svn commit: r272780 - in head: etc/mtree usr.bin/cmp usr.bin/cmp/tests

2014-10-08 Thread Garrett Cooper
Author: ngie
Date: Thu Oct  9 00:50:33 2014
New Revision: 272780
URL: https://svnweb.freebsd.org/changeset/base/272780

Log:
  Integrate usr.bin/cmp/tests from NetBSD into atf/kyua
  
  In collaboration with: sjg
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/usr.bin/cmp/tests/
  head/usr.bin/cmp/tests/Makefile   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.bin/cmp/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Oct  9 00:41:42 2014
(r272779)
+++ head/etc/mtree/BSD.tests.dist   Thu Oct  9 00:50:33 2014
(r272780)
@@ -245,6 +245,8 @@
 ..
 calendar
 ..
+cmp
+..
 comm
 ..
 file2c

Modified: head/usr.bin/cmp/Makefile
==
--- head/usr.bin/cmp/Makefile   Thu Oct  9 00:41:42 2014(r272779)
+++ head/usr.bin/cmp/Makefile   Thu Oct  9 00:50:33 2014(r272780)
@@ -1,7 +1,13 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+.include 
+
 PROG=  cmp
 SRCS=  cmp.c link.c misc.c regular.c special.c
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Added: head/usr.bin/cmp/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/cmp/tests/Makefile Thu Oct  9 00:50:33 2014
(r272780)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+TESTSRC=   ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/cmp
+.PATH: ${TESTSRC}
+
+.include 
+
+TESTSDIR=  ${TESTSBASE}/usr.bin/cmp
+ATF_TESTS_SH=  cmp_test
+ATF_TESTS_SH_SRC_cmp_test= t_cmp.sh
+
+.include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272781 - in head: etc/mtree usr.bin/dirname usr.bin/dirname/tests

2014-10-08 Thread Garrett Cooper
Author: ngie
Date: Thu Oct  9 00:55:04 2014
New Revision: 272781
URL: https://svnweb.freebsd.org/changeset/base/272781

Log:
  Integrate usr.bin/dirname/tests from NetBSD into atf/kyua
  
  In collaboration with: pho, sjg
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/usr.bin/dirname/tests/
  head/usr.bin/dirname/tests/Makefile   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.bin/dirname/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Oct  9 00:50:33 2014
(r272780)
+++ head/etc/mtree/BSD.tests.dist   Thu Oct  9 00:55:04 2014
(r272781)
@@ -249,6 +249,8 @@
 ..
 comm
 ..
+dirname
+..
 file2c
 ..
 join

Modified: head/usr.bin/dirname/Makefile
==
--- head/usr.bin/dirname/Makefile   Thu Oct  9 00:50:33 2014
(r272780)
+++ head/usr.bin/dirname/Makefile   Thu Oct  9 00:55:04 2014
(r272781)
@@ -1,7 +1,13 @@
 #  From: @(#)Makefile  8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+.include 
+
 PROG=  dirname
 MAN=
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Added: head/usr.bin/dirname/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/dirname/tests/Makefile Thu Oct  9 00:55:04 2014
(r272781)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+TESTSRC=   ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/dirname
+.PATH: ${TESTSRC}
+
+.include 
+
+TESTSDIR=  ${TESTSBASE}/usr.bin/dirname
+ATF_TESTS_SH=  dirname_test
+ATF_TESTS_SH_SRC_dirname_test= t_dirname.sh
+
+.include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272782 - in head: bin/sleep bin/sleep/tests etc/mtree

2014-10-08 Thread Garrett Cooper
Author: ngie
Date: Thu Oct  9 01:39:07 2014
New Revision: 272782
URL: https://svnweb.freebsd.org/changeset/base/272782

Log:
  Integrate bin/sleep/tests from NetBSD into atf/kyua
  
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/bin/sleep/tests/
  head/bin/sleep/tests/Makefile   (contents, props changed)
Modified:
  head/bin/sleep/Makefile
  head/etc/mtree/BSD.tests.dist

Modified: head/bin/sleep/Makefile
==
--- head/bin/sleep/Makefile Thu Oct  9 00:55:04 2014(r272781)
+++ head/bin/sleep/Makefile Thu Oct  9 01:39:07 2014(r272782)
@@ -1,6 +1,12 @@
 #  @(#)Makefile8.1 (Berkeley) 5/31/93
 # $FreeBSD$
 
+.include 
+
 PROG=  sleep
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Added: head/bin/sleep/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sleep/tests/Makefile   Thu Oct  9 01:39:07 2014
(r272782)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+TESTSRC=   ${.CURDIR}/../../../contrib/netbsd-tests/bin/sleep
+.PATH: ${TESTSRC}
+
+.include 
+
+TESTSDIR=  ${TESTSBASE}/bin/sleep
+ATF_TESTS_SH=  sleep_test
+ATF_TESTS_SH_SRC_sleep_test=   t_sleep.sh
+
+.include 

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Oct  9 00:55:04 2014
(r272781)
+++ head/etc/mtree/BSD.tests.dist   Thu Oct  9 01:39:07 2014
(r272782)
@@ -47,6 +47,8 @@
 set-e
 ..
 ..
+sleep
+..
 test
 ..
 ..
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272783 - in head: etc/mtree usr.bin/cut usr.bin/cut/tests

2014-10-08 Thread Garrett Cooper
Author: ngie
Date: Thu Oct  9 01:46:31 2014
New Revision: 272783
URL: https://svnweb.freebsd.org/changeset/base/272783

Log:
  Integrate usr.bin/cut/tests from NetBSD into atf/kyua
  
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/usr.bin/cut/tests/
  head/usr.bin/cut/tests/Makefile   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.bin/cut/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Oct  9 01:39:07 2014
(r272782)
+++ head/etc/mtree/BSD.tests.dist   Thu Oct  9 01:46:31 2014
(r272783)
@@ -251,6 +251,8 @@
 ..
 comm
 ..
+cut
+..
 dirname
 ..
 file2c

Modified: head/usr.bin/cut/Makefile
==
--- head/usr.bin/cut/Makefile   Thu Oct  9 01:39:07 2014(r272782)
+++ head/usr.bin/cut/Makefile   Thu Oct  9 01:46:31 2014(r272783)
@@ -1,6 +1,12 @@
 #  From: @(#)Makefile  8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+.include 
+
 PROG=  cut
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Added: head/usr.bin/cut/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/cut/tests/Makefile Thu Oct  9 01:46:31 2014
(r272783)
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+TESTSRC=   ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/cut
+.PATH: ${TESTSRC}
+
+.include 
+
+TESTSDIR=  ${TESTSBASE}/usr.bin/cut
+ATF_TESTS_SH=  cut_test
+ATF_TESTS_SH_SRC_cut_test= t_cut.sh
+
+FILESDIR=  ${TESTSDIR}
+FILES= d_basic.out
+FILES+=d_cut.in
+FILES+=d_dflag.out
+FILES+=d_dsflag.out
+FILES+=d_latin1.in
+FILES+=d_sflag.out
+FILES+=d_utf8.in
+
+.include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272784 - in head: etc/mtree usr.bin/grep usr.bin/grep/tests

2014-10-08 Thread Garrett Cooper
Author: ngie
Date: Thu Oct  9 01:53:23 2014
New Revision: 272784
URL: https://svnweb.freebsd.org/changeset/base/272784

Log:
  Integrate usr.bin/grep/tests from NetBSD into atf/kyua
  
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/usr.bin/grep/tests/
  head/usr.bin/grep/tests/Makefile   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.bin/grep/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Oct  9 01:46:31 2014
(r272783)
+++ head/etc/mtree/BSD.tests.dist   Thu Oct  9 01:53:23 2014
(r272784)
@@ -257,6 +257,8 @@
 ..
 file2c
 ..
+grep
+..
 join
 ..
 jot

Modified: head/usr.bin/grep/Makefile
==
--- head/usr.bin/grep/Makefile  Thu Oct  9 01:46:31 2014(r272783)
+++ head/usr.bin/grep/Makefile  Thu Oct  9 01:53:23 2014(r272784)
@@ -85,4 +85,8 @@ DPADD+=   ${LIBGNUREGEX}
 CFLAGS+= -DWITHOUT_NLS
 .endif
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Added: head/usr.bin/grep/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/grep/tests/MakefileThu Oct  9 01:53:23 2014
(r272784)
@@ -0,0 +1,41 @@
+# $FreeBSD$
+
+TESTSRC=   ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/grep
+.PATH: ${TESTSRC}
+
+.include 
+
+TESTSDIR=  ${TESTSBASE}/usr.bin/grep
+
+ATF_TESTS_SH=  grep_test
+ATF_TESTS_SH_SRC_grep_test=t_grep.sh
+
+FILESDIR=  ${TESTSDIR}
+FILES= d_basic.out
+FILES+=d_begin_end_a.out
+FILES+=d_begin_end_b.out
+FILES+=d_binary.out
+FILES+=d_context2_a.out
+FILES+=d_context2_b.out
+FILES+=d_context2_c.out
+FILES+=d_context_a.in
+FILES+=d_context_a.out
+FILES+=d_context_b.in
+FILES+=d_context_b.out
+FILES+=d_context_c.out
+FILES+=d_context_d.out
+FILES+=d_egrep.out
+FILES+=d_file_exp.in
+FILES+=d_file_exp.out
+FILES+=d_ignore_case.out
+FILES+=d_input
+FILES+=d_invert.in
+FILES+=d_invert.out
+FILES+=d_recurse.out
+FILES+=d_recurse_symlink.err
+FILES+=d_recurse_symlink.out
+FILES+=d_whole_line.out
+FILES+=d_word_regexps.out
+FILES+=d_zgrep.out
+
+.include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272785 - head/sys/boot/i386/gptboot

2014-10-08 Thread Marcel Moolenaar
Author: marcel
Date: Thu Oct  9 01:54:32 2014
New Revision: 272785
URL: https://svnweb.freebsd.org/changeset/base/272785

Log:
  Properly NUL-terminate the on-stack buffer for reading /boot.config
  or /boot/config. In qemu, on a warm boot, the stack is not all zeroes
  and we parse beyond the file's contents.
  
  Obtained from:Juniper Networks, Inc.

Modified:
  head/sys/boot/i386/gptboot/gptboot.c

Modified: head/sys/boot/i386/gptboot/gptboot.c
==
--- head/sys/boot/i386/gptboot/gptboot.cThu Oct  9 01:53:23 2014
(r272784)
+++ head/sys/boot/i386/gptboot/gptboot.cThu Oct  9 01:54:32 2014
(r272785)
@@ -136,6 +136,7 @@ int
 main(void)
 {
char cmd[512], cmdtmp[512];
+   ssize_t sz;
int autoboot, dskupdated;
ufs_ino_t ino;
 
@@ -164,9 +165,10 @@ main(void)
for (;;) {
*kname = '\0';
if ((ino = lookup(PATH_CONFIG)) ||
-   (ino = lookup(PATH_DOTCONFIG)))
-   fsread(ino, cmd, sizeof(cmd));
-
+   (ino = lookup(PATH_DOTCONFIG))) {
+   sz = fsread(ino, cmd, sizeof(cmd) - 1);
+   cmd[(sz < 0) ? 0 : sz] = '\0';
+   }
if (*cmd != '\0') {
memcpy(cmdtmp, cmd, sizeof(cmdtmp));
if (parse(cmdtmp, &dskupdated))
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272786 - head/sys/kern

2014-10-08 Thread Marcel Moolenaar
Author: marcel
Date: Thu Oct  9 01:59:25 2014
New Revision: 272786
URL: https://svnweb.freebsd.org/changeset/base/272786

Log:
  Apply r269126 to tty_timedwait():
  Don't return ERESTART when the device is gone.

Modified:
  head/sys/kern/tty.c

Modified: head/sys/kern/tty.c
==
--- head/sys/kern/tty.c Thu Oct  9 01:54:32 2014(r272785)
+++ head/sys/kern/tty.c Thu Oct  9 01:59:25 2014(r272786)
@@ -1392,14 +1392,14 @@ tty_timedwait(struct tty *tp, struct cv 
 
error = cv_timedwait_sig(cv, tp->t_mtx, hz);
 
-   /* Restart the system call when we may have been revoked. */
-   if (tp->t_revokecnt != revokecnt)
-   return (ERESTART);
-
/* Bail out when the device slipped away. */
if (tty_gone(tp))
return (ENXIO);
 
+   /* Restart the system call when we may have been revoked. */
+   if (tp->t_revokecnt != revokecnt)
+   return (ERESTART);
+
return (error);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272787 - in head: etc/mtree gnu/usr.bin/diff gnu/usr.bin/diff/tests

2014-10-08 Thread Garrett Cooper
Author: ngie
Date: Thu Oct  9 02:07:34 2014
New Revision: 272787
URL: https://svnweb.freebsd.org/changeset/base/272787

Log:
  Integrate usr.bin/diff/tests from NetBSD into atf/kyua at 
gnu/usr.bin/diff/tests
  
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/gnu/usr.bin/diff/tests/
  head/gnu/usr.bin/diff/tests/Makefile   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/gnu/usr.bin/diff/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Oct  9 01:59:25 2014
(r272786)
+++ head/etc/mtree/BSD.tests.dist   Thu Oct  9 02:07:34 2014
(r272787)
@@ -70,6 +70,8 @@
 lib
 ..
 usr.bin
+diff
+..
 ..
 ..
 lib

Modified: head/gnu/usr.bin/diff/Makefile
==
--- head/gnu/usr.bin/diff/Makefile  Thu Oct  9 01:59:25 2014
(r272786)
+++ head/gnu/usr.bin/diff/Makefile  Thu Oct  9 02:07:34 2014
(r272787)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include 
+
 DIFFSRC=${.CURDIR}/../../../contrib/diff/src
 .PATH: ${DIFFSRC} \
${.CURDIR}/../../../contrib/diff/lib \
@@ -27,4 +29,8 @@ SUBDIR+=doc
 DPADD= ${LIBGNUREGEX}
 LDADD= -lgnuregex
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Added: head/gnu/usr.bin/diff/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/gnu/usr.bin/diff/tests/MakefileThu Oct  9 02:07:34 2014
(r272787)
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+TESTSRC=   ${.CURDIR}/../../../../contrib/netbsd-tests/usr.bin/diff
+.PATH: ${TESTSRC}
+
+.include 
+
+TESTSDIR=  ${TESTSBASE}/gnu/usr.bin/diff
+ATF_TESTS_SH=  diff_test
+ATF_TESTS_SH_SED_diff_test=-e 's/t_diff/`basename $$0`/g'
+ATF_TESTS_SH_SRC_diff_test=t_diff.sh
+
+FILESDIR=  ${TESTSDIR}
+FILES+=d_mallocv1.in
+FILES+=d_mallocv2.in
+
+.include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272788 - in head: etc/mtree usr.bin/gzip usr.bin/gzip/tests

2014-10-08 Thread Garrett Cooper
Author: ngie
Date: Thu Oct  9 02:24:34 2014
New Revision: 272788
URL: https://svnweb.freebsd.org/changeset/base/272788

Log:
  Integrate usr.bin/gzip/tests from NetBSD into atf/kyua
  
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/usr.bin/gzip/tests/
  head/usr.bin/gzip/tests/Makefile   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.bin/gzip/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Oct  9 02:07:34 2014
(r272787)
+++ head/etc/mtree/BSD.tests.dist   Thu Oct  9 02:24:34 2014
(r272788)
@@ -261,6 +261,8 @@
 ..
 grep
 ..
+gzip
+..
 join
 ..
 jot

Modified: head/usr.bin/gzip/Makefile
==
--- head/usr.bin/gzip/Makefile  Thu Oct  9 02:07:34 2014(r272787)
+++ head/usr.bin/gzip/Makefile  Thu Oct  9 02:24:34 2014(r272788)
@@ -28,4 +28,8 @@ LINKS+=   ${BINDIR}/gzip ${BINDIR}/gunzip
${BINDIR}/gzip ${BINDIR}/zcat \
${BINDIR}/zdiff ${BINDIR}/zcmp
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Added: head/usr.bin/gzip/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/gzip/tests/MakefileThu Oct  9 02:24:34 2014
(r272788)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+TESTSRC=   ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/gzip
+.PATH: ${TESTSRC}
+
+.include 
+
+TESTSDIR=  ${TESTSBASE}/usr.bin/gzip
+ATF_TESTS_SH=  gzip_test
+ATF_TESTS_SH_SRC_gzip_test=t_gzip.sh
+
+.include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272789 - head/sys/kern

2014-10-08 Thread Marcel Moolenaar
Author: marcel
Date: Thu Oct  9 02:30:38 2014
New Revision: 272789
URL: https://svnweb.freebsd.org/changeset/base/272789

Log:
  Fix draining in ttydev_leave():
  1.  ERESTART is not only returned when the revoke count changed. It
  is also returned when a signal is received. While a change in
  the revoke count should be ignored, a signal should not.
  2.  Waiting until the output queue is entirely drained can cause a
  hang when the underlying device is stuck or broken.
  
  Have tty_drain() take care of this by telling it when we're leaving.
  When leaving, tty_drain() will use a timed wait to address point 2
  above and it will check the revoke count to handle point 1 above.
  The timeout is set to 1 second, which is arbitrary and long enough
  to expect a change in the output queue.
  
  Discussed with: jilles@
  Reported by: Yamagi Burmeister 

Modified:
  head/sys/kern/tty.c

Modified: head/sys/kern/tty.c
==
--- head/sys/kern/tty.c Thu Oct  9 02:24:34 2014(r272788)
+++ head/sys/kern/tty.c Thu Oct  9 02:30:38 2014(r272789)
@@ -123,9 +123,10 @@ tty_watermarks(struct tty *tp)
 }
 
 static int
-tty_drain(struct tty *tp)
+tty_drain(struct tty *tp, int leaving)
 {
-   int error;
+   size_t bytesused;
+   int error, revokecnt;
 
if (ttyhook_hashook(tp, getc_inject))
/* buffer is inaccessible */
@@ -134,11 +135,27 @@ tty_drain(struct tty *tp)
while (ttyoutq_bytesused(&tp->t_outq) > 0) {
ttydevsw_outwakeup(tp);
/* Could be handled synchronously. */
-   if (ttyoutq_bytesused(&tp->t_outq) == 0)
+   bytesused = ttyoutq_bytesused(&tp->t_outq);
+   if (bytesused == 0)
return (0);
 
/* Wait for data to be drained. */
-   error = tty_wait(tp, &tp->t_outwait);
+   if (leaving) {
+   revokecnt = tp->t_revokecnt;
+   error = tty_timedwait(tp, &tp->t_outwait, hz);
+   switch (error) {
+   case ERESTART:
+   if (revokecnt != tp->t_revokecnt)
+   error = 0;
+   break;
+   case EWOULDBLOCK:
+   if (ttyoutq_bytesused(&tp->t_outq) < bytesused)
+   error = 0;
+   break;
+   }
+   } else
+   error = tty_wait(tp, &tp->t_outwait);
+
if (error)
return (error);
}
@@ -191,10 +208,8 @@ ttydev_leave(struct tty *tp)
 
/* Drain any output. */
MPASS((tp->t_flags & TF_STOPPED) == 0);
-   if (!tty_gone(tp)) {
-   while (tty_drain(tp) == ERESTART)
-   ;
-   }
+   if (!tty_gone(tp))
+   tty_drain(tp, 1);
 
ttydisc_close(tp);
 
@@ -1528,7 +1543,7 @@ tty_generic_ioctl(struct tty *tp, u_long
 
/* Set terminal flags through tcsetattr(). */
if (cmd == TIOCSETAW || cmd == TIOCSETAF) {
-   error = tty_drain(tp);
+   error = tty_drain(tp, 0);
if (error)
return (error);
if (cmd == TIOCSETAF)
@@ -1707,7 +1722,7 @@ tty_generic_ioctl(struct tty *tp, u_long
}
case TIOCDRAIN:
/* Drain TTY output. */
-   return tty_drain(tp);
+   return tty_drain(tp, 0);
case TIOCCONS:
/* Set terminal as console TTY. */
if (*(int *)data) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272796 - head/sys/sys

2014-10-08 Thread Bryan Venteicher
Author: bryanv
Date: Thu Oct  9 04:40:19 2014
New Revision: 272796
URL: https://svnweb.freebsd.org/changeset/base/272796

Log:
  Add M_FLOWID to M_COPYFLAGS
  
  The M_FLOWID flag should be propagated to the new mbuf pkthdr in
  m_move_pkthdr() and m_dup_pkthdr(). The new mbuf already got the
  existing flowid value, but would be ignored since the flag was
  not set.
  
  Phabricator:  https://reviews.freebsd.org/D914
  Reviewed by:  adrian
  Obtained from:NetApp
  MFC after:1 week

Modified:
  head/sys/sys/mbuf.h

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Thu Oct  9 04:10:58 2014(r272795)
+++ head/sys/sys/mbuf.h Thu Oct  9 04:40:19 2014(r272796)
@@ -248,7 +248,7 @@ struct mbuf {
  * Flags preserved when copying m_pkthdr.
  */
 #define M_COPYFLAGS \
-(M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_VLANTAG|M_PROMISC| \
+(M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_FLOWID| \
  M_PROTOFLAGS)
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272797 - head/sys/netinet

2014-10-08 Thread Bryan Venteicher
Author: bryanv
Date: Thu Oct  9 05:17:47 2014
New Revision: 272797
URL: https://svnweb.freebsd.org/changeset/base/272797

Log:
  Check for mbuf copy failure when there are multiple multicast sockets
  
  This partitular case is the only path where the mbuf could be NULL.
  udp_append() checked for a NULL mbuf only after invoking the tunneling
  callback. Our only in tree tunneling callback - SCTP - assumed a non
  NULL mbuf, and it is a bit odd to make the callbacks responsible for
  checking this condition.
  
  This also reduces the differences between the IPv4 and IPv6 code.
  
  MFC after:1 month

Modified:
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Thu Oct  9 04:40:19 2014
(r272796)
+++ head/sys/netinet/udp_usrreq.c   Thu Oct  9 05:17:47 2014
(r272797)
@@ -316,9 +316,6 @@ udp_append(struct inpcb *inp, struct ip 
return;
}
 
-   if (n == NULL)
-   return;
-
off += sizeof(struct udphdr);
 
 #ifdef IPSEC
@@ -578,8 +575,10 @@ udp_input(struct mbuf **mp, int *offp, i
if (last != NULL) {
struct mbuf *n;
 
-   n = m_copy(m, 0, M_COPYALL);
-   udp_append(last, ip, n, iphlen, &udp_in);
+   if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
+   udp_append(last, ip, n, iphlen,
+   &udp_in);
+   }
INP_RUNLOCK(last);
}
last = inp;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272799 - in head/sys: dev/acpica dev/pci kern sys

2014-10-08 Thread Adrian Chadd
Author: adrian
Date: Thu Oct  9 05:33:25 2014
New Revision: 272799
URL: https://svnweb.freebsd.org/changeset/base/272799

Log:
  Add a bus method to fetch the VM domain for the given device/bus.
  
  * Add a bus_if.m method - get_domain() - returning the VM domain or
ENOENT if the device isn't in a VM domain;
  * Add bus methods to print out the domain of the device if appropriate;
  * Add code in srat.c to save the PXM -> VM domain mapping that's done and
expose a function to translate VM domain -> PXM;
  * Add ACPI and ACPI PCI methods to check if the bus has a _PXM attribute
and if so map it to the VM domain;
  * (.. yes, this works recursively.)
  * Have the pci bus glue print out the device VM domain if present.
  
  Note: this is just the plumbing to start enumerating information -
  it doesn't at all modify behaviour.
  
  Differential Revision:D906
  Reviewed by:  jhb
  Sponsored by: Norse Corp

Modified:
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpi_pci.c
  head/sys/dev/acpica/acpivar.h
  head/sys/dev/pci/pci.c
  head/sys/kern/bus_if.m
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Thu Oct  9 05:28:11 2014(r272798)
+++ head/sys/dev/acpica/acpi.c  Thu Oct  9 05:33:25 2014(r272799)
@@ -208,6 +208,7 @@ static device_method_t acpi_methods[] = 
 DEVMETHOD(bus_setup_intr,  bus_generic_setup_intr),
 DEVMETHOD(bus_teardown_intr,   bus_generic_teardown_intr),
 DEVMETHOD(bus_hint_device_unit,acpi_hint_device_unit),
+DEVMETHOD(bus_get_domain,  acpi_get_domain),
 
 /* ACPI bus */
 DEVMETHOD(acpi_id_probe,   acpi_device_id_probe),
@@ -794,6 +795,7 @@ acpi_print_child(device_t bus, device_t 
 retval += resource_list_print_type(rl, "drq",   SYS_RES_DRQ,"%ld");
 if (device_get_flags(child))
retval += printf(" flags %#x", device_get_flags(child));
+retval += bus_print_child_domain(bus, child);
 retval += bus_print_child_footer(bus, child);
 
 return (retval);
@@ -1067,6 +1069,35 @@ acpi_hint_device_unit(device_t acdev, de
 }
 
 /*
+ * Fech the NUMA domain for the given device.
+ *
+ * If a device has a _PXM method, map that to a NUMA domain.
+ *
+ * If none is found, then it'll call the parent method.
+ * If there's no domain, return ENOENT.
+ */
+int
+acpi_get_domain(device_t dev, device_t child, int *domain)
+{
+#if MAXMEMDOM > 1
+   ACPI_HANDLE h;
+   int d, pxm;
+
+   h = acpi_get_handle(child);
+   if ((h != NULL) &&
+   ACPI_SUCCESS(acpi_GetInteger(h, "_PXM", &pxm))) {
+   d = acpi_map_pxm_to_vm_domainid(pxm);
+   if (d < 0)
+   return (ENOENT);
+   *domain = d;
+   return (0);
+   }
+#endif
+   /* No _PXM node; go up a level */
+   return (bus_generic_get_domain(dev, child, domain));
+}
+
+/*
  * Pre-allocate/manage all memory and IO resources.  Since rman can't handle
  * duplicates, we merge any in the sysresource attach routine.
  */

Modified: head/sys/dev/acpica/acpi_pci.c
==
--- head/sys/dev/acpica/acpi_pci.c  Thu Oct  9 05:28:11 2014
(r272798)
+++ head/sys/dev/acpica/acpi_pci.c  Thu Oct  9 05:33:25 2014
(r272799)
@@ -94,6 +94,7 @@ static device_method_t acpi_pci_methods[
DEVMETHOD(bus_write_ivar,   acpi_pci_write_ivar),
DEVMETHOD(bus_child_location_str, acpi_pci_child_location_str_method),
DEVMETHOD(bus_get_dma_tag,  acpi_pci_get_dma_tag),
+   DEVMETHOD(bus_get_domain,   acpi_get_domain),
 
/* PCI interface */
DEVMETHOD(pci_set_powerstate,   acpi_pci_set_powerstate_method),

Modified: head/sys/dev/acpica/acpivar.h
==
--- head/sys/dev/acpica/acpivar.h   Thu Oct  9 05:28:11 2014
(r272798)
+++ head/sys/dev/acpica/acpivar.h   Thu Oct  9 05:33:25 2014
(r272799)
@@ -489,5 +489,16 @@ ACPI_HANDLEacpi_GetReference(ACPI_HANDL
 
 SYSCTL_DECL(_debug_acpi);
 
+/*
+ * Map a PXM to a VM domain.
+ *
+ * Returns the VM domain ID if found, or -1 if not found / invalid.
+ */
+#if MAXMEMDOM > 1
+extern int acpi_map_pxm_to_vm_domainid(int pxm);
+#endif
+
+extern int acpi_get_domain(device_t dev, device_t child, int *domain);
+
 #endif /* _KERNEL */
 #endif /* !_ACPIVAR_H_ */

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Thu Oct  9 05:28:11 2014(r272798)
+++ head/sys/dev/pci/pci.c  Thu Oct  9 05:33:25 2014(r272799)
@@ -3965,6 +3965,7 @@ pci_print_child(device_t dev, device_t c
retval += printf(" at device %d.%d", pci_get_slot(child),
pci_get_func

svn commit: r272800 - head/sys/x86/acpica

2014-10-08 Thread Adrian Chadd
Author: adrian
Date: Thu Oct  9 05:34:28 2014
New Revision: 272800
URL: https://svnweb.freebsd.org/changeset/base/272800

Log:
  Missing from previous commit - keep the VM domain -> PXM mapping
  array and use it to map PXM -> VM domain when needed.
  
  Differential Revision:D906
  Reviewed by:  jhb

Modified:
  head/sys/x86/acpica/srat.c

Modified: head/sys/x86/acpica/srat.c
==
--- head/sys/x86/acpica/srat.c  Thu Oct  9 05:33:25 2014(r272799)
+++ head/sys/x86/acpica/srat.c  Thu Oct  9 05:34:28 2014(r272800)
@@ -62,6 +62,8 @@ int num_mem;
 static ACPI_TABLE_SRAT *srat;
 static vm_paddr_t srat_physaddr;
 
+static int vm_domains[VM_PHYSSEG_MAX];
+
 static voidsrat_walk_table(acpi_subtable_handler *handler, void *arg);
 
 /*
@@ -247,7 +249,6 @@ check_phys_avail(void)
 static int
 renumber_domains(void)
 {
-   int domains[VM_PHYSSEG_MAX];
int i, j, slot;
 
/* Enumerate all the domains. */
@@ -255,17 +256,17 @@ renumber_domains(void)
for (i = 0; i < num_mem; i++) {
/* See if this domain is already known. */
for (j = 0; j < vm_ndomains; j++) {
-   if (domains[j] >= mem_info[i].domain)
+   if (vm_domains[j] >= mem_info[i].domain)
break;
}
-   if (j < vm_ndomains && domains[j] == mem_info[i].domain)
+   if (j < vm_ndomains && vm_domains[j] == mem_info[i].domain)
continue;
 
/* Insert the new domain at slot 'j'. */
slot = j;
for (j = vm_ndomains; j > slot; j--)
-   domains[j] = domains[j - 1];
-   domains[slot] = mem_info[i].domain;
+   vm_domains[j] = vm_domains[j - 1];
+   vm_domains[slot] = mem_info[i].domain;
vm_ndomains++;
if (vm_ndomains > MAXMEMDOM) {
vm_ndomains = 1;
@@ -280,15 +281,15 @@ renumber_domains(void)
 * If the domain is already the right value, no need
 * to renumber.
 */
-   if (domains[i] == i)
+   if (vm_domains[i] == i)
continue;
 
/* Walk the cpu[] and mem_info[] arrays to renumber. */
for (j = 0; j < num_mem; j++)
-   if (mem_info[j].domain == domains[i])
+   if (mem_info[j].domain == vm_domains[i])
mem_info[j].domain = i;
for (j = 0; j <= MAX_APIC_ID; j++)
-   if (cpus[j].enabled && cpus[j].domain == domains[i])
+   if (cpus[j].enabled && cpus[j].domain == vm_domains[i])
cpus[j].domain = i;
}
KASSERT(vm_ndomains > 0,
@@ -368,4 +369,23 @@ srat_set_cpus(void *dummy)
}
 }
 SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL);
+
+/*
+ * Map a _PXM value to a VM domain ID.
+ *
+ * Returns the domain ID, or -1 if no domain ID was found.
+ */
+int
+acpi_map_pxm_to_vm_domainid(int pxm)
+{
+   int i;
+
+   for (i = 0; i < vm_ndomains; i++) {
+   if (vm_domains[i] == pxm)
+   return (i);
+   }
+
+   return (-1);
+}
+
 #endif /* MAXMEMDOM > 1 */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272801 - head/sys/netinet6

2014-10-08 Thread Bryan Venteicher
Author: bryanv
Date: Thu Oct  9 05:42:07 2014
New Revision: 272801
URL: https://svnweb.freebsd.org/changeset/base/272801

Log:
  Move the calls to u_tun_func() into udp6_append()
  
  A similar cleanup for UDPv4 was performed in r220620.
  
  Phabricator:  https://reviews.freebsd.org/D383
  Reviewed by:  gnn
  MFC after:1 month

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==
--- head/sys/netinet6/udp6_usrreq.c Thu Oct  9 05:34:28 2014
(r272800)
+++ head/sys/netinet6/udp6_usrreq.c Thu Oct  9 05:42:07 2014
(r272801)
@@ -141,9 +141,18 @@ udp6_append(struct inpcb *inp, struct mb
 {
struct socket *so;
struct mbuf *opts;
+   struct udpcb *up;
 
INP_LOCK_ASSERT(inp);
 
+   /*
+* Engage the tunneling protocol.
+*/
+   up = intoudpcb(inp);
+   if (up->u_tun_func != NULL) {
+   (*up->u_tun_func)(n, off, inp);
+   return;
+   }
 #ifdef IPSEC
/* Check AH/ESP integrity. */
if (ipsec6_in_reject(n, inp)) {
@@ -361,20 +370,7 @@ udp6_input(struct mbuf **mp, int *offp, 
 
if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
INP_RLOCK(last);
-   up = intoudpcb(last);
-   if (up->u_tun_func == NULL) {
-   udp6_append(last, n, off, 
&fromsa);
-   } else {
-   /*
-* Engage the tunneling
-* protocol we will have to
-* leave the info_lock up,
-* since we are hunting
-* through multiple UDP's.
-* 
-*/
-   (*up->u_tun_func)(n, off, last);
-   }
+   udp6_append(last, n, off, &fromsa);
INP_RUNLOCK(last);
}
}
@@ -404,16 +400,8 @@ udp6_input(struct mbuf **mp, int *offp, 
}
INP_RLOCK(last);
INP_INFO_RUNLOCK(pcbinfo);
-   up = intoudpcb(last);
UDP_PROBE(receive, NULL, last, ip6, last, uh);
-   if (up->u_tun_func == NULL) {
-   udp6_append(last, m, off, &fromsa);
-   } else {
-   /*
-* Engage the tunneling protocol.
-*/
-   (*up->u_tun_func)(m, off, last);
-   }
+   udp6_append(last, m, off, &fromsa);
INP_RUNLOCK(last);
return (IPPROTO_DONE);
}
@@ -492,15 +480,7 @@ udp6_input(struct mbuf **mp, int *offp, 
}
}
UDP_PROBE(receive, NULL, inp, ip6, inp, uh);
-   if (up->u_tun_func == NULL) {
-   udp6_append(inp, m, off, &fromsa);
-   } else {
-   /*
-* Engage the tunneling protocol.
-*/
-
-   (*up->u_tun_func)(m, off, inp);
-   }
+   udp6_append(inp, m, off, &fromsa);
INP_RUNLOCK(inp);
return (IPPROTO_DONE);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272805 - head/sys/cam

2014-10-08 Thread Alexander Motin
Author: mav
Date: Thu Oct  9 05:53:58 2014
New Revision: 272805
URL: https://svnweb.freebsd.org/changeset/base/272805

Log:
  Use proper variable when looping through periphs with CAM_PERIPH_FREE.
  
  PR:   194256
  Submitted by: Scott M. Ferris 
  MFC after:3 days
  Sponsored by: EMC/Isilon Storage Division

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Oct  9 05:53:04 2014(r272804)
+++ head/sys/cam/cam_xpt.c  Thu Oct  9 05:53:58 2014(r272805)
@@ -2195,7 +2195,7 @@ xptperiphtraverse(struct cam_ed *device,
next_periph = SLIST_NEXT(periph, periph_links);
while (next_periph != NULL &&
(next_periph->flags & CAM_PERIPH_FREE) != 0)
-   next_periph = SLIST_NEXT(periph, periph_links);
+   next_periph = SLIST_NEXT(next_periph, periph_links);
if (next_periph)
next_periph->refcount++;
mtx_unlock(&bus->eb_mtx);
@@ -2269,7 +2269,7 @@ xptpdperiphtraverse(struct periph_driver
next_periph = TAILQ_NEXT(periph, unit_links);
while (next_periph != NULL &&
(next_periph->flags & CAM_PERIPH_FREE) != 0)
-   next_periph = TAILQ_NEXT(periph, unit_links);
+   next_periph = TAILQ_NEXT(next_periph, unit_links);
if (next_periph)
next_periph->refcount++;
xpt_unlock_buses();
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272806 - head/cddl/contrib/opensolaris/cmd/zdb

2014-10-08 Thread Xin LI
Author: delphij
Date: Thu Oct  9 06:02:53 2014
New Revision: 272806
URL: https://svnweb.freebsd.org/changeset/base/272806

Log:
  MFV r272802:
  
   - Limit ARC for zdb at 256MB.  zdb do not typically revisit data
 in the ARC.
   - Increase default max_inflight from 200 to 1000 (can be overriden
 by -I) so we can queue more I/Os when doing scrubbing.
   - Print status while loading meataslabs for leak detection.
  
  Illumos issues:
  
  5169 zdb should limit its ARC size
  5170 zdb -c should create more scrub i/os by default
  5171 zdb should print status while loading metaslabs for leak detection
  
  MFC after:2 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Oct  9 05:53:58 2014
(r272805)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Oct  9 06:02:53 2014
(r272806)
@@ -76,8 +76,10 @@
 
 #ifndef lint
 extern boolean_t zfs_recover;
+extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
 #else
 boolean_t zfs_recover;
+uint64_t zfs_arc_max, zfs_arc_meta_limit;
 #endif
 
 const char cmdname[] = "zdb";
@@ -89,7 +91,7 @@ extern void dump_intent_log(zilog_t *);
 uint64_t *zopt_object = NULL;
 int zopt_objects = 0;
 libzfs_handle_t *g_zfs;
-uint64_t max_inflight = 200;
+uint64_t max_inflight = 1000;
 
 /*
  * These libumem hooks provide a reasonable set of defaults for the allocator's
@@ -2382,7 +2384,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog
 
zcb->zcb_readfails = 0;
 
-   if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) &&
+   if (dump_opt['b'] < 5 &&
gethrtime() > zcb->zcb_lastprint + NANOSEC) {
uint64_t now = gethrtime();
char buf[10];
@@ -2467,9 +2469,9 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
 
if (!dump_opt['L']) {
vdev_t *rvd = spa->spa_root_vdev;
-   for (int c = 0; c < rvd->vdev_children; c++) {
+   for (uint64_t c = 0; c < rvd->vdev_children; c++) {
vdev_t *vd = rvd->vdev_child[c];
-   for (int m = 0; m < vd->vdev_ms_count; m++) {
+   for (uint64_t m = 0; m < vd->vdev_ms_count; m++) {
metaslab_t *msp = vd->vdev_ms[m];
mutex_enter(&msp->ms_lock);
metaslab_unload(msp);
@@ -2482,6 +2484,15 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
 * interfaces.
 */
if (msp->ms_sm != NULL) {
+   (void) fprintf(stderr,
+   "\rloading space map for "
+   "vdev %llu of %llu, "
+   "metaslab %llu of %llu ...",
+   (longlong_t)c,
+   (longlong_t)rvd->vdev_children,
+   (longlong_t)m,
+   (longlong_t)vd->vdev_ms_count);
+
msp->ms_ops = &zdb_metaslab_ops;
VERIFY0(space_map_load(msp->ms_sm,
msp->ms_tree, SM_ALLOC));
@@ -2490,6 +2501,7 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
mutex_exit(&msp->ms_lock);
}
}
+   (void) fprintf(stderr, "\n");
}
 
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
@@ -3490,6 +3502,12 @@ main(int argc, char **argv)
usage();
}
 
+   /*
+* ZDB does not typically re-read blocks; therefore limit the ARC
+* to 256 MB, which can be used entirely for metadata.
+*/
+   zfs_arc_max = zfs_arc_meta_limit = 256 * 1024 * 1024;
+
kernel_init(FREAD);
g_zfs = libzfs_init();
ASSERT(g_zfs != NULL);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r272805 - head/sys/cam

2014-10-08 Thread Garrett Cooper
Also...

> On Oct 8, 2014, at 22:53, Alexander Motin  wrote:
> 
> Author: mav
> Date: Thu Oct  9 05:53:58 2014
> New Revision: 272805
> URL: https://svnweb.freebsd.org/changeset/base/272805
> 
> Log:
>  Use proper variable when looping through periphs with CAM_PERIPH_FREE.
> 
>  PR:194256
>  Submitted by:Scott M. Ferris 
>  MFC after:3 days
>  Sponsored by:EMC/Isilon Storage Division
> 

Reported by: Anton Rang 

> Modified:
>  head/sys/cam/cam_xpt.c
> 
> Modified: head/sys/cam/cam_xpt.c
> ==
> --- head/sys/cam/cam_xpt.cThu Oct  9 05:53:04 2014(r272804)
> +++ head/sys/cam/cam_xpt.cThu Oct  9 05:53:58 2014(r272805)
> @@ -2195,7 +2195,7 @@ xptperiphtraverse(struct cam_ed *device,
>next_periph = SLIST_NEXT(periph, periph_links);
>while (next_periph != NULL &&
>(next_periph->flags & CAM_PERIPH_FREE) != 0)
> -next_periph = SLIST_NEXT(periph, periph_links);
> +next_periph = SLIST_NEXT(next_periph, periph_links);
>if (next_periph)
>next_periph->refcount++;
>mtx_unlock(&bus->eb_mtx);
> @@ -2269,7 +2269,7 @@ xptpdperiphtraverse(struct periph_driver
>next_periph = TAILQ_NEXT(periph, unit_links);
>while (next_periph != NULL &&
>(next_periph->flags & CAM_PERIPH_FREE) != 0)
> -next_periph = TAILQ_NEXT(periph, unit_links);
> +next_periph = TAILQ_NEXT(next_periph, unit_links);
>if (next_periph)
>next_periph->refcount++;
>xpt_unlock_buses();
> 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272807 - in head/sys/dev/usb: . controller

2014-10-08 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Oct  9 06:24:06 2014
New Revision: 272807
URL: https://svnweb.freebsd.org/changeset/base/272807

Log:
  Refine support for disabling USB enumeration to allow device detach
  and suspend and resume of existing devices.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/usb/controller/usb_controller.c
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/controller/usb_controller.c
==
--- head/sys/dev/usb/controller/usb_controller.cThu Oct  9 06:02:53 
2014(r272806)
+++ head/sys/dev/usb/controller/usb_controller.cThu Oct  9 06:24:06 
2014(r272807)
@@ -102,14 +102,6 @@ static int usb_no_shutdown_wait = 0;
 SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RWTUN,
 &usb_no_shutdown_wait, 0, "No USB device waiting at system shutdown.");
 
-#if USB_HAVE_DISABLE_ENUM
-static int usb_disable_enumeration = 0;
-SYSCTL_INT(_hw_usb, OID_AUTO, disable_enumeration, CTLFLAG_RWTUN,
-&usb_disable_enumeration, 0, "Set to disable all USB device enumeration.");
-#else
-#defineusb_disable_enumeration 0
-#endif
-
 static devclass_t usb_devclass;
 
 static device_method_t usb_methods[] = {
@@ -379,8 +371,7 @@ usb_bus_explore(struct usb_proc_msg *pm)
USB_BUS_LOCK(bus);
}
 
-   if (usb_disable_enumeration == 0 &&
-   udev != NULL && udev->hub != NULL) {
+   if (udev != NULL && udev->hub != NULL) {
 
if (bus->do_probe) {
bus->do_probe = 0;

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Thu Oct  9 06:02:53 2014(r272806)
+++ head/sys/dev/usb/usb_hub.c  Thu Oct  9 06:24:06 2014(r272807)
@@ -97,6 +97,12 @@ SYSCTL_INT(_hw_usb, OID_AUTO, power_time
 &usb_power_timeout, 0, "USB power timeout");
 #endif
 
+#if USB_HAVE_DISABLE_ENUM
+static int usb_disable_enumeration = 0;
+SYSCTL_INT(_hw_usb, OID_AUTO, disable_enumeration, CTLFLAG_RWTUN,
+&usb_disable_enumeration, 0, "Set to disable all USB device enumeration.");
+#endif
+
 struct uhub_current_state {
uint16_t port_change;
uint16_t port_status;
@@ -621,9 +627,9 @@ repeat:
err = usbd_req_clear_port_feature(udev, NULL,
portno, UHF_C_PORT_CONNECTION);
 
-   if (err) {
+   if (err)
goto error;
-   }
+
/* check if there is a child */
 
if (child != NULL) {
@@ -636,14 +642,22 @@ repeat:
/* get fresh status */
 
err = uhub_read_port_status(sc, portno);
-   if (err) {
+   if (err)
+   goto error;
+
+#if USB_HAVE_DISABLE_ENUM
+   /* check if we should skip enumeration from this USB HUB */
+   if (usb_disable_enumeration != 0 ||
+   sc->sc_disable_enumeration != 0) {
+   DPRINTF("Enumeration is disabled!\n");
goto error;
}
+#endif
/* check if nothing is connected to the port */
 
-   if (!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS)) {
+   if (!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))
goto error;
-   }
+
/* check if there is no power on the port and print a warning */
 
switch (udev->speed) {
@@ -996,13 +1010,6 @@ uhub_explore(struct usb_device *udev)
 
DPRINTFN(11, "udev=%p addr=%d\n", udev, udev->address);
 
-#if USB_HAVE_DISABLE_ENUM
-   /* check if we should skip enumeration from this USB HUB */
-   if (sc->sc_disable_enumeration != 0) {
-   DPRINTF("Enumeration is disabled!\n");
-   return (0);
-   }
-#endif
/* ignore devices that are too deep */
if (uhub_is_too_deep(udev))
return (USB_ERR_TOO_DEEP);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272808 - head/include/rpcsvc

2014-10-08 Thread Baptiste Daroussin
Author: bapt
Date: Thu Oct  9 06:58:33 2014
New Revision: 272808
URL: https://svnweb.freebsd.org/changeset/base/272808

Log:
  Fix build with rpcgen using a recent (tested with gcc 4.9.1) GNU cpp

Modified:
  head/include/rpcsvc/nis.x

Modified: head/include/rpcsvc/nis.x
==
--- head/include/rpcsvc/nis.x   Thu Oct  9 06:24:06 2014(r272807)
+++ head/include/rpcsvc/nis.x   Thu Oct  9 06:58:33 2014(r272808)
@@ -400,10 +400,7 @@ program  NIS_PROG {
 %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
 %#define WORLD_DEFAULT (NIS_READ_ACC)
 %#define GROUP_DEFAULT (NIS_READ_ACC << 8)
-%#define OWNER_DEFAULT ((NIS_READ_ACC +\
-NIS_MODIFY_ACC +\
-NIS_CREATE_ACC +\
-NIS_DESTROY_ACC) << 16)
+%#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC + 
NIS_DESTROY_ACC) << 16)
 %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
 %
 %/* Result manipulation defines ... */
@@ -432,10 +429,8 @@ program  NIS_PROG {
 % * these definitions they take an nis_object *, and an int and return
 % * a u_char * for Value, and an int for length.
 % */
-%#define ENTRY_VAL(obj, col) \
-   (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
-%#define ENTRY_LEN(obj, col) \
-   (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
+%#define ENTRY_VAL(obj, col) 
(obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
+%#define ENTRY_LEN(obj, col) 
(obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
 %
 %#ifdef __cplusplus
 %}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272733 - in head/sys/dev/usb: . controller

2014-10-08 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Oct  8 07:00:50 2014
New Revision: 272733
URL: https://svnweb.freebsd.org/changeset/base/272733

Log:
  Add support for disabling USB enumeration in general or on selected
  USB HUBs.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/usb/controller/usb_controller.c
  head/sys/dev/usb/usb_freebsd.h
  head/sys/dev/usb/usb_freebsd_loader.h
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/controller/usb_controller.c
==
--- head/sys/dev/usb/controller/usb_controller.cWed Oct  8 05:53:04 
2014(r272732)
+++ head/sys/dev/usb/controller/usb_controller.cWed Oct  8 07:00:50 
2014(r272733)
@@ -102,6 +102,14 @@ static int usb_no_shutdown_wait = 0;
 SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RWTUN,
 &usb_no_shutdown_wait, 0, "No USB device waiting at system shutdown.");
 
+#if USB_HAVE_DISABLE_ENUM
+static int usb_disable_enumeration = 0;
+SYSCTL_INT(_hw_usb, OID_AUTO, disable_enumeration, CTLFLAG_RWTUN,
+&usb_disable_enumeration, 0, "Set to disable all USB device enumeration.");
+#else
+#defineusb_disable_enumeration 0
+#endif
+
 static devclass_t usb_devclass;
 
 static device_method_t usb_methods[] = {
@@ -371,7 +379,8 @@ usb_bus_explore(struct usb_proc_msg *pm)
USB_BUS_LOCK(bus);
}
 
-   if (udev != NULL && udev->hub != NULL) {
+   if (usb_disable_enumeration == 0 &&
+   udev != NULL && udev->hub != NULL) {
 
if (bus->do_probe) {
bus->do_probe = 0;

Modified: head/sys/dev/usb/usb_freebsd.h
==
--- head/sys/dev/usb/usb_freebsd.h  Wed Oct  8 05:53:04 2014
(r272732)
+++ head/sys/dev/usb/usb_freebsd.h  Wed Oct  8 07:00:50 2014
(r272733)
@@ -50,6 +50,7 @@
 #defineUSB_HAVE_FIXED_IFACE 0
 #defineUSB_HAVE_FIXED_CONFIG 0
 #defineUSB_HAVE_FIXED_PORT 0
+#defineUSB_HAVE_DISABLE_ENUM 1
 
 /* define zero ticks callout value */
 #defineUSB_CALLOUT_ZERO_TICKS 1

Modified: head/sys/dev/usb/usb_freebsd_loader.h
==
--- head/sys/dev/usb/usb_freebsd_loader.h   Wed Oct  8 05:53:04 2014
(r272732)
+++ head/sys/dev/usb/usb_freebsd_loader.h   Wed Oct  8 07:00:50 2014
(r272733)
@@ -50,6 +50,7 @@
 #defineUSB_HAVE_FIXED_IFACE 0
 #defineUSB_HAVE_FIXED_CONFIG 0
 #defineUSB_HAVE_FIXED_PORT 0
+#defineUSB_HAVE_DISABLE_ENUM 0
 
 #defineUSB_CALLOUT_ZERO_TICKS 1
 

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Wed Oct  8 05:53:04 2014(r272732)
+++ head/sys/dev/usb/usb_hub.c  Wed Oct  8 07:00:50 2014(r272733)
@@ -111,6 +111,9 @@ struct uhub_softc {
struct mtx sc_mtx;  /* our mutex */
struct usb_device *sc_udev; /* USB device */
struct usb_xfer *sc_xfer[UHUB_N_TRANSFER];  /* interrupt xfer */
+#if USB_HAVE_DISABLE_ENUM
+   int sc_disable_enumeration;
+#endif
uint8_t sc_flags;
 #defineUHUB_FLAG_DID_EXPLORE 0x01
 };
@@ -993,6 +996,13 @@ uhub_explore(struct usb_device *udev)
 
DPRINTFN(11, "udev=%p addr=%d\n", udev, udev->address);
 
+#if USB_HAVE_DISABLE_ENUM
+   /* check if we should skip enumeration from this USB HUB */
+   if (sc->sc_disable_enumeration != 0) {
+   DPRINTF("Enumeration is disabled!\n");
+   return (0);
+   }
+#endif
/* ignore devices that are too deep */
if (uhub_is_too_deep(udev))
return (USB_ERR_TOO_DEEP);
@@ -1188,6 +1198,10 @@ uhub_attach(device_t dev)
struct usb_hub *hub;
struct usb_hub_descriptor hubdesc20;
struct usb_hub_ss_descriptor hubdesc30;
+#if USB_HAVE_DISABLE_ENUM
+   struct sysctl_ctx_list *sysctl_ctx;
+   struct sysctl_oid *sysctl_tree;
+#endif
uint16_t pwrdly;
uint16_t nports;
uint8_t x;
@@ -1469,6 +1483,19 @@ uhub_attach(device_t dev)
 
usbd_set_power_mode(udev, USB_POWER_MODE_SAVE);
 
+#if USB_HAVE_DISABLE_ENUM
+   /* Add device sysctls */
+
+   sysctl_ctx = device_get_sysctl_ctx(dev);
+   sysctl_tree = device_get_sysctl_tree(dev);
+
+   if (sysctl_ctx != NULL && sysctl_tree != NULL) {
+   (void) SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
+   OID_AUTO, "disable_enumeration", CTLFLAG_RWTUN,
+   &sc->sc_disable_enumeration, 0,
+   "Set to disable enumeration on this USB HUB.");
+   }
+#endif
return (0);
 
 error:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mai

svn commit: r272734 - in head/sys/cam: ctl scsi

2014-10-08 Thread Alexander Motin
Author: mav
Date: Wed Oct  8 07:48:36 2014
New Revision: 272734
URL: https://svnweb.freebsd.org/changeset/base/272734

Log:
  Add support for WRITE ATOMIC (16) command and report SBC-4 compliance.
  
  Atomic writes are only supported for ZVOLs in "dev" mode.  In other cases
  atomicity can not be guarantied and so the command is blocked.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_backend.h
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_backend_ramdisk.c
  head/sys/cam/ctl/ctl_cmd_table.c
  head/sys/cam/ctl/scsi_ctl.c
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Wed Oct  8 07:00:50 2014(r272733)
+++ head/sys/cam/ctl/ctl.c  Wed Oct  8 07:48:36 2014(r272734)
@@ -9126,6 +9126,31 @@ ctl_read_write(struct ctl_scsiio *ctsio)
num_blocks = scsi_4btoul(cdb->length);
break;
}
+   case WRITE_ATOMIC_16: {
+   struct scsi_rw_16 *cdb;
+
+   if (lun->be_lun->atomicblock == 0) {
+   ctl_set_invalid_opcode(ctsio);
+   ctl_done((union ctl_io *)ctsio);
+   return (CTL_RETVAL_COMPLETE);
+   }
+
+   cdb = (struct scsi_rw_16 *)ctsio->cdb;
+   if (cdb->byte2 & SRW12_FUA)
+   flags |= CTL_LLF_FUA;
+   if (cdb->byte2 & SRW12_DPO)
+   flags |= CTL_LLF_DPO;
+   lba = scsi_8btou64(cdb->addr);
+   num_blocks = scsi_4btoul(cdb->length);
+   if (num_blocks > lun->be_lun->atomicblock) {
+   ctl_set_invalid_field(ctsio, /*sks_valid*/ 1,
+   /*command*/ 1, /*field*/ 12, /*bit_valid*/ 0,
+   /*bit*/ 0);
+   ctl_done((union ctl_io *)ctsio);
+   return (CTL_RETVAL_COMPLETE);
+   }
+   break;
+   }
case WRITE_VERIFY_16: {
struct scsi_write_verify_16 *cdb;
 
@@ -10299,6 +10324,10 @@ ctl_inquiry_evpd_block_limits(struct ctl
bl_ptr->unmap_grain_align);
}
}
+   scsi_ulto4b(lun->be_lun->atomicblock,
+   bl_ptr->max_atomic_transfer_length);
+   scsi_ulto4b(0, bl_ptr->atomic_alignment);
+   scsi_ulto4b(0, bl_ptr->atomic_transfer_length_granularity);
}
scsi_u64to8b(UINT64_MAX, bl_ptr->max_write_same_length);
 
@@ -10694,13 +10723,13 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
}
 
if (lun == NULL) {
-   /* SBC-3 (no version claimed) */
-   scsi_ulto2b(0x04C0, inq_ptr->version4);
+   /* SBC-4 (no version claimed) */
+   scsi_ulto2b(0x0600, inq_ptr->version4);
} else {
switch (lun->be_lun->lun_type) {
case T_DIRECT:
-   /* SBC-3 (no version claimed) */
-   scsi_ulto2b(0x04C0, inq_ptr->version4);
+   /* SBC-4 (no version claimed) */
+   scsi_ulto2b(0x0600, inq_ptr->version4);
break;
case T_PROCESSOR:
default:
@@ -10818,7 +10847,8 @@ ctl_get_lba_len(union ctl_io *io, uint64
break;
}
case READ_16:
-   case WRITE_16: {
+   case WRITE_16:
+   case WRITE_ATOMIC_16: {
struct scsi_rw_16 *cdb;
 
cdb = (struct scsi_rw_16 *)io->scsiio.cdb;
@@ -10832,7 +10862,6 @@ ctl_get_lba_len(union ctl_io *io, uint64
 
cdb = (struct scsi_write_verify_16 *)io->scsiio.cdb;
 
-   
*lba = scsi_8btou64(cdb->addr);
*len = scsi_4btoul(cdb->length);
break;

Modified: head/sys/cam/ctl/ctl_backend.h
==
--- head/sys/cam/ctl/ctl_backend.h  Wed Oct  8 07:00:50 2014
(r272733)
+++ head/sys/cam/ctl/ctl_backend.h  Wed Oct  8 07:48:36 2014
(r272734)
@@ -144,6 +144,8 @@ typedef void (*be_lun_config_t)(void *be
  *
  * pblockoff is the lowest LBA on the LUN aligned ot physical sector.
  *
+ * atomicblock is the number of blocks that can be written atomically.
+ *
  * req_lun_id is the requested LUN ID.  CTL only pays attention to this
  * field if the CTL_LUN_FLAG_ID_REQ flag is set.  If the requested LUN ID is
  * not available, the LUN addition will fail.  If a particular LUN ID isn't
@@ -188,6 +190,7 @@ struct ctl_be_lun {
uint32_tblocksize;  /* passed to CTL */
uint16_tpblockexp;  /* passed to CTL */
uint16_tpblockoff;  /* passed to CTL */
+   uint32_tatomicblock;/* passed to CTL */

svn commit: r272735 - head/sys/dev/mrsas

2014-10-08 Thread Kashyap D Desai
Author: kadesai
Date: Wed Oct  8 08:48:18 2014
New Revision: 272735
URL: https://svnweb.freebsd.org/changeset/base/272735

Log:
  Current MegaRAID firmware and hence the driver only supported 64VDs.
  E.g: If the user wants to create more than 64VD on a controller,
  it is not possible on current firmware/driver.
  
  New feature and requirement to support upto 256VD, firmware/driver/apps need 
changes.
  In addition to that, there must be a backward compatibility of the new driver 
with the
  older firmware and vice versa.
  
  RAID map is the interface between Driver and FW to fetch all required
  fields(attributes) for each Virtual Drives.
  In the earlier design driver was using the FW copy of RAID map where as
  in the new design the Driver will keep the RAID map copy of its own; on which
  it will operate for any raid map access in fast path.
  
  Local driver raid map copy will provide ease of access through out the code
  and provide generic interface for future FW raid map changes.
  
  For the backward compatibility driver will notify FW that it supports 256VD
  to the FW in driver capability field.
  Based on the controller properly returned by the FW, the Driver will know
  whether it supports 256VD or not and will copy the RAID map accordingly.
  
  At any given time, driver will always have old or new Raid map.
  
  Reviewed by   :   ambrisko
  MFC after :   2 weeks
  Sponsored by: AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h
  head/sys/dev/mrsas/mrsas_cam.c
  head/sys/dev/mrsas/mrsas_fp.c

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Wed Oct  8 07:48:36 2014(r272734)
+++ head/sys/dev/mrsas/mrsas.c  Wed Oct  8 08:48:18 2014(r272735)
@@ -139,8 +139,8 @@ extern void mrsas_release_mpt_cmd(struct
 extern struct mrsas_mpt_cmd *mrsas_get_mpt_cmd(struct mrsas_softc *sc);
 extern int mrsas_passthru(struct mrsas_softc *sc, void *arg);
 extern uint8_t MR_ValidateMapInfo(struct mrsas_softc *sc);
-extern u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_FW_RAID_MAP_ALL *map);
-extern MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_FW_RAID_MAP_ALL *map);
+extern u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map);
+extern MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map);
 extern void mrsas_xpt_freeze(struct mrsas_softc *sc);
 extern void mrsas_xpt_release(struct mrsas_softc *sc);
 extern MRSAS_REQUEST_DESCRIPTOR_UNION *mrsas_get_request_desc(struct 
mrsas_softc *sc,
@@ -928,6 +928,9 @@ void mrsas_free_mem(struct mrsas_softc *
 bus_dmamem_free(sc->raidmap_tag[i], sc->raidmap_mem[i], 
sc->raidmap_dmamap[i]);
 if (sc->raidmap_tag[i] != NULL)
 bus_dma_tag_destroy(sc->raidmap_tag[i]);
+
+   if (sc->ld_drv_map[i] != NULL)
+   free(sc->ld_drv_map[i], M_MRSAS);
 }
 
 /* 
@@ -1634,9 +1637,58 @@ mrsas_addr_cb(void *arg, bus_dma_segment
  * Allocate DMA memory for the RAID maps and perform setup.
  */
 static int mrsas_setup_raidmap(struct mrsas_softc *sc)
-{   
-sc->map_sz = sizeof(MR_FW_RAID_MAP) +
-(sizeof(MR_LD_SPAN_MAP) * (MAX_LOGICAL_DRIVES - 1));
+{
+   int i;
+
+   sc->drv_supported_vd_count =
+   MRSAS_MAX_LD_CHANNELS * MRSAS_MAX_DEV_PER_CHANNEL;
+   sc->drv_supported_pd_count =
+   MRSAS_MAX_PD_CHANNELS * MRSAS_MAX_DEV_PER_CHANNEL;
+
+   if(sc->max256vdSupport) {
+   sc->fw_supported_vd_count = MAX_LOGICAL_DRIVES_EXT;
+   sc->fw_supported_pd_count = MAX_PHYSICAL_DEVICES;
+   } else {
+   sc->fw_supported_vd_count = MAX_LOGICAL_DRIVES;
+   sc->fw_supported_pd_count = MAX_PHYSICAL_DEVICES;
+   }
+
+#if VD_EXT_DEBUG
+   device_printf(sc->mrsas_dev, "FW supports: max256vdSupport = %s\n",
+   sc->max256vdSupport ? "YES":"NO");
+   device_printf(sc->mrsas_dev, "FW supports %dVDs %dPDs\n"
+   "DRIVER supports %dVDs  %dPDs \n",
+   sc->fw_supported_vd_count, sc->fw_supported_pd_count,
+   sc->drv_supported_vd_count, sc->drv_supported_pd_count);
+#endif
+
+   sc->old_map_sz = sizeof(MR_FW_RAID_MAP) +
+   (sizeof(MR_LD_SPAN_MAP) * (sc->fw_supported_vd_count - 1));
+   sc->new_map_sz = sizeof(MR_FW_RAID_MAP_EXT);
+   sc->drv_map_sz = sizeof(MR_DRV_RAID_MAP) +
+   (sizeof(MR_LD_SPAN_MAP) * (sc->drv_supported_vd_count-1));
+
+   for (i = 0; i < 2; i++) {
+   sc->ld_drv_map[i] =
+   (void*) malloc(sc->drv_map_sz, M_MRSAS, M_NOWAIT);
+   /* Do Error handling */
+   if (!sc->ld_drv_map[i]) {
+   device_printf(sc->mrsas_dev, "Could not allocate memory 
for local map");
+
+   if (i == 1)
+   free (sc->ld_drv_map[0], M_MRSAS);
+ 

svn commit: r272736 - head/sys/dev/mmc/host

2014-10-08 Thread Ruslan Bukin
Author: br
Date: Wed Oct  8 08:51:05 2014
New Revision: 272736
URL: https://svnweb.freebsd.org/changeset/base/272736

Log:
  Always wait 'command done' interrupt status bit before proceeding next 
command.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/mmc/host/dwmmc.c

Modified: head/sys/dev/mmc/host/dwmmc.c
==
--- head/sys/dev/mmc/host/dwmmc.c   Wed Oct  8 08:48:18 2014
(r272735)
+++ head/sys/dev/mmc/host/dwmmc.c   Wed Oct  8 08:51:05 2014
(r272736)
@@ -348,9 +348,10 @@ dwmmc_tasklet(struct dwmmc_softc *sc)
if (cmd == NULL)
return;
 
-   if (cmd->error != MMC_ERR_NONE) {
-   dwmmc_next_operation(sc);
-   } else if (!cmd->data && sc->cmd_done) {
+   if (!sc->cmd_done)
+   return;
+
+   if (cmd->error != MMC_ERR_NONE || !cmd->data) {
dwmmc_next_operation(sc);
} else if (cmd->data && sc->dto_rcvd) {
if ((cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK ||
@@ -394,11 +395,8 @@ dwmmc_intr(void *arg)
dprintf("data err 0x%08x cmd 0x%08x\n",
reg, cmd->opcode);
cmd->error = MMC_ERR_FAILED;
-
dma_done(sc, cmd);
dma_stop(sc);
-   DWMMC_UNLOCK(sc);
-   return;
}
 
if (reg & SDMMC_INTMASK_CMD_DONE) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272737 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux

2014-10-08 Thread Kashyap D Desai
Author: kadesai
Date: Wed Oct  8 09:19:35 2014
New Revision: 272737
URL: https://svnweb.freebsd.org/changeset/base/272737

Log:
  This is a feature provided to run 32-bit linux binaries on FreeBSD 64bit
  machine, for which 32bit compatibilty code has been added.
  As in linux there is only one device entry that is used to fire IOCTL 
commands,
  a new device entry megaraid_sas_ioctl_node is added for solely this
  purpose.
  
  From one dev node i.e mrgaraid_sa_ioctl_node we have to find out the
  controller instance in case of multicontroller, for which one management info
  structure has been added.
  
  Reviewed by:  ambrisko
  MFC after:2 weeks
  Sponsored by: AVAGO Technologies

Added:
  head/sys/dev/mrsas/mrsas_linux.c   (contents, props changed)
  head/sys/modules/mrsas/mrsas_linux/
  head/sys/modules/mrsas/mrsas_linux/Makefile   (contents, props changed)
Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h
  head/sys/dev/mrsas/mrsas_ioctl.c
  head/sys/dev/mrsas/mrsas_ioctl.h
  head/sys/modules/mrsas/Makefile

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Wed Oct  8 08:51:05 2014(r272736)
+++ head/sys/dev/mrsas/mrsas.c  Wed Oct  8 09:19:35 2014(r272737)
@@ -65,6 +65,7 @@ static d_read_t mrsas_read;
 static d_write_tmrsas_write;
 static d_ioctl_tmrsas_ioctl;
 
+static struct mrsas_mgmt_info mrsas_mgmt_info;
 static struct mrsas_ident *mrsas_find_ident(device_t);
 static void mrsas_shutdown_ctlr(struct mrsas_softc *sc, u_int32_t opcode);
 static void mrsas_flush_cache(struct mrsas_softc *sc);
@@ -137,7 +138,7 @@ extern void mrsas_free_frame(struct mrsa
 extern int mrsas_alloc_mfi_cmds(struct mrsas_softc *sc);
 extern void mrsas_release_mpt_cmd(struct mrsas_mpt_cmd *cmd); 
 extern struct mrsas_mpt_cmd *mrsas_get_mpt_cmd(struct mrsas_softc *sc);
-extern int mrsas_passthru(struct mrsas_softc *sc, void *arg);
+extern int mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd);
 extern uint8_t MR_ValidateMapInfo(struct mrsas_softc *sc);
 extern u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map);
 extern MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map);
@@ -657,7 +658,7 @@ mrsas_register_aen(struct mrsas_softc *s
dcmd->data_xfer_len = sizeof(struct mrsas_evt_detail);
dcmd->opcode = MR_DCMD_CTRL_EVENT_WAIT;
dcmd->mbox.w[0] = seq_num;
-sc->last_seq_num = seq_num;
+   sc->last_seq_num = seq_num;
dcmd->mbox.w[1] = curr_aen.word;
dcmd->sgl.sge32[0].phys_addr = (u_int32_t) sc->evt_detail_phys_addr;
dcmd->sgl.sge32[0].length = sizeof(struct mrsas_evt_detail);
@@ -775,6 +776,8 @@ static int mrsas_attach(device_t dev)
 sc->mrsas_cdev = make_dev(&mrsas_cdevsw, device_get_unit(dev), UID_ROOT,
 GID_OPERATOR, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP), "mrsas%u",
 device_get_unit(dev));
+if (device_get_unit(dev) == 0)
+   make_dev_alias(sc->mrsas_cdev, "megaraid_sas_ioctl_node");
 if (sc->mrsas_cdev)
sc->mrsas_cdev->si_drv1 = sc;
 
@@ -816,6 +819,17 @@ static int mrsas_attach(device_t dev)
goto fail_start_aen;
}
 
+/*
+ * Add this controller to mrsas_mgmt_info structure so that it
+ * can be exported to management applications
+ */
+if (device_get_unit(dev) == 0)
+memset(&mrsas_mgmt_info, 0, sizeof(mrsas_mgmt_info));
+
+mrsas_mgmt_info.count++;
+mrsas_mgmt_info.sc_ptr[mrsas_mgmt_info.max_index] = sc;
+mrsas_mgmt_info.max_index++;
+
 return (0);
 
 fail_start_aen:
@@ -858,6 +872,19 @@ static int mrsas_detach(device_t dev)
 
 sc = device_get_softc(dev);
 sc->remove_in_progress = 1;
+
+/*
+ * Take the instance off the instance array. Note that we will not
+ * decrement the max_index. We let this array be sparse array
+*/
+for (i = 0; i < mrsas_mgmt_info.max_index; i++) {
+if (mrsas_mgmt_info.sc_ptr[i] == sc) {
+mrsas_mgmt_info.count--;
+mrsas_mgmt_info.sc_ptr[i] = NULL;
+break;
+}
+}
+
 if(sc->ocr_thread_active)
 wakeup(&sc->ocr_chan);
 while(sc->reset_in_progress){
@@ -1101,8 +1128,19 @@ mrsas_ioctl(struct cdev *dev, u_long cmd
 struct mrsas_softc *sc;
 int ret = 0, i = 0; 
 
-sc = (struct mrsas_softc *)(dev->si_drv1);
-
+struct mrsas_iocpacket *user_ioc = (struct mrsas_iocpacket *)arg;
+
+/* get the Host number & the softc from data sent by the Application */
+sc = mrsas_mgmt_info.sc_ptr[user_ioc->host_no];
+
+if ((mrsas_mgmt_info.max_index == user_ioc->host_no) || (sc == NULL)) {
+printf ("Please check the controller number\n");
+if (sc == NULL)
+printf ("There is NO such Host no. %d\n", 
user_ioc->host_no);
+
+return ENOENT;
+}
+
 if (

svn commit: r272738 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux

2014-10-08 Thread Kashyap D Desai
Author: kadesai
Date: Wed Oct  8 09:30:35 2014
New Revision: 272738
URL: https://svnweb.freebsd.org/changeset/base/272738

Log:
  Fix the minor svn add issue. $FreeBSD$ expands at the time of
  snv add, so I have added $FreeBSD$ as comment.
  
  This commit is contininous of last mrsas commit, so that compilation
  does not break.
  
  Obtained from:AVAGO Technologies
  MFC after: 2 weeks

Modified:
  head/sys/dev/mrsas/mrsas_linux.c
  head/sys/modules/mrsas/Makefile
  head/sys/modules/mrsas/mrsas_linux/Makefile

Modified: head/sys/dev/mrsas/mrsas_linux.c
==
--- head/sys/dev/mrsas/mrsas_linux.cWed Oct  8 09:19:35 2014
(r272737)
+++ head/sys/dev/mrsas/mrsas_linux.cWed Oct  8 09:30:35 2014
(r272738)
@@ -39,10 +39,10 @@
  * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035
  *ATTN: MegaRaid FreeBSD
  *
+ * $FreeBSD$
  */
 
 #include 
-
 
 #include 
 #include 

Modified: head/sys/modules/mrsas/Makefile
==
--- head/sys/modules/mrsas/Makefile Wed Oct  8 09:19:35 2014
(r272737)
+++ head/sys/modules/mrsas/Makefile Wed Oct  8 09:30:35 2014
(r272738)
@@ -1,5 +1,5 @@
 # Makefile for mrsas driver
-
+# $FreeBSD$
 
 KMOD=mrsas
 .PATH: ${.CURDIR}/../../dev/${KMOD}

Modified: head/sys/modules/mrsas/mrsas_linux/Makefile
==
--- head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct  8 09:19:35 2014
(r272737)
+++ head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct  8 09:30:35 2014
(r272738)
@@ -1,5 +1,5 @@
 # Makefile for mrsas driver
-
+# $FreeBSD$
 
 .PATH: ${.CURDIR}/../../../dev/mrsas
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272739 - head/sys/dev/mrsas

2014-10-08 Thread Kashyap D Desai
Author: kadesai
Date: Wed Oct  8 09:34:25 2014
New Revision: 272739
URL: https://svnweb.freebsd.org/changeset/base/272739

Log:
  Extended MSI-x vectors support for Invader and Fury(12Gb/s HBA).
  
  This Driver will create multiple MSI-x vector depending upon what FW expose.
  As of now 12 Gbp/s MR controller (Invader and Fury) expose 96 msix vector.
  As of now 6 Gbp/s MR controller (Thunderbolt) expose 16 msix vector.
  
  Reviewed by:  ambrisko
  MFC after:2 weeks
  Sponsored by: AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h
  head/sys/dev/mrsas/mrsas_cam.c

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Wed Oct  8 09:30:35 2014(r272738)
+++ head/sys/dev/mrsas/mrsas.c  Wed Oct  8 09:34:25 2014(r272739)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 
 /* 
@@ -67,6 +68,8 @@ static d_ioctl_tmrsas_ioctl;
 
 static struct mrsas_mgmt_info mrsas_mgmt_info;
 static struct mrsas_ident *mrsas_find_ident(device_t);
+static int mrsas_setup_msix(struct mrsas_softc *sc);
+static int mrsas_allocate_msix(struct mrsas_softc *sc);
 static void mrsas_shutdown_ctlr(struct mrsas_softc *sc, u_int32_t opcode);
 static void mrsas_flush_cache(struct mrsas_softc *sc);
 static void mrsas_reset_reply_desc(struct mrsas_softc *sc);
@@ -80,7 +83,7 @@ static int mrsas_setup_irq(struct mrsas_
 static int mrsas_alloc_mem(struct mrsas_softc *sc);
 static int mrsas_init_fw(struct mrsas_softc *sc);
 static int mrsas_setup_raidmap(struct mrsas_softc *sc);
-static int mrsas_complete_cmd(struct mrsas_softc *sc);
+static int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
 static int mrsas_clear_intr(struct mrsas_softc *sc);
 static int mrsas_get_ctrl_info(struct mrsas_softc *sc, 
   struct mrsas_ctrl_info *ctrl_info);
@@ -151,7 +154,6 @@ static int mrsas_alloc_evt_log_info_cmd(
 static void mrsas_free_evt_log_info_cmd(struct mrsas_softc *sc);
 SYSCTL_NODE(_hw, OID_AUTO, mrsas, CTLFLAG_RD, 0, "MRSAS Driver Parameters");
 
-
 /**
  * PCI device struct and table
  *
@@ -709,9 +711,64 @@ static int mrsas_start_aen(struct mrsas_
 
return mrsas_register_aen(sc, eli.newest_seq_num + 1,
class_locale.word);
+
 }
 
 /**
+ * mrsas_setup_msix:   Allocate MSI-x vectors
+ * @sc:Adapter soft state
+ */
+static int mrsas_setup_msix(struct mrsas_softc *sc)
+{
+   int i;
+   for (i = 0; i < sc->msix_vectors; i++) {
+   sc->irq_context[i].sc = sc;
+sc->irq_context[i].MSIxIndex = i;
+   sc->irq_id[i] = i + 1;
+   sc->mrsas_irq[i] = bus_alloc_resource_any
+   (sc->mrsas_dev, SYS_RES_IRQ, &sc->irq_id[i]
+, RF_ACTIVE);
+   if (sc->mrsas_irq[i] == NULL) {
+   device_printf(sc->mrsas_dev, "Can't allocate MSI-x\n");
+   goto irq_alloc_failed;
+   }
+   if (bus_setup_intr(sc->mrsas_dev,
+   sc->mrsas_irq[i],
+   INTR_MPSAFE|INTR_TYPE_CAM,
+   NULL, mrsas_isr, &sc->irq_context[i],
+   &sc->intr_handle[i])) {
+   device_printf(sc->mrsas_dev,
+   "Cannot set up MSI-x interrupt handler\n");
+   goto irq_alloc_failed;
+   }
+   }
+   return SUCCESS;
+
+irq_alloc_failed:
+   mrsas_teardown_intr(sc);
+   return (FAIL);
+}
+
+/**
+ * mrsas_allocate_msix:Setup MSI-x vectors
+ * @sc:Adapter soft state
+ */
+static int mrsas_allocate_msix(struct mrsas_softc *sc)
+{
+   if (pci_alloc_msix(sc->mrsas_dev, &sc->msix_vectors) == 0) {
+   device_printf(sc->mrsas_dev, "Using MSI-X with %d number"
+   " of vectors\n", sc->msix_vectors);
+   } else {
+   device_printf(sc->mrsas_dev, "MSI-x setup failed\n");
+   goto irq_alloc_failed;
+   }
+   return SUCCESS;
+
+irq_alloc_failed:
+   mrsas_teardown_intr(sc);
+   return (FAIL);
+}
+/**
  * mrsas_attach:PCI entry point
  * input:   device struct pointer 
  * 
@@ -784,6 +841,8 @@ static int mrsas_attach(device_t dev)
 sc->adprecovery = MRSAS_HBA_OPERATIONAL;
sc->UnevenSpanSupport = 0;
 
+sc->msix_enable = 0;
+
 /* Initialize Firmware */
 if (mrsas_init_fw(sc) != SUCCESS) {
 goto attach_fail_fw;
@@ -794,6 +853,7 @@ static int mrsas_attach(device_t dev)
 goto attach_fail_cam;
 }
 
+
 /* Register IRQs */
 if (mrsas_setup_irq(sc) != SUCCESS) {
 goto attach_fail_irq;
@@ -838,7 +898,9 @@ attach_fail_irq:
 attach_fail_cam:
 mrsas_cam_de

svn commit: r272740 - head/sys/dev/mrsas

2014-10-08 Thread Kashyap D Desai
Author: kadesai
Date: Wed Oct  8 09:35:52 2014
New Revision: 272740
URL: https://svnweb.freebsd.org/changeset/base/272740

Log:
  d_poll() callback function is the entry point for poll system call for the 
application.
  It is meant to notify the applications which will be waiting for some
  controller events to be occured.
  
  Reviewed by:  ambrisko
  MFC after:2 weeks
  Sponsored by: AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Wed Oct  8 09:34:25 2014(r272739)
+++ head/sys/dev/mrsas/mrsas.c  Wed Oct  8 09:35:52 2014(r272740)
@@ -65,6 +65,7 @@ static d_close_tmrsas_close;
 static d_read_t mrsas_read;
 static d_write_tmrsas_write;
 static d_ioctl_tmrsas_ioctl;
+static d_poll_tmrsas_poll;
 
 static struct mrsas_mgmt_info mrsas_mgmt_info;
 static struct mrsas_ident *mrsas_find_ident(device_t);
@@ -184,6 +185,7 @@ static struct cdevsw mrsas_cdevsw = {
 .d_read =   mrsas_read,
 .d_write =  mrsas_write,
 .d_ioctl =  mrsas_ioctl,
+.d_poll =  mrsas_poll,
 .d_name =   "mrsas",
 };
 
@@ -1265,6 +1267,36 @@ do_ioctl:
 }
 
 /**
+ * mrsas_poll:   poll entry point for mrsas driver fd
+ *
+ * This function is the entry point for poll from the OS.  It waits for
+ * some AEN events to be triggered from the controller and notifies back.
+ */
+static int
+mrsas_poll(struct cdev *dev, int poll_events, struct thread *td)
+{
+   struct mrsas_softc *sc;
+   int revents = 0;
+
+   sc = dev->si_drv1;
+
+   if (poll_events & (POLLIN | POLLRDNORM)) {
+   if (sc->mrsas_aen_triggered) {
+   revents |= poll_events & (POLLIN | POLLRDNORM);
+   }
+   }
+
+   if (revents == 0) {
+   if (poll_events & (POLLIN | POLLRDNORM)) {
+   sc->mrsas_poll_waiting = 1;
+   selrecord(td, &sc->mrsas_select);
+   }
+   }
+
+   return revents;
+}
+
+/**
  * mrsas_setup_irq:   Set up interrupt. 
  * input: Adapter instance soft state
  * 
@@ -3274,13 +3306,12 @@ mrsas_complete_mptmfi_passthru(struct mr
 mtx_unlock(&sc->raidmap_lock);
 break;
 }
-#if 0 //currently not supporting event handling, so commenting out
 if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_GET_INFO ||
 cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_GET) {
-mrsas_poll_wait_aen = 0;
+   sc->mrsas_aen_triggered = 0;
 }
-#endif
-/* See if got an event notification */
+
+   /* See if got an event notification */
 if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_WAIT)
 mrsas_complete_aen(sc, cmd);
 else
@@ -3967,7 +3998,11 @@ void mrsas_complete_aen(struct mrsas_sof
* Don't signal app if it is just an aborted previously registered aen
*/
if ((!cmd->abort_aen) && (sc->remove_in_progress == 0)) {
-   /* TO DO (?) */
+   sc->mrsas_aen_triggered = 1;
+   if (sc->mrsas_poll_waiting) {
+   sc->mrsas_poll_waiting = 0;
+   selwakeup(&sc->mrsas_select);
+   }
}
else
cmd->abort_aen = 0;

Modified: head/sys/dev/mrsas/mrsas.h
==
--- head/sys/dev/mrsas/mrsas.h  Wed Oct  8 09:34:25 2014(r272739)
+++ head/sys/dev/mrsas/mrsas.h  Wed Oct  8 09:35:52 2014(r272740)
@@ -2491,6 +2491,9 @@ struct mrsas_softc {
 struct mtx mfi_cmd_pool_lock; // lock for cmd pool linked list
 struct mtx raidmap_lock;  // lock for raid map access/update
 struct mtx aen_lock;  // aen lock
+struct selinfo mrsas_select; // poll select interface for 
application
+uint32_t mrsas_aen_triggered;
+uint32_t mrsas_poll_waiting;
 uint32_t   max_fw_cmds;   // Max commands from FW
 uint32_t   max_num_sge;   // Max number of SGEs
 struct resource*mrsas_irq[MAX_MSIX_COUNT];// interrupt 
interface window
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272741 - head/sys/dev/mrsas

2014-10-08 Thread Kashyap D Desai
Author: kadesai
Date: Wed Oct  8 09:37:47 2014
New Revision: 272741
URL: https://svnweb.freebsd.org/changeset/base/272741

Log:
  In the passthru IOCTL path, the mfi command pool was freely accessible N times
  where as there are limited number(32) of mfi commands in the pool.
  The mfi command pool is now restricted to 27 simultaneous accesses by using
  a counting semaphore while calling the passthru function.
  
  In the mrsas_cam.c source file there was a same function name mrsas_poll(),
  which was same as the mrsas_poll() implemented in the mrsas.c file for the
  polling interface.
  To clearly distinguish the functionality by usage we have renamed the former
  as mrsas_cam_poll().
  
  In the passthru function let's say it has got an mfi command from the pool
  but it has failed in one of the DMA function call which will lead to leak
  an mfi command because in the ERROR case it directly returns and not freeing 
up
  the occupied mfi command.
  
  Reviewed by:  ambrisko
  MFC after:2 weeks
  Sponsored by: AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h
  head/sys/dev/mrsas/mrsas_cam.c
  head/sys/dev/mrsas/mrsas_ioctl.c

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Wed Oct  8 09:35:52 2014(r272740)
+++ head/sys/dev/mrsas/mrsas.c  Wed Oct  8 09:37:47 2014(r272741)
@@ -823,6 +823,9 @@ static int mrsas_attach(device_t dev)
 mtx_init(&sc->mfi_cmd_pool_lock, "mrsas_mfi_cmd_pool_lock", NULL, MTX_DEF);
 mtx_init(&sc->raidmap_lock, "mrsas_raidmap_lock", NULL, MTX_DEF);
 
+/* Intialize a counting Semaphore to take care no. of concurrent IOCTLs */
+sema_init(&sc->ioctl_count_sema, MRSAS_MAX_MFI_CMDS-5, 
IOCTL_SEMA_DESCRIPTION);
+
 /* Intialize linked list */
 TAILQ_INIT(&sc->mrsas_mpt_cmd_list_head);
 TAILQ_INIT(&sc->mrsas_mfi_cmd_list_head);
@@ -912,6 +915,8 @@ attach_fail_fw:
 mtx_destroy(&sc->mpt_cmd_pool_lock);
 mtx_destroy(&sc->mfi_cmd_pool_lock);
 mtx_destroy(&sc->raidmap_lock);
+/* Destroy the counting semaphore created for Ioctl */
+sema_destroy(&sc->ioctl_count_sema);
 attach_fail:
 destroy_dev(sc->mrsas_cdev);
 if (sc->reg_res){
@@ -937,10 +942,13 @@ static int mrsas_detach(device_t dev)
 sc = device_get_softc(dev);
 sc->remove_in_progress = 1;
 
+/* Destroy the character device so no other IOCTL will be handled */
+destroy_dev(sc->mrsas_cdev);
+
 /*
  * Take the instance off the instance array. Note that we will not
  * decrement the max_index. We let this array be sparse array
-*/
+ */
 for (i = 0; i < mrsas_mgmt_info.max_index; i++) {
 if (mrsas_mgmt_info.sc_ptr[i] == sc) {
 mrsas_mgmt_info.count--;
@@ -984,13 +992,22 @@ static int mrsas_detach(device_t dev)
 mtx_destroy(&sc->mpt_cmd_pool_lock);
 mtx_destroy(&sc->mfi_cmd_pool_lock);
 mtx_destroy(&sc->raidmap_lock);
+
+/* Wait for all the semaphores to be released */
+while (sema_value(&sc->ioctl_count_sema) != (MRSAS_MAX_MFI_CMDS-5))
+pause("mr_shutdown", hz);
+
+/* Destroy the counting semaphore created for Ioctl */
+sema_destroy(&sc->ioctl_count_sema);
+
 if (sc->reg_res){
 bus_release_resource(sc->mrsas_dev,
  SYS_RES_MEMORY, sc->reg_res_id, sc->reg_res);
 }
-destroy_dev(sc->mrsas_cdev);
+
 if (sc->sysctl_tree != NULL)
 sysctl_ctx_free(&sc->sysctl_ctx);
+
 return (0);
 }
 
@@ -1254,13 +1271,21 @@ do_ioctl:
 #ifdef COMPAT_FREEBSD32
 case MRSAS_IOC_FIRMWARE_PASS_THROUGH32:
 #endif
+/* Decrement the Ioctl counting Semaphore before getting an mfi 
command */
+sema_wait(&sc->ioctl_count_sema);
+
 ret = mrsas_passthru(sc, (void *)arg, cmd);
+
+   /* Increment the Ioctl counting semaphore value */
+   sema_post(&sc->ioctl_count_sema);
+
 break;
 case MRSAS_IOC_SCAN_BUS:
 ret = mrsas_bus_scan(sc);
 break;
default:
mrsas_dprint(sc, MRSAS_TRACE, "IOCTL command 0x%lx is not 
handled\n", cmd);
+   ret = ENOENT;
 }
  
 return (ret);

Modified: head/sys/dev/mrsas/mrsas.h
==
--- head/sys/dev/mrsas/mrsas.h  Wed Oct  8 09:35:52 2014(r272740)
+++ head/sys/dev/mrsas/mrsas.h  Wed Oct  8 09:37:47 2014(r272741)
@@ -67,12 +67,16 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
+#define IOCTL_SEMA_DESCRIPTION "mrsas semaphore for MFI pool"
+
 /*
  * Device IDs and PCI
  */
@@ -2494,6 +2498,8 @@ struct mrsas_softc {
 struct selinfo mrsas_select; // poll select interface for 
application
 uint32_t mrsas_aen_triggered;
 uint32_t mrsas_poll_waiting;
+
+struct sem

svn commit: r272742 - head/sys/dev/mrsas

2014-10-08 Thread Kashyap D Desai
Author: kadesai
Date: Wed Oct  8 09:39:18 2014
New Revision: 272742
URL: https://svnweb.freebsd.org/changeset/base/272742

Log:
  Driver version upgrade.
  Bring head mrsas same as internal Phase 6.5.
  
  Reviewed by:  ambrisko
  MFC after:2 weeks
  Sponsored by: AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.h

Modified: head/sys/dev/mrsas/mrsas.h
==
--- head/sys/dev/mrsas/mrsas.h  Wed Oct  8 09:37:47 2014(r272741)
+++ head/sys/dev/mrsas/mrsas.h  Wed Oct  8 09:39:18 2014(r272742)
@@ -105,7 +105,7 @@ __FBSDID("$FreeBSD$");
  */
 #define BYTE_ALIGNMENT1 
 #define MRSAS_MAX_NAME_LENGTH 32  
-#define MRSAS_VERSION "06.704.01.01-fbsd"
+#define MRSAS_VERSION "06.705.10.00-fbsd"
 #define MRSAS_ULONG_MAX 0x
 #define MRSAS_DEFAULT_TIMEOUT 0x14 //temp 
 #define DONE 0
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272743 - head/sys/fs/autofs

2014-10-08 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Oct  8 09:44:02 2014
New Revision: 272743
URL: https://svnweb.freebsd.org/changeset/base/272743

Log:
  Simplify; no functional changes.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/fs/autofs/autofs.c

Modified: head/sys/fs/autofs/autofs.c
==
--- head/sys/fs/autofs/autofs.c Wed Oct  8 09:39:18 2014(r272742)
+++ head/sys/fs/autofs/autofs.c Wed Oct  8 09:44:02 2014(r272743)
@@ -367,7 +367,7 @@ autofs_trigger_one(struct autofs_node *a
char *key, *path;
int error = 0, request_error, last;
 
-   amp = VFSTOAUTOFS(anp->an_vnode->v_mount);
+   amp = anp->an_mount;
 
sx_assert(&autofs_softc->sc_lock, SA_XLOCKED);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r272738 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux

2014-10-08 Thread Steven Hartland
I thought it was convension to avoid using $FreeBSD$ in code comments instead use the __FBSDID e.g. 


#include 
__FBSDID("$FreeBSD$");
#include 

Could anyone confirm?

   Regards
   Steve

- Original Message - 
From: "Kashyap D Desai" 

To: ; ; 

Sent: Wednesday, October 08, 2014 10:30 AM
Subject: svn commit: r272738 - in head/sys: dev/mrsas modules/mrsas 
modules/mrsas/mrsas_linux



Author: kadesai
Date: Wed Oct  8 09:30:35 2014
New Revision: 272738
URL: https://svnweb.freebsd.org/changeset/base/272738

Log:
 Fix the minor svn add issue. $FreeBSD$ expands at the time of
 snv add, so I have added $FreeBSD$ as comment.
 
 This commit is contininous of last mrsas commit, so that compilation

 does not break.
 
 Obtained from: AVAGO Technologies

 MFC after: 2 weeks

Modified:
 head/sys/dev/mrsas/mrsas_linux.c
 head/sys/modules/mrsas/Makefile
 head/sys/modules/mrsas/mrsas_linux/Makefile

Modified: head/sys/dev/mrsas/mrsas_linux.c
==
--- head/sys/dev/mrsas/mrsas_linux.c Wed Oct  8 09:19:35 2014 (r272737)
+++ head/sys/dev/mrsas/mrsas_linux.c Wed Oct  8 09:30:35 2014 (r272738)
@@ -39,10 +39,10 @@
 * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035
 *ATTN: MegaRaid FreeBSD
 *
+ * $FreeBSD$
 */

#include 
-

#include 
#include 

Modified: head/sys/modules/mrsas/Makefile
==
--- head/sys/modules/mrsas/Makefile Wed Oct  8 09:19:35 2014 (r272737)
+++ head/sys/modules/mrsas/Makefile Wed Oct  8 09:30:35 2014 (r272738)
@@ -1,5 +1,5 @@
# Makefile for mrsas driver
-
+# $FreeBSD$

KMOD=mrsas
.PATH: ${.CURDIR}/../../dev/${KMOD}

Modified: head/sys/modules/mrsas/mrsas_linux/Makefile
==
--- head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct  8 09:19:35 2014 
(r272737)
+++ head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct  8 09:30:35 2014 
(r272738)
@@ -1,5 +1,5 @@
# Makefile for mrsas driver
-
+# $FreeBSD$

.PATH: ${.CURDIR}/../../../dev/mrsas




___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272744 - head/sys/dev/mrsas

2014-10-08 Thread Kashyap D Desai
Author: kadesai
Date: Wed Oct  8 10:14:37 2014
New Revision: 272744
URL: https://svnweb.freebsd.org/changeset/base/272744

Log:
  No logical code change in this pathc.
  Only Style 9 changes for mrsas driver.
  
  Reviewed by:  ambrisko
  MFC after:2 weeks
  Sponsored by: AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h
  head/sys/dev/mrsas/mrsas_cam.c
  head/sys/dev/mrsas/mrsas_fp.c
  head/sys/dev/mrsas/mrsas_ioctl.c
  head/sys/dev/mrsas/mrsas_ioctl.h
  head/sys/dev/mrsas/mrsas_linux.c

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Wed Oct  8 09:44:02 2014(r272743)
+++ head/sys/dev/mrsas/mrsas.c  Wed Oct  8 10:14:37 2014(r272744)
@@ -1,43 +1,38 @@
 /*
- * Copyright (c) 2014, LSI Corp.
- * All rights reserved.
- * Author: Marian Choy
+ * Copyright (c) 2014, LSI Corp. All rights reserved. Author: Marian Choy
  * Support: freebsdr...@lsi.com
  *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * 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.
- * 3. Neither the name of the  nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
- *
- * 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 MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDER 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
+ * 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. 3. Neither the name of the
+ *  nor the names of its contributors may be used to endorse or
+ * promote products derived from this software without specific prior written
+ * permission.
+ *
+ * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
  *
- * The views and conclusions contained in the software and documentation
- * are those of the authors and should not be interpreted as representing
+ * The views and conclusions contained in the software and documentation are
+ * those of the authors and should not be interpreted as representing
  * official policies,either expressed or implied, of the FreeBSD Project.
  *
- * Send feedback to: 
- * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035
- *ATTN: MegaRaid FreeBSD
+ * Send feedback to:  Mail to: LSI Corporation, 1621
+ * Barber Lane, Milpitas, CA 95035 ATTN: MegaRaid FreeBSD
  *
  */
 
@@ -57,15 +52,15 @@ __FBSDID("$FreeBSD$");
 #include 
 
 
-/* 
- * Function prototypes 
+/*
+ * Function prototypes
  */
-static d_open_t mrsas_open;
-static d_close_tmrsas_close;
-static d_read_t mrsas_read;
-static d_write_tmrsas_write;
-static d_ioctl_tmrsas_ioctl;
-static d_poll_tmrsas_poll;
+static d_open_t mrsas_open;
+static d_close_t mrsas_close;
+static d_read_t mrsas_read;
+static d_wr

svn commit: r272746 - head/sys/geom

2014-10-08 Thread Andrey V. Elsukov
Author: ae
Date: Wed Oct  8 12:18:16 2014
New Revision: 272746
URL: https://svnweb.freebsd.org/changeset/base/272746

Log:
  Add an ability to set dumpdev via loader(8) tunable.
  
  MFC after:3 weeks

Modified:
  head/sys/geom/geom_dev.c

Modified: head/sys/geom/geom_dev.c
==
--- head/sys/geom/geom_dev.cWed Oct  8 11:12:14 2014(r272745)
+++ head/sys/geom/geom_dev.cWed Oct  8 12:18:16 2014(r272746)
@@ -82,6 +82,8 @@ static struct cdevsw g_dev_cdevsw = {
.d_flags =  D_DISK | D_TRACKCLOSE,
 };
 
+static g_init_t g_dev_init;
+static g_fini_t g_dev_fini;
 static g_taste_t g_dev_taste;
 static g_orphan_t g_dev_orphan;
 static g_attrchanged_t g_dev_attrchanged;
@@ -89,6 +91,8 @@ static g_attrchanged_t g_dev_attrchanged
 static struct g_class g_dev_class  = {
.name = "DEV",
.version = G_VERSION,
+   .init = g_dev_init,
+   .fini = g_dev_fini,
.taste = g_dev_taste,
.orphan = g_dev_orphan,
.attrchanged = g_dev_attrchanged
@@ -107,6 +111,58 @@ SYSCTL_QUAD(_kern_geom_dev, OID_AUTO, de
 "delete request sent to the provider. Larger requests are chunked "
 "so they can be interrupted. (0 = disable chunking)");
 
+static char *dumpdev = NULL;
+static void
+g_dev_init(struct g_class *mp)
+{
+
+   dumpdev = getenv("dumpdev");
+}
+
+static void
+g_dev_fini(struct g_class *mp)
+{
+
+   freeenv(dumpdev);
+}
+
+static int
+g_dev_setdumpdev(struct cdev *dev)
+{
+   struct g_kerneldump kd;
+   struct g_consumer *cp;
+   int error, len;
+
+   if (dev == NULL)
+   return (set_dumper(NULL, NULL));
+
+   cp = dev->si_drv2;
+   len = sizeof(kd);
+   kd.offset = 0;
+   kd.length = OFF_MAX;
+   error = g_io_getattr("GEOM::kerneldump", cp, &len, &kd);
+   if (error == 0) {
+   error = set_dumper(&kd.di, devtoname(dev));
+   if (error == 0)
+   dev->si_flags |= SI_DUMPDEV;
+   }
+   return (error);
+}
+
+static void
+init_dumpdev(struct cdev *dev)
+{
+
+   if (dumpdev == NULL)
+   return;
+   if (strcmp(devtoname(dev), dumpdev) != 0)
+   return;
+   if (g_dev_setdumpdev(dev) == 0) {
+   freeenv(dumpdev);
+   dumpdev = NULL;
+   }
+}
+
 static void
 g_dev_destroy(void *arg, int flags __unused)
 {
@@ -261,10 +317,12 @@ g_dev_taste(struct g_class *mp, struct g
 
dev->si_iosize_max = MAXPHYS;
dev->si_drv2 = cp;
+   init_dumpdev(dev);
if (adev != NULL) {
adev->si_iosize_max = MAXPHYS;
adev->si_drv2 = cp;
adev->si_flags |= SI_UNMAPPED;
+   init_dumpdev(adev);
}
 
g_dev_attrchanged(cp, "GEOM::physpath");
@@ -358,7 +416,6 @@ g_dev_ioctl(struct cdev *dev, u_long cmd
 {
struct g_consumer *cp;
struct g_provider *pp;
-   struct g_kerneldump kd;
off_t offset, length, chunk;
int i, error;
 
@@ -395,19 +452,10 @@ g_dev_ioctl(struct cdev *dev, u_long cmd
error = g_io_getattr("GEOM::frontstuff", cp, &i, data);
break;
case DIOCSKERNELDUMP:
-   if (*(u_int *)data == 0) {
-   error = set_dumper(NULL, NULL);
-   break;
-   }
-   kd.offset = 0;
-   kd.length = OFF_MAX;
-   i = sizeof kd;
-   error = g_io_getattr("GEOM::kerneldump", cp, &i, &kd);
-   if (error == 0) {
-   error = set_dumper(&kd.di, devtoname(dev));
-   if (error == 0)
-   dev->si_flags |= SI_DUMPDEV;
-   }
+   if (*(u_int *)data == 0)
+   error = g_dev_setdumpdev(NULL);
+   else
+   error = g_dev_setdumpdev(dev);
break;
case DIOCGFLUSH:
error = g_io_flush(cp);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272747 - head/sbin/dumpon

2014-10-08 Thread Andrey V. Elsukov
Author: ae
Date: Wed Oct  8 12:19:48 2014
New Revision: 272747
URL: https://svnweb.freebsd.org/changeset/base/272747

Log:
  Revert r156046. We support setting dumpdev via loader tunable again.
  Also change default disk name to ada.
  
  MFC after:3 weeks

Modified:
  head/sbin/dumpon/dumpon.8

Modified: head/sbin/dumpon/dumpon.8
==
--- head/sbin/dumpon/dumpon.8   Wed Oct  8 12:18:16 2014(r272746)
+++ head/sbin/dumpon/dumpon.8   Wed Oct  8 12:19:48 2014(r272747)
@@ -28,7 +28,7 @@
 .\" From: @(#)swapon.8 8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd April 29, 2013
+.Dd October 8, 2014
 .Dt DUMPON 8
 .Os
 .Sh NAME
@@ -124,9 +124,18 @@ performs a
 on
 .Pa /dev/null
 and thus instructs the kernel not to save crash dumps.
+.Pp
+Since
+.Nm
+cannot be used during kernel initialization, the
+.Va dumpdev
+variable of
+.Xr loader 8
+must be used to enable dumps for system panics which occur
+during kernel initialization.
 .Sh FILES
-.Bl -tag -width "/dev/{ad,da}?s?b" -compact
-.It Pa /dev/{ad,da}?s?b
+.Bl -tag -width "/dev/{ada,da}?s?b" -compact
+.It Pa /dev/{ada,da}?s?b
 standard swap areas
 .It Pa /etc/rc.conf
 boot-time system configuration
@@ -136,6 +145,7 @@ boot-time system configuration
 .Xr rc.conf 5 ,
 .Xr config 8 ,
 .Xr init 8 ,
+.Xr loader 8 ,
 .Xr rc 8 ,
 .Xr savecore 8 ,
 .Xr swapon 8 ,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272748 - in head: sys/cam/ctl usr.sbin/ctladm

2014-10-08 Thread Alexander Motin
Author: mav
Date: Wed Oct  8 12:24:24 2014
New Revision: 272748
URL: https://svnweb.freebsd.org/changeset/base/272748

Log:
  Implement software (mode page) and hardware (config) write protection.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_private.h
  head/usr.sbin/ctladm/ctladm.8

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Wed Oct  8 12:19:48 2014(r272747)
+++ head/sys/cam/ctl/ctl.c  Wed Oct  8 12:24:24 2014(r272748)
@@ -293,7 +293,7 @@ static struct scsi_control_page control_
/*page_length*/sizeof(struct scsi_control_page) - 2,
/*rlec*/SCP_DSENSE,
/*queue_flags*/SCP_QUEUE_ALG_MASK,
-   /*eca_and_aen*/0,
+   /*eca_and_aen*/SCP_SWP,
/*flags4*/0,
/*aen_holdoff_period*/{0, 0},
/*busy_timeout_period*/{0, 0},
@@ -4447,7 +4447,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
struct ctl_port *port;
struct scsi_vpd_id_descriptor *desc;
struct scsi_vpd_id_t10 *t10id;
-   const char *eui, *naa, *scsiname, *vendor;
+   const char *eui, *naa, *scsiname, *vendor, *value;
int lun_number, i, lun_malloced;
int devidlen, idlen1, idlen2 = 0, len;
 
@@ -4609,6 +4609,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
if (be_lun->flags & CTL_LUN_FLAG_PRIMARY)
lun->flags |= CTL_LUN_PRIMARY_SC;
 
+   value = ctl_get_opt(&be_lun->options, "readonly");
+   if (value != NULL && strcmp(value, "on") == 0)
+   lun->flags |= CTL_LUN_READONLY;
+
lun->ctl_softc = ctl_softc;
TAILQ_INIT(&lun->ooa_queue);
TAILQ_INIT(&lun->blocked_queue);
@@ -6219,6 +6223,14 @@ ctl_control_page_handler(struct ctl_scsi
saved_cp->queue_flags |= user_cp->queue_flags & 
SCP_QUEUE_ALG_MASK;
set_ua = 1;
}
+   if ((current_cp->eca_and_aen & SCP_SWP) !=
+   (user_cp->eca_and_aen & SCP_SWP)) {
+   current_cp->eca_and_aen &= ~SCP_SWP;
+   current_cp->eca_and_aen |= user_cp->eca_and_aen & SCP_SWP;
+   saved_cp->eca_and_aen &= ~SCP_SWP;
+   saved_cp->eca_and_aen |= user_cp->eca_and_aen & SCP_SWP;
+   set_ua = 1;
+   }
if (set_ua != 0) {
int i;
/*
@@ -7045,8 +7057,13 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
header = (struct scsi_mode_hdr_6 *)ctsio->kern_data_ptr;
 
header->datalen = ctl_min(total_len - 1, 254);
-   if (control_dev == 0)
+   if (control_dev == 0) {
header->dev_specific = 0x10; /* DPOFUA */
+   if ((lun->flags & CTL_LUN_READONLY) ||
+   (lun->mode_pages.control_page[CTL_PAGE_CURRENT]
+   .eca_and_aen & SCP_SWP) != 0)
+   header->dev_specific |= 0x80; /* WP */
+   }
if (dbd)
header->block_descr_len = 0;
else
@@ -7063,8 +7080,13 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 
datalen = ctl_min(total_len - 2, 65533);
scsi_ulto2b(datalen, header->datalen);
-   if (control_dev == 0)
+   if (control_dev == 0) {
header->dev_specific = 0x10; /* DPOFUA */
+   if ((lun->flags & CTL_LUN_READONLY) ||
+   (lun->mode_pages.control_page[CTL_PAGE_CURRENT]
+   .eca_and_aen & SCP_SWP) != 0)
+   header->dev_specific |= 0x80; /* WP */
+   }
if (dbd)
scsi_ulto2b(0, header->block_descr_len);
else
@@ -11313,6 +11335,24 @@ ctl_scsiio_lun_check(struct ctl_softc *c
}
 #endif
 
+   if (entry->pattern & CTL_LUN_PAT_WRITE) {
+   if (lun->flags & CTL_LUN_READONLY) {
+   ctl_set_sense(ctsio, /*current_error*/ 1,
+   /*sense_key*/ SSD_KEY_DATA_PROTECT,
+   /*asc*/ 0x27, /*ascq*/ 0x01, SSD_ELEM_NONE);
+   retval = 1;
+   goto bailout;
+   }
+   if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT]
+   .eca_and_aen & SCP_SWP) != 0) {
+   ctl_set_sense(ctsio, /*current_error*/ 1,
+   /*sense_key*/ SSD_KEY_DATA_PROTECT,
+   /*asc*/ 0x27, /*ascq*/ 0x02, SSD_ELEM_NONE);
+   retval = 1;
+   goto bailout;
+   }
+   }
+
/*
 * Check for a reservation conflict.  If this command isn't allowed
 * even on reserved LUNs, and if this initiator isn't the one who

Modified: head/sys/cam/ctl/ctl_private.h

svn commit: r272749 - head/sys/boot/common

2014-10-08 Thread Andrey V. Elsukov
Author: ae
Date: Wed Oct  8 12:33:31 2014
New Revision: 272749
URL: https://svnweb.freebsd.org/changeset/base/272749

Log:
  Fix comment.
  
  MFC after:1 week

Modified:
  head/sys/boot/common/disk.h

Modified: head/sys/boot/common/disk.h
==
--- head/sys/boot/common/disk.h Wed Oct  8 12:24:24 2014(r272748)
+++ head/sys/boot/common/disk.h Wed Oct  8 12:33:31 2014(r272749)
@@ -43,12 +43,12 @@
  * BSD disklabel partition within an MBR slice:
  *
  * d_slice = MBR slice number (typically 1..4)
- * d_partition = disklabel partition (typically 0..7)
+ * d_partition = disklabel partition (typically 0..19)
  *
  * BSD disklabel partition on the true dedicated disk:
  *
  * d_slice = -1
- * d_partition = disklabel partition (typically 0..7)
+ * d_partition = disklabel partition (typically 0..19)
  *
  * GPT partition:
  *
@@ -71,7 +71,7 @@
  * if there are multiple slices/partitions of a given type, the first one
  * is chosen.
  *
- * The low-level disk device will typically call slice_open() from its open
+ * The low-level disk device will typically call disk_open() from its open
  * method to interpret the disk partition tables according to the rules above.
  * This will initialize d_offset to the block offset of the start of the
  * selected partition - this offset should be added to the offset passed to
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r272738 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux

2014-10-08 Thread John Baldwin
On Wednesday, October 08, 2014 10:50:47 AM Steven Hartland wrote:
> I thought it was convension to avoid using $FreeBSD$ in code comments
> instead use the __FBSDID e.g.
> 
> #include 
> __FBSDID("$FreeBSD$");
> #include 
> 
> Could anyone confirm?
> 
> Regards
> Steve


Yes, C files use __FBSDID().  I believe headers use a bare $FreeBSD$ comment 
after the license block.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272750 - head/sys/netinet

2014-10-08 Thread Michael Tuexen
Author: tuexen
Date: Wed Oct  8 15:29:49 2014
New Revision: 272750
URL: https://svnweb.freebsd.org/changeset/base/272750

Log:
  Ensure that the number of stream reported in srs_number_streams is
  consistent with the amount of data provided in the SCTP_RESET_STREAMS
  socket option.
  Thanks to Peter Bostroem from Google for drawing my attention to
  this part of the code.

Modified:
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Wed Oct  8 12:33:31 2014
(r272749)
+++ head/sys/netinet/sctp_usrreq.c  Wed Oct  8 15:29:49 2014
(r272750)
@@ -4431,6 +4431,12 @@ sctp_setopt(struct socket *so, int optna
SCTP_TCB_UNLOCK(stcb);
break;
}
+   if (sizeof(struct sctp_reset_streams) +
+   strrst->srs_number_streams * sizeof(uint16_t) > 
optsize) {
+   error = EINVAL;
+   SCTP_TCB_UNLOCK(stcb);
+   break;
+   }
if (stcb->asoc.stream_reset_outstanding) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EALREADY);
error = EALREADY;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272751 - head/sys/netinet

2014-10-08 Thread Michael Tuexen
Author: tuexen
Date: Wed Oct  8 15:30:59 2014
New Revision: 272751
URL: https://svnweb.freebsd.org/changeset/base/272751

Log:
  Ensure that the list of streams sent in a stream reset parameter fits
  in an mbuf-cluster.
  Thanks to Peter Bostroem for drawing my attention to this part of the code.

Modified:
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_output.h

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Wed Oct  8 15:29:49 2014
(r272750)
+++ head/sys/netinet/sctp_output.c  Wed Oct  8 15:30:59 2014
(r272751)
@@ -11846,7 +11846,7 @@ sctp_add_an_in_stream(struct sctp_tmit_c
 
 int
 sctp_send_str_reset_req(struct sctp_tcb *stcb,
-int number_entries, uint16_t * list,
+uint16_t number_entries, uint16_t * list,
 uint8_t send_out_req,
 uint8_t send_in_req,
 uint8_t send_tsn_req,
@@ -11879,6 +11879,14 @@ sctp_send_str_reset_req(struct sctp_tcb 
SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, 
EINVAL);
return (EINVAL);
}
+   if (number_entries > (MCLBYTES -
+   SCTP_MIN_OVERHEAD -
+   sizeof(struct sctp_chunkhdr) -
+   sizeof(struct sctp_stream_reset_out_request)) /
+   sizeof(uint16_t)) {
+   SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, 
ENOMEM);
+   return (ENOMEM);
+   }
sctp_alloc_a_chunk(stcb, chk);
if (chk == NULL) {
SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, 
ENOMEM);

Modified: head/sys/netinet/sctp_output.h
==
--- head/sys/netinet/sctp_output.h  Wed Oct  8 15:29:49 2014
(r272750)
+++ head/sys/netinet/sctp_output.h  Wed Oct  8 15:30:59 2014
(r272751)
@@ -181,8 +181,8 @@ sctp_add_stream_reset_result_tsn(struct 
 uint32_t, uint32_t, uint32_t, uint32_t);
 
 int
-sctp_send_str_reset_req(struct sctp_tcb *, int, uint16_t *, uint8_t, uint8_t,
-uint8_t, uint8_t, uint16_t, uint16_t, uint8_t);
+sctp_send_str_reset_req(struct sctp_tcb *, uint16_t, uint16_t *, uint8_t,
+uint8_t, uint8_t, uint8_t, uint16_t, uint16_t, uint8_t);
 
 void
 sctp_send_abort(struct mbuf *, int, struct sockaddr *, struct sockaddr *,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r272738 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux

2014-10-08 Thread Bjoern A. Zeeb

On 08 Oct 2014, at 09:30 , Kashyap D Desai  wrote:

> Author: kadesai
> Date: Wed Oct  8 09:30:35 2014
> New Revision: 272738
> URL: https://svnweb.freebsd.org/changeset/base/272738
> 
> Log:
>  Fix the minor svn add issue. $FreeBSD$ expands at the time of
>  snv add, so I have added $FreeBSD$ as comment.
> 
>  This commit is contininous of last mrsas commit, so that compilation
>  does not break.
> 

So i386.XEN seems broken when I do a universe currently;  could you check?

In file included from 
/scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/mrsas_linux.c:66:
@/dev/mrsas/mrsas.h:516:3: error: typedef redefinition with different types 
('struct atomic_t' vs 'struct atomic_t')
} atomic_t;
  ^
./machine/xen/xen-os.h:157:42: note: previous definition is here
typedef struct { volatile int counter; } atomic_t;
 ^
In file included from 
/scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/mrsas_linux.c:66:
@/dev/mrsas/mrsas.h:2580:1: error: redefinition of 'clear_bit'
clear_bit(int b, volatile void *p)
^
./machine/xen/xen-os.h:258:24: note: previous definition is here
static __inline__ void clear_bit(int nr, volatile void * addr)
   ^
In file included from 
/scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/mrsas_linux.c:66:
@/dev/mrsas/mrsas.h:2586:1: error: redefinition of 'set_bit'
set_bit(int b, volatile void *p)
^
./machine/xen/xen-os.h:240:24: note: previous definition is here
static __inline__ void set_bit(int nr, volatile void * addr)
   ^
In file included from 
/scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/mrsas_linux.c:66:
@/dev/mrsas/mrsas.h:2592:1: error: expected ')'
test_bit(int b, volatile void *p)
^
./machine/xen/xen-os.h:225:27: note: expanded from macro 'test_bit'
(__builtin_constant_p(nr) ? \
  ^
@/dev/mrsas/mrsas.h:2592:1: note: to match this '('
./machine/xen/xen-os.h:224:27: note: expanded from macro 'test_bit'
#define test_bit(nr,addr) \
  ^
In file included from 
/scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/mrsas_linux.c:66:
@/dev/mrsas/mrsas.h:2592:1: error: static declaration of '__builtin_constant_p' 
follows non-static declaration
test_bit(int b, volatile void *p)
^
./machine/xen/xen-os.h:225:2: note: expanded from macro 'test_bit'
(__builtin_constant_p(nr) ? \
 ^
./x86/endian.h:122:10: note: previous implicit declaration is here
return (__bswap64_gen(_x));
^
./x86/endian.h:70:16: note: expanded from macro '__bswap64_gen'
(((__uint64_t)__bswap32((x) & 0x) << 32) | __bswap32((x) >> 32))
  ^
./x86/endian.h:77:3: note: expanded from macro '__bswap32'
(__builtin_constant_p(x) ?  \
 ^
In file included from 
/scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/mrsas_linux.c:66:
@/dev/mrsas/mrsas.h:2592:1: error: definition of builtin function 
'__builtin_constant_p'
test_bit(int b, volatile void *p)
^
./machine/xen/xen-os.h:225:2: note: expanded from macro 'test_bit'
(__builtin_constant_p(nr) ? \
 ^
In file included from 
/scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/mrsas_linux.c:66:
@/dev/mrsas/mrsas.h:2594:26: error: use of undeclared identifier 'p'
return ((volatile int *)p)[b >> 5] & (1 << (b & 0x1f));
^
7 errors generated.
--- mrsas_linux.o ---
*** [mrsas_linux.o] Error code 1










>  Obtained from:   AVAGO Technologies
>  MFC after: 2 weeks
> 
> Modified:
>  head/sys/dev/mrsas/mrsas_linux.c
>  head/sys/modules/mrsas/Makefile
>  head/sys/modules/mrsas/mrsas_linux/Makefile
> 
> Modified: head/sys/dev/mrsas/mrsas_linux.c
> ==
> --- head/sys/dev/mrsas/mrsas_linux.c  Wed Oct  8 09:19:35 2014
> (r272737)
> +++ head/sys/dev/mrsas/mrsas_linux.c  Wed Oct  8 09:30:35 2014
> (r272738)
> @@ -39,10 +39,10 @@
>  * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035
>  *ATTN: MegaRaid FreeBSD
>  *
> + * $FreeBSD$
>  */
> 
> #include 
> -
> 
> #include 
> #include 
> 
> Modified: head/sys/modules/mrsas/Makefile
> ==
> --- head/sys/modules/mrsas/Makefile   Wed Oct  8 09:19:35 2014
> (r272737)
> +++ head/sys/modules/mrsas/Makefile   Wed Oct  8 09:30:35 2014
> (r272738)
> @@ -1,5 +1,5 @@
> # Makefile for mrsas driver
> -
> +# $FreeBSD$
> 
> KMOD=mrsas
> .PATH: ${.CURDIR}/../../dev/${KMOD}
> 
> Modified: head/sys/modules/mrsas/mrsas_linux/Makefile
> ==
> --- head/sys/modules/mrsas/mrsas_linux/Makefile   Wed Oct  8 09:19:35 
> 2014(r272737)
> +++ head/sys/modules/mrsas/mrsas_linux/Makefile 

svn commit: r272756 - head/sys/dev/mpr

2014-10-08 Thread Alexander Motin
Author: mav
Date: Wed Oct  8 16:22:26 2014
New Revision: 272756
URL: https://svnweb.freebsd.org/changeset/base/272756

Log:
  Properly report 12Gbps connection rate.
  
  Reviewed by:  kadesai, slm
  MFC after:1 week

Modified:
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mpr/mpr_table.c

Modified: head/sys/dev/mpr/mpr_sas.c
==
--- head/sys/dev/mpr/mpr_sas.c  Wed Oct  8 15:58:28 2014(r272755)
+++ head/sys/dev/mpr/mpr_sas.c  Wed Oct  8 16:22:26 2014(r272756)
@@ -1043,6 +1043,9 @@ mprsas_action(struct cam_sim *sim, union
case 0x0a:
sas->bitrate = 60;
break;
+   case 0x0b:
+   sas->bitrate = 120;
+   break;
default:
sas->valid = 0;
}

Modified: head/sys/dev/mpr/mpr_table.c
==
--- head/sys/dev/mpr/mpr_table.cWed Oct  8 15:58:28 2014
(r272755)
+++ head/sys/dev/mpr/mpr_table.cWed Oct  8 16:22:26 2014
(r272756)
@@ -118,6 +118,7 @@ struct mpr_table_lookup mpr_linkrate_nam
{"1.5Gbps", 0x08},
{"3.0Gbps", 0x09},
{"6.0Gbps", 0x0a},
+   {"12.0Gbps",0x0b},
{NULL, 0},
{"LinkRate Unknown",0x00}
 };
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272757 - in head: sys/kern tools/sched

2014-10-08 Thread John Baldwin
Author: jhb
Date: Wed Oct  8 16:22:59 2014
New Revision: 272757
URL: https://svnweb.freebsd.org/changeset/base/272757

Log:
  Add schedgraph traces for callout handlers.  Specifically, a callwheel logs
  a running event each time it executes a callout function.  The event
  includes the function pointer, argument, and whether or not it was run from
  hardware interrupt context.  The callwheel is marked idle when each handler
  completes.  This effectively logs the duration of each callout routine in
  the graph.

Modified:
  head/sys/kern/kern_timeout.c
  head/tools/sched/schedgraph.py

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cWed Oct  8 16:22:26 2014
(r272756)
+++ head/sys/kern/kern_timeout.cWed Oct  8 16:22:59 2014
(r272757)
@@ -163,6 +163,7 @@ struct callout_cpu {
sbintime_t  cc_lastscan;
void*cc_cookie;
u_int   cc_bucket;
+   charcc_ktr_event_name[20];
 };
 
 #definecc_exec_currcc_exec_entity[0].cc_curr
@@ -201,7 +202,7 @@ struct callout_cpu cc_cpu;
 
 static int timeout_cpu;
 
-static voidcallout_cpu_init(struct callout_cpu *cc);
+static voidcallout_cpu_init(struct callout_cpu *cc, int cpu);
 static voidsoftclock_call_cc(struct callout *c, struct callout_cpu *cc,
 #ifdef CALLOUT_PROFILING
int *mpcalls, int *lockcalls, int *gcalls,
@@ -302,7 +303,7 @@ callout_callwheel_init(void *dummy)
cc = CC_CPU(timeout_cpu);
cc->cc_callout = malloc(ncallout * sizeof(struct callout),
M_CALLOUT, M_WAITOK);
-   callout_cpu_init(cc);
+   callout_cpu_init(cc, timeout_cpu);
 }
 SYSINIT(callwheel_init, SI_SUB_CPU, SI_ORDER_ANY, callout_callwheel_init, 
NULL);
 
@@ -310,7 +311,7 @@ SYSINIT(callwheel_init, SI_SUB_CPU, SI_O
  * Initialize the per-cpu callout structures.
  */
 static void
-callout_cpu_init(struct callout_cpu *cc)
+callout_cpu_init(struct callout_cpu *cc, int cpu)
 {
struct callout *c;
int i;
@@ -325,6 +326,8 @@ callout_cpu_init(struct callout_cpu *cc)
cc->cc_firstevent = SBT_MAX;
for (i = 0; i < 2; i++)
cc_cce_cleanup(cc, i);
+   snprintf(cc->cc_ktr_event_name, sizeof(cc->cc_ktr_event_name),
+   "callwheel cpu %d", cpu);
if (cc->cc_callout == NULL) /* Only cpu0 handles timeout(9) */
return;
for (i = 0; i < ncallout; i++) {
@@ -396,7 +399,7 @@ start_softclock(void *dummy)
continue;
cc = CC_CPU(cpu);
cc->cc_callout = NULL;  /* Only cpu0 handles timeout(9). */
-   callout_cpu_init(cc);
+   callout_cpu_init(cc, cpu);
snprintf(name, sizeof(name), "clock (%d)", cpu);
ie = NULL;
if (swi_add(&ie, name, softclock, cc, SWI_CLOCK,
@@ -711,6 +714,8 @@ softclock_call_cc(struct callout *c, str
CTR3(KTR_CALLOUT, "callout %p func %p arg %p",
c, c_func, c_arg);
}
+   KTR_STATE3(KTR_SCHED, "callout", cc->cc_ktr_event_name, "running",
+   "func:%p", c_func, "arg:%p", c_arg, "direct:%d", direct);
 #if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING)
sbt1 = sbinuptime();
 #endif
@@ -733,6 +738,7 @@ softclock_call_cc(struct callout *c, str
lastfunc = c_func;
}
 #endif
+   KTR_STATE0(KTR_SCHED, "callout", cc->cc_ktr_event_name, "idle");
CTR1(KTR_CALLOUT, "callout %p finished", c);
if ((c_flags & CALLOUT_RETURNUNLOCKED) == 0)
class->lc_unlock(c_lock);

Modified: head/tools/sched/schedgraph.py
==
--- head/tools/sched/schedgraph.py  Wed Oct  8 16:22:26 2014
(r272756)
+++ head/tools/sched/schedgraph.py  Wed Oct  8 16:22:59 2014
(r272757)
@@ -80,8 +80,6 @@ eventcolors = [
("runq rem","yellow"),
("thread exit", "grey"),
("proc exit",   "grey"),
-   ("callwheel idle", "grey"),
-   ("callout running", "green"),
("lock acquire", "blue"),
("lock contest", "purple"),
("failed lock try", "red"),
@@ -903,7 +901,6 @@ class KTRFile:
self.timestamp_f = None
self.timestamp_l = None
self.locks = {}
-   self.callwheels = {}
self.ticks = {}
self.load = {}
self.crit = {}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272761 - in head/sys: amd64/amd64 amd64/include dev/drm2/i915 i386/i386 i386/include

2014-10-08 Thread Konstantin Belousov
Author: kib
Date: Wed Oct  8 16:48:03 2014
New Revision: 272761
URL: https://svnweb.freebsd.org/changeset/base/272761

Log:
  Add an argument to the x86 pmap_invalidate_cache_range() to request
  forced invalidation of the cache range regardless of the presence of
  self-snoop feature.  Some recent Intel GPUs in some modes are not
  coherent, and dirty lines in CPU cache must be flushed before the
  pages are transferred to GPU domain.
  
  Reviewed by:  alc (previous version)
  Tested by:pho (amd64)
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/include/pmap.h
  head/sys/dev/drm2/i915/intel_ringbuffer.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/i386/include/pmap.h

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Wed Oct  8 16:35:57 2014(r272760)
+++ head/sys/amd64/amd64/pmap.c Wed Oct  8 16:48:03 2014(r272761)
@@ -1710,16 +1710,20 @@ pmap_update_pde(pmap_t pmap, vm_offset_t
 #define PMAP_CLFLUSH_THRESHOLD   (2 * 1024 * 1024)
 
 void
-pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva)
+pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva, boolean_t force)
 {
 
-   KASSERT((sva & PAGE_MASK) == 0,
-   ("pmap_invalidate_cache_range: sva not page-aligned"));
-   KASSERT((eva & PAGE_MASK) == 0,
-   ("pmap_invalidate_cache_range: eva not page-aligned"));
+   if (force) {
+   sva &= ~(vm_offset_t)cpu_clflush_line_size;
+   } else {
+   KASSERT((sva & PAGE_MASK) == 0,
+   ("pmap_invalidate_cache_range: sva not page-aligned"));
+   KASSERT((eva & PAGE_MASK) == 0,
+   ("pmap_invalidate_cache_range: eva not page-aligned"));
+   }
 
-   if (cpu_feature & CPUID_SS)
-   ; /* If "Self Snoop" is supported, do nothing. */
+   if ((cpu_feature & CPUID_SS) != 0 && !force)
+   ; /* If "Self Snoop" is supported and allowed, do nothing. */
else if ((cpu_feature & CPUID_CLFSH) != 0 &&
eva - sva < PMAP_CLFLUSH_THRESHOLD) {
 
@@ -6222,7 +6226,7 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_
for (tmpsize = 0; tmpsize < size; tmpsize += PAGE_SIZE)
pmap_kenter_attr(va + tmpsize, pa + tmpsize, mode);
pmap_invalidate_range(kernel_pmap, va, va + tmpsize);
-   pmap_invalidate_cache_range(va, va + tmpsize);
+   pmap_invalidate_cache_range(va, va + tmpsize, FALSE);
return ((void *)(va + offset));
 }
 
@@ -6558,7 +6562,7 @@ pmap_change_attr_locked(vm_offset_t va, 
 */
if (changed) {
pmap_invalidate_range(kernel_pmap, base, tmpva);
-   pmap_invalidate_cache_range(base, tmpva);
+   pmap_invalidate_cache_range(base, tmpva, FALSE);
}
return (error);
 }

Modified: head/sys/amd64/include/pmap.h
==
--- head/sys/amd64/include/pmap.h   Wed Oct  8 16:35:57 2014
(r272760)
+++ head/sys/amd64/include/pmap.h   Wed Oct  8 16:48:03 2014
(r272761)
@@ -394,7 +394,8 @@ voidpmap_invalidate_range(pmap_t, vm_of
 void   pmap_invalidate_all(pmap_t);
 void   pmap_invalidate_cache(void);
 void   pmap_invalidate_cache_pages(vm_page_t *pages, int count);
-void   pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva);
+void   pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva,
+   boolean_t force);
 void   pmap_get_mapping(pmap_t pmap, vm_offset_t va, uint64_t *ptr, int *num);
 #endif /* _KERNEL */
 

Modified: head/sys/dev/drm2/i915/intel_ringbuffer.c
==
--- head/sys/dev/drm2/i915/intel_ringbuffer.c   Wed Oct  8 16:35:57 2014
(r272760)
+++ head/sys/dev/drm2/i915/intel_ringbuffer.c   Wed Oct  8 16:48:03 2014
(r272761)
@@ -366,7 +366,7 @@ init_pipe_control(struct intel_ring_buff
goto err_unpin;
pmap_qenter((uintptr_t)pc->cpu_page, &obj->pages[0], 1);
pmap_invalidate_cache_range((vm_offset_t)pc->cpu_page,
-   (vm_offset_t)pc->cpu_page + PAGE_SIZE);
+   (vm_offset_t)pc->cpu_page + PAGE_SIZE, FALSE);
 
pc->obj = obj;
ring->private = pc;
@@ -1014,7 +1014,7 @@ static int init_status_page(struct intel
pmap_qenter((vm_offset_t)ring->status_page.page_addr, &obj->pages[0],
1);
pmap_invalidate_cache_range((vm_offset_t)ring->status_page.page_addr,
-   (vm_offset_t)ring->status_page.page_addr + PAGE_SIZE);
+   (vm_offset_t)ring->status_page.page_addr + PAGE_SIZE, FALSE);
ring->status_page.obj = obj;
memset(ring->status_page.page_addr, 0, PAGE_SIZE);
 

Modified: head/sys/i386/i386/pmap.c
=

svn commit: r272762 - head/usr.bin/find

2014-10-08 Thread Ed Maste
Author: emaste
Date: Wed Oct  8 17:40:58 2014
New Revision: 272762
URL: https://svnweb.freebsd.org/changeset/base/272762

Log:
  Correct scale factor for T terabyte suffix
  
  PR:   194250
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/find/function.c

Modified: head/usr.bin/find/function.c
==
--- head/usr.bin/find/function.cWed Oct  8 16:48:03 2014
(r272761)
+++ head/usr.bin/find/function.cWed Oct  8 17:40:58 2014
(r272762)
@@ -1506,7 +1506,7 @@ c_size(OPTION *option, char ***argvp)
scale = 0x4000LL;
break;
case 'T':   /* terabytes 1<<40 */
-   scale = 0x10LL;
+   scale = 0x100LL;
break;
case 'P':   /* petabytes 1<<50 */
scale = 0x4LL;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272763 - head/usr.sbin/newsyslog

2014-10-08 Thread Mark Johnston
Author: markj
Date: Wed Oct  8 17:44:30 2014
New Revision: 272763
URL: https://svnweb.freebsd.org/changeset/base/272763

Log:
  If we fail to send a signal after rotation, print the pidfile from which
  the corresponding PID was obtained.
  
  PR:   194143
  Submitted by: Lyndon Nerenberg 
  MFC after:1 week

Modified:
  head/usr.sbin/newsyslog/newsyslog.c

Modified: head/usr.sbin/newsyslog/newsyslog.c
==
--- head/usr.sbin/newsyslog/newsyslog.c Wed Oct  8 17:40:58 2014
(r272762)
+++ head/usr.sbin/newsyslog/newsyslog.c Wed Oct  8 17:44:30 2014
(r272763)
@@ -1968,8 +1968,8 @@ do_sigwork(struct sigwork_entry *swork)
 */
if (errno != ESRCH)
swork->sw_pidok = 0;
-   warn("can't notify %s, pid %d", swork->sw_pidtype,
-   (int)swork->sw_pid);
+   warn("can't notify %s, pid %d = %s", swork->sw_pidtype,
+   (int)swork->sw_pid, swork->sw_fname);
} else {
if (verbose)
printf("Notified %s pid %d = %s\n", swork->sw_pidtype,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272764 - head/sys/dev/usb/net

2014-10-08 Thread Gavin Atkinson
Author: gavin
Date: Wed Oct  8 19:49:10 2014
New Revision: 272764
URL: https://svnweb.freebsd.org/changeset/base/272764

Log:
  It looks like an entry for the R215 is not required in cdce(4) after all.

Modified:
  head/sys/dev/usb/net/if_cdce.c

Modified: head/sys/dev/usb/net/if_cdce.c
==
--- head/sys/dev/usb/net/if_cdce.c  Wed Oct  8 17:44:30 2014
(r272763)
+++ head/sys/dev/usb/net/if_cdce.c  Wed Oct  8 19:49:10 2014
(r272764)
@@ -273,7 +273,6 @@ static const struct usb_ether_methods cd
 
 static const STRUCT_USB_HOST_ID cdce_switch_devs[] = {
{USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3272_INIT, 
MSC_EJECT_HUAWEI2)},
-   {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_R215_INIT, 
MSC_EJECT_HUAWEI2)},
 };
 
 static const STRUCT_USB_HOST_ID cdce_host_devs[] = {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272765 - head/sys/dev/iscsi

2014-10-08 Thread Alexander Motin
Author: mav
Date: Wed Oct  8 19:54:42 2014
New Revision: 272765
URL: https://svnweb.freebsd.org/changeset/base/272765

Log:
  Remove one second wait for threads exit from icl_conn_close().
  
  Switch it from polling with pause() to using cv_wait()/cv_signal().

Modified:
  head/sys/dev/iscsi/icl.c

Modified: head/sys/dev/iscsi/icl.c
==
--- head/sys/dev/iscsi/icl.cWed Oct  8 19:49:10 2014(r272764)
+++ head/sys/dev/iscsi/icl.cWed Oct  8 19:54:42 2014(r272765)
@@ -771,6 +771,7 @@ icl_receive_thread(void *arg)
 
ICL_CONN_LOCK(ic);
ic->ic_receive_running = false;
+   cv_signal(&ic->ic_send_cv);
ICL_CONN_UNLOCK(ic);
kthread_exit();
 }
@@ -1023,6 +1024,7 @@ icl_send_thread(void *arg)
STAILQ_CONCAT(&ic->ic_to_send, &queue);
 
ic->ic_send_running = false;
+   cv_signal(&ic->ic_send_cv);
ICL_CONN_UNLOCK(ic);
kthread_exit();
 }
@@ -1342,15 +1344,11 @@ icl_conn_close(struct icl_conn *ic)
/*
 * Wake up the threads, so they can properly terminate.
 */
-   cv_signal(&ic->ic_receive_cv);
-   cv_signal(&ic->ic_send_cv);
while (ic->ic_receive_running || ic->ic_send_running) {
//ICL_DEBUG("waiting for send/receive threads to terminate");
-   ICL_CONN_UNLOCK(ic);
cv_signal(&ic->ic_receive_cv);
cv_signal(&ic->ic_send_cv);
-   pause("icl_close", 1 * hz);
-   ICL_CONN_LOCK(ic);
+   cv_wait(&ic->ic_send_cv, ic->ic_lock);
}
//ICL_DEBUG("send/receive threads terminated");
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r272649 - head/contrib/byacc

2014-10-08 Thread Craig Rodrigues
On Tue, Oct 7, 2014 at 3:39 PM, Baptiste Daroussin  wrote:

> On Tue, Oct 07, 2014 at 02:02:34PM -0700, Craig Rodrigues wrote:
> > On Mon, Oct 6, 2014 at 7:49 AM, Baptiste Daroussin 
> wrote:
> >
> > >
> > > Why a direct commit instead of a proper import of 20141005 version? it
> > > would
> > > have imho been better, simpler and easier to maintain.
> > >
> >
> > Because according to Thomas Dickey, he did not fix all
> > the memory related problems in snapshot 20141005.  Specifically there are
> > still
> > some issues not fixed when realloc() is called.
> > I was going to wait for the next snapshot.
> > However, I wanted to get that one fix into FreeBSD to fix the kyua tests,
> > which have been failing under Jenkins.  See:
> > https://jenkins.freebsd.org/jenkins/job/FreeBSD_HEAD-tests2/
> > (see runs #10 and #11).
>
> In that case I will import the new one which has the fix (do you confirm?)
>

According to http://invisible-island.net/byacc/CHANGES.html , the
2014-10-06 has a fix
to address my concerns.  However, this fix involves a lot of changes to the
code,
and I don't have time right now to audit everything.

There have been a lot of changes to the byacc code in the past few days.
The changes
are good bugfixes, but I would recommend auditing everything beore
importing the snapshot into FreeBSD.
--
Craig
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272766 - in head/sys: amd64/amd64 amd64/include arm/arm arm/include i386/i386 i386/include mips/include mips/mips x86/x86

2014-10-08 Thread Mark Johnston
Author: markj
Date: Wed Oct  8 20:25:21 2014
New Revision: 272766
URL: https://svnweb.freebsd.org/changeset/base/272766

Log:
  Pass up the error status of minidumpsys() to its callers.
  
  PR:   193761
  Submitted by: Conrad Meyer 
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/amd64/amd64/minidump_machdep.c
  head/sys/amd64/include/md_var.h
  head/sys/arm/arm/dump_machdep.c
  head/sys/arm/arm/minidump_machdep.c
  head/sys/arm/include/md_var.h
  head/sys/i386/i386/minidump_machdep.c
  head/sys/i386/include/md_var.h
  head/sys/mips/include/md_var.h
  head/sys/mips/mips/dump_machdep.c
  head/sys/mips/mips/minidump_machdep.c
  head/sys/x86/x86/dump_machdep.c

Modified: head/sys/amd64/amd64/minidump_machdep.c
==
--- head/sys/amd64/amd64/minidump_machdep.c Wed Oct  8 19:54:42 2014
(r272765)
+++ head/sys/amd64/amd64/minidump_machdep.c Wed Oct  8 20:25:21 2014
(r272766)
@@ -215,7 +215,7 @@ blk_write(struct dumperinfo *di, char *p
 /* A fake page table page, to avoid having to handle both 4K and 2M pages */
 static pd_entry_t fakepd[NPDEPG];
 
-void
+int
 minidumpsys(struct dumperinfo *di)
 {
uint32_t pmapsize;
@@ -441,7 +441,7 @@ minidumpsys(struct dumperinfo *di)
/* Signal completion, signoff and exit stage left. */
dump_write(di, NULL, 0, 0, 0);
printf("\nDump complete\n");
-   return;
+   return (0);
 
  fail:
if (error < 0)
@@ -462,6 +462,7 @@ minidumpsys(struct dumperinfo *di)
printf("Dump failed. Partition too small.\n");
else
printf("** DUMP FAILED (ERROR %d) **\n", error);
+   return (error);
 }
 
 void

Modified: head/sys/amd64/include/md_var.h
==
--- head/sys/amd64/include/md_var.h Wed Oct  8 19:54:42 2014
(r272765)
+++ head/sys/amd64/include/md_var.h Wed Oct  8 20:25:21 2014
(r272766)
@@ -118,7 +118,7 @@ voidpagezero(void *addr);
 void   printcpuinfo(void);
 void   setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist);
 intuser_dbreg_trap(void);
-void   minidumpsys(struct dumperinfo *);
+intminidumpsys(struct dumperinfo *);
 struct savefpu *get_pcb_user_save_td(struct thread *td);
 struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb);
 struct pcb *get_pcb_td(struct thread *td);

Modified: head/sys/arm/arm/dump_machdep.c
==
--- head/sys/arm/arm/dump_machdep.c Wed Oct  8 19:54:42 2014
(r272765)
+++ head/sys/arm/arm/dump_machdep.c Wed Oct  8 20:25:21 2014
(r272766)
@@ -280,10 +280,8 @@ dumpsys(struct dumperinfo *di)
size_t hdrsz;
int error;
 
-   if (do_minidump) {
-   minidumpsys(di);
-   return (0);
-   }
+   if (do_minidump)
+   return (minidumpsys(di));
 
bzero(&ehdr, sizeof(ehdr));
ehdr.e_ident[EI_MAG0] = ELFMAG0;

Modified: head/sys/arm/arm/minidump_machdep.c
==
--- head/sys/arm/arm/minidump_machdep.c Wed Oct  8 19:54:42 2014
(r272765)
+++ head/sys/arm/arm/minidump_machdep.c Wed Oct  8 20:25:21 2014
(r272766)
@@ -196,7 +196,7 @@ blk_write_cont(struct dumperinfo *di, vm
 /* A fake page table page, to avoid having to handle both 4K and 2M pages */
 static pt_entry_t fakept[NPTEPG];
 
-void
+int
 minidumpsys(struct dumperinfo *di)
 {
struct minidumphdr mdhdr;
@@ -460,7 +460,7 @@ minidumpsys(struct dumperinfo *di)
/* Signal completion, signoff and exit stage left. */
dump_write(di, NULL, 0, 0, 0);
printf("\nDump complete\n");
-   return;
+   return (0);
 
 fail:
if (error < 0)
@@ -472,6 +472,7 @@ fail:
printf("\nDump failed. Partition too small.\n");
else
printf("\n** DUMP FAILED (ERROR %d) **\n", error);
+   return (error);
 }
 
 void

Modified: head/sys/arm/include/md_var.h
==
--- head/sys/arm/include/md_var.h   Wed Oct  8 19:54:42 2014
(r272765)
+++ head/sys/arm/include/md_var.h   Wed Oct  8 20:25:21 2014
(r272766)
@@ -68,6 +68,6 @@ extern int busdma_swi_pending;
 void busdma_swi(void);
 void dump_add_page(vm_paddr_t);
 void dump_drop_page(vm_paddr_t);
-void minidumpsys(struct dumperinfo *);
+int minidumpsys(struct dumperinfo *);
 
 #endif /* !_MACHINE_MD_VAR_H_ */

Modified: head/sys/i386/i386/minidump_machdep.c
==
--- head/sys/i386/i386/minidump_machdep.c   Wed Oct  8 19:54:42 2014
(r272765)
+++ head/sys/i386/i386/minidump_machdep.c   Wed Oct  8 20:25:21 2014
(r272766)
@@ -178,7 +178,7 @@ blk_wr

Re: svn commit: r272649 - head/contrib/byacc

2014-10-08 Thread Baptiste Daroussin
On Wed, Oct 08, 2014 at 01:10:19PM -0700, Craig Rodrigues wrote:
> On Tue, Oct 7, 2014 at 3:39 PM, Baptiste Daroussin  wrote:
> 
> > On Tue, Oct 07, 2014 at 02:02:34PM -0700, Craig Rodrigues wrote:
> > > On Mon, Oct 6, 2014 at 7:49 AM, Baptiste Daroussin 
> > wrote:
> > >
> > > >
> > > > Why a direct commit instead of a proper import of 20141005 version? it
> > > > would
> > > > have imho been better, simpler and easier to maintain.
> > > >
> > >
> > > Because according to Thomas Dickey, he did not fix all
> > > the memory related problems in snapshot 20141005.  Specifically there are
> > > still
> > > some issues not fixed when realloc() is called.
> > > I was going to wait for the next snapshot.
> > > However, I wanted to get that one fix into FreeBSD to fix the kyua tests,
> > > which have been failing under Jenkins.  See:
> > > https://jenkins.freebsd.org/jenkins/job/FreeBSD_HEAD-tests2/
> > > (see runs #10 and #11).
> >
> > In that case I will import the new one which has the fix (do you confirm?)
> >
> 
> According to http://invisible-island.net/byacc/CHANGES.html , the
> 2014-10-06 has a fix
> to address my concerns.  However, this fix involves a lot of changes to the
> code,
> and I don't have time right now to audit everything.
> 
> There have been a lot of changes to the byacc code in the past few days.
> The changes
> are good bugfixes, but I would recommend auditing everything beore
> importing the snapshot into FreeBSD.

It has already been imported the only difference between the version in base
since 2 days ago and the version upstream now is your change.

regards,
Bapt


pgppu07EOXhbe.pgp
Description: PGP signature


svn commit: r272769 - in head/contrib/byacc: . package package/debian package/debian/source package/pkgsrc

2014-10-08 Thread Baptiste Daroussin
Author: bapt
Date: Wed Oct  8 20:46:38 2014
New Revision: 272769
URL: https://svnweb.freebsd.org/changeset/base/272769

Log:
  Import byacc 20141006

Modified:
  head/contrib/byacc/CHANGES
  head/contrib/byacc/MANIFEST
  head/contrib/byacc/VERSION
  head/contrib/byacc/configure
  head/contrib/byacc/configure.in
  head/contrib/byacc/main.c
  head/contrib/byacc/package/byacc.spec
  head/contrib/byacc/package/debian/changelog
  head/contrib/byacc/package/debian/source/format
  head/contrib/byacc/package/mingw-byacc.spec
  head/contrib/byacc/package/pkgsrc/Makefile
  head/contrib/byacc/reader.c
Directory Properties:
  head/contrib/byacc/   (props changed)

Modified: head/contrib/byacc/CHANGES
==
--- head/contrib/byacc/CHANGES  Wed Oct  8 20:44:05 2014(r272768)
+++ head/contrib/byacc/CHANGES  Wed Oct  8 20:46:38 2014(r272769)
@@ -1,3 +1,23 @@
+2014-10-06  Thomas E. Dickey  
+
+   * package/debian/source/format:
+   change to native format to work around regression in Debian packaging.
+
+   * VERSION, package/byacc.spec, package/debian/changelog, 
package/mingw-byacc.spec, package/pkgsrc/Makefile:
+   bump
+
+   * configure: regen
+
+   * main.c:
+   correct parameter for umask - for very old mkstemp's - and use type 
mode_t
+   to quiet compiler warning
+
+   * configure.in: add configure check for mode_t
+
+   * reader.c:
+   better fix for get_line, by ensuring there is enough space to 
null-terminate
+   its result (prompted by discussion with Craig Rodrigues).
+
 2014-10-05  Thomas E. Dickey  
 
* main.c:

Modified: head/contrib/byacc/MANIFEST
==
--- head/contrib/byacc/MANIFEST Wed Oct  8 20:44:05 2014(r272768)
+++ head/contrib/byacc/MANIFEST Wed Oct  8 20:46:38 2014(r272769)
@@ -1,4 +1,4 @@
-MANIFEST for byacc-20141005, version t20141005
+MANIFEST for byacc-20141006, version t20141006
 

 MANIFESTthis file
 ACKNOWLEDGEMENTSoriginal version of byacc - 1993

Modified: head/contrib/byacc/VERSION
==
--- head/contrib/byacc/VERSION  Wed Oct  8 20:44:05 2014(r272768)
+++ head/contrib/byacc/VERSION  Wed Oct  8 20:46:38 2014(r272769)
@@ -1 +1 @@
-20141005
+20141006

Modified: head/contrib/byacc/configure
==
--- head/contrib/byacc/configureWed Oct  8 20:44:05 2014
(r272768)
+++ head/contrib/byacc/configureWed Oct  8 20:46:38 2014
(r272769)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.19 .
+# From configure.in Revision: 1.20 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by Autoconf 2.52.20121002.
 #
@@ -106,6 +106,42 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 : ${ac_max_here_lines=38}
 
 ac_unique_file="main.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include 
+#if HAVE_SYS_TYPES_H
+# include 
+#endif
+#if HAVE_SYS_STAT_H
+# include 
+#endif
+#if STDC_HEADERS
+# include 
+# include 
+#else
+# if HAVE_STDLIB_H
+#  include 
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include 
+# endif
+# include 
+#endif
+#if HAVE_STRINGS_H
+# include 
+#endif
+#if HAVE_INTTYPES_H
+# include 
+#else
+# if HAVE_STDINT_H
+#  include 
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include 
+#endif"
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -854,7 +890,7 @@ if test -z "$CONFIG_SITE"; then
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
-{ echo "$as_me:857: loading site script $ac_site_file" >&5
+{ echo "$as_me:893: loading site script $ac_site_file" >&5
 echo "$as_me: loading site script $ac_site_file" >&6;}
 cat "$ac_site_file" >&5
 . "$ac_site_file"
@@ -865,7 +901,7 @@ if test -r "$cache_file"; then
   # Some versions of bash will fail to source /dev/null (special
   # files actually), so we avoid doing that.
   if test -f "$cache_file"; then
-{ echo "$as_me:868: loading cache $cache_file" >&5
+{ echo "$as_me:904: loading cache $cache_file" >&5
 echo "$as_me: loading cache $cache_file" >&6;}
 case $cache_file in
   [\\/]* | ?:[\\/]* ) . $cache_file;;
@@ -873,7 +909,7 @@ echo "$as_me: loading cache $cache_file"
 esac
   fi
 else
-  { echo "$as_me:876: creating cache $cache_file" >&5
+  { echo "$as_me:912: creating cache $cache_file" >&5
 echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
@@ -889,21 +925,21 @@ for ac_var in `(set) 2>&1 |
   eval ac_new_val="\$ac_env_${ac_var}_value"
   case $ac_old_set,$ac_new_set in
 set,)
-  { echo "$as_me:892: error: \`$ac_var' was set to \`$a

svn commit: r272770 - in head/sys: net netinet

2014-10-08 Thread Andrey V. Elsukov
Author: ae
Date: Wed Oct  8 21:23:34 2014
New Revision: 272770
URL: https://svnweb.freebsd.org/changeset/base/272770

Log:
  When tunneling interface is going to insert mbuf into netisr queue after 
stripping
  outer header, consider it as new packet and clear the protocols flags.
  
  This fixes problems when IPSEC traffic goes through various tunnels and router
  doesn't send ICMP/ICMPv6 errors.
  
  PR:   174602
  Obtained from:Yandex LLC
  MFC after:2 weeks
  Sponsored by: Yandex LLC

Modified:
  head/sys/net/if_gif.c
  head/sys/netinet/ip_gre.c

Modified: head/sys/net/if_gif.c
==
--- head/sys/net/if_gif.c   Wed Oct  8 20:46:38 2014(r272769)
+++ head/sys/net/if_gif.c   Wed Oct  8 21:23:34 2014(r272770)
@@ -547,6 +547,7 @@ gif_input(struct mbuf *m, int af, struct
}
sc = ifp->if_softc;
m->m_pkthdr.rcvif = ifp;
+   m_clrprotoflags(m);
 
 #ifdef MAC
mac_ifnet_create_mbuf(ifp, m);

Modified: head/sys/netinet/ip_gre.c
==
--- head/sys/netinet/ip_gre.c   Wed Oct  8 20:46:38 2014(r272769)
+++ head/sys/netinet/ip_gre.c   Wed Oct  8 21:23:34 2014(r272770)
@@ -205,7 +205,7 @@ gre_input2(struct mbuf *m ,int hlen, u_c
}
 
m->m_pkthdr.rcvif = GRE2IFP(sc);
-
+   m_clrprotoflags(m);
netisr_queue(isr, m);
 
/* Packet is done, no further processing needed. */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272771 - head/share/man/man9

2014-10-08 Thread John Baldwin
Author: jhb
Date: Wed Oct  8 21:53:24 2014
New Revision: 272771
URL: https://svnweb.freebsd.org/changeset/base/272771

Log:
  Rewrite timeout(9) to be callout(9)-centric instead.  Move the description
  of timeout(9) to the end and mark it prominently as deprecated.  Document
  somewhat how times are specified for the 'sbt' variants.  Better explain
  how using callout_init_*() to associate a lock with a callout resolves
  common races.
  
  Differential Revision:https://reviews.freebsd.org/D847
  Reviewed by:  wblock, bjk
  MFC after:1 week

Modified:
  head/share/man/man9/timeout.9

Modified: head/share/man/man9/timeout.9
==
--- head/share/man/man9/timeout.9   Wed Oct  8 21:23:34 2014
(r272770)
+++ head/share/man/man9/timeout.9   Wed Oct  8 21:53:24 2014
(r272771)
@@ -33,27 +33,27 @@
 .Dt TIMEOUT 9
 .Os
 .Sh NAME
-.Nm timeout ,
-.Nm untimeout ,
+.Nm callout_active ,
+.Nm callout_deactivate ,
+.Nm callout_drain ,
 .Nm callout_handle_init ,
 .Nm callout_init ,
 .Nm callout_init_mtx ,
 .Nm callout_init_rm ,
 .Nm callout_init_rw ,
-.Nm callout_stop ,
-.Nm callout_drain ,
+.Nm callout_pending ,
 .Nm callout_reset ,
-.Nm callout_reset_on ,
 .Nm callout_reset_curcpu ,
+.Nm callout_reset_on ,
 .Nm callout_reset_sbt ,
-.Nm callout_reset_sbt_on ,
 .Nm callout_reset_sbt_curcpu ,
+.Nm callout_reset_sbt_on ,
 .Nm callout_schedule ,
-.Nm callout_schedule_on ,
 .Nm callout_schedule_curcpu ,
-.Nm callout_pending ,
-.Nm callout_active ,
-.Nm callout_deactivate
+.Nm callout_schedule_on ,
+.Nm callout_stop ,
+.Nm timeout ,
+.Nm untimeout
 .Nd execute a function after a specified length of time
 .Sh SYNOPSIS
 .In sys/types.h
@@ -61,16 +61,18 @@
 .Bd -literal
 typedef void timeout_t (void *);
 .Ed
-.Ft struct callout_handle
-.Fn timeout "timeout_t *func" "void *arg" "int ticks"
+.Ft int
+.Fn callout_active "struct callout *c"
+.Ft void
+.Fn callout_deactivate "struct callout *c"
+.Ft int
+.Fn callout_drain "struct callout *c"
 .Ft void
 .Fn callout_handle_init "struct callout_handle *handle"
 .Bd -literal
 struct callout_handle handle = CALLOUT_HANDLE_INITIALIZER(&handle);
 .Ed
 .Ft void
-.Fn untimeout "timeout_t *func" "void *arg" "struct callout_handle handle"
-.Ft void
 .Fn callout_init "struct callout *c" "int mpsafe"
 .Ft void
 .Fn callout_init_mtx "struct callout *c" "struct mtx *mtx" "int flags"
@@ -79,314 +81,337 @@ struct callout_handle handle = CALLOUT_H
 .Ft void
 .Fn callout_init_rw "struct callout *c" "struct rwlock *rw" "int flags"
 .Ft int
-.Fn callout_stop "struct callout *c"
-.Ft int
-.Fn callout_drain "struct callout *c"
+.Fn callout_pending "struct callout *c"
 .Ft int
 .Fn callout_reset "struct callout *c" "int ticks" "timeout_t *func" "void *arg"
 .Ft int
+.Fn callout_reset_curcpu "struct callout *c" "int ticks" "timeout_t *func" \
+"void *arg"
+.Ft int
 .Fn callout_reset_on "struct callout *c" "int ticks" "timeout_t *func" \
 "void *arg" "int cpu"
 .Ft int
+.Fn callout_reset_sbt "struct callout *c" "sbintime_t sbt" \
+"sbintime_t pr" "timeout_t *func" "void *arg" "int flags"
+.Ft int
+.Fn callout_reset_sbt_curcpu "struct callout *c" "sbintime_t sbt" \
+"sbintime_t pr" "timeout_t *func" "void *arg" "int flags"
+.Ft int
 .Fn callout_reset_sbt_on "struct callout *c" "sbintime_t sbt" \
 "sbintime_t pr" "timeout_t *func" "void *arg" "int cpu" "int flags"
 .Ft int
-.Fn callout_reset_curcpu "struct callout *c" "int ticks" "timeout_t *func" \
-"void *arg"
-.Ft int
 .Fn callout_schedule "struct callout *c" "int ticks"
 .Ft int
-.Fn callout_schedule_on "struct callout *c" "int ticks" "int cpu"
-.Ft int
 .Fn callout_schedule_curcpu "struct callout *c" "int ticks"
 .Ft int
-.Fn callout_pending "struct callout *c"
+.Fn callout_schedule_on "struct callout *c" "int ticks" "int cpu"
 .Ft int
-.Fn callout_active "struct callout *c"
+.Fn callout_stop "struct callout *c"
+.Ft struct callout_handle
+.Fn timeout "timeout_t *func" "void *arg" "int ticks"
 .Ft void
-.Fn callout_deactivate "struct callout *c"
+.Fn untimeout "timeout_t *func" "void *arg" "struct callout_handle handle"
 .Sh DESCRIPTION
-The function
-.Fn timeout
-schedules a call to the function given by the argument
-.Fa func
-to take place after
-.Fa ticks Ns No /hz
-seconds.
-Non-positive values of
-.Fa ticks
-are silently converted to the value
-.Sq 1 .
-.Fa func
-should be a pointer to a function that takes a
-.Fa void *
-argument.
-Upon invocation,
-.Fa func
-will receive
-.Fa arg
-as its only argument.
-The return value from
-.Fn timeout
-is a
-.Ft struct callout_handle
-which can be used in conjunction with the
-.Fn untimeout
-function to request that a scheduled timeout be canceled.
-The
-.Fn timeout
-call is the old style and new code should use the
-.Fn callout_*
-functions.
-.Pp
-The function
-.Fn callout_handle_init
-can be used to initialize a handle to a state which will cause
-any calls to
-.Fn untimeout
-with that handle to return with

svn commit: r272772 - head/share/man/man9

2014-10-08 Thread John Baldwin
Author: jhb
Date: Wed Oct  8 21:56:00 2014
New Revision: 272772
URL: https://svnweb.freebsd.org/changeset/base/272772

Log:
  Forgot to bump Dd.
  
  Pointy hat to:jhb

Modified:
  head/share/man/man9/timeout.9

Modified: head/share/man/man9/timeout.9
==
--- head/share/man/man9/timeout.9   Wed Oct  8 21:53:24 2014
(r272771)
+++ head/share/man/man9/timeout.9   Wed Oct  8 21:56:00 2014
(r272772)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 21, 2014
+.Dd October 8, 2014
 .Dt TIMEOUT 9
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272777 - in head: etc/mtree usr.sbin/nmtree usr.sbin/nmtree/tests

2014-10-08 Thread Garrett Cooper
Author: ngie
Date: Thu Oct  9 00:32:33 2014
New Revision: 272777
URL: https://svnweb.freebsd.org/changeset/base/272777

Log:
  Integrate usr.sbin/nmtree/tests from NetBSD into atf/kyua
  
  In collaboration with: pho
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/usr.sbin/nmtree/tests/
  head/usr.sbin/nmtree/tests/Makefile   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.sbin/nmtree/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Wed Oct  8 22:13:18 2014
(r272776)
+++ head/etc/mtree/BSD.tests.dist   Thu Oct  9 00:32:33 2014
(r272777)
@@ -287,6 +287,8 @@
 ..
 newsyslog
 ..
+nmtree
+..
 pw
 ..
 sa

Modified: head/usr.sbin/nmtree/Makefile
==
--- head/usr.sbin/nmtree/Makefile   Wed Oct  8 22:13:18 2014
(r272776)
+++ head/usr.sbin/nmtree/Makefile   Thu Oct  9 00:32:33 2014
(r272777)
@@ -1,6 +1,6 @@
 #  $FreeBSD$
 
-.include 
+.include 
 
 .PATH: ${.CURDIR}/../../contrib/mtree
 
@@ -24,4 +24,8 @@ LDADD+=   ${LIBNETBSD}
 LINKS= ${BINDIR}/mtree ${BINDIR}/nmtree
 MLINKS=mtree.8 nmtree.8
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Added: head/usr.sbin/nmtree/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/nmtree/tests/Makefile Thu Oct  9 00:32:33 2014
(r272777)
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+TESTSRC=   ${.CURDIR}/../../../contrib/netbsd-tests/usr.sbin/mtree
+.PATH: ${TESTSRC}
+
+TESTSDIR=  ${TESTSBASE}/usr.sbin/nmtree
+
+ATF_TESTS_SH=  nmtree_test
+ATF_TESTS_SH_SRC_nmtree_test=  t_mtree.sh
+
+FILESDIR=  ${TESTSDIR}
+
+# NOTE: the output from FreeBSD's nmtree displays sha256digest instead of
+# sha256; we need to mangle the specfiles to reflect this.
+.for f in mtree_d_create.out netbsd6_d_create.out
+CLEANFILES+=   $f $f.tmp
+FILES+=$f
+$f: ${TESTSRC}/$f
+   sed -e 's/sha256/sha256digest/g' < ${.ALLSRC} > ${.TARGET}.tmp
+   mv ${.TARGET}.tmp ${.TARGET}
+.endfor
+
+FILES+=d_convert.in
+FILES+=d_convert_C.out
+FILES+=d_convert_C_S.out
+FILES+=d_convert_D.out
+FILES+=d_convert_D_S.out
+FILES+=d_merge.in
+FILES+=d_merge_C_M.out
+FILES+=d_merge_C_M_S.out
+
+.include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272778 - head/etc/mtree

2014-10-08 Thread Garrett Cooper
Author: ngie
Date: Thu Oct  9 00:37:58 2014
New Revision: 272778
URL: https://svnweb.freebsd.org/changeset/base/272778

Log:
  Set the autoindent to 4 spaces with vim in BSD.tests.dist
  
  This will prevent vim users from accidentally checking in buggy mtree files
  (mixed tabs/spaces).
  
  MFC after: 2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/etc/mtree/BSD.tests.dist

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Oct  9 00:32:33 2014
(r272777)
+++ head/etc/mtree/BSD.tests.dist   Thu Oct  9 00:37:58 2014
(r272778)
@@ -296,3 +296,5 @@
 ..
 ..
 ..
+
+# vim: set expandtab ts=4 sw=4:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272779 - in head: etc/mtree usr.bin/basename usr.bin/basename/tests

2014-10-08 Thread Garrett Cooper
Author: ngie
Date: Thu Oct  9 00:41:42 2014
New Revision: 272779
URL: https://svnweb.freebsd.org/changeset/base/272779

Log:
  Integrate usr.sbin/basename/tests from NetBSD into atf/kyua
  
  In collaboration with: pho
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/usr.bin/basename/tests/
  head/usr.bin/basename/tests/Makefile   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.bin/basename/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Oct  9 00:37:58 2014
(r272778)
+++ head/etc/mtree/BSD.tests.dist   Thu Oct  9 00:41:42 2014
(r272779)
@@ -143,6 +143,8 @@
 usr.bin
 apply
 ..
+basename
+..
 bmake
 archives
 fmt_44bsd

Modified: head/usr.bin/basename/Makefile
==
--- head/usr.bin/basename/Makefile  Thu Oct  9 00:37:58 2014
(r272778)
+++ head/usr.bin/basename/Makefile  Thu Oct  9 00:41:42 2014
(r272779)
@@ -1,7 +1,13 @@
 #  From: @(#)Makefile  8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+.include 
+
 PROG=  basename
 MLINKS=basename.1 dirname.1
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Added: head/usr.bin/basename/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/basename/tests/MakefileThu Oct  9 00:41:42 2014
(r272779)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+TESTSRC=   ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/basename
+.PATH: ${TESTSRC}
+
+.include 
+
+TESTSDIR=  ${TESTSBASE}/usr.bin/basename
+ATF_TESTS_SH=  basename_test
+ATF_TESTS_SH_SRC_basename_test=t_basename.sh
+
+.include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"