From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754158AbbKLK4Q (ORCPT ); Thu, 12 Nov 2015 05:56:16 -0500 Received: from mail.skyhub.de ([78.46.96.112]:48379 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751048AbbKLK4P (ORCPT ); Thu, 12 Nov 2015 05:56:15 -0500 From: Borislav Petkov To: LKML Cc: Alexander Shishkin , Arnaldo Carvalho de Melo , "H. Peter Anvin" , Ingo Molnar , Paolo Bonzini , Paul Gortmaker , "Peter Zijlstra (Intel)" , Thomas Gleixner Subject: [PATCH] perf/x86/intel/pt: Test CPU vendor before loading Date: Thu, 12 Nov 2015 11:56:12 +0100 Message-Id: <1447325772-4799-1-git-send-email-bp@alien8.de> X-Mailer: git-send-email 2.3.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov This keeps poking at MSR 0x570 when loading, i.e. MSR_IA32_RTIT_CTL, which is most likely not present on other vendors. It is using the _safe variant but there's no need to try it at all, really. Besides, it causes unhandled rdmsr warnings when booting in a guest: kvm [4414]: vcpu0 unhandled rdmsr: 0x570 So check CPU vendor before doing anything else. Signed-off-by: Borislav Petkov Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Paolo Bonzini Cc: Paul Gortmaker Cc: "Peter Zijlstra (Intel)" Cc: Thomas Gleixner --- arch/x86/kernel/cpu/perf_event_intel_pt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kernel/cpu/perf_event_intel_pt.c b/arch/x86/kernel/cpu/perf_event_intel_pt.c index 42169283448b..fa1262b025e7 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_pt.c +++ b/arch/x86/kernel/cpu/perf_event_intel_pt.c @@ -1129,6 +1129,9 @@ static __init int pt_init(void) { int ret, cpu, prior_warn = 0; + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) + return 0; + BUILD_BUG_ON(sizeof(struct topa) > PAGE_SIZE); get_online_cpus(); for_each_online_cpu(cpu) { -- 2.3.5