Re: [PATCH v2 4/4] kernel/time/clockevents: compensate for monotonic clock's dynamic frequency
From: Thomas Gleixner
Date: Mon Jul 11 2016 - 04:34:59 EST
On Mon, 11 Jul 2016, Nicolai Stange wrote:
> > + raw = ((u64)interval >> 32) * raw_mult; /* Upper half of interval */
> > + if (raw >> 32)
> > + return KTIME_MAX;
> > + raw <<= 32;
> > + tmp = ((u64)interval & U32_MAX) * raw_mult; /* Lower half of interval */
> > + if (U64_MAX - raw < tmp)
> > + return KTIME_MAX;
> > + raw += tmp;
> > +
> > + /* Finally, do raw /= mono_mult with proper rounding. */
> > + if (U64_MAX - raw < mono_mult / 2)
> > + return KTIME_MAX;
> > + raw += mono_mult / 2;
> > + do_div(raw, mono_mult);
> > +
> > + return (s64)raw;
That's a complete insanity. No way that we are going to do all this math in
the CE programming path.
If you want to address the issue, then you need to find a way to adjust the
mult/shift factors of the clock event device occasionally.
Thanks,
tglx