Re: [RFC PATCH 2/4] x86, mwaitt: introduce mwaitx idle with a configurable timer

From: Thomas Gleixner
Date: Wed May 20 2015 - 15:12:17 EST


On Wed, 20 May 2015, Borislav Petkov wrote:

> On Wed, May 20, 2015 at 04:55:58PM +0100, One Thousand Gnomes wrote:
> > > That's not what appears to be happening here though: the MWAITX will
> > > return after the timeout.
> > >
> > > Which isn't really useful unless we use it to drive timers.
> >
> > What about things like mdelay() ?
>
> It has an upper limit on the max timeout though: u32 TSC cycles.

Which would be good enough for mdelay/udelay I think, but we'd need to
measure the time spend in MWAITT so we wont return early.

Something like this:

delay = usec_to_tsc(delay);
end = rdtsc() + delay;
while (1) {
MWAITT(delay);
now = rdtsc();
if (end <= now)
break;
delay = end - now;
}

Now we'd need to add alternatives or some other mechanism to it to
make this conditionally for those machines.

Not sure if it's worth the trouble.

Thanks,

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/