summaryrefslogtreecommitdiffstats
path: root/lib/libdevinfo/devinfo.h
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2009-09-15 16:56:17 +0000
committerattilio <attilio@FreeBSD.org>2009-09-15 16:56:17 +0000
commit867bd3bd7f6bb4c540f7dd1ad8ea0b0105df18c7 (patch)
tree0897533ec825c72ebbf5dfe305fa3c24c055ff09 /lib/libdevinfo/devinfo.h
parenta9512b9a6ff62512df444c36c5e17329413d5d0a (diff)
downloadFreeBSD-src-867bd3bd7f6bb4c540f7dd1ad8ea0b0105df18c7.zip
FreeBSD-src-867bd3bd7f6bb4c540f7dd1ad8ea0b0105df18c7.tar.gz
Fix sched_switch_migrate():
- In 8.x and above the run-queue locks are nomore shared even in the HTT case, so remove the special case. - The deadlock explained in the removed comment here is still possible even with different locks, with the contribution of tdq_lock_pair(). An explanation is here: (hypotesis: a thread needs to migrate on another CPU, thread1 is doing sched_switch_migrate() and thread2 is the one handling the sched_switch() request or in other words, thread1 is the thread that needs to migrate and thread2 is a thread that is going to be preempted, most likely an idle thread. Also, 'old' is referred to the context (in terms of run-queue and CPU) thread1 is leaving and 'new' is referred to the context thread1 is going into. Finally, thread3 is doing tdq_idletd() or sched_balance() and definitively doing tdq_lock_pair()) * thread1 blocks its td_lock. Now td_lock is 'blocked' * thread1 drops its old runqueue lock * thread1 acquires the new runqueue lock * thread1 adds itself to the new runqueue and sends an IPI_PREEMPT through tdq_notify() to the new CPU * thread1 drops the new lock * thread3, scanning the runqueues, locks the old lock * thread2 received the IPI_PREEMPT and does thread_lock() with td_lock pointing to the new runqueue * thread3 wants to acquire the new runqueue lock, but it can't because it is held by thread2 so it spins * thread1 wants to acquire old lock, but as long as it is held by thread3 it can't * thread2 going further, at some point wants to switchin in thread1, but it will wait forever because thread1->td_lock is in blocked state This deadlock has been manifested mostly on 7.x and reported several time on mailing lists under the voice 'spinlock held too long'. Many thanks to des@ for having worked hard on producing suitable textdumps and Jeff for help on the comment wording. Reviewed by: jeff Reported by: des, others Tested by: des, Giovanni Trematerra <giovanni dot trematerra at gmail dot com> (STABLE_7 based version)
Diffstat (limited to 'lib/libdevinfo/devinfo.h')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud