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 c4ecb06cea7 drivers/syslog: start the rpmsg syslog server on one CPU 
in BMP mode
c4ecb06cea7 is described below

commit c4ecb06cea7374e27a4cf26e20e95e60a573ddd0
Author: chenzihan1 <[email protected]>
AuthorDate: Wed Nov 25 23:59:10 2026 +0800

    drivers/syslog: start the rpmsg syslog server on one CPU in BMP mode
    
    In BMP mode all CPUs run the same image, so syslog_rpmsg_server_init()
    registered the RPMSG syslog server on every CPU, while the server
    should run only on the core that collects the logs. Add
    SYSLOG_RPMSG_SERVER_CPUID; with it set, only that CPU starts the
    server. Without BMP nothing changes.
    
    Signed-off-by: chenzihan1 <[email protected]>
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/syslog/Kconfig               |  9 +++++++++
 drivers/syslog/syslog_rpmsg_server.c | 10 ++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/syslog/Kconfig b/drivers/syslog/Kconfig
index 8289257149a..2cbaf69d889 100644
--- a/drivers/syslog/Kconfig
+++ b/drivers/syslog/Kconfig
@@ -474,6 +474,15 @@ config SYSLOG_RPMSG_SERVER
        ---help---
                Use RPMSG to receive message from remote proc.
 
+config SYSLOG_RPMSG_SERVER_CPUID
+       int "The cpuid on which the SYSLOG RPMSG server runs"
+       depends on SYSLOG_RPMSG_SERVER && BMP
+       ---help---
+               In BMP mode all CPUs share the same firmware image, so
+               syslog_rpmsg_server_init() would otherwise register the RPMSG
+               server channel on every CPU. Set this to the cpuid of the log
+               aggregation core to only initialize the server there.
+
 config SYSLOG_RPMSG_SERVER_CHARDEV
        bool "SYSLOG RPMSG server character device"
        default n
diff --git a/drivers/syslog/syslog_rpmsg_server.c 
b/drivers/syslog/syslog_rpmsg_server.c
index 4eeffbdf665..eded9a804ae 100644
--- a/drivers/syslog/syslog_rpmsg_server.c
+++ b/drivers/syslog/syslog_rpmsg_server.c
@@ -27,6 +27,7 @@
 #include <nuttx/config.h>
 
 #include <assert.h>
+#include <sched.h>
 
 #include <nuttx/fs/ioctl.h>
 #include <nuttx/kmalloc.h>
@@ -291,7 +292,16 @@ int syslog_rpmsg_server_init(void)
 {
 #ifdef CONFIG_SYSLOG_RPMSG_SERVER_CHARDEV
   int ret;
+#endif
+
+#ifdef CONFIG_SYSLOG_RPMSG_SERVER_CPUID
+  if (sched_getcpu() != CONFIG_SYSLOG_RPMSG_SERVER_CPUID)
+    {
+      return OK;
+    }
+#endif
 
+#ifdef CONFIG_SYSLOG_RPMSG_SERVER_CHARDEV
   ret = register_driver("/dev/logrpmsg", &g_syslog_rpmsg_fops, 0600, NULL);
   if (ret < 0)
     {

Reply via email to