From 84d2b7df26aaa4c58367dd2ba8a64bf84a7bb069 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Mon, 19 Sep 2005 16:51:43 +0000 Subject: Add GIANT_REQUIRED and WITNESS sleep warnings to uprintf() and tprintf(), as they both interact with the tty code (!MPSAFE) and may sleep if the tty buffer is full (per comment). Modify all consumers of uprintf() and tprintf() to hold Giant around calls into these functions. In most cases, this means adding an acquisition of Giant immediately around the function. In some cases (nfs_timer()), it means acquiring Giant higher up in the callout. With these changes, UFS no longer panics on SMP when either blocks are exhausted or inodes are exhausted under load due to races in the tty code when running without Giant. NB: Some reduction in calls to uprintf() in the svr4 code is probably desirable. NB: In the case of nfs_timer(), calling uprintf() while holding a mutex, or even in a callout at all, is a bad idea, and will generate warnings and potential upset. This needs to be fixed, but was a problem before this change. NB: uprintf()/tprintf() sleeping is generally a bad ideas, as is having non-MPSAFE tty code. MFC after: 1 week --- sys/alpha/osf1/osf1_misc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sys/alpha/osf1/osf1_misc.c') diff --git a/sys/alpha/osf1/osf1_misc.c b/sys/alpha/osf1/osf1_misc.c index 63ce5eed5cc41..eacf78a96f8e4 100644 --- a/sys/alpha/osf1/osf1_misc.c +++ b/sys/alpha/osf1/osf1_misc.c @@ -209,8 +209,10 @@ osf1_getsysinfo(td, uap) rpb_size = (unsigned long)&hwrpb->rpb_tbhint - (unsigned long)hwrpb; if(uap->nbytes < rpb_size){ + mtx_lock(&Giant); uprintf("nbytes = %ld, sizeof(struct rpb) = %ld\n", uap->nbytes, rpb_size); + mtx_unlock(&Giant); error = EINVAL; } else { @@ -254,7 +256,9 @@ osf1_setsysinfo(td, uap) break; } default: + mtx_lock(&Giant); uprintf("osf1_setsysinfo called with op=%ld\n", uap->op); + mtx_unlock(&Giant); /*error = EINVAL;*/ } return (error); -- cgit v1.2.3