Bug 1017636

Summary: PATCH: fix qemu using 50% host cpu when audio is playing
Product: Red Hat Enterprise Linux 7 Reporter: Hans de Goede <hdegoede>
Component: qemu-kvmAssignee: Miroslav Rezanina <mrezanin>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: acathrow, hhuang, juzhang, knoel, mazhang, mrezanin, qiguo, virt-maint, wquan, xigao
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-38.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:31:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hans de Goede 2013-10-10 09:27:59 UTC
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:
http://lists.nongnu.org/archive/html/qemu-devel/2013-10/msg01204.html

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:
http://lists.nongnu.org/archive/html/qemu-devel/2013-10/msg01205.html

Further reducing the host cpu load for playing audio to 9%.

Comment 2 Hans de Goede 2013-12-04 09:23:24 UTC
(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 08:15:09 UTC
Quick update on this, the second patch has been accepted upstream now:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=40a814b0b1789b94c483190b3208729b5182e5bd

There also is a related patch which we should probably also pick up (although it is unlikely to impact typical RHEL qemu use):
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=0e8ae611bda0dfb038da2d865801d8adbd692bad

Comment 5 Miroslav Rezanina 2014-01-17 13:27:04 UTC
Fix included in qemu-kvm-1.5.3-38.el7

Comment 7 Qian Guo 2014-02-11 02:14:20 UTC
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?


Thanks,

Comment 8 Miroslav Rezanina 2014-02-11 04:26:39 UTC
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 08:19:47 UTC
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?

thanks

Comment 10 Miroslav Rezanina 2014-02-19 08:42:53 UTC
Hi Qian,

yes, these numbers verify the fix is working.


Mirek

Comment 11 Qian Guo 2014-02-19 08:50:41 UTC
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 11:31:41 UTC
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.