CV-Bowen commented on code in PR #22142:
URL: https://github.com/apache/nuttx/pull/22142#discussion_r4675219071


##########
drivers/misc/rpmsgdev.c:
##########
@@ -407,39 +443,29 @@ static ssize_t rpmsgdev_read(FAR struct file *filep, FAR 
char *buffer,
   priv = filep->f_priv;
   DEBUGASSERT(dev != NULL && priv != NULL);
 
-  /* Call the host to perform the read */
-
-  read.iov_base = buffer;
-  read.iov_len  = 0;
+  command = priv->nonblock ? RPMSGDEV_READ_NONBLOCK : RPMSGDEV_READ;

Review Comment:
   Right, this is a behaviour change of this series: on master the client
   waited for data in `rpmsgdev_wait()` with `nxsem_wait()`; now it waits
   for the server's reply with `rpmsg_wait()`, which a signal does not end.
   The wait has to stay `rpmsg_wait()`: when it runs on the rpmsg work queue
   it keeps dispatching incoming messages, which nested calls rely on. The
   Impact section now says that a blocking read can no longer be
   interrupted by a signal. Making it interruptible, together with the
   killed-task case you describe, will be done in a separate PR.



##########
drivers/rpmsg/Kconfig:
##########
@@ -138,11 +138,13 @@ config RPMSG_PANIC_DUMP_LEVEL
 
 config RPMSG_POOL_COUNT
        int "rpmsg pool buffer count"
-       default 0
+       default 16 if ARCH_STACK_PROTECT || ARCH_KSTACK_PROTECT

Review Comment:
   Dropped: `keep request buffers off the stack with stack protection`
   (apache/nuttx#22234) no longer touches `drivers/rpmsg/Kconfig` and lost
   its `!`, and the row is gone from the BREAKING CHANGE table.



##########
drivers/misc/rpmsgdev.c:
##########
@@ -1085,6 +1243,8 @@ static void rpmsgdev_device_destroy(FAR struct 
rpmsg_device *rdev,
 
   if (strcmp(priv->remotecpu, rpmsg_get_cpuname(rdev)) == 0)
     {
+      rpmsgdev_fail_cookies(priv);
+      rpmsg_wait(&priv->ept, &priv->wait);

Review Comment:
   This is intended. Registering an rpmsgdev client means the peer exports
   that device, so the endpoint is expected to bind: requests and the
   teardown wait for the binding instead of failing and leaving the caller
   to retry. A client towards a core without the server is a configuration
   error.



##########
drivers/misc/Kconfig:
##########
@@ -60,6 +60,18 @@ config DEV_RPMSG_SERVER
        default n
        depends on RPMSG
 
+config DEV_RPMSG_OPEN_MAX
+       int "Rpmsg Device max concurrent opens per device"
+       default 2
+       depends on DEV_RPMSG || DEV_RPMSG_SERVER
+       ---help---
+               Maximum number of concurrent open() instances supported per 
rpmsg
+               device.  The per-open data blocks (client: struct 
rpmsgdev_priv_s,
+               server: struct rpmsgdev_device_s) are preallocated as a 
fixed-size
+               array inside each device/endpoint instance to avoid dynamic
+               allocation.  open() is rejected with -EMFILE once all slots are 
in

Review Comment:
   Fixed in `!preallocate the per-open state` (apache/nuttx#22235): the help
   text says -ENOMEM, which is what both `rpmsgdev_open()` and
   `rpmsgdev_open_handler()` return and what the BREAKING CHANGE note
   already said.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to