[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] iommu/amd-vi: adjust _amd_iommu_flush_pages() to handle pseudo-domids


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 14 Jun 2023 15:23:43 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EW0J2ASRDyPn3qivvp1t+h7uBWPprYtfWZ7NzD/HKt0=; b=SkBRLPkv9i4wrwu9tw8UpZhhNPTXandfSNM1VD7wRo4qjAA0Pe4B3DudA1CVYo7cg8ce0x70iU17gNrMKnaE4N2m+VIN3B122dgEVcRxv79J7tycrvX+DVKMwqg3YCb8JW/lMkFKLW0+wqPnuX/SyUITMXEI/+W+PfBjkqJb475QvrNpAKcZM4PcJDlVKoIMY/IHv4DPxh4Sjtu3GgDS0dDb+eSlkFhkbqp0dok6RMBYEqhI1yc6cKVTBWBBmX9BN1ChmxsS78ulZDvwPV2hnnmj7YC/Pg03+rfaPuKRZ6Gqa/wT9dIAKNovCtiHtzO5wSgQxXvXbb3IeSdY95EOjA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AZmCJLa6TziQjJXHg/tLs7SZ1ER/xdaygvnGwD/RzdSNmSI7YyKHnCFUgMMJXY7AD96S4kSmCy0rJFI5oJL+Ks/H7N/c9hHUytZQMY5RwVSwdbVHqgPWbczbFGlg20g6vRpwLVQSkz3DVsCoKjF+pykUtFruJgNGLmiiitXIEayds1aHSpWvb/xZIYGkCiDSs8il+GIbTxbYt3ylupywopHM6sXfOP47M1eDsa3v51QfxrEwrYbqRqil1Q2gp41bTHZWeBl1uMsm7eTiIY0uVpJuAK95GIXiU69ukHaMRX2lwpLbDOcDJHAsS2MSUjzUFJLdQn0zSKWu1hP6ved9cA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 14 Jun 2023 13:24:15 +0000
  • Ironport-data: A9a23:QQXqIa5tvDefQQ/SxTmdagxRtCrGchMFZxGqfqrLsTDasY5as4F+v mBJWzvUMvffN2unL41zPYi29kpUsZ/Ux4dqQQBvqX0wHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraCYnsrLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9lU35JwehBtC5gZlPa4S4AeH/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5m2 PU5b24BNza6jN2Xzu+pY9JrheQfI5y+VG8fkikIITDxK98DGMmGb4CUoNhS0XE3m9xEGuvYa 4wBcz1zYR/cYhpJfFAKFJY5m+TujX76G9FagAvN+exrvC6Ok0ooj+OF3Nn9I7RmQe1PmUmVv CTe9nnRCRAGLt2PjzGC9xpAg8eWxHmkB9xJSezQGvhCjW+17TMDUBwtR1Kdnsizh2vnAu1FA hlBksYphe1onKCxdfH/VRClpH+PvjYHRsFdVeY97Wml2qfSpgqUGGUAZjpAc8A98t87QyQw0 V2ElM+vAiZg2IB5UlqY/7aQ6D+3Zy4cKDZbYTdeFFRepd7+vIs0kxTDCM55F7K4hcH0Hje2x C2WqC85hPMYistjO7iHwG0rSgmE/vDhJjPZLC2NNo55xmuVvLKYWrE=
  • Ironport-hdrordr: A9a23:Q+5Py6puW3iJh/xideGgGwsaV5oReYIsimQD101hICG9JPbo8P xG+85rtiMc6QxwZJhOo7u90cW7K080lqQV3WByB9iftVLdyQ+VxehZhOPfKlvbdhEWndQy6U 4PScRD4HKbNykdsS5XijPIcerJYbO8gcWVuds=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Jun 14, 2023 at 02:58:14PM +0200, Jan Beulich wrote:
> On 14.06.2023 10:32, Roger Pau Monne wrote:
> > When the passed domain is DomIO iterate over the list of DomIO
> > assigned devices and flush each pseudo-domid found.
> > 
> > invalidate_all_domain_pages() does call amd_iommu_flush_all_pages()
> > with DomIO as a parameter,
> 
> Does it? Since the full function is visible in the patch (because of
> the "While there ..." change), it seems pretty clear that it doesn't:
> for_each_domain() iterates over ordinary domains only.

Oh, I got confused by domain_create() returning early for system
domains.

> > and hence the underlying
> > _amd_iommu_flush_pages() implementation must be capable of flushing
> > all pseudo-domids used by the quarantine domain logic.
> 
> While it didn't occur to me right away when we discussed this, it
> may well be that I left alone all flushing when introducing the pseudo
> domain IDs simply because no flushing would ever happen for the
> quarantine domain.

But the purpose of the calls to invalidate_all_devices() and
invalidate_all_domain_pages() in amd_iommu_resume() is to cover up for
the lack of Invalidate All support in the IOMMU, so flushing
pseudo-domids is also required in order to flush all possible IOMMU
state.

Note that as part of invalidate_all_devices() we do invalidate DTEs
for devices assigned to pseudo-domids, hence it seems natural that we
also flush such pseudo-domids.

> > While there fix invalidate_all_domain_pages() to only attempt to flush
> > the domains that have IOMMU enabled, otherwise the flush is pointless.
> 
> For the moment at least it looks to me as if this change alone wants
> to go in.

I would rather get the current patch with an added call to flush
dom_io in invalidate_all_domain_pages().

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.