Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp252673rdb; Thu, 19 Oct 2023 03:39:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDg2x88i5yOrhlzOnzOeXFj3/rZU+s1LouEuIx//K+9C78DTPdL9ceMXFxGId0wFMN3q1r X-Received: by 2002:a25:7455:0:b0:d9a:6855:14cd with SMTP id p82-20020a257455000000b00d9a685514cdmr1760816ybc.39.1697711955627; Thu, 19 Oct 2023 03:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697711955; cv=none; d=google.com; s=arc-20160816; b=h4tkN8aZOr0e3x1Z/Siat5pGamLlbx/OveuYvpbBF+bHkSO1L/gA3g695LNS/knmXw kdSDjB6t7v5uNKW8mrpCj/00h6WTqYuo6Ynb2IM48Oc7dZZoVT203FyYYT6A1aWDRYbv aL2tLGTUdZV35oDD2i7KMY8fUeYgDRCrCJNklI0Igi35LgynLU+55IvJiJ+rSRkw28EO 3T+zTFbjM/gt1FGZGv0lgg/6bfySO6ShnBSAjmDrhCLxHMaBMlunTdO28Xm6UQ6Yu0c2 Sg1ykMuzud9F9bsuIK5rnNFpmU42XnBGhDaDP4eFw7aeMK3wZZjrEpaiOBCcfqDeEY6Z UAtA== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=wLlqN2XxL/coY7OvZHhUxl+Y/NbZSQqkAIlnQGRsdA0=; fh=+r64cWSi0MjglFriUL+Ckm2FO4ENKgxDsqfY0eb6bi4=; b=k4Kjy89ak4TR86t/DM2vmb3CpVgHRQDXBPn+DO2pSVztZDW1pyEGci7Ooi70CH7ePr vfvDo7ZeF5ESD9+IGaLkHf3tStZBT2xDWKbj9kotOl8wk9efK+xCe2B/QNjJD3Ud2CO2 fytmAtlVh5C4GqG299gMSz1l144OqCfV4eR/F10a/L1fLhleidvsgZ7XBrr4Y5N75W8n cWJTIsaVyZvhP2haL8+xB/TH864sgrroZp5LlJVh9dzWyCvEuG+ZO1nYmzZU1tBsbCr0 RxE3PFS2BY5caP9CYWyMQ75vFkVgaI7VOgncSSOIC6JFWWo1daM3dTnRi98Z2zUEeDDM dfLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id m125-20020a633f83000000b00578a44df6c1si4029156pga.640.2023.10.19.03.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 03:39:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 78D3D828952A; Thu, 19 Oct 2023 03:39:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232626AbjJSKjH (ORCPT + 99 others); Thu, 19 Oct 2023 06:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjJSKjG (ORCPT ); Thu, 19 Oct 2023 06:39:06 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3F31BFA; Thu, 19 Oct 2023 03:39:04 -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 8E7802F4; Thu, 19 Oct 2023 03:39:44 -0700 (PDT) Received: from [10.57.67.150] (unknown [10.57.67.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DE4E63F5A1; Thu, 19 Oct 2023 03:38:59 -0700 (PDT) Message-ID: Date: Thu, 19 Oct 2023 11:38:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v1 2/2] perf cs-etm: Enable itrace option 'T' Content-Language: en-US To: Leo Yan 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, Arnaldo Carvalho de Melo , Suzuki K Poulose , Mike Leach References: <20231014074513.1668000-1-leo.yan@linaro.org> <20231014074513.1668000-3-leo.yan@linaro.org> From: James Clark In-Reply-To: <20231014074513.1668000-3-leo.yan@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Thu, 19 Oct 2023 03:39:13 -0700 (PDT) On 14/10/2023 08:45, Leo Yan wrote: > Prior to Armv8.4, the feature FEAT_TRF is not supported by Arm CPUs. > Consequently, the sysfs node 'ts_source' will not be set as 1 by the > CoreSight ETM driver. On the other hand, the perf tool relies on the > 'ts_source' node to determine whether the kernel timestamp is traced. > Since the 'ts_source' is not set for Arm CPUs prior to Armv8.4, > platforms in this case cannot utilize the traced timestamp as the kernel > time. > > This patch enables the 'T' itrace option, which forcibly utilizes the > traced timestamp as the kernel time. If users are aware that their > working platform's Arm CoreSight shares the same counter with the kernel > time, they can specify 'T' option to decode the traced timestamp as the > kernel time. > > An usage example is: > > # perf record -e cs_etm// -- test_program > # perf script --itrace=i10ibT > # perf report --itrace=i10ibT > > Signed-off-by: Leo Yan > --- > tools/perf/util/cs-etm.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > index 9729d006550d..4a37fdeb1795 100644 > --- a/tools/perf/util/cs-etm.c > +++ b/tools/perf/util/cs-etm.c > @@ -3322,12 +3322,27 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event, > etm->metadata = metadata; > etm->auxtrace_type = auxtrace_info->type; > > - /* Use virtual timestamps if all ETMs report ts_source = 1 */ > - etm->has_virtual_ts = cs_etm__has_virtual_ts(metadata, num_cpu); > + if (etm->synth_opts.use_timestamp) > + /* > + * Prior to Armv8.4, Arm CPUs don't support FEAT_TRF feature, > + * therefore the decoder cannot know if the timestamp trace is > + * same with the kernel time. > + * > + * If a user has knowledge for the working platform and can > + * specify itrace option 'T' to tell decoder to forcely use the > + * traced timestamp as the kernel time. > + */ > + etm->has_virtual_ts = true; > + else > + /* Use virtual timestamps if all ETMs report ts_source = 1 */ > + etm->has_virtual_ts = cs_etm__has_virtual_ts(metadata, num_cpu); > > if (!etm->has_virtual_ts) > ui__warning("Virtual timestamps are not enabled, or not supported by the traced system.\n" > - "The time field of the samples will not be set accurately.\n\n"); > + "The time field of the samples will not be set accurately.\n" > + "For Arm CPUs prior to Armv8.4 or without support FEAT_TRF,\n" > + "you can specify the itrace option 'T' for timestamp decoding\n" > + "if the Coresight timestamp on the platform is same with the kernel time.\n\n"); > > etm->auxtrace.process_event = cs_etm__process_event; > etm->auxtrace.process_auxtrace_event = cs_etm__process_auxtrace_event; Reviewed-by: James Clark