Skip to content

Conversation

@aarkegz
Copy link
Contributor

@aarkegz aarkegz commented Dec 18, 2025

Replace #314, targeting main instead.

Copy link

Copilot AI left a 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 introduces runtime CPU number detection by replacing all direct usages of the compile-time constant axconfig::plat::CPU_NUM with a new runtime API axhal::cpu_num(). The configuration item is renamed from cpu-num to max-cpu-num to reflect that it now represents an upper limit rather than a fixed value.

Key changes:

  • Introduced axhal::cpu_num() and axhal::init_cpu_num() for runtime CPU detection
  • Renamed configuration item from plat.cpu-num to plat.max-cpu-num across all config files
  • Added ax_get_cpu_num() API to the public arceos_api::sys module
  • Updated platform crate dependencies from version 0.2 to 0.3

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
ulib/axstd/src/thread/mod.rs Updated available_parallelism() to use new ax_get_cpu_num() API
scripts/make/config.mk Renamed config key from cpu-num to max-cpu-num with updated error messages
modules/axtask/src/task.rs Changed task initialization to use runtime CPU mask via cpu_mask_full()
modules/axtask/src/run_queue.rs Replaced compile-time CPU_NUM with runtime axhal::cpu_num() for array sizing and selection
modules/axtask/src/api.rs Added CPU mask initialization logic using runtime CPU detection
modules/axtask/Cargo.toml Removed lazyinit from multitask feature dependencies
modules/axruntime/src/mp.rs Updated secondary CPU stack sizing to use MAX_CPU_NUM
modules/axruntime/src/lib.rs Added init_cpu_num() call and removed hardcoded SMP display
modules/axruntime/Cargo.toml Updated axplat dependency to version 0.3
modules/axipi/src/lib.rs Changed to use runtime axhal::cpu_num() instead of compile-time constant
modules/axhal/src/lib.rs Implemented CPU number detection with CPU_NUM atomic and initialization logic
modules/axhal/src/dummy.rs Added cpu_num() method to dummy power interface
modules/axhal/build.rs Updated linker script generation to use MAX_CPU_NUM
modules/axhal/Cargo.toml Updated platform crate dependencies to version 0.3
configs/dummy.toml Renamed cpu-num to max-cpu-num with updated documentation
configs/custom/x86_64-pc-oslab.toml Renamed cpu-num to max-cpu-num with updated documentation
api/arceos_posix_api/src/imp/sys.rs Updated sysconf to use runtime axhal::cpu_num()
api/arceos_api/src/lib.rs Added ax_get_cpu_num() to sys module API
api/arceos_api/src/imp/mod.rs Implemented ax_get_cpu_num() by re-exporting axhal::cpu_num
Makefile Updated SMP parameter documentation
Cargo.lock Updated platform crate dependencies to version 0.3

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aarkegz aarkegz merged commit bcc354a into main Dec 19, 2025
54 checks passed
@aarkegz aarkegz deleted the feat/max_cpu_num_main branch December 25, 2025 02:03
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.

4 participants