[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: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 14 Jun 2023 15:51:55 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=smvQtCsPdiA8ZGiDimrFt5qwpEVDcrd/rk8/Jm6Ir6c=; b=IL0iZc15DLJk9YwjjDf0iOZ2Pl2YlK5RcnrsM2uYlHVKMQv+ebwPM9Vm4avXApMwpE+AQPp53k0C6ype8WJCC7rXk02BIk5R7GMrisUXrDZ7U8lhMrlIJ5NBGcwVBj6Yhzq28ka0JDCQArRZ2EE/Mo8qszeZTFgQZuUX80k8+HJWASiODwcl9HTNUeDqXDSXlcBBiKAElfOaQHoJDutXYLSvqv4CVmbBmds4vhzdAHPH+qhsj9tO7Ftx4z/m317ZTE0FSoyJmUTp5Vq0WVQcjk6M37KSo7MhSifTzLdw0e+2X64ANLwYhK8djnZXEfGNAvOljDrwNRuPvWvlc7A3xg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C6EexMYMKk+uw9UST8Jqk4jnrqxNnu2maoajxMiuX4DIvgPEUz7wvVexK08fdtNpXyAphQpmOhzxYsVIFMYfoH38SYd60ClWTUeJg9NwzRaC0M4xmUG3opn3PmPO6j5CxybBGfQdI8IEkzj67G9ZXTmnFpYdZeDSm4RspEcCbcGHE88ADk0XtHp7kNP72Xacs8eJL1pkkBcYPEctJ8AHmvedAyV3C8pbhSZZIOM9JyncWy0+Cad722fmhbhSYjfJt8mDP6Lsf18VPuUmpZDbQhmg1eaAen2C5JmOyTFs8ZGiAtKBjDpQXBsKSjBq/Aw0a7vpTFMNr8WVMUNK2T462A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 14 Jun 2023 13:52:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.06.2023 15:23, Roger Pau Monné wrote:
> 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().

The question is: Is there anything that needs flushing for the
quarantine domain. Right now I'm thinking that there isn't.

Jan



 


Rackspace

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