[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <06f228ac4afce0126337ad4a8b0ade1f12c98d40.camel@xry111.site>
Date: Tue, 01 Aug 2023 19:28:35 +0800
From: Xi Ruoyao <xry111@...111.site>
To: Guo Ren <guoren@...nel.org>, WANG Rui <wangrui@...ngson.cn>
Cc: chenhuacai@...nel.org, kernel@...0n.name, arnd@...db.de,
andi.shyti@...ux.intel.com, andrzej.hajda@...el.com,
peterz@...radead.org, will@...nel.org, boqun.feng@...il.com,
mark.rutland@....com, loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org, Guo Ren <guoren@...ux.alibaba.com>
Subject: Re: [PATCH] LoongArch: Fixup cmpxchg sematic for memory barrier
On Tue, 2023-08-01 at 19:23 +0800, Xi Ruoyao wrote:
> On Tue, 2023-08-01 at 18:49 +0800, Guo Ren wrote:
> > > On Tue, Aug 1, 2023 at 5:05 PM Guo Ren <guoren@...nel.org> wrote:
> > > >
> > > > > The CoRR problem would cause wider problems than this.For this case,
> > > > > do you mean your LL -> LL would be reordered?
> > > > >
> > > > > CPU 0
> > > > > CPU1
> > > > > LL(2) (set ex-monitor)
> > > > >
> > > > > store (break the ex-monitor)
> > > > > LL(1) (reordered instruction set ex-monitor
> > > > > SC(3) (successes ?)
> > > > Sorry for the mail client reformat, I mean:
> > > >
> > > > CPU0 LL(2) (set ex-monitor)
> > > > CPU1 STORE (break the ex-monitor)
> > > > CPU0 LL(1) (reordered instruction set ex-monitor
> > > > CPU0 SC(3) (success?)
> > >
> > > No. LL and LL won't reorder because LL implies a memory barrier(though
> > > not acquire semantics).
> > That means we could remove __WEAK_LLSC_MB totally, right?
>
> As I've said, to implement CAS on LA464 this barrier is *really* needed.
> I initially didn't believe it then I spent one night (from 11 PM to 04
> AM) debugging GCC libgomp test failures.
>
> On LA664 (3A6000) things may change though.
And I consider this a hardware bug, so it's out of the general concept
of general memory orders. We are basically just applying a workaround
provided by uarch designers.
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists