From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USpZ0-0001rX-Uf for qemu-devel@nongnu.org; Thu, 18 Apr 2013 10:11:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1USpYy-00020W-GU for qemu-devel@nongnu.org; Thu, 18 Apr 2013 10:11:50 -0400 Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:45597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USpYy-00020O-A5 for qemu-devel@nongnu.org; Thu, 18 Apr 2013 10:11:48 -0400 Received: by mail-we0-f174.google.com with SMTP id u12so2369994wey.5 for ; Thu, 18 Apr 2013 07:11:47 -0700 (PDT) Date: Thu, 18 Apr 2013 16:11:44 +0200 From: Stefan Hajnoczi Message-ID: <20130418141144.GA23230@stefanha-thinkpad.redhat.com> References: <1366187964-14265-1-git-send-email-qemulist@gmail.com> <1366187964-14265-5-git-send-email-qemulist@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1366187964-14265-5-git-send-email-qemulist@gmail.com> Subject: Re: [Qemu-devel] [RFC PATCH v4 04/15] net: resolve race of tap backend and its peer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: Stefan Hajnoczi , Jan Kiszka , qemu-devel@nongnu.org, mdroth , Anthony Liguori , Paolo Bonzini On Wed, Apr 17, 2013 at 04:39:13PM +0800, Liu Ping Fan wrote: > From: Liu Ping Fan > > When vhost net enabled, we should be sure that the user space > fd handler is not in flight > > Signed-off-by: Liu Ping Fan > --- > net/tap.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/net/tap.c b/net/tap.c > index 35cbb6e..b5629e3 100644 > --- a/net/tap.c > +++ b/net/tap.c > @@ -41,6 +41,7 @@ > #include "qemu/error-report.h" > > #include "net/tap.h" > +#include "util/event_gsource.h" > > #include "hw/vhost_net.h" > > @@ -327,6 +328,10 @@ static void tap_poll(NetClientState *nc, bool enable) > tap_read_poll(s, enable); > tap_write_poll(s, enable); > > + if (!enable) { > + /* need sync so vhost can take over polling */ > + g_source_remove_poll(&s->nsrc->source, &s->nsrc->gfd); > + } We must also re-enable it when .poll(nc, true) is called. Please drop the comments the previous patch added. In fact, this patch can be squashed. I think there was another vhost sync comment which you haven't addressed here. See the previous patch. Stefan