From: Peter Zijlstra Subject: Re: [RFC PATCH 01/20] asm-generic/mmiowb: Add generic implementation of mmiowb() tracking Date: Tue, 26 Feb 2019 19:33:35 +0100 Message-ID: <20190226183335.GN2861@worktop.programming.kicks-ass.net> References: <20190222185026.10973-1-will.deacon@arm.com> <20190222185026.10973-2-will.deacon@arm.com> <20190226182624.GC28709@fuggles.cambridge.arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190226182624.GC28709@fuggles.cambridge.arm.com> Sender: linux-kernel-owner@vger.kernel.org To: Will Deacon Cc: Linus Torvalds , linux-arch , Linux List Kernel Mailing , "Paul E. McKenney" , Benjamin Herrenschmidt , Michael Ellerman , Arnd Bergmann , Andrea Parri , Palmer Dabbelt , Daniel Lustig , David Howells , Alan Stern , "Maciej W. Rozycki" , Paul Burton , Ingo Molnar , Yoshinori Sato , Rich Felker , Tony Luck List-Id: linux-arch.vger.kernel.org On Tue, Feb 26, 2019 at 06:26:24PM +0000, Will Deacon wrote: > On Fri, Feb 22, 2019 at 01:49:32PM -0800, Linus Torvalds wrote: > So I *am* using __this_cpu_xchg() here, which means the architecture can > get away with plain old loads and stores (which is what RISC-V does, for > example), but I see that's not the case on e.g. x86 so I'll rework using > read() and write() because it doesn't hurt. Right, so the problem on x86 is that XCHG has an implicit LOCK prefix, so there no !atomic variant. So even the cpu-local xchg gets the LOCK prefix penalty, even though all we really wanted is a single instruction. Arguably we could fix that for __this_cpu_xchg(), which isn't IRQ-safe.