Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2709045pxf; Sun, 14 Mar 2021 09:02:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWN+4iKGPaQQxYzb+AyzNzZ/8Y8Wh6FckNWH4+W2RmCWPF7iX2K685XU16G1Ya7r/aTar9 X-Received: by 2002:a17:906:16ca:: with SMTP id t10mr19480321ejd.85.1615737751257; Sun, 14 Mar 2021 09:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615737751; cv=none; d=google.com; s=arc-20160816; b=CiUlTd/uah+2e8iY/zl7xO+4hFj4eiYWt0Nxwh9liHsIoK9PPyfkje2CJm3Hijc4PA 6A4XrNt7eJiCBZLD+bD8HkbhsG6zObPbOFSQU9i6wFeWjfJlDN51RnNLg0cAtAtRKlrN ku8ItlUMl8XFg75t2dj+xbTZjsPRIgK7chm077y0CQWO+doiM+WPhSb5Tx2jxp73afB4 GUMG6WvT2pxCrKfRfYeqhQTVon+gB3w+Kzfmkms3fTnyhA20LWWAPL8/ttcoqACtiefS crQcqEWBRIZ8ZyLMA+Src4zMwYk5d0nGiMD6Vh6ULfmQxRKjZczUbkRrjqeT5dCginBm F7hg== 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=JK/Bsb+lgOW4qIGI5zbAlaHuJcLzk/tdnr4ccCqncuI=; b=IMEPuG/Ge69o9KVIZ7sKatxf2jxo5L1eco3yBVRz+V2bONv+NrNdcqXpwOrAek6Oae xj+Nfs6WVQRu/PI1cO0qcEjFH45sj0Kl6xPRkoa03+hfXD3dQBwyfprB0Hus+xpJnLcu +qo6FyvGdjsW7WJLIfIocr2xYtOACvsMIPnuv/xmjTY9zBYEuXjavwW8sEoGlUeUwv4b K1HtY2EmrvBP4rV5lkTBOG/shz13L1umQXUV5A5qWwEp5Fn/PUUd3F3B06UCrQrEC+Lu zxJeDpEf7vm+8sc+iJxYhRpoivSfF3xiJpcfG5MMOb6jCgOgqOrlgeY1WoH5Gq0EScOi hYGg== 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 ko24si9300840ejc.407.2021.03.14.09.02.09; Sun, 14 Mar 2021 09:02:31 -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 S234150AbhCNQAw (ORCPT + 99 others); Sun, 14 Mar 2021 12:00:52 -0400 Received: from mga14.intel.com ([192.55.52.115]:7144 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234015AbhCNQAb (ORCPT ); Sun, 14 Mar 2021 12:00:31 -0400 IronPort-SDR: xxCL+gjVNradEpAUySWnxHIcxo2xj4AiO2w4Cb20SEFdEqbIwPlVr/KRUbQvqmwKJcvEYCHrOb CWAiSt7tFwDA== X-IronPort-AV: E=McAfee;i="6000,8403,9923"; a="188360693" X-IronPort-AV: E=Sophos;i="5.81,248,1610438400"; d="scan'208";a="188360693" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2021 09:00:31 -0700 IronPort-SDR: 3vBQsWcDYOuvO48jXCxle8yWDDVrM20M5Caz400T0rloWqzJs7uTooySKj1lbjRj02me3Rq8ym cQzo3zcXe3jw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,248,1610438400"; d="scan'208";a="439530617" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by FMSMGA003.fm.intel.com with ESMTP; 14 Mar 2021 09:00:27 -0700 From: Like Xu To: Paolo Bonzini , Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, x86@kernel.org, wei.w.wang@intel.com, linux-kernel@vger.kernel.org, Like Xu , Kan Liang , Peter Zijlstra , Borislav Petkov , Ingo Molnar , Andi Kleen Subject: [PATCH v4 02/11] perf/x86/lbr: Simplify the exposure check for the LBR_INFO registers Date: Sun, 14 Mar 2021 23:52:15 +0800 Message-Id: <20210314155225.206661-3-like.xu@linux.intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210314155225.206661-1-like.xu@linux.intel.com> References: <20210314155225.206661-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: Kan Liang Cc: Peter Zijlstra Cc: Borislav Petkov Cc: Ingo Molnar Signed-off-by: Like Xu Reviewed-by: Kan Liang Reviewed-by: Andi Kleen --- 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