lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc3241cab90dedf48fc2f518004e1971234d97d0.camel@nvidia.com>
Date: Wed, 19 Jun 2024 17:06:13 +0000
From: Dragos Tatulea <dtatulea@...dia.com>
To: "eperezma@...hat.com" <eperezma@...hat.com>
CC: "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
	"xuanzhuo@...ux.alibaba.com" <xuanzhuo@...ux.alibaba.com>,
	"virtualization@...ts.linux.dev" <virtualization@...ts.linux.dev>, Tariq
 Toukan <tariqt@...dia.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, Cosmin Ratiu <cratiu@...dia.com>,
	"si-wei.liu@...cle.com" <si-wei.liu@...cle.com>, "jasowang@...hat.com"
	<jasowang@...hat.com>, "mst@...hat.com" <mst@...hat.com>, Saeed Mahameed
	<saeedm@...dia.com>, "leon@...nel.org" <leon@...nel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH vhost 11/23] vdpa/mlx5: Set an initial size on the VQ

On Wed, 2024-06-19 at 17:08 +0200, Eugenio Perez Martin wrote:
> On Mon, Jun 17, 2024 at 5:09 PM Dragos Tatulea <dtatulea@...dia.com> wrote:
> > 
> > The virtqueue size is a pre-requisite for setting up any virtqueue
> > resources. For the upcoming optimization of creating virtqueues at
> > device add, the virtqueue size has to be configured.
> > 
> > Store the default queue size in struct mlx5_vdpa_net to make it easy in
> > the future to pre-configure this default value via vdpa tool.
> > 
> > The queue size check in setup_vq() will always be false. So remove it.
> > 
> > Signed-off-by: Dragos Tatulea <dtatulea@...dia.com>
> > Reviewed-by: Cosmin Ratiu <cratiu@...dia.com>
> > ---
> >  drivers/vdpa/mlx5/net/mlx5_vnet.c | 7 ++++---
> >  drivers/vdpa/mlx5/net/mlx5_vnet.h | 1 +
> >  2 files changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > index 245b5dac98d3..1181e0ac3671 100644
> > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > @@ -58,6 +58,8 @@ MODULE_LICENSE("Dual BSD/GPL");
> >   */
> >  #define MLX5V_DEFAULT_VQ_COUNT 2
> > 
> > +#define MLX5V_DEFAULT_VQ_SIZE 256
> > +
> >  struct mlx5_vdpa_cq_buf {
> >         struct mlx5_frag_buf_ctrl fbc;
> >         struct mlx5_frag_buf frag_buf;
> > @@ -1445,9 +1447,6 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq)
> >         u16 idx = mvq->index;
> >         int err;
> > 
> > -       if (!mvq->num_ent)
> > -               return 0;
> > -
> >         if (mvq->initialized)
> >                 return 0;
> > 
> > @@ -3523,6 +3522,7 @@ static void init_mvqs(struct mlx5_vdpa_net *ndev)
> >                 mvq->ndev = ndev;
> >                 mvq->fwqp.fw = true;
> >                 mvq->fw_state = MLX5_VIRTIO_NET_Q_OBJECT_NONE;
> > +               mvq->num_ent = ndev->default_queue_size;
> >         }
> >  }
> > 
> > @@ -3660,6 +3660,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
> >                 goto err_alloc;
> >         }
> >         ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT;
> > +       ndev->default_queue_size = MLX5V_DEFAULT_VQ_SIZE;
> > 
> >         init_mvqs(ndev);
> >         allocate_irqs(ndev);
> > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.h b/drivers/vdpa/mlx5/net/mlx5_vnet.h
> > index 90b556a57971..2ada29767cc5 100644
> > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.h
> > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.h
> > @@ -58,6 +58,7 @@ struct mlx5_vdpa_net {
> >         bool setup;
> >         u32 cur_num_vqs;
> >         u32 rqt_size;
> > +       u16 default_queue_size;
> 
> It seems to me this is only assigned here and not used in the rest of
> the series, why allocate a member here instead of using macro
> directly?
It is used in init_mvqs(). I wanted to make it easy in case we add the default
queue size to the mvq tool. I'm also ok with switching to constants for now.

Thank you for your reviews!

Thanks,
Dragos
> 
> >         bool nb_registered;
> >         struct notifier_block nb;
> >         struct vdpa_callback config_cb;
> > 
> > --
> > 2.45.1
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ