[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: Tue, 2 Nov 2021 11:26:01 +0100
  • 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=DKzL8tHt5zq+OtKw0WawyFTqW8we2cxtopue/iv5gcE=; b=Psu4KAY52D9yQNjNC2nqKXFwByXrRwLsiAV71EghYyhAZdZpWUidguc4yEC9/4/DFOCxKs/VSD5jw2hzWgbU5HxPhLUvKM/0pXGCGblz1p+QRQUdO+EDotGlPE38aK4YZSG6urM4TgbSg7vZlbJl4rU0hqulG2dP1myQ1+pvu5mIpjvXPEQAa7I/DNPHGJ9rlj2b0AzdqPQ7cFyM+DH4iIzYLk8NzA/DPf+2eVusVXpiK6Swh/cg6g9CgTRsVzqJjELNru/MXu7EK1w3LP8SPBuhdYTuQg2dtTRv9E09zYsfqxRpKTBsrxKKAALy2QNpOlSoXatd4OUgg9cq5tsF0A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kAUOZKsMwwm7d/86z64gP2PH/n7tYjHsBfnBG25M/2/OgX9Z/ANrnc+Am/o6JS3qcsYINuiJ3p9M70s+9+TC2gWzKhcQEKKjyqJAF3/EucVs4lMmn8jphF6y/qyzdYorT3+IkR5X1rNQdSqjzHpnZ2Hj5R3e+/clkeIAsJHcWshjQjFIT85ZflOZ1RfLGeLdKgVj2NYNQtFmNX1xb+ILvp+BM1FbyhaNQYo8ikrsiOMwfYCULi5jUyp2egJxoA891/DMYS1w2Y+pj308fNRrd95P0adY0yO1tFvg3SqbFnI6JQrSPWdCfki1vmdXGDCeIlih+Oe0LA5llDjEa7PJvQ==
  • Authentication-results: esa1.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: Tue, 02 Nov 2021 10:26:19 +0000
  • Ironport-data: A9a23:4oV/eKgklI0klmKSGcNfs+ozX161jRcKZh0ujC45NGQN5FlHY01je htvDDjQOv/eZjf9KogjbYq1p0sB65/Qn4AwQQVoqChjRSwb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oAMKRCQ7InQLlbGILes1htZGEk0F0/NtTo5w7Rg29cw24Dga++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1mrMzpaA1xMJbildoMVEECAi5vFLFZreqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHxO4wSoDd4xCzxBvc6W5HTBa7N4Le02R9t2ZoTRqmBO aL1bxJsMEucIA9hK24XK7EXh8KMq1vYMD9H/Qf9Sa0fvDGIkV0ZPKLWGMXRUsyHQ4NShEnwj nrP4mDREhwcctuFxlKt8Hihm+vOliPTQ58JGfuz8fsCqE2ewCkfBQMbUXO/oOKlkQiuVtRHM UsW9yEy668o+ySWosLVBkPi5iTe51hFBoQWQ7ZSBByxJrT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G+VPd8kLFh4xgPM tbAs1D4ZjLfCRHZKXBkXiF+rQbsaC6GcmT7I+0pRcdLnAbV0gj1XYANu/yKDwJeOAsP+teKH Pz3Lsim9L2Ek5nEfhTS0N1FdTrlpnurtbLcBQGDxko5E2nii6p0qfzF1y90g0FWz1C7L8++S yd+jaJqpmLgrWe8FvxxmXT55NZlJ/IzcZCPtWFjowwJi/3ggilSYx9U/mpvSwzosuo9FE2+e O87isIDoBW0Tf8b2u1qRzi103J1ysv0WbrzRuijX7qsaXCNXsHIvsEobgcXgrS6kImst05+r lMxXilu51eCg6FtDjh5vDTPisa13ackD4Hq6o+nnZfWYwRZPt6tooE5n5YF58GAWbT9J0nKu 9zF8vRjcwmP29yV0qp/VWH/ebcHEjaRny9Mw0/U42uondrdUlCvgslLJd1pAZFyHo/I6M0kd gsfJ4Y042mdfVmH56VMt1xNvdfOla9Mi4kD1jiVGgPNJt3c04l+KSHq4nc2omRCeg1Jd0J6d L8bG8=
  • Ironport-sdr: H//Xupu3GSYFOCsZTdr8mi09v083DQVuCjRqZzieSIpPyiY+Ll2wWuXC0MDF01WPxKjyG/tgmk 1T8MOhGKSrscD8IM3byPnUVM2uDpMqiuXgCwstOHE+zXum+6/ThMH+uwIG1ngyqaQYYqSADxOt wglEDjPnMOT8lLlOX/qD56wQuBpZ955AnMLBKzjR7IElsP4pyn9sTyBFER0Cj0Fk3nQZW/lEq3 S1KJhPXsUo/uZ6tguDwgfr0l4bT19CaokCqAFD8M5Q04AcJNJin/Qz4MFAkUjGkEh6Ik+X6Xew 1dbxM2ozXNJsl2+EICviINL8
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Nov 02, 2021 at 11:07:25AM +0100, Jan Beulich wrote:
> On 22.10.2021 17:52, Roger Pau Monné wrote:
> > 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>
> 
> Thanks.
> 
> >> ---
> >> 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.
> 
> So what's your thought then: Make the change (in another patch), or rather
> leave the code as is? I'm slightly in favor of making the change seeing
> that you agree that the rearrangement looks to be correct.

Sorry this wasn't clear, I've rambled too much: making the change in
another patch would be my preferred option.

I still wonder whether we could place some kind of checks to ensure
the logic of interrupt remap vs APIC initialization is executed in the
right order, but that's not release material.

Thanks, Roger.



 


Rackspace

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