Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2140249pxb; Mon, 11 Jan 2021 01:48:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEaVOXYWTHr9/d0jAs1bkuTsTxHcwK9l1uDZpi1cYQPyfe70+T9w+Z+gMReE4/xe9hTeoK X-Received: by 2002:a50:f61b:: with SMTP id c27mr13452479edn.61.1610358534206; Mon, 11 Jan 2021 01:48:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610358534; cv=none; d=google.com; s=arc-20160816; b=l4Lpglj+0aS0gy912m/phC8s88Wl9PIANsiUt1HBQkrfFwgaIr8o8ey84pP5RPJFKt iY1Olhhb+9CaRukuqPG9hPEkhxCI8QyEHlN1F9GLvEfZLk7D4AUzKU1cJGsSu3QOkNBv kIi5ba+Wn1oproECPE5JP5OT/rWok3l6TaTp7UWZDYeUSbQxp5puL0yWJKWWB3jHOXRZ 9JWhpOz7Us/P3wqQWYO/y0Le2c3dxyqzprKwC7ASprmeF6WsXHqPM1tmRiGWXFSqyIt6 RFFzxImfaji1QVp+WfIqkI3hB4yHKTyZK9sM++AT4hDh6jpog+z/JMn4oIXkO74vznxg 3FHg== 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:from:references :to:subject; bh=3/s57a2ApoMEFodim8lzoBs1lOILv1HQPbocJODtVBQ=; b=FjGPOTvWhBjxQG3rgiH/aV+NQBcln8vMKip7xWIAgNG27hoiPpnx4IsjLaspPYRrTq xpBDiXEjd5qMiBRNPHuJypYUEE+irIN5RF7SiVTAatlezIan+7edBceM3wszQBtTAoe7 xDxU/9lhQDlsjErpTzaUTUaOKTk9Mhdr9gw/6uI5xDriv/2Svk5U1xcZEeR510aP8fVV HQBBy/fXm+675b49joU2g88xuSgnd78Rqei7+pP2935ggNO68VmOARLEeRjYOXd/3VRl EF9F1l4rSzrHgMbHFR1xgVry8OlDn4Br75D52c9aaHijDXw2vs1YP2XbOv2NNv1a1pbg kx9w== 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z22si6415875ejo.390.2021.01.11.01.48.29; Mon, 11 Jan 2021 01:48:54 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728566AbhAKJqL (ORCPT + 99 others); Mon, 11 Jan 2021 04:46:11 -0500 Received: from foss.arm.com ([217.140.110.172]:51576 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728550AbhAKJqL (ORCPT ); Mon, 11 Jan 2021 04:46:11 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7FE7F101E; Mon, 11 Jan 2021 01:45:25 -0800 (PST) Received: from [10.57.39.145] (unknown [10.57.39.145]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DE7293F70D; Mon, 11 Jan 2021 01:45:21 -0800 (PST) Subject: Re: [PATCH v1 4/7] perf cs-etm: Add PID format into metadata To: Leo Yan , Arnaldo Carvalho de Melo , Mathieu Poirier , Mike Leach , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20210109074435.626855-1-leo.yan@linaro.org> <20210109074435.626855-5-leo.yan@linaro.org> From: Suzuki K Poulose Message-ID: Date: Mon, 11 Jan 2021 09:45:12 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210109074435.626855-5-leo.yan@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Leo, On 1/9/21 7:44 AM, Leo Yan wrote: > It's possible for CoreSight to trace PID in either CONTEXTIDR_EL1 or > CONTEXTIDR_EL2, the PID format info is used to distinguish the PID > is traced in which register. > > This patch saves PID format into the metadata when record. The patch looks good to me. One minor suggestion below > > Signed-off-by: Leo Yan > --- > tools/perf/arch/arm/util/cs-etm.c | 21 +++++++++++++++++++++ > tools/perf/util/cs-etm.c | 2 ++ > tools/perf/util/cs-etm.h | 2 ++ > 3 files changed, 25 insertions(+) > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > index fad7b6e13ccc..ee78df3b1b07 100644 > --- a/tools/perf/arch/arm/util/cs-etm.c > +++ b/tools/perf/arch/arm/util/cs-etm.c > @@ -613,6 +613,7 @@ static void cs_etm_get_metadata(int cpu, u32 *offset, > struct cs_etm_recording *ptr = > container_of(itr, struct cs_etm_recording, itr); > struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; > + u64 pid_fmt; > > /* first see what kind of tracer this cpu is affined to */ > if (cs_etm_is_etmv4(itr, cpu)) { > @@ -641,6 +642,16 @@ static void cs_etm_get_metadata(int cpu, u32 *offset, > metadata_etmv4_ro > [CS_ETMV4_TRCAUTHSTATUS]); > > + /* > + * The PID format will be used when decode the trace data; > + * based on it the decoder will make decision for setting > + * sample's PID as context_id or VMID. > + */ > + pid_fmt = perf_pmu__format_bits(&cs_etm_pmu->format, "pid"); > + if (!pid_fmt) > + pid_fmt = 1ULL << ETM_OPT_CTXTID; > + info->priv[*offset + CS_ETMV4_PID_FMT] = pid_fmt; > + Given we do this same step twice here in this function and also in patch 2. I am wondering if this could be made into a small helper function ? static u64 cs_etm_pmu_format_pid(cs_etm_pm) { pid_fmt = perf_pmu__format_bits(&cs_etm_pmu->format, "pid"); /* * An older kernel doesn't expose this, so fall back to using * CTXTID. */ if (!pid_fmt) pid_fmt = 1ULL << ETM_OPT_CTXTID; return pid_fmt; } Suzuki