From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgHh5-0000E4-RI for qemu-devel@nongnu.org; Thu, 29 Dec 2011 10:15:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RgHgz-0004K6-NS for qemu-devel@nongnu.org; Thu, 29 Dec 2011 10:14:59 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:43887) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgHgz-0004Ji-GC for qemu-devel@nongnu.org; Thu, 29 Dec 2011 10:14:53 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 29 Dec 2011 15:14:46 -0000 Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pBTFEHDe2502898 for ; Thu, 29 Dec 2011 15:14:17 GMT Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pBTFEHqn016878 for ; Thu, 29 Dec 2011 08:14:17 -0700 Message-ID: <4EFC83C5.5010903@de.ibm.com> Date: Thu, 29 Dec 2011 16:14:13 +0100 From: Christian Borntraeger MIME-Version: 1.0 References: <4EE9EBB9.9020300@de.ibm.com> <4EFC616F.4060806@de.ibm.com> <20111229140407.GC4576@amit.redhat.com> <4EFC7657.5090804@de.ibm.com> <20111229142658.GD4576@amit.redhat.com> <4EFC79EE.6020000@de.ibm.com> <20111229145602.GE4576@amit.redhat.com> In-Reply-To: <20111229145602.GE4576@amit.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCHv2] Fix virtio-console failure on unconnected pty List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: "qemu-devel@nongnu.org" , Alexander Graf On 29/12/11 15:56, Amit Shah wrote: > On (Thu) 29 Dec 2011 [15:32:14], Christian Borntraeger wrote: >>> port->throttled never becomes true for qemu. >> >> Huh? What did I miss below? >> >> if (ret == -EAGAIN || (ret >= 0 && ret < buf_size)) { >> virtio_serial_throttle_port(port, true); > > 'ret' here is the return value from info->have_data(), which is > hw/virtio-console.c:flush_buf(). That function returns the value that > qemu_chr_fe_write() returns, which is qemu-char.c:send_all() for pty, > tcp, unix sockets. send_all() just keeps spinning here if it can't > write, doesn't signal EAGAIN at all (or even a partial write). > > Can you print out the return values of have_data to check what's going > on? Maybe you're hitting a case I never hit earlier and throttling > indeed does get enabled? ret is 0, see below for the gdb output. send_all does indeed break out of the loop in case of 0. (gdb) bt #0 do_flush_queued_data (port=0x8130a910, vq=0x813091e0, vdev=0x81309060) at /home/cborntra/REPOS/qemu/hw/virtio-serial-bus.c:166 #1 0x000000008022641e in handle_output (vdev=0x81309060, vq=0x813091e0) at /home/cborntra/REPOS/qemu/hw/virtio-serial-bus.c:481 #2 0x000000008022ac34 in virtio_queue_notify_vq (vq=0x813091e0) at /home/cborntra/REPOS/qemu/hw/virtio.c:632 #3 0x000000008022acc2 in virtio_queue_notify (vdev=0x81309060, n=1) at /home/cborntra/REPOS/qemu/hw/virtio.c:638 #4 0x00000000801e7168 in s390_virtio_hypercall (env=0x812f8170, mem=2097954816, hypercall=0) at /home/cborntra/REPOS/qemu/hw/s390-virtio.c:86 #5 0x00000000801bf3d4 in handle_hypercall (env=0x812f8170, run=0x20000028000) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:270 #6 0x00000000801bf48a in handle_diag (env=0x812f8170, run=0x20000028000, ipb_code=1280) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:281 #7 0x00000000801bfa3e in handle_instruction (env=0x812f8170, run=0x20000028000) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:397 #8 0x00000000801bfb76 in handle_intercept (env=0x812f8170) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:420 #9 0x00000000801bfcd2 in kvm_arch_handle_exit (env=0x812f8170, run=0x20000028000) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:452 #10 0x00000000801bd774 in kvm_cpu_exec (env=0x812f8170) at /home/cborntra/REPOS/qemu/kvm-all.c:1021 #11 0x0000000080181470 in qemu_kvm_cpu_thread_fn (arg=0x812f8170) at /home/cborntra/REPOS/qemu/cpus.c:740 #12 0x000002000043240e in start_thread () from /lib64/libpthread.so.0 #13 0x000002000055469a in thread_start () from /lib64/libc.so.6 (gdb) print ret $3 = 0