Bug 21101 - SIGIO mouse + keyboard events NOT select()-ed - no AddEnabledDevice() - NO SIGIOs received + XKB? XINPUT?
Summary: SIGIO mouse + keyboard events NOT select()-ed - no AddEnabledDevice() - NO SI...
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: git
Hardware: Other All
: medium major
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-09 09:13 UTC by Jason Vas Dias
Modified: 2009-04-14 20:35 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Jason Vas Dias 2009-04-09 09:13:44 UTC
Hi ! 
Recent attempts to run recent xserver 1.6.99.+ of Fedora or GIT build 
under Linux kernels 2.6.28..29-rc8+ fail because the file descriptors
for which SIGIO notification is received do not trigger interruption 
of the dix dispatch() select() loop .

As a result, the keyboard and mouse are DISABLED until I make this change
to xserver/hw/common/xfree86/xf86Events.c :

/*
 * xf86AddEnabledDevice --
 *
 */
void
xf86AddEnabledDevice(InputInfoPtr pInfo)
{
  /*    if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) {*/
        AddEnabledDevice(pInfo->fd);
  /*   }*/
}

/*
 * xf86RemoveEnabledDevice --
 *
 */
void
xf86RemoveEnabledDevice(InputInfoPtr pInfo)
{
  /*  if (!xf86RemoveSIGIOHandler (pInfo->fd)) {*/
        RemoveEnabledDevice(pInfo->fd);
        /*   }*/
}


Then the keyboard works only with the evdev driver ; use of the kbd driver
does work, but it repeats each character three times, regardless of the
auto-repeat settings.

As a result, attempting to boot with the brain-damaged "plymouth" module
invoked by default by FC-11 with up-to-date X-Windows RPMS crashes the 
kernel and hangs the machine.

Using the latest X11 1.6.99+ is fine when running the latest kernel from
kernel.org, (2.6.29-fc8+) except for the above issue that SIGIO triggered
devices produce no events - they must be added to the select() loop somehow.

The above is not an issue with latest FC-10 or RHEL5 X-Windows RPMs - only
with the latest 2009-01-02+ GIT xorg-server, xorg-libX11, xorg-libxcb versions.

Clue: when emacs loads under the "OK" 1.6.99 version, it hangs because IT
      gets no SIGIO events.

      When I strace the FC-10 or RHEL-5 emacs executables running fine under
      2.6.29-rc8+ 1.6.99 xserver (which kind of proves this is not a kernel
      issue ?!!) I see some process actually does a kill(SIGIO) ; this 
      kill(SIGIO) does NOT occur when I run the emacs compiled with latest
      libX11 libxcb GTK et al under the 1.6.99 server, but the latest 
      emacs 22.3.3 runs fine under the RHEL5 or FC-10 1.5.xx server, so
      I conclude the problem is somewhere in the latest xserver, as 
      the enabling of the mouse and keyboard by adding to select() loop
      suggests.

EVERYTHING upon which the xserver depends was just built cleanly from 
a fresh GIT checkout and the xserver was configured with these options:

$ cat /usr/src/xorg/everything/xserver/cfg
./autogen.sh --prefix=/usr --libdir=/usr/lib64 \
--disable-config-dbus \
--disable-config-hal \
--disable-xselinux \
--enable-install-libxf86config \
--enable-aiglx \
--enable-glx \
--enable-glx-tls \
--enable-record \
--enable-dri \
--enable-dri2 \
--enable-xcalibrate \
--enable-multibuffer \
--enable-xorg \
--enable-xvfb \
--enable-xnest \
--enable-xfbdev \
--enable-xf86-utils \
--enable-debug \
--with-pic \
--with-gnu-ld

P.S - what happened to the XKB and XINPUT #define's in xorg-server.h ?
      The xserver definitely seems to compile its internal XKB and XINPUT
      extensions, but does not advertise that it contains them. 

Any ideas / suggestions would be gratefully received ! 

Log files available upon request.

TIA, Jason.
Comment 1 Peter Hutterer 2009-04-11 22:10:59 UTC
On Thu, Apr 09, 2009 at 09:13:46AM -0700, bugzilla-daemon@freedesktop.org wrote:
> Recent attempts to run recent xserver 1.6.99.+ of Fedora or GIT build 
> under Linux kernels 2.6.28..29-rc8+ fail because the file descriptors
> for which SIGIO notification is received do not trigger interruption 
> of the dix dispatch() select() loop .

I'm confused. They don't need to, the input is handled in the SIGIO handler.
Are you not getting an signals? are they not handled properly or are they just
ignored?

> Then the keyboard works only with the evdev driver ; use of the kbd driver
> does work, but it repeats each character three times, regardless of the
> auto-repeat settings.
that's because unless you use AutoAddDevices off, the keyboard is picked up by
the evdev driver too, so each keystroke looks as two devices hitting a key to
the server. with key repeat (faking a release), that's 3 symbols.
> 
> P.S - what happened to the XKB and XINPUT #define's in xorg-server.h ?
>       The xserver definitely seems to compile its internal XKB and XINPUT
>       extensions, but does not advertise that it contains them. 

xkb and xinput are mandatory, so the #defines are removed. 
Comment 2 Jason Vas Dias 2009-04-12 22:29:05 UTC
RE: Comment  #1 From Peter Hutterer  2009-04-11 22:10:59 PST  [reply] ---:
On Thu, Apr 09, 2009 at 09:13:46AM -0700, bugzilla-daemon@freedesktop.org
wrote:
> > Recent attempts to run recent xserver 1.6.99.+ of Fedora or GIT build 
> > under Linux kernels 2.6.28..29-rc8+ fail because the file descriptors
> > for which SIGIO notification is received do not trigger interruption 
> > of the dix dispatch() select() loop .
>
> I'm confused. They don't need to, the input is handled in the SIGIO handler.
> Are you not getting an signals? 
> are they not handled properly or are they just ignored ?

No, it seems that when Xorg or emacs linked with the latest libxcb 
+ libX11 + mesa libGL* libraries speaks to the latest 1.6.99? Xorg
(20090412 git) server, both emacs and Xorg expect to get SIGIO signals, 
but do not receive them nor break from their select(3) loops.

Also, an strace of the default Xorg server compiled from GIT also shows NO SIGIO
signals ; perhaps this is more stringent enforcement of pselect(3) POSIX rules,
which when read more strictly, might suggest that without setting up a signal 
mask with a 'sigset_t*' parameter to pselect(3) , then  select(3) is REALLY 
blocking - ie. it is not interrupted by signals;
X hasn't done anything silly like enable the SA_RESTART flag for SIGIO has it ?
If so, then select() (not pselect()) will not return on receipt of a SIGIO. 
So how is Xorg expecting to handle events from SIGIOs outside the select()
loop when the select() loop is not broken ?

The 'AutoAddDevices="off"/"on"' and 'AutoEnableDevices="off"/"on"' settings 
in the xorg.conf ServerLayout seem to have no effect on this problem - still
neither mouse nor keyboard events are enabled unless I add the mouse 
and keyboard FDs to select()'s read FD set.

> > Then the keyboard works only with the evdev driver ; use of the kbd driver
> > does work, but it repeats each character three times, regardless of the
> > auto-repeat settings.
> that's because unless you use AutoAddDevices off, the keyboard is picked up by
> the evdev driver too, so each keystroke looks as two devices hitting a key to
> the server. with key repeat (faking a release), that's 3 symbols.

Then why bother allowing users to configure the "Keyboard" input device at all?
Why not tell them NOT to configure the keyboard in xorg.conf and that 
evdev will automatically be used ?

Also, Xorg refused to allow the Synaptics Touchpad driver to control the 
mouse - if the "Mouse" Input Device is not "mouse", then another 
double-driver is pushed onto the mouse device, and both drivers
get really confused.

It is really broken and confusing behavior to allow more than one driver
to control the same device as another driver in the first place -
why doesn't X detect and complain about this ? - but this is compounded
by ignoring the user's specification of 'driver = "kbd"' in xorg.conf .

This IMHO is a bug.

When I add the FDs for the mouse and keyboard to the read/write FD sets
via my crude AddEnabledDevice() patch, then the new Xorg 1.6.99 server
works really great - thanks!  but I'm still left with the emacs problem; 
recompiling emacs against the new X libraries leaves it stuck in a
select loop not getting any SIGIOs . Running the emacs under FC10 or RHEL5
chroot works fine when running against the new 1.6.99 server, and,
paradoxically, the new 22.3 emacs linked against the new X libraries runs 
fine in a chroot under the old FC10 or RHEL5 kernel and 1.5 X server . 
Full strace logs & config files available on request.

PLEASE FIX X-Server 1.[67] SIGIO handling for x86_64 2.6.29+ Linux kernels! 

> > 
> > P.S - what happened to the XKB and XINPUT #define's in xorg-server.h ?
> >     The xserver definitely seems to compile its internal XKB and XINPUT
> >     extensions, but does not advertise that it contains them. 
> >
> xkb and xinput are mandatory, so the #defines are removed. 

Wow, that really makes sense ! A feature is now mandatory / builtin, so we'll
act like it is removed.

Why not let users know that XKB and XINPUT are now built in extensions, with
something like this for example in xorg-server.h :

#ifndef XINPUT
#define __XINPUT__=_builtin_
#define XINPUT=__XINPUT__
#endif
#ifndef XKB
#define __XKB__=_builtin_
#define XKB=__XKB__
#endif
Comment 3 Jason Vas Dias 2009-04-14 20:35:14 UTC
It seems that recent changes to ./hw/xfree86/os-support/shared/sigio.c
and hw/xfree86/common/xf86Xinput.c have fixed this problem - the 
Xserver and emacs now get SIGIOs.
Thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.