Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2382022pxj; Mon, 10 May 2021 01:17:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiYAu1wOAknkHUQEd91PykkinOcQyNhXvcN4m0pvOSuE3V3fpcm8vHl3OoWyXq37iLPDcr X-Received: by 2002:a17:906:600b:: with SMTP id o11mr24369229ejj.345.1620634674347; Mon, 10 May 2021 01:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620634674; cv=none; d=google.com; s=arc-20160816; b=eeITYGjStidCBpCazbefyUOqI5yciWTmsmQQqOtyHygqvhzZHUyLjz7c08dklViKb5 ovf2iuujsnwRqgvftDnHDMcwjmfoXzwjZi26/LY2okMIqQ8wdfw3738Nmnk+uxbXMoiU LZ6lBRGMke+I7bxEh8V1y/8/jLfMuo/dq8+RaqJedCTUb6fBKX98LmUqZQW20mA4kSio 3QC+36uHPOlttowrsrRA+P+g3cLcfdLf+FfciQYHE6bDz7tw1Jd7Mld9PGL5RStMw/iF VcoPLb7FCh7Lt42M923UTSjCl93ALgNgZ2QjhZPbOYn/U4D2pZvBj3UDfKOaejUoTS5S moGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=TKtMVl/TUtR+t/lrZIj+Lmt2mtJT7o2pZW5/ZltpIBE=; b=eCuoEQTgfniCyasG1E5AcMey6m09WzpJDi76dSjcCr5V6EcTknX/FWmo9U741i1BFH KH7WPXY9SGUqLNChkA+mPJo4/DGzi4c5MdSwH11FDYUz4HQ9hPNHrGM0TR8a+rvnaCLd uFse5TfiJDSkt72VgxjZMNRFvyayPNNj/sPt7OECUi4aVR1X1I2LPIRbAd27BNtdaPuv 5rv2Qb6HmO/Q1DaNcOfrH4ZOz4BBQX/486bvz/d7e2mzXZCrox0zHFrQiMZ66ky9T8ST 1YoavWFmiscY3bUEW1vVYft+I6Qc1jsCqf6oBau1mQzvX0wrAQv4Pz8V4bPLDte7DESf dDzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si12615873edv.323.2021.05.10.01.17.31; Mon, 10 May 2021 01:17:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230303AbhEJIR2 (ORCPT + 99 others); Mon, 10 May 2021 04:17:28 -0400 Received: from mga12.intel.com ([192.55.52.136]:42725 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbhEJIRY (ORCPT ); Mon, 10 May 2021 04:17:24 -0400 IronPort-SDR: irgHUCP+pi/KOdz31tcXZyLLt0g9LUTahvhrqCFve06xM+s8RhXUmNqDke6TG+hgw1PCA17zc2 xtzpnhe5hAIQ== X-IronPort-AV: E=McAfee;i="6200,9189,9979"; a="178727712" X-IronPort-AV: E=Sophos;i="5.82,287,1613462400"; d="scan'208";a="178727712" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2021 01:16:20 -0700 IronPort-SDR: aLMjuCWxkdtueGauxz32PbYY6B7SecmQ3xBrnYSUHeED0Eardur8N+5qsns/4hivfBkgWzsIrD VaH6KjnXRqdA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,287,1613462400"; d="scan'208";a="408250838" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by orsmga002.jf.intel.com with ESMTP; 10 May 2021 01:16:18 -0700 From: Like Xu To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , weijiang.yang@intel.com, wei.w.wang@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH v4 02/10] perf/x86/lbr: Simplify the exposure check for the LBR_INFO registers Date: Mon, 10 May 2021 16:15:26 +0800 Message-Id: <20210510081535.94184-3-like.xu@linux.intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510081535.94184-1-like.xu@linux.intel.com> References: <20210510081535.94184-1-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The x86_pmu.lbr_info is 0 unless explicitly initialized, so there's no point checking x86_pmu.intel_cap.lbr_format. Cc: Peter Zijlstra Signed-off-by: Like Xu Reviewed-by: Kan Liang Reviewed-by: Andi Kleen --- I personally recommend this patch to hit the mainline through the KVM tree. arch/x86/events/intel/lbr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c index 76dbab6ac9fb..f72276f4a5ce 100644 --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c @@ -1833,12 +1833,10 @@ void __init intel_pmu_arch_lbr_init(void) */ int x86_perf_get_lbr(struct x86_pmu_lbr *lbr) { - int lbr_fmt = x86_pmu.intel_cap.lbr_format; - lbr->nr = x86_pmu.lbr_nr; lbr->from = x86_pmu.lbr_from; lbr->to = x86_pmu.lbr_to; - lbr->info = (lbr_fmt == LBR_FORMAT_INFO) ? x86_pmu.lbr_info : 0; + lbr->info = x86_pmu.lbr_info; return 0; } -- 2.31.1