Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp70706pxb; Tue, 2 Feb 2021 23:15:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzTPTjwEFDXhSy3fxK9sLQG3buaNtz7fZDeAJNTWoX9oJXmdP6N/WzCVI9y3qf5m4WeF0+g X-Received: by 2002:a17:906:3781:: with SMTP id n1mr1821439ejc.296.1612336522069; Tue, 02 Feb 2021 23:15:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612336522; cv=none; d=google.com; s=arc-20160816; b=LAQJLzqvGVRo12Pd9pCr+pC3QwyirXjIWBP+6nk1PwjlPGdD7dPmYinlQEp76g2IwQ qX5p18y4c5NENF3yCkAlMvATFCuAll5DKgPVY6eg1A5BQiNphCTNRbgCybLsoamLnOm2 LmT7dr0wm7sTK3dxoGR2scc+At890C4tk8h9jAQa6+FmOCYL3ODqPcTDJkjyoAwOfGSU kmFgK5mHb8pMpgf0bPhiVpIfl4VdehjP89SGGUdt9huykzW5KmeXgAjwfB+8PxNB8iDo fTffnhHcmUV1zoeYPUgF5zDRKexPK1cSP2Dl6Ciq1Brgx4YzoTRS2rSJJfBUDokbZzxl sJ2w== 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 :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=Bk7zvs7OVHnXsD/LqOBnUhP2UsCalYS1UgmplC67yyE=; b=mO8DMZMmXkuXf/YSlYptQwxCpKSrCzNYaxVaxF51C1inNA6cKGHRq+S1u2UZa/Vh0c swyPpN5CO7f1vm2FSwuIP0mMqxQegTrKL2vvpJ9gVLrabC/7NOxHa6yuZ604FwqQrYXA Ch4JXTB8p8aCN1iCNafJriH/HPTOn1H5cQnFFjLW2LhStyjSJNyD+o29CTyqxAHuJYcR ws9E1Tya2LpCa735e0OWVlwoBTgop51uZS8/XYHRfZ0h8bt+0cCX8j6H7cOHrwgpOWKR 4iwsrf1Q6EfINpsbQWzJFyQ0Iy7hhoTe2jSf8m+ioZxtuTC5YfJiCr1KnUXfeEVb+PvL BYBw== 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 ay19si788790ejb.621.2021.02.02.23.14.58; Tue, 02 Feb 2021 23:15:22 -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 S231896AbhBCHMS (ORCPT + 99 others); Wed, 3 Feb 2021 02:12:18 -0500 Received: from mga09.intel.com ([134.134.136.24]:46958 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbhBCHLy (ORCPT ); Wed, 3 Feb 2021 02:11:54 -0500 IronPort-SDR: k0E+btjE/NS1F3mKPZ+J/dbCXbncj2gx5qeGo1MKShQ4LIutnWdX67brrl+B3aNWRGVFLKT73W kAiLbG6c+fCg== X-IronPort-AV: E=McAfee;i="6000,8403,9883"; a="181142960" X-IronPort-AV: E=Sophos;i="5.79,397,1602572400"; d="scan'208";a="181142960" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 23:10:09 -0800 IronPort-SDR: 8NUQ5n3RpCX0YEfPh8wwnjxS+HtI23P6xqwIngwh4Mv6blce6EVc5Q7BnTowGRIlRC3YUIiN7x VyxMZegTEnMA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,397,1602572400"; d="scan'208";a="392301015" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by orsmga008.jf.intel.com with ESMTP; 02 Feb 2021 23:10:07 -0800 From: Like Xu To: Peter Zijlstra Cc: Kan Liang , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org Subject: [PATCH] perf/x86/lbr: Simplify the exposure check for the LBR_INFO registers Date: Wed, 3 Feb 2021 15:03:37 +0800 Message-Id: <20210203070337.329511-1-like.xu@linux.intel.com> X-Mailer: git-send-email 2.29.2 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: Kan Liang Cc: Peter Zijlstra (Intel) 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