From nobody Mon May 25 07:55:39 2026 Received: from esa3.hc1455-7.c3s2.iphmx.com (esa3.hc1455-7.c3s2.iphmx.com [207.54.90.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41CFA34EF0F for ; Tue, 19 May 2026 10:12:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.54.90.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779185549; cv=none; b=Ekx5AaMxqyoOEtqxqV4JRXLNwpz6Dx94F2xD9uRJskdW27/HDWvxE//tODfGNKtSKI3XuUCSVg3Sw8/jkwr/E62nRrY/ypcq0qxKfGVfMamgCjrlmFWeIl+zOjGqAXtinkMRg1NnH1s2RRJy5NAg0TRTFBvpyUd69ByIh24S8IU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779185549; c=relaxed/simple; bh=XbXV/u59QlTB1yroWERolTZUVyTmPxGfLT6lIIG12OI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=L8P0kjVf/SXeySM+Qhf06Tmj4iTxvG6LxVnkjNCv3e9qmAIOmxaMzCBbYirRC6Am05h4FL7m6OX+3/jSxxzqGk3ImRrTBtSZ7Y+hB6YgMKhlG1t+J40m8e2OORoL3xPQ+kgf0Hbgks2lG/Rt+7Z3lrl58CfH/T4CxcB73D3g57w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fujitsu.com; spf=pass smtp.mailfrom=fujitsu.com; dkim=pass (2048-bit key) header.d=fujitsu.com header.i=@fujitsu.com header.b=JCDx824l; arc=none smtp.client-ip=207.54.90.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fujitsu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fujitsu.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fujitsu.com header.i=@fujitsu.com header.b="JCDx824l" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1779185547; x=1810721547; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=XbXV/u59QlTB1yroWERolTZUVyTmPxGfLT6lIIG12OI=; b=JCDx824lXmazPDAs9NF+7WWGTgZ3RXPab8VmVl+rwYLExXW+/Io9eqRl en3drSKg1cSqyvUopnsGgpWicuz3a6mAVyFSfEUFkGT6gd4l2j9pt8ZdW 7A2WPPxAIYBCRLPmrXoKRTze/GnITCFTYuato2MNa3ZLE6iqegri9AWG9 j9zwZAlLhuSeemXVLtleOKK00AyDoltIMmOA28IvrKDaUJycn0GNs0057 c8OslzXjcttxx3Ez+ZWaJaLk/2oP7NFFHbh+kT+0oS/msvJhVNDuE0gnK ytfJEgC4jikOuM5wwRsAi6t7LMHn6xGwsOPZP5PAZiT1JzyDxrVCnazW9 g==; X-CSE-ConnectionGUID: Zd1G0uRrS16NDN3X4eo0JA== X-CSE-MsgGUID: qpSim/zERfGxWAy4vlaMhA== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="241054680" X-IronPort-AV: E=Sophos;i="6.23,243,1770562800"; d="scan'208";a="241054680" Received: from gmgwuk01.global.fujitsu.com ([172.187.114.235]) by esa3.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2026 19:12:25 +0900 Received: from az2uksmgm2.o.css.fujitsu.com (unknown [10.151.22.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by gmgwuk01.global.fujitsu.com (Postfix) with ESMTPS id 63FDE1002B9C for ; Tue, 19 May 2026 10:12:25 +0000 (UTC) Received: from az2nlsmom1.o.css.fujitsu.com (az2nlsmom1.o.css.fujitsu.com [10.150.26.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by az2uksmgm2.o.css.fujitsu.com (Postfix) with ESMTPS id 1AAD9181AA51 for ; Tue, 19 May 2026 10:12:25 +0000 (UTC) Received: from sm-x86-amd03.ssoft.mng.com (sm-x86-stp01.soft.fujitsu.com [10.124.178.20]) by az2nlsmom1.o.css.fujitsu.com (Postfix) with ESMTP id E62508300B2; Tue, 19 May 2026 10:12:20 +0000 (UTC) From: Kohei Enju To: Catalin Marinas , Will Deacon Cc: Sami Mujawar , Gavin Shan , Steven Price , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Kohei Enju Subject: [PATCH v2] virt: arm-cca-guest: use raw variant of smp_processor_id() in arm_cca_report_new() Date: Tue, 19 May 2026 19:12:08 +0900 Message-ID: <20260519101217.155740-1-enju.kohei@fujitsu.com> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With CONFIG_DEBUG_PREEMPT=3Dy, smp_processor_id() becomes an alias of 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. Note that while migrate_disable() would pin the task to the current CPU, this path should not block CPU hotplug events. Therefore, we snapshot the current CPU ID and accept that smp_call_function_single() may fail if the CPU goes offline. [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-gc74a64= d12073 #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 [...] Reviewed-by: Gavin Shan Reviewed-by: Suzuki K Poulose Reviewed-by: Catalin Marinas Fixes: 7999edc484ca ("virt: arm-cca-guest: TSM_REPORT support for realms") Signed-off-by: Kohei Enju --- drivers/virt/coco/arm-cca-guest/arm-cca-guest.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/virt/coco/arm-cca-guest/arm-cca-guest.c b/drivers/virt= /coco/arm-cca-guest/arm-cca-guest.c index 0c9ea24a200c..b463bf35bf30 100644 --- a/drivers/virt/coco/arm-cca-guest/arm-cca-guest.c +++ b/drivers/virt/coco/arm-cca-guest/arm-cca-guest.c @@ -107,8 +107,15 @@ static int arm_cca_report_new(struct tsm_report *repor= t, void *data) * instead of simply calling get_cpu() because of the need to * allocate outblob based on the returned value from the 'init' * call and that cannot be done in an atomic context. + * + * While migrate_disable() would pin the task to the current CPU, + * this path should not block CPU hotplug events. Therefore, we + * snapshot the current CPU ID and accept that + * smp_call_function_single() may fail if the CPU goes offline. + * Any resulting error is propagated to user-space, which is + * expected to handle it. */ - cpu =3D smp_processor_id(); + cpu =3D raw_smp_processor_id(); =20 info.challenge =3D desc->inblob; info.challenge_size =3D desc->inblob_len; --=20 2.47.3