aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/src/linux_rcu.c
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2017-07-07 13:15:00 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2017-07-07 13:15:00 +0000
commitea165254130ea22f0530743bbe8e6083eaff4552 (patch)
tree2ac8e859a027fda31a1ce4e2c1cab3d13164dbfa /sys/compat/linuxkpi/common/src/linux_rcu.c
parenta90f44b281bd45f719d886c3b0de3bd95672d232 (diff)
downloadsrc-ea165254130ea22f0530743bbe8e6083eaff4552.tar.gz
src-ea165254130ea22f0530743bbe8e6083eaff4552.zip
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
Notes
Notes: svn path=/head/; revision=320774
Diffstat (limited to 'sys/compat/linuxkpi/common/src/linux_rcu.c')
-rw-r--r--sys/compat/linuxkpi/common/src/linux_rcu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c
index 32d532b13095..3cf6aba78782 100644
--- a/sys/compat/linuxkpi/common/src/linux_rcu.c
+++ b/sys/compat/linuxkpi/common/src/linux_rcu.c
@@ -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,