From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754914AbdDEOCL (ORCPT ); Wed, 5 Apr 2017 10:02:11 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:42182 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753570AbdDEOCB (ORCPT ); Wed, 5 Apr 2017 10:02:01 -0400 Date: Wed, 05 Apr 2017 07:01:57 -0700 (PDT) Message-Id: <20170405.070157.871721909352646302.davem@davemloft.net> To: npiggin@gmail.com 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 From: David Miller In-Reply-To: <20170404130233.1f45115b@roar.ozlabs.ibm.com> References: <20170404095001.664718b8@roar.ozlabs.ibm.com> <20170404130233.1f45115b@roar.ozlabs.ibm.com> X-Mailer: Mew version 6.7 on Emacs 25.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 05 Apr 2017 06:20:44 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.