diff mbox series

[v2,04/10] coresight: trbe: Ensure the format flag is set on truncation

Message ID 20210723124611.3828908-5-suzuki.poulose@arm.com (mailing list archive)
State New, archived
Headers show
Series coresight: TRBE and Self-Hosted trace fixes | expand

Commit Message

Suzuki K Poulose July 23, 2021, 12:46 p.m. UTC
When the TRBE is stopped on truncating an event, we may not
set the FORMAT flag, even though the size of the record is 0.
Let us be consistent and not confuse the user. Always set the
format flag for TRBE generated records.

Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-trbe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Anshuman Khandual July 30, 2021, 4:26 a.m. UTC | #1
On 7/23/21 6:16 PM, Suzuki K Poulose wrote:
> When the TRBE is stopped on truncating an event, we may not
> set the FORMAT flag, even though the size of the record is 0.
> Let us be consistent and not confuse the user. Always set the
> format flag for TRBE generated records.
> 
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Leo Yan <leo.yan@linaro.org>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-trbe.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index 176868496879..446f080f8320 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -132,7 +132,8 @@ static void trbe_stop_and_truncate_event(struct perf_output_handle *handle)
>  	 * the update_buffer() to return a 0 size.
>  	 */
>  	trbe_drain_and_disable_local();
> -	perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED);
> +	perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED |
> +				     PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW);
>  	*this_cpu_ptr(buf->cpudata->drvdata->handle) = NULL;
>  }

But why should not PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW also be set on
zero sized records as well ? Otherwise there are two instances during
TRBE buffer management, where PERF_AUX_FLAG_TRUNCATED is marked alone
without PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW. Those could be changed as
well.
Suzuki K Poulose July 30, 2021, 11:37 a.m. UTC | #2
On 30/07/2021 05:26, Anshuman Khandual wrote:
> 
> 
> On 7/23/21 6:16 PM, Suzuki K Poulose wrote:
>> When the TRBE is stopped on truncating an event, we may not
>> set the FORMAT flag, even though the size of the record is 0.
>> Let us be consistent and not confuse the user. Always set the
>> format flag for TRBE generated records.
>>
>> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
>> Cc: Leo Yan <leo.yan@linaro.org>
>> Cc: Mike Leach <mike.leach@linaro.org>
>> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>> ---
>>   drivers/hwtracing/coresight/coresight-trbe.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
>> index 176868496879..446f080f8320 100644
>> --- a/drivers/hwtracing/coresight/coresight-trbe.c
>> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
>> @@ -132,7 +132,8 @@ static void trbe_stop_and_truncate_event(struct perf_output_handle *handle)
>>   	 * the update_buffer() to return a 0 size.
>>   	 */
>>   	trbe_drain_and_disable_local();
>> -	perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED);
>> +	perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED |
>> +				     PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW);
>>   	*this_cpu_ptr(buf->cpudata->drvdata->handle) = NULL;
>>   }
> 
> But why should not PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW also be set on
> zero sized records as well ? Otherwise there are two instances during
> TRBE buffer management, where PERF_AUX_FLAG_TRUNCATED is marked alone
> without PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW. Those could be changed as
> well.

All records (irrespective of the size) generated by the TRBE must
contain the "RAW" flag. Did I miss another instance where we don't
do this ?

Suzuki
>
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
index 176868496879..446f080f8320 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -132,7 +132,8 @@  static void trbe_stop_and_truncate_event(struct perf_output_handle *handle)
 	 * the update_buffer() to return a 0 size.
 	 */
 	trbe_drain_and_disable_local();
-	perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED);
+	perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED |
+				     PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW);
 	*this_cpu_ptr(buf->cpudata->drvdata->handle) = NULL;
 }