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 249503f31bb drivers/rptun: optionally silence syslog on a 
remote-triggered panic
249503f31bb is described below

commit 249503f31bb4b21fccc1c335c98f3082bf7a8697
Author: Bowen Wang <[email protected]>
AuthorDate: Wed Nov 25 15:29:17 2026 +0800

    drivers/rptun: optionally silence syslog on a remote-triggered panic
    
    When a peer panics it asks the other cores to panic as well, and each
    of them prints its own assertion report and task dump into the same
    console or log buffer while the crashing core is still printing.
    
    Add RPTUN_REMOTE_PANIC_SILENT, default n: before panicking on the peer's
    request, set the system wide log mask to LOG_NONE with nx_setlogmask().
    A coredump to syslog still prints, because it raises the mask itself.
    LOG_NONE is added to <syslog.h> for this.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/rptun/Kconfig | 9 +++++++++
 drivers/rptun/rptun.c | 7 +++++++
 include/syslog.h      | 1 +
 3 files changed, 17 insertions(+)

diff --git a/drivers/rptun/Kconfig b/drivers/rptun/Kconfig
index fb40020152b..8403607d0df 100644
--- a/drivers/rptun/Kconfig
+++ b/drivers/rptun/Kconfig
@@ -57,6 +57,15 @@ config RPTUN_AUTO_RESET_IN_REBOOT_NOTIFIER
 
 endchoice # RPTUN_AUTO_RESET
 
+config RPTUN_REMOTE_PANIC_SILENT
+       bool "Silence syslog on remote-triggered panic"
+       default n
+       ---help---
+               When a remote core asks this core to panic, set the system
+               wide log mask to LOG_NONE first, so that only the core that
+               crashed prints its crash log. The mask is not restored; a
+               coredump to syslog still prints, as it raises the mask itself.
+
 config RPTUN_BMP
        bool "rptun bmp support"
        default n
diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c
index 320c522b6e3..206728f2dd1 100644
--- a/drivers/rptun/rptun.c
+++ b/drivers/rptun/rptun.c
@@ -49,6 +49,7 @@
 #include <nuttx/virtio/virtio.h>
 #include <nuttx/panic_notifier.h>
 #include <nuttx/reboot_notifier.h>
+#include <nuttx/syslog/syslog.h>
 #include <nuttx/syslog/syslog_rpmsg.h>
 #include <openamp/remoteproc_loader.h>
 #include <openamp/remoteproc_virtio.h>
@@ -1011,6 +1012,12 @@ static void rptun_check_peer_status(FAR struct 
rptun_priv_s *priv)
     {
       char msg[64];
 
+#ifdef CONFIG_RPTUN_REMOTE_PANIC_SILENT
+      /* Keep this passive panic out of the crashing core's log */
+
+      nx_setlogmask(LOG_NONE);
+#endif
+
       snprintf(msg, sizeof(msg), "Panic by remote core: %s",
                RPTUN_GET_CPUNAME(priv->dev));
       PANIC_WITH_MSG(msg);
diff --git a/include/syslog.h b/include/syslog.h
index 83a56b60fab..694d5354674 100644
--- a/include/syslog.h
+++ b/include/syslog.h
@@ -123,6 +123,7 @@
 #define LOG_MASK(p)   (1 << (p))
 #define LOG_UPTO(p)   ((1 << ((p)+1)) - 1)
 #define LOG_ALL       0xff
+#define LOG_NONE      0
 
 #define LOG_PRIMASK            0x07               /* mask to extract priority 
part (internal) */
 #define LOG_PRI(p)            ((p) & LOG_PRIMASK) /* extract priority */

Reply via email to