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

Re: [PATCH v2 1/3] x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 22 Oct 2021 17:52:18 +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=eynO/FBr2tvmU3OQA65XB5VhrKHqp3got2j/tUP0p+c=; b=ZBbmOWKcLqekHUgvXZ8Tclrlx1uUo12FB+Nyi+0SA3aLS2P2bNkKMEHh1pJME5IsUa0rIs+c9IwsTeTJGpnXAv5y9aq/9zHKHgI0ZlcrKM0aIjT94BXsMPZYNGgx1jzHcJX+KDIHHFH9gtBV6V+8TGA1XwsQpKgz0+YZiuB9LuMX3F9cdkQKOa1jFKv9WU/tvE4W4Je5s9YFwZFnKuEAwNT98xlqT5Cy3t5iflHbJZHYwx8j3GHwJzXGIv3ToQBBKGUxkW0ly+Tcy82d+U++R9g/QmGFcRJTnuvQaGYWuolFHc9QRSGwhFGYSxP51y95+69CMYY7aLjSe4NoYiqXXA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cfVGkhvg2UWuRNCfIyLQoz12dlH308ATdsW01HiteQq5ONdE7nWTNfT2wweA66OMg7hip2/UbnSlvgLfVx0FFuQOf3JJ/ho1iazz6Le4OjtK82ytsUdHxhYm/QHasbQno8F8p3PtsGERzFf8R8HPauVW5JYiYCfCjEHpe3Fal6TcsGz/aaI5gIwqioc4aL1GaW1FzE0dpidBpnu8G5LABWDlc0TOiF2jYgOycxOL/h46cnlyglCAyLFZTJ6sHp17WT2aw3CDgu1GtPWLeD8pOMoN2oRxQ9lbPiyGc+qQDOXjCbiEyjatKlwRFx+Q6R+rqY9Y2lsk47W7xW6kh8LLEg==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Fri, 22 Oct 2021 15:52:39 +0000
  • Ironport-data: A9a23:UlRrs6n+RNzznrELmNyARjzo5gxpIURdPkR7XQ2eYbSJt1+Wr1Gzt xJMWWvQa6yIZGr8KIskbonip0gFvZXTx4JlGwJu/is2QiMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BClVlxJVF/fngqoDUUYYoAQgsA187IMsdoUg7wbdg2tQy2YPR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 I9hqZ2aRlx4B6D3k+otQUNAHBklFJQTrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ignBNPsM44F/Glp0BnSDOo8QICFSKLPjTNd9Gpv2Z4URK6CD yYfQWNLZQ3HPABMAW8aF7RljvyuoUbvXRQN/Tp5ooJoujOOnWSdyoPFL979atGMA8JPkS6wv mvb+0zpDxdcM8aQoRKH+H+xgu7EnQvgRZkfUra/85ZCkFCVg2AeFhASfV+6uuWizF6zXcpFL E4Z8TZoqrI9nHFHVfGkAUf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jdyRGVxeRZjLcKrAeQfhEWmtQtsZ uINpIOd+EYbmIK/foSgjPIa+rIqePvmMvD6Ja8vhUdPj2CKZsQlDuRYjzrY3GeLzM2fKbReq Dsgfau8FGbCAoqh4mAdzQ4dtmGg+eOuIPtYBYACRJiwA6SjQmw4Lq/NxSDxB8RXx5G3L9nqA H+4kPEz5Tml8v+5g7X1mfV4ZgTsNz9yuFbDMjJrsQOMD3jhiuheYwkcbyfuzIepv2p9T8R4Z XxiiZlG/42x2Laf2mzrxeo8w780Aw243un8lOciWuLm72weBsKT+56wa5JeBrQ7EQt+Ptm1r hQ4m6fv51LSTvdgSXU/bHzJlFXv3vxhUBnvf8YjnRZX4dbQqRWt5Yj8ERcF4pFND7m6bogDP JlAKjnlbdrmGuhHjLkV1RUsZmRtixZJGbDfqFCgL3a79FupgE786NCr/Zv2Uvp9/oGOtB5Dq r/Q+JVfYp1P7orhJRGdZE8qPuMex7wqC33QRavyHTcZeo60iH22tTKCItc3pDcRHVP9upqpK j8
  • Ironport-sdr: WG48G83o0OyCUXGE+D7Lw0XObAZ2fDvlxmb2kd6cJA6nELaA61Je77OkvNmKtKiW38kzDAPH2r kueWSt6qt5k+VlLqge9ZsLDTbdN8zYNHD6cFwbdrZGhQSdd480gautFWyJSBZDJ9NyBDmLcXAy OpCOcFn4lJ+cA8/AfWt/02T+yXozDFPaWbDRwXMxxvUQHTTiULHXVqxjhOmvZbukIFdRtWFEa7 XCs7EqcfzwP6LJCjKpwZqrM3TMDi1yUPBtHK8EUHrBGBHosZfrL2lj9JyTrSc37weZpBv9MPAy zUUQwRCEVbyWaLwLcRAjt+ih
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Oct 21, 2021 at 11:58:18AM +0200, Jan Beulich wrote:
> x2apic_bsp_setup() gets called ahead of iommu_setup(), and since x2APIC
> mode (physical vs clustered) depends on iommu_intremap, that variable
> needs to be set to off as soon as we know we can't / won't enable
> interrupt remapping, i.e. in particular when parsing of the respective
> ACPI tables failed. Move the turning off of iommu_intremap from AMD
> specific code into acpi_iommu_init(), accompanying it by clearing of
> iommu_enable.
> 
> Take the opportunity and also fully skip ACPI table parsing logic on
> VT-d when both "iommu=off" and "iommu=no-intremap" are in effect anyway,
> like was already the case for AMD.
> 
> The tag below only references the commit uncovering a pre-existing
> anomaly.
> 
> Fixes: d8bd82327b0f ("AMD/IOMMU: obtain IVHD type to use earlier")
> Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

> ---
> While the change here deals with apic_x2apic_probe() as called from
> x2apic_bsp_setup(), the check_x2apic_preenabled() path looks to be
> similarly affected. That call occurs before acpi_boot_init(), which is
> what calls acpi_iommu_init(). The ordering in setup.c is in part
> relatively fragile, which is why for the moment I'm still hesitant to
> move the generic_apic_probe() call down. Plus I don't have easy access
> to a suitable system to test this case. Thoughts?

Indeed, that seems it could go quite wrong, as apic_x2apic_probe will
see iommu_intremap == iommu_intremap_full (the default value) and thus
could choose cluster mode without real interrupt remapping support.

At first sight it would seem possible to move lower down, but as you
say, this is all quite fragile. It's even made worse because we lack a
strict ordering discipline or any kind of dependency checking, so even
if we mess up the order it's likely to go unnoticed unless someone
tests on an affected system.

While we can try to solve this for the upcoming release, long term we
need a stricter ordering, either as a comment, or even better enforced
somehow in code. The x2APIC vs IOMMU ordering has bitten us multiple
times and we should see about implementing a more robust solution.

Thanks, Roger.



 


Rackspace

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