linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	anshuman.khandual@arm.com, mike.leach@linaro.org,
	leo.yan@linaro.org, tamas.zsoldos@arm.com,
	jinlmao@qti.qualcomm.com, al.grant@arm.com, denik@google.com
Subject: Re: [PATCH v3 04/10] coresight: trbe: Ensure the format flag is set always
Date: Wed, 22 Sep 2021 10:33:57 -0600	[thread overview]
Message-ID: <20210922163357.GA2129167@p14s> (raw)
In-Reply-To: <20210914102641.1852544-5-suzuki.poulose@arm.com>

On Tue, Sep 14, 2021 at 11:26:35AM +0100, 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.
> 
> To ensure that the format flag is always set on all the
> records generated by TRBE, set the flag when we have a
> new handle. Rather than deferring to the "end" operation,
> which makes it clear. So, we can do this from
> 
>  -  arm_trbe_enable() -> When a new handle is provided by the
>     CoreSight PMU, triggered via etm_event_start()
>  -  trbe_handle_overflow() -> When we begin a new handle after
>     closing the previous on overflow.
> 
> 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>
> ---
> Changes since v2:
>   - Move the format flag setting to the beginning of a session
>     than the ending (which can happen via various different paths)
> ---
>  drivers/hwtracing/coresight/coresight-trbe.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>

I have applied patches 1 to 4.

> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index 176868496879..81bf183a73a1 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -554,8 +554,6 @@ static unsigned long arm_trbe_update_buffer(struct coresight_device *csdev,
>  	if (cpudata->mode != CS_MODE_PERF)
>  		return 0;
>  
> -	perf_aux_output_flag(handle, PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW);
> -
>  	/*
>  	 * We are about to disable the TRBE. And this could in turn
>  	 * fill up the buffer triggering, an IRQ. This could be consumed
> @@ -648,6 +646,7 @@ static int arm_trbe_enable(struct coresight_device *csdev, u32 mode, void *data)
>  	if (mode != CS_MODE_PERF)
>  		return -EINVAL;
>  
> +	perf_aux_output_flag(handle, PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW);
>  	*this_cpu_ptr(drvdata->handle) = handle;
>  	cpudata->buf = buf;
>  	cpudata->mode = mode;
> @@ -710,8 +709,7 @@ static void trbe_handle_overflow(struct perf_output_handle *handle)
>  	 * Mark the buffer as truncated, as we have stopped the trace
>  	 * collection upon the WRAP event, without stopping the source.
>  	 */
> -	perf_aux_output_flag(handle, PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW |
> -				     PERF_AUX_FLAG_TRUNCATED);
> +	perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED);
>  	perf_aux_output_end(handle, size);
>  	event_data = perf_aux_output_begin(handle, event);
>  	if (!event_data) {
> @@ -725,6 +723,7 @@ static void trbe_handle_overflow(struct perf_output_handle *handle)
>  		*this_cpu_ptr(buf->cpudata->drvdata->handle) = NULL;
>  		return;
>  	}
> +	perf_aux_output_flag(handle, PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW);
>  	buf->trbe_limit = compute_trbe_buffer_limit(handle);
>  	buf->trbe_write = buf->trbe_base + PERF_IDX2OFF(handle->head, buf);
>  	if (buf->trbe_limit == buf->trbe_base) {
> -- 
> 2.24.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-09-22 16:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 10:26 [PATCH v3 00/10] coresight: TRBE and Self-Hosted trace fixes Suzuki K Poulose
2021-09-14 10:26 ` [PATCH v3 01/10] coresight: etm4x: Save restore TRFCR_EL1 Suzuki K Poulose
2021-09-21 15:50   ` Mathieu Poirier
2021-09-14 10:26 ` [PATCH v3 02/10] coresight: etm4x: Use Trace Filtering controls dynamically Suzuki K Poulose
2021-09-15  4:59   ` Anshuman Khandual
2021-09-14 10:26 ` [PATCH v3 03/10] coresight: etm-pmu: Ensure the AUX handle is valid Suzuki K Poulose
2021-09-14 10:26 ` [PATCH v3 04/10] coresight: trbe: Ensure the format flag is set always Suzuki K Poulose
2021-09-15  5:15   ` Anshuman Khandual
2021-09-22 16:33   ` Mathieu Poirier [this message]
2021-09-14 10:26 ` [PATCH v3 05/10] coresight: trbe: Drop duplicate TRUNCATE flags Suzuki K Poulose
2021-09-15  5:26   ` Anshuman Khandual
2021-09-22 16:34     ` Mathieu Poirier
2021-09-14 10:26 ` [PATCH v3 06/10] coresight: trbe: Fix handling of spurious interrupts Suzuki K Poulose
2021-09-15  5:44   ` Anshuman Khandual
2021-09-21 17:24   ` Mathieu Poirier
2021-09-21 21:29     ` Suzuki K Poulose
2021-09-22 17:13       ` Mathieu Poirier
2021-09-14 10:26 ` [PATCH v3 07/10] coresight: trbe: Do not truncate buffer on IRQ Suzuki K Poulose
2021-09-15  6:44   ` Anshuman Khandual
2021-09-21 17:41   ` Mathieu Poirier
2021-09-21 17:50     ` Mathieu Poirier
2021-09-14 10:26 ` [PATCH v3 08/10] coresight: trbe: Unify the enabling sequence Suzuki K Poulose
2021-09-22 16:56   ` Mathieu Poirier
2021-09-14 10:26 ` [PATCH v3 09/10] coresight: trbe: End the AUX handle on truncation Suzuki K Poulose
2021-09-14 10:26 ` [PATCH v3 10/10] coresight: trbe: Prohibit trace before disabling TRBE Suzuki K Poulose
2021-09-15  6:58   ` Anshuman Khandual

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=20210922163357.GA2129167@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=al.grant@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=coresight@lists.linaro.org \
    --cc=denik@google.com \
    --cc=jinlmao@qti.qualcomm.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mike.leach@linaro.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tamas.zsoldos@arm.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;
as well as URLs for NNTP newsgroup(s).