All of lore.kernel.org
 help / color / mirror / Atom feed
* How to get the number of VFs assigned to the guests in XEN
@ 2014-08-20 11:09 Sreekanth Reddy
  2014-08-20 12:46 ` Alex Williamson
  0 siblings, 1 reply; 6+ messages in thread
From: Sreekanth Reddy @ 2014-08-20 11:09 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, linux-pci, konrad.wilk
  Cc: Martin K. Petersen, Christoph Hellwig, boris.ostrovsky,
	Sathya Prakash, Nagalakshmi Nandigama

HI,

For SRIOV support, currently in the KVM environment, mpt3sas driver
can use the API pci_vfs_assigned() to know the number of VFs that are
currently assigned to the running VMs. So that during the PF driver
unload time, if the return value of this API is greater than zero the
our driver won't call the pci_disable_sriov() to disable the VFs.

Now for the same purpose in XEN environment, is there any API similar
to pci_vfs_assigned() which the low lever device driver can use to
know 'the number of VFs that are currently assigned to the running
VMs'. In XEN environment this API pci_vfs_assigned() will return
always zero even though VFs are assigned to the running VMs.

Regards,
Sreekanth

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get the number of VFs assigned to the guests in XEN
  2014-08-20 11:09 How to get the number of VFs assigned to the guests in XEN Sreekanth Reddy
@ 2014-08-20 12:46 ` Alex Williamson
  2014-08-20 13:44   ` Sreekanth Reddy
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Williamson @ 2014-08-20 12:46 UTC (permalink / raw)
  To: Sreekanth Reddy
  Cc: linux-scsi, linux-kernel, linux-pci, konrad.wilk,
	Martin K. Petersen, Christoph Hellwig, boris.ostrovsky,
	Sathya Prakash, Nagalakshmi Nandigama

On Wed, 2014-08-20 at 16:39 +0530, Sreekanth Reddy wrote:
> HI,
> 
> For SRIOV support, currently in the KVM environment, mpt3sas driver
> can use the API pci_vfs_assigned() to know the number of VFs that are
> currently assigned to the running VMs. So that during the PF driver
> unload time, if the return value of this API is greater than zero the
> our driver won't call the pci_disable_sriov() to disable the VFs.
> 
> Now for the same purpose in XEN environment, is there any API similar
> to pci_vfs_assigned() which the low lever device driver can use to
> know 'the number of VFs that are currently assigned to the running
> VMs'. In XEN environment this API pci_vfs_assigned() will return
> always zero even though VFs are assigned to the running VMs.

Note that pci_vfs_assigned() assigned is only used by legacy KVM device
assignment and primarily as a workaround for not using an actual
host-based device driver to manage device ownership.  When using
VFIO-based device assignment with KVM, pci_vfs_assigned() is not
updated.  Please don't rely on this interface.  Thanks,

Alex


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get the number of VFs assigned to the guests in XEN
  2014-08-20 12:46 ` Alex Williamson
@ 2014-08-20 13:44   ` Sreekanth Reddy
  2014-08-20 14:09     ` Alex Williamson
  0 siblings, 1 reply; 6+ messages in thread
From: Sreekanth Reddy @ 2014-08-20 13:44 UTC (permalink / raw)
  To: Alex Williamson
  Cc: linux-scsi, linux-kernel, linux-pci, konrad.wilk,
	Martin K. Petersen, Christoph Hellwig, boris.ostrovsky,
	Sathya Prakash, Nagalakshmi Nandigama

Thanks Alex,

Then, Is there any other ways to stop accidental unload of PF driver
while still some VFs are accessing by the running VMs.

Regards,
Sreekanth

On Wed, Aug 20, 2014 at 6:16 PM, Alex Williamson
<alex.williamson@redhat.com> wrote:
> On Wed, 2014-08-20 at 16:39 +0530, Sreekanth Reddy wrote:
>> HI,
>>
>> For SRIOV support, currently in the KVM environment, mpt3sas driver
>> can use the API pci_vfs_assigned() to know the number of VFs that are
>> currently assigned to the running VMs. So that during the PF driver
>> unload time, if the return value of this API is greater than zero the
>> our driver won't call the pci_disable_sriov() to disable the VFs.
>>
>> Now for the same purpose in XEN environment, is there any API similar
>> to pci_vfs_assigned() which the low lever device driver can use to
>> know 'the number of VFs that are currently assigned to the running
>> VMs'. In XEN environment this API pci_vfs_assigned() will return
>> always zero even though VFs are assigned to the running VMs.
>
> Note that pci_vfs_assigned() assigned is only used by legacy KVM device
> assignment and primarily as a workaround for not using an actual
> host-based device driver to manage device ownership.  When using
> VFIO-based device assignment with KVM, pci_vfs_assigned() is not
> updated.  Please don't rely on this interface.  Thanks,
>
> Alex
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get the number of VFs assigned to the guests in XEN
  2014-08-20 13:44   ` Sreekanth Reddy
@ 2014-08-20 14:09     ` Alex Williamson
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Williamson @ 2014-08-20 14:09 UTC (permalink / raw)
  To: Sreekanth Reddy
  Cc: linux-scsi, linux-kernel, linux-pci, konrad.wilk,
	Martin K. Petersen, Christoph Hellwig, boris.ostrovsky,
	Sathya Prakash, Nagalakshmi Nandigama

On Wed, 2014-08-20 at 19:14 +0530, Sreekanth Reddy wrote:
> Thanks Alex,
> 
> Then, Is there any other ways to stop accidental unload of PF driver
> while still some VFs are accessing by the running VMs.

I believe the reason pci_vfs_assigned() and the pci_dev flag that backs
it exists is because legacy KVM device assignment does not require a
host driver for the device.  At best, the assigned device is bound to
pci-stub, which is more than happy to release a device at any point in
time.  This flag was therefore added to indicate that the device was in
use, please don't make it disappear.  With VFIO, the device is bound to
vfio-pci in the host which will only release the device when it is
unused, just like any other device driver.  If the device is in use,
either assigned to a VM or otherwise in use by a userspace driver,
vfio-pci will block until unused.

There are opportunities that we have yet to implement that we could
notify the user of the removal request, triggering a hot-unplug in a
guest.  Assuming some sort of revoke() functionality gets pushed
upstream we could also make an unplug request, wait from some time, then
revoke the device from the user.  The point however is that device
assignment shouldn't be handled as a special case.  When
pci_disable_sriov() is called, the release functions for any drivers
owning an affected VF should be called where we have the opportunity to
block until unused.  Thanks,

Alex

> On Wed, Aug 20, 2014 at 6:16 PM, Alex Williamson
> <alex.williamson@redhat.com> wrote:
> > On Wed, 2014-08-20 at 16:39 +0530, Sreekanth Reddy wrote:
> >> HI,
> >>
> >> For SRIOV support, currently in the KVM environment, mpt3sas driver
> >> can use the API pci_vfs_assigned() to know the number of VFs that are
> >> currently assigned to the running VMs. So that during the PF driver
> >> unload time, if the return value of this API is greater than zero the
> >> our driver won't call the pci_disable_sriov() to disable the VFs.
> >>
> >> Now for the same purpose in XEN environment, is there any API similar
> >> to pci_vfs_assigned() which the low lever device driver can use to
> >> know 'the number of VFs that are currently assigned to the running
> >> VMs'. In XEN environment this API pci_vfs_assigned() will return
> >> always zero even though VFs are assigned to the running VMs.
> >
> > Note that pci_vfs_assigned() assigned is only used by legacy KVM device
> > assignment and primarily as a workaround for not using an actual
> > host-based device driver to manage device ownership.  When using
> > VFIO-based device assignment with KVM, pci_vfs_assigned() is not
> > updated.  Please don't rely on this interface.  Thanks,
> >
> > Alex
> >




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get the number of VFs assigned to the guests in XEN
  2014-08-20 22:29 ` Konrad Rzeszutek Wilk
@ 2014-08-21  8:20   ` Sreekanth Reddy
  0 siblings, 0 replies; 6+ messages in thread
From: Sreekanth Reddy @ 2014-08-21  8:20 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: linux-scsi, linux-kernel, linux-pci, Martin K. Petersen,
	Christoph Hellwig, Sathya Prakash, Nagalakshmi Nandigama,
	boris.ostrovsky

Yes, devices are binded to pci-back.

On Thu, Aug 21, 2014 at 3:59 AM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> On Wed, Aug 20, 2014 at 04:33:29PM +0530, Sreekanth Reddy wrote:
>> HI,
>>
>>
>>
>> For SRIOV support, currently in the KVM environment, mpt3sas driver can use
>> the API pci_vfs_assigned() to know the number of VFs that are currently
>> assigned to the running VMs. So that during the PF driver unload time, if
>> the return value of this API is greater than zero the our driver won't call
>> the pci_disable_sriov() to disable the VFs.
>>
>>
>>
>> Now for the same purpose in XEN environment, is there any API similar to
>> pci_vfs_assigned() which the low lever device driver can use to know 'the
>> number of VFs that are currently assigned to the running VMs'. In XEN
>> environment this API pci_vfs_assigned() will return always zero even though
>> VFs are assigned to the running VMs.
>
> Odd. It should return the same value. Are the devices binded to pci-back?
>
>>
>>
>>
>> Regards,
>>
>> Sreekanth

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get the number of VFs assigned to the guests in XEN
       [not found] <CAK=zhgpH2tG-EG4QP1SE46e+uHXA+GJGOPA1vi8UqAfRZ-EFTA@mail.gmail.com>
@ 2014-08-20 22:29 ` Konrad Rzeszutek Wilk
  2014-08-21  8:20   ` Sreekanth Reddy
  0 siblings, 1 reply; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-08-20 22:29 UTC (permalink / raw)
  To: Sreekanth Reddy
  Cc: linux-scsi, linux-kernel, linux-pci, Martin K. Petersen,
	Christoph Hellwig, Sathya Prakash, Nagalakshmi Nandigama,
	boris.ostrovsky

On Wed, Aug 20, 2014 at 04:33:29PM +0530, Sreekanth Reddy wrote:
> HI,
> 
> 
> 
> For SRIOV support, currently in the KVM environment, mpt3sas driver can use
> the API pci_vfs_assigned() to know the number of VFs that are currently
> assigned to the running VMs. So that during the PF driver unload time, if
> the return value of this API is greater than zero the our driver won't call
> the pci_disable_sriov() to disable the VFs.
> 
> 
> 
> Now for the same purpose in XEN environment, is there any API similar to
> pci_vfs_assigned() which the low lever device driver can use to know 'the
> number of VFs that are currently assigned to the running VMs'. In XEN
> environment this API pci_vfs_assigned() will return always zero even though
> VFs are assigned to the running VMs.

Odd. It should return the same value. Are the devices binded to pci-back?

> 
> 
> 
> Regards,
> 
> Sreekanth

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-08-21  8:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 11:09 How to get the number of VFs assigned to the guests in XEN Sreekanth Reddy
2014-08-20 12:46 ` Alex Williamson
2014-08-20 13:44   ` Sreekanth Reddy
2014-08-20 14:09     ` Alex Williamson
     [not found] <CAK=zhgpH2tG-EG4QP1SE46e+uHXA+GJGOPA1vi8UqAfRZ-EFTA@mail.gmail.com>
2014-08-20 22:29 ` Konrad Rzeszutek Wilk
2014-08-21  8:20   ` Sreekanth Reddy

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.