From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqciM-0007MH-S7 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 05:37:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqciH-0006Kh-Si for qemu-devel@nongnu.org; Wed, 22 Mar 2017 05:37:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37140) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqciH-0006Ka-M4 for qemu-devel@nongnu.org; Wed, 22 Mar 2017 05:37:53 -0400 References: <1322109813.6444955.1490172025040.JavaMail.zimbra@redhat.com> From: Paolo Bonzini Message-ID: <218df442-1a31-e969-32ef-01184fae84c0@redhat.com> Date: Wed, 22 Mar 2017 10:37:50 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Guest application reading from pl011 without device driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jiahuan Zhang Cc: QEMU Developers On 22/03/2017 09:48, Jiahuan Zhang wrote: >=20 >=20 > On 22 March 2017 at 09:40, Paolo Bonzini > wrote: >=20 >=20 > > > I am using a windows named pipe to get the data from a window > > > host program, which uses ReadFile () in char_win.c > > > > OK, bugs in the windows-specific char backend would be > > unsurprising. > > > > I'm not entirely sure how the chardev layer works, but > > at the pl011 end if we return 0 from our can_receive > > function then the chardev layer should decide it has > > nothing to do until the pl011 later calls > > qemu_chr_fe_accept_input(), I think. > > > > I've cc'd Paolo and Marc-Andr=C3=A9 Lureau as the chardev > > maintainers. >=20 > Windows named pipes do not support the equivalent of "select", > so it's possible that they cause a busy wait. Try using a > TCP socket instead and see if the bug goes away. >=20 >=20 > Hi, I am trying to use a Windows socket for serial redirection instead > of Windows named pipe. > What do you mean "the equivalent of 'select'"? A function that lets a process sleep until data is available on the socket. The solution is to rewrite Windows chardev handling in QEMU to use threads or overlapped I/O. Paolo