public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"Liu, Yi L" <yi.l.liu@intel.com>,
	"Martins, Joao" <joao.m.martins@oracle.com>
Subject: Re: [PATCH v2] vfio: Remove vfio_group dev_counter
Date: Tue, 6 Sep 2022 10:59:03 -0300	[thread overview]
Message-ID: <YxdSJ05uMye4Cm9/@nvidia.com> (raw)
In-Reply-To: <BN9PR11MB527619A0314F21B4FD21182D8C7E9@BN9PR11MB5276.namprd11.prod.outlook.com>

On Tue, Sep 06, 2022 at 09:21:35AM +0000, Tian, Kevin wrote:

> Although mlx5 internal tracking is not generic, the uAPI proposed
> in Yishai's series is pretty generic. I wonder whether it can be extended
> as a formal interface in iommufd with iommu dirty tracking also being
> a dirty tracker implementation.

It probably could, but I don't think it is helpful

> Currently the concept between Yishai's and Joao's series is actually
> similar, both having a capability interface and a command to read/clear
> the bitmap of a tracked range except that Yishai's series allows
> userspace to do range-based tracking while Joao's series currently
> have the tracking enabled per the entire page table.

This similarity is deliberate
 
> But in concept iommu dirty tracking can support range-based interfaces
> too. For global dirty bit control (e.g. Intel and AMD) the iommu driver
> can just turn it on globally upon any enabled range. For per-PTE
> dirty bit control (e.g. ARM) it's actually a nice fit for range-based
> tracking.

We don't actually have a use case for range-based tracking. The reason
it exists for mlx5 is only because the device just cannot do global
tracking.

I was hoping not to bring that complexity into the system iommu side.

> This pays the complexity of introducing a new object (dirty tracker)
> in iommufd object hierarchy, with the gain of providing a single
> dirty tracking interface to userspace.

Well, it isn't single, it still two interfaces that work in two quite
different ways. Userspace has to know exactly which of the two ways it
is working in and do everything accordingly.

We get to share some structs and ioctl #s, but I don't see a
real simplification here.

If anything the false sharing creates a new kind of complexity:

> Kind of like an page table can have a list of dirty trackers and each
> tracker is used by a list of devices.
> 
> If iommu dirty tracker is available it is preferred to and used by all
> devices (except mdev) attached to the page table.
> 
> Otherwise mlx5 etc. picks a vendor specific dirty tracker if available.
> 
> mdev's just share a generic software dirty tracker, not affected by 
> the presence of iommu dirty tracker.
> 
> Multiple trackers might be used for a page table at the same time.
> 
> Is above all worth it?

Because now we are trying to create one master interface but now we
need new APIs to control what trackers exists, what trackers are
turned on, and so forth. Now we've added complexity.

You end up with iommufd proxying a VFIO object that is completely
unrelated to drivers/iommu - I don't like it just on that basis.

The tracker is a vfio object, created by a vfio driver, with an
interface deliberately similar to iommufd's interface to ease the
implementation in userspace. It is not realed to drivers/iommu and it
doesn't benefit from anything in drivers/iommu beyond the shared code
to manage the shared uapi.

Jason

  reply	other threads:[~2022-09-06 14:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16 19:13 [PATCH v2] vfio: Remove vfio_group dev_counter Jason Gunthorpe
2022-08-22  4:39 ` Tian, Kevin
2022-08-22 18:35   ` Alex Williamson
2022-08-23  1:31     ` Tian, Kevin
2022-08-24  0:38       ` Jason Gunthorpe
2022-08-24 22:02         ` Alex Williamson
2022-08-25  0:43           ` Jason Gunthorpe
2022-09-06  9:21             ` Tian, Kevin
2022-09-06 13:59               ` Jason Gunthorpe [this message]
2022-08-29  2:02         ` Tian, Kevin
2022-09-02 18:42 ` Alex Williamson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YxdSJ05uMye4Cm9/@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=joao.m.martins@oracle.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=yi.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox