From: Nicholas Piggin <npiggin@gmail.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org, Anton Blanchard <anton@samba.org>
Subject: Re: [PATCH] powerpc: Fix smp_wmb barrier definition use use lwsync consistently
Date: Wed, 28 Mar 2018 23:43:10 +1000 [thread overview]
Message-ID: <20180328234119.313ef0dc@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <874ll02x22.fsf@concordia.ellerman.id.au>
On Wed, 28 Mar 2018 23:40:05 +1100
Michael Ellerman <mpe@ellerman.id.au> wrote:
> Nicholas Piggin <npiggin@gmail.com> writes:
>
> > asm/barrier.h is not always included after asm/synch.h, which meant
> > it was missing __SUBARCH_HAS_LWSYNC, so in some files smp_wmb() would
> > be eieio when it should be lwsync. kernel/time/hrtimer.c is one case.
>
> Wow nice catch. Only broken since 2008 presumably.
>
> Some days I think maybe we aren't very good at this writing software
> thing, good to have some certainty :)
Yeah, I only caught it by luck when looking through instruction traces.
The pipeline model just happens to make eieio look different to most
other instructions (which is likely a bug in the model) which made me
look closer at it. Could have been with us for another 10 years.
> > __SUBARCH_HAS_LWSYNC is only used in one place, so just fold it in
> > to where it's used. Previously with my small simulator config, 377
> > instances of eieio in the tree. After this patch there are 55.
>
> At least for Book3S this isn't actually a terrible bug AFAICS:
>
> - smp_wmb() is only defined to order accesses to cacheable memory.
> - smp_wmb() only orders prior stores vs later stores.
> - eieio orders all prior stores vs all later stores for cacheable
> memory.
> - lwsync orders everything except prior stores vs later loads for
> cacheable memory.
>
> So eieio and lwsync are both valid to use as smp_wmb(), but it's still
> terrible fishy that we were using both in different places depending on
> include ordering.
Oh yeah it's not a bug in that it would cause violation of memory
ordering, only performance (and expectations when debugging and
observing things I guess). eieio works fine for smp_wmb().
> I'm inclined to tag this for stable unless anyone can think of a reason
> not to?
I think that would be good.
Thanks,
Nick
next prev parent reply other threads:[~2018-03-28 13:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 10:41 [PATCH] powerpc: Fix smp_wmb barrier definition use use lwsync consistently Nicholas Piggin
2018-03-28 12:40 ` Michael Ellerman
2018-03-28 13:43 ` Nicholas Piggin [this message]
2018-03-31 14:04 ` Michael Ellerman
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=20180328234119.313ef0dc@roar.ozlabs.ibm.com \
--to=npiggin@gmail.com \
--cc=anton@samba.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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;
as well as URLs for NNTP newsgroup(s).