From patchwork Sat Oct 14 07:41:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 13421934 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E268ECDB465 for ; Sat, 14 Oct 2023 07:42:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N0G1gH2r8/ctNTTJxOpaZWNG09QBfKZfIuddIz4v18M=; b=m2mg5aDQE9Xu2W 91TNLOBw63FHj/3Nlg2vy2Rjt4w2rCZB3xnP+uCT6VfMovQ9dEBfrNxOBOVAgJ5bZa5YoPk7rJXZ4 u5rZIRIT+vGFMeZ4HE+ub6qfe5SAxfN3EIVu+FdO2JZ1+dioQDKYerrd2HpnJSjgFT40/7ggOb+E3 MnQW1zDIbxjRxi/O0D6oFmKPqhBYEilkwsMCqgx3d6TDWypueVrBI2kUggSRIIMYTXqDJI/N/JpAN dGsC8ZTvUOWIMLD5KXo0xu1NVKnIJ2TveVRY2bfSkCgFK8+o5hiFnjCIIyHmy+a1QUYoaG5aRDQ7B w8JRtEIYTLGoroeoRrMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qrZI5-004vLU-0k; Sat, 14 Oct 2023 07:42:29 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qrZI1-004vJh-21 for linux-arm-kernel@lists.infradead.org; Sat, 14 Oct 2023 07:42:26 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c434c33ec0so20736515ad.3 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=lists.infradead.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=MOb+dhUvdCXYpcuJ540tEa8rLQJmU3rjeXnBdLE0jo3bP7y2ZBuHseNHWDuXY95R2X YZhT2halMbxWrGYjV9pMFHvBxpDjCbxuSKRCDK6kr6mSmXVVwzCiYx44O4Ksa44A27dJ rilgnBp0HpPz2SL3kHhn/JxXWUZEIS8u0iE1zwQegoHsP7r0iAc4WYFZenckHXXirF9V bNH1VtQC4eCKY8DObXxZB4V7uZutmdSBrB/74VOi5Qc+RV9p2nYxAWfHs9fhrfIC4B4u LwFGSrorlWENYsaB2O7qdB60aF7KV091Fpjgkp+JoPflQFdhZm7qkDDR1/il5XshdItg abUQ== 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=LawunRWz6Nm3QTAggFwymdhXKsGkh++DtCfh65Ag/eG9kB3tnF74tlwOv0C5h4wKdo lJLqCq/etFHVtKvck9m+cXw/eQjp69Lryu/RDujmMvGy8WoO+ksjuWOELLFP5kFEcAFj eDYFMcV/BahvkdHrQEJrljFLrmNPDv+2+ODWFIF5CAuvLc8NxIB3I5lZ+OUWLKKzzeMi N42iL6So7OULehvxAQjkrAhoN4AdpeWDbbEcvfGTidv2i+vp/N9klLnqMvyo/Fqa+tQS gDp8l3qQj8H9pY+qB4169wa/8SlubI6twqwVApZ8Eg7xJ99YL14ZA0hWXrUoSt6xouaT stsA== X-Gm-Message-State: AOJu0Yw+lH6jAqAFK0+Q4dL8zkzS+baUsSL0NPMXgT9wDw/05NgyiuAK Qr37piVr2Iw0C9u+giOfS3/9UA== 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231014_004225_676159_B1E5C39B X-CRM114-Status: GOOD ( 14.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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)