From c0bba69cbe7c4beee5213a4f1494387ee365db4c Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 16 Nov 2000 02:16:44 +0000 Subject: Don't release and acquire Giant in mi_switch(). Instead, release and acquire Giant as needed in functions that call mi_switch(). The releases need to be done outside of the sched_lock to avoid potential deadlocks from trying to acquire Giant while interrupts are disabled. Submitted by: witness --- sys/amd64/amd64/trap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sys/amd64') diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 674f77a..21e5e12 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -192,11 +192,13 @@ userret(p, frame, oticks, have_giant) * our priority. */ s = splhigh(); + DROP_GIANT_NOSWITCH(); mtx_enter(&sched_lock, MTX_SPIN); setrunqueue(p); p->p_stats->p_ru.ru_nivcsw++; mi_switch(); mtx_exit(&sched_lock, MTX_SPIN); + PICKUP_GIANT(); splx(s); while ((sig = CURSIG(p)) != 0) { if (have_giant == 0) { -- cgit v1.1