[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251226143433-mutt-send-email-mst@kernel.org>
Date: Fri, 26 Dec 2025 14:37:07 -0500
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Jason Wang <jasowang@...hat.com>
Cc: xuanzhuo@...ux.alibaba.com, eperezma@...hat.com,
virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V11 13/19] virtio_ring: introduce virtqueue ops
On Thu, Dec 25, 2025 at 12:26:02PM +0800, Jason Wang wrote:
> This patch introduces virtqueue ops which is a set of callbacks
> that will be called for different queue layout or features. This would
> help to avoid branches for split/packed and will ease the future
> implementation like in order.
>
> Note that in order to eliminate the indirect calls this patch uses
> global array of const ops to allow compiler to avoid indirect
> branches.
>
> Tested with CONFIG_MITIGATION_RETPOLINE, no performance differences
> were noticed.
>
> Acked-by: Eugenio Pérez <eperezma@...hat.com>
> Suggested-by: Michael S. Tsirkin <mst@...hat.com>
> Signed-off-by: Jason Wang <jasowang@...hat.com>
> ---
> drivers/virtio/virtio_ring.c | 173 ++++++++++++++++++++++++++---------
> 1 file changed, 130 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index f804c5c6975a..4e905dc7b6cb 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -67,6 +67,12 @@
> #define LAST_ADD_TIME_INVALID(vq)
> #endif
>
> +enum vq_layout {
> + SPLIT = 0,
> + PACKED,
> + VQ_TYPE_MAX,
> +};
> +
VQ_LAYOUT_SPLIT and VQ_LAYOUT_PACKED would be better.
and VQ_LAYOUT_MAX for consistency.
> struct vring_desc_state_split {
> void *data; /* Data for callback. */
>
> @@ -159,12 +165,29 @@ struct vring_virtqueue_packed {
Powered by blists - more mailing lists