You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/08/25 12:36:15 UTC

[GitHub] [incubator-nuttx] eenurkka opened a new pull request, #6922: risc-v/mpfs: ihc: fix performance issue

eenurkka opened a new pull request, #6922:
URL: https://github.com/apache/incubator-nuttx/pull/6922

   nxsig_usleep() will wait for the next timer tick which is way
   too much here. It's not sleeping 100 us, but rather, near 1/60 s.
   
   This causes severe performance problems. Fix this by polling the
   register for a while if the remote end is busy.
   
   Signed-off-by: Eero Nurkkala <ee...@offcode.fi>
   
   ## Summary
   
   Performing pings in a loop from Linux <-> NuttX appears slow, only 28800 bytes / sec. After the fix,
   minimum 1 280 000 * 2 bytes / sec.
   
   ## Impact
   
   MPFS Polarfire
   
   ## Testing
   
   MPFS Polarfire kit with NuttX on hart 1 and Linux on harts 3 and 4.
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #6922: risc-v/mpfs: ihc: fix performance issue

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #6922:
URL: https://github.com/apache/incubator-nuttx/pull/6922


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] eenurkka commented on a diff in pull request #6922: risc-v/mpfs: ihc: fix performance issue

Posted by GitBox <gi...@apache.org>.
eenurkka commented on code in PR #6922:
URL: https://github.com/apache/incubator-nuttx/pull/6922#discussion_r954941839


##########
arch/risc-v/src/mpfs/mpfs_ihc.c:
##########
@@ -786,20 +786,19 @@ static int mpfs_ihc_tx_message(ihc_channel_t channel, uint32_t *message)
   uint32_t rhartid      = mpfs_ihc_context_to_remote_hart_id(channel);
   uint32_t message_size = getreg32(MPFS_IHC_MSG_SIZE(mhartid, rhartid));
   uint32_t ctrl_reg     = getreg32(MPFS_IHC_CTRL(mhartid, rhartid));
+  uint32_t retries      = 10000;
 
   DEBUGASSERT(message_size <= IHC_MAX_MESSAGE_SIZE);
 
   /* Check if the system is busy.  All we can try is wait. */
 
   if ((RMP_MESSAGE_PRESENT | ACK_INT) & ctrl_reg)
     {
-#ifndef CONFIG_MPFS_OPENSBI
-      nxsig_usleep(100);
-#endif
-
-      /* Give it a one more try */
-
-      ctrl_reg = getreg32(MPFS_IHC_CTRL(mhartid, rhartid));
+      do
+        {
+          ctrl_reg = getreg32(MPFS_IHC_CTRL(mhartid, rhartid));
+        }
+      while ((ctrl_reg & (RMP_MESSAGE_PRESENT | ACK_INT)) && --retries);
     }

Review Comment:
   Right



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6922: risc-v/mpfs: ihc: fix performance issue

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6922:
URL: https://github.com/apache/incubator-nuttx/pull/6922#discussion_r954913940


##########
arch/risc-v/src/mpfs/mpfs_ihc.c:
##########
@@ -786,20 +786,19 @@ static int mpfs_ihc_tx_message(ihc_channel_t channel, uint32_t *message)
   uint32_t rhartid      = mpfs_ihc_context_to_remote_hart_id(channel);
   uint32_t message_size = getreg32(MPFS_IHC_MSG_SIZE(mhartid, rhartid));
   uint32_t ctrl_reg     = getreg32(MPFS_IHC_CTRL(mhartid, rhartid));
+  uint32_t retries      = 10000;
 
   DEBUGASSERT(message_size <= IHC_MAX_MESSAGE_SIZE);
 
   /* Check if the system is busy.  All we can try is wait. */
 
   if ((RMP_MESSAGE_PRESENT | ACK_INT) & ctrl_reg)
     {
-#ifndef CONFIG_MPFS_OPENSBI
-      nxsig_usleep(100);
-#endif
-
-      /* Give it a one more try */
-
-      ctrl_reg = getreg32(MPFS_IHC_CTRL(mhartid, rhartid));
+      do
+        {
+          ctrl_reg = getreg32(MPFS_IHC_CTRL(mhartid, rhartid));
+        }
+      while ((ctrl_reg & (RMP_MESSAGE_PRESENT | ACK_INT)) && --retries);
     }

Review Comment:
   maybe `if` can be removed together with init at line 788?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org