qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] alsa: fix 100% CPU load when idle w/ dmix
@ 2010-10-17 10:34 Jindřich Makovička
  0 siblings, 0 replies; only message in thread
From: Jindřich Makovička @ 2010-10-17 10:34 UTC (permalink / raw)
  To: qemu-devel, kvm; +Cc: Jindřich Makovička

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

Hi,

when using dmix as an ALSA output, the output cannot be polled and
ALSA (snd_pcm_poll_descriptors) returns the event mask set to POLLIN
instead. As this event mask is passed to the main loop, the select()
in main_loop_wait() never waits, because the output file descriptor is
never read. So, qemu/kvm ends up busy looping all the time.

The attached patch simply disables the poll mode, when ALSA returns
POLLIN in the event mask for the ALSA playback pcm handle.

-- 
Jindrich Makovicka

[-- Attachment #2: alsaaudio.c.diff --]
[-- Type: text/x-patch, Size: 706 bytes --]

--- alsaaudio.c.orig	2010-10-13 12:55:11.000000000 +0200
+++ alsaaudio.c	2010-10-17 12:18:57.928834276 +0200
@@ -266,8 +266,13 @@
 
     for (i = 0; i < count; ++i) {
         if (pfds[i].events & POLLIN) {
-            err = qemu_set_fd_handler (pfds[i].fd, alsa_poll_handler,
-                                       NULL, hlp);
+            if (mask & POLLIN) {
+                err = qemu_set_fd_handler (pfds[i].fd, alsa_poll_handler,
+                                           NULL, hlp);
+            } else {
+                dolog ("Cannot use poll mode for output\n");
+                err = -1;
+            }
         }
         if (pfds[i].events & POLLOUT) {
             if (conf.verbose) {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-17 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-17 10:34 [Qemu-devel] [PATCH] alsa: fix 100% CPU load when idle w/ dmix Jindřich Makovička

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).