Subject: Re: le broken in -current on VS3100
To: Henry R. Bent <Henry.Bent@oberlin.edu>
From: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
List: port-vax
Date: 04/05/2007 19:36:28
On Tue, 3 Apr 2007, Michael L. Hitch wrote:
> OK, the change that made the le0 device not be detected was revision 1.109
> of sys/kern/kern_malloc.c. That change was to make it use mutexes.
> That change also tripped over a bug in the vax implementation of
> mutex_spin_{enter,exit} that I've been looking into.
>
> In the meantime, a workaround is to build with LOCKDEBUG (which doesn't
> include the vax-specific mutex implementations).
>
> That should get the network interface going, but -current (sometime after
> March 24) has something that causes the kernel to spend most of its time in
> the kernel. I'm working on narrowing down when that occurred now.
OK, there appears to be two bugs that cause this:
1. The ci_mtx_count in cpu_info doesn't get initialized, so
mutex_spin_enter() never saves the initial IPL value, and
mutex_spin_exit() never restores the [unsaved] IPL and remains
running at the IPL level specified in the mutex.
2. Even if ci_mtx_count had gotten initialized properly,
mutex_spin_enter() wouldn't have saved the original IPL value.
I have been using these changes that appear to make it work correctly,
at least as far as configuring the vsbus devices.
Index: sys/arch/vax/include/mutex.h
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/include/mutex.h,v
retrieving revision 1.7
diff -u -r1.7 mutex.h
--- sys/arch/vax/include/mutex.h 12 Mar 2007 02:22:43 -0000 1.7
+++ sys/arch/vax/include/mutex.h 6 Apr 2007 00:42:53 -0000
@@ -82,6 +82,10 @@
* an interlocking step.
*/
+#ifndef LOCKDEBUG
+#define MUTEX_COUNT_BIAS 1
+#endif
+
#ifndef __MUTEX_PRIVATE
struct kmutex {
@@ -111,10 +115,6 @@
#define __HAVE_MUTEX_STUBS 1
#define __HAVE_SPIN_MUTEX_STUBS 1
-#ifndef LOCKDEBUG
-#define MUTEX_COUNT_BIAS 1
-#endif
-
static inline uintptr_t
MUTEX_OWNER(uintptr_t owner)
{
Index: sys/arch/vax/vax/lock_stubs.S
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/vax/lock_stubs.S,v
retrieving revision 1.3
diff -u -r1.3 lock_stubs.S
--- sys/arch/vax/vax/lock_stubs.S 12 Mar 2007 02:22:43 -0000 1.3
+++ sys/arch/vax/vax/lock_stubs.S 6 Apr 2007 00:42:53 -0000
@@ -92,7 +92,9 @@
mtpr %r3, $PR_IPL /* yes, raise IPL */
1: mfpr $PR_SSP, %r1 /* get curcpu */
sobgeq CI_MTX_COUNT(%r1), 2f /* decr mutex count */
- movl %r2, CI_MTX_OLDSPL(%r1) /* save was-current IPL */
+ brb 4f
+2: movl %r2, CI_MTX_OLDSPL(%r1) /* save was-current IPL */
+4:
#if defined(DIAGNOSTIC) || defined(MULTIPROCESSOR)
bbssi $0, (%r0), 3f /* take out mutex */
ret
--
Michael L. Hitch mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University Bozeman, MT USA