PERFORCE change 139340 for review
Warner Losh
imp at FreeBSD.org
Fri Apr 4 14:36:28 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=139340
Change 139340 by imp at imp_paco-paco on 2008/04/04 14:36:02
IFC @139337
Affected files ...
.. //depot/projects/mips2/src/lib/libc/include/libc_private.h#4 integrate
.. //depot/projects/mips2/src/lib/libc/sys/Makefile.inc#9 integrate
.. //depot/projects/mips2/src/lib/libc/sys/fcntl.c#1 branch
.. //depot/projects/mips2/src/sbin/ddb/ddb.8#3 integrate
.. //depot/projects/mips2/src/sbin/ddb/ddb.c#3 integrate
.. //depot/projects/mips2/src/sys/fs/fdescfs/fdesc_vnops.c#6 integrate
.. //depot/projects/mips2/src/sys/kern/kern_rwlock.c#10 integrate
Differences ...
==== //depot/projects/mips2/src/lib/libc/include/libc_private.h#4 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libc/include/libc_private.h,v 1.17 2007/07/04 23:27:38 peter Exp $
+ * $FreeBSD: src/lib/libc/include/libc_private.h,v 1.18 2008/04/04 09:43:03 dfr Exp $
*
* Private definitions for libc, libc_r and libpthread.
*
@@ -192,4 +192,7 @@
extern __ssize_t __sys_freebsd6_pwrite(int, const void *, __size_t, int, __off_t);
extern void * __sys_freebsd6_mmap(void *, __size_t, int, int, int, int, __off_t);
+/* Without back-compat translation */
+extern int __sys_fcntl(int, int, ...);
+
#endif /* _LIBC_PRIVATE_H_ */
==== //depot/projects/mips2/src/lib/libc/sys/Makefile.inc#9 (text+ko) ====
@@ -1,5 +1,5 @@
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
-# $FreeBSD: src/lib/libc/sys/Makefile.inc,v 1.132 2008/03/29 10:26:29 jeff Exp $
+# $FreeBSD: src/lib/libc/sys/Makefile.inc,v 1.133 2008/04/04 09:43:03 dfr Exp $
# sys sources
.PATH: ${.CURDIR}/${MACHINE_ARCH}/sys ${.CURDIR}/sys
@@ -20,7 +20,8 @@
# Sources common to both syscall interfaces:
SRCS+= stack_protector.c __error.c
.if !defined(WITHOUT_SYSCALL_COMPAT)
-SRCS+= ftruncate.c lseek.c mmap.c pread.c pwrite.c truncate.c
+SRCS+= fcntl.c ftruncate.c lseek.c mmap.c pread.c pwrite.c truncate.c
+PSEUDO+= _fcntl.o
.endif
# Add machine dependent asm sources:
==== //depot/projects/mips2/src/sbin/ddb/ddb.8#3 (text+ko) ====
@@ -23,21 +23,21 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/sbin/ddb/ddb.8,v 1.3 2008/03/05 17:51:06 brooks Exp $
+.\" $FreeBSD: src/sbin/ddb/ddb.8,v 1.4 2008/04/04 07:31:43 ru Exp $
.\"
-.Dd 25 December, 2007
+.Dd April 4, 2008
.Dt DDB 8
.Os
.Sh NAME
.Nm ddb
-.Nd Configure DDB kernel debugger properties
+.Nd "configure DDB kernel debugger properties"
.Sh SYNOPSIS
.Nm
.Cm script
.Ar scriptname
.Nm
.Cm script
-.Ar scriptname=script
+.Ar scriptname Ns = Ns Ar script
.Nm
.Cm scripts
.Nm
@@ -46,9 +46,10 @@
.Nm
.Ar pathname
.Sh DESCRIPTION
+The
.Nm
-configures certain aspects of the
-.Xr DDB 4
+utility configures certain aspects of the
+.Xr ddb 4
kernel debugger from user space that are not configured at compile-time or
easily via
.Xr sysctl 8
@@ -64,24 +65,26 @@
.Nm
utility.
Whitespace at the beginning of lines will be ignored as will lines where the
-first non-whitespace character is #.
+first non-whitespace character is
+.Ql # .
.Sh SCRIPTING
+The
.Nm
-can be used to configure aspects of
-.Xr DDB 4
+utility can be used to configure aspects of
+.Xr ddb 4
scripting from user space; scripting support is described in more detail in
-.Xr DDB 4 .
+.Xr ddb 4 .
Each of the debugger commands is available from the command line:
.Bl -tag -width indent
.It Cm script Ar scriptname
Print the script named
.Ar scriptname .
-.It Cm script Ar scriptname=scriptvalue
+.It Cm script Ar scriptname Ns = Ns Ar script
Define a script named
-.Ar scriptname ;
-as many scripts contain characters interpreted in special ways by the shell,
+.Ar scriptname .
+As many scripts contain characters interpreted in special ways by the shell,
it is advisable to enclose
-.Ar scriptvalue
+.Ar script
in quotes.
.It Cm scripts
List currently defined scripts.
@@ -89,6 +92,8 @@
Delete the script named
.Ar scriptname .
.El
+.Sh EXIT STATUS
+.Ex -std
.Sh EXAMPLES
The following example defines a script that will execute when the kernel
debugger is entered as a result of a break signal:
@@ -97,24 +102,22 @@
.Ed
.Pp
The following example will delete the script:
-.Bd -literal -offset indent
-ddb unscript kdb.enter.break
-.Ed
+.Pp
+.Dl "ddb unscript kdb.enter.break"
.Pp
For further examples, see the
.Xr ddb 4
and
.Xr textdump 4
-man pages.
-.Sh EXIT STATUS
-.Ex -std
+manual pages.
.Sh SEE ALSO
.Xr ddb 4 ,
.Xr textdump 4 ,
.Xr sysctl 8
.Sh HISTORY
+The
.Nm
-first appeared in
+utility first appeared in
.Fx 8.0 .
.Sh AUTHORS
.An Robert N M Watson
==== //depot/projects/mips2/src/sbin/ddb/ddb.c#3 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/ddb/ddb.c,v 1.2 2008/03/05 17:51:06 brooks Exp $");
+__FBSDID("$FreeBSD: src/sbin/ddb/ddb.c,v 1.3 2008/04/04 07:31:43 ru Exp $");
#include <err.h>
#include <stdio.h>
@@ -43,11 +43,11 @@
usage(void)
{
- fprintf(stderr, "usage:\n");
- fprintf(stderr, "ddb script scriptname\n");
- fprintf(stderr, "ddb script scriptname=script\n");
- fprintf(stderr, "ddb scripts\n");
- fprintf(stderr, "ddb unscript scriptname\n");
+ fprintf(stderr, "usage: ddb script scriptname\n");
+ fprintf(stderr, " ddb script scriptname=script\n");
+ fprintf(stderr, " ddb scripts\n");
+ fprintf(stderr, " ddb unscript scriptname\n");
+ fprintf(stderr, " ddb pathname\n");
exit(EX_USAGE);
}
==== //depot/projects/mips2/src/sys/fs/fdescfs/fdesc_vnops.c#6 (text+ko) ====
@@ -31,7 +31,7 @@
*
* @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94
*
- * $FreeBSD: src/sys/fs/fdescfs/fdesc_vnops.c,v 1.107 2008/02/26 10:10:55 kib Exp $
+ * $FreeBSD: src/sys/fs/fdescfs/fdesc_vnops.c,v 1.108 2008/04/04 09:37:57 kib Exp $
*/
/*
@@ -116,9 +116,11 @@
loop:
LIST_FOREACH(fd, fc, fd_hash) {
if (fd->fd_ix == ix && fd->fd_vnode->v_mount == mp) {
- if (vget(fd->fd_vnode, 0, td))
+ if (vget(fd->fd_vnode, LK_EXCLUSIVE | LK_CANRECURSE,
+ td))
goto loop;
*vpp = fd->fd_vnode;
+ VOP_UNLOCK(*vpp, 0);
return (error);
}
}
==== //depot/projects/mips2/src/sys/kern/kern_rwlock.c#10 (text+ko) ====
@@ -32,17 +32,19 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_rwlock.c,v 1.37 2008/04/01 20:31:55 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_rwlock.c,v 1.38 2008/04/04 10:00:46 jeff Exp $");
#include "opt_ddb.h"
#include "opt_no_adaptive_rwlocks.h"
#include <sys/param.h>
#include <sys/ktr.h>
+#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/rwlock.h>
+#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/turnstile.h>
@@ -54,6 +56,14 @@
#define ADAPTIVE_RWLOCKS
#endif
+#ifdef ADAPTIVE_RWLOCKS
+static int rowner_retries = 10;
+static int rowner_loops = 10000;
+SYSCTL_NODE(_debug, OID_AUTO, rwlock, CTLFLAG_RD, NULL, "rwlock debugging");
+SYSCTL_INT(_debug_rwlock, OID_AUTO, retry, CTLFLAG_RW, &rowner_retries, 0, "");
+SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, &rowner_loops, 0, "");
+#endif
+
#ifdef DDB
#include <ddb/ddb.h>
@@ -261,6 +271,8 @@
struct turnstile *ts;
#ifdef ADAPTIVE_RWLOCKS
volatile struct thread *owner;
+ int spintries = 0;
+ int i;
#endif
uint64_t waittime = 0;
int contested = 0;
@@ -324,6 +336,16 @@
cpu_spinwait();
continue;
}
+ } else if (spintries < rowner_retries) {
+ spintries++;
+ for (i = 0; i < rowner_loops; i++) {
+ v = rw->rw_lock;
+ if ((v & RW_LOCK_READ) == 0 || RW_CAN_READ(v))
+ break;
+ cpu_spinwait();
+ }
+ if (i != rowner_loops)
+ continue;
}
#endif
@@ -592,7 +614,8 @@
cpu_spinwait();
continue;
}
- if ((v & RW_LOCK_READ) && RW_READERS(v) && spintries < 100) {
+ if ((v & RW_LOCK_READ) && RW_READERS(v) &&
+ spintries < rowner_retries) {
if (!(v & RW_LOCK_WRITE_SPINNER)) {
if (!atomic_cmpset_ptr(&rw->rw_lock, v,
v | RW_LOCK_WRITE_SPINNER)) {
@@ -601,12 +624,12 @@
}
}
spintries++;
- for (i = 100000; i > 0; i--) {
+ for (i = 0; i < rowner_loops; i++) {
if ((rw->rw_lock & RW_LOCK_WRITE_SPINNER) == 0)
break;
cpu_spinwait();
}
- if (i)
+ if (i != rowner_loops)
continue;
}
#endif
More information about the p4-projects
mailing list