From: Peter Zijlstra Subject: Re: [RFC PATCH 01/20] asm-generic/mmiowb: Add generic implementation of mmiowb() tracking Date: Wed, 27 Feb 2019 11:19:25 +0100 Message-ID: <20190227101925.GK32494@hirez.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> <20190226183335.GN2861@worktop.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Linus Torvalds Cc: Will Deacon , 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 11:02:50AM -0800, Linus Torvalds wrote: > On Tue, Feb 26, 2019 at 10:33 AM Peter Zijlstra wrote: > > > > Arguably we could fix that for __this_cpu_xchg(), which isn't IRQ-safe. > > Yeah, I guess x86 _should_ really do __this_cpu_xchg() as just a > read-write pair. See the patches I just send. > In general, a read-write pair is probably always the right thing to > do, and the only reason we can't just do it in an > architecture-independent way is that we'd want to avoid doing the > address generation twice (for architectures where that is an issue). The generic code has this right, see include/asm-generic/percpu.h:raw_cpu_generic_xchg(). That is used in the majority of the architectures. With the patch I just send, x86 will use two gs prefixed movs.