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 799BACDB474 for ; Mon, 16 Oct 2023 08:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230172AbjJPImO (ORCPT ); Mon, 16 Oct 2023 04:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbjJPImN (ORCPT ); Mon, 16 Oct 2023 04:42:13 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9037BA1; Mon, 16 Oct 2023 01:42:10 -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 A86BB1FB; Mon, 16 Oct 2023 01:42:50 -0700 (PDT) Received: from [10.57.1.186] (unknown [10.57.1.186]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB3C63F5A1; Mon, 16 Oct 2023 01:42:07 -0700 (PDT) Message-ID: Date: Mon, 16 Oct 2023 09:42:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v1 RESEND 2/2] perf cs-etm: Respect timestamp option To: Leo Yan , Arnaldo Carvalho de Melo , James Clark , Mike Leach Cc: John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , 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 References: <20231014074159.1667880-1-leo.yan@linaro.org> <20231014074159.1667880-3-leo.yan@linaro.org> From: Suzuki K Poulose In-Reply-To: <20231014074159.1667880-3-leo.yan@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/10/2023 08:41, 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 Acked-by: Suzuki K Poulose > --- > 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)