Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1323835rwb; Thu, 19 Jan 2023 09:11:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXtJaHMzg23s3m3UeVxx7C9hohFYrNdRl8iZ1ArURG+da2aXUbD6ZxHojdq8d6Q7TQrB+qva X-Received: by 2002:a17:902:ccc1:b0:191:3098:8b with SMTP id z1-20020a170902ccc100b001913098008bmr38862072ple.58.1674148291747; Thu, 19 Jan 2023 09:11:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674148291; cv=none; d=google.com; s=arc-20160816; b=MdWeaF8L2i7Na240FcMpIhhLrUSwWAp8dZhFkId/VIM6+00LcsulTe28uADlAcWvQv TeAna6qu7+96If+NRb5+jozmkhHJhgoIiXXVqwjtqQ+Knd/D5WVLAkuoURIe9C5hQXTC x4UBmIlX4jLWpZiyTsz1Y/6L3vmnUV5CRypJu9xZfc75T7+8ImI5G31FOpDFEhEu4vRK G7rnMu+3i17ZWWExAPRrz4Hpepm18hEZmOWLDnlJgbpvCwNy213/bIJ3JdyuJKo72FzT YKBdJXqEvTbWMZHfNNJqNF3QBfm8AQxFWxVpRrdSYNniC5FOLO2GdqAFGrQaexMKfOTs 2mkg== 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=0BVmWt9GB+t8pnpSOVrdKfT4Nod5GJBxldU6ZmjuEgE=; b=C2BvAlkW4aqmfBJCWYj7hMYlkF/E0UWEglKQfozoIy+PXYMBprG80nzSoBEH8w1niL d31pb6PEvD9XLpvxB6t1tzGJZO35sem9PtKKxC+CT5Fe38V0+OXSRSCd2ihrwr1tMjjD Qz3ibB1UStEXTjggYyS3rBQvoRwpnHA+BhkneDW8I43Z1ItV4LkjzEISnCHqUUhgQ41L pFo1EAyYjigKplGlLQrHgYV5Qkx7Fhmat4UGeipsKxn6B71j1PhflialrvmvcmNORMzV 6AJ9Bce5R4Ozus6H5YvusYB1R8fUGHSxZbA3yoMlkcw0frIjA77GhdVOKmzOX+ynNZUG AQ3Q== 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 l187-20020a6391c4000000b004d2bfc2b59esi594356pge.379.2023.01.19.09.11.23; Thu, 19 Jan 2023 09:11:31 -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 S230038AbjASQuN (ORCPT + 45 others); Thu, 19 Jan 2023 11:50:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230381AbjASQuI (ORCPT ); Thu, 19 Jan 2023 11:50:08 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A88276A4C; Thu, 19 Jan 2023 08:50:04 -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 E2F2C176A; Thu, 19 Jan 2023 08:50:45 -0800 (PST) Received: from [10.57.47.54] (unknown [10.57.47.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2D4403F445; Thu, 19 Jan 2023 08:50:01 -0800 (PST) Message-ID: <17f226e1-271e-e16d-596a-a0fb955de586@arm.com> Date: Thu, 19 Jan 2023 16:49:59 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v4 6/8] perf cs_etm: Record ts_source in AUXTRACE_INFO for ETMv4 and ETE Content-Language: en-US To: Suzuki K Poulose 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, linux-perf-users@vger.kernel.org, tanmay@marvell.com, leo.yan@linaro.org, mike.leach@linaro.org References: <20230119154308.3815108-1-james.clark@arm.com> <20230119154308.3815108-7-james.clark@arm.com> From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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:56, Suzuki K Poulose wrote: > 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 ? > For both of these points, I think it was just trying to be consistent with what is already there. There is already cs_etm_is_etmv4() and cs_etm_get_ro() which don't mention the cpu part, and also the metadata_etmv4_ro variable which has _ro. You're right that it doesn't matter that they're read only, but at the moment everything is so it's probably easiest to leave it for now rather than go and update everything. > Otherwise looks good to me. > > Suzuki > Thanks for the review.