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

Re: [PATCH v2 3/3] AMD/IOMMU: iommu_enable vs iommu_intremap


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 3 Nov 2021 16:15:52 +0100
  • 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=mm8onhya5KdltAdEOLZM1NDX0Yr+uFyMZqsCG2PXgps=; b=Aln02pGr2dZ7Lv+Y4RlljZgZ6yFdVCTzu4mS0sZTTfODFFxSk7F3T9dwSu46tD8QbLZXdnXD2Na2fN4PXAnI4NvJkbHI5JcB57mt8ehanwbxd7t+e86IMmjL2tUTL060o1cWWNBqqa3JEW8hZMFneCK8suPAF2PbscHTVQBC+XeImhSLm9ScY076SH5tPtjPlcTTRGJR/zALchkQyO5gEEHQpbb9e4HA8rllY7aX9xMjM49LtKa1nhM8+2mrQRMOp8oIbRH3s3Rp601MIyTRDk9pYX8tEOJ8WEgSXabOoGLk6iyj96NrUAJi+3gjNbHQ1vJTwsMwFEpEtEcj3DxXOA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H/BfXyMEnc42pn74n6WpW6kfQsh5sc3hYV88Ri65ZqsQfUYBn0wUR0DvN8ZZdGGHbN0KMSyuLn3ZPyZyrQRRspC/XyS9finAvjY8vGvD8zQMzYTVnEEh9YdTXee788GFquMawnDbW9CyKV0MnJ1CKbdblDsO6wTmjBdYgxLTkLV9Rc1rgEzc2hG3085YooBGo0yhv4ZcfLr9Cz9Akp66AMZRx8TnMzaz3tb/gf5/FMCIBq47bxkYZhGBhGnh6Ub9UjV42D+fY/u41XwiaF9ownsmXI7f59TBfkCNU9Z3km5QwjDYgkkE96o9h82DuJA+c/pqGYapKGQTLofVmqTMvQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 03 Nov 2021 15:16:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03.11.2021 16:06, Roger Pau Monné wrote:
> On Wed, Nov 03, 2021 at 10:46:40AM +0100, Jan Beulich wrote:
>> On 02.11.2021 12:03, Roger Pau Monné wrote:
>>> On Tue, Nov 02, 2021 at 11:13:08AM +0100, Jan Beulich wrote:
>>>> On 25.10.2021 12:28, Roger Pau Monné wrote:
>>>>> On Thu, Oct 21, 2021 at 11:59:02AM +0200, Jan Beulich wrote:
>>>>>> The two are really meant to be independent settings; iov_supports_xt()
>>>>>> using || instead of && was simply wrong. The corrected check is,
>>>>>> however, redundant, just like the (correct) one in iov_detect(): These
>>>>>> hook functions are unreachable without acpi_ivrs_init() installing the
>>>>>> iommu_init_ops pointer, which it does only upon success. (Unlike for
>>>>>> VT-d there is no late clearing of iommu_enable due to quirks, and any
>>>>>> possible clearing of iommu_intremap happens only after iov_supports_xt()
>>>>>> has run.)
>>>>>>
>>>>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>>>>>> ---
>>>>>> In fact in iov_detect() it could be iommu_enable alone which gets
>>>>>> checked, but this felt overly aggressive to me. Instead I'm getting the
>>>>>> impression that the function may wrongly not get called when "iommu=off"
>>>>>> but interrupt remapping is in use: We'd not get the interrupt handler
>>>>>> installed, and hence interrupt remapping related events would never get
>>>>>> reported. (Same on VT-d, FTAOD.)
>>>>>
>>>>> I've spend a non-trivial amount of time looking into this before
>>>>> reading this note. AFAICT you could set iommu=off and still get x2APIC
>>>>> enabled and relying on interrupt remapping.
>>>>
>>>> Right, contrary to ...
>>>>
>>>>>> For iov_supports_xt() the question is whether, like VT-d's
>>>>>> intel_iommu_supports_eim(), it shouldn't rather check iommu_intremap
>>>>>> alone (in which case it would need to remain a check rather than getting
>>>>>> converted to ASSERT()).
>>>>>
>>>>> Hm, no, I don't think so. I think iommu_enable should take precedence
>>>>> over iommu_intremap, and having iommu_enable == false should force
>>>>> interrupt remapping to be reported as disabled. Note that disabling it
>>>>> in iommu_setup is too late, as the APIC initialization will have
>>>>> already taken place.
>>>>>
>>>>> It's my reading of the command line parameter documentation that
>>>>> setting iommu=off should disable all usage of the IOMMU, and that
>>>>> includes the interrupt remapping support (ie: a user should not need
>>>>> to set iommu=off,no-intremap)
>>>>
>>>> ... that documentation. But I think it's the documentation that
>>>> wants fixing, such that iommu=off really only control DMA remap.
>>>
>>> IMO I think it's confusing to have sub-options that could be enabled
>>> when you set the global one to off. I would expect `iommu=off` to
>>> disable all the iommu related options, and I think it's fair for
>>> people to expect that behavior.
>>
>> It occurs to me that this reply of yours here contradicts your R-b
>> on patch 1, in particular with its revision log saying:
>>
>> v2: Treat iommu_enable and iommu_intremap as separate options.
> 
> Right, I see. patch 1 uses
> 
> if ( !iommu_enable && !iommu_intremap )
>     return;
> 
> Which I think should be:
> 
> if ( !iommu_enable )
>     return;
> 
> Sorry I didn't realize in that context. I think we need to decide
> whether we want to fix the documentation to match the code, or whether
> we should fix the code to match the documentation.

Except that adjusting the conditional(s) in patch 1 would then
be a functional change that's not really the purpose of that
patch - it really only folds acpi_ivrs_init()'s and
acpi_parse_dmar()'s into a vendor-independent instance in
acpi_iommu_init(). Alternatively we could adjust the conditional
here (in patch 3), but that would feel unrelated once again, as
this change is supposed to be AMD-specific.

> My preference would be for the latter, because I think the resulting
> interface would be clearer. That will require introducing a new
> dmaremap iommu suboption, but again I think this will result in a
> better interface overall.

I guess we could do with a 3rd opinion: Paul, any chance?

In any event I hope that we can agree that patches 1 and 2 are
okay for 4.16 in their present shape, and patch 3 (plus whichever
further ones) would better wait for post-4.16?

Jan




 


Rackspace

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