Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump Avoid double init of tty_lock if rumpkern_tty is in...



details:   https://anonhg.NetBSD.org/src/rev/88ece09ce547
branches:  trunk
changeset: 760561:88ece09ce547
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Jan 07 15:10:22 2011 +0000

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

pointed out by njoly

diffstat:

 sys/rump/kern/lib/libtty/component.c     |   6 ++++--
 sys/rump/librump/rumpkern/rump.c         |  13 ++++++++++---
 sys/rump/librump/rumpkern/rump_private.h |   4 +++-
 3 files changed, 17 insertions(+), 6 deletions(-)

diffs (91 lines):

diff -r c36d38d88ad3 -r 88ece09ce547 sys/rump/kern/lib/libtty/component.c
--- a/sys/rump/kern/lib/libtty/component.c      Fri Jan 07 15:08:40 2011 +0000
+++ b/sys/rump/kern/lib/libtty/component.c      Fri Jan 07 15:10:22 2011 +0000
@@ -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;
 }
diff -r c36d38d88ad3 -r 88ece09ce547 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Fri Jan 07 15:08:40 2011 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Fri Jan 07 15:10:22 2011 +0000
@@ -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 */
diff -r c36d38d88ad3 -r 88ece09ce547 sys/rump/librump/rumpkern/rump_private.h
--- a/sys/rump/librump/rumpkern/rump_private.h  Fri Jan 07 15:08:40 2011 +0000
+++ b/sys/rump/librump/rumpkern/rump_private.h  Fri Jan 07 15:10:22 2011 +0000
@@ -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 *);



Home | Main Index | Thread Index | Old Index