Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1066353ybl; Wed, 14 Aug 2019 10:09:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzaCwe42Ckq1Ox5+OuWDw7fnN8DO0sSAVrWdK6/AEpgC1Wf9uis6Wne8nsWrZLz3y14U7c8 X-Received: by 2002:a65:64c5:: with SMTP id t5mr221675pgv.168.1565802584633; Wed, 14 Aug 2019 10:09:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802584; cv=none; d=google.com; s=arc-20160816; b=mJNr82wLtnCVwp9nKaUbKeRl1HoalZ+CWLqebQ/GIKhkTsE+I0C0fNh2sJUIotbl0t G579MXZmpfwJlUH6n5df/DYMSJhgx+A1WXpjc8TZWd1JJFtYq5rzXzHdrpQTFB6+6y8Z LtuFDDlHS/2Gd2dsZ8s26d2bJCU8pVSLcv7lEV7+d3XY7qjCK69FNcg5NU/7wcuLwoKL DeBi8z/8hDp4HhsdXek4gKQn8o55ulgqVLG4KoVBwNzPZa8otPmIpGjx1kXNMF2MyS57 FjDOgdwPHkeTtFpb+zXnGS6Luvx9TMaLfEmva5KN9m+tX7Y001UgAGT5JXgUgLByidzg eO1Q== 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=w8tTAX1tlm6Zy3dF+2b2k16WeTkaDQMQGClTV6shjBI=; b=CbeAg0ynNAJCeaDnRbB2FxsJ32Ts9+nmhxktVGbBfkTnIT+8BVXTRVbBvMnxssyaFi uu2gpQ70BGjCogWNphFYw3thBWB1vJ04XCYJ+GxMjJ2A1hhWRSWRgglc3pYr/NN5l61D uq7ZOnsotS8JYv5IGFqpv7+KGH0BF3nbCUgHGUnEVkT7dnnBWLuB0VGuxe5KlQ8Ug31W okQ65H+gF5IFITz83WPl9+LQ/GUNPdUxTidHyhKE7afrQyvnKWnyuBl0a+EXKLuNF6NH PEfEkpI2D9sCCN/8md9W0w4d9ehffRbETvzVTxqgmTR7CrE4Kj2o4ocJZjdBUOB0qVCM luww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Pgg80KAx; 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 x12si180623pgq.220.2019.08.14.10.09.28; Wed, 14 Aug 2019 10:09:44 -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=Pgg80KAx; 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 S1730127AbfHNRIY (ORCPT + 99 others); Wed, 14 Aug 2019 13:08:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:58346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730128AbfHNRIV (ORCPT ); Wed, 14 Aug 2019 13:08:21 -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 1CAE22133F; Wed, 14 Aug 2019 17:08:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802500; bh=8d+DXjxnTBnpLKRX5659bJcWsiMINxWaioAMrxT+YZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pgg80KAxm8uc9x2/uWB20X38pCdmD2IYiTPLF7KUlIYKDKKbNDs0gatlB6M4cVGfM +OJgmo7979wjFLw8rDHk9ROlr720nF2SZheRULjQOjwPMgJncj2S+5b570m3pTzwOJ qAjzexj4NCzgllQ5cJRwB5fZloSjEvi2YsFHuLxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhenzhong Duan , "Peter Zijlstra (Intel)" , Alexander Shishkin , Arnaldo Carvalho de Melo , Boris Ostrovsky , Borislav Petkov , Jiri Olsa , Juergen Gross , Linus Torvalds , Namhyung Kim , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 5.2 114/144] perf/x86: Apply more accurate check on hypervisor platform Date: Wed, 14 Aug 2019 19:01:10 +0200 Message-Id: <20190814165804.682059835@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@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 5ea3f6fb37b79da33ac9211df336fd2b9f47c39f ] check_msr is used to fix a bug report in guest where KVM doesn't support LBR MSR and cause #GP. The msr check is bypassed on real HW to workaround a false failure, see commit d0e1a507bdc7 ("perf/x86/intel: Disable check_msr for real HW") When running a guest with CONFIG_HYPERVISOR_GUEST not set or "nopv" enabled, current check isn't enough and #GP could trigger. Signed-off-by: Zhenzhong Duan Signed-off-by: Peter Zijlstra (Intel) Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Boris Ostrovsky Cc: Borislav Petkov Cc: Jiri Olsa Cc: Juergen Gross Cc: Linus Torvalds Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Thomas Gleixner Link: https://lkml.kernel.org/r/1564022366-18293-1-git-send-email-zhenzhong.duan@oracle.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- arch/x86/events/intel/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index e9042e3f3052c..6179be624f357 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "../perf_event.h" @@ -4057,7 +4056,7 @@ static bool check_msr(unsigned long msr, u64 mask) * Disable the check for real HW, so we don't * mess with potentionaly enabled registers: */ - if (hypervisor_is_type(X86_HYPER_NATIVE)) + if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) return true; /* -- 2.20.1