From: Don Dutile <ddutile@redhat.com>
To: Sathya Perla <Sathya.Perla@Emulex.Com>,
Alex Williamson <alex.williamson@redhat.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"ariel.elior@qlogic.com" <ariel.elior@qlogic.com>,
"linux.nics@intel.com" <linux.nics@intel.com>,
"shahed.shaikh@qlogic.com" <shahed.shaikh@qlogic.com>
Subject: Re: [PATCH 0/4] move pci_assivned_vfs() check (while disabling VFs) to pci sub-system
Date: Thu, 13 Nov 2014 16:36:06 -0500 [thread overview]
Message-ID: <54652446.3070407@redhat.com> (raw)
In-Reply-To: <CF9D1877D81D214CB0CA0669EFAE020C68CD95E1@CMEXMB1.ad.emulex.com>
On 11/13/2014 02:04 AM, Sathya Perla wrote:
>> -----Original Message-----
>> From: Alex Williamson [mailto:alex.williamson@redhat.com]
>>
>> On Tue, 2014-11-11 at 14:09 -0500, Don Dutile wrote:
>>> On 11/10/2014 06:53 AM, Sathya Perla wrote:
>>>> A user must not be allowed to disable VFs while they are already assigned
>> to
>>>> a guest. This check is being made in each individual driver that
>> implements
>>>> the sriov_configure PCI method.
>>>> This patch-set fixes this code duplication by moving this check from
>>>> drivers to the sriov_nuvfs_store() routine just before invoking
>>>> sriov_configure() when num_vfs is equal to 0.
>>>>
>>>> Vasundhara Volam (4):
>>>> pci: move pci_assivned_vfs() check while disabling VFs to pci
>>>> sub-system
>>>> bnx2x: remove pci_assigned_vfs() check while disabling VFs
>>>> i40e: remove pci_assigned_vfs() check while disabling VFs
>>>> qlcnic: remove pci_assigned_vfs() check while disabling VFs
>>>>
>>>> drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 2 +-
>>>> drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 7 +------
>>>> .../net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | 10 ----------
>>>> drivers/pci/pci-sysfs.c | 5 +++++
>>>> 4 files changed, 7 insertions(+), 17 deletions(-)
>>>>
>>> I have had a side conversation with Alex Williamson, VFIO author.
>>>
>>> VFIO is the upstream method that device-assignment is managed/handled
>> on kvm now.
>>> It does not set the PCI_DEV_FLAGS_ASSIGNED pci dev-flags, and thus,
>>> this check will not work when VFIO is used.
>>>
>>> This patch set will only work for the former, kvm-managed, device-
>> assignment method,
>>> which is currently being deprecated in qemu as well.
>>>
>>> So, yes, it works for kvm managed device-assignment, but not the
>>> newer, VFIO-based device-assignment.
>>>
>>> Note, also, that the pci_assigned_vfs() check in the drivers will
>>> always return 0 when VFIO is used for device assignment, so keeping
>>> these checks in the drivers doesn't do what they imply either.
>>>
>>> So, taking in the patch solves old, kvm-managed, device assignment,
>>> but a new method is needed when VFIO is involved.
>>>
>>> - Don
>>>
>>> ps -- Note: just adding the flag setting in vfio-pci does not necessarily
>>> solve this problem. VFIO does not know if a device is assigned to a
>> guest;
>>> it only knows a caller of the ioctl requesting the device to be assigned
>>> to vfio, and to be dma-mapped for a region of memory, has been
>> requested.
>>> So, a new PF<->VF mechanism needs to be put in place to
>>> determine the equivalent information.
>>
>> pps -- Note: testing pci_assivned_vfs() is racy, nothing prevents the flag
>> being added to a device between your check and removing the VF
>> device.
>> This is one of the reasons that vfio-pci doesn't use it and that this
>> interface should be discouraged in the kernel.
>
> Alex/Don, I agree with the points you've raised.
> But, I'd like to know whether you think this patch-set should be accepted or not.
> Even though this patch-set doesn't fix any of the pending issues raised here,
> it's a small step forward as it reduces the number of invocations of pci_assigned_vfs()
> check which is a good thing.
>
> thanks,
> -Sathya
>
IMO, it's only a fix for XEN. Upstream has moved on to VFIO-based device assignment,
and these patches do not fix the issue. They don't make it any worse, either,
but I don't want someone scanning the patch list thinking it's been fixed either.
So, it's ok (but racy, as it is today) for kvm-managed device-assignment & Xen
pci passthrough, but does zip for VFIO-based assignment.
We need a new api - maybe another/new state in sysfs, so userspace can set it
(like qemu &/or libvirt), as well as (xen) kernel ... and meeting non-racy condition(s).
next prev parent reply other threads:[~2014-11-13 21:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-10 11:53 [PATCH 0/4] move pci_assivned_vfs() check (while disabling VFs) to pci sub-system Sathya Perla
2014-11-10 11:53 ` [PATCH 1/4] pci: move pci_assivned_vfs() check while disabling VFs " Sathya Perla
2014-11-10 11:53 ` [PATCH 2/4] bnx2x: remove pci_assigned_vfs() check while disabling VFs Sathya Perla
2014-11-10 11:53 ` [PATCH 3/4] i40e: " Sathya Perla
2014-11-11 13:52 ` Jeff Kirsher
2014-11-10 11:53 ` [PATCH 4/4] qlcnic: " Sathya Perla
2014-11-11 19:09 ` [PATCH 0/4] move pci_assivned_vfs() check (while disabling VFs) to pci sub-system Don Dutile
2014-11-11 20:39 ` Alex Williamson
2014-11-13 7:04 ` Sathya Perla
2014-11-13 21:36 ` Don Dutile [this message]
2014-11-20 22:21 ` Bjorn Helgaas
2014-11-20 22:42 ` [linux-nics] " Jeff Kirsher
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=54652446.3070407@redhat.com \
--to=ddutile@redhat.com \
--cc=Sathya.Perla@Emulex.Com \
--cc=alex.williamson@redhat.com \
--cc=ariel.elior@qlogic.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux.nics@intel.com \
--cc=netdev@vger.kernel.org \
--cc=shahed.shaikh@qlogic.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).