From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from esa7.hc1455-7.c3s2.iphmx.com (esa7.hc1455-7.c3s2.iphmx.com [139.138.61.252]) (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 1E580282F02 for ; Tue, 19 May 2026 02:13:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.138.61.252 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779156789; cv=none; b=SLQNC52RpVwzhD3yyYSgvT16yYlzSgfSJOjv3SWDbrLgYnfsw0BR98YJ2gmPSUFRMTulVIdHwt2F08gMJKZg5dMkI2D4KYEoA2Q17gCtEBhtnoLJ6J/mupZsWHJO8HFvKAAb1HdCyYCEGe3KiZEj6oztnMJhP/NoafeMurV2tKA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779156789; c=relaxed/simple; bh=RptmMw58B7z2kp+LpO4yKtCECQzw5sRd637q2vcLyXs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dgFPNLhBS2vPG89IocDEtMbMTOCDyT6zxd7mCFxO7Ci8jjgCY8YLgUWZPRzM+/6mvBa67c8NnGsy4iRnEKFnU8y1CDsD/dC5IBNrwX5RLWJGRIVguPipOA/m9E55mqtn/eXdz+gWr+aE0RShjCJI+4XhyiI/LZWmlFYbhLhdvDc= 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=pOmISCh0; arc=none smtp.client-ip=139.138.61.252 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="pOmISCh0" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1779156787; x=1810692787; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=RptmMw58B7z2kp+LpO4yKtCECQzw5sRd637q2vcLyXs=; b=pOmISCh0icnarVoXAf6JsaKyrihNpzAbEWuzKvj7Pb71CCgDQfkuIJ1f u5bePhf2s17ImfC5XuMyY5C0l5QgCmXnfEHi4e6JVhUXV3yIFW2k/zU3e 15uzz9B/8kfgKZNS0DaKb58q55/ENrnr17Ugumfjww2n5LhpDMm/0N8hp y1DarjXU7WfIeEgOgzca0qS8iKV1xoNOTVxWM7jN75j2mjxfAMjovfZXi 66EN0+BkxO+YnIaq/RgL4MDONIWkT3r2436CWDcp4vRd49UtU4Y+XQcW9 2PKE/Xp6d3fzWs3qMTL4PG33JLiAn41kbaFDrneHd7dYaD8mwpMBqtY3K Q==; X-CSE-ConnectionGUID: cizK6cVaTTCNs5Fq812Sfw== X-CSE-MsgGUID: e02wr0MkRg+cqQBcDd6lpA== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="219916298" X-IronPort-AV: E=Sophos;i="6.23,243,1770562800"; d="scan'208";a="219916298" Received: from gmgwuk01.global.fujitsu.com ([172.187.114.235]) by esa7.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2026 11:12:59 +0900 Received: from az2uksmgm1.o.css.fujitsu.com (unknown [10.151.22.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 gmgwuk01.global.fujitsu.com (Postfix) with ESMTPS id C8DF2C0056B for ; Tue, 19 May 2026 02:12:59 +0000 (UTC) Received: from az2nlsmom4.fujitsu.com (az2nlsmom4.o.css.fujitsu.com [10.150.26.201]) (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 az2uksmgm1.o.css.fujitsu.com (Postfix) with ESMTPS id 81027861255 for ; Tue, 19 May 2026 02:12:59 +0000 (UTC) Received: from FCCLS0092175.localdomain (unknown [10.8.207.142]) by az2nlsmom4.fujitsu.com (Postfix) with SMTP id 7B3AB20000AA; Tue, 19 May 2026 02:12:55 +0000 (UTC) Date: Tue, 19 May 2026 11:12:52 +0900 From: Kohei Enju To: Catalin Marinas Cc: Will Deacon , Sami Mujawar , Gavin Shan , Steven Price , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] virt: arm-cca-guest: use raw variant of smp_processor_id() in arm_cca_report_new() Message-ID: References: <20260518033157.1865498-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=utf-8 Content-Disposition: inline In-Reply-To: On 05/18 18:21, Catalin Marinas wrote: > Hi Kohei, > > On Mon, May 18, 2026 at 10:38:53PM +0900, Kohei Enju wrote: > > On 05/18 13:33, Catalin Marinas wrote: > > > On Mon, May 18, 2026 at 12:31:31PM +0900, Kohei Enju wrote: > > > > 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..2d450caee3e4 100644 > > > > --- a/drivers/virt/coco/arm-cca-guest/arm-cca-guest.c > > > > +++ b/drivers/virt/coco/arm-cca-guest/arm-cca-guest.c > > > > @@ -108,7 +108,7 @@ static int arm_cca_report_new(struct tsm_report *report, void *data) > > > > * allocate outblob based on the returned value from the 'init' > > > > * call and that cannot be done in an atomic context. > > > > */ > > > > - cpu = smp_processor_id(); > > > > + cpu = raw_smp_processor_id(); > > > > > > That's just hiding the warning which might be genuine, irrespective of > > > what the comment says. Sashiko has some good points: > > > > > > https://sashiko.dev/#/patchset/20260518033157.1865498-1-enju.kohei@fujitsu.com > > > > > > Basically what guarantees that the cpu won't go offline? Can we use > > > migrate_disable() and ignore the smp_call_function_single() altogether? > > > It looks like a hack anyway. > [...] > > You've raised a very valid point about raw_smp_processor_id() > > potentially hiding a genuine issue. I agree this would be a concern in > > most contexts. > > > > However, this implementation was intentionally designed not to block CPU > > hotplug: > > https://lore.kernel.org/linux-arm-kernel/7a83461d-40fd-4e61-8833-5dae2abaf82b@arm.com/ > > > > As mentioned in the thread above, the potential failure from the target > > CPU going offline (resulting in -ENXIO) is an expected and tolerated > > condition in this path. > > Using migrate_disable() would go against the non-blocking design goal. > > > > Given the context, the debug warning looks false positive for our > > specific use case to me, and I believe raw_smp_processor_id() correctly > > reflects the design intent by simply acquiring a CPU number without > > debug checks. > > Thanks, I wasn't aware of the old discussion. If user-space can > tolerate, than it's fine. > > Would you mind updating the comment above the changed line? It talks > about not allocating memory in atomic context, so migrate_disable() > would solve this. Just mention that it can't block CPU hotplug events > either and user-space can handle spurious errors. Sure, I'm happy to do. Thank you for the suggestion. I'll work on v2. Thanks, Kohei > > With that: > > Reviewed-by: Catalin Marinas >