Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1376200rdb; Mon, 4 Sep 2023 11:37:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECaAjh8bu7utW4iz2B+lysghDBZW0++FysH/TD4aZVU/OHXqMLYCFmnLV6lBXwMV3oWOLd X-Received: by 2002:a05:6870:ac12:b0:1b7:3f07:e431 with SMTP id kw18-20020a056870ac1200b001b73f07e431mr12588738oab.54.1693852645415; Mon, 04 Sep 2023 11:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693852645; cv=none; d=google.com; s=arc-20160816; b=vmqUCEp6/cnutKPbvUNZvNFhcPozmz7EunJ5T3NV8x9KZO1iHIxE7mSZOMrAaK0cCx VdIG+S6CLNoqxmP4XzLseZFPnP/fh1UJNtPXt4ldfVy8juXrVr3F03Z7x/1O38v0MJZb xU4KqOgGGVR5/pbHucbWN+Qwtg/3zgb9be3KaPMXl21N9JNw5hC8X9C2eyljkPshZgN6 3NPegpuK6N08fdPr65c0JL1XxVjL8gnmXq7fJQpuTMGJ06w4Bw3N3kgUqej4IBRLTlhc 68YDRX0XTv3O5R/Xgl+5tkaRqLTu3c0Bub3piVeRTosG6jGuxvOSb7Fh9EASgXE4OX5V yD9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=xsg6qNegb7Ahc7uGaxfAn1hUbO3EaUBcwS7Z2orSISE=; fh=cgNWYo1WLCBklJej2Q7hiHWiQ7jyJCdhMti4JiEsR1A=; b=n4hJ5Fj/MfEHV+UJNNYqut6hrHaM3I2MNoxQmVGvePhpgX85083IQbSzyLqVZArsKM M/9ySMqMhrfn10jMhFifGZyojh0aplwj3dNO0hSqX/QWL6yWEglhaOlB7qBK3o253Ok3 BFEo1yZV69k70wjWQ8B2Sqd5HsQtkAQciZ5/bJWunMc8yIyboX1J2xDyR8QAcVIrImBp 45DWyOmzBurRoItzo4xtJ6CAAYDSwdCPhJNcBAYfN7B9MdrXWfZs8Vjo6B4QlKAYq14f vWO/1xDfDtIctVXBXniKwZqu3PLWDibsqYX7J6pNjCBQrwFzaOy5cMwO6qcGv+59IiU8 8f5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d190-20020a6336c7000000b00566016fc08csi8206274pga.83.2023.09.04.11.37.11; Mon, 04 Sep 2023 11:37:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234630AbjIDPZo (ORCPT + 99 others); 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 X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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)