[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#345537: xserver-xorg: stopping acpid makes Xorg go crazy



tags 345537 + patch
stop

On Sun, Jan 01, 2006 at 05:07:26PM +0100, Mattia Dongili wrote:
> Package: xserver-xorg
> Version: 6.9.0.dfsg.1-1
> Severity: normal
> 
> Hello,
> 
> I just noticed that Xorg uses ACPI's /proc/acpi/event. Now, when acpid
> is running Xorg is smart enough to read from its socket instead, and
> when you, brave user, stop acpid: kaboom!
> Xorg uses all my CPU leaving no option than restarting it.
> 
> Disabling PM management (Option "NoPM") obviously helps and also fixes
> xorg stealing /proc/acpi/event.

bug also found in xorg's bugzilla:
https://bugs.freedesktop.org/show_bug.cgi?id=5140

I've rolled a patch that works here (also submitted in the bugreport
above), it disables reading from acpid socket on any error (tested, works).

A different approach could implement (re)opening /proc/acpi/event on EOF as
that can only happen when using acpid socket because if ACPI is enabled
the /proc/acpi/event is always compiled in.
I'm also going to try this one.

-- 
mattia
:wq!
Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_acpi.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_acpi.c,v
retrieving revision 1.2
diff -u -r1.2 lnx_acpi.c
--- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_acpi.c	31 Oct 2005 05:45:40 -0000	1.2
+++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_acpi.c	2 Jan 2006 11:57:36 -0000
@@ -45,6 +45,13 @@
     memset(ev, 0, LINE_LENGTH);
 
     n = read( fd, ev, LINE_LENGTH );
+    if (n <= 0) {
+	xf86MsgVerb(X_WARNING,3,"Error reading the ACPI Event handler, disabling.\n");
+	if (n < 0)
+		xf86MsgVerb(X_WARNING,3,"%s\n", strerror(errno));
+	lnxCloseACPI();
+	return 0;
+    }
 
     /* Check that we have a video event */
     if (strstr(ev, "video") == ev) {
@@ -160,6 +167,9 @@
 #ifdef DEBUG
    ErrorF("ACPI: Closing device\n");
 #endif
+    xf86PMGetEventFromOs = NULL;
+    xf86PMConfirmEventToOs = NULL;
+
     if (ACPIihPtr) {
 	fd = xf86RemoveInputHandler(ACPIihPtr);
 	shutdown(fd, 2);

Reply to: