rpms/xorg-x11-server/F-10 xserver-1.5.3-idletime-fix.patch, NONE, 1.1 xorg-x11-server.spec, 1.384, 1.385

Adam Jackson ajax at fedoraproject.org
Thu Dec 11 22:23:05 UTC 2008


Author: ajax

Update of /cvs/pkgs/rpms/xorg-x11-server/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12759

Modified Files:
	xorg-x11-server.spec 
Added Files:
	xserver-1.5.3-idletime-fix.patch 
Log Message:
* Thu Dec 11 2008 Adam Jackson <ajax at redhat.com> 1.5.3-6
- xserver-1.5.3-idletime-fix.patch: Fix IDLETIME infinite CPU usage.


xserver-1.5.3-idletime-fix.patch:

--- NEW FILE xserver-1.5.3-idletime-fix.patch ---
>From 4db4a1313e2992ffb77949f4fbd7fff16ffceaee Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax at redhat.com>
Date: Wed, 10 Dec 2008 16:13:20 -0500
Subject: [PATCH] xsync: Fix wakeup storm in idletime counter.

Wakeup scheduling only considered the threshold values, and not whether
the trigger was edge or level.
---
 Xext/sync.c |   51 +++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/Xext/sync.c b/Xext/sync.c
index d6b8c27..4d159d2 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -2323,7 +2323,7 @@ SyncInitServerTime(void)
  * IDLETIME implementation
  */
 
-static pointer IdleTimeCounter;
+static SyncCounter *IdleTimeCounter;
 static XSyncValue *pIdleTimeValueLess;
 static XSyncValue *pIdleTimeValueGreater;
 
@@ -2335,38 +2335,69 @@ IdleTimeQueryValue (pointer pCounter, CARD64 *pValue_return)
 }
 
 static void
-IdleTimeBlockHandler (pointer env,
-                      struct timeval **wt,
-                      pointer LastSelectMask)
+IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
 {
-    XSyncValue idle;
+    XSyncValue idle, old_idle;
+    SyncTriggerList *list = IdleTimeCounter->pTriglist;
+    SyncTrigger *trig;
 
     if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
 	return;
 
+    old_idle = IdleTimeCounter->value;
     IdleTimeQueryValue (NULL, &idle);
+    IdleTimeCounter->value = idle; /* push, so CheckTrigger works */
 
     if (pIdleTimeValueLess &&
         XSyncValueLessOrEqual (idle, *pIdleTimeValueLess))
     {
-	AdjustWaitForDelay (wt, 0);
+	/*
+	 * We've been idle for less than the threshold value, and someone
+	 * wants to know about that, but now we need to know whether they
+	 * want level or edge trigger.  Check the trigger list against the
+	 * current idle time, and if any succeed, bomb out of select()
+	 * immediately so we can reschedule.
+	 */
+
+	for (list = IdleTimeCounter->pTriglist; list; list = list->next) {
+	    trig = list->pTrigger;
+	    if (trig->CheckTrigger(trig, old_idle)) {
+		AdjustWaitForDelay(wt, 0);
+		break;
+	    }
+	}
     }
     else if (pIdleTimeValueGreater)
     {
-	unsigned long timeout = 0;
+	/*
+	 * There's a threshold in the positive direction.  If we've been
+	 * idle less than it, schedule a wakeup for sometime in the future.
+	 * If we've been idle more than it, and someone wants to know about
+	 * that level-triggered, schedule an immediate wakeup.
+	 */
+	unsigned long timeout = -1;
 
-	if (XSyncValueLessThan (idle, *pIdleTimeValueGreater))
-	{
+	if (XSyncValueLessThan (idle, *pIdleTimeValueGreater)) {
 	    XSyncValue value;
 	    Bool overflow;
 
 	    XSyncValueSubtract (&value, *pIdleTimeValueGreater,
 	                        idle, &overflow);
-	    timeout = XSyncValueLow32 (value);
+	    timeout = min(timeout, XSyncValueLow32 (value));
+	} else {
+	    for (list = IdleTimeCounter->pTriglist; list; list = list->next) {
+		trig = list->pTrigger;
+		if (trig->CheckTrigger(trig, old_idle)) {
+		    timeout = min(timeout, 0);
+		    break;
+		}
+	    }
 	}
 
 	AdjustWaitForDelay (wt, timeout);
     }
+
+    IdleTimeCounter->value = old_idle; /* pop */
 }
 
 static void
-- 
1.6.0.3



Index: xorg-x11-server.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-server/F-10/xorg-x11-server.spec,v
retrieving revision 1.384
retrieving revision 1.385
diff -u -r1.384 -r1.385
--- xorg-x11-server.spec	17 Nov 2008 01:22:34 -0000	1.384
+++ xorg-x11-server.spec	11 Dec 2008 22:22:34 -0000	1.385
@@ -19,7 +19,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.5.3
-Release:   5%{?dist}
+Release:   6%{?dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -89,6 +89,8 @@
 # Bug 471221
 Patch6004: xserver-1.5.3-AEI-on-by-default.patch
 
+Patch6005: xserver-1.5.3-idletime-fix.patch
+
 %define moduledir	%{_libdir}/xorg/modules
 %define drimoduledir	%{_libdir}/dri
 %define sdkdir		%{_includedir}/xorg
@@ -519,6 +521,9 @@
 
 
 %changelog
+* Thu Dec 11 2008 Adam Jackson <ajax at redhat.com> 1.5.3-6
+- xserver-1.5.3-idletime-fix.patch: Fix IDLETIME infinite CPU usage.
+
 * Mon Nov 17 2008 Dave Airlie <airlied at redhat.com> 1.5.3-5
 - xserver-1.5.3-exa-fix-unneeded-copies.patch: fix logic error
 




More information about the fedora-extras-commits mailing list