From: "Jindřich Makovička" <makovick@gmail.com>
To: qemu-devel@nongnu.org, kvm@vger.kernel.org
Cc: "Jindřich Makovička" <makovick@gmail.com>
Subject: [Qemu-devel] [PATCH] alsa: fix 100% CPU load when idle w/ dmix
Date: Sun, 17 Oct 2010 12:34:56 +0200 [thread overview]
Message-ID: <AANLkTinsQbVMmidLyVKDz+g0Figwi3kRhoii2L454u7L@mail.gmail.com> (raw)
[-- 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) {
reply other threads:[~2010-10-17 10:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTinsQbVMmidLyVKDz+g0Figwi3kRhoii2L454u7L@mail.gmail.com \
--to=makovick@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).