From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 D9381380FEC for ; Tue, 2 Jun 2026 11:01:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780398071; cv=none; b=PN9/277AsYlMd6TNX/uv7JetTbicCtRspPEkpELbD0D2+sGAVm8QGZaDnzLDiRb6vmGikhtVLCh0a/mRtfM6EMmWr4VNY5HlCbfOX9+QwBirIzbhlX2DyhsdiKzKyMMFky5uQ15/Qdws9c5vsDNKz9saqvkSRbci6aJQ9MD9jrA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780398071; c=relaxed/simple; bh=5/VNp3ZtQg3YXLRUQk1ByS8NjbzC46+DL4AvWfQJ6p8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gIq+8qHOXgzSwNWD5EsB+7C1aZOvEQmTQr2OPqPbjYCcdlZeIcmd0Dz3iWT768vcr/2UWJmDbsxjDIYghN+oxaI1k5ZS0jD5sBRv6rWmSZyHkCAykJyCW+CrFfHWkZieOnD7euK4YY/0ZZZJHsYcLK1Jucn9KY1h4tPfosLZqO8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CY1ggTCW; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CY1ggTCW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 813CC1F0089A; Tue, 2 Jun 2026 11:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780398069; bh=HF0gJsXf4ZRvJK6q3TUKZ70SjvpLfDlE5OPGUg+NXCw=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=CY1ggTCWVpa6Zin+p+oIadJ1UBlPgT9j4WFmd9F+IuKVnl1NjTceWNeSbN0kd5wcX UM+P+HuvUsjMtWgNi3EC9NyoPWOqjJS8T8u4JPJeoT9YW67fJF4p3tm9MkRo8gGPW+ 7i/26zH5RfFJO/bZb+fjxHvGfnPxFsLaw+3DbY0EJcEUCZxwASC5EWvKSTtPL+rIec 1AibHH56/Cfn5FVG2xB+2ezw7ZlxR5qsu68uY1Bta0OPkkCvs3fyQx8M27PUwzgFpH YAofl47SlWySX71huCaRhV05pSSL6Be323cUokNcffXsgUSEDhj7xQhMOz8mWBvPYe 7XW3rx8ihFi2w== Date: Tue, 2 Jun 2026 12:01:04 +0100 From: Will Deacon To: Kohei Enju Cc: Catalin Marinas , Sami Mujawar , Gavin Shan , Steven Price , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] virt: arm-cca-guest: use raw variant of smp_processor_id() in arm_cca_report_new() Message-ID: References: <20260519101217.155740-1-enju.kohei@fujitsu.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260519101217.155740-1-enju.kohei@fujitsu.com> 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? Will