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

Re: [PATCH RFC 5/6] amd/iommu: atomically update remapping entries when possible


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 5 Jul 2022 16:43:10 +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=pHav9Rzph42TTthl8M1E87db8TxT+IIpSGpqcppw/h0=; b=dEgpqXV3LbbI+h+loyd3V4OXnZv6JDtQqFjVd4we8U6eseLfMe3jG5vy057QyejKTIsZsuG0jpkuhdma29KKHp/GxR29UAURpurBD6ZUIRfXbUzyHSfc/U93XujT1VecZ2e0JDVW3KdZEPHFgBatK7dBGgpxtbGBL1cTVebb28rSq4avzE6awV/eblfp2wcD/h1mqhsTTwy24Za6jsB3bGrtHAA2rhPxVcaraR0qLyDUL4MN0apThHiOY0SmMHGAzDBC2xMDiF9ujMVVYYtqgUYPj/VYl2WfFyueLg72dmoaLn4QrcpYaoftno6rNJL6tYLCK/Fm1NPGGvtwAyygcg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aT+7HhVuN/Xz/HIiTazpDcHfZi9UFl3EM3GhboQfeDGiOKLGa0AC2EO5/Zz9AZQ4L+A/1JrNzj8drDhGE2Ch0Wd9EMJJwuoQpvPfb0Lau4gqfDrv7gzfZ1rvQcvLDHAc+5rcotk4c4SF8tLC5puwELyrk3Lkhlg7vChnMzSuZ4ifor5GFX+aVOaw2J9NDzEB5rafXnmWkIDe0Gnf7b8MCyIZDFvksAmhmoWQq8/6BBIccdM+ZpfwAL3+LwtcXiuLEDPsk9NHyTusvODHYv5OPwkEp+U+TYszdTP5jUTxsPeAMzJfoXEipbe+BCzGCkSeHUYcaVrp0qjNXrjd8sdKhA==
  • 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: Tue, 05 Jul 2022 14:43:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.04.2022 15:21, Roger Pau Monne wrote:
> @@ -366,8 +383,11 @@ void cf_check amd_iommu_ioapic_update_ire(
>          fresh = true;
>      }
>  
> -    /* mask the interrupt while we change the intremap table */
> -    if ( !saved_mask )
> +    /*
> +     * Mask the interrupt while we change the intremap table if it can't be
> +     * done atomically.
> +     */
> +    if ( !saved_mask && !cpu_has_cx16 && iommu->ctrl.ga_en )
>      {
>          old_rte.mask = 1;
>          __ioapic_write_entry(apic, pin, true, old_rte);
> @@ -383,6 +403,11 @@ void cf_check amd_iommu_ioapic_update_ire(
>          /* Keep the entry masked. */
>          printk(XENLOG_ERR "Remapping IO-APIC %#x pin %u failed (%d)\n",
>                 IO_APIC_ID(apic), pin, rc);
> +        if ( !saved_mask && (cpu_has_cx16 || !iommu->ctrl.ga_en) )
> +        {
> +            old_rte.mask = 1;
> +            __ioapic_write_entry(apic, pin, true, old_rte);
> +        }
>          return;
>      }

Iirc you have a question about this (wrt differing VT-d behavior)
elsewhere. I'm not convinced of this masking. I could see it as a
measure to prevent damage if an update was done partially, but I
don't see such being possible here. Hence to me it would look more
logical if the entry was simply left as is, leaving it to the
caller to correctly deal with the failure. But of course that
would first require telling the caller about the failure ...

Jan



 


Rackspace

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