Jason Gunthorpe
2025-Oct-02 15:23 UTC
[PATCH v2 1/2] rust: pci: skip probing VFs if driver doesn't support VFs
On Thu, Oct 02, 2025 at 05:11:01PM +0200, Danilo Krummrich wrote:> On Thu Oct 2, 2025 at 3:56 PM CEST, Jason Gunthorpe wrote: > >> Surely, you can argue that if they have different enough requirements they > >> should have different device IDs, but "different enough requirements" is pretty > >> vague and it's not under our control either. > > > > If you want two drivers in Linux you need two PCI IDs. > > > > We can't reliably select different drivers based on VFness because > > VFness is wiped out during virtualization. > > Sure, but I thought the whole point is that some VFs are not given directly to > the VM, but have some kind of intermediate layer, such as vGPU. I.e. some kind > of hybrid approach between full pass-through and mediated devices?We'd call the intermediate layer "mediation", and it is abnormal to have something significant there because it impacts performance and increases the hypervisor attack surface. Usually you just give the whole VF mostly as-is. The ideal vfio driver is the common one because the raw VF doesn't need any meddling.> >> But, if there is another solution for VFs already, e.g. in the case of nova-core > >> vGPU, why restrict drivers from opt-out of VFs. (In a previous reply I mentioned > >> I prefer opt-in, but you convinced me that it should rather be > >> opt-out.) > > > > I think nova-core has a temporary (OOT even!) issue that should be > > resolved - that doesn't justify adding core kernel infrastructure that > > will encourage more drivers to go away from our kernel design goals of > > drivers working equally in host and VM. > > My understanding is that vGPU will ensure that the device exposed to the VM will > be set up to be (at least mostly) compatible with nova-core's PF code paths?This is not what I've been told, the VF driver has significant programming model differences in the NVIDIA model, and supports different commands. If you look at the VFIO driver RFC it basically does no mediation, it isn't intercepting MMIO - the guest sees the BARs directly. Most of the code is "profiling" from what I can tell. Some config space meddling. I think Zhi could make it more clear what mediation the actual VFIO part of the driver is even doing and why.. Keep in mind for NVIDIA vGPU this has changed alot over the years - I am talking here about the SRIOV driver proposed recently that is specifically designed to substantially remove the hypervisor mediation.> So, there is a semantical difference between vGPU and nova-core that makes a > differentiation between VF and PF meaningful and justified.Aa was said earlier, there is a register in the MMIO that identifies if the vGPU programming model is used, that is what nova core should key on to determine how to act. Jason
Danilo Krummrich
2025-Oct-02 16:05 UTC
[PATCH v2 1/2] rust: pci: skip probing VFs if driver doesn't support VFs
On Thu Oct 2, 2025 at 5:23 PM CEST, Jason Gunthorpe wrote:> This is not what I've been told, the VF driver has significant > programming model differences in the NVIDIA model, and supports > different commands.Ok, that means there are some more fundamental differences between the host PF and the "VM PF" code that we have to deal with. But that doesn't necessarily require that the VF parts of the host have to be in nova-core as well, i.e. with the information we have we can differentiate between PF, VF and PF in the VM (indicated by a device register).> If you look at the VFIO driver RFC it basically does no mediation, it > isn't intercepting MMIO - the guest sees the BARs directly. Most of > the code is "profiling" from what I can tell. Some config space > meddling.Sure, there is no mediation in that sense, but it needs quite some setup regardless, no? I thought there is a significant amount of semantics that is different between booting the PF and the VF on the host. Also, the idea was to use a layered approach, i.e. let nova-core serve as an abstraction layer, where the DRM and VFIO parts can be layered on top of. Are you suggesting to merge vGPU into nova-core? (The VF specific firmware interfaces, should be abstracted in nova-core, so, technically, we will have some vGPU specific code in nova-core.)