From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD7925243 for ; Sat, 14 Oct 2023 07:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AkHjspck" Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E5E1D6 for ; Sat, 14 Oct 2023 00:42:23 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1c9b1e3a809so20721245ad.2 for ; Sat, 14 Oct 2023 00:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697269343; x=1697874143; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MWOAPqRfJlFeGZpcN7zM2S+ByCB4SMNDEstgKNTnaCs=; b=AkHjspckxsgd2hxEurDMoIaqdpc26U/hAk3ns5JmzsnDOLfKFX9gPbQkDRScCIu97o TjeqYN2u7BZ3MZth50pxQRQ/YsiUWLaevy9kARkYNWCjln8AwqT68hhtvbJCqi59W1Xx kNMzbB1ELctinhUfOsfUM3ZUA0Y0Ue4bvdfX8oHY5wfSr6liGuMKPTKU0shgaWYBdcp+ 1qfRyT2fCPQfD0xBkGSe/imxdz/OCorZe4cStU1A02NrZSsuBK4gcM/bg0ywbkrpgdAQ u7YtZ6fTN4jUULn9kVzbGkg4YCEzTAUwXaS9fXqo8Ie13PtcLUcIHdX7dPSkgBwlgw5q 3KRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697269343; x=1697874143; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MWOAPqRfJlFeGZpcN7zM2S+ByCB4SMNDEstgKNTnaCs=; b=P8rdnFTcBKuXi+GbmYjEUlze6dVttBxJv4yoLBmHLJe5iqzeyFd2GagHk6/XSlepj4 OQlcy+y/wXe9KLcw/cY9837kLV9lpvcx1rhniLIbyJpMN6Ez0ZrcA36giqwUlFYMJmUw jAiN4sQ2EulrNgeAGb71rViQMR0PrfSYhvyFWZxJbAOyCn1QNCUKgxQf7mhI7HpqLo4l 87kJFWRwM9OEeqiKUKlgDbc12365ka9zhQCh5oI3HzVHs4IG3iUEmz7hVRxJW62z/HcR 080Kn5zMGSXidwYdVbDySegbsb37gxmGdL/Jkw/68uPaUMbJgFmZfny5QX16s8DNURvp yw7w== X-Gm-Message-State: AOJu0YyhBtpBDJfHFBSS8OpAQT/NdstwHnriDAoZNMxUnIu5VjHtQUhU wTlcX4oe2VxUz5BBsNKnuMrXnw== X-Google-Smtp-Source: AGHT+IE4fFHIwPowtX28NpMjG4rwpVawnPYgQzzkATlSIS071tzOVwmxcTYq9ltdsTO+Ac9Hv4/pXg== X-Received: by 2002:a17:902:e80e:b0:1c6:2b9d:56ce with SMTP id u14-20020a170902e80e00b001c62b9d56cemr28094278plg.21.1697269342540; Sat, 14 Oct 2023 00:42:22 -0700 (PDT) Received: from leoy-huanghe.lan ([98.98.49.106]) by smtp.gmail.com with ESMTPSA id e11-20020a170902b78b00b001c5b8087fe5sm4957319pls.94.2023.10.14.00.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 00:42:22 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , James Clark , Suzuki K Poulose , 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, Leo Yan Subject: [PATCH v1 RESEND 2/2] perf cs-etm: Respect timestamp option Date: Sat, 14 Oct 2023 15:41:59 +0800 Message-Id: <20231014074159.1667880-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231014074159.1667880-1-leo.yan@linaro.org> References: <20231014074159.1667880-1-leo.yan@linaro.org> Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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) -- 2.34.1