Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5079056rwb; Tue, 17 Jan 2023 08:58:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXuVoQoR45xzoEQiJzNuNnlpp2MermngLUQC025dY2lY+3CpyEPRjM2uaQv+wCg+e/cuVaS8 X-Received: by 2002:aa7:c0d4:0:b0:48f:acd1:8da2 with SMTP id j20-20020aa7c0d4000000b0048facd18da2mr3831735edp.27.1673974697241; Tue, 17 Jan 2023 08:58:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673974697; cv=none; d=google.com; s=arc-20160816; b=GW4v4ZdqoqpGEi1G2gY8Fc+uf3UaowH49dHHqPvy7ove7kUaQ/DQ8DFrdt9/WZXTlm Tt/ycx05HlZ+z7zEDgBN6+e72Gm3uVXACXTVdTp5XHkpbJWk8xT+ZeU6F82yYkHcVBhy Rd851EWEcVRq572+Dr7dIpUWa7iwxWOvK349jGqS9LEf8RjSk+4pyA5QY8VY/c6Rtz58 oWVZ1YkyDBrzriVfmyuxiKOai07clb0DcUAX8qLPzlF+xrdQ/8YNYJDBckSPNy4b6gvm 8KLJ2Z7tFOl+ADr2b8Wz6n22g9WiH2I4lbwNPePK0DutaMcfwF6kMyJ3zHVU3feEqmEu 31AA== 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=cd2SMsNfrjlFZGWhyX89YSYeRAKeEFjzH0nicRYmwn0=; b=QO2wboAP21fNMG339Rn4J9AN1kEme1KSyRjUre0ey2rKwwbhSi1p+MP2WTHvYsupw0 k1dqfhFfOw8/hTPs8OvbqjTr+XiLbYEy47HmcGeECFLrZQaHPXTj/JpSxp/ehVK0RE31 M5tzgLHWvH40ZuD+N4IWOv+guIzRcyHcMmJnwnCU3DSaDnIX0+6KAb26wrtCn9wgiDc+ s7UoKGcth6wsRB1aNybNG0hRcM6gBJbRWcew11znrbl6QvWIfuiXWiv30FqwMXNCQAwO J0HMoSC8Weplf2URcEVum+B/lP1dr3pr15rlxb/tVaaE4sAOYtoOBkvw1W9qVG3fOKPX 4BPA== 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 r15-20020aa7cfcf000000b00499d41d2ef1si19876897edy.440.2023.01.17.08.58.05; Tue, 17 Jan 2023 08:58:17 -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 S230035AbjAQPzA (ORCPT + 48 others); Tue, 17 Jan 2023 10:55:00 -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 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 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