Re: [PATCH v1] virt: arm-cca-guest: use raw variant of smp_processor_id() in arm_cca_report_new()
From: Gavin Shan
Date: Mon May 18 2026 - 00:29:00 EST
On 5/18/26 1:31 PM, Kohei Enju wrote:
With CONFIG_DEBUG_PREEMPT=y, smp_processor_id() becomes an alias ofReviewed-by: Gavin Shan <gshan@xxxxxxxxxx>
debug_smp_processor_id(). This debug function complains when certain
conditions that ensure CPU ID stability are not met, specifically when
it's called from a preemptible context.
In arm_cca_report_new(), which runs in a preemptible context,
smp_processor_id() triggers a splat [0] due to this.
However, the CPU ID obtained here is used as the target CPU for
smp_call_function_single() to designate a specific CPU for subsequent
operations, not to assert that the current thread will continue to
execute on the same CPU. Therefore, snapshotting the CPU ID itself is
correct, and thus there's no actual harm except for the splat.
Use raw_smp_processor_id() instead, to directly retrieve the current CPU
ID without the debug checks, avoiding the unnecessary warning message
while preserving the correct functional behavior.
[0]
BUG: using smp_processor_id() in preemptible [00000000] code: cca-workload-at/134
caller is debug_smp_processor_id+0x20/0x2c
CPU: 0 UID: 0 PID: 134 Comm: cca-workload-at Not tainted 7.0.0-rc1-gc74a64d12073 #1 PREEMPT
Hardware name: linux,dummy-virt (DT)
Call trace:
[...]
check_preemption_disabled+0xf8/0x100
debug_smp_processor_id+0x20/0x2c
arm_cca_report_new+0x54/0x230
tsm_report_read+0x184/0x260
tsm_report_outblob_read+0x18/0x38
configfs_bin_read_iter+0xf4/0x1dc
vfs_read+0x230/0x31c
[...]
Fixes: 7999edc484ca ("virt: arm-cca-guest: TSM_REPORT support for realms")
Signed-off-by: Kohei Enju <enju.kohei@xxxxxxxxxxx>
---
drivers/virt/coco/arm-cca-guest/arm-cca-guest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)