From patchwork Mon Oct 21 23:56:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 11203215 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD8B8112B for ; Mon, 21 Oct 2019 23:56:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C00F72166E for ; Mon, 21 Oct 2019 23:56:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730065AbfJUX4s (ORCPT ); Mon, 21 Oct 2019 19:56:48 -0400 Received: from mga07.intel.com ([134.134.136.100]:63371 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728819AbfJUX4s (ORCPT ); Mon, 21 Oct 2019 19:56:48 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Oct 2019 16:56:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,325,1566889200"; d="scan'208";a="222630834" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.41]) by fmsmga004.fm.intel.com with ESMTP; 21 Oct 2019 16:56:47 -0700 From: Sean Christopherson To: Tony Luck , Borislav Petkov , Thomas Gleixner , Ingo Molnar , x86@kernel.org Cc: "H. Peter Anvin" , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , kvm@vger.kernel.org, Sean Christopherson Subject: [PATCH v2 02/16] x86/mce: WARN once if IA32_FEATURE_CONTROL MSR is left unlocked Date: Mon, 21 Oct 2019 16:56:42 -0700 Message-Id: <20191021235642.418-1-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20191021234632.32363-1-sean.j.christopherson@intel.com> References: <20191021234632.32363-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org WARN if the IA32_FEATURE_CONTROL MSR is somehow left unlocked now that CPU initialization unconditionally locks the MSR. Cc: Vitaly Kuznetsov Cc: Wanpeng Li Cc: Jim Mattson Cc: kvm@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Borislav Petkov --- arch/x86/kernel/cpu/mce/intel.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/intel.c b/arch/x86/kernel/cpu/mce/intel.c index 88cd9598fa57..1008f14b803b 100644 --- a/arch/x86/kernel/cpu/mce/intel.c +++ b/arch/x86/kernel/cpu/mce/intel.c @@ -117,11 +117,10 @@ static bool lmce_supported(void) * generate a #GP fault. */ rdmsrl(MSR_IA32_FEATURE_CONTROL, tmp); - if ((tmp & (FEATURE_CONTROL_LOCKED | FEATURE_CONTROL_LMCE)) == - (FEATURE_CONTROL_LOCKED | FEATURE_CONTROL_LMCE)) - return true; + if (WARN_ON_ONCE(!(tmp & FEATURE_CONTROL_LOCKED))) + return false; - return false; + return tmp & FEATURE_CONTROL_LMCE; } bool mce_intel_cmci_poll(void)