Re: [PATCH] Turn rdmsr, rdtsc into inline functions, clarify names
From: Vojtech Pavlik
Date: Mon Aug 07 2006 - 07:06:54 EST
On Sun, Aug 06, 2006 at 10:43:44PM -0400, Dmitry Torokhov wrote:
> On Saturday 05 August 2006 23:16, Andi Kleen wrote:
> > This whole thing is broken, e.g. on a preemptive kernel when the
> > code can switch CPUs
> Would not preempt_disable fix that?
> > Dmitry, I would suggest to convert it over to do_gettimeofday and remove
> > all the architecture ifdefs.
> > Or maybe just remove it completely. Who cares about the speed of a gameport
> > anyways? And why can't they measure it in user space?
> Analog driver uses it to adjust timing. Vojtech should have more background
> on that..
The gameport speed is used by digital-over-gameport joystick drivers to
keep track of time based on the number of inb()s done to the gameport.
We can't use anything slower than rdtsc there, and since rdtsc isn't
always available, the count of inb()s is the best approximation.
The speed can't easily be measured in userspace - you need to make sure
IRQs, DMA and other stuff doesn't interfere with the measurement, which
needs to be rather exact. AND, you need it for the kernel to work, so it
doesn't make sense to move it to an userspace tool that the kernel would
have to call.
The analog joystick driver does even more timing magic to get precise
readings from the port, where the value read depends on the time for a
bit on the port to change from 0 to 1.
I agree that gameports are mostly dead today, but people are still using
Director SuSE Labs
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/