Re: [PATCH 04/10] vfio: Use a struct of function pointers instead of a many symbol_get()'s

Christoph Hellwig
2022-04-15T14:36:29Z

On Fri, Apr 15, 2022 at 09:13:01AM -0300, Jason Gunthorpe wrote:
> > So I got anoyed at this as well a while ago and I still think this
> > is the wrong way around.
>
> What I plan to do in future is to have differnt ops returned depending
> on if the file is a struct vfio_group or a struct vfio_device, so it
> is not entirely pointless like this.

Uh, I think that is a rather ugly interface. Why would kvm pass in
FDs to both into the same interface.

>
> > I'd much rather EXPORT_SYMBOL_GPL kvm_register_device_ops and
> > just let kvm_vfio_ops live in a module than all the symbol_get
> > crazyness. We'll need to be careful to deal with unload races
> > or just not allow unloading, though.
>
> This is certainly more complicated - especially considering module
> unload - than a single symbol_get(). How do you see the benefit?

Because that is the sensible layering - kvm already has an abstract
interface for emulated devices. So instead of doing symbol_get magic
of some kind we should leverage it.

But I can see how that is something you might not want to do for
this series. So maybe stick to the individual symbol_gets for now
and I'll send a separate series to clean that up? Especially as
I have a half-finished series for that from a while ago anyway.

>
> Jason
---end quoted text---