From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3AA6CDB465 for ; Mon, 16 Oct 2023 09:15:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232915AbjJPJPW (ORCPT ); Mon, 16 Oct 2023 05:15:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233281AbjJPJPO (ORCPT ); Mon, 16 Oct 2023 05:15:14 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 362AEE6; Mon, 16 Oct 2023 02:15:12 -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 53FAF1FB; Mon, 16 Oct 2023 02:15:52 -0700 (PDT) Received: from [10.57.1.186] (unknown [10.57.1.186]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BBC2B3F762; Mon, 16 Oct 2023 02:15:08 -0700 (PDT) Message-ID: <767745f1-4d79-17f1-6c5f-a4b352b8a40f@arm.com> Date: Mon, 16 Oct 2023 10:15:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v1 RESEND 1/2] perf cs-etm: Validate timestamp tracing in per-thread mode To: Leo Yan , Arnaldo Carvalho de Melo , James Clark , 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 References: <20231014074159.1667880-1-leo.yan@linaro.org> <20231014074159.1667880-2-leo.yan@linaro.org> From: Suzuki K Poulose In-Reply-To: <20231014074159.1667880-2-leo.yan@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/10/2023 08:41, Leo Yan wrote: > So far, it's impossible to validate timestamp trace in Arm CoreSight when > the perf is in the per-thread mode. E.g. for the command: > > perf record -e cs_etm/timestamp/ --per-thread -- ls > > The command enables config 'timestamp' for 'cs_etm' event in the > per-thread mode. In this case, the function cs_etm_validate_config() > directly bails out and skips validation. > > Given profiled process can be scheduled on any CPUs in the per-thread > mode, this patch validates timestamp tracing for all CPUs when detect > the CPU map is empty. > > Signed-off-by: Leo Yan > Reviewed-by: James Clark > --- > tools/perf/arch/arm/util/cs-etm.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > index b8d6a953fd74..cf9ef9ba800b 100644 > --- a/tools/perf/arch/arm/util/cs-etm.c > +++ b/tools/perf/arch/arm/util/cs-etm.c > @@ -205,8 +205,17 @@ static int cs_etm_validate_config(struct auxtrace_record *itr, > for (i = 0; i < cpu__max_cpu().cpu; i++) { > struct perf_cpu cpu = { .cpu = i, }; > > - if (!perf_cpu_map__has(event_cpus, cpu) || > - !perf_cpu_map__has(online_cpus, cpu)) > + /* > + * In per-cpu case, do the validation for CPUs to work with. > + * In per-thread case, the CPU map is empty. Since the traced > + * program can run on any CPUs in this case, thus don't skip > + * validation. > + */ > + if (!perf_cpu_map__empty(event_cpus) && > + !perf_cpu_map__has(event_cpus, cpu)) > + continue; > + > + if (!perf_cpu_map__has(online_cpus, cpu)) > continue; > Acked-by: Suzuki K Poulose