Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-19 Thread Tony Krowiak
On 4/12/22 11:53 AM, Jason Gunthorpe wrote: All callers have a struct vfio_device trivially available, pass it in directly and avoid calling the expensive vfio_group_get_from_dev(). To support the unconverted kvmgt mdev driver add mdev_legacy_get_vfio_device() which will return the vfio_devic

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-19 Thread Tony Krowiak
On 4/18/22 11:44 AM, Jason Gunthorpe wrote: On Mon, Apr 18, 2022 at 11:28:30AM -0400, Tony Krowiak wrote: diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index a4555014bd1e72..8a5c46aa2bef61 100644 +++ b/drivers/vfio/vfio.c @@ -2484,19 +2484,15 @@ static int vfio_unregister_group_notif

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-19 Thread Jason J. Herne
On 4/12/22 11:53, Jason Gunthorpe wrote: All callers have a struct vfio_device trivially available, pass it in directly and avoid calling the expensive vfio_group_get_from_dev(). To support the unconverted kvmgt mdev driver add mdev_legacy_get_vfio_device() which will return the vfio_device poin

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-18 Thread Jason Gunthorpe
On Mon, Apr 18, 2022 at 11:28:30AM -0400, Tony Krowiak wrote: > > diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c > > index a4555014bd1e72..8a5c46aa2bef61 100644 > > +++ b/drivers/vfio/vfio.c > > @@ -2484,19 +2484,15 @@ static int vfio_unregister_group_notifier(struct > > vfio_group *group,

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-14 Thread Eric Farman
On Tue, 2022-04-12 at 12:53 -0300, Jason Gunthorpe wrote: > All callers have a struct vfio_device trivially available, pass it in > directly and avoid calling the expensive vfio_group_get_from_dev(). > > To support the unconverted kvmgt mdev driver add > mdev_legacy_get_vfio_device() which will re

RE: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-13 Thread Tian, Kevin
> From: Wang, Zhi A > Sent: Thursday, April 14, 2022 5:09 AM > > > Or is it that only the page table levels themselves are GFNs and the > > actual DMA's are IOVA? The unclear mixing of GFN as IOVA in the code > > makes it inscrutible. > > > > No. Even the HW is capable of controlling the level o

RE: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-13 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Thursday, April 14, 2022 7:12 AM > > On Wed, Apr 13, 2022 at 09:08:40PM +, Wang, Zhi A wrote: > > On 4/13/22 8:04 PM, Jason Gunthorpe wrote: > > > On Wed, Apr 13, 2022 at 07:17:52PM +, Wang, Zhi A wrote: > > >> On 4/13/22 5:37 PM, Jason Gunthorpe wrote: > >

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-13 Thread Jason Gunthorpe
On Wed, Apr 13, 2022 at 09:08:40PM +, Wang, Zhi A wrote: > On 4/13/22 8:04 PM, Jason Gunthorpe wrote: > > On Wed, Apr 13, 2022 at 07:17:52PM +, Wang, Zhi A wrote: > >> On 4/13/22 5:37 PM, Jason Gunthorpe wrote: > >>> On Wed, Apr 13, 2022 at 06:29:46PM +0200, Christoph Hellwig wrote: >

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-13 Thread Wang, Zhi A
On 4/13/22 8:04 PM, Jason Gunthorpe wrote: > On Wed, Apr 13, 2022 at 07:17:52PM +, Wang, Zhi A wrote: >> On 4/13/22 5:37 PM, Jason Gunthorpe wrote: >>> On Wed, Apr 13, 2022 at 06:29:46PM +0200, Christoph Hellwig wrote: On Wed, Apr 13, 2022 at 01:18:14PM -0300, Jason Gunthorpe wrote: >

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-13 Thread Jason Gunthorpe
On Wed, Apr 13, 2022 at 07:17:52PM +, Wang, Zhi A wrote: > On 4/13/22 5:37 PM, Jason Gunthorpe wrote: > > On Wed, Apr 13, 2022 at 06:29:46PM +0200, Christoph Hellwig wrote: > >> On Wed, Apr 13, 2022 at 01:18:14PM -0300, Jason Gunthorpe wrote: > >>> Yeah, I was thinking about that too, but on th

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-13 Thread Wang, Zhi A
On 4/13/22 5:37 PM, Jason Gunthorpe wrote: > On Wed, Apr 13, 2022 at 06:29:46PM +0200, Christoph Hellwig wrote: >> On Wed, Apr 13, 2022 at 01:18:14PM -0300, Jason Gunthorpe wrote: >>> Yeah, I was thinking about that too, but on the other hand I think it >>> is completely wrong that gvt requires kvm

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-13 Thread Jason Gunthorpe
On Wed, Apr 13, 2022 at 06:29:46PM +0200, Christoph Hellwig wrote: > On Wed, Apr 13, 2022 at 01:18:14PM -0300, Jason Gunthorpe wrote: > > Yeah, I was thinking about that too, but on the other hand I think it > > is completely wrong that gvt requires kvm at all. A vfio_device is not > > supposed to

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-13 Thread Jason Gunthorpe
On Wed, Apr 13, 2022 at 06:06:01PM +0200, Christoph Hellwig wrote: > On Wed, Apr 13, 2022 at 08:39:52AM -0300, Jason Gunthorpe wrote: > > I already looked into that for a while, it is a real mess too because > > of how the notifiers are used by the current drivers, eg gvt assumes > > the notifier i

Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-13 Thread Jason Gunthorpe
On Wed, Apr 13, 2022 at 07:55:24AM +0200, Christoph Hellwig wrote: > On Tue, Apr 12, 2022 at 12:53:28PM -0300, Jason Gunthorpe wrote: > > All callers have a struct vfio_device trivially available, pass it in > > directly and avoid calling the expensive vfio_group_get_from_dev(). > > Instead of bot

[PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

2022-04-12 Thread Jason Gunthorpe
All callers have a struct vfio_device trivially available, pass it in directly and avoid calling the expensive vfio_group_get_from_dev(). To support the unconverted kvmgt mdev driver add mdev_legacy_get_vfio_device() which will return the vfio_device pointer vfio_mdev.c puts in the drv_data. Sign