From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1492E3F0A99 for ; Tue, 2 Jun 2026 15:48:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780415332; cv=none; b=fenWl7xUKwPM3LIbAsEb1XC6FwtH7MdxDFWVLXFm8CGJLWVpWeXKDqkdHH6a8JhktF48enQE/popzX3Bqtjv3hD0PrTuliBe3jgCtJ/ZMfuP3duw/8D53Kz/9FhvE6e8NF6TpE+lIm8vzJQ2F+UauTislLLCnSrSdQb43jpcICs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780415332; c=relaxed/simple; bh=nHus5Ro3nDGtQX8vZnUZpgQi9wlcfRYljtOsSzl7VF8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=S9yr3OVIRO5py+Wo23EE3ieN9AnNJdnpZO3C6zbm/FkWwi08OWVtM6m/XQDAIXHm6BLe+z/7/ZsTFBCZJ27aaRId9qUHTB8Tm8dgUWxi1y5SveybEVVKKaWq7VF+d4rXx3bmLaJ+GqhLSb7WTFTtupPmS/a10hJfzsikCxDtw+s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=aRYRL+m7; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="aRYRL+m7" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 67BD23593; Tue, 2 Jun 2026 08:48:44 -0700 (PDT) Received: from [10.57.23.208] (unknown [10.57.23.208]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 41D543F7D8; Tue, 2 Jun 2026 08:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1780415329; bh=nHus5Ro3nDGtQX8vZnUZpgQi9wlcfRYljtOsSzl7VF8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=aRYRL+m7pib679WObYThgfpkkq7IZXrWIMDe4Bn9kf/cNblMMPmpREr9hM/2VAlzK AolkM0UheNJiTo5dHWqdjmREm9p7r3ccxJNEK3Ahl+G45Px/lLhurgU2wVonUcZNdO RmJIWVyrIJBHLzsaDltNXl6urGe695Zw6Xc521Kc= Message-ID: <41ab4dfb-b91c-46df-99a0-de36686c8fea@arm.com> Date: Tue, 2 Jun 2026 16:48:43 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] virt: arm-cca-guest: use raw variant of smp_processor_id() in arm_cca_report_new() Content-Language: en-GB To: Will Deacon , Kohei Enju Cc: Catalin Marinas , Sami Mujawar , Gavin Shan , Steven Price , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260519101217.155740-1-enju.kohei@fujitsu.com> From: Suzuki K Poulose In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Will On 02/06/2026 12:01, Will Deacon wrote: > On Tue, May 19, 2026 at 07:12:08PM +0900, Kohei Enju wrote: >> With CONFIG_DEBUG_PREEMPT=y, 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. > > That's pretty disgusting imo so I'd like to see some more justification > for this approach. > >> 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. > > Why shouldn't it block CPU hotplug events? What happens if the CPU goes > offline and comes back online again during the loop of continue calls? It need not. It can continue the calls. The RMM keeps track of the internal progress in the "REC" object for this "VCPU". Hotplug ON/OFF doesn't change the REC object in CCA Guest. So, a REC can come back and execute it. But the Linux could fail the operation if the CPU isn't available for fetching the report, after we do a RSI_ATTEST_TOKEN_INIT. Suzuki > > Will