On Mon, Aug 4, 2014 at 12:43 PM, Martin Pieuchot <mpieuc...@nolizard.org> wrote:
> On 04/06/14(Wed) 17:02, Stefan Sperling wrote: > > On Wed, Jun 04, 2014 at 09:51:08AM -0400, Eduardo Lopes wrote: > > > Hi, > > > > > > With this snapshot, the same steps yeld a kernel trap: > > > > > > uvm_fault(0xfffffe8135047b68, 0x0, 0, 1) -> e > > > kernel: page fault trap, code=0 > > > Stopped at pms_enable_alps+0xbd: movl 0(%r12),%eax > > > > > > ddb trace: > > > > > > pms_enable_alps() at pms_enable_alps+0xbd > > > pms_protocol_lookup() at pms_protocol_lookup+0x34 > > > pms_change_state() at pms_change_state+0x106 > > > wsmouseopen() at wsmouseopen+0xbf > > > spec_open() at spec_open+0x213 > > > VOP_OPEN() at VOP_OPEN+0x3f > > > vn_open() at vn_open+0x16f > > > doopenat() at doopenat+0x132 > > > syscall() at syscall+0x297 > > > --- syscall (number 5) --- > > > end trace frame: 0x0, count: -9 > > > 0x343ce1f5d0a: > > > > Try disabling wsmoused as a workaround. > > There is a known bug, perhaps related: > > http://marc.info/?l=openbsd-misc&m=137811690307634&w=2 > > I tried tracking this down once but didn't get very far. > > Could you try the diff below and tell me if it fixes your problem? > > on my X201 - with and without patch - kernel trap after several switching on my X220 - with patch - in X work only touchpad after several switching, trackpoint and mouse(usb) don't work > Index: pms.c > =================================================================== > RCS file: /home/ncvs/src/sys/dev/pckbc/pms.c,v > retrieving revision 1.52 > diff -u -p -r1.52 pms.c > --- pms.c 12 Jul 2014 18:48:52 -0000 1.52 > +++ pms.c 24 Jul 2014 08:09:04 -0000 > @@ -26,6 +26,7 @@ > > #include <sys/param.h> > #include <sys/systm.h> > +#include <sys/rwlock.h> > #include <sys/device.h> > #include <sys/ioctl.h> > #include <sys/malloc.h> > @@ -148,6 +149,8 @@ struct pms_softc { /* driver status inf > #define PMS_STATE_ENABLED 1 > #define PMS_STATE_SUSPENDED 2 > > + struct rwlock sc_state_lock; > + > int sc_dev_enable; > #define PMS_DEV_IGNORE 0x00 > #define PMS_DEV_PRIMARY 0x01 > @@ -662,6 +665,8 @@ pmsattach(struct device *parent, struct > a.accessops = &pms_accessops; > a.accesscookie = sc; > > + rw_init(&sc->sc_state_lock, "pmsst"); > + > /* > * Attach the wsmouse, saving a handle to it. > * Note that we don't need to check this pointer against NULL > @@ -762,8 +767,13 @@ int > pms_enable(void *v) > { > struct pms_softc *sc = v; > + int rv; > > - return pms_change_state(sc, PMS_STATE_ENABLED, PMS_DEV_PRIMARY); > + rw_enter_write(&sc->sc_state_lock); > + rv = pms_change_state(sc, PMS_STATE_ENABLED, PMS_DEV_PRIMARY); > + rw_exit_write(&sc->sc_state_lock); > + > + return (rv); > } > > void > @@ -771,7 +781,9 @@ pms_disable(void *v) > { > struct pms_softc *sc = v; > > + rw_enter_write(&sc->sc_state_lock); > pms_change_state(sc, PMS_STATE_DISABLED, PMS_DEV_PRIMARY); > + rw_exit_write(&sc->sc_state_lock); > } > > int > @@ -789,8 +801,13 @@ int > pms_sec_enable(void *v) > { > struct pms_softc *sc = v; > + int rv; > + > + rw_enter_write(&sc->sc_state_lock); > + rv = pms_change_state(sc, PMS_STATE_ENABLED, PMS_DEV_SECONDARY); > + rw_exit_write(&sc->sc_state_lock); > > - return (pms_change_state(sc, PMS_STATE_ENABLED, > PMS_DEV_SECONDARY)); > + return (rv); > } > > void > @@ -798,7 +815,9 @@ pms_sec_disable(void *v) > { > struct pms_softc *sc = v; > > + rw_enter_write(&sc->sc_state_lock); > pms_change_state(sc, PMS_STATE_DISABLED, PMS_DEV_SECONDARY); > + rw_exit_write(&sc->sc_state_lock); > } > > int > > -- Alexandr Shadchin