From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42355 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Om6uF-0006N7-8P for qemu-devel@nongnu.org; Thu, 19 Aug 2010 11:19:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Om6uA-0005va-LB for qemu-devel@nongnu.org; Thu, 19 Aug 2010 11:19:51 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:52720) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om6uA-0005vU-FU for qemu-devel@nongnu.org; Thu, 19 Aug 2010 11:19:46 -0400 Received: by gwb11 with SMTP id 11so809227gwb.4 for ; Thu, 19 Aug 2010 08:19:46 -0700 (PDT) Message-ID: <4C6D4B8F.7080108@codemonkey.ws> Date: Thu, 19 Aug 2010 10:19:43 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] QEMUFileBuffered: indicate that we're ready when the underlying file is ready References: <1278521062-13795-1-git-send-email-avi@redhat.com> In-Reply-To: <1278521062-13795-1-git-send-email-avi@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org On 07/07/2010 11:44 AM, Avi Kivity wrote: > QEMUFileBuffered stops writing when the underlying QEMUFile is not ready, > and tells its producer so. However, when the underlying QEMUFile becomes > ready, it neglects to pass that information along, resulting in stoppage > of all data until the next tick (a tenths of a second). > > Usually this doesn't matter, because most QEMUFiles used with QEMUFileBuffered > are almost always ready, but in the case of exec: migration this is not true, > due to the small pipe buffers used to connect to the target process. The > result is very slow migration. > > Fix by detecting the readiness notification and propagating it. The detection > is a little ugly since QEMUFile overloads put_buffer() to send it, but that's > the suject for a different patch. > > Signed-off-by: Avi Kivity\ > Applied. Thanks. Regards, Anthony Liguori > --- > buffered_file.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/buffered_file.c b/buffered_file.c > index 54dc6c2..a79264f 100644 > --- a/buffered_file.c > +++ b/buffered_file.c > @@ -156,6 +156,14 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in > offset = size; > } > > + if (pos == 0&& size == 0) { > + DPRINTF("file is ready\n"); > + if (s->bytes_xfer<= s->xfer_limit) { > + DPRINTF("notifying client\n"); > + s->put_ready(s->opaque); > + } > + } > + > return offset; > } > >