From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xhd4H-0003wf-NE for qemu-devel@nongnu.org; Fri, 24 Oct 2014 07:30:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xhd47-0005h9-MU for qemu-devel@nongnu.org; Fri, 24 Oct 2014 07:30:05 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:39342) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xhd47-0005gu-El for qemu-devel@nongnu.org; Fri, 24 Oct 2014 07:29:55 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Oct 2014 12:29:52 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 912AC1B0805F for ; Fri, 24 Oct 2014 12:29:51 +0100 (BST) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s9OBTosM7799070 for ; Fri, 24 Oct 2014 11:29:50 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s9OBToPv008451 for ; Fri, 24 Oct 2014 05:29:50 -0600 Message-ID: <544A382D.7080708@linux.vnet.ibm.com> Date: Fri, 24 Oct 2014 13:29:49 +0200 From: Heinz Graalfs MIME-Version: 1.0 References: <1414138427-60643-1-git-send-email-graalfs@linux.vnet.ibm.com> <544A18C4.5080405@redhat.com> In-Reply-To: <544A18C4.5080405@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 0/3] qemu-char: Add poll timeouts for character backends List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, borntraeger@de.ibm.com On 24/10/14 11:15, Paolo Bonzini wrote: > On 10/24/2014 10:13 AM, Heinz Graalfs wrote: >> On s390 one can observe system hang situations wrt console input when >> using 'dataplane=on'. >> >> dataplane processing causes an inactive main thread and an active >> dataplane thread. >> >> When a character backend descriptor disappears from the main thread's >> poll() descriptor array (when can_read() returns 0) it happens that it >> will never reappear in the poll() array due to missing poll() interrupts. >> >> The following patches fix observed hangs on s390 and provide a means >> to avoid potential hangs in other backends/frontends. > > I think all you need is a simple > > qemu_notify_event(); > > call when can_read can go from 0 to 1, for example just before > get_console_data returns (for hw/char/sclpconsole-lm.c). > definitely, just that simple! > By the way, for hw/char/sclpconsole-lm.c I'm not sure what happens if > scon->length == SIZE_CONSOLE_BUFFER. You cannot read, so you cannot > generate an event, and you cannot reset scon->length because you cannot > generate an event. I think something like this is needed: > > diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c > index 80dd0a9..c61b77b 100644 > --- a/hw/char/sclpconsole-lm.c > +++ b/hw/char/sclpconsole-lm.c > @@ -61,10 +61,9 @@ static int chr_can_read(void *opaque) > > if (scon->event.event_pending) { > return 0; > - } else if (SIZE_CONSOLE_BUFFER - scon->length) { > + } else { > return 1; > } > - return 0; > } > > static void chr_read(void *opaque, const uint8_t *buf, int size) > @@ -78,6 +77,10 @@ static void chr_read(void *opaque, const uint8_t > *buf, int size) > sclp_service_interrupt(0); > return; > } > + if (scon->length == SIZE_CONSOLE_BUFFER) { > + /* Eat the character, but still process CR and LF. */ > + return; > + } yes, thanks a lot > scon->buf[scon->length] = *buf; > scon->length += 1; > if (scon->echo) { > > Paolo > >