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 68FA3C6379F for ; Tue, 17 Jan 2023 15:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230495AbjAQPzC (ORCPT ); Tue, 17 Jan 2023 10:55:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbjAQPy6 (ORCPT ); Tue, 17 Jan 2023 10:54:58 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 29E9986AF; Tue, 17 Jan 2023 07:54:57 -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 1874A1FB; Tue, 17 Jan 2023 07:55:39 -0800 (PST) Received: from [10.1.197.1] (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8854B3F67D; Tue, 17 Jan 2023 07:54:55 -0800 (PST) Message-ID: <99a03fae-47fa-8f19-1768-4aeb28cac182@arm.com> Date: Tue, 17 Jan 2023 15:54:54 +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 v7 01/15] coresight: trace-id: Add API to dynamically assign Trace ID values Content-Language: en-US To: Mike Leach Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux-perf-users@vger.kernel.org, leo.yan@linaro.org, quic_jinlmao@quicinc.com References: <20230116124928.5440-1-mike.leach@linaro.org> <20230116124928.5440-2-mike.leach@linaro.org> <1896a73b-eb7b-7ffb-272d-115a10adeb71@arm.com> From: Suzuki K Poulose In-Reply-To: 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 17/01/2023 13:02, Mike Leach wrote: > On Mon, 16 Jan 2023 at 14:16, Suzuki K Poulose wrote: >> >> Hi Mike >> >> On 16/01/2023 12:49, Mike Leach wrote: >>> The existing mechanism to assign Trace ID values to sources is limited >>> and does not scale for larger multicore / multi trace source systems. >>> >>> The API introduces functions that reserve IDs based on availabilty >>> represented by a coresight_trace_id_map structure. This records the >>> used and free IDs in a bitmap. >>> >>> CPU bound sources such as ETMs use the coresight_trace_id_get_cpu_id >>> coresight_trace_id_put_cpu_id pair of functions. The API will record >>> the ID associated with the CPU. This ensures that the same ID will be >>> re-used while perf events are active on the CPU. The put_cpu_id function >>> will pend release of the ID until all perf cs_etm sessions are complete. >>> >>> For backward compatibility the functions will attempt to use the same >>> CPU IDs as the legacy system would have used if these are still available. >>> >>> Non-cpu sources, such as the STM can use coresight_trace_id_get_system_id / >>> coresight_trace_id_put_system_id. >>> >>> Signed-off-by: Mike Leach >>> --- >>> drivers/hwtracing/coresight/Makefile | 2 +- >>> .../hwtracing/coresight/coresight-trace-id.c | 265 ++++++++++++++++++ >>> .../hwtracing/coresight/coresight-trace-id.h | 156 +++++++++++ >>> include/linux/coresight-pmu.h | 10 + >>> 4 files changed, 432 insertions(+), 1 deletion(-) >>> create mode 100644 drivers/hwtracing/coresight/coresight-trace-id.c >>> create mode 100644 drivers/hwtracing/coresight/coresight-trace-id.h >>> >>> diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile >>> index b6c4a48140ec..329a0c704b87 100644 >>> --- a/drivers/hwtracing/coresight/Makefile >>> +++ b/drivers/hwtracing/coresight/Makefile >>> @@ -6,7 +6,7 @@ obj-$(CONFIG_CORESIGHT) += coresight.o >>> coresight-y := coresight-core.o coresight-etm-perf.o coresight-platform.o \ >>> coresight-sysfs.o coresight-syscfg.o coresight-config.o \ >>> coresight-cfg-preload.o coresight-cfg-afdo.o \ >>> - coresight-syscfg-configfs.o >>> + coresight-syscfg-configfs.o coresight-trace-id.o >>> obj-$(CONFIG_CORESIGHT_LINK_AND_SINK_TMC) += coresight-tmc.o >>> coresight-tmc-y := coresight-tmc-core.o coresight-tmc-etf.o \ >>> coresight-tmc-etr.o >>> diff --git a/drivers/hwtracing/coresight/coresight-trace-id.c b/drivers/hwtracing/coresight/coresight-trace-id.c >>> new file mode 100644 >>> index 000000000000..9b85c376cb12 >>> --- /dev/null >>> +++ b/drivers/hwtracing/coresight/coresight-trace-id.c >>> @@ -0,0 +1,265 @@ >>> +// SPDX-License-Identifier: GPL-2.0 >> >> ... >> >>> +int coresight_trace_id_read_cpu_id(int cpu) >>> +{ >>> + return _coresight_trace_id_read_cpu_id(cpu); >>> +} >>> +EXPORT_SYMBOL_GPL(coresight_trace_id_read_cpu_id); >>> + >>> +int coresight_trace_id_get_system_id(void) >>> +{ >>> + return coresight_trace_id_map_get_system_id(&id_map_default); >>> +} >>> +EXPORT_SYMBOL_GPL(coresight_trace_id_get_system_id); >>> + >>> +void coresight_trace_id_put_system_id(int id) >>> +{ >>> + coresight_trace_id_map_put_system_id(&id_map_default, id); >>> +} >>> +EXPORT_SYMBOL_GPL(coresight_trace_id_put_system_id); >>> + >>> +void coresight_trace_id_perf_start(void) >>> +{ >>> + atomic_inc(&perf_cs_etm_session_active); >>> +} >>> +EXPORT_SYMBOL_GPL(coresight_trace_id_perf_start); >>> + >>> +void coresight_trace_id_perf_stop(void) >>> +{ >>> + if (!atomic_dec_return(&perf_cs_etm_session_active)) >>> + coresight_trace_id_release_all_pending(); >>> +} >>> +EXPORT_SYMBOL_GPL(coresight_trace_id_perf_stop); >>> + >> >> This blank new line at the end of the file generates a checkpatch >> warning for me. I have fixed it locally and applied it. >> > OK, thanks. > > The only thing I get out of checkpatch.pl for this patch (and indeed > the entire set) is: > > WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? Ah, sorry. It is not the checkpatch, but git am complained. Sorry for the confusion. Cheers Suzuki