Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src Pull up following revision(s) (requested by ozaki-r in ti...
details: https://anonhg.NetBSD.org/src/rev/3bde419caabe
branches: netbsd-8
changeset: 434557:3bde419caabe
user: snj <snj%NetBSD.org@localhost>
date: Sat Jan 13 21:57:11 2018 +0000
description:
Pull up following revision(s) (requested by ozaki-r in ticket #495):
lib/librumpuser/rumpfiber.c: revision 1.13
lib/librumpuser/rumpuser_pth.c: revision 1.46
lib/librumpuser/rumpuser_pth_dummy.c: revision 1.18
sys/kern/kern_condvar.c: revision 1.40
sys/kern/kern_lock.c: revision 1.161
sys/kern/kern_mutex.c: revision 1.68
sys/kern/kern_rwlock.c: revision 1.48
sys/rump/include/rump/rumpuser.h: revision 1.115
sys/rump/librump/rumpkern/locks.c: revision 1.76-1.79
Apply C99-style struct initialization to lockops_t
--
Tweak LOCKDEBUG macros (NFC)
--
Distinguish spin mutex and adaptive mutex on rump kernels for LOCKDEBUG
Formerly rump kernels treated the two types of mutexes as both adaptive for
LOCKDEBUG for some reasons.
Now we can detect violations of mutex restrictions on rump kernels such as
taking an adaptive mutex with holding a spin mutex as well as normal kernels.
--
rump: check if the mutex is surely owned by the caller in mutex_exit
Unlocking a not-owned mutex wasn't detected well (it could detect if the mutex
is not held by anyone but that's not enough). Let's check it (the check is the
same as normal kernel's mutex).
If LOCKDEBUG is enabled, give the check over LOCKDEBUG because it can provide
better debugging information.
diffstat:
lib/librumpuser/rumpfiber.c | 11 ++++-
lib/librumpuser/rumpuser_pth.c | 11 ++++-
lib/librumpuser/rumpuser_pth_dummy.c | 11 ++++-
sys/kern/kern_condvar.c | 10 ++--
sys/kern/kern_lock.c | 10 ++--
sys/kern/kern_mutex.c | 16 +++---
sys/kern/kern_rwlock.c | 10 ++--
sys/rump/include/rump/rumpuser.h | 3 +-
sys/rump/librump/rumpkern/locks.c | 74 ++++++++++++++++++++---------------
9 files changed, 95 insertions(+), 61 deletions(-)
diffs (truncated from 378 to 300 lines):
diff -r b73333533999 -r 3bde419caabe lib/librumpuser/rumpfiber.c
--- a/lib/librumpuser/rumpfiber.c Sat Jan 13 21:52:06 2018 +0000
+++ b/lib/librumpuser/rumpfiber.c Sat Jan 13 21:57:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpfiber.c,v 1.12 2015/02/15 00:54:32 justin Exp $ */
+/* $NetBSD: rumpfiber.c,v 1.12.8.1 2018/01/13 21:57:11 snj Exp $ */
/*
* Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved.
@@ -68,7 +68,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpfiber.c,v 1.12 2015/02/15 00:54:32 justin Exp $");
+__RCSID("$NetBSD: rumpfiber.c,v 1.12.8.1 2018/01/13 21:57:11 snj Exp $");
#endif /* !lint */
#include <sys/mman.h>
@@ -693,6 +693,13 @@
*mtxp = mtx;
}
+int
+rumpuser_mutex_spin_p(struct rumpuser_mtx *mtx)
+{
+
+ return (mtx->flags & RUMPUSER_MTX_SPIN) != 0;
+}
+
void
rumpuser_mutex_enter(struct rumpuser_mtx *mtx)
{
diff -r b73333533999 -r 3bde419caabe lib/librumpuser/rumpuser_pth.c
--- a/lib/librumpuser/rumpuser_pth.c Sat Jan 13 21:52:06 2018 +0000
+++ b/lib/librumpuser/rumpuser_pth.c Sat Jan 13 21:57:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_pth.c,v 1.45 2015/09/18 10:56:25 pooka Exp $ */
+/* $NetBSD: rumpuser_pth.c,v 1.45.8.1 2018/01/13 21:57:11 snj Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth.c,v 1.45 2015/09/18 10:56:25 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_pth.c,v 1.45.8.1 2018/01/13 21:57:11 snj Exp $");
#endif /* !lint */
#include <sys/queue.h>
@@ -159,6 +159,13 @@
*mtxp = mtx;
}
+int
+rumpuser_mutex_spin_p(struct rumpuser_mtx *mtx)
+{
+
+ return (mtx->flags & RUMPUSER_MTX_SPIN) != 0;
+}
+
static void
mtxenter(struct rumpuser_mtx *mtx)
{
diff -r b73333533999 -r 3bde419caabe lib/librumpuser/rumpuser_pth_dummy.c
--- a/lib/librumpuser/rumpuser_pth_dummy.c Sat Jan 13 21:52:06 2018 +0000
+++ b/lib/librumpuser/rumpuser_pth_dummy.c Sat Jan 13 21:57:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_pth_dummy.c,v 1.17 2014/06/17 06:43:21 alnsn Exp $ */
+/* $NetBSD: rumpuser_pth_dummy.c,v 1.17.16.1 2018/01/13 21:57:11 snj Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth_dummy.c,v 1.17 2014/06/17 06:43:21 alnsn Exp $");
+__RCSID("$NetBSD: rumpuser_pth_dummy.c,v 1.17.16.1 2018/01/13 21:57:11 snj Exp $");
#endif /* !lint */
#include <sys/time.h>
@@ -98,6 +98,13 @@
*mtx = calloc(1, sizeof(struct rumpuser_mtx));
}
+int
+rumpuser_mutex_spin_p(struct rumpuser_mtx *mtx)
+{
+
+ return false; /* XXX */
+}
+
void
rumpuser_mutex_enter(struct rumpuser_mtx *mtx)
{
diff -r b73333533999 -r 3bde419caabe sys/kern/kern_condvar.c
--- a/sys/kern/kern_condvar.c Sat Jan 13 21:52:06 2018 +0000
+++ b/sys/kern/kern_condvar.c Sat Jan 13 21:57:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_condvar.c,v 1.35 2015/08/07 06:22:12 uebayasi Exp $ */
+/* $NetBSD: kern_condvar.c,v 1.35.10.1 2018/01/13 21:57:11 snj Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.35 2015/08/07 06:22:12 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.35.10.1 2018/01/13 21:57:11 snj Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -78,9 +78,9 @@
};
lockops_t cv_lockops = {
- "Condition variable",
- LOCKOPS_CV,
- NULL
+ .lo_name = "Condition variable",
+ .lo_type = LOCKOPS_CV,
+ .lo_dump = NULL,
};
static const char deadcv[] = "deadcv";
diff -r b73333533999 -r 3bde419caabe sys/kern/kern_lock.c
--- a/sys/kern/kern_lock.c Sat Jan 13 21:52:06 2018 +0000
+++ b/sys/kern/kern_lock.c Sat Jan 13 21:57:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_lock.c,v 1.158.6.1 2017/11/30 14:40:46 martin Exp $ */
+/* $NetBSD: kern_lock.c,v 1.158.6.2 2018/01/13 21:57:11 snj Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.158.6.1 2017/11/30 14:40:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.158.6.2 2018/01/13 21:57:11 snj Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -120,9 +120,9 @@
void _kernel_lock_dump(volatile void *);
lockops_t _kernel_lock_ops = {
- "Kernel lock",
- LOCKOPS_SPIN,
- _kernel_lock_dump
+ .lo_name = "Kernel lock",
+ .lo_type = LOCKOPS_SPIN,
+ .lo_dump = _kernel_lock_dump,
};
/*
diff -r b73333533999 -r 3bde419caabe sys/kern/kern_mutex.c
--- a/sys/kern/kern_mutex.c Sat Jan 13 21:52:06 2018 +0000
+++ b/sys/kern/kern_mutex.c Sat Jan 13 21:57:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_mutex.c,v 1.65 2017/05/01 21:35:25 pgoyette Exp $ */
+/* $NetBSD: kern_mutex.c,v 1.65.2.1 2018/01/13 21:57:11 snj Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
#define __MUTEX_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.65 2017/05/01 21:35:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.65.2.1 2018/01/13 21:57:11 snj Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -268,15 +268,15 @@
static void mutex_dump(volatile void *);
lockops_t mutex_spin_lockops = {
- "Mutex",
- LOCKOPS_SPIN,
- mutex_dump
+ .lo_name = "Mutex",
+ .lo_type = LOCKOPS_SPIN,
+ .lo_dump = mutex_dump,
};
lockops_t mutex_adaptive_lockops = {
- "Mutex",
- LOCKOPS_SLEEP,
- mutex_dump
+ .lo_name = "Mutex",
+ .lo_type = LOCKOPS_SLEEP,
+ .lo_dump = mutex_dump,
};
syncobj_t mutex_syncobj = {
diff -r b73333533999 -r 3bde419caabe sys/kern/kern_rwlock.c
--- a/sys/kern/kern_rwlock.c Sat Jan 13 21:52:06 2018 +0000
+++ b/sys/kern/kern_rwlock.c Sat Jan 13 21:57:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rwlock.c,v 1.46 2017/01/26 04:11:56 christos Exp $ */
+/* $NetBSD: kern_rwlock.c,v 1.46.6.1 2018/01/13 21:57:11 snj Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.46 2017/01/26 04:11:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.46.6.1 2018/01/13 21:57:11 snj Exp $");
#define __RWLOCK_PRIVATE
@@ -148,9 +148,9 @@
#endif
lockops_t rwlock_lockops = {
- "Reader / writer lock",
- LOCKOPS_SLEEP,
- rw_dump
+ .lo_name = "Reader / writer lock",
+ .lo_type = LOCKOPS_SLEEP,
+ .lo_dump = rw_dump,
};
syncobj_t rw_syncobj = {
diff -r b73333533999 -r 3bde419caabe sys/rump/include/rump/rumpuser.h
--- a/sys/rump/include/rump/rumpuser.h Sat Jan 13 21:52:06 2018 +0000
+++ b/sys/rump/include/rump/rumpuser.h Sat Jan 13 21:57:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser.h,v 1.114 2015/01/03 17:24:20 pooka Exp $ */
+/* $NetBSD: rumpuser.h,v 1.114.10.1 2018/01/13 21:57:11 snj Exp $ */
/*
* Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved.
@@ -194,6 +194,7 @@
void rumpuser_mutex_exit(struct rumpuser_mtx *);
void rumpuser_mutex_destroy(struct rumpuser_mtx *);
void rumpuser_mutex_owner(struct rumpuser_mtx *, struct lwp **);
+int rumpuser_mutex_spin_p(struct rumpuser_mtx *);
struct rumpuser_rw;
enum rumprwlock { RUMPUSER_RW_READER, RUMPUSER_RW_WRITER };
diff -r b73333533999 -r 3bde419caabe sys/rump/librump/rumpkern/locks.c
--- a/sys/rump/librump/rumpkern/locks.c Sat Jan 13 21:52:06 2018 +0000
+++ b/sys/rump/librump/rumpkern/locks.c Sat Jan 13 21:57:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locks.c,v 1.74 2017/05/01 21:35:26 pgoyette Exp $ */
+/* $NetBSD: locks.c,v 1.74.2.1 2018/01/13 21:57:11 snj Exp $ */
/*
* Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.74 2017/05/01 21:35:26 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.74.2.1 2018/01/13 21:57:11 snj Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -50,40 +50,45 @@
#ifdef LOCKDEBUG
#include <sys/lockdebug.h>
-static lockops_t mutex_lockops = {
- "mutex",
- LOCKOPS_SLEEP,
- NULL
+static lockops_t mutex_spin_lockops = {
+ .lo_name = "mutex",
+ .lo_type = LOCKOPS_SPIN,
+ .lo_dump = NULL,
+};
+static lockops_t mutex_adaptive_lockops = {
+ .lo_name = "mutex",
+ .lo_type = LOCKOPS_SLEEP,
+ .lo_dump = NULL,
};
static lockops_t rw_lockops = {
- "rwlock",
- LOCKOPS_SLEEP,
- NULL
+ .lo_name = "rwlock",
+ .lo_type = LOCKOPS_SLEEP,
+ .lo_dump = NULL,
};
#define ALLOCK(lock, ops) \
- lockdebug_alloc(__func__, __LINE__, lock, ops, \
- (uintptr_t)__builtin_return_address(0))
-#define FREELOCK(lock) \
- lockdebug_free(__func__, __LINE__, lock)
+ lockdebug_alloc(__func__, __LINE__, lock, ops, \
+ (uintptr_t)__builtin_return_address(0))
+#define FREELOCK(lock) \
+ lockdebug_free(__func__, __LINE__, lock)
Home |
Main Index |
Thread Index |
Old Index