-
Notifications
You must be signed in to change notification settings - Fork 47
add percpu support #238
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
base: percpu
Are you sure you want to change the base?
add percpu support #238
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the hypervisor to use the external percpu crate for managing per-CPU variables, replacing the previous approach that relied on global Vec collections. The main changes include renaming the percpu module to cpu_data, introducing per-CPU event queues, and adding linker script sections to support the percpu infrastructure.
- Introduces the external
percpucrate (v0.2) to abstract per-CPU variables - Refactors event management from a global
Vec-basedEventManagerto per-CPUVecDequeinstances - Adds
.percpusections to all platform linker scripts with proper sizing
Reviewed changes
Copilot reviewed 52 out of 54 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/cpu_data.rs | New module containing PerCpu struct and related functions (renamed from percpu module) |
| src/event.rs | Refactored to use percpu-based event queues instead of global EventManager with Vec |
| src/main.rs | Added percpu initialization calls; removed event::init() call |
| src/zone.rs, src/pci/pci.rs, src/memory/mmio.rs, src/logging.rs, src/hypercall/mod.rs | Updated imports from crate::percpu to crate::cpu_data |
| src/device/irqchip/**/*.rs | Updated imports from crate::percpu to crate::cpu_data across all irqchip implementations |
| src/arch/**/*.rs | Updated imports from crate::percpu to crate::cpu_data across all architectures |
| platform/**/linker.ld | Added .percpu section definitions with CPU_NUM constant for sizing percpu areas |
| Cargo.toml | Added percpu crate dependency with arm-el2 feature |
| Cargo.lock | Added percpu and percpu_macros dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cfg-if = "1.0" | ||
| bitvec = { version="1.0.1", default-features = false, features = ["atomic", "alloc"] } | ||
| heapless = { version = "0.8.0 "} | ||
| percpu = { package = "percpu", version="0.2", features=["arm-el2"]} |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The percpu dependency is configured with the "arm-el2" feature unconditionally in the general dependencies section. This feature is specific to AArch64's Exception Level 2 (hypervisor mode) and should not be enabled for other architectures like riscv64, loongarch64, or x86_64. Consider either making this a target-specific dependency under [target.'cfg(target_arch = "aarch64")'.dependencies], or using cfg-based features to conditionally enable the appropriate percpu features for each architecture.
|
Can you explain why we need to do this? |
less code, unified per-CPU abstraction, possible performance improvement |
Uh oh!
There was an error while loading. Please reload this page.