[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/18] virtio-blk: use bitmap_foreach
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 10/18] virtio-blk: use bitmap_foreach |
Date: |
Mon, 5 Sep 2016 02:20:31 +0400 |
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/block/dataplane/virtio-blk.c | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 704a763..dce2675 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -51,30 +51,23 @@ void virtio_blk_data_plane_notify(VirtIOBlockDataPlane *s,
VirtQueue *vq)
qemu_bh_schedule(s->bh);
}
-static void notify_guest_bh(void *opaque)
+static void notify_vq(int i, void *opaque)
{
VirtIOBlockDataPlane *s = opaque;
- unsigned nvqs = s->conf->num_queues;
- unsigned long bitmap[BITS_TO_LONGS(nvqs)];
- unsigned j;
-
- memcpy(bitmap, s->batch_notify_vqs, sizeof(bitmap));
- memset(s->batch_notify_vqs, 0, sizeof(bitmap));
+ VirtQueue *vq = virtio_get_queue(s->vdev, i);
- for (j = 0; j < nvqs; j += BITS_PER_LONG) {
- unsigned long bits = bitmap[j];
+ if (virtio_should_notify(s->vdev, vq)) {
+ event_notifier_set(virtio_queue_get_guest_notifier(vq));
+ }
- while (bits != 0) {
- unsigned i = j + ctzl(bits);
- VirtQueue *vq = virtio_get_queue(s->vdev, i);
+}
- if (virtio_should_notify(s->vdev, vq)) {
- event_notifier_set(virtio_queue_get_guest_notifier(vq));
- }
+static void notify_guest_bh(void *opaque)
+{
+ VirtIOBlockDataPlane *s = opaque;
+ unsigned nvqs = s->conf->num_queues;
- bits &= bits - 1; /* clear right-most bit */
- }
- }
+ bitmap_foreach(s->batch_notify_vqs, nvqs, notify_vq, s);
}
/* Context: QEMU global mutex held */
--
2.9.0
- [Qemu-devel] [PATCH 02/18] console: add dpy_gl_ctx_is_mt_safe, (continued)
- [Qemu-devel] [PATCH 02/18] console: add dpy_gl_ctx_is_mt_safe, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 04/18] virtio-gpu: start splitting scanout/resource flushing, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 01/18] console: skip same-size resize, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 03/18] virtio-gpu: add "iothread" property, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 05/18] virtio-gpu: start introducing a lock around the display info, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 06/18] virtio-gpu: create a thread context, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 08/18] gl: bind GL api before context creation, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 07/18] gl: allow to keep current context in ctx-create, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 09/18] bitmap: add a simple foreach util, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 11/18] virtio-gpu: use a bh for cursor modifications, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 10/18] virtio-blk: use bitmap_foreach,
Marc-André Lureau <=
- [Qemu-devel] [PATCH 12/18] virtio-gpu: save a pointer from virtio_gpu_ctrl_command, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 14/18] virtio-gpu: batch virtio_notify when using a data-plane, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 13/18] virtio-gpu: add a virgl data-plane, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 16/18] virtio-gpu: use virgl thread sync with the data-plane, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 15/18] virtio-gpu: dispatch to main thread for scanout & flush, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 17/18] virtio-gpu: schedule a bh to unblock the data-plane, Marc-André Lureau, 2016/09/04
- [Qemu-devel] [PATCH 18/18] virtio-gpu: start/stop the data-plane, Marc-André Lureau, 2016/09/04
- Re: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread, no-reply, 2016/09/04
- Re: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread, no-reply, 2016/09/04
- Re: [Qemu-devel] [PATCH 00/18] virgl: use a seperate rendering thread, Gerd Hoffmann, 2016/09/08