All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To: virtualization@lists.linux-foundation.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Subject: [PATCH v8 05/16] virtio_ring: extract the logic of freeing vring
Date: Mon, 14 Mar 2022 17:34:44 +0800	[thread overview]
Message-ID: <20220314093455.34707-6-xuanzhuo@linux.alibaba.com> (raw)
In-Reply-To: <20220314093455.34707-1-xuanzhuo@linux.alibaba.com>

Introduce __vring_free() to free the vring of vq.

Subsequent patches will use __vring_free() alone.

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
 drivers/virtio/virtio_ring.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index cb6010750a94..763532a2ffe4 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -2301,14 +2301,10 @@ struct virtqueue *vring_new_virtqueue(unsigned int index,
 }
 EXPORT_SYMBOL_GPL(vring_new_virtqueue);
 
-void vring_del_virtqueue(struct virtqueue *_vq)
+static void __vring_free(struct virtqueue *_vq)
 {
 	struct vring_virtqueue *vq = to_vvq(_vq);
 
-	spin_lock(&vq->vq.vdev->vqs_list_lock);
-	list_del(&_vq->list);
-	spin_unlock(&vq->vq.vdev->vqs_list_lock);
-
 	if (vq->we_own_ring) {
 		if (vq->packed_ring) {
 			vring_free_queue(vq->vq.vdev,
@@ -2339,6 +2335,18 @@ void vring_del_virtqueue(struct virtqueue *_vq)
 		kfree(vq->split.desc_state);
 		kfree(vq->split.desc_extra);
 	}
+}
+
+void vring_del_virtqueue(struct virtqueue *_vq)
+{
+	struct vring_virtqueue *vq = to_vvq(_vq);
+
+	spin_lock(&vq->vq.vdev->vqs_list_lock);
+	list_del(&_vq->list);
+	spin_unlock(&vq->vq.vdev->vqs_list_lock);
+
+	__vring_free(_vq);
+
 	kfree(vq);
 }
 EXPORT_SYMBOL_GPL(vring_del_virtqueue);
-- 
2.31.0

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2022-03-14  9:35 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14  9:34 [PATCH v8 00/16] virtio pci support VIRTIO_F_RING_RESET (refactor vring) Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 01/16] virtio: add helper virtqueue_get_vring_max_size() Xuan Zhuo
2022-03-14  9:50   ` Cornelia Huck
2022-03-14 11:18     ` Michael S. Tsirkin
2022-03-14 11:21       ` Xuan Zhuo
2022-03-22  6:24         ` Michael S. Tsirkin
2022-03-14  9:34 ` [PATCH v8 02/16] virtio: struct virtio_config_ops add callbacks for queue_reset Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 03/16] virtio_ring: update the document of the virtqueue_detach_unused_buf for queue reset Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 04/16] virtio_ring: remove the arg vq of vring_alloc_desc_extra() Xuan Zhuo
2022-03-22  5:49   ` Jason Wang
2022-03-14  9:34 ` Xuan Zhuo [this message]
2022-03-14  9:34 ` [PATCH v8 06/16] virtio_ring: split: extract the logic of alloc queue Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 07/16] virtio_ring: split: extract the logic of alloc state and extra Xuan Zhuo
2022-03-22  6:33   ` Jason Wang
2022-03-24  8:28     ` Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 08/16] virtio_ring: split: extract the logic of attach vring Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 09/16] virtio_ring: split: extract the logic of vq init Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 10/16] virtio_ring: split: implement virtqueue_resize_split() Xuan Zhuo
2022-03-22  6:30   ` Jason Wang
2022-03-24  8:44     ` Xuan Zhuo
2022-03-30  3:48       ` Jason Wang
2022-03-30  6:13         ` Xuan Zhuo
2022-03-30  6:57           ` Jason Wang
2022-03-14  9:34 ` [PATCH v8 11/16] virtio_ring: packed: extract the logic of alloc queue Xuan Zhuo
2022-03-22  6:38   ` Jason Wang
2022-03-24  8:28     ` Xuan Zhuo
2022-03-30  3:50       ` Jason Wang
2022-03-30  6:07         ` Xuan Zhuo
2022-03-30  6:58           ` Jason Wang
2022-03-14  9:34 ` [PATCH v8 12/16] virtio_ring: packed: extract the logic of alloc state and extra Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 13/16] virtio_ring: packed: extract the logic of attach vring Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 14/16] virtio_ring: packed: extract the logic of vq init Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 15/16] virtio_ring: packed: implement virtqueue_resize_packed() Xuan Zhuo
2022-03-14  9:34 ` [PATCH v8 16/16] virtio_ring: introduce virtqueue_resize() Xuan Zhuo
2022-03-22  6:02   ` Jason Wang
2022-03-24  8:34     ` Xuan Zhuo
2022-03-24 10:41       ` Michael S. Tsirkin
2022-03-25  7:37         ` Jason Wang
2022-03-25 10:33   ` Michael S. Tsirkin
2022-03-25 22:31     ` Xuan Zhuo
2022-03-22  6:40 ` [PATCH v8 00/16] virtio pci support VIRTIO_F_RING_RESET (refactor vring) Jason Wang
2022-03-24  8:52   ` Xuan Zhuo

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=20220314093455.34707-6-xuanzhuo@linux.alibaba.com \
    --to=xuanzhuo@linux.alibaba.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.