Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Nov 2001 00:36:41 GMT
From:      Tor.Egge@cvsup.no.freebsd.org
To:        ohartman@klima.physik.uni-mainz.de
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   Re: FBSD4.4-STABLE SMP broken!
Message-ID:  <20011111003641B.tegge@cvsup.no.freebsd.org>
In-Reply-To: <20011110172005.J999-100000@klima.physik.uni-mainz.de>
References:  <20011110172005.J999-100000@klima.physik.uni-mainz.de>

next in thread | previous in thread | raw e-mail | index | archive | help
----Next_Part(Sun_Nov_11_00:35:48_2001_809)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> I did a cvsupdate today, the target machine was running
> stable for the last four days.
> 
> After the update and make world today, the system run a few minutes and then
> get stuck ... no keyboard input, nothing, no network response.

Sleeping while holding a simplelock can be fatal on an SMP machine.
If the other CPU tries to obtain the simplelock then you get a hang.
If the same CPU tries to obtain the simplelock then you get a panic.

One example is vinvalbuf() holding the vnode interlock while calling
vm_object_page_remove() (which might block), cf. PR 26224.

For 4.4-STABLE, it might make sense to just define some simplelock
operations to nops also under SMP.  All relevant code is already
serialized by mp_lock and further lock pushdown is unlikely to occur
on that branch.  The only effect of these simplelock operations under
4.4-STABLE SMP is a hang or panic when the locking protocol is
violated.

The enclosed patch will break 3rd party device drivers that use fast
interrupts and simple_lock() to serialize access to shared resources.
I don't know about any such device drivers.

You'll need to add 

       options SIMPLELOCK_NULL

to the relevant kernel config file and recompile the kernel for the
patch to have any effect.

- Tor Egge


----Next_Part(Sun_Nov_11_00:35:48_2001_809)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=disable-simplelock

Index: sys/conf/options
===================================================================
RCS file: /home/ncvs/src/sys/conf/options,v
retrieving revision 1.191.2.37
diff -u -r1.191.2.37 options
--- sys/conf/options	3 Nov 2001 01:41:07 -0000	1.191.2.37
+++ sys/conf/options	10 Nov 2001 23:29:19 -0000
@@ -361,7 +363,8 @@
 INVARIANT_SUPPORT	opt_global.h
 INVARIANTS		opt_global.h
 SIMPLELOCK_DEBUG	opt_global.h
+SIMPLELOCK_NULL		opt_global.h
 VFS_BIO_DEBUG		opt_global.h
 
 # These are VM related options
 VM_KMEM_SIZE		opt_vm.h
Index: sys/i386/include/lock.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/Attic/lock.h,v
retrieving revision 1.11.2.2
diff -u -r1.11.2.2 lock.h
--- sys/i386/include/lock.h	30 Sep 2000 02:49:34 -0000	1.11.2.2
+++ sys/i386/include/lock.h	10 Nov 2001 23:29:19 -0000
@@ -170,6 +170,18 @@
 extern struct simplelock	mcount_lock;
 
 #if !defined(SIMPLELOCK_DEBUG) && MAXCPU > 1
+
+#ifdef SIMPLELOCK_NULL
+
+/* On SMP systems, mp_lock is used for the serialization */
+
+#define	NULL_SIMPLELOCKS
+#define	simple_lock_init(alp)
+#define	simple_lock(alp)
+#define	simple_lock_try(alp)	(1)	/* always succeeds */
+#define	simple_unlock(alp)
+
+#else
 /*
  * This set of defines turns on the real functions in i386/isa/apic_ipl.s.
  */
@@ -177,6 +189,8 @@
 #define	simple_lock(alp)	s_lock(alp)
 #define	simple_lock_try(alp)	s_lock_try(alp)
 #define	simple_unlock(alp)	s_unlock(alp)
+
+#endif
 
 #endif /* !SIMPLELOCK_DEBUG && MAXCPU > 1 */
 

----Next_Part(Sun_Nov_11_00:35:48_2001_809)----

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011111003641B.tegge>