Author: hselasky
Date: Wed Dec 18 09:30:32 2019
New Revision: 355879
URL: https://svnweb.freebsd.org/changeset/base/355879

Log:
  Restore important comment in RCU/EPOCH support in FreeBSD after r355784.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_rcu.c
  head/sys/kern/subr_epoch.c

Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_rcu.c     Wed Dec 18 08:39:24 
2019        (r355878)
+++ head/sys/compat/linuxkpi/common/src/linux_rcu.c     Wed Dec 18 09:30:32 
2019        (r355879)
@@ -259,6 +259,15 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, c
                        sched_prio(td, prio);
                        /* task switch */
                        mi_switch(SW_VOL | SWT_RELINQUISH);
+                       /*
+                        * It is important the thread lock is dropped
+                        * while yielding to allow other threads to
+                        * acquire the lock pointed to by
+                        * TDQ_LOCKPTR(td). Currently mi_switch() will
+                        * unlock the thread lock before
+                        * returning. Else a deadlock like situation
+                        * might happen.
+                        */
                        thread_lock(td);
                }
        } else {

Modified: head/sys/kern/subr_epoch.c
==============================================================================
--- head/sys/kern/subr_epoch.c  Wed Dec 18 08:39:24 2019        (r355878)
+++ head/sys/kern/subr_epoch.c  Wed Dec 18 09:30:32 2019        (r355879)
@@ -578,6 +578,13 @@ epoch_block_handler_preempt(struct ck_epoch *global __
         */
        counter_u64_add(switch_count, 1);
        mi_switch(SW_VOL | SWT_RELINQUISH);
+       /*
+        * It is important the thread lock is dropped while yielding
+        * to allow other threads to acquire the lock pointed to by
+        * TDQ_LOCKPTR(td). Currently mi_switch() will unlock the
+        * thread lock before returning. Else a deadlock like
+        * situation might happen.
+        */
        thread_lock(td);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to