From: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
To: dor.laor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: kvm-devel
<kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>,
virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH 2/2] virtio reset support
Date: Fri, 25 Jan 2008 08:19:39 +1100 [thread overview]
Message-ID: <200801250819.39484.rusty@rustcorp.com.au> (raw)
In-Reply-To: <1201180147.7100.35.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
On Friday 25 January 2008 00:09:07 Dor Laor wrote:
> The patches really fix/simplify things :)
Yes, that's why I like reset, it solves multiple problems.
> Did you test device open->close->open? It was broken in my last test,
Well, it's not really fair, since I moved the buffer allocation and
deallocation to the probe and remove routines (otherwise we'd have to reset
on every close).
> we cad add link indications too.
Definitely. We'll use the config_change callback. It should be quite neat.
> Besides that I also remembered that adding 'vq->num_free =vq->ring.num;'
> after reset fixed part of the problems, I don't remember why (gonna
> re-check it soon), I think it was the reset calls for (..) detach_buf
> for all buffers regardless if they were free already.
My initial reaction was that we don't need to do cleanup, because it's
nonsensical to use a virtqueue after reset (you can only really do del_vq: in
fact we may eventually change "reset" to "kill" which also deletes the
virtqueues).
However, a shared interrupt might make us look at the ring again, and we'll
get confused. reset() must at least reset the 'last seen' index of the
virtqueues (I had the same issue in the guest).
BTW, here's what lguest does on the host side for reset:
/* Resetting a device is fairly easy. */
static void reset_device(struct device *dev)
{
struct virtqueue *vq;
verbose("Resetting device %s\n", dev->name);
/* Clear the status. */
dev->desc->status = 0;
/* Clear any features they've acked. */
memset(get_feature_bits(dev) + dev->desc->feature_len, 0,
dev->desc->feature_len);
/* Zero out the virtqueues. */
for (vq = dev->vq; vq; vq = vq->next) {
memset(vq->vring.desc, 0,
vring_size(vq->config.num, getpagesize()));
vq->last_avail_idx = 0;
}
}
Cheers,
Rusty.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2008-01-24 21:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-23 14:16 [PATCH 1/2] reset support: make net driver alloc/cleanup in probe and remove Rusty Russell
[not found] ` <200801240116.26160.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2008-01-23 14:18 ` [PATCH 2/2] virtio reset support Rusty Russell
[not found] ` <200801240118.09032.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2008-01-24 13:09 ` Dor Laor
[not found] ` <1201180147.7100.35.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-01-24 21:19 ` Rusty Russell [this message]
2008-01-27 13:22 ` Avi Kivity
[not found] ` <479C8599.60007-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-28 15:40 ` Anthony Liguori
[not found] ` <479DF787.2020100-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-01-28 15:48 ` Avi Kivity
[not found] ` <479DF952.9040201-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-28 22:47 ` Anthony Liguori
2008-01-29 17:27 ` Avi Kivity
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=200801250819.39484.rusty@rustcorp.com.au \
--to=rusty-8n+1lvoiyb80n/f98k4iww@public.gmane.org \
--cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
--cc=dor.laor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.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