From: Alex Williamson <alex.williamson@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH] virtio-net: Don't pass NULL peer to tap routines
Date: Fri, 24 Sep 2010 08:17:09 -0600 [thread overview]
Message-ID: <1285337829.3788.192.camel@x201> (raw)
In-Reply-To: <m3wrqb5vyj.fsf@blackfin.pond.sub.org>
On Fri, 2010-09-24 at 11:31 +0200, Markus Armbruster wrote:
> Alex Williamson <alex.williamson@redhat.com> writes:
>
> > On Thu, 2010-09-23 at 12:43 -0500, Anthony Liguori wrote:
> >> On 09/22/2010 02:52 PM, Alex Williamson wrote:
> >> > During a hotplug, the netdev might be removed before the
>
> unplug?
yep
> >> > connected virtio device. When this happens, the guest might
> >> > be running cleanup operations that can trigger a segfault in
> >> > qemu. Avoid one set of these by checking whether the peer
> >> > device is present before trying to do tap operations.
> >> >
> >> > Signed-off-by: Alex Williamson<alex.williamson@redhat.com>
> >> >
> >>
> >> Can you explain this scenario a little better?
> >>
> >> If nc.peer is NULL when set_features is called, it would seem to me like
> >> we're in a pretty critical state. I agree that we shouldn't set fault,
> >> but I wonder if the real bug is that this can happen at all.
> >
> > Unfortunately that critical state happens all the time since device_del
> > does an asynchronous ACPI call into the guest and libvirt isn't blocked
> > waiting for that to complete and doesn't poll to see if the device goes
> > away. So it's actually pretty common today that the netdev disappears
> > before the device. We talked about this in the community call on
> > Tuesday, and I think Michael is trying to think of a way to solve this,
> > perhaps by separating the guest releasing the device from the device
> > removal.
> >
> > In the mean time, virtio-net has this hole that seems like it can be
> > avoided by simply checking some pointers on a slow path. Since the
> > netdev has already disappeared, attempting to set features on it seems
> > pointless. The change in the load function is really just a paranoia
> > check since it followed the same model of calling tap_*() funcs w/o
> > checking the value of nc.peer. Thanks,
>
> I figure we should either make netdev_del fail when the netdev is in
> use, or make its users cope graciously with the netdev going away (make
> it look like somebody yanked the cable).
I'm not sure how useful it is, but I like the idea that we can swap the
netdev from under a running guest. I believe this is possible with the
emulated drivers since they don't try to push features into the tap
device. Perhaps something like you suggest where a netdev going away
sets a link down on the device. If/when a netdev gets reattached, the
link returns and features are renegotiated. Then we could move the
guest between NAT'd bridges and transparent bridges and it'd look like
we moved the network cable from one switch to another in the guest.
Alex
next prev parent reply other threads:[~2010-09-24 14:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-22 19:52 [Qemu-devel] [PATCH] virtio-net: Don't pass NULL peer to tap routines Alex Williamson
2010-09-23 17:43 ` Anthony Liguori
2010-09-23 18:25 ` Alex Williamson
2010-09-24 9:31 ` Markus Armbruster
2010-09-24 14:17 ` Alex Williamson [this message]
2010-09-26 11:57 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1285337829.3788.192.camel@x201 \
--to=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).