On 26/12/2023 09:36, Krzysztof Kozlowski wrote:
> On 26/12/2023 02:50, Jinlong Mao wrote:
>>
>>
>> On 12/21/2023 4:44 PM, Krzysztof Kozlowski wrote:
>>> On 21/12/2023 09:36, Jinlong Mao wrote:
>>>>
>>>>
>>>> On 12/21/2023 4:17 PM, Krzysztof Kozlowski wrote:
>>>>> On 21/12/2023 09:15, Jinlong Mao wrote:
>>>>>>
>>>>>>
>>>>>> On 12/21/2023 4:12 PM, Krzysztof Kozlowski wrote:
>>>>>>> On 21/12/2023 04:28, Jinlong Mao wrote:
>>>>>>>>>> diff --git a/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml b/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>>>>>>>> index f725e6940993..cbf583d34029 100644
>>>>>>>>>> --- a/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>>>>>>>> +++ b/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>>>>>>>> @@ -23,7 +23,7 @@ description: |
>>>>>>>>>>
>>>>>>>>>> properties:
>>>>>>>>>> $nodename:
>>>>>>>>>> - pattern: "^ete([0-9a-f]+)$"
>>>>>>>>>> + pattern: "^ete-([0-9a-f]+)$"
>>>>>>>>>
>>>>>>>>> My concerns are not resolved. Why is it here in the first place?
>>>>>>>>
>>>>>>>> Hi Krzysztof,
>>>>>>>>
>>>>>>>> ETE is acronym of embedded trace extension. The number of the name is
>>>>>>>> the same as the number of the CPU it belongs to.
>>>>>>>
>>>>>>> This is obvious and was not my question.
>
> You already said it here...
>
>>>>>>
>>>>>> Do you mean why the pattern match of the node name is added here ?
>>>>>
>>>>> Yes, especially that it is requiring a non-generic name.
>>>>>
>>>>>>
>>>>>> This node should not have the node name match, right ?
>>>>>
>>>>> Usually. For sure shouldn't be for non-generic names.
>>>>>
>>>> Hi Suzuki,
>>>>
>>>> Can we remove the pattern match of the node name and use a generic name
>>>> "ete" for the ete DT nodes ?
>>>
>>> "ete" is not a generic name. What is generic here? It's an acronym of
>>> some specific device name.
>>>
>>
>> The device full name is embedded trace extension. So use ETE as the name
>> here.
>
> That's obvious and my comment was not about it. Second time... This is
> my unlucky day... I said, why do you even want to enforce name which is
> not generic, since the names should be generic?
>
I think we can just drop the enforced name if it's getting in the way.
It doesn't really do anything and other Coresight bindings don't have it
anyway.
> I assume you read the DT specification:
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetr…
>
>
> Best regards,
> Krzysztof
>
I couldn't find anything in that list that would be a good fit for a
name, and it seems like all of the Coresight devices have already been
added with non generic names (like funnel and replicator etc), so it
might be a bit late now.
But if we drop the enforced name then it's probably fine.
James
On 12/21/2023 4:44 PM, Krzysztof Kozlowski wrote:
> On 21/12/2023 09:36, Jinlong Mao wrote:
>>
>>
>> On 12/21/2023 4:17 PM, Krzysztof Kozlowski wrote:
>>> On 21/12/2023 09:15, Jinlong Mao wrote:
>>>>
>>>>
>>>> On 12/21/2023 4:12 PM, Krzysztof Kozlowski wrote:
>>>>> On 21/12/2023 04:28, Jinlong Mao wrote:
>>>>>>>> diff --git a/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml b/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>>>>>> index f725e6940993..cbf583d34029 100644
>>>>>>>> --- a/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>>>>>> +++ b/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>>>>>> @@ -23,7 +23,7 @@ description: |
>>>>>>>>
>>>>>>>> properties:
>>>>>>>> $nodename:
>>>>>>>> - pattern: "^ete([0-9a-f]+)$"
>>>>>>>> + pattern: "^ete-([0-9a-f]+)$"
>>>>>>>
>>>>>>> My concerns are not resolved. Why is it here in the first place?
>>>>>>
>>>>>> Hi Krzysztof,
>>>>>>
>>>>>> ETE is acronym of embedded trace extension. The number of the name is
>>>>>> the same as the number of the CPU it belongs to.
>>>>>
>>>>> This is obvious and was not my question.
>>>>
>>>> Do you mean why the pattern match of the node name is added here ?
>>>
>>> Yes, especially that it is requiring a non-generic name.
>>>
>>>>
>>>> This node should not have the node name match, right ?
>>>
>>> Usually. For sure shouldn't be for non-generic names.
>>>
>> Hi Suzuki,
>>
>> Can we remove the pattern match of the node name and use a generic name
>> "ete" for the ete DT nodes ?
>
> "ete" is not a generic name. What is generic here? It's an acronym of
> some specific device name.
>
The device full name is embedded trace extension. So use ETE as the name
here.
Thanks
Jinlong Mao
>
On 20/12/2023 16:16, Adrian Hunter wrote:
> On 20/12/23 17:54, James Clark wrote:
>>
>>
>> On 08/12/2023 17:24, Adrian Hunter wrote:
>>> Hardware traces, such as instruction traces, can produce a vast amount of
>>> trace data, so being able to reduce tracing to more specific circumstances
>>> can be useful.
>>>
>>> The ability to pause or resume tracing when another event happens, can do
>>> that.
>>>
>>> Add ability for an event to "pause" or "resume" AUX area tracing.
>>>
>>> Add aux_pause bit to perf_event_attr to indicate that, if the event
>>> happens, the associated AUX area tracing should be paused. Ditto
>>> aux_resume. Do not allow aux_pause and aux_resume to be set together.
>>>
>>> Add aux_start_paused bit to perf_event_attr to indicate to an AUX area
>>> event that it should start in a "paused" state.
>>>
>>> Add aux_paused to struct perf_event for AUX area events to keep track of
>>> the "paused" state. aux_paused is initialized to aux_start_paused.
>>>
>>> Add PERF_EF_PAUSE and PERF_EF_RESUME modes for ->stop() and ->start()
>>> callbacks. Call as needed, during __perf_event_output(). Add
>>> aux_in_pause_resume to struct perf_buffer to prevent races with the NMI
>>> handler. Pause/resume in NMI context will miss out if it coincides with
>>> another pause/resume.
>>>
>>> To use aux_pause or aux_resume, an event must be in a group with the AUX
>>> area event as the group leader.
>>>
>>> Example (requires Intel PT and tools patches also):
>>>
>>> $ perf record --kcore -e '{intel_pt/aux-start-paused/k,syscalls:sys_enter_newuname/aux-resume/,syscalls:sys_exit_newuname/aux-pause/}' uname
>>
>> I think it might be useful to have an aux-toggle option as well, and
>> then you could do sampling if you put it on a PMU counter with an
>> interval. Unless you can make two events for the same counter with
>> different intervals, and one does resume and the other does pause? I'm
>> not sure if that would work?
>
> There is already ->snapshot_aux() for sampling. Is that what you mean?
>
I suppose that mostly handles that use case yes. Although there are some
slight differences. It looks like for SAMPLE_AUX, the buffer size for
each sample is fixed and limited to 16 bits in size, whereas between
pause and resume you could potentially have multiple buffers delivered
to userspace of any size.
And it looks like SAMPLE_AUX would leave the trace running even when no
samples were being collected. I suppose you might not want to consume
the memory bandwidth and turn the trace off between samples, which
pause/resume does. Especially if you intend to have long periods between
the samples.
I think if it did turn out to be useful the toggle function can easily
be added later, so I don't intend this comment to be a blocking one.
>>
>> Other than that it looks ok. I got Coresight working with a couple of
>> changes to what you posted on here, but that can always be done more
>> thoroughly later if we leave PERF_PMU_CAP_AUX_PAUSE off Coresight for now.
>
> Thanks a lot for looking at this!
>
On 12/21/2023 4:17 PM, Krzysztof Kozlowski wrote:
> On 21/12/2023 09:15, Jinlong Mao wrote:
>>
>>
>> On 12/21/2023 4:12 PM, Krzysztof Kozlowski wrote:
>>> On 21/12/2023 04:28, Jinlong Mao wrote:
>>>>>> diff --git a/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml b/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>>>> index f725e6940993..cbf583d34029 100644
>>>>>> --- a/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>>>> +++ b/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>>>> @@ -23,7 +23,7 @@ description: |
>>>>>>
>>>>>> properties:
>>>>>> $nodename:
>>>>>> - pattern: "^ete([0-9a-f]+)$"
>>>>>> + pattern: "^ete-([0-9a-f]+)$"
>>>>>
>>>>> My concerns are not resolved. Why is it here in the first place?
>>>>
>>>> Hi Krzysztof,
>>>>
>>>> ETE is acronym of embedded trace extension. The number of the name is
>>>> the same as the number of the CPU it belongs to.
>>>
>>> This is obvious and was not my question.
>>
>> Do you mean why the pattern match of the node name is added here ?
>
> Yes, especially that it is requiring a non-generic name.
>
>>
>> This node should not have the node name match, right ?
>
> Usually. For sure shouldn't be for non-generic names.
>
Hi Suzuki,
Can we remove the pattern match of the node name and use a generic name
"ete" for the ete DT nodes ?
Thanks
Jinlong Mao
> Best regards,
> Krzysztof
>
On 12/21/2023 4:12 PM, Krzysztof Kozlowski wrote:
> On 21/12/2023 04:28, Jinlong Mao wrote:
>>>> diff --git a/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml b/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>> index f725e6940993..cbf583d34029 100644
>>>> --- a/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>> +++ b/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>>>> @@ -23,7 +23,7 @@ description: |
>>>>
>>>> properties:
>>>> $nodename:
>>>> - pattern: "^ete([0-9a-f]+)$"
>>>> + pattern: "^ete-([0-9a-f]+)$"
>>>
>>> My concerns are not resolved. Why is it here in the first place?
>>
>> Hi Krzysztof,
>>
>> ETE is acronym of embedded trace extension. The number of the name is
>> the same as the number of the CPU it belongs to.
>
> This is obvious and was not my question.
Do you mean why the pattern match of the node name is added here ?
This node should not have the node name match, right ?
Thanks
Jinlong Mao
>
> Best regards,
> Krzysztof
>
On 12/20/2023 11:50 PM, Krzysztof Kozlowski wrote:
> On 20/12/2023 15:05, Mao Jinlong wrote:
>> Update the suffix for ete node name to be with "-".
>>
>> Signed-off-by: Mao Jinlong <quic_jinlmao(a)quicinc.com>
>> ---
>> .../bindings/arm/arm,embedded-trace-extension.yaml | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml b/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>> index f725e6940993..cbf583d34029 100644
>> --- a/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>> +++ b/Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml
>> @@ -23,7 +23,7 @@ description: |
>>
>> properties:
>> $nodename:
>> - pattern: "^ete([0-9a-f]+)$"
>> + pattern: "^ete-([0-9a-f]+)$"
>
> My concerns are not resolved. Why is it here in the first place?
Hi Krzysztof,
ETE is acronym of embedded trace extension. The number of the name is
the same as the number of the CPU it belongs to.
Hi Suzuki,
Please help to comment on this.
Thanks
Jinlong Mao
>
> Best regards,
> Krzysztof
>
On 15/12/2023 06:42, Adrian Hunter wrote:
> For discussion only, un-tested...
>
If anyone wants to test Coresight, the diff below is required to get the
most basic use case working. It also probably needs more thought and
some edge case handling:
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 596c01e37624..bd0767356277 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -556,7 +556,8 @@ static void etm_event_stop(struct perf_event *event, int mode)
struct etm_event_data *event_data;
struct list_head *path;
- if (mode & PERF_EF_PAUSE && !READ_ONCE(ctxt->pr_allowed))
+ if ((mode & PERF_EF_PAUSE && !READ_ONCE(ctxt->pr_allowed)) ||
+ event->hw.state == PERF_HES_STOPPED)
return;
WRITE_ONCE(ctxt->pr_allowed, 0);
@@ -573,9 +574,6 @@ static void etm_event_stop(struct perf_event *event, int mode)
/* Clear the event_data as this ETM is stopping the trace. */
ctxt->event_data = NULL;
- if (event->hw.state == PERF_HES_STOPPED)
- goto out_pr_allowed;
-
/* We must have a valid event_data for a running event */
if (WARN_ON(!event_data))
return;
@@ -586,7 +584,7 @@ static void etm_event_stop(struct perf_event *event, int mode)
* nothing needs to be torn down other than outputting a
* zero sized record.
*/
- if (handle->event && (mode & PERF_EF_UPDATE) &&
+ if (handle->event && (mode & (PERF_EF_UPDATE | PERF_EF_PAUSE)) &&
!cpumask_test_cpu(cpu, &event_data->mask)) {
event->hw.state = PERF_HES_STOPPED;
perf_aux_output_end(handle, 0);
@@ -616,7 +614,7 @@ static void etm_event_stop(struct perf_event *event, int mode)
* handle due to lack of buffer space), we don't
* have to do anything here.
*/
- if (handle->event && (mode & PERF_EF_UPDATE)) {
+ if (handle->event && (mode & (PERF_EF_UPDATE | PERF_EF_PAUSE))) {
if (WARN_ON_ONCE(handle->event != event))
return;
@@ -646,7 +644,6 @@ static void etm_event_stop(struct perf_event *event, int mode)
/* Disabling the path make its elements available to other sessions */
coresight_disable_path(path);
-out_pr_allowed:
if (mode & PERF_EF_PAUSE)
WRITE_ONCE(ctxt->pr_allowed, 1);
}
@@ -656,7 +653,7 @@ static int etm_event_add(struct perf_event *event, int mode)
int ret = 0;
struct hw_perf_event *hwc = &event->hw;
- if (mode & PERF_EF_START && !READ_ONCE(event->aux_paused)) {
+ if (mode & PERF_EF_START) {
etm_event_start(event, 0);
if (hwc->state & PERF_HES_STOPPED)
ret = -EINVAL;
--
2.34.1
On 08/12/2023 17:24, Adrian Hunter wrote:
> Hardware traces, such as instruction traces, can produce a vast amount of
> trace data, so being able to reduce tracing to more specific circumstances
> can be useful.
>
> The ability to pause or resume tracing when another event happens, can do
> that.
>
> Add ability for an event to "pause" or "resume" AUX area tracing.
>
> Add aux_pause bit to perf_event_attr to indicate that, if the event
> happens, the associated AUX area tracing should be paused. Ditto
> aux_resume. Do not allow aux_pause and aux_resume to be set together.
>
> Add aux_start_paused bit to perf_event_attr to indicate to an AUX area
> event that it should start in a "paused" state.
>
> Add aux_paused to struct perf_event for AUX area events to keep track of
> the "paused" state. aux_paused is initialized to aux_start_paused.
>
> Add PERF_EF_PAUSE and PERF_EF_RESUME modes for ->stop() and ->start()
> callbacks. Call as needed, during __perf_event_output(). Add
> aux_in_pause_resume to struct perf_buffer to prevent races with the NMI
> handler. Pause/resume in NMI context will miss out if it coincides with
> another pause/resume.
>
> To use aux_pause or aux_resume, an event must be in a group with the AUX
> area event as the group leader.
>
> Example (requires Intel PT and tools patches also):
>
> $ perf record --kcore -e '{intel_pt/aux-start-paused/k,syscalls:sys_enter_newuname/aux-resume/,syscalls:sys_exit_newuname/aux-pause/}' uname
I think it might be useful to have an aux-toggle option as well, and
then you could do sampling if you put it on a PMU counter with an
interval. Unless you can make two events for the same counter with
different intervals, and one does resume and the other does pause? I'm
not sure if that would work?
Other than that it looks ok. I got Coresight working with a couple of
changes to what you posted on here, but that can always be done more
thoroughly later if we leave PERF_PMU_CAP_AUX_PAUSE off Coresight for now.
Thanks
James
On 12/20/2023 9:21 PM, Krzysztof Kozlowski wrote:
> On 20/12/2023 14:07, Jinlong Mao wrote:
>>
>>
>> On 12/20/2023 8:46 PM, Krzysztof Kozlowski wrote:
>>> On 20/12/2023 13:40, Mao Jinlong wrote:
>>>> Add coresight components on Qualcomm SM8450 Soc. The components include
>>>> TMC ETF/ETR, ETE, STM, TPDM, CTI.
>>>>
>>>> Signed-off-by: Mao Jinlong <quic_jinlmao(a)quicinc.com>
>>>> ---
>>>> arch/arm64/boot/dts/qcom/sm8450.dtsi | 742 +++++++++++++++++++++++++++
>>>> 1 file changed, 742 insertions(+)
>>>>
>>>> diff --git a/arch/arm64/boot/dts/qcom/sm8450.dtsi b/arch/arm64/boot/dts/qcom/sm8450.dtsi
>>>> index 1783fa78bdbc..112b5a069c94 100644
>>>> --- a/arch/arm64/boot/dts/qcom/sm8450.dtsi
>>>> +++ b/arch/arm64/boot/dts/qcom/sm8450.dtsi
>>>> @@ -285,6 +285,192 @@ CLUSTER_SLEEP_1: cluster-sleep-1 {
>>>> };
>>>> };
>>>>
>>>> + ete0 {
>>>
>>> ete-0
>> Thanks for the review.
>>
>> In arm,embedded-trace-extension.yaml, the node name pattern is
>> "^ete([0-9a-f]+)$".
>
> I don't understand why this binding requires ete name. It's not like it
> is a generic name worth preserving. Also, the recommended suffix for
> names is with '-'.
>
The number in the ete name should be the same as the number of the CPU.
So we can know which CPU this ete belongs to from the name.
I will update the binding in arm,embedded-trace-extension.yaml.
Thanks
Jinlong Mao
>
> Best regards,
> Krzysztof
>