Bug 219891 - xen SDL framebuffer uses busy polling loop
Summary: xen SDL framebuffer uses busy polling loop
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: xen
Version: 5.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Chris Lalancette
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-12-15 23:41 UTC by Stephen Tweedie
Modified: 2007-11-17 01:14 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-10-10 15:56:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch to convert the sdlfb busy looping with a thread implementation (3.88 KB, patch)
2007-10-05 20:40 UTC, Chris Lalancette
no flags Details | Diff

Description Stephen Tweedie 2006-12-15 23:41:14 UTC
Description of problem:
From xen tools/xenfb/sdlfb.c:

+	/*
+	 * We need to wait for fds becoming ready or SDL events to
+	 * arrive.  We time out the select after 10ms to poll for SDL
+	 * events.  Clunky, but works.  Could avoid the clunkiness
+	 * with a separate thread.
+	 */
+	for (;;) {
+		FD_ZERO(&readfds);
+		nfds = xenfb_select_fds(xenfb, &readfds);
+		tv = (struct timeval){0, 10000};
+
+		if (select(nfds, &readfds, NULL, NULL, &tv) < 0) {
+			if (errno == EINTR)
+				continue;
+			fprintf(stderr,
+				"Can't select() on event channel (%s)\n",
+				strerror(errno));
+			break;
+		}
 
 		while (SDL_PollEvent(&event)) {

This leaves us polling things every 10ms, forever, even on idle guests.  It's
not too hard to create a helper thread to wait on non-selectable event sources,
and to pass events back via a pipe; longer term, we should make sure we fix
sdlfb in such a way.

Comment 2 RHEL Program Management 2007-03-21 23:16:13 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 3 RHEL Program Management 2007-09-07 19:57:51 UTC
This request was previously evaluated by Red Hat Product Management
for inclusion in the current Red Hat Enterprise Linux release, but
Red Hat was unable to resolve it in time.  This request will be
reviewed for a future Red Hat Enterprise Linux release.

Comment 4 Chris Lalancette 2007-10-05 20:40:12 UTC
Created attachment 217981 [details]
Patch to convert the sdlfb busy looping with a thread implementation

This is a patch to replace the busy loop in sdlfb with a thread and a pipe.  I
might have been a little pedantic on the locking in here; I wasn't quite sure
if xenfb could be changed by both threads at the same time, so I went very
cautiously and locked every time I accessed it.  I'll have to look into it a
little more, and possibly take some of the locking away (or remove it
altogether if I can convince myself the two threads don't change the same part
of the xenfb structure).

Chris Lalancette

Comment 5 Chris Lalancette 2007-10-10 15:56:46 UTC
The consensus on virtualist seems to be that this is not worth pursuing; few
customers are using SDL, even fewer would even notice the busy wait, and
upstream is going to be getting rid of sdlfb in favor of a merged Qemu solution.
 I'm going to close this as WONTFIX.

Chris Lalancette


Note You need to log in before you can comment on or make changes to this bug.