* [PATCH] thermal: Fix CPU mask truncation in power limit trace event
@ 2026-10-23 6:07 Hungyu Lin
0 siblings, 0 replies; only message in thread
From: Hungyu Lin @ 2026-10-23 6:07 UTC (permalink / raw)
To: rafael, daniel.lezcano
Cc: rui.zhang, lukasz.luba, javi.merino, rostedt, edubezval,
linux-pm, linux-kernel, Hungyu Lin
num_possible_cpus() counts CPUs, but CPU IDs need not be contiguous.
Using it to size the thermal_power_cpu_limit bitmap can omit CPUs with
higher IDs. For example, possible CPUs 0 and 64 produce an eight-byte
bitmap on a 64-bit system, dropping CPU 64.
Use nr_cpumask_bits for both sizing and copying the bitmap.
Fixes: 6828a4711f99 ("thermal: add trace events to the power allocator governor")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
drivers/thermal/thermal_trace.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/thermal_trace.h b/drivers/thermal/thermal_trace.h
index df8f4edd6068..2f953fd8289d 100644
--- a/drivers/thermal/thermal_trace.h
+++ b/drivers/thermal/thermal_trace.h
@@ -119,7 +119,7 @@ TRACE_EVENT(thermal_power_cpu_limit,
TP_ARGS(cpus, freq, cdev_state, power),
TP_STRUCT__entry(
- __bitmask(cpumask, num_possible_cpus())
+ __bitmask(cpumask, nr_cpumask_bits)
__field(unsigned int, freq )
__field(unsigned long, cdev_state)
__field(u32, power )
@@ -127,7 +127,7 @@ TRACE_EVENT(thermal_power_cpu_limit,
TP_fast_assign(
__assign_bitmask(cpumask, cpumask_bits(cpus),
- num_possible_cpus());
+ nr_cpumask_bits);
__entry->freq = freq;
__entry->cdev_state = cdev_state;
__entry->power = power;
base-commit: 503bb6e70bbf6304b8113373d09dfffcc4aa9183
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-23 6:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 6:07 [PATCH] thermal: Fix CPU mask truncation in power limit trace event Hungyu Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®