Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2490378ybg; Fri, 31 Jul 2020 00:46:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNiDnpTSBlWyzIJzJTAVLYkVJbBnTKmR93S/CrmAXNW2FmyzG/OpHNk9IxFdq2tbw7kXZA X-Received: by 2002:a17:906:269a:: with SMTP id t26mr2778557ejc.286.1596181619688; Fri, 31 Jul 2020 00:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596181619; cv=none; d=google.com; s=arc-20160816; b=WHvdAY6Yqkoi9CwY7w8tYWth7CJMQ8bE2Fx5gJdcB02LcWdkVry37kedL+OjvMc8EO fiKjRuZphZXL3v5RHoAOqTfctiC8uqsNJ22ITRqoxNDAhTJMeBUfx1nIG6h/uZce2RLy JrlPzuxGIi1D2ThuZ7upepBxqutIRQsmg6JqOdf1SiU+6NmsNbDVGVgNHom5o8Wa61Pa 0jHXxJ6Jjp5PXYQMU+o534j6z/yHIVFZGtkA91J1JTKHKsoJ0nl4zoeNS0RF7A98FQIs NBTaRl3havxf/Gitf9H2zNB9IC4WA1ASh0DrmtpQCLimccsXbNIn3YT9hAUsPj/RCZtE ZMIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=usWm0i8amdRnf3t7toW/SpwAl1HQHp1yE3TzvArD0js=; b=iFIc86TpM8syVoiEH1PNq1Cmt8qT1r+S1bkEAksGAT+grE2hdF7cpq4mwVVnRUU2p6 E2eSQM6B8vcnoCr25qOgZSUUy8WbKy1dsOZvc71AXRvOiBfnI7hTxXw9W8zjwWAaaWF0 v3H5Mfj2eY5JP9j/JQo+gP+SnJjKk1nyzgqpXr/wBCEQw77yLKGXevNfhcWrkDM2lpGF 3lSJi2m3PBfDTFBzynPgsK9OgDG49M5cN2iuHi0ylp1v5p58WRW7XCFAa/3RYoKaWJVx +hSml1Dp2u+ZKCtvC7irCVuXVKSgR0zKwoWih2i0Z5oX2hDCIO5uqYwooLr6klyITXWb BTmQ== 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 i25si4773451ejf.697.2020.07.31.00.46.37; Fri, 31 Jul 2020 00:46:59 -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 S1731802AbgGaHqP (ORCPT + 99 others); Fri, 31 Jul 2020 03:46:15 -0400 Received: from mga11.intel.com ([192.55.52.93]:55461 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731644AbgGaHqN (ORCPT ); Fri, 31 Jul 2020 03:46:13 -0400 IronPort-SDR: 5KD3/RL0t2pCQwxaCC/8CzQvvwbF2GV+y9xmiwBjVaLX6kXDxFpxX+WHAqlTmgoYEYPsiMrIux sJRrlkl7hU5Q== X-IronPort-AV: E=McAfee;i="6000,8403,9698"; a="149570531" X-IronPort-AV: E=Sophos;i="5.75,417,1589266800"; d="scan'208";a="149570531" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2020 00:46:13 -0700 IronPort-SDR: r5qGJwM+5jBh2cYOuySikfHWjAHZuCUzZwMVwVqyUPqfo2ppnc+T108uIFxmEAhrCTjjPzLrx/ 9y1W9kIK9zhw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,417,1589266800"; d="scan'208";a="323160591" Received: from sqa-gate.sh.intel.com (HELO clx-ap-likexu.tsp.org) ([10.239.48.212]) by fmsmga002.fm.intel.com with ESMTP; 31 Jul 2020 00:46:10 -0700 From: Like Xu To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Wanpeng Li , Jim Mattson Cc: Vitaly Kuznetsov , Joerg Roedel , wei.w.wang@intel.com, linux-kernel@vger.kernel.org, Like Xu , Kan Liang , Peter Zijlstra Subject: [PATCH 2/6] perf/x86/lbr: Unify LBR_INFO registers exposure check condition Date: Fri, 31 Jul 2020 15:43:58 +0800 Message-Id: <20200731074402.8879-3-like.xu@linux.intel.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200731074402.8879-1-like.xu@linux.intel.com> References: <20200731074402.8879-1-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. The x86_pmu.lbr_info will be assigned in intel_pmu_?_lbr_init_?(), it's safe to expose LBR_INFO in the x86_perf_get_lbr(), instead of relying solely on 'lbr_format == LBR_FORMAT_INFO' check. 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 63f58bdf556c..8d816f580342 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.21.3