Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6934222pxb; Wed, 17 Feb 2021 18:37:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUGP5DAmuvH2X7z+pU9sfIEZin/8tNNXhy5okWaaKhv4DECirQKa8JHdoeOyJecNOP+sDm X-Received: by 2002:a05:6402:34c3:: with SMTP id w3mr1799157edc.3.1613615853620; Wed, 17 Feb 2021 18:37:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613615853; cv=none; d=google.com; s=arc-20160816; b=pO9Hn6iQ4nGtz4vmCrdHGSNtrBloLZe+T3XasElvgHCqBUN53u5XfrgkHhTGx39Hh4 qTTSCrqo/dWQzlqqp8/mncDue0XCoFrcuQRq1zDPbXCsUrVgx1KspuybTtyXIIiB6K9k 0TLESwyDbVfI/h5Hr0myfHW4t+mr5FfFf5Z0lf+koADpE285vbZyb+kkBf0LcEJlxc7b fExgFIcvlA3ZHzm/NY8zSfcFyWHtVldGh/RUkZ/+H71P4GmJUj6YYi4jMLlnHuVnvzIR yP07zIQ8Eg2zWiqv0iaqZosnx0hvV9lIv6aDWke+SE4j4qPLNcD/DHE/qS/7BN5lRVOK QtFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :references:cc:to:from:subject:ironport-sdr:ironport-sdr; bh=5Q8HWuNQLWCv1jdZ9MKUyUO+k2Mf9DG6qSZNCeTNME4=; b=AbtGwNS12BHw17s3eBLlnPpp48pdPJ6luwsPZufwsL6GFbLLfxo9G1l56o/c4jTr2B 0ZrFpGLANS+Wu9jWoWEX7bceWHX2Av1F6Kc7s4zS8jchFAufSRXIjsYGW3S92qGsBBRk gJ0b6aANufrMDjf4JkzQAUF8bgerTpAW+vORcJTMlAGGSawXXrPkfdxxELfN6Osm02Xc rdwxLSEyOuVnEqEclc4t6chDvvC6c1mMQUcqE5fiYytcpjscWy9xx1REuzWJsu5QiEJt be4ke+zro9IYuze/B5uowWmG/ev0oxXbi02KGIp8n1sAuBoXnVkQEFwIRtTYfyll+M47 aeQg== 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 t1si2517336ejc.524.2021.02.17.18.37.07; Wed, 17 Feb 2021 18:37:33 -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 S229803AbhBRCdS (ORCPT + 99 others); Wed, 17 Feb 2021 21:33:18 -0500 Received: from mga01.intel.com ([192.55.52.88]:65138 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbhBRCdS (ORCPT ); Wed, 17 Feb 2021 21:33:18 -0500 IronPort-SDR: H0B45p6ncjsSYUDpdCJvb7uXF8U/bLmlqgH/wAjFlPiwUL4s8Pllv+cMox3bLgYIiiGJQCRfqL 4g+09VNneghg== X-IronPort-AV: E=McAfee;i="6000,8403,9898"; a="202619801" X-IronPort-AV: E=Sophos;i="5.81,185,1610438400"; d="scan'208";a="202619801" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2021 18:31:32 -0800 IronPort-SDR: h/YMGYfFVccVrrZVrdT2THkW82ifAkJmps4ADW7CB8BL9p5F+jPFf0dtVAnZ+UxJiuiOi4nMWx CayZkZKAf0Pg== X-IronPort-AV: E=Sophos;i="5.81,185,1610438400"; d="scan'208";a="439627474" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.238.4.93]) ([10.238.4.93]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2021 18:31:29 -0800 Subject: Re: [PATCH] perf/x86/lbr: Simplify the exposure check for the LBR_INFO registers 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 References: <20210203070337.329511-1-like.xu@linux.intel.com> Organization: Intel OTC Message-ID: <5299a9a1-447e-be47-4b19-c5ada666b64e@linux.intel.com> Date: Thu, 18 Feb 2021 10:31:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210203070337.329511-1-like.xu@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, Would you help pick up this patch so that we can enable guest Arch LBR? --- thx,likexu On 2021/2/3 15:03, Like Xu wrote: > 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; > } >