2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/drivers/cpufreq
Viresh Kumar 33db8c97b4 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: 8961b8cb30 ("rust: cpumask: Add initial abstractions")
Reported-by: Miguel Ojeda <ojeda@kernel.org>
Closes: https://lore.kernel.org/rust-for-linux/CANiq72k3ozKkLMinTLQwvkyg9K=BeRxs1oYZSKhJHY-veEyZdg@mail.gmail.com/
Reported-by: Andreas Hindborg <a.hindborg@kernel.org>
Closes: https://lore.kernel.org/all/87qzzy3ric.fsf@kernel.org/
Suggested-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
2025-06-12 10:31:28 +05:30
..
acpi-cpufreq.c Merge branch 'pm-cpufreq' 2025-05-30 20:11:09 +02:00
airoha-cpufreq.c cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver 2025-01-17 09:05:07 +05:30
amd_freq_sensitivity.c x86/msr: Rename 'rdmsrl_safe()' to 'rdmsrq_safe()' 2025-04-10 11:58:38 +02:00
amd-pstate-trace.c cpufreq: amd-pstate: Add trace for AMD P-State module 2021-12-30 18:51:39 +01:00
amd-pstate-trace.h cpufreq/amd-pstate: Move all EPP tracing into *_update_perf and *_set_epp functions 2025-03-06 13:01:25 -06:00
amd-pstate-ut.c Power management updates for 6.16-rc1 2025-05-27 16:48:47 -07:00
amd-pstate.c Power management updates for 6.16-rc1 2025-05-27 16:48:47 -07:00
amd-pstate.h amd-pstate-ut: Reset amd-pstate driver mode after running selftests 2025-05-05 12:07:42 -05:00
apple-soc-cpufreq.c cpufreq: apple-soc: Fix null-ptr-deref in apple_soc_cpufreq_get_rate() 2025-04-10 10:07:32 +05:30
armada-8k-cpufreq.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
armada-37xx-cpufreq.c cpufreq: enable 1200Mhz clock speed for armada-37xx 2025-02-19 11:21:46 +05:30
bmips-cpufreq.c cpufreq: bmips: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:11 +05:30
brcmstb-avs-cpufreq.c cpufreq: brcmstb: Stop setting common freq attributes 2025-02-07 09:45:11 +05:30
cppc_cpufreq.c cpufreq: CPPC: Add support for autonomous selection 2025-05-21 22:47:44 +02:00
cpufreq_conservative.c cpufreq: conservative: Simplify the condition of storing 'down_threshold' 2023-10-06 21:55:13 +02:00
cpufreq_governor_attr_set.c cpufreq: Move to_gov_attr_set() to cpufreq.h 2022-02-04 19:22:34 +01:00
cpufreq_governor.c cpufreq: governor: Fix negative 'idle_time' handling in dbs_update() 2025-02-20 20:27:19 +01:00
cpufreq_governor.h cpufreq: governor: Use kobject release() method to free dbs_data 2022-04-13 15:22:41 +02:00
cpufreq_ondemand.c cpufreq: Fix setting policy limits when frequency tables are used 2025-04-28 14:36:41 +02:00
cpufreq_ondemand.h
cpufreq_performance.c cpufreq: Introduce CPUFREQ_GOV_STRICT_TARGET 2020-11-10 18:31:17 +01:00
cpufreq_powersave.c cpufreq: Introduce CPUFREQ_GOV_STRICT_TARGET 2020-11-10 18:31:17 +01:00
cpufreq_stats.c cpufreq: stats: Fix buffer overflow detection in trans_stats() 2023-10-24 22:02:06 +02:00
cpufreq_userspace.c cpufreq: userspace: Move is_managed indicator into per-policy structure 2023-10-06 22:01:26 +02:00
cpufreq-dt-platdev.c cpufreq: Add SM8650 to cpufreq-dt-platdev blocklist 2025-04-08 11:36:32 +05:30
cpufreq-dt.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
cpufreq-dt.h
cpufreq-nforce2.c cpufreq: nforce2: Remove empty exit() callback 2024-07-05 11:41:30 +05:30
cpufreq.c cpufreq: Update sscanf() to kstrtouint() 2025-05-21 22:27:36 +02:00
davinci-cpufreq.c cpufreq: davinci: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
e_powersaver.c x86/msr: Rename 'wrmsrl()' to 'wrmsrq()' 2025-04-10 11:58:33 +02:00
elanfreq.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
freq_table.c cpufreq: Fix setting policy limits when frequency tables are used 2025-04-28 14:36:41 +02:00
gx-suspmod.c
highbank-cpufreq.c cpufreq: Add __init annotation to module init funcs 2022-09-26 11:15:04 +05:30
imx6q-cpufreq.c cpufreq: imx6q: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
imx-cpufreq-dt.c cpufreq: Switch back to struct platform_driver::remove() 2024-10-28 12:24:39 +01:00
intel_pstate.c Power management updates for 6.16-rc1 2025-05-27 16:48:47 -07:00
Kconfig cpufreq: Add Rust-based cpufreq-dt driver 2025-05-20 11:21:11 +05:30
Kconfig.arm cpufreq: fix compile-test defaults 2025-04-17 13:36:29 +05:30
Kconfig.powerpc cpufreq: ppc_cbe: Remove powerpc Cell driver 2025-02-26 21:15:09 +05:30
Kconfig.x86 cpufreq: Introduce an optional cpuinfo_avg_freq sysfs entry 2025-02-17 18:09:31 +00:00
kirkwood-cpufreq.c cpufreq: kirkwood: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
longhaul.c x86/msr: Rename 'wrmsrl()' to 'wrmsrq()' 2025-04-10 11:58:33 +02:00
longhaul.h
longrun.c
loongson2_cpufreq.c cpufreq: loongson: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
loongson3_cpufreq.c cpufreq: loongson: Set .set_boost directly 2025-02-07 09:45:15 +05:30
Makefile cpufreq: Add Rust-based cpufreq-dt driver 2025-05-20 11:21:11 +05:30
mediatek-cpufreq-hw.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
mediatek-cpufreq.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
mvebu-cpufreq.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
omap-cpufreq.c cpufreq: omap: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
p4-clockmod.c cpufreq: p4: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
pasemi-cpufreq.c cpufreq: pasemi: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
pcc-cpufreq.c cpufreq: Switch back to struct platform_driver::remove() 2024-10-28 12:24:39 +01:00
pmac32-cpufreq.c cpufreq: pmac: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:13 +05:30
pmac64-cpufreq.c cpufreq: pmac: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:13 +05:30
powernow-k6.c cpufreq: powernow: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:13 +05:30
powernow-k7.c x86/msr: Rename 'wrmsrl()' to 'wrmsrq()' 2025-04-10 11:58:33 +02:00
powernow-k7.h
powernow-k8.c powernow: use pr_info_once 2025-05-11 17:54:05 -07:00
powernow-k8.h
powernv-cpufreq.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
pxa2xx-cpufreq.c cpufreq: pxa3: move clk register access to clk driver 2022-05-07 22:55:49 +02:00
pxa3xx-cpufreq.c cpufreq: pxa3: move clk register access to clk driver 2022-05-07 22:55:49 +02:00
qcom-cpufreq-hw.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
qcom-cpufreq-nvmem.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
qoriq-cpufreq.c cpufreq: qoriq: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:13 +05:30
raspberrypi-cpufreq.c cpufreq: Switch back to struct platform_driver::remove() 2024-10-28 12:24:39 +01:00
rcpufreq_dt.rs rust: Use CpuId in place of raw CPU numbers 2025-06-12 10:31:28 +05:30
s3c64xx-cpufreq.c cpufreq: s3c64xx: Fix compilation warning 2025-01-23 20:47:32 +01:00
s5pv210-cpufreq.c cpufreq: Introducing CPUFREQ_RELATION_E 2021-10-05 16:33:05 +02:00
sa1110-cpufreq.c ARM: sa1100: remove unused board files 2023-01-12 10:53:12 +01:00
sc520_freq.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
scmi-cpufreq.c cpufreq: scmi: Skip SCMI devices that aren't used by the CPUs 2025-05-20 11:24:18 +05:30
scpi-cpufreq.c cpufreq: scpi: Fix null-ptr-deref in scpi_cpufreq_get_rate() 2025-04-10 10:09:03 +05:30
sh-cpufreq.c cpufreq: sh: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:13 +05:30
sparc-us2e-cpufreq.c cpufreq: sparc: change kzalloc to kcalloc 2024-12-24 09:48:58 +05:30
sparc-us3-cpufreq.c cpufreq: sparc: change kzalloc to kcalloc 2024-12-24 09:48:58 +05:30
spear-cpufreq.c cpufreq: spear: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:13 +05:30
speedstep-centrino.c cpufreq: speedstep: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:14 +05:30
speedstep-ich.c cpufreq: speedstep: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:14 +05:30
speedstep-lib.c cpufreq: speedstep: remove unneeded semicolon 2020-10-28 18:04:07 +01:00
speedstep-lib.h
speedstep-smi.c cpufreq: speedstep: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:14 +05:30
sti-cpufreq.c cpufreq: Use of_property_present() 2024-08-07 12:11:45 +05:30
sun50i-cpufreq-nvmem.c cpufreq: sun50i: prevent out-of-bounds access 2025-04-08 11:35:30 +05:30
tegra20-cpufreq.c Devicetree updates for v6.4, part 2: 2023-04-27 10:09:05 -07:00
tegra124-cpufreq.c cpupfreq: tegra124: eliminate uses of of_node_put() 2024-04-19 11:55:44 +05:30
tegra186-cpufreq.c cpufreq: tegra186: Share policy per cluster 2025-03-10 11:20:05 +05:30
tegra194-cpufreq.c cpufreq: tegra: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:14 +05:30
ti-cpufreq.c cpufreq: ti-cpufreq: Remove revision offsets in AM62 family 2024-10-10 12:54:42 +05:30
vexpress-spc-cpufreq.c cpufreq: vexpress: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:14 +05:30
virtual-cpufreq.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30