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>
This commit is contained in:
parent
c4007a2fbf
commit
6893ce6c1c
@ -71,20 +71,25 @@ static void pas_restart(char *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
static DEFINE_SPINLOCK(timebase_lock);
|
static raw_spinlock_t timebase_lock;
|
||||||
static unsigned long timebase;
|
static unsigned long timebase;
|
||||||
|
|
||||||
static void __devinit pas_give_timebase(void)
|
static void __devinit pas_give_timebase(void)
|
||||||
{
|
{
|
||||||
spin_lock(&timebase_lock);
|
unsigned long flags;
|
||||||
|
|
||||||
|
local_irq_save(flags);
|
||||||
|
hard_irq_disable();
|
||||||
|
__raw_spin_lock(&timebase_lock);
|
||||||
mtspr(SPRN_TBCTL, TBCTL_FREEZE);
|
mtspr(SPRN_TBCTL, TBCTL_FREEZE);
|
||||||
isync();
|
isync();
|
||||||
timebase = get_tb();
|
timebase = get_tb();
|
||||||
spin_unlock(&timebase_lock);
|
__raw_spin_unlock(&timebase_lock);
|
||||||
|
|
||||||
while (timebase)
|
while (timebase)
|
||||||
barrier();
|
barrier();
|
||||||
mtspr(SPRN_TBCTL, TBCTL_RESTART);
|
mtspr(SPRN_TBCTL, TBCTL_RESTART);
|
||||||
|
local_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __devinit pas_take_timebase(void)
|
static void __devinit pas_take_timebase(void)
|
||||||
@ -92,10 +97,10 @@ static void __devinit pas_take_timebase(void)
|
|||||||
while (!timebase)
|
while (!timebase)
|
||||||
smp_rmb();
|
smp_rmb();
|
||||||
|
|
||||||
spin_lock(&timebase_lock);
|
__raw_spin_lock(&timebase_lock);
|
||||||
set_tb(timebase >> 32, timebase & 0xffffffff);
|
set_tb(timebase >> 32, timebase & 0xffffffff);
|
||||||
timebase = 0;
|
timebase = 0;
|
||||||
spin_unlock(&timebase_lock);
|
__raw_spin_unlock(&timebase_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct smp_ops_t pas_smp_ops = {
|
struct smp_ops_t pas_smp_ops = {
|
||||||
|
Loading…
Reference in New Issue
Block a user