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 AE543C63797 for ; Tue, 17 Jan 2023 13:03:47 +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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WZM0BJnqIJKzCtHkVxatYStcin9H/7UK8vyC4fWDy+M=; b=fmJP8hwexqzDbC 8kNi8GkjnlGxw1m2heZxj0kTJUWEYlRbcIr6earmBV8asYpodGt8Q5PNOZnFhpNEtIyiEMNid5hPI ggZ+FIQlK65tqypSYaQLvrSt0mTZBRWs+gfcTMNyUHrI5gFwmYv8kT5pj8w2BBDDiOVHmn1/TyCWH Zrg5VzTj8jHzc0IAKeiQvz6dKEjcrlrIYNNPsdMJOMaA7cPWNIAR7wj8682V2pnaJSORI+gpaPInH j9kOT57yr5V+GEJM23bonoB+8sh/Q6pXsWd2SUmZgxqCsdc08BwpLQNyxQh8jUCH1RtSiXTeHNsuo K2AVXDwVFlCHZQolSn1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHlc1-00EISN-EE; Tue, 17 Jan 2023 13:02:49 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHlby-00EIQD-11 for linux-arm-kernel@lists.infradead.org; Tue, 17 Jan 2023 13:02:47 +0000 Received: by mail-pj1-x102c.google.com with SMTP id s13-20020a17090a6e4d00b0022900843652so15516404pjm.1 for ; Tue, 17 Jan 2023 05:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=jmIfKKj7U8Bcy9yj2YgmEfLZDpCS32pWFxDGk4zOAmQ=; b=qASjWliaWCrKRQ9R7a3HdRD3wfjSMYeWigyGmwPIlQPT0evFxvqsL3mP4vjvxl0HXT Xfd9p7NjAA+SyYxihPlOXeX2/DPGibynkITo2FypiWhKjgFeOvj6oym18lwCv1uT6cUZ LRmlgXsoUGBbM39r6ME7ug1aSPsKzobn6azc7AXCppTSqSbFm+ITNXqZR3YWwz+0uFQ9 bsKgGsZ8B2WQtxJ1qDZEzeuZztgdPLl8apVmzxtqEvVsIP70h25SLCd3gZaVSRCuYa9n OWmU9/YudYlAXzvGDv2cGUQE8j8ysK7Lk2seZ6V3a7BBzzdXFeMc/EPlwm3d8Faa9hIq oryA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jmIfKKj7U8Bcy9yj2YgmEfLZDpCS32pWFxDGk4zOAmQ=; b=0GmQj7LaEoA29siaGPX1UHSbti98IRdrowpi7p0oZdJyfPW7dDTMxRuDGbR/qw+AEu x5qkf4laFXM6Wl1UG0TWgIiynOm+GZVw1rSbNvpE+86q3yiYc32D+8pjPUY21k7JCIW5 gx4swUhHIszf180ETw3RFd47XqypYlT8iE7gRu6hF9NUP/gh6Z7/JwHMPUQtXX/VGIup DGTrPwfZquCl0GIPP5AoKjX6F2nzYtAgLEuA7w1J0MfXMOqSo4op3aBKrLJ6rEUY0XcD QNCTuJZt6padqWoQ2J7lcT9oXefeAhlBE3jSg4kESw8ss4i0AXugrXmxWitZq0a4sOlL qN8A== X-Gm-Message-State: AFqh2kr8nVneSMGcCRwSDYQHhd8ZRwpXJr2fQp6rmDdrXoxezqUJthWK k5agBE6SpcJ66ilVNaxOSiFCAPEq4GqpuoCUQxFJLw== X-Google-Smtp-Source: AMrXdXv+i/hO3HrGWtPdleEamTrdv9t60Vx4JRXDr8oRauAlWP6HwqCLIuRipmrBsGIcaXtn+991HUpTrAVSyDKwif0= X-Received: by 2002:a17:90a:9413:b0:229:81a7:c5a7 with SMTP id r19-20020a17090a941300b0022981a7c5a7mr309318pjo.76.1673960561097; Tue, 17 Jan 2023 05:02:41 -0800 (PST) MIME-Version: 1.0 References: <20230116124928.5440-1-mike.leach@linaro.org> <20230116124928.5440-2-mike.leach@linaro.org> <1896a73b-eb7b-7ffb-272d-115a10adeb71@arm.com> In-Reply-To: <1896a73b-eb7b-7ffb-272d-115a10adeb71@arm.com> From: Mike Leach Date: Tue, 17 Jan 2023 13:02:29 +0000 Message-ID: Subject: Re: [PATCH v7 01/15] coresight: trace-id: Add API to dynamically assign Trace ID values To: Suzuki K Poulose 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230117_050246_096943_FE4026B7 X-CRM114-Status: GOOD ( 30.21 ) 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 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? Mike > > diff --git a/drivers/hwtracing/coresight/coresight-trace-id.h b/drivers/hwtracing/coresight/coresight-trace-id.h > > -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel