Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > muc.lists.freebsd.current > #70661 > unrolled thread
| Started by | Olivier Certner <olce@freebsd.org> |
|---|---|
| First post | 2026-11-11 13:48 +0100 |
| Last post | 2026-11-11 23:36 +0100 |
| Articles | 2 — 1 participant |
Back to article view | Back to muc.lists.freebsd.current
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: ULE: run queue lock deadlock in sched_switch_migrate() + tdq_move() Olivier Certner <olce@freebsd.org> - 2026-11-11 13:48 +0100
Re: ULE: run queue lock deadlock in sched_switch_migrate() + tdq_move() Olivier Certner <olce@freebsd.org> - 2026-11-11 23:36 +0100
| From | Olivier Certner <olce@freebsd.org> |
|---|---|
| Date | 2026-11-11 13:48 +0100 |
| Subject | Re: ULE: run queue lock deadlock in sched_switch_migrate() + tdq_move() |
| Message-ID | <6612379.O1aUxXEVJ6@ravel> |
[Multipart message — attachments visible in raw view] — view raw
Hi, > > - CPU 4: thread T was preempted (ipi_bitmap_handler -> sched_preempt -> > > mi_switch -> sched_switch) and is migrating to CPU 12. > > sched_switch_migrate() has dropped tdq 4's lock, added T to tdq 12 > > with td_lock == &blocked_lock, dropped tdq 12's lock, and now spins in > > the final TDQ_LOCK(tdq) on tdq 4's lock. > > - CPU 20: idle thread, tdq_idled() -> tdq_move(from = tdq 12, to = tdq 20). > > It holds the tdq 20 and tdq 12 locks and spins in > > thread_lock_block_wait(T). > > - CPU 0: idle thread, statclock -> sched_clock -> sched_balance -> > > sched_balance_group -> sched_balance_pair -> tdq_lock_pair(). > > It holds tdq 4's lock and spins on tdq 20's lock. > > > > T's td_lock can be released only by cpu_switch() on CPU 4, which can run > > only after CPU 4 gets tdq 4's lock. So CPU 0 waits for CPU 20, CPU 20 waits > > for T, and T waits for CPU 0. Other CPUs then piled up on tdq 20's lock > > (sched_add from sleepq_timeout) until one of them panicked. This indeed can happen. > > Ermal proposed to fix (avoid) the issue by not waiting in tdq_move() at all: > > if the thread is still blocked, return -1, which all callers already handle, > > since stealing is opportunistic. Yes, but that decreases efficiency of the "try steal" and it looks like it can be fixed differently. > I can open a review request if it would make discussing and reviewing easier. In the patch below, `thread_lock_block_wait()` is now superfluous. Except for trivial things, please always put up scheduler changes under review with the `#scheduler` group as a reviewer. Thanks and regards. -- Olivier Certner
[toc] | [next] | [standalone]
| From | Olivier Certner <olce@freebsd.org> |
|---|---|
| Date | 2026-11-11 23:36 +0100 |
| Message-ID | <4342686.O2WMGSuNBG@ravel> |
| In reply to | #70661 |
[Multipart message — attachments visible in raw view] — view raw
Please see https://reviews.freebsd.org/D61448. Regards. -- Olivier Certner
[toc] | [prev] | [standalone]
Back to top | Article view | muc.lists.freebsd.current
csiph-web