alarmtimer: Use hrtimer per-alarm instead of per-base
authorJohn Stultz <john.stultz@linaro.org>
Thu, 13 Sep 2012 23:12:16 +0000 (19:12 -0400)
committerJohn Stultz <john.stultz@linaro.org>
Mon, 24 Sep 2012 16:38:02 +0000 (12:38 -0400)
commitdae373be9fec6f850159a05af3a1c36236a70d43
tree4a58f2fd66b2cbee680dfd3b83d78e1cfea34128
parent59a93c27c4892f04dfd8f91f8b64d0d6eae43e6e
alarmtimer: Use hrtimer per-alarm instead of per-base

Arve Hjønnevåg reported numerous crashes from the
"BUG_ON(timer->state != HRTIMER_STATE_CALLBACK)" check
in __run_hrtimer after it called alarmtimer_fired.

It ends up the alarmtimer code was not properly handling
possible failures of hrtimer_try_to_cancel, and because
these faulres occur when the underlying base hrtimer is
being run, this limits the ability to properly handle
modifications to any alarmtimers on that base.

Because much of the logic duplicates the hrtimer logic,
it seems that we might as well have a per-alarmtimer
hrtimer, and avoid the extra complextity of trying to
multiplex many alarmtimers off of one hrtimer.

Thus this patch moves the hrtimer to the alarm structure
and simplifies the management logic.

Changelog:
v2:
* Includes a fix for double alarm_start calls found by
  Arve

Cc: Arve Hjønnevåg <arve@android.com>
Cc: Colin Cross <ccross@android.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Arve Hjønnevåg <arve@android.com>
Tested-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
include/linux/alarmtimer.h
kernel/time/alarmtimer.c