Skip to content

[enhancement] improve multi-core support #41

Description

@AsakuraMizu

In #25, basic smp support is enabled. However, there are still issues:

  • (Resolved by fix(smp): move accessing_user_memory into thread data #103) ACCESSING_USER_MEM should be a variable per CPU or per task. Otherwise, if the kernel accesses user memory when it shouldn't, it won't be detected correctly.

    StarryOS/core/src/mm.rs

    Lines 353 to 367 in 67a042f

    static ACCESSING_USER_MEM: AtomicBool = AtomicBool::new(false);
    /// Enables scoped access into user memory, allowing page faults to occur inside
    /// kernel.
    pub fn access_user_memory<R>(f: impl FnOnce() -> R) -> R {
    ACCESSING_USER_MEM.store(true, Ordering::Release);
    let result = f();
    ACCESSING_USER_MEM.store(false, Ordering::Release);
    result
    }
    /// Check if the current thread is accessing user memory.
    pub fn is_accessing_user_memory() -> bool {
    ACCESSING_USER_MEM.load(Ordering::Acquire)
    }
  • Sync page table and TLB across all cores
    TODO: add more description

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions