Re: [PATCH v3] virt: arm-cca-guest: use migrate_disable() for attestation token requests

From: Gavin Shan

Date: Thu Jul 09 2026 - 00:06:44 EST


On 6/12/26 9:09 PM, Kohei Enju wrote:
The RSI attestation token init and continue calls must be issued from
the same CPU. arm_cca_report_new() currently snapshots the CPU number
and uses smp_call_function_single() to issue those calls on that CPU.

With CONFIG_DEBUG_PREEMPT=y, the smp_processor_id() call used for the
snapshot triggers a debug splat [0] because it runs in preemptible
context. The snapshot does not pin the task to that CPU; it is only used
to choose the target CPU for smp_call_function_single(), which can fail
if that CPU is no longer available.

Use migrate_disable() and issue the token init and continue operations
directly, without the smp_call_function_single() callbacks. This keeps
the token request sequence on the same CPU while preserving a sleepable
context for the GFP_KERNEL allocations needed after the init call.

[0]
BUG: using smp_processor_id() in preemptible [00000000] code: cca-workload-at/264
caller is debug_smp_processor_id+0x20/0x30
CPU: 0 UID: 0 PID: 264 Comm: cca-workload-at Not tainted 7.1.0-rc1-00044-g55542ab273f2 #80 PREEMPT(lazy)
Hardware name: linux,dummy-virt (DT)
Call trace:
[...]
check_preemption_disabled+0xd8/0xf8
debug_smp_processor_id+0x20/0x30
arm_cca_report_new+0x48/0x278
tsm_report_read+0x154/0x1f8
tsm_report_outblob_read+0x20/0x38
configfs_bin_read_iter+0x118/0x208
vfs_read+0x220/0x318
[...]

Fixes: 7999edc484ca ("virt: arm-cca-guest: TSM_REPORT support for realms")
Signed-off-by: Kohei Enju <enju.kohei@xxxxxxxxxxx>
---
Changes:
v3:
- Switch to migrate_disable() and call RSI directly, removing
smp_call_function_single() (Will, Suzuki)
- Remove arm_cca_attestation_init() helper and unused fields from
arm_cca_token_info
- Drop Reviewed-by tags since the approach changed from v2
v2: https://lore.kernel.org/linux-arm-kernel/20260519101217.155740-1-enju.kohei@xxxxxxxxxxx/
- Add comment about why this path doesn't use migrate_disable()
v1: https://lore.kernel.org/linux-arm-kernel/20260518033157.1865498-1-enju.kohei@xxxxxxxxxxx/
---
.../virt/coco/arm-cca-guest/arm-cca-guest.c | 97 +++++++------------
1 file changed, 36 insertions(+), 61 deletions(-)

Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>