Re: [patch 1/3] new timerfd API - new timerfd API

From: Thomas Gleixner
Date: Mon Sep 24 2007 - 11:53:44 EST


On Mon, 2007-09-24 at 08:42 -0700, Davide Libenzi wrote:
> > > + ticks += (u64)
> > > hrtimer_forward(&ctx->tmr,
> > > hrtimer_cb_get_time(&ctx->tmr),
> >
> > You need to use ctx->tmr.base->get_time() here, otherwise you might read
> > a stale time value (in case that CONFIG_HIGH_RES_TIMERS is off).
>
> Is the particular position of hrtimer_cb_get_time() in the code that would
> break here? Because function was added by your patch ;)
> Did something change later?

For non high res systems we speed up the access to now by storing the
current time when we start to process the hrtimer softirq callbacks.

hrtimer_cb_get_time(timer) reads timer->base->now

For high resolution systems hrtimer_cb_get_time() resolves to
timer->base->get_time().

In the timerfd case we are not in softirq context and we read at any
given later time. Also on SMP the base->now variable might be changed by
the softirq running on the other CPU.

tglx


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/