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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA678C71153 for ; Mon, 4 Sep 2023 15:25:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233456AbjIDPZo (ORCPT ); Mon, 4 Sep 2023 11:25:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbjIDPZo (ORCPT ); Mon, 4 Sep 2023 11:25:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5D6F2132; Mon, 4 Sep 2023 08:25:40 -0700 (PDT) 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 1D5B6143D; Mon, 4 Sep 2023 08:26:18 -0700 (PDT) Received: from [192.168.1.3] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D99AD3F738; Mon, 4 Sep 2023 08:25:37 -0700 (PDT) Message-ID: <2a7f6d40-6502-d389-f691-488e3d9b9005@arm.com> Date: Mon, 4 Sep 2023 16:25:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v1 2/2] perf cs-etm: Respect timestamp option Content-Language: en-US To: Leo Yan References: <20230827133557.112494-1-leo.yan@linaro.org> <20230827133557.112494-3-leo.yan@linaro.org> Cc: Arnaldo Carvalho de Melo , Suzuki K Poulose , Mike Leach , John Garry , Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org From: James Clark In-Reply-To: <20230827133557.112494-3-leo.yan@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On 27/08/2023 14:35, Leo Yan wrote: > When users pass the option '--timestamp' or '-T' in the record command, > all events will set the PERF_SAMPLE_TIME bit in the attribution. In > this case, the AUX event will record the kernel timestamp, but it > doesn't mean Arm CoreSight enables timestamp packets in its hardware > tracing. > > If the option '--timestamp' or '-T' is set, this patch always enables > Arm CoreSight timestamp, as a result, the bit 28 in event's config is to > be set. > > Before: > > # perf record -e cs_etm// --per-thread --timestamp -- ls > # perf script --header-only > ... > # event : name = cs_etm//, , id = { 69 }, type = 12, size = 136, > config = 0, { sample_period, sample_freq } = 1, > sample_type = IP|TID|TIME|CPU|IDENTIFIER, read_format = ID|LOST, > disabled = 1, enable_on_exec = 1, sample_id_all = 1, exclude_guest = 1 > ... > > After: > > # perf record -e cs_etm// --per-thread --timestamp -- ls > # perf script --header-only > ... > # event : name = cs_etm//, , id = { 49 }, type = 12, size = 136, > config = 0x10000000, { sample_period, sample_freq } = 1, > sample_type = IP|TID|TIME|CPU|IDENTIFIER, read_format = ID|LOST, > disabled = 1, enable_on_exec = 1, sample_id_all = 1, exclude_guest = 1 > ... > > Signed-off-by: Leo Yan Reviewed-by: James Clark > --- > tools/perf/arch/arm/util/cs-etm.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > index cf9ef9ba800b..58c506e9788d 100644 > --- a/tools/perf/arch/arm/util/cs-etm.c > +++ b/tools/perf/arch/arm/util/cs-etm.c > @@ -442,6 +442,15 @@ static int cs_etm_recording_options(struct auxtrace_record *itr, > "contextid", 1); > } > > + /* > + * When the option '--timestamp' or '-T' is enabled, the PERF_SAMPLE_TIME > + * bit is set for all events. In this case, always enable Arm CoreSight > + * timestamp tracing. > + */ > + if (opts->sample_time_set) > + evsel__set_config_if_unset(cs_etm_pmu, cs_etm_evsel, > + "timestamp", 1); > + > /* Add dummy event to keep tracking */ > err = parse_event(evlist, "dummy:u"); > if (err)