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 0FCED40627F for ; Thu, 30 Jul 2026 10:59:06 +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=1785409148; cv=none; b=RFg13LQRyIfEBsj3Z0E6WaK/WdjNGstALJ0hs6wxWCJDSBpq/am6bl14IZw+3BRLaNeZeuu7pAwRHUbtVlVmQeBnZqNY0vsPy+KExtVvTl/s3/yQ3DzhKHZOnCBvQkSQ6pGf2PkxMXMqFcQL4SAqb06pMg8DAvaXh4+llW+jwj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785409148; c=relaxed/simple; bh=lpE2LRafRIuhPDmo0bGZrzEu19vDPtV4zcnqOziyOlM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HLwi3OeVYEz+zcE1pbQGOGMpU7S/djW9hWW70N/z6HkBk4XWJHsEqRKQFop63dXcK2zy6TzUUwGsXeBHhT3T3rKEJBajGRf85T2Hvohbr5KaJn0XMwdZ3+0zDONjtnL9GDn2EBidYaTWOPSTaU5b6+jzz/HCnNO1lUNAFrswj3Q= 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=NuxZ3Q32; 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="NuxZ3Q32" 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 50F3D1688; Thu, 30 Jul 2026 03:59:02 -0700 (PDT) Received: from J2N7QTR9R3.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CE8BA3F86F; Thu, 30 Jul 2026 03:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1785409146; bh=lpE2LRafRIuhPDmo0bGZrzEu19vDPtV4zcnqOziyOlM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NuxZ3Q32tEnauQVlxcyfMHdRsALV9PHFrXekVnE8oaQZeqlPONGuBBOGj2IXIRM3A uFSpDLuWffwkUty60dF7IDniHMZ3AXX08ss8xEyKbyXYt299u2F/0V0k6wZqfWOowr xVyWZ5Jo3EFC0Li/LTFuxeMtLHjts+lOjnMUWMSk= Date: Thu, 30 Jul 2026 11:59:02 +0100 From: Mark Rutland To: Vladimir Murzin Cc: linux-arm-kernel@lists.infradead.org, ada.coupriediaz@arm.com, ardb@kernel.org, catalin.marinas@arm.com, hca@linux.ibm.com, linux-kernel@vger.kernel.org, maz@kernel.org, peterz@infradead.org, ruanjinjie@huawei.com, will@kernel.org, yang@os.amperecomputing.com Subject: Re: [RFC PATCH 06/13] arm64: percpu: Add infrastructure for preemptible this_cpu_*() ops Message-ID: References: <20260728123859.2911495-1-mark.rutland@arm.com> <20260728123859.2911495-7-mark.rutland@arm.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: On Wed, Jul 29, 2026 at 03:25:52PM +0100, Vladimir Murzin wrote: > On 7/28/26 13:38, Mark Rutland wrote: > > +#define __VAL_PCPU_GPRS(pcp, off, addr) \ > > + "(" \ > > + "(.L__gpr_num_" pcp " << 0) | " \ > > + "(.L__gpr_num_" off " << 5) | " \ > > + "(.L__gpr_num_" addr " << 10)" \ > > + ")" > > Later in the patch, there is a comment stating that these registers > are not expected to overlap. I can also see that early-clobber > constraints are applied to the output registers later in the patch > series, so the code is correct. > > However, would it be possible to add assertions that detect register > overlap, perhaps something like: > > ".if (.L__gpr_num_" pcp "== .L__gpr_num_" off ") ||" \ > " (.L__gpr_num_" pcp "== .L__gpr_num_" addr ") ||" \ > " (.L__gpr_num_" off "== .L__gpr_num_" addr")" \ > ".error "inline asm registers overlap" \ > ".endif" \ That's a good idea. I've added the following: | #define __ASSERT_PCPU_GPRS_UNIQUE(pcp, off, addr) \ | ".if (" \ | "(.L__gpr_num_" pcp " == .L__gpr_num_" off ") || " \ | "(.L__gpr_num_" pcp " == .L__gpr_num_" addr ") || " \ | "(.L__gpr_num_" off " == .L__gpr_num_" addr")" \ | " )\n" \ | ".error \"PCPU GPRS overlap: {" pcp "," off "," addr "}\"\n" \ | ".endif\n" | | #define ____PCPU_GPRS_BEGIN(gprs, pcp, off, addr) \ | __DEFINE_ASM_GPR_NUMS \ | __DEFINE_ASM_GPR_ALIASES \ | __ASSERT_PCPU_GPRS_UNIQUE(pcp, off, addr) \ | " mov w" off ", #" __VAL_PCPU_GPRS(pcp, off, addr) "\n" \ | " strh w" off ", " gprs "\n" \ | __KERN_ASM_CPU_OFFSET(off) "\n" With that, we have enough ".L__gpr_num_" string concatenation that we should probably have: | #define __GPR_NUM(r) "(.L__gpr_num_" r ")" ... so I'll go add a preparatory patches adding that and cleaning up existing usage. Mark.