Skip to content

Commit bdf9bec

Browse files
Sebastian Andrzej Siewiorvijay-suman
authored andcommitted
clocksource/i8253: Use raw_spinlock_irqsave() in clockevent_i8253_disable()
commit 94cff94634e506a4a44684bee1875d2dbf782722 upstream. On x86 during boot, clockevent_i8253_disable() can be invoked via x86_late_time_init -> hpet_time_init() -> pit_timer_init() which happens with enabled interrupts. If some of the old i8253 hardware is actually used then lockdep will notice that i8253_lock is used in hard interrupt context. This causes lockdep to complain because it observed the lock being acquired with interrupts enabled and in hard interrupt context. Make clockevent_i8253_disable() acquire the lock with raw_spinlock_irqsave() to cure this. [ tglx: Massage change log and use guard() ] Fixes: c8c4076 ("x86/timer: Skip PIT initialization on modern chipsets") Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit cec4f45bf51e08470024d9dc7549b1ddbdcf8d43) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent 74e2411 commit bdf9bec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/clocksource/i8253.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ int __init clocksource_i8253_init(void)
103103
#ifdef CONFIG_CLKEVT_I8253
104104
void clockevent_i8253_disable(void)
105105
{
106-
raw_spin_lock(&i8253_lock);
106+
unsigned long flags;
107+
108+
raw_spin_lock_irqsave(&i8253_lock, flags);
107109

108110
/*
109111
* Writing the MODE register should stop the counter, according to
@@ -133,7 +135,7 @@ void clockevent_i8253_disable(void)
133135

134136
outb_p(0x30, PIT_MODE);
135137

136-
raw_spin_unlock(&i8253_lock);
138+
raw_spin_unlock_irqrestore(&i8253_lock, flags);
137139
}
138140

139141
static int pit_shutdown(struct clock_event_device *evt)

0 commit comments

Comments
 (0)