Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 908435

Summary: there is an audible glitch/crack/artifact in sound at the end of pause for final VM synchronization
Product: Red Hat Enterprise Linux 6 Reporter: David Jaša <djasa>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: acathrow, bsarathy, cfergeau, chayang, dblechte, djasa, juzhang, marcandre.lureau, mazhang, mkenneth, mkrcmari, pvine, qzhang, rhod, virt-bugs, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1081795 (view as bug list) Environment:
Last Closed: 2014-03-30 11:25:40 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:
Bug Depends On:    
Bug Blocks: 1081795    
Attachments:
Description Flags
Spice clietn debug log
none
rfc patch none

Description David Jaša 2013-02-06 17:11:57 UTC
Description of problem:
When VM is unpaused after final migration sync, there occurs loud (perceptively about twice than the actual sound) glitch in audio quite often. This can be disturbing and it would be nice to get rid of it. If you play sound in the VM and it occurs when using speech as well as the music.

In can be in in spice-gtk or in spice-server as well.

Version-Release number of selected component (if applicable):
guest: rhel6/ich6

client/host:
spice-gtk-0.14-7.el6.x86_64
virt-viewer-0.5.2-18.el6.x86_64
spice-server-0.12.0-12.el6.x86_64
qemu-kvm-0.12.1.2-2.355.el6.x86_64

How reproducible:
frequently

Steps to Reproduce:
1. migrate VM when playing sound
2.
3.
  
Actual results:
after the VM resumes from final sync, loud glitch/crack/whatever can be heard

Expected results:
no sound artifact occurs

Additional info:

Comment 2 RHEL Program Management 2013-10-14 04:17:23 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 Marc-Andre Lureau 2013-11-09 00:45:14 UTC
can you get SPICE_DEBUG=1 when this happens? thanks

Comment 4 Marian Krcmarik 2013-11-12 16:05:01 UTC
I've reproduced on RHEL7 localhost migration -> ruling out any network hiccups and I am attaching debug log which is from a moment before client_migrate_info and a moment after client got disconnected from source totally.

Comment 5 Marian Krcmarik 2013-11-12 16:05:34 UTC
Created attachment 823040 [details]
Spice clietn debug log

Comment 6 Marc-Andre Lureau 2013-11-12 18:59:25 UTC
(In reply to Marian Krcmarik from comment #5)
> Created attachment 823040 [details]
> Spice clietn debug log

thanks, the log indicate quite clearly that the server sent a volume message. moving to server

Comment 7 Marc-Andre Lureau 2013-11-12 19:02:38 UTC
reading snd_worker.c, the current set volume is sent when the channel is connected to peer. It looks like  spice_server_playback_set_volume() was called by qemu with volume at maximum...

Comment 8 Marc-Andre Lureau 2013-11-12 19:28:06 UTC
this seems to work fine with current spice and qemu git.

Comment 9 Marc-Andre Lureau 2013-11-12 19:41:28 UTC
(In reply to Marc-Andre Lureau from comment #8)
> this seems to work fine with current spice and qemu git.

something we didn't precise until now is which audio device is emulated. I test with HDA and it works fine, sending a single correct volume message on reconnection.

However, with AC97, there seems to be some race, where some garbage/uninitialized value is sent first before sending the migrated volume state.

Could you verify too it's AC97 only? and move the bug to qemu?

Comment 10 Marc-Andre Lureau 2013-11-12 20:35:08 UTC
Since spice server sends currently set volume on connection, and connection happen before the migration state is restored, the client receives the initial AC97 volume set during:

#0  spice_server_playback_set_volume (sin=0x55555651b948, nchannels=2 '\002', volume=0x7fffffffcf70) at snd_worker.c:1002
#1  0x00005555555eeb7e in line_out_ctl (hw=0x55555651b8c0, cmd=3) at audio/spiceaudio.c:218
#2  0x00005555555e86da in AUD_set_volume_out (sw=0x5555564f12a0, mute=1, lvol=255 '\377', rvol=255 '\377') at audio/audio.c:2075
#3  0x0000555555680339 in update_combined_volume_out (s=0x55555650d420) at hw/audio/ac97.c:468
#4  0x000055555568043f in set_volume (s=0x55555650d420, index=2, val=32768) at hw/audio/ac97.c:488
#5  0x000055555568079c in mixer_reset (s=0x55555650d420) at hw/audio/ac97.c:548
#6  0x000055555568246e in ac97_on_reset (opaque=0x55555650d420) at hw/audio/ac97.c:1339
#7  0x0000555555869785 in qemu_devices_reset () at vl.c:1836
#8  0x00005555558697f1 in qemu_system_reset (report=false) at vl.c:1845
#9  0x0000555555871227 in main (argc=35, argv=0x7fffffffd5f8, envp=0x7fffffffd718) at vl.c:4340

Comment 11 Marc-Andre Lureau 2013-11-12 22:14:51 UTC
Created attachment 823152 [details]
rfc patch

patch proposed:
 
    RFC: ac97: don't set audio backend volume during migration
    
    The volume will be restored and set in post load.  This avoids an
    audible volume glitch during migration with AC97. It may be better to
    move this check in the audio layer, since it should be guaranteed to
    have volume restored on migration.

Comment 12 David Jaša 2013-11-20 15:22:46 UTC
sorry for late reply

(In reply to Marc-Andre Lureau from comment #9)
> (In reply to Marc-Andre Lureau from comment #8)
> > this seems to work fine with current spice and qemu git.
> 
> something we didn't precise until now is which audio device is emulated. I
> test with HDA and it works fine, sending a single correct volume message on
> reconnection.
> 
> However, with AC97, there seems to be some race, where some
> garbage/uninitialized value is sent first before sending the migrated volume
> state.
> 
> Could you verify too it's AC97 only? and move the bug to qemu?

I don't hear any significand difference between ich6 and ac97 (same guest, same client, just different soundcard, largely unused 1GbE network, time synced, client just few ms from host). The glitch may be worse with ac97 but that may be just I can't tell that reliably.
What I get more consistently with ich6 is a brief pause on _start_ of the migration (mentioned in the email).

anyway, what is the purpose of the volume message? It seems to cause bug 1012868 (happens when your client volume is lower than guest volume - client volume gets synced to guest volume on migration). This happens regardless of qemu soundcard as well.

Comment 13 Marc-Andre Lureau 2013-11-20 15:39:33 UTC
(In reply to David Jaša from comment #12)
> sorry for late reply
> 
> (In reply to Marc-Andre Lureau from comment #9)
> > (In reply to Marc-Andre Lureau from comment #8)
> > > this seems to work fine with current spice and qemu git.
> > 
> > something we didn't precise until now is which audio device is emulated. I
> > test with HDA and it works fine, sending a single correct volume message on
> > reconnection.
> > 
> > However, with AC97, there seems to be some race, where some
> > garbage/uninitialized value is sent first before sending the migrated volume
> > state.
> > 
> > Could you verify too it's AC97 only? and move the bug to qemu?
> 
> I don't hear any significand difference between ich6 and ac97 (same guest,
> same client, just different soundcard, largely unused 1GbE network, time
> synced, client just few ms from host). The glitch may be worse with ac97 but
> that may be just I can't tell that reliably.
> What I get more consistently with ich6 is a brief pause on _start_ of the
> migration (mentioned in the email).
> 
> anyway, what is the purpose of the volume message? It seems to cause bug

During migration? it shouldn't be needed.

> 1012868 (happens when your client volume is lower than guest volume - client
> volume gets synced to guest volume on migration). This happens regardless of
> qemu soundcard as well.

Client volume is drived by guest volume (so you can get full volume range, avoid multiple volume knobs, be a good desktop audio citizen). However, there is a caveat that could explain this bug, if the stream volume is changed in the client, this is not reflected in the guest. We would need some extra agent messages to sync in both directions.

Comment 14 Ronen Hod 2014-03-27 09:33:11 UTC
QE,
We will not fix it in RHEL6. Please test on RHEL7, and if it reproduces, move this BZ to RHEL7. Otherwise we will close it.
Thanks.

Comment 15 Qunfang Zhang 2014-03-27 09:48:38 UTC
(In reply to Ronen Hod from comment #14)
> QE,
> We will not fix it in RHEL6. Please test on RHEL7, and if it reproduces,
> move this BZ to RHEL7. Otherwise we will close it.
> Thanks.

Hi, Ronen

Get it. 

Hi, Maosheng

Could you give a hand to test it on a RHEL7 host?


Thanks,
Qunfang

Comment 16 mazhang 2014-03-28 03:00:29 UTC
Hit this problem on rhel7 host.

Host & Client:
qemu-img-rhev-1.5.3-57.el7ev.x86_64
libvirt-daemon-driver-qemu-1.1.1-27.el7.x86_64
ipxe-roms-qemu-20130517-5.gitc4bce43.el7.noarch
qemu-kvm-rhev-debuginfo-1.5.3-57.el7ev.x86_64
qemu-kvm-tools-rhev-1.5.3-57.el7ev.x86_64
qemu-kvm-rhev-1.5.3-57.el7ev.x86_64
qemu-guest-agent-1.5.3-53.el7.x86_64
qemu-kvm-common-rhev-1.5.3-57.el7ev.x86_64
spice-vdagent-0.14.0-7.el7.x86_64
spice-gtk3-0.20-8.el7.x86_64
spice-glib-0.20-8.el7.x86_64
spice-server-0.12.4-5.el7.x86_64
virt-viewer-0.5.7-7.el7.x86_64

Guest:
RHEL6.5
kernel-2.6.32-451.el6.x86_64

Steps:
1. Boot vm with sound device.
/usr/libexec/qemu-kvm \
-M pc \
-cpu SandyBridge \
-m 4G \
-smp 4,sockets=2,cores=2,threads=1,maxcpus=160 \
-enable-kvm \
-name rhel7-64 \
-uuid 990ea161-6b67-47b2-b803-19fb01d30d12 \
-smbios type=1,manufacturer='Red Hat',product='RHEV Hypervisor',version=el6,serial=koTUXQrb,uuid=feebc8fd-f8b0-4e75-abc3-e63fcdb67170 \
-k en-us \
-rtc base=localtime,clock=host,driftfix=slew \
-nodefaults \
-monitor stdio \
-qmp tcp:0:6666,server,nowait \
-boot menu=on \
-bios /usr/share/seabios/bios.bin \
-monitor unix:/tmp/guest-sock,server,nowait \
-drive file=/home/rhel6.6-64.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,werror=stop,rerror=stop,aio=threads \
-device virtio-blk-pci,scsi=off,bus=pci.0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1,addr=0x8 \
-vga qxl \
-spice port=5900,disable-ticketing,seamless-migration=on \
-netdev tap,id=hostnet0,vhost=on \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:39:13:2c \
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
-device usb-tablet,id=input0 \
-device intel-hda,id=sound0,bus=pci.0,addr=0x9 \
-device hda-duplex \

2. Start qemu-kvm instance on remote host with "-incoming tcp:0:5800"

3. Do migration
(qemu) client_migrate_info spice 10.66.4.217 5900
(qemu) migrate -d tcp:10.66.4.217:5800

Result:
Heard the crack in end of migration, at the same time hmp output below messages:
(qemu) red_client_migrate: migrate client with #channels 6
red_dispatcher_display_migrate: channel type 2 id 0
red_dispatcher_cursor_migrate: channel type 4 id 0

Comment 17 Qunfang Zhang 2014-03-28 03:08:54 UTC
(In reply to Ronen Hod from comment #14)
> QE,
> We will not fix it in RHEL6. Please test on RHEL7, and if it reproduces,
> move this BZ to RHEL7. Otherwise we will close it.
> Thanks.

Hello, Ronen

QE just tested this bug in comment 16. And if you won't plan to fix it in RHEL6, I'd suggest to close it as WONTFIX and then clone a new one in RHEL7 component. Please do not move it directly to RHEL7 in case our QE hit it again in RHEL6 and file new bug in future.  Is this okay for you? 

Thanks,
Qunfang

Comment 18 mazhang 2014-03-28 03:18:44 UTC
File a new bug 1081795 on RHEL7 against this problem.

Comment 19 Ronen Hod 2014-03-30 11:25:40 UTC
(In reply to Qunfang Zhang from comment #17)
> Hello, Ronen
> 
> QE just tested this bug in comment 16. And if you won't plan to fix it in
> RHEL6, I'd suggest to close it as WONTFIX and then clone a new one in RHEL7
> component. Please do not move it directly to RHEL7 in case our QE hit it
> again in RHEL6 and file new bug in future.  Is this okay for you? 
> 
> Thanks,
> Qunfang

Thanks, Ronen.