[PATCH] inputthread: Fix inputthread not listening if a fd gets re-added immediately after removal

Mihail Konev k.mvc at ya.ru
Sun Oct 9 21:52:10 UTC 2016


Hello.

On Wed,  5 Oct 2016 14:45:20 +0200, Hans de Goede wrote:
> When a fd is removed dev->state gets set to device_state_removed,
> if the fd then gets re-added before InputThreadDoWork() deals with
> the removal, the InputThreadDevice struct gets reused, but its
> state would stay device_state_removed, so it would still get removed
> on the first InputThreadDoWork() run, resulting in a non functioning
> input device.
> 
> This commit fixes this by (re-)setting dev->state to device_state_running
> when a InputThreadDevice struct gets reused.
> 
> This fixes input devices sometimes no longer working after a vt-switch.
> 
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
>  os/inputthread.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/os/inputthread.c b/os/inputthread.c
> index 6aa0a9c..ab1559f 100644
> --- a/os/inputthread.c
> +++ b/os/inputthread.c
> @@ -206,6 +206,8 @@ InputThreadRegisterDev(int fd,
>      if (dev) {
>          dev->readInputProc = readInputProc;
>          dev->readInputArgs = readInputArgs;
> +        /* Override possible unhandled state == device_state_removed */
> +        dev->state = device_state_running;
>      } else {
>          dev = calloc(1, sizeof(InputThreadDevice));
>          if (dev == NULL) {
> --
> 2.9.3
> 

On 6 Oct 2016, Hans de Goede wrote:
> On 24-09-16 19:55, Mihail Konev wrote:
> > <..>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97880
> 
> Thank you for the patch and you're right that there is an issue here.
> 
> I've posted a much simpler fix yesterday, and that has been
> favorably reviewed, so I think we're going to go with that fix
> instead, <..>
> 

Applied on top of 9e00cf0f75f286ec0e8137d91ba80ef7ba72ab2a , the patch does not
solve the bug #97880 for me.

Note: ./configure --disable-glamor is broken somewhere after the ade315386
(Require xproto 7.0.31), so be sure to --enable-glamor.

On 9 Oct 2016, Hans de Goede wrote:
> So you've tried my patch, with your patch reverted and it
> does not work for you? Strange as I was hitting the exact
> same problem and it did work for me.
> 

The difference in problem is, however, that in my case result is
consistent - keyboard either works or not all the time, not "sometimes".
Mouse is moving alright.

First, patch was applied on top of fc1c358b9 (1.19 RC1).
It did not work, so log1.diff was made, applied,
and log1 produced (both attached).
Note: log1 is (fully) commented inline.

Rebasing on top of 97a8353ec (Fix id in error) did not help.

At this point (log1), nol_e.diff gives:
- nol_e.log1
- bug being present

Applying nol_d.diff to log1 gives:
- nol_d.log1
- bug being gone

Manually applied log1.diff to master 97a8353ec (gave log1m.diff).

At this point (log1m) nol_e.diff gives:
- nol_e.log1m
- bug being present
Mistake in bugzilla bug description:
this shows that not locking EnableDevice is not a sufficient workaround.

Applying nol_d.diff to log1m gives:
- nol_d.log1m
- bug being gone
This is what is right in bugzilla description:
not locking DisableDevice is a sufficient workaround.

As I see it,

The patch assumes no device state to be maintained except in the input thread dev
list.  The dev->state is just a flag to signal the input thread to process
input state change.  When it is device_state_running, input thread would not do
any processing upon the dev list element (which through the dev->fd corresponds
to /dev/input/eventN).

Before commit 52d6a1e832a5e62289dd4f32824ae16a78dfd7e8, input thread would
process events before the input_lock is called in the xf86VTLeave,
(that is, as-soon-as xf86DisableDeviceForVTSwitch sets the
`dev->state = device_state_removed`).

Starting with the commit 52d6a1e832a5e62289dd4f32824ae16a78dfd7e8, input_lock
is called in the xf86{Enable,Disable}InputDeviceForVTSwitch (actually in the
dix {Enable,Disable}Device, but xf86* just wrap them).  As the first thing the
main thread does after calling all xf86Disable..  is to call input_lock
(without an input_unlock until VT is switched back), input thread has almost no
chance to process `dev->state == device_state_removed` for the last device.

Note: The chance could be given by inserting something relatively long-running,
like LogMessageVerb(X_INFO, 0, "[xf86VTLeave] doing input_lock...\n").  Such a
line is commented out in log1.patch; before commenting, the bug was not seen.

Note: Input thread would not process releases after VT switch in any case,
as input_lock is released by main thread only at the very end of xf86VTEnter.
(This is why not locking the EnableDevice does not help - lock is already held).

So when the main thread does input_unlock at the end of xf86VTEnter,
the input thread would see:
- N-1 elements `dev->state == device_state_added`
- One last element `dev-state == device_state_removed`
  (or `device_state_running` with the above patch applied)

For N-1 elements the input thread would call the proper attach procedures
(that is, call into xf86-input-evdev, which possibly calls into OS).
For the last element, it would:
- without the patch:
  * call into xf86-input-evdev to do proper detach procedures
  * remove the element from the list
- with the patch:
  * do nothing

Without the patch, X removes a device from dev list without a reason.
(When it actually is supposed to add one).

With the patch, X "hopes" to receive the events even through
the OS could, without the xf86-input-evdev asking it for,
disable the device due to VT switch (X may be involved too).
It looks this way as there were no from-another-VT input events
after returning from VT, regardless of input_lock/barrier modifications.

Looks like the patch above would only work for some hardware configurations,
but not all.

As for simplicity, bugzilla patch is already lighter than it could be,
as it utilises a barrier in place of condition variable under a mutex,
thus assuming that no threads except main and input would want to wait for
device releases to be processed (or to check whether they are).

To outline:
- before regression, 6 devices were fully released, then fully attached.
- with regression and bugzilla patch, only 5 are released fully,
  but the main thread stops to wait for input thread to process the last one.
- with regression and this patch, only 5 are released fully,
  1 is not released neither attached, yet X input thread
  thinks it should be getting events from it.
  For me this does not work.

Given the above, changing `device_state_running -> device_state_added` in the
patch is not a solution either, as it would not cause a release of the device
before VT switch (but only an attach upon returning to VT).

- Mihail
-------------- next part --------------

There Xserver starts.

<..>
[  3287.050] (II) config/udev: ignoring device /dev/tty7 without property ID_INPUT set
[  3287.050] (II) config/udev: ignoring device /dev/tty8 without property ID_INPUT set
[  3287.050] (II) config/udev: ignoring device /dev/tty9 without property ID_INPUT set

Now it finished detecting devices.

Input thread tries to acquire the lock.

[  3287.054] (II) inputh lock ...
[  3287.054] (II) inputh locked

Input thread sees the attachments.

[  3287.054] (II) dev fd=19 state=0 
[  3287.054] (II) dev fd=20 state=0 
[  3287.054] (II) dev fd=21 state=0 
[  3287.054] (II) dev fd=22 state=0 
[  3287.054] (II) dev fd=23 state=0 
[  3287.054] (II) dev fd=24 state=0 

There are 6 devices total.


User does Ctrl-Alt-F1
Xserver (main thread in hw/xfree86/common/xf86Events.c, in xf86DisableDevicesForVTSwitch)
for each device calls InputThreadUnregisterDev, which really just sets dev->state
(under an input_lock), so that input thread sees that and does the proper detach.

[  3291.194] (II) InputThreadUnregisterDev(fd=19) ... 
[  3291.194] (II) InputThreadUnregisterDev: found a device: fd=19 state=1 

For first device, input thread sees the dev->state change.
It tries to acquire the lock.

[  3291.194] (II) inputh lock ...
[  3291.208] (II) inputh locked

With lock held, input thread detaches the device.

[  3291.208] (II) dev fd=19 state=2 

The same goes for device 2.

[  3291.208] (II) InputThreadUnregisterDev(fd=20) ... 
[  3291.208] (II) InputThreadUnregisterDev: found a device: fd=20 state=1 
[  3291.208] (II) inputh lock ...
[  3291.220] (II) inputh locked
[  3291.220] (II) dev fd=20 state=2 

The same goes for device 3.

[  3291.220] (II) InputThreadUnregisterDev(fd=21) ... 
[  3291.220] (II) InputThreadUnregisterDev: found a device: fd=21 state=1 
[  3291.220] (II) inputh lock ...
[  3291.232] (II) inputh locked
[  3291.232] (II) dev fd=21 state=2 

The same goes for device 4.

[  3291.232] (II) InputThreadUnregisterDev(fd=22) ... 
[  3291.232] (II) InputThreadUnregisterDev: found a device: fd=22 state=1 
[  3291.232] (II) inputh lock ...
[  3291.247] (II) inputh locked
[  3291.247] (II) dev fd=22 state=2 

The same goes for device 5.

[  3291.247] (II) InputThreadUnregisterDev(fd=23) ... 
[  3291.247] (II) InputThreadUnregisterDev: found a device: fd=23 state=1 
[  3291.247] (II) inputh lock ...
[  3291.259] (II) inputh locked
[  3291.259] (II) dev fd=23 state=2 

The same goes for device 6 in the main thread.

[  3291.259] (II) InputThreadUnregisterDev(fd=24) ... 
[  3291.259] (II) InputThreadUnregisterDev: found a device: fd=24 state=1 

Now the last dev->state is set.
Time for input thread to acquire the lock and detach the device.

[  3291.259] (II) inputh lock ...

Input thread now waits on the lock.
The lock, however, is held by the main thread.

Where? In the xf86VTLeave
What for? So that input thread waits for lock for while on another VT.
(So that there is no input processing).

So input thread would not be able to process the events until VT is switched back.

User does Ctrl-Alt-F7

Xserver re-initializes the monitor.

[  3292.388] (II) modeset(0): <..>
<..>
[  3292.388] (II) modeset(0): <..>

Xserver's main thread now attaches input devices.
(By just setting the dev->state).

[  3292.501] (II) InputThreadRegisterDev(fd=19) ... 
[  3292.501] (II) InputThreadRegisterDev(fd=20) ... 
[  3292.501] (II) InputThreadRegisterDev(fd=21) ... 
[  3292.501] (II) InputThreadRegisterDev(fd=22) ... 
[  3292.501] (II) InputThreadRegisterDev(fd=23) ... 

It does this for first five devices.
For sixth, it sees a matching dev
(the unprocessed one, with dev->state == device_state_removed).

And does not signal (by means of dev->state)
the input thread to attach the device.

[  3292.501] (II) InputThreadRegisterDev(fd=24) ... 
[  3292.501] (II) InputThreadRegisterDev: found a device: fd=24 state=2 

The main thread is now done with all the six devices OS has.
It releases input lock that was being held all the VT switch.

Input thread acquires the long-awaited lock.

[  3292.502] (II) inputh locked

Now input thread would process six dev->state-s.

[  3292.502] (II) dev fd=19 state=0 
[  3292.502] (II) dev fd=20 state=0 
[  3292.502] (II) dev fd=21 state=0 
[  3292.502] (II) dev fd=22 state=0 
[  3292.502] (II) dev fd=23 state=0 

It sees five devices attached and one running.

The sixth device does not get attached (by the input thread), hence the bug.


Now timeout for Xserver expires, and it is sent a SIGTERM.
(startx was ran as `timeout 20 startx`).

[  3306.673] (II) InputThreadUnregisterDev(fd=19) ... 
[  3306.673] (II) InputThreadUnregisterDev: found a device: fd=19 state=1 
[  3306.674] (II) inputh lock ...
[  3306.684] (II) inputh locked
[  3306.684] (II) dev fd=19 state=2 
[  3306.684] (II) InputThreadUnregisterDev(fd=20) ... 
[  3306.684] (II) InputThreadUnregisterDev: found a device: fd=20 state=1 
[  3306.684] (II) inputh lock ...
[  3306.696] (II) inputh locked
[  3306.696] (II) dev fd=20 state=2 
[  3306.696] (II) InputThreadUnregisterDev(fd=21) ... 
[  3306.696] (II) InputThreadUnregisterDev: found a device: fd=21 state=1 
[  3306.696] (II) inputh lock ...
[  3306.708] (II) inputh locked
[  3306.708] (II) dev fd=21 state=2 
[  3306.708] (II) InputThreadUnregisterDev(fd=22) ... 
[  3306.708] (II) InputThreadUnregisterDev: found a device: fd=22 state=1 
[  3306.708] (II) inputh lock ...
[  3306.720] (II) inputh locked
[  3306.720] (II) dev fd=22 state=2 
[  3306.720] (II) InputThreadUnregisterDev(fd=23) ... 
[  3306.720] (II) InputThreadUnregisterDev: found a device: fd=23 state=1 
[  3306.720] (II) inputh lock ...
[  3306.732] (II) inputh locked
[  3306.732] (II) dev fd=23 state=2 
[  3306.732] (II) InputThreadUnregisterDev(fd=24) ... 
[  3306.732] (II) InputThreadUnregisterDev: found a device: fd=24 state=1 
[  3306.732] (II) inputh lock ...
[  3306.744] (II) inputh locked
[  3306.744] (II) dev fd=24 state=2 
[  3306.744] (II) evdev: <..>: Close
[  3306.744] (II) UnloadModule: "evdev"
[  3306.744] (II) evdev: <..>: Close
[  3306.744] (II) UnloadModule: "evdev"
[  3306.744] (II) evdev: <..>: Close
[  3306.744] (II) UnloadModule: "evdev"
[  3306.744] (II) evdev: Power Button: Close
[  3306.744] (II) UnloadModule: "evdev"
[  3306.745] (II) evdev: Video Bus: Close
[  3306.745] (II) UnloadModule: "evdev"
[  3306.745] (II) evdev: Power Button: Close
[  3306.745] (II) UnloadModule: "evdev"
[  3306.767] (II) Server terminated successfully (0). Closing log file.
-------------- next part --------------
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 9a8f432a0556..9c1da344c4a3 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -436,8 +436,11 @@ xf86VTLeave(void)
         else
             xf86DisableGeneralHandler(ih);
     }
+
+    //LogMessageVerb(X_INFO, 0, "xf86DisableInputDevs ...\n");
     for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
         xf86DisableInputDeviceForVTSwitch(pInfo);
+    //LogMessageVerb(X_INFO, 0, "xf86DisableInputDevs done, doing input_lock ...\n");
 
     input_lock();
     for (i = 0; i < xf86NumScreens; i++)
diff --git a/os/inputthread.c b/os/inputthread.c
index ab1559fb6b95..abbf1825589b 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -190,8 +190,12 @@ InputThreadRegisterDev(int fd,
 {
     InputThreadDevice *dev, *old;
 
-    if (!inputThreadInfo)
+    LogMessageVerb(X_INFO, 0, "%s(fd=%d) ... \n",
+            __func__, fd);
+
+    if (!inputThreadInfo) {
         return SetNotifyFd(fd, readInputProc, X_NOTIFY_READ, readInputArgs);
+    }
 
     input_lock();
 
@@ -204,6 +208,8 @@ InputThreadRegisterDev(int fd,
     }
 
     if (dev) {
+        LogMessageVerb(X_INFO, 0, "%s: found a device: fd=%d state=%d \n",
+                __func__, fd, (int)(dev->state - device_state_added));
         dev->readInputProc = readInputProc;
         dev->readInputArgs = readInputArgs;
         /* Override possible unhandled state == device_state_removed */
@@ -246,6 +252,9 @@ InputThreadUnregisterDev(int fd)
     InputThreadDevice *dev;
     Bool found_device = FALSE;
 
+    LogMessageVerb(X_INFO, 0, "%s(fd=%d) ... \n",
+            __func__, fd);
+
     /* return silently if input thread is already finished (e.g., at
      * DisableDevice time, evdev tries to call this function again through
      * xf86RemoveEnabledDevice) */
@@ -267,6 +276,8 @@ InputThreadUnregisterDev(int fd)
         return 0;
     }
 
+    LogMessageVerb(X_INFO, 0, "%s: found a device: fd=%d state=%d \n",
+            __func__, fd, (int)(dev->state - device_state_added));
     dev->state = device_state_removed;
     inputThreadInfo->changed = TRUE;
 
@@ -332,11 +343,16 @@ InputThreadDoWork(void *arg)
         if (inputThreadInfo->changed) {
             InputThreadDevice *dev, *tmp;
 
+            LogMessageVerb(X_INFO, 0, "inputh lock ...\n");
             input_lock();
+            LogMessageVerb(X_INFO, 0, "inputh locked\n");
+
             inputThreadInfo->changed = FALSE;
             xorg_list_for_each_entry_safe(dev, tmp, &inputThreadInfo->devs, node) {
                 switch (dev->state) {
                 case device_state_added:
+                    LogMessageVerb(X_INFO, 0, "dev fd=%d state=%d \n",
+                            (int)dev->fd, (int)(dev->state - device_state_added));
                     ospoll_add(inputThreadInfo->fds, dev->fd,
                                ospoll_trigger_level,
                                InputReady,
@@ -347,6 +363,8 @@ InputThreadDoWork(void *arg)
                 case device_state_running:
                     break;
                 case device_state_removed:
+                    LogMessageVerb(X_INFO, 0, "dev fd=%d state=%d \n",
+                            (int)dev->fd, (int)(dev->state - device_state_added));
                     ospoll_remove(inputThreadInfo->fds, dev->fd);
                     xorg_list_del(&dev->node);
                     free(dev);
-------------- next part --------------
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 9a8f432a0556..11d49be4622f 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -436,8 +436,10 @@ xf86VTLeave(void)
         else
             xf86DisableGeneralHandler(ih);
     }
+    //LogMessageVerb(X_INFO, 0, "xf86DisableInputDevs ...\n");
     for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
         xf86DisableInputDeviceForVTSwitch(pInfo);
+    //LogMessageVerb(X_INFO, 0, "xf86DisableInputDevs done, doing input_lock ...\n");
 
     input_lock();
     for (i = 0; i < xf86NumScreens; i++)
diff --git a/os/inputthread.c b/os/inputthread.c
index 6aa0a9ce6fb5..699b2a0d283a 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -190,8 +190,12 @@ InputThreadRegisterDev(int fd,
 {
     InputThreadDevice *dev, *old;
 
-    if (!inputThreadInfo)
+    LogMessageVerb(X_INFO, 0, "%s(fd=%d) ... \n",
+            __func__, fd);
+
+    if (!inputThreadInfo) {
         return SetNotifyFd(fd, readInputProc, X_NOTIFY_READ, readInputArgs);
+    }
 
     input_lock();
 
@@ -204,6 +208,8 @@ InputThreadRegisterDev(int fd,
     }
 
     if (dev) {
+        LogMessageVerb(X_INFO, 0, "%s: found a device: fd=%d state=%d \n",
+                __func__, fd, (int)(dev->state - device_state_added));
         dev->readInputProc = readInputProc;
         dev->readInputArgs = readInputArgs;
     } else {
@@ -244,6 +250,8 @@ InputThreadUnregisterDev(int fd)
     InputThreadDevice *dev;
     Bool found_device = FALSE;
 
+    LogMessageVerb(X_INFO, 0, "%s(fd=%d) ... \n",
+            __func__, fd);
     /* return silently if input thread is already finished (e.g., at
      * DisableDevice time, evdev tries to call this function again through
      * xf86RemoveEnabledDevice) */
@@ -265,6 +273,8 @@ InputThreadUnregisterDev(int fd)
         return 0;
     }
 
+    LogMessageVerb(X_INFO, 0, "%s: found a device: fd=%d state=%d \n",
+            __func__, fd, (int)(dev->state - device_state_added));
     dev->state = device_state_removed;
     inputThreadInfo->changed = TRUE;
 
@@ -330,11 +340,16 @@ InputThreadDoWork(void *arg)
         if (inputThreadInfo->changed) {
             InputThreadDevice *dev, *tmp;
 
+            LogMessageVerb(X_INFO, 0, "inputh lock ...\n");
             input_lock();
+            LogMessageVerb(X_INFO, 0, "inputh locked\n");
+
             inputThreadInfo->changed = FALSE;
             xorg_list_for_each_entry_safe(dev, tmp, &inputThreadInfo->devs, node) {
                 switch (dev->state) {
                 case device_state_added:
+                    LogMessageVerb(X_INFO, 0, "dev fd=%d state=%d \n",
+                            (int)dev->fd, (int)(dev->state - device_state_added));
                     ospoll_add(inputThreadInfo->fds, dev->fd,
                                ospoll_trigger_level,
                                InputReady,
@@ -345,6 +360,8 @@ InputThreadDoWork(void *arg)
                 case device_state_running:
                     break;
                 case device_state_removed:
+                    LogMessageVerb(X_INFO, 0, "dev fd=%d state=%d \n",
+                            (int)dev->fd, (int)(dev->state - device_state_added));
                     ospoll_remove(inputThreadInfo->fds, dev->fd);
                     xorg_list_del(&dev->node);
                     free(dev);
-------------- next part --------------
diff --git a/dix/devices.c b/dix/devices.c
index ea3c6c8a9a0f..c448713e3bab 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -491,7 +491,6 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
     if (dev->spriteInfo->paired)
         dev->spriteInfo->paired = NULL;
 
-    input_lock();
     (void) (*dev->deviceProc) (dev, DEVICE_OFF);
     dev->enabled = FALSE;
 
@@ -501,7 +500,6 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
         if (other->last.slave == dev)
             other->last.slave = NULL;
     }
-    input_unlock();
 
     FreeSprite(dev);
 
-------------- next part --------------
[ 13083.696] (II) config/udev: ignoring device /dev/tty7 without property ID_INPUT set
[ 13083.696] (II) config/udev: ignoring device /dev/tty8 without property ID_INPUT set
[ 13083.696] (II) config/udev: ignoring device /dev/tty9 without property ID_INPUT set
[ 13083.696] (II) inputh lock ...
[ 13083.696] (II) inputh locked
[ 13083.696] (II) dev fd=20 state=0 
[ 13083.696] (II) dev fd=21 state=0 
[ 13083.696] (II) dev fd=22 state=0 
[ 13083.697] (II) dev fd=23 state=0 
[ 13083.697] (II) dev fd=24 state=0 
[ 13083.697] (II) dev fd=25 state=0 
[ 13088.025] (II) InputThreadUnregisterDev(fd=20) ... 
[ 13088.025] (II) InputThreadUnregisterDev: found a device: fd=20 state=1 
[ 13088.025] (II) inputh lock ...
[ 13088.025] (II) inputh locked
[ 13088.025] (II) dev fd=20 state=2 
[ 13088.036] (II) InputThreadUnregisterDev(fd=21) ... 
[ 13088.036] (II) InputThreadUnregisterDev: found a device: fd=21 state=1 
[ 13088.036] (II) inputh lock ...
[ 13088.036] (II) inputh locked
[ 13088.036] (II) dev fd=21 state=2 
[ 13088.048] (II) InputThreadUnregisterDev(fd=22) ... 
[ 13088.048] (II) InputThreadUnregisterDev: found a device: fd=22 state=1 
[ 13088.048] (II) inputh lock ...
[ 13088.048] (II) inputh locked
[ 13088.048] (II) dev fd=22 state=2 
[ 13088.060] (II) InputThreadUnregisterDev(fd=23) ... 
[ 13088.060] (II) InputThreadUnregisterDev: found a device: fd=23 state=1 
[ 13088.060] (II) inputh lock ...
[ 13088.060] (II) inputh locked
[ 13088.060] (II) dev fd=23 state=2 
[ 13088.072] (II) InputThreadUnregisterDev(fd=24) ... 
[ 13088.072] (II) InputThreadUnregisterDev: found a device: fd=24 state=1 
[ 13088.072] (II) inputh lock ...
[ 13088.072] (II) inputh locked
[ 13088.072] (II) dev fd=24 state=2 
[ 13088.084] (II) InputThreadUnregisterDev(fd=25) ... 
[ 13088.084] (II) InputThreadUnregisterDev: found a device: fd=25 state=1 
[ 13088.084] (II) inputh lock ...
[ 13088.084] (II) inputh locked
[ 13088.084] (II) dev fd=25 state=2 
[ 13088.096] (II) AIGLX: Suspending AIGLX clients for VT switch
[ 13089.528] (II) AIGLX: Resuming AIGLX clients after VT switch
[ 13089.546] (II) modeset(0): ..
...
[ 13089.659] (II) InputThreadRegisterDev(fd=20) ... 
[ 13089.659] (II) InputThreadRegisterDev(fd=21) ... 
[ 13089.659] (II) inputh lock ...
[ 13089.659] (II) InputThreadRegisterDev(fd=22) ... 
[ 13089.659] (II) InputThreadRegisterDev(fd=23) ... 
[ 13089.659] (II) InputThreadRegisterDev(fd=24) ... 
[ 13089.659] (II) InputThreadRegisterDev(fd=25) ... 
[ 13089.659] (II) inputh locked
[ 13089.660] (II) dev fd=20 state=0 
[ 13089.660] (II) dev fd=21 state=0 
[ 13089.660] (II) dev fd=22 state=0 
[ 13089.660] (II) dev fd=23 state=0 
[ 13089.660] (II) dev fd=24 state=0 
[ 13089.660] (II) dev fd=25 state=0 
[ 13103.162] (II) InputThreadUnregisterDev(fd=20) ... 
[ 13103.162] (II) InputThreadUnregisterDev: found a device: fd=20 state=1 
[ 13103.162] (II) inputh lock ...
[ 13103.162] (II) inputh locked
[ 13103.162] (II) dev fd=20 state=2 
[ 13103.173] (II) InputThreadUnregisterDev(fd=21) ... 
[ 13103.173] (II) InputThreadUnregisterDev: found a device: fd=21 state=1 
[ 13103.173] (II) inputh lock ...
[ 13103.173] (II) inputh locked
[ 13103.173] (II) dev fd=21 state=2 
[ 13103.185] (II) InputThreadUnregisterDev(fd=22) ... 
[ 13103.185] (II) InputThreadUnregisterDev: found a device: fd=22 state=1 
[ 13103.185] (II) inputh lock ...
[ 13103.185] (II) inputh locked
[ 13103.185] (II) dev fd=22 state=2 
[ 13103.197] (II) InputThreadUnregisterDev(fd=23) ... 
[ 13103.197] (II) InputThreadUnregisterDev: found a device: fd=23 state=1 
[ 13103.197] (II) inputh lock ...
[ 13103.197] (II) inputh locked
[ 13103.197] (II) dev fd=23 state=2 
[ 13103.209] (II) InputThreadUnregisterDev(fd=24) ... 
[ 13103.209] (II) InputThreadUnregisterDev: found a device: fd=24 state=1 
[ 13103.209] (II) inputh lock ...
[ 13103.209] (II) inputh locked
[ 13103.209] (II) dev fd=24 state=2 
[ 13103.221] (II) InputThreadUnregisterDev(fd=25) ... 
[ 13103.221] (II) InputThreadUnregisterDev: found a device: fd=25 state=1 
[ 13103.221] (II) inputh lock ...
[ 13103.221] (II) inputh locked
[ 13103.221] (II) dev fd=25 state=2 
[ 13103.233] (II) evdev: ..
[ 13103.233] (II) UnloadModule: "evdev"
[ 13103.233] (II) evdev: ..
[ 13103.233] (II) UnloadModule: "evdev"
[ 13103.233] (II) evdev: ..
[ 13103.233] (II) UnloadModule: "evdev"
[ 13103.233] (II) evdev: Power Button: Close
[ 13103.234] (II) UnloadModule: "evdev"
[ 13103.234] (II) evdev: Video Bus: Close
[ 13103.234] (II) UnloadModule: "evdev"
[ 13103.234] (II) evdev: Power Button: Close
[ 13103.234] (II) UnloadModule: "evdev"
[ 13103.257] (II) Server terminated successfully (0). Closing log file.
-------------- next part --------------
...
[ 14822.307] (II) config/udev: ignoring device /dev/tty7 without property ID_INPUT set
[ 14822.307] (II) config/udev: ignoring device /dev/tty8 without property ID_INPUT set
[ 14822.308] (II) config/udev: ignoring device /dev/tty9 without property ID_INPUT set
[ 14822.308] (II) inputh lock ...
[ 14822.308] (II) inputh locked
[ 14822.308] (II) dev fd=20 state=0 
[ 14822.308] (II) dev fd=21 state=0 
[ 14822.308] (II) dev fd=22 state=0 
[ 14822.308] (II) dev fd=23 state=0 
[ 14822.308] (II) dev fd=24 state=0 
[ 14822.308] (II) dev fd=25 state=0 
[ 14828.032] (II) InputThreadUnregisterDev(fd=20) ... 
[ 14828.032] (II) InputThreadUnregisterDev: found a device: fd=20 state=1 
[ 14828.032] (II) inputh lock ...
[ 14828.032] (II) inputh locked
[ 14828.032] (II) dev fd=20 state=2 
[ 14828.043] (II) InputThreadUnregisterDev(fd=21) ... 
[ 14828.043] (II) InputThreadUnregisterDev: found a device: fd=21 state=1 
[ 14828.043] (II) inputh lock ...
[ 14828.043] (II) inputh locked
[ 14828.043] (II) dev fd=21 state=2 
[ 14828.055] (II) InputThreadUnregisterDev(fd=22) ... 
[ 14828.055] (II) InputThreadUnregisterDev: found a device: fd=22 state=1 
[ 14828.055] (II) inputh lock ...
[ 14828.055] (II) inputh locked
[ 14828.055] (II) dev fd=22 state=2 
[ 14828.067] (II) InputThreadUnregisterDev(fd=23) ... 
[ 14828.067] (II) InputThreadUnregisterDev: found a device: fd=23 state=1 
[ 14828.067] (II) inputh lock ...
[ 14828.067] (II) inputh locked
[ 14828.067] (II) dev fd=23 state=2 
[ 14828.079] (II) InputThreadUnregisterDev(fd=24) ... 
[ 14828.079] (II) InputThreadUnregisterDev: found a device: fd=24 state=1 
[ 14828.079] (II) inputh lock ...
[ 14828.079] (II) inputh locked
[ 14828.079] (II) dev fd=24 state=2 
[ 14828.091] (II) InputThreadUnregisterDev(fd=25) ... 
[ 14828.091] (II) InputThreadUnregisterDev: found a device: fd=25 state=1 
[ 14828.091] (II) inputh lock ...
[ 14828.091] (II) inputh locked
[ 14828.091] (II) dev fd=25 state=2 
[ 14828.103] (II) AIGLX: Suspending AIGLX clients for VT switch
[ 14830.678] (II) AIGLX: Resuming AIGLX clients after VT switch
[ 14830.692] (II) modeset(0): ..
...
[ 14830.804] (II) InputThreadRegisterDev(fd=20) ... 
[ 14830.804] (II) InputThreadRegisterDev(fd=21) ... 
[ 14830.804] (II) inputh lock ...
[ 14830.804] (II) InputThreadRegisterDev(fd=22) ... 
[ 14830.804] (II) InputThreadRegisterDev(fd=23) ... 
[ 14830.804] (II) InputThreadRegisterDev(fd=24) ... 
[ 14830.804] (II) InputThreadRegisterDev(fd=25) ... 
[ 14830.805] (II) inputh locked
[ 14830.805] (II) dev fd=20 state=0 
[ 14830.805] (II) dev fd=21 state=0 
[ 14830.805] (II) dev fd=22 state=0 
[ 14830.805] (II) dev fd=23 state=0 
[ 14830.805] (II) dev fd=24 state=0 
[ 14830.805] (II) dev fd=25 state=0 
[ 14841.770] (II) InputThreadUnregisterDev(fd=20) ... 
[ 14841.770] (II) InputThreadUnregisterDev: found a device: fd=20 state=1 
[ 14841.770] (II) inputh lock ...
[ 14841.770] (II) inputh locked
[ 14841.770] (II) dev fd=20 state=2 
[ 14841.782] (II) InputThreadUnregisterDev(fd=21) ... 
[ 14841.782] (II) InputThreadUnregisterDev: found a device: fd=21 state=1 
[ 14841.782] (II) inputh lock ...
[ 14841.782] (II) inputh locked
[ 14841.782] (II) dev fd=21 state=2 
[ 14841.794] (II) InputThreadUnregisterDev(fd=22) ... 
[ 14841.794] (II) InputThreadUnregisterDev: found a device: fd=22 state=1 
[ 14841.794] (II) inputh lock ...
[ 14841.794] (II) inputh locked
[ 14841.794] (II) dev fd=22 state=2 
[ 14841.806] (II) InputThreadUnregisterDev(fd=23) ... 
[ 14841.806] (II) InputThreadUnregisterDev: found a device: fd=23 state=1 
[ 14841.806] (II) inputh lock ...
[ 14841.806] (II) inputh locked
[ 14841.806] (II) dev fd=23 state=2 
[ 14841.818] (II) InputThreadUnregisterDev(fd=24) ... 
[ 14841.818] (II) InputThreadUnregisterDev: found a device: fd=24 state=1 
[ 14841.818] (II) inputh lock ...
[ 14841.818] (II) inputh locked
[ 14841.818] (II) dev fd=24 state=2 
[ 14841.830] (II) InputThreadUnregisterDev(fd=25) ... 
[ 14841.830] (II) InputThreadUnregisterDev: found a device: fd=25 state=1 
[ 14841.830] (II) inputh lock ...
[ 14841.830] (II) inputh locked
[ 14841.830] (II) dev fd=25 state=2 
[ 14841.842] (II) evdev: ..
[ 14841.842] (II) UnloadModule: "evdev"
[ 14841.842] (II) evdev: ..
[ 14841.842] (II) UnloadModule: "evdev"
[ 14841.842] (II) evdev: ..
[ 14841.842] (II) UnloadModule: "evdev"
[ 14841.842] (II) evdev: Power Button: Close
[ 14841.843] (II) UnloadModule: "evdev"
[ 14841.843] (II) evdev: Video Bus: Close
[ 14841.843] (II) UnloadModule: "evdev"
[ 14841.843] (II) evdev: Power Button: Close
[ 14841.843] (II) UnloadModule: "evdev"
[ 14841.869] (II) Server terminated successfully (0). Closing log file.
-------------- next part --------------
diff --git a/dix/devices.c b/dix/devices.c
index ea3c6c8a9a0f..0b95bc494e79 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -399,11 +399,9 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
         }
     }
 
-    input_lock();
     if ((*prev != dev) || !dev->inited ||
         ((ret = (*dev->deviceProc) (dev, DEVICE_ON)) != Success)) {
         ErrorF("[dix] couldn't enable device %d\n", dev->id);
-        input_unlock();
         return FALSE;
     }
     dev->enabled = TRUE;
@@ -412,7 +410,6 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
     for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next);
     *prev = dev;
     dev->next = NULL;
-    input_unlock();
 
     enabled = TRUE;
     XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
-------------- next part --------------
[ 12676.328] (II) config/udev: ignoring device /dev/tty63 without property ID_INPUT set
[ 12676.328] (II) config/udev: ignoring device /dev/tty7 without property ID_INPUT set
[ 12676.328] (II) config/udev: ignoring device /dev/tty8 without property ID_INPUT set
[ 12676.328] (II) config/udev: ignoring device /dev/tty9 without property ID_INPUT set
[ 12676.328] (II) inputh lock ...
[ 12676.328] (II) inputh locked
[ 12676.328] (II) dev fd=20 state=0 
[ 12676.328] (II) dev fd=21 state=0 
[ 12676.328] (II) dev fd=22 state=0 
[ 12676.328] (II) dev fd=23 state=0 
[ 12676.328] (II) dev fd=24 state=0 
[ 12676.328] (II) dev fd=25 state=0 
[ 12681.504] (II) InputThreadUnregisterDev(fd=20) ... 
[ 12681.504] (II) InputThreadUnregisterDev: found a device: fd=20 state=1 
[ 12681.504] (II) inputh lock ...
[ 12681.517] (II) inputh locked
[ 12681.517] (II) dev fd=20 state=2 
[ 12681.517] (II) InputThreadUnregisterDev(fd=21) ... 
[ 12681.517] (II) InputThreadUnregisterDev: found a device: fd=21 state=1 
[ 12681.517] (II) inputh lock ...
[ 12681.529] (II) inputh locked
[ 12681.529] (II) dev fd=21 state=2 
[ 12681.529] (II) InputThreadUnregisterDev(fd=22) ... 
[ 12681.529] (II) InputThreadUnregisterDev: found a device: fd=22 state=1 
[ 12681.529] (II) inputh lock ...
[ 12681.541] (II) inputh locked
[ 12681.541] (II) dev fd=22 state=2 
[ 12681.541] (II) InputThreadUnregisterDev(fd=23) ... 
[ 12681.541] (II) InputThreadUnregisterDev: found a device: fd=23 state=1 
[ 12681.541] (II) inputh lock ...
[ 12681.556] (II) inputh locked
[ 12681.556] (II) dev fd=23 state=2 
[ 12681.556] (II) InputThreadUnregisterDev(fd=24) ... 
[ 12681.556] (II) InputThreadUnregisterDev: found a device: fd=24 state=1 
[ 12681.556] (II) inputh lock ...
[ 12681.568] (II) inputh locked
[ 12681.568] (II) dev fd=24 state=2 
[ 12681.568] (II) InputThreadUnregisterDev(fd=25) ... 
[ 12681.568] (II) InputThreadUnregisterDev: found a device: fd=25 state=1 
[ 12681.568] (II) inputh lock ...
[ 12681.580] (II) AIGLX: Suspending AIGLX clients for VT switch
[ 12683.746] (II) AIGLX: Resuming AIGLX clients after VT switch
[ 12683.762] (II) modeset(0): ..
...
[ 12683.874] (II) InputThreadRegisterDev(fd=20) ... 
[ 12683.874] (II) InputThreadRegisterDev(fd=21) ... 
[ 12683.874] (II) InputThreadRegisterDev(fd=22) ... 
[ 12683.874] (II) InputThreadRegisterDev(fd=23) ... 
[ 12683.874] (II) InputThreadRegisterDev(fd=24) ... 
[ 12683.874] (II) InputThreadRegisterDev(fd=25) ... 
[ 12683.874] (II) InputThreadRegisterDev: found a device: fd=25 state=2 
[ 12683.874] (II) inputh locked
[ 12683.875] (II) dev fd=20 state=0 
[ 12683.875] (II) dev fd=21 state=0 
[ 12683.875] (II) dev fd=22 state=0 
[ 12683.875] (II) dev fd=23 state=0 
[ 12683.875] (II) dev fd=24 state=0 
[ 12695.794] (II) InputThreadUnregisterDev(fd=20) ... 
[ 12695.794] (II) InputThreadUnregisterDev: found a device: fd=20 state=1 
[ 12695.794] (II) inputh lock ...
[ 12695.805] (II) inputh locked
[ 12695.805] (II) dev fd=20 state=2 
[ 12695.805] (II) InputThreadUnregisterDev(fd=21) ... 
[ 12695.805] (II) InputThreadUnregisterDev: found a device: fd=21 state=1 
[ 12695.805] (II) inputh lock ...
[ 12695.817] (II) inputh locked
[ 12695.817] (II) dev fd=21 state=2 
[ 12695.817] (II) InputThreadUnregisterDev(fd=22) ... 
[ 12695.817] (II) InputThreadUnregisterDev: found a device: fd=22 state=1 
[ 12695.817] (II) inputh lock ...
[ 12695.829] (II) inputh locked
[ 12695.829] (II) dev fd=22 state=2 
[ 12695.829] (II) InputThreadUnregisterDev(fd=23) ... 
[ 12695.829] (II) InputThreadUnregisterDev: found a device: fd=23 state=1 
[ 12695.829] (II) inputh lock ...
[ 12695.841] (II) inputh locked
[ 12695.841] (II) dev fd=23 state=2 
[ 12695.841] (II) InputThreadUnregisterDev(fd=24) ... 
[ 12695.841] (II) InputThreadUnregisterDev: found a device: fd=24 state=1 
[ 12695.841] (II) inputh lock ...
[ 12695.853] (II) inputh locked
[ 12695.853] (II) dev fd=24 state=2 
[ 12695.853] (II) InputThreadUnregisterDev(fd=25) ... 
[ 12695.853] (II) InputThreadUnregisterDev: found a device: fd=25 state=1 
[ 12695.853] (II) inputh lock ...
[ 12695.865] (II) inputh locked
[ 12695.865] (II) dev fd=25 state=2 
[ 12695.865] (II) evdev: ..
[ 12695.865] (II) UnloadModule: "evdev"
[ 12695.865] (II) evdev: ..
[ 12695.865] (II) UnloadModule: "evdev"
[ 12695.866] (II) evdev: ..
[ 12695.866] (II) UnloadModule: "evdev"
[ 12695.866] (II) evdev: Power Button: Close
[ 12695.866] (II) UnloadModule: "evdev"
[ 12695.866] (II) evdev: Video Bus: Close
[ 12695.866] (II) UnloadModule: "evdev"
[ 12695.866] (II) evdev: Power Button: Close
[ 12695.866] (II) UnloadModule: "evdev"
[ 12695.889] (II) Server terminated successfully (0). Closing log file.
-------------- next part --------------
...
[ 14470.539] (II) config/udev: ignoring device /dev/tty7 without property ID_INPUT set
[ 14470.539] (II) config/udev: ignoring device /dev/tty8 without property ID_INPUT set
[ 14470.540] (II) config/udev: ignoring device /dev/tty9 without property ID_INPUT set
[ 14470.540] (II) inputh lock ...
[ 14470.540] (II) inputh locked
[ 14470.540] (II) dev fd=20 state=0 
[ 14470.540] (II) dev fd=21 state=0 
[ 14470.540] (II) dev fd=22 state=0 
[ 14470.540] (II) dev fd=23 state=0 
[ 14470.540] (II) dev fd=24 state=0 
[ 14470.540] (II) dev fd=25 state=0 
[ 14476.492] (II) InputThreadUnregisterDev(fd=20) ... 
[ 14476.492] (II) InputThreadUnregisterDev: found a device: fd=20 state=1 
[ 14476.492] (II) inputh lock ...
[ 14476.505] (II) inputh locked
[ 14476.505] (II) dev fd=20 state=2 
[ 14476.505] (II) InputThreadUnregisterDev(fd=21) ... 
[ 14476.505] (II) InputThreadUnregisterDev: found a device: fd=21 state=1 
[ 14476.505] (II) inputh lock ...
[ 14476.517] (II) inputh locked
[ 14476.517] (II) dev fd=21 state=2 
[ 14476.517] (II) InputThreadUnregisterDev(fd=22) ... 
[ 14476.517] (II) InputThreadUnregisterDev: found a device: fd=22 state=1 
[ 14476.517] (II) inputh lock ...
[ 14476.529] (II) inputh locked
[ 14476.529] (II) dev fd=22 state=2 
[ 14476.529] (II) InputThreadUnregisterDev(fd=23) ... 
[ 14476.529] (II) InputThreadUnregisterDev: found a device: fd=23 state=1 
[ 14476.529] (II) inputh lock ...
[ 14476.541] (II) inputh locked
[ 14476.541] (II) dev fd=23 state=2 
[ 14476.541] (II) InputThreadUnregisterDev(fd=24) ... 
[ 14476.541] (II) InputThreadUnregisterDev: found a device: fd=24 state=1 
[ 14476.541] (II) inputh lock ...
[ 14476.553] (II) inputh locked
[ 14476.553] (II) dev fd=24 state=2 
[ 14476.553] (II) InputThreadUnregisterDev(fd=25) ... 
[ 14476.553] (II) InputThreadUnregisterDev: found a device: fd=25 state=1 
[ 14476.553] (II) inputh lock ...
[ 14476.565] (II) AIGLX: Suspending AIGLX clients for VT switch
[ 14477.916] (II) AIGLX: Resuming AIGLX clients after VT switch
[ 14477.940] (II) modeset(0): ..
...
[ 14478.053] (II) InputThreadRegisterDev(fd=20) ... 
[ 14478.053] (II) InputThreadRegisterDev(fd=21) ... 
[ 14478.053] (II) InputThreadRegisterDev(fd=22) ... 
[ 14478.053] (II) InputThreadRegisterDev(fd=23) ... 
[ 14478.053] (II) InputThreadRegisterDev(fd=24) ... 
[ 14478.053] (II) InputThreadRegisterDev(fd=25) ... 
[ 14478.053] (II) InputThreadRegisterDev: found a device: fd=25 state=2 
[ 14478.053] (II) inputh locked
[ 14478.053] (II) dev fd=25 state=2 
[ 14478.054] (II) dev fd=20 state=0 
[ 14478.054] (II) dev fd=21 state=0 
[ 14478.054] (II) dev fd=22 state=0 
[ 14478.054] (II) dev fd=23 state=0 
[ 14478.054] (II) dev fd=24 state=0 
[ 14490.006] (II) InputThreadUnregisterDev(fd=20) ... 
[ 14490.006] (II) InputThreadUnregisterDev: found a device: fd=20 state=1 
[ 14490.006] (II) inputh lock ...
[ 14490.019] (II) inputh locked
[ 14490.019] (II) dev fd=20 state=2 
[ 14490.019] (II) InputThreadUnregisterDev(fd=21) ... 
[ 14490.019] (II) InputThreadUnregisterDev: found a device: fd=21 state=1 
[ 14490.019] (II) inputh lock ...
[ 14490.031] (II) inputh locked
[ 14490.031] (II) dev fd=21 state=2 
[ 14490.031] (II) InputThreadUnregisterDev(fd=22) ... 
[ 14490.031] (II) InputThreadUnregisterDev: found a device: fd=22 state=1 
[ 14490.031] (II) inputh lock ...
[ 14490.043] (II) inputh locked
[ 14490.043] (II) dev fd=22 state=2 
[ 14490.043] (II) InputThreadUnregisterDev(fd=23) ... 
[ 14490.043] (II) InputThreadUnregisterDev: found a device: fd=23 state=1 
[ 14490.043] (II) inputh lock ...
[ 14490.055] (II) inputh locked
[ 14490.055] (II) dev fd=23 state=2 
[ 14490.055] (II) InputThreadUnregisterDev(fd=24) ... 
[ 14490.055] (II) InputThreadUnregisterDev: found a device: fd=24 state=1 
[ 14490.055] (II) inputh lock ...
[ 14490.067] (II) inputh locked
[ 14490.067] (II) dev fd=24 state=2 
[ 14490.067] (II) InputThreadUnregisterDev(fd=25) ... 
[ 14490.079] (II) evdev: ..
[ 14490.079] (II) UnloadModule: "evdev"
[ 14490.079] (II) evdev: ..
[ 14490.079] (II) UnloadModule: "evdev"
[ 14490.079] (II) evdev: ..
[ 14490.079] (II) UnloadModule: "evdev"
[ 14490.079] (II) evdev: Power Button: Close
[ 14490.080] (II) UnloadModule: "evdev"
[ 14490.080] (II) evdev: Video Bus: Close
[ 14490.080] (II) UnloadModule: "evdev"
[ 14490.080] (II) evdev: Power Button: Close
[ 14490.080] (II) UnloadModule: "evdev"
[ 14490.101] (II) Server terminated successfully (0). Closing log file.


More information about the xorg-devel mailing list