Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10411134ybi; Wed, 24 Jul 2019 22:44:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSXFX0ZY62EZZEY1Be80S1zM7M0jfjIZc8N/eRqTfcl8wDP4uItHszBB0WHgLtQ0r4+tXB X-Received: by 2002:a62:f20b:: with SMTP id m11mr15006073pfh.125.1564033452456; Wed, 24 Jul 2019 22:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564033452; cv=none; d=google.com; s=arc-20160816; b=DHkYTUyoxqqRQlV2WJ2VwUFmqyrav7JmdQBvtStPquXOPvYQZNoOUfkQHKaf7gZaPK hrTSVhUANvCHshnBa3NsfDJOfNhfkkG+zXmK9mCz8dmhbVGHcP005YIt0MNHYKWlnB1v rsfKT0AYDGi0fxqLN6RY0vQC24LpE/9l3uPoOEy5YKEDaHhnGUOjA+CLY8eveXplUNHz MuGXRkZdYOajxVGhPSrgcy2PDAosfe50fdTBEg3Qime8XQBetGCNp2amPTxOMP+fIShq PGNYypEs+S2NjMzP/XbD5jwIySPZd9iXzCG1TpV34kc0Y7Kexgzx5HstIiOWjpJ1N349 HjhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gbhg8pxbz9ImM9kNozMa1ukYbYq3h23Bm48b9cQ8Z/s=; b=Jhuloe5HdSqTMUzWcSjWcstdLZGVhro1BjUiLRI2rEfYuSPOPqMw/sAg5OtlSVvehi ezWoPTjYwoEmaCG9ZD9lniGk7jH45aIjgLzYJLSPIYCERSczCDYUaIJlapcJnVmD9wKQ +rp2xblB7Hfw5W73rPIR/gq5gAoaf5MvPW+vBMh9wchllUTJ0y4KJDU1SiYMtqHPtpW1 R/OLmLXA7k2iJxs+JAa3m7OiZR7rr8CkTzQQ8CCAQzhBELehVa3o1AQnyFPNb2JoVLHs iMVIOZP78qtdZ1Z+VPHwwe/pj2ZnztYXLMA/knjNsQ4Cm+qJ77ZaWAS4387gIAR/lgvb CMgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S8YsiCzR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si16394627plk.87.2019.07.24.22.43.58; Wed, 24 Jul 2019 22:44:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S8YsiCzR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388174AbfGXUf1 (ORCPT + 99 others); Wed, 24 Jul 2019 16:35:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:46134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727737AbfGXT2D (ORCPT ); Wed, 24 Jul 2019 15:28:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 53DA921951; Wed, 24 Jul 2019 19:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996482; bh=QibYDCEWMWCyBeR5MW9G3hSGiuU13D55MQrwyNA4rf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S8YsiCzRGVpV/jFF7hlUAo+aoj4o0MaKzXdy3dzSX1KJFCZX2nfCZrhU2DCpcc9o/ 3EDQImDAO42p15/Lz9aLBmCIIqAkDLR54UA0vX7RicdLQCLKo60HCd2TBj4WK9EHss 4Fmr3g1IvYRd8LuaXFqlNpoqpFj7Z4IoZbq8Na3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Vaden , Jiri Olsa , "Peter Zijlstra (Intel)" , Alexander Shishkin , Arnaldo Carvalho de Melo , Liang Kan , Linus Torvalds , Namhyung Kim , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 5.2 111/413] perf/x86/intel: Disable check_msr for real HW Date: Wed, 24 Jul 2019 21:16:42 +0200 Message-Id: <20190724191743.278360099@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit d0e1a507bdc761a14906f03399d933ea639a1756 ] Tom Vaden reported false failure of the check_msr() function, because some servers can do POST tracing and enable LBR tracing during bootup. Kan confirmed that check_msr patch was to fix a bug report in guest, so it's ok to disable it for real HW. Reported-by: Tom Vaden Signed-off-by: Jiri Olsa Signed-off-by: Peter Zijlstra (Intel) Acked-by: Tom Vaden Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Liang Kan Cc: Linus Torvalds Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Thomas Gleixner Link: https://lkml.kernel.org/r/20190616141313.GD2500@krava [ Readability edits. ] Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- arch/x86/events/intel/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index b6cae65aa7ef..f0c14665893b 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "../perf_event.h" @@ -4054,6 +4055,13 @@ static bool check_msr(unsigned long msr, u64 mask) { u64 val_old, val_new, val_tmp; + /* + * Disable the check for real HW, so we don't + * mess with potentionaly enabled registers: + */ + if (hypervisor_is_type(X86_HYPER_NATIVE)) + return true; + /* * Read the current value, change it and read it back to see if it * matches, this is needed to detect certain hardware emulators -- 2.20.1