Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[task]: Introduce namespaces io manage system resources #193

Open
wants to merge 4 commits into
base: monolithic
Choose a base branch
from

Conversation

Azure-stars
Copy link
Contributor

No description provided.

@@ -186,6 +186,8 @@ pub extern "C" fn rust_main(cpu_id: usize, dtb: usize) -> ! {
info!("Primary CPU {} init OK.", cpu_id);
INITED_CPUS.fetch_add(1, Ordering::Relaxed);

ctor_bare::call_ctors();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put it before line 186, or other CPU may enter main before calling ctors.

///
/// It provides methods to lazily initialize the resource of the current thread,
/// or to share the resource with other threads.
pub struct AxResource<T>(LazyInit<Arc<T>>);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ResArc clearer and shorter?

RwLock::new(fd_table)
};
def_resource! {
#[allow(non_camel_case_types)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this?


#[ctor_bare::register_ctor]
#[cfg(feature = "fd")]
fn init_stdio() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to fs_ops.rs

@@ -15,10 +15,34 @@ fn make_disk() -> std::io::Result<RamDisk> {
Ok(RamDisk::from(&data))
}

mod axns_imp {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we only test the global namespace, can we avoid adding this code?

@@ -90,6 +90,12 @@ fn kernel_image_regions() -> impl Iterator<Item = MemRegion> {
flags: MemRegionFlags::RESERVED | MemRegionFlags::READ,
name: ".rodata",
},
MemRegion {
paddr: virt_to_phys((_sinit_array as usize).into()),
size: _einit_array as usize - _sinit_array as usize,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use __init_array_start and __init_array_end only?

@@ -37,6 +37,10 @@ pub fn new_kernel_aspace() -> AxResult<AddrSpace> {
axconfig::KERNEL_ASPACE_SIZE,
)?;
for r in axhal::mem::memory_regions() {
if r.size == 0 {
info!("Skip zero-size memory region: {:?}", r);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the empty region check in map_linear/map_alloc/unmap/protect

@@ -10,6 +10,7 @@ repository = "https://github.com/arceos-org/arceos/tree/main/modules/axfs"
documentation = "https://arceos-org.github.io/arceos/axfs/index.html"

[features]
thread-local = ["axns/thread-local"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this feature and enable axns/thread-local in arceos-posix-api/uspace only.

@@ -19,11 +19,12 @@ documentation = "https://arceos-org.github.io/arceos/arceos_posix_api/index.html
[features]
default = []

uspace = ["axns/thread-local", "axfs/thread-local", "smp", "irq", "fs", "multitask", "net", "pipe", "select", "epoll"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only use uspace = ["axns/thread-local"] here, other features should be enabled in starry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants