Skip to content

Commit f21f237

Browse files
committed
Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: timers: handle HRTIMER_CB_IRQSAFE_UNLOCKED correctly from softirq context nohz: disable tick_nohz_kick_tick() for now irq: call __irq_enter() before calling the tick_idle_check x86: HPET: enter hpet_interrupt_handler with interrupts disabled x86: HPET: read from HPET_Tn_CMP() not HPET_T0_CMP x86: HPET: convert WARN_ON to WARN_ON_ONCE
2 parents 2f96cb5 + 5d5254f commit f21f237

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

arch/x86/kernel/hpet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static int hpet_next_event(unsigned long delta,
322322
* what we wrote hit the chip before we compare it to the
323323
* counter.
324324
*/
325-
WARN_ON((u32)hpet_readl(HPET_T0_CMP) != cnt);
325+
WARN_ON_ONCE((u32)hpet_readl(HPET_Tn_CMP(timer)) != cnt);
326326

327327
return (s32)((u32)hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0;
328328
}
@@ -445,7 +445,7 @@ static int hpet_setup_irq(struct hpet_dev *dev)
445445
{
446446

447447
if (request_irq(dev->irq, hpet_interrupt_handler,
448-
IRQF_SHARED|IRQF_NOBALANCING, dev->name, dev))
448+
IRQF_DISABLED|IRQF_NOBALANCING, dev->name, dev))
449449
return -1;
450450

451451
disable_irq(dev->irq);

kernel/hrtimer.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,7 @@ static void run_hrtimer_pending(struct hrtimer_cpu_base *cpu_base)
12091209
enum hrtimer_restart (*fn)(struct hrtimer *);
12101210
struct hrtimer *timer;
12111211
int restart;
1212+
int emulate_hardirq_ctx = 0;
12121213

12131214
timer = list_entry(cpu_base->cb_pending.next,
12141215
struct hrtimer, cb_entry);
@@ -1217,10 +1218,24 @@ static void run_hrtimer_pending(struct hrtimer_cpu_base *cpu_base)
12171218
timer_stats_account_hrtimer(timer);
12181219

12191220
fn = timer->function;
1221+
/*
1222+
* A timer might have been added to the cb_pending list
1223+
* when it was migrated during a cpu-offline operation.
1224+
* Emulate hardirq context for such timers.
1225+
*/
1226+
if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU ||
1227+
timer->cb_mode == HRTIMER_CB_IRQSAFE_UNLOCKED)
1228+
emulate_hardirq_ctx = 1;
1229+
12201230
__remove_hrtimer(timer, timer->base, HRTIMER_STATE_CALLBACK, 0);
12211231
spin_unlock_irq(&cpu_base->lock);
12221232

1223-
restart = fn(timer);
1233+
if (unlikely(emulate_hardirq_ctx)) {
1234+
local_irq_disable();
1235+
restart = fn(timer);
1236+
local_irq_enable();
1237+
} else
1238+
restart = fn(timer);
12241239

12251240
spin_lock_irq(&cpu_base->lock);
12261241

kernel/softirq.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,11 @@ void irq_enter(void)
269269
{
270270
int cpu = smp_processor_id();
271271

272-
if (idle_cpu(cpu) && !in_interrupt())
272+
if (idle_cpu(cpu) && !in_interrupt()) {
273+
__irq_enter();
273274
tick_check_idle(cpu);
274-
275-
__irq_enter();
275+
} else
276+
__irq_enter();
276277
}
277278

278279
#ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED

kernel/time/tick-sched.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,9 @@ static void tick_nohz_switch_to_nohz(void)
568568
*/
569569
static void tick_nohz_kick_tick(int cpu)
570570
{
571+
#if 0
572+
/* Switch back to 2.6.27 behaviour */
573+
571574
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
572575
ktime_t delta, now;
573576

@@ -584,6 +587,7 @@ static void tick_nohz_kick_tick(int cpu)
584587
return;
585588

586589
tick_nohz_restart(ts, now);
590+
#endif
587591
}
588592

589593
#else

0 commit comments

Comments
 (0)