From: Thiago Jung Bauermann <bauerman@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: linuxppc-dev@ozlabs.org,
"Christopher M. Riedl" <cmr@informatik.wtf>,
ajd@linux.ibm.com
Subject: Re: [PATCH 1/3] powerpc/spinlocks: Refactor SHARED_PROCESSOR
Date: Tue, 30 Jul 2019 18:31:55 -0300 [thread overview]
Message-ID: <87ef27us38.fsf@morokweng.localdomain> (raw)
In-Reply-To: <20190728125438.1550-2-cmr@informatik.wtf>
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.
--
Thiago Jung Bauermann
IBM Linux Technology Center
next prev parent reply other threads:[~2019-07-30 21:34 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 [this message]
2019-07-30 23:31 ` Christopher M Riedl
2019-07-31 0:11 ` Thiago Jung Bauermann
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=87ef27us38.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