diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2026-01-22 21:46:01 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2026-01-30 18:45:48 +0000 |
| commit | 245157fd8a382c3989075789ee98582665f3b31d (patch) | |
| tree | 20a741a3cc84aa940a21249161d182b50470db6c /lib/libcurses/ssh:/anongit@git.FreeBSD.org/(public-mirror) | |
| parent | bda8028146694ee490543b35e3349e060936fde4 (diff) | |
The issue is that for ktrcsw() we lock the ktrace_mtx mutex while owning
the interlock from a subsystem that called msleep(). In particular, the
VM subsystem might call msleep() if page allocation failed. This
establishes order VM locks (e.g. domain free queue lock) -> ktrace_mtx.
Calling free() while owning ktrace_mtx gives the reverse order.
Worse, msleep_spin_sbt() call s ktrcsw() while the thread is put on
sleep queue. Then, since the mutex might be contested, the thread needs
to be put on turnstil, which cannot work.
Move the ktrcsw() call for switch-out after the wakeup, when the thread
does not yet re-obtained any locks. From there, we call a special
version of ktrcsw(), which is passed the actual time when the context
switch occured.
The drawback is that the switch-out record is only written in the
ktrace.out file after the switch-in occurred, but this is probably not
too serious.
Reported and tested by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D54831
Diffstat (limited to 'lib/libcurses/ssh:/anongit@git.FreeBSD.org/(public-mirror)')
0 files changed, 0 insertions, 0 deletions
