linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Pan Xinhui <xinhui@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@ozlabs.org
Cc: xinhui.pan@linux.vnet.ibm.com, peterz@infradead.org
Subject: Re: [PATCH] powerpc: Fix __cmpxchg() to take a volatile ptr again
Date: Fri, 25 Nov 2016 12:26:04 +0800	[thread overview]
Message-ID: <480bd5a3-1981-e716-9049-cbd5877cd122@linux.vnet.ibm.com> (raw)
In-Reply-To: <1480043229-2363-1-git-send-email-mpe@ellerman.id.au>



在 2016/11/25 11:07, Michael Ellerman 写道:
> In commit d0563a1297e2 ("powerpc: Implement {cmp}xchg for u8 and u16")
> we removed the volatile from __cmpxchg().
>
> This is leading to warnings such as:
>
>   drivers/gpu/drm/drm_lock.c: In function ‘drm_lock_take’:
>   arch/powerpc/include/asm/cmpxchg.h:484:37: warning: passing argument 1
>   of ‘__cmpxchg’ discards ‘volatile’ qualifier from pointer target
>      (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,   \
>
> There doesn't seem to be consensus across architectures whether the
> argument is volatile or not, so at least for now put the volatile back.
>
> Fixes: d0563a1297e2 ("powerpc: Implement {cmp}xchg for u8 and u16")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
Hi, mpe
	We implement __cmpxchg in asm so volatile maybe is not needed I think.
But seems compiler is not happy :(
I am okay with your patch. thanks!

>  arch/powerpc/include/asm/cmpxchg.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/cmpxchg.h b/arch/powerpc/include/asm/cmpxchg.h
> index c12f110261b2..fc46b664c49e 100644
> --- a/arch/powerpc/include/asm/cmpxchg.h
> +++ b/arch/powerpc/include/asm/cmpxchg.h
> @@ -14,7 +14,7 @@
>  #endif
>
>  #define XCHG_GEN(type, sfx, cl)				\
> -static inline u32 __xchg_##type##sfx(void *p, u32 val)		\
> +static inline u32 __xchg_##type##sfx(volatile void *p, u32 val)	\
>  {								\
>  	unsigned int prev, prev_mask, tmp, bitoff, off;		\
>  								\
> @@ -40,7 +40,7 @@ static inline u32 __xchg_##type##sfx(void *p, u32 val)		\
>
>  #define CMPXCHG_GEN(type, sfx, br, br2, cl)			\
>  static inline							\
> -u32 __cmpxchg_##type##sfx(void *p, u32 old, u32 new)		\
> +u32 __cmpxchg_##type##sfx(volatile void *p, u32 old, u32 new)	\
>  {								\
>  	unsigned int prev, prev_mask, tmp, bitoff, off;		\
>  								\
> @@ -399,7 +399,7 @@ __cmpxchg_u64_acquire(u64 *p, unsigned long old, unsigned long new)
>  #endif
>
>  static __always_inline unsigned long
> -__cmpxchg(void *ptr, unsigned long old, unsigned long new,
> +__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new,
>  	  unsigned int size)
>  {
>  	switch (size) {
>

  reply	other threads:[~2016-11-25  4:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25  3:07 [PATCH] powerpc: Fix __cmpxchg() to take a volatile ptr again Michael Ellerman
2016-11-25  4:26 ` Pan Xinhui [this message]
2016-11-28 12:15 ` 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=480bd5a3-1981-e716-9049-cbd5877cd122@linux.vnet.ibm.com \
    --to=xinhui@linux.vnet.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=peterz@infradead.org \
    --cc=xinhui.pan@linux.vnet.ibm.com \
    /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).