Bug 709397

Summary: virtio-serial unthrottling needs to use a bottomhalf to avoid recursion
Product: Red Hat Enterprise Linux 6 Reporter: Alon Levy <alevy>
Component: qemu-kvmAssignee: Alon Levy <alevy>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2CC: amit.shah, dblechte, ehabkost, juzhang, mkenneth, qzhang, tburke, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.172.el6 Doc Type: Bug Fix
Doc Text:
I don't think a technical note is required. This is not user visible (not easily, not in the bug description).
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 15:41:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alon Levy 2011-05-31 15:33:49 UTC
Description of problem:
current virtio serial unthrottling callback does a straight call to the callback,
which can lead to a second call to the user on the same stack, which should be avoided.
qemu already has a bottomhalf mechanism for this. It is implemented to call all bh before going back to select in the mainloop, so no wait is involved (except for a few instructions).

Comment 4 juzhang 2011-06-01 05:11:19 UTC
Hi,Alon

  Would you please give our qe efficient way to reproduce & verify this issue? thanks

Comment 5 Alon Levy 2011-06-01 05:38:52 UTC
Hi Juzhang,

 There is none.. this is not user visible at all, it just changes the way the callback for sending queued messages to the chardev inside qemu code is called. Without this patch is was called directly, with this patch it is called from the qemu event loop (main_loop) via the bh (bottom half) mechanism. This is basically to cleanup some code that was overly complicated in spice_qemu_char.c (the spicevmc chardev). The patch for the later has not been sent yet. I'll probably open another bug just for it. Maybe there is some flag I should put on the bug to indicate "code cleanup bug"?

Alon

Comment 6 Amit Shah 2011-06-01 07:05:03 UTC
I'd recommend QE to test guest->host file transfer with a very large file (2+GB) and ensure they receive the entire file fine on the host.  That will ensure the throttling code is executed and this path hasn't regressed.

Comment 7 juzhang 2011-06-08 02:34:40 UTC
Mark this issue qa_ack+

We will verify this issue according to comment6 and check source code whether apply in fixed version

Comment 11 FuXiangChun 2011-09-01 07:28:43 UTC
verified on qemu-kvm-0.12.1.2-2.184.el6.x86_64

steps to verify:
1./usr/libexec/qemu-kvm -M pc -enable-kvm -m 4G -smp 4 -name rhel6-32 -uuid ddcbfb49-3411-1701-3c36-6bdbc00bedb9 -rtc base=utc,clock=host,driftfix=slew -boot c -drive file=/dev/migrate/data1,if=none,id=drive-virtio-0-1,format=qcow2,cache=none,werror=ignore,rerror=ignore -device virtio-blk-pci,drive=drive-virtio-0-1,id=virt0-0-1 -netdev tap,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:19:3b:80 -spice disable-ticketing,port=5913  -monitor stdio  -device virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x6 -chardev socket,id=channel0,path=/tmp/port0,server,nowait -device virtserialport,chardev=channel0,name=org.linux-kvm.port.0,bus=virtio-serial0.0,id=port0

2.dd if=/dev/zero of=2Gfile bs=1M count=2000 and md5sum 2Gfile in guest
3.cat 2Gfile >/dev/vport0p1  in guest
4.nc -U /tmp/port0 >2Gfile.out
5.md5sum 2Gfile 
6.compare md5sum values

actual result:
two 2Gfile values are same.

check source code:
  below is part changelog of build qemu-kvm-0.12.1.2-2.172.el6
Changelog
- kvm-virtio-serial-bus-use-bh-for-unthrottling.patch [bz#709397] 
- Resolves: bz#709397 
 build qemu-kvm-0.12.1.2-2.172.el6 have included the patch.

base on above, this bug has been fixed.

Comment 13 Alon Levy 2011-11-17 17:54:11 UTC
adding note that technical note is not required.

Comment 14 Alon Levy 2011-11-17 17:54:11 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
I don't think a technical note is required. This is not user visible (not easily, not in the bug description).

Comment 15 errata-xmlrpc 2011-12-06 15:41:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2011-1531.html