Re: locking in psmouse

From: Pavel Machek
Date: Sun Jun 06 2004 - 13:55:11 EST


Hi!

> > > > > psmouse-base.c does not have any locking. For example psmouse_command
> > > > > could race with data coming from the mouse, resulting in problem. This
> > > > > should fix it.
> > > >
> > > > Although I am not arguing that locking might be needed in psmouse module I
> > > > am somewhat confused how it will help in case of data stream coming from the
> > > > mouse... If mouse sent a byte before the kernel issue a command then it will
> > > > be delivered by KBC controller and will be processed by the interrupt handler,
> > > > probably messing up detection process. That's why as soon as we decide that
> > > > the device behind PS/2 port is some kind of mouse we disable the stream mode.
> > >
> > > Does that mean that mouse can not talk while we are sending commands
> > > to it? That would help a bit.
> > >
> >
> > Yes, check psmouse_probe. As soon as PSMOUSE_CMD_RESET_DIS acknowledged mouse
> > should cease sending motion data. That still leaves possibility of screwing up
> > detection if you are moving mouse while psmouse doing PSMOUSE_CMD_GETID.
> > But I don't think we can do much about it as we'd like to know that the device
> > is some kind of a mouse before we start messing with it.
>
> I've updated the atkbd_command/atkbd_interrupt mechanism so that even
> bytes coming from the keyboard when we're issuing a command shouldn't
> disturb us. I've tested by banging my head at the keyboard while
> plugging it in. ;)
>
> Something like that might be worth implementing for psmouse as well.

Well, psmouse case should be just converting int foo:1 into
set_bit(&flags, BIT_FOO), no?

But I guess autorepeat and higher layers of keyboard might be
"interesting".
Pavel

--
934a471f20d6580d5aad759bf0d97ddc
-
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/