Commit b9c30322 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Thomas Gleixner

hrtimer, softirq: Fix hrtimer->softirq trampoline

hrtimers callbacks are always done from hardirq context, either the
jiffy tick interrupt or the hrtimer device interrupt.

[ there is currently one exception that can still call a hrtimer
  callback from softirq, but even in that case this will still
  work correctly. ]
Reported-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Yury Polyanskiy <ypolyans@princeton.edu>
Tested-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
LKML-Reference: <1265120401.24455.306.camel@laptop>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent c80d292f
...@@ -500,22 +500,17 @@ EXPORT_SYMBOL(tasklet_kill); ...@@ -500,22 +500,17 @@ EXPORT_SYMBOL(tasklet_kill);
*/ */
/* /*
* The trampoline is called when the hrtimer expires. If this is * The trampoline is called when the hrtimer expires. It schedules a tasklet
* called from the hrtimer interrupt then we schedule the tasklet as * to run __tasklet_hrtimer_trampoline() which in turn will call the intended
* the timer callback function expects to run in softirq context. If * hrtimer callback, but from softirq context.
* it's called in softirq context anyway (i.e. high resolution timers
* disabled) then the hrtimer callback is called right away.
*/ */
static enum hrtimer_restart __hrtimer_tasklet_trampoline(struct hrtimer *timer) static enum hrtimer_restart __hrtimer_tasklet_trampoline(struct hrtimer *timer)
{ {
struct tasklet_hrtimer *ttimer = struct tasklet_hrtimer *ttimer =
container_of(timer, struct tasklet_hrtimer, timer); container_of(timer, struct tasklet_hrtimer, timer);
if (hrtimer_is_hres_active(timer)) { tasklet_hi_schedule(&ttimer->tasklet);
tasklet_hi_schedule(&ttimer->tasklet); return HRTIMER_NORESTART;
return HRTIMER_NORESTART;
}
return ttimer->function(timer);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment