Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2141349pxb; Mon, 11 Jan 2021 01:51:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhBMx8VD4rD6UeVGkNeMjGAt7YPjcEy7LQIzjLJUfTo0NKStEFXX1APYVoU0MLqxKxvZCU X-Received: by 2002:a17:906:af99:: with SMTP id mj25mr10567075ejb.414.1610358699357; Mon, 11 Jan 2021 01:51:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610358699; cv=none; d=google.com; s=arc-20160816; b=DQ0v1xtUCTEH3BYicr9QEOQMcl6Dl7rXfS5py2y+1WJrcCpxC+EUd/0Ka2Uij4uy8g V78X2BXQRa9TVhVnzfTHFiPER4/dzDPghuD4a1BGIyjdkwEA3N0gdpEOvYgRk3ZLBNRn Ds65ccADNYGZKj/Vla6sB2ul1hYPGAFMLOSguQSz9t0DLpgnNa8Z7RTfa7Rjr3FrDTY3 XhfSXIpKuHZF30kR5K7CbN7V3YKnJ3Zz1bAKsg9BkpO8c//kK7LLuSqPDD7qFo4nXXIA S8AiNK0XsimIqWHaUbPZCDspMpQSzpICXD9A3A+e88D4a/M4jnnf1DHwqMw0aNkb0XW1 k00w== 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=NlY9lW2H9YlQQ4Ln27o/w/e7CkATmi2vVi+BW3tobtw=; b=TtC+1UV74Dp8lsFarXFufVMyioHzBZq2YNR3Eu2zlbEU7nK78MRe43xFvTePrMRbGw D2/xrQZwx1MaE3ULh1AWY97JBOOnvtWoooHwCogBxb0Xb9kK7acXdS2jO7BceJmdaZa0 Vn2PjVe0HyI+lZ+OIAyyxG2GcT8yFwedqyBgq8pfWNsGnW4MMqYet34r2DWQBCIylaGM 3GvzkAawpkNbBTho93H4jeY7H5Si5swt6XKDZ/9A3x4UVbL8nkO6PWMri7OBOM3JGKGR HnUWI68j7F3eK0HSRpNwnV1AJ42CeMfvz4sKqz2lvvwq+97VgKsTWCY5nfZ6S5H4hY/f 30RA== 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 n11si6489568ejc.684.2021.01.11.01.51.15; Mon, 11 Jan 2021 01:51:39 -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 S1728703AbhAKJsb (ORCPT + 99 others); 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; >