Subject: Re: ps/2 mouse timeout problems
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 08/30/2002 15:40:36
On Fri, Aug 30, 2002 at 03:33:22PM +0200, Martin Husemann wrote:
> On Fri, Aug 30, 2002 at 12:20:44AM +0100, David Laight wrote:
> 
> > The ps/2 driver seems to call microtime() (possibly unknowingly)
> > in order to (I presume) timestamp the arrival of bytes.
> 
> Yes. And it needs higher precision than mono_time can provide.

Why? What are you timing?
I would have thought you just needed a timer to ensure you
get all the bytes of a mouse movement.
So if there is a missing byte then leaving the mouse still get it
corrected.  Also ISTR that there is a bit set in one of the bytes
that helps slightly (certainly for 3 button mice).
The 10ms tick should be good enough for that.

> > Now the standard microtime() routine will always enable
> > interrupts on exit (even if disabled on entry), it is definitely
> > called with interrupts disabled from somewhere.
> 
> Since pmsinput is called from pckbcintr, which is a regular interrupt
> handler, we will not have cli'd, so the sti in microtime does no harm.

It certainly does some harm somewhere - since I had to fix that
codepath in my faster microtime.

> > It is also worth noting that (on x86) microtime() is a particularly
> > expensive routine (about 4us at best), so using the callout
> > functions is significantly better (they are optimised for short
> > timers, even when cancelled).
> 
> That is indeed an alternative. I'll have a look at it.

It won't help if you trully need better than 10ms accuracy.

Chuck is still getting time warps in microtime - even with
my version (which passes the same test on this system).
It may be that the timer hardware is broken on more motherboards
than has been allowed for.
(and you can't do much about it anyway)


	David

-- 
David Laight: david@l8s.co.uk