Bug 1017636 - PATCH: fix qemu using 50% host cpu when audio is playing
PATCH: fix qemu using 50% host cpu when audio is playing
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Miroslav Rezanina
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2013-10-10 05:27 EDT by Hans de Goede
Modified: 2014-06-17 23:39 EDT (History)
10 users (show)

See Also:
Fixed In Version: qemu-kvm-1.5.3-38.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-06-13 07:31:41 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Hans de Goede 2013-10-10 05:27:59 EDT
qemu-1.5 has a regression where the audio_timer tries to expires every nano second, which gets rate limited to every 250 us by the timer subsys, resulting in 4000 wakeups per seconds for vms with audio active.

Here is an upstream patch fixing this:

Dropping host cpu load to a much better 13%. And here is a follow up patch further limiting the wakeup rate from 250 / second (which is a bit much) to 100 / second:

Further reducing the host cpu load for playing audio to 9%.
Comment 2 Hans de Goede 2013-12-04 04:23:24 EST
(In reply to Miroslav Rezanina from comment #1)
> Using patches lower cpu consumption to less then half of the consumption
> without them. However, only one of patches applied upstream, waiting for
> second to be applied.

The second one may cause issues with Windows guests (this needs more testing), which is why it was not applied. Most of the benefits come from the first patch, so I suggest just moving forward with only the 1st patch, the 2nd patches may very well never get applied upstream.
Comment 3 Hans de Goede 2013-12-11 03:15:09 EST
Quick update on this, the second patch has been accepted upstream now:

There also is a related patch which we should probably also pick up (although it is unlikely to impact typical RHEL qemu use):
Comment 5 Miroslav Rezanina 2014-01-17 08:27:04 EST
Fix included in qemu-kvm-1.5.3-38.el7
Comment 7 Qian Guo 2014-02-10 21:14:20 EST
Hi, Miroslav

Does this bug related with virtual sound deivces, do we qe need test this bug with which sound deivce (AC97/intel-hda)?
And should we test both windows/linux guests?

Comment 8 Miroslav Rezanina 2014-02-10 23:26:39 EST
Hi Qian,
this should be applicable to both sound device on both windows/linux guests to see full impact of patches (I was able to test only with linux).
Comment 9 Qian Guo 2014-02-19 03:19:47 EST
Test this bug with qemu-kvm-1.5.3-30.el7.x86_64 and qemu-kvm-1.5.3-48.el7.x86_64, and guests I used rhel7  and win7, the following matrix is the result that I got:

1.Reproduce this bug with  qemu-kvm-1.5.3-30.el7.x86_64, the value is the cpu usage:

            | RHEl7       |        Win7  
intel-hda   | 42%~55%     |        25%~34%
AC97        | 40%~55%     |        Windows not support AC97 by default

2.Verify this bug with  qemu-kvm-1.5.3-48.el7.x86_64:

            | RHEl7       |        Win7  
intel-hda   | 17%~25%     |        11%~15%
AC97        | 15%~25%     |        Windows not support AC97 by default

Hi, Miroslav

windows can not use AC97 sound device, and accoridng to above, can it verify this bug?

Comment 10 Miroslav Rezanina 2014-02-19 03:42:53 EST
Hi Qian,

yes, these numbers verify the fix is working.

Comment 11 Qian Guo 2014-02-19 03:50:41 EST
Thank Mirek for the quick response.

So according to comment #9 and comment #10, this bug is fixed by qemu-kvm-1.5.3-48.el7.x86_64
Comment 13 Ludek Smid 2014-06-13 07:31:41 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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