On Fri, Mar 27, 2015 at 10:44:28PM +0530, Viresh Kumar wrote:
Only hrtimer_reprogram() is responsible for programming the clockevent device for next event, if the clockevent device is stopped earlier. And updating that alone is sufficient here.
+++ b/kernel/time/hrtimer.c @@ -566,6 +566,7 @@ static int hrtimer_reprogram(struct hrtimer *timer, { struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases); ktime_t expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
- struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); int res;
WARN_ON_ONCE(hrtimer_get_expires_tv64(timer) < 0); @@ -610,6 +611,10 @@ static int hrtimer_reprogram(struct hrtimer *timer, if (cpu_base->hang_detected) return 0;
- /* Switchback to ONESHOT state */
- if (unlikely(dev->state == CLOCK_EVT_STATE_ONESHOT_STOPPED))
clockevents_set_state(dev, CLOCK_EVT_STATE_ONESHOT);
- /*
*/
- Clockevents returns -ETIME, when the event was in the past.
Should we not do this in tick_program_event() instead? Note that there are a few more places that call that, the two in the hrtimer_interrupt() should be safe because if we're handling the interrupt its cannot be stopped anyhow.
hrtimer_force_reprogram() seems to need the annotation regardless.
Furthermore, by putting it in tick_program_event() you also don't need to fixup tick_nohz_restart().
Or am I completely missing something?