Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1579780pxb; Thu, 4 Mar 2021 15:22:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4yh4ekeHf2AW3NfWZCEGAYeUsDIlO/YXAGasc9vEt29tezJpdCFQ8gMTwcYE6MTQBEb30 X-Received: by 2002:a92:cd8a:: with SMTP id r10mr5973888ilb.110.1614900147169; Thu, 04 Mar 2021 15:22:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614900147; cv=none; d=google.com; s=arc-20160816; b=h2fONUNT+dFe6fCqKe05WQS59LYS1LbURxFK/qu5bxvnhZsMNx964TJeFoFAMp/TKC HgmiFhYqV2Cy8qEGAS/WtdeM+c8ZOhQ0Zik5J9+CqAh9l87Fhuj3+j7RZOlZWZSUHBQs UqlITkbYMjyhWcovAt2xuirT1oUcx2t6Zl5rfgMlifMIvCXomEOmnaka4L4WnDuTvLJ6 pe65UZEfNJO+xJHqxYP/NqWJdWel3Onb0wLSEh3ALkwpENjhadIY39PlRoNZ4Lrf8edk TLbKYezJbAjoVTEsxkn73+askMux2Np+IybZA3B6mvEosKi103u9Ra9yI6IEEN5p6/tP RQXw== 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=vlSMN6RdhY3uIDMNJd7BkEKnmgHbw4bAZSKFdPnnnYw=; b=Z3gDFN9JCtm7BjALd4eLq3YUCltbWOGoXqtCnjAA1EU+MDFX93ovD3GeGrrKUkBRh5 zre4WTLqWlUfHP9CBN6ozL7OeSYfiytPzAUb/93J8YoQHRrhzVLOYKU6we0t2/cNncTH Y1JYhjdX1gxPVTq2zfvfLGEHHwc8nEujykIF9IBqf2doSJhXbf2OhAHuEg6PhqH9gKxv Nty/NwOh8JBiM05rwfuF/4TtQHNsXm2L8F0ZYhWp0hepWPk7h3tjoHW9P82hUkjW/YDK DSvXoCdh1HiePHFNH8eJWOh11ajgW/+4MkuGpNaef73WqDPJePJJVVJvuiv4pxVPLBk5 1BYQ== 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 c1si603778ilo.55.2021.03.04.15.22.14; Thu, 04 Mar 2021 15:22:27 -0800 (PST) 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 S1574891AbhCCReZ (ORCPT + 99 others); Wed, 3 Mar 2021 12:34:25 -0500 Received: from mga11.intel.com ([192.55.52.93]:44167 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237820AbhCCOHF (ORCPT ); Wed, 3 Mar 2021 09:07:05 -0500 IronPort-SDR: E6QrcAV/BdPf1uD+RY9MIu+8OnQ9ekhwSzaeVKLirk//2PQwNJODkYmTn3T2M93T8PEqff5aJ0 hii7wqzgmJ9Q== X-IronPort-AV: E=McAfee;i="6000,8403,9911"; a="183818863" X-IronPort-AV: E=Sophos;i="5.81,220,1610438400"; d="scan'208";a="183818863" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2021 06:05:21 -0800 IronPort-SDR: 6Wx2avFZ5NZp2xVnxL+aL91JvjJZFYXOZ39fhjwpVQcXzC8J82qZzKUM2jJE09cwXhEHrQNX5b rwoHWjarqz5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,220,1610438400"; d="scan'208";a="399729328" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by fmsmga008.fm.intel.com with ESMTP; 03 Mar 2021 06:05:14 -0800 From: Like Xu To: Peter Zijlstra , Paolo Bonzini , Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Kan Liang , Dave Hansen , wei.w.wang@intel.com, Borislav Petkov , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Like Xu Subject: [PATCH v3 2/9] perf/x86/lbr: Simplify the exposure check for the LBR_INFO registers Date: Wed, 3 Mar 2021 21:57:48 +0800 Message-Id: <20210303135756.1546253-3-like.xu@linux.intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210303135756.1546253-1-like.xu@linux.intel.com> References: <20210303135756.1546253-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 If the platform supports LBR_INFO register, the x86_pmu.lbr_info will be assigned in intel_pmu_?_lbr_init_?() and it's safe to expose LBR_INFO in the x86_perf_get_lbr() directly, instead of relying on lbr_format check. Also Architectural LBR has IA32_LBR_x_INFO instead of LBR_FORMAT_INFO_x to hold metadata for the operation, including mispredict, TSX, and elapsed cycle time information. Cc: Peter Zijlstra Reviewed-by: Kan Liang Signed-off-by: Like Xu --- 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 21890dacfcfe..355ea70f1879 100644 --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c @@ -1832,12 +1832,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.29.2