diff options
| author | Viresh Kumar <[email protected]> | 2025-06-09 08:56:54 +0000 |
|---|---|---|
| committer | Viresh Kumar <[email protected]> | 2025-06-12 05:01:28 +0000 |
| commit | 33db8c97b4cfa0328054fb755dfbcd6e7f3c7a9d (patch) | |
| tree | 3db65f245ab9adc5b35895cae803528edefd43a6 /rust/helpers | |
| parent | rust: cpu: Introduce CpuId abstraction (diff) | |
| download | kernel-33db8c97b4cfa0328054fb755dfbcd6e7f3c7a9d.tar.gz kernel-33db8c97b4cfa0328054fb755dfbcd6e7f3c7a9d.zip | |
rust: Use CpuId in place of raw CPU numbers
Use the newly defined `CpuId` abstraction instead of raw CPU numbers.
This also fixes a doctest failure for configurations where `nr_cpu_ids <
4`.
The C `cpumask_{set|clear}_cpu()` APIs emit a warning when given an
invalid CPU number — but only if `CONFIG_DEBUG_PER_CPU_MAPS=y` is set.
Meanwhile, `cpumask_weight()` only considers CPUs up to `nr_cpu_ids`,
which can cause inconsistencies: a CPU number greater than `nr_cpu_ids`
may be set in the mask, yet the weight calculation won't reflect it.
This leads to doctest failures when `nr_cpu_ids < 4`, as the test tries
to set CPUs 2 and 3:
rust_doctest_kernel_cpumask_rs_0.location: rust/kernel/cpumask.rs:180
rust_doctest_kernel_cpumask_rs_0: ASSERTION FAILED at rust/kernel/cpumask.rs:190
Fixes: 8961b8cb3099 ("rust: cpumask: Add initial abstractions")
Reported-by: Miguel Ojeda <[email protected]>
Closes: https://lore.kernel.org/rust-for-linux/CANiq72k3ozKkLMinTLQwvkyg9K=BeRxs1oYZSKhJHY-veEyZdg@mail.gmail.com/
Reported-by: Andreas Hindborg <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Suggested-by: Boqun Feng <[email protected]>
Signed-off-by: Viresh Kumar <[email protected]>
Reviewed-by: Boqun Feng <[email protected]>
Diffstat (limited to 'rust/helpers')
0 files changed, 0 insertions, 0 deletions
