Bug 673983

Summary: virtio_console driver never returns from selecting for write when the queue is full [rhel-5.6.z]
Product: Red Hat Enterprise Linux 5 Reporter: RHEL Program Management <pm-rhel>
Component: kernelAssignee: Jiri Pirko <jpirko>
Status: CLOSED ERRATA QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 5.7CC: amit.shah, bcao, dhoward, hdegoede, mjenner, pm-eus, rkhan, virt-maint
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-2.6.18-238.4.1.el5 Doc Type: Bug Fix
Doc Text:
Using a virtio serial port from an application, filling it until the write command returns -EAGAIN and then executing a select command for the write command caused the select command to not return any values, when using the virtio serial port in a non-blocking mode. When used in a blocking mode, the write command waited until the host indicated it used up the buffers. This was due to the fact that the poll operation waited for the port->waitqueue pointer, however, nothing woke the waitqueue when there was room again in the queue. With this update, the queue is woken via host notifications so that buffers consumed by the host can be reclaimed, the queue freed, and the application write operations may proceed again.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-01 20:31:03 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: 673459    
Bug Blocks:    

Description RHEL Program Management 2011-01-31 09:14:41 UTC
This bug has been copied from bug #673459 and has been proposed
to be backported to 5.6 z-stream (EUS).

Comment 2 Jiri Pirko 2011-02-03 09:21:03 UTC
in kernel-2.6.18-238.4.1.el5

linux-2.6-char-virtio-wake-console-outvq-on-host-notifications.patch

Comment 4 Mike Cao 2011-02-16 08:26:14 UTC
Verified on qemu-kvm-0.12.1.2-2.144.el6.
guest kernel : kernel-2.6.18-238.4.1.el5

steps:
1.start VM with virtio-serial-port w/o -M parameter.
2.open the socket file on the host and not read it
eg:#cat open-socket 
#!/usr/bin/python
import os
import sys
import socket
import time

#fd = os.open(sys.argv[1], os.O_RDONLY)

s = socket.socket(socket.AF_UNIX)
s.connect(sys.argv[1])

while 1:
        # do nothing
        time.sleep(1)

#python open-socket /tmp/vport0
3.transfer a file whose size > 2G via virtio-serial
eg :#cat /tt > /dev/vport0p1

Actual Results:
qemu-kvm process does not freeze.

Based on above ,this issue has been fixed.
Change status to VERIFIED.

Comment 5 errata-xmlrpc 2011-03-01 20:31:03 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-0303.html

Comment 6 Martin Prpič 2011-07-13 20:22:10 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:
Using a virtio serial port from an application, filling it until the write command returns -EAGAIN and then executing a select command for the write command caused the select command to not return any values, when using the virtio serial port in a non-blocking mode. When used in a blocking mode, the write command waited until the host indicated it used up the buffers. This was due to the fact that the poll operation waited for the port->waitqueue pointer, however, nothing woke the waitqueue when there was room again in the queue. With this update, the queue is woken via host notifications so that buffers consumed by the host can be reclaimed, the queue freed, and the application write operations may proceed again.