linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: coresight@lists.linaro.org, linux-kernel@vger.kernel.org,
	al.grant@arm.com, anshuman.khandual@arm.com, leo.yan@linaro.org,
	mathieu.poirier@linaro.org, mike.leach@linaro.org,
	peterz@infradead.org, suzuki.poulose@arm.com,
	Tamas.Zsoldos@arm.com, will@kernel.org
Subject: [PATCH 4/5] coresight: trbe: Move irq_work queue processing
Date: Mon, 12 Jul 2021 12:38:29 +0100	[thread overview]
Message-ID: <20210712113830.2803257-5-suzuki.poulose@arm.com> (raw)
In-Reply-To: <20210712113830.2803257-1-suzuki.poulose@arm.com>

The TRBE driver issues the irq_work_run() to ensure that
any pending disable event callback has been processed. But this
is done before we mark the AUX buffer as TRUNCATED, making
the call pointless. Move the call after the current handle
has been closed.

Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver")
Reported-by: Tamas Zsoldos <Tamas.Zsoldos@arm.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-trbe.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
index ec38cf17b693..c0c264264427 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -723,6 +723,14 @@ static void trbe_handle_overflow(struct perf_output_handle *handle)
 	perf_aux_output_flag(handle, PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW |
 				     PERF_AUX_FLAG_TRUNCATED);
 	perf_aux_output_end(handle, size);
+
+	/*
+	 * Ensure perf callbacks have completed. Since we
+	 * always TRUNCATE the buffer on IRQ, the event
+	 * is scheduled to be disabled. Make sure that happens
+	 * as soon as possible.
+	 */
+	irq_work_run();
 }
 
 static bool is_perf_trbe(struct perf_output_handle *handle)
@@ -777,12 +785,6 @@ static irqreturn_t arm_trbe_irq_handler(int irq, void *dev)
 	if (!is_perf_trbe(handle))
 		return IRQ_NONE;
 
-	/*
-	 * Ensure perf callbacks have completed, which may disable
-	 * the trace buffer in response to a TRUNCATION flag.
-	 */
-	irq_work_run();
-
 	act = trbe_get_fault_act(status);
 	switch (act) {
 	case TRBE_FAULT_ACT_WRAP:
-- 
2.24.1


  parent reply	other threads:[~2021-07-12 11:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12 11:38 [PATCH 0/5] coresight: TRBE and Self-Hosted trace fixes Suzuki K Poulose
2021-07-12 11:38 ` [PATCH 1/5] coresight: etm4x: Save restore TRFCR_EL1 Suzuki K Poulose
2021-07-12 11:38 ` [PATCH 2/5] coresight: etm4x: Use Trace Filtering controls dynamically Suzuki K Poulose
2021-07-12 11:38 ` [PATCH 3/5] coresight: trbe: Keep TRBE disabled on overflow irq Suzuki K Poulose
2021-07-15  3:54   ` Anshuman Khandual
2021-07-15  8:28     ` Suzuki K Poulose
2021-07-18  6:11       ` Anshuman Khandual
2021-07-20  8:53   ` Suzuki K Poulose
2021-07-12 11:38 ` Suzuki K Poulose [this message]
2021-07-15  3:23   ` [PATCH 4/5] coresight: trbe: Move irq_work queue processing Anshuman Khandual
2021-07-15  8:33     ` Suzuki K Poulose
2021-07-18  6:13       ` Anshuman Khandual
2021-07-12 11:38 ` [PATCH 5/5] coresight: trbe: Prohibit tracing while handling an IRQ Suzuki K Poulose
2021-07-15  3:09   ` Anshuman Khandual
2021-07-15  8:52     ` Suzuki K Poulose
2021-07-18  6:31       ` Anshuman Khandual
2021-07-12 17:02 ` [PATCH 0/5] coresight: TRBE and Self-Hosted trace fixes Mathieu Poirier
2021-07-13  7:23   ` 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=20210712113830.2803257-5-suzuki.poulose@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=Tamas.Zsoldos@arm.com \
    --cc=al.grant@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=coresight@lists.linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /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).