[xorg-x11-server] fix tcflush EIO bug

Adam Jackson ajax at fedoraproject.org
Wed Aug 25 15:11:12 UTC 2010


commit dc8a7bc8400f78c6ad60beb32a70bfd6e45ddbc9
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Aug 25 11:11:10 2010 -0400

    fix tcflush EIO bug

 xorg-x11-server.spec            |    7 ++++++-
 xserver-1.9.0-tcflush-fix.patch |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index a0fde8d..5acfd56 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -30,7 +30,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.9.0
-Release:   1%{?gitdate:.%{gitdate}}%{dist}
+Release:   2%{?gitdate:.%{gitdate}}%{dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -98,6 +98,8 @@ Patch6053: xserver-1.8-disable-vboxvideo.patch
 # https://bugs.freedesktop.org/show_bug.cgi?id=28672
 Patch7000: xserver-1.8.0-no-xorg.patch
 
+Patch7001: xserver-1.9.0-tcflush-fix.patch
+
 %define moduledir	%{_libdir}/xorg/modules
 %define drimoduledir	%{_libdir}/dri
 %define sdkdir		%{_includedir}/xorg
@@ -546,6 +548,9 @@ rm -rf $RPM_BUILD_ROOT
 %{xserver_source_dir}
 
 %changelog
+* Wed Aug 25 2010 Adam Jackson <ajax at redhat.com> 1.9.0-2
+- xserver-1.9.0-tcflush-fix.patch: Fix 100% CPU usage bug.
+
 * Mon Aug 23 2010 Peter Hutterer <peter.hutterer at redhat.com> 1.9.0-1
 - xserver 1.9.0
 - xserver-1.9-reset-root-null.patch: drop, upstream.
diff --git a/xserver-1.9.0-tcflush-fix.patch b/xserver-1.9.0-tcflush-fix.patch
new file mode 100644
index 0000000..86462dc
--- /dev/null
+++ b/xserver-1.9.0-tcflush-fix.patch
@@ -0,0 +1,35 @@
+From 20e32420a2f75b58603eb1578c151d63e6b2e8ac Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax at redhat.com>
+Date: Wed, 25 Aug 2010 11:06:38 -0400
+Subject: [PATCH] linux: Fix CPU usage bug in console fd flushing
+
+If the vt gets a vhangup from under us, then the tty will appear ready
+in select(), but trying to tcflush() it will return -EIO, so we'll spin
+around at 100% CPU for no reason.  Notice this condition and unregister
+the handler if it happens.
+
+Signed-off-by: Adam Jackson <ajax at redhat.com>
+---
+ hw/xfree86/os-support/linux/lnx_init.c |    6 +++++-
+ 1 files changed, 5 insertions(+), 1 deletions(-)
+
+diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
+index c8cec2e..21f2220 100644
+--- a/hw/xfree86/os-support/linux/lnx_init.c
++++ b/hw/xfree86/os-support/linux/lnx_init.c
+@@ -85,7 +85,11 @@ static void *console_handler;
+ static void
+ drain_console(int fd, void *closure)
+ {
+-    tcflush(fd, TCIOFLUSH);
++    errno = 0;
++    if (tcflush(fd, TCIOFLUSH) == -1 && errno == EIO) {
++	xf86RemoveGeneralHandler(console_handler);
++	console_handler = NULL;
++    }
+ }
+ 
+ void
+-- 
+1.7.2.1
+


More information about the scm-commits mailing list