Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1411509rdg; Sat, 14 Oct 2023 00:42:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEw5fpaAL+iFk+kfvW/UaOrWfKb/hxjj2tKQ2fBYIXLDCrs0rxvghtTCFs1j2prck3EjiEh X-Received: by 2002:a17:903:110f:b0:1bb:f1d9:432e with SMTP id n15-20020a170903110f00b001bbf1d9432emr31505376plh.37.1697269377240; Sat, 14 Oct 2023 00:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697269377; cv=none; d=google.com; s=arc-20160816; b=fnJuyRdK3nLWS8QLOLV+DRMpvUVp9zR1RHyaC3EuH1VOwgcLW/t3THWAPqK0pc/kh9 yj59Pjeop7ik8O/+NxQvGYYsWWnN/ApQJ8QjpoaWgxd16d5c5ns7gj+ZEVlvs7hwO78/ 0qLEc3BKtPKRTR520bHjZK8cZ9XyVCwkEecnmSQfaL3+N9BovmC7N1K4zXGRWzV5uMmC IfC6kjmTq+cDTl8rvSB69dB8Ik9Y5ys72Tv6SiHIcoKINNWBHhbvEIAWQ5TJ06L/BOSm QFCQ9LZrT78m7zwi+9ztXJoVbgrzUzMr+i2ERzfip8I3khyP+GV7CqEkhgUXpiSigXd5 huBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MWOAPqRfJlFeGZpcN7zM2S+ByCB4SMNDEstgKNTnaCs=; fh=l4iAVwDO61LIwaniIgzRha+ULreFBpZU+fcJCDhl18U=; b=VOcIfE+6GSvaY9R5kpyL94b0MyzRyumceLApek4vMr1sBn4Oian/puL9e9f0C07/5P vyEiPbQ9yqN1HVEy8kAQeDfRa6uEo30L4u1uHxgVSo/KHpBkVb7wMg2UiyE5HMg97wID eG5wrCmhZ2Qxn+H5+WdZgJ9kVorm4/DPep6p1TgXpXTj6DgXl8x39YniY4UqzixBwLLe bpXv3EGKVTLNo+WcUKvGKg0UXdUIaTB2Ilz6VydOELqLQcYJkKzNnciM2cA3rmhEoLON 7xnMZgVGYbqzztBZEm78Gjg0lQabI9qSnzT8a+QEsi6V4hTp2BciOwVMT302L2td35U4 Ag9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AkHjspck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t16-20020a170902e85000b001c61bd9db5csi6772768plg.317.2023.10.14.00.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 00:42:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AkHjspck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3B4288206D79; Sat, 14 Oct 2023 00:42:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232966AbjJNHma (ORCPT + 99 others); Sat, 14 Oct 2023 03:42:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232946AbjJNHm0 (ORCPT ); Sat, 14 Oct 2023 03:42:26 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B85ECF for ; Sat, 14 Oct 2023 00:42:23 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c88b46710bso20778465ad.1 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=wGAzTDns/PFkYJmthLIoK3YgbXtXKEEqjvj82YJ0IdIhPxeNm3N0Eo4KdSBcjQZVxD bXxNpT7Mzri8pxdtVm6LrZkxYkd5A53JpzwxC4UiV7I278jyJC4admBYRZjW6/MeYUW3 Vcolj+M7+wa2E2BVvM8d0cIhyMDZ3CKDM/ST4ZZJl57NNZIREz9zb6PEkZGKUpBXoWgQ 4FZSU0giteTkQkyukhIWG1szrU4s0wyDLPlrNKm5dAC7IwsFn4A3Y2iO5vV/X7xcn5Um FCur+mXajXUz7QwCiauWe/ncDAKKOhaf5PBDERfYw3qhTx/c8BALN+RpLB+lAIV9Ugvo NUyg== X-Gm-Message-State: AOJu0YxTm6wf8U1XQVhJmOQE3kthPGOstMwYznPplkd5ysgUUKEGtage RJjBvPN/QZxtyoTpgx0X3XwGIw== 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> 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=unavailable 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 14 Oct 2023 00:42:42 -0700 (PDT) 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