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 634232 - PATCH: virtio_console: Fix poll blocking even though there is data to read
Summary: PATCH: virtio_console: Fix poll blocking even though there is data to read
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel
Version: 6.1
Hardware: All
OS: Linux
medium
high
Target Milestone: rc
: 6.1
Assignee: Amit Shah
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 580954 636020 678561
TreeView+ depends on / blocked
 
Reported: 2010-09-15 15:20 UTC by Hans de Goede
Modified: 2013-01-11 03:19 UTC (History)
7 users (show)

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.
Clone Of:
: 636020 (view as bug list)
Environment:
Last Closed: 2011-05-23 20:52:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
PATCH: virtio_console: Fix poll blocking even though there is data to read (1.33 KB, application/octet-stream)
2010-09-15 15:20 UTC, Hans de Goede
no flags Details
PATCH: virtio_console: Fix poll blocking even though there is data to read (1.35 KB, patch)
2010-09-16 09:02 UTC, Hans de Goede
no flags Details | Diff
Cursor async when moving mouse (830.66 KB, image/png)
2011-01-20 03:45 UTC, Keqin Hong
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0542 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 6.1 kernel security, bug fix and enhancement update 2011-05-19 11:58:07 UTC

Description Hans de Goede 2010-09-15 15:20:47 UTC
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.

Comment 2 Hans de Goede 2010-09-16 09:02:05 UTC
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.

Comment 4 RHEL Program Management 2010-10-05 01:52:37 UTC
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.

Comment 6 Hans de Goede 2010-10-09 08:12:40 UTC
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

Comment 7 Keqin Hong 2010-10-11 05:34:18 UTC
Can reproduce the bug according to Comment 6.
(notes, before vdagentd is started, make sure "uinput" module is loaded.)

Comment 8 Aristeu Rozanski 2010-12-13 15:14:32 UTC
Patch(es) available on kernel-2.6.32-89.el6

Comment 11 Keqin Hong 2011-01-19 10:42:40 UTC
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

Comment 12 Hans de Goede 2011-01-19 10:57:23 UTC
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).

Comment 13 Keqin Hong 2011-01-20 03:18:01 UTC
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.

Comment 14 Keqin Hong 2011-01-20 03:45:38 UTC
Created attachment 474382 [details]
Cursor async when moving mouse

Comment 15 Keqin Hong 2011-01-20 03:52:38 UTC
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

Comment 18 Martin Prpič 2011-04-12 12:41:51 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:
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.

Comment 19 errata-xmlrpc 2011-05-23 20:52:24 UTC
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


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