Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp46483pxy; Tue, 4 May 2021 18:12:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKbiDKaCuJW04+INdsQ5MchfQ0om2nsfDhNmhv2cbxhfDHd6puMhN286gqglVmdbaPdvK9 X-Received: by 2002:a17:902:d2d2:b029:ee:4684:b64a with SMTP id n18-20020a170902d2d2b02900ee4684b64amr28659369plc.12.1620177150668; Tue, 04 May 2021 18:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620177150; cv=none; d=google.com; s=arc-20160816; b=CbuwyO3fRvE+JQUkUvkIo7HlVFULhI00jvRJZrDtm2m8mRTPOrLX4NifuFt00ZOMHN 3xh8yq20aaCq9htgC/YwaxHiuv4wX53QI0YEtGLIhOS2Wb1jxFglnxFa9UDXsYqAfUd/ bi69+ikQmN0mEvsIQ6vVRp3o1RJfQjHa72iIw3uJKqRYABaGSyX/GDdZxktKmQWi3Nn9 YnsFLoU6Zz0sdWXWF8FVjz9RRQTNzE4UGz8t8kV1rVJXwiClux5C/GhvEWDS6iTfaolG oTILQO3Zr17HawBu6KnkNiYZ3xNLzhjhKB0Xeb4QA+2An+YEP8JwMFa0ZFR73Dujkt1t N1bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:cc:references:message-id:date :subject:mime-version:from:content-transfer-encoding:dkim-signature; bh=ZTESUAJHff3rHiE1iQkDnV/NFjY5nd2nPE1FAwGRmjQ=; b=eNNF7Zy98ydEoHDjhzTioxDuv1Je9S9CCK5jr6iksMB9oOGrGUpoyrAeb+i3JpG3Ej m3R9iw0Odq6ny8q0H705sXcDDkrsVL+m/UOG4VENEDSHJtZxlKP9TODg+5CkyZBLTpRk e40Tt6/eexIUHw6FIsnymHNrFPqebl5EZ5MT61U40wOKgISPICJ2ecJBECBm7VgXijxC 0pcvpVhLtXqWqP4jDP55Nwngr15rfW3vt3Mg8o4X3bVR8lNcAhyBIuYxGaWTPTFuR/Xe WCnf1Z7WsCznBlsZxk+QTXmFHjMkeU8VI2vV15O4U4NkFiqDnEy7r2dub8EunEDnHo9N 9H7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="l/zgfqAG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si5953921pgv.151.2021.05.04.18.12.14; Tue, 04 May 2021 18:12:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="l/zgfqAG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231778AbhEEBMc (ORCPT + 99 others); Tue, 4 May 2021 21:12:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231408AbhEEBMb (ORCPT ); Tue, 4 May 2021 21:12:31 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EFE4C061574 for ; Tue, 4 May 2021 18:11:35 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id n16so243292plf.7 for ; Tue, 04 May 2021 18:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=ZTESUAJHff3rHiE1iQkDnV/NFjY5nd2nPE1FAwGRmjQ=; b=l/zgfqAGkgB7vlL0PDLMPEZIJlENnIokEpGmg2KornzaXhgFm1wB11bLrk55TNitNh UdLfrjHeYshWzFmYK7lwXFTqsDraVgaoAuZDsbpZPJ8vP2nSRuRK2YdvAl43ACphfMsi /ZnWjOdKj2g85eeUuH8v2mcD6SHtDSpV0iYJiGAZPd/BTSMeofqRNRxsWPlpdq/SLAFR X9V5wZHwKucLyaaqigIledcoHEJ+Ry2G8wS27JwZ/Sj59Vw1f7NtcG34wvs2Cskame9W /Y92W/vQN47vX2GeWzFEYdkaCEYRyBK4/RfndWLKhokzj9WkoW7SnoLBOgXa/FroZVpg 8uAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=ZTESUAJHff3rHiE1iQkDnV/NFjY5nd2nPE1FAwGRmjQ=; b=XCRhpOuxQ0/rQG4/1zaVKkCTd4uM8DBmiib4UTMJib0hJ5Z5ncIjoDVIeosgPQ+ZOx 9qo9Eg4jnT/2U/eN1BUfZt0pFiB5IsfHEJqc2TIEdzoDhEbUOx2SQopaFWv0sosx/311 oSfEeqYmy7ceReUKppu+DVBm2Qe+4MZZuYLo3oBxNkiOFE/4AmeZbx87Aky6suFIE79c LAVu4UMCoauTNcoYigkN5AFGcP2MDZN4QDX0VOTJgxn9VZWSRIYAZHUn8dJ+kEu2mVGN xKPURlYoEhXKkXEtEV156KuIAPgxH2he0Bz73NN8OlLsPFcZLOLa63dZ0ofDzck9hi8k ubIw== X-Gm-Message-State: AOAM533qJo1zzx+UXVg87S2x1U5Ut5ddKAel0G9xTincXK46EwkmyboO QgvWsiHPDa7kGtCDBDCkerlCUg== X-Received: by 2002:a17:902:9002:b029:e6:c95f:2a1d with SMTP id a2-20020a1709029002b02900e6c95f2a1dmr28821032plp.79.1620177094861; Tue, 04 May 2021 18:11:34 -0700 (PDT) Received: from smtpclient.apple ([2601:646:c200:1ef2:cd99:8d1d:1c8b:22c9]) by smtp.gmail.com with ESMTPSA id a190sm13964079pfd.118.2021.05.04.18.11.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 May 2021 18:11:34 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] KVM/VMX: Invoke NMI non-IST entry instead of IST entry Date: Tue, 4 May 2021 18:11:33 -0700 Message-Id: <2FB0C052-A998-4510-8BBA-6B48AC86E4C8@amacapital.net> References: Cc: Sean Christopherson , Paolo Bonzini , Maxim Levitsky , Thomas Gleixner , LKML , Lai Jiangshan , Steven Rostedt , Andi Kleen , Andy Lutomirski , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Josh Poimboeuf , Uros Bizjak , Ingo Molnar , Borislav Petkov , X86 ML , "H. Peter Anvin" , Peter Zijlstra , Alexandre Chartre , Juergen Gross , Joerg Roedel , Jian Cai In-Reply-To: To: Lai Jiangshan X-Mailer: iPhone Mail (18E199) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 4, 2021, at 6:08 PM, Lai Jiangshan wrote: >=20 > =EF=BB=BFOn Wed, May 5, 2021 at 5:23 AM Andy Lutomirski wrote: >>=20 >>=20 >>>> On May 4, 2021, at 2:21 PM, Sean Christopherson wro= te: >>>=20 >>> =EF=BB=BFOn Tue, May 04, 2021, Paolo Bonzini wrote: >>>>> On 04/05/21 23:05, Maxim Levitsky wrote: >>>>> Does this mean that we still rely on hardware NMI masking to be activa= ted? >>>>=20 >>>> No, the NMI code already handles reentrancy at both the assembly and C >>>> levels. >>>>=20 >>>>> Or in other words, that is we still can't have an IRET between VM exit= and >>>>> the entry to the NMI handler? >>>>=20 >>>> No, because NMIs are not masked on VM exit. This in fact makes things >>>> potentially messy; unlike with AMD's CLGI/STGI, only MSRs and other thi= ngs >>>> that Intel thought can be restored atomically with the VM exit. >>>=20 >>> FWIW, NMIs are masked if the VM-Exit was due to an NMI. >>=20 >> Then this whole change is busted, since nothing will unmask NMIs. Revert i= t? >=20 > There is some instructable code between VMEXIT and > handle_exception_nmi_irqoff(). >=20 > The possible #DB #BP can happen in this gap and the IRET > of the handler of #DB #BP will unmask NMI. >=20 > Another way to fix is to change the VMX code to call the NMI handler > immediately after VMEXIT before leaving "nostr" section. >=20 > Reverting it can't fix the problem. I was indeed wrong, and the helper properly unmasks NMIs. So all should be w= ell. I will contemplate how this all interacts with FRED.=