virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: virtualization@lists.linux.dev
Cc: mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
	eperezma@redhat.com, parav@nvidia.com, feliu@nvidia.com
Subject: [PATCH virtio 2/8] virtio_pci_modern: treat vp_dev->admin_vq.info.vq pointer as static
Date: Mon, 24 Jun 2024 11:04:45 +0200	[thread overview]
Message-ID: <20240624090451.2683976-3-jiri@resnulli.us> (raw)
In-Reply-To: <20240624090451.2683976-1-jiri@resnulli.us>

From: Jiri Pirko <jiri@nvidia.com>

It is guaranteed by the virtio_pci and PCI layers that none of the VFs
is probed before setup_vq() is called for admin queue and after del_vq()
is called for admin queue. Therefore treat vp_dev->admin_vq.info.vq as
static, don't null it and don't take cmd lock during assign.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
 drivers/virtio/virtio_pci_common.h |  2 +-
 drivers/virtio/virtio_pci_modern.c | 11 +----------
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/virtio/virtio_pci_common.h b/drivers/virtio/virtio_pci_common.h
index 7fef52bee455..148d1ab01a69 100644
--- a/drivers/virtio/virtio_pci_common.h
+++ b/drivers/virtio/virtio_pci_common.h
@@ -45,7 +45,7 @@ struct virtio_pci_vq_info {
 struct virtio_pci_admin_vq {
 	/* Virtqueue info associated with this admin queue. */
 	struct virtio_pci_vq_info info;
-	/* serializing admin commands execution and virtqueue deletion */
+	/* serializing admin commands execution. */
 	struct mutex cmd_lock;
 	u64 supported_cmds;
 	/* Name of the admin queue: avq.$vq_index. */
diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
index f62b530aa3b5..925166498e2e 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -580,11 +580,8 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
 		goto err;
 	}
 
-	if (is_avq) {
-		mutex_lock(&vp_dev->admin_vq.cmd_lock);
+	if (is_avq)
 		vp_dev->admin_vq.info.vq = vq;
-		mutex_unlock(&vp_dev->admin_vq.cmd_lock);
-	}
 
 	return vq;
 
@@ -621,12 +618,6 @@ static void del_vq(struct virtio_pci_vq_info *info)
 	struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
 	struct virtio_pci_modern_device *mdev = &vp_dev->mdev;
 
-	if (vp_is_avq(&vp_dev->vdev, vq->index)) {
-		mutex_lock(&vp_dev->admin_vq.cmd_lock);
-		vp_dev->admin_vq.info.vq = NULL;
-		mutex_unlock(&vp_dev->admin_vq.cmd_lock);
-	}
-
 	if (vp_dev->msix_enabled)
 		vp_modern_queue_vector(mdev, vq->index,
 				       VIRTIO_MSI_NO_VECTOR);
-- 
2.45.1


  parent reply	other threads:[~2024-06-24  9:05 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24  9:04 [PATCH virtio 0/8] virtio_pci_modern: allow parallel admin queue commands execution Jiri Pirko
2024-06-24  9:04 ` [PATCH virtio 1/8] virtio_pci: push out single vq find code to vp_find_one_vq_msix() Jiri Pirko
2024-06-24 10:52   ` Heng Qi
2024-06-24 13:11     ` Jiri Pirko
2024-06-24  9:04 ` Jiri Pirko [this message]
2024-06-24  9:04 ` [PATCH virtio 3/8] virtio: push out code to vp_avq_index() Jiri Pirko
2024-06-24  9:04 ` [PATCH virtio 4/8] virtio: create admin queues alongside other virtqueues Jiri Pirko
2024-06-24  9:04 ` [PATCH virtio 5/8] virtio_pci_modern: create admin queue of queried size Jiri Pirko
2024-06-24  9:04 ` [PATCH virtio 6/8] virtio_pci_modern: pass cmd as an identification token Jiri Pirko
2024-06-24  9:04 ` [PATCH virtio 7/8] virtio_pci_modern: use completion instead of busy loop to wait on admin cmd result Jiri Pirko
2024-06-24 11:30   ` Michael S. Tsirkin
2024-06-24 13:10     ` Jiri Pirko
2024-06-25 11:07     ` Jiri Pirko
2024-06-25 12:53       ` Parav Pandit
2024-06-25 14:29         ` Jiri Pirko
2024-06-24 11:34   ` Michael S. Tsirkin
2024-06-24 13:10     ` Jiri Pirko
2024-06-24  9:04 ` [PATCH virtio 8/8] virtio_pci_modern: remove admin queue serialization lock Jiri Pirko
2024-06-24  9:53 ` [PATCH virtio 0/8] virtio_pci_modern: allow parallel admin queue commands execution Heng Qi
2024-06-24 11:23   ` Michael S. Tsirkin
2024-06-24 13:46     ` Jiri Pirko
2024-06-24 13:55       ` Michael S. Tsirkin
2024-06-24 14:51         ` Jiri Pirko
2024-06-24 15:16           ` Michael S. Tsirkin
2024-06-25  2:11             ` Heng Qi
2024-06-25  6:38               ` Jiri Pirko
2024-06-25  6:41                 ` Parav Pandit
2024-06-25  7:29                   ` Michael S. Tsirkin
2024-06-25  8:01                     ` Jiri Pirko
2024-06-25  7:20               ` Michael S. Tsirkin
2024-06-25  7:25                 ` Parav Pandit
2024-06-24 15:10     ` Jiri Pirko
2024-06-24 15:23       ` Michael S. Tsirkin
2024-06-24 15:45         ` Jiri Pirko
2024-06-24 11:07 ` Michael S. Tsirkin
2024-06-24 13:09   ` Jiri Pirko
2024-06-24 13:16     ` Michael S. Tsirkin
2024-06-24 13:36       ` Jiri Pirko

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=20240624090451.2683976-3-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=eperezma@redhat.com \
    --cc=feliu@nvidia.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=parav@nvidia.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.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).