linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/atomics: Remove unused function
@ 2023-02-24 10:39 Nysal Jan K.A
  2023-02-24 11:02 ` Christophe Leroy
  2023-04-06  1:09 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Nysal Jan K.A @ 2023-02-24 10:39 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Mark Rutland, Peter Zijlstra, linuxppc-dev, Boqun Feng,
	linux-kernel, Nicholas Piggin, Nysal Jan K.A, Will Deacon

Remove arch_atomic_try_cmpxchg_lock function as it is no longer used
since commit 9f61521c7a28 ("powerpc/qspinlock: powerpc qspinlock
implementation")

Signed-off-by: Nysal Jan K.A <nysal@linux.ibm.com>
---
 arch/powerpc/include/asm/atomic.h | 29 -----------------------------
 1 file changed, 29 deletions(-)

diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
index 486ab7889121..b3a53830446b 100644
--- a/arch/powerpc/include/asm/atomic.h
+++ b/arch/powerpc/include/asm/atomic.h
@@ -130,35 +130,6 @@ ATOMIC_OPS(xor, xor, "", K)
 #define arch_atomic_xchg_relaxed(v, new) \
 	arch_xchg_relaxed(&((v)->counter), (new))
 
-/*
- * Don't want to override the generic atomic_try_cmpxchg_acquire, because
- * we add a lock hint to the lwarx, which may not be wanted for the
- * _acquire case (and is not used by the other _acquire variants so it
- * would be a surprise).
- */
-static __always_inline bool
-arch_atomic_try_cmpxchg_lock(atomic_t *v, int *old, int new)
-{
-	int r, o = *old;
-	unsigned int eh = IS_ENABLED(CONFIG_PPC64);
-
-	__asm__ __volatile__ (
-"1:	lwarx	%0,0,%2,%[eh]	# atomic_try_cmpxchg_acquire		\n"
-"	cmpw	0,%0,%3							\n"
-"	bne-	2f							\n"
-"	stwcx.	%4,0,%2							\n"
-"	bne-	1b							\n"
-"\t"	PPC_ACQUIRE_BARRIER "						\n"
-"2:									\n"
-	: "=&r" (r), "+m" (v->counter)
-	: "r" (&v->counter), "r" (o), "r" (new), [eh] "n" (eh)
-	: "cr0", "memory");
-
-	if (unlikely(r != o))
-		*old = r;
-	return likely(r == o);
-}
-
 /**
  * atomic_fetch_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/atomics: Remove unused function
  2023-02-24 10:39 [PATCH] powerpc/atomics: Remove unused function Nysal Jan K.A
@ 2023-02-24 11:02 ` Christophe Leroy
  2023-03-24  1:14   ` Nysal Jan K.A.
  2023-04-06  1:09 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Christophe Leroy @ 2023-02-24 11:02 UTC (permalink / raw)
  To: Nysal Jan K.A, Michael Ellerman
  Cc: Mark Rutland, Peter Zijlstra, linuxppc-dev, Boqun Feng,
	linux-kernel, Nicholas Piggin, Will Deacon



Le 24/02/2023 à 11:39, Nysal Jan K.A a écrit :
> [Vous ne recevez pas souvent de courriers de nysal@linux.ibm.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> Remove arch_atomic_try_cmpxchg_lock function as it is no longer used
> since commit 9f61521c7a28 ("powerpc/qspinlock: powerpc qspinlock
> implementation")
> 
> Signed-off-by: Nysal Jan K.A <nysal@linux.ibm.com>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
>   arch/powerpc/include/asm/atomic.h | 29 -----------------------------
>   1 file changed, 29 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
> index 486ab7889121..b3a53830446b 100644
> --- a/arch/powerpc/include/asm/atomic.h
> +++ b/arch/powerpc/include/asm/atomic.h
> @@ -130,35 +130,6 @@ ATOMIC_OPS(xor, xor, "", K)
>   #define arch_atomic_xchg_relaxed(v, new) \
>          arch_xchg_relaxed(&((v)->counter), (new))
> 
> -/*
> - * Don't want to override the generic atomic_try_cmpxchg_acquire, because
> - * we add a lock hint to the lwarx, which may not be wanted for the
> - * _acquire case (and is not used by the other _acquire variants so it
> - * would be a surprise).
> - */
> -static __always_inline bool
> -arch_atomic_try_cmpxchg_lock(atomic_t *v, int *old, int new)
> -{
> -       int r, o = *old;
> -       unsigned int eh = IS_ENABLED(CONFIG_PPC64);
> -
> -       __asm__ __volatile__ (
> -"1:    lwarx   %0,0,%2,%[eh]   # atomic_try_cmpxchg_acquire            \n"
> -"      cmpw    0,%0,%3                                                 \n"
> -"      bne-    2f                                                      \n"
> -"      stwcx.  %4,0,%2                                                 \n"
> -"      bne-    1b                                                      \n"
> -"\t"   PPC_ACQUIRE_BARRIER "                                           \n"
> -"2:                                                                    \n"
> -       : "=&r" (r), "+m" (v->counter)
> -       : "r" (&v->counter), "r" (o), "r" (new), [eh] "n" (eh)
> -       : "cr0", "memory");
> -
> -       if (unlikely(r != o))
> -               *old = r;
> -       return likely(r == o);
> -}
> -
>   /**
>    * atomic_fetch_add_unless - add unless the number is a given value
>    * @v: pointer of type atomic_t
> --
> 2.39.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/atomics: Remove unused function
  2023-02-24 11:02 ` Christophe Leroy
@ 2023-03-24  1:14   ` Nysal Jan K.A.
  0 siblings, 0 replies; 4+ messages in thread
From: Nysal Jan K.A. @ 2023-03-24  1:14 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

Michael,
Any comments on this one?

On Fri, Feb 24, 2023 at 11:02:31AM +0000, Christophe Leroy wrote:
> 
> 
> Le 24/02/2023 à 11:39, Nysal Jan K.A a écrit :
> > [Vous ne recevez pas souvent de courriers de nysal@linux.ibm.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> > 
> > Remove arch_atomic_try_cmpxchg_lock function as it is no longer used
> > since commit 9f61521c7a28 ("powerpc/qspinlock: powerpc qspinlock
> > implementation")
> > 
> > Signed-off-by: Nysal Jan K.A <nysal@linux.ibm.com>
> 
> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> 
> > ---
> >   arch/powerpc/include/asm/atomic.h | 29 -----------------------------
> >   1 file changed, 29 deletions(-)
> > 
> > diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
> > index 486ab7889121..b3a53830446b 100644
> > --- a/arch/powerpc/include/asm/atomic.h
> > +++ b/arch/powerpc/include/asm/atomic.h
> > @@ -130,35 +130,6 @@ ATOMIC_OPS(xor, xor, "", K)
> >   #define arch_atomic_xchg_relaxed(v, new) \
> >          arch_xchg_relaxed(&((v)->counter), (new))
> > 
> > -/*
> > - * Don't want to override the generic atomic_try_cmpxchg_acquire, because
> > - * we add a lock hint to the lwarx, which may not be wanted for the
> > - * _acquire case (and is not used by the other _acquire variants so it
> > - * would be a surprise).
> > - */
> > -static __always_inline bool
> > -arch_atomic_try_cmpxchg_lock(atomic_t *v, int *old, int new)
> > -{
> > -       int r, o = *old;
> > -       unsigned int eh = IS_ENABLED(CONFIG_PPC64);
> > -
> > -       __asm__ __volatile__ (
> > -"1:    lwarx   %0,0,%2,%[eh]   # atomic_try_cmpxchg_acquire            \n"
> > -"      cmpw    0,%0,%3                                                 \n"
> > -"      bne-    2f                                                      \n"
> > -"      stwcx.  %4,0,%2                                                 \n"
> > -"      bne-    1b                                                      \n"
> > -"\t"   PPC_ACQUIRE_BARRIER "                                           \n"
> > -"2:                                                                    \n"
> > -       : "=&r" (r), "+m" (v->counter)
> > -       : "r" (&v->counter), "r" (o), "r" (new), [eh] "n" (eh)
> > -       : "cr0", "memory");
> > -
> > -       if (unlikely(r != o))
> > -               *old = r;
> > -       return likely(r == o);
> > -}
> > -
> >   /**
> >    * atomic_fetch_add_unless - add unless the number is a given value
> >    * @v: pointer of type atomic_t
> > --
> > 2.39.2
> > 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/atomics: Remove unused function
  2023-02-24 10:39 [PATCH] powerpc/atomics: Remove unused function Nysal Jan K.A
  2023-02-24 11:02 ` Christophe Leroy
@ 2023-04-06  1:09 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2023-04-06  1:09 UTC (permalink / raw)
  To: Michael Ellerman, Nysal Jan K.A
  Cc: Mark Rutland, Peter Zijlstra, linuxppc-dev, Boqun Feng,
	linux-kernel, Nicholas Piggin, Will Deacon

On Fri, 24 Feb 2023 16:09:40 +0530, Nysal Jan K.A wrote:
> Remove arch_atomic_try_cmpxchg_lock function as it is no longer used
> since commit 9f61521c7a28 ("powerpc/qspinlock: powerpc qspinlock
> implementation")
> 
> 

Applied to powerpc/next.

[1/1] powerpc/atomics: Remove unused function
      https://git.kernel.org/powerpc/c/b0bbe5a2915201e3231e788d716d39dc54493b03

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-06  1:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 10:39 [PATCH] powerpc/atomics: Remove unused function Nysal Jan K.A
2023-02-24 11:02 ` Christophe Leroy
2023-03-24  1:14   ` Nysal Jan K.A.
2023-04-06  1:09 ` Michael Ellerman

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).