You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/07/26 01:36:12 UTC

[incubator-nuttx] branch master updated (9e7e45df76 -> 434c49f282)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


    from 9e7e45df76 Evaluate n in preprocessor before masking
     new 631eb516c9 rptun_dump: don't get lock in IRQ handler
     new 4a9bd26317 rptun: merge rptun_ioctl & rptun_ops to one
     new 434c49f282 rptun_dump: use METAL_LOG_EMERGENCY log level

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 drivers/rptun/rptun.c      | 54 +++++++++++++++++-----------------------------
 drivers/rptun/rptun_dump.c | 22 ++++++++++++-------
 2 files changed, 34 insertions(+), 42 deletions(-)


[incubator-nuttx] 01/03: rptun_dump: don't get lock in IRQ handler

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 631eb516c90504e1f96287feb9ac302e811e7682
Author: ligd <li...@xiaomi.com>
AuthorDate: Sun Apr 24 15:25:13 2022 +0800

    rptun_dump: don't get lock in IRQ handler
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 drivers/rptun/rptun_dump.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/rptun/rptun_dump.c b/drivers/rptun/rptun_dump.c
index cb041cf70e..84eb64d2ac 100644
--- a/drivers/rptun/rptun_dump.c
+++ b/drivers/rptun/rptun_dump.c
@@ -100,7 +100,10 @@ void rptun_dump(FAR struct rpmsg_virtio_device *rvdev)
       return;
     }
 
-  metal_mutex_acquire(&rdev->lock);
+  if (!up_interrupt_context() && !sched_idletask())
+    {
+      metal_mutex_acquire(&rdev->lock);
+    }
 
   metal_log(METAL_LOG_INFO,
             "Dump rpmsg info between cpu %s <==> %s:\n",
@@ -119,5 +122,8 @@ void rptun_dump(FAR struct rpmsg_virtio_device *rvdev)
   rptun_dump_buffer(rvdev, true);
   rptun_dump_buffer(rvdev, false);
 
-  metal_mutex_release(&rdev->lock);
+  if (!up_interrupt_context() && !sched_idletask())
+    {
+      metal_mutex_release(&rdev->lock);
+    }
 }


[incubator-nuttx] 03/03: rptun_dump: use METAL_LOG_EMERGENCY log level

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 434c49f282e8be8c18b6fb4bd0cbea21074b3a77
Author: ligd <li...@xiaomi.com>
AuthorDate: Mon Apr 25 18:39:15 2022 +0800

    rptun_dump: use METAL_LOG_EMERGENCY log level
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 drivers/rptun/rptun_dump.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/rptun/rptun_dump.c b/drivers/rptun/rptun_dump.c
index 84eb64d2ac..7e7f0a9440 100644
--- a/drivers/rptun/rptun_dump.c
+++ b/drivers/rptun/rptun_dump.c
@@ -43,7 +43,7 @@ static void rptun_dump_addr(FAR struct rpmsg_device *rdev,
   ept = rpmsg_get_ept_from_addr(rdev, rx ? hdr->dst : hdr->src);
   if (ept)
     {
-      metal_log(METAL_LOG_INFO,
+      metal_log(METAL_LOG_EMERGENCY,
                 "      %s buffer %p hold by %s\n",
                 rx ? "RX" : "TX", hdr, ept->name);
     }
@@ -59,7 +59,7 @@ static void rptun_dump_buffer(FAR struct rpmsg_virtio_device *rvdev,
   int i;
 
   num = rptun_buffer_nused(rvdev, rx);
-  metal_log(METAL_LOG_INFO,
+  metal_log(METAL_LOG_EMERGENCY,
             "    %s buffer, total %d, pending %d\n",
             rx ? "RX" : "TX", vq->vq_nentries, num);
 
@@ -105,19 +105,19 @@ void rptun_dump(FAR struct rpmsg_virtio_device *rvdev)
       metal_mutex_acquire(&rdev->lock);
     }
 
-  metal_log(METAL_LOG_INFO,
+  metal_log(METAL_LOG_EMERGENCY,
             "Dump rpmsg info between cpu %s <==> %s:\n",
             CONFIG_RPTUN_LOCAL_CPUNAME, rpmsg_get_cpuname(rdev));
 
-  metal_log(METAL_LOG_INFO, "  rpmsg ept list:\n");
+  metal_log(METAL_LOG_EMERGENCY, "  rpmsg ept list:\n");
 
   metal_list_for_each(&rdev->endpoints, node)
     {
       ept = metal_container_of(node, struct rpmsg_endpoint, node);
-      metal_log(METAL_LOG_INFO, "    ept %s\n", ept->name);
+      metal_log(METAL_LOG_EMERGENCY, "    ept %s\n", ept->name);
     }
 
-  metal_log(METAL_LOG_INFO, "  rpmsg buffer list:\n");
+  metal_log(METAL_LOG_EMERGENCY, "  rpmsg buffer list:\n");
 
   rptun_dump_buffer(rvdev, true);
   rptun_dump_buffer(rvdev, false);


[incubator-nuttx] 02/03: rptun: merge rptun_ioctl & rptun_ops to one

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 4a9bd26317cf93d6b5b108b1974bc45304aa8a89
Author: ligd <li...@xiaomi.com>
AuthorDate: Mon Apr 25 12:40:24 2022 +0800

    rptun: merge rptun_ioctl & rptun_ops to one
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 drivers/rptun/rptun.c | 54 +++++++++++++++++++--------------------------------
 1 file changed, 20 insertions(+), 34 deletions(-)

diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c
index 11d277cf02..34efe39895 100644
--- a/drivers/rptun/rptun.c
+++ b/drivers/rptun/rptun.c
@@ -59,11 +59,6 @@
 
 #define RPTUNIOC_NONE               0
 
-#define RPTUN_OPS_START             0
-#define RPTUN_OPS_DUMP              1
-#define RPTUN_OPS_RESET             2
-#define RPTUN_OPS_PANIC             3
-
 /****************************************************************************
  * Private Types
  ****************************************************************************/
@@ -158,7 +153,6 @@ static metal_phys_addr_t rptun_pa_to_da(FAR struct rptun_dev_s *dev,
                                         metal_phys_addr_t pa);
 static metal_phys_addr_t rptun_da_to_pa(FAR struct rptun_dev_s *dev,
                                         metal_phys_addr_t da);
-static int rptun_ops_foreach(FAR const char *cpuname, int ops, int value);
 
 /****************************************************************************
  * Private Data
@@ -767,11 +761,9 @@ static int rptun_dev_stop(FAR struct remoteproc *rproc)
   return 0;
 }
 
-static int rptun_dev_ioctl(FAR struct file *filep, int cmd,
-                           unsigned long arg)
+static int rptun_do_ioctl(FAR struct rptun_priv_s *priv, int cmd,
+                          unsigned long arg)
 {
-  FAR struct inode *inode = filep->f_inode;
-  FAR struct rptun_priv_s *priv = inode->i_private;
   int ret = OK;
 
   switch (cmd)
@@ -803,6 +795,13 @@ static int rptun_dev_ioctl(FAR struct file *filep, int cmd,
   return ret;
 }
 
+static int rptun_dev_ioctl(FAR struct file *filep, int cmd,
+                           unsigned long arg)
+{
+  FAR struct inode *inode = filep->f_inode;
+  return rptun_do_ioctl(inode->i_private, cmd, arg);
+}
+
 #ifdef CONFIG_RPTUN_LOADER
 static int rptun_store_open(FAR void *store_,
                             FAR const char *path,
@@ -918,9 +917,11 @@ static metal_phys_addr_t rptun_da_to_pa(FAR struct rptun_dev_s *dev,
   return da;
 }
 
-static int rptun_ops_foreach(FAR const char *cpuname, int ops, int value)
+static int rptun_ioctl_foreach(FAR const char *cpuname, int cmd,
+                               unsigned long value)
 {
   FAR struct metal_list *node;
+  int ret = OK;
 
   metal_list_for_each(&g_rptun_priv, node)
     {
@@ -930,28 +931,13 @@ static int rptun_ops_foreach(FAR const char *cpuname, int ops, int value)
 
       if (!cpuname || !strcmp(RPTUN_GET_CPUNAME(priv->dev), cpuname))
         {
-          switch (ops)
-            {
-              case RPTUN_OPS_START:
-                priv->cmd = RPTUNIOC_START;
-                rptun_wakeup(priv);
-                break;
-              case RPTUN_OPS_DUMP:
-                rptun_dump(&priv->rvdev);
-                break;
-              case RPTUN_OPS_RESET:
-                RPTUN_RESET(priv->dev, value);
-                break;
-              case RPTUN_OPS_PANIC:
-                RPTUN_PANIC(priv->dev);
-                break;
-              default:
-                return -ENOTTY;
-            }
+          ret = rptun_do_ioctl(priv, cmd, value);
+          if (ret < 0)
+              break;
         }
     }
 
-  return 0;
+  return ret;
 }
 
 /****************************************************************************
@@ -1196,17 +1182,17 @@ err_mem:
 
 int rptun_boot(FAR const char *cpuname)
 {
-  return rptun_ops_foreach(cpuname, RPTUN_OPS_START, 0);
+  return rptun_ioctl_foreach(cpuname, RPTUNIOC_START, 0);
 }
 
 int rptun_reset(FAR const char *cpuname, int value)
 {
-  return rptun_ops_foreach(cpuname, RPTUN_OPS_RESET, value);
+  return rptun_ioctl_foreach(cpuname, RPTUNIOC_RESET, value);
 }
 
 int rptun_panic(FAR const char *cpuname)
 {
-  return rptun_ops_foreach(cpuname, RPTUN_OPS_PANIC, 0);
+  return rptun_ioctl_foreach(cpuname, RPTUNIOC_PANIC, 0);
 }
 
 int rptun_buffer_nused(FAR struct rpmsg_virtio_device *rvdev, bool rx)
@@ -1226,5 +1212,5 @@ int rptun_buffer_nused(FAR struct rpmsg_virtio_device *rvdev, bool rx)
 
 void rptun_dump_all(void)
 {
-  rptun_ops_foreach(NULL, RPTUN_OPS_DUMP, 0);
+  rptun_ioctl_foreach(NULL, RPTUNIOC_DUMP, 0);
 }