From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2DB6C433E9 for ; Mon, 11 Jan 2021 09:48:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF4FF22AAB for ; Mon, 11 Jan 2021 09:48:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728715AbhAKJsb (ORCPT ); Mon, 11 Jan 2021 04:48:31 -0500 Received: from foss.arm.com ([217.140.110.172]:51658 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728679AbhAKJsa (ORCPT ); Mon, 11 Jan 2021 04:48:30 -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 CC012101E; Mon, 11 Jan 2021 01:47:44 -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 3EE1C3F70D; Mon, 11 Jan 2021 01:47:41 -0800 (PST) Subject: Re: [PATCH v1 5/7] perf cs-etm: Fixup PID_FMT when it is zero 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-6-leo.yan@linaro.org> From: Suzuki K Poulose Message-ID: <27c8f898-93f3-6a2d-5e9e-b5b1225df1c9@arm.com> Date: Mon, 11 Jan 2021 09:47:31 +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-6-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 On 1/9/21 7:44 AM, Leo Yan wrote: > If the metadata item CS_ETM_PID_FMT/CS_ETMV4_PID_FMT is zero, this means > the perf data file is recorded with old version tool and the tool has > not extended to support the item. > > For this case, this patch fixes up PID_FMT entry to set the value as > BIT(ETM_OPT_CTXTID), this info will be delivered to the decoder to > extract PID from packet's field "context_id". > > Signed-off-by: Leo Yan Acked-by: Suzuki K Poulose > --- > tools/perf/util/cs-etm.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > index 763085db29ae..8c125134a756 100644 > --- a/tools/perf/util/cs-etm.c > +++ b/tools/perf/util/cs-etm.c > @@ -7,6 +7,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -2577,6 +2578,15 @@ int cs_etm__process_auxtrace_info(union perf_event *event, > for (k = 0; k < metadata_cpu_array_size; k++) > metadata[j][k] = ptr[i + k]; > > + /* > + * If the data in CS_ETM_PID_FMT is zero, means the > + * information isn't stored in the data file, this is > + * because the old perf tool hasn't yet supported > + * CS_ETM_PID_FMT. Fixup the item to option "CTXTID". > + */ > + if (!metadata[j][CS_ETM_PID_FMT]) > + metadata[j][CS_ETM_PID_FMT] = BIT(ETM_OPT_CTXTID); > + > /* The traceID is our handle */ > idx = metadata[j][CS_ETM_ETMTRACEIDR]; > i += metadata_cpu_array_size; > @@ -2590,6 +2600,15 @@ int cs_etm__process_auxtrace_info(union perf_event *event, > for (k = 0; k < metadata_cpu_array_size; k++) > metadata[j][k] = ptr[i + k]; > > + /* > + * If the data in CS_ETMV4_PID_FMT is zero, means the > + * information isn't stored in the data file, this is > + * because the old perf tool hasn't yet supported > + * CS_ETMV4_PID_FMT. Fixup the item to option "CTXTID". > + */ > + if (!metadata[j][CS_ETMV4_PID_FMT]) > + metadata[j][CS_ETMV4_PID_FMT] = BIT(ETM_OPT_CTXTID); > + > /* The traceID is our handle */ > idx = metadata[j][CS_ETMV4_TRCTRACEIDR]; > i += metadata_cpu_array_size; >