* [PATCH] coresight: etm4x: Remove redundant claim register setting
@ 2025-05-01 10:42 Leo Yan
2025-05-01 10:54 ` James Clark
0 siblings, 1 reply; 3+ messages in thread
From: Leo Yan @ 2025-05-01 10:42 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
coresight, linux-arm-kernel, linux-kernel
Cc: Leo Yan
The claim register is set twice in the restore flow; remove the
duplicate operation.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
index 5c20ed4cf4ed..228317991ec2 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
@@ -1958,8 +1958,6 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
if (drvdata->numvmidc > 4)
etm4x_relaxed_write32(csa, state->trcvmidcctlr0, TRCVMIDCCTLR1);
- etm4x_relaxed_write32(csa, state->trcclaimset, TRCCLAIMSET);
-
if (!drvdata->skip_power_up)
etm4x_relaxed_write32(csa, state->trcpdcr, TRCPDCR);
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] coresight: etm4x: Remove redundant claim register setting
2025-05-01 10:42 [PATCH] coresight: etm4x: Remove redundant claim register setting Leo Yan
@ 2025-05-01 10:54 ` James Clark
2025-05-01 11:45 ` Leo Yan
0 siblings, 1 reply; 3+ messages in thread
From: James Clark @ 2025-05-01 10:54 UTC (permalink / raw)
To: Leo Yan
Cc: Suzuki K Poulose, Mike Leach, Alexander Shishkin, coresight,
linux-arm-kernel, linux-kernel
On 01/05/2025 11:42 am, Leo Yan wrote:
> The claim register is set twice in the restore flow; remove the
> duplicate operation.
>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
> drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index 5c20ed4cf4ed..228317991ec2 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -1958,8 +1958,6 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
> if (drvdata->numvmidc > 4)
> etm4x_relaxed_write32(csa, state->trcvmidcctlr0, TRCVMIDCCTLR1);
>
> - etm4x_relaxed_write32(csa, state->trcclaimset, TRCCLAIMSET);
> -
> if (!drvdata->skip_power_up)
> etm4x_relaxed_write32(csa, state->trcpdcr, TRCPDCR);
>
Reviewed-by: James Clark <james.clark@linaro.org>
Semi-related to this patch but probably not worth fixing: There's
technically a race condition with an external debugger here. It would be
better to use coresight_claim_device_unlocked() and report the error
that's returned instead of manually writing to the whole claim register
without checking it before and after like the claim function does.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] coresight: etm4x: Remove redundant claim register setting
2025-05-01 10:54 ` James Clark
@ 2025-05-01 11:45 ` Leo Yan
0 siblings, 0 replies; 3+ messages in thread
From: Leo Yan @ 2025-05-01 11:45 UTC (permalink / raw)
To: James Clark
Cc: Suzuki K Poulose, Mike Leach, Alexander Shishkin, coresight,
linux-arm-kernel, linux-kernel
On Thu, May 01, 2025 at 11:54:58AM +0100, James Clark wrote:
>
> On 01/05/2025 11:42 am, Leo Yan wrote:
> > The claim register is set twice in the restore flow; remove the
> > duplicate operation.
> >
> > Signed-off-by: Leo Yan <leo.yan@arm.com>
> > ---
> > drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> > index 5c20ed4cf4ed..228317991ec2 100644
> > --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> > +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> > @@ -1958,8 +1958,6 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
> > if (drvdata->numvmidc > 4)
> > etm4x_relaxed_write32(csa, state->trcvmidcctlr0, TRCVMIDCCTLR1);
> > - etm4x_relaxed_write32(csa, state->trcclaimset, TRCCLAIMSET);
> > -
> > if (!drvdata->skip_power_up)
> > etm4x_relaxed_write32(csa, state->trcpdcr, TRCPDCR);
>
> Reviewed-by: James Clark <james.clark@linaro.org>
>
> Semi-related to this patch but probably not worth fixing: There's
> technically a race condition with an external debugger here. It would be
> better to use coresight_claim_device_unlocked() and report the error that's
> returned instead of manually writing to the whole claim register without
> checking it before and after like the claim function does.
I thought again and conclude the current patch would be fine (at least
not bad ;)
The reason is the ETM driver has acquired the OS lock during idle
states, this prevents the race condition with external debuggers.
And if a CPU detects pending interrupts and abort a low power flow,
the CoreSight self claim tag is still set. In this case,
coresight_claim_device_unlocked() will report unnecessary warnings.
Thanks,
Leo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-01 11:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-01 10:42 [PATCH] coresight: etm4x: Remove redundant claim register setting Leo Yan
2025-05-01 10:54 ` James Clark
2025-05-01 11:45 ` Leo Yan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®