(2.6.20-rt3) PowerPC: convert spinlocks into raw
PATCH 1/1 (2.6.20-rt3) PowerPC: convert spinlocks into raw
Convert the spinlocks in the PowerPC interrupt related code into the raw ones, also convert the PURR and PMC related spinlocks...
arch/powerpc/kernel/irq.c +1 -1
@@ -392,7 +392,7 @@ EXPORT_SYMBOL(do_softirq);#ifdef CONFIG_PPC_MERGE static LIST_HEAD (irq_hosts); -static spinlock_t irq_big_lock =SPIN_LOCK_UNLOCKED ; +static DEFINE_RAW_SPINLOCK (irq_big_lock); static DEFINE_PER_CPU(unsigned int, irq_radix_reader);static unsigned int irq_radix_writer;struct irq_map_entry irq_map[NR_IRQS ];
arch/powerpc/kernel/pmc.c +1 -1
@@ -52,7 +52,7 @@ static void dummy_perf(struct pt_regs *r }#endif -static DEFINE_SPINLOCK (pmc_owner_lock); +static DEFINE_RAW_SPINLOCK (pmc_owner_lock);static void *pmc_owner_caller;/* mostly for debugging */ perf_irq_t perf_irq = dummy_perf;
arch/powerpc/kernel/time.c +1 -1
@@ -223,7 +223,7 @@ struct cpu_purr_data {int initialized;/* thread is running */ u64 tb;/* last TB value read */ u64 purr;/* last PURR value read */ -spinlock_t lock; +raw_spinlock_t lock; }; static DEFINE_PER_CPU(struct cpu_purr_data, cpu_purr_data);
arch/powerpc/sysdev/i8259.c +1 -1
@@ -23,7 +23,7 @@ static unsigned char cached_8259[2] = {#define cached_A1 (cached_8259[0])#define cached_21 (cached_8259[1]) -static DEFINE_SPINLOCK (i8259_lock); +static DEFINE_RAW_SPINLOCK (i8259_lock);static struct device_node *i8259_node;static struct irq_host *i8259_host;
arch/powerpc/sysdev/ipic.c +1 -1
@@ -30,7 +30,7 @@#include "ipic.h" static struct ipic * primary_ipic; -static DEFINE_SPINLOCK (ipic_lock); +static DEFINE_RAW_SPINLOCK (ipic_lock);static struct ipic_info ipic_info[] = { [9 ] = {
arch/powerpc/sysdev/mpic.c +1 -1
@@ -44,7 +44,7 @@static struct mpic *mpics;static struct mpic *mpic_primary; -static DEFINE_SPINLOCK (mpic_lock); +static DEFINE_RAW_SPINLOCK (mpic_lock);#ifdef CONFIG_PPC32 /* XXX for now */ #ifdef CONFIG_IRQ_ALL_CPUS
include/asm-powerpc/mpic.h +1 -1
@@ -279,7 +279,7 @@ struct mpic#ifdef CONFIG_MPIC_BROKEN_U3 /* The fixup table */ struct mpic_irq_fixup *fixups; -spinlock_t fixup_lock; +raw_spinlock_t fixup_lock;#endif /* Register access method */
Quoted 2 lines · Sergei Shtylyov
Convert the spinlocks in the PowerPC interrupt related code into the raw ones, also convert the PURR and PMC related spinlocks...
Care to explain the difference ? This is related to the -rt stuff ?
Cheers,
Ben.
Quoted 99 lines
Signed-off-by Mark A. Greer <[email protected]>Signed-off-by Sergei Shtylyov <[email protected]>Index:
linux-2.6/arch/powerpc/kernel/irq.c
===================================================================arch/powerpc/kernel/irq.c +1
-1@@ -392,7 +392,7 @@ EXPORT_SYMBOL(do_softirq);#ifdef CONFIG_PPC_MERGE static LIST_HEAD (irq_hosts); -static spinlock_t irq_big_lock =SPIN_LOCK_UNLOCKED ; +static DEFINE_RAW_SPINLOCK (irq_big_lock); static DEFINE_PER_CPU(unsigned int, irq_radix_reader);static unsigned int irq_radix_writer;struct irq_map_entry irq_map[NR_IRQS ];Index:
linux-2.6/arch/powerpc/kernel/pmc.c
===================================================================arch/powerpc/kernel/pmc.c +1
-1@@ -52,7 +52,7 @@ static void dummy_perf(struct pt_regs *r }#endif -static DEFINE_SPINLOCK (pmc_owner_lock); +static DEFINE_RAW_SPINLOCK (pmc_owner_lock);static void *pmc_owner_caller;/* mostly for debugging */ perf_irq_t perf_irq = dummy_perf;Index:
linux-2.6/arch/powerpc/kernel/time.c
===================================================================arch/powerpc/kernel/time.c +1
-1@@ -223,7 +223,7 @@ struct cpu_purr_data {int initialized;/* thread is running */ u64 tb;/* last TB value read */ u64 purr;/* last PURR value read */ -spinlock_t lock; +raw_spinlock_t lock; }; static DEFINE_PER_CPU(struct cpu_purr_data, cpu_purr_data);Index:
linux-2.6/arch/powerpc/sysdev/i8259.c
===================================================================arch/powerpc/sysdev/i8259.c +1
-1@@ -23,7 +23,7 @@ static unsigned char cached_8259[2] = {#define cached_A1 (cached_8259[0])#define cached_21 (cached_8259[1]) -static DEFINE_SPINLOCK (i8259_lock); +static DEFINE_RAW_SPINLOCK (i8259_lock);static struct device_node *i8259_node;static struct irq_host *i8259_host;Index:
linux-2.6/arch/powerpc/sysdev/ipic.c
===================================================================arch/powerpc/sysdev/ipic.c +1
-1@@ -30,7 +30,7 @@#include "ipic.h" static struct ipic * primary_ipic; -static DEFINE_SPINLOCK (ipic_lock); +static DEFINE_RAW_SPINLOCK (ipic_lock);static struct ipic_info ipic_info[] = { [9 ] = {Index:
linux-2.6/arch/powerpc/sysdev/mpic.c
===================================================================arch/powerpc/sysdev/mpic.c +1
-1@@ -44,7 +44,7 @@static struct mpic *mpics;static struct mpic *mpic_primary; -static DEFINE_SPINLOCK (mpic_lock); +static DEFINE_RAW_SPINLOCK (mpic_lock);#ifdef CONFIG_PPC32 /* XXX for now */ #ifdef CONFIG_IRQ_ALL_CPUS Index:
linux-2.6/include/asm-powerpc/mpic.h
===================================================================include/asm-powerpc/mpic.h +1
-1@@ -279,7 +279,7 @@ struct mpic#ifdef CONFIG_MPIC_BROKEN_U3 /* The fixup table */ struct mpic_irq_fixup *fixups; -spinlock_t fixup_lock; +raw_spinlock_t fixup_lock;#endif /* Register access method */ _______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev
Hello.
Quoted 4 lines · Benjamin Herrenschmidt
Quoted 2 lines
Convert the spinlocks in the PowerPC interrupt related code into the raw ones, also convert the PURR and PMC related spinlocks...
Care to explain the difference ?
In the realtime preemption mode, spinlocks are implemented via mutexes,
and the kernel may be preempted if the lock it's trying to acquire is already taken by another process which shouldn't happen in the interrupt (or otherwise non-preempatble) context. In such context, the "raw" spinlocks must still be used which are (almost?) the same as the "usual" Linux spinlocks.
IIUC, the notion of the interrupt context" in the realtim (and also in the
low-latency desktop with hardirq preemption) mode is somewhat different form the usual as the interrupt handlers are executed in their own threads, and so, out of the interrupt context (that's not an absolute law: the timer interrupts are still handled the usual way, for example)...
I hope Ingo will correct me where I may be wrong. :-)
Quoted 1 line
This is related to the -rt stuff ?
Yes, it's CONFIG_PREEMPT_RT specific. That's whey I specified 2.6.20-rt3
in the subject.
Quoted 2 lines
Cheers,
Ben.
In my turn, I'd like to have your (or anybody's) comments since I have
doubts about the nee of some conversions below which Mark have originally done (though I limited myself to only adding couple more that seemed really necessary)
Quoted 10 lines
Quoted 10 lines
Signed-off-by Mark A. Greer <[email protected]>Signed-off-by Sergei Shtylyov <[email protected]>Index:
linux-2.6/arch/powerpc/kernel/irq.c
===================================================================arch/powerpc/kernel/irq.c +0
-0@@ -392,7 +392,7 @@ EXPORT_SYMBOL(do_softirq);#ifdef CONFIG_PPC_MERGE
Quoted 6 lines
arch/powerpc/kernel/irq.c EXPORT_SYMBOL(do_softirq); · line 398
Quoted 6 lines
arch/powerpc/kernel/irq.c +1
-1static LIST_HEAD (irq_hosts); -static spinlock_t irq_big_lock =SPIN_LOCK_UNLOCKED ; +static DEFINE_RAW_SPINLOCK (irq_big_lock); static DEFINE_PER_CPU(unsigned int, irq_radix_reader);static unsigned int irq_radix_writer;struct irq_map_entry irq_map[NR_IRQS ];
Erm, not very sure about irq_big_lock -- seems to only be used by IRQ
mapping code...
Quoted 8 lines
Quoted 8 lines
Index:
linux-2.6/arch/powerpc/kernel/pmc.c
===================================================================arch/powerpc/kernel/pmc.c +0
-0@@ -52,7 +52,7 @@ static void dummy_perf(struct pt_regs *r }#endif
Quoted 4 lines
Quoted 4 lines
arch/powerpc/kernel/pmc.c +1
-1-static DEFINE_SPINLOCK (pmc_owner_lock); +static DEFINE_RAW_SPINLOCK (pmc_owner_lock);static void
*pmc_owner_caller; /* mostly for debugging */perf_irq_tperf_irq=dummy_perf;
Not sure about this one -- it seemed to guard reserving/releasing the PMC
hardware (by Oprofile) and only be taken out of the interrupt context...
Quoted 12 lines
Quoted 12 lines
Index:
linux-2.6/arch/powerpc/kernel/time.c
===================================================================arch/powerpc/kernel/time.c +1
-1@@ -223,7 +223,7 @@ struct cpu_purr_data {int initialized;/* thread is running */ u64 tb;/* last TB value read */ u64 purr;/* last PURR value read */ -spinlock_t lock; +raw_spinlock_t lock; };
Quoted 1 line
arch/powerpc/kernel/time.c struct cpu_purr_data { · line 229
Quoted 1 line
arch/powerpc/kernel/time.c +0
-0static DEFINE_PER_CPU(struct cpu_purr_data, cpu_purr_data);
The PURR spinlock obviously needed to be raw being used by the timer
interrupt.
[...]
Quoted 6 lines
Quoted 6 lines
Index:
linux-2.6/arch/powerpc/sysdev/mpic.c
===================================================================arch/powerpc/sysdev/mpic.c +0
-0@@ -44,7 +44,7 @@
Quoted 7 lines
arch/powerpc/sysdev/mpic.c line 50
Quoted 7 lines
arch/powerpc/sysdev/mpic.c +1
-1static struct mpic *mpics;static struct mpic *mpic_primary; -static DEFINE_SPINLOCK (mpic_lock); +static DEFINE_RAW_SPINLOCK (mpic_lock);#ifdef CONFIG_PPC32 /* XXX for now */ #ifdef CONFIG_IRQ_ALL_CPUS
Not sure about this one -- it seemed to only be taken out of the interrupt
context...
Quoted 12 lines
Quoted 12 lines
Index:
linux-2.6/include/asm-powerpc/mpic.h
===================================================================include/asm-powerpc/mpic.h +1
-1@@ -279,7 +279,7 @@ struct mpic#ifdef CONFIG_MPIC_BROKEN_U3 /* The fixup table */ struct mpic_irq_fixup *fixups; -spinlock_t fixup_lock; +raw_spinlock_t fixup_lock;#endif
Quoted 1 line
include/asm-powerpc/mpic.h struct mpic · line 285
Quoted 1 line
include/asm-powerpc/mpic.h +0
-0/* Register access method */
This one is also taken by the OpenPIC code in the interrupt context.
WBR, Sergei