* [PATCH RFC 01/10] Documentation: coresight: cpu-debug: Fix the module parameter name
2026-11-27 6:38 [PATCH RFC 00/10] coresight: cpu-debug: Sample CPUs that ignore a backtrace request Igor Velkov via B4 Relay
@ 2026-11-27 6:38 ` Igor Velkov via B4 Relay
2026-11-27 20:41 ` Randy Dunlap
2026-12-04 16:03 ` Leo Yan
2026-11-27 6:38 ` [PATCH RFC 02/10] coresight: cpu-debug: Make the enable parameter read-only in sysfs Igor Velkov via B4 Relay
` (8 subsequent siblings)
9 siblings, 2 replies; 18+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-27 6:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan, Andrew Morton,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Randy Dunlap, Douglas Anderson,
Petr Mladek, Feng Tang, Igor Velkov
From: Igor Velkov <iav@iav.lv>
The parameter that enables the debugging is "enable"; the module has no
"debug" parameter.
Fixes: 0cd555c35131 ("doc: Add documentation for Coresight CPU debug")
Signed-off-by: Igor Velkov <iav@iav.lv>
---
Documentation/trace/coresight/coresight-cpu-debug.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/trace/coresight/coresight-cpu-debug.rst b/Documentation/trace/coresight/coresight-cpu-debug.rst
index 836b35532667..32fbae244524 100644
--- a/Documentation/trace/coresight/coresight-cpu-debug.rst
+++ b/Documentation/trace/coresight/coresight-cpu-debug.rst
@@ -130,7 +130,7 @@ If you want to enable debugging functionality at boot time, you can add
The driver also can work as module, so can enable the debugging when insmod
module::
- # insmod coresight_cpu_debug.ko debug=1
+ # insmod coresight_cpu_debug.ko enable=1
When boot time or insmod module you have not enabled the debugging, the driver
uses the debugfs file system to provide a knob to dynamically enable or disable
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH RFC 01/10] Documentation: coresight: cpu-debug: Fix the module parameter name
2026-11-27 6:38 ` [PATCH RFC 01/10] Documentation: coresight: cpu-debug: Fix the module parameter name Igor Velkov via B4 Relay
@ 2026-11-27 20:41 ` Randy Dunlap
2026-12-04 16:03 ` Leo Yan
1 sibling, 0 replies; 18+ messages in thread
From: Randy Dunlap @ 2026-11-27 20:41 UTC (permalink / raw)
To: iav, Suzuki K Poulose, Mike Leach, James Clark, Leo Yan,
Andrew Morton, Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Douglas Anderson, Petr Mladek,
Feng Tang
On 11/26/26 10:38 PM, Igor Velkov via B4 Relay wrote:
> From: Igor Velkov <iav@iav.lv>
>
> The parameter that enables the debugging is "enable"; the module has no
> "debug" parameter.
>
> Fixes: 0cd555c35131 ("doc: Add documentation for Coresight CPU debug")
> Signed-off-by: Igor Velkov <iav@iav.lv>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
> ---
> Documentation/trace/coresight/coresight-cpu-debug.rst | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/trace/coresight/coresight-cpu-debug.rst b/Documentation/trace/coresight/coresight-cpu-debug.rst
> index 836b35532667..32fbae244524 100644
> --- a/Documentation/trace/coresight/coresight-cpu-debug.rst
> +++ b/Documentation/trace/coresight/coresight-cpu-debug.rst
> @@ -130,7 +130,7 @@ If you want to enable debugging functionality at boot time, you can add
> The driver also can work as module, so can enable the debugging when insmod
> module::
>
> - # insmod coresight_cpu_debug.ko debug=1
> + # insmod coresight_cpu_debug.ko enable=1
>
> When boot time or insmod module you have not enabled the debugging, the driver
> uses the debugfs file system to provide a knob to dynamically enable or disable
>
--
~Randy
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH RFC 01/10] Documentation: coresight: cpu-debug: Fix the module parameter name
2026-11-27 6:38 ` [PATCH RFC 01/10] Documentation: coresight: cpu-debug: Fix the module parameter name Igor Velkov via B4 Relay
2026-11-27 20:41 ` Randy Dunlap
@ 2026-12-04 16:03 ` Leo Yan
1 sibling, 0 replies; 18+ messages in thread
From: Leo Yan @ 2026-12-04 16:03 UTC (permalink / raw)
To: iav
Cc: Suzuki K Poulose, Mike Leach, James Clark, Andrew Morton,
Alexander Shishkin, coresight, linux-arm-kernel, linux-doc,
linux-kernel, Jonathan Corbet, Shuah Khan, Randy Dunlap,
Douglas Anderson, Petr Mladek, Feng Tang
On Fri, Nov 27, 2026 at 08:38:38AM +0200, Igor Velkov via B4 Relay wrote:
> From: Igor Velkov <iav@iav.lv>
>
> The parameter that enables the debugging is "enable"; the module has no
> "debug" parameter.
>
> Fixes: 0cd555c35131 ("doc: Add documentation for Coresight CPU debug")
> Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH RFC 02/10] coresight: cpu-debug: Make the enable parameter read-only in sysfs
2026-11-27 6:38 [PATCH RFC 00/10] coresight: cpu-debug: Sample CPUs that ignore a backtrace request Igor Velkov via B4 Relay
2026-11-27 6:38 ` [PATCH RFC 01/10] Documentation: coresight: cpu-debug: Fix the module parameter name Igor Velkov via B4 Relay
@ 2026-11-27 6:38 ` Igor Velkov via B4 Relay
2026-12-04 16:11 ` Leo Yan
2026-11-27 6:38 ` [PATCH RFC 03/10] coresight: cpu-debug: Publish the per-CPU data under debug_lock Igor Velkov via B4 Relay
` (7 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-27 6:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan, Andrew Morton,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Randy Dunlap, Douglas Anderson,
Petr Mladek, Feng Tang, Igor Velkov
From: Igor Velkov <iav@iav.lv>
A write to /sys/module/coresight_cpu_debug/parameters/enable changes
debug_enable but takes no runtime PM reference, so the driver then
reads the debug registers with their clock and power domain possibly
off. A later write to the debugfs knob finds debug_enable already set
and does nothing.
Leave the parameter for the command line and for module load, and the
debugfs knob for run time, as the documentation describes. A set
callback that does what the knob does would also work, but one run-time
interface is enough.
Fixes: 2227b7c74634 ("coresight: add support for CPU debug module")
Signed-off-by: Igor Velkov <iav@iav.lv>
---
drivers/hwtracing/coresight/coresight-cpu-debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index edccbd2fa5e2..f9e6e344ed59 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -109,7 +109,7 @@ static int debug_count;
static struct dentry *debug_debugfs_dir;
static bool debug_enable = IS_ENABLED(CONFIG_CORESIGHT_CPU_DEBUG_DEFAULT_ON);
-module_param_named(enable, debug_enable, bool, 0600);
+module_param_named(enable, debug_enable, bool, 0400);
MODULE_PARM_DESC(enable, "Control to enable coresight CPU debug functionality");
static void debug_os_unlock(struct debug_drvdata *drvdata)
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH RFC 02/10] coresight: cpu-debug: Make the enable parameter read-only in sysfs
2026-11-27 6:38 ` [PATCH RFC 02/10] coresight: cpu-debug: Make the enable parameter read-only in sysfs Igor Velkov via B4 Relay
@ 2026-12-04 16:11 ` Leo Yan
0 siblings, 0 replies; 18+ messages in thread
From: Leo Yan @ 2026-12-04 16:11 UTC (permalink / raw)
To: iav
Cc: Suzuki K Poulose, Mike Leach, James Clark, Andrew Morton,
Alexander Shishkin, coresight, linux-arm-kernel, linux-doc,
linux-kernel, Jonathan Corbet, Shuah Khan, Randy Dunlap,
Douglas Anderson, Petr Mladek, Feng Tang
On Fri, Nov 27, 2026 at 08:38:39AM +0200, Igor Velkov via B4 Relay wrote:
> Leave the parameter for the command line and for module load, and the
> debugfs knob for run time, as the documentation describes. A set
> callback that does what the knob does would also work, but one run-time
> interface is enough.
Makes sense to me.
> Fixes: 2227b7c74634 ("coresight: add support for CPU debug module")
> Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH RFC 03/10] coresight: cpu-debug: Publish the per-CPU data under debug_lock
2026-11-27 6:38 [PATCH RFC 00/10] coresight: cpu-debug: Sample CPUs that ignore a backtrace request Igor Velkov via B4 Relay
2026-11-27 6:38 ` [PATCH RFC 01/10] Documentation: coresight: cpu-debug: Fix the module parameter name Igor Velkov via B4 Relay
2026-11-27 6:38 ` [PATCH RFC 02/10] coresight: cpu-debug: Make the enable parameter read-only in sysfs Igor Velkov via B4 Relay
@ 2026-11-27 6:38 ` Igor Velkov via B4 Relay
2026-12-04 17:04 ` Leo Yan
2026-11-27 6:38 ` [PATCH RFC 04/10] coresight: cpu-debug: Bound the power up retries Igor Velkov via B4 Relay
` (6 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-27 6:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan, Andrew Morton,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Randy Dunlap, Douglas Anderson,
Petr Mladek, Feng Tang, Igor Velkov
From: Igor Velkov <iav@iav.lv>
The probe stores the per-CPU pointer before it has read the device ID
registers, so a device that it goes on to reject is visible to the
panic notifier and to the debugfs knob in between. The knob walks the
pointers under debug_lock, but the probe and the remove path change
them outside it: a write to the knob between the store and the
pm_runtime_put() of the probe leaves the device with one runtime PM
reference too many.
Store the pointer once the device is known to be usable, and change it
only under debug_lock, which the knob holds while it takes or drops the
runtime PM references of the published devices.
Fixes: 2227b7c74634 ("coresight: add support for CPU debug module")
Signed-off-by: Igor Velkov <iav@iav.lv>
---
drivers/hwtracing/coresight/coresight-cpu-debug.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index f9e6e344ed59..c55de98100a3 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -590,30 +590,31 @@ static int __debug_probe(struct device *dev, struct resource *res)
drvdata->base = base;
cpus_read_lock();
- per_cpu(debug_drvdata, drvdata->cpu) = drvdata;
ret = smp_call_function_single(drvdata->cpu, debug_init_arch_data,
drvdata, 1);
cpus_read_unlock();
if (ret) {
dev_err(dev, "CPU%d debug arch init failed\n", drvdata->cpu);
- goto err;
+ return ret;
}
if (!drvdata->edpcsr_present) {
dev_err(dev, "CPU%d sample-based profiling isn't implemented\n",
drvdata->cpu);
- ret = -ENXIO;
- goto err;
+ return -ENXIO;
}
if (!debug_count++) {
ret = debug_func_init();
- if (ret)
- goto err_func_init;
+ if (ret) {
+ debug_count--;
+ return ret;
+ }
}
mutex_lock(&debug_lock);
+ per_cpu(debug_drvdata, drvdata->cpu) = drvdata;
/* Turn off debug power domain if debugging is disabled */
if (!debug_enable)
pm_runtime_put(dev);
@@ -621,12 +622,6 @@ static int __debug_probe(struct device *dev, struct resource *res)
dev_info(dev, "Coresight debug-CPU%d initialized\n", drvdata->cpu);
return 0;
-
-err_func_init:
- debug_count--;
-err:
- per_cpu(debug_drvdata, drvdata->cpu) = NULL;
- return ret;
}
static int debug_probe(struct amba_device *adev, const struct amba_id *id)
@@ -638,9 +633,8 @@ static void __debug_remove(struct device *dev)
{
struct debug_drvdata *drvdata = dev_get_drvdata(dev);
- per_cpu(debug_drvdata, drvdata->cpu) = NULL;
-
mutex_lock(&debug_lock);
+ per_cpu(debug_drvdata, drvdata->cpu) = NULL;
/* Turn off debug power domain before rmmod the module */
if (debug_enable)
pm_runtime_put(dev);
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH RFC 03/10] coresight: cpu-debug: Publish the per-CPU data under debug_lock
2026-11-27 6:38 ` [PATCH RFC 03/10] coresight: cpu-debug: Publish the per-CPU data under debug_lock Igor Velkov via B4 Relay
@ 2026-12-04 17:04 ` Leo Yan
0 siblings, 0 replies; 18+ messages in thread
From: Leo Yan @ 2026-12-04 17:04 UTC (permalink / raw)
To: iav
Cc: Suzuki K Poulose, Mike Leach, James Clark, Andrew Morton,
Alexander Shishkin, coresight, linux-arm-kernel, linux-doc,
linux-kernel, Jonathan Corbet, Shuah Khan, Randy Dunlap,
Douglas Anderson, Petr Mladek, Feng Tang
On Fri, Nov 27, 2026 at 08:38:40AM +0200, Igor Velkov via B4 Relay wrote:
[...]
> Store the pointer once the device is known to be usable, and change it
> only under debug_lock, which the knob holds while it takes or drops the
> runtime PM references of the published devices.
The problem is the duplicate check per_cpu(debug_drvdata, cpu) still
runs outside debug_lock in __debug_probe().
Maybe it is good to go a bit further:
- Call debug_func_init() from debug_init() and debug_func_exit() from
debug_exit(). The debugfs knob and notifier would then exist for the
lifetime of the driver. That would let us drop debug_count and avoid
racing debugfs setup in probe against teardown in remove.
- In __debug_probe(), after the SMP call succeeds and the hardware
checks pass, take debug_lock, check if the CPU slot is duplicated,
and publish drvdata before unlocking.
Thanks,
Leo
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH RFC 04/10] coresight: cpu-debug: Bound the power up retries
2026-11-27 6:38 [PATCH RFC 00/10] coresight: cpu-debug: Sample CPUs that ignore a backtrace request Igor Velkov via B4 Relay
` (2 preceding siblings ...)
2026-11-27 6:38 ` [PATCH RFC 03/10] coresight: cpu-debug: Publish the per-CPU data under debug_lock Igor Velkov via B4 Relay
@ 2026-11-27 6:38 ` Igor Velkov via B4 Relay
2026-12-04 17:28 ` Leo Yan
2026-11-27 6:38 ` [PATCH RFC 05/10] coresight: cpu-debug: Do not sample a core that is in reset Igor Velkov via B4 Relay
` (5 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-27 6:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan, Andrew Morton,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Randy Dunlap, Douglas Anderson,
Petr Mladek, Feng Tang, Igor Velkov
From: Igor Velkov <iav@iav.lv>
debug_force_cpu_powered_up() starts over whenever the core is found
powered down again right after CORENPDRQ is set, with no limit. Where
the power controller does not hold the core up, the caller never
returns.
Give up after three tries. EDPRSR then shows the core powered down and
debug_access_permitted() keeps the caller away from its registers.
Fixes: 2227b7c74634 ("coresight: add support for CPU debug module")
Signed-off-by: Igor Velkov <iav@iav.lv>
---
drivers/hwtracing/coresight/coresight-cpu-debug.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index c55de98100a3..9a8ce85fc468 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -84,6 +84,7 @@
#define DEBUG_WAIT_SLEEP 1000
#define DEBUG_WAIT_TIMEOUT 32000
+#define DEBUG_POWER_UP_TRIES 3
struct debug_drvdata {
struct clk *pclk;
@@ -147,6 +148,7 @@ static bool debug_access_permitted(struct debug_drvdata *drvdata)
static void debug_force_cpu_powered_up(struct debug_drvdata *drvdata)
{
+ int tries = DEBUG_POWER_UP_TRIES;
u32 edprcr;
try_again:
@@ -186,8 +188,8 @@ static void debug_force_cpu_powered_up(struct debug_drvdata *drvdata)
drvdata->edprsr = readl_relaxed(drvdata->base + EDPRSR);
- /* The core power domain got switched off on use, try again */
- if (unlikely(!(drvdata->edprsr & EDPRSR_PU)))
+ /* The core power domain got switched off on use, try again if allowed */
+ if (unlikely(!(drvdata->edprsr & EDPRSR_PU)) && --tries)
goto try_again;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH RFC 04/10] coresight: cpu-debug: Bound the power up retries
2026-11-27 6:38 ` [PATCH RFC 04/10] coresight: cpu-debug: Bound the power up retries Igor Velkov via B4 Relay
@ 2026-12-04 17:28 ` Leo Yan
0 siblings, 0 replies; 18+ messages in thread
From: Leo Yan @ 2026-12-04 17:28 UTC (permalink / raw)
To: iav
Cc: Suzuki K Poulose, Mike Leach, James Clark, Andrew Morton,
Alexander Shishkin, coresight, linux-arm-kernel, linux-doc,
linux-kernel, Jonathan Corbet, Shuah Khan, Randy Dunlap,
Douglas Anderson, Petr Mladek, Feng Tang
On Fri, Nov 27, 2026 at 08:38:41AM +0200, Igor Velkov via B4 Relay wrote:
[...]
> static void debug_force_cpu_powered_up(struct debug_drvdata *drvdata)
> {
> + int tries = DEBUG_POWER_UP_TRIES;
> u32 edprcr;
>
> try_again:
> @@ -186,8 +188,8 @@ static void debug_force_cpu_powered_up(struct debug_drvdata *drvdata)
>
> drvdata->edprsr = readl_relaxed(drvdata->base + EDPRSR);
>
> - /* The core power domain got switched off on use, try again */
> - if (unlikely(!(drvdata->edprsr & EDPRSR_PU)))
> + /* The core power domain got switched off on use, try again if allowed */
> + if (unlikely(!(drvdata->edprsr & EDPRSR_PU)) && --tries)
> goto try_again;
I'd add a helper to poll the CPU power state:
static int debug_poll_cpu_power_state(struct debug_drvdata *drvdata)
{
return readx_poll_timeout_atomic(readl_relaxed, drvdata->base + EDPRSR,
drvdata->edprsr, drvdata->edprsr & EDPRSR_PU,
DEBUG_WAIT_SLEEP, DEBUG_WAIT_TIMEOUT);
}
We can then call it twice (one is after setting EDPRCR_COREPURQ and
again after setting EDPRCR_COREPURQ | EDPRCR_CORENPDRQ).
Thanks,
Leo
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH RFC 05/10] coresight: cpu-debug: Do not sample a core that is in reset
2026-11-27 6:38 [PATCH RFC 00/10] coresight: cpu-debug: Sample CPUs that ignore a backtrace request Igor Velkov via B4 Relay
` (3 preceding siblings ...)
2026-11-27 6:38 ` [PATCH RFC 04/10] coresight: cpu-debug: Bound the power up retries Igor Velkov via B4 Relay
@ 2026-11-27 6:38 ` Igor Velkov via B4 Relay
2026-12-04 17:33 ` Leo Yan
2026-11-27 6:38 ` [PATCH RFC 06/10] coresight: cpu-debug: Factor out debug_read_pcsr() Igor Velkov via B4 Relay
` (4 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-27 6:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan, Andrew Morton,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Randy Dunlap, Douglas Anderson,
Petr Mladek, Feng Tang, Igor Velkov
From: Igor Velkov <iav@iav.lv>
debug_access_permitted() lets the driver read the sampling registers
when EDPRSR shows the core powered and the OS Double Lock clear. A core
can be powered and held in reset: an idle Cortex-A72 on RK3399 reads
PU = 1, R = 1, and a read of its EDPCSR aborts.
Treat a core that EDPRSR reports in reset as not accessible, and print
the bit in the dump.
debug_read_regs() writes EDOSLAR before it reads EDPRSR, and on RK3399
that write already faults for such a core. The check covers the path
added later in this series, which reads EDPRSR first.
Signed-off-by: Igor Velkov <iav@iav.lv>
---
Documentation/trace/coresight/coresight-cpu-debug.rst | 4 ++--
drivers/hwtracing/coresight/coresight-cpu-debug.c | 9 ++++++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/Documentation/trace/coresight/coresight-cpu-debug.rst b/Documentation/trace/coresight/coresight-cpu-debug.rst
index 32fbae244524..04bfd318cb2b 100644
--- a/Documentation/trace/coresight/coresight-cpu-debug.rst
+++ b/Documentation/trace/coresight/coresight-cpu-debug.rst
@@ -182,12 +182,12 @@ Here is an example of the debugging output format::
ARM external debug module:
coresight-cpu-debug 850000.debug: CPU[0]:
- coresight-cpu-debug 850000.debug: EDPRSR: 00000001 (Power:On DLK:Unlock)
+ coresight-cpu-debug 850000.debug: EDPRSR: 00000001 (Power:On Reset:No DLK:Unlock)
coresight-cpu-debug 850000.debug: EDPCSR: handle_IPI+0x174/0x1d8
coresight-cpu-debug 850000.debug: EDCIDSR: 00000000
coresight-cpu-debug 850000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0)
coresight-cpu-debug 852000.debug: CPU[1]:
- coresight-cpu-debug 852000.debug: EDPRSR: 00000001 (Power:On DLK:Unlock)
+ coresight-cpu-debug 852000.debug: EDPRSR: 00000001 (Power:On Reset:No DLK:Unlock)
coresight-cpu-debug 852000.debug: EDPCSR: debug_notifier_call+0x23c/0x358
coresight-cpu-debug 852000.debug: EDCIDSR: 00000000
coresight-cpu-debug 852000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0)
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index 9a8ce85fc468..64b5abe33aa8 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -51,6 +51,7 @@
/* bits definition for EDPRSR */
#define EDPRSR_DLK BIT(6)
+#define EDPRSR_R BIT(2)
#define EDPRSR_PU BIT(0)
/* bits definition for EDVIDSR */
@@ -129,6 +130,7 @@ static void debug_os_unlock(struct debug_drvdata *drvdata)
* registers to avoid lockup issue:
*
* - CPU power domain is powered off;
+ * - The CPU is in reset;
* - The OS Double Lock is locked;
*
* By checking EDPRSR can get to know if meet these conditions.
@@ -139,6 +141,10 @@ static bool debug_access_permitted(struct debug_drvdata *drvdata)
if (!(drvdata->edprsr & EDPRSR_PU))
return false;
+ /* CPU is in reset */
+ if (drvdata->edprsr & EDPRSR_R)
+ return false;
+
/* The OS Double Lock is locked */
if (drvdata->edprsr & EDPRSR_DLK)
return false;
@@ -293,9 +299,10 @@ static void debug_dump_regs(struct debug_drvdata *drvdata)
struct device *dev = drvdata->dev;
unsigned long pc;
- dev_emerg(dev, " EDPRSR: %08x (Power:%s DLK:%s)\n",
+ dev_emerg(dev, " EDPRSR: %08x (Power:%s Reset:%s DLK:%s)\n",
drvdata->edprsr,
drvdata->edprsr & EDPRSR_PU ? "On" : "Off",
+ drvdata->edprsr & EDPRSR_R ? "Yes" : "No",
drvdata->edprsr & EDPRSR_DLK ? "Lock" : "Unlock");
if (!debug_access_permitted(drvdata)) {
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH RFC 05/10] coresight: cpu-debug: Do not sample a core that is in reset
2026-11-27 6:38 ` [PATCH RFC 05/10] coresight: cpu-debug: Do not sample a core that is in reset Igor Velkov via B4 Relay
@ 2026-12-04 17:33 ` Leo Yan
0 siblings, 0 replies; 18+ messages in thread
From: Leo Yan @ 2026-12-04 17:33 UTC (permalink / raw)
To: iav
Cc: Suzuki K Poulose, Mike Leach, James Clark, Andrew Morton,
Alexander Shishkin, coresight, linux-arm-kernel, linux-doc,
linux-kernel, Jonathan Corbet, Shuah Khan, Randy Dunlap,
Douglas Anderson, Petr Mladek, Feng Tang
On Fri, Nov 27, 2026 at 08:38:42AM +0200, Igor Velkov via B4 Relay wrote:
[...]
> --- a/Documentation/trace/coresight/coresight-cpu-debug.rst
> +++ b/Documentation/trace/coresight/coresight-cpu-debug.rst
> @@ -182,12 +182,12 @@ Here is an example of the debugging output format::
>
> ARM external debug module:
> coresight-cpu-debug 850000.debug: CPU[0]:
> - coresight-cpu-debug 850000.debug: EDPRSR: 00000001 (Power:On DLK:Unlock)
> + coresight-cpu-debug 850000.debug: EDPRSR: 00000001 (Power:On Reset:No DLK:Unlock)
I'm happy to just print "" in the non-reset case, but your approach
works for me too. Either way,
Reviewed-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH RFC 06/10] coresight: cpu-debug: Factor out debug_read_pcsr()
2026-11-27 6:38 [PATCH RFC 00/10] coresight: cpu-debug: Sample CPUs that ignore a backtrace request Igor Velkov via B4 Relay
` (4 preceding siblings ...)
2026-11-27 6:38 ` [PATCH RFC 05/10] coresight: cpu-debug: Do not sample a core that is in reset Igor Velkov via B4 Relay
@ 2026-11-27 6:38 ` Igor Velkov via B4 Relay
2026-12-04 17:38 ` Leo Yan
2026-11-27 6:38 ` [PATCH RFC 07/10] lib/nmi_backtrace: notify about CPUs that ignore a backtrace request Igor Velkov via B4 Relay
` (3 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-27 6:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan, Andrew Morton,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Randy Dunlap, Douglas Anderson,
Petr Mladek, Feng Tang, Igor Velkov
From: Igor Velkov <iav@iav.lv>
Move the reads of EDPCSR and of the registers it latches out of
debug_read_regs(), so that they can be reused without the EDPRCR power
request.
No functional change.
Signed-off-by: Igor Velkov <iav@iav.lv>
---
drivers/hwtracing/coresight/coresight-cpu-debug.c | 46 ++++++++++++-----------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index 64b5abe33aa8..63bc4cb8df52 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -199,27 +199,8 @@ static void debug_force_cpu_powered_up(struct debug_drvdata *drvdata)
goto try_again;
}
-static void debug_read_regs(struct debug_drvdata *drvdata)
+static void debug_read_pcsr(struct debug_drvdata *drvdata)
{
- u32 save_edprcr;
-
- CS_UNLOCK(drvdata->base);
-
- /* Unlock os lock */
- debug_os_unlock(drvdata);
-
- /* Save EDPRCR register */
- save_edprcr = readl_relaxed(drvdata->base + EDPRCR);
-
- /*
- * Ensure CPU power domain is enabled to let registers
- * are accessiable.
- */
- debug_force_cpu_powered_up(drvdata);
-
- if (!debug_access_permitted(drvdata))
- goto out;
-
drvdata->edpcsr = readl_relaxed(drvdata->base + EDPCSR);
/*
@@ -230,7 +211,7 @@ static void debug_read_regs(struct debug_drvdata *drvdata)
* UNKNOWN state. So directly bail out for this case.
*/
if (drvdata->edpcsr == EDPCSR_PROHIBITED)
- goto out;
+ return;
/*
* A read of the EDPCSR normally has the side-effect of
@@ -245,8 +226,29 @@ static void debug_read_regs(struct debug_drvdata *drvdata)
if (drvdata->edvidsr_present)
drvdata->edvidsr = readl_relaxed(drvdata->base + EDVIDSR);
+}
+
+static void debug_read_regs(struct debug_drvdata *drvdata)
+{
+ u32 save_edprcr;
+
+ CS_UNLOCK(drvdata->base);
+
+ /* Unlock os lock */
+ debug_os_unlock(drvdata);
+
+ /* Save EDPRCR register */
+ save_edprcr = readl_relaxed(drvdata->base + EDPRCR);
+
+ /*
+ * Ensure CPU power domain is enabled to let registers
+ * are accessiable.
+ */
+ debug_force_cpu_powered_up(drvdata);
+
+ if (debug_access_permitted(drvdata))
+ debug_read_pcsr(drvdata);
-out:
/* Restore EDPRCR register */
writel_relaxed(save_edprcr, drvdata->base + EDPRCR);
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH RFC 06/10] coresight: cpu-debug: Factor out debug_read_pcsr()
2026-11-27 6:38 ` [PATCH RFC 06/10] coresight: cpu-debug: Factor out debug_read_pcsr() Igor Velkov via B4 Relay
@ 2026-12-04 17:38 ` Leo Yan
0 siblings, 0 replies; 18+ messages in thread
From: Leo Yan @ 2026-12-04 17:38 UTC (permalink / raw)
To: iav
Cc: Suzuki K Poulose, Mike Leach, James Clark, Andrew Morton,
Alexander Shishkin, coresight, linux-arm-kernel, linux-doc,
linux-kernel, Jonathan Corbet, Shuah Khan, Randy Dunlap,
Douglas Anderson, Petr Mladek, Feng Tang
On Fri, Nov 27, 2026 at 08:38:43AM +0200, Igor Velkov via B4 Relay wrote:
> From: Igor Velkov <iav@iav.lv>
>
> Move the reads of EDPCSR and of the registers it latches out of
> debug_read_regs(), so that they can be reused without the EDPRCR power
> request.
>
> No functional change.
>
> Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH RFC 07/10] lib/nmi_backtrace: notify about CPUs that ignore a backtrace request
2026-11-27 6:38 [PATCH RFC 00/10] coresight: cpu-debug: Sample CPUs that ignore a backtrace request Igor Velkov via B4 Relay
` (5 preceding siblings ...)
2026-11-27 6:38 ` [PATCH RFC 06/10] coresight: cpu-debug: Factor out debug_read_pcsr() Igor Velkov via B4 Relay
@ 2026-11-27 6:38 ` Igor Velkov via B4 Relay
2026-11-27 6:38 ` [PATCH RFC 08/10] coresight: cpu-debug: Dump " Igor Velkov via B4 Relay
` (2 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-27 6:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan, Andrew Morton,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Randy Dunlap, Douglas Anderson,
Petr Mladek, Feng Tang, Igor Velkov
From: Igor Velkov <iav@iav.lv>
nmi_trigger_cpumask_backtrace() waits 10 seconds for the CPUs it asked
for a backtrace and then reports the ones that did not respond. A CPU
locked up with interrupts masked cannot take a request sent as a
regular IPI, so its stack cannot be had, but an external debug
interface may still be able to sample its program counter.
Add an atomic notifier chain that is called with the CPUs that did not
respond. idle_cpu() is not exported to modules, so pass the idle CPUs
as a second mask.
nmi_backtrace_stall_check() is called at the same point, but it is an
arch hook; the consumer here is a tristate driver bound to per-CPU
devices, so it takes a notifier.
Signed-off-by: Igor Velkov <iav@iav.lv>
---
include/linux/nmi.h | 28 +++++++++++++++++++++++++++
lib/nmi_backtrace.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+)
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index af69712df5f4..f2f8c9e42ff7 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -8,6 +8,8 @@
#include <linux/sched.h>
#include <asm/irq.h>
+struct notifier_block;
+
/* Arch specific watchdogs might need to share extra watchdog-related APIs. */
#if defined(CONFIG_HARDLOCKUP_DETECTOR_ARCH) || defined(CONFIG_HARDLOCKUP_DETECTOR_SPARC64)
#include <asm/nmi.h>
@@ -151,6 +153,19 @@ static inline void touch_nmi_watchdog(void)
touch_softlockup_watchdog();
}
+/**
+ * struct nmi_backtrace_stall - CPUs that ignored a backtrace request
+ * @cpus: CPUs that did not respond before the timeout; one that responds
+ * while the notifiers run is cleared from the mask
+ * @idle: the CPUs of @cpus that idle_cpu() reported as idle: they run their
+ * idle task and have nothing queued, so a CPU stuck in idle with a
+ * wakeup pending is not among them
+ */
+struct nmi_backtrace_stall {
+ const struct cpumask *cpus;
+ const struct cpumask *idle;
+};
+
/*
* Create trigger_all_cpu_backtrace() out of the arch-provided
* base function. Return whether such support was available,
@@ -189,7 +204,20 @@ void nmi_trigger_cpumask_backtrace(const cpumask_t *mask,
void (*raise)(cpumask_t *mask));
bool nmi_cpu_backtrace(struct pt_regs *regs);
+int nmi_backtrace_stall_notifier_register(struct notifier_block *nb);
+int nmi_backtrace_stall_notifier_unregister(struct notifier_block *nb);
+
#else
+static inline int nmi_backtrace_stall_notifier_register(struct notifier_block *nb)
+{
+ return 0;
+}
+
+static inline int nmi_backtrace_stall_notifier_unregister(struct notifier_block *nb)
+{
+ return 0;
+}
+
static inline bool trigger_all_cpu_backtrace(void)
{
return false;
diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
index f39c9eca8888..2b5a4e693599 100644
--- a/lib/nmi_backtrace.c
+++ b/lib/nmi_backtrace.c
@@ -18,6 +18,7 @@
#include <linux/kprobes.h>
#include <linux/stringify.h>
#include <linux/nmi.h>
+#include <linux/notifier.h>
#include <linux/cpu.h>
#include <linux/export.h>
#include <linux/sched/debug.h>
@@ -31,6 +32,60 @@ static unsigned long backtrace_flag;
#define NMI_BT_TIMEOUT_SEC 10
+static ATOMIC_NOTIFIER_HEAD(backtrace_stall_chain);
+static DECLARE_BITMAP(backtrace_stall_idle_mask, NR_CPUS);
+
+/**
+ * nmi_backtrace_stall_notifier_register - watch for CPUs ignoring a backtrace
+ * @nb: notifier to call with a &struct nmi_backtrace_stall
+ *
+ * The notifier runs in the context of the backtrace request, which can be
+ * an NMI, and the masks it is passed are valid only until it returns. Only
+ * requests that go through nmi_trigger_cpumask_backtrace() are reported.
+ *
+ * Return: 0 on success, -EEXIST if @nb is already registered.
+ */
+int nmi_backtrace_stall_notifier_register(struct notifier_block *nb)
+{
+ return atomic_notifier_chain_register(&backtrace_stall_chain, nb);
+}
+EXPORT_SYMBOL_GPL(nmi_backtrace_stall_notifier_register);
+
+/**
+ * nmi_backtrace_stall_notifier_unregister - stop watching for such CPUs
+ * @nb: notifier to remove
+ *
+ * Waits for a running notifier to return, so it can sleep and must not be
+ * called from the notifier.
+ *
+ * Return: 0 on success, -ENOENT if @nb is not registered.
+ */
+int nmi_backtrace_stall_notifier_unregister(struct notifier_block *nb)
+{
+ return atomic_notifier_chain_unregister(&backtrace_stall_chain, nb);
+}
+EXPORT_SYMBOL_GPL(nmi_backtrace_stall_notifier_unregister);
+
+static void nmi_backtrace_stall_notify(void)
+{
+ struct nmi_backtrace_stall stall = {
+ .cpus = to_cpumask(backtrace_mask),
+ .idle = to_cpumask(backtrace_stall_idle_mask),
+ };
+ int cpu;
+
+ if (atomic_notifier_call_chain_is_empty(&backtrace_stall_chain))
+ return;
+
+ cpumask_clear(to_cpumask(backtrace_stall_idle_mask));
+ for_each_cpu(cpu, stall.cpus) {
+ if (idle_cpu(cpu))
+ __cpumask_set_cpu(cpu, to_cpumask(backtrace_stall_idle_mask));
+ }
+
+ atomic_notifier_call_chain(&backtrace_stall_chain, 0, &stall);
+}
+
/*
* When raise() is called it will be passed a pointer to the
* backtrace_mask. Architectures that call nmi_cpu_backtrace()
@@ -85,6 +140,7 @@ void nmi_trigger_cpumask_backtrace(const cpumask_t *mask,
cpumask_pr_args(to_cpumask(backtrace_mask)));
nmi_backtrace_stall_check(to_cpumask(backtrace_mask));
+ nmi_backtrace_stall_notify();
}
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH RFC 08/10] coresight: cpu-debug: Dump CPUs that ignore a backtrace request
2026-11-27 6:38 [PATCH RFC 00/10] coresight: cpu-debug: Sample CPUs that ignore a backtrace request Igor Velkov via B4 Relay
` (6 preceding siblings ...)
2026-11-27 6:38 ` [PATCH RFC 07/10] lib/nmi_backtrace: notify about CPUs that ignore a backtrace request Igor Velkov via B4 Relay
@ 2026-11-27 6:38 ` Igor Velkov via B4 Relay
2026-11-27 6:38 ` [PATCH RFC 09/10] coresight: cpu-debug: Remove the panic notifier Igor Velkov via B4 Relay
2026-11-27 6:38 ` [PATCH RFC 10/10] coresight: cpu-debug: Print the dump at the warning level Igor Velkov via B4 Relay
9 siblings, 0 replies; 18+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-27 6:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan, Andrew Morton,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Randy Dunlap, Douglas Anderson,
Petr Mladek, Feng Tang, Igor Velkov
From: Igor Velkov <iav@iav.lv>
A CPU that is locked up with interrupts masked does not respond to a
backtrace request unless the request is delivered as an NMI, and the
kernel can only report that it did not respond. Its program counter can
still be sampled through the external debug interface.
Register for the backtrace stall notification and dump the CPUs it
names. A CPU that the scheduler does not see as idle is expected to be
powered: sample it without the EDPRCR power request, only if EDPRSR
shows it accessible, and clear the OS lock only if it is set. An idle
CPU goes through the same path as on panic, with the power request.
The notification also comes on a system that keeps running, for
example on SysRq-l or on an RCU stall warning, and the path with the
power request is not safe everywhere. On RK3399 a test module running
the register sequence of that path raises an SError on the reading CPU
for an idle core of either cluster: the write to EDOSLAR faults, and
COREPURQ powers a Cortex-A53 only for a moment. Add the skip_idle
parameter to leave idle CPUs alone on such platforms.
The notifier can run in NMI context and cannot take debug_lock. Make
the per-CPU pointer RCU protected; on disable and on remove, clear
debug_enable or the pointer first and wait for a grace period before
the runtime PM reference is dropped.
Suggested-by: Leo Yan <leo.yan@arm.com>
Link: https://lore.kernel.org/r/20261118104917.GW9176@e132581.arm.com
Signed-off-by: Igor Velkov <iav@iav.lv>
---
Documentation/admin-guide/kernel-parameters.txt | 10 ++
.../trace/coresight/coresight-cpu-debug.rst | 16 +++
drivers/hwtracing/coresight/coresight-cpu-debug.c | 136 ++++++++++++++++++---
3 files changed, 145 insertions(+), 17 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 0b3c140babd9..b1ca2ca599b2 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1011,6 +1011,16 @@ Kernel parameters
0: default value, disable debugging
1: enable debugging at boot time
+ coresight_cpu_debug.skip_idle
+ [ARM,ARM64]
+ Format: <bool>
+ Of the CPUs that do not respond to a backtrace
+ request, do not sample the idle ones. For platforms
+ where the debug registers of an idle CPU are not
+ safe to access.
+ 0: default value, sample idle CPUs
+ 1: skip idle CPUs
+
cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver
Format:
<first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>]
diff --git a/Documentation/trace/coresight/coresight-cpu-debug.rst b/Documentation/trace/coresight/coresight-cpu-debug.rst
index 04bfd318cb2b..e25177b3b857 100644
--- a/Documentation/trace/coresight/coresight-cpu-debug.rst
+++ b/Documentation/trace/coresight/coresight-cpu-debug.rst
@@ -40,6 +40,15 @@ Implementation
bit width, etc; EDCIDSR is context ID value which contains the sampled value
of CONTEXTIDR_EL1.
+- The driver also dumps the CPUs that do not respond to a backtrace request.
+ A CPU that is locked up with interrupts masked does not respond unless the
+ request is delivered as an NMI. A CPU that the scheduler does not report as
+ idle is sampled without the EDPRCR power request, and only if EDPRSR shows
+ it accessible (powered, out of reset, OS Double Lock clear). An idle CPU is
+ sampled the way the panic notifier does it, with the power request, unless
+ the "skip_idle" parameter is set. Idle is what idle_cpu() reports: the CPU
+ runs its idle task and has no task waiting to run.
+
- The driver supports a CPU running in either AArch64 or AArch32 mode. The
registers naming convention is a bit different between them, AArch64 uses
'ED' for register prefix (ARM DDI 0487A.k, chapter H9.1) and AArch32 uses
@@ -150,6 +159,13 @@ controller cannot work well for the request from EDPRCR, then you should
firstly constraint CPU idle states before enable CPU debugging feature; so can
ensure the accessing to debug logic.
+The dump of the CPUs that do not respond to a backtrace request can also happen
+on a system that keeps running, for example on SysRq-l or on an RCU stall
+warning. If the idle states are to stay enabled there, set
+"coresight_cpu_debug.skip_idle=1" in the kernel command line or write '1' into
+/sys/module/coresight_cpu_debug/parameters/skip_idle: the driver then does not
+sample the idle CPUs. The dump on panic still reads every CPU.
+
If you want to limit idle states at boot time, you can use "nohlt" or
"cpuidle.off=1" in the kernel command line.
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index 63bc4cb8df52..ffbdad1204a4 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -18,9 +18,12 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/nmi.h>
+#include <linux/notifier.h>
#include <linux/panic_notifier.h>
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
+#include <linux/rcupdate.h>
#include <linux/slab.h>
#include <linux/smp.h>
#include <linux/types.h>
@@ -51,6 +54,7 @@
/* bits definition for EDPRSR */
#define EDPRSR_DLK BIT(6)
+#define EDPRSR_OSLK BIT(5)
#define EDPRSR_R BIT(2)
#define EDPRSR_PU BIT(0)
@@ -106,7 +110,7 @@ struct debug_drvdata {
};
static DEFINE_MUTEX(debug_lock);
-static DEFINE_PER_CPU(struct debug_drvdata *, debug_drvdata);
+static DEFINE_PER_CPU(struct debug_drvdata __rcu *, debug_drvdata);
static int debug_count;
static struct dentry *debug_debugfs_dir;
@@ -114,6 +118,17 @@ static bool debug_enable = IS_ENABLED(CONFIG_CORESIGHT_CPU_DEBUG_DEFAULT_ON);
module_param_named(enable, debug_enable, bool, 0400);
MODULE_PARM_DESC(enable, "Control to enable coresight CPU debug functionality");
+static bool debug_skip_idle;
+module_param_named(skip_idle, debug_skip_idle, bool, 0600);
+MODULE_PARM_DESC(skip_idle, "Do not sample idle CPUs (for platforms where their debug registers are not safe to access)");
+
+/* The per-CPU pointers change only under debug_lock */
+static struct debug_drvdata *debug_drvdata_locked(int cpu)
+{
+ return rcu_dereference_protected(per_cpu(debug_drvdata, cpu),
+ lockdep_is_held(&debug_lock));
+}
+
static void debug_os_unlock(struct debug_drvdata *drvdata)
{
/* Unlocks the debug registers */
@@ -255,6 +270,26 @@ static void debug_read_regs(struct debug_drvdata *drvdata)
CS_LOCK(drvdata->base);
}
+/*
+ * Sample a CPU that is not idle and so is expected to be powered: leave
+ * EDPRCR alone and touch the core only if EDPRSR shows it accessible.
+ */
+static void debug_read_regs_running(struct debug_drvdata *drvdata)
+{
+ CS_UNLOCK(drvdata->base);
+
+ drvdata->edprsr = readl_relaxed(drvdata->base + EDPRSR);
+
+ if (debug_access_permitted(drvdata)) {
+ if (drvdata->edprsr & EDPRSR_OSLK)
+ debug_os_unlock(drvdata);
+
+ debug_read_pcsr(drvdata);
+ }
+
+ CS_LOCK(drvdata->base);
+}
+
#ifdef CONFIG_64BIT
static unsigned long debug_adjust_pc(struct debug_drvdata *drvdata)
{
@@ -404,7 +439,7 @@ static int debug_notifier_call(struct notifier_block *self,
pr_emerg("ARM external debug module:\n");
for_each_possible_cpu(cpu) {
- drvdata = per_cpu(debug_drvdata, cpu);
+ drvdata = debug_drvdata_locked(cpu);
if (!drvdata)
continue;
@@ -423,6 +458,56 @@ static struct notifier_block debug_notifier = {
.notifier_call = debug_notifier_call,
};
+/*
+ * Dump the CPUs that did not respond to a backtrace request. This can run
+ * in NMI context.
+ */
+static int debug_stall_notifier_call(struct notifier_block *self,
+ unsigned long v, void *p)
+{
+ const struct nmi_backtrace_stall *stall = p;
+ struct debug_drvdata *drvdata;
+ bool banner = false;
+ bool idle;
+ int cpu;
+
+ if (!READ_ONCE(debug_enable))
+ return NOTIFY_DONE;
+
+ for_each_cpu(cpu, stall->cpus) {
+ drvdata = rcu_dereference(per_cpu(debug_drvdata, cpu));
+ if (!drvdata)
+ continue;
+
+ if (!banner) {
+ pr_emerg("ARM external debug module:\n");
+ banner = true;
+ }
+
+ idle = cpumask_test_cpu(cpu, stall->idle);
+ if (idle && READ_ONCE(debug_skip_idle)) {
+ dev_emerg(drvdata->dev, "CPU[%d]: idle, not sampled\n",
+ drvdata->cpu);
+ continue;
+ }
+
+ dev_emerg(drvdata->dev, "CPU[%d]:\n", drvdata->cpu);
+
+ if (idle)
+ debug_read_regs(drvdata);
+ else
+ debug_read_regs_running(drvdata);
+
+ debug_dump_regs(drvdata);
+ }
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block debug_stall_notifier = {
+ .notifier_call = debug_stall_notifier_call,
+};
+
static int debug_enable_func(void)
{
struct debug_drvdata *drvdata;
@@ -436,7 +521,7 @@ static int debug_enable_func(void)
cpumask_clear(&mask);
for_each_possible_cpu(cpu) {
- drvdata = per_cpu(debug_drvdata, cpu);
+ drvdata = debug_drvdata_locked(cpu);
if (!drvdata)
continue;
@@ -455,7 +540,7 @@ static int debug_enable_func(void)
* that have been enabled before that.
*/
for_each_cpu(cpu, &mask) {
- drvdata = per_cpu(debug_drvdata, cpu);
+ drvdata = debug_drvdata_locked(cpu);
pm_runtime_put_noidle(drvdata->dev);
}
@@ -473,7 +558,7 @@ static void debug_disable_func(void)
* encountered.
*/
for_each_possible_cpu(cpu) {
- drvdata = per_cpu(debug_drvdata, cpu);
+ drvdata = debug_drvdata_locked(cpu);
if (!drvdata)
continue;
@@ -496,18 +581,22 @@ static ssize_t debug_func_knob_write(struct file *f,
if (val == debug_enable)
goto out;
- if (val)
+ if (val) {
ret = debug_enable_func();
- else
- debug_disable_func();
+ if (ret) {
+ pr_err("%s: unable to enable debug function: %d\n",
+ __func__, ret);
+ goto err;
+ }
- if (ret) {
- pr_err("%s: unable to %s debug function: %d\n",
- __func__, val ? "enable" : "disable", ret);
- goto err;
- }
+ WRITE_ONCE(debug_enable, true);
+ } else {
+ WRITE_ONCE(debug_enable, false);
- debug_enable = val;
+ /* The stall notifier must be done before the clocks stop */
+ synchronize_rcu();
+ debug_disable_func();
+ }
out:
ret = count;
err:
@@ -553,8 +642,18 @@ static int debug_func_init(void)
goto err;
}
+ ret = nmi_backtrace_stall_notifier_register(&debug_stall_notifier);
+ if (ret) {
+ pr_err("%s: unable to register stall notifier: %d\n",
+ __func__, ret);
+ goto err_stall;
+ }
+
return 0;
+err_stall:
+ atomic_notifier_chain_unregister(&panic_notifier_list,
+ &debug_notifier);
err:
debugfs_remove_recursive(debug_debugfs_dir);
return ret;
@@ -562,6 +661,7 @@ static int debug_func_init(void)
static void debug_func_exit(void)
{
+ nmi_backtrace_stall_notifier_unregister(&debug_stall_notifier);
atomic_notifier_chain_unregister(&panic_notifier_list,
&debug_notifier);
debugfs_remove_recursive(debug_debugfs_dir);
@@ -587,7 +687,7 @@ static int __debug_probe(struct device *dev, struct resource *res)
if (drvdata->cpu < 0)
return drvdata->cpu;
- if (per_cpu(debug_drvdata, drvdata->cpu)) {
+ if (rcu_access_pointer(per_cpu(debug_drvdata, drvdata->cpu))) {
dev_err(dev, "CPU%d drvdata has already been initialized\n",
drvdata->cpu);
return -EBUSY;
@@ -625,7 +725,7 @@ static int __debug_probe(struct device *dev, struct resource *res)
}
mutex_lock(&debug_lock);
- per_cpu(debug_drvdata, drvdata->cpu) = drvdata;
+ rcu_assign_pointer(per_cpu(debug_drvdata, drvdata->cpu), drvdata);
/* Turn off debug power domain if debugging is disabled */
if (!debug_enable)
pm_runtime_put(dev);
@@ -645,7 +745,9 @@ static void __debug_remove(struct device *dev)
struct debug_drvdata *drvdata = dev_get_drvdata(dev);
mutex_lock(&debug_lock);
- per_cpu(debug_drvdata, drvdata->cpu) = NULL;
+ RCU_INIT_POINTER(per_cpu(debug_drvdata, drvdata->cpu), NULL);
+ /* The stall notifier may still be reading this CPU */
+ synchronize_rcu();
/* Turn off debug power domain before rmmod the module */
if (debug_enable)
pm_runtime_put(dev);
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH RFC 09/10] coresight: cpu-debug: Remove the panic notifier
2026-11-27 6:38 [PATCH RFC 00/10] coresight: cpu-debug: Sample CPUs that ignore a backtrace request Igor Velkov via B4 Relay
` (7 preceding siblings ...)
2026-11-27 6:38 ` [PATCH RFC 08/10] coresight: cpu-debug: Dump " Igor Velkov via B4 Relay
@ 2026-11-27 6:38 ` Igor Velkov via B4 Relay
2026-11-27 6:38 ` [PATCH RFC 10/10] coresight: cpu-debug: Print the dump at the warning level Igor Velkov via B4 Relay
9 siblings, 0 replies; 18+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-27 6:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan, Andrew Morton,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Randy Dunlap, Douglas Anderson,
Petr Mladek, Feng Tang, Igor Velkov
From: Igor Velkov <iav@iav.lv>
The CPUs that ignore a backtrace request are dumped from the backtrace
stall notifier. When the hard lockup detector finds another CPU locked
up, it sends such a request to that CPU before it panics, and the panic
notifier then dumps the same CPU once more.
The panic notifier also reads every possible CPU through the EDPRCR
power request. On the platforms where that is not safe it raises an
SError in the middle of the panic.
Remove it. This changes what a panic prints: the dump no longer covers
every CPU and no longer comes with every panic. "panic_sys_info=all_bt"
brings back the dump of the CPUs that do not respond, as the kernel
then requests a backtrace from all CPUs before it stops them.
Without SMP there is no backtrace request to ignore and the driver
would do nothing, so make it depend on SMP.
The example output in the documentation came from the panic notifier;
replace it with a dump of a CPU locked up by LKDTM HARDLOCKUP on
RK3399.
Suggested-by: Leo Yan <leo.yan@arm.com>
Link: https://lore.kernel.org/r/20261118104917.GW9176@e132581.arm.com
Signed-off-by: Igor Velkov <iav@iav.lv>
---
.../trace/coresight/coresight-cpu-debug.rst | 47 +++++++++---------
drivers/hwtracing/coresight/Kconfig | 8 ++--
drivers/hwtracing/coresight/coresight-cpu-debug.c | 55 +---------------------
3 files changed, 29 insertions(+), 81 deletions(-)
diff --git a/Documentation/trace/coresight/coresight-cpu-debug.rst b/Documentation/trace/coresight/coresight-cpu-debug.rst
index e25177b3b857..d841c2fb610e 100644
--- a/Documentation/trace/coresight/coresight-cpu-debug.rst
+++ b/Documentation/trace/coresight/coresight-cpu-debug.rst
@@ -20,9 +20,8 @@ The debug module provides sample-based profiling extension, which can be used
to sample CPU program counter, secure state and exception level, etc; usually
every CPU has one dedicated debug module to be connected. Based on self-hosted
debug mechanism, Linux kernel can access these related registers from mmio
-region when the kernel panic happens. The callback notifier for kernel panic
-will dump related registers for every CPU; finally this is good for assistant
-analysis for panic.
+region when a CPU does not respond to a backtrace request. The driver then
+dumps the related registers of that CPU, which shows where it is stuck.
Implementation
@@ -34,20 +33,23 @@ Implementation
this feature is not supported then registration will fail.
- At the time this documentation was written, the debug driver mainly relies on
- information gathered by the kernel panic callback notifier from three
- sampling registers: EDPCSR, EDVIDSR and EDCIDSR: from EDPCSR we can get
- program counter; EDVIDSR has information for secure state, exception level,
- bit width, etc; EDCIDSR is context ID value which contains the sampled value
- of CONTEXTIDR_EL1.
+ information gathered from three sampling registers: EDPCSR, EDVIDSR and
+ EDCIDSR: from EDPCSR we can get program counter; EDVIDSR has information for
+ secure state, exception level, bit width, etc; EDCIDSR is context ID value
+ which contains the sampled value of CONTEXTIDR_EL1.
-- The driver also dumps the CPUs that do not respond to a backtrace request.
+- The driver dumps the CPUs that do not respond to a backtrace request.
A CPU that is locked up with interrupts masked does not respond unless the
request is delivered as an NMI. A CPU that the scheduler does not report as
idle is sampled without the EDPRCR power request, and only if EDPRSR shows
it accessible (powered, out of reset, OS Double Lock clear). An idle CPU is
- sampled the way the panic notifier does it, with the power request, unless
- the "skip_idle" parameter is set. Idle is what idle_cpu() reports: the CPU
- runs its idle task and has no task waiting to run.
+ sampled with the power request, unless the "skip_idle" parameter is set.
+ Idle is what idle_cpu() reports: the CPU runs its idle task and has no task
+ waiting to run.
+
+- A panic by itself does not produce the dump. With "panic_sys_info=all_bt"
+ the kernel requests a backtrace from all CPUs before it stops them, and the
+ CPUs that do not respond are dumped.
- The driver supports a CPU running in either AArch64 or AArch32 mode. The
registers naming convention is a bit different between them, AArch64 uses
@@ -164,7 +166,7 @@ on a system that keeps running, for example on SysRq-l or on an RCU stall
warning. If the idle states are to stay enabled there, set
"coresight_cpu_debug.skip_idle=1" in the kernel command line or write '1' into
/sys/module/coresight_cpu_debug/parameters/skip_idle: the driver then does not
-sample the idle CPUs. The dump on panic still reads every CPU.
+sample the idle CPUs.
If you want to limit idle states at boot time, you can use "nohlt" or
"cpuidle.off=1" in the kernel command line.
@@ -194,16 +196,13 @@ Documentation/admin-guide/pm/cpuidle.rst)::
Output format
-------------
-Here is an example of the debugging output format::
+Here is an example of the debugging output format, for CPU1 locked up with
+interrupts masked::
+ After 10 seconds, these CPUS still haven't responded to the NMI: 1
ARM external debug module:
- coresight-cpu-debug 850000.debug: CPU[0]:
- coresight-cpu-debug 850000.debug: EDPRSR: 00000001 (Power:On Reset:No DLK:Unlock)
- coresight-cpu-debug 850000.debug: EDPCSR: handle_IPI+0x174/0x1d8
- coresight-cpu-debug 850000.debug: EDCIDSR: 00000000
- coresight-cpu-debug 850000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0)
- coresight-cpu-debug 852000.debug: CPU[1]:
- coresight-cpu-debug 852000.debug: EDPRSR: 00000001 (Power:On Reset:No DLK:Unlock)
- coresight-cpu-debug 852000.debug: EDPCSR: debug_notifier_call+0x23c/0x358
- coresight-cpu-debug 852000.debug: EDCIDSR: 00000000
- coresight-cpu-debug 852000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0)
+ coresight-cpu-debug fe432000.debug: CPU[1]:
+ coresight-cpu-debug fe432000.debug: EDPRSR: 0000000b (Power:On Reset:No DLK:Unlock)
+ coresight-cpu-debug fe432000.debug: EDPCSR: lkdtm_HARDLOCKUP+0x14/0x38 [lkdtm]
+ coresight-cpu-debug fe432000.debug: EDCIDSR: 00000000
+ coresight-cpu-debug fe432000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0)
diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig
index 6a4239ebb582..3bacb33af615 100644
--- a/drivers/hwtracing/coresight/Kconfig
+++ b/drivers/hwtracing/coresight/Kconfig
@@ -148,11 +148,13 @@ config CORESIGHT_CTCU
config CORESIGHT_CPU_DEBUG
tristate "CoreSight CPU Debug driver"
depends on ARM || ARM64
+ depends on SMP
depends on DEBUG_FS
help
This driver provides support for coresight debugging module. This
- is primarily used to dump sample-based profiling registers when
- system triggers panic, the driver will parse context registers so
+ is primarily used to dump sample-based profiling registers when a
+ CPU does not respond to a backtrace request, as when it is locked
+ up with interrupts masked; the driver will parse context registers so
can quickly get to know program counter (PC), secure state,
exception level, etc. Before use debugging functionality, platform
needs to ensure the clock domain and power domain are enabled
@@ -166,7 +168,7 @@ config CORESIGHT_CPU_DEBUG_DEFAULT_ON
bool "Enable CoreSight CPU Debug by default"
depends on CORESIGHT_CPU_DEBUG
help
- Say Y here to enable the CoreSight Debug panic-debug by default. This
+ Say Y here to enable the CoreSight CPU Debug dump by default. This
can also be enabled via debugfs, but this ensures the debug feature
is enabled as early as possible.
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index ffbdad1204a4..5c5a1f6a6e33 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -20,7 +20,6 @@
#include <linux/moduleparam.h>
#include <linux/nmi.h>
#include <linux/notifier.h>
-#include <linux/panic_notifier.h>
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
#include <linux/rcupdate.h>
@@ -420,44 +419,6 @@ static void debug_init_arch_data(void *info)
}
}
-/*
- * Dump out information on panic.
- */
-static int debug_notifier_call(struct notifier_block *self,
- unsigned long v, void *p)
-{
- int cpu;
- struct debug_drvdata *drvdata;
-
- /* Bail out if we can't acquire the mutex or the functionality is off */
- if (!mutex_trylock(&debug_lock))
- return NOTIFY_DONE;
-
- if (!debug_enable)
- goto skip_dump;
-
- pr_emerg("ARM external debug module:\n");
-
- for_each_possible_cpu(cpu) {
- drvdata = debug_drvdata_locked(cpu);
- if (!drvdata)
- continue;
-
- dev_emerg(drvdata->dev, "CPU[%d]:\n", drvdata->cpu);
-
- debug_read_regs(drvdata);
- debug_dump_regs(drvdata);
- }
-
-skip_dump:
- mutex_unlock(&debug_lock);
- return NOTIFY_DONE;
-}
-
-static struct notifier_block debug_notifier = {
- .notifier_call = debug_notifier_call,
-};
-
/*
* Dump the CPUs that did not respond to a backtrace request. This can run
* in NMI context.
@@ -633,27 +594,15 @@ static int debug_func_init(void)
debugfs_create_file("enable", 0644, debug_debugfs_dir, NULL,
&debug_func_knob_fops);
- /* Register function to be called for panic */
- ret = atomic_notifier_chain_register(&panic_notifier_list,
- &debug_notifier);
- if (ret) {
- pr_err("%s: unable to register notifier: %d\n",
- __func__, ret);
- goto err;
- }
-
ret = nmi_backtrace_stall_notifier_register(&debug_stall_notifier);
if (ret) {
pr_err("%s: unable to register stall notifier: %d\n",
__func__, ret);
- goto err_stall;
+ goto err;
}
return 0;
-err_stall:
- atomic_notifier_chain_unregister(&panic_notifier_list,
- &debug_notifier);
err:
debugfs_remove_recursive(debug_debugfs_dir);
return ret;
@@ -662,8 +611,6 @@ static int debug_func_init(void)
static void debug_func_exit(void)
{
nmi_backtrace_stall_notifier_unregister(&debug_stall_notifier);
- atomic_notifier_chain_unregister(&panic_notifier_list,
- &debug_notifier);
debugfs_remove_recursive(debug_debugfs_dir);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH RFC 10/10] coresight: cpu-debug: Print the dump at the warning level
2026-11-27 6:38 [PATCH RFC 00/10] coresight: cpu-debug: Sample CPUs that ignore a backtrace request Igor Velkov via B4 Relay
` (8 preceding siblings ...)
2026-11-27 6:38 ` [PATCH RFC 09/10] coresight: cpu-debug: Remove the panic notifier Igor Velkov via B4 Relay
@ 2026-11-27 6:38 ` Igor Velkov via B4 Relay
9 siblings, 0 replies; 18+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-27 6:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan, Andrew Morton,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-doc, linux-kernel,
Jonathan Corbet, Shuah Khan, Randy Dunlap, Douglas Anderson,
Petr Mladek, Feng Tang, Igor Velkov
From: Igor Velkov <iav@iav.lv>
The dump comes from backtrace requests, which also happen on a system
that keeps running, for example on SysRq-l or on an RCU stall warning.
Print it at the warning level, like the "these CPUS still haven't
responded" line it follows.
Signed-off-by: Igor Velkov <iav@iav.lv>
---
drivers/hwtracing/coresight/coresight-cpu-debug.c | 44 +++++++++++------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index 5c5a1f6a6e33..860c31b4e025 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -321,8 +321,8 @@ static unsigned long debug_adjust_pc(struct debug_drvdata *drvdata)
* case and print info for notice.
*/
if (pc & BIT(1))
- dev_emerg(drvdata->dev,
- "Instruction offset is implementation defined\n");
+ dev_warn(drvdata->dev,
+ "Instruction offset is implementation defined\n");
else
pc = (pc & EDPCSR_ARM_INST_MASK) - arm_inst_offset;
@@ -335,38 +335,38 @@ static void debug_dump_regs(struct debug_drvdata *drvdata)
struct device *dev = drvdata->dev;
unsigned long pc;
- dev_emerg(dev, " EDPRSR: %08x (Power:%s Reset:%s DLK:%s)\n",
- drvdata->edprsr,
- drvdata->edprsr & EDPRSR_PU ? "On" : "Off",
- drvdata->edprsr & EDPRSR_R ? "Yes" : "No",
- drvdata->edprsr & EDPRSR_DLK ? "Lock" : "Unlock");
+ dev_warn(dev, " EDPRSR: %08x (Power:%s Reset:%s DLK:%s)\n",
+ drvdata->edprsr,
+ drvdata->edprsr & EDPRSR_PU ? "On" : "Off",
+ drvdata->edprsr & EDPRSR_R ? "Yes" : "No",
+ drvdata->edprsr & EDPRSR_DLK ? "Lock" : "Unlock");
if (!debug_access_permitted(drvdata)) {
- dev_emerg(dev, "No permission to access debug registers!\n");
+ dev_warn(dev, "No permission to access debug registers!\n");
return;
}
if (drvdata->edpcsr == EDPCSR_PROHIBITED) {
- dev_emerg(dev, "CPU is in Debug state or profiling is prohibited!\n");
+ dev_warn(dev, "CPU is in Debug state or profiling is prohibited!\n");
return;
}
pc = debug_adjust_pc(drvdata);
- dev_emerg(dev, " EDPCSR: %pS\n", (void *)pc);
+ dev_warn(dev, " EDPCSR: %pS\n", (void *)pc);
if (drvdata->edcidsr_present)
- dev_emerg(dev, " EDCIDSR: %08x\n", drvdata->edcidsr);
+ dev_warn(dev, " EDCIDSR: %08x\n", drvdata->edcidsr);
if (drvdata->edvidsr_present)
- dev_emerg(dev, " EDVIDSR: %08x (State:%s Mode:%s Width:%dbits VMID:%x)\n",
- drvdata->edvidsr,
- drvdata->edvidsr & EDVIDSR_NS ?
- "Non-secure" : "Secure",
- drvdata->edvidsr & EDVIDSR_E3 ? "EL3" :
+ dev_warn(dev, " EDVIDSR: %08x (State:%s Mode:%s Width:%dbits VMID:%x)\n",
+ drvdata->edvidsr,
+ drvdata->edvidsr & EDVIDSR_NS ?
+ "Non-secure" : "Secure",
+ drvdata->edvidsr & EDVIDSR_E3 ? "EL3" :
(drvdata->edvidsr & EDVIDSR_E2 ?
"EL2" : "EL1/0"),
- drvdata->edvidsr & EDVIDSR_HV ? 64 : 32,
- drvdata->edvidsr & (u32)EDVIDSR_VMID);
+ drvdata->edvidsr & EDVIDSR_HV ? 64 : 32,
+ drvdata->edvidsr & (u32)EDVIDSR_VMID);
}
static void debug_init_arch_data(void *info)
@@ -441,18 +441,18 @@ static int debug_stall_notifier_call(struct notifier_block *self,
continue;
if (!banner) {
- pr_emerg("ARM external debug module:\n");
+ pr_warn("ARM external debug module:\n");
banner = true;
}
idle = cpumask_test_cpu(cpu, stall->idle);
if (idle && READ_ONCE(debug_skip_idle)) {
- dev_emerg(drvdata->dev, "CPU[%d]: idle, not sampled\n",
- drvdata->cpu);
+ dev_warn(drvdata->dev, "CPU[%d]: idle, not sampled\n",
+ drvdata->cpu);
continue;
}
- dev_emerg(drvdata->dev, "CPU[%d]:\n", drvdata->cpu);
+ dev_warn(drvdata->dev, "CPU[%d]:\n", drvdata->cpu);
if (idle)
debug_read_regs(drvdata);
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread