Remove old style lock initializers
Subsystems (16)
cover Remove old style lock initializers
The old style lock initializers SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED are deprecated for several years. The series fixes the remaining users and removes the defines.
Thanks,
tglx
PATCH 1/16 arm: Replace old style lock initializer
SPIN_LOCK_UNLOCKED is deprecated. Initialize the per cpu ipi locks via spin_lock_init.
--- arch/arm/kernel/smp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arm/kernel/smp.c +4 -3
@@ -55,9 +55,7 @@ struct ipi_data {unsigned long bits; }; -static DEFINE_PER_CPU(struct ipi_data, ipi_data) = { - .lock =SPIN_LOCK_UNLOCKED , -}; +static DEFINE_PER_CPU(struct ipi_data, ipi_data);enum ipi_msg_type {IPI_TIMER ,
@@ -329,6 +327,9 @@ void __init smp_prepare_boot_cpu(void)unsigned int cpu =smp_processor_id ();per_cpu (cpu_data, cpu).idle = current; + +for_each_possible_cpu (cpu) +spin_lock_init (&per_cpu (ipi_data, cpu).lock); }static void send_ipi_message (const struct cpumask *mask,enum ipi_msg_type msg)
PATCH 2/16 mips: Replace old style spin lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Use __SPIN_LOCK_UNLOCKED instead.
--- arch/mips/kernel/vpe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/kernel/vpe.c +2 -2
@@ -149,9 +149,9 @@ struct {spinlock_t tc_list_lock;struct list_head tc_list;/* Thread contexts */ } vpecontrol = { - .vpe_list_lock = SPIN_LOCK_UNLOCKED, + .vpe_list_lock = __SPIN_LOCK_UNLOCKED(vpecontrol.vpe_list_lock), .vpe_list = LIST_HEAD_INIT(vpecontrol.vpe_list), - .tc_list_lock = SPIN_LOCK_UNLOCKED, + .tc_list_lock = __SPIN_LOCK_UNLOCKED(vpecontrol.tc_list_lock), .tc_list =LIST_HEAD_INIT (vpecontrol.tc_list) };
PATCH 3/16 net: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Use DEFINE_SPINLOCK instead.
--- net/core/drop_monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/drop_monitor.c +1 -1
@@ -41,7 +41,7 @@ static void send_dm_alert(struct work_st* netlink alerts */ static int trace_state =TRACE_OFF ; -static spinlock_t trace_state_lock =SPIN_LOCK_UNLOCKED ; +static DEFINE_SPINLOCK (trace_state_lock);struct per_cpu_dm_data {struct work_struct dm_alert_work;
Re: [patch 03/16] net: Replace old style lock initializer
From: Thomas Gleixner <[email protected]>
Date: Fri, 06 Nov 2009 22:41:15 -0000
Quoted 3 lines
SPIN_LOCK_UNLOCKEDis deprecated. UseDEFINE_SPINLOCKinstead.Signed-off-by Thomas Gleixner <[email protected]>
Applied to net-next-2.6, thanks.
PATCH 4/16 cred: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Use __SPIN_LOCK_UNLOCKED instead.
--- kernel/cred.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cred.c +1 -1
@@ -39,7 +39,7 @@ static struct kmem_cache *cred_jar;static struct thread_group_cred init_tgcred = { .usage =ATOMIC_INIT (2 ), .tgid =0 , - .lock =SPIN_LOCK_UNLOCKED , + .lock =__SPIN_LOCK_UNLOCKED (init_tgcred.lock), };#endif
PATCH 5/16 pci: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Use DEFINE_SPINLOCK instead.
Make the lock static while at it.
--- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci.c +1 -1
@@ -2590,7 +2590,7 @@ int pci_set_vga_state(struct pci_dev *de#define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZEstatic char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE ] = {0 }; -spinlock_t resource_alignment_lock =SPIN_LOCK_UNLOCKED ; +static DEFINE_SPINLOCK (resource_alignment_lock);/** * pci_specified_resource_alignment - get resource alignment specified by user.
Jesse Barnes
AppliedRe: [patch 05/16] pci: Replace old style lock initializer
Quoted 23 lines · On Fri, 06 Nov 2009 22:41:23 -0000 Thomas Gleixner <[email protected]> wrote:
SPIN_LOCK_UNLOCKEDis deprecated. UseDEFINE_SPINLOCKinstead.Make the lock static while at it.
Signed-off-by Thomas Gleixner <[email protected]>Cc Jesse Barnes <[email protected]>--- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Index:
linux-2.6/drivers/pci/pci.c
===================================================================drivers/pci/pci.c +1
-0@@ -2590,7 +2590,7 @@ int pci_set_vga_state(struct pci_dev *de#define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZEstatic char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE ] = {0}; -spinlock_t resource_alignment_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK (resource_alignment_lock);/** * pci_specified_resource_alignment - get resource alignment
Quoted 1 line
specified by user.
Applied to my linux-next branch, thanks.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
PATCH 6/16 sound: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Use __SPIN_LOCK_UNLOCKED instead.
--- sound/oss/dmasound/dmasound_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/oss/dmasound/dmasound_core.c +3 -1
@@ -219,7 +219,9 @@ static int shared_resources_initialised;* Mid level stuff */ -struct sound_settings dmasound = { .lock =SPIN_LOCK_UNLOCKED }; +struct sound_settings dmasound = { + .lock =__SPIN_LOCK_UNLOCKED (dmasound.lock) +};static inline void sound_silence (void ) {
Takashi Iwai
AppliedRe: [patch 06/16] sound: Replace old style lock initializer
At Fri, 06 Nov 2009 22:41:29 -0000,
Quoted 5 lines · Thomas Gleixner
SPIN_LOCK_UNLOCKEDis deprecated. Use__SPIN_LOCK_UNLOCKEDinstead.Signed-off-by Thomas Gleixner <[email protected]>Cc Takashi Iwai <[email protected]>
Applied to sound git tree now. Thanks!
Takashi
Quoted 21 lines
--- sound/oss/dmasound/dmasound_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Index:
linux-2.6/sound/oss/dmasound/dmasound_core.c
===================================================================sound/oss/dmasound/dmasound_core.c +3
-1@@ -219,7 +219,9 @@ static int shared_resources_initialised;* Mid level stuff */ -struct sound_settings dmasound = { .lock =SPIN_LOCK_UNLOCKED }; +struct sound_settings dmasound = { + .lock =__SPIN_LOCK_UNLOCKED (dmasound.lock) +};static inline void sound_silence (void ) {
PATCH 7/16 um: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated since quite a while. Runtime init the locks instead.
--- arch/um/drivers/ubd_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/ubd_kern.c +1 -1
@@ -180,7 +180,6 @@ struct ubd { .no_cow = 0, \ .shared = 0, \ .cow = DEFAULT_COW, \ - .lock = SPIN_LOCK_UNLOCKED, \ .request = NULL, \ .start_sg = 0, \ .end_sg = 0, \
@@ -838,6 +837,7 @@ static int ubd_add(int n, char **error_o ubd_dev->size =ROUND_BLOCK (ubd_dev->size); +spin_lock_init (&ubd_dev->lock);INIT_LIST_HEAD (&ubd_dev->restart);sg_init_table (ubd_dev->sg,MAX_SG );
Re: [patch 07/16] um: Replace old style lock initializer
Quoted 5 lines · Thomas Gleixner
SPIN_LOCK_UNLOCKEDis deprecated since quite a while. Runtime init the locks instead.Signed-off-by Thomas Gleixner <[email protected]>Cc Jeff Dike <[email protected]>
Thanks.
Quoted 31 lines
---
arch/um/drivers/ubd_kern.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Index:
linux-2.6/arch/um/drivers/ubd_kern.c
===================================================================arch/um/drivers/ubd_kern.c +1
-2@@ -180,7 +180,6 @@ struct ubd { .no_cow = 0, \ .shared = 0, \ .cow = DEFAULT_COW, \ - .lock = SPIN_LOCK_UNLOCKED, \ .request = NULL, \ .start_sg = 0, \ .end_sg = 0, \@@ -838,6 +837,7 @@ static int ubd_add(int n, char **error_o ubd_dev->size =ROUND_BLOCK (ubd_dev->size); +spin_lock_init (&ubd_dev->lock);INIT_LIST_HEAD (&ubd_dev->restart);sg_init_table (ubd_dev->sg,MAX_SG ); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 1 line
Live like a child, think like the god.
PATCH 8/16 sparc: Make atomic locks raw
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated and the locks which protect the atomic operations have no dependency on other locks and the code is well tested so the conversion to a raw lock is safe.
Make the lock array static while at it.
--- arch/sparc/lib/atomic32.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
Index: linux-2.6/arch/sparc/lib/atomic32.c =================================--- linux-2.6.orig/arch/sparc/lib/atomic32.c +++ linux-2.6/arch/sparc/lib/atomic32.c
@@ -15,8 +15,8 @@
#define ATOMIC_HASH_SIZE 4
#define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)])
-spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
- [0 ... (ATOMIC_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED
+static raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
+ [0 ... (ATOMIC_HASH_SIZE-1)] = __RAW_SPIN_LOCK_UNLOCKED
};
#else /* SMP */
@@ -31,11 +31,11 @@ int __atomic_add_return(int i, atomic_t
{
int ret;
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
ret = (v->counter += i);
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret;
}
EXPORT_SYMBOL(__atomic_add_return);
@@ -45,12 +45,12 @@ int atomic_cmpxchg(atomic_t *v, int old,
int ret;
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
ret = v->counter;
if (likely(ret = old))
v->counter = new;
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret;
}
EXPORT_SYMBOL(atomic_cmpxchg);
@@ -60,11 +60,11 @@ int atomic_add_unless(atomic_t *v, int a
int ret;
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
ret = v->counter;
if (ret != u)
v->counter += a;
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
return ret != u;
}
EXPORT_SYMBOL(atomic_add_unless);
@@ -74,9 +74,9 @@ void atomic_set(atomic_t *v, int i)
{
unsigned long flags;
- spin_lock_irqsave(ATOMIC_HASH(v), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(v), flags);
v->counter = i;
- spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
}
EXPORT_SYMBOL(atomic_set);
@@ -84,10 +84,10 @@ unsigned long ___set_bit(unsigned long *
{
unsigned long old, flags;
- spin_lock_irqsave(ATOMIC_HASH(addr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
old = *addr;
*addr = old | mask;
- spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
return old & mask;
}
@@ -97,10 +97,10 @@ unsigned long ___clear_bit(unsigned long
{
unsigned long old, flags;
- spin_lock_irqsave(ATOMIC_HASH(addr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
old = *addr;
*addr = old & ~mask;
- spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
return old & mask;
}
@@ -110,10 +110,10 @@ unsigned long ___change_bit(unsigned lon
{
unsigned long old, flags;
- spin_lock_irqsave(ATOMIC_HASH(addr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
old = *addr;
*addr = old ^ mask;
- spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
return old & mask;
}
@@ -124,10 +124,10 @@ unsigned long __cmpxchg_u32(volatile u32
unsigned long flags;
u32 prev;
- spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
+ __raw_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
if ((prev = *ptr) = old)
*ptr = new;
- spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
+ __raw_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
return (unsigned long)prev;
}
Re: [patch 08/16] sparc: Make atomic locks raw
From: Thomas Gleixner <[email protected]>
Date: Fri, 06 Nov 2009 22:41:39 -0000
Quoted 7 lines
SPIN_LOCK_UNLOCKEDis deprecated and the locks which protect the atomic operations have no dependency on other locks and the code is well tested so the conversion to a raw lock is safe.Make the lock array static while at it.
Signed-off-by Thomas Gleixner <[email protected]>
Applied to sparc-next-2.6, thanks!
PATCH 9/16 powerpc: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Init the lock array at runtime instead.
--- arch/powerpc/platforms/iseries/htab.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/platforms/iseries/htab.c +6 -2
@@ -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(unsivoid __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;
Re: [patch 09/16] powerpc: Replace old style lock initializer
Quoted 9 lines · Thomas Gleixner
plain text document attachment (power-replace-old-style-lock-init.patch)
SPIN_LOCK_UNLOCKEDis deprecated. Init the lock array at runtime instead.Signed-off-by Thomas Gleixner <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>---
Looks reasonable. But iseries can be a bitch, so we do need to test it on monday.
Cheers,
Ben.
Quoted 36 lines
arch/powerpc/platforms/iseries/htab.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)Index:
linux-2.6/arch/powerpc/platforms/iseries/htab.c
===================================================================arch/powerpc/platforms/iseries/htab.c +6
-3@@ -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(unsivoid __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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 09/16] powerpc: Replace old style lock initializer
Hi Ben,
Quoted 3 lines · On Sat, 07 Nov 2009 09:55:44 +1100 Benjamin Herrenschmidt…
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. :-)
Quoted 10 lines
Quoted 10 lines
void
__inithpte_init_iSeries(void)
{arch/powerpc/platforms/iseries/htab.c +5
-0+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;
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Stephen Rothwell
Tested-byRe: [patch 09/16] powerpc: Replace old style lock initializer
In reply to Benjamin HerrenschmidtHi Thomas,
Quoted 7 lines · On Sat, 07 Nov 2009 09:55:44 +1100 Benjamin Herrenschmidt…
Quoted 5 lines · Thomas Gleixner
plain text document attachment (power-replace-old-style-lock-init.patch)
SPIN_LOCK_UNLOCKEDis deprecated. Init the lock array at runtime instead.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Thomas Gleixner <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>---
Looks reasonable. But iseries can be a bitch, so we do need to test it on monday.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Benjamin Herrenschmidt
Acked-byRe: [patch 09/16] powerpc: Replace old style lock initializer
Quoted 15 lines · Stephen Rothwell
Hi Thomas,
Quoted 12 lines · On Sat, 07 Nov 2009 09:55:44 +1100 Benjamin Herrenschmidt…
Quoted 9 lines · Thomas Gleixner
plain text document attachment (power-replace-old-style-lock-init.patch)
SPIN_LOCK_UNLOCKEDis deprecated. Init the lock array at runtime instead.Signed-off-by Thomas Gleixner <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>---
Quoted 4 lines
Quoted 2 lines
Looks reasonable. But iseries can be a bitch, so we do need to test it on monday.
Tested-by Stephen Rothwell <[email protected]>
Thanks Stephen !
PATCH 10/16 parisc: Replace old style lock init
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Init the per cpu locks at runtime instead.
--- arch/parisc/kernel/smp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/parisc/kernel/smp.c +6 -3
@@ -60,8 +60,6 @@ static int smp_debug_lvl = 0;#define smp_debug (lvl, ...) do { } while(0)#endif /* DEBUG_SMP */ -DEFINE_SPINLOCK (smp_lock); -volatile struct task_struct *smp_init_current_idle_task;/* track which CPU is booting */
@@ -69,7 +67,7 @@ static volatile int cpu_now_booting __cpstatic int parisc_max_cpus__cpuinitdata =1 ; -DEFINE_PER_CPU (spinlock_t, ipi_lock) =SPIN_LOCK_UNLOCKED ; +static DEFINE_PER_CPU(spinlock_t, ipi_lock);enum ipi_message_type {IPI_NOP =0 ,
@@ -438,6 +436,11 @@ void __init smp_prepare_boot_cpu(void)*/ void __init smp_prepare_cpus (unsigned int max_cpus) { +int cpu; + +for_each_possible_cpu (cpu) +spin_lock_init (&per_cpu (ipi_lock, cpu)); +init_cpu_present (cpumask_of (0 )); parisc_max_cpus = max_cpus;
Re: [patch 10/16] parisc: Replace old style lock init
Quoted 6 lines · Thomas Gleixner
SPIN_LOCK_UNLOCKEDis deprecated. Init the per cpu locks at runtime instead.Signed-off-by Thomas Gleixner <[email protected]>Cc Kyle McMartin <[email protected]>
applied with one nit.
arch/parisc/kernel/smp.c static int smp_debug_lvl = 0; · line 64
Quoted 3 lines
arch/parisc/kernel/smp.c +0
-2-DEFINE_SPINLOCK (smp_lock); -
You forgot to mention this was unused. :) Confused me for a while.
cheers, Kyle
Quoted 27 lines
volatile struct
task_struct*smp_init_current_idle_task;/* track which CPU is booting */
arch/parisc/kernel/smp.c +6
-1@@ -69,7 +67,7 @@ static volatile int cpu_now_booting __cpstatic int parisc_max_cpus__cpuinitdata =1 ; -DEFINE_PER_CPU (spinlock_t, ipi_lock) =SPIN_LOCK_UNLOCKED ; +static DEFINE_PER_CPU(spinlock_t, ipi_lock);enum ipi_message_type {IPI_NOP =0 ,@@ -438,6 +436,11 @@ void __init smp_prepare_boot_cpu(void)*/ void __init smp_prepare_cpus (unsigned int max_cpus) { +int cpu; + +for_each_possible_cpu (cpu) +spin_lock_init (&per_cpu (ipi_lock, cpu)); +init_cpu_present (cpumask_of (0 )); parisc_max_cpus = max_cpus;
Re: [patch 10/16] parisc: Replace old style lock init
Quoted 8 lines · Kyle McMartin
Quoted 6 lines · Thomas Gleixner
SPIN_LOCK_UNLOCKEDis deprecated. Init the per cpu locks at runtime instead.Signed-off-by Thomas Gleixner <[email protected]>Cc Kyle McMartin <[email protected]>
Quoted 7 lines
applied with one nit.
arch/parisc/kernel/smp.c static int smp_debug_lvl = 0; · line 64
Quoted 3 lines
arch/parisc/kernel/smp.c +0
-2-DEFINE_SPINLOCK (smp_lock); -You forgot to mention this was unused. :) Confused me for a while.
Gah. Wanted to add it to the changelog, but slipped from my mind.
Sorry for the confusion,
tglx
PATCH 11/16 alpha: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Use __SPIN_LOCK_UNLOCKED instead.
--- arch/alpha/include/asm/rwsem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/alpha/include/asm/rwsem.h +1 -1
@@ -39,7 +39,7 @@ struct rw_semaphore { };#define __RWSEM_INITIALIZER (name) \ - { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ + { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ LIST_HEAD_INIT((name).wait_list) }#define DECLARE_RWSEM (name) \
PATCH 12/16 ia64: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Use __SPIN_LOCK_UNLOCKED instead.
--- arch/ia64/include/asm/rwsem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6/arch/ia64/include/asm/rwsem.h =================================--- linux-2.6.orig/arch/ia64/include/asm/rwsem.h +++ linux-2.6/arch/ia64/include/asm/rwsem.h
@@ -47,7 +47,7 @@ struct rw_semaphore {
#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
#define __RWSEM_INITIALIZER(name) \
- { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
+ { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
LIST_HEAD_INIT((name).wait_list) }
#define DECLARE_RWSEM(name) \
PATCH 13/16 sh: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Use __SPIN_LOCK_UNLOCKED instead.
--- arch/sh/include/asm/rwsem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6/arch/sh/include/asm/rwsem.h =================================--- linux-2.6.orig/arch/sh/include/asm/rwsem.h +++ linux-2.6/arch/sh/include/asm/rwsem.h
@@ -41,7 +41,7 @@ struct rw_semaphore {
#endif
#define __RWSEM_INITIALIZER(name) \
- { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
+ { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
LIST_HEAD_INIT((name).wait_list) \
__RWSEM_DEP_MAP_INIT(name) }
Paul Mundt
AppliedRe: [patch 13/16] sh: Replace old style lock initializer
Quoted 5 lines · Thomas Gleixner
SPIN_LOCK_UNLOCKEDis deprecated. Use__SPIN_LOCK_UNLOCKEDinstead.Signed-off-by Thomas Gleixner <[email protected]>Cc Paul Mundt <[email protected]>
Applied, thanks.
PATCH 14/16 sparc: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Use __SPIN_LOCK_UNLOCKED instead.
--- arch/sparc/include/asm/rwsem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6/arch/sparc/include/asm/rwsem.h =================================--- linux-2.6.orig/arch/sparc/include/asm/rwsem.h +++ linux-2.6/arch/sparc/include/asm/rwsem.h
@@ -35,8 +35,8 @@ struct rw_semaphore {
#endif
#define __RWSEM_INITIALIZER(name) \
-{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \
- __RWSEM_DEP_MAP_INIT(name) }
+{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock),
+ LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
#define DECLARE_RWSEM(name) \
struct rw_semaphore name = __RWSEM_INITIALIZER(name)
Re: [patch 14/16] sparc: Replace old style lock initializer
From: Thomas Gleixner <[email protected]>
Date: Fri, 06 Nov 2009 22:42:14 -0000
Quoted 3 lines
SPIN_LOCK_UNLOCKEDis deprecated. Use__SPIN_LOCK_UNLOCKEDinstead.Signed-off-by Thomas Gleixner <[email protected]>
Applied to sparc-next-2.6, thanks.
David Miller
maintainerRe: [patch 14/16] sparc: Replace old style lock initializer
From: David Miller <[email protected]>
Date: Fri, 06 Nov 2009 22:18:34 -0800 (PST)
Quoted 8 lines
From: Thomas Gleixner <[email protected]>
Date: Fri, 06 Nov 2009 22:42:14 -0000Quoted 3 lines
SPIN_LOCK_UNLOCKEDis deprecated. Use__SPIN_LOCK_UNLOCKEDinstead.Signed-off-by Thomas Gleixner <[email protected]>Applied to sparc-next-2.6, thanks.
This breaks the build:
/home/davem/src/GIT/sparc-next-2.6/arch/sparc/include/asm/rwsem.h:39: error: expected identifier or ‘(’ before ‘{’ token /home/davem/src/GIT/sparc-next-2.6/arch/sparc/include/asm/rwsem.h:39: error: expected identifier or ‘(’ before ‘}’ token make[1]: *** [arch/sparc/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2 ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Re: [patch 14/16] sparc: Replace old style lock initializer
Quoted 10 lines · David Miller
From: David Miller <[email protected]>
Date: Fri, 06 Nov 2009 22:18:34 -0800 (PST)Quoted 7 lines
From: Thomas Gleixner <[email protected]>
Date: Fri, 06 Nov 2009 22:42:14 -0000Quoted 3 lines
SPIN_LOCK_UNLOCKEDis deprecated. Use__SPIN_LOCK_UNLOCKEDinstead.Signed-off-by Thomas Gleixner <[email protected]>
Quoted 8 lines
Quoted 1 line
Applied to sparc-next-2.6, thanks.
This breaks the build:
/home/davem/src/GIT/sparc-next-2.6/arch/sparc/include/asm/rwsem.h:39: error: expected identifier or ‘(’ before ‘{’ token/home/davem/src/GIT/sparc-next-2.6/arch/sparc/include/asm/rwsem.h:39: error: expected identifier or ‘(’ before ‘}’ token make[1]: *** [arch/sparc/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
Darn, I compiled it but the 32bit build does not use that file :) Working version below.
Thanks,
tglx
---
Subject: sparc: Replace old style lock initializer
From: Thomas Gleixner <[email protected]>
Date: Fri, 06 Nov 2009 22:06:35 +0100
SPIN_LOCK_UNLOCKED is deprecated. Use __SPIN_LOCK_UNLOCKED instead.
--- arch/sparc/include/asm/rwsem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/sparc/include/asm/rwsem.h +2 -2
@@ -35,8 +35,8 @@ struct rw_semaphore {#endif #define __RWSEM_INITIALIZER (name) \ -{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \ - __RWSEM_DEP_MAP_INIT(name) } +{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ + LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }#define DECLARE_RWSEM (name) \ struct rw_semaphore name = __RWSEM_INITIALIZER(name)
David Miller
maintainerRe: [patch 14/16] sparc: Replace old style lock initializer
From: Thomas Gleixner <[email protected]>
Date: Sat, 7 Nov 2009 13:16:24 +0100 (CET)
Quoted 2 lines
Darn, I compiled it but the 32bit build does not use that file :) Working version below.
Looks a lot better, applied, thanks!
PATCH 15/16 xtensa: Replace old style lock initializer
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED is deprecated. Use __SPIN_LOCK_UNLOCKED instead.
--- arch/xtensa/include/asm/rwsem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/xtensa/include/asm/rwsem.h +1 -1
@@ -38,7 +38,7 @@ struct rw_semaphore { };#define __RWSEM_INITIALIZER (name) \ - { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ + { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ LIST_HEAD_INIT((name).wait_list) }#define DECLARE_RWSEM (name) \
Chris Zankel
maintainerRe: [patch 15/16] xtensa: Replace old style lock initializer
Quoted 3 lines · Thomas Gleixner
SPIN_LOCK_UNLOCKEDis deprecated. Use__SPIN_LOCK_UNLOCKEDinstead.Signed-off-by Thomas Gleixner <[email protected]>
Quoted 18 lines
--- arch/xtensa/include/asm/rwsem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Index:
linux-2.6/arch/xtensa/include/asm/rwsem.h
===================================================================arch/xtensa/include/asm/rwsem.h +1
-1@@ -38,7 +38,7 @@ struct rw_semaphore { };#define __RWSEM_INITIALIZER (name) \ - { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ + { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ LIST_HEAD_INIT((name).wait_list) }#define DECLARE_RWSEM (name) \
PATCH 16/16 locking: Remove old style lock initializers
In reply to Thomas GleixnerSPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED have been deprecated for years. Now the last users are gone. Remove the cruft.
--- include/linux/spinlock.h | 4 ++-- include/linux/spinlock_types.h | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-)
include/linux/spinlock.h +2 -2
@@ -102,7 +102,7 @@ do { \#else # define spin_lock_init (lock) \ - do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0) + do { *(lock) = __SPIN_LOCK_UNLOCKED(lock); } while (0)#endif #ifdef CONFIG_DEBUG_SPINLOCK
@@ -116,7 +116,7 @@ do { \ } while (0)#else # define rwlock_init (lock) \ - do { *(lock) = RW_LOCK_UNLOCKED; } while (0) + do { *(lock) = __RW_LOCK_UNLOCKED(lock); } while (0)#endif #define spin_is_locked (lock) __raw_spin_is_locked(&(lock)->raw_lock)
include/linux/spinlock_types.h +0 -9
@@ -85,15 +85,6 @@ typedef struct { RW_DEP_MAP_INIT(lockname) }#endif -/* -* SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED defeat lockdep state tracking and -* are hence deprecated. -* Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or -* __SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate. -*/ -#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init) -#define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init) -#define DEFINE_SPINLOCK (x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)#define DEFINE_RWLOCK (x) rwlock_t x = __RW_LOCK_UNLOCKED(x)