From: Thiago Jung Bauermann <bauerman@linux.ibm.com>
To: Christopher M Riedl <cmr@informatik.wtf>
Cc: linuxppc-dev@ozlabs.org, linuxppc-dev@lists.ozlabs.org,
ajd@linux.ibm.com
Subject: Re: [PATCH 1/3] powerpc/spinlocks: Refactor SHARED_PROCESSOR
Date: Tue, 30 Jul 2019 21:11:53 -0300 [thread overview]
Message-ID: <87d0hrukom.fsf@morokweng.localdomain> (raw)
In-Reply-To: <1271264633.409807.1564529492813@privateemail.com>
Christopher M Riedl <cmr@informatik.wtf> writes:
>> On July 30, 2019 at 4:31 PM Thiago Jung Bauermann <bauerman@linux.ibm.com> wrote:
>>
>>
>>
>> Christopher M. Riedl <cmr@informatik.wtf> writes:
>>
>> > Determining if a processor is in shared processor mode is not a constant
>> > so don't hide it behind a #define.
>> >
>> > Signed-off-by: Christopher M. Riedl <cmr@informatik.wtf>
>> > ---
>> > arch/powerpc/include/asm/spinlock.h | 21 +++++++++++++++------
>> > 1 file changed, 15 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
>> > index a47f827bc5f1..8631b0b4e109 100644
>> > --- a/arch/powerpc/include/asm/spinlock.h
>> > +++ b/arch/powerpc/include/asm/spinlock.h
>> > @@ -101,15 +101,24 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)
>> >
>> > #if defined(CONFIG_PPC_SPLPAR)
>> > /* We only yield to the hypervisor if we are in shared processor mode */
>> > -#define SHARED_PROCESSOR (lppaca_shared_proc(local_paca->lppaca_ptr))
>> > extern void __spin_yield(arch_spinlock_t *lock);
>> > extern void __rw_yield(arch_rwlock_t *lock);
>> > #else /* SPLPAR */
>> > #define __spin_yield(x) barrier()
>> > #define __rw_yield(x) barrier()
>> > -#define SHARED_PROCESSOR 0
>> > #endif
>> >
>> > +static inline bool is_shared_processor(void)
>> > +{
>> > +/* Only server processors have an lppaca struct */
>> > +#ifdef CONFIG_PPC_BOOK3S
>> > + return (IS_ENABLED(CONFIG_PPC_SPLPAR) &&
>> > + lppaca_shared_proc(local_paca->lppaca_ptr));
>> > +#else
>> > + return false;
>> > +#endif
>> > +}
>> > +
>>
>> CONFIG_PPC_SPLPAR depends on CONFIG_PPC_PSERIES, which depends on
>> CONFIG_PPC_BOOK3S so the #ifdef above is unnecessary:
>>
>> if CONFIG_PPC_BOOK3S is unset then CONFIG_PPC_SPLPAR will be unset as
>> well and the return expression should short-circuit to false.
>>
>
> Agreed, but the #ifdef is necessary to compile platforms which include
> this header but do not implement lppaca_shared_proc(...) and friends.
> I can reword the comment if that helps.
Ah, indeed. Yes, if you could mention that in the commit I think it
would help. These #ifdefs are becoming démodé so it's good to know why
they're there.
Another alternative is to provide a dummy lppaca_shared_proc() which
always returns false when CONFIG_PPC_BOOK3S isn't set (just mentioning
it, I don't have a preference).
--
Thiago Jung Bauermann
IBM Linux Technology Center
next prev parent reply other threads:[~2019-07-31 0:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-28 12:54 [PATCH 0/3] Fix oops in shared-processor spinlocks Christopher M. Riedl
2019-07-28 12:54 ` [PATCH 1/3] powerpc/spinlocks: Refactor SHARED_PROCESSOR Christopher M. Riedl
2019-07-30 21:31 ` Thiago Jung Bauermann
2019-07-30 23:31 ` Christopher M Riedl
2019-07-31 0:11 ` Thiago Jung Bauermann [this message]
2019-07-31 2:36 ` Christopher M Riedl
2019-08-01 3:20 ` Andrew Donnellan
2019-07-28 12:54 ` [PATCH 2/3] powerpc/spinlocks: Rename SPLPAR-only spinlocks Christopher M. Riedl
2019-08-01 3:27 ` Andrew Donnellan
2019-07-28 12:54 ` [PATCH 3/3] powerpc/spinlock: Fix oops in shared-processor spinlocks Christopher M. Riedl
2019-08-01 3:33 ` Andrew Donnellan
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=87d0hrukom.fsf@morokweng.localdomain \
--to=bauerman@linux.ibm.com \
--cc=ajd@linux.ibm.com \
--cc=cmr@informatik.wtf \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=linuxppc-dev@ozlabs.org \
/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