From: Suzuki K Poulose <suzuki.poulose@arm.com> To: mathieu.poirier@linaro.org, linux-arm-kernel@lists.infradead.org Cc: anshuman.khandual@arm.com, mike.leach@linaro.org, leo.yan@linaro.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, Suzuki K Poulose <suzuki.poulose@arm.com> Subject: [PATCH v4 1/5] coresight: trbe: irq handler: Do not disable TRBE if no action is needed Date: Thu, 23 Sep 2021 15:39:15 +0100 [thread overview] Message-ID: <20210923143919.2944311-2-suzuki.poulose@arm.com> (raw) In-Reply-To: <20210923143919.2944311-1-suzuki.poulose@arm.com> The IRQ handler of the TRBE driver could race against the update_buffer() in consuming the IRQ. So, if the update_buffer() gets to processing the TRBE irq, the TRBSR will be cleared. Thus by the time IRQ handler is triggered, there is nothing to do there. Handle these cases and do not disable the TRBE unnecessarily. Since the TRBSR can be read without stopping the TRBE, we can check that before disabling the TRBE. Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> --- drivers/hwtracing/coresight/coresight-trbe.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index 2cf28de2e447..e78800ba5b5b 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -762,12 +762,7 @@ static irqreturn_t arm_trbe_irq_handler(int irq, void *dev) enum trbe_fault_action act; u64 status; - /* - * Ensure the trace is visible to the CPUs and - * any external aborts have been resolved. - */ - trbe_drain_and_disable_local(); - + /* Reads to TRBSR_EL1 is fine when TRBE is active */ status = read_sysreg_s(SYS_TRBSR_EL1); /* * If the pending IRQ was handled by update_buffer callback @@ -776,6 +771,11 @@ static irqreturn_t arm_trbe_irq_handler(int irq, void *dev) if (!is_trbe_irq(status)) return IRQ_NONE; + /* + * Ensure the trace is visible to the CPUs and + * any external aborts have been resolved. + */ + trbe_drain_and_disable_local(); clr_trbe_irq(); isb(); -- 2.24.1
WARNING: multiple messages have this Message-ID (diff)
From: Suzuki K Poulose <suzuki.poulose@arm.com> To: mathieu.poirier@linaro.org, linux-arm-kernel@lists.infradead.org Cc: anshuman.khandual@arm.com, mike.leach@linaro.org, leo.yan@linaro.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, Suzuki K Poulose <suzuki.poulose@arm.com> Subject: [PATCH v4 1/5] coresight: trbe: irq handler: Do not disable TRBE if no action is needed Date: Thu, 23 Sep 2021 15:39:15 +0100 [thread overview] Message-ID: <20210923143919.2944311-2-suzuki.poulose@arm.com> (raw) In-Reply-To: <20210923143919.2944311-1-suzuki.poulose@arm.com> The IRQ handler of the TRBE driver could race against the update_buffer() in consuming the IRQ. So, if the update_buffer() gets to processing the TRBE irq, the TRBSR will be cleared. Thus by the time IRQ handler is triggered, there is nothing to do there. Handle these cases and do not disable the TRBE unnecessarily. Since the TRBSR can be read without stopping the TRBE, we can check that before disabling the TRBE. Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> --- drivers/hwtracing/coresight/coresight-trbe.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index 2cf28de2e447..e78800ba5b5b 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -762,12 +762,7 @@ static irqreturn_t arm_trbe_irq_handler(int irq, void *dev) enum trbe_fault_action act; u64 status; - /* - * Ensure the trace is visible to the CPUs and - * any external aborts have been resolved. - */ - trbe_drain_and_disable_local(); - + /* Reads to TRBSR_EL1 is fine when TRBE is active */ status = read_sysreg_s(SYS_TRBSR_EL1); /* * If the pending IRQ was handled by update_buffer callback @@ -776,6 +771,11 @@ static irqreturn_t arm_trbe_irq_handler(int irq, void *dev) if (!is_trbe_irq(status)) return IRQ_NONE; + /* + * Ensure the trace is visible to the CPUs and + * any external aborts have been resolved. + */ + trbe_drain_and_disable_local(); clr_trbe_irq(); isb(); -- 2.24.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-09-23 14:39 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-23 14:39 [PATCH v4 0/5] coresight: TRBE and Self-Hosted trace fixes Suzuki K Poulose 2021-09-23 14:39 ` Suzuki K Poulose 2021-09-23 14:39 ` Suzuki K Poulose [this message] 2021-09-23 14:39 ` [PATCH v4 1/5] coresight: trbe: irq handler: Do not disable TRBE if no action is needed Suzuki K Poulose 2021-09-23 14:39 ` [PATCH v4 2/5] coresight: trbe: Fix handling of spurious interrupts Suzuki K Poulose 2021-09-23 14:39 ` Suzuki K Poulose 2021-09-23 14:39 ` [PATCH v4 3/5] coresight: trbe: Do not truncate buffer on IRQ Suzuki K Poulose 2021-09-23 14:39 ` Suzuki K Poulose 2021-09-23 14:39 ` [PATCH v4 4/5] coresight: trbe: End the AUX handle on truncation Suzuki K Poulose 2021-09-23 14:39 ` Suzuki K Poulose 2021-09-23 14:39 ` [PATCH v4 5/5] coresight: trbe: Prohibit trace before disabling TRBE Suzuki K Poulose 2021-09-23 14:39 ` Suzuki K Poulose 2021-09-23 16:55 ` [PATCH v4 0/5] coresight: TRBE and Self-Hosted trace fixes Mathieu Poirier 2021-09-23 16:55 ` Mathieu Poirier 2021-09-23 18:07 ` Suzuki K Poulose 2021-09-23 18:07 ` Suzuki K Poulose
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=20210923143919.2944311-2-suzuki.poulose@arm.com \ --to=suzuki.poulose@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 \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.