From: Tiwei Bie <tiwei.bie@intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, stefanha@redhat.com
Cc: bhelgaas@google.com, virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, virtio-dev@lists.oasis-open.org,
linux-pci@vger.kernel.org, dan.daly@intel.com,
mark.d.rustad@intel.com, alexander.h.duyck@intel.com,
cunming.liang@intel.com, zhihong.wang@intel.com
Subject: Re: [PATCH v2] virtio_pci: support enabling VFs
Date: Fri, 1 Jun 2018 12:00:07 +0800 [thread overview]
Message-ID: <20180601040007.GA32070@debian> (raw)
In-Reply-To: <20180601063224-mutt-send-email-mst@kernel.org>
On Fri, Jun 01, 2018 at 06:47:01AM +0300, Michael S. Tsirkin wrote:
> On Fri, Jun 01, 2018 at 10:09:21AM +0800, Tiwei Bie wrote:
> > There is a new feature bit allocated in virtio spec to
> > support SR-IOV (Single Root I/O Virtualization):
> >
> > https://github.com/oasis-tcs/virtio-spec/issues/11
> >
> > This patch enables the support for this feature bit in
> > virtio driver.
> >
> > Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> > Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
> > Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
>
> Generally you aren't supposed to carry forward acks
> when you make major changes.
Got it! Thank you very much!
>
> In this case I'm fine with the patch, so never mind.
Thank you so much! Anyway, it's my fault.
I'll send a new version dropping all acks.
>
[...]
> >
> > +static int virtio_pci_sriov_configure(struct pci_dev *pci_dev, int num_vfs)
> > +{
> > + struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
> > + struct virtio_device *vdev = &vp_dev->vdev;
> > + int ret;
> > +
> > + if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
> > + return -EBUSY;
> > +
> > + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> > + return -EINVAL;
> > +
> > + if (pci_vfs_assigned(pci_dev))
> > + return -EPERM;
>
> Not a comment on this patch - existing code has the
> same race - but generally
>
> 1. this seems racy since assigning vfs does not seem
> to take device lock
> 2. does this work correctly for kvm at all?
> pci_set_dev_assigned seems to be only called by xen.
>
> Can you look at addressing this pls?
Sure! I'll do it!
Best regards,
Tiwei Bie
WARNING: multiple messages have this Message-ID (diff)
From: Tiwei Bie <tiwei.bie@intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, stefanha@redhat.com
Cc: bhelgaas@google.com, virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, virtio-dev@lists.oasis-open.org,
linux-pci@vger.kernel.org, dan.daly@intel.com,
mark.d.rustad@intel.com, alexander.h.duyck@intel.com,
cunming.liang@intel.com, zhihong.wang@intel.com
Subject: [virtio-dev] Re: [PATCH v2] virtio_pci: support enabling VFs
Date: Fri, 1 Jun 2018 12:00:07 +0800 [thread overview]
Message-ID: <20180601040007.GA32070@debian> (raw)
In-Reply-To: <20180601063224-mutt-send-email-mst@kernel.org>
On Fri, Jun 01, 2018 at 06:47:01AM +0300, Michael S. Tsirkin wrote:
> On Fri, Jun 01, 2018 at 10:09:21AM +0800, Tiwei Bie wrote:
> > There is a new feature bit allocated in virtio spec to
> > support SR-IOV (Single Root I/O Virtualization):
> >
> > https://github.com/oasis-tcs/virtio-spec/issues/11
> >
> > This patch enables the support for this feature bit in
> > virtio driver.
> >
> > Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> > Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
> > Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
>
> Generally you aren't supposed to carry forward acks
> when you make major changes.
Got it! Thank you very much!
>
> In this case I'm fine with the patch, so never mind.
Thank you so much! Anyway, it's my fault.
I'll send a new version dropping all acks.
>
[...]
> >
> > +static int virtio_pci_sriov_configure(struct pci_dev *pci_dev, int num_vfs)
> > +{
> > + struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
> > + struct virtio_device *vdev = &vp_dev->vdev;
> > + int ret;
> > +
> > + if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
> > + return -EBUSY;
> > +
> > + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> > + return -EINVAL;
> > +
> > + if (pci_vfs_assigned(pci_dev))
> > + return -EPERM;
>
> Not a comment on this patch - existing code has the
> same race - but generally
>
> 1. this seems racy since assigning vfs does not seem
> to take device lock
> 2. does this work correctly for kvm at all?
> pci_set_dev_assigned seems to be only called by xen.
>
> Can you look at addressing this pls?
Sure! I'll do it!
Best regards,
Tiwei Bie
---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
next prev parent reply other threads:[~2018-06-01 3:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-01 2:09 [PATCH v2] virtio_pci: support enabling VFs Tiwei Bie
2018-06-01 2:09 ` [virtio-dev] " Tiwei Bie
2018-06-01 3:02 ` Tiwei Bie
2018-06-01 3:02 ` Tiwei Bie
2018-06-01 3:02 ` [virtio-dev] " Tiwei Bie
2018-06-01 3:47 ` Michael S. Tsirkin
2018-06-01 3:47 ` [virtio-dev] " Michael S. Tsirkin
2018-06-01 4:00 ` Tiwei Bie
2018-06-01 4:00 ` Tiwei Bie [this message]
2018-06-01 4:00 ` [virtio-dev] " Tiwei Bie
2018-06-01 3:47 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2018-06-01 2:09 Tiwei Bie
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=20180601040007.GA32070@debian \
--to=tiwei.bie@intel.com \
--cc=alexander.h.duyck@intel.com \
--cc=bhelgaas@google.com \
--cc=cunming.liang@intel.com \
--cc=dan.daly@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mark.d.rustad@intel.com \
--cc=mst@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=zhihong.wang@intel.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 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.