Message ID | 20230302052511.1918-35-xin3.li@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4067386wrd; Wed, 1 Mar 2023 22:05:08 -0800 (PST) X-Google-Smtp-Source: AK7set8EChU7ztE02n5sTJ4JWffJLAtSU80bLBxvvgx72sKvMH+MRwxK4RhvUn3g1ADu1e9Kexxw X-Received: by 2002:a17:90a:190d:b0:237:659a:a456 with SMTP id 13-20020a17090a190d00b00237659aa456mr10076628pjg.49.1677737108561; Wed, 01 Mar 2023 22:05:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677737108; cv=none; d=google.com; s=arc-20160816; b=VNFgt1ccZTEkZb2skCpS88VQKt3iCeNwIncgNplPNqn3iHzKObMyyD26d77dFkG+QI 9FVB4D/OPgjkbFRPLkzMlVVKDKMyDeZEh58Qpo9qZ347cXwYX3IYQx7VjMhp030QIhaN qAbqWSUvwPiLzN+bcvCIHCC6AtEsO64pvpsE2IblmAiyDwO1bIANehoL0G6orUT6mxtW I46Kx6HVsokmyok2Yp5WcycsFdQqnQEHCOiAiVJ5kTGqxxT/2jJQQvmETTea+svcfIKd qwbF24WMzp8Xf72DpnYtM6ZuqRQ9kGeoDpjIGwOWZTqd4oUhk8sn2UMQNG+w1yxQwxa8 o6/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qNazW7SX8KMj5ZY7lzPccvEmZuUliNNIPrFxMrj6GD4=; b=vqBud4NTMeVJs+yF1esVyBdLGGhIf4rgpAJpQnbdCLUADqqHyNYy9PKHgVCoy54u7N Jo7LVv6TrjL1gL+GZ1o8mCTXeNI/C30Eft8yZMaFVeJPoLa/G6uMkayBP2lWE/Jit5Yb iTyjIbguoGVOiRq+tv/9WaYRd9Cyy/7NbehKVMlYbe2ejW4JJJk4pMH3L670hFCAL/lr u4slNCz/tAXhLHLRRt0Gj5EUNwy4DwOjZ+U2ehBiBz36TQLtnQgGi/CZaRUpWHhktIbK 2zWk1tW77dAm+b/s8JXGaNh2u56zxzSKmUcIjZ6cbWwHO5rix/TL/+acnLuk80frl72V qYzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iM7D+6tm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ci22-20020a17090afc9600b0023027272515si1547484pjb.101.2023.03.01.22.04.52; Wed, 01 Mar 2023 22:05:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iM7D+6tm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230210AbjCBFxP (ORCPT <rfc822;davidbtadokoro@gmail.com> + 99 others); Thu, 2 Mar 2023 00:53:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229620AbjCBFwj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 2 Mar 2023 00:52:39 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D42F656512; Wed, 1 Mar 2023 21:51:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677736296; x=1709272296; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GKXTMdUzJkVqC+CQLNZb60zKnOqG48lGuDswKhO/vhg=; b=iM7D+6tmWbngB+ozKYoez+Sjj5eS96l2s7u3MhLA+ehoPe1/0BVktJiR UmSkaDDo8MPeFpQqSUGlauWrqPtastnmLFd11Gm/gDE/TFmkQKrf0Ji48 shIUEd18M92hNCfz9t5b4gePB4e0eH07pPHaUbfeVWhdGgutABtURPb4B 1h/RnYBPw9W1SZ28dn9RNe/yFajNUaQdOm17ISkZrz4HpJ28AWn53f4u0 UhI4OLxrBUhD6+F+kiC8s3m7sCqBC26Tci4NB0k1jnD2U2l8n/zcEAOQc DakJqKcyOZt09qYsZgFN/nG4NJMGTEFpNMJr7R0R/0fNULDE0WlPNmcbb Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10636"; a="420887335" X-IronPort-AV: E=Sophos;i="5.98,226,1673942400"; d="scan'208";a="420887335" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2023 21:50:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10636"; a="920530987" X-IronPort-AV: E=Sophos;i="5.98,226,1673942400"; d="scan'208";a="920530987" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmsmga006.fm.intel.com with ESMTP; 01 Mar 2023 21:50:52 -0800 From: Xin Li <xin3.li@intel.com> To: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, peterz@infradead.org, andrew.cooper3@citrix.com, seanjc@google.com, pbonzini@redhat.com, ravi.v.shankar@intel.com Subject: [PATCH v4 34/34] KVM: x86/vmx: execute "int $2" for NMI reinjection when FRED is enabled Date: Wed, 1 Mar 2023 21:25:11 -0800 Message-Id: <20230302052511.1918-35-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230302052511.1918-1-xin3.li@intel.com> References: <20230302052511.1918-1-xin3.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759234866517585234?= X-GMAIL-MSGID: =?utf-8?q?1759234866517585234?= |
Series |
x86: enable FRED for x86-64
|
|
Commit Message
Li, Xin3
March 2, 2023, 5:25 a.m. UTC
Execute "int $2" for NMI reinjection when FRED is enabled. Tested-by: Shan Kang <shan.kang@intel.com> Signed-off-by: Xin Li <xin3.li@intel.com> --- arch/x86/kvm/vmx/vmx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On Wed, Mar 01, 2023, Xin Li wrote:
> Execute "int $2" for NMI reinjection when FRED is enabled.
This needs an explanation of _why_. And as requested earlier[*], please avoid
"reinjection" in this context.
[*] https://lore.kernel.org/all/Y20f8v9ObO+IPwU+@google.com
> > Execute "int $2" for NMI reinjection when FRED is enabled. > > This needs an explanation of _why_. And as requested earlier[*], please avoid > "reinjection" in this context. W/ FRED, we use ERETS to unblock NMI when returning from a NMI handler (Setting bit 28 of CS). And there are 2 approaches to do it: 1) "int $2", let the h/w do the job for us. 2) create a FRED stack frame, and then jump to fred_entrypoint_kernel in arch/x86/entry/entry_64_fred.S. I prefer "INT $2", what is your opinion? > [*] https://lore.kernel.org/all/Y20f8v9ObO+IPwU+@google.com
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 30f854015c8c..b9644bd37672 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7229,7 +7229,10 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu, if ((u16)vmx->exit_reason.basic == EXIT_REASON_EXCEPTION_NMI && is_nmi(vmx_get_intr_info(vcpu))) { kvm_before_interrupt(vcpu, KVM_HANDLING_NMI); - vmx_do_nmi_irqoff(); + if (cpu_feature_enabled(X86_FEATURE_FRED)) + asm volatile("int $2"); + else + vmx_do_nmi_irqoff(); kvm_after_interrupt(vcpu); }