Received: by 2002:ac8:1418:0:b0:3ab:920c:4c8b with SMTP id k24csp434170qtj; Thu, 19 Jan 2023 08:05:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXuj6+JFd7Zl1jJNMCke25kOYJ9ZiSV8Y0ghLHp1VNxMLg34DKOYFWXJ3S0QPugQkmCdv6Id X-Received: by 2002:a17:903:2405:b0:194:5116:c3ee with SMTP id e5-20020a170903240500b001945116c3eemr13706231plo.37.1674144347204; Thu, 19 Jan 2023 08:05:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674144347; cv=none; d=google.com; s=arc-20160816; b=Do2gCCUI1peT88FwuDe7m5WNpiP33TlncM2Gfy6rOw+iHQqr3iB1dJbi4fPGNobGU5 v/xupifDBGuhbfZe2s5RO3NrIm2YUdJ6WL0RWoQyspTczqrgiVWSd5r/1l+OdIVWmhVH i4iSSJvobA6+0cTjETUh37Ahx/x1medPJk2OACqYldA8ymW+ziOXkK5pI5f3tPVvKuoU 42FKiv9xFC9XmLcwwa6M16RmvIYnVXxXRqS1sDghZ/ffBMD+GQpvSrIIIRsxbeH7LVdx pHRlr2v2QlZjpz/dDopHt3odueg4Xg2VD4QWQ7Q8BBGd1weecbH+gH3Hqj6t0SKzjhlI 1nMQ== 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:subject:user-agent:mime-version:date:message-id; bh=AX8Vnk2yxozq7H73woSjBgl6OTsQPxviul7mRlMw5Po=; b=uyNQ9SO9loy0oBYo1f7RYK0riLlvUwqpSHPXdxSZqISJPT5WKr/xPSHhi2qBvLw1f8 ihkeBTJ3cnKhfu7ddqZYnd8StqizDxzOWcUH76XB7M9t2sZqd/Ej74HP+5TId36E76Ew RexrJyuzMSAvtEMiAgU6M4yaMDgBI+c5cl7MFjy7SnDbOSj+hX8AKE609N/JgUp5GBLC 6B+Wsk3sFDUbS0+NhRyJNOxEwCzEhb0czf8Nij4ENoVdWV2Emd61vs5RDsfMCoPW1K9K Yhpzjpv6/RethH+Y71Gmpjoi0N+1Lm2MigqgMEisGoFPvBSsQNcXoX8IVHFYxdllM4YV AxXA== 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 k186-20020a6384c3000000b004cffaea14f8si6711013pgd.816.2023.01.19.08.05.41; Thu, 19 Jan 2023 08:05:47 -0800 (PST) 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 S231274AbjASP5E (ORCPT + 45 others); Thu, 19 Jan 2023 10:57:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbjASP5B (ORCPT ); Thu, 19 Jan 2023 10:57:01 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7EF323A9D; Thu, 19 Jan 2023 07:57:00 -0800 (PST) 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 BF4691758; Thu, 19 Jan 2023 07:57:41 -0800 (PST) Received: from [10.57.75.229] (unknown [10.57.75.229]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D947E3F445; Thu, 19 Jan 2023 07:56:56 -0800 (PST) Message-ID: Date: Thu, 19 Jan 2023 15:56:55 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v4 6/8] perf cs_etm: Record ts_source in AUXTRACE_INFO for ETMv4 and ETE To: James Clark , linux-perf-users@vger.kernel.org, tanmay@marvell.com, leo.yan@linaro.org, mike.leach@linaro.org Cc: sgoutham@marvell.com, gcherian@marvell.com, lcherian@marvell.com, bbhushan2@marvell.com, German Gomez , Mathieu Poirier , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230119154308.3815108-1-james.clark@arm.com> <20230119154308.3815108-7-james.clark@arm.com> From: Suzuki K Poulose In-Reply-To: <20230119154308.3815108-7-james.clark@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 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 19/01/2023 15:43, James Clark wrote: > From: German Gomez > > Read the value of ts_source exposed by the driver and store it in the > ETMv4 and ETE header. If the interface doesn't exist (such as in older > Kernels), defaults to a safe value of -1. Super minor nits feel free to ignore. > > Signed-off-by: German Gomez > Signed-off-by: James Clark > --- > tools/perf/arch/arm/util/cs-etm.c | 48 +++++++++++++++++++++++++++++++ > tools/perf/util/cs-etm-base.c | 2 ++ > tools/perf/util/cs-etm.h | 2 ++ > 3 files changed, 52 insertions(+) > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > index b526ffe550a5..481e170cd3f1 100644 > --- a/tools/perf/arch/arm/util/cs-etm.c > +++ b/tools/perf/arch/arm/util/cs-etm.c > @@ -53,6 +53,7 @@ static const char * const metadata_etmv4_ro[] = { > [CS_ETMV4_TRCIDR2] = "trcidr/trcidr2", > [CS_ETMV4_TRCIDR8] = "trcidr/trcidr8", > [CS_ETMV4_TRCAUTHSTATUS] = "mgmt/trcauthstatus", > + [CS_ETMV4_TS_SOURCE] = "ts_source", > }; > > static const char * const metadata_ete_ro[] = { > @@ -62,6 +63,7 @@ static const char * const metadata_ete_ro[] = { > [CS_ETE_TRCIDR8] = "trcidr/trcidr8", > [CS_ETE_TRCAUTHSTATUS] = "mgmt/trcauthstatus", > [CS_ETE_TRCDEVARCH] = "mgmt/trcdevarch", > + [CS_ETE_TS_SOURCE] = "ts_source", > }; > > static bool cs_etm_is_etmv4(struct auxtrace_record *itr, int cpu); > @@ -613,6 +615,32 @@ static int cs_etm_get_ro(struct perf_pmu *pmu, int cpu, const char *path) > return val; > } > > +static int cs_etm_get_ro_signed(struct perf_pmu *pmu, int cpu, const char *path) minor nit: This doesn't necessarily care if it is RO ? Also, does it make sense to rename to include cpu relation : say, cs_etm_pmu_cpu_get_signed() ? > +{ > + char pmu_path[PATH_MAX]; > + int scan; > + int val = 0; > + > + /* Get RO metadata from sysfs */ > + snprintf(pmu_path, PATH_MAX, "cpu%d/%s", cpu, path); > + > + scan = perf_pmu__scan_file(pmu, pmu_path, "%d", &val); > + if (scan != 1) > + pr_err("%s: error reading: %s\n", __func__, pmu_path); > + > + return val; > +} > + > +static bool cs_etm_pmu_path_exists(struct perf_pmu *pmu, int cpu, const char *path) nit: cs_etm_pmu_cpu_path_exists() ? To make the "cpu" relation explicit ? Otherwise looks good to me. Suzuki