[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Reset pass-thru devices in a VM

On Fri, Aug 09, 2019 at 03:23:59PM +0200, Jan Beulich wrote:
>On 09.08.2019 15:24, Chao Gao wrote:
>>On Fri, Aug 09, 2019 at 10:49:32AM +0200, Jan Beulich wrote:
>>>On 09.08.2019 10:38, Chao Gao wrote:
>>>>Alternatively, emulating FLR (Function Level Reset)
>>>>capability for this device might be a feasible way and only needs
>>>>relatively few changes. I am planning to enable an opt-in feature
>>>>(like 'permissive') to allow qemu to expose FLR capability to guest for
>>>>pass-thru devices as long as this device is resetable on dom0 (i.e. the
>>>>device has 'reset' attribute under its sysfs). And when guest initiates
>>>>an FLR, qemu just echo 1 to the 'reset' attribute on dom0.
>>>>Do you think emulating FLR capability is doable?
>>>Wouldn't a such emulated guest initiated reset affect other devices
>>>(likely not under control of this guest) as well?
>>No. Linux kernel guarantees that reset to a device won't affect
>>other devices. Otherwise, such device cannot be reset and no
>>'reset' attribute will be created under device's sysfs.
>>Specfically, the invocation of pci_dev_reset_slot_function() and
>>pci_parent_bus_reset() in pci_probe_reset_function() will check whether
>>the device (function) is the only one under the slot or bus
>>respectively. In pci_create_capabilities_sysfs(), 'reset' attribute is
>>created only if dev->reset_fn is not zero.
>Ah, good. But then the opposite question arises: How would your
>proposed change help if the device shares a bus with others?

It wouldn't. If the device supports any way to reset it in dom0, this
change would help. If even in dom0 there is no way to reset a device,
it won't help. But I think for such device, it cannot be safely assigned
to a VM because we rely on PCI reset to clean up sensitive data in the
device programmed by the previous owner.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.