From: Jason Gunthorpe <jgg@nvidia.com>
To: Yi Liu <yi.l.liu@intel.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
Lu Baolu <baolu.lu@linux.intel.com>,
Nicolin Chen <nicolinc@nvidia.com>,
"alex.williamson@redhat.com" <alex.williamson@redhat.com>,
Robin Murphy <robin.murphy@arm.com>,
Joerg Roedel <joro@8bytes.org>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>
Subject: Re: About unmap pages and set dirty tracking on nested parent domain
Date: Thu, 25 Jan 2024 10:03:31 -0400 [thread overview]
Message-ID: <20240125140331.GQ1455070@nvidia.com> (raw)
In-Reply-To: <92f8aaca-093d-4161-b8f2-5ab1680df769@intel.com>
On Thu, Jan 25, 2024 at 09:55:46PM +0800, Yi Liu wrote:
> Hi Jason, Kevin,
>
> Today, Intel iommu driver only tracks attached devices/iommus in the nested
> domain. While the nested parent domain does not.
Heh, I was just looking at this bug on my ARM implemention too :)
> This makes cache flush on nested parent domain be a nop if it's only
> used as parent.
Yep, this is wrong.
> 1) Do we want to allow unmap pages on nested parent domain?
Yes. It is needed for memory unplug.
> Today there is
> no PRQ support on the nested parent domain (stage-2). That's why both
> VFIO and IOMMUFD pins the page in the DMA_MAP. As a result, VMMs like
> Qemu cannot not unamp pages in nested parent domain after VM is
> running.
No, qemu can do an explicit unmap command to iommufd. PRQ is not relavent
> 2) If answer of 1) is yes. Should the owner of stage-1 be notified about
> the unmap event on its nested parent, hence owner is able to flush the
> corresponding stage-1 cache explicitly?
No. We don't support "mdev" "access" operations on nests so there is
no reason to notify anyone. If qemu hot unplugs memory from a VM then
it should already have some idea that the VM is not doing DMA to that
memory.
> 3) Is it enough to fix this gap within iommu driver? or need to be handled
> in the generic layer? e.g. let the iommufd layer to track stage-1 hwpts
> in stage-2 hwpt. In this way, iommufd can flush stage-1 cache when
> unmapping pages on stage-2.
I think the iommu driver should fix it
Notice there is also an ATC requirement here, when the nesting parent
changes it needs to issue a full ATC flush on PASID 0, not a range
flush.
Also notice the iommu probably has to zap the entire IOTLB for any
nesting child if the parent changes, unless it has amazing HW :)
It would be really awkward to try to lift this detail out of the
driver.
Lets add Suravee to be sure the AMD driver is aware of this detail
too.
My plan is to have the nesting attach add the device to the parent
domain's invalidation list and have a flag in the master_domain to
indicate this attachment has the special ATC invalidation.
This will allow the S2 to be used normally as well, eg for the
identity map.
Jason
next prev parent reply other threads:[~2024-01-25 14:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 13:55 About unmap pages and set dirty tracking on nested parent domain Yi Liu
2024-01-25 14:03 ` Jason Gunthorpe [this message]
2024-01-26 0:19 ` Jason Gunthorpe
2024-01-26 9:36 ` Yi Liu
2024-01-26 9:30 ` Yi Liu
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=20240125140331.GQ1455070@nvidia.com \
--to=jgg@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=nicolinc@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.