From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: persistent tun & different virtual NICs & dead guest network Date: Thu, 9 Jul 2009 21:13:17 +0300 Message-ID: <20090709181317.GB4340@redhat.com> References: <49D735D6.3070803@msgid.tls.msk.ru> <49D89CF8.8040200@redhat.com> <49D8A014.7010802@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Michael Tokarev , KVM list , qemu-devel To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:47536 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753120AbZGISOG (ORCPT ); Thu, 9 Jul 2009 14:14:06 -0400 Content-Disposition: inline In-Reply-To: <49D8A014.7010802@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Apr 05, 2009 at 03:12:04PM +0300, Avi Kivity wrote: > Avi Kivity wrote: >>> I think all the settings should be reset to 0 >>> when opening the tun device. >> >> This should definitely be fixed. I'll look at writing a patch. >> > > Okay, that's not in upstream qemu, so I committed a fix to > kvm-userspace.git. > > Attached if you want to test it. > > -- > error compiling committee.c: too many arguments to function > > >From 25971710409c374e9486c960c297f324a9164a65 Mon Sep 17 00:00:00 2001 > From: Avi Kivity > Date: Sun, 5 Apr 2009 15:08:55 +0300 > Subject: [PATCH] kvm: qemu: clear tap features on initialization > > tap features change how tap interprets data, so they must be cleared on > initialization to prevent old settings from interfering with new guest > instances. > > Signed-off-by: Avi Kivity > --- > qemu/net.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/qemu/net.c b/qemu/net.c > index d753fa0..703d01c 100644 > --- a/qemu/net.c > +++ b/qemu/net.c > @@ -930,6 +930,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, > #endif > #ifdef TUNSETOFFLOAD > s->vc->set_offload = tap_set_offload; > + tap_set_offload(s->vc, 0, 0, 0, 0); BTW, should not these bits be restored on load? I couldn't find code that does this. > #endif > qemu_set_fd_handler2(s->fd, tap_can_send, tap_send, NULL, s); > snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd); Looks good to me. Just a thought: do we want kernel to give us an option to tie the offload bits to the character device, so that it gets cleaned automatically when qemu dies? -- MST From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MOy8F-0008Gy-OO for qemu-devel@nongnu.org; Thu, 09 Jul 2009 14:14:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOy8C-0008G4-2L for qemu-devel@nongnu.org; Thu, 09 Jul 2009 14:14:07 -0400 Received: from [199.232.76.173] (port=36271 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOy8B-0008G1-R2 for qemu-devel@nongnu.org; Thu, 09 Jul 2009 14:14:03 -0400 Received: from mx2.redhat.com ([66.187.237.31]:56111) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MOy8B-0005O5-Ey for qemu-devel@nongnu.org; Thu, 09 Jul 2009 14:14:03 -0400 Date: Thu, 9 Jul 2009 21:13:17 +0300 From: "Michael S. Tsirkin" Message-ID: <20090709181317.GB4340@redhat.com> References: <49D735D6.3070803@msgid.tls.msk.ru> <49D89CF8.8040200@redhat.com> <49D8A014.7010802@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49D8A014.7010802@redhat.com> Subject: [Qemu-devel] Re: persistent tun & different virtual NICs & dead guest network List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Michael Tokarev , qemu-devel , KVM list On Sun, Apr 05, 2009 at 03:12:04PM +0300, Avi Kivity wrote: > Avi Kivity wrote: >>> I think all the settings should be reset to 0 >>> when opening the tun device. >> >> This should definitely be fixed. I'll look at writing a patch. >> > > Okay, that's not in upstream qemu, so I committed a fix to > kvm-userspace.git. > > Attached if you want to test it. > > -- > error compiling committee.c: too many arguments to function > > >From 25971710409c374e9486c960c297f324a9164a65 Mon Sep 17 00:00:00 2001 > From: Avi Kivity > Date: Sun, 5 Apr 2009 15:08:55 +0300 > Subject: [PATCH] kvm: qemu: clear tap features on initialization > > tap features change how tap interprets data, so they must be cleared on > initialization to prevent old settings from interfering with new guest > instances. > > Signed-off-by: Avi Kivity > --- > qemu/net.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/qemu/net.c b/qemu/net.c > index d753fa0..703d01c 100644 > --- a/qemu/net.c > +++ b/qemu/net.c > @@ -930,6 +930,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, > #endif > #ifdef TUNSETOFFLOAD > s->vc->set_offload = tap_set_offload; > + tap_set_offload(s->vc, 0, 0, 0, 0); BTW, should not these bits be restored on load? I couldn't find code that does this. > #endif > qemu_set_fd_handler2(s->fd, tap_can_send, tap_send, NULL, s); > snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd); Looks good to me. Just a thought: do we want kernel to give us an option to tie the offload bits to the character device, so that it gets cleaned automatically when qemu dies? -- MST