Bug 634232
Summary: | PATCH: virtio_console: Fix poll blocking even though there is data to read | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Hans de Goede <hdegoede> | |
Component: | kernel | Assignee: | Amit Shah <amit.shah> | |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
Severity: | high | Docs Contact: | ||
Priority: | medium | |||
Version: | 6.1 | CC: | amit.shah, dhoward, fhrbata, khong, llim, plyons, tburke | |
Target Milestone: | rc | Keywords: | ZStream | |
Target Release: | 6.1 | |||
Hardware: | All | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | kernel-2.6.32-85.el6 | Doc Type: | Bug Fix | |
Doc Text: |
Applications and agents using virtio serial ports would block messages even though there were messages queued up and ready to be read in the virtqueue. This was due to virtio_console's poll function checking whether a port was NULL to determine if a read operation would result in a block of the port. However, in some cases, a port can be NULL even though there are buffers left in the virtqueue to be read. This update introduces a more sophisticated method of checking whether a port contains any data; thus, preventing queued up messages from being incorrectly blocked.
|
Story Points: | --- | |
Clone Of: | ||||
: | 636020 (view as bug list) | Environment: | ||
Last Closed: | 2011-05-23 20:52:24 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: | ||||
Bug Depends On: | ||||
Bug Blocks: | 580954, 636020, 678561 | |||
Attachments: |
Created attachment 447686 [details]
PATCH: virtio_console: Fix poll blocking even though there is data to read
This is version 1 of the patch, which after initial review was changed, and then after more review turned out to be correct after all.
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release. Hi, Some info on verifying this bug. As mentioned in the patch commit message I hit this problem while working on a spice agent for linux: http://cgit.freedesktop.org/~jwrdegoede/vdagent-linux/ To reproduce to the following: create a rhel kvm guest using the qxl adapter / spice protocol for display. and not using the usbtablet option for mouse. Inside this guest, compile the agent, then start vdagentd (as root) followed by vdagent Notice that you can now move your mouse outside of the spice-client window, even though it is active (iow grabbed) inside it. Now press the right mouse button on the desktop background and keep it pressed, this will give you a selection rectangle. Move the mouse slowly around a bit keeping the button pressed, notice that the corner of the selectionrectangle exactly matches the hotspot of the mouse corner. Now move the mouse around fast. After a while you will see the actual mouse position and the corner of the selection rectangle no longer match. This is caused by the bug this patch fixes. ### Alternatively, I can verify the fix myself. Once a fixed kernel is available it is easy for me to install it inside my guest and verify this problem is not happening, exp. as I exactly now the problem symptoms. Regards, Hans Can reproduce the bug according to Comment 6. (notes, before vdagentd is started, make sure "uinput" module is loaded.) Patch(es) available on kernel-2.6.32-89.el6 Hi Hans, Strange that I couldn't move your mouse outside of the spice-client window after running vdagentd, then vdagent -d following your steps mentioned in Comment 6. # vdagent -d 0x18fd010 connected to /tmp/vdagent Selection window: 46137345 0x18fd010 sent guest xorg resolution, opaque: 0, size 8 Last time I did succeed as can be seen in comment 7. Did I miss something? CLI used: # /usr/libexec/qemu-kvm -M rhel6.0.0 -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -uuid 24d1410f-82d6-9ccc-ef35-33c237c95b6a -nodefconfig -nodefaults -monitor stdio -rtc base=utc -boot c -drive file=/home/khong/RHEL-Server-6.0-64-virtio.raw,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -netdev tap,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:fa:e9:8b,bus=pci.0,addr=0x3 -vga qxl -spice port=5930,disable-ticketing -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -vga cirrus -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 -device spicevmc,bus=virtio-serial0.0,nr=0 Thanks Keqin Ypur vga device is set to cirrus, rather then qxl I think that is the cause. (note you've both a -vga qxl and a - vga cirrus in your cmdline and the -vga cirrus is the last one so it will win). Oops. yes, it was caused by cirrus. Thank you Hans. There might be a problem with CLI parsing. If I put "-vga qxl" before "-spice port=...", I got no display. However, if I put it the opposite, things would go well. (That caused me mistakenly to put -vga cirrus at the rear) I will further check this later. Created attachment 474382 [details]
Cursor async when moving mouse
Reproduced on kernel-2.6.32-70.el6.x86_64 and verified on 2.6.32-100.el6.x86_64, PASS. Steps: 1. boot RHEL6 with qxl/spice and spicevmc. # /usr/libexec/qemu-kvm -M rhel6.0.0 -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -uuid 24d1410f-82d6-9ccc-ef35-33c237c95b6a -nodefconfig -nodefaults -monitor stdio -rtc base=utc -boot c -drive file=/home/khong/RHEL-Server-6.0-64-virtio.raw,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -netdev tap,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:fa:e9:8b,bus=pci.0,addr=0x3 -spice port=5930,disable-ticketing -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -vga qxl -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 -device spicevmc,bus=virtio-serial0.0,nr=0 2. Install spice-vdagent-0.6.3-5.el6 inside guest. 3. start vdagentd service #/usr/sbin/spice-vdagentd 4. start vdagent #/usr/bin/spice/spice-vdagent -d 5. right click, and move mouse around 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: Applications and agents using virtio serial ports would block messages even though there were messages queued up and ready to be read in the virtqueue. This was due to virtio_console's poll function checking whether a port was NULL to determine if a read operation would result in a block of the port. However, in some cases, a port can be NULL even though there are buffers left in the virtqueue to be read. This update introduces a more sophisticated method of checking whether a port contains any data; thus, preventing queued up messages from being incorrectly blocked. An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2011-0542.html |
Created attachment 447501 [details] PATCH: virtio_console: Fix poll blocking even though there is data to read I found this while working on a Linux agent for spice, the symptom I was seeing was select blocking on the spice vdagent virtio serial port even though there were messages queued up there. I found this while working on a Linux agent for spice, the symptom I was seeing was select blocking on the spice vdagent virtio serial port even though there were messages queued up there. virtio_console's port_fops_poll checks port->inbuf != NULL to determine if read won't block. However if an application reads enough bytes from inbuf through port_fops_read, to empty the current port->inbuf, port->inbuf will be NULL even though there may be buffers left in the virtqueue. This causes poll() to block even though there is data ready to be read, this patch fixes this by using port_has_data(port) instead of the port->inbuf != NULL check. Note this bug should probably be assigned to amit.shah@redhat.... who has also reviewed this patch upstream.