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

Re: [Xen-devel] [PATCH] x86/HVM: adjust hvm_interrupt_blocked()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 5 Sep 2023 12:36:36 +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=MDETOJUBJE9xOpwfPJBxla+FHGSZCMdXh6hZ18IM1wM=; b=PO2E1WYcgLcy2QdMyy94G2S6yE+t0u07xphmc1mqxQM1NEV0vRND1sM6wudhybvX5MCb2JANog3HJ+XUcMuhqcayufSeuTKLpz5tDrwmrmIwKkdcRtdfJljdluxYtzNt66B5dVpScfNhZ1IQGadBFgXvyckaQsvT+RIKLE1kGsRgYNgCEUWjDVABHM6iDmvkWmuonYx59va1+5eMDA/bSpECJB07hz2Jp/J3pPM4cn4mOGQfEuRX+IpiZxlS1ajZ7OhWwPq0Ndcjim1UvOwfUn4hDC0zxRUtVCDaML7/NJQXMiTp0xRp2kuyzM06JlTLxhkvT9bMVe7cSMxmRlkgWw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dFzGrGm/h0wTH5IgdVjQLFk9+68n8WJGdqcIOgf6omJVBbeo29nkG9r6wrLpl3y+8GpmRl77BK+lN9lXDfUkvA2/1tTUbhnSHvXry2+lu366k94Oe6UXR1UiPFmiS+fpxv6VJXH9SUWnPJYOpu5jkk/RdHxrP2Ua0lsl29f9KpxVzQEF1jpft5vcTAgvumZJUmMJb1tzDsFpjX3ERvgPbQzXk7lp0M4/ihJt2/keYD6/2jw92uGt8YhLpYHr2mpPINCZQh/IatsniqnTLUPsL/bmCsmGdkz3l+pTe3JP5sXH93zXnQBg0qCRFODT/4nE8bhuydNeuL5XzfeHkdKPRA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wei.liu2@xxxxxxxxxx>
  • Delivery-date: Tue, 05 Sep 2023 10:37:09 +0000
  • Ironport-data: A9a23:HaNf8KpgeeNe2fRIQ2UAacIxtoZeBmILZBIvgKrLsJaIsI4StFCzt garIBnXMvneMDD1edB+Pdvlox8HvpOAmNZkGwVoqnwxEnxHo5uZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpA1c/Ek/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKq04GlwUmAWP6gR5wePzyRNV/rzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXAAEiNk6BnbyJ+qzhU/BFmf0ZCu+3PYxK7xmMzRmBZRonabbqZv2QoPN9h3I3jM0IGuvCb c0EbzYpdA7HfxBEJlYQDtQ5gfusgX78NTZfrTp5p4JuuzSVkFM3jearbIu9lt+iHK25mm6Co W3L5SLhCwwyP92D0zuVtHmrg4cjmAuiAttPT+HhqacCbFu79C8OJhgoaVWAnfiigVycBOMBJ G0Jw397xUQ13AnxJjXnZDW6qnOZuh8XW/JLDvY3rgqKz8L88wufQ2QJUDNFQNgnr9MtAywn0 EeTmNHkDiApt6eaIU9x7Z+RpDK2fCQQdmkLYHdeSRNfu4Wy5oYukhjIU9BvVravicH4Ei3xx DbMqzUig7IUjogA0KDTEU37vg9Ab6PhFmYdjjg7lEr/hu+lTOZJv7CV1GU=
  • Ironport-hdrordr: A9a23:CrfqvqO+0xFKGMBcT/X155DYdb4zR+YMi2TDiHoddfUFSKalfp 6V98jzjSWE9Ar5K0tQ5uxoWZPwMk80kKQY3WB/B8bZYOCLghrOEGgA1/qR/9SDIVyCygc178 4JHMYOa6yTfD0K6foW+DPZYqEdKbG8gdSVbIzlvg5QpHRRGtpdBnBCe36m+yNNNW977UZQLu vo2iNynUvXRZ1bVLX0OlA1G8z44/HbnpPvZhALQzYh9Qm1lDutrIX3FhCJty1uHg+mld0ZkF Ttokjc3OGOovu7whjT2yv49JJNgubszdNFGYilltUVAi+EsHfuWK1RH5m5+BwlquCm71gn1P PWpQ07Ash143TNOkmovBrW3RX62jpG0Q6n9bahuwqknSXFfkN5NyMBv/MbTvLh0TthgDio6t MP44qb36AnRy8o0h6NvuQgHCsa6HZcmkBS2tL7v0YvGLf2IIUh3LD3w3klWKvoPBiKpLzPQ9 MeQ/00oswmMG9yQUqpzlVS/A==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Sep 04, 2023 at 03:40:46PM +0200, Jan Beulich wrote:
> On 31.08.2023 12:57, Roger Pau Monné wrote:
> > On Thu, Aug 31, 2023 at 12:42:58PM +0200, Roger Pau Monné wrote:
> >> On Fri, Oct 12, 2018 at 09:58:46AM -0600, Jan Beulich wrote:
> >>> First of all, hvm_intsrc_mce was not considered here at all, yet nothing
> >>> blocks #MC (other than an already in-progress #MC, but dealing with this
> >>> is not the purpose of this patch).
> >>>
> >>> Additionally STI-shadow only blocks maskable interrupts, but not NMI.
> >>
> >> I've found the Table 25-3 on Intel SDM vol3 quite helpful:
> >>
> >> "Execution of STI with RFLAGS.IF = 0 blocks maskable interrupts on the
> >> instruction boundary following its execution.1 Setting this bit
> >> indicates that this blocking is in effect."
> >>
> >> And:
> >>
> >> "Execution of a MOV to SS or a POP to SS blocks or suppresses certain
> >> debug exceptions as well as interrupts (maskable and nonmaskable) on
> >> the instruction boundary following its execution."
> >>
> >> Might be worth adding to the commit message IMO.
> > 
> > So I've found a further footnote that contains:
> > 
> > "Nonmaskable interrupts and system-management interrupts may also be
> > inhibited on the instruction boundary following such an execution of
> > STI."
> > 
> > So we want to take the more restrictive implementation of STI-shadow,
> > and block #NMI there also.
> 
> Hmm, that text says "may", not will, and imo STI affecting NMI can at best
> be viewed as a quirk (quite possibly intentional, for simplifying some
> internal logic on the processor).

Possibly, but a guest expecting such behavior and Xen not emulating it
would most likely lead to a crash, while forcing the other way around
(Xen blocking NMIs on STI shadow unconditionally) is not likely to
cause issues for OSes not relying on it.

> Plus I'm not convinced AMD allows similar
> leeway in SVM; at least I can't spot any similar statement in their PM.

Hard to tell, in any case I would apply the same reasoning as above,
as IMO implementing STI shadow blocking NMIs is the safer option, and
is what Xen has been doing so far without reported issues that I know
of.

Thanks, Roger.



 


Rackspace

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