svn commit: r204409 - in releng: 7.1 7.1/sys/conf 7.1/sys/kern 7.2
7.2/sys/conf 7.2/sys/kern
Colin Percival
cperciva at FreeBSD.org
Sat Feb 27 10:55:44 UTC 2010
Author: cperciva
Date: Sat Feb 27 10:55:43 2010
New Revision: 204409
URL: http://svn.freebsd.org/changeset/base/204409
Log:
MFC r197223: Fix a deadlock in the ULE scheduler.
Approved by: so (cperciva)
Errata: FreeBSD-EN-10:02.sched_ule
Modified:
releng/7.1/UPDATING
releng/7.1/sys/conf/newvers.sh
releng/7.1/sys/kern/sched_ule.c
releng/7.2/UPDATING
releng/7.2/sys/conf/newvers.sh
releng/7.2/sys/kern/sched_ule.c
Modified: releng/7.1/UPDATING
==============================================================================
--- releng/7.1/UPDATING Sat Feb 27 10:41:30 2010 (r204408)
+++ releng/7.1/UPDATING Sat Feb 27 10:55:43 2010 (r204409)
@@ -8,6 +8,9 @@ Items affecting the ports and packages s
/usr/ports/UPDATING. Please read that file before running
portupgrade.
+20100227: p11 FreeBSD-EN-10:02.sched_ule
+ Fix a deadlock in the ULE scheduler.
+
20100106: p10 FreeBSD-SA-10:01.bind, FreeBSD-SA-10:02.ntpd,
FreeBSD-SA-10:03.zfs
Fix BIND named(8) cache poisoning with DNSSEC validation.
Modified: releng/7.1/sys/conf/newvers.sh
==============================================================================
--- releng/7.1/sys/conf/newvers.sh Sat Feb 27 10:41:30 2010 (r204408)
+++ releng/7.1/sys/conf/newvers.sh Sat Feb 27 10:55:43 2010 (r204409)
@@ -32,7 +32,7 @@
TYPE="FreeBSD"
REVISION="7.1"
-BRANCH="RELEASE-p10"
+BRANCH="RELEASE-p11"
if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
fi
Modified: releng/7.1/sys/kern/sched_ule.c
==============================================================================
--- releng/7.1/sys/kern/sched_ule.c Sat Feb 27 10:41:30 2010 (r204408)
+++ releng/7.1/sys/kern/sched_ule.c Sat Feb 27 10:55:43 2010 (r204409)
@@ -1822,18 +1822,24 @@ sched_switch_migrate(struct tdq *tdq, st
*/
spinlock_enter();
thread_block_switch(td); /* This releases the lock on tdq. */
- TDQ_LOCK(tdn);
- tdq_add(tdn, td, flags);
- tdq_notify(td->td_sched);
- /*
- * After we unlock tdn the new cpu still can't switch into this
- * thread until we've unblocked it in cpu_switch(). The lock
- * pointers may match in the case of HTT cores. Don't unlock here
- * or we can deadlock when the other CPU runs the IPI handler.
+
+ /*
+ * Acquire both run-queue locks before placing the thread on the new
+ * run-queue to avoid deadlocks created by placing a thread with a
+ * blocked lock on the run-queue of a remote processor. The deadlock
+ * occurs when a third processor attempts to lock the two queues in
+ * question while the target processor is spinning with its own
+ * run-queue lock held while waiting for the blocked lock to clear.
*/
- if (TDQ_LOCKPTR(tdn) != TDQ_LOCKPTR(tdq)) {
- TDQ_UNLOCK(tdn);
+ if (TDQ_LOCKPTR(tdn) == TDQ_LOCKPTR(tdq)) {
TDQ_LOCK(tdq);
+ tdq_add(tdn, td, flags);
+ tdq_notify(td->td_sched);
+ } else {
+ tdq_lock_pair(tdn, tdq);
+ tdq_add(tdn, td, flags);
+ tdq_notify(td->td_sched);
+ TDQ_UNLOCK(tdn);
}
spinlock_exit();
#endif
Modified: releng/7.2/UPDATING
==============================================================================
--- releng/7.2/UPDATING Sat Feb 27 10:41:30 2010 (r204408)
+++ releng/7.2/UPDATING Sat Feb 27 10:55:43 2010 (r204409)
@@ -8,6 +8,9 @@ Items affecting the ports and packages s
/usr/ports/UPDATING. Please read that file before running
portupgrade.
+20100227: p7 FreeBSD-EN-10:02.sched_ule
+ Fix a deadlock in the ULE scheduler.
+
20100106: p6 FreeBSD-SA-10:01.bind, FreeBSD-SA-10:02.ntpd,
FreeBSD-SA-10:03.zfs
Fix BIND named(8) cache poisoning with DNSSEC validation.
Modified: releng/7.2/sys/conf/newvers.sh
==============================================================================
--- releng/7.2/sys/conf/newvers.sh Sat Feb 27 10:41:30 2010 (r204408)
+++ releng/7.2/sys/conf/newvers.sh Sat Feb 27 10:55:43 2010 (r204409)
@@ -32,7 +32,7 @@
TYPE="FreeBSD"
REVISION="7.2"
-BRANCH="RELEASE-p6"
+BRANCH="RELEASE-p7"
if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
fi
Modified: releng/7.2/sys/kern/sched_ule.c
==============================================================================
--- releng/7.2/sys/kern/sched_ule.c Sat Feb 27 10:41:30 2010 (r204408)
+++ releng/7.2/sys/kern/sched_ule.c Sat Feb 27 10:55:43 2010 (r204409)
@@ -1822,18 +1822,24 @@ sched_switch_migrate(struct tdq *tdq, st
*/
spinlock_enter();
thread_block_switch(td); /* This releases the lock on tdq. */
- TDQ_LOCK(tdn);
- tdq_add(tdn, td, flags);
- tdq_notify(td->td_sched);
- /*
- * After we unlock tdn the new cpu still can't switch into this
- * thread until we've unblocked it in cpu_switch(). The lock
- * pointers may match in the case of HTT cores. Don't unlock here
- * or we can deadlock when the other CPU runs the IPI handler.
+
+ /*
+ * Acquire both run-queue locks before placing the thread on the new
+ * run-queue to avoid deadlocks created by placing a thread with a
+ * blocked lock on the run-queue of a remote processor. The deadlock
+ * occurs when a third processor attempts to lock the two queues in
+ * question while the target processor is spinning with its own
+ * run-queue lock held while waiting for the blocked lock to clear.
*/
- if (TDQ_LOCKPTR(tdn) != TDQ_LOCKPTR(tdq)) {
- TDQ_UNLOCK(tdn);
+ if (TDQ_LOCKPTR(tdn) == TDQ_LOCKPTR(tdq)) {
TDQ_LOCK(tdq);
+ tdq_add(tdn, td, flags);
+ tdq_notify(td->td_sched);
+ } else {
+ tdq_lock_pair(tdn, tdq);
+ tdq_add(tdn, td, flags);
+ tdq_notify(td->td_sched);
+ TDQ_UNLOCK(tdn);
}
spinlock_exit();
#endif
More information about the svn-src-all
mailing list