Message ID | 20221114233441.3895891-4-seanjc@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2421777wru; Mon, 14 Nov 2022 15:41:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf5gOifDmKqsCqDv3/wfFf3l63UBu1lxQYKAtLiarbom0fSJRuNwks9Rg04giKvMY/ULkhLs X-Received: by 2002:a17:906:c56:b0:7ad:88f8:68fb with SMTP id t22-20020a1709060c5600b007ad88f868fbmr12098530ejf.277.1668469298010; Mon, 14 Nov 2022 15:41:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668469298; cv=none; d=google.com; s=arc-20160816; b=zfcF6e8dZhpVrSjJYexm23BHCX1iAeqbg0vg+DnPSxr3lTcRWMPuPZFZbwzUv23rD0 oCzaXOudimB2/SQPcwVG/+QiHQi7e1GFHPRAJB6IJTu4dQeQhaPIeMIeQHhJHznoKNMf 7tSwxZuq3t4g8RmbeqHxdAfDg7Tc64AWMag/hPJtsi3o3/DIo2Dzx2ha8lKJk1FNzsd+ YLbvaiJ4jWJWEgpp1uM5Fm1Yf1Aqud7yIQthQlJbw59kvY6361xVKvKXzGJbBy5j2nTs IJccjywnv1wdnTbLH0qc4cdglIOosVo4uBW7SnE7LuFblQ72sco8tRHUA9T5yL1wpqEM 920Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=CuKvIMG0gJXVjX3tbXmKavICyGNlOF16asBACO4qrT8=; b=Fsy2t6+s3XBe3nF0DP5Yld5sq8980d+VT1yBHLA/mKEAiHSASSumS4ALCvYRwC7DwD f6LwxOYivKHuaCtI16VZ1fQPSNE3OyeeKsj2R0OWN+1MBRCUoAX8y5ZSqZGb2+4SWTJO uZcNXfPbB5G+mxNCQ33GRyZbwifrrlOIBJLsJ8I4GsBbYzTkia6zt3gSUlFZtD6pEw8g 7YnJX/QCQjlFmj699/4wEMwmlE0yZ8k9gcHJinxduV2AoWrKk5sAK+ONp0E9Is/dtlnp 0C0RQSDdFqAlUokGc4s2bM6Is//dEam5lUD48LvTVi/uRE2jdX8QipXva1c9LocQqX/B tAdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=aX7xVD9d; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a05640225c300b00462e9b337c2si9153127edb.464.2022.11.14.15.41.14; Mon, 14 Nov 2022 15:41:37 -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=@google.com header.s=20210112 header.b=aX7xVD9d; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237288AbiKNXe7 (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 14 Nov 2022 18:34:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236646AbiKNXeu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 18:34:50 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 168719FD8 for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 15:34:49 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id q6-20020a170902dac600b001873ef77938so10010167plx.18 for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 15:34:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=CuKvIMG0gJXVjX3tbXmKavICyGNlOF16asBACO4qrT8=; b=aX7xVD9dcMcvK8lTJzwcwroZfbH8mtqoObt1cLCfIfNBrnQLxxBOraVlNmlV1JCA8v T3RIatPfsiUm6v2ocVOy7mhJafHTgtZ/VxsTTQp4gkDjXNVCByn+Gft5BNWQjK8VvPoa OV1L+vFy/ScifZSCgMAqJ3BHKVSXSWzbhwvw/n+gx8DJryuZ7UOckJDB4I8E43ujvfn2 HYWG8yhQlTGAQawT97Wi62I9/RKDpDdFA/hILuQIw19xUYAKRZazPOG1geJPc9C6vbR7 GpW4Us68LKM+T8+3KHHykvt/rS1LtQ1C9k/XLH7wC6gTVyGcq7RVthPp7zc7a4+0mzOS u8HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CuKvIMG0gJXVjX3tbXmKavICyGNlOF16asBACO4qrT8=; b=HwYPt2Geu3jzjPxsNrQBVxlwvFsSKFIt6IcdflvrfqbPlSRP15AsviCrWrHNbpuX9j 0Fx+8ih/jxKjyRbP/+ZKcdzuh4IHcciPVsOZ2ucZbqHWS5VCBw3AbJzam+bP1UnNdL4H hsWs59aks2+eejaJV6yW00PcEDe7XshZ4kLJ3Hyc2EIGTXJKXhyWa/cbZHUIRmS5Mf+C MEDiWYjxn1+EbN/cpNcH/K770NeZ4an9gybbV+xqhj4eyCiIUU3wtV9PXyeuL27p326e KWEujnxE2HVj6fGkFy6pAYUWMSH46XWhAqe8ifmjj0VuSgBKq0OWek1ITnwXSd0Ez5mF vCew== X-Gm-Message-State: ANoB5pldMwLSqE3R0IISVO4mKr2avxyDSJAIo7sRMcZYs7mfmaMzPVcW ma5OZoU9AdJW5go9pd8cuRyNiCNozsw= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a62:1dd8:0:b0:572:24c7:34da with SMTP id d207-20020a621dd8000000b0057224c734damr6261309pfd.73.1668468889489; Mon, 14 Nov 2022 15:34:49 -0800 (PST) Reply-To: Sean Christopherson <seanjc@google.com> Date: Mon, 14 Nov 2022 23:34:41 +0000 In-Reply-To: <20221114233441.3895891-1-seanjc@google.com> Mime-Version: 1.0 References: <20221114233441.3895891-1-seanjc@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221114233441.3895891-4-seanjc@google.com> Subject: [PATCH v3 3/3] x86/virt: Fold __cpu_emergency_vmxoff() into its sole caller From: Sean Christopherson <seanjc@google.com> To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org Cc: "H. Peter Anvin" <hpa@zytor.com>, linux-kernel@vger.kernel.org, "Guilherme G . Piccoli" <gpiccoli@igalia.com>, Vitaly Kuznetsov <vkuznets@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Tom Lendacky <thomas.lendacky@amd.com>, Sean Christopherson <seanjc@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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?1749516862316051757?= X-GMAIL-MSGID: =?utf-8?q?1749516862316051757?= |
Series |
x86/crash: Fix double NMI shootdown bug
|
|
Commit Message
Sean Christopherson
Nov. 14, 2022, 11:34 p.m. UTC
Fold __cpu_emergency_vmxoff() into cpu_emergency_vmxoff(), its sole
remaining caller, to discourage crash/emergency code from handling VMX
but not SVM. The behavior of VMX and SVM is so similar that it's highly
unlikely that there will be a scenario where VMX needs to be disabled,
but SVM can be left enabled. In other words, during a crash and/or
emergency reboot, funnel all virtualization teardown sequences through
cpu_crash_disable_virtualization().
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
arch/x86/include/asm/virtext.h | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h index 8757078d4442..a9414ef5269e 100644 --- a/arch/x86/include/asm/virtext.h +++ b/arch/x86/include/asm/virtext.h @@ -60,22 +60,12 @@ static inline int cpu_vmx_enabled(void) return __read_cr4() & X86_CR4_VMXE; } -/** Disable VMX if it is enabled on the current CPU - * - * You shouldn't call this if cpu_has_vmx() returns 0. - */ -static inline void __cpu_emergency_vmxoff(void) -{ - if (cpu_vmx_enabled()) - cpu_vmxoff(); -} - /** Disable VMX if it is supported and enabled on the current CPU */ static inline void cpu_emergency_vmxoff(void) { - if (cpu_has_vmx()) - __cpu_emergency_vmxoff(); + if (cpu_has_vmx() && cpu_vmx_enabled()) + cpu_vmxoff(); }