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] [day] [month] [year] [list]
Message-ID: <CACGkMEsWkyMOUmnFks9C73BMZB3i86Kg0ig745N3OjJs35PAuw@mail.gmail.com>
Date:   Wed, 7 Jun 2023 10:11:04 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Angus Chen <angus.chen@...uarmicro.com>
Cc:     "mst@...hat.com" <mst@...hat.com>,
        "virtualization@...ts.linux-foundation.org" 
        <virtualization@...ts.linux-foundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vp_vdpa: Check queue number of vdpa device from add_config

On Tue, Jun 6, 2023 at 2:19 PM Angus Chen <angus.chen@...uarmicro.com> wrote:
>
> Hi,Jason.
>
> > -----Original Message-----
> > From: Jason Wang <jasowang@...hat.com>
> > Sent: Monday, June 5, 2023 2:54 PM
> > To: Angus Chen <angus.chen@...uarmicro.com>
> > Cc: mst@...hat.com; virtualization@...ts.linux-foundation.org;
> > linux-kernel@...r.kernel.org
> > Subject: Re: [PATCH] vp_vdpa: Check queue number of vdpa device from
> > add_config
> >
> > On Fri, Jun 2, 2023 at 3:35 PM Angus Chen <angus.chen@...uarmicro.com>
> > wrote:
> > >
> > > When add virtio_pci vdpa device,check the vqs number of device cap
> > > and max_vq_pairs from add_config.
> > >
> > > Signed-off-by: Angus Chen <angus.chen@...uarmicro.com>
> > > ---
> > >  drivers/vdpa/virtio_pci/vp_vdpa.c | 11 +++++++++--
> > >  1 file changed, 9 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c
> > b/drivers/vdpa/virtio_pci/vp_vdpa.c
> > > index 281287fae89f..4bf1ab637d32 100644
> > > --- a/drivers/vdpa/virtio_pci/vp_vdpa.c
> > > +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c
> > > @@ -478,7 +478,7 @@ static int vp_vdpa_dev_add(struct vdpa_mgmt_dev
> > *v_mdev, const char *name,
> > >         struct device *dev = &pdev->dev;
> > >         struct vp_vdpa *vp_vdpa = NULL;
> > >         u64 device_features;
> > > -       int ret, i;
> > > +       int ret, i, queues;
> > >
> > >         vp_vdpa = vdpa_alloc_device(struct vp_vdpa, vdpa,
> > >                                     dev, &vp_vdpa_ops, 1, 1, name,
> > false);
> > > @@ -491,7 +491,14 @@ static int vp_vdpa_dev_add(struct vdpa_mgmt_dev
> > *v_mdev, const char *name,
> > >         vp_vdpa_mgtdev->vp_vdpa = vp_vdpa;
> > >
> > >         vp_vdpa->vdpa.dma_dev = &pdev->dev;
> > > -       vp_vdpa->queues = vp_modern_get_num_queues(mdev);
> > > +       queues = vp_modern_get_num_queues(mdev);
> > > +       if (add_config->mask &
> > BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MAX_VQP)) {
> > > +               if (add_config->net.max_vq_pairs > queues / 2)
> > > +                       return -EINVAL;
> > > +               queues = min_t(u32, queues, 2 *
> > add_config->net.max_vq_pairs);
> >
> > Looks like you want to mediate the max_vqp here, but what happens:
> >
> > 1) harware have 4 queue paris
> > 2) vp_vdpa cap it into 2 queue pairs
> > 3) guest may still try to enable 4 queue paris
> >
> Yes,you are right,this situation can occur.
> > For 3), the kernel needs to mediate the control virtqueue which seems not
> > easy.
> >
> > How about simply starting from failing if the provisioned #qp is not
> > equal to the one that hardware has?
> Ok,You mean we just check it in vp_vdpa or check it in all other vdpa net drivers?

vp_vdpa only, since in some other kind of parents, #qps could be provisioned.

Thanks

> >
> > Thanks
> >
> > > +       }
> > > +
> > > +       vp_vdpa->queues = queues;
> > >         vp_vdpa->mdev = mdev;
> > >
> > >         device_features = vp_modern_get_features(mdev);
> > > --
> > > 2.25.1
> > >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ