public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Will Deacon <will.deacon@arm.com>
Cc: "Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	linux-mips@linux-mips.org, 陈华才 <chenhc@lemote.com>,
	"Paul Burton" <paul.burton@mips.com>,
	"Ralf Baechle" <ralf@linux-mips.org>,
	"James Hogan" <jhogan@kernel.org>,
	"Fuxin Zhang" <zhangfx@lemote.com>,
	wuzhangjin <wuzhangjin@gmail.com>,
	stable <stable@vger.kernel.org>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"Andrea Parri" <andrea.parri@amarulasolutions.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"David Howells" <dhowells@redhat.com>,
	"Jade Alglave" <j.alglave@ucl.ac.uk>,
	"Luc Maranget" <luc.maranget@inria.fr>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	"Akira Yokosawa" <akiyks@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2] MIPS: implement smp_cond_load_acquire() for Loongson-3
Date: Wed, 11 Jul 2018 13:09:52 +0200	[thread overview]
Message-ID: <20180711110952.GC2476@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180711102106.GG13963@arm.com>

On Wed, Jul 11, 2018 at 11:21:06AM +0100, Will Deacon wrote:
> On Wed, Jul 11, 2018 at 06:05:51PM +0800, Jiaxun Yang wrote:
> > On 2018-7-10 Tue at 20:17:27,Peter Zijlstra Wrote:

> > > Still, even with the rules above, the best work-around is still the very
> > > same cpu_relax() hack.
> > 
> > As you say, SFB makes Loongson not fully SMP-coherent.
> > However, modify cpu_relax can solve the current problem,
> > but not so straight forward. On the other hand, providing a Loongson-specific 
> > WRITE_ONCE looks more reasonable, because it the eliminate the "non-cohrency".
> > So we can solve the bug from the root.
> 
> Curious, but why is it not straight-forward to hack cpu_relax()? If you try
> to hack WRITE_ONCE, you also need to hack atomic_set, atomic64_set and all
> the places that should be using WRITE_ONCE but aren't ;~)

Right.

The problem isn't stores pre-se, normal progress should contain enough
stores to flush out 'old' bits in the natural order of things. But the
problem is spin-wait loops that inhibit normal progress (and thereby
store-buffer flushing).

And all spin-wait loops should be having cpu_relax() in them. So
cpu_relax() is the natural place to fix this.

Adding SYNC to WRITE_ONCE()/atomic* will hurt performance lots and will
ultimately not guarantee anything more; and as Will said, keep you
chasing dragons where people forgot to use WRITE_ONCE() where they maybe
should've.

  reply	other threads:[~2018-07-11 11:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1531103198-16764-1-git-send-email-chenhc@lemote.com>
2018-07-09 16:49 ` [PATCH V2] MIPS: implement smp_cond_load_acquire() for Loongson-3 Paul Burton
2018-07-10  4:26   ` Huacai Chen
2018-07-10  9:36     ` Peter Zijlstra
2018-07-10 10:54       ` Peter Zijlstra
2018-07-10 11:45         ` 陈华才
2018-07-10 12:17           ` Peter Zijlstra
2018-07-10 16:14             ` Paul E. McKenney
2018-07-10 17:10             ` Paul Burton
2018-07-11 10:04               ` David Laight
2018-07-11 10:55                 ` Peter Zijlstra
2018-07-11 10:05             ` Jiaxun Yang
2018-07-11 10:21               ` Will Deacon
2018-07-11 11:09                 ` Peter Zijlstra [this message]
2018-07-11 11:46                   ` David Laight
2018-07-11  9:43           ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180711110952.GC2476@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akiyks@gmail.com \
    --cc=andrea.parri@amarulasolutions.com \
    --cc=boqun.feng@gmail.com \
    --cc=chenhc@lemote.com \
    --cc=dhowells@redhat.com \
    --cc=j.alglave@ucl.ac.uk \
    --cc=jhogan@kernel.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=luc.maranget@inria.fr \
    --cc=npiggin@gmail.com \
    --cc=paul.burton@mips.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=ralf@linux-mips.org \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=will.deacon@arm.com \
    --cc=wuzhangjin@gmail.com \
    --cc=zhangfx@lemote.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox