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 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 69CF6C7EE23 for ; Sat, 29 Apr 2023 01:59:09 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=y3nBy9w45bBrk/2dQAR1m6PY3qJHZKzcKeJtA7ww0AM=; b=A0tWFjEr/K0mwC uDJ/HTJ3CfB+5zPacyzVIvmDxvsv7v3K26RqsYUAYKcydnUnNlzhWuwqPiaHmYhKi2ECnKISztjcS 5J9VyJTMALJXTFYjmEaB41PO4XMsdsWlxjwYsQAV61/+DcUGKmmODNwXhXPCicjOTMAzmXAuT7yZm 6QtaXmtC/GcgjX/d/yh3STmC5xel+u7opz9WyQc5MHvoGtBfr7Y/YVr/2Q2rfkjtGOlqwFZBtLT+3 bEXOQ6rMyivSXy3a5TQsUo79MjlUv1yFzi2BYWWIlQFhoyKGiR8KM/3G3EXddEpG78LU9hPdBWiYK r9n4azRQ4yrbbCznmXOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1psZqY-00C5hL-2g; Sat, 29 Apr 2023 01:57:58 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1psZqW-00C5hB-0m for linux-arm-kernel@bombadil.infradead.org; Sat, 29 Apr 2023 01:57:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ayr7VbWMIwUcp6wwxuHnmNGUXgkPNo9SsjRh8F3lqDQ=; b=BqPYJTK2rEzm1czoolF+6u+Zy5 FxnuqNOj5GHfAmhNDefdfQbKuaYf2q6tc97/5i9McPmPuWbK9dauLTF2ROuh7EuJf50BLrhkECXE/ tn/VKxSZKJKsCY0957nZ06+EwtAumb22p80OAu1VGCCT1rAc96k7A2hc+h4kyNg2aCIhHslNhxMV9 o1N+63m4i9q94wICo8033aH19JqBipFuGWX0B3/hXrm2Hh7Hzle7us+OH+pnnekvuZCYV/UNsa0Ir 1OuJfkdjmPgvIeNF4hVa4M39PN5I0x7zOP0fiU13ZfHcehwbOtYECjeOpvPzk4CMCVn0KKN4wamWi io2lADLQ==; Received: from [187.19.238.117] (helo=quaco.ghostprotocols.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1psZqU-00DXoa-0l for linux-arm-kernel@lists.infradead.org; Sat, 29 Apr 2023 01:57:54 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 2BB89403B5; Fri, 28 Apr 2023 22:57:51 -0300 (-03) Date: Fri, 28 Apr 2023 22:57:51 -0300 From: Arnaldo Carvalho de Melo To: Ganapatrao Kulkarni Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org, suzuki.poulose@arm.com, mathieu.poirier@linaro.org, darren@os.amperecomputing.com, scott@os.amperecomputing.com, scclevenger@os.amperecomputing.com Subject: Re: [PATCH V2] perf cs-etm: Add fix for coresight trace for any range of CPUs Message-ID: References: <20230421055253.83912-1-gankulkarni@os.amperecomputing.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230421055253.83912-1-gankulkarni@os.amperecomputing.com> X-Url: http://acmel.wordpress.com 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Em Thu, Apr 20, 2023 at 10:52:53PM -0700, Ganapatrao Kulkarni escreveu: > The current implementation supports coresight trace decode for a range > of CPUs, if the first CPU is CPU0. > > Perf report segfaults, if tried for sparse CPUs list and also for > any range of CPUs(non zero first CPU). > > Adding a fix to perf report for any range of CPUs and for sparse list. Can some ARM people please review this? - Arnaldo > Signed-off-by: Ganapatrao Kulkarni > --- > > V2: > Updated with review comments. > Fixed for sparse list of CPUs also. > > V1: > [1] https://lore.kernel.org/lkml/20230419172101.78638-1-gankulkarni@os.amperecomputing.com/ > > tools/perf/util/cs-etm.c | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > index 8dd81ddd9e4e..2003717f5779 100644 > --- a/tools/perf/util/cs-etm.c > +++ b/tools/perf/util/cs-etm.c > @@ -275,6 +275,25 @@ static int cs_etm__metadata_set_trace_id(u8 trace_chan_id, u64 *cpu_metadata) > (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \ > }) > > +/* > + * Get a metadata for a specific cpu from an array. > + * > + */ > +static u64 *get_cpu_data(struct cs_etm_auxtrace *etm, int cpu) > +{ > + int i; > + u64 *metadata = NULL; > + > + for (i = 0; i < etm->num_cpu; i++) { > + if (etm->metadata[i][CS_ETM_CPU] == (u64)cpu) { > + metadata = etm->metadata[i]; > + break; > + } > + } > + > + return metadata; > +} > + > /* > * Handle the PERF_RECORD_AUX_OUTPUT_HW_ID event. > * > @@ -344,8 +363,11 @@ static int cs_etm__process_aux_output_hw_id(struct perf_session *session, > return 0; > } > > + cpu_data = get_cpu_data(etm, cpu); > + if (cpu_data == NULL) > + return err; > + > /* not one we've seen before - lets map it */ > - cpu_data = etm->metadata[cpu]; > err = cs_etm__map_trace_id(trace_chan_id, cpu_data); > if (err) > return err; > -- > 2.39.2 > -- - Arnaldo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel