From: Peter Zijlstra <peterz@infradead.org>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: linux-alpha@vger.kernel.org, loongarch@lists.linux.dev,
linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
x86@kernel.org, linux-arch@vger.kernel.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Richard Henderson <richard.henderson@linaro.org>,
Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
Matt Turner <mattst88@gmail.com>,
Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>,
Jiaxun Yang <jiaxun.yang@flygoat.com>, Jun Yi <yijun@loongson.cn>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH v2 3/5] locking/arch: Wire up local_try_cmpxchg
Date: Wed, 12 Apr 2023 15:40:42 +0200 [thread overview]
Message-ID: <20230412134042.GA629004@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CAFULd4aCNNcyQm3Av+KkWVXuU9Cb0G5H5cFmqVR_T5LwCW=YJA@mail.gmail.com>
On Wed, Apr 12, 2023 at 03:37:50PM +0200, Uros Bizjak wrote:
> On Wed, Apr 12, 2023 at 1:33 PM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > On Wed, Apr 05, 2023 at 04:17:08PM +0200, Uros Bizjak wrote:
> > > diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
> > > index bc4bd19b7fc2..45492fb5bf22 100644
> > > --- a/arch/powerpc/include/asm/local.h
> > > +++ b/arch/powerpc/include/asm/local.h
> > > @@ -90,6 +90,17 @@ static __inline__ long local_cmpxchg(local_t *l, long o, long n)
> > > return t;
> > > }
> > >
> > > +static __inline__ bool local_try_cmpxchg(local_t *l, long *po, long n)
> > > +{
> > > + long o = *po, r;
> > > +
> > > + r = local_cmpxchg(l, o, n);
> > > + if (unlikely(r != o))
> > > + *po = r;
> > > +
> > > + return likely(r == o);
> > > +}
> > > +
> >
> > Why is the ppc one different from the rest? Why can't it use the
> > try_cmpxchg_local() fallback and needs to have it open-coded?
>
> Please note that ppc directly defines local_cmpxchg that bypasses
> cmpxchg_local/arch_cmpxchg_local machinery. The patch takes the same
> approach for local_try_cmpxchg, because fallbacks are using
> arch_cmpxchg_local definitions.
>
> PPC should be converted to use arch_cmpxchg_local (to also enable
> instrumentation), but this is not the scope of the proposed patchset.
Ah indeed. Thanks!
next prev parent reply other threads:[~2023-04-12 13:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 14:17 [PATCH v2 0/5] locking: Introduce local{,64}_try_cmpxchg Uros Bizjak
2023-04-05 14:17 ` [PATCH v2 1/5] locking/atomic: Add generic try_cmpxchg{,64}_local support Uros Bizjak
2023-04-11 11:10 ` Mark Rutland
2023-04-05 14:17 ` [PATCH v2 2/5] locking/generic: Wire up local{,64}_try_cmpxchg Uros Bizjak
2023-04-11 11:13 ` Mark Rutland
2023-04-05 14:17 ` [PATCH v2 3/5] locking/arch: Wire up local_try_cmpxchg Uros Bizjak
2023-04-12 11:32 ` Peter Zijlstra
2023-04-12 13:37 ` Uros Bizjak
2023-04-12 13:40 ` Peter Zijlstra [this message]
2023-05-17 7:41 ` Charlemagne Lasse
2023-04-05 14:17 ` [PATCH v2 4/5] locking/x86: Define arch_try_cmpxchg_local Uros Bizjak
2023-04-05 14:17 ` [PATCH v2 5/5] events: Illustrate the transition to local{,64}_try_cmpxchg Uros Bizjak
2023-04-05 16:37 ` [PATCH v2 0/5] locking: Introduce local{,64}_try_cmpxchg Dave Hansen
2023-04-05 18:53 ` Uros Bizjak
2023-04-06 8:25 ` David Laight
2023-04-06 8:38 ` Uros Bizjak
2023-04-06 9:01 ` David Laight
2023-04-11 11:35 ` Mark Rutland
2023-04-11 13:43 ` Dave Hansen
2023-04-11 21:34 ` David Laight
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=20230412134042.GA629004@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=chenhuacai@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=ink@jurassic.park.msu.ru \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=loongarch@lists.linux.dev \
--cc=mattst88@gmail.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=richard.henderson@linaro.org \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=ubizjak@gmail.com \
--cc=x86@kernel.org \
--cc=yijun@loongson.cn \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).