From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752028AbcDFQ5o (ORCPT ); Wed, 6 Apr 2016 12:57:44 -0400 Received: from mail.skyhub.de ([78.46.96.112]:34787 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750943AbcDFQ5n (ORCPT ); Wed, 6 Apr 2016 12:57:43 -0400 Date: Wed, 6 Apr 2016 18:57:38 +0200 From: Borislav Petkov To: Alexander Shishkin Cc: Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, vince@deater.net, eranian@google.com, Arnaldo Carvalho de Melo Subject: Re: [PATCH] perf/x86/intel/pt: Use boot_cpu_has() because it's there Message-ID: <20160406165738.GK12070@pd.tnic> References: <1459953307-14372-1-git-send-email-alexander.shishkin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1459953307-14372-1-git-send-email-alexander.shishkin@linux.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 06, 2016 at 05:35:07PM +0300, Alexander Shishkin wrote: > At the moment, initialization path is using test_cpu_cap(&boot_cpu_data), > to detect PT, which is just open coding boot_cpu_has(). Use the latter > instead. > > Signed-off-by: Alexander Shishkin > --- > arch/x86/events/intel/pt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c > index 32b613e863..7c7f09a8fe 100644 > --- a/arch/x86/events/intel/pt.c > +++ b/arch/x86/events/intel/pt.c > @@ -1159,7 +1159,7 @@ static __init int pt_init(void) > > BUILD_BUG_ON(sizeof(struct topa) > PAGE_SIZE); > > - if (!test_cpu_cap(&boot_cpu_data, X86_FEATURE_INTEL_PT)) > + if (!boot_cpu_has(X86_FEATURE_INTEL_PT)) > return -ENODEV; > > get_online_cpus(); > -- Acked-by: Borislav Petkov Btw, there's another wonderful gem in the tree: arch/x86/kernel/cpu/cyrix.c:201: if (test_cpu_cap(c, 1*32+24)) { Jeez, and a naked number at that which is not even a define in arch/x86/include/asm/cpufeatures.h Ah, I need to look at the whole thing: /* Cyrix used bit 24 in extended (AMD) CPUID for Cyrix MMX extensions */ if (test_cpu_cap(c, 1*32+24)) { clear_cpu_cap(c, 1*32+24); set_cpu_cap(c, X86_FEATURE_CXMMX); } So it is actually a correction for "smart" hw. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.