Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Update the rest of the kernel to conform to the module s...
details: https://anonhg.NetBSD.org/src/rev/e5bb546479e3
branches: trunk
changeset: 757252:e5bb546479e3
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sat Aug 21 13:19:39 2010 +0000
description:
Update the rest of the kernel to conform to the module subsystem's new
locking protocol.
diffstat:
sys/dev/dm/dm_target.c | 4 +---
sys/kern/kern_exec.c | 8 ++------
sys/kern/kern_syscall.c | 21 +++++++++++----------
sys/kern/sys_module.c | 10 +++++-----
sys/kern/sys_sig.c | 10 +++++-----
sys/kern/tty.c | 7 ++-----
sys/kern/uipc_accf.c | 6 ++----
sys/kern/vfs_syscalls.c | 6 ++----
sys/miscfs/specfs/spec_vnops.c | 8 ++------
sys/net/if_ppp.c | 8 ++++----
10 files changed, 36 insertions(+), 52 deletions(-)
diffs (truncated from 386 to 300 lines):
diff -r 88f25f15a1b8 -r e5bb546479e3 sys/dev/dm/dm_target.c
--- a/sys/dev/dm/dm_target.c Sat Aug 21 13:18:35 2010 +0000
+++ b/sys/dev/dm/dm_target.c Sat Aug 21 13:19:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target.c,v 1.13 2010/05/18 15:10:38 haad Exp $ */
+/* $NetBSD: dm_target.c,v 1.14 2010/08/21 13:19:41 pgoyette Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -83,9 +83,7 @@
gen = module_gen;
/* Try to autoload target module */
- mutex_enter(&module_lock);
(void) module_autoload(name, MODULE_CLASS_MISC);
- mutex_exit(&module_lock);
} while (gen != module_gen);
mutex_enter(&dm_target_mutex);
diff -r 88f25f15a1b8 -r e5bb546479e3 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c Sat Aug 21 13:18:35 2010 +0000
+++ b/sys/kern/kern_exec.c Sat Aug 21 13:19:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exec.c,v 1.299 2010/07/07 01:30:37 chs Exp $ */
+/* $NetBSD: kern_exec.c,v 1.300 2010/08/21 13:19:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.299 2010/07/07 01:30:37 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.300 2010/08/21 13:19:39 pgoyette Exp $");
#include "opt_ktrace.h"
#include "opt_modular.h"
@@ -500,17 +500,13 @@
char const * const *list;
int i;
- mutex_enter(&module_lock);
list = (nexecs == 0 ? native : compat);
for (i = 0; list[i] != NULL; i++) {
if (module_autoload(list[i], MODULE_CLASS_MISC) != 0) {
continue;
}
- mutex_exit(&module_lock);
yield();
- mutex_enter(&module_lock);
}
- mutex_exit(&module_lock);
#endif
}
diff -r 88f25f15a1b8 -r e5bb546479e3 sys/kern/kern_syscall.c
--- a/sys/kern/kern_syscall.c Sat Aug 21 13:18:35 2010 +0000
+++ b/sys/kern/kern_syscall.c Sat Aug 21 13:19:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_syscall.c,v 1.4 2010/04/15 20:46:08 pooka Exp $ */
+/* $NetBSD: kern_syscall.c,v 1.5 2010/08/21 13:19:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_syscall.c,v 1.4 2010/04/15 20:46:08 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_syscall.c,v 1.5 2010/08/21 13:19:39 pgoyette Exp $");
#include "opt_modular.h"
@@ -45,6 +45,7 @@
#include <sys/syscall.h>
#include <sys/syscallargs.h>
#include <sys/syscallvar.h>
+#include <sys/systm.h>
#include <sys/xcall.h>
int
@@ -199,13 +200,13 @@
/*
* Restart the syscall if we interrupted a module unload that
- * failed. Acquiring module_lock delays us until any unload
+ * failed. Acquiring kernconfig_lock delays us until any unload
* has been completed or rolled back.
*/
- mutex_enter(&module_lock);
+ kernconfig_lock();
sy = l->l_sysent;
if (sy->sy_call != sys_nomodule) {
- mutex_exit(&module_lock);
+ kernconfig_unlock();
return ERESTART;
}
/*
@@ -224,11 +225,11 @@
sy->sy_call == sys_nomodule) {
break;
}
- mutex_exit(&module_lock);
+ kernconfig_unlock();
return ERESTART;
}
}
- mutex_exit(&module_lock);
+ kernconfig_unlock();
#endif /* MODULAR */
return sys_nosys(l, v, retval);
@@ -240,7 +241,7 @@
struct sysent *sy;
int i;
- KASSERT(mutex_owned(&module_lock));
+ KASSERT(kernconfig_is_held());
if (em == NULL) {
em = &emul_netbsd;
@@ -277,7 +278,7 @@
lwp_t *l;
int i;
- KASSERT(mutex_owned(&module_lock));
+ KASSERT(kernconfig_is_held());
if (em == NULL) {
em = &emul_netbsd;
@@ -320,7 +321,7 @@
/*
* We lose: one or more calls are still in use. Put back
* the old entrypoints and act like nothing happened.
- * When we drop module_lock, any system calls held in
+ * When we drop kernconfig_lock, any system calls held in
* sys_nomodule() will be restarted.
*/
for (i = 0; sp[i].sp_call != NULL; i++) {
diff -r 88f25f15a1b8 -r e5bb546479e3 sys/kern/sys_module.c
--- a/sys/kern/sys_module.c Sat Aug 21 13:18:35 2010 +0000
+++ b/sys/kern/sys_module.c Sat Aug 21 13:19:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_module.c,v 1.11 2010/03/05 18:35:01 pooka Exp $ */
+/* $NetBSD: sys_module.c,v 1.12 2010/08/21 13:19:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.11 2010/03/05 18:35:01 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.12 2010/08/21 13:19:39 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -144,11 +144,11 @@
if (error != 0) {
break;
}
- mutex_enter(&module_lock);
+ kernconfig_lock();
mslen = (module_count+module_builtinlist+1) * sizeof(modstat_t);
mso = kmem_zalloc(mslen, KM_SLEEP);
if (mso == NULL) {
- mutex_exit(&module_lock);
+ kernconfig_unlock();
return ENOMEM;
}
ms = mso;
@@ -187,7 +187,7 @@
ms->ms_source = mod->mod_source;
ms++;
}
- mutex_exit(&module_lock);
+ kernconfig_unlock();
error = copyout(mso, iov.iov_base,
min(mslen - sizeof(modstat_t), iov.iov_len));
kmem_free(mso, mslen);
diff -r 88f25f15a1b8 -r e5bb546479e3 sys/kern/sys_sig.c
--- a/sys/kern/sys_sig.c Sat Aug 21 13:18:35 2010 +0000
+++ b/sys/kern/sys_sig.c Sat Aug 21 13:19:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_sig.c,v 1.28 2010/07/01 02:38:31 rmind Exp $ */
+/* $NetBSD: sys_sig.c,v 1.29 2010/08/21 13:19:39 pgoyette Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.28 2010/07/01 02:38:31 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.29 2010/08/21 13:19:39 pgoyette Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -347,13 +347,13 @@
*
* If version < 2, we try to autoload the compat module. Note
* that we interlock with the unload check in compat_modcmd()
- * using module_lock. If the autoload fails, we don't try it
+ * using kernconfig_lock. If the autoload fails, we don't try it
* again for this process.
*/
if (nsa != NULL) {
if (__predict_false(vers < 2) &&
(p->p_lflag & PL_SIGCOMPAT) == 0) {
- mutex_enter(&module_lock);
+ kernconfig_lock();
if (sendsig_sigcontext_vec == NULL) {
(void)module_autoload("compat",
MODULE_CLASS_ANY);
@@ -374,7 +374,7 @@
*/
p->p_lflag |= PL_SIGCOMPAT;
mutex_exit(proc_lock);
- mutex_exit(&module_lock);
+ kernconfig_unlock();
}
switch (vers) {
diff -r 88f25f15a1b8 -r e5bb546479e3 sys/kern/tty.c
--- a/sys/kern/tty.c Sat Aug 21 13:18:35 2010 +0000
+++ b/sys/kern/tty.c Sat Aug 21 13:19:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.237 2010/07/01 02:38:31 rmind Exp $ */
+/* $NetBSD: tty.c,v 1.238 2010/08/21 13:19:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.237 2010/07/01 02:38:31 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.238 2010/08/21 13:19:39 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1264,13 +1264,10 @@
break;
}
rw_exit(&ttcompat_lock);
- mutex_enter(&module_lock);
(void)module_autoload("compat", MODULE_CLASS_ANY);
if (ttcompatvec == NULL) {
- mutex_exit(&module_lock);
return EPASSTHROUGH;
}
- mutex_exit(&module_lock);
}
error = (*ttcompatvec)(tp, cmd, data, flag, l);
rw_exit(&ttcompat_lock);
diff -r 88f25f15a1b8 -r e5bb546479e3 sys/kern/uipc_accf.c
--- a/sys/kern/uipc_accf.c Sat Aug 21 13:18:35 2010 +0000
+++ b/sys/kern/uipc_accf.c Sat Aug 21 13:19:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_accf.c,v 1.11 2010/03/13 23:03:39 christos Exp $ */
+/* $NetBSD: uipc_accf.c,v 1.12 2010/08/21 13:19:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_accf.c,v 1.11 2010/03/13 23:03:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_accf.c,v 1.12 2010/08/21 13:19:39 pgoyette Exp $");
#define ACCEPT_FILTER_MOD
@@ -167,10 +167,8 @@
/* Try to autoload a module to satisfy the request. */
strcpy(buf, "accf_");
strlcat(buf, name, sizeof(buf));
- mutex_enter(&module_lock);
gen = module_gen;
(void)module_autoload(buf, MODULE_CLASS_ANY);
- mutex_exit(&module_lock);
} while (gen != module_gen);
return p;
diff -r 88f25f15a1b8 -r e5bb546479e3 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c Sat Aug 21 13:18:35 2010 +0000
+++ b/sys/kern/vfs_syscalls.c Sat Aug 21 13:19:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls.c,v 1.407 2010/06/30 15:44:54 pooka Exp $ */
+/* $NetBSD: vfs_syscalls.c,v 1.408 2010/08/21 13:19:39 pgoyette Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.407 2010/06/30 15:44:54 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.408 2010/08/21 13:19:39 pgoyette Exp $");
Home |
Main Index |
Thread Index |
Old Index