[patch 09/16] powerpc: Replace old style lock initializer

View: New views
5 Messages — Rating Filter:   Alert me  

Parent Message unknown [patch 09/16] powerpc: Replace old style lock initializer

by Thomas Gleixner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

SPIN_LOCK_UNLOCKED is deprecated. Init the lock array at runtime
instead.

Signed-off-by: Thomas Gleixner <tglx@...>
Cc: Benjamin Herrenschmidt <benh@...>
Cc: linuxppc-dev@...
---
 arch/powerpc/platforms/iseries/htab.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/powerpc/platforms/iseries/htab.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/iseries/htab.c
+++ linux-2.6/arch/powerpc/platforms/iseries/htab.c
@@ -19,8 +19,7 @@
 
 #include "call_hpt.h"
 
-static spinlock_t iSeries_hlocks[64] __cacheline_aligned_in_smp =
- { [0 ... 63] = SPIN_LOCK_UNLOCKED};
+static spinlock_t iSeries_hlocks[64] __cacheline_aligned_in_smp;
 
 /*
  * Very primitive algorithm for picking up a lock
@@ -245,6 +244,11 @@ static void iSeries_hpte_invalidate(unsi
 
 void __init hpte_init_iSeries(void)
 {
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(iSeries_hlocks); i++)
+ spin_lock_init(&iSeries_hlocks[i]);
+
  ppc_md.hpte_invalidate = iSeries_hpte_invalidate;
  ppc_md.hpte_updatepp = iSeries_hpte_updatepp;
  ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp;


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@...
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [patch 09/16] powerpc: Replace old style lock initializer

by Benjamin Herrenschmidt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-11-06 at 22:41 +0000, Thomas Gleixner wrote:
> plain text document attachment
> (power-replace-old-style-lock-init.patch)
> SPIN_LOCK_UNLOCKED is deprecated. Init the lock array at runtime
> instead.
>
> Signed-off-by: Thomas Gleixner <tglx@...>
> Cc: Benjamin Herrenschmidt <benh@...>
> Cc: linuxppc-dev@...
> ---

Looks reasonable. But iseries can be a bitch, so we do need to test it
on monday.

Cheers,
Ben.

>  arch/powerpc/platforms/iseries/htab.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/arch/powerpc/platforms/iseries/htab.c
> ===================================================================
> --- linux-2.6.orig/arch/powerpc/platforms/iseries/htab.c
> +++ linux-2.6/arch/powerpc/platforms/iseries/htab.c
> @@ -19,8 +19,7 @@
>  
>  #include "call_hpt.h"
>  
> -static spinlock_t iSeries_hlocks[64] __cacheline_aligned_in_smp =
> - { [0 ... 63] = SPIN_LOCK_UNLOCKED};
> +static spinlock_t iSeries_hlocks[64] __cacheline_aligned_in_smp;
>  
>  /*
>   * Very primitive algorithm for picking up a lock
> @@ -245,6 +244,11 @@ static void iSeries_hpte_invalidate(unsi
>  
>  void __init hpte_init_iSeries(void)
>  {
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(iSeries_hlocks); i++)
> + spin_lock_init(&iSeries_hlocks[i]);
> +
>   ppc_md.hpte_invalidate = iSeries_hpte_invalidate;
>   ppc_md.hpte_updatepp = iSeries_hpte_updatepp;
>   ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp;
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@...
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [patch 09/16] powerpc: Replace old style lock initializer

by Stephen Rothwell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ben,

On Sat, 07 Nov 2009 09:55:44 +1100 Benjamin Herrenschmidt <benh@...> wrote:
>
> Looks reasonable. But iseries can be a bitch, so we do need to test it
> on monday.

It should be safe as the spinlocks cannot be access until after the
following ppc_md pointer initialisations are done (and all this happens
before the secondary CPUs are started).

But, you are right that there is nothing like actually testing with
iSeries. :-)

> >  void __init hpte_init_iSeries(void)
> >  {
> > + int i;
> > +
> > + for (i = 0; i < ARRAY_SIZE(iSeries_hlocks); i++)
> > + spin_lock_init(&iSeries_hlocks[i]);
> > +
> >   ppc_md.hpte_invalidate = iSeries_hpte_invalidate;
> >   ppc_md.hpte_updatepp = iSeries_hpte_updatepp;
> >   ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp;
--
Cheers,
Stephen Rothwell                    sfr@...
http://www.canb.auug.org.au/~sfr/


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@...
https://lists.ozlabs.org/listinfo/linuxppc-dev

attachment0 (205 bytes) Download Attachment

Re: [patch 09/16] powerpc: Replace old style lock initializer

by Stephen Rothwell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Thomas,

On Sat, 07 Nov 2009 09:55:44 +1100 Benjamin Herrenschmidt <benh@...> wrote:

>
> On Fri, 2009-11-06 at 22:41 +0000, Thomas Gleixner wrote:
> > plain text document attachment
> > (power-replace-old-style-lock-init.patch)
> > SPIN_LOCK_UNLOCKED is deprecated. Init the lock array at runtime
> > instead.
> >
> > Signed-off-by: Thomas Gleixner <tglx@...>
> > Cc: Benjamin Herrenschmidt <benh@...>
> > Cc: linuxppc-dev@...
> > ---
>
> Looks reasonable. But iseries can be a bitch, so we do need to test it
> on monday.
Tested-by: Stephen Rothwell <sfr@...>
--
Cheers,
Stephen Rothwell                    sfr@...
http://www.canb.auug.org.au/~sfr/


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@...
https://lists.ozlabs.org/listinfo/linuxppc-dev

attachment0 (205 bytes) Download Attachment

Re: [patch 09/16] powerpc: Replace old style lock initializer

by Benjamin Herrenschmidt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2009-11-09 at 16:15 +1100, Stephen Rothwell wrote:

> Hi Thomas,
>
> On Sat, 07 Nov 2009 09:55:44 +1100 Benjamin Herrenschmidt <benh@...> wrote:
> >
> > On Fri, 2009-11-06 at 22:41 +0000, Thomas Gleixner wrote:
> > > plain text document attachment
> > > (power-replace-old-style-lock-init.patch)
> > > SPIN_LOCK_UNLOCKED is deprecated. Init the lock array at runtime
> > > instead.
> > >
> > > Signed-off-by: Thomas Gleixner <tglx@...>
> > > Cc: Benjamin Herrenschmidt <benh@...>
> > > Cc: linuxppc-dev@...
> > > ---
> >
> > Looks reasonable. But iseries can be a bitch, so we do need to test it
> > on monday.
>
> Tested-by: Stephen Rothwell <sfr@...>

Thanks Stephen !

Acked-by: Benjamin Herrenschmidt <benh@...>

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@...
https://lists.ozlabs.org/listinfo/linuxppc-dev