From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 00:33:37 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 592BDA2A; Sun, 2 Jun 2013 00:33:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3B8446D3; Sun, 2 Jun 2013 00:33:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r520XbTH051578; Sun, 2 Jun 2013 00:33:37 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r520Xa8a051568; Sun, 2 Jun 2013 00:33:36 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306020033.r520Xa8a051568@svn.freebsd.org> From: Mark Johnston Date: Sun, 2 Jun 2013 00:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251237 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt sys/cddl/dev/dtrace sys/modules/dtrace/dtrace_test X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 00:33:37 -0000 Author: markj Date: Sun Jun 2 00:33:36 2013 New Revision: 251237 URL: http://svnweb.freebsd.org/changeset/base/251237 Log: Port the SDT test now that it's possible to create SDT probes that take seven arguments. The original test uses Solaris' uadmin system call to trigger the test probe; this change adds a sysctl to the dtrace_test module and gets the test program to trigger the test probe via the sysctl handler. The test is currently failing on amd64 because of some bugs in the way that probe arguments beyond the first five are obtained - these bugs will be fixed in a separate change. Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d head/sys/cddl/dev/dtrace/dtrace_test.c head/sys/modules/dtrace/dtrace_test/Makefile Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c Sat Jun 1 23:58:44 2013 (r251236) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c Sun Jun 2 00:33:36 2013 (r251237) @@ -26,26 +26,24 @@ #pragma ident "%Z%%M% %I% %E% SMI" +#include +#include + +#include #include -#ifndef __FreeBSD__ -#include -#endif int main(int argc, char **argv) { -#ifdef __FreeBSD__ - return (1); -#else + int val = 1; + while (1) { - if (uadmin(A_SDTTEST, 0, 0) < 0) { - perror("uadmin"); - return (1); - } + if (sysctlbyname("debug.dtracetest.sdttest", NULL, NULL, &val, + sizeof(val))) + err(1, "sysctlbyname"); sleep(1); } return (0); -#endif } Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d Sat Jun 1 23:58:44 2013 (r251236) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d Sun Jun 2 00:33:36 2013 (r251237) @@ -43,7 +43,7 @@ ERROR exit(1); } -sdt:::test +test:::sdttest /arg0 != 1 || arg1 != 2 || arg2 != 3 || arg3 != 4 || arg4 != 5 || arg5 != 6 || arg6 != 7/ { @@ -54,7 +54,7 @@ sdt:::test exit(1); } -sdt:::test +test:::sdttest { exit(0); } Modified: head/sys/cddl/dev/dtrace/dtrace_test.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_test.c Sat Jun 1 23:58:44 2013 (r251236) +++ head/sys/cddl/dev/dtrace/dtrace_test.c Sun Jun 2 00:33:36 2013 (r251237) @@ -25,15 +25,25 @@ * $FreeBSD$ * */ +#include "opt_kdtrace.h" #include #include #include +#include + #include #include #include +#include +#include #include +SDT_PROVIDER_DEFINE(test); + +SDT_PROBE_DEFINE7(test, , , sdttest, sdttest, "int", "int", "int", "int", "int", + "int", "int"); + /* * These are variables that the DTrace test suite references in the * Solaris kernel. We define them here so that the tests function @@ -45,6 +55,33 @@ typedef struct vnode vnode_t; vnode_t dummy; vnode_t *rootvp = &dummy; +/* + * Test SDT probes with more than 5 arguments. On amd64, such probes require + * special handling since only the first 5 arguments will be passed to + * dtrace_probe() in registers; the rest must be fetched off the stack. + */ +static int +dtrace_test_sdttest(SYSCTL_HANDLER_ARGS) +{ + int val, error; + + val = 0; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || req->newptr == NULL) + return (error); + else if (val == 0) + return (0); + + SDT_PROBE7(test, , , sdttest, 1, 2, 3, 4, 5, 6, 7); + + return (error); +} + +static SYSCTL_NODE(_debug, OID_AUTO, dtracetest, CTLFLAG_RD, 0, ""); + +SYSCTL_PROC(_debug_dtracetest, OID_AUTO, sdttest, CTLTYPE_INT | CTLFLAG_RW, + NULL, 0, dtrace_test_sdttest, "I", "Trigger the SDT test probe"); + static int dtrace_test_modevent(module_t mod, int type, void *data) { Modified: head/sys/modules/dtrace/dtrace_test/Makefile ============================================================================== --- head/sys/modules/dtrace/dtrace_test/Makefile Sat Jun 1 23:58:44 2013 (r251236) +++ head/sys/modules/dtrace/dtrace_test/Makefile Sun Jun 2 00:33:36 2013 (r251237) @@ -5,8 +5,9 @@ KMOD= dtrace_test SRCS= dtrace_test.c +SRCS+= opt_kdtrace.h SRCS+= vnode_if.h - + CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -D_KERNEL From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 01:05:37 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C09E3C8E; Sun, 2 Jun 2013 01:05:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 992FE799; Sun, 2 Jun 2013 01:05:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r5215bWW062328; Sun, 2 Jun 2013 01:05:37 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r5215b1p062326; Sun, 2 Jun 2013 01:05:37 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306020105.r5215b1p062326@svn.freebsd.org> From: Mark Johnston Date: Sun, 2 Jun 2013 01:05:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251238 - in head/sys/cddl/dev: dtrace/amd64 sdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 01:05:37 -0000 Author: markj Date: Sun Jun 2 01:05:36 2013 New Revision: 251238 URL: http://svnweb.freebsd.org/changeset/base/251238 Log: SDT probes can directly pass up to five arguments as arguments to dtrace_probe(). Arguments beyond these five must be obtained in an architecture-specific way; this can be done through the getargval provider method, and through dtrace_getarg() if getargval isn't overridden. This change fixes two off-by-one bugs in the way these arguments are fetched in FreeBSD's DTrace implementation. First, the SDT provider must set the aframes parameter to 1 when creating a probe. The aframes parameter controls the number of frames that dtrace_getarg() will step over in order to find the frame containing the extra arguments. On FreeBSD, dtrace_getarg() is called in SDT probe context via dtrace_probe()->dtrace_dif_emulate()->dtrace_dif_variable->dtrace_getarg() so aframes must be 3 since the arguments are in dtrace_probe()'s frame; it was previously being called with a value of 2 instead. illumos uses a different aframes value for SDT probes, but this is because illumos SDT probes fire by triggering the #UD fault handler rather than calling dtrace_probe() directly. The second bug has to do with the way arguments are grabbed out dtrace_probe()'s frame on amd64. The code currently jumps over the first stack argument and retrieves the rest of them using a pointer into the stack. This works on i386 because all of dtrace_probe()'s arguments will be on the stack and the first argument is the probe ID, which should be ignored. However, it is incorrect to ignore the first stack argument on amd64, so we correct the pointer used to access the arguments. MFC after: 2 weeks Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c head/sys/cddl/dev/sdt/sdt.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Sun Jun 2 00:33:36 2013 (r251237) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Sun Jun 2 01:05:36 2013 (r251238) @@ -398,7 +398,7 @@ dtrace_getarg(int arg, int aframes) } arg -= (inreg + 1); - stack = (uintptr_t *)&fp[1]; + stack = (uintptr_t *)fp + 2; load: DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Sun Jun 2 00:33:36 2013 (r251237) +++ head/sys/cddl/dev/sdt/sdt.c Sun Jun 2 01:05:36 2013 (r251238) @@ -134,7 +134,7 @@ sdt_probe_callback(struct sdt_probe *pro return (0); (void) dtrace_probe_create(prov->id, probe->mod, probe->func, - probe->name, 0, probe); + probe->name, 1, probe); return (0); } From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 01:07:39 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7D0F2E14; Sun, 2 Jun 2013 01:07:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6E8507A5; Sun, 2 Jun 2013 01:07:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r5217d4V062807; Sun, 2 Jun 2013 01:07:39 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r5217dQk062806; Sun, 2 Jun 2013 01:07:39 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306020107.r5217dQk062806@svn.freebsd.org> From: Mark Johnston Date: Sun, 2 Jun 2013 01:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251239 - head/tools/test/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 01:07:39 -0000 Author: markj Date: Sun Jun 2 01:07:38 2013 New Revision: 251239 URL: http://svnweb.freebsd.org/changeset/base/251239 Log: This test is working now, so remove it from NOTWORK. Modified: head/tools/test/dtrace/Makefile Modified: head/tools/test/dtrace/Makefile ============================================================================== --- head/tools/test/dtrace/Makefile Sun Jun 2 01:05:36 2013 (r251238) +++ head/tools/test/dtrace/Makefile Sun Jun 2 01:07:38 2013 (r251239) @@ -159,7 +159,6 @@ NOTWORK+= \ ${TESTSRCDIR}/tst/common/sched/tst.enqueue.d \ ${TESTSRCDIR}/tst/common/sched/tst.oncpu.d \ ${TESTSRCDIR}/tst/common/sched/tst.stackdepth.d \ - ${TESTSRCDIR}/tst/common/sdt/tst.sdtargs.d \ ${TESTSRCDIR}/tst/common/usdt/argmap.d \ ${TESTSRCDIR}/tst/common/usdt/args.d \ ${TESTSRCDIR}/tst/common/usdt/forker.d \ From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 01:10:50 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 19248FAA; Sun, 2 Jun 2013 01:10:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 099AF7C3; Sun, 2 Jun 2013 01:10:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r521An0q065055; Sun, 2 Jun 2013 01:10:49 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r521AnpR065054; Sun, 2 Jun 2013 01:10:49 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306020110.r521AnpR065054@svn.freebsd.org> From: Mark Johnston Date: Sun, 2 Jun 2013 01:10:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251240 - head/usr.sbin/newsyslog X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 01:10:50 -0000 Author: markj Date: Sun Jun 2 01:10:49 2013 New Revision: 251240 URL: http://svnweb.freebsd.org/changeset/base/251240 Log: We want to stat the archived log file rather than the logfile itself. PR: bin/179122 Submitted by: Oliver Fromme MFC after: 3 days Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Sun Jun 2 01:07:38 2013 (r251239) +++ head/usr.sbin/newsyslog/newsyslog.c Sun Jun 2 01:10:49 2013 (r251240) @@ -2326,7 +2326,7 @@ mtime_old_timelog(const char *file) if (validate_old_timelog(dir_fd, dp, logfname, &tm) == 0) continue; - if (fstatat(dir_fd, logfname, &sb, AT_SYMLINK_NOFOLLOW) == -1) { + if (fstatat(dir_fd, dp->d_name, &sb, AT_SYMLINK_NOFOLLOW) == -1) { warn("Cannot stat '%s'", file); continue; } From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 04:30:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A3B0DEC1; Sun, 2 Jun 2013 04:30:04 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 960731724; Sun, 2 Jun 2013 04:30:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r524U4sX097447; Sun, 2 Jun 2013 04:30:04 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r524U3tr097435; Sun, 2 Jun 2013 04:30:03 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201306020430.r524U3tr097435@svn.freebsd.org> From: David Schultz Date: Sun, 2 Jun 2013 04:30:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251241 - head/tools/regression/lib/msun X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 04:30:04 -0000 Author: das Date: Sun Jun 2 04:30:03 2013 New Revision: 251241 URL: http://svnweb.freebsd.org/changeset/base/251241 Log: Factor out some common code from the libm tests. This is a bit messy because different tests have different ideas about what it means to be "close enough" to the right answer, depending on the properties of the function being tested. In the process, I fixed some warnings and added a few more 'volatile' hacks, which are sufficient to make all the tests pass at -O2 with clang. Added: head/tools/regression/lib/msun/test-utils.h (contents, props changed) Modified: head/tools/regression/lib/msun/Makefile head/tools/regression/lib/msun/test-cexp.c head/tools/regression/lib/msun/test-conj.c head/tools/regression/lib/msun/test-csqrt.c head/tools/regression/lib/msun/test-ctrig.c head/tools/regression/lib/msun/test-exponential.c head/tools/regression/lib/msun/test-fma.c head/tools/regression/lib/msun/test-fmaxmin.c head/tools/regression/lib/msun/test-invctrig.c head/tools/regression/lib/msun/test-invtrig.c head/tools/regression/lib/msun/test-logarithm.c head/tools/regression/lib/msun/test-nearbyint.c head/tools/regression/lib/msun/test-next.c head/tools/regression/lib/msun/test-trig.c Modified: head/tools/regression/lib/msun/Makefile ============================================================================== --- head/tools/regression/lib/msun/Makefile Sun Jun 2 01:10:49 2013 (r251240) +++ head/tools/regression/lib/msun/Makefile Sun Jun 2 04:30:03 2013 (r251241) @@ -5,7 +5,7 @@ TESTS= test-cexp test-conj test-csqrt te test-fmaxmin test-ilogb test-invtrig test-invctrig \ test-logarithm test-lrint \ test-lround test-nan test-nearbyint test-next test-rem test-trig -CFLAGS+= -O0 -lm +CFLAGS+= -O0 -lm -Wno-unknown-pragmas .PHONY: tests tests: ${TESTS} Modified: head/tools/regression/lib/msun/test-cexp.c ============================================================================== --- head/tools/regression/lib/msun/test-cexp.c Sun Jun 2 01:10:49 2013 (r251240) +++ head/tools/regression/lib/msun/test-cexp.c Sun Jun 2 04:30:03 2013 (r251241) @@ -38,11 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include -#define ALL_STD_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \ - FE_OVERFLOW | FE_UNDERFLOW) -#define FLT_ULP() ldexpl(1.0, 1 - FLT_MANT_DIG) -#define DBL_ULP() ldexpl(1.0, 1 - DBL_MANT_DIG) -#define LDBL_ULP() ldexpl(1.0, 1 - LDBL_MANT_DIG) +#include "test-utils.h" #define N(i) (sizeof(i) / sizeof((i)[0])) @@ -50,23 +46,6 @@ __FBSDID("$FreeBSD$"); #pragma STDC CX_LIMITED_RANGE OFF /* - * XXX gcc implements complex multiplication incorrectly. In - * particular, it implements it as if the CX_LIMITED_RANGE pragma - * were ON. Consequently, we need this function to form numbers - * such as x + INFINITY * I, since gcc evalutes INFINITY * I as - * NaN + INFINITY * I. - */ -static inline long double complex -cpackl(long double x, long double y) -{ - long double complex z; - - __real__ z = x; - __imag__ z = y; - return (z); -} - -/* * Test that a function returns the correct value and sets the * exception flags correctly. The exceptmask specifies which * exceptions we should check. We need to be lenient for several @@ -83,14 +62,15 @@ cpackl(long double x, long double y) #define test(func, z, result, exceptmask, excepts, checksign) do { \ volatile long double complex _d = z; \ assert(feclearexcept(FE_ALL_EXCEPT) == 0); \ - assert(cfpequal((func)(_d), (result), (checksign))); \ - assert(((func), fetestexcept(exceptmask) == (excepts))); \ + assert(cfpequal_cs((func)(_d), (result), (checksign))); \ + assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \ } while (0) /* Test within a given tolerance. */ #define test_tol(func, z, result, tol) do { \ volatile long double complex _d = z; \ - assert(cfpequal_tol((func)(_d), (result), (tol))); \ + assert(cfpequal_tol((func)(_d), (result), (tol), \ + FPE_ABS_ZERO | CS_BOTH)); \ } while (0) /* Test all the functions that compute cexp(x). */ @@ -112,67 +92,6 @@ cpackl(long double x, long double y) static const float finites[] = { -42.0e20, -1.0, -1.0e-10, -0.0, 0.0, 1.0e-10, 1.0, 42.0e20 }; -/* - * Determine whether x and y are equal, with two special rules: - * +0.0 != -0.0 - * NaN == NaN - * If checksign is 0, we compare the absolute values instead. - */ -static int -fpequal(long double x, long double y, int checksign) -{ - if (isnan(x) || isnan(y)) - return (1); - if (checksign) - return (x == y && !signbit(x) == !signbit(y)); - else - return (fabsl(x) == fabsl(y)); -} - -static int -fpequal_tol(long double x, long double y, long double tol) -{ - fenv_t env; - int ret; - - if (isnan(x) && isnan(y)) - return (1); - if (!signbit(x) != !signbit(y)) - return (0); - if (x == y) - return (1); - if (tol == 0) - return (0); - - /* Hard case: need to check the tolerance. */ - feholdexcept(&env); - /* - * For our purposes here, if y=0, we interpret tol as an absolute - * tolerance. This is to account for roundoff in the input, e.g., - * cos(Pi/2) ~= 0. - */ - if (y == 0.0) - ret = fabsl(x - y) <= fabsl(tol); - else - ret = fabsl(x - y) <= fabsl(y * tol); - fesetenv(&env); - return (ret); -} - -static int -cfpequal(long double complex x, long double complex y, int checksign) -{ - return (fpequal(creal(x), creal(y), checksign) - && fpequal(cimag(x), cimag(y), checksign)); -} - -static int -cfpequal_tol(long double complex x, long double complex y, long double tol) -{ - return (fpequal_tol(creal(x), creal(y), tol) - && fpequal_tol(cimag(x), cimag(y), tol)); -} - /* Tests for 0 */ void @@ -182,8 +101,8 @@ test_zero(void) /* cexp(0) = 1, no exceptions raised */ testall(0.0, 1.0, ALL_STD_EXCEPT, 0, 1); testall(-0.0, 1.0, ALL_STD_EXCEPT, 0, 1); - testall(cpackl(0.0, -0.0), cpackl(1.0, -0.0), ALL_STD_EXCEPT, 0, 1); - testall(cpackl(-0.0, -0.0), cpackl(1.0, -0.0), ALL_STD_EXCEPT, 0, 1); + testall(CMPLXL(0.0, -0.0), CMPLXL(1.0, -0.0), ALL_STD_EXCEPT, 0, 1); + testall(CMPLXL(-0.0, -0.0), CMPLXL(1.0, -0.0), ALL_STD_EXCEPT, 0, 1); } /* @@ -198,27 +117,27 @@ test_nan() /* cexp(x + NaNi) = NaN + NaNi and optionally raises invalid */ /* cexp(NaN + yi) = NaN + NaNi and optionally raises invalid (|y|>0) */ for (i = 0; i < N(finites); i++) { - testall(cpackl(finites[i], NAN), cpackl(NAN, NAN), + testall(CMPLXL(finites[i], NAN), CMPLXL(NAN, NAN), ALL_STD_EXCEPT & ~FE_INVALID, 0, 0); if (finites[i] == 0.0) continue; /* XXX FE_INEXACT shouldn't be raised here */ - testall(cpackl(NAN, finites[i]), cpackl(NAN, NAN), + testall(CMPLXL(NAN, finites[i]), CMPLXL(NAN, NAN), ALL_STD_EXCEPT & ~(FE_INVALID | FE_INEXACT), 0, 0); } /* cexp(NaN +- 0i) = NaN +- 0i */ - testall(cpackl(NAN, 0.0), cpackl(NAN, 0.0), ALL_STD_EXCEPT, 0, 1); - testall(cpackl(NAN, -0.0), cpackl(NAN, -0.0), ALL_STD_EXCEPT, 0, 1); + testall(CMPLXL(NAN, 0.0), CMPLXL(NAN, 0.0), ALL_STD_EXCEPT, 0, 1); + testall(CMPLXL(NAN, -0.0), CMPLXL(NAN, -0.0), ALL_STD_EXCEPT, 0, 1); /* cexp(inf + NaN i) = inf + nan i */ - testall(cpackl(INFINITY, NAN), cpackl(INFINITY, NAN), + testall(CMPLXL(INFINITY, NAN), CMPLXL(INFINITY, NAN), ALL_STD_EXCEPT, 0, 0); /* cexp(-inf + NaN i) = 0 */ - testall(cpackl(-INFINITY, NAN), cpackl(0.0, 0.0), + testall(CMPLXL(-INFINITY, NAN), CMPLXL(0.0, 0.0), ALL_STD_EXCEPT, 0, 0); /* cexp(NaN + NaN i) = NaN + NaN i */ - testall(cpackl(NAN, NAN), cpackl(NAN, NAN), + testall(CMPLXL(NAN, NAN), CMPLXL(NAN, NAN), ALL_STD_EXCEPT, 0, 0); } @@ -229,37 +148,37 @@ test_inf(void) /* cexp(x + inf i) = NaN + NaNi and raises invalid */ for (i = 0; i < N(finites); i++) { - testall(cpackl(finites[i], INFINITY), cpackl(NAN, NAN), + testall(CMPLXL(finites[i], INFINITY), CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 1); } /* cexp(-inf + yi) = 0 * (cos(y) + sin(y)i) */ /* XXX shouldn't raise an inexact exception */ - testall(cpackl(-INFINITY, M_PI_4), cpackl(0.0, 0.0), + testall(CMPLXL(-INFINITY, M_PI_4), CMPLXL(0.0, 0.0), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - testall(cpackl(-INFINITY, 3 * M_PI_4), cpackl(-0.0, 0.0), + testall(CMPLXL(-INFINITY, 3 * M_PI_4), CMPLXL(-0.0, 0.0), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - testall(cpackl(-INFINITY, 5 * M_PI_4), cpackl(-0.0, -0.0), + testall(CMPLXL(-INFINITY, 5 * M_PI_4), CMPLXL(-0.0, -0.0), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - testall(cpackl(-INFINITY, 7 * M_PI_4), cpackl(0.0, -0.0), + testall(CMPLXL(-INFINITY, 7 * M_PI_4), CMPLXL(0.0, -0.0), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - testall(cpackl(-INFINITY, 0.0), cpackl(0.0, 0.0), + testall(CMPLXL(-INFINITY, 0.0), CMPLXL(0.0, 0.0), ALL_STD_EXCEPT, 0, 1); - testall(cpackl(-INFINITY, -0.0), cpackl(0.0, -0.0), + testall(CMPLXL(-INFINITY, -0.0), CMPLXL(0.0, -0.0), ALL_STD_EXCEPT, 0, 1); /* cexp(inf + yi) = inf * (cos(y) + sin(y)i) (except y=0) */ /* XXX shouldn't raise an inexact exception */ - testall(cpackl(INFINITY, M_PI_4), cpackl(INFINITY, INFINITY), + testall(CMPLXL(INFINITY, M_PI_4), CMPLXL(INFINITY, INFINITY), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - testall(cpackl(INFINITY, 3 * M_PI_4), cpackl(-INFINITY, INFINITY), + testall(CMPLXL(INFINITY, 3 * M_PI_4), CMPLXL(-INFINITY, INFINITY), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - testall(cpackl(INFINITY, 5 * M_PI_4), cpackl(-INFINITY, -INFINITY), + testall(CMPLXL(INFINITY, 5 * M_PI_4), CMPLXL(-INFINITY, -INFINITY), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - testall(cpackl(INFINITY, 7 * M_PI_4), cpackl(INFINITY, -INFINITY), + testall(CMPLXL(INFINITY, 7 * M_PI_4), CMPLXL(INFINITY, -INFINITY), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); /* cexp(inf + 0i) = inf + 0i */ - testall(cpackl(INFINITY, 0.0), cpackl(INFINITY, 0.0), + testall(CMPLXL(INFINITY, 0.0), CMPLXL(INFINITY, 0.0), ALL_STD_EXCEPT, 0, 1); - testall(cpackl(INFINITY, -0.0), cpackl(INFINITY, -0.0), + testall(CMPLXL(INFINITY, -0.0), CMPLXL(INFINITY, -0.0), ALL_STD_EXCEPT, 0, 1); } @@ -270,17 +189,17 @@ test_reals(void) for (i = 0; i < N(finites); i++) { /* XXX could check exceptions more meticulously */ - test(cexp, cpackl(finites[i], 0.0), - cpackl(exp(finites[i]), 0.0), + test(cexp, CMPLXL(finites[i], 0.0), + CMPLXL(exp(finites[i]), 0.0), FE_INVALID | FE_DIVBYZERO, 0, 1); - test(cexp, cpackl(finites[i], -0.0), - cpackl(exp(finites[i]), -0.0), + test(cexp, CMPLXL(finites[i], -0.0), + CMPLXL(exp(finites[i]), -0.0), FE_INVALID | FE_DIVBYZERO, 0, 1); - test(cexpf, cpackl(finites[i], 0.0), - cpackl(expf(finites[i]), 0.0), + test(cexpf, CMPLXL(finites[i], 0.0), + CMPLXL(expf(finites[i]), 0.0), FE_INVALID | FE_DIVBYZERO, 0, 1); - test(cexpf, cpackl(finites[i], -0.0), - cpackl(expf(finites[i]), -0.0), + test(cexpf, CMPLXL(finites[i], -0.0), + CMPLXL(expf(finites[i]), -0.0), FE_INVALID | FE_DIVBYZERO, 0, 1); } } @@ -291,17 +210,17 @@ test_imaginaries(void) int i; for (i = 0; i < N(finites); i++) { - test(cexp, cpackl(0.0, finites[i]), - cpackl(cos(finites[i]), sin(finites[i])), + test(cexp, CMPLXL(0.0, finites[i]), + CMPLXL(cos(finites[i]), sin(finites[i])), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - test(cexp, cpackl(-0.0, finites[i]), - cpackl(cos(finites[i]), sin(finites[i])), + test(cexp, CMPLXL(-0.0, finites[i]), + CMPLXL(cos(finites[i]), sin(finites[i])), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - test(cexpf, cpackl(0.0, finites[i]), - cpackl(cosf(finites[i]), sinf(finites[i])), + test(cexpf, CMPLXL(0.0, finites[i]), + CMPLXL(cosf(finites[i]), sinf(finites[i])), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - test(cexpf, cpackl(-0.0, finites[i]), - cpackl(cosf(finites[i]), sinf(finites[i])), + test(cexpf, CMPLXL(-0.0, finites[i]), + CMPLXL(cosf(finites[i]), sinf(finites[i])), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); } } @@ -326,12 +245,12 @@ test_small(void) b = tests[i + 1]; x = tests[i + 2]; y = tests[i + 3]; - test_tol(cexp, cpackl(a, b), cpackl(x, y), 3 * DBL_ULP()); + test_tol(cexp, CMPLXL(a, b), CMPLXL(x, y), 3 * DBL_ULP()); /* float doesn't have enough precision to pass these tests */ if (x == 0 || y == 0) continue; - test_tol(cexpf, cpackl(a, b), cpackl(x, y), 1 * FLT_ULP()); + test_tol(cexpf, CMPLXL(a, b), CMPLXL(x, y), 1 * FLT_ULP()); } } @@ -340,27 +259,27 @@ void test_large(void) { - test_tol(cexp, cpackl(709.79, 0x1p-1074), - cpackl(INFINITY, 8.94674309915433533273e-16), DBL_ULP()); - test_tol(cexp, cpackl(1000, 0x1p-1074), - cpackl(INFINITY, 9.73344457300016401328e+110), DBL_ULP()); - test_tol(cexp, cpackl(1400, 0x1p-1074), - cpackl(INFINITY, 5.08228858149196559681e+284), DBL_ULP()); - test_tol(cexp, cpackl(900, 0x1.23456789abcdep-1020), - cpackl(INFINITY, 7.42156649354218408074e+83), DBL_ULP()); - test_tol(cexp, cpackl(1300, 0x1.23456789abcdep-1020), - cpackl(INFINITY, 3.87514844965996756704e+257), DBL_ULP()); - - test_tol(cexpf, cpackl(88.73, 0x1p-149), - cpackl(INFINITY, 4.80265603e-07), 2 * FLT_ULP()); - test_tol(cexpf, cpackl(90, 0x1p-149), - cpackl(INFINITY, 1.7101492622e-06f), 2 * FLT_ULP()); - test_tol(cexpf, cpackl(192, 0x1p-149), - cpackl(INFINITY, 3.396809344e+38f), 2 * FLT_ULP()); - test_tol(cexpf, cpackl(120, 0x1.234568p-120), - cpackl(INFINITY, 1.1163382522e+16f), 2 * FLT_ULP()); - test_tol(cexpf, cpackl(170, 0x1.234568p-120), - cpackl(INFINITY, 5.7878851079e+37f), 2 * FLT_ULP()); + test_tol(cexp, CMPLXL(709.79, 0x1p-1074), + CMPLXL(INFINITY, 8.94674309915433533273e-16), DBL_ULP()); + test_tol(cexp, CMPLXL(1000, 0x1p-1074), + CMPLXL(INFINITY, 9.73344457300016401328e+110), DBL_ULP()); + test_tol(cexp, CMPLXL(1400, 0x1p-1074), + CMPLXL(INFINITY, 5.08228858149196559681e+284), DBL_ULP()); + test_tol(cexp, CMPLXL(900, 0x1.23456789abcdep-1020), + CMPLXL(INFINITY, 7.42156649354218408074e+83), DBL_ULP()); + test_tol(cexp, CMPLXL(1300, 0x1.23456789abcdep-1020), + CMPLXL(INFINITY, 3.87514844965996756704e+257), DBL_ULP()); + + test_tol(cexpf, CMPLXL(88.73, 0x1p-149), + CMPLXL(INFINITY, 4.80265603e-07), 2 * FLT_ULP()); + test_tol(cexpf, CMPLXL(90, 0x1p-149), + CMPLXL(INFINITY, 1.7101492622e-06f), 2 * FLT_ULP()); + test_tol(cexpf, CMPLXL(192, 0x1p-149), + CMPLXL(INFINITY, 3.396809344e+38f), 2 * FLT_ULP()); + test_tol(cexpf, CMPLXL(120, 0x1.234568p-120), + CMPLXL(INFINITY, 1.1163382522e+16f), 2 * FLT_ULP()); + test_tol(cexpf, CMPLXL(170, 0x1.234568p-120), + CMPLXL(INFINITY, 5.7878851079e+37f), 2 * FLT_ULP()); } int Modified: head/tools/regression/lib/msun/test-conj.c ============================================================================== --- head/tools/regression/lib/msun/test-conj.c Sun Jun 2 01:10:49 2013 (r251240) +++ head/tools/regression/lib/msun/test-conj.c Sun Jun 2 04:30:03 2013 (r251241) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "test-utils.h" + #pragma STDC CX_LIMITED_RANGE off /* Make sure gcc doesn't use builtin versions of these or honor __pure2. */ @@ -50,27 +52,6 @@ static float (*libcimagf)(float complex) static double (*libcimag)(double complex) = cimag; static long double (*libcimagl)(long double complex) = cimagl; -/* - * Compare d1 and d2 using special rules: NaN == NaN and +0 != -0. - * Fail an assertion if they differ. - */ -static int -fpequal(long double d1, long double d2) -{ - - if (d1 != d2) - return (isnan(d1) && isnan(d2)); - return (copysignl(1.0, d1) == copysignl(1.0, d2)); -} - -static int -cfpequal(long double complex d1, long double complex d2) -{ - - return (fpequal(creall(d1), creall(d2)) && - fpequal(cimagl(d1), cimagl(d2))); -} - static const double tests[] = { /* a + bI */ 0.0, 0.0, Modified: head/tools/regression/lib/msun/test-csqrt.c ============================================================================== --- head/tools/regression/lib/msun/test-csqrt.c Sun Jun 2 01:10:49 2013 (r251240) +++ head/tools/regression/lib/msun/test-csqrt.c Sun Jun 2 04:30:03 2013 (r251241) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "test-utils.h" + #define N(i) (sizeof(i) / sizeof((i)[0])) /* @@ -63,23 +65,6 @@ _csqrt(long double complex d) #pragma STDC CX_LIMITED_RANGE off /* - * XXX gcc implements complex multiplication incorrectly. In - * particular, it implements it as if the CX_LIMITED_RANGE pragma - * were ON. Consequently, we need this function to form numbers - * such as x + INFINITY * I, since gcc evalutes INFINITY * I as - * NaN + INFINITY * I. - */ -static inline long double complex -cpackl(long double x, long double y) -{ - long double complex z; - - __real__ z = x; - __imag__ z = y; - return (z); -} - -/* * Compare d1 and d2 using special rules: NaN == NaN and +0 != -0. * Fail an assertion if they differ. */ @@ -87,20 +72,7 @@ static void assert_equal(long double complex d1, long double complex d2) { - if (isnan(creall(d1))) { - assert(isnan(creall(d2))); - } else { - assert(creall(d1) == creall(d2)); - assert(copysignl(1.0, creall(d1)) == - copysignl(1.0, creall(d2))); - } - if (isnan(cimagl(d1))) { - assert(isnan(cimagl(d2))); - } else { - assert(cimagl(d1) == cimagl(d2)); - assert(copysignl(1.0, cimagl(d1)) == - copysignl(1.0, cimagl(d2))); - } + assert(cfpequal(d1, d2)); } /* @@ -161,7 +133,7 @@ test_finite() b = tests[i + 1] * mults[j] * mults[j]; x = tests[i + 2] * mults[j]; y = tests[i + 3] * mults[j]; - assert(t_csqrt(cpackl(a, b)) == cpackl(x, y)); + assert(t_csqrt(CMPLXL(a, b)) == CMPLXL(x, y)); } } @@ -174,10 +146,10 @@ static void test_zeros() { - assert_equal(t_csqrt(cpackl(0.0, 0.0)), cpackl(0.0, 0.0)); - assert_equal(t_csqrt(cpackl(-0.0, 0.0)), cpackl(0.0, 0.0)); - assert_equal(t_csqrt(cpackl(0.0, -0.0)), cpackl(0.0, -0.0)); - assert_equal(t_csqrt(cpackl(-0.0, -0.0)), cpackl(0.0, -0.0)); + assert_equal(t_csqrt(CMPLXL(0.0, 0.0)), CMPLXL(0.0, 0.0)); + assert_equal(t_csqrt(CMPLXL(-0.0, 0.0)), CMPLXL(0.0, 0.0)); + assert_equal(t_csqrt(CMPLXL(0.0, -0.0)), CMPLXL(0.0, -0.0)); + assert_equal(t_csqrt(CMPLXL(-0.0, -0.0)), CMPLXL(0.0, -0.0)); } /* @@ -199,15 +171,15 @@ test_infinities() for (i = 0; i < N(vals); i++) { if (isfinite(vals[i])) { - assert_equal(t_csqrt(cpackl(-INFINITY, vals[i])), - cpackl(0.0, copysignl(INFINITY, vals[i]))); - assert_equal(t_csqrt(cpackl(INFINITY, vals[i])), - cpackl(INFINITY, copysignl(0.0, vals[i]))); + assert_equal(t_csqrt(CMPLXL(-INFINITY, vals[i])), + CMPLXL(0.0, copysignl(INFINITY, vals[i]))); + assert_equal(t_csqrt(CMPLXL(INFINITY, vals[i])), + CMPLXL(INFINITY, copysignl(0.0, vals[i]))); } - assert_equal(t_csqrt(cpackl(vals[i], INFINITY)), - cpackl(INFINITY, INFINITY)); - assert_equal(t_csqrt(cpackl(vals[i], -INFINITY)), - cpackl(INFINITY, -INFINITY)); + assert_equal(t_csqrt(CMPLXL(vals[i], INFINITY)), + CMPLXL(INFINITY, INFINITY)); + assert_equal(t_csqrt(CMPLXL(vals[i], -INFINITY)), + CMPLXL(INFINITY, -INFINITY)); } } @@ -218,26 +190,26 @@ static void test_nans() { - assert(creall(t_csqrt(cpackl(INFINITY, NAN))) == INFINITY); - assert(isnan(cimagl(t_csqrt(cpackl(INFINITY, NAN))))); + assert(creall(t_csqrt(CMPLXL(INFINITY, NAN))) == INFINITY); + assert(isnan(cimagl(t_csqrt(CMPLXL(INFINITY, NAN))))); - assert(isnan(creall(t_csqrt(cpackl(-INFINITY, NAN))))); - assert(isinf(cimagl(t_csqrt(cpackl(-INFINITY, NAN))))); + assert(isnan(creall(t_csqrt(CMPLXL(-INFINITY, NAN))))); + assert(isinf(cimagl(t_csqrt(CMPLXL(-INFINITY, NAN))))); - assert_equal(t_csqrt(cpackl(NAN, INFINITY)), - cpackl(INFINITY, INFINITY)); - assert_equal(t_csqrt(cpackl(NAN, -INFINITY)), - cpackl(INFINITY, -INFINITY)); - - assert_equal(t_csqrt(cpackl(0.0, NAN)), cpackl(NAN, NAN)); - assert_equal(t_csqrt(cpackl(-0.0, NAN)), cpackl(NAN, NAN)); - assert_equal(t_csqrt(cpackl(42.0, NAN)), cpackl(NAN, NAN)); - assert_equal(t_csqrt(cpackl(-42.0, NAN)), cpackl(NAN, NAN)); - assert_equal(t_csqrt(cpackl(NAN, 0.0)), cpackl(NAN, NAN)); - assert_equal(t_csqrt(cpackl(NAN, -0.0)), cpackl(NAN, NAN)); - assert_equal(t_csqrt(cpackl(NAN, 42.0)), cpackl(NAN, NAN)); - assert_equal(t_csqrt(cpackl(NAN, -42.0)), cpackl(NAN, NAN)); - assert_equal(t_csqrt(cpackl(NAN, NAN)), cpackl(NAN, NAN)); + assert_equal(t_csqrt(CMPLXL(NAN, INFINITY)), + CMPLXL(INFINITY, INFINITY)); + assert_equal(t_csqrt(CMPLXL(NAN, -INFINITY)), + CMPLXL(INFINITY, -INFINITY)); + + assert_equal(t_csqrt(CMPLXL(0.0, NAN)), CMPLXL(NAN, NAN)); + assert_equal(t_csqrt(CMPLXL(-0.0, NAN)), CMPLXL(NAN, NAN)); + assert_equal(t_csqrt(CMPLXL(42.0, NAN)), CMPLXL(NAN, NAN)); + assert_equal(t_csqrt(CMPLXL(-42.0, NAN)), CMPLXL(NAN, NAN)); + assert_equal(t_csqrt(CMPLXL(NAN, 0.0)), CMPLXL(NAN, NAN)); + assert_equal(t_csqrt(CMPLXL(NAN, -0.0)), CMPLXL(NAN, NAN)); + assert_equal(t_csqrt(CMPLXL(NAN, 42.0)), CMPLXL(NAN, NAN)); + assert_equal(t_csqrt(CMPLXL(NAN, -42.0)), CMPLXL(NAN, NAN)); + assert_equal(t_csqrt(CMPLXL(NAN, NAN)), CMPLXL(NAN, NAN)); } /* @@ -254,7 +226,7 @@ test_overflow(int maxexp) a = ldexpl(115 * 0x1p-8, maxexp); b = ldexpl(252 * 0x1p-8, maxexp); - result = t_csqrt(cpackl(a, b)); + result = t_csqrt(CMPLXL(a, b)); assert(creall(result) == ldexpl(14 * 0x1p-4, maxexp / 2)); assert(cimagl(result) == ldexpl(9 * 0x1p-4, maxexp / 2)); } Modified: head/tools/regression/lib/msun/test-ctrig.c ============================================================================== --- head/tools/regression/lib/msun/test-ctrig.c Sun Jun 2 01:10:49 2013 (r251240) +++ head/tools/regression/lib/msun/test-ctrig.c Sun Jun 2 04:30:03 2013 (r251241) @@ -38,46 +38,12 @@ __FBSDID("$FreeBSD$"); #include #include -#define ALL_STD_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \ - FE_OVERFLOW | FE_UNDERFLOW) -#define OPT_INVALID (ALL_STD_EXCEPT & ~FE_INVALID) -#define OPT_INEXACT (ALL_STD_EXCEPT & ~FE_INEXACT) -#define FLT_ULP() ldexpl(1.0, 1 - FLT_MANT_DIG) -#define DBL_ULP() ldexpl(1.0, 1 - DBL_MANT_DIG) -#define LDBL_ULP() ldexpl(1.0, 1 - LDBL_MANT_DIG) +#include "test-utils.h" #pragma STDC FENV_ACCESS ON #pragma STDC CX_LIMITED_RANGE OFF /* - * XXX gcc implements complex multiplication incorrectly. In - * particular, it implements it as if the CX_LIMITED_RANGE pragma - * were ON. Consequently, we need this function to form numbers - * such as x + INFINITY * I, since gcc evalutes INFINITY * I as - * NaN + INFINITY * I. - */ -static inline long double complex -cpackl(long double x, long double y) -{ - long double complex z; - - __real__ z = x; - __imag__ z = y; - return (z); -} - -/* Flags that determine whether to check the signs of the result. */ -#define CS_REAL 1 -#define CS_IMAG 2 -#define CS_BOTH (CS_REAL | CS_IMAG) - -#ifdef DEBUG -#define debug(...) printf(__VA_ARGS__) -#else -#define debug(...) (void)0 -#endif - -/* * Test that a function returns the correct value and sets the * exception flags correctly. The exceptmask specifies which * exceptions we should check. We need to be lenient for several @@ -95,8 +61,8 @@ cpackl(long double x, long double y) debug(" testing %s(%Lg + %Lg I) == %Lg + %Lg I\n", #func, \ creall(_d), cimagl(_d), creall(result), cimagl(result)); \ assert(feclearexcept(FE_ALL_EXCEPT) == 0); \ - assert(cfpequal((func)(_d), (result), (checksign))); \ - assert(((func), fetestexcept(exceptmask) == (excepts))); \ + assert(cfpequal_cs((func)(_d), (result), (checksign))); \ + assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \ } while (0) /* @@ -108,7 +74,7 @@ cpackl(long double x, long double y) volatile long double complex _d = z; \ debug(" testing %s(%Lg + %Lg I) ~= %Lg + %Lg I\n", #func, \ creall(_d), cimagl(_d), creall(result), cimagl(result)); \ - assert(cfpequal_tol((func)(_d), (result), (tol))); \ + assert(cfpequal_tol((func)(_d), (result), (tol), FPE_ABS_ZERO)); \ } while (0) /* These wrappers apply the identities f(conj(z)) = conj(f(z)). */ @@ -152,79 +118,18 @@ cpackl(long double x, long double y) test_tol(func, -x, result, tol * DBL_ULP()); \ } while (0) -/* - * Determine whether x and y are equal, with two special rules: - * +0.0 != -0.0 - * NaN == NaN - * If checksign is 0, we compare the absolute values instead. - */ -static int -fpequal(long double x, long double y, int checksign) -{ - if (isnan(x) && isnan(y)) - return (1); - if (checksign) - return (x == y && !signbit(x) == !signbit(y)); - else - return (fabsl(x) == fabsl(y)); -} - -static int -fpequal_tol(long double x, long double y, long double tol) -{ - fenv_t env; - int ret; - - if (isnan(x) && isnan(y)) - return (1); - if (!signbit(x) != !signbit(y) && tol == 0) - return (0); - if (x == y) - return (1); - if (tol == 0) - return (0); - - /* Hard case: need to check the tolerance. */ - feholdexcept(&env); - /* - * For our purposes here, if y=0, we interpret tol as an absolute - * tolerance. This is to account for roundoff in the input, e.g., - * cos(Pi/2) ~= 0. - */ - if (y == 0.0) - ret = fabsl(x - y) <= fabsl(tol); - else - ret = fabsl(x - y) <= fabsl(y * tol); - fesetenv(&env); - return (ret); -} - -static int -cfpequal(long double complex x, long double complex y, int checksign) -{ - return (fpequal(creal(x), creal(y), checksign & CS_REAL) - && fpequal(cimag(x), cimag(y), checksign & CS_IMAG)); -} - -static int -cfpequal_tol(long double complex x, long double complex y, long double tol) -{ - return (fpequal_tol(creal(x), creal(y), tol) - && fpequal_tol(cimag(x), cimag(y), tol)); -} - /* Tests for 0 */ void test_zero(void) { - long double complex zero = cpackl(0.0, 0.0); + long double complex zero = CMPLXL(0.0, 0.0); /* csinh(0) = ctanh(0) = 0; ccosh(0) = 1 (no exceptions raised) */ testall_odd(csinh, zero, zero, ALL_STD_EXCEPT, 0, CS_BOTH); testall_odd(csin, zero, zero, ALL_STD_EXCEPT, 0, CS_BOTH); testall_even(ccosh, zero, 1.0, ALL_STD_EXCEPT, 0, CS_BOTH); - testall_even(ccos, zero, cpackl(1.0, -0.0), ALL_STD_EXCEPT, 0, CS_BOTH); + testall_even(ccos, zero, CMPLXL(1.0, -0.0), ALL_STD_EXCEPT, 0, CS_BOTH); testall_odd(ctanh, zero, zero, ALL_STD_EXCEPT, 0, CS_BOTH); testall_odd(ctan, zero, zero, ALL_STD_EXCEPT, 0, CS_BOTH); } @@ -235,7 +140,7 @@ test_zero(void) void test_nan() { - long double complex nan_nan = cpackl(NAN, NAN); + long double complex nan_nan = CMPLXL(NAN, NAN); long double complex z; /* @@ -256,7 +161,7 @@ test_nan() testall_even(ccos, z, nan_nan, ALL_STD_EXCEPT, 0, 0); testall_odd(ctan, z, nan_nan, ALL_STD_EXCEPT, 0, 0); - z = cpackl(42, NAN); + z = CMPLXL(42, NAN); testall_odd(csinh, z, nan_nan, OPT_INVALID, 0, 0); testall_even(ccosh, z, nan_nan, OPT_INVALID, 0, 0); /* XXX We allow a spurious inexact exception here. */ @@ -265,7 +170,7 @@ test_nan() testall_even(ccos, z, nan_nan, OPT_INVALID, 0, 0); testall_odd(ctan, z, nan_nan, OPT_INVALID, 0, 0); - z = cpackl(NAN, 42); + z = CMPLXL(NAN, 42); testall_odd(csinh, z, nan_nan, OPT_INVALID, 0, 0); testall_even(ccosh, z, nan_nan, OPT_INVALID, 0, 0); testall_odd(ctanh, z, nan_nan, OPT_INVALID, 0, 0); @@ -274,38 +179,38 @@ test_nan() /* XXX We allow a spurious inexact exception here. */ testall_odd(ctan, z, nan_nan, OPT_INVALID & ~FE_INEXACT, 0, 0); - z = cpackl(NAN, INFINITY); + z = CMPLXL(NAN, INFINITY); testall_odd(csinh, z, nan_nan, OPT_INVALID, 0, 0); testall_even(ccosh, z, nan_nan, OPT_INVALID, 0, 0); testall_odd(ctanh, z, nan_nan, OPT_INVALID, 0, 0); - testall_odd(csin, z, cpackl(NAN, INFINITY), ALL_STD_EXCEPT, 0, 0); - testall_even(ccos, z, cpackl(INFINITY, NAN), ALL_STD_EXCEPT, 0, + testall_odd(csin, z, CMPLXL(NAN, INFINITY), ALL_STD_EXCEPT, 0, 0); + testall_even(ccos, z, CMPLXL(INFINITY, NAN), ALL_STD_EXCEPT, 0, CS_IMAG); - testall_odd(ctan, z, cpackl(0, 1), ALL_STD_EXCEPT, 0, CS_IMAG); + testall_odd(ctan, z, CMPLXL(0, 1), ALL_STD_EXCEPT, 0, CS_IMAG); - z = cpackl(INFINITY, NAN); - testall_odd(csinh, z, cpackl(INFINITY, NAN), ALL_STD_EXCEPT, 0, 0); - testall_even(ccosh, z, cpackl(INFINITY, NAN), ALL_STD_EXCEPT, 0, + z = CMPLXL(INFINITY, NAN); + testall_odd(csinh, z, CMPLXL(INFINITY, NAN), ALL_STD_EXCEPT, 0, 0); + testall_even(ccosh, z, CMPLXL(INFINITY, NAN), ALL_STD_EXCEPT, 0, CS_REAL); - testall_odd(ctanh, z, cpackl(1, 0), ALL_STD_EXCEPT, 0, CS_REAL); + testall_odd(ctanh, z, CMPLXL(1, 0), ALL_STD_EXCEPT, 0, CS_REAL); testall_odd(csin, z, nan_nan, OPT_INVALID, 0, 0); testall_even(ccos, z, nan_nan, OPT_INVALID, 0, 0); testall_odd(ctan, z, nan_nan, OPT_INVALID, 0, 0); - z = cpackl(0, NAN); - testall_odd(csinh, z, cpackl(0, NAN), ALL_STD_EXCEPT, 0, 0); - testall_even(ccosh, z, cpackl(NAN, 0), ALL_STD_EXCEPT, 0, 0); + z = CMPLXL(0, NAN); + testall_odd(csinh, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, 0); + testall_even(ccosh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); testall_odd(ctanh, z, nan_nan, OPT_INVALID, 0, 0); - testall_odd(csin, z, cpackl(0, NAN), ALL_STD_EXCEPT, 0, CS_REAL); - testall_even(ccos, z, cpackl(NAN, 0), ALL_STD_EXCEPT, 0, 0); - testall_odd(ctan, z, cpackl(0, NAN), ALL_STD_EXCEPT, 0, CS_REAL); - - z = cpackl(NAN, 0); - testall_odd(csinh, z, cpackl(NAN, 0), ALL_STD_EXCEPT, 0, CS_IMAG); - testall_even(ccosh, z, cpackl(NAN, 0), ALL_STD_EXCEPT, 0, 0); - testall_odd(ctanh, z, cpackl(NAN, 0), ALL_STD_EXCEPT, 0, CS_IMAG); - testall_odd(csin, z, cpackl(NAN, 0), ALL_STD_EXCEPT, 0, 0); - testall_even(ccos, z, cpackl(NAN, 0), ALL_STD_EXCEPT, 0, 0); + testall_odd(csin, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, CS_REAL); + testall_even(ccos, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); + testall_odd(ctan, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, CS_REAL); + + z = CMPLXL(NAN, 0); + testall_odd(csinh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, CS_IMAG); + testall_even(ccosh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); + testall_odd(ctanh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, CS_IMAG); + testall_odd(csin, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); + testall_even(ccos, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); testall_odd(ctan, z, nan_nan, OPT_INVALID, 0, 0); } @@ -325,53 +230,53 @@ test_inf(void) * 0,Inf +-0,NaN inval NaN,+-0 inval NaN,NaN inval * finite,Inf NaN,NaN inval NaN,NaN inval NaN,NaN inval */ - z = cpackl(INFINITY, INFINITY); - testall_odd(csinh, z, cpackl(INFINITY, NAN), + z = CMPLXL(INFINITY, INFINITY); + testall_odd(csinh, z, CMPLXL(INFINITY, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_even(ccosh, z, cpackl(INFINITY, NAN), + testall_even(ccosh, z, CMPLXL(INFINITY, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_odd(ctanh, z, cpackl(1, 0), ALL_STD_EXCEPT, 0, CS_REAL); - testall_odd(csin, z, cpackl(NAN, INFINITY), + testall_odd(ctanh, z, CMPLXL(1, 0), ALL_STD_EXCEPT, 0, CS_REAL); + testall_odd(csin, z, CMPLXL(NAN, INFINITY), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_even(ccos, z, cpackl(INFINITY, NAN), + testall_even(ccos, z, CMPLXL(INFINITY, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_odd(ctan, z, cpackl(0, 1), ALL_STD_EXCEPT, 0, CS_REAL); + testall_odd(ctan, z, CMPLXL(0, 1), ALL_STD_EXCEPT, 0, CS_REAL); /* XXX We allow spurious inexact exceptions here (hard to avoid). */ for (i = 0; i < sizeof(finites) / sizeof(finites[0]); i++) { - z = cpackl(INFINITY, finites[i]); + z = CMPLXL(INFINITY, finites[i]); c = INFINITY * cosl(finites[i]); s = finites[i] == 0 ? finites[i] : INFINITY * sinl(finites[i]); - testall_odd(csinh, z, cpackl(c, s), OPT_INEXACT, 0, CS_BOTH); - testall_even(ccosh, z, cpackl(c, s), OPT_INEXACT, 0, CS_BOTH); - testall_odd(ctanh, z, cpackl(1, 0 * sin(finites[i] * 2)), + testall_odd(csinh, z, CMPLXL(c, s), OPT_INEXACT, 0, CS_BOTH); + testall_even(ccosh, z, CMPLXL(c, s), OPT_INEXACT, 0, CS_BOTH); + testall_odd(ctanh, z, CMPLXL(1, 0 * sin(finites[i] * 2)), OPT_INEXACT, 0, CS_BOTH); - z = cpackl(finites[i], INFINITY); - testall_odd(csin, z, cpackl(s, c), OPT_INEXACT, 0, CS_BOTH); - testall_even(ccos, z, cpackl(c, -s), OPT_INEXACT, 0, CS_BOTH); - testall_odd(ctan, z, cpackl(0 * sin(finites[i] * 2), 1), + z = CMPLXL(finites[i], INFINITY); + testall_odd(csin, z, CMPLXL(s, c), OPT_INEXACT, 0, CS_BOTH); + testall_even(ccos, z, CMPLXL(c, -s), OPT_INEXACT, 0, CS_BOTH); + testall_odd(ctan, z, CMPLXL(0 * sin(finites[i] * 2), 1), OPT_INEXACT, 0, CS_BOTH); } - z = cpackl(0, INFINITY); - testall_odd(csinh, z, cpackl(0, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_even(ccosh, z, cpackl(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_odd(ctanh, z, cpackl(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); - z = cpackl(INFINITY, 0); - testall_odd(csin, z, cpackl(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_even(ccos, z, cpackl(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_odd(ctan, z, cpackl(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); - - z = cpackl(42, INFINITY); - testall_odd(csinh, z, cpackl(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_even(ccosh, z, cpackl(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + z = CMPLXL(0, INFINITY); + testall_odd(csinh, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_even(ccosh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_odd(ctanh, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + z = CMPLXL(INFINITY, 0); + testall_odd(csin, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_even(ccos, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_odd(ctan, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + + z = CMPLXL(42, INFINITY); + testall_odd(csinh, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_even(ccosh, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); /* XXX We allow a spurious inexact exception here. */ - testall_odd(ctanh, z, cpackl(NAN, NAN), OPT_INEXACT, FE_INVALID, 0); - z = cpackl(INFINITY, 42); - testall_odd(csin, z, cpackl(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_even(ccos, z, cpackl(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_odd(ctanh, z, CMPLXL(NAN, NAN), OPT_INEXACT, FE_INVALID, 0); + z = CMPLXL(INFINITY, 42); + testall_odd(csin, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_even(ccos, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); /* XXX We allow a spurious inexact exception here. */ - testall_odd(ctan, z, cpackl(NAN, NAN), OPT_INEXACT, FE_INVALID, 0); + testall_odd(ctan, z, CMPLXL(NAN, NAN), OPT_INEXACT, FE_INVALID, 0); } /* Tests along the real and imaginary axes. */ @@ -387,26 +292,26 @@ test_axes(void) for (i = 0; i < sizeof(nums) / sizeof(nums[0]); i++) { /* Real axis */ - z = cpackl(nums[i], 0.0); - testall_odd_tol(csinh, z, cpackl(sinh(nums[i]), 0), 0); - testall_even_tol(ccosh, z, cpackl(cosh(nums[i]), 0), 0); - testall_odd_tol(ctanh, z, cpackl(tanh(nums[i]), 0), 1); - testall_odd_tol(csin, z, cpackl(sin(nums[i]), + z = CMPLXL(nums[i], 0.0); + testall_odd_tol(csinh, z, CMPLXL(sinh(nums[i]), 0), 0); + testall_even_tol(ccosh, z, CMPLXL(cosh(nums[i]), 0), 0); + testall_odd_tol(ctanh, z, CMPLXL(tanh(nums[i]), 0), 1); + testall_odd_tol(csin, z, CMPLXL(sin(nums[i]), copysign(0, cos(nums[i]))), 0); - testall_even_tol(ccos, z, cpackl(cos(nums[i]), + testall_even_tol(ccos, z, CMPLXL(cos(nums[i]), -copysign(0, sin(nums[i]))), 0); - testall_odd_tol(ctan, z, cpackl(tan(nums[i]), 0), 1); + testall_odd_tol(ctan, z, CMPLXL(tan(nums[i]), 0), 1); /* Imaginary axis */ - z = cpackl(0.0, nums[i]); - testall_odd_tol(csinh, z, cpackl(copysign(0, cos(nums[i])), + z = CMPLXL(0.0, nums[i]); + testall_odd_tol(csinh, z, CMPLXL(copysign(0, cos(nums[i])), sin(nums[i])), 0); - testall_even_tol(ccosh, z, cpackl(cos(nums[i]), + testall_even_tol(ccosh, z, CMPLXL(cos(nums[i]), copysign(0, sin(nums[i]))), 0); - testall_odd_tol(ctanh, z, cpackl(0, tan(nums[i])), 1); - testall_odd_tol(csin, z, cpackl(0, sinh(nums[i])), 0); - testall_even_tol(ccos, z, cpackl(cosh(nums[i]), -0.0), 0); - testall_odd_tol(ctan, z, cpackl(0, tanh(nums[i])), 1); + testall_odd_tol(ctanh, z, CMPLXL(0, tan(nums[i])), 1); + testall_odd_tol(csin, z, CMPLXL(0, sinh(nums[i])), 0); + testall_even_tol(ccos, z, CMPLXL(cosh(nums[i]), -0.0), 0); + testall_odd_tol(ctan, z, CMPLXL(0, tanh(nums[i])), 1); } } @@ -462,13 +367,13 @@ test_small(void) int i; for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { - z = cpackl(tests[i].a, tests[i].b); + z = CMPLXL(tests[i].a, tests[i].b); testall_odd_tol(csinh, z, - cpackl(tests[i].sinh_a, tests[i].sinh_b), 1.1); + CMPLXL(tests[i].sinh_a, tests[i].sinh_b), 1.1); testall_even_tol(ccosh, z, - cpackl(tests[i].cosh_a, tests[i].cosh_b), 1.1); + CMPLXL(tests[i].cosh_a, tests[i].cosh_b), 1.1); testall_odd_tol(ctanh, z, - cpackl(tests[i].tanh_a, tests[i].tanh_b), 1.1); + CMPLXL(tests[i].tanh_a, tests[i].tanh_b), 1.1); } } @@ -479,36 +384,36 @@ test_large(void) long double complex z; /* tanh() uses a threshold around x=22, so check both sides. */ - z = cpackl(21, 0.78539816339744830961566084581987572L); + z = CMPLXL(21, 0.78539816339744830961566084581987572L); testall_odd_tol(ctanh, z, - cpackl(1.0, 1.14990445285871196133287617611468468e-18L), 1); + CMPLXL(1.0, 1.14990445285871196133287617611468468e-18L), 1); z++; testall_odd_tol(ctanh, z, - cpackl(1.0, 1.55622644822675930314266334585597964e-19L), 1); + CMPLXL(1.0, 1.55622644822675930314266334585597964e-19L), 1); - z = cpackl(355, 0.78539816339744830961566084581987572L); + z = CMPLXL(355, 0.78539816339744830961566084581987572L); testall_odd_tol(ctanh, z, - cpackl(1.0, 8.95257245135025991216632140458264468e-309L), 1); - z = cpackl(30, 0x1p1023L); + CMPLXL(1.0, 8.95257245135025991216632140458264468e-309L), 1); + z = CMPLXL(30, 0x1p1023L); testall_odd_tol(ctanh, z, - cpackl(1.0, -1.62994325413993477997492170229268382e-26L), 1); - z = cpackl(1, 0x1p1023L); + CMPLXL(1.0, -1.62994325413993477997492170229268382e-26L), 1); + z = CMPLXL(1, 0x1p1023L); testall_odd_tol(ctanh, z, - cpackl(0.878606311888306869546254022621986509L, + CMPLXL(0.878606311888306869546254022621986509L, -0.225462792499754505792678258169527424L), 1); - z = cpackl(710.6, 0.78539816339744830961566084581987572L); + z = CMPLXL(710.6, 0.78539816339744830961566084581987572L); testall_odd_tol(csinh, z, - cpackl(1.43917579766621073533185387499658944e308L, + CMPLXL(1.43917579766621073533185387499658944e308L, 1.43917579766621073533185387499658944e308L), 1); testall_even_tol(ccosh, z, - cpackl(1.43917579766621073533185387499658944e308L, + CMPLXL(1.43917579766621073533185387499658944e308L, 1.43917579766621073533185387499658944e308L), 1); - z = cpackl(1500, 0.78539816339744830961566084581987572L); - testall_odd(csinh, z, cpackl(INFINITY, INFINITY), OPT_INEXACT, + z = CMPLXL(1500, 0.78539816339744830961566084581987572L); + testall_odd(csinh, z, CMPLXL(INFINITY, INFINITY), OPT_INEXACT, FE_OVERFLOW, CS_BOTH); - testall_even(ccosh, z, cpackl(INFINITY, INFINITY), OPT_INEXACT, + testall_even(ccosh, z, CMPLXL(INFINITY, INFINITY), OPT_INEXACT, FE_OVERFLOW, CS_BOTH); } Modified: head/tools/regression/lib/msun/test-exponential.c ============================================================================== --- head/tools/regression/lib/msun/test-exponential.c Sun Jun 2 01:10:49 2013 (r251240) +++ head/tools/regression/lib/msun/test-exponential.c Sun Jun 2 04:30:03 2013 (r251241) @@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$"); #include #endif -#define ALL_STD_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \ - FE_OVERFLOW | FE_UNDERFLOW) +#include "test-utils.h" #pragma STDC FENV_ACCESS ON @@ -63,7 +62,7 @@ __FBSDID("$FreeBSD$"); volatile long double _d = x; \ assert(feclearexcept(FE_ALL_EXCEPT) == 0); \ assert(fpequal((func)(_d), (result))); \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 05:45:30 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 127F1A46; Sun, 2 Jun 2013 05:45:30 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E8C1C1894; Sun, 2 Jun 2013 05:45:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r525jTHW023558; Sun, 2 Jun 2013 05:45:29 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r525jQDf023531; Sun, 2 Jun 2013 05:45:26 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306020545.r525jQDf023531@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 05:45:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251242 - in head/usr.sbin/bsdconfig: console mouse networking/share password/share share share/media startup startup/share usermgmt/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 05:45:30 -0000 Author: dteske Date: Sun Jun 2 05:45:25 2013 New Revision: 251242 URL: http://svnweb.freebsd.org/changeset/base/251242 Log: Similar to r251236, improve the portion of dialog(1) API in dialog.subr responsible for retrieving stored input (for the --inputbox and --password widgets). When we (Ron McDowell and I) developed the first version of bsdconfig, it used temporary files to store responses from dialog(1). That hasn't been true for a very long time, so the need to always execute some clean-up function is long-deprecated. The function that used to perform these clean- up routines for these widgets was f_dialog_inputstr(). We really don't need f_dialog_inputstr() for its originally designed purpose as all dialog invocations no longer require temporary files. Just as in r251236, redesign f_dialog_inputstr() in the following four ways: 1. Rename f_dialog_inputstr() to f_dialog_inputstr_fetch() 2. Introduce the new first-argument of $var_to_set to reduce forking 3. Create a corresponding f_dialog_inputstr_store() to abstract storage 4. Offload the sanitization to a new function, f_dialog_line_sanitize() It should be noted that f_dialog_line_sanitize() -- unlike its cousin from SVN r251236, f_dialog_data_sanitize() -- trims leading/trailing whitespace from the user's input. This helps prevent errors and common mistakes caused by the fact that the new cdialog implementation allows the right-arrow cursor key to go beyond the last byte of realtime input (adding whitespace at the end of the typed value). While we're centralizing the sanitization, let's rewrite f_dialog_input() while we're here to likewise reduce forking. The f_dialog_input() function now expects the first argument of $var_to_set instead of producing results on standard-out. These changes greatly improve readability and also improve performance. Modified: head/usr.sbin/bsdconfig/console/saver head/usr.sbin/bsdconfig/mouse/flags head/usr.sbin/bsdconfig/networking/share/hostname.subr head/usr.sbin/bsdconfig/networking/share/ipaddr.subr head/usr.sbin/bsdconfig/networking/share/media.subr head/usr.sbin/bsdconfig/networking/share/netmask.subr head/usr.sbin/bsdconfig/networking/share/resolv.subr head/usr.sbin/bsdconfig/networking/share/routing.subr head/usr.sbin/bsdconfig/password/share/password.subr head/usr.sbin/bsdconfig/share/dialog.subr head/usr.sbin/bsdconfig/share/media/tcpip.subr head/usr.sbin/bsdconfig/share/mustberoot.subr head/usr.sbin/bsdconfig/share/variable.subr head/usr.sbin/bsdconfig/startup/misc head/usr.sbin/bsdconfig/startup/share/rcconf.subr head/usr.sbin/bsdconfig/startup/share/rcedit.subr head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Modified: head/usr.sbin/bsdconfig/console/saver ============================================================================== --- head/usr.sbin/bsdconfig/console/saver Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/console/saver Sun Jun 2 05:45:25 2013 (r251242) @@ -183,9 +183,9 @@ while :; do break ;; "$msg_timeout") # Set the screen saver timeout interval f_dialog_title "$msg_value_required" - blanktime=$( f_dialog_input "$msg_enter_timeout_period" \ - "$( f_sysrc_get blanktime )" - ) && f_sysrc_set blanktime "$blanktime" + f_dialog_input blanktime "$msg_enter_timeout_period" \ + "$( f_sysrc_get blanktime )" && + f_sysrc_set blanktime "$blanktime" f_dialog_title_restore ;; esac Modified: head/usr.sbin/bsdconfig/mouse/flags ============================================================================== --- head/usr.sbin/bsdconfig/mouse/flags Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/mouse/flags Sun Jun 2 05:45:25 2013 (r251242) @@ -79,9 +79,8 @@ flags=$( f_sysrc_get moused_flags ) # Prompt the user with the current value # f_dialog_title "$msg_value_required" -flags=$( f_dialog_input "$msg_please_specify_the_mouse_daemon_flags" \ - "$flags" - ) || f_die +f_dialog_input flags "$msg_please_specify_the_mouse_daemon_flags" \ + "$flags" || f_die f_dialog_title_restore # Modified: head/usr.sbin/bsdconfig/networking/share/hostname.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/hostname.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/networking/share/hostname.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -108,9 +108,8 @@ f_dialog_input_hostname() # Loop until the user provides taint-free input. # while :; do - hostname=$( f_dialog_input "$msg" "$hostname" \ - "$hline_alnum_punc_tab_enter" - ) || return + f_dialog_input hostname "$msg" "$hostname" \ + "$hline_alnum_punc_tab_enter" || return # Taint-check the user's input f_dialog_validate_hostname "$hostname" && break done Modified: head/usr.sbin/bsdconfig/networking/share/ipaddr.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -162,9 +162,8 @@ f_dialog_input_ipaddr() # - User has either pressed ESC or chosen Cancel/No # - User has not made any changes to the given value # - _input=$( f_dialog_input "$msg" "$_ipaddr" \ - "$hline_num_punc_tab_enter" - ) || return + f_dialog_input _input "$msg" "$_ipaddr" \ + "$hline_num_punc_tab_enter" || return [ "$_ipaddr" = "$_input" ] && return $FAILURE # Return success if NULL value was entered Modified: head/usr.sbin/bsdconfig/networking/share/media.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/media.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/networking/share/media.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -122,8 +122,8 @@ f_dialog_input_options() local msg="$( printf "$msg_please_enter_mediaopts" "$interface" )" local hline="$hline_alnum_punc_tab_enter" - local dialog_inputbox - dialog_inputbox=$( $DIALOG \ + local _options + _options=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --hline "$hline" \ @@ -133,10 +133,8 @@ f_dialog_input_options() "$options" \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) - local retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - local _options="$( f_dialog_inputstr )" + f_dialog_line_sanitize _options [ $retval -eq $SUCCESS ] && options="$_options" Modified: head/usr.sbin/bsdconfig/networking/share/netmask.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/netmask.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/networking/share/netmask.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -110,9 +110,8 @@ f_dialog_input_netmask() # - User has either pressed ESC or chosen Cancel/No # - User has not made any changes to the given value # - _input=$( f_dialog_input "$msg" "$_netmask" \ - "$hline_num_punc_tab_enter" - ) || return + f_dialog_input _input "$msg" "$_netmask" \ + "$hline_num_punc_tab_enter" || return [ "$_netmask" = "$_input" ] && return $FAILURE # Return success if NULL value was entered Modified: head/usr.sbin/bsdconfig/networking/share/resolv.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/resolv.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/networking/share/resolv.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -311,9 +311,8 @@ f_dialog_input_nameserver() # Loop until the user provides taint-free input. # while :; do - new_ns=$( f_dialog_input "$msg" "$ns" \ - "$hline_num_punc_tab_enter" - ) || return + f_dialog_input new_ns "$msg" "$ns" \ + "$hline_num_punc_tab_enter" || return # Take only the first "word" of the user's input new_ns="${new_ns%%[$IFS]*}" Modified: head/usr.sbin/bsdconfig/networking/share/routing.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/routing.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/networking/share/routing.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -83,10 +83,9 @@ f_dialog_input_defaultrouter() # local retval while :; do - defaultrouter=$( f_dialog_input \ - "$msg_please_enter_default_router" \ - "$defaultrouter" "$hline_num_punc_tab_enter" - ) + f_dialog_input defaultrouter \ + "$msg_please_enter_default_router" \ + "$defaultrouter" "$hline_num_punc_tab_enter" retval=$? [ "$defaultrouter" ] || return $SUCCESS [ $retval -eq $SUCCESS ] || return $retval Modified: head/usr.sbin/bsdconfig/password/share/password.subr ============================================================================== --- head/usr.sbin/bsdconfig/password/share/password.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/password/share/password.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -69,10 +69,9 @@ f_dialog_input_password() # # Loop until the user provides taint-free/valid input # - local retval _password1 _password2 + local _password1 _password2 while :; do - local dialog_inputbox - dialog_inputbox=$( $DIALOG \ + _password1=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --hline "$hline" \ @@ -82,16 +81,11 @@ f_dialog_input_password() --passwordbox "$msg" \ $height1 $width1 \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) + ) || return $? + # Return if user either pressed ESC or chose Cancel/No + debug= f_dialog_line_sanitize _password1 - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _password1=$( f_dialog_inputstr ) - - # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval - - dialog_inputbox=$( $DIALOG \ + _password2=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --hline "$hline" \ @@ -101,14 +95,9 @@ f_dialog_input_password() --passwordbox "$rmsg" \ $height2 $width2 \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _password2=$( f_dialog_inputstr ) - - # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + ) || return $? + # Return if user either pressed ESC or chose Cancel/No + debug= f_dialog_line_sanitize _password2 # Check for NULL entry if ! [ "$_password1" -o "$_password2" ]; then Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/share/dialog.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -144,6 +144,48 @@ f_dialog_data_sanitize() done } +# f_dialog_line_sanitize $var_to_edit ... +# +# When using dialog(1) or Xdialog(1) sometimes unintended warnings or errors +# are generated from underlying libraries. For example, if $LANG is set to an +# invalid or unknown locale, the warnings from the Xdialog(1) libraries will +# clutter the output. This function helps by providing a centralied function +# that removes spurious warnings from the dialog(1) (or Xdialog(1)) response. +# +# Simply pass the name of one or more variables that need to be sanitized. +# After execution, the variables will hold their newly-sanitized data. +# +# This function, unlike f_dialog_data_sanitize(), also removes leading/trailing +# whitespace from each line. +# +f_dialog_line_sanitize() +{ + if [ "$#" -eq 0 ]; then + f_dprintf "%s: called with zero arguments" \ + f_dialog_response_sanitize + return $FAILURE + fi + + local __var_to_edit + for __var_to_edit in $*; do + # Skip warnings and trim leading/trailing whitespace + setvar $__var_to_edit "$( f_getvar $__var_to_edit | awk ' + BEGIN { data = 0 } + { + if ( ! data ) + { + if ( $0 ~ /^$/ ) next + if ( $0 ~ /^Gdk-WARNING \*\*:/ ) next + data = 1 + } + sub(/^[[:space:]]*/, "") + sub(/[[:space:]]*$/, "") + print + } + ' )" + done +} + ############################################################ TITLE FUNCTIONS # f_dialog_title [$new_title] @@ -1588,33 +1630,45 @@ f_dialog_noyes() ############################################################ INPUT FUNCTIONS -# f_dialog_inputstr +# f_dialog_inputstr_store [-s] $text +# +# Store some text from a dialog(1) inputbox to be retrieved later by +# f_dialog_inputstr_fetch(). If the first argument is `-s', the text is +# sanitized before being stored. +# +f_dialog_inputstr_store() +{ + local sanitize= + [ "$1" = "-s" ] && sanitize=1 && shift 1 # -s + local text="$1" + + # Sanitize the line before storing it if desired + [ "$sanitize" ] && f_dialog_line_sanitize text + + setvar DIALOG_INPUTBOX_$$ "$text" +} + +# f_dialog_inputstr_fetch [$var_to_set] # # Obtain the inputstr entered by the user from the most recently displayed -# dialog(1) inputbox and clean up any temporary files/variables. +# dialog(1) inputbox (previously stored with f_dialog_inputstr_store() above). +# If $var_to_set is NULL or missing, output is printed to stdout (which is less +# recommended due to performance degradation; in a loop for example). # -f_dialog_inputstr() +f_dialog_inputstr_fetch() { - # Skip warnings and trim leading/trailing whitespace from user input - eval echo \"\$DIALOG_INPUTBOX_$$\" | awk ' - BEGIN { found = 0 } - { - if ( ! found ) - { - if ( $0 ~ /^$/ ) next - if ( $0 ~ /^Gdk-WARNING \*\*:/ ) next - found = 1 - } - sub(/^[[:space:]]*/, "") - sub(/[[:space:]]*$/, "") - print - } - ' + local __var_to_set="$1" __cp + + debug= f_getvar DIALOG_INPUTBOX_$$ "${__var_to_set:-__cp}" # get data setvar DIALOG_INPUTBOX_$$ "" # scrub memory in case data was sensitive + + # Return the line on standard-out if desired + [ "$__var_to_set" ] || echo "$__cp" + return $SUCCESS } -# f_dialog_input $prompt [$init [$hline]] +# f_dialog_input $var_to_set $prompt [$init [$hline]] # # Prompt the user with a dialog(1) inputbox to enter some value. The inputbox # remains until the the user presses ENTER or ESC, or otherwise ends the @@ -1629,34 +1683,38 @@ f_dialog_inputstr() # f_dialog_input() { - local prompt="$1" init="$2" hline="$3" - local height width - f_dialog_inputbox_size height width \ + local __var_to_set="$1" __prompt="$2" __init="$3" __hline="$4" + + # NOTE: Function name appended to prevent __var_{height,width} values + # from becoming local (and thus preventing setvar from working). + local __height_input __width_input + f_dialog_inputbox_size __height_input __width_input \ "$DIALOG_TITLE" "$DIALOG_BACKTITLE" \ - "$prompt" "$init" "$hline" + "$__prompt" "$__init" "$__hline" - local opterm="--" - [ "$USE_XDIALOG" ] && opterm= + local __opterm="--" + [ "$USE_XDIALOG" ] && __opterm= - local dialog_input - dialog_input=$( + local __dialog_input + __dialog_input=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ - --hline "$hline" \ + --hline "$__hline" \ --ok-label "$msg_ok" \ --cancel-label "$msg_cancel" \ - --inputbox "$prompt" \ - $height $width \ - $opterm "$init" \ + --inputbox "$__prompt" \ + $__height_input $__width_input \ + $__opterm "$__init" \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) - local retval=$? + local __retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_input" - f_dialog_inputstr + # Remove warnings and leading/trailing whitespace from user input + f_dialog_line_sanitize __dialog_input - return $retval + setvar "$__var_to_set" "$__dialog_input" + return $__retval } ############################################################ MENU FUNCTIONS Modified: head/usr.sbin/bsdconfig/share/media/tcpip.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/tcpip.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/share/media/tcpip.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -1422,29 +1422,23 @@ f_device_dialog_tcp() "$_netmask" \ && break ;; "$msg_host_name_including_domain:") - cp=$( f_dialog_input "$cp" \ - "$_hostname" - ) && _hostname="$cp" ;; + f_dialog_input cp "$cp" "$_hostname" \ + && _hostname="$cp" ;; "$msg_ipv4_gateway:") - cp=$( f_dialog_input "$cp" \ - "$_gateway" - ) && _gateway="$cp" ;; + f_dialog_input cp "$cp" "$_gateway" \ + && _gateway="$cp" ;; "$msg_name_server:") - cp=$( f_dialog_input "$cp" \ - "$_nameserver" - ) && _nameserver="$cp" ;; + f_dialog_input cp "$cp" "$_nameserver" \ + && _nameserver="$cp" ;; "$msg_ipv4_address:") - cp=$( f_dialog_input "$cp" \ - "$_ipaddr" - ) && _ipaddr="$cp" ;; + f_dialog_input cp "$cp" "$_ipaddr" \ + && _ipaddr="$cp" ;; "$msg_netmask:") - cp=$( f_dialog_input "$cp" \ - "$_netmask" - ) && _netmask="$cp" ;; + f_dialog_input cp "$cp" "$_netmask" \ + && _netmask="$cp" ;; "$msg_extra_options_to_ifconfig") - cp=$( f_dialog_input "$cp" \ - "$_extras" - ) && _extras="$cp" ;; + f_dialog_input cp "$cp" "$_extras" \ + && _extras="$cp" ;; esac done Modified: head/usr.sbin/bsdconfig/share/mustberoot.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/mustberoot.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/share/mustberoot.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -177,8 +177,7 @@ f_become_root_via_sudo() [ $retval -eq 255 ] && f_die $retval "$password" else - local dialog_inputbox - dialog_inputbox=$( $DIALOG \ + password=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --hline "$hline" \ @@ -188,14 +187,9 @@ f_become_root_via_sudo() --passwordbox "$msg" \ $height $width \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - password=$( f_dialog_inputstr ) + ) || exit $? fi - - # Exit if the user cancelled. - [ $retval -eq $SUCCESS ] || exit $retval + debug= f_dialog_line_sanitize password # # Validate sudo(8) credentials Modified: head/usr.sbin/bsdconfig/share/variable.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/variable.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/share/variable.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -93,8 +93,7 @@ f_variable_get_value() if ! { f_getvar $var cp && ! f_interactive; }; then shift 1 # var - cp=$( f_dialog_input "$( printf "$@" )" "$cp" ) && - setvar $var "$cp" + f_dialog_input cp "$( printf "$@" )" "$cp" && setvar $var "$cp" fi return $SUCCESS Modified: head/usr.sbin/bsdconfig/startup/misc ============================================================================== --- head/usr.sbin/bsdconfig/startup/misc Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/startup/misc Sun Jun 2 05:45:25 2013 (r251242) @@ -303,7 +303,7 @@ dialog_input_value() local prompt="$1" _input="$2" f_dialog_title "$msg_value_required" - _input=$( f_dialog_input "$prompt" "$_input" "$hline_alnum_tab_enter" ) + f_dialog_input _input "$prompt" "$_input" "$hline_alnum_tab_enter" local retval=$? f_dialog_title_restore Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -454,9 +454,8 @@ f_dialog_input_rcvar() while :; do # Return if user either pressed ESC or chosen Cancel/No - _input=$( f_dialog_input "$msg_please_enter_rcvar_name" \ - "$_input" "$hline_alnum_tab_enter" - ) || return + f_dialog_input _input "$msg_please_enter_rcvar_name" \ + "$_input" "$hline_alnum_tab_enter" || return # Check for invalid entry (1of2) if ! echo "$_input" | grep -q "^[[:alpha:]_]"; then Modified: head/usr.sbin/bsdconfig/startup/share/rcedit.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcedit.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/startup/share/rcedit.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -68,9 +68,8 @@ f_dialog_rcedit() fi # Return if user has either pressed ESC or chosen Cancel/No - _input=$( f_dialog_input "$msg" "$_input" \ - "$hline_alnum_punc_tab_enter" - ) || return + f_dialog_input _input "$msg" "$_input" \ + "$hline_alnum_punc_tab_enter" || return # Return if the value has not changed from current local cur_val="$( f_sysrc_get "$var" )" Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -125,9 +125,8 @@ f_dialog_input_group_name() while :; do # Return if user has either pressed ESC or chosen Cancel/No - _input=$( f_dialog_input "$msg_group" "$_input" \ - "$hline_alnum_tab_enter" - ) || return + f_dialog_input _input "$msg_group" "$_input" \ + "$hline_alnum_tab_enter" || return # Check for no-change [ "$_input" = "$_name" ] && return $SUCCESS @@ -198,8 +197,7 @@ f_dialog_input_group_password() # local retval _password1 _password2 while :; do - local dialog_inputbox - dialog_inputbox=$( $DIALOG \ + _password1=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --hline "$hline" \ @@ -210,15 +208,13 @@ f_dialog_input_group_password() $height1 $width1 \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _password1=$( f_dialog_inputstr ) + debug= f_dialog_line_sanitize _password1 # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval - dialog_inputbox=$( $DIALOG \ + _password2=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --hline "$hline" \ @@ -229,10 +225,8 @@ f_dialog_input_group_password() $height2 $width2 \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _password2=$( f_dialog_inputstr ) + debug= f_dialog_line_sanitize _password2 # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval @@ -275,9 +269,8 @@ f_dialog_input_group_gid() local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - _input=$( f_dialog_input "$msg_group_id_leave_empty_for_default" \ - "$_input" "$hline_num_tab_enter" - ) || return + f_dialog_input _input "$msg_group_id_leave_empty_for_default" \ + "$_input" "$hline_num_tab_enter" || return group_gid="$_input" save_flag=1 @@ -392,11 +385,10 @@ f_dialog_input_group_members() 2) # Enter Group Members manually msg="$msg_group_members ($msg_separated_by_commas)" - # Return to previous menu if user has either - # pressed ESC or chosen Cancel/No - _group_members=$( f_dialog_input "$msg" "$_input" \ - "$hline_num_tab_enter" - ) || continue + f_dialog_input _group_members "$msg" "$_input" \ + "$hline_num_tab_enter" || continue + # Return to previous menu if user either + # pressed ESC or chose Cancel/No _input="$_group_members" ;; Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sun Jun 2 04:30:03 2013 (r251241) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sun Jun 2 05:45:25 2013 (r251242) @@ -226,9 +226,8 @@ f_dialog_input_name() while :; do # Return if user has either pressed ESC or chosen Cancel/No - _input=$( f_dialog_input "$msg_login" "$_input" \ - "$hline_alnum_tab_enter" - ) || return + f_dialog_input _input "$msg_login" "$_input" \ + "$hline_alnum_tab_enter" || return # Check for no-change [ "$_input" = "$_name" ] && return $SUCCESS @@ -297,10 +296,9 @@ f_dialog_input_password() # # Loop until the user provides taint-free/valid input # - local retval _password1 _password2 + local _password1 _password2 while :; do - local dialog_inputbox - dialog_inputbox=$( $DIALOG \ + _password1=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --hline "$hline" \ @@ -310,13 +308,11 @@ f_dialog_input_password() --passwordbox "$msg" \ $height1 $width1 \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _password1=$( f_dialog_inputstr ) + ) || return $? + # Return if user either pressed ESC or chose Cancel/No + debug= f_dialog_line_sanitize _password1 - dialog_inputbox=$( $DIALOG \ + _password2=$( $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --hline "$hline" \ @@ -326,14 +322,9 @@ f_dialog_input_password() --passwordbox "$rmsg" \ $height2 $width2 \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) - - retval=$? - setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" - _password2=$( f_dialog_inputstr ) - - # Return if user has either pressed ESC or chosen Cancel/No - [ $retval -eq $SUCCESS ] || return $retval + ) || return $? + # Return if user either pressed ESC or chose Cancel/No + debug= f_dialog_line_sanitize _password2 # Check for password mismatch if [ "$_password1" != "$_password2" ]; then @@ -373,9 +364,8 @@ f_dialog_input_gecos() local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - _input=$( f_dialog_input "$msg_full_name" "$_input" \ - "$hline_alnum_punc_tab_enter" - ) || return + f_dialog_input _input "$msg_full_name" "$_input" \ + "$hline_alnum_punc_tab_enter" || return pw_gecos="$_input" save_flag=1 @@ -396,9 +386,8 @@ f_dialog_input_uid() local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - _input=$( f_dialog_input "$msg_user_id_leave_empty_for_default" \ - "$_input" "$hline_num_tab_enter" - ) || return + f_dialog_input _input "$msg_user_id_leave_empty_for_default" \ + "$_input" "$hline_num_tab_enter" || return pw_uid="$_input" save_flag=1 @@ -419,9 +408,8 @@ f_dialog_input_gid() local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - _input=$( f_dialog_input "$msg_group_id_leave_empty_for_default" \ - "$_input" "$hline_num_tab_enter" - ) || return + f_dialog_input _input "$msg_group_id_leave_empty_for_default" \ + "$_input" "$hline_num_tab_enter" || return pw_gid="$_input" save_flag=1 @@ -442,9 +430,8 @@ f_dialog_input_class() local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - _input=$( f_dialog_input "$msg_login_class" "$_input" \ - "$hline_alnum_tab_enter" - ) || return + f_dialog_input _input "$msg_login_class" "$_input" \ + "$hline_alnum_tab_enter" || return pw_class="$_input" save_flag=1 @@ -585,10 +572,9 @@ f_dialog_input_change() ret_days=$(( $ret_days + 1 )) # Return to menu if either ESC or Cancel/No - ret_days=$( f_dialog_input \ + f_dialog_input ret_days \ "$msg_password_expires_in_how_many_days" \ - "$ret_days" "$hline" - ) || continue + "$ret_days" "$hline" || continue # Taint-check the user's input if ! f_isinteger "$ret_days"; then @@ -606,16 +592,12 @@ f_dialog_input_change() break ;; 4) # Enter value manually - local ret_secs - msg=$( printf "$msg_number_of_seconds_since_epoch" \ "$( date -r 1 "+%c %Z" )" ) # Return to menu if either ESC or Cancel/No - ret_secs=$( f_dialog_input \ - "$msg" "$_input" "$hline" ) || continue - - _input="$ret_secs" + f_dialog_input _input \ + "$msg" "$_input" "$hline" || continue # Taint-check the user's input if ! f_isinteger "${_input:-0}"; then @@ -771,10 +753,9 @@ f_dialog_input_expire() ret_days=$(( $ret_days + 1 )) # Return to menu if either ESC or Cancel/No - ret_days=$( f_dialog_input \ + f_dialog_input ret_days \ "$msg_account_expires_in_how_many_days" \ - "$ret_days" "$hline" - ) || continue + "$ret_days" "$hline" || continue # Taint-check the user's input if ! f_isinteger "$ret_days"; then @@ -792,16 +773,12 @@ f_dialog_input_expire() break ;; 4) # Enter value manually - local ret_secs - msg=$( printf "$msg_number_of_seconds_since_epoch" \ "$( date -r 1 "+%c %Z" )" ) # Return to menu if either ESC or Cancel/No - ret_secs=$( f_dialog_input \ - "$msg" "$_input" "$hline" ) || continue - - _input="$ret_secs" + f_dialog_input _input "$msg" \ + "$_input" "$hline" || continue # Taint-check the user's input if ! f_isinteger "${_input:-0}"; then @@ -837,9 +814,8 @@ f_dialog_input_home_dir() local _input="$1" # Return if user has either pressed ESC or chosen Cancel/No - _input=$( f_dialog_input "$msg_home_directory" "$_input" \ - "$hline_alnum_punc_tab_enter" - ) || return + f_dialog_input _input "$msg_home_directory" "$_input" \ + "$hline_alnum_punc_tab_enter" || return pw_home_dir="$_input" save_flag=1 From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 09:02:15 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9E7FBC14; Sun, 2 Jun 2013 09:02:15 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 809301C3B; Sun, 2 Jun 2013 09:02:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5292F6t090199; Sun, 2 Jun 2013 09:02:15 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5292CPU090179; Sun, 2 Jun 2013 09:02:12 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306020902.r5292CPU090179@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 09:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251244 - in head/usr.sbin/bsdconfig: . console mouse networking security share startup timezone usermgmt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 09:02:15 -0000 Author: dteske Date: Sun Jun 2 09:02:12 2013 New Revision: 251244 URL: http://svnweb.freebsd.org/changeset/base/251244 Log: Improve the dialog(1) API in dialog.subr by adding f_dialog_default_store() and f_dialog_default_fetch(). Operating similar to functions introduced by SVN r251236 and r251242, these functions operate as a pair for helping track the default-item data (for the --menu, --checklist, and --radiolist widgets). This replaces the direct usage of a global to store the data with an abstract method for readability and to centralize the code. Modified: head/usr.sbin/bsdconfig/bsdconfig head/usr.sbin/bsdconfig/console/console head/usr.sbin/bsdconfig/mouse/mouse head/usr.sbin/bsdconfig/networking/networking head/usr.sbin/bsdconfig/security/security head/usr.sbin/bsdconfig/share/dialog.subr head/usr.sbin/bsdconfig/startup/misc head/usr.sbin/bsdconfig/startup/rcconf head/usr.sbin/bsdconfig/startup/rcdelete head/usr.sbin/bsdconfig/startup/rcvar head/usr.sbin/bsdconfig/startup/startup head/usr.sbin/bsdconfig/timezone/timezone head/usr.sbin/bsdconfig/usermgmt/groupinput head/usr.sbin/bsdconfig/usermgmt/userinput head/usr.sbin/bsdconfig/usermgmt/usermgmt Modified: head/usr.sbin/bsdconfig/bsdconfig ============================================================================== --- head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 09:02:12 2013 (r251244) @@ -146,6 +146,7 @@ dialog_menu_main() local btitle="$DIALOG_BACKTITLE" local prompt="$msg_menu_text" local menu_list + local defaultitem= # Calculated below menu_list=" 'X' '$msg_exit' '$msg_exit_bsdconfig' @@ -187,6 +188,9 @@ dialog_menu_main() \"\" \ $menu_list + # Obtain default-item from previously stored selection + f_dialog_default_fetch defaultitem + local menu_choice menu_choice=$( eval $DIALOG \ --clear \ @@ -198,7 +202,7 @@ dialog_menu_main() --help-button \ --help-label \"\$msg_help\" \ ${USE_XDIALOG:+--help \"\"} \ - --default-item \"\$DEFAULTITEM_$$\" \ + --default-item \"\$defaultitem\" \ --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ @@ -209,7 +213,7 @@ dialog_menu_main() f_dialog_menutag_store "$menu_choice" # Only update default-item on success - [ $retval -eq 0 ] && setvar DEFAULTITEM_$$ "$menu_choice" + [ $retval -eq 0 ] && f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/console/console ============================================================================== --- head/usr.sbin/bsdconfig/console/console Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/console/console Sun Jun 2 09:02:12 2013 (r251244) @@ -51,6 +51,7 @@ dialog_menu_main() local menu_list local hline="$hline_configure_system_console_settings" local prompt="$msg_console_menu_text" + local defaultitem= # Calculated below menu_list=" 'X $msg_exit' '$msg_exit_this_menu' @@ -70,23 +71,26 @@ dialog_menu_main() \"\$hline\" \ $menu_list + # Obtain default-item from previously stored selection + f_dialog_default_fetch defaultitem + local menu_choice menu_choice=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\$prompt\" \ - $height $width $rows \ - $menu_list \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --default-item \"\$defaultitem\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_data_sanitize menu_choice f_dialog_menutag_store "$menu_choice" - setvar DEFAULTITEM_$$ "$menu_choice" + f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/mouse/mouse ============================================================================== --- head/usr.sbin/bsdconfig/mouse/mouse Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/mouse/mouse Sun Jun 2 09:02:12 2013 (r251244) @@ -51,6 +51,7 @@ dialog_menu_main() local menu_list local hline="" local prompt="$msg_menu_text" + local defaultitem= # Calculated below menu_list=" 'X $msg_exit' '$msg_exit_this_menu' @@ -69,23 +70,26 @@ dialog_menu_main() \"\$hline\" \ $menu_list + # Obtain default-item from previously stored selection + f_dialog_default_fetch defaultitem + local menu_choice menu_choice=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\$prompt\" \ - $height $width $rows \ - $menu_list \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --default-item \"\$defaultitem\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_data_sanitize menu_choice f_dialog_menutag_store "$menu_choice" - setvar DEFAULTITEM_$$ "$menu_choice" + f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/networking/networking ============================================================================== --- head/usr.sbin/bsdconfig/networking/networking Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/networking/networking Sun Jun 2 09:02:12 2013 (r251244) @@ -50,6 +50,7 @@ dialog_menu_main() { local menu_list local hline="$hline_arrows_tab_enter" + local defaultitem= # Calculated below menu_list=" 'X' '$msg_exit' @@ -67,23 +68,26 @@ dialog_menu_main() \"\$hline\" \ $menu_list + # Obtain default-item from previously stored selection + f_dialog_default_fetch defaultitem + local menu_choice menu_choice=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\" \ - $height $width $rows \ - $menu_list \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --default-item \"\$defaultitem\" \ + --menu \"\" \ + $height $width $rows \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_data_sanitize menu_choice f_dialog_menutag_store "$menu_choice" - setvar DEFAULTITEM_$$ "$menu_choice" + f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/security/security ============================================================================== --- head/usr.sbin/bsdconfig/security/security Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/security/security Sun Jun 2 09:02:12 2013 (r251244) @@ -54,7 +54,7 @@ dialog_menu_main() local prompt="$msg_menu_text" # Obtain default-item (adjusted below for dynamic tags) - f_getvar DEFAULTITEM_$$ defaultitem + f_dialog_default_fetch defaultitem local ditem="${defaultitem%%[$IFS]*}" menu_list=" @@ -123,7 +123,7 @@ dialog_menu_main() f_dialog_menutag_store "$menu_choice" # Only update default-item on success - [ $retval -eq 0 ] && setvar DEFAULTITEM_$$ "$menu_choice" + [ $retval -eq 0 ] && f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/share/dialog.subr Sun Jun 2 09:02:12 2013 (r251244) @@ -1757,6 +1757,45 @@ f_dialog_menutag_fetch() return $SUCCESS } +# f_dialog_default_store [-s] $text +# +# Store some text to be used later as the --default-item argument to dialog(1) +# (or Xdialog(1)) for --menu, --checklist, and --radiolist widgets. Retrieve +# the text later with f_dialog_menutag_fetch(). If the first argument is `-s', +# the text is sanitized before being stored. +# +f_dialog_default_store() +{ + local sanitize= + [ "$1" = "-s" ] && sanitize=1 && shift 1 # -s + local text="$1" + + # Sanitize the defaulitem before storing it if desired + [ "$sanitize" ] && f_dialog_data_sanitize text + + setvar DEFAULTITEM_$$ "$text" +} + +# f_dialog_default_fetch [$var_to_set] +# +# Obtain text to be used with the --default-item argument of dialog(1) (or +# Xdialog(1)) (previously stored with f_dialog_default_store() above). If +# $var_to_set is NULL or missing, output is printed to stdout (which is less +# recommended due to performance degradation; in a loop for example). +# +f_dialog_default_fetch() +{ + local __var_to_set="$1" __cp + + debug= f_getvar DEFAULTITEM_$$ "${__var_to_set:-__cp}" # get the data + setvar DEFAULTITEM_$$ "" # scrub memory in case data was sensitive + + # Return the data on standard-out if desired + [ "$__var_to_set" ] || echo "$__cp" + + return $SUCCESS +} + # f_dialog_menutag2item $tag_chosen $tag1 $item1 $tag2 $item2 ... # # To use the `--menu' option of dialog(1) you must pass an ordered list of Modified: head/usr.sbin/bsdconfig/startup/misc ============================================================================== --- head/usr.sbin/bsdconfig/startup/misc Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/startup/misc Sun Jun 2 09:02:12 2013 (r251244) @@ -61,7 +61,7 @@ dialog_menu_main() local prompt="$msg_miscellaneous_menu_text" # Obtain default-item (adjusted below for dynamic tags) - f_getvar DEFAULTITEM_$$ defaultitem + f_dialog_default_fetch defaultitem local ditem="${defaultitem%%[$IFS]*}" menu_list=" @@ -289,7 +289,7 @@ dialog_menu_main() local retval=$? f_dialog_data_sanitize menu_choice f_dialog_menutag_store "$menu_choice" - setvar DEFAULTITEM_$$ "$menu_choice" + f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/startup/rcconf ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcconf Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/startup/rcconf Sun Jun 2 09:02:12 2013 (r251244) @@ -81,6 +81,7 @@ dialog_menu_main() { local hline="$hline_arrows_tab_enter" local prompt="" + local defaultitem= # Calculated below RCCONF_MENU_LIST=" 'X $msg_exit' '$msg_exit_desc' @@ -170,20 +171,23 @@ dialog_menu_main() \"\$hline\" \ $RCCONF_MENU_LIST + # Obtain default-item from previously stored selection + f_dialog_default_fetch defaultitem + local menu_choice menu_choice=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --help-button \ - --help-label \"\$msg_details\" \ - ${SHOW_DESC:+--item-help} \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\$prompt\" \ - $height $width $rows \ - $RCCONF_MENU_LIST \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --help-button \ + --help-label \"\$msg_details\" \ + ${SHOW_DESC:+--item-help} \ + --default-item \"\$defaultitem\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $RCCONF_MENU_LIST \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? @@ -191,7 +195,7 @@ dialog_menu_main() f_dialog_menutag_store "$menu_choice" # Only update default-item on success - [ $retval -eq 0 ] && setvar DEFAULTITEM_$$ "$menu_choice" + [ $retval -eq 0 ] && f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/startup/rcdelete ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcdelete Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/startup/rcdelete Sun Jun 2 09:02:12 2013 (r251244) @@ -148,6 +148,7 @@ dialog_menu_main() { local hline="$hline_arrows_tab_enter" local prompt="" + local defaultitem= # Calculated below # # [Re-]Accent the menu list before incorporating it @@ -205,21 +206,24 @@ dialog_menu_main() \"\$hline\" \ $menu_list + # Obtain default-item from previously stored selection + f_dialog_default_fetch defaultitem + local menu_choice menu_choice=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --keep-tite \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --help-button \ - --help-label \"\$msg_details\" \ - ${SHOW_DESC:+--item-help} \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\$prompt\" \ - $height $width $rows \ - $menu_list \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --keep-tite \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --help-button \ + --help-label \"\$msg_details\" \ + ${SHOW_DESC:+--item-help} \ + --default-item \"\$defaultitem\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? @@ -227,7 +231,7 @@ dialog_menu_main() f_dialog_menutag_store "$menu_choice" # Only update default-item on success - [ $retval -eq 0 ] && setvar DEFAULTITEM_$$ "$menu_choice" + [ $retval -eq 0 ] && f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/startup/rcvar ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcvar Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/startup/rcvar Sun Jun 2 09:02:12 2013 (r251244) @@ -67,6 +67,7 @@ dialog_menu_main() { local hline="$hline_arrows_tab_enter" local prompt="" + local defaultitem= # Calculated below RCVAR_MENU_LIST=" 'X $msg_exit' '$msg_exit_this_menu' @@ -134,25 +135,28 @@ dialog_menu_main() \"\$hline\" \ $RCVAR_MENU_LIST + # Obtain default-item from previously stored selection + f_dialog_default_fetch defaultitem + local menu_choice menu_choice=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --keep-tite \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - ${SHOW_DESC:+--item-help} \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\$prompt\" \ - $height $width $rows \ - $RCVAR_MENU_LIST \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --keep-tite \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + ${SHOW_DESC:+--item-help} \ + --default-item \"\$defaultitem\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $RCVAR_MENU_LIST \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_data_sanitize menu_choice f_dialog_menutag_store "$menu_choice" - setvar DEFAULTITEM_$$ "$menu_choice" + f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/startup/startup ============================================================================== --- head/usr.sbin/bsdconfig/startup/startup Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/startup/startup Sun Jun 2 09:02:12 2013 (r251244) @@ -51,6 +51,7 @@ dialog_menu_main() local menu_list local hline="$hline_arrows_tab_enter" local prompt="" + local defaultitem= # Calculated below menu_list=" 'X' '$msg_exit' @@ -67,23 +68,26 @@ dialog_menu_main() \"\$hline\" \ $menu_list + # Obtain default-item from previously stored selection + f_dialog_default_fetch defaultitem + local menu_choice menu_choice=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\$prompt\" \ - $height $width $rows \ - $menu_list \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --default-item \"\$defaultitem\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_data_sanitize menu_choice f_dialog_menutag_store "$menu_choice" - setvar DEFAULTITEM_$$ "$menu_choice" + f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/timezone/timezone ============================================================================== --- head/usr.sbin/bsdconfig/timezone/timezone Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/timezone/timezone Sun Jun 2 09:02:12 2013 (r251244) @@ -83,6 +83,7 @@ dialog_menu_main() local title="$DIALOG_TITLE" local btitle="$DIALOG_BACKTITLE" local prompt="$msg_select_region" + local defaultitem= # Calculated below local height width rows eval f_dialog_menu_size height width rows \ @@ -92,22 +93,25 @@ dialog_menu_main() \"\" \ $continent_menu_list + # Obtain default-item from previously stored selection + f_dialog_default_fetch defaultitem + local menu_choice menu_choice=$( eval $DIALOG \ - --title \"\$title\" \ - --backtitle \"\$btitle\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\$prompt\" \ - $height $width $rows \ - $continent_menu_list \ + --title \"\$title\" \ + --backtitle \"\$btitle\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --default-item \"\$defaultitem\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $continent_menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_data_sanitize menu_choice f_dialog_menutag_store "$menu_choice" - setvar DEFAULTITEM_$$ "$menu_choice" + f_dialog_default_store "$menu_choice" return $retval } Modified: head/usr.sbin/bsdconfig/usermgmt/groupinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/groupinput Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/usermgmt/groupinput Sun Jun 2 09:02:12 2013 (r251244) @@ -228,21 +228,22 @@ while :; do \"\$hline\" \ $menu_items + f_dialog_default_fetch defaultitem mtag=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\$menu_text\" \ - $height $width $rows \ - $menu_items \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --default-item \"\$defaultitem\" \ + --menu \"\$menu_text\" \ + $height $width $rows \ + $menu_items \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) retval=$? f_dialog_data_sanitize mtag - setvar DEFAULTITEM_$$ "$mtag" + f_dialog_default_store "$mtag" f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" # Exit if user has either pressed ESC or chosen Cancel/No Modified: head/usr.sbin/bsdconfig/usermgmt/userinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/userinput Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/usermgmt/userinput Sun Jun 2 09:02:12 2013 (r251244) @@ -391,21 +391,22 @@ while :; do \"\$hline\" \ $menu_items + f_dialog_default_fetch defaultitem mtag=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\$menu_text\" \ - $height $width $rows \ - $menu_items \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --default-item \"\$defaultitem\" \ + --menu \"\$menu_text\" \ + $height $width $rows \ + $menu_items \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) retval=$? f_dialog_data_sanitize mtag - setvar DEFAULTITEM_$$ "$mtag" + f_dialog_default_store "$mtag" f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" # Exit if user has either pressed ESC or chosen Cancel/No Modified: head/usr.sbin/bsdconfig/usermgmt/usermgmt ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/usermgmt Sun Jun 2 05:57:45 2013 (r251243) +++ head/usr.sbin/bsdconfig/usermgmt/usermgmt Sun Jun 2 09:02:12 2013 (r251244) @@ -53,6 +53,7 @@ dialog_menu_main() { local menu_list local hline="$hline_arrows_tab_enter" + local defaultitem= # Calculated below menu_list=" 'X' '$msg_exit' @@ -76,20 +77,23 @@ dialog_menu_main() # When using Xdialog(1) we need to bump the width for the buttons [ "$USE_XDIALOG" ] && width=40 + # Obtain default-item from previously stored selection + f_dialog_default_fetch defaultitem + local menu_choice menu_choice=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --ok-label \"\$msg_ok\" \ - --cancel-label \"\$msg_cancel\" \ - --help-button \ - --help-label \"\$msg_help\" \ - ${USE_XDIALOG:+--help \"\"} \ - --default-item \"\$DEFAULTITEM_$$\" \ - --menu \"\" \ - $height $width $rows \ - $menu_list \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --ok-label \"\$msg_ok\" \ + --cancel-label \"\$msg_cancel\" \ + --help-button \ + --help-label \"\$msg_help\" \ + ${USE_XDIALOG:+--help \"\"} \ + --default-item \"\$defaultitem\" \ + --menu \"\" \ + $height $width $rows \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? @@ -97,7 +101,7 @@ dialog_menu_main() f_dialog_menutag_store "$menu_choice" # Only update default-item on success - [ $retval -eq 0 ] && setvar DEFAULTITEM_$$ "$menu_choice" + [ $retval -eq 0 ] && f_dialog_default_store "$menu_choice" return $retval } From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 09:35:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 10E49F12; Sun, 2 Jun 2013 09:35:11 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 9DB541CC6; Sun, 2 Jun 2013 09:35:10 +0000 (UTC) Received: from server.mypc.hu (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 649C914D2410; Sun, 2 Jun 2013 11:35:08 +0200 (CEST) X-Virus-Scanned: amavisd-new at !change-mydomain-variable!.example.com Received: from server.mypc.hu ([127.0.0.1]) by server.mypc.hu (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Y-PqQAP5ZDBA; Sun, 2 Jun 2013 11:35:07 +0200 (CEST) Received: from [192.168.0.10] (54034B4D.catv.pool.telekom.hu [84.3.75.77]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 889E314D240B; Sun, 2 Jun 2013 11:35:07 +0200 (CEST) Message-ID: <51AB11CE.5030702@FreeBSD.org> Date: Sun, 02 Jun 2013 11:35:10 +0200 From: Gabor Kovesdan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Thunderbird/22.0 MIME-Version: 1.0 To: Ed Schouten , Jilles Tjoelker Subject: Re: svn commit: r250883 - in head: include include/xlocale lib/libc/locale sys/sys tools/regression/lib/libc/locale References: <201305211959.r4LJxbLx034714@svn.freebsd.org> <20130521220003.GB58299@stack.nl> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 09:35:11 -0000 Em 25-05-2013 16:00, Ed Schouten escreveu: > Jilles, Gabor, could you please take a look at the patch, whether it's any good? > > Now we still have the case where the system is built WITHOUT_ICONV=. I > think it really depends on the future of iconv in base how complete we > should attempt to make it. Gabor, is there a chance WITH_ICONV= will > become the default in FreeBSD 10? In general, I think the idea is good. In the original Citrus implementation, there were also plans to use iconv for a ctype functions but the it wasn't actually finished so I removed those bits when I imported iconv to FreeBSD. As for the status, at the moment I have other focuses and higher priority tasks but eventually I would like to get back to iconv. However, I cannot foresee when I will be able to fix the remaining problems, which are: 1, Compatibility with GNU iconv. It achieves a good level of compatibility but it should be almost perfect so that all ports compile. 2, As for the performance, it is quite behind GNU iconv. The loadable modules may have some overhead but it needs some investigation. Gabor From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 09:43:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 45B23415; Sun, 2 Jun 2013 09:43:52 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 285961CF7; Sun, 2 Jun 2013 09:43:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r529hqTf004548; Sun, 2 Jun 2013 09:43:52 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r529hnk4004528; Sun, 2 Jun 2013 09:43:49 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201306020943.r529hnk4004528@svn.freebsd.org> From: Gabor Kovesdan Date: Sun, 2 Jun 2013 09:43:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251245 - head/usr.bin/sort X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 09:43:52 -0000 Author: gabor Date: Sun Jun 2 09:43:48 2013 New Revision: 251245 URL: http://svnweb.freebsd.org/changeset/base/251245 Log: - Update Oleg Moskalenko's email address Requested by: Oleg Moskalenko Modified: head/usr.bin/sort/bwstring.c head/usr.bin/sort/bwstring.h head/usr.bin/sort/coll.c head/usr.bin/sort/coll.h head/usr.bin/sort/file.c head/usr.bin/sort/file.h head/usr.bin/sort/mem.c head/usr.bin/sort/mem.h head/usr.bin/sort/radixsort.c head/usr.bin/sort/radixsort.h head/usr.bin/sort/sort.1.in head/usr.bin/sort/sort.c head/usr.bin/sort/sort.h head/usr.bin/sort/vsort.c head/usr.bin/sort/vsort.h Modified: head/usr.bin/sort/bwstring.c ============================================================================== --- head/usr.bin/sort/bwstring.c Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/bwstring.c Sun Jun 2 09:43:48 2013 (r251245) @@ -1,6 +1,6 @@ /*- * Copyright (C) 2009 Gabor Kovesdan - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.bin/sort/bwstring.h ============================================================================== --- head/usr.bin/sort/bwstring.h Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/bwstring.h Sun Jun 2 09:43:48 2013 (r251245) @@ -2,7 +2,7 @@ /*- * Copyright (C) 2009 Gabor Kovesdan - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.bin/sort/coll.c ============================================================================== --- head/usr.bin/sort/coll.c Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/coll.c Sun Jun 2 09:43:48 2013 (r251245) @@ -1,6 +1,6 @@ /*- * Copyright (C) 2009 Gabor Kovesdan - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.bin/sort/coll.h ============================================================================== --- head/usr.bin/sort/coll.h Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/coll.h Sun Jun 2 09:43:48 2013 (r251245) @@ -2,7 +2,7 @@ /*- * Copyright (C) 2009 Gabor Kovesdan - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.bin/sort/file.c ============================================================================== --- head/usr.bin/sort/file.c Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/file.c Sun Jun 2 09:43:48 2013 (r251245) @@ -1,6 +1,6 @@ /*- * Copyright (C) 2009 Gabor Kovesdan - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.bin/sort/file.h ============================================================================== --- head/usr.bin/sort/file.h Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/file.h Sun Jun 2 09:43:48 2013 (r251245) @@ -2,7 +2,7 @@ /*- * Copyright (C) 2009 Gabor Kovesdan - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.bin/sort/mem.c ============================================================================== --- head/usr.bin/sort/mem.c Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/mem.c Sun Jun 2 09:43:48 2013 (r251245) @@ -1,6 +1,6 @@ /*- * Copyright (C) 2009 Gabor Kovesdan - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.bin/sort/mem.h ============================================================================== --- head/usr.bin/sort/mem.h Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/mem.h Sun Jun 2 09:43:48 2013 (r251245) @@ -2,7 +2,7 @@ /*- * Copyright (C) 2009 Gabor Kovesdan - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.bin/sort/radixsort.c ============================================================================== --- head/usr.bin/sort/radixsort.c Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/radixsort.c Sun Jun 2 09:43:48 2013 (r251245) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * Copyright (C) 2012 Gabor Kovesdan * All rights reserved. * Modified: head/usr.bin/sort/radixsort.h ============================================================================== --- head/usr.bin/sort/radixsort.h Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/radixsort.h Sun Jun 2 09:43:48 2013 (r251245) @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /*- - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * Copyright (C) 2012 Gabor Kovesdan * All rights reserved. * Modified: head/usr.bin/sort/sort.1.in ============================================================================== --- head/usr.bin/sort/sort.1.in Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/sort.1.in Sun Jun 2 09:43:48 2013 (r251245) @@ -612,7 +612,7 @@ command first appeared in .Sh AUTHORS Gabor Kovesdan , .Pp -Oleg Moskalenko +Oleg Moskalenko .Sh NOTES This implementation of .Nm Modified: head/usr.bin/sort/sort.c ============================================================================== --- head/usr.bin/sort/sort.c Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/sort.c Sun Jun 2 09:43:48 2013 (r251245) @@ -1,6 +1,6 @@ /*- * Copyright (C) 2009 Gabor Kovesdan - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.bin/sort/sort.h ============================================================================== --- head/usr.bin/sort/sort.h Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/sort.h Sun Jun 2 09:43:48 2013 (r251245) @@ -2,7 +2,7 @@ /*- * Copyright (C) 2009 Gabor Kovesdan - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.bin/sort/vsort.c ============================================================================== --- head/usr.bin/sort/vsort.c Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/vsort.c Sun Jun 2 09:43:48 2013 (r251245) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * Copyright (C) 2012 Gabor Kovesdan * All rights reserved. * Modified: head/usr.bin/sort/vsort.h ============================================================================== --- head/usr.bin/sort/vsort.h Sun Jun 2 09:02:12 2013 (r251244) +++ head/usr.bin/sort/vsort.h Sun Jun 2 09:43:48 2013 (r251245) @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /*- - * Copyright (C) 2012 Oleg Moskalenko + * Copyright (C) 2012 Oleg Moskalenko * Copyright (C) 2012 Gabor Kovesdan * All rights reserved. * From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 10:19:14 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E33B68ED; Sun, 2 Jun 2013 10:19:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D3D401DBD; Sun, 2 Jun 2013 10:19:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52AJEeR016220; Sun, 2 Jun 2013 10:19:14 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52AJEhU016218; Sun, 2 Jun 2013 10:19:14 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306021019.r52AJEhU016218@svn.freebsd.org> From: Hiroki Sato Date: Sun, 2 Jun 2013 10:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r251246 - releng/8.4/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 10:19:15 -0000 Author: hrs Date: Sun Jun 2 10:19:14 2013 New Revision: 251246 URL: http://svnweb.freebsd.org/changeset/base/251246 Log: Update relnotes item: F_DUP{,2}FD_CLOEXEC implemented for fcntl(2), filemon(4) added, kern.*siz writable sysctl, random(4) PADLOCK_RNG and RDRAND_RND, Danish keymap for MacBook added, uchcom(4) CH341/CH340 USB-Serial Bridge support, ukbd(4) Microsoft Natural Egronomic Keyboard 4000 issue fixed, uplcom(4) Motorola cable support, uslcom(4) CP2103/CP2104/CP2105 support, virtio drivers added, em(4), lem(4), igb(4) stat counter bugfix, ipheth(4) iPhone 5 support, arcmsr(4) updated to 1.20.00.25, hptiop(4) updated to 1.8, isci(4) SCSI UNMAP to ATA DSM translation, GEOM_RAID kern.geom.raid.* tunables, tws(4) updated to 10.80.00.005, NFS security configuration issue in exports(5) fixed, crontab(1) one second wait added, fetch(1) max number of HTTP redirections increased, fetch(1) 305 and 308 status code supported, make(1) :tu and :tl modifiers added, mv(1) -h added, ppp(8) lqr/echo issue fixed, ps(1) dsiz and ssiz keywords added, NO_FOO overrides WITH_FOO in src.conf, syslogd(8) IPv6 support in dest addr, top(1) ZFS ARC stats support, rc.d/jail jail_parameters variable added, ISC BIND 9.6-ESV-R7-P4, LESS v451, pkg(8) command added, and pkg_add(1) PACKAGESUFFIX support added. Approved by: re (implicitly) Modified: releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml releng/8.4/release/doc/en_US.ISO8859-1/relnotes/man-refs.ent Modified: releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jun 2 09:43:48 2013 (r251245) +++ releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jun 2 10:19:14 2013 (r251246) @@ -253,6 +253,18 @@ A bug which could cause a kernel thread to have a wrong CPU affinity configuration has been fixed. + The + F_DUPFD_CLOEXEC command for &man.fcntl.2; + has been implemented. This is standardized in IEEE Std + 1003.1-2008 (POSIX, Single UNIX Specification Version 4). In + addition to this, F_DUP2FD_CLOEXEC has been + implemented in analogy with + F_DUP2FD. + + The &man.filemon.4; pseudo-device has + been added. This allows a process to collect file operations + data of its children. + A bug in VIMAGE &man.jail.8; which could make the network subsystem run on an wrong vnet context has been fixed. @@ -277,6 +289,15 @@ uninterruptedly after a system panic and the other CPUs are stopped. The default value is 0. + The &man.loader.8; tunables + kern.maxtsiz, + kern.dfldsiz, + kern.maxdsiz, + kern.dflssiz, + kern.maxssiz, and + kern.sgrowsiz are now writable + &man.sysctl.8; variables. + A bug that changes to a mapped file with the &man.mmap.2; system call were not flushed properly under certain circumstances has been fixed. If a @@ -390,6 +411,22 @@ CP102E/CP102EL/CP104EL-A/CP104JU/CP114EL/CP118EL-A/CP168EL-A multiport serial boards. + The &man.random.4; + driver now supports VIA C3 Nehemiah random number generator + on VIA Nano processors. kernel + option has been replaced with + in GENERIC kernel. + + arch="amd64,i386">The &man.random.4; + driver now supports RDRAND instruction on + Intel on-chip Digital Random Number Generator (called Bull + Mountain). kernel option has been + added to GENERIC kernel. + + A new &man.syscons.4; keyboard map for + Danish ISO-8859-1 keyboard found on Apple MacBook has been + added. + The &man.uart.4; driver now supports Intel AMT Serial Port for Remote Keyboard and Text (KT) Redirection (Serial Over LAN) on @@ -399,6 +436,16 @@ supports BeagleBone and FT2232-based egnite Turtelizer 2 JTAG/RS232 Adapter. + The &man.uchcom.4; driver now supports + CH341/CH340 USB-Serial Bridge. + + The &man.ukbd.4; driver now supports + Microsoft Natural Egronomic Keyboard 4000. It had an issue + that function keys were not recognized. + + The &man.uplcom.4; driver now supports + Motorola cable. + The &man.usb.4; driver now handles suspend events synchronously. This fixed problems of suspend and resume. @@ -409,6 +456,23 @@ This allows more bandwidth for isochronous FULL speed application connected through a High Speed USB HUB. + The &man.uslcom.4; driver now + supports Silicon Laboratories CP2103/CP2104/CP2105 based USB + serial adapter. + + The paravirtualized + virtio drivers have been added as + kernel modules. They include PCI fontend, + net, block, + balloon, and scsi + drivers. The module files are + virtio.ko, + virtio_pci.ko, + if_vtnet.ko, + virtio_blk.ko, + virtio_balloon.ko, and + virtio_scsi.ko, respectively. + The &man.wbwd.4; driver, which supports the watchdog timer found in Winbond Super I/O chips, has been added. @@ -473,6 +537,10 @@ &man.gem.4;, and &man.hme.4; drivers have been added to GENERIC kernel. + A bug in statistics counters in the + &man.em.4;, lem(4), and &man.igb.4; drivers has been + fixed. + The &man.fxp.4; network driver has been improved. It does not cause unnecessary media change in controller reconfiguration such as promiscuos mode @@ -485,6 +553,9 @@ number of queues, all of queues are bound to different CPUs. + The ipheth(4) driver now supports + Apple iPhone 5 tethering mode. + The &man.iwn.4; driver now supports Intel Centrino 6150 wireless N and WiMAX chipsets, and Intel Centrino Wireless-N 100/130 @@ -658,6 +729,9 @@ Marvell 88SE9220/9230/9235 PCIe 2.0 x2 6Gbps SATA controllers. + The &man.arcmsr.4; driver has been + updated to version 1.20.00.25. + A bug in the &man.amr.4; driver which could cause data corruption has been fixed. @@ -701,9 +775,9 @@ BIO_DELETE requests handled as a single TRIM request. - The &man.umass.4; driver now - supports Olympus FE-210 camera, LG UP3S MP3 player, Laser - MP3-2GA13 MP3, and Garmin GPS devices. + The &man.hptiop.4; driver has + bee updated to version 1.8 and now supports HighPoint + RocketRAID 4500/4311/4310/4211/4210/3560/3530. The &man.isci.4; driver now supports Intel C600 Serial Attached SCSI controllers with chip IDs from @@ -714,6 +788,9 @@ CAPACITY(16) SCSI command for an SATA device has been fixed. + The &man.isci.4; driver now supports + SCSI UNMAP to ATA DSM translation. + A bug in &man.isci.4; driver which could prevent smartctl (sysutils/smartmontools in the Ports @@ -763,9 +840,32 @@ option in &man.graid.8; utility can be used to specify byte order for the DDF metadata. + The RAID + &man.geom.4; class now supports &man.sysctl.8; variables + kern.geom.raid.enable and + kern.geom.raid.format. + kern.geom.raid.enable is to control + on-disk metadata recognition in a systemwide basis. When it + is set to 1, it is enabled (the default + value is 1). + kern.geom.raid.format + are similar variables to control enable/disable of specific + metadata or transformation modules. The valid keywords for + format are + raid0, raid1, + raid1e, raid5, and + concat. + The &man.tmpfs.5; filesystem is not an experimental implementation anymore. + The &man.tws.4; driver has been + updated to version 10.80.00.005 from LSI. + + The &man.umass.4; driver now + supports Olympus FE-210 camera, LG UP3S MP3 player, Laser + MP3-2GA13 MP3, and Garmin GPS devices. + A bug in the &man.xen.4; blkfront driver has been fixed. It could not attach on Citrix XenServer configurations that @@ -799,6 +899,11 @@ circumstances. This improves interoperability between non-&os; NFS servers and &os; NFS clients. + A bug in &man.exports.5; handling in + &os; NFS subsystem has been fixed. It could cause an + unintended security configuration when there are multiple + export entries with different security flavors. + Several bugs in &man.nullfs.5; which could cause a system panic have been fixed. @@ -843,6 +948,15 @@ Userland Changes + The &man.crontab.1; utility now waits + for a second before updating the spool directory's mtime. It + could happen that the modified crontab updated the + mtime of the spool directory, and then + &man.crontab.1; utility updated the mtime + again within a second. In this case, the + crontab database is not updated + properly. + The default dot.cshrc file for &man.csh.1; and &man.tcsh.1; has been changed. For more detail, see @@ -864,6 +978,14 @@ percent-encoded string in user and password component of a URL. + The maximum number of HTTP redirection + has been increased from 5 to + 20 in the &man.fetch.1; utility. + + The &man.fetch.1; utility now + supports HTTP status code 305 (Use Proxy) + and 308 (Permanent Redirect). + A new environment variable PROFIL_USE_PID has been added to generate profiling data for the &man.gprof.1; utility with a filename @@ -908,6 +1030,21 @@ &man.setusercontext.3; function) from working when the password is not set. + The &man.make.1; utility has been + updated to version 8201210080. It now + supports + variable expansion, and :tu and + :tl variable modifiers. + + The &man.mktemp.1; utility now uses + tmp as the default prefix when no + is specified. + + The &man.mv.1; utility now supports + flag. This forces it to treat a symbolic + link to a directory for the target as a symbolic instead of a + directory. + The &man.pam.exec.8; module now supports . When this option is enabled, the program exit status is used as the @@ -926,6 +1063,11 @@ by version 1 of PCI-express Advanced Error Reporting (AER). + A workaround has been implemented in + &man.ppp.8; daemon to support some 3G modems which return a + wrong signature in echo packets and make it impossible to use + LQR and ECHO. + The &man.procstat.1; utility now displays osreldate in binary information for a process. @@ -942,6 +1084,10 @@ keyword to show the number of copy-on-write faults in a process. + The &man.ps.1; utility now supports + dsiz and ssiz keywords + to show data and stack size respectively. + A bug in the &man.remquo.3; functions where the quotient did not always have the correct sign when the remainder was 0, and another bug that the remainder and @@ -967,6 +1113,18 @@ option to specify the socket list to be limited to a specific &man.jail.8; ID. + A variable + NO_FOO in + &man.src.conf.5; now overrides + WITH_FOO. + + The &man.syslogd.8; daemon now supports + IPv6 address as destination address in + &man.syslog.conf.5;. + + The &man.top.1; utility now displays ZFS + ARC memory usage on hosts using ZFS. + A bug in &man.traceroute.8; utility which could result in not accepting any incoming packets has been fixed. @@ -1009,6 +1167,10 @@ SIGINFO is issued. This message was sent to standard output and could prevent redirection from working. + + The rc.d/jail + script now supports jail_parameters + variable to specify extra parameters for each jail. @@ -1021,12 +1183,15 @@ Contributed Software - ISC BIND has - been updated to 9.6-ESV-R7-P1. + ISC BIND has + been updated to 9.6-ESV-R7-P4. TENEX C shell (&man.tcsh.1;) has been updated to version 6.18.01. + LESS + (&man.less.1;) has been updated to version v451. + netcat has been updated to a version as of OpenBSD 5.1. @@ -1041,6 +1206,15 @@ Ports/Packages Collection Infrastructure + The pkg(8) command + has been added. This is used as a bootstrap tool for + ports-mgmt/pkg in the Ports + Collection. + + The &man.pkg.add.1; utility now suports + PACKAGESUFFIX to specify extension in a + package filename. + The &man.pkg.create.1; program now allows a relative pathname in the option. Modified: releng/8.4/release/doc/en_US.ISO8859-1/relnotes/man-refs.ent ============================================================================== --- releng/8.4/release/doc/en_US.ISO8859-1/relnotes/man-refs.ent Sun Jun 2 09:43:48 2013 (r251245) +++ releng/8.4/release/doc/en_US.ISO8859-1/relnotes/man-refs.ent Sun Jun 2 10:19:14 2013 (r251246) @@ -6,6 +6,7 @@ libusb_get_max_iso_packet_size3"> pcf85634"> +uchcom4"> boot.config5"> From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 10:32:58 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 765F4CEC; Sun, 2 Jun 2013 10:32:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 67CAA1E17; Sun, 2 Jun 2013 10:32:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52AWw6I021853; Sun, 2 Jun 2013 10:32:58 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52AWwWm021851; Sun, 2 Jun 2013 10:32:58 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201306021032.r52AWwWm021851@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 2 Jun 2013 10:32:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251247 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 10:32:58 -0000 Author: hselasky Date: Sun Jun 2 10:32:57 2013 New Revision: 251247 URL: http://svnweb.freebsd.org/changeset/base/251247 Log: Correct some XHCI streams mode transfer handling found by code inspection. The existing streams mode support is not working and has not been tested due to lack of hardware which supports the given feature. MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/controller/xhci.h Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Sun Jun 2 10:19:14 2013 (r251246) +++ head/sys/dev/usb/controller/xhci.c Sun Jun 2 10:32:57 2013 (r251247) @@ -133,8 +133,9 @@ static struct xhci_endpoint_ext *xhci_ge static usb_proc_callback_t xhci_configure_msg; static usb_error_t xhci_configure_device(struct usb_device *); static usb_error_t xhci_configure_endpoint(struct usb_device *, - struct usb_endpoint_descriptor *, uint64_t, uint16_t, - uint8_t, uint8_t, uint8_t, uint16_t, uint16_t, uint8_t); + struct usb_endpoint_descriptor *, struct xhci_endpoint_ext *, + uint16_t, uint8_t, uint8_t, uint8_t, uint16_t, uint16_t, + uint8_t); static usb_error_t xhci_configure_mask(struct usb_device *, uint32_t, uint8_t); static usb_error_t xhci_cmd_evaluate_ctx(struct xhci_softc *, @@ -767,15 +768,17 @@ xhci_skip_transfer(struct usb_xfer *xfer static void xhci_check_transfer(struct xhci_softc *sc, struct xhci_trb *trb) { + struct xhci_endpoint_ext *pepext; int64_t offset; uint64_t td_event; uint32_t temp; uint32_t remainder; + uint16_t stream_id; + uint16_t i; uint8_t status; uint8_t halted; uint8_t epno; uint8_t index; - uint8_t i; /* decode TRB */ td_event = le64toh(trb->qwTrb0); @@ -783,6 +786,7 @@ xhci_check_transfer(struct xhci_softc *s remainder = XHCI_TRB_2_REM_GET(temp); status = XHCI_TRB_2_ERROR_GET(temp); + stream_id = XHCI_TRB_2_STREAM_GET(temp); temp = le32toh(trb->dwTrb3); epno = XHCI_TRB_3_EP_GET(temp); @@ -792,8 +796,8 @@ xhci_check_transfer(struct xhci_softc *s halted = (status != XHCI_TRB_ERROR_SHORT_PKT && status != XHCI_TRB_ERROR_SUCCESS); - DPRINTF("slot=%u epno=%u remainder=%u status=%u\n", - index, epno, remainder, status); + DPRINTF("slot=%u epno=%u stream=%u remainder=%u status=%u\n", + index, epno, stream_id, remainder, status); if (index > sc->sc_noslot) { DPRINTF("Invalid slot.\n"); @@ -805,15 +809,22 @@ xhci_check_transfer(struct xhci_softc *s return; } + pepext = &sc->sc_hw.devs[index].endp[epno]; + + if (pepext->trb_ep_mode != USB_EP_MODE_STREAMS) { + stream_id = 0; + DPRINTF("stream_id=0\n"); + } else if (stream_id >= XHCI_MAX_STREAMS) { + DPRINTF("Invalid stream ID.\n"); + return; + } + /* try to find the USB transfer that generated the event */ for (i = 0; i != (XHCI_MAX_TRANSFERS - 1); i++) { struct usb_xfer *xfer; struct xhci_td *td; - struct xhci_endpoint_ext *pepext; - pepext = &sc->sc_hw.devs[index].endp[epno]; - - xfer = pepext->xfer[i]; + xfer = pepext->xfer[i + (XHCI_MAX_TRANSFERS * stream_id)]; if (xfer == NULL) continue; @@ -1265,7 +1276,7 @@ xhci_set_address(struct usb_device *udev pepext = xhci_get_endpoint_ext(udev, &udev->ctrl_ep_desc); err = xhci_configure_endpoint(udev, - &udev->ctrl_ep_desc, pepext->physaddr, + &udev->ctrl_ep_desc, pepext, 0, 1, 1, 0, mps, mps, USB_EP_MODE_DEFAULT); if (err != 0) { @@ -2104,14 +2115,15 @@ xhci_configure_mask(struct usb_device *u static usb_error_t xhci_configure_endpoint(struct usb_device *udev, - struct usb_endpoint_descriptor *edesc, uint64_t ring_addr, - uint16_t interval, uint8_t max_packet_count, uint8_t mult, - uint8_t fps_shift, uint16_t max_packet_size, + struct usb_endpoint_descriptor *edesc, struct xhci_endpoint_ext *pepext, + uint16_t interval, uint8_t max_packet_count, + uint8_t mult, uint8_t fps_shift, uint16_t max_packet_size, uint16_t max_frame_size, uint8_t ep_mode) { struct usb_page_search buf_inp; struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); struct xhci_input_dev_ctx *pinp; + uint64_t ring_addr = pepext->physaddr; uint32_t temp; uint8_t index; uint8_t epno; @@ -2142,6 +2154,10 @@ xhci_configure_endpoint(struct usb_devic if (mult == 0) return (USB_ERR_BAD_BUFSIZE); + /* store endpoint mode */ + pepext->trb_ep_mode = ep_mode; + usb_pc_cpu_flush(pepext->page_cache); + if (ep_mode == USB_EP_MODE_STREAMS) { temp = XHCI_EPCTX_0_EPSTATE_SET(0) | XHCI_EPCTX_0_MAXP_STREAMS_SET(XHCI_MAX_STREAMS_LOG - 1) | @@ -2286,7 +2302,7 @@ xhci_configure_endpoint_by_xfer(struct u usb_pc_cpu_flush(pepext->page_cache); return (xhci_configure_endpoint(xfer->xroot->udev, - xfer->endpoint->edesc, pepext->physaddr, + xfer->endpoint->edesc, pepext, xfer->interval, xfer->max_packet_count, (ecomp != NULL) ? UE_GET_SS_ISO_MULT(ecomp->bmAttributes) + 1 : 1, usbd_xfer_get_fps_shift(xfer), xfer->max_packet_size, @@ -2701,6 +2717,9 @@ xhci_transfer_insert(struct usb_xfer *xf if (inext >= (XHCI_MAX_TRANSFERS - 1)) inext = 0; + /* store next TRB index, before stream ID offset is added */ + pepext->trb_index[id] = inext; + /* offset for stream */ i += id * XHCI_MAX_TRANSFERS; inext += id * XHCI_MAX_TRANSFERS; @@ -2750,8 +2769,6 @@ xhci_transfer_insert(struct usb_xfer *xf xfer->flags_int.bandwidth_reclaimed = 1; - pepext->trb_index[id] = inext; - xhci_endpoint_doorbell(xfer); return (0); @@ -3674,7 +3691,7 @@ restart: if ((pepext->trb_halted != 0) || (pepext->trb_running == 0)) { - uint8_t i; + uint16_t i; /* clear halted and running */ pepext->trb_halted = 0; @@ -3682,7 +3699,8 @@ restart: /* nuke remaining buffered transfers */ - for (i = 0; i != (XHCI_MAX_TRANSFERS - 1); i++) { + for (i = 0; i != (XHCI_MAX_TRANSFERS * + XHCI_MAX_STREAMS); i++) { /* * NOTE: We need to use the timeout * error code here else existing Modified: head/sys/dev/usb/controller/xhci.h ============================================================================== --- head/sys/dev/usb/controller/xhci.h Sun Jun 2 10:19:14 2013 (r251246) +++ head/sys/dev/usb/controller/xhci.h Sun Jun 2 10:32:57 2013 (r251247) @@ -369,6 +369,7 @@ struct xhci_endpoint_ext { uint8_t trb_index[XHCI_MAX_STREAMS]; uint8_t trb_halted; uint8_t trb_running; + uint8_t trb_ep_mode; }; enum { From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 10:35:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 492EFE6A; Sun, 2 Jun 2013 10:35:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E160D1E24; Sun, 2 Jun 2013 10:35:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52AZ863022331; Sun, 2 Jun 2013 10:35:08 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52AZ88o022330; Sun, 2 Jun 2013 10:35:08 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201306021035.r52AZ88o022330@svn.freebsd.org> From: Michael Tuexen Date: Sun, 2 Jun 2013 10:35:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251248 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 10:35:09 -0000 Author: tuexen Date: Sun Jun 2 10:35:08 2013 New Revision: 251248 URL: http://svnweb.freebsd.org/changeset/base/251248 Log: Use LIST_EMPTY when appropriate. MFC after: 1 week Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sun Jun 2 10:32:57 2013 (r251247) +++ head/sys/netinet/sctputil.c Sun Jun 2 10:35:08 2013 (r251248) @@ -3973,7 +3973,7 @@ sctp_abort_an_association(struct sctp_in if (stcb == NULL) { /* Got to have a TCB */ if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { - if (LIST_FIRST(&inp->sctp_asoc_list) == NULL) { + if (LIST_EMPTY(&inp->sctp_asoc_list)) { sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, SCTP_CALLED_DIRECTLY_NOCMPSET); } @@ -4028,7 +4028,7 @@ sctp_handle_ootb(struct mbuf *m, int iph SCTP_STAT_INCR_COUNTER32(sctps_outoftheblue); /* Generate a TO address for future reference */ if (inp && (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) { - if (LIST_FIRST(&inp->sctp_asoc_list) == NULL) { + if (LIST_EMPTY(&inp->sctp_asoc_list)) { sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, SCTP_CALLED_DIRECTLY_NOCMPSET); } From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 10:54:48 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 01F0E420; Sun, 2 Jun 2013 10:54:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E7D4D1EAF; Sun, 2 Jun 2013 10:54:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52Asl0n028899; Sun, 2 Jun 2013 10:54:47 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52Asltk028898; Sun, 2 Jun 2013 10:54:47 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201306021054.r52Asltk028898@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 2 Jun 2013 10:54:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251249 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 10:54:48 -0000 Author: hselasky Date: Sun Jun 2 10:54:47 2013 New Revision: 251249 URL: http://svnweb.freebsd.org/changeset/base/251249 Log: Don't set the start ISOC ASAP bit for non-isochronous TRBs. MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Sun Jun 2 10:35:08 2013 (r251248) +++ head/sys/dev/usb/controller/xhci.c Sun Jun 2 10:54:47 2013 (r251249) @@ -1700,14 +1700,17 @@ restart: dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_TYPE_SET(temp->trb_type) | - (temp->do_isoc_sync ? - XHCI_TRB_3_FRID_SET(temp->isoc_frame / 8) : - XHCI_TRB_3_ISO_SIA_BIT) | XHCI_TRB_3_TBC_SET(temp->tbc) | XHCI_TRB_3_TLBPC_SET(temp->tlbpc); - temp->do_isoc_sync = 0; - + if (temp->trb_type == XHCI_TRB_TYPE_ISOCH) { + if (temp->do_isoc_sync != 0) { + temp->do_isoc_sync = 0; + dword |= XHCI_TRB_3_FRID_SET(temp->isoc_frame / 8); + } else { + dword |= XHCI_TRB_3_ISO_SIA_BIT; + } + } if (temp->direction == UE_DIR_IN) { dword |= XHCI_TRB_3_DIR_IN; From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 11:44:25 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AFE7E8EE; Sun, 2 Jun 2013 11:44:25 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 911891FA6; Sun, 2 Jun 2013 11:44:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52BiPUD046152; Sun, 2 Jun 2013 11:44:25 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52BiNLn046138; Sun, 2 Jun 2013 11:44:23 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201306021144.r52BiNLn046138@svn.freebsd.org> From: Tijl Coosemans Date: Sun, 2 Jun 2013 11:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251250 - in head: lib/ncurses/form lib/ncurses/menu lib/ncurses/panel release sys/boot/arm/at91 sys/boot/arm/at91/boot2 sys/boot/arm/ixp425 sys/boot/arm/ixp425/boot2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 11:44:25 -0000 Author: tijl Date: Sun Jun 2 11:44:23 2013 New Revision: 251250 URL: http://svnweb.freebsd.org/changeset/base/251250 Log: Convert old make variable modifiers :U and :L to bmake :tu and :tl. Reviewed by: sjg Modified: head/lib/ncurses/form/Makefile head/lib/ncurses/menu/Makefile head/lib/ncurses/panel/Makefile head/release/Makefile head/sys/boot/arm/at91/Makefile.inc head/sys/boot/arm/at91/boot2/Makefile head/sys/boot/arm/ixp425/Makefile.inc head/sys/boot/arm/ixp425/boot2/Makefile Modified: head/lib/ncurses/form/Makefile ============================================================================== --- head/lib/ncurses/form/Makefile Sun Jun 2 10:54:47 2013 (r251249) +++ head/lib/ncurses/form/Makefile Sun Jun 2 11:44:23 2013 (r251250) @@ -54,7 +54,7 @@ CLEANFILES= ncurses_def.h CFLAGS+= -I${SRCDIR} CFLAGS+= -I${NCURSES_DIR}/menu -DPADD= ${LIBNCURSES${LIB_SUFFIX:U}} +DPADD= ${LIBNCURSES${LIB_SUFFIX:tu}} LDADD= -lncurses${LIB_SUFFIX} .if defined(ENABLE_WIDEC) Modified: head/lib/ncurses/menu/Makefile ============================================================================== --- head/lib/ncurses/menu/Makefile Sun Jun 2 10:54:47 2013 (r251249) +++ head/lib/ncurses/menu/Makefile Sun Jun 2 11:44:23 2013 (r251250) @@ -40,7 +40,7 @@ CLEANFILES= ncurses_def.h CFLAGS+= -I${SRCDIR} -DPADD= ${LIBNCURSES${LIB_SUFFIX:U}} +DPADD= ${LIBNCURSES${LIB_SUFFIX:tu}} LDADD= -lncurses${LIB_SUFFIX} .if defined(ENABLE_WIDEC) Modified: head/lib/ncurses/panel/Makefile ============================================================================== --- head/lib/ncurses/panel/Makefile Sun Jun 2 10:54:47 2013 (r251249) +++ head/lib/ncurses/panel/Makefile Sun Jun 2 11:44:23 2013 (r251250) @@ -29,7 +29,7 @@ CLEANFILES= ncurses_def.h CFLAGS+= -I${SRCDIR} -DPADD= ${LIBNCURSES${LIB_SUFFIX:U}} +DPADD= ${LIBNCURSES${LIB_SUFFIX:tu}} LDADD= -lncurses${LIB_SUFFIX} .if defined(ENABLE_WIDEC) Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Sun Jun 2 10:54:47 2013 (r251249) +++ head/release/Makefile Sun Jun 2 11:44:23 2013 (r251250) @@ -113,8 +113,8 @@ reldoc: INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc mkdir -p reldoc .for i in hardware readme relnotes errata - ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:U}.TXT - ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:U}.HTM + ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT + ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM .endfor cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc Modified: head/sys/boot/arm/at91/Makefile.inc ============================================================================== --- head/sys/boot/arm/at91/Makefile.inc Sun Jun 2 10:54:47 2013 (r251249) +++ head/sys/boot/arm/at91/Makefile.inc Sun Jun 2 11:44:23 2013 (r251250) @@ -21,7 +21,7 @@ CFLAGS=-Os -mcpu=arm9 -ffreestanding \ -Wmissing-declarations # -Wstrict-prototypes -CFLAGS+=-DBOOT_${BOOT_FLAVOR:U} +CFLAGS+=-DBOOT_${BOOT_FLAVOR:tu} LIBAT91=${.OBJDIR}/../libat91/libat91.a Modified: head/sys/boot/arm/at91/boot2/Makefile ============================================================================== --- head/sys/boot/arm/at91/boot2/Makefile Sun Jun 2 10:54:47 2013 (r251249) +++ head/sys/boot/arm/at91/boot2/Makefile Sun Jun 2 11:44:23 2013 (r251250) @@ -4,7 +4,7 @@ P=boot2 FILES=${P} -SRCS=arm_init.S boot2.c ${BOOT_FLAVOR:L}_board.c +SRCS=arm_init.S boot2.c ${BOOT_FLAVOR:tl}_board.c NO_MAN= LDFLAGS=-e 0 -T ${.CURDIR}/../linker.cfg OBJS+= ${SRCS:N*.h:R:S/$/.o/g} Modified: head/sys/boot/arm/ixp425/Makefile.inc ============================================================================== --- head/sys/boot/arm/ixp425/Makefile.inc Sun Jun 2 10:54:47 2013 (r251249) +++ head/sys/boot/arm/ixp425/Makefile.inc Sun Jun 2 11:44:23 2013 (r251250) @@ -21,7 +21,7 @@ CFLAGS+=-Os -ffreestanding \ # -Wstrict-prototypes -CFLAGS+=-DBOOT_${BOOT_FLAVOR:U} +CFLAGS+=-DBOOT_${BOOT_FLAVOR:tu} LD ?= ld OBJCOPY ?= objcopy Modified: head/sys/boot/arm/ixp425/boot2/Makefile ============================================================================== --- head/sys/boot/arm/ixp425/boot2/Makefile Sun Jun 2 10:54:47 2013 (r251249) +++ head/sys/boot/arm/ixp425/boot2/Makefile Sun Jun 2 11:44:23 2013 (r251250) @@ -12,7 +12,7 @@ FIXUP_BOOT_DRV=yes P=boot2 FILES=${P} -SRCS=arm_init.S boot2.c ${BOOT_FLAVOR:L}_board.c +SRCS=arm_init.S boot2.c ${BOOT_FLAVOR:tl}_board.c SRCS+=memchr.c memcmp.c memcpy.c memmem.c memset.c printf.c strcmp.c strcpy.c SRCS+=strlen.c ashldi3.c divsi3.S muldi3.c NO_MAN= From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 11:58:32 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F27E5D60; Sun, 2 Jun 2013 11:58:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E50BC1FF8; Sun, 2 Jun 2013 11:58:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52BwVEs050395; Sun, 2 Jun 2013 11:58:31 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52BwVJU050394; Sun, 2 Jun 2013 11:58:31 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201306021158.r52BwVJU050394@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 2 Jun 2013 11:58:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251251 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 11:58:32 -0000 Author: hselasky Date: Sun Jun 2 11:58:31 2013 New Revision: 251251 URL: http://svnweb.freebsd.org/changeset/base/251251 Log: Block event interrupts when we don't need it as soon as possible. Typically this feature is used for isochronous transfers. This reduces the amount of XHCI interrupting. MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Sun Jun 2 11:44:23 2013 (r251250) +++ head/sys/dev/usb/controller/xhci.c Sun Jun 2 11:58:31 2013 (r251251) @@ -1545,6 +1545,7 @@ xhci_setup_generic_chain_sub(struct xhci { struct usb_page_search buf_res; struct xhci_td *td; + struct xhci_td *td_first; struct xhci_td *td_next; struct xhci_td *td_alt_next; uint32_t buf_offset; @@ -1564,7 +1565,7 @@ xhci_setup_generic_chain_sub(struct xhci restart: td = temp->td; - td_next = temp->td_next; + td_next = td_first = temp->td_next; while (1) { @@ -1698,7 +1699,9 @@ restart: td->td_trb[x].dwTrb2 = htole32(dword); + /* BEI: Interrupts are inhibited until EOT */ dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_BEI_BIT | XHCI_TRB_3_TYPE_SET(temp->trb_type) | XHCI_TRB_3_TBC_SET(temp->tbc) | XHCI_TRB_3_TLBPC_SET(temp->tlbpc); @@ -1761,8 +1764,10 @@ restart: td->td_trb[x].dwTrb2 = htole32(dword); + /* BEI: interrupts are inhibited until EOT */ dword = XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK) | - XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_IOC_BIT; + XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_IOC_BIT | + XHCI_TRB_3_BEI_BIT; td->td_trb[x].dwTrb3 = htole32(dword); @@ -1790,9 +1795,14 @@ restart: goto restart; } - /* remove cycle bit from first if we are stepping the TRBs */ - if (temp->step_td) - td->td_trb[0].dwTrb3 &= ~htole32(XHCI_TRB_3_CYCLE_BIT); + /* need to force an interrupt if we are stepping the TRBs */ + if ((temp->direction & UE_DIR_IN) != 0 && temp->multishort == 0) { + /* remove cycle bit from first TRB if we are stepping them */ + if (temp->step_td) + td_first->td_trb[0].dwTrb3 &= ~htole32(XHCI_TRB_3_CYCLE_BIT); + /* make sure the last LINK event generates an interrupt */ + td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_BEI_BIT); + } /* remove chain bit because this is the last TRB in the chain */ td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(15)); @@ -2655,6 +2665,7 @@ xhci_transfer_insert(struct usb_xfer *xf { struct xhci_td *td_first; struct xhci_td *td_last; + struct xhci_trb *trb_link; struct xhci_endpoint_ext *pepext; uint64_t addr; usb_stream_t id; @@ -2730,11 +2741,15 @@ xhci_transfer_insert(struct usb_xfer *xf /* compute terminating return address */ addr += (inext * sizeof(struct xhci_trb)); + /* compute link TRB pointer */ + trb_link = td_last->td_trb + td_last->ntrb; + /* update next pointer of last link TRB */ - td_last->td_trb[td_last->ntrb].qwTrb0 = htole64(addr); - td_last->td_trb[td_last->ntrb].dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); - td_last->td_trb[td_last->ntrb].dwTrb3 = htole32(XHCI_TRB_3_IOC_BIT | - XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK)); + trb_link->qwTrb0 = htole64(addr); + trb_link->dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); + trb_link->dwTrb3 = htole32(XHCI_TRB_3_IOC_BIT | + XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK)); #ifdef USB_DEBUG xhci_dump_trb(&td_last->td_trb[td_last->ntrb]); From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 12:00:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AC801BA; Sun, 2 Jun 2013 12:00:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9F60A101F; Sun, 2 Jun 2013 12:00:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52C0GTf050904; Sun, 2 Jun 2013 12:00:16 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52C0GOE050903; Sun, 2 Jun 2013 12:00:16 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201306021200.r52C0GOE050903@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 2 Jun 2013 12:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251252 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 12:00:16 -0000 Author: hselasky Date: Sun Jun 2 12:00:16 2013 New Revision: 251252 URL: http://svnweb.freebsd.org/changeset/base/251252 Log: Use the correct constant for 8000 IRQ/s. MFC after: 1 week Modified: head/sys/dev/usb/controller/xhcireg.h Modified: head/sys/dev/usb/controller/xhcireg.h ============================================================================== --- head/sys/dev/usb/controller/xhcireg.h Sun Jun 2 11:58:31 2013 (r251251) +++ head/sys/dev/usb/controller/xhcireg.h Sun Jun 2 12:00:16 2013 (r251252) @@ -166,7 +166,7 @@ #define XHCI_IMOD_IVAL_SET(x) (((x) & 0xFFFF) << 0) /* 250ns unit */ #define XHCI_IMOD_ICNT_GET(x) (((x) >> 16) & 0xFFFF) /* 250ns unit */ #define XHCI_IMOD_ICNT_SET(x) (((x) & 0xFFFF) << 16) /* 250ns unit */ -#define XHCI_IMOD_DEFAULT 0x000001F4U /* 8000 IRQ/second */ +#define XHCI_IMOD_DEFAULT 0x000003E8U /* 8000 IRQ/second */ #define XHCI_ERSTSZ(n) (0x0028 + (0x20 * (n))) /* XHCI event ring segment table size */ #define XHCI_ERSTS_GET(x) ((x) & 0xFFFF) #define XHCI_ERSTS_SET(x) ((x) & 0xFFFF) From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 12:16:59 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D3C3355F; Sun, 2 Jun 2013 12:16:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ACD61108F; Sun, 2 Jun 2013 12:16:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52CGxBI057591; Sun, 2 Jun 2013 12:16:59 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52CGxCM057590; Sun, 2 Jun 2013 12:16:59 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201306021216.r52CGxCM057590@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 2 Jun 2013 12:16:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251253 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 12:16:59 -0000 Author: hselasky Date: Sun Jun 2 12:16:58 2013 New Revision: 251253 URL: http://svnweb.freebsd.org/changeset/base/251253 Log: Correct TRB type for multi TRB transfers of non-NORMAL type, like isochronous. Only the first TRB should be markes as special. Subsequent ones should be marked as NORMAL. Optimise away TD first variable. MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Sun Jun 2 12:00:16 2013 (r251252) +++ head/sys/dev/usb/controller/xhci.c Sun Jun 2 12:16:58 2013 (r251253) @@ -1545,7 +1545,6 @@ xhci_setup_generic_chain_sub(struct xhci { struct usb_page_search buf_res; struct xhci_td *td; - struct xhci_td *td_first; struct xhci_td *td_next; struct xhci_td *td_alt_next; uint32_t buf_offset; @@ -1555,6 +1554,7 @@ xhci_setup_generic_chain_sub(struct xhci uint8_t shortpkt_old; uint8_t precompute; uint8_t x; + uint8_t first_trb = 1; td_alt_next = NULL; buf_offset = 0; @@ -1565,7 +1565,7 @@ xhci_setup_generic_chain_sub(struct xhci restart: td = temp->td; - td_next = td_first = temp->td_next; + td_next = temp->td_next; while (1) { @@ -1702,10 +1702,21 @@ restart: /* BEI: Interrupts are inhibited until EOT */ dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_BEI_BIT | - XHCI_TRB_3_TYPE_SET(temp->trb_type) | XHCI_TRB_3_TBC_SET(temp->tbc) | XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (first_trb != 0) { + first_trb = 0; + dword |= XHCI_TRB_3_TYPE_SET(temp->trb_type); + /* + * Remove cycle bit from the first TRB + * if we are stepping them: + */ + if (temp->step_td != 0) + dword &= ~XHCI_TRB_3_CYCLE_BIT; + } else { + dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL); + } if (temp->trb_type == XHCI_TRB_TYPE_ISOCH) { if (temp->do_isoc_sync != 0) { temp->do_isoc_sync = 0; @@ -1797,9 +1808,6 @@ restart: /* need to force an interrupt if we are stepping the TRBs */ if ((temp->direction & UE_DIR_IN) != 0 && temp->multishort == 0) { - /* remove cycle bit from first TRB if we are stepping them */ - if (temp->step_td) - td_first->td_trb[0].dwTrb3 &= ~htole32(XHCI_TRB_3_CYCLE_BIT); /* make sure the last LINK event generates an interrupt */ td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_BEI_BIT); } From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 12:28:30 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7DA518A1; Sun, 2 Jun 2013 12:28:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 704EC10E9; Sun, 2 Jun 2013 12:28:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52CSULa061244; Sun, 2 Jun 2013 12:28:30 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52CSULF061243; Sun, 2 Jun 2013 12:28:30 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201306021228.r52CSULF061243@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 2 Jun 2013 12:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251254 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 12:28:30 -0000 Author: hselasky Date: Sun Jun 2 12:28:29 2013 New Revision: 251254 URL: http://svnweb.freebsd.org/changeset/base/251254 Log: Correct the TD size computation. npkt should reflect the number of packets remaining after the current TRB has been executed. Refer to section 4.11.2.4 of the XHCI specification for USB. MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Sun Jun 2 12:16:58 2013 (r251253) +++ head/sys/dev/usb/controller/xhci.c Sun Jun 2 12:28:29 2013 (r251254) @@ -1550,6 +1550,7 @@ xhci_setup_generic_chain_sub(struct xhci uint32_t buf_offset; uint32_t average; uint32_t len_old; + uint32_t npkt_off; uint32_t dword; uint8_t shortpkt_old; uint8_t precompute; @@ -1560,6 +1561,7 @@ xhci_setup_generic_chain_sub(struct xhci buf_offset = 0; shortpkt_old = temp->shortpkt; len_old = temp->len; + npkt_off = 0; precompute = 1; restart: @@ -1666,7 +1668,7 @@ restart: /* fill out buffer pointers */ if (average == 0) { - npkt = 1; + npkt = 0; memset(&buf_res, 0, sizeof(buf_res)); } else { usbd_get_page(temp->pc, temp->offset + @@ -1680,8 +1682,10 @@ restart: if (buf_res.length > XHCI_TD_PAGE_SIZE) buf_res.length = XHCI_TD_PAGE_SIZE; + npkt_off += buf_res.length; + /* setup npkt */ - npkt = (average + temp->max_packet_size - 1) / + npkt = (len_old - npkt_off + temp->max_packet_size - 1) / temp->max_packet_size; if (npkt > 31) From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 15:36:30 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6C58BB86; Sun, 2 Jun 2013 15:36:30 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D7861DF4; Sun, 2 Jun 2013 15:36:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52FaU07027915; Sun, 2 Jun 2013 15:36:30 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52FaU7x027913; Sun, 2 Jun 2013 15:36:30 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306021536.r52FaU7x027913@svn.freebsd.org> From: Hiroki Sato Date: Sun, 2 Jun 2013 15:36:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r251255 - releng/8.4/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 15:36:30 -0000 Author: hrs Date: Sun Jun 2 15:36:29 2013 New Revision: 251255 URL: http://svnweb.freebsd.org/changeset/base/251255 Log: Update relnotes item: comconsole_port and _pcidev loader variable, hw.broken_txfifo tunable, ule(4) SMT logical CPU selection improved, atkbdc(4) Synaptics touchpad v7.5, puc(4) more devices, syscons(4) mouse detach handling fixed, uart(4) more devices, virtio(4) in GENERIC, xhci(4) port routing, more devices, snd_uaudio(4) USB Audio v2.0, more devices, age(4) jumbo frame bugfix, bge(4) more devices, cxgbe(4) 1.8.4, em(4) 7.3.7 and lem(4) 2.3.9, ixgbe(4) 1.1.4, oce(4) 4.6.95.0, rl(4) more devices, u3g(4) more devices, bpf(4) performance improvement, IP_RECVTOS sockopt, net.inet.tcp.rexmit_drop_options added, arcmsr(4) 1.20.00.26, ata(4) more devices, ata(4) SATA revision tunables, kern.cam.da.da_send_ordered rename, hpt27xx(4) in GENERIC, mfi(4) hw.mfi.allow_cam_disk_passthrough, GEOM_RAID Intel RRT, GEOM_RAID BIO_DELETE support, linprocfs(5) /proc/filesystems, msdosfs(5) bugfix, ZFS SPA v5000, ZFS import bugfix, atrun(8) loadavg fix, chkgrp(8) -q flag, cut(1) -w flag, devd(8) ! operator, du(1) -g flag, workaround for CVE-2010-2632, ifconfig state for carp(4), inetd(8) listen queue fix, ip6addrctl(8) policy updated to RFC 6724, rarpd(8) -P flag, systat(1) fractional number support, tcpdrop(8) colon-separated list support, zfs(8) jail/unjail name/id support, service(8) -R flag, AWK 20121220, ISC BIND 9.8.4-P2, BZIP2 1.0.6, libexpat 2.1.0, netcat 5.2, OpenSSH 6.1, OpenSSL 0.9.8y, sendmail 8.14.7, tzdata2012j, and XZ 5.0.4. Approved by: re (implicitly) Modified: releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml releng/8.4/release/doc/en_US.ISO8859-1/relnotes/man-refs.ent Modified: releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jun 2 12:28:29 2013 (r251254) +++ releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jun 2 15:36:29 2013 (r251255) @@ -253,6 +253,24 @@ A bug which could cause a kernel thread to have a wrong CPU affinity configuration has been fixed. + &man.loader.8; environment variables + comconsole_port and + comconsole_pcidev have been added. The + former allows to set the base address of the serial console + I/O port. The later takes the string of the format + bus:device:function:[bar] + as a value and uses the serial port attached as PCI device at + the specified location for console. Both variants pass + hw.uart.console variable to the + &man.uart.4; driver to properly hand-over the kernel + console. + + A new &man.loader.8; tunable + hw.broken_txfifo has been added to enable + workaround for old version of QEMU + and Xen which have a buggy emulated + UART. + The F_DUPFD_CLOEXEC command for &man.fcntl.2; has been implemented. This is standardized in IEEE Std @@ -278,6 +296,17 @@ GENERIC kernel to support break-to-debugger capability. + The &os; &man.sched.ule.4; scheduler has + been improved in CPU selection on systems which support SMT + (Symmetric MultiThreading, also known as HyperThreading on + Intel CPUs). It now prefers a logical CPU when the the other + logical CPUs on the physical one are idle, and an idle CPU in + an SMT CPU group always has lower priority. The CPU load + calculation for load balancing has also been improved to + consider highest and lowest CPU load in comparison to + differentiate load in CPU groups. This change gives 10-15% + performance improvement in SMT CPUs such as Core i7. + The &man.shm.map.9; and &man.shm.unmap.9; functions have been added to allow in-kernel code to map portions of shared memory objects created by @@ -389,6 +418,10 @@ found on machines which have Japanese PS/2 keyboard with 106/109 keys. + The + &man.atkbdc.4; driver now supports Synaptics touchpad v7.5 + and above. + A bug in &man.cpufreq.4; which could prevent CPU frequency tuning from working properly has been fixed. @@ -406,10 +439,12 @@ bus briges. This change improves handling of MSIs on AMD CPUs. - The &man.puc.4; driver now - supports Sun 1040 PCI Quad Serial and Moxa PCIe + The &man.puc.4; + driver now supports Sun 1040 PCI Quad Serial, Moxa PCIe CP102E/CP102EL/CP104EL-A/CP104JU/CP114EL/CP118EL-A/CP168EL-A - multiport serial boards. + multiport serial boards, Advantech PCI-1602 RS-485/RS-422 + serial card, and Sunix SER5437A dual serial PCI Express + card. The &man.random.4; driver now supports VIA C3 Nehemiah random number generator @@ -427,11 +462,21 @@ Danish ISO-8859-1 keyboard found on Apple MacBook has been added. + A bug in the &man.syscons.4; driver + has been fixed. It could cause a button of a USB mouse to + be pressed and never released after detaching. + The &man.uart.4; driver now supports Intel AMT Serial Port for Remote Keyboard and Text (KT) Redirection (Serial Over LAN) on Intel 4 Series Chipset family. + The &man.uart.4; driver + now supports Wacom Tablet at FuS Lifebook T, multiport + serial device IrDA devices with PnP ID PNP0502, PNP0510, and + PNP0511, V.34 modems based on CIR1000 Cirrus Logic chip, and + MosChip MCS9904 four serial ports controller. + The &man.uftdi.4; driver now supports BeagleBone and FT2232-based egnite Turtelizer 2 JTAG/RS232 Adapter. @@ -460,10 +505,10 @@ supports Silicon Laboratories CP2103/CP2104/CP2105 based USB serial adapter. - The paravirtualized - virtio drivers have been added as - kernel modules. They include PCI fontend, - net, block, + The + paravirtualized &man.virtio.4; drivers have been added to + GENERIC kernel. They include PCI + fontend, net, block, balloon, and scsi drivers. The module files are virtio.ko, @@ -477,6 +522,17 @@ supports the watchdog timer found in Winbond Super I/O chips, has been added. + The &man.xhci.4; USB driver now + supports XHCI port routing on Intel 7 Series chipsets + (Panther Point) and Intel 8 Series chipsets (Lynx Point). A + new &man.loader.8; tunable + hw.usb.xhci.xhci_port_route has been + added for routing bitmap for switching EHCI ports to XHCI + controller. + + The &man.xhci.4; USB driver now + supports Etron EJ168 USB 3.0 Host Controllers. + Multimedia Support @@ -492,11 +548,26 @@ controller, multichannel recording, additional playback/record streams, higher bandwidth, and more informative device names. + + The &man.snd.uaudio.4; driver now + supports USB Audio v2.0. + + The &man.snd.uaudio.4; driver now + supports Intel 8 Series chipsets (Lynx Point). + + The &man.snd.uaudio.4; driver now + supports various Yamaha keyboards. + + The &man.snd.uaudio.4; driver now + supports buttons such as volume up/down. Network Interface Support + The &man.age.4; network interface + driver now supports jumbo frames. + Link state change handling in the &man.ale.4; network driver has been improved. @@ -524,6 +595,10 @@ controller connected behind AMD 8131 PCI-X bridge has been fixed. + The &man.bge.4; driver now + supports + BCM5717/5718/5719/5720/5761/57766. controllers. + A bug in if_ierrors counter in the &man.bge.4; driver running on BCM5700, 5701, 5702, 5703, or 5704 @@ -537,10 +612,18 @@ &man.gem.4;, and &man.hme.4; drivers have been added to GENERIC kernel. + The &man.cxgbe.4; network interface + driver has been updated to firmware version 1.8.4. + A bug in statistics counters in the &man.em.4;, lem(4), and &man.igb.4; drivers has been fixed. + The &man.em.4; and lem(4) network + interface drivers have been updated to version 7.3.7 and + 2.3.9, respectively. It now supports Intel 82580 and + I210/I217/I218 interfaces. + The &man.fxp.4; network driver has been improved. It does not cause unnecessary media change in controller reconfiguration such as promiscuos mode @@ -561,14 +644,20 @@ chipsets, and Intel Centrino Wireless-N 100/130 devices. - The &man.mxge.4; driver has been - updated to firmware version 1.4.55 from Myricom. + The &man.ixgbe.4; network interface + driver has been updated to version 1.1.4. A bug in &man.ixgbe.4; network driver has been fixed. It could cause a packet loss in TCP communication when TSO (TCP Segmentation Offload) is enabled. + The &man.mxge.4; driver has been + updated to firmware version 1.4.55 from Myricom. + + The &man.oce.4; network interface + driver has been updated to version 4.6.95.0. + The &man.ral.4; network driver now supports Ralink RT2800 and RT3000 chipsets. @@ -580,6 +669,9 @@ driver which could cause intermittent link up/down on RTL8169 controller has been fixed. + The &man.rl.4; network interface + driver now supports D-Link DFE-520TX rev C1. + WoL (Wake-on-LAN) support in the &man.rl.4; driver is now disabled by default. @@ -602,17 +694,24 @@ The &man.tap.4; pseudo network interface driver now supports VIMAGE &man.jail.8;. - The &man.u3g.4; driver now - supports Qualcomm Vertex Wireless 110L modem, Qualcomm 3G - modem, Qualcomm Vertex VW110L modem, and SIMCom - SIM5218. + The &man.u3g.4; driver + now supports Qualcomm Vertex Wireless 110L modem, Qualcomm + 3G modem, Qualcomm Vertex VW110L modem, SIMCom SIM5218, + and Huawei K4505, K3770, E3131, E392, E3131, K3765, K4505, + and ETS2055 3G modems. + + The &man.udav.4; network interface + driver now supports JP1082 USB-LAN adapter. Network Protocols - The &man.if.bridge.4; pseudo network + The &man.bpf.4; Berkeley Packet Filter + has been improved in the locking performance. + + The &man.if.bridge.4; pseudo network interface driver now supports multiple bridges in the same STP domain. It used the same MAC address as the bridge ID for all bridges on the system. @@ -642,6 +741,12 @@ to specify the maximum number of tables. The default value is 128. + IP_RECVTOS socket + option to receive for received UDP/IPv4 packets a cmsg of type + IP_RECVTOS which contains the TOS byte has been implemented. + This allows to implement a protocol on top of UDP and + implementing ECN. + A bug in &os; IPv6 stack has been fixed. It could cause a &man.vlan.4; pseudo network interface to get the EUI64 part in an autoconfigured IPv6 @@ -720,6 +825,12 @@ cache has been fixed. It could cause extra ICMP message exchanges when an ICMP unreach is received but allocation of the corresponding TCP host cache is failed. + + A &man.sysctl.8; variable + net.inet.tcp.rexmit_drop_options has been + added to not drop options from the third retransmitted SYN. + The default value is set to 1 for + backward compatibility. @@ -729,12 +840,16 @@ Marvell 88SE9220/9230/9235 PCIe 2.0 x2 6Gbps SATA controllers. - The &man.arcmsr.4; driver has been - updated to version 1.20.00.25. + The &man.arcmsr.4; driver has + been updated to version 1.20.00.26 and now supports + ARC-1214 and ARC-1224. A bug in the &man.amr.4; driver which could cause data corruption has been fixed. + The &man.ata.4; driver now supports + Intel 8 Series chipsets (Lynx Point). + The &man.ata.4; driver now creates symbolic links for backward compatibility when kernel option is enabled. In a @@ -749,6 +864,19 @@ kern.cam.ada.legacy_aliases (enabled by default when is set). + The &man.ata.4; driver now has + &man.loader.8; tunables to set initial SATA revision for the + specific device. The tunable name is + hint.ata.busnum.devdevnum.sata_rev + for a device devnum on a bus + busnum, or + hint.ata.busnum.sata_rev + for all devices on a bus busnum. + The valid values are 1, + 2, and 3, which + correspond to 1.5 Gbps, 3 Gbps, and + 6 Gbps. + A new &man.sysctl.8; kern.features.ata_cam has been added. This shows whether ATA_CAM kernel option @@ -770,11 +898,21 @@ SBC-3 (SCSI Block Commands-3) Specification is supported on the device. + The &man.sysctl.8; variables + kern.cam.da.da_send_ordered and + kern.cam.ada.ada_send_ordered have been + renamed with kern.cam.da.send_ordered and + kern.cam.ada.send_ordered. + The &man.da.4; driver has been improved in performance of subsequent BIO_DELETE requests handled as a single TRIM request. + The &man.hpt27xx.4; + driver has been included in GENERIC + kernel. + The &man.hptiop.4; driver has bee updated to version 1.8 and now supports HighPoint RocketRAID 4500/4311/4310/4211/4210/3560/3530. @@ -805,6 +943,12 @@ driver attach LSI MegaRAID cards which should be handled by the &man.mfi.4; driver has been fixed. + The &man.mfi.4; driver now supports + &man.loader.8; tunable + hw.mfi.allow_cam_disk_passthrough to + control raw disk attachment. The default value is + 0 (disabled). + The &man.mps.4; driver has been updated to version 14.00.00.01-fbsd. This now supports Integrated RAID, WarpDrive controllers, @@ -840,6 +984,14 @@ option in &man.graid.8; utility can be used to specify byte order for the DDF metadata. + The RAID + &man.geom.4; class now partially supports Intel Rapid + Recover Technology (Intel RRT). It is alike to RAID1, but + with dedicating master and recovery disks and providing + manual control over synchronization. It allows to use + recovery disk as snapshot of the master disk from the time + of the last sync. + The RAID &man.geom.4; class now supports &man.sysctl.8; variables kern.geom.raid.enable and @@ -856,6 +1008,10 @@ raid1e, raid5, and concat. + The RAID + &man.geom.4; class now supports BIO_DELETE + requests. + The &man.tmpfs.5; filesystem is not an experimental implementation anymore. @@ -875,6 +1031,15 @@ File Systems + The &man.linprocfs.5; filesystem now + supports /proc/filesystems. + + Bugs in &man.msdosfs.5; + which could fail a FAT32 filesystem to mount, create a + broken directory entry in a FAT32 filesystem, and prevent + and mount + option from working, have been fixed. + Bugs in &os; NFS subsystem has been fixed. They could cause stale name cache entries on an NFS client. @@ -907,47 +1072,47 @@ Several bugs in &man.nullfs.5; which could cause a system panic have been fixed. + &os; ZFS subsystem has + been updated to support feature flags for ZFS pools (the SPA + version is 5000). Asynchronous destroy of ZFS dataset, LZ4 + compression, ZIO NOP-write optimization have been + implemented as new feature. &man.loader.8; tunables + vfs.zfs.sync_pass_deferred_free, + vfs.zfs.sync_pass_dont_compress, + vfs.zfs.sync_pass_rewrite, and + vfs.zfs.nopwrite_enabled have been + added. + + Note that this upgrade can cause interoperability issue + when upgrading a &os; 8.4 system to 9.0 or 9.1. This is + because &os; 9.0 and 9.1 support SPA version 28 and do not + recognize version 5000. To mitigate this issue, the default + SPA version for a newly created ZFS pool on &os; 8.4 is set + to version 28. To create a ZFS pool with version 5000, use + &man.zpool.8; upgrade command after the + creation. + + A bug in ZFS subsystem which could + cause a system panic when importing a ZFS pool has been + fixed. + The &man.sysctl.8; variable vfs.zfs.txg.timeout has been changed from read-only to writable. - - ZFS is upgraded to support zpool feature flags. ZFS - pool creation defaults to version 28 allowing upgrades to - &os; 9.1-RELEASE, which does not support - zpool feature flags. - - Users who wish to enable these features can upgrade - storage pools created on &os; 8.4-RC1 and later by - running zpool upgrade. - - The new features available are: - - - - async_destroy: allows a ZFS - dataset to be destroyed asynchronously, reclaiming space - by a background process. - - - - empty_bpobj: improves performance - and reduces disk space needed by snapshots. - - - - lz4_compress: a new high - performance compression algorithm that features better - performance and compression ratio than lzjb. - - - - For more information, see &man.zpool-features.7;. Userland Changes + The load average limit in the + &man.atrun.8; utility has been set based on the number of + CPUs. + + The &man.chkgrp.8; utility now supports + flag to disable printing of text when the + group format is correct. + The &man.crontab.1; utility now waits for a second before updating the spool directory's mtime. It could happen that the modified crontab updated the @@ -957,7 +1122,11 @@ crontab database is not updated properly. - The default + The &man.cut.1; utility now supports + flag to specify whitespace as the + delimiter. + + The default dot.cshrc file for &man.csh.1; and &man.tcsh.1; has been changed. For more detail, see /usr/share/skel/dot.cshrc. @@ -966,6 +1135,11 @@ flag to restart the program if it has been terminated. + The &man.devd.8; daemon now supports + ! character in regex matching in + &man.devd.conf.5;. It inverts the logic of the + matching. + The &man.devfs.5; mount now supports mount option and updating the existing mount by using flag in the @@ -974,6 +1148,10 @@ and applies all its rules at mount time. If the specified ruleset doesn't exist, a new empty ruleset is created. + The &man.du.1; utility now supports + flag to display the results in + gigabytes. + The &man.fetch.1; utility now supports percent-encoded string in user and password component of a URL. @@ -986,15 +1164,34 @@ supports HTTP status code 305 (Use Proxy) and 308 (Permanent Redirect). + A countermeasure against a possible DoS + (Denial of Service) attack described in CVE-2010-2632 in the + &man.ftpd.8; daemon has been implemented. + A new environment variable PROFIL_USE_PID has been added to generate profiling data for the &man.gprof.1; utility with a filename including the process ID. + The &man.ifconfig.8; now supports + state option for &man.carp.4; protocol to + set the state of a carp cluster. The valid keywords are + master and + backup. + A bug in the &man.inetd.8; daemon which could cause wrong accounting for elapsed time has been fixed. + The &man.inetd.8; daemon now set the + listen queue size to the value of + kern.ipc.somaxconn instead of hardcoded value + 64. + + The default &man.ip6addrctl.8; address + selection policy for IPv4 and IPv6 has been updated to one in + RFC 6724. + The &man.kdump.1; utility now supports a option to accept either a process ID or a thread ID. @@ -1088,6 +1285,13 @@ dsiz and ssiz keywords to show data and stack size respectively. + The &man.rarpd.8; daemon now supports + &man.vlan.4; interface and option to + specify the PID file. When flag is + specified, + /var/run/rarpd.ifname.pid + is used as the PID filename by default. + A bug in the &man.remquo.3; functions where the quotient did not always have the correct sign when the remainder was 0, and another bug that the remainder and @@ -1122,6 +1326,15 @@ IPv6 address as destination address in &man.syslog.conf.5;. + The &man.systat.1; utility now accepts + fractional number of seconds. + + The &man.tcpdrop.8; utility now accepts + the address and ports to be separated by a colon or period + rather than a space to permit directly pasting the output of + commands such as netstat and sockstat on the command + line. + The &man.top.1; utility now displays ZFS ARC memory usage on hosts using ZFS. @@ -1149,6 +1362,11 @@ command now supports option. + The &man.zfs.8; jail + and unjail commands now support + jailnames and + jailid. + The &man.zfs.8; send command now reports transmitted data size in bytes when flag is specified. @@ -1171,6 +1389,10 @@ The rc.d/jail script now supports jail_parameters variable to specify extra parameters for each jail. + + The &man.service.8; utility now + supports flag to restart all third party + services in /usr/local/etc/rc.d. @@ -1183,8 +1405,14 @@ Contributed Software - ISC BIND has - been updated to 9.6-ESV-R7-P4. + AWK has been + updated to 20121220. + + ISC BIND has + been updated to version 9.8.4-P2. + + BZIP2 has + been updated to version 1.0.6. TENEX C shell (&man.tcsh.1;) has been updated to version 6.18.01. @@ -1192,15 +1420,27 @@ LESS (&man.less.1;) has been updated to version v451. - netcat has - been updated to a version as of OpenBSD 5.1. + libexpat has + been updated to version 2.1.0. + + netcat has + been updated to a version as of OpenBSD 5.2. - OpenSSL has - been updated to version 0.9.8x. + OpenSSH has + been updated to version 6.1. - The timezone + OpenSSL has + been updated to version 0.9.8y. + + sendmail has + been updated to version 8.14.7. + + The timezone database has been updated to - tzdata2012a release. + tzdata2012j release. + + XZ has been + updated to version 5.0.4. Modified: releng/8.4/release/doc/en_US.ISO8859-1/relnotes/man-refs.ent ============================================================================== --- releng/8.4/release/doc/en_US.ISO8859-1/relnotes/man-refs.ent Sun Jun 2 12:28:29 2013 (r251254) +++ releng/8.4/release/doc/en_US.ISO8859-1/relnotes/man-refs.ent Sun Jun 2 15:36:29 2013 (r251255) @@ -7,6 +7,7 @@ pcf85634"> uchcom4"> +virtio4"> boot.config5"> From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 15:47:22 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D6963EB; Sun, 2 Jun 2013 15:47:22 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ABE361E56; Sun, 2 Jun 2013 15:47:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52FlMLt031768; Sun, 2 Jun 2013 15:47:22 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52FlM4k031766; Sun, 2 Jun 2013 15:47:22 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306021547.r52FlM4k031766@svn.freebsd.org> From: Hiroki Sato Date: Sun, 2 Jun 2013 15:47:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r251256 - releng/8.4/release/doc/en_US.ISO8859-1/hardware X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 15:47:22 -0000 Author: hrs Date: Sun Jun 2 15:47:22 2013 New Revision: 251256 URL: http://svnweb.freebsd.org/changeset/base/251256 Log: Update description of logical CPU handling in the latest releases and remove obsolete sysctl variable machdep.hlt_logical_cpus. Pointed out by: mav Approved by: re (implicitly) Modified: releng/8.4/release/doc/en_US.ISO8859-1/hardware/article.xml Modified: releng/8.4/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- releng/8.4/release/doc/en_US.ISO8859-1/hardware/article.xml Sun Jun 2 15:36:29 2013 (r251255) +++ releng/8.4/release/doc/en_US.ISO8859-1/hardware/article.xml Sun Jun 2 15:47:22 2013 (r251256) @@ -167,20 +167,13 @@ bugs may generate some problems. Perusal of the archives of the &a.smp; may yield some clues. - &os; will take advantage of HyperThreading (HTT) support - on &intel; CPUs that support this feature. A kernel with the - options SMP feature enabled will - automatically detect the additional logical processors. The - default &os; scheduler treats the logical processors the same - as additional physical processors; in other words, no attempt - is made to optimize scheduling decisions given the shared - resources between logical processors within the same CPU. - Because this naive scheduling can result in suboptimal - performance, under certain circumstances it may be useful to - disable the logical processors with the - machdep.hlt_logical_cpus sysctl variable. - It is also possible to halt any CPU in the idle loop with the - machdep.hlt_cpus sysctl variable. The + &os; will take advantage of SMT (Symmetric MultiThreading, + also known as HyperThreading on &intel; CPUs) on the supported + CPUs. The GENERIC kernel which is + installed by default will automatically detect the additional + logical processors. The default &os; scheduler recognizes + processor topology on the system and selects logical and + physical processors to obtain optimal performance. The &man.smp.4; manual page has more details. &os; will take advantage of Physical Address Extensions From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 16:18:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 273AF89C; Sun, 2 Jun 2013 16:18:04 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 19ED31F08; Sun, 2 Jun 2013 16:18:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52GI33w042678; Sun, 2 Jun 2013 16:18:03 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52GI33I042677; Sun, 2 Jun 2013 16:18:03 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201306021618.r52GI33I042677@svn.freebsd.org> From: Alan Cox Date: Sun, 2 Jun 2013 16:18:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251257 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 16:18:04 -0000 Author: alc Date: Sun Jun 2 16:18:03 2013 New Revision: 251257 URL: http://svnweb.freebsd.org/changeset/base/251257 Log: Reduce the scope of the VM object locking in brelse(). In my tests, this change reduced the total number of VM object lock acquisitions by brelse() by 74%. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun Jun 2 15:47:22 2013 (r251256) +++ head/sys/kern/vfs_bio.c Sun Jun 2 16:18:03 2013 (r251257) @@ -1522,7 +1522,6 @@ brelse(struct buf *bp) */ resid = bp->b_bufsize; foff = bp->b_offset; - VM_OBJECT_WLOCK(obj); for (i = 0; i < bp->b_npages; i++) { int had_bogus = 0; @@ -1536,6 +1535,7 @@ brelse(struct buf *bp) poff = OFF_TO_IDX(bp->b_offset); had_bogus = 1; + VM_OBJECT_RLOCK(obj); for (j = i; j < bp->b_npages; j++) { vm_page_t mtmp; mtmp = bp->b_pages[j]; @@ -1547,6 +1547,7 @@ brelse(struct buf *bp) bp->b_pages[j] = mtmp; } } + VM_OBJECT_RUNLOCK(obj); if ((bp->b_flags & (B_INVAL | B_UNMAPPED)) == 0) { BUF_CHECK_MAPPED(bp); @@ -1564,14 +1565,15 @@ brelse(struct buf *bp) (PAGE_SIZE - poffset) : resid; KASSERT(presid >= 0, ("brelse: extra page")); + VM_OBJECT_WLOCK(obj); vm_page_set_invalid(m, poffset, presid); + VM_OBJECT_WUNLOCK(obj); if (had_bogus) printf("avoided corruption bug in bogus_page/brelse code\n"); } resid -= PAGE_SIZE - (foff & PAGE_MASK); foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; } - VM_OBJECT_WUNLOCK(obj); if (bp->b_flags & (B_INVAL | B_RELBUF)) vfs_vmio_release(bp); From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 16:21:03 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4BDEEA36; Sun, 2 Jun 2013 16:21:03 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3E6CC1F20; Sun, 2 Jun 2013 16:21:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52GL3uW044822; Sun, 2 Jun 2013 16:21:03 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52GL3IE044821; Sun, 2 Jun 2013 16:21:03 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306021621.r52GL3IE044821@svn.freebsd.org> From: Hiroki Sato Date: Sun, 2 Jun 2013 16:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r251258 - releng/8.4/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 16:21:03 -0000 Author: hrs Date: Sun Jun 2 16:21:02 2013 New Revision: 251258 URL: http://svnweb.freebsd.org/changeset/base/251258 Log: - Remove an empty section. - Add version number of x11/kde4. Approved by: re (implicitly) Modified: releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jun 2 16:18:03 2013 (r251257) +++ releng/8.4/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jun 2 16:21:02 2013 (r251258) @@ -1394,12 +1394,6 @@ supports flag to restart all third party services in /usr/local/etc/rc.d. - - - <filename>/etc/periodic</filename> Scripts - - - @@ -1463,7 +1457,10 @@ Release Engineering and Integration - + The supported version of the + KDE desktop environment (x11/kde4) has been updated from 4.7.4 + to 4.10.1. From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 16:54:43 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 17F603D6; Sun, 2 Jun 2013 16:54:43 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E3D661FE3; Sun, 2 Jun 2013 16:54:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52GsgHq055969; Sun, 2 Jun 2013 16:54:42 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52GsgIr055968; Sun, 2 Jun 2013 16:54:42 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201306021654.r52GsgIr055968@svn.freebsd.org> From: Glen Barber Date: Sun, 2 Jun 2013 16:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-release@freebsd.org Subject: svn commit: r251259 - release/8.4.0 X-SVN-Group: release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 16:54:43 -0000 Author: gjb (doc,ports committer) Date: Sun Jun 2 16:54:42 2013 New Revision: 251259 URL: http://svnweb.freebsd.org/changeset/base/251259 Log: Copy releng/8.4 to release/8.4.0 as part of the 8.4-RELEASE Approved by: re (jpaetzel) Added: release/8.4.0/ - copied from r251258, releng/8.4/ From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 17:03:12 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6EEE09C7; Sun, 2 Jun 2013 17:03:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 615DB102A; Sun, 2 Jun 2013 17:03:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52H3Cgc059667; Sun, 2 Jun 2013 17:03:12 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52H3COo059666; Sun, 2 Jun 2013 17:03:12 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201306021703.r52H3COo059666@svn.freebsd.org> From: Glen Barber Date: Sun, 2 Jun 2013 17:03:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251260 - stable/8/sys/conf X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 17:03:12 -0000 Author: gjb (doc,ports committer) Date: Sun Jun 2 17:03:11 2013 New Revision: 251260 URL: http://svnweb.freebsd.org/changeset/base/251260 Log: Since release/8.4.0 tag is created, make stable/8 -STABLE again. Approved by: re (implicit) Modified: stable/8/sys/conf/newvers.sh Modified: stable/8/sys/conf/newvers.sh ============================================================================== --- stable/8/sys/conf/newvers.sh Sun Jun 2 16:54:42 2013 (r251259) +++ stable/8/sys/conf/newvers.sh Sun Jun 2 17:03:11 2013 (r251260) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.4" -BRANCH="PRERELEASE" +BRANCH="STABLE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 17:55:01 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 58BD5B0A; Sun, 2 Jun 2013 17:55:01 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4A8BA117F; Sun, 2 Jun 2013 17:55:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52Ht1qr078289; Sun, 2 Jun 2013 17:55:01 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52Ht1V0078286; Sun, 2 Jun 2013 17:55:01 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306021755.r52Ht1V0078286@svn.freebsd.org> From: Eitan Adler Date: Sun, 2 Jun 2013 17:55:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251261 - head/bin/ln X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 17:55:01 -0000 Author: eadler Date: Sun Jun 2 17:55:00 2013 New Revision: 251261 URL: http://svnweb.freebsd.org/changeset/base/251261 Log: Add 'static' where able. Modified: head/bin/ln/ln.c Modified: head/bin/ln/ln.c ============================================================================== --- head/bin/ln/ln.c Sun Jun 2 17:03:11 2013 (r251260) +++ head/bin/ln/ln.c Sun Jun 2 17:55:00 2013 (r251261) @@ -65,8 +65,8 @@ static int wflag; /* Warn if symlink t * exist, and -f is not enabled. */ static char linkch; -int linkit(const char *, const char *, int); -void usage(void); +static int linkit(const char *, const char *, int); +static void usage(void); int main(int argc, char *argv[]) @@ -219,7 +219,7 @@ samedirent(const char *path1, const char return sb1.st_dev == sb2.st_dev && sb1.st_ino == sb2.st_ino; } -int +static int linkit(const char *source, const char *target, int isdir) { struct stat sb; @@ -347,7 +347,7 @@ linkit(const char *source, const char *t return (0); } -void +static void usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n", From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 18:10:08 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0870F278; Sun, 2 Jun 2013 18:10:08 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F05E91226; Sun, 2 Jun 2013 18:10:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52IA7L7083363; Sun, 2 Jun 2013 18:10:07 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52IA7o0083361; Sun, 2 Jun 2013 18:10:07 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306021810.r52IA7o0083361@svn.freebsd.org> From: Eitan Adler Date: Sun, 2 Jun 2013 18:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251262 - head/usr.bin/fetch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 18:10:08 -0000 Author: eadler Date: Sun Jun 2 18:10:07 2013 New Revision: 251262 URL: http://svnweb.freebsd.org/changeset/base/251262 Log: Correct check to see if file changes. Reported by: swildner@DragonFlyBSD.org Reviewed by: des Modified: head/usr.bin/fetch/fetch.c Modified: head/usr.bin/fetch/fetch.c ============================================================================== --- head/usr.bin/fetch/fetch.c Sun Jun 2 17:55:00 2013 (r251261) +++ head/usr.bin/fetch/fetch.c Sun Jun 2 18:10:07 2013 (r251262) @@ -565,7 +565,7 @@ fetch(char *URL, const char *path) goto failure; } if (nsb.st_dev != sb.st_dev || - nsb.st_ino != nsb.st_ino || + nsb.st_ino != sb.st_ino || nsb.st_size != sb.st_size) { warnx("%s: file has changed", URL); fclose(of); From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 18:10:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D27263CA; Sun, 2 Jun 2013 18:10:16 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C5E951237; Sun, 2 Jun 2013 18:10:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52IAGKF083430; Sun, 2 Jun 2013 18:10:16 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52IAGOC083429; Sun, 2 Jun 2013 18:10:16 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201306021810.r52IAGOC083429@svn.freebsd.org> From: Alan Cox Date: Sun, 2 Jun 2013 18:10:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251263 - head/sys/dev/cxgb/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 18:10:16 -0000 Author: alc Date: Sun Jun 2 18:10:16 2013 New Revision: 251263 URL: http://svnweb.freebsd.org/changeset/base/251263 Log: Remove unnecessary #include's. Modified: head/sys/dev/cxgb/sys/uipc_mvec.c Modified: head/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- head/sys/dev/cxgb/sys/uipc_mvec.c Sun Jun 2 18:10:07 2013 (r251262) +++ head/sys/dev/cxgb/sys/uipc_mvec.c Sun Jun 2 18:10:16 2013 (r251263) @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -44,10 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #ifdef INVARIANTS #define M_SANITY m_sanity #else From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 20:02:56 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D211F76F; Sun, 2 Jun 2013 20:02:56 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C27951783; Sun, 2 Jun 2013 20:02:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52K2ufK024887; Sun, 2 Jun 2013 20:02:56 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52K2oZ3024839; Sun, 2 Jun 2013 20:02:50 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022002.r52K2oZ3024839@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 20:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251264 - in head/usr.sbin/bsdconfig: . console mouse networking networking/share password/share security share share/media share/packages startup startup/share timezone usermgmt usermg... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 20:02:56 -0000 Author: dteske Date: Sun Jun 2 20:02:50 2013 New Revision: 251264 URL: http://svnweb.freebsd.org/changeset/base/251264 Log: Standardize the way functions build their arguments leading up to a dialog invocation. Specifically, "top-load" your arguments and in the order in- which they will be displayed. For example, many [if not all] widgets display information in the following order, top-to-bottom (visually): + backtitle (displayed behind the widget at top-left) + title (at the top of the `window') + prompt text (just below the title and above whatever widget you choose) + Depending on widget, _one_ of the following: - menu list - radio list - check list - text input box with initial text - [Xdialog(1)] 2x or 3x text input boxes - [dialog(1)] a multi-part form - progress bar - etc. (many more widget choices) + buttons (right below the selected widget) + [dialog(1)] the hline (displayed at bottom of `window') NOTE: Xdialog(1) accepts and silently ignores --hline When building local arguments for your dialog invocation, if the value can't be cleanly loaded into a local, add "# Calculated below" to the end of the local declaration while retaining the block order of argument declarations. Move other local declarations that are not associated with this top-loading the dialog arguments to right-above where they are first-used. Also, standardize on the names of the arguments. For example, always use $prompt (instead of sometimes $msg and sometimes $prompt); use $menu_list or $shell_list or $radio_list for those respective widgets; ad nauseum. While we're doing this, flush-out full arguments for many invocations that were passing NULL strings (making it unapparent if you were staring at this one invocation what argument that NULL string was supposed to represent). Last, while we're in startup/rcconf let's remove the unnecessary use of a GLOBAL (RCCONF_MENU_LIST) for the menu_list. Modified: head/usr.sbin/bsdconfig/bsdconfig head/usr.sbin/bsdconfig/console/console head/usr.sbin/bsdconfig/console/font head/usr.sbin/bsdconfig/console/keymap head/usr.sbin/bsdconfig/console/repeat head/usr.sbin/bsdconfig/console/saver head/usr.sbin/bsdconfig/console/screenmap head/usr.sbin/bsdconfig/console/ttys head/usr.sbin/bsdconfig/mouse/mouse head/usr.sbin/bsdconfig/mouse/port head/usr.sbin/bsdconfig/mouse/type head/usr.sbin/bsdconfig/networking/networking head/usr.sbin/bsdconfig/networking/share/resolv.subr head/usr.sbin/bsdconfig/password/share/password.subr head/usr.sbin/bsdconfig/security/kern_securelevel head/usr.sbin/bsdconfig/security/security head/usr.sbin/bsdconfig/share/media/any.subr head/usr.sbin/bsdconfig/share/media/ftp.subr head/usr.sbin/bsdconfig/share/media/options.subr head/usr.sbin/bsdconfig/share/mustberoot.subr head/usr.sbin/bsdconfig/share/packages/packages.subr head/usr.sbin/bsdconfig/startup/misc head/usr.sbin/bsdconfig/startup/rcadd head/usr.sbin/bsdconfig/startup/rcconf head/usr.sbin/bsdconfig/startup/rcdelete head/usr.sbin/bsdconfig/startup/rcvar head/usr.sbin/bsdconfig/startup/share/rcconf.subr head/usr.sbin/bsdconfig/startup/startup head/usr.sbin/bsdconfig/timezone/timezone head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr head/usr.sbin/bsdconfig/usermgmt/usermgmt Modified: head/usr.sbin/bsdconfig/bsdconfig ============================================================================== --- head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 20:02:50 2013 (r251264) @@ -50,7 +50,8 @@ USAGE_HELPFILE=$BSDCFG_LIBE/include/usag # usage() { - local index="INDEX" cmd_list="" + local index="INDEX" + local cmd_list # Calculated below cd $BSDCFG_LIBE # No need to preserve CWD (headed toward exit) @@ -145,13 +146,12 @@ dialog_menu_main() local title="$DIALOG_TITLE" local btitle="$DIALOG_BACKTITLE" local prompt="$msg_menu_text" - local menu_list - local defaultitem= # Calculated below - - menu_list=" + local menu_list=" 'X' '$msg_exit' '$msg_exit_bsdconfig' '1' '$msg_usage' '$msg_quick_start_how_to_use_this_menu_system' " # END-QUOTE + local defaultitem= # Calculated below + local hline= local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }" @@ -185,7 +185,7 @@ dialog_menu_main() \"\$title\" \ \"\$btitle\" \ \"\$prompt\" \ - \"\" \ + \"\$hline\" \ $menu_list # Obtain default-item from previously stored selection @@ -196,6 +196,7 @@ dialog_menu_main() --clear \ --title \"\$title\" \ --backtitle \"\$btitle\" \ + --hline \"\$hline\" \ --item-help \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_exit_bsdconfig\" \ Modified: head/usr.sbin/bsdconfig/console/console ============================================================================== --- head/usr.sbin/bsdconfig/console/console Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/console Sun Jun 2 20:02:50 2013 (r251264) @@ -48,12 +48,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list - local hline="$hline_configure_system_console_settings" local prompt="$msg_console_menu_text" - local defaultitem= # Calculated below - - menu_list=" + local menu_list=" 'X $msg_exit' '$msg_exit_this_menu' '2 $msg_font' '$msg_choose_alternate_screen_font' '3 $msg_keymap' '$msg_choose_alternate_keyboard_map' @@ -62,6 +58,8 @@ dialog_menu_main() '6 $msg_screenmap' '$msg_choose_alternate_screenmap' '7 $msg_ttys' '$msg_choose_console_terminal_type' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_configure_system_console_settings" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/console/font ============================================================================== --- head/usr.sbin/bsdconfig/console/font Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/font Sun Jun 2 20:02:50 2013 (r251264) @@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_choose_a_font" local prompt="$msg_font_menu_text" - - menu_list=" + local menu_list=" '1 $msg_none' '$msg_use_hardware_default_font' '2 $msg_ibm_437' '$msg_ibm_437_desc' '3 $msg_ibm_850' '$msg_ibm_850_desc' @@ -69,6 +66,8 @@ dialog_menu_main() 'd $msg_iso_8859_15' '$msg_iso_8859_15_desc' 'e $msg_swiss' '$msg_swiss_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_choose_a_font" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/console/keymap ============================================================================== --- head/usr.sbin/bsdconfig/console/keymap Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/keymap Sun Jun 2 20:02:50 2013 (r251264) @@ -77,9 +77,9 @@ KEYMAP_NAMES=" # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_choose_a_keyboard_map" local prompt="$msg_keymap_menu_text" + local menu_list defaultitem= # Calculated below + local hline="$hline_choose_a_keyboard_map" # # Export variables for awk(1) ENVIRON visibility Modified: head/usr.sbin/bsdconfig/console/repeat ============================================================================== --- head/usr.sbin/bsdconfig/console/repeat Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/repeat Sun Jun 2 20:02:50 2013 (r251264) @@ -49,16 +49,15 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_choose_a_keyboard_repeat_rate" local prompt="$msg_repeat_menu_text" - - menu_list=" + local menu_list=" '$msg_default' '$msg_default_desc' '$msg_slow' '$msg_slow_desc' '$msg_normal' '$msg_normal_desc' '$msg_fast' '$msg_fast_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_choose_a_keyboard_repeat_rate" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/console/saver ============================================================================== --- head/usr.sbin/bsdconfig/console/saver Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/saver Sun Jun 2 20:02:50 2013 (r251264) @@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_choose_a_screen_saver" local prompt="$msg_saver_menu_text" - - menu_list=" + local menu_list=" '1 $msg_blank' '$msg_blank_desc' '2 $msg_beastie' '$msg_beastie_desc' '3 $msg_daemon' '$msg_daemon_desc' @@ -69,6 +66,8 @@ dialog_menu_main() 'd $msg_none' '$msg_none_saver_desc' '$msg_timeout' '$msg_timeout_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_choose_a_screen_saver" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/console/screenmap ============================================================================== --- head/usr.sbin/bsdconfig/console/screenmap Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/screenmap Sun Jun 2 20:02:50 2013 (r251264) @@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_choose_a_screen_map" local prompt="$msg_screenmap_menu_text" - - menu_list=" + local menu_list=" '1 $msg_none' '$msg_none_screenmap_desc' '2 $msg_iso_8859_1_to_ibm437' '$msg_iso_8859_1_to_ibm437_desc' '3 $msg_iso_8859_7_to_ibm437' '$msg_iso_8859_7_to_ibm437_desc' @@ -61,6 +58,8 @@ dialog_menu_main() '5 $msg_koi8_r_to_ibm866' '$msg_koi8_r_to_ibm866_desc' '6 $msg_koi8_u_to_ibm866u' '$msg_koi8_u_to_ibm866u_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_choose_a_screen_map" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/console/ttys ============================================================================== --- head/usr.sbin/bsdconfig/console/ttys Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/ttys Sun Jun 2 20:02:50 2013 (r251264) @@ -72,8 +72,8 @@ TTY_MENU_LIST=" # dialog_menu_main() { - local hline="$hline_choose_a_terminal_type" local prompt="$msg_ttys_menu_text" + local hline="$hline_choose_a_terminal_type" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/mouse/mouse ============================================================================== --- head/usr.sbin/bsdconfig/mouse/mouse Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/mouse/mouse Sun Jun 2 20:02:50 2013 (r251264) @@ -48,12 +48,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list - local hline="" local prompt="$msg_menu_text" - local defaultitem= # Calculated below - - menu_list=" + local menu_list=" 'X $msg_exit' '$msg_exit_this_menu' '2 $msg_enable' '$msg_test_and_run_the_mouse_daemon' '3 $msg_type' '$msg_select_mouse_protocol_type' @@ -61,6 +57,8 @@ dialog_menu_main() '5 $msg_flags' '$msg_set_additional_flags' '6 $msg_disable' '$msg_disable_the_mouse_daemon' " # END-QUOTE + local defaultitem= # Calculated below + local hline= local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/mouse/port ============================================================================== --- head/usr.sbin/bsdconfig/mouse/port Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/mouse/port Sun Jun 2 20:02:50 2013 (r251264) @@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="" local prompt="$msg_port_menu_text" - - menu_list=" + local menu_list=" '1 $msg_ps2' '$msg_ps2_desc' '2 $msg_com1' '$msg_com1_desc' '3 $msg_com2' '$msg_com2_desc' @@ -61,6 +58,8 @@ dialog_menu_main() '5 $msg_com4' '$msg_com4_desc' '6 $msg_busmouse' '$msg_busmouse_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline= local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/mouse/type ============================================================================== --- head/usr.sbin/bsdconfig/mouse/type Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/mouse/type Sun Jun 2 20:02:50 2013 (r251264) @@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="" local prompt="$msg_protocol_menu_text" - - menu_list=" + local menu_list=" '1 $msg_auto' '$msg_auto_desc' '2 $msg_glidepoint' '$msg_glidepoint_desc' '3 $msg_hitachi' '$msg_hitachi_desc' @@ -65,6 +62,8 @@ dialog_menu_main() '9 $msg_mousesystems' '$msg_mousesystems_desc' 'A $msg_thinkingmouse' '$msg_thinkingmouse_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline= local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/networking/networking ============================================================================== --- head/usr.sbin/bsdconfig/networking/networking Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/networking/networking Sun Jun 2 20:02:50 2013 (r251264) @@ -48,23 +48,22 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list - local hline="$hline_arrows_tab_enter" - local defaultitem= # Calculated below - - menu_list=" + local prompt= + local menu_list=" 'X' '$msg_exit' '1' '$msg_hostname_domain' '2' '$msg_network_interfaces' '3' '$msg_default_router' '4' '$msg_dns_nameservers' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" local height width rows eval f_dialog_menu_size height width rows \ \"\$DIALOG_TITLE\" \ \"\$DIALOG_BACKTITLE\" \ - \"\" \ + \"\$prompt\" \ \"\$hline\" \ $menu_list @@ -79,7 +78,7 @@ dialog_menu_main() --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --default-item \"\$defaultitem\" \ - --menu \"\" \ + --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD Modified: head/usr.sbin/bsdconfig/networking/share/resolv.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/resolv.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/networking/share/resolv.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -392,23 +392,24 @@ f_dialog_input_nameserver() # f_dialog_menu_nameservers() { + local prompt="$msg_dns_configuration" + local menu_list # Calculated below + local hline="$hline_arrows_tab_enter" + local defaultitem= local height width rows local opt_exit="$msg_return_to_previous_menu" local opt_add="$msg_add_nameserver" - local hline="$hline_arrows_tab_enter" - local prompt defaultitem= # # Loop forever until the user has finished configuring nameservers # - prompt="$msg_dns_configuration" while :; do # # Re/Build list of nameservers # local nameservers="$( f_resolv_conf_nameservers )" - local menu_list="$( + menu_list=$( index=1 echo "'X $msg_exit' '$opt_exit'" @@ -423,7 +424,7 @@ f_dialog_menu_nameservers() echo "'$tag nameserver' '$ns'" index=$(( $index + 1 )) done - )" + ) # # Display configuration-edit menu Modified: head/usr.sbin/bsdconfig/password/share/password.subr ============================================================================== --- head/usr.sbin/bsdconfig/password/share/password.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/password/share/password.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -45,24 +45,23 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/inc # f_dialog_input_password() { + local prompt1="$msg_enter_new_password" + local prompt2="$msg_reenter_password" local hline="$hline_alnum_punc_tab_enter" - local msg rmsg - msg=$( printf "$msg_enter_new_password" ) local height1 width1 f_dialog_inputbox_size height1 width1 \ "$DIALOG_TITLE" \ "$DIALOG_BACKTITLE" \ - "$msg" \ + "$prompt1" \ "" \ "$hline" - rmsg=$( printf "$msg_reenter_password" ) local height2 width2 f_dialog_inputbox_size height2 width2 \ "$DIALOG_TITLE" \ "$DIALOG_BACKTITLE" \ - "$rmsg" \ + "$prompt2" \ "" \ "$hline" @@ -78,7 +77,7 @@ f_dialog_input_password() --ok-label "$msg_ok" \ --cancel-label "$msg_cancel" \ --insecure \ - --passwordbox "$msg" \ + --passwordbox "$prompt1" \ $height1 $width1 \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) || return $? @@ -92,7 +91,7 @@ f_dialog_input_password() --ok-label "$msg_ok" \ --cancel-label "$msg_cancel" \ --insecure \ - --passwordbox "$rmsg" \ + --passwordbox "$prompt2" \ $height2 $width2 \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) || return $? Modified: head/usr.sbin/bsdconfig/security/kern_securelevel ============================================================================== --- head/usr.sbin/bsdconfig/security/kern_securelevel Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/security/kern_securelevel Sun Jun 2 20:02:50 2013 (r251264) @@ -51,16 +51,15 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_select_securelevel_to_operate_at" local prompt="$msg_securelevels_menu_text" - - menu_list=" + local menu_list=" '$msg_disabled' '$msg_disable_securelevels' '$msg_secure' '$msg_secure_mode' '$msg_highly_secure' '$msg_highly_secure_mode' '$msg_network_secure' '$msg_network_secure_mode' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_select_securelevel_to_operate_at" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/security/security ============================================================================== --- head/usr.sbin/bsdconfig/security/security Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/security/security Sun Jun 2 20:02:50 2013 (r251264) @@ -49,21 +49,21 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list mark=" " defaultitem= - local hline="$hline_arrows_tab_enter" local prompt="$msg_menu_text" + local menu_list=" + 'X <<< $msg_exit' '$msg_exit_this_menu' + " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" # Obtain default-item (adjusted below for dynamic tags) f_dialog_default_fetch defaultitem local ditem="${defaultitem%%[$IFS]*}" - menu_list=" - 'X <<< $msg_exit' '$msg_exit_this_menu' - " # END-QUOTE - # # Add dynamically tagged entry for kern_securelevels # + local mark=" " case "$( f_sysrc_get kern_securelevel_enable )" in [Yy][Ee][Ss]) local kern_securelevel="$( f_sysrc_get kern_securelevel )" Modified: head/usr.sbin/bsdconfig/share/media/any.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/any.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/share/media/any.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -68,10 +68,7 @@ f_media_get_type() local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE" f_dialog_title_restore local prompt="$msg_choose_installation_media_description" - local hline="$hline_choose_help_for_more_information_on_media_types" - local menu_list - - menu_list=" + local menu_list=" '1 $msg_cd_dvd' '$msg_install_from_a_freebsd_cd_dvd' '2 $msg_ftp' '$msg_install_from_an_ftp_server' '3 $msg_ftp_passive' @@ -85,6 +82,7 @@ f_media_get_type() 'A $msg_usb' '$msg_install_from_a_usb_drive' 'X $msg_options' '$msg_view_set_various_media_options' " # END-QUOTE + local hline="$hline_choose_help_for_more_information_on_media_types" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/share/media/ftp.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/ftp.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/share/media/ftp.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -72,9 +72,7 @@ f_dialog_menu_media_ftp() f_dialog_title "$msg_please_select_a_freebsd_ftp_distribution_site" local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE" f_dialog_title_restore - local prompt="$msg_please_select_the_site_closest_to_you_or_other" - local hline="$msg_select_a_site_thats_close" local menu_list=" '$msg_main_site' 'ftp.freebsd.org' 'URL' '$msg_specify_some_other_ftp_site' @@ -228,6 +226,7 @@ f_dialog_menu_media_ftp() ' $msg_usa #14' 'ftp14.us.freebsd.org' ' $msg_usa #15' 'ftp15.us.freebsd.org' " # END-QUOTE + local hline="$msg_select_a_site_thats_close" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/share/media/options.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/options.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/share/media/options.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -53,9 +53,10 @@ f_media_options_menu() f_dialog_title "$msg_options_editor" local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE" f_dialog_title_restore - local prompt="" + local prompt= + local menu_list # Calculated below + local defaultitem= local hline="$hline_arrows_tab_enter" - local menu_list cp # # A hack so that the dialogs below are always interactive in a script @@ -66,7 +67,7 @@ f_media_options_menu() unset $VAR_NONINTERACTIVE fi - local defaultitem= + local cp while :; do menu_list="" Modified: head/usr.sbin/bsdconfig/share/mustberoot.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/mustberoot.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/share/mustberoot.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -77,7 +77,7 @@ SECURE_DIVULGE_UNKNOWN_USER= # f_become_root_via_sudo() { - local msg hline height width rows + local prompt hline height width rows msg [ "$( id -u )" = "0" ] && return $SUCCESS @@ -90,18 +90,19 @@ f_become_root_via_sudo() # local checkpath="${HOME%/}/.bsdconfig_uses_sudo" if [ ! -e "$checkpath" ]; then + prompt=$( printf "$msg_you_are_not_root_but" bsdconfig ) msg=$( printf "$msg_always_try_sudo_when_run_as" "$USER" ) local menu_list=" 'X' '$msg_cancel_exit' '1' '$msg' '2' '$msg_try_sudo_only_this_once' " # END-QUOTE - msg=$( printf "$msg_you_are_not_root_but" bsdconfig ) hline="$hline_arrows_tab_enter" + eval f_dialog_menu_size height width rows \ \"\$DIALOG_TITLE\" \ \"\$DIALOG_BACKTITLE\" \ - \"\$msg\" \ + \"\$prompt\" \ \"\$hline\" \ $menu_list @@ -112,7 +113,7 @@ f_become_root_via_sudo() --hline \"\$hline\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ - --menu \"\$msg\" \ + --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD @@ -147,12 +148,12 @@ f_become_root_via_sudo() # # sudo(8) access denied. Prompt for their password. # - msg="$msg_please_enter_password" + prompt="$msg_please_enter_password" hline="$hline_alnum_punc_tab_enter" f_dialog_inputbox_size height width \ "$DIALOG_TITLE" \ "$DIALOG_BACKTITLE" \ - "$msg" \ + "$prompt" \ "$hline" # @@ -168,7 +169,7 @@ f_become_root_via_sudo() --hline "$hline" \ --ok-label "$msg_ok" \ --cancel-label "$msg_cancel" \ - --password --inputbox "$msg" \ + --password --inputbox "$prompt" \ $height $width \ 2>&1 > /dev/null ) retval=$? @@ -184,7 +185,7 @@ f_become_root_via_sudo() --ok-label "$msg_ok" \ --cancel-label "$msg_cancel" \ --insecure \ - --passwordbox "$msg" \ + --passwordbox "$prompt" \ $height $width \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) || exit $? Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/packages/packages.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/share/packages/packages.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -277,25 +277,26 @@ f_package_calculate_rundeps() # f_package_menu_categories() { - local var_to_get="$1" defaultitem="$2" category_list menu_list + local var_to_get="$1" defaultitem="$2" + local prompt="$msg_please_select_a_category_to_display" + local menu_list=" + '> $msg_review' '$msg_review_desc' '$msg_review_help' + " # End-Quote + local hline= f_package_calculate_rundeps # updates package mark variables and SELECTED_PACKAGES f_package_calculate_totals # creates _{varcat}_ninstalled and _{varcat}_nselected + local category_list debug= f_getvar "$var_to_get" category_list || return $FAILURE # Accent the category menu list with ninstalled/nselected eval f_package_accent_category_menu category_list $category_list - local prompt="$msg_please_select_a_category_to_display" - local hline="" - - menu_list=" - '> $msg_review' '$msg_review_desc' '$msg_review_help' - $category_list - " # End-Quote + # Add list of categories to menu list + menu_list="$menu_list $category_list" local height width rows eval f_dialog_menu_with_help_size height width rows \ @@ -365,22 +366,26 @@ f_package_index_get_page() # f_package_menu_select() { - local category="$1" page="${2:-1}" defaultitem="$3" - local varcat npkgs=0 npages menu_list + local category="$1" page="${2:-1}" + local prompt= # Calculated below + local menu_list # Calculated below + local defaultitem="$3" + local hline="$hline_arrows_tab_punc_enter" f_isinteger "$page" || return $FAILURE + local varcat f_str2varname "$category" varcat - f_package_index_get_page "$category" $page index_page # Get number of packages for this category + local npkgs=0 case "$category" in "$msg_all"|"") npkgs="${_npkgs:-0}";; *) f_getvar _npkgs_$varcat npkgs esac # Calculate number of pages - npages=$(( ${npkgs:=0} / $PACKAGE_MENU_PAGESIZE )) + local npages=$(( ${npkgs:=0} / $PACKAGE_MENU_PAGESIZE )) # Add a page to the pagecount if not evenly divisible [ $(( $npages * $PACKAGE_MENU_PAGESIZE )) -lt $npkgs ] && @@ -407,6 +412,9 @@ f_package_menu_select() next_page="$next_page*" fi + local index_page + f_package_index_get_page "$category" $page index_page + menu_list=" ${add_prev:+'> $previous_page' '' ${SHOW_DESC:+''}} ${add_next:+'> $next_page' '' ${SHOW_DESC:+''}} @@ -446,7 +454,6 @@ f_package_menu_select() ${add_next:+'> $next_page' '' ${SHOW_DESC:+''}} " # End-Quote - local prompt="" # Accept/Translate i18n "All" but other category names must # match tree definitions from INDEX, ports, FTP, etc. case "$category" in @@ -456,7 +463,6 @@ f_package_menu_select() prompt="$prompt $( printf "$msg_page_of_npages" \ "$page" "$npages" )" - local hline="$hline_arrows_tab_punc_enter" local mheight mwidth mrows f_dialog_menu${SHOW_DESC:+_with_help}_size mheight mwidth mrows \ \"\$DIALOG_TITLE\" \"\$DIALOG_BACKTITLE\" \ @@ -509,14 +515,16 @@ f_package_menu_select() # f_package_menu_deselect() { - local package="$1" prompt menu_list - prompt=$( printf "$msg_what_would_you_like_to_do_with" "$package" ) - local hline="$hline_alnum_arrows_punc_tab_enter" - menu_list=" + local package="$1" + local prompt # Calculated below + local menu_list=" 'X $msg_installed' '$msg_installed_desc' 'R $msg_reinstall' '$msg_reinstall_desc' 'U $msg_uninstall' '$msg_uninstall_desc' " # End-Quote + local hline="$hline_alnum_arrows_punc_tab_enter" + + prompt=$( printf "$msg_what_would_you_like_to_do_with" "$package" ) local height width rows eval f_dialog_menu_size height width rows \ @@ -551,12 +559,16 @@ f_package_menu_deselect() # f_package_review() { - local prompt package varpkg mark menu_list= - prompt=$( printf "$msg_reviewing_selected_packages" \ - "$_All_nselected" ) + local prompt # Calculated below + local menu_list # Calculated below local hline="$hline_alnum_arrows_punc_tab_enter" + f_dprintf "f_package_review: SELECTED_PACKAGES=[%s]" \ "$SELECTED_PACKAGES" + + prompt=$( printf "$msg_reviewing_selected_packages" "$_All_nselected" ) + + local package varpkg mark for package in $SELECTED_PACKAGES; do mark= f_str2varname "$package" varpkg Modified: head/usr.sbin/bsdconfig/startup/misc ============================================================================== --- head/usr.sbin/bsdconfig/startup/misc Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/misc Sun Jun 2 20:02:50 2013 (r251264) @@ -56,19 +56,14 @@ UNAME_P=$( uname -p ) # Processor Archit # dialog_menu_main() { - local menu_list var_list defaultitem= - local hline="$hline_arrows_tab_enter" local prompt="$msg_miscellaneous_menu_text" - - # Obtain default-item (adjusted below for dynamic tags) - f_dialog_default_fetch defaultitem - local ditem="${defaultitem%%[$IFS]*}" - - menu_list=" + local menu_list=" 'X <<< $msg_exit' '$msg_exit_this_menu' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" - var_list=" + local var_list=" accounting_enable local_startup lpd_enable @@ -88,6 +83,10 @@ dialog_menu_main() " # END-QUOTE fi + # Obtain default-item (adjusted below for dynamic tags) + f_dialog_default_fetch defaultitem + local ditem="${defaultitem%%[$IFS]*}" + eval "$( . "$RC_DEFAULTS" source_rc_confs Modified: head/usr.sbin/bsdconfig/startup/rcadd ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcadd Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/rcadd Sun Jun 2 20:02:50 2013 (r251264) @@ -57,14 +57,12 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list - local hline="$hline_arrows_tab_enter" - local prompt="" - - menu_list=" + local prompt= + local menu_list=" '1' '$msg_add_from_list' '2' '$msg_add_custom' " # END-QUOTE + local hline="$hline_arrows_tab_enter" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/startup/rcconf ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcconf Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/rcconf Sun Jun 2 20:02:50 2013 (r251264) @@ -49,7 +49,6 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # RCCONF_MAP= _RCCONF_MAP= -RCCONF_MENU_LIST= # # Options @@ -79,11 +78,8 @@ fi # dialog_menu_main() { - local hline="$hline_arrows_tab_enter" - local prompt="" - local defaultitem= # Calculated below - - RCCONF_MENU_LIST=" + local prompt= + local menu_list=" 'X $msg_exit' '$msg_exit_desc' ${SHOW_DESC:+'$msg_exit_help'} '> $msg_add_new' '$msg_add_new_desc' @@ -95,6 +91,8 @@ dialog_menu_main() ${SHOW_DESC:+'$msg_view_details_help'} } " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" if [ ! "$_RCCONF_MAP" ]; then # Genreate RCCONF_MAP of `var desc ...' per-line @@ -110,7 +108,7 @@ dialog_menu_main() [ "$SHOW_DEFAULT_VALUE" -o "$SHOW_CONFIGURED" ] && f_dialog_info "$msg_creating_menu_list" - RCCONF_MENU_LIST="$RCCONF_MENU_LIST $( + menu_list="$menu_list $( . "$RC_DEFAULTS" > /dev/null source_rc_confs > /dev/null var_list=$( f_startup_rcconf_list ) @@ -169,7 +167,7 @@ dialog_menu_main() \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ - $RCCONF_MENU_LIST + $menu_list # Obtain default-item from previously stored selection f_dialog_default_fetch defaultitem @@ -187,7 +185,7 @@ dialog_menu_main() --default-item \"\$defaultitem\" \ --menu \"\$prompt\" \ $height $width $rows \ - $RCCONF_MENU_LIST \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? Modified: head/usr.sbin/bsdconfig/startup/rcdelete ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcdelete Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/rcdelete Sun Jun 2 20:02:50 2013 (r251264) @@ -146,9 +146,23 @@ dialog_create_main() # dialog_menu_main() { - local hline="$hline_arrows_tab_enter" - local prompt="" + local prompt= + local menu_list=" + 'X $msg_exit_cancel' '$msg_exit_cancel_desc' + ${SHOW_DESC:+'$msg_exit_cancel_help'} + '> $msg_delete_selected' '$msg_delete_selected_desc' + ${SHOW_DESC:+'$msg_delete_selected_help'} + '> $msg_all' '$msg_all_desc' + ${SHOW_DESC:+'$msg_all_help'} + '> $msg_none' '$msg_none_desc' + ${SHOW_DESC:+'$msg_none_help'} + ${USE_XDIALOG:+ + '> $msg_view_details' '$msg_view_details_desc' + ${SHOW_DESC:+'$msg_view_details_help'} + } + " # END-QUOTE local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" # # [Re-]Accent the menu list before incorporating it @@ -178,22 +192,7 @@ dialog_menu_main() menu_buf="$menu_buf '$rcconf_var' '$details' ${SHOW_DESC:+'$help'}" # End-Quote done - - local menu_list=" - 'X $msg_exit_cancel' '$msg_exit_cancel_desc' - ${SHOW_DESC:+'$msg_exit_cancel_help'} - '> $msg_delete_selected' '$msg_delete_selected_desc' - ${SHOW_DESC:+'$msg_delete_selected_help'} - '> $msg_all' '$msg_all_desc' - ${SHOW_DESC:+'$msg_all_help'} - '> $msg_none' '$msg_none_desc' - ${SHOW_DESC:+'$msg_none_help'} - ${USE_XDIALOG:+ - '> $msg_view_details' '$msg_view_details_desc' - ${SHOW_DESC:+'$msg_view_details_help'} - } - $menu_buf - " # END-QUOTE + menu_list="$menu_list $menu_buf" set -f # noglob (descriptions in $RCCONF_MENU_LIST may contain *) @@ -244,9 +243,9 @@ dialog_menu_main() # dialog_menu_confirm_delete() { - local hline="$hline_arrows_tab_enter" local prompt="$msg_are_you_sure_you_want_delete_the_following" - local var_list menu_list + local menu_list # Calculated below + local hline="$hline_arrows_tab_enter" [ $# -ge 1 ] || return $FAILURE @@ -255,6 +254,7 @@ dialog_menu_confirm_delete() return $? fi + local var_list var_list=$( for var in $*; do echo "$var"; done | sort -u ) menu_list=$( . "$RC_DEFAULTS" Modified: head/usr.sbin/bsdconfig/startup/rcvar ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcvar Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/rcvar Sun Jun 2 20:02:50 2013 (r251264) @@ -65,8 +65,8 @@ RCVAR_MENU_LIST= # dialog_menu_main() { + local prompt= local hline="$hline_arrows_tab_enter" - local prompt="" local defaultitem= # Calculated below RCVAR_MENU_LIST=" Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -273,15 +273,16 @@ f_startup_rcconf_map_expand() # f_dialog_input_view_details() { - local menu_list + local prompt= + local menu_list # calculated below + local defaultitem= # calculated below local hline="$hline_arrows_tab_enter" - local prompt="" local md=" " if [ "$SHOW_DESC" ]; then md="X" fi - local m1=" " m2=" " m3=" " defaultitem= + local m1=" " m2=" " m3=" " if [ "$SHOW_VALUE" ]; then m1="*" defaultitem="1 ($m1) $msg_show_value" @@ -367,13 +368,11 @@ f_dialog_input_view_details() # f_dialog_input_rclist() { - local hline="$hline_arrows_tab_enter" local prompt="$msg_please_select_an_rcconf_directive" - local menu_list - - menu_list=" + local menu_list=" 'X $msg_exit' '' ${SHOW_DESC:+'$msg_exit_help'} " # END-QUOTE + local hline="$hline_arrows_tab_enter" if [ ! "$_RCCONF_MAP" ]; then # Generate RCCONF_MAP of `var desc ...' per-line Modified: head/usr.sbin/bsdconfig/startup/startup ============================================================================== --- head/usr.sbin/bsdconfig/startup/startup Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/startup Sun Jun 2 20:02:50 2013 (r251264) @@ -48,17 +48,15 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list - local hline="$hline_arrows_tab_enter" - local prompt="" - local defaultitem= # Calculated below - - menu_list=" + local prompt= + local menu_list=" 'X' '$msg_exit' '1' '$msg_toggle_startup_services' '2' '$msg_view_edit_startup_configuration' '3' '$msg_miscellaneous_startup_services' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/timezone/timezone ============================================================================== --- head/usr.sbin/bsdconfig/timezone/timezone Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/timezone/timezone Sun Jun 2 20:02:50 2013 (r251264) @@ -84,13 +84,14 @@ dialog_menu_main() local btitle="$DIALOG_BACKTITLE" local prompt="$msg_select_region" local defaultitem= # Calculated below + local hline= local height width rows eval f_dialog_menu_size height width rows \ \"\$title\" \ \"\$btitle\" \ \"\$prompt\" \ - \"\" \ + \"\$hline\" \ $continent_menu_list *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 21:22:26 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6C0AB53A; Sun, 2 Jun 2013 21:22:26 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107]) by mx1.freebsd.org (Postfix) with ESMTP id 34DE71965; Sun, 2 Jun 2013 21:22:26 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id B267612020A; Sun, 2 Jun 2013 23:22:09 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 8C1CF28493; Sun, 2 Jun 2013 23:22:09 +0200 (CEST) Date: Sun, 2 Jun 2013 23:22:09 +0200 From: Jilles Tjoelker To: Pawel Jakub Dawidek Subject: Re: svn commit: r251197 - head/lib/libc/sys Message-ID: <20130602212209.GA44549@stack.nl> References: <201305312131.r4VLVcd5074132@svn.freebsd.org> <20130531233109.GD1387@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130531233109.GD1387@garage.freebsd.pl> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 21:22:26 -0000 On Sat, Jun 01, 2013 at 01:31:10AM +0200, Pawel Jakub Dawidek wrote: > On Fri, May 31, 2013 at 09:31:38PM +0000, Jilles Tjoelker wrote: > > Author: jilles > > Date: Fri May 31 21:31:38 2013 > > New Revision: 251197 > > URL: http://svnweb.freebsd.org/changeset/base/251197 > > Log: > > sigaction(2): *at system calls are async-signal safe. > Isn't chflags(2) family safe as well? There are many more non-POSIX functions that are async-signal safe. For example: * bindat()/connectat() (like bind()/connect()) * eaccess() (like faccessat()) * pipe2() (like pipe()) * accept4() (like accept()) * wait4() (like waitpid()) * futimesat() (like utimes()) * strsep() (like strtok_r()) We may not want to document them all as async-signal safe because it may be necessary later to implement some as async-signal unsafe library functions. However, it would be useful to document some of them as async-signal safe. -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 22:04:40 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DC8C3CBB; Sun, 2 Jun 2013 22:04:40 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CCCBA1A84; Sun, 2 Jun 2013 22:04:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52M4eQA067559; Sun, 2 Jun 2013 22:04:40 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52M4eYr067556; Sun, 2 Jun 2013 22:04:40 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022204.r52M4eYr067556@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 22:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251265 - in head/usr.sbin/bsdconfig: . share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 22:04:40 -0000 Author: dteske Date: Sun Jun 2 22:04:39 2013 New Revision: 251265 URL: http://svnweb.freebsd.org/changeset/base/251265 Log: Fix option processing from the library layer to address unexpected behavior(s); e.g., `-Xd' versus `-dX' did not produce the same results. The libraries common.subr and dialog.subr automatically process the arguments passed to the program and enable/disable functionality without the need to process the arguments within your program. For example, if "$@" contains `-d', common.subr will see this and enable debugging regardless of whether you process "$@" yourself or not (this automatic processing can easily be disabled for custom scripts that don't want it; see the afore- mentioned scripts for additional details). NOTE: common.subr stores a copy of "$@" in $ARGV for convenient (and repeated) processing by libraries such as dialog.subr which provide such transparent functionality for the consuming script(s). However, the libraries don't know if a program wants to accept `extra' options. Flags are not really a problem, because the library can be programmed to silently ignore unknown flags. The trouble comes into play when the program wants to define an option that takes an argument. For example: bsdconfig -D logfile -X In the above example, the library uses getopts to process $ARGV and if it doesn't know that `-D' takes an argument, the option processing will prematurely terminate on `logfile' (this is standard/correct behavior for getopts but is undesired in our situation where we have partially off-loaded main argument processing). The problem is solved by allowing the program to define an extra set of options to be included in each library's handling of $ARGV. Only options that require arguments are truly necessary to be pre-specified in this new manner. Modified: head/usr.sbin/bsdconfig/bsdconfig head/usr.sbin/bsdconfig/share/common.subr head/usr.sbin/bsdconfig/share/dialog.subr Modified: head/usr.sbin/bsdconfig/bsdconfig ============================================================================== --- head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 20:02:50 2013 (r251264) +++ head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 22:04:39 2013 (r251265) @@ -29,6 +29,21 @@ # ############################################################ INCLUDES +# When common.subr is included, it automatically scans "$@" for `-d' and/or +# `-D file' arguments to conditionally enable debugging. Similarly, when +# dialog.subr is included, it automatically scans "$@" for `-X' and/or `-S'. +# To prevent this scanning from becoming confused by extra options, define +# any/all extra arguments to use in the optstring to getopts when scanning +# for dedicated options such as those described. +# +# NOTE: This needs to be declared before including `common.subr'. +# NOTE: You really only need to list flags that require an argument as unknown +# flags are silently accepted unless they take an argument (in which case +# the following argument will terminate option processing unless it looks +# like a flag). +# +GETOPTS_EXTRA="f:" + BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 f_dprintf "%s: loading includes..." "$0" Modified: head/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/common.subr Sun Jun 2 20:02:50 2013 (r251264) +++ head/usr.sbin/bsdconfig/share/common.subr Sun Jun 2 22:04:39 2013 (r251265) @@ -77,6 +77,33 @@ export UNAME_R="$(uname -r)" # Release L # GETOPTS_STDARGS="dD:" +# +# The getopts builtin will return 1 either when the end of "$@" or the first +# invalid flag is reached. This makes it impossible to determine if you've +# processed all the arguments or simply have hit an invalid flag. In the cases +# where we want to tolerate invalid flags (f_debug_init() for example), the +# following variable can be appended to your optstring argument to getopts, +# preventing it from prematurely returning 1 before the end of the arguments. +# +# NOTE: This assumes that all unknown flags are argument-less. +# +GETOPTS_ALLFLAGS="abcdefghijklmnopqrstuvwxyz" +GETOPTS_ALLFLAGS="${GETOPTS_ALLFLAGS}ABCDEFGHIJKLMNOPQRSTUVWXYZ" +GETOPTS_ALLFLAGS="${GETOPTS_ALLFLAGS}0123456789" + +# +# When we get included, f_debug_init() will fire (unless $DEBUG_SELF_INITIALIZE +# is set to disable automatic initialization) and process "$@" for a few global +# options such as `-d' and/or `-D file'. However, if your program takes custom +# flags that take arguments, this automatic processing may fail unexpectedly. +# +# The solution to this problem is to pre-define (before including this file) +# the following variable (which defaults to NULL) to indicate that there are +# extra flags that should be considered when performing automatic processing of +# globally persistent flags. +# +: ${GETOPTS_EXTRA:=} + ############################################################ FUNCTIONS # f_dprintf $fmt [ $opts ... ] @@ -114,11 +141,11 @@ f_debug_init() local OPTIND f_dprintf "f_debug_init: ARGV=[%s] GETOPTS_STDARGS=[%s]" \ "$ARGV" "$GETOPTS_STDARGS" - while getopts "$GETOPTS_STDARGS" flag > /dev/null; do + while getopts "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" flag \ + > /dev/null; do case "$flag" in d) debug=1;; D) debugFile="$OPTARG";; - \?) continue;; esac done shift $(( $OPTIND - 1 )) Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Sun Jun 2 20:02:50 2013 (r251264) +++ head/usr.sbin/bsdconfig/share/dialog.subr Sun Jun 2 22:04:39 2013 (r251265) @@ -1970,18 +1970,20 @@ f_dialog_init() f_dprintf "f_dialog_init: ARGV=[%s] GETOPTS_STDARGS=[%s]" \ "$ARGV" "$GETOPTS_STDARGS" SECURE=$( set -- $ARGV - while getopts "$GETOPTS_STDARGS" flag > /dev/null; do + while getopts \ + "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ + flag > /dev/null; do case "$flag" in S) echo 1;; - \?) continue;; esac done ) USE_XDIALOG=$( set -- $ARGV - while getopts $GETOPTS_STDARGS flag > /dev/null; do + while getopts \ + "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ + flag > /dev/null; do case "$flag" in S|X) echo 1;; - \?) continue;; esac done ) From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 22:34:43 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 124B14F7; Sun, 2 Jun 2013 22:34:43 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 01AD91B4E; Sun, 2 Jun 2013 22:34:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52MYgnr078394; Sun, 2 Jun 2013 22:34:42 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52MYeAP078379; Sun, 2 Jun 2013 22:34:40 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022234.r52MYeAP078379@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 22:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251266 - in head/usr.sbin/bsdconfig: . networking/share share share/packages startup startup/share usermgmt/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 22:34:43 -0000 Author: dteske Date: Sun Jun 2 22:34:40 2013 New Revision: 251266 URL: http://svnweb.freebsd.org/changeset/base/251266 Log: Improvements to whitespace and comments. Modified: head/usr.sbin/bsdconfig/bsdconfig head/usr.sbin/bsdconfig/networking/share/media.subr head/usr.sbin/bsdconfig/share/dialog.subr head/usr.sbin/bsdconfig/share/mustberoot.subr head/usr.sbin/bsdconfig/share/packages/packages.subr head/usr.sbin/bsdconfig/startup/misc head/usr.sbin/bsdconfig/startup/rcconf head/usr.sbin/bsdconfig/startup/rcdelete head/usr.sbin/bsdconfig/startup/rcvar head/usr.sbin/bsdconfig/startup/share/rcconf.subr head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Modified: head/usr.sbin/bsdconfig/bsdconfig ============================================================================== --- head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 22:34:40 2013 (r251266) @@ -169,7 +169,6 @@ dialog_menu_main() local hline= local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }" - local menuitem menu_title menu_help menu_selection index=2 for menuitem in $( cd $BSDCFG_LIBE && ls -d [0-9][0-9][0-9].* ); do [ $index -lt ${#DIALOG_MENU_TAGS} ] || break Modified: head/usr.sbin/bsdconfig/networking/share/media.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/media.subr Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/networking/share/media.subr Sun Jun 2 22:34:40 2013 (r251266) @@ -101,7 +101,9 @@ f_ifconfig_media() # f_dialog_input_options $interface # -# Input custom interface options. +# Input custom interface options. If the user does not press ESC or choose +# Cancel/No, $options will hold the user's input. Default input is taken from +# the same variable ($options). # f_dialog_input_options() { Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/share/dialog.subr Sun Jun 2 22:34:40 2013 (r251266) @@ -1672,7 +1672,7 @@ f_dialog_inputstr_fetch() # # Prompt the user with a dialog(1) inputbox to enter some value. The inputbox # remains until the the user presses ENTER or ESC, or otherwise ends the -# editing session, by selecting `Cancel' for example. +# editing session (by selecting `Cancel' for example). # # If the user presses ENTER, the exit status is zero (success), otherwise if # the user presses ESC the exit status is 255, or if the user chose Cancel, the Modified: head/usr.sbin/bsdconfig/share/mustberoot.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/mustberoot.subr Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/share/mustberoot.subr Sun Jun 2 22:34:40 2013 (r251266) @@ -171,7 +171,8 @@ f_become_root_via_sudo() --cancel-label "$msg_cancel" \ --password --inputbox "$prompt" \ $height $width \ - 2>&1 > /dev/null ) + 2>&1 > /dev/null + ) retval=$? # Catch X11-related errors Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/packages/packages.subr Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/share/packages/packages.subr Sun Jun 2 22:34:40 2013 (r251266) @@ -307,18 +307,18 @@ f_package_menu_categories() $menu_list local menu_choice menu_choice=$( eval $DIALOG \ - --title \"\$DIALOG_TITLE\" \ - --backtitle \"\$DIALOG_BACKTITLE\" \ - --hline \"\$hline\" \ - --item-help \ - --default-item \"\$defaultitem\" \ - --ok-label \"$msg_select\" \ - --cancel-label \"$msg_cancel\" \ - --menu \"\$prompt\" \ - $height $width $rows \ - $menu_list \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD - ) + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --item-help \ + --default-item \"\$defaultitem\" \ + --ok-label \"$msg_select\" \ + --cancel-label \"$msg_cancel\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $menu_list \ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) local retval=$? f_dialog_menutag_store -s "$menu_choice" return $retval @@ -353,7 +353,7 @@ f_package_index_get_page() fi } -# f_package_menu_select $category [ $page [ $defaultitem ] ] +# f_package_menu_select $category [$page [$defaultitem]] # # Display list of packages for $category, optionally $page N and with a default # item selected. If $page is omitted, the first page is displayed (but this Modified: head/usr.sbin/bsdconfig/startup/misc ============================================================================== --- head/usr.sbin/bsdconfig/startup/misc Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/startup/misc Sun Jun 2 22:34:40 2013 (r251266) @@ -63,6 +63,7 @@ dialog_menu_main() local defaultitem= # Calculated below local hline="$hline_arrows_tab_enter" + # List of variables we'll need from rc.conf(5) local var_list=" accounting_enable local_startup @@ -75,6 +76,7 @@ dialog_menu_main() startup_dirs " # END-QUOTE + # Add i386-specific variables if appropriate if [ "$UNAME_P" = "i386" ]; then var_list="$var_list apm_enable Modified: head/usr.sbin/bsdconfig/startup/rcconf ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcconf Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/startup/rcconf Sun Jun 2 22:34:40 2013 (r251266) @@ -158,7 +158,9 @@ dialog_menu_main() }' )" - set -f # noglob + set -f # set noglob because descriptions in the $menu_list may contain + # `*' and get expanded by dialog(1) (doesn't affect Xdialog(1)). + # This prevents dialog(1) from expanding wildcards in help line. local height width rows eval f_dialog_menu${SHOW_DESC:+_with_help}_size \ Modified: head/usr.sbin/bsdconfig/startup/rcdelete ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcdelete Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/startup/rcdelete Sun Jun 2 22:34:40 2013 (r251266) @@ -194,7 +194,9 @@ dialog_menu_main() done menu_list="$menu_list $menu_buf" - set -f # noglob (descriptions in $RCCONF_MENU_LIST may contain *) + set -f # set noglob because descriptions in the $menu_list may contain + # `*' and get expanded by dialog(1) (doesn't affect Xdialog(1)). + # This prevents dialog(1) from expanding wildcards in help line. local height width rows eval f_dialog_menu${SHOW_DESC:+_with_help}_size \ @@ -249,11 +251,14 @@ dialog_menu_confirm_delete() [ $# -ge 1 ] || return $FAILURE + # If asked to delete only one variable, simply ask and return if [ $# -eq 1 ]; then f_noyes "$msg_are_you_sure_you_want_to_delete" "$delete_vars" return $? fi + # Not reached unless requested to delete multiple variables + # Generate a menu to cleanly display the variables to be deleted local var_list var_list=$( for var in $*; do echo "$var"; done | sort -u ) menu_list=$( Modified: head/usr.sbin/bsdconfig/startup/rcvar ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcvar Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/startup/rcvar Sun Jun 2 22:34:40 2013 (r251266) @@ -69,6 +69,8 @@ dialog_menu_main() local hline="$hline_arrows_tab_enter" local defaultitem= # Calculated below + # NOTE: Using a GLOBAL here because caller will need this list to turn + # the menu tag into the menu item with f_dialog_menutag2item() RCVAR_MENU_LIST=" 'X $msg_exit' '$msg_exit_this_menu' ${SHOW_DESC:+'$msg_exit_this_menu'} @@ -124,7 +126,9 @@ dialog_menu_main() }' )" - set -f # noglob + set -f # set noglob because descriptions in the $RCVAR_MENU_LIST may + # contain `*' and get expanded by dialog(1). This prevents + # dialog(1) from expanding wildcards in the help line. local height width rows eval f_dialog_menu${SHOW_DESC:+_with_help}_size \ Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sun Jun 2 22:34:40 2013 (r251266) @@ -278,6 +278,7 @@ f_dialog_input_view_details() local defaultitem= # calculated below local hline="$hline_arrows_tab_enter" + # Calculate marks for checkboxes and radio buttons local md=" " if [ "$SHOW_DESC" ]; then md="X" @@ -294,6 +295,7 @@ f_dialog_input_view_details() defaultitem="3 ($m3) $msg_show_configured" fi + # Create the menu list with the above-calculated marks menu_list=" 'R $msg_reset' '$msg_reset_desc' 'D [$md] $msg_desc' '$msg_desc_desc' @@ -410,7 +412,9 @@ f_dialog_input_rclist() }' )" - set -f # noglob + set -f # set noglob because descriptions in the $menu_list may contain + # `*' and get expanded by dialog(1) (doesn't affect Xdialog(1)). + # This prevents dialog(1) from expanding wildcards in help line. local height width rows eval f_dialog_menu${SHOW_DESC:+_with_help}_size \ Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Sun Jun 2 22:34:40 2013 (r251266) @@ -280,9 +280,9 @@ f_dialog_input_group_gid() # f_dialog_input_group_members [$group_members] # -# Allow the user to modify a list of members for a given group. If the user does -# not cancel or press ESC, the $group_members variable will hold the newly- -# configured value upon return. +# Allow the user to modify a list of members for a given group. If the user +# does not cancel or press ESC, the $group_members variable will hold the +# newly-configured value upon return. # f_dialog_input_group_members() { Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sun Jun 2 22:04:39 2013 (r251265) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sun Jun 2 22:34:40 2013 (r251266) @@ -280,18 +280,18 @@ f_dialog_input_password() local height1 width1 f_dialog_inputbox_size height1 width1 \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$prompt1" \ - "" \ - "$hline" + "$DIALOG_TITLE" \ + "$DIALOG_BACKTITLE" \ + "$prompt1" \ + "" \ + "$hline" local height2 width2 f_dialog_inputbox_size height2 width2 \ - "$DIALOG_TITLE" \ - "$DIALOG_BACKTITLE" \ - "$prompt2" \ - "" \ - "$hline" + "$DIALOG_TITLE" \ + "$DIALOG_BACKTITLE" \ + "$prompt2" \ + "" \ + "$hline" # # Loop until the user provides taint-free/valid input @@ -496,9 +496,9 @@ f_dialog_input_change() $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) - retval=$? + retval=$? f_dialog_data_sanitize date_type - f_dprintf "retval=%u date_type=[%s]" $retval "$date_type" + f_dprintf "retval=%u date_type=[%s]" $retval "$date_type" # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval @@ -677,9 +677,9 @@ f_dialog_input_expire() $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) - retval=$? + retval=$? f_dialog_data_sanitize date_type - f_dprintf "retval=%u date_type=[%s]" $retval "$date_type" + f_dprintf "retval=%u date_type=[%s]" $retval "$date_type" # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 22:45:54 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C8122887; Sun, 2 Jun 2013 22:45:54 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B9F0E1BC4; Sun, 2 Jun 2013 22:45:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52Mjsfh082041; Sun, 2 Jun 2013 22:45:54 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52MjsL6082040; Sun, 2 Jun 2013 22:45:54 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022245.r52MjsL6082040@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 22:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251267 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 22:45:54 -0000 Author: dteske Date: Sun Jun 2 22:45:54 2013 New Revision: 251267 URL: http://svnweb.freebsd.org/changeset/base/251267 Log: Make proper use of locals in f_dialog_init(). Modified: head/usr.sbin/bsdconfig/share/dialog.subr Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Sun Jun 2 22:34:40 2013 (r251266) +++ head/usr.sbin/bsdconfig/share/dialog.subr Sun Jun 2 22:45:54 2013 (r251267) @@ -2000,7 +2000,7 @@ f_dialog_init() # if ! f_have $DIALOG; then unset USE_XDIALOG - failed_dialog="$DIALOG" + local failed_dialog="$DIALOG" DIALOG=dialog f_die 1 "$msg_no_such_file_or_directory" "$pgm" "$failed_dialog" fi @@ -2021,7 +2021,7 @@ f_dialog_init() f_die 1 "$msg_no_such_file_or_directory" "$pgm" "xauth" fi HOSTNAME=$(hostname) - displaynum="${DISPLAY#*:}" + local displaynum="${DISPLAY#*:}" eval xauth -if \~$SUDO_USER/.Xauthority extract - \ \"\$HOSTNAME/unix:\$displaynum\" \ \"\$HOSTNAME:\$displaynum\" | sudo sh -c 'xauth -ivf \ @@ -2033,6 +2033,7 @@ f_dialog_init() # gracefully # if [ "$USE_XDIALOG" ]; then + local maxsize if ! maxsize=$( LANG= LC_ALL= $DIALOG --print-maxsize 2>&1 ) then # Xdialog(1) failed, fall back to dialog(1) @@ -2058,7 +2059,6 @@ f_dialog_init() echo $height $width ) - unset maxsize fi # @@ -2068,10 +2068,9 @@ f_dialog_init() # --title with Xdialog(1)). # if [ "$USE_XDIALOG" ]; then - _DIALOG_TITLE="$DIALOG_TITLE" + local _DIALOG_TITLE="$DIALOG_TITLE" DIALOG_TITLE="$DIALOG_BACKTITLE" DIALOG_BACKTITLE="$_DIALOG_TITLE" - unset _DIALOG_TITLE fi f_dprintf "f_dialog_init: dialog(1) API initialized." From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 22:54:37 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C2ABAB50; Sun, 2 Jun 2013 22:54:37 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9C06F1C0B; Sun, 2 Jun 2013 22:54:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52Msb6Q085190; Sun, 2 Jun 2013 22:54:37 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52Msbl3085187; Sun, 2 Jun 2013 22:54:37 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022254.r52Msbl3085187@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 22:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251268 - in head/usr.sbin/bsdconfig/share: media packages X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 22:54:37 -0000 Author: dteske Date: Sun Jun 2 22:54:36 2013 New Revision: 251268 URL: http://svnweb.freebsd.org/changeset/base/251268 Log: Use f_isset() (introduced by r250317) instead of `f_quietly f_getvar ...'. Modified: head/usr.sbin/bsdconfig/share/media/nfs.subr head/usr.sbin/bsdconfig/share/media/tcpip.subr head/usr.sbin/bsdconfig/share/packages/categories.subr Modified: head/usr.sbin/bsdconfig/share/media/nfs.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/nfs.subr Sun Jun 2 22:45:54 2013 (r251267) +++ head/usr.sbin/bsdconfig/share/media/nfs.subr Sun Jun 2 22:54:36 2013 (r251268) @@ -103,9 +103,8 @@ f_media_set_nfs() f_dprintf "%s: $msg_net_device_init_failed\n" f_media_set_nfs local hostname="${nfs%%:*}" - if f_quietly f_getvar $VAR_NAMESERVER && ! { - f_validate_ipaddr "$hostname" || - f_validate_ipaddr6 "$hostname" + if f_isset $VAR_NAMESERVER && ! { + f_validate_ipaddr "$hostname" || f_validate_ipaddr6 "$hostname" }; then f_show_info "$msg_looking_up_host" "$hostname" f_dprintf "%s Looking up hostname, %s, using host(1)" \ Modified: head/usr.sbin/bsdconfig/share/media/tcpip.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/tcpip.subr Sun Jun 2 22:45:54 2013 (r251267) +++ head/usr.sbin/bsdconfig/share/media/tcpip.subr Sun Jun 2 22:54:36 2013 (r251268) @@ -1133,11 +1133,12 @@ f_device_dialog_tcp() # Otherwise, ask the question interactively. # local try6 - if ! f_quietly f_getvar $VAR_NO_INET6 && { + if ! f_isset $VAR_NO_INET6 && { { f_getvar $VAR_TRY_RTSOL try6 && [ "$try6" = "YES" ]; } || { - ! f_quietly f_getvar $VAR_TRY_RTSOL && - f_dialog_noyes "$msg_try_ipv6_configuration" + # Only prompt the user when VAR_TRY_RTSOL is unset + ! f_isset $VAR_TRY_RTSOL && + f_dialog_noyes "$msg_try_ipv6_configuration" } }; then local i @@ -1169,8 +1170,9 @@ f_device_dialog_tcp() # local try4 if { f_getvar $VAR_TRY_DHCP try4 && [ "$try4" = "YES" ]; } || { - ! f_quietly f_getvar $VAR_TRY_DHCP && - f_dialog_noyes "$msg_try_dhcp_configuration" + # Only prompt the user when VAR_TRY_DHCP is unset + ! f_isset $VAR_TRY_DHCP && + f_dialog_noyes "$msg_try_dhcp_configuration" }; then f_quietly ifconfig $dev delete f_quietly mkdir -p /var/db Modified: head/usr.sbin/bsdconfig/share/packages/categories.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/packages/categories.subr Sun Jun 2 22:45:54 2013 (r251267) +++ head/usr.sbin/bsdconfig/share/packages/categories.subr Sun Jun 2 22:54:36 2013 (r251268) @@ -83,7 +83,7 @@ f_category_desc_set() for cat in $CATEGORIES; do [ "$cat" = "$category" ] || continue f_str2varname $cat varcat - f_quietly f_getvar _category_$varcat || continue + f_isset _category_$varcat || continue found=1 && break done if [ ! "$found" ]; then From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:02:57 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 41DF9DEB; Sun, 2 Jun 2013 23:02:57 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3341A1C4A; Sun, 2 Jun 2013 23:02:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52N2vA8088538; Sun, 2 Jun 2013 23:02:57 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52N2utC088533; Sun, 2 Jun 2013 23:02:56 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022302.r52N2utC088533@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 23:02:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251269 - in head/usr.sbin/bsdconfig: networking share/media X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:02:57 -0000 Author: dteske Date: Sun Jun 2 23:02:56 2013 New Revision: 251269 URL: http://svnweb.freebsd.org/changeset/base/251269 Log: Standardize NULL initialization to be consistent. Modified: head/usr.sbin/bsdconfig/networking/devices head/usr.sbin/bsdconfig/share/media/options.subr head/usr.sbin/bsdconfig/share/media/tcpip.subr Modified: head/usr.sbin/bsdconfig/networking/devices ============================================================================== --- head/usr.sbin/bsdconfig/networking/devices Sun Jun 2 22:54:36 2013 (r251268) +++ head/usr.sbin/bsdconfig/networking/devices Sun Jun 2 23:02:56 2013 (r251269) @@ -71,7 +71,7 @@ f_mustberoot_init # # Launch application main menu # -defaultitem="" +defaultitem= while :; do f_dialog_menu_netdev "$defaultitem" || break f_dialog_menutag_fetch interface Modified: head/usr.sbin/bsdconfig/share/media/options.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/options.subr Sun Jun 2 22:54:36 2013 (r251268) +++ head/usr.sbin/bsdconfig/share/media/options.subr Sun Jun 2 23:02:56 2013 (r251269) @@ -69,7 +69,7 @@ f_media_options_menu() local cp while :; do - menu_list="" + menu_list= f_getvar $VAR_NFS_SECURE cp if [ "$cp" = "YES" ]; then menu_list="$menu_list Modified: head/usr.sbin/bsdconfig/share/media/tcpip.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/tcpip.subr Sun Jun 2 22:54:36 2013 (r251268) +++ head/usr.sbin/bsdconfig/share/media/tcpip.subr Sun Jun 2 23:02:56 2013 (r251269) @@ -1371,7 +1371,7 @@ f_device_dialog_tcp() # Create a persistent menu instead f_dialog_title "$msg_network_configuration" - local prompt="" + local prompt= while :; do cp=$( $DIALOG \ From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:05:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 38D0FF70; Sun, 2 Jun 2013 23:05:02 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2AC981C5B; Sun, 2 Jun 2013 23:05:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52N52qA089055; Sun, 2 Jun 2013 23:05:02 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52N51l6089053; Sun, 2 Jun 2013 23:05:01 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022305.r52N51l6089053@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 23:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251270 - in head/usr.sbin/bsdconfig: . networking/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:05:02 -0000 Author: dteske Date: Sun Jun 2 23:05:01 2013 New Revision: 251270 URL: http://svnweb.freebsd.org/changeset/base/251270 Log: Make some obvious consolidations in local declaration for readability. Modified: head/usr.sbin/bsdconfig/bsdconfig head/usr.sbin/bsdconfig/networking/share/device.subr Modified: head/usr.sbin/bsdconfig/bsdconfig ============================================================================== --- head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 23:02:56 2013 (r251269) +++ head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 23:05:01 2013 (r251270) @@ -93,10 +93,9 @@ usage() # # Determine the maximum width of terminal/console # - local max_size max_width - max_size=$( stty size 2> /dev/null ) + local max_size="$( stty size 2> /dev/null )" : ${max_size:="24 80"} - max_width="${max_size#*[$IFS]}" + local max_width="${max_size#*[$IFS]}" f_dprintf "max_width=[%s]" "$max_width" # Modified: head/usr.sbin/bsdconfig/networking/share/device.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/device.subr Sun Jun 2 23:02:56 2013 (r251269) +++ head/usr.sbin/bsdconfig/networking/share/device.subr Sun Jun 2 23:05:01 2013 (r251270) @@ -142,8 +142,7 @@ f_dialog_menu_netdev() # # Ask user to select an interface # - local prompt - prompt="$msg_select_network_interface" + local prompt="$msg_select_network_interface" local height width rows eval f_dialog_menu_size height width rows \ \"\$DIALOG_TITLE\" \ From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:06:35 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 591C916F; Sun, 2 Jun 2013 23:06:35 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4A1141C61; Sun, 2 Jun 2013 23:06:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52N6YxI089415; Sun, 2 Jun 2013 23:06:34 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52N6YkZ089414; Sun, 2 Jun 2013 23:06:34 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022306.r52N6YkZ089414@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 23:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251271 - head/usr.sbin/bsdconfig/share/media X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:06:35 -0000 Author: dteske Date: Sun Jun 2 23:06:33 2013 New Revision: 251271 URL: http://svnweb.freebsd.org/changeset/base/251271 Log: Add some additional debugging to the common media library. Modified: head/usr.sbin/bsdconfig/share/media/common.subr Modified: head/usr.sbin/bsdconfig/share/media/common.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/common.subr Sun Jun 2 23:05:01 2013 (r251270) +++ head/usr.sbin/bsdconfig/share/media/common.subr Sun Jun 2 23:06:33 2013 (r251271) @@ -50,6 +50,7 @@ MOUNTPOINT=/dist # f_media_open() { + f_dprintf "f_media_open: Verifying and initiliazing media device" { # Verify and initialize device media if-defined f_struct device_media && f_media_verify && @@ -64,6 +65,7 @@ f_media_open() # f_media_close() { + f_dprintf "f_media_close: Shutting down media device" f_struct device_media && f_device_shutdown media f_struct_free device_media @@ -77,6 +79,7 @@ f_media_close() # f_media_verify() { + f_dprintf "f_media_verify: Verifying media device" f_struct device_media || f_media_get_type } @@ -86,8 +89,12 @@ f_media_verify() # f_media_generic_get() { - local base="$1" file="$2" rel path + local base="$1" file="$2" + local fname=f_media_generic_get + f_dprintf "%s: base=[%s] files=[%s]" $fname "$base" "$file" + + local rel path f_getvar $VAR_RELNAME rel for path in \ "$base/$file" \ @@ -96,6 +103,7 @@ f_media_generic_get() "$base/$rel/$file" \ ; do if [ -f "$path" -a -r "$path" ]; then + f_dprintf "%s: file exists path=[%s]" $fname "$path" cat "$path" return fi From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:08:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8E9D02F6; Sun, 2 Jun 2013 23:08:21 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 80BD71C6B; Sun, 2 Jun 2013 23:08:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52N8LLf089825; Sun, 2 Jun 2013 23:08:21 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52N8LcW089824; Sun, 2 Jun 2013 23:08:21 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022308.r52N8LcW089824@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 23:08:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251272 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:08:21 -0000 Author: dteske Date: Sun Jun 2 23:08:21 2013 New Revision: 251272 URL: http://svnweb.freebsd.org/changeset/base/251272 Log: Fix a copy/paste error within a comment. Modified: head/usr.sbin/bsdconfig/share/strings.subr Modified: head/usr.sbin/bsdconfig/share/strings.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/strings.subr Sun Jun 2 23:06:33 2013 (r251271) +++ head/usr.sbin/bsdconfig/share/strings.subr Sun Jun 2 23:08:21 2013 (r251272) @@ -253,7 +253,7 @@ f_str2varname() # # foo="abc'123" # f_shell_escape "$foo" bar # bar=[abc'\''123] -# eval echo \'$foo\' # produces abc'123 +# eval echo \'$bar\' # produces abc'123 # # This is helpful when processing an argument list that has to retain its # escaped structure for later evaluations. From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:12:33 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6AC3E58F; Sun, 2 Jun 2013 23:12:33 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4BA6C1C9A; Sun, 2 Jun 2013 23:12:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52NCXig092403; Sun, 2 Jun 2013 23:12:33 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52NCWtH092401; Sun, 2 Jun 2013 23:12:32 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022312.r52NCWtH092401@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 23:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251273 - in head/usr.sbin/bsdconfig/usermgmt: . share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:12:33 -0000 Author: dteske Date: Sun Jun 2 23:12:32 2013 New Revision: 251273 URL: http://svnweb.freebsd.org/changeset/base/251273 Log: Change the name of a couple of functions in `usermgmt/user_input.subr' to make their purpose more clear by their names: f_dialog_input_change() and f_dialog_input_expire() Are now (respectively): f_dialog_input_expire_password() and f_dialog_input_expire_account() Upon revisit to this portion of code, the former names were too confusing. Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr head/usr.sbin/bsdconfig/usermgmt/userinput Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sun Jun 2 23:08:21 2013 (r251272) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sun Jun 2 23:12:32 2013 (r251273) @@ -441,14 +441,14 @@ f_dialog_input_class() return $SUCCESS } -# f_dialog_input_change [$seconds] +# f_dialog_input_expire_password [$seconds] # # Allow the user to enter a date/time (in number-of-seconds since the `epoch') # for when a given user's password must be changed. If the user does not cancel # or press ESC, the $pw_password_expire variable will hold the newly- # configured value upon return. # -f_dialog_input_change() +f_dialog_input_expire_password() { local prompt="$msg_password_expires_on" local menu_list=" @@ -622,14 +622,14 @@ f_dialog_input_change() return $SUCCESS } -# f_dialog_input_expire [$seconds] +# f_dialog_input_expire_account [$seconds] # # Allow the user to enter a date/time (in number-of-seconds since the `epoch') # for when a given user's account should become expired. If the user does not # cancel or press ESC, the $pw_account_expire variable will hold the newly- # configured value upon return. # -f_dialog_input_expire() +f_dialog_input_expire_account() { local prompt="$msg_account_expires_on" local menu_list=" Modified: head/usr.sbin/bsdconfig/usermgmt/userinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/userinput Sun Jun 2 23:08:21 2013 (r251272) +++ head/usr.sbin/bsdconfig/usermgmt/userinput Sun Jun 2 23:12:32 2013 (r251273) @@ -254,8 +254,8 @@ if [ "$mode" = "Add" ]; then f_dialog_input_gid || exit 0 f_dialog_input_member_groups || exit 0 f_dialog_input_class || exit 0 - f_dialog_input_change || exit 0 - f_dialog_input_expire || exit 0 + f_dialog_input_expire_password || exit 0 + f_dialog_input_expire_account || exit 0 f_dialog_input_home_dir "$homeprefix/$pw_name" || exit 0 pw_dotfiles_create="$msg_no" if [ ! -d "$homeprefix/$pw_name" ]; then @@ -472,10 +472,10 @@ while :; do f_dialog_input_class "$pw_class" ;; 8) # Password Expire on - f_dialog_input_change "$pw_password_expire" + f_dialog_input_expire_password "$pw_password_expire" ;; 9) # Account Expire on - f_dialog_input_expire "$pw_account_expire" + f_dialog_input_expire_account "$pw_account_expire" ;; A) # Home Directory f_dialog_input_home_dir "$pw_home_dir" From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:15:13 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 68BF3708; Sun, 2 Jun 2013 23:15:13 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5AB981CA1; Sun, 2 Jun 2013 23:15:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52NFC37093009; Sun, 2 Jun 2013 23:15:12 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52NFCGk093008; Sun, 2 Jun 2013 23:15:12 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022315.r52NFCGk093008@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 23:15:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251274 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:15:13 -0000 Author: dteske Date: Sun Jun 2 23:15:12 2013 New Revision: 251274 URL: http://svnweb.freebsd.org/changeset/base/251274 Log: Fix a bug in which the user's choice to Cancel was not properly recognized. Modified: head/usr.sbin/bsdconfig/share/mustberoot.subr Modified: head/usr.sbin/bsdconfig/share/mustberoot.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/mustberoot.subr Sun Jun 2 23:12:32 2013 (r251273) +++ head/usr.sbin/bsdconfig/share/mustberoot.subr Sun Jun 2 23:15:12 2013 (r251274) @@ -176,8 +176,12 @@ f_become_root_via_sudo() retval=$? # Catch X11-related errors - [ $retval -eq 255 ] && + if [ $retval -eq 255 ]; then f_die $retval "$password" + elif [ $retval -ne 0 ]; then + # User cancelled + exit $retval + fi else password=$( $DIALOG \ --title "$DIALOG_TITLE" \ From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:18:28 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 35CFA883; Sun, 2 Jun 2013 23:18:28 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 263CA1CAC; Sun, 2 Jun 2013 23:18:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52NISMo093595; Sun, 2 Jun 2013 23:18:28 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52NISbw093594; Sun, 2 Jun 2013 23:18:28 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022318.r52NISbw093594@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 23:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251275 - head/usr.sbin/bsdconfig/share/media X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:18:28 -0000 Author: dteske Date: Sun Jun 2 23:18:27 2013 New Revision: 251275 URL: http://svnweb.freebsd.org/changeset/base/251275 Log: Fix a bug that would cause a spurious warning to appear to appear in an edge-case. The case was that you have been through the FTP setup once before and on the second time through, you cancel at the re-selection of a new FTP server. The spurious warning was "device_media: not found" and was caused because the underlying call to f_device_network_down() did not check to see if the network device existed before attempting to shut it down. Add checks to make sure we don't forge ahead unless the device exists. Modified: head/usr.sbin/bsdconfig/share/media/ftp.subr Modified: head/usr.sbin/bsdconfig/share/media/ftp.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/ftp.subr Sun Jun 2 23:15:12 2013 (r251274) +++ head/usr.sbin/bsdconfig/share/media/ftp.subr Sun Jun 2 23:18:27 2013 (r251275) @@ -502,6 +502,7 @@ f_media_set_ftp_userpass() f_device_network_up() { local dev="$1" netDev + f_struct device_$dev || return $FAILURE device_$dev get private netDev || return $SUCCESS # No net == happy net f_device_init $netDev } @@ -513,6 +514,7 @@ f_device_network_up() f_device_network_down() { local dev="$1" netDev + f_struct device_$dev || return $FAILURE device_$dev get private netDev || return $SUCCESS f_device_shutdown $netDev } From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:20:46 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E3018A18; Sun, 2 Jun 2013 23:20:46 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D43041CBE; Sun, 2 Jun 2013 23:20:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52NKkQo095641; Sun, 2 Jun 2013 23:20:46 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52NKkJH095640; Sun, 2 Jun 2013 23:20:46 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022320.r52NKkJH095640@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 23:20:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251276 - head/usr.sbin/bsdconfig/share/packages X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:20:47 -0000 Author: dteske Date: Sun Jun 2 23:20:46 2013 New Revision: 251276 URL: http://svnweb.freebsd.org/changeset/base/251276 Log: Fix a bug in which the user's choice to Cancel was not recognized. This was caused by the standard (and correct) behavior of the shell to discard the return status of lvalue-operands in a pipe-chain. The solution is to not pipe the file-acquisition directly into sort(1) but instead store the output (allowing immediate testing of the return status) and later sort it. Modified: head/usr.sbin/bsdconfig/share/packages/index.subr Modified: head/usr.sbin/bsdconfig/share/packages/index.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/packages/index.subr Sun Jun 2 23:18:27 2013 (r251275) +++ head/usr.sbin/bsdconfig/share/packages/index.subr Sun Jun 2 23:20:46 2013 (r251276) @@ -70,13 +70,14 @@ f_index_initialize() f_show_info "$msg_attempting_to_fetch_file_from_selected_media" \ "$__path" - eval "$__var_to_set"='$( f_device_get media "$__path" | sort )' + eval "$__var_to_set"='$( f_device_get media "$__path" )' if [ $? -ne $SUCCESS ]; then f_show_msg "$msg_unable_to_get_file_from_selected_media" \ "$__path" f_device_shutdown media return $FAILURE fi + eval "$__var_to_set"='$( debug= f_getvar "$__var_to_set" | sort )' f_show_info "$msg_located_index_now_reading_package_data_from_it" if ! f_index_read "$__var_to_set"; then From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:23:30 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 84E91B9F; Sun, 2 Jun 2013 23:23:30 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 769C81CD0; Sun, 2 Jun 2013 23:23:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52NNUIA096194; Sun, 2 Jun 2013 23:23:30 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52NNUCl096193; Sun, 2 Jun 2013 23:23:30 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022323.r52NNUCl096193@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 23:23:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251277 - head/usr.sbin/bsdconfig/startup X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:23:30 -0000 Author: dteske Date: Sun Jun 2 23:23:29 2013 New Revision: 251277 URL: http://svnweb.freebsd.org/changeset/base/251277 Log: Fix a typo. In this case, the typo caused the f_noyes() invocation to display a global instead of the passed-argument; however since the global always has the same value as the passed argument, it made no difference in the realtime operation. Modified: head/usr.sbin/bsdconfig/startup/rcdelete Modified: head/usr.sbin/bsdconfig/startup/rcdelete ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcdelete Sun Jun 2 23:20:46 2013 (r251276) +++ head/usr.sbin/bsdconfig/startup/rcdelete Sun Jun 2 23:23:29 2013 (r251277) @@ -253,7 +253,7 @@ dialog_menu_confirm_delete() # If asked to delete only one variable, simply ask and return if [ $# -eq 1 ]; then - f_noyes "$msg_are_you_sure_you_want_to_delete" "$delete_vars" + f_noyes "$msg_are_you_sure_you_want_to_delete" "$1" return $? fi # Not reached unless requested to delete multiple variables From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:25:28 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 51B39D1D; Sun, 2 Jun 2013 23:25:28 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 425B51CD9; Sun, 2 Jun 2013 23:25:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52NPStG096593; Sun, 2 Jun 2013 23:25:28 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52NPSs1096592; Sun, 2 Jun 2013 23:25:28 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306022325.r52NPSs1096592@svn.freebsd.org> From: Devin Teske Date: Sun, 2 Jun 2013 23:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251278 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:25:28 -0000 Author: dteske Date: Sun Jun 2 23:25:27 2013 New Revision: 251278 URL: http://svnweb.freebsd.org/changeset/base/251278 Log: Like r250701, introduce another handy function for truncating variables to a specific byte-length. Works like vsnprintf(3). Modified: head/usr.sbin/bsdconfig/share/strings.subr Modified: head/usr.sbin/bsdconfig/share/strings.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/strings.subr Sun Jun 2 23:23:29 2013 (r251277) +++ head/usr.sbin/bsdconfig/share/strings.subr Sun Jun 2 23:25:27 2013 (r251278) @@ -71,6 +71,41 @@ f_snprintf() }'\' \) } +# f_vsnprintf $var_to_set $size $format $format_args +# +# Similar to vsnprintf(3), write at most $size number of bytes into $var_to_set +# using printf(1) syntax (`$format $format_args'). The value of $var_to_set is +# NULL unless at-least one byte is stored from the output. +# +# Example 1: +# +# limit=7 format="%s" +# format_args="'abc 123'" # 3-spaces between abc and 123 +# f_vsnprintf foo $limit "$format" "$format_args" # foo=[abc 1] +# +# Example 2: +# +# limit=12 format="%s %s" +# format_args=" 'doghouse' 'foxhound' " +# # even more spaces added to illustrate escape-method +# f_vsnprintf foo $limit "$format" "$format_args" # foo=[doghouse fox] +# +# Example 3: +# +# limit=13 format="%s %s" +# f_shell_escape arg1 'aaa"aaa' # arg1=[aaa"aaa] (no change) +# f_shell_escape arg2 "aaa'aaa" # arg2=[aaa'\''aaa] (escaped s-quote) +# format_args="'$arg1' '$arg2'" # use single-quotes to surround args +# f_vsnprintf foo $limit "$format" "$format_args" # foo=[aaa"aaa aaa'a] +# +# In all of the above examples, the call to f_vsnprintf() does not change. Only +# the contents of $limit, $format, and $format_args changes in each example. +# +f_vsnprintf() +{ + eval f_snprintf \"\$1\" \"\$2\" \"\$3\" $4 +} + # f_longest_line_length # # Simple wrapper to an awk(1) script to print the length of the longest line of From owner-svn-src-all@FreeBSD.ORG Sun Jun 2 23:56:39 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C1B1D5C9; Sun, 2 Jun 2013 23:56:39 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A2EBA1D8B; Sun, 2 Jun 2013 23:56:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r52NudGu007448; Sun, 2 Jun 2013 23:56:39 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r52Nudgd007442; Sun, 2 Jun 2013 23:56:39 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201306022356.r52Nudgd007442@svn.freebsd.org> From: Brian Somers Date: Sun, 2 Jun 2013 23:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251279 - head/usr.sbin/ppp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 23:56:39 -0000 Author: brian Date: Sun Jun 2 23:56:38 2013 New Revision: 251279 URL: http://svnweb.freebsd.org/changeset/base/251279 Log: Move ppp.8.m4 back to ppp.8 and de-ifdef it. Requested by: joel MFC after: 1 week Added: head/usr.sbin/ppp/ppp.8 - copied, changed from r251278, head/usr.sbin/ppp/ppp.8.m4 Deleted: head/usr.sbin/ppp/ppp.8.m4 Modified: head/usr.sbin/ppp/Makefile Modified: head/usr.sbin/ppp/Makefile ============================================================================== --- head/usr.sbin/ppp/Makefile Sun Jun 2 23:25:27 2013 (r251278) +++ head/usr.sbin/ppp/Makefile Sun Jun 2 23:56:38 2013 (r251279) @@ -44,13 +44,6 @@ M4FLAGS= LDADD= -lcrypt -lmd -lutil -lz DPADD= ${LIBCRYPT} ${LIBMD} ${LIBUTIL} ${LIBZ} -.SUFFIXES: .8 .8.m4 - -.8.m4.8: - m4 ${M4FLAGS} ${.IMPSRC} >${.TARGET} - -CLEANFILES= ppp.8 - .if defined(PPP_CONFDIR) && !empty(PPP_CONFDIR) CFLAGS+=-DPPP_CONFDIR=\"${PPP_CONFDIR}\" .endif Copied and modified: head/usr.sbin/ppp/ppp.8 (from r251278, head/usr.sbin/ppp/ppp.8.m4) ============================================================================== --- head/usr.sbin/ppp/ppp.8.m4 Sun Jun 2 23:25:27 2013 (r251278, copy source) +++ head/usr.sbin/ppp/ppp.8 Sun Jun 2 23:56:38 2013 (r251279) @@ -1,5 +1,3 @@ -changequote({,})dnl -changecom(,)dnl .\" .\" Copyright (c) 2001 Brian Somers .\" All rights reserved. @@ -65,10 +63,9 @@ This allows .Nm to act as a NAT or masquerading engine for all machines on an internal LAN. -ifdef({LOCALNAT},{},{Refer to +Refer to .Xr libalias 3 for details on the technical side of the NAT engine. -})dnl Refer to the .Sx NETWORK ADDRESS TRANSLATION (PACKET ALIASING) section of this manual page for details on how to configure NAT in @@ -313,14 +310,13 @@ An extension to PAP and CHAP, allows authentication information to be stored in a central or distributed database along with various per-user framed connection characteristics. -ifdef({LOCALRAD},{},{If +If .Xr libradius 3 is available at compile time, .Nm will use it to make .Em RADIUS requests when configured to do so. -})dnl .It Supports Proxy Arp. .Nm can be configured to make one or more proxy arp entries on behalf of @@ -3018,9 +3014,9 @@ The option can only be enabled if networ With this option enabled, .Nm will pass traffic for old interface addresses through the NAT -ifdef({LOCALNAT},{engine,},{engine +engine (see -.Xr libalias 3 ) ,}) +.Xr libalias 3 ) , resulting in the ability (in .Fl auto mode) to properly connect the process that caused the PPP link to @@ -3428,18 +3424,17 @@ you wish to map to specific machines beh .It nat deny_incoming yes|no If set to yes, this command will refuse all incoming packets where an aliasing link does not already exist. -ifdef({LOCALNAT},{},{Refer to the +Refer to the .Sx CONCEPTUAL BACKGROUND section of .Xr libalias 3 for a description of what an .Dq aliasing link is. -})dnl .Pp It should be noted under what circumstances an aliasing link is -ifdef({LOCALNAT},{created.},{created by -.Xr libalias 3 .}) +created by +.Xr libalias 3 . It may be necessary to further protect your network from outside connections using the .Dq set filter @@ -3524,12 +3519,11 @@ for example: This command tells .Nm to proxy certain connections, redirecting them to a given server. -ifdef({LOCALNAT},{},{Refer to the description of +Refer to the description of .Fn PacketAliasProxyRule in .Xr libalias 3 for details of the available commands. -})dnl .It nat punch_fw Op Ar base count This command tells .Nm @@ -3567,9 +3561,8 @@ if you want to support protocols such as connections to come from a well known port. .It nat target Op Ar address Set the given target address or clear it if no address is given. -The target address is used -ifdef({LOCALNAT},{},{by libalias })dnl -to specify how to NAT incoming packets by default. +The target address is used by libalias to specify how to NAT incoming packets +by default. If a target address is not set or if .Dq default is given, packets are not altered and are allowed to route to the internal @@ -3577,10 +3570,7 @@ network. .Pp The target address may be set to .Dq MYADDR , -in which case -ifdef({LOCALNAT},{all packets will be redirected}, -{libalias will redirect all packets}) -to the interface address. +in which case libalias will redirect all packets to the interface address. .It nat use_sockets yes|no When enabled, this option tells the network address translation engine to create a socket so that it can guarantee a correct incoming ftp data or @@ -6055,10 +6045,8 @@ This socket is used to pass links betwee .Xr kldload 2 , .Xr pipe 2 , .Xr socketpair 2 , -ifdef({LOCALNAT},{},{.Xr libalias 3 , -})dnl -ifdef({LOCALRAD},{},{.Xr libradius 3 , -})dnl +.Xr libalias 3 , +.Xr libradius 3 , .Xr syslog 3 , .Xr uucplock 3 , .Xr netgraph 4 , From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 01:22:55 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3261F2C2; Mon, 3 Jun 2013 01:22:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 249F01F5B; Mon, 3 Jun 2013 01:22:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r531Mt7P039458; Mon, 3 Jun 2013 01:22:55 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r531MsuG039456; Mon, 3 Jun 2013 01:22:54 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201306030122.r531MsuG039456@svn.freebsd.org> From: Alan Cox Date: Mon, 3 Jun 2013 01:22:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251280 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 01:22:55 -0000 Author: alc Date: Mon Jun 3 01:22:54 2013 New Revision: 251280 URL: http://svnweb.freebsd.org/changeset/base/251280 Log: Require that the page lock is held, instead of the object lock, when clearing the page's PGA_REFERENCED flag. Since we are typically manipulating the page's act_count field when we are clearing its PGA_REFERENCED flag, the page lock is already held everywhere that we clear the PGA_REFERENCED flag. So, in fact, this revision only changes some comments and an assertion. Nonetheless, it will enable later changes to object locking in the pageout code. Introduce vm_page_assert_locked(), which completely hides the implementation details of the page lock from the caller, and use it in vm_page_aflag_clear(). (The existing vm_page_lock_assert() could not be used in vm_page_aflag_clear().) Over the coming weeks, I expect that we'll either eliminate or replace the various uses of vm_page_lock_assert() with vm_page_assert_locked(). Reviewed by: attilio Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Jun 2 23:56:38 2013 (r251279) +++ head/sys/vm/vm_page.c Mon Jun 3 01:22:54 2013 (r251280) @@ -2725,6 +2725,13 @@ vm_page_trylock_KBI(vm_page_t m, const c #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) void +vm_page_assert_locked_KBI(vm_page_t m, const char *file, int line) +{ + + vm_page_lock_assert_KBI(m, MA_OWNED, file, line); +} + +void vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int line) { Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sun Jun 2 23:56:38 2013 (r251279) +++ head/sys/vm/vm_page.h Mon Jun 3 01:22:54 2013 (r251280) @@ -229,9 +229,12 @@ extern struct mtx_padalign pa_lock[]; #define vm_page_trylock(m) mtx_trylock(vm_page_lockptr((m))) #endif #if defined(INVARIANTS) +#define vm_page_assert_locked(m) \ + vm_page_assert_locked_KBI((m), __FILE__, __LINE__) #define vm_page_lock_assert(m, a) \ vm_page_lock_assert_KBI((m), (a), __FILE__, __LINE__) #else +#define vm_page_assert_locked(m) #define vm_page_lock_assert(m, a) #endif @@ -240,10 +243,9 @@ extern struct mtx_padalign pa_lock[]; * these flags, the functions vm_page_aflag_set() and vm_page_aflag_clear() * must be used. Neither these flags nor these functions are part of the KBI. * - * PGA_REFERENCED may be cleared only if the object containing the page is - * locked. It is set by both the MI and MD VM layers. However, kernel - * loadable modules should not directly set this flag. They should call - * vm_page_reference() instead. + * PGA_REFERENCED may be cleared only if the page is locked. It is set by + * both the MI and MD VM layers. However, kernel loadable modules should not + * directly set this flag. They should call vm_page_reference() instead. * * PGA_WRITEABLE is set exclusively on managed pages by pmap_enter(). When it * does so, the page must be VPO_BUSY. The MI VM layer must never access this @@ -424,6 +426,7 @@ void vm_page_lock_KBI(vm_page_t m, const void vm_page_unlock_KBI(vm_page_t m, const char *file, int line); int vm_page_trylock_KBI(vm_page_t m, const char *file, int line); #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) +void vm_page_assert_locked_KBI(vm_page_t m, const char *file, int line); void vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int line); #endif @@ -451,11 +454,10 @@ vm_page_aflag_clear(vm_page_t m, uint8_t uint32_t *addr, val; /* - * The PGA_REFERENCED flag can only be cleared if the object - * containing the page is locked. + * The PGA_REFERENCED flag can only be cleared if the page is locked. */ if ((bits & PGA_REFERENCED) != 0) - VM_PAGE_OBJECT_LOCK_ASSERT(m); + vm_page_assert_locked(m); /* * Access the whole 32-bit word containing the aflags field with an From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:11:44 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2A1C1C4F; Mon, 3 Jun 2013 04:11:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1D20B16D6; Mon, 3 Jun 2013 04:11:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534BgaV000821; Mon, 3 Jun 2013 04:11:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534BggU000820; Mon, 3 Jun 2013 04:11:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030411.r534BggU000820@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:11:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251281 - head/sys/dev/drm2/i915 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:11:44 -0000 Author: kib Date: Mon Jun 3 04:11:42 2013 New Revision: 251281 URL: http://svnweb.freebsd.org/changeset/base/251281 Log: The vm_page lock is not needed around the call to vm_page_insert(). Submitted by: alc MFC after: 1 week Modified: head/sys/dev/drm2/i915/i915_gem.c Modified: head/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- head/sys/dev/drm2/i915/i915_gem.c Mon Jun 3 01:22:54 2013 (r251280) +++ head/sys/dev/drm2/i915/i915_gem.c Mon Jun 3 04:11:42 2013 (r251281) @@ -1426,9 +1426,7 @@ unlocked_vmobj: } m->valid = VM_PAGE_BITS_ALL; *mres = m; - vm_page_lock(m); vm_page_insert(m, vm_obj, OFF_TO_IDX(offset)); - vm_page_unlock(m); vm_page_busy(m); CTR4(KTR_DRM, "fault %p %jx %x phys %x", gem_obj, offset, prot, From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:16:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F40CCDD6; Mon, 3 Jun 2013 04:16:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E6FFF16E6; Mon, 3 Jun 2013 04:16:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534GmeP001873; Mon, 3 Jun 2013 04:16:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534GmCA001872; Mon, 3 Jun 2013 04:16:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030416.r534GmCA001872@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:16:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251282 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:16:49 -0000 Author: kib Date: Mon Jun 3 04:16:48 2013 New Revision: 251282 URL: http://svnweb.freebsd.org/changeset/base/251282 Log: When auto-sizing the buffer cache, limit the amount of physical memory used as the estimation of size, to 32GB. This provides around 100K of buffer headers and corresponding KVA for buffer map at the peak. Sizing the cache larger is not useful, also resulting in the wasting and exhausting of KVA for large machines. Reported and tested by: bdrewery Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Mon Jun 3 04:11:42 2013 (r251281) +++ head/sys/kern/vfs_bio.c Mon Jun 3 04:16:48 2013 (r251282) @@ -560,7 +560,8 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon nbuf += min((physmem_est - 4096) / factor, 65536 / factor); if (physmem_est > 65536) - nbuf += (physmem_est - 65536) * 2 / (factor * 5); + nbuf += min((physmem_est - 65536) * 2 / (factor * 5), + 32 * 1024 * 1024 / (factor * 5)); if (maxbcache && nbuf > maxbcache / BKVASIZE) nbuf = maxbcache / BKVASIZE; From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:19:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C6282F62; Mon, 3 Jun 2013 04:19:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B80BD16F5; Mon, 3 Jun 2013 04:19:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534JLvY002367; Mon, 3 Jun 2013 04:19:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534JL7b002365; Mon, 3 Jun 2013 04:19:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030419.r534JL7b002365@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:19:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251283 - head/sys/i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:19:21 -0000 Author: kib Date: Mon Jun 3 04:19:21 2013 New Revision: 251283 URL: http://svnweb.freebsd.org/changeset/base/251283 Log: MFamd64: when printing the trap information, show the %esp value. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/trap.c Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Mon Jun 3 04:16:48 2013 (r251282) +++ head/sys/i386/i386/trap.c Mon Jun 3 04:19:21 2013 (r251283) @@ -767,10 +767,10 @@ trap(struct trapframe *frame) ksi.ksi_trapno = type; if (uprintf_signal) { uprintf("pid %d comm %s: signal %d err %x code %d type %d " - "addr 0x%x eip 0x%08x " + "addr 0x%x esp 0x%08x eip 0x%08x " "<%02x %02x %02x %02x %02x %02x %02x %02x>\n", p->p_pid, p->p_comm, i, frame->tf_err, ucode, type, addr, - frame->tf_eip, + frame->tf_esp, frame->tf_eip, fubyte((void *)(frame->tf_eip + 0)), fubyte((void *)(frame->tf_eip + 1)), fubyte((void *)(frame->tf_eip + 2)), From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:22:43 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6A0A2180; Mon, 3 Jun 2013 04:22:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5B068170E; Mon, 3 Jun 2013 04:22:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534MhVl004632; Mon, 3 Jun 2013 04:22:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534MhYK004631; Mon, 3 Jun 2013 04:22:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030422.r534MhYK004631@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:22:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251284 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:22:43 -0000 Author: kib Date: Mon Jun 3 04:22:42 2013 New Revision: 251284 URL: http://svnweb.freebsd.org/changeset/base/251284 Log: Since the cause of the problems with the __fillcontextx() was identified, unify the code of check_deferred_signal() for all architectures, making the variant under #ifdef x86 common. Tested by: marius (sparc64) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Mon Jun 3 04:19:21 2013 (r251283) +++ head/lib/libthr/thread/thr_sig.c Mon Jun 3 04:22:42 2013 (r251284) @@ -318,31 +318,23 @@ check_deferred_signal(struct pthread *cu ucontext_t *uc; struct sigaction act; siginfo_t info; + int uc_len; if (__predict_true(curthread->deferred_siginfo.si_signo == 0)) return; -#if defined(__amd64__) || defined(__i386__) - int uc_len; uc_len = __getcontextx_size(); uc = alloca(uc_len); getcontext(uc); if (curthread->deferred_siginfo.si_signo == 0) return; __fillcontextx2((char *)uc); -#else - ucontext_t ucv; - uc = &ucv; - getcontext(uc); -#endif - if (curthread->deferred_siginfo.si_signo != 0) { - act = curthread->deferred_sigact; - uc->uc_sigmask = curthread->deferred_sigmask; - memcpy(&info, &curthread->deferred_siginfo, sizeof(siginfo_t)); - /* remove signal */ - curthread->deferred_siginfo.si_signo = 0; - handle_signal(&act, info.si_signo, &info, uc); - } + act = curthread->deferred_sigact; + uc->uc_sigmask = curthread->deferred_sigmask; + memcpy(&info, &curthread->deferred_siginfo, sizeof(siginfo_t)); + /* remove signal */ + curthread->deferred_siginfo.si_signo = 0; + handle_signal(&act, info.si_signo, &info, uc); } static void From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:32:54 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5052B4BF; Mon, 3 Jun 2013 04:32:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 435121759; Mon, 3 Jun 2013 04:32:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534Ws06007972; Mon, 3 Jun 2013 04:32:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534WsnH007971; Mon, 3 Jun 2013 04:32:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030432.r534WsnH007971@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251285 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:32:54 -0000 Author: kib Date: Mon Jun 3 04:32:53 2013 New Revision: 251285 URL: http://svnweb.freebsd.org/changeset/base/251285 Log: Do not map the shared page COW. If the process wired its address space, fork(2) would cause shadowing of the physical object and copying of the shared page into private copy, effectively preventing updates for the exported timehands structure and stopping the clock. Specify the maximum allowed permissions for the page to be read and execute, preventing write from the user mode. Reported and tested by: Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Jun 3 04:22:42 2013 (r251284) +++ head/sys/kern/kern_exec.c Mon Jun 3 04:32:53 2013 (r251285) @@ -1050,8 +1050,9 @@ exec_new_vmspace(imgp, sv) vm_object_reference(obj); error = vm_map_fixed(map, obj, 0, sv->sv_shared_page_base, sv->sv_shared_page_len, - VM_PROT_READ | VM_PROT_EXECUTE, VM_PROT_ALL, - MAP_COPY_ON_WRITE | MAP_ACC_NO_CHARGE); + VM_PROT_READ | VM_PROT_EXECUTE, + VM_PROT_READ | VM_PROT_EXECUTE, + MAP_INHERIT_SHARE | MAP_ACC_NO_CHARGE); if (error) { vm_object_deallocate(obj); return (error); From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:37:12 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2D0E8659; Mon, 3 Jun 2013 04:37:12 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 1D0FC1773; Mon, 3 Jun 2013 04:37:11 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 0E1AD1A3C19; Sun, 2 Jun 2013 21:27:56 -0700 (PDT) Message-ID: <51AC1B49.9090001@mu.org> Date: Sun, 02 Jun 2013 21:27:53 -0700 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Konstantin Belousov Subject: Re: svn commit: r251282 - head/sys/kern References: <201306030416.r534GmCA001872@svn.freebsd.org> In-Reply-To: <201306030416.r534GmCA001872@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:37:12 -0000 Hey Konstaintin, shouldn't this be scaled against the actual amount of KVA we have instead of an arbitrary limit? -Alfred On 6/2/13 9:16 PM, Konstantin Belousov wrote: > Author: kib > Date: Mon Jun 3 04:16:48 2013 > New Revision: 251282 > URL: http://svnweb.freebsd.org/changeset/base/251282 > > Log: > When auto-sizing the buffer cache, limit the amount of physical memory > used as the estimation of size, to 32GB. This provides around 100K of > buffer headers and corresponding KVA for buffer map at the peak. > Sizing the cache larger is not useful, also resulting in the wasting > and exhausting of KVA for large machines. > > Reported and tested by: bdrewery > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/kern/vfs_bio.c > > Modified: head/sys/kern/vfs_bio.c > ============================================================================== > --- head/sys/kern/vfs_bio.c Mon Jun 3 04:11:42 2013 (r251281) > +++ head/sys/kern/vfs_bio.c Mon Jun 3 04:16:48 2013 (r251282) > @@ -560,7 +560,8 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon > nbuf += min((physmem_est - 4096) / factor, > 65536 / factor); > if (physmem_est > 65536) > - nbuf += (physmem_est - 65536) * 2 / (factor * 5); > + nbuf += min((physmem_est - 65536) * 2 / (factor * 5), > + 32 * 1024 * 1024 / (factor * 5)); > > if (maxbcache && nbuf > maxbcache / BKVASIZE) > nbuf = maxbcache / BKVASIZE; > From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:48:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D30599C0; Mon, 3 Jun 2013 04:48:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AA71917A1; Mon, 3 Jun 2013 04:48:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534m9Rx012365; Mon, 3 Jun 2013 04:48:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534m9pf012363; Mon, 3 Jun 2013 04:48:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030448.r534m9pf012363@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:48:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251286 - in stable/9/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:48:09 -0000 Author: kib Date: Mon Jun 3 04:48:09 2013 New Revision: 251286 URL: http://svnweb.freebsd.org/changeset/base/251286 Log: MFC r251033: When handling an exception from the attempt from loading the faulting context on return from the trap handler, re-enable the interrupts on i386 and amd64. Modified: stable/9/sys/amd64/amd64/exception.S stable/9/sys/i386/i386/exception.s Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/exception.S ============================================================================== --- stable/9/sys/amd64/amd64/exception.S Mon Jun 3 04:32:53 2013 (r251285) +++ stable/9/sys/amd64/amd64/exception.S Mon Jun 3 04:48:09 2013 (r251286) @@ -818,6 +818,10 @@ doreti_iret_fault: .globl ds_load_fault ds_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movq %rsp,%rdi call trap movw $KUDSEL,TF_DS(%rsp) @@ -827,6 +831,10 @@ ds_load_fault: .globl es_load_fault es_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movq %rsp,%rdi call trap movw $KUDSEL,TF_ES(%rsp) @@ -835,6 +843,10 @@ es_load_fault: ALIGN_TEXT .globl fs_load_fault fs_load_fault: + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movl $T_PROTFLT,TF_TRAPNO(%rsp) movq %rsp,%rdi call trap @@ -846,6 +858,10 @@ fs_load_fault: gs_load_fault: popfq movl $T_PROTFLT,TF_TRAPNO(%rsp) + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movq %rsp,%rdi call trap movw $KUG32SEL,TF_GS(%rsp) @@ -855,6 +871,10 @@ gs_load_fault: .globl fsbase_load_fault fsbase_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movq %rsp,%rdi call trap movq PCPU(CURTHREAD),%r8 @@ -866,6 +886,10 @@ fsbase_load_fault: .globl gsbase_load_fault gsbase_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movq %rsp,%rdi call trap movq PCPU(CURTHREAD),%r8 Modified: stable/9/sys/i386/i386/exception.s ============================================================================== --- stable/9/sys/i386/i386/exception.s Mon Jun 3 04:32:53 2013 (r251285) +++ stable/9/sys/i386/i386/exception.s Mon Jun 3 04:48:09 2013 (r251286) @@ -422,6 +422,7 @@ doreti_popl_es_fault: pushl %fs .globl doreti_popl_fs_fault doreti_popl_fs_fault: + sti movl $0,TF_ERR(%esp) /* XXX should be the error code */ movl $T_PROTFLT,TF_TRAPNO(%esp) jmp alltraps_with_regs_pushed From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:50:22 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 708DBB3A; Mon, 3 Jun 2013 04:50:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6194517B0; Mon, 3 Jun 2013 04:50:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534oMbM014374; Mon, 3 Jun 2013 04:50:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534oMQl014373; Mon, 3 Jun 2013 04:50:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030450.r534oMQl014373@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:50:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251287 - stable/9/sys/amd64/amd64 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:50:22 -0000 Author: kib Date: Mon Jun 3 04:50:21 2013 New Revision: 251287 URL: http://svnweb.freebsd.org/changeset/base/251287 Log: MFC r251035: When reporting the fault details, also print %rsp.r251035: When reporting the fault details, also print %rsp. Modified: stable/9/sys/amd64/amd64/trap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/trap.c ============================================================================== --- stable/9/sys/amd64/amd64/trap.c Mon Jun 3 04:48:09 2013 (r251286) +++ stable/9/sys/amd64/amd64/trap.c Mon Jun 3 04:50:21 2013 (r251287) @@ -617,10 +617,10 @@ trap(struct trapframe *frame) ksi.ksi_addr = (void *)addr; if (uprintf_signal) { uprintf("pid %d comm %s: signal %d err %lx code %d type %d " - "addr 0x%lx rip 0x%lx " + "addr 0x%lx rsp 0x%lx rip 0x%lx " "<%02x %02x %02x %02x %02x %02x %02x %02x>\n", p->p_pid, p->p_comm, i, frame->tf_err, ucode, type, addr, - frame->tf_rip, + frame->tf_rsp, frame->tf_rip, fubyte((void *)(frame->tf_rip + 0)), fubyte((void *)(frame->tf_rip + 1)), fubyte((void *)(frame->tf_rip + 2)), From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:52:32 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0B58ECBD; Mon, 3 Jun 2013 04:52:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F186E17BE; Mon, 3 Jun 2013 04:52:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534qVvH014964; Mon, 3 Jun 2013 04:52:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534qVXs014963; Mon, 3 Jun 2013 04:52:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030452.r534qVXs014963@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:52:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251288 - stable/9/sys/amd64/ia32 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:52:32 -0000 Author: kib Date: Mon Jun 3 04:52:31 2013 New Revision: 251288 URL: http://svnweb.freebsd.org/changeset/base/251288 Log: MFC r251037: The ia32_get_mcontext() does not need to set PCB_FULL_IRET. Modified: stable/9/sys/amd64/ia32/ia32_signal.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/ia32/ia32_signal.c ============================================================================== --- stable/9/sys/amd64/ia32/ia32_signal.c Mon Jun 3 04:50:21 2013 (r251287) +++ stable/9/sys/amd64/ia32/ia32_signal.c Mon Jun 3 04:52:31 2013 (r251288) @@ -187,7 +187,6 @@ ia32_get_mcontext(struct thread *td, str mcp->mc_xfpustate = 0; mcp->mc_xfpustate_len = 0; bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2)); - set_pcb_flags(pcb, PCB_FULL_IRET); return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:55:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2027CE3F; Mon, 3 Jun 2013 04:55:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 117FB17D4; Mon, 3 Jun 2013 04:55:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534t3it015540; Mon, 3 Jun 2013 04:55:03 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534t3hV015539; Mon, 3 Jun 2013 04:55:03 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030455.r534t3hV015539@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:55:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251289 - stable/9/sys/amd64/ia32 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:55:04 -0000 Author: kib Date: Mon Jun 3 04:55:03 2013 New Revision: 251289 URL: http://svnweb.freebsd.org/changeset/base/251289 Log: MFC r251038: Use _MC_IA32_HASFPXSTATE name instead of _MC_HASFPXSTATE. Modified: stable/9/sys/amd64/ia32/ia32_signal.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/ia32/ia32_signal.c ============================================================================== --- stable/9/sys/amd64/ia32/ia32_signal.c Mon Jun 3 04:52:31 2013 (r251288) +++ stable/9/sys/amd64/ia32/ia32_signal.c Mon Jun 3 04:55:03 2013 (r251289) @@ -112,7 +112,7 @@ ia32_get_fpcontext(struct thread *td, st len = max_len; bzero(xfpusave + max_len, len - max_len); } - mcp->mc_flags |= _MC_HASFPXSTATE; + mcp->mc_flags |= _MC_IA32_HASFPXSTATE; mcp->mc_xfpustate_len = len; bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:57:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4A97EFBE; Mon, 3 Jun 2013 04:57:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2050117E4; Mon, 3 Jun 2013 04:57:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534vG24015986; Mon, 3 Jun 2013 04:57:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534vFPX015982; Mon, 3 Jun 2013 04:57:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030457.r534vFPX015982@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:57:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251290 - in stable/9/sys: amd64/amd64 amd64/ia32 i386/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:57:16 -0000 Author: kib Date: Mon Jun 3 04:57:15 2013 New Revision: 251290 URL: http://svnweb.freebsd.org/changeset/base/251290 Log: MFC r251039: Use slightly more idiomatic expression to get the address of array. Modified: stable/9/sys/amd64/amd64/machdep.c stable/9/sys/amd64/ia32/ia32_signal.c stable/9/sys/i386/i386/machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/machdep.c Mon Jun 3 04:55:03 2013 (r251289) +++ stable/9/sys/amd64/amd64/machdep.c Mon Jun 3 04:57:15 2013 (r251290) @@ -2244,7 +2244,7 @@ get_fpcontext(struct thread *td, mcontex size_t max_len, len; mcp->mc_ownedfp = fpugetregs(td); - bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate, + bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); if (!use_xsave || xfpusave_len == 0) Modified: stable/9/sys/amd64/ia32/ia32_signal.c ============================================================================== --- stable/9/sys/amd64/ia32/ia32_signal.c Mon Jun 3 04:55:03 2013 (r251289) +++ stable/9/sys/amd64/ia32/ia32_signal.c Mon Jun 3 04:57:15 2013 (r251290) @@ -101,7 +101,7 @@ ia32_get_fpcontext(struct thread *td, st * for now, it should be irrelevant for most applications. */ mcp->mc_ownedfp = fpugetregs(td); - bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate, + bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); if (!use_xsave || xfpusave_len == 0) Modified: stable/9/sys/i386/i386/machdep.c ============================================================================== --- stable/9/sys/i386/i386/machdep.c Mon Jun 3 04:55:03 2013 (r251289) +++ stable/9/sys/i386/i386/machdep.c Mon Jun 3 04:57:15 2013 (r251290) @@ -3453,7 +3453,7 @@ get_fpcontext(struct thread *td, mcontex bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate)); #else mcp->mc_ownedfp = npxgetregs(td); - bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate, + bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = npxformat(); #endif From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 04:58:13 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 862B11BE; Mon, 3 Jun 2013 04:58:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 764CF17EE; Mon, 3 Jun 2013 04:58:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r534wDLa016208; Mon, 3 Jun 2013 04:58:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r534wDrd016207; Mon, 3 Jun 2013 04:58:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306030458.r534wDrd016207@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 04:58:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251291 - stable/9/lib/libthr/thread X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 04:58:13 -0000 Author: kib Date: Mon Jun 3 04:58:12 2013 New Revision: 251291 URL: http://svnweb.freebsd.org/changeset/base/251291 Log: MFC r251040: Partially apply the capitalization of the heading word of the sequence and fix typo. Modified: stable/9/lib/libthr/thread/thr_sig.c Directory Properties: stable/9/lib/libthr/ (props changed) Modified: stable/9/lib/libthr/thread/thr_sig.c ============================================================================== --- stable/9/lib/libthr/thread/thr_sig.c Mon Jun 3 04:57:15 2013 (r251290) +++ stable/9/lib/libthr/thread/thr_sig.c Mon Jun 3 04:58:12 2013 (r251291) @@ -205,9 +205,9 @@ handle_signal(struct sigaction *actp, in curthread->in_sigsuspend = 0; /* - * if thread is in deferred cancellation mode, disable cancellation + * If thread is in deferred cancellation mode, disable cancellation * in signal handler. - * if user signal handler calls a cancellation point function, e.g, + * If user signal handler calls a cancellation point function, e.g, * it calls write() to write data to file, because write() is a * cancellation point, the thread is immediately cancelled if * cancellation is pending, to avoid this problem while thread is in @@ -229,7 +229,7 @@ handle_signal(struct sigaction *actp, in * We have already reset cancellation point flags, so if user's code * longjmp()s out of its signal handler, wish its jmpbuf was set * outside of a cancellation point, in most cases, this would be - * true. however, ther is no way to save cancel_enable in jmpbuf, + * true. However, there is no way to save cancel_enable in jmpbuf, * so after setjmps() returns once more, the user code may need to * re-set cancel_enable flag by calling pthread_setcancelstate(). */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 07:55:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0C0B39DE; Mon, 3 Jun 2013 07:55:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id A2A961CBB; Mon, 3 Jun 2013 07:55:44 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r537tdYa068932; Mon, 3 Jun 2013 10:55:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r537tdYa068932 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r537tdkj068929; Mon, 3 Jun 2013 10:55:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 3 Jun 2013 10:55:39 +0300 From: Konstantin Belousov To: Alfred Perlstein Subject: Re: svn commit: r251282 - head/sys/kern Message-ID: <20130603075539.GK3047@kib.kiev.ua> References: <201306030416.r534GmCA001872@svn.freebsd.org> <51AC1B49.9090001@mu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SdoyoXCIx8sI4ZrW" Content-Disposition: inline In-Reply-To: <51AC1B49.9090001@mu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 07:55:45 -0000 --SdoyoXCIx8sI4ZrW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 02, 2013 at 09:27:53PM -0700, Alfred Perlstein wrote: > Hey Konstaintin, shouldn't this be scaled against the actual amount of=20 > KVA we have instead of an arbitrary limit? The commit changes the buffer cache to scale according to the available KVA, making the scaling less dumb. I do not understand what exactly do you want to do, please describe the algorithm you propose to implement instead of my change. >=20 > -Alfred >=20 > On 6/2/13 9:16 PM, Konstantin Belousov wrote: > > Author: kib > > Date: Mon Jun 3 04:16:48 2013 > > New Revision: 251282 > > URL: http://svnweb.freebsd.org/changeset/base/251282 > > > > Log: > > When auto-sizing the buffer cache, limit the amount of physical memo= ry > > used as the estimation of size, to 32GB. This provides around 100K = of > > buffer headers and corresponding KVA for buffer map at the peak. > > Sizing the cache larger is not useful, also resulting in the wasting > > and exhausting of KVA for large machines. > > =20 > > Reported and tested by: bdrewery > > Sponsored by: The FreeBSD Foundation > > > > Modified: > > head/sys/kern/vfs_bio.c > > > > Modified: head/sys/kern/vfs_bio.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/kern/vfs_bio.c Mon Jun 3 04:11:42 2013 (r251281) > > +++ head/sys/kern/vfs_bio.c Mon Jun 3 04:16:48 2013 (r251282) > > @@ -560,7 +560,8 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon > > nbuf +=3D min((physmem_est - 4096) / factor, > > 65536 / factor); > > if (physmem_est > 65536) > > - nbuf +=3D (physmem_est - 65536) * 2 / (factor * 5); > > + nbuf +=3D min((physmem_est - 65536) * 2 / (factor * 5), > > + 32 * 1024 * 1024 / (factor * 5)); > > =20 > > if (maxbcache && nbuf > maxbcache / BKVASIZE) > > nbuf =3D maxbcache / BKVASIZE; > > --SdoyoXCIx8sI4ZrW Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJRrEv6AAoJEJDCuSvBvK1BLrQQAIWpzL7foVjn/0YwseXBa/QZ 1Nz3Rh3VyA6/QG0xD+XpSp7mlehiFypOnzAhqanEZwt+dTxz2H5VL7MilBF+H2Mo eLRC7PD3mIUg66/PkY6ebhoyWSf5n3+Au8+xl1jub7bfi2KtunCKVIMrk1ss6iEr Um9PR/eFwYnYjiQaZI3eZrDotPi8rqIDr5gJN9wDXd9t/2xxDzXd2tZNiEsgG9sy QL22MnjrsOXFC88QRUFcLLeUxGvyizA91De+lw8Mil7Nd3TcK9AQozzi7H7ZspiT ey0sBGuycUteA3WzdzQMvLQK1pUEBLp+r2Vh9iq6PnTuV3pyAhYU5RnA17GZFaxA cOU5RoFFknPXMlyuU6Axz4J4fMNaFqex3Hl+1bwoDt+eor6hb6/gOWqBlV6mSR0M HkpvdUCLxWVX0Qh4rsP4VuiluyiP40a8xpYqw/Z3cE9sxaju4BOH6/ISZ0pWxzJ2 NN9jwudqdyYvdP4pHjc4CbCfYjbdF37JHaSLycHx23pjsPWLFu/WEzTXjp9ASBXU 5AKggwgY4JKvfyzPjAKcX4kvcdd91Z+RH7GcdFZqmAFG7+22pp+mZ4q2KD0zEkLr E5EaesC3jnKubndZFFMRAQOJynr1cmpzoK8dvLFpR41FxhBZvbHR4gk0sQn9ObwG +wKwX8sZmI3ND5g11tfT =Ib8D -----END PGP SIGNATURE----- --SdoyoXCIx8sI4ZrW-- From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 09:14:32 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DDA3B884; Mon, 3 Jun 2013 09:14:32 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CE6511F5A; Mon, 3 Jun 2013 09:14:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r539EWEJ009321; Mon, 3 Jun 2013 09:14:32 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r539EWdh009315; Mon, 3 Jun 2013 09:14:32 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201306030914.r539EWdh009315@svn.freebsd.org> From: David Schultz Date: Mon, 3 Jun 2013 09:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251292 - in head/lib/msun: . ld128 ld80 man src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 09:14:32 -0000 Author: das Date: Mon Jun 3 09:14:31 2013 New Revision: 251292 URL: http://svnweb.freebsd.org/changeset/base/251292 Log: Add logl, log2l, log10l, and log1pl. Submitted by: bde Added: head/lib/msun/ld128/s_logl.c (contents, props changed) head/lib/msun/ld80/s_logl.c (contents, props changed) Modified: head/lib/msun/Makefile head/lib/msun/Symbol.map head/lib/msun/man/log.3 head/lib/msun/src/e_log.c head/lib/msun/src/e_log10.c head/lib/msun/src/e_log2.c head/lib/msun/src/math.h head/lib/msun/src/math_private.h head/lib/msun/src/s_log1p.c Modified: head/lib/msun/Makefile ============================================================================== --- head/lib/msun/Makefile Mon Jun 3 04:58:12 2013 (r251291) +++ head/lib/msun/Makefile Mon Jun 3 09:14:31 2013 (r251292) @@ -99,8 +99,8 @@ COMMON_SRCS+= e_acosl.c e_asinl.c e_atan invtrig.c k_cosl.c k_sinl.c k_tanl.c \ s_atanl.c s_cbrtl.c s_ceill.c s_cosl.c s_cprojl.c \ s_csqrtl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \ - s_frexpl.c s_logbl.c s_nanl.c s_nextafterl.c s_nexttoward.c \ - s_remquol.c s_rintl.c s_scalbnl.c \ + s_frexpl.c s_logbl.c s_logl.c s_nanl.c s_nextafterl.c \ + s_nexttoward.c s_remquol.c s_rintl.c s_scalbnl.c \ s_sinl.c s_tanl.c s_truncl.c w_cabsl.c .endif @@ -187,7 +187,9 @@ MLINKS+=j0.3 j1.3 j0.3 jn.3 j0.3 y0.3 j0 MLINKS+=j0.3 j0f.3 j0.3 j1f.3 j0.3 jnf.3 j0.3 y0f.3 j0.3 ynf.3 MLINKS+=lgamma.3 gamma.3 lgamma.3 gammaf.3 lgamma.3 lgammaf.3 \ lgamma.3 tgamma.3 lgamma.3 tgammaf.3 -MLINKS+=log.3 log10.3 log.3 log10f.3 log.3 log1p.3 log.3 log1pf.3 log.3 logf.3 log.3 log2.3 log.3 log2f.3 +MLINKS+=log.3 log10.3 log.3 log10f.3 log.3 log10l.3 log.3 \ + log1p.3 log.3 log1pf.3 log.3 log1pl.3 log.3 logf.3 log.3 logl.3 \ + log.3 log2.3 log.3 log2f.3 log.3 log2l.3 MLINKS+=lrint.3 llrint.3 lrint.3 llrintf.3 lrint.3 llrintl.3 \ lrint.3 lrintf.3 lrint.3 lrintl.3 MLINKS+=lround.3 llround.3 lround.3 llroundf.3 lround.3 llroundl.3 \ Modified: head/lib/msun/Symbol.map ============================================================================== --- head/lib/msun/Symbol.map Mon Jun 3 04:58:12 2013 (r251291) +++ head/lib/msun/Symbol.map Mon Jun 3 09:14:31 2013 (r251292) @@ -262,4 +262,8 @@ FBSD_1.3 { ctanh; ctanhf; expl; + log10l; + log1pl; + log2l; + logl; }; Added: head/lib/msun/ld128/s_logl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/ld128/s_logl.c Mon Jun 3 09:14:31 2013 (r251292) @@ -0,0 +1,737 @@ +/*- + * Copyright (c) 2007-2013 Bruce D. Evans + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/** + * Implementation of the natural logarithm of x for 128-bit format. + * + * First decompose x into its base 2 representation: + * + * log(x) = log(X * 2**k), where X is in [1, 2) + * = log(X) + k * log(2). + * + * Let X = X_i + e, where X_i is the center of one of the intervals + * [-1.0/256, 1.0/256), [1.0/256, 3.0/256), .... [2.0-1.0/256, 2.0+1.0/256) + * and X is in this interval. Then + * + * log(X) = log(X_i + e) + * = log(X_i * (1 + e / X_i)) + * = log(X_i) + log(1 + e / X_i). + * + * The values log(X_i) are tabulated below. Let d = e / X_i and use + * + * log(1 + d) = p(d) + * + * where p(d) = d - 0.5*d*d + ... is a special minimax polynomial of + * suitably high degree. + * + * To get sufficiently small roundoff errors, k * log(2), log(X_i), and + * sometimes (if |k| is not large) the first term in p(d) must be evaluated + * and added up in extra precision. Extra precision is not needed for the + * rest of p(d). In the worst case when k = 0 and log(X_i) is 0, the final + * error is controlled mainly by the error in the second term in p(d). The + * error in this term itself is at most 0.5 ulps from the d*d operation in + * it. The error in this term relative to the first term is thus at most + * 0.5 * |-0.5| * |d| < 1.0/1024 ulps. We aim for an accumulated error of + * at most twice this at the point of the final rounding step. Thus the + * final error should be at most 0.5 + 1.0/512 = 0.5020 ulps. Exhaustive + * testing of a float variant of this function showed a maximum final error + * of 0.5008 ulps. Non-exhaustive testing of a double variant of this + * function showed a maximum final error of 0.5078 ulps (near 1+1.0/256). + * + * We made the maximum of |d| (and thus the total relative error and the + * degree of p(d)) small by using a large number of intervals. Using + * centers of intervals instead of endpoints reduces this maximum by a + * factor of 2 for a given number of intervals. p(d) is special only + * in beginning with the Taylor coefficients 0 + 1*d, which tends to happen + * naturally. The most accurate minimax polynomial of a given degree might + * be different, but then we wouldn't want it since we would have to do + * extra work to avoid roundoff error (especially for P0*d instead of d). + */ + +#ifdef DEBUG +#include +#include +#endif + +#include "fpmath.h" +#include "math.h" +#ifndef NO_STRUCT_RETURN +#define STRUCT_RETURN +#endif +#include "math_private.h" + +#if !defined(NO_UTAB) && !defined(NO_UTABL) +#define USE_UTAB +#endif + +/* + * Domain [-0.005280, 0.004838], range ~[-1.1577e-37, 1.1582e-37]: + * |log(1 + d)/d - p(d)| < 2**-122.7 + */ +static const long double +P2 = -0.5L, +P3 = 3.33333333333333333333333333333233795e-1L, /* 0x15555555555555555555555554d42.0p-114L */ +P4 = -2.49999999999999999999999999941139296e-1L, /* -0x1ffffffffffffffffffffffdab14e.0p-115L */ +P5 = 2.00000000000000000000000085468039943e-1L, /* 0x19999999999999999999a6d3567f4.0p-115L */ +P6 = -1.66666666666666666666696142372698408e-1L, /* -0x15555555555555555567267a58e13.0p-115L */ +P7 = 1.42857142857142857119522943477166120e-1L, /* 0x1249249249249248ed79a0ae434de.0p-115L */ +P8 = -1.24999999999999994863289015033581301e-1L; /* -0x1fffffffffffffa13e91765e46140.0p-116L */ +/* Double precision gives ~ 53 + log2(P9 * max(|d|)**8) ~= 120 bits. */ +static const double +P9 = 1.1111111111111401e-1, /* 0x1c71c71c71c7ed.0p-56 */ +P10 = -1.0000000000040135e-1, /* -0x199999999a0a92.0p-56 */ +P11 = 9.0909090728136258e-2, /* 0x1745d173962111.0p-56 */ +P12 = -8.3333318851855284e-2, /* -0x1555551722c7a3.0p-56 */ +P13 = 7.6928634666404178e-2, /* 0x13b1985204a4ae.0p-56 */ +P14 = -7.1626810078462499e-2; /* -0x12562276cdc5d0.0p-56 */ + +static volatile const double zero = 0; + +#define INTERVALS 128 +#define LOG2_INTERVALS 7 +#define TSIZE (INTERVALS + 1) +#define G(i) (T[(i)].G) +#define F_hi(i) (T[(i)].F_hi) +#define F_lo(i) (T[(i)].F_lo) +#define ln2_hi F_hi(TSIZE - 1) +#define ln2_lo F_lo(TSIZE - 1) +#define E(i) (U[(i)].E) +#define H(i) (U[(i)].H) + +static const struct { + float G; /* 1/(1 + i/128) rounded to 8/9 bits */ + float F_hi; /* log(1 / G_i) rounded (see below) */ + /* The compiler will insert 8 bytes of padding here. */ + long double F_lo; /* next 113 bits for log(1 / G_i) */ +} T[TSIZE] = { + /* + * ln2_hi and each F_hi(i) are rounded to a number of bits that + * makes F_hi(i) + dk*ln2_hi exact for all i and all dk. + * + * The last entry (for X just below 2) is used to define ln2_hi + * and ln2_lo, to ensure that F_hi(i) and F_lo(i) cancel exactly + * with dk*ln2_hi and dk*ln2_lo, respectively, when dk = -1. + * This is needed for accuracy when x is just below 1. (To avoid + * special cases, such x are "reduced" strangely to X just below + * 2 and dk = -1, and then the exact cancellation is needed + * because any the error from any non-exactness would be too + * large). + * + * The relevant range of dk is [-16445, 16383]. The maximum number + * of bits in F_hi(i) that works is very dependent on i but has + * a minimum of 93. We only need about 12 bits in F_hi(i) for + * it to provide enough extra precision. + * + * We round F_hi(i) to 24 bits so that it can have type float, + * mainly to minimize the size of the table. Using all 24 bits + * in a float for it automatically satisfies the above constraints. + */ + 0x800000.0p-23, 0, 0, + 0xfe0000.0p-24, 0x8080ac.0p-30, -0x14ee431dae6674afa0c4bfe16e8fd.0p-144L, + 0xfc0000.0p-24, 0x8102b3.0p-29, -0x1db29ee2d83717be918e1119642ab.0p-144L, + 0xfa0000.0p-24, 0xc24929.0p-29, 0x1191957d173697cf302cc9476f561.0p-143L, + 0xf80000.0p-24, 0x820aec.0p-28, 0x13ce8888e02e78eba9b1113bc1c18.0p-142L, + 0xf60000.0p-24, 0xa33577.0p-28, -0x17a4382ce6eb7bfa509bec8da5f22.0p-142L, + 0xf48000.0p-24, 0xbc42cb.0p-28, -0x172a21161a107674986dcdca6709c.0p-143L, + 0xf30000.0p-24, 0xd57797.0p-28, -0x1e09de07cb958897a3ea46e84abb3.0p-142L, + 0xf10000.0p-24, 0xf7518e.0p-28, 0x1ae1eec1b036c484993c549c4bf40.0p-151L, + 0xef0000.0p-24, 0x8cb9df.0p-27, -0x1d7355325d560d9e9ab3d6ebab580.0p-141L, + 0xed8000.0p-24, 0x999ec0.0p-27, -0x1f9f02d256d5037108f4ec21e48cd.0p-142L, + 0xec0000.0p-24, 0xa6988b.0p-27, -0x16fc0a9d12c17a70f7a684c596b12.0p-143L, + 0xea0000.0p-24, 0xb80698.0p-27, 0x15d581c1e8da99ded322fb08b8462.0p-141L, + 0xe80000.0p-24, 0xc99af3.0p-27, -0x1535b3ba8f150ae09996d7bb4653e.0p-143L, + 0xe70000.0p-24, 0xd273b2.0p-27, 0x163786f5251aefe0ded34c8318f52.0p-145L, + 0xe50000.0p-24, 0xe442c0.0p-27, 0x1bc4b2368e32d56699c1799a244d4.0p-144L, + 0xe38000.0p-24, 0xf1b83f.0p-27, 0x1c6090f684e6766abceccab1d7174.0p-141L, + 0xe20000.0p-24, 0xff448a.0p-27, -0x1890aa69ac9f4215f93936b709efb.0p-142L, + 0xe08000.0p-24, 0x8673f6.0p-26, 0x1b9985194b6affd511b534b72a28e.0p-140L, + 0xdf0000.0p-24, 0x8d515c.0p-26, -0x1dc08d61c6ef1d9b2ef7e68680598.0p-143L, + 0xdd8000.0p-24, 0x943a9e.0p-26, -0x1f72a2dac729b3f46662238a9425a.0p-142L, + 0xdc0000.0p-24, 0x9b2fe6.0p-26, -0x1fd4dfd3a0afb9691aed4d5e3df94.0p-140L, + 0xda8000.0p-24, 0xa2315d.0p-26, -0x11b26121629c46c186384993e1c93.0p-142L, + 0xd90000.0p-24, 0xa93f2f.0p-26, 0x1286d633e8e5697dc6a402a56fce1.0p-141L, + 0xd78000.0p-24, 0xb05988.0p-26, 0x16128eba9367707ebfa540e45350c.0p-144L, + 0xd60000.0p-24, 0xb78094.0p-26, 0x16ead577390d31ef0f4c9d43f79b2.0p-140L, + 0xd50000.0p-24, 0xbc4c6c.0p-26, 0x151131ccf7c7b75e7d900b521c48d.0p-141L, + 0xd38000.0p-24, 0xc3890a.0p-26, -0x115e2cd714bd06508aeb00d2ae3e9.0p-140L, + 0xd20000.0p-24, 0xcad2d7.0p-26, -0x1847f406ebd3af80485c2f409633c.0p-142L, + 0xd10000.0p-24, 0xcfb620.0p-26, 0x1c2259904d686581799fbce0b5f19.0p-141L, + 0xcf8000.0p-24, 0xd71653.0p-26, 0x1ece57a8d5ae54f550444ecf8b995.0p-140L, + 0xce0000.0p-24, 0xde843a.0p-26, -0x1f109d4bc4595412b5d2517aaac13.0p-141L, + 0xcd0000.0p-24, 0xe37fde.0p-26, 0x1bc03dc271a74d3a85b5b43c0e727.0p-141L, + 0xcb8000.0p-24, 0xeb050c.0p-26, -0x1bf2badc0df841a71b79dd5645b46.0p-145L, + 0xca0000.0p-24, 0xf29878.0p-26, -0x18efededd89fbe0bcfbe6d6db9f66.0p-147L, + 0xc90000.0p-24, 0xf7ad6f.0p-26, 0x1373ff977baa6911c7bafcb4d84fb.0p-141L, + 0xc80000.0p-24, 0xfcc8e3.0p-26, 0x196766f2fb328337cc050c6d83b22.0p-140L, + 0xc68000.0p-24, 0x823f30.0p-25, 0x19bd076f7c434e5fcf1a212e2a91e.0p-139L, + 0xc58000.0p-24, 0x84d52c.0p-25, -0x1a327257af0f465e5ecab5f2a6f81.0p-139L, + 0xc40000.0p-24, 0x88bc74.0p-25, 0x113f23def19c5a0fe396f40f1dda9.0p-141L, + 0xc30000.0p-24, 0x8b5ae6.0p-25, 0x1759f6e6b37de945a049a962e66c6.0p-139L, + 0xc20000.0p-24, 0x8dfccb.0p-25, 0x1ad35ca6ed5147bdb6ddcaf59c425.0p-141L, + 0xc10000.0p-24, 0x90a22b.0p-25, 0x1a1d71a87deba46bae9827221dc98.0p-139L, + 0xbf8000.0p-24, 0x94a0d8.0p-25, -0x139e5210c2b730e28aba001a9b5e0.0p-140L, + 0xbe8000.0p-24, 0x974f16.0p-25, -0x18f6ebcff3ed72e23e13431adc4a5.0p-141L, + 0xbd8000.0p-24, 0x9a00f1.0p-25, -0x1aa268be39aab7148e8d80caa10b7.0p-139L, + 0xbc8000.0p-24, 0x9cb672.0p-25, -0x14c8815839c5663663d15faed7771.0p-139L, + 0xbb0000.0p-24, 0xa0cda1.0p-25, 0x1eaf46390dbb2438273918db7df5c.0p-141L, + 0xba0000.0p-24, 0xa38c6e.0p-25, 0x138e20d831f698298adddd7f32686.0p-141L, + 0xb90000.0p-24, 0xa64f05.0p-25, -0x1e8d3c41123615b147a5d47bc208f.0p-142L, + 0xb80000.0p-24, 0xa91570.0p-25, 0x1ce28f5f3840b263acb4351104631.0p-140L, + 0xb70000.0p-24, 0xabdfbb.0p-25, -0x186e5c0a42423457e22d8c650b355.0p-139L, + 0xb60000.0p-24, 0xaeadef.0p-25, -0x14d41a0b2a08a465dc513b13f567d.0p-143L, + 0xb50000.0p-24, 0xb18018.0p-25, 0x16755892770633947ffe651e7352f.0p-139L, + 0xb40000.0p-24, 0xb45642.0p-25, -0x16395ebe59b15228bfe8798d10ff0.0p-142L, + 0xb30000.0p-24, 0xb73077.0p-25, 0x1abc65c8595f088b61a335f5b688c.0p-140L, + 0xb20000.0p-24, 0xba0ec4.0p-25, -0x1273089d3dad88e7d353e9967d548.0p-139L, + 0xb10000.0p-24, 0xbcf133.0p-25, 0x10f9f67b1f4bbf45de06ecebfaf6d.0p-139L, + 0xb00000.0p-24, 0xbfd7d2.0p-25, -0x109fab904864092b34edda19a831e.0p-140L, + 0xaf0000.0p-24, 0xc2c2ac.0p-25, -0x1124680aa43333221d8a9b475a6ba.0p-139L, + 0xae8000.0p-24, 0xc439b3.0p-25, -0x1f360cc4710fbfe24b633f4e8d84d.0p-140L, + 0xad8000.0p-24, 0xc72afd.0p-25, -0x132d91f21d89c89c45003fc5d7807.0p-140L, + 0xac8000.0p-24, 0xca20a2.0p-25, -0x16bf9b4d1f8da8002f2449e174504.0p-139L, + 0xab8000.0p-24, 0xcd1aae.0p-25, 0x19deb5ce6a6a8717d5626e16acc7d.0p-141L, + 0xaa8000.0p-24, 0xd0192f.0p-25, 0x1a29fb48f7d3ca87dabf351aa41f4.0p-139L, + 0xaa0000.0p-24, 0xd19a20.0p-25, 0x1127d3c6457f9d79f51dcc73014c9.0p-141L, + 0xa90000.0p-24, 0xd49f6a.0p-25, -0x1ba930e486a0ac42d1bf9199188e7.0p-141L, + 0xa80000.0p-24, 0xd7a94b.0p-25, -0x1b6e645f31549dd1160bcc45c7e2c.0p-139L, + 0xa70000.0p-24, 0xdab7d0.0p-25, 0x1118a425494b610665377f15625b6.0p-140L, + 0xa68000.0p-24, 0xdc40d5.0p-25, 0x1966f24d29d3a2d1b2176010478be.0p-140L, + 0xa58000.0p-24, 0xdf566d.0p-25, -0x1d8e52eb2248f0c95dd83626d7333.0p-142L, + 0xa48000.0p-24, 0xe270ce.0p-25, -0x1ee370f96e6b67ccb006a5b9890ea.0p-140L, + 0xa40000.0p-24, 0xe3ffce.0p-25, 0x1d155324911f56db28da4d629d00a.0p-140L, + 0xa30000.0p-24, 0xe72179.0p-25, -0x1fe6e2f2f867d8f4d60c713346641.0p-140L, + 0xa20000.0p-24, 0xea4812.0p-25, 0x1b7be9add7f4d3b3d406b6cbf3ce5.0p-140L, + 0xa18000.0p-24, 0xebdd3d.0p-25, 0x1b3cfb3f7511dd73692609040ccc2.0p-139L, + 0xa08000.0p-24, 0xef0b5b.0p-25, -0x1220de1f7301901b8ad85c25afd09.0p-139L, + 0xa00000.0p-24, 0xf0a451.0p-25, -0x176364c9ac81cc8a4dfb804de6867.0p-140L, + 0x9f0000.0p-24, 0xf3da16.0p-25, 0x1eed6b9aafac8d42f78d3e65d3727.0p-141L, + 0x9e8000.0p-24, 0xf576e9.0p-25, 0x1d593218675af269647b783d88999.0p-139L, + 0x9d8000.0p-24, 0xf8b47c.0p-25, -0x13e8eb7da053e063714615f7cc91d.0p-144L, + 0x9d0000.0p-24, 0xfa553f.0p-25, 0x1c063259bcade02951686d5373aec.0p-139L, + 0x9c0000.0p-24, 0xfd9ac5.0p-25, 0x1ef491085fa3c1649349630531502.0p-139L, + 0x9b8000.0p-24, 0xff3f8c.0p-25, 0x1d607a7c2b8c5320619fb9433d841.0p-139L, + 0x9a8000.0p-24, 0x814697.0p-24, -0x12ad3817004f3f0bdff99f932b273.0p-138L, + 0x9a0000.0p-24, 0x821b06.0p-24, -0x189fc53117f9e54e78103a2bc1767.0p-141L, + 0x990000.0p-24, 0x83c5f8.0p-24, 0x14cf15a048907b7d7f47ddb45c5a3.0p-139L, + 0x988000.0p-24, 0x849c7d.0p-24, 0x1cbb1d35fb82873b04a9af1dd692c.0p-138L, + 0x978000.0p-24, 0x864ba6.0p-24, 0x1128639b814f9b9770d8cb6573540.0p-138L, + 0x970000.0p-24, 0x87244c.0p-24, 0x184733853300f002e836dfd47bd41.0p-139L, + 0x968000.0p-24, 0x87fdaa.0p-24, 0x109d23aef77dd5cd7cc94306fb3ff.0p-140L, + 0x958000.0p-24, 0x89b293.0p-24, -0x1a81ef367a59de2b41eeebd550702.0p-138L, + 0x950000.0p-24, 0x8a8e20.0p-24, -0x121ad3dbb2f45275c917a30df4ac9.0p-138L, + 0x948000.0p-24, 0x8b6a6a.0p-24, -0x1cfb981628af71a89df4e6df2e93b.0p-139L, + 0x938000.0p-24, 0x8d253a.0p-24, -0x1d21730ea76cfdec367828734cae5.0p-139L, + 0x930000.0p-24, 0x8e03c2.0p-24, 0x135cc00e566f76b87333891e0dec4.0p-138L, + 0x928000.0p-24, 0x8ee30d.0p-24, -0x10fcb5df257a263e3bf446c6e3f69.0p-140L, + 0x918000.0p-24, 0x90a3ee.0p-24, -0x16e171b15433d723a4c7380a448d8.0p-139L, + 0x910000.0p-24, 0x918587.0p-24, -0x1d050da07f3236f330972da2a7a87.0p-139L, + 0x908000.0p-24, 0x9267e7.0p-24, 0x1be03669a5268d21148c6002becd3.0p-139L, + 0x8f8000.0p-24, 0x942f04.0p-24, 0x10b28e0e26c336af90e00533323ba.0p-139L, + 0x8f0000.0p-24, 0x9513c3.0p-24, 0x1a1d820da57cf2f105a89060046aa.0p-138L, + 0x8e8000.0p-24, 0x95f950.0p-24, -0x19ef8f13ae3cf162409d8ea99d4c0.0p-139L, + 0x8e0000.0p-24, 0x96dfab.0p-24, -0x109e417a6e507b9dc10dac743ad7a.0p-138L, + 0x8d0000.0p-24, 0x98aed2.0p-24, 0x10d01a2c5b0e97c4990b23d9ac1f5.0p-139L, + 0x8c8000.0p-24, 0x9997a2.0p-24, -0x1d6a50d4b61ea74540bdd2aa99a42.0p-138L, + 0x8c0000.0p-24, 0x9a8145.0p-24, 0x1b3b190b83f9527e6aba8f2d783c1.0p-138L, + 0x8b8000.0p-24, 0x9b6bbf.0p-24, 0x13a69fad7e7abe7ba81c664c107e0.0p-138L, + 0x8b0000.0p-24, 0x9c5711.0p-24, -0x11cd12316f576aad348ae79867223.0p-138L, + 0x8a8000.0p-24, 0x9d433b.0p-24, 0x1c95c444b807a246726b304ccae56.0p-139L, + 0x898000.0p-24, 0x9f1e22.0p-24, -0x1b9c224ea698c2f9b47466d6123fe.0p-139L, + 0x890000.0p-24, 0xa00ce1.0p-24, 0x125ca93186cf0f38b4619a2483399.0p-141L, + 0x888000.0p-24, 0xa0fc80.0p-24, -0x1ee38a7bc228b3597043be78eaf49.0p-139L, + 0x880000.0p-24, 0xa1ed00.0p-24, -0x1a0db876613d204147dc69a07a649.0p-138L, + 0x878000.0p-24, 0xa2de62.0p-24, 0x193224e8516c008d3602a7b41c6e8.0p-139L, + 0x870000.0p-24, 0xa3d0a9.0p-24, 0x1fa28b4d2541aca7d5844606b2421.0p-139L, + 0x868000.0p-24, 0xa4c3d6.0p-24, 0x1c1b5760fb4571acbcfb03f16daf4.0p-138L, + 0x858000.0p-24, 0xa6acea.0p-24, 0x1fed5d0f65949c0a345ad743ae1ae.0p-140L, + 0x850000.0p-24, 0xa7a2d4.0p-24, 0x1ad270c9d749362382a7688479e24.0p-140L, + 0x848000.0p-24, 0xa899ab.0p-24, 0x199ff15ce532661ea9643a3a2d378.0p-139L, + 0x840000.0p-24, 0xa99171.0p-24, 0x1a19e15ccc45d257530a682b80490.0p-139L, + 0x838000.0p-24, 0xaa8a28.0p-24, -0x121a14ec532b35ba3e1f868fd0b5e.0p-140L, + 0x830000.0p-24, 0xab83d1.0p-24, 0x1aee319980bff3303dd481779df69.0p-139L, + 0x828000.0p-24, 0xac7e6f.0p-24, -0x18ffd9e3900345a85d2d86161742e.0p-140L, + 0x820000.0p-24, 0xad7a03.0p-24, -0x1e4db102ce29f79b026b64b42caa1.0p-140L, + 0x818000.0p-24, 0xae768f.0p-24, 0x17c35c55a04a82ab19f77652d977a.0p-141L, + 0x810000.0p-24, 0xaf7415.0p-24, 0x1448324047019b48d7b98c1cf7234.0p-138L, + 0x808000.0p-24, 0xb07298.0p-24, -0x1750ee3915a197e9c7359dd94152f.0p-138L, + 0x800000.0p-24, 0xb17218.0p-24, -0x105c610ca86c3898cff81a12a17e2.0p-141L, +}; + +#ifdef USE_UTAB +static const struct { + float H; /* 1 + i/INTERVALS (exact) */ + float E; /* H(i) * G(i) - 1 (exact) */ +} U[TSIZE] = { + 0x800000.0p-23, 0, + 0x810000.0p-23, -0x800000.0p-37, + 0x820000.0p-23, -0x800000.0p-35, + 0x830000.0p-23, -0x900000.0p-34, + 0x840000.0p-23, -0x800000.0p-33, + 0x850000.0p-23, -0xc80000.0p-33, + 0x860000.0p-23, -0xa00000.0p-36, + 0x870000.0p-23, 0x940000.0p-33, + 0x880000.0p-23, 0x800000.0p-35, + 0x890000.0p-23, -0xc80000.0p-34, + 0x8a0000.0p-23, 0xe00000.0p-36, + 0x8b0000.0p-23, 0x900000.0p-33, + 0x8c0000.0p-23, -0x800000.0p-35, + 0x8d0000.0p-23, -0xe00000.0p-33, + 0x8e0000.0p-23, 0x880000.0p-33, + 0x8f0000.0p-23, -0xa80000.0p-34, + 0x900000.0p-23, -0x800000.0p-35, + 0x910000.0p-23, 0x800000.0p-37, + 0x920000.0p-23, 0x900000.0p-35, + 0x930000.0p-23, 0xd00000.0p-35, + 0x940000.0p-23, 0xe00000.0p-35, + 0x950000.0p-23, 0xc00000.0p-35, + 0x960000.0p-23, 0xe00000.0p-36, + 0x970000.0p-23, -0x800000.0p-38, + 0x980000.0p-23, -0xc00000.0p-35, + 0x990000.0p-23, -0xd00000.0p-34, + 0x9a0000.0p-23, 0x880000.0p-33, + 0x9b0000.0p-23, 0xe80000.0p-35, + 0x9c0000.0p-23, -0x800000.0p-35, + 0x9d0000.0p-23, 0xb40000.0p-33, + 0x9e0000.0p-23, 0x880000.0p-34, + 0x9f0000.0p-23, -0xe00000.0p-35, + 0xa00000.0p-23, 0x800000.0p-33, + 0xa10000.0p-23, -0x900000.0p-36, + 0xa20000.0p-23, -0xb00000.0p-33, + 0xa30000.0p-23, -0xa00000.0p-36, + 0xa40000.0p-23, 0x800000.0p-33, + 0xa50000.0p-23, -0xf80000.0p-35, + 0xa60000.0p-23, 0x880000.0p-34, + 0xa70000.0p-23, -0x900000.0p-33, + 0xa80000.0p-23, -0x800000.0p-35, + 0xa90000.0p-23, 0x900000.0p-34, + 0xaa0000.0p-23, 0xa80000.0p-33, + 0xab0000.0p-23, -0xac0000.0p-34, + 0xac0000.0p-23, -0x800000.0p-37, + 0xad0000.0p-23, 0xf80000.0p-35, + 0xae0000.0p-23, 0xf80000.0p-34, + 0xaf0000.0p-23, -0xac0000.0p-33, + 0xb00000.0p-23, -0x800000.0p-33, + 0xb10000.0p-23, -0xb80000.0p-34, + 0xb20000.0p-23, -0x800000.0p-34, + 0xb30000.0p-23, -0xb00000.0p-35, + 0xb40000.0p-23, -0x800000.0p-35, + 0xb50000.0p-23, -0xe00000.0p-36, + 0xb60000.0p-23, -0x800000.0p-35, + 0xb70000.0p-23, -0xb00000.0p-35, + 0xb80000.0p-23, -0x800000.0p-34, + 0xb90000.0p-23, -0xb80000.0p-34, + 0xba0000.0p-23, -0x800000.0p-33, + 0xbb0000.0p-23, -0xac0000.0p-33, + 0xbc0000.0p-23, 0x980000.0p-33, + 0xbd0000.0p-23, 0xbc0000.0p-34, + 0xbe0000.0p-23, 0xe00000.0p-36, + 0xbf0000.0p-23, -0xb80000.0p-35, + 0xc00000.0p-23, -0x800000.0p-33, + 0xc10000.0p-23, 0xa80000.0p-33, + 0xc20000.0p-23, 0x900000.0p-34, + 0xc30000.0p-23, -0x800000.0p-35, + 0xc40000.0p-23, -0x900000.0p-33, + 0xc50000.0p-23, 0x820000.0p-33, + 0xc60000.0p-23, 0x800000.0p-38, + 0xc70000.0p-23, -0x820000.0p-33, + 0xc80000.0p-23, 0x800000.0p-33, + 0xc90000.0p-23, -0xa00000.0p-36, + 0xca0000.0p-23, -0xb00000.0p-33, + 0xcb0000.0p-23, 0x840000.0p-34, + 0xcc0000.0p-23, -0xd00000.0p-34, + 0xcd0000.0p-23, 0x800000.0p-33, + 0xce0000.0p-23, -0xe00000.0p-35, + 0xcf0000.0p-23, 0xa60000.0p-33, + 0xd00000.0p-23, -0x800000.0p-35, + 0xd10000.0p-23, 0xb40000.0p-33, + 0xd20000.0p-23, -0x800000.0p-35, + 0xd30000.0p-23, 0xaa0000.0p-33, + 0xd40000.0p-23, -0xe00000.0p-35, + 0xd50000.0p-23, 0x880000.0p-33, + 0xd60000.0p-23, -0xd00000.0p-34, + 0xd70000.0p-23, 0x9c0000.0p-34, + 0xd80000.0p-23, -0xb00000.0p-33, + 0xd90000.0p-23, -0x800000.0p-38, + 0xda0000.0p-23, 0xa40000.0p-33, + 0xdb0000.0p-23, -0xdc0000.0p-34, + 0xdc0000.0p-23, 0xc00000.0p-35, + 0xdd0000.0p-23, 0xca0000.0p-33, + 0xde0000.0p-23, -0xb80000.0p-34, + 0xdf0000.0p-23, 0xd00000.0p-35, + 0xe00000.0p-23, 0xc00000.0p-33, + 0xe10000.0p-23, -0xf40000.0p-34, + 0xe20000.0p-23, 0x800000.0p-37, + 0xe30000.0p-23, 0x860000.0p-33, + 0xe40000.0p-23, -0xc80000.0p-33, + 0xe50000.0p-23, -0xa80000.0p-34, + 0xe60000.0p-23, 0xe00000.0p-36, + 0xe70000.0p-23, 0x880000.0p-33, + 0xe80000.0p-23, -0xe00000.0p-33, + 0xe90000.0p-23, -0xfc0000.0p-34, + 0xea0000.0p-23, -0x800000.0p-35, + 0xeb0000.0p-23, 0xe80000.0p-35, + 0xec0000.0p-23, 0x900000.0p-33, + 0xed0000.0p-23, 0xe20000.0p-33, + 0xee0000.0p-23, -0xac0000.0p-33, + 0xef0000.0p-23, -0xc80000.0p-34, + 0xf00000.0p-23, -0x800000.0p-35, + 0xf10000.0p-23, 0x800000.0p-35, + 0xf20000.0p-23, 0xb80000.0p-34, + 0xf30000.0p-23, 0x940000.0p-33, + 0xf40000.0p-23, 0xc80000.0p-33, + 0xf50000.0p-23, -0xf20000.0p-33, + 0xf60000.0p-23, -0xc80000.0p-33, + 0xf70000.0p-23, -0xa20000.0p-33, + 0xf80000.0p-23, -0x800000.0p-33, + 0xf90000.0p-23, -0xc40000.0p-34, + 0xfa0000.0p-23, -0x900000.0p-34, + 0xfb0000.0p-23, -0xc80000.0p-35, + 0xfc0000.0p-23, -0x800000.0p-35, + 0xfd0000.0p-23, -0x900000.0p-36, + 0xfe0000.0p-23, -0x800000.0p-37, + 0xff0000.0p-23, -0x800000.0p-39, + 0x800000.0p-22, 0, +}; +#endif /* USE_UTAB */ + +#ifdef STRUCT_RETURN +#define RETURN1(rp, v) do { \ + (rp)->hi = (v); \ + (rp)->lo_set = 0; \ + return; \ +} while (0) + +#define RETURN2(rp, h, l) do { \ + (rp)->hi = (h); \ + (rp)->lo = (l); \ + (rp)->lo_set = 1; \ + return; \ +} while (0) + +struct ld { + long double hi; + long double lo; + int lo_set; +}; +#else +#define RETURN1(rp, v) RETURNF(v) +#define RETURN2(rp, h, l) RETURNI((h) + (l)) +#endif + +#ifdef STRUCT_RETURN +static inline __always_inline void +k_logl(long double x, struct ld *rp) +#else +long double +logl(long double x) +#endif +{ + long double d, val_hi, val_lo; + double dd, dk; + uint64_t lx, llx; + int i, k; + uint16_t hx; + + EXTRACT_LDBL128_WORDS(hx, lx, llx, x); + k = -16383; +#if 0 /* Hard to do efficiently. Don't do it until we support all modes. */ + if (x == 1) + RETURN1(rp, 0); /* log(1) = +0 in all rounding modes */ +#endif + if (hx == 0 || hx >= 0x8000) { /* zero, negative or subnormal? */ + if (((hx & 0x7fff) | lx | llx) == 0) + RETURN1(rp, -1 / zero); /* log(+-0) = -Inf */ + if (hx != 0) + /* log(neg or NaN) = qNaN: */ + RETURN1(rp, (x - x) / zero); + x *= 0x1.0p113; /* subnormal; scale up x */ + EXTRACT_LDBL128_WORDS(hx, lx, llx, x); + k = -16383 - 113; + } else if (hx >= 0x7fff) + RETURN1(rp, x + x); /* log(Inf or NaN) = Inf or qNaN */ +#ifndef STRUCT_RETURN + ENTERI(); +#endif + k += hx; + dk = k; + + /* Scale x to be in [1, 2). */ + SET_LDBL_EXPSIGN(x, 0x3fff); + + /* 0 <= i <= INTERVALS: */ +#define L2I (49 - LOG2_INTERVALS) + i = (lx + (1LL << (L2I - 2))) >> (L2I - 1); + + /* + * -0.005280 < d < 0.004838. In particular, the infinite- + * precision |d| is <= 2**-7. Rounding of G(i) to 8 bits + * ensures that d is representable without extra precision for + * this bound on |d| (since when this calculation is expressed + * as x*G(i)-1, the multiplication needs as many extra bits as + * G(i) has and the subtraction cancels 8 bits). But for + * most i (107 cases out of 129), the infinite-precision |d| + * is <= 2**-8. G(i) is rounded to 9 bits for such i to give + * better accuracy (this works by improving the bound on |d|, + * which in turn allows rounding to 9 bits in more cases). + * This is only important when the original x is near 1 -- it + * lets us avoid using a special method to give the desired + * accuracy for such x. + */ + if (0) + d = x * G(i) - 1; + else { +#ifdef USE_UTAB + d = (x - H(i)) * G(i) + E(i); +#else + long double x_hi; + double x_lo; + + /* + * Split x into x_hi + x_lo to calculate x*G(i)-1 exactly. + * G(i) has at most 9 bits, so the splitting point is not + * critical. + */ + INSERT_LDBL128_WORDS(x_hi, 0x3fff, lx, + llx & 0xffffffffff000000ULL); + x_lo = x - x_hi; + d = x_hi * G(i) - 1 + x_lo * G(i); +#endif + } + + /* + * Our algorithm depends on exact cancellation of F_lo(i) and + * F_hi(i) with dk*ln_2_lo and dk*ln2_hi when k is -1 and i is + * at the end of the table. This and other technical complications + * make it difficult to avoid the double scaling in (dk*ln2) * + * log(base) for base != e without losing more accuracy and/or + * efficiency than is gained. + */ + /* + * Use double precision operations wherever possible, since long + * double operations are emulated and are very slow on the only + * known machines that support ld128 (sparc64). Also, don't try + * to improve parallelism by increasing the number of operations, + * since any parallelism on such machines is needed for the + * emulation. Horner's method is good for this, and is also good + * for accuracy. Horner's method doesn't handle the `lo' term + * well, either for efficiency or accuracy. However, for accuracy + * we evaluate d * d * P2 separately to take advantage of + * by P2 being exact, and this gives a good place to sum the 'lo' + * term too. + */ + dd = (double)d; + val_lo = d * d * d * (P3 + + d * (P4 + d * (P5 + d * (P6 + d * (P7 + d * (P8 + + dd * (P9 + dd * (P10 + dd * (P11 + dd * (P12 + dd * (P13 + + dd * P14))))))))))) + (F_lo(i) + dk * ln2_lo) + d * d * P2; + val_hi = d; +#ifdef DEBUG + if (fetestexcept(FE_UNDERFLOW)) + breakpoint(); +#endif + + _3sumF(val_hi, val_lo, F_hi(i) + dk * ln2_hi); + RETURN2(rp, val_hi, val_lo); +} + +long double +log1pl(long double x) +{ + long double d, d_hi, f_lo, val_hi, val_lo; + long double f_hi, twopminusk; + double d_lo, dd, dk; + uint64_t lx, llx; + int i, k; + int16_t ax, hx; + + DOPRINT_START(&x); + EXTRACT_LDBL128_WORDS(hx, lx, llx, x); + if (hx < 0x3fff) { /* x < 1, or x neg NaN */ + ax = hx & 0x7fff; + if (ax >= 0x3fff) { /* x <= -1, or x neg NaN */ + if (ax == 0x3fff && (lx | llx) == 0) + RETURNP(-1 / zero); /* log1p(-1) = -Inf */ + /* log1p(x < 1, or x NaN) = qNaN: */ + RETURNP((x - x) / (x - x)); + } + if (ax <= 0x3f8d) { /* |x| < 2**-113 */ + if ((int)x == 0) + RETURNP(x); /* x with inexact if x != 0 */ + } + f_hi = 1; + f_lo = x; + } else if (hx >= 0x7fff) { /* x +Inf or non-neg NaN */ + RETURNP(x + x); /* log1p(Inf or NaN) = Inf or qNaN */ + } else if (hx < 0x40e1) { /* 1 <= x < 2**226 */ + f_hi = x; + f_lo = 1; + } else { /* 2**226 <= x < +Inf */ + f_hi = x; + f_lo = 0; /* avoid underflow of the P3 term */ + } + ENTERI(); + x = f_hi + f_lo; + f_lo = (f_hi - x) + f_lo; + + EXTRACT_LDBL128_WORDS(hx, lx, llx, x); + k = -16383; + + k += hx; + dk = k; + + SET_LDBL_EXPSIGN(x, 0x3fff); + twopminusk = 1; + SET_LDBL_EXPSIGN(twopminusk, 0x7ffe - (hx & 0x7fff)); + f_lo *= twopminusk; + + i = (lx + (1LL << (L2I - 2))) >> (L2I - 1); + + /* + * x*G(i)-1 (with a reduced x) can be represented exactly, as + * above, but now we need to evaluate the polynomial on d = + * (x+f_lo)*G(i)-1 and extra precision is needed for that. + * Since x+x_lo is a hi+lo decomposition and subtracting 1 + * doesn't lose too many bits, an inexact calculation for + * f_lo*G(i) is good enough. + */ + if (0) + d_hi = x * G(i) - 1; + else { +#ifdef USE_UTAB + d_hi = (x - H(i)) * G(i) + E(i); +#else + long double x_hi; + double x_lo; + + INSERT_LDBL128_WORDS(x_hi, 0x3fff, lx, + llx & 0xffffffffff000000ULL); + x_lo = x - x_hi; + d_hi = x_hi * G(i) - 1 + x_lo * G(i); +#endif + } + d_lo = f_lo * G(i); + + /* + * This is _2sumF(d_hi, d_lo) inlined. The condition + * (d_hi == 0 || |d_hi| >= |d_lo|) for using _2sumF() is not + * always satisifed, so it is not clear that this works, but + * it works in practice. It works even if it gives a wrong + * normalized d_lo, since |d_lo| > |d_hi| implies that i is + * nonzero and d is tiny, so the F(i) term dominates d_lo. + * In float precision: + * (By exhaustive testing, the worst case is d_hi = 0x1.bp-25. + * And if d is only a little tinier than that, we would have + * another underflow problem for the P3 term; this is also ruled + * out by exhaustive testing.) + */ + d = d_hi + d_lo; + d_lo = d_hi - d + d_lo; + d_hi = d; + + dd = (double)d; + val_lo = d * d * d * (P3 + + d * (P4 + d * (P5 + d * (P6 + d * (P7 + d * (P8 + + dd * (P9 + dd * (P10 + dd * (P11 + dd * (P12 + dd * (P13 + + dd * P14))))))))))) + (F_lo(i) + dk * ln2_lo + d_lo) + d * d * P2; + val_hi = d_hi; +#ifdef DEBUG + if (fetestexcept(FE_UNDERFLOW)) + breakpoint(); +#endif + + _3sumF(val_hi, val_lo, F_hi(i) + dk * ln2_hi); + RETURN2PI(val_hi, val_lo); +} + +#ifdef STRUCT_RETURN + +long double +logl(long double x) +{ + struct ld r; + + ENTERI(); + DOPRINT_START(&x); + k_logl(x, &r); + RETURNSPI(&r); +} + +/* + * 29+113 bit decompositions. The bits are distributed so that the products + * of the hi terms are exact in double precision. The types are chosen so + * that the products of the hi terms are done in at least double precision, + * without any explicit conversions. More natural choices would require a + * slow long double precision multiplication. + */ +static const double +invln10_hi = 4.3429448176175356e-1, /* 0x1bcb7b15000000.0p-54 */ +invln2_hi = 1.4426950402557850e0; /* 0x17154765000000.0p-52 */ +static const long double +invln10_lo = 1.41498268538580090791605082294397000e-10L, /* 0x137287195355baaafad33dc323ee3.0p-145L */ +invln2_lo = 6.33178418956604368501892137426645911e-10L; /* 0x15c17f0bbbe87fed0691d3e88eb57.0p-143L */ + +long double +log10l(long double x) +{ + struct ld r; + long double lo; + float hi; + + ENTERI(); + DOPRINT_START(&x); + k_logl(x, &r); + if (!r.lo_set) + RETURNPI(r.hi); + _2sumF(r.hi, r.lo); + hi = r.hi; + lo = r.lo + (r.hi - hi); + RETURN2PI(invln10_hi * hi, + (invln10_lo + invln10_hi) * lo + invln10_lo * hi); +} + +long double +log2l(long double x) +{ + struct ld r; + long double lo; + float hi; + + ENTERI(); + DOPRINT_START(&x); + k_logl(x, &r); + if (!r.lo_set) + RETURNPI(r.hi); + _2sumF(r.hi, r.lo); + hi = r.hi; + lo = r.lo + (r.hi - hi); + RETURN2PI(invln2_hi * hi, + (invln2_lo + invln2_hi) * lo + invln2_lo * hi); +} + +#endif /* STRUCT_RETURN */ Added: head/lib/msun/ld80/s_logl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/ld80/s_logl.c Mon Jun 3 09:14:31 2013 (r251292) @@ -0,0 +1,717 @@ +/*- + * Copyright (c) 2007-2013 Bruce D. Evans + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/** + * Implementation of the natural logarithm of x for Intel 80-bit format. + * + * First decompose x into its base 2 representation: + * + * log(x) = log(X * 2**k), where X is in [1, 2) + * = log(X) + k * log(2). + * + * Let X = X_i + e, where X_i is the center of one of the intervals + * [-1.0/256, 1.0/256), [1.0/256, 3.0/256), .... [2.0-1.0/256, 2.0+1.0/256) + * and X is in this interval. Then + * + * log(X) = log(X_i + e) + * = log(X_i * (1 + e / X_i)) + * = log(X_i) + log(1 + e / X_i). + * + * The values log(X_i) are tabulated below. Let d = e / X_i and use + * + * log(1 + d) = p(d) + * + * where p(d) = d - 0.5*d*d + ... is a special minimax polynomial of + * suitably high degree. + * + * To get sufficiently small roundoff errors, k * log(2), log(X_i), and + * sometimes (if |k| is not large) the first term in p(d) must be evaluated + * and added up in extra precision. Extra precision is not needed for the + * rest of p(d). In the worst case when k = 0 and log(X_i) is 0, the final + * error is controlled mainly by the error in the second term in p(d). The + * error in this term itself is at most 0.5 ulps from the d*d operation in + * it. The error in this term relative to the first term is thus at most + * 0.5 * |-0.5| * |d| < 1.0/1024 ulps. We aim for an accumulated error of + * at most twice this at the point of the final rounding step. Thus the + * final error should be at most 0.5 + 1.0/512 = 0.5020 ulps. Exhaustive + * testing of a float variant of this function showed a maximum final error + * of 0.5008 ulps. Non-exhaustive testing of a double variant of this + * function showed a maximum final error of 0.5078 ulps (near 1+1.0/256). + * + * We made the maximum of |d| (and thus the total relative error and the + * degree of p(d)) small by using a large number of intervals. Using + * centers of intervals instead of endpoints reduces this maximum by a + * factor of 2 for a given number of intervals. p(d) is special only + * in beginning with the Taylor coefficients 0 + 1*d, which tends to happen + * naturally. The most accurate minimax polynomial of a given degree might + * be different, but then we wouldn't want it since we would have to do + * extra work to avoid roundoff error (especially for P0*d instead of d). + */ + +#ifdef DEBUG +#include +#include +#endif + +#ifdef __i386__ +#include +#endif + +#include "fpmath.h" +#include "math.h" +#define i386_SSE_GOOD +#ifndef NO_STRUCT_RETURN +#define STRUCT_RETURN +#endif +#include "math_private.h" + +#if !defined(NO_UTAB) && !defined(NO_UTABL) +#define USE_UTAB +#endif + +/* + * Domain [-0.005280, 0.004838], range ~[-5.1736e-22, 5.1738e-22]: + * |log(1 + d)/d - p(d)| < 2**-70.7 + */ +static const double +P2 = -0.5, +P3 = 3.3333333333333359e-1, /* 0x1555555555555a.0p-54 */ +P4 = -2.5000000000004424e-1, /* -0x1000000000031d.0p-54 */ +P5 = 1.9999999992970016e-1, /* 0x1999999972f3c7.0p-55 */ +P6 = -1.6666666072191585e-1, /* -0x15555548912c09.0p-55 */ +P7 = 1.4286227413310518e-1, /* 0x12494f9d9def91.0p-55 */ +P8 = -1.2518388626763144e-1; /* -0x1006068cc0b97c.0p-55 */ + +static volatile const double zero = 0; + +#define INTERVALS 128 +#define LOG2_INTERVALS 7 +#define TSIZE (INTERVALS + 1) +#define G(i) (T[(i)].G) +#define F_hi(i) (T[(i)].F_hi) +#define F_lo(i) (T[(i)].F_lo) +#define ln2_hi F_hi(TSIZE - 1) +#define ln2_lo F_lo(TSIZE - 1) +#define E(i) (U[(i)].E) +#define H(i) (U[(i)].H) + +static const struct { + float G; /* 1/(1 + i/128) rounded to 8/9 bits */ + float F_hi; /* log(1 / G_i) rounded (see below) */ + double F_lo; /* next 53 bits for log(1 / G_i) */ +} T[TSIZE] = { + /* + * ln2_hi and each F_hi(i) are rounded to a number of bits that + * makes F_hi(i) + dk*ln2_hi exact for all i and all dk. + * + * The last entry (for X just below 2) is used to define ln2_hi + * and ln2_lo, to ensure that F_hi(i) and F_lo(i) cancel exactly + * with dk*ln2_hi and dk*ln2_lo, respectively, when dk = -1. + * This is needed for accuracy when x is just below 1. (To avoid + * special cases, such x are "reduced" strangely to X just below + * 2 and dk = -1, and then the exact cancellation is needed + * because any the error from any non-exactness would be too + * large). + * + * We want to share this table between double precision and ld80, + * so the relevant range of dk is the larger one of ld80 + * ([-16445, 16383]) and the relevant exactness requirement is + * the stricter one of double precision. The maximum number of + * bits in F_hi(i) that works is very dependent on i but has + * a minimum of 33. We only need about 12 bits in F_hi(i) for + * it to provide enough extra precision in double precision (11 + * more than that are required for ld80). + * + * We round F_hi(i) to 24 bits so that it can have type float, + * mainly to minimize the size of the table. Using all 24 bits + * in a float for it automatically satisfies the above constraints. + */ + 0x800000.0p-23, 0, 0, + 0xfe0000.0p-24, 0x8080ac.0p-30, -0x14ee431dae6675.0p-84, + 0xfc0000.0p-24, 0x8102b3.0p-29, -0x1db29ee2d83718.0p-84, + 0xfa0000.0p-24, 0xc24929.0p-29, 0x1191957d173698.0p-83, + 0xf80000.0p-24, 0x820aec.0p-28, 0x13ce8888e02e79.0p-82, + 0xf60000.0p-24, 0xa33577.0p-28, -0x17a4382ce6eb7c.0p-82, + 0xf48000.0p-24, 0xbc42cb.0p-28, -0x172a21161a1076.0p-83, + 0xf30000.0p-24, 0xd57797.0p-28, -0x1e09de07cb9589.0p-82, + 0xf10000.0p-24, 0xf7518e.0p-28, 0x1ae1eec1b036c5.0p-91, + 0xef0000.0p-24, 0x8cb9df.0p-27, -0x1d7355325d560e.0p-81, + 0xed8000.0p-24, 0x999ec0.0p-27, -0x1f9f02d256d503.0p-82, + 0xec0000.0p-24, 0xa6988b.0p-27, -0x16fc0a9d12c17a.0p-83, + 0xea0000.0p-24, 0xb80698.0p-27, 0x15d581c1e8da9a.0p-81, + 0xe80000.0p-24, 0xc99af3.0p-27, -0x1535b3ba8f150b.0p-83, + 0xe70000.0p-24, 0xd273b2.0p-27, 0x163786f5251af0.0p-85, + 0xe50000.0p-24, 0xe442c0.0p-27, 0x1bc4b2368e32d5.0p-84, + 0xe38000.0p-24, 0xf1b83f.0p-27, 0x1c6090f684e676.0p-81, + 0xe20000.0p-24, 0xff448a.0p-27, -0x1890aa69ac9f42.0p-82, + 0xe08000.0p-24, 0x8673f6.0p-26, 0x1b9985194b6b00.0p-80, + 0xdf0000.0p-24, 0x8d515c.0p-26, -0x1dc08d61c6ef1e.0p-83, + 0xdd8000.0p-24, 0x943a9e.0p-26, -0x1f72a2dac729b4.0p-82, + 0xdc0000.0p-24, 0x9b2fe6.0p-26, -0x1fd4dfd3a0afb9.0p-80, + 0xda8000.0p-24, 0xa2315d.0p-26, -0x11b26121629c47.0p-82, + 0xd90000.0p-24, 0xa93f2f.0p-26, 0x1286d633e8e569.0p-81, + 0xd78000.0p-24, 0xb05988.0p-26, 0x16128eba936770.0p-84, + 0xd60000.0p-24, 0xb78094.0p-26, 0x16ead577390d32.0p-80, + 0xd50000.0p-24, 0xbc4c6c.0p-26, 0x151131ccf7c7b7.0p-81, + 0xd38000.0p-24, 0xc3890a.0p-26, -0x115e2cd714bd06.0p-80, + 0xd20000.0p-24, 0xcad2d7.0p-26, -0x1847f406ebd3b0.0p-82, + 0xd10000.0p-24, 0xcfb620.0p-26, 0x1c2259904d6866.0p-81, + 0xcf8000.0p-24, 0xd71653.0p-26, 0x1ece57a8d5ae55.0p-80, + 0xce0000.0p-24, 0xde843a.0p-26, -0x1f109d4bc45954.0p-81, + 0xcd0000.0p-24, 0xe37fde.0p-26, 0x1bc03dc271a74d.0p-81, + 0xcb8000.0p-24, 0xeb050c.0p-26, -0x1bf2badc0df842.0p-85, + 0xca0000.0p-24, 0xf29878.0p-26, -0x18efededd89fbe.0p-87, + 0xc90000.0p-24, 0xf7ad6f.0p-26, 0x1373ff977baa69.0p-81, + 0xc80000.0p-24, 0xfcc8e3.0p-26, 0x196766f2fb3283.0p-80, + 0xc68000.0p-24, 0x823f30.0p-25, 0x19bd076f7c434e.0p-79, + 0xc58000.0p-24, 0x84d52c.0p-25, -0x1a327257af0f46.0p-79, + 0xc40000.0p-24, 0x88bc74.0p-25, 0x113f23def19c5a.0p-81, + 0xc30000.0p-24, 0x8b5ae6.0p-25, 0x1759f6e6b37de9.0p-79, + 0xc20000.0p-24, 0x8dfccb.0p-25, 0x1ad35ca6ed5148.0p-81, + 0xc10000.0p-24, 0x90a22b.0p-25, 0x1a1d71a87deba4.0p-79, + 0xbf8000.0p-24, 0x94a0d8.0p-25, -0x139e5210c2b731.0p-80, + 0xbe8000.0p-24, 0x974f16.0p-25, -0x18f6ebcff3ed73.0p-81, + 0xbd8000.0p-24, 0x9a00f1.0p-25, -0x1aa268be39aab7.0p-79, + 0xbc8000.0p-24, 0x9cb672.0p-25, -0x14c8815839c566.0p-79, + 0xbb0000.0p-24, 0xa0cda1.0p-25, 0x1eaf46390dbb24.0p-81, + 0xba0000.0p-24, 0xa38c6e.0p-25, 0x138e20d831f698.0p-81, + 0xb90000.0p-24, 0xa64f05.0p-25, -0x1e8d3c41123616.0p-82, + 0xb80000.0p-24, 0xa91570.0p-25, 0x1ce28f5f3840b2.0p-80, + 0xb70000.0p-24, 0xabdfbb.0p-25, -0x186e5c0a424234.0p-79, + 0xb60000.0p-24, 0xaeadef.0p-25, -0x14d41a0b2a08a4.0p-83, + 0xb50000.0p-24, 0xb18018.0p-25, 0x16755892770634.0p-79, + 0xb40000.0p-24, 0xb45642.0p-25, -0x16395ebe59b152.0p-82, + 0xb30000.0p-24, 0xb73077.0p-25, 0x1abc65c8595f09.0p-80, + 0xb20000.0p-24, 0xba0ec4.0p-25, -0x1273089d3dad89.0p-79, + 0xb10000.0p-24, 0xbcf133.0p-25, 0x10f9f67b1f4bbf.0p-79, + 0xb00000.0p-24, 0xbfd7d2.0p-25, -0x109fab90486409.0p-80, + 0xaf0000.0p-24, 0xc2c2ac.0p-25, -0x1124680aa43333.0p-79, + 0xae8000.0p-24, 0xc439b3.0p-25, -0x1f360cc4710fc0.0p-80, + 0xad8000.0p-24, 0xc72afd.0p-25, -0x132d91f21d89c9.0p-80, + 0xac8000.0p-24, 0xca20a2.0p-25, -0x16bf9b4d1f8da8.0p-79, + 0xab8000.0p-24, 0xcd1aae.0p-25, 0x19deb5ce6a6a87.0p-81, + 0xaa8000.0p-24, 0xd0192f.0p-25, 0x1a29fb48f7d3cb.0p-79, + 0xaa0000.0p-24, 0xd19a20.0p-25, 0x1127d3c6457f9d.0p-81, + 0xa90000.0p-24, 0xd49f6a.0p-25, -0x1ba930e486a0ac.0p-81, + 0xa80000.0p-24, 0xd7a94b.0p-25, -0x1b6e645f31549e.0p-79, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 09:15:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2F04FA15; Mon, 3 Jun 2013 09:15:16 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 202001F6E; Mon, 3 Jun 2013 09:15:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r539FGlF009557; Mon, 3 Jun 2013 09:15:16 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r539FFAY009555; Mon, 3 Jun 2013 09:15:15 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201306030915.r539FFAY009555@svn.freebsd.org> From: David Schultz Date: Mon, 3 Jun 2013 09:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251293 - head/tools/regression/lib/msun X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 09:15:16 -0000 Author: das Date: Mon Jun 3 09:15:15 2013 New Revision: 251293 URL: http://svnweb.freebsd.org/changeset/base/251293 Log: Add more tests for log functions. A few are commented out because the long double versions don't pass yet. (They are rather nit-picky cases, so there's ongoing discussion with Bruce about whether it is worth the performance cost.) Modified: head/tools/regression/lib/msun/test-logarithm.c Modified: head/tools/regression/lib/msun/test-logarithm.c ============================================================================== --- head/tools/regression/lib/msun/test-logarithm.c Mon Jun 3 09:14:31 2013 (r251292) +++ head/tools/regression/lib/msun/test-logarithm.c Mon Jun 3 09:15:15 2013 (r251293) @@ -65,20 +65,37 @@ __FBSDID("$FreeBSD$"); assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \ } while (0) +#define test(func, x, result, exceptmask, excepts) do { \ + volatile long double _d = x; \ + assert(feclearexcept(FE_ALL_EXCEPT) == 0); \ + assert(fpequal((func)(_d), (result))); \ + assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \ +} while (0) + +#define test_tol(func, z, result, tol) do { \ + volatile long double _d = z; \ + debug(" testing %6s(%15La) ~= % .36Le\n", #func, _d, result); \ + assert(fpequal_tol((func)(_d), (result), (tol), CS_BOTH)); \ +} while (0) + /* Test all the functions that compute log(x). */ #define testall0(x, result, exceptmask, excepts) do { \ test(log, x, result, exceptmask, excepts); \ test(logf, x, result, exceptmask, excepts); \ + test(logl, x, result, exceptmask, excepts); \ test(log2, x, result, exceptmask, excepts); \ test(log2f, x, result, exceptmask, excepts); \ + test(log2l, x, result, exceptmask, excepts); \ test(log10, x, result, exceptmask, excepts); \ test(log10f, x, result, exceptmask, excepts); \ + test(log10l, x, result, exceptmask, excepts); \ } while (0) /* Test all the functions that compute log(1+x). */ #define testall1(x, result, exceptmask, excepts) do { \ test(log1p, x, result, exceptmask, excepts); \ test(log1pf, x, result, exceptmask, excepts); \ + test(log1pl, x, result, exceptmask, excepts); \ } while (0) void @@ -128,6 +145,13 @@ run_log2_tests(void) assert(log2(ldexp(1.0, i)) == i); assert(fetestexcept(ALL_STD_EXCEPT) == 0); } + for (i = LDBL_MIN_EXP - LDBL_MANT_DIG; i < LDBL_MAX_EXP; i++) { + assert(log2l(ldexpl(1.0, i)) == i); +#if 0 + /* XXX This test does not pass yet. */ + assert(fetestexcept(ALL_STD_EXCEPT) == 0); +#endif + } } void @@ -139,7 +163,17 @@ run_roundingmode_tests(void) */ fesetround(FE_DOWNWARD); /* These are still positive per IEEE 754R */ +#if 0 testall0(1.0, 0.0, ALL_STD_EXCEPT, 0); +#else + /* logl, log2l, and log10l don't pass yet. */ + test(log, 1.0, 0.0, ALL_STD_EXCEPT, 0); + test(logf, 1.0, 0.0, ALL_STD_EXCEPT, 0); + test(log2, 1.0, 0.0, ALL_STD_EXCEPT, 0); + test(log2f, 1.0, 0.0, ALL_STD_EXCEPT, 0); + test(log10, 1.0, 0.0, ALL_STD_EXCEPT, 0); + test(log10f, 1.0, 0.0, ALL_STD_EXCEPT, 0); +#endif testall1(0.0, 0.0, ALL_STD_EXCEPT, 0); fesetround(FE_TOWARDZERO); testall0(1.0, 0.0, ALL_STD_EXCEPT, 0); @@ -154,11 +188,84 @@ run_roundingmode_tests(void) fesetround(FE_TONEAREST); } +void +run_accuracy_tests(void) +{ + static const struct { + float x; + long double log2x; + long double logex; + long double log10x; + } tests[] = { + { 0x1p-120 + 0x1p-140, + -1.19999998624139449158861798943319717e2L, + -8.31776607135195754708796206665656732e1L, + -3.61235990655024477716980559136055915e1L, + }, + { 1.0 - 0x1p-20, + -1.37586186296463416424364914705656460e-6L, + -9.53674771153890007250243736279163253e-7L, + -4.14175690642480911859354110516159131e-7L, }, + { 1.0 + 0x1p-20, + 1.37586055084113820105668028340371476e-6L, + 9.53673861659188233908415514963336144e-7L, + 4.14175295653950611453333571759200697e-7L }, + { 19.75, + 4.30378074817710292442728634194115348e0L, + 2.98315349134713087533848129856505779e0L, + 1.29556709996247903756734359702926363e0L }, + { 19.75 * 0x1p100, + 1.043037807481771029244272863419411534e2L, + 7.229787154734166181706169344438271459e1L, + 3.139856666636059855894123306947856631e1L }, + }; + int i; + + for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { + test_tol(log2, tests[i].x, tests[i].log2x, DBL_ULP()); + test_tol(log2f, tests[i].x, tests[i].log2x, FLT_ULP()); + test_tol(log2l, tests[i].x, tests[i].log2x, LDBL_ULP()); + test_tol(log, tests[i].x, tests[i].logex, DBL_ULP()); + test_tol(logf, tests[i].x, tests[i].logex, FLT_ULP()); + test_tol(logl, tests[i].x, tests[i].logex, LDBL_ULP()); + test_tol(log10, tests[i].x, tests[i].log10x, DBL_ULP()); + test_tol(log10f, tests[i].x, tests[i].log10x, FLT_ULP()); + test_tol(log10l, tests[i].x, tests[i].log10x, LDBL_ULP()); + if (tests[i].x >= 0.5) { + test_tol(log1p, tests[i].x - 1, tests[i].logex, + DBL_ULP()); + test_tol(log1pf, tests[i].x - 1, tests[i].logex, + FLT_ULP()); + test_tol(log1pl, tests[i].x - 1, tests[i].logex, + LDBL_ULP()); + } + } +} + +void +run_log1p_accuracy_tests(void) +{ + + test_tol(log1pf, 0x0.333333p0F, + 1.82321546859847114303367992804596800640e-1L, FLT_ULP()); + test_tol(log1p, 0x0.3333333333333p0, + 1.82321556793954589204283870982629267635e-1L, DBL_ULP()); + test_tol(log1pl, 0x0.33333333333333332p0L, + 1.82321556793954626202683007050468762914e-1L, LDBL_ULP()); + + test_tol(log1pf, -0x0.333333p0F, + -2.23143536413048672940940199918017467652e-1L, FLT_ULP()); + test_tol(log1p, -0x0.3333333333333p0, + -2.23143551314209700255143859052009022937e-1L, DBL_ULP()); + test_tol(log1pl, -0x0.33333333333333332p0L, + -2.23143551314209755752742563153765697950e-1L, LDBL_ULP()); +} + int main(int argc, char *argv[]) { - printf("1..3\n"); + printf("1..5\n"); run_generic_tests(); printf("ok 1 - logarithm\n"); @@ -169,5 +276,11 @@ main(int argc, char *argv[]) run_roundingmode_tests(); printf("ok 3 - logarithm\n"); + run_accuracy_tests(); + printf("ok 4 - logarithm\n"); + + run_log1p_accuracy_tests(); + printf("ok 5 - logarithm\n"); + return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 09:24:31 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B3907D0D; Mon, 3 Jun 2013 09:24:31 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id A353D1FBD; Mon, 3 Jun 2013 09:24:31 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 347161A3C1A; Mon, 3 Jun 2013 02:24:30 -0700 (PDT) Message-ID: <51AC60CA.6050105@mu.org> Date: Mon, 03 Jun 2013 02:24:26 -0700 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Konstantin Belousov Subject: Re: svn commit: r251282 - head/sys/kern References: <201306030416.r534GmCA001872@svn.freebsd.org> <51AC1B49.9090001@mu.org> <20130603075539.GK3047@kib.kiev.ua> In-Reply-To: <20130603075539.GK3047@kib.kiev.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 09:24:31 -0000 On 6/3/13 12:55 AM, Konstantin Belousov wrote: > On Sun, Jun 02, 2013 at 09:27:53PM -0700, Alfred Perlstein wrote: >> Hey Konstaintin, shouldn't this be scaled against the actual amount of >> KVA we have instead of an arbitrary limit? > The commit changes the buffer cache to scale according to the available > KVA, making the scaling less dumb. > > I do not understand what exactly do you want to do, please describe the > algorithm you propose to implement instead of my change. Sure, how about deriving the hardcoded "32" from the maxkva a machine can have? Is that possible? -Alfred > >> -Alfred >> >> On 6/2/13 9:16 PM, Konstantin Belousov wrote: >>> Author: kib >>> Date: Mon Jun 3 04:16:48 2013 >>> New Revision: 251282 >>> URL: http://svnweb.freebsd.org/changeset/base/251282 >>> >>> Log: >>> When auto-sizing the buffer cache, limit the amount of physical memory >>> used as the estimation of size, to 32GB. This provides around 100K of >>> buffer headers and corresponding KVA for buffer map at the peak. >>> Sizing the cache larger is not useful, also resulting in the wasting >>> and exhausting of KVA for large machines. >>> >>> Reported and tested by: bdrewery >>> Sponsored by: The FreeBSD Foundation >>> >>> Modified: >>> head/sys/kern/vfs_bio.c >>> >>> Modified: head/sys/kern/vfs_bio.c >>> ============================================================================== >>> --- head/sys/kern/vfs_bio.c Mon Jun 3 04:11:42 2013 (r251281) >>> +++ head/sys/kern/vfs_bio.c Mon Jun 3 04:16:48 2013 (r251282) >>> @@ -560,7 +560,8 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon >>> nbuf += min((physmem_est - 4096) / factor, >>> 65536 / factor); >>> if (physmem_est > 65536) >>> - nbuf += (physmem_est - 65536) * 2 / (factor * 5); >>> + nbuf += min((physmem_est - 65536) * 2 / (factor * 5), >>> + 32 * 1024 * 1024 / (factor * 5)); >>> >>> if (maxbcache && nbuf > maxbcache / BKVASIZE) >>> nbuf = maxbcache / BKVASIZE; >>> From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 09:33:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 098F0FED; Mon, 3 Jun 2013 09:33:52 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F01211001; Mon, 3 Jun 2013 09:33:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r539XprM016509; Mon, 3 Jun 2013 09:33:51 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r539Xpqi016508; Mon, 3 Jun 2013 09:33:51 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201306030933.r539Xpqi016508@svn.freebsd.org> From: David Schultz Date: Mon, 3 Jun 2013 09:33:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251294 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 09:33:52 -0000 Author: das Date: Mon Jun 3 09:33:51 2013 New Revision: 251294 URL: http://svnweb.freebsd.org/changeset/base/251294 Log: Bump __FreeBSD_version for the addition of the following functions to libm: cacos, cacosf, cacosh, cacoshf, casin, casinf, casinh, casinhf, catan, catanf, catanh, catanhf, logl, log2l, log10l, log1pl I am hoping kargl@ will commit expl and expm1l soon, in which case this bump will cover those, too. Requested by: danfe Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Jun 3 09:15:15 2013 (r251293) +++ head/sys/sys/param.h Mon Jun 3 09:33:51 2013 (r251294) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000033 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000034 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 09:38:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2867F22D; Mon, 3 Jun 2013 09:38:11 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from zim.MIT.EDU (50-196-151-174-static.hfc.comcastbusiness.net [50.196.151.174]) by mx1.freebsd.org (Postfix) with ESMTP id 02BCD1020; Mon, 3 Jun 2013 09:38:10 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.7/8.14.2) with ESMTP id r539cA4G030207; Mon, 3 Jun 2013 02:38:10 -0700 (PDT) (envelope-from das@FreeBSD.org) Received: (from das@localhost) by zim.MIT.EDU (8.14.7/8.14.2/Submit) id r539c9mx030206; Mon, 3 Jun 2013 02:38:09 -0700 (PDT) (envelope-from das@FreeBSD.org) Date: Mon, 3 Jun 2013 02:38:09 -0700 From: David Schultz To: Alexey Dokuchaev Subject: Re: svn commit: r251121 - in head: include lib/msun lib/msun/man lib/msun/src Message-ID: <20130603093809.GA30173@zim.MIT.EDU> References: <201305300449.r4U4nRqM012625@svn.freebsd.org> <20130531033012.GB42068@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130531033012.GB42068@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 09:38:11 -0000 On Fri, May 31, 2013, Alexey Dokuchaev wrote: > On Thu, May 30, 2013 at 04:49:27AM +0000, David Schultz wrote: > > New Revision: 251121 > > URL: http://svnweb.freebsd.org/changeset/base/251121 > > > > Log: > > I'm happy to finally commit stephen@'s implementations of cacos, > > cacosh, casin, casinh, catan, and catanh. Thanks to stephen@ and bde@ > > for working on these. > > This is awesome, but I did not see __FreeBSD_version bumped. Many ports > rely on math functions, and having coherent OSVERSIONs really helps to > decide when some function is natively supported, or emulation code required. Done. Sorry for the delay: I wanted to add a few more functions first! I usually update the Porter's Handbook too, but I'm out of time right now, so I would appreciate it if someone could do it. The needed information should be in the commit message. From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 12:43:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D7F8C872; Mon, 3 Jun 2013 12:43:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CA53C1AF1; Mon, 3 Jun 2013 12:43:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53Ch9G3085576; Mon, 3 Jun 2013 12:43:09 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53Ch9JZ085575; Mon, 3 Jun 2013 12:43:09 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201306031243.r53Ch9JZ085575@svn.freebsd.org> From: Ed Maste Date: Mon, 3 Jun 2013 12:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251295 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 12:43:09 -0000 Author: emaste Date: Mon Jun 3 12:43:09 2013 New Revision: 251295 URL: http://svnweb.freebsd.org/changeset/base/251295 Log: Switch to 2-clause license Approved by: bms@ Modified: head/lib/libc/net/getifmaddrs.c Modified: head/lib/libc/net/getifmaddrs.c ============================================================================== --- head/lib/libc/net/getifmaddrs.c Mon Jun 3 09:33:51 2013 (r251294) +++ head/lib/libc/net/getifmaddrs.c Mon Jun 3 12:43:09 2013 (r251295) @@ -10,12 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Bruce M. Simpson. - * 4. Neither the name of Bruce M. Simpson nor the names of other - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 12:55:15 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 42F83CA4; Mon, 3 Jun 2013 12:55:15 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 260701B6C; Mon, 3 Jun 2013 12:55:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53CtF8c089633; Mon, 3 Jun 2013 12:55:15 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53CtDYw089624; Mon, 3 Jun 2013 12:55:13 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201306031255.r53CtDYw089624@svn.freebsd.org> From: Andre Oppermann Date: Mon, 3 Jun 2013 12:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251296 - in head/sys: net netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 12:55:15 -0000 Author: andre Date: Mon Jun 3 12:55:13 2013 New Revision: 251296 URL: http://svnweb.freebsd.org/changeset/base/251296 Log: Allow drivers to specify a maximum TSO length in bytes if they are limited in the amount of data they can handle at once. Drivers can set ifp->if_hw_tsomax before calling ether_ifattach() to change the limit. The lowest allowable size is IP_MAXPACKET / 8 (8192 bytes) as anything less wouldn't be very useful anymore. The upper limit is still at IP_MAXPACKET (65536 bytes). Raising it requires further auditing of the IPv4/v6 code path's as the length field in the IP header would overflow leading to confusion in firewalls and others packet handler on the real size of the packet. The placement into "struct ifnet" is a bit hackish but the best place that was found. When the stack/driver boundary is updated it should be handled in a better way. Submitted by: cperciva (earlier version) Reviewed by: cperciva Tested by: cperciva MFC after: 1 week (using spare struct members to preserve ABI) Modified: head/sys/net/if.c head/sys/net/if_var.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Jun 3 12:43:09 2013 (r251295) +++ head/sys/net/if.c Mon Jun 3 12:55:13 2013 (r251296) @@ -74,18 +74,18 @@ #include #if defined(INET) || defined(INET6) -/*XXX*/ #include #include +#include #include +#ifdef INET +#include +#endif /* INET */ #ifdef INET6 #include #include -#endif -#endif -#ifdef INET -#include -#endif +#endif /* INET6 */ +#endif /* INET || INET6 */ #include @@ -653,6 +653,13 @@ if_attach_internal(struct ifnet *ifp, in TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); /* Reliably crash if used uninitialized. */ ifp->if_broadcastaddr = NULL; + + /* Initialize to max value. */ + if (ifp->if_hw_tsomax == 0) + ifp->if_hw_tsomax = IP_MAXPACKET; + KASSERT(ifp->if_hw_tsomax <= IP_MAXPACKET && + ifp->if_hw_tsomax >= IP_MAXPACKET / 8, + ("%s: tsomax outside of range", __func__)); } #ifdef VIMAGE else { Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Mon Jun 3 12:43:09 2013 (r251295) +++ head/sys/net/if_var.h Mon Jun 3 12:55:13 2013 (r251296) @@ -204,6 +204,11 @@ struct ifnet { u_int if_fib; /* interface FIB */ u_char if_alloctype; /* if_type at time of allocation */ + u_int if_hw_tsomax; /* tso burst length limit, the minmum + * is (IP_MAXPACKET / 8). + * XXXAO: Have to find a better place + * for it eventually. */ + /* * Spare fields are added so that we can modify sensitive data * structures without changing the kernel binary interface, and must Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Mon Jun 3 12:43:09 2013 (r251295) +++ head/sys/netinet/tcp_input.c Mon Jun 3 12:55:13 2013 (r251296) @@ -3434,7 +3434,7 @@ tcp_xmit_timer(struct tcpcb *tp, int rtt */ void tcp_mss_update(struct tcpcb *tp, int offer, int mtuoffer, - struct hc_metrics_lite *metricptr, int *mtuflags) + struct hc_metrics_lite *metricptr, struct tcp_ifcap *cap) { int mss = 0; u_long maxmtu = 0; @@ -3461,7 +3461,7 @@ tcp_mss_update(struct tcpcb *tp, int off /* Initialize. */ #ifdef INET6 if (isipv6) { - maxmtu = tcp_maxmtu6(&inp->inp_inc, mtuflags); + maxmtu = tcp_maxmtu6(&inp->inp_inc, cap); tp->t_maxopd = tp->t_maxseg = V_tcp_v6mssdflt; } #endif @@ -3470,7 +3470,7 @@ tcp_mss_update(struct tcpcb *tp, int off #endif #ifdef INET { - maxmtu = tcp_maxmtu(&inp->inp_inc, mtuflags); + maxmtu = tcp_maxmtu(&inp->inp_inc, cap); tp->t_maxopd = tp->t_maxseg = V_tcp_mssdflt; } #endif @@ -3605,11 +3605,12 @@ tcp_mss(struct tcpcb *tp, int offer) struct inpcb *inp; struct socket *so; struct hc_metrics_lite metrics; - int mtuflags = 0; + struct tcp_ifcap cap; KASSERT(tp != NULL, ("%s: tp == NULL", __func__)); - - tcp_mss_update(tp, offer, -1, &metrics, &mtuflags); + + bzero(&cap, sizeof(cap)); + tcp_mss_update(tp, offer, -1, &metrics, &cap); mss = tp->t_maxseg; inp = tp->t_inpcb; @@ -3654,8 +3655,10 @@ tcp_mss(struct tcpcb *tp, int offer) SOCKBUF_UNLOCK(&so->so_rcv); /* Check the interface for TSO capabilities. */ - if (mtuflags & CSUM_TSO) + if (cap.ifcap & CSUM_TSO) { tp->t_flags |= TF_TSO; + tp->t_tsomax = cap.tsomax; + } } /* Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Mon Jun 3 12:43:09 2013 (r251295) +++ head/sys/netinet/tcp_output.c Mon Jun 3 12:55:13 2013 (r251296) @@ -769,12 +769,13 @@ send: ("%s: TSO can't do IP options", __func__)); /* - * Limit a burst to IP_MAXPACKET minus IP, + * Limit a burst to t_tsomax minus IP, * TCP and options length to keep ip->ip_len - * from overflowing. + * from overflowing or exceeding the maximum + * length allowed by the network interface. */ - if (len > IP_MAXPACKET - hdrlen) { - len = IP_MAXPACKET - hdrlen; + if (len > tp->t_tsomax - hdrlen) { + len = tp->t_tsomax - hdrlen; sendalot = 1; } Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Mon Jun 3 12:43:09 2013 (r251295) +++ head/sys/netinet/tcp_subr.c Mon Jun 3 12:55:13 2013 (r251296) @@ -1770,7 +1770,7 @@ tcp_mtudisc(struct inpcb *inp, int mtuof * tcp_mss_update to get the peer/interface MTU. */ u_long -tcp_maxmtu(struct in_conninfo *inc, int *flags) +tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap *cap) { struct route sro; struct sockaddr_in *dst; @@ -1795,10 +1795,11 @@ tcp_maxmtu(struct in_conninfo *inc, int maxmtu = min(sro.ro_rt->rt_rmx.rmx_mtu, ifp->if_mtu); /* Report additional interface capabilities. */ - if (flags != NULL) { + if (cap != NULL) { if (ifp->if_capenable & IFCAP_TSO4 && ifp->if_hwassist & CSUM_TSO) - *flags |= CSUM_TSO; + cap->ifcap |= CSUM_TSO; + cap->tsomax = ifp->if_hw_tsomax; } RTFREE(sro.ro_rt); } @@ -1808,7 +1809,7 @@ tcp_maxmtu(struct in_conninfo *inc, int #ifdef INET6 u_long -tcp_maxmtu6(struct in_conninfo *inc, int *flags) +tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap *cap) { struct route_in6 sro6; struct ifnet *ifp; @@ -1832,10 +1833,11 @@ tcp_maxmtu6(struct in_conninfo *inc, int IN6_LINKMTU(sro6.ro_rt->rt_ifp)); /* Report additional interface capabilities. */ - if (flags != NULL) { + if (cap != NULL) { if (ifp->if_capenable & IFCAP_TSO6 && ifp->if_hwassist & CSUM_TSO) - *flags |= CSUM_TSO; + cap->ifcap |= CSUM_TSO; + cap->tsomax = ifp->if_hw_tsomax; } RTFREE(sro6.ro_rt); } Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Mon Jun 3 12:43:09 2013 (r251295) +++ head/sys/netinet/tcp_var.h Mon Jun 3 12:55:13 2013 (r251296) @@ -208,6 +208,8 @@ struct tcpcb { u_int t_keepintvl; /* interval between keepalives */ u_int t_keepcnt; /* number of keepalives before close */ + u_int t_tsomax; /* tso burst length limit */ + uint32_t t_ispare[8]; /* 5 UTO, 3 TBD */ void *t_pspare2[4]; /* 4 TBD */ uint64_t _pad[6]; /* 6 TBD (1-2 CC/RTT?) */ @@ -324,6 +326,15 @@ struct hc_metrics_lite { /* must stay in u_long rmx_recvpipe; /* inbound delay-bandwidth product */ }; +/* + * Used by tcp_maxmtu() to communicate interface specific features + * and limits at the time of connection setup. + */ +struct tcp_ifcap { + int ifcap; + u_int tsomax; +}; + #ifndef _NETINET_IN_PCB_H_ struct in_conninfo; #endif /* _NETINET_IN_PCB_H_ */ @@ -782,10 +793,10 @@ void tcp_reass_flush(struct tcpcb *); void tcp_reass_destroy(void); #endif void tcp_input(struct mbuf *, int); -u_long tcp_maxmtu(struct in_conninfo *, int *); -u_long tcp_maxmtu6(struct in_conninfo *, int *); +u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); +u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); void tcp_mss_update(struct tcpcb *, int, int, struct hc_metrics_lite *, - int *); + struct tcp_ifcap *); void tcp_mss(struct tcpcb *, int); int tcp_mssopt(struct in_conninfo *); struct inpcb * From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 13:00:33 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9B10CE87; Mon, 3 Jun 2013 13:00:33 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8E25B1BBC; Mon, 3 Jun 2013 13:00:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53D0XNW092179; Mon, 3 Jun 2013 13:00:33 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53D0XUx092178; Mon, 3 Jun 2013 13:00:33 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201306031300.r53D0XUx092178@svn.freebsd.org> From: Andre Oppermann Date: Mon, 3 Jun 2013 13:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251297 - head/sys/dev/xen/netfront X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 13:00:33 -0000 Author: andre Date: Mon Jun 3 13:00:33 2013 New Revision: 251297 URL: http://svnweb.freebsd.org/changeset/base/251297 Log: Specify a maximum TSO length limiting the segment chain to what the Xen host side can handle after defragmentation. This prevents the driver from throwing away too long TSO chains and improves the performance on Amazon AWS instances with 10GigE virtual interfaces to the normally expected throughput. Submitted by: cperciva (earlier version) Reviewed by: cperciva Tested by: cperciva MFC after: 1 week Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Mon Jun 3 12:55:13 2013 (r251296) +++ head/sys/dev/xen/netfront/netfront.c Mon Jun 3 13:00:33 2013 (r251297) @@ -134,6 +134,7 @@ static const int MODPARM_rx_flip = 0; * to mirror the Linux MAX_SKB_FRAGS constant. */ #define MAX_TX_REQ_FRAGS (65536 / PAGE_SIZE + 2) +#define NF_TSO_MAXBURST ((IP_MAXPACKET / PAGE_SIZE) * MCLBYTES) #define RX_COPY_THRESHOLD 256 @@ -2122,6 +2123,7 @@ create_netdev(device_t dev) ifp->if_hwassist = XN_CSUM_FEATURES; ifp->if_capabilities = IFCAP_HWCSUM; + ifp->if_hw_tsomax = NF_TSO_MAXBURST; ether_ifattach(ifp, np->mac); callout_init(&np->xn_stat_ch, CALLOUT_MPSAFE); From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 13:11:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 51C7435B; Mon, 3 Jun 2013 13:11:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 44A301C5C; Mon, 3 Jun 2013 13:11:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53DBnGf096461; Mon, 3 Jun 2013 13:11:49 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53DBnBN096460; Mon, 3 Jun 2013 13:11:49 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201306031311.r53DBnBN096460@svn.freebsd.org> From: Ed Maste Date: Mon, 3 Jun 2013 13:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251298 - head/share/man/man4/man4.i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 13:11:49 -0000 Author: emaste Date: Mon Jun 3 13:11:48 2013 New Revision: 251298 URL: http://svnweb.freebsd.org/changeset/base/251298 Log: Switch to 2-clause license Approved by: luigi@ Modified: head/share/man/man4/man4.i386/pnp.4 Modified: head/share/man/man4/man4.i386/pnp.4 ============================================================================== --- head/share/man/man4/man4.i386/pnp.4 Mon Jun 3 13:00:33 2013 (r251297) +++ head/share/man/man4/man4.i386/pnp.4 Mon Jun 3 13:11:48 2013 (r251298) @@ -8,11 +8,6 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgements: -.\" This product includes software developed by Luigi Rizzo. -.\" 4. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 13:25:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5A1D66FE; Mon, 3 Jun 2013 13:25:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id 1DF3D1CF4; Mon, 3 Jun 2013 13:25:10 +0000 (UTC) Received: from spaceball.andric.com (spaceball.andric.com [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id CCAAC5C44; Mon, 3 Jun 2013 15:25:09 +0200 (CEST) Message-ID: <51AC9933.7050201@FreeBSD.org> Date: Mon, 03 Jun 2013 15:25:07 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Thunderbird/22.0 MIME-Version: 1.0 To: Marcel Moolenaar , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r250991 - in head: contrib/jemalloc/include/jemalloc include lib/libc/stdlib/jemalloc References: <201305251859.r4PIxChc053341@svn.freebsd.org> In-Reply-To: <201305251859.r4PIxChc053341@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 13:25:11 -0000 On 2013-05-25 20:59, Marcel Moolenaar wrote: > Author: marcel > Date: Sat May 25 18:59:11 2013 > New Revision: 250991 > URL: http://svnweb.freebsd.org/changeset/base/250991 > > Log: > Make the malloc(3) family of functions weak and make their non-weak > implementations visible for use by applications. The functions $F that > are now weak symbols are: > allocm, calloc, dallocm, free, malloc, malloc_usable_size, > nallocm, posix_memalign, rallocm, realloc, sallocm > > The non-weak implementations of $F are exported as __$F. Hi Marcel, This commit seems to lead to various problems in ports, and possibly other software. For example, with Firefox I now always get a few messages like: firefox in free(): warning: malloc() has never been called Another example is the devel/talloc port, which now dies with: [...] Checking linker accepts ['-undefined', 'dynamic_lookup'] : yes 'configure' finished successfully (2m33.364s) : /share/dim/src/freebsd/head/lib/libc/../../contrib/jemalloc/include/jemalloc/internal/arena.h:1002: Failed assertion: "((uintptr_t)ptr & PAGE_MASK) == 0" Abort trap (core dumped) ===> Script "buildtools/bin/waf configure" failed unexpectedly. See also the post here: Can we please revert this commit for now, if a fix for these problems is not readily available? -Dimitry From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 14:33:10 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EC54EEFA; Mon, 3 Jun 2013 14:33:10 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DD1471070; Mon, 3 Jun 2013 14:33:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53EXAbs025894; Mon, 3 Jun 2013 14:33:10 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53EXARJ025893; Mon, 3 Jun 2013 14:33:10 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306031433.r53EXARJ025893@svn.freebsd.org> From: Steven Hartland Date: Mon, 3 Jun 2013 14:33:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251299 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 14:33:11 -0000 Author: smh Date: Mon Jun 3 14:33:10 2013 New Revision: 251299 URL: http://svnweb.freebsd.org/changeset/base/251299 Log: MFC r246146: Format CDB output as 2 digit hex correcting the length Modified: stable/9/sys/cam/scsi/scsi_all.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Mon Jun 3 13:11:48 2013 (r251298) +++ stable/9/sys/cam/scsi/scsi_all.c Mon Jun 3 14:33:10 2013 (r251299) @@ -3136,7 +3136,7 @@ scsi_cdb_string(u_int8_t *cdb_ptr, char *cdb_string = '\0'; for (i = 0; i < cdb_len; i++) snprintf(cdb_string + strlen(cdb_string), - len - strlen(cdb_string), "%x ", cdb_ptr[i]); + len - strlen(cdb_string), "%02hhx ", cdb_ptr[i]); return(cdb_string); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 14:36:32 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B8591140; Mon, 3 Jun 2013 14:36:32 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8958B109B; Mon, 3 Jun 2013 14:36:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53EaWFk026541; Mon, 3 Jun 2013 14:36:32 GMT (envelope-from jasone@svn.freebsd.org) Received: (from jasone@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53EaSVV026513; Mon, 3 Jun 2013 14:36:28 GMT (envelope-from jasone@svn.freebsd.org) Message-Id: <201306031436.r53EaSVV026513@svn.freebsd.org> From: Jason Evans Date: Mon, 3 Jun 2013 14:36:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251300 - in head/contrib/jemalloc: . doc include/jemalloc include/jemalloc/internal src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 14:36:32 -0000 Author: jasone Date: Mon Jun 3 14:36:28 2013 New Revision: 251300 URL: http://svnweb.freebsd.org/changeset/base/251300 Log: Update jemalloc to version 3.4.0. Modified: head/contrib/jemalloc/ChangeLog head/contrib/jemalloc/FREEBSD-diffs head/contrib/jemalloc/VERSION head/contrib/jemalloc/doc/jemalloc.3 head/contrib/jemalloc/include/jemalloc/internal/arena.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h head/contrib/jemalloc/include/jemalloc/internal/private_namespace.h head/contrib/jemalloc/include/jemalloc/internal/prof.h head/contrib/jemalloc/include/jemalloc/internal/quarantine.h head/contrib/jemalloc/include/jemalloc/internal/tcache.h head/contrib/jemalloc/include/jemalloc/jemalloc.h head/contrib/jemalloc/src/arena.c head/contrib/jemalloc/src/base.c head/contrib/jemalloc/src/chunk.c head/contrib/jemalloc/src/chunk_dss.c head/contrib/jemalloc/src/jemalloc.c head/contrib/jemalloc/src/prof.c head/contrib/jemalloc/src/quarantine.c head/contrib/jemalloc/src/tcache.c Modified: head/contrib/jemalloc/ChangeLog ============================================================================== --- head/contrib/jemalloc/ChangeLog Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/ChangeLog Mon Jun 3 14:36:28 2013 (r251300) @@ -6,6 +6,47 @@ found in the git revision history: http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git git://canonware.com/jemalloc.git +* 3.4.0 (June 2, 2013) + + This version is essentially a small bugfix release, but the addition of + aarch64 support requires that the minor version be incremented. + + Bug fixes: + - Fix race-triggered deadlocks in chunk_record(). These deadlocks were + typically triggered by multiple threads concurrently deallocating huge + objects. + + New features: + - Add support for the aarch64 architecture. + +* 3.3.1 (March 6, 2013) + + This version fixes bugs that are typically encountered only when utilizing + custom run-time options. + + Bug fixes: + - Fix a locking order bug that could cause deadlock during fork if heap + profiling were enabled. + - Fix a chunk recycling bug that could cause the allocator to lose track of + whether a chunk was zeroed. On FreeBSD, NetBSD, and OS X, it could cause + corruption if allocating via sbrk(2) (unlikely unless running with the + "dss:primary" option specified). This was completely harmless on Linux + unless using mlockall(2) (and unlikely even then, unless the + --disable-munmap configure option or the "dss:primary" option was + specified). This regression was introduced in 3.1.0 by the + mlockall(2)/madvise(2) interaction fix. + - Fix TLS-related memory corruption that could occur during thread exit if the + thread never allocated memory. Only the quarantine and prof facilities were + susceptible. + - Fix two quarantine bugs: + + Internal reallocation of the quarantined object array leaked the old + array. + + Reallocation failure for internal reallocation of the quarantined object + array (very unlikely) resulted in memory corruption. + - Fix Valgrind integration to annotate all internally allocated memory in a + way that keeps Valgrind happy about internal data structure access. + - Fix building for s390 systems. + * 3.3.0 (January 23, 2013) This version includes a few minor performance improvements in addition to the Modified: head/contrib/jemalloc/FREEBSD-diffs ============================================================================== --- head/contrib/jemalloc/FREEBSD-diffs Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/FREEBSD-diffs Mon Jun 3 14:36:28 2013 (r251300) @@ -1,5 +1,5 @@ diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in -index 0930580..d45fa3d 100644 +index abd5e6f..1d7491a 100644 --- a/doc/jemalloc.xml.in +++ b/doc/jemalloc.xml.in @@ -51,12 +51,23 @@ @@ -27,7 +27,7 @@ index 0930580..d45fa3d 100644 Standard API -@@ -2173,4 +2184,16 @@ malloc_conf = "lg_chunk:24";]]> +@@ -2180,4 +2191,16 @@ malloc_conf = "lg_chunk:24";]]> The posix_memalign function conforms to IEEE Std 1003.1-2001 (“POSIX.1”). @@ -45,7 +45,7 @@ index 0930580..d45fa3d 100644 + diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in -index c606c12..0d46d9d 100644 +index e46ac54..527449d 100644 --- a/include/jemalloc/internal/jemalloc_internal.h.in +++ b/include/jemalloc/internal/jemalloc_internal.h.in @@ -1,5 +1,8 @@ @@ -97,7 +97,7 @@ index de44e14..564d604 100644 bool malloc_mutex_init(malloc_mutex_t *mutex); diff --git a/include/jemalloc/internal/private_namespace.h b/include/jemalloc/internal/private_namespace.h -index 903fb4d..d6638df 100644 +index 65de316..366676b 100644 --- a/include/jemalloc/internal/private_namespace.h +++ b/include/jemalloc/internal/private_namespace.h @@ -216,7 +216,6 @@ @@ -122,10 +122,10 @@ index 31b1304..c3ef2f5 100644 #define ALLOCM_LG_ALIGN(la) (la) diff --git a/include/jemalloc/jemalloc_FreeBSD.h b/include/jemalloc/jemalloc_FreeBSD.h new file mode 100644 -index 0000000..9c97a13 +index 0000000..e6c8407 --- /dev/null +++ b/include/jemalloc/jemalloc_FreeBSD.h -@@ -0,0 +1,76 @@ +@@ -0,0 +1,117 @@ +/* + * Override settings that were generated in jemalloc_defs.h as necessary. + */ @@ -196,14 +196,55 @@ index 0000000..9c97a13 +#define isthreaded ((bool)__isthreaded) + +/* Mangle. */ ++#undef je_malloc ++#undef je_calloc ++#undef je_realloc ++#undef je_free ++#undef je_posix_memalign ++#undef je_malloc_usable_size ++#undef je_allocm ++#undef je_rallocm ++#undef je_sallocm ++#undef je_dallocm ++#undef je_nallocm ++#define je_malloc __malloc ++#define je_calloc __calloc ++#define je_realloc __realloc ++#define je_free __free ++#define je_posix_memalign __posix_memalign ++#define je_malloc_usable_size __malloc_usable_size ++#define je_allocm __allocm ++#define je_rallocm __rallocm ++#define je_sallocm __sallocm ++#define je_dallocm __dallocm ++#define je_nallocm __nallocm +#define open _open +#define read _read +#define write _write +#define close _close +#define pthread_mutex_lock _pthread_mutex_lock +#define pthread_mutex_unlock _pthread_mutex_unlock ++ ++#ifdef JEMALLOC_C_ ++/* ++ * Define 'weak' symbols so that an application can have its own versions ++ * of malloc, calloc, realloc, free, et al. ++ */ ++__weak_reference(__malloc, malloc); ++__weak_reference(__calloc, calloc); ++__weak_reference(__realloc, realloc); ++__weak_reference(__free, free); ++__weak_reference(__posix_memalign, posix_memalign); ++__weak_reference(__malloc_usable_size, malloc_usable_size); ++__weak_reference(__allocm, allocm); ++__weak_reference(__rallocm, rallocm); ++__weak_reference(__sallocm, sallocm); ++__weak_reference(__dallocm, dallocm); ++__weak_reference(__nallocm, nallocm); ++#endif ++ diff --git a/src/jemalloc.c b/src/jemalloc.c -index c117685..665d98f 100644 +index bc350ed..352c98e 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -8,6 +8,10 @@ malloc_tsd_data(, arenas, arena_t *, NULL) @@ -217,7 +258,7 @@ index c117685..665d98f 100644 /* Runtime configuration options. */ const char *je_malloc_conf; bool opt_abort = -@@ -453,7 +457,8 @@ malloc_conf_init(void) +@@ -471,7 +475,8 @@ malloc_conf_init(void) #endif ; Modified: head/contrib/jemalloc/VERSION ============================================================================== --- head/contrib/jemalloc/VERSION Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/VERSION Mon Jun 3 14:36:28 2013 (r251300) @@ -1 +1 @@ -3.3.0-0-g83789f45307379e096c4e8be81d9e9a51e3f5a4a +3.4.0-0-g0ed518e5dab789ad2171bb38977a8927e2a26775 Modified: head/contrib/jemalloc/doc/jemalloc.3 ============================================================================== --- head/contrib/jemalloc/doc/jemalloc.3 Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/doc/jemalloc.3 Mon Jun 3 14:36:28 2013 (r251300) @@ -2,12 +2,12 @@ .\" Title: JEMALLOC .\" Author: Jason Evans .\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 01/23/2013 +.\" Date: 06/02/2013 .\" Manual: User Manual -.\" Source: jemalloc 3.3.0-0-g83789f45307379e096c4e8be81d9e9a51e3f5a4a +.\" Source: jemalloc 3.4.0-0-g0ed518e5dab789ad2171bb38977a8927e2a26775 .\" Language: English .\" -.TH "JEMALLOC" "3" "01/23/2013" "jemalloc 3.3.0-0-g83789f453073" "User Manual" +.TH "JEMALLOC" "3" "06/02/2013" "jemalloc 3.4.0-0-g0ed518e5dab7" "User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -31,7 +31,7 @@ jemalloc \- general purpose memory allocation functions .SH "LIBRARY" .PP -This manual describes jemalloc 3\&.3\&.0\-0\-g83789f45307379e096c4e8be81d9e9a51e3f5a4a\&. More information can be found at the +This manual describes jemalloc 3\&.4\&.0\-0\-g0ed518e5dab789ad2171bb38977a8927e2a26775\&. More information can be found at the \m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP The following configuration options are enabled in libc\*(Aqs built\-in jemalloc: @@ -392,7 +392,19 @@ Once, when the first call is made to one The string pointed to by the global variable \fImalloc_conf\fR, the \(lqname\(rq of the file referenced by the symbolic link named /etc/malloc\&.conf, and the value of the environment variable -\fBMALLOC_CONF\fR, will be interpreted, in that order, from left to right as options\&. +\fBMALLOC_CONF\fR, will be interpreted, in that order, from left to right as options\&. Note that +\fImalloc_conf\fR +may be read before +\fBmain\fR\fB\fR +is entered, so the declaration of +\fImalloc_conf\fR +should specify an initializer that contains the final value to be read by jemalloc\&. +\fImalloc_conf\fR +is a compile\-time setting, whereas +/etc/malloc\&.conf +and +\fBMALLOC_CONF\fR +can be safely set any time prior to program invocation\&. .PP An options string is a comma\-separated list of option:value pairs\&. There is one key corresponding to each "opt\&.*" Modified: head/contrib/jemalloc/include/jemalloc/internal/arena.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/arena.h Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/include/jemalloc/internal/arena.h Mon Jun 3 14:36:28 2013 (r251300) @@ -463,9 +463,9 @@ void arena_mapbits_small_set(arena_chunk size_t runind, size_t binind, size_t flags); void arena_mapbits_unzeroed_set(arena_chunk_t *chunk, size_t pageind, size_t unzeroed); -void arena_prof_accum_impl(arena_t *arena, uint64_t accumbytes); -void arena_prof_accum_locked(arena_t *arena, uint64_t accumbytes); -void arena_prof_accum(arena_t *arena, uint64_t accumbytes); +bool arena_prof_accum_impl(arena_t *arena, uint64_t accumbytes); +bool arena_prof_accum_locked(arena_t *arena, uint64_t accumbytes); +bool arena_prof_accum(arena_t *arena, uint64_t accumbytes); size_t arena_ptr_small_binind_get(const void *ptr, size_t mapbits); size_t arena_bin_index(arena_t *arena, arena_bin_t *bin); unsigned arena_run_regind(arena_run_t *run, arena_bin_info_t *bin_info, @@ -663,7 +663,7 @@ arena_mapbits_unzeroed_set(arena_chunk_t *mapbitsp = (*mapbitsp & ~CHUNK_MAP_UNZEROED) | unzeroed; } -JEMALLOC_INLINE void +JEMALLOC_INLINE bool arena_prof_accum_impl(arena_t *arena, uint64_t accumbytes) { @@ -672,33 +672,40 @@ arena_prof_accum_impl(arena_t *arena, ui arena->prof_accumbytes += accumbytes; if (arena->prof_accumbytes >= prof_interval) { - prof_idump(); arena->prof_accumbytes -= prof_interval; + return (true); } + return (false); } -JEMALLOC_INLINE void +JEMALLOC_INLINE bool arena_prof_accum_locked(arena_t *arena, uint64_t accumbytes) { cassert(config_prof); if (prof_interval == 0) - return; - arena_prof_accum_impl(arena, accumbytes); + return (false); + return (arena_prof_accum_impl(arena, accumbytes)); } -JEMALLOC_INLINE void +JEMALLOC_INLINE bool arena_prof_accum(arena_t *arena, uint64_t accumbytes) { cassert(config_prof); if (prof_interval == 0) - return; - malloc_mutex_lock(&arena->lock); - arena_prof_accum_impl(arena, accumbytes); - malloc_mutex_unlock(&arena->lock); + return (false); + + { + bool ret; + + malloc_mutex_lock(&arena->lock); + ret = arena_prof_accum_impl(arena, accumbytes); + malloc_mutex_unlock(&arena->lock); + return (ret); + } } JEMALLOC_ALWAYS_INLINE size_t Modified: head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h Mon Jun 3 14:36:28 2013 (r251300) @@ -278,6 +278,9 @@ static const bool config_ivsalloc = # ifdef __arm__ # define LG_QUANTUM 3 # endif +# ifdef __aarch64__ +# define LG_QUANTUM 4 +# endif # ifdef __hppa__ # define LG_QUANTUM 4 # endif @@ -287,7 +290,7 @@ static const bool config_ivsalloc = # ifdef __powerpc__ # define LG_QUANTUM 4 # endif -# ifdef __s390x__ +# ifdef __s390__ # define LG_QUANTUM 4 # endif # ifdef __SH4__ @@ -440,15 +443,18 @@ static const bool config_ivsalloc = } while (0) #else #define RUNNING_ON_VALGRIND ((unsigned)0) -#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) -#define VALGRIND_RESIZEINPLACE_BLOCK(addr, oldSizeB, newSizeB, rzB) -#define VALGRIND_FREELIKE_BLOCK(addr, rzB) -#define VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr, _qzz_len) -#define VALGRIND_MAKE_MEM_DEFINED(_qzz_addr, _qzz_len) -#define JEMALLOC_VALGRIND_MALLOC(cond, ptr, usize, zero) +#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \ + do {} while (0) +#define VALGRIND_RESIZEINPLACE_BLOCK(addr, oldSizeB, newSizeB, rzB) \ + do {} while (0) +#define VALGRIND_FREELIKE_BLOCK(addr, rzB) do {} while (0) +#define VALGRIND_MAKE_MEM_NOACCESS(_qzz_addr, _qzz_len) do {} while (0) +#define VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr, _qzz_len) do {} while (0) +#define VALGRIND_MAKE_MEM_DEFINED(_qzz_addr, _qzz_len) do {} while (0) +#define JEMALLOC_VALGRIND_MALLOC(cond, ptr, usize, zero) do {} while (0) #define JEMALLOC_VALGRIND_REALLOC(ptr, usize, old_ptr, old_usize, \ - old_rzsize, zero) -#define JEMALLOC_VALGRIND_FREE(ptr, rzsize) + old_rzsize, zero) do {} while (0) +#define JEMALLOC_VALGRIND_FREE(ptr, rzsize) do {} while (0) #endif #include "jemalloc/internal/util.h" Modified: head/contrib/jemalloc/include/jemalloc/internal/private_namespace.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/private_namespace.h Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/include/jemalloc/internal/private_namespace.h Mon Jun 3 14:36:28 2013 (r251300) @@ -305,7 +305,13 @@ #define prof_tdata_tsd_get_wrapper JEMALLOC_N(prof_tdata_tsd_get_wrapper) #define prof_tdata_tsd_set JEMALLOC_N(prof_tdata_tsd_set) #define quarantine JEMALLOC_N(quarantine) +#define quarantine_alloc_hook JEMALLOC_N(quarantine_alloc_hook) #define quarantine_boot JEMALLOC_N(quarantine_boot) +#define quarantine_booted JEMALLOC_N(quarantine_booted) +#define quarantine_cleanup JEMALLOC_N(quarantine_cleanup) +#define quarantine_init JEMALLOC_N(quarantine_init) +#define quarantine_tls JEMALLOC_N(quarantine_tls) +#define quarantine_tsd JEMALLOC_N(quarantine_tsd) #define quarantine_tsd_boot JEMALLOC_N(quarantine_tsd_boot) #define quarantine_tsd_cleanup_wrapper JEMALLOC_N(quarantine_tsd_cleanup_wrapper) #define quarantine_tsd_get JEMALLOC_N(quarantine_tsd_get) Modified: head/contrib/jemalloc/include/jemalloc/internal/prof.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/prof.h Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/include/jemalloc/internal/prof.h Mon Jun 3 14:36:28 2013 (r251300) @@ -237,7 +237,7 @@ void prof_postfork_child(void); \ assert(size == s2u(size)); \ \ - prof_tdata = prof_tdata_get(); \ + prof_tdata = prof_tdata_get(true); \ if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX) { \ if (prof_tdata != NULL) \ ret = (prof_thr_cnt_t *)(uintptr_t)1U; \ @@ -286,7 +286,7 @@ void prof_postfork_child(void); #ifndef JEMALLOC_ENABLE_INLINE malloc_tsd_protos(JEMALLOC_ATTR(unused), prof_tdata, prof_tdata_t *) -prof_tdata_t *prof_tdata_get(void); +prof_tdata_t *prof_tdata_get(bool create); void prof_sample_threshold_update(prof_tdata_t *prof_tdata); prof_ctx_t *prof_ctx_get(const void *ptr); void prof_ctx_set(const void *ptr, prof_ctx_t *ctx); @@ -304,17 +304,15 @@ malloc_tsd_funcs(JEMALLOC_INLINE, prof_t prof_tdata_cleanup) JEMALLOC_INLINE prof_tdata_t * -prof_tdata_get(void) +prof_tdata_get(bool create) { prof_tdata_t *prof_tdata; cassert(config_prof); prof_tdata = *prof_tdata_tsd_get(); - if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX) { - if (prof_tdata == NULL) - prof_tdata = prof_tdata_init(); - } + if (create && prof_tdata == NULL) + prof_tdata = prof_tdata_init(); return (prof_tdata); } @@ -397,7 +395,7 @@ prof_sample_accum_update(size_t size) /* Sampling logic is unnecessary if the interval is 1. */ assert(opt_lg_prof_sample != 0); - prof_tdata = *prof_tdata_tsd_get(); + prof_tdata = prof_tdata_get(false); if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX) return (true); Modified: head/contrib/jemalloc/include/jemalloc/internal/quarantine.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/quarantine.h Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/include/jemalloc/internal/quarantine.h Mon Jun 3 14:36:28 2013 (r251300) @@ -1,6 +1,9 @@ /******************************************************************************/ #ifdef JEMALLOC_H_TYPES +typedef struct quarantine_obj_s quarantine_obj_t; +typedef struct quarantine_s quarantine_t; + /* Default per thread quarantine size if valgrind is enabled. */ #define JEMALLOC_VALGRIND_QUARANTINE_DEFAULT (ZU(1) << 24) @@ -8,17 +11,57 @@ /******************************************************************************/ #ifdef JEMALLOC_H_STRUCTS +struct quarantine_obj_s { + void *ptr; + size_t usize; +}; + +struct quarantine_s { + size_t curbytes; + size_t curobjs; + size_t first; +#define LG_MAXOBJS_INIT 10 + size_t lg_maxobjs; + quarantine_obj_t objs[1]; /* Dynamically sized ring buffer. */ +}; + #endif /* JEMALLOC_H_STRUCTS */ /******************************************************************************/ #ifdef JEMALLOC_H_EXTERNS +quarantine_t *quarantine_init(size_t lg_maxobjs); void quarantine(void *ptr); +void quarantine_cleanup(void *arg); bool quarantine_boot(void); #endif /* JEMALLOC_H_EXTERNS */ /******************************************************************************/ #ifdef JEMALLOC_H_INLINES +#ifndef JEMALLOC_ENABLE_INLINE +malloc_tsd_protos(JEMALLOC_ATTR(unused), quarantine, quarantine_t *) + +void quarantine_alloc_hook(void); +#endif + +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_QUARANTINE_C_)) +malloc_tsd_externs(quarantine, quarantine_t *) +malloc_tsd_funcs(JEMALLOC_ALWAYS_INLINE, quarantine, quarantine_t *, NULL, + quarantine_cleanup) + +JEMALLOC_ALWAYS_INLINE void +quarantine_alloc_hook(void) +{ + quarantine_t *quarantine; + + assert(config_fill && opt_quarantine); + + quarantine = *quarantine_tsd_get(); + if (quarantine == NULL) + quarantine_init(LG_MAXOBJS_INIT); +} +#endif + #endif /* JEMALLOC_H_INLINES */ /******************************************************************************/ Modified: head/contrib/jemalloc/include/jemalloc/internal/tcache.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/tcache.h Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/include/jemalloc/internal/tcache.h Mon Jun 3 14:36:28 2013 (r251300) @@ -320,8 +320,8 @@ tcache_alloc_small(tcache_t *tcache, siz } VALGRIND_MAKE_MEM_UNDEFINED(ret, size); memset(ret, 0, size); - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); if (config_stats) tbin->tstats.nrequests++; @@ -371,8 +371,8 @@ tcache_alloc_large(tcache_t *tcache, siz } else { VALGRIND_MAKE_MEM_UNDEFINED(ret, size); memset(ret, 0, size); - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); if (config_stats) tbin->tstats.nrequests++; Modified: head/contrib/jemalloc/include/jemalloc/jemalloc.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/jemalloc.h Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/include/jemalloc/jemalloc.h Mon Jun 3 14:36:28 2013 (r251300) @@ -7,12 +7,12 @@ extern "C" { #include #include -#define JEMALLOC_VERSION "3.3.0-0-g83789f45307379e096c4e8be81d9e9a51e3f5a4a" +#define JEMALLOC_VERSION "3.4.0-0-g0ed518e5dab789ad2171bb38977a8927e2a26775" #define JEMALLOC_VERSION_MAJOR 3 -#define JEMALLOC_VERSION_MINOR 3 +#define JEMALLOC_VERSION_MINOR 4 #define JEMALLOC_VERSION_BUGFIX 0 #define JEMALLOC_VERSION_NREV 0 -#define JEMALLOC_VERSION_GID "83789f45307379e096c4e8be81d9e9a51e3f5a4a" +#define JEMALLOC_VERSION_GID "0ed518e5dab789ad2171bb38977a8927e2a26775" #include "jemalloc_defs.h" #include "jemalloc_FreeBSD.h" Modified: head/contrib/jemalloc/src/arena.c ============================================================================== --- head/contrib/jemalloc/src/arena.c Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/src/arena.c Mon Jun 3 14:36:28 2013 (r251300) @@ -366,8 +366,6 @@ arena_run_zero(arena_chunk_t *chunk, siz LG_PAGE)), (npages << LG_PAGE)); memset((void *)((uintptr_t)chunk + (run_ind << LG_PAGE)), 0, (npages << LG_PAGE)); - VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk + (run_ind << - LG_PAGE)), (npages << LG_PAGE)); } static inline void @@ -380,8 +378,6 @@ arena_run_page_validate_zeroed(arena_chu LG_PAGE)), PAGE); for (i = 0; i < PAGE / sizeof(size_t); i++) assert(p[i] == 0); - VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk + (run_ind << - LG_PAGE)), PAGE); } static void @@ -513,6 +509,8 @@ arena_run_split(arena_t *arena, arena_ru run_ind+need_pages-1); } } + VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk + (run_ind << + LG_PAGE)), (need_pages << LG_PAGE)); } static arena_chunk_t * @@ -574,6 +572,11 @@ arena_chunk_alloc(arena_t *arena) for (i = map_bias+1; i < chunk_npages-1; i++) arena_mapbits_unzeroed_set(chunk, i, unzeroed); } else if (config_debug) { + VALGRIND_MAKE_MEM_DEFINED( + (void *)arena_mapp_get(chunk, map_bias+1), + (void *)((uintptr_t) + arena_mapp_get(chunk, chunk_npages-1) + - (uintptr_t)arena_mapp_get(chunk, map_bias+1))); for (i = map_bias+1; i < chunk_npages-1; i++) { assert(arena_mapbits_unzeroed_get(chunk, i) == unzeroed); @@ -1246,8 +1249,6 @@ arena_bin_nonfull_run_get(arena_t *arena (uintptr_t)bin_info->bitmap_offset); /* Initialize run internals. */ - VALGRIND_MAKE_MEM_UNDEFINED(run, bin_info->reg0_offset - - bin_info->redzone_size); run->bin = bin; run->nextind = 0; run->nfree = bin_info->nregs; @@ -1337,8 +1338,8 @@ arena_tcache_fill_small(arena_t *arena, assert(tbin->ncached == 0); - if (config_prof) - arena_prof_accum(arena, prof_accumbytes); + if (config_prof && arena_prof_accum(arena, prof_accumbytes)) + prof_idump(); bin = &arena->bins[binind]; malloc_mutex_lock(&bin->lock); for (i = 0, nfill = (tcache_bin_info[binind].ncached_max >> @@ -1446,8 +1447,8 @@ arena_malloc_small(arena_t *arena, size_ bin->stats.nrequests++; } malloc_mutex_unlock(&bin->lock); - if (config_prof && isthreaded == false) - arena_prof_accum(arena, size); + if (config_prof && isthreaded == false && arena_prof_accum(arena, size)) + prof_idump(); if (zero == false) { if (config_fill) { @@ -1464,8 +1465,8 @@ arena_malloc_small(arena_t *arena, size_ } VALGRIND_MAKE_MEM_UNDEFINED(ret, size); memset(ret, 0, size); - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); return (ret); } @@ -1474,6 +1475,7 @@ void * arena_malloc_large(arena_t *arena, size_t size, bool zero) { void *ret; + UNUSED bool idump; /* Large allocation. */ size = PAGE_CEILING(size); @@ -1492,8 +1494,10 @@ arena_malloc_large(arena_t *arena, size_ arena->stats.lstats[(size >> LG_PAGE) - 1].curruns++; } if (config_prof) - arena_prof_accum_locked(arena, size); + idump = arena_prof_accum_locked(arena, size); malloc_mutex_unlock(&arena->lock); + if (config_prof && idump) + prof_idump(); if (zero == false) { if (config_fill) { Modified: head/contrib/jemalloc/src/base.c ============================================================================== --- head/contrib/jemalloc/src/base.c Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/src/base.c Mon Jun 3 14:36:28 2013 (r251300) @@ -63,6 +63,7 @@ base_alloc(size_t size) ret = base_next_addr; base_next_addr = (void *)((uintptr_t)base_next_addr + csize); malloc_mutex_unlock(&base_mtx); + VALGRIND_MAKE_MEM_UNDEFINED(ret, csize); return (ret); } @@ -88,6 +89,7 @@ base_node_alloc(void) ret = base_nodes; base_nodes = *(extent_node_t **)ret; malloc_mutex_unlock(&base_mtx); + VALGRIND_MAKE_MEM_UNDEFINED(ret, sizeof(extent_node_t)); } else { malloc_mutex_unlock(&base_mtx); ret = (extent_node_t *)base_alloc(sizeof(extent_node_t)); @@ -100,6 +102,7 @@ void base_node_dealloc(extent_node_t *node) { + VALGRIND_MAKE_MEM_UNDEFINED(node, sizeof(extent_node_t)); malloc_mutex_lock(&base_mtx); *(extent_node_t **)node = base_nodes; base_nodes = node; Modified: head/contrib/jemalloc/src/chunk.c ============================================================================== --- head/contrib/jemalloc/src/chunk.c Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/src/chunk.c Mon Jun 3 14:36:28 2013 (r251300) @@ -111,6 +111,7 @@ chunk_recycle(extent_tree_t *chunks_szad } node->addr = (void *)((uintptr_t)(ret) + size); node->size = trailsize; + node->zeroed = zeroed; extent_tree_szad_insert(chunks_szad, node); extent_tree_ad_insert(chunks_ad, node); node = NULL; @@ -119,7 +120,6 @@ chunk_recycle(extent_tree_t *chunks_szad if (node != NULL) base_node_dealloc(node); - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); if (*zero) { if (zeroed == false) memset(ret, 0, size); @@ -130,7 +130,6 @@ chunk_recycle(extent_tree_t *chunks_szad VALGRIND_MAKE_MEM_DEFINED(ret, size); for (i = 0; i < size / sizeof(size_t); i++) assert(p[i] == 0); - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } } return (ret); @@ -179,27 +178,32 @@ chunk_alloc(size_t size, size_t alignmen /* All strategies for allocation failed. */ ret = NULL; label_return: - if (config_ivsalloc && base == false && ret != NULL) { - if (rtree_set(chunks_rtree, (uintptr_t)ret, ret)) { - chunk_dealloc(ret, size, true); - return (NULL); + if (ret != NULL) { + if (config_ivsalloc && base == false) { + if (rtree_set(chunks_rtree, (uintptr_t)ret, ret)) { + chunk_dealloc(ret, size, true); + return (NULL); + } } - } - if ((config_stats || config_prof) && ret != NULL) { - bool gdump; - malloc_mutex_lock(&chunks_mtx); - if (config_stats) - stats_chunks.nchunks += (size / chunksize); - stats_chunks.curchunks += (size / chunksize); - if (stats_chunks.curchunks > stats_chunks.highchunks) { - stats_chunks.highchunks = stats_chunks.curchunks; - if (config_prof) - gdump = true; - } else if (config_prof) - gdump = false; - malloc_mutex_unlock(&chunks_mtx); - if (config_prof && opt_prof && opt_prof_gdump && gdump) - prof_gdump(); + if (config_stats || config_prof) { + bool gdump; + malloc_mutex_lock(&chunks_mtx); + if (config_stats) + stats_chunks.nchunks += (size / chunksize); + stats_chunks.curchunks += (size / chunksize); + if (stats_chunks.curchunks > stats_chunks.highchunks) { + stats_chunks.highchunks = + stats_chunks.curchunks; + if (config_prof) + gdump = true; + } else if (config_prof) + gdump = false; + malloc_mutex_unlock(&chunks_mtx); + if (config_prof && opt_prof && opt_prof_gdump && gdump) + prof_gdump(); + } + if (config_valgrind) + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } assert(CHUNK_ADDR2BASE(ret) == ret); return (ret); @@ -210,9 +214,10 @@ chunk_record(extent_tree_t *chunks_szad, size_t size) { bool unzeroed; - extent_node_t *xnode, *node, *prev, key; + extent_node_t *xnode, *node, *prev, *xprev, key; unzeroed = pages_purge(chunk, size); + VALGRIND_MAKE_MEM_NOACCESS(chunk, size); /* * Allocate a node before acquiring chunks_mtx even though it might not @@ -221,6 +226,8 @@ chunk_record(extent_tree_t *chunks_szad, * held. */ xnode = base_node_alloc(); + /* Use xprev to implement conditional deferred deallocation of prev. */ + xprev = NULL; malloc_mutex_lock(&chunks_mtx); key.addr = (void *)((uintptr_t)chunk + size); @@ -237,8 +244,6 @@ chunk_record(extent_tree_t *chunks_szad, node->size += size; node->zeroed = (node->zeroed && (unzeroed == false)); extent_tree_szad_insert(chunks_szad, node); - if (xnode != NULL) - base_node_dealloc(xnode); } else { /* Coalescing forward failed, so insert a new node. */ if (xnode == NULL) { @@ -248,10 +253,10 @@ chunk_record(extent_tree_t *chunks_szad, * already been purged, so this is only a virtual * memory leak. */ - malloc_mutex_unlock(&chunks_mtx); - return; + goto label_return; } node = xnode; + xnode = NULL; /* Prevent deallocation below. */ node->addr = chunk; node->size = size; node->zeroed = (unzeroed == false); @@ -277,9 +282,19 @@ chunk_record(extent_tree_t *chunks_szad, node->zeroed = (node->zeroed && prev->zeroed); extent_tree_szad_insert(chunks_szad, node); - base_node_dealloc(prev); + xprev = prev; } + +label_return: malloc_mutex_unlock(&chunks_mtx); + /* + * Deallocate xnode and/or xprev after unlocking chunks_mtx in order to + * avoid potential deadlock. + */ + if (xnode != NULL) + base_node_dealloc(xnode); + if (xprev != NULL) + base_node_dealloc(prev); } void Modified: head/contrib/jemalloc/src/chunk_dss.c ============================================================================== --- head/contrib/jemalloc/src/chunk_dss.c Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/src/chunk_dss.c Mon Jun 3 14:36:28 2013 (r251300) @@ -127,7 +127,6 @@ chunk_alloc_dss(size_t size, size_t alig if (*zero) { VALGRIND_MAKE_MEM_UNDEFINED(ret, size); memset(ret, 0, size); - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } return (ret); } Modified: head/contrib/jemalloc/src/jemalloc.c ============================================================================== --- head/contrib/jemalloc/src/jemalloc.c Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/src/jemalloc.c Mon Jun 3 14:36:28 2013 (r251300) @@ -286,12 +286,30 @@ arenas_cleanup(void *arg) malloc_mutex_unlock(&arenas_lock); } +static JEMALLOC_ATTR(always_inline) void +malloc_thread_init(void) +{ + + /* + * TSD initialization can't be safely done as a side effect of + * deallocation, because it is possible for a thread to do nothing but + * deallocate its TLS data via free(), in which case writing to TLS + * would cause write-after-free memory corruption. The quarantine + * facility *only* gets used as a side effect of deallocation, so make + * a best effort attempt at initializing its TSD by hooking all + * allocation events. + */ + if (config_fill && opt_quarantine) + quarantine_alloc_hook(); +} + static JEMALLOC_ATTR(always_inline) bool malloc_init(void) { - if (malloc_initialized == false) - return (malloc_init_hard()); + if (malloc_initialized == false && malloc_init_hard()) + return (true); + malloc_thread_init(); return (false); } @@ -1100,6 +1118,7 @@ je_realloc(void *ptr, size_t size) if (size == 0) { if (ptr != NULL) { /* realloc(ptr, 0) is equivalent to free(p). */ + assert(malloc_initialized || IS_INITIALIZER); if (config_prof) { old_size = isalloc(ptr, true); if (config_valgrind && opt_valgrind) @@ -1125,6 +1144,7 @@ je_realloc(void *ptr, size_t size) if (ptr != NULL) { assert(malloc_initialized || IS_INITIALIZER); + malloc_thread_init(); if (config_prof) { old_size = isalloc(ptr, true); @@ -1328,6 +1348,7 @@ je_malloc_usable_size(JEMALLOC_USABLE_SI size_t ret; assert(malloc_initialized || IS_INITIALIZER); + malloc_thread_init(); if (config_ivsalloc) ret = ivsalloc(ptr, config_prof); @@ -1502,6 +1523,7 @@ je_rallocm(void **ptr, size_t *rsize, si assert(size != 0); assert(SIZE_T_MAX - size >= extra); assert(malloc_initialized || IS_INITIALIZER); + malloc_thread_init(); if (arena_ind != UINT_MAX) { arena_chunk_t *chunk; @@ -1616,6 +1638,7 @@ je_sallocm(const void *ptr, size_t *rsiz size_t sz; assert(malloc_initialized || IS_INITIALIZER); + malloc_thread_init(); if (config_ivsalloc) sz = ivsalloc(ptr, config_prof); @@ -1735,12 +1758,12 @@ _malloc_prefork(void) /* Acquire all mutexes in a safe order. */ ctl_prefork(); + prof_prefork(); malloc_mutex_prefork(&arenas_lock); for (i = 0; i < narenas_total; i++) { if (arenas[i] != NULL) arena_prefork(arenas[i]); } - prof_prefork(); chunk_prefork(); base_prefork(); huge_prefork(); @@ -1766,12 +1789,12 @@ _malloc_postfork(void) huge_postfork_parent(); base_postfork_parent(); chunk_postfork_parent(); - prof_postfork_parent(); for (i = 0; i < narenas_total; i++) { if (arenas[i] != NULL) arena_postfork_parent(arenas[i]); } malloc_mutex_postfork_parent(&arenas_lock); + prof_postfork_parent(); ctl_postfork_parent(); } @@ -1786,12 +1809,12 @@ jemalloc_postfork_child(void) huge_postfork_child(); base_postfork_child(); chunk_postfork_child(); - prof_postfork_child(); for (i = 0; i < narenas_total; i++) { if (arenas[i] != NULL) arena_postfork_child(arenas[i]); } malloc_mutex_postfork_child(&arenas_lock); + prof_postfork_child(); ctl_postfork_child(); } Modified: head/contrib/jemalloc/src/prof.c ============================================================================== --- head/contrib/jemalloc/src/prof.c Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/src/prof.c Mon Jun 3 14:36:28 2013 (r251300) @@ -438,7 +438,7 @@ prof_lookup(prof_bt_t *bt) cassert(config_prof); - prof_tdata = prof_tdata_get(); + prof_tdata = prof_tdata_get(false); if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX) return (NULL); @@ -684,7 +684,7 @@ prof_ctx_destroy(prof_ctx_t *ctx) * avoid a race between the main body of prof_ctx_merge() and entry * into this function. */ - prof_tdata = *prof_tdata_tsd_get(); + prof_tdata = prof_tdata_get(false); assert((uintptr_t)prof_tdata > (uintptr_t)PROF_TDATA_STATE_MAX); prof_enter(prof_tdata); malloc_mutex_lock(ctx->lock); @@ -844,7 +844,7 @@ prof_dump(bool propagate_err, const char cassert(config_prof); - prof_tdata = prof_tdata_get(); + prof_tdata = prof_tdata_get(false); if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX) return (true); prof_enter(prof_tdata); @@ -966,11 +966,7 @@ prof_idump(void) if (prof_booted == false) return; - /* - * Don't call prof_tdata_get() here, because it could cause recursive - * allocation. - */ - prof_tdata = *prof_tdata_tsd_get(); + prof_tdata = prof_tdata_get(false); if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX) return; if (prof_tdata->enq) { @@ -1020,11 +1016,7 @@ prof_gdump(void) if (prof_booted == false) return; - /* - * Don't call prof_tdata_get() here, because it could cause recursive - * allocation. - */ - prof_tdata = *prof_tdata_tsd_get(); + prof_tdata = prof_tdata_get(false); if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX) return; if (prof_tdata->enq) { Modified: head/contrib/jemalloc/src/quarantine.c ============================================================================== --- head/contrib/jemalloc/src/quarantine.c Mon Jun 3 14:33:10 2013 (r251299) +++ head/contrib/jemalloc/src/quarantine.c Mon Jun 3 14:36:28 2013 (r251300) @@ -1,3 +1,4 @@ +#define JEMALLOC_QUARANTINE_C_ #include "jemalloc/internal/jemalloc_internal.h" /* @@ -11,39 +12,18 @@ /******************************************************************************/ /* Data. */ -typedef struct quarantine_obj_s quarantine_obj_t; -typedef struct quarantine_s quarantine_t; - -struct quarantine_obj_s { - void *ptr; - size_t usize; -}; - -struct quarantine_s { - size_t curbytes; - size_t curobjs; - size_t first; -#define LG_MAXOBJS_INIT 10 - size_t lg_maxobjs; - quarantine_obj_t objs[1]; /* Dynamically sized ring buffer. */ -}; - -static void quarantine_cleanup(void *arg); - -malloc_tsd_data(static, quarantine, quarantine_t *, NULL) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 14:50:38 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B31344AF; Mon, 3 Jun 2013 14:50:38 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id 1B26B114B; Mon, 3 Jun 2013 14:50:37 +0000 (UTC) Received: from sladejones-sslvpn-nc.jnpr.net (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mail.xcllnt.net (8.14.7/8.14.7) with ESMTP id r53Eoal5028148 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 3 Jun 2013 07:50:36 -0700 (PDT) (envelope-from marcel@xcllnt.net) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: svn commit: r250991 - in head: contrib/jemalloc/include/jemalloc include lib/libc/stdlib/jemalloc From: Marcel Moolenaar In-Reply-To: <51AC9933.7050201@FreeBSD.org> Date: Mon, 3 Jun 2013 07:50:31 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201305251859.r4PIxChc053341@svn.freebsd.org> <51AC9933.7050201@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.1503) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 14:50:38 -0000 On Jun 3, 2013, at 6:25 AM, Dimitry Andric wrote: > On 2013-05-25 20:59, Marcel Moolenaar wrote: >> Author: marcel >> Date: Sat May 25 18:59:11 2013 >> New Revision: 250991 >> URL: http://svnweb.freebsd.org/changeset/base/250991 >>=20 >> Log: >> Make the malloc(3) family of functions weak and make their non-weak >> implementations visible for use by applications. The functions $F = that >> are now weak symbols are: >> allocm, calloc, dallocm, free, malloc, malloc_usable_size, >> nallocm, posix_memalign, rallocm, realloc, sallocm >>=20 >> The non-weak implementations of $F are exported as __$F. >=20 > Hi Marcel, >=20 > This commit seems to lead to various problems in ports, and possibly > other software. For example, with Firefox I now always get a few > messages like: >=20 > firefox in free(): warning: malloc() has never been called >=20 > Another example is the devel/talloc port, which now dies with: It looks like the python build is broken. The net effect is that = _ctypes.so has a strong definition of malloc, free, et al. This is not intentional, but a side-effect of the what seems to be a bug in fficonfig.py.in (see patch below). To elaborate: _ctypes.so incorporates the libffi functionality for what I presume is the basis for Python bindings. libffi includes dlmalloc.c, an open = source allocator. dlmalloc.c is incuded by closures.c and closures.c defines USE_DL_PREFIX. On top of that closures.c makes all allocator functions static. This, by design there's no problem. In short: dlmalloc.c never gets compiler separately/independently. The python build however compiles dlmalloc.c separately/independently. As such, dlmalloc.c now defines and exports malloc et al and it also get linked into _ctypes.so. Once _ctypes.so gets dynamically loaded, things start to break. Unfortunately, this means python needs to be recompiled from ports with the following fix: Index: files/patch-Modules-_ctypes-libffi-fficonfig.py.in =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- files/patch-Modules-_ctypes-libffi-fficonfig.py.in (revision 0) +++ files/patch-Modules-_ctypes-libffi-fficonfig.py.in (working copy) @@ -0,0 +1,10 @@ +--- Modules/_ctypes/libffi/fficonfig.py.in.orig 2013-06-03 = 07:16:44.000000000 -0700 ++++ Modules/_ctypes/libffi/fficonfig.py.in 2013-06-03 = 07:17:03.000000000 -0700 +@@ -1,7 +1,6 @@ + ffi_sources =3D """ + src/prep_cif.c + src/closures.c +-src/dlmalloc.c + """.split() +=20 + ffi_platforms =3D { This has been tested with python-2.7.5. I can't say anything about other versions. Do people concur that this is the right fix? --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 15:23:03 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 3A77D228; Mon, 3 Jun 2013 15:23:03 +0000 (UTC) Date: Mon, 3 Jun 2013 15:23:03 +0000 From: Alexey Dokuchaev To: David Schultz Subject: Re: svn commit: r251121 - in head: include lib/msun lib/msun/man lib/msun/src Message-ID: <20130603152303.GA28476@FreeBSD.org> References: <201305300449.r4U4nRqM012625@svn.freebsd.org> <20130531033012.GB42068@FreeBSD.org> <20130603093809.GA30173@zim.MIT.EDU> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline In-Reply-To: <20130603093809.GA30173@zim.MIT.EDU> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 15:23:03 -0000 --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jun 03, 2013 at 02:38:09AM -0700, David Schultz wrote: > On Fri, May 31, 2013, Alexey Dokuchaev wrote: > > On Thu, May 30, 2013 at 04:49:27AM +0000, David Schultz wrote: > > > New Revision: 251121 > > > URL: http://svnweb.freebsd.org/changeset/base/251121 > > > > > > Log: > > > I'm happy to finally commit stephen@'s implementations of cacos, > > > cacosh, casin, casinh, catan, and catanh. Thanks to stephen@ and bde@ > > > for working on these. > > > > This is awesome, but I did not see __FreeBSD_version bumped. Many ports > > rely on math functions, and having coherent OSVERSIONs really helps to > > decide when some function is natively supported, or emulation code required. > > Done. Sorry for the delay: I wanted to add a few more functions > first! I usually update the Porter's Handbook too, but I'm out of > time right now, so I would appreciate it if someone could do it. > The needed information should be in the commit message. It's OK, no problem (about the delay), thanks for bumping it. As for the PH update, personally I don't think it is awfully useful to document every __FreeBSD_version bump there (not to mention that it's generally hard to keep this pretty volatile list consistent with the reality), but patch is attached nonetheless (need a review and blessing from someone on the doc@ team to commit it myself). ./danfe --fdj2RfSjLxBAspz7 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ph.diff" Index: book.xml =================================================================== --- book.xml (revision 41830) +++ book.xml (working copy) @@ -16026,6 +16026,15 @@ VM subsystem to support read/write locking (rev 248084). + + + 1000034 + June 3, 2013 + 10-CURRENT after adding the following functions to + libm: cacos, cacosf, cacosh, cacoshf, casin, casinf, + casinh, casinhf, catan, catanf, catanh, catanhf, logl, + log2l, log10l, log1pl. + --fdj2RfSjLxBAspz7-- From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 15:48:26 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CFCB7FA; Mon, 3 Jun 2013 15:48:26 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C167816BD; Mon, 3 Jun 2013 15:48:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53FmQSV051199; Mon, 3 Jun 2013 15:48:26 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53FmQce051193; Mon, 3 Jun 2013 15:48:26 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306031548.r53FmQce051193@svn.freebsd.org> From: Steven Hartland Date: Mon, 3 Jun 2013 15:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251301 - in stable/9/sys/cam: . ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 15:48:26 -0000 Author: smh Date: Mon Jun 3 15:48:25 2013 New Revision: 251301 URL: http://svnweb.freebsd.org/changeset/base/251301 Log: MFC r248922: Add the ability to enable / disable sorting of BIO requests Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/cam.c stable/9/sys/cam/cam.h stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Mon Jun 3 14:36:28 2013 (r251300) +++ stable/9/sys/cam/ata/ata_da.c Mon Jun 3 15:48:25 2013 (r251301) @@ -131,6 +131,7 @@ struct ada_softc { ada_state state; ada_flags flags; ada_quirks quirks; + int sort_io_queue; int ordered_tag_count; int outstanding_cmds; int trim_max_ranges; @@ -450,6 +451,8 @@ static void adaresume(void *arg); softc->read_ahead : ada_read_ahead) #define ADA_WC (softc->write_cache >= 0 ? \ softc->write_cache : ada_write_cache) +#define ADA_SIO (softc->sort_io_queue >= 0 ? \ + softc->sort_io_queue : cam_sort_io_queues) /* * Most platforms map firmware geometry to actual, but some don't. If @@ -660,10 +663,17 @@ adastrategy(struct bio *bp) * Place it in the queue of disk activities for this disk */ if (bp->bio_cmd == BIO_DELETE && - (softc->flags & ADA_FLAG_CAN_TRIM)) - bioq_disksort(&softc->trim_queue, bp); - else - bioq_disksort(&softc->bio_queue, bp); + (softc->flags & ADA_FLAG_CAN_TRIM)) { + if (ADA_SIO) + bioq_disksort(&softc->trim_queue, bp); + else + bioq_insert_tail(&softc->trim_queue, bp); + } else { + if (ADA_SIO) + bioq_disksort(&softc->bio_queue, bp); + else + bioq_insert_tail(&softc->bio_queue, bp); + } /* * Schedule ourselves for performing the work. @@ -1010,6 +1020,10 @@ adasysctlinit(void *context, int pending SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->write_cache, 0, "Enable disk write cache."); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "sort_io_queue", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->sort_io_queue, 0, + "Sort IO queue to try and optimise disk access patterns"); #ifdef ADA_TEST_FAILURE /* * Add a 'door bell' sysctl which allows one to set it from userland @@ -1145,6 +1159,7 @@ adaregister(struct cam_periph *periph, v snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.write_cache", periph->unit_number); TUNABLE_INT_FETCH(announce_buf, &softc->write_cache); + softc->sort_io_queue = -1; adagetparams(periph, cgd); softc->disk = disk_alloc(); softc->disk->d_devstat = devstat_new_entry(periph->periph_name, Modified: stable/9/sys/cam/cam.c ============================================================================== --- stable/9/sys/cam/cam.c Mon Jun 3 14:36:28 2013 (r251300) +++ stable/9/sys/cam/cam.c Mon Jun 3 15:48:25 2013 (r251301) @@ -110,6 +110,15 @@ const int num_cam_status_entries = #ifdef _KERNEL SYSCTL_NODE(_kern, OID_AUTO, cam, CTLFLAG_RD, 0, "CAM Subsystem"); + +#ifndef CAM_DEFAULT_SORT_IO_QUEUES +#define CAM_DEFAULT_SORT_IO_QUEUES 1 +#endif + +int cam_sort_io_queues = CAM_DEFAULT_SORT_IO_QUEUES; +TUNABLE_INT("kern.cam.sort_io_queues", &cam_sort_io_queues); +SYSCTL_INT(_kern_cam, OID_AUTO, sort_io_queues, CTLFLAG_RWTUN, + &cam_sort_io_queues, 0, "Sort IO queues to try and optimise disk access patterns"); #endif void Modified: stable/9/sys/cam/cam.h ============================================================================== --- stable/9/sys/cam/cam.h Mon Jun 3 14:36:28 2013 (r251300) +++ stable/9/sys/cam/cam.h Mon Jun 3 15:48:25 2013 (r251301) @@ -228,6 +228,9 @@ struct cam_status_entry extern const struct cam_status_entry cam_status_table[]; extern const int num_cam_status_entries; +#ifdef _KERNEL +extern int cam_sort_io_queues; +#endif union ccb; #ifdef SYSCTL_DECL /* from sysctl.h */ Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Mon Jun 3 14:36:28 2013 (r251300) +++ stable/9/sys/cam/scsi/scsi_da.c Mon Jun 3 15:48:25 2013 (r251301) @@ -145,6 +145,7 @@ struct da_softc { da_state state; da_flags flags; da_quirks quirks; + int sort_io_queue; int minimum_cmd_size; int error_inject; int ordered_tag_count; @@ -903,6 +904,8 @@ static timeout_t damediapoll; #define DA_DEFAULT_SEND_ORDERED 1 #endif +#define DA_SIO (softc->sort_io_queue >= 0 ? \ + softc->sort_io_queue : cam_sort_io_queues) static int da_poll_period = DA_DEFAULT_POLL_PERIOD; static int da_retry_count = DA_DEFAULT_RETRY; @@ -1129,10 +1132,15 @@ dastrategy(struct bio *bp) if (bp->bio_cmd == BIO_DELETE) { if (bp->bio_bcount == 0) biodone(bp); - else + else if (DA_SIO) bioq_disksort(&softc->delete_queue, bp); - } else + else + bioq_insert_tail(&softc->delete_queue, bp); + } else if (DA_SIO) { bioq_disksort(&softc->bio_queue, bp); + } else { + bioq_insert_tail(&softc->bio_queue, bp); + } /* * Schedule ourselves for performing the work. @@ -1487,6 +1495,9 @@ dasysctlinit(void *context, int pending) OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW, &softc->minimum_cmd_size, 0, dacmdsizesysctl, "I", "Minimum CDB size"); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "sort_io_queue", CTLFLAG_RW, &softc->sort_io_queue, 0, + "Sort IO queue to try and optimise disk access patterns"); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), @@ -1634,6 +1645,7 @@ daregister(struct cam_periph *periph, vo softc->flags |= DA_FLAG_PACK_REMOVABLE; softc->unmap_max_ranges = UNMAP_MAX_RANGES; softc->unmap_max_lba = 1024*1024*2; + softc->sort_io_queue = -1; periph->softc = softc; @@ -2109,9 +2121,16 @@ cmd6workaround(union ccb *ccb) dadeletemethodset(softc, DA_DELETE_DISABLE); } else dadeletemethodset(softc, DA_DELETE_DISABLE); - while ((bp = bioq_takefirst(&softc->delete_run_queue)) - != NULL) - bioq_disksort(&softc->delete_queue, bp); + + if (DA_SIO) { + while ((bp = bioq_takefirst(&softc->delete_run_queue)) + != NULL) + bioq_disksort(&softc->delete_queue, bp); + } else { + while ((bp = bioq_takefirst(&softc->delete_run_queue)) + != NULL) + bioq_insert_tail(&softc->delete_queue, bp); + } bioq_insert_tail(&softc->delete_queue, (struct bio *)ccb->ccb_h.ccb_bp); ccb->ccb_h.ccb_bp = NULL; From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 16:05:35 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6DE76522; Mon, 3 Jun 2013 16:05:35 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 500C3176F; Mon, 3 Jun 2013 16:05:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53G5Zhj058088; Mon, 3 Jun 2013 16:05:35 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53G5YWZ058086; Mon, 3 Jun 2013 16:05:34 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306031605.r53G5YWZ058086@svn.freebsd.org> From: Steven Hartland Date: Mon, 3 Jun 2013 16:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251302 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 16:05:35 -0000 Author: smh Date: Mon Jun 3 16:05:34 2013 New Revision: 251302 URL: http://svnweb.freebsd.org/changeset/base/251302 Log: MFC r248992: Added ATA Pass-Through support to CAM Modified: stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Mon Jun 3 15:48:25 2013 (r251301) +++ stable/9/sys/cam/scsi/scsi_all.c Mon Jun 3 16:05:34 2013 (r251302) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifndef _KERNEL #include @@ -5847,6 +5848,50 @@ scsi_write_same(struct ccb_scsiio *csio, } void +scsi_ata_pass_16(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int32_t flags, u_int8_t tag_action, + u_int8_t protocol, u_int8_t ata_flags, u_int16_t features, + u_int16_t sector_count, uint64_t lba, u_int8_t command, + u_int8_t control, u_int8_t *data_ptr, u_int16_t dxfer_len, + u_int8_t sense_len, u_int32_t timeout) +{ + struct ata_pass_16 *ata_cmd; + + ata_cmd = (struct ata_pass_16 *)&csio->cdb_io.cdb_bytes; + ata_cmd->opcode = ATA_PASS_16; + ata_cmd->protocol = protocol; + ata_cmd->flags = ata_flags; + ata_cmd->features_ext = features >> 8; + ata_cmd->features = features; + ata_cmd->sector_count_ext = sector_count >> 8; + ata_cmd->sector_count = sector_count; + ata_cmd->lba_low = lba; + ata_cmd->lba_mid = lba >> 8; + ata_cmd->lba_high = lba >> 16; + ata_cmd->device = ATA_DEV_LBA; + if (protocol & AP_EXTEND) { + ata_cmd->lba_low_ext = lba >> 24; + ata_cmd->lba_mid_ext = lba >> 32; + ata_cmd->lba_high_ext = lba >> 40; + } else + ata_cmd->device |= (lba >> 24) & 0x0f; + ata_cmd->command = command; + ata_cmd->control = control; + + cam_fill_csio(csio, + retries, + cbfcnp, + flags, + tag_action, + data_ptr, + dxfer_len, + sense_len, + sizeof(*ata_cmd), + timeout); +} + +void scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int8_t byte2, Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Mon Jun 3 15:48:25 2013 (r251301) +++ stable/9/sys/cam/scsi/scsi_all.h Mon Jun 3 16:05:34 2013 (r251302) @@ -908,6 +908,19 @@ struct scsi_start_stop_unit struct ata_pass_12 { u_int8_t opcode; u_int8_t protocol; +#define AP_PROTO_HARD_RESET (0x00 << 1) +#define AP_PROTO_SRST (0x01 << 1) +#define AP_PROTO_NON_DATA (0x03 << 1) +#define AP_PROTO_PIO_IN (0x04 << 1) +#define AP_PROTO_PIO_OUT (0x05 << 1) +#define AP_PROTO_DMA (0x06 << 1) +#define AP_PROTO_DMA_QUEUED (0x07 << 1) +#define AP_PROTO_DEVICE_DIAG (0x08 << 1) +#define AP_PROTO_DEVICE_RESET (0x09 << 1) +#define AP_PROTO_UDMA_IN (0x10 << 1) +#define AP_PROTO_UDMA_OUT (0x11 << 1) +#define AP_PROTO_FPDMA (0x12 << 1) +#define AP_PROTO_RESP_INFO (0x15 << 1) #define AP_MULTI 0xe0 u_int8_t flags; #define AP_T_LEN 0x03 @@ -943,6 +956,15 @@ struct ata_pass_16 { u_int8_t protocol; #define AP_EXTEND 0x01 u_int8_t flags; +#define AP_FLAG_TLEN_NO_DATA (0 << 0) +#define AP_FLAG_TLEN_FEAT (1 << 0) +#define AP_FLAG_TLEN_SECT_CNT (2 << 0) +#define AP_FLAG_TLEN_STPSIU (3 << 0) +#define AP_FLAG_BYT_BLOK_BYTES (0 << 2) +#define AP_FLAG_BYT_BLOK_BLOCKS (1 << 2) +#define AP_FLAG_TDIR_TO_DEV (0 << 3) +#define AP_FLAG_TDIR_FROM_DEV (1 << 3) +#define AP_FLAG_CHK_COND (1 << 5) u_int8_t features_ext; u_int8_t features; u_int8_t sector_count_ext; @@ -1064,7 +1086,7 @@ struct ata_pass_16 { /* * This length is the initial inquiry length used by the probe code, as - * well as the legnth necessary for scsi_print_inquiry() to function + * well as the length necessary for scsi_print_inquiry() to function * correctly. If either use requires a different length in the future, * the two values should be de-coupled. */ @@ -2370,6 +2392,14 @@ void scsi_write_same(struct ccb_scsiio * u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); +void scsi_ata_pass_16(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int32_t flags, u_int8_t tag_action, + u_int8_t protocol, u_int8_t ata_flags, u_int16_t features, + u_int16_t sector_count, uint64_t lba, u_int8_t command, + u_int8_t control, u_int8_t *data_ptr, u_int16_t dxfer_len, + u_int8_t sense_len, u_int32_t timeout); + void scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int8_t byte2, From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 16:09:24 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2719D832; Mon, 3 Jun 2013 16:09:24 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 18F5317B0; Mon, 3 Jun 2013 16:09:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53G9NTi058993; Mon, 3 Jun 2013 16:09:23 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53G9NNO058992; Mon, 3 Jun 2013 16:09:23 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201306031609.r53G9NNO058992@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 3 Jun 2013 16:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251303 - stable/9/sys/geom X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 16:09:24 -0000 Author: jh Date: Mon Jun 3 16:09:23 2013 New Revision: 251303 URL: http://svnweb.freebsd.org/changeset/base/251303 Log: MFC r250868: Remove an extra semicolon from the DOT language output. PR: kern/178540 Modified: stable/9/sys/geom/geom_dump.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/geom_dump.c ============================================================================== --- stable/9/sys/geom/geom_dump.c Mon Jun 3 16:05:34 2013 (r251302) +++ stable/9/sys/geom/geom_dump.c Mon Jun 3 16:09:23 2013 (r251303) @@ -104,7 +104,7 @@ g_confdot(void *p, int flag ) sbuf_printf(sb, "digraph geom {\n"); LIST_FOREACH(mp, &g_classes, class) g_confdot_class(sb, mp); - sbuf_printf(sb, "};\n"); + sbuf_printf(sb, "}\n"); sbuf_finish(sb); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 16:10:31 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 506519C1; Mon, 3 Jun 2013 16:10:31 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4297C17C5; Mon, 3 Jun 2013 16:10:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53GAVAK059506; Mon, 3 Jun 2013 16:10:31 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53GAVNv059504; Mon, 3 Jun 2013 16:10:31 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201306031610.r53GAVNv059504@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 3 Jun 2013 16:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251304 - stable/8/sys/geom X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 16:10:31 -0000 Author: jh Date: Mon Jun 3 16:10:30 2013 New Revision: 251304 URL: http://svnweb.freebsd.org/changeset/base/251304 Log: MFC r250868: Remove an extra semicolon from the DOT language output. PR: kern/178540 Modified: stable/8/sys/geom/geom_dump.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/geom/ (props changed) Modified: stable/8/sys/geom/geom_dump.c ============================================================================== --- stable/8/sys/geom/geom_dump.c Mon Jun 3 16:09:23 2013 (r251303) +++ stable/8/sys/geom/geom_dump.c Mon Jun 3 16:10:30 2013 (r251304) @@ -104,7 +104,7 @@ g_confdot(void *p, int flag ) sbuf_printf(sb, "digraph geom {\n"); LIST_FOREACH(mp, &g_classes, class) g_confdot_class(sb, mp); - sbuf_printf(sb, "};\n"); + sbuf_printf(sb, "}\n"); sbuf_finish(sb); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 16:14:25 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2C7EDC9C; Mon, 3 Jun 2013 16:14:25 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1DED017F4; Mon, 3 Jun 2013 16:14:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53GEO2V061912; Mon, 3 Jun 2013 16:14:25 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53GEORQ061911; Mon, 3 Jun 2013 16:14:24 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306031614.r53GEORQ061911@svn.freebsd.org> From: Steven Hartland Date: Mon, 3 Jun 2013 16:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251305 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 16:14:25 -0000 Author: smh Date: Mon Jun 3 16:14:24 2013 New Revision: 251305 URL: http://svnweb.freebsd.org/changeset/base/251305 Log: MFC r249929: Removed unneeded tests in dadeletemethodset Modified: stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Mon Jun 3 16:10:30 2013 (r251304) +++ stable/9/sys/cam/scsi/scsi_da.c Mon Jun 3 16:14:24 2013 (r251305) @@ -868,7 +868,7 @@ static void daasync(void *callback_arg, static void dasysctlinit(void *context, int pending); static int dacmdsizesysctl(SYSCTL_HANDLER_ARGS); static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS); -static int dadeletemethodset(struct da_softc *softc, +static void dadeletemethodset(struct da_softc *softc, da_delete_methods delete_method); static periph_ctor_t daregister; static periph_dtor_t dacleanup; @@ -1568,12 +1568,10 @@ dacmdsizesysctl(SYSCTL_HANDLER_ARGS) return (0); } -static int +static void dadeletemethodset(struct da_softc *softc, da_delete_methods delete_method) { - if (delete_method < 0 || delete_method > DA_DELETE_MAX) - return (EINVAL); softc->delete_method = delete_method; @@ -1581,8 +1579,6 @@ dadeletemethodset(struct da_softc *softc softc->disk->d_flags |= DISKFLAG_CANDELETE; else softc->disk->d_flags &= ~DISKFLAG_CANDELETE; - - return (0); } static int @@ -1607,7 +1603,8 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS for (i = 0; i <= DA_DELETE_MAX; i++) { if (strcmp(buf, da_delete_method_names[i]) != 0) continue; - return dadeletemethodset(softc, i); + dadeletemethodset(softc, i); + return (0); } return (EINVAL); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 16:22:20 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 69DCFEB2; Mon, 3 Jun 2013 16:22:20 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 424741845; Mon, 3 Jun 2013 16:22:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53GMJwu065393; Mon, 3 Jun 2013 16:22:19 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53GMJQt065392; Mon, 3 Jun 2013 16:22:19 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306031622.r53GMJQt065392@svn.freebsd.org> From: Steven Hartland Date: Mon, 3 Jun 2013 16:22:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251306 - stable/9/sys/geom X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 16:22:20 -0000 Author: smh Date: Mon Jun 3 16:22:19 2013 New Revision: 251306 URL: http://svnweb.freebsd.org/changeset/base/251306 Log: MFC r249930: Added a sysctl to control the maximum size of a delete request Modified: stable/9/sys/geom/geom_dev.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/geom_dev.c ============================================================================== --- stable/9/sys/geom/geom_dev.c Mon Jun 3 16:14:24 2013 (r251305) +++ stable/9/sys/geom/geom_dev.c Mon Jun 3 16:22:19 2013 (r251306) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -93,6 +94,19 @@ static struct g_class g_dev_class = { .attrchanged = g_dev_attrchanged }; +/* + * We target 262144 (8 x 32768) sectors by default as this significantly + * increases the throughput on commonly used SSD's with a marginal + * increase in non-interruptible request latency. + */ +static uint64_t g_dev_del_max_sectors = 262144; +SYSCTL_DECL(_kern_geom); +SYSCTL_NODE(_kern_geom, OID_AUTO, dev, CTLFLAG_RW, 0, "GEOM_DEV stuff"); +SYSCTL_QUAD(_kern_geom_dev, OID_AUTO, delete_max_sectors, CTLFLAG_RW, + &g_dev_del_max_sectors, 0, "Maximum number of sectors in a single " + "delete request sent to the provider. Larger requests are chunked " + "so they can be interrupted. (0 = disable chunking)"); + static void g_dev_destroy(void *arg, int flags __unused) { @@ -412,17 +426,20 @@ g_dev_ioctl(struct cdev *dev, u_long cmd } while (length > 0) { chunk = length; - if (chunk > 65536 * cp->provider->sectorsize) - chunk = 65536 * cp->provider->sectorsize; + if (g_dev_del_max_sectors != 0 && chunk > + g_dev_del_max_sectors * cp->provider->sectorsize) { + chunk = g_dev_del_max_sectors * + cp->provider->sectorsize; + } error = g_delete_data(cp, offset, chunk); length -= chunk; offset += chunk; if (error) break; /* - * Since the request size is unbounded, the service - * time is likewise. We make this ioctl interruptible - * by checking for signals for each bio. + * Since the request size can be large, the service + * time can be is likewise. We make this ioctl + * interruptible by checking for signals for each bio. */ if (SIGPENDING(td)) break; From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 16:46:38 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 249286F5; Mon, 3 Jun 2013 16:46:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 16D8C19BF; Mon, 3 Jun 2013 16:46:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53GkbD3074212; Mon, 3 Jun 2013 16:46:37 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53GkbA0074211; Mon, 3 Jun 2013 16:46:37 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201306031646.r53GkbA0074211@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 3 Jun 2013 16:46:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251307 - stable/9/usr.sbin/acpi/acpidump X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 16:46:38 -0000 Author: jkim Date: Mon Jun 3 16:46:37 2013 New Revision: 251307 URL: http://svnweb.freebsd.org/changeset/base/251307 Log: MFC: r251186 Fix a long standing logic bug introduced in r167814. The code was added to get RSDP from loader(8) hint via kenv(2) but the bug nullified the new code and we always fell back to the previous method, i. e., sysctlbyname(3). Modified: stable/9/usr.sbin/acpi/acpidump/acpi_user.c Directory Properties: stable/9/usr.sbin/acpi/acpidump/ (props changed) Modified: stable/9/usr.sbin/acpi/acpidump/acpi_user.c ============================================================================== --- stable/9/usr.sbin/acpi/acpidump/acpi_user.c Mon Jun 3 16:22:19 2013 (r251306) +++ stable/9/usr.sbin/acpi/acpidump/acpi_user.c Mon Jun 3 16:46:37 2013 (r251307) @@ -172,7 +172,7 @@ acpi_find_rsd_ptr(void) addr = 0; /* Attempt to use kenv or sysctl to find RSD PTR record. */ - if (kenv(KENV_GET, hint_acpi_0_rsdp, buf, 20) == 0) + if (kenv(KENV_GET, hint_acpi_0_rsdp, buf, 20) > 0) addr = strtoul(buf, NULL, 0); if (addr == 0) { len = sizeof(addr); From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 16:47:47 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 841D7943; Mon, 3 Jun 2013 16:47:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 74DA019CA; Mon, 3 Jun 2013 16:47:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53GllRx074537; Mon, 3 Jun 2013 16:47:47 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53GllMR074536; Mon, 3 Jun 2013 16:47:47 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201306031647.r53GllMR074536@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 3 Jun 2013 16:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251308 - stable/8/usr.sbin/acpi/acpidump X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 16:47:47 -0000 Author: jkim Date: Mon Jun 3 16:47:46 2013 New Revision: 251308 URL: http://svnweb.freebsd.org/changeset/base/251308 Log: MFC: r251186 Fix a long standing logic bug introduced in r167814. The code was added to get RSDP from loader(8) hint via kenv(2) but the bug nullified the new code and we always fell back to the previous method, i. e., sysctlbyname(3). Modified: stable/8/usr.sbin/acpi/acpidump/acpi_user.c Directory Properties: stable/8/usr.sbin/acpi/acpidump/ (props changed) Modified: stable/8/usr.sbin/acpi/acpidump/acpi_user.c ============================================================================== --- stable/8/usr.sbin/acpi/acpidump/acpi_user.c Mon Jun 3 16:46:37 2013 (r251307) +++ stable/8/usr.sbin/acpi/acpidump/acpi_user.c Mon Jun 3 16:47:46 2013 (r251308) @@ -172,7 +172,7 @@ acpi_find_rsd_ptr(void) addr = 0; /* Attempt to use kenv or sysctl to find RSD PTR record. */ - if (kenv(KENV_GET, hint_acpi_0_rsdp, buf, 20) == 0) + if (kenv(KENV_GET, hint_acpi_0_rsdp, buf, 20) > 0) addr = strtoul(buf, NULL, 0); if (addr == 0) { len = sizeof(addr); From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 16:48:24 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E424CAB1; Mon, 3 Jun 2013 16:48:24 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id 871BB19CF; Mon, 3 Jun 2013 16:48:13 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.5/8.14.5) with ESMTP id r53Gm7pT078043; Mon, 3 Jun 2013 11:48:07 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.5/8.14.5/Submit) id r53Gm7AM078042; Mon, 3 Jun 2013 11:48:07 -0500 (CDT) (envelope-from brooks) Date: Mon, 3 Jun 2013 11:48:07 -0500 From: Brooks Davis To: Maxim Sobolev Subject: Re: svn: stable/9: . usr.bin/xinstall Message-ID: <20130603164807.GA77693@lor.one-eyed-alien.net> References: <201303151519.r2FFJYjS060493@svn.freebsd.org> <51AA52FD.9090303@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline In-Reply-To: <51AA52FD.9090303@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, Brooks Davis , src-committers@FreeBSD.org, svn-src-stable-9@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 16:48:25 -0000 --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 01, 2013 at 01:01:01PM -0700, Maxim Sobolev wrote: > Hmm, I believe this breaks build for me. Any ideas why? Presumably you are building in some less common way since this change has been working for months. What command line resulted in this error? Is this tree fully up to date? Do you have anything in src.conf or make.conf? From the error, it looks like you haven't bootstrapped a new libc properly. -- Brooks > =3D=3D=3D> usr.bin/xinstall (all) > cc -O2 -pipe -I/usr/src/usr.bin/xinstall/../../contrib/mtree=20 > -I/usr/src/usr.bin/xinstall/../../lib/libnetbsd=20 > -I/usr/src/usr.bin/xinstall/../../lib/libmd -std=3Dgnu99 -fstack-protecto= r=20 > -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter= =20 > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type=20 > -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter=20 > -Wcast-align -Wchar-subscripts -Winline -Wnested-externs=20 > -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c=20 > /usr/src/usr.bin/xinstall/xinstall.c > cc1: warnings being treated as errors > /usr/src/usr.bin/xinstall/xinstall.c: In function 'metadata_log': > /usr/src/usr.bin/xinstall/xinstall.c:1331: warning: implicit declaration= =20 > of function 'strsvis' > /usr/src/usr.bin/xinstall/xinstall.c:1331: warning: nested extern=20 > declaration of 'strsvis' > *** [xinstall.o] Error code 1 >=20 > Stop in /usr/src/usr.bin/xinstall. > *** [all] Error code 1 >=20 > uname -a > FreeBSD dal09 9.1-RELEASE FreeBSD 9.1-RELEASE #2: Thu Dec 27 09:39:03=20 > UTC 2012 root@pioneer:/usr/obj/usr/src91/sys/SSP-PRODUCTION9_X64 amd= 64 >=20 >=20 >=20 > On 3/15/2013 8:19 AM, Brooks Davis wrote: > > Author: brooks > > Date: Fri Mar 15 15:19:33 2013 > > New Revision: 248331 > > URL: http://svnweb.freebsd.org/changeset/base/248331 > > > > Log: > > MFC all changes to install(1) through r246784. Notable functional > > changes are: > > > > r245617: > > Introduce six new options from NetBSD: > > * -M Log metadata in mtree format. > > * -D Log paths relative to . > > * -h Log digest of type . > > * -T Specify which mtree tags to log. > > * -l Create hard or symbolic links (allows logging). > > * -U Install without root privileges (owner, group, mod= e, > > and flags can be logged via -M > > > > NOTE: In the interest of compatibility with NetBSD and because it is= the > > obvious letter, the nearly useless -M option (disable mmap) has been > > repurposed. > > > > Sponsored by: DARPA, AFRL > > Obtained from: NetBSD > > Reviewed by: bz > > > > r245312: > > Implement the -N option which allows an alternate passwd and > > group file to be used. This is useful for installing on systems whe= re > > a user or group does not currently exist. > > > > Sponsored by: DARPA, AFRL > > Obtained from: NetBSD > > > > Modified: > > stable/9/UPDATING (contents, props changed) > > stable/9/usr.bin/xinstall/Makefile > > stable/9/usr.bin/xinstall/install.1 > > stable/9/usr.bin/xinstall/xinstall.c > > Directory Properties: > > stable/9/usr.bin/xinstall/ (props changed) > > > > Modified: stable/9/UPDATING > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- stable/9/UPDATING Fri Mar 15 14:53:29 2013 (r248330) > > +++ stable/9/UPDATING Fri Mar 15 15:19:33 2013 (r248331) > > @@ -11,6 +11,15 @@ handbook: > > Items affecting the ports and packages system can be found in > > /usr/ports/UPDATING. Please read that file before running portupgrad= e. > > > > +20130315: > > + The install(1) option -M has changed meaning and now takes an > > + argument that is a file or path to append logs to. In the > > + unlikely event that -M was the last option on the command line > > + and the command line contained at least two files and a target > > + directory the first file will have logs appended to it. The -M > > + option served little practical purpose in the last decade so it's > > + used expected to be extremely rare. > > + > > 20130225: > > A new compression method (lz4) has been merged to. Please refer to > > zpool-features(7) for more information. > > > > Modified: stable/9/usr.bin/xinstall/Makefile > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- stable/9/usr.bin/xinstall/Makefile Fri Mar 15 14:53:29 2013 (r24833= 0) > > +++ stable/9/usr.bin/xinstall/Makefile Fri Mar 15 15:19:33 2013 (r24833= 1) > > @@ -3,6 +3,16 @@ > > > > PROG=3D xinstall > > PROGNAME=3D install > > +SRCS=3D xinstall.c getid.c > > MAN=3D install.1 > > > > +.PATH: ${.CURDIR}/../../contrib/mtree > > +.PATH: ${.CURDIR}/../../lib/libmd > > +CFLAGS+=3D -I${.CURDIR}/../../contrib/mtree > > +CFLAGS+=3D -I${.CURDIR}/../../lib/libnetbsd > > +CFLAGS+=3D -I${.CURDIR}/../../lib/libmd > > + > > +DPADD+=3D ${LIBMD} > > +LDADD+=3D -lmd > > + > > .include > > > > Modified: stable/9/usr.bin/xinstall/install.1 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- stable/9/usr.bin/xinstall/install.1 Fri Mar 15 14:53:29 2013 (r2483= 30) > > +++ stable/9/usr.bin/xinstall/install.1 Fri Mar 15 15:19:33 2013 (r2483= 31) > > @@ -28,7 +28,7 @@ > > .\" From: @(#)install.1 8.1 (Berkeley) 6/6/93 > > .\" $FreeBSD$ > > .\" > > -.Dd March 6, 2006 > > +.Dd January 18, 2013 > > .Dt INSTALL 1 > > .Os > > .Sh NAME > > @@ -36,31 +36,50 @@ > > .Nd install binaries > > .Sh SYNOPSIS > > .Nm > > -.Op Fl bCcMpSsv > > +.Op Fl bCcpSsUv > > .Op Fl B Ar suffix > > +.Op Fl D Ar destdir > > .Op Fl f Ar flags > > .Op Fl g Ar group > > +.Op Fl h Ar hash > > +.Op Fl l Ar linkflags > > +.Op Fl M Ar metalog > > .Op Fl m Ar mode > > +.Op Fl N Ar dbdir > > .Op Fl o Ar owner > > +.Op Fl T Ar tags > > .Ar file1 file2 > > .Nm > > -.Op Fl bCcMpSsv > > +.Op Fl bCcpSsUv > > .Op Fl B Ar suffix > > +.Op Fl D Ar destdir > > .Op Fl f Ar flags > > .Op Fl g Ar group > > +.Op Fl h Ar hash > > +.Op Fl l Ar linkflags > > +.Op Fl M Ar metalog > > .Op Fl m Ar mode > > +.Op Fl N Ar dbdir > > .Op Fl o Ar owner > > +.Op Fl T Ar tags > > .Ar file1 ... fileN directory > > .Nm > > .Fl d > > -.Op Fl v > > +.Op Fl Uv > > +.Op Fl D Ar destdir > > .Op Fl g Ar group > > +.Op Fl h Ar hash > > +.Op Fl M Ar metalog > > .Op Fl m Ar mode > > +.Op Fl N Ar dbdir > > .Op Fl o Ar owner > > +.Op Fl T Ar tags > > .Ar directory ... > > .Sh DESCRIPTION > > The file(s) are copied > > -to the target file or directory. > > +(or linked if the > > +.Fl l > > +option is specified) to the target file or directory. > > If the destination is a directory, then the > > .Ar file > > is copied into > > @@ -105,6 +124,17 @@ This is actually the default. > > The > > .Fl c > > option is only included for backwards compatibility. > > +.It Fl D Ar destdir > > +Specify the > > +.Ev DESTDIR > > +(top of the file hierarchy) that the items are installed in to. > > +If > > +.Fl M Ar metalog > > +is in use, a leading string of > > +.Dq Ar destdir > > +will be removed from the file names logged to the > > +.Ar metalog . > > +This option does not affect where the actual files are installed. > > .It Fl d > > Create directories. > > Missing parent directories are created as required. > > @@ -115,15 +145,82 @@ for a list of possible flags and their m > > .It Fl g > > Specify a group. > > A numeric GID is allowed. > > -.It Fl M > > -Disable all use of > > -.Xr mmap 2 . > > +.It Fl h Ar hash > > +When copying, calculate the digest of the files with > > +.Ar hash > > +to store in the > > +.Fl M Ar metalog . > > +When > > +.Fl d > > +is given no hash is emitted. > > +Supported digests: > > +.Bl -tag -width rmd160 -offset indent > > +.It Sy none > > +No hash. > > +This is the default. > > +.It Sy md5 > > +The MD5 cryptographic message digest. > > +.It Sy rmd160 > > +The RMD-160 cryptographic message digest. > > +.It Sy sha1 > > +The SHA-1 cryptographic message digest. > > +.It Sy sha256 > > +The 256-bits > > +.Tn SHA-2 > > +cryptographic message digest of the file. > > +.It Sy sha512 > > +The 512-bits > > +.Tn SHA-2 > > +cryptographic message digest of the file. > > +.El > > +.It Fl l Ar linkflags > > +Instead of copying the file make a link to the source. > > +The type of the link is determined by the > > +.Ar linkflags > > +argument. > > +Valid > > +.Ar linkflags > > +are: > > +.Ar a > > +(absolute), > > +.Ar r > > +(relative), > > +.Ar h > > +(hard), > > +.Ar s > > +(symbolic), > > +.Ar m > > +(mixed). > > +Absolute and relative have effect only for symbolic links. > > +Mixed links > > +are hard links for files on the same filesystem, symbolic otherwise. > > +.It Fl M Ar metalog > > +Write the metadata associated with each item installed to > > +.Ar metalog > > +in an > > +.Xr mtree 8 > > +.Dq full path > > +specification line. > > +The metadata includes: the file name and file type, and depending upon > > +other options, the owner, group, file flags, modification time, and ta= gs. > > .It Fl m > > Specify an alternate mode. > > The default mode is set to rwxr-xr-x (0755). > > The specified mode may be either an octal or symbolic value; see > > .Xr chmod 1 > > for a description of possible mode values. > > +.It Fl N > > +Use the user database text file > > +.Pa master.passwd > > +and group database text file > > +.Pa group > > +from > > +.Ar dbdir , > > +rather than using the results from the system's > > +.Xr getpwnam 3 > > +and > > +.Xr getgrnam 3 > > +(and related) library calls. > > .It Fl o > > Specify an owner. > > A numeric UID is allowed. > > @@ -156,6 +253,17 @@ number of systems and binary types. > > See below for how > > .Nm > > can be instructed to use another program to strip binaries. > > +.It Fl T Ar tags > > +Specify the > > +.Xr mtree 8 > > +tags to write out for the file when using > > +.Fl M Ar metalog . > > +.It Fl U > > +Indicate that install is running unprivileged, and that it should not > > +try to change the owner, the group, or the file flags of the destinati= on. > > +The information that would have been updated can be stored in a log > > +file with > > +.Fl M Ar metalog . > > .It Fl v > > Cause > > .Nm > > @@ -231,6 +339,8 @@ The default was changed to copy in > > .Xr mv 1 , > > .Xr strip 1 , > > .Xr mmap 2 , > > +.Xr getgrnam 3 , > > +.Xr getpwnam 3 , > > .Xr chown 8 > > .Sh HISTORY > > The > > @@ -238,6 +348,16 @@ The > > utility appeared in > > .Bx 4.2 . > > .Sh BUGS > > +The meaning of the > > +.Fl M > > +option has changed as of > > +.Fx 10 > > +and it now takes an argument. > > +Command lines that used the old > > +.Fl M > > +will get an error or in rare cases will append logs to the first of > > +multiple source files rather than installing it. > > +.Pp > > Temporary files may be left in the target directory if > > .Nm > > exits abnormally. > > > > Modified: stable/9/usr.bin/xinstall/xinstall.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- stable/9/usr.bin/xinstall/xinstall.c Fri Mar 15 14:53:29 2013 (r248= 330) > > +++ stable/9/usr.bin/xinstall/xinstall.c Fri Mar 15 15:19:33 2013 (r248= 331) > > @@ -1,4 +1,5 @@ > > /* > > + * Copyright (c) 2012, 2013 SRI International > > * Copyright (c) 1987, 1993 > > * The Regents of the University of California. All rights reserved. > > * > > @@ -53,14 +54,23 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > +#include > > +#include > > +#include > > +#include > > #include > > #include > > #include > > #include > > #include > > #include > > +#include > > + > > +#include "mtree.h" > > > > /* Bootstrap aid - this doesn't exist in most older releases */ > > #ifndef MAP_FAILED > > @@ -69,26 +79,63 @@ __FBSDID("$FreeBSD$"); > > > > #define MAX_CMP_SIZE (16 * 1024 * 1024) > > > > +#define LN_ABSOLUTE 0x01 > > +#define LN_RELATIVE 0x02 > > +#define LN_HARD 0x04 > > +#define LN_SYMBOLIC 0x08 > > +#define LN_MIXED 0x10 > > + > > #define DIRECTORY 0x01 /* Tell install it's a directory. */ > > #define SETFLAGS 0x02 /* Tell install to set flags. */ > > #define NOCHANGEBITS (UF_IMMUTABLE | UF_APPEND | SF_IMMUTABLE | SF_AP= PEND) > > #define BACKUP_SUFFIX ".old" > > > > -struct passwd *pp; > > -struct group *gp; > > -gid_t gid; > > -uid_t uid; > > -int dobackup, docompare, dodir, dopreserve, dostrip, nommap, safecopy,= verbose; > > -mode_t mode =3D S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; > > -const char *suffix =3D BACKUP_SUFFIX; > > - > > -static int compare(int, const char *, size_t, int, const char *, size_= t); > > -static void copy(int, const char *, int, const char *, off_t); > > +typedef union { > > + MD5_CTX MD5; > > + RIPEMD160_CTX RIPEMD160; > > + SHA1_CTX SHA1; > > + SHA256_CTX SHA256; > > + SHA512_CTX SHA512; > > +} DIGEST_CTX; > > + > > +static enum { > > + DIGEST_NONE =3D 0, > > + DIGEST_MD5, > > + DIGEST_RIPEMD160, > > + DIGEST_SHA1, > > + DIGEST_SHA256, > > + DIGEST_SHA512, > > +} digesttype =3D DIGEST_NONE; > > + > > +static gid_t gid; > > +static uid_t uid; > > +static int dobackup, docompare, dodir, dolink, dopreserve, dostrip, do= unpriv, > > + safecopy, verbose; > > +static int haveopt_f, haveopt_g, haveopt_m, haveopt_o; > > +static mode_t mode =3D S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; > > +static FILE *metafp; > > +static const char *group, *owner; > > +static const char *suffix =3D BACKUP_SUFFIX; > > +static char *destdir, *digest, *fflags, *metafile, *tags; > > + > > +static int compare(int, const char *, size_t, int, const char *, size_= t, > > + char **); > > +static char *copy(int, const char *, int, const char *, off_t); > > static int create_newfile(const char *, int, struct stat *); > > static int create_tempfile(const char *, char *, size_t); > > +static char *quiet_mktemp(char *template); > > +static char *digest_file(const char *); > > +static void digest_init(DIGEST_CTX *); > > +static void digest_update(DIGEST_CTX *, const unsigned char *, size_t); > > +static char *digest_end(DIGEST_CTX *, char *); > > +static int do_link(const char *, const char *, const struct stat *); > > +static void do_symlink(const char *, const char *, const struct stat *= ); > > +static void makelink(const char *, const char *, const struct stat *); > > static void install(const char *, const char *, u_long, u_int); > > static void install_dir(char *); > > -static u_long numeric_id(const char *, const char *); > > +static void metadata_log(const char *, const char *, struct timeval *, > > + const char *, const char *, off_t); > > +static int parseid(const char *, id_t *); > > static void strip(const char *); > > static int trymmap(int); > > static void usage(void); > > @@ -101,12 +148,13 @@ main(int argc, char *argv[]) > > u_long fset; > > int ch, no_target; > > u_int iflags; > > - char *flags; > > - const char *group, *owner, *to_name; > > + char *p; > > + const char *to_name; > > > > iflags =3D 0; > > group =3D owner =3D NULL; > > - while ((ch =3D getopt(argc, argv, "B:bCcdf:g:Mm:o:pSsv")) !=3D -1) > > + while ((ch =3D getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uv"))= !=3D > > + -1) > > switch((char)ch) { > > case 'B': > > suffix =3D optarg; > > @@ -120,29 +168,69 @@ main(int argc, char *argv[]) > > case 'c': > > /* For backwards compatibility. */ > > break; > > + case 'D': > > + destdir =3D optarg; > > + break; > > case 'd': > > dodir =3D 1; > > break; > > case 'f': > > - flags =3D optarg; > > - if (strtofflags(&flags, &fset, NULL)) > > - errx(EX_USAGE, "%s: invalid flag", flags); > > - iflags |=3D SETFLAGS; > > + haveopt_f =3D 1; > > + fflags =3D optarg; > > break; > > case 'g': > > + haveopt_g =3D 1; > > group =3D optarg; > > break; > > + case 'h': > > + digest =3D optarg; > > + break; > > + case 'l': > > + for (p =3D optarg; *p !=3D '\0'; p++) > > + switch (*p) { > > + case 's': > > + dolink &=3D ~(LN_HARD|LN_MIXED); > > + dolink |=3D LN_SYMBOLIC; > > + break; > > + case 'h': > > + dolink &=3D ~(LN_SYMBOLIC|LN_MIXED); > > + dolink |=3D LN_HARD; > > + break; > > + case 'm': > > + dolink &=3D ~(LN_SYMBOLIC|LN_HARD); > > + dolink |=3D LN_MIXED; > > + break; > > + case 'a': > > + dolink &=3D ~LN_RELATIVE; > > + dolink |=3D LN_ABSOLUTE; > > + break; > > + case 'r': > > + dolink &=3D ~LN_ABSOLUTE; > > + dolink |=3D LN_RELATIVE; > > + break; > > + default: > > + errx(1, "%c: invalid link type", *p); > > + /* NOTREACHED */ > > + } > > + break; > > case 'M': > > - nommap =3D 1; > > + metafile =3D optarg; > > break; > > case 'm': > > + haveopt_m =3D 1; > > if (!(set =3D setmode(optarg))) > > errx(EX_USAGE, "invalid file mode: %s", > > optarg); > > mode =3D getmode(set, 0); > > free(set); > > break; > > + case 'N': > > + if (!setup_getid(optarg)) > > + err(EX_OSERR, "Unable to use user and group " > > + "databases in `%s'", optarg); > > + break; > > case 'o': > > + haveopt_o =3D 1; > > owner =3D optarg; > > break; > > case 'p': > > @@ -154,6 +242,12 @@ main(int argc, char *argv[]) > > case 's': > > dostrip =3D 1; > > break; > > + case 'T': > > + tags =3D optarg; > > + break; > > + case 'U': > > + dounpriv =3D 1; > > + break; > > case 'v': > > verbose =3D 1; > > break; > > @@ -179,27 +273,62 @@ main(int argc, char *argv[]) > > if (argc =3D=3D 0 || (argc =3D=3D 1 && !dodir)) > > usage(); > > > > + if (digest !=3D NULL) { > > + if (strcmp(digest, "none") =3D=3D 0) { > > + digesttype =3D DIGEST_NONE; > > + } else if (strcmp(digest, "md5") =3D=3D 0) { > > + digesttype =3D DIGEST_MD5; > > + } else if (strcmp(digest, "rmd160") =3D=3D 0) { > > + digesttype =3D DIGEST_RIPEMD160; > > + } else if (strcmp(digest, "sha1") =3D=3D 0) { > > + digesttype =3D DIGEST_SHA1; > > + } else if (strcmp(digest, "sha256") =3D=3D 0) { > > + digesttype =3D DIGEST_SHA256; > > + } else if (strcmp(digest, "sha512") =3D=3D 0) { > > + digesttype =3D DIGEST_SHA512; > > + } else { > > + warnx("unknown digest `%s'", digest); > > + usage(); > > + } > > + } > > + > > /* need to make a temp copy so we can compare stripped version */ > > if (docompare && dostrip) > > safecopy =3D 1; > > > > /* get group and owner id's */ > > - if (group !=3D NULL) { > > - if ((gp =3D getgrnam(group)) !=3D NULL) > > - gid =3D gp->gr_gid; > > - else > > - gid =3D (gid_t)numeric_id(group, "group"); > > + if (group !=3D NULL && !dounpriv) { > > + if (gid_from_group(group, &gid) =3D=3D -1) { > > + id_t id; > > + if (!parseid(group, &id)) > > + errx(1, "unknown group %s", group); > > + gid =3D id; > > + } > > } else > > gid =3D (gid_t)-1; > > > > - if (owner !=3D NULL) { > > - if ((pp =3D getpwnam(owner)) !=3D NULL) > > - uid =3D pp->pw_uid; > > - else > > - uid =3D (uid_t)numeric_id(owner, "user"); > > + if (owner !=3D NULL && !dounpriv) { > > + if (uid_from_user(owner, &uid) =3D=3D -1) { > > + id_t id; > > + if (!parseid(owner, &id)) > > + errx(1, "unknown user %s", owner); > > + uid =3D id; > > + } > > } else > > uid =3D (uid_t)-1; > > > > + if (fflags !=3D NULL && !dounpriv) { > > + if (strtofflags(&fflags, &fset, NULL)) > > + errx(EX_USAGE, "%s: invalid flag", fflags); > > + iflags |=3D SETFLAGS; > > + } > > + > > + if (metafile !=3D NULL) { > > + if ((metafp =3D fopen(metafile, "a")) =3D=3D NULL) > > + warn("open %s", metafile); > > + } else > > + digesttype =3D DIGEST_NONE; > > + > > if (dodir) { > > for (; *argv !=3D NULL; ++argv) > > install_dir(*argv); > > @@ -207,8 +336,21 @@ main(int argc, char *argv[]) > > /* NOTREACHED */ > > } > > > > - no_target =3D stat(to_name =3D argv[argc - 1], &to_sb); > > + to_name =3D argv[argc - 1]; > > + no_target =3D stat(to_name, &to_sb); > > if (!no_target && S_ISDIR(to_sb.st_mode)) { > > + if (dolink & LN_SYMBOLIC) { > > + if (lstat(to_name, &to_sb) !=3D 0) > > + err(EX_OSERR, "%s vanished", to_name); > > + if (S_ISLNK(to_sb.st_mode)) { > > + if (argc !=3D 2) { > > + errno =3D ENOTDIR; > > + err(EX_USAGE, "%s", to_name); > > + } > > + install(*argv, to_name, fset, iflags); > > + exit(EX_OK); > > + } > > + } > > for (; *argv !=3D to_name; ++argv) > > install(*argv, to_name, fset, iflags | DIRECTORY); > > exit(EX_OK); > > @@ -226,7 +368,7 @@ main(int argc, char *argv[]) > > usage(); > > } > > > > - if (!no_target) { > > + if (!no_target && !dolink) { > > if (stat(*argv, &from_sb)) > > err(EX_OSERR, "%s", *argv); > > if (!S_ISREG(to_sb.st_mode)) { > > @@ -243,23 +385,327 @@ main(int argc, char *argv[]) > > /* NOTREACHED */ > > } > > > > -static u_long > > -numeric_id(const char *name, const char *type) > > +static char * > > +digest_file(const char *name) > > +{ > > + > > + switch (digesttype) { > > + case DIGEST_MD5: > > + return (MD5File(name, NULL)); > > + case DIGEST_RIPEMD160: > > + return (RIPEMD160_File(name, NULL)); > > + case DIGEST_SHA1: > > + return (SHA1_File(name, NULL)); > > + case DIGEST_SHA256: > > + return (SHA256_File(name, NULL)); > > + case DIGEST_SHA512: > > + return (SHA512_File(name, NULL)); > > + default: > > + return (NULL); > > + } > > +} > > + > > +static void > > +digest_init(DIGEST_CTX *c) > > +{ > > + > > + switch (digesttype) { > > + case DIGEST_NONE: > > + break; > > + case DIGEST_MD5: > > + MD5Init(&(c->MD5)); > > + break; > > + case DIGEST_RIPEMD160: > > + RIPEMD160_Init(&(c->RIPEMD160)); > > + break; > > + case DIGEST_SHA1: > > + SHA1_Init(&(c->SHA1)); > > + break; > > + case DIGEST_SHA256: > > + SHA256_Init(&(c->SHA256)); > > + break; > > + case DIGEST_SHA512: > > + SHA512_Init(&(c->SHA512)); > > + break; > > + } > > +} > > + > > +static void > > +digest_update(DIGEST_CTX *c, const unsigned char *data, size_t len) > > +{ > > + > > + switch (digesttype) { > > + case DIGEST_NONE: > > + break; > > + case DIGEST_MD5: > > + MD5Update(&(c->MD5), data, len); > > + break; > > + case DIGEST_RIPEMD160: > > + RIPEMD160_Update(&(c->RIPEMD160), data, len); > > + break; > > + case DIGEST_SHA1: > > + SHA1_Update(&(c->SHA1), data, len); > > + break; > > + case DIGEST_SHA256: > > + SHA256_Update(&(c->SHA256), data, len); > > + break; > > + case DIGEST_SHA512: > > + SHA512_Update(&(c->SHA512), data, len); > > + break; > > + } > > +} > > + > > +static char * > > +digest_end(DIGEST_CTX *c, char *buf) > > +{ > > + > > + switch (digesttype) { > > + case DIGEST_MD5: > > + return (MD5End(&(c->MD5), buf)); > > + case DIGEST_RIPEMD160: > > + return (RIPEMD160_End(&(c->RIPEMD160), buf)); > > + case DIGEST_SHA1: > > + return (SHA1_End(&(c->SHA1), buf)); > > + case DIGEST_SHA256: > > + return (SHA256_End(&(c->SHA256), buf)); > > + case DIGEST_SHA512: > > + return (SHA512_End(&(c->SHA512), buf)); > > + default: > > + return (NULL); > > + } > > +} > > + > > +/* > > + * parseid -- > > + * parse uid or gid from arg into id, returning non-zero if successful > > + */ > > +static int > > +parseid(const char *name, id_t *id) > > +{ > > + char *ep; > > + errno =3D 0; > > + *id =3D (id_t)strtoul(name, &ep, 10); > > + if (errno || *ep !=3D '\0') > > + return (0); > > + return (1); > > +} > > + > > +/* > > + * quiet_mktemp -- > > + * mktemp implementation used mkstemp to avoid mktemp warnings. We > > + * really do need mktemp semantics here as we will be creating a link. > > + */ > > +static char * > > +quiet_mktemp(char *template) > > +{ > > + int fd; > > + > > + if ((fd =3D mkstemp(template)) =3D=3D -1) > > + return (NULL); > > + close (fd); > > + if (unlink(template) =3D=3D -1) > > + err(EX_OSERR, "unlink %s", template); > > + return (template); > > +} > > + > > +/* > > + * do_link -- > > + * make a hard link, obeying dorename if set > > + * return -1 on failure > > + */ > > +static int > > +do_link(const char *from_name, const char *to_name, > > + const struct stat *target_sb) > > +{ > > + char tmpl[MAXPATHLEN]; > > + int ret; > > + > > + if (safecopy && target_sb !=3D NULL) { > > + (void)snprintf(tmpl, sizeof(tmpl), "%s.inst.XXXXXX", to_name); > > + /* This usage is safe. */ > > + if (quiet_mktemp(tmpl) =3D=3D NULL) > > + err(EX_OSERR, "%s: mktemp", tmpl); > > + ret =3D link(from_name, tmpl); > > + if (ret =3D=3D 0) { > > + if (target_sb->st_mode & S_IFDIR && rmdir(to_name) =3D=3D > > + -1) { > > + unlink(tmpl); > > + err(EX_OSERR, "%s", to_name); > > + } > > + if (target_sb->st_flags & NOCHANGEBITS) > > + (void)chflags(to_name, target_sb->st_flags & > > + ~NOCHANGEBITS); > > + unlink(to_name); > > + ret =3D rename(tmpl, to_name); > > + /* > > + * If rename has posix semantics, then the temporary > > + * file may still exist when from_name and to_name point > > + * to the same file, so unlink it unconditionally. > > + */ > > + (void)unlink(tmpl); > > + } > > + return (ret); > > + } else > > + return (link(from_name, to_name)); > > +} > > + > > +/* > > + * do_symlink -- > > + * Make a symbolic link, obeying dorename if set. Exit on failure. > > + */ > > +static void > > +do_symlink(const char *from_name, const char *to_name, > > + const struct stat *target_sb) > > +{ > > + char tmpl[MAXPATHLEN]; > > + > > + if (safecopy && target_sb !=3D NULL) { > > + (void)snprintf(tmpl, sizeof(tmpl), "%s.inst.XXXXXX", to_name); > > + /* This usage is safe. */ > > + if (quiet_mktemp(tmpl) =3D=3D NULL) > > + err(EX_OSERR, "%s: mktemp", tmpl); > > + > > + if (symlink(from_name, tmpl) =3D=3D -1) > > + err(EX_OSERR, "symlink %s -> %s", from_name, tmpl); > > + > > + if (target_sb->st_mode & S_IFDIR && rmdir(to_name) =3D=3D -1) { > > + (void)unlink(tmpl); > > + err(EX_OSERR, "%s", to_name); > > + } > > + if (target_sb->st_flags & NOCHANGEBITS) > > + (void)chflags(to_name, target_sb->st_flags & > > + ~NOCHANGEBITS); > > + unlink(to_name); > > + > > + if (rename(tmpl, to_name) =3D=3D -1) { > > + /* Remove temporary link before exiting. */ > > + (void)unlink(tmpl); > > + err(EX_OSERR, "%s: rename", to_name); > > + } > > + } else { > > + if (symlink(from_name, to_name) =3D=3D -1) > > + err(EX_OSERR, "symlink %s -> %s", from_name, to_name); > > + } > > +} > > + > > +/* > > + * makelink -- > > + * make a link from source to destination > > + */ > > +static void > > +makelink(const char *from_name, const char *to_name, > > + const struct stat *target_sb) > > { > > - u_long val; > > - char *ep; > > + char src[MAXPATHLEN], dst[MAXPATHLEN], lnk[MAXPATHLEN]; > > + struct stat to_sb; > > + > > + /* Try hard links first. */ > > + if (dolink & (LN_HARD|LN_MIXED)) { > > + if (do_link(from_name, to_name, target_sb) =3D=3D -1) { > > + if ((dolink & LN_HARD) || errno !=3D EXDEV) > > + err(EX_OSERR, "link %s -> %s", from_name, to_name); > > + } else { > > + if (stat(to_name, &to_sb)) > > + err(EX_OSERR, "%s: stat", to_name); > > + if (S_ISREG(to_sb.st_mode)) { > > + /* > > + * XXX: hard links to anything other than > > + * plain files are not metalogged > > + */ > > + int omode; > > + const char *oowner, *ogroup; > > + char *offlags; > > + char *dres; > > + > > + /* > > + * XXX: use underlying perms, unless > > + * overridden on command line. > > + */ > > + omode =3D mode; > > + if (!haveopt_m) > > + mode =3D (to_sb.st_mode & 0777); > > + oowner =3D owner; > > + if (!haveopt_o) > > + owner =3D NULL; > > + ogroup =3D group; > > + if (!haveopt_g) > > + group =3D NULL; > > + offlags =3D fflags; > > + if (!haveopt_f) > > + fflags =3D NULL; > > + dres =3D digest_file(from_name); > > + metadata_log(to_name, "file", NULL, NULL, > > + dres, to_sb.st_size); > > + free(dres); > > + mode =3D omode; > > + owner =3D oowner; > > + group =3D ogroup; > > + fflags =3D offlags; > > + } > > + return; > > + } > > + } > > + > > + /* Symbolic links. */ > > + if (dolink & LN_ABSOLUTE) { > > + /* Convert source path to absolute. */ > > + if (realpath(from_name, src) =3D=3D NULL) > > + err(EX_OSERR, "%s: realpath", from_name); > > + do_symlink(src, to_name, target_sb); > > + /* XXX: src may point outside of destdir */ > > + metadata_log(to_name, "link", NULL, src, NULL, 0); > > + return; > > + } > > + > > + if (dolink & LN_RELATIVE) { > > + char *cp, *d, *s; > > + > > + /* Resolve pathnames. */ > > + if (realpath(from_name, src) =3D=3D NULL) > > + err(EX_OSERR, "%s: realpath", from_name); > > + > > + /* > > + * The last component of to_name may be a symlink, > > + * so use realpath to resolve only the directory. > > + */ > > + cp =3D dirname(to_name); > > + if (realpath(cp, dst) =3D=3D NULL) > > + err(EX_OSERR, "%s: realpath", cp); > > + /* .. and add the last component. */ > > + if (strcmp(dst, "/") !=3D 0) { > > + if (strlcat(dst, "/", sizeof(dst)) > sizeof(dst)) > > + errx(1, "resolved pathname too long"); > > + } > > + cp =3D basename(to_name); > > + if (strlcat(dst, cp, sizeof(dst)) > sizeof(dst)) > > + errx(1, "resolved pathname too long"); > > + > > + /* Trim common path components. */ > > + for (s =3D src, d =3D dst; *s =3D=3D *d; s++, d++) > > + continue; > > + while (*s !=3D '/') > > + s--, d--; > > + > > + /* Count the number of directories we need to backtrack. */ > > + for (++d, lnk[0] =3D '\0'; *d; d++) > > + if (*d =3D=3D '/') > > + (void)strlcat(lnk, "../", sizeof(lnk)); > > + > > + (void)strlcat(lnk, ++s, sizeof(lnk)); > > + > > + do_symlink(lnk, to_name, target_sb); > > + /* XXX: Link may point outside of destdir. */ > > + metadata_log(to_name, "link", NULL, lnk, NULL, 0); > > + return; > > + } > > > > /* > > - * XXX > > - * We know that uid_t's and gid_t's are unsigned longs. > > + * If absolute or relative was not specified, try the names the > > + * user provided. > > */ > > - errno =3D 0; > > - val =3D strtoul(name, &ep, 10); > > - if (errno) > > - err(EX_NOUSER, "%s", name); > > - if (*ep !=3D '\0') > > - errx(EX_NOUSER, "unknown %s %s", type, name); > > - return (val); > > + do_symlink(from_name, to_name, target_sb); > > + /* XXX: from_name may point outside of destdir. */ > > + metadata_log(to_name, "link", NULL, from_name, NULL, 0); > > } > > > > /* > > @@ -274,6 +720,7 @@ install(const char *from_name, const cha > > int devnull, files_match, from_fd, serrno, target; > > int tempcopy, temp_fd, to_fd; > > char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLE= N]; > > + char *digestresult; > > > > files_match =3D 0; > > from_fd =3D -1; > > @@ -281,11 +728,13 @@ install(const char *from_name, const cha > > > > /* If try to install NULL file to a directory, fails. */ > > if (flags & DIRECTORY || strcmp(from_name, _PATH_DEVNULL)) { > > - if (stat(from_name, &from_sb)) > > - err(EX_OSERR, "%s", from_name); > > - if (!S_ISREG(from_sb.st_mode)) { > > - errno =3D EFTYPE; > > - err(EX_OSERR, "%s", from_name); > > + if (!dolink) { > > + if (stat(from_name, &from_sb)) > > + err(EX_OSERR, "%s", from_name); > > + if (!S_ISREG(from_sb.st_mode)) { > > + errno =3D EFTYPE; > > + err(EX_OSERR, "%s", from_name); > > + } > > } > > /* Build the target path. */ > > if (flags & DIRECTORY) { > > @@ -299,7 +748,23 @@ install(const char *from_name, const cha > > devnull =3D 1; > > } > > > > - target =3D stat(to_name, &to_sb) =3D=3D 0; > > + if (!dolink) > > + target =3D (stat(to_name, &to_sb) =3D=3D 0); > > + else > > + target =3D (lstat(to_name, &to_sb) =3D=3D 0); > > + > > + if (dolink) { > > + if (target && !safecopy) { > > + if (to_sb.st_mode & S_IFDIR && rmdir(to_name) =3D=3D -1) > > + err(EX_OSERR, "%s", to_name); > > + if (to_sb.st_flags & NOCHANGEBITS) > > + (void)chflags(to_name, > > + to_sb.st_flags & ~NOCHANGEBITS); > > + unlink(to_name); > > + } > > + makelink(from_name, to_name, target ? &to_sb : NULL); > > + return; > > + } > > > > /* Only install to regular files. */ > > if (target && !S_ISREG(to_sb.st_mode)) { > > @@ -323,7 +788,7 @@ install(const char *from_name, const cha > > else > > files_match =3D !(compare(from_fd, from_name, > > (size_t)from_sb.st_size, to_fd, > > - to_name, (size_t)to_sb.st_size)); > > + to_name, (size_t)to_sb.st_size, &digestresult)); > > > > /* Close "to" file unless we match. */ > > if (!files_match) > > @@ -345,8 +810,10 @@ install(const char *from_name, const cha > > from_name, to_name); > > } > > if (!devnull) > > - copy(from_fd, from_name, to_fd, > > + digestresult =3D copy(from_fd, from_name, to_fd, > > tempcopy ? tempfile : to_name, from_sb.st_size); > > + else > > + digestresult =3D NULL; > > } > > > > if (dostrip) { > > @@ -380,7 +847,8 @@ install(const char *from_name, const cha > > } > > > > if (compare(temp_fd, tempfile, (size_t)temp_sb.st_size, to_fd, > > - to_name, (size_t)to_sb.st_size) =3D=3D 0) { > > + to_name, (size_t)to_sb.st_size, &digestresult) > > + =3D=3D 0) { > > /* > > * If target has more than one link we need to > > * replace it in order to snap the extra links. > > @@ -400,6 +868,9 @@ install(const char *from_name, const cha > > } > > } > > > > + if (dostrip && (!docompare || !target)) > > + digestresult =3D digest_file(tempfile); > > + > > /* > > > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > > > >=20 --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFRrMjHXY6L6fI4GtQRAoDqAKC7ZMEi5qJHTzg26sLui5odnxYnXQCfQtwu h9ScwoynxNU+VaAJkV32VQs= =RT1W -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn-- From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 16:50:17 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0F959C47; Mon, 3 Jun 2013 16:50:17 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 023D819E4; Mon, 3 Jun 2013 16:50:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53GoGFa076513; Mon, 3 Jun 2013 16:50:16 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53GoGPA076512; Mon, 3 Jun 2013 16:50:16 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306031650.r53GoGPA076512@svn.freebsd.org> From: Steven Hartland Date: Mon, 3 Jun 2013 16:50:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251309 - stable/9/sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 16:50:17 -0000 Author: smh Date: Mon Jun 3 16:50:16 2013 New Revision: 251309 URL: http://svnweb.freebsd.org/changeset/base/251309 Log: MFC r249931: Added Dataset Management defines to be used by TRIM Modified: stable/9/sys/sys/ata.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/sys/ata.h ============================================================================== --- stable/9/sys/sys/ata.h Mon Jun 3 16:47:46 2013 (r251308) +++ stable/9/sys/sys/ata.h Mon Jun 3 16:50:16 2013 (r251309) @@ -261,6 +261,12 @@ struct ata_params { /*255*/ u_int16_t integrity; } __packed; +/* ATA Dataset Management */ +#define ATA_DSM_BLK_SIZE 512 +#define ATA_DSM_BLK_RANGES 64 +#define ATA_DSM_RANGE_SIZE 8 +#define ATA_DSM_RANGE_MAX 65535 + /* * ATA Device Register * From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 16:54:57 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B1311163; Mon, 3 Jun 2013 16:54:57 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 945121A29; Mon, 3 Jun 2013 16:54:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53GsvIl077663; Mon, 3 Jun 2013 16:54:57 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53Gsv1B077661; Mon, 3 Jun 2013 16:54:57 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306031654.r53Gsv1B077661@svn.freebsd.org> From: Steven Hartland Date: Mon, 3 Jun 2013 16:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251310 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 16:54:57 -0000 Author: smh Date: Mon Jun 3 16:54:56 2013 New Revision: 251310 URL: http://svnweb.freebsd.org/changeset/base/251310 Log: MFC r249933: Added the ability to send ATA identify and TRIM commands via SCSI Modified: stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Mon Jun 3 16:50:16 2013 (r251309) +++ stable/9/sys/cam/scsi/scsi_all.c Mon Jun 3 16:54:56 2013 (r251310) @@ -5848,6 +5848,57 @@ scsi_write_same(struct ccb_scsiio *csio, } void +scsi_ata_identify(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t *data_ptr, + u_int16_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout) +{ + scsi_ata_pass_16(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_IN, + tag_action, + /*protocol*/AP_PROTO_PIO_IN, + /*ata_flags*/AP_FLAG_TDIR_FROM_DEV| + AP_FLAG_BYT_BLOK_BYTES|AP_FLAG_TLEN_SECT_CNT, + /*features*/0, + /*sector_count*/dxfer_len, + /*lba*/0, + /*command*/ATA_ATA_IDENTIFY, + /*control*/0, + data_ptr, + dxfer_len, + sense_len, + timeout); +} + +void +scsi_ata_trim(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int16_t block_count, + u_int8_t *data_ptr, u_int16_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout) +{ + scsi_ata_pass_16(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_OUT, + tag_action, + /*protocol*/AP_EXTEND|AP_PROTO_DMA, + /*ata_flags*/AP_FLAG_TLEN_SECT_CNT|AP_FLAG_BYT_BLOK_BLOCKS, + /*features*/ATA_DSM_TRIM, + /*sector_count*/block_count, + /*lba*/0, + /*command*/ATA_DATA_SET_MANAGEMENT, + /*control*/0, + data_ptr, + dxfer_len, + sense_len, + timeout); +} + +void scsi_ata_pass_16(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int32_t flags, u_int8_t tag_action, Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Mon Jun 3 16:50:16 2013 (r251309) +++ stable/9/sys/cam/scsi/scsi_all.h Mon Jun 3 16:54:56 2013 (r251310) @@ -1429,6 +1429,61 @@ struct scsi_diag_page { uint8_t params[0]; }; +/* + * Logical Block Provisioning VPD Page based on + * T10/1799-D Revision 31 + */ +struct scsi_vpd_logical_block_prov +{ + u_int8_t device; + u_int8_t page_code; +#define SVPD_LBP 0xB2 + u_int8_t page_length[2]; +#define SVPD_LBP_PL_BASIC 0x04 + u_int8_t threshold_exponent; + u_int8_t flags; +#define SVPD_LBP_UNMAP 0x80 +#define SVPD_LBP_WS16 0x40 +#define SVPD_LBP_WS10 0x20 +#define SVPD_LBP_RZ 0x04 +#define SVPD_LBP_ANC_SUP 0x02 +#define SVPD_LBP_DP 0x01 + u_int8_t prov_type; +#define SVPD_LBP_RESOURCE 0x01 +#define SVPD_LBP_THIN 0x02 + u_int8_t reserved; + /* + * Provisioning Group Descriptor can be here if SVPD_LBP_DP is set + * Its size can be determined from page_length - 4 + */ +}; + +/* + * Block Limits VDP Page based on + * T10/1799-D Revision 31 + */ +struct scsi_vpd_block_limits +{ + u_int8_t device; + u_int8_t page_code; +#define SVPD_BLOCK_LIMITS 0xB0 + u_int8_t page_length[2]; +#define SVPD_BL_PL_BASIC 0x10 +#define SVPD_BL_PL_TP 0x3C + u_int8_t reserved1; + u_int8_t max_cmp_write_len; + u_int8_t opt_txfer_len_grain[2]; + u_int8_t max_txfer_len[4]; + u_int8_t opt_txfer_len[4]; + u_int8_t max_prefetch[4]; + u_int8_t max_unmap_lba_cnt[4]; + u_int8_t max_unmap_blk_cnt[4]; + u_int8_t opt_unmap_grain[4]; + u_int8_t unmap_grain_align[4]; + u_int8_t max_write_same_length[8]; + u_int8_t reserved2[20]; +}; + struct scsi_read_capacity { u_int8_t opcode; @@ -2392,6 +2447,18 @@ void scsi_write_same(struct ccb_scsiio * u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); +void scsi_ata_identify(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t *data_ptr, + u_int16_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout); + +void scsi_ata_trim(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int16_t block_count, + u_int8_t *data_ptr, u_int16_t dxfer_len, + u_int8_t sense_len, u_int32_t timeout); + void scsi_ata_pass_16(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int32_t flags, u_int8_t tag_action, From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:07:34 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 865EA516; Mon, 3 Jun 2013 17:07:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 775D91AE5; Mon, 3 Jun 2013 17:07:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53H7YYJ082157; Mon, 3 Jun 2013 17:07:34 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53H7YXg082156; Mon, 3 Jun 2013 17:07:34 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306031707.r53H7YXg082156@svn.freebsd.org> From: John Baldwin Date: Mon, 3 Jun 2013 17:07:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251311 - stable/9/usr.bin/top X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:07:34 -0000 Author: jhb Date: Mon Jun 3 17:07:34 2013 New Revision: 251311 URL: http://svnweb.freebsd.org/changeset/base/251311 Log: MFC 248167: Fix the 'C' field for a running thread to match the behavior described in the manpage by having it display the current CPU (ki_oncpu) rather than the previously used CPU (ki_lastcpu). ki_lastcpu is still used for all other thread states. Modified: stable/9/usr.bin/top/machine.c Directory Properties: stable/9/usr.bin/top/ (props changed) Modified: stable/9/usr.bin/top/machine.c ============================================================================== --- stable/9/usr.bin/top/machine.c Mon Jun 3 16:54:56 2013 (r251310) +++ stable/9/usr.bin/top/machine.c Mon Jun 3 17:07:34 2013 (r251311) @@ -797,7 +797,7 @@ format_next_process(caddr_t handle, char double pct; struct handle *hp; char status[16]; - int state; + int cpu, state; struct rusage ru, *rup; long p_tot, s_tot; char *proc_fmt, thr_buf[6], jid_buf[6]; @@ -996,6 +996,13 @@ format_next_process(caddr_t handle, char } /* format this entry */ + if (smpmode) { + if (state == SRUN && pp->ki_oncpu != 0xff) + cpu = pp->ki_oncpu; + else + cpu = pp->ki_lastcpu; + } else + cpu = 0; proc_fmt = smpmode ? smp_Proc_format : up_Proc_format; if (ps.thread != 0) thr_buf[0] = '\0'; @@ -1013,7 +1020,7 @@ format_next_process(caddr_t handle, char format_k2(PROCSIZE(pp)), format_k2(pagetok(pp->ki_rssize)), status, - smpmode ? pp->ki_lastcpu : 0, + cpu, format_time(cputime), ps.wcpu ? 100.0 * weighted_cpu(pct, pp) : 100.0 * pct, screen_width > cmdlengthdelta ? screen_width - cmdlengthdelta : 0, From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:07:58 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 075E468A; Mon, 3 Jun 2013 17:07:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EDF081AED; Mon, 3 Jun 2013 17:07:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53H7vVG082275; Mon, 3 Jun 2013 17:07:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53H7v7K082274; Mon, 3 Jun 2013 17:07:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306031707.r53H7v7K082274@svn.freebsd.org> From: John Baldwin Date: Mon, 3 Jun 2013 17:07:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251312 - stable/8/usr.bin/top X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:07:58 -0000 Author: jhb Date: Mon Jun 3 17:07:57 2013 New Revision: 251312 URL: http://svnweb.freebsd.org/changeset/base/251312 Log: MFC 248167: Fix the 'C' field for a running thread to match the behavior described in the manpage by having it display the current CPU (ki_oncpu) rather than the previously used CPU (ki_lastcpu). ki_lastcpu is still used for all other thread states. Modified: stable/8/usr.bin/top/machine.c Directory Properties: stable/8/usr.bin/top/ (props changed) Modified: stable/8/usr.bin/top/machine.c ============================================================================== --- stable/8/usr.bin/top/machine.c Mon Jun 3 17:07:34 2013 (r251311) +++ stable/8/usr.bin/top/machine.c Mon Jun 3 17:07:57 2013 (r251312) @@ -796,7 +796,7 @@ format_next_process(caddr_t handle, char double pct; struct handle *hp; char status[16]; - int state; + int cpu, state; struct rusage ru, *rup; long p_tot, s_tot; char *proc_fmt, thr_buf[6], jid_buf[6]; @@ -995,6 +995,13 @@ format_next_process(caddr_t handle, char } /* format this entry */ + if (smpmode) { + if (state == SRUN && pp->ki_oncpu != 0xff) + cpu = pp->ki_oncpu; + else + cpu = pp->ki_lastcpu; + } else + cpu = 0; proc_fmt = smpmode ? smp_Proc_format : up_Proc_format; if (ps.thread != 0) thr_buf[0] = '\0'; @@ -1012,7 +1019,7 @@ format_next_process(caddr_t handle, char format_k2(PROCSIZE(pp)), format_k2(pagetok(pp->ki_rssize)), status, - smpmode ? pp->ki_lastcpu : 0, + cpu, format_time(cputime), ps.wcpu ? 100.0 * weighted_cpu(pct, pp) : 100.0 * pct, screen_width > cmdlengthdelta ? screen_width - cmdlengthdelta : 0, From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:13:38 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8FBEC973; Mon, 3 Jun 2013 17:13:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 680491B41; Mon, 3 Jun 2013 17:13:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HDcG0085290; Mon, 3 Jun 2013 17:13:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HDcTq085288; Mon, 3 Jun 2013 17:13:38 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306031713.r53HDcTq085288@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 17:13:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251313 - in stable/8/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:13:38 -0000 Author: kib Date: Mon Jun 3 17:13:37 2013 New Revision: 251313 URL: http://svnweb.freebsd.org/changeset/base/251313 Log: MFC r251033: When handling an exception from the attempt from loading the faulting context on return from the trap handler, re-enable the interrupts on i386 and amd64. Modified: stable/8/sys/amd64/amd64/exception.S stable/8/sys/i386/i386/exception.s Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) stable/8/sys/i386/ (props changed) Modified: stable/8/sys/amd64/amd64/exception.S ============================================================================== --- stable/8/sys/amd64/amd64/exception.S Mon Jun 3 17:07:57 2013 (r251312) +++ stable/8/sys/amd64/amd64/exception.S Mon Jun 3 17:13:37 2013 (r251313) @@ -818,6 +818,10 @@ doreti_iret_fault: .globl ds_load_fault ds_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movq %rsp,%rdi call trap movw $KUDSEL,TF_DS(%rsp) @@ -827,6 +831,10 @@ ds_load_fault: .globl es_load_fault es_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movq %rsp,%rdi call trap movw $KUDSEL,TF_ES(%rsp) @@ -835,6 +843,10 @@ es_load_fault: ALIGN_TEXT .globl fs_load_fault fs_load_fault: + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movl $T_PROTFLT,TF_TRAPNO(%rsp) movq %rsp,%rdi call trap @@ -846,6 +858,10 @@ fs_load_fault: gs_load_fault: popfq movl $T_PROTFLT,TF_TRAPNO(%rsp) + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movq %rsp,%rdi call trap movw $KUG32SEL,TF_GS(%rsp) @@ -855,6 +871,10 @@ gs_load_fault: .globl fsbase_load_fault fsbase_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movq %rsp,%rdi call trap movq PCPU(CURTHREAD),%r8 @@ -866,6 +886,10 @@ fsbase_load_fault: .globl gsbase_load_fault gsbase_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) + testl $PSL_I,TF_RFLAGS(%rsp) + jz 1f + sti +1: movq %rsp,%rdi call trap movq PCPU(CURTHREAD),%r8 Modified: stable/8/sys/i386/i386/exception.s ============================================================================== --- stable/8/sys/i386/i386/exception.s Mon Jun 3 17:07:57 2013 (r251312) +++ stable/8/sys/i386/i386/exception.s Mon Jun 3 17:13:37 2013 (r251313) @@ -417,6 +417,7 @@ doreti_popl_es_fault: pushl %fs .globl doreti_popl_fs_fault doreti_popl_fs_fault: + sti movl $0,TF_ERR(%esp) /* XXX should be the error code */ movl $T_PROTFLT,TF_TRAPNO(%esp) jmp alltraps_with_regs_pushed From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:17:59 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 16681B62; Mon, 3 Jun 2013 17:17:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 07FAF1B82; Mon, 3 Jun 2013 17:17:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HHxsP086209; Mon, 3 Jun 2013 17:17:59 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HHvGY086194; Mon, 3 Jun 2013 17:17:57 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201306031717.r53HHvGY086194@svn.freebsd.org> From: Ed Schouten Date: Mon, 3 Jun 2013 17:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251314 - in head: lib/libc/locale tools/regression/lib/libc/locale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:17:59 -0000 Author: ed Date: Mon Jun 3 17:17:56 2013 New Revision: 251314 URL: http://svnweb.freebsd.org/changeset/base/251314 Log: Add libiconv based versions of *c16*() and *c32*(). I initially thought wchar_t was locale independent, but this seems to be only the case on Linux. This means that we cannot depend on the *wc*() routines to implement *c16*() and *c32*(). Instead, use the Citrus libiconv that is part of libc. I'll see if there is anything I can do to make the existing functions somewhat useful in case the system is built without libiconv in the nearby future. If not, I'll simply remove the broken implementations. Reviewed by: jilles, gabor Added: head/lib/libc/locale/c16rtomb_iconv.c (contents, props changed) head/lib/libc/locale/c32rtomb_iconv.c (contents, props changed) head/lib/libc/locale/cXXrtomb_iconv.h (contents, props changed) head/lib/libc/locale/mbrtoc16_iconv.c (contents, props changed) head/lib/libc/locale/mbrtoc32_iconv.c (contents, props changed) head/lib/libc/locale/mbrtocXX_iconv.h (contents, props changed) Modified: head/lib/libc/locale/Makefile.inc head/tools/regression/lib/libc/locale/test-c16rtomb.c head/tools/regression/lib/libc/locale/test-mbrtoc16.c Modified: head/lib/libc/locale/Makefile.inc ============================================================================== --- head/lib/libc/locale/Makefile.inc Mon Jun 3 17:13:37 2013 (r251313) +++ head/lib/libc/locale/Makefile.inc Mon Jun 3 17:17:56 2013 (r251314) @@ -4,11 +4,11 @@ # locale sources .PATH: ${.CURDIR}/${LIBC_ARCH}/locale ${.CURDIR}/locale -SRCS+= ascii.c big5.c btowc.c c16rtomb.c c32rtomb.c collate.c collcmp.c euc.c \ - fix_grouping.c gb18030.c gb2312.c gbk.c ctype.c isctype.c iswctype.c \ +SRCS+= ascii.c big5.c btowc.c collate.c collcmp.c euc.c fix_grouping.c \ + gb18030.c gb2312.c gbk.c ctype.c isctype.c iswctype.c \ ldpart.c lmessages.c lmonetary.c lnumeric.c localeconv.c mblen.c \ mbrlen.c \ - mbrtoc16.c mbrtoc32.c mbrtowc.c mbsinit.c mbsnrtowcs.c \ + mbrtowc.c mbsinit.c mbsnrtowcs.c \ mbsrtowcs.c mbtowc.c mbstowcs.c \ mskanji.c nextwctype.c nl_langinfo.c nomacros.c none.c rpmatch.c \ rune.c \ @@ -23,6 +23,12 @@ SRCS+= ascii.c big5.c btowc.c c16rtomb.c wcwidth.c\ xlocale.c +.if ${MK_ICONV} != "no" +SRCS+= c16rtomb_iconv.c c32rtomb_iconv.c mbrtoc16_iconv.c mbrtoc32_iconv.c +.else +SRCS+= c16rtomb.c c32rtomb.c mbrtoc16.c mbrtoc32.c +.endif + SYM_MAPS+=${.CURDIR}/locale/Symbol.map MAN+= btowc.3 \ Added: head/lib/libc/locale/c16rtomb_iconv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/locale/c16rtomb_iconv.c Mon Jun 3 17:17:56 2013 (r251314) @@ -0,0 +1,8 @@ +/* $FreeBSD$ */ +#define charXX_t char16_t +#define cXXrtomb c16rtomb +#define cXXrtomb_l c16rtomb_l +#define SRCBUF_LEN 2 +#define UTF_XX_INTERNAL "UTF-16-INTERNAL" + +#include "cXXrtomb_iconv.h" Added: head/lib/libc/locale/c32rtomb_iconv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/locale/c32rtomb_iconv.c Mon Jun 3 17:17:56 2013 (r251314) @@ -0,0 +1,8 @@ +/* $FreeBSD$ */ +#define charXX_t char32_t +#define cXXrtomb c32rtomb +#define cXXrtomb_l c32rtomb_l +#define SRCBUF_LEN 1 +#define UTF_XX_INTERNAL "UTF-32-INTERNAL" + +#include "cXXrtomb_iconv.h" Added: head/lib/libc/locale/cXXrtomb_iconv.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/locale/cXXrtomb_iconv.h Mon Jun 3 17:17:56 2013 (r251314) @@ -0,0 +1,115 @@ +/*- + * Copyright (c) 2013 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include + +#include "../iconv/citrus_hash.h" +#include "../iconv/citrus_module.h" +#include "../iconv/citrus_iconv.h" +#include "xlocale_private.h" + +typedef struct { + bool initialized; + struct _citrus_iconv iconv; + union { + charXX_t widechar[SRCBUF_LEN]; + char bytes[sizeof(charXX_t) * SRCBUF_LEN]; + } srcbuf; + size_t srcbuf_len; +} _ConversionState; +_Static_assert(sizeof(_ConversionState) <= sizeof(mbstate_t), + "Size of _ConversionState must not exceed mbstate_t's size."); + +size_t +cXXrtomb_l(char * __restrict s, charXX_t c, mbstate_t * __restrict ps, + locale_t locale) +{ + _ConversionState *cs; + struct _citrus_iconv *handle; + char *src, *dst; + size_t srcleft, dstleft, invlen; + int err; + + FIX_LOCALE(locale); + if (ps == NULL) + ps = &locale->cXXrtomb; + cs = (_ConversionState *)ps; + handle = &cs->iconv; + + /* Reinitialize mbstate_t. */ + if (s == NULL || !cs->initialized) { + if (_citrus_iconv_open(&handle, UTF_XX_INTERNAL, + nl_langinfo_l(CODESET, locale)) != 0) { + cs->initialized = false; + errno = EINVAL; + return (-1); + } + handle->cv_shared->ci_discard_ilseq = true; + handle->cv_shared->ci_hooks = NULL; + cs->srcbuf_len = 0; + cs->initialized = true; + if (s == NULL) + return (1); + } + + assert(cs->srcbuf_len < sizeof(cs->srcbuf.widechar) / sizeof(charXX_t)); + cs->srcbuf.widechar[cs->srcbuf_len++] = c; + + /* Perform conversion. */ + src = cs->srcbuf.bytes; + srcleft = cs->srcbuf_len * sizeof(charXX_t); + dst = s; + dstleft = MB_CUR_MAX_L(locale); + err = _citrus_iconv_convert(handle, &src, &srcleft, &dst, &dstleft, + 0, &invlen); + + /* Character is part of a surrogate pair. We need more input. */ + if (err == EINVAL) + return (0); + cs->srcbuf_len = 0; + + /* Illegal sequence. */ + if (dst == s) { + errno = EILSEQ; + return ((size_t)-1); + } + return (dst - s); +} + +size_t +cXXrtomb(char * __restrict s, charXX_t c, mbstate_t * __restrict ps) +{ + + return (cXXrtomb_l(s, c, ps, __get_locale())); +} Added: head/lib/libc/locale/mbrtoc16_iconv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/locale/mbrtoc16_iconv.c Mon Jun 3 17:17:56 2013 (r251314) @@ -0,0 +1,8 @@ +/* $FreeBSD$ */ +#define charXX_t char16_t +#define mbrtocXX mbrtoc16 +#define mbrtocXX_l mbrtoc16_l +#define DSTBUF_LEN 2 +#define UTF_XX_INTERNAL "UTF-16-INTERNAL" + +#include "mbrtocXX_iconv.h" Added: head/lib/libc/locale/mbrtoc32_iconv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/locale/mbrtoc32_iconv.c Mon Jun 3 17:17:56 2013 (r251314) @@ -0,0 +1,8 @@ +/* $FreeBSD$ */ +#define charXX_t char32_t +#define mbrtocXX mbrtoc32 +#define mbrtocXX_l mbrtoc32_l +#define DSTBUF_LEN 1 +#define UTF_XX_INTERNAL "UTF-32-INTERNAL" + +#include "mbrtocXX_iconv.h" Added: head/lib/libc/locale/mbrtocXX_iconv.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/locale/mbrtocXX_iconv.h Mon Jun 3 17:17:56 2013 (r251314) @@ -0,0 +1,158 @@ +/*- + * Copyright (c) 2013 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include +#include + +#include "../iconv/citrus_hash.h" +#include "../iconv/citrus_module.h" +#include "../iconv/citrus_iconv.h" +#include "xlocale_private.h" + +typedef struct { + bool initialized; + struct _citrus_iconv iconv; + char srcbuf[MB_LEN_MAX]; + size_t srcbuf_len; + union { + charXX_t widechar[DSTBUF_LEN]; + char bytes[sizeof(charXX_t) * DSTBUF_LEN]; + } dstbuf; + size_t dstbuf_len; +} _ConversionState; +_Static_assert(sizeof(_ConversionState) <= sizeof(mbstate_t), + "Size of _ConversionState must not exceed mbstate_t's size."); + +size_t +mbrtocXX_l(charXX_t * __restrict pc, const char * __restrict s, size_t n, + mbstate_t * __restrict ps, locale_t locale) +{ + _ConversionState *cs; + struct _citrus_iconv *handle; + size_t i, retval; + charXX_t retchar; + + FIX_LOCALE(locale); + if (ps == NULL) + ps = &locale->mbrtocXX; + cs = (_ConversionState *)ps; + handle = &cs->iconv; + + /* Reinitialize mbstate_t. */ + if (s == NULL || !cs->initialized) { + if (_citrus_iconv_open(&handle, + nl_langinfo_l(CODESET, locale), UTF_XX_INTERNAL) != 0) { + cs->initialized = false; + errno = EINVAL; + return (-1); + } + handle->cv_shared->ci_discard_ilseq = true; + handle->cv_shared->ci_hooks = NULL; + cs->srcbuf_len = cs->dstbuf_len = 0; + cs->initialized = true; + if (s == NULL) + return (0); + } + + /* See if we still have characters left from the previous invocation. */ + if (cs->dstbuf_len > 0) { + retval = (size_t)-3; + goto return_char; + } + + /* Fill up the read buffer as far as possible. */ + if (n > sizeof(cs->srcbuf) - cs->srcbuf_len) + n = sizeof(cs->srcbuf) - cs->srcbuf_len; + memcpy(cs->srcbuf + cs->srcbuf_len, s, n); + + /* Convert as few characters to the dst buffer as possible. */ + for (i = 0; ; i++) { + char *src, *dst; + size_t srcleft, dstleft, invlen; + int err; + + src = cs->srcbuf; + srcleft = cs->srcbuf_len + n; + dst = cs->dstbuf.bytes; + dstleft = i * sizeof(charXX_t); + assert(srcleft <= sizeof(cs->srcbuf) && + dstleft <= sizeof(cs->dstbuf.bytes)); + err = _citrus_iconv_convert(handle, &src, &srcleft, + &dst, &dstleft, 0, &invlen); + cs->dstbuf_len = (dst - cs->dstbuf.bytes) / sizeof(charXX_t); + + /* Got new character(s). Return the first. */ + if (cs->dstbuf_len > 0) { + assert(src - cs->srcbuf > cs->srcbuf_len); + retval = src - cs->srcbuf - cs->srcbuf_len; + cs->srcbuf_len = 0; + goto return_char; + } + + /* Increase dst buffer size, to obtain the surrogate pair. */ + if (err == E2BIG) + continue; + + /* Illegal sequence. */ + if (invlen > 0) { + cs->srcbuf_len = 0; + errno = EILSEQ; + return ((size_t)-1); + } + + /* Save unprocessed remainder for the next invocation. */ + memmove(cs->srcbuf, src, srcleft); + cs->srcbuf_len = srcleft; + return ((size_t)-2); + } + +return_char: + retchar = cs->dstbuf.widechar[0]; + memmove(&cs->dstbuf.widechar[0], &cs->dstbuf.widechar[1], + --cs->dstbuf_len * sizeof(charXX_t)); + if (pc != NULL) + *pc = retchar; + if (retchar == 0) + return (0); + return (retval); +} + +size_t +mbrtocXX(charXX_t * __restrict pc, const char * __restrict s, size_t n, + mbstate_t * __restrict ps) +{ + + return (mbrtocXX_l(pc, s, n, ps, __get_locale())); +} Modified: head/tools/regression/lib/libc/locale/test-c16rtomb.c ============================================================================== --- head/tools/regression/lib/libc/locale/test-c16rtomb.c Mon Jun 3 17:13:37 2013 (r251313) +++ head/tools/regression/lib/libc/locale/test-c16rtomb.c Mon Jun 3 17:17:56 2013 (r251314) @@ -82,6 +82,34 @@ main(int argc, char *argv[]) assert(c16rtomb(buf, 0xd83d, &s) == 0); assert(c16rtomb(buf, 0xdca9, &s) == (size_t)-1); assert(errno == EILSEQ); + assert((unsigned char)buf[0] == 0xcc); + + /* + * ISO8859-1. + */ + + assert(strcmp(setlocale(LC_CTYPE, "en_US.ISO8859-1"), + "en_US.ISO8859-1") == 0); + + /* Unicode character 'Euro sign'. */ + memset(&s, 0, sizeof(s)); + memset(buf, 0xcc, sizeof(buf)); + assert(c16rtomb(buf, 0x20ac, &s) == (size_t)-1); + assert(errno == EILSEQ); + assert((unsigned char)buf[0] == 0xcc); + + /* + * ISO8859-15. + */ + + assert(strcmp(setlocale(LC_CTYPE, "en_US.ISO8859-15"), + "en_US.ISO8859-15") == 0); + + /* Unicode character 'Euro sign'. */ + memset(&s, 0, sizeof(s)); + memset(buf, 0xcc, sizeof(buf)); + assert(c16rtomb(buf, 0x20ac, &s) == 1); + assert((unsigned char)buf[0] == 0xa4 && (unsigned char)buf[1] == 0xcc); /* * UTF-8. @@ -104,12 +132,14 @@ main(int argc, char *argv[]) assert(c16rtomb(buf, 0xd83d, &s) == 0); assert(c16rtomb(buf, L'A', &s) == (size_t)-1); assert(errno == EILSEQ); + assert((unsigned char)buf[0] == 0xcc); /* Invalid code; 'Pile of poo' without the lead surrogate. */ memset(&s, 0, sizeof(s)); memset(buf, 0xcc, sizeof(buf)); assert(c16rtomb(buf, 0xdca9, &s) == (size_t)-1); assert(errno == EILSEQ); + assert((unsigned char)buf[0] == 0xcc); printf("ok 1 - c16rtomb()\n"); } Modified: head/tools/regression/lib/libc/locale/test-mbrtoc16.c ============================================================================== --- head/tools/regression/lib/libc/locale/test-mbrtoc16.c Mon Jun 3 17:13:37 2013 (r251313) +++ head/tools/regression/lib/libc/locale/test-mbrtoc16.c Mon Jun 3 17:17:56 2013 (r251314) @@ -85,6 +85,37 @@ main(int argc, char *argv[]) assert(mbrtoc16(&c16, "", 0, &s) == (size_t)-2); assert(c16 == L'z'); + /* Check that mbrtoc16() doesn't read ahead too aggressively. */ + memset(&s, 0, sizeof(s)); + assert(mbrtoc16(&c16, "AB", 2, &s) == 1); + assert(c16 == L'A'); + assert(mbrtoc16(&c16, "C", 1, &s) == 1); + assert(c16 == L'C'); + + /* + * ISO-8859-1. + */ + + assert(strcmp(setlocale(LC_CTYPE, "en_US.ISO8859-1"), + "en_US.ISO8859-1") == 0); + + /* Currency sign. */ + memset(&s, 0, sizeof(s)); + assert(mbrtoc16(&c16, "\xa4", 1, &s) == 1); + assert(c16 == 0xa4); + + /* + * ISO-8859-15. + */ + + assert(strcmp(setlocale(LC_CTYPE, "en_US.ISO8859-15"), + "en_US.ISO8859-15") == 0); + + /* Euro sign. */ + memset(&s, 0, sizeof(s)); + assert(mbrtoc16(&c16, "\xa4", 1, &s) == 1); + assert(c16 == 0x20ac); + /* * UTF-8. */ @@ -144,6 +175,20 @@ main(int argc, char *argv[]) assert(mbrtoc16(&c16, "", 0, &s) == (size_t)-3); assert(c16 == 0xdca9); + /* Letter e with acute, precomposed. */ + memset(&s, 0, sizeof(s)); + c16 = 0; + assert(mbrtoc16(&c16, "\xc3\xa9", 2, &s) == 2); + assert(c16 == 0xe9); + + /* Letter e with acute, combined. */ + memset(&s, 0, sizeof(s)); + c16 = 0; + assert(mbrtoc16(&c16, "\x65\xcc\x81", 3, &s) == 1); + assert(c16 == 0x65); + assert(mbrtoc16(&c16, "\xcc\x81", 2, &s) == 2); + assert(c16 == 0x301); + printf("ok 1 - mbrtoc16()\n"); return (0); From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:21:44 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1B2E3D26; Mon, 3 Jun 2013 17:21:44 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0E23A1BB8; Mon, 3 Jun 2013 17:21:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HLhSW088601; Mon, 3 Jun 2013 17:21:43 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HLhaB088599; Mon, 3 Jun 2013 17:21:43 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031721.r53HLhaB088599@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 17:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251315 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:21:44 -0000 Author: kargl Date: Mon Jun 3 17:21:43 2013 New Revision: 251315 URL: http://svnweb.freebsd.org/changeset/base/251315 Log: ld80/s_expl.c: * Update Copyright years to include 2013. ld128/s_expl.c: * Correct and update Copyright years. This code originated from the ld80 version, so it should reflect the same time period. Reviewed by: bde (as part of larger diff) Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 17:17:56 2013 (r251314) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 17:21:43 2013 (r251315) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012 Steven G. Kargl + * Copyright (c) 2009-2013 Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 17:17:56 2013 (r251314) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 17:21:43 2013 (r251315) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Steven G. Kargl + * Copyright (c) 2009-2013 Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:24:47 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 79ED3ED8; Mon, 3 Jun 2013 17:24:47 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6CC9B1BD8; Mon, 3 Jun 2013 17:24:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HOlB9089274; Mon, 3 Jun 2013 17:24:47 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HOlPP089273; Mon, 3 Jun 2013 17:24:47 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031724.r53HOlPP089273@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 17:24:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251316 - head/lib/msun/ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:24:47 -0000 Author: kargl Date: Mon Jun 3 17:24:46 2013 New Revision: 251316 URL: http://svnweb.freebsd.org/changeset/base/251316 Log: * Style(9). Start non-Copyright fancy formatted comments with /**. Reviewed by: bde (as part of larger diff) Modified: head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 17:21:43 2013 (r251315) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 17:24:46 2013 (r251316) @@ -29,7 +29,7 @@ #include __FBSDID("$FreeBSD$"); -/*- +/** * Compute the exponential of x for Intel 80-bit format. This is based on: * * PTP Tang, "Table-driven implementation of the exponential function From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:30:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9F8E2222; Mon, 3 Jun 2013 17:30:21 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 91C511C1D; Mon, 3 Jun 2013 17:30:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HULSp091969; Mon, 3 Jun 2013 17:30:21 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HULbb091968; Mon, 3 Jun 2013 17:30:21 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201306031730.r53HULbb091968@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 3 Jun 2013 17:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251317 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:30:21 -0000 Author: np Date: Mon Jun 3 17:30:21 2013 New Revision: 251317 URL: http://svnweb.freebsd.org/changeset/base/251317 Log: cxgbe(4): t4fw_cfg must be explicitly loaded if the driver is being loaded via loader.conf. Submitted by: jwd@ MFC after: 3 days Modified: head/share/man/man4/cxgbe.4 Modified: head/share/man/man4/cxgbe.4 ============================================================================== --- head/share/man/man4/cxgbe.4 Mon Jun 3 17:24:46 2013 (r251316) +++ head/share/man/man4/cxgbe.4 Mon Jun 3 17:30:21 2013 (r251317) @@ -46,9 +46,10 @@ kernel configuration file: .Ed .Pp To load the driver as a -module at boot time, place the following line in +module at boot time, place the following lines in .Xr loader.conf 5 : .Bd -literal -offset indent +t4fw_cfg_load="YES" if_cxgbe_load="YES" .Ed .Sh DESCRIPTION From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:30:40 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EA24E38F; Mon, 3 Jun 2013 17:30:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DD2541C21; Mon, 3 Jun 2013 17:30:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HUewt092070; Mon, 3 Jun 2013 17:30:40 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HUeAE092069; Mon, 3 Jun 2013 17:30:40 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306031730.r53HUeAE092069@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 17:30:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251318 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:30:41 -0000 Author: kib Date: Mon Jun 3 17:30:40 2013 New Revision: 251318 URL: http://svnweb.freebsd.org/changeset/base/251318 Log: Remove irrelevant comments. Discussed with: alc MFC after: 3 days Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Jun 3 17:30:21 2013 (r251317) +++ head/sys/vm/vm_page.c Mon Jun 3 17:30:40 2013 (r251318) @@ -801,11 +801,6 @@ vm_page_dirty_KBI(vm_page_t m) * * Inserts the given mem entry into the object and object list. * - * The pagetables are not updated but will presumably fault the page - * in if necessary, or if a kernel page the caller will at some point - * enter the page into the kernel's pmap. We are not allowed to sleep - * here so we *can't* do this anyway. - * * The object must be locked. */ void @@ -891,8 +886,6 @@ vm_page_insert_after(vm_page_t m, vm_obj * table and the object page list, but do not invalidate/terminate * the backing store. * - * The underlying pmap entry (if any) is NOT removed here. - * * The object must be locked. The page must be locked if it is managed. */ void From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:33:12 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CD547612; Mon, 3 Jun 2013 17:33:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BF9251C3C; Mon, 3 Jun 2013 17:33:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HXCt6092648; Mon, 3 Jun 2013 17:33:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HXCYE092647; Mon, 3 Jun 2013 17:33:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306031733.r53HXCYE092647@svn.freebsd.org> From: John Baldwin Date: Mon, 3 Jun 2013 17:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251319 - stable/9/games/fortune/datfiles X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:33:12 -0000 Author: jhb Date: Mon Jun 3 17:33:12 2013 New Revision: 251319 URL: http://svnweb.freebsd.org/changeset/base/251319 Log: MFC 248200: Remove fortunes-o from the base system. Deleted: stable/9/games/fortune/datfiles/fortunes-o.fake stable/9/games/fortune/datfiles/fortunes-o.real stable/9/games/fortune/datfiles/fortunes-o.sp.ok Modified: stable/9/games/fortune/datfiles/Makefile Directory Properties: stable/9/games/fortune/ (props changed) Modified: stable/9/games/fortune/datfiles/Makefile ============================================================================== --- stable/9/games/fortune/datfiles/Makefile Mon Jun 3 17:30:40 2013 (r251318) +++ stable/9/games/fortune/datfiles/Makefile Mon Jun 3 17:33:12 2013 (r251319) @@ -1,37 +1,22 @@ # @(#)Makefile 8.2 (Berkeley) 4/19/94 # $FreeBSD$ -FILES= fortunes freebsd-tips murphy startrek zippy -BLDS= fortunes.dat murphy.dat startrek.dat zippy.dat \ - fortunes-o fortunes-o.dat freebsd-tips.dat +DB= fortunes freebsd-tips murphy startrek zippy # TO AVOID INSTALLING THE POTENTIALLY OFFENSIVE FORTUNES, COMMENT OUT THE -# THREE LINES AND UNCOMMENT THE FOURTH LINE. +# NEXT LINE. +DB+= limerick murphy-o gerrold.limerick -# THE THREE LINES: -FILES+= limerick murphy-o gerrold.limerick -BLDS+= limerick.dat murphy-o.dat gerrold.limerick.dat -TYPE= real - -# THE FOURTH LINE: -#TYPE= fake - -FILES+= ${BLDS} +BLDS= ${DB:S/$/.dat/} +FILES= ${DB} ${BLDS} CLEANFILES+=${BLDS} FILESDIR= ${SHAREDIR}/games/fortune -.for f in fortunes freebsd-tips gerrold.limerick limerick murphy murphy-o startrek zippy +.for f in ${DB} $f.dat: $f PATH=$$PATH:/usr/games:${.OBJDIR}/../strfile \ strfile -Cs ${.ALLSRC} ${.TARGET} .endfor -fortunes-o.dat: fortunes-o - PATH=$$PATH:/usr/games:${.OBJDIR}/../strfile \ - strfile -Csx ${.ALLSRC} ${.TARGET} - -fortunes-o: fortunes-o.${TYPE} - LC_ALL=C tr a-zA-Z n-za-mN-ZA-M < ${.ALLSRC} > ${.TARGET} - .include From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:34:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5C6B9795; Mon, 3 Jun 2013 17:34:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4DF551C4F; Mon, 3 Jun 2013 17:34:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HYnMo092994; Mon, 3 Jun 2013 17:34:49 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HYnSK092993; Mon, 3 Jun 2013 17:34:49 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306031734.r53HYnSK092993@svn.freebsd.org> From: John Baldwin Date: Mon, 3 Jun 2013 17:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251320 - stable/8/games/fortune/datfiles X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:34:49 -0000 Author: jhb Date: Mon Jun 3 17:34:48 2013 New Revision: 251320 URL: http://svnweb.freebsd.org/changeset/base/251320 Log: MFC 248200: Remove fortunes-o from the base system. Deleted: stable/8/games/fortune/datfiles/fortunes-o.fake stable/8/games/fortune/datfiles/fortunes-o.real stable/8/games/fortune/datfiles/fortunes-o.sp.ok Modified: stable/8/games/fortune/datfiles/Makefile Directory Properties: stable/8/games/fortune/ (props changed) Modified: stable/8/games/fortune/datfiles/Makefile ============================================================================== --- stable/8/games/fortune/datfiles/Makefile Mon Jun 3 17:33:12 2013 (r251319) +++ stable/8/games/fortune/datfiles/Makefile Mon Jun 3 17:34:48 2013 (r251320) @@ -1,37 +1,22 @@ # @(#)Makefile 8.2 (Berkeley) 4/19/94 # $FreeBSD$ -FILES= fortunes freebsd-tips murphy startrek zippy -BLDS= fortunes.dat murphy.dat startrek.dat zippy.dat \ - fortunes-o fortunes-o.dat freebsd-tips.dat +DB= fortunes freebsd-tips murphy startrek zippy # TO AVOID INSTALLING THE POTENTIALLY OFFENSIVE FORTUNES, COMMENT OUT THE -# THREE LINES AND UNCOMMENT THE FOURTH LINE. +# NEXT LINE. +DB+= limerick murphy-o gerrold.limerick -# THE THREE LINES: -FILES+= limerick murphy-o gerrold.limerick -BLDS+= limerick.dat murphy-o.dat gerrold.limerick.dat -TYPE= real - -# THE FOURTH LINE: -#TYPE= fake - -FILES+= ${BLDS} +BLDS= ${DB:S/$/.dat/} +FILES= ${DB} ${BLDS} CLEANFILES+=${BLDS} FILESDIR= ${SHAREDIR}/games/fortune -.for f in fortunes freebsd-tips gerrold.limerick limerick murphy murphy-o startrek zippy +.for f in ${DB} $f.dat: $f PATH=$$PATH:/usr/games:${.OBJDIR}/../strfile \ strfile -Cs ${.ALLSRC} ${.TARGET} .endfor -fortunes-o.dat: fortunes-o - PATH=$$PATH:/usr/games:${.OBJDIR}/../strfile \ - strfile -Csx ${.ALLSRC} ${.TARGET} - -fortunes-o: fortunes-o.${TYPE} - LC_ALL=C tr a-zA-Z n-za-mN-ZA-M < ${.ALLSRC} > ${.TARGET} - .include From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:36:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9671A918; Mon, 3 Jun 2013 17:36:27 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 874441C5F; Mon, 3 Jun 2013 17:36:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HaRMf093350; Mon, 3 Jun 2013 17:36:27 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HaQ8R093348; Mon, 3 Jun 2013 17:36:26 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031736.r53HaQ8R093348@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 17:36:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251321 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:36:27 -0000 Author: kargl Date: Mon Jun 3 17:36:26 2013 New Revision: 251321 URL: http://svnweb.freebsd.org/changeset/base/251321 Log: * Rename the polynomial coefficients from P2, P3, ... to A2, A3, .... The names now coincide with the name used in PTP Tang's paper. * Rename the variable from s to tbl to better reflect that this is a table, and to be consistent with the naming scheme in s_exp2l.c Reviewed by: bde (as part of larger diff) Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 17:34:48 2013 (r251320) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 17:36:26 2013 (r251321) @@ -52,21 +52,21 @@ twom10000 = 0x1p-10000L, u_threshold = -11433.462743336297878837243843452621503L; static const long double -P2 = 5.00000000000000000000000000000000000e-1L, -P3 = 1.66666666666666666666666666666666972e-1L, -P4 = 4.16666666666666666666666666653708268e-2L, -P5 = 8.33333333333333333333333315069867254e-3L, -P6 = 1.38888888888888888888996596213795377e-3L, -P7 = 1.98412698412698412718821436278644414e-4L, -P8 = 2.48015873015869681884882576649543128e-5L, -P9 = 2.75573192240103867817876199544468806e-6L, -P10 = 2.75573236172670046201884000197885520e-7L, -P11 = 2.50517544183909126492878226167697856e-8L; +A2 = 5.00000000000000000000000000000000000e-1L, +A3 = 1.66666666666666666666666666666666972e-1L, +A4 = 4.16666666666666666666666666653708268e-2L, +A5 = 8.33333333333333333333333315069867254e-3L, +A6 = 1.38888888888888888888996596213795377e-3L, +A7 = 1.98412698412698412718821436278644414e-4L, +A8 = 2.48015873015869681884882576649543128e-5L, +A9 = 2.75573192240103867817876199544468806e-6L, +A10 = 2.75573236172670046201884000197885520e-7L, +A11 = 2.50517544183909126492878226167697856e-8L; static const struct { long double hi; long double lo; -} s[INTERVALS] = { +} tbl[INTERVALS] = { 0x1p0L, 0x0p0L, 0x1.0163da9fb33356d84a66aep0L, 0x3.36dcdfa4003ec04c360be2404078p-92L, 0x1.02c9a3e778060ee6f7cacap0L, 0x4.f7a29bde93d70a2cabc5cb89ba10p-92L, @@ -245,10 +245,10 @@ expl(long double x) } r = r1 + r2; - q = r * r * (P2 + r * (P3 + r * (P4 + r * (P5 + r * (P6 + r * (P7 + - r * (P8 + r * (P9 + r * (P10 + r * P11))))))))); - t = s[n2].lo + s[n2].hi; - t = s[n2].hi + (s[n2].lo + t * (r2 + q + r1)); + q = r * r * (A2 + r * (A3 + r * (A4 + r * (A5 + r * (A6 + r * (A7 + + r * (A8 + r * (A9 + r * (A10 + r * A11))))))))); + t = tbl[n2].lo + tbl[n2].hi; + t = tbl[n2].hi + (tbl[n2].lo + t * (r2 + q + r1)); /* Scale by 2**k. */ if (k >= LDBL_MIN_EXP) { Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 17:34:48 2013 (r251320) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 17:36:26 2013 (r251321) @@ -78,11 +78,11 @@ L2 = -3.2819649005320973e-13, /* -0x171 * |exp(x) - p(x)| < 2**-77.2 * (0.002708 is ln2/(2*INTERVALS) rounded up a little). */ -P2 = 0.5, -P3 = 1.6666666666666119e-1, /* 0x15555555555490.0p-55 */ -P4 = 4.1666666666665887e-2, /* 0x155555555554e5.0p-57 */ -P5 = 8.3333354987869413e-3, /* 0x1111115b789919.0p-59 */ -P6 = 1.3888891738560272e-3; /* 0x16c16c651633ae.0p-62 */ +A2 = 0.5, +A3 = 1.6666666666666119e-1, /* 0x15555555555490.0p-55 */ +A4 = 4.1666666666665887e-2, /* 0x155555555554e5.0p-57 */ +A5 = 8.3333354987869413e-3, /* 0x1111115b789919.0p-59 */ +A6 = 1.3888891738560272e-3; /* 0x16c16c651633ae.0p-62 */ /* * 2^(i/INTERVALS) for i in [0,INTERVALS] is represented by two values where @@ -96,8 +96,7 @@ P6 = 1.3888891738560272e-3; /* 0x16c1 static const struct { double hi; double lo; -/* XXX should rename 's'. */ -} s[INTERVALS] = { +} tbl[INTERVALS] = { 0x1p+0, 0x0p+0, 0x1.0163da9fb3335p+0, 0x1.b61299ab8cdb7p-54, 0x1.02c9a3e778060p+0, 0x1.dcdef95949ef4p-53, @@ -284,14 +283,14 @@ expl(long double x) twopkp10000 = v.e; } - /* Evaluate expl(midpoint[n2] + r1 + r2) = s[n2] * expl(r1 + r2). */ + /* Evaluate expl(midpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). */ /* Here q = q(r), not q(r1), since r1 is lopped like L1. */ t45 = r * P5 + P4; z = r * r; t23 = r * P3 + P2; q = r2 + z * t23 + z * z * t45 + z * z * z * P6; - t = (long double)s[n2].lo + s[n2].hi; - t = s[n2].lo + t * (q + r1) + s[n2].hi; + t = (long double)tbl[n2].lo + tbl[n2].hi; + t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; /* Scale by 2**k. */ if (k >= LDBL_MIN_EXP) { From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:36:44 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4CDE0A88; Mon, 3 Jun 2013 17:36:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3F4C81C62; Mon, 3 Jun 2013 17:36:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53Haiui093432; Mon, 3 Jun 2013 17:36:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53Hain5093431; Mon, 3 Jun 2013 17:36:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306031736.r53Hain5093431@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 17:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251322 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:36:44 -0000 Author: kib Date: Mon Jun 3 17:36:43 2013 New Revision: 251322 URL: http://svnweb.freebsd.org/changeset/base/251322 Log: Be more generous when donating the current thread time to the owner of the vnode lock while iterating over the free vnode list. Instead of yielding, pause for 1 tick. The change is reported to help in some virtualized environments. Submitted by: Roger Pau Monn? Discussed with: jilles Tested by: pho MFC after: 2 weeks Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Jun 3 17:36:26 2013 (r251321) +++ head/sys/kern/vfs_subr.c Mon Jun 3 17:36:43 2013 (r251322) @@ -4693,7 +4693,7 @@ restart: if (mp_ncpus == 1 || should_yield()) { TAILQ_INSERT_BEFORE(vp, *mvp, v_actfreelist); mtx_unlock(&vnode_free_list_mtx); - kern_yield(PRI_USER); + pause("vnacti", 1); mtx_lock(&vnode_free_list_mtx); goto restart; } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:38:58 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 54E36C1E; Mon, 3 Jun 2013 17:38:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 47A821C75; Mon, 3 Jun 2013 17:38:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HcwCe093884; Mon, 3 Jun 2013 17:38:58 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53Hcw3M093883; Mon, 3 Jun 2013 17:38:58 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306031738.r53Hcw3M093883@svn.freebsd.org> From: John Baldwin Date: Mon, 3 Jun 2013 17:38:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251323 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:38:58 -0000 Author: jhb Date: Mon Jun 3 17:38:57 2013 New Revision: 251323 URL: http://svnweb.freebsd.org/changeset/base/251323 Log: - Handle the recursed/not recursed flags with RA_RLOCKED in rw_assert(). - Tweak a panic message. Modified: head/sys/kern/kern_rwlock.c Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Mon Jun 3 17:36:43 2013 (r251322) +++ head/sys/kern/kern_rwlock.c Mon Jun 3 17:38:57 2013 (r251323) @@ -371,7 +371,7 @@ __rw_rlock(volatile uintptr_t *c, const KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_rlock() of destroyed rwlock @ %s:%d", file, line)); KASSERT(rw_wowner(rw) != curthread, - ("%s (%s): wlock already held @ %s:%d", __func__, + ("rw_rlock: wlock already held for %s @ %s:%d", rw->lock_object.lo_name, file, line)); WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL); @@ -1124,6 +1124,8 @@ __rw_assert(const volatile uintptr_t *c, case RA_LOCKED | RA_RECURSED: case RA_LOCKED | RA_NOTRECURSED: case RA_RLOCKED: + case RA_RLOCKED | RA_RECURSED: + case RA_RLOCKED | RA_NOTRECURSED: #ifdef WITNESS witness_assert(&rw->lock_object, what, file, line); #else @@ -1133,13 +1135,13 @@ __rw_assert(const volatile uintptr_t *c, * has a lock at all, fail. */ if (rw->rw_lock == RW_UNLOCKED || - (!(rw->rw_lock & RW_LOCK_READ) && (what == RA_RLOCKED || + (!(rw->rw_lock & RW_LOCK_READ) && (what & RA_RLOCKED || rw_wowner(rw) != curthread))) panic("Lock %s not %slocked @ %s:%d\n", - rw->lock_object.lo_name, (what == RA_RLOCKED) ? + rw->lock_object.lo_name, (what & RA_RLOCKED) ? "read " : "", file, line); - if (!(rw->rw_lock & RW_LOCK_READ)) { + if (!(rw->rw_lock & RW_LOCK_READ) && !(what & RA_RLOCKED)) { if (rw_recursed(rw)) { if (what & RA_NOTRECURSED) panic("Lock %s recursed @ %s:%d\n", From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:40:06 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7B3B0E2E; Mon, 3 Jun 2013 17:40:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6E1CC1C87; Mon, 3 Jun 2013 17:40:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53He67c094196; Mon, 3 Jun 2013 17:40:06 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53He6Zw094192; Mon, 3 Jun 2013 17:40:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306031740.r53He6Zw094192@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 17:40:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251324 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:40:06 -0000 Author: kib Date: Mon Jun 3 17:40:05 2013 New Revision: 251324 URL: http://svnweb.freebsd.org/changeset/base/251324 Log: Assert that interrupts are enabled in the trap handlers on x86 before calling generic code to deliver signals. Discussed with: bde Tested by: pho MFC after: 1 week Modified: head/sys/amd64/amd64/trap.c head/sys/i386/i386/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Mon Jun 3 17:38:57 2013 (r251323) +++ head/sys/amd64/amd64/trap.c Mon Jun 3 17:40:05 2013 (r251324) @@ -630,6 +630,7 @@ trap(struct trapframe *frame) fubyte((void *)(frame->tf_rip + 6)), fubyte((void *)(frame->tf_rip + 7))); } + KASSERT((read_rflags() & PSL_I) != 0, ("interrupts disabled")); trapsignal(td, &ksi); user: Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Mon Jun 3 17:38:57 2013 (r251323) +++ head/sys/i386/i386/trap.c Mon Jun 3 17:40:05 2013 (r251324) @@ -780,6 +780,7 @@ trap(struct trapframe *frame) fubyte((void *)(frame->tf_eip + 6)), fubyte((void *)(frame->tf_eip + 7))); } + KASSERT((read_eflags() & PSL_I) != 0, ("interrupts disabled")); trapsignal(td, &ksi); #ifdef DEBUG From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:40:53 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6A3BEFA5; Mon, 3 Jun 2013 17:40:53 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5B8D31C91; Mon, 3 Jun 2013 17:40:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53Hervt095936; Mon, 3 Jun 2013 17:40:53 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53Her8b095934; Mon, 3 Jun 2013 17:40:53 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031740.r53Her8b095934@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 17:40:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251325 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:40:53 -0000 Author: kargl Date: Mon Jun 3 17:40:52 2013 New Revision: 251325 URL: http://svnweb.freebsd.org/changeset/base/251325 Log: Whitespace. Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 17:40:05 2013 (r251324) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 17:40:52 2013 (r251325) @@ -227,7 +227,7 @@ expl(long double x) /* Reduce x to (k*ln2 + midpoint[n2] + r1 + r2). */ fn = x * INV_L + 0x1.8p112 - 0x1.8p112; - n = (int)fn; + n = (int)fn; n2 = (unsigned)n % INTERVALS; k = (n - n2) / INTERVALS; r1 = x - fn * L1; Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 17:40:05 2013 (r251324) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 17:40:52 2013 (r251325) @@ -262,11 +262,11 @@ expl(long double x) fn = x * INV_L + 0x1.8p63 - 0x1.8p63; r = x - fn * L1 - fn * L2; /* r = r1 + r2 done independently. */ #if defined(HAVE_EFFICIENT_IRINTL) - n = irintl(fn); + n = irintl(fn); #elif defined(HAVE_EFFICIENT_IRINT) - n = irint(fn); + n = irint(fn); #else - n = (int)fn; + n = (int)fn; #endif n2 = (unsigned)n % INTERVALS; k = (n - n2) / INTERVALS; From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:41:12 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 59C551A5; Mon, 3 Jun 2013 17:41:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4CD6A1C97; Mon, 3 Jun 2013 17:41:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HfCbj096060; Mon, 3 Jun 2013 17:41:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HfBtp096058; Mon, 3 Jun 2013 17:41:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306031741.r53HfBtp096058@svn.freebsd.org> From: John Baldwin Date: Mon, 3 Jun 2013 17:41:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251326 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:41:12 -0000 Author: jhb Date: Mon Jun 3 17:41:11 2013 New Revision: 251326 URL: http://svnweb.freebsd.org/changeset/base/251326 Log: - Fix a couple of inverted panic messages for shared/exclusive mismatches of a lock within a single thread. - Fix handling of interlocks in WITNESS by properly requiring the interlock to be held exactly once if it is specified. Modified: head/sys/kern/kern_lock.c head/sys/kern/subr_witness.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Mon Jun 3 17:40:52 2013 (r251325) +++ head/sys/kern/kern_lock.c Mon Jun 3 17:41:11 2013 (r251326) @@ -511,7 +511,7 @@ __lockmgr_args(struct lock *lk, u_int fl case LK_SHARED: if (LK_CAN_WITNESS(flags)) WITNESS_CHECKORDER(&lk->lock_object, LOP_NEWORDER, - file, line, ilk); + file, line, flags & LK_INTERLOCK ? ilk : NULL); for (;;) { x = lk->lk_lock; @@ -723,7 +723,8 @@ __lockmgr_args(struct lock *lk, u_int fl case LK_EXCLUSIVE: if (LK_CAN_WITNESS(flags)) WITNESS_CHECKORDER(&lk->lock_object, LOP_NEWORDER | - LOP_EXCLUSIVE, file, line, ilk); + LOP_EXCLUSIVE, file, line, flags & LK_INTERLOCK ? + ilk : NULL); /* * If curthread already holds the lock and this one is @@ -1072,7 +1073,8 @@ __lockmgr_args(struct lock *lk, u_int fl case LK_DRAIN: if (LK_CAN_WITNESS(flags)) WITNESS_CHECKORDER(&lk->lock_object, LOP_NEWORDER | - LOP_EXCLUSIVE, file, line, ilk); + LOP_EXCLUSIVE, file, line, flags & LK_INTERLOCK ? + ilk : NULL); /* * Trying to drain a lock we already own will result in a Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Mon Jun 3 17:40:52 2013 (r251325) +++ head/sys/kern/subr_witness.c Mon Jun 3 17:41:11 2013 (r251326) @@ -1053,7 +1053,7 @@ witness_checkorder(struct lock_object *l { struct lock_list_entry *lock_list, *lle; struct lock_instance *lock1, *lock2, *plock; - struct lock_class *class; + struct lock_class *class, *iclass; struct witness *w, *w1; struct thread *td; int i, j; @@ -1119,7 +1119,7 @@ witness_checkorder(struct lock_object *l fixup_filename(file), line); printf("while exclusively locked from %s:%d\n", fixup_filename(lock1->li_file), lock1->li_line); - kassert_panic("share->excl"); + kassert_panic("excl->share"); } if ((lock1->li_flags & LI_EXCLUSIVE) == 0 && (flags & LOP_EXCLUSIVE) != 0) { @@ -1128,11 +1128,27 @@ witness_checkorder(struct lock_object *l fixup_filename(file), line); printf("while share locked from %s:%d\n", fixup_filename(lock1->li_file), lock1->li_line); - kassert_panic("excl->share"); + kassert_panic("share->excl"); } return; } + /* Warn if the interlock is not locked exactly once. */ + if (interlock != NULL) { + iclass = LOCK_CLASS(interlock); + lock1 = find_instance(lock_list, interlock); + if (lock1 == NULL) + kassert_panic("interlock (%s) %s not locked @ %s:%d", + iclass->lc_name, interlock->lo_name, + flags & LOP_EXCLUSIVE ? "exclusive" : "shared", + fixup_filename(file), line); + else if ((lock1->li_flags & LI_RECURSEMASK) != 0) + kassert_panic("interlock (%s) %s recursed @ %s:%d", + iclass->lc_name, interlock->lo_name, + flags & LOP_EXCLUSIVE ? "exclusive" : "shared", + fixup_filename(file), line); + } + /* * Find the previously acquired lock, but ignore interlocks. */ @@ -1205,12 +1221,10 @@ witness_checkorder(struct lock_object *l lock1 = &lle->ll_children[i]; /* - * Ignore the interlock the first time we see it. + * Ignore the interlock. */ - if (interlock != NULL && interlock == lock1->li_lock) { - interlock = NULL; + if (interlock == lock1->li_lock) continue; - } /* * If this lock doesn't undergo witness checking, From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:44:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 53903397 for ; Mon, 3 Jun 2013 17:44:52 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vb0-x22c.google.com (mail-vb0-x22c.google.com [IPv6:2607:f8b0:400c:c02::22c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F8B91CC3 for ; Mon, 3 Jun 2013 17:44:51 +0000 (UTC) Received: by mail-vb0-f44.google.com with SMTP id i3so2879743vbh.3 for ; Mon, 03 Jun 2013 10:44:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=MDhzXJw+ynQXmKfwjeVoDlsILxLv5zJ0pQ45ncPBn3c=; b=BVn017CY+hH1nALzw64dTlqin6W9JiiFGBnUUY7VYIlCSvwZSuh7CmzgOq0EWXtnKQ QKNTwmHmW1Njosdmnb5bwClMVv5FH6ripp2n2JG7keXUqp3QGhg7wo6GJs0z7lslEbxM 31y5PqJ9f1vAGe4+GLQzM1rIMQIWtBeyXmvH0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=MDhzXJw+ynQXmKfwjeVoDlsILxLv5zJ0pQ45ncPBn3c=; b=c2k1zH1NGMEn5jdeula6PVc+CT3hAHxuXXmHCO6u3HHUxhrnr/KE/obXeG+pVaPWnn g37QIr9Gg6aU2T2nqiROFtc8kwSoZa2yPeD8blCYofo0o8WT3hwPeirlSdlNIVlqrhPr n086ps4dtlmFdX3YH081nVv00Kd5YIdq9qf1QX7jWlLx+dF20My6mqxbl+sqogvDXWw+ Fx7dPjUvK4PhX/USjtzmbtrpviBBHgdrK+HhxcZJ0yLKE+jD5AFwrl2kffA0jG2kGr5V 2grohBxQQdcVJxMEGwp2WWqkOqg6ql6Ya7ayOQrdGHdX25i9hi5PKAvakSeo6mqjZFjf alEA== MIME-Version: 1.0 X-Received: by 10.220.48.201 with SMTP id s9mr2732244vcf.9.1370281491568; Mon, 03 Jun 2013 10:44:51 -0700 (PDT) Received: by 10.220.20.133 with HTTP; Mon, 3 Jun 2013 10:44:51 -0700 (PDT) In-Reply-To: References: <201305251859.r4PIxChc053341@svn.freebsd.org> <51AC9933.7050201@FreeBSD.org> Date: Mon, 3 Jun 2013 10:44:51 -0700 Message-ID: Subject: Re: svn commit: r250991 - in head: contrib/jemalloc/include/jemalloc include lib/libc/stdlib/jemalloc From: Peter Wemm To: Marcel Moolenaar Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQl4FAryTGmXrno88BkNDJoE47vflIaYjE6eT+KUxMTLaRbDY8iE+oHM7CHCowDr3ALIu32M Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , Dimitry Andric , src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:44:52 -0000 On Mon, Jun 3, 2013 at 7:50 AM, Marcel Moolenaar wrote: > > On Jun 3, 2013, at 6:25 AM, Dimitry Andric wrote: > >> On 2013-05-25 20:59, Marcel Moolenaar wrote: >>> Author: marcel >>> Date: Sat May 25 18:59:11 2013 >>> New Revision: 250991 >>> URL: http://svnweb.freebsd.org/changeset/base/250991 >>> >>> Log: >>> Make the malloc(3) family of functions weak and make their non-weak >>> implementations visible for use by applications. The functions $F that >>> are now weak symbols are: >>> allocm, calloc, dallocm, free, malloc, malloc_usable_size, >>> nallocm, posix_memalign, rallocm, realloc, sallocm >>> >>> The non-weak implementations of $F are exported as __$F. >> >> Hi Marcel, >> >> This commit seems to lead to various problems in ports, and possibly >> other software. For example, with Firefox I now always get a few >> messages like: >> >> firefox in free(): warning: malloc() has never been called >> >> Another example is the devel/talloc port, which now dies with: > > It looks like the python build is broken. The net effect is that _ctypes.so > has a strong definition of malloc, free, et al. This is not intentional, > but a side-effect of the what seems to be a bug in fficonfig.py.in (see > patch below). To elaborate: > > _ctypes.so incorporates the libffi functionality for what I presume is > the basis for Python bindings. libffi includes dlmalloc.c, an open source > allocator. dlmalloc.c is incuded by closures.c and closures.c defines > USE_DL_PREFIX. On top of that closures.c makes all allocator functions > static. This, by design there's no problem. In short: dlmalloc.c never > gets compiler separately/independently. > > The python build however compiles dlmalloc.c separately/independently. > As such, dlmalloc.c now defines and exports malloc et al and it also > get linked into _ctypes.so. > > Once _ctypes.so gets dynamically loaded, things start to break. > > Unfortunately, this means python needs to be recompiled from ports with > the following fix: > > Index: files/patch-Modules-_ctypes-libffi-fficonfig.py.in > =================================================================== > --- files/patch-Modules-_ctypes-libffi-fficonfig.py.in (revision 0) > +++ files/patch-Modules-_ctypes-libffi-fficonfig.py.in (working copy) > @@ -0,0 +1,10 @@ > +--- Modules/_ctypes/libffi/fficonfig.py.in.orig 2013-06-03 07:16:44.000000000 -0700 > ++++ Modules/_ctypes/libffi/fficonfig.py.in 2013-06-03 07:17:03.000000000 -0700 > +@@ -1,7 +1,6 @@ > + ffi_sources = """ > + src/prep_cif.c > + src/closures.c > +-src/dlmalloc.c > + """.split() > + > + ffi_platforms = { > > This has been tested with python-2.7.5. I can't say anything about > other versions. > > Do people concur that this is the right fix? Forgive me for asking dumb questions, but: * Does this fix the firefox, chromium etc problems? (were they linked to python?) * Even if the python code is wrong, is this one of those things that's going to keep biting us going forward? Interactions between dlopen/dlsym/rtld/library dependencies/embedded malloc replacements/etc has been accumulated a large number of casualties over the years. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 17:51:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 09B2E556; Mon, 3 Jun 2013 17:51:09 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EF7731CF1; Mon, 3 Jun 2013 17:51:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53Hp8M1099655; Mon, 3 Jun 2013 17:51:08 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53Hp8Mm099653; Mon, 3 Jun 2013 17:51:08 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031751.r53Hp8Mm099653@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 17:51:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251327 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:51:09 -0000 Author: kargl Date: Mon Jun 3 17:51:08 2013 New Revision: 251327 URL: http://svnweb.freebsd.org/changeset/base/251327 Log: Introduce the macro LOG2_INTERVAL, which is log2(number of intervals). Use the macroi as a micro-optimization to convert a subtraction and division to a shift. Obtained from: bde Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 17:41:11 2013 (r251326) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 17:51:08 2013 (r251327) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "math_private.h" #define INTERVALS 128 +#define LOG2_INTERVALS 7 #define BIAS (LDBL_MAX_EXP - 1) static volatile const long double tiny = 0x1p-10000L; @@ -229,7 +230,7 @@ expl(long double x) fn = x * INV_L + 0x1.8p112 - 0x1.8p112; n = (int)fn; n2 = (unsigned)n % INTERVALS; - k = (n - n2) / INTERVALS; + k = n >> LOG2_INTERVALS; r1 = x - fn * L1; r2 = -fn * L2; Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 17:41:11 2013 (r251326) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 17:51:08 2013 (r251327) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include "math_private.h" #define INTERVALS 128 +#define LOG2_INTERVALS 7 #define BIAS (LDBL_MAX_EXP - 1) static const long double @@ -269,7 +270,8 @@ expl(long double x) n = (int)fn; #endif n2 = (unsigned)n % INTERVALS; - k = (n - n2) / INTERVALS; + /* Depend on the sign bit being propagated: */ + k = n >> LOG2_INTERVALS; r1 = x - fn * L1; r2 = -fn * L2; From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:07:05 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 17146BAE; Mon, 3 Jun 2013 18:07:05 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 099B11DA4; Mon, 3 Jun 2013 18:07:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53I74bb005038; Mon, 3 Jun 2013 18:07:04 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53I74RQ005035; Mon, 3 Jun 2013 18:07:04 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031807.r53I74RQ005035@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 18:07:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251328 - head/lib/msun/ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:07:05 -0000 Author: kargl Date: Mon Jun 3 18:07:04 2013 New Revision: 251328 URL: http://svnweb.freebsd.org/changeset/base/251328 Log: Add a u suffix to the IEEEl2bits unions o_threshold and u_threshold, and use macros to access the e component of the unions. This allows the portions of the code in ld80 to be identical to the ld128 code. Obtained from: bde Modified: head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 17:51:08 2013 (r251327) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 18:07:04 2013 (r251328) @@ -61,9 +61,12 @@ static volatile const long double tiny = static const union IEEEl2bits /* log(2**16384 - 0.5) rounded towards zero: */ -o_threshold = LD80C(0xb17217f7d1cf79ab, 13, 11356.5234062941439488L), +/* log(2**16384 - 0.5 + 1) rounded towards zero for expm1l() is the same: */ +o_thresholdu = LD80C(0xb17217f7d1cf79ab, 13, 11356.5234062941439488L), +#define o_threshold (o_thresholdu.e) /* log(2**(-16381-64-1)) rounded towards zero: */ -u_threshold = LD80C(0xb21dfe7f09e2baa9, 13, -11399.4985314888605581L); +u_thresholdu = LD80C(0xb21dfe7f09e2baa9, 13, -11399.4985314888605581L); +#define u_threshold (u_thresholdu.e) static const double /* @@ -246,9 +249,9 @@ expl(long double x) return (0.0L); /* x is -Inf */ return (x + x); /* x is +Inf, NaN or unsupported */ } - if (x > o_threshold.e) + if (x > o_threshold) return (huge * huge); - if (x < u_threshold.e) + if (x < u_threshold) return (tiny * tiny); } else if (ix < BIAS - 66) { /* |x| < 0x1p-66 */ /* includes pseudo-denormals */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:13:26 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 71CE6E7C; Mon, 3 Jun 2013 18:13:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6362B1DE8; Mon, 3 Jun 2013 18:13:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53IDQ6x008165; Mon, 3 Jun 2013 18:13:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53IDQvc008164; Mon, 3 Jun 2013 18:13:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306031813.r53IDQvc008164@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 18:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251329 - stable/8/sys/amd64/ia32 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:13:26 -0000 Author: kib Date: Mon Jun 3 18:13:25 2013 New Revision: 251329 URL: http://svnweb.freebsd.org/changeset/base/251329 Log: MFC r251037: The ia32_get_mcontext() does not need to set PCB_FULL_IRET. Modified: stable/8/sys/amd64/ia32/ia32_signal.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) Modified: stable/8/sys/amd64/ia32/ia32_signal.c ============================================================================== --- stable/8/sys/amd64/ia32/ia32_signal.c Mon Jun 3 18:07:04 2013 (r251328) +++ stable/8/sys/amd64/ia32/ia32_signal.c Mon Jun 3 18:13:25 2013 (r251329) @@ -187,7 +187,6 @@ ia32_get_mcontext(struct thread *td, str mcp->mc_xfpustate = 0; mcp->mc_xfpustate_len = 0; bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2)); - set_pcb_flags(pcb, PCB_FULL_IRET); return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:14:19 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 336A7FE7; Mon, 3 Jun 2013 18:14:19 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 25F4C1DF0; Mon, 3 Jun 2013 18:14:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53IEJ9r008407; Mon, 3 Jun 2013 18:14:19 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53IEIGr008405; Mon, 3 Jun 2013 18:14:18 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031814.r53IEIGr008405@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 18:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251330 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:14:19 -0000 Author: kargl Date: Mon Jun 3 18:14:18 2013 New Revision: 251330 URL: http://svnweb.freebsd.org/changeset/base/251330 Log: Update a comment to reflect that we are using an endpoint of an interval instead of a midpoint. Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 18:13:25 2013 (r251329) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 18:14:18 2013 (r251330) @@ -226,7 +226,7 @@ expl(long double x) return (1.0L + x); } - /* Reduce x to (k*ln2 + midpoint[n2] + r1 + r2). */ + /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ fn = x * INV_L + 0x1.8p112 - 0x1.8p112; n = (int)fn; n2 = (unsigned)n % INTERVALS; Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 18:13:25 2013 (r251329) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 18:14:18 2013 (r251330) @@ -261,7 +261,7 @@ expl(long double x) ENTERI(); - /* Reduce x to (k*ln2 + midpoint[n2] + r1 + r2). */ + /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ /* Use a specialized rint() to get fn. Assume round-to-nearest. */ fn = x * INV_L + 0x1.8p63 - 0x1.8p63; r = x - fn * L1 - fn * L2; /* r = r1 + r2 done independently. */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:15:48 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A8A06313; Mon, 3 Jun 2013 18:15:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9AE501E12; Mon, 3 Jun 2013 18:15:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53IFmaX008760; Mon, 3 Jun 2013 18:15:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53IFmlu008759; Mon, 3 Jun 2013 18:15:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306031815.r53IFmlu008759@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 18:15:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251331 - stable/8/sys/amd64/ia32 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:15:48 -0000 Author: kib Date: Mon Jun 3 18:15:48 2013 New Revision: 251331 URL: http://svnweb.freebsd.org/changeset/base/251331 Log: MFC r251038: Use _MC_IA32_HASFPXSTATE name instead of _MC_HASFPXSTATE. Modified: stable/8/sys/amd64/ia32/ia32_signal.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) Modified: stable/8/sys/amd64/ia32/ia32_signal.c ============================================================================== --- stable/8/sys/amd64/ia32/ia32_signal.c Mon Jun 3 18:14:18 2013 (r251330) +++ stable/8/sys/amd64/ia32/ia32_signal.c Mon Jun 3 18:15:48 2013 (r251331) @@ -112,7 +112,7 @@ ia32_get_fpcontext(struct thread *td, st len = max_len; bzero(xfpusave + max_len, len - max_len); } - mcp->mc_flags |= _MC_HASFPXSTATE; + mcp->mc_flags |= _MC_IA32_HASFPXSTATE; mcp->mc_xfpustate_len = len; bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:17:48 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BBCB9492; Mon, 3 Jun 2013 18:17:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 942D31E26; Mon, 3 Jun 2013 18:17:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53IHmNr009182; Mon, 3 Jun 2013 18:17:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53IHmMx009176; Mon, 3 Jun 2013 18:17:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306031817.r53IHmMx009176@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 Jun 2013 18:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251332 - in stable/8/sys: amd64/amd64 amd64/ia32 i386/i386 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:17:48 -0000 Author: kib Date: Mon Jun 3 18:17:47 2013 New Revision: 251332 URL: http://svnweb.freebsd.org/changeset/base/251332 Log: MFC r251039: Use slightly more idiomatic expression to get the address of array. Modified: stable/8/sys/amd64/amd64/machdep.c stable/8/sys/amd64/ia32/ia32_signal.c stable/8/sys/i386/i386/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) stable/8/sys/i386/ (props changed) Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Mon Jun 3 18:15:48 2013 (r251331) +++ stable/8/sys/amd64/amd64/machdep.c Mon Jun 3 18:17:47 2013 (r251332) @@ -2221,7 +2221,7 @@ get_fpcontext(struct thread *td, mcontex size_t max_len, len; mcp->mc_ownedfp = fpugetregs(td); - bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate, + bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); if (!use_xsave || xfpusave_len == 0) Modified: stable/8/sys/amd64/ia32/ia32_signal.c ============================================================================== --- stable/8/sys/amd64/ia32/ia32_signal.c Mon Jun 3 18:15:48 2013 (r251331) +++ stable/8/sys/amd64/ia32/ia32_signal.c Mon Jun 3 18:17:47 2013 (r251332) @@ -101,7 +101,7 @@ ia32_get_fpcontext(struct thread *td, st * for now, it should be irrelevant for most applications. */ mcp->mc_ownedfp = fpugetregs(td); - bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate, + bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); if (!use_xsave || xfpusave_len == 0) Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Mon Jun 3 18:15:48 2013 (r251331) +++ stable/8/sys/i386/i386/machdep.c Mon Jun 3 18:17:47 2013 (r251332) @@ -3385,7 +3385,7 @@ get_fpcontext(struct thread *td, mcontex bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate)); #else mcp->mc_ownedfp = npxgetregs(td); - bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate, + bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = npxformat(); #endif From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:18:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 482D95F8; Mon, 3 Jun 2013 18:18:09 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3B6661E2A; Mon, 3 Jun 2013 18:18:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53II9EK009296; Mon, 3 Jun 2013 18:18:09 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53II9pp009295; Mon, 3 Jun 2013 18:18:09 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031818.r53II9pp009295@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 18:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251333 - head/lib/msun/ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:18:09 -0000 Author: kargl Date: Mon Jun 3 18:18:08 2013 New Revision: 251333 URL: http://svnweb.freebsd.org/changeset/base/251333 Log: Rename a few P2, P3, ... coefficients to A2, A3, ... missed in my previous commit. Modified: head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 18:17:47 2013 (r251332) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 18:18:08 2013 (r251333) @@ -290,10 +290,10 @@ expl(long double x) /* Evaluate expl(midpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). */ /* Here q = q(r), not q(r1), since r1 is lopped like L1. */ - t45 = r * P5 + P4; + t45 = r * A5 + A4; z = r * r; - t23 = r * P3 + P2; - q = r2 + z * t23 + z * z * t45 + z * z * z * P6; + t23 = r * A3 + A2; + q = r2 + z * t23 + z * z * t45 + z * z * z * A6; t = (long double)tbl[n2].lo + tbl[n2].hi; t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:30:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CBE6CAB8; Mon, 3 Jun 2013 18:30:09 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id 8E8201EB0; Mon, 3 Jun 2013 18:30:09 +0000 (UTC) Received: from sladejones-sslvpn-nc.jnpr.net (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mail.xcllnt.net (8.14.7/8.14.7) with ESMTP id r53IU2U9029090 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 3 Jun 2013 11:30:03 -0700 (PDT) (envelope-from marcel@xcllnt.net) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: svn commit: r250991 - in head: contrib/jemalloc/include/jemalloc include lib/libc/stdlib/jemalloc From: Marcel Moolenaar In-Reply-To: Date: Mon, 3 Jun 2013 11:29:57 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201305251859.r4PIxChc053341@svn.freebsd.org> <51AC9933.7050201@FreeBSD.org> To: Peter Wemm X-Mailer: Apple Mail (2.1503) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , Dimitry Andric , src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:30:09 -0000 On Jun 3, 2013, at 10:44 AM, Peter Wemm wrote: >>=20 >> Unfortunately, this means python needs to be recompiled from ports = with >> the following fix: >>=20 >> Index: files/patch-Modules-_ctypes-libffi-fficonfig.py.in >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- files/patch-Modules-_ctypes-libffi-fficonfig.py.in (revision 0) >> +++ files/patch-Modules-_ctypes-libffi-fficonfig.py.in (working = copy) >> @@ -0,0 +1,10 @@ >> +--- Modules/_ctypes/libffi/fficonfig.py.in.orig 2013-06-03 = 07:16:44.000000000 -0700 >> ++++ Modules/_ctypes/libffi/fficonfig.py.in 2013-06-03 = 07:17:03.000000000 -0700 >> +@@ -1,7 +1,6 @@ >> + ffi_sources =3D """ >> + src/prep_cif.c >> + src/closures.c >> +-src/dlmalloc.c >> + """.split() >> + >> + ffi_platforms =3D { >>=20 >> This has been tested with python-2.7.5. I can't say anything about >> other versions. >>=20 >> Do people concur that this is the right fix? >=20 > Forgive me for asking dumb questions, but: >=20 > * Does this fix the firefox, chromium etc problems? (were they linked > to python?) libffi and this _ctypes.so is (based on an educated guess) the core of Python bindings. Anything that has a python binding is likely to have been broken. > * Even if the python code is wrong, is this one of those things that's > going to keep biting us going forward? Interactions between > dlopen/dlsym/rtld/library dependencies/embedded malloc > replacements/etc has been accumulated a large number of casualties > over the years. Possibly. We do not seem to have ever had weak symbols for malloc() et al. Any shared library that exports malloc() and/or friends is potentially causing breakages. Those are breakages only seen on FreeBSD, I would think. I can do some analysis if people prefer. All it takes is the complete set of packages and run nm on any ELF files to see if malloc() or friends is defined as a global symbol to havea protential problem. With a bit of scripting we can come up with a list of candidates. We can go from there... --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:40:01 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 46433E69; Mon, 3 Jun 2013 18:40:01 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 28D251F03; Mon, 3 Jun 2013 18:40:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53Ie1gJ017158; Mon, 3 Jun 2013 18:40:01 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53Ie0Z5017152; Mon, 3 Jun 2013 18:40:00 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031840.r53Ie0Z5017152@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 18:40:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251334 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:40:01 -0000 Author: kargl Date: Mon Jun 3 18:40:00 2013 New Revision: 251334 URL: http://svnweb.freebsd.org/changeset/base/251334 Log: ld80/s_expl.c: * Update the evaluation of the polynomial. This allows the removal of the now unused variables t23 and t45. ld128/s_expl.c: * Update the evaluation of the polynomial and the intermediate result t. This update allows several numerical constants to be written as double rather than long double constants. Update the constants as appropriate. Obtained from: bde Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 18:18:08 2013 (r251333) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 18:40:00 2013 (r251334) @@ -41,28 +41,48 @@ __FBSDID("$FreeBSD$"); #define LOG2_INTERVALS 7 #define BIAS (LDBL_MAX_EXP - 1) +static const long double +huge = 0x1p10000L, +twom10000 = 0x1p-10000L, +/* XXX Prevent gcc from erroneously constant folding this: */ static volatile const long double tiny = 0x1p-10000L; static const long double -INV_L = 1.84664965233787316142070359168242182e+02L, -L1 = 5.41521234812457272982212595914567508e-03L, -L2 = -1.02536706388947310094527932552595546e-29L, -huge = 0x1p10000L, +/* log(2**16384 - 0.5) rounded towards zero: */ +/* log(2**16384 - 0.5 + 1) rounded towards zero for expm1l() is the same: */ o_threshold = 11356.523406294143949491931077970763428L, -twom10000 = 0x1p-10000L, +/* log(2**(-16381-64-1)) rounded towards zero: */ u_threshold = -11433.462743336297878837243843452621503L; +static const double +/* + * ln2/INTERVALS = L1+L2 (hi+lo decomposition for multiplication). L1 must + * have at least 22 (= log2(|LDBL_MIN_EXP-extras|) + log2(INTERVALS)) lowest + * bits zero so that multiplication of it by n is exact. + */ +INV_L = 1.8466496523378731e+2, /* 0x171547652b82fe.0p-45 */ +L2 = -1.0253670638894731e-29; /* -0x1.9ff0342542fc3p-97 */ +static const long double +/* 0x1.62e42fefa39ef35793c768000000p-8 */ +L1 = 5.41521234812457272982212595914567508e-3L; + static const long double -A2 = 5.00000000000000000000000000000000000e-1L, -A3 = 1.66666666666666666666666666666666972e-1L, -A4 = 4.16666666666666666666666666653708268e-2L, -A5 = 8.33333333333333333333333315069867254e-3L, -A6 = 1.38888888888888888888996596213795377e-3L, -A7 = 1.98412698412698412718821436278644414e-4L, -A8 = 2.48015873015869681884882576649543128e-5L, -A9 = 2.75573192240103867817876199544468806e-6L, -A10 = 2.75573236172670046201884000197885520e-7L, -A11 = 2.50517544183909126492878226167697856e-8L; +/* + * Domain [-0.002708, 0.002708], range ~[-2.4011e-38, 2.4244e-38]: + * |exp(x) - p(x)| < 2**-124.9 + * (0.002708 is ln2/(2*INTERVALS) rounded up a little). + */ +A2 = 0.5, +A3 = 1.66666666666666666666666666651085500e-1L, +A4 = 4.16666666666666666666666666425885320e-2L, +A5 = 8.33333333333333333334522877160175842e-3L, +A6 = 1.38888888888888888889971139751596836e-3L; + +static const double +A7 = 1.9841269841269471e-4, +A8 = 2.4801587301585284e-5, +A9 = 2.7557324277411234e-6, +A10 = 2.7557333722375072e-7; static const struct { long double hi; @@ -202,7 +222,9 @@ long double expl(long double x) { union IEEEl2bits u, v; - long double fn, r, r1, r2, q, t, twopk, twopkp10000; + long double q, r, r1, t, twopk, twopkp10000; + double dr, fn, r2; + int k, n, n2; uint32_t hx, ix; @@ -227,8 +249,15 @@ expl(long double x) } /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ - fn = x * INV_L + 0x1.8p112 - 0x1.8p112; + /* Use a specialized rint() to get fn. Assume round-to-nearest. */ + /* XXX assume no extra precision for the additions, as for trig fns. */ + /* XXX this set of comments is now quadruplicated. */ + fn = (double)x * INV_L + 0x1.8p52 - 0x1.8p52; +#if defined(HAVE_EFFICIENT_IRINT) + n = irint(fn); +#else n = (int)fn; +#endif n2 = (unsigned)n % INTERVALS; k = n >> LOG2_INTERVALS; r1 = x - fn * L1; @@ -245,11 +274,12 @@ expl(long double x) twopkp10000 = v.e; } - r = r1 + r2; - q = r * r * (A2 + r * (A3 + r * (A4 + r * (A5 + r * (A6 + r * (A7 + - r * (A8 + r * (A9 + r * (A10 + r * A11))))))))); + /* Evaluate expl(endpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). */ + dr = r; + q = r2 + r * r * (A2 + r * (A3 + r * (A4 + r * (A5 + r * (A6 + + dr * (A7 + dr * (A8 + dr * (A9 + dr * A10)))))))); t = tbl[n2].lo + tbl[n2].hi; - t = tbl[n2].hi + (tbl[n2].lo + t * (r2 + q + r1)); + t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; /* Scale by 2**k. */ if (k >= LDBL_MIN_EXP) { Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 18:18:08 2013 (r251333) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 18:40:00 2013 (r251334) @@ -235,7 +235,8 @@ long double expl(long double x) { union IEEEl2bits u, v; - long double fn, q, r, r1, r2, t, t23, t45, twopk, twopkp10000, z; + long double fn, q, r, r1, r2, t, twopk, twopkp10000; + long double z; int k, n, n2; uint16_t hx, ix; @@ -288,12 +289,9 @@ expl(long double x) twopkp10000 = v.e; } - /* Evaluate expl(midpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). */ - /* Here q = q(r), not q(r1), since r1 is lopped like L1. */ - t45 = r * A5 + A4; + /* Evaluate expl(endpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). */ z = r * r; - t23 = r * A3 + A2; - q = r2 + z * t23 + z * z * t45 + z * z * z * A6; + q = r2 + z * (A2 + r * A3) + z * z * (A4 + r * A5) + z * z * z * A6; t = (long double)tbl[n2].lo + tbl[n2].hi; t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:51:35 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C27036EE; Mon, 3 Jun 2013 18:51:35 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 99BDA1FC3; Mon, 3 Jun 2013 18:51:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53IpZkP022652; Mon, 3 Jun 2013 18:51:35 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53IpZle022650; Mon, 3 Jun 2013 18:51:35 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031851.r53IpZle022650@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 18:51:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251335 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:51:35 -0000 Author: kargl Date: Mon Jun 3 18:51:34 2013 New Revision: 251335 URL: http://svnweb.freebsd.org/changeset/base/251335 Log: ld80/s_expl.c: * In the special case x = -Inf or -NaN, use a micro-optimization to eliminate the need to access u.xbits.man. * Fix an off-by-one for small arguments |x| < 0x1p-65. ld128/s_expl.c: * In the special case x = -Inf or -NaN, use a micro-optimization to eliminate the need to access u.xbits.manh and u.xbits.manl. * Fix an off-by-one for small arguments |x| < 0x1p-114. Obtained from: bde Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 18:40:00 2013 (r251334) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 18:51:34 2013 (r251335) @@ -234,18 +234,16 @@ expl(long double x) ix = hx & 0x7fff; if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { - if (hx & 0x8000 && u.xbits.manh == 0 && - u.xbits.manl == 0) - return (0.0L); /* x is -Inf */ + if (hx & 0x8000) /* x is -Inf or -NaN */ + return (-1 / x); return (x + x); /* x is +Inf or NaN */ } if (x > o_threshold) return (huge * huge); if (x < u_threshold) return (tiny * tiny); - } else if (ix < BIAS - 115) { /* |x| < 0x1p-115 */ - if (huge + x > 1.0L) /* trigger inexact iff x != 0 */ - return (1.0L + x); + } else if (ix < BIAS - 114) { /* |x| < 0x1p-114 */ + return (1 + x); /* 1 with inexact iff x != 0 */ } /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 18:40:00 2013 (r251334) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 18:51:34 2013 (r251335) @@ -246,18 +246,16 @@ expl(long double x) ix = hx & 0x7fff; if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { - if (hx & 0x8000 && u.xbits.man == 1ULL << 63) - return (0.0L); /* x is -Inf */ - return (x + x); /* x is +Inf, NaN or unsupported */ + if (hx & 0x8000) /* x is -Inf, -NaN or unsupported */ + return (-1 / x); + return (x + x); /* x is +Inf, +NaN or unsupported */ } if (x > o_threshold) return (huge * huge); if (x < u_threshold) return (tiny * tiny); - } else if (ix < BIAS - 66) { /* |x| < 0x1p-66 */ - /* includes pseudo-denormals */ - if (huge + x > 1.0L) /* trigger inexact iff x != 0 */ - return (1.0L + x); + } else if (ix < BIAS - 65) { /* |x| < 0x1p-65 (includes pseudos) */ + return (1 + x); /* 1 with inexact iff x != 0 */ } ENTERI(); From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:52:14 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EE2A18F0; Mon, 3 Jun 2013 18:52:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E0E3D1FCF; Mon, 3 Jun 2013 18:52:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53IqEkw022832; Mon, 3 Jun 2013 18:52:14 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53IqEIC022831; Mon, 3 Jun 2013 18:52:14 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306031852.r53IqEIC022831@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 3 Jun 2013 18:52:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251336 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:52:15 -0000 Author: pfg Date: Mon Jun 3 18:52:14 2013 New Revision: 251336 URL: http://svnweb.freebsd.org/changeset/base/251336 Log: ext2fs: Update Block Group Descriptor struct. Uncover some, previously reserved, fields that are used by Ext4. These are currently unused but it is good to have them for future reference. Reviewed by: bde MFC after: 3 days Modified: head/sys/fs/ext2fs/ext2fs.h Modified: head/sys/fs/ext2fs/ext2fs.h ============================================================================== --- head/sys/fs/ext2fs/ext2fs.h Mon Jun 3 18:51:34 2013 (r251335) +++ head/sys/fs/ext2fs/ext2fs.h Mon Jun 3 18:52:14 2013 (r251336) @@ -281,9 +281,13 @@ struct ext2_gd { uint32_t ext2bgd_i_tables; /* inodes table block */ uint16_t ext2bgd_nbfree; /* number of free blocks */ uint16_t ext2bgd_nifree; /* number of free inodes */ - uint16_t ext2bgd_ndirs; /* number of directories */ - uint16_t reserved; - uint32_t reserved2[3]; + uint16_t ext2bgd_ndirs; /* number of directories */ + uint16_t ext2bgd_flags; /* block group flags */ + uint32_t ext2bgd_x_bitmap; /* snapshot exclusion bitmap loc. */ + uint16_t ext2bgd_b_bmap_csum; /* block bitmap checksum */ + uint16_t ext2bgd_i_bmap_csum; /* inode bitmap checksum */ + uint16_t ext2bgd_i_unused; /* unused inode count */ + uint16_t ext2bgd_csum; /* group descriptor checksum */ }; /* cluster summary information */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:53:41 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5570BAF0; Mon, 3 Jun 2013 18:53:41 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 47E431FE8; Mon, 3 Jun 2013 18:53:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53IrfBG023129; Mon, 3 Jun 2013 18:53:41 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53IrfEF023128; Mon, 3 Jun 2013 18:53:41 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031853.r53IrfEF023128@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 18:53:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251337 - head/lib/msun/ld128 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:53:41 -0000 Author: kargl Date: Mon Jun 3 18:53:40 2013 New Revision: 251337 URL: http://svnweb.freebsd.org/changeset/base/251337 Log: Add a comment to note that bde supplied most, if not all, of the optimizations. Modified: head/lib/msun/ld128/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 18:52:14 2013 (r251336) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 18:53:40 2013 (r251337) @@ -22,6 +22,8 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Optimized by Bruce D. Evans. */ #include From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 18:57:36 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6E46FDC2; Mon, 3 Jun 2013 18:57:36 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 60377102A; Mon, 3 Jun 2013 18:57:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53Iva3X023938; Mon, 3 Jun 2013 18:57:36 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53IvajA023936; Mon, 3 Jun 2013 18:57:36 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031857.r53IvajA023936@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 18:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251338 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:57:36 -0000 Author: kargl Date: Mon Jun 3 18:57:35 2013 New Revision: 251338 URL: http://svnweb.freebsd.org/changeset/base/251338 Log: Micro-optimization: move the unary mius operator to operate on a literal constant. Obtained from: bde Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 18:53:40 2013 (r251337) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 18:57:35 2013 (r251338) @@ -261,7 +261,7 @@ expl(long double x) n2 = (unsigned)n % INTERVALS; k = n >> LOG2_INTERVALS; r1 = x - fn * L1; - r2 = -fn * L2; + r2 = fn * -L2; /* Prepare scale factors. */ v.xbits.manh = 0; Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 18:53:40 2013 (r251337) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 18:57:35 2013 (r251338) @@ -275,10 +275,10 @@ expl(long double x) /* Depend on the sign bit being propagated: */ k = n >> LOG2_INTERVALS; r1 = x - fn * L1; - r2 = -fn * L2; + r2 = fn * -L2; /* Prepare scale factors. */ - v.xbits.man = 1ULL << 63; + v.e = 1ULL << 63; if (k >= LDBL_MIN_EXP) { v.xbits.expsign = BIAS + k; twopk = v.e; From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 19:13:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A340841B; Mon, 3 Jun 2013 19:13:45 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7B99E10E4; Mon, 3 Jun 2013 19:13:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53JDj2w030842; Mon, 3 Jun 2013 19:13:45 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53JDjc5030838; Mon, 3 Jun 2013 19:13:45 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031913.r53JDjc5030838@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 19:13:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251339 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 19:13:45 -0000 Author: kargl Date: Mon Jun 3 19:13:44 2013 New Revision: 251339 URL: http://svnweb.freebsd.org/changeset/base/251339 Log: ld80/s_expl.c: * Use integral numerical constants, and let the compiler do the conversion to long double. ld128/s_expl.c: * Use integral numerical constants, and let the compiler do the conversion to long double. * Use the ENTERI/RETURNI macros, which are no-ops on ld128. This however makes the ld80 and ld128 identical. Reviewed by: bde (as part of larger diff) Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 18:57:35 2013 (r251338) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 19:13:44 2013 (r251339) @@ -228,7 +228,7 @@ expl(long double x) double dr, fn, r2; int k, n, n2; - uint32_t hx, ix; + uint16_t hx, ix; /* Filter out exceptional cases. */ u.e = x; @@ -248,6 +248,8 @@ expl(long double x) return (1 + x); /* 1 with inexact iff x != 0 */ } + ENTERI(); + /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ /* Use a specialized rint() to get fn. Assume round-to-nearest. */ /* XXX assume no extra precision for the additions, as for trig fns. */ @@ -262,10 +264,11 @@ expl(long double x) k = n >> LOG2_INTERVALS; r1 = x - fn * L1; r2 = fn * -L2; + r = r1 + r2; /* Prepare scale factors. */ - v.xbits.manh = 0; - v.xbits.manl = 0; + /* XXX sparc64 multiplication is so slow that scalbnl() is faster. */ + v.e = 1; if (k >= LDBL_MIN_EXP) { v.xbits.expsign = BIAS + k; twopk = v.e; @@ -284,9 +287,9 @@ expl(long double x) /* Scale by 2**k. */ if (k >= LDBL_MIN_EXP) { if (k == LDBL_MAX_EXP) - return (t * 2.0L * 0x1p16383L); - return (t * twopk); + RETURNI(t * 2 * 0x1p16383L); + RETURNI(t * twopk); } else { - return (t * twopkp10000 * twom10000); + RETURNI(t * twopkp10000 * twom10000); } } Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 18:57:35 2013 (r251338) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 19:13:44 2013 (r251339) @@ -278,7 +278,7 @@ expl(long double x) r2 = fn * -L2; /* Prepare scale factors. */ - v.e = 1ULL << 63; + v.e = 1; if (k >= LDBL_MIN_EXP) { v.xbits.expsign = BIAS + k; twopk = v.e; @@ -296,7 +296,7 @@ expl(long double x) /* Scale by 2**k. */ if (k >= LDBL_MIN_EXP) { if (k == LDBL_MAX_EXP) - RETURNI(t * 2.0L * 0x1p16383L); + RETURNI(t * 2 * 0x1p16383L); RETURNI(t * twopk); } else { RETURNI(t * twopkp10000 * twom10000); From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 19:14:29 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E804367C; Mon, 3 Jun 2013 19:14:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DA80610EF; Mon, 3 Jun 2013 19:14:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53JET5g031063; Mon, 3 Jun 2013 19:14:29 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53JETC5031062; Mon, 3 Jun 2013 19:14:29 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306031914.r53JETC5031062@svn.freebsd.org> From: Adrian Chadd Date: Mon, 3 Jun 2013 19:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251340 - head/sys/dev/ath/ath_hal/ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 19:14:30 -0000 Author: adrian Date: Mon Jun 3 19:14:29 2013 New Revision: 251340 URL: http://svnweb.freebsd.org/changeset/base/251340 Log: Fix receive on the AR9285 (Kite) with only one antenna connected. The main problem here is that fast and driver RX diversity isn't actually configured; I need to figure out why that is. That said, this makes the single-antenna connected AR9285 and AR2427 (AR9285 w/ no 11n) work correctly. PR: kern/179269 Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Mon Jun 3 19:13:44 2013 (r251339) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Mon Jun 3 19:14:29 2013 (r251340) @@ -136,7 +136,20 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO * Preserve the antenna on a channel change */ saveDefAntenna = OS_REG_READ(ah, AR_DEF_ANTENNA); - if (saveDefAntenna == 0) /* XXX magic constants */ + + /* + * Don't do this for the AR9285 - it breaks RX for single + * antenna designs when diversity is disabled. + * + * I'm not sure what this was working around; it may be + * something to do with the AR5416. Certainly this register + * isn't supposed to be used by the MIMO chips for anything + * except for defining the default antenna when an external + * phase array / smart antenna is connected. + * + * See PR: kern/179269 . + */ + if ((! AR_SREV_KITE(ah)) && saveDefAntenna == 0) /* XXX magic constants */ saveDefAntenna = 1; /* Save hardware flag before chip reset clears the register */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 19:16:50 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EC639828; Mon, 3 Jun 2013 19:16:50 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id D0B87110C; Mon, 3 Jun 2013 19:16:50 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.6/8.14.6) with ESMTP id r53JGoru089862; Mon, 3 Jun 2013 12:16:50 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.6/8.14.6/Submit) id r53JGoXK089861; Mon, 3 Jun 2013 12:16:50 -0700 (PDT) (envelope-from sgk) Date: Mon, 3 Jun 2013 12:16:50 -0700 From: Steve Kargl To: Steve Kargl Subject: Re: svn commit: r251339 - in head/lib/msun: ld128 ld80 Message-ID: <20130603191650.GA89580@troutmask.apl.washington.edu> References: <201306031913.r53JDjc5030838@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201306031913.r53JDjc5030838@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 19:16:51 -0000 On Mon, Jun 03, 2013 at 07:13:45PM +0000, Steve Kargl wrote: > Author: kargl > Date: Mon Jun 3 19:13:44 2013 > New Revision: 251339 > URL: http://svnweb.freebsd.org/changeset/base/251339 > > Log: > ld80/s_expl.c: > > * Use integral numerical constants, and let the compiler do the > conversion to long double. > > ld128/s_expl.c: > > * Use integral numerical constants, and let the compiler do the > conversion to long double. > * Use the ENTERI/RETURNI macros, which are no-ops on ld128. This > however makes the ld80 and ld128 identical. > > Reviewed by: bde (as part of larger diff) > With this patch, I have hopefully completed a series of changes to ld80/s_expl.c and ld128/s_expl.c, which have accumulated over the last 12-18 months. I tried to separate cosmetic and functional changes. Hopefully, I did not break anything. -- steve From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 19:29:03 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D3B7EF7E; Mon, 3 Jun 2013 19:29:03 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C5C321194; Mon, 3 Jun 2013 19:29:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53JT3YX035831; Mon, 3 Jun 2013 19:29:03 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53JT3Md035830; Mon, 3 Jun 2013 19:29:03 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031929.r53JT3Md035830@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 19:29:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251341 - head/lib/msun/ld128 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 19:29:03 -0000 Author: kargl Date: Mon Jun 3 19:29:03 2013 New Revision: 251341 URL: http://svnweb.freebsd.org/changeset/base/251341 Log: Fix two comments that got lost in the disentanglement of the larger diff. Modified: head/lib/msun/ld128/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 19:14:29 2013 (r251340) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 19:29:03 2013 (r251341) @@ -70,7 +70,7 @@ L1 = 5.41521234812457272982212595914567 static const long double /* - * Domain [-0.002708, 0.002708], range ~[-2.4011e-38, 2.4244e-38]: + * Domain [-0.002708, 0.002708], range ~[-2.4021e-38, 2.4234e-38]: * |exp(x) - p(x)| < 2**-124.9 * (0.002708 is ln2/(2*INTERVALS) rounded up a little). */ @@ -87,6 +87,11 @@ A9 = 2.7557324277411234e-6, A10 = 2.7557333722375072e-7; static const struct { + /* + * hi must be rounded to at most 106 bits so that multiplication + * by r1 in expm1l() is exact, but it is rounded to 88 bits due to + * historical accidents. + */ long double hi; long double lo; } tbl[INTERVALS] = { From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 19:39:38 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2070734C; Mon, 3 Jun 2013 19:39:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EDB0D1207; Mon, 3 Jun 2013 19:39:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53Jdbt6039631; Mon, 3 Jun 2013 19:39:37 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53JdbHE039630; Mon, 3 Jun 2013 19:39:37 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306031939.r53JdbHE039630@svn.freebsd.org> From: Adrian Chadd Date: Mon, 3 Jun 2013 19:39:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251342 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 19:39:38 -0000 Author: adrian Date: Mon Jun 3 19:39:37 2013 New Revision: 251342 URL: http://svnweb.freebsd.org/changeset/base/251342 Log: Fix the order of TX shutdown and reset. * Grab the reset lock first, so any subsequent interrupt, TX, RX work will fail * Then shut down interrupts * Then wait for TX/RX to finish running At this point no further work will be running, so it's safe to do the reset path code. PR: kern/179232 Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Jun 3 19:29:03 2013 (r251341) +++ head/sys/dev/ath/if_ath.c Mon Jun 3 19:39:37 2013 (r251342) @@ -2328,12 +2328,27 @@ ath_reset(struct ifnet *ifp, ATH_RESET_T taskqueue_block(sc->sc_tq); ATH_PCU_LOCK(sc); - ath_hal_intrset(ah, 0); /* disable interrupts */ - ath_txrx_stop_locked(sc); /* Ensure TX/RX is stopped */ + + /* + * Grab the reset lock before TX/RX is stopped. + * + * This is needed to ensure that when the TX/RX actually does finish, + * no further TX/RX/reset runs in parallel with this. + */ if (ath_reset_grablock(sc, 1) == 0) { device_printf(sc->sc_dev, "%s: concurrent reset! Danger!\n", __func__); } + + /* disable interrupts */ + ath_hal_intrset(ah, 0); + + /* + * Now, ensure that any in progress TX/RX completes before we + * continue. + */ + ath_txrx_stop_locked(sc); + ATH_PCU_UNLOCK(sc); /* @@ -4871,12 +4886,18 @@ ath_chan_set(struct ath_softc *sc, struc taskqueue_block(sc->sc_tq); ATH_PCU_LOCK(sc); - ath_hal_intrset(ah, 0); /* Stop new RX/TX completion */ - ath_txrx_stop_locked(sc); /* Stop pending RX/TX completion */ + + /* Stop new RX/TX/interrupt completion */ if (ath_reset_grablock(sc, 1) == 0) { device_printf(sc->sc_dev, "%s: concurrent reset! Danger!\n", __func__); } + + ath_hal_intrset(ah, 0); + + /* Stop pending RX/TX completion */ + ath_txrx_stop_locked(sc); + ATH_PCU_UNLOCK(sc); DPRINTF(sc, ATH_DEBUG_RESET, "%s: %u (%u MHz, flags 0x%x)\n", From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 19:51:34 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1C1E66C4; Mon, 3 Jun 2013 19:51:34 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F29681278; Mon, 3 Jun 2013 19:51:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53JpXdY051633; Mon, 3 Jun 2013 19:51:33 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53JpWjS051618; Mon, 3 Jun 2013 19:51:32 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031951.r53JpWjS051618@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 19:51:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251343 - in head/lib/msun: . ld128 ld80 man src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 19:51:34 -0000 Author: kargl Date: Mon Jun 3 19:51:32 2013 New Revision: 251343 URL: http://svnweb.freebsd.org/changeset/base/251343 Log: ld80 and ld128 implementations of expm1l(). This code started life as a fairly faithful implementation of the algorithm found in PTP Tang, "Table-driven implementation of the Expm1 function in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 18, 211-222 (1992). Over the last 18-24 months, the code has under gone significant optimization and testing. Reviewed by: bde Obtained from: bde (most of the optimizations) Modified: head/lib/msun/Symbol.map head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c head/lib/msun/man/exp.3 head/lib/msun/src/math.h head/lib/msun/src/s_expm1.c Modified: head/lib/msun/Symbol.map ============================================================================== --- head/lib/msun/Symbol.map Mon Jun 3 19:39:37 2013 (r251342) +++ head/lib/msun/Symbol.map Mon Jun 3 19:51:32 2013 (r251343) @@ -262,6 +262,7 @@ FBSD_1.3 { ctanh; ctanhf; expl; + expm1l; log10l; log1pl; log2l; Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 19:39:37 2013 (r251342) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 19:51:32 2013 (r251343) @@ -298,3 +298,198 @@ expl(long double x) RETURNI(t * twopkp10000 * twom10000); } } + +/* + * Our T1 and T2 are chosen to be approximately the points where method + * A and method B have the same accuracy. Tang's T1 and T2 are the + * points where method A's accuracy changes by a full bit. For Tang, + * this drop in accuracy makes method A immediately less accurate than + * method B, but our larger INTERVALS makes method A 2 bits more + * accurate so it remains the most accurate method significantly + * closer to the origin despite losing the full bit in our extended + * range for it. + * + * Split the interval [T1, T2] into two intervals [T1, T3] and [T3, T2]. + * Setting T3 to 0 would require the |x| < 0x1p-113 condition to appear + * in both subintervals, so set T3 = 2**-5, which places the condition + * into the [T1, T3] interval. + */ +static const double +T1 = -0.1659, /* ~-30.625/128 * log(2) */ +T2 = 0.1659, /* ~30.625/128 * log(2) */ +T3 = 0.03125; + +/* + * Domain [-0.1659, 0.03125], range ~[2.9134e-44, 1.8404e-37]: + * |(exp(x)-1-x-x**2/2)/x - p(x)| < 2**-122.03 + */ +static const long double +C3 = 1.66666666666666666666666666666666667e-1L, +C4 = 4.16666666666666666666666666666666645e-2L, +C5 = 8.33333333333333333333333333333371638e-3L, +C6 = 1.38888888888888888888888888891188658e-3L, +C7 = 1.98412698412698412698412697235950394e-4L, +C8 = 2.48015873015873015873015112487849040e-5L, +C9 = 2.75573192239858906525606685484412005e-6L, +C10 = 2.75573192239858906612966093057020362e-7L, +C11 = 2.50521083854417203619031960151253944e-8L, +C12 = 2.08767569878679576457272282566520649e-9L, +C13 = 1.60590438367252471783548748824255707e-10L; + +static const double +C14 = 1.1470745580491932e-11, /* 0x1.93974a81dae30p-37 */ +C15 = 7.6471620181090468e-13, /* 0x1.ae7f3820adab1p-41 */ +C16 = 4.7793721460260450e-14, /* 0x1.ae7cd18a18eacp-45 */ +C17 = 2.8074757356658877e-15, /* 0x1.949992a1937d9p-49 */ +C18 = 1.4760610323699476e-16; /* 0x1.545b43aabfbcdp-53 */ + +/* + * Domain [0.03125, 0.1659], range ~[-2.7676e-37, -1.0367e-38]: + * |(exp(x)-1-x-x**2/2)/x - p(x)| < 2**-121.44 + */ +static const long double +D3 = 1.66666666666666666666666666666682245e-1L, +D4 = 4.16666666666666666666666666634228324e-2L, +D5 = 8.33333333333333333333333364022244481e-3L, +D6 = 1.38888888888888888888887138722762072e-3L, +D7 = 1.98412698412698412699085805424661471e-4L, +D8 = 2.48015873015873015687993712101479612e-5L, +D9 = 2.75573192239858944101036288338208042e-6L, +D10 = 2.75573192239853161148064676533754048e-7L, +D11 = 2.50521083855084570046480450935267433e-8L, +D12 = 2.08767569819738524488686318024854942e-9L, +D13 = 1.60590442297008495301927448122499313e-10L; + +static const double +D14 = 1.1470726176204336e-11, /* 0x1.93971dc395d9ep-37 */ +D15 = 7.6478532249581686e-13, /* 0x1.ae892e3D16fcep-41 */ +D16 = 4.7628892832607741e-14, /* 0x1.ad00Dfe41feccp-45 */ +D17 = 3.0524857220358650e-15; /* 0x1.D7e8d886Df921p-49 */ + +long double +expm1l(long double x) +{ + union IEEEl2bits u, v; + long double hx2_hi, hx2_lo, q, r, r1, t, twomk, twopk, x_hi; + long double x_lo, x2; + double dr, dx, fn, r2; + int k, n, n2; + uint16_t hx, ix; + + /* Filter out exceptional cases. */ + u.e = x; + hx = u.xbits.expsign; + ix = hx & 0x7fff; + if (ix >= BIAS + 7) { /* |x| >= 128 or x is NaN */ + if (ix == BIAS + LDBL_MAX_EXP) { + if (hx & 0x8000) /* x is -Inf or -NaN */ + return (-1 / x - 1); + return (x + x); /* x is +Inf or +NaN */ + } + if (x > o_threshold) + return (huge * huge); + /* + * expm1l() never underflows, but it must avoid + * unrepresentable large negative exponents. We used a + * much smaller threshold for large |x| above than in + * expl() so as to handle not so large negative exponents + * in the same way as large ones here. + */ + if (hx & 0x8000) /* x <= -128 */ + return (tiny - 1); /* good for x < -114ln2 - eps */ + } + + ENTERI(); + + if (T1 < x && x < T2) { + x2 = x * x; + dx = x; + + if (x < T3) { + if (ix < BIAS - 113) { /* |x| < 0x1p-113 */ + /* x (rounded) with inexact if x != 0: */ + RETURNI(x == 0 ? x : + (0x1p200 * x + fabsl(x)) * 0x1p-200); + } + q = x * x2 * C3 + x2 * x2 * (C4 + x * (C5 + x * (C6 + + x * (C7 + x * (C8 + x * (C9 + x * (C10 + + x * (C11 + x * (C12 + x * (C13 + + dx * (C14 + dx * (C15 + dx * (C16 + + dx * (C17 + dx * C18)))))))))))))); + } else { + q = x * x2 * D3 + x2 * x2 * (D4 + x * (D5 + x * (D6 + + x * (D7 + x * (D8 + x * (D9 + x * (D10 + + x * (D11 + x * (D12 + x * (D13 + + dx * (D14 + dx * (D15 + dx * (D16 + + dx * D17))))))))))))); + } + + x_hi = (float)x; + x_lo = x - x_hi; + hx2_hi = x_hi * x_hi / 2; + hx2_lo = x_lo * (x + x_hi) / 2; + if (ix >= BIAS - 7) + RETURNI(hx2_lo + x_lo + q + (hx2_hi + x_hi)); + else + RETURNI(hx2_lo + q + hx2_hi + x); + } + + /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ + /* Use a specialized rint() to get fn. Assume round-to-nearest. */ + fn = (double)x * INV_L + 0x1.8p52 - 0x1.8p52; +#if defined(HAVE_EFFICIENT_IRINT) + n = irint(fn); +#else + n = (int)fn; +#endif + n2 = (unsigned)n % INTERVALS; + k = n >> LOG2_INTERVALS; + r1 = x - fn * L1; + r2 = fn * -L2; + r = r1 + r2; + + /* Prepare scale factor. */ + v.e = 1; + v.xbits.expsign = BIAS + k; + twopk = v.e; + + /* + * Evaluate lower terms of + * expl(endpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). + */ + dr = r; + q = r2 + r * r * (A2 + r * (A3 + r * (A4 + r * (A5 + r * (A6 + + dr * (A7 + dr * (A8 + dr * (A9 + dr * A10)))))))); + + t = tbl[n2].lo + tbl[n2].hi; + + if (k == 0) { + t = tbl[n2].lo * (r1 + 1) + t * q + tbl[n2].hi * r1 + + (tbl[n2].hi - 1); + RETURNI(t); + } + if (k == -1) { + t = tbl[n2].lo * (r1 + 1) + t * q + tbl[n2].hi * r1 + + (tbl[n2].hi - 2); + RETURNI(t / 2); + } + if (k < -7) { + t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; + RETURNI(t * twopk - 1); + } + if (k > 2 * LDBL_MANT_DIG - 1) { + t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; + if (k == LDBL_MAX_EXP) + RETURNI(t * 2 * 0x1p16383L - 1); + RETURNI(t * twopk - 1); + } + + v.xbits.expsign = BIAS - k; + twomk = v.e; + + if (k > LDBL_MANT_DIG - 1) + t = tbl[n2].lo - twomk + t * (q + r1) + tbl[n2].hi; + else + t = tbl[n2].lo + t * (q + r1) + (tbl[n2].hi - twomk); + RETURNI(t * twopk); +} Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 19:39:37 2013 (r251342) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 19:51:32 2013 (r251343) @@ -302,3 +302,168 @@ expl(long double x) RETURNI(t * twopkp10000 * twom10000); } } + +/** + * Compute expm1l(x) for Intel 80-bit format. This is based on: + * + * PTP Tang, "Table-driven implementation of the Expm1 function + * in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 18, + * 211-222 (1992). + */ + +/* + * Our T1 and T2 are chosen to be approximately the points where method + * A and method B have the same accuracy. Tang's T1 and T2 are the + * points where method A's accuracy changes by a full bit. For Tang, + * this drop in accuracy makes method A immediately less accurate than + * method B, but our larger INTERVALS makes method A 2 bits more + * accurate so it remains the most accurate method significantly + * closer to the origin despite losing the full bit in our extended + * range for it. + */ +static const double +T1 = -0.1659, /* ~-30.625/128 * log(2) */ +T2 = 0.1659; /* ~30.625/128 * log(2) */ + +/* + * Domain [-0.1659, 0.1659], range ~[-1.2027e-22, 3.4417e-22]: + * |(exp(x)-1-x-x**2/2)/x - p(x)| < 2**-71.2 + */ +static const union IEEEl2bits +B3 = LD80C(0xaaaaaaaaaaaaaaab, -3, 1.66666666666666666671e-1L), +B4 = LD80C(0xaaaaaaaaaaaaaaac, -5, 4.16666666666666666712e-2L); + +static const double +B5 = 8.3333333333333245e-3, /* 0x1.111111111110cp-7 */ +B6 = 1.3888888888888861e-3, /* 0x1.6c16c16c16c0ap-10 */ +B7 = 1.9841269841532042e-4, /* 0x1.a01a01a0319f9p-13 */ +B8 = 2.4801587302069236e-5, /* 0x1.a01a01a03cbbcp-16 */ +B9 = 2.7557316558468562e-6, /* 0x1.71de37fd33d67p-19 */ +B10 = 2.7557315829785151e-7, /* 0x1.27e4f91418144p-22 */ +B11 = 2.5063168199779829e-8, /* 0x1.ae94fabdc6b27p-26 */ +B12 = 2.0887164654459567e-9; /* 0x1.1f122d6413fe1p-29 */ + +long double +expm1l(long double x) +{ + union IEEEl2bits u, v; + long double fn, hx2_hi, hx2_lo, q, r, r1, r2, t, twomk, twopk, x_hi; + long double x_lo, x2, z; + long double x4; + int k, n, n2; + uint16_t hx, ix; + + /* Filter out exceptional cases. */ + u.e = x; + hx = u.xbits.expsign; + ix = hx & 0x7fff; + if (ix >= BIAS + 6) { /* |x| >= 64 or x is NaN */ + if (ix == BIAS + LDBL_MAX_EXP) { + if (hx & 0x8000) /* x is -Inf, -NaN or unsupported */ + return (-1 / x - 1); + return (x + x); /* x is +Inf, +NaN or unsupported */ + } + if (x > o_threshold) + return (huge * huge); + /* + * expm1l() never underflows, but it must avoid + * unrepresentable large negative exponents. We used a + * much smaller threshold for large |x| above than in + * expl() so as to handle not so large negative exponents + * in the same way as large ones here. + */ + if (hx & 0x8000) /* x <= -64 */ + return (tiny - 1); /* good for x < -65ln2 - eps */ + } + + ENTERI(); + + if (T1 < x && x < T2) { + if (ix < BIAS - 64) { /* |x| < 0x1p-64 (includes pseudos) */ + /* x (rounded) with inexact if x != 0: */ + RETURNI(x == 0 ? x : + (0x1p100 * x + fabsl(x)) * 0x1p-100); + } + + x2 = x * x; + x4 = x2 * x2; + q = x4 * (x2 * (x4 * + /* + * XXX the number of terms is no longer good for + * pairwise grouping of all except B3, and the + * grouping is no longer from highest down. + */ + (x2 * B12 + (x * B11 + B10)) + + (x2 * (x * B9 + B8) + (x * B7 + B6))) + + (x * B5 + B4.e)) + x2 * x * B3.e; + + x_hi = (float)x; + x_lo = x - x_hi; + hx2_hi = x_hi * x_hi / 2; + hx2_lo = x_lo * (x + x_hi) / 2; + if (ix >= BIAS - 7) + RETURNI(hx2_lo + x_lo + q + (hx2_hi + x_hi)); + else + RETURNI(hx2_lo + q + hx2_hi + x); + } + + /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ + /* Use a specialized rint() to get fn. Assume round-to-nearest. */ + fn = x * INV_L + 0x1.8p63 - 0x1.8p63; +#if defined(HAVE_EFFICIENT_IRINTL) + n = irintl(fn); +#elif defined(HAVE_EFFICIENT_IRINT) + n = irint(fn); +#else + n = (int)fn; +#endif + n2 = (unsigned)n % INTERVALS; + k = n >> LOG2_INTERVALS; + r1 = x - fn * L1; + r2 = fn * -L2; + r = r1 + r2; + + /* Prepare scale factor. */ + v.e = 1; + v.xbits.expsign = BIAS + k; + twopk = v.e; + + /* + * Evaluate lower terms of + * expl(endpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). + */ + z = r * r; + q = r2 + z * (A2 + r * A3) + z * z * (A4 + r * A5) + z * z * z * A6; + + t = (long double)tbl[n2].lo + tbl[n2].hi; + + if (k == 0) { + t = tbl[n2].lo * (r1 + 1) + t * q + tbl[n2].hi * r1 + + (tbl[n2].hi - 1); + RETURNI(t); + } + if (k == -1) { + t = tbl[n2].lo * (r1 + 1) + t * q + tbl[n2].hi * r1 + + (tbl[n2].hi - 2); + RETURNI(t / 2); + } + if (k < -7) { + t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; + RETURNI(t * twopk - 1); + } + if (k > 2 * LDBL_MANT_DIG - 1) { + t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; + if (k == LDBL_MAX_EXP) + RETURNI(t * 2 * 0x1p16383L - 1); + RETURNI(t * twopk - 1); + } + + v.xbits.expsign = BIAS - k; + twomk = v.e; + + if (k > LDBL_MANT_DIG - 1) + t = tbl[n2].lo - twomk + t * (q + r1) + tbl[n2].hi; + else + t = tbl[n2].lo + t * (q + r1) + (tbl[n2].hi - twomk); + RETURNI(t * twopk); +} Modified: head/lib/msun/man/exp.3 ============================================================================== --- head/lib/msun/man/exp.3 Mon Jun 3 19:39:37 2013 (r251342) +++ head/lib/msun/man/exp.3 Mon Jun 3 19:51:32 2013 (r251343) @@ -28,7 +28,7 @@ .\" from: @(#)exp.3 6.12 (Berkeley) 7/31/91 .\" $FreeBSD$ .\" -.Dd July 10, 2012 +.Dd June 3, 2013 .Dt EXP 3 .Os .Sh NAME @@ -41,6 +41,7 @@ .Nm exp2l , .Nm expm1 , .Nm expm1f , +.Nm expm1l , .Nm pow , .Nm powf .Nd exponential and power functions @@ -64,6 +65,8 @@ .Fn expm1 "double x" .Ft float .Fn expm1f "float x" +.Ft long double +.Fn expm1l "long double x" .Ft double .Fn pow "double x" "double y" .Ft float @@ -88,9 +91,10 @@ functions compute the base 2 exponential .Fa x . .Pp The -.Fn expm1 +.Fn expm1 , +.Fn expm1f , and the -.Fn expm1f +.Fn expm1l functions compute the value exp(x)\-1 accurately even for tiny argument .Fa x . .Pp Modified: head/lib/msun/src/math.h ============================================================================== --- head/lib/msun/src/math.h Mon Jun 3 19:39:37 2013 (r251342) +++ head/lib/msun/src/math.h Mon Jun 3 19:51:32 2013 (r251343) @@ -405,6 +405,7 @@ long double copysignl(long double, long long double cosl(long double); long double exp2l(long double); long double expl(long double); +long double expm1l(long double); long double fabsl(long double) __pure2; long double fdiml(long double, long double); long double floorl(long double); @@ -466,7 +467,6 @@ long double atanhl(long double); long double coshl(long double); long double erfcl(long double); long double erfl(long double); -long double expm1l(long double); long double lgammal(long double); long double powl(long double, long double); long double sinhl(long double); Modified: head/lib/msun/src/s_expm1.c ============================================================================== --- head/lib/msun/src/s_expm1.c Mon Jun 3 19:39:37 2013 (r251342) +++ head/lib/msun/src/s_expm1.c Mon Jun 3 19:51:32 2013 (r251343) @@ -216,3 +216,7 @@ expm1(double x) } return y; } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(expm1, expm1l); +#endif From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 19:57:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 556598A3; Mon, 3 Jun 2013 19:57:42 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id 3DCCA12AF; Mon, 3 Jun 2013 19:57:42 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.6/8.14.6) with ESMTP id r53Jvf8Y090123; Mon, 3 Jun 2013 12:57:41 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.6/8.14.6/Submit) id r53JvfR9090122; Mon, 3 Jun 2013 12:57:41 -0700 (PDT) (envelope-from sgk) Date: Mon, 3 Jun 2013 12:57:41 -0700 From: Steve Kargl To: Steve Kargl Subject: Re: svn commit: r251343 - in head/lib/msun: . ld128 ld80 man src Message-ID: <20130603195741.GC89580@troutmask.apl.washington.edu> References: <201306031951.r53JpWjS051618@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201306031951.r53JpWjS051618@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 19:57:42 -0000 On Mon, Jun 03, 2013 at 07:51:32PM +0000, Steve Kargl wrote: > Author: kargl > Date: Mon Jun 3 19:51:32 2013 > New Revision: 251343 > URL: http://svnweb.freebsd.org/changeset/base/251343 > > Log: > ld80 and ld128 implementations of expm1l(). This code started life > as a fairly faithful implementation of the algorithm found in > > PTP Tang, "Table-driven implementation of the Expm1 function > in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 18, > 211-222 (1992). > > Over the last 18-24 months, the code has under gone significant > optimization and testing. > > Reviewed by: bde > Obtained from: bde (most of the optimizations) > For those people that care, here is the data from my last round of testing expl and expm1l. (Best read in 90+column window.) These were obtained using GCC in the base system. expl Timing: 1M 2M 10M 100M i386 [-11355.0:11356.0] 0.088302 0.867567 8.64871 amd64 [-11355.0:11356.0] 0.062994 0.631960 6.30295 sparc64 [-11355.0:11356.0] 39.5309 79.1927 Accuracy: M Max ULP x at Max ULP i386 [-11355.0:11356.0] 1 0.50465 -3.5510383760383760e+03 -0x1.bbe13a6062b8cdd4p+11 i386 [-11355.0:11356.0] 10 0.50556 -9.6479456830945683e+03 -0x1.2d7f90c24c5c686p+13 i386 [-11355.0:11356.0] 100 0.50654 -7.9982712426427124e+03 -0x1.f3e45702867bb01p+12 amd64 [-11355.0:11356.0] 1 0.50465 -3.5510383760383760e+03 -0x1.bbe13a6062b8cdd4p+11 amd64 [-11355.0:11356.0] 10 0.50556 -9.6479456830945683e+03 -0x1.2d7f90c24c5c686p+13 amd64 [-11355.0:11356.0] 100 0.50654 -7.9982712426427124e+03 -0x1.f3e45702867bb01p+12 sparc64 [-11355.0:11356.0] 1 0.50619 1.79779355979355979355979355979355983e+03 sparc64 {-11355.0:11356.0] 2 0.50541 1.11496704618352309176154588077294027e+04 expm1l Timing: 1M 10M 100M i386 [-64.0000:-0.1659] 0.435783 4.342621 43.41397 i386 [ -0.1659: 0.1659] 0.082880 0.829142 8.28948 i386 [ 0.1659:11356.0] 0.110590 1.096098 10.96253 amd64 [-64.0000:-0.1659] 0.066751 0.648734 6.46649 amd64 [ -0.1659: 0.1659] 0.061531 0.614824 6.14377 amd64 [ 0.1659:11356.0] 0.071677 0.716927 7.16819 sparc64 [-113.000:-0.1659] 37.84224 sparc64 [ -0.1659: 0.1659] 66.28533 sparc64 [ 0.1659:11356.0] 41.20714 Accuracy: M Max ULP x at Max ULP i386 [-64.0000:-0.1659] 1 0.50824 -1.7579429539429599e-01 -0x1.6806d6ec55bd2cp-3 i386 [ -0.1659: 0.1659] 1 0.50807 1.5765476175476175e-01 0x1.42e07fee5cecaa04p-3 i386 [ 0.1659:11356.0] 1 0.50533 4.6558240641420642e+03 0x1.22fd2f5de1bf8cb2p+12 i386 [-64.0000:-0.1659] 10 0.51163 -1.8666523480652408e-01 -0x1.7e4a57b65a7cp-3 i386 [ -0.1659: 0.1659] 10 0.51031 -1.6139564864956486e-01 -0x1.4a89cd45552be4a8p-3 i386 [ 0.1659:11356.0] 10 0.50597 7.2029609713952472e+03 0x1.c22f60238aafa618p+12 i386 [-64.0000:-0.1659] 100 0.51520 -1.8119337383093434e-01 -0x1.731582f6d89b72p-3 i386 [ -0.1659: 0.1659] 100 0.51161 1.6120475455904754e-01 0x1.4a25b7e6539760ecp-3 i386 [ 0.1659:11356.0] 100 0.50645 1.5581592136564341e+03 0x1.858a308e79dd8494p+10 amd64 [-64.0000:-0.1659] 1 0.50502 -1.8115636515636515e-01 -0x1.73021bbe7877ccp-3 amd64 [ -0.1659: 0.1659] 1 0.50807 1.5765476175476175e-01 0x1.42e07fee5cecaa04p-3 amd64 [ 0.1659:11356.0] 1 0.50522 5.3732636683514684e+03 0x1.4fd437fc4e28bfb6p+12 amd64 [-64.0000:-0.1659] 10 0.51363 -1.7086629347662934e-01 -0x1.5def25b3c452dap-3 amd64 [ -0.1659: 0.1659] 10 0.51031 -1.6139564864956486e-01 -0x1.4a89cd45552be4a8p-3 amd64 [ 0.1659:11356.0] 10 0.50595 2.2495034322503431e-01 0x1.ccb2c3fb0104dbe4p-3 amd64 [-64.0000:-0.1659] 100 0.51376 -2.7335577165055771e-01 -0x1.17ea934da5e086p-2 amd64 [ -0.1659: 0.1659] 100 0.51161 1.6120475455904754e-01 0x1.4a25b7e6539760ecp-3 amd64 [ 0.1659:11356.0] 100 0.50662 3.9436528827225188e+02 0x1.8a5d83883eef2676p+8 sparc64 [-113.000:-0.1659] 1 0.50339 -4.89331501511501510727132103685011835e+00 sparc64 [ -0.1659:0.1659] 1 0.50837 -1.28120218820218813976976441251060453e-01 sparc64 [ 0.1659:11356.] 1 0.50514 6.45515777662077662077313264157127259e+03 -- steve From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 20:02:46 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4ED5DB55; Mon, 3 Jun 2013 20:02:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4201F12F0; Mon, 3 Jun 2013 20:02:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53K2kbh055670; Mon, 3 Jun 2013 20:02:46 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53K2jFd055665; Mon, 3 Jun 2013 20:02:45 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306032002.r53K2jFd055665@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 3 Jun 2013 20:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251344 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 20:02:46 -0000 Author: pfg Date: Mon Jun 3 20:02:45 2013 New Revision: 251344 URL: http://svnweb.freebsd.org/changeset/base/251344 Log: ext2fs: Small cosmetic fixes. Make a long macro readable and sort a header. Obtained from: Christoph Mallon MFC after: 3 days Modified: head/sys/fs/ext2fs/ext2_bmap.c head/sys/fs/ext2fs/ext2_dinode.h Modified: head/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- head/sys/fs/ext2fs/ext2_bmap.c Mon Jun 3 19:51:32 2013 (r251343) +++ head/sys/fs/ext2fs/ext2_bmap.c Mon Jun 3 20:02:45 2013 (r251344) @@ -47,8 +47,8 @@ #include #include -#include #include +#include /* * Bmap converts the logical block number of a file to its physical block Modified: head/sys/fs/ext2fs/ext2_dinode.h ============================================================================== --- head/sys/fs/ext2fs/ext2_dinode.h Mon Jun 3 19:51:32 2013 (r251343) +++ head/sys/fs/ext2fs/ext2_dinode.h Mon Jun 3 20:02:45 2013 (r251344) @@ -77,7 +77,8 @@ #define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1) #define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS) -#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, EXT2F_ROCOMPAT_EXTRA_ISIZE)) +#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, \ + EXT2F_ROCOMPAT_EXTRA_ISIZE)) /* * Structure of an inode on the disk From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 20:09:22 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D0B58D1A; Mon, 3 Jun 2013 20:09:22 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C28931320; Mon, 3 Jun 2013 20:09:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53K9Mfm057207; Mon, 3 Jun 2013 20:09:22 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53K9MOp057206; Mon, 3 Jun 2013 20:09:22 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306032009.r53K9MOp057206@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 20:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251345 - head/lib/msun/ld128 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 20:09:22 -0000 Author: kargl Date: Mon Jun 3 20:09:22 2013 New Revision: 251345 URL: http://svnweb.freebsd.org/changeset/base/251345 Log: Change a comma to a semicolon. Remove a blank line that crept into the declarations. Fix a comment to show a sign on a NaN. Modified: head/lib/msun/ld128/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 20:02:45 2013 (r251344) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 20:09:22 2013 (r251345) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); static const long double huge = 0x1p10000L, -twom10000 = 0x1p-10000L, +twom10000 = 0x1p-10000L; /* XXX Prevent gcc from erroneously constant folding this: */ static volatile const long double tiny = 0x1p-10000L; @@ -231,7 +231,6 @@ expl(long double x) union IEEEl2bits u, v; long double q, r, r1, t, twopk, twopkp10000; double dr, fn, r2; - int k, n, n2; uint16_t hx, ix; @@ -243,7 +242,7 @@ expl(long double x) if (ix == BIAS + LDBL_MAX_EXP) { if (hx & 0x8000) /* x is -Inf or -NaN */ return (-1 / x); - return (x + x); /* x is +Inf or NaN */ + return (x + x); /* x is +Inf or +NaN */ } if (x > o_threshold) return (huge * huge); From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 20:33:05 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E991D5EA; Mon, 3 Jun 2013 20:33:05 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DCAD015BC; Mon, 3 Jun 2013 20:33:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53KX5Zc066916; Mon, 3 Jun 2013 20:33:05 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53KX53O066914; Mon, 3 Jun 2013 20:33:05 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306032033.r53KX53O066914@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 3 Jun 2013 20:33:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251346 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 20:33:06 -0000 Author: pfg Date: Mon Jun 3 20:33:05 2013 New Revision: 251346 URL: http://svnweb.freebsd.org/changeset/base/251346 Log: ext2fs: space vs tab. Obtained from: Christoph Mallon MFC after: 3 days Modified: head/sys/fs/ext2fs/ext2_dinode.h head/sys/fs/ext2fs/ext2_inode_cnv.c Modified: head/sys/fs/ext2fs/ext2_dinode.h ============================================================================== --- head/sys/fs/ext2fs/ext2_dinode.h Mon Jun 3 20:09:22 2013 (r251345) +++ head/sys/fs/ext2fs/ext2_dinode.h Mon Jun 3 20:33:05 2013 (r251346) @@ -77,7 +77,7 @@ #define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1) #define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS) -#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, \ +#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, \ EXT2F_ROCOMPAT_EXTRA_ISIZE)) /* Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode_cnv.c Mon Jun 3 20:09:22 2013 (r251345) +++ head/sys/fs/ext2fs/ext2_inode_cnv.c Mon Jun 3 20:33:05 2013 (r251346) @@ -115,7 +115,7 @@ ext2_i2ei(struct inode *ip, struct ext2f int i; ei->e2di_mode = ip->i_mode; - ei->e2di_nlink = ip->i_nlink; + ei->e2di_nlink = ip->i_nlink; /* Godmar thinks: if dtime is nonzero, ext2 says this inode has been deleted, this would correspond to a zero link count From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 20:52:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2D64BFB9; Mon, 3 Jun 2013 20:52:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1F91F16E4; Mon, 3 Jun 2013 20:52:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53KqKt6073772; Mon, 3 Jun 2013 20:52:21 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53KqKDf073771; Mon, 3 Jun 2013 20:52:20 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201306032052.r53KqKDf073771@svn.freebsd.org> From: Ed Schouten Date: Mon, 3 Jun 2013 20:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251347 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 20:52:21 -0000 Author: ed Date: Mon Jun 3 20:52:20 2013 New Revision: 251347 URL: http://svnweb.freebsd.org/changeset/base/251347 Log: Add ATOMIC_*_LOCK_FREE constants. These constants are part of the C standard. Both Clang and GCC seem to export these constants under the name __GCC_ATOMIC_*_LOCK_FREE. Modified: head/sys/sys/stdatomic.h Modified: head/sys/sys/stdatomic.h ============================================================================== --- head/sys/sys/stdatomic.h Mon Jun 3 20:33:05 2013 (r251346) +++ head/sys/sys/stdatomic.h Mon Jun 3 20:52:20 2013 (r251347) @@ -46,6 +46,41 @@ #endif /* + * 7.17.1 Atomic lock-free macros. + */ + +#ifdef __GCC_ATOMIC_BOOL_LOCK_FREE +#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +#endif +#ifdef __GCC_ATOMIC_CHAR_LOCK_FREE +#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +#endif +#ifdef __GCC_ATOMIC_CHAR16_T_LOCK_FREE +#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +#endif +#ifdef __GCC_ATOMIC_CHAR32_T_LOCK_FREE +#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +#endif +#ifdef __GCC_ATOMIC_WCHAR_T_LOCK_FREE +#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +#endif +#ifdef __GCC_ATOMIC_SHORT_LOCK_FREE +#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +#endif +#ifdef __GCC_ATOMIC_INT_LOCK_FREE +#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +#endif +#ifdef __GCC_ATOMIC_LONG_LOCK_FREE +#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +#endif +#ifdef __GCC_ATOMIC_LLONG_LOCK_FREE +#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +#endif +#ifdef __GCC_ATOMIC_POINTER_LOCK_FREE +#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#endif + +/* * 7.17.2 Initialization. */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 21:35:05 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 360ED389; Mon, 3 Jun 2013 21:35:05 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 283F2196A; Mon, 3 Jun 2013 21:35:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53LZ5dH088807; Mon, 3 Jun 2013 21:35:05 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53LZ5tu088806; Mon, 3 Jun 2013 21:35:05 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306032135.r53LZ5tu088806@svn.freebsd.org> From: Steven Hartland Date: Mon, 3 Jun 2013 21:35:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251348 - stable/9/sys/cam/ata X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 21:35:05 -0000 Author: smh Date: Mon Jun 3 21:35:04 2013 New Revision: 251348 URL: http://svnweb.freebsd.org/changeset/base/251348 Log: MFC r249934: Updated TRIM calculations in CAM ATA to be based off ATA_DSM_* defines Modified: stable/9/sys/cam/ata/ata_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Mon Jun 3 20:52:20 2013 (r251347) +++ stable/9/sys/cam/ata/ata_da.c Mon Jun 3 21:35:04 2013 (r251348) @@ -118,10 +118,10 @@ struct disk_params { }; #define TRIM_MAX_BLOCKS 8 -#define TRIM_MAX_RANGES (TRIM_MAX_BLOCKS * 64) +#define TRIM_MAX_RANGES (TRIM_MAX_BLOCKS * ATA_DSM_BLK_RANGES) #define TRIM_MAX_BIOS (TRIM_MAX_RANGES * 4) struct trim_request { - uint8_t data[TRIM_MAX_RANGES * 8]; + uint8_t data[TRIM_MAX_RANGES * ATA_DSM_RANGE_SIZE]; struct bio *bps[TRIM_MAX_BIOS]; }; @@ -1113,8 +1113,8 @@ adaregister(struct cam_periph *periph, v softc->trim_max_ranges = TRIM_MAX_RANGES; if (cgd->ident_data.max_dsm_blocks != 0) { softc->trim_max_ranges = - min(cgd->ident_data.max_dsm_blocks * 64, - softc->trim_max_ranges); + min(cgd->ident_data.max_dsm_blocks * + ATA_DSM_BLK_RANGES, softc->trim_max_ranges); } } if (cgd->ident_data.support.command2 & ATA_SUPPORT_CFA) @@ -1190,10 +1190,12 @@ adaregister(struct cam_periph *periph, v softc->disk->d_flags = 0; if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; - if ((softc->flags & ADA_FLAG_CAN_TRIM) || - ((softc->flags & ADA_FLAG_CAN_CFA) && - !(softc->flags & ADA_FLAG_CAN_48BIT))) + if (softc->flags & ADA_FLAG_CAN_TRIM) { softc->disk->d_flags |= DISKFLAG_CANDELETE; + } else if ((softc->flags & ADA_FLAG_CAN_CFA) && + !(softc->flags & ADA_FLAG_CAN_48BIT)) { + softc->disk->d_flags |= DISKFLAG_CANDELETE; + } strlcpy(softc->disk->d_descr, cgd->ident_data.model, MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model))); strlcpy(softc->disk->d_ident, cgd->ident_data.serial, @@ -1360,9 +1362,9 @@ adastart(struct cam_periph *periph, unio /* Try to extend the previous range. */ if (lba == lastlba) { - c = min(count, 0xffff - lastcount); + c = min(count, ATA_DSM_RANGE_MAX - lastcount); lastcount += c; - off = (ranges - 1) * 8; + off = (ranges - 1) * ATA_DSM_RANGE_SIZE; req->data[off + 6] = lastcount & 0xff; req->data[off + 7] = (lastcount >> 8) & 0xff; @@ -1371,8 +1373,8 @@ adastart(struct cam_periph *periph, unio } while (count > 0) { - c = min(count, 0xffff); - off = ranges * 8; + c = min(count, ATA_DSM_RANGE_MAX); + off = ranges * ATA_DSM_RANGE_SIZE; req->data[off + 0] = lba & 0xff; req->data[off + 1] = (lba >> 8) & 0xff; req->data[off + 2] = (lba >> 16) & 0xff; @@ -1385,6 +1387,11 @@ adastart(struct cam_periph *periph, unio count -= c; lastcount = c; ranges++; + /* + * Its the caller's responsibility to ensure the + * request will fit so we don't need to check for + * overrun here + */ } lastlba = lba; req->bps[bps++] = bp1; @@ -1392,7 +1399,8 @@ adastart(struct cam_periph *periph, unio if (bps >= TRIM_MAX_BIOS || bp1 == NULL || bp1->bio_bcount / softc->params.secsize > - (softc->trim_max_ranges - ranges) * 0xffff) + (softc->trim_max_ranges - ranges) * + ATA_DSM_RANGE_MAX) break; } while (1); cam_fill_ataio(ataio, @@ -1401,10 +1409,12 @@ adastart(struct cam_periph *periph, unio CAM_DIR_OUT, 0, req->data, - ((ranges + 63) / 64) * 512, + ((ranges + ATA_DSM_BLK_RANGES - 1) / + ATA_DSM_BLK_RANGES) * ATA_DSM_BLK_SIZE, ada_default_timeout * 1000); ata_48bit_cmd(ataio, ATA_DATA_SET_MANAGEMENT, - ATA_DSM_TRIM, 0, (ranges + 63) / 64); + ATA_DSM_TRIM, 0, (ranges + ATA_DSM_BLK_RANGES - + 1) / ATA_DSM_BLK_RANGES); start_ccb->ccb_h.ccb_state = ADA_CCB_TRIM; goto out; } From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 21:52:19 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C79ADA44; Mon, 3 Jun 2013 21:52:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BA84D1A2E; Mon, 3 Jun 2013 21:52:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53LqJMe094837; Mon, 3 Jun 2013 21:52:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53LqJwW094836; Mon, 3 Jun 2013 21:52:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306032152.r53LqJwW094836@svn.freebsd.org> From: Xin LI Date: Mon, 3 Jun 2013 21:52:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251349 - head/lib/libcam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 21:52:19 -0000 Author: delphij Date: Mon Jun 3 21:52:19 2013 New Revision: 251349 URL: http://svnweb.freebsd.org/changeset/base/251349 Log: Fix a typo: XPORT_SPI should be tested against transport, nor protocol. Submitted by: Sascha Wildner Reviewed by: mjacob MFC after: 2 weeks Modified: head/lib/libcam/camlib.c Modified: head/lib/libcam/camlib.c ============================================================================== --- head/lib/libcam/camlib.c Mon Jun 3 21:35:04 2013 (r251348) +++ head/lib/libcam/camlib.c Mon Jun 3 21:52:19 2013 (r251349) @@ -633,7 +633,7 @@ cam_real_open_device(const char *path, i "%s: %s", func_name, func_name, strerror(errno)); goto crod_bailout; } - if (ccb.cts.protocol == XPORT_SPI) { + if (ccb.cts.transport == XPORT_SPI) { struct ccb_trans_settings_spi *spi = &ccb.cts.xport_specific.spi; device->sync_period = spi->sync_period; From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 22:06:10 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 62B34176; Mon, 3 Jun 2013 22:06:10 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 52D1F1A9F; Mon, 3 Jun 2013 22:06:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53M6AMr099473; Mon, 3 Jun 2013 22:06:10 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53M69tT099467; Mon, 3 Jun 2013 22:06:09 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306032206.r53M69tT099467@svn.freebsd.org> From: Steven Hartland Date: Mon, 3 Jun 2013 22:06:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251350 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 22:06:10 -0000 Author: smh Date: Mon Jun 3 22:06:09 2013 New Revision: 251350 URL: http://svnweb.freebsd.org/changeset/base/251350 Log: MFC r249937: Refactored scsi_xpt use of device_has_vpd Modified: stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Mon Jun 3 21:52:19 2013 (r251349) +++ stable/9/sys/cam/scsi/scsi_all.c Mon Jun 3 22:06:09 2013 (r251350) @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #include #else #include @@ -55,7 +58,13 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifndef _KERNEL + +#ifdef _KERNEL +#include +#include +#include +#include +#else #include #include @@ -6252,6 +6261,28 @@ scsi_devid_match(uint8_t *lhs, size_t lh } #ifdef _KERNEL +int +scsi_vpd_supported_page(struct cam_periph *periph, uint8_t page_id) +{ + struct cam_ed *device; + struct scsi_vpd_supported_pages *vpds; + int i, num_pages; + + device = periph->path->device; + vpds = (struct scsi_vpd_supported_pages *)device->supported_vpds; + + if (vpds != NULL) { + num_pages = device->supported_vpds_len - + SVPD_SUPPORTED_PAGES_HDR_LEN; + for (i = 0; i < num_pages; i++) { + if (vpds->page_list[i] == page_id) + return (1); + } + } + + return (0); +} + static void init_scsi_delay(void) { Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Mon Jun 3 21:52:19 2013 (r251349) +++ stable/9/sys/cam/scsi/scsi_all.h Mon Jun 3 22:06:09 2013 (r251350) @@ -2257,6 +2257,8 @@ int scsi_sense_sbuf(struct ccb_scsiio * char * scsi_sense_string(struct ccb_scsiio *csio, char *str, int str_len); void scsi_sense_print(struct ccb_scsiio *csio); +int scsi_vpd_supported_page(struct cam_periph *periph, + uint8_t page_id); #else /* _KERNEL */ int scsi_command_string(struct cam_device *device, struct ccb_scsiio *csio, struct sbuf *sb); Modified: stable/9/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_xpt.c Mon Jun 3 21:52:19 2013 (r251349) +++ stable/9/sys/cam/scsi/scsi_xpt.c Mon Jun 3 22:06:09 2013 (r251350) @@ -556,7 +556,6 @@ static const int scsi_quirk_table_size = static cam_status proberegister(struct cam_periph *periph, void *arg); static void probeschedule(struct cam_periph *probe_periph); -static int device_has_vpd(struct cam_ed *device, uint8_t page_id); static void probestart(struct cam_periph *periph, union ccb *start_ccb); static void proberequestdefaultnegotiation(struct cam_periph *periph); static int proberequestbackoff(struct cam_periph *periph, @@ -708,21 +707,6 @@ probeschedule(struct cam_periph *periph) xpt_schedule(periph, CAM_PRIORITY_XPT); } -static int -device_has_vpd(struct cam_ed *device, uint8_t page_id) -{ - int i, num_pages; - struct scsi_vpd_supported_pages *vpds; - - vpds = (struct scsi_vpd_supported_pages *)device->supported_vpds; - num_pages = device->supported_vpds_len - SVPD_SUPPORTED_PAGES_HDR_LEN; - for (i = 0;i < num_pages;i++) - if (vpds->page_list[i] == page_id) - return 1; - - return 0; -} - static void probestart(struct cam_periph *periph, union ccb *start_ccb) { @@ -910,11 +894,9 @@ again: case PROBE_DEVICE_ID: { struct scsi_vpd_device_id *devid; - struct cam_ed *device; devid = NULL; - device = periph->path->device; - if (device_has_vpd(device, SVPD_DEVICE_ID)) + if (scsi_vpd_supported_page(periph, SVPD_DEVICE_ID)) devid = malloc(SVPD_DEVICE_ID_MAX_SIZE, M_CAMXPT, M_NOWAIT | M_ZERO); @@ -952,7 +934,7 @@ again: device->serial_num_len = 0; } - if (device_has_vpd(device, SVPD_UNIT_SERIAL_NUMBER)) + if (scsi_vpd_supported_page(periph, SVPD_UNIT_SERIAL_NUMBER)) serial_buf = (struct scsi_vpd_unit_serial_number *) malloc(sizeof(*serial_buf), M_CAMXPT, M_NOWAIT|M_ZERO); From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 22:22:54 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1B9BB8BE; Mon, 3 Jun 2013 22:22:54 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0D24B1BA4; Mon, 3 Jun 2013 22:22:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53MMr5C005687; Mon, 3 Jun 2013 22:22:53 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53MMrTo005686; Mon, 3 Jun 2013 22:22:53 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201306032222.r53MMrTo005686@svn.freebsd.org> From: Hiren Panchasara Date: Mon, 3 Jun 2013 22:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251351 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 22:22:54 -0000 Author: hiren Date: Mon Jun 3 22:22:53 2013 New Revision: 251351 URL: http://svnweb.freebsd.org/changeset/base/251351 Log: Fixing a typo. Approved by: sbruno (mentor) MFC after: 3 days Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Jun 3 22:06:09 2013 (r251350) +++ head/sys/dev/usb/usbdevs Mon Jun 3 22:22:53 2013 (r251351) @@ -3498,7 +3498,7 @@ product RALINK RT2573_2 0x9021 RT2501US product RATOC REXUSB60 0xb000 USB serial adapter REX-USB60 product RATOC REXUSB60F 0xb020 USB serial adapter REX-USB60F -/* ReakTek products */ +/* Realtek products */ /* Green House and CompUSA OEM this part */ product REALTEK DUMMY 0x0000 Dummy product product REALTEK USB20CRW 0x0158 USB20CRW Card Reader From owner-svn-src-all@FreeBSD.ORG Mon Jun 3 23:51:46 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E6CE9BC4; Mon, 3 Jun 2013 23:51:46 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D945E1EE9; Mon, 3 Jun 2013 23:51:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53NpkEG033433; Mon, 3 Jun 2013 23:51:46 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53NpktR033432; Mon, 3 Jun 2013 23:51:46 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201306032351.r53NpktR033432@svn.freebsd.org> From: "Simon J. Gerraty" Date: Mon, 3 Jun 2013 23:51:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251352 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 23:51:47 -0000 Author: sjg Date: Mon Jun 3 23:51:46 2013 New Revision: 251352 URL: http://svnweb.freebsd.org/changeset/base/251352 Log: bmake does not like universe_${target}_prologue in the .ORDER when there is an explicit dependency for it anyway. Remove it so both bmake and fmake do the same thing. Reviewed by: OBrien Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Mon Jun 3 22:22:53 2013 (r251351) +++ head/Makefile Mon Jun 3 23:51:46 2013 (r251352) @@ -375,7 +375,7 @@ universe_prologue: .endif .for target in ${TARGETS} universe: universe_${target} -.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue +.ORDER: universe_prologue upgrade_checks universe_${target} universe_epilogue universe_${target}: universe_${target}_prologue universe_${target}_prologue: @echo ">> ${target} started on `LC_ALL=C date`" From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 00:30:05 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AADDFF43; Tue, 4 Jun 2013 00:30:05 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9DAEA1FD6; Tue, 4 Jun 2013 00:30:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r540U5f1044542; Tue, 4 Jun 2013 00:30:05 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r540U5CU044541; Tue, 4 Jun 2013 00:30:05 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306040030.r540U5CU044541@svn.freebsd.org> From: Devin Teske Date: Tue, 4 Jun 2013 00:30:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251353 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 00:30:05 -0000 Author: dteske Date: Tue Jun 4 00:30:05 2013 New Revision: 251353 URL: http://svnweb.freebsd.org/changeset/base/251353 Log: Improve debugging for f_dialog_*_constrain() to print constrained rather than unconstrained values. Modified: head/usr.sbin/bsdconfig/share/dialog.subr Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Mon Jun 3 23:51:46 2013 (r251352) +++ head/usr.sbin/bsdconfig/share/dialog.subr Tue Jun 4 00:30:05 2013 (r251353) @@ -328,7 +328,7 @@ f_dialog_size_constrain() for __arg in height width; do debug= f_getvar __var_$__arg __cp [ "$__cp" ] || continue - if ! f_getvar "$__cp" __$__arg; then + if ! debug= f_getvar "$__cp" __$__arg; then f_dprintf "%s: var_%s variable \`%s' not set" \ $__fname $__arg "$__cp" __retval=$FAILURE @@ -377,6 +377,12 @@ f_dialog_size_constrain() fi fi + if [ "$debug" ]; then + # Print final constrained values to debuggin + f_quietly f_getvar "$__var_height" + f_quietly f_getvar "$__var_width" + fi + return $__retval # success if no debug warnings were printed } @@ -419,7 +425,7 @@ f_dialog_menu_constrain() for __arg in height width rows; do debug= f_getvar __var_$__arg __cp [ "$__cp" ] || continue - if ! f_getvar "$__cp" __$__arg; then + if ! debug= f_getvar "$__cp" __$__arg; then f_dprintf "%s: var_%s variable \`%s' not set" \ $__fname $__arg "$__cp" __retval=$FAILURE @@ -489,6 +495,13 @@ f_dialog_menu_constrain() fi fi + if [ "$debug" ]; then + # Print final constrained values to debuggin + f_quietly f_getvar "$__var_height" + f_quietly f_getvar "$__var_width" + f_quietly f_getvar "$__var_rows" + fi + return $__retval # success if no debug warnings were printed } From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 00:35:58 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0861A17E; Tue, 4 Jun 2013 00:35:58 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EDF111FFB; Tue, 4 Jun 2013 00:35:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r540ZvAP046967; Tue, 4 Jun 2013 00:35:57 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r540ZvUo046966; Tue, 4 Jun 2013 00:35:57 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306040035.r540ZvUo046966@svn.freebsd.org> From: Devin Teske Date: Tue, 4 Jun 2013 00:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251354 - head/usr.sbin/bsdconfig/share/packages X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 00:35:58 -0000 Author: dteske Date: Tue Jun 4 00:35:57 2013 New Revision: 251354 URL: http://svnweb.freebsd.org/changeset/base/251354 Log: Whitespace and comments. Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/packages/packages.subr Tue Jun 4 00:30:05 2013 (r251353) +++ head/usr.sbin/bsdconfig/share/packages/packages.subr Tue Jun 4 00:35:57 2013 (r251354) @@ -88,7 +88,7 @@ f_package_accent_category_menu() "$msg_all") debug= f_getvar "_All_ninstalled" n ;; *) debug= f_getvar "_${varcat}_ninstalled" n ;; esac && - [ $n -ge 1 ] && desc="$desc; $n $msg_installed_lc" + [ $n -ge 1 ] && desc="$desc; $n $msg_installed_lc" # Add number of selected packages for this category (if any) n=0 @@ -96,9 +96,9 @@ f_package_accent_category_menu() "$msg_all") debug= f_getvar "_All_nselected" n ;; *) debug= f_getvar "_${varcat}_nselected" n ;; esac && - [ $n -ge 1 ] && desc="$desc; $n $msg_selected" + [ $n -ge 1 ] && desc="$desc; $n $msg_selected" - # Add an asterisk to the category if its index has been cached + # Re-Add asterisk to the category if its index has been cached f_isset _index_page_${varcat}_1 && cat="$cat*" # Update buffer with modified elements From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 00:38:19 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A1BF2322; Tue, 4 Jun 2013 00:38:19 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 94967101A; Tue, 4 Jun 2013 00:38:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r540cJI5047401; Tue, 4 Jun 2013 00:38:19 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r540cJZ9047400; Tue, 4 Jun 2013 00:38:19 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306040038.r540cJZ9047400@svn.freebsd.org> From: Devin Teske Date: Tue, 4 Jun 2013 00:38:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251355 - head/usr.sbin/bsdconfig/share/packages X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 00:38:19 -0000 Author: dteske Date: Tue Jun 4 00:38:19 2013 New Revision: 251355 URL: http://svnweb.freebsd.org/changeset/base/251355 Log: Fix menu accenting for the package category list. The single-space indent for duplicate initial-characters was removed for making comparisons but was not put back. Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/packages/packages.subr Tue Jun 4 00:35:57 2013 (r251354) +++ head/usr.sbin/bsdconfig/share/packages/packages.subr Tue Jun 4 00:38:19 2013 (r251355) @@ -73,13 +73,13 @@ SELECTED_PACKAGES= # f_package_accent_category_menu() { - local var_to_set="$1" cat desc help varcat menu_buf n + local var_to_set="$1" category cat desc help varcat menu_buf n shift 1 # var_to_set while [ $# -gt 0 ]; do - cat="${1%\*}" desc="${2%%; *}" help="$3" + category="${1%\*}" desc="${2%%; *}" help="$3" shift 3 # cat/desc/help - cat="${cat# }" # Trim leading space inserted by sort-method + cat="${category# }" # Trim lead space inserted by sort-method f_str2varname "$cat" varcat # Add number of installed packages for this category (if any) @@ -99,11 +99,11 @@ f_package_accent_category_menu() [ $n -ge 1 ] && desc="$desc; $n $msg_selected" # Re-Add asterisk to the category if its index has been cached - f_isset _index_page_${varcat}_1 && cat="$cat*" + f_isset _index_page_${varcat}_1 && category="$category*" # Update buffer with modified elements menu_buf="$menu_buf - '$cat' '$desc' '$help'" # End-Quote + '$category' '$desc' '$help'" # End-Quote done setvar "$var_to_set" "$menu_buf" # return our buffer } From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 00:40:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6831E4B7; Tue, 4 Jun 2013 00:40:27 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 59A5A102F; Tue, 4 Jun 2013 00:40:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r540eRf1049113; Tue, 4 Jun 2013 00:40:27 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r540eRNr049076; Tue, 4 Jun 2013 00:40:27 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201306040040.r540eRNr049076@svn.freebsd.org> From: Justin Hibbits Date: Tue, 4 Jun 2013 00:40:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251356 - head/sys/powerpc/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 00:40:27 -0000 Author: jhibbits Date: Tue Jun 4 00:40:26 2013 New Revision: 251356 URL: http://svnweb.freebsd.org/changeset/base/251356 Log: Pad the PCPU MD struct, to satisfy an assert added with the projects/counters branch import. PR: ports/179173,ports/179164 Modified: head/sys/powerpc/include/pcpu.h Modified: head/sys/powerpc/include/pcpu.h ============================================================================== --- head/sys/powerpc/include/pcpu.h Tue Jun 4 00:38:19 2013 (r251355) +++ head/sys/powerpc/include/pcpu.h Tue Jun 4 00:40:26 2013 (r251356) @@ -128,7 +128,7 @@ struct pmap; */ #ifndef PCPU_MD_FIELDS #define PCPU_MD_FIELDS \ - int pc_md_placeholder + int pc_md_placeholder[32] #endif #ifdef _KERNEL From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 00:42:32 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 22D6B650; Tue, 4 Jun 2013 00:42:32 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1562A1043; Tue, 4 Jun 2013 00:42:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r540gVUo049596; Tue, 4 Jun 2013 00:42:31 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r540gVqt049595; Tue, 4 Jun 2013 00:42:31 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306040042.r540gVqt049595@svn.freebsd.org> From: Devin Teske Date: Tue, 4 Jun 2013 00:42:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251357 - head/usr.sbin/bsdconfig/share/packages X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 00:42:32 -0000 Author: dteske Date: Tue Jun 4 00:42:31 2013 New Revision: 251357 URL: http://svnweb.freebsd.org/changeset/base/251357 Log: Fix a code typo (missing `eval') which lead to improperly-sized menu when displaying packages (menu was always maximum height). The problem was introduced by SVN r251232. Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/packages/packages.subr Tue Jun 4 00:40:26 2013 (r251356) +++ head/usr.sbin/bsdconfig/share/packages/packages.subr Tue Jun 4 00:42:31 2013 (r251357) @@ -464,7 +464,7 @@ f_package_menu_select() "$page" "$npages" )" local mheight mwidth mrows - f_dialog_menu${SHOW_DESC:+_with_help}_size mheight mwidth mrows \ + eval f_dialog_menu${SHOW_DESC:+_with_help}_size mheight mwidth mrows \ \"\$DIALOG_TITLE\" \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \"\$hline\" $menu_list local iheight iwidth From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 02:25:26 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 658CF801; Tue, 4 Jun 2013 02:25:26 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 57A9A133A; Tue, 4 Jun 2013 02:25:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r542PQM0081739; Tue, 4 Jun 2013 02:25:26 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r542PQe2081738; Tue, 4 Jun 2013 02:25:26 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201306040225.r542PQe2081738@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 4 Jun 2013 02:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251358 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 02:25:26 -0000 Author: np Date: Tue Jun 4 02:25:25 2013 New Revision: 251358 URL: http://svnweb.freebsd.org/changeset/base/251358 Log: cxgbe(4): Provide accurate hit count for filters on T5 cards. The location within the TCB and the size have both changed. MFC after: 1 week Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Jun 4 00:42:31 2013 (r251357) +++ head/sys/dev/cxgbe/t4_main.c Tue Jun 4 02:25:25 2013 (r251358) @@ -6573,9 +6573,15 @@ get_filter_hits(struct adapter *sc, uint memwin_info(sc, 0, &mw_base, NULL); off = position_memwin(sc, 0, tcb_base + (fid + sc->tids.ftid_base) * TCB_SIZE); - hits = t4_read_reg64(sc, mw_base + off + 16); + if (is_t4(sc)) { + hits = t4_read_reg64(sc, mw_base + off + 16); + hits = be64toh(hits); + } else { + hits = t4_read_reg(sc, mw_base + off + 24); + hits = be32toh(hits); + } - return (be64toh(hits)); + return (hits); } static int From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 02:28:47 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AFC6DA2E; Tue, 4 Jun 2013 02:28:47 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 87068135A; Tue, 4 Jun 2013 02:28:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r542Slxv082251; Tue, 4 Jun 2013 02:28:47 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r542SlcM082250; Tue, 4 Jun 2013 02:28:47 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201306040228.r542SlcM082250@svn.freebsd.org> From: Alan Cox Date: Tue, 4 Jun 2013 02:28:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251359 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 02:28:47 -0000 Author: alc Date: Tue Jun 4 02:28:47 2013 New Revision: 251359 URL: http://svnweb.freebsd.org/changeset/base/251359 Log: Relax the object locking in vm_pageout_map_deactivate_pages() and vm_pageout_object_deactivate_pages(). A read lock suffices. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Tue Jun 4 02:25:25 2013 (r251358) +++ head/sys/vm/vm_pageout.c Tue Jun 4 02:28:47 2013 (r251359) @@ -714,13 +714,13 @@ vm_pageout_object_deactivate_pages(pmap_ vm_page_t p; int actcount, remove_mode; - VM_OBJECT_ASSERT_WLOCKED(first_object); + VM_OBJECT_ASSERT_LOCKED(first_object); if ((first_object->flags & OBJ_FICTITIOUS) != 0) return; for (object = first_object;; object = backing_object) { if (pmap_resident_count(pmap) <= desired) goto unlock_return; - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_LOCKED(object); if ((object->flags & OBJ_UNMANAGED) != 0 || object->paging_in_progress != 0) goto unlock_return; @@ -776,13 +776,13 @@ vm_pageout_object_deactivate_pages(pmap_ } if ((backing_object = object->backing_object) == NULL) goto unlock_return; - VM_OBJECT_WLOCK(backing_object); + VM_OBJECT_RLOCK(backing_object); if (object != first_object) - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RUNLOCK(object); } unlock_return: if (object != first_object) - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RUNLOCK(object); } /* @@ -812,15 +812,15 @@ vm_pageout_map_deactivate_pages(map, des while (tmpe != &map->header) { if ((tmpe->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { obj = tmpe->object.vm_object; - if (obj != NULL && VM_OBJECT_TRYWLOCK(obj)) { + if (obj != NULL && VM_OBJECT_TRYRLOCK(obj)) { if (obj->shadow_count <= 1 && (bigobj == NULL || bigobj->resident_page_count < obj->resident_page_count)) { if (bigobj != NULL) - VM_OBJECT_WUNLOCK(bigobj); + VM_OBJECT_RUNLOCK(bigobj); bigobj = obj; } else - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); } } if (tmpe->wired_count > 0) @@ -830,7 +830,7 @@ vm_pageout_map_deactivate_pages(map, des if (bigobj != NULL) { vm_pageout_object_deactivate_pages(map->pmap, bigobj, desired); - VM_OBJECT_WUNLOCK(bigobj); + VM_OBJECT_RUNLOCK(bigobj); } /* * Next, hunt around for other pages to deactivate. We actually @@ -843,9 +843,9 @@ vm_pageout_map_deactivate_pages(map, des if ((tmpe->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { obj = tmpe->object.vm_object; if (obj != NULL) { - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); vm_pageout_object_deactivate_pages(map->pmap, obj, desired); - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); } } tmpe = tmpe->next; From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 02:56:57 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 436D2BC; Tue, 4 Jun 2013 02:56:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 36348147C; Tue, 4 Jun 2013 02:56:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r542uvJK091218; Tue, 4 Jun 2013 02:56:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r542uu4a091216; Tue, 4 Jun 2013 02:56:56 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306040256.r542uu4a091216@svn.freebsd.org> From: Adrian Chadd Date: Tue, 4 Jun 2013 02:56:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251360 - head/sys/dev/ath/ath_hal X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 02:56:57 -0000 Author: adrian Date: Tue Jun 4 02:56:56 2013 New Revision: 251360 URL: http://svnweb.freebsd.org/changeset/base/251360 Log: Add the combined (mixed) diversity support capability bit for the AR9285/AR9485. Modified: head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Tue Jun 4 02:28:47 2013 (r251359) +++ head/sys/dev/ath/ath_hal/ah.c Tue Jun 4 02:56:56 2013 (r251360) @@ -748,6 +748,9 @@ ath_hal_getcapability(struct ath_hal *ah case HAL_CAP_RXTSTAMP_PREC: /* rx desc tstamp precision (bits) */ *result = pCap->halTstampPrecision; return HAL_OK; + case HAL_CAP_ANT_DIV_COMB: /* AR9285/AR9485 LNA diversity */ + return pCap->halAntDivCombSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_ENHANCED_DFS_SUPPORT: return pCap->halEnhancedDfsSupport ? HAL_OK : HAL_ENOTSUPP; Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Tue Jun 4 02:28:47 2013 (r251359) +++ head/sys/dev/ath/ath_hal/ah.h Tue Jun 4 02:56:56 2013 (r251360) @@ -169,6 +169,7 @@ typedef enum { HAL_CAP_RXTSTAMP_PREC = 100, /* rx desc tstamp precision (bits) */ + HAL_CAP_ANT_DIV_COMB = 105, /* Enable antenna diversity/combining */ HAL_CAP_PHYRESTART_CLR_WAR = 106, /* in some cases, clear phy restart to fix bb hang */ HAL_CAP_ENTERPRISE_MODE = 107, /* Enterprise mode features */ HAL_CAP_LDPCWAR = 108, From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 03:30:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8F21D7C9; Tue, 4 Jun 2013 03:30:45 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 80F9F1826; Tue, 4 Jun 2013 03:30:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r543UjEQ004351; Tue, 4 Jun 2013 03:30:45 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r543Ui5c004344; Tue, 4 Jun 2013 03:30:44 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306040330.r543Ui5c004344@svn.freebsd.org> From: Devin Teske Date: Tue, 4 Jun 2013 03:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251361 - in head/usr.sbin/bsdconfig: console share share/packages startup X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 03:30:45 -0000 Author: dteske Date: Tue Jun 4 03:30:44 2013 New Revision: 251361 URL: http://svnweb.freebsd.org/changeset/base/251361 Log: Similar to r251236, r251242, and r251244. Introduce new function-pair to dialog(1) API in dialog.subr responsible for retrieving menu-choice data (for the --menu widget). Add f_dialog_menuitem_store()/f_dialog_menuitem_fetch() for storing and retrieving the menuitem (not the tag) from a --menu widget result. The dialog --menu widget returns the `tag' from the tag/item pair of choices for a menu list. Because the menu list is often local to the function that is displaying it, the ability to dereference this into the item is not possible unless you use a global. This changes things so the function (upon successful return of dialog) dereferences the tag into the item and stores it for later retrieval using these functions. NOTE: Tags are dereferenced into items using f_dialog_menutag2item(). Modified: head/usr.sbin/bsdconfig/console/ttys head/usr.sbin/bsdconfig/share/dialog.subr head/usr.sbin/bsdconfig/share/packages/packages.subr head/usr.sbin/bsdconfig/startup/rcvar Modified: head/usr.sbin/bsdconfig/console/ttys ============================================================================== --- head/usr.sbin/bsdconfig/console/ttys Tue Jun 4 02:56:56 2013 (r251360) +++ head/usr.sbin/bsdconfig/console/ttys Tue Jun 4 03:30:44 2013 (r251361) @@ -48,22 +48,6 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # ETC_TTYS=/etc/ttys -############################################################ GLOBALS - -# -# Terminal-type map/menu-item list -# -TTY_MENU_LIST=" - '1 $msg_none' '$msg_none_ttys_desc' - '2 $msg_ibm_437_vga_default' 'cons25' - '3 $msg_iso_8859_1' 'cons25l1' - '4 $msg_iso_8859_2' 'cons25l2' - '5 $msg_iso_8859_7' 'cons25l7' - '6 $msg_koi8_r' 'cons25r' - '7 $msg_koi8_u' 'cons25u' - '8 $msg_us_ascii' 'cons25w' -" # END-QUOTE - ############################################################ FUNCTIONS # dialog_menu_main @@ -73,6 +57,16 @@ TTY_MENU_LIST=" dialog_menu_main() { local prompt="$msg_ttys_menu_text" + local menu_list=" + '1 $msg_none' '$msg_none_ttys_desc' + '2 $msg_ibm_437_vga_default' 'cons25' + '3 $msg_iso_8859_1' 'cons25l1' + '4 $msg_iso_8859_2' 'cons25l2' + '5 $msg_iso_8859_7' 'cons25l7' + '6 $msg_koi8_r' 'cons25r' + '7 $msg_koi8_u' 'cons25u' + '8 $msg_us_ascii' 'cons25w' + " # END-QUOTE local hline="$hline_choose_a_terminal_type" local height width rows @@ -81,7 +75,7 @@ dialog_menu_main() \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ - $TTY_MENU_LIST + $menu_list local menu_choice menu_choice=$( eval $DIALOG \ @@ -92,11 +86,19 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" \ $height $width $rows \ - $TTY_MENU_LIST \ + $menu_ist \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_menutag_store -s "$menu_choice" + + if [ $retval -eq $SUCCESS ]; then + local item + item=$( eval f_dialog_menutag2item \ + \"\$menu_choice\" $menu_list ) + f_dialog_menuitem_store "$item" + fi + return $retval } @@ -187,7 +189,7 @@ while :; do [ "$mtag" = "1 $msg_none" ] && break - consterm=$( eval f_dialog_menutag2item \"\$mtag\" $TTY_MENU_LIST ) + f_dialog_menuitem_fetch consterm err=$( ttys_set_type "$consterm" 2>&1 ) [ "$err" ] || break Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Tue Jun 4 02:56:56 2013 (r251360) +++ head/usr.sbin/bsdconfig/share/dialog.subr Tue Jun 4 03:30:44 2013 (r251361) @@ -1770,6 +1770,44 @@ f_dialog_menutag_fetch() return $SUCCESS } +# f_dialog_menuitem_store [-s] $text +# +# Store the item from a dialog(1) menu (see f_dialog_menutag2item()) to be +# retrieved later by f_dialog_menuitem_fetch(). If the first argument is `-s', +# the text is sanitized before being stored. +# +f_dialog_menuitem_store() +{ + local sanitize= + [ "$1" = "-s" ] && sanitize=1 && shift 1 # -s + local text="$1" + + # Sanitize the menuitem before storing it if desired + [ "$sanitize" ] && f_dialog_data_sanitize text + + setvar DIALOG_MENUITEM_$$ "$text" +} + +# f_dialog_menuitem_fetch [$var_to_set] +# +# Obtain the menuitem chosen by the user from the most recently displayed +# dialog(1) menu (previously stored with f_dialog_menuitem_store() above). If +# $var_to_set is NULL or missing, output is printed to stdout (which is less +# recommended due to performance degradation; in a loop for example). +# +f_dialog_menuitem_fetch() +{ + local __var_to_set="$1" __cp + + debug= f_getvar DIALOG_MENUITEM_$$ "${__var_to_set:-__cp}" # get data + setvar DIALOG_MENUITEM_$$ "" # scrub memory in case data was sensitive + + # Return the data on standard-out if desired + [ "$__var_to_set" ] || echo "$__cp" + + return $SUCCESS +} + # f_dialog_default_store [-s] $text # # Store some text to be used later as the --default-item argument to dialog(1) Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/packages/packages.subr Tue Jun 4 02:56:56 2013 (r251360) +++ head/usr.sbin/bsdconfig/share/packages/packages.subr Tue Jun 4 03:30:44 2013 (r251361) @@ -360,9 +360,10 @@ f_package_index_get_page() # only matters if there are multiple pages; which is determined by the global # maximum $PACKAGE_MENU_PAGESIZE). # -# On success, if the user doesn't press ESC or choose Cancel, the environment -# variable $DIALOG_MENUITEM_$$ will hold the item associated with the chosen -# tag (accessible through f_dialog_menutag_fetch()). +# On success, if the user doesn't press ESC or choose Cancel, use +# f_dialog_menuitem_fetch() to populate a local variable with the item (not +# tag) corresponding to the user's selection. The tag portion of the user's +# selection is available through f_dialog_menutag_fetch(). # f_package_menu_select() { @@ -499,7 +500,7 @@ f_package_menu_select() local item item=$( eval f_dialog_menutag2item${SHOW_DESC:+_with_help} \ \"\$menu_choice\" $menu_list ) - setvar DIALOG_MENUITEM_$$ "$item" + f_dialog_menuitem_store "$item" fi return $retval @@ -739,7 +740,7 @@ f_package_config() # Treat any other selection as a package package="${menu_choice# }" # Trim leading space f_str2varname $package varpkg - f_getvar DIALOG_MENUITEM_$$ mark + f_dialog_menuitem_fetch mark mark="${mark#?}" mark="${mark%%\] *}" case "$mark" in Modified: head/usr.sbin/bsdconfig/startup/rcvar ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcvar Tue Jun 4 02:56:56 2013 (r251360) +++ head/usr.sbin/bsdconfig/startup/rcvar Tue Jun 4 03:30:44 2013 (r251361) @@ -49,7 +49,6 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # RCVAR_MAP= _RCVAR_MAP= -RCVAR_MENU_LIST= # # Options @@ -66,15 +65,12 @@ RCVAR_MENU_LIST= dialog_menu_main() { local prompt= - local hline="$hline_arrows_tab_enter" - local defaultitem= # Calculated below - - # NOTE: Using a GLOBAL here because caller will need this list to turn - # the menu tag into the menu item with f_dialog_menutag2item() - RCVAR_MENU_LIST=" + local menu_list=" 'X $msg_exit' '$msg_exit_this_menu' ${SHOW_DESC:+'$msg_exit_this_menu'} " # END-QUOTE + local hline="$hline_arrows_tab_enter" + local defaultitem= # Calculated below if [ ! "$_RCVAR_MAP" ]; then # Generate RCVAR_MAP of `rcvar dflt script desc ...' per-line @@ -84,7 +80,7 @@ dialog_menu_main() export _RCVAR_MAP=1 fi - RCVAR_MENU_LIST="$RCVAR_MENU_LIST $( + menu_list="$menu_list $( . "$RC_DEFAULTS" > /dev/null source_rc_confs > /dev/null for rcvar in $( echo "$RCVAR_MAP" | awk '{print $1}' ); do @@ -126,7 +122,7 @@ dialog_menu_main() }' )" - set -f # set noglob because descriptions in the $RCVAR_MENU_LIST may + set -f # set noglob because descriptions in the $menu_list may # contain `*' and get expanded by dialog(1). This prevents # dialog(1) from expanding wildcards in the help line. @@ -137,7 +133,7 @@ dialog_menu_main() \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ - $RCVAR_MENU_LIST + $menu_list # Obtain default-item from previously stored selection f_dialog_default_fetch defaultitem @@ -154,13 +150,21 @@ dialog_menu_main() --default-item \"\$defaultitem\" \ --menu \"\$prompt\" \ $height $width $rows \ - $RCVAR_MENU_LIST \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_data_sanitize menu_choice f_dialog_menutag_store "$menu_choice" f_dialog_default_store "$menu_choice" + + if [ $retval -eq $SUCCESS ]; then + local item + item=$( eval f_dialog_menutag2item${SHOW_DESC:+_with_help} \ + \"\$menu_choice\" $menu_list ) + f_dialog_menuitem_store "$item" + fi + return $retval } @@ -193,10 +197,8 @@ while :; do case "$mtag" in "X $msg_exit") break ;; *) # Anything else is an rcvar to toggle - rcvar="${mtag# }" - value=$( eval f_dialog_menutag2item${SHOW_DESC:+_with_help} \ - \"\$mtag\" $RCVAR_MENU_LIST ) + f_dialog_menuitem_fetch value # Determine the new [toggled] value to use case "$value" in From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 03:37:35 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DD951AD5; Tue, 4 Jun 2013 03:37:35 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D05F81878; Tue, 4 Jun 2013 03:37:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r543bZrU005466; Tue, 4 Jun 2013 03:37:35 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r543bZGE005465; Tue, 4 Jun 2013 03:37:35 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306040337.r543bZGE005465@svn.freebsd.org> From: Devin Teske Date: Tue, 4 Jun 2013 03:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251362 - head/usr.sbin/bsdconfig/console X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 03:37:35 -0000 Author: dteske Date: Tue Jun 4 03:37:35 2013 New Revision: 251362 URL: http://svnweb.freebsd.org/changeset/base/251362 Log: Comments. Modified: head/usr.sbin/bsdconfig/console/ttys Modified: head/usr.sbin/bsdconfig/console/ttys ============================================================================== --- head/usr.sbin/bsdconfig/console/ttys Tue Jun 4 03:30:44 2013 (r251361) +++ head/usr.sbin/bsdconfig/console/ttys Tue Jun 4 03:37:35 2013 (r251362) @@ -191,7 +191,7 @@ while :; do f_dialog_menuitem_fetch consterm err=$( ttys_set_type "$consterm" 2>&1 ) - [ "$err" ] || break + [ "$err" ] || break # to success f_dialog_msgbox "$err" done From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 03:38:17 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 69642C48; Tue, 4 Jun 2013 03:38:17 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5AC9B1883; Tue, 4 Jun 2013 03:38:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r543cHxv005613; Tue, 4 Jun 2013 03:38:17 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r543cHu7005612; Tue, 4 Jun 2013 03:38:17 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306040338.r543cHu7005612@svn.freebsd.org> From: Devin Teske Date: Tue, 4 Jun 2013 03:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251363 - head/usr.sbin/bsdconfig/networking/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 03:38:17 -0000 Author: dteske Date: Tue Jun 4 03:38:16 2013 New Revision: 251363 URL: http://svnweb.freebsd.org/changeset/base/251363 Log: Use a case-statement instead of multiple (separate even) if-statements. Modified: head/usr.sbin/bsdconfig/networking/share/media.subr Modified: head/usr.sbin/bsdconfig/networking/share/media.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/media.subr Tue Jun 4 03:37:35 2013 (r251362) +++ head/usr.sbin/bsdconfig/networking/share/media.subr Tue Jun 4 03:38:16 2013 (r251363) @@ -222,13 +222,16 @@ f_dialog_menu_media_options() if [ $retval -eq $SUCCESS ]; then options=$( eval f_dialog_menutag2item \"\$tag\" \ $supported_media ) - [ "$options" = "$opt_none" ] && options= - - if [ "$options" = "$opt_cust" ]; then + case "$options" in + "$opt_none") + options= + ;; + "$opt_cust") options="$_options" f_dialog_input_options "$interface" retval=$? - fi + ;; + esac fi return $retval From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 03:47:22 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1AD37F0C; Tue, 4 Jun 2013 03:47:22 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F080918CE; Tue, 4 Jun 2013 03:47:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r543lLIs008528; Tue, 4 Jun 2013 03:47:21 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r543lL0G008524; Tue, 4 Jun 2013 03:47:21 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306040347.r543lL0G008524@svn.freebsd.org> From: Devin Teske Date: Tue, 4 Jun 2013 03:47:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251364 - in head/usr.sbin/bsdconfig: . share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 03:47:22 -0000 Author: dteske Date: Tue Jun 4 03:47:21 2013 New Revision: 251364 URL: http://svnweb.freebsd.org/changeset/base/251364 Log: Use f_shell_escape() instead of forking to awk. In this case, the replacement comes with a great performance increase (as f_shell_escape() uses the built-in based f_replaceall() which out-performs forking to awk(1)). This should also improve readability slightly. Modified: head/usr.sbin/bsdconfig/bsdconfig head/usr.sbin/bsdconfig/share/device.subr head/usr.sbin/bsdconfig/share/variable.subr Modified: head/usr.sbin/bsdconfig/bsdconfig ============================================================================== --- head/usr.sbin/bsdconfig/bsdconfig Tue Jun 4 03:38:16 2013 (r251363) +++ head/usr.sbin/bsdconfig/bsdconfig Tue Jun 4 03:47:21 2013 (r251364) @@ -167,7 +167,6 @@ dialog_menu_main() local defaultitem= # Calculated below local hline= - local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }" local menuitem menu_title menu_help menu_selection index=2 for menuitem in $( cd $BSDCFG_LIBE && ls -d [0-9][0-9][0-9].* ); do [ $index -lt ${#DIALOG_MENU_TAGS} ] || break @@ -185,8 +184,8 @@ dialog_menu_main() menu_program="$menuitem/$menu_program" esac - menu_title=$( echo "$menu_title" | awk "$sanitize_awk" ) - menu_help=$( echo "$menu_help" | awk "$sanitize_awk" ) + f_shell_escape "$menu_title" menu_title + f_shell_escape "$menu_help" menu_help setvar "menu_program$tag" "$menu_program" menu_list="$menu_list '$tag' '$menu_title' '$menu_help'" Modified: head/usr.sbin/bsdconfig/share/device.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/device.subr Tue Jun 4 03:38:16 2013 (r251363) +++ head/usr.sbin/bsdconfig/share/device.subr Tue Jun 4 03:47:21 2013 (r251364) @@ -598,12 +598,10 @@ f_device_menu() done [ "$devs" ] || return $FAILURE - local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }" - local desc menu_list= for dev in $devs; do device_$dev get desc desc - desc=$( echo "$desc" | awk "$sanitize_awk" ) + f_shell_escape "$desc" desc menu_list="$menu_list '$dev' '$desc'" done Modified: head/usr.sbin/bsdconfig/share/variable.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/variable.subr Tue Jun 4 03:38:16 2013 (r251363) +++ head/usr.sbin/bsdconfig/share/variable.subr Tue Jun 4 03:47:21 2013 (r251364) @@ -32,6 +32,7 @@ BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 f_dprintf "%s: loading includes..." variable.subr f_include $BSDCFG_SHARE/dialog.subr +f_include $BSDCFG_SHARE/strings.subr ############################################################ GLOBALS @@ -130,12 +131,12 @@ f_variable_set_defaults() # f_dump_variables() { - local err sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }" + local err if ! err=$( ( for handle in $VARIABLES; do f_getvar $handle var || continue f_getvar $var value || continue - value=$( echo "$value" | awk "$sanitize_awk" ) + f_shell_escape "$value" value printf "%s='%s'\n" "$var" "$value" done > "$VARIABLE_DUMPFILE" ) 2>&1 ); then From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 05:07:06 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 173DCE97; Tue, 4 Jun 2013 05:07:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 063951B0C; Tue, 4 Jun 2013 05:07:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54575E3033640; Tue, 4 Jun 2013 05:07:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54573iV033621; Tue, 4 Jun 2013 05:07:03 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306040507.r54573iV033621@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 Jun 2013 05:07:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251365 - in stable/9: lib/libc/amd64/gen lib/libc/arm/gen lib/libc/gen lib/libc/i386/gen lib/libc/ia64/gen lib/libc/mips/gen lib/libc/powerpc/gen lib/libc/powerpc64/gen lib/libc/sparc6... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 05:07:06 -0000 Author: kib Date: Tue Jun 4 05:07:03 2013 New Revision: 251365 URL: http://svnweb.freebsd.org/changeset/base/251365 Log: MFC r251047: Avoid a nested frame for getcontext() call in check_deferred_signal(). Modified: stable/9/lib/libc/amd64/gen/getcontextx.c stable/9/lib/libc/arm/gen/getcontextx.c stable/9/lib/libc/gen/Symbol.map stable/9/lib/libc/i386/gen/getcontextx.c stable/9/lib/libc/ia64/gen/getcontextx.c stable/9/lib/libc/mips/gen/getcontextx.c stable/9/lib/libc/powerpc/gen/getcontextx.c stable/9/lib/libc/powerpc64/gen/getcontextx.c stable/9/lib/libc/sparc64/gen/getcontextx.c stable/9/lib/libthr/thread/thr_sig.c stable/9/sys/sys/ucontext.h Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libthr/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/lib/libc/amd64/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/amd64/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/amd64/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -57,14 +57,12 @@ __getcontextx_size(void) } int -__fillcontextx(char *ctx) +__fillcontextx2(char *ctx) { struct amd64_get_xfpustate xfpu; ucontext_t *ucp; ucp = (ucontext_t *)ctx; - if (getcontext(ucp) == -1) - return (-1); if (xstate_sz != 0) { xfpu.addr = (char *)(ucp + 1); xfpu.len = xstate_sz; @@ -80,6 +78,18 @@ __fillcontextx(char *ctx) return (0); } +int +__fillcontextx(char *ctx) +{ + ucontext_t *ucp; + + ucp = (ucontext_t *)ctx; + if (getcontext(ucp) == -1) + return (-1); + __fillcontextx2(ctx); + return (0); +} + __weak_reference(__getcontextx, getcontextx); ucontext_t * Modified: stable/9/lib/libc/arm/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/arm/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/arm/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libc/gen/Symbol.map ============================================================================== --- stable/9/lib/libc/gen/Symbol.map Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/gen/Symbol.map Tue Jun 4 05:07:03 2013 (r251365) @@ -526,5 +526,6 @@ FBSDprivate_1.0 { __elf_aux_vector; __pthread_map_stacks_exec; __fillcontextx; + __fillcontextx2; __getcontextx_size; }; Modified: stable/9/lib/libc/i386/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/i386/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/i386/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -89,14 +89,12 @@ __getcontextx_size(void) } int -__fillcontextx(char *ctx) +__fillcontextx2(char *ctx) { struct i386_get_xfpustate xfpu; ucontext_t *ucp; ucp = (ucontext_t *)ctx; - if (getcontext(ucp) == -1) - return (-1); if (xstate_sz != 0) { xfpu.addr = (char *)(ucp + 1); xfpu.len = xstate_sz; @@ -112,6 +110,18 @@ __fillcontextx(char *ctx) return (0); } +int +__fillcontextx(char *ctx) +{ + ucontext_t *ucp; + + ucp = (ucontext_t *)ctx; + if (getcontext(ucp) == -1) + return (-1); + __fillcontextx2(ctx); + return (0); +} + __weak_reference(__getcontextx, getcontextx); ucontext_t * Modified: stable/9/lib/libc/ia64/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/ia64/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/ia64/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libc/mips/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/mips/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/mips/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libc/powerpc/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/powerpc/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/powerpc/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libc/powerpc64/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/powerpc64/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/powerpc64/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libc/sparc64/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/sparc64/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/sparc64/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libthr/thread/thr_sig.c ============================================================================== --- stable/9/lib/libthr/thread/thr_sig.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libthr/thread/thr_sig.c Tue Jun 4 05:07:03 2013 (r251365) @@ -323,8 +323,13 @@ check_deferred_signal(struct pthread *cu return; #if defined(__amd64__) || defined(__i386__) - uc = alloca(__getcontextx_size()); - __fillcontextx((char *)uc); + int uc_len; + uc_len = __getcontextx_size(); + uc = alloca(uc_len); + getcontext(uc); + if (curthread->deferred_siginfo.si_signo == 0) + return; + __fillcontextx2((char *)uc); #else ucontext_t ucv; uc = &ucv; Modified: stable/9/sys/sys/ucontext.h ============================================================================== --- stable/9/sys/sys/ucontext.h Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/sys/sys/ucontext.h Tue Jun 4 05:07:03 2013 (r251365) @@ -80,7 +80,8 @@ int swapcontext(ucontext_t *, const ucon #if __BSD_VISIBLE int __getcontextx_size(void); -int __fillcontextx(char *ctx); +int __fillcontextx(char *ctx) __returns_twice; +int __fillcontextx2(char *ctx); #endif __END_DECLS From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 05:14:59 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A541925D; Tue, 4 Jun 2013 05:14:59 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from zim.MIT.EDU (50-196-151-174-static.hfc.comcastbusiness.net [50.196.151.174]) by mx1.freebsd.org (Postfix) with ESMTP id 86CCC1B6C; Tue, 4 Jun 2013 05:14:58 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.7/8.14.2) with ESMTP id r545Eqpw032907; Mon, 3 Jun 2013 22:14:52 -0700 (PDT) (envelope-from das@FreeBSD.org) Received: (from das@localhost) by zim.MIT.EDU (8.14.7/8.14.2/Submit) id r545Eqte032906; Mon, 3 Jun 2013 22:14:52 -0700 (PDT) (envelope-from das@FreeBSD.org) Date: Mon, 3 Jun 2013 22:14:52 -0700 From: David Schultz To: Alexey Dokuchaev Subject: Re: svn commit: r251121 - in head: include lib/msun lib/msun/man lib/msun/src Message-ID: <20130604051452.GA32885@zim.MIT.EDU> References: <201305300449.r4U4nRqM012625@svn.freebsd.org> <20130531033012.GB42068@FreeBSD.org> <20130603093809.GA30173@zim.MIT.EDU> <20130603152303.GA28476@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130603152303.GA28476@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 05:14:59 -0000 On Mon, Jun 03, 2013, Alexey Dokuchaev wrote: > On Mon, Jun 03, 2013 at 02:38:09AM -0700, David Schultz wrote: > > On Fri, May 31, 2013, Alexey Dokuchaev wrote: > > > On Thu, May 30, 2013 at 04:49:27AM +0000, David Schultz wrote: > > > > New Revision: 251121 > > > > URL: http://svnweb.freebsd.org/changeset/base/251121 > > > > > > > > Log: > > > > I'm happy to finally commit stephen@'s implementations of cacos, > > > > cacosh, casin, casinh, catan, and catanh. Thanks to stephen@ and bde@ > > > > for working on these. > > > > > > This is awesome, but I did not see __FreeBSD_version bumped. Many ports > > > rely on math functions, and having coherent OSVERSIONs really helps to > > > decide when some function is natively supported, or emulation code required. > > > > Done. Sorry for the delay: I wanted to add a few more functions > > first! I usually update the Porter's Handbook too, but I'm out of > > time right now, so I would appreciate it if someone could do it. > > The needed information should be in the commit message. > > It's OK, no problem (about the delay), thanks for bumping it. As for the > PH update, personally I don't think it is awfully useful to document every > __FreeBSD_version bump there (not to mention that it's generally hard to > keep this pretty volatile list consistent with the reality), but patch is > attached nonetheless (need a review and blessing from someone on the doc@ > team to commit it myself). Thanks. I think it's up to you guys to decide what's useful to document in the Porter's Handbook and what isn't. I'm more than happy to skip that step in the future. From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 05:22:23 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 76C3D562; Tue, 4 Jun 2013 05:22:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id DFEE31BCA; Tue, 4 Jun 2013 05:22:22 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r545MJrN045672; Tue, 4 Jun 2013 08:22:19 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r545MJrN045672 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r545MJnJ045671; Tue, 4 Jun 2013 08:22:19 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 4 Jun 2013 08:22:19 +0300 From: Konstantin Belousov To: Alfred Perlstein Subject: Re: svn commit: r251282 - head/sys/kern Message-ID: <20130604052219.GP3047@kib.kiev.ua> References: <201306030416.r534GmCA001872@svn.freebsd.org> <51AC1B49.9090001@mu.org> <20130603075539.GK3047@kib.kiev.ua> <51AC60CA.6050105@mu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pcq5s9LhOxPPc4wB" Content-Disposition: inline In-Reply-To: <51AC60CA.6050105@mu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 05:22:23 -0000 --pcq5s9LhOxPPc4wB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 03, 2013 at 02:24:26AM -0700, Alfred Perlstein wrote: > On 6/3/13 12:55 AM, Konstantin Belousov wrote: > > On Sun, Jun 02, 2013 at 09:27:53PM -0700, Alfred Perlstein wrote: > >> Hey Konstaintin, shouldn't this be scaled against the actual amount of > >> KVA we have instead of an arbitrary limit? > > The commit changes the buffer cache to scale according to the available > > KVA, making the scaling less dumb. > > > > I do not understand what exactly do you want to do, please describe the > > algorithm you propose to implement instead of my change. >=20 > Sure, how about deriving the hardcoded "32" from the maxkva a machine=20 > can have? >=20 > Is that possible? I do not see why this would be useful. Initially I thought about simply capping nbuf at 100000 without referencing any "memory". Then I realized that this would somewhat conflict with (unlikely) changes to the value of BKVASIZE due to "factor". --pcq5s9LhOxPPc4wB Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJRrXmKAAoJEJDCuSvBvK1Bwt4QAKO045Ea2neD2dW9NYeuEVpA R3VKd8PXfJ8oc+w29mIv035NLQwqJ6Wu+hc9aTcMq/DwyAjaKOSWqId1z6F6uMA5 ufoDkttshd9AAkNL7S7f5YTvap4XL3S/JZNjrWIoJH55nlTOy1QrnHCRJZ9VDvYb bibFNWxTkpjKJD6Zb+Ole7MCEx2Ox+yjVC0d7oDxMUJC4NirxN3JyFPWdzeqllWH zf58PZmN8kMvuBspfyYf2wHbVLyx3lngXa/ZqlqkklHenaPuSP1MvKnhNG/YlXPx CuLL77SPBCpMR9FMnMa6Ro0b54MwQ5+JkD3xokuVVS3mRGSUeRXvyR689FP7/Jdu EX+2GNJnjQAQMle0RcbSVb1EpeHfHC2i/011JyNxCIQv7Hh5XJ5cxNYPW6H/piX2 J4RbEAy1hvsYpbzE8J2tCT5ChiDCMDX8PGIXICEr6bZpLjWNatO9sS8x8PA040+1 jSBo7DO2aslJZkPtqQ9/WnWvtc9bW93jjGgtvWbP7MS41Ub+iW57SKmlol61Yjf+ wzvaHh9po3/pFqIuac1mt+T0OqeuJouviH6qeL4tnXo0PhYrQJxT+l92C/DMu7rr i1Y/fLF6e+ccnA36+PX84TJdIvJUWJ+DPTbBHmNS0N5DS77h6DfrcNaObbO4JZdT cHaM3UBPUIXQb/ZIrKDe =pc8H -----END PGP SIGNATURE----- --pcq5s9LhOxPPc4wB-- From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 05:26:54 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EE6FA91F; Tue, 4 Jun 2013 05:26:54 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (50-196-151-174-static.hfc.comcastbusiness.net [50.196.151.174]) by mx1.freebsd.org (Postfix) with ESMTP id D23501C0A; Tue, 4 Jun 2013 05:26:54 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.7/8.14.2) with ESMTP id r545QsMD032981; Mon, 3 Jun 2013 22:26:54 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.7/8.14.2/Submit) id r545QsW2032980; Mon, 3 Jun 2013 22:26:54 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Date: Mon, 3 Jun 2013 22:26:54 -0700 From: David Schultz To: Steve Kargl Subject: Re: svn commit: r251343 - in head/lib/msun: . ld128 ld80 man src Message-ID: <20130604052654.GA32850@zim.MIT.EDU> References: <201306031951.r53JpWjS051618@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201306031951.r53JpWjS051618@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 05:26:55 -0000 On Mon, Jun 03, 2013, Steve Kargl wrote: > Author: kargl > Date: Mon Jun 3 19:51:32 2013 > New Revision: 251343 > URL: http://svnweb.freebsd.org/changeset/base/251343 > > Log: > ld80 and ld128 implementations of expm1l(). This code started life > as a fairly faithful implementation of the algorithm found in Thanks! I'm glad to see this finally committed. By the way, although we did discuss separating functional and style changes, 12 commits to the same file in a day is a bit beyond the call of duty. Two commits are good, and you can save yourself and the svn-src readers some time! From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 05:41:39 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D1F9ECF4; Tue, 4 Jun 2013 05:41:39 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C51611C62; Tue, 4 Jun 2013 05:41:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r545fdLn045156; Tue, 4 Jun 2013 05:41:39 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r545fd0i045155; Tue, 4 Jun 2013 05:41:39 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201306040541.r545fd0i045155@svn.freebsd.org> From: David Schultz Date: Tue, 4 Jun 2013 05:41:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251366 - head/lib/msun X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 05:41:39 -0000 Author: das Date: Tue Jun 4 05:41:38 2013 New Revision: 251366 URL: http://svnweb.freebsd.org/changeset/base/251366 Log: Add man links for expl(3) and expm1l(3). Modified: head/lib/msun/Makefile Modified: head/lib/msun/Makefile ============================================================================== --- head/lib/msun/Makefile Tue Jun 4 05:07:03 2013 (r251365) +++ head/lib/msun/Makefile Tue Jun 4 05:41:38 2013 (r251366) @@ -162,8 +162,8 @@ MLINKS+=cos.3 cosf.3 cos.3 cosl.3 MLINKS+=cosh.3 coshf.3 MLINKS+=csqrt.3 csqrtf.3 csqrt.3 csqrtl.3 MLINKS+=erf.3 erfc.3 erf.3 erff.3 erf.3 erfcf.3 -MLINKS+=exp.3 expm1.3 exp.3 expm1f.3 exp.3 pow.3 exp.3 powf.3 \ - exp.3 exp2.3 exp.3 exp2f.3 exp.3 exp2l.3 exp.3 expf.3 +MLINKS+=exp.3 expm1.3 exp.3 expm1f.3 exp.3 expm1l.3 exp.3 pow.3 exp.3 powf.3 \ + exp.3 exp2.3 exp.3 exp2f.3 exp.3 exp2l.3 exp.3 expf.3 exp.3 expl.3 MLINKS+=fabs.3 fabsf.3 fabs.3 fabsl.3 MLINKS+=fdim.3 fdimf.3 fdim.3 fdiml.3 MLINKS+=feclearexcept.3 fegetexceptflag.3 feclearexcept.3 feraiseexcept.3 \ From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 05:44:53 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 541B4E8C; Tue, 4 Jun 2013 05:44:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 465F61C77; Tue, 4 Jun 2013 05:44:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r545irjV045712; Tue, 4 Jun 2013 05:44:53 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r545irhe045711; Tue, 4 Jun 2013 05:44:53 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201306040544.r545irhe045711@svn.freebsd.org> From: Alan Cox Date: Tue, 4 Jun 2013 05:44:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251367 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 05:44:53 -0000 Author: alc Date: Tue Jun 4 05:44:52 2013 New Revision: 251367 URL: http://svnweb.freebsd.org/changeset/base/251367 Log: Update a comment. Modified: head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Tue Jun 4 05:41:38 2013 (r251366) +++ head/sys/vm/vm_page.h Tue Jun 4 05:44:52 2013 (r251367) @@ -74,9 +74,9 @@ * * A small structure is kept for each resident * page, indexed by page number. Each structure - * is an element of several lists: + * is an element of several collections: * - * A hash table bucket used to quickly + * A radix tree used to quickly * perform object/offset lookups * * A list of all pages for a given object, From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 06:38:03 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 94AF7824; Tue, 4 Jun 2013 06:38:03 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7603E1DCA; Tue, 4 Jun 2013 06:38:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r546c3EO062087; Tue, 4 Jun 2013 06:38:03 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r546c29G062072; Tue, 4 Jun 2013 06:38:02 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201306040638.r546c29G062072@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 4 Jun 2013 06:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251368 - in head: sys/dev/filemon sys/modules/filemon tools/regression/filemon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 06:38:03 -0000 Author: obrien Date: Tue Jun 4 06:38:01 2013 New Revision: 251368 URL: http://svnweb.freebsd.org/changeset/base/251368 Log: Match the options of the kernel. Modified: head/sys/dev/filemon/filemon.c head/sys/dev/filemon/filemon_wrapper.c head/sys/modules/filemon/Makefile head/tools/regression/filemon/Makefile head/tools/regression/filemon/filemontest.c head/tools/regression/filemon/test_script.sh Modified: head/sys/dev/filemon/filemon.c ============================================================================== --- head/sys/dev/filemon/filemon.c Tue Jun 4 05:44:52 2013 (r251367) +++ head/sys/dev/filemon/filemon.c Tue Jun 4 06:38:01 2013 (r251368) @@ -25,10 +25,11 @@ * SUCH DAMAGE. */ -#include +#include __FBSDID("$FreeBSD$"); -#include +#include "opt_compat.h" + #include #include #include Modified: head/sys/dev/filemon/filemon_wrapper.c ============================================================================== --- head/sys/dev/filemon/filemon_wrapper.c Tue Jun 4 05:44:52 2013 (r251367) +++ head/sys/dev/filemon/filemon_wrapper.c Tue Jun 4 06:38:01 2013 (r251368) @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #if __FreeBSD_version > 800032 #define FILEMON_HAS_LINKAT #endif Modified: head/sys/modules/filemon/Makefile ============================================================================== --- head/sys/modules/filemon/Makefile Tue Jun 4 05:44:52 2013 (r251367) +++ head/sys/modules/filemon/Makefile Tue Jun 4 06:38:01 2013 (r251368) @@ -4,6 +4,6 @@ KMOD= filemon SRCS= ${KMOD}.c -SRCS+= vnode_if.h opt_compat.h opt_capsicum.h +SRCS+= opt_compat.h .include Modified: head/tools/regression/filemon/Makefile ============================================================================== --- head/tools/regression/filemon/Makefile Tue Jun 4 05:44:52 2013 (r251367) +++ head/tools/regression/filemon/Makefile Tue Jun 4 06:38:01 2013 (r251368) @@ -1,10 +1,20 @@ # $FreeBSD$ -BINS= \ +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" +BI_BITS= +.endif + +_BINS= \ filemontest \ - timed-forkb + timed-forkb \ + sizeof_long + +BINS= ${_BINS} +.if defined(BI_BITS) +BINS+= ${_BINS:C/$/32/g} +.endif -bins: filemontest timed-forkb +bins: ${BINS} all: bins NO_MAN= @@ -18,20 +28,25 @@ WITHOUT_CDDL= CLEANFILES+= ${BINS} -tests: bins + +.for f32 in ${BINS} +${f32}32: ${f32}.c + ${CC} -m32 -DBIT=\"32\" -o ${.TARGET} ${CFLAGS} ${.ALLSRC} +.endfor + +tests: kldstat | grep filemon - ${MAKE} test - @echo "Without filemon(4) active:" - ./timed-forkb - @echo "With filemon(4) active:" - script -f typescript-timed-forkb ./timed-forkb - ls -l typescript-timed-forkb.filemon + @echo "" + ${MAKE} test01 + ${MAKE} test02 +.if defined(BI_BITS) + ${MAKE} test32 +.endif @echo "filemon(4) tests passed." # Cannot use .OBJDIR -- 'filemontest' expects 'test_script.sh' in . -#FILEMONTEST32= filemontest32 -test: filemontest clean-test -.for BIN in filemontest ${FILEMONTEST32} +test01: ${BINS:Mfilemontest*} ${BINS:Msizeof_long*} clean-test +.for BIN in ${BINS:Mfilemontest} cd ${.CURDIR} ; \ for A in 1 2 3 4 5 6 7 8 9 0; do \ for B in 1 2 3 4 5 6 7 8 9 0; do \ @@ -41,13 +56,30 @@ test: filemontest clean-test done ;\ done @cd ${.CURDIR} ; set +e ; egrep '(Start|Stop) .*\.' filemon_log.* | \ - grep -q -v '\.[0-9][0-9][0-9][0-9][0-9][0-9]$$' || echo "Time stamp format OK" + grep -q -v '\.[0-9][0-9][0-9][0-9][0-9][0-9]$$' || printf "Time stamp format OK\n\n" .endfor + @cd ${.CURDIR} ; set +e ; for F in filemon_log.* ; do \ + tail -1 $$F | grep -q '# Bye bye' || echo "$$F missing filemon bye-bye" ; \ + NL=`wc -l $$F | awk '{print $$1}'` ; \ + if [ "$${NL}" != 97 ]; then echo "$$F BAD, contains $${NL} lines" ; exit 1 ; fi ; done + +test02: ${BINS:Mtimed-forkb*} + @echo "Without filemon(4) active:" + ./timed-forkb + @echo "With filemon(4) active:" + script -f typescript-timed-forkb ./timed-forkb + ls -l typescript-timed-forkb.filemon + +test32: ${BINS:M*32*} + script -f typescript.${.TARGET} ./sizeof_long32 >/dev/null + @tail -1 typescript.test32.filemon | grep -q '# Bye bye' || (echo '32-bit comapt filemon Missing "bye-bye"' ; exit 1) + @egrep -q '^X [0-9]+ 0$$' typescript.test32.filemon || (echo "32-bit binary exit ERROR" ; exit 1) + @printf "filemon(4) 32bit FreeBSD support passed.\n\n" CLEANFILES+= typescript-timed-forkb typescript-timed-forkb.filemon clean-test: - cd ${.CURDIR} ; rm -f filemon_log.* + cd ${.CURDIR} ; rm -f filemon_log*.* clean-tests: clean-test Modified: head/tools/regression/filemon/filemontest.c ============================================================================== --- head/tools/regression/filemon/filemontest.c Tue Jun 4 05:44:52 2013 (r251367) +++ head/tools/regression/filemon/filemontest.c Tue Jun 4 06:38:01 2013 (r251368) @@ -43,9 +43,13 @@ __FBSDID("$FreeBSD$"); * "test_script.sh" in the cwd. */ +#ifndef BIT +#define BIT "" +#endif + int main(void) { - char log_name[] = "filemon_log.XXXXXX"; + char log_name[] = "filemon_log" BIT ".XXXXXX"; pid_t child; int fm_fd, fm_log; @@ -66,7 +70,7 @@ main(void) { child = getpid(); if (ioctl(fm_fd, FILEMON_SET_PID, &child) == -1) err(1, "Cannot set filemon PID to %d", child); - system("./test_script.sh"); + system("env BIT=" BIT " ./test_script.sh"); break; case -1: err(1, "Cannot fork"); Modified: head/tools/regression/filemon/test_script.sh ============================================================================== --- head/tools/regression/filemon/test_script.sh Tue Jun 4 05:44:52 2013 (r251367) +++ head/tools/regression/filemon/test_script.sh Tue Jun 4 06:38:01 2013 (r251368) @@ -41,3 +41,4 @@ ed -s $f1 < $f2 #w" | ed -s $f1 #rm $f1 $f2 uptime > /dev/null +sizeof_long${BIT} > /dev/null From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 07:37:07 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 97966D2; Tue, 4 Jun 2013 07:37:07 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 882771F9C; Tue, 4 Jun 2013 07:37:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r547b7P7086829; Tue, 4 Jun 2013 07:37:07 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r547b6Ys086819; Tue, 4 Jun 2013 07:37:06 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201306040737.r547b6Ys086819@svn.freebsd.org> From: Joel Dahl Date: Tue, 4 Jun 2013 07:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251369 - in head: lib/libc/gen lib/libc/net share/man/man3 usr.bin/m4/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 07:37:07 -0000 Author: joel (doc committer) Date: Tue Jun 4 07:37:06 2013 New Revision: 251369 URL: http://svnweb.freebsd.org/changeset/base/251369 Log: mdoc: convert .Fd to .In, which is much nicer. Modified: head/lib/libc/gen/dl_iterate_phdr.3 head/lib/libc/net/getaddrinfo.3 head/lib/libc/net/getnameinfo.3 head/share/man/man3/offsetof.3 head/usr.bin/m4/lib/ohash_init.3 head/usr.bin/m4/lib/ohash_interval.3 Modified: head/lib/libc/gen/dl_iterate_phdr.3 ============================================================================== --- head/lib/libc/gen/dl_iterate_phdr.3 Tue Jun 4 06:38:01 2013 (r251368) +++ head/lib/libc/gen/dl_iterate_phdr.3 Tue Jun 4 07:37:06 2013 (r251369) @@ -29,7 +29,7 @@ Statically linked programs use an implem .Fn dl_iterate_phdr from libc. .Sh SYNOPSIS -.Fd #include +.In link.h .Ft int .Fn dl_iterate_phdr "int (*callback)(struct dl_phdr_info *, size_t, void *)" "void *data" .Sh DESCRIPTION Modified: head/lib/libc/net/getaddrinfo.3 ============================================================================== --- head/lib/libc/net/getaddrinfo.3 Tue Jun 4 06:38:01 2013 (r251368) +++ head/lib/libc/net/getaddrinfo.3 Tue Jun 4 07:37:06 2013 (r251369) @@ -26,9 +26,9 @@ .Nm freeaddrinfo .Nd socket address structure to host and service name .Sh SYNOPSIS -.Fd #include -.Fd #include -.Fd #include +.In sys/types.h +.In sys/socket.h +.In netdb.h .Ft int .Fo getaddrinfo .Fa "const char *hostname" "const char *servname" Modified: head/lib/libc/net/getnameinfo.3 ============================================================================== --- head/lib/libc/net/getnameinfo.3 Tue Jun 4 06:38:01 2013 (r251368) +++ head/lib/libc/net/getnameinfo.3 Tue Jun 4 07:37:06 2013 (r251369) @@ -25,9 +25,9 @@ .Nm getnameinfo .Nd socket address structure to hostname and service name .Sh SYNOPSIS -.Fd #include -.Fd #include -.Fd #include +.In sys/types.h +.In sys/socket.h +.In netdb.h .Ft int .Fo getnameinfo .Fa "const struct sockaddr *sa" "socklen_t salen" "char *host" Modified: head/share/man/man3/offsetof.3 ============================================================================== --- head/share/man/man3/offsetof.3 Tue Jun 4 06:38:01 2013 (r251368) +++ head/share/man/man3/offsetof.3 Tue Jun 4 07:37:06 2013 (r251369) @@ -23,7 +23,7 @@ .Nm offsetof .Nd offset of a structure member .Sh SYNOPSIS -.Fd #include +.In stddef.h .Ft size_t .Fn offsetof "type" "member" .Sh DESCRIPTION Modified: head/usr.bin/m4/lib/ohash_init.3 ============================================================================== --- head/usr.bin/m4/lib/ohash_init.3 Tue Jun 4 06:38:01 2013 (r251368) +++ head/usr.bin/m4/lib/ohash_init.3 Tue Jun 4 07:37:06 2013 (r251369) @@ -31,9 +31,9 @@ .Nm ohash_entries .Nd light-weight open hashing .Sh SYNOPSIS -.Fd #include -.Fd #include -.Fd #include +.In stdint.h +.In stddef.h +.In ohash.h .Ft void .Fn ohash_init "struct ohash *h" "unsigned int size" "struct ohash_info *info" .Ft void Modified: head/usr.bin/m4/lib/ohash_interval.3 ============================================================================== --- head/usr.bin/m4/lib/ohash_interval.3 Tue Jun 4 06:38:01 2013 (r251368) +++ head/usr.bin/m4/lib/ohash_interval.3 Tue Jun 4 07:37:06 2013 (r251369) @@ -25,9 +25,9 @@ .Nm ohash_qlookupi .Nd helper functions for open hashing .Sh SYNOPSIS -.Fd #include -.Fd #include -.Fd #include +.In stdint.h +.In stddef.h +.In ohash.h .Ft uint32_t .Fn ohash_interval "const char *start" "const char **pend" .Ft "void *" From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 08:15:18 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DBD9060A; Tue, 4 Jun 2013 08:15:18 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx07.syd.optusnet.com.au (fallbackmx07.syd.optusnet.com.au [211.29.132.9]) by mx1.freebsd.org (Postfix) with ESMTP id C7B0510D7; Tue, 4 Jun 2013 08:15:16 +0000 (UTC) Received: from mail17.syd.optusnet.com.au (mail17.syd.optusnet.com.au [211.29.132.198]) by fallbackmx07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r548F465019721; Tue, 4 Jun 2013 18:15:04 +1000 Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail17.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r548Ence025428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 4 Jun 2013 18:14:51 +1000 Date: Tue, 4 Jun 2013 18:14:49 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov Subject: Re: svn commit: r251282 - head/sys/kern In-Reply-To: <20130604052219.GP3047@kib.kiev.ua> Message-ID: <20130604170410.M1018@besplex.bde.org> References: <201306030416.r534GmCA001872@svn.freebsd.org> <51AC1B49.9090001@mu.org> <20130603075539.GK3047@kib.kiev.ua> <51AC60CA.6050105@mu.org> <20130604052219.GP3047@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=e/de0tV/ c=1 sm=1 a=kj_ttALqKtUA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=M4roAWbnUW4A:10 a=IWIlB6OQ2OuE0nCdm-YA:9 a=CjuIK1q_8ugA:10 a=Qxv59xfT--BE3oyG:21 a=W3MHmfVKcGBJ_qNC:21 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 08:15:18 -0000 On Tue, 4 Jun 2013, Konstantin Belousov wrote: > On Mon, Jun 03, 2013 at 02:24:26AM -0700, Alfred Perlstein wrote: >> On 6/3/13 12:55 AM, Konstantin Belousov wrote: >>> On Sun, Jun 02, 2013 at 09:27:53PM -0700, Alfred Perlstein wrote: >>>> Hey Konstaintin, shouldn't this be scaled against the actual amount of >>>> KVA we have instead of an arbitrary limit? >>> The commit changes the buffer cache to scale according to the available >>> KVA, making the scaling less dumb. >>> >>> I do not understand what exactly do you want to do, please describe the >>> algorithm you propose to implement instead of my change. >> >> Sure, how about deriving the hardcoded "32" from the maxkva a machine >> can have? >> >> Is that possible? > I do not see why this would be useful. Initially I thought about simply > capping nbuf at 100000 without referencing any "memory". Then I realized > that this would somewhat conflict with (unlikely) changes to the value > of BKVASIZE due to "factor". The presence of BKVASIZE in 'factor' is a bug. My version never had this bug (see below for a patch). The scaling should be to maximize nbuf, subject to non-arbitrary limits on physical memory and kva, and now an arbirary limit of about 100000 / (BKVASIZE / 16384) on nbuf. Your new limit is arbitrary so it shouldn't affect nbuf depending on BKVASIZE. Expanding BKVASIZE should expand kva use, but on i386 this will soon hit a non-arbitary kva limit so nbuf will not be as high as preferred. nbuf needs to be very large mainly to support file systems with small buffers. Even 100000 only gives 50MB of buffering if the fs block size is 512. This would shrink to only 12.5MB if BKVASIZE is expanded by a factor of 4 and the bug is not fixed. If 25000 buffers after expanding BKVASIZE is enough, then that should be the arbitary limit (independent of BKVASIZE) so as to save physical memory. On i386 systems with 1GB RAM, nbuf defaults to about 7000. With an fs block size of 512, that can buffer 3.5MB. Expanding BKVASIZE by a factor of 4 shrinks this to 0.875MB in -current. That is ridiculously small. VMIO limits the lossage from this. BKVASIZE was originally 8KB. I forget if nbuf was halved by not modifying the scale factor when it was expanded to 16KB. Probably not. I used to modify the scale factor to get twice as many as the default nbuf, but once the default nbuf expanded to a few thousand it became large enough for most purposes so I no longer do this. Except on arches with extremely limit kva like i386, KVASIZE should be MAXBSIZE, and all of the complications for expanding a buffer's kva beyond BKVASIZE and handling the fragmentation problems caused by this shouldn't exist. Limits like vfs.maxbufspace should be scaled by NOMBSIZE = current BKVASIZE instead of BKVASIZE. Oops, my NOMBSIZE has similar logical problems to BKVASIZE. It needs to be precisely 16KB to preserve the defaults for nbuf and maxbufspace, but the nominal (ffs) buffer size is now 32KB. So the heuristic scale factors should use the historical magic number 16K. I changed sequential_heuristic() to use a hard-coded 16K instead of BKVASIZE. The correct number here depends on disk technology. The patch has many style fixes: @ Index: vfs_bio.c @ =================================================================== @ RCS file: /home/ncvs/src/sys/kern/vfs_bio.c,v @ retrieving revision 1.436 @ diff -u -2 -r1.436 vfs_bio.c @ --- vfs_bio.c 17 Jun 2004 17:16:49 -0000 1.436 @ +++ vfs_bio.c 3 Jun 2013 16:04:34 -0000 @ @@ -419,64 +493,54 @@ @ @ /* @ - * Calculating buffer cache scaling values and reserve space for buffer @ + * Calculate buffer cache scaling values and reserve space for buffer @ * headers. This is called during low level kernel initialization and @ * may be called more then once. We CANNOT write to the memory area @ * being reserved at this time. @ */ @ -caddr_t @ -kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) @ +void * @ +vfs_bio_alloc(void *va) The API name was verbose and bogus. The prefix for this subsystem is vfs_bio_, not kern_vfs_bio_. This is a generic allocation routine. It always allocated swbufs and has expanded to do more allocations. @ { @ - /* @ - * physmem_est is in pages. Convert it to kilobytes (assumes @ - * PAGE_SIZE is >= 1K) @ - */ @ - physmem_est = physmem_est * (PAGE_SIZE / 1024); I use the global physmem. This change may be too i386-specific. In with 8-16 RAM, a significant amount of RAM may be eaten by the kernel image or perhaps just unavailable to the kernel. Now memories are larger and the amount eaten is relatively insignificant (since we are only using a small fraction of physmem, only the relative error matters). @ + int factor, memsize; @ @ /* @ - * The nominal buffer size (and minimum KVA allocation) is BKVASIZE. @ - * For the first 64MB of ram nominally allocate sufficient buffers to @ - * cover 1/4 of our ram. Beyond the first 64MB allocate additional @ - * buffers to cover 1/20 of our ram over 64MB. When auto-sizing @ - * the buffer cache we limit the eventual kva reservation to @ + * The nominal buffer size is NOMBSIZE. @ + * For the first 4MB of RAM, allocate 50 buffers. @ + * For the next 60MB of RAM, nominally allocate sufficient buffers to @ + * cover 1/4 of the RAM. Beyond the first 64MB allocate additional @ + * buffers to cover 1/20 of the RAM. When auto-sizing @ + * the buffer cache, limit the eventual kva reservation to @ * maxbcache bytes. Fix old bitrot in this comment, and update for my changes. - the first 4MB wasn't mentioned - the minimum clamp wasn't mentioned - replace BKVASIZE by NOMBSIZE so that I can change BKVASIZE without changing the default nbuf (subject to maxbcache). The bitrot of the magic number 1/20 is not fixed. The code uses 1/10. This is fixed in -current. I should have noticed this before, since I used to have to change the code to get 1/10 instead of 1/20. I hope you updated the comment for recent changes, but I don't like having magic numbers in comments. @ * @ - * factor represents the 1/4 x ram conversion. @ + * `factor' represents the 1/4 of RAM conversion. @ */ @ +#define NOMBSIZE imax(PAGE_SIZE, 16384) /* XXX */ @ if (nbuf == 0) { @ - int factor = 4 * BKVASIZE / 1024; @ + /* @ + * physmem is in pages. Convert it to a size in kilobytes. @ + * XXX no ptob(). @ + */ @ + memsize = ctob(physmem) / 1024; @ @ + factor = 4 * NOMBSIZE / 1024; @ nbuf = 50; @ - if (physmem_est > 4096) @ - nbuf += min((physmem_est - 4096) / factor, @ - 65536 / factor); @ - if (physmem_est > 65536) @ - nbuf += (physmem_est - 65536) * 2 / (factor * 5); @ - @ - if (maxbcache && nbuf > maxbcache / BKVASIZE) @ - nbuf = maxbcache / BKVASIZE; The maxbcache limit must be applied to the non-default nbuf too. @ + if (memsize > 4096) @ + nbuf += imin((memsize - 4096) / factor, @ + (65536 - 4096) / factor); @ + if (memsize > 65536) @ + nbuf += (memsize - 65536) * 2 / (factor * 5); @ } @ - @ -#if 0 @ - /* @ - * Do not allow the buffer_map to be more then 1/2 the size of the @ - * kernel_map. @ - */ @ - if (nbuf > (kernel_map->max_offset - kernel_map->min_offset) / @ - (BKVASIZE * 2)) { @ - nbuf = (kernel_map->max_offset - kernel_map->min_offset) / @ - (BKVASIZE * 2); @ - printf("Warning: nbufs capped at %d\n", nbuf); @ - } @ -#endif Already removed in -current. @ + if (nbuf > maxbcache / BKVASIZE) @ + nbuf = maxbcache / BKVASIZE; @ @ /* @ * swbufs are used as temporary holders for I/O, such as paging I/O. @ - * We have no less then 16 and no more then 256. @ + * There must be between 16 and 256 of them. @ */ @ - nswbuf = max(min(nbuf/4, 256), 16); @ + nswbuf = imax(imin(nbuf / 4, 256), 16); @ #ifdef NSWBUF_MIN @ if (nswbuf < NSWBUF_MIN) @ nswbuf = NSWBUF_MIN; @ #endif @ + @ #ifdef DIRECTIO @ ffs_rawread_setup(); @ @@ -484,12 +548,12 @@ @ @ /* @ - * Reserve space for the buffer cache buffers @ + * Reserve space for swbuf headers and buffer cache buffers. @ */ @ - swbuf = (void *)v; @ - v = (caddr_t)(swbuf + nswbuf); @ - buf = (void *)v; @ - v = (caddr_t)(buf + nbuf); @ + swbuf = va; @ + va = swbuf + nswbuf; @ + buf = va; @ + va = buf + nbuf; @ @ - return(v); @ + return (va); @ } @ Don't use the caddr_t mistake. The API was also changed to not use it. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 08:59:11 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 77D1F7C1; Tue, 4 Jun 2013 08:59:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 1173812A4; Tue, 4 Jun 2013 08:59:10 +0000 (UTC) Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r548wwIP018120 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 4 Jun 2013 18:59:03 +1000 Date: Tue, 4 Jun 2013 18:58:58 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jeremie Le Hen Subject: Re: svn commit: r250991 - in head: contrib/jemalloc/include/jemalloc include lib/libc/stdlib/jemalloc In-Reply-To: <20130531064239.GF70224@caravan.chchile.org> Message-ID: <20130604181934.R1018@besplex.bde.org> References: <201305251859.r4PIxChc053341@svn.freebsd.org> <20130531064239.GF70224@caravan.chchile.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=e/de0tV/ c=1 sm=1 a=rFD-CHOitREA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=sGq7gZRHcmUA:10 a=iBoK8JgcxXjK5WcVGSQA:9 a=CjuIK1q_8ugA:10 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Marcel Moolenaar , src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 08:59:11 -0000 On Fri, 31 May 2013, Jeremie Le Hen wrote: > On Sat, May 25, 2013 at 06:59:12PM +0000, Marcel Moolenaar wrote: >> ... >> Log: >> Make the malloc(3) family of functions weak and make their non-weak >> implementations visible for use by applications. The functions $F that >> are now weak symbols are: >> allocm, calloc, dallocm, free, malloc, malloc_usable_size, >> nallocm, posix_memalign, rallocm, realloc, sallocm >> .. > I don't understand what this brings. It apparently brings (exposes) lots of bugs :-). > If an application want to override > malloc() et al., it can just do it and the dynamic linker won't look up > the libc's version. This doesn't work for static linkage. Static linkage is non-broken, and doesn't allow replacing 1 symbol in an object file without replacing all of them, except possibly for weak symbols. Not replacing all of the symbols, by using the dynamic linkage bug or weak symbols, is very fragile. A program might replace malloc() and free() but not bother replacing calloc() because it doesn't use it. But a library might use it. The program shouldn't omit repacing calloc(). calloc() is a well-known public part of malloc() so it is easy to know that it needs to be replaced. But it is hard to know all the implementation details that need replacing. > Would you mind giving an example of what is now possible with this > change? I hope it will make it possible to replace malloc() so that small statically linked programs take 1K text again like they did in FreeBSD-3. In FreeBSD-4, malloc() now adds 360K to this in programs that don't want to use malloc() or stdio, because (poorly implemented) constructors reference it, and it references stdio (at least in the non-production version). Replacing it is difficult because of the complex dependencies of symbols. The first reference to it in a constructor was in atexit in FreeBSD-4, then malloc() only added 10K and was easy to replace. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 09:21:19 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0771DE70; Tue, 4 Jun 2013 09:21:19 +0000 (UTC) (envelope-from gber@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EDF4A13C1; Tue, 4 Jun 2013 09:21:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r549LI4Z021618; Tue, 4 Jun 2013 09:21:18 GMT (envelope-from gber@svn.freebsd.org) Received: (from gber@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r549LI8t021617; Tue, 4 Jun 2013 09:21:18 GMT (envelope-from gber@svn.freebsd.org) Message-Id: <201306040921.r549LI8t021617@svn.freebsd.org> From: Grzegorz Bernacki Date: Tue, 4 Jun 2013 09:21:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251370 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 09:21:19 -0000 Author: gber Date: Tue Jun 4 09:21:18 2013 New Revision: 251370 URL: http://svnweb.freebsd.org/changeset/base/251370 Log: Implement pmap_copy() for ARMv6/v7. Copy the given range of mappings from the source map to the destination map, thereby reducing the number of VM faults on fork. Submitted by: Zbigniew Bodek Sponsored by: The FreeBSD Foundation, Semihalf Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Tue Jun 4 07:37:06 2013 (r251369) +++ head/sys/arm/arm/pmap-v6.c Tue Jun 4 09:21:18 2013 (r251370) @@ -2966,6 +2966,126 @@ void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { + struct l2_bucket *l2b_src, *l2b_dst; + struct pv_entry *pve; + vm_offset_t addr; + vm_offset_t end_addr; + vm_offset_t next_bucket; + u_int flags; + boolean_t l2b_alloc; + + CTR4(KTR_PMAP, "%s: VA = 0x%08x, len = 0x%08x. Will %s\n", __func__, + src_addr, len, (dst_addr != src_addr) ? "exit" : "copy"); + + if (dst_addr != src_addr) + return; + + rw_wlock(&pvh_global_lock); + if (dst_pmap < src_pmap) { + PMAP_LOCK(dst_pmap); + PMAP_LOCK(src_pmap); + } else { + PMAP_LOCK(src_pmap); + PMAP_LOCK(dst_pmap); + } + + end_addr = src_addr + len; + addr = src_addr; + /* + * Iterate through all used l2_buckets in a given range. + */ + while (addr < end_addr) { + pt_entry_t *src_ptep, *dst_ptep; + pt_entry_t src_pte; + + next_bucket = L2_NEXT_BUCKET(addr); + /* + * If the next bucket VA is out of the + * copy range then set it to end_addr in order + * to copy all mappings until the given limit. + */ + if (next_bucket > end_addr) + next_bucket = end_addr; + + l2b_src = pmap_get_l2_bucket(src_pmap, addr); + if (l2b_src == NULL) { + addr = next_bucket; + continue; + } + src_ptep = &l2b_src->l2b_kva[l2pte_index(addr)]; + + while (addr < next_bucket) { + vm_page_t srcmpte; + + src_pte = *src_ptep; + srcmpte = PHYS_TO_VM_PAGE(l2pte_pa(src_pte)); + /* + * We only virtual copy managed pages + */ + if (srcmpte && (srcmpte->oflags & VPO_UNMANAGED) == 0) { + l2b_alloc = FALSE; + l2b_dst = pmap_get_l2_bucket(dst_pmap, addr); + /* + * Check if the allocation of another + * l2_bucket is necessary. + */ + if (l2b_dst == NULL) { + l2b_dst = pmap_alloc_l2_bucket(dst_pmap, + addr); + l2b_alloc = TRUE; + } + if (l2b_dst == NULL) + goto out; + + dst_ptep = &l2b_dst->l2b_kva[l2pte_index(addr)]; + + if (*dst_ptep == 0 && + (pve = pmap_get_pv_entry(dst_pmap, TRUE))) { + /* + * Check whether the source mapping is + * writable and set the proper flag + * for a copied mapping so that right + * permissions could be set on the + * access fault. + */ + flags = 0; + if ((src_pte & L2_APX) == 0) + flags = PVF_WRITE; + pmap_enter_pv(srcmpte, pve, dst_pmap, + addr, flags); + /* + * Clear the modified and + * accessed (referenced) flags + * and don't set the wired flag + * during the copy. + */ + *dst_ptep = src_pte; + *dst_ptep &= ~L2_S_REF; + *dst_ptep |= L2_APX; + /* + * Update stats + */ + l2b_dst->l2b_occupancy++; + dst_pmap->pm_stats.resident_count++; + } else { + /* + * If the l2_bucket was acquired as + * a result of allocation then free it. + */ + if (l2b_alloc) + pmap_free_l2_bucket(dst_pmap, + l2b_dst, 1); + goto out; + } + } + addr += PAGE_SIZE; + src_ptep++; + } + } +out: + rw_wunlock(&pvh_global_lock); + PMAP_UNLOCK(src_pmap); + PMAP_UNLOCK(dst_pmap); } From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 09:33:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 066C93A4; Tue, 4 Jun 2013 09:33:04 +0000 (UTC) (envelope-from gber@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D23251660; Tue, 4 Jun 2013 09:33:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r549X3U8025169; Tue, 4 Jun 2013 09:33:03 GMT (envelope-from gber@svn.freebsd.org) Received: (from gber@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r549X3J7025167; Tue, 4 Jun 2013 09:33:03 GMT (envelope-from gber@svn.freebsd.org) Message-Id: <201306040933.r549X3J7025167@svn.freebsd.org> From: Grzegorz Bernacki Date: Tue, 4 Jun 2013 09:33:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251371 - head/sys/arm/mv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 09:33:04 -0000 Author: gber Date: Tue Jun 4 09:33:03 2013 New Revision: 251371 URL: http://svnweb.freebsd.org/changeset/base/251371 Log: Fix the passing of time on Armada XP. In order to become independent of Coherency Fabric frequency, configure Timer and Watchdog to operate in 25MHz mode. Submitted by: Zbigniew Bodek Modified: head/sys/arm/mv/mvreg.h head/sys/arm/mv/timer.c Modified: head/sys/arm/mv/mvreg.h ============================================================================== --- head/sys/arm/mv/mvreg.h Tue Jun 4 09:21:18 2013 (r251370) +++ head/sys/arm/mv/mvreg.h Tue Jun 4 09:33:03 2013 (r251371) @@ -215,6 +215,10 @@ #define CPU_TIMER1_AUTO 0x00000008 #define CPU_TIMER_WD_EN 0x00000010 #define CPU_TIMER_WD_AUTO 0x00000020 +/* 25MHz mode is Armada XP - specific */ +#define CPU_TIMER_WD_25MHZ_EN 0x00000400 +#define CPU_TIMER0_25MHZ_EN 0x00000800 +#define CPU_TIMER1_25MHZ_EN 0x00001000 #define CPU_TIMER0_REL 0x10 #define CPU_TIMER0 0x14 Modified: head/sys/arm/mv/timer.c ============================================================================== --- head/sys/arm/mv/timer.c Tue Jun 4 09:21:18 2013 (r251370) +++ head/sys/arm/mv/timer.c Tue Jun 4 09:33:03 2013 (r251371) @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #define MAX_WATCHDOG_TICKS (0xffffffff) #if defined(SOC_MV_ARMADAXP) -#define MV_CLOCK_SRC get_l2clk() +#define MV_CLOCK_SRC 25000000 /* Timers' 25MHz mode */ #else #define MV_CLOCK_SRC get_tclk() #endif @@ -323,6 +323,9 @@ mv_watchdog_enable(void) val = mv_get_timer_control(); val |= CPU_TIMER_WD_EN | CPU_TIMER_WD_AUTO; +#if defined(SOC_MV_ARMADAXP) + val |= CPU_TIMER_WD_25MHZ_EN; +#endif mv_set_timer_control(val); } @@ -440,6 +443,10 @@ mv_setup_timers(void) val = mv_get_timer_control(); val &= ~(CPU_TIMER0_EN | CPU_TIMER0_AUTO); val |= CPU_TIMER1_EN | CPU_TIMER1_AUTO; +#if defined(SOC_MV_ARMADAXP) + /* Enable 25MHz mode */ + val |= CPU_TIMER0_25MHZ_EN | CPU_TIMER1_25MHZ_EN; +#endif mv_set_timer_control(val); timers_initialized = 1; } From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 10:47:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A0DE1F9C; Tue, 4 Jun 2013 10:47:45 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8151119E9; Tue, 4 Jun 2013 10:47:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54Alj9J050736; Tue, 4 Jun 2013 10:47:45 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54AljAX050733; Tue, 4 Jun 2013 10:47:45 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306041047.r54AljAX050733@svn.freebsd.org> From: Steven Hartland Date: Tue, 4 Jun 2013 10:47:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251372 - in stable/9/sys/cam: ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 10:47:45 -0000 Author: smh Date: Tue Jun 4 10:47:44 2013 New Revision: 251372 URL: http://svnweb.freebsd.org/changeset/base/251372 Log: Enhanced BIO_DELETE support for CAM SCSI to add ATA_TRIM support. Disable CAM BIO queue sorting for non-rotating media by default. MFC r249939 Added available delete methods discovery during device probe MFC r249941 Automatically disable BIO queue sorting for non-rotating media MFC r250033 Correct comment typo's MFC r250179 Update probe flow so that devices with lbp can also disable disksort MFC r250180 Fix probe in progress check in dareprobe MFC r250181 Check for ATA Information VPD before querying for ATA MFC r250183 Enable CAM SCSI to choice ATA TRIM during autodetection MFC r250967 Enforce validation on the selected delete method via sysctl Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Tue Jun 4 09:33:03 2013 (r251371) +++ stable/9/sys/cam/ata/ata_da.c Tue Jun 4 10:47:44 2013 (r251372) @@ -1159,7 +1159,11 @@ adaregister(struct cam_periph *periph, v snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.write_cache", periph->unit_number); TUNABLE_INT_FETCH(announce_buf, &softc->write_cache); - softc->sort_io_queue = -1; + /* Disable queue sorting for non-rotational media by default. */ + if (cgd->ident_data.media_rotation_rate == 1) + softc->sort_io_queue = 0; + else + softc->sort_io_queue = -1; adagetparams(periph, cgd); softc->disk = disk_alloc(); softc->disk->d_devstat = devstat_new_entry(periph->periph_name, Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Tue Jun 4 09:33:03 2013 (r251371) +++ stable/9/sys/cam/scsi/scsi_all.h Tue Jun 4 10:47:44 2013 (r251372) @@ -1430,6 +1430,36 @@ struct scsi_diag_page { }; /* + * ATA Information VPD Page based on + * T10/2126-D Revision 04 + */ +#define SVPD_ATA_INFORMATION 0x89 + +/* + * Block Device Characteristics VPD Page based on + * T10/1799-D Revision 31 + */ +struct scsi_vpd_block_characteristics +{ + u_int8_t device; + u_int8_t page_code; +#define SVPD_BDC 0xB1 + u_int8_t page_length[2]; + u_int8_t medium_rotation_rate[2]; +#define SVPD_BDC_RATE_NOT_REPORTED 0x00 +#define SVPD_BDC_RATE_NONE_ROTATING 0x01 + u_int8_t reserved1; + u_int8_t nominal_form_factor; +#define SVPD_BDC_FORM_NOT_REPORTED 0x00 +#define SVPD_BDC_FORM_5_25INCH 0x01 +#define SVPD_BDC_FORM_3_5INCH 0x02 +#define SVPD_BDC_FORM_2_5INCH 0x03 +#define SVPD_BDC_FORM_1_5INCH 0x04 +#define SVPD_BDC_FORM_LESSTHAN_1_5INCH 0x05 + u_int8_t reserved2[56]; +}; + +/* * Logical Block Provisioning VPD Page based on * T10/1799-D Revision 31 */ Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Tue Jun 4 09:33:03 2013 (r251371) +++ stable/9/sys/cam/scsi/scsi_da.c Tue Jun 4 10:47:44 2013 (r251372) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #endif /* _KERNEL */ @@ -67,8 +68,12 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL typedef enum { - DA_STATE_PROBE, - DA_STATE_PROBE2, + DA_STATE_PROBE_RC, + DA_STATE_PROBE_RC16, + DA_STATE_PROBE_LBP, + DA_STATE_PROBE_BLK_LIMITS, + DA_STATE_PROBE_BDC, + DA_STATE_PROBE_ATA, DA_STATE_NORMAL } da_state; @@ -96,29 +101,47 @@ typedef enum { } da_quirks; typedef enum { - DA_CCB_PROBE = 0x01, - DA_CCB_PROBE2 = 0x02, - DA_CCB_BUFFER_IO = 0x03, - DA_CCB_WAITING = 0x04, - DA_CCB_DUMP = 0x05, - DA_CCB_DELETE = 0x06, - DA_CCB_TUR = 0x07, + DA_CCB_PROBE_RC = 0x01, + DA_CCB_PROBE_RC16 = 0x02, + DA_CCB_PROBE_LBP = 0x03, + DA_CCB_PROBE_BLK_LIMITS = 0x04, + DA_CCB_PROBE_BDC = 0x05, + DA_CCB_PROBE_ATA = 0x06, + DA_CCB_BUFFER_IO = 0x07, + DA_CCB_WAITING = 0x08, + DA_CCB_DUMP = 0x0A, + DA_CCB_DELETE = 0x0B, + DA_CCB_TUR = 0x0C, DA_CCB_TYPE_MASK = 0x0F, DA_CCB_RETRY_UA = 0x10 } da_ccb_state; +/* + * Order here is important for method choice + * + * We prefer ATA_TRIM as tests run against a Sandforce 2281 SSD attached to + * LSI 2008 (mps) controller (FW: v12, Drv: v14) resulted 20% quicker deletes + * using ATA_TRIM than the corresponding UNMAP results for a real world mysql + * import taking 5mins. + * + */ typedef enum { DA_DELETE_NONE, DA_DELETE_DISABLE, - DA_DELETE_ZERO, - DA_DELETE_WS10, - DA_DELETE_WS16, + DA_DELETE_ATA_TRIM, DA_DELETE_UNMAP, - DA_DELETE_MAX = DA_DELETE_UNMAP + DA_DELETE_WS16, + DA_DELETE_WS10, + DA_DELETE_ZERO, + DA_DELETE_MIN = DA_DELETE_ATA_TRIM, + DA_DELETE_MAX = DA_DELETE_ZERO } da_delete_methods; static const char *da_delete_method_names[] = - { "NONE", "DISABLE", "ZERO", "WS10", "WS16", "UNMAP" }; + { "NONE", "DISABLE", "ATA_TRIM", "UNMAP", "WS16", "WS10", "ZERO" }; +static const char *da_delete_method_desc[] = + { "NONE", "DISABLED", "ATA TRIM", "UNMAP", "WRITE SAME(16) with UNMAP", + "WRITE SAME(10) with UNMAP", "ZERO" }; /* Offsets into our private area for storing information */ #define ccb_state ppriv_field0 @@ -134,7 +157,17 @@ struct disk_params { u_int stripeoffset; }; -#define UNMAP_MAX_RANGES 512 +#define UNMAP_RANGE_MAX 0xffffffff +#define UNMAP_HEAD_SIZE 8 +#define UNMAP_RANGE_SIZE 16 +#define UNMAP_MAX_RANGES 2048 /* Protocol Max is 4095 */ +#define UNMAP_BUF_SIZE ((UNMAP_MAX_RANGES * UNMAP_RANGE_SIZE) + \ + UNMAP_HEAD_SIZE) + +#define WS10_MAX_BLKS 0xffff +#define WS16_MAX_BLKS 0xffffffff +#define ATA_TRIM_MAX_RANGES ((UNMAP_BUF_SIZE / \ + (ATA_DSM_RANGE_SIZE * ATA_DSM_BLK_SIZE)) * ATA_DSM_BLK_SIZE) struct da_softc { struct bio_queue_head bio_queue; @@ -150,11 +183,14 @@ struct da_softc { int error_inject; int ordered_tag_count; int outstanding_cmds; - int unmap_max_ranges; - int unmap_max_lba; + int trim_max_ranges; int delete_running; int tur; - da_delete_methods delete_method; + int delete_available; /* Delete methods possibly available */ + uint32_t unmap_max_ranges; + uint32_t unmap_max_lba; + uint64_t ws_max_blks; + da_delete_methods delete_method; struct disk_params params; struct disk *disk; union ccb saved_ccb; @@ -163,11 +199,18 @@ struct da_softc { struct sysctl_oid *sysctl_tree; struct callout sendordered_c; uint64_t wwpn; - uint8_t unmap_buf[UNMAP_MAX_RANGES * 16 + 8]; + uint8_t unmap_buf[UNMAP_BUF_SIZE]; struct scsi_read_capacity_data_long rcaplong; struct callout mediapoll_c; }; +#define dadeleteflag(softc, delete_method, enable) \ + if (enable) { \ + softc->delete_available |= (1 << delete_method); \ + } else { \ + softc->delete_available &= ~(1 << delete_method); \ + } + struct da_quirk_entry { struct scsi_inquiry_pattern inq_pat; da_quirks quirks; @@ -870,6 +913,10 @@ static int dacmdsizesysctl(SYSCTL_HANDL static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS); static void dadeletemethodset(struct da_softc *softc, da_delete_methods delete_method); +static void dadeletemethodchoose(struct da_softc *softc, + da_delete_methods default_method); +static void daprobedone(struct cam_periph *periph, union ccb *ccb); + static periph_ctor_t daregister; static periph_dtor_t dacleanup; static periph_start_t dastart; @@ -1581,6 +1628,85 @@ dadeletemethodset(struct da_softc *softc softc->disk->d_flags &= ~DISKFLAG_CANDELETE; } +static void +daprobedone(struct cam_periph *periph, union ccb *ccb) +{ + struct da_softc *softc; + + softc = (struct da_softc *)periph->softc; + + dadeletemethodchoose(softc, DA_DELETE_NONE); + + if (bootverbose && (softc->flags & DA_FLAG_PROBED) == 0) { + char buf[80]; + int i, sep; + + snprintf(buf, sizeof(buf), "Delete methods: <"); + sep = 0; + for (i = DA_DELETE_MIN; i <= DA_DELETE_MAX; i++) { + if (softc->delete_available & (1 << i)) { + if (sep) { + strlcat(buf, ",", sizeof(buf)); + } else { + sep = 1; + } + strlcat(buf, da_delete_method_names[i], + sizeof(buf)); + if (i == softc->delete_method) { + strlcat(buf, "(*)", sizeof(buf)); + } + } + } + if (sep == 0) { + if (softc->delete_method == DA_DELETE_NONE) + strlcat(buf, "NONE(*)", sizeof(buf)); + else + strlcat(buf, "DISABLED(*)", sizeof(buf)); + } + strlcat(buf, ">", sizeof(buf)); + printf("%s%d: %s\n", periph->periph_name, + periph->unit_number, buf); + } + + /* + * Since our peripheral may be invalidated by an error + * above or an external event, we must release our CCB + * before releasing the probe lock on the peripheral. + * The peripheral will only go away once the last lock + * is removed, and we need it around for the CCB release + * operation. + */ + xpt_release_ccb(ccb); + softc->state = DA_STATE_NORMAL; + daschedule(periph); + wakeup(&softc->disk->d_mediasize); + if ((softc->flags & DA_FLAG_PROBED) == 0) { + softc->flags |= DA_FLAG_PROBED; + cam_periph_unhold(periph); + } else + cam_periph_release_locked(periph); +} + +static void +dadeletemethodchoose(struct da_softc *softc, da_delete_methods default_method) +{ + int i, delete_method; + + delete_method = default_method; + + /* + * Use the pre-defined order to choose the best + * performing delete. + */ + for (i = DA_DELETE_MIN; i <= DA_DELETE_MAX; i++) { + if (softc->delete_available & (1 << i)) { + dadeletemethodset(softc, i); + return; + } + } + dadeletemethodset(softc, delete_method); +} + static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS) { @@ -1601,7 +1727,8 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS if (error != 0 || req->newptr == NULL) return (error); for (i = 0; i <= DA_DELETE_MAX; i++) { - if (strcmp(buf, da_delete_method_names[i]) != 0) + if (!(softc->delete_available & (1 << i)) || + strcmp(buf, da_delete_method_names[i]) != 0) continue; dadeletemethodset(softc, i); return (0); @@ -1634,14 +1761,16 @@ daregister(struct cam_periph *periph, vo } LIST_INIT(&softc->pending_ccbs); - softc->state = DA_STATE_PROBE; + softc->state = DA_STATE_PROBE_RC; bioq_init(&softc->bio_queue); bioq_init(&softc->delete_queue); bioq_init(&softc->delete_run_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= DA_FLAG_PACK_REMOVABLE; softc->unmap_max_ranges = UNMAP_MAX_RANGES; - softc->unmap_max_lba = 1024*1024*2; + softc->unmap_max_lba = UNMAP_RANGE_MAX; + softc->ws_max_blks = WS16_MAX_BLKS; + softc->trim_max_ranges = ATA_TRIM_MAX_RANGES; softc->sort_io_queue = -1; periph->softc = softc; @@ -1718,7 +1847,7 @@ daregister(struct cam_periph *periph, vo /* Predict whether device may support READ CAPACITY(16). */ if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3) { softc->flags |= DA_FLAG_CAN_RC16; - softc->state = DA_STATE_PROBE2; + softc->state = DA_STATE_PROBE_RC16; } /* @@ -1818,6 +1947,7 @@ dastart(struct cam_periph *periph, union CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dastart\n")); +skipstate: switch (softc->state) { case DA_STATE_NORMAL: { @@ -1842,13 +1972,36 @@ dastart(struct cam_periph *periph, union if (!softc->delete_running && (bp = bioq_first(&softc->delete_queue)) != NULL) { uint64_t lba; - u_int count; + uint64_t count; /* forward compat with WS32 */ + + /* + * In each of the methods below, while its the caller's + * responsibility to ensure the request will fit into a + * single device request, we might have changed the delete + * method due to the device incorrectly advertising either + * its supported methods or limits. + * + * To prevent this causing further issues we validate the + * against the methods limits, and warn which would + * otherwise be unnecessary. + */ if (softc->delete_method == DA_DELETE_UNMAP) { uint8_t *buf = softc->unmap_buf; uint64_t lastlba = (uint64_t)-1; - uint32_t lastcount = 0; - int blocks = 0, off, ranges = 0; + uint32_t lastcount = 0, c; + uint64_t totalcount = 0; + uint32_t off, ranges = 0; + + /* + * Currently this doesn't take the UNMAP + * Granularity and Granularity Alignment + * fields into account. + * + * This could result in both unoptimal unmap + * requests as as well as UNMAP calls unmapping + * fewer LBA's than requested. + */ softc->delete_running = 1; bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); @@ -1862,22 +2015,44 @@ dastart(struct cam_periph *periph, union /* Try to extend the previous range. */ if (lba == lastlba) { - lastcount += count; - off = (ranges - 1) * 16 + 8; + c = min(count, softc->unmap_max_lba - + lastcount); + lastcount += c; + off = ((ranges - 1) * UNMAP_RANGE_SIZE) + + UNMAP_HEAD_SIZE; scsi_ulto4b(lastcount, &buf[off + 8]); - } else if (count > 0) { - off = ranges * 16 + 8; + count -= c; + lba +=c; + totalcount += c; + } + + while (count > 0) { + c = min(count, softc->unmap_max_lba); + if (totalcount + c > softc->unmap_max_lba || + ranges >= softc->unmap_max_ranges) { + xpt_print(periph->path, + "%s issuing short delete %ld > %ld" + "|| %d >= %d", + da_delete_method_desc[softc->delete_method], + totalcount + c, softc->unmap_max_lba, + ranges, softc->unmap_max_ranges); + break; + } + off = (ranges * UNMAP_RANGE_SIZE) + + UNMAP_HEAD_SIZE; scsi_u64to8b(lba, &buf[off + 0]); - scsi_ulto4b(count, &buf[off + 8]); - lastcount = count; + scsi_ulto4b(c, &buf[off + 8]); + lba += c; + totalcount += c; ranges++; + count -= c; + lastcount = c; } - blocks += count; - lastlba = lba + count; + lastlba = lba; bp1 = bioq_first(&softc->delete_queue); if (bp1 == NULL || ranges >= softc->unmap_max_ranges || - blocks + bp1->bio_bcount / + totalcount + bp1->bio_bcount / softc->params.secsize > softc->unmap_max_lba) break; } while (1); @@ -1895,9 +2070,87 @@ dastart(struct cam_periph *periph, union da_default_timeout * 1000); start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; goto out; + } else if (softc->delete_method == DA_DELETE_ATA_TRIM) { + uint8_t *buf = softc->unmap_buf; + uint64_t lastlba = (uint64_t)-1; + uint32_t lastcount = 0, c, requestcount; + int ranges = 0, off, block_count; + + softc->delete_running = 1; + bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + lba = bp1->bio_pblkno; + count = bp1->bio_bcount / softc->params.secsize; + requestcount = count; + + /* Try to extend the previous range. */ + if (lba == lastlba) { + c = min(count, ATA_DSM_RANGE_MAX - lastcount); + lastcount += c; + off = (ranges - 1) * 8; + buf[off + 6] = lastcount & 0xff; + buf[off + 7] = (lastcount >> 8) & 0xff; + count -= c; + lba += c; + } + + while (count > 0) { + c = min(count, ATA_DSM_RANGE_MAX); + off = ranges * 8; + + buf[off + 0] = lba & 0xff; + buf[off + 1] = (lba >> 8) & 0xff; + buf[off + 2] = (lba >> 16) & 0xff; + buf[off + 3] = (lba >> 24) & 0xff; + buf[off + 4] = (lba >> 32) & 0xff; + buf[off + 5] = (lba >> 40) & 0xff; + buf[off + 6] = c & 0xff; + buf[off + 7] = (c >> 8) & 0xff; + lba += c; + ranges++; + count -= c; + lastcount = c; + if (count != 0 && ranges == softc->trim_max_ranges) { + xpt_print(periph->path, + "%s issuing short delete %ld > %ld", + da_delete_method_desc[softc->delete_method], + requestcount, + (softc->trim_max_ranges - ranges) * + ATA_DSM_RANGE_MAX); + break; + } + } + lastlba = lba; + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || + bp1->bio_bcount / softc->params.secsize > + (softc->trim_max_ranges - ranges) * + ATA_DSM_RANGE_MAX) + break; + } while (1); + + block_count = (ranges + ATA_DSM_BLK_RANGES - 1) / + ATA_DSM_BLK_RANGES; + scsi_ata_trim(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + block_count, + /*data_ptr*/buf, + /*dxfer_len*/block_count * ATA_DSM_BLK_SIZE, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; + goto out; } else if (softc->delete_method == DA_DELETE_ZERO || softc->delete_method == DA_DELETE_WS10 || softc->delete_method == DA_DELETE_WS16) { + uint64_t ws_max_blks; + ws_max_blks = softc->ws_max_blks / softc->params.secsize; softc->delete_running = 1; lba = bp->bio_pblkno; count = 0; @@ -1907,11 +2160,19 @@ dastart(struct cam_periph *periph, union if (bp1 != bp) bioq_insert_tail(&softc->delete_run_queue, bp1); count += bp1->bio_bcount / softc->params.secsize; + if (count > ws_max_blks) { + count = min(count, ws_max_blks); + xpt_print(periph->path, + "%s issuing short delete %ld > %ld", + da_delete_method_desc[softc->delete_method], + count, ws_max_blks); + break; + } bp1 = bioq_first(&softc->delete_queue); if (bp1 == NULL || lba + count != bp1->bio_pblkno || count + bp1->bio_bcount / - softc->params.secsize > 0xffff) + softc->params.secsize > ws_max_blks) break; } while (1); @@ -2031,7 +2292,7 @@ out: daschedule(periph); break; } - case DA_STATE_PROBE: + case DA_STATE_PROBE_RC: { struct scsi_read_capacity_data *rcap; @@ -2050,11 +2311,11 @@ out: SSD_FULL_SIZE, /*timeout*/5000); start_ccb->ccb_h.ccb_bp = NULL; - start_ccb->ccb_h.ccb_state = DA_CCB_PROBE; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_RC; xpt_action(start_ccb); break; } - case DA_STATE_PROBE2: + case DA_STATE_PROBE_RC16: { struct scsi_read_capacity_data_long *rcaplong; @@ -2076,8 +2337,148 @@ out: /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ da_default_timeout * 1000); start_ccb->ccb_h.ccb_bp = NULL; - start_ccb->ccb_h.ccb_state = DA_CCB_PROBE2; - xpt_action(start_ccb); + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_RC16; + xpt_action(start_ccb); + break; + } + case DA_STATE_PROBE_LBP: + { + struct scsi_vpd_logical_block_prov *lbp; + + if (!scsi_vpd_supported_page(periph, SVPD_LBP)) { + /* + * If we get here we don't support any SBC-3 delete + * methods with UNMAP as the Logical Block Provisioning + * VPD page support is required for devices which + * support it according to T10/1799-D Revision 31 + * however older revisions of the spec don't mandate + * this so we currently don't remove these methods + * from the available set. + */ + softc->state = DA_STATE_PROBE_BLK_LIMITS; + goto skipstate; + } + + lbp = (struct scsi_vpd_logical_block_prov *) + malloc(sizeof(*lbp), M_SCSIDA, M_NOWAIT|M_ZERO); + + if (lbp == NULL) { + printf("dastart: Couldn't malloc lbp data\n"); + /* da_free_periph??? */ + break; + } + + scsi_inquiry(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*inq_buf*/(u_int8_t *)lbp, + /*inq_len*/sizeof(*lbp), + /*evpd*/TRUE, + /*page_code*/SVPD_LBP, + /*sense_len*/SSD_MIN_SIZE, + /*timeout*/da_default_timeout * 1000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_LBP; + xpt_action(start_ccb); + break; + } + case DA_STATE_PROBE_BLK_LIMITS: + { + struct scsi_vpd_block_limits *block_limits; + + if (!scsi_vpd_supported_page(periph, SVPD_BLOCK_LIMITS)) { + /* Not supported skip to next probe */ + softc->state = DA_STATE_PROBE_BDC; + goto skipstate; + } + + block_limits = (struct scsi_vpd_block_limits *) + malloc(sizeof(*block_limits), M_SCSIDA, M_NOWAIT|M_ZERO); + + if (block_limits == NULL) { + printf("dastart: Couldn't malloc block_limits data\n"); + /* da_free_periph??? */ + break; + } + + scsi_inquiry(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*inq_buf*/(u_int8_t *)block_limits, + /*inq_len*/sizeof(*block_limits), + /*evpd*/TRUE, + /*page_code*/SVPD_BLOCK_LIMITS, + /*sense_len*/SSD_MIN_SIZE, + /*timeout*/da_default_timeout * 1000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_BLK_LIMITS; + xpt_action(start_ccb); + break; + } + case DA_STATE_PROBE_BDC: + { + struct scsi_vpd_block_characteristics *bdc; + + if (!scsi_vpd_supported_page(periph, SVPD_BDC)) { + softc->state = DA_STATE_PROBE_ATA; + goto skipstate; + } + + bdc = (struct scsi_vpd_block_characteristics *) + malloc(sizeof(*bdc), M_SCSIDA, M_NOWAIT|M_ZERO); + + if (bdc == NULL) { + printf("dastart: Couldn't malloc bdc data\n"); + /* da_free_periph??? */ + break; + } + + scsi_inquiry(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*inq_buf*/(u_int8_t *)bdc, + /*inq_len*/sizeof(*bdc), + /*evpd*/TRUE, + /*page_code*/SVPD_BDC, + /*sense_len*/SSD_MIN_SIZE, + /*timeout*/da_default_timeout * 1000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_BDC; + xpt_action(start_ccb); + break; + } + case DA_STATE_PROBE_ATA: + { + struct ata_params *ata_params; + + if (!scsi_vpd_supported_page(periph, SVPD_ATA_INFORMATION)) { + daprobedone(periph, start_ccb); + break; + } + + ata_params = (struct ata_params*) + malloc(sizeof(*ata_params), M_SCSIDA, M_NOWAIT|M_ZERO); + + if (ata_params == NULL) { + printf("dastart: Couldn't malloc ata_params data\n"); + /* da_free_periph??? */ + break; + } + + scsi_ata_identify(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*data_ptr*/(u_int8_t *)ata_params, + /*dxfer_len*/sizeof(*ata_params), + /*sense_len*/SSD_FULL_SIZE, + /*timeout*/da_default_timeout * 1000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_ATA; + xpt_action(start_ccb); break; } } @@ -2097,27 +2498,31 @@ cmd6workaround(union ccb *ccb) softc = (struct da_softc *)xpt_path_periph(ccb->ccb_h.path)->softc; if (ccb->ccb_h.ccb_state == DA_CCB_DELETE) { - if (softc->delete_method == DA_DELETE_UNMAP) { - xpt_print(ccb->ccb_h.path, "UNMAP is not supported, " - "switching to WRITE SAME(16) with UNMAP.\n"); - dadeletemethodset(softc, DA_DELETE_WS16); - } else if (softc->delete_method == DA_DELETE_WS16) { - xpt_print(ccb->ccb_h.path, - "WRITE SAME(16) with UNMAP is not supported, " - "disabling BIO_DELETE.\n"); - dadeletemethodset(softc, DA_DELETE_DISABLE); - } else if (softc->delete_method == DA_DELETE_WS10) { + da_delete_methods old_method = softc->delete_method; + + /* + * Typically there are two reasons for failure here + * 1. Delete method was detected as supported but isn't + * 2. Delete failed due to invalid params e.g. too big + * + * While we will attempt to choose an alternative delete method + * this may result in short deletes if the existing delete + * requests from geom are big for the new method choosen. + * + * This method assumes that the error which triggered this + * will not retry the io otherwise a panic will occur + */ + dadeleteflag(softc, old_method, 0); + dadeletemethodchoose(softc, DA_DELETE_DISABLE); + if (softc->delete_method == DA_DELETE_DISABLE) xpt_print(ccb->ccb_h.path, - "WRITE SAME(10) with UNMAP is not supported, " - "disabling BIO_DELETE.\n"); - dadeletemethodset(softc, DA_DELETE_DISABLE); - } else if (softc->delete_method == DA_DELETE_ZERO) { + "%s failed, disabling BIO_DELETE\n", + da_delete_method_desc[old_method]); + else xpt_print(ccb->ccb_h.path, - "WRITE SAME(10) is not supported, " - "disabling BIO_DELETE.\n"); - dadeletemethodset(softc, DA_DELETE_DISABLE); - } else - dadeletemethodset(softc, DA_DELETE_DISABLE); + "%s failed, switching to %s BIO_DELETE\n", + da_delete_method_desc[old_method], + da_delete_method_desc[softc->delete_method]); if (DA_SIO) { while ((bp = bioq_takefirst(&softc->delete_run_queue)) @@ -2201,7 +2606,7 @@ dadone(struct cam_periph *periph, union error = daerror(done_ccb, CAM_RETRY_SELTO, sf); if (error == ERESTART) { /* - * A retry was scheuled, so + * A retry was scheduled, so * just return. */ return; @@ -2297,16 +2702,18 @@ dadone(struct cam_periph *periph, union biodone(bp); break; } - case DA_CCB_PROBE: - case DA_CCB_PROBE2: + case DA_CCB_PROBE_RC: + case DA_CCB_PROBE_RC16: { struct scsi_read_capacity_data *rdcap; struct scsi_read_capacity_data_long *rcaplong; char announce_buf[80]; + int lbp; + lbp = 0; rdcap = NULL; rcaplong = NULL; - if (state == DA_CCB_PROBE) + if (state == DA_CCB_PROBE_RC) rdcap =(struct scsi_read_capacity_data *)csio->data_ptr; else rcaplong = (struct scsi_read_capacity_data_long *) @@ -2319,7 +2726,7 @@ dadone(struct cam_periph *periph, union u_int lbppbe; /* LB per physical block exponent. */ u_int lalba; /* Lowest aligned LBA. */ - if (state == DA_CCB_PROBE) { + if (state == DA_CCB_PROBE_RC) { block_size = scsi_4btoul(rdcap->length); maxsector = scsi_4btoul(rdcap->addr); lbppbe = 0; @@ -2334,9 +2741,9 @@ dadone(struct cam_periph *periph, union * with the short version of the command. */ if (maxsector == 0xffffffff) { - softc->state = DA_STATE_PROBE2; free(rdcap, M_SCSIDA); xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_RC16; xpt_schedule(periph, priority); return; } @@ -2369,9 +2776,7 @@ dadone(struct cam_periph *periph, union */ dasetgeom(periph, block_size, maxsector, rcaplong, sizeof(*rcaplong)); - if ((lalba & SRC16_LBPME_A) - && softc->delete_method == DA_DELETE_NONE) - dadeletemethodset(softc, DA_DELETE_UNMAP); + lbp = (lalba & SRC16_LBPME_A); dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), "%juMB (%ju %u byte sectors: %dH %dS/T " @@ -2432,7 +2837,7 @@ dadone(struct cam_periph *periph, union * If we tried READ CAPACITY(16) and failed, * fallback to READ CAPACITY(10). */ - if ((state == DA_CCB_PROBE2) && + if ((state == DA_CCB_PROBE_RC16) && (softc->flags & DA_FLAG_CAN_RC16) && (((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) || @@ -2440,9 +2845,9 @@ dadone(struct cam_periph *periph, union (error_code == SSD_CURRENT_ERROR) && (sense_key == SSD_KEY_ILLEGAL_REQUEST)))) { softc->flags &= ~DA_FLAG_CAN_RC16; - softc->state = DA_STATE_PROBE; free(rdcap, M_SCSIDA); xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_RC; xpt_schedule(periph, priority); return; } else @@ -2498,28 +2903,248 @@ dadone(struct cam_periph *periph, union taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task); xpt_announce_periph(periph, announce_buf); + } else { xpt_print(periph->path, "fatal error, " "could not acquire reference count\n"); } } - /* - * Since our peripheral may be invalidated by an error - * above or an external event, we must release our CCB - * before releasing the probe lock on the peripheral. - * The peripheral will only go away once the last lock - * is removed, and we need it around for the CCB release - * operation. - */ + + /* Ensure re-probe doesn't see old delete. */ + softc->delete_available = 0; + if (lbp) { + /* + * Based on older SBC-3 spec revisions + * any of the UNMAP methods "may" be + * available via LBP given this flag so + * we flag all of them as availble and + * then remove those which further + * probes confirm aren't available + * later. + * + * We could also check readcap(16) p_type + * flag to exclude one or more invalid + * write same (X) types here + */ + dadeleteflag(softc, DA_DELETE_WS16, 1); + dadeleteflag(softc, DA_DELETE_WS10, 1); + dadeleteflag(softc, DA_DELETE_ZERO, 1); + dadeleteflag(softc, DA_DELETE_UNMAP, 1); + + xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_LBP; + xpt_schedule(periph, priority); + return; + } + xpt_release_ccb(done_ccb); - softc->state = DA_STATE_NORMAL; - daschedule(periph); - wakeup(&softc->disk->d_mediasize); - if ((softc->flags & DA_FLAG_PROBED) == 0) { - softc->flags |= DA_FLAG_PROBED; - cam_periph_unhold(periph); - } else - cam_periph_release_locked(periph); + softc->state = DA_STATE_PROBE_BDC; + xpt_schedule(periph, priority); + return; + } + case DA_CCB_PROBE_LBP: + { + struct scsi_vpd_logical_block_prov *lbp; + + lbp = (struct scsi_vpd_logical_block_prov *)csio->data_ptr; + + if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + /* + * T10/1799-D Revision 31 states at least one of these + * must be supported but we don't currently enforce this. + */ + dadeleteflag(softc, DA_DELETE_WS16, + (lbp->flags & SVPD_LBP_WS16)); + dadeleteflag(softc, DA_DELETE_WS10, + (lbp->flags & SVPD_LBP_WS10)); + dadeleteflag(softc, DA_DELETE_ZERO, + (lbp->flags & SVPD_LBP_WS10)); + dadeleteflag(softc, DA_DELETE_UNMAP, + (lbp->flags & SVPD_LBP_UNMAP)); + + if (lbp->flags & SVPD_LBP_UNMAP) { + free(lbp, M_SCSIDA); + xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_BLK_LIMITS; + xpt_schedule(periph, priority); + return; + } + } else { + int error; + error = daerror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA|SF_NO_PRINT); + if (error == ERESTART) + return; + else if (error != 0) { + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + /* Don't wedge this device's queue */ + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + } + + /* + * Failure indicates we don't support any SBC-3 + * delete methods with UNMAP + */ + } + } + + free(lbp, M_SCSIDA); + xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_BDC; + xpt_schedule(periph, priority); + return; + } + case DA_CCB_PROBE_BLK_LIMITS: + { + struct scsi_vpd_block_limits *block_limits; + + block_limits = (struct scsi_vpd_block_limits *)csio->data_ptr; + + if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + uint32_t max_unmap_lba_cnt = scsi_4btoul( + block_limits->max_unmap_lba_cnt); + uint32_t max_unmap_blk_cnt = scsi_4btoul( + block_limits->max_unmap_blk_cnt); + uint64_t ws_max_blks = scsi_8btou64( + block_limits->max_write_same_length); + /* + * We should already support UNMAP but we check lba + * and block count to be sure + */ + if (max_unmap_lba_cnt != 0x00L && + max_unmap_blk_cnt != 0x00L) { + softc->unmap_max_lba = max_unmap_lba_cnt; + softc->unmap_max_ranges = min(max_unmap_blk_cnt, + UNMAP_MAX_RANGES); + } else { + /* + * Unexpected UNMAP limits which means the + * device doesn't actually support UNMAP + */ + dadeleteflag(softc, DA_DELETE_UNMAP, 0); + } + + if (ws_max_blks != 0x00L) + softc->ws_max_blks = ws_max_blks; + } else { + int error; + error = daerror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA|SF_NO_PRINT); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 11:05:58 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 54E6C36A; Tue, 4 Jun 2013 11:05:58 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 47CC11AB2; Tue, 4 Jun 2013 11:05:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54B5waa057163; Tue, 4 Jun 2013 11:05:58 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54B5wUG057162; Tue, 4 Jun 2013 11:05:58 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306041105.r54B5wUG057162@svn.freebsd.org> From: Marius Strobl Date: Tue, 4 Jun 2013 11:05:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251373 - head/sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 11:05:58 -0000 Author: marius Date: Tue Jun 4 11:05:57 2013 New Revision: 251373 URL: http://svnweb.freebsd.org/changeset/base/251373 Log: Flag isp(4) as supporting unmapped I/O; all necessary conversion actually already has been done as part of r246713. Reviewed by: mjacob Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Tue Jun 4 10:47:44 2013 (r251372) +++ head/sys/dev/isp/isp_freebsd.c Tue Jun 4 11:05:57 2013 (r251373) @@ -5449,7 +5449,7 @@ isp_action(struct cam_sim *sim, union cc if (IS_FC(isp)) { fcparam *fcp = FCPARAM(isp, bus); - cpi->hba_misc = PIM_NOBUSRESET; + cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED; /* * Because our loop ID can shift from time to time, @@ -5479,7 +5479,7 @@ isp_action(struct cam_sim *sim, union cc } else { sdparam *sdp = SDPARAM(isp, bus); cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16; - cpi->hba_misc = 0; + cpi->hba_misc = PIM_UNMAPPED; cpi->initiator_id = sdp->isp_initiator_id; cpi->base_transfer_speed = 3300; cpi->transport = XPORT_SPI; From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 11:19:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 73AB370D; Tue, 4 Jun 2013 11:19:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4B52C1B58; Tue, 4 Jun 2013 11:19:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54BJ9DN061233; Tue, 4 Jun 2013 11:19:09 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54BJ9NO061232; Tue, 4 Jun 2013 11:19:09 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306041119.r54BJ9NO061232@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 4 Jun 2013 11:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251374 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 11:19:09 -0000 Author: glebius Date: Tue Jun 4 11:19:08 2013 New Revision: 251374 URL: http://svnweb.freebsd.org/changeset/base/251374 Log: Improve r250890, so that we stop processing of a message with zero descriptors as early as possible, and assert that number of descriptors is positive in unp_freerights(). Reviewed by: mjg, pjd, jilles Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Tue Jun 4 11:05:57 2013 (r251373) +++ head/sys/kern/uipc_usrreq.c Tue Jun 4 11:19:08 2013 (r251374) @@ -1686,8 +1686,8 @@ unp_freerights(struct filedescent **fdep struct file *fp; int i; - if (fdcount == 0) - return; + KASSERT(fdcount > 0, ("%s: fdcount %d", __func__, fdcount)); + for (i = 0; i < fdcount; i++) { fp = fdep[i]->fde_file; filecaps_free(&fdep[i]->fde_caps); @@ -1725,6 +1725,8 @@ unp_externalize(struct mbuf *control, st if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SCM_RIGHTS) { newfds = datalen / sizeof(*fdep); + if (newfds == 0) + goto next; fdep = data; /* If we're not outputting the descriptors free them. */ @@ -1770,8 +1772,7 @@ unp_externalize(struct mbuf *control, st unp_externalize_fp(fde->fde_file); } FILEDESC_XUNLOCK(fdesc); - if (newfds != 0) - free(fdep[0], M_FILECAPS); + free(fdep[0], M_FILECAPS); } else { /* We can just copy anything else across. */ if (error || controlp == NULL) @@ -1894,6 +1895,8 @@ unp_internalize(struct mbuf **controlp, case SCM_RIGHTS: oldfds = datalen / sizeof (int); + if (oldfds == 0) + break; /* * Check that all the FDs passed in refer to legal * files. If not, reject the entire operation. @@ -1928,10 +1931,6 @@ unp_internalize(struct mbuf **controlp, error = E2BIG; goto out; } - if (oldfds == 0) { - FILEDESC_SUNLOCK(fdesc); - break; - } fdp = data; fdep = (struct filedescent **) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 12:03:04 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BEE804C3; Tue, 4 Jun 2013 12:03:04 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx07.syd.optusnet.com.au (fallbackmx07.syd.optusnet.com.au [211.29.132.9]) by mx1.freebsd.org (Postfix) with ESMTP id EAEAD1DB2; Tue, 4 Jun 2013 12:03:03 +0000 (UTC) Received: from mail36.syd.optusnet.com.au (mail36.syd.optusnet.com.au [211.29.133.76]) by fallbackmx07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r54C2vwP005402; Tue, 4 Jun 2013 22:02:57 +1000 Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail36.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r54C2lJW000581 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 4 Jun 2013 22:02:48 +1000 Date: Tue, 4 Jun 2013 22:02:47 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Schultz Subject: Re: svn commit: r251292 - in head/lib/msun: . ld128 ld80 man src In-Reply-To: <201306030914.r539EWdh009315@svn.freebsd.org> Message-ID: <20130604220059.B4115@besplex.bde.org> References: <201306030914.r539EWdh009315@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=BPvrNysG c=1 sm=1 a=1DwG04LQoRAA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=6y1nRL9r6LUA:10 a=IPdTA4C2pKR0zjeWDWIA:9 a=CjuIK1q_8ugA:10 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 12:03:04 -0000 On Mon, 3 Jun 2013, David Schultz wrote: > Log: > Add logl, log2l, log10l, and log1pl. > > Submitted by: bde Thanks for looking after this. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 14:38:51 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 16BB2F70; Tue, 4 Jun 2013 14:38:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 08BEF16ED; Tue, 4 Jun 2013 14:38:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54EcoLM027236; Tue, 4 Jun 2013 14:38:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54EcogP027235; Tue, 4 Jun 2013 14:38:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306041438.r54EcogP027235@svn.freebsd.org> From: John Baldwin Date: Tue, 4 Jun 2013 14:38:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251378 - stable/9/sys/ofed/drivers/infiniband/ulp/sdp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 14:38:51 -0000 Author: jhb Date: Tue Jun 4 14:38:50 2013 New Revision: 251378 URL: http://svnweb.freebsd.org/changeset/base/251378 Log: MFC 249066: Check for SS_NBIO in the socket state field rather than socket buffer flags. Modified: stable/9/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Tue Jun 4 13:55:03 2013 (r251377) +++ stable/9/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Tue Jun 4 14:38:50 2013 (r251378) @@ -1267,7 +1267,7 @@ sdp_sorecv(struct socket *so, struct soc /* Socket buffer is empty and we shall not block. */ if (sb->sb_cc == 0 && - ((sb->sb_flags & SS_NBIO) || (flags & (MSG_DONTWAIT|MSG_NBIO)))) { + ((so->so_state & SS_NBIO) || (flags & (MSG_DONTWAIT|MSG_NBIO)))) { error = EAGAIN; goto out; } @@ -1297,7 +1297,7 @@ restart: /* Socket buffer got some data that we shall deliver now. */ if (sb->sb_cc > 0 && !(flags & MSG_WAITALL) && - ((sb->sb_flags & SS_NBIO) || + ((so->so_state & SS_NBIO) || (flags & (MSG_DONTWAIT|MSG_NBIO)) || sb->sb_cc >= sb->sb_lowat || sb->sb_cc >= uio->uio_resid || From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 15:35:38 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 012CF201; Tue, 4 Jun 2013 15:35:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E65B81919; Tue, 4 Jun 2013 15:35:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54FZbtf047888; Tue, 4 Jun 2013 15:35:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54FZb7n047887; Tue, 4 Jun 2013 15:35:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306041535.r54FZb7n047887@svn.freebsd.org> From: John Baldwin Date: Tue, 4 Jun 2013 15:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251382 - head/sys/dev/filemon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 15:35:38 -0000 Author: jhb Date: Tue Jun 4 15:35:37 2013 New Revision: 251382 URL: http://svnweb.freebsd.org/changeset/base/251382 Log: Build fix: Only should be included before __FBSDID(). needs to be included after any "opt_foo.h" headers so it sees the same set of defined macros as other headers. Modified: head/sys/dev/filemon/filemon.c Modified: head/sys/dev/filemon/filemon.c ============================================================================== --- head/sys/dev/filemon/filemon.c Tue Jun 4 15:27:41 2013 (r251381) +++ head/sys/dev/filemon/filemon.c Tue Jun 4 15:35:37 2013 (r251382) @@ -25,11 +25,12 @@ * SUCH DAMAGE. */ -#include +#include __FBSDID("$FreeBSD$"); #include "opt_compat.h" +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 15:40:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8CE6B41B; Tue, 4 Jun 2013 15:40:45 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7F6AC1973; Tue, 4 Jun 2013 15:40:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54FejTP050318; Tue, 4 Jun 2013 15:40:45 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54FejFq050317; Tue, 4 Jun 2013 15:40:45 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201306041540.r54FejFq050317@svn.freebsd.org> From: Alan Cox Date: Tue, 4 Jun 2013 15:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251383 - head/sys/fs/tmpfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 15:40:45 -0000 Author: alc Date: Tue Jun 4 15:40:45 2013 New Revision: 251383 URL: http://svnweb.freebsd.org/changeset/base/251383 Log: Eliminate unnecessary vm object locking from tmpfs_nocacheread(). Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Jun 4 15:35:37 2013 (r251382) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Jun 4 15:40:45 2013 (r251383) @@ -490,7 +490,6 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p vm_page_unlock(m); VM_OBJECT_WUNLOCK(tobj); error = uiomove_fromphys(&m, offset, tlen, uio); - VM_OBJECT_WLOCK(tobj); vm_page_lock(m); vm_page_unhold(m); if (m->queue == PQ_NONE) { @@ -500,7 +499,6 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p vm_page_requeue(m); } vm_page_unlock(m); - VM_OBJECT_WUNLOCK(tobj); return (error); } From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 15:54:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BBDECD3E; Tue, 4 Jun 2013 15:54:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AEB511A2C; Tue, 4 Jun 2013 15:54:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54FsL5s055212; Tue, 4 Jun 2013 15:54:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54FsLN1055210; Tue, 4 Jun 2013 15:54:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306041554.r54FsLN1055210@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 Jun 2013 15:54:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r251384 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 15:54:21 -0000 Author: kib Date: Tue Jun 4 15:54:20 2013 New Revision: 251384 URL: http://svnweb.freebsd.org/changeset/base/251384 Log: Upgrade Glen commit bits with the src one. His area of interest is the release engineering work. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Tue Jun 4 15:40:45 2013 (r251383) +++ svnadmin/conf/access Tue Jun 4 15:54:20 2013 (r251384) @@ -99,6 +99,7 @@ gavin gber ghelmer gibbs +gjb gleb glebius gnn Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Tue Jun 4 15:40:45 2013 (r251383) +++ svnadmin/conf/mentors Tue Jun 4 15:54:20 2013 (r251384) @@ -21,6 +21,7 @@ cy andre Co-mentor: glebius davidcs gnn eri mlaier Co-mentor: thompsa erwin delphij +gjb kib hiren sbruno jceel wkoszek Co-mentor: cognet jinmei gnn From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 16:02:00 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F12C54DD; Tue, 4 Jun 2013 16:02:00 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E37011AF1; Tue, 4 Jun 2013 16:02:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54G20NZ058277; Tue, 4 Jun 2013 16:02:00 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54G20pe058276; Tue, 4 Jun 2013 16:02:00 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201306041602.r54G20pe058276@svn.freebsd.org> From: Glen Barber Date: Tue, 4 Jun 2013 16:02:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251385 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 16:02:01 -0000 Author: gjb Date: Tue Jun 4 16:02:00 2013 New Revision: 251385 URL: http://svnweb.freebsd.org/changeset/base/251385 Log: Add myself to committers-src.dot, and note kib is my mentor. Approved by: kib (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Tue Jun 4 15:54:20 2013 (r251384) +++ head/share/misc/committers-src.dot Tue Jun 4 16:02:00 2013 (r251385) @@ -158,6 +158,7 @@ gad [label="Garance A. Drosehn\ngad@Free gallatin [label="Andrew Gallatin\ngallatin@FreeBSD.org\n1999/01/15"] gavin [label="Gavin Atkinson\ngavin@FreeBSD.org\n2009/12/07"] gibbs [label="Justin T. Gibbs\ngibbs@FreeBSD.org\n????/??/??"] +gjb [label="Glen Barber\ngjb@FreeBSD.org\n2013/06/04"] gleb [label="Gleb Kurtsou\ngleb@FreeBSD.org\n2011/09/19"] glebius [label="Gleb Smirnoff\nglebius@FreeBSD.org\n2004/07/14"] gnn [label="George V. Neville-Neil\ngnn@FreeBSD.org\n2004/10/11"] @@ -508,6 +509,7 @@ ken -> asomers kib -> ae kib -> dchagin +kib -> gjb kib -> jlh kib -> jpaetzel kib -> lulf From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 16:16:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 82457BC; Tue, 4 Jun 2013 16:16:45 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 740821C2F; Tue, 4 Jun 2013 16:16:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54GGjp8062835; Tue, 4 Jun 2013 16:16:45 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54GGhaG062821; Tue, 4 Jun 2013 16:16:43 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306041616.r54GGhaG062821@svn.freebsd.org> From: Steven Hartland Date: Tue, 4 Jun 2013 16:16:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251386 - in stable/9/sys: cam cam/ata cam/scsi dev/ahci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 16:16:45 -0000 Author: smh Date: Tue Jun 4 16:16:43 2013 New Revision: 251386 URL: http://svnweb.freebsd.org/changeset/base/251386 Log: MFC r250792: Added output of device QUIRKS for CAM and AHCI devices during boot. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt_periph.h stable/9/sys/cam/scsi/scsi_cd.c stable/9/sys/cam/scsi/scsi_ch.c stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/cam/scsi/scsi_sa.c stable/9/sys/dev/ahci/ahci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Tue Jun 4 16:02:00 2013 (r251385) +++ stable/9/sys/cam/ata/ata_da.c Tue Jun 4 16:16:43 2013 (r251386) @@ -95,6 +95,10 @@ typedef enum { ADA_Q_4K = 0x01, } ada_quirks; +#define ADA_Q_BIT_STRING \ + "\020" \ + "\0014K" + typedef enum { ADA_CCB_RAHEAD = 0x01, ADA_CCB_WCACHE = 0x02, @@ -1267,6 +1271,7 @@ adaregister(struct cam_periph *periph, v dp->secsize, dp->heads, dp->secs_per_track, dp->cylinders); xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, ADA_Q_BIT_STRING); if (legacy_id >= 0) printf("%s%d: Previously was known as ad%d\n", periph->periph_name, periph->unit_number, legacy_id); Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Tue Jun 4 16:02:00 2013 (r251385) +++ stable/9/sys/cam/cam_xpt.c Tue Jun 4 16:16:43 2013 (r251386) @@ -1114,6 +1114,15 @@ xpt_announce_periph(struct cam_periph *p periph->unit_number, announce_string); } +void +xpt_announce_quirks(struct cam_periph *periph, int quirks, char *bit_string) +{ + if (quirks != 0) { + printf("%s%d: quirks=0x%b\n", periph->periph_name, + periph->unit_number, quirks, bit_string); + } +} + int xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path) { Modified: stable/9/sys/cam/cam_xpt_periph.h ============================================================================== --- stable/9/sys/cam/cam_xpt_periph.h Tue Jun 4 16:02:00 2013 (r251385) +++ stable/9/sys/cam/cam_xpt_periph.h Tue Jun 4 16:16:43 2013 (r251386) @@ -46,6 +46,8 @@ void xpt_remove_periph(struct cam_perip int topology_lock_held); void xpt_announce_periph(struct cam_periph *periph, char *announce_string); +void xpt_announce_quirks(struct cam_periph *periph, + int quirks, char *bit_string); #endif #endif /* _CAM_CAM_XPT_PERIPH_H */ Modified: stable/9/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_cd.c Tue Jun 4 16:02:00 2013 (r251385) +++ stable/9/sys/cam/scsi/scsi_cd.c Tue Jun 4 16:16:43 2013 (r251386) @@ -92,6 +92,14 @@ typedef enum { CD_Q_10_BYTE_ONLY = 0x10 } cd_quirks; +#define CD_Q_BIT_STRING \ + "\020" \ + "\001NO_TOUCH" \ + "\002BCD_TRACKS" \ + "\003NO_CHANGER" \ + "\004CHANGER" \ + "\00510_BYTE_ONLY" + typedef enum { CD_FLAG_INVALID = 0x0001, CD_FLAG_NEW_DISC = 0x0002, @@ -1866,6 +1874,8 @@ cddone(struct cam_periph *periph, union free(rdcap, M_SCSICD); if (announce_buf[0] != '\0') { xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, + CD_Q_BIT_STRING); if (softc->flags & CD_FLAG_CHANGER) cdchangerschedule(softc); /* Modified: stable/9/sys/cam/scsi/scsi_ch.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_ch.c Tue Jun 4 16:02:00 2013 (r251385) +++ stable/9/sys/cam/scsi/scsi_ch.c Tue Jun 4 16:16:43 2013 (r251386) @@ -125,6 +125,10 @@ typedef enum { CH_Q_NO_DBD = 0x01 } ch_quirks; +#define CH_Q_BIT_STRING \ + "\020" \ + "\001NO_DBD" + #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 @@ -703,8 +707,11 @@ chdone(struct cam_periph *periph, union announce_buf[0] = '\0'; } } - if (announce_buf[0] != '\0') + if (announce_buf[0] != '\0') { xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, + CH_Q_BIT_STRING); + } softc->state = CH_STATE_NORMAL; free(mode_header, M_SCSICH); /* Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Tue Jun 4 16:02:00 2013 (r251385) +++ stable/9/sys/cam/scsi/scsi_da.c Tue Jun 4 16:16:43 2013 (r251386) @@ -100,6 +100,13 @@ typedef enum { DA_Q_4K = 0x08 } da_quirks; +#define DA_Q_BIT_STRING \ + "\020" \ + "\001NO_SYNC_CACHE" \ + "\002NO_6_BYTE" \ + "\003NO_PREVENT" \ + "\0044K" + typedef enum { DA_CCB_PROBE_RC = 0x01, DA_CCB_PROBE_RC16 = 0x02, @@ -2903,7 +2910,8 @@ dadone(struct cam_periph *periph, union taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task); xpt_announce_periph(periph, announce_buf); - + xpt_announce_quirks(periph, softc->quirks, + DA_Q_BIT_STRING); } else { xpt_print(periph->path, "fatal error, " "could not acquire reference count\n"); Modified: stable/9/sys/cam/scsi/scsi_sa.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_sa.c Tue Jun 4 16:02:00 2013 (r251385) +++ stable/9/sys/cam/scsi/scsi_sa.c Tue Jun 4 16:16:43 2013 (r251386) @@ -173,6 +173,17 @@ typedef enum { SA_QUIRK_NO_CPAGE = 0x80 /* Don't use DEVICE COMPRESSION page */ } sa_quirks; +#define SA_QUIRK_BIT_STRING \ + "\020" \ + "\001NOCOMP" \ + "\002FIXED" \ + "\003VARIABLE" \ + "\0042FM" \ + "\0051FM" \ + "\006NODREAD" \ + "\007NO_MODESEL" \ + "\010NO_CPAGE" + #define SAMODE(z) (dev2unit(z) & 0x3) #define SADENSITY(z) ((dev2unit(z) >> 2) & 0x3) #define SA_IS_CTRL(z) (dev2unit(z) & (1 << 4)) @@ -1546,6 +1557,7 @@ saregister(struct cam_periph *periph, vo xpt_register_async(AC_LOST_DEVICE, saasync, periph, periph->path); xpt_announce_periph(periph, NULL); + xpt_announce_quirks(periph, softc->quirks, SA_QUIRK_BIT_STRING); return (CAM_REQ_CMP); } Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Tue Jun 4 16:02:00 2013 (r251385) +++ stable/9/sys/dev/ahci/ahci.c Tue Jun 4 16:16:43 2013 (r251386) @@ -121,6 +121,22 @@ static struct { #define AHCI_Q_NOCOUNT 1024 #define AHCI_Q_ALTSIG 2048 #define AHCI_Q_NOMSI 4096 + +#define AHCI_Q_BIT_STRING \ + "\020" \ + "\001NOFORCE" \ + "\002NOPMP" \ + "\003NONCQ" \ + "\0041CH" \ + "\0052CH" \ + "\0064CH" \ + "\007EDGEIS" \ + "\010SATA2" \ + "\011NOBSYRES" \ + "\012NOAA" \ + "\013NOCOUNT" \ + "\014ALTSIG" \ + "\015NOMSI" } ahci_ids[] = { {0x43801002, 0x00, "ATI IXP600", AHCI_Q_NOMSI}, {0x43901002, 0x00, "ATI IXP700", 0}, @@ -496,6 +512,10 @@ ahci_attach(device_t dev) "supported" : "not supported", (ctlr->caps & AHCI_CAP_FBSS) ? " with FBS" : ""); + if (ctlr->quirks != 0) { + device_printf(dev, "quirks=0x%b\n", ctlr->quirks, + AHCI_Q_BIT_STRING); + } if (bootverbose) { device_printf(dev, "Caps:%s%s%s%s%s%s%s%s %sGbps", (ctlr->caps & AHCI_CAP_64BIT) ? " 64bit":"", From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 16:24:39 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3EE166B9; Tue, 4 Jun 2013 16:24:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1626C1C7C; Tue, 4 Jun 2013 16:24:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54GOc3u065771; Tue, 4 Jun 2013 16:24:38 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54GOcfA065770; Tue, 4 Jun 2013 16:24:38 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201306041624.r54GOcfA065770@svn.freebsd.org> From: Glen Barber Date: Tue, 4 Jun 2013 16:24:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r251387 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 16:24:39 -0000 Author: gjb Date: Tue Jun 4 16:24:38 2013 New Revision: 251387 URL: http://svnweb.freebsd.org/changeset/base/251387 Log: Remove myself from access.doc to avoid receiving duplicate email. Approved by: core (implicit), doceng (implicit) Modified: svnadmin/conf/access.doc Modified: svnadmin/conf/access.doc ============================================================================== --- svnadmin/conf/access.doc Tue Jun 4 16:16:43 2013 (r251386) +++ svnadmin/conf/access.doc Tue Jun 4 16:24:38 2013 (r251387) @@ -18,5 +18,4 @@ # type of commits. # blackend -gjb joel From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 16:32:18 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7A3ED920; Tue, 4 Jun 2013 16:32:18 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6C36D1CD5; Tue, 4 Jun 2013 16:32:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54GWIeY068586; Tue, 4 Jun 2013 16:32:18 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54GWI0k068584; Tue, 4 Jun 2013 16:32:18 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306041632.r54GWI0k068584@svn.freebsd.org> From: Steven Hartland Date: Tue, 4 Jun 2013 16:32:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251388 - in stable/9/sys/cam: ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 16:32:18 -0000 Author: smh Date: Tue Jun 4 16:32:17 2013 New Revision: 251388 URL: http://svnweb.freebsd.org/changeset/base/251388 Log: MFC r251061: More 4k quirks for SSD's Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Tue Jun 4 16:24:38 2013 (r251387) +++ stable/9/sys/cam/ata/ata_da.c Tue Jun 4 16:32:17 2013 (r251388) @@ -274,12 +274,11 @@ static struct ada_quirk_entry ada_quirk_ { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD?????PVT*", "*" }, /*quirks*/ADA_Q_4K }, + /* SSDs */ { /* * Corsair Force 2 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair CSSD-F*", "*" }, /*quirks*/ADA_Q_4K @@ -288,100 +287,136 @@ static struct ada_quirk_entry ada_quirk_ /* * Corsair Force 3 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair Force 3*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * OCZ Agility 3 SSDs + * Corsair Force GT SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-AGILITY3*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair Force GT*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * OCZ Vertex 2 SSDs (inc pro series) + * Crucial M4 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ?VERTEX2*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "M4-CT???M4SSD2*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * OCZ Vertex 3 SSDs + * Crucial RealSSD C300 SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "C300-CTFDDAC???MAG*", + "*" }, /*quirks*/ADA_Q_4K + }, + { + /* + * Intel 320 Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-VERTEX3*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSA2CW*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * SuperTalent TeraDrive CT SSDs + * Intel 330 Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "FTM??CT25H*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSC2CT*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * Crucial RealSSD C300 SSDs - * 4k optimised - * Submitted by: Steven Hartland - * PR: 169974 + * Intel 510 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "C300-CTFDDAC???MAG*", - "*" }, /*quirks*/ADA_Q_4K + { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSC2MH*", "*" }, + /*quirks*/ADA_Q_4K }, { /* - * XceedIOPS SATA SSDs - * 4k optimised - * Submitted by: Steven Hartland - * PR: 169974 + * Intel 520 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "SG9XCS2D*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSC2BW*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * Intel 330 Series SSDs + * Kingston E100 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "KINGSTON SE100S3*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * Kingston HyperX 3k SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "KINGSTON SH103S3*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * OCZ Agility 3 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSC2ct*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-AGILITY3*", "*" }, /*quirks*/ADA_Q_4K }, { /* * OCZ Deneva R Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "DENRSTE251M45*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * Kingston HyperX 3k SSDs + * OCZ Vertex 2 SSDs (inc pro series) * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "KINGSTON SH103S3*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ?VERTEX2*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * OCZ Vertex 3 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-VERTEX3*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * Samsung 830 Series SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG SSD 830 Series*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * SuperTalent TeraDrive CT SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "FTM??CT25H*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * XceedIOPS SATA SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SG9XCS2D*", "*" }, /*quirks*/ADA_Q_4K }, { Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Tue Jun 4 16:24:38 2013 (r251387) +++ stable/9/sys/cam/scsi/scsi_da.c Tue Jun 4 16:32:17 2013 (r251388) @@ -908,6 +908,151 @@ static struct da_quirk_entry da_quirk_ta {T_DIRECT, SIP_MEDIA_FIXED, "SAMSUNG", "HM250JI", "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE }, + /* SATA SSDs */ + { + /* + * Corsair Force 2 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Corsair CSSD-F*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Corsair Force 3 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Corsair Force 3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Corsair Force GT SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Corsair Force GT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Crucial M4 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "M4-CT???M4SSD2*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Crucial RealSSD C300 SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "C300-CTFDDAC???MAG*", + "*" }, /*quirks*/DA_Q_4K + }, + { + /* + * Intel 320 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "INTEL SSDSA2CW*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Intel 330 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "INTEL SSDSC2CT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Intel 510 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "INTEL SSDSC2MH*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Intel 520 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "INTEL SSDSC2BW*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Kingston E100 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "KINGSTON SE100S3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Kingston HyperX 3k SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "KINGSTON SH103S3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * OCZ Agility 3 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "OCZ-AGILITY3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * OCZ Deneva R Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "DENRSTE251M45*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * OCZ Vertex 2 SSDs (inc pro series) + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "OCZ?VERTEX2*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * OCZ Vertex 3 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "OCZ-VERTEX3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Samsung 830 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG SSD 830 Series*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * SuperTalent TeraDrive CT SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "FTM??CT25H*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * XceedIOPS SATA SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SG9XCS2D*", "*" }, + /*quirks*/DA_Q_4K + }, }; static disk_strategy_t dastrategy; From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 16:48:24 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CE50FE8F; Tue, 4 Jun 2013 16:48:24 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B1F951DBF; Tue, 4 Jun 2013 16:48:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54GmO0g072759; Tue, 4 Jun 2013 16:48:24 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54GmN5Q072751; Tue, 4 Jun 2013 16:48:23 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306041648.r54GmN5Q072751@svn.freebsd.org> From: Devin Teske Date: Tue, 4 Jun 2013 16:48:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251389 - in head/usr.sbin/bsdconfig: console/include mouse/include security/include startup startup/include startup/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 16:48:24 -0000 Author: dteske Date: Tue Jun 4 16:48:23 2013 New Revision: 251389 URL: http://svnweb.freebsd.org/changeset/base/251389 Log: Lessen verbosity of "Exit" menutag items to appear more consistent across menus from one module to the next. Replacing "Exit this menu (returning to previous)" with "Exit this menu". PR: ports/169316 Modified: head/usr.sbin/bsdconfig/console/include/messages.subr head/usr.sbin/bsdconfig/mouse/include/messages.subr head/usr.sbin/bsdconfig/security/include/messages.subr head/usr.sbin/bsdconfig/startup/include/messages.subr head/usr.sbin/bsdconfig/startup/rcconf head/usr.sbin/bsdconfig/startup/share/rcconf.subr Modified: head/usr.sbin/bsdconfig/console/include/messages.subr ============================================================================== --- head/usr.sbin/bsdconfig/console/include/messages.subr Tue Jun 4 16:32:17 2013 (r251388) +++ head/usr.sbin/bsdconfig/console/include/messages.subr Tue Jun 4 16:48:23 2013 (r251389) @@ -78,7 +78,7 @@ msg_estonian_iso_desc="Estonian ISO keym msg_estonian_iso_15="Estonian ISO 15" msg_estonian_iso_15_desc="Estonian ISO 8859-15 keymap" msg_exit="Exit" -msg_exit_this_menu="Exit this menu (returning to previous)" +msg_exit_this_menu="Exit this menu" msg_fade="Fade" msg_fade_desc="Fade out effect screen saver" msg_fast="Fast" Modified: head/usr.sbin/bsdconfig/mouse/include/messages.subr ============================================================================== --- head/usr.sbin/bsdconfig/mouse/include/messages.subr Tue Jun 4 16:32:17 2013 (r251388) +++ head/usr.sbin/bsdconfig/mouse/include/messages.subr Tue Jun 4 16:48:23 2013 (r251389) @@ -42,7 +42,7 @@ msg_disable="Disable" msg_disable_the_mouse_daemon="Disable the mouse daemon" msg_enable="Enable" msg_exit="Exit" -msg_exit_this_menu="Exit this menu (returning to previous)" +msg_exit_this_menu="Exit this menu" msg_flags="Flags" msg_glidepoint="GlidePoint" msg_glidepoint_desc="ALPS GlidePoint pad (serial)" Modified: head/usr.sbin/bsdconfig/security/include/messages.subr ============================================================================== --- head/usr.sbin/bsdconfig/security/include/messages.subr Tue Jun 4 16:32:17 2013 (r251388) +++ head/usr.sbin/bsdconfig/security/include/messages.subr Tue Jun 4 16:48:23 2013 (r251389) @@ -30,7 +30,7 @@ msg_cancel="Cancel" msg_disable_securelevels="Disable securelevels" msg_disabled="Disabled" msg_exit="Exit" -msg_exit_this_menu="Exit this menu (returning to previous)" +msg_exit_this_menu="Exit this menu" msg_highly_secure="Highly Secure" msg_highly_secure_mode="Highly secure mode" msg_menu_text="This menu allows you to configure aspects of the operating system security\npolicy. Please read the system documentation carefully before modifying\nthese settings, as they may cause service disruption if used improperly.\n\nMost settings will take affect only following a system reboot." Modified: head/usr.sbin/bsdconfig/startup/include/messages.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/include/messages.subr Tue Jun 4 16:32:17 2013 (r251388) +++ head/usr.sbin/bsdconfig/startup/include/messages.subr Tue Jun 4 16:48:23 2013 (r251389) @@ -63,8 +63,7 @@ msg_exit_cancel="Exit/Cancel" msg_exit_cancel_desc="Return to previous menu" msg_exit_cancel_help="Return to the previous menu (selected items are untouched)" msg_exit_desc="Return to previous menu" -msg_exit_help="Exit this menu (returning to previous)" -msg_exit_this_menu="Exit this menu (returning to previous)" +msg_exit_this_menu="Exit this menu" msg_info="Info" msg_lpd="lpd" msg_lpd_desc="This host has a printer and wants to run lpd." Modified: head/usr.sbin/bsdconfig/startup/rcconf ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcconf Tue Jun 4 16:32:17 2013 (r251388) +++ head/usr.sbin/bsdconfig/startup/rcconf Tue Jun 4 16:48:23 2013 (r251389) @@ -81,7 +81,7 @@ dialog_menu_main() local prompt= local menu_list=" 'X $msg_exit' '$msg_exit_desc' - ${SHOW_DESC:+'$msg_exit_help'} + ${SHOW_DESC:+'$msg_exit_this_menu'} '> $msg_add_new' '$msg_add_new_desc' ${SHOW_DESC:+'$msg_add_new_help'} '> $msg_delete' '$msg_delete_desc' Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Tue Jun 4 16:32:17 2013 (r251388) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Tue Jun 4 16:48:23 2013 (r251389) @@ -372,7 +372,7 @@ f_dialog_input_rclist() { local prompt="$msg_please_select_an_rcconf_directive" local menu_list=" - 'X $msg_exit' '' ${SHOW_DESC:+'$msg_exit_help'} + 'X $msg_exit' '' ${SHOW_DESC:+'$msg_exit_this_menu'} " # END-QUOTE local hline="$hline_arrows_tab_enter" From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 17:08:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 808ADDE; Tue, 4 Jun 2013 17:08:27 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 631C81F27; Tue, 4 Jun 2013 17:08:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54H8RFC080273; Tue, 4 Jun 2013 17:08:27 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54H8RBP080272; Tue, 4 Jun 2013 17:08:27 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306041708.r54H8RBP080272@svn.freebsd.org> From: Devin Teske Date: Tue, 4 Jun 2013 17:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251390 - head/usr.sbin/bsdconfig/console X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 17:08:27 -0000 Author: dteske Date: Tue Jun 4 17:08:26 2013 New Revision: 251390 URL: http://svnweb.freebsd.org/changeset/base/251390 Log: Shift Console->Saver menu items to place the default item at the top, making this menu consistent with Console->Repeat, Console->Font, Console->Screenmap and many others which place the default choice at the top. NOTE: SVN r249751 changed things so that these menus highlight the active selection, so the idea that the default choice (now at top) "can be selected immediately by hitting ENTER" is not possible unless the default choice is the currently active setting (e.g., on first visit to the menu). However, it is still warranted to have the default choice at the top of the menu. PR: bin/169316 Modified: head/usr.sbin/bsdconfig/console/saver Modified: head/usr.sbin/bsdconfig/console/saver ============================================================================== --- head/usr.sbin/bsdconfig/console/saver Tue Jun 4 16:48:23 2013 (r251389) +++ head/usr.sbin/bsdconfig/console/saver Tue Jun 4 17:08:26 2013 (r251390) @@ -51,19 +51,19 @@ dialog_menu_main() { local prompt="$msg_saver_menu_text" local menu_list=" - '1 $msg_blank' '$msg_blank_desc' - '2 $msg_beastie' '$msg_beastie_desc' - '3 $msg_daemon' '$msg_daemon_desc' - '4 $msg_dragon' '$msg_dragon_desc' - '5 $msg_fade' '$msg_fade_desc' - '6 $msg_fire' '$msg_fire_desc' - '7 $msg_green' '$msg_green_desc' - '8 $msg_logo' '$msg_logo_desc' - '9 $msg_rain' '$msg_rain_desc' - 'a $msg_snake' '$msg_snake_desc' - 'b $msg_star' '$msg_star_desc' - 'c $msg_warp' '$msg_warp_desc' - 'd $msg_none' '$msg_none_saver_desc' + '1 $msg_none' '$msg_none_saver_desc' + '2 $msg_blank' '$msg_blank_desc' + '3 $msg_beastie' '$msg_beastie_desc' + '4 $msg_daemon' '$msg_daemon_desc' + '5 $msg_dragon' '$msg_dragon_desc' + '6 $msg_fade' '$msg_fade_desc' + '7 $msg_fire' '$msg_fire_desc' + '8 $msg_green' '$msg_green_desc' + '9 $msg_logo' '$msg_logo_desc' + 'a $msg_rain' '$msg_rain_desc' + 'b $msg_snake' '$msg_snake_desc' + 'c $msg_star' '$msg_star_desc' + 'd $msg_warp' '$msg_warp_desc' '$msg_timeout' '$msg_timeout_desc' " # END-QUOTE local defaultitem= # Calculated below @@ -78,19 +78,19 @@ dialog_menu_main() $menu_list case "$( f_sysrc_get saver )" in - blank) defaultitem="1 $msg_blank" ;; - beastie) defaultitem="2 $msg_beastie";; - daemon) defaultitem="3 $msg_daemon" ;; - dragon) defaultitem="4 $msg_dragon" ;; - fade) defaultitem="5 $msg_fade" ;; - fire) defaultitem="6 $msg_fire" ;; - green) defaultitem="7 $msg_green" ;; - logo) defaultitem="8 $msg_logo" ;; - rain) defaultitem="9 $msg_rain" ;; - snake) defaultitem="a $msg_snake" ;; - star) defaultitem="b $msg_star" ;; - warp) defaultitem="c $msg_warp" ;; - [Nn][Oo]|'') defaultitem="d $msg_none" ;; + [Nn][Oo]|'') defaultitem="1 $msg_none" ;; + blank) defaultitem="2 $msg_blank" ;; + beastie) defaultitem="3 $msg_beastie";; + daemon) defaultitem="4 $msg_daemon" ;; + dragon) defaultitem="5 $msg_dragon" ;; + fade) defaultitem="6 $msg_fade" ;; + fire) defaultitem="7 $msg_fire" ;; + green) defaultitem="8 $msg_green" ;; + logo) defaultitem="9 $msg_logo" ;; + rain) defaultitem="a $msg_rain" ;; + snake) defaultitem="b $msg_snake" ;; + star) defaultitem="c $msg_star" ;; + warp) defaultitem="d $msg_warp" ;; esac local menu_choice @@ -141,45 +141,45 @@ while :; do f_dialog_menutag_fetch mtag case "$mtag" in - "1 $msg_blank") # Simply blank the screen + "1 $msg_none") # Disable the screensaver + f_sysrc_set saver "NO" || f_die + break ;; + "2 $msg_blank") # Simply blank the screen f_sysrc_set saver "blank" || f_die break ;; - "2 $msg_beastie") # "BSD Daemon" animated screen saver (graphics) + "3 $msg_beastie") # "BSD Daemon" animated screen saver (graphics) f_sysrc_set saver "beastie" || f_die break ;; - "3 $msg_daemon") # "BSD Daemon" animated screen saver (text) + "4 $msg_daemon") # "BSD Daemon" animated screen saver (text) f_sysrc_set saver "daemon" || f_die break ;; - "4 $msg_dragon") # Dragon screensaver (graphics) + "5 $msg_dragon") # Dragon screensaver (graphics) f_sysrc_set saver "dragon" || f_die break ;; - "5 $msg_fade") # Fade out effect screen saver + "6 $msg_fade") # Fade out effect screen saver f_sysrc_set saver "fade" || f_die break ;; - "6 $msg_fire") # Flames effect screen saver + "7 $msg_fire") # Flames effect screen saver f_sysrc_set saver "fire" || f_die break ;; - "7 $msg_green") # "Green" power saving mode (if supported by monitor) + "8 $msg_green") # "Green" power saving mode (if supported by monitor) f_sysrc_set saver "green" || f_die break ;; - "8 $msg_logo") # FreeBSD "logo" animated screen saver (graphics) + "9 $msg_logo") # FreeBSD "logo" animated screen saver (graphics) f_sysrc_set saver "logo" || f_die break ;; - "9 $msg_rain") # Rain drops screen saver + "a $msg_rain") # Rain drops screen saver f_sysrc_set saver "rain" || f_die break ;; - "a $msg_snake") # Draw a FreeBSD "snake" on your screen + "b $msg_snake") # Draw a FreeBSD "snake" on your screen f_sysrc_set saver "snake" || f_die break ;; - "b $msg_star") # A "twinkling stars" effect + "c $msg_star") # A "twinkling stars" effect f_sysrc_set saver "star" || f_die break ;; - "c $msg_warp") # A "stars warping" effect + "d $msg_warp") # A "stars warping" effect f_sysrc_set saver "warp" || f_die break ;; - "d $msg_none") # Disable the screensaver - f_sysrc_set saver "NO" || f_die - break ;; "$msg_timeout") # Set the screen saver timeout interval f_dialog_title "$msg_value_required" f_dialog_input blanktime "$msg_enter_timeout_period" \ From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 17:23:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 858215F7; Tue, 4 Jun 2013 17:23:09 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 776971037; Tue, 4 Jun 2013 17:23:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54HN9Vl086179; Tue, 4 Jun 2013 17:23:09 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54HN9lg086178; Tue, 4 Jun 2013 17:23:09 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201306041723.r54HN9lg086178@svn.freebsd.org> From: Alan Cox Date: Tue, 4 Jun 2013 17:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251391 - head/sys/security/mac X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 17:23:09 -0000 Author: alc Date: Tue Jun 4 17:23:09 2013 New Revision: 251391 URL: http://svnweb.freebsd.org/changeset/base/251391 Log: Relax the vm object locking in mac_proc_vm_revoke_recurse(). A read lock suffices in one place. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/security/mac/mac_process.c Modified: head/sys/security/mac/mac_process.c ============================================================================== --- head/sys/security/mac/mac_process.c Tue Jun 4 17:08:26 2013 (r251390) +++ head/sys/security/mac/mac_process.c Tue Jun 4 17:23:09 2013 (r251391) @@ -284,14 +284,14 @@ mac_proc_vm_revoke_recurse(struct thread object = vme->object.vm_object; if (object == NULL) continue; - VM_OBJECT_WLOCK(object); + VM_OBJECT_RLOCK(object); while ((backing_object = object->backing_object) != NULL) { - VM_OBJECT_WLOCK(backing_object); + VM_OBJECT_RLOCK(backing_object); offset += object->backing_object_offset; - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RUNLOCK(object); object = backing_object; } - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RUNLOCK(object); /* * At the moment, vm_maps and objects aren't considered by * the MAC system, so only things with backing by a normal From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 19:47:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2D02168E; Tue, 4 Jun 2013 19:47:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0F27A1909; Tue, 4 Jun 2013 19:47:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54JlQ0t042906; Tue, 4 Jun 2013 19:47:26 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54JlQhU042904; Tue, 4 Jun 2013 19:47:26 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201306041947.r54JlQhU042904@svn.freebsd.org> From: Andrew Turner Date: Tue, 4 Jun 2013 19:47:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251392 - head/lib/libc/arm/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 19:47:27 -0000 Author: andrew Date: Tue Jun 4 19:47:26 2013 New Revision: 251392 URL: http://svnweb.freebsd.org/changeset/base/251392 Log: Start to merge the updated ARM NetBSD setjump/longjmp functions. To begin with merge the functions but leave out the code to save/load the VFP registers as that requires other changes to ensure the VFP is enabled first. This removes storing the old fpa registers. These were never fully supported, and the only user of this code I can find have moved to newer CPUs which use a VFP. Modified: head/lib/libc/arm/gen/_setjmp.S head/lib/libc/arm/gen/setjmp.S Modified: head/lib/libc/arm/gen/_setjmp.S ============================================================================== --- head/lib/libc/arm/gen/_setjmp.S Tue Jun 4 17:23:09 2013 (r251391) +++ head/lib/libc/arm/gen/_setjmp.S Tue Jun 4 19:47:26 2013 (r251392) @@ -1,4 +1,4 @@ -/* $NetBSD: _setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */ +/* $NetBSD: _setjmp.S,v 1.12 2013/04/19 13:45:45 matt Exp $ */ /* * Copyright (c) 1997 Mark Brinicombe @@ -32,7 +32,17 @@ * SUCH DAMAGE. */ +#if !defined(__SOFTFP__) && !defined(__VFP_FP__) && !defined(__ARM_PCS) +#error FPA is not supported anymore +#endif + +#ifdef __ARM_EABI__ + .fpu vfp +#endif + #include +#include + __FBSDID("$FreeBSD$"); /* @@ -45,21 +55,15 @@ __FBSDID("$FreeBSD$"); * The previous signal state is NOT restored. * * Note: r0 is the return value - * r1-r3 are scratch registers in functions + * r1-r3,ip are scratch registers in functions */ ENTRY(_setjmp) ldr r1, .L_setjmp_magic - str r1, [r0], #4 -#ifdef __SOFTFP__ - add r0, r0, #52 -#else - /* Store fp registers */ - sfm f4, 4, [r0], #48 - /* Store fpsr */ - rfs r1 - str r1, [r0], #0x0004 -#endif /* __SOFTFP__ */ + + str r1, [r0] + + add r0, r0, #(_JB_REG_R4 * 4) /* Store integer registers */ stmia r0, {r4-r14} @@ -71,20 +75,12 @@ ENTRY(_setjmp) WEAK_ALIAS(___longjmp, _longjmp) ENTRY(_longjmp) - ldr r2, .L_setjmp_magic - ldr r3, [r0], #4 - teq r2, r3 - bne botch + ldr r2, [r0] /* get magic from jmp_buf */ + ldr ip, .L_setjmp_magic /* load magic */ + teq ip, r2 /* magic correct? */ + bne botch /* no, botch */ -#ifdef __SOFTFP__ - add r0, r0, #52 -#else - /* Restore fp registers */ - lfm f4, 4, [r0], #48 - /* Restore fpsr */ - ldr r4, [r0], #0x0004 - wfs r4 -#endif /* __SOFTFP__ */ + add r0, r0, #(_JB_REG_R4 * 4) /* Restore integer registers */ ldmia r0, {r4-r14} @@ -94,8 +90,7 @@ ENTRY(_longjmp) beq botch /* Set return value */ - mov r0, r1 - teq r0, #0x00000000 + movs r0, r1 moveq r0, #0x00000001 RET Modified: head/lib/libc/arm/gen/setjmp.S ============================================================================== --- head/lib/libc/arm/gen/setjmp.S Tue Jun 4 17:23:09 2013 (r251391) +++ head/lib/libc/arm/gen/setjmp.S Tue Jun 4 19:47:26 2013 (r251392) @@ -1,4 +1,4 @@ -/* $NetBSD: setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */ +/* $NetBSD: setjmp.S,v 1.14 2013/04/19 13:45:45 matt Exp $ */ /* * Copyright (c) 1997 Mark Brinicombe @@ -32,8 +32,15 @@ * SUCH DAMAGE. */ +#if !defined(__SOFTFP__) && !defined(__VFP_FP__) && !defined(__ARM_PCS) +#error FPA is not supported anymore +#endif + #include +#include + __FBSDID("$FreeBSD$"); + /* * C library -- setjmp, longjmp * @@ -47,27 +54,17 @@ __FBSDID("$FreeBSD$"); ENTRY(setjmp) /* Block all signals and retrieve the old signal mask */ stmfd sp!, {r0, r14} - add r2, r0, #(25 * 4) /* oset */ - mov r0, #0x00000001 /* SIG_BLOCK */ - mov r1, #0 /* set */ - + add r2, r0, #(_JB_SIGMASK * 4) /* oset */ + mov r1, #0x00000000 /* set */ + mov r0, #0x00000001 /* SIG_BLOCK */ bl PIC_SYM(_C_LABEL(sigprocmask), PLT) - ldmfd sp!, {r0, r14} ldr r1, .Lsetjmp_magic - str r1, [r0], #4 + str r1, [r0] /* store magic */ -#ifdef __SOFTFP__ - add r0, r0, #52 -#else - /* Store fp registers */ - sfm f4, 4, [r0], #48 - /* Store fpsr */ - rfs r1 - str r1, [r0], #0x0004 -#endif /* __SOFTFP__ */ /* Store integer registers */ + add r0, r0, #(_JB_REG_R4 * 4) stmia r0, {r4-r14} mov r0, #0x00000000 RET @@ -79,51 +76,36 @@ ENTRY(setjmp) .weak _C_LABEL(longjmp) .set _C_LABEL(longjmp), _C_LABEL(__longjmp) ENTRY(__longjmp) - ldr r2, .Lsetjmp_magic - ldr r3, [r0] - teq r2, r3 - bne botch - - - /* Set signal mask */ - stmfd sp!, {r0, r1, r14} - sub sp, sp, #4 /* align the stack */ - - add r1, r0, #(25 * 4) /* Signal mask */ - mov r0, #3 /* SIG_SETMASK */ - mov r2, #0 + ldr r2, [r0] + ldr ip, .Lsetjmp_magic + bic r3, r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP) + teq r3, ip + bne .Lbotch + + /* Restore the signal mask. */ + stmfd sp!, {r0-r2, r14} + mov r2, #0x00000000 + add r1, r0, #(_JB_SIGMASK * 4) /* Signal mask */ + mov r0, #3 /* SIG_SETMASK */ bl PIC_SYM(_C_LABEL(sigprocmask), PLT) + ldmfd sp!, {r0-r2, r14} - add sp, sp, #4 /* unalign the stack */ - ldmfd sp!, {r0, r1, r14} - - add r0, r0, #4 -#ifdef __SOFTFP__ - add r0, r0, #52 -#else - /* Restore fp registers */ - lfm f4, 4, [r0], #48 - /* Restore FPSR */ - ldr r4, [r0], #0x0004 - wfs r4 -#endif /* __SOFTFP__ */ + add r0, r0, #(_JB_REG_R4 * 4) /* Restore integer registers */ ldmia r0, {r4-r14} /* Validate sp and r14 */ teq sp, #0 teqne r14, #0 - beq botch + beq .Lbotch /* Set return value */ - - mov r0, r1 - teq r0, #0x00000000 + movs r0, r1 moveq r0, #0x00000001 RET /* validation failed, die die die. */ -botch: +.Lbotch: bl PIC_SYM(_C_LABEL(longjmperror), PLT) bl PIC_SYM(_C_LABEL(abort), PLT) b . - 8 /* Cannot get here */ From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 20:40:17 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0B96F6E2; Tue, 4 Jun 2013 20:40:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F286E1B11; Tue, 4 Jun 2013 20:40:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54KeGfW062234; Tue, 4 Jun 2013 20:40:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54KeGpn062233; Tue, 4 Jun 2013 20:40:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306042040.r54KeGpn062233@svn.freebsd.org> From: John Baldwin Date: Tue, 4 Jun 2013 20:40:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251393 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 20:40:17 -0000 Author: jhb Date: Tue Jun 4 20:40:16 2013 New Revision: 251393 URL: http://svnweb.freebsd.org/changeset/base/251393 Log: Fix build with both INET and INET6 disabled. Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Jun 4 19:47:26 2013 (r251392) +++ head/sys/net/if.c Tue Jun 4 20:40:16 2013 (r251393) @@ -654,12 +654,14 @@ if_attach_internal(struct ifnet *ifp, in /* Reliably crash if used uninitialized. */ ifp->if_broadcastaddr = NULL; +#if defined(INET) || defined(INET6) /* Initialize to max value. */ if (ifp->if_hw_tsomax == 0) ifp->if_hw_tsomax = IP_MAXPACKET; KASSERT(ifp->if_hw_tsomax <= IP_MAXPACKET && ifp->if_hw_tsomax >= IP_MAXPACKET / 8, ("%s: tsomax outside of range", __func__)); +#endif } #ifdef VIMAGE else { From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 20:49:18 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 02DFC980; Tue, 4 Jun 2013 20:49:18 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E82B01B71; Tue, 4 Jun 2013 20:49:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54KnHlm065785; Tue, 4 Jun 2013 20:49:17 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54KnHsU065784; Tue, 4 Jun 2013 20:49:17 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306042049.r54KnHsU065784@svn.freebsd.org> From: Marius Strobl Date: Tue, 4 Jun 2013 20:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251394 - head/sys/dev/sym X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 20:49:18 -0000 Author: marius Date: Tue Jun 4 20:49:17 2013 New Revision: 251394 URL: http://svnweb.freebsd.org/changeset/base/251394 Log: CAM_DEV_QFREEZE handling should only be done on request submission but neither on completion nor by SIM drivers in the first place. This issue has been revealed by r249466. Reviewed by: mav MFC after: 3 days Modified: head/sys/dev/sym/sym_hipd.c Modified: head/sys/dev/sym/sym_hipd.c ============================================================================== --- head/sys/dev/sym/sym_hipd.c Tue Jun 4 20:40:16 2013 (r251393) +++ head/sys/dev/sym/sym_hipd.c Tue Jun 4 20:49:17 2013 (r251394) @@ -2352,17 +2352,6 @@ static void sym_enqueue_cam_ccb(ccb_p cp /* * Complete a pending CAM CCB. */ -static void _sym_xpt_done(hcb_p np, union ccb *ccb) -{ - SYM_LOCK_ASSERT(MA_OWNED); - - KASSERT((ccb->ccb_h.status & CAM_SIM_QUEUED) == 0, - ("%s: status=CAM_SIM_QUEUED", __func__)); - - if (ccb->ccb_h.flags & CAM_DEV_QFREEZE) - sym_freeze_cam_ccb(ccb); - xpt_done(ccb); -} static void sym_xpt_done(hcb_p np, union ccb *ccb, ccb_p cp) { @@ -2374,7 +2363,7 @@ static void sym_xpt_done(hcb_p np, union ccb->ccb_h.status &= ~CAM_SIM_QUEUED; ccb->ccb_h.sym_hcb_ptr = NULL; } - _sym_xpt_done(np, ccb); + xpt_done(ccb); } static void sym_xpt_done2(hcb_p np, union ccb *ccb, int cam_status) @@ -2382,7 +2371,7 @@ static void sym_xpt_done2(hcb_p np, unio SYM_LOCK_ASSERT(MA_OWNED); sym_set_cam_status(ccb, cam_status); - _sym_xpt_done(np, ccb); + xpt_done(ccb); } /* @@ -8935,7 +8924,7 @@ static int sym_cam_attach(hcb_p np) goto fail; np->sim = sim; - if (xpt_create_path(&path, 0, + if (xpt_create_path(&path, NULL, cam_sim_path(np->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { goto fail; From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 22:29:20 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3E371B64; Tue, 4 Jun 2013 22:29:20 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2FE7E1F97; Tue, 4 Jun 2013 22:29:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54MTKmo001826; Tue, 4 Jun 2013 22:29:20 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54MTKSK001825; Tue, 4 Jun 2013 22:29:20 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306042229.r54MTKSK001825@svn.freebsd.org> From: Rick Macklem Date: Tue, 4 Jun 2013 22:29:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251395 - stable/9/sys/fs/nfsclient X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 22:29:20 -0000 Author: rmacklem Date: Tue Jun 4 22:29:19 2013 New Revision: 251395 URL: http://svnweb.freebsd.org/changeset/base/251395 Log: MFC: r251079 Post-r248567, there were times when the client would return a truncated directory for some NFS servers. This turned out to be because the size of a directory reported by an NFS server can be smaller that the ufs-like directory created from the RPC XDR in the client. This patch fixes the problem by changing r248567 so that vnode_pager_setsize() is only done for regular files. Modified: stable/9/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clport.c Tue Jun 4 20:49:17 2013 (r251394) +++ stable/9/sys/fs/nfsclient/nfs_clport.c Tue Jun 4 22:29:19 2013 (r251395) @@ -454,12 +454,10 @@ nfscl_loadattrcache(struct vnode **vpp, np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; } - } else { - np->n_size = vap->va_size; - } - if (vap->va_type == VREG || vap->va_type == VDIR) { setnsize = 1; nsize = vap->va_size; + } else { + np->n_size = vap->va_size; } } /* From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 22:32:34 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 28981FFC; Tue, 4 Jun 2013 22:32:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 00F121FC5; Tue, 4 Jun 2013 22:32:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54MWXU8004261; Tue, 4 Jun 2013 22:32:33 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54MWXPA004259; Tue, 4 Jun 2013 22:32:33 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201306042232.r54MWXPA004259@svn.freebsd.org> From: Alan Somers Date: Tue, 4 Jun 2013 22:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251396 - head/sys/dev/mps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 22:32:34 -0000 Author: asomers Date: Tue Jun 4 22:32:33 2013 New Revision: 251396 URL: http://svnweb.freebsd.org/changeset/base/251396 Log: sys/dev/mps/mps.c sys/dev/mps/mps_user.c Fix uninitialized memory reference in mps_read_config_page. It was referencing a field (params->hdr.Ext.ExtPageType) that would only be set when reading an Extended config page. The symptom was that MPSIO_READ_CFG_PAGE ioctls would randomly fail with MPI2_IOCSTATUS_CONFIG_INVALID_PAGE errors. The solution is to determine whether an extended or an ordinary config page is requested by looking at the PageType field, which should be available regardless. Similarly, mps_user_read_extcfg_header and mps_user_read_extcfg_page, which call mps_read_config_page, had to be fixed to always set the PageType field. They were implicitly assuming that mps_read_config_page always operated on Extended pages. Reviewed by: ken Approved by: ken (mentor) MFC after: 3 days Modified: head/sys/dev/mps/mps.c head/sys/dev/mps/mps_user.c Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Tue Jun 4 22:29:19 2013 (r251395) +++ head/sys/dev/mps/mps.c Tue Jun 4 22:32:33 2013 (r251396) @@ -2387,7 +2387,7 @@ mps_read_config_page(struct mps_softc *s req->SGLFlags = 0; req->ChainOffset = 0; req->PageAddress = params->page_address; - if (params->hdr.Ext.ExtPageType != 0) { + if (params->hdr.Struct.PageType == MPI2_CONFIG_PAGETYPE_EXTENDED) { MPI2_CONFIG_EXTENDED_PAGE_HEADER *hdr; hdr = ¶ms->hdr.Ext; Modified: head/sys/dev/mps/mps_user.c ============================================================================== --- head/sys/dev/mps/mps_user.c Tue Jun 4 22:29:19 2013 (r251395) +++ head/sys/dev/mps/mps_user.c Tue Jun 4 22:32:33 2013 (r251396) @@ -305,6 +305,7 @@ mps_user_read_extcfg_header(struct mps_s hdr = ¶ms.hdr.Ext; params.action = MPI2_CONFIG_ACTION_PAGE_HEADER; hdr->PageVersion = ext_page_req->header.PageVersion; + hdr->PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; hdr->ExtPageLength = 0; hdr->PageNumber = ext_page_req->header.PageNumber; hdr->ExtPageType = ext_page_req->header.ExtPageType; @@ -346,6 +347,7 @@ mps_user_read_extcfg_page(struct mps_sof params.action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; params.page_address = le32toh(ext_page_req->page_address); hdr->PageVersion = reqhdr->PageVersion; + hdr->PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; hdr->PageNumber = reqhdr->PageNumber; hdr->ExtPageType = reqhdr->ExtPageType; hdr->ExtPageLength = reqhdr->ExtPageLength; From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 22:47:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2B6C588E; Tue, 4 Jun 2013 22:47:02 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1C8F81095; Tue, 4 Jun 2013 22:47:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54Ml1YL009184; Tue, 4 Jun 2013 22:47:01 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54Ml1i3009183; Tue, 4 Jun 2013 22:47:01 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201306042247.r54Ml1i3009183@svn.freebsd.org> From: Attilio Rao Date: Tue, 4 Jun 2013 22:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251397 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 22:47:02 -0000 Author: attilio Date: Tue Jun 4 22:47:01 2013 New Revision: 251397 URL: http://svnweb.freebsd.org/changeset/base/251397 Log: In vm_object_split(), busy and consequently unbusy the pages only when swap_pager_copy() is invoked, otherwise there is no reason to do so. This will eliminate the necessity to busy pages most of the times. Sponsored by: EMC / Isilon storage division Reviewed by: alc Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Jun 4 22:32:33 2013 (r251396) +++ head/sys/vm/vm_object.c Tue Jun 4 22:47:01 2013 (r251397) @@ -1390,7 +1390,8 @@ retry: vm_page_rename(m, new_object, idx); vm_page_unlock(m); /* page automatically made dirty by rename and cache handled */ - vm_page_busy(m); + if (orig_object->type == OBJT_SWAP) + vm_page_busy(m); } if (orig_object->type == OBJT_SWAP) { /* @@ -1398,6 +1399,8 @@ retry: * and new_object's locks are released and reacquired. */ swap_pager_copy(orig_object, new_object, offidxstart, 0); + TAILQ_FOREACH(m, &new_object->memq, listq) + vm_page_wakeup(m); /* * Transfer any cached pages from orig_object to new_object. @@ -1413,8 +1416,6 @@ retry: new_object); } VM_OBJECT_WUNLOCK(orig_object); - TAILQ_FOREACH(m, &new_object->memq, listq) - vm_page_wakeup(m); VM_OBJECT_WUNLOCK(new_object); entry->object.vm_object = new_object; entry->offset = 0LL; From owner-svn-src-all@FreeBSD.ORG Tue Jun 4 23:52:57 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DF259ADD; Tue, 4 Jun 2013 23:52:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B577B179D; Tue, 4 Jun 2013 23:52:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54NqvMG032193; Tue, 4 Jun 2013 23:52:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54NqvZX032192; Tue, 4 Jun 2013 23:52:57 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306042352.r54NqvZX032192@svn.freebsd.org> From: Adrian Chadd Date: Tue, 4 Jun 2013 23:52:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251398 - head/tools/tools/ath/athstats X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 23:52:57 -0000 Author: adrian Date: Tue Jun 4 23:52:57 2013 New Revision: 251398 URL: http://svnweb.freebsd.org/changeset/base/251398 Log: Add RX STBC statistics. Modified: head/tools/tools/ath/athstats/athstats.c Modified: head/tools/tools/ath/athstats/athstats.c ============================================================================== --- head/tools/tools/ath/athstats/athstats.c Tue Jun 4 22:47:01 2013 (r251397) +++ head/tools/tools/ath/athstats/athstats.c Tue Jun 4 23:52:57 2013 (r251398) @@ -262,7 +262,9 @@ static const struct fmt athstats[] = { { 10, "rxdescbusy", "rxdescbusy", "Decryption engine busy" }, #define S_RX_HI_CHAIN AFTER(S_RX_DECRYPT_BUSY_ERR) { 4, "rxhi", "rxhi", "Frames received with RX chain in high power mode" }, -#define S_TX_HTPROTECT AFTER(S_RX_HI_CHAIN) +#define S_RX_STBC AFTER(S_RX_HI_CHAIN) + { 6, "rxstbc", "rxstbc", "Frames received w/ STBC encoding" }, +#define S_TX_HTPROTECT AFTER(S_RX_STBC) { 7, "txhtprot", "txhtprot", "Frames transmitted with HT Protection" }, #define S_RX_QEND AFTER(S_TX_HTPROTECT) { 7, "rxquend", "rxquend", "Hit end of RX descriptor queue" }, @@ -420,7 +422,6 @@ static const struct fmt athstats[] = { { 4, "signal", "sig", "avg recv signal (dBm)" }, #define S_BMISSCOUNT AFTER(S_RX_SIGNAL) { 8, "bmisscount", "bmisscnt", "beacon miss count" }, - }; #define S_PHY_MIN S_RX_PHY_UNDERRUN #define S_PHY_MAX S_RX_PHY_CCK_RESTART @@ -773,6 +774,7 @@ ath_get_curstat(struct statfoo *sf, int case S_RX_POST_CRC_ERR: STAT(rx_post_crc_err); case S_RX_DECRYPT_BUSY_ERR: STAT(rx_decrypt_busy_err); case S_RX_HI_CHAIN: STAT(rx_hi_rx_chain); + case S_RX_STBC: STAT(rx_stbc); case S_TX_HTPROTECT: STAT(tx_htprotect); case S_RX_QEND: STAT(rx_hitqueueend); case S_TX_TIMEOUT: STAT(tx_timeout); @@ -1015,6 +1017,7 @@ ath_get_totstat(struct statfoo *sf, int case S_RX_POST_CRC_ERR: STAT(rx_post_crc_err); case S_RX_DECRYPT_BUSY_ERR: STAT(rx_decrypt_busy_err); case S_RX_HI_CHAIN: STAT(rx_hi_rx_chain); + case S_RX_STBC: STAT(rx_stbc); case S_TX_HTPROTECT: STAT(tx_htprotect); case S_RX_QEND: STAT(rx_hitqueueend); case S_TX_TIMEOUT: STAT(tx_timeout); From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 00:39:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 22B85596; Wed, 5 Jun 2013 00:39:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 151121920; Wed, 5 Jun 2013 00:39:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r550dKJ8048802; Wed, 5 Jun 2013 00:39:20 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r550dKKY048801; Wed, 5 Jun 2013 00:39:20 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306050039.r550dKKY048801@svn.freebsd.org> From: Adrian Chadd Date: Wed, 5 Jun 2013 00:39:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251399 - head/sys/dev/ath/ath_hal X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 00:39:21 -0000 Author: adrian Date: Wed Jun 5 00:39:20 2013 New Revision: 251399 URL: http://svnweb.freebsd.org/changeset/base/251399 Log: Document the AR9285/AR9485 LNA configuration information that's stored in the ctl/ext RSSI field for chain 2. Tested: * AR9285, STA Modified: head/sys/dev/ath/ath_hal/ah_desc.h Modified: head/sys/dev/ath/ath_hal/ah_desc.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_desc.h Tue Jun 4 23:52:57 2013 (r251398) +++ head/sys/dev/ath/ath_hal/ah_desc.h Wed Jun 5 00:39:20 2013 (r251399) @@ -157,6 +157,32 @@ struct ath_rx_status { #define HAL_RX_IS_APSD 0x0100 /* Is ASPD trigger frame */ #define HAL_RX_STBC 0x0200 /* Is an STBC frame */ +/* + * This is the format of RSSI[2] on the AR9285/AR9485. + * It encodes the LNA configuration information. + * + * For boards with an external diversity antenna switch, + * HAL_RX_LNA_EXTCFG encodes which configuration was + * used (antenna 1 or antenna 2.) This feeds into the + * switch table and ensures that the given antenna was + * connected to an LNA. + */ +#define HAL_RX_LNA_LNACFG 0x80 /* 1 = main LNA config used, 0 = ALT */ +#define HAL_RX_LNA_EXTCFG 0x40 /* 0 = external diversity ant1, 1 = ant2 */ +#define HAL_RX_LNA_CFG_USED 0x30 /* 2 bits; LNA config used on RX */ +#define HAL_RX_LNA_CFG_USED_S 4 +#define HAL_RX_LNA_CFG_MAIN 0x0c /* 2 bits; "Main" LNA config */ +#define HAL_RX_LNA_CFG_ALT 0x02 /* 2 bits; "Alt" LNA config */ + +/* + * This is the format of RSSI_EXT[2] on the AR9285/AR9485. + * It encodes the switch table configuration and fast diversity + * value. + */ +#define HAL_RX_LNA_FASTDIV 0x40 /* 1 = fast diversity measurement done */ +#define HAL_RX_LNA_SWITCH_0 0x30 /* 2 bits; sw_0[1:0] */ +#define HAL_RX_LNA_SWITCH_COM 0x0f /* 4 bits, sw_com[3:0] */ + enum { HAL_PHYERR_UNDERRUN = 0, /* Transmit underrun */ HAL_PHYERR_TIMING = 1, /* Timing error */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 00:42:05 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8D30A804; Wed, 5 Jun 2013 00:42:05 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6411C193D; Wed, 5 Jun 2013 00:42:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r550g5aY051015; Wed, 5 Jun 2013 00:42:05 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r550g4mQ051010; Wed, 5 Jun 2013 00:42:04 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306050042.r550g4mQ051010@svn.freebsd.org> From: Adrian Chadd Date: Wed, 5 Jun 2013 00:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251400 - in head/sys/dev/ath/ath_hal: . ar9002 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 00:42:05 -0000 Author: adrian Date: Wed Jun 5 00:42:04 2013 New Revision: 251400 URL: http://svnweb.freebsd.org/changeset/base/251400 Log: Add a new capability flag to announce that the chip implements LNA mixing for the RX path. This is different to the div comb HAL flag, that says it actually can use this for RX diversity (the "slow" diversity path implemented but disabled in the AR9285 HAL code.) Tested: * AR9285, STA operation Modified: head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ah_internal.h head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Wed Jun 5 00:39:20 2013 (r251399) +++ head/sys/dev/ath/ath_hal/ah.c Wed Jun 5 00:42:04 2013 (r251400) @@ -784,6 +784,8 @@ ath_hal_getcapability(struct ath_hal *ah case HAL_CAP_MFP: /* Management frame protection setting */ *result = pCap->halMfpSupport; return HAL_OK; + case HAL_CAP_RX_LNA_MIXING: /* Hardware uses an RX LNA mixer to map 2 antennas to a 1 stream receiver */ + return pCap->halRxUsingLnaMixing ? HAL_OK : HAL_ENOTSUPP; default: return HAL_EINVAL; } Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Wed Jun 5 00:39:20 2013 (r251399) +++ head/sys/dev/ath/ath_hal/ah.h Wed Jun 5 00:42:04 2013 (r251400) @@ -198,6 +198,7 @@ typedef enum { HAL_CAP_BB_READ_WAR = 244, /* baseband read WAR */ HAL_CAP_SERIALISE_WAR = 245, /* serialise register access on PCI */ HAL_CAP_ENFORCE_TXOP = 246, /* Enforce TXOP if supported */ + HAL_CAP_RX_LNA_MIXING = 247, /* RX hardware uses LNA mixing */ } HAL_CAPABILITY_TYPE; /* Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Wed Jun 5 00:39:20 2013 (r251399) +++ head/sys/dev/ath/ath_hal/ah_internal.h Wed Jun 5 00:42:04 2013 (r251400) @@ -279,7 +279,8 @@ typedef struct { halAntDivCombSupport : 1, halAntDivCombSupportOrg : 1, halRadioRetentionSupport : 1, - halSpectralScanSupport : 1; + halSpectralScanSupport : 1, + halRxUsingLnaMixing : 1; uint32_t halWirelessModes; uint16_t halTotalQueues; Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Wed Jun 5 00:39:20 2013 (r251399) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Wed Jun 5 00:42:04 2013 (r251400) @@ -525,6 +525,7 @@ ar9285FillCapabilityInfo(struct ath_hal pCap->halMbssidAggrSupport = AH_TRUE; pCap->hal4AddrAggrSupport = AH_TRUE; pCap->halSpectralScanSupport = AH_TRUE; + pCap->halRxUsingLnaMixing = AH_TRUE; if (AR_SREV_KITE_12_OR_LATER(ah)) pCap->halPSPollBroken = AH_FALSE; From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 00:45:20 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A687F9A1; Wed, 5 Jun 2013 00:45:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 98E8A1951; Wed, 5 Jun 2013 00:45:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r550jKZD051786; Wed, 5 Jun 2013 00:45:20 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r550jJ0P051783; Wed, 5 Jun 2013 00:45:19 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306050045.r550jJ0P051783@svn.freebsd.org> From: Adrian Chadd Date: Wed, 5 Jun 2013 00:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251401 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 00:45:20 -0000 Author: adrian Date: Wed Jun 5 00:45:19 2013 New Revision: 251401 URL: http://svnweb.freebsd.org/changeset/base/251401 Log: Implement a bit of a hack to store the AR9285/AR9485 RX LNA configuration in the RX antenna field. The AR9285/AR9485 use an LNA mixer to determine how to combine the signals from the two antennas. This is encoded in the RSSI fields (ctl/ext) for chain 2. So, let's use that here. This maps RX antennas 0->3 to the RX mixer configuration used to receive a frame. There's more that can be done but this is good enough to diagnose if the hardware is doing "odd" things like trying to receive frames on LNA2 (ie, antenna 2 or "alt" antenna) when there's only one antenna connected. Tested: * AR9285, STA mode Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_rx.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Wed Jun 5 00:42:04 2013 (r251400) +++ head/sys/dev/ath/if_ath.c Wed Jun 5 00:45:19 2013 (r251401) @@ -670,6 +670,7 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_rxslink = ath_hal_self_linked_final_rxdesc(ah); sc->sc_rxtsf32 = ath_hal_has_long_rxdesc_tsf(ah); sc->sc_hasenforcetxop = ath_hal_hasenforcetxop(ah); + sc->sc_rx_lnamixer = ath_hal_hasrxlnamixer(ah); if (ath_hal_hasfastframes(ah)) ic->ic_caps |= IEEE80211_C_FF; wmodes = ath_hal_getwirelessmodes(ah); Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Wed Jun 5 00:42:04 2013 (r251400) +++ head/sys/dev/ath/if_ath_rx.c Wed Jun 5 00:45:19 2013 (r251401) @@ -704,6 +704,34 @@ rx_accept: rs->rs_antenna = 0; /* XXX better than nothing */ } + /* + * If this is an AR9285/AR9485, then the receive and LNA + * configuration is stored in RSSI[2] / EXTRSSI[2]. + * We can extract this out to build a much better + * receive antenna profile. + * + * Yes, this just blurts over the above RX antenna field + * for now. It's fine, the AR9285 doesn't really use + * that. + * + * Later on we should store away the fine grained LNA + * information and keep separate counters just for + * that. It'll help when debugging the AR9285/AR9485 + * combined diversity code. + */ + if (sc->sc_rx_lnamixer) { + rs->rs_antenna = 0; + + /* Bits 0:1 - the LNA configuration used */ + rs->rs_antenna |= + ((rs->rs_rssi_ctl[2] & HAL_RX_LNA_CFG_USED) + >> HAL_RX_LNA_CFG_USED_S); + + /* Bit 2 - the external RX antenna switch */ + if (rs->rs_rssi_ctl[2] & HAL_RX_LNA_EXTCFG) + rs->rs_antenna |= 0x4; + } + ifp->if_ipackets++; sc->sc_stats.ast_ant_rx[rs->rs_antenna]++; Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Wed Jun 5 00:42:04 2013 (r251400) +++ head/sys/dev/ath/if_athvar.h Wed Jun 5 00:45:19 2013 (r251401) @@ -629,8 +629,8 @@ struct ath_softc { u_int32_t sc_use_ent : 1, sc_rx_stbc : 1, sc_tx_stbc : 1, - sc_hasenforcetxop : 1; /* support enforce TxOP */ - + sc_hasenforcetxop : 1, /* support enforce TxOP */ + sc_rx_lnamixer : 1; /* RX using LNA mixing */ int sc_cabq_enable; /* Enable cabq transmission */ @@ -1269,6 +1269,8 @@ void ath_intr(void *); #define ath_hal_setenforcetxop(_ah, _v) \ ath_hal_setcapability(_ah, HAL_CAP_ENFORCE_TXOP, 1, _v, NULL) +#define ath_hal_hasrxlnamixer(_ah) \ + (ath_hal_getcapability(_ah, HAL_CAP_RX_LNA_MIXING, 0, NULL) == HAL_OK) /* EDMA definitions */ #define ath_hal_hasedma(_ah) \ From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 01:07:41 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3A0FAEBA; Wed, 5 Jun 2013 01:07:41 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1BA0919E8; Wed, 5 Jun 2013 01:07:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5517e2x059892; Wed, 5 Jun 2013 01:07:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5517eIl059890; Wed, 5 Jun 2013 01:07:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306050107.r5517eIl059890@svn.freebsd.org> From: Marius Strobl Date: Wed, 5 Jun 2013 01:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251402 - head/sys/dev/sym X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 01:07:41 -0000 Author: marius Date: Wed Jun 5 01:07:40 2013 New Revision: 251402 URL: http://svnweb.freebsd.org/changeset/base/251402 Log: Handle/mark/nuke unused arguments. Modified: head/sys/dev/sym/sym_hipd.c Modified: head/sys/dev/sym/sym_hipd.c ============================================================================== --- head/sys/dev/sym/sym_hipd.c Wed Jun 5 00:45:19 2013 (r251401) +++ head/sys/dev/sym/sym_hipd.c Wed Jun 5 01:07:40 2013 (r251402) @@ -595,18 +595,25 @@ static void sym_mfree(void *ptr, int siz * BUS handle. A reverse table (hashed) is maintained for virtual * to BUS address translation. */ -static void getbaddrcb(void *arg, bus_dma_segment_t *segs, int nseg, int error) +static void getbaddrcb(void *arg, bus_dma_segment_t *segs, int nseg __unused, + int error) { bus_addr_t *baddr; + + KASSERT(nseg == 1, ("%s: too many DMA segments (%d)", __func__, nseg)); + baddr = (bus_addr_t *)arg; - *baddr = segs->ds_addr; + if (error) + *baddr = 0; + else + *baddr = segs->ds_addr; } static m_addr_t ___dma_getp(m_pool_s *mp) { m_vtob_s *vbp; void *vaddr = NULL; - bus_addr_t baddr = 0; + bus_addr_t baddr; vbp = __sym_calloc(&mp0, sizeof(*vbp), "VTOB"); if (!vbp) @@ -1165,6 +1172,14 @@ struct sym_tcb { }; /* + * Assert some alignments required by the chip. + */ +CTASSERT(((offsetof(struct sym_reg, nc_sxfer) ^ + offsetof(struct sym_tcb, head.sval)) &3) == 0); +CTASSERT(((offsetof(struct sym_reg, nc_scntl3) ^ + offsetof(struct sym_tcb, head.wval)) &3) == 0); + +/* * Global LCB HEADER. * * Due to lack of indirect addressing on earlier NCR chips, @@ -1265,9 +1280,9 @@ struct sym_pmc { * LUN(s) > 0. */ #if SYM_CONF_MAX_LUN <= 1 -#define sym_lp(np, tp, lun) (!lun) ? (tp)->lun0p : 0 +#define sym_lp(tp, lun) (!lun) ? (tp)->lun0p : 0 #else -#define sym_lp(np, tp, lun) \ +#define sym_lp(tp, lun) \ (!lun) ? (tp)->lun0p : (tp)->lunmp ? (tp)->lunmp[(lun)] : 0 #endif @@ -2222,11 +2237,11 @@ static void sym_int_par (hcb_p np, u_sho static void sym_int_ma (hcb_p np); static int sym_dequeue_from_squeue(hcb_p np, int i, int target, int lun, int task); -static void sym_sir_bad_scsi_status (hcb_p np, int num, ccb_p cp); +static void sym_sir_bad_scsi_status (hcb_p np, ccb_p cp); static int sym_clear_tasks (hcb_p np, int status, int targ, int lun, int task); static void sym_sir_task_recovery (hcb_p np, int num); static int sym_evaluate_dp (hcb_p np, ccb_p cp, u32 scr, int *ofs); -static void sym_modify_dp (hcb_p np, tcb_p tp, ccb_p cp, int ofs); +static void sym_modify_dp(hcb_p np, ccb_p cp, int ofs); static int sym_compute_residual (hcb_p np, ccb_p cp); static int sym_show_msg (u_char * msg); static void sym_print_msg (ccb_p cp, char *label, u_char *msg); @@ -2260,7 +2275,7 @@ static int sym_fast_scatter_sg_physical( static int sym_scatter_sg_physical (hcb_p np, ccb_p cp, bus_dma_segment_t *psegs, int nsegs); static void sym_action2 (struct cam_sim *sim, union ccb *ccb); -static void sym_update_trans (hcb_p np, tcb_p tp, struct sym_trans *tip, +static void sym_update_trans(hcb_p np, struct sym_trans *tip, struct ccb_trans_settings *cts); static void sym_update_dflags(hcb_p np, u_char *flags, struct ccb_trans_settings *cts); @@ -2355,6 +2370,7 @@ static void sym_enqueue_cam_ccb(ccb_p cp static void sym_xpt_done(hcb_p np, union ccb *ccb, ccb_p cp) { + SYM_LOCK_ASSERT(MA_OWNED); if (ccb->ccb_h.status & CAM_SIM_QUEUED) { @@ -2368,6 +2384,7 @@ static void sym_xpt_done(hcb_p np, union static void sym_xpt_done2(hcb_p np, union ccb *ccb, int cam_status) { + SYM_LOCK_ASSERT(MA_OWNED); sym_set_cam_status(ccb, cam_status); @@ -4659,7 +4676,7 @@ sym_flush_comp_queue(hcb_p np, int cam_s * SCRATCHA is assumed to have been loaded with STARTPOS * before the SCRIPTS called the C code. */ -static void sym_sir_bad_scsi_status(hcb_p np, int num, ccb_p cp) +static void sym_sir_bad_scsi_status(hcb_p np, ccb_p cp) { tcb_p tp = &np->target[cp->target]; u32 startp; @@ -5086,7 +5103,7 @@ static void sym_sir_task_recovery(hcb_p * an IDENTIFY(lun) + ABORT MESSAGE. */ if (lun != -1) { - lcb_p lp = sym_lp(np, tp, lun); + lcb_p lp = sym_lp(tp, lun); lp->to_clear = 0; /* We donnot expect to fail here */ np->abrt_msg[0] = M_IDENTIFY | lun; np->abrt_msg[1] = M_ABORT; @@ -5379,7 +5396,7 @@ out_err: * Btw, we assume in that situation that such a message * is equivalent to a MODIFY DATA POINTER (offset=-1). */ -static void sym_modify_dp(hcb_p np, tcb_p tp, ccb_p cp, int ofs) +static void sym_modify_dp(hcb_p np, ccb_p cp, int ofs) { int dp_ofs = ofs; u32 dp_scr = INL (nc_temp); @@ -6108,7 +6125,7 @@ static void sym_int_sir (hcb_p np) case SIR_BAD_SCSI_STATUS: if (!cp) goto out; - sym_sir_bad_scsi_status(np, num, cp); + sym_sir_bad_scsi_status(np, cp); return; /* * We are asked by the SCRIPTS to prepare a @@ -6182,7 +6199,7 @@ static void sym_int_sir (hcb_p np) sym_print_msg(cp,"modify DP",np->msgin); tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) + (np->msgin[5]<<8) + (np->msgin[6]); - sym_modify_dp(np, tp, cp, tmp); + sym_modify_dp(np, cp, tmp); return; case M_X_SYNC_REQ: sym_sync_nego(np, tp, cp); @@ -6207,7 +6224,7 @@ static void sym_int_sir (hcb_p np) case M_IGN_RESIDUE: if (DEBUG_FLAGS & DEBUG_POINTER) sym_print_msg(cp,"ign wide residue", np->msgin); - sym_modify_dp(np, tp, cp, -1); + sym_modify_dp(np, cp, -1); return; case M_REJECT: if (INB (HS_PRT) == HS_NEGOTIATE) @@ -6266,7 +6283,7 @@ out_stuck: static ccb_p sym_get_ccb (hcb_p np, u_char tn, u_char ln, u_char tag_order) { tcb_p tp = &np->target[tn]; - lcb_p lp = sym_lp(np, tp, ln); + lcb_p lp = sym_lp(tp, ln); u_short tag = NO_TAG; SYM_QUEHEAD *qp; ccb_p cp = (ccb_p) NULL; @@ -6389,10 +6406,10 @@ out_free: /* * Release one control block */ -static void sym_free_ccb (hcb_p np, ccb_p cp) +static void sym_free_ccb(hcb_p np, ccb_p cp) { tcb_p tp = &np->target[cp->target]; - lcb_p lp = sym_lp(np, tp, cp->lun); + lcb_p lp = sym_lp(tp, cp->lun); if (DEBUG_FLAGS & DEBUG_TAGS) { PRINT_LUN(np, cp->target, cp->lun); @@ -6577,27 +6594,12 @@ static ccb_p sym_ccb_from_dsa(hcb_p np, } /* - * Target control block initialisation. - * Nothing important to do at the moment. - */ -static void sym_init_tcb (hcb_p np, u_char tn) -{ - /* - * Check some alignments required by the chip. - */ - assert (((offsetof(struct sym_reg, nc_sxfer) ^ - offsetof(struct sym_tcb, head.sval)) &3) == 0); - assert (((offsetof(struct sym_reg, nc_scntl3) ^ - offsetof(struct sym_tcb, head.wval)) &3) == 0); -} - -/* * Lun control block allocation and initialization. */ static lcb_p sym_alloc_lcb (hcb_p np, u_char tn, u_char ln) { tcb_p tp = &np->target[tn]; - lcb_p lp = sym_lp(np, tp, ln); + lcb_p lp = sym_lp(tp, ln); /* * Already done, just return. @@ -6610,11 +6612,6 @@ static lcb_p sym_alloc_lcb (hcb_p np, u_ assert(!sym_is_bit(tp->busy0_map, ln)); /* - * Initialize the target control block if not yet. - */ - sym_init_tcb (np, tn); - - /* * Allocate the LCB bus address array. * Compute the bus address of this table. */ @@ -6680,7 +6677,7 @@ fail: static void sym_alloc_lcb_tags (hcb_p np, u_char tn, u_char ln) { tcb_p tp = &np->target[tn]; - lcb_p lp = sym_lp(np, tp, ln); + lcb_p lp = sym_lp(tp, ln); int i; /* @@ -7290,7 +7287,7 @@ static void sym_complete_ok (hcb_p np, c */ csio = &cp->cam_ccb->csio; tp = &np->target[cp->target]; - lp = sym_lp(np, tp, cp->lun); + lp = sym_lp(tp, cp->lun); /* * Assume device discovered on first success. @@ -7489,7 +7486,7 @@ static void sym_action(struct cam_sim *s * Retrieve the target and lun descriptors. */ tp = &np->target[ccb_h->target_id]; - lp = sym_lp(np, tp, ccb_h->target_lun); + lp = sym_lp(tp, ccb_h->target_lun); /* * Complete the 1st INQUIRY command with error @@ -7991,14 +7988,14 @@ static void sym_action2(struct cam_sim * * Update SPI transport settings in TARGET control block. * Update SCSI device settings in LUN control block. */ - lp = sym_lp(np, tp, ccb_h->target_lun); + lp = sym_lp(tp, ccb_h->target_lun); if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { - sym_update_trans(np, tp, &tp->tinfo.goal, cts); + sym_update_trans(np, &tp->tinfo.goal, cts); if (lp) sym_update_dflags(np, &lp->current_flags, cts); } if (cts->type == CTS_TYPE_USER_SETTINGS) { - sym_update_trans(np, tp, &tp->tinfo.user, cts); + sym_update_trans(np, &tp->tinfo.user, cts); if (lp) sym_update_dflags(np, &lp->user_flags, cts); } @@ -8008,7 +8005,7 @@ static void sym_action2(struct cam_sim * case XPT_GET_TRAN_SETTINGS: cts = &ccb->cts; tp = &np->target[ccb_h->target_id]; - lp = sym_lp(np, tp, ccb_h->target_lun); + lp = sym_lp(tp, ccb_h->target_lun); #define cts__scsi (&cts->proto_specific.scsi) #define cts__spi (&cts->xport_specific.spi) @@ -8133,7 +8130,7 @@ static void sym_action2(struct cam_sim * * Asynchronous notification handler. */ static void -sym_async(void *cb_arg, u32 code, struct cam_path *path, void *arg) +sym_async(void *cb_arg, u32 code, struct cam_path *path, void *args __unused) { hcb_p np; struct cam_sim *sim; @@ -8172,9 +8169,10 @@ sym_async(void *cb_arg, u32 code, struct /* * Update transfer settings of a target. */ -static void sym_update_trans(hcb_p np, tcb_p tp, struct sym_trans *tip, - struct ccb_trans_settings *cts) +static void sym_update_trans(hcb_p np, struct sym_trans *tip, + struct ccb_trans_settings *cts) { + SYM_LOCK_ASSERT(MA_OWNED); /* @@ -8251,6 +8249,7 @@ static void sym_update_trans(hcb_p np, t static void sym_update_dflags(hcb_p np, u_char *flags, struct ccb_trans_settings *cts) { + SYM_LOCK_ASSERT(MA_OWNED); #define cts__scsi (&cts->proto_specific.scsi) @@ -8848,7 +8847,7 @@ static void sym_pci_free(hcb_p np) for (target = 0; target < SYM_CONF_MAX_TARGET ; target++) { tp = &np->target[target]; for (lun = 0 ; lun < SYM_CONF_MAX_LUN ; lun++) { - lp = sym_lp(np, tp, lun); + lp = sym_lp(tp, lun); if (!lp) continue; if (lp->itlq_tbl) @@ -8967,6 +8966,7 @@ fail: */ static void sym_cam_free(hcb_p np) { + SYM_LOCK_ASSERT(MA_NOTOWNED); if (np->intr) { From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 01:23:00 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0DA93332; Wed, 5 Jun 2013 01:23:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F2D201A56; Wed, 5 Jun 2013 01:22:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r551Mxwc066733; Wed, 5 Jun 2013 01:22:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r551Mxjx066732; Wed, 5 Jun 2013 01:22:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306050122.r551Mxjx066732@svn.freebsd.org> From: Marius Strobl Date: Wed, 5 Jun 2013 01:22:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251403 - head/sys/dev/sym X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 01:23:00 -0000 Author: marius Date: Wed Jun 5 01:22:59 2013 New Revision: 251403 URL: http://svnweb.freebsd.org/changeset/base/251403 Log: - Flag sym(4) as supporting unmapped I/O; all necessary conversion actually already has been done as part of r246713. - Revert a part of r251402 in order to appease clang. Modified: head/sys/dev/sym/sym_hipd.c Modified: head/sys/dev/sym/sym_hipd.c ============================================================================== --- head/sys/dev/sym/sym_hipd.c Wed Jun 5 01:07:40 2013 (r251402) +++ head/sys/dev/sym/sym_hipd.c Wed Jun 5 01:22:59 2013 (r251403) @@ -613,7 +613,7 @@ static m_addr_t ___dma_getp(m_pool_s *mp { m_vtob_s *vbp; void *vaddr = NULL; - bus_addr_t baddr; + bus_addr_t baddr = 0; vbp = __sym_calloc(&mp0, sizeof(*vbp), "VTOB"); if (!vbp) @@ -7871,7 +7871,6 @@ sym_setup_data_and_start(hcb_p np, struc xpt_freeze_simq(np->sim, 1); csio->ccb_h.status |= CAM_RELEASE_SIMQ; } - return; } /* @@ -8057,7 +8056,7 @@ static void sym_action2(struct cam_sim * if ((np->features & FE_WIDE) != 0) cpi->hba_inquiry |= PI_WIDE_16; cpi->target_sprt = 0; - cpi->hba_misc = 0; + cpi->hba_misc = PIM_UNMAPPED; if (np->usrflags & SYM_SCAN_TARGETS_HILO) cpi->hba_misc |= PIM_SCANHILO; if (np->usrflags & SYM_AVOID_BUS_RESET) From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 05:33:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D3CCF628; Wed, 5 Jun 2013 05:33:02 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C390C12E8; Wed, 5 Jun 2013 05:33:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r555X2aE047215; Wed, 5 Jun 2013 05:33:02 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r555X2dQ047208; Wed, 5 Jun 2013 05:33:02 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201306050533.r555X2dQ047208@svn.freebsd.org> From: David Schultz Date: Wed, 5 Jun 2013 05:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251404 - in head/lib/msun: . src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 05:33:02 -0000 Author: das Date: Wed Jun 5 05:33:01 2013 New Revision: 251404 URL: http://svnweb.freebsd.org/changeset/base/251404 Log: Style fixes. Submitted by: bde Modified: head/lib/msun/Makefile head/lib/msun/src/catrig.c head/lib/msun/src/catrigf.c head/lib/msun/src/e_log2.c Modified: head/lib/msun/Makefile ============================================================================== --- head/lib/msun/Makefile Wed Jun 5 01:22:59 2013 (r251403) +++ head/lib/msun/Makefile Wed Jun 5 05:33:01 2013 (r251404) @@ -21,6 +21,10 @@ ARCH_SUBDIR= ${MACHINE_CPUARCH} .include "${ARCH_SUBDIR}/Makefile.inc" .PATH: ${.CURDIR}/${ARCH_SUBDIR} +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.PATH: ${.CURDIR}/x86 +CFLAGS+= -I${.CURDIR}/x86 +.endif # long double format .if ${LDBL_PREC} == 64 @@ -35,10 +39,6 @@ CFLAGS+= -I${.CURDIR}/ld128 .PATH: ${.CURDIR}/src .PATH: ${.CURDIR}/man -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -.PATH: ${.CURDIR}/x86 -.endif - LIB= m SHLIBDIR?= /lib SHLIB_MAJOR= 5 @@ -187,8 +187,9 @@ MLINKS+=j0.3 j1.3 j0.3 jn.3 j0.3 y0.3 j0 MLINKS+=j0.3 j0f.3 j0.3 j1f.3 j0.3 jnf.3 j0.3 y0f.3 j0.3 ynf.3 MLINKS+=lgamma.3 gamma.3 lgamma.3 gammaf.3 lgamma.3 lgammaf.3 \ lgamma.3 tgamma.3 lgamma.3 tgammaf.3 -MLINKS+=log.3 log10.3 log.3 log10f.3 log.3 log10l.3 log.3 \ - log1p.3 log.3 log1pf.3 log.3 log1pl.3 log.3 logf.3 log.3 logl.3 \ +MLINKS+=log.3 log10.3 log.3 log10f.3 log.3 log10l.3 \ + log.3 log1p.3 log.3 log1pf.3 log.3 log1pl.3 \ + log.3 logf.3 log.3 logl.3 \ log.3 log2.3 log.3 log2f.3 log.3 log2l.3 MLINKS+=lrint.3 llrint.3 lrint.3 llrintf.3 lrint.3 llrintl.3 \ lrint.3 lrintf.3 lrint.3 lrintl.3 Modified: head/lib/msun/src/catrig.c ============================================================================== --- head/lib/msun/src/catrig.c Wed Jun 5 01:22:59 2013 (r251403) +++ head/lib/msun/src/catrig.c Wed Jun 5 05:33:01 2013 (r251404) @@ -151,13 +151,13 @@ f(double a, double b, double hypot_a_b) */ static inline void do_hard_work(double x, double y, double *rx, int *B_is_usable, double *B, - double *sqrt_A2my2, double *new_y) + double *sqrt_A2my2, double *new_y) { double R, S, A; /* A, B, R, and S are as in Hull et al. */ double Am1, Amy; /* A-1, A-y. */ - R = hypot(x, y + 1); /* |z+I| */ - S = hypot(x, y - 1); /* |z-I| */ + R = hypot(x, y + 1); /* |z+I| */ + S = hypot(x, y - 1); /* |z-I| */ /* A = (|z+I| + |z-I|) / 2 */ A = (R + S) / 2; @@ -174,7 +174,7 @@ do_hard_work(double x, double y, double * Am1 = fp + fm, where fp = f(x, 1+y), and fm = f(x, 1-y). * rx = log1p(Am1 + sqrt(Am1*(A+1))) */ - if (y == 1 && x < DBL_EPSILON*DBL_EPSILON / 128) { + if (y == 1 && x < DBL_EPSILON * DBL_EPSILON / 128) { /* * fp is of order x^2, and fm = x/2. * A = 1 (inexactly). @@ -193,7 +193,7 @@ do_hard_work(double x, double y, double * A = 1 (inexactly). */ *rx = x / sqrt((1 - y) * (1 + y)); - } else /* if (y > 1) */ { + } else { /* if (y > 1) */ /* * A-1 = y-1 (inexactly). */ @@ -251,9 +251,9 @@ do_hard_work(double x, double y, double * scaling should avoid any underflow problems. */ *sqrt_A2my2 = x * (4 / DBL_EPSILON / DBL_EPSILON) * y / - sqrt((y + 1) * (y - 1)); + sqrt((y + 1) * (y - 1)); *new_y = y * (4 / DBL_EPSILON / DBL_EPSILON); - } else /* if (y < 1) */ { + } else { /* if (y < 1) */ /* * fm = 1-y >= DBL_EPSILON, fp is of order x^2, and * A = 1 (inexactly). @@ -298,7 +298,6 @@ casinh(double complex z) * C99 leaves it optional whether to raise invalid if one of * the arguments is not NaN, so we opt not to raise it. */ - /* Bruce Evans tells me this is the way to do this: */ return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); } @@ -337,6 +336,7 @@ double complex casin(double complex z) { double complex w = casinh(cpack(cimag(z), creal(z))); + return (cpack(cimag(w), creal(w))); } @@ -402,17 +402,17 @@ cacos(double complex z) /* All remaining cases are inexact. */ raise_inexact(); - if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON/4) + if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4) return (cpack(pio2_hi - (x - pio2_lo), -y)); do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x); if (B_is_usable) { - if (sx==0) + if (sx == 0) rx = acos(B); else rx = acos(-B); } else { - if (sx==0) + if (sx == 0) rx = atan2(sqrt_A2mx2, new_x); else rx = atan2(sqrt_A2mx2, -new_x); @@ -488,10 +488,6 @@ clog_for_large_values(double complex z) } /* - *============================================================================= - */ - -/* * ================= * | catanh, catan | * ================= @@ -511,6 +507,7 @@ sum_squares(double x, double y) /* Avoid underflow when y is small. */ if (y < SQRT_MIN) return (x * x); + return (x * x + y * y); } @@ -578,7 +575,7 @@ catanh(double complex z) /* This helps handle many cases. */ if (y == 0 && ax <= 1) - return (cpack(atanh(x), y)); + return (cpack(atanh(x), y)); /* To ensure the same accuracy as atan(), and to filter out z = 0. */ if (x == 0) @@ -589,10 +586,9 @@ catanh(double complex z) if (isinf(x)) return (cpack(copysign(0, x), y + y)); /* catanh(NaN + I*+-Inf) = sign(NaN)0 + I*+-PI/2 */ - if (isinf(y)) { + if (isinf(y)) return (cpack(copysign(0, x), - copysign(pio2_hi + pio2_lo, y))); - } + copysign(pio2_hi + pio2_lo, y))); /* * All other cases involving NaN return NaN + I*NaN. * C99 leaves it optional whether to raise invalid if one of @@ -601,10 +597,9 @@ catanh(double complex z) return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); } - if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) { + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) return (cpack(real_part_reciprocal(x, y), - copysign(pio2_hi + pio2_lo, y))); - } + copysign(pio2_hi + pio2_lo, y))); if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) { /* @@ -617,7 +612,7 @@ catanh(double complex z) } if (ax == 1 && ay < DBL_EPSILON) - rx = (log(ay) - m_ln2) / -2; + rx = (m_ln2 - log(ay)) / 2; else rx = log1p(4 * ax / sum_squares(ax - 1, ay)) / 4; @@ -639,5 +634,6 @@ double complex catan(double complex z) { double complex w = catanh(cpack(cimag(z), creal(z))); + return (cpack(cimag(w), creal(w))); } Modified: head/lib/msun/src/catrigf.c ============================================================================== --- head/lib/msun/src/catrigf.c Wed Jun 5 01:22:59 2013 (r251403) +++ head/lib/msun/src/catrigf.c Wed Jun 5 05:33:01 2013 (r251404) @@ -31,7 +31,11 @@ * Mathematical Software, Volume 23 Issue 3, 1997, Pages 299-335, * http://dl.acm.org/citation.cfm?id=275324. * - * The code for catrig.c contains complete comments. + * See catrig.c for complete comments. + * + * XXX comments were removed automatically, and even short ones on the right + * of statements were removed (all of them), contrary to normal style. Only + * a few comments on the right of declarations remain. */ #include @@ -82,7 +86,7 @@ f(float a, float b, float hypot_a_b) static inline void do_hard_work(float x, float y, float *rx, int *B_is_usable, float *B, - float *sqrt_A2my2, float *new_y) + float *sqrt_A2my2, float *new_y) { float R, S, A; float Am1, Amy; @@ -101,7 +105,7 @@ do_hard_work(float x, float y, float *rx Am1 = f(x, 1 + y, R) + f(x, 1 - y, S); *rx = log1pf(Am1 + sqrtf(Am1 * (A + 1))); } else if (y < 1) { - *rx = x / sqrtf((1 - y)*(1 + y)); + *rx = x / sqrtf((1 - y) * (1 + y)); } else { *rx = log1pf((y - 1) + sqrtf((y - 1) * (y + 1))); } @@ -130,7 +134,7 @@ do_hard_work(float x, float y, float *rx *sqrt_A2my2 = sqrtf(Amy * (A + y)); } else if (y > 1) { *sqrt_A2my2 = x * (4 / FLT_EPSILON / FLT_EPSILON) * y / - sqrtf((y + 1) * (y - 1)); + sqrtf((y + 1) * (y - 1)); *new_y = y * (4 / FLT_EPSILON / FLT_EPSILON); } else { *sqrt_A2my2 = sqrtf((1 - y) * (1 + y)); @@ -166,7 +170,7 @@ casinhf(float complex z) else w = clog_for_large_values(-z) + m_ln2; return (cpackf(copysignf(crealf(w), x), - copysignf(cimagf(w), y))); + copysignf(cimagf(w), y))); } if (x == 0 && y == 0) @@ -189,6 +193,7 @@ float complex casinf(float complex z) { float complex w = casinhf(cpackf(cimagf(z), crealf(z))); + return (cpackf(cimagf(w), crealf(w))); } @@ -212,7 +217,8 @@ cacosf(float complex z) return (cpackf(y + y, -INFINITY)); if (isinf(y)) return (cpackf(x + x, -y)); - if (x == 0) return (cpackf(pio2_hi + pio2_lo, y + y)); + if (x == 0) + return (cpackf(pio2_hi + pio2_lo, y + y)); return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); } @@ -235,17 +241,17 @@ cacosf(float complex z) do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x); if (B_is_usable) { - if (sx==0) + if (sx == 0) rx = acosf(B); else rx = acosf(-B); } else { - if (sx==0) + if (sx == 0) rx = atan2f(sqrt_A2mx2, new_x); else rx = atan2f(sqrt_A2mx2, -new_x); } - if (sy==0) + if (sy == 0) ry = -ry; return (cpackf(rx, ry)); } @@ -284,10 +290,9 @@ clog_for_large_values(float complex z) ay = t; } - if (ax > FLT_MAX / 2) { + if (ax > FLT_MAX / 2) return (cpackf(logf(hypotf(x / m_e, y / m_e)) + 1, - atan2f(y, x))); - } + atan2f(y, x))); if (ax > QUARTER_SQRT_MAX || ay < SQRT_MIN) return (cpackf(logf(hypotf(x, y)), atan2f(y, x))); @@ -300,8 +305,9 @@ sum_squares(float x, float y) { if (y < SQRT_MIN) - return (x*x); - return (x*x + y*y); + return (x * x); + + return (x * x + y * y); } static inline float @@ -318,9 +324,9 @@ real_part_reciprocal(float x, float y) #define BIAS (FLT_MAX_EXP - 1) #define CUTOFF (FLT_MANT_DIG / 2 + 1) if (ix - iy >= CUTOFF << 23 || isinf(x)) - return (1/x); + return (1 / x); if (iy - ix >= CUTOFF << 23) - return (x/y/y); + return (x / y / y); if (ix <= (BIAS + FLT_MAX_EXP / 2 - CUTOFF) << 23) return (x / (x * x + y * y)); SET_FLOAT_WORD(scale, 0x7f800000 - ix); @@ -340,25 +346,23 @@ catanhf(float complex z) ay = fabsf(y); if (y == 0 && ax <= 1) - return (cpackf(atanhf(x), y)); + return (cpackf(atanhf(x), y)); if (x == 0) return (cpackf(x, atanf(y))); if (isnan(x) || isnan(y)) { if (isinf(x)) - return (cpackf(copysignf(0, x), y+y)); - if (isinf(y)) { + return (cpackf(copysignf(0, x), y + y)); + if (isinf(y)) return (cpackf(copysignf(0, x), - copysignf(pio2_hi + pio2_lo, y))); - } + copysignf(pio2_hi + pio2_lo, y))); return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); } - if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) { + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) return (cpackf(real_part_reciprocal(x, y), - copysignf(pio2_hi + pio2_lo, y))); - } + copysignf(pio2_hi + pio2_lo, y))); if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) { raise_inexact(); @@ -366,7 +370,7 @@ catanhf(float complex z) } if (ax == 1 && ay < FLT_EPSILON) - rx = (logf(ay) - m_ln2) / -2; + rx = (m_ln2 - logf(ay)) / 2; else rx = log1pf(4 * ax / sum_squares(ax - 1, ay)) / 4; @@ -384,5 +388,6 @@ float complex catanf(float complex z) { float complex w = catanhf(cpackf(cimagf(z), crealf(z))); + return (cpackf(cimagf(w), crealf(w))); } Modified: head/lib/msun/src/e_log2.c ============================================================================== --- head/lib/msun/src/e_log2.c Wed Jun 5 01:22:59 2013 (r251403) +++ head/lib/msun/src/e_log2.c Wed Jun 5 05:33:01 2013 (r251404) @@ -24,6 +24,8 @@ __FBSDID("$FreeBSD$"); * in not-quite-routine extra precision. */ +#include + #include "math.h" #include "math_private.h" #include "k_log.h" From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 06:00:12 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 09FD3C77; Wed, 5 Jun 2013 06:00:12 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id C5AF315DB; Wed, 5 Jun 2013 06:00:11 +0000 (UTC) Received: from lstewart.caia.swin.edu.au (lstewart.caia.swin.edu.au [136.186.229.95]) by lauren.room52.net (Postfix) with ESMTPSA id 8FCF57E81E; Wed, 5 Jun 2013 15:51:47 +1000 (EST) Message-ID: <51AED1F3.2060003@freebsd.org> Date: Wed, 05 Jun 2013 15:51:47 +1000 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130521 Thunderbird/17.0.6 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r251297 - head/sys/dev/xen/netfront References: <201306031300.r53D0XUx092178@svn.freebsd.org> In-Reply-To: <201306031300.r53D0XUx092178@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, cperciva@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 06:00:12 -0000 On 06/03/13 23:00, Andre Oppermann wrote: > Author: andre > Date: Mon Jun 3 13:00:33 2013 > New Revision: 251297 > URL: http://svnweb.freebsd.org/changeset/base/251297 > > Log: > Specify a maximum TSO length limiting the segment chain to what the > Xen host side can handle after defragmentation. > > This prevents the driver from throwing away too long TSO chains and > improves the performance on Amazon AWS instances with 10GigE virtual > interfaces to the normally expected throughput. > > Submitted by: cperciva (earlier version) > Reviewed by: cperciva > Tested by: cperciva > MFC after: 1 week > > Modified: > head/sys/dev/xen/netfront/netfront.c > > Modified: head/sys/dev/xen/netfront/netfront.c > ============================================================================== > --- head/sys/dev/xen/netfront/netfront.c Mon Jun 3 12:55:13 2013 (r251296) > +++ head/sys/dev/xen/netfront/netfront.c Mon Jun 3 13:00:33 2013 (r251297) > @@ -134,6 +134,7 @@ static const int MODPARM_rx_flip = 0; > * to mirror the Linux MAX_SKB_FRAGS constant. > */ > #define MAX_TX_REQ_FRAGS (65536 / PAGE_SIZE + 2) > +#define NF_TSO_MAXBURST ((IP_MAXPACKET / PAGE_SIZE) * MCLBYTES) For posterity's sake, can you and/or Colin please elaborate on how this value was determined and what it is dependent upon? Could a newer version of Xen remove the need for this reduced limit? Cheers, Lawrence From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 06:14:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6F55923D for ; Wed, 5 Jun 2013 06:14:49 +0000 (UTC) (envelope-from bounces+73574-8822-svn-src-all=freebsd.org@sendgrid.me) Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85]) by mx1.freebsd.org (Postfix) with SMTP id F13621688 for ; Wed, 5 Jun 2013 06:14:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h=from :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpapi; bh=iJem3h9WHvJUWDO9RZ5RMd idMSk=; b=McXSDBMo/pYpfQdSvkcrzljqV8WsWztRZeoSoGMdA2pTfzCjJvZHZH wz1awgskmMDYbKCwnsS0YjS+iq6P5AVX8QYuCibEWUlxhuSSjG5h7JcH/d42aPGI uwEjMhhCU9WzFNnEK0iiQUIcRwL68MFnXli/OR00sKKg20NpBFnW4= Received: by 10.42.83.34 with SMTP id filter-123.24595.51AED7582 Wed, 05 Jun 2013 06:14:48 +0000 (UTC) Received: from mail.tarsnap.com (unknown [10.60.208.17]) by mi19 (SG) with ESMTP id 13f12f92f78.482f.16789fd for ; Wed, 05 Jun 2013 01:14:47 -0500 (CST) Received: (qmail 48915 invoked from network); 5 Jun 2013 06:14:46 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 5 Jun 2013 06:14:46 -0000 Received: (qmail 69478 invoked from network); 5 Jun 2013 06:13:54 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 5 Jun 2013 06:13:54 -0000 Message-ID: <51AED722.8000504@freebsd.org> Date: Tue, 04 Jun 2013 23:13:54 -0700 From: Colin Percival User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130524 Thunderbird/17.0.6 MIME-Version: 1.0 To: Lawrence Stewart Subject: Re: svn commit: r251297 - head/sys/dev/xen/netfront References: <201306031300.r53D0XUx092178@svn.freebsd.org> <51AED1F3.2060003@freebsd.org> In-Reply-To: <51AED1F3.2060003@freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SG-EID: A6W2xSVPHetogaU8rnzccWwgBYtN+QvIzXyjfe/10PFt7odERcTzFE6iBL5iSTO14jKdo/jsgr8RmgoUPN0ZU9fIel8UAjsQXcCi5P4h0WY6jGeIg5YNI414l+qUEkL47qyFUhfYKM/seQ94xzKw8g== Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andre Oppermann X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 06:14:49 -0000 On 06/04/13 22:51, Lawrence Stewart wrote: > On 06/03/13 23:00, Andre Oppermann wrote: >> Modified: head/sys/dev/xen/netfront/netfront.c >> ============================================================================== >> --- head/sys/dev/xen/netfront/netfront.c Mon Jun 3 12:55:13 2013 (r251296) >> +++ head/sys/dev/xen/netfront/netfront.c Mon Jun 3 13:00:33 2013 (r251297) >> @@ -134,6 +134,7 @@ static const int MODPARM_rx_flip = 0; >> * to mirror the Linux MAX_SKB_FRAGS constant. >> */ >> #define MAX_TX_REQ_FRAGS (65536 / PAGE_SIZE + 2) >> +#define NF_TSO_MAXBURST ((IP_MAXPACKET / PAGE_SIZE) * MCLBYTES) > > For posterity's sake, can you and/or Colin please elaborate on how this > value was determined and what it is dependent upon? Could a newer > version of Xen remove the need for this reduced limit? The comment above (of which only the last line is quoted in the diff) explains it: * This limit is imposed by the backend driver. We assume here that * we are dealing with a Linux driver domain and have set our limit * to mirror the Linux MAX_SKB_FRAGS constant. This isn't a Xen issue really; rather, it's a Linux Dom0 issue. AFAIK there are no changes in the pipe to fix this in Linux; but this would not be needed with a different Dom0 (e.g., a FreeBSD Dom0, if/when that becomes possible) or if FreeBSD switched to using 4kB mbuf clusters (since at that point we would be matching Linux and be able to fit a maximum-length IP packet into the allowed number of fragments). -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 06:38:47 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 26344696 for ; Wed, 5 Jun 2013 06:38:47 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 78AAF171C for ; Wed, 5 Jun 2013 06:38:45 +0000 (UTC) Received: (qmail 3106 invoked from network); 5 Jun 2013 07:35:55 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 5 Jun 2013 07:35:55 -0000 Message-ID: <51AEDCF1.9020109@freebsd.org> Date: Wed, 05 Jun 2013 08:38:41 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Colin Percival Subject: Re: svn commit: r251297 - head/sys/dev/xen/netfront References: <201306031300.r53D0XUx092178@svn.freebsd.org> <51AED1F3.2060003@freebsd.org> <51AED722.8000504@freebsd.org> In-Reply-To: <51AED722.8000504@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, Lawrence Stewart , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 06:38:47 -0000 On 05.06.2013 08:13, Colin Percival wrote: > On 06/04/13 22:51, Lawrence Stewart wrote: >> On 06/03/13 23:00, Andre Oppermann wrote: >>> Modified: head/sys/dev/xen/netfront/netfront.c >>> ============================================================================== >>> --- head/sys/dev/xen/netfront/netfront.c Mon Jun 3 12:55:13 2013 (r251296) >>> +++ head/sys/dev/xen/netfront/netfront.c Mon Jun 3 13:00:33 2013 (r251297) >>> @@ -134,6 +134,7 @@ static const int MODPARM_rx_flip = 0; >>> * to mirror the Linux MAX_SKB_FRAGS constant. >>> */ >>> #define MAX_TX_REQ_FRAGS (65536 / PAGE_SIZE + 2) >>> +#define NF_TSO_MAXBURST ((IP_MAXPACKET / PAGE_SIZE) * MCLBYTES) >> >> For posterity's sake, can you and/or Colin please elaborate on how this >> value was determined and what it is dependent upon? Could a newer >> version of Xen remove the need for this reduced limit? > > The comment above (of which only the last line is quoted in the diff) > explains it: > * This limit is imposed by the backend driver. We assume here that > * we are dealing with a Linux driver domain and have set our limit > * to mirror the Linux MAX_SKB_FRAGS constant. > > This isn't a Xen issue really; rather, it's a Linux Dom0 issue. AFAIK > there are no changes in the pipe to fix this in Linux; but this would not > be needed with a different Dom0 (e.g., a FreeBSD Dom0, if/when that becomes > possible) or if FreeBSD switched to using 4kB mbuf clusters (since at that > point we would be matching Linux and be able to fit a maximum-length IP > packet into the allowed number of fragments). We do support 4K mbufs and have done so for a long time. The problem is that socket buffer mbuf chains can be any combination of mbuf sizes and m_defrag() so far only collapses to 2K mbuf clusters. The latter can be changed but it is used in a number of places where an explicit 2K assumption may have been made (even if it shouldn't). When all them are checked m_defrag() can be changed to collapse into 4K mbufs and this "hack" removed. -- Andre From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 07:37:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9CBFC285; Wed, 5 Jun 2013 07:37:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F855192C; Wed, 5 Jun 2013 07:37:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r557bjHJ085375; Wed, 5 Jun 2013 07:37:45 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r557bj7J085374; Wed, 5 Jun 2013 07:37:45 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201306050737.r557bj7J085374@svn.freebsd.org> From: Andrew Turner Date: Wed, 5 Jun 2013 07:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251405 - head/lib/libc/arm/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 07:37:45 -0000 Author: andrew Date: Wed Jun 5 07:37:45 2013 New Revision: 251405 URL: http://svnweb.freebsd.org/changeset/base/251405 Log: Remove part of the NetBSD longjmp code that was not ready to be merged. Modified: head/lib/libc/arm/gen/setjmp.S Modified: head/lib/libc/arm/gen/setjmp.S ============================================================================== --- head/lib/libc/arm/gen/setjmp.S Wed Jun 5 05:33:01 2013 (r251404) +++ head/lib/libc/arm/gen/setjmp.S Wed Jun 5 07:37:45 2013 (r251405) @@ -78,8 +78,7 @@ ENTRY(setjmp) ENTRY(__longjmp) ldr r2, [r0] ldr ip, .Lsetjmp_magic - bic r3, r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP) - teq r3, ip + teq r2, ip bne .Lbotch /* Restore the signal mask. */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 07:49:47 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 52509698; Wed, 5 Jun 2013 07:49:47 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-ie0-x235.google.com (mail-ie0-x235.google.com [IPv6:2607:f8b0:4001:c03::235]) by mx1.freebsd.org (Postfix) with ESMTP id 0432819BA; Wed, 5 Jun 2013 07:49:46 +0000 (UTC) Received: by mail-ie0-f181.google.com with SMTP id x14so2821355ief.40 for ; Wed, 05 Jun 2013 00:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ZkX3U74VNOfMYgBEVCfVFvH/sSEgUUQeVZFypXXIPWg=; b=zDiq3GsV0WAP0f23i15mTOG1YCE8GqiOAUFmI57baQVhjbdbQoqbBWkjfXRMZ8Tfxw IpzKlfTgNgpJP1a6NQdgm3rszLfZt3J5NqHvP0zKRKzfvgrG5HNiGVwJamScO2ejCpSQ QWzd6/BZ1NLl3OszXAslcniO2BFTI46khsuna7tdgoQ+GU/f4aCVBU6bExZ8HNHZ7Pnw 3r7ExUXjCVofVoIuf6aW1B4zo/UD/NrAe40teysYMSpJ/Rrzuz0YqRV/aESyh6nnFhu9 Cl1wo0ni758eXw3PNs8digHFxu9f+Hzpow0zLJ1Pptg6biJuZUNtCpjT+yMZeGESKErt 0kqA== MIME-Version: 1.0 X-Received: by 10.50.98.3 with SMTP id ee3mr2538261igb.101.1370418586584; Wed, 05 Jun 2013 00:49:46 -0700 (PDT) Received: by 10.64.71.101 with HTTP; Wed, 5 Jun 2013 00:49:46 -0700 (PDT) Received: by 10.64.71.101 with HTTP; Wed, 5 Jun 2013 00:49:46 -0700 (PDT) In-Reply-To: <201306050533.r555X2dQ047208@svn.freebsd.org> References: <201306050533.r555X2dQ047208@svn.freebsd.org> Date: Wed, 5 Jun 2013 08:49:46 +0100 Message-ID: Subject: Re: svn commit: r251404 - in head/lib/msun: . src From: Chris Rees To: David Schultz Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 07:49:47 -0000 On 5 Jun 2013 06:33, "David Schultz" wrote: > > Author: das > Date: Wed Jun 5 05:33:01 2013 > New Revision: 251404 > URL: http://svnweb.freebsd.org/changeset/base/251404 > > Log: > Style fixes. > > Submitted by: bde > > Modified: > head/lib/msun/Makefile > head/lib/msun/src/catrig.c > head/lib/msun/src/catrigf.c > head/lib/msun/src/e_log2.c > > Modified: head/lib/msun/Makefile > ============================================================================== > --- head/lib/msun/Makefile Wed Jun 5 01:22:59 2013 (r251403) > +++ head/lib/msun/Makefile Wed Jun 5 05:33:01 2013 (r251404) > @@ -21,6 +21,10 @@ ARCH_SUBDIR= ${MACHINE_CPUARCH} > .include "${ARCH_SUBDIR}/Makefile.inc" > > .PATH: ${.CURDIR}/${ARCH_SUBDIR} > +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" > +.PATH: ${.CURDIR}/x86 > +CFLAGS+= -I${.CURDIR}/x86 > +.endif Since you're doing style fixes, it is worth noting that quoting strings in Makefiles is nearly always incorrect, and only works in our make because of an extension. Chris > # long double format > .if ${LDBL_PREC} == 64 > @@ -35,10 +39,6 @@ CFLAGS+= -I${.CURDIR}/ld128 > .PATH: ${.CURDIR}/src > .PATH: ${.CURDIR}/man > > -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" > -.PATH: ${.CURDIR}/x86 > -.endif > - > LIB= m > SHLIBDIR?= /lib > SHLIB_MAJOR= 5 > @@ -187,8 +187,9 @@ MLINKS+=j0.3 j1.3 j0.3 jn.3 j0.3 y0.3 j0 > MLINKS+=j0.3 j0f.3 j0.3 j1f.3 j0.3 jnf.3 j0.3 y0f.3 j0.3 ynf.3 > MLINKS+=lgamma.3 gamma.3 lgamma.3 gammaf.3 lgamma.3 lgammaf.3 \ > lgamma.3 tgamma.3 lgamma.3 tgammaf.3 > -MLINKS+=log.3 log10.3 log.3 log10f.3 log.3 log10l.3 log.3 \ > - log1p.3 log.3 log1pf.3 log.3 log1pl.3 log.3 logf.3 log.3 logl.3 \ > +MLINKS+=log.3 log10.3 log.3 log10f.3 log.3 log10l.3 \ > + log.3 log1p.3 log.3 log1pf.3 log.3 log1pl.3 \ > + log.3 logf.3 log.3 logl.3 \ > log.3 log2.3 log.3 log2f.3 log.3 log2l.3 > MLINKS+=lrint.3 llrint.3 lrint.3 llrintf.3 lrint.3 llrintl.3 \ > lrint.3 lrintf.3 lrint.3 lrintl.3 > > Modified: head/lib/msun/src/catrig.c > ============================================================================== > --- head/lib/msun/src/catrig.c Wed Jun 5 01:22:59 2013 (r251403) > +++ head/lib/msun/src/catrig.c Wed Jun 5 05:33:01 2013 (r251404) > @@ -151,13 +151,13 @@ f(double a, double b, double hypot_a_b) > */ > static inline void > do_hard_work(double x, double y, double *rx, int *B_is_usable, double *B, > - double *sqrt_A2my2, double *new_y) > + double *sqrt_A2my2, double *new_y) > { > double R, S, A; /* A, B, R, and S are as in Hull et al. */ > double Am1, Amy; /* A-1, A-y. */ > > - R = hypot(x, y + 1); /* |z+I| */ > - S = hypot(x, y - 1); /* |z-I| */ > + R = hypot(x, y + 1); /* |z+I| */ > + S = hypot(x, y - 1); /* |z-I| */ > > /* A = (|z+I| + |z-I|) / 2 */ > A = (R + S) / 2; > @@ -174,7 +174,7 @@ do_hard_work(double x, double y, double > * Am1 = fp + fm, where fp = f(x, 1+y), and fm = f(x, 1-y). > * rx = log1p(Am1 + sqrt(Am1*(A+1))) > */ > - if (y == 1 && x < DBL_EPSILON*DBL_EPSILON / 128) { > + if (y == 1 && x < DBL_EPSILON * DBL_EPSILON / 128) { > /* > * fp is of order x^2, and fm = x/2. > * A = 1 (inexactly). > @@ -193,7 +193,7 @@ do_hard_work(double x, double y, double > * A = 1 (inexactly). > */ > *rx = x / sqrt((1 - y) * (1 + y)); > - } else /* if (y > 1) */ { > + } else { /* if (y > 1) */ > /* > * A-1 = y-1 (inexactly). > */ > @@ -251,9 +251,9 @@ do_hard_work(double x, double y, double > * scaling should avoid any underflow problems. > */ > *sqrt_A2my2 = x * (4 / DBL_EPSILON / DBL_EPSILON) * y / > - sqrt((y + 1) * (y - 1)); > + sqrt((y + 1) * (y - 1)); > *new_y = y * (4 / DBL_EPSILON / DBL_EPSILON); > - } else /* if (y < 1) */ { > + } else { /* if (y < 1) */ > /* > * fm = 1-y >= DBL_EPSILON, fp is of order x^2, and > * A = 1 (inexactly). > @@ -298,7 +298,6 @@ casinh(double complex z) > * C99 leaves it optional whether to raise invalid if one of > * the arguments is not NaN, so we opt not to raise it. > */ > - /* Bruce Evans tells me this is the way to do this: */ > return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); > } > > @@ -337,6 +336,7 @@ double complex > casin(double complex z) > { > double complex w = casinh(cpack(cimag(z), creal(z))); > + > return (cpack(cimag(w), creal(w))); > } > > @@ -402,17 +402,17 @@ cacos(double complex z) > /* All remaining cases are inexact. */ > raise_inexact(); > > - if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON/4) > + if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4) > return (cpack(pio2_hi - (x - pio2_lo), -y)); > > do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x); > if (B_is_usable) { > - if (sx==0) > + if (sx == 0) > rx = acos(B); > else > rx = acos(-B); > } else { > - if (sx==0) > + if (sx == 0) > rx = atan2(sqrt_A2mx2, new_x); > else > rx = atan2(sqrt_A2mx2, -new_x); > @@ -488,10 +488,6 @@ clog_for_large_values(double complex z) > } > > /* > - *============================================================================= > - */ > - > -/* > * ================= > * | catanh, catan | > * ================= > @@ -511,6 +507,7 @@ sum_squares(double x, double y) > /* Avoid underflow when y is small. */ > if (y < SQRT_MIN) > return (x * x); > + > return (x * x + y * y); > } > > @@ -578,7 +575,7 @@ catanh(double complex z) > > /* This helps handle many cases. */ > if (y == 0 && ax <= 1) > - return (cpack(atanh(x), y)); > + return (cpack(atanh(x), y)); > > /* To ensure the same accuracy as atan(), and to filter out z = 0. */ > if (x == 0) > @@ -589,10 +586,9 @@ catanh(double complex z) > if (isinf(x)) > return (cpack(copysign(0, x), y + y)); > /* catanh(NaN + I*+-Inf) = sign(NaN)0 + I*+-PI/2 */ > - if (isinf(y)) { > + if (isinf(y)) > return (cpack(copysign(0, x), > - copysign(pio2_hi + pio2_lo, y))); > - } > + copysign(pio2_hi + pio2_lo, y))); > /* > * All other cases involving NaN return NaN + I*NaN. > * C99 leaves it optional whether to raise invalid if one of > @@ -601,10 +597,9 @@ catanh(double complex z) > return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); > } > > - if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) { > + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) > return (cpack(real_part_reciprocal(x, y), > - copysign(pio2_hi + pio2_lo, y))); > - } > + copysign(pio2_hi + pio2_lo, y))); > > if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) { > /* > @@ -617,7 +612,7 @@ catanh(double complex z) > } > > if (ax == 1 && ay < DBL_EPSILON) > - rx = (log(ay) - m_ln2) / -2; > + rx = (m_ln2 - log(ay)) / 2; > else > rx = log1p(4 * ax / sum_squares(ax - 1, ay)) / 4; > > @@ -639,5 +634,6 @@ double complex > catan(double complex z) > { > double complex w = catanh(cpack(cimag(z), creal(z))); > + > return (cpack(cimag(w), creal(w))); > } > > Modified: head/lib/msun/src/catrigf.c > ============================================================================== > --- head/lib/msun/src/catrigf.c Wed Jun 5 01:22:59 2013 (r251403) > +++ head/lib/msun/src/catrigf.c Wed Jun 5 05:33:01 2013 (r251404) > @@ -31,7 +31,11 @@ > * Mathematical Software, Volume 23 Issue 3, 1997, Pages 299-335, > * http://dl.acm.org/citation.cfm?id=275324. > * > - * The code for catrig.c contains complete comments. > + * See catrig.c for complete comments. > + * > + * XXX comments were removed automatically, and even short ones on the right > + * of statements were removed (all of them), contrary to normal style. Only > + * a few comments on the right of declarations remain. > */ > > #include > @@ -82,7 +86,7 @@ f(float a, float b, float hypot_a_b) > > static inline void > do_hard_work(float x, float y, float *rx, int *B_is_usable, float *B, > - float *sqrt_A2my2, float *new_y) > + float *sqrt_A2my2, float *new_y) > { > float R, S, A; > float Am1, Amy; > @@ -101,7 +105,7 @@ do_hard_work(float x, float y, float *rx > Am1 = f(x, 1 + y, R) + f(x, 1 - y, S); > *rx = log1pf(Am1 + sqrtf(Am1 * (A + 1))); > } else if (y < 1) { > - *rx = x / sqrtf((1 - y)*(1 + y)); > + *rx = x / sqrtf((1 - y) * (1 + y)); > } else { > *rx = log1pf((y - 1) + sqrtf((y - 1) * (y + 1))); > } > @@ -130,7 +134,7 @@ do_hard_work(float x, float y, float *rx > *sqrt_A2my2 = sqrtf(Amy * (A + y)); > } else if (y > 1) { > *sqrt_A2my2 = x * (4 / FLT_EPSILON / FLT_EPSILON) * y / > - sqrtf((y + 1) * (y - 1)); > + sqrtf((y + 1) * (y - 1)); > *new_y = y * (4 / FLT_EPSILON / FLT_EPSILON); > } else { > *sqrt_A2my2 = sqrtf((1 - y) * (1 + y)); > @@ -166,7 +170,7 @@ casinhf(float complex z) > else > w = clog_for_large_values(-z) + m_ln2; > return (cpackf(copysignf(crealf(w), x), > - copysignf(cimagf(w), y))); > + copysignf(cimagf(w), y))); > } > > if (x == 0 && y == 0) > @@ -189,6 +193,7 @@ float complex > casinf(float complex z) > { > float complex w = casinhf(cpackf(cimagf(z), crealf(z))); > + > return (cpackf(cimagf(w), crealf(w))); > } > > @@ -212,7 +217,8 @@ cacosf(float complex z) > return (cpackf(y + y, -INFINITY)); > if (isinf(y)) > return (cpackf(x + x, -y)); > - if (x == 0) return (cpackf(pio2_hi + pio2_lo, y + y)); > + if (x == 0) > + return (cpackf(pio2_hi + pio2_lo, y + y)); > return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); > } > > @@ -235,17 +241,17 @@ cacosf(float complex z) > > do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x); > if (B_is_usable) { > - if (sx==0) > + if (sx == 0) > rx = acosf(B); > else > rx = acosf(-B); > } else { > - if (sx==0) > + if (sx == 0) > rx = atan2f(sqrt_A2mx2, new_x); > else > rx = atan2f(sqrt_A2mx2, -new_x); > } > - if (sy==0) > + if (sy == 0) > ry = -ry; > return (cpackf(rx, ry)); > } > @@ -284,10 +290,9 @@ clog_for_large_values(float complex z) > ay = t; > } > > - if (ax > FLT_MAX / 2) { > + if (ax > FLT_MAX / 2) > return (cpackf(logf(hypotf(x / m_e, y / m_e)) + 1, > - atan2f(y, x))); > - } > + atan2f(y, x))); > > if (ax > QUARTER_SQRT_MAX || ay < SQRT_MIN) > return (cpackf(logf(hypotf(x, y)), atan2f(y, x))); > @@ -300,8 +305,9 @@ sum_squares(float x, float y) > { > > if (y < SQRT_MIN) > - return (x*x); > - return (x*x + y*y); > + return (x * x); > + > + return (x * x + y * y); > } > > static inline float > @@ -318,9 +324,9 @@ real_part_reciprocal(float x, float y) > #define BIAS (FLT_MAX_EXP - 1) > #define CUTOFF (FLT_MANT_DIG / 2 + 1) > if (ix - iy >= CUTOFF << 23 || isinf(x)) > - return (1/x); > + return (1 / x); > if (iy - ix >= CUTOFF << 23) > - return (x/y/y); > + return (x / y / y); > if (ix <= (BIAS + FLT_MAX_EXP / 2 - CUTOFF) << 23) > return (x / (x * x + y * y)); > SET_FLOAT_WORD(scale, 0x7f800000 - ix); > @@ -340,25 +346,23 @@ catanhf(float complex z) > ay = fabsf(y); > > if (y == 0 && ax <= 1) > - return (cpackf(atanhf(x), y)); > + return (cpackf(atanhf(x), y)); > > if (x == 0) > return (cpackf(x, atanf(y))); > > if (isnan(x) || isnan(y)) { > if (isinf(x)) > - return (cpackf(copysignf(0, x), y+y)); > - if (isinf(y)) { > + return (cpackf(copysignf(0, x), y + y)); > + if (isinf(y)) > return (cpackf(copysignf(0, x), > - copysignf(pio2_hi + pio2_lo, y))); > - } > + copysignf(pio2_hi + pio2_lo, y))); > return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); > } > > - if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) { > + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) > return (cpackf(real_part_reciprocal(x, y), > - copysignf(pio2_hi + pio2_lo, y))); > - } > + copysignf(pio2_hi + pio2_lo, y))); > > if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) { > raise_inexact(); > @@ -366,7 +370,7 @@ catanhf(float complex z) > } > > if (ax == 1 && ay < FLT_EPSILON) > - rx = (logf(ay) - m_ln2) / -2; > + rx = (m_ln2 - logf(ay)) / 2; > else > rx = log1pf(4 * ax / sum_squares(ax - 1, ay)) / 4; > > @@ -384,5 +388,6 @@ float complex > catanf(float complex z) > { > float complex w = catanhf(cpackf(cimagf(z), crealf(z))); > + > return (cpackf(cimagf(w), crealf(w))); > } > > Modified: head/lib/msun/src/e_log2.c > ============================================================================== > --- head/lib/msun/src/e_log2.c Wed Jun 5 01:22:59 2013 (r251403) > +++ head/lib/msun/src/e_log2.c Wed Jun 5 05:33:01 2013 (r251404) > @@ -24,6 +24,8 @@ __FBSDID("$FreeBSD$"); > * in not-quite-routine extra precision. > */ > > +#include > + > #include "math.h" > #include "math_private.h" > #include "k_log.h" > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 08:13:08 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EF206F73; Wed, 5 Jun 2013 08:13:08 +0000 (UTC) (envelope-from das@freebsd.org) Received: from zim.MIT.EDU (50-196-151-174-static.hfc.comcastbusiness.net [50.196.151.174]) by mx1.freebsd.org (Postfix) with ESMTP id D401C1ADE; Wed, 5 Jun 2013 08:13:08 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.7/8.14.2) with ESMTP id r558D1Fv043027; Wed, 5 Jun 2013 01:13:02 -0700 (PDT) (envelope-from das@freebsd.org) Received: (from das@localhost) by zim.MIT.EDU (8.14.7/8.14.2/Submit) id r558D1UI043026; Wed, 5 Jun 2013 01:13:01 -0700 (PDT) (envelope-from das@freebsd.org) Date: Wed, 5 Jun 2013 01:13:01 -0700 From: David Schultz To: Chris Rees Subject: Re: svn commit: r251404 - in head/lib/msun: . src Message-ID: <20130605081301.GA42959@zim.MIT.EDU> References: <201306050533.r555X2dQ047208@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 08:13:09 -0000 On Wed, Jun 05, 2013, Chris Rees wrote: > On 5 Jun 2013 06:33, "David Schultz" wrote: > > > > Author: das > > Date: Wed Jun 5 05:33:01 2013 > > New Revision: 251404 > > URL: http://svnweb.freebsd.org/changeset/base/251404 > > > > Log: > > Style fixes. > > > > Submitted by: bde > > > > Modified: > > head/lib/msun/Makefile > > head/lib/msun/src/catrig.c > > head/lib/msun/src/catrigf.c > > head/lib/msun/src/e_log2.c > > > > Modified: head/lib/msun/Makefile > > > ============================================================================== > > --- head/lib/msun/Makefile Wed Jun 5 01:22:59 2013 (r251403) > > +++ head/lib/msun/Makefile Wed Jun 5 05:33:01 2013 (r251404) > > @@ -21,6 +21,10 @@ ARCH_SUBDIR= ${MACHINE_CPUARCH} > > .include "${ARCH_SUBDIR}/Makefile.inc" > > > > .PATH: ${.CURDIR}/${ARCH_SUBDIR} > > +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" > > +.PATH: ${.CURDIR}/x86 > > +CFLAGS+= -I${.CURDIR}/x86 > > +.endif > > Since you're doing style fixes, it is worth noting that quoting strings in > Makefiles is nearly always incorrect, and only works in our make because of > an extension. Thanks -- I didn't know that, and apparently neither did whoever wrote that line originally. But quoted strings are pervasive in our makefiles; if there's a good reason to fix it, perhaps you could go through and clean them up. :) From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 08:50:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 506669A1; Wed, 5 Jun 2013 08:50:04 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-ie0-x233.google.com (mail-ie0-x233.google.com [IPv6:2607:f8b0:4001:c03::233]) by mx1.freebsd.org (Postfix) with ESMTP id 098741C47; Wed, 5 Jun 2013 08:50:03 +0000 (UTC) Received: by mail-ie0-f179.google.com with SMTP id c13so2917988ieb.24 for ; Wed, 05 Jun 2013 01:50:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iQylUf7GA1r6dcQT0dt39YMgSbHKvUv/abW2oP0DhYM=; b=UkZwRijDTvTYhDE6Aip7yiKrOF3utIP8EyDh47PwajqkavO9/bABAqSrRfeZwDx7Kj SNRfBa8rEHxboiIefXrovFJybdUaf3i8ydYxUqGf9NWIYmNNVybiVIz9or+QqdUEZc1f gdpzAEzHsOKtk5oUFIxWxTblwwsTeM4jwCdEBdqQZ+hrEtBu1lEXzaAQiMNDapUas5Yk gTvCluYXlGoa8qHgUDLY2qDXNlBEn/eJdd5zO+xrYaFupBcf40rWnUhe+zJ69j1jYz/u 9y7wckg2fMaZ8a3bn6PuXJAbMA7o0+WERKwN5DyIkGuvkxl1qMfq4ecEOZyhEHZFbGGL JUMA== MIME-Version: 1.0 X-Received: by 10.50.118.69 with SMTP id kk5mr2684785igb.36.1370422203271; Wed, 05 Jun 2013 01:50:03 -0700 (PDT) Received: by 10.64.71.101 with HTTP; Wed, 5 Jun 2013 01:50:03 -0700 (PDT) Received: by 10.64.71.101 with HTTP; Wed, 5 Jun 2013 01:50:03 -0700 (PDT) In-Reply-To: <20130605081301.GA42959@zim.MIT.EDU> References: <201306050533.r555X2dQ047208@svn.freebsd.org> <20130605081301.GA42959@zim.MIT.EDU> Date: Wed, 5 Jun 2013 09:50:03 +0100 Message-ID: Subject: Re: svn commit: r251404 - in head/lib/msun: . src From: Chris Rees To: David Schultz Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 08:50:04 -0000 On 5 Jun 2013 09:13, "David Schultz" wrote: > > On Wed, Jun 05, 2013, Chris Rees wrote: > > On 5 Jun 2013 06:33, "David Schultz" wrote: > > > > > > Author: das > > > Date: Wed Jun 5 05:33:01 2013 > > > New Revision: 251404 > > > URL: http://svnweb.freebsd.org/changeset/base/251404 > > > > > > Log: > > > Style fixes. > > > > > > Submitted by: bde > > > > > > Modified: > > > head/lib/msun/Makefile > > > head/lib/msun/src/catrig.c > > > head/lib/msun/src/catrigf.c > > > head/lib/msun/src/e_log2.c > > > > > > Modified: head/lib/msun/Makefile > > > > > ============================================================================== > > > --- head/lib/msun/Makefile Wed Jun 5 01:22:59 2013 (r251403) > > > +++ head/lib/msun/Makefile Wed Jun 5 05:33:01 2013 (r251404) > > > @@ -21,6 +21,10 @@ ARCH_SUBDIR= ${MACHINE_CPUARCH} > > > .include "${ARCH_SUBDIR}/Makefile.inc" > > > > > > .PATH: ${.CURDIR}/${ARCH_SUBDIR} > > > +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" > > > +.PATH: ${.CURDIR}/x86 > > > +CFLAGS+= -I${.CURDIR}/x86 > > > +.endif > > > > Since you're doing style fixes, it is worth noting that quoting strings in > > Makefiles is nearly always incorrect, and only works in our make because of > > an extension. > > Thanks -- I didn't know that, and apparently neither did whoever > wrote that line originally. But quoted strings are pervasive in > our makefiles; if there's a good reason to fix it, perhaps you > could go through and clean them up. :) I've thought about this, but really that kind of fix is repo churn. I'll see if I can find somewhere appropriate to document it; the only real harm is that people using other makes are constantly surprised when things like ifeq($(ARCH),"amd64") never match. Obviously this isn't directly our problem, but it's a nice portability concern. Chris From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 09:46:57 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8F6CA830; Wed, 5 Jun 2013 09:46:57 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 994851E7D; Wed, 5 Jun 2013 09:46:56 +0000 (UTC) Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 42865D40EE2; Wed, 5 Jun 2013 19:46:48 +1000 (EST) Date: Wed, 5 Jun 2013 19:46:47 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Chris Rees Subject: Re: svn commit: r251404 - in head/lib/msun: . src In-Reply-To: Message-ID: <20130605190925.X1394@besplex.bde.org> References: <201306050533.r555X2dQ047208@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=e/de0tV/ c=1 sm=1 a=R6bvxTt4exwA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=rZKycl_GVckA:10 a=6I5d2MoRAAAA:8 a=gPIDfWKbdn5japZPCskA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=bGgsVW87oxRvdTD6:21 a=LmhdNDzX00al9zQ-:21 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 Cc: svn-src-head@FreeBSD.org, David Schultz , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 09:46:57 -0000 On Wed, 5 Jun 2013, Chris Rees wrote: > On 5 Jun 2013 06:33, "David Schultz" wrote: >> ... >> Log: >> Style fixes. >> >> Submitted by: bde >> ... > ============================================================================== >> --- head/lib/msun/Makefile Wed Jun 5 01:22:59 2013 (r251403) >> +++ head/lib/msun/Makefile Wed Jun 5 05:33:01 2013 (r251404) >> @@ -21,6 +21,10 @@ ARCH_SUBDIR= ${MACHINE_CPUARCH} >> .include "${ARCH_SUBDIR}/Makefile.inc" >> >> .PATH: ${.CURDIR}/${ARCH_SUBDIR} >> +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" >> +.PATH: ${.CURDIR}/x86 >> +CFLAGS+= -I${.CURDIR}/x86 >> +.endif > > Since you're doing style fixes, it is worth noting that quoting strings in > Makefiles is nearly always incorrect, and only works in our make because of > an extension. Ugh. make's tutorial even says that strings are required in both of the above contexts (for .include "file" and for strings in comparison operations). From /usr/share/doc/psd/12.make: @ added ability to use variables in the filenames. An include @ directive in a makefile looks either like this: @ @ #include @ @ or this @ @ #include "file" @ @ The difference between the two is where PMake searches for @ the file: the first way, PMake will look for the file only @ ... @ The arithmetic and string operators may only be used to test @ the value of a variable. The lefthand side must contain the @ variable expansion, while the righthand side contains either @ a string, enclosed in double-quotes, or a number. The stan- @ dard C numeric conventions (except for specifying an octal @ number) apply to both sides. E.g. @ @ #if $(OS) == 4.3 @ @ #if $(MACHINE) == "sun3" @ @ #if $(LOAD_ADDR) < 0xc000 @ @ are all valid conditionals. In addition, the numeric value @ of a variable can be tested as a boolean as follows: The tutorial doesn't seem to have been updated for the new make (or the old make). bmake duplicates the ~20-year old source file except for about 20 lines of trivial changes, but doesn't seem to build or install its version. I tried building a target named "foo bar". It failed completely. >> # long double format >> .if ${LDBL_PREC} == 64 >> @@ -35,10 +39,6 @@ CFLAGS+= -I${.CURDIR}/ld128 >> .PATH: ${.CURDIR}/src >> .PATH: ${.CURDIR}/man >> >> -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" >> -.PATH: ${.CURDIR}/x86 >> -.endif >> - >> LIB= m >> SHLIBDIR?= /lib >> SHLIB_MAJOR= 5 It is also worth noting that this part is not (primarily) a style fix. It is to add a -I path to unbreak the use of the uninstalled fenv.h. There are still many old and new style bugs in the choice of vs "fenv.h" in include directives. >> [800+ quoted lines deleted] Please don't quote the whole thing. > ============================================================================== >> --- head/lib/msun/src/e_log2.c Wed Jun 5 01:22:59 2013 (r251403) >> +++ head/lib/msun/src/e_log2.c Wed Jun 5 05:33:01 2013 (r251404) >> @@ -24,6 +24,8 @@ __FBSDID("$FreeBSD$"); >> * in not-quite-routine extra precision. >> */ >> >> +#include >> + >> #include "math.h" >> #include "math_private.h" >> #include "k_log.h" Since you quoted so much, it is worth noting that this isn't a style fix. It fixes (implements) log2l() on arches where long double is the same as double. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 09:48:13 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F2FE89B6; Wed, 5 Jun 2013 09:48:12 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CB06D1E8C; Wed, 5 Jun 2013 09:48:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r559mCBL026868; Wed, 5 Jun 2013 09:48:12 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r559mCfj026867; Wed, 5 Jun 2013 09:48:12 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306050948.r559mCfj026867@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 09:48:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251406 - stable/9/sys/dev/mfi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 09:48:13 -0000 Author: smh Date: Wed Jun 5 09:48:12 2013 New Revision: 251406 URL: http://svnweb.freebsd.org/changeset/base/251406 Log: MFC r247426: Add hw.mfi.cmd_timeout loader / sysctl tuneable. Modified: stable/9/sys/dev/mfi/mfi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mfi/mfi.c ============================================================================== --- stable/9/sys/dev/mfi/mfi.c Wed Jun 5 07:37:45 2013 (r251405) +++ stable/9/sys/dev/mfi/mfi.c Wed Jun 5 09:48:12 2013 (r251406) @@ -157,6 +157,11 @@ SYSCTL_INT(_hw_mfi, OID_AUTO, polled_cmd &mfi_polled_cmd_timeout, 0, "Polled command timeout - used for firmware flash etc (in seconds)"); +static int mfi_cmd_timeout = MFI_CMD_TIMEOUT; +TUNABLE_INT("hw.mfi.cmd_timeout", &mfi_cmd_timeout); +SYSCTL_INT(_hw_mfi, OID_AUTO, cmd_timeout, CTLFLAG_RWTUN, &mfi_cmd_timeout, + 0, "Command timeout (in seconds)"); + /* Management interface */ static d_open_t mfi_open; static d_close_t mfi_close; @@ -782,7 +787,7 @@ mfi_attach(struct mfi_softc *sc) /* Start the timeout watchdog */ callout_init(&sc->mfi_watchdog_callout, CALLOUT_MPSAFE); - callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, + callout_reset(&sc->mfi_watchdog_callout, mfi_cmd_timeout * hz, mfi_timeout, sc); if (sc->mfi_flags & MFI_FLAGS_TBOLT) { @@ -3703,7 +3708,7 @@ mfi_dump_all(void) break; device_printf(sc->mfi_dev, "Dumping\n\n"); timedout = 0; - deadline = time_uptime - MFI_CMD_TIMEOUT; + deadline = time_uptime - mfi_cmd_timeout; mtx_lock(&sc->mfi_io_lock); TAILQ_FOREACH(cm, &sc->mfi_busy, cm_link) { if (cm->cm_timestamp <= deadline) { @@ -3734,10 +3739,11 @@ mfi_timeout(void *data) time_t deadline; int timedout = 0; - deadline = time_uptime - MFI_CMD_TIMEOUT; + deadline = time_uptime - mfi_cmd_timeout; if (sc->adpreset == 0) { if (!mfi_tbolt_reset(sc)) { - callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, mfi_timeout, sc); + callout_reset(&sc->mfi_watchdog_callout, + mfi_cmd_timeout * hz, mfi_timeout, sc); return; } } @@ -3774,7 +3780,7 @@ mfi_timeout(void *data) mtx_unlock(&sc->mfi_io_lock); - callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, + callout_reset(&sc->mfi_watchdog_callout, mfi_cmd_timeout * hz, mfi_timeout, sc); if (0) From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 10:02:55 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D14C2DEE; Wed, 5 Jun 2013 10:02:55 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-ea0-x236.google.com (mail-ea0-x236.google.com [IPv6:2a00:1450:4013:c01::236]) by mx1.freebsd.org (Postfix) with ESMTP id E5E871F2E; Wed, 5 Jun 2013 10:02:54 +0000 (UTC) Received: by mail-ea0-f182.google.com with SMTP id r16so992903ead.13 for ; Wed, 05 Jun 2013 03:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=2C7hSRjVwx8lEj8BLg243qii04WB9v+2+8C3oNh51Bk=; b=MaLr7wZkry8x5SFiBqZf99kqdj4sZHGS/waoUjDaVMApUAdn32Tq0M18m9e+IfHUz7 5KwM5ij+mlEaKbGma6GEhi6sRBqiYU1sduUJJRn9HlqjGyPs9P1izng4cZTUCTbdQICx OrQ+8xysOFvZD9eLrUTAa5mn5Ld2MHljHA2uayiUJMuGltYPytmO1alZAxvYWBVI+5Tb 43DeA/se+nQ9BSiW3wjlhClZjeYSCb5xqSzbvccZZg+8WFzOubNxhzn2NwAu8ENmMXjx phmkAePrlTiD3wzGji6ScdhiEHelNpFnETkS3K/l5YMnoQFy7cEQ5xlYMR1PWO7pG+sQ WIxA== MIME-Version: 1.0 X-Received: by 10.14.203.7 with SMTP id e7mr10698471eeo.118.1370426574073; Wed, 05 Jun 2013 03:02:54 -0700 (PDT) Received: by 10.15.23.76 with HTTP; Wed, 5 Jun 2013 03:02:53 -0700 (PDT) Received: by 10.15.23.76 with HTTP; Wed, 5 Jun 2013 03:02:53 -0700 (PDT) In-Reply-To: <20130605190925.X1394@besplex.bde.org> References: <201306050533.r555X2dQ047208@svn.freebsd.org> <20130605190925.X1394@besplex.bde.org> Date: Wed, 5 Jun 2013 11:02:53 +0100 Message-ID: Subject: Re: svn commit: r251404 - in head/lib/msun: . src From: Chris Rees To: Bruce Evans Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Schultz X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 10:02:55 -0000 On 5 Jun 2013 10:46, "Bruce Evans" wrote: > > On Wed, 5 Jun 2013, Chris Rees wrote: > >> On 5 Jun 2013 06:33, "David Schultz" wrote: >>> >>> ... >>> >>> Log: >>> Style fixes. >>> >>> Submitted by: bde >>> ... >> >> ============================================================================== >>> >>> --- head/lib/msun/Makefile Wed Jun 5 01:22:59 2013 (r251403) >>> +++ head/lib/msun/Makefile Wed Jun 5 05:33:01 2013 (r251404) >>> @@ -21,6 +21,10 @@ ARCH_SUBDIR= ${MACHINE_CPUARCH} >>> .include "${ARCH_SUBDIR}/Makefile.inc" >>> >>> .PATH: ${.CURDIR}/${ARCH_SUBDIR} >>> +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" >>> +.PATH: ${.CURDIR}/x86 >>> +CFLAGS+= -I${.CURDIR}/x86 >>> +.endif >> >> >> Since you're doing style fixes, it is worth noting that quoting strings in >> Makefiles is nearly always incorrect, and only works in our make because of >> an extension. > > > Ugh. make's tutorial even says that strings are required in both of the > above contexts (for .include "file" and for strings in comparison > operations). From /usr/share/doc/psd/12.make: > > @ added ability to use variables in the filenames. An include > @ directive in a makefile looks either like this: > @ @ #include > @ @ or this > @ @ #include "file" > @ @ The difference between the two is where PMake searches for > @ the file: the first way, PMake will look for the file only > @ ... > @ The arithmetic and string operators may only be used to test > @ the value of a variable. The lefthand side must contain the > @ variable expansion, while the righthand side contains either > @ a string, enclosed in double-quotes, or a number. The stan- > @ dard C numeric conventions (except for specifying an octal > @ number) apply to both sides. E.g. > @ @ #if $(OS) == 4.3 > @ @ #if $(MACHINE) == "sun3" > @ @ #if $(LOAD_ADDR) < 0xc000 > @ @ are all valid conditionals. In addition, the numeric value > @ of a variable can be tested as a boolean as follows: > > The tutorial doesn't seem to have been updated for the new make (or > the old make). bmake duplicates the ~20-year old source file except > for about 20 lines of trivial changes, but doesn't seem to build or > install its version. > > I tried building a target named "foo bar". It failed completely. Very little in that guide is at all relevant or correct. Perhaps when it was first written.... It shows some interesting historical notes on the difference between ${} and $(), which is also now wrong. Following quoting rules because of an out of date tutorial and thus diverging from the rest of the world seems a little odd. I can't work out whether you agree or disagree with me from your comment :) Chris From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 10:19:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B8E504BC; Wed, 5 Jun 2013 10:19:21 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 928331FDD; Wed, 5 Jun 2013 10:19:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55AJLwD036785; Wed, 5 Jun 2013 10:19:21 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55AJLLV036784; Wed, 5 Jun 2013 10:19:21 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051019.r55AJLLV036784@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 10:19:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251407 - stable/8/sys/dev/mfi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 10:19:21 -0000 Author: smh Date: Wed Jun 5 10:19:21 2013 New Revision: 251407 URL: http://svnweb.freebsd.org/changeset/base/251407 Log: MFC r247426: Add hw.mfi.cmd_timeout loader / sysctl tuneable. Modified: stable/8/sys/dev/mfi/mfi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mfi/ (props changed) Modified: stable/8/sys/dev/mfi/mfi.c ============================================================================== --- stable/8/sys/dev/mfi/mfi.c Wed Jun 5 09:48:12 2013 (r251406) +++ stable/8/sys/dev/mfi/mfi.c Wed Jun 5 10:19:21 2013 (r251407) @@ -157,6 +157,11 @@ SYSCTL_INT(_hw_mfi, OID_AUTO, polled_cmd &mfi_polled_cmd_timeout, 0, "Polled command timeout - used for firmware flash etc (in seconds)"); +static int mfi_cmd_timeout = MFI_CMD_TIMEOUT; +TUNABLE_INT("hw.mfi.cmd_timeout", &mfi_cmd_timeout); +SYSCTL_INT(_hw_mfi, OID_AUTO, cmd_timeout, CTLFLAG_RWTUN, &mfi_cmd_timeout, + 0, "Command timeout (in seconds)"); + /* Management interface */ static d_open_t mfi_open; static d_close_t mfi_close; @@ -782,7 +787,7 @@ mfi_attach(struct mfi_softc *sc) /* Start the timeout watchdog */ callout_init(&sc->mfi_watchdog_callout, CALLOUT_MPSAFE); - callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, + callout_reset(&sc->mfi_watchdog_callout, mfi_cmd_timeout * hz, mfi_timeout, sc); if (sc->mfi_flags & MFI_FLAGS_TBOLT) { @@ -3703,7 +3708,7 @@ mfi_dump_all(void) break; device_printf(sc->mfi_dev, "Dumping\n\n"); timedout = 0; - deadline = time_uptime - MFI_CMD_TIMEOUT; + deadline = time_uptime - mfi_cmd_timeout; mtx_lock(&sc->mfi_io_lock); TAILQ_FOREACH(cm, &sc->mfi_busy, cm_link) { if (cm->cm_timestamp <= deadline) { @@ -3734,10 +3739,11 @@ mfi_timeout(void *data) time_t deadline; int timedout = 0; - deadline = time_uptime - MFI_CMD_TIMEOUT; + deadline = time_uptime - mfi_cmd_timeout; if (sc->adpreset == 0) { if (!mfi_tbolt_reset(sc)) { - callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, mfi_timeout, sc); + callout_reset(&sc->mfi_watchdog_callout, + mfi_cmd_timeout * hz, mfi_timeout, sc); return; } } @@ -3774,7 +3780,7 @@ mfi_timeout(void *data) mtx_unlock(&sc->mfi_io_lock); - callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz, + callout_reset(&sc->mfi_watchdog_callout, mfi_cmd_timeout * hz, mfi_timeout, sc); if (0) From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 10:37:28 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 73482AA4; Wed, 5 Jun 2013 10:37:28 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 64D641074; Wed, 5 Jun 2013 10:37:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55AbSnZ043008; Wed, 5 Jun 2013 10:37:28 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55AbSDJ043007; Wed, 5 Jun 2013 10:37:28 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051037.r55AbSDJ043007@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 10:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251408 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 10:37:28 -0000 Author: smh Date: Wed Jun 5 10:37:27 2013 New Revision: 251408 URL: http://svnweb.freebsd.org/changeset/base/251408 Log: MFC r248579: Add missing descriptions for ZFS sysctls Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jun 5 10:19:21 2013 (r251407) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jun 5 10:37:27 2013 (r251408) @@ -77,10 +77,11 @@ SYSCTL_QUAD(_vfs_zfs, OID_AUTO, write_li &zfs_write_limit_max, 0, "Maximum data payload per txg"); TUNABLE_QUAD("vfs.zfs.write_limit_inflated", &zfs_write_limit_inflated); SYSCTL_QUAD(_vfs_zfs, OID_AUTO, write_limit_inflated, CTLFLAG_RDTUN, - &zfs_write_limit_inflated, 0, ""); + &zfs_write_limit_inflated, 0, "Maximum size of the dynamic write limit"); TUNABLE_QUAD("vfs.zfs.write_limit_override", &zfs_write_limit_override); SYSCTL_QUAD(_vfs_zfs, OID_AUTO, write_limit_override, CTLFLAG_RDTUN, - &zfs_write_limit_override, 0, ""); + &zfs_write_limit_override, 0, + "Force a txg if dirty buffers exceed this value (bytes)"); int dsl_pool_open_special_dir(dsl_pool_t *dp, const char *name, dsl_dir_t **ddp) From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 10:53:28 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B34B2EFA; Wed, 5 Jun 2013 10:53:28 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A58D410F3; Wed, 5 Jun 2013 10:53:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55ArRWx048675; Wed, 5 Jun 2013 10:53:27 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55ArRdL048674; Wed, 5 Jun 2013 10:53:27 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051053.r55ArRdL048674@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 10:53:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251409 - stable/8/sys/dev/mps X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 10:53:28 -0000 Author: smh Date: Wed Jun 5 10:53:27 2013 New Revision: 251409 URL: http://svnweb.freebsd.org/changeset/base/251409 Log: MFC r250206: Fix uninitialized warning in mps Modified: stable/8/sys/dev/mps/mps_mapping.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mps/ (props changed) Modified: stable/8/sys/dev/mps/mps_mapping.c ============================================================================== --- stable/8/sys/dev/mps/mps_mapping.c Wed Jun 5 10:37:27 2013 (r251408) +++ stable/8/sys/dev/mps/mps_mapping.c Wed Jun 5 10:53:27 2013 (r251409) @@ -331,6 +331,8 @@ _mapping_get_high_missing_mt_idx(struct u16 ioc_pg8_flags = le16toh(sc->ioc_pg8.Flags); start_idx = 0; + start_idx_ir = 0; + end_idx_ir = 0; end_idx = sc->max_devices; if (ioc_pg8_flags & MPI2_IOCPAGE8_FLAGS_RESERVED_TARGETID_0) start_idx = 1; From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 10:59:53 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8D960148; Wed, 5 Jun 2013 10:59:53 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 91C741128; Wed, 5 Jun 2013 10:59:52 +0000 (UTC) Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 2A22E3C1978; Wed, 5 Jun 2013 20:59:43 +1000 (EST) Date: Wed, 5 Jun 2013 20:59:42 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Chris Rees Subject: Re: svn commit: r251404 - in head/lib/msun: . src In-Reply-To: Message-ID: <20130605204519.S1701@besplex.bde.org> References: <201306050533.r555X2dQ047208@svn.freebsd.org> <20130605190925.X1394@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=BPvrNysG c=1 sm=1 a=R6bvxTt4exwA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=rZKycl_GVckA:10 a=6I5d2MoRAAAA:8 a=mq1bVjIXCb4gxXLZoPkA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=qOw1DmAu_wDzwlqJ:21 a=19xsBIcHXRGJrv1f:21 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Schultz , Bruce Evans X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 10:59:53 -0000 On Wed, 5 Jun 2013, Chris Rees wrote: > On 5 Jun 2013 10:46, "Bruce Evans" wrote: >> >> On Wed, 5 Jun 2013, Chris Rees wrote: >> >>> On 5 Jun 2013 06:33, "David Schultz" wrote: >>>> >>>> ... >>>> >>>> Log: >>>> Style fixes. >>>> >>>> Submitted by: bde >>>> ... >>> >>> > ============================================================================== >>>> >>>> --- head/lib/msun/Makefile Wed Jun 5 01:22:59 2013 > (r251403) >>>> +++ head/lib/msun/Makefile Wed Jun 5 05:33:01 2013 > (r251404) >>>> @@ -21,6 +21,10 @@ ARCH_SUBDIR= ${MACHINE_CPUARCH} >>>> .include "${ARCH_SUBDIR}/Makefile.inc" >>>> >>>> .PATH: ${.CURDIR}/${ARCH_SUBDIR} >>>> +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" >>>> +.PATH: ${.CURDIR}/x86 >>>> +CFLAGS+= -I${.CURDIR}/x86 >>>> +.endif >>> >>> >>> Since you're doing style fixes, it is worth noting that quoting strings > in >>> Makefiles is nearly always incorrect, and only works in our make because > of >>> an extension. >> >> >> Ugh. make's tutorial even says that strings are required in both of the >> above contexts (for .include "file" and for strings in comparison >> operations). From /usr/share/doc/psd/12.make: >> >> @ added ability to use variables in the filenames. An include >> @ directive in a makefile looks either like this: >> @ @ #include >> @ @ or this >> @ @ #include "file" >> @ @ The difference between the two is where PMake searches for >> @ the file: the first way, PMake will look for the file only >> @ ... >> @ The arithmetic and string operators may only be used to test >> @ the value of a variable. The lefthand side must contain the >> @ variable expansion, while the righthand side contains either >> @ a string, enclosed in double-quotes, or a number. The stan- >> @ dard C numeric conventions (except for specifying an octal >> @ number) apply to both sides. E.g. >> @ @ #if $(OS) == 4.3 >> @ @ #if $(MACHINE) == "sun3" >> @ @ #if $(LOAD_ADDR) < 0xc000 >> @ @ are all valid conditionals. In addition, the numeric value >> @ of a variable can be tested as a boolean as follows: >> >> The tutorial doesn't seem to have been updated for the new make (or >> the old make). bmake duplicates the ~20-year old source file except >> for about 20 lines of trivial changes, but doesn't seem to build or >> install its version. >> >> I tried building a target named "foo bar". It failed completely. > > Very little in that guide is at all relevant or correct. Perhaps when it > was first written.... It shows some interesting historical notes on the > difference between ${} and $(), which is also now wrong. > > Following quoting rules because of an out of date tutorial and thus > diverging from the rest of the world seems a little odd. > > I can't work out whether you agree or disagree with me from your comment :) Quoted strings are necessary for file names with spaces, and good for documenting the type of other things, and BSD make had them in 1993 (1983?). Perhaps it is time the rest of the world supported them? The result of the world needs them more than BSD, since it has mores spaces in file names. But quoting single identifiers like i386 don't seems to be just a style thing. The style in the tutorial seems to be almost always followed for machine names. I reminded someone to fix the other style bug(s) in the line moved but not changed above. The machine names are unsorted. I thought that this was the only one. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 11:16:18 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6CD0248C; Wed, 5 Jun 2013 11:16:18 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D5E211A2; Wed, 5 Jun 2013 11:16:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55BGIiF055811; Wed, 5 Jun 2013 11:16:18 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55BGIUX055810; Wed, 5 Jun 2013 11:16:18 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051116.r55BGIUX055810@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 11:16:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251410 - stable/8/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 11:16:18 -0000 Author: smh Date: Wed Jun 5 11:16:17 2013 New Revision: 251410 URL: http://svnweb.freebsd.org/changeset/base/251410 Log: MFC r245479: Report pools which have a removed l2cache disk under zpool status -x Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Wed Jun 5 10:53:27 2013 (r251409) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Wed Jun 5 11:16:17 2013 (r251410) @@ -150,6 +150,16 @@ find_vdev_problem(nvlist_t *vdev, int (* return (B_TRUE); } + /* + * Check any L2 cache devs + */ + if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_L2CACHE, &child, + &children) == 0) { + for (c = 0; c < children; c++) + if (find_vdev_problem(child[c], func)) + return (B_TRUE); + } + return (B_FALSE); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 11:23:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4FFC4AF3; Wed, 5 Jun 2013 11:23:11 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4178711FF; Wed, 5 Jun 2013 11:23:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55BNBmV058907; Wed, 5 Jun 2013 11:23:11 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55BNBNO058906; Wed, 5 Jun 2013 11:23:11 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051123.r55BNBNO058906@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 11:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251411 - stable/8/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 11:23:11 -0000 Author: smh Date: Wed Jun 5 11:23:10 2013 New Revision: 251411 URL: http://svnweb.freebsd.org/changeset/base/251411 Log: MFC r244194: Fixe zfs receive errors caused by snapshot replication being processed in random order. PR: kern/172259 Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Jun 5 11:16:17 2013 (r251410) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Jun 5 11:23:10 2013 (r251411) @@ -727,7 +727,7 @@ send_iterate_fs(zfs_handle_t *zhp, void sd->parent_fromsnap_guid = 0; VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0)); VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0)); - (void) zfs_iter_snapshots(zhp, B_FALSE, send_iterate_snap, sd); + (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd); VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps)); VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops)); nvlist_free(sd->parent_snaps); @@ -1945,11 +1945,12 @@ recv_incremental_replication(libzfs_hand recvflags_t *flags, nvlist_t *stream_nv, avl_tree_t *stream_avl, nvlist_t *renamed) { - nvlist_t *local_nv; + nvlist_t *local_nv, *deleted = NULL; avl_tree_t *local_avl; nvpair_t *fselem, *nextfselem; char *fromsnap; char newname[ZFS_MAXNAMELEN]; + char guidname[32]; int error; boolean_t needagain, progress, recursive; char *s1, *s2; @@ -1965,6 +1966,8 @@ recv_incremental_replication(libzfs_hand again: needagain = progress = B_FALSE; + VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); + if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, recursive, &local_nv, &local_avl)) != 0) return (error); @@ -2079,6 +2082,8 @@ again: needagain = B_TRUE; else progress = B_TRUE; + sprintf(guidname, "%lu", thisguid); + nvlist_add_boolean(deleted, guidname); continue; } @@ -2134,6 +2139,8 @@ again: needagain = B_TRUE; else progress = B_TRUE; + sprintf(guidname, "%lu", parent_fromsnap_guid); + nvlist_add_boolean(deleted, guidname); continue; } @@ -2156,6 +2163,24 @@ again: s2 = strrchr(stream_fsname, '/'); /* + * Check if we're going to rename based on parent guid change + * and the current parent guid was also deleted. If it was then + * rename will fail and is likely unneeded, so avoid this and + * force an early retry to determine the new + * parent_fromsnap_guid. + */ + if (stream_parent_fromsnap_guid != 0 && + parent_fromsnap_guid != 0 && + stream_parent_fromsnap_guid != parent_fromsnap_guid) { + sprintf(guidname, "%lu", parent_fromsnap_guid); + if (nvlist_exists(deleted, guidname)) { + progress = B_TRUE; + needagain = B_TRUE; + goto doagain; + } + } + + /* * Check for rename. If the exact receive path is specified, it * does not count as a rename, but we still need to check the * datasets beneath it. @@ -2209,8 +2234,10 @@ again: } } +doagain: fsavl_destroy(local_avl); nvlist_free(local_nv); + nvlist_free(deleted); if (needagain && progress) { /* do another pass to fix up temporary names */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 11:28:56 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5DD77CBE; Wed, 5 Jun 2013 11:28:56 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 503AF1230; Wed, 5 Jun 2013 11:28:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55BSuut059727; Wed, 5 Jun 2013 11:28:56 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55BStjP059723; Wed, 5 Jun 2013 11:28:55 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051128.r55BStjP059723@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 11:28:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251412 - stable/8/lib/libc/gen X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 11:28:56 -0000 Author: smh Date: Wed Jun 5 11:28:55 2013 New Revision: 251412 URL: http://svnweb.freebsd.org/changeset/base/251412 Log: MFC r219696: Add ZFS to UFS-like file systems. Modified: stable/8/lib/libc/gen/fts-compat.c stable/8/lib/libc/gen/fts.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/gen/fts-compat.c ============================================================================== --- stable/8/lib/libc/gen/fts-compat.c Wed Jun 5 11:23:10 2013 (r251411) +++ stable/8/lib/libc/gen/fts-compat.c Wed Jun 5 11:28:55 2013 (r251412) @@ -110,6 +110,7 @@ struct _fts_private { static const char *ufslike_filesystems[] = { "ufs", + "zfs", "nfs", "nfs4", "ext2fs", Modified: stable/8/lib/libc/gen/fts.c ============================================================================== --- stable/8/lib/libc/gen/fts.c Wed Jun 5 11:23:10 2013 (r251411) +++ stable/8/lib/libc/gen/fts.c Wed Jun 5 11:28:55 2013 (r251412) @@ -100,6 +100,7 @@ struct _fts_private { static const char *ufslike_filesystems[] = { "ufs", + "zfs", "nfs", "nfs4", "ext2fs", From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 11:37:01 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 35F3BE90; Wed, 5 Jun 2013 11:37:01 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 28B5E1268; Wed, 5 Jun 2013 11:37:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55Bb1pu062532; Wed, 5 Jun 2013 11:37:01 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55Bb16b062531; Wed, 5 Jun 2013 11:37:01 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051137.r55Bb16b062531@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 11:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251413 - stable/8/etc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 11:37:01 -0000 Author: smh Date: Wed Jun 5 11:37:00 2013 New Revision: 251413 URL: http://svnweb.freebsd.org/changeset/base/251413 Log: MFC r245250: Allow perl scripts to be used in rc.d scripts Modified: stable/8/etc/rc.subr Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc.subr ============================================================================== --- stable/8/etc/rc.subr Wed Jun 5 11:28:55 2013 (r251412) +++ stable/8/etc/rc.subr Wed Jun 5 11:37:00 2013 (r251413) @@ -331,7 +331,7 @@ _find_processes() _interpbn=${1##*/} _fp_args='_argv' _fp_match='case "$_argv" in - ${_interp}|"${_interp} "*|"${_interpbn}: ${_procname}"*)' + ${_interp}|"${_interp} "*|"[${_interpbn}]"|"${_interpbn}: ${_procname}"*)' else # a normal daemon _procnamebn=${_procname##*/} _fp_args='_arg0 _argv' From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 11:39:22 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 94BC97B; Wed, 5 Jun 2013 11:39:22 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 85BA7127A; Wed, 5 Jun 2013 11:39:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55BdMUm062879; Wed, 5 Jun 2013 11:39:22 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55BdMPO062878; Wed, 5 Jun 2013 11:39:22 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051139.r55BdMPO062878@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 11:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251414 - stable/9/sys/dev/mps X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 11:39:22 -0000 Author: smh Date: Wed Jun 5 11:39:22 2013 New Revision: 251414 URL: http://svnweb.freebsd.org/changeset/base/251414 Log: MFC r250206: Fix uninitialized warning in mps Modified: stable/9/sys/dev/mps/mps_mapping.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mps/mps_mapping.c ============================================================================== --- stable/9/sys/dev/mps/mps_mapping.c Wed Jun 5 11:37:00 2013 (r251413) +++ stable/9/sys/dev/mps/mps_mapping.c Wed Jun 5 11:39:22 2013 (r251414) @@ -331,6 +331,8 @@ _mapping_get_high_missing_mt_idx(struct u16 ioc_pg8_flags = le16toh(sc->ioc_pg8.Flags); start_idx = 0; + start_idx_ir = 0; + end_idx_ir = 0; end_idx = sc->max_devices; if (ioc_pg8_flags & MPI2_IOCPAGE8_FLAGS_RESERVED_TARGETID_0) start_idx = 1; From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 11:42:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 618FC253; Wed, 5 Jun 2013 11:42:04 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 51FD3129F; Wed, 5 Jun 2013 11:42:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55Bg4XT064912; Wed, 5 Jun 2013 11:42:04 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55Bg4cP064911; Wed, 5 Jun 2013 11:42:04 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051142.r55Bg4cP064911@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 11:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251415 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 11:42:04 -0000 Author: smh Date: Wed Jun 5 11:42:03 2013 New Revision: 251415 URL: http://svnweb.freebsd.org/changeset/base/251415 Log: MFC r248579: Add missing descriptions for ZFS sysctls Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jun 5 11:39:22 2013 (r251414) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Wed Jun 5 11:42:03 2013 (r251415) @@ -78,10 +78,11 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_l &zfs_write_limit_max, 0, "Maximum data payload per txg"); TUNABLE_QUAD("vfs.zfs.write_limit_inflated", &zfs_write_limit_inflated); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_inflated, CTLFLAG_RDTUN, - &zfs_write_limit_inflated, 0, ""); + &zfs_write_limit_inflated, 0, "Maximum size of the dynamic write limit"); TUNABLE_QUAD("vfs.zfs.write_limit_override", &zfs_write_limit_override); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_override, CTLFLAG_RDTUN, - &zfs_write_limit_override, 0, ""); + &zfs_write_limit_override, 0, + "Force a txg if dirty buffers exceed this value (bytes)"); int dsl_pool_open_special_dir(dsl_pool_t *dp, const char *name, dsl_dir_t **ddp) From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 11:46:43 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DFA3D4EA; Wed, 5 Jun 2013 11:46:43 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D1F7512CA; Wed, 5 Jun 2013 11:46:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55Bkhjr065717; Wed, 5 Jun 2013 11:46:43 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55BkhlT065716; Wed, 5 Jun 2013 11:46:43 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051146.r55BkhlT065716@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 11:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251416 - stable/9/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 11:46:44 -0000 Author: smh Date: Wed Jun 5 11:46:43 2013 New Revision: 251416 URL: http://svnweb.freebsd.org/changeset/base/251416 Log: MFC r245479: Report pools which have a removed l2cache disk under zpool status -x Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Wed Jun 5 11:42:03 2013 (r251415) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Wed Jun 5 11:46:43 2013 (r251416) @@ -150,6 +150,16 @@ find_vdev_problem(nvlist_t *vdev, int (* return (B_TRUE); } + /* + * Check any L2 cache devs + */ + if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_L2CACHE, &child, + &children) == 0) { + for (c = 0; c < children; c++) + if (find_vdev_problem(child[c], func)) + return (B_TRUE); + } + return (B_FALSE); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 11:55:35 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D99C999C; Wed, 5 Jun 2013 11:55:35 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CB82B1318; Wed, 5 Jun 2013 11:55:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55BtZUa068871; Wed, 5 Jun 2013 11:55:35 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55BtZwt068870; Wed, 5 Jun 2013 11:55:35 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051155.r55BtZwt068870@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 11:55:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251417 - stable/9/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 11:55:35 -0000 Author: smh Date: Wed Jun 5 11:55:35 2013 New Revision: 251417 URL: http://svnweb.freebsd.org/changeset/base/251417 Log: MFC r244194: Fix zfs receive errors caused by snapshot replication being processed in random order. PR: kern/172259 Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Jun 5 11:46:43 2013 (r251416) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Jun 5 11:55:35 2013 (r251417) @@ -731,7 +731,7 @@ send_iterate_fs(zfs_handle_t *zhp, void sd->parent_fromsnap_guid = 0; VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0)); VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0)); - (void) zfs_iter_snapshots(zhp, B_FALSE, send_iterate_snap, sd); + (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd); VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps)); VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops)); nvlist_free(sd->parent_snaps); @@ -1946,11 +1946,12 @@ recv_incremental_replication(libzfs_hand recvflags_t *flags, nvlist_t *stream_nv, avl_tree_t *stream_avl, nvlist_t *renamed) { - nvlist_t *local_nv; + nvlist_t *local_nv, *deleted = NULL; avl_tree_t *local_avl; nvpair_t *fselem, *nextfselem; char *fromsnap; char newname[ZFS_MAXNAMELEN]; + char guidname[32]; int error; boolean_t needagain, progress, recursive; char *s1, *s2; @@ -1966,6 +1967,8 @@ recv_incremental_replication(libzfs_hand again: needagain = progress = B_FALSE; + VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); + if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, recursive, &local_nv, &local_avl)) != 0) return (error); @@ -2080,6 +2083,8 @@ again: needagain = B_TRUE; else progress = B_TRUE; + sprintf(guidname, "%lu", thisguid); + nvlist_add_boolean(deleted, guidname); continue; } @@ -2135,6 +2140,8 @@ again: needagain = B_TRUE; else progress = B_TRUE; + sprintf(guidname, "%lu", parent_fromsnap_guid); + nvlist_add_boolean(deleted, guidname); continue; } @@ -2157,6 +2164,24 @@ again: s2 = strrchr(stream_fsname, '/'); /* + * Check if we're going to rename based on parent guid change + * and the current parent guid was also deleted. If it was then + * rename will fail and is likely unneeded, so avoid this and + * force an early retry to determine the new + * parent_fromsnap_guid. + */ + if (stream_parent_fromsnap_guid != 0 && + parent_fromsnap_guid != 0 && + stream_parent_fromsnap_guid != parent_fromsnap_guid) { + sprintf(guidname, "%lu", parent_fromsnap_guid); + if (nvlist_exists(deleted, guidname)) { + progress = B_TRUE; + needagain = B_TRUE; + goto doagain; + } + } + + /* * Check for rename. If the exact receive path is specified, it * does not count as a rename, but we still need to check the * datasets beneath it. @@ -2210,8 +2235,10 @@ again: } } +doagain: fsavl_destroy(local_avl); nvlist_free(local_nv); + nvlist_free(deleted); if (needagain && progress) { /* do another pass to fix up temporary names */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 11:59:36 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8D41EB4D; Wed, 5 Jun 2013 11:59:36 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7EB8D1333; Wed, 5 Jun 2013 11:59:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55Bxaav069436; Wed, 5 Jun 2013 11:59:36 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55BxaOu069435; Wed, 5 Jun 2013 11:59:36 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051159.r55BxaOu069435@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 11:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251418 - stable/9/etc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 11:59:36 -0000 Author: smh Date: Wed Jun 5 11:59:36 2013 New Revision: 251418 URL: http://svnweb.freebsd.org/changeset/base/251418 Log: MFC r245250: Allow perl scripts to be used in rc.d scripts PR: conf/117027 Modified: stable/9/etc/rc.subr Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/rc.subr ============================================================================== --- stable/9/etc/rc.subr Wed Jun 5 11:55:35 2013 (r251417) +++ stable/9/etc/rc.subr Wed Jun 5 11:59:36 2013 (r251418) @@ -331,7 +331,7 @@ _find_processes() _interpbn=${1##*/} _fp_args='_argv' _fp_match='case "$_argv" in - ${_interp}|"${_interp} "*|"${_interpbn}: ${_procname}"*)' + ${_interp}|"${_interp} "*|"[${_interpbn}]"|"${_interpbn}: ${_procname}"*)' else # a normal daemon _procnamebn=${_procname##*/} _fp_args='_arg0 _argv' From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 12:11:36 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 61C38FB9; Wed, 5 Jun 2013 12:11:36 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 40ADC145C; Wed, 5 Jun 2013 12:11:36 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id F29B91A3C20; Wed, 5 Jun 2013 05:11:25 -0700 (PDT) Message-ID: <51AF2AE8.4080308@mu.org> Date: Wed, 05 Jun 2013 05:11:20 -0700 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Bruce Evans Subject: Re: svn commit: r251282 - head/sys/kern References: <201306030416.r534GmCA001872@svn.freebsd.org> <51AC1B49.9090001@mu.org> <20130603075539.GK3047@kib.kiev.ua> <51AC60CA.6050105@mu.org> <20130604052219.GP3047@kib.kiev.ua> <20130604170410.M1018@besplex.bde.org> In-Reply-To: <20130604170410.M1018@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 12:11:36 -0000 Konstantin, is there any way to take some of Bruce's feedback into account to get rid of the hard coded max? -Alfred On 6/4/13 1:14 AM, Bruce Evans wrote: > On Tue, 4 Jun 2013, Konstantin Belousov wrote: > >> On Mon, Jun 03, 2013 at 02:24:26AM -0700, Alfred Perlstein wrote: >>> On 6/3/13 12:55 AM, Konstantin Belousov wrote: >>>> On Sun, Jun 02, 2013 at 09:27:53PM -0700, Alfred Perlstein wrote: >>>>> Hey Konstaintin, shouldn't this be scaled against the actual >>>>> amount of >>>>> KVA we have instead of an arbitrary limit? >>>> The commit changes the buffer cache to scale according to the >>>> available >>>> KVA, making the scaling less dumb. >>>> >>>> I do not understand what exactly do you want to do, please describe >>>> the >>>> algorithm you propose to implement instead of my change. >>> >>> Sure, how about deriving the hardcoded "32" from the maxkva a machine >>> can have? >>> >>> Is that possible? >> I do not see why this would be useful. Initially I thought about simply >> capping nbuf at 100000 without referencing any "memory". Then I realized >> that this would somewhat conflict with (unlikely) changes to the value >> of BKVASIZE due to "factor". > > The presence of BKVASIZE in 'factor' is a bug. My version never had this > bug (see below for a patch). The scaling should be to maximize nbuf, > subject to non-arbitrary limits on physical memory and kva, and now an > arbirary limit of about 100000 / (BKVASIZE / 16384) on nbuf. Your new > limit is arbitrary so it shouldn't affect nbuf depending on BKVASIZE. > > Expanding BKVASIZE should expand kva use, but on i386 this will soon > hit a non-arbitary kva limit so nbuf will not be as high as preferred. > nbuf needs to be very large mainly to support file systems with small > buffers. Even 100000 only gives 50MB of buffering if the fs block > size is 512. This would shrink to only 12.5MB if BKVASIZE is expanded > by a factor of 4 and the bug is not fixed. If 25000 buffers after > expanding BKVASIZE is enough, then that should be the arbitary limit > (independent of BKVASIZE) so as to save physical memory. > > On i386 systems with 1GB RAM, nbuf defaults to about 7000. With an > fs block size of 512, that can buffer 3.5MB. Expanding BKVASIZE by a > factor of 4 shrinks this to 0.875MB in -current. That is ridiculously > small. VMIO limits the lossage from this. > > BKVASIZE was originally 8KB. I forget if nbuf was halved by not > modifying > the scale factor when it was expanded to 16KB. Probably not. I used to > modify the scale factor to get twice as many as the default nbuf, but > once the default nbuf expanded to a few thousand it became large enough > for most purposes so I no longer do this. > > Except on arches with extremely limit kva like i386, KVASIZE should be > MAXBSIZE, and all of the complications for expanding a buffer's kva > beyond BKVASIZE and handling the fragmentation problems caused by this > shouldn't exist. Limits like vfs.maxbufspace should be scaled by > NOMBSIZE = current BKVASIZE instead of BKVASIZE. Oops, my NOMBSIZE > has similar logical problems to BKVASIZE. It needs to be precisely > 16KB to preserve the defaults for nbuf and maxbufspace, but the nominal > (ffs) buffer size is now 32KB. So the heuristic scale factors should > use the historical magic number 16K. I changed sequential_heuristic() > to use a hard-coded 16K instead of BKVASIZE. The correct number here > depends on disk technology. > > The patch has many style fixes: > > @ Index: vfs_bio.c > @ =================================================================== > @ RCS file: /home/ncvs/src/sys/kern/vfs_bio.c,v > @ retrieving revision 1.436 > @ diff -u -2 -r1.436 vfs_bio.c > @ --- vfs_bio.c 17 Jun 2004 17:16:49 -0000 1.436 > @ +++ vfs_bio.c 3 Jun 2013 16:04:34 -0000 > @ @@ -419,64 +493,54 @@ > @ @ /* > @ - * Calculating buffer cache scaling values and reserve space for > buffer > @ + * Calculate buffer cache scaling values and reserve space for buffer > @ * headers. This is called during low level kernel initialization and > @ * may be called more then once. We CANNOT write to the memory area > @ * being reserved at this time. > @ */ > @ -caddr_t > @ -kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) > @ +void * > @ +vfs_bio_alloc(void *va) > > The API name was verbose and bogus. The prefix for this subsystem is > vfs_bio_, not kern_vfs_bio_. This is a generic allocation routine. > It always allocated swbufs and has expanded to do more allocations. > > @ { > @ - /* > @ - * physmem_est is in pages. Convert it to kilobytes (assumes > @ - * PAGE_SIZE is >= 1K) > @ - */ > @ - physmem_est = physmem_est * (PAGE_SIZE / 1024); > > I use the global physmem. This change may be too i386-specific. In > with 8-16 RAM, a significant amount of RAM may be eaten by the kernel > image or perhaps just unavailable to the kernel. Now memories are > larger and the amount eaten is relatively insignificant (since we are > only using a small fraction of physmem, only the relative error matters). > > @ + int factor, memsize; > @ @ /* > @ - * The nominal buffer size (and minimum KVA allocation) is > BKVASIZE. > @ - * For the first 64MB of ram nominally allocate sufficient > buffers to > @ - * cover 1/4 of our ram. Beyond the first 64MB allocate > additional > @ - * buffers to cover 1/20 of our ram over 64MB. When auto-sizing > @ - * the buffer cache we limit the eventual kva reservation to > @ + * The nominal buffer size is NOMBSIZE. > @ + * For the first 4MB of RAM, allocate 50 buffers. > @ + * For the next 60MB of RAM, nominally allocate sufficient > buffers to > @ + * cover 1/4 of the RAM. Beyond the first 64MB allocate > additional > @ + * buffers to cover 1/20 of the RAM. When auto-sizing > @ + * the buffer cache, limit the eventual kva reservation to > @ * maxbcache bytes. > > Fix old bitrot in this comment, and update for my changes. > - the first 4MB wasn't mentioned > - the minimum clamp wasn't mentioned > - replace BKVASIZE by NOMBSIZE so that I can change BKVASIZE without > changing the default nbuf (subject to maxbcache). > > The bitrot of the magic number 1/20 is not fixed. The code uses 1/10. > This is fixed in -current. I should have noticed this before, since > I used to have to change the code to get 1/10 instead of 1/20. > > I hope you updated the comment for recent changes, but I don't like > having magic numbers in comments. > > @ * > @ - * factor represents the 1/4 x ram conversion. > @ + * `factor' represents the 1/4 of RAM conversion. > @ */ > @ +#define NOMBSIZE imax(PAGE_SIZE, 16384) /* XXX */ > @ if (nbuf == 0) { > @ - int factor = 4 * BKVASIZE / 1024; > @ + /* > @ + * physmem is in pages. Convert it to a size in kilobytes. > @ + * XXX no ptob(). > @ + */ > @ + memsize = ctob(physmem) / 1024; > @ @ + factor = 4 * NOMBSIZE / 1024; > @ nbuf = 50; > @ - if (physmem_est > 4096) > @ - nbuf += min((physmem_est - 4096) / factor, > @ - 65536 / factor); > @ - if (physmem_est > 65536) > @ - nbuf += (physmem_est - 65536) * 2 / (factor * 5); > @ - > @ - if (maxbcache && nbuf > maxbcache / BKVASIZE) > @ - nbuf = maxbcache / BKVASIZE; > > The maxbcache limit must be applied to the non-default nbuf too. > > @ + if (memsize > 4096) > @ + nbuf += imin((memsize - 4096) / factor, > @ + (65536 - 4096) / factor); > @ + if (memsize > 65536) > @ + nbuf += (memsize - 65536) * 2 / (factor * 5); > @ } > @ - > @ -#if 0 > @ - /* > @ - * Do not allow the buffer_map to be more then 1/2 the size of the > @ - * kernel_map. > @ - */ > @ - if (nbuf > (kernel_map->max_offset - kernel_map->min_offset) / > @ - (BKVASIZE * 2)) { > @ - nbuf = (kernel_map->max_offset - kernel_map->min_offset) / > @ - (BKVASIZE * 2); > @ - printf("Warning: nbufs capped at %d\n", nbuf); > @ - } > @ -#endif > > Already removed in -current. > > @ + if (nbuf > maxbcache / BKVASIZE) > @ + nbuf = maxbcache / BKVASIZE; > @ @ /* > @ * swbufs are used as temporary holders for I/O, such as paging > I/O. > @ - * We have no less then 16 and no more then 256. > @ + * There must be between 16 and 256 of them. > @ */ > @ - nswbuf = max(min(nbuf/4, 256), 16); > @ + nswbuf = imax(imin(nbuf / 4, 256), 16); > @ #ifdef NSWBUF_MIN > @ if (nswbuf < NSWBUF_MIN) > @ nswbuf = NSWBUF_MIN; > @ #endif > @ + > @ #ifdef DIRECTIO > @ ffs_rawread_setup(); > @ @@ -484,12 +548,12 @@ > @ @ /* > @ - * Reserve space for the buffer cache buffers > @ + * Reserve space for swbuf headers and buffer cache buffers. > @ */ > @ - swbuf = (void *)v; > @ - v = (caddr_t)(swbuf + nswbuf); > @ - buf = (void *)v; > @ - v = (caddr_t)(buf + nbuf); > @ + swbuf = va; > @ + va = swbuf + nswbuf; > @ + buf = va; > @ + va = buf + nbuf; > @ @ - return(v); > @ + return (va); > @ } > @ > > Don't use the caddr_t mistake. The API was also changed to not use it. > > Bruce > From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 13:03:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A14ECDD6; Wed, 5 Jun 2013 13:03:52 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F62C186C; Wed, 5 Jun 2013 13:03:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55D3qmI090789; Wed, 5 Jun 2013 13:03:52 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55D3mxk090757; Wed, 5 Jun 2013 13:03:48 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306051303.r55D3mxk090757@svn.freebsd.org> From: Steven Hartland Date: Wed, 5 Jun 2013 13:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251419 - in stable/9: . cddl/lib/libzpool sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/u... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 13:03:52 -0000 Author: smh Date: Wed Jun 5 13:03:47 2013 New Revision: 251419 URL: http://svnweb.freebsd.org/changeset/base/251419 Log: Added ZFS TRIM support which is enabled by default. To disable ZFS TRIM support set vfs.zfs.trim.enabled=0 in loader.conf. Creating new ZFS pools and adding new devices to existing pools first performs a full device level TRIM which can take a significant amount of time. The sysctl vfs.zfs.vdev.trim_on_init can be set to 0 to disable this behaviour. ZFS TRIM requires the underlying device support BIO_DELETE which is currently provided by methods such as ATA TRIM and SCSI UNMAP via CAM, which are typically supported by SSD's. Stats for ZFS TRIM can be monitored by looking at the sysctl's under kstat.zfs.misc.zio_trim. MFC r240868: Add TRIM support MFC r244155: Renamed zfs trim stats MFC r244187: Upgrade TRIM free request sizes optimisation MFC r244188: Added vfs.zfs.vdev.trim_on_init sysctl MFC r248572: Add TRIM support for L2ARC MFC r248574: Improve TXG handling in the TRIM module MFC r248575: TRIM cache devices based on time instead of TXGs MFC r248576: Names the ZFS TRIM thread MFC r248577: Optimisation of TRIM processing MFC r248602: Fix for building libzpool under i386 MFC r249921: Enabled ZFS TRIM by default Added: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h - copied, changed from r240868, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c - copied, changed from r240868, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Modified: stable/9/UPDATING stable/9/cddl/lib/libzpool/Makefile stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c stable/9/sys/cddl/compat/opensolaris/sys/dkio.h stable/9/sys/cddl/compat/opensolaris/sys/kstat.h stable/9/sys/cddl/compat/opensolaris/sys/time.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c stable/9/sys/modules/zfs/Makefile Directory Properties: stable/9/cddl/lib/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/UPDATING Wed Jun 5 13:03:47 2013 (r251419) @@ -11,6 +11,22 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20130605: + Added ZFS TRIM support which is enabled by default. To disable + ZFS TRIM support set vfs.zfs.trim.enabled=0 in loader.conf. + + Creating new ZFS pools and adding new devices to existing pools + first performs a full device level TRIM which can take a significant + amount of time. The sysctl vfs.zfs.vdev.trim_on_init can be set to 0 + to disable this behaviour. + + ZFS TRIM requires the underlying device support BIO_DELETE which + is currently provided by methods such as ATA TRIM and SCSI UNMAP + via CAM, which are typically supported by SSD's. + + Stats for ZFS TRIM can be monitored by looking at the sysctl's + under kstat.zfs.misc.zio_trim. + 20130524: `list' command has been added to hastctl(8). For now, it is full equivalent of `status' command. Modified: stable/9/cddl/lib/libzpool/Makefile ============================================================================== --- stable/9/cddl/lib/libzpool/Makefile Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/cddl/lib/libzpool/Makefile Wed Jun 5 13:03:47 2013 (r251419) @@ -26,7 +26,7 @@ ATOMIC_SRCS= opensolaris_atomic.c LIB= zpool -ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} vdev_file.c +ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} vdev_file.c trim_map.c ZFS_SHARED_SRCS= ${ZFS_SHARED_OBJS:C/.o$/.c/} KERNEL_SRCS= kernel.c taskq.c util.c LIST_SRCS= list.c Modified: stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c Wed Jun 5 13:03:47 2013 (r251419) @@ -118,7 +118,7 @@ kstat_install(kstat_t *ksp) SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx, SYSCTL_CHILDREN(ksp->ks_sysctl_root), OID_AUTO, ksent->name, CTLTYPE_U64 | CTLFLAG_RD, ksent, sizeof(*ksent), - kstat_sysctl, "QU", ""); + kstat_sysctl, "QU", ksent->desc); } } Modified: stable/9/sys/cddl/compat/opensolaris/sys/dkio.h ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/sys/dkio.h Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/compat/opensolaris/sys/dkio.h Wed Jun 5 13:03:47 2013 (r251419) @@ -75,6 +75,8 @@ extern "C" { */ #define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */ +#define DKIOCTRIM (DKIOC|35) /* TRIM a block */ + struct dk_callback { void (*dkc_callback)(void *dkc_cookie, int error); void *dkc_cookie; Modified: stable/9/sys/cddl/compat/opensolaris/sys/kstat.h ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/sys/kstat.h Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/compat/opensolaris/sys/kstat.h Wed Jun 5 13:03:47 2013 (r251419) @@ -53,6 +53,8 @@ typedef struct kstat_named { #define KSTAT_DATA_INT64 3 #define KSTAT_DATA_UINT64 4 uchar_t data_type; +#define KSTAT_DESCLEN 128 + char desc[KSTAT_DESCLEN]; union { uint64_t ui64; } value; Modified: stable/9/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/sys/time.h Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/compat/opensolaris/sys/time.h Wed Jun 5 13:03:47 2013 (r251419) @@ -35,6 +35,7 @@ #define MILLISEC 1000 #define MICROSEC 1000000 #define NANOSEC 1000000000 +#define TIME_MAX LLONG_MAX typedef longlong_t hrtime_t; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jun 5 13:03:47 2013 (r251419) @@ -130,6 +130,7 @@ #endif #include #include +#include #include #include @@ -1691,6 +1692,8 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) } if (l2hdr != NULL) { + trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, + hdr->b_size, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); @@ -3528,6 +3531,8 @@ arc_release(arc_buf_t *buf, void *tag) buf->b_private = NULL; if (l2hdr) { + trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, + hdr->b_size, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -buf_size); @@ -4442,6 +4447,8 @@ l2arc_write_done(zio_t *zio) list_remove(buflist, ab); abl2 = ab->b_l2hdr; ab->b_l2hdr = NULL; + trim_map_free(abl2->b_dev->l2ad_vdev, abl2->b_daddr, + ab->b_size, 0); kmem_free(abl2, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -ab->b_size); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Jun 5 13:03:47 2013 (r251419) @@ -397,7 +397,8 @@ void dsl_free_sync(zio_t *pio, dsl_pool_t *dp, uint64_t txg, const blkptr_t *bpp) { ASSERT(dsl_pool_sync_context(dp)); - zio_nowait(zio_free_sync(pio, dp->dp_spa, txg, bpp, pio->io_flags)); + zio_nowait(zio_free_sync(pio, dp->dp_spa, txg, bpp, BP_GET_PSIZE(bpp), + pio->io_flags)); } static uint64_t @@ -1364,7 +1365,7 @@ dsl_scan_free_block_cb(void *arg, const } zio_nowait(zio_free_sync(scn->scn_zio_root, scn->scn_dp->dp_spa, - dmu_tx_get_txg(tx), bp, 0)); + dmu_tx_get_txg(tx), bp, BP_GET_PSIZE(bp), 0)); dsl_dir_diduse_space(tx->tx_pool->dp_free_dir, DD_USED_HEAD, -bp_get_dsize_sync(scn->scn_dp->dp_spa, bp), -BP_GET_PSIZE(bp), -BP_GET_UCSIZE(bp), tx); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Jun 5 13:03:47 2013 (r251419) @@ -67,6 +67,7 @@ #include #include #include +#include #ifdef _KERNEL #include @@ -1001,6 +1002,11 @@ spa_activate(spa_t *spa, int mode) spa_create_zio_taskqs(spa); } + /* + * Start TRIM thread. + */ + trim_thread_create(spa); + list_create(&spa->spa_config_dirty_list, sizeof (vdev_t), offsetof(vdev_t, vdev_config_dirty_node)); list_create(&spa->spa_state_dirty_list, sizeof (vdev_t), @@ -1029,6 +1035,12 @@ spa_deactivate(spa_t *spa) ASSERT(spa->spa_async_zio_root == NULL); ASSERT(spa->spa_state != POOL_STATE_UNINITIALIZED); + /* + * Stop TRIM thread in case spa_unload() wasn't called directly + * before spa_deactivate(). + */ + trim_thread_destroy(spa); + txg_list_destroy(&spa->spa_vdev_txg_list); list_destroy(&spa->spa_config_dirty_list); @@ -1145,6 +1157,11 @@ spa_unload(spa_t *spa) ASSERT(MUTEX_HELD(&spa_namespace_lock)); /* + * Stop TRIM thread. + */ + trim_thread_destroy(spa); + + /* * Stop async tasks. */ spa_async_suspend(spa); @@ -5875,7 +5892,7 @@ spa_free_sync_cb(void *arg, const blkptr zio_t *zio = arg; zio_nowait(zio_free_sync(zio, zio->io_spa, dmu_tx_get_txg(tx), bp, - zio->io_flags)); + BP_GET_PSIZE(bp), zio->io_flags)); return (0); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Wed Jun 5 13:03:47 2013 (r251419) @@ -221,6 +221,9 @@ struct spa { spa_proc_state_t spa_proc_state; /* see definition */ struct proc *spa_proc; /* "zpool-poolname" process */ uint64_t spa_did; /* if procp != p0, did of t1 */ + kthread_t *spa_trim_thread; /* thread sending TRIM I/Os */ + kmutex_t spa_trim_lock; /* protects spa_trim_cv */ + kcondvar_t spa_trim_cv; /* used to notify TRIM thread */ boolean_t spa_autoreplace; /* autoreplace set in open */ int spa_vdev_locks; /* locks grabbed */ uint64_t spa_creation_version; /* version at pool creation */ Copied and modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h (from r240868, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h) ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h Sun Sep 23 19:40:58 2012 (r240868, copy source) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h Wed Jun 5 13:03:47 2013 (r251419) @@ -36,7 +36,7 @@ extern "C" { extern void trim_map_create(vdev_t *vd); extern void trim_map_destroy(vdev_t *vd); -extern void trim_map_free(zio_t *zio); +extern void trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size, uint64_t txg); extern boolean_t trim_map_write_start(zio_t *zio); extern void trim_map_write_done(zio_t *zio); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Wed Jun 5 13:03:47 2013 (r251419) @@ -46,6 +46,7 @@ typedef enum vdev_dtl_type { } vdev_dtl_type_t; extern boolean_t zfs_nocacheflush; +extern boolean_t zfs_trim_enabled; extern int vdev_open(vdev_t *); extern void vdev_open_children(vdev_t *); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Wed Jun 5 13:03:47 2013 (r251419) @@ -183,6 +183,7 @@ struct vdev { uint64_t vdev_unspare; /* unspare when resilvering done */ hrtime_t vdev_last_try; /* last reopen time */ boolean_t vdev_nowritecache; /* true if flushwritecache failed */ + boolean_t vdev_notrim; /* true if trim failed */ boolean_t vdev_checkremove; /* temporary online test */ boolean_t vdev_forcefault; /* force online fault */ boolean_t vdev_splitting; /* split or repair in progress */ @@ -198,6 +199,7 @@ struct vdev { spa_aux_vdev_t *vdev_aux; /* for l2cache vdevs */ zio_t *vdev_probe_zio; /* root of current probe */ vdev_aux_t vdev_label_aux; /* on-disk aux state */ + struct trim_map *vdev_trimmap; /* * For DTrace to work in userland (libzpool) context, these fields must Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Wed Jun 5 13:03:47 2013 (r251419) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -137,7 +138,8 @@ enum zio_compress { #define ZIO_PRIORITY_RESILVER (zio_priority_table[9]) #define ZIO_PRIORITY_SCRUB (zio_priority_table[10]) #define ZIO_PRIORITY_DDT_PREFETCH (zio_priority_table[11]) -#define ZIO_PRIORITY_TABLE_SIZE 12 +#define ZIO_PRIORITY_TRIM (zio_priority_table[12]) +#define ZIO_PRIORITY_TABLE_SIZE 13 #define ZIO_PIPELINE_CONTINUE 0x100 #define ZIO_PIPELINE_STOP 0x101 @@ -367,6 +369,39 @@ typedef struct zio_link { list_node_t zl_child_node; } zio_link_t; +/* + * Used for TRIM kstat. + */ +typedef struct zio_trim_stats { + /* + * Number of bytes successfully TRIMmed. + */ + kstat_named_t bytes; + + /* + * Number of successful TRIM requests. + */ + kstat_named_t success; + + /* + * Number of TRIM requests that failed because TRIM is not + * supported. + */ + kstat_named_t unsupported; + + /* + * Number of TRIM requests that failed for other reasons. + */ + kstat_named_t failed; +} zio_trim_stats_t; + +extern zio_trim_stats_t zio_trim_stats; + +#define ZIO_TRIM_STAT_INCR(stat, val) \ + atomic_add_64(&zio_trim_stats.stat.value.ui64, (val)); +#define ZIO_TRIM_STAT_BUMP(stat) \ + ZIO_TRIM_STAT_INCR(stat, 1); + struct zio { /* Core information about this I/O */ zbookmark_t io_bookmark; @@ -441,6 +476,8 @@ struct zio { /* FreeBSD only. */ struct ostask io_task; #endif + avl_node_t io_trim_node; + list_node_t io_trim_link; }; extern zio_t *zio_null(zio_t *pio, spa_t *spa, vdev_t *vd, @@ -472,8 +509,8 @@ extern zio_t *zio_claim(zio_t *pio, spa_ zio_done_func_t *done, void *priv, enum zio_flag flags); extern zio_t *zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd, - zio_done_func_t *done, void *priv, int priority, - enum zio_flag flags); + uint64_t offset, uint64_t size, zio_done_func_t *done, void *priv, + int priority, enum zio_flag flags); extern zio_t *zio_read_phys(zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, void *data, int checksum, @@ -486,12 +523,14 @@ extern zio_t *zio_write_phys(zio_t *pio, boolean_t labels); extern zio_t *zio_free_sync(zio_t *pio, spa_t *spa, uint64_t txg, - const blkptr_t *bp, enum zio_flag flags); + const blkptr_t *bp, uint64_t size, enum zio_flag flags); extern int zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp, uint64_t size, boolean_t use_slog); extern void zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp); extern void zio_flush(zio_t *zio, vdev_t *vd); +extern zio_t *zio_trim(zio_t *zio, spa_t *spa, vdev_t *vd, uint64_t offset, + uint64_t size); extern void zio_shrink(zio_t *zio, uint64_t size); extern int zio_wait(zio_t *zio); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h Wed Jun 5 13:03:47 2013 (r251419) @@ -130,9 +130,9 @@ enum zio_stage { ZIO_STAGE_READY = 1 << 16, /* RWFCI */ - ZIO_STAGE_VDEV_IO_START = 1 << 17, /* RW--I */ - ZIO_STAGE_VDEV_IO_DONE = 1 << 18, /* RW--- */ - ZIO_STAGE_VDEV_IO_ASSESS = 1 << 19, /* RW--I */ + ZIO_STAGE_VDEV_IO_START = 1 << 17, /* RWF-I */ + ZIO_STAGE_VDEV_IO_DONE = 1 << 18, /* RWF-- */ + ZIO_STAGE_VDEV_IO_ASSESS = 1 << 19, /* RWF-I */ ZIO_STAGE_CHECKSUM_VERIFY = 1 << 20, /* R---- */ @@ -214,7 +214,9 @@ enum zio_stage { (ZIO_INTERLOCK_STAGES | \ ZIO_STAGE_FREE_BP_INIT | \ ZIO_STAGE_ISSUE_ASYNC | \ - ZIO_STAGE_DVA_FREE) + ZIO_STAGE_DVA_FREE | \ + ZIO_STAGE_VDEV_IO_START | \ + ZIO_STAGE_VDEV_IO_ASSESS) #define ZIO_DDT_FREE_PIPELINE \ (ZIO_INTERLOCK_STAGES | \ Copied and modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c (from r240868, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c) ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Sun Sep 23 19:40:58 2012 (r240868, copy source) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Wed Jun 5 13:03:47 2013 (r251419) @@ -27,6 +27,30 @@ #include #include #include +#include + +/* + * Calculate the zio end, upgrading based on ashift which would be + * done by zio_vdev_io_start. + * + * This makes free range consolidation much more effective + * than it would otherwise be as well as ensuring that entire + * blocks are invalidated by writes. + */ +#define TRIM_ZIO_END(vd, offset, size) (offset + \ + P2ROUNDUP(size, 1ULL << vd->vdev_top->vdev_ashift)) + +#define TRIM_MAP_SINC(tm, size) \ + atomic_add_64(&(tm)->tm_bytes, (size)) + +#define TRIM_MAP_SDEC(tm, size) \ + atomic_add_64(&(tm)->tm_bytes, -(size)) + +#define TRIM_MAP_QINC(tm) \ + atomic_inc_64(&(tm)->tm_pending); \ + +#define TRIM_MAP_QDEC(tm) \ + atomic_dec_64(&(tm)->tm_pending); typedef struct trim_map { list_t tm_head; /* List of segments sorted by txg. */ @@ -35,6 +59,8 @@ typedef struct trim_map { avl_tree_t tm_inflight_writes; /* AVL tree of in-flight writes. */ list_t tm_pending_writes; /* Writes blocked on in-flight frees. */ kmutex_t tm_lock; + uint64_t tm_pending; /* Count of pending TRIMs. */ + uint64_t tm_bytes; /* Total size in bytes of queued TRIMs. */ } trim_map_t; typedef struct trim_seg { @@ -43,16 +69,46 @@ typedef struct trim_seg { uint64_t ts_start; /* Starting offset of this segment. */ uint64_t ts_end; /* Ending offset (non-inclusive). */ uint64_t ts_txg; /* Segment creation txg. */ + hrtime_t ts_time; /* Segment creation time. */ } trim_seg_t; -extern boolean_t zfs_notrim; +extern boolean_t zfs_trim_enabled; + +static u_int trim_txg_delay = 32; +static u_int trim_timeout = 30; +static u_int trim_max_interval = 1; +/* Limit outstanding TRIMs to 2G (max size for a single TRIM request) */ +static uint64_t trim_vdev_max_bytes = 2147483648; +/* Limit outstanding TRIMs to 64 (max ranges for a single TRIM request) */ +static u_int trim_vdev_max_pending = 64; SYSCTL_DECL(_vfs_zfs); -/* Delay TRIMs by that many TXGs. */ -static int trim_txg_limit = 64; -TUNABLE_INT("vfs.zfs.trim_txg_limit", &trim_txg_limit); -SYSCTL_INT(_vfs_zfs, OID_AUTO, trim_txg_limit, CTLFLAG_RW, &trim_txg_limit, 0, - "Delay TRIMs by that many TXGs."); +SYSCTL_NODE(_vfs_zfs, OID_AUTO, trim, CTLFLAG_RD, 0, "ZFS TRIM"); + +TUNABLE_INT("vfs.zfs.trim.txg_delay", &trim_txg_delay); +SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, txg_delay, CTLFLAG_RWTUN, &trim_txg_delay, + 0, "Delay TRIMs by up to this many TXGs"); + +TUNABLE_INT("vfs.zfs.trim.timeout", &trim_timeout); +SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, timeout, CTLFLAG_RWTUN, &trim_timeout, 0, + "Delay TRIMs by up to this many seconds"); + +TUNABLE_INT("vfs.zfs.trim.max_interval", &trim_max_interval); +SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, max_interval, CTLFLAG_RWTUN, + &trim_max_interval, 0, + "Maximum interval between TRIM queue processing (seconds)"); + +SYSCTL_DECL(_vfs_zfs_vdev); +TUNABLE_QUAD("vfs.zfs.vdev.trim_max_bytes", &trim_vdev_max_bytes); +SYSCTL_QUAD(_vfs_zfs_vdev, OID_AUTO, trim_max_bytes, CTLFLAG_RWTUN, + &trim_vdev_max_bytes, 0, + "Maximum pending TRIM bytes for a vdev"); + +TUNABLE_INT("vfs.zfs.vdev.trim_max_pending", &trim_vdev_max_pending); +SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, trim_max_pending, CTLFLAG_RWTUN, + &trim_vdev_max_pending, 0, + "Maximum pending TRIM segments for a vdev"); + static void trim_map_vdev_commit_done(spa_t *spa, vdev_t *vd); @@ -101,7 +157,7 @@ trim_map_create(vdev_t *vd) ASSERT(vd->vdev_ops->vdev_op_leaf); - if (zfs_notrim) + if (!zfs_trim_enabled) return; tm = kmem_zalloc(sizeof (*tm), KM_SLEEP); @@ -127,7 +183,7 @@ trim_map_destroy(vdev_t *vd) ASSERT(vd->vdev_ops->vdev_op_leaf); - if (zfs_notrim) + if (!zfs_trim_enabled) return; tm = vd->vdev_trimmap; @@ -146,6 +202,8 @@ trim_map_destroy(vdev_t *vd) avl_remove(&tm->tm_queued_frees, ts); list_remove(&tm->tm_head, ts); kmem_free(ts, sizeof (*ts)); + TRIM_MAP_SDEC(tm, ts->ts_end - ts->ts_start); + TRIM_MAP_QDEC(tm); } mutex_exit(&tm->tm_lock); @@ -165,10 +223,12 @@ trim_map_segment_add(trim_map_t *tm, uin avl_index_t where; trim_seg_t tsearch, *ts_before, *ts_after, *ts; boolean_t merge_before, merge_after; + hrtime_t time; ASSERT(MUTEX_HELD(&tm->tm_lock)); VERIFY(start < end); + time = gethrtime(); tsearch.ts_start = start; tsearch.ts_end = end; @@ -184,25 +244,36 @@ trim_map_segment_add(trim_map_t *tm, uin ts_before = avl_nearest(&tm->tm_queued_frees, where, AVL_BEFORE); ts_after = avl_nearest(&tm->tm_queued_frees, where, AVL_AFTER); - merge_before = (ts_before != NULL && ts_before->ts_end == start && - ts_before->ts_txg == txg); - merge_after = (ts_after != NULL && ts_after->ts_start == end && - ts_after->ts_txg == txg); + merge_before = (ts_before != NULL && ts_before->ts_end == start); + merge_after = (ts_after != NULL && ts_after->ts_start == end); if (merge_before && merge_after) { + TRIM_MAP_SINC(tm, ts_after->ts_start - ts_before->ts_end); + TRIM_MAP_QDEC(tm); avl_remove(&tm->tm_queued_frees, ts_before); list_remove(&tm->tm_head, ts_before); ts_after->ts_start = ts_before->ts_start; + ts_after->ts_txg = txg; + ts_after->ts_time = time; kmem_free(ts_before, sizeof (*ts_before)); } else if (merge_before) { + TRIM_MAP_SINC(tm, end - ts_before->ts_end); ts_before->ts_end = end; + ts_before->ts_txg = txg; + ts_before->ts_time = time; } else if (merge_after) { + TRIM_MAP_SINC(tm, ts_after->ts_start - start); ts_after->ts_start = start; + ts_after->ts_txg = txg; + ts_after->ts_time = time; } else { + TRIM_MAP_SINC(tm, end - start); + TRIM_MAP_QINC(tm); ts = kmem_alloc(sizeof (*ts), KM_SLEEP); ts->ts_start = start; ts->ts_end = end; ts->ts_txg = txg; + ts->ts_time = time; avl_insert(&tm->tm_queued_frees, ts, where); list_insert_tail(&tm->tm_head, ts); } @@ -220,14 +291,17 @@ trim_map_segment_remove(trim_map_t *tm, left_over = (ts->ts_start < start); right_over = (ts->ts_end > end); + TRIM_MAP_SDEC(tm, end - start); if (left_over && right_over) { nts = kmem_alloc(sizeof (*nts), KM_SLEEP); nts->ts_start = end; nts->ts_end = ts->ts_end; nts->ts_txg = ts->ts_txg; + nts->ts_time = ts->ts_time; ts->ts_end = start; avl_insert_here(&tm->tm_queued_frees, nts, ts, AVL_AFTER); list_insert_after(&tm->tm_head, ts, nts); + TRIM_MAP_QINC(tm); } else if (left_over) { ts->ts_end = start; } else if (right_over) { @@ -235,6 +309,7 @@ trim_map_segment_remove(trim_map_t *tm, } else { avl_remove(&tm->tm_queued_frees, ts); list_remove(&tm->tm_head, ts); + TRIM_MAP_QDEC(tm); kmem_free(ts, sizeof (*ts)); } } @@ -261,17 +336,15 @@ trim_map_free_locked(trim_map_t *tm, uin } void -trim_map_free(zio_t *zio) +trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size, uint64_t txg) { - vdev_t *vd = zio->io_vd; trim_map_t *tm = vd->vdev_trimmap; - if (zfs_notrim || vd->vdev_notrim || tm == NULL) + if (!zfs_trim_enabled || vd->vdev_notrim || tm == NULL) return; mutex_enter(&tm->tm_lock); - trim_map_free_locked(tm, zio->io_offset, zio->io_offset + zio->io_size, - vd->vdev_spa->spa_syncing_txg); + trim_map_free_locked(tm, offset, TRIM_ZIO_END(vd, offset, size), txg); mutex_exit(&tm->tm_lock); } @@ -284,11 +357,11 @@ trim_map_write_start(zio_t *zio) boolean_t left_over, right_over; uint64_t start, end; - if (zfs_notrim || vd->vdev_notrim || tm == NULL) + if (!zfs_trim_enabled || vd->vdev_notrim || tm == NULL) return (B_TRUE); start = zio->io_offset; - end = start + zio->io_size; + end = TRIM_ZIO_END(zio->io_vd, start, zio->io_size); tsearch.ts_start = start; tsearch.ts_end = end; @@ -331,7 +404,7 @@ trim_map_write_done(zio_t *zio) * Don't check for vdev_notrim, since the write could have * started before vdev_notrim was set. */ - if (zfs_notrim || tm == NULL) + if (!zfs_trim_enabled || tm == NULL) return; mutex_enter(&tm->tm_lock); @@ -348,19 +421,25 @@ trim_map_write_done(zio_t *zio) } /* - * Return the oldest segment (the one with the lowest txg) or false if - * the list is empty or the first element's txg is greater than txg given - * as function argument. + * Return the oldest segment (the one with the lowest txg / time) or NULL if: + * 1. The list is empty + * 2. The first element's txg is greater than txgsafe + * 3. The first element's txg is not greater than the txg argument and the + * the first element's time is not greater than time argument */ static trim_seg_t * -trim_map_first(trim_map_t *tm, uint64_t txg) +trim_map_first(trim_map_t *tm, uint64_t txg, uint64_t txgsafe, hrtime_t time) { trim_seg_t *ts; ASSERT(MUTEX_HELD(&tm->tm_lock)); + VERIFY(txgsafe >= txg); ts = list_head(&tm->tm_head); - if (ts != NULL && ts->ts_txg <= txg) + if (ts != NULL && ts->ts_txg <= txgsafe && + (ts->ts_txg <= txg || ts->ts_time <= time || + tm->tm_bytes > trim_vdev_max_bytes || + tm->tm_pending > trim_vdev_max_pending)) return (ts); return (NULL); } @@ -370,26 +449,37 @@ trim_map_vdev_commit(spa_t *spa, zio_t * { trim_map_t *tm = vd->vdev_trimmap; trim_seg_t *ts; - uint64_t start, size, txglimit; + uint64_t size, txgtarget, txgsafe; + hrtime_t timelimit; ASSERT(vd->vdev_ops->vdev_op_leaf); if (tm == NULL) return; - txglimit = MIN(spa->spa_syncing_txg, spa_freeze_txg(spa)) - - trim_txg_limit; + timelimit = gethrtime() - trim_timeout * NANOSEC; + if (vd->vdev_isl2cache) { + txgsafe = UINT64_MAX; + txgtarget = UINT64_MAX; + } else { + txgsafe = MIN(spa_last_synced_txg(spa), spa_freeze_txg(spa)); + if (txgsafe > trim_txg_delay) + txgtarget = txgsafe - trim_txg_delay; + else + txgtarget = 0; + } mutex_enter(&tm->tm_lock); - /* - * Loop until we send all frees up to the txglimit. - */ - while ((ts = trim_map_first(tm, txglimit)) != NULL) { + /* Loop until we have sent all outstanding free's */ + while ((ts = trim_map_first(tm, txgtarget, txgsafe, timelimit)) + != NULL) { list_remove(&tm->tm_head, ts); avl_remove(&tm->tm_queued_frees, ts); avl_add(&tm->tm_inflight_frees, ts); - zio_nowait(zio_trim(zio, spa, vd, ts->ts_start, - ts->ts_end - ts->ts_start)); + size = ts->ts_end - ts->ts_start; + zio_nowait(zio_trim(zio, spa, vd, ts->ts_start, size)); + TRIM_MAP_SDEC(tm, size); + TRIM_MAP_QDEC(tm); } mutex_exit(&tm->tm_lock); } @@ -434,7 +524,7 @@ trim_map_commit(spa_t *spa, zio_t *zio, { int c; - if (vd == NULL || spa->spa_syncing_txg <= trim_txg_limit) + if (vd == NULL) return; if (vd->vdev_ops->vdev_op_leaf) { @@ -467,6 +557,11 @@ trim_thread(void *arg) spa_t *spa = arg; zio_t *zio; +#ifdef _KERNEL + (void) snprintf(curthread->td_name, sizeof(curthread->td_name), + "trim %s", spa_name(spa)); +#endif + for (;;) { mutex_enter(&spa->spa_trim_lock); if (spa->spa_trim_thread == NULL) { @@ -475,7 +570,9 @@ trim_thread(void *arg) mutex_exit(&spa->spa_trim_lock); thread_exit(); } - cv_wait(&spa->spa_trim_cv, &spa->spa_trim_lock); + + (void) cv_timedwait(&spa->spa_trim_cv, &spa->spa_trim_lock, + hz * trim_max_interval); mutex_exit(&spa->spa_trim_lock); zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); @@ -492,7 +589,7 @@ void trim_thread_create(spa_t *spa) { - if (zfs_notrim) + if (!zfs_trim_enabled) return; mutex_init(&spa->spa_trim_lock, NULL, MUTEX_DEFAULT, NULL); @@ -507,7 +604,7 @@ void trim_thread_destroy(spa_t *spa) { - if (zfs_notrim) + if (!zfs_trim_enabled) return; if (spa->spa_trim_thread == NULL) return; @@ -530,7 +627,7 @@ void trim_thread_wakeup(spa_t *spa) { - if (zfs_notrim) + if (!zfs_trim_enabled) return; if (spa->spa_trim_thread == NULL) return; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Jun 5 13:03:47 2013 (r251419) @@ -43,6 +43,7 @@ #include #include #include +#include SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, vdev, CTLFLAG_RW, 0, "ZFS VDEV"); @@ -1196,6 +1197,11 @@ vdev_open(vdev_t *vd) if (vd->vdev_ishole || vd->vdev_ops == &vdev_missing_ops) return (0); + if (vd->vdev_ops->vdev_op_leaf) { + vd->vdev_notrim = B_FALSE; + trim_map_create(vd); + } + for (int c = 0; c < vd->vdev_children; c++) { if (vd->vdev_child[c]->vdev_state != VDEV_STATE_HEALTHY) { vdev_set_state(vd, B_TRUE, VDEV_STATE_DEGRADED, @@ -1441,6 +1447,9 @@ vdev_close(vdev_t *vd) vdev_cache_purge(vd); + if (vd->vdev_ops->vdev_op_leaf) + trim_map_destroy(vd); + /* * We record the previous state before we close it, so that if we are * doing a reopen(), we don't generate FMA ereports if we notice that Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Jun 5 13:03:47 2013 (r251419) @@ -49,14 +49,17 @@ struct g_class zfs_vdev_class = { DECLARE_GEOM_CLASS(zfs_vdev_class, zfs_vdev); -/* - * Don't send BIO_FLUSH. - */ +SYSCTL_DECL(_vfs_zfs_vdev); +/* Don't send BIO_FLUSH. */ static int vdev_geom_bio_flush_disable = 0; TUNABLE_INT("vfs.zfs.vdev.bio_flush_disable", &vdev_geom_bio_flush_disable); -SYSCTL_DECL(_vfs_zfs_vdev); SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_flush_disable, CTLFLAG_RW, &vdev_geom_bio_flush_disable, 0, "Disable BIO_FLUSH"); +/* Don't send BIO_DELETE. */ +static int vdev_geom_bio_delete_disable = 0; +TUNABLE_INT("vfs.zfs.vdev.bio_delete_disable", &vdev_geom_bio_delete_disable); +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_delete_disable, CTLFLAG_RW, + &vdev_geom_bio_delete_disable, 0, "Disable BIO_DELETE"); static void vdev_geom_orphan(struct g_consumer *cp) @@ -663,8 +666,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi *ashift = highbit(MAX(pp->sectorsize, SPA_MINBLOCKSIZE)) - 1; /* - * Clear the nowritecache bit, so that on a vdev_reopen() we will - * try again. + * Clear the nowritecache settings, so that on a vdev_reopen() + * we will try again. */ vd->vdev_nowritecache = B_FALSE; @@ -710,6 +713,15 @@ vdev_geom_io_intr(struct bio *bp) */ vd->vdev_nowritecache = B_TRUE; } + if (bp->bio_cmd == BIO_DELETE && bp->bio_error == ENOTSUP) { + /* + * If we get ENOTSUP, we know that no future + * attempts will ever succeed. In this case we + * set a persistent bit so that we don't bother + * with the ioctl in the future. + */ + vd->vdev_notrim = B_TRUE; + } if (zio->io_error == EIO && !vd->vdev_remove_wanted) { /* * If provider's error is set we assume it is being @@ -752,17 +764,21 @@ vdev_geom_io_start(zio_t *zio) } switch (zio->io_cmd) { - case DKIOCFLUSHWRITECACHE: - if (zfs_nocacheflush || vdev_geom_bio_flush_disable) break; - if (vd->vdev_nowritecache) { zio->io_error = ENOTSUP; break; } - + goto sendreq; + case DKIOCTRIM: + if (vdev_geom_bio_delete_disable) + break; + if (vd->vdev_notrim) { + zio->io_error = ENOTSUP; + break; + } goto sendreq; default: zio->io_error = ENOTSUP; @@ -787,11 +803,21 @@ sendreq: bp->bio_length = zio->io_size; break; case ZIO_TYPE_IOCTL: - bp->bio_cmd = BIO_FLUSH; - bp->bio_flags |= BIO_ORDERED; - bp->bio_data = NULL; - bp->bio_offset = cp->provider->mediasize; - bp->bio_length = 0; + switch (zio->io_cmd) { + case DKIOCFLUSHWRITECACHE: + bp->bio_cmd = BIO_FLUSH; + bp->bio_flags |= BIO_ORDERED; + bp->bio_data = NULL; + bp->bio_offset = cp->provider->mediasize; + bp->bio_length = 0; + break; + case DKIOCTRIM: + bp->bio_cmd = BIO_DELETE; + bp->bio_data = NULL; + bp->bio_offset = zio->io_offset; + bp->bio_length = zio->io_size; + break; + } break; } bp->bio_done = vdev_geom_io_intr; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Wed Jun 5 13:03:47 2013 (r251419) @@ -145,8 +145,14 @@ #include #include #include +#include #include +static boolean_t vdev_trim_on_init = B_TRUE; +SYSCTL_DECL(_vfs_zfs_vdev); +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, trim_on_init, CTLFLAG_RW, + &vdev_trim_on_init, 0, "Enable/disable full vdev trim on initialisation"); + /* * Basic routines to read and write from a vdev label. * Used throughout the rest of this file. @@ -718,6 +724,16 @@ vdev_label_init(vdev_t *vd, uint64_t crt } /* + * TRIM the whole thing so that we start with a clean slate. + * It's just an optimization, so we don't care if it fails. + * Don't TRIM if removing so that we don't interfere with zpool + * disaster recovery. + */ + if (zfs_trim_enabled && vdev_trim_on_init && (reason == VDEV_LABEL_CREATE || + reason == VDEV_LABEL_SPARE || reason == VDEV_LABEL_L2CACHE)) + zio_wait(zio_trim(NULL, spa, vd, 0, vd->vdev_psize)); + + /* * Initialize its label. */ vp = zio_buf_alloc(sizeof (vdev_phys_t)); @@ -1282,5 +1298,10 @@ vdev_config_sync(vdev_t **svd, int svdco * to disk to ensure that all odd-label updates are committed to * stable storage before the next transaction group begins. */ - return (vdev_label_sync_list(spa, 1, txg, flags)); + if ((error = vdev_label_sync_list(spa, 1, txg, flags)) != 0) + return (error); + + trim_thread_wakeup(spa); + + return (0); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Wed Jun 5 13:03:47 2013 (r251419) @@ -293,10 +293,11 @@ vdev_mirror_io_start(zio_t *zio) c = vdev_mirror_child_select(zio); children = (c >= 0); } else { - ASSERT(zio->io_type == ZIO_TYPE_WRITE); + ASSERT(zio->io_type == ZIO_TYPE_WRITE || + zio->io_type == ZIO_TYPE_FREE); /* - * Writes go to all children. + * Writes and frees go to all children. */ c = 0; children = mm->mm_children; @@ -377,6 +378,8 @@ vdev_mirror_io_done(zio_t *zio) zio->io_error = vdev_mirror_worst_error(mm); } return; + } else if (zio->io_type == ZIO_TYPE_FREE) { + return; } ASSERT(zio->io_type == ZIO_TYPE_READ); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Wed Jun 5 11:59:36 2013 (r251418) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Wed Jun 5 13:03:47 2013 (r251419) @@ -259,7 +259,9 @@ vdev_raidz_map_free(raidz_map_t *rm) size_t size; for (c = 0; c < rm->rm_firstdatacol; c++) { - zio_buf_free(rm->rm_col[c].rc_data, rm->rm_col[c].rc_size); + if (rm->rm_col[c].rc_data != NULL) + zio_buf_free(rm->rm_col[c].rc_data, + rm->rm_col[c].rc_size); if (rm->rm_col[c].rc_gdata != NULL) zio_buf_free(rm->rm_col[c].rc_gdata, @@ -504,14 +506,20 @@ vdev_raidz_map_alloc(zio_t *zio, uint64_ ASSERT3U(rm->rm_asize - asize, ==, rm->rm_nskip << unit_shift); ASSERT3U(rm->rm_nskip, <=, nparity); - for (c = 0; c < rm->rm_firstdatacol; c++) - rm->rm_col[c].rc_data = zio_buf_alloc(rm->rm_col[c].rc_size); - - rm->rm_col[c].rc_data = zio->io_data; + if (zio->io_type != ZIO_TYPE_FREE) { + for (c = 0; c < rm->rm_firstdatacol; c++) { + rm->rm_col[c].rc_data = + zio_buf_alloc(rm->rm_col[c].rc_size); + } - for (c = c + 1; c < acols; c++) - rm->rm_col[c].rc_data = (char *)rm->rm_col[c - 1].rc_data + - rm->rm_col[c - 1].rc_size; + rm->rm_col[c].rc_data = zio->io_data; + + for (c = c + 1; c < acols; c++) { + rm->rm_col[c].rc_data = + (char *)rm->rm_col[c - 1].rc_data + + rm->rm_col[c - 1].rc_size; + } + } /* * If all data stored spans all columns, there's a danger that parity @@ -1536,6 +1544,18 @@ vdev_raidz_io_start(zio_t *zio) ASSERT3U(rm->rm_asize, ==, vdev_psize_to_asize(vd, zio->io_size)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 13:30:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2301061A; Wed, 5 Jun 2013 13:30:52 +0000 (UTC) (envelope-from gibbs@scsiguy.com) Received: from aslan.scsiguy.com (aslan.scsiguy.com [70.89.174.89]) by mx1.freebsd.org (Postfix) with ESMTP id EEAF519B5; Wed, 5 Jun 2013 13:30:51 +0000 (UTC) Received: from [192.168.5.95] (ip-64-134-30-158.public.wayport.net [64.134.30.158]) (authenticated bits=0) by aslan.scsiguy.com (8.14.7/8.14.5) with ESMTP id r55DUmZu022024 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 5 Jun 2013 13:30:50 GMT (envelope-from gibbs@scsiguy.com) References: <201306041047.r54AljAX050733@svn.freebsd.org> Mime-Version: 1.0 (1.0) In-Reply-To: <201306041047.r54AljAX050733@svn.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <4A91EB3F-56FD-4E94-9981-0422032C9240@scsiguy.com> X-Mailer: iPhone Mail (10B329) From: "Justin T. Gibbs" Subject: Re: svn commit: r251372 - in stable/9/sys/cam: ata scsi Date: Wed, 5 Jun 2013 06:30:44 -0700 To: Steven Hartland X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (aslan.scsiguy.com [70.89.174.89]); Wed, 05 Jun 2013 13:30:50 +0000 (UTC) Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "svn-src-stable-9@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 13:30:52 -0000 On Jun 4, 2013, at 3:47, Steven Hartland wrote: > Author: smh > Date: Tue Jun 4 10:47:44 2013 > New Revision: 251372 > URL: http://svnweb.freebsd.org/changeset/base/251372 >=20 > Log: > Enhanced BIO_DELETE support for CAM SCSI to add ATA_TRIM support. >=20 > Disable CAM BIO queue sorting for non-rotating media by default. Using the elevator makes perfect sense even for random access devices when o= perations can be merged. Even SSDs have fixed, per-command overheads and mer= ging writes may help prevent fragmentation. On drivers that support unmappe= d I/O, merging should be fairly cheap. It would be an interesting performance experiment. >=20 -- Justin= From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 15:03:14 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 80479FEF; Wed, 5 Jun 2013 15:03:14 +0000 (UTC) (envelope-from prvs=1868436c14=killing@multiplay.co.uk) Received: from mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) by mx1.freebsd.org (Postfix) with ESMTP id A931D1DFA; Wed, 5 Jun 2013 15:03:13 +0000 (UTC) Received: from r2d2 ([82.69.141.170]) by mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) (MDaemon PRO v10.0.4) with ESMTP id md50004168536.msg; Wed, 05 Jun 2013 16:03:05 +0100 X-Spam-Processed: mail1.multiplay.co.uk, Wed, 05 Jun 2013 16:03:05 +0100 (not processed: message from valid local sender) X-MDDKIM-Result: neutral (mail1.multiplay.co.uk) X-MDRemoteIP: 82.69.141.170 X-Return-Path: prvs=1868436c14=killing@multiplay.co.uk X-Envelope-From: killing@multiplay.co.uk Message-ID: <491E54742FDD4C299688DE36717EA531@multiplay.co.uk> From: "Steven Hartland" To: "Justin T. Gibbs" References: <201306041047.r54AljAX050733@svn.freebsd.org> <4A91EB3F-56FD-4E94-9981-0422032C9240@scsiguy.com> Subject: Re: svn commit: r251372 - in stable/9/sys/cam: ata scsi Date: Wed, 5 Jun 2013 16:02:54 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 15:03:14 -0000 ----- Original Message ----- From: "Justin T. Gibbs" On Jun 4, 2013, at 3:47, Steven Hartland wrote: > > Author: smh > > Date: Tue Jun 4 10:47:44 2013 > > New Revision: 251372 > > URL: http://svnweb.freebsd.org/changeset/base/251372 > > > > Log: > > Enhanced BIO_DELETE support for CAM SCSI to add ATA_TRIM support. > > > > Disable CAM BIO queue sorting for non-rotating media by default. > > Using the elevator makes perfect sense even for random access devices when > operations can be merged. Even SSDs have fixed, per-command overheads and > merging writes may help prevent fragmentation. On drivers that support > unmapped I/O, merging should be fairly cheap. > > It would be an interesting performance experiment. In theory I'd agree but in practice this was not the case with bioq becoming a noticable bottleneck for SSD based machines, hence this change. The sysctl's still allow this to be configured :) Regards Steve ================================================ This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it. In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337 or return the E.mail to postmaster@multiplay.co.uk. From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 15:51:48 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6B7CEDE1; Wed, 5 Jun 2013 15:51:48 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D24E104C; Wed, 5 Jun 2013 15:51:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55FplvC044221; Wed, 5 Jun 2013 15:51:47 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55Fplpi044212; Wed, 5 Jun 2013 15:51:47 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201306051551.r55Fplpi044212@svn.freebsd.org> From: "Simon J. Gerraty" Date: Wed, 5 Jun 2013 15:51:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r251420 - vendor/NetBSD/bmake/dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 15:51:48 -0000 Author: sjg Date: Wed Jun 5 15:51:46 2013 New Revision: 251420 URL: http://svnweb.freebsd.org/changeset/base/251420 Log: Import bmake-20130604 Modified: vendor/NetBSD/bmake/dist/ChangeLog vendor/NetBSD/bmake/dist/Makefile vendor/NetBSD/bmake/dist/job.c vendor/NetBSD/bmake/dist/make.1 vendor/NetBSD/bmake/dist/var.c Modified: vendor/NetBSD/bmake/dist/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/ChangeLog Wed Jun 5 13:03:47 2013 (r251419) +++ vendor/NetBSD/bmake/dist/ChangeLog Wed Jun 5 15:51:46 2013 (r251420) @@ -1,3 +1,16 @@ +2013-06-04 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20130604 + Merge with NetBSD make, pick up + o job.c: JobCreatePipe: do fcntl() after any tweaking of fd's + to avoid leaking descriptors. + +2013-05-28 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20130528 + Merge with NetBSD make, pick up + o var.c: cleanup some left-overs in VarHash() + 2013-05-20 Simon J. Gerraty * Makefile (MAKE_VERSION): 20130520 Modified: vendor/NetBSD/bmake/dist/Makefile ============================================================================== --- vendor/NetBSD/bmake/dist/Makefile Wed Jun 5 13:03:47 2013 (r251419) +++ vendor/NetBSD/bmake/dist/Makefile Wed Jun 5 15:51:46 2013 (r251420) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.12 2013/05/20 16:05:10 sjg Exp $ +# $Id: Makefile,v 1.14 2013/06/05 04:03:22 sjg Exp $ # Base version on src date -MAKE_VERSION= 20130520 +MAKE_VERSION= 20130604 PROG= bmake Modified: vendor/NetBSD/bmake/dist/job.c ============================================================================== --- vendor/NetBSD/bmake/dist/job.c Wed Jun 5 13:03:47 2013 (r251419) +++ vendor/NetBSD/bmake/dist/job.c Wed Jun 5 15:51:46 2013 (r251420) @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $ */ +/* $NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $"); +__RCSID("$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -414,6 +414,15 @@ JobCreatePipe(Job *job, int minfd) if (pipe(job->jobPipe) == -1) Punt("Cannot create pipe: %s", strerror(errno)); + for (i = 0; i < 2; i++) { + /* Avoid using low numbered fds */ + fd = fcntl(job->jobPipe[i], F_DUPFD, minfd); + if (fd != -1) { + close(job->jobPipe[i]); + job->jobPipe[i] = fd; + } + } + /* Set close-on-exec flag for both */ (void)fcntl(job->jobPipe[0], F_SETFD, 1); (void)fcntl(job->jobPipe[1], F_SETFD, 1); @@ -426,15 +435,6 @@ JobCreatePipe(Job *job, int minfd) */ fcntl(job->jobPipe[0], F_SETFL, fcntl(job->jobPipe[0], F_GETFL, 0) | O_NONBLOCK); - - for (i = 0; i < 2; i++) { - /* Avoid using low numbered fds */ - fd = fcntl(job->jobPipe[i], F_DUPFD, minfd); - if (fd != -1) { - close(job->jobPipe[i]); - job->jobPipe[i] = fd; - } - } } /*- @@ -2828,6 +2828,8 @@ Job_ServerStart(int max_tokens, int jp_0 /* Pipe passed in from parent */ tokenWaitJob.inPipe = jp_0; tokenWaitJob.outPipe = jp_1; + (void)fcntl(jp_0, F_SETFD, 1); + (void)fcntl(jp_1, F_SETFD, 1); return; } Modified: vendor/NetBSD/bmake/dist/make.1 ============================================================================== --- vendor/NetBSD/bmake/dist/make.1 Wed Jun 5 13:03:47 2013 (r251419) +++ vendor/NetBSD/bmake/dist/make.1 Wed Jun 5 15:51:46 2013 (r251420) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.213 2013/03/31 05:49:51 sjg Exp $ +.\" $NetBSD: make.1,v 1.215 2013/05/22 19:35:11 christos Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd March 30, 2013 +.Dd May 22, 2013 .Dt MAKE 1 .Os .Sh NAME @@ -2110,6 +2110,13 @@ for Sprite at Berkeley. It was designed to be a parallel distributed make running jobs on different machines using a daemon called .Dq customs . +.Pp +Historically the target/dependency +.Dq FRC +has been used to FoRCe rebuilding (since the target/dependency +does not exist... unless someone creates an +.Dq FRC +file). .Sh BUGS The .Nm Modified: vendor/NetBSD/bmake/dist/var.c ============================================================================== --- vendor/NetBSD/bmake/dist/var.c Wed Jun 5 13:03:47 2013 (r251419) +++ vendor/NetBSD/bmake/dist/var.c Wed Jun 5 15:51:46 2013 (r251420) @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $ */ +/* $NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $"); +__RCSID("$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -2310,9 +2310,7 @@ VarHash(char *str) size_t len, len2; unsigned char *ustr = (unsigned char *)str; uint32_t h, k, c1, c2; - int done; - done = 1; h = 0x971e137bU; c1 = 0x95543787U; c2 = 0x2ad7eb25U; @@ -2342,7 +2340,7 @@ VarHash(char *str) h = (h << 13) ^ (h >> 19); h = h * 5 + 0x52dce729U; h ^= k; - } while (!done); + } h ^= len2; h *= 0x85ebca6b; h ^= h >> 13; From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 15:52:25 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8A95FF49; Wed, 5 Jun 2013 15:52:25 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6384A1055; Wed, 5 Jun 2013 15:52:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55FqPXd044346; Wed, 5 Jun 2013 15:52:25 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55FqPeR044345; Wed, 5 Jun 2013 15:52:25 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201306051552.r55FqPeR044345@svn.freebsd.org> From: "Simon J. Gerraty" Date: Wed, 5 Jun 2013 15:52:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r251421 - vendor/NetBSD/bmake/20130604 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 15:52:25 -0000 Author: sjg Date: Wed Jun 5 15:52:24 2013 New Revision: 251421 URL: http://svnweb.freebsd.org/changeset/base/251421 Log: Tag bmake-20130604 Added: vendor/NetBSD/bmake/20130604/ - copied from r251420, vendor/NetBSD/bmake/dist/ From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 15:55:29 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1E331182; Wed, 5 Jun 2013 15:55:29 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id BCD2B1082; Wed, 5 Jun 2013 15:55:28 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id r55FtR01022266; Wed, 5 Jun 2013 09:55:27 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id r55FtRYK022265; Wed, 5 Jun 2013 09:55:27 -0600 (MDT) (envelope-from ken) Date: Wed, 5 Jun 2013 09:55:27 -0600 From: "Kenneth D. Merry" To: Colin Percival Subject: Re: svn commit: r251297 - head/sys/dev/xen/netfront Message-ID: <20130605155527.GA84878@nargothrond.kdm.org> References: <201306031300.r53D0XUx092178@svn.freebsd.org> <51AED1F3.2060003@freebsd.org> <51AED722.8000504@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51AED722.8000504@freebsd.org> User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, Lawrence Stewart , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andre Oppermann X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 15:55:29 -0000 On Tue, Jun 04, 2013 at 23:13:54 -0700, Colin Percival wrote: > On 06/04/13 22:51, Lawrence Stewart wrote: > > On 06/03/13 23:00, Andre Oppermann wrote: > >> Modified: head/sys/dev/xen/netfront/netfront.c > >> ============================================================================== > >> --- head/sys/dev/xen/netfront/netfront.c Mon Jun 3 12:55:13 2013 (r251296) > >> +++ head/sys/dev/xen/netfront/netfront.c Mon Jun 3 13:00:33 2013 (r251297) > >> @@ -134,6 +134,7 @@ static const int MODPARM_rx_flip = 0; > >> * to mirror the Linux MAX_SKB_FRAGS constant. > >> */ > >> #define MAX_TX_REQ_FRAGS (65536 / PAGE_SIZE + 2) > >> +#define NF_TSO_MAXBURST ((IP_MAXPACKET / PAGE_SIZE) * MCLBYTES) > > > > For posterity's sake, can you and/or Colin please elaborate on how this > > value was determined and what it is dependent upon? Could a newer > > version of Xen remove the need for this reduced limit? > > The comment above (of which only the last line is quoted in the diff) > explains it: > * This limit is imposed by the backend driver. We assume here that > * we are dealing with a Linux driver domain and have set our limit > * to mirror the Linux MAX_SKB_FRAGS constant. > > This isn't a Xen issue really; rather, it's a Linux Dom0 issue. AFAIK > there are no changes in the pipe to fix this in Linux; but this would not > be needed with a different Dom0 (e.g., a FreeBSD Dom0, if/when that becomes > possible) or if FreeBSD switched to using 4kB mbuf clusters (since at that > point we would be matching Linux and be able to fit a maximum-length IP > packet into the allowed number of fragments). It has been a couple of years since I looked at that, but IIRC one of the issues here is that the is no way to probe for the maximum. So even once we have a FreeBSD Dom 0, we may be stuck with the limit. Or we'll have to have some other way (e.g. the xenstore) to communicate that we're running on a different type of Dom 0 and don't have the limit. Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 16:12:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7645C4F2; Wed, 5 Jun 2013 16:12:52 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 674AB1135; Wed, 5 Jun 2013 16:12:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55GCqDi050950; Wed, 5 Jun 2013 16:12:52 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55GCpPG050941; Wed, 5 Jun 2013 16:12:51 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201306051612.r55GCpPG050941@svn.freebsd.org> From: "Simon J. Gerraty" Date: Wed, 5 Jun 2013 16:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251422 - in head: contrib/bmake usr.bin/bmake X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 16:12:52 -0000 Author: sjg Date: Wed Jun 5 16:12:50 2013 New Revision: 251422 URL: http://svnweb.freebsd.org/changeset/base/251422 Log: Update to bmake-20130604 to fix file descriptor leak. Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/Makefile head/contrib/bmake/job.c head/contrib/bmake/make.1 head/contrib/bmake/var.c head/usr.bin/bmake/Makefile Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Wed Jun 5 15:52:24 2013 (r251421) +++ head/contrib/bmake/ChangeLog Wed Jun 5 16:12:50 2013 (r251422) @@ -1,3 +1,16 @@ +2013-06-04 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20130604 + Merge with NetBSD make, pick up + o job.c: JobCreatePipe: do fcntl() after any tweaking of fd's + to avoid leaking descriptors. + +2013-05-28 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20130528 + Merge with NetBSD make, pick up + o var.c: cleanup some left-overs in VarHash() + 2013-05-20 Simon J. Gerraty * Makefile (MAKE_VERSION): 20130520 Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Wed Jun 5 15:52:24 2013 (r251421) +++ head/contrib/bmake/Makefile Wed Jun 5 16:12:50 2013 (r251422) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.12 2013/05/20 16:05:10 sjg Exp $ +# $Id: Makefile,v 1.14 2013/06/05 04:03:22 sjg Exp $ # Base version on src date -MAKE_VERSION= 20130520 +MAKE_VERSION= 20130604 PROG= bmake Modified: head/contrib/bmake/job.c ============================================================================== --- head/contrib/bmake/job.c Wed Jun 5 15:52:24 2013 (r251421) +++ head/contrib/bmake/job.c Wed Jun 5 16:12:50 2013 (r251422) @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $ */ +/* $NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $"); +__RCSID("$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -414,6 +414,15 @@ JobCreatePipe(Job *job, int minfd) if (pipe(job->jobPipe) == -1) Punt("Cannot create pipe: %s", strerror(errno)); + for (i = 0; i < 2; i++) { + /* Avoid using low numbered fds */ + fd = fcntl(job->jobPipe[i], F_DUPFD, minfd); + if (fd != -1) { + close(job->jobPipe[i]); + job->jobPipe[i] = fd; + } + } + /* Set close-on-exec flag for both */ (void)fcntl(job->jobPipe[0], F_SETFD, 1); (void)fcntl(job->jobPipe[1], F_SETFD, 1); @@ -426,15 +435,6 @@ JobCreatePipe(Job *job, int minfd) */ fcntl(job->jobPipe[0], F_SETFL, fcntl(job->jobPipe[0], F_GETFL, 0) | O_NONBLOCK); - - for (i = 0; i < 2; i++) { - /* Avoid using low numbered fds */ - fd = fcntl(job->jobPipe[i], F_DUPFD, minfd); - if (fd != -1) { - close(job->jobPipe[i]); - job->jobPipe[i] = fd; - } - } } /*- @@ -2828,6 +2828,8 @@ Job_ServerStart(int max_tokens, int jp_0 /* Pipe passed in from parent */ tokenWaitJob.inPipe = jp_0; tokenWaitJob.outPipe = jp_1; + (void)fcntl(jp_0, F_SETFD, 1); + (void)fcntl(jp_1, F_SETFD, 1); return; } Modified: head/contrib/bmake/make.1 ============================================================================== --- head/contrib/bmake/make.1 Wed Jun 5 15:52:24 2013 (r251421) +++ head/contrib/bmake/make.1 Wed Jun 5 16:12:50 2013 (r251422) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.213 2013/03/31 05:49:51 sjg Exp $ +.\" $NetBSD: make.1,v 1.215 2013/05/22 19:35:11 christos Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd March 30, 2013 +.Dd May 22, 2013 .Dt MAKE 1 .Os .Sh NAME @@ -2110,6 +2110,13 @@ for Sprite at Berkeley. It was designed to be a parallel distributed make running jobs on different machines using a daemon called .Dq customs . +.Pp +Historically the target/dependency +.Dq FRC +has been used to FoRCe rebuilding (since the target/dependency +does not exist... unless someone creates an +.Dq FRC +file). .Sh BUGS The .Nm Modified: head/contrib/bmake/var.c ============================================================================== --- head/contrib/bmake/var.c Wed Jun 5 15:52:24 2013 (r251421) +++ head/contrib/bmake/var.c Wed Jun 5 16:12:50 2013 (r251422) @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $ */ +/* $NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $"); +__RCSID("$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -2326,9 +2326,7 @@ VarHash(char *str) size_t len, len2; unsigned char *ustr = (unsigned char *)str; uint32_t h, k, c1, c2; - int done; - done = 1; h = 0x971e137bU; c1 = 0x95543787U; c2 = 0x2ad7eb25U; @@ -2358,7 +2356,7 @@ VarHash(char *str) h = (h << 13) ^ (h >> 19); h = h * 5 + 0x52dce729U; h ^= k; - } while (!done); + } h ^= len2; h *= 0x85ebca6b; h ^= h >> 13; Modified: head/usr.bin/bmake/Makefile ============================================================================== --- head/usr.bin/bmake/Makefile Wed Jun 5 15:52:24 2013 (r251421) +++ head/usr.bin/bmake/Makefile Wed Jun 5 16:12:50 2013 (r251422) @@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR} CLEANDIRS+= FreeBSD CLEANFILES+= bootstrap -# $Id: Makefile,v 1.12 2013/05/20 16:05:10 sjg Exp $ +# $Id: Makefile,v 1.14 2013/06/05 04:03:22 sjg Exp $ # Base version on src date -MAKE_VERSION= 20130520 +MAKE_VERSION= 20130604 PROG?= ${.CURDIR:T} From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 16:25:39 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F11CA82F for ; Wed, 5 Jun 2013 16:25:39 +0000 (UTC) (envelope-from scott4long@yahoo.com) Received: from nm48-vm7.bullet.mail.ne1.yahoo.com (nm48-vm7.bullet.mail.ne1.yahoo.com [98.138.121.119]) by mx1.freebsd.org (Postfix) with ESMTP id B779E11AF for ; Wed, 5 Jun 2013 16:25:39 +0000 (UTC) Received: from [98.138.90.56] by nm48.bullet.mail.ne1.yahoo.com with NNFMP; 05 Jun 2013 16:20:04 -0000 Received: from [98.138.84.41] by tm9.bullet.mail.ne1.yahoo.com with NNFMP; 05 Jun 2013 16:20:04 -0000 Received: from [127.0.0.1] by smtp109.mail.ne1.yahoo.com with NNFMP; 05 Jun 2013 16:20:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1370449204; bh=KIT0ZdNPozqdIjjsXRe0I5n4FKaKutkAYvjAKdllP/g=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Subject:Mime-Version:Content-Type:From:X-Priority:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=iFc7IYdwXjSPha1Bll/y/YcngHILVOfELE85Splx+XagFsysSbLigSktguHQXO5yQ/KOgENyPomqiI6MUqUmnl35nsqnvSrFrS1BWfVLCM01ykNNyXRIv+W0mIPSLBxNSbJ/mcQG2le9C8YNh28q67KtZdErEshKE963Y/1Iaec= X-Yahoo-Newman-Id: 162850.40359.bm@smtp109.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: U6tdZ8kVM1lQslKauY7GRm9xsb7VrouRT1qQkSSyh_nsAga Q7IfqFx9eruPTzg5hjl6UGEcdUQ4z1.fb95t6AgaBpMabdQqHdEM0ldREZvx nWNDL5LDw.pK19zSzpe3sFMwZwI1GtVhBLUlO089P0gYEcUtK.V_iR7kTeoJ aaKL5AYKxXG9zTLeCjaZyYbPENyGLLSBMRyy98PCVE14n3VLBdMQm1Sfwh23 sLtS1f_jr2F6Zmuf1T7.09x69Cui4TgAPr00ECV2Di9fSf8DVbP01er.jVJm IAnaTHvOMNAt9CalpGht3cAjuzpG3_ft.c2N7QaWQ9Cdq3zPtUuhQbiyWHAM a73mjhDxGWDFXVYEB5P2HLtGa826U.si6pnSDiIWmskfP5iVQ.e7l0FFCN2W HWNXQhYcYWZy4d4gHbdVZpR_xpbQ7gn9GonhwRBaPkeSUyy6xDSR4iIpztDk tlorYaipXB7oAzOEzFwz4iRfHBDhhC1c1hRdYOupYIqX4Vq7PWgJTSa62hOO U X-Yahoo-SMTP: clhABp.swBB7fs.LwIJpv3jkWgo2NU8- X-Rocket-Received: from phobos.samsco.home (scott4long@168.103.85.57 with ) by smtp109.mail.ne1.yahoo.com with SMTP; 05 Jun 2013 09:20:04 -0700 PDT Subject: Re: svn commit: r251372 - in stable/9/sys/cam: ata scsi Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Content-Type: text/plain; charset=iso-8859-1 From: Scott Long X-Priority: 3 In-Reply-To: <491E54742FDD4C299688DE36717EA531@multiplay.co.uk> Date: Wed, 5 Jun 2013 10:20:02 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <6F4A05CA-5C95-4862-9FBA-0352B7132214@yahoo.com> References: <201306041047.r54AljAX050733@svn.freebsd.org> <4A91EB3F-56FD-4E94-9981-0422032C9240@scsiguy.com> <491E54742FDD4C299688DE36717EA531@multiplay.co.uk> To: Steven Hartland X-Mailer: Apple Mail (2.1503) Cc: "Justin T. Gibbs" , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 16:25:40 -0000 On Jun 5, 2013, at 9:02 AM, Steven Hartland = wrote: >=20 >=20 > ----- Original Message ----- From: "Justin T. Gibbs" = >=20 >=20 > On Jun 4, 2013, at 3:47, Steven Hartland wrote: >=20 >> > Author: smh >> > Date: Tue Jun 4 10:47:44 2013 >> > New Revision: 251372 >> > URL: http://svnweb.freebsd.org/changeset/base/251372 >> > > Log: >> > Enhanced BIO_DELETE support for CAM SCSI to add ATA_TRIM support. >> > > Disable CAM BIO queue sorting for non-rotating media by default. >>=20 >> Using the elevator makes perfect sense even for random access devices = when >> operations can be merged. Even SSDs have fixed, per-command overheads = and >> merging writes may help prevent fragmentation. On drivers that = support >> unmapped I/O, merging should be fairly cheap. >>=20 >> It would be an interesting performance experiment. >=20 > In theory I'd agree but in practice this was not the case with bioq > becoming a noticable bottleneck for SSD based machines, hence this = change. >=20 > The sysctl's still allow this to be configured :) >=20 Completely agree. The bioq_disksort() only serves to burn CPU cycles = with the column lock held (thus burning even more CPU cycles elsewhere) = once the queue grows to any appreciable size. Merging of adjacent = segments happens (mostly) right now thanks to lock serialization in the = issuing path and g_down thread serialization. Furthermore, = bioq_disksort() has no concept of the cost of reads vs writes as they = pertain to SSDs. It's better to have the order be random and/or = somewhat separated thanks to operational serialization, than to try = extra hard to gets reads and writes close together. A much better I/O scheduler is needed. In our tests, bioq_disksort() is = worse than no i/o scheduler, so we've turned it off. We've tried = Luigi's scheduler, but it adds too much latency to our workload. I'm = working on a better scheme. Scott From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 17:00:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 001C14BD; Wed, 5 Jun 2013 17:00:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E62651346; Wed, 5 Jun 2013 17:00:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55H0APr064419; Wed, 5 Jun 2013 17:00:10 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55H0AT5064416; Wed, 5 Jun 2013 17:00:10 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201306051700.r55H0AT5064416@svn.freebsd.org> From: Alan Cox Date: Wed, 5 Jun 2013 17:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251423 - in head/sys: compat/linprocfs dev/hwpmc fs/procfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 17:00:11 -0000 Author: alc Date: Wed Jun 5 17:00:10 2013 New Revision: 251423 URL: http://svnweb.freebsd.org/changeset/base/251423 Log: Relax the vm object locking. Use a read lock. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/dev/hwpmc/hwpmc_mod.c head/sys/fs/procfs/procfs_map.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Wed Jun 5 16:12:50 2013 (r251422) +++ head/sys/compat/linprocfs/linprocfs.c Wed Jun 5 17:00:10 2013 (r251423) @@ -1031,9 +1031,9 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) e_end = entry->end; obj = entry->object.vm_object; for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { - VM_OBJECT_WLOCK(tobj); + VM_OBJECT_RLOCK(tobj); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); lobj = tobj; } last_timestamp = map->timestamp; @@ -1049,11 +1049,11 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) else vp = NULL; if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); flags = obj->flags; ref_count = obj->ref_count; shadow_count = obj->shadow_count; - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); if (vp) { vn_fullpath(td, vp, &name, &freename); vn_lock(vp, LK_SHARED | LK_RETRY); Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Wed Jun 5 16:12:50 2013 (r251422) +++ head/sys/dev/hwpmc/hwpmc_mod.c Wed Jun 5 17:00:10 2013 (r251423) @@ -1672,7 +1672,7 @@ pmc_log_process_mappings(struct pmc_owne } obj = entry->object.vm_object; - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); /* * Walk the backing_object list to find the base @@ -1680,9 +1680,9 @@ pmc_log_process_mappings(struct pmc_owne */ for (lobj = tobj = obj; tobj != NULL; tobj = tobj->backing_object) { if (tobj != obj) - VM_OBJECT_WLOCK(tobj); + VM_OBJECT_RLOCK(tobj); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); lobj = tobj; } @@ -1692,14 +1692,14 @@ pmc_log_process_mappings(struct pmc_owne if (lobj == NULL) { PMCDBG(LOG,OPS,2, "hwpmc: lobj unexpectedly NULL! pid=%d " "vm_map=%p vm_obj=%p\n", p->p_pid, map, obj); - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); continue; } if (lobj->type != OBJT_VNODE || lobj->handle == NULL) { if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(lobj); + VM_OBJECT_RUNLOCK(obj); continue; } @@ -1711,8 +1711,8 @@ pmc_log_process_mappings(struct pmc_owne if (entry->start == last_end && lobj->handle == last_vp) { last_end = entry->end; if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(lobj); + VM_OBJECT_RUNLOCK(obj); continue; } @@ -1734,9 +1734,9 @@ pmc_log_process_mappings(struct pmc_owne vp = lobj->handle; vref(vp); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); freepath = NULL; pmc_getfilename(vp, &fullpath, &freepath); Modified: head/sys/fs/procfs/procfs_map.c ============================================================================== --- head/sys/fs/procfs/procfs_map.c Wed Jun 5 16:12:50 2013 (r251422) +++ head/sys/fs/procfs/procfs_map.c Wed Jun 5 17:00:10 2013 (r251423) @@ -132,7 +132,7 @@ procfs_doprocmap(PFS_FILL_ARGS) privateresident = 0; obj = entry->object.vm_object; if (obj != NULL) { - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); if (obj->shadow_count == 1) privateresident = obj->resident_page_count; } @@ -148,9 +148,9 @@ procfs_doprocmap(PFS_FILL_ARGS) for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { if (tobj != obj) - VM_OBJECT_WLOCK(tobj); + VM_OBJECT_RLOCK(tobj); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); lobj = tobj; } last_timestamp = map->timestamp; @@ -181,12 +181,12 @@ procfs_doprocmap(PFS_FILL_ARGS) break; } if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); flags = obj->flags; ref_count = obj->ref_count; shadow_count = obj->shadow_count; - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); if (vp != NULL) { vn_fullpath(td, vp, &fullpath, &freepath); vrele(vp); From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 17:02:22 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4B746811; Wed, 5 Jun 2013 17:02:22 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3D8481366; Wed, 5 Jun 2013 17:02:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55H2M35066644; Wed, 5 Jun 2013 17:02:22 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55H2Mpl066643; Wed, 5 Jun 2013 17:02:22 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201306051702.r55H2Mpl066643@svn.freebsd.org> From: Brooks Davis Date: Wed, 5 Jun 2013 17:02:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251424 - head/usr.bin/xinstall X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 17:02:22 -0000 Author: brooks Date: Wed Jun 5 17:02:21 2013 New Revision: 251424 URL: http://svnweb.freebsd.org/changeset/base/251424 Log: New install flags were merged to 9-STABLE and will appear in FreeBSD-9.2. Sponsored by: DARPA, AFRL Submitted by: ru MFC after: 3 days Modified: head/usr.bin/xinstall/install.1 Modified: head/usr.bin/xinstall/install.1 ============================================================================== --- head/usr.bin/xinstall/install.1 Wed Jun 5 17:00:10 2013 (r251423) +++ head/usr.bin/xinstall/install.1 Wed Jun 5 17:02:21 2013 (r251424) @@ -351,7 +351,7 @@ utility appeared in The meaning of the .Fl M option has changed as of -.Fx 10 +.Fx 9.2 and it now takes an argument. Command lines that used the old .Fl M From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 17:27:59 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EE5B978; Wed, 5 Jun 2013 17:27:59 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D02AA1657; Wed, 5 Jun 2013 17:27:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55HRxPs073940; Wed, 5 Jun 2013 17:27:59 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55HRxue073939; Wed, 5 Jun 2013 17:27:59 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201306051727.r55HRxue073939@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 5 Jun 2013 17:27:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251425 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 17:28:00 -0000 Author: luigi Date: Wed Jun 5 17:27:59 2013 New Revision: 251425 URL: http://svnweb.freebsd.org/changeset/base/251425 Log: - fix a bug in the previous commit that was dropping the last packet from each batch flowing on the VALE switch - feature: add glue for 'indirect' buffers on the sender side: if a slot has NS_INDIRECT set, the netmap buffer contains pointer(s) to the actual userspace buffers, which are accessed with copyin(). The feature is not finalised yet, as it will likely need to deal with some iovec variant for proper scatter/gather support. This will save one copy for clients (e.g. qemu) that cannot use the netmap buffer directly. A curiosity: on amd64 copyin() appears to be 10-15% faster than pkt_copy() or bcopy() at least for sizes of 256 and greater. Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Wed Jun 5 17:02:21 2013 (r251424) +++ head/sys/dev/netmap/netmap.c Wed Jun 5 17:27:59 2013 (r251425) @@ -188,8 +188,9 @@ static int kern_netmap_regif(struct nmre /* per-tx-queue entry */ struct nm_bdg_fwd { /* forwarding entry for a bridge */ - void *buf; - uint32_t ft_dst; /* dst port */ + void *ft_buf; + uint16_t _ft_dst; /* dst port, unused */ + uint16_t ft_flags; /* flags, e.g. indirect */ uint16_t ft_len; /* src len */ uint16_t ft_next; /* next packet to same destination */ }; @@ -2289,8 +2290,10 @@ bdg_netmap_start(struct ifnet *ifp, stru if (!na->na_bdg) /* SWNA is not configured to be attached */ return EBUSY; m_copydata(m, 0, len, buf); + ft->ft_flags = 0; // XXX could be indirect ? ft->ft_len = len; - ft->buf = buf; + ft->ft_buf = buf; + ft->ft_next = NM_BDG_BATCH; // XXX is it needed ? nm_bdg_flush(ft, 1, na, 0); /* release the mbuf in either cases of success or failure. As an @@ -2435,12 +2438,19 @@ nm_bdg_preflush(struct netmap_adapter *n for (; likely(j != end); j = unlikely(j == lim) ? 0 : j+1) { struct netmap_slot *slot = &ring->slot[j]; + char *buf = NMB(slot); int len = ft[ft_i].ft_len = slot->len; - char *buf = ft[ft_i].buf = NMB(slot); - prefetch(buf); + ft[ft_i].ft_flags = slot->flags; + + ND("flags is 0x%x", slot->flags); + /* this slot goes into a list so initialize the link field */ + ft[ft_i].ft_next = NM_BDG_BATCH; /* equivalent to NULL */ if (unlikely(len < 14)) continue; + buf = ft[ft_i].ft_buf = (slot->flags & NS_INDIRECT) ? + *((void **)buf) : buf; + prefetch(buf); if (unlikely(++ft_i == netmap_bridge)) ft_i = nm_bdg_flush(ft, ft_i, na, ring_nr); } @@ -2935,7 +2945,7 @@ nm_bdg_flush(struct nm_bdg_fwd *ft, int /* first pass: find a destination */ for (i = 0; likely(i < n); i++) { - uint8_t *buf = ft[i].buf; + uint8_t *buf = ft[i].ft_buf; uint8_t dst_ring = ring_nr; uint16_t dst_port, d_i; struct nm_bdg_q *d; @@ -2960,9 +2970,10 @@ nm_bdg_flush(struct nm_bdg_fwd *ft, int /* remember this position to be scanned later */ if (dst_port != NM_BDG_BROADCAST) dsts[num_dsts++] = d_i; + } else { + ft[d->bq_tail].ft_next = i; + d->bq_tail = i; } - ft[d->bq_tail].ft_next = i; - d->bq_tail = i; } /* if there is a broadcast, set ring 0 of all ports to be scanned @@ -3043,20 +3054,36 @@ retry: struct netmap_slot *slot; struct nm_bdg_fwd *ft_p; + /* our 'NULL' is always higher than valid indexes + * so we never dereference it if the other list + * has packets (and if both are NULL we never + * get here). + */ if (next < brd_next) { ft_p = ft + next; next = ft_p->ft_next; + ND("j %d uni %d next %d %d", + j, ft_p - ft, next, brd_next); } else { /* insert broadcast */ ft_p = ft + brd_next; brd_next = ft_p->ft_next; + ND("j %d brd %d next %d %d", + j, ft_p - ft, next, brd_next); } slot = &ring->slot[j]; ND("send %d %d bytes at %s:%d", i, ft_p->ft_len, dst_ifp->if_xname, j); - pkt_copy(ft_p->buf, NMB(slot), ft_p->ft_len); + if (ft_p->ft_flags & NS_INDIRECT) { + ND("copying from INDIRECT source"); + copyin(ft_p->ft_buf, NMB(slot), + (ft_p->ft_len + 63) & ~63); + } else { + pkt_copy(ft_p->ft_buf, NMB(slot), ft_p->ft_len); + } slot->len = ft_p->ft_len; - j = (j == lim) ? 0: j + 1; /* XXX to be macro-ed */ + j = unlikely(j == lim) ? 0: j + 1; /* XXX to be macro-ed */ sent++; - if (next == d->bq_tail && brd_next == brddst->bq_tail) + /* are we done ? */ + if (next == NM_BDG_BATCH && brd_next == NM_BDG_BATCH) break; } if (netmap_verbose && (howmany < 0)) @@ -3078,6 +3105,7 @@ retry: goto retry; dst_na->nm_lock(dst_ifp, NETMAP_TX_UNLOCK, dst_nr); } + /* NM_BDG_BATCH means 'no packet' */ d->bq_head = d->bq_tail = NM_BDG_BATCH; /* cleanup */ } brddst->bq_head = brddst->bq_tail = NM_BDG_BATCH; /* cleanup */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 17:38:00 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7E480424; Wed, 5 Jun 2013 17:38:00 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 704FE16DB; Wed, 5 Jun 2013 17:38:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55Hc052076999; Wed, 5 Jun 2013 17:38:00 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55Hc06J076998; Wed, 5 Jun 2013 17:38:00 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201306051738.r55Hc06J076998@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 5 Jun 2013 17:38:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251426 - head/tools/tools/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 17:38:00 -0000 Author: luigi Date: Wed Jun 5 17:37:59 2013 New Revision: 251426 URL: http://svnweb.freebsd.org/changeset/base/251426 Log: new features (mostly for testing netmap capabilities) + pkt-gen -f rx now remains active even when traffic stops Previous behaviour (exit after 1 second of silence) can be restored with the -W option + the -X option does a hexdump of the content of a packet (both tx and rx). This can be useful to check what goes in and out. + the -I option instructs the sender to use indirect buffers (not really useful other than to test the kernel module in the VALE switch) Modified: head/tools/tools/netmap/pkt-gen.c Modified: head/tools/tools/netmap/pkt-gen.c ============================================================================== --- head/tools/tools/netmap/pkt-gen.c Wed Jun 5 17:27:59 2013 (r251425) +++ head/tools/tools/netmap/pkt-gen.c Wed Jun 5 17:37:59 2013 (r251426) @@ -38,6 +38,8 @@ #include "nm_util.h" +#include // isprint() + const char *default_payload="netmap pkt-gen payload\n" "http://info.iet.unipi.it/~luigi/netmap/ "; @@ -86,6 +88,8 @@ struct glob_arg { #define OPT_COPY 4 #define OPT_MEMCPY 8 #define OPT_TS 16 /* add a timestamp */ +#define OPT_INDIRECT 32 /* use indirect buffers, tx only */ +#define OPT_DUMP 64 /* dump rx/tx traffic */ int dev_type; pcap_t *p; @@ -346,6 +350,33 @@ wrapsum(u_int32_t sum) return (htons(sum)); } +/* Check the payload of the packet for errors (use it for debug). + * Look for consecutive ascii representations of the size of the packet. + */ +static void +dump_payload(char *p, int len, struct netmap_ring *ring, int cur) +{ + char buf[128]; + int i, j, i0; + + /* get the length in ASCII of the length of the packet. */ + + printf("ring %p cur %5d len %5d buf %p\n", ring, cur, len, p); + /* hexdump routine */ + for (i = 0; i < len; ) { + memset(buf, sizeof(buf), ' '); + sprintf(buf, "%5d: ", i); + i0 = i; + for (j=0; j < 16 && i < len; i++, j++) + sprintf(buf+7+j*3, "%02x ", (uint8_t)(p[i])); + i = i0; + for (j=0; j < 16 && i < len; i++, j++) + sprintf(buf+7+j + 48, "%c", + isprint(p[i]) ? p[i] : '.'); + printf("%s\n", buf); + } +} + /* * Fill a packet with some payload. * We create a UDP packet so the payload starts at @@ -357,6 +388,7 @@ wrapsum(u_int32_t sum) #define uh_ulen len #define uh_sum check #endif /* linux */ + static void initialize_packet(struct targ *targ) { @@ -365,11 +397,13 @@ initialize_packet(struct targ *targ) struct ip *ip; struct udphdr *udp; uint16_t paylen = targ->g->pkt_size - sizeof(*eh) - sizeof(struct ip); - int i, l, l0 = strlen(default_payload); + const char *payload = targ->g->options & OPT_INDIRECT ? + "XXXXXXXXXXXXXXXXXXXXXX" : default_payload; + int i, l, l0 = strlen(payload); for (i = 0; i < paylen;) { l = min(l0, paylen - i); - bcopy(default_payload, pkt->body + i, l); + bcopy(payload, pkt->body + i, l); i += l; } pkt->body[i-1] = '\0'; @@ -415,34 +449,9 @@ initialize_packet(struct targ *targ) bcopy(&targ->g->src_mac.start, eh->ether_shost, 6); bcopy(&targ->g->dst_mac.start, eh->ether_dhost, 6); eh->ether_type = htons(ETHERTYPE_IP); + // dump_payload((void *)pkt, targ->g->pkt_size, NULL, 0); } -/* Check the payload of the packet for errors (use it for debug). - * Look for consecutive ascii representations of the size of the packet. - */ -static void -check_payload(char *p, int psize) -{ - char temp[64]; - int n_read, size, sizelen; - - /* get the length in ASCII of the length of the packet. */ - sizelen = sprintf(temp, "%d", psize) + 1; // include a whitespace - - /* dummy payload. */ - p += 14; /* skip packet header. */ - n_read = 14; - while (psize - n_read >= sizelen) { - sscanf(p, "%d", &size); - if (size != psize) { - D("Read %d instead of %d", size, psize); - break; - } - - p += sizelen; - n_read += sizelen; - } -} /* @@ -475,7 +484,13 @@ send_packets(struct netmap_ring *ring, s struct netmap_slot *slot = &ring->slot[cur]; char *p = NETMAP_BUF(ring, slot->buf_idx); - if (options & OPT_COPY) + slot->flags = 0; + if (options & OPT_DUMP) + dump_payload(p, size, ring, cur); + if (options & OPT_INDIRECT) { + slot->flags |= NS_INDIRECT; + *((struct pkt **)(void *)p) = pkt; + } else if (options & OPT_COPY) pkt_copy(pkt, p, size); else if (options & OPT_MEMCPY) memcpy(p, pkt, size); @@ -756,6 +771,7 @@ sender_body(void *data) struct timespec tmptime, nexttime = { 0, 0}; // XXX silence compiler int rate_limit = targ->g->tx_rate; long long waited = 0; + D("start"); if (setaffinity(targ->thread, targ->affinity)) goto quit; @@ -882,7 +898,7 @@ receive_pcap(u_char *user, const struct } static int -receive_packets(struct netmap_ring *ring, u_int limit, int skip_payload) +receive_packets(struct netmap_ring *ring, u_int limit, int dump) { u_int cur, rx; @@ -893,8 +909,9 @@ receive_packets(struct netmap_ring *ring struct netmap_slot *slot = &ring->slot[cur]; char *p = NETMAP_BUF(ring, slot->buf_idx); - if (!skip_payload) - check_payload(p, slot->len); + slot->flags = OPT_INDIRECT; // XXX + if (dump) + dump_payload(p, slot->len, ring, cur); cur = NETMAP_RING_NEXT(ring, cur); } @@ -946,6 +963,7 @@ receiver_body(void *data) targ->count++; } } else { + int dump = targ->g->options & OPT_DUMP; while (!targ->cancel) { /* Once we started to receive packets, wait at most 1 seconds before quitting. */ @@ -962,8 +980,7 @@ receiver_body(void *data) if (rxring->avail == 0) continue; - m = receive_packets(rxring, targ->g->burst, - SKIP_PAYLOAD); + m = receive_packets(rxring, targ->g->burst, dump); received += m; } targ->count = received; @@ -1324,10 +1341,11 @@ main(int arc, char **argv) g.burst = 512; // default g.nthreads = 1; g.cpus = 1; + g.forever = 1; g.tx_rate = 0; while ( (ch = getopt(arc, argv, - "a:f:n:i:t:r:l:d:s:D:S:b:c:o:p:PT:w:WvR:")) != -1) { + "a:f:n:i:It:r:l:d:s:D:S:b:c:o:p:PT:w:WvR:X")) != -1) { struct sf *fn; switch(ch) { @@ -1367,6 +1385,10 @@ main(int arc, char **argv) g.dev_type = DEV_NETMAP; break; + case 'I': + g.options |= OPT_INDIRECT; /* XXX use indirect buffer */ + break; + case 't': /* send, deprecated */ D("-t deprecated, please use -f tx -n %s", optarg); g.td_body = sender_body; @@ -1399,8 +1421,8 @@ main(int arc, char **argv) wait_link = atoi(optarg); break; - case 'W': - g.forever = 1; /* do not exit rx even with no traffic */ + case 'W': /* XXX changed default */ + g.forever = 0; /* do not exit rx even with no traffic */ break; case 'b': /* burst */ @@ -1430,6 +1452,8 @@ main(int arc, char **argv) case 'R': g.tx_rate = atoi(optarg); break; + case 'X': + g.options |= OPT_DUMP; } } @@ -1572,10 +1596,11 @@ main(int arc, char **argv) } if (g.options) { - D("special options:%s%s%s%s\n", + D("--- SPECIAL OPTIONS:%s%s%s%s%s\n", g.options & OPT_PREFETCH ? " prefetch" : "", g.options & OPT_ACCESS ? " access" : "", g.options & OPT_MEMCPY ? " memcpy" : "", + g.options & OPT_INDIRECT ? " indirect" : "", g.options & OPT_COPY ? " copy" : ""); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 17:55:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1A085D7A; Wed, 5 Jun 2013 17:55:02 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qa0-x229.google.com (mail-qa0-x229.google.com [IPv6:2607:f8b0:400d:c00::229]) by mx1.freebsd.org (Postfix) with ESMTP id AF45217C5; Wed, 5 Jun 2013 17:55:01 +0000 (UTC) Received: by mail-qa0-f41.google.com with SMTP id bn16so3529300qab.0 for ; Wed, 05 Jun 2013 10:55:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=UxvgsCM2qVIa2uB64mghgg6O6zPJ0wWo3hYVLcuPm6Q=; b=cEsoR8hIqgkk1W5R6pRTpEW8Sj6S1gU+9BIWxVOqj6rT8xD9QerXUKbZs71ZjRa4ZU vRRAHYWTI9fPvUdJxQ+VrvwQRZpaG7HDULwQA/xRSWmS14hBqGLYcLTPcW0/0DMyFGgC vPh9QIMfN9kIv7/aVcQ3y4sle6I3kx3k4RDgMlj9JRks4yRKXFwuvaS6jcxD/Wd+GEEj nVQqYs3DREH+pTIBOHct2gNVxomuocMHQ39GkN5AToPpJmZoKWjKuuQxV/34Sv5Nvx9b fDDdBXsUKaY8HfCT66WAxtKI4Uvu+S7+xqiD18ofg7tb3A/1GFMQwm98f0+p1KfM3qiK SxeQ== MIME-Version: 1.0 X-Received: by 10.229.252.132 with SMTP id mw4mr3539588qcb.47.1370454900717; Wed, 05 Jun 2013 10:55:00 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.71.12 with HTTP; Wed, 5 Jun 2013 10:55:00 -0700 (PDT) In-Reply-To: <51AF2AE8.4080308@mu.org> References: <201306030416.r534GmCA001872@svn.freebsd.org> <51AC1B49.9090001@mu.org> <20130603075539.GK3047@kib.kiev.ua> <51AC60CA.6050105@mu.org> <20130604052219.GP3047@kib.kiev.ua> <20130604170410.M1018@besplex.bde.org> <51AF2AE8.4080308@mu.org> Date: Wed, 5 Jun 2013 10:55:00 -0700 X-Google-Sender-Auth: c02oHFGdEFShsEXFMqKWxepBnz8 Message-ID: Subject: Re: svn commit: r251282 - head/sys/kern From: Adrian Chadd To: Alfred Perlstein Content-Type: text/plain; charset=ISO-8859-1 Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 17:55:02 -0000 ... can people please boot an i386 kernel w/ this stuff in it, with the RAM constrained to something small (say, 128mb), and verify that you can at least start a buildworld (minus clang, of course) without panicing? There's a recent PR (http://www.freebsd.org/cgi/query-pr.cgi?pr=179112) which shows regressions on i386 + small RAM platforms. I know it's a different area, but I'd really appreciate it if people better tested this stuff out before they make i386 (and by extension, any platform with limited KVA and small amounts of RAM) unusable through carelessness. Thanks, Adrian On 5 June 2013 05:11, Alfred Perlstein wrote: > > Konstantin, is there any way to take some of Bruce's feedback into account > to get rid of the hard coded max? > > -Alfred > > > On 6/4/13 1:14 AM, Bruce Evans wrote: >> >> On Tue, 4 Jun 2013, Konstantin Belousov wrote: >> >>> On Mon, Jun 03, 2013 at 02:24:26AM -0700, Alfred Perlstein wrote: >>>> >>>> On 6/3/13 12:55 AM, Konstantin Belousov wrote: >>>>> >>>>> On Sun, Jun 02, 2013 at 09:27:53PM -0700, Alfred Perlstein wrote: >>>>>> >>>>>> Hey Konstaintin, shouldn't this be scaled against the actual amount of >>>>>> KVA we have instead of an arbitrary limit? >>>>> >>>>> The commit changes the buffer cache to scale according to the available >>>>> KVA, making the scaling less dumb. >>>>> >>>>> I do not understand what exactly do you want to do, please describe the >>>>> algorithm you propose to implement instead of my change. >>>> >>>> >>>> Sure, how about deriving the hardcoded "32" from the maxkva a machine >>>> can have? >>>> >>>> Is that possible? >>> >>> I do not see why this would be useful. Initially I thought about simply >>> capping nbuf at 100000 without referencing any "memory". Then I realized >>> that this would somewhat conflict with (unlikely) changes to the value >>> of BKVASIZE due to "factor". >> >> >> The presence of BKVASIZE in 'factor' is a bug. My version never had this >> bug (see below for a patch). The scaling should be to maximize nbuf, >> subject to non-arbitrary limits on physical memory and kva, and now an >> arbirary limit of about 100000 / (BKVASIZE / 16384) on nbuf. Your new >> limit is arbitrary so it shouldn't affect nbuf depending on BKVASIZE. >> >> Expanding BKVASIZE should expand kva use, but on i386 this will soon >> hit a non-arbitary kva limit so nbuf will not be as high as preferred. >> nbuf needs to be very large mainly to support file systems with small >> buffers. Even 100000 only gives 50MB of buffering if the fs block >> size is 512. This would shrink to only 12.5MB if BKVASIZE is expanded >> by a factor of 4 and the bug is not fixed. If 25000 buffers after >> expanding BKVASIZE is enough, then that should be the arbitary limit >> (independent of BKVASIZE) so as to save physical memory. >> >> On i386 systems with 1GB RAM, nbuf defaults to about 7000. With an >> fs block size of 512, that can buffer 3.5MB. Expanding BKVASIZE by a >> factor of 4 shrinks this to 0.875MB in -current. That is ridiculously >> small. VMIO limits the lossage from this. >> >> BKVASIZE was originally 8KB. I forget if nbuf was halved by not modifying >> the scale factor when it was expanded to 16KB. Probably not. I used to >> modify the scale factor to get twice as many as the default nbuf, but >> once the default nbuf expanded to a few thousand it became large enough >> for most purposes so I no longer do this. >> >> Except on arches with extremely limit kva like i386, KVASIZE should be >> MAXBSIZE, and all of the complications for expanding a buffer's kva >> beyond BKVASIZE and handling the fragmentation problems caused by this >> shouldn't exist. Limits like vfs.maxbufspace should be scaled by >> NOMBSIZE = current BKVASIZE instead of BKVASIZE. Oops, my NOMBSIZE >> has similar logical problems to BKVASIZE. It needs to be precisely >> 16KB to preserve the defaults for nbuf and maxbufspace, but the nominal >> (ffs) buffer size is now 32KB. So the heuristic scale factors should >> use the historical magic number 16K. I changed sequential_heuristic() >> to use a hard-coded 16K instead of BKVASIZE. The correct number here >> depends on disk technology. >> >> The patch has many style fixes: >> >> @ Index: vfs_bio.c >> @ =================================================================== >> @ RCS file: /home/ncvs/src/sys/kern/vfs_bio.c,v >> @ retrieving revision 1.436 >> @ diff -u -2 -r1.436 vfs_bio.c >> @ --- vfs_bio.c 17 Jun 2004 17:16:49 -0000 1.436 >> @ +++ vfs_bio.c 3 Jun 2013 16:04:34 -0000 >> @ @@ -419,64 +493,54 @@ >> @ @ /* >> @ - * Calculating buffer cache scaling values and reserve space for buffer >> @ + * Calculate buffer cache scaling values and reserve space for buffer >> @ * headers. This is called during low level kernel initialization and >> @ * may be called more then once. We CANNOT write to the memory area >> @ * being reserved at this time. >> @ */ >> @ -caddr_t >> @ -kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) >> @ +void * >> @ +vfs_bio_alloc(void *va) >> >> The API name was verbose and bogus. The prefix for this subsystem is >> vfs_bio_, not kern_vfs_bio_. This is a generic allocation routine. >> It always allocated swbufs and has expanded to do more allocations. >> >> @ { >> @ - /* >> @ - * physmem_est is in pages. Convert it to kilobytes (assumes >> @ - * PAGE_SIZE is >= 1K) >> @ - */ >> @ - physmem_est = physmem_est * (PAGE_SIZE / 1024); >> >> I use the global physmem. This change may be too i386-specific. In >> with 8-16 RAM, a significant amount of RAM may be eaten by the kernel >> image or perhaps just unavailable to the kernel. Now memories are >> larger and the amount eaten is relatively insignificant (since we are >> only using a small fraction of physmem, only the relative error matters). >> >> @ + int factor, memsize; >> @ @ /* >> @ - * The nominal buffer size (and minimum KVA allocation) is >> BKVASIZE. >> @ - * For the first 64MB of ram nominally allocate sufficient buffers >> to >> @ - * cover 1/4 of our ram. Beyond the first 64MB allocate additional >> @ - * buffers to cover 1/20 of our ram over 64MB. When auto-sizing >> @ - * the buffer cache we limit the eventual kva reservation to >> @ + * The nominal buffer size is NOMBSIZE. >> @ + * For the first 4MB of RAM, allocate 50 buffers. >> @ + * For the next 60MB of RAM, nominally allocate sufficient buffers >> to >> @ + * cover 1/4 of the RAM. Beyond the first 64MB allocate additional >> @ + * buffers to cover 1/20 of the RAM. When auto-sizing >> @ + * the buffer cache, limit the eventual kva reservation to >> @ * maxbcache bytes. >> >> Fix old bitrot in this comment, and update for my changes. >> - the first 4MB wasn't mentioned >> - the minimum clamp wasn't mentioned >> - replace BKVASIZE by NOMBSIZE so that I can change BKVASIZE without >> changing the default nbuf (subject to maxbcache). >> >> The bitrot of the magic number 1/20 is not fixed. The code uses 1/10. >> This is fixed in -current. I should have noticed this before, since >> I used to have to change the code to get 1/10 instead of 1/20. >> >> I hope you updated the comment for recent changes, but I don't like >> having magic numbers in comments. >> >> @ * >> @ - * factor represents the 1/4 x ram conversion. >> @ + * `factor' represents the 1/4 of RAM conversion. >> @ */ >> @ +#define NOMBSIZE imax(PAGE_SIZE, 16384) /* XXX */ >> @ if (nbuf == 0) { >> @ - int factor = 4 * BKVASIZE / 1024; >> @ + /* >> @ + * physmem is in pages. Convert it to a size in kilobytes. >> @ + * XXX no ptob(). >> @ + */ >> @ + memsize = ctob(physmem) / 1024; >> @ @ + factor = 4 * NOMBSIZE / 1024; >> @ nbuf = 50; >> @ - if (physmem_est > 4096) >> @ - nbuf += min((physmem_est - 4096) / factor, >> @ - 65536 / factor); >> @ - if (physmem_est > 65536) >> @ - nbuf += (physmem_est - 65536) * 2 / (factor * 5); >> @ - >> @ - if (maxbcache && nbuf > maxbcache / BKVASIZE) >> @ - nbuf = maxbcache / BKVASIZE; >> >> The maxbcache limit must be applied to the non-default nbuf too. >> >> @ + if (memsize > 4096) >> @ + nbuf += imin((memsize - 4096) / factor, >> @ + (65536 - 4096) / factor); >> @ + if (memsize > 65536) >> @ + nbuf += (memsize - 65536) * 2 / (factor * 5); >> @ } >> @ - >> @ -#if 0 >> @ - /* >> @ - * Do not allow the buffer_map to be more then 1/2 the size of the >> @ - * kernel_map. >> @ - */ >> @ - if (nbuf > (kernel_map->max_offset - kernel_map->min_offset) / @ - >> (BKVASIZE * 2)) { >> @ - nbuf = (kernel_map->max_offset - kernel_map->min_offset) / @ - >> (BKVASIZE * 2); >> @ - printf("Warning: nbufs capped at %d\n", nbuf); >> @ - } >> @ -#endif >> >> Already removed in -current. >> >> @ + if (nbuf > maxbcache / BKVASIZE) >> @ + nbuf = maxbcache / BKVASIZE; >> @ @ /* >> @ * swbufs are used as temporary holders for I/O, such as paging >> I/O. >> @ - * We have no less then 16 and no more then 256. >> @ + * There must be between 16 and 256 of them. >> @ */ >> @ - nswbuf = max(min(nbuf/4, 256), 16); >> @ + nswbuf = imax(imin(nbuf / 4, 256), 16); >> @ #ifdef NSWBUF_MIN >> @ if (nswbuf < NSWBUF_MIN) >> @ nswbuf = NSWBUF_MIN; >> @ #endif >> @ + >> @ #ifdef DIRECTIO >> @ ffs_rawread_setup(); >> @ @@ -484,12 +548,12 @@ >> @ @ /* >> @ - * Reserve space for the buffer cache buffers >> @ + * Reserve space for swbuf headers and buffer cache buffers. >> @ */ >> @ - swbuf = (void *)v; >> @ - v = (caddr_t)(swbuf + nswbuf); >> @ - buf = (void *)v; >> @ - v = (caddr_t)(buf + nbuf); >> @ + swbuf = va; >> @ + va = swbuf + nswbuf; >> @ + buf = va; >> @ + va = buf + nbuf; >> @ @ - return(v); >> @ + return (va); >> @ } >> @ >> >> Don't use the caddr_t mistake. The API was also changed to not use it. >> >> Bruce >> > From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 17:58:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3821623C; Wed, 5 Jun 2013 17:58:27 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qe0-f44.google.com (mail-qe0-f44.google.com [209.85.128.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9D25D17F6; Wed, 5 Jun 2013 17:58:26 +0000 (UTC) Received: by mail-qe0-f44.google.com with SMTP id 6so1271037qeb.31 for ; Wed, 05 Jun 2013 10:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=qHxdhy24Lziv434xjQS3UcSNhdWD5FwNv6OAmbSPuMg=; b=Fn/omwfguxwhTLOjAd5xSMgnFFPkzB6/WqNktnDvUgla7Yt0w08VUvVr4/95ia7gFx C31gPKsSupxiIC/aVRWTRJJULTqRlj1TvdpzExo/ku8HkQOLl1J7RscYBqUPt3/rnb+d J2KXzPDfT/rNoFYtgoHEHsxEVi/O2vl5zjId6C/L18edeJZf16D8lA+YMN3ZqpfbyDGI juZqBbd8dw4NP5K3NuPkVIWlLEFfGS8BNSFibRScFyZCGHnRyjZmEGST7CaiK5poVKpc j3NbjslE9gwOQ6llwwaW7fibKMowNNB+EGO+MyxnUmwGSCQZWZKL0DjWU+OykwDwl4Me tvTw== MIME-Version: 1.0 X-Received: by 10.49.28.35 with SMTP id y3mr34294745qeg.7.1370455100011; Wed, 05 Jun 2013 10:58:20 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.71.12 with HTTP; Wed, 5 Jun 2013 10:58:19 -0700 (PDT) In-Reply-To: <51AED722.8000504@freebsd.org> References: <201306031300.r53D0XUx092178@svn.freebsd.org> <51AED1F3.2060003@freebsd.org> <51AED722.8000504@freebsd.org> Date: Wed, 5 Jun 2013 10:58:19 -0700 X-Google-Sender-Auth: Ktobe58Dkaty9Hy9wOHziHQ2ijo Message-ID: Subject: Re: svn commit: r251297 - head/sys/dev/xen/netfront From: Adrian Chadd To: Colin Percival Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, Lawrence Stewart , svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 17:58:27 -0000 On 4 June 2013 23:13, Colin Percival wrote: > The comment above (of which only the last line is quoted in the diff) > explains it: > * This limit is imposed by the backend driver. We assume here that > * we are dealing with a Linux driver domain and have set our limit > * to mirror the Linux MAX_SKB_FRAGS constant. Then can you please create a "This is the linux limitation" rather than deriving it from a set of FreeBSD #define's ? Right now you're defining it based on the system page size _and_ some FreeBSD mbuf limit, rather than adding in the Linux versions of those as separate defines. Which honestly, they should be. Then you could add a compile time assert to ensure that the maximum segment size makes sense given both the linux constraints and the FreeBSD constraints. Otherwise looking at the code by itself isn't enough to know that it's a Linux-imposed limitation. Thanks, Adrian (Who has been knee-deep in this xen crap before, and would've appreciated these kinds of comments in the network driver.) From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 18:42:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F34BD334; Wed, 5 Jun 2013 18:42:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D5A681A43; Wed, 5 Jun 2013 18:42:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55Igirb098260; Wed, 5 Jun 2013 18:42:44 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55IgifW098256; Wed, 5 Jun 2013 18:42:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201306051842.r55IgifW098256@svn.freebsd.org> From: Alexander Motin Date: Wed, 5 Jun 2013 18:42:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251427 - stable/9/sys/dev/sound/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 18:42:45 -0000 Author: mav Date: Wed Jun 5 18:42:44 2013 New Revision: 251427 URL: http://svnweb.freebsd.org/changeset/base/251427 Log: MFC r250286: Some fixes to snd_envy24ht(4) driver: - Allow DMA addresses anywhere in the lower 4GB; Envy24HT has a 32-bit DMA engine, not 28-bit like Envy24. - Mark interrupt handler as MPSAFE, seems to be correctly synchronized. PR: kern/152378 Submitted by: Jason Harmening Modified: stable/9/sys/dev/sound/pci/envy24ht.c stable/9/sys/dev/sound/pci/envy24ht.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sound/pci/envy24ht.c ============================================================================== --- stable/9/sys/dev/sound/pci/envy24ht.c Wed Jun 5 17:37:59 2013 (r251426) +++ stable/9/sys/dev/sound/pci/envy24ht.c Wed Jun 5 18:42:44 2013 (r251427) @@ -2080,7 +2080,7 @@ envy24ht_pci_probe(device_t dev) static void envy24ht_dmapsetmap(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - /* struct sc_info *sc = (struct sc_info *)arg; */ + struct sc_info *sc = arg; #if(0) device_printf(sc->dev, "envy24ht_dmapsetmap()\n"); @@ -2088,15 +2088,16 @@ envy24ht_dmapsetmap(void *arg, bus_dma_s printf("envy24ht(play): setmap %lx, %lx; ", (unsigned long)segs->ds_addr, (unsigned long)segs->ds_len); - printf("%p -> %lx\n", sc->pmap, (unsigned long)vtophys(sc->pmap)); } #endif + envy24ht_wrmt(sc, ENVY24HT_MT_PADDR, (uint32_t)segs->ds_addr, 4); + envy24ht_wrmt(sc, ENVY24HT_MT_PCNT, (uint32_t)(segs->ds_len / 4 - 1), 2); } static void envy24ht_dmarsetmap(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - /* struct sc_info *sc = (struct sc_info *)arg; */ + struct sc_info *sc = arg; #if(0) device_printf(sc->dev, "envy24ht_dmarsetmap()\n"); @@ -2104,9 +2105,10 @@ envy24ht_dmarsetmap(void *arg, bus_dma_s printf("envy24ht(record): setmap %lx, %lx; ", (unsigned long)segs->ds_addr, (unsigned long)segs->ds_len); - printf("%p -> %lx\n", sc->rmap, (unsigned long)vtophys(sc->pmap)); } #endif + envy24ht_wrmt(sc, ENVY24HT_MT_RADDR, (uint32_t)segs->ds_addr, 4); + envy24ht_wrmt(sc, ENVY24HT_MT_RCNT, (uint32_t)(segs->ds_len / 4 - 1), 2); } static void @@ -2149,7 +2151,6 @@ envy24ht_dmafree(struct sc_info *sc) static int envy24ht_dmainit(struct sc_info *sc) { - u_int32_t addr; #if(0) device_printf(sc->dev, "envy24ht_dmainit()\n"); @@ -2176,34 +2177,16 @@ envy24ht_dmainit(struct sc_info *sc) #if(0) device_printf(sc->dev, "envy24ht_dmainit(): bus_dmamem_load(): sc->pmap\n"); #endif - if (bus_dmamap_load(sc->dmat, sc->pmap, sc->pbuf, sc->psize, envy24ht_dmapsetmap, sc, 0)) + if (bus_dmamap_load(sc->dmat, sc->pmap, sc->pbuf, sc->psize, envy24ht_dmapsetmap, sc, BUS_DMA_NOWAIT)) goto bad; #if(0) device_printf(sc->dev, "envy24ht_dmainit(): bus_dmamem_load(): sc->rmap\n"); #endif - if (bus_dmamap_load(sc->dmat, sc->rmap, sc->rbuf, sc->rsize, envy24ht_dmarsetmap, sc, 0)) + if (bus_dmamap_load(sc->dmat, sc->rmap, sc->rbuf, sc->rsize, envy24ht_dmarsetmap, sc, BUS_DMA_NOWAIT)) goto bad; bzero(sc->pbuf, sc->psize); bzero(sc->rbuf, sc->rsize); - /* set values to register */ - addr = vtophys(sc->pbuf); -#if(0) - device_printf(sc->dev, "pbuf(0x%08x)\n", addr); -#endif - envy24ht_wrmt(sc, ENVY24HT_MT_PADDR, addr, 4); -#if(0) - device_printf(sc->dev, "PADDR-->(0x%08x)\n", envy24ht_rdmt(sc, ENVY24HT_MT_PADDR, 4)); - device_printf(sc->dev, "psize(%ld)\n", sc->psize / 4 - 1); -#endif - envy24ht_wrmt(sc, ENVY24HT_MT_PCNT, sc->psize / 4 - 1, 2); -#if(0) - device_printf(sc->dev, "PCNT-->(%ld)\n", envy24ht_rdmt(sc, ENVY24HT_MT_PCNT, 2)); -#endif - addr = vtophys(sc->rbuf); - envy24ht_wrmt(sc, ENVY24HT_MT_RADDR, addr, 4); - envy24ht_wrmt(sc, ENVY24HT_MT_RCNT, sc->rsize / 4 - 1, 2); - return 0; bad: envy24ht_dmafree(sc); @@ -2441,7 +2424,7 @@ envy24ht_alloc_resource(struct sc_info * sc->irq = bus_alloc_resource(sc->dev, SYS_RES_IRQ, &sc->irqid, 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); if (!sc->irq || - snd_setup_intr(sc->dev, sc->irq, 0, envy24ht_intr, sc, &sc->ih)) { + snd_setup_intr(sc->dev, sc->irq, INTR_MPSAFE, envy24ht_intr, sc, &sc->ih)) { device_printf(sc->dev, "unable to map interrupt\n"); return ENXIO; } @@ -2450,13 +2433,13 @@ envy24ht_alloc_resource(struct sc_info * if (bus_dma_tag_create(/*parent*/bus_get_dma_tag(sc->dev), /*alignment*/4, /*boundary*/0, - /*lowaddr*/BUS_SPACE_MAXADDR_ENVY24, - /*highaddr*/BUS_SPACE_MAXADDR_ENVY24, + /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, + /*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL, /*maxsize*/BUS_SPACE_MAXSIZE_ENVY24, /*nsegments*/1, /*maxsegsz*/0x3ffff, - /*flags*/0, /*lockfunc*/busdma_lock_mutex, - /*lockarg*/&Giant, &sc->dmat) != 0) { + /*flags*/0, /*lockfunc*/NULL, + /*lockarg*/NULL, &sc->dmat) != 0) { device_printf(sc->dev, "unable to create dma tag\n"); return ENXIO; } Modified: stable/9/sys/dev/sound/pci/envy24ht.h ============================================================================== --- stable/9/sys/dev/sound/pci/envy24ht.h Wed Jun 5 17:37:59 2013 (r251426) +++ stable/9/sys/dev/sound/pci/envy24ht.h Wed Jun 5 18:42:44 2013 (r251427) @@ -176,8 +176,6 @@ #define ENVY24HT_VOL_MIN 96 /* -144db(negate) */ #define ENVY24HT_VOL_MUTE 127 /* mute */ -#define BUS_SPACE_MAXADDR_ENVY24 0x0fffffff /* Address space beyond 256MB is not - supported */ #define BUS_SPACE_MAXSIZE_ENVY24 0x3fffc /* 64k x 4byte(1dword) */ #define ENVY24HT_CCS_GPIO_HDATA 0x1E From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 18:49:29 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 407B160E; Wed, 5 Jun 2013 18:49:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 20FEF1A88; Wed, 5 Jun 2013 18:49:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55InTsP099303; Wed, 5 Jun 2013 18:49:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55InShK099300; Wed, 5 Jun 2013 18:49:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201306051849.r55InShK099300@svn.freebsd.org> From: Alexander Motin Date: Wed, 5 Jun 2013 18:49:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251428 - stable/8/sys/dev/sound/pci X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 18:49:29 -0000 Author: mav Date: Wed Jun 5 18:49:28 2013 New Revision: 251428 URL: http://svnweb.freebsd.org/changeset/base/251428 Log: MFC r250286: Some fixes to snd_envy24ht(4) driver: - Allow DMA addresses anywhere in the lower 4GB; Envy24HT has a 32-bit DMA engine, not 28-bit like Envy24. - Mark interrupt handler as MPSAFE, seems to be correctly synchronized. PR: kern/152378 Submitted by: Jason Harmening Modified: stable/8/sys/dev/sound/pci/envy24ht.c stable/8/sys/dev/sound/pci/envy24ht.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/sound/ (props changed) stable/8/sys/dev/sound/pci/ (props changed) Modified: stable/8/sys/dev/sound/pci/envy24ht.c ============================================================================== --- stable/8/sys/dev/sound/pci/envy24ht.c Wed Jun 5 18:42:44 2013 (r251427) +++ stable/8/sys/dev/sound/pci/envy24ht.c Wed Jun 5 18:49:28 2013 (r251428) @@ -2080,7 +2080,7 @@ envy24ht_pci_probe(device_t dev) static void envy24ht_dmapsetmap(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - /* struct sc_info *sc = (struct sc_info *)arg; */ + struct sc_info *sc = arg; #if(0) device_printf(sc->dev, "envy24ht_dmapsetmap()\n"); @@ -2088,15 +2088,16 @@ envy24ht_dmapsetmap(void *arg, bus_dma_s printf("envy24ht(play): setmap %lx, %lx; ", (unsigned long)segs->ds_addr, (unsigned long)segs->ds_len); - printf("%p -> %lx\n", sc->pmap, (unsigned long)vtophys(sc->pmap)); } #endif + envy24ht_wrmt(sc, ENVY24HT_MT_PADDR, (uint32_t)segs->ds_addr, 4); + envy24ht_wrmt(sc, ENVY24HT_MT_PCNT, (uint32_t)(segs->ds_len / 4 - 1), 2); } static void envy24ht_dmarsetmap(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - /* struct sc_info *sc = (struct sc_info *)arg; */ + struct sc_info *sc = arg; #if(0) device_printf(sc->dev, "envy24ht_dmarsetmap()\n"); @@ -2104,9 +2105,10 @@ envy24ht_dmarsetmap(void *arg, bus_dma_s printf("envy24ht(record): setmap %lx, %lx; ", (unsigned long)segs->ds_addr, (unsigned long)segs->ds_len); - printf("%p -> %lx\n", sc->rmap, (unsigned long)vtophys(sc->pmap)); } #endif + envy24ht_wrmt(sc, ENVY24HT_MT_RADDR, (uint32_t)segs->ds_addr, 4); + envy24ht_wrmt(sc, ENVY24HT_MT_RCNT, (uint32_t)(segs->ds_len / 4 - 1), 2); } static void @@ -2149,7 +2151,6 @@ envy24ht_dmafree(struct sc_info *sc) static int envy24ht_dmainit(struct sc_info *sc) { - u_int32_t addr; #if(0) device_printf(sc->dev, "envy24ht_dmainit()\n"); @@ -2176,34 +2177,16 @@ envy24ht_dmainit(struct sc_info *sc) #if(0) device_printf(sc->dev, "envy24ht_dmainit(): bus_dmamem_load(): sc->pmap\n"); #endif - if (bus_dmamap_load(sc->dmat, sc->pmap, sc->pbuf, sc->psize, envy24ht_dmapsetmap, sc, 0)) + if (bus_dmamap_load(sc->dmat, sc->pmap, sc->pbuf, sc->psize, envy24ht_dmapsetmap, sc, BUS_DMA_NOWAIT)) goto bad; #if(0) device_printf(sc->dev, "envy24ht_dmainit(): bus_dmamem_load(): sc->rmap\n"); #endif - if (bus_dmamap_load(sc->dmat, sc->rmap, sc->rbuf, sc->rsize, envy24ht_dmarsetmap, sc, 0)) + if (bus_dmamap_load(sc->dmat, sc->rmap, sc->rbuf, sc->rsize, envy24ht_dmarsetmap, sc, BUS_DMA_NOWAIT)) goto bad; bzero(sc->pbuf, sc->psize); bzero(sc->rbuf, sc->rsize); - /* set values to register */ - addr = vtophys(sc->pbuf); -#if(0) - device_printf(sc->dev, "pbuf(0x%08x)\n", addr); -#endif - envy24ht_wrmt(sc, ENVY24HT_MT_PADDR, addr, 4); -#if(0) - device_printf(sc->dev, "PADDR-->(0x%08x)\n", envy24ht_rdmt(sc, ENVY24HT_MT_PADDR, 4)); - device_printf(sc->dev, "psize(%ld)\n", sc->psize / 4 - 1); -#endif - envy24ht_wrmt(sc, ENVY24HT_MT_PCNT, sc->psize / 4 - 1, 2); -#if(0) - device_printf(sc->dev, "PCNT-->(%ld)\n", envy24ht_rdmt(sc, ENVY24HT_MT_PCNT, 2)); -#endif - addr = vtophys(sc->rbuf); - envy24ht_wrmt(sc, ENVY24HT_MT_RADDR, addr, 4); - envy24ht_wrmt(sc, ENVY24HT_MT_RCNT, sc->rsize / 4 - 1, 2); - return 0; bad: envy24ht_dmafree(sc); @@ -2440,7 +2423,7 @@ envy24ht_alloc_resource(struct sc_info * sc->irq = bus_alloc_resource(sc->dev, SYS_RES_IRQ, &sc->irqid, 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); if (!sc->irq || - snd_setup_intr(sc->dev, sc->irq, 0, envy24ht_intr, sc, &sc->ih)) { + snd_setup_intr(sc->dev, sc->irq, INTR_MPSAFE, envy24ht_intr, sc, &sc->ih)) { device_printf(sc->dev, "unable to map interrupt\n"); return ENXIO; } @@ -2449,13 +2432,13 @@ envy24ht_alloc_resource(struct sc_info * if (bus_dma_tag_create(/*parent*/bus_get_dma_tag(sc->dev), /*alignment*/4, /*boundary*/0, - /*lowaddr*/BUS_SPACE_MAXADDR_ENVY24, - /*highaddr*/BUS_SPACE_MAXADDR_ENVY24, + /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, + /*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL, /*maxsize*/BUS_SPACE_MAXSIZE_ENVY24, /*nsegments*/1, /*maxsegsz*/0x3ffff, - /*flags*/0, /*lockfunc*/busdma_lock_mutex, - /*lockarg*/&Giant, &sc->dmat) != 0) { + /*flags*/0, /*lockfunc*/NULL, + /*lockarg*/NULL, &sc->dmat) != 0) { device_printf(sc->dev, "unable to create dma tag\n"); return ENXIO; } Modified: stable/8/sys/dev/sound/pci/envy24ht.h ============================================================================== --- stable/8/sys/dev/sound/pci/envy24ht.h Wed Jun 5 18:42:44 2013 (r251427) +++ stable/8/sys/dev/sound/pci/envy24ht.h Wed Jun 5 18:49:28 2013 (r251428) @@ -176,8 +176,6 @@ #define ENVY24HT_VOL_MIN 96 /* -144db(negate) */ #define ENVY24HT_VOL_MUTE 127 /* mute */ -#define BUS_SPACE_MAXADDR_ENVY24 0x0fffffff /* Address space beyond 256MB is not - supported */ #define BUS_SPACE_MAXSIZE_ENVY24 0x3fffc /* 64k x 4byte(1dword) */ #define ENVY24HT_CCS_GPIO_HDATA 0x1E From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 19:08:23 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A26D8D77; Wed, 5 Jun 2013 19:08:23 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 946B01B88; Wed, 5 Jun 2013 19:08:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55J8NKu005633; Wed, 5 Jun 2013 19:08:23 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55J8NZR005631; Wed, 5 Jun 2013 19:08:23 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201306051908.r55J8NZR005631@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 5 Jun 2013 19:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251429 - in head: bin/sh tools/regression/bin/sh/builtins X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 19:08:23 -0000 Author: jilles Date: Wed Jun 5 19:08:22 2013 New Revision: 251429 URL: http://svnweb.freebsd.org/changeset/base/251429 Log: sh: Allow multiple operands in wait builtin. This is only part of the PR; the behaviour for unknown/invalid pids/jobs remains unchanged (aborts the builtin with status 2). PR: 176916 Submitted by: Vadim Goncharov Added: head/tools/regression/bin/sh/builtins/wait8.0 (contents, props changed) Modified: head/bin/sh/jobs.c Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Wed Jun 5 18:49:28 2013 (r251428) +++ head/bin/sh/jobs.c Wed Jun 5 19:08:22 2013 (r251429) @@ -95,6 +95,7 @@ static int ttyfd = -1; static void restartjob(struct job *); #endif static void freejob(struct job *); +static int waitcmdloop(struct job *); static struct job *getjob(char *); pid_t getjobpgrp(char *); static pid_t dowait(int, struct job *); @@ -459,15 +460,26 @@ int waitcmd(int argc __unused, char **argv __unused) { struct job *job; - int status, retval; - struct job *jp; + int retval; nextopt(""); - if (*argptr != NULL) { + if (*argptr == NULL) + return (waitcmdloop(NULL)); + + do { job = getjob(*argptr); - } else { - job = NULL; - } + retval = waitcmdloop(job); + argptr++; + } while (*argptr != NULL); + + return (retval); +} + +static int +waitcmdloop(struct job *job) +{ + int status, retval; + struct job *jp; /* * Loop until a process is terminated or stopped, or a SIGINT is Added: head/tools/regression/bin/sh/builtins/wait8.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/wait8.0 Wed Jun 5 19:08:22 2013 (r251429) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +exit 44 & p44=$! +exit 45 & p45=$! +exit 7 & p7=$! +wait "$p44" "$p7" "$p45" +[ "$?" = 45 ] From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 19:40:53 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D0523812; Wed, 5 Jun 2013 19:40:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A5B991D35; Wed, 5 Jun 2013 19:40:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55JeruX015443; Wed, 5 Jun 2013 19:40:53 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55Jeqah015440; Wed, 5 Jun 2013 19:40:52 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201306051940.r55Jeqah015440@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 5 Jun 2013 19:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251430 - in head: bin/sh tools/regression/bin/sh/builtins X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 19:40:53 -0000 Author: jilles Date: Wed Jun 5 19:40:52 2013 New Revision: 251430 URL: http://svnweb.freebsd.org/changeset/base/251430 Log: sh: Return status 127 for unknown jobs in wait builtin. This is required by POSIX, at least for pids that are not known child processes. Other problems with job specifications still cause wait to abort with exit status 2. PR: 176916 Added: head/tools/regression/bin/sh/builtins/wait10.0 (contents, props changed) head/tools/regression/bin/sh/builtins/wait9.127 (contents, props changed) Modified: head/bin/sh/jobs.c Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Wed Jun 5 19:08:22 2013 (r251429) +++ head/bin/sh/jobs.c Wed Jun 5 19:40:52 2013 (r251430) @@ -96,6 +96,7 @@ static void restartjob(struct job *); #endif static void freejob(struct job *); static int waitcmdloop(struct job *); +static struct job *getjob_nonotfound(char *); static struct job *getjob(char *); pid_t getjobpgrp(char *); static pid_t dowait(int, struct job *); @@ -467,8 +468,11 @@ waitcmd(int argc __unused, char **argv _ return (waitcmdloop(NULL)); do { - job = getjob(*argptr); - retval = waitcmdloop(job); + job = getjob_nonotfound(*argptr); + if (job == NULL) + retval = 127; + else + retval = waitcmdloop(job); argptr++; } while (*argptr != NULL); @@ -558,7 +562,7 @@ jobidcmd(int argc __unused, char **argv) */ static struct job * -getjob(char *name) +getjob_nonotfound(char *name) { int jobno; struct job *found, *jp; @@ -623,12 +627,22 @@ currentjob: if ((jp = getcurjob(NULL)) = return jp; } } - error("No such job: %s", name); - /*NOTREACHED*/ return NULL; } +static struct job * +getjob(char *name) +{ + struct job *jp; + + jp = getjob_nonotfound(name); + if (jp == NULL) + error("No such job: %s", name); + return (jp); +} + + pid_t getjobpgrp(char *name) { Added: head/tools/regression/bin/sh/builtins/wait10.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/wait10.0 Wed Jun 5 19:40:52 2013 (r251430) @@ -0,0 +1,5 @@ +# $FreeBSD$ +# Init cannot be a child of the shell. +exit 49 & p49=$! +wait 1 "$p49" +[ "$?" = 49 ] Added: head/tools/regression/bin/sh/builtins/wait9.127 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/wait9.127 Wed Jun 5 19:40:52 2013 (r251430) @@ -0,0 +1,3 @@ +# $FreeBSD$ +# Init cannot be a child of the shell. +wait 1 From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 19:46:40 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 418B89EE; Wed, 5 Jun 2013 19:46:40 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1B2921D70; Wed, 5 Jun 2013 19:46:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55JkdD7017732; Wed, 5 Jun 2013 19:46:39 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55JkdjL017731; Wed, 5 Jun 2013 19:46:39 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201306051946.r55JkdjL017731@svn.freebsd.org> From: Dimitry Andric Date: Wed, 5 Jun 2013 19:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251431 - head/contrib/llvm/lib/CodeGen/AsmPrinter X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 19:46:40 -0000 Author: dim Date: Wed Jun 5 19:46:39 2013 New Revision: 251431 URL: http://svnweb.freebsd.org/changeset/base/251431 Log: Pull in r183297 from upstream llvm trunk: PR15662: Optimized debug info produces out of order function parameters When a function is inlined we lazily construct the variables representing the function's parameters. After that, we add any remaining unused parameters. If the function doesn't use all the parameters, or uses them out of order, then the DWARF would produce them in that order, producing a parameter order that doesn't match the source. This fix causes us to always keep the arg variables at the start of the variable list & in the original order from the source. Reported by: avg MFC after: 1 week Modified: head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Jun 5 19:40:52 2013 (r251430) +++ head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Jun 5 19:46:39 2013 (r251431) @@ -1538,9 +1538,37 @@ void DwarfDebug::beginFunction(const Mac } void DwarfDebug::addScopeVariable(LexicalScope *LS, DbgVariable *Var) { -// SmallVector &Vars = ScopeVariables.lookup(LS); - ScopeVariables[LS].push_back(Var); -// Vars.push_back(Var); + SmallVectorImpl &Vars = ScopeVariables[LS]; + DIVariable DV = Var->getVariable(); + if (DV.getTag() == dwarf::DW_TAG_arg_variable) { + DISubprogram Ctxt(DV.getContext()); + DIArray Variables = Ctxt.getVariables(); + // If the variable is a parameter (arg_variable) and this is an optimized + // build (the subprogram has a 'variables' list) make sure we keep the + // parameters in order. Otherwise we would produce an incorrect function + // type with parameters out of order if function parameters were used out of + // order or unused (see the call to addScopeVariable in endFunction where + // the remaining unused variables (including parameters) are added). + if (unsigned NumVariables = Variables.getNumElements()) { + // Keep the parameters at the start of the variables list. Search through + // current variable list (Vars) and the full function variable list in + // lock-step looking for this parameter in the full list to find the + // insertion point. + SmallVectorImpl::iterator I = Vars.begin(); + unsigned j = 0; + while (I != Vars.end() && j != NumVariables && + Variables.getElement(j) != DV && + (*I)->getVariable().getTag() == dwarf::DW_TAG_arg_variable) { + if (Variables.getElement(j) == (*I)->getVariable()) + ++I; + ++j; + } + Vars.insert(I, Var); + return; + } + } + + Vars.push_back(Var); } // Gather and emit post-function debug information. From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 19:54:29 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 36687CF1; Wed, 5 Jun 2013 19:54:29 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 294531DBB; Wed, 5 Jun 2013 19:54:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55JsTiI020464; Wed, 5 Jun 2013 19:54:29 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55JsTBQ020463; Wed, 5 Jun 2013 19:54:29 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201306051954.r55JsTBQ020463@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 5 Jun 2013 19:54:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251432 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 19:54:29 -0000 Author: jilles Date: Wed Jun 5 19:54:28 2013 New Revision: 251432 URL: http://svnweb.freebsd.org/changeset/base/251432 Log: sh(1): Document new features in wait builtin. PR: 176916 Modified: head/bin/sh/sh.1 Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Wed Jun 5 19:46:39 2013 (r251431) +++ head/bin/sh/sh.1 Wed Jun 5 19:54:28 2013 (r251432) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd May 3, 2013 +.Dd June 5, 2013 .Dt SH 1 .Os .Sh NAME @@ -2642,12 +2642,17 @@ If the option is specified, the .Ar name arguments are treated as function names. -.It Ic wait Op Ar job -Wait for the specified +.It Ic wait Op Ar job ... +Wait for each specified .Ar job to complete and return the exit status of the last process in the +last specified .Ar job . -If the argument is omitted, wait for all jobs to complete +If any +.Ar job +specified is unknown to the shell, it is treated as if it +were a known job that exited with exit status 127. +If no operands are given, wait for all jobs to complete and return an exit status of zero. .El .Ss Commandline Editing From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 20:15:19 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 68025645; Wed, 5 Jun 2013 20:15:19 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5A7A61EEE; Wed, 5 Jun 2013 20:15:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55KFJoe027354; Wed, 5 Jun 2013 20:15:19 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55KFJGp027353; Wed, 5 Jun 2013 20:15:19 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201306052015.r55KFJGp027353@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 5 Jun 2013 20:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251433 - head/bin/sleep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 20:15:19 -0000 Author: jilles Date: Wed Jun 5 20:15:18 2013 New Revision: 251433 URL: http://svnweb.freebsd.org/changeset/base/251433 Log: sleep: Explain in a comment why the [EINTR] check is there. Suggested by: eadler Modified: head/bin/sleep/sleep.c Modified: head/bin/sleep/sleep.c ============================================================================== --- head/bin/sleep/sleep.c Wed Jun 5 19:54:28 2013 (r251432) +++ head/bin/sleep/sleep.c Wed Jun 5 20:15:18 2013 (r251433) @@ -82,6 +82,12 @@ main(int argc, char *argv[]) time_to_sleep.tv_nsec = 1e9 * (d - time_to_sleep.tv_sec); signal(SIGINFO, report_request); + + /* + * Note: [EINTR] is supposed to happen only when a signal was handled + * but the kernel also returns it when a ptrace-based debugger + * attaches. This is a bug but it is hard to fix. + */ while (nanosleep(&time_to_sleep, &time_to_sleep) != 0) { if (report_requested) { /* Reporting does not bother with nanoseconds. */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 20:57:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DC777775; Wed, 5 Jun 2013 20:57:52 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B55CD10CD; Wed, 5 Jun 2013 20:57:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55KvqNa040388; Wed, 5 Jun 2013 20:57:52 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55KvqXl040387; Wed, 5 Jun 2013 20:57:52 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201306052057.r55KvqXl040387@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 5 Jun 2013 20:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251434 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 20:57:52 -0000 Author: np Date: Wed Jun 5 20:57:52 2013 New Revision: 251434 URL: http://svnweb.freebsd.org/changeset/base/251434 Log: cxgbe(4): Never install a firmware if hw.cxgbe.fw_install is 0. MFC after: 1 week Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed Jun 5 20:15:18 2013 (r251433) +++ head/sys/dev/cxgbe/t4_main.c Wed Jun 5 20:57:52 2013 (r251434) @@ -1912,18 +1912,15 @@ fw_compatible(const struct fw_hdr *hdr1, } /* - * The firmware in the KLD is usable and can be installed. But should it be? - * This routine explains itself in detail if it indicates the KLD firmware - * should be installed. + * The firmware in the KLD is usable, but should it be installed? This routine + * explains itself in detail if it indicates the KLD firmware should be + * installed. */ static int should_install_kld_fw(struct adapter *sc, int card_fw_usable, int k, int c) { const char *reason; - KASSERT(t4_fw_install != 0, ("%s: Can't install; shouldn't be asked " - "to evaluate if install is a good idea.", __func__)); - if (!card_fw_usable) { reason = "incompatible or unusable"; goto install; @@ -1942,6 +1939,16 @@ should_install_kld_fw(struct adapter *sc return (0); install: + if (t4_fw_install == 0) { + device_printf(sc->dev, "firmware on card (%u.%u.%u.%u) is %s, " + "but the driver is prohibited from installing a different " + "firmware on the card.\n", + G_FW_HDR_FW_VER_MAJOR(c), G_FW_HDR_FW_VER_MINOR(c), + G_FW_HDR_FW_VER_MICRO(c), G_FW_HDR_FW_VER_BUILD(c), reason); + + return (0); + } + device_printf(sc->dev, "firmware on card (%u.%u.%u.%u) is %s, " "installing firmware %u.%u.%u.%u on card.\n", G_FW_HDR_FW_VER_MAJOR(c), G_FW_HDR_FW_VER_MINOR(c), @@ -2028,15 +2035,13 @@ prep_firmware(struct adapter *sc) } if (card_fw_usable && card_fw->fw_ver == drv_fw->fw_ver && - (!kld_fw_usable || kld_fw->fw_ver == drv_fw->fw_ver || - t4_fw_install == 0)) { + (!kld_fw_usable || kld_fw->fw_ver == drv_fw->fw_ver)) { /* * Common case: the firmware on the card is an exact match and * the KLD is an exact match too, or the KLD is - * absent/incompatible, or we're prohibited from using it. Note - * that t4_fw_install = 2 is ignored here -- use cxgbetool - * loadfw if you want to reinstall the same firmware as the one - * on the card. + * absent/incompatible. Note that t4_fw_install = 2 is ignored + * here -- use cxgbetool loadfw if you want to reinstall the + * same firmware as the one on the card. */ } else if (kld_fw_usable && state == DEV_STATE_UNINIT && should_install_kld_fw(sc, card_fw_usable, be32toh(kld_fw->fw_ver), From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 21:12:56 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7FE66ECE; Wed, 5 Jun 2013 21:12:56 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 724CC117E; Wed, 5 Jun 2013 21:12:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55LCunT046481; Wed, 5 Jun 2013 21:12:56 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55LCuaC046478; Wed, 5 Jun 2013 21:12:56 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201306052112.r55LCuaC046478@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 5 Jun 2013 21:12:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r251435 - vendor/libregex/dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 21:12:56 -0000 Author: jkim Date: Wed Jun 5 21:12:55 2013 New Revision: 251435 URL: http://svnweb.freebsd.org/changeset/base/251435 Log: Import couple of important bug fixes from the upstream. http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=7e2f0d2 http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=a445af0 Modified: vendor/libregex/dist/regcomp.c vendor/libregex/dist/regexec.c Modified: vendor/libregex/dist/regcomp.c ============================================================================== --- vendor/libregex/dist/regcomp.c Wed Jun 5 20:57:52 2013 (r251434) +++ vendor/libregex/dist/regcomp.c Wed Jun 5 21:12:55 2013 (r251435) @@ -2776,40 +2776,29 @@ parse_bracket_exp (re_string_t *regexp, /* Local function for parse_bracket_exp used in _LIBC environement. Seek the collating symbol entry correspondings to NAME. - Return the index of the symbol in the SYMB_TABLE. */ + Return the index of the symbol in the SYMB_TABLE, + or -1 if not found. */ auto inline int32_t __attribute ((always_inline)) - seek_collating_symbol_entry (name, name_len) - const unsigned char *name; - size_t name_len; - { - int32_t hash = elem_hash ((const char *) name, name_len); - int32_t elem = hash % table_size; - if (symb_table[2 * elem] != 0) - { - int32_t second = hash % (table_size - 2) + 1; - - do - { - /* First compare the hashing value. */ - if (symb_table[2 * elem] == hash - /* Compare the length of the name. */ - && name_len == extra[symb_table[2 * elem + 1]] - /* Compare the name. */ - && memcmp (name, &extra[symb_table[2 * elem + 1] + 1], - name_len) == 0) - { - /* Yep, this is the entry. */ - break; - } + seek_collating_symbol_entry (const unsigned char *name, size_t name_len) + { + int32_t elem; - /* Next entry. */ - elem += second; - } - while (symb_table[2 * elem] != 0); - } - return elem; + for (elem = 0; elem < table_size; elem++) + if (symb_table[2 * elem] != 0) + { + int32_t idx = symb_table[2 * elem + 1]; + /* Skip the name of collating element name. */ + idx += 1 + extra[idx]; + if (/* Compare the length of the name. */ + name_len == extra[idx] + /* Compare the name. */ + && memcmp (name, &extra[idx + 1], name_len) == 0) + /* Yep, this is the entry. */ + return elem; + } + return -1; } /* Local function for parse_bracket_exp used in _LIBC environment. @@ -2818,8 +2807,7 @@ parse_bracket_exp (re_string_t *regexp, auto inline unsigned int __attribute ((always_inline)) - lookup_collation_sequence_value (br_elem) - bracket_elem_t *br_elem; + lookup_collation_sequence_value (bracket_elem_t *br_elem) { if (br_elem->type == SB_CHAR) { @@ -2847,7 +2835,7 @@ parse_bracket_exp (re_string_t *regexp, int32_t elem, idx; elem = seek_collating_symbol_entry (br_elem->opr.name, sym_name_len); - if (symb_table[2 * elem] != 0) + if (elem != -1) { /* We found the entry. */ idx = symb_table[2 * elem + 1]; @@ -2865,7 +2853,7 @@ parse_bracket_exp (re_string_t *regexp, /* Return the collation sequence value. */ return *(unsigned int *) (extra + idx); } - else if (symb_table[2 * elem] == 0 && sym_name_len == 1) + else if (sym_name_len == 1) { /* No valid character. Match it as a single byte character. */ @@ -2887,11 +2875,8 @@ parse_bracket_exp (re_string_t *regexp, auto inline reg_errcode_t __attribute ((always_inline)) - build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem) - re_charset_t *mbcset; - int *range_alloc; - bitset_t sbcset; - bracket_elem_t *start_elem, *end_elem; + build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc, + bracket_elem_t *start_elem, bracket_elem_t *end_elem) { unsigned int ch; uint32_t start_collseq; @@ -2970,25 +2955,22 @@ parse_bracket_exp (re_string_t *regexp, auto inline reg_errcode_t __attribute ((always_inline)) - build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name) - re_charset_t *mbcset; - int *coll_sym_alloc; - bitset_t sbcset; - const unsigned char *name; + build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset, + int *coll_sym_alloc, const unsigned char *name) { int32_t elem, idx; size_t name_len = strlen ((const char *) name); if (nrules != 0) { elem = seek_collating_symbol_entry (name, name_len); - if (symb_table[2 * elem] != 0) + if (elem != -1) { /* We found the entry. */ idx = symb_table[2 * elem + 1]; /* Skip the name of collating element name. */ idx += 1 + extra[idx]; } - else if (symb_table[2 * elem] == 0 && name_len == 1) + else if (name_len == 1) { /* No valid character, treat it as a normal character. */ Modified: vendor/libregex/dist/regexec.c ============================================================================== --- vendor/libregex/dist/regexec.c Wed Jun 5 20:57:52 2013 (r251434) +++ vendor/libregex/dist/regexec.c Wed Jun 5 21:12:55 2013 (r251435) @@ -197,7 +197,7 @@ static int group_nodes_into_DFAstates (c static int check_node_accept (const re_match_context_t *mctx, const re_token_t *node, int idx) internal_function; -static reg_errcode_t extend_buffers (re_match_context_t *mctx) +static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len) internal_function; /* Entry point for POSIX code. */ @@ -1160,7 +1160,7 @@ check_matching (re_match_context_t *mctx || (BE (next_char_idx >= mctx->input.valid_len, 0) && mctx->input.valid_len < mctx->input.len)) { - err = extend_buffers (mctx); + err = extend_buffers (mctx, next_char_idx + 1); if (BE (err != REG_NOERROR, 0)) { assert (err == REG_ESPACE); @@ -1738,7 +1738,7 @@ clean_state_log_if_needed (re_match_cont && mctx->input.valid_len < mctx->input.len)) { reg_errcode_t err; - err = extend_buffers (mctx); + err = extend_buffers (mctx, next_state_log_idx + 1); if (BE (err != REG_NOERROR, 0)) return err; } @@ -2792,7 +2792,7 @@ get_subexp (re_match_context_t *mctx, in if (bkref_str_off >= mctx->input.len) break; - err = extend_buffers (mctx); + err = extend_buffers (mctx, bkref_str_off + 1); if (BE (err != REG_NOERROR, 0)) return err; @@ -4102,7 +4102,7 @@ check_node_accept (const re_match_contex static reg_errcode_t internal_function __attribute_warn_unused_result__ -extend_buffers (re_match_context_t *mctx) +extend_buffers (re_match_context_t *mctx, int min_len) { reg_errcode_t ret; re_string_t *pstr = &mctx->input; @@ -4111,8 +4111,10 @@ extend_buffers (re_match_context_t *mctx if (BE (INT_MAX / 2 / sizeof (re_dfastate_t *) <= pstr->bufs_len, 0)) return REG_ESPACE; - /* Double the lengthes of the buffers. */ - ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2)); + /* Double the lengthes of the buffers, but allocate at least MIN_LEN. */ + ret = re_string_realloc_buffers (pstr, + MAX (min_len, + MIN (pstr->len, pstr->bufs_len * 2))); if (BE (ret != REG_NOERROR, 0)) return ret; From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 21:27:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ABFC374A; Wed, 5 Jun 2013 21:27:04 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8668212B9; Wed, 5 Jun 2013 21:27:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55LR4ZV050447; Wed, 5 Jun 2013 21:27:04 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55LR4FF050446; Wed, 5 Jun 2013 21:27:04 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201306052127.r55LR4FF050446@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 5 Jun 2013 21:27:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251436 - head/contrib/libgnuregex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 21:27:04 -0000 Author: jkim Date: Wed Jun 5 21:27:04 2013 New Revision: 251436 URL: http://svnweb.freebsd.org/changeset/base/251436 Log: Add GNU regex from glibc 2.17. Added: head/contrib/libgnuregex/ - copied from r251435, vendor/libregex/dist/ From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 21:28:33 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9D1998FA; Wed, 5 Jun 2013 21:28:33 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F80E12D7; Wed, 5 Jun 2013 21:28:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55LSXm0050678; Wed, 5 Jun 2013 21:28:33 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55LSXEo050677; Wed, 5 Jun 2013 21:28:33 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201306052128.r55LSXEo050677@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 5 Jun 2013 21:28:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251437 - head/contrib/libgnuregex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 21:28:33 -0000 Author: jkim Date: Wed Jun 5 21:28:33 2013 New Revision: 251437 URL: http://svnweb.freebsd.org/changeset/base/251437 Log: Fix build for FreeBSD. We do not have alloca.h. Modified: head/contrib/libgnuregex/regex_internal.h Modified: head/contrib/libgnuregex/regex_internal.h ============================================================================== --- head/contrib/libgnuregex/regex_internal.h Wed Jun 5 21:27:04 2013 (r251436) +++ head/contrib/libgnuregex/regex_internal.h Wed Jun 5 21:28:33 2013 (r251437) @@ -417,7 +417,9 @@ static unsigned int re_string_context_at #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) +#ifndef __FreeBSD__ #include +#endif #ifndef _LIBC # if HAVE_ALLOCA From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 21:31:07 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 74927B7C; Wed, 5 Jun 2013 21:31:07 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 667B91329; Wed, 5 Jun 2013 21:31:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55LV74L052716; Wed, 5 Jun 2013 21:31:07 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55LV6t8052710; Wed, 5 Jun 2013 21:31:06 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201306052131.r55LV6t8052710@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 5 Jun 2013 21:31:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251438 - in head/gnu: lib/libregex lib/libregex/posix usr.bin/diff usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 21:31:07 -0000 Author: jkim Date: Wed Jun 5 21:31:06 2013 New Revision: 251438 URL: http://svnweb.freebsd.org/changeset/base/251438 Log: Connect libgnuregex 2.17 to the build. Deleted: head/gnu/lib/libregex/FREEBSD-upgrade head/gnu/lib/libregex/posix/ head/gnu/lib/libregex/regcomp.c head/gnu/lib/libregex/regex.c head/gnu/lib/libregex/regex_internal.c head/gnu/lib/libregex/regex_internal.h head/gnu/lib/libregex/regexec.c Modified: head/gnu/lib/libregex/Makefile head/gnu/lib/libregex/config.h head/gnu/lib/libregex/regex.h head/gnu/usr.bin/diff/Makefile head/gnu/usr.bin/grep/Makefile Modified: head/gnu/lib/libregex/Makefile ============================================================================== --- head/gnu/lib/libregex/Makefile Wed Jun 5 21:28:33 2013 (r251437) +++ head/gnu/lib/libregex/Makefile Wed Jun 5 21:31:06 2013 (r251438) @@ -5,16 +5,20 @@ SUBDIR= doc LIB= gnuregex SHLIB_MAJOR= 5 +REGEXDIR= ${.CURDIR}/../../../contrib/libgnuregex +.PATH: ${REGEXDIR} + SRCS= gnuregex.c INCSGROUPS= INCS WRINCS PXINCS INCS= regex.h.patched INCSNAME= regex.h INCSDIR= ${INCLUDEDIR}/gnu WRINCS= gnuregex.h -PXINCS= posix/regex.h +PXINCS= ${REGEXDIR}/regex.h PXINCSDIR= ${INCSDIR}/posix -CFLAGS+=-DHAVE_CONFIG_H -I${.CURDIR} +CFLAGS+= -D__attribute_warn_unused_result__="" +CFLAGS+= -DHAVE_CONFIG_H -I${.CURDIR} -I${REGEXDIR} CLEANFILES= regex.h.patched gnuregex.c regex.h.patched: regex.h Modified: head/gnu/lib/libregex/config.h ============================================================================== --- head/gnu/lib/libregex/config.h Wed Jun 5 21:28:33 2013 (r251437) +++ head/gnu/lib/libregex/config.h Wed Jun 5 21:31:06 2013 (r251438) @@ -10,3 +10,6 @@ #define HAVE_WCRTOMB 1 #define HAVE_MBRTOWC 1 #define HAVE_WCSCOLL 1 +#define HAVE_ALLOCA 1 +#define HAVE_STDBOOL_H 1 +#define HAVE_STDINT_H 1 Modified: head/gnu/lib/libregex/regex.h ============================================================================== --- head/gnu/lib/libregex/regex.h Wed Jun 5 21:28:33 2013 (r251437) +++ head/gnu/lib/libregex/regex.h Wed Jun 5 21:31:06 2013 (r251438) @@ -1,47 +1,54 @@ /* $FreeBSD$ */ #ifndef _REGEX_H + +#ifndef __USE_GNU +#define __USE_GNU +#endif + #include /* Document internal interfaces. */ -extern reg_syntax_t __re_set_syntax _RE_ARGS ((reg_syntax_t syntax)); +extern reg_syntax_t __re_set_syntax (reg_syntax_t __syntax); -extern const char *__re_compile_pattern - _RE_ARGS ((const char *pattern, size_t length, - struct re_pattern_buffer *buffer)); +extern const char *__re_compile_pattern (const char *__pattern, size_t __length, + struct re_pattern_buffer *__buffer); -extern int __re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); +extern int __re_compile_fastmap (struct re_pattern_buffer *__buffer); -extern int __re_search - _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, - int length, int start, int range, struct re_registers *regs)); +extern int __re_search (struct re_pattern_buffer *__buffer, const char *__string, + int __length, int __start, int __range, + struct re_registers *__regs); -extern int __re_search_2 - _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, - int length1, const char *string2, int length2, - int start, int range, struct re_registers *regs, int stop)); +extern int __re_search_2 (struct re_pattern_buffer *__buffer, + const char *__string1, int __length1, + const char *__string2, int __length2, int __start, + int __range, struct re_registers *__regs, int __stop); -extern int __re_match - _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, - int length, int start, struct re_registers *regs)); +extern int __re_match (struct re_pattern_buffer *__buffer, const char *__string, + int __length, int __start, struct re_registers *__regs); -extern int __re_match_2 - _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, - int length1, const char *string2, int length2, - int start, struct re_registers *regs, int stop)); +extern int __re_match_2 (struct re_pattern_buffer *__buffer, + const char *__string1, int __length1, + const char *__string2, int __length2, int __start, + struct re_registers *__regs, int __stop); -extern void __re_set_registers - _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs, - unsigned num_regs, regoff_t *starts, regoff_t *ends)); +extern void __re_set_registers (struct re_pattern_buffer *__buffer, + struct re_registers *__regs, + unsigned int __num_regs, + regoff_t *__starts, regoff_t *__ends); -extern int __regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern, - int __cflags)); +extern int __regcomp (regex_t *__restrict __preg, + const char *__restrict __pattern, + int __cflags); -extern int __regexec _RE_ARGS ((const regex_t *__preg, - const char *__string, size_t __nmatch, - regmatch_t __pmatch[], int __eflags)); +extern int __regexec (const regex_t *__restrict __preg, + const char *__restrict __string, size_t __nmatch, + regmatch_t __pmatch[__restrict_arr], + int __eflags); -extern size_t __regerror _RE_ARGS ((int __errcode, const regex_t *__preg, - char *__errbuf, size_t __errbuf_size)); +extern size_t __regerror (int __errcode, const regex_t *__restrict __preg, + char *__restrict __errbuf, size_t __errbuf_size); -extern void __regfree _RE_ARGS ((regex_t *__preg)); -#endif +extern void __regfree (regex_t *__preg); + +#endif /* _REGEX_H */ Modified: head/gnu/usr.bin/diff/Makefile ============================================================================== --- head/gnu/usr.bin/diff/Makefile Wed Jun 5 21:28:33 2013 (r251437) +++ head/gnu/usr.bin/diff/Makefile Wed Jun 5 21:31:06 2013 (r251438) @@ -17,10 +17,11 @@ CFLAGS+=-funsigned-char CFLAGS+=-DHAVE_CONFIG_H CFLAGS+=-DPR_PROGRAM=\"/usr/bin/pr\" +CFLAGS+=-D__USE_GNU CFLAGS+=-I${.CURDIR}/../../../contrib/diff CFLAGS+=-I${.CURDIR}/../../../contrib/diff/src CFLAGS+=-I${.CURDIR}/../../../contrib/diff/lib -CFLAGS+=-I${.CURDIR}/../../lib/libregex +CFLAGS+=-I${.CURDIR}/../../../contrib/libgnuregex SUBDIR+=doc Modified: head/gnu/usr.bin/grep/Makefile ============================================================================== --- head/gnu/usr.bin/grep/Makefile Wed Jun 5 21:28:33 2013 (r251437) +++ head/gnu/usr.bin/grep/Makefile Wed Jun 5 21:31:06 2013 (r251438) @@ -13,7 +13,8 @@ SRCS= closeout.c dfa.c error.c exclude.c isdir.c kwset.c obstack.c quotearg.c savedir.c search.c xmalloc.c \ xstrtoumax.c -CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../../lib/libregex -DHAVE_CONFIG_H +CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../../../contrib/libgnuregex +CFLAGS+=-DHAVE_CONFIG_H -D__USE_GNU .if ${MK_BSD_GREP} != "yes" LINKS+= ${BINDIR}/grep ${BINDIR}/egrep \ From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 21:55:22 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4410851D; Wed, 5 Jun 2013 21:55:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1D4311649; Wed, 5 Jun 2013 21:55:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55LtMsL059755; Wed, 5 Jun 2013 21:55:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55LtLcn059748; Wed, 5 Jun 2013 21:55:21 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306052155.r55LtLcn059748@svn.freebsd.org> From: Xin LI Date: Wed, 5 Jun 2013 21:55:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251439 - head/usr.sbin/kldxref X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 21:55:22 -0000 Author: delphij Date: Wed Jun 5 21:55:20 2013 New Revision: 251439 URL: http://svnweb.freebsd.org/changeset/base/251439 Log: Remove unneeded reference to link.h (sys/link_elf.h). MFC after: 2 weeks Modified: head/usr.sbin/kldxref/ef.c head/usr.sbin/kldxref/ef_amd64.c head/usr.sbin/kldxref/ef_i386.c head/usr.sbin/kldxref/ef_obj.c head/usr.sbin/kldxref/kldxref.c Modified: head/usr.sbin/kldxref/ef.c ============================================================================== --- head/usr.sbin/kldxref/ef.c Wed Jun 5 21:31:06 2013 (r251438) +++ head/usr.sbin/kldxref/ef.c Wed Jun 5 21:55:20 2013 (r251439) @@ -42,7 +42,6 @@ #include #include #define FREEBSD_ELF -#include #include Modified: head/usr.sbin/kldxref/ef_amd64.c ============================================================================== --- head/usr.sbin/kldxref/ef_amd64.c Wed Jun 5 21:31:06 2013 (r251438) +++ head/usr.sbin/kldxref/ef_amd64.c Wed Jun 5 21:55:20 2013 (r251439) @@ -32,7 +32,6 @@ #include #include -#include #include "ef.h" Modified: head/usr.sbin/kldxref/ef_i386.c ============================================================================== --- head/usr.sbin/kldxref/ef_i386.c Wed Jun 5 21:31:06 2013 (r251438) +++ head/usr.sbin/kldxref/ef_i386.c Wed Jun 5 21:55:20 2013 (r251439) @@ -32,7 +32,6 @@ #include #include -#include #include "ef.h" Modified: head/usr.sbin/kldxref/ef_obj.c ============================================================================== --- head/usr.sbin/kldxref/ef_obj.c Wed Jun 5 21:31:06 2013 (r251438) +++ head/usr.sbin/kldxref/ef_obj.c Wed Jun 5 21:55:20 2013 (r251439) @@ -44,7 +44,6 @@ #include #include #define FREEBSD_ELF -#include #include Modified: head/usr.sbin/kldxref/kldxref.c ============================================================================== --- head/usr.sbin/kldxref/kldxref.c Wed Jun 5 21:31:06 2013 (r251438) +++ head/usr.sbin/kldxref/kldxref.c Wed Jun 5 21:55:20 2013 (r251439) @@ -42,7 +42,6 @@ #include #include #define FREEBSD_ELF -#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 21:56:30 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 249C4782; Wed, 5 Jun 2013 21:56:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 17867165B; Wed, 5 Jun 2013 21:56:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55LuTTi060003; Wed, 5 Jun 2013 21:56:29 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55LuTPr060002; Wed, 5 Jun 2013 21:56:29 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306052156.r55LuTPr060002@svn.freebsd.org> From: Xin LI Date: Wed, 5 Jun 2013 21:56:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251440 - head/usr.sbin/kldxref X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 21:56:30 -0000 Author: delphij Date: Wed Jun 5 21:56:29 2013 New Revision: 251440 URL: http://svnweb.freebsd.org/changeset/base/251440 Log: Use calloc(). MFC after: 2 weeks Modified: head/usr.sbin/kldxref/ef_obj.c Modified: head/usr.sbin/kldxref/ef_obj.c ============================================================================== --- head/usr.sbin/kldxref/ef_obj.c Wed Jun 5 21:55:20 2013 (r251439) +++ head/usr.sbin/kldxref/ef_obj.c Wed Jun 5 21:56:29 2013 (r251440) @@ -343,7 +343,7 @@ ef_obj_open(const char *filename, struct if ((fd = open(filename, O_RDONLY)) == -1) return errno; - ef = malloc(sizeof(*ef)); + ef = calloc(1, sizeof(*ef)); if (ef == NULL) { close(fd); return (ENOMEM); @@ -352,7 +352,6 @@ ef_obj_open(const char *filename, struct efile->ef_ef = ef; efile->ef_ops = &ef_obj_file_ops; - bzero(ef, sizeof(*ef)); ef->ef_verbose = verbose; ef->ef_fd = fd; ef->ef_name = strdup(filename); From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 22:21:13 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C4D772FF; Wed, 5 Jun 2013 22:21:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9C6101796; Wed, 5 Jun 2013 22:21:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55MLDC9069067; Wed, 5 Jun 2013 22:21:13 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55MLDIk069066; Wed, 5 Jun 2013 22:21:13 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306052221.r55MLDIk069066@svn.freebsd.org> From: Adrian Chadd Date: Wed, 5 Jun 2013 22:21:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251441 - head/sys/dev/ath/ath_hal/ar9002 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 22:21:13 -0000 Author: adrian Date: Wed Jun 5 22:21:13 2013 New Revision: 251441 URL: http://svnweb.freebsd.org/changeset/base/251441 Log: As a temporary work-around (read: until there's a nice API for exposing and controlling this form of antenna diversity) - print out the AR9285 antenna diversity configuration at attach time. This will help track down and diagose if/when people have connectivity issues on cards (eg if they connect a single antenna to LNA1, yet the card has RX configured to only occur on LNA2.) Tested: * AR9285 w/ antenna diversity enabled in EEPROM; * AR9285 w/ antenna diversity disabled in EEPROM; mapping only to a single antenna (LNA1.) Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Wed Jun 5 21:56:29 2013 (r251440) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Wed Jun 5 22:21:13 2013 (r251441) @@ -105,6 +105,28 @@ ar9285AniSetup(struct ath_hal *ah) ar5416AniAttach(ah, &aniparams, &aniparams, AH_TRUE); } +static const char * ar9285_lna_conf[] = { + "LNA1-LNA2", + "LNA2", + "LNA1", + "LNA1+LNA2", +}; + +static void +ar9285_eeprom_print_diversity_settings(struct ath_hal *ah) +{ + const HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader; + + ath_hal_printf(ah, "[ath] AR9285 Main LNA config: %s\n", + ar9285_lna_conf[(pModal->antdiv_ctl2 >> 2) & 0x3]); + ath_hal_printf(ah, "[ath] AR9285 Alt LNA config: %s\n", + ar9285_lna_conf[pModal->antdiv_ctl2 & 0x3]); + ath_hal_printf(ah, "[ath] LNA diversity %s, Diversity %s\n", + ((pModal->antdiv_ctl1 & 0x1) ? "enabled" : "disabled"), + ((pModal->antdiv_ctl1 & 0x8) ? "enabled" : "disabled")); +} + /* * Attach for an AR9285 part. */ @@ -309,6 +331,13 @@ ar9285Attach(uint16_t devid, HAL_SOFTC s goto bad; } + /* + * Print out the EEPROM antenna configuration mapping. + * Some devices have a hard-coded LNA configuration profile; + * others enable diversity. + */ + ar9285_eeprom_print_diversity_settings(ah); + /* Print out whether the EEPROM settings enable AR9285 diversity */ if (ar9285_check_div_comb(ah)) { ath_hal_printf(ah, "[ath] Enabling diversity for Kite\n"); From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 22:23:13 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A1A26724; Wed, 5 Jun 2013 22:23:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9223F17B1; Wed, 5 Jun 2013 22:23:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55MNDOH069607; Wed, 5 Jun 2013 22:23:13 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55MND2f069606; Wed, 5 Jun 2013 22:23:13 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306052223.r55MND2f069606@svn.freebsd.org> From: Adrian Chadd Date: Wed, 5 Jun 2013 22:23:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251442 - head/sys/dev/ath/ath_hal/ar9002 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 22:23:13 -0000 Author: adrian Date: Wed Jun 5 22:23:13 2013 New Revision: 251442 URL: http://svnweb.freebsd.org/changeset/base/251442 Log: Enable slow diversity combining for the AR9285. Now that I understand what's going on - and the RX antenna array maps to what the receive LNA configuration actually is - I feel comfortable in enabling this. If people do have issues with this, there's enough debugging now available that we have a chance to diagnose it without writing it up as 'weird crap.' Tested: * AR9285 STA w/ diversity combining enabled in EEPROM TODO: * (More) testing in hostap mode Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c Wed Jun 5 22:21:13 2013 (r251441) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c Wed Jun 5 22:23:13 2013 (r251442) @@ -87,8 +87,10 @@ ar9285_check_div_comb(struct ath_hal *ah HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader; +#if 0 /* For now, simply disable this until it's better debugged. -adrian */ return AH_FALSE; +#endif if (! AR_SREV_KITE(ah)) return AH_FALSE; From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 22:27:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A83629B4; Wed, 5 Jun 2013 22:27:49 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9B76B17D5; Wed, 5 Jun 2013 22:27:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55MRniV070401; Wed, 5 Jun 2013 22:27:49 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55MRnmo070400; Wed, 5 Jun 2013 22:27:49 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201306052227.r55MRnmo070400@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 5 Jun 2013 22:27:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251443 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 22:27:49 -0000 Author: jilles Date: Wed Jun 5 22:27:49 2013 New Revision: 251443 URL: http://svnweb.freebsd.org/changeset/base/251443 Log: release: Allow empty extra distributions. For example, WITHOUT_SHAREDOCS= in src.conf creates an empty doc distribution. Submitted by: Kurt Lidl Tested by: Kurt Lidl Discussed with: gjb MFC after: 1 week Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Jun 5 22:23:13 2013 (r251442) +++ head/Makefile.inc1 Wed Jun 5 22:27:49 2013 (r251443) @@ -798,7 +798,7 @@ distributeworld installworld: installche ${IMAKEENV} rm -rf ${INSTALLTMP} .if make(distributeworld) .for dist in ${EXTRA_DISTRIBUTIONS} - find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete + find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete .endfor .if defined(NO_ROOT) .for dist in base ${EXTRA_DISTRIBUTIONS} From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 23:17:40 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 021683F1; Wed, 5 Jun 2013 23:17:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E6FFA1946; Wed, 5 Jun 2013 23:17:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55NHdmS085549; Wed, 5 Jun 2013 23:17:39 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55NHd6Y085548; Wed, 5 Jun 2013 23:17:39 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306052317.r55NHd6Y085548@svn.freebsd.org> From: Rick Macklem Date: Wed, 5 Jun 2013 23:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251444 - head/usr.sbin/gssd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 23:17:40 -0000 Author: rmacklem Date: Wed Jun 5 23:17:39 2013 New Revision: 251444 URL: http://svnweb.freebsd.org/changeset/base/251444 Log: Add a "-v" (verbose) option to the gssd daemon, to help with diagnosis of kerberized NFS mount problems. When set, messages are sent to syslog() (or fprintf(stderr,...) if "-d" is also specified) to indicate activity/results of kgssapi upcalls. Reviewed by: jhb MFC after: 2 weeks Modified: head/usr.sbin/gssd/gssd.c Modified: head/usr.sbin/gssd/gssd.c ============================================================================== --- head/usr.sbin/gssd/gssd.c Wed Jun 5 22:27:49 2013 (r251443) +++ head/usr.sbin/gssd/gssd.c Wed Jun 5 23:17:39 2013 (r251444) @@ -71,10 +71,12 @@ uint32_t gss_start_time; int debug_level; static char ccfile_dirlist[PATH_MAX + 1], ccfile_substring[NAME_MAX + 1]; static char pref_realm[1024]; +static int verbose; static void gssd_load_mech(void); static int find_ccache_file(const char *, uid_t, char *); static int is_a_valid_tgt_cache(const char *, uid_t, int *, time_t *); +static void gssd_verbose_out(const char *, ...); extern void gssd_1(struct svc_req *rqstp, SVCXPRT *transp); extern int gssd_syscall(char *path); @@ -99,11 +101,15 @@ main(int argc, char **argv) ccfile_dirlist[0] = '\0'; pref_realm[0] = '\0'; debug = 0; - while ((ch = getopt(argc, argv, "ds:c:r:")) != -1) { + verbose = 0; + while ((ch = getopt(argc, argv, "dvs:c:r:")) != -1) { switch (ch) { case 'd': debug_level++; break; + case 'v': + verbose = 1; + break; case 's': #ifndef WITHOUT_KERBEROS /* @@ -299,10 +305,26 @@ gssd_delete_resource(uint64_t id) } } +static void +gssd_verbose_out(const char *fmt, ...) +{ + va_list ap; + + if (verbose != 0) { + va_start(ap, fmt); + if (debug_level == 0) + vsyslog(LOG_INFO | LOG_DAEMON, fmt, ap); + else + vfprintf(stderr, fmt, ap); + va_end(ap); + } +} + bool_t gssd_null_1_svc(void *argp, void *result, struct svc_req *rqstp) { + gssd_verbose_out("gssd_null: done\n"); return (TRUE); } @@ -337,6 +359,9 @@ gssd_init_sec_context_1_svc(init_sec_con } while (cp != NULL && *cp != '\0'); if (gotone == 0) { result->major_status = GSS_S_CREDENTIALS_EXPIRED; + gssd_verbose_out("gssd_init_sec_context: -s no" + " credential cache file found for uid=%d\n", + (int)argp->uid); return (TRUE); } } else { @@ -362,6 +387,8 @@ gssd_init_sec_context_1_svc(init_sec_con cred = gssd_find_resource(argp->cred); if (!cred) { result->major_status = GSS_S_CREDENTIALS_EXPIRED; + gssd_verbose_out("gssd_init_sec_context: cred" + " resource not found\n"); return (TRUE); } } @@ -369,6 +396,8 @@ gssd_init_sec_context_1_svc(init_sec_con ctx = gssd_find_resource(argp->ctx); if (!ctx) { result->major_status = GSS_S_CONTEXT_EXPIRED; + gssd_verbose_out("gssd_init_sec_context: context" + " resource not found\n"); return (TRUE); } } @@ -376,6 +405,8 @@ gssd_init_sec_context_1_svc(init_sec_con name = gssd_find_resource(argp->name); if (!name) { result->major_status = GSS_S_BAD_NAME; + gssd_verbose_out("gssd_init_sec_context: name" + " resource not found\n"); return (TRUE); } } @@ -385,6 +416,9 @@ gssd_init_sec_context_1_svc(init_sec_con argp->req_flags, argp->time_req, argp->input_chan_bindings, &argp->input_token, &result->actual_mech_type, &result->output_token, &result->ret_flags, &result->time_rec); + gssd_verbose_out("gssd_init_sec_context: done major=0x%x minor=%d" + " uid=%d\n", (unsigned int)result->major_status, + (int)result->minor_status, (int)argp->uid); if (result->major_status == GSS_S_COMPLETE || result->major_status == GSS_S_CONTINUE_NEEDED) { @@ -410,6 +444,8 @@ gssd_accept_sec_context_1_svc(accept_sec ctx = gssd_find_resource(argp->ctx); if (!ctx) { result->major_status = GSS_S_CONTEXT_EXPIRED; + gssd_verbose_out("gssd_accept_sec_context: ctx" + " resource not found\n"); return (TRUE); } } @@ -417,6 +453,8 @@ gssd_accept_sec_context_1_svc(accept_sec cred = gssd_find_resource(argp->cred); if (!cred) { result->major_status = GSS_S_CREDENTIALS_EXPIRED; + gssd_verbose_out("gssd_accept_sec_context: cred" + " resource not found\n"); return (TRUE); } } @@ -427,6 +465,8 @@ gssd_accept_sec_context_1_svc(accept_sec &src_name, &result->mech_type, &result->output_token, &result->ret_flags, &result->time_rec, &delegated_cred_handle); + gssd_verbose_out("gssd_accept_sec_context: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); if (result->major_status == GSS_S_COMPLETE || result->major_status == GSS_S_CONTINUE_NEEDED) { @@ -455,6 +495,8 @@ gssd_delete_sec_context_1_svc(delete_sec result->major_status = GSS_S_COMPLETE; result->minor_status = 0; } + gssd_verbose_out("gssd_delete_sec_context: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); return (TRUE); } @@ -476,6 +518,8 @@ gssd_export_sec_context_1_svc(export_sec result->interprocess_token.length = 0; result->interprocess_token.value = NULL; } + gssd_verbose_out("gssd_export_sec_context: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); return (TRUE); } @@ -487,6 +531,8 @@ gssd_import_name_1_svc(import_name_args result->major_status = gss_import_name(&result->minor_status, &argp->input_name_buffer, argp->input_name_type, &name); + gssd_verbose_out("gssd_import_name: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); if (result->major_status == GSS_S_COMPLETE) result->output_name = gssd_make_resource(name); @@ -510,6 +556,8 @@ gssd_canonicalize_name_1_svc(canonicaliz result->major_status = gss_canonicalize_name(&result->minor_status, name, argp->mech_type, &output_name); + gssd_verbose_out("gssd_canonicalize_name: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); if (result->major_status == GSS_S_COMPLETE) result->output_name = gssd_make_resource(output_name); @@ -527,11 +575,14 @@ gssd_export_name_1_svc(export_name_args memset(result, 0, sizeof(*result)); if (!name) { result->major_status = GSS_S_BAD_NAME; + gssd_verbose_out("gssd_export_name: name resource not found\n"); return (TRUE); } result->major_status = gss_export_name(&result->minor_status, name, &result->exported_name); + gssd_verbose_out("gssd_export_name: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); return (TRUE); } @@ -549,6 +600,8 @@ gssd_release_name_1_svc(release_name_arg result->major_status = GSS_S_COMPLETE; result->minor_status = 0; } + gssd_verbose_out("gssd_release_name: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); return (TRUE); } @@ -600,17 +653,27 @@ gssd_pname_to_uid_1_svc(pname_to_uid_arg mem_alloc(len * sizeof(int)); memcpy(result->gidlist.gidlist_val, groups, len * sizeof(int)); + gssd_verbose_out("gssd_pname_to_uid: mapped" + " to uid=%d, gid=%d\n", (int)result->uid, + (int)result->gid); } else { result->gid = 65534; result->gidlist.gidlist_len = 0; result->gidlist.gidlist_val = NULL; + gssd_verbose_out("gssd_pname_to_uid: mapped" + " to uid=%d, but no groups\n", + (int)result->uid); } if (bufp != NULL && buflen > sizeof(buf)) free(bufp); - } + } else + gssd_verbose_out("gssd_pname_to_uid: failed major=0x%x" + " minor=%d\n", (unsigned int)result->major_status, + (int)result->minor_status); } else { result->major_status = GSS_S_BAD_NAME; result->minor_status = 0; + gssd_verbose_out("gssd_pname_to_uid: no name\n"); } return (TRUE); @@ -646,6 +709,8 @@ gssd_acquire_cred_1_svc(acquire_cred_arg } while (cp != NULL && *cp != '\0'); if (gotone == 0) { result->major_status = GSS_S_CREDENTIALS_EXPIRED; + gssd_verbose_out("gssd_acquire_cred: no cred cache" + " file found\n"); return (TRUE); } } else { @@ -672,6 +737,8 @@ gssd_acquire_cred_1_svc(acquire_cred_arg desired_name = gssd_find_resource(argp->desired_name); if (!desired_name) { result->major_status = GSS_S_BAD_NAME; + gssd_verbose_out("gssd_acquire_cred: no desired name" + " found\n"); return (TRUE); } } @@ -679,6 +746,8 @@ gssd_acquire_cred_1_svc(acquire_cred_arg result->major_status = gss_acquire_cred(&result->minor_status, desired_name, argp->time_req, argp->desired_mechs, argp->cred_usage, &cred, &result->actual_mechs, &result->time_rec); + gssd_verbose_out("gssd_acquire_cred: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); if (result->major_status == GSS_S_COMPLETE) result->output_cred = gssd_make_resource(cred); @@ -696,11 +765,14 @@ gssd_set_cred_option_1_svc(set_cred_opti memset(result, 0, sizeof(*result)); if (!cred) { result->major_status = GSS_S_CREDENTIALS_EXPIRED; + gssd_verbose_out("gssd_set_cred: no credentials\n"); return (TRUE); } result->major_status = gss_set_cred_option(&result->minor_status, &cred, argp->option_name, &argp->option_value); + gssd_verbose_out("gssd_set_cred: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); return (TRUE); } @@ -718,6 +790,8 @@ gssd_release_cred_1_svc(release_cred_arg result->major_status = GSS_S_COMPLETE; result->minor_status = 0; } + gssd_verbose_out("gssd_release_cred: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); return (TRUE); } @@ -730,6 +804,8 @@ gssd_display_status_1_svc(display_status result->major_status = gss_display_status(&result->minor_status, argp->status_value, argp->status_type, argp->mech_type, &result->message_context, &result->status_string); + gssd_verbose_out("gssd_display_status: done major=0x%x minor=%d\n", + (unsigned int)result->major_status, (int)result->minor_status); return (TRUE); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 23:28:30 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 363F06E4; Wed, 5 Jun 2013 23:28:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 284D519A7; Wed, 5 Jun 2013 23:28:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55NSU8U088615; Wed, 5 Jun 2013 23:28:30 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55NSUrK088614; Wed, 5 Jun 2013 23:28:30 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306052328.r55NSUrK088614@svn.freebsd.org> From: Rick Macklem Date: Wed, 5 Jun 2013 23:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251445 - head/usr.sbin/gssd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 23:28:30 -0000 Author: rmacklem Date: Wed Jun 5 23:28:29 2013 New Revision: 251445 URL: http://svnweb.freebsd.org/changeset/base/251445 Log: Document the new "-v" option for the gssd daemon. This is a content change. MFC after: 2 weeks Modified: head/usr.sbin/gssd/gssd.8 Modified: head/usr.sbin/gssd/gssd.8 ============================================================================== --- head/usr.sbin/gssd/gssd.8 Wed Jun 5 23:17:39 2013 (r251444) +++ head/usr.sbin/gssd/gssd.8 Wed Jun 5 23:28:29 2013 (r251445) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 30, 2012 +.Dd June 5, 2013 .Dt GSSD 8 .Os .Sh NAME @@ -34,6 +34,7 @@ .Sh SYNOPSIS .Nm .Op Fl d +.Op Fl v .Op Fl s Ar dir-list .Op Fl c Ar file-substring .Op Fl r Ar preferred-realm @@ -49,6 +50,16 @@ Run in debug mode. In this mode, .Nm will not fork when it starts. +.It Fl v +Run in verbose mode. +In this mode, +.Nm +will log activity messages to syslog using LOG_INFO | LOG_DAEMON or to +stderr, if the +.Fl d +option has also been specified. +The minor status is logged as a decimal number, since it is actually a +Kerberos return status, which is signed. .It Fl s Ar dir-list Look for an appropriate credential cache file in this list of directories. The list should be full pathnames from root, separated by ':' characters. @@ -79,7 +90,8 @@ by kernel GSS-API services. .Sh EXIT STATUS .Ex -std .Sh SEE ALSO -.Xr gssapi 3 +.Xr gssapi 3 , +.Xr syslog 3 .Sh HISTORY The .Nm From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 23:53:00 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9AC0A9AA; Wed, 5 Jun 2013 23:53:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7C5AB1A41; Wed, 5 Jun 2013 23:53:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55Nr0pv096759; Wed, 5 Jun 2013 23:53:00 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55Nr0nx096758; Wed, 5 Jun 2013 23:53:00 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201306052353.r55Nr0nx096758@svn.freebsd.org> From: Jeff Roberson Date: Wed, 5 Jun 2013 23:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251446 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 23:53:00 -0000 Author: jeff Date: Wed Jun 5 23:53:00 2013 New Revision: 251446 URL: http://svnweb.freebsd.org/changeset/base/251446 Log: - Consolidate duplicate code into support functions. - Split the bqlock into bqclean and bqdirty locks. - Only acquire the wakeup synchronization locks when we cross a threshold requiring them. - Restructure the way flushbufqueues() targets work so they are more smp friendly and sane. Reviewed by: kib Discussed with: mckusick, attilio Sponsored by: EMC / Isilon Storage Division M vfs_bio.c Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Jun 5 23:28:29 2013 (r251445) +++ head/sys/kern/vfs_bio.c Wed Jun 5 23:53:00 2013 (r251446) @@ -113,10 +113,11 @@ static void vfs_setdirty_locked_object(s static void vfs_vmio_release(struct buf *bp); static int vfs_bio_clcheck(struct vnode *vp, int size, daddr_t lblkno, daddr_t blkno); -static int buf_do_flush(struct vnode *vp); +static int buf_flush(struct vnode *vp, int); static int flushbufqueues(struct vnode *, int, int); static void buf_daemon(void); static void bremfreel(struct buf *bp); +static __inline void bd_wakeup(void); #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) static int sysctl_bufspace(SYSCTL_HANDLER_ARGS); @@ -217,8 +218,8 @@ SYSCTL_INT(_vfs, OID_AUTO, mappingrestar static int flushbufqtarget = 100; SYSCTL_INT(_vfs, OID_AUTO, flushbufqtarget, CTLFLAG_RW, &flushbufqtarget, 0, "Amount of work to do in flushbufqueues when helping bufdaemon"); -static long notbufdflashes; -SYSCTL_LONG(_vfs, OID_AUTO, notbufdflashes, CTLFLAG_RD, ¬bufdflashes, 0, +static long notbufdflushes; +SYSCTL_LONG(_vfs, OID_AUTO, notbufdflushes, CTLFLAG_RD, ¬bufdflushes, 0, "Number of dirty buffer flushes done by the bufdaemon helpers"); static long barrierwrites; SYSCTL_LONG(_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW, &barrierwrites, 0, @@ -228,6 +229,37 @@ SYSCTL_INT(_vfs, OID_AUTO, unmapped_buf_ "Permit the use of the unmapped i/o"); /* + * Lock for the non-dirty bufqueues + */ +static struct mtx_padalign bqclean; + +/* + * Lock for the dirty queue. + */ +static struct mtx_padalign bqdirty; + +/* + * This lock synchronizes access to bd_request. + */ +static struct mtx_padalign bdlock; + +/* + * This lock protects the runningbufreq and synchronizes runningbufwakeup and + * waitrunningbufspace(). + */ +static struct mtx_padalign rbreqlock; + +/* + * Lock that protects needsbuffer and the sleeps/wakeups surrounding it. + */ +static struct mtx_padalign nblock; + +/* + * Lock that protects bdirtywait. + */ +static struct mtx_padalign bdirtylock; + +/* * Wakeup point for bufdaemon, as well as indicator of whether it is already * active. Set to 1 when the bufdaemon is already "on" the queue, 0 when it * is idling. @@ -243,11 +275,6 @@ static int bd_request; static int bd_speedupreq; /* - * This lock synchronizes access to bd_request. - */ -static struct mtx bdlock; - -/* * bogus page -- for I/O to/from partially complete buffers * this is a temporary solution to the problem, but it is not * really that bad. it would be better to split the buffer @@ -263,25 +290,19 @@ vm_page_t bogus_page; */ static int runningbufreq; -/* - * This lock protects the runningbufreq and synchronizes runningbufwakeup and - * waitrunningbufspace(). - */ -static struct mtx rbreqlock; - /* * Synchronization (sleep/wakeup) variable for buffer requests. * Can contain the VFS_BIO_NEED flags defined below; setting/clearing is done * by and/or. - * Used in numdirtywakeup(), bufspacewakeup(), bufcountwakeup(), bwillwrite(), + * Used in numdirtywakeup(), bufspacewakeup(), bufcountadd(), bwillwrite(), * getnewbuf(), and getblk(). */ static int needsbuffer; /* - * Lock that protects needsbuffer and the sleeps/wakeups surrounding it. + * Synchronization for bwillwrite() waiters. */ -static struct mtx nblock; +static int bdirtywait; /* * Definitions for the buffer free lists. @@ -301,9 +322,6 @@ static TAILQ_HEAD(bqueues, buf) bufqueue static int bq_len[BUFFER_QUEUES]; #endif -/* Lock for the bufqueues */ -static struct mtx bqlock; - /* * Single global constant for BUF_WMESG, to avoid getting multiple references. * buf_wmesg is referred from macros. @@ -311,7 +329,6 @@ static struct mtx bqlock; const char *buf_wmesg = BUF_WMESG; #define VFS_BIO_NEED_ANY 0x01 /* any freeable buffer */ -#define VFS_BIO_NEED_DIRTYFLUSH 0x02 /* waiting for dirty buffer flush */ #define VFS_BIO_NEED_FREE 0x04 /* wait for free bufs, hi hysteresis */ #define VFS_BIO_NEED_BUFSPACE 0x08 /* wait for buf space, lo hysteresis */ @@ -337,25 +354,69 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) #ifdef DIRECTIO extern void ffs_rawread_setup(void); #endif /* DIRECTIO */ + /* - * numdirtywakeup: + * bqlock: * - * If someone is blocked due to there being too many dirty buffers, - * and numdirtybuffers is now reasonable, wake them up. + * Return the appropriate queue lock based on the index. */ - -static __inline void -numdirtywakeup(int level) +static inline struct mtx * +bqlock(int qindex) { - if (numdirtybuffers <= level) { - mtx_lock(&nblock); - if (needsbuffer & VFS_BIO_NEED_DIRTYFLUSH) { - needsbuffer &= ~VFS_BIO_NEED_DIRTYFLUSH; - wakeup(&needsbuffer); - } - mtx_unlock(&nblock); + if (qindex == QUEUE_DIRTY) + return (struct mtx *)(&bqdirty); + return (struct mtx *)(&bqclean); +} + +/* + * bdirtywakeup: + * + * Wakeup any bwillwrite() waiters. + */ +static void +bdirtywakeup(void) +{ + mtx_lock(&bdirtylock); + if (bdirtywait) { + bdirtywait = 0; + wakeup(&bdirtywait); } + mtx_unlock(&bdirtylock); +} + +/* + * bdirtysub: + * + * Decrement the numdirtybuffers count by one and wakeup any + * threads blocked in bwillwrite(). + */ +static void +bdirtysub(void) +{ + + if (atomic_fetchadd_int(&numdirtybuffers, -1) == + (lodirtybuffers + hidirtybuffers) / 2) + bdirtywakeup(); +} + +/* + * bdirtyadd: + * + * Increment the numdirtybuffers count by one and wakeup the buf + * daemon if needed. + */ +static void +bdirtyadd(void) +{ + + /* + * Only do the wakeup once as we cross the boundary. The + * buf daemon will keep running until the condition clears. + */ + if (atomic_fetchadd_int(&numdirtybuffers, 1) == + (lodirtybuffers + hidirtybuffers) / 2) + bd_wakeup(); } /* @@ -385,36 +446,59 @@ bufspacewakeup(void) } /* - * runningbufwakeup() - in-progress I/O accounting. + * runningwakeup: * + * Wake up processes that are waiting on asynchronous writes to fall + * below lorunningspace. + */ +static void +runningwakeup(void) +{ + + mtx_lock(&rbreqlock); + if (runningbufreq) { + runningbufreq = 0; + wakeup(&runningbufreq); + } + mtx_unlock(&rbreqlock); +} + +/* + * runningbufwakeup: + * + * Decrement the outstanding write count according. */ void runningbufwakeup(struct buf *bp) { + long space, bspace; - if (bp->b_runningbufspace) { - atomic_subtract_long(&runningbufspace, bp->b_runningbufspace); - bp->b_runningbufspace = 0; - mtx_lock(&rbreqlock); - if (runningbufreq && runningbufspace <= lorunningspace) { - runningbufreq = 0; - wakeup(&runningbufreq); - } - mtx_unlock(&rbreqlock); - } + if (bp->b_runningbufspace == 0) + return; + space = atomic_fetchadd_long(&runningbufspace, -bp->b_runningbufspace); + bspace = bp->b_runningbufspace; + bp->b_runningbufspace = 0; + /* + * Only acquire the lock and wakeup on the transition from exceeding + * the threshold to falling below it. + */ + if (space < lorunningspace) + return; + if (space - bspace > lorunningspace) + return; + runningwakeup(); } /* - * bufcountwakeup: + * bufcountadd: * * Called when a buffer has been added to one of the free queues to * account for the buffer and to wakeup anyone waiting for free buffers. * This typically occurs when large amounts of metadata are being handled * by the buffer cache ( else buffer space runs out first, usually ). */ - static __inline void -bufcountwakeup(struct buf *bp) +bufcountadd(struct buf *bp) { int old; @@ -435,6 +519,30 @@ bufcountwakeup(struct buf *bp) } /* + * bufcountsub: + * + * Decrement the numfreebuffers count as needed. + */ +static void +bufcountsub(struct buf *bp) +{ + int old; + + /* + * Fixup numfreebuffers count. If the buffer is invalid or not + * delayed-write, the buffer was free and we must decrement + * numfreebuffers. + */ + if ((bp->b_flags & B_INVAL) || (bp->b_flags & B_DELWRI) == 0) { + KASSERT((bp->b_flags & B_INFREECNT) != 0, + ("buf %p not counted in numfreebuffers", bp)); + bp->b_flags &= ~B_INFREECNT; + old = atomic_fetchadd_int(&numfreebuffers, -1); + KASSERT(old > 0, ("numfreebuffers dropped to %d", old - 1)); + } +} + +/* * waitrunningbufspace() * * runningbufspace is a measure of the amount of I/O currently @@ -442,9 +550,6 @@ bufcountwakeup(struct buf *bp) * prevent creating huge backups of pending writes to a device. * Only asynchronous writes are governed by this function. * - * Reads will adjust runningbufspace, but will not block based on it. - * The read load has a side effect of reducing the allowed write load. - * * This does NOT turn an async write into a sync write. It waits * for earlier writes to complete and generally returns before the * caller's write has reached the device. @@ -485,13 +590,12 @@ vfs_buf_test_cache(struct buf *bp, } /* Wake up the buffer daemon if necessary */ -static __inline -void -bd_wakeup(int dirtybuflevel) +static __inline void +bd_wakeup(void) { mtx_lock(&bdlock); - if (bd_request == 0 && numdirtybuffers >= dirtybuflevel) { + if (bd_request == 0) { bd_request = 1; wakeup(&bd_request); } @@ -501,7 +605,6 @@ bd_wakeup(int dirtybuflevel) /* * bd_speedup - speedup the buffer cache flushing code */ - void bd_speedup(void) { @@ -656,10 +759,12 @@ bufinit(void) struct buf *bp; int i; - mtx_init(&bqlock, "buf queue lock", NULL, MTX_DEF); + mtx_init(&bqclean, "bufq clean lock", NULL, MTX_DEF); + mtx_init(&bqdirty, "bufq dirty lock", NULL, MTX_DEF); mtx_init(&rbreqlock, "runningbufspace lock", NULL, MTX_DEF); mtx_init(&nblock, "needsbuffer lock", NULL, MTX_DEF); mtx_init(&bdlock, "buffer daemon lock", NULL, MTX_DEF); + mtx_init(&bdirtylock, "dirty buf lock", NULL, MTX_DEF); /* next, make a null set of free lists */ for (i = 0; i < BUFFER_QUEUES; i++) @@ -831,15 +936,60 @@ bfreekva(struct buf *bp) } /* + * binsfree: + * + * Insert the buffer into the appropriate free list. + */ +static void +binsfree(struct buf *bp, int qindex) +{ + struct mtx *olock, *nlock; + + BUF_ASSERT_XLOCKED(bp); + + olock = bqlock(bp->b_qindex); + nlock = bqlock(qindex); + mtx_lock(olock); + /* Handle delayed bremfree() processing. */ + if (bp->b_flags & B_REMFREE) + bremfreel(bp); + + if (bp->b_qindex != QUEUE_NONE) + panic("binsfree: free buffer onto another queue???"); + + bp->b_qindex = qindex; + if (olock != nlock) { + mtx_unlock(olock); + mtx_lock(nlock); + } + if (bp->b_flags & B_AGE) + TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist); + else + TAILQ_INSERT_TAIL(&bufqueues[bp->b_qindex], bp, b_freelist); +#ifdef INVARIANTS + bq_len[bp->b_qindex]++; +#endif + mtx_unlock(nlock); + + /* + * Something we can maybe free or reuse. + */ + if (bp->b_bufsize && !(bp->b_flags & B_DELWRI)) + bufspacewakeup(); + + if ((bp->b_flags & B_INVAL) || !(bp->b_flags & B_DELWRI)) + bufcountadd(bp); +} + +/* * bremfree: * - * Mark the buffer for removal from the appropriate free list in brelse. + * Mark the buffer for removal from the appropriate free list. * */ void bremfree(struct buf *bp) { - int old; CTR3(KTR_BUF, "bremfree(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); KASSERT((bp->b_flags & B_REMFREE) == 0, @@ -849,14 +999,7 @@ bremfree(struct buf *bp) BUF_ASSERT_XLOCKED(bp); bp->b_flags |= B_REMFREE; - /* Fixup numfreebuffers count. */ - if ((bp->b_flags & B_INVAL) || (bp->b_flags & B_DELWRI) == 0) { - KASSERT((bp->b_flags & B_INFREECNT) != 0, - ("buf %p not counted in numfreebuffers", bp)); - bp->b_flags &= ~B_INFREECNT; - old = atomic_fetchadd_int(&numfreebuffers, -1); - KASSERT(old > 0, ("numfreebuffers dropped to %d", old - 1)); - } + bufcountsub(bp); } /* @@ -868,28 +1011,30 @@ bremfree(struct buf *bp) void bremfreef(struct buf *bp) { - mtx_lock(&bqlock); + struct mtx *qlock; + + qlock = bqlock(bp->b_qindex); + mtx_lock(qlock); bremfreel(bp); - mtx_unlock(&bqlock); + mtx_unlock(qlock); } /* * bremfreel: * * Removes a buffer from the free list, must be called with the - * bqlock held. + * correct qlock held. */ static void bremfreel(struct buf *bp) { - int old; CTR3(KTR_BUF, "bremfreel(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); KASSERT(bp->b_qindex != QUEUE_NONE, ("bremfreel: buffer %p not on a queue.", bp)); BUF_ASSERT_XLOCKED(bp); - mtx_assert(&bqlock, MA_OWNED); + mtx_assert(bqlock(bp->b_qindex), MA_OWNED); TAILQ_REMOVE(&bufqueues[bp->b_qindex], bp, b_freelist); #ifdef INVARIANTS @@ -906,18 +1051,7 @@ bremfreel(struct buf *bp) bp->b_flags &= ~B_REMFREE; return; } - /* - * Fixup numfreebuffers count. If the buffer is invalid or not - * delayed-write, the buffer was free and we must decrement - * numfreebuffers. - */ - if ((bp->b_flags & B_INVAL) || (bp->b_flags & B_DELWRI) == 0) { - KASSERT((bp->b_flags & B_INFREECNT) != 0, - ("buf %p not counted in numfreebuffers", bp)); - bp->b_flags &= ~B_INFREECNT; - old = atomic_fetchadd_int(&numfreebuffers, -1); - KASSERT(old > 0, ("numfreebuffers dropped to %d", old - 1)); - } + bufcountsub(bp); } /* @@ -1018,6 +1152,7 @@ bufwrite(struct buf *bp) { int oldflags; struct vnode *vp; + long space; int vp_md; CTR3(KTR_BUF, "bufwrite(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); @@ -1065,7 +1200,7 @@ bufwrite(struct buf *bp) * Normal bwrites pipeline writes */ bp->b_runningbufspace = bp->b_bufsize; - atomic_add_long(&runningbufspace, bp->b_runningbufspace); + space = atomic_fetchadd_long(&runningbufspace, bp->b_runningbufspace); if (!TD_IS_IDLETHREAD(curthread)) curthread->td_ru.ru_oublock++; @@ -1078,7 +1213,7 @@ bufwrite(struct buf *bp) int rtval = bufwait(bp); brelse(bp); return (rtval); - } else { + } else if (space > hirunningspace) { /* * don't allow the async write to saturate the I/O * system. We will not deadlock here because @@ -1213,13 +1348,6 @@ bdwrite(struct buf *bp) bqrelse(bp); /* - * Wakeup the buffer flushing daemon if we have a lot of dirty - * buffers (midpoint between our recovery point and our stall - * point). - */ - bd_wakeup((lodirtybuffers + hidirtybuffers) / 2); - - /* * note: we cannot initiate I/O from a bdwrite even if we wanted to, * due to the softdep code. */ @@ -1259,8 +1387,7 @@ bdirty(struct buf *bp) if ((bp->b_flags & B_DELWRI) == 0) { bp->b_flags |= /* XXX B_DONE | */ B_DELWRI; reassignbuf(bp); - atomic_add_int(&numdirtybuffers, 1); - bd_wakeup((lodirtybuffers + hidirtybuffers) / 2); + bdirtyadd(); } } @@ -1288,8 +1415,7 @@ bundirty(struct buf *bp) if (bp->b_flags & B_DELWRI) { bp->b_flags &= ~B_DELWRI; reassignbuf(bp); - atomic_subtract_int(&numdirtybuffers, 1); - numdirtywakeup(lodirtybuffers); + bdirtysub(); } /* * Since it is now being written, we can clear its deferred write flag. @@ -1357,20 +1483,18 @@ bbarrierwrite(struct buf *bp) * of any vnodes we attempt to avoid the situation where a locked vnode * prevents the various system daemons from flushing related buffers. */ - void bwillwrite(void) { if (numdirtybuffers >= hidirtybuffers) { - mtx_lock(&nblock); + mtx_lock(&bdirtylock); while (numdirtybuffers >= hidirtybuffers) { - bd_wakeup(1); - needsbuffer |= VFS_BIO_NEED_DIRTYFLUSH; - msleep(&needsbuffer, &nblock, - (PRIBIO + 4), "flswai", 0); + bdirtywait = 1; + msleep(&bdirtywait, &bdirtylock, (PRIBIO + 4), + "flswai", 0); } - mtx_unlock(&nblock); + mtx_unlock(&bdirtylock); } } @@ -1403,6 +1527,8 @@ buf_vm_page_count_severe(void) void brelse(struct buf *bp) { + int qindex; + CTR3(KTR_BUF, "brelse(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); KASSERT(!(bp->b_flags & (B_CLUSTER|B_PAGING)), @@ -1441,10 +1567,8 @@ brelse(struct buf *bp) bp->b_flags |= B_INVAL; if (!LIST_EMPTY(&bp->b_dep)) buf_deallocate(bp); - if (bp->b_flags & B_DELWRI) { - atomic_subtract_int(&numdirtybuffers, 1); - numdirtywakeup(lodirtybuffers); - } + if (bp->b_flags & B_DELWRI) + bdirtysub(); bp->b_flags &= ~(B_DELWRI | B_CACHE); if ((bp->b_flags & B_VMIO) == 0) { if (bp->b_bufsize) @@ -1591,15 +1715,6 @@ brelse(struct buf *bp) brelvp(bp); } - /* enqueue */ - mtx_lock(&bqlock); - /* Handle delayed bremfree() processing. */ - if (bp->b_flags & B_REMFREE) - bremfreel(bp); - - if (bp->b_qindex != QUEUE_NONE) - panic("brelse: free buffer onto another queue???"); - /* * If the buffer has junk contents signal it and eventually * clean up B_DELWRI and diassociate the vnode so that gbincore() @@ -1620,54 +1735,26 @@ brelse(struct buf *bp) bp->b_xflags &= ~(BX_BKGRDWRITE | BX_ALTDATA); if (bp->b_vflags & BV_BKGRDINPROG) panic("losing buffer 1"); - if (bp->b_kvasize) { - bp->b_qindex = QUEUE_EMPTYKVA; - } else { - bp->b_qindex = QUEUE_EMPTY; - } - TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist); + if (bp->b_kvasize) + qindex = QUEUE_EMPTYKVA; + else + qindex = QUEUE_EMPTY; + bp->b_flags |= B_AGE; /* buffers with junk contents */ } else if (bp->b_flags & (B_INVAL | B_NOCACHE | B_RELBUF) || (bp->b_ioflags & BIO_ERROR)) { bp->b_xflags &= ~(BX_BKGRDWRITE | BX_ALTDATA); if (bp->b_vflags & BV_BKGRDINPROG) panic("losing buffer 2"); - bp->b_qindex = QUEUE_CLEAN; - TAILQ_INSERT_HEAD(&bufqueues[QUEUE_CLEAN], bp, b_freelist); + qindex = QUEUE_CLEAN; + bp->b_flags |= B_AGE; /* remaining buffers */ - } else { - if (bp->b_flags & B_DELWRI) - bp->b_qindex = QUEUE_DIRTY; - else - bp->b_qindex = QUEUE_CLEAN; - if (bp->b_flags & B_AGE) { - TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, - b_freelist); - } else { - TAILQ_INSERT_TAIL(&bufqueues[bp->b_qindex], bp, - b_freelist); - } - } -#ifdef INVARIANTS - bq_len[bp->b_qindex]++; -#endif - mtx_unlock(&bqlock); - - /* - * Fixup numfreebuffers count. The bp is on an appropriate queue - * unless locked. We then bump numfreebuffers if it is not B_DELWRI. - * We've already handled the B_INVAL case ( B_DELWRI will be clear - * if B_INVAL is set ). - */ - - if (!(bp->b_flags & B_DELWRI)) - bufcountwakeup(bp); + } else if (bp->b_flags & B_DELWRI) + qindex = QUEUE_DIRTY; + else + qindex = QUEUE_CLEAN; - /* - * Something we can maybe free or reuse - */ - if (bp->b_bufsize || bp->b_kvasize) - bufspacewakeup(); + binsfree(bp, qindex); bp->b_flags &= ~(B_ASYNC | B_NOCACHE | B_AGE | B_RELBUF | B_DIRECT); if ((bp->b_flags & B_DELWRI) == 0 && (bp->b_xflags & BX_VNDIRTY)) @@ -1690,7 +1777,7 @@ brelse(struct buf *bp) void bqrelse(struct buf *bp) { - struct bufobj *bo; + int qindex; CTR3(KTR_BUF, "bqrelse(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); KASSERT(!(bp->b_flags & (B_CLUSTER|B_PAGING)), @@ -1701,71 +1788,40 @@ bqrelse(struct buf *bp) BUF_UNLOCK(bp); return; } + bp->b_flags &= ~(B_ASYNC | B_NOCACHE | B_AGE | B_RELBUF); - bo = bp->b_bufobj; if (bp->b_flags & B_MANAGED) { - if (bp->b_flags & B_REMFREE) { - mtx_lock(&bqlock); - bremfreel(bp); - mtx_unlock(&bqlock); - } - bp->b_flags &= ~(B_ASYNC | B_NOCACHE | B_AGE | B_RELBUF); - BUF_UNLOCK(bp); - return; + if (bp->b_flags & B_REMFREE) + bremfreef(bp); + goto out; } - mtx_lock(&bqlock); - /* Handle delayed bremfree() processing. */ - if (bp->b_flags & B_REMFREE) - bremfreel(bp); - - if (bp->b_qindex != QUEUE_NONE) - panic("bqrelse: free buffer onto another queue???"); /* buffers with stale but valid contents */ if (bp->b_flags & B_DELWRI) { - bp->b_qindex = QUEUE_DIRTY; - TAILQ_INSERT_TAIL(&bufqueues[bp->b_qindex], bp, b_freelist); -#ifdef INVARIANTS - bq_len[bp->b_qindex]++; -#endif + qindex = QUEUE_DIRTY; } else { + if ((bp->b_flags & B_DELWRI) == 0 && + (bp->b_xflags & BX_VNDIRTY)) + panic("bqrelse: not dirty"); /* * BKGRDINPROG can only be set with the buf and bufobj * locks both held. We tolerate a race to clear it here. */ - if (!buf_vm_page_count_severe() || - (bp->b_vflags & BV_BKGRDINPROG)) { - bp->b_qindex = QUEUE_CLEAN; - TAILQ_INSERT_TAIL(&bufqueues[QUEUE_CLEAN], bp, - b_freelist); -#ifdef INVARIANTS - bq_len[QUEUE_CLEAN]++; -#endif - } else { + if (buf_vm_page_count_severe() && + (bp->b_vflags & BV_BKGRDINPROG) == 0) { /* * We are too low on memory, we have to try to free * the buffer (most importantly: the wired pages * making up its backing store) *now*. */ - mtx_unlock(&bqlock); brelse(bp); return; } + qindex = QUEUE_CLEAN; } - mtx_unlock(&bqlock); - - if ((bp->b_flags & B_INVAL) || !(bp->b_flags & B_DELWRI)) - bufcountwakeup(bp); + binsfree(bp, qindex); - /* - * Something we can maybe free or reuse. - */ - if (bp->b_bufsize && !(bp->b_flags & B_DELWRI)) - bufspacewakeup(); - - bp->b_flags &= ~(B_ASYNC | B_NOCACHE | B_AGE | B_RELBUF); - if ((bp->b_flags & B_DELWRI) == 0 && (bp->b_xflags & BX_VNDIRTY)) - panic("bqrelse: not dirty"); +out: /* unlock */ BUF_UNLOCK(bp); } @@ -2000,7 +2056,7 @@ getnewbuf_bufd_help(struct vnode *vp, in char *waitmsg; int fl, flags, norunbuf; - mtx_assert(&bqlock, MA_OWNED); + mtx_assert(&bqclean, MA_OWNED); if (defrag) { flags = VFS_BIO_NEED_BUFSPACE; @@ -2015,7 +2071,7 @@ getnewbuf_bufd_help(struct vnode *vp, in mtx_lock(&nblock); needsbuffer |= flags; mtx_unlock(&nblock); - mtx_unlock(&bqlock); + mtx_unlock(&bqclean); bd_speedup(); /* heeeelp */ if ((gbflags & GB_NOWAIT_BD) != 0) @@ -2038,7 +2094,7 @@ getnewbuf_bufd_help(struct vnode *vp, in (td->td_pflags & TDP_NORUNNINGBUF); /* play bufdaemon */ td->td_pflags |= TDP_BUFNEED | TDP_NORUNNINGBUF; - fl = buf_do_flush(vp); + fl = buf_flush(vp, flushbufqtarget); td->td_pflags &= norunbuf; mtx_lock(&nblock); if (fl != 0) @@ -2060,7 +2116,7 @@ getnewbuf_reuse_bp(struct buf *bp, int q CTR6(KTR_BUF, "getnewbuf(%p) vp %p flags %X kvasize %d bufsize %d " "queue %d (recycling)", bp, bp->b_vp, bp->b_flags, bp->b_kvasize, bp->b_bufsize, qindex); - mtx_assert(&bqlock, MA_NOTOWNED); + mtx_assert(&bqclean, MA_NOTOWNED); /* * Note: we no longer distinguish between VMIO and non-VMIO @@ -2156,7 +2212,7 @@ restart: * where we cannot backup. */ nbp = NULL; - mtx_lock(&bqlock); + mtx_lock(&bqclean); if (!defrag && unmapped) { nqindex = QUEUE_EMPTY; nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTY]); @@ -2267,14 +2323,14 @@ restart: ("getnewbuf: inconsistent queue %d bp %p", qindex, bp)); bremfreel(bp); - mtx_unlock(&bqlock); + mtx_unlock(&bqclean); /* * NOTE: nbp is now entirely invalid. We can only restart * the scan from this point on. */ getnewbuf_reuse_bp(bp, qindex); - mtx_assert(&bqlock, MA_NOTOWNED); + mtx_assert(&bqclean, MA_NOTOWNED); /* * If we are defragging then free the buffer. @@ -2335,10 +2391,6 @@ restart: * We have insufficient buffer space * buffer_map is too fragmented ( space reservation fails ) * If we have to flush dirty buffers ( but we try to avoid this ) - * - * To avoid VFS layer recursion we do not flush dirty buffers ourselves. - * Instead we ask the buf daemon to do it for us. We attempt to - * avoid piecemeal wakeups of the pageout daemon. */ static struct buf * getnewbuf(struct vnode *vp, int slpflag, int slptimeo, int size, int maxsize, @@ -2379,11 +2431,11 @@ restart: * Generally we are sleeping due to insufficient buffer space. */ if (bp == NULL) { - mtx_assert(&bqlock, MA_OWNED); + mtx_assert(&bqclean, MA_OWNED); getnewbuf_bufd_help(vp, gbflags, slpflag, slptimeo, defrag); - mtx_assert(&bqlock, MA_NOTOWNED); + mtx_assert(&bqclean, MA_NOTOWNED); } else if ((gbflags & (GB_UNMAPPED | GB_KVAALLOC)) == GB_UNMAPPED) { - mtx_assert(&bqlock, MA_NOTOWNED); + mtx_assert(&bqclean, MA_NOTOWNED); bfreekva(bp); bp->b_flags |= B_UNMAPPED; @@ -2393,7 +2445,7 @@ restart: atomic_add_long(&unmapped_bufspace, bp->b_kvasize); atomic_add_int(&bufreusecnt, 1); } else { - mtx_assert(&bqlock, MA_NOTOWNED); + mtx_assert(&bqclean, MA_NOTOWNED); /* * We finally have a valid bp. We aren't quite out of the @@ -2464,18 +2516,20 @@ static struct kproc_desc buf_kp = { SYSINIT(bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start, &buf_kp); static int -buf_do_flush(struct vnode *vp) +buf_flush(struct vnode *vp, int target) { int flushed; - flushed = flushbufqueues(vp, QUEUE_DIRTY, 0); + flushed = flushbufqueues(vp, target, 0); if (flushed == 0) { /* * Could not find any buffers without rollback * dependencies, so just write the first one * in the hopes of eventually making progress. */ - flushbufqueues(vp, QUEUE_DIRTY, 1); + if (vp != NULL && target > 2) + target /= 2; + flushbufqueues(vp, target, 1); } return (flushed); } @@ -2483,7 +2537,7 @@ buf_do_flush(struct vnode *vp) static void buf_daemon() { - int lodirtysave; + int lodirty; /* * This process needs to be suspended prior to shutdown sync. @@ -2501,23 +2555,21 @@ buf_daemon() mtx_unlock(&bdlock); kproc_suspend_check(bufdaemonproc); - lodirtysave = lodirtybuffers; + lodirty = lodirtybuffers; if (bd_speedupreq) { - lodirtybuffers = numdirtybuffers / 2; + lodirty = numdirtybuffers / 2; bd_speedupreq = 0; } /* * Do the flush. Limit the amount of in-transit I/O we * allow to build up, otherwise we would completely saturate - * the I/O system. Wakeup any waiting processes before we - * normally would so they can run in parallel with our drain. + * the I/O system. */ - while (numdirtybuffers > lodirtybuffers) { - if (buf_do_flush(NULL) == 0) + while (numdirtybuffers > lodirty) { + if (buf_flush(NULL, numdirtybuffers - lodirty) == 0) break; kern_yield(PRI_USER); } - lodirtybuffers = lodirtysave; /* * Only clear bd_request if we have reached our low water @@ -2526,8 +2578,8 @@ buf_daemon() * built up, within reason. * * If we were unable to hit our low water mark and couldn't - * find any flushable buffers, we sleep half a second. - * Otherwise we loop immediately. + * find any flushable buffers, we sleep for a short period + * to avoid endless loops on unlockable buffers. */ mtx_lock(&bdlock); if (numdirtybuffers <= lodirtybuffers) { @@ -2537,6 +2589,14 @@ buf_daemon() * The sleep is just so the suspend code works. */ bd_request = 0; + /* + * Do an extra wakeup in case dirty threshold + * changed via sysctl and the explicit transition + * out of shortfall was missed. + */ + bdirtywakeup(); + if (runningbufspace <= lorunningspace) + runningwakeup(); msleep(&bd_request, &bdlock, PVM, "psleep", hz); } else { /* @@ -2561,7 +2621,7 @@ SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps 0, "Number of buffers flushed with dependecies that require rollbacks"); static int -flushbufqueues(struct vnode *lvp, int queue, int flushdeps) +flushbufqueues(struct vnode *lvp, int target, int flushdeps) { struct buf *sentinel; struct vnode *vp; @@ -2569,19 +2629,14 @@ flushbufqueues(struct vnode *lvp, int qu struct buf *bp; int hasdeps; int flushed; - int target; + int queue; - if (lvp == NULL) { - target = numdirtybuffers - lodirtybuffers; - if (flushdeps && target > 2) - target /= 2; - } else - target = flushbufqtarget; flushed = 0; + queue = QUEUE_DIRTY; bp = NULL; sentinel = malloc(sizeof(struct buf), M_TEMP, M_WAITOK | M_ZERO); sentinel->b_qindex = QUEUE_SENTINEL; - mtx_lock(&bqlock); + mtx_lock(&bqdirty); TAILQ_INSERT_HEAD(&bufqueues[queue], sentinel, b_freelist); while (flushed != target) { bp = TAILQ_NEXT(sentinel, b_freelist); @@ -2620,11 +2675,10 @@ flushbufqueues(struct vnode *lvp, int qu } if (bp->b_flags & B_INVAL) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 03:18:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0823FD47; Thu, 6 Jun 2013 03:18:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DE7901283; Thu, 6 Jun 2013 03:18:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r563I8Ps061725; Thu, 6 Jun 2013 03:18:08 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r563I8Dt061719; Thu, 6 Jun 2013 03:18:08 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306060318.r563I8Dt061719@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 6 Jun 2013 03:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251447 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 03:18:09 -0000 Author: pfg Date: Thu Jun 6 03:18:07 2013 New Revision: 251447 URL: http://svnweb.freebsd.org/changeset/base/251447 Log: MFC r251336, r251344, r251346: ext2fs: update Block Group Descriptor struct plus cosmetic fixes. Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c stable/9/sys/fs/ext2fs/ext2_dinode.h stable/9/sys/fs/ext2fs/ext2_inode_cnv.c stable/9/sys/fs/ext2fs/ext2fs.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Jun 5 23:53:00 2013 (r251446) +++ stable/9/sys/fs/ext2fs/ext2_bmap.c Thu Jun 6 03:18:07 2013 (r251447) @@ -47,8 +47,8 @@ #include #include -#include #include +#include /* * Bmap converts the logical block number of a file to its physical block Modified: stable/9/sys/fs/ext2fs/ext2_dinode.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_dinode.h Wed Jun 5 23:53:00 2013 (r251446) +++ stable/9/sys/fs/ext2fs/ext2_dinode.h Thu Jun 6 03:18:07 2013 (r251447) @@ -77,7 +77,8 @@ #define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1) #define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS) -#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, EXT2F_ROCOMPAT_EXTRA_ISIZE)) +#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, \ + EXT2F_ROCOMPAT_EXTRA_ISIZE)) /* * Structure of an inode on the disk Modified: stable/9/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Wed Jun 5 23:53:00 2013 (r251446) +++ stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Thu Jun 6 03:18:07 2013 (r251447) @@ -115,7 +115,7 @@ ext2_i2ei(struct inode *ip, struct ext2f int i; ei->e2di_mode = ip->i_mode; - ei->e2di_nlink = ip->i_nlink; + ei->e2di_nlink = ip->i_nlink; /* Godmar thinks: if dtime is nonzero, ext2 says this inode has been deleted, this would correspond to a zero link count Modified: stable/9/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2fs.h Wed Jun 5 23:53:00 2013 (r251446) +++ stable/9/sys/fs/ext2fs/ext2fs.h Thu Jun 6 03:18:07 2013 (r251447) @@ -281,9 +281,13 @@ struct ext2_gd { uint32_t ext2bgd_i_tables; /* inodes table block */ uint16_t ext2bgd_nbfree; /* number of free blocks */ uint16_t ext2bgd_nifree; /* number of free inodes */ - uint16_t ext2bgd_ndirs; /* number of directories */ - uint16_t reserved; - uint32_t reserved2[3]; + uint16_t ext2bgd_ndirs; /* number of directories */ + uint16_t ext2bgd_flags; /* block group flags */ + uint32_t ext2bgd_x_bitmap; /* snapshot exclusion bitmap loc. */ + uint16_t ext2bgd_b_bmap_csum; /* block bitmap checksum */ + uint16_t ext2bgd_i_bmap_csum; /* inode bitmap checksum */ + uint16_t ext2bgd_i_unused; /* unused inode count */ + uint16_t ext2bgd_csum; /* group descriptor checksum */ }; /* cluster summary information */ From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 03:27:56 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8B9AFB8; Thu, 6 Jun 2013 03:27:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from onyx.glenbarber.us (onyx.glenbarber.us [IPv6:2607:fc50:1000:c200::face]) by mx1.freebsd.org (Postfix) with ESMTP id 616B61315; Thu, 6 Jun 2013 03:27:56 +0000 (UTC) Received: from glenbarber.us (kaos.glenbarber.us [71.224.221.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id C255323F848; Wed, 5 Jun 2013 23:27:54 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.8.3 onyx.glenbarber.us C255323F848 Authentication-Results: onyx.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Wed, 5 Jun 2013 23:27:52 -0400 From: Glen Barber To: Jung-uk Kim Subject: Re: svn commit: r251438 - in head/gnu: lib/libregex lib/libregex/posix usr.bin/diff usr.bin/grep Message-ID: <20130606032752.GR1716@glenbarber.us> References: <201306052131.r55LV6t8052710@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mIBGJ7C7ypTjlzw5" Content-Disposition: inline In-Reply-To: <201306052131.r55LV6t8052710@svn.freebsd.org> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 03:27:56 -0000 --mIBGJ7C7ypTjlzw5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 05, 2013 at 09:31:06PM +0000, Jung-uk Kim wrote: > Author: jkim > Date: Wed Jun 5 21:31:06 2013 > New Revision: 251438 > URL: http://svnweb.freebsd.org/changeset/base/251438 >=20 > Log: > Connect libgnuregex 2.17 to the build. >=20 I think this breaks the build. I am seeing the following: /usr/obj/usr/src/tmp/usr/include/gnu/posix/regex.h:369:3: error: declaration does not declare anything [-Werror,-Wmissing-declarations] unsigned long int __REPB_PREFIX(used); ^~~~~~~~~~~~~~~~~ Glen --mIBGJ7C7ypTjlzw5 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBCAAGBQJRsAG4AAoJEFJPDDeguUajtA8IAISLTX2UpbsIbLxZWNZQS3xJ jZjtoFZs4RN4zkdOWW0YGmXeXbrdP1bHy71EDHZ8TsecqmAfDzAqQ6W+GPIqY3/4 0EOBUOd1y7Z4DaXCe2mU93yKT6mRwBYQtU2RP1bl+RwjcxePAnNF94oyQkmLndcG ZCpYG7OfWhBPCGYluNm5AxHMc6UVTm53+d6ZGmJECT5RLV3lsSn8e/72GzRryDoo hny1iwbNVcGDhaj5ZHHh9DqaKOc4Y6LY70xsmUvKvIInDcYRKQNkUxbqtyDGL3cu I+eqBvrEzyIZg/SvBOCAGOAbKwYZR1rt4Z8/wqWqA1rREo32bqyj6pJML1XYbkg= =14M6 -----END PGP SIGNATURE----- --mIBGJ7C7ypTjlzw5-- From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 05:17:58 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 681C9EA5; Thu, 6 Jun 2013 05:17:58 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 557CF17ED; Thu, 6 Jun 2013 05:17:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r565Hv4k098764; Thu, 6 Jun 2013 05:17:57 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r565Hq7n098728; Thu, 6 Jun 2013 05:17:52 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306060517.r565Hq7n098728@svn.freebsd.org> From: Hiroki Sato Date: Thu, 6 Jun 2013 05:17:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251448 - in stable/8/release/doc: de_DE.ISO8859-1/early-adopter de_DE.ISO8859-1/errata de_DE.ISO8859-1/hardware/alpha de_DE.ISO8859-1/hardware/common de_DE.ISO8859-1/hardware/i386 de_D... X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 05:17:58 -0000 Author: hrs Date: Thu Jun 6 05:17:51 2013 New Revision: 251448 URL: http://svnweb.freebsd.org/changeset/base/251448 Log: MFC: r250746 and r250805. Fix build after DocBook 4.5 conversion. Added: stable/8/release/doc/ja_JP.eucJP/share/xml/catalog.xml (contents, props changed) - copied, changed from r250746, head/release/doc/ja_JP.eucJP/share/xml/catalog.xml stable/8/release/doc/ja_JP.eucJP/share/xml/dev-auto-ja.ent - copied unchanged from r250805, head/release/doc/ja_JP.eucJP/share/xml/dev-auto-ja.ent stable/8/release/doc/ru_RU.KOI8-R/share/xml/catalog.xml (contents, props changed) - copied, changed from r250746, head/release/doc/ru_RU.KOI8-R/share/xml/catalog.xml stable/8/release/doc/ru_RU.KOI8-R/share/xml/dev-auto-ru.ent - copied unchanged from r250805, head/release/doc/ru_RU.KOI8-R/share/xml/dev-auto-ru.ent - copied unchanged from r250746, head/release/doc/share/xml/catalog.xml Directory Properties: stable/8/release/doc/share/xml/catalog.xml (props changed) Deleted: stable/8/release/doc/ja_JP.eucJP/share/xml/dev-auto-ja.xml stable/8/release/doc/ru_RU.KOI8-R/share/xml/dev-auto-ru.xml Modified: stable/8/release/doc/de_DE.ISO8859-1/early-adopter/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/errata/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/alpha/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/alpha/proc-alpha.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/common/dev.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/i386/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/ia64/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/pc98/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/sparc64/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/alpha/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/i386/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/ia64/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/pc98/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/sparc64/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/readme/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/relnotes/alpha/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/relnotes/common/new.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/relnotes/i386/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/relnotes/ia64/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/relnotes/pc98/article.xml (contents, props changed) stable/8/release/doc/de_DE.ISO8859-1/relnotes/sparc64/article.xml (contents, props changed) stable/8/release/doc/en_US.ISO8859-1/Makefile stable/8/release/doc/en_US.ISO8859-1/errata/article.xml (contents, props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/Makefile stable/8/release/doc/en_US.ISO8859-1/hardware/article.xml (contents, props changed) stable/8/release/doc/en_US.ISO8859-1/installation/article.xml (contents, props changed) stable/8/release/doc/en_US.ISO8859-1/readme/article.xml (contents, props changed) stable/8/release/doc/en_US.ISO8859-1/relnotes/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/early-adopter/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/errata/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/alpha/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/alpha/proc-alpha.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/common/dev.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/i386/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/i386/proc-i386.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/ia64/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/pc98/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/pc98/proc-pc98.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/sparc64/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/sparc64/proc-sparc64.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/alpha/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/common/install.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/common/layout.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/i386/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/pc98/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/sparc64/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/relnotes/alpha/article.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/relnotes/common/new.xml (contents, props changed) stable/8/release/doc/fr_FR.ISO8859-1/relnotes/i386/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/errata/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/alpha/Makefile stable/8/release/doc/ja_JP.eucJP/hardware/alpha/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/amd64/Makefile stable/8/release/doc/ja_JP.eucJP/hardware/amd64/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/amd64/proc-amd64.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/common/artheader.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/common/dev.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/common/intro.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/i386/Makefile stable/8/release/doc/ja_JP.eucJP/hardware/i386/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/i386/proc-i386.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/ia64/Makefile stable/8/release/doc/ja_JP.eucJP/hardware/ia64/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/ia64/proc-ia64.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/pc98/Makefile stable/8/release/doc/ja_JP.eucJP/hardware/pc98/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/pc98/proc-pc98.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/sparc64/Makefile stable/8/release/doc/ja_JP.eucJP/hardware/sparc64/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/hardware/sparc64/proc-sparc64.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/relnotes/alpha/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/relnotes/amd64/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/relnotes/common/new.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/relnotes/common/relnotes.ent stable/8/release/doc/ja_JP.eucJP/relnotes/i386/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/relnotes/ia64/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/relnotes/pc98/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/relnotes/sparc64/article.xml (contents, props changed) stable/8/release/doc/ja_JP.eucJP/share/xml/catalog stable/8/release/doc/ru_RU.KOI8-R/errata/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/alpha/Makefile stable/8/release/doc/ru_RU.KOI8-R/hardware/alpha/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/amd64/Makefile stable/8/release/doc/ru_RU.KOI8-R/hardware/amd64/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/amd64/proc-amd64.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/common/artheader.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/common/dev.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/common/intro.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/i386/Makefile stable/8/release/doc/ru_RU.KOI8-R/hardware/i386/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/i386/proc-i386.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/ia64/Makefile stable/8/release/doc/ru_RU.KOI8-R/hardware/ia64/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/ia64/proc-ia64.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/pc98/Makefile stable/8/release/doc/ru_RU.KOI8-R/hardware/pc98/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/pc98/proc-pc98.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/sparc64/Makefile stable/8/release/doc/ru_RU.KOI8-R/hardware/sparc64/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/hardware/sparc64/proc-sparc64.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/alpha/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/amd64/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/common/abstract.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/common/artheader.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/common/install.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/common/layout.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/common/trouble.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/common/upgrade.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/i386/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/ia64/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/pc98/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/installation/sparc64/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/readme/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/relnotes/alpha/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/relnotes/amd64/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/relnotes/common/new.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/relnotes/i386/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/relnotes/ia64/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/relnotes/pc98/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/relnotes/sparc64/article.xml (contents, props changed) stable/8/release/doc/ru_RU.KOI8-R/share/xml/catalog stable/8/release/doc/share/mk/doc.relnotes.mk stable/8/release/doc/share/xml/Makefile stable/8/release/doc/share/xml/release.ent stable/8/release/doc/zh_CN.GB2312/errata/article.xml (contents, props changed) stable/8/release/doc/zh_CN.GB2312/hardware/Makefile stable/8/release/doc/zh_CN.GB2312/hardware/article.xml (contents, props changed) stable/8/release/doc/zh_CN.GB2312/readme/article.xml (contents, props changed) stable/8/release/doc/zh_CN.GB2312/relnotes/article.xml (contents, props changed) Directory Properties: stable/8/release/doc/ (props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/common/artheader.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/common/intro.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/i386/proc-i386.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/ia64/proc-ia64.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/pc98/proc-pc98.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/sparc64/dev-sparc64.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/hardware/sparc64/proc-sparc64.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/common/abstract.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/common/artheader.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/common/install.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/common/layout.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/common/trouble.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/common/upgrade.xml (props changed) stable/8/release/doc/de_DE.ISO8859-1/installation/sparc64/install.xml (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/common/artheader.xml (props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/common/intro.xml (props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/ia64/proc-ia64.xml (props changed) stable/8/release/doc/fr_FR.ISO8859-1/hardware/sparc64/dev-sparc64.xml (props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/common/abstract.xml (props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/common/artheader.xml (props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/common/trouble.xml (props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/common/upgrade.xml (props changed) stable/8/release/doc/fr_FR.ISO8859-1/installation/sparc64/install.xml (props changed) Modified: stable/8/release/doc/de_DE.ISO8859-1/early-adopter/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/early-adopter/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/early-adopter/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; X"> X"> Modified: stable/8/release/doc/de_DE.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/errata/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/errata/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; ]> Modified: stable/8/release/doc/de_DE.ISO8859-1/hardware/alpha/proc-alpha.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/hardware/alpha/proc-alpha.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/hardware/alpha/proc-alpha.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,3 +1,4 @@ + Modified: stable/8/release/doc/de_DE.ISO8859-1/hardware/ia64/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/hardware/ia64/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/hardware/ia64/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,10 +1,9 @@ - - -%entities; - -%release; - %sections + + + %release; + %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/hardware/pc98/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/hardware/pc98/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/hardware/pc98/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,10 +1,9 @@ - - -%entities; - -%release; - %sections + + + %release; + %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/hardware/sparc64/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/hardware/sparc64/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/hardware/sparc64/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,10 +1,9 @@ - - -%entities; - -%release; - %sections + + + %release; + %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/installation/alpha/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/installation/alpha/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/installation/alpha/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/installation/i386/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/installation/i386/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/installation/i386/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/installation/ia64/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/installation/ia64/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/installation/ia64/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/installation/pc98/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/installation/pc98/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/installation/pc98/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/installation/sparc64/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/installation/sparc64/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/installation/sparc64/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,10 +1,8 @@ - - -%entities; - - -%release; + + + %release; %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/readme/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/readme/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/readme/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; ]> Modified: stable/8/release/doc/de_DE.ISO8859-1/relnotes/common/new.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/relnotes/common/new.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/relnotes/common/new.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -34,13 +34,8 @@ Die Release Notes für &os; &release.current; enthalten eine Übersicht über - - Dieses Dokument enthält die Liste aller Sicherheitshinweise, die seit der letzten Version herausgegeben wurden, sowie eine Übersicht über die wichtigsten Änderungen am @@ -59,9 +54,7 @@ Sie Hinweise für die Aktualisierung Ihres &os;-Systems. -Die &release.type; Distribution, für die diese Release + Die &release.type; Distribution, für die diese Release Notes gültig sind, markiert einen Punkt im Entwicklungszweig &release.branch; zwischen &release.prev; und der zukünftigen Version &release.next;. Sie können einige fertige @@ -69,11 +62,7 @@ entstanden sind, auf finden. -]]> - -Diese Distribution von &os; &release.current; ist eine + Diese Distribution von &os; &release.current; ist eine &release.type; Distribution. Sie können Sie von und allen seinen Mirrors erhalten. Weitere Informationen, wie Sie diese (oder andere) &release.type; @@ -84,8 +73,6 @@ url="http://www.FreeBSD.org/doc/de_DE.ISO8859-1/books/handbook/">FreeBSD Handbuchs. -]]> - Anwender, die noch keine Erfahrung mit einer &release.branch; Version eines &os; &release.type; haben, sollten auf jeden Fall die Hinweise für die ersten Anwender von &os; @@ -111,21 +98,12 @@ Neuerungen In diesem Artikel finden Sie - - Die Einträge umfassen alle Sicherheitshinweise, die nach Modified: stable/8/release/doc/de_DE.ISO8859-1/relnotes/i386/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/relnotes/i386/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/relnotes/i386/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/relnotes/ia64/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/relnotes/ia64/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/relnotes/ia64/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/relnotes/pc98/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/relnotes/pc98/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/relnotes/pc98/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; %sections; Modified: stable/8/release/doc/de_DE.ISO8859-1/relnotes/sparc64/article.xml ============================================================================== --- stable/8/release/doc/de_DE.ISO8859-1/relnotes/sparc64/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/de_DE.ISO8859-1/relnotes/sparc64/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,9 +1,8 @@ - - -%entities; - -%release; + + + %release; %sections; Modified: stable/8/release/doc/en_US.ISO8859-1/Makefile ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/Makefile Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/en_US.ISO8859-1/Makefile Thu Jun 6 05:17:51 2013 (r251448) @@ -10,5 +10,8 @@ SUBDIR+= installation COMPAT_SYMLINK = en +LANGCODE=en_US.ISO8859-1 +_LANGCODE=en_US.ISO8859-1 + .include "${RELN_ROOT}/share/mk/doc.relnotes.mk" .include "${DOC_PREFIX}/share/mk/doc.project.mk" Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,21 +1,8 @@ - - -%entities; - - + + %release; - - -]]> - -]]> - - -]]> ]> + No advisories. + + No advisories. Open Issues - No open issue. + No open issues. + + No open issues. + + No open issues. Late-Breaking News and Corrections - A bug in OpenSSL that could cause - it to parse past the end of the message was found at the late - stage of &release.bugfix; release process. The &release.bugfix; - includes a fix for this issue by importing relevant parts from - the OpenSSL CVS. This could be triggered by an incorrectly - formatted ClientHello SSL/TLS handshake messages. The details - can be found at . + No news. + + No news. + + No news. Modified: stable/8/release/doc/en_US.ISO8859-1/hardware/Makefile ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/hardware/Makefile Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/en_US.ISO8859-1/hardware/Makefile Thu Jun 6 05:17:51 2013 (r251448) @@ -18,7 +18,7 @@ JADEFLAGS+= -V %generate-article-toc% # SGML content SRCS+= article.xml SRCS+= ${DEV-AUTODIR}/catalog-auto -SRCS+= ${DEV-AUTODIR}/dev-auto.xml +SRCS+= ${DEV-AUTODIR}/dev-auto.ent CATALOGS+= -c ${DEV-AUTODIR}/catalog-auto Modified: stable/8/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/hardware/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/en_US.ISO8859-1/hardware/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,11 +1,9 @@ - - -%entities; - - + + %release; - + %devauto; ]> @@ -312,8 +310,63 @@ powerpc - The information for this paragraph has yet to be - compiled. + This section describes the systems currently known to be + supported by &os; on the PowerPC platform. This list is not + exhaustive. + + In general, all New World architecture Apple hardware + is supported, as well a limited selection of non-Apple + machines. + + All systems listed below are fully supported, with the + exception that software fan control is currently missing on + some Power Macintosh G5 models. SMP is supported on all systems + with more than 1 processor. + + + + Apple iMac G3 + + + Apple iMac G4 + + + Apple iMac G5 + + + Apple Power Macintosh G3 (Blue & White) + + + Apple Power Macintosh G4 + + + Apple Power Macintosh G5 + + + Apple iBook G3 + + + Apple iBook G4 + + + Apple PowerBook G3 (Lombard and Pismo) + + + Apple PowerBook G4 + + + Apple XServe G4 + + + Apple XServe G5 + + + Apple Mac Mini + + + Embedded boards based on MPC85XX + + @@ -482,7 +535,7 @@ The following systems are partially supported by &os;. In particular the fiber channel controllers in SBus-based systems are not supported. However, it is possible to use these with a SCSI controller - supported by the &man.esp.4 driver (Sun ESP SCSI, Sun FAS Fast-SCSI + supported by the &man.esp.4; driver (Sun ESP SCSI, Sun FAS Fast-SCSI and Sun FAS366 Fast-Wide SCSI controllers). Modified: stable/8/release/doc/en_US.ISO8859-1/installation/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/installation/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/en_US.ISO8859-1/installation/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,15 +1,8 @@ - - -%entities; - - + + %release; - - - - - ]>
Modified: stable/8/release/doc/en_US.ISO8859-1/readme/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/readme/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/en_US.ISO8859-1/readme/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,10 +1,8 @@ - - -%entities; - - -%release; + + + %release; ]>
@@ -92,59 +90,46 @@ Target Audience -This &release.type; is aimed primarily at early adopters + This &release.type; is aimed primarily at early adopters and various other users who want to get involved with the ongoing development of &os;. While the &os; development team tries its best to ensure that each &release.type; works as advertised, &release.branch; is very much a work-in-progress. - The basic requirements for using this &release.type; are + The basic requirements for using this &release.type; are technical proficiency with &os; and an understanding of the ongoing development process of &os; &release.branch; (as discussed on the &a.current;). - For those more interested in doing business with &os; than + For those more interested in doing business with &os; than in experimenting with new &os; technology, formal releases - (such as &release.prev.stable;) are frequently more appropriate. + (such as &release.prev;) are frequently more appropriate. Releases undergo a period of testing and quality assurance checking to ensure high reliability and dependability. -]]> - -This &release.type; is aimed primarily at early adopters + This &release.type; is aimed primarily at early adopters and various other users who want to get involved with the ongoing development of &os;. While the &os; development team tries its best to ensure that each &release.type; works as advertised, &release.branch; is very much a work-in-progress. - The basic requirements for using this &release.type; are + The basic requirements for using this &release.type; are technical proficiency with &os; and an understanding of the ongoing development process of &os; &release.branch; (as discussed on the &a.current;). - For those more interested in doing business with &os; than + For those more interested in doing business with &os; than in experimenting with new &os; technology, formal releases - (such as &release.prev.stable;) are frequently more appropriate. + (such as &release.prev;) are frequently more appropriate. Releases undergo a period of testing and quality assurance checking to ensure high reliability and dependability. -]]> - -This &release.type; of &os; is suitable for all users. It + This &release.type; of &os; is suitable for all users. It has undergone a period of testing and quality assurance checking to ensure the highest reliability and dependability. - -]]> - Modified: stable/8/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Jun 6 03:18:07 2013 (r251447) +++ stable/8/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Jun 6 05:17:51 2013 (r251448) @@ -1,10 +1,8 @@ - - -%entities; - - -%release; + + + %release; ]>
@@ -49,30 +47,20 @@ It also provides some notes on upgrading from previous versions of &os;. -The &release.type; distribution to which these release notes + The &release.type; distribution to which these release notes apply represents the latest point along the &release.branch; development branch since &release.branch; was created. Information regarding pre-built, binary &release.type; distributions along this branch *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 05:20:06 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2439FD7; Thu, 6 Jun 2013 05:20:06 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EF85517F9; Thu, 6 Jun 2013 05:20:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r565K5nC000640; Thu, 6 Jun 2013 05:20:05 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r565K5tI000639; Thu, 6 Jun 2013 05:20:05 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306060520.r565K5tI000639@svn.freebsd.org> From: Hiroki Sato Date: Thu, 6 Jun 2013 05:20:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251449 - in stable/8/release/doc: de_DE.ISO8859-1 fr_FR.ISO8859-1 ja_JP.eucJP ru_RU.KOI8-R zh_CN.GB2312 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 05:20:06 -0000 Author: hrs Date: Thu Jun 6 05:20:05 2013 New Revision: 251449 URL: http://svnweb.freebsd.org/changeset/base/251449 Log: Remove obsolete translations. Deleted: stable/8/release/doc/de_DE.ISO8859-1/ stable/8/release/doc/fr_FR.ISO8859-1/ stable/8/release/doc/ja_JP.eucJP/ stable/8/release/doc/ru_RU.KOI8-R/ stable/8/release/doc/zh_CN.GB2312/ From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 05:28:29 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4FEA02C3; Thu, 6 Jun 2013 05:28:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 41B2F182A; Thu, 6 Jun 2013 05:28:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r565STfU002042; Thu, 6 Jun 2013 05:28:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r565STNu002041; Thu, 6 Jun 2013 05:28:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306060528.r565STNu002041@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 6 Jun 2013 05:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251450 - stable/9/sys/vm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 05:28:29 -0000 Author: kib Date: Thu Jun 6 05:28:28 2013 New Revision: 251450 URL: http://svnweb.freebsd.org/changeset/base/251450 Log: MFC r251318: Remove irrelevant comments. Modified: stable/9/sys/vm/vm_page.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_page.c ============================================================================== --- stable/9/sys/vm/vm_page.c Thu Jun 6 05:20:05 2013 (r251449) +++ stable/9/sys/vm/vm_page.c Thu Jun 6 05:28:28 2013 (r251450) @@ -902,11 +902,6 @@ vm_page_splay(vm_pindex_t pindex, vm_pag * * Inserts the given mem entry into the object and object list. * - * The pagetables are not updated but will presumably fault the page - * in if necessary, or if a kernel page the caller will at some point - * enter the page into the kernel's pmap. We are not allowed to sleep - * here so we *can't* do this anyway. - * * The object must be locked. */ void @@ -976,8 +971,6 @@ vm_page_insert(vm_page_t m, vm_object_t * table and the object page list, but do not invalidate/terminate * the backing store. * - * The underlying pmap entry (if any) is NOT removed here. - * * The object must be locked. The page must be locked if it is managed. */ void From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 06:11:44 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5E51EC02; Thu, 6 Jun 2013 06:11:44 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 40F891990; Thu, 6 Jun 2013 06:11:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r566Bi6N016911; Thu, 6 Jun 2013 06:11:44 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r566Bi1S016910; Thu, 6 Jun 2013 06:11:44 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306060611.r566Bi1S016910@svn.freebsd.org> From: Hiroki Sato Date: Thu, 6 Jun 2013 06:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251451 - stable/8/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 06:11:44 -0000 Author: hrs Date: Thu Jun 6 06:11:43 2013 New Revision: 251451 URL: http://svnweb.freebsd.org/changeset/base/251451 Log: Update errata document for 8.4R: - dhclient does not work on fxp(4). - ZFS pool interoperability issue between 8.4 and 9.[01]. Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Thu Jun 6 05:28:28 2013 (r251450) +++ stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Thu Jun 6 06:11:43 2013 (r251451) @@ -5,18 +5,6 @@ %release; ]> - -
&os; &release; Errata @@ -28,7 +16,7 @@ $FreeBSD$ - 2011 + 2013 The &os; Documentation Project @@ -85,30 +73,178 @@ Security Advisories - No advisories. + The following security advisories pertain to &os; &release;. + For more information, consult the individual advisories available from + . + + + + + + + + + Advisory + Date + Topic + + + + + + SA-12:01.openssl + + 03 May 2012 + + OpenSSL multiple vulnerabilities + + + + SA-12:02.crypt + + 30 May 2012 + + Incorrect crypt() hashing + + + + SA-12:03.bind + + 12 June 2012 + + Incorrect handling of zero-length RDATA fields in named(8) + + + + SA-12:04.sysret + + 12 June 2012 + + Privilege escalation when returning from kernel + + + + SA-12:05.bind + + 06 August 2012 + + named(8) DNSSEC validation Denial of Service + + + + SA-12:06.bind - No advisories. + 22 November 2012 - No advisories. + Multiple Denial of Service vulnerabilities with named(8) + + + + SA-12:07.hostapd + + 22 November 2012 + + Insufficient message length validation for EAP-TLS messages + + + + SA-12:08.linux + + 22 November 2012 + + Linux compatibility layer input validation error + + + + SA-13:02.libc + + 19 February 2013 + + glob(3) related resource exhaustion + + + + SA-13:03.openssl + + 02 April 2013 + + OpenSSL multiple vulnerabilities + + + + SA-13:04.bind + + 02 April 2013 + + BIND remote denial of service + + + + SA-13:05.nfsserver + + 29 April 2013 + + Insufficient input validation in the NFS server + + + + Open Issues - No open issues. + [20130606] The &man.fxp.4; network interface driver may not + work well with the &man.dhclient.8; utility. More specifically, + if the /etc/rc.conf has the following + line: + + ifconfig_fxp0="DHCP" + + to activate a DHCP client to configure the network + interface, the following notification messages are displayed and + the &man.dhclient.8; utility keeps trying to initialize the + network interface forever. - No open issues. + kernel: fxp0: link state changed to UP +kernel: fxp0: link state changed to DOWN - No open issues. + A patch to fix this issue will be released as an Errata + Notice. Late-Breaking News and Corrections - No news. - - No news. - - No news. + [20130606] As described in &os; &release; Release Notes, + &os; ZFS subsystem has been updated to support feature flags for + ZFS pools. However, the default version number of a newly + created ZFS pool is still 28. + + This is because &os; 9.0 and 9.1 do not support the feature + flags. This means ZFS pools with feature flag support cannot be + used on &os; 9.0 and 9.1. An 8.X system with v28 ZFS pools can + be upgraded to 9.X with no problem. Note that &man.zfs.8; + send and receive commands + do not work between pools with different versions. Once a ZFS + pool is upgraded from v28, there is no way to upgrade the system + to &os; 9.0 and 9.1. &os; 9.2 and later will support ZFS pools + with feature flags. + + To create a ZFS pool with feature flag support, use the + &man.zpool.8; create command and then the + &man.zpool.8; upgrade command.
From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 06:17:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ED59BD94; Thu, 6 Jun 2013 06:17:21 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CD42719AA; Thu, 6 Jun 2013 06:17:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r566HLZw017814; Thu, 6 Jun 2013 06:17:21 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r566HLYx017810; Thu, 6 Jun 2013 06:17:21 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201306060617.r566HLYx017810@svn.freebsd.org> From: Alan Cox Date: Thu, 6 Jun 2013 06:17:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251452 - in head/sys: dev/drm2/i915 dev/drm2/ttm fs/tmpfs kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 06:17:22 -0000 Author: alc Date: Thu Jun 6 06:17:20 2013 New Revision: 251452 URL: http://svnweb.freebsd.org/changeset/base/251452 Log: Don't busy the page unless we are likely to release the object lock. Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/drm2/i915/i915_gem.c head/sys/dev/drm2/ttm/ttm_tt.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/kern/kern_exec.c Modified: head/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- head/sys/dev/drm2/i915/i915_gem.c Thu Jun 6 06:11:43 2013 (r251451) +++ head/sys/dev/drm2/i915/i915_gem.c Thu Jun 6 06:17:20 2013 (r251452) @@ -2487,8 +2487,10 @@ i915_gem_wire_page(vm_object_t object, v int rv; VM_OBJECT_ASSERT_WLOCKED(object); - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_RETRY); if (m->valid != VM_PAGE_BITS_ALL) { + vm_page_busy(m); if (vm_pager_has_page(object, pindex, NULL, NULL)) { rv = vm_pager_get_pages(object, &m, 1, 0); m = vm_page_lookup(object, pindex); @@ -2505,11 +2507,11 @@ i915_gem_wire_page(vm_object_t object, v m->valid = VM_PAGE_BITS_ALL; m->dirty = 0; } + vm_page_wakeup(m); } vm_page_lock(m); vm_page_wire(m); vm_page_unlock(m); - vm_page_wakeup(m); atomic_add_long(&i915_gem_wired_pages_cnt, 1); return (m); } Modified: head/sys/dev/drm2/ttm/ttm_tt.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_tt.c Thu Jun 6 06:11:43 2013 (r251451) +++ head/sys/dev/drm2/ttm/ttm_tt.c Thu Jun 6 06:17:20 2013 (r251452) @@ -288,8 +288,10 @@ int ttm_tt_swapin(struct ttm_tt *ttm) VM_OBJECT_WLOCK(obj); vm_object_pip_add(obj, 1); for (i = 0; i < ttm->num_pages; ++i) { - from_page = vm_page_grab(obj, i, VM_ALLOC_RETRY); + from_page = vm_page_grab(obj, i, VM_ALLOC_NOBUSY | + VM_ALLOC_RETRY); if (from_page->valid != VM_PAGE_BITS_ALL) { + vm_page_busy(from_page); if (vm_pager_has_page(obj, i, NULL, NULL)) { rv = vm_pager_get_pages(obj, &from_page, 1, 0); if (rv != VM_PAGER_OK) { @@ -301,15 +303,14 @@ int ttm_tt_swapin(struct ttm_tt *ttm) } } else vm_page_zero_invalid(from_page, TRUE); + vm_page_wakeup(from_page); } to_page = ttm->pages[i]; if (unlikely(to_page == NULL)) { - vm_page_wakeup(from_page); ret = -ENOMEM; goto err_ret; } pmap_copy_page(from_page, to_page); - vm_page_wakeup(from_page); } vm_object_pip_wakeup(obj); VM_OBJECT_WUNLOCK(obj); Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Thu Jun 6 06:11:43 2013 (r251451) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Thu Jun 6 06:17:20 2013 (r251452) @@ -460,8 +460,9 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p * type object. */ m = vm_page_grab(tobj, idx, VM_ALLOC_NORMAL | VM_ALLOC_RETRY | - VM_ALLOC_IGN_SBUSY); + VM_ALLOC_IGN_SBUSY | VM_ALLOC_NOBUSY); if (m->valid != VM_PAGE_BITS_ALL) { + vm_page_busy(m); if (vm_pager_has_page(tobj, idx, NULL, NULL)) { rv = vm_pager_get_pages(tobj, &m, 1, 0); m = vm_page_lookup(tobj, idx); @@ -483,10 +484,10 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p } } else vm_page_zero_invalid(m, TRUE); + vm_page_wakeup(m); } vm_page_lock(m); vm_page_hold(m); - vm_page_wakeup(m); vm_page_unlock(m); VM_OBJECT_WUNLOCK(tobj); error = uiomove_fromphys(&m, offset, tlen, uio); @@ -574,8 +575,10 @@ tmpfs_mappedwrite(vm_object_t tobj, size tlen = MIN(PAGE_SIZE - offset, len); VM_OBJECT_WLOCK(tobj); - tpg = vm_page_grab(tobj, idx, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + tpg = vm_page_grab(tobj, idx, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_RETRY); if (tpg->valid != VM_PAGE_BITS_ALL) { + vm_page_busy(tpg); if (vm_pager_has_page(tobj, idx, NULL, NULL)) { rv = vm_pager_get_pages(tobj, &tpg, 1, 0); tpg = vm_page_lookup(tobj, idx); @@ -597,10 +600,10 @@ tmpfs_mappedwrite(vm_object_t tobj, size } } else vm_page_zero_invalid(tpg, TRUE); + vm_page_wakeup(tpg); } vm_page_lock(tpg); vm_page_hold(tpg); - vm_page_wakeup(tpg); vm_page_unlock(tpg); VM_OBJECT_WUNLOCK(tobj); error = uiomove_fromphys(&tpg, offset, tlen, uio); Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Thu Jun 6 06:11:43 2013 (r251451) +++ head/sys/kern/kern_exec.c Thu Jun 6 06:17:20 2013 (r251452) @@ -937,8 +937,10 @@ exec_map_first_page(imgp) object->pg_color = 0; } #endif - ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_RETRY); if (ma[0]->valid != VM_PAGE_BITS_ALL) { + vm_page_busy(ma[0]); initial_pagein = VM_INITIAL_PAGEIN; if (initial_pagein > object->size) initial_pagein = object->size; @@ -968,11 +970,11 @@ exec_map_first_page(imgp) VM_OBJECT_WUNLOCK(object); return (EIO); } + vm_page_wakeup(ma[0]); } vm_page_lock(ma[0]); vm_page_hold(ma[0]); vm_page_unlock(ma[0]); - vm_page_wakeup(ma[0]); VM_OBJECT_WUNLOCK(object); imgp->firstpage = sf_buf_alloc(ma[0], 0); From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 08:48:03 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9B5399C; Thu, 6 Jun 2013 08:48:03 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7303B10A1; Thu, 6 Jun 2013 08:48:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r568m3sQ064852; Thu, 6 Jun 2013 08:48:03 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r568m30c064850; Thu, 6 Jun 2013 08:48:03 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306060848.r568m30c064850@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 08:48:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251453 - stable/8/sys/dev/md X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 08:48:03 -0000 Author: smh Date: Thu Jun 6 08:48:02 2013 New Revision: 251453 URL: http://svnweb.freebsd.org/changeset/base/251453 Log: MFC r221229: Implement BIO_DELETE for vnode devices Modified: stable/8/sys/dev/md/md.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/md/ (props changed) Modified: stable/8/sys/dev/md/md.c ============================================================================== --- stable/8/sys/dev/md/md.c Thu Jun 6 06:17:20 2013 (r251452) +++ stable/8/sys/dev/md/md.c Thu Jun 6 08:48:02 2013 (r251453) @@ -205,6 +205,9 @@ struct md_s { vm_object_t object; }; +/* Used for BIO_DELETE on MD_VNODE */ +static u_char zero[PAGE_SIZE]; + static struct indir * new_indir(u_int shift) { @@ -514,10 +517,12 @@ mdstart_vnode(struct md_s *sc, struct bi struct mount *mp; struct vnode *vp; struct thread *td; + off_t end, zerosize; switch (bp->bio_cmd) { case BIO_READ: case BIO_WRITE: + case BIO_DELETE: case BIO_FLUSH: break; default: @@ -548,6 +553,43 @@ mdstart_vnode(struct md_s *sc, struct bi bzero(&auio, sizeof(auio)); + /* + * Special case for BIO_DELETE. On the surface, this is very + * similar to BIO_WRITE, except that we write from our own + * fixed-length buffer, so we have to loop. The net result is + * that the two cases end up having very little in common. + */ + if (bp->bio_cmd == BIO_DELETE) { + zerosize = sizeof(zero) - (sizeof(zero) % sc->sectorsize); + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + auio.uio_offset = (vm_ooffset_t)bp->bio_offset; + auio.uio_segflg = UIO_SYSSPACE; + auio.uio_rw = UIO_WRITE; + auio.uio_td = td; + end = bp->bio_offset + bp->bio_length; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + (void) vn_start_write(vp, &mp, V_WAIT); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + error = 0; + while (auio.uio_offset < end) { + aiov.iov_base = zero; + aiov.iov_len = end - auio.uio_offset; + if (aiov.iov_len > zerosize) + aiov.iov_len = zerosize; + auio.uio_resid = aiov.iov_len; + error = VOP_WRITE(vp, &auio, + sc->flags & MD_ASYNC ? 0 : IO_SYNC, sc->cred); + if (error != 0) + break; + } + VOP_UNLOCK(vp, 0); + vn_finished_write(mp); + bp->bio_resid = end - auio.uio_offset; + VFS_UNLOCK_GIANT(vfslocked); + return (error); + } + aiov.iov_base = bp->bio_data; aiov.iov_len = bp->bio_length; auio.uio_iov = &aiov; From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 08:57:34 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1129B494; Thu, 6 Jun 2013 08:57:34 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E751E1141; Thu, 6 Jun 2013 08:57:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r568vXSe067859; Thu, 6 Jun 2013 08:57:33 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r568vXaR067853; Thu, 6 Jun 2013 08:57:33 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306060857.r568vXaR067853@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 08:57:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251454 - in stable/8/sys: dev/md dev/null sys vm X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 08:57:34 -0000 Author: smh Date: Thu Jun 6 08:57:32 2013 New Revision: 251454 URL: http://svnweb.freebsd.org/changeset/base/251454 Log: MFC r221853: Global zeros region Modified: stable/8/sys/dev/md/md.c stable/8/sys/dev/null/null.c stable/8/sys/sys/systm.h stable/8/sys/vm/vm_kern.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/md/ (props changed) stable/8/sys/dev/null/ (props changed) stable/8/sys/sys/ (props changed) stable/8/sys/vm/ (props changed) Modified: stable/8/sys/dev/md/md.c ============================================================================== --- stable/8/sys/dev/md/md.c Thu Jun 6 08:48:02 2013 (r251453) +++ stable/8/sys/dev/md/md.c Thu Jun 6 08:57:32 2013 (r251454) @@ -205,9 +205,6 @@ struct md_s { vm_object_t object; }; -/* Used for BIO_DELETE on MD_VNODE */ -static u_char zero[PAGE_SIZE]; - static struct indir * new_indir(u_int shift) { @@ -560,7 +557,8 @@ mdstart_vnode(struct md_s *sc, struct bi * that the two cases end up having very little in common. */ if (bp->bio_cmd == BIO_DELETE) { - zerosize = sizeof(zero) - (sizeof(zero) % sc->sectorsize); + zerosize = ZERO_REGION_SIZE - + (ZERO_REGION_SIZE % sc->sectorsize); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = (vm_ooffset_t)bp->bio_offset; @@ -573,7 +571,7 @@ mdstart_vnode(struct md_s *sc, struct bi vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = 0; while (auio.uio_offset < end) { - aiov.iov_base = zero; + aiov.iov_base = __DECONST(void *, zero_region); aiov.iov_len = end - auio.uio_offset; if (aiov.iov_len > zerosize) aiov.iov_len = zerosize; Modified: stable/8/sys/dev/null/null.c ============================================================================== --- stable/8/sys/dev/null/null.c Thu Jun 6 08:48:02 2013 (r251453) +++ stable/8/sys/dev/null/null.c Thu Jun 6 08:57:32 2013 (r251454) @@ -69,8 +69,6 @@ static struct cdevsw zero_cdevsw = { .d_flags = D_MMAP_ANON, }; -static void *zbuf; - /* ARGSUSED */ static int null_write(struct cdev *dev __unused, struct uio *uio, int flags __unused) @@ -132,10 +130,19 @@ zero_ioctl(struct cdev *dev __unused, u_ static int zero_read(struct cdev *dev __unused, struct uio *uio, int flags __unused) { + void *zbuf; + ssize_t len; int error = 0; - while (uio->uio_resid > 0 && error == 0) - error = uiomove(zbuf, MIN(uio->uio_resid, PAGE_SIZE), uio); + KASSERT(uio->uio_rw == UIO_READ, + ("Can't be in %s for write", __func__)); + zbuf = __DECONST(void *, zero_region); + while (uio->uio_resid > 0 && error == 0) { + len = uio->uio_resid; + if (len > ZERO_REGION_SIZE) + len = ZERO_REGION_SIZE; + error = uiomove(zbuf, len, uio); + } return (error); } @@ -148,7 +155,6 @@ null_modevent(module_t mod __unused, int case MOD_LOAD: if (bootverbose) printf("null: \n"); - zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); null_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &null_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0666, "null"); zero_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &zero_cdevsw, 0, @@ -158,7 +164,6 @@ null_modevent(module_t mod __unused, int case MOD_UNLOAD: destroy_dev(null_dev); destroy_dev(zero_dev); - free(zbuf, M_TEMP); break; case MOD_SHUTDOWN: Modified: stable/8/sys/sys/systm.h ============================================================================== --- stable/8/sys/sys/systm.h Thu Jun 6 08:48:02 2013 (r251453) +++ stable/8/sys/sys/systm.h Thu Jun 6 08:57:32 2013 (r251454) @@ -136,6 +136,9 @@ extern char static_hints[]; /* by config extern char **kenvp; +extern const void *zero_region; /* address space maps to a zeroed page */ +#define ZERO_REGION_SIZE (2048 * 1024) + /* * General function declarations. */ Modified: stable/8/sys/vm/vm_kern.c ============================================================================== --- stable/8/sys/vm/vm_kern.c Thu Jun 6 08:48:02 2013 (r251453) +++ stable/8/sys/vm/vm_kern.c Thu Jun 6 08:57:32 2013 (r251454) @@ -91,6 +91,9 @@ vm_map_t exec_map=0; vm_map_t pipe_map; vm_map_t buffer_map=0; +const void *zero_region; +CTASSERT((ZERO_REGION_SIZE & PAGE_MASK) == 0); + /* * kmem_alloc_nofault: * @@ -519,6 +522,35 @@ kmem_free_wakeup(map, addr, size) vm_map_unlock(map); } +static void +kmem_init_zero_region(void) +{ + vm_offset_t addr; + vm_page_t m; + unsigned int i; + int error; + + /* Allocate virtual address space. */ + addr = kmem_alloc_nofault(kernel_map, ZERO_REGION_SIZE); + + /* Allocate a page and zero it. */ + m = vm_page_alloc(NULL, OFF_TO_IDX(addr - VM_MIN_KERNEL_ADDRESS), + VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); + if ((m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + + /* Map the address space to the page. */ + for (i = 0; i < ZERO_REGION_SIZE; i += PAGE_SIZE) + pmap_qenter(addr + i, &m, 1); + + /* Protect it r/o. */ + error = vm_map_protect(kernel_map, addr, addr + ZERO_REGION_SIZE, + VM_PROT_READ, TRUE); + KASSERT(error == 0, ("error=%d", error)); + + zero_region = (const void *)addr; +} + /* * kmem_init: * @@ -547,6 +579,8 @@ kmem_init(start, end) start, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); /* ... and ending with the completion of the above `insert' */ vm_map_unlock(m); + + kmem_init_zero_region(); } #ifdef DIAGNOSTIC From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 09:13:10 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1EB1E9E6; Thu, 6 Jun 2013 09:13:10 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 00914121B; Thu, 6 Jun 2013 09:13:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r569D9QD073843; Thu, 6 Jun 2013 09:13:09 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r569D7NX073822; Thu, 6 Jun 2013 09:13:07 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306060913.r569D7NX073822@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 09:13:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251455 - in stable/8/sys: amd64/include arm/include dev/md dev/null i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include sys vm X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 09:13:10 -0000 Author: smh Date: Thu Jun 6 09:13:07 2013 New Revision: 251455 URL: http://svnweb.freebsd.org/changeset/base/251455 Log: MFC r221855: Move the ZERO_REGION_SIZE to a machine-dependent Modified: stable/8/sys/amd64/include/vmparam.h stable/8/sys/arm/include/vmparam.h stable/8/sys/dev/md/md.c stable/8/sys/dev/null/null.c stable/8/sys/i386/include/vmparam.h stable/8/sys/ia64/include/vmparam.h stable/8/sys/mips/include/vmparam.h stable/8/sys/powerpc/include/vmparam.h stable/8/sys/sparc64/include/vmparam.h stable/8/sys/sun4v/include/vmparam.h stable/8/sys/sys/systm.h stable/8/sys/vm/vm_kern.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) stable/8/sys/arm/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/md/ (props changed) stable/8/sys/dev/null/ (props changed) stable/8/sys/i386/ (props changed) stable/8/sys/ia64/ (props changed) stable/8/sys/mips/ (props changed) stable/8/sys/powerpc/ (props changed) stable/8/sys/sparc64/ (props changed) stable/8/sys/sun4v/ (props changed) stable/8/sys/sys/ (props changed) stable/8/sys/vm/ (props changed) Modified: stable/8/sys/amd64/include/vmparam.h ============================================================================== --- stable/8/sys/amd64/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/amd64/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455) @@ -210,4 +210,6 @@ #define VM_INITIAL_PAGEIN 16 #endif +#define ZERO_REGION_SIZE (2 * 1024 * 1024) /* 2MB */ + #endif /* _MACHINE_VMPARAM_H_ */ Modified: stable/8/sys/arm/include/vmparam.h ============================================================================== --- stable/8/sys/arm/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/arm/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455) @@ -144,4 +144,7 @@ #ifdef ARM_USE_SMALL_ALLOC #define UMA_MD_SMALL_ALLOC #endif /* ARM_USE_SMALL_ALLOC */ + +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* _MACHINE_VMPARAM_H_ */ Modified: stable/8/sys/dev/md/md.c ============================================================================== --- stable/8/sys/dev/md/md.c Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/dev/md/md.c Thu Jun 6 09:13:07 2013 (r251455) @@ -89,6 +89,8 @@ #include #include +#include + #define MD_MODVER 1 #define MD_SHUTDOWN 0x10000 /* Tell worker thread to terminate. */ Modified: stable/8/sys/dev/null/null.c ============================================================================== --- stable/8/sys/dev/null/null.c Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/dev/null/null.c Thu Jun 6 09:13:07 2013 (r251455) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include /* For use with destroy_dev(9). */ static struct cdev *null_dev; Modified: stable/8/sys/i386/include/vmparam.h ============================================================================== --- stable/8/sys/i386/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/i386/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455) @@ -202,4 +202,6 @@ #define VM_INITIAL_PAGEIN 16 #endif +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* _MACHINE_VMPARAM_H_ */ Modified: stable/8/sys/ia64/include/vmparam.h ============================================================================== --- stable/8/sys/ia64/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/ia64/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455) @@ -181,4 +181,6 @@ #define VM_INITIAL_PAGEIN 16 #endif +#define ZERO_REGION_SIZE (2 * 1024 * 1024) /* 2MB */ + #endif /* !_MACHINE_VMPARAM_H_ */ Modified: stable/8/sys/mips/include/vmparam.h ============================================================================== --- stable/8/sys/mips/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/mips/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455) @@ -202,4 +202,6 @@ */ #define VM_NFREEORDER 9 +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* !_MACHINE_VMPARAM_H_ */ Modified: stable/8/sys/powerpc/include/vmparam.h ============================================================================== --- stable/8/sys/powerpc/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/powerpc/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455) @@ -182,4 +182,6 @@ struct pmap_physseg { #define VM_KMEM_SIZE (12 * 1024 * 1024) #endif +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* _MACHINE_VMPARAM_H_ */ Modified: stable/8/sys/sparc64/include/vmparam.h ============================================================================== --- stable/8/sys/sparc64/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/sparc64/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455) @@ -245,4 +245,11 @@ extern u_int tsb_kernel_ldd_phys; extern vm_offset_t vm_max_kernel_address; +/* + * Older sparc64 machines have a virtually indexed L1 data cache of 16KB. + * Consequently, mapping the same physical page multiple times may have + * caching disabled. + */ +#define ZERO_REGION_SIZE PAGE_SIZE + #endif /* !_MACHINE_VMPARAM_H_ */ Modified: stable/8/sys/sun4v/include/vmparam.h ============================================================================== --- stable/8/sys/sun4v/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/sun4v/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455) @@ -227,4 +227,6 @@ #define UMA_MD_SMALL_ALLOC extern vm_offset_t vm_max_kernel_address; +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* !_MACHINE_VMPARAM_H_ */ Modified: stable/8/sys/sys/systm.h ============================================================================== --- stable/8/sys/sys/systm.h Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/sys/systm.h Thu Jun 6 09:13:07 2013 (r251455) @@ -137,7 +137,6 @@ extern char static_hints[]; /* by config extern char **kenvp; extern const void *zero_region; /* address space maps to a zeroed page */ -#define ZERO_REGION_SIZE (2048 * 1024) /* * General function declarations. Modified: stable/8/sys/vm/vm_kern.c ============================================================================== --- stable/8/sys/vm/vm_kern.c Thu Jun 6 08:57:32 2013 (r251454) +++ stable/8/sys/vm/vm_kern.c Thu Jun 6 09:13:07 2013 (r251455) @@ -525,25 +525,22 @@ kmem_free_wakeup(map, addr, size) static void kmem_init_zero_region(void) { - vm_offset_t addr; + vm_offset_t addr, i; vm_page_t m; - unsigned int i; int error; - /* Allocate virtual address space. */ + /* + * Map a single physical page of zeros to a larger virtual range. + * This requires less looping in places that want large amounts of + * zeros, while not using much more physical resources. + */ addr = kmem_alloc_nofault(kernel_map, ZERO_REGION_SIZE); - - /* Allocate a page and zero it. */ m = vm_page_alloc(NULL, OFF_TO_IDX(addr - VM_MIN_KERNEL_ADDRESS), VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if ((m->flags & PG_ZERO) == 0) pmap_zero_page(m); - - /* Map the address space to the page. */ for (i = 0; i < ZERO_REGION_SIZE; i += PAGE_SIZE) pmap_qenter(addr + i, &m, 1); - - /* Protect it r/o. */ error = vm_map_protect(kernel_map, addr, addr + ZERO_REGION_SIZE, VM_PROT_READ, TRUE); KASSERT(error == 0, ("error=%d", error)); From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 09:23:22 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 70A65E4A; Thu, 6 Jun 2013 09:23:22 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 61C2312BB; Thu, 6 Jun 2013 09:23:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r569NMOA077141; Thu, 6 Jun 2013 09:23:22 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r569NMgw077140; Thu, 6 Jun 2013 09:23:22 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306060923.r569NMgw077140@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 09:23:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251456 - stable/8/sys/geom X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 09:23:22 -0000 Author: smh Date: Thu Jun 6 09:23:21 2013 New Revision: 251456 URL: http://svnweb.freebsd.org/changeset/base/251456 Log: MFC r226737: Allow upper layers to discover that BIO_DELETE / BIO_FLUSH is not supported. Modified: stable/8/sys/geom/geom_disk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/geom/ (props changed) Modified: stable/8/sys/geom/geom_disk.c ============================================================================== --- stable/8/sys/geom/geom_disk.c Thu Jun 6 09:13:07 2013 (r251455) +++ stable/8/sys/geom/geom_disk.c Thu Jun 6 09:23:21 2013 (r251456) @@ -302,7 +302,7 @@ g_disk_start(struct bio *bp) switch(bp->bio_cmd) { case BIO_DELETE: if (!(dp->d_flags & DISKFLAG_CANDELETE)) { - error = 0; + error = EOPNOTSUPP; break; } /* fall-through */ @@ -370,8 +370,8 @@ g_disk_start(struct bio *bp) g_trace(G_T_BIO, "g_disk_flushcache(%s)", bp->bio_to->name); if (!(dp->d_flags & DISKFLAG_CANFLUSHCACHE)) { - g_io_deliver(bp, ENODEV); - return; + error = EOPNOTSUPP; + break; } bp2 = g_clone_bio(bp); if (bp2 == NULL) { From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 09:45:23 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B64624C6; Thu, 6 Jun 2013 09:45:23 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9800D13B8; Thu, 6 Jun 2013 09:45:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r569jNSk083808; Thu, 6 Jun 2013 09:45:23 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r569jNO1083802; Thu, 6 Jun 2013 09:45:23 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306060945.r569jNO1083802@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 09:45:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251457 - stable/8/sys/cam/scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 09:45:23 -0000 Author: smh Date: Thu Jun 6 09:45:22 2013 New Revision: 251457 URL: http://svnweb.freebsd.org/changeset/base/251457 Log: MFC r230053: BIO_DELETE for SCSI da devices MFC r239655: Fix scsi_da's BIO_DELETE->SCSI_UNMAP translation Modified: stable/8/sys/cam/scsi/scsi_all.c stable/8/sys/cam/scsi/scsi_all.h stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.c Thu Jun 6 09:23:21 2013 (r251456) +++ stable/8/sys/cam/scsi/scsi_all.c Thu Jun 6 09:45:22 2013 (r251457) @@ -361,6 +361,8 @@ static struct op_table_entry scsi_op_cod { 0x40, D | T | L | P | W | R | O | M | S | C, "CHANGE DEFINITION" }, /* 41 O WRITE SAME(10) */ { 0x41, D, "WRITE SAME(10)" }, + /* 42 O UNMAP */ + { 0x42, D, "UNMAP" }, /* 42 O READ SUB-CHANNEL */ { 0x42, R, "READ SUB-CHANNEL" }, /* 43 O READ TOC/PMA/ATIP */ @@ -4318,6 +4320,104 @@ scsi_read_write(struct ccb_scsiio *csio, timeout); } +void +scsi_write_same(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + int minimum_cmd_size, u_int64_t lba, u_int32_t block_count, + u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout) +{ + u_int8_t cdb_len; + if ((minimum_cmd_size < 16) && + ((block_count & 0xffff) == block_count) && + ((lba & 0xffffffff) == lba)) { + /* + * Need a 10 byte cdb. + */ + struct scsi_write_same_10 *scsi_cmd; + + scsi_cmd = (struct scsi_write_same_10 *)&csio->cdb_io.cdb_bytes; + scsi_cmd->opcode = WRITE_SAME_10; + scsi_cmd->byte2 = byte2; + scsi_ulto4b(lba, scsi_cmd->addr); + scsi_cmd->group = 0; + scsi_ulto2b(block_count, scsi_cmd->length); + scsi_cmd->control = 0; + cdb_len = sizeof(*scsi_cmd); + + CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, + ("10byte: %x%x%x%x:%x%x: %d\n", scsi_cmd->addr[0], + scsi_cmd->addr[1], scsi_cmd->addr[2], + scsi_cmd->addr[3], scsi_cmd->length[0], + scsi_cmd->length[1], dxfer_len)); + } else { + /* + * 16 byte CDB. We'll only get here if the LBA is larger + * than 2^32, or if the user asks for a 16 byte command. + */ + struct scsi_write_same_16 *scsi_cmd; + + scsi_cmd = (struct scsi_write_same_16 *)&csio->cdb_io.cdb_bytes; + scsi_cmd->opcode = WRITE_SAME_16; + scsi_cmd->byte2 = byte2; + scsi_u64to8b(lba, scsi_cmd->addr); + scsi_ulto4b(block_count, scsi_cmd->length); + scsi_cmd->group = 0; + scsi_cmd->control = 0; + cdb_len = sizeof(*scsi_cmd); + + CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, + ("16byte: %x%x%x%x%x%x%x%x:%x%x%x%x: %d\n", + scsi_cmd->addr[0], scsi_cmd->addr[1], + scsi_cmd->addr[2], scsi_cmd->addr[3], + scsi_cmd->addr[4], scsi_cmd->addr[5], + scsi_cmd->addr[6], scsi_cmd->addr[7], + scsi_cmd->length[0], scsi_cmd->length[1], + scsi_cmd->length[2], scsi_cmd->length[3], + dxfer_len)); + } + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_OUT, + tag_action, + data_ptr, + dxfer_len, + sense_len, + cdb_len, + timeout); +} + +void +scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + u_int8_t *data_ptr, u_int16_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout) +{ + struct scsi_unmap *scsi_cmd; + + scsi_cmd = (struct scsi_unmap *)&csio->cdb_io.cdb_bytes; + scsi_cmd->opcode = UNMAP; + scsi_cmd->byte2 = byte2; + scsi_ulto4b(0, scsi_cmd->reserved); + scsi_cmd->group = 0; + scsi_ulto2b(dxfer_len, scsi_cmd->length); + scsi_cmd->control = 0; + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_OUT, + tag_action, + data_ptr, + dxfer_len, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + void scsi_start_stop(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), Modified: stable/8/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.h Thu Jun 6 09:23:21 2013 (r251456) +++ stable/8/sys/cam/scsi/scsi_all.h Thu Jun 6 09:45:22 2013 (r251457) @@ -512,6 +512,41 @@ struct scsi_rw_16 u_int8_t control; }; +struct scsi_write_same_10 +{ + uint8_t opcode; + uint8_t byte2; +#define SWS_LBDATA 0x02 +#define SWS_PBDATA 0x04 +#define SWS_UNMAP 0x08 +#define SWS_ANCHOR 0x10 + uint8_t addr[4]; + uint8_t group; + uint8_t length[2]; + uint8_t control; +}; + +struct scsi_write_same_16 +{ + uint8_t opcode; + uint8_t byte2; + uint8_t addr[8]; + uint8_t length[4]; + uint8_t group; + uint8_t control; +}; + +struct scsi_unmap +{ + uint8_t opcode; + uint8_t byte2; +#define SU_ANCHOR 0x01 + uint8_t reserved[4]; + uint8_t group; + uint8_t length[2]; + uint8_t control; +}; + struct scsi_start_stop_unit { u_int8_t opcode; @@ -595,6 +630,8 @@ struct ata_pass_16 { #define WRITE_BUFFER 0x3B #define READ_BUFFER 0x3C #define CHANGE_DEFINITION 0x40 +#define WRITE_SAME_10 0x41 +#define UNMAP 0x42 #define LOG_SELECT 0x4C #define LOG_SENSE 0x4D #define MODE_SELECT_10 0x55 @@ -602,6 +639,7 @@ struct ata_pass_16 { #define ATA_PASS_16 0x85 #define READ_16 0x88 #define WRITE_16 0x8A +#define WRITE_SAME_16 0x93 #define SERVICE_ACTION_IN 0x9E #define REPORT_LUNS 0xA0 #define ATA_PASS_12 0xA1 @@ -1287,6 +1325,20 @@ void scsi_read_write(struct ccb_scsiio * u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); +void scsi_write_same(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + int minimum_cmd_size, u_int64_t lba, + u_int32_t block_count, u_int8_t *data_ptr, + u_int32_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout); + +void scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + u_int8_t *data_ptr, u_int16_t dxfer_len, + u_int8_t sense_len, u_int32_t timeout); + void scsi_start_stop(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int start, int load_eject, Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Thu Jun 6 09:23:21 2013 (r251456) +++ stable/8/sys/cam/scsi/scsi_da.c Thu Jun 6 09:45:22 2013 (r251457) @@ -81,8 +81,7 @@ typedef enum { DA_FLAG_RETRY_UA = 0x080, DA_FLAG_OPEN = 0x100, DA_FLAG_SCTX_INIT = 0x200, - DA_FLAG_CAN_RC16 = 0x400, - DA_FLAG_CAN_LBPME = 0x800 + DA_FLAG_CAN_RC16 = 0x400 } da_flags; typedef enum { @@ -99,10 +98,24 @@ typedef enum { DA_CCB_BUFFER_IO = 0x03, DA_CCB_WAITING = 0x04, DA_CCB_DUMP = 0x05, + DA_CCB_DELETE = 0x06, DA_CCB_TYPE_MASK = 0x0F, DA_CCB_RETRY_UA = 0x10 } da_ccb_state; +typedef enum { + DA_DELETE_NONE, + DA_DELETE_DISABLE, + DA_DELETE_ZERO, + DA_DELETE_WS10, + DA_DELETE_WS16, + DA_DELETE_UNMAP, + DA_DELETE_MAX = DA_DELETE_UNMAP +} da_delete_methods; + +static const char *da_delete_method_names[] = + { "NONE", "DISABLE", "ZERO", "WS10", "WS16", "UNMAP" }; + /* Offsets into our private area for storing information */ #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 @@ -117,8 +130,12 @@ struct disk_params { u_int stripeoffset; }; +#define UNMAP_MAX_RANGES 512 + struct da_softc { struct bio_queue_head bio_queue; + struct bio_queue_head delete_queue; + struct bio_queue_head delete_run_queue; SLIST_ENTRY(da_softc) links; LIST_HEAD(, ccb_hdr) pending_ccbs; da_state state; @@ -128,6 +145,10 @@ struct da_softc { int error_inject; int ordered_tag_count; int outstanding_cmds; + int unmap_max_ranges; + int unmap_max_lba; + int delete_running; + da_delete_methods delete_method; struct disk_params params; struct disk *disk; union ccb saved_ccb; @@ -136,6 +157,7 @@ struct da_softc { struct sysctl_oid *sysctl_tree; struct callout sendordered_c; uint64_t wwpn; + uint8_t unmap_buf[UNMAP_MAX_RANGES * 16 + 8]; }; struct da_quirk_entry { @@ -833,6 +855,7 @@ static void daasync(void *callback_arg, struct cam_path *path, void *arg); static void dasysctlinit(void *context, int pending); static int dacmdsizesysctl(SYSCTL_HANDLER_ARGS); +static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS); static periph_ctor_t daregister; static periph_dtor_t dacleanup; static periph_start_t dastart; @@ -952,6 +975,10 @@ daopen(struct disk *dp) softc->disk->d_fwheads = softc->params.heads; softc->disk->d_devstat->block_size = softc->params.secsize; softc->disk->d_devstat->flags &= ~DEVSTAT_BS_UNAVAILABLE; + if (softc->delete_method > DA_DELETE_DISABLE) + softc->disk->d_flags |= DISKFLAG_CANDELETE; + else + softc->disk->d_flags &= ~DISKFLAG_CANDELETE; if ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0 && (softc->quirks & DA_Q_NO_PREVENT) == 0) @@ -1051,6 +1078,26 @@ daclose(struct disk *dp) return (0); } +static void +daschedule(struct cam_periph *periph) +{ + struct da_softc *softc = (struct da_softc *)periph->softc; + uint32_t prio; + + /* Check if cam_periph_getccb() was called. */ + prio = periph->immediate_priority; + + /* Check if we have more work to do. */ + if (bioq_first(&softc->bio_queue) || + (!softc->delete_running && bioq_first(&softc->delete_queue))) { + prio = CAM_PRIORITY_NORMAL; + } + + /* Schedule CCB if any of above is true. */ + if (prio != CAM_PRIORITY_NONE) + xpt_schedule(periph, prio); +} + /* * Actually translate the requested transfer into one the physical driver * can understand. The transfer is described by a buf and will include @@ -1085,12 +1132,18 @@ dastrategy(struct bio *bp) /* * Place it in the queue of disk activities for this disk */ - bioq_disksort(&softc->bio_queue, bp); + if (bp->bio_cmd == BIO_DELETE) { + if (bp->bio_bcount == 0) + biodone(bp); + else + bioq_disksort(&softc->delete_queue, bp); + } else + bioq_disksort(&softc->bio_queue, bp); /* * Schedule ourselves for performing the work. */ - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + daschedule(periph); cam_periph_unlock(periph); return; @@ -1234,6 +1287,7 @@ daoninvalidate(struct cam_periph *periph * with XPT_ABORT_CCB. */ bioq_flush(&softc->bio_queue, NULL, ENXIO); + bioq_flush(&softc->delete_queue, NULL, ENXIO); disk_gone(softc->disk); xpt_print(periph->path, "lost device - %d outstanding, %d refs\n", @@ -1365,6 +1419,10 @@ dasysctlinit(void *context, int pending) * the fly. */ SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "delete_method", CTLTYPE_STRING | CTLFLAG_RW, + &softc->delete_method, 0, dadeletemethodsysctl, "A", + "BIO_DELETE execution method"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW, &softc->minimum_cmd_size, 0, dacmdsizesysctl, "I", "Minimum CDB size"); @@ -1428,6 +1486,32 @@ dacmdsizesysctl(SYSCTL_HANDLER_ARGS) return (0); } +static int +dadeletemethodsysctl(SYSCTL_HANDLER_ARGS) +{ + char buf[16]; + int error; + const char *p; + int i, value; + + value = *(int *)arg1; + if (value < 0 || value > DA_DELETE_MAX) + p = "UNKNOWN"; + else + p = da_delete_method_names[value]; + strncpy(buf, p, sizeof(buf)); + error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + if (error != 0 || req->newptr == NULL) + return (error); + for (i = 0; i <= DA_DELETE_MAX; i++) { + if (strcmp(buf, da_delete_method_names[i]) != 0) + continue; + *(int *)arg1 = i; + return (0); + } + return (EINVAL); +} + static cam_status daregister(struct cam_periph *periph, void *arg) { @@ -1460,8 +1544,12 @@ daregister(struct cam_periph *periph, vo LIST_INIT(&softc->pending_ccbs); softc->state = DA_STATE_PROBE; bioq_init(&softc->bio_queue); + bioq_init(&softc->delete_queue); + bioq_init(&softc->delete_run_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= DA_FLAG_PACK_REMOVABLE; + softc->unmap_max_ranges = UNMAP_MAX_RANGES; + softc->unmap_max_lba = 1024*1024*2; periph->softc = softc; @@ -1599,13 +1687,10 @@ dastart(struct cam_periph *periph, union switch (softc->state) { case DA_STATE_NORMAL: { - /* Pull a buffer from the queue and get going on it */ - struct bio *bp; + struct bio *bp, *bp1; + uint8_t tag_code; - /* - * See if there is a buf with work for us to do.. - */ - bp = bioq_first(&softc->bio_queue); + /* Execute immediate CCB if waiting. */ if (periph->immediate_priority <= periph->pinfo.priority) { CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); @@ -1614,84 +1699,186 @@ dastart(struct cam_periph *periph, union periph_links.sle); periph->immediate_priority = CAM_PRIORITY_NONE; wakeup(&periph->ccb_list); - } else if (bp == NULL) { - xpt_release_ccb(start_ccb); - } else { - u_int8_t tag_code; + /* May have more work to do, so ensure we stay scheduled */ + daschedule(periph); + break; + } - bioq_remove(&softc->bio_queue, bp); + /* Run BIO_DELETE if not running yet. */ + if (!softc->delete_running && + (bp = bioq_first(&softc->delete_queue)) != NULL) { + uint64_t lba; + u_int count; + + if (softc->delete_method == DA_DELETE_UNMAP) { + uint8_t *buf = softc->unmap_buf; + uint64_t lastlba = (uint64_t)-1; + uint32_t lastcount = 0; + int blocks = 0, off, ranges = 0; + + softc->delete_running = 1; + bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + lba = bp1->bio_pblkno; + count = bp1->bio_bcount / softc->params.secsize; + + /* Try to extend the previous range. */ + if (lba == lastlba) { + lastcount += count; + off = (ranges - 1) * 16 + 8; + scsi_ulto4b(lastcount, &buf[off + 8]); + } else if (count > 0) { + off = ranges * 16 + 8; + scsi_u64to8b(lba, &buf[off + 0]); + scsi_ulto4b(count, &buf[off + 8]); + lastcount = count; + ranges++; + } + blocks += count; + lastlba = lba + count; + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || + ranges >= softc->unmap_max_ranges || + blocks + bp1->bio_bcount / + softc->params.secsize > softc->unmap_max_lba) + break; + } while (1); + scsi_ulto2b(ranges * 16 + 6, &buf[0]); + scsi_ulto2b(ranges * 16, &buf[2]); + + scsi_unmap(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*byte2*/0, + /*data_ptr*/ buf, + /*dxfer_len*/ ranges * 16 + 8, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; + goto out; + } else if (softc->delete_method == DA_DELETE_ZERO || + softc->delete_method == DA_DELETE_WS10 || + softc->delete_method == DA_DELETE_WS16) { + softc->delete_running = 1; + lba = bp->bio_pblkno; + count = 0; + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + count += bp1->bio_bcount / softc->params.secsize; + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || + lba + count != bp1->bio_pblkno || + count + bp1->bio_bcount / + softc->params.secsize > 0xffff) + break; + } while (1); + + scsi_write_same(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*byte2*/softc->delete_method == + DA_DELETE_ZERO ? 0 : SWS_UNMAP, + softc->delete_method == + DA_DELETE_WS16 ? 16 : 10, + /*lba*/lba, + /*block_count*/count, + /*data_ptr*/ __DECONST(void *, + zero_region), + /*dxfer_len*/ softc->params.secsize, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; + goto out; + } else { + bioq_flush(&softc->delete_queue, NULL, 0); + /* FALLTHROUGH */ + } + } - if ((bp->bio_flags & BIO_ORDERED) != 0 - || (softc->flags & DA_FLAG_NEED_OTAG) != 0) { - softc->flags &= ~DA_FLAG_NEED_OTAG; - softc->ordered_tag_count++; - tag_code = MSG_ORDERED_Q_TAG; - } else { - tag_code = MSG_SIMPLE_Q_TAG; - } - switch (bp->bio_cmd) { - case BIO_READ: - case BIO_WRITE: - scsi_read_write(&start_ccb->csio, - /*retries*/da_retry_count, - /*cbfcnp*/dadone, - /*tag_action*/tag_code, - /*read_op*/bp->bio_cmd - == BIO_READ, - /*byte2*/0, - softc->minimum_cmd_size, - /*lba*/bp->bio_pblkno, - /*block_count*/bp->bio_bcount / - softc->params.secsize, - /*data_ptr*/ bp->bio_data, - /*dxfer_len*/ bp->bio_bcount, - /*sense_len*/SSD_FULL_SIZE, - da_default_timeout * 1000); - break; - case BIO_FLUSH: - /* - * BIO_FLUSH doesn't currently communicate - * range data, so we synchronize the cache - * over the whole disk. We also force - * ordered tag semantics the flush applies - * to all previously queued I/O. - */ - scsi_synchronize_cache(&start_ccb->csio, - /*retries*/1, - /*cbfcnp*/dadone, - MSG_ORDERED_Q_TAG, - /*begin_lba*/0, - /*lb_count*/0, - SSD_FULL_SIZE, - da_default_timeout*1000); - break; - } - start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO; + /* Run regular command. */ + bp = bioq_takefirst(&softc->bio_queue); + if (bp == NULL) { + xpt_release_ccb(start_ccb); + break; + } + + if ((bp->bio_flags & BIO_ORDERED) != 0 || + (softc->flags & DA_FLAG_NEED_OTAG) != 0) { + softc->flags &= ~DA_FLAG_NEED_OTAG; + softc->ordered_tag_count++; + tag_code = MSG_ORDERED_Q_TAG; + } else { + tag_code = MSG_SIMPLE_Q_TAG; + } + switch (bp->bio_cmd) { + case BIO_READ: + case BIO_WRITE: + scsi_read_write(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/tag_code, + /*read_op*/bp->bio_cmd + == BIO_READ, + /*byte2*/0, + softc->minimum_cmd_size, + /*lba*/bp->bio_pblkno, + /*block_count*/bp->bio_bcount / + softc->params.secsize, + /*data_ptr*/ bp->bio_data, + /*dxfer_len*/ bp->bio_bcount, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + break; + case BIO_FLUSH: /* - * Block out any asyncronous callbacks - * while we touch the pending ccb list. + * BIO_FLUSH doesn't currently communicate + * range data, so we synchronize the cache + * over the whole disk. We also force + * ordered tag semantics the flush applies + * to all previously queued I/O. */ - LIST_INSERT_HEAD(&softc->pending_ccbs, - &start_ccb->ccb_h, periph_links.le); - softc->outstanding_cmds++; - - /* We expect a unit attention from this device */ - if ((softc->flags & DA_FLAG_RETRY_UA) != 0) { - start_ccb->ccb_h.ccb_state |= DA_CCB_RETRY_UA; - softc->flags &= ~DA_FLAG_RETRY_UA; - } - - start_ccb->ccb_h.ccb_bp = bp; - bp = bioq_first(&softc->bio_queue); - - xpt_action(start_ccb); + scsi_synchronize_cache(&start_ccb->csio, + /*retries*/1, + /*cbfcnp*/dadone, + MSG_ORDERED_Q_TAG, + /*begin_lba*/0, + /*lb_count*/0, + SSD_FULL_SIZE, + da_default_timeout*1000); + break; } - - if (bp != NULL) { - /* Have more work to do, so ensure we stay scheduled */ - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO; + +out: + /* + * Block out any asyncronous callbacks + * while we touch the pending ccb list. + */ + LIST_INSERT_HEAD(&softc->pending_ccbs, + &start_ccb->ccb_h, periph_links.le); + softc->outstanding_cmds++; + + /* We expect a unit attention from this device */ + if ((softc->flags & DA_FLAG_RETRY_UA) != 0) { + start_ccb->ccb_h.ccb_state |= DA_CCB_RETRY_UA; + softc->flags &= ~DA_FLAG_RETRY_UA; } + + start_ccb->ccb_h.ccb_bp = bp; + xpt_action(start_ccb); + + /* May have more work to do, so ensure we stay scheduled */ + daschedule(periph); break; } case DA_STATE_PROBE: @@ -1757,9 +1944,42 @@ cmd6workaround(union ccb *ccb) struct scsi_rw_10 *cmd10; struct da_softc *softc; u_int8_t *cdb; + struct bio *bp; int frozen; cdb = ccb->csio.cdb_io.cdb_bytes; + softc = (struct da_softc *)xpt_path_periph(ccb->ccb_h.path)->softc; + + if (ccb->ccb_h.ccb_state == DA_CCB_DELETE) { + if (softc->delete_method == DA_DELETE_UNMAP) { + xpt_print(ccb->ccb_h.path, "UNMAP is not supported, " + "switching to WRITE SAME(16) with UNMAP.\n"); + softc->delete_method = DA_DELETE_WS16; + } else if (softc->delete_method == DA_DELETE_WS16) { + xpt_print(ccb->ccb_h.path, + "WRITE SAME(16) with UNMAP is not supported, " + "disabling BIO_DELETE.\n"); + softc->delete_method = DA_DELETE_DISABLE; + } else if (softc->delete_method == DA_DELETE_WS10) { + xpt_print(ccb->ccb_h.path, + "WRITE SAME(10) with UNMAP is not supported, " + "disabling BIO_DELETE.\n"); + softc->delete_method = DA_DELETE_DISABLE; + } else if (softc->delete_method == DA_DELETE_ZERO) { + xpt_print(ccb->ccb_h.path, + "WRITE SAME(10) is not supported, " + "disabling BIO_DELETE.\n"); + softc->delete_method = DA_DELETE_DISABLE; + } else + softc->delete_method = DA_DELETE_DISABLE; + while ((bp = bioq_takefirst(&softc->delete_run_queue)) + != NULL) + bioq_disksort(&softc->delete_queue, bp); + bioq_insert_tail(&softc->delete_queue, + (struct bio *)ccb->ccb_h.ccb_bp); + ccb->ccb_h.ccb_bp = NULL; + return (0); + } /* Translation only possible if CDB is an array and cmd is R/W6 */ if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0 || @@ -1768,8 +1988,7 @@ cmd6workaround(union ccb *ccb) xpt_print(ccb->ccb_h.path, "READ(6)/WRITE(6) not supported, " "increasing minimum_cmd_size to 10.\n"); - softc = (struct da_softc *)xpt_path_periph(ccb->ccb_h.path)->softc; - softc->minimum_cmd_size = 10; + softc->minimum_cmd_size = 10; bcopy(cdb, &cmd6, sizeof(struct scsi_rw_6)); cmd10 = (struct scsi_rw_10 *)cdb; @@ -1810,8 +2029,9 @@ dadone(struct cam_periph *periph, union csio = &done_ccb->csio; switch (csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) { case DA_CCB_BUFFER_IO: + case DA_CCB_DELETE: { - struct bio *bp; + struct bio *bp, *bp1; bp = (struct bio *)done_ccb->ccb_h.ccb_bp; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { @@ -1831,6 +2051,7 @@ dadone(struct cam_periph *periph, union */ return; } + bp = (struct bio *)done_ccb->ccb_h.ccb_bp; if (error != 0) { int queued_error; @@ -1858,10 +2079,12 @@ dadone(struct cam_periph *periph, union } bioq_flush(&softc->bio_queue, NULL, queued_error); - bp->bio_error = error; - bp->bio_resid = bp->bio_bcount; - bp->bio_flags |= BIO_ERROR; - } else { + if (bp != NULL) { + bp->bio_error = error; + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; + } + } else if (bp != NULL) { bp->bio_resid = csio->resid; bp->bio_error = 0; if (bp->bio_resid != 0) @@ -1873,7 +2096,7 @@ dadone(struct cam_periph *periph, union /*reduction*/0, /*timeout*/0, /*getcount_only*/0); - } else { + } else if (bp != NULL) { if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) panic("REQ_CMP with QFRZN"); bp->bio_resid = csio->resid; @@ -1902,7 +2125,22 @@ dadone(struct cam_periph *periph, union softc->outstanding_cmds); } - biodone(bp); + if ((csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) == + DA_CCB_DELETE) { + while ((bp1 = bioq_takefirst(&softc->delete_run_queue)) + != NULL) { + bp1->bio_resid = bp->bio_resid; + bp1->bio_error = bp->bio_error; + if (bp->bio_flags & BIO_ERROR) + bp1->bio_flags |= BIO_ERROR; + biodone(bp1); + } + softc->delete_running = 0; + if (bp != NULL) + biodone(bp); + daschedule(periph); + } else if (bp != NULL) + biodone(bp); break; } case DA_CCB_PROBE: @@ -1972,10 +2210,9 @@ dadone(struct cam_periph *periph, union } else { dasetgeom(periph, block_size, maxsector, lbppbe, lalba & SRC16_LALBA); - if (lalba & SRC16_LBPME) - softc->flags |= DA_FLAG_CAN_LBPME; - else - softc->flags &= ~DA_FLAG_CAN_LBPME; + if ((lalba & SRC16_LBPME) && + softc->delete_method == DA_DELETE_NONE) + softc->delete_method = DA_DELETE_UNMAP; dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), "%juMB (%ju %u byte sectors: %dH %dS/T " @@ -2362,10 +2599,9 @@ done: } else { dasetgeom(periph, block_len, maxsector, lbppbe, lalba & SRC16_LALBA); - if (lalba & SRC16_LBPME) - softc->flags |= DA_FLAG_CAN_LBPME; - else - softc->flags &= ~DA_FLAG_CAN_LBPME; + if ((lalba & SRC16_LBPME) && + softc->delete_method == DA_DELETE_NONE) + softc->delete_method = DA_DELETE_UNMAP; } } From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 09:50:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E11B0878; Thu, 6 Jun 2013 09:50:42 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D204E1479; Thu, 6 Jun 2013 09:50:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r569ogdM086238; Thu, 6 Jun 2013 09:50:42 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r569og78086237; Thu, 6 Jun 2013 09:50:42 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306060950.r569og78086237@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 09:50:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251458 - stable/8/sys/cam/scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 09:50:43 -0000 Author: smh Date: Thu Jun 6 09:50:42 2013 New Revision: 251458 URL: http://svnweb.freebsd.org/changeset/base/251458 Log: MFC r245251: Remove essentially unused variables from scsi_da probe setups Modified: stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Thu Jun 6 09:45:22 2013 (r251457) +++ stable/8/sys/cam/scsi/scsi_da.c Thu Jun 6 09:50:42 2013 (r251458) @@ -1883,7 +1883,6 @@ out: } case DA_STATE_PROBE: { - struct ccb_scsiio *csio; struct scsi_read_capacity_data *rcap; rcap = (struct scsi_read_capacity_data *) @@ -1893,8 +1892,7 @@ out: /* da_free_periph??? */ break; } - csio = &start_ccb->csio; - scsi_read_capacity(csio, + scsi_read_capacity(&start_ccb->csio, /*retries*/4, dadone, MSG_SIMPLE_Q_TAG, @@ -1908,7 +1906,6 @@ out: } case DA_STATE_PROBE2: { - struct ccb_scsiio *csio; struct scsi_read_capacity_data_long *rcaplong; rcaplong = (struct scsi_read_capacity_data_long *) @@ -1918,8 +1915,7 @@ out: /* da_free_periph??? */ break; } - csio = &start_ccb->csio; - scsi_read_capacity_16(csio, + scsi_read_capacity_16(&start_ccb->csio, /*retries*/ 4, /*cbfcnp*/ dadone, /*tag_action*/ MSG_SIMPLE_Q_TAG, From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 09:55:01 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 182E6A16; Thu, 6 Jun 2013 09:55:01 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0A09915C2; Thu, 6 Jun 2013 09:55:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r569t03o086914; Thu, 6 Jun 2013 09:55:00 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r569t0Nq086913; Thu, 6 Jun 2013 09:55:00 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306060955.r569t0Nq086913@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 09:55:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251459 - stable/8/sys/cam/scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 09:55:01 -0000 Author: smh Date: Thu Jun 6 09:55:00 2013 New Revision: 251459 URL: http://svnweb.freebsd.org/changeset/base/251459 Log: MFC r245252: Always maintain disk d_flags MFC r249929: Removed unneeded tests in dadeletemethodset Modified: stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Thu Jun 6 09:50:42 2013 (r251458) +++ stable/8/sys/cam/scsi/scsi_da.c Thu Jun 6 09:55:00 2013 (r251459) @@ -856,6 +856,8 @@ static void daasync(void *callback_arg, static void dasysctlinit(void *context, int pending); static int dacmdsizesysctl(SYSCTL_HANDLER_ARGS); static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS); +static void dadeletemethodset(struct da_softc *softc, + da_delete_methods delete_method); static periph_ctor_t daregister; static periph_dtor_t dacleanup; static periph_start_t dastart; @@ -1420,7 +1422,7 @@ dasysctlinit(void *context, int pending) */ SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "delete_method", CTLTYPE_STRING | CTLFLAG_RW, - &softc->delete_method, 0, dadeletemethodsysctl, "A", + softc, 0, dadeletemethodsysctl, "A", "BIO_DELETE execution method"); SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW, @@ -1486,15 +1488,30 @@ dacmdsizesysctl(SYSCTL_HANDLER_ARGS) return (0); } +static void +dadeletemethodset(struct da_softc *softc, da_delete_methods delete_method) +{ + + + softc->delete_method = delete_method; + + if (softc->delete_method > DA_DELETE_DISABLE) + softc->disk->d_flags |= DISKFLAG_CANDELETE; + else + softc->disk->d_flags &= ~DISKFLAG_CANDELETE; +} + static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS) { char buf[16]; - int error; const char *p; - int i, value; + struct da_softc *softc; + int i, error, value; - value = *(int *)arg1; + softc = (struct da_softc *)arg1; + + value = softc->delete_method; if (value < 0 || value > DA_DELETE_MAX) p = "UNKNOWN"; else @@ -1506,7 +1523,7 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS for (i = 0; i <= DA_DELETE_MAX; i++) { if (strcmp(buf, da_delete_method_names[i]) != 0) continue; - *(int *)arg1 = i; + dadeletemethodset(softc, i); return (0); } return (EINVAL); @@ -1950,24 +1967,24 @@ cmd6workaround(union ccb *ccb) if (softc->delete_method == DA_DELETE_UNMAP) { xpt_print(ccb->ccb_h.path, "UNMAP is not supported, " "switching to WRITE SAME(16) with UNMAP.\n"); - softc->delete_method = DA_DELETE_WS16; + dadeletemethodset(softc, DA_DELETE_WS16); } else if (softc->delete_method == DA_DELETE_WS16) { xpt_print(ccb->ccb_h.path, "WRITE SAME(16) with UNMAP is not supported, " "disabling BIO_DELETE.\n"); - softc->delete_method = DA_DELETE_DISABLE; + dadeletemethodset(softc, DA_DELETE_DISABLE); } else if (softc->delete_method == DA_DELETE_WS10) { xpt_print(ccb->ccb_h.path, "WRITE SAME(10) with UNMAP is not supported, " "disabling BIO_DELETE.\n"); - softc->delete_method = DA_DELETE_DISABLE; + dadeletemethodset(softc, DA_DELETE_DISABLE); } else if (softc->delete_method == DA_DELETE_ZERO) { xpt_print(ccb->ccb_h.path, "WRITE SAME(10) is not supported, " "disabling BIO_DELETE.\n"); - softc->delete_method = DA_DELETE_DISABLE; + dadeletemethodset(softc, DA_DELETE_DISABLE); } else - softc->delete_method = DA_DELETE_DISABLE; + dadeletemethodset(softc, DA_DELETE_DISABLE); while ((bp = bioq_takefirst(&softc->delete_run_queue)) != NULL) bioq_disksort(&softc->delete_queue, bp); @@ -2208,7 +2225,7 @@ dadone(struct cam_periph *periph, union lbppbe, lalba & SRC16_LALBA); if ((lalba & SRC16_LBPME) && softc->delete_method == DA_DELETE_NONE) - softc->delete_method = DA_DELETE_UNMAP; + dadeletemethodset(softc, DA_DELETE_UNMAP); dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), "%juMB (%ju %u byte sectors: %dH %dS/T " From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 09:58:24 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 448B9D7F; Thu, 6 Jun 2013 09:58:24 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 368971617; Thu, 6 Jun 2013 09:58:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r569wOak087564; Thu, 6 Jun 2013 09:58:24 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r569wOUr087563; Thu, 6 Jun 2013 09:58:24 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306060958.r569wOUr087563@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 09:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251460 - stable/8/sys/cam/scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 09:58:24 -0000 Author: smh Date: Thu Jun 6 09:58:23 2013 New Revision: 251460 URL: http://svnweb.freebsd.org/changeset/base/251460 Log: MFC r245253: Use sysctl tuneable values for scsi_da and retry_count Modified: stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Thu Jun 6 09:55:00 2013 (r251459) +++ stable/8/sys/cam/scsi/scsi_da.c Thu Jun 6 09:58:23 2013 (r251460) @@ -1910,7 +1910,7 @@ out: break; } scsi_read_capacity(&start_ccb->csio, - /*retries*/4, + /*retries*/da_retry_count, dadone, MSG_SIMPLE_Q_TAG, rcap, @@ -1933,7 +1933,7 @@ out: break; } scsi_read_capacity_16(&start_ccb->csio, - /*retries*/ 4, + /*retries*/ da_retry_count, /*cbfcnp*/ dadone, /*tag_action*/ MSG_SIMPLE_Q_TAG, /*lba*/ 0, @@ -1941,7 +1941,7 @@ out: /*pmi*/ 0, rcaplong, /*sense_len*/ SSD_FULL_SIZE, - /*timeout*/ 60000); + /*timeout*/ da_default_timeout * 1000); start_ccb->ccb_h.ccb_bp = NULL; start_ccb->ccb_h.ccb_state = DA_CCB_PROBE2; xpt_action(start_ccb); From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 10:00:23 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6F56625B; Thu, 6 Jun 2013 10:00:23 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 610191657; Thu, 6 Jun 2013 10:00:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56A0NT1088228; Thu, 6 Jun 2013 10:00:23 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56A0Neq088227; Thu, 6 Jun 2013 10:00:23 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306061000.r56A0Neq088227@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 10:00:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251461 - stable/8/sys/cam/scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 10:00:23 -0000 Author: smh Date: Thu Jun 6 10:00:22 2013 New Revision: 251461 URL: http://svnweb.freebsd.org/changeset/base/251461 Log: MFC r246146: Format CDB output as 2 digit hex correcting the length Modified: stable/8/sys/cam/scsi/scsi_all.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.c Thu Jun 6 09:58:23 2013 (r251460) +++ stable/8/sys/cam/scsi/scsi_all.c Thu Jun 6 10:00:22 2013 (r251461) @@ -3112,7 +3112,7 @@ scsi_cdb_string(u_int8_t *cdb_ptr, char *cdb_string = '\0'; for (i = 0; i < cdb_len; i++) snprintf(cdb_string + strlen(cdb_string), - len - strlen(cdb_string), "%x ", cdb_ptr[i]); + len - strlen(cdb_string), "%02hhx ", cdb_ptr[i]); return(cdb_string); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 10:06:33 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8230A4EA; Thu, 6 Jun 2013 10:06:33 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7217516A8; Thu, 6 Jun 2013 10:06:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56A6X8V090904; Thu, 6 Jun 2013 10:06:33 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56A6WcB090896; Thu, 6 Jun 2013 10:06:32 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306061006.r56A6WcB090896@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 10:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251462 - in stable/8/sys/cam: . ata scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 10:06:33 -0000 Author: smh Date: Thu Jun 6 10:06:32 2013 New Revision: 251462 URL: http://svnweb.freebsd.org/changeset/base/251462 Log: MFC r248922: Adds the ability to enable / disable sorting of BIO requests Modified: stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/cam.c stable/8/sys/cam/cam.h stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Thu Jun 6 10:00:22 2013 (r251461) +++ stable/8/sys/cam/ata/ata_da.c Thu Jun 6 10:06:32 2013 (r251462) @@ -130,6 +130,7 @@ struct ada_softc { ada_state state; ada_flags flags; ada_quirks quirks; + int sort_io_queue; int ordered_tag_count; int outstanding_cmds; int trim_max_ranges; @@ -443,6 +444,8 @@ static void adashutdown(void *arg, int softc->read_ahead : ada_read_ahead) #define ADA_WC (softc->write_cache >= 0 ? \ softc->write_cache : ada_write_cache) +#define ADA_SIO (softc->sort_io_queue >= 0 ? \ + softc->sort_io_queue : cam_sort_io_queues) /* * Most platforms map firmware geometry to actual, but some don't. If @@ -660,10 +663,17 @@ adastrategy(struct bio *bp) * Place it in the queue of disk activities for this disk */ if (bp->bio_cmd == BIO_DELETE && - (softc->flags & ADA_FLAG_CAN_TRIM)) - bioq_disksort(&softc->trim_queue, bp); - else - bioq_disksort(&softc->bio_queue, bp); + (softc->flags & ADA_FLAG_CAN_TRIM)) { + if (ADA_SIO) + bioq_disksort(&softc->trim_queue, bp); + else + bioq_insert_tail(&softc->trim_queue, bp); + } else { + if (ADA_SIO) + bioq_disksort(&softc->bio_queue, bp); + else + bioq_insert_tail(&softc->bio_queue, bp); + } /* * Schedule ourselves for performing the work. @@ -967,6 +977,10 @@ adasysctlinit(void *context, int pending SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->write_cache, 0, "Enable disk write cache."); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "sort_io_queue", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->sort_io_queue, 0, + "Sort IO queue to try and optimise disk access patterns"); #ifdef ADA_TEST_FAILURE /* * Add a 'door bell' sysctl which allows one to set it from userland @@ -1088,6 +1102,7 @@ adaregister(struct cam_periph *periph, v snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.write_cache", periph->unit_number); TUNABLE_INT_FETCH(announce_buf, &softc->write_cache); + softc->sort_io_queue = -1; adagetparams(periph, cgd); softc->disk = disk_alloc(); softc->disk->d_devstat = devstat_new_entry(periph->periph_name, Modified: stable/8/sys/cam/cam.c ============================================================================== --- stable/8/sys/cam/cam.c Thu Jun 6 10:00:22 2013 (r251461) +++ stable/8/sys/cam/cam.c Thu Jun 6 10:06:32 2013 (r251462) @@ -103,6 +103,15 @@ const int num_cam_status_entries = #ifdef _KERNEL SYSCTL_NODE(_kern, OID_AUTO, cam, CTLFLAG_RD, 0, "CAM Subsystem"); + +#ifndef CAM_DEFAULT_SORT_IO_QUEUES +#define CAM_DEFAULT_SORT_IO_QUEUES 1 +#endif + +int cam_sort_io_queues = CAM_DEFAULT_SORT_IO_QUEUES; +TUNABLE_INT("kern.cam.sort_io_queues", &cam_sort_io_queues); +SYSCTL_INT(_kern_cam, OID_AUTO, sort_io_queues, CTLFLAG_RWTUN, + &cam_sort_io_queues, 0, "Sort IO queues to try and optimise disk access patterns"); #endif void Modified: stable/8/sys/cam/cam.h ============================================================================== --- stable/8/sys/cam/cam.h Thu Jun 6 10:00:22 2013 (r251461) +++ stable/8/sys/cam/cam.h Thu Jun 6 10:06:32 2013 (r251462) @@ -212,6 +212,9 @@ struct cam_status_entry extern const struct cam_status_entry cam_status_table[]; extern const int num_cam_status_entries; +#ifdef _KERNEL +extern int cam_sort_io_queues; +#endif union ccb; #ifdef SYSCTL_DECL /* from sysctl.h */ Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Thu Jun 6 10:00:22 2013 (r251461) +++ stable/8/sys/cam/scsi/scsi_da.c Thu Jun 6 10:06:32 2013 (r251462) @@ -141,6 +141,7 @@ struct da_softc { da_state state; da_flags flags; da_quirks quirks; + int sort_io_queue; int minimum_cmd_size; int error_inject; int ordered_tag_count; @@ -885,6 +886,8 @@ static void dashutdown(void *arg, int h #define DA_DEFAULT_SEND_ORDERED 1 #endif +#define DA_SIO (softc->sort_io_queue >= 0 ? \ + softc->sort_io_queue : cam_sort_io_queues) static int da_retry_count = DA_DEFAULT_RETRY; static int da_default_timeout = DA_DEFAULT_TIMEOUT; @@ -1137,10 +1140,15 @@ dastrategy(struct bio *bp) if (bp->bio_cmd == BIO_DELETE) { if (bp->bio_bcount == 0) biodone(bp); - else + else if (DA_SIO) bioq_disksort(&softc->delete_queue, bp); - } else + else + bioq_insert_tail(&softc->delete_queue, bp); + } else if (DA_SIO) { bioq_disksort(&softc->bio_queue, bp); + } else { + bioq_insert_tail(&softc->bio_queue, bp); + } /* * Schedule ourselves for performing the work. @@ -1428,6 +1436,9 @@ dasysctlinit(void *context, int pending) OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW, &softc->minimum_cmd_size, 0, dacmdsizesysctl, "I", "Minimum CDB size"); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "sort_io_queue", CTLFLAG_RW, &softc->sort_io_queue, 0, + "Sort IO queue to try and optimise disk access patterns"); /* * Add some addressing info. @@ -1567,6 +1578,7 @@ daregister(struct cam_periph *periph, vo softc->flags |= DA_FLAG_PACK_REMOVABLE; softc->unmap_max_ranges = UNMAP_MAX_RANGES; softc->unmap_max_lba = 1024*1024*2; + softc->sort_io_queue = -1; periph->softc = softc; @@ -1985,9 +1997,16 @@ cmd6workaround(union ccb *ccb) dadeletemethodset(softc, DA_DELETE_DISABLE); } else dadeletemethodset(softc, DA_DELETE_DISABLE); - while ((bp = bioq_takefirst(&softc->delete_run_queue)) - != NULL) - bioq_disksort(&softc->delete_queue, bp); + + if (DA_SIO) { + while ((bp = bioq_takefirst(&softc->delete_run_queue)) + != NULL) + bioq_disksort(&softc->delete_queue, bp); + } else { + while ((bp = bioq_takefirst(&softc->delete_run_queue)) + != NULL) + bioq_insert_tail(&softc->delete_queue, bp); + } bioq_insert_tail(&softc->delete_queue, (struct bio *)ccb->ccb_h.ccb_bp); ccb->ccb_h.ccb_bp = NULL; From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 10:09:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3457777C; Thu, 6 Jun 2013 10:09:21 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1640816D0; Thu, 6 Jun 2013 10:09:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56A9KKu091497; Thu, 6 Jun 2013 10:09:20 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56A9KqQ091495; Thu, 6 Jun 2013 10:09:20 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306061009.r56A9KqQ091495@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 10:09:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251463 - stable/8/sys/cam/scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 10:09:21 -0000 Author: smh Date: Thu Jun 6 10:09:20 2013 New Revision: 251463 URL: http://svnweb.freebsd.org/changeset/base/251463 Log: MFC r248992: Added ATA Pass-Through support to CAM Modified: stable/8/sys/cam/scsi/scsi_all.c stable/8/sys/cam/scsi/scsi_all.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.c Thu Jun 6 10:06:32 2013 (r251462) +++ stable/8/sys/cam/scsi/scsi_all.c Thu Jun 6 10:09:20 2013 (r251463) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifndef _KERNEL #include @@ -4390,6 +4391,50 @@ scsi_write_same(struct ccb_scsiio *csio, } void +scsi_ata_pass_16(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int32_t flags, u_int8_t tag_action, + u_int8_t protocol, u_int8_t ata_flags, u_int16_t features, + u_int16_t sector_count, uint64_t lba, u_int8_t command, + u_int8_t control, u_int8_t *data_ptr, u_int16_t dxfer_len, + u_int8_t sense_len, u_int32_t timeout) +{ + struct ata_pass_16 *ata_cmd; + + ata_cmd = (struct ata_pass_16 *)&csio->cdb_io.cdb_bytes; + ata_cmd->opcode = ATA_PASS_16; + ata_cmd->protocol = protocol; + ata_cmd->flags = ata_flags; + ata_cmd->features_ext = features >> 8; + ata_cmd->features = features; + ata_cmd->sector_count_ext = sector_count >> 8; + ata_cmd->sector_count = sector_count; + ata_cmd->lba_low = lba; + ata_cmd->lba_mid = lba >> 8; + ata_cmd->lba_high = lba >> 16; + ata_cmd->device = ATA_DEV_LBA; + if (protocol & AP_EXTEND) { + ata_cmd->lba_low_ext = lba >> 24; + ata_cmd->lba_mid_ext = lba >> 32; + ata_cmd->lba_high_ext = lba >> 40; + } else + ata_cmd->device |= (lba >> 24) & 0x0f; + ata_cmd->command = command; + ata_cmd->control = control; + + cam_fill_csio(csio, + retries, + cbfcnp, + flags, + tag_action, + data_ptr, + dxfer_len, + sense_len, + sizeof(*ata_cmd), + timeout); +} + +void scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int8_t byte2, Modified: stable/8/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.h Thu Jun 6 10:06:32 2013 (r251462) +++ stable/8/sys/cam/scsi/scsi_all.h Thu Jun 6 10:09:20 2013 (r251463) @@ -562,6 +562,19 @@ struct scsi_start_stop_unit struct ata_pass_12 { u_int8_t opcode; u_int8_t protocol; +#define AP_PROTO_HARD_RESET (0x00 << 1) +#define AP_PROTO_SRST (0x01 << 1) +#define AP_PROTO_NON_DATA (0x03 << 1) +#define AP_PROTO_PIO_IN (0x04 << 1) +#define AP_PROTO_PIO_OUT (0x05 << 1) +#define AP_PROTO_DMA (0x06 << 1) +#define AP_PROTO_DMA_QUEUED (0x07 << 1) +#define AP_PROTO_DEVICE_DIAG (0x08 << 1) +#define AP_PROTO_DEVICE_RESET (0x09 << 1) +#define AP_PROTO_UDMA_IN (0x10 << 1) +#define AP_PROTO_UDMA_OUT (0x11 << 1) +#define AP_PROTO_FPDMA (0x12 << 1) +#define AP_PROTO_RESP_INFO (0x15 << 1) #define AP_MULTI 0xe0 u_int8_t flags; #define AP_T_LEN 0x03 @@ -585,6 +598,15 @@ struct ata_pass_16 { u_int8_t protocol; #define AP_EXTEND 0x01 u_int8_t flags; +#define AP_FLAG_TLEN_NO_DATA (0 << 0) +#define AP_FLAG_TLEN_FEAT (1 << 0) +#define AP_FLAG_TLEN_SECT_CNT (2 << 0) +#define AP_FLAG_TLEN_STPSIU (3 << 0) +#define AP_FLAG_BYT_BLOK_BYTES (0 << 2) +#define AP_FLAG_BYT_BLOK_BLOCKS (1 << 2) +#define AP_FLAG_TDIR_TO_DEV (0 << 3) +#define AP_FLAG_TDIR_FROM_DEV (1 << 3) +#define AP_FLAG_CHK_COND (1 << 5) u_int8_t features_ext; u_int8_t features; u_int8_t sector_count_ext; @@ -697,7 +719,7 @@ struct ata_pass_16 { /* * This length is the initial inquiry length used by the probe code, as - * well as the legnth necessary for scsi_print_inquiry() to function + * well as the length necessary for scsi_print_inquiry() to function * correctly. If either use requires a different length in the future, * the two values should be de-coupled. */ @@ -1333,6 +1355,14 @@ void scsi_write_same(struct ccb_scsiio * u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); +void scsi_ata_pass_16(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int32_t flags, u_int8_t tag_action, + u_int8_t protocol, u_int8_t ata_flags, u_int16_t features, + u_int16_t sector_count, uint64_t lba, u_int8_t command, + u_int8_t control, u_int8_t *data_ptr, u_int16_t dxfer_len, + u_int8_t sense_len, u_int32_t timeout); + void scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int8_t byte2, From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 10:25:58 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DEA18C8; Thu, 6 Jun 2013 10:25:58 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B66701793; Thu, 6 Jun 2013 10:25:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56APwUp097886; Thu, 6 Jun 2013 10:25:58 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56APwA6097885; Thu, 6 Jun 2013 10:25:58 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306061025.r56APwA6097885@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 10:25:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251464 - stable/8/sys/geom X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 10:25:59 -0000 Author: smh Date: Thu Jun 6 10:25:58 2013 New Revision: 251464 URL: http://svnweb.freebsd.org/changeset/base/251464 Log: MFC r249930: Added a sysctl to control the maximum size of a delete request Modified: stable/8/sys/geom/geom_dev.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/geom/ (props changed) Modified: stable/8/sys/geom/geom_dev.c ============================================================================== --- stable/8/sys/geom/geom_dev.c Thu Jun 6 10:09:20 2013 (r251463) +++ stable/8/sys/geom/geom_dev.c Thu Jun 6 10:25:58 2013 (r251464) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -80,6 +81,19 @@ static struct g_class g_dev_class = { .orphan = g_dev_orphan, }; +/* + * We target 262144 (8 x 32768) sectors by default as this significantly + * increases the throughput on commonly used SSD's with a marginal + * increase in non-interruptible request latency. + */ +static uint64_t g_dev_del_max_sectors = 262144; +SYSCTL_DECL(_kern_geom); +SYSCTL_NODE(_kern_geom, OID_AUTO, dev, CTLFLAG_RW, 0, "GEOM_DEV stuff"); +SYSCTL_QUAD(_kern_geom_dev, OID_AUTO, delete_max_sectors, CTLFLAG_RW, + &g_dev_del_max_sectors, 0, "Maximum number of sectors in a single " + "delete request sent to the provider. Larger requests are chunked " + "so they can be interrupted. (0 = disable chunking)"); + void g_dev_print(void) { @@ -326,17 +340,20 @@ g_dev_ioctl(struct cdev *dev, u_long cmd } while (length > 0) { chunk = length; - if (chunk > 65536 * cp->provider->sectorsize) - chunk = 65536 * cp->provider->sectorsize; + if (g_dev_del_max_sectors != 0 && chunk > + g_dev_del_max_sectors * cp->provider->sectorsize) { + chunk = g_dev_del_max_sectors * + cp->provider->sectorsize; + } error = g_delete_data(cp, offset, chunk); length -= chunk; offset += chunk; if (error) break; /* - * Since the request size is unbounded, the service - * time is likewise. We make this ioctl interruptible - * by checking for signals for each bio. + * Since the request size can be large, the service + * time can be is likewise. We make this ioctl + * interruptible by checking for signals for each bio. */ if (SIGPENDING(td)) break; From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 10:27:34 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EB24B354; Thu, 6 Jun 2013 10:27:34 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DD5F917A9; Thu, 6 Jun 2013 10:27:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56ARY3A098236; Thu, 6 Jun 2013 10:27:34 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56ARYrd098235; Thu, 6 Jun 2013 10:27:34 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306061027.r56ARYrd098235@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 10:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251465 - stable/8/sys/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 10:27:35 -0000 Author: smh Date: Thu Jun 6 10:27:34 2013 New Revision: 251465 URL: http://svnweb.freebsd.org/changeset/base/251465 Log: MFC r249931: Added Dataset Management defines to be used by TRIM Modified: stable/8/sys/sys/ata.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/sys/ata.h ============================================================================== --- stable/8/sys/sys/ata.h Thu Jun 6 10:25:58 2013 (r251464) +++ stable/8/sys/sys/ata.h Thu Jun 6 10:27:34 2013 (r251465) @@ -261,6 +261,12 @@ struct ata_params { /*255*/ u_int16_t integrity; } __packed; +/* ATA Dataset Management */ +#define ATA_DSM_BLK_SIZE 512 +#define ATA_DSM_BLK_RANGES 64 +#define ATA_DSM_RANGE_SIZE 8 +#define ATA_DSM_RANGE_MAX 65535 + /* * ATA Device Register * From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 10:51:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3864885E; Thu, 6 Jun 2013 10:51:02 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from onyx.glenbarber.us (onyx.glenbarber.us [IPv6:2607:fc50:1000:c200::face]) by mx1.freebsd.org (Postfix) with ESMTP id 072BC18AA; Thu, 6 Jun 2013 10:51:02 +0000 (UTC) Received: from glenbarber.us (kaos.glenbarber.us [71.224.221.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id 1B90223F848; Thu, 6 Jun 2013 06:51:00 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.8.3 onyx.glenbarber.us 1B90223F848 Authentication-Results: onyx.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Thu, 6 Jun 2013 06:50:58 -0400 From: Glen Barber To: Jung-uk Kim Subject: Re: svn commit: r251438 - in head/gnu: lib/libregex lib/libregex/posix usr.bin/diff usr.bin/grep Message-ID: <20130606105058.GI64948@glenbarber.us> References: <201306052131.r55LV6t8052710@svn.freebsd.org> <20130606032752.GR1716@glenbarber.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cf0hFtnykp6aONGL" Content-Disposition: inline In-Reply-To: <20130606032752.GR1716@glenbarber.us> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 10:51:02 -0000 --cf0hFtnykp6aONGL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 05, 2013 at 11:27:52PM -0400, Glen Barber wrote: > On Wed, Jun 05, 2013 at 09:31:06PM +0000, Jung-uk Kim wrote: > > Author: jkim > > Date: Wed Jun 5 21:31:06 2013 > > New Revision: 251438 > > URL: http://svnweb.freebsd.org/changeset/base/251438 > >=20 > > Log: > > Connect libgnuregex 2.17 to the build. > >=20 >=20 > I think this breaks the build. I am seeing the following: >=20 > /usr/obj/usr/src/tmp/usr/include/gnu/posix/regex.h:369:3: error: > declaration does not declare anything [-Werror,-Wmissing-declarations] > unsigned long int __REPB_PREFIX(used); > ^~~~~~~~~~~~~~~~~ >=20 I think this is a local problem. Sorry for the noise. Glen --cf0hFtnykp6aONGL Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBCAAGBQJRsGmSAAoJEFJPDDeguUajcikH/04IPf7Z3UfWOa5hnQ/u6DSP xOj0azITDL2zMZl3rliOqAUxou4ohphOVby8DiMV9BVWIB9gT7QLHZk6oYCm9774 /uP+CeNna/tctbx0rHLKPvABhc6veTgoN90zjzKPZHmAN9LqJZS2k2VQIqpa82wn hJt93o8wjuTyx8ieccc/MCpQ50r/50+O1DJ8An/yiQEl6lF+/XjHKZEwm9yHan/l XICd/sBaJUolH9HzHv970pq+C7TsI5rY6lo54QxK1XE7oqXCPMXTNiOuPDq6veFu nOErEe5yxRLhPpwpaUI4gxI6saXq3Xfobo1Y1JfRrh07kVdQhRKpM8WhqKDLa7I= =eDs/ -----END PGP SIGNATURE----- --cf0hFtnykp6aONGL-- From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 11:41:23 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F009EA5D; Thu, 6 Jun 2013 11:41:22 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D226B1B15; Thu, 6 Jun 2013 11:41:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56BfMUC022596; Thu, 6 Jun 2013 11:41:22 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56BfMAO022593; Thu, 6 Jun 2013 11:41:22 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306061141.r56BfMAO022593@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 11:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251466 - stable/8/sys/cam/scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 11:41:23 -0000 Author: smh Date: Thu Jun 6 11:41:22 2013 New Revision: 251466 URL: http://svnweb.freebsd.org/changeset/base/251466 Log: MFC r249933: Added the ability to send ATA identify and TRIM commands via SCSI Modified: stable/8/sys/cam/scsi/scsi_all.c stable/8/sys/cam/scsi/scsi_all.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.c Thu Jun 6 10:27:34 2013 (r251465) +++ stable/8/sys/cam/scsi/scsi_all.c Thu Jun 6 11:41:22 2013 (r251466) @@ -4391,6 +4391,57 @@ scsi_write_same(struct ccb_scsiio *csio, } void +scsi_ata_identify(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t *data_ptr, + u_int16_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout) +{ + scsi_ata_pass_16(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_IN, + tag_action, + /*protocol*/AP_PROTO_PIO_IN, + /*ata_flags*/AP_FLAG_TDIR_FROM_DEV| + AP_FLAG_BYT_BLOK_BYTES|AP_FLAG_TLEN_SECT_CNT, + /*features*/0, + /*sector_count*/dxfer_len, + /*lba*/0, + /*command*/ATA_ATA_IDENTIFY, + /*control*/0, + data_ptr, + dxfer_len, + sense_len, + timeout); +} + +void +scsi_ata_trim(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int16_t block_count, + u_int8_t *data_ptr, u_int16_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout) +{ + scsi_ata_pass_16(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_OUT, + tag_action, + /*protocol*/AP_EXTEND|AP_PROTO_DMA, + /*ata_flags*/AP_FLAG_TLEN_SECT_CNT|AP_FLAG_BYT_BLOK_BLOCKS, + /*features*/ATA_DSM_TRIM, + /*sector_count*/block_count, + /*lba*/0, + /*command*/ATA_DATA_SET_MANAGEMENT, + /*control*/0, + data_ptr, + dxfer_len, + sense_len, + timeout); +} + +void scsi_ata_pass_16(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int32_t flags, u_int8_t tag_action, Modified: stable/8/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.h Thu Jun 6 10:27:34 2013 (r251465) +++ stable/8/sys/cam/scsi/scsi_all.h Thu Jun 6 11:41:22 2013 (r251466) @@ -875,6 +875,61 @@ struct scsi_vpd_unit_serial_number u_int8_t serial_num[SVPD_SERIAL_NUM_SIZE]; }; +/* + * Logical Block Provisioning VPD Page based on + * T10/1799-D Revision 31 + */ +struct scsi_vpd_logical_block_prov +{ + u_int8_t device; + u_int8_t page_code; +#define SVPD_LBP 0xB2 + u_int8_t page_length[2]; +#define SVPD_LBP_PL_BASIC 0x04 + u_int8_t threshold_exponent; + u_int8_t flags; +#define SVPD_LBP_UNMAP 0x80 +#define SVPD_LBP_WS16 0x40 +#define SVPD_LBP_WS10 0x20 +#define SVPD_LBP_RZ 0x04 +#define SVPD_LBP_ANC_SUP 0x02 +#define SVPD_LBP_DP 0x01 + u_int8_t prov_type; +#define SVPD_LBP_RESOURCE 0x01 +#define SVPD_LBP_THIN 0x02 + u_int8_t reserved; + /* + * Provisioning Group Descriptor can be here if SVPD_LBP_DP is set + * Its size can be determined from page_length - 4 + */ +}; + +/* + * Block Limits VDP Page based on + * T10/1799-D Revision 31 + */ +struct scsi_vpd_block_limits +{ + u_int8_t device; + u_int8_t page_code; +#define SVPD_BLOCK_LIMITS 0xB0 + u_int8_t page_length[2]; +#define SVPD_BL_PL_BASIC 0x10 +#define SVPD_BL_PL_TP 0x3C + u_int8_t reserved1; + u_int8_t max_cmp_write_len; + u_int8_t opt_txfer_len_grain[2]; + u_int8_t max_txfer_len[4]; + u_int8_t opt_txfer_len[4]; + u_int8_t max_prefetch[4]; + u_int8_t max_unmap_lba_cnt[4]; + u_int8_t max_unmap_blk_cnt[4]; + u_int8_t opt_unmap_grain[4]; + u_int8_t unmap_grain_align[4]; + u_int8_t max_write_same_length[8]; + u_int8_t reserved2[20]; +}; + struct scsi_read_capacity { u_int8_t opcode; @@ -1355,6 +1410,18 @@ void scsi_write_same(struct ccb_scsiio * u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); +void scsi_ata_identify(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t *data_ptr, + u_int16_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout); + +void scsi_ata_trim(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int16_t block_count, + u_int8_t *data_ptr, u_int16_t dxfer_len, + u_int8_t sense_len, u_int32_t timeout); + void scsi_ata_pass_16(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int32_t flags, u_int8_t tag_action, From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 11:47:55 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 311DFE2B; Thu, 6 Jun 2013 11:47:55 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 22F941B4F; Thu, 6 Jun 2013 11:47:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56Bltu1023570; Thu, 6 Jun 2013 11:47:55 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56BlshS023569; Thu, 6 Jun 2013 11:47:55 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306061147.r56BlshS023569@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 11:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251467 - stable/8/sys/cam/ata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 11:47:55 -0000 Author: smh Date: Thu Jun 6 11:47:54 2013 New Revision: 251467 URL: http://svnweb.freebsd.org/changeset/base/251467 Log: MFC r249934: Updated TRIM calculations in cam/ata to be based off ATA_DSM_* defines Modified: stable/8/sys/cam/ata/ata_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Thu Jun 6 11:41:22 2013 (r251466) +++ stable/8/sys/cam/ata/ata_da.c Thu Jun 6 11:47:54 2013 (r251467) @@ -117,10 +117,10 @@ struct disk_params { }; #define TRIM_MAX_BLOCKS 8 -#define TRIM_MAX_RANGES (TRIM_MAX_BLOCKS * 64) +#define TRIM_MAX_RANGES (TRIM_MAX_BLOCKS * ATA_DSM_BLK_RANGES) #define TRIM_MAX_BIOS (TRIM_MAX_RANGES * 4) struct trim_request { - uint8_t data[TRIM_MAX_RANGES * 8]; + uint8_t data[TRIM_MAX_RANGES * ATA_DSM_RANGE_SIZE]; struct bio *bps[TRIM_MAX_BIOS]; }; @@ -1056,8 +1056,8 @@ adaregister(struct cam_periph *periph, v softc->trim_max_ranges = TRIM_MAX_RANGES; if (cgd->ident_data.max_dsm_blocks != 0) { softc->trim_max_ranges = - min(cgd->ident_data.max_dsm_blocks * 64, - softc->trim_max_ranges); + min(cgd->ident_data.max_dsm_blocks * + ATA_DSM_BLK_RANGES, softc->trim_max_ranges); } } if (cgd->ident_data.support.command2 & ATA_SUPPORT_CFA) @@ -1131,10 +1131,12 @@ adaregister(struct cam_periph *periph, v softc->disk->d_flags = 0; if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; - if ((softc->flags & ADA_FLAG_CAN_TRIM) || - ((softc->flags & ADA_FLAG_CAN_CFA) && - !(softc->flags & ADA_FLAG_CAN_48BIT))) + if (softc->flags & ADA_FLAG_CAN_TRIM) { softc->disk->d_flags |= DISKFLAG_CANDELETE; + } else if ((softc->flags & ADA_FLAG_CAN_CFA) && + !(softc->flags & ADA_FLAG_CAN_48BIT)) { + softc->disk->d_flags |= DISKFLAG_CANDELETE; + } strlcpy(softc->disk->d_ident, cgd->serial_num, MIN(sizeof(softc->disk->d_ident), cgd->serial_num_len + 1)); @@ -1284,9 +1286,9 @@ adastart(struct cam_periph *periph, unio /* Try to extend the previous range. */ if (lba == lastlba) { - c = min(count, 0xffff - lastcount); + c = min(count, ATA_DSM_RANGE_MAX - lastcount); lastcount += c; - off = (ranges - 1) * 8; + off = (ranges - 1) * ATA_DSM_RANGE_SIZE; req->data[off + 6] = lastcount & 0xff; req->data[off + 7] = (lastcount >> 8) & 0xff; @@ -1295,8 +1297,8 @@ adastart(struct cam_periph *periph, unio } while (count > 0) { - c = min(count, 0xffff); - off = ranges * 8; + c = min(count, ATA_DSM_RANGE_MAX); + off = ranges * ATA_DSM_RANGE_SIZE; req->data[off + 0] = lba & 0xff; req->data[off + 1] = (lba >> 8) & 0xff; req->data[off + 2] = (lba >> 16) & 0xff; @@ -1309,6 +1311,11 @@ adastart(struct cam_periph *periph, unio count -= c; lastcount = c; ranges++; + /* + * Its the caller's responsibility to ensure the + * request will fit so we don't need to check for + * overrun here + */ } lastlba = lba; req->bps[bps++] = bp1; @@ -1316,7 +1323,8 @@ adastart(struct cam_periph *periph, unio if (bps >= TRIM_MAX_BIOS || bp1 == NULL || bp1->bio_bcount / softc->params.secsize > - (softc->trim_max_ranges - ranges) * 0xffff) + (softc->trim_max_ranges - ranges) * + ATA_DSM_RANGE_MAX) break; } while (1); cam_fill_ataio(ataio, @@ -1325,10 +1333,12 @@ adastart(struct cam_periph *periph, unio CAM_DIR_OUT, 0, req->data, - ((ranges + 63) / 64) * 512, + ((ranges + ATA_DSM_BLK_RANGES - 1) / + ATA_DSM_BLK_RANGES) * ATA_DSM_BLK_SIZE, ada_default_timeout * 1000); ata_48bit_cmd(ataio, ATA_DATA_SET_MANAGEMENT, - ATA_DSM_TRIM, 0, (ranges + 63) / 64); + ATA_DSM_TRIM, 0, (ranges + ATA_DSM_BLK_RANGES - + 1) / ATA_DSM_BLK_RANGES); start_ccb->ccb_h.ccb_state = ADA_CCB_TRIM; goto out; } From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 11:59:39 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C528C660; Thu, 6 Jun 2013 11:59:39 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9E5341C11; Thu, 6 Jun 2013 11:59:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56BxdFo026849; Thu, 6 Jun 2013 11:59:39 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56BxcmN026846; Thu, 6 Jun 2013 11:59:38 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201306061159.r56BxcmN026846@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 6 Jun 2013 11:59:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251468 - in head: gnu/usr.bin/diff gnu/usr.bin/grep usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 11:59:39 -0000 Author: jkim Date: Thu Jun 6 11:59:38 2013 New Revision: 251468 URL: http://svnweb.freebsd.org/changeset/base/251468 Log: Adjust CFLAGS to pick up correct regex.h and posix/regex.h. Note this actually reverts r250860 and r250861. Reported by: gjb, tinderbox Modified: head/gnu/usr.bin/diff/Makefile head/gnu/usr.bin/grep/Makefile head/usr.bin/grep/Makefile Modified: head/gnu/usr.bin/diff/Makefile ============================================================================== --- head/gnu/usr.bin/diff/Makefile Thu Jun 6 11:47:54 2013 (r251467) +++ head/gnu/usr.bin/diff/Makefile Thu Jun 6 11:59:38 2013 (r251468) @@ -17,11 +17,10 @@ CFLAGS+=-funsigned-char CFLAGS+=-DHAVE_CONFIG_H CFLAGS+=-DPR_PROGRAM=\"/usr/bin/pr\" -CFLAGS+=-D__USE_GNU CFLAGS+=-I${.CURDIR}/../../../contrib/diff CFLAGS+=-I${.CURDIR}/../../../contrib/diff/src CFLAGS+=-I${.CURDIR}/../../../contrib/diff/lib -CFLAGS+=-I${.CURDIR}/../../../contrib/libgnuregex +CFLAGS+=-I${DESTDIR}/usr/include/gnu SUBDIR+=doc Modified: head/gnu/usr.bin/grep/Makefile ============================================================================== --- head/gnu/usr.bin/grep/Makefile Thu Jun 6 11:47:54 2013 (r251467) +++ head/gnu/usr.bin/grep/Makefile Thu Jun 6 11:59:38 2013 (r251468) @@ -13,8 +13,7 @@ SRCS= closeout.c dfa.c error.c exclude.c isdir.c kwset.c obstack.c quotearg.c savedir.c search.c xmalloc.c \ xstrtoumax.c -CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../../../contrib/libgnuregex -CFLAGS+=-DHAVE_CONFIG_H -D__USE_GNU +CFLAGS+=-I${.CURDIR} -I${DESTDIR}/usr/include/gnu -DHAVE_CONFIG_H .if ${MK_BSD_GREP} != "yes" LINKS+= ${BINDIR}/grep ${BINDIR}/egrep \ Modified: head/usr.bin/grep/Makefile ============================================================================== --- head/usr.bin/grep/Makefile Thu Jun 6 11:47:54 2013 (r251467) +++ head/usr.bin/grep/Makefile Thu Jun 6 11:59:38 2013 (r251468) @@ -74,7 +74,7 @@ CFLAGS+= -DWITHOUT_BZIP2 .endif .if !defined(WITHOUT_GNU_COMPAT) -CFLAGS+= -I/usr/include/gnu +CFLAGS+= -I${DESTDIR}/usr/include/gnu LDADD+= -lgnuregex DPADD+= ${LIBGNUREGEX} .endif From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 12:42:51 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 95F176D7; Thu, 6 Jun 2013 12:42:51 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay004.isp.belgacom.be (mailrelay004.isp.belgacom.be [195.238.6.170]) by mx1.freebsd.org (Postfix) with ESMTP id 979F21EFB; Thu, 6 Jun 2013 12:42:50 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Al8GAPaCsFFbsJH7/2dsb2JhbABZgwkwv0V3F3SCIwEBBVYjEAsUBAkWBAsJAwIBAgEnDREGDQEFAgEBiA0IuyCOfzMHg1sDmGiQF4FYgTk6 Received: from 251.145-176-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.176.145.251]) by relay.skynet.be with ESMTP; 06 Jun 2013 14:42:42 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.7/8.14.7) with ESMTP id r56CgfcE002768; Thu, 6 Jun 2013 14:42:41 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Message-ID: <51B083C0.7020001@FreeBSD.org> Date: Thu, 06 Jun 2013 14:42:40 +0200 From: Tijl Coosemans User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130517 Thunderbird/17.0.6 MIME-Version: 1.0 To: Marcel Moolenaar Subject: Re: svn commit: r250991 - in head: contrib/jemalloc/include/jemalloc include lib/libc/stdlib/jemalloc References: <201305251859.r4PIxChc053341@svn.freebsd.org> <51AC9933.7050201@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 12:42:51 -0000 On 2013-06-03 16:50, Marcel Moolenaar wrote: > > On Jun 3, 2013, at 6:25 AM, Dimitry Andric wrote: > >> On 2013-05-25 20:59, Marcel Moolenaar wrote: >>> Author: marcel >>> Date: Sat May 25 18:59:11 2013 >>> New Revision: 250991 >>> URL: http://svnweb.freebsd.org/changeset/base/250991 >>> >>> Log: >>> Make the malloc(3) family of functions weak and make their non-weak >>> implementations visible for use by applications. The functions $F that >>> are now weak symbols are: >>> allocm, calloc, dallocm, free, malloc, malloc_usable_size, >>> nallocm, posix_memalign, rallocm, realloc, sallocm >>> >>> The non-weak implementations of $F are exported as __$F. >> >> Hi Marcel, >> >> This commit seems to lead to various problems in ports, and possibly >> other software. For example, with Firefox I now always get a few >> messages like: >> >> firefox in free(): warning: malloc() has never been called >> >> Another example is the devel/talloc port, which now dies with: > > It looks like the python build is broken. The net effect is that _ctypes.so > has a strong definition of malloc, free, et al. This is not intentional, > but a side-effect of the what seems to be a bug in fficonfig.py.in (see > patch below). To elaborate: > > _ctypes.so incorporates the libffi functionality for what I presume is > the basis for Python bindings. libffi includes dlmalloc.c, an open source > allocator. dlmalloc.c is incuded by closures.c and closures.c defines > USE_DL_PREFIX. On top of that closures.c makes all allocator functions > static. This, by design there's no problem. In short: dlmalloc.c never > gets compiler separately/independently. > > The python build however compiles dlmalloc.c separately/independently. > As such, dlmalloc.c now defines and exports malloc et al and it also > get linked into _ctypes.so. > > Once _ctypes.so gets dynamically loaded, things start to break. > > Unfortunately, this means python needs to be recompiled from ports with > the following fix: > > Index: files/patch-Modules-_ctypes-libffi-fficonfig.py.in > =================================================================== > --- files/patch-Modules-_ctypes-libffi-fficonfig.py.in (revision 0) > +++ files/patch-Modules-_ctypes-libffi-fficonfig.py.in (working copy) > @@ -0,0 +1,10 @@ > +--- Modules/_ctypes/libffi/fficonfig.py.in.orig 2013-06-03 07:16:44.000000000 -0700 > ++++ Modules/_ctypes/libffi/fficonfig.py.in 2013-06-03 07:17:03.000000000 -0700 > +@@ -1,7 +1,6 @@ > + ffi_sources = """ > + src/prep_cif.c > + src/closures.c > +-src/dlmalloc.c > + """.split() > + > + ffi_platforms = { > > This has been tested with python-2.7.5. I can't say anything about > other versions. > > Do people concur that this is the right fix? Maybe you should send this patch to python@. They should know if it's the right fix. It worked for me anyway. From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 13:47:37 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3886C240; Thu, 6 Jun 2013 13:47:37 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 28F0E1294; Thu, 6 Jun 2013 13:47:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56DlbUR062968; Thu, 6 Jun 2013 13:47:37 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56Dlb7B062967; Thu, 6 Jun 2013 13:47:37 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201306061347.r56Dlb7B062967@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Thu, 6 Jun 2013 13:47:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251469 - stable/9/usr.sbin/rtadvd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 13:47:37 -0000 Author: des Date: Thu Jun 6 13:47:36 2013 New Revision: 251469 URL: http://svnweb.freebsd.org/changeset/base/251469 Log: MFH (r247863): fix occasional SIGSEGV when an interface was added. Modified: stable/9/usr.sbin/rtadvd/rtadvd.c Directory Properties: stable/9/usr.sbin/rtadvd/ (props changed) Modified: stable/9/usr.sbin/rtadvd/rtadvd.c ============================================================================== --- stable/9/usr.sbin/rtadvd/rtadvd.c Thu Jun 6 11:59:38 2013 (r251468) +++ stable/9/usr.sbin/rtadvd/rtadvd.c Thu Jun 6 13:47:36 2013 (r251469) @@ -1008,6 +1008,8 @@ set_short_delay(struct ifinfo *ifi) long delay; /* must not be greater than 1000000 */ struct timeval interval, now, min_delay, tm_tmp, *rest; + if (ifi->ifi_ra_timer == NULL) + return; /* * Compute a random delay. If the computed value * corresponds to a time later than the time the next From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 14:43:19 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AEACAA5F; Thu, 6 Jun 2013 14:43:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 877CE17A0; Thu, 6 Jun 2013 14:43:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56EhJV2081412; Thu, 6 Jun 2013 14:43:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56EhJoc081411; Thu, 6 Jun 2013 14:43:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306061443.r56EhJoc081411@svn.freebsd.org> From: John Baldwin Date: Thu, 6 Jun 2013 14:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251470 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 14:43:19 -0000 Author: jhb Date: Thu Jun 6 14:43:19 2013 New Revision: 251470 URL: http://svnweb.freebsd.org/changeset/base/251470 Log: Do not compare the existing mask of a cpuset with a new mask when changing the mask of a cpuset. Also, change the cpuset's mask before updating the masks of all children. Previously changing a cpuset's mask first required setting the mask to a super-set of both the old and new masks and then changing it a second time to the new mask. Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Thu Jun 6 13:47:36 2013 (r251469) +++ head/sys/kern/kern_cpuset.c Thu Jun 6 14:43:19 2013 (r251470) @@ -303,7 +303,7 @@ cpuset_create(struct cpuset **setp, stru * empty as well as RDONLY flags. */ static int -cpuset_testupdate(struct cpuset *set, cpuset_t *mask) +cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int check_mask) { struct cpuset *nset; cpuset_t newmask; @@ -312,13 +312,16 @@ cpuset_testupdate(struct cpuset *set, cp mtx_assert(&cpuset_lock, MA_OWNED); if (set->cs_flags & CPU_SET_RDONLY) return (EPERM); - if (!CPU_OVERLAP(&set->cs_mask, mask)) - return (EDEADLK); - CPU_COPY(&set->cs_mask, &newmask); - CPU_AND(&newmask, mask); + if (check_mask) { + if (!CPU_OVERLAP(&set->cs_mask, mask)) + return (EDEADLK); + CPU_COPY(&set->cs_mask, &newmask); + CPU_AND(&newmask, mask); + } else + CPU_COPY(mask, &newmask); error = 0; LIST_FOREACH(nset, &set->cs_children, cs_siblings) - if ((error = cpuset_testupdate(nset, &newmask)) != 0) + if ((error = cpuset_testupdate(nset, &newmask, 1)) != 0) break; return (error); } @@ -370,11 +373,11 @@ cpuset_modify(struct cpuset *set, cpuset if (root && !CPU_SUBSET(&root->cs_mask, mask)) return (EINVAL); mtx_lock_spin(&cpuset_lock); - error = cpuset_testupdate(set, mask); + error = cpuset_testupdate(set, mask, 0); if (error) goto out; - cpuset_update(set, mask); CPU_COPY(mask, &set->cs_mask); + cpuset_update(set, mask); out: mtx_unlock_spin(&cpuset_lock); From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 14:49:05 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 38F9AD4A; Thu, 6 Jun 2013 14:49:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 175E617E6; Thu, 6 Jun 2013 14:49:05 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 1B639B993; Thu, 6 Jun 2013 10:49:02 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Subject: Re: svn commit: r251470 - head/sys/kern Date: Thu, 6 Jun 2013 10:46:33 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <201306061443.r56EhJoc081411@svn.freebsd.org> In-Reply-To: <201306061443.r56EhJoc081411@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201306061046.33438.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 06 Jun 2013 10:49:02 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 14:49:05 -0000 On Thursday, June 06, 2013 10:43:19 am John Baldwin wrote: > Author: jhb > Date: Thu Jun 6 14:43:19 2013 > New Revision: 251470 > URL: http://svnweb.freebsd.org/changeset/base/251470 > > Log: > Do not compare the existing mask of a cpuset with a new mask when changing > the mask of a cpuset. Also, change the cpuset's mask before updating the > masks of all children. Previously changing a cpuset's mask first required > setting the mask to a super-set of both the old and new masks and then > changing it a second time to the new mask. Oof, meant to add: Reviewed by: davidxu MFC after: 1 week -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 18:19:00 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5C1FCFE6; Thu, 6 Jun 2013 18:19:00 +0000 (UTC) (envelope-from tuexen@fh-muenster.de) Received: from mail-n.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) by mx1.freebsd.org (Postfix) with ESMTP id E2D1A10C0; Thu, 6 Jun 2013 18:18:59 +0000 (UTC) Received: from [192.168.1.200] (p508F2BEC.dip0.t-ipconnect.de [80.143.43.236]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTP id D398F1C0C0693; Thu, 6 Jun 2013 20:18:55 +0200 (CEST) Subject: Re: svn commit: r251438 - in head/gnu: lib/libregex lib/libregex/posix usr.bin/diff usr.bin/grep Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: Michael Tuexen In-Reply-To: <20130606105058.GI64948@glenbarber.us> Date: Thu, 6 Jun 2013 20:18:54 +0200 Content-Transfer-Encoding: 7bit Message-Id: <89C1FBF4-C82A-48C4-95B4-C28C2C5D9EA8@fh-muenster.de> References: <201306052131.r55LV6t8052710@svn.freebsd.org> <20130606032752.GR1716@glenbarber.us> <20130606105058.GI64948@glenbarber.us> To: Glen Barber X-Mailer: Apple Mail (2.1283) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jung-uk Kim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 18:19:00 -0000 On Jun 6, 2013, at 12:50 PM, Glen Barber wrote: > On Wed, Jun 05, 2013 at 11:27:52PM -0400, Glen Barber wrote: >> On Wed, Jun 05, 2013 at 09:31:06PM +0000, Jung-uk Kim wrote: >>> Author: jkim >>> Date: Wed Jun 5 21:31:06 2013 >>> New Revision: 251438 >>> URL: http://svnweb.freebsd.org/changeset/base/251438 >>> >>> Log: >>> Connect libgnuregex 2.17 to the build. >>> >> >> I think this breaks the build. I am seeing the following: >> >> /usr/obj/usr/src/tmp/usr/include/gnu/posix/regex.h:369:3: error: >> declaration does not declare anything [-Werror,-Wmissing-declarations] >> unsigned long int __REPB_PREFIX(used); >> ^~~~~~~~~~~~~~~~~ >> > > I think this is a local problem. Sorry for the noise. I do see the same problem when cross building for ARM. How did you fix it? Best regards Michael > > Glen > From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 18:19:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 86D031E3; Thu, 6 Jun 2013 18:19:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5F6A710C6; Thu, 6 Jun 2013 18:19:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56IJR2W048906; Thu, 6 Jun 2013 18:19:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56IJRm1048904; Thu, 6 Jun 2013 18:19:27 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201306061819.r56IJRm1048904@svn.freebsd.org> From: Attilio Rao Date: Thu, 6 Jun 2013 18:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251471 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 18:19:27 -0000 Author: attilio Date: Thu Jun 6 18:19:26 2013 New Revision: 251471 URL: http://svnweb.freebsd.org/changeset/base/251471 Log: Complete r251452: Avoid to busy/unbusy a page in cases where there is no need to drop the vm_obj lock, more nominally when the page is full valid after vm_page_grab(). Sponsored by: EMC / Isilon storage division Reviewed by: alc Modified: head/sys/vm/swap_pager.c head/sys/vm/vm_glue.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Thu Jun 6 14:43:19 2013 (r251470) +++ head/sys/vm/swap_pager.c Thu Jun 6 18:19:26 2013 (r251471) @@ -1706,18 +1706,19 @@ swp_pager_force_pagein(vm_object_t objec vm_page_t m; vm_object_pip_add(object, 1); - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL|VM_ALLOC_RETRY); + m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY | + VM_ALLOC_NOBUSY); if (m->valid == VM_PAGE_BITS_ALL) { vm_object_pip_subtract(object, 1); vm_page_dirty(m); vm_page_lock(m); vm_page_activate(m); vm_page_unlock(m); - vm_page_wakeup(m); vm_pager_page_unswapped(m); return; } + vm_page_busy(m); if (swap_pager_getpages(object, &m, 1, 0) != VM_PAGER_OK) panic("swap_pager_force_pagein: read from swap failed");/*XXX*/ vm_object_pip_subtract(object, 1); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Thu Jun 6 14:43:19 2013 (r251470) +++ head/sys/vm/vm_glue.c Thu Jun 6 18:19:26 2013 (r251471) @@ -241,8 +241,10 @@ vm_imgact_hold_page(vm_object_t object, VM_OBJECT_WLOCK(object); pindex = OFF_TO_IDX(offset); - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY | + VM_ALLOC_NOBUSY); if (m->valid != VM_PAGE_BITS_ALL) { + vm_page_busy(m); ma[0] = m; rv = vm_pager_get_pages(object, ma, 1, 0); m = vm_page_lookup(object, pindex); @@ -255,11 +257,11 @@ vm_imgact_hold_page(vm_object_t object, m = NULL; goto out; } + vm_page_wakeup(m); } vm_page_lock(m); vm_page_hold(m); vm_page_unlock(m); - vm_page_wakeup(m); out: VM_OBJECT_WUNLOCK(object); return (m); From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 18:30:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C10974FD; Thu, 6 Jun 2013 18:30:16 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by mx1.freebsd.org (Postfix) with ESMTP id 854D11112; Thu, 6 Jun 2013 18:30:16 +0000 (UTC) Received: by mail-pd0-f170.google.com with SMTP id x10so3723130pdj.15 for ; Thu, 06 Jun 2013 11:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=DzwYdXqTIR21SDdIjkhL5+2DIpelP5SW1WKRi78lpFw=; b=S++JSIzf3/vLvgdV0D+NcyT0eCzhJOjUYZ4CKHIP5z/m8TW2kyXk7Gh8BViMfOHZMh yug5NJfKp8EBntuULfDqZ0yXqyJ6qrq7BpEU4/ZbfPUEFUUb0GFc6wTXAHXBwzWi6iaq noADPVV05aaaQ18yENLzOlsgG0SKMcSiE05W+tOyqJIZvFbns1Jp+9IodTr3mEicrHmN ellsMumqArACy5utu/qFirWgL6FqT+2tdA6zNs2jBkuH2MnV9k9vKPFkl33LfRaYVSWp /lL1rR8z+9KkU72As9Y6rKAksv5H78m9YsJbhqxXEAdwRAqcvDqffaTCGQkXlB82bqpq BeGg== X-Received: by 10.66.121.108 with SMTP id lj12mr14373863pab.52.1370543410413; Thu, 06 Jun 2013 11:30:10 -0700 (PDT) Received: from [192.168.20.5] (c-98-203-241-95.hsd1.wa.comcast.net. [98.203.241.95]) by mx.google.com with ESMTPSA id yj2sm73818329pbb.40.2013.06.06.11.30.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Jun 2013 11:30:09 -0700 (PDT) Subject: Re: svn commit: r251438 - in head/gnu: lib/libregex lib/libregex/posix usr.bin/diff usr.bin/grep Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: Garrett Cooper In-Reply-To: <89C1FBF4-C82A-48C4-95B4-C28C2C5D9EA8@fh-muenster.de> Date: Thu, 6 Jun 2013 11:30:06 -0700 Content-Transfer-Encoding: 7bit Message-Id: <1188506E-8955-49F1-BC25-F6873C9472CC@gmail.com> References: <201306052131.r55LV6t8052710@svn.freebsd.org> <20130606032752.GR1716@glenbarber.us> <20130606105058.GI64948@glenbarber.us> <89C1FBF4-C82A-48C4-95B4-C28C2C5D9EA8@fh-muenster.de> To: Michael Tuexen X-Mailer: Apple Mail (2.1283) Cc: svn-src-head@freebsd.org, Glen Barber , svn-src-all@freebsd.org, src-committers@freebsd.org, Jung-uk Kim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 18:30:16 -0000 On Jun 6, 2013, at 11:18 AM, Michael Tuexen wrote: > On Jun 6, 2013, at 12:50 PM, Glen Barber wrote: > >> On Wed, Jun 05, 2013 at 11:27:52PM -0400, Glen Barber wrote: >>> On Wed, Jun 05, 2013 at 09:31:06PM +0000, Jung-uk Kim wrote: >>>> Author: jkim >>>> Date: Wed Jun 5 21:31:06 2013 >>>> New Revision: 251438 >>>> URL: http://svnweb.freebsd.org/changeset/base/251438 >>>> >>>> Log: >>>> Connect libgnuregex 2.17 to the build. >>>> >>> >>> I think this breaks the build. I am seeing the following: >>> >>> /usr/obj/usr/src/tmp/usr/include/gnu/posix/regex.h:369:3: error: >>> declaration does not declare anything [-Werror,-Wmissing-declarations] >>> unsigned long int __REPB_PREFIX(used); >>> ^~~~~~~~~~~~~~~~~ >>> >> >> I think this is a local problem. Sorry for the noise. > I do see the same problem when cross building for ARM. How did you fix it? See r251468. From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 18:32:15 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4E323830; Thu, 6 Jun 2013 18:32:15 +0000 (UTC) (envelope-from tuexen@fh-muenster.de) Received: from mail-n.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) by mx1.freebsd.org (Postfix) with ESMTP id D39771132; Thu, 6 Jun 2013 18:32:14 +0000 (UTC) Received: from [192.168.1.200] (p508F2BEC.dip0.t-ipconnect.de [80.143.43.236]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTP id 5A37B1C0C0693; Thu, 6 Jun 2013 20:32:03 +0200 (CEST) Subject: Re: svn commit: r251438 - in head/gnu: lib/libregex lib/libregex/posix usr.bin/diff usr.bin/grep Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: Michael Tuexen In-Reply-To: <1188506E-8955-49F1-BC25-F6873C9472CC@gmail.com> Date: Thu, 6 Jun 2013 20:32:02 +0200 Content-Transfer-Encoding: 7bit Message-Id: <8B469A8D-F9BD-4FDE-BC1D-98147C6334D0@fh-muenster.de> References: <201306052131.r55LV6t8052710@svn.freebsd.org> <20130606032752.GR1716@glenbarber.us> <20130606105058.GI64948@glenbarber.us> <89C1FBF4-C82A-48C4-95B4-C28C2C5D9EA8@fh-muenster.de> <1188506E-8955-49F1-BC25-F6873C9472CC@gmail.com> To: Garrett Cooper X-Mailer: Apple Mail (2.1283) Cc: svn-src-head@freebsd.org, Glen Barber , svn-src-all@freebsd.org, src-committers@freebsd.org, Jung-uk Kim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 18:32:15 -0000 On Jun 6, 2013, at 8:30 PM, Garrett Cooper wrote: > On Jun 6, 2013, at 11:18 AM, Michael Tuexen wrote: > >> On Jun 6, 2013, at 12:50 PM, Glen Barber wrote: >> >>> On Wed, Jun 05, 2013 at 11:27:52PM -0400, Glen Barber wrote: >>>> On Wed, Jun 05, 2013 at 09:31:06PM +0000, Jung-uk Kim wrote: >>>>> Author: jkim >>>>> Date: Wed Jun 5 21:31:06 2013 >>>>> New Revision: 251438 >>>>> URL: http://svnweb.freebsd.org/changeset/base/251438 >>>>> >>>>> Log: >>>>> Connect libgnuregex 2.17 to the build. >>>>> >>>> >>>> I think this breaks the build. I am seeing the following: >>>> >>>> /usr/obj/usr/src/tmp/usr/include/gnu/posix/regex.h:369:3: error: >>>> declaration does not declare anything [-Werror,-Wmissing-declarations] >>>> unsigned long int __REPB_PREFIX(used); >>>> ^~~~~~~~~~~~~~~~~ >>>> >>> >>> I think this is a local problem. Sorry for the noise. >> I do see the same problem when cross building for ARM. How did you fix it? > > See r251468. > Thanks! Best regards Michael From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 20:14:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9E29CB3A; Thu, 6 Jun 2013 20:14:42 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8E16011A8; Thu, 6 Jun 2013 20:14:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56KEggl086116; Thu, 6 Jun 2013 20:14:42 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56KEf0N086108; Thu, 6 Jun 2013 20:14:41 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306062014.r56KEf0N086108@svn.freebsd.org> From: Xin LI Date: Thu, 6 Jun 2013 20:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r251474 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 20:14:42 -0000 Author: delphij Date: Thu Jun 6 20:14:40 2013 New Revision: 251474 URL: http://svnweb.freebsd.org/changeset/base/251474 Log: Update vendor-sys/illumos/dist to illumos-gate 14039:6cfd5a5778b9 Illumos ZFS issues: 3137 L2ARC compression Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Thu Jun 6 18:30:33 2013 (r251473) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Thu Jun 6 20:14:40 2013 (r251474) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* @@ -120,6 +121,7 @@ #include #include +#include #include #include #include @@ -289,7 +291,11 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_cksum_bad; kstat_named_t arcstat_l2_io_error; kstat_named_t arcstat_l2_size; + kstat_named_t arcstat_l2_asize; kstat_named_t arcstat_l2_hdr_size; + kstat_named_t arcstat_l2_compress_successes; + kstat_named_t arcstat_l2_compress_zeros; + kstat_named_t arcstat_l2_compress_failures; kstat_named_t arcstat_memory_throttle_count; kstat_named_t arcstat_duplicate_buffers; kstat_named_t arcstat_duplicate_buffers_size; @@ -351,7 +357,11 @@ static arc_stats_t arc_stats = { { "l2_cksum_bad", KSTAT_DATA_UINT64 }, { "l2_io_error", KSTAT_DATA_UINT64 }, { "l2_size", KSTAT_DATA_UINT64 }, + { "l2_asize", KSTAT_DATA_UINT64 }, { "l2_hdr_size", KSTAT_DATA_UINT64 }, + { "l2_compress_successes", KSTAT_DATA_UINT64 }, + { "l2_compress_zeros", KSTAT_DATA_UINT64 }, + { "l2_compress_failures", KSTAT_DATA_UINT64 }, { "memory_throttle_count", KSTAT_DATA_UINT64 }, { "duplicate_buffers", KSTAT_DATA_UINT64 }, { "duplicate_buffers_size", KSTAT_DATA_UINT64 }, @@ -424,6 +434,9 @@ static arc_state_t *arc_l2c_only; #define arc_meta_used ARCSTAT(arcstat_meta_used) /* size of metadata */ #define arc_meta_max ARCSTAT(arcstat_meta_max) /* max size of metadata */ +#define L2ARC_IS_VALID_COMPRESS(_c_) \ + ((_c_) == ZIO_COMPRESS_LZ4 || (_c_) == ZIO_COMPRESS_EMPTY) + static int arc_no_grow; /* Don't try to grow cache size */ static uint64_t arc_tempreserve; static uint64_t arc_loaned_bytes; @@ -577,7 +590,12 @@ uint64_t zfs_crc64_table[256]; */ #define L2ARC_WRITE_SIZE (8 * 1024 * 1024) /* initial write max */ -#define L2ARC_HEADROOM 2 /* num of writes */ +#define L2ARC_HEADROOM 2 /* num of writes */ +/* + * If we discover during ARC scan any buffers to be compressed, we boost + * our headroom for the next scanning cycle by this percentage multiple. + */ +#define L2ARC_HEADROOM_BOOST 200 #define L2ARC_FEED_SECS 1 /* caching interval secs */ #define L2ARC_FEED_MIN_MS 200 /* min caching interval ms */ @@ -590,6 +608,7 @@ uint64_t zfs_crc64_table[256]; uint64_t l2arc_write_max = L2ARC_WRITE_SIZE; /* default max write size */ uint64_t l2arc_write_boost = L2ARC_WRITE_SIZE; /* extra write during warmup */ uint64_t l2arc_headroom = L2ARC_HEADROOM; /* number of dev writes */ +uint64_t l2arc_headroom_boost = L2ARC_HEADROOM_BOOST; uint64_t l2arc_feed_secs = L2ARC_FEED_SECS; /* interval seconds */ uint64_t l2arc_feed_min_ms = L2ARC_FEED_MIN_MS; /* min interval milliseconds */ boolean_t l2arc_noprefetch = B_TRUE; /* don't cache prefetch bufs */ @@ -603,8 +622,6 @@ typedef struct l2arc_dev { vdev_t *l2ad_vdev; /* vdev */ spa_t *l2ad_spa; /* spa */ uint64_t l2ad_hand; /* next write location */ - uint64_t l2ad_write; /* desired write size, bytes */ - uint64_t l2ad_boost; /* warmup write boost, bytes */ uint64_t l2ad_start; /* first addr on device */ uint64_t l2ad_end; /* last addr on device */ uint64_t l2ad_evict; /* last addr eviction reached */ @@ -625,11 +642,12 @@ static kmutex_t l2arc_free_on_write_mtx; static uint64_t l2arc_ndev; /* number of devices */ typedef struct l2arc_read_callback { - arc_buf_t *l2rcb_buf; /* read buffer */ - spa_t *l2rcb_spa; /* spa */ - blkptr_t l2rcb_bp; /* original blkptr */ - zbookmark_t l2rcb_zb; /* original bookmark */ - int l2rcb_flags; /* original flags */ + arc_buf_t *l2rcb_buf; /* read buffer */ + spa_t *l2rcb_spa; /* spa */ + blkptr_t l2rcb_bp; /* original blkptr */ + zbookmark_t l2rcb_zb; /* original bookmark */ + int l2rcb_flags; /* original flags */ + enum zio_compress l2rcb_compress; /* applied compress */ } l2arc_read_callback_t; typedef struct l2arc_write_callback { @@ -639,8 +657,14 @@ typedef struct l2arc_write_callback { struct l2arc_buf_hdr { /* protected by arc_buf_hdr mutex */ - l2arc_dev_t *b_dev; /* L2ARC device */ - uint64_t b_daddr; /* disk address, offset byte */ + l2arc_dev_t *b_dev; /* L2ARC device */ + uint64_t b_daddr; /* disk address, offset byte */ + /* compression applied to buffer data */ + enum zio_compress b_compress; + /* real alloc'd buffer size depending on b_compress applied */ + int b_asize; + /* temporary buffer holder for in-flight compressed data */ + void *b_tmp_cdata; }; typedef struct l2arc_data_free { @@ -659,6 +683,11 @@ static void l2arc_read_done(zio_t *zio); static void l2arc_hdr_stat_add(void); static void l2arc_hdr_stat_remove(void); +static boolean_t l2arc_compress_buf(l2arc_buf_hdr_t *l2hdr); +static void l2arc_decompress_zio(zio_t *zio, arc_buf_hdr_t *hdr, + enum zio_compress c); +static void l2arc_release_cdata_buf(arc_buf_hdr_t *ab); + static uint64_t buf_hash(uint64_t spa, const dva_t *dva, uint64_t birth) { @@ -1539,6 +1568,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) if (l2hdr != NULL) { list_remove(l2hdr->b_dev->l2ad_buflist, hdr); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); + ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); if (hdr->b_state == arc_l2c_only) l2arc_hdr_stat_remove(); @@ -2860,6 +2890,8 @@ top: arc_access(hdr, hash_lock); if (*arc_flags & ARC_L2CACHE) hdr->b_flags |= ARC_L2CACHE; + if (*arc_flags & ARC_L2COMPRESS) + hdr->b_flags |= ARC_L2COMPRESS; mutex_exit(hash_lock); ARCSTAT_BUMP(arcstat_hits); ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH), @@ -2900,6 +2932,8 @@ top: } if (*arc_flags & ARC_L2CACHE) hdr->b_flags |= ARC_L2CACHE; + if (*arc_flags & ARC_L2COMPRESS) + hdr->b_flags |= ARC_L2COMPRESS; if (BP_GET_LEVEL(bp) > 0) hdr->b_flags |= ARC_INDIRECT; } else { @@ -2916,6 +2950,8 @@ top: add_reference(hdr, hash_lock, private); if (*arc_flags & ARC_L2CACHE) hdr->b_flags |= ARC_L2CACHE; + if (*arc_flags & ARC_L2COMPRESS) + hdr->b_flags |= ARC_L2COMPRESS; buf = kmem_cache_alloc(buf_cache, KM_PUSHPAGE); buf->b_hdr = hdr; buf->b_data = NULL; @@ -2986,6 +3022,7 @@ top: cb->l2rcb_bp = *bp; cb->l2rcb_zb = *zb; cb->l2rcb_flags = zio_flags; + cb->l2rcb_compress = hdr->b_l2hdr->b_compress; ASSERT(addr >= VDEV_LABEL_START_SIZE && addr + size < vd->vdev_psize - @@ -2994,16 +3031,31 @@ top: /* * l2arc read. The SCL_L2ARC lock will be * released by l2arc_read_done(). + * Issue a null zio if the underlying buffer + * was squashed to zero size by compression. */ - rzio = zio_read_phys(pio, vd, addr, size, - buf->b_data, ZIO_CHECKSUM_OFF, - l2arc_read_done, cb, priority, zio_flags | - ZIO_FLAG_DONT_CACHE | ZIO_FLAG_CANFAIL | - ZIO_FLAG_DONT_PROPAGATE | - ZIO_FLAG_DONT_RETRY, B_FALSE); + if (hdr->b_l2hdr->b_compress == + ZIO_COMPRESS_EMPTY) { + rzio = zio_null(pio, spa, vd, + l2arc_read_done, cb, + zio_flags | ZIO_FLAG_DONT_CACHE | + ZIO_FLAG_CANFAIL | + ZIO_FLAG_DONT_PROPAGATE | + ZIO_FLAG_DONT_RETRY); + } else { + rzio = zio_read_phys(pio, vd, addr, + hdr->b_l2hdr->b_asize, + buf->b_data, ZIO_CHECKSUM_OFF, + l2arc_read_done, cb, priority, + zio_flags | ZIO_FLAG_DONT_CACHE | + ZIO_FLAG_CANFAIL | + ZIO_FLAG_DONT_PROPAGATE | + ZIO_FLAG_DONT_RETRY, B_FALSE); + } DTRACE_PROBE2(l2arc__read, vdev_t *, vd, zio_t *, rzio); - ARCSTAT_INCR(arcstat_l2_read_bytes, size); + ARCSTAT_INCR(arcstat_l2_read_bytes, + hdr->b_l2hdr->b_asize); if (*arc_flags & ARC_NOWAIT) { zio_nowait(rzio); @@ -3264,6 +3316,7 @@ arc_release(arc_buf_t *buf, void *tag) buf->b_private = NULL; if (l2hdr) { + ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -buf_size); @@ -3413,9 +3466,9 @@ arc_write_done(zio_t *zio) zio_t * arc_write(zio_t *pio, spa_t *spa, uint64_t txg, - blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp, - arc_done_func_t *ready, arc_done_func_t *done, void *private, - int priority, int zio_flags, const zbookmark_t *zb) + blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, + const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *done, + void *private, int priority, int zio_flags, const zbookmark_t *zb) { arc_buf_hdr_t *hdr = buf->b_hdr; arc_write_callback_t *callback; @@ -3428,6 +3481,8 @@ arc_write(zio_t *pio, spa_t *spa, uint64 ASSERT(hdr->b_acb == NULL); if (l2arc) hdr->b_flags |= ARC_L2CACHE; + if (l2arc_compress) + hdr->b_flags |= ARC_L2COMPRESS; callback = kmem_zalloc(sizeof (arc_write_callback_t), KM_SLEEP); callback->awcb_ready = ready; callback->awcb_done = done; @@ -3789,8 +3844,12 @@ arc_fini(void) * 2. The L2ARC attempts to cache data from the ARC before it is evicted. * It does this by periodically scanning buffers from the eviction-end of * the MFU and MRU ARC lists, copying them to the L2ARC devices if they are - * not already there. It scans until a headroom of buffers is satisfied, - * which itself is a buffer for ARC eviction. The thread that does this is + * not already there. It scans until a headroom of buffers is satisfied, + * which itself is a buffer for ARC eviction. If a compressible buffer is + * found during scanning and selected for writing to an L2ARC device, we + * temporarily boost scanning headroom during the next scan cycle to make + * sure we adapt to compression effects (which might significantly reduce + * the data volume we write to L2ARC). The thread that does this is * l2arc_feed_thread(), illustrated below; example sizes are included to * provide a better sense of ratio than this diagram: * @@ -3855,6 +3914,11 @@ arc_fini(void) * l2arc_write_boost extra write bytes during device warmup * l2arc_noprefetch skip caching prefetched buffers * l2arc_headroom number of max device writes to precache + * l2arc_headroom_boost when we find compressed buffers during ARC + * scanning, we multiply headroom by this + * percentage factor for the next scan cycle, + * since more compressed buffers are likely to + * be present * l2arc_feed_secs seconds between L2ARC writing * * Tunables may be removed or added as future performance improvements are @@ -3888,14 +3952,24 @@ l2arc_write_eligible(uint64_t spa_guid, } static uint64_t -l2arc_write_size(l2arc_dev_t *dev) +l2arc_write_size(void) { uint64_t size; - size = dev->l2ad_write; + /* + * Make sure our globals have meaningful values in case the user + * altered them. + */ + size = l2arc_write_max; + if (size == 0) { + cmn_err(CE_NOTE, "Bad value for l2arc_write_max, value must " + "be greater than zero, resetting it to the default (%d)", + L2ARC_WRITE_SIZE); + size = l2arc_write_max = L2ARC_WRITE_SIZE; + } if (arc_warm == B_FALSE) - size += dev->l2ad_boost; + size += l2arc_write_boost; return (size); @@ -4069,12 +4143,20 @@ l2arc_write_done(zio_t *zio) continue; } + abl2 = ab->b_l2hdr; + + /* + * Release the temporary compressed buffer as soon as possible. + */ + if (abl2->b_compress != ZIO_COMPRESS_OFF) + l2arc_release_cdata_buf(ab); + if (zio->io_error != 0) { /* * Error - drop L2ARC entry. */ list_remove(buflist, ab); - abl2 = ab->b_l2hdr; + ARCSTAT_INCR(arcstat_l2_asize, -abl2->b_asize); ab->b_l2hdr = NULL; kmem_free(abl2, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -ab->b_size); @@ -4127,6 +4209,13 @@ l2arc_read_done(zio_t *zio) ASSERT3P(hash_lock, ==, HDR_LOCK(hdr)); /* + * If the buffer was compressed, decompress it first. + */ + if (cb->l2rcb_compress != ZIO_COMPRESS_OFF) + l2arc_decompress_zio(zio, hdr, cb->l2rcb_compress); + ASSERT(zio->io_data != NULL); + + /* * Check this survived the L2ARC journey. */ equal = arc_cksum_equal(buf); @@ -4321,6 +4410,7 @@ top: */ if (ab->b_l2hdr != NULL) { abl2 = ab->b_l2hdr; + ARCSTAT_INCR(arcstat_l2_asize, -abl2->b_asize); ab->b_l2hdr = NULL; kmem_free(abl2, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -ab->b_size); @@ -4346,36 +4436,53 @@ top: * * An ARC_L2_WRITING flag is set so that the L2ARC buffers are not valid * for reading until they have completed writing. + * The headroom_boost is an in-out parameter used to maintain headroom boost + * state between calls to this function. + * + * Returns the number of bytes actually written (which may be smaller than + * the delta by which the device hand has changed due to alignment). */ static uint64_t -l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) +l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz, + boolean_t *headroom_boost) { arc_buf_hdr_t *ab, *ab_prev, *head; - l2arc_buf_hdr_t *hdrl2; list_t *list; - uint64_t passed_sz, write_sz, buf_sz, headroom; + uint64_t write_asize, write_psize, write_sz, headroom, + buf_compress_minsz; void *buf_data; - kmutex_t *hash_lock, *list_lock; - boolean_t have_lock, full; + kmutex_t *list_lock; + boolean_t full; l2arc_write_callback_t *cb; zio_t *pio, *wzio; uint64_t guid = spa_load_guid(spa); + const boolean_t do_headroom_boost = *headroom_boost; ASSERT(dev->l2ad_vdev != NULL); + /* Lower the flag now, we might want to raise it again later. */ + *headroom_boost = B_FALSE; + pio = NULL; - write_sz = 0; + write_sz = write_asize = write_psize = 0; full = B_FALSE; head = kmem_cache_alloc(hdr_cache, KM_PUSHPAGE); head->b_flags |= ARC_L2_WRITE_HEAD; /* + * We will want to try to compress buffers that are at least 2x the + * device sector size. + */ + buf_compress_minsz = 2 << dev->l2ad_vdev->vdev_ashift; + + /* * Copy buffers for L2ARC writing. */ mutex_enter(&l2arc_buflist_mtx); for (int try = 0; try <= 3; try++) { + uint64_t passed_sz = 0; + list = l2arc_list_locked(try, &list_lock); - passed_sz = 0; /* * L2ARC fast warmup. @@ -4383,21 +4490,27 @@ l2arc_write_buffers(spa_t *spa, l2arc_de * Until the ARC is warm and starts to evict, read from the * head of the ARC lists rather than the tail. */ - headroom = target_sz * l2arc_headroom; if (arc_warm == B_FALSE) ab = list_head(list); else ab = list_tail(list); + headroom = target_sz * l2arc_headroom; + if (do_headroom_boost) + headroom = (headroom * l2arc_headroom_boost) / 100; + for (; ab; ab = ab_prev) { + l2arc_buf_hdr_t *l2hdr; + kmutex_t *hash_lock; + uint64_t buf_sz; + if (arc_warm == B_FALSE) ab_prev = list_next(list, ab); else ab_prev = list_prev(list, ab); hash_lock = HDR_LOCK(ab); - have_lock = MUTEX_HELD(hash_lock); - if (!have_lock && !mutex_tryenter(hash_lock)) { + if (!mutex_tryenter(hash_lock)) { /* * Skip this buffer rather than waiting. */ @@ -4443,15 +4556,26 @@ l2arc_write_buffers(spa_t *spa, l2arc_de /* * Create and add a new L2ARC header. */ - hdrl2 = kmem_zalloc(sizeof (l2arc_buf_hdr_t), KM_SLEEP); - hdrl2->b_dev = dev; - hdrl2->b_daddr = dev->l2ad_hand; - + l2hdr = kmem_zalloc(sizeof (l2arc_buf_hdr_t), KM_SLEEP); + l2hdr->b_dev = dev; ab->b_flags |= ARC_L2_WRITING; - ab->b_l2hdr = hdrl2; - list_insert_head(dev->l2ad_buflist, ab); - buf_data = ab->b_buf->b_data; + + /* + * Temporarily stash the data buffer in b_tmp_cdata. + * The subsequent write step will pick it up from + * there. This is because can't access ab->b_buf + * without holding the hash_lock, which we in turn + * can't access without holding the ARC list locks + * (which we want to avoid during compression/writing). + */ + l2hdr->b_compress = ZIO_COMPRESS_OFF; + l2hdr->b_asize = ab->b_size; + l2hdr->b_tmp_cdata = ab->b_buf->b_data; + buf_sz = ab->b_size; + ab->b_l2hdr = l2hdr; + + list_insert_head(dev->l2ad_buflist, ab); /* * Compute and store the buffer cksum before @@ -4462,6 +4586,64 @@ l2arc_write_buffers(spa_t *spa, l2arc_de mutex_exit(hash_lock); + write_sz += buf_sz; + } + + mutex_exit(list_lock); + + if (full == B_TRUE) + break; + } + + /* No buffers selected for writing? */ + if (pio == NULL) { + ASSERT0(write_sz); + mutex_exit(&l2arc_buflist_mtx); + kmem_cache_free(hdr_cache, head); + return (0); + } + + /* + * Now start writing the buffers. We're starting at the write head + * and work backwards, retracing the course of the buffer selector + * loop above. + */ + for (ab = list_prev(dev->l2ad_buflist, head); ab; + ab = list_prev(dev->l2ad_buflist, ab)) { + l2arc_buf_hdr_t *l2hdr; + uint64_t buf_sz; + + /* + * We shouldn't need to lock the buffer here, since we flagged + * it as ARC_L2_WRITING in the previous step, but we must take + * care to only access its L2 cache parameters. In particular, + * ab->b_buf may be invalid by now due to ARC eviction. + */ + l2hdr = ab->b_l2hdr; + l2hdr->b_daddr = dev->l2ad_hand; + + if ((ab->b_flags & ARC_L2COMPRESS) && + l2hdr->b_asize >= buf_compress_minsz) { + if (l2arc_compress_buf(l2hdr)) { + /* + * If compression succeeded, enable headroom + * boost on the next scan cycle. + */ + *headroom_boost = B_TRUE; + } + } + + /* + * Pick up the buffer data we had previously stashed away + * (and now potentially also compressed). + */ + buf_data = l2hdr->b_tmp_cdata; + buf_sz = l2hdr->b_asize; + + /* Compression may have squashed the buffer to zero length. */ + if (buf_sz != 0) { + uint64_t buf_p_sz; + wzio = zio_write_phys(pio, dev->l2ad_vdev, dev->l2ad_hand, buf_sz, buf_data, ZIO_CHECKSUM_OFF, NULL, NULL, ZIO_PRIORITY_ASYNC_WRITE, @@ -4471,33 +4653,24 @@ l2arc_write_buffers(spa_t *spa, l2arc_de zio_t *, wzio); (void) zio_nowait(wzio); + write_asize += buf_sz; /* * Keep the clock hand suitably device-aligned. */ - buf_sz = vdev_psize_to_asize(dev->l2ad_vdev, buf_sz); - - write_sz += buf_sz; - dev->l2ad_hand += buf_sz; + buf_p_sz = vdev_psize_to_asize(dev->l2ad_vdev, buf_sz); + write_psize += buf_p_sz; + dev->l2ad_hand += buf_p_sz; } - - mutex_exit(list_lock); - - if (full == B_TRUE) - break; } - mutex_exit(&l2arc_buflist_mtx); - if (pio == NULL) { - ASSERT0(write_sz); - kmem_cache_free(hdr_cache, head); - return (0); - } + mutex_exit(&l2arc_buflist_mtx); - ASSERT3U(write_sz, <=, target_sz); + ASSERT3U(write_asize, <=, target_sz); ARCSTAT_BUMP(arcstat_l2_writes_sent); - ARCSTAT_INCR(arcstat_l2_write_bytes, write_sz); + ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize); ARCSTAT_INCR(arcstat_l2_size, write_sz); - vdev_space_update(dev->l2ad_vdev, write_sz, 0, 0); + ARCSTAT_INCR(arcstat_l2_asize, write_asize); + vdev_space_update(dev->l2ad_vdev, write_psize, 0, 0); /* * Bump device hand to the device start if it is approaching the end. @@ -4515,7 +4688,153 @@ l2arc_write_buffers(spa_t *spa, l2arc_de (void) zio_wait(pio); dev->l2ad_writing = B_FALSE; - return (write_sz); + return (write_asize); +} + +/* + * Compresses an L2ARC buffer. + * The data to be compressed must be prefilled in l2hdr->b_tmp_cdata and its + * size in l2hdr->b_asize. This routine tries to compress the data and + * depending on the compression result there are three possible outcomes: + * *) The buffer was incompressible. The original l2hdr contents were left + * untouched and are ready for writing to an L2 device. + * *) The buffer was all-zeros, so there is no need to write it to an L2 + * device. To indicate this situation b_tmp_cdata is NULL'ed, b_asize is + * set to zero and b_compress is set to ZIO_COMPRESS_EMPTY. + * *) Compression succeeded and b_tmp_cdata was replaced with a temporary + * data buffer which holds the compressed data to be written, and b_asize + * tells us how much data there is. b_compress is set to the appropriate + * compression algorithm. Once writing is done, invoke + * l2arc_release_cdata_buf on this l2hdr to free this temporary buffer. + * + * Returns B_TRUE if compression succeeded, or B_FALSE if it didn't (the + * buffer was incompressible). + */ +static boolean_t +l2arc_compress_buf(l2arc_buf_hdr_t *l2hdr) +{ + void *cdata; + size_t csize, len; + + ASSERT(l2hdr->b_compress == ZIO_COMPRESS_OFF); + ASSERT(l2hdr->b_tmp_cdata != NULL); + + len = l2hdr->b_asize; + cdata = zio_data_buf_alloc(len); + csize = zio_compress_data(ZIO_COMPRESS_LZ4, l2hdr->b_tmp_cdata, + cdata, l2hdr->b_asize); + + if (csize == 0) { + /* zero block, indicate that there's nothing to write */ + zio_data_buf_free(cdata, len); + l2hdr->b_compress = ZIO_COMPRESS_EMPTY; + l2hdr->b_asize = 0; + l2hdr->b_tmp_cdata = NULL; + ARCSTAT_BUMP(arcstat_l2_compress_zeros); + return (B_TRUE); + } else if (csize > 0 && csize < len) { + /* + * Compression succeeded, we'll keep the cdata around for + * writing and release it afterwards. + */ + l2hdr->b_compress = ZIO_COMPRESS_LZ4; + l2hdr->b_asize = csize; + l2hdr->b_tmp_cdata = cdata; + ARCSTAT_BUMP(arcstat_l2_compress_successes); + return (B_TRUE); + } else { + /* + * Compression failed, release the compressed buffer. + * l2hdr will be left unmodified. + */ + zio_data_buf_free(cdata, len); + ARCSTAT_BUMP(arcstat_l2_compress_failures); + return (B_FALSE); + } +} + +/* + * Decompresses a zio read back from an l2arc device. On success, the + * underlying zio's io_data buffer is overwritten by the uncompressed + * version. On decompression error (corrupt compressed stream), the + * zio->io_error value is set to signal an I/O error. + * + * Please note that the compressed data stream is not checksummed, so + * if the underlying device is experiencing data corruption, we may feed + * corrupt data to the decompressor, so the decompressor needs to be + * able to handle this situation (LZ4 does). + */ +static void +l2arc_decompress_zio(zio_t *zio, arc_buf_hdr_t *hdr, enum zio_compress c) +{ + ASSERT(L2ARC_IS_VALID_COMPRESS(c)); + + if (zio->io_error != 0) { + /* + * An io error has occured, just restore the original io + * size in preparation for a main pool read. + */ + zio->io_orig_size = zio->io_size = hdr->b_size; + return; + } + + if (c == ZIO_COMPRESS_EMPTY) { + /* + * An empty buffer results in a null zio, which means we + * need to fill its io_data after we're done restoring the + * buffer's contents. + */ + ASSERT(hdr->b_buf != NULL); + bzero(hdr->b_buf->b_data, hdr->b_size); + zio->io_data = zio->io_orig_data = hdr->b_buf->b_data; + } else { + ASSERT(zio->io_data != NULL); + /* + * We copy the compressed data from the start of the arc buffer + * (the zio_read will have pulled in only what we need, the + * rest is garbage which we will overwrite at decompression) + * and then decompress back to the ARC data buffer. This way we + * can minimize copying by simply decompressing back over the + * original compressed data (rather than decompressing to an + * aux buffer and then copying back the uncompressed buffer, + * which is likely to be much larger). + */ + uint64_t csize; + void *cdata; + + csize = zio->io_size; + cdata = zio_data_buf_alloc(csize); + bcopy(zio->io_data, cdata, csize); + if (zio_decompress_data(c, cdata, zio->io_data, csize, + hdr->b_size) != 0) + zio->io_error = EIO; + zio_data_buf_free(cdata, csize); + } + + /* Restore the expected uncompressed IO size. */ + zio->io_orig_size = zio->io_size = hdr->b_size; +} + +/* + * Releases the temporary b_tmp_cdata buffer in an l2arc header structure. + * This buffer serves as a temporary holder of compressed data while + * the buffer entry is being written to an l2arc device. Once that is + * done, we can dispose of it. + */ +static void +l2arc_release_cdata_buf(arc_buf_hdr_t *ab) +{ + l2arc_buf_hdr_t *l2hdr = ab->b_l2hdr; + + if (l2hdr->b_compress == ZIO_COMPRESS_LZ4) { + /* + * If the data was compressed, then we've allocated a + * temporary buffer for it, so now we need to release it. + */ + ASSERT(l2hdr->b_tmp_cdata != NULL); + zio_data_buf_free(l2hdr->b_tmp_cdata, ab->b_size); + } + l2hdr->b_tmp_cdata = NULL; } /* @@ -4530,6 +4849,7 @@ l2arc_feed_thread(void) spa_t *spa; uint64_t size, wrote; clock_t begin, next = ddi_get_lbolt(); + boolean_t headroom_boost = B_FALSE; CALLB_CPR_INIT(&cpr, &l2arc_feed_thr_lock, callb_generic_cpr, FTAG); @@ -4590,7 +4910,7 @@ l2arc_feed_thread(void) ARCSTAT_BUMP(arcstat_l2_feeds); - size = l2arc_write_size(dev); + size = l2arc_write_size(); /* * Evict L2ARC buffers that will be overwritten. @@ -4600,7 +4920,7 @@ l2arc_feed_thread(void) /* * Write ARC buffers. */ - wrote = l2arc_write_buffers(spa, dev, size); + wrote = l2arc_write_buffers(spa, dev, size, &headroom_boost); /* * Calculate interval between writes. @@ -4648,15 +4968,12 @@ l2arc_add_vdev(spa_t *spa, vdev_t *vd) adddev = kmem_zalloc(sizeof (l2arc_dev_t), KM_SLEEP); adddev->l2ad_spa = spa; adddev->l2ad_vdev = vd; - adddev->l2ad_write = l2arc_write_max; - adddev->l2ad_boost = l2arc_write_boost; adddev->l2ad_start = VDEV_LABEL_START_SIZE; adddev->l2ad_end = VDEV_LABEL_START_SIZE + vdev_get_min_asize(vd); adddev->l2ad_hand = adddev->l2ad_start; adddev->l2ad_evict = adddev->l2ad_start; adddev->l2ad_first = B_TRUE; adddev->l2ad_writing = B_FALSE; - ASSERT3U(adddev->l2ad_write, >, 0); /* * This is a list of all ARC buffers that are still valid on the Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Thu Jun 6 18:30:33 2013 (r251473) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Thu Jun 6 20:14:40 2013 (r251474) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #include @@ -568,6 +569,8 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t if (DBUF_IS_L2CACHEABLE(db)) aflags |= ARC_L2CACHE; + if (DBUF_IS_L2COMPRESSIBLE(db)) + aflags |= ARC_L2COMPRESS; SET_BOOKMARK(&zb, db->db_objset->os_dsl_dataset ? db->db_objset->os_dsl_dataset->ds_object : DMU_META_OBJSET, @@ -2706,8 +2709,9 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ } else { ASSERT(arc_released(data)); dr->dr_zio = arc_write(zio, os->os_spa, txg, - db->db_blkptr, data, DBUF_IS_L2CACHEABLE(db), &zp, - dbuf_write_ready, dbuf_write_done, db, - ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); + db->db_blkptr, data, DBUF_IS_L2CACHEABLE(db), + DBUF_IS_L2COMPRESSIBLE(db), &zp, dbuf_write_ready, + dbuf_write_done, db, ZIO_PRIORITY_ASYNC_WRITE, + ZIO_FLAG_MUSTSUCCEED, &zb); } } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Thu Jun 6 18:30:33 2013 (r251473) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Thu Jun 6 20:14:40 2013 (r251474) @@ -23,6 +23,8 @@ * Copyright (c) 2013 by Delphix. All rights reserved. */ +/* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ + #include #include #include @@ -1504,9 +1506,9 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_s dsa->dsa_tx = NULL; zio_nowait(arc_write(pio, os->os_spa, txg, - bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), &zp, - dmu_sync_ready, dmu_sync_done, dsa, - ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb)); + bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), + DBUF_IS_L2COMPRESSIBLE(db), &zp, dmu_sync_ready, dmu_sync_done, + dsa, ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb)); return (0); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Thu Jun 6 18:30:33 2013 (r251473) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Thu Jun 6 20:14:40 2013 (r251474) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -276,6 +277,8 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat if (DMU_OS_IS_L2CACHEABLE(os)) aflags |= ARC_L2CACHE; + if (DMU_OS_IS_L2COMPRESSIBLE(os)) + aflags |= ARC_L2COMPRESS; dprintf_bp(os->os_rootbp, "reading %s", ""); err = arc_read(NULL, spa, os->os_rootbp, @@ -991,9 +994,10 @@ dmu_objset_sync(objset_t *os, zio_t *pio dmu_write_policy(os, NULL, 0, 0, &zp); zio = arc_write(pio, os->os_spa, tx->tx_txg, - os->os_rootbp, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), &zp, - dmu_objset_write_ready, dmu_objset_write_done, os, - ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); + os->os_rootbp, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), + DMU_OS_IS_L2COMPRESSIBLE(os), &zp, dmu_objset_write_ready, + dmu_objset_write_done, os, ZIO_PRIORITY_ASYNC_WRITE, + ZIO_FLAG_MUSTSUCCEED, &zb); /* * Sync special dnodes - the parent IO for the sync is the root block Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h Thu Jun 6 18:30:33 2013 (r251473) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h Thu Jun 6 20:14:40 2013 (r251474) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifndef _SYS_ARC_H @@ -67,6 +68,7 @@ typedef enum arc_buf_contents { #define ARC_PREFETCH (1 << 3) /* I/O is a prefetch */ #define ARC_CACHED (1 << 4) /* I/O was already in cache */ #define ARC_L2CACHE (1 << 5) /* cache in L2ARC */ +#define ARC_L2COMPRESS (1 << 6) /* compress in L2ARC */ /* * The following breakdows of arc_size exist for kstat only. @@ -105,9 +107,9 @@ int arc_read(zio_t *pio, spa_t *spa, con arc_done_func_t *done, void *private, int priority, int flags, uint32_t *arc_flags, const zbookmark_t *zb); zio_t *arc_write(zio_t *pio, spa_t *spa, uint64_t txg, - blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp, - arc_done_func_t *ready, arc_done_func_t *done, void *private, - int priority, int zio_flags, const zbookmark_t *zb); + blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, + const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *done, + void *private, int priority, int zio_flags, const zbookmark_t *zb); void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *private); int arc_buf_evict(arc_buf_t *buf); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h Thu Jun 6 18:30:33 2013 (r251473) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h Thu Jun 6 20:14:40 2013 (r251474) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifndef _SYS_DBUF_H @@ -324,6 +325,9 @@ boolean_t dbuf_is_metadata(dmu_buf_impl_ (dbuf_is_metadata(_db) && \ ((_db)->db_objset->os_secondary_cache == ZFS_CACHE_METADATA))) +#define DBUF_IS_L2COMPRESSIBLE(_db) \ + ((_db)->db_objset->os_compress != ZIO_COMPRESS_OFF) + #ifdef ZFS_DEBUG /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h Thu Jun 6 18:30:33 2013 (r251473) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h Thu Jun 6 20:14:40 2013 (r251474) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -129,6 +130,8 @@ struct objset { ((os)->os_secondary_cache == ZFS_CACHE_ALL || \ (os)->os_secondary_cache == ZFS_CACHE_METADATA) +#define DMU_OS_IS_L2COMPRESSIBLE(os) ((os)->os_compress != ZIO_COMPRESS_OFF) + /* called from zpl */ int dmu_objset_hold(const char *name, void *tag, objset_t **osp); int dmu_objset_own(const char *name, dmu_objset_type_t type, From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 21:09:28 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E4F33946; Thu, 6 Jun 2013 21:09:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D506215CF; Thu, 6 Jun 2013 21:09:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56L9SC7002708; Thu, 6 Jun 2013 21:09:28 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56L9SOZ002705; Thu, 6 Jun 2013 21:09:28 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201306062109.r56L9SOZ002705@svn.freebsd.org> From: Ed Maste Date: Thu, 6 Jun 2013 21:09:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251475 - in head: lib/libc/net lib/libkvm tools/tools/pciroms X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 21:09:29 -0000 Author: emaste Date: Thu Jun 6 21:09:27 2013 New Revision: 251475 URL: http://svnweb.freebsd.org/changeset/base/251475 Log: Switch to 2-clause license and standard text Approved by: bms@ Modified: head/lib/libc/net/getifmaddrs.c head/lib/libkvm/kvm_mips.c head/tools/tools/pciroms/pciroms.c Modified: head/lib/libc/net/getifmaddrs.c ============================================================================== --- head/lib/libc/net/getifmaddrs.c Thu Jun 6 20:14:40 2013 (r251474) +++ head/lib/libc/net/getifmaddrs.c Thu Jun 6 21:09:27 2013 (r251475) @@ -11,17 +11,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BRUCE M. SIMPSON OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/lib/libkvm/kvm_mips.c ============================================================================== --- head/lib/libkvm/kvm_mips.c Thu Jun 6 20:14:40 2013 (r251474) +++ head/lib/libkvm/kvm_mips.c Thu Jun 6 21:09:27 2013 (r251475) @@ -10,22 +10,18 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Bruce M. Simpson. - * 4. The name of Bruce M. Simpson may not be used to endorse or promote products - * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL BRUCE M. SIMPSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* Modified: head/tools/tools/pciroms/pciroms.c ============================================================================== --- head/tools/tools/pciroms/pciroms.c Thu Jun 6 20:14:40 2013 (r251474) +++ head/tools/tools/pciroms/pciroms.c Thu Jun 6 21:09:27 2013 (r251475) @@ -10,25 +10,18 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Bruce M. Simpson. - * 4. Neither the name of Bruce M. Simpson nor the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 22:02:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 197637FF; Thu, 6 Jun 2013 22:02:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0BE4C17DB; Thu, 6 Jun 2013 22:02:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56M23MR020349; Thu, 6 Jun 2013 22:02:03 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56M23LK020348; Thu, 6 Jun 2013 22:02:03 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306062202.r56M23LK020348@svn.freebsd.org> From: Rick Macklem Date: Thu, 6 Jun 2013 22:02:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251476 - head/usr.sbin/gssd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 22:02:04 -0000 Author: rmacklem Date: Thu Jun 6 22:02:03 2013 New Revision: 251476 URL: http://svnweb.freebsd.org/changeset/base/251476 Log: Fix r251444 so that gssd.c still builds for WITHOUT_KERBEROS. Reported by: bf1783@gmail.com MFC after: 2 weeks Modified: head/usr.sbin/gssd/gssd.c Modified: head/usr.sbin/gssd/gssd.c ============================================================================== --- head/usr.sbin/gssd/gssd.c Thu Jun 6 21:09:27 2013 (r251475) +++ head/usr.sbin/gssd/gssd.c Thu Jun 6 22:02:03 2013 (r251476) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 22:31:54 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0F34E83F; Thu, 6 Jun 2013 22:31:54 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E4F6A1927; Thu, 6 Jun 2013 22:31:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56MVrkR030605; Thu, 6 Jun 2013 22:31:53 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56MVqrn030598; Thu, 6 Jun 2013 22:31:52 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306062231.r56MVqrn030598@svn.freebsd.org> From: Steven Hartland Date: Thu, 6 Jun 2013 22:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251477 - in stable/8/sys/cam: . scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 22:31:54 -0000 Author: smh Date: Thu Jun 6 22:31:52 2013 New Revision: 251477 URL: http://svnweb.freebsd.org/changeset/base/251477 Log: MFC r216088: Manual partial MFC of only basic VPD support for scsi_xpt MFC r249937: Refactored scsi_xpt use of device_has_vpd Modified: stable/8/sys/cam/cam_xpt.c stable/8/sys/cam/cam_xpt_internal.h stable/8/sys/cam/scsi/scsi_all.c stable/8/sys/cam/scsi/scsi_all.h stable/8/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Thu Jun 6 22:02:03 2013 (r251476) +++ stable/8/sys/cam/cam_xpt.c Thu Jun 6 22:31:52 2013 (r251477) @@ -4497,7 +4497,7 @@ xpt_alloc_device(struct cam_eb *bus, str device = NULL; } else { device = (struct cam_ed *)malloc(sizeof(*device), - M_CAMXPT, M_NOWAIT); + M_CAMXPT, M_NOWAIT|M_ZERO); } if (device != NULL) { @@ -4568,6 +4568,14 @@ xpt_release_device(struct cam_ed *device cam_devq_resize(devq, devq->alloc_queue.array_size - 1); camq_fini(&device->drvq); cam_ccbq_fini(&device->ccbq); + /* + * Free allocated memory. free(9) does nothing if the + * supplied pointer is NULL, so it is safe to call without + * checking. + */ + free(device->supported_vpds, M_CAMXPT); + free(device->serial_num, M_CAMXPT); + xpt_release_target(device->target); free(device, M_CAMXPT); } else Modified: stable/8/sys/cam/cam_xpt_internal.h ============================================================================== --- stable/8/sys/cam/cam_xpt_internal.h Thu Jun 6 22:02:03 2013 (r251476) +++ stable/8/sys/cam/cam_xpt_internal.h Thu Jun 6 22:31:52 2013 (r251477) @@ -93,6 +93,8 @@ struct cam_ed { cam_xport transport; u_int transport_version; struct scsi_inquiry_data inq_data; + uint8_t *supported_vpds; + uint8_t supported_vpds_len; struct ata_params ident_data; u_int8_t inq_flags; /* * Current settings for inquiry flags. Modified: stable/8/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.c Thu Jun 6 22:02:03 2013 (r251476) +++ stable/8/sys/cam/scsi/scsi_all.c Thu Jun 6 22:31:52 2013 (r251477) @@ -38,6 +38,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #include #else #include @@ -53,7 +56,13 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifndef _KERNEL + +#ifdef _KERNEL +#include +#include +#include +#include +#else #include #ifndef FALSE @@ -4605,6 +4614,28 @@ scsi_static_inquiry_match(caddr_t inqbuf } #ifdef _KERNEL +int +scsi_vpd_supported_page(struct cam_periph *periph, uint8_t page_id) +{ + struct cam_ed *device; + struct scsi_vpd_supported_pages *vpds; + int i, num_pages; + + device = periph->path->device; + vpds = (struct scsi_vpd_supported_pages *)device->supported_vpds; + + if (vpds != NULL) { + num_pages = device->supported_vpds_len - + SVPD_SUPPORTED_PAGES_HDR_LEN; + for (i = 0; i < num_pages; i++) { + if (vpds->page_list[i] == page_id) + return (1); + } + } + + return (0); +} + static void init_scsi_delay(void) { Modified: stable/8/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.h Thu Jun 6 22:02:03 2013 (r251476) +++ stable/8/sys/cam/scsi/scsi_all.h Thu Jun 6 22:31:52 2013 (r251477) @@ -857,13 +857,28 @@ struct scsi_vpd_supported_page_list { u_int8_t device; u_int8_t page_code; -#define SVPD_SUPPORTED_PAGE_LIST 0x00 +#define SVPD_SUPPORTED_PAGE_LIST 0x00 +#define SVPD_SUPPORTED_PAGES_HDR_LEN 4 u_int8_t reserved; u_int8_t length; /* number of VPD entries */ #define SVPD_SUPPORTED_PAGES_SIZE 251 u_int8_t list[SVPD_SUPPORTED_PAGES_SIZE]; }; +/* + * This structure is more suited to target operation, because the + * number of supported pages is left to the user to allocate. + */ +struct scsi_vpd_supported_pages +{ + u_int8_t device; + u_int8_t page_code; + u_int8_t reserved; +#define SVPD_SUPPORTED_PAGES 0x00 + u_int8_t length; + u_int8_t page_list[0]; +}; + struct scsi_vpd_unit_serial_number { u_int8_t device; @@ -1250,6 +1265,8 @@ int scsi_sense_sbuf(struct ccb_scsiio * char * scsi_sense_string(struct ccb_scsiio *csio, char *str, int str_len); void scsi_sense_print(struct ccb_scsiio *csio); +int scsi_vpd_supported_page(struct cam_periph *periph, + uint8_t page_id); #else /* _KERNEL */ int scsi_command_string(struct cam_device *device, struct ccb_scsiio *csio, struct sbuf *sb); Modified: stable/8/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_xpt.c Thu Jun 6 22:02:03 2013 (r251476) +++ stable/8/sys/cam/scsi/scsi_xpt.c Thu Jun 6 22:31:52 2013 (r251477) @@ -134,8 +134,8 @@ typedef enum { PROBE_FULL_INQUIRY, PROBE_REPORT_LUNS, PROBE_MODE_SENSE, - PROBE_SERIAL_NUM_0, - PROBE_SERIAL_NUM_1, + PROBE_SUPPORTED_VPD_LIST, + PROBE_SERIAL_NUM, PROBE_TUR_FOR_NEGOTIATION, PROBE_INQUIRY_BASIC_DV1, PROBE_INQUIRY_BASIC_DV2, @@ -150,8 +150,8 @@ static char *probe_action_text[] = { "PROBE_FULL_INQUIRY", "PROBE_REPORT_LUNS", "PROBE_MODE_SENSE", - "PROBE_SERIAL_NUM_0", - "PROBE_SERIAL_NUM_1", + "PROBE_SUPPORTED_VPD_LIST", + "PROBE_SERIAL_NUM", "PROBE_TUR_FOR_NEGOTIATION", "PROBE_INQUIRY_BASIC_DV1", "PROBE_INQUIRY_BASIC_DV2", @@ -824,7 +824,8 @@ again: if (INQ_DATA_TQ_ENABLED(inq_buf)) PROBE_SET_ACTION(softc, PROBE_MODE_SENSE); else - PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); + PROBE_SET_ACTION(softc, + PROBE_SUPPORTED_VPD_LIST); goto again; } scsi_report_luns(csio, 5, probedone, MSG_SIMPLE_Q_TAG, @@ -857,10 +858,10 @@ again: } xpt_print(periph->path, "Unable to mode sense control page - " "malloc failure\n"); - PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); + PROBE_SET_ACTION(softc, PROBE_SUPPORTED_VPD_LIST); } /* FALLTHROUGH */ - case PROBE_SERIAL_NUM_0: + case PROBE_SUPPORTED_VPD_LIST: { struct scsi_vpd_supported_page_list *vpd_list = NULL; struct cam_ed *device; @@ -892,7 +893,7 @@ again: probedone(periph, start_ccb); return; } - case PROBE_SERIAL_NUM_1: + case PROBE_SERIAL_NUM: { struct scsi_vpd_unit_serial_number *serial_buf; struct cam_ed* device; @@ -905,8 +906,10 @@ again: device->serial_num_len = 0; } - serial_buf = (struct scsi_vpd_unit_serial_number *) - malloc(sizeof(*serial_buf), M_CAMXPT, M_NOWAIT|M_ZERO); + if (scsi_vpd_supported_page(periph, SVPD_UNIT_SERIAL_NUMBER)) + serial_buf = (struct scsi_vpd_unit_serial_number *) + malloc(sizeof(*serial_buf), M_CAMXPT, + M_NOWAIT|M_ZERO); if (serial_buf != NULL) { scsi_inquiry(csio, @@ -1144,7 +1147,7 @@ probedone(struct cam_periph *periph, uni PROBE_MODE_SENSE); else PROBE_SET_ACTION(softc, - PROBE_SERIAL_NUM_0); + PROBE_SUPPORTED_VPD_LIST); if (path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; @@ -1303,7 +1306,8 @@ probedone(struct cam_periph *periph, uni if (INQ_DATA_TQ_ENABLED(inq_buf)) PROBE_SET_ACTION(softc, PROBE_MODE_SENSE); else - PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); + PROBE_SET_ACTION(softc, + PROBE_SUPPORTED_VPD_LIST); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; @@ -1339,36 +1343,40 @@ probedone(struct cam_periph *periph, uni } xpt_release_ccb(done_ccb); free(mode_hdr, M_CAMXPT); - PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); + PROBE_SET_ACTION(softc, PROBE_SUPPORTED_VPD_LIST); xpt_schedule(periph, priority); return; } - case PROBE_SERIAL_NUM_0: + case PROBE_SUPPORTED_VPD_LIST: { struct ccb_scsiio *csio; struct scsi_vpd_supported_page_list *page_list; - int length, serialnum_supported, i; - serialnum_supported = 0; csio = &done_ccb->csio; page_list = (struct scsi_vpd_supported_page_list *)csio->data_ptr; + if (path->device->supported_vpds != NULL) { + free(path->device->supported_vpds, M_CAMXPT); + path->device->supported_vpds = NULL; + path->device->supported_vpds_len = 0; + } + if (page_list == NULL) { /* * Don't process the command as it was never sent */ - } else if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP - && (page_list->length > 0)) { - length = min(page_list->length, - SVPD_SUPPORTED_PAGES_SIZE); - for (i = 0; i < length; i++) { - if (page_list->list[i] == - SVPD_UNIT_SERIAL_NUMBER) { - serialnum_supported = 1; - break; - } - } + } else if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + /* Got vpd list */ + path->device->supported_vpds_len = page_list->length + + SVPD_SUPPORTED_PAGES_HDR_LEN; + path->device->supported_vpds = (uint8_t *)page_list; + + xpt_release_ccb(done_ccb); + PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM); + xpt_schedule(periph, priority); + return; + } else if (cam_periph_error(done_ccb, 0, SF_RETRY_UA|SF_NO_PRINT, &softc->saved_ccb) == ERESTART) { @@ -1382,18 +1390,12 @@ probedone(struct cam_periph *periph, uni if (page_list != NULL) free(page_list, M_CAMXPT); - if (serialnum_supported) { - xpt_release_ccb(done_ccb); - PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_1); - xpt_schedule(periph, priority); - return; - } - + /* No VPDs available, skip to device check. */ csio->data_ptr = NULL; /* FALLTHROUGH */ } - case PROBE_SERIAL_NUM_1: + case PROBE_SERIAL_NUM: { struct ccb_scsiio *csio; struct scsi_vpd_unit_serial_number *serial_buf; @@ -2245,6 +2247,8 @@ scsi_alloc_device(struct cam_eb *bus, st device->queue_flags = 0; device->serial_num = NULL; device->serial_num_len = 0; + device->supported_vpds = NULL; + device->supported_vpds_len = 0; /* * XXX should be limited by number of CCBs this bus can From owner-svn-src-all@FreeBSD.ORG Thu Jun 6 23:21:43 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9C93E27A; Thu, 6 Jun 2013 23:21:43 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8D88B1B4E; Thu, 6 Jun 2013 23:21:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r56NLhNx046335; Thu, 6 Jun 2013 23:21:43 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r56NLgZX046328; Thu, 6 Jun 2013 23:21:42 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306062321.r56NLgZX046328@svn.freebsd.org> From: Xin LI Date: Thu, 6 Jun 2013 23:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251478 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 23:21:43 -0000 Author: delphij Date: Thu Jun 6 23:21:41 2013 New Revision: 251478 URL: http://svnweb.freebsd.org/changeset/base/251478 Log: MFV r251474: * Illumos zfs issue #3137 L2ARC compression Whether or not to compress buffers entering the L2ARC is controlled by "compression" setting on the dataset, when compression is not "off", L2ARC compression is enabled. The compress method is always LZ4 for L2ARC when enabled because it works best for the scenario. MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jun 6 22:31:52 2013 (r251477) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jun 6 23:21:41 2013 (r251478) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* @@ -120,6 +121,7 @@ #include #include +#include #include #include #include @@ -322,7 +324,11 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_cksum_bad; kstat_named_t arcstat_l2_io_error; kstat_named_t arcstat_l2_size; + kstat_named_t arcstat_l2_asize; kstat_named_t arcstat_l2_hdr_size; + kstat_named_t arcstat_l2_compress_successes; + kstat_named_t arcstat_l2_compress_zeros; + kstat_named_t arcstat_l2_compress_failures; kstat_named_t arcstat_l2_write_trylock_fail; kstat_named_t arcstat_l2_write_passed_headroom; kstat_named_t arcstat_l2_write_spa_mismatch; @@ -395,7 +401,11 @@ static arc_stats_t arc_stats = { { "l2_cksum_bad", KSTAT_DATA_UINT64 }, { "l2_io_error", KSTAT_DATA_UINT64 }, { "l2_size", KSTAT_DATA_UINT64 }, + { "l2_asize", KSTAT_DATA_UINT64 }, { "l2_hdr_size", KSTAT_DATA_UINT64 }, + { "l2_compress_successes", KSTAT_DATA_UINT64 }, + { "l2_compress_zeros", KSTAT_DATA_UINT64 }, + { "l2_compress_failures", KSTAT_DATA_UINT64 }, { "l2_write_trylock_fail", KSTAT_DATA_UINT64 }, { "l2_write_passed_headroom", KSTAT_DATA_UINT64 }, { "l2_write_spa_mismatch", KSTAT_DATA_UINT64 }, @@ -474,6 +484,9 @@ static arc_state_t *arc_l2c_only; #define arc_c_min ARCSTAT(arcstat_c_min) /* min target cache size */ #define arc_c_max ARCSTAT(arcstat_c_max) /* max target cache size */ +#define L2ARC_IS_VALID_COMPRESS(_c_) \ + ((_c_) == ZIO_COMPRESS_LZ4 || (_c_) == ZIO_COMPRESS_EMPTY) + static int arc_no_grow; /* Don't try to grow cache size */ static uint64_t arc_tempreserve; static uint64_t arc_loaned_bytes; @@ -636,7 +649,12 @@ uint64_t zfs_crc64_table[256]; */ #define L2ARC_WRITE_SIZE (8 * 1024 * 1024) /* initial write max */ -#define L2ARC_HEADROOM 2 /* num of writes */ +#define L2ARC_HEADROOM 2 /* num of writes */ +/* + * If we discover during ARC scan any buffers to be compressed, we boost + * our headroom for the next scanning cycle by this percentage multiple. + */ +#define L2ARC_HEADROOM_BOOST 200 #define L2ARC_FEED_SECS 1 /* caching interval secs */ #define L2ARC_FEED_MIN_MS 200 /* min caching interval ms */ @@ -649,6 +667,7 @@ uint64_t zfs_crc64_table[256]; uint64_t l2arc_write_max = L2ARC_WRITE_SIZE; /* default max write size */ uint64_t l2arc_write_boost = L2ARC_WRITE_SIZE; /* extra write during warmup */ uint64_t l2arc_headroom = L2ARC_HEADROOM; /* number of dev writes */ +uint64_t l2arc_headroom_boost = L2ARC_HEADROOM_BOOST; uint64_t l2arc_feed_secs = L2ARC_FEED_SECS; /* interval seconds */ uint64_t l2arc_feed_min_ms = L2ARC_FEED_MIN_MS; /* min interval milliseconds */ boolean_t l2arc_noprefetch = B_TRUE; /* don't cache prefetch bufs */ @@ -722,8 +741,6 @@ typedef struct l2arc_dev { vdev_t *l2ad_vdev; /* vdev */ spa_t *l2ad_spa; /* spa */ uint64_t l2ad_hand; /* next write location */ - uint64_t l2ad_write; /* desired write size, bytes */ - uint64_t l2ad_boost; /* warmup write boost, bytes */ uint64_t l2ad_start; /* first addr on device */ uint64_t l2ad_end; /* last addr on device */ uint64_t l2ad_evict; /* last addr eviction reached */ @@ -744,11 +761,12 @@ static kmutex_t l2arc_free_on_write_mtx; static uint64_t l2arc_ndev; /* number of devices */ typedef struct l2arc_read_callback { - arc_buf_t *l2rcb_buf; /* read buffer */ - spa_t *l2rcb_spa; /* spa */ - blkptr_t l2rcb_bp; /* original blkptr */ - zbookmark_t l2rcb_zb; /* original bookmark */ - int l2rcb_flags; /* original flags */ + arc_buf_t *l2rcb_buf; /* read buffer */ + spa_t *l2rcb_spa; /* spa */ + blkptr_t l2rcb_bp; /* original blkptr */ + zbookmark_t l2rcb_zb; /* original bookmark */ + int l2rcb_flags; /* original flags */ + enum zio_compress l2rcb_compress; /* applied compress */ } l2arc_read_callback_t; typedef struct l2arc_write_callback { @@ -758,8 +776,14 @@ typedef struct l2arc_write_callback { struct l2arc_buf_hdr { /* protected by arc_buf_hdr mutex */ - l2arc_dev_t *b_dev; /* L2ARC device */ - uint64_t b_daddr; /* disk address, offset byte */ + l2arc_dev_t *b_dev; /* L2ARC device */ + uint64_t b_daddr; /* disk address, offset byte */ + /* compression applied to buffer data */ + enum zio_compress b_compress; + /* real alloc'd buffer size depending on b_compress applied */ + int b_asize; + /* temporary buffer holder for in-flight compressed data */ + void *b_tmp_cdata; }; typedef struct l2arc_data_free { @@ -778,6 +802,11 @@ static void l2arc_read_done(zio_t *zio); static void l2arc_hdr_stat_add(void); static void l2arc_hdr_stat_remove(void); +static boolean_t l2arc_compress_buf(l2arc_buf_hdr_t *l2hdr); +static void l2arc_decompress_zio(zio_t *zio, arc_buf_hdr_t *hdr, + enum zio_compress c); +static void l2arc_release_cdata_buf(arc_buf_hdr_t *ab); + static uint64_t buf_hash(uint64_t spa, const dva_t *dva, uint64_t birth) { @@ -1696,6 +1725,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) hdr->b_size, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); + ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); if (hdr->b_state == arc_l2c_only) l2arc_hdr_stat_remove(); @@ -3118,6 +3148,8 @@ top: arc_access(hdr, hash_lock); if (*arc_flags & ARC_L2CACHE) hdr->b_flags |= ARC_L2CACHE; + if (*arc_flags & ARC_L2COMPRESS) + hdr->b_flags |= ARC_L2COMPRESS; mutex_exit(hash_lock); ARCSTAT_BUMP(arcstat_hits); ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH), @@ -3158,6 +3190,8 @@ top: } if (*arc_flags & ARC_L2CACHE) hdr->b_flags |= ARC_L2CACHE; + if (*arc_flags & ARC_L2COMPRESS) + hdr->b_flags |= ARC_L2COMPRESS; if (BP_GET_LEVEL(bp) > 0) hdr->b_flags |= ARC_INDIRECT; } else { @@ -3174,6 +3208,8 @@ top: add_reference(hdr, hash_lock, private); if (*arc_flags & ARC_L2CACHE) hdr->b_flags |= ARC_L2CACHE; + if (*arc_flags & ARC_L2COMPRESS) + hdr->b_flags |= ARC_L2COMPRESS; buf = kmem_cache_alloc(buf_cache, KM_PUSHPAGE); buf->b_hdr = hdr; buf->b_data = NULL; @@ -3247,6 +3283,7 @@ top: cb->l2rcb_bp = *bp; cb->l2rcb_zb = *zb; cb->l2rcb_flags = zio_flags; + cb->l2rcb_compress = hdr->b_l2hdr->b_compress; ASSERT(addr >= VDEV_LABEL_START_SIZE && addr + size < vd->vdev_psize - @@ -3255,16 +3292,31 @@ top: /* * l2arc read. The SCL_L2ARC lock will be * released by l2arc_read_done(). + * Issue a null zio if the underlying buffer + * was squashed to zero size by compression. */ - rzio = zio_read_phys(pio, vd, addr, size, - buf->b_data, ZIO_CHECKSUM_OFF, - l2arc_read_done, cb, priority, zio_flags | - ZIO_FLAG_DONT_CACHE | ZIO_FLAG_CANFAIL | - ZIO_FLAG_DONT_PROPAGATE | - ZIO_FLAG_DONT_RETRY, B_FALSE); + if (hdr->b_l2hdr->b_compress == + ZIO_COMPRESS_EMPTY) { + rzio = zio_null(pio, spa, vd, + l2arc_read_done, cb, + zio_flags | ZIO_FLAG_DONT_CACHE | + ZIO_FLAG_CANFAIL | + ZIO_FLAG_DONT_PROPAGATE | + ZIO_FLAG_DONT_RETRY); + } else { + rzio = zio_read_phys(pio, vd, addr, + hdr->b_l2hdr->b_asize, + buf->b_data, ZIO_CHECKSUM_OFF, + l2arc_read_done, cb, priority, + zio_flags | ZIO_FLAG_DONT_CACHE | + ZIO_FLAG_CANFAIL | + ZIO_FLAG_DONT_PROPAGATE | + ZIO_FLAG_DONT_RETRY, B_FALSE); + } DTRACE_PROBE2(l2arc__read, vdev_t *, vd, zio_t *, rzio); - ARCSTAT_INCR(arcstat_l2_read_bytes, size); + ARCSTAT_INCR(arcstat_l2_read_bytes, + hdr->b_l2hdr->b_asize); if (*arc_flags & ARC_NOWAIT) { zio_nowait(rzio); @@ -3531,6 +3583,7 @@ arc_release(arc_buf_t *buf, void *tag) buf->b_private = NULL; if (l2hdr) { + ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize); trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, hdr->b_size, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); @@ -3682,9 +3735,9 @@ arc_write_done(zio_t *zio) zio_t * arc_write(zio_t *pio, spa_t *spa, uint64_t txg, - blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp, - arc_done_func_t *ready, arc_done_func_t *done, void *private, - int priority, int zio_flags, const zbookmark_t *zb) + blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, + const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *done, + void *private, int priority, int zio_flags, const zbookmark_t *zb) { arc_buf_hdr_t *hdr = buf->b_hdr; arc_write_callback_t *callback; @@ -3697,6 +3750,8 @@ arc_write(zio_t *pio, spa_t *spa, uint64 ASSERT(hdr->b_acb == NULL); if (l2arc) hdr->b_flags |= ARC_L2CACHE; + if (l2arc_compress) + hdr->b_flags |= ARC_L2COMPRESS; callback = kmem_zalloc(sizeof (arc_write_callback_t), KM_SLEEP); callback->awcb_ready = ready; callback->awcb_done = done; @@ -4147,8 +4202,12 @@ arc_fini(void) * 2. The L2ARC attempts to cache data from the ARC before it is evicted. * It does this by periodically scanning buffers from the eviction-end of * the MFU and MRU ARC lists, copying them to the L2ARC devices if they are - * not already there. It scans until a headroom of buffers is satisfied, - * which itself is a buffer for ARC eviction. The thread that does this is + * not already there. It scans until a headroom of buffers is satisfied, + * which itself is a buffer for ARC eviction. If a compressible buffer is + * found during scanning and selected for writing to an L2ARC device, we + * temporarily boost scanning headroom during the next scan cycle to make + * sure we adapt to compression effects (which might significantly reduce + * the data volume we write to L2ARC). The thread that does this is * l2arc_feed_thread(), illustrated below; example sizes are included to * provide a better sense of ratio than this diagram: * @@ -4213,6 +4272,11 @@ arc_fini(void) * l2arc_write_boost extra write bytes during device warmup * l2arc_noprefetch skip caching prefetched buffers * l2arc_headroom number of max device writes to precache + * l2arc_headroom_boost when we find compressed buffers during ARC + * scanning, we multiply headroom by this + * percentage factor for the next scan cycle, + * since more compressed buffers are likely to + * be present * l2arc_feed_secs seconds between L2ARC writing * * Tunables may be removed or added as future performance improvements are @@ -4259,14 +4323,24 @@ l2arc_write_eligible(uint64_t spa_guid, } static uint64_t -l2arc_write_size(l2arc_dev_t *dev) +l2arc_write_size(void) { uint64_t size; - size = dev->l2ad_write; + /* + * Make sure our globals have meaningful values in case the user + * altered them. + */ + size = l2arc_write_max; + if (size == 0) { + cmn_err(CE_NOTE, "Bad value for l2arc_write_max, value must " + "be greater than zero, resetting it to the default (%d)", + L2ARC_WRITE_SIZE); + size = l2arc_write_max = L2ARC_WRITE_SIZE; + } if (arc_warm == B_FALSE) - size += dev->l2ad_boost; + size += l2arc_write_boost; return (size); @@ -4440,12 +4514,20 @@ l2arc_write_done(zio_t *zio) continue; } + abl2 = ab->b_l2hdr; + + /* + * Release the temporary compressed buffer as soon as possible. + */ + if (abl2->b_compress != ZIO_COMPRESS_OFF) + l2arc_release_cdata_buf(ab); + if (zio->io_error != 0) { /* * Error - drop L2ARC entry. */ list_remove(buflist, ab); - abl2 = ab->b_l2hdr; + ARCSTAT_INCR(arcstat_l2_asize, -abl2->b_asize); ab->b_l2hdr = NULL; trim_map_free(abl2->b_dev->l2ad_vdev, abl2->b_daddr, ab->b_size, 0); @@ -4500,6 +4582,13 @@ l2arc_read_done(zio_t *zio) ASSERT3P(hash_lock, ==, HDR_LOCK(hdr)); /* + * If the buffer was compressed, decompress it first. + */ + if (cb->l2rcb_compress != ZIO_COMPRESS_OFF) + l2arc_decompress_zio(zio, hdr, cb->l2rcb_compress); + ASSERT(zio->io_data != NULL); + + /* * Check this survived the L2ARC journey. */ equal = arc_cksum_equal(buf); @@ -4695,6 +4784,7 @@ top: */ if (ab->b_l2hdr != NULL) { abl2 = ab->b_l2hdr; + ARCSTAT_INCR(arcstat_l2_asize, -abl2->b_asize); ab->b_l2hdr = NULL; kmem_free(abl2, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -ab->b_size); @@ -4720,38 +4810,55 @@ top: * * An ARC_L2_WRITING flag is set so that the L2ARC buffers are not valid * for reading until they have completed writing. + * The headroom_boost is an in-out parameter used to maintain headroom boost + * state between calls to this function. + * + * Returns the number of bytes actually written (which may be smaller than + * the delta by which the device hand has changed due to alignment). */ static uint64_t -l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) +l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz, + boolean_t *headroom_boost) { arc_buf_hdr_t *ab, *ab_prev, *head; - l2arc_buf_hdr_t *hdrl2; list_t *list; - uint64_t passed_sz, write_sz, buf_sz, headroom; + uint64_t write_asize, write_psize, write_sz, headroom, + buf_compress_minsz; void *buf_data; - kmutex_t *hash_lock, *list_lock; - boolean_t have_lock, full; + kmutex_t *list_lock; + boolean_t full; l2arc_write_callback_t *cb; zio_t *pio, *wzio; uint64_t guid = spa_load_guid(spa); + const boolean_t do_headroom_boost = *headroom_boost; int try; ASSERT(dev->l2ad_vdev != NULL); + /* Lower the flag now, we might want to raise it again later. */ + *headroom_boost = B_FALSE; + pio = NULL; - write_sz = 0; + write_sz = write_asize = write_psize = 0; full = B_FALSE; head = kmem_cache_alloc(hdr_cache, KM_PUSHPAGE); head->b_flags |= ARC_L2_WRITE_HEAD; ARCSTAT_BUMP(arcstat_l2_write_buffer_iter); /* + * We will want to try to compress buffers that are at least 2x the + * device sector size. + */ + buf_compress_minsz = 2 << dev->l2ad_vdev->vdev_ashift; + + /* * Copy buffers for L2ARC writing. */ mutex_enter(&l2arc_buflist_mtx); for (try = 0; try < 2 * ARC_BUFC_NUMLISTS; try++) { + uint64_t passed_sz = 0; + list = l2arc_list_locked(try, &list_lock); - passed_sz = 0; ARCSTAT_BUMP(arcstat_l2_write_buffer_list_iter); /* @@ -4760,7 +4867,6 @@ l2arc_write_buffers(spa_t *spa, l2arc_de * Until the ARC is warm and starts to evict, read from the * head of the ARC lists rather than the tail. */ - headroom = target_sz * l2arc_headroom; if (arc_warm == B_FALSE) ab = list_head(list); else @@ -4768,7 +4874,15 @@ l2arc_write_buffers(spa_t *spa, l2arc_de if (ab == NULL) ARCSTAT_BUMP(arcstat_l2_write_buffer_list_null_iter); + headroom = target_sz * l2arc_headroom; + if (do_headroom_boost) + headroom = (headroom * l2arc_headroom_boost) / 100; + for (; ab; ab = ab_prev) { + l2arc_buf_hdr_t *l2hdr; + kmutex_t *hash_lock; + uint64_t buf_sz; + if (arc_warm == B_FALSE) ab_prev = list_next(list, ab); else @@ -4776,8 +4890,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de ARCSTAT_INCR(arcstat_l2_write_buffer_bytes_scanned, ab->b_size); hash_lock = HDR_LOCK(ab); - have_lock = MUTEX_HELD(hash_lock); - if (!have_lock && !mutex_tryenter(hash_lock)) { + if (!mutex_tryenter(hash_lock)) { ARCSTAT_BUMP(arcstat_l2_write_trylock_fail); /* * Skip this buffer rather than waiting. @@ -4827,15 +4940,26 @@ l2arc_write_buffers(spa_t *spa, l2arc_de /* * Create and add a new L2ARC header. */ - hdrl2 = kmem_zalloc(sizeof (l2arc_buf_hdr_t), KM_SLEEP); - hdrl2->b_dev = dev; - hdrl2->b_daddr = dev->l2ad_hand; - + l2hdr = kmem_zalloc(sizeof (l2arc_buf_hdr_t), KM_SLEEP); + l2hdr->b_dev = dev; ab->b_flags |= ARC_L2_WRITING; - ab->b_l2hdr = hdrl2; - list_insert_head(dev->l2ad_buflist, ab); - buf_data = ab->b_buf->b_data; + + /* + * Temporarily stash the data buffer in b_tmp_cdata. + * The subsequent write step will pick it up from + * there. This is because can't access ab->b_buf + * without holding the hash_lock, which we in turn + * can't access without holding the ARC list locks + * (which we want to avoid during compression/writing). + */ + l2hdr->b_compress = ZIO_COMPRESS_OFF; + l2hdr->b_asize = ab->b_size; + l2hdr->b_tmp_cdata = ab->b_buf->b_data; + buf_sz = ab->b_size; + ab->b_l2hdr = l2hdr; + + list_insert_head(dev->l2ad_buflist, ab); /* * Compute and store the buffer cksum before @@ -4846,6 +4970,64 @@ l2arc_write_buffers(spa_t *spa, l2arc_de mutex_exit(hash_lock); + write_sz += buf_sz; + } + + mutex_exit(list_lock); + + if (full == B_TRUE) + break; + } + + /* No buffers selected for writing? */ + if (pio == NULL) { + ASSERT0(write_sz); + mutex_exit(&l2arc_buflist_mtx); + kmem_cache_free(hdr_cache, head); + return (0); + } + + /* + * Now start writing the buffers. We're starting at the write head + * and work backwards, retracing the course of the buffer selector + * loop above. + */ + for (ab = list_prev(dev->l2ad_buflist, head); ab; + ab = list_prev(dev->l2ad_buflist, ab)) { + l2arc_buf_hdr_t *l2hdr; + uint64_t buf_sz; + + /* + * We shouldn't need to lock the buffer here, since we flagged + * it as ARC_L2_WRITING in the previous step, but we must take + * care to only access its L2 cache parameters. In particular, + * ab->b_buf may be invalid by now due to ARC eviction. + */ + l2hdr = ab->b_l2hdr; + l2hdr->b_daddr = dev->l2ad_hand; + + if ((ab->b_flags & ARC_L2COMPRESS) && + l2hdr->b_asize >= buf_compress_minsz) { + if (l2arc_compress_buf(l2hdr)) { + /* + * If compression succeeded, enable headroom + * boost on the next scan cycle. + */ + *headroom_boost = B_TRUE; + } + } + + /* + * Pick up the buffer data we had previously stashed away + * (and now potentially also compressed). + */ + buf_data = l2hdr->b_tmp_cdata; + buf_sz = l2hdr->b_asize; + + /* Compression may have squashed the buffer to zero length. */ + if (buf_sz != 0) { + uint64_t buf_p_sz; + wzio = zio_write_phys(pio, dev->l2ad_vdev, dev->l2ad_hand, buf_sz, buf_data, ZIO_CHECKSUM_OFF, NULL, NULL, ZIO_PRIORITY_ASYNC_WRITE, @@ -4855,33 +5037,24 @@ l2arc_write_buffers(spa_t *spa, l2arc_de zio_t *, wzio); (void) zio_nowait(wzio); + write_asize += buf_sz; /* * Keep the clock hand suitably device-aligned. */ - buf_sz = vdev_psize_to_asize(dev->l2ad_vdev, buf_sz); - - write_sz += buf_sz; - dev->l2ad_hand += buf_sz; + buf_p_sz = vdev_psize_to_asize(dev->l2ad_vdev, buf_sz); + write_psize += buf_p_sz; + dev->l2ad_hand += buf_p_sz; } - - mutex_exit(list_lock); - - if (full == B_TRUE) - break; } - mutex_exit(&l2arc_buflist_mtx); - if (pio == NULL) { - ASSERT0(write_sz); - kmem_cache_free(hdr_cache, head); - return (0); - } + mutex_exit(&l2arc_buflist_mtx); - ASSERT3U(write_sz, <=, target_sz); + ASSERT3U(write_asize, <=, target_sz); ARCSTAT_BUMP(arcstat_l2_writes_sent); - ARCSTAT_INCR(arcstat_l2_write_bytes, write_sz); + ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize); ARCSTAT_INCR(arcstat_l2_size, write_sz); - vdev_space_update(dev->l2ad_vdev, write_sz, 0, 0); + ARCSTAT_INCR(arcstat_l2_asize, write_asize); + vdev_space_update(dev->l2ad_vdev, write_psize, 0, 0); /* * Bump device hand to the device start if it is approaching the end. @@ -4899,7 +5072,153 @@ l2arc_write_buffers(spa_t *spa, l2arc_de (void) zio_wait(pio); dev->l2ad_writing = B_FALSE; - return (write_sz); + return (write_asize); +} + +/* + * Compresses an L2ARC buffer. + * The data to be compressed must be prefilled in l2hdr->b_tmp_cdata and its + * size in l2hdr->b_asize. This routine tries to compress the data and + * depending on the compression result there are three possible outcomes: + * *) The buffer was incompressible. The original l2hdr contents were left + * untouched and are ready for writing to an L2 device. + * *) The buffer was all-zeros, so there is no need to write it to an L2 + * device. To indicate this situation b_tmp_cdata is NULL'ed, b_asize is + * set to zero and b_compress is set to ZIO_COMPRESS_EMPTY. + * *) Compression succeeded and b_tmp_cdata was replaced with a temporary + * data buffer which holds the compressed data to be written, and b_asize + * tells us how much data there is. b_compress is set to the appropriate + * compression algorithm. Once writing is done, invoke + * l2arc_release_cdata_buf on this l2hdr to free this temporary buffer. + * + * Returns B_TRUE if compression succeeded, or B_FALSE if it didn't (the + * buffer was incompressible). + */ +static boolean_t +l2arc_compress_buf(l2arc_buf_hdr_t *l2hdr) +{ + void *cdata; + size_t csize, len; + + ASSERT(l2hdr->b_compress == ZIO_COMPRESS_OFF); + ASSERT(l2hdr->b_tmp_cdata != NULL); + + len = l2hdr->b_asize; + cdata = zio_data_buf_alloc(len); + csize = zio_compress_data(ZIO_COMPRESS_LZ4, l2hdr->b_tmp_cdata, + cdata, l2hdr->b_asize); + + if (csize == 0) { + /* zero block, indicate that there's nothing to write */ + zio_data_buf_free(cdata, len); + l2hdr->b_compress = ZIO_COMPRESS_EMPTY; + l2hdr->b_asize = 0; + l2hdr->b_tmp_cdata = NULL; + ARCSTAT_BUMP(arcstat_l2_compress_zeros); + return (B_TRUE); + } else if (csize > 0 && csize < len) { + /* + * Compression succeeded, we'll keep the cdata around for + * writing and release it afterwards. + */ + l2hdr->b_compress = ZIO_COMPRESS_LZ4; + l2hdr->b_asize = csize; + l2hdr->b_tmp_cdata = cdata; + ARCSTAT_BUMP(arcstat_l2_compress_successes); + return (B_TRUE); + } else { + /* + * Compression failed, release the compressed buffer. + * l2hdr will be left unmodified. + */ + zio_data_buf_free(cdata, len); + ARCSTAT_BUMP(arcstat_l2_compress_failures); + return (B_FALSE); + } +} + +/* + * Decompresses a zio read back from an l2arc device. On success, the + * underlying zio's io_data buffer is overwritten by the uncompressed + * version. On decompression error (corrupt compressed stream), the + * zio->io_error value is set to signal an I/O error. + * + * Please note that the compressed data stream is not checksummed, so + * if the underlying device is experiencing data corruption, we may feed + * corrupt data to the decompressor, so the decompressor needs to be + * able to handle this situation (LZ4 does). + */ +static void +l2arc_decompress_zio(zio_t *zio, arc_buf_hdr_t *hdr, enum zio_compress c) +{ + ASSERT(L2ARC_IS_VALID_COMPRESS(c)); + + if (zio->io_error != 0) { + /* + * An io error has occured, just restore the original io + * size in preparation for a main pool read. + */ + zio->io_orig_size = zio->io_size = hdr->b_size; + return; + } + + if (c == ZIO_COMPRESS_EMPTY) { + /* + * An empty buffer results in a null zio, which means we + * need to fill its io_data after we're done restoring the + * buffer's contents. + */ + ASSERT(hdr->b_buf != NULL); + bzero(hdr->b_buf->b_data, hdr->b_size); + zio->io_data = zio->io_orig_data = hdr->b_buf->b_data; + } else { + ASSERT(zio->io_data != NULL); + /* + * We copy the compressed data from the start of the arc buffer + * (the zio_read will have pulled in only what we need, the + * rest is garbage which we will overwrite at decompression) + * and then decompress back to the ARC data buffer. This way we + * can minimize copying by simply decompressing back over the + * original compressed data (rather than decompressing to an + * aux buffer and then copying back the uncompressed buffer, + * which is likely to be much larger). + */ + uint64_t csize; + void *cdata; + + csize = zio->io_size; + cdata = zio_data_buf_alloc(csize); + bcopy(zio->io_data, cdata, csize); + if (zio_decompress_data(c, cdata, zio->io_data, csize, + hdr->b_size) != 0) + zio->io_error = EIO; + zio_data_buf_free(cdata, csize); + } + + /* Restore the expected uncompressed IO size. */ + zio->io_orig_size = zio->io_size = hdr->b_size; +} + +/* + * Releases the temporary b_tmp_cdata buffer in an l2arc header structure. + * This buffer serves as a temporary holder of compressed data while + * the buffer entry is being written to an l2arc device. Once that is + * done, we can dispose of it. + */ +static void +l2arc_release_cdata_buf(arc_buf_hdr_t *ab) +{ + l2arc_buf_hdr_t *l2hdr = ab->b_l2hdr; + + if (l2hdr->b_compress == ZIO_COMPRESS_LZ4) { + /* + * If the data was compressed, then we've allocated a + * temporary buffer for it, so now we need to release it. + */ + ASSERT(l2hdr->b_tmp_cdata != NULL); + zio_data_buf_free(l2hdr->b_tmp_cdata, ab->b_size); + } + l2hdr->b_tmp_cdata = NULL; } /* @@ -4914,6 +5233,7 @@ l2arc_feed_thread(void *dummy __unused) spa_t *spa; uint64_t size, wrote; clock_t begin, next = ddi_get_lbolt(); + boolean_t headroom_boost = B_FALSE; CALLB_CPR_INIT(&cpr, &l2arc_feed_thr_lock, callb_generic_cpr, FTAG); @@ -4974,7 +5294,7 @@ l2arc_feed_thread(void *dummy __unused) ARCSTAT_BUMP(arcstat_l2_feeds); - size = l2arc_write_size(dev); + size = l2arc_write_size(); /* * Evict L2ARC buffers that will be overwritten. @@ -4984,7 +5304,7 @@ l2arc_feed_thread(void *dummy __unused) /* * Write ARC buffers. */ - wrote = l2arc_write_buffers(spa, dev, size); + wrote = l2arc_write_buffers(spa, dev, size, &headroom_boost); /* * Calculate interval between writes. @@ -5032,15 +5352,12 @@ l2arc_add_vdev(spa_t *spa, vdev_t *vd) adddev = kmem_zalloc(sizeof (l2arc_dev_t), KM_SLEEP); adddev->l2ad_spa = spa; adddev->l2ad_vdev = vd; - adddev->l2ad_write = l2arc_write_max; - adddev->l2ad_boost = l2arc_write_boost; adddev->l2ad_start = VDEV_LABEL_START_SIZE; adddev->l2ad_end = VDEV_LABEL_START_SIZE + vdev_get_min_asize(vd); adddev->l2ad_hand = adddev->l2ad_start; adddev->l2ad_evict = adddev->l2ad_start; adddev->l2ad_first = B_TRUE; adddev->l2ad_writing = B_FALSE; - ASSERT3U(adddev->l2ad_write, >, 0); /* * This is a list of all ARC buffers that are still valid on the Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jun 6 22:31:52 2013 (r251477) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jun 6 23:21:41 2013 (r251478) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #include @@ -568,6 +569,8 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t if (DBUF_IS_L2CACHEABLE(db)) aflags |= ARC_L2CACHE; + if (DBUF_IS_L2COMPRESSIBLE(db)) + aflags |= ARC_L2COMPRESS; SET_BOOKMARK(&zb, db->db_objset->os_dsl_dataset ? db->db_objset->os_dsl_dataset->ds_object : DMU_META_OBJSET, @@ -2710,8 +2713,9 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ } else { ASSERT(arc_released(data)); dr->dr_zio = arc_write(zio, os->os_spa, txg, - db->db_blkptr, data, DBUF_IS_L2CACHEABLE(db), &zp, - dbuf_write_ready, dbuf_write_done, db, - ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); + db->db_blkptr, data, DBUF_IS_L2CACHEABLE(db), + DBUF_IS_L2COMPRESSIBLE(db), &zp, dbuf_write_ready, + dbuf_write_done, db, ZIO_PRIORITY_ASYNC_WRITE, + ZIO_FLAG_MUSTSUCCEED, &zb); } } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jun 6 22:31:52 2013 (r251477) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jun 6 23:21:41 2013 (r251478) @@ -23,6 +23,8 @@ * Copyright (c) 2013 by Delphix. All rights reserved. */ +/* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ + #include #include #include @@ -1514,9 +1516,9 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_s dsa->dsa_tx = NULL; zio_nowait(arc_write(pio, os->os_spa, txg, - bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), &zp, - dmu_sync_ready, dmu_sync_done, dsa, - ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb)); + bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), + DBUF_IS_L2COMPRESSIBLE(db), &zp, dmu_sync_ready, dmu_sync_done, + dsa, ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb)); return (0); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Thu Jun 6 22:31:52 2013 (r251477) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Thu Jun 6 23:21:41 2013 (r251478) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -276,6 +277,8 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat if (DMU_OS_IS_L2CACHEABLE(os)) aflags |= ARC_L2CACHE; + if (DMU_OS_IS_L2COMPRESSIBLE(os)) + aflags |= ARC_L2COMPRESS; dprintf_bp(os->os_rootbp, "reading %s", ""); err = arc_read(NULL, spa, os->os_rootbp, @@ -991,9 +994,10 @@ dmu_objset_sync(objset_t *os, zio_t *pio dmu_write_policy(os, NULL, 0, 0, &zp); zio = arc_write(pio, os->os_spa, tx->tx_txg, - os->os_rootbp, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), &zp, - dmu_objset_write_ready, dmu_objset_write_done, os, - ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); + os->os_rootbp, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), + DMU_OS_IS_L2COMPRESSIBLE(os), &zp, dmu_objset_write_ready, + dmu_objset_write_done, os, ZIO_PRIORITY_ASYNC_WRITE, + ZIO_FLAG_MUSTSUCCEED, &zb); /* * Sync special dnodes - the parent IO for the sync is the root block Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Thu Jun 6 22:31:52 2013 (r251477) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Thu Jun 6 23:21:41 2013 (r251478) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifndef _SYS_ARC_H @@ -67,6 +68,7 @@ typedef enum arc_buf_contents { #define ARC_PREFETCH (1 << 3) /* I/O is a prefetch */ #define ARC_CACHED (1 << 4) /* I/O was already in cache */ #define ARC_L2CACHE (1 << 5) /* cache in L2ARC */ +#define ARC_L2COMPRESS (1 << 6) /* compress in L2ARC */ /* * The following breakdows of arc_size exist for kstat only. @@ -105,9 +107,9 @@ int arc_read(zio_t *pio, spa_t *spa, con arc_done_func_t *done, void *priv, int priority, int flags, uint32_t *arc_flags, const zbookmark_t *zb); zio_t *arc_write(zio_t *pio, spa_t *spa, uint64_t txg, - blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp, - arc_done_func_t *ready, arc_done_func_t *done, void *priv, - int priority, int zio_flags, const zbookmark_t *zb); + blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, + const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *done, + void *priv, int priority, int zio_flags, const zbookmark_t *zb); void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *priv); int arc_buf_evict(arc_buf_t *buf); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Thu Jun 6 22:31:52 2013 (r251477) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Thu Jun 6 23:21:41 2013 (r251478) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifndef _SYS_DBUF_H @@ -324,6 +325,9 @@ boolean_t dbuf_is_metadata(dmu_buf_impl_ (dbuf_is_metadata(_db) && \ ((_db)->db_objset->os_secondary_cache == ZFS_CACHE_METADATA))) +#define DBUF_IS_L2COMPRESSIBLE(_db) \ + ((_db)->db_objset->os_compress != ZIO_COMPRESS_OFF) + #ifdef ZFS_DEBUG /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Thu Jun 6 22:31:52 2013 (r251477) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Thu Jun 6 23:21:41 2013 (r251478) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -129,6 +130,8 @@ struct objset { ((os)->os_secondary_cache == ZFS_CACHE_ALL || \ (os)->os_secondary_cache == ZFS_CACHE_METADATA) +#define DMU_OS_IS_L2COMPRESSIBLE(os) ((os)->os_compress != ZIO_COMPRESS_OFF) + /* called from zpl */ int dmu_objset_hold(const char *name, void *tag, objset_t **osp); int dmu_objset_own(const char *name, dmu_objset_type_t type, From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 00:22:40 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 60E94B24; Fri, 7 Jun 2013 00:22:40 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 51F261E0E; Fri, 7 Jun 2013 00:22:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r570MdQE065054; Fri, 7 Jun 2013 00:22:39 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r570MdG8065048; Fri, 7 Jun 2013 00:22:39 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201306070022.r570MdG8065048@svn.freebsd.org> From: Scott Long Date: Fri, 7 Jun 2013 00:22:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251479 - in head/sys/cam: . scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 00:22:40 -0000 Author: scottl Date: Fri Jun 7 00:22:38 2013 New Revision: 251479 URL: http://svnweb.freebsd.org/changeset/base/251479 Log: Simplify the checking of flags for cam_periph_mapmem(). This gets rid of a lot of code redundancy and grossness at very minor expense. Reviewed by: smh Obtained from: Netflix MFC after: 3 days Modified: head/sys/cam/cam_periph.c head/sys/cam/scsi/scsi_pass.c head/sys/cam/scsi/scsi_sg.c head/sys/cam/scsi/scsi_target.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Thu Jun 6 23:21:41 2013 (r251478) +++ head/sys/cam/cam_periph.c Fri Jun 7 00:22:38 2013 (r251479) @@ -681,9 +681,9 @@ camperiphfree(struct cam_periph *periph) /* * Map user virtual pointers into kernel virtual address space, so we can - * access the memory. This won't work on physical pointers, for now it's - * up to the caller to check for that. (XXX KDM -- should we do that here - * instead?) This also only works for up to MAXPHYS memory. Since we use + * access the memory. This is now a generic function that centralizes most + * of the sanity checks on the data flags, if any. + * This also only works for up to MAXPHYS memory. Since we use * buffers to map stuff in and out, we're limited to the buffer size. */ int @@ -728,9 +728,8 @@ cam_periph_mapmem(union ccb *ccb, struct case XPT_CONT_TARGET_IO: if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) return(0); - KASSERT((ccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR, - ("not VADDR for SCSI_IO %p %x\n", ccb, ccb->ccb_h.flags)); - + if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR) + return (EINVAL); data_ptrs[0] = &ccb->csio.data_ptr; lengths[0] = ccb->csio.dxfer_len; dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK; @@ -739,9 +738,8 @@ cam_periph_mapmem(union ccb *ccb, struct case XPT_ATA_IO: if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) return(0); - KASSERT((ccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR, - ("not VADDR for ATA_IO %p %x\n", ccb, ccb->ccb_h.flags)); - + if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR) + return (EINVAL); data_ptrs[0] = &ccb->ataio.data_ptr; lengths[0] = ccb->ataio.dxfer_len; dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK; @@ -812,8 +810,12 @@ cam_periph_mapmem(union ccb *ccb, struct } - /* this keeps the current process from getting swapped */ /* + * This keeps the the kernel stack of current thread from getting + * swapped. In low-memory situations where the kernel stack might + * otherwise get swapped out, this holds it and allows the thread + * to make progress and release the kernel mapped pages sooner. + * * XXX KDM should I use P_NOSWAP instead? */ PHOLD(curproc); @@ -885,8 +887,7 @@ cam_periph_unmapmem(union ccb *ccb, stru u_int8_t **data_ptrs[CAM_PERIPH_MAXMAPS]; if (mapinfo->num_bufs_used <= 0) { - /* allow ourselves to be swapped once again */ - PRELE(curproc); + /* nothing to free and the process wasn't held. */ return; } Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Thu Jun 6 23:21:41 2013 (r251478) +++ head/sys/cam/scsi/scsi_pass.c Fri Jun 7 00:22:38 2013 (r251479) @@ -668,12 +668,11 @@ passsendccb(struct cam_periph *periph, u { struct pass_softc *softc; struct cam_periph_map_info mapinfo; - int error, need_unmap; + xpt_opcode fc; + int error; softc = (struct pass_softc *)periph->softc; - need_unmap = 0; - /* * There are some fields in the CCB header that need to be * preserved, the rest we get from the user. @@ -687,28 +686,13 @@ passsendccb(struct cam_periph *periph, u ccb->ccb_h.cbfcnp = passdone; /* - * We only attempt to map the user memory into kernel space - * if they haven't passed in a physical memory pointer, - * and if there is actually an I/O operation to perform. - * cam_periph_mapmem() supports SCSI, ATA, SMP, ADVINFO and device - * match CCBs. For the SCSI, ATA and ADVINFO CCBs, we only pass the - * CCB in if there's actually data to map. cam_periph_mapmem() will - * do the right thing, even if there isn't data to map, but since CCBs - * without data are a reasonably common occurrence (e.g. test unit - * ready), it will save a few cycles if we check for it here. - * - * XXX What happens if a sg list is supplied? We don't filter that - * out. + * Let cam_periph_mapmem do a sanity check on the data pointer format. + * Even if no data transfer is needed, it's a cheap check and it + * simplifies the code. */ - if (((ccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) - && (((ccb->ccb_h.func_code == XPT_SCSI_IO || - ccb->ccb_h.func_code == XPT_ATA_IO) - && ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE)) - || (ccb->ccb_h.func_code == XPT_DEV_MATCH) - || (ccb->ccb_h.func_code == XPT_SMP_IO) - || ((ccb->ccb_h.func_code == XPT_DEV_ADVINFO) - && (ccb->cdai.bufsiz > 0)))) { - + fc = ccb->ccb_h.func_code; + if ((fc == XPT_SCSI_IO) || (fc == XPT_ATA_IO) || (fc == XPT_SMP_IO) + || (fc == XPT_DEV_MATCH) || (fc == XPT_DEV_ADVINFO)) { bzero(&mapinfo, sizeof(mapinfo)); /* @@ -726,13 +710,9 @@ passsendccb(struct cam_periph *periph, u */ if (error) return(error); - - /* - * We successfully mapped the memory in, so we need to - * unmap it when the transaction is done. - */ - need_unmap = 1; - } + } else + /* Ensure that the unmap call later on is a no-op. */ + mapinfo.num_bufs_used = 0; /* * If the user wants us to perform any error recovery, then honor @@ -744,8 +724,7 @@ passsendccb(struct cam_periph *periph, u SF_RETRY_UA : SF_NO_RECOVERY) | SF_NO_PRINT, softc->device_stats); - if (need_unmap != 0) - cam_periph_unmapmem(ccb, &mapinfo); + cam_periph_unmapmem(ccb, &mapinfo); ccb->ccb_h.cbfcnp = NULL; ccb->ccb_h.periph_priv = inccb->ccb_h.periph_priv; Modified: head/sys/cam/scsi/scsi_sg.c ============================================================================== --- head/sys/cam/scsi/scsi_sg.c Thu Jun 6 23:21:41 2013 (r251478) +++ head/sys/cam/scsi/scsi_sg.c Fri Jun 7 00:22:38 2013 (r251479) @@ -946,25 +946,23 @@ sgsendccb(struct cam_periph *periph, uni { struct sg_softc *softc; struct cam_periph_map_info mapinfo; - int error, need_unmap = 0; + int error; softc = periph->softc; - if (((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) - && (ccb->csio.data_ptr != NULL)) { - bzero(&mapinfo, sizeof(mapinfo)); - - /* - * cam_periph_mapmem calls into proc and vm functions that can - * sleep as well as trigger I/O, so we can't hold the lock. - * Dropping it here is reasonably safe. - */ - cam_periph_unlock(periph); - error = cam_periph_mapmem(ccb, &mapinfo); - cam_periph_lock(periph); - if (error) - return (error); - need_unmap = 1; - } + bzero(&mapinfo, sizeof(mapinfo)); + + /* + * cam_periph_mapmem calls into proc and vm functions that can + * sleep as well as trigger I/O, so we can't hold the lock. + * Dropping it here is reasonably safe. + * The only CCB opcode that is possible here is XPT_SCSI_IO, no + * need for additional checks. + */ + cam_periph_unlock(periph); + error = cam_periph_mapmem(ccb, &mapinfo); + cam_periph_lock(periph); + if (error) + return (error); error = cam_periph_runccb(ccb, sgerror, @@ -972,8 +970,7 @@ sgsendccb(struct cam_periph *periph, uni SF_RETRY_UA, softc->device_stats); - if (need_unmap) - cam_periph_unmapmem(ccb, &mapinfo); + cam_periph_unmapmem(ccb, &mapinfo); return (error); } Modified: head/sys/cam/scsi/scsi_target.c ============================================================================== --- head/sys/cam/scsi/scsi_target.c Thu Jun 6 23:21:41 2013 (r251478) +++ head/sys/cam/scsi/scsi_target.c Fri Jun 7 00:22:38 2013 (r251479) @@ -726,21 +726,8 @@ targsendccb(struct targ_softc *softc, un ccb_h->cbfcnp = targdone; ccb_h->targ_descr = descr; - /* - * We only attempt to map the user memory into kernel space - * if they haven't passed in a physical memory pointer, - * and if there is actually an I/O operation to perform. - * Right now cam_periph_mapmem() only supports SCSI and device - * match CCBs. For the SCSI CCBs, we only pass the CCB in if - * there's actually data to map. cam_periph_mapmem() will do the - * right thing, even if there isn't data to map, but since CCBs - * without data are a reasonably common occurrence (e.g. test unit - * ready), it will save a few cycles if we check for it here. - */ - if (((ccb_h->flags & CAM_DATA_MASK) == CAM_DATA_VADDR) - && (((ccb_h->func_code == XPT_CONT_TARGET_IO) - && ((ccb_h->flags & CAM_DIR_MASK) != CAM_DIR_NONE)) - || (ccb_h->func_code == XPT_DEV_MATCH))) { + if ((ccb_h->func_code == XPT_CONT_TARGET_IO) || + (ccb_h->func_code == XPT_DEV_MATCH)) { error = cam_periph_mapmem(ccb, mapinfo); From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 00:48:01 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D2C16F2C; Fri, 7 Jun 2013 00:48:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C37AD1ED9; Fri, 7 Jun 2013 00:48:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r570m16h071850; Fri, 7 Jun 2013 00:48:01 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r570m1U1071849; Fri, 7 Jun 2013 00:48:01 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306070048.r570m1U1071849@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 7 Jun 2013 00:48:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251480 - head/gnu/usr.bin/cc/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 00:48:01 -0000 Author: pfg Date: Fri Jun 7 00:48:01 2013 New Revision: 251480 URL: http://svnweb.freebsd.org/changeset/base/251480 Log: gcc: install AMD intrinsics header ammintrin.h This file was included in the changes from r251212 and originated in the pre-GPLv3 gcc43 branch. MFC after: 2 weeks Modified: head/gnu/usr.bin/cc/include/Makefile Modified: head/gnu/usr.bin/cc/include/Makefile ============================================================================== --- head/gnu/usr.bin/cc/include/Makefile Fri Jun 7 00:22:38 2013 (r251479) +++ head/gnu/usr.bin/cc/include/Makefile Fri Jun 7 00:48:01 2013 (r251480) @@ -9,8 +9,8 @@ INCSDIR=${INCLUDEDIR}/gcc/${GCCVER} .PATH: ${GCCDIR}/config/${GCC_CPU} .if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64" -INCS= emmintrin.h mmintrin.h mm3dnow.h pmmintrin.h tmmintrin.h xmmintrin.h \ - mm_malloc.h +INCS= ammintrin.h emmintrin.h mmintrin.h mm3dnow.h pmmintrin.h \ + tmmintrin.h xmmintrin.h mm_malloc.h .elif ${TARGET_ARCH} == "ia64" INCS= ia64intrin.h .elif ${TARGET_ARCH} == "arm" From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 01:01:40 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 11D3D319; Fri, 7 Jun 2013 01:01:40 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 040261F4A; Fri, 7 Jun 2013 01:01:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5711das077231; Fri, 7 Jun 2013 01:01:39 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5711dWn077230; Fri, 7 Jun 2013 01:01:39 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201306070101.r5711dWn077230@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 7 Jun 2013 01:01:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251481 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 01:01:40 -0000 Author: yongari Date: Fri Jun 7 01:01:39 2013 New Revision: 251481 URL: http://svnweb.freebsd.org/changeset/base/251481 Log: Do not report current link status if driver is not running. Reporting link status in driver has a side-effect that makes mii(4) check current link status. mii(4) will call link status change callback when it sees link state change. Normally this wouldn't have problems. However, ASF/IPMI firmware can actively access PHY regardless of driver's running state such that reporting link status for not-running interface can generate meaningless link UP/DOWN messages. This change also makes dhclient think driver got a valid link regardless of link establishment so it will bypass dhclient's initial link status check. I think that wouldn't be issue though. Tested by: Daniel Braniss Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Fri Jun 7 00:48:01 2013 (r251480) +++ head/sys/dev/bge/if_bge.c Fri Jun 7 01:01:39 2013 (r251481) @@ -5583,6 +5583,10 @@ bge_ifmedia_sts(struct ifnet *ifp, struc BGE_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + BGE_UNLOCK(sc); + return; + } if (sc->bge_flags & BGE_FLAG_TBI) { ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 01:21:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E660773B; Fri, 7 Jun 2013 01:21:09 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D76C31FF1; Fri, 7 Jun 2013 01:21:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r571L97S083785; Fri, 7 Jun 2013 01:21:09 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r571L9bM083782; Fri, 7 Jun 2013 01:21:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201306070121.r571L9bM083782@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 7 Jun 2013 01:21:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251482 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 01:21:10 -0000 Author: yongari Date: Fri Jun 7 01:21:09 2013 New Revision: 251482 URL: http://svnweb.freebsd.org/changeset/base/251482 Log: Correct setting TX random backoff register. This register is implemented as a 10 bits linear feedback shift register so only lower 10 bits are valid. Because this register is used to initialize random backoff interval register only when resolved duplex is half-duplex, it wouldn't have caused issues in these days. Submitted by: Masanobu SAITOH Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Fri Jun 7 01:01:39 2013 (r251481) +++ head/sys/dev/bge/if_bge.c Fri Jun 7 01:21:09 2013 (r251482) @@ -2280,9 +2280,9 @@ bge_blockinit(struct bge_softc *sc) /* Set random backoff seed for TX */ CSR_WRITE_4(sc, BGE_TX_RANDOM_BACKOFF, - IF_LLADDR(sc->bge_ifp)[0] + IF_LLADDR(sc->bge_ifp)[1] + + (IF_LLADDR(sc->bge_ifp)[0] + IF_LLADDR(sc->bge_ifp)[1] + IF_LLADDR(sc->bge_ifp)[2] + IF_LLADDR(sc->bge_ifp)[3] + - IF_LLADDR(sc->bge_ifp)[4] + IF_LLADDR(sc->bge_ifp)[5] + + IF_LLADDR(sc->bge_ifp)[4] + IF_LLADDR(sc->bge_ifp)[5]) & BGE_TX_BACKOFF_SEED_MASK); /* Set inter-packet gap */ Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Fri Jun 7 01:01:39 2013 (r251481) +++ head/sys/dev/bge/if_bgereg.h Fri Jun 7 01:21:09 2013 (r251482) @@ -797,7 +797,7 @@ #define BGE_LEDCTL_BLINKPERIOD_OVERRIDE 0x80000000 /* TX backoff seed register */ -#define BGE_TX_BACKOFF_SEED_MASK 0x3F +#define BGE_TX_BACKOFF_SEED_MASK 0x3FF /* Autopoll status register */ #define BGE_AUTOPOLLSTS_ERROR 0x00000001 From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 05:18:01 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0959796B; Fri, 7 Jun 2013 05:18:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DEED619A2; Fri, 7 Jun 2013 05:18:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r575I0kr057342; Fri, 7 Jun 2013 05:18:00 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r575Hxdv057327; Fri, 7 Jun 2013 05:17:59 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306070517.r575Hxdv057327@svn.freebsd.org> From: Adrian Chadd Date: Fri, 7 Jun 2013 05:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251483 - in head/sys/dev/ath/ath_hal: . ar5416 ar9002 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 05:18:01 -0000 Author: adrian Date: Fri Jun 7 05:17:58 2013 New Revision: 251483 URL: http://svnweb.freebsd.org/changeset/base/251483 Log: Add bluetooth fixes to the AR5416/AR92xx HAL: * Call the bluetooth setup function during the reset path, so the bluetooth settings are actually initialised. * Call the AR9285 diversity functions during bluetooth setup; so the AR9285 diversity and antenna configuration registers are correctly programmed * Misc debugging info. Tested: * AR9285+AR3011 bluetooth combo; this code itself doesn't enable bluetooth coexistence but it's part of what I'm currently using. Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c head/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ah.h Fri Jun 7 05:17:58 2013 (r251483) @@ -1581,7 +1581,7 @@ struct ath_hal { uint32_t); void __ahdecl(*ah_btCoexSetBmissThresh)(struct ath_hal *, uint32_t); - void __ahdecl(*ah_btcoexSetParameter)(struct ath_hal *, + void __ahdecl(*ah_btCoexSetParameter)(struct ath_hal *, uint32_t, uint32_t); void __ahdecl(*ah_btCoexDisable)(struct ath_hal *); int __ahdecl(*ah_btCoexEnable)(struct ath_hal *); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Jun 7 05:17:58 2013 (r251483) @@ -207,7 +207,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_btCoexSetQcuThresh = ar5416BTCoexSetQcuThresh; ah->ah_btCoexSetWeights = ar5416BTCoexSetWeights; ah->ah_btCoexSetBmissThresh = ar5416BTCoexSetupBmissThresh; - ah->ah_btcoexSetParameter = ar5416BTCoexSetParameter; + ah->ah_btCoexSetParameter = ar5416BTCoexSetParameter; ah->ah_btCoexDisable = ar5416BTCoexDisable; ah->ah_btCoexEnable = ar5416BTCoexEnable; AH5416(ah)->ah_btCoexSetDiversity = ar5416BTCoexAntennaDiversity; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c Fri Jun 7 05:17:58 2013 (r251483) @@ -328,6 +328,11 @@ ar5416InitBTCoex(struct ath_hal *ah) { struct ath_hal_5416 *ahp = AH5416(ah); + HALDEBUG(ah, HAL_DEBUG_BT_COEX, + "%s: called; configType=%d\n", + __func__, + ahp->ah_btCoexConfigType); + if (ahp->ah_btCoexConfigType == HAL_BT_COEX_CFG_3WIRE) { OS_REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB | Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri Jun 7 05:17:58 2013 (r251483) @@ -289,6 +289,12 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO ar5416StartTsf2(ah); #endif + /* + * Enable Bluetooth Coexistence if it's enabled. + */ + if (AH5416(ah)->ah_btCoexConfigType != HAL_BT_COEX_CFG_NONE) + ar5416InitBTCoex(ah); + /* Restore previous antenna */ OS_REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna); Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Fri Jun 7 05:17:58 2013 (r251483) @@ -172,14 +172,14 @@ ar9285Attach(uint16_t devid, HAL_SOFTC s /* override with 9285 specific state */ AH5416(ah)->ah_initPLL = ar9280InitPLL; - AH5416(ah)->ah_btCoexSetDiversity = ar5416BTCoexAntennaDiversity; + AH5416(ah)->ah_btCoexSetDiversity = ar9285BTCoexAntennaDiversity; ah->ah_setAntennaSwitch = ar9285SetAntennaSwitch; ah->ah_configPCIE = ar9285ConfigPCIE; ah->ah_disablePCIE = ar9285DisablePCIE; ah->ah_setTxPower = ar9285SetTransmitPower; ah->ah_setBoardValues = ar9285SetBoardValues; - ah->ah_btcoexSetParameter = ar9285BTCoexSetParameter; + ah->ah_btCoexSetParameter = ar9285BTCoexSetParameter; AH5416(ah)->ah_cal.iqCalData.calData = &ar9280_iq_cal; AH5416(ah)->ah_cal.adcGainCalData.calData = &ar9280_adc_gain_cal; @@ -543,7 +543,7 @@ ar9285FillCapabilityInfo(struct ath_hal pCap->halRtsAggrLimit = 64*1024; /* 802.11n max */ pCap->halExtChanDfsSupport = AH_TRUE; pCap->halUseCombinedRadarRssi = AH_TRUE; -#if 0 +#if 1 /* XXX bluetooth */ pCap->halBtCoexSupport = AH_TRUE; #endif Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c Fri Jun 7 01:21:09 2013 (r251482) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c Fri Jun 7 05:17:58 2013 (r251483) @@ -47,6 +47,12 @@ ar9285BTCoexAntennaDiversity(struct ath_ u_int32_t regVal; u_int8_t ant_div_control1, ant_div_control2; + HALDEBUG(ah, HAL_DEBUG_BT_COEX, + "%s: btCoexFlag: ALLOW=%d, ENABLE=%d\n", + __func__, + !! (ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ALLOW), + !! (ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE)); + if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ALLOW) || (AH5212(ah)->ah_diversity != HAL_ANT_VARIABLE)) { if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE) && From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 05:18:08 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5CE4AAB9; Fri, 7 Jun 2013 05:18:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 50E0F19A3; Fri, 7 Jun 2013 05:18:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r575I8Gq057412; Fri, 7 Jun 2013 05:18:08 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r575I8JX057411; Fri, 7 Jun 2013 05:18:08 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306070518.r575I8JX057411@svn.freebsd.org> From: Adrian Chadd Date: Fri, 7 Jun 2013 05:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251484 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 05:18:08 -0000 Author: adrian Date: Fri Jun 7 05:18:07 2013 New Revision: 251484 URL: http://svnweb.freebsd.org/changeset/base/251484 Log: Add accessor macros for the bluetooth coexistence routines. Modified: head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Fri Jun 7 05:17:58 2013 (r251483) +++ head/sys/dev/ath/if_athvar.h Fri Jun 7 05:18:07 2013 (r251484) @@ -1437,4 +1437,25 @@ void ath_intr(void *); #define ath_hal_spectral_stop(_ah) \ ((*(_ah)->ah_spectralStop)((_ah))) +#define ath_hal_btcoex_supported(_ah) \ + (ath_hal_getcapability(_ah, HAL_CAP_BT_COEX, 0, NULL) == HAL_OK) +#define ath_hal_btcoex_set_info(_ah, _info) \ + ((*(_ah)->ah_btCoexSetInfo)((_ah), (_info))) +#define ath_hal_btcoex_set_config(_ah, _cfg) \ + ((*(_ah)->ah_btCoexSetConfig)((_ah), (_cfg))) +#define ath_hal_btcoex_set_qcu_thresh(_ah, _qcuid) \ + ((*(_ah)->ah_btCoexSetQcuThresh)((_ah), (_qcuid))) +#define ath_hal_btcoex_set_weights(_ah, _weight) \ + ((*(_ah)->ah_btCoexSetWeights)((_ah), (_weight))) +#define ath_hal_btcoex_set_weights(_ah, _weight) \ + ((*(_ah)->ah_btCoexSetWeights)((_ah), (_weight))) +#define ath_hal_btcoex_set_bmiss_thresh(_ah, _thr) \ + ((*(_ah)->ah_btCoexSetBmissThresh)((_ah), (_thr))) +#define ath_hal_btcoex_set_parameter(_ah, _attrib, _val) \ + ((*(_ah)->ah_btCoexSetParameter)((_ah), (_attrib), (_val))) +#define ath_hal_btcoex_enable(_ah) \ + ((*(_ah)->ah_btCoexEnable)((_ah))) +#define ath_hal_btcoex_disable(_ah) \ + ((*(_ah)->ah_btCoexDisable)((_ah))) + #endif /* _DEV_ATH_ATHVAR_H */ From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 07:17:47 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 853477F8; Fri, 7 Jun 2013 07:17:47 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 760131CFC; Fri, 7 Jun 2013 07:17:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r577HlS5095472; Fri, 7 Jun 2013 07:17:47 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r577Hl89095471; Fri, 7 Jun 2013 07:17:47 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201306070717.r577Hl89095471@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 7 Jun 2013 07:17:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251485 - head/sbin/mount X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 07:17:47 -0000 Author: jh Date: Fri Jun 7 07:17:46 2013 New Revision: 251485 URL: http://svnweb.freebsd.org/changeset/base/251485 Log: Revert r238399. The "failok" option doesn't have any effect at all unless specified in fstab(5) and combined with the -a flag. The "failok" option is already documented in fstab(5). PR: 177630 No objection: eadler MFC after: 1 week Modified: head/sbin/mount/mount.8 Modified: head/sbin/mount/mount.8 ============================================================================== --- head/sbin/mount/mount.8 Fri Jun 7 05:18:07 2013 (r251484) +++ head/sbin/mount/mount.8 Fri Jun 7 07:17:46 2013 (r251485) @@ -28,7 +28,7 @@ .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" $FreeBSD$ .\" -.Dd July 12, 2012 +.Dd June 6, 2011 .Dt MOUNT 8 .Os .Sh NAME @@ -152,11 +152,6 @@ When used with the .Fl u flag, this is the same as specifying the options currently in effect for the mounted file system. -.It Cm failok -If this option is specified, -.Nm -will return 0 even if an error occurs -during the mount of the filesystem. .It Cm force The same as .Fl f ; From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 08:06:48 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C8B5E3D2; Fri, 7 Jun 2013 08:06:48 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BB7A81F22; Fri, 7 Jun 2013 08:06:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5786m2u011996; Fri, 7 Jun 2013 08:06:48 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5786m5m011995; Fri, 7 Jun 2013 08:06:48 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201306070806.r5786m5m011995@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 7 Jun 2013 08:06:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251486 - head/usr.bin/kdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 08:06:48 -0000 Author: ae Date: Fri Jun 7 08:06:48 2013 New Revision: 251486 URL: http://svnweb.freebsd.org/changeset/base/251486 Log: Use getnameinfo(3) instead of inet_ntop(3) to make printable versions of sockaddr_in6 structures. getnameinfo(3) does the same thing, but it is also able to represent a scope zone id as described in the RFC 4007. MFC after: 2 weeks Modified: head/usr.bin/kdump/kdump.c Modified: head/usr.bin/kdump/kdump.c ============================================================================== --- head/usr.bin/kdump/kdump.c Fri Jun 7 07:17:46 2013 (r251485) +++ head/usr.bin/kdump/kdump.c Fri Jun 7 08:06:48 2013 (r251486) @@ -74,6 +74,7 @@ extern int errno; #include #include #include +#include #include #include #include @@ -1531,7 +1532,8 @@ ktrsockaddr(struct sockaddr *sa) memset(&sa_in6, 0, sizeof(sa_in6)); memcpy(&sa_in6, sa, sa->sa_len); check_sockaddr_len(in6); - inet_ntop(AF_INET6, &sa_in6.sin6_addr, addr, sizeof addr); + getnameinfo((struct sockaddr *)&sa_in6, sizeof(sa_in6), + addr, sizeof(addr), NULL, 0, NI_NUMERICHOST); printf("[%s]:%u", addr, htons(sa_in6.sin6_port)); break; } From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 09:02:03 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A4003DD1; Fri, 7 Jun 2013 09:02:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9563A11E1; Fri, 7 Jun 2013 09:02:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57923xw030615; Fri, 7 Jun 2013 09:02:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57922vx030605; Fri, 7 Jun 2013 09:02:02 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306070902.r57922vx030605@svn.freebsd.org> From: Adrian Chadd Date: Fri, 7 Jun 2013 09:02:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251487 - in head/sys: conf dev/ath modules/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 09:02:03 -0000 Author: adrian Date: Fri Jun 7 09:02:02 2013 New Revision: 251487 URL: http://svnweb.freebsd.org/changeset/base/251487 Log: Bring over the initial static bluetooth coexistence configuration for the WB195 combo NIC - an AR9285 w/ an AR3011 USB bluetooth NIC. The AR3011 is wired up using a 3-wire coexistence scheme to the AR9285. The code in if_ath_btcoex.c sets up the initial hardware mapping and coexistence configuration. There's nothing special about it - it's static; it doesn't try to configure bluetooth / MAC traffic priorities or try to figure out what's actually going on. It's enough to stop basic bluetooth traffic from causing traffic stalls and diassociation from the wireless network. To use this code, you must have the above NIC. No, it won't work for the AR9287+AR3012, nor the AR9485, AR9462 or AR955x combo cards. Then you set a kernel hint before boot or before kldload, where 'X' is the unit number of your AR9285 NIC: # kenv hint.ath.X.btcoex_profile=wb195 This will then appear in your boot messages: [100482] athX: Enabling WB195 BTCOEX This code is going to evolve pretty quickly (well, depending upon my spare time) so don't assume the btcoex API is going to stay stable. In order to use the bluetooth side, you must also load in firmware using ath3kfw and the binary firmware file (ath3k-1.fw in my case.) Tested: * AR9280, no interference * WB195 - AR9285 + AR3011 combo; STA mode; basic bluetooth inquiries were enough to cause traffic stalls and disassociations. This has stopped with the btcoex profile code. TODO: * Importantly - the AR9285 needs ASPM disabled if bluetooth coexistence is enabled. No, I don't know why. It's likely some kind of bug to do with the AR3011 sending bluetooth coexistence signals whilst the device is asleep. Since we don't actually sleep the MAC just yet, it shouldn't be a problem. That said, to be totally correct: + ASPM should be disabled - upon attach and wakeup + The PCIe powersave HAL code should never be called Look at what the ath9k driver does for inspiration. * Add WB197 (AR9287+AR3012) support * Add support for the AR9485, which is another combo like the AR9285 * The later NICs have a different signaling mechanism between the MAC and the bluetooth device; I haven't even begun to experiment with making that HAL code work. But it should be a lot more automatic. * The hardware can do much more interesting traffic weighting with bluetooth and wifi traffic. None of this is currently used. Ideally someone would code up something to watch the bluetooth traffic GPIO (via an interrupt) and then watch it go high/low; then figure out what the bluetooth traffic is and adjust things appropriately. * If I get the time I may add in some code to at least track this stuff and expose statistics. But it's up to someone else to experiment with the bluetooth coexistence support and add the interesting stuff (like "real" detection of bulk, audio, etc bluetooth traffic patterns and change wifi parameters appropriately - eg, maximum aggregate length, transmit power, using quiet time to control TX duty cycle, etc.) Added: head/sys/dev/ath/if_ath_btcoex.c (contents, props changed) head/sys/dev/ath/if_ath_btcoex.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/ath/if_ath.c head/sys/modules/ath/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Jun 7 08:06:48 2013 (r251486) +++ head/sys/conf/files Fri Jun 7 09:02:02 2013 (r251487) @@ -725,6 +725,8 @@ dev/ath/if_ath.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_beacon.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" +dev/ath/if_ath_btcoex.c optional ath \ + compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_debug.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_keycache.c optional ath \ Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Jun 7 08:06:48 2013 (r251486) +++ head/sys/dev/ath/if_ath.c Fri Jun 7 09:02:02 2013 (r251487) @@ -111,6 +111,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -521,6 +522,14 @@ ath_attach(u_int16_t devid, struct ath_s goto bad2; } + /* Attach bluetooth coexistence module */ + if (ath_btcoex_attach(sc) < 0) { + device_printf(sc->sc_dev, + "%s: unable to attach bluetooth coexistence\n", __func__); + error = EIO; + goto bad2; + } + /* Start DFS processing tasklet */ TASK_INIT(&sc->sc_dfstask, 0, ath_dfs_tasklet, sc); @@ -1029,6 +1038,7 @@ ath_detach(struct ath_softc *sc) #ifdef ATH_DEBUG_ALQ if_ath_alq_tidyup(&sc->sc_alq); #endif + ath_btcoex_detach(sc); ath_spectral_detach(sc); ath_dfs_detach(sc); ath_desc_free(sc); @@ -1589,6 +1599,11 @@ ath_resume(struct ath_softc *sc) ath_spectral_enable(sc, ic->ic_curchan); /* + * Let bluetooth coexistence at in case it's needed for this channel + */ + ath_btcoex_enable(sc, ic->ic_curchan); + + /* * If we're doing TDMA, enforce the TXOP limitation for chips that * support it. */ @@ -2045,6 +2060,11 @@ ath_init(void *arg) ath_spectral_enable(sc, ic->ic_curchan); /* + * Let bluetooth coexistence at in case it's needed for this channel + */ + ath_btcoex_enable(sc, ic->ic_curchan); + + /* * If we're doing TDMA, enforce the TXOP limitation for chips that * support it. */ @@ -2384,6 +2404,11 @@ ath_reset(struct ifnet *ifp, ATH_RESET_T ath_spectral_enable(sc, ic->ic_curchan); /* + * Let bluetooth coexistence at in case it's needed for this channel + */ + ath_btcoex_enable(sc, ic->ic_curchan); + + /* * If we're doing TDMA, enforce the TXOP limitation for chips that * support it. */ @@ -4946,6 +4971,12 @@ ath_chan_set(struct ath_softc *sc, struc ath_spectral_enable(sc, chan); /* + * Let bluetooth coexistence at in case it's needed for this + * channel + */ + ath_btcoex_enable(sc, ic->ic_curchan); + + /* * If we're doing TDMA, enforce the TXOP limitation for chips * that support it. */ Added: head/sys/dev/ath/if_ath_btcoex.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ath/if_ath_btcoex.c Fri Jun 7 09:02:02 2013 (r251487) @@ -0,0 +1,281 @@ +/*- + * Copyright (c) 2013 Adrian Chadd + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ +#include +__FBSDID("$FreeBSD$"); + +/* + * This implements some very basic bluetooth coexistence methods for + * the ath(4) hardware. + */ +#include "opt_ath.h" +#include "opt_inet.h" +#include "opt_wlan.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include /* XXX for ether_sprintf */ + +#include + +#include + +#ifdef INET +#include +#include +#endif + +#include +#include + +/* + * Initial AR9285 / (WB195) bluetooth coexistence settings, + * just for experimentation. + * + * Return 0 for OK; errno for error. + * + * XXX TODO: There needs to be a PCIe workaround to disable ASPM if + * bluetooth coexistence is enabled. + */ +static int +ath_btcoex_cfg_wb195(struct ath_softc *sc) +{ + HAL_BT_COEX_INFO btinfo; + HAL_BT_COEX_CONFIG btconfig; + struct ath_hal *ah = sc->sc_ah; + + if (! ath_hal_btcoex_supported(ah)) + return (EINVAL); + + bzero(&btinfo, sizeof(btinfo)); + bzero(&btconfig, sizeof(btconfig)); + + device_printf(sc->sc_dev, "Enabling WB195 BTCOEX\n"); + + btinfo.bt_module = HAL_BT_MODULE_JANUS; + btinfo.bt_coex_config = HAL_BT_COEX_CFG_3WIRE; + /* + * These are the three GPIO pins hooked up between the AR9285 and + * the AR3011. + */ + btinfo.bt_gpio_bt_active = 6; + btinfo.bt_gpio_bt_priority = 7; + btinfo.bt_gpio_wlan_active = 5; + btinfo.bt_active_polarity = 1; /* XXX not used */ + btinfo.bt_single_ant = 1; /* 1 antenna on ar9285 ? */ + btinfo.bt_isolation = 0; /* in dB, not used */ + + ath_hal_btcoex_set_info(ah, &btinfo); + + btconfig.bt_time_extend = 0; + btconfig.bt_txstate_extend = 1; /* true */ + btconfig.bt_txframe_extend = 1; /* true */ + btconfig.bt_mode = HAL_BT_COEX_MODE_SLOTTED; + btconfig.bt_quiet_collision = 1; /* true */ + btconfig.bt_rxclear_polarity = 1; /* true */ + btconfig.bt_priority_time = 2; + btconfig.bt_first_slot_time = 5; + btconfig.bt_hold_rxclear = 1; /* true */ + + ath_hal_btcoex_set_config(ah, &btconfig); + + /* + * Enable antenna diversity. + */ + ath_hal_btcoex_set_parameter(ah, HAL_BT_COEX_ANTENNA_DIVERSITY, 1); + + return (0); +} + +#if 0 +/* + * When using bluetooth coexistence, ASPM needs to be disabled + * otherwise the sleeping interferes with the bluetooth (USB) + * operation and the MAC sleep/wakeup hardware. + */ +static int +ath_btcoex_aspm_wb195(struct ath_softc *sc) +{ + + /* XXX TODO: clear device ASPM L0S and L1 */ + /* XXX TODO: clear _parent_ ASPM L0S and L1 */ +} +#endif + +/* + * Methods which are required + */ + +/* + * Attach btcoex to the given interface + */ +int +ath_btcoex_attach(struct ath_softc *sc) +{ + int ret; + struct ath_hal *ah = sc->sc_ah; + const char *profname; + + /* + * No chipset bluetooth coexistence? Then do nothing. + */ + if (! ath_hal_btcoex_supported(ah)) + return (0); + + /* + * Look at the hints to determine which bluetooth + * profile to configure. + */ + ret = resource_string_value(device_get_name(sc->sc_dev), + device_get_unit(sc->sc_dev), + "btcoex_profile", + &profname); + if (ret != 0) { + /* nothing to do */ + return (0); + } + + if (strncmp(profname, "wb195", 5) == 0) { + ret = ath_btcoex_cfg_wb195(sc); + } else { + return (0); + } + + /* + * Propagate up failure from the actual attach phase. + */ + if (ret != 0) + return (ret); + + return (0); +} + +/* + * Detach btcoex from the given interface + */ +int +ath_btcoex_detach(struct ath_softc *sc) +{ + + return (0); +} + +/* + * Configure or disable bluetooth coexistence on the given channel. + * + * For AR9285/AR9287/AR9485, we'll never see a 5GHz channel, so we just + * assume bluetooth coexistence is always on. + * + * For AR9462, we may see a 5GHz channel; bluetooth coexistence should + * not be enabled on those channels. + */ +int +ath_btcoex_enable(struct ath_softc *sc, const struct ieee80211_channel *chan) +{ + + return (0); +} + +/* + * Handle ioctl requests from the diagnostic interface. + * + * The initial part of this code resembles ath_ioctl_diag(); + * it's likely a good idea to reduce duplication between + * these two routines. + */ +int +ath_btcoex_ioctl(struct ath_softc *sc, struct ath_diag *ad) +{ + unsigned int id = ad->ad_id & ATH_DIAG_ID; + void *indata = NULL; + void *outdata = NULL; + u_int32_t insize = ad->ad_in_size; + u_int32_t outsize = ad->ad_out_size; + int error = 0; +// int val; + + if (ad->ad_id & ATH_DIAG_IN) { + /* + * Copy in data. + */ + indata = malloc(insize, M_TEMP, M_NOWAIT); + if (indata == NULL) { + error = ENOMEM; + goto bad; + } + error = copyin(ad->ad_in_data, indata, insize); + if (error) + goto bad; + } + if (ad->ad_id & ATH_DIAG_DYN) { + /* + * Allocate a buffer for the results (otherwise the HAL + * returns a pointer to a buffer where we can read the + * results). Note that we depend on the HAL leaving this + * pointer for us to use below in reclaiming the buffer; + * may want to be more defensive. + */ + outdata = malloc(outsize, M_TEMP, M_NOWAIT); + if (outdata == NULL) { + error = ENOMEM; + goto bad; + } + } + switch (id) { + default: + error = EINVAL; + } + if (outsize < ad->ad_out_size) + ad->ad_out_size = outsize; + if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_size)) + error = EFAULT; +bad: + if ((ad->ad_id & ATH_DIAG_IN) && indata != NULL) + free(indata, M_TEMP); + if ((ad->ad_id & ATH_DIAG_DYN) && outdata != NULL) + free(outdata, M_TEMP); + return (error); +} + Added: head/sys/dev/ath/if_ath_btcoex.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ath/if_ath_btcoex.h Fri Jun 7 09:02:02 2013 (r251487) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2013 Adrian Chadd + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ +#ifndef __IF_ATH_BTCOEX_H__ +#define __IF_ATH_BTCOEX_H__ + +extern int ath_btcoex_attach(struct ath_softc *sc); +extern int ath_btcoex_detach(struct ath_softc *sc); +extern int ath_btcoex_ioctl(struct ath_softc *sc, struct ath_diag *ad); +extern int ath_btcoex_enable(struct ath_softc *sc, + const struct ieee80211_channel *ch); + +#endif /* __IF_ATH_BTCOEX_H__ */ Modified: head/sys/modules/ath/Makefile ============================================================================== --- head/sys/modules/ath/Makefile Fri Jun 7 08:06:48 2013 (r251486) +++ head/sys/modules/ath/Makefile Fri Jun 7 09:02:02 2013 (r251487) @@ -38,6 +38,7 @@ KMOD= if_ath SRCS= if_ath.c if_ath_alq.c if_ath_debug.c if_ath_keycache.c if_ath_sysctl.c SRCS+= if_ath_tx.c if_ath_tx_ht.c if_ath_led.c if_ath_rx.c if_ath_tdma.c SRCS+= if_ath_beacon.c if_ath_rx_edma.c if_ath_tx_edma.c if_ath_spectral.c +SRCS+= if_ath_btcoex.c # NB: v3 eeprom support used by both AR5211 and AR5212; just include it SRCS+= ah_osdep.c ah.c ah_regdomain.c ah_eeprom_v3.c SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 09:03:57 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5C948F73; Fri, 7 Jun 2013 09:03:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4F7F511F9; Fri, 7 Jun 2013 09:03:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5793vrs030952; Fri, 7 Jun 2013 09:03:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5793vj7030951; Fri, 7 Jun 2013 09:03:57 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306070903.r5793vj7030951@svn.freebsd.org> From: Adrian Chadd Date: Fri, 7 Jun 2013 09:03:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251488 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 09:03:57 -0000 Author: adrian Date: Fri Jun 7 09:03:56 2013 New Revision: 251488 URL: http://svnweb.freebsd.org/changeset/base/251488 Log: Don't hold the node lock over the iterator. The "find node" function call will increase the node reference anyway; so there's no reason to hold the node table lock during the MLME change. The only reason I could think of is to stop overlapping mlme ioctls from causing issues, but this should be fixed a different way. This fixes a whole class of LORs that creep up when nodes are being timed out or removed by hostapd. Tested: * AR5416, hostap, with nodes coming and going. No LORs or stability issues were observed. Modified: head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Fri Jun 7 09:02:02 2013 (r251487) +++ head/sys/net80211/ieee80211_ioctl.c Fri Jun 7 09:03:56 2013 (r251488) @@ -1340,12 +1340,17 @@ setmlme_dropsta(struct ieee80211vap *vap if (!IEEE80211_ADDR_EQ(mac, ic->ic_ifp->if_broadcastaddr)) { IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_node_locked(nt, mac); + IEEE80211_NODE_UNLOCK(nt); + /* + * Don't do the node update inside the node + * table lock. This unfortunately causes LORs + * with drivers and their TX paths. + */ if (ni != NULL) { domlme(mlmeop, ni); ieee80211_free_node(ni); } else error = ENOENT; - IEEE80211_NODE_UNLOCK(nt); } else { ieee80211_iterate_nodes(nt, domlme, mlmeop); } @@ -1400,13 +1405,18 @@ setmlme_common(struct ieee80211vap *vap, case IEEE80211_M_MBSS: IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_node_locked(nt, mac); + /* + * Don't do the node update inside the node + * table lock. This unfortunately causes LORs + * with drivers and their TX paths. + */ + IEEE80211_NODE_UNLOCK(nt); if (ni != NULL) { ieee80211_node_leave(ni); ieee80211_free_node(ni); } else { error = ENOENT; } - IEEE80211_NODE_UNLOCK(nt); break; default: error = EINVAL; @@ -1422,6 +1432,12 @@ setmlme_common(struct ieee80211vap *vap, } IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_vap_node_locked(nt, vap, mac); + /* + * Don't do the node update inside the node + * table lock. This unfortunately causes LORs + * with drivers and their TX paths. + */ + IEEE80211_NODE_UNLOCK(nt); if (ni != NULL) { mlmedebug(vap, mac, op, reason); if (op == IEEE80211_MLME_AUTHORIZE) @@ -1431,7 +1447,6 @@ setmlme_common(struct ieee80211vap *vap, ieee80211_free_node(ni); } else error = ENOENT; - IEEE80211_NODE_UNLOCK(nt); break; case IEEE80211_MLME_AUTH: if (vap->iv_opmode != IEEE80211_M_HOSTAP) { @@ -1440,6 +1455,12 @@ setmlme_common(struct ieee80211vap *vap, } IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_vap_node_locked(nt, vap, mac); + /* + * Don't do the node update inside the node + * table lock. This unfortunately causes LORs + * with drivers and their TX paths. + */ + IEEE80211_NODE_UNLOCK(nt); if (ni != NULL) { mlmedebug(vap, mac, op, reason); if (reason == IEEE80211_STATUS_SUCCESS) { @@ -1463,7 +1484,6 @@ setmlme_common(struct ieee80211vap *vap, ieee80211_free_node(ni); } else error = ENOENT; - IEEE80211_NODE_UNLOCK(nt); break; default: error = EINVAL; From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 09:06:50 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9D094245; Fri, 7 Jun 2013 09:06:50 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F1F8122B; Fri, 7 Jun 2013 09:06:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5796owh031505; Fri, 7 Jun 2013 09:06:50 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5796oAp031504; Fri, 7 Jun 2013 09:06:50 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306070906.r5796oAp031504@svn.freebsd.org> From: Hiroki Sato Date: Fri, 7 Jun 2013 09:06:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251489 - stable/8/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 09:06:50 -0000 Author: hrs Date: Fri Jun 7 09:06:50 2013 New Revision: 251489 URL: http://svnweb.freebsd.org/changeset/base/251489 Log: Document a bge(4) issue. Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Fri Jun 7 09:03:56 2013 (r251488) +++ stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Fri Jun 7 09:06:50 2013 (r251489) @@ -206,6 +206,23 @@ Open Issues + [20130607] The &man.bge.4; network interface driver has an + issue when TSO (TCP Segmentation Offload) is enabled. It causes + intermittent reset and re-initialization. + + A workaround is disabling the TSO feature. One can disable + it by adding the following line into the &man.rc.conf.5; + file: + + ifconfig_bge0="-tso" + + or by using the &man.ifconfig.8; utility manually: + + &prompt.root; ifconfig bge0 -tso + + A patch to fix this issue will be released as an Errata + Notice. + [20130606] The &man.fxp.4; network interface driver may not work well with the &man.dhclient.8; utility. More specifically, if the /etc/rc.conf has the following From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 10:27:51 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6AEAF94A; Fri, 7 Jun 2013 10:27:51 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5DB6516A3; Fri, 7 Jun 2013 10:27:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57ARpad056607; Fri, 7 Jun 2013 10:27:51 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57ARpaF056606; Fri, 7 Jun 2013 10:27:51 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201306071027.r57ARpaF056606@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 7 Jun 2013 10:27:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251490 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 10:27:51 -0000 Author: trociny Date: Fri Jun 7 10:27:50 2013 New Revision: 251490 URL: http://svnweb.freebsd.org/changeset/base/251490 Log: Properly set curvnet context in lagg_port_setlladdr() task handler. Reported by: Nikos Vassiliadis Submitted by: zec Tested by: Nikos Vassiliadis MFC after: 1 week Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Fri Jun 7 09:06:50 2013 (r251489) +++ head/sys/net/if_lagg.c Fri Jun 7 10:27:50 2013 (r251490) @@ -505,7 +505,9 @@ lagg_port_setlladdr(void *arg, int pendi ifp = llq->llq_ifp; /* Set the link layer address */ + CURVNET_SET(ifp->if_vnet); error = if_setlladdr(ifp, llq->llq_lladdr, ETHER_ADDR_LEN); + CURVNET_RESTORE(); if (error) printf("%s: setlladdr failed on %s\n", __func__, ifp->if_xname); From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 10:33:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A7CAEB67; Fri, 7 Jun 2013 10:33:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 8FE0316DF; Fri, 7 Jun 2013 10:33:15 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id r57AX8du023313; Fri, 7 Jun 2013 14:33:08 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id r57AX81v023312; Fri, 7 Jun 2013 14:33:08 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 7 Jun 2013 14:33:08 +0400 From: Gleb Smirnoff To: Mikolaj Golub , zec@FreeBSD.org, Nikos Vassiliadis Subject: Re: svn commit: r251490 - head/sys/net Message-ID: <20130607103307.GA1187@FreeBSD.org> References: <201306071027.r57ARpaF056606@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201306071027.r57ARpaF056606@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 10:33:16 -0000 On Fri, Jun 07, 2013 at 10:27:51AM +0000, Mikolaj Golub wrote: M> Author: trociny M> Date: Fri Jun 7 10:27:50 2013 M> New Revision: 251490 M> URL: http://svnweb.freebsd.org/changeset/base/251490 M> M> Log: M> Properly set curvnet context in lagg_port_setlladdr() task handler. M> M> Reported by: Nikos Vassiliadis M> Submitted by: zec M> Tested by: Nikos Vassiliadis M> MFC after: 1 week M> M> Modified: M> head/sys/net/if_lagg.c M> M> Modified: head/sys/net/if_lagg.c M> ============================================================================== M> --- head/sys/net/if_lagg.c Fri Jun 7 09:06:50 2013 (r251489) M> +++ head/sys/net/if_lagg.c Fri Jun 7 10:27:50 2013 (r251490) M> @@ -505,7 +505,9 @@ lagg_port_setlladdr(void *arg, int pendi M> ifp = llq->llq_ifp; M> M> /* Set the link layer address */ M> + CURVNET_SET(ifp->if_vnet); M> error = if_setlladdr(ifp, llq->llq_lladdr, ETHER_ADDR_LEN); M> + CURVNET_RESTORE(); M> if (error) M> printf("%s: setlladdr failed on %s\n", __func__, M> ifp->if_xname); IMHO, the entire task function should be embraced into VNET context. -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 10:33:55 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1121DCE5; Fri, 7 Jun 2013 10:33:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 9010516E5; Fri, 7 Jun 2013 10:33:54 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id r57AXrKn023342; Fri, 7 Jun 2013 14:33:53 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id r57AXrps023341; Fri, 7 Jun 2013 14:33:53 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 7 Jun 2013 14:33:53 +0400 From: Gleb Smirnoff To: Mikolaj Golub , zec@FreeBSD.org, Nikos Vassiliadis Subject: Re: svn commit: r251490 - head/sys/net Message-ID: <20130607103353.GB1187@FreeBSD.org> References: <201306071027.r57ARpaF056606@svn.freebsd.org> <20130607103307.GA1187@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20130607103307.GA1187@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 10:33:55 -0000 On Fri, Jun 07, 2013 at 02:33:08PM +0400, Gleb Smirnoff wrote: T> On Fri, Jun 07, 2013 at 10:27:51AM +0000, Mikolaj Golub wrote: T> M> Author: trociny T> M> Date: Fri Jun 7 10:27:50 2013 T> M> New Revision: 251490 T> M> URL: http://svnweb.freebsd.org/changeset/base/251490 T> M> T> M> Log: T> M> Properly set curvnet context in lagg_port_setlladdr() task handler. T> M> T> M> Reported by: Nikos Vassiliadis T> M> Submitted by: zec T> M> Tested by: Nikos Vassiliadis T> M> MFC after: 1 week T> M> T> M> Modified: T> M> head/sys/net/if_lagg.c T> M> T> M> Modified: head/sys/net/if_lagg.c T> M> ============================================================================== T> M> --- head/sys/net/if_lagg.c Fri Jun 7 09:06:50 2013 (r251489) T> M> +++ head/sys/net/if_lagg.c Fri Jun 7 10:27:50 2013 (r251490) T> M> @@ -505,7 +505,9 @@ lagg_port_setlladdr(void *arg, int pendi T> M> ifp = llq->llq_ifp; T> M> T> M> /* Set the link layer address */ T> M> + CURVNET_SET(ifp->if_vnet); T> M> error = if_setlladdr(ifp, llq->llq_lladdr, ETHER_ADDR_LEN); T> M> + CURVNET_RESTORE(); T> M> if (error) T> M> printf("%s: setlladdr failed on %s\n", __func__, T> M> ifp->if_xname); T> T> IMHO, the entire task function should be embraced into VNET context. Sorry, I'm wrong. :( -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 10:46:35 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 45CB0FB4; Fri, 7 Jun 2013 10:46:35 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bk0-x234.google.com (mail-bk0-x234.google.com [IPv6:2a00:1450:4008:c01::234]) by mx1.freebsd.org (Postfix) with ESMTP id 25CFB1749; Fri, 7 Jun 2013 10:46:33 +0000 (UTC) Received: by mail-bk0-f52.google.com with SMTP id d7so1768766bkh.25 for ; Fri, 07 Jun 2013 03:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=CxnJcm3KPAt9Wx3sSmQywjfXmjrhYdhM4XhzriExqnk=; b=hcT+VzV/iBPF3y0edQ2sjg1lhVWCjkXYJJtMK/QCETWBuS+ft5as1dVy/Wym98Hhvr ahcs2J55hw2gLE0DUDPEQpjUilYkqwclRP5RfY71VF0uiIlkEXJ1IOqYABH3qwLdUylN LUJzk9023hHC64/FMTMLu3BZQa1XY2H5JZAtRlogQQIjQRwwhH1qQO3wpqXdwJLbKN8G Jb0qyvw0SerrXC67DJbN+TXLxRVEqVHkiJgPCaB5XI2omuOgGv6JxJoIEQ36Cjt2ihqd j5EALfV5Uv1MyX4zIILgY3XUlNKXaeggO970tY2Tw981Ny7kngMnOu7CTgPVFJW+4PKB jbEg== X-Received: by 10.204.227.201 with SMTP id jb9mr12193854bkb.96.1370601993128; Fri, 07 Jun 2013 03:46:33 -0700 (PDT) Received: from localhost ([178.150.115.244]) by mx.google.com with ESMTPSA id i15sm30199475bkz.12.2013.06.07.03.46.31 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 07 Jun 2013 03:46:32 -0700 (PDT) Sender: Mikolaj Golub Date: Fri, 7 Jun 2013 13:46:29 +0300 From: Mikolaj Golub To: Gleb Smirnoff Subject: Re: svn commit: r251490 - head/sys/net Message-ID: <20130607104628.GA96120@gmail.com> References: <201306071027.r57ARpaF056606@svn.freebsd.org> <20130607103307.GA1187@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130607103307.GA1187@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Nikos Vassiliadis , zec@FreeBSD.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 10:46:35 -0000 On Fri, Jun 07, 2013 at 02:33:08PM +0400, Gleb Smirnoff wrote: > On Fri, Jun 07, 2013 at 10:27:51AM +0000, Mikolaj Golub wrote: > M> Author: trociny > M> Date: Fri Jun 7 10:27:50 2013 > M> New Revision: 251490 > M> URL: http://svnweb.freebsd.org/changeset/base/251490 > M> > M> Log: > M> Properly set curvnet context in lagg_port_setlladdr() task handler. > M> > M> Reported by: Nikos Vassiliadis > M> Submitted by: zec > M> Tested by: Nikos Vassiliadis > M> MFC after: 1 week > M> > M> Modified: > M> head/sys/net/if_lagg.c > M> > M> Modified: head/sys/net/if_lagg.c > M> ============================================================================== > M> --- head/sys/net/if_lagg.c Fri Jun 7 09:06:50 2013 (r251489) > M> +++ head/sys/net/if_lagg.c Fri Jun 7 10:27:50 2013 (r251490) > M> @@ -505,7 +505,9 @@ lagg_port_setlladdr(void *arg, int pendi > M> ifp = llq->llq_ifp; > M> > M> /* Set the link layer address */ > M> + CURVNET_SET(ifp->if_vnet); > M> error = if_setlladdr(ifp, llq->llq_lladdr, ETHER_ADDR_LEN); > M> + CURVNET_RESTORE(); > M> if (error) > M> printf("%s: setlladdr failed on %s\n", __func__, > M> ifp->if_xname); > > IMHO, the entire task function should be embraced into VNET context. The VNET context is obtained from ifp, which is taken from the queue just one line above. It might be taken from lagg interface, supposing that all the lagg ports are in the same vnet, but this may not always be true, e.g. when you moving a lagg and its ports to another vnet, one by one. -- Mikolaj Golub From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 12:24:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0FB93ADD; Fri, 7 Jun 2013 12:24:16 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F3F781C14; Fri, 7 Jun 2013 12:24:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57COFKI094035; Fri, 7 Jun 2013 12:24:15 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57COFb4094032; Fri, 7 Jun 2013 12:24:15 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306071224.r57COFb4094032@svn.freebsd.org> From: Steven Hartland Date: Fri, 7 Jun 2013 12:24:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251491 - in stable/8/sys/cam: ata scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 12:24:16 -0000 Author: smh Date: Fri Jun 7 12:24:15 2013 New Revision: 251491 URL: http://svnweb.freebsd.org/changeset/base/251491 Log: Enhanced BIO_DELETE support for CAM SCSI to add ATA_TRIM support. Disable CAM BIO queue sorting for non-rotating media by default. MFC r245253 Use sysctl tunable values for scsi_da & retry_count (stable/8 only) MFC r249939 Added available delete methods discovery during device probe MFC r249941 Automatically disable BIO queue sorting for non-rotating media MFC r250033 Correct comment typo's MFC r250179 Update probe flow so that devices with lbp can also disable disksort MFC r250181 Check for ATA Information VPD before querying for ATA MFC r250183 Enable CAM SCSI to choice ATA TRIM during autodetection MFC r250967 Enforce validation on the selected delete method via sysctl Modified: stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/scsi/scsi_all.h stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Fri Jun 7 10:27:50 2013 (r251490) +++ stable/8/sys/cam/ata/ata_da.c Fri Jun 7 12:24:15 2013 (r251491) @@ -1102,7 +1102,11 @@ adaregister(struct cam_periph *periph, v snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.write_cache", periph->unit_number); TUNABLE_INT_FETCH(announce_buf, &softc->write_cache); - softc->sort_io_queue = -1; + /* Disable queue sorting for non-rotational media by default. */ + if (cgd->ident_data.media_rotation_rate == 1) + softc->sort_io_queue = 0; + else + softc->sort_io_queue = -1; adagetparams(periph, cgd); softc->disk = disk_alloc(); softc->disk->d_devstat = devstat_new_entry(periph->periph_name, Modified: stable/8/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.h Fri Jun 7 10:27:50 2013 (r251490) +++ stable/8/sys/cam/scsi/scsi_all.h Fri Jun 7 12:24:15 2013 (r251491) @@ -891,6 +891,36 @@ struct scsi_vpd_unit_serial_number }; /* + * ATA Information VPD Page based on + * T10/2126-D Revision 04 + */ +#define SVPD_ATA_INFORMATION 0x89 + +/* + * Block Device Characteristics VPD Page based on + * T10/1799-D Revision 31 + */ +struct scsi_vpd_block_characteristics +{ + u_int8_t device; + u_int8_t page_code; +#define SVPD_BDC 0xB1 + u_int8_t page_length[2]; + u_int8_t medium_rotation_rate[2]; +#define SVPD_BDC_RATE_NOT_REPORTED 0x00 +#define SVPD_BDC_RATE_NONE_ROTATING 0x01 + u_int8_t reserved1; + u_int8_t nominal_form_factor; +#define SVPD_BDC_FORM_NOT_REPORTED 0x00 +#define SVPD_BDC_FORM_5_25INCH 0x01 +#define SVPD_BDC_FORM_3_5INCH 0x02 +#define SVPD_BDC_FORM_2_5INCH 0x03 +#define SVPD_BDC_FORM_1_5INCH 0x04 +#define SVPD_BDC_FORM_LESSTHAN_1_5INCH 0x05 + u_int8_t reserved2[56]; +}; + +/* * Logical Block Provisioning VPD Page based on * T10/1799-D Revision 31 */ Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Fri Jun 7 10:27:50 2013 (r251490) +++ stable/8/sys/cam/scsi/scsi_da.c Fri Jun 7 12:24:15 2013 (r251491) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #endif /* _KERNEL */ @@ -66,8 +67,12 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL typedef enum { - DA_STATE_PROBE, - DA_STATE_PROBE2, + DA_STATE_PROBE_RC, + DA_STATE_PROBE_RC16, + DA_STATE_PROBE_LBP, + DA_STATE_PROBE_BLK_LIMITS, + DA_STATE_PROBE_BDC, + DA_STATE_PROBE_ATA, DA_STATE_NORMAL } da_state; @@ -93,28 +98,46 @@ typedef enum { } da_quirks; typedef enum { - DA_CCB_PROBE = 0x01, - DA_CCB_PROBE2 = 0x02, - DA_CCB_BUFFER_IO = 0x03, - DA_CCB_WAITING = 0x04, - DA_CCB_DUMP = 0x05, - DA_CCB_DELETE = 0x06, + DA_CCB_PROBE_RC = 0x01, + DA_CCB_PROBE_RC16 = 0x02, + DA_CCB_PROBE_LBP = 0x03, + DA_CCB_PROBE_BLK_LIMITS = 0x04, + DA_CCB_PROBE_BDC = 0x05, + DA_CCB_PROBE_ATA = 0x06, + DA_CCB_BUFFER_IO = 0x07, + DA_CCB_WAITING = 0x08, + DA_CCB_DUMP = 0x0A, + DA_CCB_DELETE = 0x0B, DA_CCB_TYPE_MASK = 0x0F, DA_CCB_RETRY_UA = 0x10 } da_ccb_state; +/* + * Order here is important for method choice + * + * We prefer ATA_TRIM as tests run against a Sandforce 2281 SSD attached to + * LSI 2008 (mps) controller (FW: v12, Drv: v14) resulted 20% quicker deletes + * using ATA_TRIM than the corresponding UNMAP results for a real world mysql + * import taking 5mins. + * + */ typedef enum { DA_DELETE_NONE, DA_DELETE_DISABLE, - DA_DELETE_ZERO, - DA_DELETE_WS10, - DA_DELETE_WS16, + DA_DELETE_ATA_TRIM, DA_DELETE_UNMAP, - DA_DELETE_MAX = DA_DELETE_UNMAP + DA_DELETE_WS16, + DA_DELETE_WS10, + DA_DELETE_ZERO, + DA_DELETE_MIN = DA_DELETE_ATA_TRIM, + DA_DELETE_MAX = DA_DELETE_ZERO } da_delete_methods; static const char *da_delete_method_names[] = - { "NONE", "DISABLE", "ZERO", "WS10", "WS16", "UNMAP" }; + { "NONE", "DISABLE", "ATA_TRIM", "UNMAP", "WS16", "WS10", "ZERO" }; +static const char *da_delete_method_desc[] = + { "NONE", "DISABLED", "ATA TRIM", "UNMAP", "WRITE SAME(16) with UNMAP", + "WRITE SAME(10) with UNMAP", "ZERO" }; /* Offsets into our private area for storing information */ #define ccb_state ppriv_field0 @@ -130,7 +153,17 @@ struct disk_params { u_int stripeoffset; }; -#define UNMAP_MAX_RANGES 512 +#define UNMAP_RANGE_MAX 0xffffffff +#define UNMAP_HEAD_SIZE 8 +#define UNMAP_RANGE_SIZE 16 +#define UNMAP_MAX_RANGES 2048 /* Protocol Max is 4095 */ +#define UNMAP_BUF_SIZE ((UNMAP_MAX_RANGES * UNMAP_RANGE_SIZE) + \ + UNMAP_HEAD_SIZE) + +#define WS10_MAX_BLKS 0xffff +#define WS16_MAX_BLKS 0xffffffff +#define ATA_TRIM_MAX_RANGES ((UNMAP_BUF_SIZE / \ + (ATA_DSM_RANGE_SIZE * ATA_DSM_BLK_SIZE)) * ATA_DSM_BLK_SIZE) struct da_softc { struct bio_queue_head bio_queue; @@ -146,10 +179,13 @@ struct da_softc { int error_inject; int ordered_tag_count; int outstanding_cmds; - int unmap_max_ranges; - int unmap_max_lba; + int trim_max_ranges; int delete_running; - da_delete_methods delete_method; + int delete_available; /* Delete methods possibly available */ + uint32_t unmap_max_ranges; + uint32_t unmap_max_lba; + uint64_t ws_max_blks; + da_delete_methods delete_method; struct disk_params params; struct disk *disk; union ccb saved_ccb; @@ -158,9 +194,16 @@ struct da_softc { struct sysctl_oid *sysctl_tree; struct callout sendordered_c; uint64_t wwpn; - uint8_t unmap_buf[UNMAP_MAX_RANGES * 16 + 8]; + uint8_t unmap_buf[UNMAP_BUF_SIZE]; }; +#define dadeleteflag(softc, delete_method, enable) \ + if (enable) { \ + softc->delete_available |= (1 << delete_method); \ + } else { \ + softc->delete_available &= ~(1 << delete_method); \ + } + struct da_quirk_entry { struct scsi_inquiry_pattern inq_pat; da_quirks quirks; @@ -859,6 +902,10 @@ static int dacmdsizesysctl(SYSCTL_HANDL static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS); static void dadeletemethodset(struct da_softc *softc, da_delete_methods delete_method); +static void dadeletemethodchoose(struct da_softc *softc, + da_delete_methods default_method); +static void daprobedone(struct cam_periph *periph, union ccb *ccb); + static periph_ctor_t daregister; static periph_dtor_t dacleanup; static periph_start_t dastart; @@ -980,10 +1027,6 @@ daopen(struct disk *dp) softc->disk->d_fwheads = softc->params.heads; softc->disk->d_devstat->block_size = softc->params.secsize; softc->disk->d_devstat->flags &= ~DEVSTAT_BS_UNAVAILABLE; - if (softc->delete_method > DA_DELETE_DISABLE) - softc->disk->d_flags |= DISKFLAG_CANDELETE; - else - softc->disk->d_flags &= ~DISKFLAG_CANDELETE; if ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0 && (softc->quirks & DA_Q_NO_PREVENT) == 0) @@ -1512,6 +1555,82 @@ dadeletemethodset(struct da_softc *softc softc->disk->d_flags &= ~DISKFLAG_CANDELETE; } +static void +daprobedone(struct cam_periph *periph, union ccb *ccb) +{ + struct da_softc *softc; + + softc = (struct da_softc *)periph->softc; + + dadeletemethodchoose(softc, DA_DELETE_NONE); + + if (bootverbose) { + char buf[80]; + int i, sep; + + snprintf(buf, sizeof(buf), "Delete methods: <"); + sep = 0; + for (i = DA_DELETE_MIN; i <= DA_DELETE_MAX; i++) { + if (softc->delete_available & (1 << i)) { + if (sep) { + strlcat(buf, ",", sizeof(buf)); + } else { + sep = 1; + } + strlcat(buf, da_delete_method_names[i], + sizeof(buf)); + if (i == softc->delete_method) { + strlcat(buf, "(*)", sizeof(buf)); + } + } + } + if (sep == 0) { + if (softc->delete_method == DA_DELETE_NONE) + strlcat(buf, "NONE(*)", sizeof(buf)); + else + strlcat(buf, "DISABLED(*)", sizeof(buf)); + } + strlcat(buf, ">", sizeof(buf)); + printf("%s%d: %s\n", periph->periph_name, + periph->unit_number, buf); + } + + /* + * Since our peripheral may be invalidated by an error + * above or an external event, we must release our CCB + * before releasing the probe lock on the peripheral. + * The peripheral will only go away once the last lock + * is removed, and we need it around for the CCB release + * operation. + */ + xpt_release_ccb(ccb); + softc->state = DA_STATE_NORMAL; + cam_periph_unhold(periph); + + /* May have more work to do, so ensure we stay scheduled. */ + daschedule(periph); +} + +static void +dadeletemethodchoose(struct da_softc *softc, da_delete_methods default_method) +{ + int i, delete_method; + + delete_method = default_method; + + /* + * Use the pre-defined order to choose the best + * performing delete. + */ + for (i = DA_DELETE_MIN; i <= DA_DELETE_MAX; i++) { + if (softc->delete_available & (1 << i)) { + dadeletemethodset(softc, i); + return; + } + } + dadeletemethodset(softc, delete_method); +} + static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS) { @@ -1532,7 +1651,8 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS if (error != 0 || req->newptr == NULL) return (error); for (i = 0; i <= DA_DELETE_MAX; i++) { - if (strcmp(buf, da_delete_method_names[i]) != 0) + if (!(softc->delete_available & (1 << i)) || + strcmp(buf, da_delete_method_names[i]) != 0) continue; dadeletemethodset(softc, i); return (0); @@ -1570,14 +1690,16 @@ daregister(struct cam_periph *periph, vo } LIST_INIT(&softc->pending_ccbs); - softc->state = DA_STATE_PROBE; + softc->state = DA_STATE_PROBE_RC; bioq_init(&softc->bio_queue); bioq_init(&softc->delete_queue); bioq_init(&softc->delete_run_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= DA_FLAG_PACK_REMOVABLE; softc->unmap_max_ranges = UNMAP_MAX_RANGES; - softc->unmap_max_lba = 1024*1024*2; + softc->unmap_max_lba = UNMAP_RANGE_MAX; + softc->ws_max_blks = WS16_MAX_BLKS; + softc->trim_max_ranges = ATA_TRIM_MAX_RANGES; softc->sort_io_queue = -1; periph->softc = softc; @@ -1665,7 +1787,7 @@ daregister(struct cam_periph *periph, vo /* Predict whether device may support READ CAPACITY(16). */ if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3) { softc->flags |= DA_FLAG_CAN_RC16; - softc->state = DA_STATE_PROBE2; + softc->state = DA_STATE_PROBE_RC16; } /* @@ -1713,6 +1835,7 @@ dastart(struct cam_periph *periph, union CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dastart\n")); +skipstate: switch (softc->state) { case DA_STATE_NORMAL: { @@ -1737,13 +1860,36 @@ dastart(struct cam_periph *periph, union if (!softc->delete_running && (bp = bioq_first(&softc->delete_queue)) != NULL) { uint64_t lba; - u_int count; + uint64_t count; /* forward compat with WS32 */ + + /* + * In each of the methods below, while its the caller's + * responsibility to ensure the request will fit into a + * single device request, we might have changed the delete + * method due to the device incorrectly advertising either + * its supported methods or limits. + * + * To prevent this causing further issues we validate the + * against the methods limits, and warn which would + * otherwise be unnecessary. + */ if (softc->delete_method == DA_DELETE_UNMAP) { uint8_t *buf = softc->unmap_buf; uint64_t lastlba = (uint64_t)-1; - uint32_t lastcount = 0; - int blocks = 0, off, ranges = 0; + uint32_t lastcount = 0, c; + uint64_t totalcount = 0; + uint32_t off, ranges = 0; + + /* + * Currently this doesn't take the UNMAP + * Granularity and Granularity Alignment + * fields into account. + * + * This could result in both unoptimal unmap + * requests as as well as UNMAP calls unmapping + * fewer LBA's than requested. + */ softc->delete_running = 1; bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); @@ -1757,22 +1903,44 @@ dastart(struct cam_periph *periph, union /* Try to extend the previous range. */ if (lba == lastlba) { - lastcount += count; - off = (ranges - 1) * 16 + 8; + c = min(count, softc->unmap_max_lba - + lastcount); + lastcount += c; + off = ((ranges - 1) * UNMAP_RANGE_SIZE) + + UNMAP_HEAD_SIZE; scsi_ulto4b(lastcount, &buf[off + 8]); - } else if (count > 0) { - off = ranges * 16 + 8; + count -= c; + lba +=c; + totalcount += c; + } + + while (count > 0) { + c = min(count, softc->unmap_max_lba); + if (totalcount + c > softc->unmap_max_lba || + ranges >= softc->unmap_max_ranges) { + xpt_print(periph->path, + "%s issuing short delete %ld > %ld" + "|| %d >= %d", + da_delete_method_desc[softc->delete_method], + totalcount + c, softc->unmap_max_lba, + ranges, softc->unmap_max_ranges); + break; + } + off = (ranges * UNMAP_RANGE_SIZE) + + UNMAP_HEAD_SIZE; scsi_u64to8b(lba, &buf[off + 0]); - scsi_ulto4b(count, &buf[off + 8]); - lastcount = count; + scsi_ulto4b(c, &buf[off + 8]); + lba += c; + totalcount += c; ranges++; + count -= c; + lastcount = c; } - blocks += count; - lastlba = lba + count; + lastlba = lba; bp1 = bioq_first(&softc->delete_queue); if (bp1 == NULL || ranges >= softc->unmap_max_ranges || - blocks + bp1->bio_bcount / + totalcount + bp1->bio_bcount / softc->params.secsize > softc->unmap_max_lba) break; } while (1); @@ -1790,9 +1958,87 @@ dastart(struct cam_periph *periph, union da_default_timeout * 1000); start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; goto out; + } else if (softc->delete_method == DA_DELETE_ATA_TRIM) { + uint8_t *buf = softc->unmap_buf; + uint64_t lastlba = (uint64_t)-1; + uint32_t lastcount = 0, c, requestcount; + int ranges = 0, off, block_count; + + softc->delete_running = 1; + bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + lba = bp1->bio_pblkno; + count = bp1->bio_bcount / softc->params.secsize; + requestcount = count; + + /* Try to extend the previous range. */ + if (lba == lastlba) { + c = min(count, ATA_DSM_RANGE_MAX - lastcount); + lastcount += c; + off = (ranges - 1) * 8; + buf[off + 6] = lastcount & 0xff; + buf[off + 7] = (lastcount >> 8) & 0xff; + count -= c; + lba += c; + } + + while (count > 0) { + c = min(count, ATA_DSM_RANGE_MAX); + off = ranges * 8; + + buf[off + 0] = lba & 0xff; + buf[off + 1] = (lba >> 8) & 0xff; + buf[off + 2] = (lba >> 16) & 0xff; + buf[off + 3] = (lba >> 24) & 0xff; + buf[off + 4] = (lba >> 32) & 0xff; + buf[off + 5] = (lba >> 40) & 0xff; + buf[off + 6] = c & 0xff; + buf[off + 7] = (c >> 8) & 0xff; + lba += c; + ranges++; + count -= c; + lastcount = c; + if (count != 0 && ranges == softc->trim_max_ranges) { + xpt_print(periph->path, + "%s issuing short delete %ld > %ld", + da_delete_method_desc[softc->delete_method], + requestcount, + (softc->trim_max_ranges - ranges) * + ATA_DSM_RANGE_MAX); + break; + } + } + lastlba = lba; + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || + bp1->bio_bcount / softc->params.secsize > + (softc->trim_max_ranges - ranges) * + ATA_DSM_RANGE_MAX) + break; + } while (1); + + block_count = (ranges + ATA_DSM_BLK_RANGES - 1) / + ATA_DSM_BLK_RANGES; + scsi_ata_trim(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + block_count, + /*data_ptr*/buf, + /*dxfer_len*/block_count * ATA_DSM_BLK_SIZE, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; + goto out; } else if (softc->delete_method == DA_DELETE_ZERO || softc->delete_method == DA_DELETE_WS10 || softc->delete_method == DA_DELETE_WS16) { + uint64_t ws_max_blks; + ws_max_blks = softc->ws_max_blks / softc->params.secsize; softc->delete_running = 1; lba = bp->bio_pblkno; count = 0; @@ -1802,11 +2048,19 @@ dastart(struct cam_periph *periph, union if (bp1 != bp) bioq_insert_tail(&softc->delete_run_queue, bp1); count += bp1->bio_bcount / softc->params.secsize; + if (count > ws_max_blks) { + count = min(count, ws_max_blks); + xpt_print(periph->path, + "%s issuing short delete %ld > %ld", + da_delete_method_desc[softc->delete_method], + count, ws_max_blks); + break; + } bp1 = bioq_first(&softc->delete_queue); if (bp1 == NULL || lba + count != bp1->bio_pblkno || count + bp1->bio_bcount / - softc->params.secsize > 0xffff) + softc->params.secsize > ws_max_blks) break; } while (1); @@ -1910,7 +2164,7 @@ out: daschedule(periph); break; } - case DA_STATE_PROBE: + case DA_STATE_PROBE_RC: { struct scsi_read_capacity_data *rcap; @@ -1929,11 +2183,11 @@ out: SSD_FULL_SIZE, /*timeout*/5000); start_ccb->ccb_h.ccb_bp = NULL; - start_ccb->ccb_h.ccb_state = DA_CCB_PROBE; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_RC; xpt_action(start_ccb); break; } - case DA_STATE_PROBE2: + case DA_STATE_PROBE_RC16: { struct scsi_read_capacity_data_long *rcaplong; @@ -1955,8 +2209,148 @@ out: /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ da_default_timeout * 1000); start_ccb->ccb_h.ccb_bp = NULL; - start_ccb->ccb_h.ccb_state = DA_CCB_PROBE2; - xpt_action(start_ccb); + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_RC16; + xpt_action(start_ccb); + break; + } + case DA_STATE_PROBE_LBP: + { + struct scsi_vpd_logical_block_prov *lbp; + + if (!scsi_vpd_supported_page(periph, SVPD_LBP)) { + /* + * If we get here we don't support any SBC-3 delete + * methods with UNMAP as the Logical Block Provisioning + * VPD page support is required for devices which + * support it according to T10/1799-D Revision 31 + * however older revisions of the spec don't mandate + * this so we currently don't remove these methods + * from the available set. + */ + softc->state = DA_STATE_PROBE_BLK_LIMITS; + goto skipstate; + } + + lbp = (struct scsi_vpd_logical_block_prov *) + malloc(sizeof(*lbp), M_SCSIDA, M_NOWAIT|M_ZERO); + + if (lbp == NULL) { + printf("dastart: Couldn't malloc lbp data\n"); + /* da_free_periph??? */ + break; + } + + scsi_inquiry(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*inq_buf*/(u_int8_t *)lbp, + /*inq_len*/sizeof(*lbp), + /*evpd*/TRUE, + /*page_code*/SVPD_LBP, + /*sense_len*/SSD_MIN_SIZE, + /*timeout*/da_default_timeout * 1000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_LBP; + xpt_action(start_ccb); + break; + } + case DA_STATE_PROBE_BLK_LIMITS: + { + struct scsi_vpd_block_limits *block_limits; + + if (!scsi_vpd_supported_page(periph, SVPD_BLOCK_LIMITS)) { + /* Not supported skip to next probe */ + softc->state = DA_STATE_PROBE_BDC; + goto skipstate; + } + + block_limits = (struct scsi_vpd_block_limits *) + malloc(sizeof(*block_limits), M_SCSIDA, M_NOWAIT|M_ZERO); + + if (block_limits == NULL) { + printf("dastart: Couldn't malloc block_limits data\n"); + /* da_free_periph??? */ + break; + } + + scsi_inquiry(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*inq_buf*/(u_int8_t *)block_limits, + /*inq_len*/sizeof(*block_limits), + /*evpd*/TRUE, + /*page_code*/SVPD_BLOCK_LIMITS, + /*sense_len*/SSD_MIN_SIZE, + /*timeout*/da_default_timeout * 1000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_BLK_LIMITS; + xpt_action(start_ccb); + break; + } + case DA_STATE_PROBE_BDC: + { + struct scsi_vpd_block_characteristics *bdc; + + if (!scsi_vpd_supported_page(periph, SVPD_BDC)) { + softc->state = DA_STATE_PROBE_ATA; + goto skipstate; + } + + bdc = (struct scsi_vpd_block_characteristics *) + malloc(sizeof(*bdc), M_SCSIDA, M_NOWAIT|M_ZERO); + + if (bdc == NULL) { + printf("dastart: Couldn't malloc bdc data\n"); + /* da_free_periph??? */ + break; + } + + scsi_inquiry(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*inq_buf*/(u_int8_t *)bdc, + /*inq_len*/sizeof(*bdc), + /*evpd*/TRUE, + /*page_code*/SVPD_BDC, + /*sense_len*/SSD_MIN_SIZE, + /*timeout*/da_default_timeout * 1000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_BDC; + xpt_action(start_ccb); + break; + } + case DA_STATE_PROBE_ATA: + { + struct ata_params *ata_params; + + if (!scsi_vpd_supported_page(periph, SVPD_ATA_INFORMATION)) { + daprobedone(periph, start_ccb); + break; + } + + ata_params = (struct ata_params*) + malloc(sizeof(*ata_params), M_SCSIDA, M_NOWAIT|M_ZERO); + + if (ata_params == NULL) { + printf("dastart: Couldn't malloc ata_params data\n"); + /* da_free_periph??? */ + break; + } + + scsi_ata_identify(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*data_ptr*/(u_int8_t *)ata_params, + /*dxfer_len*/sizeof(*ata_params), + /*sense_len*/SSD_FULL_SIZE, + /*timeout*/da_default_timeout * 1000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_ATA; + xpt_action(start_ccb); break; } } @@ -1976,27 +2370,31 @@ cmd6workaround(union ccb *ccb) softc = (struct da_softc *)xpt_path_periph(ccb->ccb_h.path)->softc; if (ccb->ccb_h.ccb_state == DA_CCB_DELETE) { - if (softc->delete_method == DA_DELETE_UNMAP) { - xpt_print(ccb->ccb_h.path, "UNMAP is not supported, " - "switching to WRITE SAME(16) with UNMAP.\n"); - dadeletemethodset(softc, DA_DELETE_WS16); - } else if (softc->delete_method == DA_DELETE_WS16) { - xpt_print(ccb->ccb_h.path, - "WRITE SAME(16) with UNMAP is not supported, " - "disabling BIO_DELETE.\n"); - dadeletemethodset(softc, DA_DELETE_DISABLE); - } else if (softc->delete_method == DA_DELETE_WS10) { + da_delete_methods old_method = softc->delete_method; + + /* + * Typically there are two reasons for failure here + * 1. Delete method was detected as supported but isn't + * 2. Delete failed due to invalid params e.g. too big + * + * While we will attempt to choose an alternative delete method + * this may result in short deletes if the existing delete + * requests from geom are big for the new method choosen. + * + * This method assumes that the error which triggered this + * will not retry the io otherwise a panic will occur + */ + dadeleteflag(softc, old_method, 0); + dadeletemethodchoose(softc, DA_DELETE_DISABLE); + if (softc->delete_method == DA_DELETE_DISABLE) xpt_print(ccb->ccb_h.path, - "WRITE SAME(10) with UNMAP is not supported, " - "disabling BIO_DELETE.\n"); - dadeletemethodset(softc, DA_DELETE_DISABLE); - } else if (softc->delete_method == DA_DELETE_ZERO) { + "%s failed, disabling BIO_DELETE\n", + da_delete_method_desc[old_method]); + else xpt_print(ccb->ccb_h.path, - "WRITE SAME(10) is not supported, " - "disabling BIO_DELETE.\n"); - dadeletemethodset(softc, DA_DELETE_DISABLE); - } else - dadeletemethodset(softc, DA_DELETE_DISABLE); + "%s failed, switching to %s BIO_DELETE\n", + da_delete_method_desc[old_method], + da_delete_method_desc[softc->delete_method]); if (DA_SIO) { while ((bp = bioq_takefirst(&softc->delete_run_queue)) @@ -2078,7 +2476,7 @@ dadone(struct cam_periph *periph, union error = daerror(done_ccb, CAM_RETRY_SELTO, sf); if (error == ERESTART) { /* - * A retry was scheuled, so + * A retry was scheduled, so * just return. */ return; @@ -2175,16 +2573,18 @@ dadone(struct cam_periph *periph, union biodone(bp); break; } - case DA_CCB_PROBE: - case DA_CCB_PROBE2: + case DA_CCB_PROBE_RC: + case DA_CCB_PROBE_RC16: { struct scsi_read_capacity_data *rdcap; struct scsi_read_capacity_data_long *rcaplong; char announce_buf[80]; + int lbp; + lbp = 0; rdcap = NULL; rcaplong = NULL; - if (softc->state == DA_STATE_PROBE) + if (softc->state == DA_STATE_PROBE_RC) rdcap =(struct scsi_read_capacity_data *)csio->data_ptr; else rcaplong = (struct scsi_read_capacity_data_long *) @@ -2197,7 +2597,7 @@ dadone(struct cam_periph *periph, union u_int lbppbe; /* LB per physical block exponent. */ u_int lalba; /* Lowest aligned LBA. */ - if (softc->state == DA_STATE_PROBE) { + if (softc->state == DA_STATE_PROBE_RC) { block_size = scsi_4btoul(rdcap->length); maxsector = scsi_4btoul(rdcap->addr); lbppbe = 0; @@ -2212,9 +2612,9 @@ dadone(struct cam_periph *periph, union * with the short version of the command. */ if (maxsector == 0xffffffff) { - softc->state = DA_STATE_PROBE2; free(rdcap, M_SCSIDA); xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_RC16; xpt_schedule(periph, priority); return; } @@ -2242,9 +2642,7 @@ dadone(struct cam_periph *periph, union } else { dasetgeom(periph, block_size, maxsector, lbppbe, lalba & SRC16_LALBA); - if ((lalba & SRC16_LBPME) && - softc->delete_method == DA_DELETE_NONE) - dadeletemethodset(softc, DA_DELETE_UNMAP); + lbp = (lalba & SRC16_LBPME); dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), "%juMB (%ju %u byte sectors: %dH %dS/T " @@ -2314,7 +2712,7 @@ dadone(struct cam_periph *periph, union * If we tried READ CAPACITY(16) and failed, * fallback to READ CAPACITY(10). */ - if ((softc->state == DA_STATE_PROBE2) && + if ((softc->state == DA_STATE_PROBE_RC16) && (softc->flags & DA_FLAG_CAN_RC16) && (((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) || @@ -2322,9 +2720,9 @@ dadone(struct cam_periph *periph, union (error_code == SSD_CURRENT_ERROR) && (sense_key == SSD_KEY_ILLEGAL_REQUEST)))) { softc->flags &= ~DA_FLAG_CAN_RC16; - softc->state = DA_STATE_PROBE; free(rdcap, M_SCSIDA); xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_RC; xpt_schedule(periph, priority); return; } else @@ -2386,17 +2784,242 @@ dadone(struct cam_periph *periph, union } } - softc->state = DA_STATE_NORMAL; - /* - * Since our peripheral may be invalidated by an error - * above or an external event, we must release our CCB - * before releasing the probe lock on the peripheral. - * The peripheral will only go away once the last lock - * is removed, and we need it around for the CCB release - * operation. - */ + + /* Ensure re-probe doesn't see old delete. */ + softc->delete_available = 0; + if (lbp) { + /* + * Based on older SBC-3 spec revisions + * any of the UNMAP methods "may" be + * available via LBP given this flag so + * we flag all of them as availble and + * then remove those which further + * probes confirm aren't available + * later. + * + * We could also check readcap(16) p_type + * flag to exclude one or more invalid + * write same (X) types here + */ + dadeleteflag(softc, DA_DELETE_WS16, 1); + dadeleteflag(softc, DA_DELETE_WS10, 1); + dadeleteflag(softc, DA_DELETE_ZERO, 1); + dadeleteflag(softc, DA_DELETE_UNMAP, 1); + + xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_LBP; + xpt_schedule(periph, priority); + return; + } + + xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_BDC; + xpt_schedule(periph, priority); + return; + } + case DA_CCB_PROBE_LBP: + { + struct scsi_vpd_logical_block_prov *lbp; + + lbp = (struct scsi_vpd_logical_block_prov *)csio->data_ptr; + + if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + /* + * T10/1799-D Revision 31 states at least one of these + * must be supported but we don't currently enforce this. + */ + dadeleteflag(softc, DA_DELETE_WS16, + (lbp->flags & SVPD_LBP_WS16)); + dadeleteflag(softc, DA_DELETE_WS10, + (lbp->flags & SVPD_LBP_WS10)); + dadeleteflag(softc, DA_DELETE_ZERO, + (lbp->flags & SVPD_LBP_WS10)); + dadeleteflag(softc, DA_DELETE_UNMAP, + (lbp->flags & SVPD_LBP_UNMAP)); + + if (lbp->flags & SVPD_LBP_UNMAP) { + free(lbp, M_SCSIDA); + xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_BLK_LIMITS; + xpt_schedule(periph, priority); + return; + } + } else { + int error; + error = daerror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA|SF_NO_PRINT); + if (error == ERESTART) + return; + else if (error != 0) { + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + /* Don't wedge this device's queue */ + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + } + + /* + * Failure indicates we don't support any SBC-3 + * delete methods with UNMAP + */ + } + } + + free(lbp, M_SCSIDA); + xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_BDC; + xpt_schedule(periph, priority); + return; + } + case DA_CCB_PROBE_BLK_LIMITS: + { + struct scsi_vpd_block_limits *block_limits; + + block_limits = (struct scsi_vpd_block_limits *)csio->data_ptr; + + if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + uint32_t max_unmap_lba_cnt = scsi_4btoul( + block_limits->max_unmap_lba_cnt); + uint32_t max_unmap_blk_cnt = scsi_4btoul( + block_limits->max_unmap_blk_cnt); + uint64_t ws_max_blks = scsi_8btou64( + block_limits->max_write_same_length); + /* + * We should already support UNMAP but we check lba + * and block count to be sure + */ + if (max_unmap_lba_cnt != 0x00L && + max_unmap_blk_cnt != 0x00L) { + softc->unmap_max_lba = max_unmap_lba_cnt; + softc->unmap_max_ranges = min(max_unmap_blk_cnt, + UNMAP_MAX_RANGES); + } else { + /* + * Unexpected UNMAP limits which means the + * device doesn't actually support UNMAP + */ + dadeleteflag(softc, DA_DELETE_UNMAP, 0); + } + + if (ws_max_blks != 0x00L) + softc->ws_max_blks = ws_max_blks; + } else { + int error; + error = daerror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA|SF_NO_PRINT); + if (error == ERESTART) + return; + else if (error != 0) { + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + /* Don't wedge this device's queue */ + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 12:33:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 40836DB1; Fri, 7 Jun 2013 12:33:42 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 326251CA2; Fri, 7 Jun 2013 12:33:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57CXgXq097046; Fri, 7 Jun 2013 12:33:42 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57CXeeg097034; Fri, 7 Jun 2013 12:33:40 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306071233.r57CXeeg097034@svn.freebsd.org> From: Steven Hartland Date: Fri, 7 Jun 2013 12:33:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251492 - in stable/8/sys: cam cam/ata cam/scsi dev/ahci X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 12:33:42 -0000 Author: smh Date: Fri Jun 7 12:33:40 2013 New Revision: 251492 URL: http://svnweb.freebsd.org/changeset/base/251492 Log: MFC r250792: Added output of device QUIRKS for CAM and AHCI devices during boot. Modified: stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/cam_xpt.c stable/8/sys/cam/cam_xpt_periph.h stable/8/sys/cam/scsi/scsi_cd.c stable/8/sys/cam/scsi/scsi_ch.c stable/8/sys/cam/scsi/scsi_da.c stable/8/sys/cam/scsi/scsi_sa.c stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/ahci/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Fri Jun 7 12:24:15 2013 (r251491) +++ stable/8/sys/cam/ata/ata_da.c Fri Jun 7 12:33:40 2013 (r251492) @@ -94,6 +94,10 @@ typedef enum { ADA_Q_4K = 0x01, } ada_quirks; +#define ADA_Q_BIT_STRING \ + "\020" \ + "\0014K" + typedef enum { ADA_CCB_RAHEAD = 0x01, ADA_CCB_WCACHE = 0x02, @@ -1191,6 +1195,7 @@ adaregister(struct cam_periph *periph, v dp->secsize, dp->heads, dp->secs_per_track, dp->cylinders); xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, ADA_Q_BIT_STRING); if (legacy_id >= 0) printf("%s%d: Previously was known as ad%d\n", periph->periph_name, periph->unit_number, legacy_id); Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Fri Jun 7 12:24:15 2013 (r251491) +++ stable/8/sys/cam/cam_xpt.c Fri Jun 7 12:33:40 2013 (r251492) @@ -1099,6 +1099,15 @@ xpt_announce_periph(struct cam_periph *p periph->unit_number, announce_string); } +void +xpt_announce_quirks(struct cam_periph *periph, int quirks, char *bit_string) +{ + if (quirks != 0) { + printf("%s%d: quirks=0x%b\n", periph->periph_name, + periph->unit_number, quirks, bit_string); + } +} + static dev_match_ret xptbusmatch(struct dev_match_pattern *patterns, u_int num_patterns, struct cam_eb *bus) Modified: stable/8/sys/cam/cam_xpt_periph.h ============================================================================== --- stable/8/sys/cam/cam_xpt_periph.h Fri Jun 7 12:24:15 2013 (r251491) +++ stable/8/sys/cam/cam_xpt_periph.h Fri Jun 7 12:33:40 2013 (r251492) @@ -45,6 +45,8 @@ int32_t xpt_add_periph(struct cam_perip void xpt_remove_periph(struct cam_periph *periph); void xpt_announce_periph(struct cam_periph *periph, char *announce_string); +void xpt_announce_quirks(struct cam_periph *periph, + int quirks, char *bit_string); #endif #endif /* _CAM_CAM_XPT_PERIPH_H */ Modified: stable/8/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_cd.c Fri Jun 7 12:24:15 2013 (r251491) +++ stable/8/sys/cam/scsi/scsi_cd.c Fri Jun 7 12:33:40 2013 (r251492) @@ -92,6 +92,14 @@ typedef enum { CD_Q_10_BYTE_ONLY = 0x10 } cd_quirks; +#define CD_Q_BIT_STRING \ + "\020" \ + "\001NO_TOUCH" \ + "\002BCD_TRACKS" \ + "\003NO_CHANGER" \ + "\004CHANGER" \ + "\00510_BYTE_ONLY" + typedef enum { CD_FLAG_INVALID = 0x0001, CD_FLAG_NEW_DISC = 0x0002, @@ -1782,6 +1790,8 @@ cddone(struct cam_periph *periph, union free(rdcap, M_SCSICD); if (announce_buf[0] != '\0') { xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, + CD_Q_BIT_STRING); if (softc->flags & CD_FLAG_CHANGER) cdchangerschedule(softc); /* Modified: stable/8/sys/cam/scsi/scsi_ch.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_ch.c Fri Jun 7 12:24:15 2013 (r251491) +++ stable/8/sys/cam/scsi/scsi_ch.c Fri Jun 7 12:33:40 2013 (r251492) @@ -126,6 +126,10 @@ typedef enum { CH_Q_NO_DBD = 0x01 } ch_quirks; +#define CH_Q_BIT_STRING \ + "\020" \ + "\001NO_DBD" + #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 @@ -639,8 +643,11 @@ chdone(struct cam_periph *periph, union announce_buf[0] = '\0'; } } - if (announce_buf[0] != '\0') + if (announce_buf[0] != '\0') { xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, + CH_Q_BIT_STRING); + } softc->state = CH_STATE_NORMAL; free(mode_header, M_SCSICH); /* Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Fri Jun 7 12:24:15 2013 (r251491) +++ stable/8/sys/cam/scsi/scsi_da.c Fri Jun 7 12:33:40 2013 (r251492) @@ -97,6 +97,13 @@ typedef enum { DA_Q_4K = 0x08 } da_quirks; +#define DA_Q_BIT_STRING \ + "\020" \ + "\001NO_SYNC_CACHE" \ + "\002NO_6_BYTE" \ + "\003NO_PREVENT" \ + "\0044K" + typedef enum { DA_CCB_PROBE_RC = 0x01, DA_CCB_PROBE_RC16 = 0x02, @@ -2778,6 +2785,8 @@ dadone(struct cam_periph *periph, union taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task); xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, + DA_Q_BIT_STRING); } else { xpt_print(periph->path, "fatal error, " "could not acquire reference count\n"); Modified: stable/8/sys/cam/scsi/scsi_sa.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_sa.c Fri Jun 7 12:24:15 2013 (r251491) +++ stable/8/sys/cam/scsi/scsi_sa.c Fri Jun 7 12:33:40 2013 (r251492) @@ -173,6 +173,17 @@ typedef enum { SA_QUIRK_NO_CPAGE = 0x80 /* Don't use DEVICE COMPRESSION page */ } sa_quirks; +#define SA_QUIRK_BIT_STRING \ + "\020" \ + "\001NOCOMP" \ + "\002FIXED" \ + "\003VARIABLE" \ + "\0042FM" \ + "\0051FM" \ + "\006NODREAD" \ + "\007NO_MODESEL" \ + "\010NO_CPAGE" + #define SAMODE(z) (dev2unit(z) & 0x3) #define SADENSITY(z) ((dev2unit(z) >> 2) & 0x3) #define SA_IS_CTRL(z) (dev2unit(z) & (1 << 4)) @@ -1546,6 +1557,7 @@ saregister(struct cam_periph *periph, vo xpt_register_async(AC_LOST_DEVICE, saasync, periph, periph->path); xpt_announce_periph(periph, NULL); + xpt_announce_quirks(periph, softc->quirks, SA_QUIRK_BIT_STRING); return (CAM_REQ_CMP); } Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Fri Jun 7 12:24:15 2013 (r251491) +++ stable/8/sys/dev/ahci/ahci.c Fri Jun 7 12:33:40 2013 (r251492) @@ -121,6 +121,22 @@ static struct { #define AHCI_Q_NOCOUNT 1024 #define AHCI_Q_ALTSIG 2048 #define AHCI_Q_NOMSI 4096 + +#define AHCI_Q_BIT_STRING \ + "\020" \ + "\001NOFORCE" \ + "\002NOPMP" \ + "\003NONCQ" \ + "\0041CH" \ + "\0052CH" \ + "\0064CH" \ + "\007EDGEIS" \ + "\010SATA2" \ + "\011NOBSYRES" \ + "\012NOAA" \ + "\013NOCOUNT" \ + "\014ALTSIG" \ + "\015NOMSI" } ahci_ids[] = { {0x43801002, 0x00, "ATI IXP600", AHCI_Q_NOMSI}, {0x43901002, 0x00, "ATI IXP700", 0}, @@ -482,6 +498,10 @@ ahci_attach(device_t dev) "supported" : "not supported", (ctlr->caps & AHCI_CAP_FBSS) ? " with FBS" : ""); + if (ctlr->quirks != 0) { + device_printf(dev, "quirks=0x%b\n", ctlr->quirks, + AHCI_Q_BIT_STRING); + } if (bootverbose) { device_printf(dev, "Caps:%s%s%s%s%s%s%s%s %sGbps", (ctlr->caps & AHCI_CAP_64BIT) ? " 64bit":"", From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 12:42:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DAFCF31C; Fri, 7 Jun 2013 12:42:49 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CC0711D18; Fri, 7 Jun 2013 12:42:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57CgnAR000233; Fri, 7 Jun 2013 12:42:49 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57CgnOg000231; Fri, 7 Jun 2013 12:42:49 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306071242.r57CgnOg000231@svn.freebsd.org> From: Steven Hartland Date: Fri, 7 Jun 2013 12:42:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251493 - in stable/8/sys/cam: ata scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 12:42:49 -0000 Author: smh Date: Fri Jun 7 12:42:49 2013 New Revision: 251493 URL: http://svnweb.freebsd.org/changeset/base/251493 Log: MFC r251061: More 4k quirks for SSD's Modified: stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Fri Jun 7 12:33:40 2013 (r251492) +++ stable/8/sys/cam/ata/ata_da.c Fri Jun 7 12:42:49 2013 (r251493) @@ -273,12 +273,11 @@ static struct ada_quirk_entry ada_quirk_ { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD?????PVT*", "*" }, /*quirks*/ADA_Q_4K }, + /* SSDs */ { /* * Corsair Force 2 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair CSSD-F*", "*" }, /*quirks*/ADA_Q_4K @@ -287,100 +286,136 @@ static struct ada_quirk_entry ada_quirk_ /* * Corsair Force 3 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair Force 3*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * OCZ Agility 3 SSDs + * Corsair Force GT SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-AGILITY3*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair Force GT*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * OCZ Vertex 2 SSDs (inc pro series) + * Crucial M4 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ?VERTEX2*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "M4-CT???M4SSD2*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * OCZ Vertex 3 SSDs + * Crucial RealSSD C300 SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "C300-CTFDDAC???MAG*", + "*" }, /*quirks*/ADA_Q_4K + }, + { + /* + * Intel 320 Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-VERTEX3*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSA2CW*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * SuperTalent TeraDrive CT SSDs + * Intel 330 Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "FTM??CT25H*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSC2CT*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * Crucial RealSSD C300 SSDs - * 4k optimised - * Submitted by: Steven Hartland - * PR: 169974 + * Intel 510 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "C300-CTFDDAC???MAG*", - "*" }, /*quirks*/ADA_Q_4K + { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSC2MH*", "*" }, + /*quirks*/ADA_Q_4K }, { /* - * XceedIOPS SATA SSDs - * 4k optimised - * Submitted by: Steven Hartland - * PR: 169974 + * Intel 520 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "SG9XCS2D*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSC2BW*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * Intel 330 Series SSDs + * Kingston E100 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "KINGSTON SE100S3*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * Kingston HyperX 3k SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "KINGSTON SH103S3*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * OCZ Agility 3 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSC2ct*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-AGILITY3*", "*" }, /*quirks*/ADA_Q_4K }, { /* * OCZ Deneva R Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "DENRSTE251M45*", "*" }, /*quirks*/ADA_Q_4K }, { /* - * Kingston HyperX 3k SSDs + * OCZ Vertex 2 SSDs (inc pro series) * 4k optimised & trim only works in 4k requests + 4k aligned - * Submitted by: Steven Hartland - * PR: 169974 */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "KINGSTON SH103S3*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ?VERTEX2*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * OCZ Vertex 3 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-VERTEX3*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * Samsung 830 Series SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG SSD 830 Series*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * SuperTalent TeraDrive CT SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "FTM??CT25H*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * XceedIOPS SATA SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SG9XCS2D*", "*" }, /*quirks*/ADA_Q_4K }, { Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Fri Jun 7 12:33:40 2013 (r251492) +++ stable/8/sys/cam/scsi/scsi_da.c Fri Jun 7 12:42:49 2013 (r251493) @@ -897,6 +897,151 @@ static struct da_quirk_entry da_quirk_ta {T_DIRECT, SIP_MEDIA_FIXED, "SAMSUNG", "HM250JI", "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE }, + /* SATA SSDs */ + { + /* + * Corsair Force 2 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Corsair CSSD-F*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Corsair Force 3 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Corsair Force 3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Corsair Force GT SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Corsair Force GT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Crucial M4 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "M4-CT???M4SSD2*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Crucial RealSSD C300 SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "C300-CTFDDAC???MAG*", + "*" }, /*quirks*/DA_Q_4K + }, + { + /* + * Intel 320 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "INTEL SSDSA2CW*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Intel 330 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "INTEL SSDSC2CT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Intel 510 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "INTEL SSDSC2MH*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Intel 520 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "INTEL SSDSC2BW*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Kingston E100 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "KINGSTON SE100S3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Kingston HyperX 3k SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "KINGSTON SH103S3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * OCZ Agility 3 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "OCZ-AGILITY3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * OCZ Deneva R Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "DENRSTE251M45*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * OCZ Vertex 2 SSDs (inc pro series) + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "OCZ?VERTEX2*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * OCZ Vertex 3 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "OCZ-VERTEX3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * Samsung 830 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG SSD 830 Series*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * SuperTalent TeraDrive CT SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "FTM??CT25H*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * XceedIOPS SATA SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SG9XCS2D*", "*" }, + /*quirks*/DA_Q_4K + }, }; static disk_strategy_t dastrategy; From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 13:31:00 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0021CD5F; Fri, 7 Jun 2013 13:30:59 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D7E001F2D; Fri, 7 Jun 2013 13:30:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57DUxhF015860; Fri, 7 Jun 2013 13:30:59 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57DUxsQ015855; Fri, 7 Jun 2013 13:30:59 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306071330.r57DUxsQ015855@svn.freebsd.org> From: Steven Hartland Date: Fri, 7 Jun 2013 13:30:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251494 - in stable/8: sbin/camcontrol sys/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 13:31:00 -0000 Author: smh Date: Fri Jun 7 13:30:59 2013 New Revision: 251494 URL: http://svnweb.freebsd.org/changeset/base/251494 Log: MFC r249115: Adds security command to camcontrol which provides the ability to secure erase SSD's Modified: stable/8/sbin/camcontrol/camcontrol.8 stable/8/sbin/camcontrol/camcontrol.c stable/8/sys/sys/ata.h Directory Properties: stable/8/sbin/camcontrol/ (props changed) stable/8/sys/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.8 Fri Jun 7 12:42:49 2013 (r251493) +++ stable/8/sbin/camcontrol/camcontrol.8 Fri Jun 7 13:30:59 2013 (r251494) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 4, 2012 +.Dd June 7, 2013 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -184,6 +184,21 @@ .Op device id .Op generic args .Nm +.Ic security +.Op device id +.Op generic args +.Op Fl d Ar pwd +.Op Fl e Ar pwd +.Op Fl f +.Op Fl h Ar pwd +.Op Fl k Ar pwd +.Op Fl l Ar high|maximum +.Op Fl q +.Op Fl s Ar pwd +.Op Fl T Ar timeout +.Op Fl U Ar user|master +.Op Fl y +.Nm .Ic help .Sh DESCRIPTION The @@ -856,6 +871,123 @@ specifies automatic standby timer value .It Ic sleep Put ATA device into SLEEP state. Note that the only way get device out of this state may be reset. +.It Ic security +Update or report security settings, using an ATA identify command (0xec). +By default, +.Nm +will print out the security support and associated settings of the device. +The +.Ic security +command takes several arguments: +.Bl -tag -width 0n +.It Fl d Ar pwd +.Pp +Disable device security using the given password for the selected user according +to the devices configured security level. +.It Fl e Ar pwd +.Pp +Erase the device using the given password for the selected user. +.Pp +.Em WARNING! WARNING! WARNING! +.Pp +Issuing a secure erase will +.Em ERASE ALL +user data on the device and may take several hours to complete. +.Pp +When this command is used against an SSD drive all its cells will be marked as +empty, restoring it to factory default write performance. For SSD's this action +usually takes just a few seconds. +.It Fl f +.Pp +Freeze the security configuration of the specified device. +.Pp +After command completion any other commands that update the device lock mode +shall be command aborted. Frozen mode is disabled by power-off or hardware reset. +.It Fl h Ar pwd +.Pp +Enhanced erase the device using the given password for the selected user. +.Pp +.Em WARNING! WARNING! WARNING! +.Pp +Issuing an enhanced secure erase will +.Em ERASE ALL +user data on the device and may take several hours to complete. +.Pp +An enhanced erase writes predetermined data patterns to all user data areas, +all previously written user data shall be overwritten, including sectors that +are no longer in use due to reallocation. +.It Fl k Ar pwd +.Pp +Unlock the device using the given password for the selected user according to +the devices configured security level. +.It Fl l Ar high|maximum +.Pp +Specifies which security level to set when issuing a +.Fl s Ar pwd +command. The security level determines device behavior when the master +password is used to unlock the device. When the security level is set to high +the device requires the unlock command and the master password to unlock. +When the security level is set to maximum the device requires a secure erase +with the master password to unlock. +.Pp +This option must be used in conjunction with one of the security action commands. +.Pp +Defaults to +.Em high +.It Fl q +.Pp +Be quiet, do not print any status messages. +This option will not disable the questions, however. +To disable questions, use the +.Fl y +argument, below. +.It Fl s Ar pwd +.Pp +Password the device (enable security) using the given password for the selected +user. This option can be combined with other options such as +.Fl e Em pwd +.Pp +A master password may be set in a addition to the user password. The purpose of +the master password is to allow an administrator to establish a password that +is kept secret from the user, and which may be used to unlock the device if the +user password is lost. +.Pp +.Em Note: +Setting the master password does not enable device security. +.Pp +If the master password is set and the drive supports a Master Revision Code +feature the Master Password Revision Code will be decremented. +.It Fl T Ar timeout +.Pp +Overrides the default timeout, specified in seconds, used for both +.Fl e +and +.Fl h +this is useful if your system has problems processing long timeouts correctly. +.Pp +Usually the timeout is calculated from the information stored on the drive if +present, otherwise it defaults to 2 hours. +.It Fl U Ar user|master +.Pp +Specifies which user to set / use for the running action command, valid values +are user or master and defaults to master if not set. +.Pp +This option must be used in conjunction with one of the security action commands. +.Pp +Defaults to +.Em master +.It Fl y +.Pp +Confirm yes to dangerous options such as +.Fl e +without prompting for confirmation. +.Pp +.El +If the password specified for any action commands doesn't match the configured +password for the specified user the command will fail. +.Pp +The password in all cases is limited to 32 characters, longer passwords will +fail. .It Ic help Print out verbose usage information. .El @@ -974,6 +1106,30 @@ camcontrol negotiate -n da -u 3 -R 20.00 Negotiate a sync rate of 20MHz and an offset of 15 with da3. Then send a Test Unit Ready command to make the settings take effect. +.Bd -literal -offset indent +camcontrol security ada0 +.Ed +.Pp +Report security support and settings for ada0 +.Bd -literal -offset indent +camcontrol security ada0 -u user -s MyPass +.Ed +.Pp +Enable security on device ada0 with the password MyPass +.Bd -literal -offset indent +camcontrol security ada0 -u user -e MyPass +.Ed +.Pp +Secure erase ada0 which has had security enabled with user password MyPass +.Pp +.Em WARNING! WARNING! WARNING! +.Pp +This will +.Em ERASE ALL +data from the device, so backup your data before using! +.Pp +This command can be used used against an SSD drive to restoring it to +factory default write performance. .Sh SEE ALSO .Xr cam 3 , .Xr cam_cdbparse 3 , Modified: stable/8/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.c Fri Jun 7 12:42:49 2013 (r251493) +++ stable/8/sbin/camcontrol/camcontrol.c Fri Jun 7 13:30:59 2013 (r251494) @@ -77,7 +77,8 @@ typedef enum { CAM_CMD_IDENTIFY = 0x00000013, CAM_CMD_IDLE = 0x00000014, CAM_CMD_STANDBY = 0x00000015, - CAM_CMD_SLEEP = 0x00000016 + CAM_CMD_SLEEP = 0x00000016, + CAM_CMD_SECURITY = 0x00000017 } cam_cmdmask; typedef enum { @@ -127,6 +128,7 @@ struct camcontrol_opts { static const char scsicmd_opts[] = "a:c:dfi:o:r"; static const char readdefect_opts[] = "f:GP"; static const char negotiate_opts[] = "acD:M:O:qR:T:UW:"; +static char pwd_opt; #endif struct camcontrol_opts option_table[] = { @@ -161,6 +163,7 @@ struct camcontrol_opts option_table[] = {"idle", CAM_CMD_IDLE, CAM_ARG_NONE, "t:"}, {"standby", CAM_CMD_STANDBY, CAM_ARG_NONE, "t:"}, {"sleep", CAM_CMD_SLEEP, CAM_ARG_NONE, ""}, + {"security", CAM_CMD_SECURITY, CAM_ARG_NONE, "d:e:fh:k:l:qs:T:U:y"}, #endif /* MINIMALISTIC */ {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -225,7 +228,10 @@ static int scsireportluns(struct cam_dev static int scsireadcapacity(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); static int atapm(struct cam_device *device, int argc, char **argv, - char *combinedopt, int retry_count, int timeout); + char *combinedopt, int retry_count, int timeout); +static int atasecurity(struct cam_device *device, int retry_count, int timeout, + int argc, char **argv, char *combinedopt); + #endif /* MINIMALISTIC */ #ifndef min #define min(a,b) (((a)<(b))?(a):(b)) @@ -1260,55 +1266,93 @@ atacapprint(struct ata_params *parm) printf("free-fall %s %s\n", parm->support2 & ATA_SUPPORT_FREEFALL ? "yes" : "no", parm->enabled2 & ATA_SUPPORT_FREEFALL ? "yes" : "no"); - printf("data set management (TRIM) %s\n", - parm->support_dsm & ATA_SUPPORT_DSM_TRIM ? "yes" : "no"); + printf("Data Set Management (DSM/TRIM) "); + if (parm->support_dsm & ATA_SUPPORT_DSM_TRIM) { + printf("yes\n"); + printf("DSM - max 512byte blocks "); + if (parm->max_dsm_blocks == 0x00) + printf("yes not specified\n"); + else + printf("yes %d\n", + parm->max_dsm_blocks); + + printf("DSM - deterministic read "); + if (parm->support3 & ATA_SUPPORT_DRAT) { + if (parm->support3 & ATA_SUPPORT_RZAT) + printf("yes zeroed\n"); + else + printf("yes any value\n"); + } else { + printf("no\n"); + } + } else { + printf("no\n"); + } } static int -ataidentify(struct cam_device *device, int retry_count, int timeout) +scsi_cam_pass_16_send(struct cam_device *device, union ccb *ccb, int quiet) { - union ccb *ccb; - struct ata_params *ident_buf; - struct ccb_getdev cgd; - u_int i, error = 0; - int16_t *ptr; + struct ata_pass_16 *ata_pass_16; + struct ata_cmd ata_cmd; - if (get_cgd(device, &cgd) != 0) { - warnx("couldn't get CGD"); - return(1); - } - ccb = cam_getccb(device); + ata_pass_16 = (struct ata_pass_16 *)ccb->csio.cdb_io.cdb_bytes; + ata_cmd.command = ata_pass_16->command; + ata_cmd.control = ata_pass_16->control; + ata_cmd.features = ata_pass_16->features; - if (ccb == NULL) { - warnx("couldn't allocate CCB"); - return(1); + if (arglist & CAM_ARG_VERBOSE) { + warnx("sending ATA %s via pass_16 with timeout of %u msecs", + ata_op_string(&ata_cmd), + ccb->csio.ccb_h.timeout); } - /* cam_getccb cleans up the header, caller has to zero the payload */ - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_ataio) - sizeof(struct ccb_hdr)); + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; - ptr = (uint16_t *)malloc(sizeof(struct ata_params)); + if (arglist & CAM_ARG_ERR_RECOVER) + ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; - if (ptr == NULL) { - cam_freeccb(ccb); - warnx("can't malloc memory for identify\n"); - return(1); + if (cam_send_ccb(device, ccb) < 0) { + if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { + warn("error sending ATA %s via pass_16", + ata_op_string(&ata_cmd)); + } + + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + + return (1); } - bzero(ptr, sizeof(struct ata_params)); - cam_fill_ataio(&ccb->ataio, - retry_count, - NULL, - /*flags*/CAM_DIR_IN, - MSG_SIMPLE_Q_TAG, - /*data_ptr*/(u_int8_t *)ptr, - /*dxfer_len*/sizeof(struct ata_params), - timeout ? timeout : 30 * 1000); - if (cgd.protocol == PROTO_ATA) - ata_28bit_cmd(&ccb->ataio, ATA_ATA_IDENTIFY, 0, 0, 0); - else - ata_28bit_cmd(&ccb->ataio, ATA_ATAPI_IDENTIFY, 0, 0, 0); + if (!(ata_pass_16->flags & AP_FLAG_CHK_COND) && + (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { + warnx("ATA %s via pass_16 failed", + ata_op_string(&ata_cmd)); + } + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + + return (1); + } + + return (0); +} + + +static int +ata_cam_send(struct cam_device *device, union ccb *ccb, int quiet) +{ + if (arglist & CAM_ARG_VERBOSE) { + warnx("sending ATA %s with timeout of %u msecs", + ata_op_string(&(ccb->ataio.cmd)), + ccb->ataio.ccb_h.timeout); + } /* Disable freezing the device queue */ ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; @@ -1317,47 +1361,247 @@ ataidentify(struct cam_device *device, i ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending ATA identify"); + if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { + warn("error sending ATA %s", + ata_op_string(&(ccb->ataio.cmd))); + } if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } - free(ptr); - cam_freeccb(ccb); - return(1); + return (1); } if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - error = 1; + if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { + warnx("ATA %s failed: %d", + ata_op_string(&(ccb->ataio.cmd)), quiet); + } if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } + + return (1); } - cam_freeccb(ccb); + return (0); +} + +static int +ata_do_pass_16(struct cam_device *device, union ccb *ccb, int retries, + u_int32_t flags, u_int8_t protocol, u_int8_t ata_flags, + u_int8_t tag_action, u_int8_t command, u_int8_t features, + u_int64_t lba, u_int8_t sector_count, u_int8_t *data_ptr, + u_int16_t dxfer_len, int timeout, int quiet) +{ + if (data_ptr != NULL) { + ata_flags |= AP_FLAG_BYT_BLOK_BYTES | + AP_FLAG_TLEN_SECT_CNT; + if (flags & CAM_DIR_OUT) + ata_flags |= AP_FLAG_TDIR_TO_DEV; + else + ata_flags |= AP_FLAG_TDIR_FROM_DEV; + } else { + ata_flags |= AP_FLAG_TLEN_NO_DATA; + } + + bzero(&(&ccb->ccb_h)[1], + sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + + scsi_ata_pass_16(&ccb->csio, + retries, + NULL, + flags, + tag_action, + protocol, + ata_flags, + features, + sector_count, + lba, + command, + /*control*/0, + data_ptr, + dxfer_len, + /*sense_len*/SSD_FULL_SIZE, + timeout); + + return scsi_cam_pass_16_send(device, ccb, quiet); +} + +static int +ata_try_pass_16(struct cam_device *device) +{ + struct ccb_pathinq cpi; + + if (get_cpi(device, &cpi) != 0) { + warnx("couldn't get CPI"); + return (-1); + } + + if (cpi.protocol == PROTO_SCSI) { + /* possibly compatible with pass_16 */ + return (1); + } + + /* likely not compatible with pass_16 */ + return (0); +} + +static int +ata_do_28bit_cmd(struct cam_device *device, union ccb *ccb, int retries, + u_int32_t flags, u_int8_t protocol, u_int8_t tag_action, + u_int8_t command, u_int8_t features, u_int32_t lba, + u_int8_t sector_count, u_int8_t *data_ptr, u_int16_t dxfer_len, + int timeout, int quiet) +{ + + + switch (ata_try_pass_16(device)) { + case -1: + return (1); + case 1: + /* Try using SCSI Passthrough */ + return ata_do_pass_16(device, ccb, retries, flags, protocol, + 0, tag_action, command, features, lba, + sector_count, data_ptr, dxfer_len, + timeout, quiet); + } + + bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_ataio) - + sizeof(struct ccb_hdr)); + cam_fill_ataio(&ccb->ataio, + retries, + NULL, + flags, + tag_action, + data_ptr, + dxfer_len, + timeout); + + ata_28bit_cmd(&ccb->ataio, command, features, lba, sector_count); + return ata_cam_send(device, ccb, quiet); +} + +static void +dump_data(uint16_t *ptr, uint32_t len) +{ + u_int i; + + for (i = 0; i < len / 2; i++) { + if ((i % 8) == 0) + printf(" %3d: ", i); + printf("%04hx ", ptr[i]); + if ((i % 8) == 7) + printf("\n"); + } + if ((i % 8) != 7) + printf("\n"); +} + +static int +ata_do_identify(struct cam_device *device, int retry_count, int timeout, + union ccb *ccb, struct ata_params** ident_bufp) +{ + struct ata_params *ident_buf; + struct ccb_pathinq cpi; + struct ccb_getdev cgd; + u_int i, error; + int16_t *ptr; + u_int8_t command, retry_command; + + if (get_cpi(device, &cpi) != 0) { + warnx("couldn't get CPI"); + return (-1); + } + + /* Neither PROTO_ATAPI or PROTO_SATAPM are used in cpi.protocol */ + if (cpi.protocol == PROTO_ATA) { + if (get_cgd(device, &cgd) != 0) { + warnx("couldn't get CGD"); + return (-1); + } + + command = (cgd.protocol == PROTO_ATA) ? + ATA_ATA_IDENTIFY : ATA_ATAPI_IDENTIFY; + retry_command = 0; + } else { + /* We don't know which for sure so try both */ + command = ATA_ATA_IDENTIFY; + retry_command = ATA_ATAPI_IDENTIFY; + } + + ptr = (uint16_t *)calloc(1, sizeof(struct ata_params)); + if (ptr == NULL) { + warnx("can't calloc memory for identify\n"); + return (1); + } + + error = ata_do_28bit_cmd(device, + ccb, + /*retries*/retry_count, + /*flags*/CAM_DIR_IN, + /*protocol*/AP_PROTO_PIO_IN, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/command, + /*features*/0, + /*lba*/0, + /*sector_count*/(u_int8_t)sizeof(struct ata_params), + /*data_ptr*/(u_int8_t *)ptr, + /*dxfer_len*/sizeof(struct ata_params), + /*timeout*/timeout ? timeout : 30 * 1000, + /*quiet*/1); if (error != 0) { - free(ptr); - return(error); + if (retry_command == 0) { + free(ptr); + return (1); + } + error = ata_do_28bit_cmd(device, + ccb, + /*retries*/retry_count, + /*flags*/CAM_DIR_IN, + /*protocol*/AP_PROTO_PIO_IN, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/retry_command, + /*features*/0, + /*lba*/0, + /*sector_count*/(u_int8_t) + sizeof(struct ata_params), + /*data_ptr*/(u_int8_t *)ptr, + /*dxfer_len*/sizeof(struct ata_params), + /*timeout*/timeout ? timeout : 30 * 1000, + /*quiet*/0); + + if (error != 0) { + free(ptr); + return (1); + } } - for (i = 0; i < sizeof(struct ata_params) / 2; i++) + error = 1; + for (i = 0; i < sizeof(struct ata_params) / 2; i++) { ptr[i] = le16toh(ptr[i]); + if (ptr[i] != 0) + error = 0; + } + if (arglist & CAM_ARG_VERBOSE) { fprintf(stdout, "%s%d: Raw identify data:\n", device->device_name, device->dev_unit_num); - for (i = 0; i < sizeof(struct ata_params) / 2; i++) { - if ((i % 8) == 0) - fprintf(stdout, " %3d: ", i); - fprintf(stdout, "%04x ", (uint16_t)ptr[i]); - if ((i % 8) == 7) - fprintf(stdout, "\n"); - } + dump_data(ptr, sizeof(struct ata_params)); + } + + /* check for invalid (all zero) response */ + if (error != 0) { + warnx("Invalid identify response detected"); + free(ptr); + return (error); } + ident_buf = (struct ata_params *)ptr; if (strncmp(ident_buf->model, "FX", 2) && strncmp(ident_buf->model, "NEC", 3) && @@ -1378,15 +1622,636 @@ ataidentify(struct cam_device *device, i ata_bpack(ident_buf->media_serial, ident_buf->media_serial, sizeof(ident_buf->media_serial)); - fprintf(stdout, "%s%d: ", device->device_name, - device->dev_unit_num); + *ident_bufp = ident_buf; + + return (0); +} + + +static int +ataidentify(struct cam_device *device, int retry_count, int timeout) +{ + union ccb *ccb; + struct ata_params *ident_buf; + + if ((ccb = cam_getccb(device)) == NULL) { + warnx("couldn't allocate CCB"); + return (1); + } + + if (ata_do_identify(device, retry_count, timeout, ccb, &ident_buf) != 0) { + cam_freeccb(ccb); + return (1); + } + + printf("%s%d: ", device->device_name, device->dev_unit_num); ata_print_ident(ident_buf); camxferrate(device); atacapprint(ident_buf); free(ident_buf); + cam_freeccb(ccb); - return(0); + return (0); +} +#endif /* MINIMALISTIC */ + + +#ifndef MINIMALISTIC +enum { + ATA_SECURITY_ACTION_PRINT, + ATA_SECURITY_ACTION_FREEZE, + ATA_SECURITY_ACTION_UNLOCK, + ATA_SECURITY_ACTION_DISABLE, + ATA_SECURITY_ACTION_ERASE, + ATA_SECURITY_ACTION_ERASE_ENHANCED, + ATA_SECURITY_ACTION_SET_PASSWORD +} atasecurity_action; + +static void +atasecurity_print_time(u_int16_t tw) +{ + + if (tw == 0) + printf("unspecified"); + else if (tw >= 255) + printf("> 508 min"); + else + printf("%i min", 2 * tw); +} + +static u_int32_t +atasecurity_erase_timeout_msecs(u_int16_t timeout) +{ + + if (timeout == 0) + return 2 * 3600 * 1000; /* default: two hours */ + else if (timeout > 255) + return (508 + 60) * 60 * 1000; /* spec says > 508 minutes */ + + return ((2 * timeout) + 5) * 60 * 1000; /* add a 5min margin */ +} + + +static void +atasecurity_notify(u_int8_t command, struct ata_security_password *pwd) +{ + struct ata_cmd cmd; + + bzero(&cmd, sizeof(cmd)); + cmd.command = command; + printf("Issuing %s", ata_op_string(&cmd)); + + if (pwd != NULL) { + char pass[sizeof(pwd->password)+1]; + + /* pwd->password may not be null terminated */ + pass[sizeof(pwd->password)] = '\0'; + strncpy(pass, pwd->password, sizeof(pwd->password)); + printf(" password='%s', user='%s'", + pass, + (pwd->ctrl & ATA_SECURITY_PASSWORD_MASTER) ? + "master" : "user"); + + if (command == ATA_SECURITY_SET_PASSWORD) { + printf(", mode='%s'", + (pwd->ctrl & ATA_SECURITY_LEVEL_MAXIMUM) ? + "maximum" : "high"); + } + } + + printf("\n"); +} + +static int +atasecurity_freeze(struct cam_device *device, union ccb *ccb, + int retry_count, u_int32_t timeout, int quiet) +{ + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_FREEZE_LOCK, NULL); + + return ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_NONE, + /*protocol*/AP_PROTO_NON_DATA, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_FREEZE_LOCK, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + /*timeout*/timeout, + /*quiet*/0); +} + +static int +atasecurity_unlock(struct cam_device *device, union ccb *ccb, + int retry_count, u_int32_t timeout, + struct ata_security_password *pwd, int quiet) +{ + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_UNLOCK, pwd); + + return ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_UNLOCK, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*quiet*/0); +} + +static int +atasecurity_disable(struct cam_device *device, union ccb *ccb, + int retry_count, u_int32_t timeout, + struct ata_security_password *pwd, int quiet) +{ + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_DISABLE_PASSWORD, pwd); + return ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_DISABLE_PASSWORD, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*quiet*/0); +} + + +static int +atasecurity_erase_confirm(struct cam_device *device, + struct ata_params* ident_buf) +{ + + printf("\nYou are about to ERASE ALL DATA from the following" + " device:\n%s%d,%s%d: ", device->device_name, + device->dev_unit_num, device->given_dev_name, + device->given_unit_number); + ata_print_ident(ident_buf); + + for(;;) { + char str[50]; + printf("\nAre you SURE you want to ERASE ALL DATA? (yes/no) "); + + if (fgets(str, sizeof(str), stdin) != NULL) { + if (strncasecmp(str, "yes", 3) == 0) { + return (1); + } else if (strncasecmp(str, "no", 2) == 0) { + return (0); + } else { + printf("Please answer \"yes\" or " + "\"no\"\n"); + } + } + } + + /* NOTREACHED */ + return (0); +} + +static int +atasecurity_erase(struct cam_device *device, union ccb *ccb, + int retry_count, u_int32_t timeout, + u_int32_t erase_timeout, + struct ata_security_password *pwd, int quiet) +{ + int error; + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_ERASE_PREPARE, NULL); + + error = ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_NONE, + /*protocol*/AP_PROTO_NON_DATA, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_ERASE_PREPARE, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + /*timeout*/timeout, + /*quiet*/0); + + if (error != 0) + return error; + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_ERASE_UNIT, pwd); + + error = ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_ERASE_UNIT, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/erase_timeout, + /*quiet*/0); + + if (error == 0 && quiet == 0) + printf("\nErase Complete\n"); + + return error; +} + +static int +atasecurity_set_password(struct cam_device *device, union ccb *ccb, + int retry_count, u_int32_t timeout, + struct ata_security_password *pwd, int quiet) +{ + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_SET_PASSWORD, pwd); + + return ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_SET_PASSWORD, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*quiet*/0); +} + +static void +atasecurity_print(struct ata_params *parm) +{ + + printf("\nSecurity Option Value\n"); + if (arglist & CAM_ARG_VERBOSE) { + printf("status %04x\n", + parm->security_status); + } + printf("supported %s\n", + parm->security_status & ATA_SECURITY_SUPPORTED ? "yes" : "no"); + if (!(parm->security_status & ATA_SECURITY_SUPPORTED)) + return; + printf("enabled %s\n", + parm->security_status & ATA_SECURITY_ENABLED ? "yes" : "no"); + printf("drive locked %s\n", + parm->security_status & ATA_SECURITY_LOCKED ? "yes" : "no"); + printf("security config frozen %s\n", + parm->security_status & ATA_SECURITY_FROZEN ? "yes" : "no"); + printf("count expired %s\n", + parm->security_status & ATA_SECURITY_COUNT_EXP ? "yes" : "no"); + printf("security level %s\n", + parm->security_status & ATA_SECURITY_LEVEL ? "maximum" : "high"); + printf("enhanced erase supported %s\n", + parm->security_status & ATA_SECURITY_ENH_SUPP ? "yes" : "no"); + printf("erase time "); + atasecurity_print_time(parm->erase_time); + printf("\n"); + printf("enhanced erase time "); + atasecurity_print_time(parm->enhanced_erase_time); + printf("\n"); + printf("master password rev %04x%s\n", + parm->master_passwd_revision, + parm->master_passwd_revision == 0x0000 || + parm->master_passwd_revision == 0xFFFF ? " (unsupported)" : ""); +} + +/* + * Validates and copies the password in optarg to the passed buffer. + * If the password in optarg is the same length as the buffer then + * the data will still be copied but no null termination will occur. + */ +static int +ata_getpwd(u_int8_t *passwd, int max, char opt) +{ + int len; + + len = strlen(optarg); + if (len > max) { + warnx("-%c password is too long", opt); + return (1); + } else if (len == 0) { + warnx("-%c password is missing", opt); + return (1); + } else if (optarg[0] == '-'){ + warnx("-%c password starts with '-' (generic arg?)", opt); + return (1); + } else if (strlen(passwd) != 0 && strcmp(passwd, optarg) != 0) { + warnx("-%c password conflicts with existing password from -%c", + opt, pwd_opt); + return (1); + } + + /* Callers pass in a buffer which does NOT need to be terminated */ + strncpy(passwd, optarg, max); + pwd_opt = opt; + + return (0); +} + +static int +atasecurity(struct cam_device *device, int retry_count, int timeout, + int argc, char **argv, char *combinedopt) +{ + union ccb *ccb; + struct ata_params *ident_buf; + int error, confirm, quiet, c, action, actions, setpwd; + int security_enabled, erase_timeout, pwdsize; + struct ata_security_password pwd; + + actions = 0; + setpwd = 0; + erase_timeout = 0; + confirm = 0; + quiet = 0; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 13:45:59 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 38FBF394; Fri, 7 Jun 2013 13:45:59 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 11BCF1FE1; Fri, 7 Jun 2013 13:45:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57Djwf2019778; Fri, 7 Jun 2013 13:45:58 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57Djwub019775; Fri, 7 Jun 2013 13:45:58 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201306071345.r57Djwub019775@svn.freebsd.org> From: Ed Maste Date: Fri, 7 Jun 2013 13:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251495 - head/lib/libusb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 13:45:59 -0000 Author: emaste Date: Fri Jun 7 13:45:58 2013 New Revision: 251495 URL: http://svnweb.freebsd.org/changeset/base/251495 Log: Add libusb_get_port_numbers libusbx deprecated libusb_get_port_path and replaced it with libusb_get_port_numbers. The latter omits an extra parameter which was unused in the FreeBSD implementation anyway. Modified: head/lib/libusb/libusb.3 head/lib/libusb/libusb.h head/lib/libusb/libusb10.c Modified: head/lib/libusb/libusb.3 ============================================================================== --- head/lib/libusb/libusb.3 Fri Jun 7 13:30:59 2013 (r251494) +++ head/lib/libusb/libusb.3 Fri Jun 7 13:45:58 2013 (r251495) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 7, 2013 +.Dd June 7, 2013 .Dt LIBUSB 3 .Os .Sh NAME @@ -103,7 +103,7 @@ Returns the number of the bus contained .Fa dev . .Pp .Ft int -.Fn libusb_get_port_path "libusb_context *ctx" "libusb_device *dev" "uint8_t *buf" "uint8_t bufsize" +.Fn libusb_get_port_numbers "libusb_device *dev" "uint8_t *buf" "uint8_t bufsize" Stores, in the buffer .Fa buf of size @@ -111,6 +111,10 @@ of size the list of all port numbers from root for the device .Fa dev . .Pp +.Ft int +.Fn libusb_get_port_path "libusb_context *ctx" "libusb_device *dev" "uint8_t *buf" "uint8_t bufsize" +Deprecated function equivalent to libusb_get_port_numbers. +.Pp .Ft uint8_t .Fn libusb_get_device_address "libusb_device *dev" Returns the device_address contained by the device Modified: head/lib/libusb/libusb.h ============================================================================== --- head/lib/libusb/libusb.h Fri Jun 7 13:30:59 2013 (r251494) +++ head/lib/libusb/libusb.h Fri Jun 7 13:45:58 2013 (r251495) @@ -369,6 +369,7 @@ void libusb_exit(struct libusb_context * ssize_t libusb_get_device_list(libusb_context * ctx, libusb_device *** list); void libusb_free_device_list(libusb_device ** list, int unref_devices); uint8_t libusb_get_bus_number(libusb_device * dev); +int libusb_get_port_numbers(libusb_device *dev, uint8_t *buf, uint8_t bufsize); int libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *buf, uint8_t bufsize); uint8_t libusb_get_device_address(libusb_device * dev); enum libusb_speed libusb_get_device_speed(libusb_device * dev); Modified: head/lib/libusb/libusb10.c ============================================================================== --- head/lib/libusb/libusb10.c Fri Jun 7 13:30:59 2013 (r251494) +++ head/lib/libusb/libusb10.c Fri Jun 7 13:45:58 2013 (r251495) @@ -291,6 +291,12 @@ libusb_get_bus_number(libusb_device *dev } int +libusb_get_port_numbers(libusb_device *dev, uint8_t *buf, uint8_t bufsize) +{ + return (libusb20_dev_get_port_path(dev->os_priv, buf, bufsize)); +} + +int libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *buf, uint8_t bufsize) { From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 13:59:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7EF907C3; Fri, 7 Jun 2013 13:59:42 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 61D4510C3; Fri, 7 Jun 2013 13:59:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57DxgRg023366; Fri, 7 Jun 2013 13:59:42 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57Dxfgd023363; Fri, 7 Jun 2013 13:59:41 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306071359.r57Dxfgd023363@svn.freebsd.org> From: Steven Hartland Date: Fri, 7 Jun 2013 13:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251496 - in stable/8: sbin/camcontrol sys/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 13:59:42 -0000 Author: smh Date: Fri Jun 7 13:59:41 2013 New Revision: 251496 URL: http://svnweb.freebsd.org/changeset/base/251496 Log: MFC r249895: Add Host Protected Area (HPA) support to camcontrol MFC r249904: mdoc: remove superfluous paragraph macro. MFC r249153: (included in r251494) mdoc: remove superfluous paragraph macro. Modified: stable/8/sbin/camcontrol/camcontrol.8 stable/8/sbin/camcontrol/camcontrol.c stable/8/sys/sys/ata.h Directory Properties: stable/8/sbin/camcontrol/ (props changed) stable/8/sys/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.8 Fri Jun 7 13:45:58 2013 (r251495) +++ stable/8/sbin/camcontrol/camcontrol.8 Fri Jun 7 13:59:41 2013 (r251496) @@ -199,6 +199,18 @@ .Op Fl U Ar user|master .Op Fl y .Nm +.Ic hpa +.Op device id +.Op generic args +.Op Fl f +.Op Fl l +.Op Fl P +.Op Fl p Ar pwd +.Op Fl q +.Op Fl s Ar max_sectors +.Op Fl U Ar pwd +.Op Fl y +.Nm .Ic help .Sh DESCRIPTION The @@ -988,6 +1000,73 @@ password for the specified user the comm .Pp The password in all cases is limited to 32 characters, longer passwords will fail. +.It Ic hpa +Update or report Host Protected Area details. +By default +.Nm +will print out the HPA support and associated settings of the device. +The +.Ic hpa +command takes several optional arguments: +.Bl -tag -width 0n +.It Fl f +.Pp +Freeze the HPA configuration of the specified device. +.Pp +After command completion any other commands that update the HPA configuration +shall be command aborted. +Frozen mode is disabled by power-off or hardware reset. +.It Fl l +.Pp +Lock the HPA configuration of the device until a successful call to unlock or +the next power-on reset occurs. +.It Fl P +.Pp +Make the HPA max sectors persist across power-on reset or a hardware reset. +This must be used in combination with +.Fl s Ar max_sectors +. +.It Fl p Ar pwd +.Pp +Set the HPA configuration password required for unlock calls. +.It Fl q +.Pp +Be quiet, do not print any status messages. +This option will not disable the questions. +To disable questions, use the +.Fl y +argument, below. +.It Fl s Ar max_sectors +.Pp +Configures the maximum user accessible sectors of the device. +This will change the number of sectors the device reports. +.Pp +.Em WARNING! WARNING! WARNING! +.Pp +Changing the max sectors of a device using this option will make the data on +the device beyond the specified value inaccessible. +.Pp +Only one successful +.Fl s Ar max_sectors +call can be made without a power-on reset or a hardware reset of the device. +.It Fl U Ar pwd +.Pp +Unlock the HPA configuration of the specified device using the given password. +If the password specified doesn't match the password configured via +.Fl p Ar pwd +the command will fail. +.Pp +After 5 failed unlock calls, due to password miss-match, the device will refuse +additional unlock calls until after a power-on reset. +.It Fl y +.Pp +Confirm yes to dangerous options such as +.Fl e +without prompting for confirmation +.Pp +.El +The password for all HPA commands is limited to 32 characters, longer passwords +will fail. .It Ic help Print out verbose usage information. .El @@ -1130,6 +1209,28 @@ data from the device, so backup your dat .Pp This command can be used used against an SSD drive to restoring it to factory default write performance. +.Bd -literal -offset indent +camcontrol hpa ada0 +.Ed +.Pp +Report HPA support and settings for ada0 (also reported via +identify). +.Bd -literal -offset indent +camcontrol hpa ada0 -s 10240 +.Ed +.Pp +Enables HPA on ada0 setting the maximum reported sectors to 10240. +.Pp +.Em WARNING! WARNING! WARNING! +.Pp +This will +.Em PREVENT ACCESS +to all data on the device beyond this limit until HPA is disabled by setting +HPA to native max sectors of the device, which can only be done after a +power-on or hardware reset! +.Pp +.Em DO NOT +use this on a device which has an active filesystem! .Sh SEE ALSO .Xr cam 3 , .Xr cam_cdbparse 3 , Modified: stable/8/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.c Fri Jun 7 13:45:58 2013 (r251495) +++ stable/8/sbin/camcontrol/camcontrol.c Fri Jun 7 13:59:41 2013 (r251496) @@ -42,6 +42,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifndef MINIMALISTIC +#include +#include +#endif #include #include @@ -78,7 +82,8 @@ typedef enum { CAM_CMD_IDLE = 0x00000014, CAM_CMD_STANDBY = 0x00000015, CAM_CMD_SLEEP = 0x00000016, - CAM_CMD_SECURITY = 0x00000017 + CAM_CMD_SECURITY = 0x00000017, + CAM_CMD_HPA = 0x00000018 } cam_cmdmask; typedef enum { @@ -125,6 +130,29 @@ struct camcontrol_opts { }; #ifndef MINIMALISTIC +struct ata_res_pass16 { + u_int16_t reserved[5]; + u_int8_t flags; + u_int8_t error; + u_int8_t sector_count_exp; + u_int8_t sector_count; + u_int8_t lba_low_exp; + u_int8_t lba_low; + u_int8_t lba_mid_exp; + u_int8_t lba_mid; + u_int8_t lba_high_exp; + u_int8_t lba_high; + u_int8_t device; + u_int8_t status; +}; + +struct ata_set_max_pwd +{ + u_int16_t reserved1; + u_int8_t password[32]; + u_int16_t reserved2[239]; +}; + static const char scsicmd_opts[] = "a:c:dfi:o:r"; static const char readdefect_opts[] = "f:GP"; static const char negotiate_opts[] = "acD:M:O:qR:T:UW:"; @@ -164,6 +192,7 @@ struct camcontrol_opts option_table[] = {"standby", CAM_CMD_STANDBY, CAM_ARG_NONE, "t:"}, {"sleep", CAM_CMD_SLEEP, CAM_ARG_NONE, ""}, {"security", CAM_CMD_SECURITY, CAM_ARG_NONE, "d:e:fh:k:l:qs:T:U:y"}, + {"hpa", CAM_CMD_HPA, CAM_ARG_NONE, "Pflp:qs:U:y"}, #endif /* MINIMALISTIC */ {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -231,6 +260,8 @@ static int atapm(struct cam_device *devi char *combinedopt, int retry_count, int timeout); static int atasecurity(struct cam_device *device, int retry_count, int timeout, int argc, char **argv, char *combinedopt); +static int atahpa(struct cam_device *device, int retry_count, int timeout, + int argc, char **argv, char *combinedopt); #endif /* MINIMALISTIC */ #ifndef min @@ -1060,6 +1091,38 @@ xferrate_bailout: } static void +atahpa_print(struct ata_params *parm, u_int64_t hpasize, int header) +{ + u_int32_t lbasize = (u_int32_t)parm->lba_size_1 | + ((u_int32_t)parm->lba_size_2 << 16); + + u_int64_t lbasize48 = ((u_int64_t)parm->lba_size48_1) | + ((u_int64_t)parm->lba_size48_2 << 16) | + ((u_int64_t)parm->lba_size48_3 << 32) | + ((u_int64_t)parm->lba_size48_4 << 48); + + if (header) { + printf("\nFeature " + "Support Enabled Value\n"); + } + + printf("Host Protected Area (HPA) "); + if (parm->support.command1 & ATA_SUPPORT_PROTECTED) { + u_int64_t lba = lbasize48 ? lbasize48 : lbasize; + printf("yes %s %ju/%ju\n", (hpasize > lba) ? "yes" : "no ", + lba, hpasize); + + printf("HPA - Security "); + if (parm->support.command1 & ATA_SUPPORT_MAXSECURITY) + printf("yes\n"); + else + printf("no\n"); + } else { + printf("no\n"); + } +} + +static void atacapprint(struct ata_params *parm) { u_int32_t lbasize = (u_int32_t)parm->lba_size_1 | @@ -1486,6 +1549,83 @@ ata_do_28bit_cmd(struct cam_device *devi return ata_cam_send(device, ccb, quiet); } +static int +ata_do_cmd(struct cam_device *device, union ccb *ccb, int retries, + u_int32_t flags, u_int8_t protocol, u_int8_t ata_flags, + u_int8_t tag_action, u_int8_t command, u_int8_t features, + u_int64_t lba, u_int8_t sector_count, u_int8_t *data_ptr, + u_int16_t dxfer_len, int timeout, int force48bit) +{ + int retval; + + retval = ata_try_pass_16(device); + if (retval == -1) + return (1); + + if (retval == 1) { + int error; + + /* Try using SCSI Passthrough */ + error = ata_do_pass_16(device, ccb, retries, flags, protocol, + ata_flags, tag_action, command, features, + lba, sector_count, data_ptr, dxfer_len, + timeout, 0); + + if (ata_flags & AP_FLAG_CHK_COND) { + /* Decode ata_res from sense data */ + struct ata_res_pass16 *res_pass16; + struct ata_res *res; + u_int i; + u_int16_t *ptr; + + /* sense_data is 4 byte aligned */ + ptr = (uint16_t*)(uintptr_t)&ccb->csio.sense_data; + for (i = 0; i < sizeof(*res_pass16) / 2; i++) + ptr[i] = le16toh(ptr[i]); + + /* sense_data is 4 byte aligned */ + res_pass16 = (struct ata_res_pass16 *)(uintptr_t) + &ccb->csio.sense_data; + res = &ccb->ataio.res; + res->flags = res_pass16->flags; + res->status = res_pass16->status; + res->error = res_pass16->error; + res->lba_low = res_pass16->lba_low; + res->lba_mid = res_pass16->lba_mid; + res->lba_high = res_pass16->lba_high; + res->device = res_pass16->device; + res->lba_low_exp = res_pass16->lba_low_exp; + res->lba_mid_exp = res_pass16->lba_mid_exp; + res->lba_high_exp = res_pass16->lba_high_exp; + res->sector_count = res_pass16->sector_count; + res->sector_count_exp = res_pass16->sector_count_exp; + } + + return (error); + } + + bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_ataio) - + sizeof(struct ccb_hdr)); + cam_fill_ataio(&ccb->ataio, + retries, + NULL, + flags, + tag_action, + data_ptr, + dxfer_len, + timeout); + + if (force48bit || lba > ATA_MAX_28BIT_LBA) + ata_48bit_cmd(&ccb->ataio, command, features, lba, sector_count); + else + ata_28bit_cmd(&ccb->ataio, command, features, lba, sector_count); + + if (ata_flags & AP_FLAG_CHK_COND) + ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT; + + return ata_cam_send(device, ccb, 0); +} + static void dump_data(uint16_t *ptr, uint32_t len) { @@ -1503,6 +1643,278 @@ dump_data(uint16_t *ptr, uint32_t len) } static int +atahpa_proc_resp(struct cam_device *device, union ccb *ccb, + int is48bit, u_int64_t *hpasize) +{ + struct ata_res *res; + + res = &ccb->ataio.res; + if (res->status & ATA_STATUS_ERROR) { + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + printf("error = 0x%02x, sector_count = 0x%04x, " + "device = 0x%02x, status = 0x%02x\n", + res->error, res->sector_count, + res->device, res->status); + } + + if (res->error & ATA_ERROR_ID_NOT_FOUND) { + warnx("Max address has already been set since " + "last power-on or hardware reset"); + } + + return (1); + } + + if (arglist & CAM_ARG_VERBOSE) { + fprintf(stdout, "%s%d: Raw native max data:\n", + device->device_name, device->dev_unit_num); + /* res is 4 byte aligned */ + dump_data((uint16_t*)(uintptr_t)res, sizeof(struct ata_res)); + + printf("error = 0x%02x, sector_count = 0x%04x, device = 0x%02x, " + "status = 0x%02x\n", res->error, res->sector_count, + res->device, res->status); + } + + if (hpasize != NULL) { + if (is48bit) { + *hpasize = (((u_int64_t)((res->lba_high_exp << 16) | + (res->lba_mid_exp << 8) | res->lba_low_exp) << 24) | + ((res->lba_high << 16) | (res->lba_mid << 8) | + res->lba_low)) + 1; + } else { + *hpasize = (((res->device & 0x0f) << 24) | + (res->lba_high << 16) | (res->lba_mid << 8) | + res->lba_low) + 1; + } + } + + return (0); +} + +static int +ata_read_native_max(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, + struct ata_params *parm, u_int64_t *hpasize) +{ + int error; + u_int cmd, is48bit; + u_int8_t protocol; + + is48bit = parm->support.command2 & ATA_SUPPORT_ADDRESS48; + protocol = AP_PROTO_NON_DATA; + + if (is48bit) { + cmd = ATA_READ_NATIVE_MAX_ADDRESS48; + protocol |= AP_EXTEND; + } else { + cmd = ATA_READ_NATIVE_MAX_ADDRESS; + } + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_IN, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, hpasize); +} + +static int +atahpa_set_max(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, + int is48bit, u_int64_t maxsize, int persist) +{ + int error; + u_int cmd; + u_int8_t protocol; + + protocol = AP_PROTO_NON_DATA; + + if (is48bit) { + cmd = ATA_SET_MAX_ADDRESS48; + protocol |= AP_EXTEND; + } else { + cmd = ATA_SET_MAX_ADDRESS; + } + + /* lba's are zero indexed so the max lba is requested max - 1 */ + if (maxsize) + maxsize--; + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/ATA_HPA_FEAT_MAX_ADDR, + /*lba*/maxsize, + /*sector_count*/persist, + /*data_ptr*/NULL, + /*dxfer_len*/0, + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, NULL); +} + +static int +atahpa_password(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, + int is48bit, struct ata_set_max_pwd *pwd) +{ + int error; + u_int cmd; + u_int8_t protocol; + + protocol = AP_PROTO_PIO_OUT; + cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/ATA_HPA_FEAT_SET_PWD, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t*)pwd, + /*dxfer_len*/sizeof(struct ata_set_max_pwd), + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, NULL); +} + +static int +atahpa_lock(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, int is48bit) +{ + int error; + u_int cmd; + u_int8_t protocol; + + protocol = AP_PROTO_NON_DATA; + cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/ATA_HPA_FEAT_LOCK, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, NULL); +} + +static int +atahpa_unlock(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, + int is48bit, struct ata_set_max_pwd *pwd) +{ + int error; + u_int cmd; + u_int8_t protocol; + + protocol = AP_PROTO_PIO_OUT; + cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/ATA_HPA_FEAT_UNLOCK, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t*)pwd, + /*dxfer_len*/sizeof(struct ata_set_max_pwd), + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, NULL); +} + +static int +atahpa_freeze_lock(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, int is48bit) +{ + int error; + u_int cmd; + u_int8_t protocol; + + protocol = AP_PROTO_NON_DATA; + cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/ATA_HPA_FEAT_FREEZE, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, NULL); +} + + +static int ata_do_identify(struct cam_device *device, int retry_count, int timeout, union ccb *ccb, struct ata_params** ident_bufp) { @@ -1633,6 +2045,7 @@ ataidentify(struct cam_device *device, i { union ccb *ccb; struct ata_params *ident_buf; + u_int64_t hpasize; if ((ccb = cam_getccb(device)) == NULL) { warnx("couldn't allocate CCB"); @@ -1644,10 +2057,21 @@ ataidentify(struct cam_device *device, i return (1); } + if (ident_buf->support.command1 & ATA_SUPPORT_PROTECTED) { + if (ata_read_native_max(device, retry_count, timeout, ccb, + ident_buf, &hpasize) != 0) { + cam_freeccb(ccb); + return (1); + } + } else { + hpasize = 0; + } + printf("%s%d: ", device->device_name, device->dev_unit_num); ata_print_ident(ident_buf); camxferrate(device); atacapprint(ident_buf); + atahpa_print(ident_buf, hpasize, 0); free(ident_buf); cam_freeccb(ccb); @@ -1976,6 +2400,245 @@ ata_getpwd(u_int8_t *passwd, int max, ch return (0); } +enum { + ATA_HPA_ACTION_PRINT, + ATA_HPA_ACTION_SET_MAX, + ATA_HPA_ACTION_SET_PWD, + ATA_HPA_ACTION_LOCK, + ATA_HPA_ACTION_UNLOCK, + ATA_HPA_ACTION_FREEZE_LOCK +}; + +static int +atahpa_set_confirm(struct cam_device *device, struct ata_params* ident_buf, + u_int64_t maxsize, int persist) +{ + printf("\nYou are about to configure HPA to limit the user accessible\n" + "sectors to %ju %s on the device:\n%s%d,%s%d: ", maxsize, + persist ? "persistently" : "temporarily", + device->device_name, device->dev_unit_num, + device->given_dev_name, device->given_unit_number); + ata_print_ident(ident_buf); + + for(;;) { + char str[50]; + printf("\nAre you SURE you want to configure HPA? (yes/no) "); + + if (NULL != fgets(str, sizeof(str), stdin)) { + if (0 == strncasecmp(str, "yes", 3)) { + return (1); + } else if (0 == strncasecmp(str, "no", 2)) { + return (0); + } else { + printf("Please answer \"yes\" or " + "\"no\"\n"); + } + } + } + + /* NOTREACHED */ + return (0); +} + +static int +atahpa(struct cam_device *device, int retry_count, int timeout, + int argc, char **argv, char *combinedopt) +{ + union ccb *ccb; + struct ata_params *ident_buf; + struct ccb_getdev cgd; + struct ata_set_max_pwd pwd; + int error, confirm, quiet, c, action, actions, setpwd, persist; + int security, is48bit, pwdsize; + u_int64_t hpasize, maxsize; + + actions = 0; + setpwd = 0; + confirm = 0; + quiet = 0; + maxsize = 0; + persist = 0; + security = 0; + + memset(&pwd, 0, sizeof(pwd)); + + /* default action is to print hpa information */ + action = ATA_HPA_ACTION_PRINT; + pwdsize = sizeof(pwd.password); + + while ((c = getopt(argc, argv, combinedopt)) != -1) { + switch(c){ + case 's': + action = ATA_HPA_ACTION_SET_MAX; + maxsize = strtoumax(optarg, NULL, 0); + actions++; + break; + + case 'p': + if (ata_getpwd(pwd.password, pwdsize, c) != 0) + return (1); + action = ATA_HPA_ACTION_SET_PWD; + security = 1; + actions++; + break; + + case 'l': + action = ATA_HPA_ACTION_LOCK; + security = 1; + actions++; + break; + + case 'U': + if (ata_getpwd(pwd.password, pwdsize, c) != 0) + return (1); + action = ATA_HPA_ACTION_UNLOCK; + security = 1; + actions++; + break; + + case 'f': + action = ATA_HPA_ACTION_FREEZE_LOCK; + security = 1; + actions++; + break; + + case 'P': + persist = 1; + break; + + case 'y': + confirm++; + break; + + case 'q': + quiet++; + break; + } + } + + if (actions > 1) { + warnx("too many hpa actions specified"); + return (1); + } + + if (get_cgd(device, &cgd) != 0) { + warnx("couldn't get CGD"); + return (1); + } + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("couldn't allocate CCB"); + return (1); + } + + error = ata_do_identify(device, retry_count, timeout, ccb, &ident_buf); + if (error != 0) { + cam_freeccb(ccb); + return (1); + } + + if (quiet == 0) { + printf("%s%d: ", device->device_name, device->dev_unit_num); + ata_print_ident(ident_buf); + camxferrate(device); + } + + if (action == ATA_HPA_ACTION_PRINT) { + error = ata_read_native_max(device, retry_count, timeout, ccb, + ident_buf, &hpasize); + if (error == 0) + atahpa_print(ident_buf, hpasize, 1); + + cam_freeccb(ccb); + free(ident_buf); + return (error); + } + + if (!(ident_buf->support.command1 & ATA_SUPPORT_PROTECTED)) { + warnx("HPA is not supported by this device"); + cam_freeccb(ccb); + free(ident_buf); + return (1); + } + + if (security && !(ident_buf->support.command1 & ATA_SUPPORT_MAXSECURITY)) { + warnx("HPA Security is not supported by this device"); + cam_freeccb(ccb); + free(ident_buf); + return (1); + } + + is48bit = ident_buf->support.command2 & ATA_SUPPORT_ADDRESS48; + + /* + * The ATA spec requires: + * 1. Read native max addr is called directly before set max addr + * 2. Read native max addr is NOT called before any other set max call + */ + switch(action) { + case ATA_HPA_ACTION_SET_MAX: + if (confirm == 0 && + atahpa_set_confirm(device, ident_buf, maxsize, + persist) == 0) { + cam_freeccb(ccb); + free(ident_buf); + return (1); + } + + error = ata_read_native_max(device, retry_count, timeout, + ccb, ident_buf, &hpasize); + if (error == 0) { + error = atahpa_set_max(device, retry_count, timeout, + ccb, is48bit, maxsize, persist); + if (error == 0) { + /* redo identify to get new lba values */ + error = ata_do_identify(device, retry_count, + timeout, ccb, + &ident_buf); + atahpa_print(ident_buf, hpasize, 1); + } + } + break; + + case ATA_HPA_ACTION_SET_PWD: + error = atahpa_password(device, retry_count, timeout, + ccb, is48bit, &pwd); + if (error == 0) + printf("HPA password has been set\n"); + break; + + case ATA_HPA_ACTION_LOCK: + error = atahpa_lock(device, retry_count, timeout, + ccb, is48bit); + if (error == 0) + printf("HPA has been locked\n"); + break; + + case ATA_HPA_ACTION_UNLOCK: + error = atahpa_unlock(device, retry_count, timeout, + ccb, is48bit, &pwd); + if (error == 0) + printf("HPA has been unlocked\n"); + break; + + case ATA_HPA_ACTION_FREEZE_LOCK: + error = atahpa_freeze_lock(device, retry_count, timeout, + ccb, is48bit); + if (error == 0) + printf("HPA has been frozen\n"); + break; + + default: + errx(1, "Option currently not supported"); + } + + cam_freeccb(ccb); + free(ident_buf); + + return (error); +} + static int atasecurity(struct cam_device *device, int retry_count, int timeout, int argc, char **argv, char *combinedopt) @@ -5319,6 +5982,8 @@ usage(int verbose) " <-d pwd | -e pwd | -f | -h pwd | -k pwd>\n" " [-l ] [-q] [-s pwd] [-T timeout]\n" " [-U ] [-y]\n" +" camcontrol hpa [dev_id][generic args] [-f] [-l] [-P] [-p pwd]\n" +" [-q] [-s max_sectors] [-U pwd] [-y]\n" #endif /* MINIMALISTIC */ " camcontrol help\n"); if (!verbose) @@ -5436,6 +6101,17 @@ usage(int verbose) "-T timeout overrides the timeout (seconds) used for erase operation\n" "-U specifies which user to set: user or master\n" "-y don't ask any questions\n" +"hpa arguments:\n" +"-f freeze the HPA configuration of the device\n" +"-l lock the HPA configuration of the device\n" +"-P make the HPA max sectors persist\n" +"-p pwd Set the HPA configuration password required for unlock\n" +" calls\n" +"-q be quiet, do not print any status messages\n" +"-s sectors configures the maximum user accessible sectors of the\n" +" device\n" +"-U pwd unlock the HPA configuration of the device\n" +"-y don't ask any questions\n" ); #endif /* MINIMALISTIC */ } @@ -5660,6 +6336,10 @@ main(int argc, char **argv) case CAM_CMD_DEVLIST: error = getdevlist(cam_dev); break; + case CAM_CMD_HPA: + error = atahpa(cam_dev, retry_count, timeout, + argc, argv, combinedopt); + break; #endif /* MINIMALISTIC */ case CAM_CMD_DEVTREE: error = getdevtree(); Modified: stable/8/sys/sys/ata.h ============================================================================== --- stable/8/sys/sys/ata.h Fri Jun 7 13:45:58 2013 (r251495) +++ stable/8/sys/sys/ata.h Fri Jun 7 13:59:41 2013 (r251496) @@ -289,6 +289,23 @@ struct ata_params { #define ATA_DEV_SLAVE 0x10 #define ATA_DEV_LBA 0x40 +/* ATA limits */ +#define ATA_MAX_28BIT_LBA 268435455UL + +/* ATA Status Register */ +#define ATA_STATUS_ERROR 0x01 +#define ATA_STATUS_DEVICE_FAULT 0x20 + +/* ATA Error Register */ +#define ATA_ERROR_ABORT 0x04 +#define ATA_ERROR_ID_NOT_FOUND 0x10 + +/* ATA HPA Features */ +#define ATA_HPA_FEAT_MAX_ADDR 0x00 +#define ATA_HPA_FEAT_SET_PWD 0x01 +#define ATA_HPA_FEAT_LOCK 0x02 +#define ATA_HPA_FEAT_UNLOCK 0x03 +#define ATA_HPA_FEAT_FREEZE 0x04 /* ATA transfer modes */ #define ATA_MODE_MASK 0x0f From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 14:10:19 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3390DACC; Fri, 7 Jun 2013 14:10:19 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1677C1147; Fri, 7 Jun 2013 14:10:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57EAJmY028427; Fri, 7 Jun 2013 14:10:19 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57EAIgt028422; Fri, 7 Jun 2013 14:10:18 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306071410.r57EAIgt028422@svn.freebsd.org> From: Steven Hartland Date: Fri, 7 Jun 2013 14:10:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251497 - in stable/9: sbin/camcontrol sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 14:10:19 -0000 Author: smh Date: Fri Jun 7 14:10:18 2013 New Revision: 251497 URL: http://svnweb.freebsd.org/changeset/base/251497 Log: MFC r249115: Adds security command to camcontrol which provides the ability to secure erase SSD's MFC r249153: (included in r251494) mdoc: remove superfluous paragraph macro. Modified: stable/9/sbin/camcontrol/camcontrol.8 stable/9/sbin/camcontrol/camcontrol.c stable/9/sys/sys/ata.h Directory Properties: stable/9/sbin/camcontrol/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.8 Fri Jun 7 13:59:41 2013 (r251496) +++ stable/9/sbin/camcontrol/camcontrol.8 Fri Jun 7 14:10:18 2013 (r251497) @@ -228,6 +228,21 @@ .Op Fl y .Op Fl s .Nm +.Ic security +.Op device id +.Op generic args +.Op Fl d Ar pwd +.Op Fl e Ar pwd +.Op Fl f +.Op Fl h Ar pwd +.Op Fl k Ar pwd +.Op Fl l Ar high|maximum +.Op Fl q +.Op Fl s Ar pwd +.Op Fl T Ar timeout +.Op Fl U Ar user|master +.Op Fl y +.Nm .Ic help .Sh DESCRIPTION The @@ -1072,6 +1087,123 @@ specifies automatic standby timer value .It Ic sleep Put ATA device into SLEEP state. Note that the only way get device out of this state may be reset. +.It Ic security +Update or report security settings, using an ATA identify command (0xec). +By default, +.Nm +will print out the security support and associated settings of the device. +The +.Ic security +command takes several arguments: +.Bl -tag -width 0n +.It Fl d Ar pwd +.Pp +Disable device security using the given password for the selected user according +to the devices configured security level. +.It Fl e Ar pwd +.Pp +Erase the device using the given password for the selected user. +.Pp +.Em WARNING! WARNING! WARNING! +.Pp +Issuing a secure erase will +.Em ERASE ALL +user data on the device and may take several hours to complete. +.Pp +When this command is used against an SSD drive all its cells will be marked as +empty, restoring it to factory default write performance. For SSD's this action +usually takes just a few seconds. +.It Fl f +.Pp +Freeze the security configuration of the specified device. +.Pp +After command completion any other commands that update the device lock mode +shall be command aborted. Frozen mode is disabled by power-off or hardware reset. +.It Fl h Ar pwd +.Pp +Enhanced erase the device using the given password for the selected user. +.Pp +.Em WARNING! WARNING! WARNING! +.Pp +Issuing an enhanced secure erase will +.Em ERASE ALL +user data on the device and may take several hours to complete. +.Pp +An enhanced erase writes predetermined data patterns to all user data areas, +all previously written user data shall be overwritten, including sectors that +are no longer in use due to reallocation. +.It Fl k Ar pwd +.Pp +Unlock the device using the given password for the selected user according to +the devices configured security level. +.It Fl l Ar high|maximum +.Pp +Specifies which security level to set when issuing a +.Fl s Ar pwd +command. The security level determines device behavior when the master +password is used to unlock the device. When the security level is set to high +the device requires the unlock command and the master password to unlock. +When the security level is set to maximum the device requires a secure erase +with the master password to unlock. +.Pp +This option must be used in conjunction with one of the security action commands. +.Pp +Defaults to +.Em high +.It Fl q +.Pp +Be quiet, do not print any status messages. +This option will not disable the questions, however. +To disable questions, use the +.Fl y +argument, below. +.It Fl s Ar pwd +.Pp +Password the device (enable security) using the given password for the selected +user. This option can be combined with other options such as +.Fl e Em pwd +.Pp +A master password may be set in a addition to the user password. The purpose of +the master password is to allow an administrator to establish a password that +is kept secret from the user, and which may be used to unlock the device if the +user password is lost. +.Pp +.Em Note: +Setting the master password does not enable device security. +.Pp +If the master password is set and the drive supports a Master Revision Code +feature the Master Password Revision Code will be decremented. +.It Fl T Ar timeout +.Pp +Overrides the default timeout, specified in seconds, used for both +.Fl e +and +.Fl h +this is useful if your system has problems processing long timeouts correctly. +.Pp +Usually the timeout is calculated from the information stored on the drive if +present, otherwise it defaults to 2 hours. +.It Fl U Ar user|master +.Pp +Specifies which user to set / use for the running action command, valid values +are user or master and defaults to master if not set. +.Pp +This option must be used in conjunction with one of the security action commands. +.Pp +Defaults to +.Em master +.It Fl y +.Pp +Confirm yes to dangerous options such as +.Fl e +without prompting for confirmation. +.Pp +.El +If the password specified for any action commands doesn't match the configured +password for the specified user the command will fail. +.Pp +The password in all cases is limited to 32 characters, longer passwords will +fail. .It Ic fwdownload Program firmware of the named SCSI device using the image file provided. .Pp @@ -1240,6 +1372,30 @@ camcontrol smpcmd ses0 -v -r 4 "40 0 00 Send the SMP REPORT GENERAL command to ses0, and display the number of PHYs it contains. Display SMP errors if the command fails. +.Bd -literal -offset indent +camcontrol security ada0 +.Ed +.Pp +Report security support and settings for ada0 +.Bd -literal -offset indent +camcontrol security ada0 -u user -s MyPass +.Ed +.Pp +Enable security on device ada0 with the password MyPass +.Bd -literal -offset indent +camcontrol security ada0 -u user -e MyPass +.Ed +.Pp +Secure erase ada0 which has had security enabled with user password MyPass +.Pp +.Em WARNING! WARNING! WARNING! +.Pp +This will +.Em ERASE ALL +data from the device, so backup your data before using! +.Pp +This command can be used used against an SSD drive to restoring it to +factory default write performance. .Sh SEE ALSO .Xr cam 3 , .Xr cam_cdbparse 3 , Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Fri Jun 7 13:59:41 2013 (r251496) +++ stable/9/sbin/camcontrol/camcontrol.c Fri Jun 7 14:10:18 2013 (r251497) @@ -87,7 +87,8 @@ typedef enum { CAM_CMD_SMP_PC = 0x00000019, CAM_CMD_SMP_PHYLIST = 0x0000001a, CAM_CMD_SMP_MANINFO = 0x0000001b, - CAM_CMD_DOWNLOAD_FW = 0x0000001c + CAM_CMD_DOWNLOAD_FW = 0x0000001c, + CAM_CMD_SECURITY = 0x0000001d } cam_cmdmask; typedef enum { @@ -140,6 +141,7 @@ static const char negotiate_opts[] = "ac static const char smprg_opts[] = "l"; static const char smppc_opts[] = "a:A:d:lm:M:o:p:s:S:T:"; static const char smpphylist_opts[] = "lq"; +static char pwd_opt; #endif static struct camcontrol_opts option_table[] = { @@ -183,6 +185,7 @@ static struct camcontrol_opts option_tab {"standby", CAM_CMD_STANDBY, CAM_ARG_NONE, "t:"}, {"sleep", CAM_CMD_SLEEP, CAM_ARG_NONE, ""}, {"fwdownload", CAM_CMD_DOWNLOAD_FW, CAM_ARG_NONE, "f:ys"}, + {"security", CAM_CMD_SECURITY, CAM_ARG_NONE, "d:e:fh:k:l:qs:T:U:y"}, #endif /* MINIMALISTIC */ {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -274,7 +277,10 @@ static int scsireportluns(struct cam_dev static int scsireadcapacity(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); static int atapm(struct cam_device *device, int argc, char **argv, - char *combinedopt, int retry_count, int timeout); + char *combinedopt, int retry_count, int timeout); +static int atasecurity(struct cam_device *device, int retry_count, int timeout, + int argc, char **argv, char *combinedopt); + #endif /* MINIMALISTIC */ #ifndef min #define min(a,b) (((a)<(b))?(a):(b)) @@ -1328,55 +1334,93 @@ atacapprint(struct ata_params *parm) printf("free-fall %s %s\n", parm->support2 & ATA_SUPPORT_FREEFALL ? "yes" : "no", parm->enabled2 & ATA_SUPPORT_FREEFALL ? "yes" : "no"); - printf("data set management (TRIM) %s\n", - parm->support_dsm & ATA_SUPPORT_DSM_TRIM ? "yes" : "no"); + printf("Data Set Management (DSM/TRIM) "); + if (parm->support_dsm & ATA_SUPPORT_DSM_TRIM) { + printf("yes\n"); + printf("DSM - max 512byte blocks "); + if (parm->max_dsm_blocks == 0x00) + printf("yes not specified\n"); + else + printf("yes %d\n", + parm->max_dsm_blocks); + + printf("DSM - deterministic read "); + if (parm->support3 & ATA_SUPPORT_DRAT) { + if (parm->support3 & ATA_SUPPORT_RZAT) + printf("yes zeroed\n"); + else + printf("yes any value\n"); + } else { + printf("no\n"); + } + } else { + printf("no\n"); + } } static int -ataidentify(struct cam_device *device, int retry_count, int timeout) +scsi_cam_pass_16_send(struct cam_device *device, union ccb *ccb, int quiet) { - union ccb *ccb; - struct ata_params *ident_buf; - struct ccb_getdev cgd; - u_int i, error = 0; - int16_t *ptr; + struct ata_pass_16 *ata_pass_16; + struct ata_cmd ata_cmd; - if (get_cgd(device, &cgd) != 0) { - warnx("couldn't get CGD"); - return(1); - } - ccb = cam_getccb(device); + ata_pass_16 = (struct ata_pass_16 *)ccb->csio.cdb_io.cdb_bytes; + ata_cmd.command = ata_pass_16->command; + ata_cmd.control = ata_pass_16->control; + ata_cmd.features = ata_pass_16->features; - if (ccb == NULL) { - warnx("couldn't allocate CCB"); - return(1); + if (arglist & CAM_ARG_VERBOSE) { + warnx("sending ATA %s via pass_16 with timeout of %u msecs", + ata_op_string(&ata_cmd), + ccb->csio.ccb_h.timeout); } - /* cam_getccb cleans up the header, caller has to zero the payload */ - bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_ataio) - sizeof(struct ccb_hdr)); + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; - ptr = (uint16_t *)malloc(sizeof(struct ata_params)); + if (arglist & CAM_ARG_ERR_RECOVER) + ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; - if (ptr == NULL) { - cam_freeccb(ccb); - warnx("can't malloc memory for identify\n"); - return(1); + if (cam_send_ccb(device, ccb) < 0) { + if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { + warn("error sending ATA %s via pass_16", + ata_op_string(&ata_cmd)); + } + + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + + return (1); } - bzero(ptr, sizeof(struct ata_params)); - cam_fill_ataio(&ccb->ataio, - retry_count, - NULL, - /*flags*/CAM_DIR_IN, - MSG_SIMPLE_Q_TAG, - /*data_ptr*/(u_int8_t *)ptr, - /*dxfer_len*/sizeof(struct ata_params), - timeout ? timeout : 30 * 1000); - if (cgd.protocol == PROTO_ATA) - ata_28bit_cmd(&ccb->ataio, ATA_ATA_IDENTIFY, 0, 0, 0); - else - ata_28bit_cmd(&ccb->ataio, ATA_ATAPI_IDENTIFY, 0, 0, 0); + if (!(ata_pass_16->flags & AP_FLAG_CHK_COND) && + (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { + warnx("ATA %s via pass_16 failed", + ata_op_string(&ata_cmd)); + } + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + + return (1); + } + + return (0); +} + + +static int +ata_cam_send(struct cam_device *device, union ccb *ccb, int quiet) +{ + if (arglist & CAM_ARG_VERBOSE) { + warnx("sending ATA %s with timeout of %u msecs", + ata_op_string(&(ccb->ataio.cmd)), + ccb->ataio.ccb_h.timeout); + } /* Disable freezing the device queue */ ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; @@ -1385,47 +1429,247 @@ ataidentify(struct cam_device *device, i ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending ATA identify"); + if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { + warn("error sending ATA %s", + ata_op_string(&(ccb->ataio.cmd))); + } if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } - free(ptr); - cam_freeccb(ccb); - return(1); + return (1); } if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - error = 1; + if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { + warnx("ATA %s failed: %d", + ata_op_string(&(ccb->ataio.cmd)), quiet); + } if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } + + return (1); } - cam_freeccb(ccb); + return (0); +} + +static int +ata_do_pass_16(struct cam_device *device, union ccb *ccb, int retries, + u_int32_t flags, u_int8_t protocol, u_int8_t ata_flags, + u_int8_t tag_action, u_int8_t command, u_int8_t features, + u_int64_t lba, u_int8_t sector_count, u_int8_t *data_ptr, + u_int16_t dxfer_len, int timeout, int quiet) +{ + if (data_ptr != NULL) { + ata_flags |= AP_FLAG_BYT_BLOK_BYTES | + AP_FLAG_TLEN_SECT_CNT; + if (flags & CAM_DIR_OUT) + ata_flags |= AP_FLAG_TDIR_TO_DEV; + else + ata_flags |= AP_FLAG_TDIR_FROM_DEV; + } else { + ata_flags |= AP_FLAG_TLEN_NO_DATA; + } + + bzero(&(&ccb->ccb_h)[1], + sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + + scsi_ata_pass_16(&ccb->csio, + retries, + NULL, + flags, + tag_action, + protocol, + ata_flags, + features, + sector_count, + lba, + command, + /*control*/0, + data_ptr, + dxfer_len, + /*sense_len*/SSD_FULL_SIZE, + timeout); + + return scsi_cam_pass_16_send(device, ccb, quiet); +} + +static int +ata_try_pass_16(struct cam_device *device) +{ + struct ccb_pathinq cpi; + + if (get_cpi(device, &cpi) != 0) { + warnx("couldn't get CPI"); + return (-1); + } + + if (cpi.protocol == PROTO_SCSI) { + /* possibly compatible with pass_16 */ + return (1); + } + + /* likely not compatible with pass_16 */ + return (0); +} + +static int +ata_do_28bit_cmd(struct cam_device *device, union ccb *ccb, int retries, + u_int32_t flags, u_int8_t protocol, u_int8_t tag_action, + u_int8_t command, u_int8_t features, u_int32_t lba, + u_int8_t sector_count, u_int8_t *data_ptr, u_int16_t dxfer_len, + int timeout, int quiet) +{ + + + switch (ata_try_pass_16(device)) { + case -1: + return (1); + case 1: + /* Try using SCSI Passthrough */ + return ata_do_pass_16(device, ccb, retries, flags, protocol, + 0, tag_action, command, features, lba, + sector_count, data_ptr, dxfer_len, + timeout, quiet); + } + + bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_ataio) - + sizeof(struct ccb_hdr)); + cam_fill_ataio(&ccb->ataio, + retries, + NULL, + flags, + tag_action, + data_ptr, + dxfer_len, + timeout); + + ata_28bit_cmd(&ccb->ataio, command, features, lba, sector_count); + return ata_cam_send(device, ccb, quiet); +} + +static void +dump_data(uint16_t *ptr, uint32_t len) +{ + u_int i; + + for (i = 0; i < len / 2; i++) { + if ((i % 8) == 0) + printf(" %3d: ", i); + printf("%04hx ", ptr[i]); + if ((i % 8) == 7) + printf("\n"); + } + if ((i % 8) != 7) + printf("\n"); +} + +static int +ata_do_identify(struct cam_device *device, int retry_count, int timeout, + union ccb *ccb, struct ata_params** ident_bufp) +{ + struct ata_params *ident_buf; + struct ccb_pathinq cpi; + struct ccb_getdev cgd; + u_int i, error; + int16_t *ptr; + u_int8_t command, retry_command; + + if (get_cpi(device, &cpi) != 0) { + warnx("couldn't get CPI"); + return (-1); + } + + /* Neither PROTO_ATAPI or PROTO_SATAPM are used in cpi.protocol */ + if (cpi.protocol == PROTO_ATA) { + if (get_cgd(device, &cgd) != 0) { + warnx("couldn't get CGD"); + return (-1); + } + + command = (cgd.protocol == PROTO_ATA) ? + ATA_ATA_IDENTIFY : ATA_ATAPI_IDENTIFY; + retry_command = 0; + } else { + /* We don't know which for sure so try both */ + command = ATA_ATA_IDENTIFY; + retry_command = ATA_ATAPI_IDENTIFY; + } + + ptr = (uint16_t *)calloc(1, sizeof(struct ata_params)); + if (ptr == NULL) { + warnx("can't calloc memory for identify\n"); + return (1); + } + + error = ata_do_28bit_cmd(device, + ccb, + /*retries*/retry_count, + /*flags*/CAM_DIR_IN, + /*protocol*/AP_PROTO_PIO_IN, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/command, + /*features*/0, + /*lba*/0, + /*sector_count*/(u_int8_t)sizeof(struct ata_params), + /*data_ptr*/(u_int8_t *)ptr, + /*dxfer_len*/sizeof(struct ata_params), + /*timeout*/timeout ? timeout : 30 * 1000, + /*quiet*/1); if (error != 0) { - free(ptr); - return(error); + if (retry_command == 0) { + free(ptr); + return (1); + } + error = ata_do_28bit_cmd(device, + ccb, + /*retries*/retry_count, + /*flags*/CAM_DIR_IN, + /*protocol*/AP_PROTO_PIO_IN, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/retry_command, + /*features*/0, + /*lba*/0, + /*sector_count*/(u_int8_t) + sizeof(struct ata_params), + /*data_ptr*/(u_int8_t *)ptr, + /*dxfer_len*/sizeof(struct ata_params), + /*timeout*/timeout ? timeout : 30 * 1000, + /*quiet*/0); + + if (error != 0) { + free(ptr); + return (1); + } } - for (i = 0; i < sizeof(struct ata_params) / 2; i++) + error = 1; + for (i = 0; i < sizeof(struct ata_params) / 2; i++) { ptr[i] = le16toh(ptr[i]); + if (ptr[i] != 0) + error = 0; + } + if (arglist & CAM_ARG_VERBOSE) { fprintf(stdout, "%s%d: Raw identify data:\n", device->device_name, device->dev_unit_num); - for (i = 0; i < sizeof(struct ata_params) / 2; i++) { - if ((i % 8) == 0) - fprintf(stdout, " %3d: ", i); - fprintf(stdout, "%04x ", (uint16_t)ptr[i]); - if ((i % 8) == 7) - fprintf(stdout, "\n"); - } + dump_data(ptr, sizeof(struct ata_params)); } + + /* check for invalid (all zero) response */ + if (error != 0) { + warnx("Invalid identify response detected"); + free(ptr); + return (error); + } + ident_buf = (struct ata_params *)ptr; if (strncmp(ident_buf->model, "FX", 2) && strncmp(ident_buf->model, "NEC", 3) && @@ -1446,15 +1690,636 @@ ataidentify(struct cam_device *device, i ata_bpack(ident_buf->media_serial, ident_buf->media_serial, sizeof(ident_buf->media_serial)); - fprintf(stdout, "%s%d: ", device->device_name, - device->dev_unit_num); + *ident_bufp = ident_buf; + + return (0); +} + + +static int +ataidentify(struct cam_device *device, int retry_count, int timeout) +{ + union ccb *ccb; + struct ata_params *ident_buf; + + if ((ccb = cam_getccb(device)) == NULL) { + warnx("couldn't allocate CCB"); + return (1); + } + + if (ata_do_identify(device, retry_count, timeout, ccb, &ident_buf) != 0) { + cam_freeccb(ccb); + return (1); + } + + printf("%s%d: ", device->device_name, device->dev_unit_num); ata_print_ident(ident_buf); camxferrate(device); atacapprint(ident_buf); free(ident_buf); + cam_freeccb(ccb); - return(0); + return (0); +} +#endif /* MINIMALISTIC */ + + +#ifndef MINIMALISTIC +enum { + ATA_SECURITY_ACTION_PRINT, + ATA_SECURITY_ACTION_FREEZE, + ATA_SECURITY_ACTION_UNLOCK, + ATA_SECURITY_ACTION_DISABLE, + ATA_SECURITY_ACTION_ERASE, + ATA_SECURITY_ACTION_ERASE_ENHANCED, + ATA_SECURITY_ACTION_SET_PASSWORD +} atasecurity_action; + +static void +atasecurity_print_time(u_int16_t tw) +{ + + if (tw == 0) + printf("unspecified"); + else if (tw >= 255) + printf("> 508 min"); + else + printf("%i min", 2 * tw); +} + +static u_int32_t +atasecurity_erase_timeout_msecs(u_int16_t timeout) +{ + + if (timeout == 0) + return 2 * 3600 * 1000; /* default: two hours */ + else if (timeout > 255) + return (508 + 60) * 60 * 1000; /* spec says > 508 minutes */ + + return ((2 * timeout) + 5) * 60 * 1000; /* add a 5min margin */ +} + + +static void +atasecurity_notify(u_int8_t command, struct ata_security_password *pwd) +{ + struct ata_cmd cmd; + + bzero(&cmd, sizeof(cmd)); + cmd.command = command; + printf("Issuing %s", ata_op_string(&cmd)); + + if (pwd != NULL) { + char pass[sizeof(pwd->password)+1]; + + /* pwd->password may not be null terminated */ + pass[sizeof(pwd->password)] = '\0'; + strncpy(pass, pwd->password, sizeof(pwd->password)); + printf(" password='%s', user='%s'", + pass, + (pwd->ctrl & ATA_SECURITY_PASSWORD_MASTER) ? + "master" : "user"); + + if (command == ATA_SECURITY_SET_PASSWORD) { + printf(", mode='%s'", + (pwd->ctrl & ATA_SECURITY_LEVEL_MAXIMUM) ? + "maximum" : "high"); + } + } + + printf("\n"); +} + +static int +atasecurity_freeze(struct cam_device *device, union ccb *ccb, + int retry_count, u_int32_t timeout, int quiet) +{ + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_FREEZE_LOCK, NULL); + + return ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_NONE, + /*protocol*/AP_PROTO_NON_DATA, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_FREEZE_LOCK, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + /*timeout*/timeout, + /*quiet*/0); +} + +static int +atasecurity_unlock(struct cam_device *device, union ccb *ccb, + int retry_count, u_int32_t timeout, + struct ata_security_password *pwd, int quiet) +{ + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_UNLOCK, pwd); + + return ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_UNLOCK, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*quiet*/0); +} + +static int +atasecurity_disable(struct cam_device *device, union ccb *ccb, + int retry_count, u_int32_t timeout, + struct ata_security_password *pwd, int quiet) +{ + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_DISABLE_PASSWORD, pwd); + return ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_DISABLE_PASSWORD, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*quiet*/0); +} + + +static int +atasecurity_erase_confirm(struct cam_device *device, + struct ata_params* ident_buf) +{ + + printf("\nYou are about to ERASE ALL DATA from the following" + " device:\n%s%d,%s%d: ", device->device_name, + device->dev_unit_num, device->given_dev_name, + device->given_unit_number); + ata_print_ident(ident_buf); + + for(;;) { + char str[50]; + printf("\nAre you SURE you want to ERASE ALL DATA? (yes/no) "); + + if (fgets(str, sizeof(str), stdin) != NULL) { + if (strncasecmp(str, "yes", 3) == 0) { + return (1); + } else if (strncasecmp(str, "no", 2) == 0) { + return (0); + } else { + printf("Please answer \"yes\" or " + "\"no\"\n"); + } + } + } + + /* NOTREACHED */ + return (0); +} + +static int +atasecurity_erase(struct cam_device *device, union ccb *ccb, + int retry_count, u_int32_t timeout, + u_int32_t erase_timeout, + struct ata_security_password *pwd, int quiet) +{ + int error; + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_ERASE_PREPARE, NULL); + + error = ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_NONE, + /*protocol*/AP_PROTO_NON_DATA, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_ERASE_PREPARE, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + /*timeout*/timeout, + /*quiet*/0); + + if (error != 0) + return error; + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_ERASE_UNIT, pwd); + + error = ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_ERASE_UNIT, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/erase_timeout, + /*quiet*/0); + + if (error == 0 && quiet == 0) + printf("\nErase Complete\n"); + + return error; +} + +static int +atasecurity_set_password(struct cam_device *device, union ccb *ccb, + int retry_count, u_int32_t timeout, + struct ata_security_password *pwd, int quiet) +{ + + if (quiet == 0) + atasecurity_notify(ATA_SECURITY_SET_PASSWORD, pwd); + + return ata_do_28bit_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_SET_PASSWORD, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*quiet*/0); +} + +static void +atasecurity_print(struct ata_params *parm) +{ + + printf("\nSecurity Option Value\n"); + if (arglist & CAM_ARG_VERBOSE) { + printf("status %04x\n", + parm->security_status); + } + printf("supported %s\n", + parm->security_status & ATA_SECURITY_SUPPORTED ? "yes" : "no"); + if (!(parm->security_status & ATA_SECURITY_SUPPORTED)) + return; + printf("enabled %s\n", + parm->security_status & ATA_SECURITY_ENABLED ? "yes" : "no"); + printf("drive locked %s\n", + parm->security_status & ATA_SECURITY_LOCKED ? "yes" : "no"); + printf("security config frozen %s\n", + parm->security_status & ATA_SECURITY_FROZEN ? "yes" : "no"); + printf("count expired %s\n", + parm->security_status & ATA_SECURITY_COUNT_EXP ? "yes" : "no"); + printf("security level %s\n", + parm->security_status & ATA_SECURITY_LEVEL ? "maximum" : "high"); + printf("enhanced erase supported %s\n", + parm->security_status & ATA_SECURITY_ENH_SUPP ? "yes" : "no"); + printf("erase time "); + atasecurity_print_time(parm->erase_time); + printf("\n"); + printf("enhanced erase time "); + atasecurity_print_time(parm->enhanced_erase_time); + printf("\n"); + printf("master password rev %04x%s\n", + parm->master_passwd_revision, + parm->master_passwd_revision == 0x0000 || + parm->master_passwd_revision == 0xFFFF ? " (unsupported)" : ""); +} + +/* + * Validates and copies the password in optarg to the passed buffer. + * If the password in optarg is the same length as the buffer then + * the data will still be copied but no null termination will occur. + */ +static int +ata_getpwd(u_int8_t *passwd, int max, char opt) +{ + int len; + + len = strlen(optarg); + if (len > max) { + warnx("-%c password is too long", opt); + return (1); + } else if (len == 0) { + warnx("-%c password is missing", opt); + return (1); + } else if (optarg[0] == '-'){ + warnx("-%c password starts with '-' (generic arg?)", opt); + return (1); + } else if (strlen(passwd) != 0 && strcmp(passwd, optarg) != 0) { + warnx("-%c password conflicts with existing password from -%c", + opt, pwd_opt); + return (1); + } + + /* Callers pass in a buffer which does NOT need to be terminated */ + strncpy(passwd, optarg, max); + pwd_opt = opt; + + return (0); +} + +static int +atasecurity(struct cam_device *device, int retry_count, int timeout, + int argc, char **argv, char *combinedopt) +{ + union ccb *ccb; + struct ata_params *ident_buf; + int error, confirm, quiet, c, action, actions, setpwd; + int security_enabled, erase_timeout, pwdsize; + struct ata_security_password pwd; + + actions = 0; + setpwd = 0; + erase_timeout = 0; + confirm = 0; + quiet = 0; + + memset(&pwd, 0, sizeof(pwd)); + + /* default action is to print security information */ + action = ATA_SECURITY_ACTION_PRINT; + + /* user is master by default as its safer that way */ + pwd.ctrl |= ATA_SECURITY_PASSWORD_MASTER; + pwdsize = sizeof(pwd.password); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 14:23:12 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2031AF26; Fri, 7 Jun 2013 14:23:12 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 028E211E9; Fri, 7 Jun 2013 14:23:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57ENBKT032513; Fri, 7 Jun 2013 14:23:12 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57ENB0h032509; Fri, 7 Jun 2013 14:23:11 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306071423.r57ENB0h032509@svn.freebsd.org> From: Steven Hartland Date: Fri, 7 Jun 2013 14:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251498 - in stable/9: sbin/camcontrol sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 14:23:12 -0000 Author: smh Date: Fri Jun 7 14:23:11 2013 New Revision: 251498 URL: http://svnweb.freebsd.org/changeset/base/251498 Log: MFC r249895: Add Host Protected Area (HPA) support to camcontrol MFC r249904: mdoc: remove superfluous paragraph macro. Modified: stable/9/sbin/camcontrol/camcontrol.8 stable/9/sbin/camcontrol/camcontrol.c stable/9/sys/sys/ata.h Directory Properties: stable/9/sbin/camcontrol/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.8 Fri Jun 7 14:10:18 2013 (r251497) +++ stable/9/sbin/camcontrol/camcontrol.8 Fri Jun 7 14:23:11 2013 (r251498) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 4, 2012 +.Dd April 24, 2013 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -243,6 +243,18 @@ .Op Fl U Ar user|master .Op Fl y .Nm +.Ic hpa +.Op device id +.Op generic args +.Op Fl f +.Op Fl l +.Op Fl P +.Op Fl p Ar pwd +.Op Fl q +.Op Fl s Ar max_sectors +.Op Fl U Ar pwd +.Op Fl y +.Nm .Ic help .Sh DESCRIPTION The @@ -1204,6 +1216,73 @@ password for the specified user the comm .Pp The password in all cases is limited to 32 characters, longer passwords will fail. +.It Ic hpa +Update or report Host Protected Area details. +By default +.Nm +will print out the HPA support and associated settings of the device. +The +.Ic hpa +command takes several optional arguments: +.Bl -tag -width 0n +.It Fl f +.Pp +Freeze the HPA configuration of the specified device. +.Pp +After command completion any other commands that update the HPA configuration +shall be command aborted. +Frozen mode is disabled by power-off or hardware reset. +.It Fl l +.Pp +Lock the HPA configuration of the device until a successful call to unlock or +the next power-on reset occurs. +.It Fl P +.Pp +Make the HPA max sectors persist across power-on reset or a hardware reset. +This must be used in combination with +.Fl s Ar max_sectors +. +.It Fl p Ar pwd +.Pp +Set the HPA configuration password required for unlock calls. +.It Fl q +.Pp +Be quiet, do not print any status messages. +This option will not disable the questions. +To disable questions, use the +.Fl y +argument, below. +.It Fl s Ar max_sectors +.Pp +Configures the maximum user accessible sectors of the device. +This will change the number of sectors the device reports. +.Pp +.Em WARNING! WARNING! WARNING! +.Pp +Changing the max sectors of a device using this option will make the data on +the device beyond the specified value inaccessible. +.Pp +Only one successful +.Fl s Ar max_sectors +call can be made without a power-on reset or a hardware reset of the device. +.It Fl U Ar pwd +.Pp +Unlock the HPA configuration of the specified device using the given password. +If the password specified doesn't match the password configured via +.Fl p Ar pwd +the command will fail. +.Pp +After 5 failed unlock calls, due to password miss-match, the device will refuse +additional unlock calls until after a power-on reset. +.It Fl y +.Pp +Confirm yes to dangerous options such as +.Fl e +without prompting for confirmation +.Pp +.El +The password for all HPA commands is limited to 32 characters, longer passwords +will fail. .It Ic fwdownload Program firmware of the named SCSI device using the image file provided. .Pp @@ -1396,6 +1475,28 @@ data from the device, so backup your dat .Pp This command can be used used against an SSD drive to restoring it to factory default write performance. +.Bd -literal -offset indent +camcontrol hpa ada0 +.Ed +.Pp +Report HPA support and settings for ada0 (also reported via +identify). +.Bd -literal -offset indent +camcontrol hpa ada0 -s 10240 +.Ed +.Pp +Enables HPA on ada0 setting the maximum reported sectors to 10240. +.Pp +.Em WARNING! WARNING! WARNING! +.Pp +This will +.Em PREVENT ACCESS +to all data on the device beyond this limit until HPA is disabled by setting +HPA to native max sectors of the device, which can only be done after a +power-on or hardware reset! +.Pp +.Em DO NOT +use this on a device which has an active filesystem! .Sh SEE ALSO .Xr cam 3 , .Xr cam_cdbparse 3 , Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Fri Jun 7 14:10:18 2013 (r251497) +++ stable/9/sbin/camcontrol/camcontrol.c Fri Jun 7 14:23:11 2013 (r251498) @@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifndef MINIMALISTIC +#include +#include +#endif #include #include @@ -88,7 +92,8 @@ typedef enum { CAM_CMD_SMP_PHYLIST = 0x0000001a, CAM_CMD_SMP_MANINFO = 0x0000001b, CAM_CMD_DOWNLOAD_FW = 0x0000001c, - CAM_CMD_SECURITY = 0x0000001d + CAM_CMD_SECURITY = 0x0000001d, + CAM_CMD_HPA = 0x0000001e } cam_cmdmask; typedef enum { @@ -135,6 +140,29 @@ struct camcontrol_opts { }; #ifndef MINIMALISTIC +struct ata_res_pass16 { + u_int16_t reserved[5]; + u_int8_t flags; + u_int8_t error; + u_int8_t sector_count_exp; + u_int8_t sector_count; + u_int8_t lba_low_exp; + u_int8_t lba_low; + u_int8_t lba_mid_exp; + u_int8_t lba_mid; + u_int8_t lba_high_exp; + u_int8_t lba_high; + u_int8_t device; + u_int8_t status; +}; + +struct ata_set_max_pwd +{ + u_int16_t reserved1; + u_int8_t password[32]; + u_int16_t reserved2[239]; +}; + static const char scsicmd_opts[] = "a:c:dfi:o:r"; static const char readdefect_opts[] = "f:GP"; static const char negotiate_opts[] = "acD:M:O:qR:T:UW:"; @@ -186,6 +214,7 @@ static struct camcontrol_opts option_tab {"sleep", CAM_CMD_SLEEP, CAM_ARG_NONE, ""}, {"fwdownload", CAM_CMD_DOWNLOAD_FW, CAM_ARG_NONE, "f:ys"}, {"security", CAM_CMD_SECURITY, CAM_ARG_NONE, "d:e:fh:k:l:qs:T:U:y"}, + {"hpa", CAM_CMD_HPA, CAM_ARG_NONE, "Pflp:qs:U:y"}, #endif /* MINIMALISTIC */ {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -280,6 +309,8 @@ static int atapm(struct cam_device *devi char *combinedopt, int retry_count, int timeout); static int atasecurity(struct cam_device *device, int retry_count, int timeout, int argc, char **argv, char *combinedopt); +static int atahpa(struct cam_device *device, int retry_count, int timeout, + int argc, char **argv, char *combinedopt); #endif /* MINIMALISTIC */ #ifndef min @@ -1128,6 +1159,38 @@ xferrate_bailout: } static void +atahpa_print(struct ata_params *parm, u_int64_t hpasize, int header) +{ + u_int32_t lbasize = (u_int32_t)parm->lba_size_1 | + ((u_int32_t)parm->lba_size_2 << 16); + + u_int64_t lbasize48 = ((u_int64_t)parm->lba_size48_1) | + ((u_int64_t)parm->lba_size48_2 << 16) | + ((u_int64_t)parm->lba_size48_3 << 32) | + ((u_int64_t)parm->lba_size48_4 << 48); + + if (header) { + printf("\nFeature " + "Support Enabled Value\n"); + } + + printf("Host Protected Area (HPA) "); + if (parm->support.command1 & ATA_SUPPORT_PROTECTED) { + u_int64_t lba = lbasize48 ? lbasize48 : lbasize; + printf("yes %s %ju/%ju\n", (hpasize > lba) ? "yes" : "no ", + lba, hpasize); + + printf("HPA - Security "); + if (parm->support.command1 & ATA_SUPPORT_MAXSECURITY) + printf("yes\n"); + else + printf("no\n"); + } else { + printf("no\n"); + } +} + +static void atacapprint(struct ata_params *parm) { u_int32_t lbasize = (u_int32_t)parm->lba_size_1 | @@ -1554,6 +1617,83 @@ ata_do_28bit_cmd(struct cam_device *devi return ata_cam_send(device, ccb, quiet); } +static int +ata_do_cmd(struct cam_device *device, union ccb *ccb, int retries, + u_int32_t flags, u_int8_t protocol, u_int8_t ata_flags, + u_int8_t tag_action, u_int8_t command, u_int8_t features, + u_int64_t lba, u_int8_t sector_count, u_int8_t *data_ptr, + u_int16_t dxfer_len, int timeout, int force48bit) +{ + int retval; + + retval = ata_try_pass_16(device); + if (retval == -1) + return (1); + + if (retval == 1) { + int error; + + /* Try using SCSI Passthrough */ + error = ata_do_pass_16(device, ccb, retries, flags, protocol, + ata_flags, tag_action, command, features, + lba, sector_count, data_ptr, dxfer_len, + timeout, 0); + + if (ata_flags & AP_FLAG_CHK_COND) { + /* Decode ata_res from sense data */ + struct ata_res_pass16 *res_pass16; + struct ata_res *res; + u_int i; + u_int16_t *ptr; + + /* sense_data is 4 byte aligned */ + ptr = (uint16_t*)(uintptr_t)&ccb->csio.sense_data; + for (i = 0; i < sizeof(*res_pass16) / 2; i++) + ptr[i] = le16toh(ptr[i]); + + /* sense_data is 4 byte aligned */ + res_pass16 = (struct ata_res_pass16 *)(uintptr_t) + &ccb->csio.sense_data; + res = &ccb->ataio.res; + res->flags = res_pass16->flags; + res->status = res_pass16->status; + res->error = res_pass16->error; + res->lba_low = res_pass16->lba_low; + res->lba_mid = res_pass16->lba_mid; + res->lba_high = res_pass16->lba_high; + res->device = res_pass16->device; + res->lba_low_exp = res_pass16->lba_low_exp; + res->lba_mid_exp = res_pass16->lba_mid_exp; + res->lba_high_exp = res_pass16->lba_high_exp; + res->sector_count = res_pass16->sector_count; + res->sector_count_exp = res_pass16->sector_count_exp; + } + + return (error); + } + + bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_ataio) - + sizeof(struct ccb_hdr)); + cam_fill_ataio(&ccb->ataio, + retries, + NULL, + flags, + tag_action, + data_ptr, + dxfer_len, + timeout); + + if (force48bit || lba > ATA_MAX_28BIT_LBA) + ata_48bit_cmd(&ccb->ataio, command, features, lba, sector_count); + else + ata_28bit_cmd(&ccb->ataio, command, features, lba, sector_count); + + if (ata_flags & AP_FLAG_CHK_COND) + ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT; + + return ata_cam_send(device, ccb, 0); +} + static void dump_data(uint16_t *ptr, uint32_t len) { @@ -1571,6 +1711,278 @@ dump_data(uint16_t *ptr, uint32_t len) } static int +atahpa_proc_resp(struct cam_device *device, union ccb *ccb, + int is48bit, u_int64_t *hpasize) +{ + struct ata_res *res; + + res = &ccb->ataio.res; + if (res->status & ATA_STATUS_ERROR) { + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + printf("error = 0x%02x, sector_count = 0x%04x, " + "device = 0x%02x, status = 0x%02x\n", + res->error, res->sector_count, + res->device, res->status); + } + + if (res->error & ATA_ERROR_ID_NOT_FOUND) { + warnx("Max address has already been set since " + "last power-on or hardware reset"); + } + + return (1); + } + + if (arglist & CAM_ARG_VERBOSE) { + fprintf(stdout, "%s%d: Raw native max data:\n", + device->device_name, device->dev_unit_num); + /* res is 4 byte aligned */ + dump_data((uint16_t*)(uintptr_t)res, sizeof(struct ata_res)); + + printf("error = 0x%02x, sector_count = 0x%04x, device = 0x%02x, " + "status = 0x%02x\n", res->error, res->sector_count, + res->device, res->status); + } + + if (hpasize != NULL) { + if (is48bit) { + *hpasize = (((u_int64_t)((res->lba_high_exp << 16) | + (res->lba_mid_exp << 8) | res->lba_low_exp) << 24) | + ((res->lba_high << 16) | (res->lba_mid << 8) | + res->lba_low)) + 1; + } else { + *hpasize = (((res->device & 0x0f) << 24) | + (res->lba_high << 16) | (res->lba_mid << 8) | + res->lba_low) + 1; + } + } + + return (0); +} + +static int +ata_read_native_max(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, + struct ata_params *parm, u_int64_t *hpasize) +{ + int error; + u_int cmd, is48bit; + u_int8_t protocol; + + is48bit = parm->support.command2 & ATA_SUPPORT_ADDRESS48; + protocol = AP_PROTO_NON_DATA; + + if (is48bit) { + cmd = ATA_READ_NATIVE_MAX_ADDRESS48; + protocol |= AP_EXTEND; + } else { + cmd = ATA_READ_NATIVE_MAX_ADDRESS; + } + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_IN, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, hpasize); +} + +static int +atahpa_set_max(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, + int is48bit, u_int64_t maxsize, int persist) +{ + int error; + u_int cmd; + u_int8_t protocol; + + protocol = AP_PROTO_NON_DATA; + + if (is48bit) { + cmd = ATA_SET_MAX_ADDRESS48; + protocol |= AP_EXTEND; + } else { + cmd = ATA_SET_MAX_ADDRESS; + } + + /* lba's are zero indexed so the max lba is requested max - 1 */ + if (maxsize) + maxsize--; + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/ATA_HPA_FEAT_MAX_ADDR, + /*lba*/maxsize, + /*sector_count*/persist, + /*data_ptr*/NULL, + /*dxfer_len*/0, + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, NULL); +} + +static int +atahpa_password(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, + int is48bit, struct ata_set_max_pwd *pwd) +{ + int error; + u_int cmd; + u_int8_t protocol; + + protocol = AP_PROTO_PIO_OUT; + cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/ATA_HPA_FEAT_SET_PWD, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t*)pwd, + /*dxfer_len*/sizeof(struct ata_set_max_pwd), + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, NULL); +} + +static int +atahpa_lock(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, int is48bit) +{ + int error; + u_int cmd; + u_int8_t protocol; + + protocol = AP_PROTO_NON_DATA; + cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/ATA_HPA_FEAT_LOCK, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, NULL); +} + +static int +atahpa_unlock(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, + int is48bit, struct ata_set_max_pwd *pwd) +{ + int error; + u_int cmd; + u_int8_t protocol; + + protocol = AP_PROTO_PIO_OUT; + cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/ATA_HPA_FEAT_UNLOCK, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/(u_int8_t*)pwd, + /*dxfer_len*/sizeof(struct ata_set_max_pwd), + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, NULL); +} + +static int +atahpa_freeze_lock(struct cam_device *device, int retry_count, + u_int32_t timeout, union ccb *ccb, int is48bit) +{ + int error; + u_int cmd; + u_int8_t protocol; + + protocol = AP_PROTO_NON_DATA; + cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; + + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/protocol, + /*ata_flags*/AP_FLAG_CHK_COND, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/cmd, + /*features*/ATA_HPA_FEAT_FREEZE, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + timeout ? timeout : 1000, + is48bit); + + if (error) + return (error); + + return atahpa_proc_resp(device, ccb, is48bit, NULL); +} + + +static int ata_do_identify(struct cam_device *device, int retry_count, int timeout, union ccb *ccb, struct ata_params** ident_bufp) { @@ -1701,6 +2113,7 @@ ataidentify(struct cam_device *device, i { union ccb *ccb; struct ata_params *ident_buf; + u_int64_t hpasize; if ((ccb = cam_getccb(device)) == NULL) { warnx("couldn't allocate CCB"); @@ -1712,10 +2125,21 @@ ataidentify(struct cam_device *device, i return (1); } + if (ident_buf->support.command1 & ATA_SUPPORT_PROTECTED) { + if (ata_read_native_max(device, retry_count, timeout, ccb, + ident_buf, &hpasize) != 0) { + cam_freeccb(ccb); + return (1); + } + } else { + hpasize = 0; + } + printf("%s%d: ", device->device_name, device->dev_unit_num); ata_print_ident(ident_buf); camxferrate(device); atacapprint(ident_buf); + atahpa_print(ident_buf, hpasize, 0); free(ident_buf); cam_freeccb(ccb); @@ -2044,6 +2468,245 @@ ata_getpwd(u_int8_t *passwd, int max, ch return (0); } +enum { + ATA_HPA_ACTION_PRINT, + ATA_HPA_ACTION_SET_MAX, + ATA_HPA_ACTION_SET_PWD, + ATA_HPA_ACTION_LOCK, + ATA_HPA_ACTION_UNLOCK, + ATA_HPA_ACTION_FREEZE_LOCK +}; + +static int +atahpa_set_confirm(struct cam_device *device, struct ata_params* ident_buf, + u_int64_t maxsize, int persist) +{ + printf("\nYou are about to configure HPA to limit the user accessible\n" + "sectors to %ju %s on the device:\n%s%d,%s%d: ", maxsize, + persist ? "persistently" : "temporarily", + device->device_name, device->dev_unit_num, + device->given_dev_name, device->given_unit_number); + ata_print_ident(ident_buf); + + for(;;) { + char str[50]; + printf("\nAre you SURE you want to configure HPA? (yes/no) "); + + if (NULL != fgets(str, sizeof(str), stdin)) { + if (0 == strncasecmp(str, "yes", 3)) { + return (1); + } else if (0 == strncasecmp(str, "no", 2)) { + return (0); + } else { + printf("Please answer \"yes\" or " + "\"no\"\n"); + } + } + } + + /* NOTREACHED */ + return (0); +} + +static int +atahpa(struct cam_device *device, int retry_count, int timeout, + int argc, char **argv, char *combinedopt) +{ + union ccb *ccb; + struct ata_params *ident_buf; + struct ccb_getdev cgd; + struct ata_set_max_pwd pwd; + int error, confirm, quiet, c, action, actions, setpwd, persist; + int security, is48bit, pwdsize; + u_int64_t hpasize, maxsize; + + actions = 0; + setpwd = 0; + confirm = 0; + quiet = 0; + maxsize = 0; + persist = 0; + security = 0; + + memset(&pwd, 0, sizeof(pwd)); + + /* default action is to print hpa information */ + action = ATA_HPA_ACTION_PRINT; + pwdsize = sizeof(pwd.password); + + while ((c = getopt(argc, argv, combinedopt)) != -1) { + switch(c){ + case 's': + action = ATA_HPA_ACTION_SET_MAX; + maxsize = strtoumax(optarg, NULL, 0); + actions++; + break; + + case 'p': + if (ata_getpwd(pwd.password, pwdsize, c) != 0) + return (1); + action = ATA_HPA_ACTION_SET_PWD; + security = 1; + actions++; + break; + + case 'l': + action = ATA_HPA_ACTION_LOCK; + security = 1; + actions++; + break; + + case 'U': + if (ata_getpwd(pwd.password, pwdsize, c) != 0) + return (1); + action = ATA_HPA_ACTION_UNLOCK; + security = 1; + actions++; + break; + + case 'f': + action = ATA_HPA_ACTION_FREEZE_LOCK; + security = 1; + actions++; + break; + + case 'P': + persist = 1; + break; + + case 'y': + confirm++; + break; + + case 'q': + quiet++; + break; + } + } + + if (actions > 1) { + warnx("too many hpa actions specified"); + return (1); + } + + if (get_cgd(device, &cgd) != 0) { + warnx("couldn't get CGD"); + return (1); + } + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("couldn't allocate CCB"); + return (1); + } + + error = ata_do_identify(device, retry_count, timeout, ccb, &ident_buf); + if (error != 0) { + cam_freeccb(ccb); + return (1); + } + + if (quiet == 0) { + printf("%s%d: ", device->device_name, device->dev_unit_num); + ata_print_ident(ident_buf); + camxferrate(device); + } + + if (action == ATA_HPA_ACTION_PRINT) { + error = ata_read_native_max(device, retry_count, timeout, ccb, + ident_buf, &hpasize); + if (error == 0) + atahpa_print(ident_buf, hpasize, 1); + + cam_freeccb(ccb); + free(ident_buf); + return (error); + } + + if (!(ident_buf->support.command1 & ATA_SUPPORT_PROTECTED)) { + warnx("HPA is not supported by this device"); + cam_freeccb(ccb); + free(ident_buf); + return (1); + } + + if (security && !(ident_buf->support.command1 & ATA_SUPPORT_MAXSECURITY)) { + warnx("HPA Security is not supported by this device"); + cam_freeccb(ccb); + free(ident_buf); + return (1); + } + + is48bit = ident_buf->support.command2 & ATA_SUPPORT_ADDRESS48; + + /* + * The ATA spec requires: + * 1. Read native max addr is called directly before set max addr + * 2. Read native max addr is NOT called before any other set max call + */ + switch(action) { + case ATA_HPA_ACTION_SET_MAX: + if (confirm == 0 && + atahpa_set_confirm(device, ident_buf, maxsize, + persist) == 0) { + cam_freeccb(ccb); + free(ident_buf); + return (1); + } + + error = ata_read_native_max(device, retry_count, timeout, + ccb, ident_buf, &hpasize); + if (error == 0) { + error = atahpa_set_max(device, retry_count, timeout, + ccb, is48bit, maxsize, persist); + if (error == 0) { + /* redo identify to get new lba values */ + error = ata_do_identify(device, retry_count, + timeout, ccb, + &ident_buf); + atahpa_print(ident_buf, hpasize, 1); + } + } + break; + + case ATA_HPA_ACTION_SET_PWD: + error = atahpa_password(device, retry_count, timeout, + ccb, is48bit, &pwd); + if (error == 0) + printf("HPA password has been set\n"); + break; + + case ATA_HPA_ACTION_LOCK: + error = atahpa_lock(device, retry_count, timeout, + ccb, is48bit); + if (error == 0) + printf("HPA has been locked\n"); + break; + + case ATA_HPA_ACTION_UNLOCK: + error = atahpa_unlock(device, retry_count, timeout, + ccb, is48bit, &pwd); + if (error == 0) + printf("HPA has been unlocked\n"); + break; + + case ATA_HPA_ACTION_FREEZE_LOCK: + error = atahpa_freeze_lock(device, retry_count, timeout, + ccb, is48bit); + if (error == 0) + printf("HPA has been frozen\n"); + break; + + default: + errx(1, "Option currently not supported"); + } + + cam_freeccb(ccb); + free(ident_buf); + + return (error); +} + static int atasecurity(struct cam_device *device, int retry_count, int timeout, int argc, char **argv, char *combinedopt) @@ -6701,6 +7364,8 @@ usage(int printlong) " <-d pwd | -e pwd | -f | -h pwd | -k pwd>\n" " [-l ] [-q] [-s pwd] [-T timeout]\n" " [-U ] [-y]\n" +" camcontrol hpa [dev_id][generic args] [-f] [-l] [-P] [-p pwd]\n" +" [-q] [-s max_sectors] [-U pwd] [-y]\n" #endif /* MINIMALISTIC */ " camcontrol help\n"); if (!printlong) @@ -6851,6 +7516,17 @@ usage(int printlong) "-T timeout overrides the timeout (seconds) used for erase operation\n" "-U specifies which user to set: user or master\n" "-y don't ask any questions\n" +"hpa arguments:\n" +"-f freeze the HPA configuration of the device\n" +"-l lock the HPA configuration of the device\n" +"-P make the HPA max sectors persist\n" +"-p pwd Set the HPA configuration password required for unlock\n" +" calls\n" +"-q be quiet, do not print any status messages\n" +"-s sectors configures the maximum user accessible sectors of the\n" +" device\n" +"-U pwd unlock the HPA configuration of the device\n" +"-y don't ask any questions\n" ); #endif /* MINIMALISTIC */ } @@ -7075,6 +7751,10 @@ main(int argc, char **argv) case CAM_CMD_DEVLIST: error = getdevlist(cam_dev); break; + case CAM_CMD_HPA: + error = atahpa(cam_dev, retry_count, timeout, + argc, argv, combinedopt); + break; #endif /* MINIMALISTIC */ case CAM_CMD_DEVTREE: error = getdevtree(); Modified: stable/9/sys/sys/ata.h ============================================================================== --- stable/9/sys/sys/ata.h Fri Jun 7 14:10:18 2013 (r251497) +++ stable/9/sys/sys/ata.h Fri Jun 7 14:23:11 2013 (r251498) @@ -289,6 +289,23 @@ struct ata_params { #define ATA_DEV_SLAVE 0x10 #define ATA_DEV_LBA 0x40 +/* ATA limits */ +#define ATA_MAX_28BIT_LBA 268435455UL + +/* ATA Status Register */ +#define ATA_STATUS_ERROR 0x01 +#define ATA_STATUS_DEVICE_FAULT 0x20 + +/* ATA Error Register */ +#define ATA_ERROR_ABORT 0x04 +#define ATA_ERROR_ID_NOT_FOUND 0x10 + +/* ATA HPA Features */ +#define ATA_HPA_FEAT_MAX_ADDR 0x00 +#define ATA_HPA_FEAT_SET_PWD 0x01 +#define ATA_HPA_FEAT_LOCK 0x02 +#define ATA_HPA_FEAT_UNLOCK 0x03 +#define ATA_HPA_FEAT_FREEZE 0x04 /* ATA transfer modes */ #define ATA_MODE_MASK 0x0f From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 14:30:08 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 31FB5198; Fri, 7 Jun 2013 14:30:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 14D59121B; Fri, 7 Jun 2013 14:30:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57EU72k033561; Fri, 7 Jun 2013 14:30:07 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57EU7Y8033558; Fri, 7 Jun 2013 14:30:07 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201306071430.r57EU7Y8033558@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 7 Jun 2013 14:30:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251499 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 14:30:08 -0000 Author: hselasky Date: Fri Jun 7 14:30:06 2013 New Revision: 251499 URL: http://svnweb.freebsd.org/changeset/base/251499 Log: Add support for polling the XHCI interrupt handler when the regular interrupt handler is not working properly or in case of MSI interrupts which are not yet supported. Remove interrupt setup code for FreeBSD versions older than 700031. MFC after: 1 week PR: usb/179342 Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/controller/xhci.h head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Fri Jun 7 14:23:11 2013 (r251498) +++ head/sys/dev/usb/controller/xhci.c Fri Jun 7 14:30:06 2013 (r251499) @@ -90,6 +90,7 @@ #ifdef USB_DEBUG static int xhcidebug; static int xhciroute; +static int xhcipolling; static SYSCTL_NODE(_hw_usb, OID_AUTO, xhci, CTLFLAG_RW, 0, "USB XHCI"); SYSCTL_INT(_hw_usb_xhci, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN, @@ -98,6 +99,9 @@ TUNABLE_INT("hw.usb.xhci.debug", &xhcide SYSCTL_INT(_hw_usb_xhci, OID_AUTO, xhci_port_route, CTLFLAG_RW | CTLFLAG_TUN, &xhciroute, 0, "Routing bitmap for switching EHCI ports to XHCI controller"); TUNABLE_INT("hw.usb.xhci.xhci_port_route", &xhciroute); +SYSCTL_INT(_hw_usb_xhci, OID_AUTO, use_polling, CTLFLAG_RW | CTLFLAG_TUN, + &xhcipolling, 0, "Set to enable software interrupt polling for XHCI controller"); +TUNABLE_INT("hw.usb.xhci.use_polling", &xhcipolling); #endif #define XHCI_INTR_ENDPT 1 @@ -194,6 +198,16 @@ xhci_get_port_route(void) #endif } +uint8_t +xhci_use_polling(void) +{ +#ifdef USB_DEBUG + return (xhcipolling != 0); +#else + return (0); +#endif +} + static void xhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb) { Modified: head/sys/dev/usb/controller/xhci.h ============================================================================== --- head/sys/dev/usb/controller/xhci.h Fri Jun 7 14:23:11 2013 (r251498) +++ head/sys/dev/usb/controller/xhci.h Fri Jun 7 14:30:06 2013 (r251499) @@ -438,6 +438,8 @@ struct xhci_softc { /* configure message */ struct usb_bus_msg sc_config_msg[2]; + struct usb_callout sc_callout; + union xhci_hub_desc sc_hub_desc; struct cv sc_cmd_cv; @@ -500,6 +502,7 @@ struct xhci_softc { /* prototypes */ uint32_t xhci_get_port_route(void); +uint8_t xhci_use_polling(void); usb_error_t xhci_halt_controller(struct xhci_softc *); usb_error_t xhci_init(struct xhci_softc *, device_t); usb_error_t xhci_start_controller(struct xhci_softc *); Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Fri Jun 7 14:23:11 2013 (r251498) +++ head/sys/dev/usb/controller/xhci_pci.c Fri Jun 7 14:30:06 2013 (r251499) @@ -132,6 +132,16 @@ xhci_pci_probe(device_t self) } } +static void +xhci_interrupt_poll(void *_sc) +{ + struct xhci_softc *sc = _sc; + USB_BUS_UNLOCK(&sc->sc_bus); + xhci_interrupt(sc); + USB_BUS_LOCK(&sc->sc_bus); + usb_callout_reset(&sc->sc_callout, 1, (void *)&xhci_interrupt_poll, sc); +} + static int xhci_pci_attach(device_t self) { @@ -159,12 +169,13 @@ xhci_pci_attach(device_t self) sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); sc->sc_io_size = rman_get_size(sc->sc_io_res); + usb_callout_init_mtx(&sc->sc_callout, &sc->sc_bus.bus_mtx, 0); + rid = 0; sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); if (sc->sc_irq_res == NULL) { device_printf(self, "Could not allocate IRQ\n"); - goto error; } sc->sc_bus.bdev = device_add_child(self, "usbus", -1); if (sc->sc_bus.bdev == NULL) { @@ -175,18 +186,22 @@ xhci_pci_attach(device_t self) sprintf(sc->sc_vendor, "0x%04x", pci_get_vendor(self)); -#if (__FreeBSD_version >= 700031) - err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, - NULL, (driver_intr_t *)xhci_interrupt, sc, &sc->sc_intr_hdl); -#else - err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, - (driver_intr_t *)xhci_interrupt, sc, &sc->sc_intr_hdl); -#endif - if (err) { - device_printf(self, "Could not setup IRQ, err=%d\n", err); - sc->sc_intr_hdl = NULL; - goto error; + if (sc->sc_irq_res != NULL) { + err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)xhci_interrupt, sc, &sc->sc_intr_hdl); + if (err != 0) { + device_printf(self, "Could not setup IRQ, err=%d\n", err); + sc->sc_intr_hdl = NULL; + } } + if (sc->sc_irq_res == NULL || sc->sc_intr_hdl == NULL || + xhci_use_polling() != 0) { + device_printf(self, "Interrupt polling at %dHz\n", hz); + USB_BUS_LOCK(&sc->sc_bus); + xhci_interrupt_poll(sc); + USB_BUS_UNLOCK(&sc->sc_bus); + } + xhci_pci_take_controller(self); err = xhci_halt_controller(sc); @@ -222,12 +237,14 @@ xhci_pci_detach(device_t self) /* during module unload there are lots of children leftover */ device_delete_children(self); + if (sc->sc_io_res) { + usb_callout_drain(&sc->sc_callout); + xhci_halt_controller(sc); + } + pci_disable_busmaster(self); if (sc->sc_irq_res && sc->sc_intr_hdl) { - - xhci_halt_controller(sc); - bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl); sc->sc_intr_hdl = NULL; } From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 15:52:33 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8C681EE; Fri, 7 Jun 2013 15:52:33 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7EAAB17AF; Fri, 7 Jun 2013 15:52:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57FqXSs061898; Fri, 7 Jun 2013 15:52:33 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57FqXvO061897; Fri, 7 Jun 2013 15:52:33 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201306071552.r57FqXvO061897@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 7 Jun 2013 15:52:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251500 - stable/8 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 15:52:33 -0000 Author: pluknet Date: Fri Jun 7 15:52:33 2013 New Revision: 251500 URL: http://svnweb.freebsd.org/changeset/base/251500 Log: Add the entry for 8.4-RELEASE. Modified: stable/8/UPDATING Modified: stable/8/UPDATING ============================================================================== --- stable/8/UPDATING Fri Jun 7 14:30:06 2013 (r251499) +++ stable/8/UPDATING Fri Jun 7 15:52:33 2013 (r251500) @@ -15,6 +15,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20130607: + 8.4-RELEASE. + 20130524: `list' command has been added to hastctl(8). For now, it is full equivalent of `status' command. From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 17:06:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3FCE5F0F; Fri, 7 Jun 2013 17:06:09 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 17A4F1ACD; Fri, 7 Jun 2013 17:06:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57H683K084792; Fri, 7 Jun 2013 17:06:08 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57H68cu084791; Fri, 7 Jun 2013 17:06:08 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201306071706.r57H68cu084791@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 7 Jun 2013 17:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251501 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 17:06:09 -0000 Author: pluknet Date: Fri Jun 7 17:06:08 2013 New Revision: 251501 URL: http://svnweb.freebsd.org/changeset/base/251501 Log: FreeBSD 8.4 added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Fri Jun 7 15:52:33 2013 (r251500) +++ head/share/misc/bsd-family-tree Fri Jun 7 17:06:08 2013 (r251501) @@ -254,16 +254,17 @@ FreeBSD 5.2 | | | 9.0 | | | NetBSD 5.1.2 | DragonFly 3.0.1 | | FreeBSD | | | | | | 8.3 | | OpenBSD 5.1 | - | | Mac OS X | | | - | | 10.8 | | | - | | | NetBSD 6.0 | | - | | | | OpenBSD 5.2 DragonFly 3.2.1 - | FreeBSD | | | | - | 9.1 | | | | - | | | | | - | | | OpenBSD 5.3 DragonFly 3.4.1 - | | NetBSD 6.1 | | - | | | | | + | | | Mac OS X | | | + | | | 10.8 | | | + | | | | NetBSD 6.0 | | + | | | | | OpenBSD 5.2 DragonFly 3.2.1 + | FreeBSD | | | | | + | 9.1 | | | | | + | | | | | | + | | | | OpenBSD 5.3 DragonFly 3.4.1 + | | | NetBSD 6.1 | | + | FreeBSD | | | | + | 8.4 | | | | | | | | | FreeBSD 10 -current | NetBSD -current OpenBSD -current | | | | | | @@ -568,6 +569,7 @@ FreeBSD 9.1 2012-12-30 [FBD] DragonFly 3.4.1 2013-04-29 [DFB] OpenBSD 5.3 2013-05-01 [OBD] NetBSD 6.1 2013-05-18 [NBD] +FreeBSD 8.4 2013-06-07 [FBD] Bibliography ------------------------ From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 17:12:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 64BD51D9; Fri, 7 Jun 2013 17:12:09 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 572B91B17; Fri, 7 Jun 2013 17:12:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57HC9Rr087519; Fri, 7 Jun 2013 17:12:09 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57HC97k087518; Fri, 7 Jun 2013 17:12:09 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <201306071712.r57HC97k087518@svn.freebsd.org> From: Bruce M Simpson Date: Fri, 7 Jun 2013 17:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251502 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 17:12:09 -0000 Author: bms Date: Fri Jun 7 17:12:08 2013 New Revision: 251502 URL: http://svnweb.freebsd.org/changeset/base/251502 Log: Disable IGMPv3 link timers on a transition to IGMPv2. Submitted by: Alan Smithee Modified: head/sys/netinet/igmp.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Fri Jun 7 17:06:08 2013 (r251501) +++ head/sys/netinet/igmp.c Fri Jun 7 17:12:08 2013 (r251502) @@ -2121,6 +2121,7 @@ igmp_v1v2_process_querier_timers(struct __func__, igi->igi_version, IGMP_VERSION_2, igi->igi_ifp, igi->igi_ifp->if_xname); igi->igi_version = IGMP_VERSION_2; + igmp_v3_cancel_link_timers(igi); } } } else if (igi->igi_v1_timer > 0) { From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 19:02:34 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8A0FE6E1; Fri, 7 Jun 2013 19:02:34 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7B3441F70; Fri, 7 Jun 2013 19:02:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57J2Y9g021492; Fri, 7 Jun 2013 19:02:34 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57J2Xso021485; Fri, 7 Jun 2013 19:02:33 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201306071902.r57J2Xso021485@svn.freebsd.org> From: "David E. O'Brien" Date: Fri, 7 Jun 2013 19:02:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251504 - in stable/9: sys/dev/filemon sys/modules/filemon tools/regression/filemon X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 19:02:34 -0000 Author: obrien Date: Fri Jun 7 19:02:32 2013 New Revision: 251504 URL: http://svnweb.freebsd.org/changeset/base/251504 Log: MFC: r251368, r251382: Match the options of the kernel. Modified: stable/9/sys/dev/filemon/filemon.c stable/9/sys/dev/filemon/filemon_wrapper.c stable/9/sys/modules/filemon/Makefile stable/9/tools/regression/filemon/Makefile stable/9/tools/regression/filemon/filemontest.c stable/9/tools/regression/filemon/test_script.sh Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/modules/ (props changed) stable/9/tools/ (props changed) stable/9/tools/regression/ (props changed) Modified: stable/9/sys/dev/filemon/filemon.c ============================================================================== --- stable/9/sys/dev/filemon/filemon.c Fri Jun 7 18:46:47 2013 (r251503) +++ stable/9/sys/dev/filemon/filemon.c Fri Jun 7 19:02:32 2013 (r251504) @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #include #include #include Modified: stable/9/sys/dev/filemon/filemon_wrapper.c ============================================================================== --- stable/9/sys/dev/filemon/filemon_wrapper.c Fri Jun 7 18:46:47 2013 (r251503) +++ stable/9/sys/dev/filemon/filemon_wrapper.c Fri Jun 7 19:02:32 2013 (r251504) @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #if __FreeBSD_version > 800032 #define FILEMON_HAS_LINKAT #endif Modified: stable/9/sys/modules/filemon/Makefile ============================================================================== --- stable/9/sys/modules/filemon/Makefile Fri Jun 7 18:46:47 2013 (r251503) +++ stable/9/sys/modules/filemon/Makefile Fri Jun 7 19:02:32 2013 (r251504) @@ -4,6 +4,6 @@ KMOD= filemon SRCS= ${KMOD}.c -SRCS+= vnode_if.h opt_compat.h opt_capsicum.h +SRCS+= opt_compat.h .include Modified: stable/9/tools/regression/filemon/Makefile ============================================================================== --- stable/9/tools/regression/filemon/Makefile Fri Jun 7 18:46:47 2013 (r251503) +++ stable/9/tools/regression/filemon/Makefile Fri Jun 7 19:02:32 2013 (r251504) @@ -1,10 +1,20 @@ # $FreeBSD$ -BINS= \ +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" +BI_BITS= +.endif + +_BINS= \ filemontest \ - timed-forkb + timed-forkb \ + sizeof_long + +BINS= ${_BINS} +.if defined(BI_BITS) +BINS+= ${_BINS:C/$/32/g} +.endif -bins: filemontest timed-forkb +bins: ${BINS} all: bins NO_MAN= @@ -18,16 +28,25 @@ WITHOUT_CDDL= CLEANFILES+= ${BINS} -tests: bins + +.for f32 in ${BINS} +${f32}32: ${f32}.c + ${CC} -m32 -DBIT=\"32\" -o ${.TARGET} ${CFLAGS} ${.ALLSRC} +.endfor + +tests: kldstat | grep filemon - ${MAKE} test - ./timed-forkb + @echo "" + ${MAKE} test01 + ${MAKE} test02 +.if defined(BI_BITS) + ${MAKE} test32 +.endif @echo "filemon(4) tests passed." # Cannot use .OBJDIR -- 'filemontest' expects 'test_script.sh' in . -#FILEMONTEST32= filemontest32 -test: filemontest clean-test -.for BIN in filemontest ${FILEMONTEST32} +test01: ${BINS:Mfilemontest*} ${BINS:Msizeof_long*} clean-test +.for BIN in ${BINS:Mfilemontest} cd ${.CURDIR} ; \ for A in 1 2 3 4 5 6 7 8 9 0; do \ for B in 1 2 3 4 5 6 7 8 9 0; do \ @@ -37,10 +56,31 @@ test: filemontest clean-test done ;\ done @cd ${.CURDIR} ; set +e ; egrep '(Start|Stop) .*\.' filemon_log.* | \ - grep -q -v '\.[0-9][0-9][0-9][0-9][0-9][0-9]$$' || echo "Time stamp format OK" + grep -q -v '\.[0-9][0-9][0-9][0-9][0-9][0-9]$$' || printf "Time stamp format OK\n\n" .endfor + @cd ${.CURDIR} ; set +e ; for F in filemon_log.* ; do \ + tail -1 $$F | grep -q '# Bye bye' || echo "$$F missing filemon bye-bye" ; \ + NL=`wc -l $$F | awk '{print $$1}'` ; \ + if [ "$${NL}" != 97 ]; then echo "$$F BAD, contains $${NL} lines" ; exit 1 ; fi ; done + +test02: ${BINS:Mtimed-forkb*} + @echo "Without filemon(4) active:" + ./timed-forkb + @echo "With filemon(4) active:" + script -f typescript-timed-forkb ./timed-forkb + ls -l typescript-timed-forkb.filemon + +test32: ${BINS:M*32*} + script -f typescript.${.TARGET} ./sizeof_long32 >/dev/null + @tail -1 typescript.test32.filemon | grep -q '# Bye bye' || (echo '32-bit comapt filemon Missing "bye-bye"' ; exit 1) + @egrep -q '^X [0-9]+ 0$$' typescript.test32.filemon || (echo "32-bit binary exit ERROR" ; exit 1) + @printf "filemon(4) 32bit FreeBSD support passed.\n\n" + +CLEANFILES+= typescript-timed-forkb typescript-timed-forkb.filemon clean-test: - cd ${.CURDIR} ; rm -f filemon_log.* + cd ${.CURDIR} ; rm -f filemon_log*.* + +clean-tests: clean-test .include Modified: stable/9/tools/regression/filemon/filemontest.c ============================================================================== --- stable/9/tools/regression/filemon/filemontest.c Fri Jun 7 18:46:47 2013 (r251503) +++ stable/9/tools/regression/filemon/filemontest.c Fri Jun 7 19:02:32 2013 (r251504) @@ -43,9 +43,13 @@ __FBSDID("$FreeBSD$"); * "test_script.sh" in the cwd. */ +#ifndef BIT +#define BIT "" +#endif + int main(void) { - char log_name[] = "filemon_log.XXXXXX"; + char log_name[] = "filemon_log" BIT ".XXXXXX"; pid_t child; int fm_fd, fm_log; @@ -66,7 +70,7 @@ main(void) { child = getpid(); if (ioctl(fm_fd, FILEMON_SET_PID, &child) == -1) err(1, "Cannot set filemon PID to %d", child); - system("./test_script.sh"); + system("env BIT=" BIT " ./test_script.sh"); break; case -1: err(1, "Cannot fork"); Modified: stable/9/tools/regression/filemon/test_script.sh ============================================================================== --- stable/9/tools/regression/filemon/test_script.sh Fri Jun 7 18:46:47 2013 (r251503) +++ stable/9/tools/regression/filemon/test_script.sh Fri Jun 7 19:02:32 2013 (r251504) @@ -41,3 +41,4 @@ ed -s $f1 < $f2 #w" | ed -s $f1 #rm $f1 $f2 uptime > /dev/null +sizeof_long${BIT} > /dev/null From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 19:42:00 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D436719F; Fri, 7 Jun 2013 19:42:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C6F2F116D; Fri, 7 Jun 2013 19:42:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57Jg09v033725; Fri, 7 Jun 2013 19:42:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57Jg0g5033724; Fri, 7 Jun 2013 19:42:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201306071942.r57Jg0g5033724@svn.freebsd.org> From: Alan Cox Date: Fri, 7 Jun 2013 19:42:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251505 - head/sys/fs/tmpfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 19:42:00 -0000 Author: alc Date: Fri Jun 7 19:42:00 2013 New Revision: 251505 URL: http://svnweb.freebsd.org/changeset/base/251505 Log: Add missing VM object unlocks in an error case. Reviewed by: kib Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Fri Jun 7 19:02:32 2013 (r251504) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Fri Jun 7 19:42:00 2013 (r251505) @@ -470,6 +470,7 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p printf( "tmpfs: vm_obj %p idx %jd null lookup rv %d\n", tobj, idx, rv); + VM_OBJECT_WUNLOCK(tobj); return (EIO); } if (rv != VM_PAGER_OK) { @@ -586,6 +587,7 @@ tmpfs_mappedwrite(vm_object_t tobj, size printf( "tmpfs: vm_obj %p idx %jd null lookup rv %d\n", tobj, idx, rv); + VM_OBJECT_WUNLOCK(tobj); return (EIO); } if (rv != VM_PAGER_OK) { From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 19:45:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 88C1A37B; Fri, 7 Jun 2013 19:45:04 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7BA8F118D; Fri, 7 Jun 2013 19:45:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57Jj45w034305; Fri, 7 Jun 2013 19:45:04 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57Jj4pl034304; Fri, 7 Jun 2013 19:45:04 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201306071945.r57Jj4pl034304@svn.freebsd.org> From: "Simon J. Gerraty" Date: Fri, 7 Jun 2013 19:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251506 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 19:45:04 -0000 Author: sjg Date: Fri Jun 7 19:45:04 2013 New Revision: 251506 URL: http://svnweb.freebsd.org/changeset/base/251506 Log: Override bmake's default MAKEFILE_PREFERENCE Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Fri Jun 7 19:42:00 2013 (r251505) +++ head/share/mk/sys.mk Fri Jun 7 19:45:04 2013 (r251506) @@ -334,7 +334,7 @@ OBJFORMAT?= elf .MAKE.EXPAND_VARIABLES= yes # Tell bmake the makefile preference -.MAKE.MAKEFILE_PREFERENCE?= BSDmakefile makefile Makefile +.MAKE.MAKEFILE_PREFERENCE= BSDmakefile makefile Makefile .if !defined(.PARSEDIR) # We are not bmake, which is more aggressive about searching .PATH From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 20:02:01 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5208F750; Fri, 7 Jun 2013 20:02:01 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 3BA25122B; Fri, 7 Jun 2013 20:02:01 +0000 (UTC) Received: from kruse-124.4.ixsystems.com (drawbridge.ixsystems.com [206.40.55.65]) by elvis.mu.org (Postfix) with ESMTPSA id EC7BC1A3C3E; Fri, 7 Jun 2013 13:01:50 -0700 (PDT) Message-ID: <51B23C2D.7000203@mu.org> Date: Fri, 07 Jun 2013 13:01:49 -0700 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r251282 - head/sys/kern References: <201306030416.r534GmCA001872@svn.freebsd.org> <51AC1B49.9090001@mu.org> <20130603075539.GK3047@kib.kiev.ua> <51AC60CA.6050105@mu.org> <20130604052219.GP3047@kib.kiev.ua> <20130604170410.M1018@besplex.bde.org> <51AF2AE8.4080308@mu.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 20:02:01 -0000 On 6/5/13 10:55 AM, Adrian Chadd wrote: > ... can people please boot an i386 kernel w/ this stuff in it, with > the RAM constrained to something small (say, 128mb), and verify that > you can at least start a buildworld (minus clang, of course) without > panicing? > > There's a recent PR > (http://www.freebsd.org/cgi/query-pr.cgi?pr=179112) which shows > regressions on i386 + small RAM platforms. > > I know it's a different area, but I'd really appreciate it if people > better tested this stuff out before they make i386 (and by extension, > any platform with limited KVA and small amounts of RAM) unusable > through carelessness. Adrian, I'm pretty sure that kib's patch actually limits memory. The concern I have is that it's a hard limit that appears not based on KVA, but rather 32GB. I can be wrong, but Bruce's feedback looks like it backs up my concern. -Alfred > > Thanks, > > > > Adrian > > On 5 June 2013 05:11, Alfred Perlstein wrote: >> Konstantin, is there any way to take some of Bruce's feedback into account >> to get rid of the hard coded max? >> >> -Alfred >> >> >> On 6/4/13 1:14 AM, Bruce Evans wrote: >>> On Tue, 4 Jun 2013, Konstantin Belousov wrote: >>> >>>> On Mon, Jun 03, 2013 at 02:24:26AM -0700, Alfred Perlstein wrote: >>>>> On 6/3/13 12:55 AM, Konstantin Belousov wrote: >>>>>> On Sun, Jun 02, 2013 at 09:27:53PM -0700, Alfred Perlstein wrote: >>>>>>> Hey Konstaintin, shouldn't this be scaled against the actual amount of >>>>>>> KVA we have instead of an arbitrary limit? >>>>>> The commit changes the buffer cache to scale according to the available >>>>>> KVA, making the scaling less dumb. >>>>>> >>>>>> I do not understand what exactly do you want to do, please describe the >>>>>> algorithm you propose to implement instead of my change. >>>>> >>>>> Sure, how about deriving the hardcoded "32" from the maxkva a machine >>>>> can have? >>>>> >>>>> Is that possible? >>>> I do not see why this would be useful. Initially I thought about simply >>>> capping nbuf at 100000 without referencing any "memory". Then I realized >>>> that this would somewhat conflict with (unlikely) changes to the value >>>> of BKVASIZE due to "factor". >>> >>> The presence of BKVASIZE in 'factor' is a bug. My version never had this >>> bug (see below for a patch). The scaling should be to maximize nbuf, >>> subject to non-arbitrary limits on physical memory and kva, and now an >>> arbirary limit of about 100000 / (BKVASIZE / 16384) on nbuf. Your new >>> limit is arbitrary so it shouldn't affect nbuf depending on BKVASIZE. >>> >>> Expanding BKVASIZE should expand kva use, but on i386 this will soon >>> hit a non-arbitary kva limit so nbuf will not be as high as preferred. >>> nbuf needs to be very large mainly to support file systems with small >>> buffers. Even 100000 only gives 50MB of buffering if the fs block >>> size is 512. This would shrink to only 12.5MB if BKVASIZE is expanded >>> by a factor of 4 and the bug is not fixed. If 25000 buffers after >>> expanding BKVASIZE is enough, then that should be the arbitary limit >>> (independent of BKVASIZE) so as to save physical memory. >>> >>> On i386 systems with 1GB RAM, nbuf defaults to about 7000. With an >>> fs block size of 512, that can buffer 3.5MB. Expanding BKVASIZE by a >>> factor of 4 shrinks this to 0.875MB in -current. That is ridiculously >>> small. VMIO limits the lossage from this. >>> >>> BKVASIZE was originally 8KB. I forget if nbuf was halved by not modifying >>> the scale factor when it was expanded to 16KB. Probably not. I used to >>> modify the scale factor to get twice as many as the default nbuf, but >>> once the default nbuf expanded to a few thousand it became large enough >>> for most purposes so I no longer do this. >>> >>> Except on arches with extremely limit kva like i386, KVASIZE should be >>> MAXBSIZE, and all of the complications for expanding a buffer's kva >>> beyond BKVASIZE and handling the fragmentation problems caused by this >>> shouldn't exist. Limits like vfs.maxbufspace should be scaled by >>> NOMBSIZE = current BKVASIZE instead of BKVASIZE. Oops, my NOMBSIZE >>> has similar logical problems to BKVASIZE. It needs to be precisely >>> 16KB to preserve the defaults for nbuf and maxbufspace, but the nominal >>> (ffs) buffer size is now 32KB. So the heuristic scale factors should >>> use the historical magic number 16K. I changed sequential_heuristic() >>> to use a hard-coded 16K instead of BKVASIZE. The correct number here >>> depends on disk technology. >>> >>> The patch has many style fixes: >>> >>> @ Index: vfs_bio.c >>> @ =================================================================== >>> @ RCS file: /home/ncvs/src/sys/kern/vfs_bio.c,v >>> @ retrieving revision 1.436 >>> @ diff -u -2 -r1.436 vfs_bio.c >>> @ --- vfs_bio.c 17 Jun 2004 17:16:49 -0000 1.436 >>> @ +++ vfs_bio.c 3 Jun 2013 16:04:34 -0000 >>> @ @@ -419,64 +493,54 @@ >>> @ @ /* >>> @ - * Calculating buffer cache scaling values and reserve space for buffer >>> @ + * Calculate buffer cache scaling values and reserve space for buffer >>> @ * headers. This is called during low level kernel initialization and >>> @ * may be called more then once. We CANNOT write to the memory area >>> @ * being reserved at this time. >>> @ */ >>> @ -caddr_t >>> @ -kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) >>> @ +void * >>> @ +vfs_bio_alloc(void *va) >>> >>> The API name was verbose and bogus. The prefix for this subsystem is >>> vfs_bio_, not kern_vfs_bio_. This is a generic allocation routine. >>> It always allocated swbufs and has expanded to do more allocations. >>> >>> @ { >>> @ - /* >>> @ - * physmem_est is in pages. Convert it to kilobytes (assumes >>> @ - * PAGE_SIZE is >= 1K) >>> @ - */ >>> @ - physmem_est = physmem_est * (PAGE_SIZE / 1024); >>> >>> I use the global physmem. This change may be too i386-specific. In >>> with 8-16 RAM, a significant amount of RAM may be eaten by the kernel >>> image or perhaps just unavailable to the kernel. Now memories are >>> larger and the amount eaten is relatively insignificant (since we are >>> only using a small fraction of physmem, only the relative error matters). >>> >>> @ + int factor, memsize; >>> @ @ /* >>> @ - * The nominal buffer size (and minimum KVA allocation) is >>> BKVASIZE. >>> @ - * For the first 64MB of ram nominally allocate sufficient buffers >>> to >>> @ - * cover 1/4 of our ram. Beyond the first 64MB allocate additional >>> @ - * buffers to cover 1/20 of our ram over 64MB. When auto-sizing >>> @ - * the buffer cache we limit the eventual kva reservation to >>> @ + * The nominal buffer size is NOMBSIZE. >>> @ + * For the first 4MB of RAM, allocate 50 buffers. >>> @ + * For the next 60MB of RAM, nominally allocate sufficient buffers >>> to >>> @ + * cover 1/4 of the RAM. Beyond the first 64MB allocate additional >>> @ + * buffers to cover 1/20 of the RAM. When auto-sizing >>> @ + * the buffer cache, limit the eventual kva reservation to >>> @ * maxbcache bytes. >>> >>> Fix old bitrot in this comment, and update for my changes. >>> - the first 4MB wasn't mentioned >>> - the minimum clamp wasn't mentioned >>> - replace BKVASIZE by NOMBSIZE so that I can change BKVASIZE without >>> changing the default nbuf (subject to maxbcache). >>> >>> The bitrot of the magic number 1/20 is not fixed. The code uses 1/10. >>> This is fixed in -current. I should have noticed this before, since >>> I used to have to change the code to get 1/10 instead of 1/20. >>> >>> I hope you updated the comment for recent changes, but I don't like >>> having magic numbers in comments. >>> >>> @ * >>> @ - * factor represents the 1/4 x ram conversion. >>> @ + * `factor' represents the 1/4 of RAM conversion. >>> @ */ >>> @ +#define NOMBSIZE imax(PAGE_SIZE, 16384) /* XXX */ >>> @ if (nbuf == 0) { >>> @ - int factor = 4 * BKVASIZE / 1024; >>> @ + /* >>> @ + * physmem is in pages. Convert it to a size in kilobytes. >>> @ + * XXX no ptob(). >>> @ + */ >>> @ + memsize = ctob(physmem) / 1024; >>> @ @ + factor = 4 * NOMBSIZE / 1024; >>> @ nbuf = 50; >>> @ - if (physmem_est > 4096) >>> @ - nbuf += min((physmem_est - 4096) / factor, >>> @ - 65536 / factor); >>> @ - if (physmem_est > 65536) >>> @ - nbuf += (physmem_est - 65536) * 2 / (factor * 5); >>> @ - >>> @ - if (maxbcache && nbuf > maxbcache / BKVASIZE) >>> @ - nbuf = maxbcache / BKVASIZE; >>> >>> The maxbcache limit must be applied to the non-default nbuf too. >>> >>> @ + if (memsize > 4096) >>> @ + nbuf += imin((memsize - 4096) / factor, >>> @ + (65536 - 4096) / factor); >>> @ + if (memsize > 65536) >>> @ + nbuf += (memsize - 65536) * 2 / (factor * 5); >>> @ } >>> @ - >>> @ -#if 0 >>> @ - /* >>> @ - * Do not allow the buffer_map to be more then 1/2 the size of the >>> @ - * kernel_map. >>> @ - */ >>> @ - if (nbuf > (kernel_map->max_offset - kernel_map->min_offset) / @ - >>> (BKVASIZE * 2)) { >>> @ - nbuf = (kernel_map->max_offset - kernel_map->min_offset) / @ - >>> (BKVASIZE * 2); >>> @ - printf("Warning: nbufs capped at %d\n", nbuf); >>> @ - } >>> @ -#endif >>> >>> Already removed in -current. >>> >>> @ + if (nbuf > maxbcache / BKVASIZE) >>> @ + nbuf = maxbcache / BKVASIZE; >>> @ @ /* >>> @ * swbufs are used as temporary holders for I/O, such as paging >>> I/O. >>> @ - * We have no less then 16 and no more then 256. >>> @ + * There must be between 16 and 256 of them. >>> @ */ >>> @ - nswbuf = max(min(nbuf/4, 256), 16); >>> @ + nswbuf = imax(imin(nbuf / 4, 256), 16); >>> @ #ifdef NSWBUF_MIN >>> @ if (nswbuf < NSWBUF_MIN) >>> @ nswbuf = NSWBUF_MIN; >>> @ #endif >>> @ + >>> @ #ifdef DIRECTIO >>> @ ffs_rawread_setup(); >>> @ @@ -484,12 +548,12 @@ >>> @ @ /* >>> @ - * Reserve space for the buffer cache buffers >>> @ + * Reserve space for swbuf headers and buffer cache buffers. >>> @ */ >>> @ - swbuf = (void *)v; >>> @ - v = (caddr_t)(swbuf + nswbuf); >>> @ - buf = (void *)v; >>> @ - v = (caddr_t)(buf + nbuf); >>> @ + swbuf = va; >>> @ + va = swbuf + nswbuf; >>> @ + buf = va; >>> @ + va = buf + nbuf; >>> @ @ - return(v); >>> @ + return (va); >>> @ } >>> @ >>> >>> Don't use the caddr_t mistake. The API was also changed to not use it. >>> >>> Bruce >>> From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 20:04:14 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B906A8F8 for ; Fri, 7 Jun 2013 20:04:14 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 9C7DB125A for ; Fri, 7 Jun 2013 20:04:14 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r57K4EEB012014 for ; Fri, 7 Jun 2013 20:04:14 GMT (envelope-from bdrewery@freefall.freebsd.org) Received: (from bdrewery@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r57K4EWQ012008 for svn-src-all@freebsd.org; Fri, 7 Jun 2013 20:04:14 GMT (envelope-from bdrewery) Received: (qmail 96062 invoked from network); 7 Jun 2013 15:04:12 -0500 Received: from unknown (HELO ?173.160.118.90?) (freebsd@shatow.net@173.160.118.90) by sweb.xzibition.com with ESMTPA; 7 Jun 2013 15:04:12 -0500 Message-ID: <51B23CBA.30706@FreeBSD.org> Date: Fri, 07 Jun 2013 15:04:10 -0500 From: Bryan Drewery Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: "Simon J. Gerraty" Subject: Re: svn commit: r251506 - head/share/mk References: <201306071945.r57Jj4pl034304@svn.freebsd.org> In-Reply-To: <201306071945.r57Jj4pl034304@svn.freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2USUANBEIXTWCARAIHSCK" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 20:04:14 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2USUANBEIXTWCARAIHSCK Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 6/7/2013 2:45 PM, Simon J. Gerraty wrote: > Author: sjg > Date: Fri Jun 7 19:45:04 2013 > New Revision: 251506 > URL: http://svnweb.freebsd.org/changeset/base/251506 >=20 > Log: > Override bmake's default MAKEFILE_PREFERENCE Thanks! >=20 > Modified: > head/share/mk/sys.mk >=20 > Modified: head/share/mk/sys.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/sys.mk Fri Jun 7 19:42:00 2013 (r251505) > +++ head/share/mk/sys.mk Fri Jun 7 19:45:04 2013 (r251506) > @@ -334,7 +334,7 @@ OBJFORMAT?=3D elf > .MAKE.EXPAND_VARIABLES=3D yes > =20 > # Tell bmake the makefile preference > -.MAKE.MAKEFILE_PREFERENCE?=3D BSDmakefile makefile Makefile > +.MAKE.MAKEFILE_PREFERENCE=3D BSDmakefile makefile Makefile > =20 > .if !defined(.PARSEDIR) > # We are not bmake, which is more aggressive about searching .PATH > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" >=20 --=20 Regards, Bryan Drewery ------enig2USUANBEIXTWCARAIHSCK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRsjy+AAoJEG54KsA8mwz5ZwkP/2ckadcd0JETIKxhsCFEAWv5 QnxPyXp6Ox/xYAT56fj0IvpSl/XaJKDTYbqwWmJ/9NicA523F8Y3ze/aLZhhwrku rvPcL3pX9RGu8lKdrsxBWu5JX/kBiMx/JJ7pXEMZtbunrHKuF2d6N/wA/6IbuIiE yKyHEFT2Fe+lFEqCGwjYwD3VRe5UBHsaBHwUQAxMlEpnrHZ4HVQ6Yb5AkTzh+O5q xkMPnRJi+6szdZpjXnA/93wQZdJj5ET+/+C5DWPrq03fwuX4+V4JXV9D8UzYJcZI CpuZJno0Z2eD7aXHbme2UTTQaGjz7yKOPIR+ZRRx54x48d1Z31XaO0Ays3wAApVz p8LFiqzozd4JhW2UuLPM7OTrBGuvNBXHh4WBwJ6JbUQo6snauzEl62zdfsaCz8P4 ShTqlapGJvRqZDnAf+nuXpP0luHo32s37S261IKLM8BwHsRdHvvRQHF2h4UQoz63 +BL2CiATj16fFoO3wsJM8ILphnM06cp1fr5icufYdPkOoemeVrdE+C8Sm4XqRKfd 9MZTyE0BUNJ6u7rLww2+eacXzqoF9JgaJOqbjkM4iEqFXlJHAPpPL6AyV/jHuSMS WdZdxoeECHz0N6tsFrB1OVX1HydYOyXw18Ln6ZpA7GAJijs6K/eCREnHMnv0oFd/ 64fibKM/O/DIsPJrHYaT =QP6x -----END PGP SIGNATURE----- ------enig2USUANBEIXTWCARAIHSCK-- From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 20:21:30 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D1390D48; Fri, 7 Jun 2013 20:21:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C3B5612C3; Fri, 7 Jun 2013 20:21:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57KLUDj046463; Fri, 7 Jun 2013 20:21:30 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57KLUfD046462; Fri, 7 Jun 2013 20:21:30 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306072021.r57KLUfD046462@svn.freebsd.org> From: Xin LI Date: Fri, 7 Jun 2013 20:21:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251507 - head/usr.sbin/portsnap/portsnap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 20:21:30 -0000 Author: delphij Date: Fri Jun 7 20:21:30 2013 New Revision: 251507 URL: http://svnweb.freebsd.org/changeset/base/251507 Log: Make 'portsnap alfred' overwrite ports tree if it's not created by a portsnap. Discussed with: alfred Reviewed by: cperciva Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh ============================================================================== --- head/usr.sbin/portsnap/portsnap/portsnap.sh Fri Jun 7 19:45:04 2013 (r251506) +++ head/usr.sbin/portsnap/portsnap/portsnap.sh Fri Jun 7 20:21:30 2013 (r251507) @@ -1113,7 +1113,7 @@ cmd_alfred() { else cmd_cron fi - if [ -d ${PORTSDIR} ]; then + if [ -r ${PORTSDIR}/.portsnap.INDEX ]; then cmd_update else cmd_extract From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 20:59:50 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CE1C8ADC; Fri, 7 Jun 2013 20:59:50 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id BDCE915D0; Fri, 7 Jun 2013 20:59:50 +0000 (UTC) Received: from kruse-124.4.ixsystems.com (drawbridge.ixsystems.com [206.40.55.65]) by elvis.mu.org (Postfix) with ESMTPSA id 53BFA1A3C1B; Fri, 7 Jun 2013 13:59:48 -0700 (PDT) Message-ID: <51B249C2.5040201@mu.org> Date: Fri, 07 Jun 2013 13:59:46 -0700 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Xin LI Subject: Re: svn commit: r251507 - head/usr.sbin/portsnap/portsnap References: <201306072021.r57KLUfD046462@svn.freebsd.org> In-Reply-To: <201306072021.r57KLUfD046462@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 20:59:50 -0000 Oh no, you made me destructive!! :) -Alfred On 6/7/13 1:21 PM, Xin LI wrote: > Author: delphij > Date: Fri Jun 7 20:21:30 2013 > New Revision: 251507 > URL: http://svnweb.freebsd.org/changeset/base/251507 > > Log: > Make 'portsnap alfred' overwrite ports tree if it's not created by a > portsnap. > > Discussed with: alfred > Reviewed by: cperciva > > Modified: > head/usr.sbin/portsnap/portsnap/portsnap.sh > > Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh > ============================================================================== > --- head/usr.sbin/portsnap/portsnap/portsnap.sh Fri Jun 7 19:45:04 2013 (r251506) > +++ head/usr.sbin/portsnap/portsnap/portsnap.sh Fri Jun 7 20:21:30 2013 (r251507) > @@ -1113,7 +1113,7 @@ cmd_alfred() { > else > cmd_cron > fi > - if [ -d ${PORTSDIR} ]; then > + if [ -r ${PORTSDIR}/.portsnap.INDEX ]; then > cmd_update > else > cmd_extract > From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 21:06:20 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6AD1FD73; Fri, 7 Jun 2013 21:06:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4230E1600; Fri, 7 Jun 2013 21:06:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57L6Kip059334; Fri, 7 Jun 2013 21:06:20 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57L6K1k059333; Fri, 7 Jun 2013 21:06:20 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201306072106.r57L6K1k059333@svn.freebsd.org> From: Andrew Turner Date: Fri, 7 Jun 2013 21:06:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251508 - head/lib/libstand/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 21:06:20 -0000 Author: andrew Date: Fri Jun 7 21:06:19 2013 New Revision: 251508 URL: http://svnweb.freebsd.org/changeset/base/251508 Log: Remove an extra copy of _setjmp from libstand. We have used the libc version of this function since r183876. Deleted: head/lib/libstand/arm/ From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 21:13:29 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7D66CF2B; Fri, 7 Jun 2013 21:13:29 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6E9E7162E; Fri, 7 Jun 2013 21:13:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57LDTkq062125; Fri, 7 Jun 2013 21:13:29 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57LDTU8062123; Fri, 7 Jun 2013 21:13:29 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201306072113.r57LDTU8062123@svn.freebsd.org> From: Andrew Turner Date: Fri, 7 Jun 2013 21:13:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251509 - head/lib/libc/arm/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 21:13:29 -0000 Author: andrew Date: Fri Jun 7 21:13:28 2013 New Revision: 251509 URL: http://svnweb.freebsd.org/changeset/base/251509 Log: Include machine/setjmp.h to get the definition of _JB_MAGIC__SETJMP. This allows us to remove it from the ARM copy of machine/asm.h. Modified: head/lib/libc/arm/gen/sigsetjmp.S Modified: head/lib/libc/arm/gen/sigsetjmp.S ============================================================================== --- head/lib/libc/arm/gen/sigsetjmp.S Fri Jun 7 21:06:19 2013 (r251508) +++ head/lib/libc/arm/gen/sigsetjmp.S Fri Jun 7 21:13:28 2013 (r251509) @@ -1,4 +1,4 @@ -/* $NetBSD: sigsetjmp.S,v 1.3 2002/08/17 19:54:30 thorpej Exp $ */ +/* $NetBSD: sigsetjmp.S,v 1.6 2013/04/19 16:50:22 matt Exp $ */ /* * Copyright (c) 1997 Mark Brinicombe @@ -35,6 +35,8 @@ #include __FBSDID("$FreeBSD$"); +#include + /* * C library -- sigsetjmp, siglongjmp * From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 21:23:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 93E57394; Fri, 7 Jun 2013 21:23:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 86924166B; Fri, 7 Jun 2013 21:23:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57LNBGQ065205; Fri, 7 Jun 2013 21:23:11 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57LNBT4065204; Fri, 7 Jun 2013 21:23:11 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201306072123.r57LNBT4065204@svn.freebsd.org> From: Andrew Turner Date: Fri, 7 Jun 2013 21:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251510 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 21:23:11 -0000 Author: andrew Date: Fri Jun 7 21:23:11 2013 New Revision: 251510 URL: http://svnweb.freebsd.org/changeset/base/251510 Log: Reduce the difference to NetBSD. * Stop pretending we support anything other than ELF by removing code surrounded by #ifdef __ELF__ ... #endif. * Remove _JB_MAGIC_SETJMP and _JB_MAGIC__SETJMP, they are defined in setjmp.h, which is able to be included from asm. * Fix the spelling of dependent. * Rename END _END and add END and ASEND to complement ENTRY and ASENTRY respectively * Add macros to simplify accessing the Global Offset Table, some of these will be used in the upcoming update to the setjmp functions. Modified: head/sys/arm/include/asm.h Modified: head/sys/arm/include/asm.h ============================================================================== --- head/sys/arm/include/asm.h Fri Jun 7 21:13:28 2013 (r251509) +++ head/sys/arm/include/asm.h Fri Jun 7 21:23:11 2013 (r251510) @@ -40,22 +40,9 @@ #define _MACHINE_ASM_H_ #include -#ifdef __ELF__ -# define _C_LABEL(x) x -#else -# ifdef __STDC__ -# define _C_LABEL(x) _ ## x -# else -# define _C_LABEL(x) _/**/x -# endif -#endif +#define _C_LABEL(x) x #define _ASM_LABEL(x) x -#ifndef _JB_MAGIC__SETJMP -#define _JB_MAGIC__SETJMP 0x4278f500 -#define _JB_MAGIC_SETJMP 0x4278f501 -#endif - #define I32_bit (1 << 7) /* IRQ disable */ #define F32_bit (1 << 6) /* FIQ disable */ @@ -79,7 +66,7 @@ /* * gas/arm uses @ as a single comment character and thus cannot be used here * Instead it recognised the # instead of an @ symbols in .type directives - * We define a couple of macros so that assembly code will not be dependant + * We define a couple of macros so that assembly code will not be dependent * on one or the other. */ #define _ASM_TYPE_FUNCTION #function @@ -88,7 +75,7 @@ #define _ENTRY(x) \ .text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: _FNSTART -#define END(x) .size x, . - x; _FNEND +#define _END(x) .size x, . - x; _FNEND #ifdef GPROF # define _PROF_PROLOGUE \ @@ -99,20 +86,41 @@ #define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE #define ENTRY_NP(y) _ENTRY(_C_LABEL(y)) +#define END(y) _END(_C_LABEL(y)) #define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE #define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y)) +#define ASEND(y) _END(_ASM_LABEL(y)) #define ASMSTR .asciz -#if defined(__ELF__) && defined(PIC) +#if defined(PIC) +#define PLT_SYM(x) PIC_SYM(x, PLT) +#define GOT_SYM(x) PIC_SYM(x, GOT) +#define GOT_GET(x,got,sym) \ + ldr x, sym; \ + ldr x, [x, got] +#define GOT_INIT(got,gotsym,pclabel) \ + ldr got, gotsym; \ + add got, got, pc; \ + pclabel: +#define GOT_INITSYM(gotsym,pclabel) \ + gotsym: .word _C_LABEL(_GLOBAL_OFFSET_TABLE_) + (. - (pclabel+4)) + #ifdef __STDC__ #define PIC_SYM(x,y) x ## ( ## y ## ) #else #define PIC_SYM(x,y) x/**/(/**/y/**/) #endif + #else +#define PLT_SYM(x) x +#define GOT_SYM(x) x +#define GOT_GET(x,got,sym) \ + ldr x, sym; +#define GOT_INIT(got,gotsym,pclabel) +#define GOT_INITSYM(gotsym,pclabel) #define PIC_SYM(x,y) x -#endif +#endif /* PIC */ #undef __FBSDID #if !defined(lint) && !defined(STRIP_FBSDID) @@ -122,24 +130,18 @@ #endif -#ifdef __ELF__ #define WEAK_ALIAS(alias,sym) \ .weak alias; \ alias = sym -#endif #ifdef __STDC__ #define WARN_REFERENCES(sym,msg) \ .stabs msg ## ,30,0,0,0 ; \ .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0 -#elif defined(__ELF__) -#define WARN_REFERENCES(sym,msg) \ - .stabs msg,30,0,0,0 ; \ - .stabs __STRING(sym),1,0,0,0 #else #define WARN_REFERENCES(sym,msg) \ .stabs msg,30,0,0,0 ; \ - .stabs __STRING(_/**/sym),1,0,0,0 + .stabs __STRING(sym),1,0,0,0 #endif /* __STDC__ */ /* Exactly one of the __ARM_ARCH_*__ macros will be defined by the compiler. */ From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 21:39:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 01A6873C; Fri, 7 Jun 2013 21:39:48 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E535D16E1; Fri, 7 Jun 2013 21:39:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57LdmWx069109; Fri, 7 Jun 2013 21:39:48 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57LdlEl069096; Fri, 7 Jun 2013 21:39:47 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201306072139.r57LdlEl069096@svn.freebsd.org> From: "David E. O'Brien" Date: Fri, 7 Jun 2013 21:39:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251511 - in stable/8: etc/mtree include sys/dev/filemon sys/modules/filemon tools/regression/filemon X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 21:39:49 -0000 Author: obrien Date: Fri Jun 7 21:39:46 2013 New Revision: 251511 URL: http://svnweb.freebsd.org/changeset/base/251511 Log: MF9: r237968, r251504: MFC: r251368, r251382: Match the options of the kernel. MFC: r237279: install filemon.h into /usr/include for userland consumption. Modified: stable/8/etc/mtree/BSD.include.dist stable/8/include/Makefile stable/8/sys/dev/filemon/filemon.c stable/8/sys/dev/filemon/filemon_wrapper.c stable/8/sys/modules/filemon/Makefile stable/8/tools/regression/filemon/Makefile stable/8/tools/regression/filemon/filemontest.c stable/8/tools/regression/filemon/test_script.sh Directory Properties: stable/8/ (props changed) stable/8/etc/ (props changed) stable/8/include/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/modules/ (props changed) stable/8/tools/ (props changed) Modified: stable/8/etc/mtree/BSD.include.dist ============================================================================== --- stable/8/etc/mtree/BSD.include.dist Fri Jun 7 21:23:11 2013 (r251510) +++ stable/8/etc/mtree/BSD.include.dist Fri Jun 7 21:39:46 2013 (r251511) @@ -96,6 +96,8 @@ .. ciss .. + filemon + .. firewire .. hwpmc Modified: stable/8/include/Makefile ============================================================================== --- stable/8/include/Makefile Fri Jun 7 21:23:11 2013 (r251510) +++ stable/8/include/Makefile Fri Jun 7 21:39:46 2013 (r251511) @@ -39,7 +39,8 @@ LDIRS= bsm cam geom net net80211 netatal sys vm LSUBDIRS= cam/ata cam/scsi \ - dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/firewire dev/hwpmc \ + dev/acpica dev/agp dev/an dev/bktr dev/ciss \ + dev/filemon dev/firewire dev/hwpmc \ dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \ dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ Modified: stable/8/sys/dev/filemon/filemon.c ============================================================================== --- stable/8/sys/dev/filemon/filemon.c Fri Jun 7 21:23:11 2013 (r251510) +++ stable/8/sys/dev/filemon/filemon.c Fri Jun 7 21:39:46 2013 (r251511) @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #include #include #include Modified: stable/8/sys/dev/filemon/filemon_wrapper.c ============================================================================== --- stable/8/sys/dev/filemon/filemon_wrapper.c Fri Jun 7 21:23:11 2013 (r251510) +++ stable/8/sys/dev/filemon/filemon_wrapper.c Fri Jun 7 21:39:46 2013 (r251511) @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #if __FreeBSD_version > 800032 #define FILEMON_HAS_LINKAT #endif Modified: stable/8/sys/modules/filemon/Makefile ============================================================================== --- stable/8/sys/modules/filemon/Makefile Fri Jun 7 21:23:11 2013 (r251510) +++ stable/8/sys/modules/filemon/Makefile Fri Jun 7 21:39:46 2013 (r251511) @@ -4,6 +4,6 @@ KMOD= filemon SRCS= ${KMOD}.c -SRCS+= vnode_if.h opt_compat.h opt_capsicum.h +SRCS+= opt_compat.h .include Modified: stable/8/tools/regression/filemon/Makefile ============================================================================== --- stable/8/tools/regression/filemon/Makefile Fri Jun 7 21:23:11 2013 (r251510) +++ stable/8/tools/regression/filemon/Makefile Fri Jun 7 21:39:46 2013 (r251511) @@ -1,10 +1,20 @@ # $FreeBSD$ -BINS= \ +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" +BI_BITS= +.endif + +_BINS= \ filemontest \ - timed-forkb + timed-forkb \ + sizeof_long + +BINS= ${_BINS} +.if defined(BI_BITS) +BINS+= ${_BINS:C/$/32/g} +.endif -bins: filemontest timed-forkb +bins: ${BINS} all: bins NO_MAN= @@ -18,16 +28,25 @@ WITHOUT_CDDL= CLEANFILES+= ${BINS} -tests: bins + +.for f32 in ${BINS} +${f32}32: ${f32}.c + ${CC} -m32 -DBIT=\"32\" -o ${.TARGET} ${CFLAGS} ${.ALLSRC} +.endfor + +tests: kldstat | grep filemon - ${MAKE} test - ./timed-forkb + @echo "" + ${MAKE} test01 + ${MAKE} test02 +.if defined(BI_BITS) + ${MAKE} test32 +.endif @echo "filemon(4) tests passed." # Cannot use .OBJDIR -- 'filemontest' expects 'test_script.sh' in . -#FILEMONTEST32= filemontest32 -test: filemontest clean-test -.for BIN in filemontest ${FILEMONTEST32} +test01: ${BINS:Mfilemontest*} ${BINS:Msizeof_long*} clean-test +.for BIN in ${BINS:Mfilemontest} cd ${.CURDIR} ; \ for A in 1 2 3 4 5 6 7 8 9 0; do \ for B in 1 2 3 4 5 6 7 8 9 0; do \ @@ -37,10 +56,31 @@ test: filemontest clean-test done ;\ done @cd ${.CURDIR} ; set +e ; egrep '(Start|Stop) .*\.' filemon_log.* | \ - grep -q -v '\.[0-9][0-9][0-9][0-9][0-9][0-9]$$' || echo "Time stamp format OK" + grep -q -v '\.[0-9][0-9][0-9][0-9][0-9][0-9]$$' || printf "Time stamp format OK\n\n" .endfor + @cd ${.CURDIR} ; set +e ; for F in filemon_log.* ; do \ + tail -1 $$F | grep -q '# Bye bye' || echo "$$F missing filemon bye-bye" ; \ + NL=`wc -l $$F | awk '{print $$1}'` ; \ + if [ "$${NL}" != 97 ]; then echo "$$F BAD, contains $${NL} lines" ; exit 1 ; fi ; done + +test02: ${BINS:Mtimed-forkb*} + @echo "Without filemon(4) active:" + ./timed-forkb + @echo "With filemon(4) active:" + script -f typescript-timed-forkb ./timed-forkb + ls -l typescript-timed-forkb.filemon + +test32: ${BINS:M*32*} + script -f typescript.${.TARGET} ./sizeof_long32 >/dev/null + @tail -1 typescript.test32.filemon | grep -q '# Bye bye' || (echo '32-bit comapt filemon Missing "bye-bye"' ; exit 1) + @egrep -q '^X [0-9]+ 0$$' typescript.test32.filemon || (echo "32-bit binary exit ERROR" ; exit 1) + @printf "filemon(4) 32bit FreeBSD support passed.\n\n" + +CLEANFILES+= typescript-timed-forkb typescript-timed-forkb.filemon clean-test: - cd ${.CURDIR} ; rm -f filemon_log.* + cd ${.CURDIR} ; rm -f filemon_log*.* + +clean-tests: clean-test .include Modified: stable/8/tools/regression/filemon/filemontest.c ============================================================================== --- stable/8/tools/regression/filemon/filemontest.c Fri Jun 7 21:23:11 2013 (r251510) +++ stable/8/tools/regression/filemon/filemontest.c Fri Jun 7 21:39:46 2013 (r251511) @@ -43,9 +43,13 @@ __FBSDID("$FreeBSD$"); * "test_script.sh" in the cwd. */ +#ifndef BIT +#define BIT "" +#endif + int main(void) { - char log_name[] = "filemon_log.XXXXXX"; + char log_name[] = "filemon_log" BIT ".XXXXXX"; pid_t child; int fm_fd, fm_log; @@ -66,7 +70,7 @@ main(void) { child = getpid(); if (ioctl(fm_fd, FILEMON_SET_PID, &child) == -1) err(1, "Cannot set filemon PID to %d", child); - system("./test_script.sh"); + system("env BIT=" BIT " ./test_script.sh"); break; case -1: err(1, "Cannot fork"); Modified: stable/8/tools/regression/filemon/test_script.sh ============================================================================== --- stable/8/tools/regression/filemon/test_script.sh Fri Jun 7 21:23:11 2013 (r251510) +++ stable/8/tools/regression/filemon/test_script.sh Fri Jun 7 21:39:46 2013 (r251511) @@ -41,3 +41,4 @@ ed -s $f1 < $f2 #w" | ed -s $f1 #rm $f1 $f2 uptime > /dev/null +sizeof_long${BIT} > /dev/null From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 21:40:06 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5DDCF898; Fri, 7 Jun 2013 21:40:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4DA8016E6; Fri, 7 Jun 2013 21:40:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57Le6m2069270; Fri, 7 Jun 2013 21:40:06 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57Le2Ct069230; Fri, 7 Jun 2013 21:40:02 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201306072140.r57Le2Ct069230@svn.freebsd.org> From: Ed Maste Date: Fri, 7 Jun 2013 21:40:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251512 - in head: . etc etc/mtree gnu/usr.bin/gdb gnu/usr.bin/gdb/arch/amd64 gnu/usr.bin/gdb/arch/arm gnu/usr.bin/gdb/arch/i386 gnu/usr.bin/gdb/arch/ia64 gnu/usr.bin/gdb/arch/mips gnu/... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 21:40:06 -0000 Author: emaste Date: Fri Jun 7 21:40:02 2013 New Revision: 251512 URL: http://svnweb.freebsd.org/changeset/base/251512 Log: Add a new knob WITH_DEBUG_FILES to control the building of standalone debug files for userland programs and libraries. The "-g" debug flag is automatically applied when WITH_DEBUG_FILES is set. The debug files are now named ${prog}.debug and ${shlib}.debug for consistency with other systems and documentation. In addition they are installed under /usr/lib/debug, to simplify the process of installing them if needed after a crash. Users of bsd.{prog,lib}.mk outside of the base system place the standalone debug files in a .debug subdirectory. GDB automatically searches both of these directories for standalone debug files. Thanks to everyone who contributed changes, review, and testing during development. Added: head/etc/mtree/BSD.debug.dist (contents, props changed) head/tools/build/options/WITH_DEBUG_FILES (contents, props changed) Modified: head/Makefile.inc1 head/etc/Makefile head/etc/mtree/Makefile head/gnu/usr.bin/gdb/Makefile.inc head/gnu/usr.bin/gdb/arch/amd64/config.h head/gnu/usr.bin/gdb/arch/arm/config.h head/gnu/usr.bin/gdb/arch/i386/config.h head/gnu/usr.bin/gdb/arch/ia64/config.h head/gnu/usr.bin/gdb/arch/mips/config.h head/gnu/usr.bin/gdb/arch/powerpc/config.h head/gnu/usr.bin/gdb/arch/powerpc64/config.h head/gnu/usr.bin/gdb/arch/sparc64/config.h head/gnu/usr.bin/gdb/gdb/Makefile head/share/mk/bsd.crunchgen.mk head/share/mk/bsd.lib.mk head/share/mk/bsd.own.mk head/share/mk/bsd.prog.mk Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Jun 7 21:39:46 2013 (r251511) +++ head/Makefile.inc1 Fri Jun 7 21:40:02 2013 (r251512) @@ -470,6 +470,13 @@ _worldtmp: mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ -p ${WORLDTMP}/usr/include >/dev/null ln -sf ${.CURDIR}/sys ${WORLDTMP} +.if ${MK_DEBUG_FILES} != "no" + # We could instead disable debug files for these build stages + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ + -p ${WORLDTMP}/legacy/usr/lib >/dev/null + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ + -p ${WORLDTMP}/usr/lib >/dev/null +.endif .if ${MK_BIND_LIBS} != "no" mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ -p ${WORLDTMP}/usr/include >/dev/null @@ -555,6 +562,10 @@ build32: -p ${LIB32TMP}/usr >/dev/null mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ -p ${LIB32TMP}/usr/include >/dev/null +.if ${MK_DEBUG_FILES} != "no" + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ + -p ${LIB32TMP}/usr/lib >/dev/null +.endif mkdir -p ${WORLDTMP} ln -sf ${.CURDIR}/sys ${WORLDTMP} .for _t in obj includes @@ -779,6 +790,10 @@ distributeworld installworld: installche -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null +.if ${MK_DEBUG_FILES} != "no" + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ + -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null +.endif .if defined(NO_ROOT) ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ sed -e 's#^\./#./${dist}/#' >> ${METALOG} Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Fri Jun 7 21:39:46 2013 (r251511) +++ head/etc/Makefile Fri Jun 7 21:40:02 2013 (r251512) @@ -143,6 +143,9 @@ MTREE+= BIND.chroot.dist MTREE+= BIND.include.dist .endif .endif +.if ${MK_DEBUG_FILES} != "no" +MTREE+= BSD.debug.dist +.endif PPPCNF= ppp.conf @@ -312,6 +315,9 @@ MTREES= mtree/BSD.root.dist / \ mtree/BSD.var.dist /var \ mtree/BSD.usr.dist /usr \ mtree/BSD.include.dist /usr/include +.if ${MK_DEBUG_FILES} != "no" +MTREES+= mtree/BSD.debug.dist /usr/lib +.endif .if ${MK_BIND_LIBS} != "no" MTREES+= mtree/BIND.include.dist /usr/include .endif Added: head/etc/mtree/BSD.debug.dist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/etc/mtree/BSD.debug.dist Fri Jun 7 21:40:02 2013 (r251512) @@ -0,0 +1,48 @@ +# $FreeBSD$ +# +# Please see the file src/etc/mtree/README before making changes to this file. +# + +/set type=dir uname=root gname=wheel mode=0755 +. + debug + bin + .. + boot + .. + lib + geom + .. + .. + libexec + .. + sbin + .. + usr + bin + .. + games + .. + lib + engines + .. + .. + lib32 + .. + libexec + bsdinstall + .. + lpr + ru + .. + .. + sendmail + .. + sm.bin + .. + .. + sbin + .. + .. + .. +.. Modified: head/etc/mtree/Makefile ============================================================================== --- head/etc/mtree/Makefile Fri Jun 7 21:39:46 2013 (r251511) +++ head/etc/mtree/Makefile Fri Jun 7 21:40:02 2013 (r251512) @@ -4,6 +4,7 @@ FILES= ${_BIND.chroot.dist} \ ${_BIND.include.dist} \ + ${_BSD.debug.dist} \ BSD.include.dist \ BSD.root.dist \ ${_BSD.sendmail.dist} \ @@ -16,6 +17,9 @@ _BIND.chroot.dist= BIND.chroot.dist _BIND.include.dist= BIND.include.dist .endif .endif +.if ${MK_DEBUG_FILES} != "no" +_BSD.debug.dist= BSD.debug.dist +.endif .if ${MK_GROFF} != "no" _BSD.groff.dist= BSD.groff.dist .endif Modified: head/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- head/gnu/usr.bin/gdb/Makefile.inc Fri Jun 7 21:39:46 2013 (r251511) +++ head/gnu/usr.bin/gdb/Makefile.inc Fri Jun 7 21:40:02 2013 (r251512) @@ -37,6 +37,7 @@ GDB_CROSS_DEBUGGER= ${CNTRB_GDB}/gdb/signals ${CNTRB_GDB}/gdb/tui ${TARGET_SUBDIR} CFLAGS+= -DHAVE_CONFIG_H -DRL_NO_COMPAT -DMI_OUT=1 -DTUI=1 +CFLAGS+= -DDEBUGDIR=\"${DEBUGDIR}\" CFLAGS+= -I. CFLAGS+= -I${TARGET_SUBDIR} CFLAGS+= -I${BMAKE_BU}/libbfd -I${BMAKE_BU}/libbfd/${TARGET_CPUARCH} Modified: head/gnu/usr.bin/gdb/arch/amd64/config.h ============================================================================== --- head/gnu/usr.bin/gdb/arch/amd64/config.h Fri Jun 7 21:39:46 2013 (r251511) +++ head/gnu/usr.bin/gdb/arch/amd64/config.h Fri Jun 7 21:40:02 2013 (r251512) @@ -439,9 +439,6 @@ /* Name of this package. */ #define PACKAGE "gdb" -/* Global directory for separate debug files. */ -#define DEBUGDIR "/usr/local/lib/debug" - /* Define to BFD's default architecture. */ #define DEFAULT_BFD_ARCH bfd_i386_arch Modified: head/gnu/usr.bin/gdb/arch/arm/config.h ============================================================================== --- head/gnu/usr.bin/gdb/arch/arm/config.h Fri Jun 7 21:39:46 2013 (r251511) +++ head/gnu/usr.bin/gdb/arch/arm/config.h Fri Jun 7 21:40:02 2013 (r251512) @@ -451,9 +451,6 @@ /* Name of this package. */ #define PACKAGE "gdb" -/* Global directory for separate debug files. */ -#define DEBUGDIR "/usr/local/lib/debug" - /* Define to BFD's default architecture. */ #define DEFAULT_BFD_ARCH bfd_arm_arch Modified: head/gnu/usr.bin/gdb/arch/i386/config.h ============================================================================== --- head/gnu/usr.bin/gdb/arch/i386/config.h Fri Jun 7 21:39:46 2013 (r251511) +++ head/gnu/usr.bin/gdb/arch/i386/config.h Fri Jun 7 21:40:02 2013 (r251512) @@ -439,9 +439,6 @@ /* Name of this package. */ #define PACKAGE "gdb" -/* Global directory for separate debug files. */ -#define DEBUGDIR "/usr/local/lib/debug" - /* Define to BFD's default architecture. */ #define DEFAULT_BFD_ARCH bfd_i386_arch Modified: head/gnu/usr.bin/gdb/arch/ia64/config.h ============================================================================== --- head/gnu/usr.bin/gdb/arch/ia64/config.h Fri Jun 7 21:39:46 2013 (r251511) +++ head/gnu/usr.bin/gdb/arch/ia64/config.h Fri Jun 7 21:40:02 2013 (r251512) @@ -439,9 +439,6 @@ /* Name of this package. */ #define PACKAGE "gdb" -/* Global directory for separate debug files. */ -#define DEBUGDIR "/usr/local/lib/debug" - /* Define to BFD's default architecture. */ #define DEFAULT_BFD_ARCH bfd_ia64_arch Modified: head/gnu/usr.bin/gdb/arch/mips/config.h ============================================================================== --- head/gnu/usr.bin/gdb/arch/mips/config.h Fri Jun 7 21:39:46 2013 (r251511) +++ head/gnu/usr.bin/gdb/arch/mips/config.h Fri Jun 7 21:40:02 2013 (r251512) @@ -439,9 +439,6 @@ /* Name of this package. */ #define PACKAGE "gdb" -/* Global directory for separate debug files. */ -#define DEBUGDIR "/usr/local/lib/debug" - /* Define to BFD's default architecture. */ #define DEFAULT_BFD_ARCH bfd_mips_arch Modified: head/gnu/usr.bin/gdb/arch/powerpc/config.h ============================================================================== --- head/gnu/usr.bin/gdb/arch/powerpc/config.h Fri Jun 7 21:39:46 2013 (r251511) +++ head/gnu/usr.bin/gdb/arch/powerpc/config.h Fri Jun 7 21:40:02 2013 (r251512) @@ -439,9 +439,6 @@ /* Name of this package. */ #define PACKAGE "gdb" -/* Global directory for separate debug files. */ -#define DEBUGDIR "/usr/local/lib/debug" - /* Define to BFD's default architecture. */ #define DEFAULT_BFD_ARCH bfd_rs6000_arch Modified: head/gnu/usr.bin/gdb/arch/powerpc64/config.h ============================================================================== --- head/gnu/usr.bin/gdb/arch/powerpc64/config.h Fri Jun 7 21:39:46 2013 (r251511) +++ head/gnu/usr.bin/gdb/arch/powerpc64/config.h Fri Jun 7 21:40:02 2013 (r251512) @@ -439,9 +439,6 @@ /* Name of this package. */ #define PACKAGE "gdb" -/* Global directory for separate debug files. */ -#define DEBUGDIR "/usr/local/lib/debug" - /* Define to BFD's default architecture. */ #define DEFAULT_BFD_ARCH bfd_rs6000_arch Modified: head/gnu/usr.bin/gdb/arch/sparc64/config.h ============================================================================== --- head/gnu/usr.bin/gdb/arch/sparc64/config.h Fri Jun 7 21:39:46 2013 (r251511) +++ head/gnu/usr.bin/gdb/arch/sparc64/config.h Fri Jun 7 21:40:02 2013 (r251512) @@ -439,9 +439,6 @@ /* Name of this package. */ #define PACKAGE "gdb" -/* Global directory for separate debug files. */ -#define DEBUGDIR "/usr/local/lib/debug" - /* Define to BFD's default architecture. */ #define DEFAULT_BFD_ARCH bfd_sparc_arch Modified: head/gnu/usr.bin/gdb/gdb/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/gdb/Makefile Fri Jun 7 21:39:46 2013 (r251511) +++ head/gnu/usr.bin/gdb/gdb/Makefile Fri Jun 7 21:40:02 2013 (r251512) @@ -15,3 +15,4 @@ DPADD= ${GDBLIBS} ${BULIBS} ${LIBM} ${LI LDADD= ${GDBLIBS} ${BULIBS} -lm -lreadline -ltermcap -lgnuregex .include +CFLAGS+= -DDEBUGDIR=\"${DEBUGDIR}\" Modified: head/share/mk/bsd.crunchgen.mk ============================================================================== --- head/share/mk/bsd.crunchgen.mk Fri Jun 7 21:39:46 2013 (r251511) +++ head/share/mk/bsd.crunchgen.mk Fri Jun 7 21:40:02 2013 (r251512) @@ -47,6 +47,9 @@ CRUNCH_GENERATE_LINKS?= yes CLEANFILES+= $(CONF) *.o *.lo *.c *.mk *.cache *.a *.h +# Don't try to extract debug info from ${PROG}. +NO_DEBUG_FILES= + # Program names and their aliases contribute hardlinks to 'rescue' executable, # except for those that get suppressed. .for D in $(CRUNCH_SRCDIRS) Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Fri Jun 7 21:39:46 2013 (r251511) +++ head/share/mk/bsd.lib.mk Fri Jun 7 21:40:02 2013 (r251512) @@ -43,6 +43,12 @@ CTFFLAGS+= -g STRIP?= -s .endif +.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ + empty(DEBUG_FLAGS:M-gdwarf*) +CFLAGS+= -g +CTFFLAGS+= -g +.endif + .include # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries @@ -114,8 +120,17 @@ PO_FLAG=-pg all: objwarn .if defined(SHLIB_NAME) -.if defined(DEBUG_FLAGS) -SHLIB_NAME_FULL=${SHLIB_NAME}.debug +.if ${MK_DEBUG_FILES} != "no" +SHLIB_NAME_FULL=${SHLIB_NAME}.full +# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory +.if ${SHLIBDIR} == "/boot" ||\ + ${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\ + ${SHLIBDIR:C%/usr/lib(32)?(/.*)?%/usr/lib%} == "/usr/lib" +DEBUGFILEDIR=${DEBUGDIR}${SHLIBDIR} +.else +DEBUGFILEDIR=${SHLIBDIR}/.debug +DEBUGMKDIR= +.endif .else SHLIB_NAME_FULL=${SHLIB_NAME} .endif @@ -201,13 +216,13 @@ ${SHLIB_NAME_FULL}: ${SOBJS} ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} .endif -.if defined(DEBUG_FLAGS) -CLEANFILES+= ${SHLIB_NAME_FULL} ${SHLIB_NAME}.symbols -${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.symbols - ${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.symbols \ +.if ${MK_DEBUG_FILES} != "no" +CLEANFILES+= ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug +${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug + ${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \ ${SHLIB_NAME_FULL} ${.TARGET} -${SHLIB_NAME}.symbols: ${SHLIB_NAME_FULL} +${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL} ${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET} .endif .endif #defined(SHLIB_NAME) @@ -286,10 +301,13 @@ _libinstall: ${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR} -.if defined(DEBUG_FLAGS) - ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ +.if ${MK_DEBUG_FILES} != "no" +.if defined(DEBUGMKDIR) + ${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR} +.endif + ${INSTALL} -T debug -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \ ${_INSTALLFLAGS} \ - ${SHLIB_NAME}.symbols ${DESTDIR}${SHLIBDIR} + ${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR} .endif .if defined(SHLIB_LINK) # ${_SHLIBDIRPREFIX} and ${_LDSCRIPTROOT} are both needed when cross-building Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Fri Jun 7 21:39:46 2013 (r251511) +++ head/share/mk/bsd.own.mk Fri Jun 7 21:40:02 2013 (r251512) @@ -43,6 +43,11 @@ # LIBMODE Library mode. [${NOBINMODE}] # # +# DEBUGDIR Base path for standalone debug files. [/usr/lib/debug] +# +# DEBUGMODE Mode for debug files. [${NOBINMODE}] +# +# # KMODDIR Base path for loadable kernel modules # (see kld(4)). [/boot/kernel] # @@ -147,6 +152,9 @@ LIBOWN?= ${BINOWN} LIBGRP?= ${BINGRP} LIBMODE?= ${NOBINMODE} +DEBUGDIR?= /usr/lib/debug +DEBUGMODE?= ${NOBINMODE} + # Share files SHAREDIR?= /usr/share @@ -213,6 +221,7 @@ COMPRESS_EXT?= .gz # .for var in \ CTF \ + DEBUG_FILES \ INSTALLLIB \ MAN \ PROFILE @@ -365,6 +374,7 @@ __DEFAULT_NO_OPTIONS = \ BSD_GREP \ CLANG_EXTRAS \ CTF \ + DEBUG_FILES \ GPL_DTC \ HESIOD \ ICONV \ Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Fri Jun 7 21:39:46 2013 (r251511) +++ head/share/mk/bsd.prog.mk Fri Jun 7 21:40:02 2013 (r251512) @@ -24,8 +24,24 @@ CTFFLAGS+= -g .endif .endif +.if defined(PROG_CXX) +PROG= ${PROG_CXX} +.endif + +.if defined(PROG) && target(${PROG}) +MK_DEBUG_FILES= no +.elif !empty(LDFLAGS:M-Wl,*--oformat,*) || !empty(LDFLAGS:M-static) +MK_DEBUG_FILES= no +.endif + .if defined(CRUNCH_CFLAGS) CFLAGS+=${CRUNCH_CFLAGS} +.else +.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ + empty(DEBUG_FLAGS:M-gdwarf-*) +CFLAGS+= -g +CTFFLAGS+= -g +.endif .endif .if !defined(DEBUG_FLAGS) @@ -36,21 +52,36 @@ STRIP?= -s LDFLAGS+= -static .endif -.if defined(PROG_CXX) -PROG= ${PROG_CXX} +.if ${MK_DEBUG_FILES} != "no" +PROG_FULL=${PROG}.full +# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory +.if defined(BINDIR) && (\ + ${BINDIR} == "/bin" ||\ + ${BINDIR} == "/libexec" ||\ + ${BINDIR} == "/sbin" ||\ + ${BINDIR:C%/usr/(bin|bsdinstall|games|libexec|lpr|sendmail|sm.bin|sbin)(/.*)?%/usr/bin%} == "/usr/bin"\ + ) +DEBUGFILEDIR= ${DEBUGDIR}${BINDIR} +.else +DEBUGFILEDIR?= ${BINDIR}/.debug +DEBUGMKDIR= +.endif +.else +PROG_FULL= ${PROG} .endif .if defined(PROG) PROGNAME?= ${PROG} + .if defined(SRCS) OBJS+= ${SRCS:N*.h:R:S/$/.o/g} .if target(beforelinking) beforelinking: ${OBJS} -${PROG}: beforelinking +${PROG_FULL}: beforelinking .endif -${PROG}: ${OBJS} +${PROG_FULL}: ${OBJS} .if defined(PROG_CXX) ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .else @@ -78,9 +109,9 @@ OBJS+= ${PROG}.o .if target(beforelinking) beforelinking: ${OBJS} -${PROG}: beforelinking +${PROG_FULL}: beforelinking .endif -${PROG}: ${OBJS} +${PROG_FULL}: ${OBJS} .if defined(PROG_CXX) ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .else @@ -89,10 +120,19 @@ ${PROG}: ${OBJS} .if ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} .endif -.endif +.endif # !target(${PROG}) .endif # !defined(SRCS) +.if ${MK_DEBUG_FILES} != "no" +${PROG}: ${PROG_FULL} ${PROGNAME}.debug + ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \ + ${PROG_FULL} ${.TARGET} + +${PROGNAME}.debug: ${PROG_FULL} + ${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET} +.endif + .if ${MK_MAN} != "no" && !defined(MAN) && \ !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ @@ -109,6 +149,9 @@ all: _manpages .if defined(PROG) CLEANFILES+= ${PROG} +.if ${MK_DEBUG_FILES} != "no" +CLEANFILES+= ${PROG_FULL} ${PROGNAME}.debug +.endif .endif .if defined(OBJS) @@ -156,6 +199,13 @@ _proginstall: .if defined(PROG) ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME} +.if ${MK_DEBUG_FILES} != "no" +.if defined(DEBUGMKDIR) + ${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR} +.endif + ${INSTALL} -T debug -o ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \ + ${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug +.endif .endif .endif # !target(realinstall) Added: head/tools/build/options/WITH_DEBUG_FILES ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_DEBUG_FILES Fri Jun 7 21:40:02 2013 (r251512) @@ -0,0 +1,7 @@ +.\" $FreeBSD$ +Set to strip debug info into a separate file for each executable binary +and shared library. +The debug files will be placed in a subdirectory of +.Pa /usr/lib/debug +and are located automatically by +.Xr gdb 1 . From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 21:51:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 40292C00; Fri, 7 Jun 2013 21:51:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 32632173E; Fri, 7 Jun 2013 21:51:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57LpB62074062; Fri, 7 Jun 2013 21:51:11 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57LpBOa074061; Fri, 7 Jun 2013 21:51:11 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201306072151.r57LpBOa074061@svn.freebsd.org> From: Ed Maste Date: Fri, 7 Jun 2013 21:51:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251513 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 21:51:11 -0000 Author: emaste Date: Fri Jun 7 21:51:10 2013 New Revision: 251513 URL: http://svnweb.freebsd.org/changeset/base/251513 Log: Add WITH_DEBUG_FILES makeman currently generates a src.conf that claims every option also enforces WITHOUT_BIND_UTILS, so I applied this section by hand. Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Fri Jun 7 21:40:02 2013 (r251512) +++ head/share/man/man5/src.conf.5 Fri Jun 7 21:51:10 2013 (r251513) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 236279 2012-05-30 02:37:20Z gjb .\" $FreeBSD$ -.Dd May 21, 2013 +.Dd June 7, 2013 .Dt SRC.CONF 5 .Os .Sh NAME @@ -413,6 +413,14 @@ When set, it also enforces the following .It .Va WITHOUT_GROFF .El +.It Va WITH_DEBUG_FILES +.\" from FreeBSD: head/tools/build/options/WITH_DEBUG_FILES 251512 2013-06-07 21:40:02Z emaste +Set to strip debug info into a separate file for each executable binary +and shared library. +The debug files will be placed in a subdirectory of +.Pa /usr/lib/debug +and are located automatically by +.Xr gdb 1 . .It Va WITHOUT_DICT .\" from FreeBSD: head/tools/build/options/WITHOUT_DICT 156932 2006-03-21 07:50:50Z ru Set to not build the Webster dictionary files. From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 22:01:07 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5421BEE0; Fri, 7 Jun 2013 22:01:07 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 366FE1790; Fri, 7 Jun 2013 22:01:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57M17N4077196; Fri, 7 Jun 2013 22:01:07 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57M16tc077192; Fri, 7 Jun 2013 22:01:06 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201306072201.r57M16tc077192@svn.freebsd.org> From: Andrew Turner Date: Fri, 7 Jun 2013 22:01:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251514 - head/lib/libc/arm/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 22:01:07 -0000 Author: andrew Date: Fri Jun 7 22:01:06 2013 New Revision: 251514 URL: http://svnweb.freebsd.org/changeset/base/251514 Log: Finish pulling in the NetBSD setjmp/longjmp updates on ARM. Store/restore the VFP registers in setjmp/longjmp on ARM EABI if VFP is enabled in the kernel. It checks the hw.floatingpoint sysctl to see if floating-point is available and uses this to determine if it should store them. If it does it uses a different magic value so longjmp is able to know if it should load them. Added: head/lib/libc/arm/gen/arm_initfini.c (contents, props changed) Modified: head/lib/libc/arm/gen/Makefile.inc head/lib/libc/arm/gen/_setjmp.S head/lib/libc/arm/gen/setjmp.S Modified: head/lib/libc/arm/gen/Makefile.inc ============================================================================== --- head/lib/libc/arm/gen/Makefile.inc Fri Jun 7 21:51:10 2013 (r251513) +++ head/lib/libc/arm/gen/Makefile.inc Fri Jun 7 22:01:06 2013 (r251514) @@ -3,7 +3,8 @@ SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \ getcontextx.c infinity.c ldexp.c makecontext.c \ - __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S flt_rounds.c + __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S flt_rounds.c \ + arm_initfini.c .if ${MK_ARM_EABI} == "no" SRCS+= divsi3.S Modified: head/lib/libc/arm/gen/_setjmp.S ============================================================================== --- head/lib/libc/arm/gen/_setjmp.S Fri Jun 7 21:51:10 2013 (r251513) +++ head/lib/libc/arm/gen/_setjmp.S Fri Jun 7 22:01:06 2013 (r251514) @@ -36,7 +36,7 @@ #error FPA is not supported anymore #endif -#ifdef __ARM_EABI__ +#if defined(__ARM_EABI__) && !defined(_STANDALONE) .fpu vfp #endif @@ -61,6 +61,26 @@ __FBSDID("$FreeBSD$"); ENTRY(_setjmp) ldr r1, .L_setjmp_magic +#if defined(__ARM_EABI__) && !defined(_STANDALONE) + ldr r2, .Lfpu_present +#ifdef PIC + GOT_INIT(r3, .L_setjmp_got, .L_setjmp_gotinit) + ldr r2, [r2, r3] +#else + ldr r2, [r2] +#endif + teq r2, #0 /* do we have a FPU? */ + beq 1f /* no, don't save VFP registers */ + + orr r1, r1, #(_JB_MAGIC__SETJMP ^ _JB_MAGIC__SETJMP_VFP) + /* change magic to VFP magic */ + add r2, r0, #(_JB_REG_D8 * 4) + vstmia r2, {d8-d15} + vmrs r2, fpscr + str r2, [r0, #(_JB_REG_FPSCR * 4)] +1: +#endif /* __ARM_EABI__ */ + str r1, [r0] add r0, r0, #(_JB_REG_R4 * 4) @@ -72,14 +92,31 @@ ENTRY(_setjmp) .L_setjmp_magic: .word _JB_MAGIC__SETJMP +#if defined(__ARM_EABI__) && !defined(_STANDALONE) + GOT_INITSYM(.L_setjmp_got, .L_setjmp_gotinit) +.Lfpu_present: + .word PIC_SYM(_libc_arm_fpu_present, GOTOFF) +#endif /* __ARM_EABI__ */ WEAK_ALIAS(___longjmp, _longjmp) ENTRY(_longjmp) ldr r2, [r0] /* get magic from jmp_buf */ + bic r3, r2, #(_JB_MAGIC__SETJMP ^ _JB_MAGIC__SETJMP_VFP) + /* ignore VFP-ness of magic */ ldr ip, .L_setjmp_magic /* load magic */ - teq ip, r2 /* magic correct? */ + teq ip, r3 /* magic correct? */ bne botch /* no, botch */ +#if defined(__ARM_EABI__) && !defined(_STANDALONE) + teq r3, r2 /* did magic change? */ + beq 1f /* no, don't restore VFP */ + add ip, r0, #(_JB_REG_D8 * 4) + vldmia ip, {d8-d15} + ldr ip, [r0, #(_JB_REG_FPSCR * 4)] + vmsr fpscr, ip +1: +#endif /* __ARM_EABI__ */ + add r0, r0, #(_JB_REG_R4 * 4) /* Restore integer registers */ ldmia r0, {r4-r14} Added: head/lib/libc/arm/gen/arm_initfini.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/arm/gen/arm_initfini.c Fri Jun 7 22:01:06 2013 (r251514) @@ -0,0 +1,78 @@ +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * Copyright (c) 2013 Andrew Turner + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Matt Thomas of 3am Software Foundry. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Bases on NetBSD lib/libc/arch/arm/misc/arm_initfini.c + * $NetBSD: arm_initfini.c,v 1.2 2013/01/31 06:47:55 matt Exp $ + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * To properly implement setjmp/longjmp for the ARM AAPCS ABI, it has to be + * aware of whether there is a FPU is present or not. Regardless of whether + * the hard-float ABI is being used, setjmp needs to save D8-D15. But it can + * only do this if those instructions won't cause an exception. + */ + +#include +#include + +#include +#include + +extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen); + +int _libc_arm_fpu_present; +static bool _libc_aapcs_initialized; + +void _libc_aapcs_init(void) __attribute__((__constructor__, __used__)); + +void +_libc_aapcs_init(void) +{ + int mib[2]; + size_t len; + + if (_libc_aapcs_initialized) + return; + + mib[0] = CTL_HW; + mib[1] = HW_FLOATINGPT; + + len = sizeof(_libc_arm_fpu_present); + if (__sysctl(mib, 2, &_libc_arm_fpu_present, &len, NULL, 0) == -1 || + len != sizeof(_libc_arm_fpu_present)) { + /* sysctl failed, assume no vfp */ + _libc_arm_fpu_present = 0; + } + + _libc_aapcs_initialized = true; +} Modified: head/lib/libc/arm/gen/setjmp.S ============================================================================== --- head/lib/libc/arm/gen/setjmp.S Fri Jun 7 21:51:10 2013 (r251513) +++ head/lib/libc/arm/gen/setjmp.S Fri Jun 7 22:01:06 2013 (r251514) @@ -36,6 +36,10 @@ #error FPA is not supported anymore #endif +#ifdef __ARM_EABI__ + .fpu vfp +#endif + #include #include @@ -61,6 +65,27 @@ ENTRY(setjmp) ldmfd sp!, {r0, r14} ldr r1, .Lsetjmp_magic + +#ifdef __ARM_EABI__ + ldr r2, .Lfpu_present +#ifdef PIC + GOT_INIT(r3, .Lsetjmp_got, .Lsetjmp_gotinit) + ldr r2, [r2, r3] +#else + ldr r2, [r2] +#endif + teq r2, #0 /* do we have a FPU? */ + beq 1f /* no, don't save VFP registers */ + + orr r1, r1, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP) + /* change magic to VFP magic */ + add r2, r0, #(_JB_REG_D8 * 4) + vstmia r2, {d8-d15} + vmrs r2, fpscr + str r2, [r0, #(_JB_REG_FPSCR * 4)] +1: +#endif /* __ARM_EABI__ */ + str r1, [r0] /* store magic */ /* Store integer registers */ @@ -71,6 +96,11 @@ ENTRY(setjmp) .Lsetjmp_magic: .word _JB_MAGIC_SETJMP +#ifdef __ARM_EABI__ + GOT_INITSYM(.Lsetjmp_got, .Lsetjmp_gotinit) +.Lfpu_present: + .word PIC_SYM(_libc_arm_fpu_present, GOTOFF) +#endif /* __ARM_EABI__ */ .weak _C_LABEL(longjmp) @@ -78,7 +108,8 @@ ENTRY(setjmp) ENTRY(__longjmp) ldr r2, [r0] ldr ip, .Lsetjmp_magic - teq r2, ip + bic r3, r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP) + teq r3, ip bne .Lbotch /* Restore the signal mask. */ @@ -89,6 +120,17 @@ ENTRY(__longjmp) bl PIC_SYM(_C_LABEL(sigprocmask), PLT) ldmfd sp!, {r0-r2, r14} +#ifdef __ARM_EABI__ + tst r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP) + /* is this a VFP magic? */ + beq 1f /* no, don't restore VFP */ + add ip, r0, #(_JB_REG_D8 * 4) + vldmia ip, {d8-d15} + ldr ip, [r0, #(_JB_REG_FPSCR * 4)] + vmsr fpscr, ip +1: +#endif /* __ARM_EABI__ */ + add r0, r0, #(_JB_REG_R4 * 4) /* Restore integer registers */ ldmia r0, {r4-r14} From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 22:35:59 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 31C458AE; Fri, 7 Jun 2013 22:35:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 13981189B; Fri, 7 Jun 2013 22:35:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r57MZwsP087227; Fri, 7 Jun 2013 22:35:58 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r57MZw03087226; Fri, 7 Jun 2013 22:35:58 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201306072235.r57MZw03087226@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 7 Jun 2013 22:35:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251515 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 22:35:59 -0000 Author: hselasky Date: Fri Jun 7 22:35:58 2013 New Revision: 251515 URL: http://svnweb.freebsd.org/changeset/base/251515 Log: Fix some recent regression issues: 1) Only multi-TD isochronous transfers should use NORMAL type after specific type as per XHCI specification. 2) BEI bit is only available in NORMAL and ISOCHRONOUS TRB types. Don't use this bit for other types to avoid hardware asserts. Reserved bits should be don't care though ... MFC after: 1 week PR: usb/179342 Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Fri Jun 7 22:01:06 2013 (r251514) +++ head/sys/dev/usb/controller/xhci.c Fri Jun 7 22:35:58 2013 (r251515) @@ -1561,6 +1561,7 @@ xhci_setup_generic_chain_sub(struct xhci struct xhci_td *td; struct xhci_td *td_next; struct xhci_td *td_alt_next; + struct xhci_td *td_first; uint32_t buf_offset; uint32_t average; uint32_t len_old; @@ -1569,7 +1570,6 @@ xhci_setup_generic_chain_sub(struct xhci uint8_t shortpkt_old; uint8_t precompute; uint8_t x; - uint8_t first_trb = 1; td_alt_next = NULL; buf_offset = 0; @@ -1581,7 +1581,7 @@ xhci_setup_generic_chain_sub(struct xhci restart: td = temp->td; - td_next = temp->td_next; + td_next = td_first = temp->td_next; while (1) { @@ -1717,48 +1717,55 @@ restart: td->td_trb[x].dwTrb2 = htole32(dword); - /* BEI: Interrupts are inhibited until EOT */ - dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | - XHCI_TRB_3_BEI_BIT | - XHCI_TRB_3_TBC_SET(temp->tbc) | - XHCI_TRB_3_TLBPC_SET(temp->tlbpc); - - if (first_trb != 0) { - first_trb = 0; - dword |= XHCI_TRB_3_TYPE_SET(temp->trb_type); - /* - * Remove cycle bit from the first TRB - * if we are stepping them: - */ - if (temp->step_td != 0) - dword &= ~XHCI_TRB_3_CYCLE_BIT; - } else { - dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL); - } - if (temp->trb_type == XHCI_TRB_TYPE_ISOCH) { - if (temp->do_isoc_sync != 0) { + switch (temp->trb_type) { + case XHCI_TRB_TYPE_ISOCH: + /* BEI: Interrupts are inhibited until EOT */ + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_BEI_BIT | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (td != td_first) { + dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL); + } else if (temp->do_isoc_sync != 0) { temp->do_isoc_sync = 0; - dword |= XHCI_TRB_3_FRID_SET(temp->isoc_frame / 8); + /* wait until "isoc_frame" */ + dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_ISOCH) | + XHCI_TRB_3_FRID_SET(temp->isoc_frame / 8); } else { - dword |= XHCI_TRB_3_ISO_SIA_BIT; + /* start data transfer at next interval */ + dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_ISOCH) | + XHCI_TRB_3_ISO_SIA_BIT; } + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN | XHCI_TRB_3_ISP_BIT; + break; + case XHCI_TRB_TYPE_DATA_STAGE: + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_DATA_STAGE) | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN | XHCI_TRB_3_ISP_BIT; + break; + case XHCI_TRB_TYPE_STATUS_STAGE: + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_STATUS_STAGE) | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN; + break; + default: /* XHCI_TRB_TYPE_NORMAL */ + /* BEI: Interrupts are inhibited until EOT */ + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL) | + XHCI_TRB_3_BEI_BIT | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN | XHCI_TRB_3_ISP_BIT; + break; } - if (temp->direction == UE_DIR_IN) { - dword |= XHCI_TRB_3_DIR_IN; - - /* - * NOTE: Only the SETUP stage should - * use the IDT bit. Else transactions - * can be sent using the wrong data - * toggle value. - */ - if (temp->trb_type != - XHCI_TRB_TYPE_SETUP_STAGE && - temp->trb_type != - XHCI_TRB_TYPE_STATUS_STAGE) - dword |= XHCI_TRB_3_ISP_BIT; - } - td->td_trb[x].dwTrb3 = htole32(dword); average -= buf_res.length; @@ -1793,10 +1800,8 @@ restart: td->td_trb[x].dwTrb2 = htole32(dword); - /* BEI: interrupts are inhibited until EOT */ dword = XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK) | - XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_IOC_BIT | - XHCI_TRB_3_BEI_BIT; + XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_IOC_BIT; td->td_trb[x].dwTrb3 = htole32(dword); @@ -1824,10 +1829,13 @@ restart: goto restart; } - /* need to force an interrupt if we are stepping the TRBs */ - if ((temp->direction & UE_DIR_IN) != 0 && temp->multishort == 0) { - /* make sure the last LINK event generates an interrupt */ - td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_BEI_BIT); + /* + * Remove cycle bit from the first TRB if we are + * stepping them: + */ + if (temp->step_td != 0) { + td_first->td_trb[0].dwTrb3 &= ~htole32(XHCI_TRB_3_CYCLE_BIT); + usb_pc_cpu_flush(td_first->page_cache); } /* remove chain bit because this is the last TRB in the chain */ From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 22:48:10 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A1829DD4 for ; Fri, 7 Jun 2013 22:48:10 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com [IPv6:2607:f8b0:400e:c03::231]) by mx1.freebsd.org (Postfix) with ESMTP id 7D29418F0 for ; Fri, 7 Jun 2013 22:48:10 +0000 (UTC) Received: by mail-pa0-f49.google.com with SMTP id ld11so57712pab.36 for ; Fri, 07 Jun 2013 15:48:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=tuZKMZdloe4FqeNkpJX/k60xiuu6fJyXDVVPJUyFhvA=; b=bvPsH5BVM9gwUlNcMIFnW90VyRdajJIjMP7Jr8+7BnNT4B2ZT0xU2u7L1ZvJjwiAUb JVZ/cREQ5ARS+gqHQYpUuo0YwIwmkTaqAWxqkS+htOqso6Gnig2zMA4ILOIGYcI99tvz JX1GXVJGUl7TA0UWwapRZ7EbhDwmTRcOJ/d64= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-gm-message-state; bh=tuZKMZdloe4FqeNkpJX/k60xiuu6fJyXDVVPJUyFhvA=; b=KGsAa99rPBLxi8KPJ0LRdvQeH7ezPTvXg4+YpI1Hl6YYLwvxzFbNw8UxTtjwmL3RYg 4pc1gur7vsBqIcVkQnEiqhG1ipHY+rgDF3aRePamra/+Cef5iFt4/5UuNbQyRDnLQmUz diUXOMyk2giUwawOk6xEQOA1rofK5z3SBzQ9rrqxqbLBM6RDehBArI0jusX2d561Om4F urtI56YfWwwPdyxQnJQXqyn39LEFszaMbt9yn/WrHgMjWvkIiKtASIn+HRsOVt3ED5Bn 72qy4WquGksNqlFhgfurRfsjTMVLnxA3L1VRF1uOvqLOtPKDq7VC+49OOm6SwdpKY2UC 3sSw== X-Received: by 10.68.171.36 with SMTP id ar4mr668824pbc.195.1370645290210; Fri, 07 Jun 2013 15:48:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.70.45.33 with HTTP; Fri, 7 Jun 2013 15:47:40 -0700 (PDT) In-Reply-To: <201306072021.r57KLUfD046462@svn.freebsd.org> References: <201306072021.r57KLUfD046462@svn.freebsd.org> From: Eitan Adler Date: Sat, 8 Jun 2013 00:47:40 +0200 Message-ID: Subject: Re: svn commit: r251507 - head/usr.sbin/portsnap/portsnap To: Xin LI Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQkC87M2syTG/czSK9tc9iZh6K4789SYcfLdksLyMig1XquWrPCm7A74cBZDsEcupPBI5q11 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 22:48:10 -0000 On 7 June 2013 22:21, Xin LI wrote: > Author: delphij > Date: Fri Jun 7 20:21:30 2013 > New Revision: 251507 > URL: http://svnweb.freebsd.org/changeset/base/251507 > > Log: > Make 'portsnap alfred' overwrite ports tree if it's not created by a > portsnap. FWIW, the 'alfred' command is poorly named and is used by other projects (ISTR portshaker uses it). It should also be documented. -- Eitan Adler From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 23:35:34 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B9D7561A; Fri, 7 Jun 2013 23:35:34 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (gw.catspoiler.org [75.1.14.242]) by mx1.freebsd.org (Postfix) with ESMTP id 9E6CD1A2D; Fri, 7 Jun 2013 23:35:34 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id r57NZN9H087680; Fri, 7 Jun 2013 16:35:27 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201306072335.r57NZN9H087680@gw.catspoiler.org> Date: Fri, 7 Jun 2013 16:35:23 -0700 (PDT) From: Don Lewis Subject: Re: svn commit: r251512 - in head: . etc etc/mtree gnu/usr.bin/gdb gnu/usr.bin/gdb/arch/amd64 gnu/usr.bin/gdb/arch/arm gnu/usr.bin/gdb/arch/i386 gnu/usr.bin/gdb/arch/ia64 gnu/usr.bin/gdb/arch/mips gnu/... To: emaste@FreeBSD.org In-Reply-To: <201306072140.r57Le2Ct069230@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 23:35:34 -0000 On 7 Jun, Ed Maste wrote: > Author: emaste > Date: Fri Jun 7 21:40:02 2013 > New Revision: 251512 > URL: http://svnweb.freebsd.org/changeset/base/251512 > > Log: > Add a new knob WITH_DEBUG_FILES to control the building of standalone > debug files for userland programs and libraries. The "-g" debug flag > is automatically applied when WITH_DEBUG_FILES is set. > > The debug files are now named ${prog}.debug and ${shlib}.debug for > consistency with other systems and documentation. In addition they are > installed under /usr/lib/debug, to simplify the process of installing > them if needed after a crash. Users of bsd.{prog,lib}.mk outside of the > base system place the standalone debug files in a .debug subdirectory. > GDB automatically searches both of these directories for standalone > debug files. Can the debug files be compressed so they don't take up as much room? It looks like gdb supports compressed symbol files. The same would be nice for /boot/kernel/*.symbols, btw ... From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 23:39:02 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 92F337BA; Fri, 7 Jun 2013 23:39:02 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from onyx.glenbarber.us (onyx.glenbarber.us [199.48.134.227]) by mx1.freebsd.org (Postfix) with ESMTP id 6FB7D1A3E; Fri, 7 Jun 2013 23:39:02 +0000 (UTC) Received: from glenbarber.us (kaos.glenbarber.us [71.224.221.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id 7AD8023F848; Fri, 7 Jun 2013 19:39:01 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.8.3 onyx.glenbarber.us 7AD8023F848 Authentication-Results: onyx.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Fri, 7 Jun 2013 19:38:59 -0400 From: Glen Barber To: Don Lewis Subject: Re: svn commit: r251512 - in head: . etc etc/mtree gnu/usr.bin/gdb gnu/usr.bin/gdb/arch/amd64 gnu/usr.bin/gdb/arch/arm gnu/usr.bin/gdb/arch/i386 gnu/usr.bin/gdb/arch/ia64 gnu/usr.bin/gdb/arch/mips gnu/... Message-ID: <20130607233859.GE1578@glenbarber.us> References: <201306072140.r57Le2Ct069230@svn.freebsd.org> <201306072335.r57NZN9H087680@gw.catspoiler.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="C94crkcyjafcjHxo" Content-Disposition: inline In-Reply-To: <201306072335.r57NZN9H087680@gw.catspoiler.org> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, emaste@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 23:39:02 -0000 --C94crkcyjafcjHxo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 07, 2013 at 04:35:23PM -0700, Don Lewis wrote: > On 7 Jun, Ed Maste wrote: > > Author: emaste > > Date: Fri Jun 7 21:40:02 2013 > > New Revision: 251512 > > URL: http://svnweb.freebsd.org/changeset/base/251512 > >=20 > > Log: > > Add a new knob WITH_DEBUG_FILES to control the building of standalone > > debug files for userland programs and libraries. The "-g" debug flag > > is automatically applied when WITH_DEBUG_FILES is set. > > =20 > > The debug files are now named ${prog}.debug and ${shlib}.debug for > > consistency with other systems and documentation. In addition they a= re > > installed under /usr/lib/debug, to simplify the process of installing > > them if needed after a crash. Users of bsd.{prog,lib}.mk outside of = the > > base system place the standalone debug files in a .debug subdirectory. > > GDB automatically searches both of these directories for standalone > > debug files. >=20 > Can the debug files be compressed so they don't take up as much room? It > looks like gdb supports compressed symbol files. The same would be nice > for /boot/kernel/*.symbols, btw ... >=20 I don't think compression will gain us much here. The difference of release medium size with WITH_DEBUG_FILES set versus without is ~2GB compared to ~750MB. On the release medium, the debug files are compressed with the base system with xz(1). Glen --C94crkcyjafcjHxo Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBCAAGBQJRsm8TAAoJEFJPDDeguUajr3YH/2GshRzKolYS5ARF/PJiUVBH cHwc93+TGGSML3jtcRIrBMoZk04UvpU9wxAUh84jhA5pbnVQiOBomCk5LQqguCpN h5c4x8Qy3Lp2jukqsbsZ7QRTFo9dMAr41gIpL5FN37du7hK9zs9Wxd3Md+VW6w25 fpm8NGRKlqVreWDmXfIf/NTRC2rnLigwXdYXqTpodP2NcE50MyxK0bKMGnqj7Vhf Ugz5pthYFjllJ3AI+RXa0IHOq1TF4EJptnuyPwy7CpWx3U4fU48EnaQZCX7XrbUs l8J2RNg8p3H5KMLj/IF+eIwnevAaP1GGS92j1qB+qoekfHinzz2XXIAHt/VBg+c= =L2H1 -----END PGP SIGNATURE----- --C94crkcyjafcjHxo-- From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 23:51:08 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AE6ECADD; Fri, 7 Jun 2013 23:51:08 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (gw.catspoiler.org [75.1.14.242]) by mx1.freebsd.org (Postfix) with ESMTP id 8E3A61A76; Fri, 7 Jun 2013 23:51:08 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id r57NowUR087706; Fri, 7 Jun 2013 16:51:02 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201306072351.r57NowUR087706@gw.catspoiler.org> Date: Fri, 7 Jun 2013 16:50:58 -0700 (PDT) From: Don Lewis Subject: Re: svn commit: r251512 - in head: . etc etc/mtree gnu/usr.bin/gdb gnu/usr.bin/gdb/arch/amd64 gnu/usr.bin/gdb/arch/arm gnu/usr.bin/gdb/arch/i386 gnu/usr.bin/gdb/arch/ia64 gnu/usr.bin/gdb/arch/mips gnu/... To: gjb@FreeBSD.org In-Reply-To: <20130607233859.GE1578@glenbarber.us> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, emaste@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 23:51:08 -0000 On 7 Jun, Glen Barber wrote: > On Fri, Jun 07, 2013 at 04:35:23PM -0700, Don Lewis wrote: >> On 7 Jun, Ed Maste wrote: >> > Author: emaste >> > Date: Fri Jun 7 21:40:02 2013 >> > New Revision: 251512 >> > URL: http://svnweb.freebsd.org/changeset/base/251512 >> > >> > Log: >> > Add a new knob WITH_DEBUG_FILES to control the building of standalone >> > debug files for userland programs and libraries. The "-g" debug flag >> > is automatically applied when WITH_DEBUG_FILES is set. >> > >> > The debug files are now named ${prog}.debug and ${shlib}.debug for >> > consistency with other systems and documentation. In addition they are >> > installed under /usr/lib/debug, to simplify the process of installing >> > them if needed after a crash. Users of bsd.{prog,lib}.mk outside of the >> > base system place the standalone debug files in a .debug subdirectory. >> > GDB automatically searches both of these directories for standalone >> > debug files. >> >> Can the debug files be compressed so they don't take up as much room? It >> looks like gdb supports compressed symbol files. The same would be nice >> for /boot/kernel/*.symbols, btw ... >> > > I don't think compression will gain us much here. The difference of > release medium size with WITH_DEBUG_FILES set versus without is ~2GB > compared to ~750MB. On the release medium, the debug files are > compressed with the base system with xz(1). I'm not concerned so much about the size of the release medium as I am about how much space this will take on my /usr partition. I still remember having to resize the root partitions on all my machines when the kernel symbols were added. My head machine also has a small drive with everything under / and space is very tight once all the ports are installed. From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 23:53:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0A592D0C; Fri, 7 Jun 2013 23:53:11 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-qe0-f42.google.com (mail-qe0-f42.google.com [209.85.128.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8EA9E1A91; Fri, 7 Jun 2013 23:53:10 +0000 (UTC) Received: by mail-qe0-f42.google.com with SMTP id s14so3154789qeb.29 for ; Fri, 07 Jun 2013 16:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=O0wfOVyPyGXkRFfv/Uo8owXhG/lR6qsssj4HpmtR9T8=; b=VCzJLB6Qpj1GX9SynIFEUce4HE8M7exLBSjJ6IL7mfvSv/XBZIGCubTXorY6Cm1Nxr CGl3hb9gOvSPZOD9H6X2e3qOzbzKrfrUFBGuX/LUgwPKfqHtyT9mSSg0s88UEk/Y3MzN n4gSmUzOy9mlvxZ/3TBwEwl18FlVxyazqoNWDz51W9QMoot/z7zydH0S4YHh9fd6NGQ6 kvT/RDPATSqyIFXKllQ/wPH/LxwQ0W7PcPBWBczgDAywW+CL3QP56GJY9x9pQW5DGODz A/EBpayUuMAxGMMTMkSs74FKHeTHrsgkK76JcdzAx0mJTL7/mOKy42bw/RdzTLcACeFZ CxtA== MIME-Version: 1.0 X-Received: by 10.224.45.132 with SMTP id e4mr5484461qaf.84.1370649184627; Fri, 07 Jun 2013 16:53:04 -0700 (PDT) Sender: carpeddiem@gmail.com Received: by 10.224.12.17 with HTTP; Fri, 7 Jun 2013 16:53:04 -0700 (PDT) In-Reply-To: <201306072335.r57NZN9H087680@gw.catspoiler.org> References: <201306072140.r57Le2Ct069230@svn.freebsd.org> <201306072335.r57NZN9H087680@gw.catspoiler.org> Date: Fri, 7 Jun 2013 19:53:04 -0400 X-Google-Sender-Auth: evOtq2MErQmUTKT0oNEZisUxgag Message-ID: Subject: Re: svn commit: r251512 - in head: . etc etc/mtree gnu/usr.bin/gdb gnu/usr.bin/gdb/arch/amd64 gnu/usr.bin/gdb/arch/arm gnu/usr.bin/gdb/arch/i386 gnu/usr.bin/gdb/arch/ia64 gnu/usr.bin/gdb/arch/mips gnu/... From: Ed Maste To: Don Lewis Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 23:53:11 -0000 On 7 June 2013 19:35, Don Lewis wrote: > Can the debug files be compressed so they don't take up as much room? It > looks like gdb supports compressed symbol files. The same would be nice > for /boot/kernel/*.symbols, btw ... Unfortunately our binutils is too old, so we're out of luck in the short term. This is most likely a project to undertake once we've migrated from binutils. From owner-svn-src-all@FreeBSD.ORG Fri Jun 7 23:59:18 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F1960ECD; Fri, 7 Jun 2013 23:59:17 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from onyx.glenbarber.us (onyx.glenbarber.us [199.48.134.227]) by mx1.freebsd.org (Postfix) with ESMTP id B8E981AB4; Fri, 7 Jun 2013 23:59:17 +0000 (UTC) Received: from glenbarber.us (kaos.glenbarber.us [71.224.221.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id B118723F848; Fri, 7 Jun 2013 19:59:13 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.8.3 onyx.glenbarber.us B118723F848 Authentication-Results: onyx.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Fri, 7 Jun 2013 19:59:11 -0400 From: Glen Barber To: Don Lewis Subject: Re: svn commit: r251512 - in head: . etc etc/mtree gnu/usr.bin/gdb gnu/usr.bin/gdb/arch/amd64 gnu/usr.bin/gdb/arch/arm gnu/usr.bin/gdb/arch/i386 gnu/usr.bin/gdb/arch/ia64 gnu/usr.bin/gdb/arch/mips gnu/... Message-ID: <20130607235911.GH1578@glenbarber.us> References: <20130607233859.GE1578@glenbarber.us> <201306072351.r57NowUR087706@gw.catspoiler.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="o71xDhNo7p97+qVi" Content-Disposition: inline In-Reply-To: <201306072351.r57NowUR087706@gw.catspoiler.org> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, emaste@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 23:59:18 -0000 --o71xDhNo7p97+qVi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 07, 2013 at 04:50:58PM -0700, Don Lewis wrote: > On 7 Jun, Glen Barber wrote: > > On Fri, Jun 07, 2013 at 04:35:23PM -0700, Don Lewis wrote: > >> On 7 Jun, Ed Maste wrote: > >> > Author: emaste > >> > Date: Fri Jun 7 21:40:02 2013 > >> > New Revision: 251512 > >> > URL: http://svnweb.freebsd.org/changeset/base/251512 > >> >=20 > >> > Log: > >> > Add a new knob WITH_DEBUG_FILES to control the building of standal= one > >> > debug files for userland programs and libraries. The "-g" debug f= lag > >> > is automatically applied when WITH_DEBUG_FILES is set. > >> > =20 > >> > The debug files are now named ${prog}.debug and ${shlib}.debug for > >> > consistency with other systems and documentation. In addition the= y are > >> > installed under /usr/lib/debug, to simplify the process of install= ing > >> > them if needed after a crash. Users of bsd.{prog,lib}.mk outside = of the > >> > base system place the standalone debug files in a .debug subdirect= ory. > >> > GDB automatically searches both of these directories for standalone > >> > debug files. > >>=20 > >> Can the debug files be compressed so they don't take up as much room? = It > >> looks like gdb supports compressed symbol files. The same would be ni= ce > >> for /boot/kernel/*.symbols, btw ... > >>=20 > >=20 > > I don't think compression will gain us much here. The difference of > > release medium size with WITH_DEBUG_FILES set versus without is ~2GB > > compared to ~750MB. On the release medium, the debug files are > > compressed with the base system with xz(1). >=20 > I'm not concerned so much about the size of the release medium as I am > about how much space this will take on my /usr partition. I still > remember having to resize the root partitions on all my machines when > the kernel symbols were added. My head machine also has a small drive > with everything under / and space is very tight once all the ports are > installed. >=20 Understood. I was just pointing out the significant size difference overall. Glen --o71xDhNo7p97+qVi Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBCAAGBQJRsnPPAAoJEFJPDDeguUajtA0H/3mBKbUq06JSTvg6F0fEjy+I KlJCJfzanMNiTt8/uBhjDiJ8TS9QxaeJTntoxrSP1Pk82BVy1aoWR9PBlLnkT0Ow cgYKSTAWAJ8WxsPoo6Ra38ggMsLZtvlQEMizC5wjbs67N3UAOSp52ttghvnNKniD WAi6tPvYs1/sHGQAjwm9QLUOOaPB52BbwF0f6t2P+kK05Bk6Pc+9eyv2IjNv7gW3 DB0Qp8EC6Xv49e0s3z8vqbVaKJ0pY/kjYHReSmvR7gIrGJsFdEgQYqq9pZv3ILFE nTZLZzu3CwDIajL0E6tmmpvpSJbCuR5MaoqmKCbJi+LSVxYRm34LceasirdB8J4= =jzUn -----END PGP SIGNATURE----- --o71xDhNo7p97+qVi-- From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 02:55:01 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 409ED446; Sat, 8 Jun 2013 02:55:01 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 322671ECA; Sat, 8 Jun 2013 02:55:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r582t1EW067515; Sat, 8 Jun 2013 02:55:01 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r582sxeS067431; Sat, 8 Jun 2013 02:54:59 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201306080254.r582sxeS067431@svn.freebsd.org> From: Sean Bruno Date: Sat, 8 Jun 2013 02:54:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251516 - in head: sys/dev/mfi usr.sbin/mfiutil X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 02:55:01 -0000 Author: sbruno Date: Sat Jun 8 02:54:59 2013 New Revision: 251516 URL: http://svnweb.freebsd.org/changeset/base/251516 Log: Implement foreign volume handling. Allows admins to view foreign metadata and clear or import it for use. PR: kern/172091 Submitted by: smh@freebsd.org Reviewed by: jhb@freebsd.org MFC after: 2 weeks Added: head/usr.sbin/mfiutil/mfi_foreign.c (contents, props changed) Modified: head/sys/dev/mfi/mfireg.h head/usr.sbin/mfiutil/Makefile head/usr.sbin/mfiutil/mfi_config.c head/usr.sbin/mfiutil/mfi_show.c head/usr.sbin/mfiutil/mfiutil.8 head/usr.sbin/mfiutil/mfiutil.c head/usr.sbin/mfiutil/mfiutil.h Modified: head/sys/dev/mfi/mfireg.h ============================================================================== --- head/sys/dev/mfi/mfireg.h Fri Jun 7 22:35:58 2013 (r251515) +++ head/sys/dev/mfi/mfireg.h Sat Jun 8 02:54:59 2013 (r251516) @@ -230,7 +230,11 @@ typedef enum { MFI_DCMD_CFG_CLEAR = 0x04030000, MFI_DCMD_CFG_MAKE_SPARE = 0x04040000, MFI_DCMD_CFG_REMOVE_SPARE = 0x04050000, + MFI_DCMD_CFG_FOREIGN_SCAN = 0x04060100, + MFI_DCMD_CFG_FOREIGN_DISPLAY = 0x04060200, + MFI_DCMD_CFG_FOREIGN_PREVIEW = 0x04060300, MFI_DCMD_CFG_FOREIGN_IMPORT = 0x04060400, + MFI_DCMD_CFG_FOREIGN_CLEAR = 0x04060500, MFI_DCMD_BBU_GET_STATUS = 0x05010000, MFI_DCMD_BBU_GET_CAPACITY_INFO =0x05020000, MFI_DCMD_BBU_GET_DESIGN_INFO = 0x05030000, Modified: head/usr.sbin/mfiutil/Makefile ============================================================================== --- head/usr.sbin/mfiutil/Makefile Fri Jun 7 22:35:58 2013 (r251515) +++ head/usr.sbin/mfiutil/Makefile Sat Jun 8 02:54:59 2013 (r251516) @@ -2,7 +2,7 @@ PROG= mfiutil SRCS= mfiutil.c mfi_bbu.c mfi_cmd.c mfi_config.c mfi_drive.c mfi_evt.c \ - mfi_flash.c mfi_patrol.c mfi_show.c mfi_volume.c + mfi_flash.c mfi_patrol.c mfi_show.c mfi_volume.c mfi_foreign.c MAN8= mfiutil.8 CFLAGS+= -fno-builtin-strftime Modified: head/usr.sbin/mfiutil/mfi_config.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_config.c Fri Jun 7 22:35:58 2013 (r251515) +++ head/usr.sbin/mfiutil/mfi_config.c Sat Jun 8 02:54:59 2013 (r251516) @@ -37,19 +37,13 @@ #include #include #include -#ifdef DEBUG #include -#endif #include #include #include #include #include "mfiutil.h" -#ifdef DEBUG -static void dump_config(int fd, struct mfi_config_data *config); -#endif - static int add_spare(int ac, char **av); static int remove_spare(int ac, char **av); @@ -81,9 +75,17 @@ dehumanize(const char *value) } return (iv); } + int mfi_config_read(int fd, struct mfi_config_data **configp) { + return mfi_config_read_opcode(fd, MFI_DCMD_CFG_READ, configp, NULL, 0); +} + +int +mfi_config_read_opcode(int fd, uint32_t opcode, struct mfi_config_data **configp, + uint8_t *mbox, size_t mboxlen) +{ struct mfi_config_data *config; uint32_t config_size; int error; @@ -98,8 +100,8 @@ fetch: config = reallocf(config, config_size); if (config == NULL) return (-1); - if (mfi_dcmd_command(fd, MFI_DCMD_CFG_READ, config, - config_size, NULL, 0, NULL) < 0) { + if (mfi_dcmd_command(fd, opcode, config, + config_size, mbox, mboxlen, NULL) < 0) { error = errno; free(config); errno = error; @@ -366,6 +368,13 @@ parse_array(int fd, int raid_type, char info->drives = NULL; return (EINVAL); } + + if (pinfo->state.ddf.v.pd_type.is_foreign) { + warnx("Drive %u is foreign", device_id); + free(info->drives); + info->drives = NULL; + return (EINVAL); + } } return (0); @@ -804,7 +813,7 @@ create_volume(int ac, char **av) #ifdef DEBUG if (dump) - dump_config(fd, config); + dump_config(fd, config, NULL); #endif /* Send the new config to the controller. */ @@ -1093,10 +1102,9 @@ remove_spare(int ac, char **av) } MFI_COMMAND(top, remove, remove_spare); -#ifdef DEBUG /* Display raw data about a config. */ -static void -dump_config(int fd, struct mfi_config_data *config) +void +dump_config(int fd, struct mfi_config_data *config, const char *msg_prefix) { struct mfi_array *ar; struct mfi_ld_config *ld; @@ -1106,9 +1114,12 @@ dump_config(int fd, struct mfi_config_da char *p; int i, j; + if (NULL == msg_prefix) + msg_prefix = "Configuration (Debug)"; + printf( - "mfi%d Configuration (Debug): %d arrays, %d volumes, %d spares\n", - mfi_unit, config->array_count, config->log_drv_count, + "mfi%d %s: %d arrays, %d volumes, %d spares\n", mfi_unit, + msg_prefix, config->array_count, config->log_drv_count, config->spares_count); printf(" array size: %u\n", config->array_size); printf(" volume size: %u\n", config->log_drv_size); @@ -1186,6 +1197,7 @@ dump_config(int fd, struct mfi_config_da } } +#ifdef DEBUG static int debug_config(int ac, char **av) { @@ -1213,7 +1225,7 @@ debug_config(int ac, char **av) } /* Dump out the configuration. */ - dump_config(fd, config); + dump_config(fd, config, NULL); free(config); close(fd); @@ -1265,7 +1277,7 @@ dump(int ac, char **av) close(fd); return (error); } - dump_config(fd, config); + dump_config(fd, config, NULL); free(config); close(fd); Added: head/usr.sbin/mfiutil/mfi_foreign.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mfiutil/mfi_foreign.c Sat Jun 8 02:54:59 2013 (r251516) @@ -0,0 +1,364 @@ +/* + * Copyright (c) 2013 smh@freebsd.org + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mfiutil.h" + +MFI_TABLE(top, foreign); + +static int +foreign_clear(__unused int ac, __unused char **av) +{ + int ch, error, fd; + + fd = mfi_open(mfi_unit, O_RDWR); + if (fd < 0) { + error = errno; + warn("mfi_open"); + return (error); + } + + printf( + "Are you sure you wish to clear ALL foreign configurations" + " on mfi%u? [y/N] ", mfi_unit); + + ch = getchar(); + if (ch != 'y' && ch != 'Y') { + printf("\nAborting\n"); + close(fd); + return (0); + } + + if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_CLEAR, NULL, 0, NULL, + 0, NULL) < 0) { + error = errno; + warn("Failed to clear foreign configuration"); + close(fd); + return (error); + } + + printf("mfi%d: Foreign configuration cleared\n", mfi_unit); + close(fd); + return (0); +} +MFI_COMMAND(foreign, clear, foreign_clear); + +static int +foreign_scan(__unused int ac, __unused char **av) +{ + struct mfi_foreign_scan_info info; + int error, fd; + + fd = mfi_open(mfi_unit, O_RDONLY); + if (fd < 0) { + error = errno; + warn("mfi_open"); + return (error); + } + + if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_SCAN, &info, + sizeof(info), NULL, 0, NULL) < 0) { + error = errno; + warn("Failed to scan foreign configuration"); + close(fd); + return (error); + } + + printf("mfi%d: Found %d foreign configurations\n", mfi_unit, + info.count); + close(fd); + return (0); +} +MFI_COMMAND(foreign, scan, foreign_scan); + +static int +foreign_show_cfg(int fd, uint32_t opcode, uint8_t cfgidx, int diagnostic) +{ + struct mfi_config_data *config; + char prefix[26]; + int error; + uint8_t mbox[4]; + + bzero(mbox, sizeof(mbox)); + mbox[0] = cfgidx; + if (mfi_config_read_opcode(fd, opcode, &config, mbox, sizeof(mbox)) < 0) { + error = errno; + warn("Failed to get foreign config %d", error); + close(fd); + return (error); + } + + if (opcode == MFI_DCMD_CFG_FOREIGN_PREVIEW) + sprintf(prefix, "Foreign configuration preview %d", cfgidx); + else + sprintf(prefix, "Foreign configuration %d", cfgidx); + /* + * MegaCli uses DCMD opcodes: 0x03100200 (which fails) followed by + * 0x1a721880 which returns what looks to be drive / volume info + * but we have no real information on what these are or what they do + * so we're currently relying solely on the config returned above + */ + if (diagnostic) + dump_config(fd, config, prefix); + else { + char *ld_list; + int i; + + ld_list = (char *)(config->array); + + printf("%s: %d arrays, %d volumes, %d spares\n", prefix, + config->array_count, config->log_drv_count, + config->spares_count); + + + for (i = 0; i < config->array_count; i++) + ld_list += config->array_size; + + for (i = 0; i < config->log_drv_count; i++) { + const char *level; + char size[6], stripe[5]; + struct mfi_ld_config *ld; + + ld = (struct mfi_ld_config *)ld_list; + + format_stripe(stripe, sizeof(stripe), + ld->params.stripe_size); + /* + * foreign configs don't seem to have a secondary raid level + * but, we can use span depth here as if a LD spans multiple + * arrays of disks (2 raid 1 sets for example), we will have an + * indication based on the spam depth. swb + */ + level = mfi_raid_level(ld->params.primary_raid_level, + (ld->params.span_depth - 1)); + + humanize_number(size, sizeof(size), ld->span[0].num_blocks * 512, + "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + + printf(" ID%d ", i); + printf("(%6s) %-8s |", + size, level); + printf("volume spans %d %s\n", ld->params.span_depth, + (ld->params.span_depth > 1) ? "arrays" : "array"); + for (int j = 0; j < ld->params.span_depth; j++) { + char *ar_list; + struct mfi_array *ar; + uint16_t device_id; + + printf(" array %u @ ", ld->span[j].array_ref); + humanize_number(size, sizeof(size), ld->span[j].num_blocks * 512, + "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + + printf("(%6s)\n",size); + ar_list = (char *)config->array + (ld->span[j].array_ref * config->array_size); + + ar = (struct mfi_array *)ar_list; + for (int k = 0; k < ar->num_drives; k++) { + device_id = ar->pd[k].ref.v.device_id; + if (device_id == 0xffff) + printf(" drive MISSING\n"); + else { + printf(" drive %u %s\n", device_id, + mfi_pdstate(ar->pd[k].fw_state)); + } + } + + } + ld_list += config->log_drv_size; + } + } + + free(config); + + return (0); +} + +int +display_format(int ac, char **av, int diagnostic, mfi_dcmd_t display_cmd) +{ + struct mfi_foreign_scan_info info; + uint8_t i; + int error, fd; + + if (ac > 2) { + warnx("foreign display: extra arguments"); + return (EINVAL); + } + + fd = mfi_open(mfi_unit, O_RDONLY); + if (fd < 0) { + error = errno; + warn("mfi_open"); + return (error); + } + + if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_SCAN, &info, + sizeof(info), NULL, 0, NULL) < 0) { + error = errno; + warn("Failed to scan foreign configuration"); + close(fd); + return (error); + } + + if (info.count == 0) { + warnx("foreign display: no foreign configs found"); + close(fd); + return (EINVAL); + } + + if (ac == 1) { + for (i = 0; i < info.count; i++) { + error = foreign_show_cfg(fd, + display_cmd, i, diagnostic); + if(error != 0) { + close(fd); + return (error); + } + if (i < info.count - 1) + printf("\n"); + } + } else if (ac == 2) { + error = foreign_show_cfg(fd, + display_cmd, atoi(av[1]), diagnostic); + if (error != 0) { + close(fd); + return (error); + } + } + + close(fd); + return (0); +} + +static int +foreign_display(int ac, char **av) +{ + return(display_format(ac, av, 1/*diagnostic output*/, MFI_DCMD_CFG_FOREIGN_DISPLAY)); +} +MFI_COMMAND(foreign, diag, foreign_display); + +static int +foreign_preview(int ac, char **av) +{ + return(display_format(ac, av, 1/*diagnostic output*/, MFI_DCMD_CFG_FOREIGN_PREVIEW)); +} +MFI_COMMAND(foreign, preview, foreign_preview); + +static int +foreign_import(int ac, char **av) +{ + struct mfi_foreign_scan_info info; + int ch, error, fd; + uint8_t cfgidx; + uint8_t mbox[4]; + + if (ac > 2) { + warnx("foreign preview: extra arguments"); + return (EINVAL); + } + + fd = mfi_open(mfi_unit, O_RDWR); + if (fd < 0) { + error = errno; + warn("mfi_open"); + return (error); + } + + if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_SCAN, &info, + sizeof(info), NULL, 0, NULL) < 0) { + error = errno; + warn("Failed to scan foreign configuration"); + close(fd); + return (error); + } + + if (info.count == 0) { + warnx("foreign import: no foreign configs found"); + close(fd); + return (EINVAL); + } + + if (ac == 1) { + cfgidx = 0xff; + printf("Are you sure you wish to import ALL foreign " + "configurations on mfi%u? [y/N] ", mfi_unit); + } else { + /* + * While this is docmmented for MegaCli this failed with + * exit code 0x03 on the test controller which was a Supermicro + * SMC2108 with firmware 12.12.0-0095 which is a LSI 2108 based + * controller. + */ + cfgidx = atoi(av[1]); + if (cfgidx >= info.count) { + warnx("Invalid foreign config %d specified max is %d", + cfgidx, info.count - 1); + close(fd); + return (EINVAL); + } + printf("Are you sure you wish to import the foreign " + "configuration %d on mfi%u? [y/N] ", cfgidx, mfi_unit); + } + + ch = getchar(); + if (ch != 'y' && ch != 'Y') { + printf("\nAborting\n"); + close(fd); + return (0); + } + + bzero(mbox, sizeof(mbox)); + mbox[0] = cfgidx; + if (mfi_dcmd_command(fd, MFI_DCMD_CFG_FOREIGN_IMPORT, NULL, 0, mbox, + sizeof(mbox), NULL) < 0) { + error = errno; + warn("Failed to import foreign configuration"); + close(fd); + return (error); + } + + if (ac == 1) + printf("mfi%d: All foreign configurations imported\n", + mfi_unit); + else + printf("mfi%d: Foreign configuration %d imported\n", mfi_unit, + cfgidx); + close(fd); + return (0); +} +MFI_COMMAND(foreign, import, foreign_import); Modified: head/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_show.c Fri Jun 7 22:35:58 2013 (r251515) +++ head/usr.sbin/mfiutil/mfi_show.c Sat Jun 8 02:54:59 2013 (r251516) @@ -40,9 +40,11 @@ #include #include "mfiutil.h" +static const char* foreign_state = " (FOREIGN)"; + MFI_TABLE(top, show); -static void +void format_stripe(char *buf, size_t buflen, uint8_t stripe) { @@ -291,7 +293,7 @@ show_battery(int ac, char **av __unused) } MFI_COMMAND(show, battery, show_battery); -static void +void print_ld(struct mfi_ld_info *info, int state_len) { struct mfi_ld_params *params = &info->ld_config.params; @@ -312,19 +314,24 @@ print_ld(struct mfi_ld_info *info, int s mfi_ldstate(params->state)); } -static void +void print_pd(struct mfi_pd_info *info, int state_len) { const char *s; - char buf[6]; + char buf[256]; humanize_number(buf, sizeof(buf), info->raw_size * 512, "", HN_AUTOSCALE, HN_B | HN_NOSPACE |HN_DECIMAL); printf("(%6s) ", buf); + if (info->state.ddf.v.pd_type.is_foreign) { + sprintf(buf, "%s%s", mfi_pdstate(info->fw_state), foreign_state); + s = buf; + } else + s = mfi_pdstate(info->fw_state); if (state_len > 0) - printf("%-*s", state_len, mfi_pdstate(info->fw_state)); + printf("%-*s", state_len, s); else - printf("%s", mfi_pdstate(info->fw_state)); + printf("%s",s); s = mfi_pd_inq_string(info); if (s != NULL) printf(" %s", s); @@ -560,6 +567,8 @@ show_drives(int ac, char **av __unused) goto error; } len = strlen(mfi_pdstate(info.fw_state)); + if (info.state.ddf.v.pd_type.is_foreign) + len += strlen(foreign_state); if (len > state_len) state_len = len; } @@ -757,7 +766,7 @@ show_progress(int ac, char **av __unused printf("drive %s ", mfi_drive_name(NULL, device_id, MFI_DNAME_DEVICE_ID|MFI_DNAME_HONOR_OPTS)); mfi_display_progress("Clear", &pinfo.prog_info.clear); - busy = 1; + } } @@ -770,3 +779,10 @@ show_progress(int ac, char **av __unused return (0); } MFI_COMMAND(show, progress, show_progress); + +static int +show_foreign(int ac, char **av) +{ + return(display_format(ac, av, 0/*normal display*/, MFI_DCMD_CFG_FOREIGN_DISPLAY)); +} +MFI_COMMAND(show, foreign, show_foreign); Modified: head/usr.sbin/mfiutil/mfiutil.8 ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.8 Fri Jun 7 22:35:58 2013 (r251515) +++ head/usr.sbin/mfiutil/mfiutil.8 Sat Jun 8 02:54:59 2013 (r251516) @@ -63,6 +63,9 @@ .Cm show firmware .Nm .Op Fl u Ar unit +.Cm show foreign Op Ar volume +.Nm +.Op Fl u Ar unit .Cm show logstate .Nm .Op Fl d @@ -140,6 +143,21 @@ .Cm patrol Ar command Op Ar interval Op Ar start .Nm .Op Fl u Ar unit +.Cm foreign scan +.Nm +.Op Fl u Ar unit +.Cm foreign clear Op Ar config +.Nm +.Op Fl u Ar unit +.Cm foreign diag Op Ar config +.Nm +.Op Fl u Ar unit +.Cm foreign preview Op Ar config +.Nm +.Op Fl u Ar unit +.Cm foreign import Op Ar config +.Nm +.Op Fl u Ar unit .Cm flash Ar file .Nm .Op Fl u Ar unit @@ -321,6 +339,8 @@ The entry in the event log corresponding .El .It Cm show firmware Lists all of the firmware images present on the controller. +.It Cm show foreign +Displays detected foreign configurations on disks for importation or removal. .It Cm show logstate Display the various sequence numbers associated with the event log. .It Cm show patrol @@ -567,6 +587,35 @@ Enable manual patrol reads that are only Start a patrol read operation. .It Cm stop patrol Stop a currently running patrol read operation. +.It Cm foreign scan +Scan for foreign configurations and display the number found. The +.Ar config +argument for the commands below takes the form of a number from 0 to the total +configurations found. +.It Cm foreign clear Op config +Clear the specifed foreign +.Ar config +or all if no +.Ar config +argument is provided. +.It Cm foreign diag Op config +Display a diagnostic display of the specifed foreign +.Ar config +or all if no +.Ar config +argument is provided. +.It Cm foreign preview Op config +Preview the specifed foreign +.Ar config +after import or all if no +.Ar config +argument is provided. +.It Cm foreign import Op config +Import the specifed foreign +.Ar config +or all if no +.Ar config +argument is provided. .It Cm flash Ar file Updates the flash on the controller with the firmware stored in .Ar file . @@ -634,6 +683,10 @@ Configure the adapter to run periodic pa patrol read starting in 5 minutes: .Pp .Dl Nm Cm patrol auto 604800 300 +.Pp +Display the second detected foreign configuration: +.Pp +.Dl Nm Cm show foreign 1 .Sh SEE ALSO .Xr mfi 4 .Sh HISTORY Modified: head/usr.sbin/mfiutil/mfiutil.c ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.c Fri Jun 7 22:35:58 2013 (r251515) +++ head/usr.sbin/mfiutil/mfiutil.c Sat Jun 8 02:54:59 2013 (r251516) @@ -60,6 +60,7 @@ usage(void) fprintf(stderr, " show drives - list physical drives\n"); fprintf(stderr, " show events - display event log\n"); fprintf(stderr, " show firmware - list firmware images\n"); + fprintf(stderr, " show foreign - display detected foreign volumes\n"); fprintf(stderr, " show logstate - display event log sequence numbers\n"); fprintf(stderr, " show volumes - list logical volumes\n"); fprintf(stderr, " show patrol - display patrol read status\n"); @@ -83,6 +84,11 @@ usage(void) fprintf(stderr, " patrol [interval [start]]\n"); fprintf(stderr, " start patrol - start a patrol read\n"); fprintf(stderr, " stop patrol - stop a patrol read\n"); + fprintf(stderr, " foreign scan - scan for foreign configurations\n"); + fprintf(stderr, " foreign clear [volume] - clear foreign configurations (default all)\n"); + fprintf(stderr, " foreign diag [volume] - diagnostic display foreign configurations (default all)\n"); + fprintf(stderr, " foreign preview [volume] - preview foreign configurations (default all)\n"); + fprintf(stderr, " foreign import [volume] - import foreign configurations (default all)\n"); fprintf(stderr, " flash \n"); fprintf(stderr, " start learn - start a BBU relearn\n"); fprintf(stderr, " bbu - set BBU properties\n"); Modified: head/usr.sbin/mfiutil/mfiutil.h ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.h Fri Jun 7 22:35:58 2013 (r251515) +++ head/usr.sbin/mfiutil/mfiutil.h Sat Jun 8 02:54:59 2013 (r251516) @@ -124,6 +124,16 @@ extern int mfi_unit; extern u_int mfi_opts; +/* We currently don't know the full details of the following struct */ +struct mfi_foreign_scan_cfg { + char data[24]; +}; + +struct mfi_foreign_scan_info { + uint32_t count; /* Number of foreign configs found */ + struct mfi_foreign_scan_cfg cfgs[8]; +}; + void mbox_store_ldref(uint8_t *mbox, union mfi_ld_ref *ref); void mbox_store_pdref(uint8_t *mbox, union mfi_pd_ref *ref); void mfi_display_progress(const char *label, struct mfi_progress *prog); @@ -136,6 +146,8 @@ const char *mfi_pd_inq_string(struct mfi const char *mfi_volume_name(int fd, uint8_t target_id); int mfi_volume_busy(int fd, uint8_t target_id); int mfi_config_read(int fd, struct mfi_config_data **configp); +int mfi_config_read_opcode(int fd, uint32_t opcode, + struct mfi_config_data **configp, uint8_t *mbox, size_t mboxlen); int mfi_lookup_drive(int fd, char *drive, uint16_t *device_id); int mfi_lookup_volume(int fd, const char *name, uint8_t *target_id); int mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize, @@ -152,6 +164,10 @@ int mfi_reconfig_supported(void); const char *mfi_status(u_int status_code); const char *mfi_drive_name(struct mfi_pd_info *pinfo, uint16_t device_id, uint32_t def); +void format_stripe(char *buf, size_t buflen, uint8_t stripe); +void print_ld(struct mfi_ld_info *info, int state_len); +void print_pd(struct mfi_pd_info *info, int state_len); +void dump_config(int fd, struct mfi_config_data *config, const char *msg_prefix); int mfi_bbu_get_props(int fd, struct mfi_bbu_properties *props, uint8_t *statusp); int mfi_bbu_set_props(int fd, struct mfi_bbu_properties *props, @@ -163,4 +179,5 @@ void mfi_autolearn_mode(uint8_t, char *, void scan_firmware(struct mfi_info_component *comp); void display_firmware(struct mfi_info_component *comp, const char *tag); +int display_format(int ac, char **av, int diagnostic, mfi_dcmd_t display_cmd); #endif /* !__MFIUTIL_H__ */ From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 07:16:23 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A9B91C58; Sat, 8 Jun 2013 07:16:23 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 82BE018B7; Sat, 8 Jun 2013 07:16:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r587GNHD048988; Sat, 8 Jun 2013 07:16:23 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r587GNs0048987; Sat, 8 Jun 2013 07:16:23 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201306080716.r587GNs0048987@svn.freebsd.org> From: Andrew Turner Date: Sat, 8 Jun 2013 07:16:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251517 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 07:16:23 -0000 Author: andrew Date: Sat Jun 8 07:16:22 2013 New Revision: 251517 URL: http://svnweb.freebsd.org/changeset/base/251517 Log: Merge in changes from NetBSD: * Remove support for non-elf files. * Add the VFP setjmp magic numbers. * Add the offsets for the VFP registers within the buffer. Modified: head/sys/arm/include/setjmp.h Modified: head/sys/arm/include/setjmp.h ============================================================================== --- head/sys/arm/include/setjmp.h Sat Jun 8 02:54:59 2013 (r251516) +++ head/sys/arm/include/setjmp.h Sat Jun 8 07:16:22 2013 (r251517) @@ -1,4 +1,4 @@ -/* $NetBSD: setjmp.h,v 1.2 2001/08/25 14:45:59 bjh21 Exp $ */ +/* $NetBSD: setjmp.h,v 1.5 2013/01/11 13:56:32 matt Exp $ */ /* $FreeBSD$ */ /* @@ -7,11 +7,8 @@ #ifndef _MACHINE_SETJMP_H_ #define _MACHINE_SETJMP_H_ -#ifdef __ELF__ + #define _JBLEN 64 /* size, in longs, of a jmp_buf */ -#else -#define _JBLEN 29 /* size, in longs, of a jmp_buf */ -#endif /* * NOTE: The internal structure of a jmp_buf is *PRIVATE* @@ -21,12 +18,8 @@ * * Description of the setjmp buffer * - * word 0 magic number (dependant on creator) - * 1 - 3 f4 fp register 4 - * 4 - 6 f5 fp register 5 - * 7 - 9 f6 fp register 6 - * 10 - 12 f7 fp register 7 - * 13 fpsr fp status register + * word 0 magic number (dependent on creator) + * 13 fpscr vfp status control register * 14 r4 register 4 * 15 r5 register 5 * 16 r6 register 6 @@ -38,10 +31,18 @@ * 22 r12 register 12 (ip) * 23 r13 register 13 (sp) * 24 r14 register 14 (lr) - * 25 signal mask (dependant on magic) + * 25 signal mask (dependent on magic) * 26 (con't) * 27 (con't) * 28 (con't) + * 32-33 d8 (vfp register d8) + * 34-35 d9 (vfp register d9) + * 36-37 d10 (vfp register d10) + * 38-39 d11 (vfp register d11) + * 40-41 d12 (vfp register d12) + * 42-43 d13 (vfp register d13) + * 44-45 d14 (vfp register d14) + * 46-47 d15 (vfp register d15) * * The magic number number identifies the jmp_buf and * how the buffer was created as well as providing @@ -63,15 +64,13 @@ #define _JB_MAGIC__SETJMP 0x4278f500 #define _JB_MAGIC_SETJMP 0x4278f501 +#define _JB_MAGIC__SETJMP_VFP 0x4278f502 +#define _JB_MAGIC_SETJMP_VFP 0x4278f503 /* Valid for all jmp_buf's */ #define _JB_MAGIC 0 -#define _JB_REG_F4 1 -#define _JB_REG_F5 4 -#define _JB_REG_F6 7 -#define _JB_REG_F7 10 -#define _JB_REG_FPSR 13 +#define _JB_REG_FPSCR 13 #define _JB_REG_R4 14 #define _JB_REG_R5 15 #define _JB_REG_R6 16 @@ -88,6 +87,15 @@ #define _JB_SIGMASK 25 +#define _JB_REG_D8 32 +#define _JB_REG_D9 34 +#define _JB_REG_D10 36 +#define _JB_REG_D11 38 +#define _JB_REG_D12 40 +#define _JB_REG_D13 42 +#define _JB_REG_D14 44 +#define _JB_REG_D15 46 + #ifndef __ASSEMBLER__ #if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE typedef struct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1]; From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 07:23:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4CBC1E39; Sat, 8 Jun 2013 07:23:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3E61018FB; Sat, 8 Jun 2013 07:23:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r587NQmg051656; Sat, 8 Jun 2013 07:23:26 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r587NQpx051654; Sat, 8 Jun 2013 07:23:26 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201306080723.r587NQpx051654@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 8 Jun 2013 07:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251518 - in head/sys/dev/cxgbe: . tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 07:23:27 -0000 Author: np Date: Sat Jun 8 07:23:26 2013 New Revision: 251518 URL: http://svnweb.freebsd.org/changeset/base/251518 Log: cxgbe/tom: Fix bad signed/unsigned mixup in the stid allocator. This fixes a panic when allocating a mixture of IPv6 and IPv4 stids. MFC after: 1 week Modified: head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/offload.h ============================================================================== --- head/sys/dev/cxgbe/offload.h Sat Jun 8 07:16:22 2013 (r251517) +++ head/sys/dev/cxgbe/offload.h Sat Jun 8 07:23:26 2013 (r251518) @@ -59,8 +59,8 @@ struct listen_ctx; struct stid_region { TAILQ_ENTRY(stid_region) link; - int used; /* # of stids used by this region */ - int free; /* # of contiguous stids free right after this region */ + u_int used; /* # of stids used by this region */ + u_int free; /* # of contiguous stids free right after this region */ }; /* Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Sat Jun 8 07:16:22 2013 (r251517) +++ head/sys/dev/cxgbe/tom/t4_listen.c Sat Jun 8 07:23:26 2013 (r251518) @@ -125,7 +125,7 @@ alloc_stid(struct adapter *sc, struct li TAILQ_FOREACH(s, &t->stids, link) { stid += s->used + s->free; f = stid & mask; - if (n <= s->free - f) { + if (s->free >= n + f) { stid -= n + f; s->free -= n + f; TAILQ_INSERT_AFTER(&t->stids, s, sr, link); From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 08:51:23 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AF36370F; Sat, 8 Jun 2013 08:51:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 916FF1B26; Sat, 8 Jun 2013 08:51:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r588pNGx078576; Sat, 8 Jun 2013 08:51:23 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r588pNxa078573; Sat, 8 Jun 2013 08:51:23 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306080851.r588pNxa078573@svn.freebsd.org> From: Xin LI Date: Sat, 8 Jun 2013 08:51:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r251519 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 08:51:23 -0000 Author: delphij Date: Sat Jun 8 08:51:22 2013 New Revision: 251519 URL: http://svnweb.freebsd.org/changeset/base/251519 Log: Update vendor-sys/illumos/dist to illumos-gate 14041:cb4a51285eeb Illumos ZFS issues: 3805 arc shouldn't cache freed blocks Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Sat Jun 8 07:23:26 2013 (r251518) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Sat Jun 8 08:51:22 2013 (r251519) @@ -3111,6 +3111,34 @@ arc_set_callback(arc_buf_t *buf, arc_evi } /* + * Notify the arc that a block was freed, and thus will never be used again. + */ +void +arc_freed(spa_t *spa, const blkptr_t *bp) +{ + arc_buf_hdr_t *hdr; + kmutex_t *hash_lock; + uint64_t guid = spa_load_guid(spa); + + hdr = buf_hash_find(guid, BP_IDENTITY(bp), BP_PHYSICAL_BIRTH(bp), + &hash_lock); + if (hdr == NULL) + return; + if (HDR_BUF_AVAILABLE(hdr)) { + arc_buf_t *buf = hdr->b_buf; + add_reference(hdr, hash_lock, FTAG); + hdr->b_flags &= ~ARC_BUF_AVAILABLE; + mutex_exit(hash_lock); + + arc_release(buf, FTAG); + (void) arc_buf_remove_ref(buf, FTAG); + } else { + mutex_exit(hash_lock); + } + +} + +/* * This is used by the DMU to let the ARC know that a buffer is * being evicted, so the ARC should clean up. If this arc buf * is not yet in the evicted state, it will be put there. Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h Sat Jun 8 07:23:26 2013 (r251518) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h Sat Jun 8 08:51:22 2013 (r251519) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -110,6 +110,7 @@ zio_t *arc_write(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *done, void *private, int priority, int zio_flags, const zbookmark_t *zb); +void arc_freed(spa_t *spa, const blkptr_t *bp); void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *private); int arc_buf_evict(arc_buf_t *buf); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Sat Jun 8 07:23:26 2013 (r251518) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Sat Jun 8 08:51:22 2013 (r251519) @@ -715,6 +715,7 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui ASSERT(spa_sync_pass(spa) < zfs_sync_pass_deferred_free); metaslab_check_free(spa, bp); + arc_freed(spa, bp); zio = zio_create(pio, spa, txg, bp, NULL, BP_GET_PSIZE(bp), NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_FREE, flags, From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 09:11:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 81CF9A00; Sat, 8 Jun 2013 09:11:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 636881BD1; Sat, 8 Jun 2013 09:11:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r589BL45084893; Sat, 8 Jun 2013 09:11:21 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r589BKJe084890; Sat, 8 Jun 2013 09:11:20 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306080911.r589BKJe084890@svn.freebsd.org> From: Xin LI Date: Sat, 8 Jun 2013 09:11:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251520 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 09:11:21 -0000 Author: delphij Date: Sat Jun 8 09:11:20 2013 New Revision: 251520 URL: http://svnweb.freebsd.org/changeset/base/251520 Log: MFV r251519: * Illumos ZFS issue #3805 arc shouldn't cache freed blocks Quote from the Illumos issue: ZFS should proactively evict freed blocks from the cache. Even though these freed blocks will never be used again, and thus will eventually be evicted, this causes us to use memory inefficiently for 2 reasons: 1. A block that is freed has no chance of being accessed again, but will be kept in memory preferentially to a block that was accessed before it (and is thus older) but has not been freed and thus has at least some chance of being accessed again. 2. We partition the ARC into several buckets: user data that has been accessed only once (MRU) metadata that has been accessed only once (MRU) user data that has been accessed more than once (MFU) metadata that has been accessed more than once (MFU) The user data vs metadata split is somewhat arbitrary, and the primary control on how much memory is used to cache data vs metadata is to simply try to keep the proportion the same as it has been in the past (each bucket "evicts against" itself). The secondary control is to evict data before evicting metadata. Because of this bucketing, we may end up with one bucket mostly containing freed blocks that are very old, while another bucket has more recently accessed, still-allocated blocks. Data in the useful bucket (with still-allocated blocks) may be evicted in preference to data in the useless bucket (with old, freed blocks). On dcenter, we saw that the MFU metadata bucket was 230MB, while the MFU data bucket was 27GB and the MRU metadata bucket was 256GB. However, the vast majority of data in the MRU metadata bucket (256GB) was freed blocks, and thus useless. Meanwhile, the MFU metadata bucket (230MB) was constantly evicting useful blocks that will be soon needed. The problem of cache segmentation is a larger problem that needs more investigation. However, if we stop caching freed blocks, it should reduce the impact of this more fundamental issue. MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Jun 8 08:51:22 2013 (r251519) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Jun 8 09:11:20 2013 (r251520) @@ -3372,6 +3372,34 @@ arc_set_callback(arc_buf_t *buf, arc_evi } /* + * Notify the arc that a block was freed, and thus will never be used again. + */ +void +arc_freed(spa_t *spa, const blkptr_t *bp) +{ + arc_buf_hdr_t *hdr; + kmutex_t *hash_lock; + uint64_t guid = spa_load_guid(spa); + + hdr = buf_hash_find(guid, BP_IDENTITY(bp), BP_PHYSICAL_BIRTH(bp), + &hash_lock); + if (hdr == NULL) + return; + if (HDR_BUF_AVAILABLE(hdr)) { + arc_buf_t *buf = hdr->b_buf; + add_reference(hdr, hash_lock, FTAG); + hdr->b_flags &= ~ARC_BUF_AVAILABLE; + mutex_exit(hash_lock); + + arc_release(buf, FTAG); + (void) arc_buf_remove_ref(buf, FTAG); + } else { + mutex_exit(hash_lock); + } + +} + +/* * This is used by the DMU to let the ARC know that a buffer is * being evicted, so the ARC should clean up. If this arc buf * is not yet in the evicted state, it will be put there. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sat Jun 8 08:51:22 2013 (r251519) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sat Jun 8 09:11:20 2013 (r251520) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -110,6 +110,7 @@ zio_t *arc_write(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *done, void *priv, int priority, int zio_flags, const zbookmark_t *zb); +void arc_freed(spa_t *spa, const blkptr_t *bp); void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *priv); int arc_buf_evict(arc_buf_t *buf); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Jun 8 08:51:22 2013 (r251519) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Jun 8 09:11:20 2013 (r251520) @@ -780,6 +780,7 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui ASSERT(spa_sync_pass(spa) < zfs_sync_pass_deferred_free); metaslab_check_free(spa, bp); + arc_freed(spa, bp); zio = zio_create(pio, spa, txg, bp, NULL, size, NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_FREE, flags, From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 12:10:53 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 890B3686; Sat, 8 Jun 2013 12:10:53 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7ADC91161; Sat, 8 Jun 2013 12:10:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58CAr6i040628; Sat, 8 Jun 2013 12:10:53 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58CArET040626; Sat, 8 Jun 2013 12:10:53 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306081210.r58CArET040626@svn.freebsd.org> From: Hiroki Sato Date: Sat, 8 Jun 2013 12:10:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251521 - stable/8/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 12:10:53 -0000 Author: hrs Date: Sat Jun 8 12:10:52 2013 New Revision: 251521 URL: http://svnweb.freebsd.org/changeset/base/251521 Log: Document that CVS repository is no longer supported. Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sat Jun 8 09:11:20 2013 (r251520) +++ stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sat Jun 8 12:10:52 2013 (r251521) @@ -206,6 +206,20 @@ Open Issues + [20130608] &os; &release; no longer supports &os; CVS + repository. Some documents mistakenly refer to + RELEASE_8_4_0 as CVS tag for the release and + RELENG_8_4 as CVS branch tag for the + &release; security branch. However, &os; Project no longer + supports &os; CVS repository and &release; has been released by + using &os; subversion repository instead. + RELENG_8_4 corresponds to + svn://svn.FreeBSD.org/base/releng/8.4, and + RELEASE_8_4_0 corresponds to + svn://svn.FreeBSD.org/base/release/8.4.0. + Please note that &os; source tree for &release; and its security + branch cannot be updated by using official CVSup servers. + [20130607] The &man.bge.4; network interface driver has an issue when TSO (TCP Segmentation Offload) is enabled. It causes intermittent reset and re-initialization. From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 13:02:43 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E2BAA26B; Sat, 8 Jun 2013 13:02:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D2B0A1382; Sat, 8 Jun 2013 13:02:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58D2h6X056636; Sat, 8 Jun 2013 13:02:43 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58D2hvh056635; Sat, 8 Jun 2013 13:02:43 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306081302.r58D2hvh056635@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 8 Jun 2013 13:02:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251522 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 13:02:44 -0000 Author: glebius Date: Sat Jun 8 13:02:43 2013 New Revision: 251522 URL: http://svnweb.freebsd.org/changeset/base/251522 Log: Separate LIO_SYNC processing into a separate function aio_process_sync(), and rename aio_process() into aio_process_rw(). Reviewed by: kib Sponsored by: Nginx, Inc. Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Sat Jun 8 12:10:52 2013 (r251521) +++ head/sys/kern/vfs_aio.c Sat Jun 8 13:02:43 2013 (r251522) @@ -338,7 +338,8 @@ static struct unrhdr *aiod_unr; void aio_init_aioinfo(struct proc *p); static int aio_onceonly(void); static int aio_free_entry(struct aiocblist *aiocbe); -static void aio_process(struct aiocblist *aiocbe); +static void aio_process_rw(struct aiocblist *aiocbe); +static void aio_process_sync(struct aiocblist *aiocbe); static int aio_newproc(int *); int aio_aqueue(struct thread *td, struct aiocb *job, struct aioliojob *lio, int type, struct aiocb_ops *ops); @@ -855,15 +856,15 @@ drop: } /* - * The AIO processing activity. This is the code that does the I/O request for - * the non-physio version of the operations. The normal vn operations are used, - * and this code should work in all instances for every type of file, including - * pipes, sockets, fifos, and regular files. + * The AIO processing activity for LIO_READ/LIO_WRITE. This is the code that + * does the I/O request for the non-physio version of the operations. The + * normal vn operations are used, and this code should work in all instances + * for every type of file, including pipes, sockets, fifos, and regular files. * * XXX I don't think it works well for socket, pipe, and fifo. */ static void -aio_process(struct aiocblist *aiocbe) +aio_process_rw(struct aiocblist *aiocbe) { struct ucred *td_savedcred; struct thread *td; @@ -877,23 +878,16 @@ aio_process(struct aiocblist *aiocbe) int oublock_st, oublock_end; int inblock_st, inblock_end; + KASSERT(aiocbe->uaiocb.aio_lio_opcode == LIO_READ || + aiocbe->uaiocb.aio_lio_opcode == LIO_WRITE, + ("%s: opcode %d", __func__, aiocbe->uaiocb.aio_lio_opcode)); + td = curthread; td_savedcred = td->td_ucred; td->td_ucred = aiocbe->cred; cb = &aiocbe->uaiocb; fp = aiocbe->fd_file; - if (cb->aio_lio_opcode == LIO_SYNC) { - error = 0; - cnt = 0; - if (fp->f_vnode != NULL) - error = aio_fsync_vnode(td, fp->f_vnode); - cb->_aiocb_private.error = error; - cb->_aiocb_private.status = 0; - td->td_ucred = td_savedcred; - return; - } - aiov.iov_base = (void *)(uintptr_t)cb->aio_buf; aiov.iov_len = cb->aio_nbytes; @@ -954,6 +948,26 @@ aio_process(struct aiocblist *aiocbe) } static void +aio_process_sync(struct aiocblist *aiocbe) +{ + struct thread *td = curthread; + struct ucred *td_savedcred = td->td_ucred; + struct aiocb *cb = &aiocbe->uaiocb; + struct file *fp = aiocbe->fd_file; + int error = 0; + + KASSERT(aiocbe->uaiocb.aio_lio_opcode == LIO_SYNC, + ("%s: opcode %d", __func__, aiocbe->uaiocb.aio_lio_opcode)); + + td->td_ucred = aiocbe->cred; + if (fp->f_vnode != NULL) + error = aio_fsync_vnode(td, fp->f_vnode); + cb->_aiocb_private.error = error; + cb->_aiocb_private.status = 0; + td->td_ucred = td_savedcred; +} + +static void aio_bio_done_notify(struct proc *userp, struct aiocblist *aiocbe, int type) { struct aioliojob *lj; @@ -1024,7 +1038,7 @@ notification_done: } /* - * The AIO daemon, most of the actual work is done in aio_process, + * The AIO daemon, most of the actual work is done in aio_process_*, * but the setup (and address space mgmt) is done in this routine. */ static void @@ -1121,7 +1135,15 @@ aio_daemon(void *_id) ki = userp->p_aioinfo; /* Do the I/O function. */ - aio_process(aiocbe); + switch(aiocbe->uaiocb.aio_lio_opcode) { + case LIO_READ: + case LIO_WRITE: + aio_process_rw(aiocbe); + break; + case LIO_SYNC: + aio_process_sync(aiocbe); + break; + } mtx_lock(&aio_job_mtx); /* Decrement the active job count. */ From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 13:13:41 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BEF6762B; Sat, 8 Jun 2013 13:13:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 964461453; Sat, 8 Jun 2013 13:13:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58DDf6v060223; Sat, 8 Jun 2013 13:13:41 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58DDfZt060221; Sat, 8 Jun 2013 13:13:41 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306081313.r58DDfZt060221@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 8 Jun 2013 13:13:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251523 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 13:13:41 -0000 Author: glebius Date: Sat Jun 8 13:13:40 2013 New Revision: 251523 URL: http://svnweb.freebsd.org/changeset/base/251523 Log: Make sys_mlock() function just a wrapper around vm_mlock() function that does all the job. Reviewed by: kib, jilles Sponsored by: Nginx, Inc. Modified: head/sys/vm/vm_extern.h head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_extern.h ============================================================================== --- head/sys/vm/vm_extern.h Sat Jun 8 13:02:43 2013 (r251522) +++ head/sys/vm/vm_extern.h Sat Jun 8 13:13:40 2013 (r251523) @@ -90,5 +90,6 @@ struct sf_buf *vm_imgact_map_page(vm_obj void vm_imgact_unmap_page(struct sf_buf *sf); void vm_thread_dispose(struct thread *td); int vm_thread_new(struct thread *td, int pages); +int vm_mlock(struct proc *, struct ucred *, const void *, size_t); #endif /* _KERNEL */ #endif /* !_VM_EXTERN_H_ */ Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Sat Jun 8 13:02:43 2013 (r251522) +++ head/sys/vm/vm_mmap.c Sat Jun 8 13:13:40 2013 (r251523) @@ -1036,18 +1036,24 @@ sys_mlock(td, uap) struct thread *td; struct mlock_args *uap; { - struct proc *proc; + + return (vm_mlock(td->td_proc, td->td_ucred, uap->addr, uap->len)); +} + +int +vm_mlock(struct proc *proc, struct ucred *cred, const void *addr0, size_t len) +{ vm_offset_t addr, end, last, start; vm_size_t npages, size; vm_map_t map; unsigned long nsize; int error; - error = priv_check(td, PRIV_VM_MLOCK); + error = priv_check_cred(cred, PRIV_VM_MLOCK, 0); if (error) return (error); - addr = (vm_offset_t)uap->addr; - size = uap->len; + addr = (vm_offset_t)addr0; + size = len; last = addr + size; start = trunc_page(addr); end = round_page(last); @@ -1056,7 +1062,6 @@ sys_mlock(td, uap) npages = atop(end - start); if (npages > vm_page_max_wired) return (ENOMEM); - proc = td->td_proc; map = &proc->p_vmspace->vm_map; PROC_LOCK(proc); nsize = ptoa(npages + pmap_wired_count(map->pmap)); From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 13:19:12 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 09AAF8D2; Sat, 8 Jun 2013 13:19:12 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E030B148D; Sat, 8 Jun 2013 13:19:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58DJBDF061188; Sat, 8 Jun 2013 13:19:11 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58DJBS0061186; Sat, 8 Jun 2013 13:19:11 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201306081319.r58DJBS0061186@svn.freebsd.org> From: Ed Schouten Date: Sat, 8 Jun 2013 13:19:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251524 - in head/sys: conf mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 13:19:12 -0000 Author: ed Date: Sat Jun 8 13:19:11 2013 New Revision: 251524 URL: http://svnweb.freebsd.org/changeset/base/251524 Log: Add proper __sync_*() intrinsics for MIPS. To make work on MIPS (and ARM) using GCC, we need to provide implementations of the __sync_*() functions. I already added these functions for 4 and 8 byte types to libcompiler-rt some time ago, based on top of . Unfortunately, only provides a subset of the features needed to implement . This means that in some cases we had to do compare-and-exchange calls in loops, where a simple ll/sc would suffice. Also implement these functions for 1 and 2 byte types. MIPS only provides ll/sc instructions for 4 and 8 byte types, but this is of course no limitation. We can simply load 4 bytes and use some bitmask tricks to modify only the bytes affected. Discussed on: mips, arch Tested with: QEMU Added: head/sys/mips/mips/stdatomic.c (contents, props changed) Modified: head/sys/conf/files.mips Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Sat Jun 8 13:13:40 2013 (r251523) +++ head/sys/conf/files.mips Sat Jun 8 13:19:11 2013 (r251524) @@ -35,6 +35,8 @@ mips/mips/pmap.c standard mips/mips/ptrace_machdep.c standard mips/mips/sc_machdep.c standard mips/mips/stack_machdep.c optional ddb | stack +mips/mips/stdatomic.c standard \ + compile-with "${NORMAL_C:N-Wmissing-prototypes}" mips/mips/support.S standard mips/mips/swtch.S standard mips/mips/sys_machdep.c standard Added: head/sys/mips/mips/stdatomic.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mips/stdatomic.c Sat Jun 8 13:19:11 2013 (r251524) @@ -0,0 +1,436 @@ +/*- + * Copyright (c) 2013 Ed Schouten + * All rights reserved. + * + * Copyright (c) 1998 Doug Rabson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#ifdef _KERNEL +#include "opt_global.h" +#endif + +/* + * Memory barriers. + * + * It turns out __sync_synchronize() does not emit any code when used + * with GCC 4.2. Implement our own version that does work reliably. + * + * Although __sync_lock_test_and_set() should only perform an acquire + * barrier, make it do a full barrier like the other functions. This + * should make 's atomic_exchange_explicit() work reliably. + */ + +static inline void +mips_sync(void) +{ + + __asm volatile ( +#if !defined(_KERNEL) || defined(SMP) + ".set noreorder\n" + "\tsync\n" + "\tnop\n" + "\tnop\n" + "\tnop\n" + "\tnop\n" + "\tnop\n" + "\tnop\n" + "\tnop\n" + "\tnop\n" + ".set reorder\n" +#else /* _KERNEL && !SMP */ + "" +#endif /* !KERNEL || SMP */ + : : : "memory"); +} + +typedef union { + uint8_t v8[4]; + uint16_t v16[2]; + uint32_t v32; +} reg_t; + +/* + * 8-bit routines. + */ + +uint8_t +__sync_lock_test_and_set_1(uint8_t *mem8, uint8_t val8) +{ + uint32_t *mem32; + reg_t val32, negmask32, old; + uint32_t temp; + + mem32 = (uint32_t *)((intptr_t)mem8 & ~3); + val32.v32 = 0x00000000; + val32.v8[(intptr_t)mem8 & 3] = val8; + negmask32.v32 = 0xffffffff; + negmask32.v8[(intptr_t)mem8 & 3] = 0x00; + + mips_sync(); + __asm volatile ( + "1:" + "\tll %0, %5\n" /* Load old value. */ + "\tand %2, %4, %0\n" /* Trim out affected part. */ + "\tor %2, %3\n" /* Put in the new value. */ + "\tsc %2, %1\n" /* Attempt to store. */ + "\tbeqz %2, 1b\n" /* Spin if failed. */ + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) + : "r" (val32.v32), "r" (negmask32.v32), "m" (*mem32)); + return (old.v8[(intptr_t)mem8 & 3]); +} + +uint8_t +__sync_val_compare_and_swap_1(uint8_t *mem8, uint8_t expected, uint8_t desired) +{ + uint32_t *mem32; + reg_t expected32, desired32, posmask32, negmask32, old; + uint32_t temp; + + mem32 = (uint32_t *)((intptr_t)mem8 & ~3); + expected32.v32 = 0x00000000; + expected32.v8[(intptr_t)mem8 & 3] = expected; + desired32.v32 = 0x00000000; + desired32.v8[(intptr_t)mem8 & 3] = desired; + posmask32.v32 = 0x00000000; + posmask32.v8[(intptr_t)mem8 & 3] = 0xff; + negmask32.v32 = ~posmask32.v32; + + mips_sync(); + __asm volatile ( + "1:" + "\tll %0, %7\n" /* Load old value. */ + "\tand %2, %5, %0\n" /* Isolate affected part. */ + "\tbne %2, %3, 2f\n" /* Compare to expected value. */ + "\tand %2, %6, %0\n" /* Trim out affected part. */ + "\tor %2, %4\n" /* Put in the new value. */ + "\tsc %2, %1\n" /* Attempt to store. */ + "\tbeqz %2, 1b\n" /* Spin if failed. */ + "2:" + : "=&r" (old), "=m" (*mem32), "=&r" (temp) + : "r" (expected32.v32), "r" (desired32.v32), + "r" (posmask32.v32), "r" (negmask32.v32), "m" (*mem32)); + return (old.v8[(intptr_t)mem8 & 3]); +} + +#define EMIT_ARITHMETIC_FETCH_AND_OP_1(name, op) \ +uint8_t \ +__sync_##name##_1(uint8_t *mem8, uint8_t val8) \ +{ \ + uint32_t *mem32; \ + reg_t val32, posmask32, negmask32, old; \ + uint32_t temp1, temp2; \ + \ + mem32 = (uint32_t *)((intptr_t)mem8 & ~3); \ + val32.v32 = 0x00000000; \ + val32.v8[(intptr_t)mem8 & 3] = val8; \ + posmask32.v32 = 0x00000000; \ + posmask32.v8[(intptr_t)mem8 & 3] = 0xff; \ + negmask32.v32 = ~posmask32.v32; \ + \ + mips_sync(); \ + __asm volatile ( \ + "1:" \ + "\tll %0, %7\n" /* Load old value. */ \ + "\t"op" %2, %0, %4\n" /* Calculate new value. */ \ + "\tand %2, %5\n" /* Isolate affected part. */ \ + "\tand %3, %6, %0\n" /* Trim out affected part. */ \ + "\tor %2, %3\n" /* Put in the new value. */ \ + "\tsc %2, %1\n" /* Attempt to store. */ \ + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp1), \ + "=&r" (temp2) \ + : "r" (val32.v32), "r" (posmask32.v32), \ + "r" (negmask32.v32), "m" (*mem32)); \ + return (old.v8[(intptr_t)mem8 & 3]); \ +} + +EMIT_ARITHMETIC_FETCH_AND_OP_1(fetch_and_add, "addu") +EMIT_ARITHMETIC_FETCH_AND_OP_1(fetch_and_sub, "subu") + +#define EMIT_BITWISE_FETCH_AND_OP_1(name, op, idempotence) \ +uint8_t \ +__sync_##name##_1(uint8_t *mem8, uint8_t val8) \ +{ \ + uint32_t *mem32; \ + reg_t val32, old; \ + uint32_t temp; \ + \ + mem32 = (uint32_t *)((intptr_t)mem8 & ~3); \ + val32.v32 = idempotence ? 0xffffffff : 0x00000000; \ + val32.v8[(intptr_t)mem8 & 3] = val8; \ + \ + mips_sync(); \ + __asm volatile ( \ + "1:" \ + "\tll %0, %4\n" /* Load old value. */ \ + "\t"op" %2, %3, %0\n" /* Calculate new value. */ \ + "\tsc %2, %1\n" /* Attempt to store. */ \ + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) \ + : "r" (val32.v32), "m" (*mem32)); \ + return (old.v8[(intptr_t)mem8 & 3]); \ +} + +EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_and, "and", 1) +EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_or, "or", 0) +EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_xor, "xor", 0) + +/* + * 16-bit routines. + */ + +uint16_t +__sync_lock_test_and_set_2(uint16_t *mem16, uint16_t val16) +{ + uint32_t *mem32; + reg_t val32, negmask32, old; + uint32_t temp; + + mem32 = (uint32_t *)((intptr_t)mem16 & ~1); + val32.v32 = 0x00000000; + val32.v16[(intptr_t)mem16 & 1] = val16; + negmask32.v32 = 0xffffffff; + negmask32.v16[(intptr_t)mem16 & 1] = 0x0000; + + mips_sync(); + __asm volatile ( + "1:" + "\tll %0, %5\n" /* Load old value. */ + "\tand %2, %4, %0\n" /* Trim out affected part. */ + "\tor %2, %3\n" /* Combine to new value. */ + "\tsc %2, %1\n" /* Attempt to store. */ + "\tbeqz %2, 1b\n" /* Spin if failed. */ + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) + : "r" (val32.v32), "r" (negmask32.v32), "m" (*mem32)); + return (old.v16[(intptr_t)mem16 & 1]); +} + +uint16_t +__sync_val_compare_and_swap_2(uint16_t *mem16, uint16_t expected, + uint16_t desired) +{ + uint32_t *mem32; + reg_t expected32, desired32, posmask32, negmask32, old; + uint32_t temp; + + mem32 = (uint32_t *)((intptr_t)mem16 & ~1); + expected32.v32 = 0x00000000; + expected32.v16[(intptr_t)mem16 & 1] = expected; + desired32.v32 = 0x00000000; + desired32.v16[(intptr_t)mem16 & 1] = desired; + posmask32.v32 = 0x00000000; + posmask32.v16[(intptr_t)mem16 & 1] = 0xffff; + negmask32.v32 = ~posmask32.v32; + + mips_sync(); + __asm volatile ( + "1:" + "\tll %0, %7\n" /* Load old value. */ + "\tand %2, %5, %0\n" /* Isolate affected part. */ + "\tbne %2, %3, 2f\n" /* Compare to expected value. */ + "\tand %2, %6, %0\n" /* Trim out affected part. */ + "\tor %2, %4\n" /* Put in the new value. */ + "\tsc %2, %1\n" /* Attempt to store. */ + "\tbeqz %2, 1b\n" /* Spin if failed. */ + "2:" + : "=&r" (old), "=m" (*mem32), "=&r" (temp) + : "r" (expected32.v32), "r" (desired32.v32), + "r" (posmask32.v32), "r" (negmask32.v32), "m" (*mem32)); + return (old.v16[(intptr_t)mem16 & 1]); +} + +#define EMIT_ARITHMETIC_FETCH_AND_OP_2(name, op) \ +uint16_t \ +__sync_##name##_2(uint16_t *mem16, uint16_t val16) \ +{ \ + uint32_t *mem32; \ + reg_t val32, posmask32, negmask32, old; \ + uint32_t temp1, temp2; \ + \ + mem32 = (uint32_t *)((intptr_t)mem16 & ~3); \ + val32.v32 = 0x00000000; \ + val32.v16[(intptr_t)mem16 & 1] = val16; \ + posmask32.v32 = 0x00000000; \ + posmask32.v16[(intptr_t)mem16 & 1] = 0xffff; \ + negmask32.v32 = ~posmask32.v32; \ + \ + mips_sync(); \ + __asm volatile ( \ + "1:" \ + "\tll %0, %7\n" /* Load old value. */ \ + "\t"op" %2, %0, %4\n" /* Calculate new value. */ \ + "\tand %2, %5\n" /* Isolate affected part. */ \ + "\tand %3, %6, %0\n" /* Trim out affected part. */ \ + "\tor %2, %3\n" /* Combine to new value. */ \ + "\tsc %2, %1\n" /* Attempt to store. */ \ + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp1), \ + "=&r" (temp2) \ + : "r" (val32.v32), "r" (posmask32.v32), \ + "r" (negmask32.v32), "m" (*mem32)); \ + return (old.v16[(intptr_t)mem16 & 1]); \ +} + +EMIT_ARITHMETIC_FETCH_AND_OP_2(fetch_and_add, "addu") +EMIT_ARITHMETIC_FETCH_AND_OP_2(fetch_and_sub, "subu") + +#define EMIT_BITWISE_FETCH_AND_OP_2(name, op, idempotence) \ +uint16_t \ +__sync_##name##_2(uint16_t *mem16, uint16_t val16) \ +{ \ + uint32_t *mem32; \ + reg_t val32, old; \ + uint32_t temp; \ + \ + mem32 = (uint32_t *)((intptr_t)mem16 & ~1); \ + val32.v32 = idempotence ? 0xffffffff : 0x00000000; \ + val32.v16[(intptr_t)mem16 & 1] = val16; \ + \ + mips_sync(); \ + __asm volatile ( \ + "1:" \ + "\tll %0, %4\n" /* Load old value. */ \ + "\t"op" %2, %3, %0\n" /* Calculate new value. */ \ + "\tsc %2, %1\n" /* Attempt to store. */ \ + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) \ + : "r" (val32.v32), "m" (*mem32)); \ + return (old.v16[(intptr_t)mem16 & 1]); \ +} + +EMIT_BITWISE_FETCH_AND_OP_2(fetch_and_and, "and", 1) +EMIT_BITWISE_FETCH_AND_OP_2(fetch_and_or, "or", 0) +EMIT_BITWISE_FETCH_AND_OP_2(fetch_and_xor, "xor", 0) + +/* + * 32-bit routines. + */ + +uint32_t +__sync_val_compare_and_swap_4(uint32_t *mem, uint32_t expected, + uint32_t desired) +{ + uint32_t old, temp; + + mips_sync(); + __asm volatile ( + "1:" + "\tll %0, %5\n" /* Load old value. */ + "\tbne %0, %3, 2f\n" /* Compare to expected value. */ + "\tmove %2, %4\n" /* Value to store. */ + "\tsc %2, %1\n" /* Attempt to store. */ + "\tbeqz %2, 1b\n" /* Spin if failed. */ + "2:" + : "=&r" (old), "=m" (*mem), "=&r" (temp) + : "r" (expected), "r" (desired), "m" (*mem)); + return (old); +} + +#define EMIT_FETCH_AND_OP_4(name, op) \ +uint32_t \ +__sync_##name##_4(uint32_t *mem, uint32_t val) \ +{ \ + uint32_t old, temp; \ + \ + mips_sync(); \ + __asm volatile ( \ + "1:" \ + "\tll %0, %4\n" /* Load old value. */ \ + "\t"op"\n" /* Calculate new value. */ \ + "\tsc %2, %1\n" /* Attempt to store. */ \ + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ + : "=&r" (old), "=m" (*mem), "=&r" (temp) \ + : "r" (val), "m" (*mem)); \ + return (old); \ +} + +EMIT_FETCH_AND_OP_4(lock_test_and_set, "move %2, %3") +EMIT_FETCH_AND_OP_4(fetch_and_add, "addu %2, %0, %3") +EMIT_FETCH_AND_OP_4(fetch_and_and, "and %2, %0, %3") +EMIT_FETCH_AND_OP_4(fetch_and_or, "or %2, %0, %3") +EMIT_FETCH_AND_OP_4(fetch_and_sub, "subu %2, %0, %3") +EMIT_FETCH_AND_OP_4(fetch_and_xor, "xor %2, %0, %3") + +/* + * 64-bit routines. + * + * Note: All the 64-bit atomic operations are only atomic when running + * in 64-bit mode. It is assumed that code compiled for n32 and n64 fits + * into this definition and no further safeties are needed. + */ + +#if defined(__mips_n32) || defined(__mips_n64) + +uint64_t +__sync_val_compare_and_swap_8(uint64_t *mem, uint64_t expected, + uint64_t desired) +{ + uint64_t old, temp; + + mips_sync(); + __asm volatile ( + "1:" + "\tlld %0, %5\n" /* Load old value. */ + "\tbne %0, %3, 2f\n" /* Compare to expected value. */ + "\tmove %2, %4\n" /* Value to store. */ + "\tscd %2, %1\n" /* Attempt to store. */ + "\tbeqz %2, 1b\n" /* Spin if failed. */ + "2:" + : "=&r" (old), "=m" (*mem), "=&r" (temp) + : "r" (expected), "r" (desired), "m" (*mem)); + return (old); +} + +#define EMIT_FETCH_AND_OP_8(name, op) \ +uint64_t \ +__sync_##name##_8(uint64_t *mem, uint64_t val) \ +{ \ + uint64_t old, temp; \ + \ + mips_sync(); \ + __asm volatile ( \ + "1:" \ + "\tlld %0, %4\n" /* Load old value. */ \ + "\t"op"\n" /* Calculate new value. */ \ + "\tscd %2, %1\n" /* Attempt to store. */ \ + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ + : "=&r" (old), "=m" (*mem), "=&r" (temp) \ + : "r" (val), "m" (*mem)); \ + return (old); \ +} + +EMIT_FETCH_AND_OP_8(lock_test_and_set, "move %2, %3") +EMIT_FETCH_AND_OP_8(fetch_and_add, "daddu %2, %0, %3") +EMIT_FETCH_AND_OP_8(fetch_and_and, "and %2, %0, %3") +EMIT_FETCH_AND_OP_8(fetch_and_or, "or %2, %0, %3") +EMIT_FETCH_AND_OP_8(fetch_and_sub, "dsubu %2, %0, %3") +EMIT_FETCH_AND_OP_8(fetch_and_xor, "xor %2, %0, %3") + +#endif /* __mips_n32 || __mips_n64 */ From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 13:22:53 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EA150A51; Sat, 8 Jun 2013 13:22:53 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DB9F915BC; Sat, 8 Jun 2013 13:22:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58DMr52063484; Sat, 8 Jun 2013 13:22:53 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58DMrCr063482; Sat, 8 Jun 2013 13:22:53 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201306081322.r58DMrCr063482@svn.freebsd.org> From: Ed Schouten Date: Sat, 8 Jun 2013 13:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251525 - head/lib/libcompiler_rt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 13:22:54 -0000 Author: ed Date: Sat Jun 8 13:22:53 2013 New Revision: 251525 URL: http://svnweb.freebsd.org/changeset/base/251525 Log: Use improved __sync_*() intrinsics for MIPS in userspace as well. r251524 introduced custom tailored versions for MIPS of these functions for kernel-space code. We can just reuse them in userspace as well. Deleted: head/lib/libcompiler_rt/__sync_fetch_and_add_8.c head/lib/libcompiler_rt/__sync_fetch_and_and_8.c head/lib/libcompiler_rt/__sync_fetch_and_or_8.c head/lib/libcompiler_rt/__sync_fetch_and_sub_8.c head/lib/libcompiler_rt/__sync_fetch_and_xor_8.c head/lib/libcompiler_rt/__sync_lock_test_and_set_8.c head/lib/libcompiler_rt/__sync_val_compare_and_swap_8.c Modified: head/lib/libcompiler_rt/Makefile Modified: head/lib/libcompiler_rt/Makefile ============================================================================== --- head/lib/libcompiler_rt/Makefile Sat Jun 8 13:19:11 2013 (r251524) +++ head/lib/libcompiler_rt/Makefile Sat Jun 8 13:22:53 2013 (r251525) @@ -157,7 +157,7 @@ SRCF+= divsi3 \ .endif # FreeBSD-specific atomic intrinsics. -.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" +.if ${MACHINE_CPUARCH} == "arm" SRCF+= __sync_fetch_and_add_4 \ __sync_fetch_and_and_4 \ __sync_fetch_and_or_4 \ @@ -166,15 +166,10 @@ SRCF+= __sync_fetch_and_add_4 \ __sync_lock_test_and_set_4 \ __sync_synchronize \ __sync_val_compare_and_swap_4 -.endif -.if ${MACHINE_ARCH:Mmips64*} != "" -SRCF+= __sync_fetch_and_add_8 \ - __sync_fetch_and_and_8 \ - __sync_fetch_and_or_8 \ - __sync_fetch_and_sub_8 \ - __sync_fetch_and_xor_8 \ - __sync_lock_test_and_set_8 \ - __sync_val_compare_and_swap_8 +.elif ${MACHINE_CPUARCH} == "mips" +.PATH: ${.CURDIR}/../../sys/mips/mips + +SRCF+= stdatomic .endif .for file in ${SRCF} From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 13:27:59 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0E08FD0C; Sat, 8 Jun 2013 13:27:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F31C415E6; Sat, 8 Jun 2013 13:27:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58DRwQw064300; Sat, 8 Jun 2013 13:27:58 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58DRv7p064284; Sat, 8 Jun 2013 13:27:57 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306081327.r58DRv7p064284@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 8 Jun 2013 13:27:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251526 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 13:27:59 -0000 Author: glebius Date: Sat Jun 8 13:27:57 2013 New Revision: 251526 URL: http://svnweb.freebsd.org/changeset/base/251526 Log: Add new system call - aio_mlock(). The name speaks for itself. It allows to perform the mlock(2) operation, which can consume a lot of time, under control of aio(4). Reviewed by: kib, jilles Sponsored by: Nginx, Inc. Added: head/lib/libc/sys/aio_mlock.2 (contents, props changed) Modified: head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/sys/compat/freebsd32/syscalls.master head/sys/kern/syscalls.master head/sys/kern/vfs_aio.c head/sys/sys/aio.h Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Sat Jun 8 13:22:53 2013 (r251525) +++ head/lib/libc/sys/Makefile.inc Sat Jun 8 13:27:57 2013 (r251526) @@ -85,6 +85,7 @@ MAN+= abort2.2 \ adjtime.2 \ aio_cancel.2 \ aio_error.2 \ + aio_mlock.2 \ aio_read.2 \ aio_return.2 \ aio_suspend.2 \ Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Sat Jun 8 13:22:53 2013 (r251525) +++ head/lib/libc/sys/Symbol.map Sat Jun 8 13:27:57 2013 (r251526) @@ -379,6 +379,7 @@ FBSD_1.2 { FBSD_1.3 { accept4; + aio_mlock; bindat; cap_fcntls_get; cap_fcntls_limit; Added: head/lib/libc/sys/aio_mlock.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/aio_mlock.2 Sat Jun 8 13:27:57 2013 (r251526) @@ -0,0 +1,133 @@ +.\" Copyright (c) 2013 Gleb Smirnoff +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd June 3, 2013 +.Dt AIO_MLOCK 2 +.Os +.Sh NAME +.Nm aio_mlock +.Nd asynchronous +.Xr mlock 2 +operation +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In aio.h +.Ft int +.Fn aio_mlock "struct aiocb *iocb" +.Sh DESCRIPTION +The +.Fn aio_mlock +system call allows the calling process to lock into memory the +physical pages associated with the virtual address range starting at +.Fa iocb->aio_buf +for +.Fa iocb->aio_nbytes +bytes. +The call returns immediately after the locking request has +been enqueued; the operation may or may not have completed at the time +the call returns. +.Pp +The +.Fa iocb +pointer may be subsequently used as an argument to +.Fn aio_return +and +.Fn aio_error +in order to determine return or error status for the enqueued operation +while it is in progress. +.Pp +If the request could not be enqueued (generally due to +.Xr aio 4 +limits), +then the call returns without having enqueued the request. +.Sh RESTRICTIONS +The Asynchronous I/O Control Block structure pointed to by +.Fa iocb +and the buffer that the +.Fa iocb->aio_buf +member of that structure references must remain valid until the +operation has completed. +For this reason, use of auto (stack) variables +for these objects is discouraged. +.Pp +The asynchronous I/O control buffer +.Fa iocb +should be zeroed before the +.Fn aio_mlock +call to avoid passing bogus context information to the kernel. +.Pp +Modifications of the Asynchronous I/O Control Block structure or the +buffer contents after the request has been enqueued, but before the +request has completed, are not allowed. +.Sh RETURN VALUES +.Rv -std aio_mlock +.Sh ERRORS +The +.Fn aio_read +system call will fail if: +.Bl -tag -width Er +.It Bq Er EAGAIN +The request was not queued because of system resource limitations. +.It Bq Er ENOSYS +The +.Fn aio_mlock +system call is not supported. +.El +.Pp +If the request is successfully enqueued, but subsequently cancelled +or an error occurs, the value returned by the +.Fn aio_return +system call is per the +.Xr mlock 2 +system call, and the value returned by the +.Fn aio_error +system call is one of the error returns from the +.Xr mlock 2 +system call, or +.Er ECANCELED +if the request was explicitly cancelled via a call to +.Fn aio_cancel . +.Sh SEE ALSO +.Xr aio_cancel 2 , +.Xr aio_error 2 , +.Xr aio_return 2 , +.Xr aio 4 , +.Xr mlock 2 +.Sh PORTABILITY +The +.Fn aio_mlock +system call is a +.Fx +extension, and should not be used in portable code. +.Sh HISTORY +The +.Fn aio_mlock +system call first appeared in +.Fx 10.0 . +.Sh AUTHORS +The system call was introduced by +.An Gleb Smirnoff Aq glebius@FreeBSD.org . Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Sat Jun 8 13:22:53 2013 (r251525) +++ head/sys/compat/freebsd32/syscalls.master Sat Jun 8 13:27:57 2013 (r251526) @@ -1044,3 +1044,5 @@ __socklen_t * __restrict anamelen, \ int flags); } 542 AUE_PIPE NOPROTO { int pipe2(int *fildes, int flags); } +543 AUE_NULL NOSTD { int freebsd32_aio_mlock( \ + struct aiocb32 *aiocbp); } Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Sat Jun 8 13:22:53 2013 (r251525) +++ head/sys/kern/syscalls.master Sat Jun 8 13:27:57 2013 (r251526) @@ -977,5 +977,6 @@ __socklen_t * __restrict anamelen, \ int flags); } 542 AUE_PIPE STD { int pipe2(int *fildes, int flags); } +543 AUE_NULL NOSTD { int aio_mlock(struct aiocb *aiocbp); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Sat Jun 8 13:22:53 2013 (r251525) +++ head/sys/kern/vfs_aio.c Sat Jun 8 13:27:57 2013 (r251526) @@ -340,6 +340,7 @@ static int aio_onceonly(void); static int aio_free_entry(struct aiocblist *aiocbe); static void aio_process_rw(struct aiocblist *aiocbe); static void aio_process_sync(struct aiocblist *aiocbe); +static void aio_process_mlock(struct aiocblist *aiocbe); static int aio_newproc(int *); int aio_aqueue(struct thread *td, struct aiocb *job, struct aioliojob *lio, int type, struct aiocb_ops *ops); @@ -426,6 +427,7 @@ static struct syscall_helper_data aio_sy SYSCALL_INIT_HELPER(aio_cancel), SYSCALL_INIT_HELPER(aio_error), SYSCALL_INIT_HELPER(aio_fsync), + SYSCALL_INIT_HELPER(aio_mlock), SYSCALL_INIT_HELPER(aio_read), SYSCALL_INIT_HELPER(aio_return), SYSCALL_INIT_HELPER(aio_suspend), @@ -453,6 +455,7 @@ static struct syscall_helper_data aio32_ SYSCALL32_INIT_HELPER(freebsd32_aio_cancel), SYSCALL32_INIT_HELPER(freebsd32_aio_error), SYSCALL32_INIT_HELPER(freebsd32_aio_fsync), + SYSCALL32_INIT_HELPER(freebsd32_aio_mlock), SYSCALL32_INIT_HELPER(freebsd32_aio_read), SYSCALL32_INIT_HELPER(freebsd32_aio_write), SYSCALL32_INIT_HELPER(freebsd32_aio_waitcomplete), @@ -702,7 +705,8 @@ aio_free_entry(struct aiocblist *aiocbe) * at open time, but this is already true of file descriptors in * a multithreaded process. */ - fdrop(aiocbe->fd_file, curthread); + if (aiocbe->fd_file) + fdrop(aiocbe->fd_file, curthread); crfree(aiocbe->cred); uma_zfree(aiocb_zone, aiocbe); AIO_LOCK(ki); @@ -968,6 +972,21 @@ aio_process_sync(struct aiocblist *aiocb } static void +aio_process_mlock(struct aiocblist *aiocbe) +{ + struct aiocb *cb = &aiocbe->uaiocb; + int error; + + KASSERT(aiocbe->uaiocb.aio_lio_opcode == LIO_MLOCK, + ("%s: opcode %d", __func__, aiocbe->uaiocb.aio_lio_opcode)); + + error = vm_mlock(aiocbe->userproc, aiocbe->cred, + __DEVOLATILE(void *, cb->aio_buf), cb->aio_nbytes); + cb->_aiocb_private.error = error; + cb->_aiocb_private.status = 0; +} + +static void aio_bio_done_notify(struct proc *userp, struct aiocblist *aiocbe, int type) { struct aioliojob *lj; @@ -1143,6 +1162,9 @@ aio_daemon(void *_id) case LIO_SYNC: aio_process_sync(aiocbe); break; + case LIO_MLOCK: + aio_process_mlock(aiocbe); + break; } mtx_lock(&aio_job_mtx); @@ -1283,7 +1305,7 @@ aio_qphysio(struct proc *p, struct aiocb cb = &aiocbe->uaiocb; fp = aiocbe->fd_file; - if (fp->f_type != DTYPE_VNODE) + if (fp == NULL || fp->f_type != DTYPE_VNODE) return (-1); vp = fp->f_vnode; @@ -1635,6 +1657,9 @@ aio_aqueue(struct thread *td, struct aio case LIO_SYNC: error = fget(td, fd, CAP_FSYNC, &fp); break; + case LIO_MLOCK: + fp = NULL; + break; case LIO_NOP: error = fget(td, fd, CAP_NONE, &fp); break; @@ -1692,7 +1717,8 @@ aio_aqueue(struct thread *td, struct aio error = kqfd_register(kqfd, &kev, td, 1); aqueue_fail: if (error) { - fdrop(fp, td); + if (fp) + fdrop(fp, td); uma_zfree(aiocb_zone, aiocbe); ops->store_error(job, error); goto done; @@ -1709,7 +1735,7 @@ no_kqueue: if (opcode == LIO_SYNC) goto queueit; - if (fp->f_type == DTYPE_SOCKET) { + if (fp && fp->f_type == DTYPE_SOCKET) { /* * Alternate queueing for socket ops: Reach down into the * descriptor to get the socket data. Then check to see if the @@ -2187,6 +2213,13 @@ sys_aio_write(struct thread *td, struct return (aio_aqueue(td, uap->aiocbp, NULL, LIO_WRITE, &aiocb_ops)); } +int +sys_aio_mlock(struct thread *td, struct aio_mlock_args *uap) +{ + + return (aio_aqueue(td, uap->aiocbp, NULL, LIO_MLOCK, &aiocb_ops)); +} + static int kern_lio_listio(struct thread *td, int mode, struct aiocb * const *uacb_list, struct aiocb **acb_list, int nent, struct sigevent *sig, @@ -2929,6 +2962,14 @@ freebsd32_aio_write(struct thread *td, s } int +freebsd32_aio_mlock(struct thread *td, struct freebsd32_aio_mlock_args *uap) +{ + + return (aio_aqueue(td, (struct aiocb *)uap->aiocbp, NULL, LIO_MLOCK, + &aiocb32_ops)); +} + +int freebsd32_aio_waitcomplete(struct thread *td, struct freebsd32_aio_waitcomplete_args *uap) { Modified: head/sys/sys/aio.h ============================================================================== --- head/sys/sys/aio.h Sat Jun 8 13:22:53 2013 (r251525) +++ head/sys/sys/aio.h Sat Jun 8 13:27:57 2013 (r251526) @@ -37,6 +37,7 @@ #define LIO_READ 0x2 #ifdef _KERNEL #define LIO_SYNC 0x3 +#define LIO_MLOCK 0x4 #endif /* @@ -124,6 +125,11 @@ int aio_cancel(int, struct aiocb *); */ int aio_suspend(const struct aiocb * const[], int, const struct timespec *); +/* + * Asynchronous mlock + */ +int aio_mlock(struct aiocb *); + #ifdef __BSD_VISIBLE int aio_waitcomplete(struct aiocb **, struct timespec *); #endif From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 13:30:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 48DC3F0F; Sat, 8 Jun 2013 13:30:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3A6011601; Sat, 8 Jun 2013 13:30:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58DUGFx066192; Sat, 8 Jun 2013 13:30:16 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58DUDaD066178; Sat, 8 Jun 2013 13:30:13 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306081330.r58DUDaD066178@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 8 Jun 2013 13:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251527 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 13:30:16 -0000 Author: glebius Date: Sat Jun 8 13:30:13 2013 New Revision: 251527 URL: http://svnweb.freebsd.org/changeset/base/251527 Log: aio_mlock() added: - Regen for r251526. - Bump __FreeBSD_version. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/param.h head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/compat/freebsd32/freebsd32_proto.h Sat Jun 8 13:30:13 2013 (r251527) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 250853 2013-05-21 11:40:16Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 251526 2013-06-08 13:27:57Z glebius */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -628,6 +628,9 @@ struct freebsd32_wait6_args { char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)]; }; #endif +struct freebsd32_aio_mlock_args { + char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; +}; #if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif @@ -746,6 +749,7 @@ int freebsd32_posix_fallocate(struct thr int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *); int freebsd32_wait6(struct thread *, struct freebsd32_wait6_args *); #endif +int freebsd32_aio_mlock(struct thread *, struct freebsd32_aio_mlock_args *); #ifdef COMPAT_43 @@ -1138,6 +1142,7 @@ int freebsd7_freebsd32_shmctl(struct thr #define FREEBSD32_SYS_AUE_freebsd32_posix_fallocate AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_posix_fadvise AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_wait6 AUE_WAIT6 +#define FREEBSD32_SYS_AUE_freebsd32_aio_mlock AUE_NULL #undef PAD_ #undef PADL_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Sat Jun 8 13:30:13 2013 (r251527) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 250853 2013-05-21 11:40:16Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 251526 2013-06-08 13:27:57Z glebius */ #define FREEBSD32_SYS_syscall 0 @@ -443,4 +443,5 @@ #define FREEBSD32_SYS_chflagsat 540 #define FREEBSD32_SYS_accept4 541 #define FREEBSD32_SYS_pipe2 542 -#define FREEBSD32_SYS_MAXSYSCALL 543 +#define FREEBSD32_SYS_freebsd32_aio_mlock 543 +#define FREEBSD32_SYS_MAXSYSCALL 544 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Sat Jun 8 13:30:13 2013 (r251527) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 250853 2013-05-21 11:40:16Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 251526 2013-06-08 13:27:57Z glebius */ const char *freebsd32_syscallnames[] = { @@ -572,4 +572,5 @@ const char *freebsd32_syscallnames[] = { "chflagsat", /* 540 = chflagsat */ "accept4", /* 541 = accept4 */ "pipe2", /* 542 = pipe2 */ + "freebsd32_aio_mlock", /* 543 = freebsd32_aio_mlock */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Sat Jun 8 13:30:13 2013 (r251527) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 250853 2013-05-21 11:40:16Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 251526 2013-06-08 13:27:57Z glebius */ #include "opt_compat.h" @@ -609,4 +609,5 @@ struct sysent freebsd32_sysent[] = { { AS(chflagsat_args), (sy_call_t *)sys_chflagsat, AUE_CHFLAGSAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 540 = chflagsat */ { AS(accept4_args), (sy_call_t *)sys_accept4, AUE_ACCEPT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 541 = accept4 */ { AS(pipe2_args), (sy_call_t *)sys_pipe2, AUE_PIPE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 542 = pipe2 */ + { AS(freebsd32_aio_mlock_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 543 = freebsd32_aio_mlock */ }; Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Sat Jun 8 13:30:13 2013 (r251527) @@ -3221,6 +3221,13 @@ systrace_args(int sysnum, void *params, *n_args = 2; break; } + /* freebsd32_aio_mlock */ + case 543: { + struct freebsd32_aio_mlock_args *p = params; + uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb32 * */ + *n_args = 1; + break; + } default: *n_args = 0; break; @@ -8626,6 +8633,16 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; + /* freebsd32_aio_mlock */ + case 543: + switch(ndx) { + case 0: + p = "struct aiocb32 *"; + break; + default: + break; + }; + break; default: break; }; @@ -10456,6 +10473,11 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; + /* freebsd32_aio_mlock */ + case 543: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/kern/init_sysent.c Sat Jun 8 13:30:13 2013 (r251527) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 250853 2013-05-21 11:40:16Z kib + * created from FreeBSD: head/sys/kern/syscalls.master 251526 2013-06-08 13:27:57Z glebius */ #include "opt_compat.h" @@ -577,4 +577,5 @@ struct sysent sysent[] = { { AS(chflagsat_args), (sy_call_t *)sys_chflagsat, AUE_CHFLAGSAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 540 = chflagsat */ { AS(accept4_args), (sy_call_t *)sys_accept4, AUE_ACCEPT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 541 = accept4 */ { AS(pipe2_args), (sy_call_t *)sys_pipe2, AUE_PIPE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 542 = pipe2 */ + { AS(aio_mlock_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 543 = aio_mlock */ }; Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/kern/syscalls.c Sat Jun 8 13:30:13 2013 (r251527) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 250853 2013-05-21 11:40:16Z kib + * created from FreeBSD: head/sys/kern/syscalls.master 251526 2013-06-08 13:27:57Z glebius */ const char *syscallnames[] = { @@ -550,4 +550,5 @@ const char *syscallnames[] = { "chflagsat", /* 540 = chflagsat */ "accept4", /* 541 = accept4 */ "pipe2", /* 542 = pipe2 */ + "aio_mlock", /* 543 = aio_mlock */ }; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/kern/systrace_args.c Sat Jun 8 13:30:13 2013 (r251527) @@ -3376,6 +3376,13 @@ systrace_args(int sysnum, void *params, *n_args = 2; break; } + /* aio_mlock */ + case 543: { + struct aio_mlock_args *p = params; + uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb * */ + *n_args = 1; + break; + } default: *n_args = 0; break; @@ -8995,6 +9002,16 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; + /* aio_mlock */ + case 543: + switch(ndx) { + case 0: + p = "struct aiocb *"; + break; + default: + break; + }; + break; default: break; }; @@ -10938,6 +10955,11 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; + /* aio_mlock */ + case 543: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/sys/param.h Sat Jun 8 13:30:13 2013 (r251527) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000034 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000035 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/sys/syscall.h Sat Jun 8 13:30:13 2013 (r251527) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 250853 2013-05-21 11:40:16Z kib + * created from FreeBSD: head/sys/kern/syscalls.master 251526 2013-06-08 13:27:57Z glebius */ #define SYS_syscall 0 @@ -462,4 +462,5 @@ #define SYS_chflagsat 540 #define SYS_accept4 541 #define SYS_pipe2 542 -#define SYS_MAXSYSCALL 543 +#define SYS_aio_mlock 543 +#define SYS_MAXSYSCALL 544 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/sys/syscall.mk Sat Jun 8 13:30:13 2013 (r251527) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 250853 2013-05-21 11:40:16Z kib +# created from FreeBSD: head/sys/kern/syscalls.master 251526 2013-06-08 13:27:57Z glebius MIASM = \ syscall.o \ exit.o \ @@ -410,4 +410,5 @@ MIASM = \ connectat.o \ chflagsat.o \ accept4.o \ - pipe2.o + pipe2.o \ + aio_mlock.o Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Sat Jun 8 13:27:57 2013 (r251526) +++ head/sys/sys/sysproto.h Sat Jun 8 13:30:13 2013 (r251527) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 250853 2013-05-21 11:40:16Z kib + * created from FreeBSD: head/sys/kern/syscalls.master 251526 2013-06-08 13:27:57Z glebius */ #ifndef _SYS_SYSPROTO_H_ @@ -1812,6 +1812,9 @@ struct pipe2_args { char fildes_l_[PADL_(int *)]; int * fildes; char fildes_r_[PADR_(int *)]; char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; }; +struct aio_mlock_args { + char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2204,6 +2207,7 @@ int sys_connectat(struct thread *, struc int sys_chflagsat(struct thread *, struct chflagsat_args *); int sys_accept4(struct thread *, struct accept4_args *); int sys_pipe2(struct thread *, struct pipe2_args *); +int sys_aio_mlock(struct thread *, struct aio_mlock_args *); #ifdef COMPAT_43 @@ -2910,6 +2914,7 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE_chflagsat AUE_CHFLAGSAT #define SYS_AUE_accept4 AUE_ACCEPT #define SYS_AUE_pipe2 AUE_PIPE +#define SYS_AUE_aio_mlock AUE_NULL #undef PAD_ #undef PADL_ From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 13:40:37 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F3B8A404; Sat, 8 Jun 2013 13:40:36 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E44BB1673; Sat, 8 Jun 2013 13:40:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58DeaUQ068043; Sat, 8 Jun 2013 13:40:36 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58Deane068042; Sat, 8 Jun 2013 13:40:36 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306081340.r58Deane068042@svn.freebsd.org> From: Hiroki Sato Date: Sat, 8 Jun 2013 13:40:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251528 - stable/8/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 13:40:37 -0000 Author: hrs Date: Sat Jun 8 13:40:36 2013 New Revision: 251528 URL: http://svnweb.freebsd.org/changeset/base/251528 Log: s/RELEASE_8_4_0/RELENG_8_4_0_RELEASE/ Spotted by: nyan Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sat Jun 8 13:30:13 2013 (r251527) +++ stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sat Jun 8 13:40:36 2013 (r251528) @@ -215,7 +215,7 @@ using &os; subversion repository instead. RELENG_8_4 corresponds to svn://svn.FreeBSD.org/base/releng/8.4, and - RELEASE_8_4_0 corresponds to + RELENG_8_4_0_RELEASE corresponds to svn://svn.FreeBSD.org/base/release/8.4.0. Please note that &os; source tree for &release; and its security branch cannot be updated by using official CVSup servers. From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 13:45:43 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ECB8364B; Sat, 8 Jun 2013 13:45:43 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DE00216BA; Sat, 8 Jun 2013 13:45:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58Djh9E070261; Sat, 8 Jun 2013 13:45:43 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58DjhPE070260; Sat, 8 Jun 2013 13:45:43 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201306081345.r58DjhPE070260@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 8 Jun 2013 13:45:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251529 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 13:45:44 -0000 Author: jilles Date: Sat Jun 8 13:45:43 2013 New Revision: 251529 URL: http://svnweb.freebsd.org/changeset/base/251529 Log: sigaction(2): Document various non-POSIX functions as async-signal safe. Modified: head/lib/libc/sys/sigaction.2 Modified: head/lib/libc/sys/sigaction.2 ============================================================================== --- head/lib/libc/sys/sigaction.2 Sat Jun 8 13:40:36 2013 (r251528) +++ head/lib/libc/sys/sigaction.2 Sat Jun 8 13:45:43 2013 (r251529) @@ -28,7 +28,7 @@ .\" From: @(#)sigaction.2 8.2 (Berkeley) 4/3/94 .\" $FreeBSD$ .\" -.Dd May 31, 2013 +.Dd June 8, 2013 .Dt SIGACTION 2 .Os .Sh NAME @@ -556,9 +556,22 @@ but planned to be: .Pp Extension Interfaces: .Pp +.Fn accept4 , +.Fn bindat , +.Fn closefrom , +.Fn connectat , +.Fn eaccess , +.Fn ffsl , +.Fn ffsll , +.Fn flock , +.Fn fls , +.Fn flsl , +.Fn flsll , .Fn futimesat , -.Fn strlcpy , +.Fn pipe2 , .Fn strlcat . +.Fn strlcpy , +.Fn strsep . .Pp In addition, reading or writing .Va errno From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 13:45:44 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 103A164C; Sat, 8 Jun 2013 13:45:44 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 02ADE16BB; Sat, 8 Jun 2013 13:45:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58Djhld070263; Sat, 8 Jun 2013 13:45:43 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58DjhT0070262; Sat, 8 Jun 2013 13:45:43 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306081345.r58DjhT0070262@svn.freebsd.org> From: Hiroki Sato Date: Sat, 8 Jun 2013 13:45:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251530 - stable/8/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 13:45:44 -0000 Author: hrs Date: Sat Jun 8 13:45:43 2013 New Revision: 251530 URL: http://svnweb.freebsd.org/changeset/base/251530 Log: One more s/RELEASE_8_4_0/RELENG_8_4_0_RELEASE/ Spotted by: nyan Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sat Jun 8 13:45:43 2013 (r251529) +++ stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sat Jun 8 13:45:43 2013 (r251530) @@ -209,7 +209,7 @@ [20130608] &os; &release; no longer supports &os; CVS repository. Some documents mistakenly refer to RELEASE_8_4_0 as CVS tag for the release and - RELENG_8_4 as CVS branch tag for the + RELENG_8_4_0_RELEASE as CVS branch tag for the &release; security branch. However, &os; Project no longer supports &os; CVS repository and &release; has been released by using &os; subversion repository instead. From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 13:48:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 910FD972; Sat, 8 Jun 2013 13:48:27 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 833BF16EF; Sat, 8 Jun 2013 13:48:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58DmR7T070669; Sat, 8 Jun 2013 13:48:27 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58DmRq1070668; Sat, 8 Jun 2013 13:48:27 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306081348.r58DmRq1070668@svn.freebsd.org> From: Hiroki Sato Date: Sat, 8 Jun 2013 13:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251531 - stable/8/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 13:48:27 -0000 Author: hrs Date: Sat Jun 8 13:48:27 2013 New Revision: 251531 URL: http://svnweb.freebsd.org/changeset/base/251531 Log: Revert the previous change and fix the tag name. Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sat Jun 8 13:45:43 2013 (r251530) +++ stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sat Jun 8 13:48:27 2013 (r251531) @@ -208,8 +208,8 @@ [20130608] &os; &release; no longer supports &os; CVS repository. Some documents mistakenly refer to - RELEASE_8_4_0 as CVS tag for the release and - RELENG_8_4_0_RELEASE as CVS branch tag for the + RELENG_8_4_0_RELEASE as CVS tag for the release and + RELENG_8_4 as CVS branch tag for the &release; security branch. However, &os; Project no longer supports &os; CVS repository and &release; has been released by using &os; subversion repository instead. From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 14:32:58 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D1A3EC49; Sat, 8 Jun 2013 14:32:58 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qe0-f54.google.com (mail-qe0-f54.google.com [209.85.128.54]) by mx1.freebsd.org (Postfix) with ESMTP id 6481A1EB4; Sat, 8 Jun 2013 14:32:58 +0000 (UTC) Received: by mail-qe0-f54.google.com with SMTP id ne12so3323686qeb.13 for ; Sat, 08 Jun 2013 07:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=m0orhQpb8Aue39jYR4HEjj16Oy6MJOONvDdXYrnhFPI=; b=eiglTt/UdyiXRUaF/61ySoF0AZ5x9fzrw2kzO0uRdAfzdaTIa3G/5efQzLQrJfQcVQ IT7kfrP6kpSiz09Gp8tD15YDlVdsPfYaEm0PdQAHOjZNeJX7DrI4IU1TzaCGvGKyq336 enjUJ9PxNhtqXIKvvVtnYnNaQGlRd/a8VkKWBEI2BOkRvf+vprvyx2a9FeQ7/PYpKnL7 cCXwAYpfJ3jWybmJrruaLovU0yeKFXQWhvwFtnFi6rpuDQpl41wqY2t8C5Bw8tLN4+mN zVSy6nNyYwchWSJP9PxhlWDeW9AkTIqn645o9Xoog8/yQoQ5gUuJWOOsdcR9+2yd304r ONag== MIME-Version: 1.0 X-Received: by 10.224.184.196 with SMTP id cl4mr7313343qab.65.1370701971050; Sat, 08 Jun 2013 07:32:51 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.5.65 with HTTP; Sat, 8 Jun 2013 07:32:50 -0700 (PDT) In-Reply-To: <201306081319.r58DJBS0061186@svn.freebsd.org> References: <201306081319.r58DJBS0061186@svn.freebsd.org> Date: Sat, 8 Jun 2013 07:32:50 -0700 X-Google-Sender-Auth: vut2MS2S6jKB5HGxUWtzLybsYlc Message-ID: Subject: Re: svn commit: r251524 - in head/sys: conf mips/mips From: Adrian Chadd To: Ed Schouten Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 14:32:58 -0000 .. have we decided whether to nuke the NOP flush from orbit? adrian On 8 June 2013 06:19, Ed Schouten wrote: > Author: ed > Date: Sat Jun 8 13:19:11 2013 > New Revision: 251524 > URL: http://svnweb.freebsd.org/changeset/base/251524 > > Log: > Add proper __sync_*() intrinsics for MIPS. > > To make work on MIPS (and ARM) using GCC, we need to > provide implementations of the __sync_*() functions. I already added > these functions for 4 and 8 byte types to libcompiler-rt some time ago, > based on top of . > > Unfortunately, only provides a subset of the features > needed to implement . This means that in some cases we had > to do compare-and-exchange calls in loops, where a simple ll/sc would > suffice. > > Also implement these functions for 1 and 2 byte types. MIPS only > provides ll/sc instructions for 4 and 8 byte types, but this is of > course no limitation. We can simply load 4 bytes and use some bitmask > tricks to modify only the bytes affected. > > Discussed on: mips, arch > Tested with: QEMU > > Added: > head/sys/mips/mips/stdatomic.c (contents, props changed) > Modified: > head/sys/conf/files.mips > > Modified: head/sys/conf/files.mips > ============================================================================== > --- head/sys/conf/files.mips Sat Jun 8 13:13:40 2013 (r251523) > +++ head/sys/conf/files.mips Sat Jun 8 13:19:11 2013 (r251524) > @@ -35,6 +35,8 @@ mips/mips/pmap.c standard > mips/mips/ptrace_machdep.c standard > mips/mips/sc_machdep.c standard > mips/mips/stack_machdep.c optional ddb | stack > +mips/mips/stdatomic.c standard \ > + compile-with "${NORMAL_C:N-Wmissing-prototypes}" > mips/mips/support.S standard > mips/mips/swtch.S standard > mips/mips/sys_machdep.c standard > > Added: head/sys/mips/mips/stdatomic.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/mips/mips/stdatomic.c Sat Jun 8 13:19:11 2013 (r251524) > @@ -0,0 +1,436 @@ > +/*- > + * Copyright (c) 2013 Ed Schouten > + * All rights reserved. > + * > + * Copyright (c) 1998 Doug Rabson > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > + > +#ifdef _KERNEL > +#include "opt_global.h" > +#endif > + > +/* > + * Memory barriers. > + * > + * It turns out __sync_synchronize() does not emit any code when used > + * with GCC 4.2. Implement our own version that does work reliably. > + * > + * Although __sync_lock_test_and_set() should only perform an acquire > + * barrier, make it do a full barrier like the other functions. This > + * should make 's atomic_exchange_explicit() work reliably. > + */ > + > +static inline void > +mips_sync(void) > +{ > + > + __asm volatile ( > +#if !defined(_KERNEL) || defined(SMP) > + ".set noreorder\n" > + "\tsync\n" > + "\tnop\n" > + "\tnop\n" > + "\tnop\n" > + "\tnop\n" > + "\tnop\n" > + "\tnop\n" > + "\tnop\n" > + "\tnop\n" > + ".set reorder\n" > +#else /* _KERNEL && !SMP */ > + "" > +#endif /* !KERNEL || SMP */ > + : : : "memory"); > +} > + > +typedef union { > + uint8_t v8[4]; > + uint16_t v16[2]; > + uint32_t v32; > +} reg_t; > + > +/* > + * 8-bit routines. > + */ > + > +uint8_t > +__sync_lock_test_and_set_1(uint8_t *mem8, uint8_t val8) > +{ > + uint32_t *mem32; > + reg_t val32, negmask32, old; > + uint32_t temp; > + > + mem32 = (uint32_t *)((intptr_t)mem8 & ~3); > + val32.v32 = 0x00000000; > + val32.v8[(intptr_t)mem8 & 3] = val8; > + negmask32.v32 = 0xffffffff; > + negmask32.v8[(intptr_t)mem8 & 3] = 0x00; > + > + mips_sync(); > + __asm volatile ( > + "1:" > + "\tll %0, %5\n" /* Load old value. */ > + "\tand %2, %4, %0\n" /* Trim out affected part. */ > + "\tor %2, %3\n" /* Put in the new value. */ > + "\tsc %2, %1\n" /* Attempt to store. */ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ > + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) > + : "r" (val32.v32), "r" (negmask32.v32), "m" (*mem32)); > + return (old.v8[(intptr_t)mem8 & 3]); > +} > + > +uint8_t > +__sync_val_compare_and_swap_1(uint8_t *mem8, uint8_t expected, uint8_t desired) > +{ > + uint32_t *mem32; > + reg_t expected32, desired32, posmask32, negmask32, old; > + uint32_t temp; > + > + mem32 = (uint32_t *)((intptr_t)mem8 & ~3); > + expected32.v32 = 0x00000000; > + expected32.v8[(intptr_t)mem8 & 3] = expected; > + desired32.v32 = 0x00000000; > + desired32.v8[(intptr_t)mem8 & 3] = desired; > + posmask32.v32 = 0x00000000; > + posmask32.v8[(intptr_t)mem8 & 3] = 0xff; > + negmask32.v32 = ~posmask32.v32; > + > + mips_sync(); > + __asm volatile ( > + "1:" > + "\tll %0, %7\n" /* Load old value. */ > + "\tand %2, %5, %0\n" /* Isolate affected part. */ > + "\tbne %2, %3, 2f\n" /* Compare to expected value. */ > + "\tand %2, %6, %0\n" /* Trim out affected part. */ > + "\tor %2, %4\n" /* Put in the new value. */ > + "\tsc %2, %1\n" /* Attempt to store. */ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ > + "2:" > + : "=&r" (old), "=m" (*mem32), "=&r" (temp) > + : "r" (expected32.v32), "r" (desired32.v32), > + "r" (posmask32.v32), "r" (negmask32.v32), "m" (*mem32)); > + return (old.v8[(intptr_t)mem8 & 3]); > +} > + > +#define EMIT_ARITHMETIC_FETCH_AND_OP_1(name, op) \ > +uint8_t \ > +__sync_##name##_1(uint8_t *mem8, uint8_t val8) \ > +{ \ > + uint32_t *mem32; \ > + reg_t val32, posmask32, negmask32, old; \ > + uint32_t temp1, temp2; \ > + \ > + mem32 = (uint32_t *)((intptr_t)mem8 & ~3); \ > + val32.v32 = 0x00000000; \ > + val32.v8[(intptr_t)mem8 & 3] = val8; \ > + posmask32.v32 = 0x00000000; \ > + posmask32.v8[(intptr_t)mem8 & 3] = 0xff; \ > + negmask32.v32 = ~posmask32.v32; \ > + \ > + mips_sync(); \ > + __asm volatile ( \ > + "1:" \ > + "\tll %0, %7\n" /* Load old value. */ \ > + "\t"op" %2, %0, %4\n" /* Calculate new value. */ \ > + "\tand %2, %5\n" /* Isolate affected part. */ \ > + "\tand %3, %6, %0\n" /* Trim out affected part. */ \ > + "\tor %2, %3\n" /* Put in the new value. */ \ > + "\tsc %2, %1\n" /* Attempt to store. */ \ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ > + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp1), \ > + "=&r" (temp2) \ > + : "r" (val32.v32), "r" (posmask32.v32), \ > + "r" (negmask32.v32), "m" (*mem32)); \ > + return (old.v8[(intptr_t)mem8 & 3]); \ > +} > + > +EMIT_ARITHMETIC_FETCH_AND_OP_1(fetch_and_add, "addu") > +EMIT_ARITHMETIC_FETCH_AND_OP_1(fetch_and_sub, "subu") > + > +#define EMIT_BITWISE_FETCH_AND_OP_1(name, op, idempotence) \ > +uint8_t \ > +__sync_##name##_1(uint8_t *mem8, uint8_t val8) \ > +{ \ > + uint32_t *mem32; \ > + reg_t val32, old; \ > + uint32_t temp; \ > + \ > + mem32 = (uint32_t *)((intptr_t)mem8 & ~3); \ > + val32.v32 = idempotence ? 0xffffffff : 0x00000000; \ > + val32.v8[(intptr_t)mem8 & 3] = val8; \ > + \ > + mips_sync(); \ > + __asm volatile ( \ > + "1:" \ > + "\tll %0, %4\n" /* Load old value. */ \ > + "\t"op" %2, %3, %0\n" /* Calculate new value. */ \ > + "\tsc %2, %1\n" /* Attempt to store. */ \ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ > + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) \ > + : "r" (val32.v32), "m" (*mem32)); \ > + return (old.v8[(intptr_t)mem8 & 3]); \ > +} > + > +EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_and, "and", 1) > +EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_or, "or", 0) > +EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_xor, "xor", 0) > + > +/* > + * 16-bit routines. > + */ > + > +uint16_t > +__sync_lock_test_and_set_2(uint16_t *mem16, uint16_t val16) > +{ > + uint32_t *mem32; > + reg_t val32, negmask32, old; > + uint32_t temp; > + > + mem32 = (uint32_t *)((intptr_t)mem16 & ~1); > + val32.v32 = 0x00000000; > + val32.v16[(intptr_t)mem16 & 1] = val16; > + negmask32.v32 = 0xffffffff; > + negmask32.v16[(intptr_t)mem16 & 1] = 0x0000; > + > + mips_sync(); > + __asm volatile ( > + "1:" > + "\tll %0, %5\n" /* Load old value. */ > + "\tand %2, %4, %0\n" /* Trim out affected part. */ > + "\tor %2, %3\n" /* Combine to new value. */ > + "\tsc %2, %1\n" /* Attempt to store. */ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ > + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) > + : "r" (val32.v32), "r" (negmask32.v32), "m" (*mem32)); > + return (old.v16[(intptr_t)mem16 & 1]); > +} > + > +uint16_t > +__sync_val_compare_and_swap_2(uint16_t *mem16, uint16_t expected, > + uint16_t desired) > +{ > + uint32_t *mem32; > + reg_t expected32, desired32, posmask32, negmask32, old; > + uint32_t temp; > + > + mem32 = (uint32_t *)((intptr_t)mem16 & ~1); > + expected32.v32 = 0x00000000; > + expected32.v16[(intptr_t)mem16 & 1] = expected; > + desired32.v32 = 0x00000000; > + desired32.v16[(intptr_t)mem16 & 1] = desired; > + posmask32.v32 = 0x00000000; > + posmask32.v16[(intptr_t)mem16 & 1] = 0xffff; > + negmask32.v32 = ~posmask32.v32; > + > + mips_sync(); > + __asm volatile ( > + "1:" > + "\tll %0, %7\n" /* Load old value. */ > + "\tand %2, %5, %0\n" /* Isolate affected part. */ > + "\tbne %2, %3, 2f\n" /* Compare to expected value. */ > + "\tand %2, %6, %0\n" /* Trim out affected part. */ > + "\tor %2, %4\n" /* Put in the new value. */ > + "\tsc %2, %1\n" /* Attempt to store. */ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ > + "2:" > + : "=&r" (old), "=m" (*mem32), "=&r" (temp) > + : "r" (expected32.v32), "r" (desired32.v32), > + "r" (posmask32.v32), "r" (negmask32.v32), "m" (*mem32)); > + return (old.v16[(intptr_t)mem16 & 1]); > +} > + > +#define EMIT_ARITHMETIC_FETCH_AND_OP_2(name, op) \ > +uint16_t \ > +__sync_##name##_2(uint16_t *mem16, uint16_t val16) \ > +{ \ > + uint32_t *mem32; \ > + reg_t val32, posmask32, negmask32, old; \ > + uint32_t temp1, temp2; \ > + \ > + mem32 = (uint32_t *)((intptr_t)mem16 & ~3); \ > + val32.v32 = 0x00000000; \ > + val32.v16[(intptr_t)mem16 & 1] = val16; \ > + posmask32.v32 = 0x00000000; \ > + posmask32.v16[(intptr_t)mem16 & 1] = 0xffff; \ > + negmask32.v32 = ~posmask32.v32; \ > + \ > + mips_sync(); \ > + __asm volatile ( \ > + "1:" \ > + "\tll %0, %7\n" /* Load old value. */ \ > + "\t"op" %2, %0, %4\n" /* Calculate new value. */ \ > + "\tand %2, %5\n" /* Isolate affected part. */ \ > + "\tand %3, %6, %0\n" /* Trim out affected part. */ \ > + "\tor %2, %3\n" /* Combine to new value. */ \ > + "\tsc %2, %1\n" /* Attempt to store. */ \ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ > + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp1), \ > + "=&r" (temp2) \ > + : "r" (val32.v32), "r" (posmask32.v32), \ > + "r" (negmask32.v32), "m" (*mem32)); \ > + return (old.v16[(intptr_t)mem16 & 1]); \ > +} > + > +EMIT_ARITHMETIC_FETCH_AND_OP_2(fetch_and_add, "addu") > +EMIT_ARITHMETIC_FETCH_AND_OP_2(fetch_and_sub, "subu") > + > +#define EMIT_BITWISE_FETCH_AND_OP_2(name, op, idempotence) \ > +uint16_t \ > +__sync_##name##_2(uint16_t *mem16, uint16_t val16) \ > +{ \ > + uint32_t *mem32; \ > + reg_t val32, old; \ > + uint32_t temp; \ > + \ > + mem32 = (uint32_t *)((intptr_t)mem16 & ~1); \ > + val32.v32 = idempotence ? 0xffffffff : 0x00000000; \ > + val32.v16[(intptr_t)mem16 & 1] = val16; \ > + \ > + mips_sync(); \ > + __asm volatile ( \ > + "1:" \ > + "\tll %0, %4\n" /* Load old value. */ \ > + "\t"op" %2, %3, %0\n" /* Calculate new value. */ \ > + "\tsc %2, %1\n" /* Attempt to store. */ \ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ > + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) \ > + : "r" (val32.v32), "m" (*mem32)); \ > + return (old.v16[(intptr_t)mem16 & 1]); \ > +} > + > +EMIT_BITWISE_FETCH_AND_OP_2(fetch_and_and, "and", 1) > +EMIT_BITWISE_FETCH_AND_OP_2(fetch_and_or, "or", 0) > +EMIT_BITWISE_FETCH_AND_OP_2(fetch_and_xor, "xor", 0) > + > +/* > + * 32-bit routines. > + */ > + > +uint32_t > +__sync_val_compare_and_swap_4(uint32_t *mem, uint32_t expected, > + uint32_t desired) > +{ > + uint32_t old, temp; > + > + mips_sync(); > + __asm volatile ( > + "1:" > + "\tll %0, %5\n" /* Load old value. */ > + "\tbne %0, %3, 2f\n" /* Compare to expected value. */ > + "\tmove %2, %4\n" /* Value to store. */ > + "\tsc %2, %1\n" /* Attempt to store. */ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ > + "2:" > + : "=&r" (old), "=m" (*mem), "=&r" (temp) > + : "r" (expected), "r" (desired), "m" (*mem)); > + return (old); > +} > + > +#define EMIT_FETCH_AND_OP_4(name, op) \ > +uint32_t \ > +__sync_##name##_4(uint32_t *mem, uint32_t val) \ > +{ \ > + uint32_t old, temp; \ > + \ > + mips_sync(); \ > + __asm volatile ( \ > + "1:" \ > + "\tll %0, %4\n" /* Load old value. */ \ > + "\t"op"\n" /* Calculate new value. */ \ > + "\tsc %2, %1\n" /* Attempt to store. */ \ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ > + : "=&r" (old), "=m" (*mem), "=&r" (temp) \ > + : "r" (val), "m" (*mem)); \ > + return (old); \ > +} > + > +EMIT_FETCH_AND_OP_4(lock_test_and_set, "move %2, %3") > +EMIT_FETCH_AND_OP_4(fetch_and_add, "addu %2, %0, %3") > +EMIT_FETCH_AND_OP_4(fetch_and_and, "and %2, %0, %3") > +EMIT_FETCH_AND_OP_4(fetch_and_or, "or %2, %0, %3") > +EMIT_FETCH_AND_OP_4(fetch_and_sub, "subu %2, %0, %3") > +EMIT_FETCH_AND_OP_4(fetch_and_xor, "xor %2, %0, %3") > + > +/* > + * 64-bit routines. > + * > + * Note: All the 64-bit atomic operations are only atomic when running > + * in 64-bit mode. It is assumed that code compiled for n32 and n64 fits > + * into this definition and no further safeties are needed. > + */ > + > +#if defined(__mips_n32) || defined(__mips_n64) > + > +uint64_t > +__sync_val_compare_and_swap_8(uint64_t *mem, uint64_t expected, > + uint64_t desired) > +{ > + uint64_t old, temp; > + > + mips_sync(); > + __asm volatile ( > + "1:" > + "\tlld %0, %5\n" /* Load old value. */ > + "\tbne %0, %3, 2f\n" /* Compare to expected value. */ > + "\tmove %2, %4\n" /* Value to store. */ > + "\tscd %2, %1\n" /* Attempt to store. */ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ > + "2:" > + : "=&r" (old), "=m" (*mem), "=&r" (temp) > + : "r" (expected), "r" (desired), "m" (*mem)); > + return (old); > +} > + > +#define EMIT_FETCH_AND_OP_8(name, op) \ > +uint64_t \ > +__sync_##name##_8(uint64_t *mem, uint64_t val) \ > +{ \ > + uint64_t old, temp; \ > + \ > + mips_sync(); \ > + __asm volatile ( \ > + "1:" \ > + "\tlld %0, %4\n" /* Load old value. */ \ > + "\t"op"\n" /* Calculate new value. */ \ > + "\tscd %2, %1\n" /* Attempt to store. */ \ > + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ > + : "=&r" (old), "=m" (*mem), "=&r" (temp) \ > + : "r" (val), "m" (*mem)); \ > + return (old); \ > +} > + > +EMIT_FETCH_AND_OP_8(lock_test_and_set, "move %2, %3") > +EMIT_FETCH_AND_OP_8(fetch_and_add, "daddu %2, %0, %3") > +EMIT_FETCH_AND_OP_8(fetch_and_and, "and %2, %0, %3") > +EMIT_FETCH_AND_OP_8(fetch_and_or, "or %2, %0, %3") > +EMIT_FETCH_AND_OP_8(fetch_and_sub, "dsubu %2, %0, %3") > +EMIT_FETCH_AND_OP_8(fetch_and_xor, "xor %2, %0, %3") > + > +#endif /* __mips_n32 || __mips_n64 */ From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 15:45:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2BA6E6B5; Sat, 8 Jun 2013 15:45:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1DAFB1208; Sat, 8 Jun 2013 15:45:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58Fj18m008016; Sat, 8 Jun 2013 15:45:01 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58Fj1Y9008015; Sat, 8 Jun 2013 15:45:01 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306081545.r58Fj1Y9008015@svn.freebsd.org> From: Mark Johnston Date: Sat, 8 Jun 2013 15:45:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251532 - stable/9/usr.sbin/newsyslog X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 15:45:02 -0000 Author: markj Date: Sat Jun 8 15:45:01 2013 New Revision: 251532 URL: http://svnweb.freebsd.org/changeset/base/251532 Log: MFC r235647 for newsyslog (by gleb): Hide DIR definition by making it an opaque struct typedef. Introduce dirfd() libc exported symbol replacing macro with same name, preserve _dirfd() macro for internal use. Replace dirp->dd_fd with dirfd() call. Avoid using dirfd as variable name to prevent shadowing global symbol. MFC r250545: Some filesystems (NFS in particular) do not fill out the d_type field when returning directory entries through readdir(3). In this case we need to obtain the file type ourselves; otherwise newsyslog -t will not be able to find archived log files and will fail to both delete old log files and to do interval-based rotations properly. MFC r251240: We want to stat the archived log file rather than the logfile itself. Modified: stable/9/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/9/usr.sbin/newsyslog/ (props changed) Modified: stable/9/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/9/usr.sbin/newsyslog/newsyslog.c Sat Jun 8 13:48:27 2013 (r251531) +++ stable/9/usr.sbin/newsyslog/newsyslog.c Sat Jun 8 15:45:01 2013 (r251532) @@ -1450,16 +1450,27 @@ oldlog_entry_compare(const void *a, cons * tm if this is the case; otherwise return false. */ static int -validate_old_timelog(const struct dirent *dp, const char *logfname, struct tm *tm) +validate_old_timelog(int fd, const struct dirent *dp, const char *logfname, + struct tm *tm) { + struct stat sb; size_t logfname_len; char *s; int c; logfname_len = strlen(logfname); - if (dp->d_type != DT_REG) - return (0); + if (dp->d_type != DT_REG) { + /* + * Some filesystems (e.g. NFS) don't fill out the d_type field + * and leave it set to DT_UNKNOWN; in this case we must obtain + * the file type ourselves. + */ + if (dp->d_type != DT_UNKNOWN || + fstatat(fd, dp->d_name, &sb, AT_SYMLINK_NOFOLLOW) != 0 || + !S_ISREG(sb.st_mode)) + return (0); + } /* Ignore everything but files with our logfile prefix. */ if (strncmp(dp->d_name, logfname, logfname_len) != 0) return (0); @@ -1511,7 +1522,7 @@ static void delete_oldest_timelog(const struct conf_entry *ent, const char *archive_dir) { char *logfname, *s, *dir, errbuf[80]; - int dirfd, i, logcnt, max_logcnt; + int dir_fd, i, logcnt, max_logcnt; struct oldlog_entry *oldlogs; struct dirent *dp; const char *cdir; @@ -1543,9 +1554,9 @@ delete_oldest_timelog(const struct conf_ /* First we create a 'list' of all archived logfiles */ if ((dirp = opendir(dir)) == NULL) err(1, "Cannot open log directory '%s'", dir); - dirfd = dirfd(dirp); + dir_fd = dirfd(dirp); while ((dp = readdir(dirp)) != NULL) { - if (validate_old_timelog(dp, logfname, &tm) == 0) + if (validate_old_timelog(dir_fd, dp, logfname, &tm) == 0) continue; /* @@ -1593,7 +1604,7 @@ delete_oldest_timelog(const struct conf_ if (noaction) printf("\trm -f %s/%s\n", dir, oldlogs[i].fname); - else if (unlinkat(dirfd, oldlogs[i].fname, 0) != 0) { + else if (unlinkat(dir_fd, oldlogs[i].fname, 0) != 0) { snprintf(errbuf, sizeof(errbuf), "Could not delete old logfile '%s'", oldlogs[i].fname); @@ -2310,10 +2321,10 @@ mtime_old_timelog(const char *file) dir_fd = dirfd(dirp); /* Open the archive dir and find the most recent archive of logfname. */ while ((dp = readdir(dirp)) != NULL) { - if (validate_old_timelog(dp, logfname, &tm) == 0) + if (validate_old_timelog(dir_fd, dp, logfname, &tm) == 0) continue; - if (fstatat(dir_fd, logfname, &sb, 0) == -1) { + if (fstatat(dir_fd, dp->d_name, &sb, AT_SYMLINK_NOFOLLOW) == -1) { warn("Cannot stat '%s'", file); continue; } From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 15:46:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 93A668BA; Sat, 8 Jun 2013 15:46:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 855221217; Sat, 8 Jun 2013 15:46:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58Fk9Vg008291; Sat, 8 Jun 2013 15:46:09 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58Fk97u008290; Sat, 8 Jun 2013 15:46:09 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306081546.r58Fk97u008290@svn.freebsd.org> From: Mark Johnston Date: Sat, 8 Jun 2013 15:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251533 - stable/8/usr.sbin/newsyslog X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 15:46:09 -0000 Author: markj Date: Sat Jun 8 15:46:09 2013 New Revision: 251533 URL: http://svnweb.freebsd.org/changeset/base/251533 Log: MFC r235647 for newsyslog (by gleb): Hide DIR definition by making it an opaque struct typedef. Introduce dirfd() libc exported symbol replacing macro with same name, preserve _dirfd() macro for internal use. Replace dirp->dd_fd with dirfd() call. Avoid using dirfd as variable name to prevent shadowing global symbol. MFC r250545: Some filesystems (NFS in particular) do not fill out the d_type field when returning directory entries through readdir(3). In this case we need to obtain the file type ourselves; otherwise newsyslog -t will not be able to find archived log files and will fail to both delete old log files and to do interval-based rotations properly. MFC r251240: We want to stat the archived log file rather than the logfile itself. Modified: stable/8/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/8/usr.sbin/newsyslog/ (props changed) Modified: stable/8/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/8/usr.sbin/newsyslog/newsyslog.c Sat Jun 8 15:45:01 2013 (r251532) +++ stable/8/usr.sbin/newsyslog/newsyslog.c Sat Jun 8 15:46:09 2013 (r251533) @@ -1447,16 +1447,27 @@ oldlog_entry_compare(const void *a, cons * tm if this is the case; otherwise return false. */ static int -validate_old_timelog(const struct dirent *dp, const char *logfname, struct tm *tm) +validate_old_timelog(int fd, const struct dirent *dp, const char *logfname, + struct tm *tm) { + struct stat sb; size_t logfname_len; char *s; int c; logfname_len = strlen(logfname); - if (dp->d_type != DT_REG) - return (0); + if (dp->d_type != DT_REG) { + /* + * Some filesystems (e.g. NFS) don't fill out the d_type field + * and leave it set to DT_UNKNOWN; in this case we must obtain + * the file type ourselves. + */ + if (dp->d_type != DT_UNKNOWN || + fstatat(fd, dp->d_name, &sb, AT_SYMLINK_NOFOLLOW) != 0 || + !S_ISREG(sb.st_mode)) + return (0); + } /* Ignore everything but files with our logfile prefix. */ if (strncmp(dp->d_name, logfname, logfname_len) != 0) return (0); @@ -1508,7 +1519,7 @@ static void delete_oldest_timelog(const struct conf_entry *ent, const char *archive_dir) { char *logfname, *s, *dir, errbuf[80]; - int dirfd, i, logcnt, max_logcnt; + int dir_fd, i, logcnt, max_logcnt; struct oldlog_entry *oldlogs; struct dirent *dp; const char *cdir; @@ -1540,9 +1551,9 @@ delete_oldest_timelog(const struct conf_ /* First we create a 'list' of all archived logfiles */ if ((dirp = opendir(dir)) == NULL) err(1, "Cannot open log directory '%s'", dir); - dirfd = dirfd(dirp); + dir_fd = dirfd(dirp); while ((dp = readdir(dirp)) != NULL) { - if (validate_old_timelog(dp, logfname, &tm) == 0) + if (validate_old_timelog(dir_fd, dp, logfname, &tm) == 0) continue; /* @@ -1590,7 +1601,7 @@ delete_oldest_timelog(const struct conf_ if (noaction) printf("\trm -f %s/%s\n", dir, oldlogs[i].fname); - else if (unlinkat(dirfd, oldlogs[i].fname, 0) != 0) { + else if (unlinkat(dir_fd, oldlogs[i].fname, 0) != 0) { snprintf(errbuf, sizeof(errbuf), "Could not delete old logfile '%s'", oldlogs[i].fname); @@ -2276,10 +2287,10 @@ mtime_old_timelog(const char *file) dir_fd = dirfd(dirp); /* Open the archive dir and find the most recent archive of logfname. */ while ((dp = readdir(dirp)) != NULL) { - if (validate_old_timelog(dp, logfname, &tm) == 0) + if (validate_old_timelog(dir_fd, dp, logfname, &tm) == 0) continue; - if (fstatat(dir_fd, logfname, &sb, 0) == -1) { + if (fstatat(dir_fd, dp->d_name, &sb, AT_SYMLINK_NOFOLLOW) == -1) { warn("Cannot stat '%s'", file); continue; } From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 15:46:43 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 33F49B01; Sat, 8 Jun 2013 15:46:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 261CC1222; Sat, 8 Jun 2013 15:46:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58FkhcZ008408; Sat, 8 Jun 2013 15:46:43 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58FkhGE008407; Sat, 8 Jun 2013 15:46:43 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306081546.r58FkhGE008407@svn.freebsd.org> From: Mark Johnston Date: Sat, 8 Jun 2013 15:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251534 - stable/9/usr.sbin/ndp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 15:46:43 -0000 Author: markj Date: Sat Jun 8 15:46:42 2013 New Revision: 251534 URL: http://svnweb.freebsd.org/changeset/base/251534 Log: MFC r250941: Include descriptions of the flags and fields printed when dumping the IPv6 prefix list. Modified: stable/9/usr.sbin/ndp/ndp.8 Directory Properties: stable/9/usr.sbin/ndp/ (props changed) Modified: stable/9/usr.sbin/ndp/ndp.8 ============================================================================== --- stable/9/usr.sbin/ndp/ndp.8 Sat Jun 8 15:46:09 2013 (r251533) +++ stable/9/usr.sbin/ndp/ndp.8 Sat Jun 8 15:46:42 2013 (r251534) @@ -231,6 +231,36 @@ Specify the Cur Hop Limit on the interfa Do not try to resolve numeric addresses to hostnames. .It Fl p Show prefix list. +The following information will be printed: +.Bl -tag -width indent +.It Cm if +The network interface associated with this prefix. +.It Cm flags +The status of the prefix, expressed by a combination of the following +letters: +.Pp +.Bl -tag -width indent -compact +.It Cm A +This prefix can be used for stateless address autoconfiguration. +.It Cm L, Cm O +This prefix can be used for on-link determination; that is, it can be +used to determine whether a given destination address is on-link. +.It Cm D +There are no reachable routers advertising this prefix. +.El +.It Cm vltime +Valid lifetime; the length of time for which the prefix and a stateless +autoconfigured address generated from this prefix can be used for the +source or destination address of a packet. +.It Cm pltime +Preferred lifetime; the length of time for which the prefix and a stateless +autoconfigured address generated from this prefix can be used by upper-layer +protocols unrestrictedly. +.It Cm expire +This is the remaining time that the prefix is in the valid state. +.It Cm ref +The number of kernel references held for this prefix. +.El .It Fl P Flush all the entries in the prefix list. .It Fl r From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 15:47:19 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6DABEC91; Sat, 8 Jun 2013 15:47:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 60032122D; Sat, 8 Jun 2013 15:47:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58FlJM4008545; Sat, 8 Jun 2013 15:47:19 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58FlJCb008544; Sat, 8 Jun 2013 15:47:19 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306081547.r58FlJCb008544@svn.freebsd.org> From: Mark Johnston Date: Sat, 8 Jun 2013 15:47:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251535 - stable/8/usr.sbin/ndp X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 15:47:19 -0000 Author: markj Date: Sat Jun 8 15:47:18 2013 New Revision: 251535 URL: http://svnweb.freebsd.org/changeset/base/251535 Log: MFC r250941: Include descriptions of the flags and fields printed when dumping the IPv6 prefix list. Modified: stable/8/usr.sbin/ndp/ndp.8 Directory Properties: stable/8/usr.sbin/ndp/ (props changed) Modified: stable/8/usr.sbin/ndp/ndp.8 ============================================================================== --- stable/8/usr.sbin/ndp/ndp.8 Sat Jun 8 15:46:42 2013 (r251534) +++ stable/8/usr.sbin/ndp/ndp.8 Sat Jun 8 15:47:18 2013 (r251535) @@ -218,6 +218,36 @@ Specify the Cur Hop Limit on the interfa Do not try to resolve numeric addresses to hostnames. .It Fl p Show prefix list. +The following information will be printed: +.Bl -tag -width indent +.It Cm if +The network interface associated with this prefix. +.It Cm flags +The status of the prefix, expressed by a combination of the following +letters: +.Pp +.Bl -tag -width indent -compact +.It Cm A +This prefix can be used for stateless address autoconfiguration. +.It Cm L, Cm O +This prefix can be used for on-link determination; that is, it can be +used to determine whether a given destination address is on-link. +.It Cm D +There are no reachable routers advertising this prefix. +.El +.It Cm vltime +Valid lifetime; the length of time for which the prefix and a stateless +autoconfigured address generated from this prefix can be used for the +source or destination address of a packet. +.It Cm pltime +Preferred lifetime; the length of time for which the prefix and a stateless +autoconfigured address generated from this prefix can be used by upper-layer +protocols unrestrictedly. +.It Cm expire +This is the remaining time that the prefix is in the valid state. +.It Cm ref +The number of kernel references held for this prefix. +.El .It Fl P Flush all the entries in the prefix list. .It Fl r From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 15:48:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3C33AEA1; Sat, 8 Jun 2013 15:48:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2DB2F1244; Sat, 8 Jun 2013 15:48:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58Fm2Ma008679; Sat, 8 Jun 2013 15:48:02 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58Fm20F008678; Sat, 8 Jun 2013 15:48:02 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306081548.r58Fm20F008678@svn.freebsd.org> From: Mark Johnston Date: Sat, 8 Jun 2013 15:48:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251536 - stable/9/usr.sbin/rtsold X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 15:48:02 -0000 Author: markj Date: Sat Jun 8 15:48:01 2013 New Revision: 251536 URL: http://svnweb.freebsd.org/changeset/base/251536 Log: MFC r250939: Correct the description of the -a option: rtsol(d) -a will in fact send out router solicitations on multiple interfaces. MFC r251059: - Fix wording. - Improve the descriptions in the FILES section. Modified: stable/9/usr.sbin/rtsold/rtsold.8 Directory Properties: stable/9/usr.sbin/rtsold/ (props changed) Modified: stable/9/usr.sbin/rtsold/rtsold.8 ============================================================================== --- stable/9/usr.sbin/rtsold/rtsold.8 Sat Jun 8 15:47:18 2013 (r251535) +++ stable/9/usr.sbin/rtsold/rtsold.8 Sat Jun 8 15:48:01 2013 (r251536) @@ -161,15 +161,10 @@ will dump the current internal state int The options are as follows: .Bl -tag -width indent .It Fl a -Autoprobe outgoing interface. +Autoprobe outgoing interfaces. .Nm -will try to find a non-loopback, non-point-to-point, IPv6-capable interface. -If -.Nm -finds multiple interfaces, -.Nm -will exit with error. -.\" +will try to find any non-loopback, non-point-to-point, IPv6-capable interfaces +and send router solicitation messages on all of them. .It Fl d Enable debugging. .It Fl D @@ -261,10 +256,10 @@ If not, it will be .Sh FILES .Bl -tag -width /var/run/rtsold.dump -compact .It Pa /var/run/rtsold.pid -the pid of the currently running +The PID of the currently running .Nm . .It Pa /var/run/rtsold.dump -dumps internal state on. +Internal state dump file. .El .\" .Sh EXIT STATUS From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 15:48:29 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AE9B0B8; Sat, 8 Jun 2013 15:48:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A0FCB124F; Sat, 8 Jun 2013 15:48:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58FmTYs008861; Sat, 8 Jun 2013 15:48:29 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58FmTSV008860; Sat, 8 Jun 2013 15:48:29 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306081548.r58FmTSV008860@svn.freebsd.org> From: Mark Johnston Date: Sat, 8 Jun 2013 15:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251537 - stable/8/usr.sbin/rtsold X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 15:48:29 -0000 Author: markj Date: Sat Jun 8 15:48:29 2013 New Revision: 251537 URL: http://svnweb.freebsd.org/changeset/base/251537 Log: MFC r250939: Correct the description of the -a option: rtsol(d) -a will in fact send out router solicitations on multiple interfaces. MFC r251059: - Fix wording. - Improve the descriptions in the FILES section. Modified: stable/8/usr.sbin/rtsold/rtsold.8 Directory Properties: stable/8/usr.sbin/rtsold/ (props changed) Modified: stable/8/usr.sbin/rtsold/rtsold.8 ============================================================================== --- stable/8/usr.sbin/rtsold/rtsold.8 Sat Jun 8 15:48:01 2013 (r251536) +++ stable/8/usr.sbin/rtsold/rtsold.8 Sat Jun 8 15:48:29 2013 (r251537) @@ -155,15 +155,10 @@ will dump the current internal state int The options are as follows: .Bl -tag -width indent .It Fl a -Autoprobe outgoing interface. +Autoprobe outgoing interfaces. .Nm -will try to find a non-loopback, non-point-to-point, IPv6-capable interface. -If -.Nm -finds multiple interfaces, -.Nm -will exit with error. -.\" +will try to find any non-loopback, non-point-to-point, IPv6-capable interfaces +and send router solicitation messages on all of them. .It Fl d Enable debugging. .It Fl D @@ -226,10 +221,10 @@ file, and be created by the same owner w .Sh FILES .Bl -tag -width /var/run/rtsold.dump -compact .It Pa /var/run/rtsold.pid -the pid of the currently running +The PID of the currently running .Nm . .It Pa /var/run/rtsold.dump -dumps internal state on. +Internal state dump file. .El .\" .Sh SEE ALSO From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 16:02:33 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 499D87DE; Sat, 8 Jun 2013 16:02:33 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3A1EC131E; Sat, 8 Jun 2013 16:02:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58G2XWj014335; Sat, 8 Jun 2013 16:02:33 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58G2WcG014325; Sat, 8 Jun 2013 16:02:32 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201306081602.r58G2WcG014325@svn.freebsd.org> From: Rui Paulo Date: Sat, 8 Jun 2013 16:02:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251538 - in head: share/man/man4 sys/conf sys/dev/usb sys/dev/usb/wlan sys/modules/usb sys/modules/usb/urtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 16:02:33 -0000 Author: rpaulo Date: Sat Jun 8 16:02:31 2013 New Revision: 251538 URL: http://svnweb.freebsd.org/changeset/base/251538 Log: Import Kevin Lo's port of urtwn(4) from OpenBSD. urtwn(4) is a driver for the Realtek RTL8188CU/RTL8192CU USB IEEE 802.11b/g/n wireless cards. This driver requires microcode which is available in FreeBSD ports: net/urtwn-firmware-kmod. Hiren ported the urtwn(4) man page from OpenBSD and Glen just commited a port for the firmware. TODO: - 802.11n support - Stability fixes - the driver can sustain lots of traffic but has trouble coping with simultaneous iperf sessions. - fix debugging MFC after: 2 months Tested by: kevlo, hiren, gjb Added: head/share/man/man4/urtwn.4 (contents, props changed) head/sys/dev/usb/wlan/if_urtwn.c (contents, props changed) head/sys/dev/usb/wlan/if_urtwnreg.h (contents, props changed) head/sys/modules/usb/urtwn/ head/sys/modules/usb/urtwn/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/conf/NOTES head/sys/conf/files head/sys/dev/usb/usbdevs head/sys/modules/usb/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sat Jun 8 15:48:29 2013 (r251537) +++ head/share/man/man4/Makefile Sat Jun 8 16:02:31 2013 (r251538) @@ -516,6 +516,7 @@ MAN= aac.4 \ ural.4 \ urio.4 \ ${_urtw.4} \ + urtwn.4 \ usb.4 \ usb_quirk.4 \ uslcom.4 \ Added: head/share/man/man4/urtwn.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/urtwn.4 Sat Jun 8 16:02:31 2013 (r251538) @@ -0,0 +1,140 @@ +.\" $OpenBSD: urtwn.4,v 1.20 2013/05/16 10:02:59 sthen Exp $ +.\" $FreeBSD$ +.\" +.\" Copyright (c) 2010 Damien Bergamini +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd July 7, 2013 +.Dt URTWN 4 +.Os +.Sh NAME +.Nm urtwn +.Nd Realtek RTL8188CU/RTL8192CU USB IEEE 802.11b/g/n wireless network device +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ehci" +.Cd "device uhci" +.Cd "device ohci" +.Cd "device usb" +.Cd "device urtwn" +.Cd "device wlan" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_urtwn_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver supports USB 2.0 wireless network devices based on Realtek +RTL8188CUS, RTL8188CE-VAU, RTL8188RU and RTL8192CU chipsets. +.Pp +The RTL8188CUS is a highly integrated 802.11n adapter that combines +a MAC, a 1T1R capable baseband and an RF in a single chip. +It operates in the 2GHz spectrum only. +The RTL8188RU is a high-power variant of the RTL8188CUS. +The RTL8188CE-VAU is a PCI Express Mini Card adapter that attaches +to the USB interface. +.Pp +The RTL8192CU is a highly integrated multiple-in, multiple-out (MIMO) +802.11n adapter that combines a MAC, a 2T2R capable baseband and an +RF in a single chip. +It operates in the 2GHz spectrum only. +.Pp +The driver needs at least version 1.1p0 of the following firmware files, +which are loaded when an interface is attached: +.Pp +.Bl -tag -width Ds -offset indent -compact +.It urtwn-rtl8192cfwT +.It urtwn-rtl8192cfwU +.It urtwn-rtl8723fw +.El +.Pp +The firmware is available as part of the FreeBSD Ports collection in +net/urtwn-firmware-kmod. +.Sh HARDWARE +The following adapters should work: +.Pp +.Bl -tag -width Ds -offset indent -compact +.It Belkin F7D1102 Surf Wireless Micro +.It Edimax EW-7811Un +.It Netgear WNA1000M +.It Realtek RTL8192CU +.It Realtek RTL8188CUS +.El +.Sh EXAMPLES +Join an existing BSS network (i.e., connect to an access point): +.Bd -literal -offset indent +ifconfig wlan create wlandev urtwn0 inet 192.168.0.20 \e + netmask 0xffffff00 +.Ed +.Pp +Join a specific BSS network with network name +.Dq Li my_net : +.Pp +.Dl "ifconfig wlan create wlandev urtwn0 ssid my_net up" +.Pp +Join a specific BSS network with 64-bit WEP encryption: +.Bd -literal -offset indent +ifconfig wlan create wlandev urtwn0 ssid my_net \e + wepmode on wepkey 0x1234567890 weptxkey 1 up +.Ed +.Sh DIAGNOSTICS +.Bl -diag +.It "urtwn%d: error %d, could not read firmware %s" +For some reason, the driver was unable to read the microcode file from the +filesystem. +The file might be missing or corrupted. +.It "urtwn%d: device timeout" +A frame dispatched to the hardware for transmission did not complete in time. +The driver will reset the hardware. +This should not happen. +.El +.Sh SEE ALSO +.Xr intro 4 , +.Xr netintro 4 , +.Xr usb 4 , +.Xr wlan 4 , +.Xr wlan_ccmp 4 , +.Xr wlan_tkip 4 , +.Xr wlan_wep 4 , +.Xr ifconfig 8, +.Xr wpa_supplicant 8 +.Rs +.%T Realtek +.%U http://www.realtek.com.tw +.Re +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 4.9 +and +.Fx 10.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Damien Bergamini Aq damien@openbsd.org . +.Sh CAVEATS +The +.Nm +driver does not support any of the 802.11n capabilities offered by the +adapters. Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Jun 8 15:48:29 2013 (r251537) +++ head/sys/conf/NOTES Sat Jun 8 16:02:31 2013 (r251538) @@ -2747,6 +2747,9 @@ device ural # Realtek RTL8187B/L wireless driver device urtw # +# Realtek RTL8188CU/RTL8192CU wireless driver +device urtwn +# # ZyDas ZD1211/ZD1211B wireless driver device zyd # Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Jun 8 15:48:29 2013 (r251537) +++ head/sys/conf/files Sat Jun 8 16:02:31 2013 (r251538) @@ -2292,6 +2292,7 @@ dev/usb/wlan/if_uath.c optional uath dev/usb/wlan/if_upgt.c optional upgt dev/usb/wlan/if_ural.c optional ural dev/usb/wlan/if_urtw.c optional urtw +dev/usb/wlan/if_urtwn.c optional urtwn dev/usb/wlan/if_zyd.c optional zyd # # USB serial and parallel port drivers Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sat Jun 8 15:48:29 2013 (r251537) +++ head/sys/dev/usb/usbdevs Sat Jun 8 16:02:31 2013 (r251538) @@ -571,6 +571,7 @@ vendor KONTRON 0x0fe6 Kontron AG vendor QUALCOMM 0x1004 Qualcomm vendor APACER 0x1005 Apacer vendor MOTOROLA4 0x100d Motorola +vendor HP3 0x103c Hewlett Packard vendor AIRPLUS 0x1011 Airplus vendor DESKNOTE 0x1019 Desknote vendor NEC3 0x1033 NEC @@ -720,6 +721,7 @@ vendor ENCORE 0x203d Encore vendor QIHARDWARE 0x20b7 QI-hardware vendor PARA 0x20b8 PARA Industrial vendor SIMTEC 0x20df Simtec Electronics +vendor TRENDNET 0x20f4 TRENDnet vendor RTSYSTEMS 0x2100 RTSYSTEMS vendor VIALABS 0x2109 VIA Labs vendor ERICSSON 0x2282 Ericsson @@ -742,6 +744,7 @@ vendor IRIVER 0x4102 iRiver vendor DELL 0x413c Dell vendor WCH 0x4348 QinHeng Electronics vendor ACEECA 0x4766 Aceeca +vendor FEIXUN 0x4855 FeiXun Communication vendor PAPOUCH 0x5050 Papouch products vendor AVERATEC 0x50c2 Averatec vendor SWEEX 0x5173 Sweex @@ -757,6 +760,7 @@ vendor INTEL2 0x8087 Intel vendor ALLWIN 0x8516 ALLWIN Tech vendor SITECOM2 0x9016 Sitecom vendor MOSCHIP 0x9710 MosChip Semiconductor +vendor NETGEAR4 0x9846 Netgear vendor MARVELL 0x9e88 Marvell Technology Group Ltd. vendor 3COM3 0xa727 3Com vendor EVOLUTION 0xdeee Evolution Robotics products @@ -814,6 +818,9 @@ product ABOCOM HWU54DM 0xb21b HWU54DM product ABOCOM RT2573_2 0xb21c RT2573 product ABOCOM RT2573_3 0xb21d RT2573 product ABOCOM RT2573_4 0xb21e RT2573 +product ABOCOM RTL8188CU_1 0x8188 RTL8188CU +product ABOCOM RTL8188CU_2 0x8189 RTL8188CU +product ABOCOM RTL8192CU 0x8178 RTL8192CU product ABOCOM WUG2700 0xb21f WUG2700 /* Acton Research Corp. */ @@ -1126,6 +1133,7 @@ product ASUS RT2870_4 0x1760 RT2870 product ASUS RT2870_5 0x1761 RT2870 product ASUS USBN13 0x1784 USB-N13 product ASUS RT3070_1 0x1790 RT3070 +product ASUS RTL8192CU 0x17ab RTL8192CU product ASUS A730W 0x4202 ASUS MyPal A730W product ASUS P535 0x420f ASUS P535 PDA product ASUS GMSC 0x422f ASUS Generic Mass Storage @@ -1173,6 +1181,10 @@ product AZUREWAVE RT2870_2 0x3262 RT2870 product AZUREWAVE RT3070_1 0x3273 RT3070 product AZUREWAVE RT3070_2 0x3284 RT3070 product AZUREWAVE RT3070_3 0x3305 RT3070 +product AZUREWAVE RTL8188CU 0x3357 RTL8188CU +product AZUREWAVE RTL8188CE_1 0x3358 RTL8188CE +product AZUREWAVE RTL8188CE_2 0x3359 RTL8188CE + /* Baltech products */ product BALTECH CARDREADER 0x9999 Card reader @@ -1215,6 +1227,9 @@ product BELKIN F5U257 0x0257 F5U257 Ser product BELKIN F5U409 0x0409 F5U409 Serial product BELKIN F6C550AVR 0x0551 F6C550-AVR UPS product BELKIN F5U120 0x1203 F5U120-PC Hub +product BELKIN RTL8188CU 0x1102 RTL8188CU Wireless Adapter +product BELKIN RTL8192CU 0x2102 RTL8192CU Wireless Adapter +product BELKIN F7D2102 0x2103 F7D2102 Wireless Adapter product BELKIN ZD1211B 0x4050 ZD1211B product BELKIN F5D5055 0x5055 F5D5055 product BELKIN F5D7050 0x7050 F5D7050 Wireless Adapter @@ -1294,6 +1309,11 @@ product CHIC CYPRESS 0x0003 Cypress USB product CHICONY KB8933 0x0001 KB-8933 keyboard product CHICONY KU0325 0x0116 KU-0325 keyboard product CHICONY CNF7129 0xb071 Notebook Web Camera +product CHICONY RTL8188CUS_1 0xaff7 RTL8188CUS +product CHICONY RTL8188CUS_2 0xaff8 RTL8188CUS +product CHICONY RTL8188CUS_3 0xaff9 RTL8188CUS +product CHICONY RTL8188CUS_4 0xaffa RTL8188CUS +product CHICONY RTL8188CUS_5 0xaffa RTL8188CUS product CHICONY2 TWINKLECAM 0x600d TwinkleCam USB camera /* CH Products */ @@ -1383,6 +1403,7 @@ product COREGA RT2870_2 0x003c RT2870 product COREGA RT2870_3 0x003f RT2870 product COREGA RT3070 0x0041 RT3070 product COREGA CGWLUSB300GNM 0x0042 CG-WLUSB300GNM +product COREGA RTL8192CU 0x0056 RTL8192CU product COREGA WLUSB_11_STICK 0x7613 WLAN USB Stick 11 product COREGA FETHER_USB_TXC 0x9601 FEther USB-TXC @@ -1519,6 +1540,10 @@ product DLINK DSB650 0xabc1 10/100 Ethe product DLINK DUBH7 0xf103 DUB-H7 USB 2.0 7-Port Hub product DLINK DWR510_CD 0xa805 DWR-510 CD-ROM Mode product DLINK DWR510 0x7e12 DWR-510 +product DLINK RTL8188CU 0x3308 RTL8188CU +product DLINK RTL8192CU_1 0x3307 RTL8192CU +product DLINK RTL8192CU_2 0x3309 RTL8192CU +product DLINK RTL8192CU_3 0x330a RTL8192CU product DLINK2 DWA120 0x3a0c DWA-120 product DLINK2 DWA120_NF 0x3a0d DWA-120 (no firmware) product DLINK2 DWLG122C1 0x3c03 DWL-G122 c1 @@ -1559,6 +1584,7 @@ product EDIMAX RT2870_1 0x7711 RT2870 product EDIMAX EW7717 0x7717 EW-7717 product EDIMAX EW7718 0x7718 EW-7718 product EDIMAX EW7811UN 0x7811 EW-7811Un +product EDIMAX RTL8192CU 0x7822 RTL8192CU /* eGalax Products */ product EGALAX TPANEL 0x0001 Touch Panel @@ -1691,6 +1717,10 @@ product FEIYA 5IN1 0x1132 5-in-1 Card R product FEIYA ELANGO 0x6200 MicroSDHC Card Reader product FEIYA AC110 0x6300 AC-110 Card Reader +/* FeiXun Communication products */ +product FEIXUN RTL8188CU 0x0090 RTL8188CU +product FEIXUN RTL8192CU 0x0091 RTL8192CU + /* Festo */ product FESTO CPX_USB 0x0102 CPX-USB product FESTO CMSP 0x0501 CMSP @@ -2043,6 +2073,7 @@ product GUILLEMOT HWGUSB254 0xe000 HWGUS product GUILLEMOT HWGUSB254LB 0xe010 HWGUSB2-54-LB product GUILLEMOT HWGUSB254V2AP 0xe020 HWGUSB2-54V2-AP product GUILLEMOT HWNU300 0xe030 HWNU-300 +product GUILLEMOT HWNUP150 0xe033 HWNUP-150 /* Hagiwara products */ product HAGIWARA FGSM 0x0002 FlashGate SmartMedia Card Reader @@ -2066,6 +2097,7 @@ product HAWKING RT2870_1 0x0001 RT2870 product HAWKING RT2870_2 0x0003 RT2870 product HAWKING HWUN2 0x0009 HWUN2 product HAWKING RT3070 0x000b RT3070 +product HAWKING RTL8192CU 0x0019 RTL8192CU product HAWKING UF100 0x400c 10/100 USB Ethernet /* HID Global GmbH products */ @@ -2115,6 +2147,7 @@ product HP 5400C 0x1005 Scanjet 5400C product HP 2215 0x1016 iPAQ 22xx/Jornada 548 product HP 568J 0x1116 Jornada 568 product HP 930C 0x1204 DeskJet 930c +product HP3 RTL8188CU 0x1629 RTL8188CU product HP P2000U 0x1801 Inkjet P-2000U product HP HS2300 0x1e1d HS2300 HSDPA (aka MC8775) product HP 640C 0x2004 DeskJet 640c @@ -3024,6 +3057,8 @@ product NETGEAR WG111V3 0x4260 WG111v3 product NETGEAR WG111U 0x4300 WG111U product NETGEAR WG111U_NF 0x4301 WG111U (no firmware) product NETGEAR WG111V2 0x6a00 WG111V2 +product NETGEAR RTL8192CU 0x9021 RTL8192CU +product NETGEAR WNA1000M 0x9041 WNA1000M product NETGEAR2 MA101 0x4100 MA101 product NETGEAR2 MA101B 0x4102 MA101 Rev B product NETGEAR3 WG111T 0x4250 WG111T @@ -3031,6 +3066,7 @@ product NETGEAR3 WG111T_NF 0x4251 WG111T product NETGEAR3 WPN111 0x5f00 WPN111 product NETGEAR3 WPN111_NF 0x5f01 WPN111 (no firmware) product NETGEAR3 WPN111_2 0x5f02 WPN111 +product NETGEAR4 RTL8188CU 0x9041 RTL8188CU /* NetIndex products */ product NETINDEX WS002IN 0x2001 Willcom WS002IN @@ -3046,6 +3082,7 @@ product NIKON D300 0x041a Digital Came /* NovaTech Products */ product NOVATECH NV902 0x9020 NovaTech NV-902W product NOVATECH RT2573 0x9021 RT2573 +product NOVATECH RTL8188CU 0x9071 RTL8188CU /* Nokia products */ product NOKIA N958GB 0x0070 Nokia N95 8GBc @@ -3274,8 +3311,14 @@ product PIENGINEERING PS2USB 0x020b PS2 /* Planex Communications products */ product PLANEX GW_US11H 0x14ea GW-US11H WLAN +product PLANEX2 RTL8188CUS 0x1201 RTL8188CUS product PLANEX2 GW_US11S 0x3220 GW-US11S WLAN product PLANEX2 GW_US54GXS 0x5303 GW-US54GXS WLAN +product PLANEX2 RTL8188CU_1 0xab2a RTL8188CU +product PLANEX2 RTL8188CU_2 0xed17 RTL8188CU +product PLANEX2 RTL8188CU_3 0x4902 RTL8188CU +product PLANEX2 RTL8188CU_4 0xab2e RTL8188CU +product PLANEX2 RTL8192CU 0xab2b RTL8192CU product PLANEX2 GWUS54HP 0xab01 GW-US54HP product PLANEX2 GWUS300MINIS 0xab24 GW-US300MiniS product PLANEX2 RT3070 0xab25 RT3070 @@ -3502,11 +3545,24 @@ product RATOC REXUSB60F 0xb020 USB seri /* Green House and CompUSA OEM this part */ product REALTEK DUMMY 0x0000 Dummy product product REALTEK USB20CRW 0x0158 USB20CRW Card Reader +product REALTEK RTL8188CTV 0x018a RTL8188CTV product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet +product REALTEK RTL8188CE_0 0x8170 RTL8188CE +product REALTEK RTL8188CE_1 0x817e RTL8188CE +product REALTEK RTL8188CU_0 0x8176 RTL8188CU +product REALTEK RTL8188CU_1 0x817a RTL8188CU +product REALTEK RTL8188CU_2 0x817b RTL8188CU product REALTEK RTL8187 0x8187 RTL8187 Wireless Adapter product REALTEK RTL8187B_0 0x8189 RTL8187B Wireless Adapter product REALTEK RTL8187B_1 0x8197 RTL8187B Wireless Adapter product REALTEK RTL8187B_2 0x8198 RTL8187B Wireless Adapter +product REALTEK RTL8188CUS 0x818a RTL8188CUS +product REALTEK RTL8188CU_COMBO 0x8754 RTL8188CU +product REALTEK RTL8191CU 0x8177 RTL8191CU +product REALTEK RTL8192CU 0x8178 RTL8192CU +product REALTEK RTL8192CE 0x817c RTL8192CE +product REALTEK RTL8188RU_1 0x817d RTL8188RU +product REALTEK RTL8188RU_2 0x317f RTL8188RU /* RedOctane products */ product REDOCTANE DUMMY 0x0000 Dummy product @@ -3881,6 +3937,9 @@ product SITECOMEU RT3072_3 0x0047 RT3072 product SITECOMEU RT3072_4 0x0048 RT3072 product SITECOMEU RT3072_5 0x004a RT3072 product SITECOMEU RT3072_6 0x004d RT3072 +product SITECOMEU RTL8188CU_1 0x0052 RTL8188CU +product SITECOMEU RTL8188CU_2 0x005c RTL8188CU +product SITECOMEU RTL8192CU 0x0061 RTL8192CU product SITECOMEU LN028 0x061c LN-028 product SITECOMEU WL113 0x9071 WL-113 product SITECOMEU ZD1211B 0x9075 ZD1211B @@ -4110,6 +4169,10 @@ product TREK THUMBDRIVE 0x1111 ThumbDri product TREK MEMKEY 0x8888 IBM USB Memory Key product TREK THUMBDRIVE_8MB 0x9988 ThumbDrive_8MB +/* TRENDnet products */ +product TRENDNET RTL8192CU 0x624d RTL8192CU +product TRENDNET RTL8188CU 0x648b RTL8188CU + /* Tripp-Lite products */ product TRIPPLITE U209 0x2008 Serial @@ -4319,3 +4382,4 @@ product ZYXEL G220V2 0x340f G-220 v2 product ZYXEL G202 0x3410 G-202 product ZYXEL RT2870_1 0x3416 RT2870 product ZYXEL RT2870_2 0x341a RT2870 +product ZYXEL RTL8192CU 0x341f RTL8192CU Added: head/sys/dev/usb/wlan/if_urtwn.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/wlan/if_urtwn.c Sat Jun 8 16:02:31 2013 (r251538) @@ -0,0 +1,3016 @@ +/* $OpenBSD: if_urtwn.c,v 1.16 2011/02/10 17:26:40 jakemsr Exp $ */ + +/*- + * Copyright (c) 2010 Damien Bergamini + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188RU/RTL8192CU. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include "usbdevs.h" + +#define USB_DEBUG_VAR urtwn_debug +#include + +#include + +#ifdef USB_DEBUG +static int urtwn_debug = 0; + +SYSCTL_NODE(_hw_usb, OID_AUTO, urtwn, CTLFLAG_RW, 0, "USB urtwn"); +SYSCTL_INT(_hw_usb_urtwn, OID_AUTO, debug, CTLFLAG_RW, &urtwn_debug, 0, + "Debug level"); +#endif + +#define IEEE80211_HAS_ADDR4(wh) \ + (((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) + +/* various supported device vendors/products */ +static const struct usb_device_id urtwn_devs[] = { +#define URTWN_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } + URTWN_DEV(ABOCOM, RTL8188CU_1), + URTWN_DEV(ABOCOM, RTL8188CU_2), + URTWN_DEV(ABOCOM, RTL8192CU), + URTWN_DEV(ASUS, RTL8192CU), + URTWN_DEV(AZUREWAVE, RTL8188CE_1), + URTWN_DEV(AZUREWAVE, RTL8188CE_2), + URTWN_DEV(AZUREWAVE, RTL8188CU), + URTWN_DEV(BELKIN, F7D2102), + URTWN_DEV(BELKIN, RTL8188CU), + URTWN_DEV(BELKIN, RTL8192CU), + URTWN_DEV(CHICONY, RTL8188CUS_1), + URTWN_DEV(CHICONY, RTL8188CUS_2), + URTWN_DEV(CHICONY, RTL8188CUS_3), + URTWN_DEV(CHICONY, RTL8188CUS_4), + URTWN_DEV(CHICONY, RTL8188CUS_5), + URTWN_DEV(COREGA, RTL8192CU), + URTWN_DEV(DLINK, RTL8188CU), + URTWN_DEV(DLINK, RTL8192CU_1), + URTWN_DEV(DLINK, RTL8192CU_2), + URTWN_DEV(DLINK, RTL8192CU_3), + URTWN_DEV(EDIMAX, EW7811UN), + URTWN_DEV(EDIMAX, RTL8192CU), + URTWN_DEV(FEIXUN, RTL8188CU), + URTWN_DEV(FEIXUN, RTL8192CU), + URTWN_DEV(GUILLEMOT, HWNUP150), + URTWN_DEV(HAWKING, RTL8192CU), + URTWN_DEV(HP3, RTL8188CU), + URTWN_DEV(NETGEAR, WNA1000M), + URTWN_DEV(NETGEAR, RTL8192CU), + URTWN_DEV(NETGEAR4, RTL8188CU), + URTWN_DEV(NOVATECH, RTL8188CU), + URTWN_DEV(PLANEX2, RTL8188CU_1), + URTWN_DEV(PLANEX2, RTL8188CU_2), + URTWN_DEV(PLANEX2, RTL8188CU_3), + URTWN_DEV(PLANEX2, RTL8188CU_4), + URTWN_DEV(PLANEX2, RTL8188CUS), + URTWN_DEV(PLANEX2, RTL8192CU), + URTWN_DEV(REALTEK, RTL8188CE_0), + URTWN_DEV(REALTEK, RTL8188CE_1), + URTWN_DEV(REALTEK, RTL8188CTV), + URTWN_DEV(REALTEK, RTL8188CU_0), + URTWN_DEV(REALTEK, RTL8188CU_1), + URTWN_DEV(REALTEK, RTL8188CU_2), + URTWN_DEV(REALTEK, RTL8188CU_COMBO), + URTWN_DEV(REALTEK, RTL8188CUS), + URTWN_DEV(REALTEK, RTL8188RU_1), + URTWN_DEV(REALTEK, RTL8188RU_2), + URTWN_DEV(REALTEK, RTL8191CU), + URTWN_DEV(REALTEK, RTL8192CE), + URTWN_DEV(REALTEK, RTL8192CU), + URTWN_DEV(SITECOMEU, RTL8188CU_1), + URTWN_DEV(SITECOMEU, RTL8188CU_2), + URTWN_DEV(SITECOMEU, RTL8192CU), + URTWN_DEV(TRENDNET, RTL8188CU), + URTWN_DEV(TRENDNET, RTL8192CU), + URTWN_DEV(ZYXEL, RTL8192CU), +#undef URTWN_DEV +}; + +static device_probe_t urtwn_match; +static device_attach_t urtwn_attach; +static device_detach_t urtwn_detach; + +static usb_callback_t urtwn_bulk_tx_callback; +static usb_callback_t urtwn_bulk_rx_callback; + +static usb_error_t urtwn_do_request(struct urtwn_softc *sc, + struct usb_device_request *req, void *data); +static struct ieee80211vap *urtwn_vap_create(struct ieee80211com *, + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); +static void urtwn_vap_delete(struct ieee80211vap *); +static struct mbuf * urtwn_rx_frame(struct urtwn_softc *, uint8_t *, int, + int *); +static struct mbuf * urtwn_rxeof(struct usb_xfer *, struct urtwn_data *, + int *, int8_t *); +static void urtwn_txeof(struct usb_xfer *, struct urtwn_data *); +static int urtwn_alloc_list(struct urtwn_softc *, + struct urtwn_data[], int, int); +static int urtwn_alloc_rx_list(struct urtwn_softc *); +static int urtwn_alloc_tx_list(struct urtwn_softc *); +static void urtwn_free_tx_list(struct urtwn_softc *); +static void urtwn_free_rx_list(struct urtwn_softc *); +static void urtwn_free_list(struct urtwn_softc *, + struct urtwn_data data[], int); +static struct urtwn_data * _urtwn_getbuf(struct urtwn_softc *); +static struct urtwn_data * urtwn_getbuf(struct urtwn_softc *); +static int urtwn_write_region_1(struct urtwn_softc *, uint16_t, + uint8_t *, int); +static void urtwn_write_1(struct urtwn_softc *, uint16_t, uint8_t); +static void urtwn_write_2(struct urtwn_softc *, uint16_t, uint16_t); +static void urtwn_write_4(struct urtwn_softc *, uint16_t, uint32_t); +static int urtwn_read_region_1(struct urtwn_softc *, uint16_t, + uint8_t *, int); +static uint8_t urtwn_read_1(struct urtwn_softc *, uint16_t); +static uint16_t urtwn_read_2(struct urtwn_softc *, uint16_t); +static uint32_t urtwn_read_4(struct urtwn_softc *, uint16_t); +static int urtwn_fw_cmd(struct urtwn_softc *, uint8_t, + const void *, int); +static void urtwn_rf_write(struct urtwn_softc *, int, uint8_t, + uint32_t); +static uint32_t urtwn_rf_read(struct urtwn_softc *, int, uint8_t); +static int urtwn_llt_write(struct urtwn_softc *, uint32_t, + uint32_t); +static uint8_t urtwn_efuse_read_1(struct urtwn_softc *, uint16_t); +static void urtwn_efuse_read(struct urtwn_softc *); +static int urtwn_read_chipid(struct urtwn_softc *); +static void urtwn_read_rom(struct urtwn_softc *); +static int urtwn_ra_init(struct urtwn_softc *); +static void urtwn_tsf_sync_enable(struct urtwn_softc *); +static void urtwn_set_led(struct urtwn_softc *, int, int); +static int urtwn_newstate(struct ieee80211vap *, + enum ieee80211_state, int); +static void urtwn_watchdog(void *); +static void urtwn_update_avgrssi(struct urtwn_softc *, int, int8_t); +static int8_t urtwn_get_rssi(struct urtwn_softc *, int, void *); +static int urtwn_tx_start(struct urtwn_softc *, + struct ieee80211_node *, struct mbuf *, + struct urtwn_data *); +static void urtwn_start(struct ifnet *); +static int urtwn_ioctl(struct ifnet *, u_long, caddr_t); +static int urtwn_power_on(struct urtwn_softc *); +static int urtwn_llt_init(struct urtwn_softc *); +static void urtwn_fw_reset(struct urtwn_softc *); +static int urtwn_fw_loadpage(struct urtwn_softc *, int, + const uint8_t *, int); +static int urtwn_load_firmware(struct urtwn_softc *); +static int urtwn_dma_init(struct urtwn_softc *); +static void urtwn_mac_init(struct urtwn_softc *); +static void urtwn_bb_init(struct urtwn_softc *); +static void urtwn_rf_init(struct urtwn_softc *); +static void urtwn_cam_init(struct urtwn_softc *); +static void urtwn_pa_bias_init(struct urtwn_softc *); +static void urtwn_rxfilter_init(struct urtwn_softc *); +static void urtwn_edca_init(struct urtwn_softc *); +static void urtwn_write_txpower(struct urtwn_softc *, int, + uint16_t[]); +static void urtwn_get_txpower(struct urtwn_softc *, int, + struct ieee80211_channel *, + struct ieee80211_channel *, uint16_t[]); +static void urtwn_set_txpower(struct urtwn_softc *, + struct ieee80211_channel *, + struct ieee80211_channel *); +static void urtwn_scan_start(struct ieee80211com *); +static void urtwn_scan_end(struct ieee80211com *); +static void urtwn_set_channel(struct ieee80211com *); +static void urtwn_set_chan(struct urtwn_softc *, + struct ieee80211_channel *, + struct ieee80211_channel *); +static void urtwn_update_mcast(struct ifnet *); +static void urtwn_iq_calib(struct urtwn_softc *); +static void urtwn_lc_calib(struct urtwn_softc *); +static void urtwn_init(void *); +static void urtwn_init_locked(void *); +static void urtwn_stop(struct ifnet *, int); +static void urtwn_stop_locked(struct ifnet *, int); +static void urtwn_abort_xfers(struct urtwn_softc *); +static int urtwn_raw_xmit(struct ieee80211_node *, struct mbuf *, + const struct ieee80211_bpf_params *); + +/* Aliases. */ +#define urtwn_bb_write urtwn_write_4 +#define urtwn_bb_read urtwn_read_4 + +static const struct usb_config urtwn_config[URTWN_N_TRANSFER] = { + [URTWN_BULK_RX] = { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .bufsize = URTWN_RXBUFSZ, + .flags = { + .pipe_bof = 1, + .short_xfer_ok = 1 + }, + .callback = urtwn_bulk_rx_callback, + }, + [URTWN_BULK_TX_BE] = { + .type = UE_BULK, + .endpoint = 0x03, + .direction = UE_DIR_OUT, + .bufsize = URTWN_TXBUFSZ, + .flags = { + .ext_buffer = 1, + .pipe_bof = 1, + .force_short_xfer = 1 + }, + .callback = urtwn_bulk_tx_callback, + .timeout = URTWN_TX_TIMEOUT, /* ms */ + }, + [URTWN_BULK_TX_BK] = { + .type = UE_BULK, + .endpoint = 0x03, + .direction = UE_DIR_OUT, + .bufsize = URTWN_TXBUFSZ, + .flags = { + .ext_buffer = 1, + .pipe_bof = 1, + .force_short_xfer = 1, + }, + .callback = urtwn_bulk_tx_callback, + .timeout = URTWN_TX_TIMEOUT, /* ms */ + }, + [URTWN_BULK_TX_VI] = { + .type = UE_BULK, + .endpoint = 0x02, + .direction = UE_DIR_OUT, + .bufsize = URTWN_TXBUFSZ, + .flags = { + .ext_buffer = 1, + .pipe_bof = 1, + .force_short_xfer = 1 + }, + .callback = urtwn_bulk_tx_callback, + .timeout = URTWN_TX_TIMEOUT, /* ms */ + }, + [URTWN_BULK_TX_VO] = { + .type = UE_BULK, + .endpoint = 0x02, + .direction = UE_DIR_OUT, + .bufsize = URTWN_TXBUFSZ, + .flags = { + .ext_buffer = 1, + .pipe_bof = 1, + .force_short_xfer = 1 + }, + .callback = urtwn_bulk_tx_callback, + .timeout = URTWN_TX_TIMEOUT, /* ms */ + }, +}; + +static int +urtwn_match(device_t self) +{ + struct usb_attach_arg *uaa = device_get_ivars(self); + + if (uaa->usb_mode != USB_MODE_HOST) + return (ENXIO); + if (uaa->info.bConfigIndex != URTWN_CONFIG_INDEX) + return (ENXIO); + if (uaa->info.bIfaceIndex != URTWN_IFACE_INDEX) + return (ENXIO); + + return (usbd_lookup_id_by_uaa(urtwn_devs, sizeof(urtwn_devs), uaa)); +} + +static int +urtwn_attach(device_t self) +{ + struct usb_attach_arg *uaa = device_get_ivars(self); + struct urtwn_softc *sc = device_get_softc(self); + struct ifnet *ifp; + struct ieee80211com *ic; + uint8_t iface_index, bands; + int error; + + device_set_usb_desc(self); + sc->sc_udev = uaa->device; + sc->sc_dev = self; + + mtx_init(&sc->sc_mtx, device_get_nameunit(self), + MTX_NETWORK_LOCK, MTX_DEF); + callout_init(&sc->sc_watchdog_ch, 0); + + iface_index = URTWN_IFACE_INDEX; + error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, + urtwn_config, URTWN_N_TRANSFER, sc, &sc->sc_mtx); + if (error) { + device_printf(self, "could not allocate USB transfers, " + "err=%s\n", usbd_errstr(error)); + goto detach; + } + + URTWN_LOCK(sc); + + error = urtwn_read_chipid(sc); + if (error) { + device_printf(sc->sc_dev, "unsupported test chip\n"); + URTWN_UNLOCK(sc); + goto detach; + } + + /* Determine number of Tx/Rx chains. */ + if (sc->chip & URTWN_CHIP_92C) { + sc->ntxchains = (sc->chip & URTWN_CHIP_92C_1T2R) ? 1 : 2; + sc->nrxchains = 2; + } else { + sc->ntxchains = 1; + sc->nrxchains = 1; + } + urtwn_read_rom(sc); + + device_printf(sc->sc_dev, "MAC/BB RTL%s, RF 6052 %dT%dR\n", + (sc->chip & URTWN_CHIP_92C) ? "8192CU" : + (sc->board_type == R92C_BOARD_TYPE_HIGHPA) ? "8188RU" : + (sc->board_type == R92C_BOARD_TYPE_MINICARD) ? "8188CE-VAU" : + "8188CUS", sc->ntxchains, sc->nrxchains); + + URTWN_UNLOCK(sc); + + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); + if (ifp == NULL) { + device_printf(sc->sc_dev, "can not if_alloc()\n"); + goto detach; + } + ic = ifp->if_l2com; + + ifp->if_softc = sc; + if_initname(ifp, "urtwn", device_get_unit(sc->sc_dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_init = urtwn_init; + ifp->if_ioctl = urtwn_ioctl; + ifp->if_start = urtwn_start; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + ic->ic_ifp = ifp; + ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ + ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */ + + /* set device capabilities */ + ic->ic_caps = + IEEE80211_C_STA /* station mode */ + | IEEE80211_C_MONITOR /* monitor mode */ + | IEEE80211_C_SHPREAMBLE /* short preamble supported */ + | IEEE80211_C_SHSLOT /* short slot time supported */ + | IEEE80211_C_BGSCAN /* capable of bg scanning */ + | IEEE80211_C_WPA /* 802.11i */ + ; + + bands = 0; + setbit(&bands, IEEE80211_MODE_11B); + setbit(&bands, IEEE80211_MODE_11G); + ieee80211_init_channels(ic, NULL, &bands); + + ieee80211_ifattach(ic, sc->sc_bssid); + ic->ic_raw_xmit = urtwn_raw_xmit; + ic->ic_scan_start = urtwn_scan_start; + ic->ic_scan_end = urtwn_scan_end; + ic->ic_set_channel = urtwn_set_channel; + + ic->ic_vap_create = urtwn_vap_create; + ic->ic_vap_delete = urtwn_vap_delete; + ic->ic_update_mcast = urtwn_update_mcast; + + ieee80211_radiotap_attach(ic, &sc->sc_txtap.wt_ihdr, + sizeof(sc->sc_txtap), URTWN_TX_RADIOTAP_PRESENT, + &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), + URTWN_RX_RADIOTAP_PRESENT); + + if (bootverbose) + ieee80211_announce(ic); + + return (0); + +detach: + urtwn_detach(self); + return (ENXIO); /* failure */ +} + +static int +urtwn_detach(device_t self) +{ + struct urtwn_softc *sc = device_get_softc(self); + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + + if (!device_is_attached(self)) + return (0); + + urtwn_stop(ifp, 1); + + callout_drain(&sc->sc_watchdog_ch); + + /* stop all USB transfers */ + usbd_transfer_unsetup(sc->sc_xfer, URTWN_N_TRANSFER); + ieee80211_ifdetach(ic); + + urtwn_free_tx_list(sc); + urtwn_free_rx_list(sc); + + if_free(ifp); + mtx_destroy(&sc->sc_mtx); + + return (0); +} + +static void +urtwn_free_tx_list(struct urtwn_softc *sc) +{ + urtwn_free_list(sc, sc->sc_tx, URTWN_TX_LIST_COUNT); +} + +static void +urtwn_free_rx_list(struct urtwn_softc *sc) +{ + urtwn_free_list(sc, sc->sc_rx, URTWN_RX_LIST_COUNT); +} + +static void +urtwn_free_list(struct urtwn_softc *sc, struct urtwn_data data[], int ndata) +{ + int i; + + for (i = 0; i < ndata; i++) { + struct urtwn_data *dp = &data[i]; + + if (dp->buf != NULL) { + free(dp->buf, M_USBDEV); + dp->buf = NULL; + } + if (dp->ni != NULL) { + ieee80211_free_node(dp->ni); + dp->ni = NULL; + } + } +} + +static usb_error_t +urtwn_do_request(struct urtwn_softc *sc, struct usb_device_request *req, + void *data) +{ + usb_error_t err; + int ntries = 10; + + URTWN_ASSERT_LOCKED(sc); + + while (ntries--) { + err = usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, + req, data, 0, NULL, 250 /* ms */); + if (err == 0) + break; + + DPRINTFN(1, "Control request failed, %s (retrying)\n", + usbd_errstr(err)); + usb_pause_mtx(&sc->sc_mtx, hz / 100); + } + return (err); +} + +static struct ieee80211vap * +urtwn_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) +{ + struct urtwn_vap *uvp; + struct ieee80211vap *vap; + + if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */ + return (NULL); + + uvp = (struct urtwn_vap *) malloc(sizeof(struct urtwn_vap), + M_80211_VAP, M_NOWAIT | M_ZERO); + if (uvp == NULL) + return (NULL); + vap = &uvp->vap; + /* enable s/w bmiss handling for sta mode */ + ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + + /* override state transition machine */ + uvp->newstate = vap->iv_newstate; + vap->iv_newstate = urtwn_newstate; + + /* complete setup */ + ieee80211_vap_attach(vap, ieee80211_media_change, + ieee80211_media_status); + ic->ic_opmode = opmode; + return (vap); +} + +static void +urtwn_vap_delete(struct ieee80211vap *vap) +{ + struct urtwn_vap *uvp = URTWN_VAP(vap); + + ieee80211_vap_detach(vap); + free(uvp, M_80211_VAP); +} + +static struct mbuf * +urtwn_rx_frame(struct urtwn_softc *sc, uint8_t *buf, int pktlen, int *rssi_p) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211_frame *wh; + struct mbuf *m; + struct r92c_rx_stat *stat; + uint32_t rxdw0, rxdw3; + uint8_t rate; + int8_t rssi = 0; + int infosz; + + /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 16:24:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 92972DF3; Sat, 8 Jun 2013 16:24:49 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 765101449; Sat, 8 Jun 2013 16:24:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58GOnOh021260; Sat, 8 Jun 2013 16:24:49 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58GOnJF021259; Sat, 8 Jun 2013 16:24:49 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201306081624.r58GOnJF021259@svn.freebsd.org> From: Ed Schouten Date: Sat, 8 Jun 2013 16:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251539 - head/sys/mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 16:24:49 -0000 Author: ed Date: Sat Jun 8 16:24:49 2013 New Revision: 251539 URL: http://svnweb.freebsd.org/changeset/base/251539 Log: Actually make the 2-byte atomics work. Even though I tested the 1-byte operations on arbitrarily aligned bytes, it seems I did not do this for the 2-byte operations. Create easy to read functions that are used to get/put bytes and halfwords in words. To keep the compiler happy, explicitly read two bytes into a union to obtain a 16-bit value. Modified: head/sys/mips/mips/stdatomic.c Modified: head/sys/mips/mips/stdatomic.c ============================================================================== --- head/sys/mips/mips/stdatomic.c Sat Jun 8 16:02:31 2013 (r251538) +++ head/sys/mips/mips/stdatomic.c Sat Jun 8 16:24:49 2013 (r251539) @@ -72,14 +72,38 @@ mips_sync(void) typedef union { uint8_t v8[4]; - uint16_t v16[2]; uint32_t v32; } reg_t; +static inline uint32_t * +round_to_word(void *ptr) +{ + + return ((uint32_t *)((intptr_t)ptr & ~3)); +} + /* * 8-bit routines. */ +static inline void +put_1(reg_t *r, uint8_t *offset_ptr, uint8_t val) +{ + size_t offset; + + offset = (intptr_t)offset_ptr & 3; + r->v8[offset] = val; +} + +static inline uint8_t +get_1(const reg_t *r, uint8_t *offset_ptr) +{ + size_t offset; + + offset = (intptr_t)offset_ptr & 3; + return (r->v8[offset]); +} + uint8_t __sync_lock_test_and_set_1(uint8_t *mem8, uint8_t val8) { @@ -87,11 +111,11 @@ __sync_lock_test_and_set_1(uint8_t *mem8 reg_t val32, negmask32, old; uint32_t temp; - mem32 = (uint32_t *)((intptr_t)mem8 & ~3); + mem32 = round_to_word(mem8); val32.v32 = 0x00000000; - val32.v8[(intptr_t)mem8 & 3] = val8; + put_1(&val32, mem8, val8); negmask32.v32 = 0xffffffff; - negmask32.v8[(intptr_t)mem8 & 3] = 0x00; + put_1(&negmask32, mem8, val8); mips_sync(); __asm volatile ( @@ -103,7 +127,7 @@ __sync_lock_test_and_set_1(uint8_t *mem8 "\tbeqz %2, 1b\n" /* Spin if failed. */ : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) : "r" (val32.v32), "r" (negmask32.v32), "m" (*mem32)); - return (old.v8[(intptr_t)mem8 & 3]); + return (get_1(&old, mem8)); } uint8_t @@ -113,13 +137,13 @@ __sync_val_compare_and_swap_1(uint8_t *m reg_t expected32, desired32, posmask32, negmask32, old; uint32_t temp; - mem32 = (uint32_t *)((intptr_t)mem8 & ~3); + mem32 = round_to_word(mem8); expected32.v32 = 0x00000000; - expected32.v8[(intptr_t)mem8 & 3] = expected; + put_1(&expected32, mem8, expected); desired32.v32 = 0x00000000; - desired32.v8[(intptr_t)mem8 & 3] = desired; + put_1(&desired32, mem8, desired); posmask32.v32 = 0x00000000; - posmask32.v8[(intptr_t)mem8 & 3] = 0xff; + put_1(&posmask32, mem8, 0xff); negmask32.v32 = ~posmask32.v32; mips_sync(); @@ -136,7 +160,7 @@ __sync_val_compare_and_swap_1(uint8_t *m : "=&r" (old), "=m" (*mem32), "=&r" (temp) : "r" (expected32.v32), "r" (desired32.v32), "r" (posmask32.v32), "r" (negmask32.v32), "m" (*mem32)); - return (old.v8[(intptr_t)mem8 & 3]); + return (get_1(&old, mem8)); } #define EMIT_ARITHMETIC_FETCH_AND_OP_1(name, op) \ @@ -147,11 +171,11 @@ __sync_##name##_1(uint8_t *mem8, uint8_t reg_t val32, posmask32, negmask32, old; \ uint32_t temp1, temp2; \ \ - mem32 = (uint32_t *)((intptr_t)mem8 & ~3); \ + mem32 = round_to_word(mem8); \ val32.v32 = 0x00000000; \ - val32.v8[(intptr_t)mem8 & 3] = val8; \ + put_1(&val32, mem8, val8); \ posmask32.v32 = 0x00000000; \ - posmask32.v8[(intptr_t)mem8 & 3] = 0xff; \ + put_1(&posmask32, mem8, 0xff); \ negmask32.v32 = ~posmask32.v32; \ \ mips_sync(); \ @@ -168,7 +192,7 @@ __sync_##name##_1(uint8_t *mem8, uint8_t "=&r" (temp2) \ : "r" (val32.v32), "r" (posmask32.v32), \ "r" (negmask32.v32), "m" (*mem32)); \ - return (old.v8[(intptr_t)mem8 & 3]); \ + return (get_1(&old, mem8)); \ } EMIT_ARITHMETIC_FETCH_AND_OP_1(fetch_and_add, "addu") @@ -182,9 +206,9 @@ __sync_##name##_1(uint8_t *mem8, uint8_t reg_t val32, old; \ uint32_t temp; \ \ - mem32 = (uint32_t *)((intptr_t)mem8 & ~3); \ + mem32 = round_to_word(mem8); \ val32.v32 = idempotence ? 0xffffffff : 0x00000000; \ - val32.v8[(intptr_t)mem8 & 3] = val8; \ + put_1(&val32, mem8, val8); \ \ mips_sync(); \ __asm volatile ( \ @@ -195,7 +219,7 @@ __sync_##name##_1(uint8_t *mem8, uint8_t "\tbeqz %2, 1b\n" /* Spin if failed. */ \ : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) \ : "r" (val32.v32), "m" (*mem32)); \ - return (old.v8[(intptr_t)mem8 & 3]); \ + return (get_1(&old, mem8)); \ } EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_and, "and", 1) @@ -206,6 +230,36 @@ EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_xo * 16-bit routines. */ +static inline void +put_2(reg_t *r, uint16_t *offset_ptr, uint16_t val) +{ + size_t offset; + union { + uint16_t in; + uint8_t out[2]; + } bytes; + + offset = (intptr_t)offset_ptr & 3; + bytes.in = val; + r->v8[offset] = bytes.out[0]; + r->v8[offset + 1] = bytes.out[1]; +} + +static inline uint16_t +get_2(const reg_t *r, uint16_t *offset_ptr) +{ + size_t offset; + union { + uint8_t in[2]; + uint16_t out; + } bytes; + + offset = (intptr_t)offset_ptr & 3; + bytes.in[0] = r->v8[offset]; + bytes.in[1] = r->v8[offset + 1]; + return (bytes.out); +} + uint16_t __sync_lock_test_and_set_2(uint16_t *mem16, uint16_t val16) { @@ -213,11 +267,11 @@ __sync_lock_test_and_set_2(uint16_t *mem reg_t val32, negmask32, old; uint32_t temp; - mem32 = (uint32_t *)((intptr_t)mem16 & ~1); + mem32 = round_to_word(mem16); val32.v32 = 0x00000000; - val32.v16[(intptr_t)mem16 & 1] = val16; + put_2(&val32, mem16, val16); negmask32.v32 = 0xffffffff; - negmask32.v16[(intptr_t)mem16 & 1] = 0x0000; + put_2(&negmask32, mem16, 0x0000); mips_sync(); __asm volatile ( @@ -229,7 +283,7 @@ __sync_lock_test_and_set_2(uint16_t *mem "\tbeqz %2, 1b\n" /* Spin if failed. */ : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) : "r" (val32.v32), "r" (negmask32.v32), "m" (*mem32)); - return (old.v16[(intptr_t)mem16 & 1]); + return (get_2(&old, mem16)); } uint16_t @@ -240,13 +294,13 @@ __sync_val_compare_and_swap_2(uint16_t * reg_t expected32, desired32, posmask32, negmask32, old; uint32_t temp; - mem32 = (uint32_t *)((intptr_t)mem16 & ~1); + mem32 = round_to_word(mem16); expected32.v32 = 0x00000000; - expected32.v16[(intptr_t)mem16 & 1] = expected; + put_2(&expected32, mem16, expected); desired32.v32 = 0x00000000; - desired32.v16[(intptr_t)mem16 & 1] = desired; + put_2(&desired32, mem16, desired); posmask32.v32 = 0x00000000; - posmask32.v16[(intptr_t)mem16 & 1] = 0xffff; + put_2(&posmask32, mem16, 0xffff); negmask32.v32 = ~posmask32.v32; mips_sync(); @@ -263,7 +317,7 @@ __sync_val_compare_and_swap_2(uint16_t * : "=&r" (old), "=m" (*mem32), "=&r" (temp) : "r" (expected32.v32), "r" (desired32.v32), "r" (posmask32.v32), "r" (negmask32.v32), "m" (*mem32)); - return (old.v16[(intptr_t)mem16 & 1]); + return (get_2(&old, mem16)); } #define EMIT_ARITHMETIC_FETCH_AND_OP_2(name, op) \ @@ -274,11 +328,11 @@ __sync_##name##_2(uint16_t *mem16, uint1 reg_t val32, posmask32, negmask32, old; \ uint32_t temp1, temp2; \ \ - mem32 = (uint32_t *)((intptr_t)mem16 & ~3); \ + mem32 = round_to_word(mem16); \ val32.v32 = 0x00000000; \ - val32.v16[(intptr_t)mem16 & 1] = val16; \ + put_2(&val32, mem16, val16); \ posmask32.v32 = 0x00000000; \ - posmask32.v16[(intptr_t)mem16 & 1] = 0xffff; \ + put_2(&posmask32, mem16, 0xffff); \ negmask32.v32 = ~posmask32.v32; \ \ mips_sync(); \ @@ -295,7 +349,7 @@ __sync_##name##_2(uint16_t *mem16, uint1 "=&r" (temp2) \ : "r" (val32.v32), "r" (posmask32.v32), \ "r" (negmask32.v32), "m" (*mem32)); \ - return (old.v16[(intptr_t)mem16 & 1]); \ + return (get_2(&old, mem16)); \ } EMIT_ARITHMETIC_FETCH_AND_OP_2(fetch_and_add, "addu") @@ -309,9 +363,9 @@ __sync_##name##_2(uint16_t *mem16, uint1 reg_t val32, old; \ uint32_t temp; \ \ - mem32 = (uint32_t *)((intptr_t)mem16 & ~1); \ + mem32 = round_to_word(mem16); \ val32.v32 = idempotence ? 0xffffffff : 0x00000000; \ - val32.v16[(intptr_t)mem16 & 1] = val16; \ + put_2(&val32, mem16, val16); \ \ mips_sync(); \ __asm volatile ( \ @@ -322,7 +376,7 @@ __sync_##name##_2(uint16_t *mem16, uint1 "\tbeqz %2, 1b\n" /* Spin if failed. */ \ : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) \ : "r" (val32.v32), "m" (*mem32)); \ - return (old.v16[(intptr_t)mem16 & 1]); \ + return (get_2(&old, mem16)); \ } EMIT_BITWISE_FETCH_AND_OP_2(fetch_and_and, "and", 1) From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 16:28:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6C3958B1; Sat, 8 Jun 2013 16:28:09 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 44D431482; Sat, 8 Jun 2013 16:28:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58GS9qB022358; Sat, 8 Jun 2013 16:28:09 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58GS8io022356; Sat, 8 Jun 2013 16:28:08 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306081628.r58GS8io022356@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 16:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251540 - in head/usr.sbin/bsdconfig: security startup X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 16:28:09 -0000 Author: dteske Date: Sat Jun 8 16:28:08 2013 New Revision: 251540 URL: http://svnweb.freebsd.org/changeset/base/251540 Log: Remove extraneous characters ('<<<') from `Exit' menutag in the "Security" and "Startup"->"Misc" modules to make the menus appear more consistent with the numerous other modules and look a little cleaner. PR: ports/169316 Modified: head/usr.sbin/bsdconfig/security/security head/usr.sbin/bsdconfig/startup/misc Modified: head/usr.sbin/bsdconfig/security/security ============================================================================== --- head/usr.sbin/bsdconfig/security/security Sat Jun 8 16:24:49 2013 (r251539) +++ head/usr.sbin/bsdconfig/security/security Sat Jun 8 16:28:08 2013 (r251540) @@ -51,7 +51,7 @@ dialog_menu_main() { local prompt="$msg_menu_text" local menu_list=" - 'X <<< $msg_exit' '$msg_exit_this_menu' + 'X $msg_exit' '$msg_exit_this_menu' " # END-QUOTE local defaultitem= # Calculated below local hline="$hline_arrows_tab_enter" @@ -158,7 +158,7 @@ while :; do f_dialog_menutag_fetch mtag case "$mtag" in - "X <<< $msg_exit") break ;; + "X $msg_exit") break ;; "2 ["?"] $msg_securelevel") # Configure securelevels for the system $BSDCFG_LIBE/$APP_DIR/kern_securelevel ${USE_XDIALOG:+-X} ;; "3 [X] $msg_nfs_port") # Require that NFS clients use reserved ports Modified: head/usr.sbin/bsdconfig/startup/misc ============================================================================== --- head/usr.sbin/bsdconfig/startup/misc Sat Jun 8 16:24:49 2013 (r251539) +++ head/usr.sbin/bsdconfig/startup/misc Sat Jun 8 16:28:08 2013 (r251540) @@ -58,7 +58,7 @@ dialog_menu_main() { local prompt="$msg_miscellaneous_menu_text" local menu_list=" - 'X <<< $msg_exit' '$msg_exit_this_menu' + 'X $msg_exit' '$msg_exit_this_menu' " # END-QUOTE local defaultitem= # Calculated below local hline="$hline_arrows_tab_enter" @@ -345,7 +345,7 @@ while :; do f_dialog_menutag_fetch mtag case "$mtag" in - "X <<< $msg_exit") break ;; + "X $msg_exit") break ;; ?" ["?"] $msg_apm") case "$mtag" in ?" [X] "*) err=$( f_sysrc_set apm_enable NO 2>&1 ) ;; From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 16:49:20 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 151AFC1B; Sat, 8 Jun 2013 16:49:20 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 06915164D; Sat, 8 Jun 2013 16:49:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58GnJZJ028441; Sat, 8 Jun 2013 16:49:19 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58GnJMS028440; Sat, 8 Jun 2013 16:49:19 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306081649.r58GnJMS028440@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 16:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251541 - head/usr.sbin/bsdconfig/console/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 16:49:20 -0000 Author: dteske Date: Sat Jun 8 16:49:19 2013 New Revision: 251541 URL: http://svnweb.freebsd.org/changeset/base/251541 Log: Reduce verbosity in the "Console"->"Saver" module (bsdconfig syscons_saver) by replacing the infinitive [verb] phrase "Simply blank the screen" with a simple description of what you get; "Blank screen". PR: ports/169316 Modified: head/usr.sbin/bsdconfig/console/include/messages.subr Modified: head/usr.sbin/bsdconfig/console/include/messages.subr ============================================================================== --- head/usr.sbin/bsdconfig/console/include/messages.subr Sat Jun 8 16:28:08 2013 (r251540) +++ head/usr.sbin/bsdconfig/console/include/messages.subr Sat Jun 8 16:49:19 2013 (r251541) @@ -36,7 +36,7 @@ msg_beastie_desc="\"BSD Daemon\" animate msg_belgian="Belgian" msg_belgian_desc="Belgian ISO keymap" msg_blank="Blank" -msg_blank_desc="Simply blank the screen" +msg_blank_desc="Blank screen" msg_brazil_cp850="Brazil CP850" msg_brazil_cp850_desc="Brazil CP850 keymap" msg_brazil_iso="Brazil ISO" From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 17:02:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A1DFEEE2; Sat, 8 Jun 2013 17:02:16 +0000 (UTC) (envelope-from hiren.panchasara@gmail.com) Received: from mail-ea0-x22f.google.com (mail-ea0-x22f.google.com [IPv6:2a00:1450:4013:c01::22f]) by mx1.freebsd.org (Postfix) with ESMTP id 7B1D816D6; Sat, 8 Jun 2013 17:02:15 +0000 (UTC) Received: by mail-ea0-f175.google.com with SMTP id z7so679414eaf.6 for ; Sat, 08 Jun 2013 10:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ernPjB57Oe96dr/SqdiNFCJCN+oA5uIG5MxFlk2lC40=; b=d8WjTq6RZiHqAYIdFdlkTFDNATP8lwox+D2hFfgVp5ypEglJsZ4RDCg7cb8h18ov0g PsiyTLL9u749C/Z5IM2hRt/MBPJW58WHw70a7I1lvbT/28vZHw7T5uOu4i1xv3tJLRXR M4WCKKNozmTZU1urs9gLcCqY50lO2CeVGWUr+t6JbHBX+UQx0PEpbQ37EGuFJcF+Gvlz t6w1THd6LnrIjkYo+nWG94ZIQBkXpEQRKf+wYAw1f0ZIJLIdqi8Sdl9aDJ5bhC1CMXwF JGgJJOfOgt7r669hyx70fYzz1iZbAFbxs1JInM+PKBHkxvuIGh7mCGLi4XRbdnMJ0ZJR 8F1Q== MIME-Version: 1.0 X-Received: by 10.14.1.70 with SMTP id 46mr3759447eec.82.1370710933715; Sat, 08 Jun 2013 10:02:13 -0700 (PDT) Sender: hiren.panchasara@gmail.com Received: by 10.15.64.193 with HTTP; Sat, 8 Jun 2013 10:02:13 -0700 (PDT) In-Reply-To: <201306081602.r58G2WcG014325@svn.freebsd.org> References: <201306081602.r58G2WcG014325@svn.freebsd.org> Date: Sat, 8 Jun 2013 10:02:13 -0700 X-Google-Sender-Auth: ItWLIaqwTz_Qp1r8vb5uPxiZ1cY Message-ID: Subject: Re: svn commit: r251538 - in head: share/man/man4 sys/conf sys/dev/usb sys/dev/usb/wlan sys/modules/usb sys/modules/usb/urtwn From: hiren panchasara To: Rui Paulo Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head , svn-src-all , src-committers X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 17:02:16 -0000 On Sat, Jun 8, 2013 at 9:02 AM, Rui Paulo wrote: > Author: rpaulo > Date: Sat Jun 8 16:02:31 2013 > New Revision: 251538 > URL: http://svnweb.freebsd.org/changeset/base/251538 > > Log: > Import Kevin Lo's port of urtwn(4) from OpenBSD. urtwn(4) is a driver for the > Realtek RTL8188CU/RTL8192CU USB IEEE 802.11b/g/n wireless cards. > This driver requires microcode which is available in FreeBSD ports: > net/urtwn-firmware-kmod. > > Hiren ported the urtwn(4) man page from OpenBSD and Glen just commited a port > for the firmware. > > TODO: > - 802.11n support > - Stability fixes - the driver can sustain lots of traffic but has trouble > coping with simultaneous iperf sessions. > - fix debugging > > MFC after: 2 months > Tested by: kevlo, hiren, gjb Yay! Great work Kevin for initial port and Rui for tuning it up to stable state and fixing performance issues. cheers, Hiren PS: Time for creating new image with the changes for beaglebone! > > Added: > head/share/man/man4/urtwn.4 (contents, props changed) > head/sys/dev/usb/wlan/if_urtwn.c (contents, props changed) > head/sys/dev/usb/wlan/if_urtwnreg.h (contents, props changed) > head/sys/modules/usb/urtwn/ > head/sys/modules/usb/urtwn/Makefile (contents, props changed) > Modified: > head/share/man/man4/Makefile > head/sys/conf/NOTES > head/sys/conf/files > head/sys/dev/usb/usbdevs > head/sys/modules/usb/Makefile > > Modified: head/share/man/man4/Makefile > ============================================================================== > --- head/share/man/man4/Makefile Sat Jun 8 15:48:29 2013 (r251537) > +++ head/share/man/man4/Makefile Sat Jun 8 16:02:31 2013 (r251538) > @@ -516,6 +516,7 @@ MAN= aac.4 \ > ural.4 \ > urio.4 \ > ${_urtw.4} \ > + urtwn.4 \ > usb.4 \ > usb_quirk.4 \ > uslcom.4 \ > > Added: head/share/man/man4/urtwn.4 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/man/man4/urtwn.4 Sat Jun 8 16:02:31 2013 (r251538) > @@ -0,0 +1,140 @@ > +.\" $OpenBSD: urtwn.4,v 1.20 2013/05/16 10:02:59 sthen Exp $ > +.\" $FreeBSD$ > +.\" > +.\" Copyright (c) 2010 Damien Bergamini > +.\" > +.\" Permission to use, copy, modify, and distribute this software for any > +.\" purpose with or without fee is hereby granted, provided that the above > +.\" copyright notice and this permission notice appear in all copies. > +.\" > +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > +.\" > +.Dd July 7, 2013 > +.Dt URTWN 4 > +.Os > +.Sh NAME > +.Nm urtwn > +.Nd Realtek RTL8188CU/RTL8192CU USB IEEE 802.11b/g/n wireless network device > +.Sh SYNOPSIS > +To compile this driver into the kernel, > +place the following lines in your > +kernel configuration file: > +.Bd -ragged -offset indent > +.Cd "device ehci" > +.Cd "device uhci" > +.Cd "device ohci" > +.Cd "device usb" > +.Cd "device urtwn" > +.Cd "device wlan" > +.Ed > +.Pp > +Alternatively, to load the driver as a > +module at boot time, place the following line in > +.Xr loader.conf 5 : > +.Bd -literal -offset indent > +if_urtwn_load="YES" > +.Ed > +.Sh DESCRIPTION > +The > +.Nm > +driver supports USB 2.0 wireless network devices based on Realtek > +RTL8188CUS, RTL8188CE-VAU, RTL8188RU and RTL8192CU chipsets. > +.Pp > +The RTL8188CUS is a highly integrated 802.11n adapter that combines > +a MAC, a 1T1R capable baseband and an RF in a single chip. > +It operates in the 2GHz spectrum only. > +The RTL8188RU is a high-power variant of the RTL8188CUS. > +The RTL8188CE-VAU is a PCI Express Mini Card adapter that attaches > +to the USB interface. > +.Pp > +The RTL8192CU is a highly integrated multiple-in, multiple-out (MIMO) > +802.11n adapter that combines a MAC, a 2T2R capable baseband and an > +RF in a single chip. > +It operates in the 2GHz spectrum only. > +.Pp > +The driver needs at least version 1.1p0 of the following firmware files, > +which are loaded when an interface is attached: > +.Pp > +.Bl -tag -width Ds -offset indent -compact > +.It urtwn-rtl8192cfwT > +.It urtwn-rtl8192cfwU > +.It urtwn-rtl8723fw > +.El > +.Pp > +The firmware is available as part of the FreeBSD Ports collection in > +net/urtwn-firmware-kmod. > +.Sh HARDWARE > +The following adapters should work: > +.Pp > +.Bl -tag -width Ds -offset indent -compact > +.It Belkin F7D1102 Surf Wireless Micro > +.It Edimax EW-7811Un > +.It Netgear WNA1000M > +.It Realtek RTL8192CU > +.It Realtek RTL8188CUS > +.El > +.Sh EXAMPLES > +Join an existing BSS network (i.e., connect to an access point): > +.Bd -literal -offset indent > +ifconfig wlan create wlandev urtwn0 inet 192.168.0.20 \e > + netmask 0xffffff00 > +.Ed > +.Pp > +Join a specific BSS network with network name > +.Dq Li my_net : > +.Pp > +.Dl "ifconfig wlan create wlandev urtwn0 ssid my_net up" > +.Pp > +Join a specific BSS network with 64-bit WEP encryption: > +.Bd -literal -offset indent > +ifconfig wlan create wlandev urtwn0 ssid my_net \e > + wepmode on wepkey 0x1234567890 weptxkey 1 up > +.Ed > +.Sh DIAGNOSTICS > +.Bl -diag > +.It "urtwn%d: error %d, could not read firmware %s" > +For some reason, the driver was unable to read the microcode file from the > +filesystem. > +The file might be missing or corrupted. > +.It "urtwn%d: device timeout" > +A frame dispatched to the hardware for transmission did not complete in time. > +The driver will reset the hardware. > +This should not happen. > +.El > +.Sh SEE ALSO > +.Xr intro 4 , > +.Xr netintro 4 , > +.Xr usb 4 , > +.Xr wlan 4 , > +.Xr wlan_ccmp 4 , > +.Xr wlan_tkip 4 , > +.Xr wlan_wep 4 , > +.Xr ifconfig 8, > +.Xr wpa_supplicant 8 > +.Rs > +.%T Realtek > +.%U http://www.realtek.com.tw > +.Re > +.Sh HISTORY > +The > +.Nm > +driver first appeared in > +.Ox 4.9 > +and > +.Fx 10.0 . > +.Sh AUTHORS > +The > +.Nm > +driver was written by > +.An Damien Bergamini Aq damien@openbsd.org . > +.Sh CAVEATS > +The > +.Nm > +driver does not support any of the 802.11n capabilities offered by the > +adapters. > > Modified: head/sys/conf/NOTES > ============================================================================== > --- head/sys/conf/NOTES Sat Jun 8 15:48:29 2013 (r251537) > +++ head/sys/conf/NOTES Sat Jun 8 16:02:31 2013 (r251538) > @@ -2747,6 +2747,9 @@ device ural > # Realtek RTL8187B/L wireless driver > device urtw > # > +# Realtek RTL8188CU/RTL8192CU wireless driver > +device urtwn > +# > # ZyDas ZD1211/ZD1211B wireless driver > device zyd > # > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Sat Jun 8 15:48:29 2013 (r251537) > +++ head/sys/conf/files Sat Jun 8 16:02:31 2013 (r251538) > @@ -2292,6 +2292,7 @@ dev/usb/wlan/if_uath.c optional uath > dev/usb/wlan/if_upgt.c optional upgt > dev/usb/wlan/if_ural.c optional ural > dev/usb/wlan/if_urtw.c optional urtw > +dev/usb/wlan/if_urtwn.c optional urtwn > dev/usb/wlan/if_zyd.c optional zyd > # > # USB serial and parallel port drivers > > Modified: head/sys/dev/usb/usbdevs > ============================================================================== > --- head/sys/dev/usb/usbdevs Sat Jun 8 15:48:29 2013 (r251537) > +++ head/sys/dev/usb/usbdevs Sat Jun 8 16:02:31 2013 (r251538) > @@ -571,6 +571,7 @@ vendor KONTRON 0x0fe6 Kontron AG > vendor QUALCOMM 0x1004 Qualcomm > vendor APACER 0x1005 Apacer > vendor MOTOROLA4 0x100d Motorola > +vendor HP3 0x103c Hewlett Packard > vendor AIRPLUS 0x1011 Airplus > vendor DESKNOTE 0x1019 Desknote > vendor NEC3 0x1033 NEC > @@ -720,6 +721,7 @@ vendor ENCORE 0x203d Encore > vendor QIHARDWARE 0x20b7 QI-hardware > vendor PARA 0x20b8 PARA Industrial > vendor SIMTEC 0x20df Simtec Electronics > +vendor TRENDNET 0x20f4 TRENDnet > vendor RTSYSTEMS 0x2100 RTSYSTEMS > vendor VIALABS 0x2109 VIA Labs > vendor ERICSSON 0x2282 Ericsson > @@ -742,6 +744,7 @@ vendor IRIVER 0x4102 iRiver > vendor DELL 0x413c Dell > vendor WCH 0x4348 QinHeng Electronics > vendor ACEECA 0x4766 Aceeca > +vendor FEIXUN 0x4855 FeiXun Communication > vendor PAPOUCH 0x5050 Papouch products > vendor AVERATEC 0x50c2 Averatec > vendor SWEEX 0x5173 Sweex > @@ -757,6 +760,7 @@ vendor INTEL2 0x8087 Intel > vendor ALLWIN 0x8516 ALLWIN Tech > vendor SITECOM2 0x9016 Sitecom > vendor MOSCHIP 0x9710 MosChip Semiconductor > +vendor NETGEAR4 0x9846 Netgear > vendor MARVELL 0x9e88 Marvell Technology Group Ltd. > vendor 3COM3 0xa727 3Com > vendor EVOLUTION 0xdeee Evolution Robotics products > @@ -814,6 +818,9 @@ product ABOCOM HWU54DM 0xb21b HWU54DM > product ABOCOM RT2573_2 0xb21c RT2573 > product ABOCOM RT2573_3 0xb21d RT2573 > product ABOCOM RT2573_4 0xb21e RT2573 > +product ABOCOM RTL8188CU_1 0x8188 RTL8188CU > +product ABOCOM RTL8188CU_2 0x8189 RTL8188CU > +product ABOCOM RTL8192CU 0x8178 RTL8192CU > product ABOCOM WUG2700 0xb21f WUG2700 > > /* Acton Research Corp. */ > @@ -1126,6 +1133,7 @@ product ASUS RT2870_4 0x1760 RT2870 > product ASUS RT2870_5 0x1761 RT2870 > product ASUS USBN13 0x1784 USB-N13 > product ASUS RT3070_1 0x1790 RT3070 > +product ASUS RTL8192CU 0x17ab RTL8192CU > product ASUS A730W 0x4202 ASUS MyPal A730W > product ASUS P535 0x420f ASUS P535 PDA > product ASUS GMSC 0x422f ASUS Generic Mass Storage > @@ -1173,6 +1181,10 @@ product AZUREWAVE RT2870_2 0x3262 RT2870 > product AZUREWAVE RT3070_1 0x3273 RT3070 > product AZUREWAVE RT3070_2 0x3284 RT3070 > product AZUREWAVE RT3070_3 0x3305 RT3070 > +product AZUREWAVE RTL8188CU 0x3357 RTL8188CU > +product AZUREWAVE RTL8188CE_1 0x3358 RTL8188CE > +product AZUREWAVE RTL8188CE_2 0x3359 RTL8188CE > + > > /* Baltech products */ > product BALTECH CARDREADER 0x9999 Card reader > @@ -1215,6 +1227,9 @@ product BELKIN F5U257 0x0257 F5U257 Ser > product BELKIN F5U409 0x0409 F5U409 Serial > product BELKIN F6C550AVR 0x0551 F6C550-AVR UPS > product BELKIN F5U120 0x1203 F5U120-PC Hub > +product BELKIN RTL8188CU 0x1102 RTL8188CU Wireless Adapter > +product BELKIN RTL8192CU 0x2102 RTL8192CU Wireless Adapter > +product BELKIN F7D2102 0x2103 F7D2102 Wireless Adapter > product BELKIN ZD1211B 0x4050 ZD1211B > product BELKIN F5D5055 0x5055 F5D5055 > product BELKIN F5D7050 0x7050 F5D7050 Wireless Adapter > @@ -1294,6 +1309,11 @@ product CHIC CYPRESS 0x0003 Cypress USB > product CHICONY KB8933 0x0001 KB-8933 keyboard > product CHICONY KU0325 0x0116 KU-0325 keyboard > product CHICONY CNF7129 0xb071 Notebook Web Camera > +product CHICONY RTL8188CUS_1 0xaff7 RTL8188CUS > +product CHICONY RTL8188CUS_2 0xaff8 RTL8188CUS > +product CHICONY RTL8188CUS_3 0xaff9 RTL8188CUS > +product CHICONY RTL8188CUS_4 0xaffa RTL8188CUS > +product CHICONY RTL8188CUS_5 0xaffa RTL8188CUS > product CHICONY2 TWINKLECAM 0x600d TwinkleCam USB camera > > /* CH Products */ > @@ -1383,6 +1403,7 @@ product COREGA RT2870_2 0x003c RT2870 > product COREGA RT2870_3 0x003f RT2870 > product COREGA RT3070 0x0041 RT3070 > product COREGA CGWLUSB300GNM 0x0042 CG-WLUSB300GNM > +product COREGA RTL8192CU 0x0056 RTL8192CU > > product COREGA WLUSB_11_STICK 0x7613 WLAN USB Stick 11 > product COREGA FETHER_USB_TXC 0x9601 FEther USB-TXC > @@ -1519,6 +1540,10 @@ product DLINK DSB650 0xabc1 10/100 Ethe > product DLINK DUBH7 0xf103 DUB-H7 USB 2.0 7-Port Hub > product DLINK DWR510_CD 0xa805 DWR-510 CD-ROM Mode > product DLINK DWR510 0x7e12 DWR-510 > +product DLINK RTL8188CU 0x3308 RTL8188CU > +product DLINK RTL8192CU_1 0x3307 RTL8192CU > +product DLINK RTL8192CU_2 0x3309 RTL8192CU > +product DLINK RTL8192CU_3 0x330a RTL8192CU > product DLINK2 DWA120 0x3a0c DWA-120 > product DLINK2 DWA120_NF 0x3a0d DWA-120 (no firmware) > product DLINK2 DWLG122C1 0x3c03 DWL-G122 c1 > @@ -1559,6 +1584,7 @@ product EDIMAX RT2870_1 0x7711 RT2870 > product EDIMAX EW7717 0x7717 EW-7717 > product EDIMAX EW7718 0x7718 EW-7718 > product EDIMAX EW7811UN 0x7811 EW-7811Un > +product EDIMAX RTL8192CU 0x7822 RTL8192CU > > /* eGalax Products */ > product EGALAX TPANEL 0x0001 Touch Panel > @@ -1691,6 +1717,10 @@ product FEIYA 5IN1 0x1132 5-in-1 Card R > product FEIYA ELANGO 0x6200 MicroSDHC Card Reader > product FEIYA AC110 0x6300 AC-110 Card Reader > > +/* FeiXun Communication products */ > +product FEIXUN RTL8188CU 0x0090 RTL8188CU > +product FEIXUN RTL8192CU 0x0091 RTL8192CU > + > /* Festo */ > product FESTO CPX_USB 0x0102 CPX-USB > product FESTO CMSP 0x0501 CMSP > @@ -2043,6 +2073,7 @@ product GUILLEMOT HWGUSB254 0xe000 HWGUS > product GUILLEMOT HWGUSB254LB 0xe010 HWGUSB2-54-LB > product GUILLEMOT HWGUSB254V2AP 0xe020 HWGUSB2-54V2-AP > product GUILLEMOT HWNU300 0xe030 HWNU-300 > +product GUILLEMOT HWNUP150 0xe033 HWNUP-150 > > /* Hagiwara products */ > product HAGIWARA FGSM 0x0002 FlashGate SmartMedia Card Reader > @@ -2066,6 +2097,7 @@ product HAWKING RT2870_1 0x0001 RT2870 > product HAWKING RT2870_2 0x0003 RT2870 > product HAWKING HWUN2 0x0009 HWUN2 > product HAWKING RT3070 0x000b RT3070 > +product HAWKING RTL8192CU 0x0019 RTL8192CU > product HAWKING UF100 0x400c 10/100 USB Ethernet > > /* HID Global GmbH products */ > @@ -2115,6 +2147,7 @@ product HP 5400C 0x1005 Scanjet 5400C > product HP 2215 0x1016 iPAQ 22xx/Jornada 548 > product HP 568J 0x1116 Jornada 568 > product HP 930C 0x1204 DeskJet 930c > +product HP3 RTL8188CU 0x1629 RTL8188CU > product HP P2000U 0x1801 Inkjet P-2000U > product HP HS2300 0x1e1d HS2300 HSDPA (aka MC8775) > product HP 640C 0x2004 DeskJet 640c > @@ -3024,6 +3057,8 @@ product NETGEAR WG111V3 0x4260 WG111v3 > product NETGEAR WG111U 0x4300 WG111U > product NETGEAR WG111U_NF 0x4301 WG111U (no firmware) > product NETGEAR WG111V2 0x6a00 WG111V2 > +product NETGEAR RTL8192CU 0x9021 RTL8192CU > +product NETGEAR WNA1000M 0x9041 WNA1000M > product NETGEAR2 MA101 0x4100 MA101 > product NETGEAR2 MA101B 0x4102 MA101 Rev B > product NETGEAR3 WG111T 0x4250 WG111T > @@ -3031,6 +3066,7 @@ product NETGEAR3 WG111T_NF 0x4251 WG111T > product NETGEAR3 WPN111 0x5f00 WPN111 > product NETGEAR3 WPN111_NF 0x5f01 WPN111 (no firmware) > product NETGEAR3 WPN111_2 0x5f02 WPN111 > +product NETGEAR4 RTL8188CU 0x9041 RTL8188CU > > /* NetIndex products */ > product NETINDEX WS002IN 0x2001 Willcom WS002IN > @@ -3046,6 +3082,7 @@ product NIKON D300 0x041a Digital Came > /* NovaTech Products */ > product NOVATECH NV902 0x9020 NovaTech NV-902W > product NOVATECH RT2573 0x9021 RT2573 > +product NOVATECH RTL8188CU 0x9071 RTL8188CU > > /* Nokia products */ > product NOKIA N958GB 0x0070 Nokia N95 8GBc > @@ -3274,8 +3311,14 @@ product PIENGINEERING PS2USB 0x020b PS2 > > /* Planex Communications products */ > product PLANEX GW_US11H 0x14ea GW-US11H WLAN > +product PLANEX2 RTL8188CUS 0x1201 RTL8188CUS > product PLANEX2 GW_US11S 0x3220 GW-US11S WLAN > product PLANEX2 GW_US54GXS 0x5303 GW-US54GXS WLAN > +product PLANEX2 RTL8188CU_1 0xab2a RTL8188CU > +product PLANEX2 RTL8188CU_2 0xed17 RTL8188CU > +product PLANEX2 RTL8188CU_3 0x4902 RTL8188CU > +product PLANEX2 RTL8188CU_4 0xab2e RTL8188CU > +product PLANEX2 RTL8192CU 0xab2b RTL8192CU > product PLANEX2 GWUS54HP 0xab01 GW-US54HP > product PLANEX2 GWUS300MINIS 0xab24 GW-US300MiniS > product PLANEX2 RT3070 0xab25 RT3070 > @@ -3502,11 +3545,24 @@ product RATOC REXUSB60F 0xb020 USB seri > /* Green House and CompUSA OEM this part */ > product REALTEK DUMMY 0x0000 Dummy product > product REALTEK USB20CRW 0x0158 USB20CRW Card Reader > +product REALTEK RTL8188CTV 0x018a RTL8188CTV > product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet > +product REALTEK RTL8188CE_0 0x8170 RTL8188CE > +product REALTEK RTL8188CE_1 0x817e RTL8188CE > +product REALTEK RTL8188CU_0 0x8176 RTL8188CU > +product REALTEK RTL8188CU_1 0x817a RTL8188CU > +product REALTEK RTL8188CU_2 0x817b RTL8188CU > product REALTEK RTL8187 0x8187 RTL8187 Wireless Adapter > product REALTEK RTL8187B_0 0x8189 RTL8187B Wireless Adapter > product REALTEK RTL8187B_1 0x8197 RTL8187B Wireless Adapter > product REALTEK RTL8187B_2 0x8198 RTL8187B Wireless Adapter > +product REALTEK RTL8188CUS 0x818a RTL8188CUS > +product REALTEK RTL8188CU_COMBO 0x8754 RTL8188CU > +product REALTEK RTL8191CU 0x8177 RTL8191CU > +product REALTEK RTL8192CU 0x8178 RTL8192CU > +product REALTEK RTL8192CE 0x817c RTL8192CE > +product REALTEK RTL8188RU_1 0x817d RTL8188RU > +product REALTEK RTL8188RU_2 0x317f RTL8188RU > > /* RedOctane products */ > product REDOCTANE DUMMY 0x0000 Dummy product > @@ -3881,6 +3937,9 @@ product SITECOMEU RT3072_3 0x0047 RT3072 > product SITECOMEU RT3072_4 0x0048 RT3072 > product SITECOMEU RT3072_5 0x004a RT3072 > product SITECOMEU RT3072_6 0x004d RT3072 > +product SITECOMEU RTL8188CU_1 0x0052 RTL8188CU > +product SITECOMEU RTL8188CU_2 0x005c RTL8188CU > +product SITECOMEU RTL8192CU 0x0061 RTL8192CU > product SITECOMEU LN028 0x061c LN-028 > product SITECOMEU WL113 0x9071 WL-113 > product SITECOMEU ZD1211B 0x9075 ZD1211B > @@ -4110,6 +4169,10 @@ product TREK THUMBDRIVE 0x1111 ThumbDri > product TREK MEMKEY 0x8888 IBM USB Memory Key > product TREK THUMBDRIVE_8MB 0x9988 ThumbDrive_8MB > > +/* TRENDnet products */ > +product TRENDNET RTL8192CU 0x624d RTL8192CU > +product TRENDNET RTL8188CU 0x648b RTL8188CU > + > /* Tripp-Lite products */ > product TRIPPLITE U209 0x2008 Serial > > @@ -4319,3 +4382,4 @@ product ZYXEL G220V2 0x340f G-220 v2 > product ZYXEL G202 0x3410 G-202 > product ZYXEL RT2870_1 0x3416 RT2870 > product ZYXEL RT2870_2 0x341a RT2870 > +product ZYXEL RTL8192CU 0x341f RTL8192CU > > Added: head/sys/dev/usb/wlan/if_urtwn.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/usb/wlan/if_urtwn.c Sat Jun 8 16:02:31 2013 (r251538) > @@ -0,0 +1,3016 @@ > +/* $OpenBSD: if_urtwn.c,v 1.16 2011/02/10 17:26:40 jakemsr Exp $ */ > + > +/*- > + * Copyright (c) 2010 Damien Bergamini > + * > + * Permission to use, copy, modify, and distribute this software for any > + * purpose with or without fee is hereby granted, provided that the above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +/* > + * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188RU/RTL8192CU. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include "usbdevs.h" > + > +#define USB_DEBUG_VAR urtwn_debug > +#include > + > +#include > + > +#ifdef USB_DEBUG > +static int urtwn_debug = 0; > + > +SYSCTL_NODE(_hw_usb, OID_AUTO, urtwn, CTLFLAG_RW, 0, "USB urtwn"); > +SYSCTL_INT(_hw_usb_urtwn, OID_AUTO, debug, CTLFLAG_RW, &urtwn_debug, 0, > + "Debug level"); > +#endif > + > +#define IEEE80211_HAS_ADDR4(wh) \ > + (((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) > + > +/* various supported device vendors/products */ > +static const struct usb_device_id urtwn_devs[] = { > +#define URTWN_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } > + URTWN_DEV(ABOCOM, RTL8188CU_1), > + URTWN_DEV(ABOCOM, RTL8188CU_2), > + URTWN_DEV(ABOCOM, RTL8192CU), > + URTWN_DEV(ASUS, RTL8192CU), > + URTWN_DEV(AZUREWAVE, RTL8188CE_1), > + URTWN_DEV(AZUREWAVE, RTL8188CE_2), > + URTWN_DEV(AZUREWAVE, RTL8188CU), > + URTWN_DEV(BELKIN, F7D2102), > + URTWN_DEV(BELKIN, RTL8188CU), > + URTWN_DEV(BELKIN, RTL8192CU), > + URTWN_DEV(CHICONY, RTL8188CUS_1), > + URTWN_DEV(CHICONY, RTL8188CUS_2), > + URTWN_DEV(CHICONY, RTL8188CUS_3), > + URTWN_DEV(CHICONY, RTL8188CUS_4), > + URTWN_DEV(CHICONY, RTL8188CUS_5), > + URTWN_DEV(COREGA, RTL8192CU), > + URTWN_DEV(DLINK, RTL8188CU), > + URTWN_DEV(DLINK, RTL8192CU_1), > + URTWN_DEV(DLINK, RTL8192CU_2), > + URTWN_DEV(DLINK, RTL8192CU_3), > + URTWN_DEV(EDIMAX, EW7811UN), > + URTWN_DEV(EDIMAX, RTL8192CU), > + URTWN_DEV(FEIXUN, RTL8188CU), > + URTWN_DEV(FEIXUN, RTL8192CU), > + URTWN_DEV(GUILLEMOT, HWNUP150), > + URTWN_DEV(HAWKING, RTL8192CU), > + URTWN_DEV(HP3, RTL8188CU), > + URTWN_DEV(NETGEAR, WNA1000M), > + URTWN_DEV(NETGEAR, RTL8192CU), > + URTWN_DEV(NETGEAR4, RTL8188CU), > + URTWN_DEV(NOVATECH, RTL8188CU), > + URTWN_DEV(PLANEX2, RTL8188CU_1), > + URTWN_DEV(PLANEX2, RTL8188CU_2), > + URTWN_DEV(PLANEX2, RTL8188CU_3), > + URTWN_DEV(PLANEX2, RTL8188CU_4), > + URTWN_DEV(PLANEX2, RTL8188CUS), > + URTWN_DEV(PLANEX2, RTL8192CU), > + URTWN_DEV(REALTEK, RTL8188CE_0), > + URTWN_DEV(REALTEK, RTL8188CE_1), > + URTWN_DEV(REALTEK, RTL8188CTV), > + URTWN_DEV(REALTEK, RTL8188CU_0), > + URTWN_DEV(REALTEK, RTL8188CU_1), > + URTWN_DEV(REALTEK, RTL8188CU_2), > + URTWN_DEV(REALTEK, RTL8188CU_COMBO), > + URTWN_DEV(REALTEK, RTL8188CUS), > + URTWN_DEV(REALTEK, RTL8188RU_1), > + URTWN_DEV(REALTEK, RTL8188RU_2), > + URTWN_DEV(REALTEK, RTL8191CU), > + URTWN_DEV(REALTEK, RTL8192CE), > + URTWN_DEV(REALTEK, RTL8192CU), > + URTWN_DEV(SITECOMEU, RTL8188CU_1), > + URTWN_DEV(SITECOMEU, RTL8188CU_2), > + URTWN_DEV(SITECOMEU, RTL8192CU), > + URTWN_DEV(TRENDNET, RTL8188CU), > + URTWN_DEV(TRENDNET, RTL8192CU), > + URTWN_DEV(ZYXEL, RTL8192CU), > +#undef URTWN_DEV > +}; > + > +static device_probe_t urtwn_match; > +static device_attach_t urtwn_attach; > +static device_detach_t urtwn_detach; > + > +static usb_callback_t urtwn_bulk_tx_callback; > +static usb_callback_t urtwn_bulk_rx_callback; > + > +static usb_error_t urtwn_do_request(struct urtwn_softc *sc, > + struct usb_device_request *req, void *data); > +static struct ieee80211vap *urtwn_vap_create(struct ieee80211com *, > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > +static void urtwn_vap_delete(struct ieee80211vap *); > +static struct mbuf * urtwn_rx_frame(struct urtwn_softc *, uint8_t *, int, > + int *); > +static struct mbuf * urtwn_rxeof(struct usb_xfer *, struct urtwn_data *, > + int *, int8_t *); > +static void urtwn_txeof(struct usb_xfer *, struct urtwn_data *); > +static int urtwn_alloc_list(struct urtwn_softc *, > + struct urtwn_data[], int, int); > +static int urtwn_alloc_rx_list(struct urtwn_softc *); > +static int urtwn_alloc_tx_list(struct urtwn_softc *); > +static void urtwn_free_tx_list(struct urtwn_softc *); > +static void urtwn_free_rx_list(struct urtwn_softc *); > +static void urtwn_free_list(struct urtwn_softc *, > + struct urtwn_data data[], int); > +static struct urtwn_data * _urtwn_getbuf(struct urtwn_softc *); > +static struct urtwn_data * urtwn_getbuf(struct urtwn_softc *); > +static int urtwn_write_region_1(struct urtwn_softc *, uint16_t, > + uint8_t *, int); > +static void urtwn_write_1(struct urtwn_softc *, uint16_t, uint8_t); > +static void urtwn_write_2(struct urtwn_softc *, uint16_t, uint16_t); > +static void urtwn_write_4(struct urtwn_softc *, uint16_t, uint32_t); > +static int urtwn_read_region_1(struct urtwn_softc *, uint16_t, > + uint8_t *, int); > +static uint8_t urtwn_read_1(struct urtwn_softc *, uint16_t); > +static uint16_t urtwn_read_2(struct urtwn_softc *, uint16_t); > +static uint32_t urtwn_read_4(struct urtwn_softc *, uint16_t); > +static int urtwn_fw_cmd(struct urtwn_softc *, uint8_t, > + const void *, int); > +static void urtwn_rf_write(struct urtwn_softc *, int, uint8_t, > + uint32_t); > +static uint32_t urtwn_rf_read(struct urtwn_softc *, int, uint8_t); > +static int urtwn_llt_write(struct urtwn_softc *, uint32_t, > + uint32_t); > +static uint8_t urtwn_efuse_read_1(struct urtwn_softc *, uint16_t); > +static void urtwn_efuse_read(struct urtwn_softc *); > +static int urtwn_read_chipid(struct urtwn_softc *); > +static void urtwn_read_rom(struct urtwn_softc *); > +static int urtwn_ra_init(struct urtwn_softc *); > +static void urtwn_tsf_sync_enable(struct urtwn_softc *); > +static void urtwn_set_led(struct urtwn_softc *, int, int); > +static int urtwn_newstate(struct ieee80211vap *, > + enum ieee80211_state, int); > +static void urtwn_watchdog(void *); > +static void urtwn_update_avgrssi(struct urtwn_softc *, int, int8_t); > +static int8_t urtwn_get_rssi(struct urtwn_softc *, int, void *); > +static int urtwn_tx_start(struct urtwn_softc *, > + struct ieee80211_node *, struct mbuf *, > + struct urtwn_data *); > +static void urtwn_start(struct ifnet *); > +static int urtwn_ioctl(struct ifnet *, u_long, caddr_t); > +static int urtwn_power_on(struct urtwn_softc *); > +static int urtwn_llt_init(struct urtwn_softc *); > +static void urtwn_fw_reset(struct urtwn_softc *); > +static int urtwn_fw_loadpage(struct urtwn_softc *, int, > + const uint8_t *, int); > +static int urtwn_load_firmware(struct urtwn_softc *); > +static int urtwn_dma_init(struct urtwn_softc *); > +static void urtwn_mac_init(struct urtwn_softc *); > +static void urtwn_bb_init(struct urtwn_softc *); > +static void urtwn_rf_init(struct urtwn_softc *); > +static void urtwn_cam_init(struct urtwn_softc *); > +static void urtwn_pa_bias_init(struct urtwn_softc *); > +static void urtwn_rxfilter_init(struct urtwn_softc *); > +static void urtwn_edca_init(struct urtwn_softc *); > +static void urtwn_write_txpower(struct urtwn_softc *, int, > + uint16_t[]); > +static void urtwn_get_txpower(struct urtwn_softc *, int, > + struct ieee80211_channel *, > + struct ieee80211_channel *, uint16_t[]); > +static void urtwn_set_txpower(struct urtwn_softc *, > + struct ieee80211_channel *, > + struct ieee80211_channel *); > +static void urtwn_scan_start(struct ieee80211com *); > +static void urtwn_scan_end(struct ieee80211com *); > +static void urtwn_set_channel(struct ieee80211com *); > +static void urtwn_set_chan(struct urtwn_softc *, > + struct ieee80211_channel *, > + struct ieee80211_channel *); > +static void urtwn_update_mcast(struct ifnet *); > +static void urtwn_iq_calib(struct urtwn_softc *); > +static void urtwn_lc_calib(struct urtwn_softc *); > +static void urtwn_init(void *); > +static void urtwn_init_locked(void *); > +static void urtwn_stop(struct ifnet *, int); > +static void urtwn_stop_locked(struct ifnet *, int); > +static void urtwn_abort_xfers(struct urtwn_softc *); > +static int urtwn_raw_xmit(struct ieee80211_node *, struct mbuf *, > + const struct ieee80211_bpf_params *); > + > +/* Aliases. */ > +#define urtwn_bb_write urtwn_write_4 > +#define urtwn_bb_read urtwn_read_4 > + > +static const struct usb_config urtwn_config[URTWN_N_TRANSFER] = { > + [URTWN_BULK_RX] = { > + .type = UE_BULK, > + .endpoint = UE_ADDR_ANY, > + .direction = UE_DIR_IN, > + .bufsize = URTWN_RXBUFSZ, > + .flags = { > + .pipe_bof = 1, > + .short_xfer_ok = 1 > + }, > + .callback = urtwn_bulk_rx_callback, > + }, > + [URTWN_BULK_TX_BE] = { > + .type = UE_BULK, > + .endpoint = 0x03, > + .direction = UE_DIR_OUT, > + .bufsize = URTWN_TXBUFSZ, > + .flags = { > + .ext_buffer = 1, > + .pipe_bof = 1, > + .force_short_xfer = 1 > + }, > + .callback = urtwn_bulk_tx_callback, > + .timeout = URTWN_TX_TIMEOUT, /* ms */ > + }, > + [URTWN_BULK_TX_BK] = { > + .type = UE_BULK, > + .endpoint = 0x03, > + .direction = UE_DIR_OUT, > + .bufsize = URTWN_TXBUFSZ, > + .flags = { > + .ext_buffer = 1, > + .pipe_bof = 1, > + .force_short_xfer = 1, > + }, > + .callback = urtwn_bulk_tx_callback, > + .timeout = URTWN_TX_TIMEOUT, /* ms */ > + }, > + [URTWN_BULK_TX_VI] = { > + .type = UE_BULK, > + .endpoint = 0x02, > + .direction = UE_DIR_OUT, > + .bufsize = URTWN_TXBUFSZ, > + .flags = { > + .ext_buffer = 1, > + .pipe_bof = 1, > + .force_short_xfer = 1 > + }, > + .callback = urtwn_bulk_tx_callback, > + .timeout = URTWN_TX_TIMEOUT, /* ms */ > + }, > + [URTWN_BULK_TX_VO] = { > + .type = UE_BULK, > + .endpoint = 0x02, > + .direction = UE_DIR_OUT, > + .bufsize = URTWN_TXBUFSZ, > + .flags = { > + .ext_buffer = 1, > + .pipe_bof = 1, > + .force_short_xfer = 1 > + }, > + .callback = urtwn_bulk_tx_callback, > + .timeout = URTWN_TX_TIMEOUT, /* ms */ > + }, > +}; > + > +static int > +urtwn_match(device_t self) > +{ > + struct usb_attach_arg *uaa = device_get_ivars(self); > + > + if (uaa->usb_mode != USB_MODE_HOST) > + return (ENXIO); > + if (uaa->info.bConfigIndex != URTWN_CONFIG_INDEX) > + return (ENXIO); > + if (uaa->info.bIfaceIndex != URTWN_IFACE_INDEX) > + return (ENXIO); > + > + return (usbd_lookup_id_by_uaa(urtwn_devs, sizeof(urtwn_devs), uaa)); > +} > + > +static int > +urtwn_attach(device_t self) > +{ > + struct usb_attach_arg *uaa = device_get_ivars(self); > + struct urtwn_softc *sc = device_get_softc(self); > + struct ifnet *ifp; > + struct ieee80211com *ic; > + uint8_t iface_index, bands; > + int error; > + > + device_set_usb_desc(self); > + sc->sc_udev = uaa->device; > + sc->sc_dev = self; > + > + mtx_init(&sc->sc_mtx, device_get_nameunit(self), > + MTX_NETWORK_LOCK, MTX_DEF); > + callout_init(&sc->sc_watchdog_ch, 0); > + > + iface_index = URTWN_IFACE_INDEX; > + error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, > + urtwn_config, URTWN_N_TRANSFER, sc, &sc->sc_mtx); > + if (error) { > + device_printf(self, "could not allocate USB transfers, " > + "err=%s\n", usbd_errstr(error)); > + goto detach; > + } > + > + URTWN_LOCK(sc); > + > + error = urtwn_read_chipid(sc); > + if (error) { > + device_printf(sc->sc_dev, "unsupported test chip\n"); > + URTWN_UNLOCK(sc); > + goto detach; > + } > + > + /* Determine number of Tx/Rx chains. */ > + if (sc->chip & URTWN_CHIP_92C) { > + sc->ntxchains = (sc->chip & URTWN_CHIP_92C_1T2R) ? 1 : 2; > + sc->nrxchains = 2; > + } else { > + sc->ntxchains = 1; > + sc->nrxchains = 1; > + } > + urtwn_read_rom(sc); > + > + device_printf(sc->sc_dev, "MAC/BB RTL%s, RF 6052 %dT%dR\n", > + (sc->chip & URTWN_CHIP_92C) ? "8192CU" : > + (sc->board_type == R92C_BOARD_TYPE_HIGHPA) ? "8188RU" : > + (sc->board_type == R92C_BOARD_TYPE_MINICARD) ? "8188CE-VAU" : > + "8188CUS", sc->ntxchains, sc->nrxchains); > + > + URTWN_UNLOCK(sc); > + > + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); > + if (ifp == NULL) { > + device_printf(sc->sc_dev, "can not if_alloc()\n"); > + goto detach; > + } > + ic = ifp->if_l2com; > + > + ifp->if_softc = sc; > + if_initname(ifp, "urtwn", device_get_unit(sc->sc_dev)); > + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; > + ifp->if_init = urtwn_init; > + ifp->if_ioctl = urtwn_ioctl; > + ifp->if_start = urtwn_start; > + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); > + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; > + IFQ_SET_READY(&ifp->if_snd); > + > + ic->ic_ifp = ifp; > + ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ > + ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */ > + > + /* set device capabilities */ > + ic->ic_caps = > + IEEE80211_C_STA /* station mode */ > + | IEEE80211_C_MONITOR /* monitor mode */ > + | IEEE80211_C_SHPREAMBLE /* short preamble supported */ > + | IEEE80211_C_SHSLOT /* short slot time supported */ > + | IEEE80211_C_BGSCAN /* capable of bg scanning */ > + | IEEE80211_C_WPA /* 802.11i */ > + ; > + > + bands = 0; > + setbit(&bands, IEEE80211_MODE_11B); > + setbit(&bands, IEEE80211_MODE_11G); > + ieee80211_init_channels(ic, NULL, &bands); > + > + ieee80211_ifattach(ic, sc->sc_bssid); > + ic->ic_raw_xmit = urtwn_raw_xmit; > + ic->ic_scan_start = urtwn_scan_start; > + ic->ic_scan_end = urtwn_scan_end; > + ic->ic_set_channel = urtwn_set_channel; > + > + ic->ic_vap_create = urtwn_vap_create; > + ic->ic_vap_delete = urtwn_vap_delete; > + ic->ic_update_mcast = urtwn_update_mcast; > + > + ieee80211_radiotap_attach(ic, &sc->sc_txtap.wt_ihdr, > + sizeof(sc->sc_txtap), URTWN_TX_RADIOTAP_PRESENT, > + &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), > + URTWN_RX_RADIOTAP_PRESENT); > + > + if (bootverbose) > + ieee80211_announce(ic); > + > + return (0); > + > +detach: > + urtwn_detach(self); > + return (ENXIO); /* failure */ > +} > + > +static int > +urtwn_detach(device_t self) > +{ > + struct urtwn_softc *sc = device_get_softc(self); > + struct ifnet *ifp = sc->sc_ifp; > + struct ieee80211com *ic = ifp->if_l2com; > + > + if (!device_is_attached(self)) > + return (0); > + > + urtwn_stop(ifp, 1); > + > + callout_drain(&sc->sc_watchdog_ch); > + > + /* stop all USB transfers */ > + usbd_transfer_unsetup(sc->sc_xfer, URTWN_N_TRANSFER); > + ieee80211_ifdetach(ic); > + > + urtwn_free_tx_list(sc); > + urtwn_free_rx_list(sc); > + > + if_free(ifp); > + mtx_destroy(&sc->sc_mtx); > + > + return (0); > +} > + > +static void > +urtwn_free_tx_list(struct urtwn_softc *sc) > +{ > + urtwn_free_list(sc, sc->sc_tx, URTWN_TX_LIST_COUNT); > +} > + > +static void > +urtwn_free_rx_list(struct urtwn_softc *sc) > +{ > + urtwn_free_list(sc, sc->sc_rx, URTWN_RX_LIST_COUNT); > +} > + > +static void > +urtwn_free_list(struct urtwn_softc *sc, struct urtwn_data data[], int ndata) > +{ > + int i; > + > + for (i = 0; i < ndata; i++) { > + struct urtwn_data *dp = &data[i]; > + > + if (dp->buf != NULL) { > + free(dp->buf, M_USBDEV); > + dp->buf = NULL; > + } > + if (dp->ni != NULL) { > + ieee80211_free_node(dp->ni); > + dp->ni = NULL; > + } > + } > +} > + > +static usb_error_t > +urtwn_do_request(struct urtwn_softc *sc, struct usb_device_request *req, > + void *data) > +{ > + usb_error_t err; > + int ntries = 10; > + > + URTWN_ASSERT_LOCKED(sc); > + > + while (ntries--) { > + err = usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, > + req, data, 0, NULL, 250 /* ms */); > + if (err == 0) > + break; > + > + DPRINTFN(1, "Control request failed, %s (retrying)\n", > + usbd_errstr(err)); > + usb_pause_mtx(&sc->sc_mtx, hz / 100); > + } > + return (err); > +} > + > +static struct ieee80211vap * > +urtwn_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > +{ > + struct urtwn_vap *uvp; > + struct ieee80211vap *vap; > + > + if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */ > + return (NULL); > + > + uvp = (struct urtwn_vap *) malloc(sizeof(struct urtwn_vap), > + M_80211_VAP, M_NOWAIT | M_ZERO); > + if (uvp == NULL) > + return (NULL); > + vap = &uvp->vap; > + /* enable s/w bmiss handling for sta mode */ > + ieee80211_vap_setup(ic, vap, name, unit, opmode, > + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); > + > + /* override state transition machine */ > + uvp->newstate = vap->iv_newstate; > + vap->iv_newstate = urtwn_newstate; > + > + /* complete setup */ > + ieee80211_vap_attach(vap, ieee80211_media_change, > + ieee80211_media_status); > + ic->ic_opmode = opmode; > + return (vap); > +} > + > +static void > +urtwn_vap_delete(struct ieee80211vap *vap) > +{ > + struct urtwn_vap *uvp = URTWN_VAP(vap); > + > + ieee80211_vap_detach(vap); > + free(uvp, M_80211_VAP); > +} > + > +static struct mbuf * > +urtwn_rx_frame(struct urtwn_softc *sc, uint8_t *buf, int pktlen, int *rssi_p) > +{ > + struct ifnet *ifp = sc->sc_ifp; > + struct ieee80211com *ic = ifp->if_l2com; > + struct ieee80211_frame *wh; > + struct mbuf *m; > + struct r92c_rx_stat *stat; > + uint32_t rxdw0, rxdw3; > + uint8_t rate; > + int8_t rssi = 0; > + int infosz; > + > + /* > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 17:35:07 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3F953DAE; Sat, 8 Jun 2013 17:35:07 +0000 (UTC) (envelope-from edschouten@gmail.com) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx1.freebsd.org (Postfix) with ESMTP id C0FF0189F; Sat, 8 Jun 2013 17:35:06 +0000 (UTC) Received: by mail-vc0-f173.google.com with SMTP id ht10so18056vcb.32 for ; Sat, 08 Jun 2013 10:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=84t7qwRDPIYTViTnf7+AQClePUEP05CGH2Bsx8AVTvk=; b=fESHkWQDqODL8Hwfx+CodDCsczdo+BVCHTii8VYXqG0sryION1RHeGc8+LYTvrnIOM HNyW+LOOImi588O/1PwhEOmS7bFIeyrT2lNobcyucZHCYLh/EQmKTiFxrG87bsjM0zYF ePe68n4q3IrXrag98owyE/AG1EVRIwq+GPEXJ4I2w+R+XT8xARQ/IxdC++wZ4gCMVZZc 1BRaYp3Bd6P0Kwcx/Iy2yfAwyhu5i6fF20XgDJLxIic9KA9IXrPCrM9xHODZqWuhmgOF 6wRybFCufr3b+KnUKsrMJpQNVtV4zr2j3ADYBMAJiuDNccCo5L/FnXIDpIcKFIbtBLMD tUdg== MIME-Version: 1.0 X-Received: by 10.52.165.36 with SMTP id yv4mr1651882vdb.31.1370712905990; Sat, 08 Jun 2013 10:35:05 -0700 (PDT) Sender: edschouten@gmail.com Received: by 10.220.107.139 with HTTP; Sat, 8 Jun 2013 10:35:05 -0700 (PDT) In-Reply-To: References: <201306081319.r58DJBS0061186@svn.freebsd.org> Date: Sat, 8 Jun 2013 19:35:05 +0200 X-Google-Sender-Auth: da0YKA7cEZDXvLwiEe_RNwByx7M Message-ID: Subject: Re: svn commit: r251524 - in head/sys: conf mips/mips From: Ed Schouten To: Adrian Chadd Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 17:35:07 -0000 Hello Adrian, 2013/6/8 Adrian Chadd : > .. have we decided whether to nuke the NOP flush from orbit? I thought we didn't make a clear decision on that yet, so I decided to leave it as it is for now. I'll make sure the sync routine in this file remains in sync with the one in . -- Ed Schouten From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 17:36:32 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 45AE6F64; Sat, 8 Jun 2013 17:36:32 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3794D18C9; Sat, 8 Jun 2013 17:36:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58HaWMN044179; Sat, 8 Jun 2013 17:36:32 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58HaWhY044178; Sat, 8 Jun 2013 17:36:32 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306081736.r58HaWhY044178@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 17:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251542 - head/usr.sbin/bsdconfig/usermgmt/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 17:36:32 -0000 Author: dteske Date: Sat Jun 8 17:36:31 2013 New Revision: 251542 URL: http://svnweb.freebsd.org/changeset/base/251542 Log: Fix a regression in the "Login Management" module introduced by r251242 in which choosing to cancel the manual input of expiration time (in seconds since the UNIX epoch) for either account expiration or password expiration would see the original value lost. Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sat Jun 8 16:49:19 2013 (r251541) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sat Jun 8 17:36:31 2013 (r251542) @@ -591,14 +591,16 @@ f_dialog_input_expire_password() break ;; 4) # Enter value manually - local msg + local msg ret_secs msg=$( printf "$msg_number_of_seconds_since_epoch" \ "$( date -r 1 "+%c %Z" )" ) # Return to menu if either ESC or Cancel/No - f_dialog_input _input \ + f_dialog_input ret_secs \ "$msg" "$_input" "$hline" || continue + _input="$ret_secs" + # Taint-check the user's input if ! f_isinteger "${_input:-0}"; then f_dialog_msgbox \ @@ -772,14 +774,16 @@ f_dialog_input_expire_account() break ;; 4) # Enter value manually - local msg + local msg ret_secs msg=$( printf "$msg_number_of_seconds_since_epoch" \ "$( date -r 1 "+%c %Z" )" ) # Return to menu if either ESC or Cancel/No - f_dialog_input _input "$msg" \ + f_dialog_input ret_secs "$msg" \ "$_input" "$hline" || continue + _input="$ret_secs" + # Taint-check the user's input if ! f_isinteger "${_input:-0}"; then f_dialog_msgbox \ From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 17:46:39 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DE1AE70D; Sat, 8 Jun 2013 17:46:39 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B6FA61AFE; Sat, 8 Jun 2013 17:46:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58Hkd4V047202; Sat, 8 Jun 2013 17:46:39 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58HkdbJ047201; Sat, 8 Jun 2013 17:46:39 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306081746.r58HkdbJ047201@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 17:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251543 - head/usr.sbin/bsdconfig/usermgmt/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 17:46:39 -0000 Author: dteske Date: Sat Jun 8 17:46:39 2013 New Revision: 251543 URL: http://svnweb.freebsd.org/changeset/base/251543 Log: Track defaultitem in the password and account expiry menus; if the user presses ESC or chooses Cancel/No in any of the sub-menus, we want to return to the expiry menu with that item selected. Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sat Jun 8 17:36:31 2013 (r251542) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sat Jun 8 17:46:39 2013 (r251543) @@ -483,12 +483,13 @@ f_dialog_input_expire_password() # # Loop until the user provides taint-free/cancellation-free input # - local date_type + local date_type defaultitem= while :; do date_type=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ + --default-item \"\$defaultitem\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" \ @@ -498,6 +499,7 @@ f_dialog_input_expire_password() ) retval=$? f_dialog_data_sanitize date_type + defaultitem="$date_type" f_dprintf "retval=%u date_type=[%s]" $retval "$date_type" # Return if user has either pressed ESC or chosen Cancel/No @@ -666,12 +668,13 @@ f_dialog_input_expire_account() # # Loop until the user provides taint-free/cancellation-free input # - local date_type + local date_type defaultitem= while :; do date_type=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ + --default-item \"\$defaultitem\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" \ @@ -681,6 +684,7 @@ f_dialog_input_expire_account() ) retval=$? f_dialog_data_sanitize date_type + defaultitem="$date_type" f_dprintf "retval=%u date_type=[%s]" $retval "$date_type" # Return if user has either pressed ESC or chosen Cancel/No From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 18:08:18 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D6F181FD; Sat, 8 Jun 2013 18:08:18 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AF2B51E29; Sat, 8 Jun 2013 18:08:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58I8IPH053861; Sat, 8 Jun 2013 18:08:18 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58I8IVT053859; Sat, 8 Jun 2013 18:08:18 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306081808.r58I8IVT053859@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 18:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251544 - head/usr.sbin/bsdconfig/usermgmt/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 18:08:18 -0000 Author: dteske Date: Sat Jun 8 18:08:17 2013 New Revision: 251544 URL: http://svnweb.freebsd.org/changeset/base/251544 Log: Check for ESC as a separate choice from "NO" when asking if the operator would like to disable password management for an account while adding either a user or group. When being prompted to answer questions while adding a group or user, two things are trow: 1. You can hit ENTER to blast through all the questions and in the end, the group or user is created with sensible defaults for all values. 2. You can press ESC during any prompt to cancel the operation as a whole. This fix is shoring up an inconsistency in the latter (#2). Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Sat Jun 8 17:46:39 2013 (r251543) +++ head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Sat Jun 8 18:08:17 2013 (r251544) @@ -237,10 +237,10 @@ f_dialog_input_group_password() # Check for NULL entry if [ ! "$_password1" ]; then - f_dialog_yesno \ - "$msg_disable_password_auth_for_group" || - continue - pw_group_password_disable=1 + f_dialog_yesno "$msg_disable_password_auth_for_group" + local retval=$? + [ $retval -eq 255 ] && return $retval # ESC was pressed + [ $retval -eq $SUCCESS ] && pw_group_password_disable=1 else pw_group_password_disable= fi Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sat Jun 8 17:46:39 2013 (r251543) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sat Jun 8 18:08:17 2013 (r251544) @@ -334,10 +334,10 @@ f_dialog_input_password() # Check for NULL entry if [ ! "$_password1" ]; then - f_dialog_yesno \ - "$msg_disable_password_auth_for_account" || - continue - pw_password_disable=1 + f_dialog_yesno "$msg_disable_password_auth_for_account" + local retval=$? + [ $retval -eq 255 ] && return $retval # ESC was pressed + [ $retval -eq $SUCCESS ] && pw_password_disable=1 else pw_password_disable= fi From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 18:13:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B90B7505; Sat, 8 Jun 2013 18:13:42 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AAD3D1E73; Sat, 8 Jun 2013 18:13:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58IDgdv056473; Sat, 8 Jun 2013 18:13:42 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58IDg8o056471; Sat, 8 Jun 2013 18:13:42 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306081813.r58IDg8o056471@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 18:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251545 - head/usr.sbin/bsdconfig/usermgmt/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 18:13:42 -0000 Author: dteske Date: Sat Jun 8 18:13:42 2013 New Revision: 251545 URL: http://svnweb.freebsd.org/changeset/base/251545 Log: Fix a regression introduced by r251544; if user chooses "NO" when being asked if they would like to disable password authentication for the account, loop back to prompt them for the password again. Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Sat Jun 8 18:08:17 2013 (r251544) +++ head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Sat Jun 8 18:13:42 2013 (r251545) @@ -241,6 +241,7 @@ f_dialog_input_group_password() local retval=$? [ $retval -eq 255 ] && return $retval # ESC was pressed [ $retval -eq $SUCCESS ] && pw_group_password_disable=1 + continue # back to password prompt else pw_group_password_disable= fi Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sat Jun 8 18:08:17 2013 (r251544) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sat Jun 8 18:13:42 2013 (r251545) @@ -338,6 +338,7 @@ f_dialog_input_password() local retval=$? [ $retval -eq 255 ] && return $retval # ESC was pressed [ $retval -eq $SUCCESS ] && pw_password_disable=1 + continue # back to password prompt else pw_password_disable= fi From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 18:16:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 70E7D7D8; Sat, 8 Jun 2013 18:16:42 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 48F021E95; Sat, 8 Jun 2013 18:16:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58IGgh7056975; Sat, 8 Jun 2013 18:16:42 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58IGg5O056974; Sat, 8 Jun 2013 18:16:42 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201306081816.r58IGg5O056974@svn.freebsd.org> From: Sergey Kandaurov Date: Sat, 8 Jun 2013 18:16:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251546 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 18:16:42 -0000 Author: pluknet Date: Sat Jun 8 18:16:41 2013 New Revision: 251546 URL: http://svnweb.freebsd.org/changeset/base/251546 Log: Update locking scheme, mostly transition from sched_lock. Modified: head/share/man/man9/signal.9 Modified: head/share/man/man9/signal.9 ============================================================================== --- head/share/man/man9/signal.9 Sat Jun 8 18:13:42 2013 (r251545) +++ head/share/man/man9/signal.9 Sat Jun 8 18:16:41 2013 (r251546) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2004 +.Dd June 8, 2013 .Dt SIGNAL 9 .Os .Sh NAME @@ -252,7 +252,7 @@ The function resets the signal set and signal stack of a process in preparation for an .Xr execve 2 . -The lock for +The process lock for .Fa p must be held before .Fn execsigs @@ -272,11 +272,9 @@ Stop signals are handled and cleared rig .Fn issignal unless the process is a member of an orphaned process group and the stop signal originated from a TTY. -The -.Va sched_lock -lock may be acquired and released, and if -.Va Giant -is held, it may be released and reacquired. +The process spin lock for +.Fa td->td_proc +may be acquired and released. The .Vt sigacts structure @@ -289,9 +287,6 @@ The process lock for must be acquired before calling .Fn issignal and may be released and reacquired during the call. -The lock for the parent of -.Fa td->td_proc -may also be acquired and released. Default signal actions are not taken for system processes and init. .Pp The @@ -342,7 +337,7 @@ after the kernel has been notified that which causes the flag .Dv PS_NEEDSIGCHK to be set). -The lock for process that owns +The process lock for process that owns .Va curthread must be held before .Fn postsig @@ -360,7 +355,7 @@ function causes the process that owns to exit with a return value of signal number .Fa sig . If required, the process will dump core. -The lock for the process that owns +The process lock for the process that owns .Fa td must be held before .Fn sigexit @@ -377,8 +372,8 @@ to be ignored by .Fa p . The process lock for .Fa p -is acquired and released by -.Fn siginit . +is acquired and released, as is the lock for sigacts structure +.Fa p->p_sigacts . The only process that .Fn siginit is ever called for @@ -390,13 +385,11 @@ The function flags that there are unmasked signals pending that .Fn ast should handle. -The lock for process +The process lock for process .Fa td->td_proc must be held before .Fn signotify -is called, and -.Va sched_lock -is acquired and released. +is called, and the thread lock is acquired and released. .Pp The .Fn trapsignal @@ -410,10 +403,9 @@ will deliver it directly; otherwise, will call .Xr psignal 9 to cause the signal to be delivered. -The -.Va sched_lock -lock is acquired and released, as is the lock for -.Fa td->td_proc . +The process lock for +.Fa td->td_proc +is acquired and released. The lock for the .Va p_sigacts field of From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 18:23:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B4D63C4A; Sat, 8 Jun 2013 18:23:42 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8D41A1EC9; Sat, 8 Jun 2013 18:23:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58INgXD059664; Sat, 8 Jun 2013 18:23:42 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58INgCw059661; Sat, 8 Jun 2013 18:23:42 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306081823.r58INgCw059661@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 18:23:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251547 - head/usr.sbin/bsdconfig/usermgmt/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 18:23:42 -0000 Author: dteske Date: Sat Jun 8 18:23:41 2013 New Revision: 251547 URL: http://svnweb.freebsd.org/changeset/base/251547 Log: Curb another regression (this one introduced by r251545, itself trying to fix the regression introduced by r251544; which was trying to make things consistent w/respect to ESC versus YES versus NO in the password disable prompt in "Login Management". (need stronger coffee; very sorry for the churn) With this revision, the "YES", "NO", and implied ESC options all work as- expected. Choosing "YES" allows you to proceed and the password will be disabled. Choosing "NO" will bring back around to enter a password for the account. Pressing ESC will drop you out of either user or group input and back to the usermgmt screen. Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Sat Jun 8 18:16:41 2013 (r251546) +++ head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Sat Jun 8 18:23:41 2013 (r251547) @@ -239,9 +239,13 @@ f_dialog_input_group_password() if [ ! "$_password1" ]; then f_dialog_yesno "$msg_disable_password_auth_for_group" local retval=$? - [ $retval -eq 255 ] && return $retval # ESC was pressed - [ $retval -eq $SUCCESS ] && pw_group_password_disable=1 - continue # back to password prompt + if [ $retval -eq 255 ]; then # ESC was pressed + return $retval + elif [ $retval -eq $SUCCESS ]; then + pw_group_password_disable=1 + else + continue # back to password prompt + fi else pw_group_password_disable= fi Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sat Jun 8 18:16:41 2013 (r251546) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Sat Jun 8 18:23:41 2013 (r251547) @@ -336,9 +336,13 @@ f_dialog_input_password() if [ ! "$_password1" ]; then f_dialog_yesno "$msg_disable_password_auth_for_account" local retval=$? - [ $retval -eq 255 ] && return $retval # ESC was pressed - [ $retval -eq $SUCCESS ] && pw_password_disable=1 - continue # back to password prompt + if [ $retval -eq 255 ]; then # ESC was pressed + return $retval + elif [ $retval -eq $SUCCESS ]; then + pw_password_disable=1 + else + continue # back to password prompt + fi else pw_password_disable= fi From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 18:25:09 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6ABF8DEF; Sat, 8 Jun 2013 18:25:09 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D1D31EDC; Sat, 8 Jun 2013 18:25:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58IP9mQ059940; Sat, 8 Jun 2013 18:25:09 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58IP9HA059939; Sat, 8 Jun 2013 18:25:09 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201306081825.r58IP9HA059939@svn.freebsd.org> From: Sergey Kandaurov Date: Sat, 8 Jun 2013 18:25:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251548 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 18:25:09 -0000 Author: pluknet Date: Sat Jun 8 18:25:08 2013 New Revision: 251548 URL: http://svnweb.freebsd.org/changeset/base/251548 Log: Minor markup. Modified: head/share/man/man4/urtwn.4 Modified: head/share/man/man4/urtwn.4 ============================================================================== --- head/share/man/man4/urtwn.4 Sat Jun 8 18:23:41 2013 (r251547) +++ head/share/man/man4/urtwn.4 Sat Jun 8 18:25:08 2013 (r251548) @@ -115,7 +115,7 @@ This should not happen. .Xr wlan_ccmp 4 , .Xr wlan_tkip 4 , .Xr wlan_wep 4 , -.Xr ifconfig 8, +.Xr ifconfig 8 , .Xr wpa_supplicant 8 .Rs .%T Realtek @@ -125,7 +125,7 @@ This should not happen. The .Nm driver first appeared in -.Ox 4.9 +.Ox 4.9 and .Fx 10.0 . .Sh AUTHORS From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 19:13:50 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BCD9B9A5; Sat, 8 Jun 2013 19:13:50 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9D6A110AA; Sat, 8 Jun 2013 19:13:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58JDos0075320; Sat, 8 Jun 2013 19:13:50 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58JDn6q075315; Sat, 8 Jun 2013 19:13:49 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306081913.r58JDn6q075315@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 19:13:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251549 - in head/usr.sbin/bsdconfig/usermgmt: . include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 19:13:50 -0000 Author: dteske Date: Sat Jun 8 19:13:49 2013 New Revision: 251549 URL: http://svnweb.freebsd.org/changeset/base/251549 Log: Add a prompt to the "Add User" and "Add Group" sub-menu items (under the "Login Management" module): Use default values for all account details? If you select "Yes" (the default is "No"), you'll jump past all the prompts and jump straight to the review screen with all-default values. Makes adding a lot of users/groups faster/easier if you don't need to customize more than one or two different values from their defaults. Modified: head/usr.sbin/bsdconfig/usermgmt/groupinput head/usr.sbin/bsdconfig/usermgmt/include/messages.subr head/usr.sbin/bsdconfig/usermgmt/userinput Modified: head/usr.sbin/bsdconfig/usermgmt/groupinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/groupinput Sat Jun 8 18:25:08 2013 (r251548) +++ head/usr.sbin/bsdconfig/usermgmt/groupinput Sat Jun 8 19:13:49 2013 (r251549) @@ -157,19 +157,27 @@ save_flag= hline="$hline_arrows_tab_enter" if [ "$mode" = "Add" ]; then - # - # Ask a series of questions to pre-fill the editor screen. - # - # The defaults used in each dialog should allow the user to simply - # hit ENTER to proceed, because cancelling a single dialog will - # cause them to be returned to the main groupmenu. - # - f_dialog_input_group_name || exit 0 - [ "$passwdtype" = "yes" ] && - { f_dialog_input_group_password || exit 0; } - f_dialog_input_group_gid || exit 0 - f_dialog_input_group_members || exit 0 + + f_dialog_noyes "$msg_use_default_values_for_all_account_details" + retval=$? + + if [ $retval -eq 255 ]; then # User pressed ESC + exit $SUCCESS + elif [ $retval -ne $SUCCESS ]; then + # + # Ask a series of questions to pre-fill the editor screen. + # + # The defaults used in each dialog should allow the user to + # simply hit ENTER to proceed, because cancelling a single + # dialog will cause them to be returned to the main groupmenu. + # + + [ "$passwdtype" = "yes" ] && + { f_dialog_input_group_password || exit 0; } + f_dialog_input_group_gid || exit 0 + f_dialog_input_group_members || exit 0 + fi fi if [ "$mode" = "Edit/View" -o "$mode" = "Delete" ]; then Modified: head/usr.sbin/bsdconfig/usermgmt/include/messages.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/include/messages.subr Sat Jun 8 18:25:08 2013 (r251548) +++ head/usr.sbin/bsdconfig/usermgmt/include/messages.subr Sat Jun 8 19:13:49 2013 (r251549) @@ -105,6 +105,7 @@ msg_separated_by_commas="Separated by co msg_select_group_members_from_list="Select Group Members from a list" msg_select_login_shell="Select Login Shell" msg_shell="Shell" +msg_use_default_values_for_all_account_details="Use default values for all account details?" msg_user="User" msg_user_id="UID" msg_user_id_leave_empty_for_default="UID (Leave empty for default)" Modified: head/usr.sbin/bsdconfig/usermgmt/userinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/userinput Sat Jun 8 18:25:08 2013 (r251548) +++ head/usr.sbin/bsdconfig/usermgmt/userinput Sat Jun 8 19:13:49 2013 (r251549) @@ -238,32 +238,53 @@ save_flag= hline="$hline_arrows_tab_enter" if [ "$mode" = "Add" ]; then + f_dialog_input_name || exit 0 + # - # Ask a series of questions to pre-fill the editor screen. - # - # The defaults used in each dialog should allow the user to simply - # hit ENTER to proceed, because cancelling a single dialog will - # cause them to be returned to the main usermenu. + # Set some sensible defaults for account attributes # + pw_gecos="${pw_gecos-$pw_name}" + pw_home_dir="${pw_home_dir:-$homeprefix/$pw_name}" + if [ -d "$pw_home_dir" ]; then + pw_home_create="${pw_home_create:-$msg_no}" + pw_dotfiles_create="${pw_dotfiles_create:-$msg_no}" + else + pw_home_create="${pw_home_create:-$msg_yes}" + pw_dotfiles_create="${pw_dotfiles_create:-$msg_yes}" + fi + pw_shell="${pw_shell:-$defaultshell}" - f_dialog_input_name || exit 0 - f_dialog_input_gecos "$pw_name" || exit 0 - [ "$passwdtype" = "yes" ] && - { f_dialog_input_password || exit 0; } - f_dialog_input_uid || exit 0 - f_dialog_input_gid || exit 0 - f_dialog_input_member_groups || exit 0 - f_dialog_input_class || exit 0 - f_dialog_input_expire_password || exit 0 - f_dialog_input_expire_account || exit 0 - f_dialog_input_home_dir "$homeprefix/$pw_name" || exit 0 - pw_dotfiles_create="$msg_no" - if [ ! -d "$homeprefix/$pw_name" ]; then - f_dialog_input_home_create || exit 0 - [ "$pw_home_create" = "$msg_yes" ] && - { f_dialog_input_dotfiles_create || exit 0; } + f_dialog_noyes "$msg_use_default_values_for_all_account_details" + retval=$? + + if [ $retval -eq 255 ]; then # User pressed ESC + exit $SUCCESS + elif [ $retval -ne $SUCCESS ]; then + # + # Ask a series of questions to pre-fill the editor screen. + # + # The defaults used in each dialog should allow the user to + # simply hit ENTER to proceed, because cancelling a single + # dialog will cause them to be returned to the main usermenu. + # + + f_dialog_input_gecos "$pw_gecos" || exit 0 + [ "$passwdtype" = "yes" ] && + { f_dialog_input_password || exit 0; } + f_dialog_input_uid || exit 0 + f_dialog_input_gid || exit 0 + f_dialog_input_member_groups || exit 0 + f_dialog_input_class || exit 0 + f_dialog_input_expire_password || exit 0 + f_dialog_input_expire_account || exit 0 + f_dialog_input_home_dir "$pw_home_dir" || exit 0 + if [ ! -d "$pw_home_dir" ]; then + f_dialog_input_home_create || exit 0 + [ "$pw_home_create" = "$msg_yes" ] && + { f_dialog_input_dotfiles_create || exit 0; } + fi + f_dialog_input_shell "$pw_shell" || exit 0 fi - f_dialog_input_shell "$defaultshell" || exit 0 fi if [ "$mode" = "Edit/View" -o "$mode" = "Delete" ]; then From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 20:12:14 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BAB825EA; Sat, 8 Jun 2013 20:12:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AD26A122A; Sat, 8 Jun 2013 20:12:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58KCEhE093699; Sat, 8 Jun 2013 20:12:14 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58KCESw093698; Sat, 8 Jun 2013 20:12:14 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306082012.r58KCESw093698@svn.freebsd.org> From: Adrian Chadd Date: Sat, 8 Jun 2013 20:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251550 - head/sys/dev/flash X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 20:12:14 -0000 Author: adrian Date: Sat Jun 8 20:12:14 2013 New Revision: 251550 URL: http://svnweb.freebsd.org/changeset/base/251550 Log: Add support for two new winbond SPI flash parts. The 8devices carambola 2 board uses the 16MB part. Here's how it looks: spibus0: on spi0 mx25l0: at cs 0 on spibus0 mx25l0: w25q128, sector 65536 bytes, 256 sectors Tested: * 8devices Carambola 2 board Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sat Jun 8 19:13:49 2013 (r251549) +++ head/sys/dev/flash/mx25l.c Sat Jun 8 20:12:14 2013 (r251550) @@ -108,10 +108,14 @@ struct mx25l_flash_ident flash_devices[] { "s25s1032", 0x01, 0x0215, 64 * 1024, 64, FL_NONE }, { "s25sl064a", 0x01, 0x0216, 64 * 1024, 128, FL_NONE }, { "SST25VF032B", 0xbf, 0x254a, 64 * 1024, 64, FL_ERASE_4K | FL_ERASE_32K }, + + /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ + { "w25x32", 0xef, 0x3016, 64 * 1024, 64, FL_ERASE_4K }, { "w25q32", 0xef, 0x4016, 64 * 1024, 64, FL_ERASE_4K }, { "w25q64", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, { "w25q64bv", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, - { "w25x32", 0xef, 0x3016, 64 * 1024, 64, FL_ERASE_4K }, + { "w25q128", 0xef, 0x4018, 64 * 1024, 256, FL_ERASE_4K }, + { "w25q256", 0xef, 0x4019, 64 * 1024, 512, FL_ERASE_4K }, }; static uint8_t From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 20:21:18 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 48D198AF; Sat, 8 Jun 2013 20:21:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2ABB4125E; Sat, 8 Jun 2013 20:21:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58KLIjC096719; Sat, 8 Jun 2013 20:21:18 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58KLHrA096717; Sat, 8 Jun 2013 20:21:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306082021.r58KLHrA096717@svn.freebsd.org> From: Adrian Chadd Date: Sat, 8 Jun 2013 20:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251551 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 20:21:18 -0000 Author: adrian Date: Sat Jun 8 20:21:17 2013 New Revision: 251551 URL: http://svnweb.freebsd.org/changeset/base/251551 Log: Add 8devices CARAMBOLA2 support. This is based on the AR933x (Hornet) SoC from Qualcomm Atheros. It's a much nicer board to do development on - 64MB RAM, 16MB flash. The development board breaks out the GPIO pins, ethernet, serial (via a USB<->RS232 chip), USB host and of course a small wifi antenna. Everything but the wifi works thus far. Added: head/sys/mips/conf/CARAMBOLA2 (contents, props changed) head/sys/mips/conf/CARAMBOLA2.hints (contents, props changed) Added: head/sys/mips/conf/CARAMBOLA2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/conf/CARAMBOLA2 Sat Jun 8 20:21:17 2013 (r251551) @@ -0,0 +1,53 @@ +# +# Carambola 2 - an AR933x based SoC wifi device. +# +# http://shop.8devices.com/wifi4things/carambola2 +# +# * AR9330 SoC +# * 64MB RAM +# * 16MB flash +# * Integrated 1x1 2GHz wifi and 10/100 bridge +# +# $FreeBSD$ +# + +# Include the default AR933x parameters +include "AR933X_BASE" + +ident CARAMBOLA2 + +# Override hints with board values +hints "CARAMBOLA2.hints" + +# Board memory - 64MB +options AR71XX_REALMEM=(64*1024*1024) + +# i2c GPIO bus +#device gpioiic +#device iicbb +#device iicbus +#device iic + +# Options required for miiproxy and mdiobus +options ARGE_MDIO # Export an MDIO bus separate from arge +device miiproxy # MDIO bus <-> MII PHY rendezvous + +device etherswitch +device arswitch + +# read MSDOS formatted disks - USB +#options MSDOSFS + +# Enable the uboot environment stuff rather then the +# redboot stuff. +options AR71XX_ENV_UBOOT + +# uzip - to boot natively from flash +device geom_uncompress +options GEOM_UNCOMPRESS + +# Used for the static uboot partition map +device geom_map + +# Boot off of the rootfs, as defined in the geom_map setup. +options ROOTDEVNAME=\"ufs:map/rootfs.uncompress\" Added: head/sys/mips/conf/CARAMBOLA2.hints ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/conf/CARAMBOLA2.hints Sat Jun 8 20:21:17 2013 (r251551) @@ -0,0 +1,109 @@ +# +# This file adds to the values in AR91XX_BASE.hints. +# +# $FreeBSD$ + +# mdiobus on arge1 +hint.argemdio.0.at="nexus0" +hint.argemdio.0.maddr=0x1a000000 +hint.argemdio.0.msize=0x1000 +hint.argemdio.0.order=0 + +# Embedded Atheros Switch +hint.arswitch.0.at="mdio0" + +# XXX this should really say it's an AR933x switch, as there +# are some vlan specific differences here! +hint.arswitch.0.is_7240=1 +hint.arswitch.0.numphys=4 +hint.arswitch.0.phy4cpu=1 # phy 4 is a "CPU" separate PHY +hint.arswitch.0.is_rgmii=0 +hint.arswitch.0.is_gmii=1 # arge1 <-> switch PHY is GMII + +# arge0 - MII, autoneg, phy(4) +hint.arge.0.phymask=0x10 # PHY4 +hint.arge.0.mdio=mdioproxy1 # .. off of the switch mdiobus + +# arge1 - GMII, 1000/full +hint.arge.1.phymask=0x0 # No directly mapped PHYs +hint.arge.1.media=1000 +hint.arge.1.fduplex=1 + +# The AP121 16MB flash layout: +# +# [ 0.700000] 0x000000000000-0x000000040000 : "u-boot" +# [ 0.710000] 0x000000040000-0x000000050000 : "u-boot-env" +# [ 0.710000] 0x000000050000-0x000000250000 : "kernel" +# [ 0.720000] 0x000000250000-0x000000fe0000 : "rootfs" +# [ 0.720000] mtd: partition "rootfs" set to be root filesystem +# [ 0.730000] mtd: partition "rootfs_data" created automatically, ofs=480000, len=B60000 +# [ 0.740000] 0x000000480000-0x000000fe0000 : "rootfs_data" +# [ 0.740000] 0x000000fe0000-0x000000ff0000 : "nvram" +# [ 0.750000] 0x000000ff0000-0x000001000000 : "art" +# [ 0.750000] 0x000000050000-0x000000fe0000 : "firmware" + +hint.map.0.at="flash/spi0" +hint.map.0.start=0x00000000 +hint.map.0.end=0x000040000 +hint.map.0.name="uboot" +hint.map.0.readonly=1 + +hint.map.1.at="flash/spi0" +hint.map.1.start=0x00040000 +hint.map.1.end=0x00050000 +hint.map.1.name="uboot-env" +hint.map.1.readonly=0 + +hint.map.2.at="flash/spi0" +hint.map.2.start=0x00050000 +hint.map.2.end=0x00250000 +hint.map.2.name="kernel" +hint.map.2.readonly=0 + +hint.map.3.at="flash/spi0" +hint.map.3.start=0x00250000 +hint.map.3.end=0x00fe0000 +hint.map.3.name="rootfs" +hint.map.3.readonly=0 + +hint.map.4.at="flash/spi0" +hint.map.4.start=0x00fe0000 +hint.map.4.end=0x00ff0000 +hint.map.4.name="cfg" +hint.map.4.readonly=0 + +# This is radio calibration section. It is (or should be!) unique +# for each board, to take into account thermal and electrical differences +# as well as the regulatory compliance data. +# +hint.map.5.at="flash/spi0" +hint.map.5.start=0x00ff0000 +hint.map.5.end=0x01000000 +hint.map.5.name="art" +hint.map.5.readonly=1 + +# GPIO specific configuration block + +# Don't flip on anything that isn't already enabled. +# This includes leaving the SPI CS1/CS2 pins as GPIO pins as they're +# not used here. +hint.gpio.0.function_set=0x00000000 +hint.gpio.0.function_clear=0x00000000 + +# These are the GPIO LEDs and buttons which can be software controlled. +#hint.gpio.0.pinmask=0x001c02ae +hint.gpio.0.pinmask=0x00001803 + +# gpio0 - WLAN LED +# gpio1 - USB LED +# gpio11 - Jumpstart button +# gpio12 - Reset button + +# LEDs are configured separately and driven by the LED device +hint.gpioled.0.at="gpiobus0" +hint.gpioled.0.name="wlan" +hint.gpioled.0.pins=0x0001 + +hint.gpioled.1.at="gpiobus0" +hint.gpioled.1.name="usb" +hint.gpioled.1.pins=0x0002 From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 20:27:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AF1B0A6F; Sat, 8 Jun 2013 20:27:16 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A21AD127A; Sat, 8 Jun 2013 20:27:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58KRGu7097591; Sat, 8 Jun 2013 20:27:16 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58KRGLU097590; Sat, 8 Jun 2013 20:27:16 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306082027.r58KRGLU097590@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 20:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251552 - head/usr.sbin/bsdconfig/console X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 20:27:16 -0000 Author: dteske Date: Sat Jun 8 20:27:16 2013 New Revision: 251552 URL: http://svnweb.freebsd.org/changeset/base/251552 Log: Fix a one-character typo. The effects of which were "Console"->"Ttys" menu would not launch (and gave no error). This was easily diagnosed by running `bsdconfig -d' as root and seeing the following error right after selecting the "Ttys" sub-menu: DEBUG: f_getvar: var=[text] value=[ Error: Expected at least 6 tokens for --menu, have 4. Use --help to list options.] r=0 Typo was introduced by SVN r251361. Modified: head/usr.sbin/bsdconfig/console/ttys Modified: head/usr.sbin/bsdconfig/console/ttys ============================================================================== --- head/usr.sbin/bsdconfig/console/ttys Sat Jun 8 20:21:17 2013 (r251551) +++ head/usr.sbin/bsdconfig/console/ttys Sat Jun 8 20:27:16 2013 (r251552) @@ -86,7 +86,7 @@ dialog_menu_main() --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" \ $height $width $rows \ - $menu_ist \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 20:43:14 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F1474CCC; Sat, 8 Jun 2013 20:43:13 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E3D2712C8; Sat, 8 Jun 2013 20:43:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58KhDB6003099; Sat, 8 Jun 2013 20:43:13 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58KhDnE003098; Sat, 8 Jun 2013 20:43:13 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306082043.r58KhDnE003098@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 20:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251553 - head/usr.sbin/bsdconfig/console X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 20:43:14 -0000 Author: dteske Date: Sat Jun 8 20:43:13 2013 New Revision: 251553 URL: http://svnweb.freebsd.org/changeset/base/251553 Log: Prevent getting hung-up on the following prompt (found while testing with `chflags schg /etc/ttys'): override rw-r--r-- root/wheel for /etc/ttys? (y/n [n]) Simply by adding `-f' flag to mv(1). Modified: head/usr.sbin/bsdconfig/console/ttys Modified: head/usr.sbin/bsdconfig/console/ttys ============================================================================== --- head/usr.sbin/bsdconfig/console/ttys Sat Jun 8 20:27:16 2013 (r251552) +++ head/usr.sbin/bsdconfig/console/ttys Sat Jun 8 20:43:13 2013 (r251553) @@ -153,7 +153,7 @@ ttys_set_type() printf "%s%s%s\n", left, consterm, right } ' "$ETC_TTYS" > "$tmpfile" || return $FAILURE - f_quietly mv "$tmpfile" "$ETC_TTYS" || return $FAILURE + f_quietly mv -f "$tmpfile" "$ETC_TTYS" || return $FAILURE return $SUCCESS } From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 20:47:44 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 08E31E4C; Sat, 8 Jun 2013 20:47:44 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EF85612D6; Sat, 8 Jun 2013 20:47:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58Klh9u003842; Sat, 8 Jun 2013 20:47:43 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58KlhDK003841; Sat, 8 Jun 2013 20:47:43 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306082047.r58KlhDK003841@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 20:47:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251554 - head/usr.sbin/bsdconfig/console X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 20:47:44 -0000 Author: dteske Date: Sat Jun 8 20:47:43 2013 New Revision: 251554 URL: http://svnweb.freebsd.org/changeset/base/251554 Log: Don't silently ignore errors (found while testing with `chflags schg /etc/ttys). Modified: head/usr.sbin/bsdconfig/console/ttys Modified: head/usr.sbin/bsdconfig/console/ttys ============================================================================== --- head/usr.sbin/bsdconfig/console/ttys Sat Jun 8 20:43:13 2013 (r251553) +++ head/usr.sbin/bsdconfig/console/ttys Sat Jun 8 20:47:43 2013 (r251554) @@ -108,7 +108,7 @@ dialog_menu_main() # ttys_set_type() { - local consterm="$1" + local consterm="$1" err # # Create new temporary file to write our ttys(5) update with new types. @@ -130,7 +130,7 @@ ttys_set_type() # Operate on ttys(5), replacing only the types of `ttyv*' and # `cons[0-9]' terminals with the new type. # - awk -v consterm="$consterm" ' + if ! err=$( awk -v consterm="$consterm" ' BEGIN { } { @@ -152,8 +152,14 @@ ttys_set_type() right = substr($0, RSTART) printf "%s%s%s\n", left, consterm, right } - ' "$ETC_TTYS" > "$tmpfile" || return $FAILURE - f_quietly mv -f "$tmpfile" "$ETC_TTYS" || return $FAILURE + ' "$ETC_TTYS" > "$tmpfile" 2>&1 ); then + f_dialog_msgbox "$err" + return $FAILURE + fi + if ! err=$( mv -f "$tmpfile" "$ETC_TTYS" 2>&1 ); then + f_dialog_msgbox "$err" + return $FAILURE + fi return $SUCCESS } @@ -190,10 +196,7 @@ while :; do [ "$mtag" = "1 $msg_none" ] && break f_dialog_menuitem_fetch consterm - err=$( ttys_set_type "$consterm" 2>&1 ) - [ "$err" ] || break # to success - - f_dialog_msgbox "$err" + ttys_set_type "$consterm" && break done exit $SUCCESS From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 21:11:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3B259290; Sat, 8 Jun 2013 21:11:27 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2C47913BD; Sat, 8 Jun 2013 21:11:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58LBR61013709; Sat, 8 Jun 2013 21:11:27 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58LBRNu013708; Sat, 8 Jun 2013 21:11:27 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306082111.r58LBRNu013708@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 21:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251555 - head/usr.sbin/bsdconfig/startup/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 21:11:27 -0000 Author: dteske Date: Sat Jun 8 21:11:26 2013 New Revision: 251555 URL: http://svnweb.freebsd.org/changeset/base/251555 Log: Fix a typo in comments. Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sat Jun 8 20:47:43 2013 (r251554) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sat Jun 8 21:11:26 2013 (r251555) @@ -136,7 +136,7 @@ f_startup_rcconf_map() if [ -f "$STARTUP_RCCONF_MAP_CACHEFILE" ]; then # # Attempt to populate the in-memory cache with the (soon to be) - # be validated on-disk cache. If validation fails, fall-back to + # validated on-disk cache. If validation fails, fall-back to # the current value and provide error exit status. # STARTUP_RCCONF_MAP=$( From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 21:33:10 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0BFE86CB; Sat, 8 Jun 2013 21:33:10 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F283A15E8; Sat, 8 Jun 2013 21:33:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58LX9qB020176; Sat, 8 Jun 2013 21:33:09 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58LX97F020175; Sat, 8 Jun 2013 21:33:09 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306082133.r58LX97F020175@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 21:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251556 - head/usr.sbin/bsdconfig/startup/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 21:33:10 -0000 Author: dteske Date: Sat Jun 8 21:33:09 2013 New Revision: 251556 URL: http://svnweb.freebsd.org/changeset/base/251556 Log: Fix a bug introduced with r249751, in which a small hunk was forgotten in the performance conversion process. The effect of this was, when your /etc/defaults/rc.conf file changed (based on md5(1)) and re-generating the file startup_rcconf_map.cache in /var/run/bsdconfig/ you would get a screen-dump of its contents before the menu would appear. Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sat Jun 8 21:11:26 2013 (r251555) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sat Jun 8 21:33:09 2013 (r251556) @@ -207,7 +207,11 @@ f_startup_rcconf_map() ) export STARTUP_RCCONF_MAP export _STARTUP_RCCONF_MAP=1 - echo "$STARTUP_RCCONF_MAP" + if [ "$__var_to_set" ]; then + setvar "$__var_to_set" "$STARTUP_RCCONF_MAP" + else + echo "$STARTUP_RCCONF_MAP" + fi # # Attempt to create the persistant global cache From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 21:45:32 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 94A87910; Sat, 8 Jun 2013 21:45:32 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 86E5B161E; Sat, 8 Jun 2013 21:45:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58LjWjw023521; Sat, 8 Jun 2013 21:45:32 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58LjWV7023520; Sat, 8 Jun 2013 21:45:32 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306082145.r58LjWV7023520@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 21:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251557 - head/usr.sbin/bsdconfig/startup/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 21:45:32 -0000 Author: dteske Date: Sat Jun 8 21:45:32 2013 New Revision: 251557 URL: http://svnweb.freebsd.org/changeset/base/251557 Log: Fix a bug introduced with r251190, in which a small hunk was forgotten in the performance conversion process. The effect of this was the following error when selecting the menu "Startup"->"View/Edit Startup Configuration"->"Add New"->"Add From List": [: -eq: unexpected operator By running `bsdconfig -d' as root to enable debugging, this turns into: DEBUG: f_getvar: var=[text] value=[ Error: Expected a number for token 4 of --menu. Use --help to list options.] r=0 [: -eq: unexpected operator Indicating that the fourth token for --menu which should be $height was instead a string (the first item of $menu_list) because it was using the old size-calculation method and $size was now null (needed to use instead the new size variables of $height $width and $rows). Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sat Jun 8 21:33:09 2013 (r251556) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sat Jun 8 21:45:32 2013 (r251557) @@ -437,7 +437,8 @@ f_dialog_input_rclist() --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ ${SHOW_DESC:+--item-help} \ - --menu \"\$prompt\" $size \ + --menu \"\$prompt\" \ + $height $width $rows \ $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 22:44:50 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2FA15D96; Sat, 8 Jun 2013 22:44:49 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D390817E8; Sat, 8 Jun 2013 22:44:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58MinLm042824; Sat, 8 Jun 2013 22:44:49 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58MinML042822; Sat, 8 Jun 2013 22:44:49 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201306082244.r58MinML042822@svn.freebsd.org> From: Ed Schouten Date: Sat, 8 Jun 2013 22:44:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251558 - head/tools/regression/include/stdatomic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 22:44:50 -0000 Author: ed Date: Sat Jun 8 22:44:49 2013 New Revision: 251558 URL: http://svnweb.freebsd.org/changeset/base/251558 Log: Add testing utility for behavior of atomic ops. This small utility performs a sequence of atomic operations with random parameters on an atomic variable. For every type, we also create 16 variables, to ensure that we test the correctness at different alignments. Added: head/tools/regression/include/stdatomic/ head/tools/regression/include/stdatomic/Makefile (contents, props changed) head/tools/regression/include/stdatomic/logic.c (contents, props changed) Added: head/tools/regression/include/stdatomic/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/include/stdatomic/Makefile Sat Jun 8 22:44:49 2013 (r251558) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +PROG= logic +WARNS=6 +NO_MAN= + +.include Added: head/tools/regression/include/stdatomic/logic.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/include/stdatomic/logic.c Sat Jun 8 22:44:49 2013 (r251558) @@ -0,0 +1,128 @@ +/*- + * Copyright (c) 2013 Ed Schouten + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +/* + * Tool for testing the logical behaviour of operations on atomic + * integer types. These tests make no attempt to actually test whether + * the functions are atomic or provide the right barrier semantics. + * + * For every type, we create an array of 16 elements and repeat the test + * on every element in the array. This allows us to test whether the + * atomic operations have no effect on surrounding values. This is + * especially useful for the smaller integer types, as it may be the + * case that these operations are implemented by processing entire words + * (e.g. on MIPS). + */ + +static inline intmax_t +rndnum(void) +{ + intmax_t v; + + arc4random_buf(&v, sizeof(v)); + return (v); +} + +#define DO_FETCH_TEST(T, a, name, result) do { \ + T v1 = atomic_load(a); \ + T v2 = rndnum(); \ + assert(atomic_##name(a, v2) == v1); \ + assert(atomic_load(a) == (T)(result)); \ +} while (0) + +#define DO_COMPARE_EXCHANGE_TEST(T, a, name) do { \ + T v1 = atomic_load(a); \ + T v2 = rndnum(); \ + T v3 = rndnum(); \ + if (atomic_compare_exchange_##name(a, &v2, v3)) \ + assert(v1 == v2); \ + else \ + assert(atomic_compare_exchange_##name(a, &v2, v3)); \ + assert(atomic_load(a) == v3); \ +} while (0) + +#define DO_ALL_TESTS(T, a) do { \ + { \ + T v1 = rndnum(); \ + atomic_init(a, v1); \ + assert(atomic_load(a) == v1); \ + } \ + { \ + T v1 = rndnum(); \ + atomic_store(a, v1); \ + assert(atomic_load(a) == v1); \ + } \ + \ + DO_FETCH_TEST(T, a, exchange, v2); \ + DO_FETCH_TEST(T, a, fetch_add, v1 + v2); \ + DO_FETCH_TEST(T, a, fetch_and, v1 & v2); \ + DO_FETCH_TEST(T, a, fetch_or, v1 | v2); \ + DO_FETCH_TEST(T, a, fetch_sub, v1 - v2); \ + DO_FETCH_TEST(T, a, fetch_xor, v1 ^ v2); \ + \ + DO_COMPARE_EXCHANGE_TEST(T, a, weak); \ + DO_COMPARE_EXCHANGE_TEST(T, a, strong); \ +} while (0) + +#define TEST_TYPE(T) do { \ + int j; \ + struct { _Atomic(T) v[16]; } list, cmp; \ + arc4random_buf(&cmp, sizeof(cmp)); \ + for (j = 0; j < 16; j++) { \ + list = cmp; \ + DO_ALL_TESTS(T, &list.v[j]); \ + list.v[j] = cmp.v[j]; \ + assert(memcmp(&list, &cmp, sizeof(list)) == 0); \ + } \ +} while (0) + +int +main(void) +{ + int i; + + for (i = 0; i < 1000; i++) { + TEST_TYPE(int8_t); + TEST_TYPE(uint8_t); + TEST_TYPE(int16_t); + TEST_TYPE(uint16_t); + TEST_TYPE(int32_t); + TEST_TYPE(uint32_t); + TEST_TYPE(int64_t); + TEST_TYPE(uint64_t); + } + + return (0); +} From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 23:45:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DAF87DC8; Sat, 8 Jun 2013 23:45:11 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CC0701D5B; Sat, 8 Jun 2013 23:45:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58NjB3v061716; Sat, 8 Jun 2013 23:45:11 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58NjBwZ061715; Sat, 8 Jun 2013 23:45:11 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201306082345.r58NjBwZ061715@svn.freebsd.org> From: Ed Schouten Date: Sat, 8 Jun 2013 23:45:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251559 - head/sys/mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 23:45:11 -0000 Author: ed Date: Sat Jun 8 23:45:11 2013 New Revision: 251559 URL: http://svnweb.freebsd.org/changeset/base/251559 Log: Merge the 1 and 2 byte versions of the atomic functions into one. After pushing in my fix for the 2 byte functions, I realized that the functions for 1 and 2 byte operations had become identical. Reduce the code size by merging the functions for 1 and 2 byte operations together. While there, slightly improve variable naming and comments. Modified: head/sys/mips/mips/stdatomic.c Modified: head/sys/mips/mips/stdatomic.c ============================================================================== --- head/sys/mips/mips/stdatomic.c Sat Jun 8 22:44:49 2013 (r251558) +++ head/sys/mips/mips/stdatomic.c Sat Jun 8 23:45:11 2013 (r251559) @@ -75,6 +75,11 @@ typedef union { uint32_t v32; } reg_t; +/* + * Given a memory address pointing to an 8-bit or 16-bit integer, return + * the address of the 32-bit word containing it. + */ + static inline uint32_t * round_to_word(void *ptr) { @@ -83,7 +88,9 @@ round_to_word(void *ptr) } /* - * 8-bit routines. + * Utility functions for loading and storing 8-bit and 16-bit integers + * in 32-bit words at an offset corresponding with the location of the + * atomic variable. */ static inline void @@ -104,132 +111,6 @@ get_1(const reg_t *r, uint8_t *offset_pt return (r->v8[offset]); } -uint8_t -__sync_lock_test_and_set_1(uint8_t *mem8, uint8_t val8) -{ - uint32_t *mem32; - reg_t val32, negmask32, old; - uint32_t temp; - - mem32 = round_to_word(mem8); - val32.v32 = 0x00000000; - put_1(&val32, mem8, val8); - negmask32.v32 = 0xffffffff; - put_1(&negmask32, mem8, val8); - - mips_sync(); - __asm volatile ( - "1:" - "\tll %0, %5\n" /* Load old value. */ - "\tand %2, %4, %0\n" /* Trim out affected part. */ - "\tor %2, %3\n" /* Put in the new value. */ - "\tsc %2, %1\n" /* Attempt to store. */ - "\tbeqz %2, 1b\n" /* Spin if failed. */ - : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) - : "r" (val32.v32), "r" (negmask32.v32), "m" (*mem32)); - return (get_1(&old, mem8)); -} - -uint8_t -__sync_val_compare_and_swap_1(uint8_t *mem8, uint8_t expected, uint8_t desired) -{ - uint32_t *mem32; - reg_t expected32, desired32, posmask32, negmask32, old; - uint32_t temp; - - mem32 = round_to_word(mem8); - expected32.v32 = 0x00000000; - put_1(&expected32, mem8, expected); - desired32.v32 = 0x00000000; - put_1(&desired32, mem8, desired); - posmask32.v32 = 0x00000000; - put_1(&posmask32, mem8, 0xff); - negmask32.v32 = ~posmask32.v32; - - mips_sync(); - __asm volatile ( - "1:" - "\tll %0, %7\n" /* Load old value. */ - "\tand %2, %5, %0\n" /* Isolate affected part. */ - "\tbne %2, %3, 2f\n" /* Compare to expected value. */ - "\tand %2, %6, %0\n" /* Trim out affected part. */ - "\tor %2, %4\n" /* Put in the new value. */ - "\tsc %2, %1\n" /* Attempt to store. */ - "\tbeqz %2, 1b\n" /* Spin if failed. */ - "2:" - : "=&r" (old), "=m" (*mem32), "=&r" (temp) - : "r" (expected32.v32), "r" (desired32.v32), - "r" (posmask32.v32), "r" (negmask32.v32), "m" (*mem32)); - return (get_1(&old, mem8)); -} - -#define EMIT_ARITHMETIC_FETCH_AND_OP_1(name, op) \ -uint8_t \ -__sync_##name##_1(uint8_t *mem8, uint8_t val8) \ -{ \ - uint32_t *mem32; \ - reg_t val32, posmask32, negmask32, old; \ - uint32_t temp1, temp2; \ - \ - mem32 = round_to_word(mem8); \ - val32.v32 = 0x00000000; \ - put_1(&val32, mem8, val8); \ - posmask32.v32 = 0x00000000; \ - put_1(&posmask32, mem8, 0xff); \ - negmask32.v32 = ~posmask32.v32; \ - \ - mips_sync(); \ - __asm volatile ( \ - "1:" \ - "\tll %0, %7\n" /* Load old value. */ \ - "\t"op" %2, %0, %4\n" /* Calculate new value. */ \ - "\tand %2, %5\n" /* Isolate affected part. */ \ - "\tand %3, %6, %0\n" /* Trim out affected part. */ \ - "\tor %2, %3\n" /* Put in the new value. */ \ - "\tsc %2, %1\n" /* Attempt to store. */ \ - "\tbeqz %2, 1b\n" /* Spin if failed. */ \ - : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp1), \ - "=&r" (temp2) \ - : "r" (val32.v32), "r" (posmask32.v32), \ - "r" (negmask32.v32), "m" (*mem32)); \ - return (get_1(&old, mem8)); \ -} - -EMIT_ARITHMETIC_FETCH_AND_OP_1(fetch_and_add, "addu") -EMIT_ARITHMETIC_FETCH_AND_OP_1(fetch_and_sub, "subu") - -#define EMIT_BITWISE_FETCH_AND_OP_1(name, op, idempotence) \ -uint8_t \ -__sync_##name##_1(uint8_t *mem8, uint8_t val8) \ -{ \ - uint32_t *mem32; \ - reg_t val32, old; \ - uint32_t temp; \ - \ - mem32 = round_to_word(mem8); \ - val32.v32 = idempotence ? 0xffffffff : 0x00000000; \ - put_1(&val32, mem8, val8); \ - \ - mips_sync(); \ - __asm volatile ( \ - "1:" \ - "\tll %0, %4\n" /* Load old value. */ \ - "\t"op" %2, %3, %0\n" /* Calculate new value. */ \ - "\tsc %2, %1\n" /* Attempt to store. */ \ - "\tbeqz %2, 1b\n" /* Spin if failed. */ \ - : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) \ - : "r" (val32.v32), "m" (*mem32)); \ - return (get_1(&old, mem8)); \ -} - -EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_and, "and", 1) -EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_or, "or", 0) -EMIT_BITWISE_FETCH_AND_OP_1(fetch_and_xor, "xor", 0) - -/* - * 16-bit routines. - */ - static inline void put_2(reg_t *r, uint16_t *offset_ptr, uint16_t val) { @@ -260,112 +141,129 @@ get_2(const reg_t *r, uint16_t *offset_p return (bytes.out); } -uint16_t -__sync_lock_test_and_set_2(uint16_t *mem16, uint16_t val16) -{ - uint32_t *mem32; - reg_t val32, negmask32, old; - uint32_t temp; - - mem32 = round_to_word(mem16); - val32.v32 = 0x00000000; - put_2(&val32, mem16, val16); - negmask32.v32 = 0xffffffff; - put_2(&negmask32, mem16, 0x0000); +/* + * 8-bit and 16-bit routines. + * + * These operations are not natively supported by the CPU, so we use + * some shifting and bitmasking on top of the 32-bit instructions. + */ - mips_sync(); - __asm volatile ( - "1:" - "\tll %0, %5\n" /* Load old value. */ - "\tand %2, %4, %0\n" /* Trim out affected part. */ - "\tor %2, %3\n" /* Combine to new value. */ - "\tsc %2, %1\n" /* Attempt to store. */ - "\tbeqz %2, 1b\n" /* Spin if failed. */ - : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) - : "r" (val32.v32), "r" (negmask32.v32), "m" (*mem32)); - return (get_2(&old, mem16)); +#define EMIT_LOCK_TEST_AND_SET_N(N, uintN_t) \ +uintN_t \ +__sync_lock_test_and_set_##N(uintN_t *mem, uintN_t val) \ +{ \ + uint32_t *mem32; \ + reg_t val32, negmask, old; \ + uint32_t temp; \ + \ + mem32 = round_to_word(mem); \ + val32.v32 = 0x00000000; \ + put_##N(&val32, mem, val); \ + negmask.v32 = 0xffffffff; \ + put_##N(&negmask, mem, 0); \ + \ + mips_sync(); \ + __asm volatile ( \ + "1:" \ + "\tll %0, %5\n" /* Load old value. */ \ + "\tand %2, %4, %0\n" /* Remove the old value. */ \ + "\tor %2, %3\n" /* Put in the new value. */ \ + "\tsc %2, %1\n" /* Attempt to store. */ \ + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ + : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) \ + : "r" (val32.v32), "r" (negmask.v32), "m" (*mem32)); \ + return (get_##N(&old, mem)); \ } -uint16_t -__sync_val_compare_and_swap_2(uint16_t *mem16, uint16_t expected, - uint16_t desired) -{ - uint32_t *mem32; - reg_t expected32, desired32, posmask32, negmask32, old; - uint32_t temp; - - mem32 = round_to_word(mem16); - expected32.v32 = 0x00000000; - put_2(&expected32, mem16, expected); - desired32.v32 = 0x00000000; - put_2(&desired32, mem16, desired); - posmask32.v32 = 0x00000000; - put_2(&posmask32, mem16, 0xffff); - negmask32.v32 = ~posmask32.v32; +EMIT_LOCK_TEST_AND_SET_N(1, uint8_t) +EMIT_LOCK_TEST_AND_SET_N(2, uint16_t) - mips_sync(); - __asm volatile ( - "1:" - "\tll %0, %7\n" /* Load old value. */ - "\tand %2, %5, %0\n" /* Isolate affected part. */ - "\tbne %2, %3, 2f\n" /* Compare to expected value. */ - "\tand %2, %6, %0\n" /* Trim out affected part. */ - "\tor %2, %4\n" /* Put in the new value. */ - "\tsc %2, %1\n" /* Attempt to store. */ - "\tbeqz %2, 1b\n" /* Spin if failed. */ - "2:" - : "=&r" (old), "=m" (*mem32), "=&r" (temp) - : "r" (expected32.v32), "r" (desired32.v32), - "r" (posmask32.v32), "r" (negmask32.v32), "m" (*mem32)); - return (get_2(&old, mem16)); +#define EMIT_VAL_COMPARE_AND_SWAP_N(N, uintN_t) \ +uintN_t \ +__sync_val_compare_and_swap_##N(uintN_t *mem, uintN_t expected, \ + uintN_t desired) \ +{ \ + uint32_t *mem32; \ + reg_t expected32, desired32, posmask, negmask, old; \ + uint32_t temp; \ + \ + mem32 = round_to_word(mem); \ + expected32.v32 = 0x00000000; \ + put_##N(&expected32, mem, expected); \ + desired32.v32 = 0x00000000; \ + put_##N(&desired32, mem, desired); \ + posmask.v32 = 0x00000000; \ + put_##N(&posmask, mem, ~0); \ + negmask.v32 = ~posmask.v32; \ + \ + mips_sync(); \ + __asm volatile ( \ + "1:" \ + "\tll %0, %7\n" /* Load old value. */ \ + "\tand %2, %5, %0\n" /* Isolate the old value. */ \ + "\tbne %2, %3, 2f\n" /* Compare to expected value. */\ + "\tand %2, %6, %0\n" /* Remove the old value. */ \ + "\tor %2, %4\n" /* Put in the new value. */ \ + "\tsc %2, %1\n" /* Attempt to store. */ \ + "\tbeqz %2, 1b\n" /* Spin if failed. */ \ + "2:" \ + : "=&r" (old), "=m" (*mem32), "=&r" (temp) \ + : "r" (expected32.v32), "r" (desired32.v32), \ + "r" (posmask.v32), "r" (negmask.v32), "m" (*mem32)); \ + return (get_##N(&old, mem)); \ } -#define EMIT_ARITHMETIC_FETCH_AND_OP_2(name, op) \ -uint16_t \ -__sync_##name##_2(uint16_t *mem16, uint16_t val16) \ +EMIT_VAL_COMPARE_AND_SWAP_N(1, uint8_t) +EMIT_VAL_COMPARE_AND_SWAP_N(2, uint16_t) + +#define EMIT_ARITHMETIC_FETCH_AND_OP_N(N, uintN_t, name, op) \ +uintN_t \ +__sync_##name##_##N(uintN_t *mem, uintN_t val) \ { \ uint32_t *mem32; \ - reg_t val32, posmask32, negmask32, old; \ + reg_t val32, posmask, negmask, old; \ uint32_t temp1, temp2; \ \ - mem32 = round_to_word(mem16); \ + mem32 = round_to_word(mem); \ val32.v32 = 0x00000000; \ - put_2(&val32, mem16, val16); \ - posmask32.v32 = 0x00000000; \ - put_2(&posmask32, mem16, 0xffff); \ - negmask32.v32 = ~posmask32.v32; \ + put_##N(&val32, mem, val); \ + posmask.v32 = 0x00000000; \ + put_##N(&posmask, mem, ~0); \ + negmask.v32 = ~posmask.v32; \ \ mips_sync(); \ __asm volatile ( \ "1:" \ "\tll %0, %7\n" /* Load old value. */ \ "\t"op" %2, %0, %4\n" /* Calculate new value. */ \ - "\tand %2, %5\n" /* Isolate affected part. */ \ - "\tand %3, %6, %0\n" /* Trim out affected part. */ \ - "\tor %2, %3\n" /* Combine to new value. */ \ + "\tand %2, %5\n" /* Isolate the new value. */ \ + "\tand %3, %6, %0\n" /* Remove the old value. */ \ + "\tor %2, %3\n" /* Put in the new value. */ \ "\tsc %2, %1\n" /* Attempt to store. */ \ "\tbeqz %2, 1b\n" /* Spin if failed. */ \ : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp1), \ "=&r" (temp2) \ - : "r" (val32.v32), "r" (posmask32.v32), \ - "r" (negmask32.v32), "m" (*mem32)); \ - return (get_2(&old, mem16)); \ + : "r" (val32.v32), "r" (posmask.v32), \ + "r" (negmask.v32), "m" (*mem32)); \ + return (get_##N(&old, mem)); \ } -EMIT_ARITHMETIC_FETCH_AND_OP_2(fetch_and_add, "addu") -EMIT_ARITHMETIC_FETCH_AND_OP_2(fetch_and_sub, "subu") - -#define EMIT_BITWISE_FETCH_AND_OP_2(name, op, idempotence) \ -uint16_t \ -__sync_##name##_2(uint16_t *mem16, uint16_t val16) \ +EMIT_ARITHMETIC_FETCH_AND_OP_N(1, uint8_t, fetch_and_add, "addu") +EMIT_ARITHMETIC_FETCH_AND_OP_N(1, uint8_t, fetch_and_sub, "subu") +EMIT_ARITHMETIC_FETCH_AND_OP_N(2, uint16_t, fetch_and_add, "addu") +EMIT_ARITHMETIC_FETCH_AND_OP_N(2, uint16_t, fetch_and_sub, "subu") + +#define EMIT_BITWISE_FETCH_AND_OP_N(N, uintN_t, name, op, idempotence) \ +uintN_t \ +__sync_##name##_##N(uintN_t *mem, uintN_t val) \ { \ uint32_t *mem32; \ reg_t val32, old; \ uint32_t temp; \ \ - mem32 = round_to_word(mem16); \ + mem32 = round_to_word(mem); \ val32.v32 = idempotence ? 0xffffffff : 0x00000000; \ - put_2(&val32, mem16, val16); \ + put_##N(&val32, mem, val); \ \ mips_sync(); \ __asm volatile ( \ @@ -376,12 +274,15 @@ __sync_##name##_2(uint16_t *mem16, uint1 "\tbeqz %2, 1b\n" /* Spin if failed. */ \ : "=&r" (old.v32), "=m" (*mem32), "=&r" (temp) \ : "r" (val32.v32), "m" (*mem32)); \ - return (get_2(&old, mem16)); \ + return (get_##N(&old, mem)); \ } -EMIT_BITWISE_FETCH_AND_OP_2(fetch_and_and, "and", 1) -EMIT_BITWISE_FETCH_AND_OP_2(fetch_and_or, "or", 0) -EMIT_BITWISE_FETCH_AND_OP_2(fetch_and_xor, "xor", 0) +EMIT_BITWISE_FETCH_AND_OP_N(1, uint8_t, fetch_and_and, "and", 1) +EMIT_BITWISE_FETCH_AND_OP_N(1, uint8_t, fetch_and_or, "or", 0) +EMIT_BITWISE_FETCH_AND_OP_N(1, uint8_t, fetch_and_xor, "xor", 0) +EMIT_BITWISE_FETCH_AND_OP_N(2, uint16_t, fetch_and_and, "and", 1) +EMIT_BITWISE_FETCH_AND_OP_N(2, uint16_t, fetch_and_or, "or", 0) +EMIT_BITWISE_FETCH_AND_OP_N(2, uint16_t, fetch_and_xor, "xor", 0) /* * 32-bit routines. From owner-svn-src-all@FreeBSD.ORG Sat Jun 8 23:48:14 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4321CFBD; Sat, 8 Jun 2013 23:48:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 35CAF1DA4; Sat, 8 Jun 2013 23:48:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58NmEZG062172; Sat, 8 Jun 2013 23:48:14 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58NmEtZ062171; Sat, 8 Jun 2013 23:48:14 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201306082348.r58NmEtZ062171@svn.freebsd.org> From: Baptiste Daroussin Date: Sat, 8 Jun 2013 23:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251560 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 23:48:14 -0000 Author: bapt Date: Sat Jun 8 23:48:13 2013 New Revision: 251560 URL: http://svnweb.freebsd.org/changeset/base/251560 Log: Fix a bad calloc(3) call MFC after: 2 weeks Modified: head/usr.sbin/pkg/dns_utils.c Modified: head/usr.sbin/pkg/dns_utils.c ============================================================================== --- head/usr.sbin/pkg/dns_utils.c Sat Jun 8 23:45:11 2013 (r251559) +++ head/usr.sbin/pkg/dns_utils.c Sat Jun 8 23:48:13 2013 (r251560) @@ -66,7 +66,7 @@ dns_getsrvinfo(const char *zone) p += len + NS_QFIXEDSZ; } - res = calloc(ancount, sizeof(struct dns_srvinfo)); + res = calloc(ancount, sizeof(struct dns_srvinfo *)); if (res == NULL) return (NULL);