anchao commented on code in PR #18135:
URL: https://github.com/apache/nuttx/pull/18135#discussion_r2726352684


##########
include/nuttx/spinlock.h:
##########
@@ -605,7 +611,14 @@ irqstate_t rspin_lock_irqsave(FAR rspinlock_t *lock)
   return flags;
 }
 #else
-#  define rspin_lock_irqsave(l) ((void)(l), up_irq_save())
+static inline_function
+irqstate_t rspin_lock_irqsave(FAR rspinlock_t *lock)

Review Comment:
   spin lock optimization part could be a separate PR.



##########
sched/sched/sched.h:
##########
@@ -119,6 +119,30 @@
 #  define CRITMONITOR_PANIC(fmt, ...) _alert(fmt, ##__VA_ARGS__)
 #endif
 
+#if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0 || \
+    defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION)
+void restore_critical_section(uint16_t count);
+#else
+#  ifdef CONFIG_SMP
+#    define restore_critical_section(count) rspin_restorelock(&g_schedlock, 
count)
+#  else
+#    define restore_critical_section(count)
+#  endif
+#endif
+
+#define nxsched_switch(tcb, rtcb) \
+  do \
+    { \
+      uint16_t count = rspin_lock_count(&g_schedlock); \
+      up_switch_context(tcb, rtcb); \

Review Comment:
   Performance will degrade on AMP



-- 
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