Bug 678558

Summary: virtio_console driver never returns from selecting for write when the queue is full [rhel-6.0.z]
Product: Red Hat Enterprise Linux 6 Reporter: RHEL Program Management <pm-rhel>
Component: kernelAssignee: Frantisek Hrbata <fhrbata>
Status: CLOSED ERRATA QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: amit.shah, bcao, chayang, dhoward, hdegoede, mjenner, plyons, pm-eus, virt-maint
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-2.6.32-71.19.1.el6 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 blocking mode, the write command waited until the host indicated it had 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-04-08 02:59:46 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: 643750    
Bug Blocks:    

Description RHEL Program Management 2011-02-18 12:28:19 UTC
This bug has been copied from bug #643750 and has been proposed
to be backported to 6.0 z-stream (EUS).

Comment 4 Chao Yang 2011-03-28 02:55:44 UTC
Reproduced on rhel6.0 with kernel 2.6.32-71.el6.x86_64.
Steps:
1. boot a guest with virtio-serial-port
2. open the socket with follwing script
# pythonh open-socket.py /tmp/charsoc
# 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(>2G) via virtio-serial
Actual Result:
guest freezes, cannot respond to keyboard.

CLI:
# /usr/libexec/qemu-kvm -M rhel6.0.0 -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -name rhel6.0 -uuid `uuidgen` -rtc base=utc -boot c -drive file=/root/RHEL-Server-6.0-64.qcow2,if=none,id=drive-virtio-disk0,format=qcow2 -device virtio-blk-pci,drive=drive-virtio-disk0,id=virtio-disk0 -netdev tap,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:3f:de:3b -device virtio-serial-pci  -chardev socket,path=/tmp/charsoc,id=channel0,server,nowait -device virtserialport,chardev=channel0 -usb -device usb-tablet,id=input1 -vnc :0 -monitor stdio
------------------------------------------------------------------------------
Verified on host kernel kernel-2.6.32-71.23.1.el6.x86_64.rpm with same steps&CLI above, when transferring large file from guest to host via virtio-serial, guest keeps alive and can interrupt cat process.

Comment 5 errata-xmlrpc 2011-04-08 02:59:46 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-0421.html

Comment 6 Martin Prpič 2011-04-12 12:41:02 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 blocking mode, the write command waited until the host indicated it had 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.