diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-16 12:42:51 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-26 02:55:34 -0400 |
commit | 6893ce6c1cdcf489b7ca8e6b6596208aa971a083 (patch) | |
tree | 0f6b22ad7db5f55a435ccbda1989af24fda9300a /arch/powerpc/platforms | |
parent | c4007a2fbf5f82b7e694c22b5929c87e38415a56 (diff) |
powerpc/pasemi: Use raw spinlock in SMP TB sync
spin_lock() can hang if called while the timebase is frozen,
so use a raw lock instead, also disable interrupts while
at it.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/pasemi/setup.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c index 153051eb6d93..a4619347aa7e 100644 --- a/arch/powerpc/platforms/pasemi/setup.c +++ b/arch/powerpc/platforms/pasemi/setup.c | |||
@@ -71,20 +71,25 @@ static void pas_restart(char *cmd) | |||
71 | } | 71 | } |
72 | 72 | ||
73 | #ifdef CONFIG_SMP | 73 | #ifdef CONFIG_SMP |
74 | static DEFINE_SPINLOCK(timebase_lock); | 74 | static raw_spinlock_t timebase_lock; |
75 | static unsigned long timebase; | 75 | static unsigned long timebase; |
76 | 76 | ||
77 | static void __devinit pas_give_timebase(void) | 77 | static void __devinit pas_give_timebase(void) |
78 | { | 78 | { |
79 | spin_lock(&timebase_lock); | 79 | unsigned long flags; |
80 | |||
81 | local_irq_save(flags); | ||
82 | hard_irq_disable(); | ||
83 | __raw_spin_lock(&timebase_lock); | ||
80 | mtspr(SPRN_TBCTL, TBCTL_FREEZE); | 84 | mtspr(SPRN_TBCTL, TBCTL_FREEZE); |
81 | isync(); | 85 | isync(); |
82 | timebase = get_tb(); | 86 | timebase = get_tb(); |
83 | spin_unlock(&timebase_lock); | 87 | __raw_spin_unlock(&timebase_lock); |
84 | 88 | ||
85 | while (timebase) | 89 | while (timebase) |
86 | barrier(); | 90 | barrier(); |
87 | mtspr(SPRN_TBCTL, TBCTL_RESTART); | 91 | mtspr(SPRN_TBCTL, TBCTL_RESTART); |
92 | local_irq_restore(flags); | ||
88 | } | 93 | } |
89 | 94 | ||
90 | static void __devinit pas_take_timebase(void) | 95 | static void __devinit pas_take_timebase(void) |
@@ -92,10 +97,10 @@ static void __devinit pas_take_timebase(void) | |||
92 | while (!timebase) | 97 | while (!timebase) |
93 | smp_rmb(); | 98 | smp_rmb(); |
94 | 99 | ||
95 | spin_lock(&timebase_lock); | 100 | __raw_spin_lock(&timebase_lock); |
96 | set_tb(timebase >> 32, timebase & 0xffffffff); | 101 | set_tb(timebase >> 32, timebase & 0xffffffff); |
97 | timebase = 0; | 102 | timebase = 0; |
98 | spin_unlock(&timebase_lock); | 103 | __raw_spin_unlock(&timebase_lock); |
99 | } | 104 | } |
100 | 105 | ||
101 | struct smp_ops_t pas_smp_ops = { | 106 | struct smp_ops_t pas_smp_ops = { |