From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 9E4EA3C3BF4 for ; Tue, 10 Mar 2026 10:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773138470; cv=none; b=aAMGClwmp9HN4avavi6GKzjno0rz0yKBpc+iqtXWLaTMpGpXdnDJv/CYSrbSy1SPJcIP9gfmlFyhKB/vGR80n0aFIAy2+znKBbQIhV6n1vZgZQab/fmENm4xpWuIj+z3B9VVqSeuo00e5gL86kvuVjWGw/1HFjhFhUGAhgyKFBc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773138470; c=relaxed/simple; bh=zYT5oXhJQSW9vvkq128LOZ1aVofYOzsuinV+ao0PPdo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Zte3cfojGVUEYP5wxB1w/sXTzL2VV9MK8yvHcsWPe6U0R21mWI/KxpQi7L/riqcUIt7yPl2bcqqPA0qHCdnnfmYKbbMP2Q4HthrjMWB/dImRI+nmxrQBobwpIV7tWmN51KpVcEa/dzguIeYsfplepgZX2vF64hrOxM/nLBT43Eo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=SAP5p6QD; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="SAP5p6QD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BtpfDl4H4u+B6gFSNIiGFcvIpVqsDySKSem3OFxuncw=; b=SAP5p6QDw8Qgrv608CwQ5k8Szb Mk6W3fL6iRUkVEG/lDNCVcIZk7zECz0gFblP6o3I7XMbkZ0TWDUSBznWqpPFJ5SRJqqpsAVzi1RTN nvbh+wEOESlWsWg092mRDOq3nJ77HFrfhBRhxQoLb+IfIpyCoIg9Y9wBBzeLaY7u/U167DhydyjOJ SGGXzL8jF4sNAf2EvjFTZQ79ht68S/lGYpZwLVR1WiwQyUlHmLKuerIUom6S7AlZPopdxzQxcuAuL P55YswErRn5K3xagxawpgRloIVypY+q5jHOUB9Kav1QUqeQWTbR8RgNqvyeoKspOJUCV4AmQ9ACO0 /SausBEQ==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vzuJT-0000000EFWw-2IAZ; Tue, 10 Mar 2026 10:27:43 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 622D8300462; Tue, 10 Mar 2026 11:27:42 +0100 (CET) Date: Tue, 10 Mar 2026 11:27:42 +0100 From: Peter Zijlstra To: Uros Bizjak Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: Re: [PATCH -tip 1/3] x86/fsgsbase: Remove unnecessary "memory" clobbers from FS/GS base accessors Message-ID: <20260310102742.GU1282955@noisy.programming.kicks-ass.net> References: <20260310082142.93834-1-ubizjak@gmail.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: <20260310082142.93834-1-ubizjak@gmail.com> On Tue, Mar 10, 2026 at 09:21:22AM +0100, Uros Bizjak wrote: > The rdfsbase() and rdgsbase() helpers currently include a "memory" clobber > in their inline assembly definitions. However, the RDFSBASE and RDGSBASE > instructions only read the FS/GS base MSRs into a general-purpose register > and do not access memory. As such, the "memory" clobber is unnecessary. The point isn't that this accesses memory, but that prior or later accesses would end up at different memory locations (as would happen when setting the per-cpu segment. Anyway, aside from that nit, yes these 3 patches look good to me. > > No functional change intended. > > Signed-off-by: Uros Bizjak > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: Dave Hansen > Cc: "H. Peter Anvin" > Cc: "Peter Zijlstra (Intel)" > --- > arch/x86/include/asm/fsgsbase.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/fsgsbase.h b/arch/x86/include/asm/fsgsbase.h > index ab2547f97c2c..70ff4ef457b1 100644 > --- a/arch/x86/include/asm/fsgsbase.h > +++ b/arch/x86/include/asm/fsgsbase.h > @@ -25,7 +25,7 @@ static __always_inline unsigned long rdfsbase(void) > { > unsigned long fsbase; > > - asm volatile("rdfsbase %0" : "=r" (fsbase) :: "memory"); > + asm volatile("rdfsbase %0" : "=r" (fsbase)); > > return fsbase; > } > @@ -34,7 +34,7 @@ static __always_inline unsigned long rdgsbase(void) > { > unsigned long gsbase; > > - asm volatile("rdgsbase %0" : "=r" (gsbase) :: "memory"); > + asm volatile("rdgsbase %0" : "=r" (gsbase)); > > return gsbase; > } > -- > 2.53.0 >