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

commit 0c4480146bd233358f4a72a56d2c89901b9be629
Author: Bowen Wang <[email protected]>
AuthorDate: Thu Feb 5 20:34:30 2026 +0800

    drivers/rpmsg: make the recursive dispatch limit configurable
    
    rpmsg_tickwait() dispatches pending works of its own work queue while
    it waits, up to 8 levels deep. Each level costs stack in the rpmsg
    worker thread. Add CONFIG_RPMSG_RECURSIVE_LIMIT, default 8 as before,
    so that a configuration with a small worker stack can lower it.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/rpmsg/Kconfig | 7 +++++++
 drivers/rpmsg/rpmsg.c | 4 +---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig
index 601902be67a..501d0c21308 100644
--- a/drivers/rpmsg/Kconfig
+++ b/drivers/rpmsg/Kconfig
@@ -67,6 +67,13 @@ config RPMSG_WQUEUE_NUMBER
                This macro sets the number of rpmsg work queue. It can be
                customized and the minimum value is 1.
 
+config RPMSG_RECURSIVE_LIMIT
+       int "rpmsg recursive limit"
+       default 8
+       ---help---
+               This macro sets the maximum recursion depth allowed in the
+               rpmsg dispatch function.
+
 config RPMSG_TRACE
        bool "rpmsg trace"
        default n
diff --git a/drivers/rpmsg/rpmsg.c b/drivers/rpmsg/rpmsg.c
index c6c51c7cab4..c4a725a9ba6 100644
--- a/drivers/rpmsg/rpmsg.c
+++ b/drivers/rpmsg/rpmsg.c
@@ -57,8 +57,6 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define RPMSG_RECURSIVE_LIMIT    8
-
 #ifdef CONFIG_RPMSG_WQUEUE_GLOBAL
 #  define rpmsg_get_wqueues(rpmsg) g_rpmsg_wqueues
 #else
@@ -412,7 +410,7 @@ int rpmsg_tickwait(FAR struct rpmsg_endpoint *ept, FAR 
sem_t *sem,
                */
 
               rpmsg->ops->wait(rpmsg, delay);
-              if (wqueue->recursive < RPMSG_RECURSIVE_LIMIT)
+              if (wqueue->recursive < CONFIG_RPMSG_RECURSIVE_LIMIT)
                 {
                   wqueue->recursive++;
                   work_queue_dispatch(wqueue->kwqueue);

Reply via email to