* coresight: cpu-debug: PC sampling via PMPCSR (FEAT_PCSRv8p2)?
@ 2026-11-13 5:46 Igor Velkov
2026-11-13 9:25 ` Suzuki K Poulose
2026-11-13 14:46 ` Leo Yan
0 siblings, 2 replies; 6+ messages in thread
From: Igor Velkov @ 2026-11-13 5:46 UTC (permalink / raw)
To: Suzuki K Poulose
Cc: Igor Velkov, Mike Leach, James Clark, Leo Yan, coresight,
linux-arm-kernel
Hi,
Cortex-A55 (Amlogic S905X3) reports EDDEVID.PCSample = 0, so
coresight-cpu-debug cannot use it. The PC is available through PMPCSR
in the external PMU frame (debug frame + 0x20000, PMDEVID.PCSample = 1).
A lab module reading PMPCSR caught the PC of a CPU stuck on a PCIe bus
access with IRQs off; on this GICv2 SoC the stop IPI never reaches it.
Two observations:
- A panic notifier samples too late: the other CPUs are stopped by
then, and on this SoC reading the PMU frame of a stopped CPU raises a
synchronous external abort. Sampling on entry to smp_send_stop()
works.
- Marvell has an out-of-tree patch, "coresight: cpu-debug: Add support
to dump PMPCSR" (2023, carried in linux-yocto); I could not find it
on the lists.
Is PMPCSR support in coresight-cpu-debug planned or welcome? And how
should such a PMU frame be described in DT: arm,coresight-cpu-debug or
a new compatible?
Thanks,
Igor
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: coresight: cpu-debug: PC sampling via PMPCSR (FEAT_PCSRv8p2)?
2026-11-13 5:46 coresight: cpu-debug: PC sampling via PMPCSR (FEAT_PCSRv8p2)? Igor Velkov
@ 2026-11-13 9:25 ` Suzuki K Poulose
2026-11-13 14:46 ` Leo Yan
1 sibling, 0 replies; 6+ messages in thread
From: Suzuki K Poulose @ 2026-11-13 9:25 UTC (permalink / raw)
To: Igor Velkov
Cc: Mike Leach, James Clark, Leo Yan, coresight, linux-arm-kernel,
Rob Herring
Hi Igor
On 13/11/2026 05:46, Igor Velkov wrote:
> Hi,
>
> Cortex-A55 (Amlogic S905X3) reports EDDEVID.PCSample = 0, so
> coresight-cpu-debug cannot use it. The PC is available through PMPCSR
> in the external PMU frame (debug frame + 0x20000, PMDEVID.PCSample = 1).
> A lab module reading PMPCSR caught the PC of a CPU stuck on a PCIe bus
> access with IRQs off; on this GICv2 SoC the stop IPI never reaches it.
>
> Two observations:
> - A panic notifier samples too late: the other CPUs are stopped by
> then, and on this SoC reading the PMU frame of a stopped CPU raises a
> synchronous external abort. Sampling on entry to smp_send_stop()
> works.
> - Marvell has an out-of-tree patch, "coresight: cpu-debug: Add support
> to dump PMPCSR" (2023, carried in linux-yocto); I could not find it
> on the lists.
>
> Is PMPCSR support in coresight-cpu-debug planned or welcome? And how
Patches are definitely welcome, as such I don't know of anyone working
on it from within Arm. So, please go ahead and post it.
> should such a PMU frame be described in DT: arm,coresight-cpu-debug or
> a new compatible?
If the support can be detected using the "standard" cpu-debug frame,
via the DEVID registers, I don't think we need a new compatible.
But we can debate on it with the patch review.
Cheers
Suzuki
>
> Thanks,
> Igor
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: coresight: cpu-debug: PC sampling via PMPCSR (FEAT_PCSRv8p2)?
2026-11-13 5:46 coresight: cpu-debug: PC sampling via PMPCSR (FEAT_PCSRv8p2)? Igor Velkov
2026-11-13 9:25 ` Suzuki K Poulose
@ 2026-11-13 14:46 ` Leo Yan
2026-11-14 0:08 ` Igor Velkov
1 sibling, 1 reply; 6+ messages in thread
From: Leo Yan @ 2026-11-13 14:46 UTC (permalink / raw)
To: Igor Velkov
Cc: Suzuki K Poulose, Mike Leach, James Clark, coresight,
linux-arm-kernel
Hi,
On Fri, Nov 13, 2026 at 07:46:41AM +0200, Igor Velkov wrote:
> Hi,
>
> Cortex-A55 (Amlogic S905X3) reports EDDEVID.PCSample = 0, so
> coresight-cpu-debug cannot use it. The PC is available through PMPCSR
> in the external PMU frame (debug frame + 0x20000, PMDEVID.PCSample = 1).
> A lab module reading PMPCSR caught the PC of a CPU stuck on a PCIe bus
> access with IRQs off; on this GICv2 SoC the stop IPI never reaches it.
>
> Two observations:
> - A panic notifier samples too late: the other CPUs are stopped by
> then, and on this SoC reading the PMU frame of a stopped CPU raises a
> synchronous external abort. Sampling on entry to smp_send_stop()
> works.
Arm ARM, section I5.3.48 PMPCSR mentions "PMPCSR is in the Core power
domain". The challenge is ensuring that the target core remains powered
_throughout_ the access; checking its power state beforehand still
leaves a race.
For example, with CPUidle enabled, a CPU can be powered off any time so
it still race even move sampling in smp_send_stop().
This seems to be the main challenge. I'll check a bit if any guidance
for safely accessing PMPCSR.
> - Marvell has an out-of-tree patch, "coresight: cpu-debug: Add support
> to dump PMPCSR" (2023, carried in linux-yocto); I could not find it
> on the lists.
>
> Is PMPCSR support in coresight-cpu-debug planned or welcome? And how
> should such a PMU frame be described in DT: arm,coresight-cpu-debug or
> a new compatible?
Would it make sense to describe external PMU frames in the PMU node
and have cpu-debug reference its phandle? As Suzuki mentioned, this
can be reviewed on patch.
Thanks,
Leo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: coresight: cpu-debug: PC sampling via PMPCSR (FEAT_PCSRv8p2)?
2026-11-13 14:46 ` Leo Yan
@ 2026-11-14 0:08 ` Igor Velkov
2026-11-17 18:32 ` Leo Yan
0 siblings, 1 reply; 6+ messages in thread
From: Igor Velkov @ 2026-11-14 0:08 UTC (permalink / raw)
To: Leo Yan
Cc: Suzuki K Poulose, Mike Leach, James Clark, coresight,
linux-arm-kernel, Igor Velkov
On Fri, Nov 13, 2026 at 02:46:23PM +0000, Leo Yan wrote:
> For example, with CPUidle enabled, a CPU can be powered off any time so
> it still race even move sampling in smp_send_stop().
I tested this on S905X3 (Cortex-A55, PMPCSR) and RK3399 (Cortex-A53 +
A72, EDPCSR, idle states with core powerdown).
Sampling only the CPUs still online after the stop request avoids the
race: a CPU that did not stop within the timeout did not take the stop
IPI, so it is not in a powerdown state; it spins with IRQs off or is
stuck on the bus. On RK3399 the CPUs found powered down in idle all
stopped.
EDPRSR still has to be checked, and PU alone is not enough:
- A55 after CPU_OFF on the crash path: PU=0; reading PMPCSR aborts.
- A72 after CPU_OFF: PU=1, R=1 (the same in idle); reading EDPCSR
aborts.
- S905X3: once every other core is off, even EDPRSR reads do not
return. With a stuck core still on, reading it from the panic CPU
worked on both SoCs, across clusters on RK3399.
The cpu-debug panic notifier reads every possible CPU after COREPURQ;
on RK3399 on the crash path without pseudo-NMI it hit an SError on the
first CPU that was off.
So I would send:
1. cpu-debug notifier: online CPUs other than the panic CPU, read only
with PU=1, R=0 and DLK=0, no COREPURQ;
2. PMPCSR when EDDEVID.PCSample is 0 and PMDEVID.PCSample is not.
Panic notifiers run after the stop only with crash_kexec_post_notifiers;
with a crash kernel loaded and without it, they do not run at all. Is
that acceptable, or would you rather see a hook in the crash stop path?
Thanks,
Igor
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: coresight: cpu-debug: PC sampling via PMPCSR (FEAT_PCSRv8p2)?
2026-11-14 0:08 ` Igor Velkov
@ 2026-11-17 18:32 ` Leo Yan
2026-11-17 18:50 ` Igor Velkov
0 siblings, 1 reply; 6+ messages in thread
From: Leo Yan @ 2026-11-17 18:32 UTC (permalink / raw)
To: Igor Velkov
Cc: Suzuki K Poulose, Mike Leach, James Clark, coresight,
linux-arm-kernel
On Sat, Nov 14, 2026 at 02:08:16AM +0200, Igor Velkov wrote:
> The cpu-debug panic notifier reads every possible CPU after COREPURQ;
> on RK3399 on the crash path without pseudo-NMI it hit an SError on the
> first CPU that was off.
Seems the SoC does not honor COREPURQ. The current driver relies on an
accessible debug interface; these platform limitations are already
documented in [1].
> So I would send:
> 1. cpu-debug notifier: online CPUs other than the panic CPU, read only
> with PU=1, R=0 and DLK=0, no COREPURQ;
Sampling only CPUs still online after the stop request may help, but the
online mask does not guarantee register accessibility. A late stop
acknowledgement can race with that check, and an offline CPU may still be
running (or stuck) in firmware - the driver is also helpful for CPU stuck
not in kernel.
We also need to consider FEAT_DoPD: EDPRCR and EDPRSR move from debug
power domain into the Core power domain, and COREPURQ is absent. We then
need another mechanism before accessing PCSR register.
I would check a bit if any suggestions for safely access registers.
Otherwise, we may need to explore kernel states as you suggested (not
only cpu online but also idle states).
> 2. PMPCSR when EDDEVID.PCSample is 0 and PMDEVID.PCSample is not.
This is fine for me.
> Panic notifiers run after the stop only with crash_kexec_post_notifiers;
> with a crash kernel loaded and without it, they do not run at all. Is
> that acceptable, or would you rather see a hook in the crash stop path?
I agree that the notifier need improvement.
Could we explore a hook in the CPU hard lockup detector? Seems this
module is more relevant to hard lockup rather than panic.
Thanks,
Leo
[1] Documentation/trace/coresight/coresight-cpu-debug.rst
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: coresight: cpu-debug: PC sampling via PMPCSR (FEAT_PCSRv8p2)?
2026-11-17 18:32 ` Leo Yan
@ 2026-11-17 18:50 ` Igor Velkov
0 siblings, 0 replies; 6+ messages in thread
From: Igor Velkov @ 2026-11-17 18:50 UTC (permalink / raw)
To: Leo Yan
Cc: Suzuki K Poulose, Mike Leach, James Clark, coresight,
linux-arm-kernel
On Tue, Nov 17, 2026 at 06:32:41PM +0000, Leo Yan wrote:
> Could we explore a hook in the CPU hard lockup detector? Seems this
> module is more relevant to hard lockup rather than panic.
Yes, that fits better. The hard lockup detector reports a CPU that
missed its watchdog hrtimer interrupts, so it runs with IRQs masked and
is not in an idle powerdown. The backtrace request then names the CPUs
that did not answer ("these CPUS still haven't responded"). I would
sample PCSR only for those, from a hook at that point, and leave the
panic notifier alone. Does that sound right?
Thanks,
Igor
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-17 18:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 5:46 coresight: cpu-debug: PC sampling via PMPCSR (FEAT_PCSRv8p2)? Igor Velkov
2026-11-13 9:25 ` Suzuki K Poulose
2026-11-13 14:46 ` Leo Yan
2026-11-14 0:08 ` Igor Velkov
2026-11-17 18:32 ` Leo Yan
2026-11-17 18:50 ` Igor Velkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox