From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756318AbdDFBAS (ORCPT ); Wed, 5 Apr 2017 21:00:18 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34379 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752052AbdDFBAK (ORCPT ); Wed, 5 Apr 2017 21:00:10 -0400 Date: Thu, 6 Apr 2017 10:59:58 +1000 From: Nicholas Piggin To: David Miller Cc: torvalds@linux-foundation.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, anton@samba.org, linuxppc-dev@ozlabs.org Subject: Re: [RFC][PATCH] spin loop arch primitives for busy waiting Message-ID: <20170406105958.196c6977@roar.ozlabs.ibm.com> In-Reply-To: <20170405.070157.871721909352646302.davem@davemloft.net> References: <20170404095001.664718b8@roar.ozlabs.ibm.com> <20170404130233.1f45115b@roar.ozlabs.ibm.com> <20170405.070157.871721909352646302.davem@davemloft.net> Organization: IBM X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 05 Apr 2017 07:01:57 -0700 (PDT) David Miller wrote: > From: Nicholas Piggin > Date: Tue, 4 Apr 2017 13:02:33 +1000 > > > On Mon, 3 Apr 2017 17:43:05 -0700 > > Linus Torvalds wrote: > > > >> But that depends on architectures having some pattern that we *can* > >> abstract. Would some "begin/in-loop/end" pattern like the above be > >> sufficient? > > > > Yes. begin/in/end would be sufficient for powerpc SMT priority, and > > for x86, and it looks like sparc64 too. So we could do that if you > > prefer. > > Sparc64 has two cases, on older chips we can induce a cpu thread yield > with a special sequence of instructions, and on newer chips we have > a bonafide pause instruction. > > So cpu_relax() all by itself pretty much works for us. > Thanks for taking a look. The default spin primitives should just continue to do the right thing for you in that case. Arm has a yield instruction, ia64 has a pause... No unusual requirements that I can see. If there are no objections, I'll send the arch-independent part of this through the powerpc tree (the last one I sent, which follows Linus' preferred pattern). Thanks, Nick