mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Mike Leach <mike.leach@linaro.org>
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
Subject: Re: [PATCH v7 01/15] coresight: trace-id: Add API to dynamically assign Trace ID values
Date: Tue, 17 Jan 2023 15:54:54 +0000	[thread overview]
Message-ID: <99a03fae-47fa-8f19-1768-4aeb28cac182@arm.com> (raw)
In-Reply-To: <CAJ9a7VixL9f2Cm7A780V311KH2G2giryeH9dG0p2e4zWBwA3iQ@mail.gmail.com>

On 17/01/2023 13:02, Mike Leach wrote:
> On Mon, 16 Jan 2023 at 14:16, Suzuki K Poulose <suzuki.poulose@arm.com> 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 <mike.leach@linaro.org>
>>> ---
>>>    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

  reply	other threads:[~2023-01-17 15:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 12:49 [PATCH v7 00/15] coresight: Add new API to allocate trace source " Mike Leach
2023-01-16 12:49 ` [PATCH v7 01/15] coresight: trace-id: Add API to dynamically assign Trace " Mike Leach
2023-01-16 14:16   ` Suzuki K Poulose
2023-01-17 13:02     ` Mike Leach
2023-01-17 15:54       ` Suzuki K Poulose [this message]
2023-01-16 12:49 ` [PATCH v7 02/15] coresight: Remove obsolete Trace ID unniqueness checks Mike Leach
2023-01-16 12:49 ` [PATCH v7 03/15] coresight: perf: traceid: Add perf ID allocation and notifiers Mike Leach
2023-01-16 12:49 ` [PATCH v7 04/15] coresight: stm: Update STM driver to use Trace ID API Mike Leach
2023-01-16 12:49 ` [PATCH v7 05/15] coresight: etm4x: Update ETM4 " Mike Leach
2023-01-16 12:49 ` [PATCH v7 06/15] coresight: etm3x: Update ETM3 " Mike Leach
2023-01-16 12:49 ` [PATCH v7 07/15] coresight: etmX.X: stm: Remove trace_id() callback Mike Leach
2023-01-16 12:49 ` [PATCH v7 08/15] coresight: trace id: Remove legacy get trace ID function Mike Leach
2023-01-16 12:49 ` [PATCH v7 09/15] perf: cs-etm: Move mapping of Trace ID and cpu into helper function Mike Leach
2023-01-17 12:04   ` Suzuki K Poulose
2023-01-16 12:49 ` [PATCH v7 10/15] perf: cs-etm: Update record event to use new Trace ID protocol Mike Leach
2023-01-16 12:49 ` [PATCH v7 11/15] kernel: events: Export perf_report_aux_output_id() Mike Leach
2023-01-16 12:49 ` [PATCH v7 12/15] perf: cs-etm: Handle PERF_RECORD_AUX_OUTPUT_HW_ID packet Mike Leach
2023-01-16 12:49 ` [PATCH v7 13/15] coresight: events: PERF_RECORD_AUX_OUTPUT_HW_ID used for Trace ID Mike Leach
2023-01-19 11:02   ` Suzuki K Poulose
2023-01-19 12:02     ` Mike Leach
2023-01-16 12:49 ` [PATCH v7 14/15] coresight: trace-id: Add debug & test macros to Trace ID allocation Mike Leach
2023-01-16 12:49 ` [PATCH v7 15/15] coresight: etm3x: docs: Alter sysfs documentation for trace id updates Mike Leach
2023-01-16 14:22   ` Suzuki K Poulose
2023-01-19 12:00 ` [PATCH v7 00/15] coresight: Add new API to allocate trace source ID values Suzuki K Poulose
2023-01-24 11:36   ` Suzuki K Poulose
2023-01-31 11:49     ` Suzuki K Poulose
2023-02-20 16:24       ` v4: " Suzuki K Poulose
2023-02-27 10:26         ` Suzuki K Poulose
2023-03-29  4:14           ` Ganapatrao Kulkarni
2023-03-29 13:19             ` Arnaldo Carvalho de Melo
2023-03-29 16:41               ` Ganapatrao Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99a03fae-47fa-8f19-1768-4aeb28cac182@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=acme@kernel.org \
    --cc=coresight@lists.linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=quic_jinlmao@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®