Module Name:    src
Committed By:   pooka
Date:           Fri Jan  7 15:10:22 UTC 2011

Modified Files:
        src/sys/rump/kern/lib/libtty: component.c
        src/sys/rump/librump/rumpkern: rump.c rump_private.h

Log Message:
Avoid double init of tty_lock if rumpkern_tty is included.  LOCKDEBUG
does not tolerate double inits.

pointed out by njoly


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/kern/lib/libtty/component.c
cvs rdiff -u -r1.217 -r1.218 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.65 -r1.66 src/sys/rump/librump/rumpkern/rump_private.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/kern/lib/libtty/component.c
diff -u src/sys/rump/kern/lib/libtty/component.c:1.1 src/sys/rump/kern/lib/libtty/component.c:1.2
--- src/sys/rump/kern/lib/libtty/component.c:1.1	Mon Jun 14 14:45:47 2010
+++ src/sys/rump/kern/lib/libtty/component.c	Fri Jan  7 15:10:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: component.c,v 1.1 2010/06/14 14:45:47 pooka Exp $	*/
+/*	$NetBSD: component.c,v 1.2 2011/01/07 15:10:22 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2010/06/14 14:45:47 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.2 2011/01/07 15:10:22 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -68,4 +68,6 @@
 	ttyldisc_init();
 
 	ptyattach(1);
+
+	rump_ttycomponent = true;
 }

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.217 src/sys/rump/librump/rumpkern/rump.c:1.218
--- src/sys/rump/librump/rumpkern/rump.c:1.217	Thu Jan  6 13:09:17 2011
+++ src/sys/rump/librump/rumpkern/rump.c	Fri Jan  7 15:10:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.217 2011/01/06 13:09:17 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.218 2011/01/07 15:10:22 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.217 2011/01/06 13:09:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.218 2011/01/07 15:10:22 pooka Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -109,6 +109,7 @@
 #else
 const int rump_lockdebug = 0;
 #endif
+bool rump_ttycomponent = false;
 
 static void
 rump_aiodone_worker(struct work *wk, void *dummy)
@@ -307,7 +308,6 @@
 	l->l_fd = &filedesc0;
 	rumpuser_set_curlwp(l);
 
-	mutex_init(&tty_lock, MUTEX_DEFAULT, IPL_NONE);
 	rumpuser_mutex_init(&rump_giantlock);
 	ksyms_init();
 	uvm_init();
@@ -411,6 +411,13 @@
 
 	rump_component_init(RUMP_COMPONENT_KERN_VFS);
 
+	/*
+	 * if we initialized the tty component above, the tyttymtx is
+	 * now initialized.  otherwise, we need to initialize it.
+	 */
+	if (!rump_ttycomponent)
+		mutex_init(&tty_lock, MUTEX_DEFAULT, IPL_VM);
+
 	cold = 0;
 
 	/* aieeeedondest */

Index: src/sys/rump/librump/rumpkern/rump_private.h
diff -u src/sys/rump/librump/rumpkern/rump_private.h:1.65 src/sys/rump/librump/rumpkern/rump_private.h:1.66
--- src/sys/rump/librump/rumpkern/rump_private.h:1.65	Wed Dec  1 14:59:38 2010
+++ src/sys/rump/librump/rumpkern/rump_private.h	Fri Jan  7 15:10:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_private.h,v 1.65 2010/12/01 14:59:38 pooka Exp $	*/
+/*	$NetBSD: rump_private.h,v 1.66 2011/01/07 15:10:22 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -94,6 +94,8 @@
 
 extern struct cpu_info *rump_cpu;
 
+extern bool rump_ttycomponent;
+
 struct lwp *	rump__lwproc_alloclwp(struct proc *);
 
 void	rump_cpus_bootstrap(int *);

Reply via email to