Author: hselasky
Date: Fri Jul  7 13:15:00 2017
New Revision: 320774
URL: https://svnweb.freebsd.org/changeset/base/320774

Log:
  Fix a bug in synchronize RCU when the calling thread is bound to a CPU.
  
  Set "td_pinned" to zero after "sched_unbind()" to prevent "td_pinned"
  from temporarily becoming negative during "sched_bind()". This can
  happen if "sched_bind()" uses "sched_pin()" and "sched_unpin()".
  
  MFC after:    1 week
  Sponsored by: Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_rcu.c     Fri Jul  7 12:03:58 
2017        (r320773)
+++ head/sys/compat/linuxkpi/common/src/linux_rcu.c     Fri Jul  7 13:15:00 
2017        (r320774)
@@ -299,8 +299,9 @@ linux_synchronize_rcu(void)
        old_cpu = PCPU_GET(cpuid);
        old_pinned = td->td_pinned;
        old_prio = td->td_priority;
-       td->td_pinned = 0;
        was_bound = sched_is_bound(td);
+       sched_unbind(td);
+       td->td_pinned = 0;
        sched_bind(td, old_cpu);
 
        ck_epoch_synchronize_wait(&linux_epoch,
_______________________________________________
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