From: Roman Kagan <rkagan@virtuozzo.com>
To: qemu-devel@nongnu.org
Cc: Roman Kagan <rkagan@virtuozzo.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Ladi Prosek <lprosek@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] virtio: add virtqueue_rewind
Date: Thu, 1 Sep 2016 21:13:59 +0300 [thread overview]
Message-ID: <1472753640-18375-2-git-send-email-rkagan@virtuozzo.com> (raw)
In-Reply-To: <1472753640-18375-1-git-send-email-rkagan@virtuozzo.com>
If the in-use elements aren't migrated (like is the case with
virtio-balloon stats vq), make virtqueue forget about them and pretend
they haven't been popped yet, to allow to start over on load.
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Ladi Prosek <lprosek@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/virtio/virtio.c | 6 ++++++
include/hw/virtio/virtio.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 74c085c..844d2a1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -272,6 +272,12 @@ void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
virtqueue_unmap_sg(vq, elem, len);
}
+void virtqueue_rewind(VirtQueue *vq)
+{
+ vq->last_avail_idx -= vq->inuse;
+ vq->inuse = 0;
+}
+
void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
unsigned int len, unsigned int idx)
{
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index d2490c1..9f49fa4 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -154,6 +154,7 @@ void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
void virtqueue_flush(VirtQueue *vq, unsigned int count);
void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
unsigned int len);
+void virtqueue_rewind(VirtQueue *vq);
void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
unsigned int len, unsigned int idx);
--
2.7.4
next prev parent reply other threads:[~2016-09-01 18:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-01 18:13 [Qemu-devel] [PATCH 0/2] virtio-balloon: resume collecting stats on vmload Roman Kagan
2016-09-01 18:13 ` Roman Kagan [this message]
2016-09-01 18:14 ` [Qemu-devel] [PATCH 2/2] " Roman Kagan
2016-09-01 19:26 ` Michael S. Tsirkin
2016-09-02 7:21 ` Roman Kagan
2016-09-02 22:53 ` Michael S. Tsirkin
2016-09-05 8:02 ` Roman Kagan
2016-09-06 1:45 ` Michael S. Tsirkin
2016-09-06 6:50 ` Roman Kagan
2016-09-06 10:15 ` 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=1472753640-18375-2-git-send-email-rkagan@virtuozzo.com \
--to=rkagan@virtuozzo.com \
--cc=lprosek@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).