This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 96aae7019dc assert/coredump: support designating a single CPU for
coredump in BMP mode
96aae7019dc is described below
commit 96aae7019dca56dfeb0f952c97fe745418152d36
Author: Bowen Wang <[email protected]>
AuthorDate: Wed Feb 11 19:10:00 2026 +0800
assert/coredump: support designating a single CPU for coredump in BMP mode
In BMP (Bound Multi-Processing) mode, when a panic occurs, multiple CPUs
may attempt to perform a coredump simultaneously, leading to output
corruption or resource conflicts on the syslog/storage device.
Add BOARD_COREDUMP_CPUID Kconfig option (depends on BMP, default -1) to
allow specifying which CPU is responsible for executing the coredump.
When set to a valid CPU ID, only that CPU will run coredump_dump() in
dump_core_info(); other CPUs will skip it. The default value -1 preserves
the original behavior where any CPU can perform the coredump.
Signed-off-by: Bowen Wang <[email protected]>
---
boards/Kconfig | 19 +++++++++++++++++++
sched/misc/assert.c | 17 +++++++++++------
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/boards/Kconfig b/boards/Kconfig
index 494af75374e..30d4aefc4be 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -6034,6 +6034,25 @@ config BOARD_CRASHDUMP_CUSTOM
Enable save crash dump info with custom method. only work with
board_crashdump api.
+config BOARD_COREDUMP_CPUID
+ int "The Coredump CPU ID"
+ default -1
+ depends on BMP && (!BOARD_CRASHDUMP_NONE || BOARD_CRASHDUMP_CUSTOM)
+ ---help---
+ Specify which CPU is responsible for executing coredump in BMP
+ (Bound Multi-Processing) mode. In BMP mode, multiple CPUs may
+ trigger a panic simultaneously. Without this setting, each CPU
+ could attempt to perform a coredump at the same time, leading to
+ output corruption or resource conflicts (e.g., contention on the
+ syslog or storage device).
+
+ By setting this to a valid CPU ID (e.g., 0), only the designated
+ CPU will execute the coredump logic; other CPUs will skip it.
+
+ Set to -1 (default) to allow any CPU to perform the coredump,
+ which preserves the original behavior for single-core or SMP
+ configurations.
+
config BOARD_COREDUMP_DEVPATH
string "Save Core Dump data with device PATH"
depends on BOARD_COREDUMP_BLKDEV || BOARD_COREDUMP_MTDDEV
diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index f8ee74d18ff..18640e41bcb 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -839,24 +839,29 @@ static void dump_fatal_info(FAR struct tcb_s *rtcb,
static void dump_core_info(FAR struct tcb_s *rtcb, FAR const char *filename,
int linenum, FAR const char *msg, FAR void *regs)
{
+#if defined(CONFIG_BOARD_COREDUMP_CPUID) && CONFIG_BOARD_COREDUMP_CPUID >= 0
+ if (up_cpu_index() == CONFIG_BOARD_COREDUMP_CPUID)
+#endif
+ {
#ifdef CONFIG_BOARD_CRASHDUMP_CUSTOM
- board_crashdump(up_getsp(), rtcb, filename, linenum, msg, regs);
+ board_crashdump(up_getsp(), rtcb, filename, linenum, msg, regs);
#endif
#ifndef CONFIG_BOARD_CRASHDUMP_NONE
- /* Dump core information */
+ /* Dump core information */
# ifdef CONFIG_BOARD_COREDUMP_FULL
- coredump_dump(INVALID_PROCESS_ID);
+ coredump_dump(INVALID_PROCESS_ID);
# else
- coredump_dump(rtcb->pid);
+ coredump_dump(rtcb->pid);
# endif
#endif
- /* Flush any buffered SYSLOG data */
+ /* Flush any buffered SYSLOG data */
- syslog_flush();
+ syslog_flush();
+ }
}
/****************************************************************************