From 326b7f663e843b9660f17260119f638a9a7d2f72 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 23 Aug 2004 21:39:29 +0000 Subject: Commit Doug White and Alan Cox's fix for the cross-ipi smp deadlock. We were obtaining different spin mutexes (which disable interrupts after aquisition) and spin waiting for delivery. For example, KSE processes do LDT operations which use smp_rendezvous, while other parts of the system are doing things like tlb shootdowns with a different mutex. This patch uses the common smp_rendezvous mutex for all MD home-grown IPIs that spinwait for delivery. Having the single mutex means that the spinloop to aquire it will enable interrupts periodically, thus avoiding the cross-ipi deadlock. Obtained from: dwhite, alc Reviewed by: jhb --- sys/kern/subr_smp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sys/kern/subr_smp.c') diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index b1be3fa..945ef6f 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -102,7 +102,14 @@ static void (*smp_rv_action_func)(void *arg); static void (*smp_rv_teardown_func)(void *arg); static void *smp_rv_func_arg; static volatile int smp_rv_waiters[2]; -static struct mtx smp_rv_mtx; + +/* + * Shared mutex to restrict busywaits between smp_rendezvous() and + * smp(_targeted)_tlb_shootdown(). A deadlock occurs if both of these + * functions trigger at once and cause multiple CPUs to busywait with + * interrupts disabled. + */ +struct mtx smp_rv_mtx; /* * Let the MD SMP code initialize mp_maxid very early if it can. -- cgit v1.1