From owner-svn-src-stable-11@freebsd.org Sun Oct 9 12:34:59 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0ED73C06065; Sun, 9 Oct 2016 12:34:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C400EEB0; Sun, 9 Oct 2016 12:34:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u99CYvWo018416; Sun, 9 Oct 2016 12:34:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u99CYv4x018407; Sun, 9 Oct 2016 12:34:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610091234.u99CYv4x018407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 9 Oct 2016 12:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306905 - in stable/11: include lib/librt tests/sys/mqueue X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2016 12:34:59 -0000 Author: kib Date: Sun Oct 9 12:34:56 2016 New Revision: 306905 URL: https://svnweb.freebsd.org/changeset/base/306905 Log: MFC r306588: Export the mq_getfd_np() and timer_oshandle_np() symbols from librt.so. Modified: stable/11/include/mqueue.h stable/11/include/time.h stable/11/lib/librt/Symbol.map stable/11/lib/librt/mq.c stable/11/lib/librt/timer.c stable/11/tests/sys/mqueue/Makefile stable/11/tests/sys/mqueue/mqtest3.c stable/11/tests/sys/mqueue/mqtest4.c Directory Properties: stable/11/ (props changed) Modified: stable/11/include/mqueue.h ============================================================================== --- stable/11/include/mqueue.h Sun Oct 9 11:44:33 2016 (r306904) +++ stable/11/include/mqueue.h Sun Oct 9 12:34:56 2016 (r306905) @@ -50,7 +50,9 @@ ssize_t mq_timedreceive(mqd_t, char *__r int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct timespec *); int mq_unlink(const char *); -int __mq_oshandle(mqd_t mqd); +#if __BSD_VISIBLE +int mq_getfd_np(mqd_t mqd); +#endif /* __BSD_VISIBLE */ __END_DECLS #endif Modified: stable/11/include/time.h ============================================================================== --- stable/11/include/time.h Sun Oct 9 11:44:33 2016 (r306904) +++ stable/11/include/time.h Sun Oct 9 12:34:56 2016 (r306905) @@ -194,6 +194,7 @@ char *timezone(int, int); /* XXX XSI con void tzsetwall(void); time_t timelocal(struct tm * const); time_t timegm(struct tm * const); +int timer_oshandle_np(timer_t timerid); #endif /* __BSD_VISIBLE */ #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) Modified: stable/11/lib/librt/Symbol.map ============================================================================== --- stable/11/lib/librt/Symbol.map Sun Oct 9 11:44:33 2016 (r306904) +++ stable/11/lib/librt/Symbol.map Sun Oct 9 12:34:56 2016 (r306905) @@ -25,6 +25,11 @@ FBSD_1.0 { timer_getoverrun; }; +FBSD_1.5 { + mq_getfd_np; + timer_oshandle_np; +}; + FBSDprivate_1.0 { _aio_read; _aio_write; Modified: stable/11/lib/librt/mq.c ============================================================================== --- stable/11/lib/librt/mq.c Sun Oct 9 11:44:33 2016 (r306904) +++ stable/11/lib/librt/mq.c Sun Oct 9 12:34:56 2016 (r306905) @@ -272,8 +272,9 @@ __mq_unlink(const char *path) return __sys_kmq_unlink(path); } +#pragma weak mq_getfd_np int -__mq_oshandle(mqd_t mqd) +mq_getfd_np(mqd_t mqd) { return (mqd->oshandle); Modified: stable/11/lib/librt/timer.c ============================================================================== --- stable/11/lib/librt/timer.c Sun Oct 9 11:44:33 2016 (r306904) +++ stable/11/lib/librt/timer.c Sun Oct 9 12:34:56 2016 (r306905) @@ -175,8 +175,9 @@ __timer_settime(timer_t timerid, int fla flags, value, ovalue); } +#pragma weak timer_oshandle_np int -__timer_oshandle(timer_t timerid) +timer_oshandle_np(timer_t timerid) { return (timerid->oshandle); Modified: stable/11/tests/sys/mqueue/Makefile ============================================================================== --- stable/11/tests/sys/mqueue/Makefile Sun Oct 9 11:44:33 2016 (r306904) +++ stable/11/tests/sys/mqueue/Makefile Sun Oct 9 12:34:56 2016 (r306905) @@ -10,8 +10,8 @@ CFLAGS+= -I${SRCTOP}/tests PROGS+= mqtest1 PROGS+= mqtest2 -#PROGS+= mqtest3 -#PROGS+= mqtest4 +PROGS+= mqtest3 +PROGS+= mqtest4 PROGS+= mqtest5 LIBADD+= rt Modified: stable/11/tests/sys/mqueue/mqtest3.c ============================================================================== --- stable/11/tests/sys/mqueue/mqtest3.c Sun Oct 9 11:44:33 2016 (r306904) +++ stable/11/tests/sys/mqueue/mqtest3.c Sun Oct 9 12:34:56 2016 (r306905) @@ -62,9 +62,10 @@ main(void) buf = malloc(attr.mq_msgsize); for (j = 0; j < LOOPS; ++j) { FD_ZERO(&set); - FD_SET(__mq_oshandle(mq), &set); + FD_SET(mq_getfd_np(mq), &set); alarm(3); - status = select(__mq_oshandle(mq)+1, &set, NULL, NULL, NULL); + status = select(mq_getfd_np(mq) + 1, &set, NULL, + NULL, NULL); if (status != 1) err(1, "child process: select()"); status = mq_receive(mq, buf, attr.mq_msgsize, &prio); @@ -94,8 +95,9 @@ main(void) } alarm(3); FD_ZERO(&set); - FD_SET(__mq_oshandle(mq), &set); - status = select(__mq_oshandle(mq)+1, NULL, &set, NULL, NULL); + FD_SET(mq_getfd_np(mq), &set); + status = select(mq_getfd_np(mq) + 1, NULL, &set, + NULL, NULL); if (status != 1) err(1, "select()"); status = mq_send(mq, buf, attr.mq_msgsize, PRIO); Modified: stable/11/tests/sys/mqueue/mqtest4.c ============================================================================== --- stable/11/tests/sys/mqueue/mqtest4.c Sun Oct 9 11:44:33 2016 (r306904) +++ stable/11/tests/sys/mqueue/mqtest4.c Sun Oct 9 12:34:56 2016 (r306905) @@ -57,7 +57,7 @@ main(void) mq = mq_open(MQNAME, O_RDWR); if (mq == (mqd_t)-1) err(1, "child: mq_open"); - EV_SET(&kev, __mq_oshandle(mq), EVFILT_READ, EV_ADD, 0, 0, 0); + EV_SET(&kev, mq_getfd_np(mq), EVFILT_READ, EV_ADD, 0, 0, 0); status = kevent(kq, &kev, 1, NULL, 0, NULL); if (status == -1) err(1, "child: kevent"); @@ -89,7 +89,7 @@ main(void) signal(SIGALRM, sighandler); kq = kqueue(); - EV_SET(&kev, __mq_oshandle(mq), EVFILT_WRITE, EV_ADD, 0, 0, 0); + EV_SET(&kev, mq_getfd_np(mq), EVFILT_WRITE, EV_ADD, 0, 0, 0); status = kevent(kq, &kev, 1, NULL, 0, NULL); if (status == -1) err(1, "kevent"); From owner-svn-src-stable-11@freebsd.org Sun Oct 9 13:59:40 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B1BAC07439; Sun, 9 Oct 2016 13:59:40 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDE012F3; Sun, 9 Oct 2016 13:59:39 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u99Dxddc048992; Sun, 9 Oct 2016 13:59:39 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u99DxcYb048991; Sun, 9 Oct 2016 13:59:38 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201610091359.u99DxcYb048991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 9 Oct 2016 13:59:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306907 - stable/11/sys/arm/arm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2016 13:59:40 -0000 Author: jmcneill Date: Sun Oct 9 13:59:38 2016 New Revision: 306907 URL: https://svnweb.freebsd.org/changeset/base/306907 Log: MFC r306658: Clear GT_CTRL_ENABLE to stop the timer. Modified: stable/11/sys/arm/arm/generic_timer.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/generic_timer.c ============================================================================== --- stable/11/sys/arm/arm/generic_timer.c Sun Oct 9 13:30:57 2016 (r306906) +++ stable/11/sys/arm/arm/generic_timer.c Sun Oct 9 13:59:38 2016 (r306907) @@ -259,7 +259,7 @@ arm_tmr_stop(struct eventtimer *et) sc = (struct arm_tmr_softc *)et->et_priv; ctrl = get_ctrl(sc->physical); - ctrl &= GT_CTRL_ENABLE; + ctrl &= ~GT_CTRL_ENABLE; set_ctrl(ctrl, sc->physical); return (0); From owner-svn-src-stable-11@freebsd.org Sun Oct 9 19:57:22 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76BD4C0B253; Sun, 9 Oct 2016 19:57:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3864263B; Sun, 9 Oct 2016 19:57:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u99JvLI8086678; Sun, 9 Oct 2016 19:57:21 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u99JvLmP086675; Sun, 9 Oct 2016 19:57:21 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201610091957.u99JvLmP086675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 9 Oct 2016 19:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306909 - stable/11/usr.sbin/fifolog/lib X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2016 19:57:22 -0000 Author: pfg Date: Sun Oct 9 19:57:20 2016 New Revision: 306909 URL: https://svnweb.freebsd.org/changeset/base/306909 Log: MFC r305812: fifolog(1): invert order of calloc(3) arguments. The second argument to calloc(3) should be the size, make it so. While here be a little bit more cautious in fifolog_reader_open() to protect in the unlikely event of an overflowed allocation. Modified: stable/11/usr.sbin/fifolog/lib/fifolog_create.c stable/11/usr.sbin/fifolog/lib/fifolog_reader.c stable/11/usr.sbin/fifolog/lib/fifolog_write_poll.c stable/11/usr.sbin/fifolog/lib/miniobj.h Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/fifolog/lib/fifolog_create.c ============================================================================== --- stable/11/usr.sbin/fifolog/lib/fifolog_create.c Sun Oct 9 18:39:13 2016 (r306908) +++ stable/11/usr.sbin/fifolog/lib/fifolog_create.c Sun Oct 9 19:57:20 2016 (r306909) @@ -97,7 +97,7 @@ fifolog_create(const char *fn, off_t siz if (S_ISREG(st.st_mode) && ftruncate(fd, size) < 0) return ("Could not ftrunc"); - buf = calloc(recsize, 1); + buf = calloc(1, recsize); if (buf == NULL) return ("Could not malloc"); Modified: stable/11/usr.sbin/fifolog/lib/fifolog_reader.c ============================================================================== --- stable/11/usr.sbin/fifolog/lib/fifolog_reader.c Sun Oct 9 18:39:13 2016 (r306908) +++ stable/11/usr.sbin/fifolog/lib/fifolog_reader.c Sun Oct 9 19:57:20 2016 (r306909) @@ -67,10 +67,10 @@ fifolog_reader_open(const char *fname) if (retval != NULL) err(1, "%s", retval); - fr->olen = fr->ff->recsize * 16; - fr->obuf = calloc(fr->olen, 1); + fr->obuf = calloc(16, fr->ff->recsize); if (fr->obuf == NULL) err(1, "Cannot malloc"); + fr->olen = fr->ff->recsize * 16; i = inflateInit(fr->ff->zs); assert(i == Z_OK); Modified: stable/11/usr.sbin/fifolog/lib/fifolog_write_poll.c ============================================================================== --- stable/11/usr.sbin/fifolog/lib/fifolog_write_poll.c Sun Oct 9 18:39:13 2016 (r306908) +++ stable/11/usr.sbin/fifolog/lib/fifolog_write_poll.c Sun Oct 9 19:57:20 2016 (r306909) @@ -45,7 +45,7 @@ static int fifolog_write_gzip(struct fifolog_writer *f, time_t now); #define ALLOC(ptr, size) do { \ - (*(ptr)) = calloc(size, 1); \ + (*(ptr)) = calloc(1, size); \ assert(*(ptr) != NULL); \ } while (0) Modified: stable/11/usr.sbin/fifolog/lib/miniobj.h ============================================================================== --- stable/11/usr.sbin/fifolog/lib/miniobj.h Sun Oct 9 18:39:13 2016 (r306908) +++ stable/11/usr.sbin/fifolog/lib/miniobj.h Sun Oct 9 19:57:20 2016 (r306909) @@ -28,7 +28,7 @@ #define ALLOC_OBJ(to, type_magic) \ do { \ - (to) = calloc(sizeof *(to), 1); \ + (to) = calloc(1, sizeof *(to)); \ if ((to) != NULL) \ (to)->magic = (type_magic); \ } while (0) From owner-svn-src-stable-11@freebsd.org Sun Oct 9 20:07:03 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0188EC0B534; Sun, 9 Oct 2016 20:07:03 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C742DDC8; Sun, 9 Oct 2016 20:07:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u99K71fS090465; Sun, 9 Oct 2016 20:07:01 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u99K71vB090464; Sun, 9 Oct 2016 20:07:01 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201610092007.u99K71vB090464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 9 Oct 2016 20:07:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306912 - stable/11/usr.bin/localedef X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2016 20:07:03 -0000 Author: pfg Date: Sun Oct 9 20:07:01 2016 New Revision: 306912 URL: https://svnweb.freebsd.org/changeset/base/306912 Log: MFC r305813: localedef(1): make better use of calloc(3) arguments. The first argument of calloc(3) should be an ordinal type, and the second a size: split a multiplication to make better use of calloc(3) and detect overflows. Do some other re-ordering and style fixes while here. Modified: stable/11/usr.bin/localedef/collate.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/localedef/collate.c ============================================================================== --- stable/11/usr.bin/localedef/collate.c Sun Oct 9 19:59:20 2016 (r306911) +++ stable/11/usr.bin/localedef/collate.c Sun Oct 9 20:07:01 2016 (r306912) @@ -1204,7 +1204,7 @@ dump_collate(void) subst_t *temp; RB_COUNT(temp, substs, &substs[i], n); collinfo.subst_count[i] = n; - if ((st = calloc(sizeof (collate_subst_t) * n, 1)) == NULL) { + if ((st = calloc(n, sizeof(collate_subst_t))) == NULL) { fprintf(stderr, "out of memory"); return; } @@ -1233,7 +1233,7 @@ dump_collate(void) */ RB_NUMNODES(collelem_t, elem_by_expand, &elem_by_expand, collinfo.chain_count); - chain = calloc(sizeof (collate_chain_t), collinfo.chain_count); + chain = calloc(collinfo.chain_count, sizeof(collate_chain_t)); if (chain == NULL) { fprintf(stderr, "out of memory"); return; @@ -1253,7 +1253,7 @@ dump_collate(void) * Large (> UCHAR_MAX) character priorities */ RB_NUMNODES(collchar_t, collchars, &collchars, n); - large = calloc(n, sizeof (collate_large_t)); + large = calloc(n, sizeof(collate_large_t)); if (large == NULL) { fprintf(stderr, "out of memory"); return; From owner-svn-src-stable-11@freebsd.org Sun Oct 9 20:13:00 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D08DC0B684; Sun, 9 Oct 2016 20:13:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D887D1BB; Sun, 9 Oct 2016 20:12:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u99KCxZc094148; Sun, 9 Oct 2016 20:12:59 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u99KCxDK094147; Sun, 9 Oct 2016 20:12:59 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201610092012.u99KCxDK094147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 9 Oct 2016 20:12:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306913 - stable/11/usr.bin/patch X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2016 20:13:00 -0000 Author: pfg Date: Sun Oct 9 20:12:58 2016 New Revision: 306913 URL: https://svnweb.freebsd.org/changeset/base/306913 Log: MFC r306560, r306561: patch(1): make some macros look boolean. Minor cleanup inspired by a new patch(1) variant in schily tools. For reference: https://sourceforge.net/p/schillix-on/ Modified: stable/11/usr.bin/patch/common.h Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/patch/common.h ============================================================================== --- stable/11/usr.bin/patch/common.h Sun Oct 9 20:07:01 2016 (r306912) +++ stable/11/usr.bin/patch/common.h Sun Oct 9 20:12:58 2016 (r306913) @@ -47,10 +47,9 @@ /* handy definitions */ -#define strNE(s1,s2) (strcmp(s1, s2)) -#define strEQ(s1,s2) (!strcmp(s1, s2)) -#define strnNE(s1,s2,l) (strncmp(s1, s2, l)) -#define strnEQ(s1,s2,l) (!strncmp(s1, s2, l)) +#define strEQ(s1,s2) (strcmp(s1, s2) == 0) +#define strnNE(s1,s2,l) (strncmp(s1, s2, l) != 0) +#define strnEQ(s1,s2,l) (strncmp(s1, s2, l) == 0) /* typedefs */ From owner-svn-src-stable-11@freebsd.org Sun Oct 9 21:02:35 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 129F3C07918; Sun, 9 Oct 2016 21:02:35 +0000 (UTC) (envelope-from jch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D473ED2C; Sun, 9 Oct 2016 21:02:34 +0000 (UTC) (envelope-from jch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u99L2YHD013353; Sun, 9 Oct 2016 21:02:34 GMT (envelope-from jch@FreeBSD.org) Received: (from jch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u99L2YBN013352; Sun, 9 Oct 2016 21:02:34 GMT (envelope-from jch@FreeBSD.org) Message-Id: <201610092102.u99L2YBN013352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jch set sender to jch@FreeBSD.org using -f From: Julien Charbon Date: Sun, 9 Oct 2016 21:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306922 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2016 21:02:35 -0000 Author: jch Date: Sun Oct 9 21:02:33 2016 New Revision: 306922 URL: https://svnweb.freebsd.org/changeset/base/306922 Log: MFC r306443: Fix an issue with accept_filter introduced with r261242: As a side effect of r261242 when using accept_filter the first call to soisconnected() is done earlier in tcp_input() instead of tcp_do_segment() context. Restore the expected behaviour. Note: This call to soisconnected() seems to be extraneous in all cases (with or without accept_filter). Will be addressed in a separate commit. PR: 212920 Reported by: Alexey Tested by: Alexey, jch Sponsored by: Verisign, Inc. Modified: stable/11/sys/netinet/tcp_syncache.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_syncache.c ============================================================================== --- stable/11/sys/netinet/tcp_syncache.c Sun Oct 9 21:00:49 2016 (r306921) +++ stable/11/sys/netinet/tcp_syncache.c Sun Oct 9 21:02:33 2016 (r306922) @@ -918,7 +918,9 @@ syncache_socket(struct syncache *sc, str tp->t_keepcnt = sototcpcb(lso)->t_keepcnt; tcp_timer_activate(tp, TT_KEEP, TP_KEEPINIT(tp)); - soisconnected(so); + if ((so->so_options & SO_ACCEPTFILTER) == 0) { + soisconnected(so); + } TCPSTAT_INC(tcps_accepts); return (so); From owner-svn-src-stable-11@freebsd.org Mon Oct 10 11:09:10 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C38BC07B4A; Mon, 10 Oct 2016 11:09:10 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEEE9F29; Mon, 10 Oct 2016 11:09:09 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1btYS5-0006oU-Ca; Mon, 10 Oct 2016 14:09:01 +0300 Date: Mon, 10 Oct 2016 14:09:01 +0300 From: Slawa Olhovchenkov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r306661 - in stable/11/sys/dev/cxgbe: . tom Message-ID: <20161010110901.GH6177@zxy.spb.ru> References: <201610032315.u93NFiHE057529@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201610032315.u93NFiHE057529@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 11:09:10 -0000 On Mon, Oct 03, 2016 at 11:15:44PM +0000, John Baldwin wrote: > Author: jhb > Date: Mon Oct 3 23:15:44 2016 > New Revision: 306661 > URL: https://svnweb.freebsd.org/changeset/base/306661 > > Log: > MFC 303405: Add support for zero-copy aio_write() on TOE sockets. > > AIO write requests for a TOE socket on a Chelsio T4+ adapter can now > DMA directly from the user-supplied buffer. This is implemented by > wiring the pages backing the user-supplied buffer and queueing special > mbufs backed by raw VM pages to the socket buffer. The TOE code > recognizes these special mbufs and builds a sglist from the VM page > array associated with the mbuf when queueing a work request to the TOE. > > Because these mbufs do not have an associated virtual address, m_data > is not valid. Thus, the AIO handler does not invoke sosend() directly > for these mbufs but instead inlines portions of sosend_generic() and > tcp_usr_send(). > > An aiotx_buffer structure is used to describe the user buffer (e.g. > it holds the array of VM pages and a reference to the AIO job). The > special mbufs reference this structure via m_ext. Note that a single > job might be split across multiple mbufs (e.g. if it is larger than > the socket buffer size). The 'ext_arg2' member of each mbuf gives an > offset relative to the backing aiotx_buffer. The AIO job associated > with an aiotx_buffer structure is completed when the last reference to > the structure is released. > > Zero-copy aio_write()'s for connections associated with a given > adapter can be enabled/disabled at runtime via the > 'dev.t[45]nex.N.toe.tx_zcopy' sysctl. > > Sponsored by: Chelsio Communications Do you have any public available application patches for support this? May be nginx? From owner-svn-src-stable-11@freebsd.org Mon Oct 10 11:22:13 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A71AC0B11F; Mon, 10 Oct 2016 11:22:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F054CB14; Mon, 10 Oct 2016 11:22:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ABMCNw040488; Mon, 10 Oct 2016 11:22:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ABMBMQ040486; Mon, 10 Oct 2016 11:22:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201610101122.u9ABMBMQ040486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 10 Oct 2016 11:22:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306946 - in stable/11: share/man/man9 sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 11:22:13 -0000 Author: hselasky Date: Mon Oct 10 11:22:11 2016 New Revision: 306946 URL: https://svnweb.freebsd.org/changeset/base/306946 Log: MFC r306441 and r306634: While draining a timeout task prevent the taskqueue_enqueue_timeout() function from restarting the timer. Commonly taskqueue_enqueue_timeout() is called from within the task function itself without any checks for teardown. Then it can happen the timer stays active after the return of taskqueue_drain_timeout(), because the timeout and task is drained separately. This patch factors out the teardown flag into the timeout task itself, allowing existing code to stay as-is instead of applying a teardown flag to each and every of the timeout task consumers. Add assert to taskqueue_drain_timeout() which prevents parallel execution on the same timeout task. Update manual page documenting the return value of taskqueue_enqueue_timeout(). Differential Revision: https://reviews.freebsd.org/D8012 Reviewed by: kib, trasz Modified: stable/11/share/man/man9/taskqueue.9 stable/11/sys/kern/subr_taskqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/taskqueue.9 ============================================================================== --- stable/11/share/man/man9/taskqueue.9 Mon Oct 10 10:58:18 2016 (r306945) +++ stable/11/share/man/man9/taskqueue.9 Mon Oct 10 11:22:11 2016 (r306946) @@ -223,6 +223,8 @@ Otherwise, the task is scheduled for enq after the absolute value of .Va ticks is passed. +This function returns -1 if the task is being drained. +Otherwise, the number of pending calls is returned. .Pp The .Fn taskqueue_cancel Modified: stable/11/sys/kern/subr_taskqueue.c ============================================================================== --- stable/11/sys/kern/subr_taskqueue.c Mon Oct 10 10:58:18 2016 (r306945) +++ stable/11/sys/kern/subr_taskqueue.c Mon Oct 10 11:22:11 2016 (r306946) @@ -81,6 +81,7 @@ struct taskqueue { #define TQ_FLAGS_UNLOCKED_ENQUEUE (1 << 2) #define DT_CALLOUT_ARMED (1 << 0) +#define DT_DRAIN_IN_PROGRESS (1 << 1) #define TQ_LOCK(tq) \ do { \ @@ -299,7 +300,11 @@ taskqueue_enqueue_timeout(struct taskque KASSERT(!queue->tq_spin, ("Timeout for spin-queue")); timeout_task->q = queue; res = timeout_task->t.ta_pending; - if (ticks == 0) { + if (timeout_task->f & DT_DRAIN_IN_PROGRESS) { + /* Do nothing */ + TQ_UNLOCK(queue); + res = -1; + } else if (ticks == 0) { taskqueue_enqueue_locked(queue, &timeout_task->t); /* The lock is released inside. */ } else { @@ -559,8 +564,24 @@ taskqueue_drain_timeout(struct taskqueue struct timeout_task *timeout_task) { + /* + * Set flag to prevent timer from re-starting during drain: + */ + TQ_LOCK(queue); + KASSERT((timeout_task->f & DT_DRAIN_IN_PROGRESS) == 0, + ("Drain already in progress")); + timeout_task->f |= DT_DRAIN_IN_PROGRESS; + TQ_UNLOCK(queue); + callout_drain(&timeout_task->c); taskqueue_drain(queue, &timeout_task->t); + + /* + * Clear flag to allow timer to re-start: + */ + TQ_LOCK(queue); + timeout_task->f &= ~DT_DRAIN_IN_PROGRESS; + TQ_UNLOCK(queue); } static void From owner-svn-src-stable-11@freebsd.org Mon Oct 10 11:30:37 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00285C0B4E0; Mon, 10 Oct 2016 11:30:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7F15305; Mon, 10 Oct 2016 11:30:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ABUZSf040960; Mon, 10 Oct 2016 11:30:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ABUZRh040959; Mon, 10 Oct 2016 11:30:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201610101130.u9ABUZRh040959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 10 Oct 2016 11:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306949 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 11:30:37 -0000 Author: hselasky Date: Mon Oct 10 11:30:35 2016 New Revision: 306949 URL: https://svnweb.freebsd.org/changeset/base/306949 Log: MFC r306451: The IORESOURCE_XXX defines should resemble a bitmask while SYS_RES_XXX are not bitmasks. Fix return value of pci_resource_flags() to reflect this change. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Oct 10 11:27:59 2016 (r306948) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Oct 10 11:30:35 2016 (r306949) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -121,9 +121,9 @@ struct pci_device_id { #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x04 /* Supported Link Speed 5.0GT/s */ #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x08 /* Supported Link Speed 8.0GT/s */ -#define IORESOURCE_MEM SYS_RES_MEMORY -#define IORESOURCE_IO SYS_RES_IOPORT -#define IORESOURCE_IRQ SYS_RES_IRQ +#define IORESOURCE_MEM (1 << SYS_RES_MEMORY) +#define IORESOURCE_IO (1 << SYS_RES_IOPORT) +#define IORESOURCE_IRQ (1 << SYS_RES_IRQ) enum pci_bus_speed { PCI_SPEED_UNKNOWN = -1, @@ -230,17 +230,28 @@ pci_resource_len(struct pci_dev *pdev, i return rle->count; } +static inline int +pci_resource_type(struct pci_dev *pdev, int bar) +{ + struct resource_list_entry *rle; + + if ((rle = _pci_get_bar(pdev, bar)) == NULL) + return (-1); + return (rle->type); +} + /* * All drivers just seem to want to inspect the type not flags. */ static inline int pci_resource_flags(struct pci_dev *pdev, int bar) { - struct resource_list_entry *rle; + int type; - if ((rle = _pci_get_bar(pdev, bar)) == NULL) + type = pci_resource_type(pdev, bar); + if (type < 0) return (0); - return rle->type; + return (1 << type); } static inline const char * @@ -300,8 +311,8 @@ pci_request_region(struct pci_dev *pdev, int rid; int type; - type = pci_resource_flags(pdev, bar); - if (type == 0) + type = pci_resource_type(pdev, bar); + if (type < 0) return (-ENODEV); rid = PCIR_BAR(bar); if (bus_alloc_resource_any(pdev->dev.bsddev, type, &rid, From owner-svn-src-stable-11@freebsd.org Mon Oct 10 11:38:56 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0F2EC0BAE3; Mon, 10 Oct 2016 11:38:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E999FE6; Mon, 10 Oct 2016 11:38:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ABctNj044709; Mon, 10 Oct 2016 11:38:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ABctto044708; Mon, 10 Oct 2016 11:38:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201610101138.u9ABctto044708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 10 Oct 2016 11:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306952 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 11:38:56 -0000 Author: hselasky Date: Mon Oct 10 11:38:55 2016 New Revision: 306952 URL: https://svnweb.freebsd.org/changeset/base/306952 Log: MFC r306453: Set hardware stats flag to avoid double counting the number of incoming bytes. Found by: Ben RUBSON Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 10 11:36:43 2016 (r306951) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 10 11:38:55 2016 (r306952) @@ -2903,6 +2903,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *m ifp->if_capabilities |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU; ifp->if_capabilities |= IFCAP_LRO; ifp->if_capabilities |= IFCAP_TSO | IFCAP_VLAN_HWTSO; + ifp->if_capabilities |= IFCAP_HWSTATS; /* set TSO limits so that we don't have to drop TX packets */ ifp->if_hw_tsomax = MLX5E_MAX_TX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); From owner-svn-src-stable-11@freebsd.org Mon Oct 10 11:42:27 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39952C0BD0E; Mon, 10 Oct 2016 11:42:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0930E9BD; Mon, 10 Oct 2016 11:42:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ABgQ0J048747; Mon, 10 Oct 2016 11:42:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ABgQrQ048746; Mon, 10 Oct 2016 11:42:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201610101142.u9ABgQrQ048746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 10 Oct 2016 11:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306954 - stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 11:42:27 -0000 Author: hselasky Date: Mon Oct 10 11:42:25 2016 New Revision: 306954 URL: https://svnweb.freebsd.org/changeset/base/306954 Log: MFC r306454: Set hardware stats flag to avoid double counting the number of incoming bytes. Found by: Ben RUBSON Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Oct 10 11:40:52 2016 (r306953) +++ stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Oct 10 11:42:25 2016 (r306954) @@ -2165,6 +2165,7 @@ int mlx4_en_init_netdev(struct mlx4_en_d dev->if_capabilities |= IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWFILTER; dev->if_capabilities |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU; dev->if_capabilities |= IFCAP_LRO; + dev->if_capabilities |= IFCAP_HWSTATS; if (mdev->LSO_support) dev->if_capabilities |= IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTSO; From owner-svn-src-stable-11@freebsd.org Mon Oct 10 11:46:09 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57EBEC0BDF1; Mon, 10 Oct 2016 11:46:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33FD0D02; Mon, 10 Oct 2016 11:46:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ABk8Fc049022; Mon, 10 Oct 2016 11:46:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ABk8mw049020; Mon, 10 Oct 2016 11:46:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201610101146.u9ABk8mw049020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 10 Oct 2016 11:46:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306956 - in stable/11/sys/dev/usb: . serial X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 11:46:09 -0000 Author: hselasky Date: Mon Oct 10 11:46:08 2016 New Revision: 306956 URL: https://svnweb.freebsd.org/changeset/base/306956 Log: MFC r306478: Add new USB ID. While at it remove some whitespaces. Submitted by: Jose Luis Duran PR: 213110 Modified: stable/11/sys/dev/usb/serial/u3g.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/11/sys/dev/usb/serial/u3g.c Mon Oct 10 11:43:55 2016 (r306955) +++ stable/11/sys/dev/usb/serial/u3g.c Mon Oct 10 11:46:08 2016 (r306956) @@ -522,6 +522,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(SIERRA, MC5728, 0), U3G_DEV(SIERRA, MC7354, 0), U3G_DEV(SIERRA, MC7355, 0), + U3G_DEV(SIERRA, MC7430, 0), U3G_DEV(SIERRA, MC8700, 0), U3G_DEV(SIERRA, MC8755, 0), U3G_DEV(SIERRA, MC8755_2, 0), @@ -631,7 +632,7 @@ u3g_sael_m460_init(struct usb_device *ud static const uint8_t setup[][24] = { { 0x41, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x41, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x41, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + { 0x41, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0xc1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02 }, @@ -643,7 +644,7 @@ u3g_sael_m460_init(struct usb_device *ud { 0x41, 0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }, { 0x41, 0x19, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x13 }, - { 0x41, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + { 0x41, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x09, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00 }, { 0x41, 0x12, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00 }, @@ -653,7 +654,7 @@ u3g_sael_m460_init(struct usb_device *ud { 0x41, 0x19, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x13 }, { 0x41, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00 }, { 0x41, 0x07, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 }, }; @@ -687,7 +688,7 @@ u3g_sael_m460_init(struct usb_device *ud DPRINTFN(0, "too small buffer\n"); continue; } - err = usbd_do_request(udev, NULL, &req, + err = usbd_do_request(udev, NULL, &req, __DECONST(uint8_t *, &setup[n][8])); } if (err) { @@ -863,7 +864,7 @@ u3g_attach(device_t dev) } /* copy in USB config */ - for (n = 0; n != U3G_N_TRANSFER; n++) + for (n = 0; n != U3G_N_TRANSFER; n++) u3g_config_tmp[n] = u3g_config[n]; device_set_usb_desc(dev); Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Mon Oct 10 11:43:55 2016 (r306955) +++ stable/11/sys/dev/usb/usbdevs Mon Oct 10 11:46:08 2016 (r306956) @@ -4083,6 +4083,7 @@ product SIERRA E6893 0x6893 E6893 product SIERRA MC8700 0x68A3 MC8700 product SIERRA MC7354 0x68C0 MC7354 product SIERRA MC7355 0x9041 MC7355 +product SIERRA MC7430 0x9071 Sierra Wireless MC7430 Qualcomm Snapdragon X7 LTE-A product SIERRA AC313U 0x68aa Sierra Wireless AirCard 313U product SIERRA TRUINSTALL 0x0fff Aircard Tru Installer From owner-svn-src-stable-11@freebsd.org Mon Oct 10 11:51:48 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B54D5C0B2AB; Mon, 10 Oct 2016 11:51:48 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8361E986; Mon, 10 Oct 2016 11:51:48 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ABplmb052789; Mon, 10 Oct 2016 11:51:47 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ABplsw052788; Mon, 10 Oct 2016 11:51:47 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201610101151.u9ABplsw052788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Mon, 10 Oct 2016 11:51:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306960 - stable/11/sys/i386/i386 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 11:51:48 -0000 Author: tijl Date: Mon Oct 10 11:51:47 2016 New Revision: 306960 URL: https://svnweb.freebsd.org/changeset/base/306960 Log: MFC: r306318 Allocate a zeroed LDT. Failing to do this might result in the LDT appearing to run out of free descriptors because of random junk in the descriptor's 'sd_type' field. http://lists.freebsd.org/pipermail/freebsd-amd64/2014-May/016088.html PR: 212639 Submitted by: wheelcomplex@gmail.com Modified: stable/11/sys/i386/i386/sys_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/i386/sys_machdep.c ============================================================================== --- stable/11/sys/i386/i386/sys_machdep.c Mon Oct 10 11:49:43 2016 (r306959) +++ stable/11/sys/i386/i386/sys_machdep.c Mon Oct 10 11:51:47 2016 (r306960) @@ -438,7 +438,7 @@ user_ldt_alloc(struct mdproc *mdp, int l new_ldt->ldt_len = len = NEW_MAX_LD(len); new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_arena, - len * sizeof(union descriptor), M_WAITOK); + len * sizeof(union descriptor), M_WAITOK | M_ZERO); new_ldt->ldt_refcnt = 1; new_ldt->ldt_active = 0; From owner-svn-src-stable-11@freebsd.org Mon Oct 10 15:42:52 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22047C0C01C; Mon, 10 Oct 2016 15:42:52 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9EF4F2; Mon, 10 Oct 2016 15:42:51 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AFgoCF042640; Mon, 10 Oct 2016 15:42:50 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AFgoKh042639; Mon, 10 Oct 2016 15:42:50 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101542.u9AFgoKh042639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 15:42:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306967 - stable/11/bin/chio X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 15:42:52 -0000 Author: sevan (doc committer) Date: Mon Oct 10 15:42:50 2016 New Revision: 306967 URL: https://svnweb.freebsd.org/changeset/base/306967 Log: MFC r306584: Move the description of CHANGER variable to ENVIRONMENT section rather than in the DESCRIPTION section. From OpenBSD src/bin/chio/chio.1 r1.23 PR: 212158 Approved by: bjk Obtained from: OpenBSD Differential Revision: https://reviews.freebsd.org/D8117 Modified: stable/11/bin/chio/chio.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/chio/chio.1 ============================================================================== --- stable/11/bin/chio/chio.1 Mon Oct 10 15:40:08 2016 (r306966) +++ stable/11/bin/chio/chio.1 Mon Oct 10 15:42:50 2016 (r306967) @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 14, 1998 +.Dd October 2, 2016 .Dt CHIO 1 .Os .Sh NAME @@ -61,10 +61,6 @@ rather than the default device .Pa /dev/ch0 . .El .Pp -The default changer may be overridden by setting the environment variable -.Ev CHANGER -to the desired changer device. -.Pp A medium changer apparatus is made up of .Em elements . There are five element types: @@ -265,6 +261,12 @@ Element supports passing media (exportin .It INENAB Element supports receiving media (importing) from an outside human operator. .El +.Sh ENVIRONMENT +.Bl -tag -width CHANGER +.It Ev CHANGER +The default changer may be overridden by setting this environmental +variable to the desired changer device. +.El .Sh FILES .Bl -tag -width /dev/ch0 -compact .It Pa /dev/ch0 From owner-svn-src-stable-11@freebsd.org Mon Oct 10 15:47:41 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EFB4C0C118; Mon, 10 Oct 2016 15:47:41 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B6DA82E; Mon, 10 Oct 2016 15:47:41 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AFle9T043002; Mon, 10 Oct 2016 15:47:40 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AFleMN043001; Mon, 10 Oct 2016 15:47:40 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101547.u9AFleMN043001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 15:47:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306970 - stable/11/bin/chio X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 15:47:41 -0000 Author: sevan (doc committer) Date: Mon Oct 10 15:47:39 2016 New Revision: 306970 URL: https://svnweb.freebsd.org/changeset/base/306970 Log: MFC r306714: Document where chio(1) originated from & which version of FreeBSD first included it. PR: 211776 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/bin/chio/chio.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/chio/chio.1 ============================================================================== --- stable/11/bin/chio/chio.1 Mon Oct 10 15:47:30 2016 (r306969) +++ stable/11/bin/chio/chio.1 Mon Oct 10 15:47:39 2016 (r306970) @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 2, 2016 +.Dd October 5, 2016 .Dt CHIO 1 .Os .Sh NAME @@ -287,6 +287,14 @@ Configure the changer to use picker 2 (t .Sh SEE ALSO .Xr mt 1 , .Xr mount 8 +.Sh HISTORY +A +.Nm +utility appeared in +.Nx 1.3 . +.Nm +first appeared in +.Fx 2.2 . .Sh AUTHORS .An -nosplit The From owner-svn-src-stable-11@freebsd.org Mon Oct 10 15:49:50 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 971DAC0C299; Mon, 10 Oct 2016 15:49:50 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55E5FB9A; Mon, 10 Oct 2016 15:49:50 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AFnnAM043198; Mon, 10 Oct 2016 15:49:49 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AFnndj043196; Mon, 10 Oct 2016 15:49:49 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610101549.u9AFnndj043196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 10 Oct 2016 15:49:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306972 - in stable/11/release/doc: en_US.ISO8859-1/errata share/xml X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 15:49:50 -0000 Author: gjb Date: Mon Oct 10 15:49:49 2016 New Revision: 306972 URL: https://svnweb.freebsd.org/changeset/base/306972 Log: - Add known-issue entries for 11.0-RELEASE errata.html. - Bump version numbers in release.ent. - Bump the copyright year for the errata file. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml stable/11/release/doc/share/xml/release.ent Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Mon Oct 10 15:48:40 2016 (r306971) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Mon Oct 10 15:49:49 2016 (r306972) @@ -19,7 +19,7 @@ $FreeBSD$ - 2015 + 2016 The &os; Documentation Project @@ -89,7 +89,79 @@ Open Issues - No open issues. + + + An issue was discovered with Amazon® EC2™ + images which would cause the virtual machine to hang during + boot when upgrading from previous FreeBSD versions. New + EC2™ installations are not affected, but exisiting + installations running earlier releases are advised to wait + until the issue is resolved in an Errata Notice before + upgrading. An Errata Notice to address this is planned + following the release. + + + + &os;/&arch.i386; installed on ZFS may crash during boot + when the ZFS pool mount is attempted while booting an + unmodified GENERIC kernel. + + A system tunable has been added as of revision + r286584 to make the + kern.kstack_pages tunable configurable + without recompiling the kernel. + + To mitigate system crashes with such configurations, + chose Escape to loader prompt in the boot + menu and enter the following lines from &man.loader.8; + prompt, after an OK: + + set kern.kstack_pages=4 +boot + + Add this line to + /boot/loader.conf for the change to + persist across reboots: + + kern.kstack_pages=4 + + + + A bug was diagnosed in interaction of the + pmap_activate() function and + TLB shootdown IPI + handler on amd64 systems which have PCID + features but do not implement the INVPCID + instruction. On such machines, such as SandyBridge™ + and IvyBridge™ microarchitectures, set the loader + tunable vm.pmap.pcid_enabled=0 during + boot: + + set vm.pmap.pcid_enabled=0 +boot + + Add this line to + /boot/loader.conf for the change to + persist across reboots: + + To check if the system is affected, check + &man.dmesg.8; for PCID listed in the + "Features2", and absence of + INVPCID in the "Structured Extended + Features". If the PCID feature is + not present, or INVPCID is present, + system is not affected. + + vm.pmap.pcid_enabled=0 + + + + The Release Notes errorneously states the + WITH_SYSTEM_COMPILER &man.src.conf.5; + option is enabled by default, however this was disabled + prior to the final release build. + + Modified: stable/11/release/doc/share/xml/release.ent ============================================================================== --- stable/11/release/doc/share/xml/release.ent Mon Oct 10 15:48:40 2016 (r306971) +++ stable/11/release/doc/share/xml/release.ent Mon Oct 10 15:49:49 2016 (r306972) @@ -11,15 +11,15 @@ - + - + - + @@ -39,8 +39,8 @@ doc.relnotes.mk when updating this --> - - + + @@ -58,7 +58,7 @@ - + From owner-svn-src-stable-11@freebsd.org Mon Oct 10 15:53:57 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EE80C0C44D; Mon, 10 Oct 2016 15:53:57 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DCAB75; Mon, 10 Oct 2016 15:53:57 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AFru9I046883; Mon, 10 Oct 2016 15:53:56 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AFrumB046882; Mon, 10 Oct 2016 15:53:56 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101553.u9AFrumB046882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 15:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306973 - stable/11/bin/ed X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 15:53:57 -0000 Author: sevan (doc committer) Date: Mon Oct 10 15:53:56 2016 New Revision: 306973 URL: https://svnweb.freebsd.org/changeset/base/306973 Log: MFC r306581: Use .At macro instead of specifying AT&T UNIX literaly. PR: 212034 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8114 Modified: stable/11/bin/ed/ed.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/ed/ed.1 ============================================================================== --- stable/11/bin/ed/ed.1 Mon Oct 10 15:49:49 2016 (r306972) +++ stable/11/bin/ed/ed.1 Mon Oct 10 15:53:56 2016 (r306973) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd July 3, 2004 +.Dd October 2, 2016 .Dt ED 1 .Os .Sh NAME @@ -998,7 +998,7 @@ per line overhead: 4 ints An .Nm command appeared in -Version 1 AT&T UNIX. +.At v1 . .Sh BUGS The .Nm From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:06:56 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C476C0C8B2; Mon, 10 Oct 2016 16:06:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B442E76; Mon, 10 Oct 2016 16:06:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AG6ti4051152; Mon, 10 Oct 2016 16:06:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AG6ta1051151; Mon, 10 Oct 2016 16:06:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610101606.u9AG6ta1051151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 10 Oct 2016 16:06:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306975 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:06:56 -0000 Author: gjb Date: Mon Oct 10 16:06:55 2016 New Revision: 306975 URL: https://svnweb.freebsd.org/changeset/base/306975 Log: Fix a typo. Spotted by: lidl Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Mon Oct 10 15:54:32 2016 (r306974) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Mon Oct 10 16:06:55 2016 (r306975) @@ -156,7 +156,7 @@ boot - The Release Notes errorneously states the + The Release Notes erroneously states the WITH_SYSTEM_COMPILER &man.src.conf.5; option is enabled by default, however this was disabled prior to the final release build. From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:08:30 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84AC9C0C987; Mon, 10 Oct 2016 16:08:30 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50BA720F; Mon, 10 Oct 2016 16:08:30 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AG8Tq1051376; Mon, 10 Oct 2016 16:08:29 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AG8T9N051375; Mon, 10 Oct 2016 16:08:29 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101608.u9AG8T9N051375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:08:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306977 - stable/11/bin/chmod X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:08:30 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:08:29 2016 New Revision: 306977 URL: https://svnweb.freebsd.org/changeset/base/306977 Log: MFC r306582: "POSIX doesn't specify -h." - r1.27 from NetBSD http://man.openbsd.org/?query=chmod&apropos=0&sec=0&arch=default&manpath=POSIX-2013 PR: 212337 Approved by: bcr (mentor) Obtained from: NetBSD Differential Revision: https://reviews.freebsd.org/D8118 Modified: stable/11/bin/chmod/chmod.c Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/chmod/chmod.c ============================================================================== --- stable/11/bin/chmod/chmod.c Mon Oct 10 16:07:23 2016 (r306976) +++ stable/11/bin/chmod/chmod.c Mon Oct 10 16:08:29 2016 (r306977) @@ -91,12 +91,11 @@ main(int argc, char *argv[]) break; case 'h': /* - * In System V (and probably POSIX.2) the -h option - * causes chmod to change the mode of the symbolic - * link. 4.4BSD's symbolic links didn't have modes, - * so it was an undocumented noop. In FreeBSD 3.0, - * lchmod(2) is introduced and this option does real - * work. + * In System V the -h option causes chmod to change + * the mode of the symbolic link. 4.4BSD's symbolic + * links didn't have modes, so it was an undocumented + * noop. In FreeBSD 3.0, lchmod(2) is introduced and + * this option does real work. */ hflag = 1; break; From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:11:03 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74807C0CAAB; Mon, 10 Oct 2016 16:11:03 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40C0276D; Mon, 10 Oct 2016 16:11:03 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGB24i053764; Mon, 10 Oct 2016 16:11:02 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGB2Tn053763; Mon, 10 Oct 2016 16:11:02 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101611.u9AGB2Tn053763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:11:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306978 - stable/11/sbin/ccdconfig X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:11:03 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:11:02 2016 New Revision: 306978 URL: https://svnweb.freebsd.org/changeset/base/306978 Log: MFC r306598 ccdconfig first appeared in NetBSD 1.1 From NetBSD man page, confirmed with repo tags in CVS [1] (there was also no 1.0a release according to [2]) [1] http://cvsweb.netbsd.org/bsdweb.cgi/src/sbin/ccdconfig/ccdconfig.c [2] http://netbsd.org/releases/formal.html#history PR: 212437 Approved by: bcr (mentor) Obtained from: NetBSD Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/ccdconfig/ccdconfig.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ccdconfig/ccdconfig.8 ============================================================================== --- stable/11/sbin/ccdconfig/ccdconfig.8 Mon Oct 10 16:08:29 2016 (r306977) +++ stable/11/sbin/ccdconfig/ccdconfig.8 Mon Oct 10 16:11:02 2016 (r306978) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd October 3, 2016 .Dt CCDCONFIG 8 .Os .Sh NAME @@ -159,7 +159,7 @@ It reads as a two disk stripe of da4 and to a two disk stripe of da6 and da7. The last example is a simple mirror. -The 2nd slice of /dev/da8 is mirrored with the 3rd slice of /dev/da9 +The second slice of /dev/da8 is mirrored with the third slice of /dev/da9 and assigned to ccd0. .Bd -literal # ccdconfig ccd0 64 none /dev/da0s1 /dev/da1s1 /dev/da2s1 /dev/da3s1 @@ -246,7 +246,7 @@ and The .Nm utility first appeared in -.Nx 1.0a . +.Nx 1.1 . .Sh BUGS The initial disklabel returned by .Xr ccd 4 From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:14:50 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF085C0CC17; Mon, 10 Oct 2016 16:14:50 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0A29D3E; Mon, 10 Oct 2016 16:14:50 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGEngj055351; Mon, 10 Oct 2016 16:14:49 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGEnit055350; Mon, 10 Oct 2016 16:14:49 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101614.u9AGEnit055350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:14:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306981 - stable/11/sbin/dump X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:14:51 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:14:49 2016 New Revision: 306981 URL: https://svnweb.freebsd.org/changeset/base/306981 Log: MFC r306600: dump(8) first appeared in V4 UNIX http://minnie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man8 PR: 212444 Approved by: bcr (mentor) Obtained from: TUHS Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/dump/dump.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/dump/dump.8 ============================================================================== --- stable/11/sbin/dump/dump.8 Mon Oct 10 16:14:00 2016 (r306980) +++ stable/11/sbin/dump/dump.8 Mon Oct 10 16:14:49 2016 (r306981) @@ -29,7 +29,7 @@ .\" @(#)dump.8 8.3 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd February 24, 2006 +.Dd October 3, 2016 .Dt DUMP 8 .Os .Sh NAME @@ -514,7 +514,7 @@ Many, and verbose. A .Nm utility appeared in -.At v6 . +.At v4 . .Sh BUGS Fewer than 32 read errors on the file system are ignored, though all errors will generate a warning message. From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:16:27 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DBE6C0CCD1; Mon, 10 Oct 2016 16:16:27 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CB59FBF; Mon, 10 Oct 2016 16:16:27 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGGQqE055833; Mon, 10 Oct 2016 16:16:26 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGGQbJ055832; Mon, 10 Oct 2016 16:16:26 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101616.u9AGGQbJ055832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:16:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306982 - stable/11/sbin/dumpon X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:16:27 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:16:26 2016 New Revision: 306982 URL: https://svnweb.freebsd.org/changeset/base/306982 Log: MFC r306601: dumpon(8) appears to be present in FreeBSD 2.0.5, despite initial import of man page listed FreeBSD 2.1. PR: 212445 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/dumpon/dumpon.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/dumpon/dumpon.8 ============================================================================== --- stable/11/sbin/dumpon/dumpon.8 Mon Oct 10 16:14:49 2016 (r306981) +++ stable/11/sbin/dumpon/dumpon.8 Mon Oct 10 16:16:26 2016 (r306982) @@ -28,7 +28,7 @@ .\" From: @(#)swapon.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd October 8, 2014 +.Dd October 3, 2016 .Dt DUMPON 8 .Os .Sh NAME @@ -154,7 +154,7 @@ boot-time system configuration The .Nm utility appeared in -.Fx 2.1 . +.Fx 2.0.5 . .Sh BUGS Because the file system layer is already dead by the time a crash dump is taken, it is not possible to send crash dumps directly to a file. From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:22:36 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C345C0CF7F; Mon, 10 Oct 2016 16:22:36 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCBFAD02; Mon, 10 Oct 2016 16:22:35 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGMY9I060053; Mon, 10 Oct 2016 16:22:34 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGMYlm060052; Mon, 10 Oct 2016 16:22:34 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101622.u9AGMYlm060052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306985 - stable/11/sbin/fsck_msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:22:36 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:22:34 2016 New Revision: 306985 URL: https://svnweb.freebsd.org/changeset/base/306985 Log: MFC r306602: Mention the version of NetBSD the utility originated from. PR: 212476 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/fsck_msdosfs/fsck_msdosfs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck_msdosfs/fsck_msdosfs.8 ============================================================================== --- stable/11/sbin/fsck_msdosfs/fsck_msdosfs.8 Mon Oct 10 16:21:34 2016 (r306984) +++ stable/11/sbin/fsck_msdosfs/fsck_msdosfs.8 Mon Oct 10 16:22:34 2016 (r306985) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 4, 2009 +.Dd October 3, 2016 .Dt FSCK_MSDOSFS 8 .Os .Sh NAME @@ -114,7 +114,10 @@ as the answer to all operator questions. .Sh HISTORY The .Nm -utility first appeared in +utility appeared in +.Nx 1.2 . +.Nm +first appeared in .Fx 4.4 . .Sh BUGS The From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:24:06 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9A64C0B0C5; Mon, 10 Oct 2016 16:24:06 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B20FF94; Mon, 10 Oct 2016 16:24:06 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGO51b060171; Mon, 10 Oct 2016 16:24:05 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGO5uW060170; Mon, 10 Oct 2016 16:24:05 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101624.u9AGO5uW060170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:24:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306986 - stable/11/sbin/fsdb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:24:06 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:24:05 2016 New Revision: 306986 URL: https://svnweb.freebsd.org/changeset/base/306986 Log: MFC r306603: Document which version of BSD first showed up in and add the version info for NetBSD & FreeBSD. PR: 212477 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/fsdb/fsdb.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsdb/fsdb.8 ============================================================================== --- stable/11/sbin/fsdb/fsdb.8 Mon Oct 10 16:22:34 2016 (r306985) +++ stable/11/sbin/fsdb/fsdb.8 Mon Oct 10 16:24:05 2016 (r306986) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 24, 2006 +.Dd October 3, 2016 .Dt FSDB 8 .Os .Sh NAME @@ -239,19 +239,20 @@ Exit the program. .Sh HISTORY The .Nm -utility uses the source code for +utility appeared in +.Bx 4.3 Tahoe . +It used the source code for .Xr fsck 8 to implement most of the file system manipulation code. The remainder of .Nm -first appeared in -.Nx , +appeared in +.Nx 1.1 written by .An John T. Kohl . -.Pp -.An Peter Wemm -ported it to -.Fx . +It first appeared in +.Fx 2.1.5 +ported by Peter Wemm. .Sh BUGS Manipulation of ``short'' symlinks has no effect. In particular, one should not From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:27:33 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65475C0B25D; Mon, 10 Oct 2016 16:27:33 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 364B36C1; Mon, 10 Oct 2016 16:27:33 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGRW1Y060508; Mon, 10 Oct 2016 16:27:32 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGRWns060507; Mon, 10 Oct 2016 16:27:32 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101627.u9AGRWns060507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:27:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306989 - stable/11/sbin/gbde X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:27:33 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:27:32 2016 New Revision: 306989 URL: https://svnweb.freebsd.org/changeset/base/306989 Log: MFC r306604: gbde first appeared in FreeBSD 5.0 PR: 212478 Approved by: brc (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/gbde/gbde.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/gbde/gbde.8 ============================================================================== --- stable/11/sbin/gbde/gbde.8 Mon Oct 10 16:26:38 2016 (r306988) +++ stable/11/sbin/gbde/gbde.8 Mon Oct 10 16:27:32 2016 (r306989) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 27, 2014 +.Dd October 3, 2016 .Dt GBDE 8 .Os .Sh NAME @@ -263,6 +263,9 @@ under DARPA/SPAWAR contract N66001-01-C- .Pq Dq CBOSS , as part of the DARPA CHATS research program. +.Nm +first appeared in +.Fx 5.0 . .Sh AUTHORS .An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .Sh BUGS From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:29:15 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9DA2C0B2DC; Mon, 10 Oct 2016 16:29:15 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8EEC8AB; Mon, 10 Oct 2016 16:29:15 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGTEfu060629; Mon, 10 Oct 2016 16:29:14 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGTEmg060628; Mon, 10 Oct 2016 16:29:14 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101629.u9AGTEmg060628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306990 - stable/11/sbin/init X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:29:16 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:29:14 2016 New Revision: 306990 URL: https://svnweb.freebsd.org/changeset/base/306990 Log: MFC r306605: init was there in UNIX from V1 http://minnie.tuhs.org/cgi-bin/utree.pl?file=V1/init.s PR: 212503 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/init/init.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/init/init.8 ============================================================================== --- stable/11/sbin/init/init.8 Mon Oct 10 16:27:32 2016 (r306989) +++ stable/11/sbin/init/init.8 Mon Oct 10 16:29:14 2016 (r306990) @@ -31,7 +31,7 @@ .\" @(#)init.8 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd July 24, 2015 +.Dd October 3, 2016 .Dt INIT 8 .Os .Sh NAME @@ -345,7 +345,7 @@ a persistent device error condition. An .Nm utility appeared in -.At v6 . +.At v1 . .Sh CAVEATS Systems without .Xr sysctl 8 From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:33:45 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3D18C0B5FB; Mon, 10 Oct 2016 16:33:45 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9060A11E; Mon, 10 Oct 2016 16:33:45 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGXiL1064407; Mon, 10 Oct 2016 16:33:44 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGXiqw064406; Mon, 10 Oct 2016 16:33:44 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101633.u9AGXiqw064406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:33:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306993 - stable/11/sbin/mknod X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:33:45 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:33:44 2016 New Revision: 306993 URL: https://svnweb.freebsd.org/changeset/base/306993 Log: MFC r306606: mknod appeared in V4 UNIX http://minnie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man8/mknod.8 PR: 212509 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/mknod/mknod.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mknod/mknod.8 ============================================================================== --- stable/11/sbin/mknod/mknod.8 Mon Oct 10 16:32:55 2016 (r306992) +++ stable/11/sbin/mknod/mknod.8 Mon Oct 10 16:33:44 2016 (r306993) @@ -28,7 +28,7 @@ .\" @(#)mknod.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd January 31, 2010 +.Dd October 3, 2016 .Dt MKNOD 8 .Os .Sh NAME @@ -149,4 +149,4 @@ nodes cannot be used to access devices. A .Nm utility appeared in -.At v6 . +.At v4 . From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:35:26 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAC3DC0B6FA; Mon, 10 Oct 2016 16:35:26 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A8A62DB; Mon, 10 Oct 2016 16:35:26 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGZPZk064553; Mon, 10 Oct 2016 16:35:25 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGZPRP064552; Mon, 10 Oct 2016 16:35:25 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101635.u9AGZPRP064552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:35:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306994 - stable/11/sbin/mksnap_ffs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:35:26 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:35:25 2016 New Revision: 306994 URL: https://svnweb.freebsd.org/changeset/base/306994 Log: MFC r306607: mksnap_ffs appeared in FreeBSD 5.1. PR: 212510 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/mksnap_ffs/mksnap_ffs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mksnap_ffs/mksnap_ffs.8 ============================================================================== --- stable/11/sbin/mksnap_ffs/mksnap_ffs.8 Mon Oct 10 16:33:44 2016 (r306993) +++ stable/11/sbin/mksnap_ffs/mksnap_ffs.8 Mon Oct 10 16:35:25 2016 (r306994) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 14, 2011 +.Dd October 3, 2016 .Dt MKSNAP_FFS 8 .Os .Sh NAME @@ -75,7 +75,7 @@ mount -o ro /dev/md0 /mnt/ The .Nm utility first appeared in -.Fx 5.0 . +.Fx 5.1 . .Sh CAVEATS The disk full situation is not handled gracefully and may lead to a system panic when no free blocks are found. From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:38:53 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60D0AC0B9D6; Mon, 10 Oct 2016 16:38:53 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C1B3A2C; Mon, 10 Oct 2016 16:38:53 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGcqBC064880; Mon, 10 Oct 2016 16:38:52 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGcq5N064879; Mon, 10 Oct 2016 16:38:52 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101638.u9AGcq5N064879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306997 - stable/11/sbin/mount_fusefs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:38:53 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:38:52 2016 New Revision: 306997 URL: https://svnweb.freebsd.org/changeset/base/306997 Log: MFC r306610: Note mount_fusefs appeared in FreeBSD 10. Move note regarding implementation to caveats. Address issued raised by Igor. PR: 212513 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/mount_fusefs/mount_fusefs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mount_fusefs/mount_fusefs.8 ============================================================================== --- stable/11/sbin/mount_fusefs/mount_fusefs.8 Mon Oct 10 16:38:07 2016 (r306996) +++ stable/11/sbin/mount_fusefs/mount_fusefs.8 Mon Oct 10 16:38:52 2016 (r306997) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 11, 2012 +.Dd October 3, 2016 .Dt MOUNT_FUSEFS 8 .Os .Sh NAME @@ -52,7 +52,8 @@ .Sh DESCRIPTION Basic usage is to start a fuse daemon on the given .Ar special -file. In practice, the daemon is assigned a +file. +In practice, the daemon is assigned a .Ar special file automatically, which can then be indentified via .Xr fstat 1 . @@ -68,7 +69,8 @@ is appended to the list of arguments, .Nm will call the .Ar fuse_daemon -via that command. In that way the +via that command. +In that way the .Ar fuse_daemon will be instructed to attach itself to .Ar special . @@ -101,7 +103,8 @@ The options are as follows: .It Fl A , Ic --reject-allow_other Prohibit the .Cm allow_other -mount flag. Intended for use in scripts and the +mount flag. +Intended for use in scripts and the .Xr sudoers 5 file. .It Fl S , Ic --safe @@ -143,8 +146,8 @@ Only root can use this option Limit size of read requests to .Ar n .It Cm private -Refuse shared mounting of the daemon. This is the default behaviour, -to allow sharing, expicitly use +Refuse shared mounting of the daemon. +This is the default behaviour, to allow sharing, expicitly use .Fl o Cm noprivate .It Cm neglect_shares Do not refuse unmounting if there are secondary mounts @@ -154,11 +157,13 @@ Prefix absolute symlinks with the mountp .El .Pp Besides the above mount options, there is a set of pseudo-mount options which -are supported by the Fuse library. One can list these by passing +are supported by the Fuse library. +One can list these by passing .Fl h -to a Fuse daemon. Most of these options have effect only on the behaviour of -the daemon (that is, their scope is limited to userspace). However, -there are some which do require in-kernel support. +to a Fuse daemon. +Most of these options only have affect on the behavior of the daemon (that is, +their scope is limited to userspace). +However, there are some which do require in-kernel support. Currently the options supported by the kernel are: .Bl -tag -width indent .It Cm direct_io @@ -189,7 +194,7 @@ only if the filesystem daemon has the sa real gid) as the user. .Pp This is applied for Fuse mounts by default and only root can mount without -the strict access policy (ie. the +the strict access policy (i.e. the .Cm allow_other mount option). .Pp @@ -201,7 +206,7 @@ Users might opt to willingly relax stric are concerned) by doing their own secondary mount (See .Sx SHARED MOUNTS ) . .Sh SHARED MOUNTS -A Fuse daemon can be shared (ie. mounted multiple times). +A Fuse daemon can be shared (i.e. mounted multiple times). When doing the first (primary) mount, the spawner and the mounter of the daemon must have the same uid, or the mounter should be the superuser. .Pp @@ -212,9 +217,9 @@ The behaviour of a secondary mount is an links: they redirect all filesystem operations to the primary mount. .Pp Doing a secondary mount is like signing an agreement: by this action, the mounter -agrees that the Fuse daemon can trace her I/O activities. From then on -she is not banned from using the filesystem (either via her own mount or -via the primary mount), regardless whether +agrees that the Fuse daemon can trace her I/O activities. +From then on she is not banned from using the filesystem +(either via her own mount or via the primary mount), regardless whether .Cm allow_other is used or not. .Pp @@ -226,14 +231,15 @@ mount; e.g. System administrators might want to use a custom mount policy (ie., one going beyond the .Va vfs.usermount -sysctl). The primary tool for such purposes is +sysctl). +The primary tool for such purposes is .Xr sudo 8 . However, given that .Nm is capable of invoking an arbitrary program, one must be careful when doing this. .Nm -is designed in a way such that it makes that easy. For this purpose, -there are options which disable certain risky features (ie. +is designed in a way such that it makes that easy. +For this purpose, there are options which disable certain risky features (i.e. .Fl S and .Fl A ) , @@ -269,8 +275,8 @@ If set, .Nm will ignore uknown mount options. .It Ev MOUNT_FUSEFS_CALL_BY_LIB -Adjust behaviour to the needs of the FUSE library. Currently it effects -help output. +Adjust behavior to the needs of the FUSE library. +Currently it effects help output. .El .Pp Although the following variables do not have any effect on @@ -278,11 +284,13 @@ Although the following variables do not itself, they affect the behaviour of fuse daemons: .Bl -tag -width ".Ev FUSE_DEV_NAME" .It Ev FUSE_DEV_NAME -Device to attach. If not set, the multiplexer path +Device to attach. +If not set, the multiplexer path .Ar /dev/fuse is used. .It Ev FUSE_DEV_FD -File desciptor of an opened Fuse device to use. Overrides +File desciptor of an opened Fuse device to use. +Overrides .Ev FUSE_DEV_NAME . .It Ev FUSE_NO_MOUNT If set, the library will not attempt to mount the filesystem, even @@ -293,7 +301,8 @@ if a mountpoint argument is supplied. .It Pa /dev/fuse Fuse device with which the kernel and Fuse daemons can communicate. .It Pa /dev/fuse -The multiplexer path. An +The multiplexer path. +An .Xr open 2 performed on it automatically is passed to a free Fuse device by the kernel (which might be created just for this puprose). @@ -330,12 +339,19 @@ does not call any external utility and a .Xr umount 8 .Sh HISTORY .Nm -appears as the part of the FreeBSD implementation of the Fuse userspace filesystem -framework (see http://fuse.sourceforge.net). This user interface is FreeBSD specific. +appeared in +.Fx 10.0 +as the part of the +.Fx +implementation of the Fuse userspace filesystem +framework (see http://fuse.sourceforge.net). .Sh CAVEATS -Secondary mounts should be unmounted via their device name. If an attempt is -made to be unmount them via their filesystem root path, the unmount request -will be forwarded to the primary mount path. +This user interface is +.Fx +specific. +Secondary mounts should be unmounted via their device name. +If an attempt is made to unmount them via their filesystem root path, +the unmount request will be forwarded to the primary mount path. In general, unmounting by device name is less error-prone than by mount path (although the latter will also work under normal circumstances). .Pp From owner-svn-src-stable-11@freebsd.org Mon Oct 10 16:41:19 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33456C0BB42; Mon, 10 Oct 2016 16:41:19 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD02AD06; Mon, 10 Oct 2016 16:41:18 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AGfIuu065837; Mon, 10 Oct 2016 16:41:18 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AGfI8t065836; Mon, 10 Oct 2016 16:41:18 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610101641.u9AGfI8t065836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 10 Oct 2016 16:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306998 - stable/11/sbin/mount_msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:41:19 -0000 Author: sevan (doc committer) Date: Mon Oct 10 16:41:17 2016 New Revision: 306998 URL: https://svnweb.freebsd.org/changeset/base/306998 Log: MFC r306611: Amend history to mention predecessor originated from 386BSD[1] & current implementation from NetBSD[2]. Reword history since the utility was renamed once more in FreeBSD 5.0. Separate out author & historical information regarding character code conversion. Add AUTHORS section. [1] https://groups.google.com/forum/#!search/mount_pcfs.c/comp.unix.bsd/9qhH0v1tZm0/inlPnXZj_2sJ [2] http://cvsweb.netbsd.org/bsdweb.cgi/src/sbin/mount_msdos/mount_msdos.c?rev=1.6&content-type=text/x-cvsweb-markup PR: 212536 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/mount_msdosfs/mount_msdosfs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mount_msdosfs/mount_msdosfs.8 ============================================================================== --- stable/11/sbin/mount_msdosfs/mount_msdosfs.8 Mon Oct 10 16:38:52 2016 (r306997) +++ stable/11/sbin/mount_msdosfs/mount_msdosfs.8 Mon Oct 10 16:41:17 2016 (r306998) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd October 3, 2016 .Dt MOUNT_MSDOSFS 8 .Os .Sh NAME @@ -200,21 +200,32 @@ To mount a Japanese MS-DOS file system l List of Localized MS Operating Systems: .Pa http://www.microsoft.com/globaldev/reference/oslocversion.mspx . .Sh HISTORY -The -.Nm -utility first appeared in +The predecessor to +.Nm mount_msdos +utility named +.Nm mount_pcfs +appeared in +.Bx 386 . +It was rewritten in +.Nx 1.0 +and first appeared in .Fx 2.0 . -Its predecessor, the +.Nm mount_msdos +was renamed to the more aptly-named +.Nm +in +.Fx 5.0. +The character code conversion routine was added in 2003. +.Sh AUTHORS +Initial implementation as .Nm mount_pcfs -utility appeared in -.Fx 1.0 , -and was abandoned in favor -of the more aptly-named -.Nm . -.Pp +was written by +.An -nosplit +.An Paul Popelka Aq Mt paulp@uts.amdahl.com . +It was rewritten by +.An Christopher G. Demetriou Aq Mt cgd@NetBSD.org . The character code conversion routine was added by -.An Ryuichiro Imura Aq Mt imura@ryu16.org -in 2003. +.An Ryuichiro Imura Aq Mt imura@ryu16.org . .Sh CAVEATS The use of the .Fl 9 From owner-svn-src-stable-11@freebsd.org Mon Oct 10 18:13:25 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04FC9C0C416; Mon, 10 Oct 2016 18:13:25 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B0BBFB9E; Mon, 10 Oct 2016 18:13:24 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mail-qk0-x244.google.com with SMTP id v138so6255823qka.2; Mon, 10 Oct 2016 11:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=xy+VCYNQFAyFehGIVpOwi813nVtqMhS+rHIJyQrnKYs=; b=RhO5hjjexCyBQ+5JM6Q38Q0r37qjnESPBJwDufyT+5HxcpPvUUkTgGD7vJlIgMAF+M TTViV5MoCOT5krPbKEc6XVAi8gkyyRpYkFRp1lxlB2ovmdrts+09jmYqR6ZBHG2ZVPpM n84vIj6w/go64MDkJti9inydcUjQ5RB+FwU+U3aS09fTQtoPmsfusrc0MOVtOzYnSoOa GVPwb4Q5B4rx+VvRhjl/7leuYg4zRgLVH/l8Ti3tYfmOGS9XELJapJo+73IhLWDPJjKJ ew2jSHyKRCrRmBBAX51GXRXEw5ftPWAqQoabZ2CUvHRAqQ9IsWqd/7Uz57O/BYRxth61 uSqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=xy+VCYNQFAyFehGIVpOwi813nVtqMhS+rHIJyQrnKYs=; b=kPxmuwx4MBIMw0awknoFZkgSIIryIOkjWVSuuy73/9aI149yWEnxsYU9EUtBGHB+pE V6VhIVXVJEyh7XDwd9WcAJCE5xTRE+UiTgq/GvYa+8/b2DT4vMiT4jn2oAPrAL7WUg1q 8WiTb5czI89VDTSkPsHWuluwjEKNjzdb0kWPNeHMtgC3trFN6LDo82pkQ642wzikERnu xlwhRaiC8BmbwhDPpgfYLmtB+WEW934okkRc/ULwKumF3bXw9QUUdzyd8E6bjMGME88q t9v8grVeUiExD8S0uytkdnG5JSSu63oVw21Rd+mgTHkI9F/pnWpqKSulyg4f2jZVomH6 5OIg== X-Gm-Message-State: AA6/9RlNVRUvBIp1X8MawKcPuBqaz62i2rBcSWTD1Ij3NSHXWXrzgxcwxh91STBHlKOSiQ== X-Received: by 10.55.92.135 with SMTP id q129mr35943715qkb.52.1476123203664; Mon, 10 Oct 2016 11:13:23 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [12.32.117.8]) by smtp.googlemail.com with ESMTPSA id o25sm7623453qta.39.2016.10.10.11.13.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Oct 2016 11:13:22 -0700 (PDT) Sender: Navdeep Parhar Subject: Re: svn commit: r306661 - in stable/11/sys/dev/cxgbe: . tom To: Slawa Olhovchenkov , John Baldwin References: <201610032315.u93NFiHE057529@repo.freebsd.org> <20161010110901.GH6177@zxy.spb.ru> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org From: Navdeep Parhar Message-ID: Date: Mon, 10 Oct 2016 11:13:20 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161010110901.GH6177@zxy.spb.ru> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 18:13:25 -0000 On 10/10/2016 04:09, Slawa Olhovchenkov wrote: > On Mon, Oct 03, 2016 at 11:15:44PM +0000, John Baldwin wrote: > >> Author: jhb >> Date: Mon Oct 3 23:15:44 2016 >> New Revision: 306661 >> URL: https://svnweb.freebsd.org/changeset/base/306661 >> >> Log: >> MFC 303405: Add support for zero-copy aio_write() on TOE sockets. >> >> ... > > Do you have any public available application patches for support this? netperf has support for AIO in its trunk/ branch and I assume it will be part of the next netperf release. > May be nginx? > You don't need any patches if nginx supports AIO (aio_write(2) on the socket) already. There's usually a knob in such applications that lets you select the method it uses to transmit data. That's probably the best place to start looking. Regards, Navdeep From owner-svn-src-stable-11@freebsd.org Mon Oct 10 18:19:40 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C64FC0C529; Mon, 10 Oct 2016 18:19:40 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B95AE1D; Mon, 10 Oct 2016 18:19:40 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1btfAn-000I8o-TI; Mon, 10 Oct 2016 21:19:37 +0300 Date: Mon, 10 Oct 2016 21:19:37 +0300 From: Slawa Olhovchenkov To: Navdeep Parhar Cc: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r306661 - in stable/11/sys/dev/cxgbe: . tom Message-ID: <20161010181937.GY54003@zxy.spb.ru> References: <201610032315.u93NFiHE057529@repo.freebsd.org> <20161010110901.GH6177@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 18:19:40 -0000 On Mon, Oct 10, 2016 at 11:13:20AM -0700, Navdeep Parhar wrote: > On 10/10/2016 04:09, Slawa Olhovchenkov wrote: > > On Mon, Oct 03, 2016 at 11:15:44PM +0000, John Baldwin wrote: > > > >> Author: jhb > >> Date: Mon Oct 3 23:15:44 2016 > >> New Revision: 306661 > >> URL: https://svnweb.freebsd.org/changeset/base/306661 > >> > >> Log: > >> MFC 303405: Add support for zero-copy aio_write() on TOE sockets. > >> > >> ... > > > > Do you have any public available application patches for support this? > > netperf has support for AIO in its trunk/ branch and I assume it will be > part of the next netperf release. > > > May be nginx? > > > > You don't need any patches if nginx supports AIO (aio_write(2) on the > socket) already. There's usually a knob in such applications that lets No, nginx currently don't supports AIO on the socket. > you select the method it uses to transmit data. That's probably the > best place to start looking. > > Regards, > Navdeep From owner-svn-src-stable-11@freebsd.org Mon Oct 10 18:25:43 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BEDDC0C858; Mon, 10 Oct 2016 18:25:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A660812; Mon, 10 Oct 2016 18:25:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id D3E9010AF6B; Mon, 10 Oct 2016 14:25:41 -0400 (EDT) From: John Baldwin To: Slawa Olhovchenkov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r306661 - in stable/11/sys/dev/cxgbe: . tom Date: Mon, 10 Oct 2016 10:46:27 -0700 Message-ID: <1660024.uzJn2AtV1k@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20161010110901.GH6177@zxy.spb.ru> References: <201610032315.u93NFiHE057529@repo.freebsd.org> <20161010110901.GH6177@zxy.spb.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 10 Oct 2016 14:25:41 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 18:25:43 -0000 On Monday, October 10, 2016 02:09:01 PM Slawa Olhovchenkov wrote: > On Mon, Oct 03, 2016 at 11:15:44PM +0000, John Baldwin wrote: > > > Author: jhb > > Date: Mon Oct 3 23:15:44 2016 > > New Revision: 306661 > > URL: https://svnweb.freebsd.org/changeset/base/306661 > > > > Log: > > MFC 303405: Add support for zero-copy aio_write() on TOE sockets. > > > > AIO write requests for a TOE socket on a Chelsio T4+ adapter can now > > DMA directly from the user-supplied buffer. This is implemented by > > wiring the pages backing the user-supplied buffer and queueing special > > mbufs backed by raw VM pages to the socket buffer. The TOE code > > recognizes these special mbufs and builds a sglist from the VM page > > array associated with the mbuf when queueing a work request to the TOE. > > > > Because these mbufs do not have an associated virtual address, m_data > > is not valid. Thus, the AIO handler does not invoke sosend() directly > > for these mbufs but instead inlines portions of sosend_generic() and > > tcp_usr_send(). > > > > An aiotx_buffer structure is used to describe the user buffer (e.g. > > it holds the array of VM pages and a reference to the AIO job). The > > special mbufs reference this structure via m_ext. Note that a single > > job might be split across multiple mbufs (e.g. if it is larger than > > the socket buffer size). The 'ext_arg2' member of each mbuf gives an > > offset relative to the backing aiotx_buffer. The AIO job associated > > with an aiotx_buffer structure is completed when the last reference to > > the structure is released. > > > > Zero-copy aio_write()'s for connections associated with a given > > adapter can be enabled/disabled at runtime via the > > 'dev.t[45]nex.N.toe.tx_zcopy' sysctl. > > > > Sponsored by: Chelsio Communications > > Do you have any public available application patches for support this? > May be nginx? Applications need to use aio_read(), ideally with at least 2 buffers (so queue two reads, then when a read completes, consume the data and do the next read). I'm not sure nginx will find this but so useful as web servers tend to send a lot more data than they receive. The only software I have patched explicitly for this is netperf. -- John Baldwin From owner-svn-src-stable-11@freebsd.org Mon Oct 10 18:28:23 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2AFEC0C95C; Mon, 10 Oct 2016 18:28:23 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3756AED; Mon, 10 Oct 2016 18:28:23 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1btfJF-000IPU-P4; Mon, 10 Oct 2016 21:28:21 +0300 Date: Mon, 10 Oct 2016 21:28:21 +0300 From: Slawa Olhovchenkov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r306661 - in stable/11/sys/dev/cxgbe: . tom Message-ID: <20161010182821.GZ54003@zxy.spb.ru> References: <201610032315.u93NFiHE057529@repo.freebsd.org> <20161010110901.GH6177@zxy.spb.ru> <1660024.uzJn2AtV1k@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1660024.uzJn2AtV1k@ralph.baldwin.cx> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 18:28:24 -0000 On Mon, Oct 10, 2016 at 10:46:27AM -0700, John Baldwin wrote: > On Monday, October 10, 2016 02:09:01 PM Slawa Olhovchenkov wrote: > > On Mon, Oct 03, 2016 at 11:15:44PM +0000, John Baldwin wrote: > > > > > Author: jhb > > > Date: Mon Oct 3 23:15:44 2016 > > > New Revision: 306661 > > > URL: https://svnweb.freebsd.org/changeset/base/306661 > > > > > > Log: > > > MFC 303405: Add support for zero-copy aio_write() on TOE sockets. > > > > > > AIO write requests for a TOE socket on a Chelsio T4+ adapter can now > > > DMA directly from the user-supplied buffer. This is implemented by > > > wiring the pages backing the user-supplied buffer and queueing special > > > mbufs backed by raw VM pages to the socket buffer. The TOE code > > > recognizes these special mbufs and builds a sglist from the VM page > > > array associated with the mbuf when queueing a work request to the TOE. > > > > > > Because these mbufs do not have an associated virtual address, m_data > > > is not valid. Thus, the AIO handler does not invoke sosend() directly > > > for these mbufs but instead inlines portions of sosend_generic() and > > > tcp_usr_send(). > > > > > > An aiotx_buffer structure is used to describe the user buffer (e.g. > > > it holds the array of VM pages and a reference to the AIO job). The > > > special mbufs reference this structure via m_ext. Note that a single > > > job might be split across multiple mbufs (e.g. if it is larger than > > > the socket buffer size). The 'ext_arg2' member of each mbuf gives an > > > offset relative to the backing aiotx_buffer. The AIO job associated > > > with an aiotx_buffer structure is completed when the last reference to > > > the structure is released. > > > > > > Zero-copy aio_write()'s for connections associated with a given > > > adapter can be enabled/disabled at runtime via the > > > 'dev.t[45]nex.N.toe.tx_zcopy' sysctl. > > > > > > Sponsored by: Chelsio Communications > > > > Do you have any public available application patches for support this? > > May be nginx? > > Applications need to use aio_read(), ideally with at least 2 buffers (so > queue two reads, then when a read completes, consume the data and do the > next read). I'm not sure nginx will find this but so useful as web servers > tend to send a lot more data than they receive. The only software I have > patched explicitly for this is netperf. Hm, this is like only aio_read() on sokets give performance boost, not aio_write()? From owner-svn-src-stable-11@freebsd.org Mon Oct 10 18:34:09 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 365A8C0CAAC; Mon, 10 Oct 2016 18:34:09 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-qt0-f177.google.com (mail-qt0-f177.google.com [209.85.216.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE45CEB9; Mon, 10 Oct 2016 18:34:08 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mail-qt0-f177.google.com with SMTP id q7so63503723qtq.1; Mon, 10 Oct 2016 11:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=ca1aqN8BPnAqQEme5Q0GzkPFrbVT/qf31+HfWHtiVwo=; b=Lx3PK3oBUr8H8w+DMUVwb2OivLUC5M4Mjid2PHrLXYNQ+GRNQgnmFDmqiOKdk+nKS/ Llsz7DMjI+hYTCdZRv7ywlKGAt7eIFRngFHfLoBBl0zFswcrBD5YrE9fdv+8iO4PfrzO +tHnzm+h/b8TPZFsx6nmKEPpwEabE5hbmQSiPeeDaIZ6vTuDTExpjH7LuCA4ynD3873F WvUTNvObbtvoAcdyVw6axMHsDuzElA0EqhYu+MObUmkI2gLkSaDc83np+vdw283oqqaf ouygKscJFoyWk0kc48KCn8otXme+1d4rcWQeTlJd9KDlC2Y/jwOyGNApDegWszLC/msy ABvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ca1aqN8BPnAqQEme5Q0GzkPFrbVT/qf31+HfWHtiVwo=; b=Hem3lgaWh8+rTMLFZIK42pqzChairOwgOx37S7QmbiRnZurF0M9UsTtGhuDkzHXRqF Ilg8OWZzHhz+uOi2XckDf2FnCKDQVRQetyo4dXX5+cM03H8AdZNjaww2dfuUWyZU7hZd GEU08TDkM80e0hMMA9NC9xUJX0gv17G7lB8mnDl2enmmtBeJUwzP++Sc+c4fD1yqeRHL qTuFw4wdeGm8O9Mob2B+sscLj4KXZ2kl8pNFSvlG1YUGnFf9YEb73e+z7DS5l3LHGTvv X4GIoNHEcNGm79xN7V2HyzewMDif75P9Yvu/1eKZ8u3u5pag7eCtH9/bbt7XP2NfiG8N xf1Q== X-Gm-Message-State: AA6/9RmP3ilLNkxIECfuQ79tEbg7ecJM2RNqe2MrmcRq7AEPeyCwbdixLYSGDfonqNAg1Q== X-Received: by 10.200.42.130 with SMTP id b2mr34048357qta.102.1476124382114; Mon, 10 Oct 2016 11:33:02 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [12.32.117.8]) by smtp.googlemail.com with ESMTPSA id j2sm1126049qtb.46.2016.10.10.11.33.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Oct 2016 11:33:01 -0700 (PDT) Subject: Re: svn commit: r306661 - in stable/11/sys/dev/cxgbe: . tom To: Slawa Olhovchenkov , John Baldwin References: <201610032315.u93NFiHE057529@repo.freebsd.org> <20161010110901.GH6177@zxy.spb.ru> <1660024.uzJn2AtV1k@ralph.baldwin.cx> <20161010182821.GZ54003@zxy.spb.ru> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org From: Navdeep Parhar Message-ID: Date: Mon, 10 Oct 2016 11:32:59 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161010182821.GZ54003@zxy.spb.ru> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 18:34:09 -0000 On 10/10/2016 11:28, Slawa Olhovchenkov wrote: > On Mon, Oct 10, 2016 at 10:46:27AM -0700, John Baldwin wrote: > >> On Monday, October 10, 2016 02:09:01 PM Slawa Olhovchenkov wrote: >>> On Mon, Oct 03, 2016 at 11:15:44PM +0000, John Baldwin wrote: >>> >>>> Author: jhb >>>> Date: Mon Oct 3 23:15:44 2016 >>>> New Revision: 306661 >>>> URL: https://svnweb.freebsd.org/changeset/base/306661 >>>> >>>> Log: >>>> MFC 303405: Add support for zero-copy aio_write() on TOE sockets. >>>> >>>> AIO write requests for a TOE socket on a Chelsio T4+ adapter can now >>>> DMA directly from the user-supplied buffer. This is implemented by >>>> wiring the pages backing the user-supplied buffer and queueing special >>>> mbufs backed by raw VM pages to the socket buffer. The TOE code >>>> recognizes these special mbufs and builds a sglist from the VM page >>>> array associated with the mbuf when queueing a work request to the TOE. >>>> >>>> Because these mbufs do not have an associated virtual address, m_data >>>> is not valid. Thus, the AIO handler does not invoke sosend() directly >>>> for these mbufs but instead inlines portions of sosend_generic() and >>>> tcp_usr_send(). >>>> >>>> An aiotx_buffer structure is used to describe the user buffer (e.g. >>>> it holds the array of VM pages and a reference to the AIO job). The >>>> special mbufs reference this structure via m_ext. Note that a single >>>> job might be split across multiple mbufs (e.g. if it is larger than >>>> the socket buffer size). The 'ext_arg2' member of each mbuf gives an >>>> offset relative to the backing aiotx_buffer. The AIO job associated >>>> with an aiotx_buffer structure is completed when the last reference to >>>> the structure is released. >>>> >>>> Zero-copy aio_write()'s for connections associated with a given >>>> adapter can be enabled/disabled at runtime via the >>>> 'dev.t[45]nex.N.toe.tx_zcopy' sysctl. >>>> >>>> Sponsored by: Chelsio Communications >>> >>> Do you have any public available application patches for support this? >>> May be nginx? >> >> Applications need to use aio_read(), ideally with at least 2 buffers (so >> queue two reads, then when a read completes, consume the data and do the >> next read). I'm not sure nginx will find this but so useful as web servers >> tend to send a lot more data than they receive. The only software I have >> patched explicitly for this is netperf. > > Hm, this is like only aio_read() on sokets give performance boost, not > aio_write()? > Both. tx_zcopy is the knob for aio_write and ddp is the knob for aio_read. ddp will probably get renamed to rx_zcopy (while still working with the 'ddp' name for backward compat). From owner-svn-src-stable-11@freebsd.org Mon Oct 10 18:40:30 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D4BEC0CC14; Mon, 10 Oct 2016 18:40:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4851B11FC; Mon, 10 Oct 2016 18:40:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 81B7410AF69; Mon, 10 Oct 2016 14:40:28 -0400 (EDT) From: John Baldwin To: Slawa Olhovchenkov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r306661 - in stable/11/sys/dev/cxgbe: . tom Date: Mon, 10 Oct 2016 11:39:24 -0700 Message-ID: <5243602.cilUCEM5cP@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20161010182821.GZ54003@zxy.spb.ru> References: <201610032315.u93NFiHE057529@repo.freebsd.org> <1660024.uzJn2AtV1k@ralph.baldwin.cx> <20161010182821.GZ54003@zxy.spb.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 10 Oct 2016 14:40:28 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 18:40:30 -0000 On Monday, October 10, 2016 09:28:21 PM Slawa Olhovchenkov wrote: > On Mon, Oct 10, 2016 at 10:46:27AM -0700, John Baldwin wrote: > > > On Monday, October 10, 2016 02:09:01 PM Slawa Olhovchenkov wrote: > > > On Mon, Oct 03, 2016 at 11:15:44PM +0000, John Baldwin wrote: > > > > > > > Author: jhb > > > > Date: Mon Oct 3 23:15:44 2016 > > > > New Revision: 306661 > > > > URL: https://svnweb.freebsd.org/changeset/base/306661 > > > > > > > > Log: > > > > MFC 303405: Add support for zero-copy aio_write() on TOE sockets. > > > > > > > > AIO write requests for a TOE socket on a Chelsio T4+ adapter can now > > > > DMA directly from the user-supplied buffer. This is implemented by > > > > wiring the pages backing the user-supplied buffer and queueing special > > > > mbufs backed by raw VM pages to the socket buffer. The TOE code > > > > recognizes these special mbufs and builds a sglist from the VM page > > > > array associated with the mbuf when queueing a work request to the TOE. > > > > > > > > Because these mbufs do not have an associated virtual address, m_data > > > > is not valid. Thus, the AIO handler does not invoke sosend() directly > > > > for these mbufs but instead inlines portions of sosend_generic() and > > > > tcp_usr_send(). > > > > > > > > An aiotx_buffer structure is used to describe the user buffer (e.g. > > > > it holds the array of VM pages and a reference to the AIO job). The > > > > special mbufs reference this structure via m_ext. Note that a single > > > > job might be split across multiple mbufs (e.g. if it is larger than > > > > the socket buffer size). The 'ext_arg2' member of each mbuf gives an > > > > offset relative to the backing aiotx_buffer. The AIO job associated > > > > with an aiotx_buffer structure is completed when the last reference to > > > > the structure is released. > > > > > > > > Zero-copy aio_write()'s for connections associated with a given > > > > adapter can be enabled/disabled at runtime via the > > > > 'dev.t[45]nex.N.toe.tx_zcopy' sysctl. > > > > > > > > Sponsored by: Chelsio Communications > > > > > > Do you have any public available application patches for support this? > > > May be nginx? > > > > Applications need to use aio_read(), ideally with at least 2 buffers (so > > queue two reads, then when a read completes, consume the data and do the > > next read). I'm not sure nginx will find this but so useful as web servers > > tend to send a lot more data than they receive. The only software I have > > patched explicitly for this is netperf. > > Hm, this is like only aio_read() on sokets give performance boost, not > aio_write()? Sorry, I was confused on the commit, this does affect aio_write() (earlier changes also permit zero-copy for receive via aio_read()). However, as you noted in the reply to Navdeep, it seems that nginx only supports using AIO on the backing files for static content it seems. It would need changes to support using aio_write on sockets (similar to using sendfile). -- John Baldwin From owner-svn-src-stable-11@freebsd.org Mon Oct 10 18:44:00 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD897C0CD55; Mon, 10 Oct 2016 18:44:00 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D2C7163E; Mon, 10 Oct 2016 18:44:00 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1btfYL-000Iqo-3q; Mon, 10 Oct 2016 21:43:57 +0300 Date: Mon, 10 Oct 2016 21:43:57 +0300 From: Slawa Olhovchenkov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r306661 - in stable/11/sys/dev/cxgbe: . tom Message-ID: <20161010184357.GB54003@zxy.spb.ru> References: <201610032315.u93NFiHE057529@repo.freebsd.org> <1660024.uzJn2AtV1k@ralph.baldwin.cx> <20161010182821.GZ54003@zxy.spb.ru> <5243602.cilUCEM5cP@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5243602.cilUCEM5cP@ralph.baldwin.cx> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 18:44:00 -0000 On Mon, Oct 10, 2016 at 11:39:24AM -0700, John Baldwin wrote: > On Monday, October 10, 2016 09:28:21 PM Slawa Olhovchenkov wrote: > > On Mon, Oct 10, 2016 at 10:46:27AM -0700, John Baldwin wrote: > > > > > On Monday, October 10, 2016 02:09:01 PM Slawa Olhovchenkov wrote: > > > > On Mon, Oct 03, 2016 at 11:15:44PM +0000, John Baldwin wrote: > > > > > > > > > Author: jhb > > > > > Date: Mon Oct 3 23:15:44 2016 > > > > > New Revision: 306661 > > > > > URL: https://svnweb.freebsd.org/changeset/base/306661 > > > > > > > > > > Log: > > > > > MFC 303405: Add support for zero-copy aio_write() on TOE sockets. > > > > > > > > > > AIO write requests for a TOE socket on a Chelsio T4+ adapter can now > > > > > DMA directly from the user-supplied buffer. This is implemented by > > > > > wiring the pages backing the user-supplied buffer and queueing special > > > > > mbufs backed by raw VM pages to the socket buffer. The TOE code > > > > > recognizes these special mbufs and builds a sglist from the VM page > > > > > array associated with the mbuf when queueing a work request to the TOE. > > > > > > > > > > Because these mbufs do not have an associated virtual address, m_data > > > > > is not valid. Thus, the AIO handler does not invoke sosend() directly > > > > > for these mbufs but instead inlines portions of sosend_generic() and > > > > > tcp_usr_send(). > > > > > > > > > > An aiotx_buffer structure is used to describe the user buffer (e.g. > > > > > it holds the array of VM pages and a reference to the AIO job). The > > > > > special mbufs reference this structure via m_ext. Note that a single > > > > > job might be split across multiple mbufs (e.g. if it is larger than > > > > > the socket buffer size). The 'ext_arg2' member of each mbuf gives an > > > > > offset relative to the backing aiotx_buffer. The AIO job associated > > > > > with an aiotx_buffer structure is completed when the last reference to > > > > > the structure is released. > > > > > > > > > > Zero-copy aio_write()'s for connections associated with a given > > > > > adapter can be enabled/disabled at runtime via the > > > > > 'dev.t[45]nex.N.toe.tx_zcopy' sysctl. > > > > > > > > > > Sponsored by: Chelsio Communications > > > > > > > > Do you have any public available application patches for support this? > > > > May be nginx? > > > > > > Applications need to use aio_read(), ideally with at least 2 buffers (so > > > queue two reads, then when a read completes, consume the data and do the > > > next read). I'm not sure nginx will find this but so useful as web servers > > > tend to send a lot more data than they receive. The only software I have > > > patched explicitly for this is netperf. > > > > Hm, this is like only aio_read() on sokets give performance boost, not > > aio_write()? > > Sorry, I was confused on the commit, this does affect aio_write() (earlier > changes also permit zero-copy for receive via aio_read()). However, as you > noted in the reply to Navdeep, it seems that nginx only supports using > AIO on the backing files for static content it seems. It would need changes > to support using aio_write on sockets (similar to using sendfile). Thanks You don't planed to do this? From owner-svn-src-stable-11@freebsd.org Mon Oct 10 19:21:25 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E8B3C0C640; Mon, 10 Oct 2016 19:21:25 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3EA0AF1; Mon, 10 Oct 2016 19:21:24 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 7FB3410AF74; Mon, 10 Oct 2016 15:21:23 -0400 (EDT) From: John Baldwin To: Slawa Olhovchenkov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r306661 - in stable/11/sys/dev/cxgbe: . tom Date: Mon, 10 Oct 2016 12:21:14 -0700 Message-ID: <4497031.RrIpxcHyXF@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20161010184357.GB54003@zxy.spb.ru> References: <201610032315.u93NFiHE057529@repo.freebsd.org> <5243602.cilUCEM5cP@ralph.baldwin.cx> <20161010184357.GB54003@zxy.spb.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 10 Oct 2016 15:21:23 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 19:21:25 -0000 On Monday, October 10, 2016 09:43:57 PM Slawa Olhovchenkov wrote: > On Mon, Oct 10, 2016 at 11:39:24AM -0700, John Baldwin wrote: > > > On Monday, October 10, 2016 09:28:21 PM Slawa Olhovchenkov wrote: > > > On Mon, Oct 10, 2016 at 10:46:27AM -0700, John Baldwin wrote: > > > > > > > On Monday, October 10, 2016 02:09:01 PM Slawa Olhovchenkov wrote: > > > > > On Mon, Oct 03, 2016 at 11:15:44PM +0000, John Baldwin wrote: > > > > > > > > > > > Author: jhb > > > > > > Date: Mon Oct 3 23:15:44 2016 > > > > > > New Revision: 306661 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/306661 > > > > > > > > > > > > Log: > > > > > > MFC 303405: Add support for zero-copy aio_write() on TOE sockets. > > > > > > > > > > > > AIO write requests for a TOE socket on a Chelsio T4+ adapter can now > > > > > > DMA directly from the user-supplied buffer. This is implemented by > > > > > > wiring the pages backing the user-supplied buffer and queueing special > > > > > > mbufs backed by raw VM pages to the socket buffer. The TOE code > > > > > > recognizes these special mbufs and builds a sglist from the VM page > > > > > > array associated with the mbuf when queueing a work request to the TOE. > > > > > > > > > > > > Because these mbufs do not have an associated virtual address, m_data > > > > > > is not valid. Thus, the AIO handler does not invoke sosend() directly > > > > > > for these mbufs but instead inlines portions of sosend_generic() and > > > > > > tcp_usr_send(). > > > > > > > > > > > > An aiotx_buffer structure is used to describe the user buffer (e.g. > > > > > > it holds the array of VM pages and a reference to the AIO job). The > > > > > > special mbufs reference this structure via m_ext. Note that a single > > > > > > job might be split across multiple mbufs (e.g. if it is larger than > > > > > > the socket buffer size). The 'ext_arg2' member of each mbuf gives an > > > > > > offset relative to the backing aiotx_buffer. The AIO job associated > > > > > > with an aiotx_buffer structure is completed when the last reference to > > > > > > the structure is released. > > > > > > > > > > > > Zero-copy aio_write()'s for connections associated with a given > > > > > > adapter can be enabled/disabled at runtime via the > > > > > > 'dev.t[45]nex.N.toe.tx_zcopy' sysctl. > > > > > > > > > > > > Sponsored by: Chelsio Communications > > > > > > > > > > Do you have any public available application patches for support this? > > > > > May be nginx? > > > > > > > > Applications need to use aio_read(), ideally with at least 2 buffers (so > > > > queue two reads, then when a read completes, consume the data and do the > > > > next read). I'm not sure nginx will find this but so useful as web servers > > > > tend to send a lot more data than they receive. The only software I have > > > > patched explicitly for this is netperf. > > > > > > Hm, this is like only aio_read() on sokets give performance boost, not > > > aio_write()? > > > > Sorry, I was confused on the commit, this does affect aio_write() (earlier > > changes also permit zero-copy for receive via aio_read()). However, as you > > noted in the reply to Navdeep, it seems that nginx only supports using > > AIO on the backing files for static content it seems. It would need changes > > to support using aio_write on sockets (similar to using sendfile). > > Thanks > You don't planed to do this? After talking with Navdeep it looks like I will take a stab at adding support for this and seeing what effects it has. For static content workloads using sendfile I'm not sure it will be a win, but it might let you avoid some of the CPU cycles for dynamically-generated content by avoiding copies for those. -- John Baldwin From owner-svn-src-stable-11@freebsd.org Mon Oct 10 19:27:10 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57628C0C7A5; Mon, 10 Oct 2016 19:27:10 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E840E13B; Mon, 10 Oct 2016 19:27:09 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1btgE7-000K0K-S3; Mon, 10 Oct 2016 22:27:07 +0300 Date: Mon, 10 Oct 2016 22:27:07 +0300 From: Slawa Olhovchenkov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r306661 - in stable/11/sys/dev/cxgbe: . tom Message-ID: <20161010192707.GC54003@zxy.spb.ru> References: <201610032315.u93NFiHE057529@repo.freebsd.org> <5243602.cilUCEM5cP@ralph.baldwin.cx> <20161010184357.GB54003@zxy.spb.ru> <4497031.RrIpxcHyXF@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4497031.RrIpxcHyXF@ralph.baldwin.cx> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 19:27:10 -0000 On Mon, Oct 10, 2016 at 12:21:14PM -0700, John Baldwin wrote: > On Monday, October 10, 2016 09:43:57 PM Slawa Olhovchenkov wrote: > > On Mon, Oct 10, 2016 at 11:39:24AM -0700, John Baldwin wrote: > > > > > On Monday, October 10, 2016 09:28:21 PM Slawa Olhovchenkov wrote: > > > > On Mon, Oct 10, 2016 at 10:46:27AM -0700, John Baldwin wrote: > > > > > > > > > On Monday, October 10, 2016 02:09:01 PM Slawa Olhovchenkov wrote: > > > > > > On Mon, Oct 03, 2016 at 11:15:44PM +0000, John Baldwin wrote: > > > > > > > > > > > > > Author: jhb > > > > > > > Date: Mon Oct 3 23:15:44 2016 > > > > > > > New Revision: 306661 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/306661 > > > > > > > > > > > > > > Log: > > > > > > > MFC 303405: Add support for zero-copy aio_write() on TOE sockets. > > > > > > > > > > > > > > AIO write requests for a TOE socket on a Chelsio T4+ adapter can now > > > > > > > DMA directly from the user-supplied buffer. This is implemented by > > > > > > > wiring the pages backing the user-supplied buffer and queueing special > > > > > > > mbufs backed by raw VM pages to the socket buffer. The TOE code > > > > > > > recognizes these special mbufs and builds a sglist from the VM page > > > > > > > array associated with the mbuf when queueing a work request to the TOE. > > > > > > > > > > > > > > Because these mbufs do not have an associated virtual address, m_data > > > > > > > is not valid. Thus, the AIO handler does not invoke sosend() directly > > > > > > > for these mbufs but instead inlines portions of sosend_generic() and > > > > > > > tcp_usr_send(). > > > > > > > > > > > > > > An aiotx_buffer structure is used to describe the user buffer (e.g. > > > > > > > it holds the array of VM pages and a reference to the AIO job). The > > > > > > > special mbufs reference this structure via m_ext. Note that a single > > > > > > > job might be split across multiple mbufs (e.g. if it is larger than > > > > > > > the socket buffer size). The 'ext_arg2' member of each mbuf gives an > > > > > > > offset relative to the backing aiotx_buffer. The AIO job associated > > > > > > > with an aiotx_buffer structure is completed when the last reference to > > > > > > > the structure is released. > > > > > > > > > > > > > > Zero-copy aio_write()'s for connections associated with a given > > > > > > > adapter can be enabled/disabled at runtime via the > > > > > > > 'dev.t[45]nex.N.toe.tx_zcopy' sysctl. > > > > > > > > > > > > > > Sponsored by: Chelsio Communications > > > > > > > > > > > > Do you have any public available application patches for support this? > > > > > > May be nginx? > > > > > > > > > > Applications need to use aio_read(), ideally with at least 2 buffers (so > > > > > queue two reads, then when a read completes, consume the data and do the > > > > > next read). I'm not sure nginx will find this but so useful as web servers > > > > > tend to send a lot more data than they receive. The only software I have > > > > > patched explicitly for this is netperf. > > > > > > > > Hm, this is like only aio_read() on sokets give performance boost, not > > > > aio_write()? > > > > > > Sorry, I was confused on the commit, this does affect aio_write() (earlier > > > changes also permit zero-copy for receive via aio_read()). However, as you > > > noted in the reply to Navdeep, it seems that nginx only supports using > > > AIO on the backing files for static content it seems. It would need changes > > > to support using aio_write on sockets (similar to using sendfile). > > > > Thanks > > You don't planed to do this? > > After talking with Navdeep it looks like I will take a stab at adding support > for this and seeing what effects it has. For static content workloads using > sendfile I'm not sure it will be a win, but it might let you avoid some of > the CPU cycles for dynamically-generated content by avoiding copies for those. As I remember you tests show performance boost over sendfile. Also, sendfile over ZFS don't work good, as I remember (readahead don't work, at least). From owner-svn-src-stable-11@freebsd.org Mon Oct 10 20:24:34 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72D38C0CA0A; Mon, 10 Oct 2016 20:24:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 35B4AA67; Mon, 10 Oct 2016 20:24:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AKOXfT055087; Mon, 10 Oct 2016 20:24:33 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AKOXLO055084; Mon, 10 Oct 2016 20:24:33 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201610102024.u9AKOXLO055084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Mon, 10 Oct 2016 20:24:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307004 - in stable/11: sys/kern tests/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 20:24:34 -0000 Author: jilles Date: Mon Oct 10 20:24:32 2016 New Revision: 307004 URL: https://svnweb.freebsd.org/changeset/base/307004 Log: MFC r305676: wait: Do not copyout uninitialized status/rusage/wrusage. If wait4() or wait6() return 0 because of WNOHANG, the status, rusage and wrusage information should not be returned. PR: 212048 Reported by: Casey Lucas Added: stable/11/tests/sys/kern/waitpid_nohang.c - copied unchanged from r305676, head/tests/sys/kern/waitpid_nohang.c Modified: stable/11/sys/kern/kern_exit.c stable/11/tests/sys/kern/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_exit.c ============================================================================== --- stable/11/sys/kern/kern_exit.c Mon Oct 10 19:09:35 2016 (r307003) +++ stable/11/sys/kern/kern_exit.c Mon Oct 10 20:24:32 2016 (r307004) @@ -723,9 +723,9 @@ sys_wait4(struct thread *td, struct wait else rup = NULL; error = kern_wait(td, uap->pid, &status, uap->options, rup); - if (uap->status != NULL && error == 0) + if (uap->status != NULL && error == 0 && td->td_retval[0] != 0) error = copyout(&status, uap->status, sizeof(status)); - if (uap->rusage != NULL && error == 0) + if (uap->rusage != NULL && error == 0 && td->td_retval[0] != 0) error = copyout(&ru, uap->rusage, sizeof(struct rusage)); return (error); } @@ -759,9 +759,9 @@ sys_wait6(struct thread *td, struct wait */ error = kern_wait6(td, idtype, id, &status, uap->options, wrup, sip); - if (uap->status != NULL && error == 0) + if (uap->status != NULL && error == 0 && td->td_retval[0] != 0) error = copyout(&status, uap->status, sizeof(status)); - if (uap->wrusage != NULL && error == 0) + if (uap->wrusage != NULL && error == 0 && td->td_retval[0] != 0) error = copyout(&wru, uap->wrusage, sizeof(wru)); if (uap->info != NULL && error == 0) error = copyout(&si, uap->info, sizeof(si)); Modified: stable/11/tests/sys/kern/Makefile ============================================================================== --- stable/11/tests/sys/kern/Makefile Mon Oct 10 19:09:35 2016 (r307003) +++ stable/11/tests/sys/kern/Makefile Mon Oct 10 20:24:32 2016 (r307004) @@ -12,6 +12,7 @@ PLAIN_TESTS_C+= subr_unit_test ATF_TESTS_C+= unix_seqpacket_test ATF_TESTS_C+= unix_passfd_test TEST_METADATA.unix_seqpacket_test+= timeout="15" +ATF_TESTS_C+= waitpid_nohang LIBADD.ptrace_test+= pthread LIBADD.unix_seqpacket_test+= pthread Copied: stable/11/tests/sys/kern/waitpid_nohang.c (from r305676, head/tests/sys/kern/waitpid_nohang.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/kern/waitpid_nohang.c Mon Oct 10 20:24:32 2016 (r307004, copy of r305676, head/tests/sys/kern/waitpid_nohang.c) @@ -0,0 +1,70 @@ +/*- + * Copyright (c) 2016 Jilles Tjoelker + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include + +ATF_TC_WITHOUT_HEAD(waitpid_nohang); +ATF_TC_BODY(waitpid_nohang, tc) +{ + pid_t child, pid; + int status, r; + + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + sleep(10); + _exit(1); + } + + status = 42; + pid = waitpid(child, &status, WNOHANG); + ATF_REQUIRE(pid == 0); + ATF_CHECK(status == 42); + + r = kill(child, SIGTERM); + ATF_REQUIRE(r == 0); + r = waitid(P_PID, child, NULL, WEXITED | WNOWAIT); + ATF_REQUIRE(r == 0); + + status = -1; + pid = waitpid(child, &status, WNOHANG); + ATF_REQUIRE(pid == child); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGTERM); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, waitpid_nohang); + return (atf_no_error()); +} From owner-svn-src-stable-11@freebsd.org Mon Oct 10 23:35:56 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF43DC07DF7; Mon, 10 Oct 2016 23:35:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C064C259; Mon, 10 Oct 2016 23:35:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ANZtj4029212; Mon, 10 Oct 2016 23:35:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ANZtZW029211; Mon, 10 Oct 2016 23:35:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610102335.u9ANZtZW029211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 10 Oct 2016 23:35:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307009 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 23:35:57 -0000 Author: gjb Date: Mon Oct 10 23:35:55 2016 New Revision: 307009 URL: https://svnweb.freebsd.org/changeset/base/307009 Log: Correct an entry from the release announcement. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Mon Oct 10 22:36:44 2016 (r307008) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Mon Oct 10 23:35:55 2016 (r307009) @@ -161,6 +161,13 @@ boot option is enabled by default, however this was disabled prior to the final release build. + + + The release announcement stated "Wireless support + for 802.11n has been added." This was intended to + state "Wireless support for 802.11n has been added for + additional wireless network drivers." + From owner-svn-src-stable-11@freebsd.org Tue Oct 11 02:08:11 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35884C0BF68; Tue, 11 Oct 2016 02:08:11 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1915876; Tue, 11 Oct 2016 02:08:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9B28Alq085917; Tue, 11 Oct 2016 02:08:10 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9B28ASC085916; Tue, 11 Oct 2016 02:08:10 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610110208.u9B28ASC085916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 11 Oct 2016 02:08:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307010 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 02:08:11 -0000 Author: sephe Date: Tue Oct 11 02:08:09 2016 New Revision: 307010 URL: https://svnweb.freebsd.org/changeset/base/307010 Log: MFC 306480 linuxkpi: Fix PCI BAR lazy allocation support. FreeBSD supports lazy allocation of PCI BAR, that is, when a device driver's attach method is invoked, even if the device's PCI BAR address wasn't initialized, the invocation of bus_alloc_resource_any() (the call chain: pci_alloc_resource() -> pci_alloc_multi_resource() -> pci_reserve_map() -> pci_write_bar()) would allocate a proper address for the PCI BAR and write this 'lazy allocated' address into the PCI BAR. This model works fine for native FreeBSD device drivers, but _not_ for device drivers shared with Linux (e.g. dev/mlx5/mlx5_core/mlx5_main.c and ofed/drivers/net/mlx4/main.c. Both of them use pci_request_regions(), which doesn't work properly with the PCI BAR lazy allocation, because pci_resource_type() -> _pci_get_rle() always returns NULL, so pci_request_regions() doesn't have the opportunity to invoke bus_alloc_resource_any(). We now use pci_find_bar() in pci_resource_type(), which is able to locate all available PCI BARs even if some of them will be lazy allocated. Submitted by: Dexuan Cui Reviewed by: hps Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8071 Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Oct 10 23:35:55 2016 (r307009) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Tue Oct 11 02:08:09 2016 (r307010) @@ -233,11 +233,16 @@ pci_resource_len(struct pci_dev *pdev, i static inline int pci_resource_type(struct pci_dev *pdev, int bar) { - struct resource_list_entry *rle; + struct pci_map *pm; - if ((rle = _pci_get_bar(pdev, bar)) == NULL) + pm = pci_find_bar(pdev->dev.bsddev, PCIR_BAR(bar)); + if (!pm) return (-1); - return (rle->type); + + if (PCI_BAR_IO(pm->pm_value)) + return (SYS_RES_IOPORT); + else + return (SYS_RES_MEMORY); } /* From owner-svn-src-stable-11@freebsd.org Tue Oct 11 13:22:38 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C171C0C3B5; Tue, 11 Oct 2016 13:22:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 553E3B9A; Tue, 11 Oct 2016 13:22:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BDMbF5043135; Tue, 11 Oct 2016 13:22:37 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BDMbxT043134; Tue, 11 Oct 2016 13:22:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610111322.u9BDMbxT043134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 11 Oct 2016 13:22:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307039 - stable/11/release/doc/share/xml X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 13:22:38 -0000 Author: emaste Date: Tue Oct 11 13:22:37 2016 New Revision: 307039 URL: https://svnweb.freebsd.org/changeset/base/307039 Log: Add Cavium sponsor entity Modified: stable/11/release/doc/share/xml/sponsor.ent Modified: stable/11/release/doc/share/xml/sponsor.ent ============================================================================== --- stable/11/release/doc/share/xml/sponsor.ent Tue Oct 11 13:08:48 2016 (r307038) +++ stable/11/release/doc/share/xml/sponsor.ent Tue Oct 11 13:22:37 2016 (r307039) @@ -11,6 +11,7 @@ + From owner-svn-src-stable-11@freebsd.org Tue Oct 11 16:27:00 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FDC7C0DD1E; Tue, 11 Oct 2016 16:27:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECF25C72; Tue, 11 Oct 2016 16:26:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BGQxsa013906; Tue, 11 Oct 2016 16:26:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BGQxGd013905; Tue, 11 Oct 2016 16:26:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610111626.u9BGQxGd013905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 11 Oct 2016 16:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307045 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 16:27:00 -0000 Author: mav Date: Tue Oct 11 16:26:58 2016 New Revision: 307045 URL: https://svnweb.freebsd.org/changeset/base/307045 Log: MFC r305193: MFV r302642: 6876 Stack corruption after importing a pool with a too-long name illumos/illumos-gate@c971037baa5d64dfecf6d87ed602fc3116ebec41 https://github.com/illumos/illumos-gate/commit/c971037baa5d64dfecf6d87ed602fc3116ebec41 https://www.illumos.org/issues/6876 Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for trouble. We should check every dataset on import, using a 1024 byte buffer and checking each time to see if the dataset's new name is longer than 256 bytes. Reviewed by: Prakash Surya Reviewed by: Dan Kimmel Reviewed by: George Wilson Reviewed by: Yuri Pankov Approved by: Richard Lowe Author: Paul Dagnelie Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Oct 11 16:12:12 2016 (r307044) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Oct 11 16:26:58 2016 (r307045) @@ -1996,6 +1996,19 @@ spa_load_verify_cb(spa_t *spa, zilog_t * return (0); } +/* ARGSUSED */ +int +verify_dataset_name_len(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg) +{ + char namebuf[MAXPATHLEN]; + dsl_dataset_name(ds, namebuf); + if (strlen(namebuf) > MAXNAMELEN) { + return (SET_ERROR(ENAMETOOLONG)); + } + + return (0); +} + static int spa_load_verify(spa_t *spa) { @@ -2010,6 +2023,14 @@ spa_load_verify(spa_t *spa) if (policy.zrp_request & ZPOOL_NEVER_REWIND) return (0); + dsl_pool_config_enter(spa->spa_dsl_pool, FTAG); + error = dmu_objset_find_dp(spa->spa_dsl_pool, + spa->spa_dsl_pool->dp_root_dir_obj, verify_dataset_name_len, NULL, + DS_FIND_CHILDREN); + dsl_pool_config_exit(spa->spa_dsl_pool, FTAG); + if (error != 0) + return (error); + rio = zio_root(spa, NULL, &sle, ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE); From owner-svn-src-stable-11@freebsd.org Tue Oct 11 16:29:45 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D258C0DE28; Tue, 11 Oct 2016 16:29:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 777D3E76; Tue, 11 Oct 2016 16:29:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BGTiXH014075; Tue, 11 Oct 2016 16:29:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BGThn2014065; Tue, 11 Oct 2016 16:29:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610111629.u9BGThn2014065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 11 Oct 2016 16:29:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307046 - in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/commo... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 16:29:45 -0000 Author: mav Date: Tue Oct 11 16:29:43 2016 New Revision: 307046 URL: https://svnweb.freebsd.org/changeset/base/307046 Log: MFC r305195: MFV r302643: 6902 speed up listing of snapshots if requesting name only and sorting by name This was our change from the beginning, so just reduce the upstream diff. Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Tue Oct 11 16:26:58 2016 (r307045) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Tue Oct 11 16:29:43 2016 (r307046) @@ -21,8 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 Pawel Jakub Dawidek . - * All rights reserved. + * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. */ @@ -320,8 +319,8 @@ zfs_sort(const void *larg, const void *r } else if (psc->sc_prop == ZFS_PROP_NAME) { lvalid = rvalid = B_TRUE; - (void) strlcpy(lbuf, zfs_get_name(l), sizeof(lbuf)); - (void) strlcpy(rbuf, zfs_get_name(r), sizeof(rbuf)); + (void) strlcpy(lbuf, zfs_get_name(l), sizeof (lbuf)); + (void) strlcpy(rbuf, zfs_get_name(r), sizeof (rbuf)); lstr = lbuf; rstr = rbuf; Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h Tue Oct 11 16:26:58 2016 (r307045) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h Tue Oct 11 16:29:43 2016 (r307046) @@ -22,6 +22,7 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. */ Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Tue Oct 11 16:26:58 2016 (r307045) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Tue Oct 11 16:29:43 2016 (r307046) @@ -24,8 +24,7 @@ * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright 2012 Milan Jurik. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. - * Copyright (c) 2011-2012 Pawel Jakub Dawidek . - * All rights reserved. + * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. @@ -3009,7 +3008,7 @@ print_dataset(zfs_handle_t *zhp, list_cb if (pl->pl_prop == ZFS_PROP_NAME) { (void) strlcpy(property, zfs_get_name(zhp), - sizeof(property)); + sizeof (property)); propstr = property; right_justify = zfs_prop_align_right(pl->pl_prop); } else if (pl->pl_prop != ZPROP_INVAL) { Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Oct 11 16:26:58 2016 (r307045) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Oct 11 16:29:43 2016 (r307046) @@ -21,8 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 Pawel Jakub Dawidek . - * All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Oct 11 16:26:58 2016 (r307045) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Oct 11 16:29:43 2016 (r307046) @@ -24,9 +24,8 @@ * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved. - * Copyright (c) 2011-2012 Pawel Jakub Dawidek . - * All rights reserved. - * Copyright (c) 2012 Martin Matuska . All rights reserved. + * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved. + * Copyright (c) 2013 Martin Matuska. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Tue Oct 11 16:26:58 2016 (r307045) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Tue Oct 11 16:29:43 2016 (r307046) @@ -21,8 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 Pawel Jakub Dawidek . - * All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2013 Martin Matuska . All rights reserved. */ Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Tue Oct 11 16:26:58 2016 (r307045) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Tue Oct 11 16:29:43 2016 (r307046) @@ -22,8 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2015 by Delphix. All rights reserved. - * Copyright (c) 2012 Pawel Jakub Dawidek . - * All rights reserved. + * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Oct 11 16:26:58 2016 (r307045) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Oct 11 16:29:43 2016 (r307046) @@ -23,8 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. - * Copyright (c) 2012 Pawel Jakub Dawidek . - * All rights reserved. + * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Tue Oct 11 16:26:58 2016 (r307045) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Tue Oct 11 16:29:43 2016 (r307046) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright 2016 RackTop Systems. * Copyright (c) 2014 Integros [integros.com] Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Oct 11 16:26:58 2016 (r307045) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Oct 11 16:29:43 2016 (r307046) @@ -21,8 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011-2012 Pawel Jakub Dawidek . - * All rights reserved. + * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved. * Copyright 2013 Martin Matuska . All rights reserved. * Copyright 2014 Xin Li . All rights reserved. * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. From owner-svn-src-stable-11@freebsd.org Tue Oct 11 16:30:51 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A952C0DEA3; Tue, 11 Oct 2016 16:30:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E7246E; Tue, 11 Oct 2016 16:30:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BGUooS014860; Tue, 11 Oct 2016 16:30:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BGUoP4014856; Tue, 11 Oct 2016 16:30:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610111630.u9BGUoP4014856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 11 Oct 2016 16:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307047 - in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys/sysevent X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 16:30:51 -0000 Author: mav Date: Tue Oct 11 16:30:49 2016 New Revision: 307047 URL: https://svnweb.freebsd.org/changeset/base/307047 Log: MFC r305198: MFV r302647: 6922 Emit ESC_ZFS_VDEV_REMOVE_AUX after removing an aux device illumos/illumos-gate@63364b0ee2604783e7a55f8425888867768eafa4 https://github.com/illumos/illumos-gate/commit/63364b0ee2604783e7a55f84258888677 68eafa4 https://www.illumos.org/issues/6922 ZFS does not do a config_sync after removing an aux (spare, log, or cache) device. AFAICT this isn't being done because it is slow and was deemed unnecessary. However, it should be such a rare operation that speed doesn't matter, and not doing it results in two problems: 1) It is theoretically possible to remove an aux device from one pool and attach it to another, then lose power. When power is restored, both pools woul d think that they own the aux device. 2) Removal of the aux device doesn't send any useful sysevents to userland. Reviewed by: George Wilson Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Alan Somers Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Oct 11 16:29:43 2016 (r307046) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Oct 11 16:30:49 2016 (r307047) @@ -5773,6 +5773,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui } else { error = SET_ERROR(EBUSY); } + spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); } else if (spa->spa_l2cache.sav_vdevs != NULL && nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config, ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache) == 0 && @@ -5784,6 +5785,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv); spa_load_l2cache(spa); spa->spa_l2cache.sav_sync = B_TRUE; + spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); } else if (vd != NULL && vd->vdev_islog) { ASSERT(!locked); ASSERT(vd == vd->vdev_top); @@ -5822,6 +5824,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui */ spa_vdev_remove_from_namespace(spa, vd); + spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV); } else if (vd != NULL) { /* * Normal vdevs cannot be removed (yet). @@ -5835,7 +5838,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui } if (!locked) - return (spa_vdev_exit(spa, NULL, txg, error)); + error = spa_vdev_exit(spa, NULL, txg, error); return (error); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Tue Oct 11 16:29:43 2016 (r307046) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Tue Oct 11 16:30:49 2016 (r307047) @@ -249,6 +249,8 @@ extern "C" { #define ESC_ZFS_RESILVER_START "ESC_ZFS_resilver_start" #define ESC_ZFS_RESILVER_FINISH "ESC_ZFS_resilver_finish" #define ESC_ZFS_VDEV_REMOVE "ESC_ZFS_vdev_remove" +#define ESC_ZFS_VDEV_REMOVE_AUX "ESC_ZFS_vdev_remove_aux" +#define ESC_ZFS_VDEV_REMOVE_DEV "ESC_ZFS_vdev_remove_dev" #define ESC_ZFS_POOL_CREATE "ESC_ZFS_pool_create" #define ESC_ZFS_POOL_DESTROY "ESC_ZFS_pool_destroy" #define ESC_ZFS_POOL_IMPORT "ESC_ZFS_pool_import" From owner-svn-src-stable-11@freebsd.org Tue Oct 11 16:31:56 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 907B6C0DF30; Tue, 11 Oct 2016 16:31:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D5252D3; Tue, 11 Oct 2016 16:31:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BGVtfu015548; Tue, 11 Oct 2016 16:31:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BGVt3u015547; Tue, 11 Oct 2016 16:31:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610111631.u9BGVt3u015547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 11 Oct 2016 16:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307048 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 16:31:56 -0000 Author: mav Date: Tue Oct 11 16:31:55 2016 New Revision: 307048 URL: https://svnweb.freebsd.org/changeset/base/307048 Log: MFC r305199: MFV r302648: 7019 zfsdev_ioctl skips secpolicy when FKIOCTL is set Note that the bulk of the upstream change is not applicable to FreeBSD and the affected files are not even in the vendor area. illumos/illumos-gate@45b1747515a17db45e8971501ee84a26bdff37b2 https://github.com/illumos/illumos-gate/commit/45b1747515a17db45e8971501ee84a26bdff37b2 https://www.illumos.org/issues/7019 Currently zfsdev_ioctl, when confronted by a request with the FKIOCTL flag set, skips all processing of secpolicy functions. This means that ZFS is not doing any kind of verification of the credentials or access rights of the caller and assuming that (as it is an in-kernel client) all such checks have already been done. This turns out to be quite a dangerous assumption, especially with respect to sdev. In general I don't think it's particularly reasonable to offload this enforcement of access rights onto other kernel subsystems when ZFS has some particular local semantics in this area (delegated datasets etc) and does not provide any kind of API to allow other subsystems to avoid code duplication when doing it. ZFS should apply its normal access policy to requests from within the kernel, and callers should take care to give it the correct credentials and call it from the correct context in order to get the results they need. You can observe the currently unfortunate consequences of this bug in any non- global zone that has access to /dev/zvol or any subset of it via sdev profiles. In particular, a zone used to contain a KVM or similar which has a single zvol passed through to it using a Reviewed by: Richard Lowe Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Alex Wilson Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Oct 11 16:30:49 2016 (r307047) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Oct 11 16:31:55 2016 (r307048) @@ -26,7 +26,7 @@ * Copyright 2014 Xin Li . All rights reserved. * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2014, Joyent, Inc. All rights reserved. + * Copyright (c) 2014, 2016 Joyent, Inc. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. @@ -6359,7 +6359,7 @@ zfsdev_ioctl(struct cdev *dev, u_long zc break; } - if (error == 0 && !(flag & FKIOCTL)) + if (error == 0) error = vec->zvec_secpolicy(zc, innvl, cr); if (error != 0) From owner-svn-src-stable-11@freebsd.org Tue Oct 11 16:32:51 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DB26C0C077; Tue, 11 Oct 2016 16:32:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFFD07F7; Tue, 11 Oct 2016 16:32:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BGWo4T017831; Tue, 11 Oct 2016 16:32:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BGWnQZ017825; Tue, 11 Oct 2016 16:32:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610111632.u9BGWnQZ017825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 11 Oct 2016 16:32:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307049 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 16:32:51 -0000 Author: mav Date: Tue Oct 11 16:32:49 2016 New Revision: 307049 URL: https://svnweb.freebsd.org/changeset/base/307049 Log: MFC r305200: MFV r302651: 7054 dmu_tx_hold_t should use refcount_t to track space illumos/illumos-gate@0c779ad424a92a84d1e07d47cab7f8009189202b https://github.com/illumos/illumos-gate/commit/0c779ad424a92a84d1e07d47cab7f8009 189202b https://www.illumos.org/issues/7054 upstream: ee0003de7d3e598499be7ac3fe6b61efcc47cb7f DLPX-40399 dmu_tx_hold_t should use refcount_t to track space Reviewed by: George Wilson Reviewed by: Paul Dagnelie Reviewed by: Igor Kozhukhov Approved by: Dan McDonald Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Tue Oct 11 16:31:55 2016 (r307048) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Tue Oct 11 16:32:49 2016 (r307049) @@ -129,6 +129,12 @@ dmu_tx_hold_object_impl(dmu_tx_t *tx, ob txh = kmem_zalloc(sizeof (dmu_tx_hold_t), KM_SLEEP); txh->txh_tx = tx; txh->txh_dnode = dn; + refcount_create(&txh->txh_space_towrite); + refcount_create(&txh->txh_space_tofree); + refcount_create(&txh->txh_space_tooverwrite); + refcount_create(&txh->txh_space_tounref); + refcount_create(&txh->txh_memory_tohold); + refcount_create(&txh->txh_fudge); #ifdef ZFS_DEBUG txh->txh_type = type; txh->txh_arg1 = arg1; @@ -201,12 +207,18 @@ dmu_tx_count_twig(dmu_tx_hold_t *txh, dn freeable = (bp && (freeable || dsl_dataset_block_freeable(ds, bp, bp->blk_birth))); - if (freeable) - txh->txh_space_tooverwrite += space; - else - txh->txh_space_towrite += space; - if (bp) - txh->txh_space_tounref += bp_get_dsize(os->os_spa, bp); + if (freeable) { + (void) refcount_add_many(&txh->txh_space_tooverwrite, + space, FTAG); + } else { + (void) refcount_add_many(&txh->txh_space_towrite, + space, FTAG); + } + + if (bp) { + (void) refcount_add_many(&txh->txh_space_tounref, + bp_get_dsize(os->os_spa, bp), FTAG); + } dmu_tx_count_twig(txh, dn, parent, level + 1, blkid >> epbs, freeable, history); @@ -336,8 +348,11 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u bits = 64 - min_bs; epbs = min_ibs - SPA_BLKPTRSHIFT; for (bits -= epbs * (nlvls - 1); - bits >= 0; bits -= epbs) - txh->txh_fudge += 1ULL << max_ibs; + bits >= 0; bits -= epbs) { + (void) refcount_add_many( + &txh->txh_fudge, + 1ULL << max_ibs, FTAG); + } goto out; } off += delta; @@ -353,7 +368,8 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u */ start = P2ALIGN(off, 1ULL << max_bs); end = P2ROUNDUP(off + len, 1ULL << max_bs) - 1; - txh->txh_space_towrite += end - start + 1; + (void) refcount_add_many(&txh->txh_space_towrite, + end - start + 1, FTAG); start >>= min_bs; end >>= min_bs; @@ -368,18 +384,21 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u start >>= epbs; end >>= epbs; ASSERT3U(end, >=, start); - txh->txh_space_towrite += (end - start + 1) << max_ibs; + (void) refcount_add_many(&txh->txh_space_towrite, + (end - start + 1) << max_ibs, FTAG); if (start != 0) { /* * We also need a new blkid=0 indirect block * to reference any existing file data. */ - txh->txh_space_towrite += 1ULL << max_ibs; + (void) refcount_add_many(&txh->txh_space_towrite, + 1ULL << max_ibs, FTAG); } } out: - if (txh->txh_space_towrite + txh->txh_space_tooverwrite > + if (refcount_count(&txh->txh_space_towrite) + + refcount_count(&txh->txh_space_tooverwrite) > 2 * DMU_MAX_ACCESS) err = SET_ERROR(EFBIG); @@ -398,12 +417,15 @@ dmu_tx_count_dnode(dmu_tx_hold_t *txh) if (dn && dn->dn_dbuf->db_blkptr && dsl_dataset_block_freeable(dn->dn_objset->os_dsl_dataset, dn->dn_dbuf->db_blkptr, dn->dn_dbuf->db_blkptr->blk_birth)) { - txh->txh_space_tooverwrite += space; - txh->txh_space_tounref += space; + (void) refcount_add_many(&txh->txh_space_tooverwrite, + space, FTAG); + (void) refcount_add_many(&txh->txh_space_tounref, space, FTAG); } else { - txh->txh_space_towrite += space; - if (dn && dn->dn_dbuf->db_blkptr) - txh->txh_space_tounref += space; + (void) refcount_add_many(&txh->txh_space_towrite, space, FTAG); + if (dn && dn->dn_dbuf->db_blkptr) { + (void) refcount_add_many(&txh->txh_space_tounref, + space, FTAG); + } } } @@ -525,7 +547,8 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, ui break; } - txh->txh_memory_tohold += dbuf->db.db_size; + (void) refcount_add_many(&txh->txh_memory_tohold, + dbuf->db.db_size, FTAG); /* * We don't check memory_tohold against DMU_MAX_ACCESS because @@ -578,20 +601,23 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, ui (dn->dn_indblkshift - SPA_BLKPTRSHIFT); while (level++ < maxlevel) { - txh->txh_memory_tohold += MAX(MIN(blkcnt, nl1blks), 1) - << dn->dn_indblkshift; + (void) refcount_add_many(&txh->txh_memory_tohold, + MAX(MIN(blkcnt, nl1blks), 1) << dn->dn_indblkshift, + FTAG); blkcnt = 1 + (blkcnt >> epbs); } } /* account for new level 1 indirect blocks that might show up */ if (skipped > 0) { - txh->txh_fudge += skipped << dn->dn_indblkshift; + (void) refcount_add_many(&txh->txh_fudge, + skipped << dn->dn_indblkshift, FTAG); skipped = MIN(skipped, DMU_MAX_DELETEBLKCNT >> epbs); - txh->txh_memory_tohold += skipped << dn->dn_indblkshift; + (void) refcount_add_many(&txh->txh_memory_tohold, + skipped << dn->dn_indblkshift, FTAG); } - txh->txh_space_tofree += space; - txh->txh_space_tounref += unref; + (void) refcount_add_many(&txh->txh_space_tofree, space, FTAG); + (void) refcount_add_many(&txh->txh_space_tounref, unref, FTAG); } /* @@ -617,7 +643,10 @@ dmu_tx_mark_netfree(dmu_tx_t *tx) * cause overflows when doing math with these values (e.g. in * dmu_tx_try_assign()). */ - txh->txh_space_tofree = txh->txh_space_tounref = 1024 * 1024 * 1024; + (void) refcount_add_many(&txh->txh_space_tofree, + 1024 * 1024 * 1024, FTAG); + (void) refcount_add_many(&txh->txh_space_tounref, + 1024 * 1024 * 1024, FTAG); } void @@ -717,9 +746,7 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t o { dmu_tx_hold_t *txh; dnode_t *dn; - dsl_dataset_phys_t *ds_phys; - uint64_t nblocks; - int epbs, err; + int err; ASSERT(tx->tx_txg == 0); @@ -762,12 +789,17 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t o */ bp = &dn->dn_phys->dn_blkptr[0]; if (dsl_dataset_block_freeable(dn->dn_objset->os_dsl_dataset, - bp, bp->blk_birth)) - txh->txh_space_tooverwrite += MZAP_MAX_BLKSZ; - else - txh->txh_space_towrite += MZAP_MAX_BLKSZ; - if (!BP_IS_HOLE(bp)) - txh->txh_space_tounref += MZAP_MAX_BLKSZ; + bp, bp->blk_birth)) { + (void) refcount_add_many(&txh->txh_space_tooverwrite, + MZAP_MAX_BLKSZ, FTAG); + } else { + (void) refcount_add_many(&txh->txh_space_towrite, + MZAP_MAX_BLKSZ, FTAG); + } + if (!BP_IS_HOLE(bp)) { + (void) refcount_add_many(&txh->txh_space_tounref, + MZAP_MAX_BLKSZ, FTAG); + } return; } @@ -789,15 +821,29 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t o /* * If the modified blocks are scattered to the four winds, - * we'll have to modify an indirect twig for each. + * we'll have to modify an indirect twig for each. We can make + * modifications at up to 3 locations: + * - header block at the beginning of the object + * - target leaf block + * - end of the object, where we might need to write: + * - a new leaf block if the target block needs to be split + * - the new pointer table, if it is growing + * - the new cookie table, if it is growing */ - epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - ds_phys = dsl_dataset_phys(dn->dn_objset->os_dsl_dataset); - for (nblocks = dn->dn_maxblkid >> epbs; nblocks != 0; nblocks >>= epbs) - if (ds_phys->ds_prev_snap_obj) - txh->txh_space_towrite += 3 << dn->dn_indblkshift; - else - txh->txh_space_tooverwrite += 3 << dn->dn_indblkshift; + int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; + dsl_dataset_phys_t *ds_phys = + dsl_dataset_phys(dn->dn_objset->os_dsl_dataset); + for (int lvl = 1; lvl < dn->dn_nlevels; lvl++) { + uint64_t num_indirects = 1 + (dn->dn_maxblkid >> (epbs * lvl)); + uint64_t spc = MIN(3, num_indirects) << dn->dn_indblkshift; + if (ds_phys->ds_prev_snap_obj != 0) { + (void) refcount_add_many(&txh->txh_space_towrite, + spc, FTAG); + } else { + (void) refcount_add_many(&txh->txh_space_tooverwrite, + spc, FTAG); + } + } } void @@ -822,7 +868,7 @@ dmu_tx_hold_space(dmu_tx_t *tx, uint64_t txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, DMU_NEW_OBJECT, THT_SPACE, space, 0); - txh->txh_space_towrite += space; + (void) refcount_add_many(&txh->txh_space_towrite, space, FTAG); } int @@ -1175,12 +1221,12 @@ dmu_tx_try_assign(dmu_tx_t *tx, txg_how_ (void) refcount_add(&dn->dn_tx_holds, tx); mutex_exit(&dn->dn_mtx); } - towrite += txh->txh_space_towrite; - tofree += txh->txh_space_tofree; - tooverwrite += txh->txh_space_tooverwrite; - tounref += txh->txh_space_tounref; - tohold += txh->txh_memory_tohold; - fudge += txh->txh_fudge; + towrite += refcount_count(&txh->txh_space_towrite); + tofree += refcount_count(&txh->txh_space_tofree); + tooverwrite += refcount_count(&txh->txh_space_tooverwrite); + tounref += refcount_count(&txh->txh_space_tounref); + tohold += refcount_count(&txh->txh_memory_tohold); + fudge += refcount_count(&txh->txh_fudge); } /* @@ -1383,24 +1429,59 @@ dmu_tx_willuse_space(dmu_tx_t *tx, int64 #endif } -void -dmu_tx_commit(dmu_tx_t *tx) +static void +dmu_tx_destroy(dmu_tx_t *tx) { dmu_tx_hold_t *txh; + while ((txh = list_head(&tx->tx_holds)) != NULL) { + dnode_t *dn = txh->txh_dnode; + + list_remove(&tx->tx_holds, txh); + refcount_destroy_many(&txh->txh_space_towrite, + refcount_count(&txh->txh_space_towrite)); + refcount_destroy_many(&txh->txh_space_tofree, + refcount_count(&txh->txh_space_tofree)); + refcount_destroy_many(&txh->txh_space_tooverwrite, + refcount_count(&txh->txh_space_tooverwrite)); + refcount_destroy_many(&txh->txh_space_tounref, + refcount_count(&txh->txh_space_tounref)); + refcount_destroy_many(&txh->txh_memory_tohold, + refcount_count(&txh->txh_memory_tohold)); + refcount_destroy_many(&txh->txh_fudge, + refcount_count(&txh->txh_fudge)); + kmem_free(txh, sizeof (dmu_tx_hold_t)); + if (dn != NULL) + dnode_rele(dn, tx); + } + + list_destroy(&tx->tx_callbacks); + list_destroy(&tx->tx_holds); +#ifdef ZFS_DEBUG + refcount_destroy_many(&tx->tx_space_written, + refcount_count(&tx->tx_space_written)); + refcount_destroy_many(&tx->tx_space_freed, + refcount_count(&tx->tx_space_freed)); +#endif + kmem_free(tx, sizeof (dmu_tx_t)); +} + +void +dmu_tx_commit(dmu_tx_t *tx) +{ ASSERT(tx->tx_txg != 0); /* * Go through the transaction's hold list and remove holds on * associated dnodes, notifying waiters if no holds remain. */ - while (txh = list_head(&tx->tx_holds)) { + for (dmu_tx_hold_t *txh = list_head(&tx->tx_holds); txh != NULL; + txh = list_next(&tx->tx_holds, txh)) { dnode_t *dn = txh->txh_dnode; - list_remove(&tx->tx_holds, txh); - kmem_free(txh, sizeof (dmu_tx_hold_t)); if (dn == NULL) continue; + mutex_enter(&dn->dn_mtx); ASSERT3U(dn->dn_assigned_txg, ==, tx->tx_txg); @@ -1409,7 +1490,6 @@ dmu_tx_commit(dmu_tx_t *tx) cv_broadcast(&dn->dn_notxholds); } mutex_exit(&dn->dn_mtx); - dnode_rele(dn, tx); } if (tx->tx_tempreserve_cookie) @@ -1421,51 +1501,26 @@ dmu_tx_commit(dmu_tx_t *tx) if (tx->tx_anyobj == FALSE) txg_rele_to_sync(&tx->tx_txgh); - list_destroy(&tx->tx_callbacks); - list_destroy(&tx->tx_holds); #ifdef ZFS_DEBUG dprintf("towrite=%llu written=%llu tofree=%llu freed=%llu\n", tx->tx_space_towrite, refcount_count(&tx->tx_space_written), tx->tx_space_tofree, refcount_count(&tx->tx_space_freed)); - refcount_destroy_many(&tx->tx_space_written, - refcount_count(&tx->tx_space_written)); - refcount_destroy_many(&tx->tx_space_freed, - refcount_count(&tx->tx_space_freed)); #endif - kmem_free(tx, sizeof (dmu_tx_t)); + dmu_tx_destroy(tx); } void dmu_tx_abort(dmu_tx_t *tx) { - dmu_tx_hold_t *txh; - ASSERT(tx->tx_txg == 0); - while (txh = list_head(&tx->tx_holds)) { - dnode_t *dn = txh->txh_dnode; - - list_remove(&tx->tx_holds, txh); - kmem_free(txh, sizeof (dmu_tx_hold_t)); - if (dn != NULL) - dnode_rele(dn, tx); - } - /* * Call any registered callbacks with an error code. */ if (!list_is_empty(&tx->tx_callbacks)) dmu_tx_do_callbacks(&tx->tx_callbacks, ECANCELED); - list_destroy(&tx->tx_callbacks); - list_destroy(&tx->tx_holds); -#ifdef ZFS_DEBUG - refcount_destroy_many(&tx->tx_space_written, - refcount_count(&tx->tx_space_written)); - refcount_destroy_many(&tx->tx_space_freed, - refcount_count(&tx->tx_space_freed)); -#endif - kmem_free(tx, sizeof (dmu_tx_t)); + dmu_tx_destroy(tx); } uint64_t @@ -1504,7 +1559,7 @@ dmu_tx_do_callbacks(list_t *cb_list, int { dmu_tx_callback_t *dcb; - while (dcb = list_head(cb_list)) { + while ((dcb = list_head(cb_list)) != NULL) { list_remove(cb_list, dcb); dcb->dcb_func(dcb->dcb_data, error); kmem_free(dcb, sizeof (dmu_tx_callback_t)); @@ -1562,18 +1617,24 @@ dmu_tx_hold_spill(dmu_tx_t *tx, uint64_t /* If blkptr doesn't exist then add space to towrite */ if (!(dn->dn_phys->dn_flags & DNODE_FLAG_SPILL_BLKPTR)) { - txh->txh_space_towrite += SPA_OLD_MAXBLOCKSIZE; + (void) refcount_add_many(&txh->txh_space_towrite, + SPA_OLD_MAXBLOCKSIZE, FTAG); } else { blkptr_t *bp; bp = &dn->dn_phys->dn_spill; if (dsl_dataset_block_freeable(dn->dn_objset->os_dsl_dataset, - bp, bp->blk_birth)) - txh->txh_space_tooverwrite += SPA_OLD_MAXBLOCKSIZE; - else - txh->txh_space_towrite += SPA_OLD_MAXBLOCKSIZE; - if (!BP_IS_HOLE(bp)) - txh->txh_space_tounref += SPA_OLD_MAXBLOCKSIZE; + bp, bp->blk_birth)) { + (void) refcount_add_many(&txh->txh_space_tooverwrite, + SPA_OLD_MAXBLOCKSIZE, FTAG); + } else { + (void) refcount_add_many(&txh->txh_space_towrite, + SPA_OLD_MAXBLOCKSIZE, FTAG); + } + if (!BP_IS_HOLE(bp)) { + (void) refcount_add_many(&txh->txh_space_tounref, + SPA_OLD_MAXBLOCKSIZE, FTAG); + } } } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h Tue Oct 11 16:31:55 2016 (r307048) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h Tue Oct 11 16:32:49 2016 (r307049) @@ -23,7 +23,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2015 by Delphix. All rights reserved. */ #ifndef _SYS_DMU_TX_H @@ -101,12 +101,12 @@ typedef struct dmu_tx_hold { dmu_tx_t *txh_tx; list_node_t txh_node; struct dnode *txh_dnode; - uint64_t txh_space_towrite; - uint64_t txh_space_tofree; - uint64_t txh_space_tooverwrite; - uint64_t txh_space_tounref; - uint64_t txh_memory_tohold; - uint64_t txh_fudge; + refcount_t txh_space_towrite; + refcount_t txh_space_tofree; + refcount_t txh_space_tooverwrite; + refcount_t txh_space_tounref; + refcount_t txh_memory_tohold; + refcount_t txh_fudge; #ifdef ZFS_DEBUG enum dmu_tx_hold_type txh_type; uint64_t txh_arg1; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Tue Oct 11 16:31:55 2016 (r307048) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Tue Oct 11 16:32:49 2016 (r307049) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2015 by Delphix. All rights reserved. */ #ifndef _SYS_ZAP_H @@ -80,6 +80,7 @@ */ #include +#include #ifdef __cplusplus extern "C" { @@ -217,7 +218,7 @@ int zap_prefetch_uint64(objset_t *os, ui int key_numints); int zap_count_write(objset_t *os, uint64_t zapobj, const char *name, - int add, uint64_t *towrite, uint64_t *tooverwrite); + int add, refcount_t *towrite, refcount_t *tooverwrite); /* * Create an attribute with the given name and value. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h Tue Oct 11 16:31:55 2016 (r307048) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h Tue Oct 11 16:32:49 2016 (r307049) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -213,8 +214,8 @@ int fzap_lookup(zap_name_t *zn, uint64_t integer_size, uint64_t num_integers, void *buf, char *realname, int rn_len, boolean_t *normalization_conflictp); void fzap_prefetch(zap_name_t *zn); -int fzap_count_write(zap_name_t *zn, int add, uint64_t *towrite, - uint64_t *tooverwrite); +int fzap_count_write(zap_name_t *zn, int add, refcount_t *towrite, + refcount_t *tooverwrite); int fzap_add(zap_name_t *zn, uint64_t integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx); int fzap_update(zap_name_t *zn, Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Tue Oct 11 16:31:55 2016 (r307048) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Tue Oct 11 16:32:49 2016 (r307049) @@ -1342,8 +1342,8 @@ fzap_get_stats(zap_t *zap, zap_stats_t * } int -fzap_count_write(zap_name_t *zn, int add, uint64_t *towrite, - uint64_t *tooverwrite) +fzap_count_write(zap_name_t *zn, int add, refcount_t *towrite, + refcount_t *tooverwrite) { zap_t *zap = zn->zn_zap; zap_leaf_t *l; @@ -1353,9 +1353,11 @@ fzap_count_write(zap_name_t *zn, int add * Account for the header block of the fatzap. */ if (!add && dmu_buf_freeable(zap->zap_dbuf)) { - *tooverwrite += zap->zap_dbuf->db_size; + (void) refcount_add_many(tooverwrite, + zap->zap_dbuf->db_size, FTAG); } else { - *towrite += zap->zap_dbuf->db_size; + (void) refcount_add_many(towrite, + zap->zap_dbuf->db_size, FTAG); } /* @@ -1367,10 +1369,13 @@ fzap_count_write(zap_name_t *zn, int add * could extend the table. */ if (add) { - if (zap_f_phys(zap)->zap_ptrtbl.zt_blk == 0) - *towrite += zap->zap_dbuf->db_size; - else - *towrite += (zap->zap_dbuf->db_size * 3); + if (zap_f_phys(zap)->zap_ptrtbl.zt_blk == 0) { + (void) refcount_add_many(towrite, + zap->zap_dbuf->db_size, FTAG); + } else { + (void) refcount_add_many(towrite, + zap->zap_dbuf->db_size * 3, FTAG); + } } /* @@ -1383,13 +1388,14 @@ fzap_count_write(zap_name_t *zn, int add } if (!add && dmu_buf_freeable(l->l_dbuf)) { - *tooverwrite += l->l_dbuf->db_size; + (void) refcount_add_many(tooverwrite, l->l_dbuf->db_size, FTAG); } else { /* * If this an add operation, the leaf block could split. * Hence, we need to account for an additional leaf block. */ - *towrite += (add ? 2 : 1) * l->l_dbuf->db_size; + (void) refcount_add_many(towrite, + (add ? 2 : 1) * l->l_dbuf->db_size, FTAG); } zap_put_leaf(l); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Tue Oct 11 16:31:55 2016 (r307048) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Tue Oct 11 16:32:49 2016 (r307049) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -1414,7 +1414,7 @@ zap_get_stats(objset_t *os, uint64_t zap int zap_count_write(objset_t *os, uint64_t zapobj, const char *name, int add, - uint64_t *towrite, uint64_t *tooverwrite) + refcount_t *towrite, refcount_t *tooverwrite) { zap_t *zap; int err = 0; @@ -1424,14 +1424,15 @@ zap_count_write(objset_t *os, uint64_t z * be affected in this operation. So, account for the worst case : * - 3 blocks overwritten: target leaf, ptrtbl block, header block * - 4 new blocks written if adding: - * - 2 blocks for possibly split leaves, - * - 2 grown ptrtbl blocks + * - 2 blocks for possibly split leaves, + * - 2 grown ptrtbl blocks * * This also accomodates the case where an add operation to a fairly * large microzap results in a promotion to fatzap. */ if (name == NULL) { - *towrite += (3 + (add ? 4 : 0)) * SPA_OLD_MAXBLOCKSIZE; + (void) refcount_add_many(towrite, + (3 + (add ? 4 : 0)) * SPA_OLD_MAXBLOCKSIZE, FTAG); return (err); } @@ -1455,7 +1456,8 @@ zap_count_write(objset_t *os, uint64_t z /* * We treat this case as similar to (name == NULL) */ - *towrite += (3 + (add ? 4 : 0)) * SPA_OLD_MAXBLOCKSIZE; + (void) refcount_add_many(towrite, + (3 + (add ? 4 : 0)) * SPA_OLD_MAXBLOCKSIZE, FTAG); } } else { /* @@ -1473,13 +1475,17 @@ zap_count_write(objset_t *os, uint64_t z * 4 new blocks written : 2 new split leaf, 2 grown * ptrtbl blocks */ - if (dmu_buf_freeable(zap->zap_dbuf)) - *tooverwrite += MZAP_MAX_BLKSZ; - else - *towrite += MZAP_MAX_BLKSZ; + if (dmu_buf_freeable(zap->zap_dbuf)) { + (void) refcount_add_many(tooverwrite, + MZAP_MAX_BLKSZ, FTAG); + } else { + (void) refcount_add_many(towrite, + MZAP_MAX_BLKSZ, FTAG); + } if (add) { - *towrite += 4 * MZAP_MAX_BLKSZ; + (void) refcount_add_many(towrite, + 4 * MZAP_MAX_BLKSZ, FTAG); } } From owner-svn-src-stable-11@freebsd.org Tue Oct 11 16:33:45 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E4DAC0C0E6; Tue, 11 Oct 2016 16:33:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B953964; Tue, 11 Oct 2016 16:33:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BGXiBt017944; Tue, 11 Oct 2016 16:33:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BGXhrB017936; Tue, 11 Oct 2016 16:33:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610111633.u9BGXhrB017936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 11 Oct 2016 16:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307050 - in stable/11: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 16:33:45 -0000 Author: mav Date: Tue Oct 11 16:33:43 2016 New Revision: 307050 URL: https://svnweb.freebsd.org/changeset/base/307050 Log: MFC r305207: MFV r302659: 6931 lib/libzfs: cleanup gcc warnings illumos/illumos-gate@88f61dee20b358671b1b643e9d1dbf220a1d69be https://github.com/illumos/illumos-gate/commit/88f61dee20b358671b1b643e9d1dbf220a1d69be https://www.illumos.org/issues/6931 need cleanup: CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Igor Kozhukhov Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Tue Oct 11 16:32:49 2016 (r307049) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Tue Oct 11 16:33:43 2016 (r307050) @@ -24,9 +24,9 @@ * Use is subject to license terms. * * Portions Copyright 2007 Ramprakash Jelari - * * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. + * Copyright 2016 Igor Kozhukhov */ #include @@ -136,6 +136,9 @@ changelist_prefix(prop_changelist_t *clp case ZFS_PROP_SHARESMB: (void) zfs_unshare_smb(cn->cn_handle, NULL); break; + + default: + break; } } } Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Oct 11 16:32:49 2016 (r307049) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Oct 11 16:33:43 2016 (r307050) @@ -29,6 +29,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Igor Kozhukhov */ #include @@ -78,55 +79,18 @@ zfs_type_to_name(zfs_type_t type) return (dgettext(TEXT_DOMAIN, "snapshot")); case ZFS_TYPE_VOLUME: return (dgettext(TEXT_DOMAIN, "volume")); + case ZFS_TYPE_POOL: + return (dgettext(TEXT_DOMAIN, "pool")); + case ZFS_TYPE_BOOKMARK: + return (dgettext(TEXT_DOMAIN, "bookmark")); + default: + assert(!"unhandled zfs_type_t"); } return (NULL); } /* - * Given a path and mask of ZFS types, return a string describing this dataset. - * This is used when we fail to open a dataset and we cannot get an exact type. - * We guess what the type would have been based on the path and the mask of - * acceptable types. - */ -static const char * -path_to_str(const char *path, int types) -{ - /* - * When given a single type, always report the exact type. - */ - if (types == ZFS_TYPE_SNAPSHOT) - return (dgettext(TEXT_DOMAIN, "snapshot")); - if (types == ZFS_TYPE_FILESYSTEM) - return (dgettext(TEXT_DOMAIN, "filesystem")); - if (types == ZFS_TYPE_VOLUME) - return (dgettext(TEXT_DOMAIN, "volume")); - - /* - * The user is requesting more than one type of dataset. If this is the - * case, consult the path itself. If we're looking for a snapshot, and - * a '@' is found, then report it as "snapshot". Otherwise, remove the - * snapshot attribute and try again. - */ - if (types & ZFS_TYPE_SNAPSHOT) { - if (strchr(path, '@') != NULL) - return (dgettext(TEXT_DOMAIN, "snapshot")); - return (path_to_str(path, types & ~ZFS_TYPE_SNAPSHOT)); - } - - /* - * The user has requested either filesystems or volumes. - * We have no way of knowing a priori what type this would be, so always - * report it as "filesystem" or "volume", our two primitive types. - */ - if (types & ZFS_TYPE_FILESYSTEM) - return (dgettext(TEXT_DOMAIN, "filesystem")); - - assert(types & ZFS_TYPE_VOLUME); - return (dgettext(TEXT_DOMAIN, "volume")); -} - -/* * Validate a ZFS path. This is used even before trying to open the dataset, to * provide a more meaningful error message. We call zfs_error_aux() to * explain exactly why the name was not valid. @@ -187,6 +151,11 @@ zfs_validate_name(libzfs_handle_t *hdl, zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "reserved disk name")); break; + + default: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "(%d) not defined"), why); + break; } } @@ -769,7 +738,8 @@ libzfs_mnttab_fini(libzfs_handle_t *hdl) void *cookie = NULL; mnttab_node_t *mtn; - while (mtn = avl_destroy_nodes(&hdl->libzfs_mnttab_cache, &cookie)) { + while ((mtn = avl_destroy_nodes(&hdl->libzfs_mnttab_cache, &cookie)) + != NULL) { free(mtn->mtn_mt.mnt_special); free(mtn->mtn_mt.mnt_mountp); free(mtn->mtn_mt.mnt_fstype); @@ -841,7 +811,8 @@ libzfs_mnttab_remove(libzfs_handle_t *hd mnttab_node_t *ret; find.mtn_mt.mnt_special = (char *)fsname; - if (ret = avl_find(&hdl->libzfs_mnttab_cache, (void *)&find, NULL)) { + if ((ret = avl_find(&hdl->libzfs_mnttab_cache, (void *)&find, NULL)) + != NULL) { avl_remove(&hdl->libzfs_mnttab_cache, ret); free(ret->mtn_mt.mnt_special); free(ret->mtn_mt.mnt_mountp); @@ -1193,6 +1164,13 @@ badlabel: "component of '%s' is too long"), propname); break; + + default: + zfs_error_aux(hdl, + dgettext(TEXT_DOMAIN, + "(%d) not defined"), + why); + break; } (void) zfs_error(hdl, EZFS_BADPROP, errbuf); goto error; @@ -1311,12 +1289,17 @@ badlabel: } break; + case ZFS_PROP_UTF8ONLY: chosen_utf = (int)intval; break; + case ZFS_PROP_NORMALIZE: chosen_normal = (int)intval; break; + + default: + break; } /* @@ -1365,6 +1348,9 @@ badlabel: goto error; } break; + + default: + break; } } } @@ -1974,6 +1960,9 @@ get_numeric_property(zfs_handle_t *zhp, mntopt_on = MNTOPT_NBMAND; mntopt_off = MNTOPT_NONBMAND; break; + + default: + break; } /* @@ -3151,7 +3140,7 @@ create_parents(libzfs_handle_t *hdl, cha * up to the prefixlen-long one. */ for (cp = target + prefixlen + 1; - cp = strchr(cp, '/'); *cp = '/', cp++) { + (cp = strchr(cp, '/')) != NULL; *cp = '/', cp++) { *cp = '\0'; @@ -3914,7 +3903,7 @@ int zfs_rename(zfs_handle_t *zhp, const char *source, const char *target, renameflags_t flags) { - int ret; + int ret = 0; zfs_cmd_t zc = { 0 }; char *delim; prop_changelist_t *cl = NULL; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c Tue Oct 11 16:32:49 2016 (r307049) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c Tue Oct 11 16:33:43 2016 (r307050) @@ -23,6 +23,7 @@ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2016 Joyent, Inc. + * Copyright 2016 Igor Kozhukhov */ /* @@ -353,7 +354,7 @@ write_inuse_diffs(FILE *fp, differ_info_ int err; for (o = dr->ddr_first; o <= dr->ddr_last; o++) { - if (err = write_inuse_diffs_one(fp, di, o)) + if ((err = write_inuse_diffs_one(fp, di, o)) != 0) return (err); } return (0); Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Tue Oct 11 16:32:49 2016 (r307049) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Tue Oct 11 16:33:43 2016 (r307050) @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014 by Delphix. All rights reserved. + * Copyright 2016 Igor Kozhukhov */ /* @@ -475,7 +476,8 @@ zfs_is_shared_proto(zfs_handle_t *zhp, c if (!zfs_is_mounted(zhp, &mountpoint)) return (SHARED_NOT_SHARED); - if (rc = is_shared(zhp->zfs_hdl, mountpoint, proto)) { + if ((rc = is_shared(zhp->zfs_hdl, mountpoint, proto)) + != SHARED_NOT_SHARED) { if (where != NULL) *where = mountpoint; else Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Tue Oct 11 16:32:49 2016 (r307049) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Tue Oct 11 16:33:43 2016 (r307050) @@ -24,6 +24,7 @@ * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright 2016 Nexenta Systems, Inc. + * Copyright 2016 Igor Kozhukhov */ #include @@ -199,6 +200,9 @@ zpool_state_to_name(vdev_state_t state, return (gettext("DEGRADED")); case VDEV_STATE_HEALTHY: return (gettext("ONLINE")); + + default: + break; } return (gettext("UNKNOWN")); @@ -635,6 +639,11 @@ zpool_valid_proplist(libzfs_handle_t *hd goto error; } break; + + default: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "property '%s'(%d) not defined"), propname, prop); + break; } } @@ -943,6 +952,10 @@ zpool_name_valid(libzfs_handle_t *hdl, b "multiple '@' delimiters in name")); break; + default: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "(%d) not defined"), why); + break; } } return (B_FALSE); Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Oct 11 16:32:49 2016 (r307049) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Oct 11 16:33:43 2016 (r307050) @@ -27,6 +27,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Igor Kozhukhov */ #include @@ -1182,8 +1183,8 @@ dump_snapshot(zfs_handle_t *zhp, void *a pa.pa_fd = sdd->outfd; pa.pa_parsable = sdd->parsable; - if (err = pthread_create(&tid, NULL, - send_progress_thread, &pa)) { + if ((err = pthread_create(&tid, NULL, + send_progress_thread, &pa)) != 0) { zfs_close(zhp); return (err); } @@ -1661,7 +1662,7 @@ zfs_send(zfs_handle_t *zhp, const char * if (flags->dedup && !flags->dryrun) { featureflags |= (DMU_BACKUP_FEATURE_DEDUP | DMU_BACKUP_FEATURE_DEDUPPROPS); - if (err = pipe(pipefd)) { + if ((err = pipe(pipefd)) != 0) { zfs_error_aux(zhp->zfs_hdl, strerror(errno)); return (zfs_error(zhp->zfs_hdl, EZFS_PIPEFAILED, errbuf)); @@ -1669,7 +1670,7 @@ zfs_send(zfs_handle_t *zhp, const char * dda.outputfd = outfd; dda.inputfd = pipefd[1]; dda.dedup_hdl = zhp->zfs_hdl; - if (err = pthread_create(&tid, NULL, cksummer, &dda)) { + if ((err = pthread_create(&tid, NULL, cksummer, &dda)) != 0) { (void) close(pipefd[0]); (void) close(pipefd[1]); zfs_error_aux(zhp->zfs_hdl, strerror(errno)); Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Tue Oct 11 16:32:49 2016 (r307049) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Tue Oct 11 16:33:43 2016 (r307050) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright 2016 Igor Kozhukhov */ /* @@ -1062,6 +1063,10 @@ zprop_print_one_property(const char *nam case ZPROP_SRC_RECEIVED: str = "received"; break; + + default: + str = NULL; + assert(!"unhandled zprop_source_t"); } break; Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c Tue Oct 11 16:32:49 2016 (r307049) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c Tue Oct 11 16:33:43 2016 (r307050) @@ -22,6 +22,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright 2016 Igor Kozhukhov */ #include @@ -177,8 +178,9 @@ zfs_deleg_verify_nvlist(nvlist_t *nvp) nvpair_name(perm_name)); if (error) return (-1); - } while (perm_name = nvlist_next_nvpair(perms, perm_name)); - } while (who = nvlist_next_nvpair(nvp, who)); + } while ((perm_name = nvlist_next_nvpair(perms, perm_name)) + != NULL); + } while ((who = nvlist_next_nvpair(nvp, who)) != NULL); return (0); } From owner-svn-src-stable-11@freebsd.org Tue Oct 11 16:38:40 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D01B8C0C222; Tue, 11 Oct 2016 16:38:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1BCAB9A; Tue, 11 Oct 2016 16:38:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BGcdus018193; Tue, 11 Oct 2016 16:38:39 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BGcdP3018192; Tue, 11 Oct 2016 16:38:39 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610111638.u9BGcdP3018192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 11 Oct 2016 16:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307051 - stable/11/sys/conf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 16:38:40 -0000 Author: gjb Date: Tue Oct 11 16:38:39 2016 New Revision: 307051 URL: https://svnweb.freebsd.org/changeset/base/307051 Log: Switch stable/11 to -STABLE following the release. Reminded by: Piotr Smyrak Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/conf/newvers.sh Modified: stable/11/sys/conf/newvers.sh ============================================================================== --- stable/11/sys/conf/newvers.sh Tue Oct 11 16:33:43 2016 (r307050) +++ stable/11/sys/conf/newvers.sh Tue Oct 11 16:38:39 2016 (r307051) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="11.0" -BRANCH="PRERELEASE" +BRANCH="STABLE" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable-11@freebsd.org Tue Oct 11 17:12:28 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E52CC0D229; Tue, 11 Oct 2016 17:12:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 143BC108; Tue, 11 Oct 2016 17:12:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BHCRSw033967; Tue, 11 Oct 2016 17:12:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BHCR9A033965; Tue, 11 Oct 2016 17:12:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610111712.u9BHCR9A033965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 11 Oct 2016 17:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307061 - in stable/11/release/doc: en_US.ISO8859-1/errata share/xml X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 17:12:28 -0000 Author: emaste Date: Tue Oct 11 17:12:26 2016 New Revision: 307061 URL: https://svnweb.freebsd.org/changeset/base/307061 Log: Add missing ThunderX release notes Reviewed by: gjb Differential Revision: https://reviews.freebsd.org/D8217 Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml stable/11/release/doc/share/xml/release.ent Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Oct 11 17:11:17 2016 (r307060) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Oct 11 17:12:26 2016 (r307061) @@ -168,6 +168,29 @@ boot state "Wireless support for 802.11n has been added for additional wireless network drivers." + + + Some release notes pertaining to the Cavium ThunderX + platform (the &os;/&arch.arm64; reference platform) were + omitted: + + + + Support for the Cavium + Virtualized NIC ethernet driver has been added. + + + + Support for the GICv3 and + ITS device drivers has been added. + + + + Support for PCI + Enhanced Allocation support has been added. + + + Modified: stable/11/release/doc/share/xml/release.ent ============================================================================== --- stable/11/release/doc/share/xml/release.ent Tue Oct 11 17:11:17 2016 (r307060) +++ stable/11/release/doc/share/xml/release.ent Tue Oct 11 17:12:26 2016 (r307061) @@ -70,7 +70,7 @@ - + From owner-svn-src-stable-11@freebsd.org Tue Oct 11 17:47:55 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2A2BC0DD2A; Tue, 11 Oct 2016 17:47:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 823D5BF1; Tue, 11 Oct 2016 17:47:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BHlsBf045372; Tue, 11 Oct 2016 17:47:54 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BHlsbS045371; Tue, 11 Oct 2016 17:47:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610111747.u9BHlsbS045371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 11 Oct 2016 17:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307063 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 17:47:55 -0000 Author: gjb Date: Tue Oct 11 17:47:54 2016 New Revision: 307063 URL: https://svnweb.freebsd.org/changeset/base/307063 Log: Use the sponsors/vendors entities in the errata docs. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Oct 11 17:41:13 2016 (r307062) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Oct 11 17:47:54 2016 (r307063) @@ -4,6 +4,10 @@ %release; + +%sponsor; + +%vendor; ]> @@ -176,18 +180,21 @@ boot - Support for the Cavium - Virtualized NIC ethernet driver has been added. + Support for the Cavium Virtualized + NIC ethernet driver has been added. - Support for the GICv3 and - ITS device drivers has been added. + Support for the GICv3 and ITS device + drivers has been added. - Support for PCI - Enhanced Allocation support has been added. + Support for PCI Enhanced Allocation + support has been added. From owner-svn-src-stable-11@freebsd.org Tue Oct 11 21:59:24 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02A3AC0B241; Tue, 11 Oct 2016 21:59:24 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE88426F; Tue, 11 Oct 2016 21:59:23 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9BLxMSa041308; Tue, 11 Oct 2016 21:59:22 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9BLxMCt041306; Tue, 11 Oct 2016 21:59:22 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201610112159.u9BLxMCt041306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Tue, 11 Oct 2016 21:59:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307069 - stable/11/lib/libc/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 21:59:24 -0000 Author: jilles Date: Tue Oct 11 21:59:22 2016 New Revision: 307069 URL: https://svnweb.freebsd.org/changeset/base/307069 Log: MFC r305628: intro(2),_exit(2): Update for reaper (procctl(PROC_REAP_ACQUIRE)). Modified: stable/11/lib/libc/sys/_exit.2 stable/11/lib/libc/sys/intro.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/_exit.2 ============================================================================== --- stable/11/lib/libc/sys/_exit.2 Tue Oct 11 21:40:15 2016 (r307068) +++ stable/11/lib/libc/sys/_exit.2 Tue Oct 11 21:59:22 2016 (r307069) @@ -28,7 +28,7 @@ .\" @(#)_exit.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd September 8, 2016 .Dt EXIT 2 .Os .Sh NAME @@ -64,9 +64,11 @@ is set as defined by .Xr wait 2 . .It The parent process-ID of all of the calling process's existing child -processes are set to 1; the initialization process +processes are set to the process-ID of the calling process's reaper; +the reaper (normally the initialization process) inherits each of these processes (see +.Xr procctl 2 , .Xr init 8 and the .Sx DEFINITIONS Modified: stable/11/lib/libc/sys/intro.2 ============================================================================== --- stable/11/lib/libc/sys/intro.2 Tue Oct 11 21:40:15 2016 (r307068) +++ stable/11/lib/libc/sys/intro.2 Tue Oct 11 21:59:22 2016 (r307069) @@ -28,7 +28,7 @@ .\" @(#)intro.2 8.5 (Berkeley) 2/27/95 .\" $FreeBSD$ .\" -.Dd May 4, 2013 +.Dd September 8, 2016 .Dt INTRO 2 .Os .Sh NAME @@ -484,7 +484,10 @@ A new process is created by a currently .Xr fork 2 ) . The parent process ID of a process is initially the process ID of its creator. If the creating process exits, -the parent process ID of each child is set to the ID of a system process, +the parent process ID of each child is set to the ID of the calling process's +reaper (see +.Xr procctl 2 ) , +normally .Xr init 8 . .It Process Group Each active process is a member of a process group that is identified by @@ -533,7 +536,7 @@ when none of its members has a parent pr as the group, but is in a different process group. Note that when a process exits, the parent process for its children -is changed to be +is normally changed to be .Xr init 8 , which is in a separate session. Not all members of an orphaned process group are necessarily orphaned From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:04:37 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C824C0D62F; Wed, 12 Oct 2016 05:04:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 212C7DB4; Wed, 12 Oct 2016 05:04:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C54acf008074; Wed, 12 Oct 2016 05:04:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C54aGQ008073; Wed, 12 Oct 2016 05:04:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120504.u9C54aGQ008073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307100 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:04:37 -0000 Author: mav Date: Wed Oct 12 05:04:36 2016 New Revision: 307100 URL: https://svnweb.freebsd.org/changeset/base/307100 Log: MFC r305194: MFV r302642: 6876 Stack corruption after importing a pool with a too-long name illumos/illumos-gate@c971037baa5d64dfecf6d87ed602fc3116ebec41 https://github.com/illumos/illumos-gate/commit/c971037baa5d64dfecf6d87ed602fc3116ebec41 https://www.illumos.org/issues/6876 Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for trouble. We should check every dataset on import, using a 1024 byte buffer and checking each time to see if the dataset's new name is longer than 256 bytes. Reviewed by: Prakash Surya Reviewed by: Dan Kimmel Reviewed by: George Wilson Reviewed by: Yuri Pankov Approved by: Richard Lowe Author: Paul Dagnelie Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed Oct 12 03:37:43 2016 (r307099) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed Oct 12 05:04:36 2016 (r307100) @@ -1799,7 +1799,12 @@ zpool_import_props(libzfs_handle_t *hdl, case EEXIST: (void) zpool_standard_error(hdl, error, desc); break; - + case ENAMETOOLONG: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "new name of at least one dataset is longer than " + "the maximum allowable length")); + (void) zfs_error(hdl, EZFS_NAMETOOLONG, desc); + break; default: (void) zpool_standard_error(hdl, error, desc); zpool_explain_recover(hdl, From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:08:10 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7408C0D705; Wed, 12 Oct 2016 05:08:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E64CF49; Wed, 12 Oct 2016 05:08:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C589oU008261; Wed, 12 Oct 2016 05:08:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C589Rr008257; Wed, 12 Oct 2016 05:08:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120508.u9C589Rr008257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:08:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307101 - in stable/11/sys/cddl/contrib/opensolaris: common/zfs uts/common/fs/zfs uts/common/fs/zfs/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:08:10 -0000 Author: mav Date: Wed Oct 12 05:08:09 2016 New Revision: 307101 URL: https://svnweb.freebsd.org/changeset/base/307101 Log: MFC r305197: MFV r302646: 6980 6902 causes zfs send to break due to 32-bit/64-bit struct mismatch illumos/illumos-gate@ea4a67f462de0a39a9adea8197bcdef849de5371 https://github.com/illumos/illumos-gate/commit/ea4a67f462de0a39a9adea8197bcdef84 9de5371 https://www.illumos.org/issues/6980 doing zfs send -i snap1 snap2 >testfile results in internal error: Invalid argument Abort (core dumped) Reviewed by: Paul Dagnelie Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c Wed Oct 12 05:04:36 2016 (r307100) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c Wed Oct 12 05:08:09 2016 (r307101) @@ -55,8 +55,52 @@ zfs_cmd_compat_get(zfs_cmd_t *zc, caddr_ zfs_cmd_zcmd_t *zcmd_c; zfs_cmd_edbp_t *edbp_c; zfs_cmd_resume_t *resume_c; + zfs_cmd_inlanes_t *inlanes_c; switch (cflag) { + case ZFS_CMD_COMPAT_INLANES: + inlanes_c = (void *)addr; + /* zc */ + strlcpy(zc->zc_name, inlanes_c->zc_name, MAXPATHLEN); + strlcpy(zc->zc_value, inlanes_c->zc_value, MAXPATHLEN * 2); + strlcpy(zc->zc_string, inlanes_c->zc_string, MAXPATHLEN); + +#define FIELD_COPY(field) zc->field = inlanes_c->field + FIELD_COPY(zc_nvlist_src); + FIELD_COPY(zc_nvlist_src_size); + FIELD_COPY(zc_nvlist_dst); + FIELD_COPY(zc_nvlist_dst_size); + FIELD_COPY(zc_nvlist_dst_filled); + FIELD_COPY(zc_pad2); + FIELD_COPY(zc_history); + FIELD_COPY(zc_guid); + FIELD_COPY(zc_nvlist_conf); + FIELD_COPY(zc_nvlist_conf_size); + FIELD_COPY(zc_cookie); + FIELD_COPY(zc_objset_type); + FIELD_COPY(zc_perm_action); + FIELD_COPY(zc_history_len); + FIELD_COPY(zc_history_offset); + FIELD_COPY(zc_obj); + FIELD_COPY(zc_iflags); + FIELD_COPY(zc_share); + FIELD_COPY(zc_jailid); + FIELD_COPY(zc_objset_stats); + FIELD_COPY(zc_begin_record); + FIELD_COPY(zc_inject_record); + FIELD_COPY(zc_defer_destroy); + FIELD_COPY(zc_flags); + FIELD_COPY(zc_action_handle); + FIELD_COPY(zc_cleanup_fd); + FIELD_COPY(zc_simple); + FIELD_COPY(zc_resumable); + FIELD_COPY(zc_sendobj); + FIELD_COPY(zc_fromobj); + FIELD_COPY(zc_createtxg); + FIELD_COPY(zc_stat); +#undef FIELD_COPY + break; + case ZFS_CMD_COMPAT_RESUME: resume_c = (void *)addr; /* zc */ @@ -434,8 +478,50 @@ zfs_cmd_compat_put(zfs_cmd_t *zc, caddr_ zfs_cmd_zcmd_t *zcmd_c; zfs_cmd_edbp_t *edbp_c; zfs_cmd_resume_t *resume_c; + zfs_cmd_inlanes_t *inlanes_c; switch (cflag) { + case ZFS_CMD_COMPAT_INLANES: + inlanes_c = (void *)addr; + strlcpy(inlanes_c->zc_name, zc->zc_name, MAXPATHLEN); + strlcpy(inlanes_c->zc_value, zc->zc_value, MAXPATHLEN * 2); + strlcpy(inlanes_c->zc_string, zc->zc_string, MAXPATHLEN); + +#define FIELD_COPY(field) inlanes_c->field = zc->field + FIELD_COPY(zc_nvlist_src); + FIELD_COPY(zc_nvlist_src_size); + FIELD_COPY(zc_nvlist_dst); + FIELD_COPY(zc_nvlist_dst_size); + FIELD_COPY(zc_nvlist_dst_filled); + FIELD_COPY(zc_pad2); + FIELD_COPY(zc_history); + FIELD_COPY(zc_guid); + FIELD_COPY(zc_nvlist_conf); + FIELD_COPY(zc_nvlist_conf_size); + FIELD_COPY(zc_cookie); + FIELD_COPY(zc_objset_type); + FIELD_COPY(zc_perm_action); + FIELD_COPY(zc_history_len); + FIELD_COPY(zc_history_offset); + FIELD_COPY(zc_obj); + FIELD_COPY(zc_iflags); + FIELD_COPY(zc_share); + FIELD_COPY(zc_jailid); + FIELD_COPY(zc_objset_stats); + FIELD_COPY(zc_begin_record); + FIELD_COPY(zc_inject_record); + FIELD_COPY(zc_defer_destroy); + FIELD_COPY(zc_flags); + FIELD_COPY(zc_action_handle); + FIELD_COPY(zc_cleanup_fd); + FIELD_COPY(zc_simple); + FIELD_COPY(zc_sendobj); + FIELD_COPY(zc_fromobj); + FIELD_COPY(zc_createtxg); + FIELD_COPY(zc_stat); +#undef FIELD_COPY + break; + case ZFS_CMD_COMPAT_RESUME: resume_c = (void *)addr; strlcpy(resume_c->zc_name, zc->zc_name, MAXPATHLEN); @@ -987,6 +1073,12 @@ zcmd_ioctl_compat(int fd, int request, z zp.zfs_cmd_size = sizeof(zfs_cmd_t); zp.zfs_ioctl_version = ZFS_IOCVER_CURRENT; return (ioctl(fd, ncmd, &zp)); + case ZFS_CMD_COMPAT_INLANES: + ncmd = _IOWR('Z', request, struct zfs_iocparm); + zp.zfs_cmd = (uint64_t)zc; + zp.zfs_cmd_size = sizeof(zfs_cmd_inlanes_t); + zp.zfs_ioctl_version = ZFS_IOCVER_INLANES; + return (ioctl(fd, ncmd, &zp)); case ZFS_CMD_COMPAT_RESUME: ncmd = _IOWR('Z', request, struct zfs_iocparm); zp.zfs_cmd = (uint64_t)zc; @@ -1104,7 +1196,7 @@ zfs_ioctl_compat_innvl(zfs_cmd_t *zc, nv if (cflag == ZFS_CMD_COMPAT_NONE || cflag == ZFS_CMD_COMPAT_LZC || cflag == ZFS_CMD_COMPAT_ZCMD || cflag == ZFS_CMD_COMPAT_EDBP || - cflag == ZFS_CMD_COMPAT_RESUME) + cflag == ZFS_CMD_COMPAT_RESUME || cflag == ZFS_CMD_COMPAT_INLANES) goto out; switch (vec) { @@ -1257,7 +1349,7 @@ zfs_ioctl_compat_outnvl(zfs_cmd_t *zc, n if (cflag == ZFS_CMD_COMPAT_NONE || cflag == ZFS_CMD_COMPAT_LZC || cflag == ZFS_CMD_COMPAT_ZCMD || cflag == ZFS_CMD_COMPAT_EDBP || - cflag == ZFS_CMD_COMPAT_RESUME) + cflag == ZFS_CMD_COMPAT_RESUME || cflag == ZFS_CMD_COMPAT_INLANES) return (outnvl); switch (vec) { Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h Wed Oct 12 05:04:36 2016 (r307100) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h Wed Oct 12 05:08:09 2016 (r307101) @@ -54,7 +54,8 @@ extern "C" { #define ZFS_IOCVER_EDBP 4 #define ZFS_IOCVER_RESUME 5 #define ZFS_IOCVER_INLANES 6 -#define ZFS_IOCVER_CURRENT ZFS_IOCVER_INLANES +#define ZFS_IOCVER_PAD 7 +#define ZFS_IOCVER_CURRENT ZFS_IOCVER_PAD /* compatibility conversion flag */ #define ZFS_CMD_COMPAT_NONE 0 @@ -65,6 +66,7 @@ extern "C" { #define ZFS_CMD_COMPAT_ZCMD 5 #define ZFS_CMD_COMPAT_EDBP 6 #define ZFS_CMD_COMPAT_RESUME 7 +#define ZFS_CMD_COMPAT_INLANES 8 #define ZFS_IOC_COMPAT_PASS 254 #define ZFS_IOC_COMPAT_FAIL 255 @@ -355,6 +357,49 @@ typedef struct zfs_cmd_resume { zfs_stat_t zc_stat; } zfs_cmd_resume_t; +typedef struct zfs_cmd_inlanes { + char zc_name[MAXPATHLEN]; /* name of pool or dataset */ + uint64_t zc_nvlist_src; /* really (char *) */ + uint64_t zc_nvlist_src_size; + uint64_t zc_nvlist_dst; /* really (char *) */ + uint64_t zc_nvlist_dst_size; + boolean_t zc_nvlist_dst_filled; /* put an nvlist in dst? */ + int zc_pad2; + + /* + * The following members are for legacy ioctls which haven't been + * converted to the new method. + */ + uint64_t zc_history; /* really (char *) */ + char zc_value[MAXPATHLEN * 2]; + char zc_string[MAXNAMELEN]; + uint64_t zc_guid; + uint64_t zc_nvlist_conf; /* really (char *) */ + uint64_t zc_nvlist_conf_size; + uint64_t zc_cookie; + uint64_t zc_objset_type; + uint64_t zc_perm_action; + uint64_t zc_history_len; + uint64_t zc_history_offset; + uint64_t zc_obj; + uint64_t zc_iflags; /* internal to zfs(7fs) */ + zfs_share_t zc_share; + uint64_t zc_jailid; + dmu_objset_stats_t zc_objset_stats; + dmu_replay_record_t zc_begin_record; + zinject_record_t zc_inject_record; + uint32_t zc_defer_destroy; + uint32_t zc_flags; + uint64_t zc_action_handle; + int zc_cleanup_fd; + uint8_t zc_simple; + boolean_t zc_resumable; + uint64_t zc_sendobj; + uint64_t zc_fromobj; + uint64_t zc_createtxg; + zfs_stat_t zc_stat; +} zfs_cmd_inlanes_t; + #ifdef _KERNEL unsigned static long zfs_ioctl_v15_to_v28[] = { 0, /* 0 ZFS_IOC_POOL_CREATE */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Wed Oct 12 05:04:36 2016 (r307100) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Wed Oct 12 05:08:09 2016 (r307101) @@ -353,6 +353,12 @@ typedef enum zfs_case { ZFS_CASE_MIXED } zfs_case_t; +/* + * Note: this struct must have the same layout in 32-bit and 64-bit, so + * that 32-bit processes (like /sbin/zfs) can pass it to the 64-bit + * kernel. Therefore, we add padding to it so that no "hidden" padding + * is automatically added on 64-bit (but not on 32-bit). + */ typedef struct zfs_cmd { char zc_name[MAXPATHLEN]; /* name of pool or dataset */ uint64_t zc_nvlist_src; /* really (char *) */ @@ -389,7 +395,9 @@ typedef struct zfs_cmd { uint64_t zc_action_handle; int zc_cleanup_fd; uint8_t zc_simple; + uint8_t zc_pad3[3]; boolean_t zc_resumable; + uint32_t zc_pad4; uint64_t zc_sendobj; uint64_t zc_fromobj; uint64_t zc_createtxg; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 12 05:04:36 2016 (r307100) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 12 05:08:09 2016 (r307101) @@ -6252,6 +6252,14 @@ zfsdev_ioctl(struct cdev *dev, u_long zc goto out; } break; + case ZFS_IOCVER_INLANES: + if (zc_iocparm->zfs_cmd_size != sizeof(zfs_cmd_inlanes_t)) { + error = SET_ERROR(EFAULT); + goto out; + } + compat = B_TRUE; + cflag = ZFS_CMD_COMPAT_INLANES; + break; case ZFS_IOCVER_RESUME: if (zc_iocparm->zfs_cmd_size != sizeof(zfs_cmd_resume_t)) { error = SET_ERROR(EFAULT); From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:09:23 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F03C5C0D83B; Wed, 12 Oct 2016 05:09:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB539117D; Wed, 12 Oct 2016 05:09:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C59Mx2008356; Wed, 12 Oct 2016 05:09:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C59MMx008355; Wed, 12 Oct 2016 05:09:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120509.u9C59MMx008355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307102 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:09:24 -0000 Author: mav Date: Wed Oct 12 05:09:22 2016 New Revision: 307102 URL: https://svnweb.freebsd.org/changeset/base/307102 Log: MFC r305201: MFV r302653: 6111 zfs send should ignore datasets created after the ending snapshot illumos/illumos-gate@4a20c933b148de8a1c1d3538391c64284e636653 https://github.com/illumos/illumos-gate/commit/4a20c933b148de8a1c1d3538391c64284 e636653 https://www.illumos.org/issues/6111 If you create a zfs child folder, zfs send returns an error when a recursive incremental send is done between two snapshots made prior to the folder creation. The problem can be reproduced with the following steps. root@zfs:/# zfs create pool/test root@zfs:/# zfs snapshot pool/test@snap1 root@zfs:/# zfs snapshot pool/test@snap2 root@zfs:/# zfs create pool/test/child root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap2 > /dev/null WARNING: could not send pool/test/child@snap2: does not exist WARNING: could not send pool/test/child@snap2: does not exist root@zfs:/# echo $? 1 root@zfs:/# zfs snapshot -r pool/test@snap3 root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap3 > /dev/null root@zfs:/# echo $? 0 root@zfs:/# zfs send -R -I pool/test@snap2 pool/test@snap3 > /dev/null root@zfs:/# echo $? 0 Since pool/test/child was created after snap2, zfs send should not expect snap2 to be in pool/test/child when doing a recursive send. It should examine the compare the creation time of the snapshot and each child folder to decide if the folder will be sent. The next incremental send between snap2 and snap3 would properly create the child folder and snap3 which first appears in the child folder. The problem is identical if '-i' is used instead of '-I'. Reviewed by: Alex Aizman alex.aizman@nexenta.com Reviewed by: Alek Pinchuk alek.pinchuk@nexenta.com Reviewed by: Roman Strashkin roman.strashkin@nexenta.com Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Approved by: Garrett D'Amore Author: Alex Deiter Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 12 05:08:09 2016 (r307101) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 12 05:09:22 2016 (r307102) @@ -580,13 +580,30 @@ fsavl_create(nvlist_t *fss) * Routines for dealing with the giant nvlist of fs-nvlists, etc. */ typedef struct send_data { + /* + * assigned inside every recursive call, + * restored from *_save on return: + * + * guid of fromsnap snapshot in parent dataset + * txg of fromsnap snapshot in current dataset + * txg of tosnap snapshot in current dataset + */ + uint64_t parent_fromsnap_guid; + uint64_t fromsnap_txg; + uint64_t tosnap_txg; + + /* the nvlists get accumulated during depth-first traversal */ nvlist_t *parent_snaps; nvlist_t *fss; nvlist_t *snapprops; + + /* send-receive configuration, does not change during traversal */ + const char *fsname; const char *fromsnap; const char *tosnap; boolean_t recursive; + boolean_t verbose; /* * The header nvlist is of the following format: @@ -619,11 +636,23 @@ send_iterate_snap(zfs_handle_t *zhp, voi { send_data_t *sd = arg; uint64_t guid = zhp->zfs_dmustats.dds_guid; + uint64_t txg = zhp->zfs_dmustats.dds_creation_txg; char *snapname; nvlist_t *nv; snapname = strrchr(zhp->zfs_name, '@')+1; + if (sd->tosnap_txg != 0 && txg > sd->tosnap_txg) { + if (sd->verbose) { + (void) fprintf(stderr, dgettext(TEXT_DOMAIN, + "skipping snapshot %s because it was created " + "after the destination snapshot (%s)\n"), + zhp->zfs_name, sd->tosnap); + } + zfs_close(zhp); + return (0); + } + VERIFY(0 == nvlist_add_uint64(sd->parent_snaps, snapname, guid)); /* * NB: if there is no fromsnap here (it's a newly created fs in @@ -717,6 +746,31 @@ send_iterate_prop(zfs_handle_t *zhp, nvl } /* + * returns snapshot creation txg + * and returns 0 if the snapshot does not exist + */ +static uint64_t +get_snap_txg(libzfs_handle_t *hdl, const char *fs, const char *snap) +{ + char name[ZFS_MAXNAMELEN]; + uint64_t txg = 0; + + if (fs == NULL || fs[0] == '\0' || snap == NULL || snap[0] == '\0') + return (txg); + + (void) snprintf(name, sizeof (name), "%s@%s", fs, snap); + if (zfs_dataset_exists(hdl, name, ZFS_TYPE_SNAPSHOT)) { + zfs_handle_t *zhp = zfs_open(hdl, name, ZFS_TYPE_SNAPSHOT); + if (zhp != NULL) { + txg = zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG); + zfs_close(zhp); + } + } + + return (txg); +} + +/* * recursively generate nvlists describing datasets. See comment * for the data structure send_data_t above for description of contents * of the nvlist. @@ -728,9 +782,48 @@ send_iterate_fs(zfs_handle_t *zhp, void nvlist_t *nvfs, *nv; int rv = 0; uint64_t parent_fromsnap_guid_save = sd->parent_fromsnap_guid; + uint64_t fromsnap_txg_save = sd->fromsnap_txg; + uint64_t tosnap_txg_save = sd->tosnap_txg; + uint64_t txg = zhp->zfs_dmustats.dds_creation_txg; uint64_t guid = zhp->zfs_dmustats.dds_guid; + uint64_t fromsnap_txg, tosnap_txg; char guidstring[64]; + fromsnap_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, sd->fromsnap); + if (fromsnap_txg != 0) + sd->fromsnap_txg = fromsnap_txg; + + tosnap_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, sd->tosnap); + if (tosnap_txg != 0) + sd->tosnap_txg = tosnap_txg; + + /* + * on the send side, if the current dataset does not have tosnap, + * perform two additional checks: + * + * - skip sending the current dataset if it was created later than + * the parent tosnap + * - return error if the current dataset was created earlier than + * the parent tosnap + */ + if (sd->tosnap != NULL && tosnap_txg == 0) { + if (sd->tosnap_txg != 0 && txg > sd->tosnap_txg) { + if (sd->verbose) { + (void) fprintf(stderr, dgettext(TEXT_DOMAIN, + "skipping dataset %s: snapshot %s does " + "not exist\n"), zhp->zfs_name, sd->tosnap); + } + } else { + (void) fprintf(stderr, dgettext(TEXT_DOMAIN, + "cannot send %s@%s%s: snapshot %s@%s does not " + "exist\n"), sd->fsname, sd->tosnap, sd->recursive ? + dgettext(TEXT_DOMAIN, " recursively") : "", + zhp->zfs_name, sd->tosnap); + rv = -1; + } + goto out; + } + VERIFY(0 == nvlist_alloc(&nvfs, NV_UNIQUE_NAME, 0)); VERIFY(0 == nvlist_add_string(nvfs, "name", zhp->zfs_name)); VERIFY(0 == nvlist_add_uint64(nvfs, "parentfromsnap", @@ -739,8 +832,10 @@ send_iterate_fs(zfs_handle_t *zhp, void if (zhp->zfs_dmustats.dds_origin[0]) { zfs_handle_t *origin = zfs_open(zhp->zfs_hdl, zhp->zfs_dmustats.dds_origin, ZFS_TYPE_SNAPSHOT); - if (origin == NULL) - return (-1); + if (origin == NULL) { + rv = -1; + goto out; + } VERIFY(0 == nvlist_add_uint64(nvfs, "origin", origin->zfs_dmustats.dds_guid)); } @@ -771,7 +866,10 @@ send_iterate_fs(zfs_handle_t *zhp, void if (sd->recursive) rv = zfs_iter_filesystems(zhp, send_iterate_fs, sd); +out: sd->parent_fromsnap_guid = parent_fromsnap_guid_save; + sd->fromsnap_txg = fromsnap_txg_save; + sd->tosnap_txg = tosnap_txg_save; zfs_close(zhp); return (rv); @@ -779,7 +877,8 @@ send_iterate_fs(zfs_handle_t *zhp, void static int gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap, - const char *tosnap, boolean_t recursive, nvlist_t **nvlp, avl_tree_t **avlp) + const char *tosnap, boolean_t recursive, boolean_t verbose, + nvlist_t **nvlp, avl_tree_t **avlp) { zfs_handle_t *zhp; send_data_t sd = { 0 }; @@ -790,9 +889,11 @@ gather_nvlist(libzfs_handle_t *hdl, cons return (EZFS_BADTYPE); VERIFY(0 == nvlist_alloc(&sd.fss, NV_UNIQUE_NAME, 0)); + sd.fsname = fsname; sd.fromsnap = fromsnap; sd.tosnap = tosnap; sd.recursive = recursive; + sd.verbose = verbose; if ((error = send_iterate_fs(zhp, &sd)) != 0) { nvlist_free(sd.fss); @@ -1700,7 +1801,8 @@ zfs_send(zfs_handle_t *zhp, const char * } err = gather_nvlist(zhp->zfs_hdl, zhp->zfs_name, - fromsnap, tosnap, flags->replicate, &fss, &fsavl); + fromsnap, tosnap, flags->replicate, flags->verbose, + &fss, &fsavl); if (err) goto err_out; VERIFY(0 == nvlist_add_nvlist(hdrnv, "fss", fss)); @@ -2316,7 +2418,7 @@ again: VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, - recursive, &local_nv, &local_avl)) != 0) + recursive, B_FALSE, &local_nv, &local_avl)) != 0) return (error); /* @@ -3380,7 +3482,7 @@ zfs_receive_one(libzfs_handle_t *hdl, in */ *cp = '\0'; if (gather_nvlist(hdl, zc.zc_value, NULL, NULL, B_FALSE, - &local_nv, &local_avl) == 0) { + B_FALSE, &local_nv, &local_avl) == 0) { *cp = '@'; fs = fsavl_find(local_avl, drrb->drr_toguid, NULL); fsavl_destroy(local_avl); From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:10:06 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1ECAC0D941; Wed, 12 Oct 2016 05:10:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70E7A14BB; Wed, 12 Oct 2016 05:10:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5A5GH008503; Wed, 12 Oct 2016 05:10:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5A5vj008502; Wed, 12 Oct 2016 05:10:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120510.u9C5A5vj008502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:10:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307104 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:10:06 -0000 Author: mav Date: Wed Oct 12 05:10:05 2016 New Revision: 307104 URL: https://svnweb.freebsd.org/changeset/base/307104 Log: MFC r305202: MFV r302654: 6879 incorrect endianness swap for drr_spill.drr_length in libzfs_sendrecv.c illumos/illumos-gate@20fea7a47472aceb64d3ed48cc2a3ea268bc4795 https://github.com/illumos/illumos-gate/commit/20fea7a47472aceb64d3ed48cc2a3ea26 8bc4795 https://www.illumos.org/issues/6879 In libzfs_sendrecv, there's a typo: case DRR_SPILL: if (byteswap) { drr->drr_u.drr_write.drr_length = BSWAP_64(drr->drr_u.drr_spill.drr_length); } Instead of drr_write.drr_length, we should be assigning the result of the byteswap to drr_spill.drr_length. Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Approved by: Robert Mustacchi Author: Dan Kimmel Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 12 05:09:26 2016 (r307103) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 12 05:10:05 2016 (r307104) @@ -2968,7 +2968,7 @@ recv_skip(libzfs_handle_t *hdl, int fd, break; case DRR_SPILL: if (byteswap) { - drr->drr_u.drr_write.drr_length = + drr->drr_u.drr_spill.drr_length = BSWAP_64(drr->drr_u.drr_spill.drr_length); } (void) recv_read(hdl, fd, buf, From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:10:50 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B3A5C0D9BC; Wed, 12 Oct 2016 05:10:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB3E01669; Wed, 12 Oct 2016 05:10:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5AmHR008584; Wed, 12 Oct 2016 05:10:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5Amht008583; Wed, 12 Oct 2016 05:10:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120510.u9C5Amht008583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:10:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307105 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:10:50 -0000 Author: mav Date: Wed Oct 12 05:10:48 2016 New Revision: 307105 URL: https://svnweb.freebsd.org/changeset/base/307105 Log: MFC r305203: MFV r302655: 6873 zfs_destroy_snaps_nvl leaks errlist illumos/illumos-gate@4cde22c29999ffb907ca39d2ebd512812f7e5168 https://github.com/illumos/illumos-gate/commit/4cde22c29999ffb907ca39d2ebd512812 f7e5168 https://www.illumos.org/issues/6873 lzc_destroy_snaps() returns an nvlist in errlist. zfs_destroy_snaps_nvl() should nvlist_free() it before returning. Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Approved by: Dan McDonald Author: Chris Williamson Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Oct 12 05:10:05 2016 (r307104) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Oct 12 05:10:48 2016 (r307105) @@ -3455,12 +3455,14 @@ int zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer) { int ret; - nvlist_t *errlist; + nvlist_t *errlist = NULL; ret = lzc_destroy_snaps(snaps, defer, &errlist); - if (ret == 0) + if (ret == 0) { + nvlist_free(errlist); return (0); + } if (nvlist_empty(errlist)) { char errbuf[1024]; @@ -3488,6 +3490,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *h } } + nvlist_free(errlist); return (ret); } From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:13:14 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9137CC0DB31; Wed, 12 Oct 2016 05:13:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 533BD19E6; Wed, 12 Oct 2016 05:13:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5DDXA012011; Wed, 12 Oct 2016 05:13:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5DDY5012007; Wed, 12 Oct 2016 05:13:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120513.u9C5DDY5012007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307106 - in stable/11/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:13:14 -0000 Author: mav Date: Wed Oct 12 05:13:12 2016 New Revision: 307106 URL: https://svnweb.freebsd.org/changeset/base/307106 Log: MFC r305205: MFV r302657: 4521 zfstest is trying to execute evil "zfs unmount -a" illumos/illumos-gate@8808ac5dae118369991f158b6ab736cb2691ecde https://github.com/illumos/illumos-gate/commit/8808ac5dae118369991f158b6ab736cb2 691ecde https://www.illumos.org/issues/4521 zfstest is trying to execute evil "zfs unmount -a", which fails (fortunately, as it would otherwise leave me with my ~ missing): 03:44:11.86 cannot unmount '/export/home/yuri': Device busy cannot unmount '/ export/home': Device busy 03:44:11.86 ERROR: /usr/sbin/zfs unmount -a exited 1 This affects, at least, zfs_mount_009_neg and zfs_mount_all_001_pos, both failing on that step. The pool containing the /export/home hierarchy is included in KEEP variable, but it doesn't seem to affect anything here. Reviewed by: Andriy Gapon Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Reviewed by: John Kennedy Approved by: Robert Mustacchi Author: Yuri Pankov Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Oct 12 05:10:48 2016 (r307105) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Oct 12 05:13:12 2016 (r307106) @@ -27,9 +27,9 @@ * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov . + * Copyright 2016 Nexenta Systems, Inc. */ #include @@ -6483,6 +6483,15 @@ unshare_unmount(int op, int argc, char * continue; } + /* + * Ignore datasets that are excluded/restricted by + * parent pool name. + */ + if (zpool_skip_pool(zfs_get_pool_name(zhp))) { + zfs_close(zhp); + continue; + } + switch (op) { case OP_SHARE: verify(zfs_prop_get(zhp, ZFS_PROP_SHARENFS, Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Oct 12 05:10:48 2016 (r307105) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Oct 12 05:13:12 2016 (r307106) @@ -26,8 +26,8 @@ * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. */ #ifndef _LIBZFS_H @@ -221,6 +221,7 @@ extern void zpool_free_handles(libzfs_ha */ typedef int (*zpool_iter_f)(zpool_handle_t *, void *); extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *); +extern boolean_t zpool_skip_pool(const char *); /* * Functions to create and destroy pools @@ -411,6 +412,7 @@ extern void zfs_close(zfs_handle_t *); extern zfs_type_t zfs_get_type(const zfs_handle_t *); extern const char *zfs_get_name(const zfs_handle_t *); extern zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *); +extern const char *zfs_get_pool_name(const zfs_handle_t *); /* * Property management functions. Some functions are shared with the kernel, Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c Wed Oct 12 05:10:48 2016 (r307105) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c Wed Oct 12 05:13:12 2016 (r307106) @@ -27,6 +27,7 @@ /* * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2015 by Syneto S.R.L. All rights reserved. + * Copyright 2016 Nexenta Systems, Inc. */ /* @@ -338,33 +339,47 @@ zpool_refresh_stats(zpool_handle_t *zhp, } /* - * If the __ZFS_POOL_RESTRICT environment variable is set we only iterate over - * pools it lists. + * The following environment variables are undocumented + * and should be used for testing purposes only: * - * This is an undocumented feature for use during testing only. + * __ZFS_POOL_EXCLUDE - don't iterate over the pools it lists + * __ZFS_POOL_RESTRICT - iterate only over the pools it lists * * This function returns B_TRUE if the pool should be skipped * during iteration. */ -static boolean_t -check_restricted(const char *poolname) +boolean_t +zpool_skip_pool(const char *poolname) { static boolean_t initialized = B_FALSE; - static char *restricted = NULL; + static const char *exclude = NULL; + static const char *restricted = NULL; const char *cur, *end; - int len, namelen; + int len; + int namelen = strlen(poolname); if (!initialized) { initialized = B_TRUE; + exclude = getenv("__ZFS_POOL_EXCLUDE"); restricted = getenv("__ZFS_POOL_RESTRICT"); } + if (exclude != NULL) { + cur = exclude; + do { + end = strchr(cur, ' '); + len = (NULL == end) ? strlen(cur) : (end - cur); + if (len == namelen && 0 == strncmp(cur, poolname, len)) + return (B_TRUE); + cur += (len + 1); + } while (NULL != end); + } + if (NULL == restricted) return (B_FALSE); cur = restricted; - namelen = strlen(poolname); do { end = strchr(cur, ' '); len = (NULL == end) ? strlen(cur) : (end - cur); @@ -402,7 +417,7 @@ zpool_iter(libzfs_handle_t *hdl, zpool_i for (cn = uu_avl_first(hdl->libzfs_ns_avl); cn != NULL; cn = uu_avl_next(hdl->libzfs_ns_avl, cn)) { - if (check_restricted(cn->cn_name)) + if (zpool_skip_pool(cn->cn_name)) continue; if (zpool_open_silent(hdl, cn->cn_name, &zhp) != 0) { @@ -440,7 +455,7 @@ zfs_iter_root(libzfs_handle_t *hdl, zfs_ for (cn = uu_avl_first(hdl->libzfs_ns_avl); cn != NULL; cn = uu_avl_next(hdl->libzfs_ns_avl, cn)) { - if (check_restricted(cn->cn_name)) + if (zpool_skip_pool(cn->cn_name)) continue; if ((zhp = make_dataset_handle(hdl, cn->cn_name)) == NULL) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Oct 12 05:10:48 2016 (r307105) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Oct 12 05:13:12 2016 (r307106) @@ -27,9 +27,9 @@ * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved. * Copyright (c) 2013 Martin Matuska. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov + * Copyright 2016 Nexenta Systems, Inc. */ #include @@ -2951,6 +2951,15 @@ zfs_get_name(const zfs_handle_t *zhp) } /* + * Returns the name of the parent pool for the given zfs handle. + */ +const char * +zfs_get_pool_name(const zfs_handle_t *zhp) +{ + return (zhp->zpool_hdl->zpool_name); +} + +/* * Returns the type of the given zfs handle. */ zfs_type_t From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:14:06 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62050C0DBCD; Wed, 12 Oct 2016 05:14:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 235981BF6; Wed, 12 Oct 2016 05:14:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5E58d012100; Wed, 12 Oct 2016 05:14:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5E40j012096; Wed, 12 Oct 2016 05:14:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120514.u9C5E40j012096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:14:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307107 - in stable/11/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:14:06 -0000 Author: mav Date: Wed Oct 12 05:14:04 2016 New Revision: 307107 URL: https://svnweb.freebsd.org/changeset/base/307107 Log: MFC r305206: MFV r302658: 6872 zfs libraries should not allow uninitialized variables illumos/illumos-gate@f83b46baf98d276f5f84fa84c8b461f412ac1f5e https://github.com/illumos/illumos-gate/commit/f83b46baf98d276f5f84fa84c8b461f41 2ac1f5e https://www.illumos.org/issues/6872 We compile the zfs libraries with -Wno-uninitialized. We should remove this. Change makefiles, fix new warnings, fix pbchk errors. Reviewed by: Dan Kimmel Reviewed by: George Wilson Reviewed by: Prakash Surya Reviewed by: Yuri Pankov Approved by: Robert Mustacchi Author: Paul Dagnelie Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Wed Oct 12 05:13:12 2016 (r307106) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Wed Oct 12 05:14:04 2016 (r307107) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2015 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov . */ @@ -597,7 +597,6 @@ get_replication(nvlist_t *nvroot, boolea verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, &top, &toplevels) == 0); - lastrep.zprl_type = NULL; for (t = 0; t < toplevels; t++) { uint64_t is_log = B_FALSE; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Oct 12 05:13:12 2016 (r307106) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Oct 12 05:14:04 2016 (r307107) @@ -1570,7 +1570,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvl libzfs_handle_t *hdl = zhp->zfs_hdl; nvlist_t *nvl; int nvl_len; - int added_resv; + int added_resv = 0; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot set property for '%s'"), @@ -3201,7 +3201,7 @@ zfs_create_ancestors(libzfs_handle_t *hd { int prefix; char *path_copy; - int rc; + int rc = 0; if (check_parents(hdl, path, NULL, B_TRUE, &prefix) != 0) return (-1); @@ -3843,7 +3843,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_hand rollback_data_t cb = { 0 }; int err; boolean_t restore_resv = 0; - uint64_t old_volsize, new_volsize; + uint64_t old_volsize = 0, new_volsize; zfs_prop_t resv_prop; assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM || @@ -4060,6 +4060,7 @@ zfs_rename(zfs_handle_t *zhp, const char "child dataset with inherited mountpoint is used " "in a non-global zone")); (void) zfs_error(hdl, EZFS_ZONED, errbuf); + ret = -1; goto error; } Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed Oct 12 05:13:12 2016 (r307106) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed Oct 12 05:14:04 2016 (r307107) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright 2015 RackTop Systems. * Copyright 2016 Nexenta Systems, Inc. */ @@ -440,12 +440,12 @@ get_configs(libzfs_handle_t *hdl, pool_l pool_entry_t *pe; vdev_entry_t *ve; config_entry_t *ce; - nvlist_t *ret = NULL, *config = NULL, *tmp, *nvtop, *nvroot; + nvlist_t *ret = NULL, *config = NULL, *tmp = NULL, *nvtop, *nvroot; nvlist_t **spares, **l2cache; uint_t i, nspares, nl2cache; boolean_t config_seen; uint64_t best_txg; - char *name, *hostname; + char *name, *hostname = NULL; uint64_t guid; uint_t children = 0; nvlist_t **child = NULL; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Wed Oct 12 05:13:12 2016 (r307106) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Wed Oct 12 05:14:04 2016 (r307107) @@ -1011,7 +1011,7 @@ zprop_print_one_property(const char *nam const char *source, const char *recvd_value) { int i; - const char *str; + const char *str = NULL; char buf[128]; /* From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:15:12 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3535DC0DC62; Wed, 12 Oct 2016 05:15:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6E401D5F; Wed, 12 Oct 2016 05:15:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5FB25012210; Wed, 12 Oct 2016 05:15:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5F9ZM012192; Wed, 12 Oct 2016 05:15:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120515.u9C5F9ZM012192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:15:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307108 - in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:15:12 -0000 Author: mav Date: Wed Oct 12 05:15:09 2016 New Revision: 307108 URL: https://svnweb.freebsd.org/changeset/base/307108 Log: MFC r305209: MFV r302660: 6314 buffer overflow in dsl_dataset_name illumos/illumos-gate@9adfa60d484ce2435f5af77cc99dcd4e692b6660 https://github.com/illumos/illumos-gate/commit/9adfa60d484ce2435f5af77cc99dcd4e6 92b6660 https://www.illumos.org/issues/6314 Callers of dsl_dataset_name pass a buffer of size ZFS_MAXNAMELEN, but dsl_dataset_name copies the datasets' name PLUS the snapshot name to it, resulting in a max of 2 * ZFS_MAXNAMELEN + '@'. Reviewed by: George Wilson Reviewed by: Prakash Surya Reviewed by: Igor Kozhukhov Approved by: Dan McDonald Author: Matthew Ahrens Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/11/cddl/contrib/opensolaris/cmd/zhack/zhack.c stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c stable/11/cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Oct 12 05:15:09 2016 (r307108) @@ -60,7 +60,6 @@ #include #include #include -#undef ZFS_MAXNAMELEN #undef verify #include @@ -1945,7 +1944,7 @@ dump_dir(objset_t *os) uint64_t refdbytes, usedobjs, scratch; char numbuf[32]; char blkbuf[BP_SPRINTF_LEN + 20]; - char osname[MAXNAMELEN]; + char osname[ZFS_MAX_DATASET_NAME_LEN]; char *type = "UNKNOWN"; int verbosity = dump_opt['d']; int print_header = 1; @@ -3482,7 +3481,7 @@ find_zpool(char **target, nvlist_t **con nvlist_t *match = NULL; char *name = NULL; char *sepp = NULL; - char sep; + char sep = '\0'; int count = 0; importargs_t args = { 0 }; Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Oct 12 05:15:09 2016 (r307108) @@ -1510,7 +1510,7 @@ get_callback(zfs_handle_t *zhp, void *da char buf[ZFS_MAXPROPLEN]; char rbuf[ZFS_MAXPROPLEN]; zprop_source_t sourcetype; - char source[ZFS_MAXNAMELEN]; + char source[ZFS_MAX_DATASET_NAME_LEN]; zprop_get_cbdata_t *cbp = data; nvlist_t *user_props = zfs_get_user_props(zhp); zprop_list_t *pl = cbp->cb_proplist; @@ -1990,7 +1990,7 @@ typedef struct upgrade_cbdata { uint64_t cb_version; boolean_t cb_newer; boolean_t cb_foundone; - char cb_lastfs[ZFS_MAXNAMELEN]; + char cb_lastfs[ZFS_MAX_DATASET_NAME_LEN]; } upgrade_cbdata_t; static int @@ -2436,7 +2436,7 @@ userspace_cb(void *arg, const char *doma if (domain != NULL && domain[0] != '\0') { /* SMB */ - char sid[ZFS_MAXNAMELEN + 32]; + char sid[MAXNAMELEN + 32]; uid_t id; #ifdef illumos int err; @@ -2573,7 +2573,7 @@ print_us_node(boolean_t scripted, boolea size_t *width, us_node_t *node) { nvlist_t *nvl = node->usn_nvl; - char valstr[ZFS_MAXNAMELEN]; + char valstr[MAXNAMELEN]; boolean_t first = B_TRUE; int cfield = 0; int field; @@ -3472,7 +3472,7 @@ zfs_do_rollback(int argc, char **argv) boolean_t force = B_FALSE; rollback_cbdata_t cb = { 0 }; zfs_handle_t *zhp, *snap; - char parentname[ZFS_MAXNAMELEN]; + char parentname[ZFS_MAX_DATASET_NAME_LEN]; char *delim; /* check options */ @@ -3872,7 +3872,7 @@ zfs_do_send(int argc, char **argv) */ if (strchr(argv[0], '@') == NULL || (fromname && strchr(fromname, '#') != NULL)) { - char frombuf[ZFS_MAXNAMELEN]; + char frombuf[ZFS_MAX_DATASET_NAME_LEN]; enum lzc_send_flags lzc_flags = 0; if (flags.replicate || flags.doall || flags.props || @@ -3924,7 +3924,7 @@ zfs_do_send(int argc, char **argv) * case if they specify the origin. */ if (fromname && (cp = strchr(fromname, '@')) != NULL) { - char origin[ZFS_MAXNAMELEN]; + char origin[ZFS_MAX_DATASET_NAME_LEN]; zprop_source_t src; (void) zfs_prop_get(zhp, ZFS_PROP_ORIGIN, @@ -4058,7 +4058,7 @@ zfs_do_receive(int argc, char **argv) usage(B_FALSE); } - char namebuf[ZFS_MAXNAMELEN]; + char namebuf[ZFS_MAX_DATASET_NAME_LEN]; (void) snprintf(namebuf, sizeof (namebuf), "%s/%%recv", argv[0]); @@ -4916,7 +4916,7 @@ store_allow_perm(zfs_deleg_who_type_t ty { int i; char ld[2] = { '\0', '\0' }; - char who_buf[ZFS_MAXNAMELEN+32]; + char who_buf[MAXNAMELEN + 32]; char base_type = '\0'; char set_type = '\0'; nvlist_t *base_nvl = NULL; @@ -5284,7 +5284,7 @@ static void print_fs_perms(fs_perm_set_t *fspset) { fs_perm_node_t *node = NULL; - char buf[ZFS_MAXNAMELEN+32]; + char buf[MAXNAMELEN + 32]; const char *dsname = buf; for (node = uu_list_first(fspset->fsps_list); node != NULL; @@ -5293,7 +5293,7 @@ print_fs_perms(fs_perm_set_t *fspset) uu_avl_t *uge_avl = node->fspn_fsperm.fsp_uge_avl; int left = 0; - (void) snprintf(buf, ZFS_MAXNAMELEN+32, + (void) snprintf(buf, sizeof (buf), gettext("---- Permissions on %s "), node->fspn_fsperm.fsp_name); (void) printf(dsname); @@ -5490,7 +5490,7 @@ zfs_do_hold_rele_impl(int argc, char **a for (i = 0; i < argc; ++i) { zfs_handle_t *zhp; - char parent[ZFS_MAXNAMELEN]; + char parent[ZFS_MAX_DATASET_NAME_LEN]; const char *delim; char *path = argv[i]; @@ -5623,7 +5623,7 @@ holds_callback(zfs_handle_t *zhp, void * nvlist_t *nvl = NULL; nvpair_t *nvp = NULL; const char *zname = zfs_get_name(zhp); - size_t znamelen = strnlen(zname, ZFS_MAXNAMELEN); + size_t znamelen = strlen(zname); if (cbp->cb_recursive && cbp->cb_snapname != NULL) { const char *snapname; @@ -5644,7 +5644,7 @@ holds_callback(zfs_handle_t *zhp, void * while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) { const char *tag = nvpair_name(nvp); - size_t taglen = strnlen(tag, MAXNAMELEN); + size_t taglen = strlen(tag); if (taglen > cbp->cb_max_taglen) cbp->cb_max_taglen = taglen; } @@ -6981,7 +6981,7 @@ zfs_do_diff(int argc, char **argv) static int zfs_do_bookmark(int argc, char **argv) { - char snapname[ZFS_MAXNAMELEN]; + char snapname[ZFS_MAX_DATASET_NAME_LEN]; zfs_handle_t *zhp; nvlist_t *nvl; int ret = 0; Modified: stable/11/cddl/contrib/opensolaris/cmd/zhack/zhack.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zhack/zhack.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/cmd/zhack/zhack.c Wed Oct 12 05:15:09 2016 (r307108) @@ -48,7 +48,6 @@ #include #include #include -#undef ZFS_MAXNAMELEN #undef verify #include Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Oct 12 05:15:09 2016 (r307108) @@ -4540,7 +4540,7 @@ zpool_do_status(int argc, char **argv) typedef struct upgrade_cbdata { boolean_t cb_first; boolean_t cb_unavail; - char cb_poolname[ZPOOL_MAXNAMELEN]; + char cb_poolname[ZFS_MAX_DATASET_NAME_LEN]; int cb_argc; uint64_t cb_version; char **cb_argv; Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Oct 12 05:15:09 2016 (r307108) @@ -141,8 +141,8 @@ typedef struct ztest_shared_hdr { static ztest_shared_hdr_t *ztest_shared_hdr; typedef struct ztest_shared_opts { - char zo_pool[MAXNAMELEN]; - char zo_dir[MAXNAMELEN]; + char zo_pool[ZFS_MAX_DATASET_NAME_LEN]; + char zo_dir[ZFS_MAX_DATASET_NAME_LEN]; char zo_alt_ztest[MAXNAMELEN]; char zo_alt_libpath[MAXNAMELEN]; uint64_t zo_vdevs; @@ -268,7 +268,7 @@ typedef struct ztest_od { uint64_t od_crblocksize; uint64_t od_gen; uint64_t od_crgen; - char od_name[MAXNAMELEN]; + char od_name[ZFS_MAX_DATASET_NAME_LEN]; } ztest_od_t; /* @@ -280,7 +280,7 @@ typedef struct ztest_ds { rwlock_t zd_zilog_lock; zilog_t *zd_zilog; ztest_od_t *zd_od; /* debugging aid */ - char zd_name[MAXNAMELEN]; + char zd_name[ZFS_MAX_DATASET_NAME_LEN]; mutex_t zd_dirobj_lock; rll_t zd_object_lock[ZTEST_OBJECT_LOCKS]; rll_t zd_range_lock[ZTEST_RANGE_LOCKS]; @@ -3227,7 +3227,7 @@ ztest_objset_destroy_cb(const char *name static boolean_t ztest_snapshot_create(char *osname, uint64_t id) { - char snapname[MAXNAMELEN]; + char snapname[ZFS_MAX_DATASET_NAME_LEN]; int error; (void) snprintf(snapname, sizeof (snapname), "%llu", (u_longlong_t)id); @@ -3247,10 +3247,10 @@ ztest_snapshot_create(char *osname, uint static boolean_t ztest_snapshot_destroy(char *osname, uint64_t id) { - char snapname[MAXNAMELEN]; + char snapname[ZFS_MAX_DATASET_NAME_LEN]; int error; - (void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname, + (void) snprintf(snapname, sizeof (snapname), "%s@%llu", osname, (u_longlong_t)id); error = dsl_destroy_snapshot(snapname, B_FALSE); @@ -3267,12 +3267,12 @@ ztest_dmu_objset_create_destroy(ztest_ds int iters; int error; objset_t *os, *os2; - char name[MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; zilog_t *zilog; (void) rw_rdlock(&ztest_name_lock); - (void) snprintf(name, MAXNAMELEN, "%s/temp_%llu", + (void) snprintf(name, sizeof (name), "%s/temp_%llu", ztest_opts.zo_pool, (u_longlong_t)id); /* @@ -3378,18 +3378,23 @@ ztest_dmu_snapshot_create_destroy(ztest_ void ztest_dsl_dataset_cleanup(char *osname, uint64_t id) { - char snap1name[MAXNAMELEN]; - char clone1name[MAXNAMELEN]; - char snap2name[MAXNAMELEN]; - char clone2name[MAXNAMELEN]; - char snap3name[MAXNAMELEN]; + char snap1name[ZFS_MAX_DATASET_NAME_LEN]; + char clone1name[ZFS_MAX_DATASET_NAME_LEN]; + char snap2name[ZFS_MAX_DATASET_NAME_LEN]; + char clone2name[ZFS_MAX_DATASET_NAME_LEN]; + char snap3name[ZFS_MAX_DATASET_NAME_LEN]; int error; - (void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id); - (void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id); - (void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id); - (void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id); - (void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id); + (void) snprintf(snap1name, sizeof (snap1name), + "%s@s1_%llu", osname, id); + (void) snprintf(clone1name, sizeof (clone1name), + "%s/c1_%llu", osname, id); + (void) snprintf(snap2name, sizeof (snap2name), + "%s@s2_%llu", clone1name, id); + (void) snprintf(clone2name, sizeof (clone2name), + "%s/c2_%llu", osname, id); + (void) snprintf(snap3name, sizeof (snap3name), + "%s@s3_%llu", clone1name, id); error = dsl_destroy_head(clone2name); if (error && error != ENOENT) @@ -3415,11 +3420,11 @@ void ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id) { objset_t *os; - char snap1name[MAXNAMELEN]; - char clone1name[MAXNAMELEN]; - char snap2name[MAXNAMELEN]; - char clone2name[MAXNAMELEN]; - char snap3name[MAXNAMELEN]; + char snap1name[ZFS_MAX_DATASET_NAME_LEN]; + char clone1name[ZFS_MAX_DATASET_NAME_LEN]; + char snap2name[ZFS_MAX_DATASET_NAME_LEN]; + char clone2name[ZFS_MAX_DATASET_NAME_LEN]; + char snap3name[ZFS_MAX_DATASET_NAME_LEN]; char *osname = zd->zd_name; int error; @@ -3427,11 +3432,16 @@ ztest_dsl_dataset_promote_busy(ztest_ds_ ztest_dsl_dataset_cleanup(osname, id); - (void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id); - (void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id); - (void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id); - (void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id); - (void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id); + (void) snprintf(snap1name, sizeof (snap1name), + "%s@s1_%llu", osname, id); + (void) snprintf(clone1name, sizeof (clone1name), + "%s/c1_%llu", osname, id); + (void) snprintf(snap2name, sizeof (snap2name), + "%s@s2_%llu", clone1name, id); + (void) snprintf(clone2name, sizeof (clone2name), + "%s/c2_%llu", osname, id); + (void) snprintf(snap3name, sizeof (snap3name), + "%s@s3_%llu", clone1name, id); error = dmu_objset_snapshot_one(osname, strchr(snap1name, '@') + 1); if (error && error != EEXIST) { @@ -4249,7 +4259,7 @@ ztest_fzap(ztest_ds_t *zd, uint64_t id) * 2050 entries we should see ptrtbl growth and leaf-block split. */ for (int i = 0; i < 2050; i++) { - char name[MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; uint64_t value = i; dmu_tx_t *tx; int error; @@ -4654,7 +4664,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, char fullname[100]; char clonename[100]; char tag[100]; - char osname[MAXNAMELEN]; + char osname[ZFS_MAX_DATASET_NAME_LEN]; nvlist_t *holds; (void) rw_rdlock(&ztest_name_lock); @@ -5450,13 +5460,13 @@ ztest_thread(void *arg) static void ztest_dataset_name(char *dsname, char *pool, int d) { - (void) snprintf(dsname, MAXNAMELEN, "%s/ds_%d", pool, d); + (void) snprintf(dsname, ZFS_MAX_DATASET_NAME_LEN, "%s/ds_%d", pool, d); } static void ztest_dataset_destroy(int d) { - char name[MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; ztest_dataset_name(name, ztest_opts.zo_pool, d); @@ -5505,7 +5515,7 @@ ztest_dataset_open(int d) uint64_t committed_seq = ZTEST_GET_SHARED_DS(d)->zd_seq; objset_t *os; zilog_t *zilog; - char name[MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; int error; ztest_dataset_name(name, ztest_opts.zo_pool, d); @@ -5728,8 +5738,8 @@ ztest_run(ztest_shared_t *zs) * different name. */ if (ztest_random(2) == 0) { - char name[MAXNAMELEN]; - (void) snprintf(name, MAXNAMELEN, "%s_import", + char name[ZFS_MAX_DATASET_NAME_LEN]; + (void) snprintf(name, sizeof (name), "%s_import", ztest_opts.zo_pool); ztest_spa_import_export(ztest_opts.zo_pool, name); ztest_spa_import_export(name, ztest_opts.zo_pool); @@ -6297,7 +6307,7 @@ main(int argc, char **argv) if (spa_open(ztest_opts.zo_pool, &spa, FTAG) == 0) { spa_close(spa, FTAG); } else { - char tmpname[MAXNAMELEN]; + char tmpname[ZFS_MAX_DATASET_NAME_LEN]; kernel_fini(); kernel_init(FREAD | FWRITE); (void) snprintf(tmpname, sizeof (tmpname), "%s_tmp", Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Oct 12 05:15:09 2016 (r307108) @@ -51,8 +51,6 @@ extern "C" { /* * Miscellaneous ZFS constants */ -#define ZFS_MAXNAMELEN MAXNAMELEN -#define ZPOOL_MAXNAMELEN MAXNAMELEN #define ZFS_MAXPROPLEN MAXPATHLEN #define ZPOOL_MAXPROPLEN MAXPATHLEN Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Wed Oct 12 05:15:09 2016 (r307108) @@ -26,6 +26,7 @@ * Portions Copyright 2007 Ramprakash Jelari * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. + * Copyright (c) 2014, 2015 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov */ @@ -296,7 +297,7 @@ void changelist_rename(prop_changelist_t *clp, const char *src, const char *dst) { prop_changenode_t *cn; - char newname[ZFS_MAXNAMELEN]; + char newname[ZFS_MAX_DATASET_NAME_LEN]; for (cn = uu_list_first(clp->cl_list); cn != NULL; cn = uu_list_next(clp->cl_list, cn)) { Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Oct 12 05:15:09 2016 (r307108) @@ -554,7 +554,7 @@ zfs_bookmark_exists(const char *path) { nvlist_t *bmarks; nvlist_t *props; - char fsname[ZFS_MAXNAMELEN]; + char fsname[ZFS_MAX_DATASET_NAME_LEN]; char *bmark_name; char *pound; int err; @@ -2181,7 +2181,7 @@ struct get_clones_arg { uint64_t numclones; nvlist_t *value; const char *origin; - char buf[ZFS_MAXNAMELEN]; + char buf[ZFS_MAX_DATASET_NAME_LEN]; }; int @@ -2236,7 +2236,7 @@ zfs_get_clones_nvl(zfs_handle_t *zhp) if (gca.numclones != 0) { zfs_handle_t *root; - char pool[ZFS_MAXNAMELEN]; + char pool[ZFS_MAX_DATASET_NAME_LEN]; char *cp = pool; /* get the pool name */ @@ -3021,7 +3021,7 @@ check_parents(libzfs_handle_t *hdl, cons boolean_t accept_ancestor, int *prefixlen) { zfs_cmd_t zc = { 0 }; - char parent[ZFS_MAXNAMELEN]; + char parent[ZFS_MAX_DATASET_NAME_LEN]; char *slash; zfs_handle_t *zhp; char errbuf[1024]; @@ -3260,7 +3260,7 @@ zfs_create(libzfs_handle_t *hdl, const c ost = LZC_DATSET_TYPE_ZFS; /* open zpool handle for prop validation */ - char pool_path[MAXNAMELEN]; + char pool_path[ZFS_MAX_DATASET_NAME_LEN]; (void) strlcpy(pool_path, path, sizeof (pool_path)); /* truncate pool_path at first slash */ @@ -3329,7 +3329,7 @@ zfs_create(libzfs_handle_t *hdl, const c /* check for failure */ if (ret != 0) { - char parent[ZFS_MAXNAMELEN]; + char parent[ZFS_MAX_DATASET_NAME_LEN]; (void) parent_name(path, parent, sizeof (parent)); switch (errno) { @@ -3419,7 +3419,7 @@ static int zfs_check_snap_cb(zfs_handle_t *zhp, void *arg) { struct destroydata *dd = arg; - char name[ZFS_MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; int rv = 0; (void) snprintf(name, sizeof (name), @@ -3509,7 +3509,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *h int zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props) { - char parent[ZFS_MAXNAMELEN]; + char parent[ZFS_MAX_DATASET_NAME_LEN]; int ret; char errbuf[1024]; libzfs_handle_t *hdl = zhp->zfs_hdl; @@ -3639,7 +3639,7 @@ static int zfs_snapshot_cb(zfs_handle_t *zhp, void *arg) { snapdata_t *sd = arg; - char name[ZFS_MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; int rv = 0; if (zfs_prop_get_int(zhp, ZFS_PROP_INCONSISTENT) == 0) { @@ -3688,7 +3688,7 @@ zfs_snapshot_nvl(libzfs_handle_t *hdl, n * get pool handle for prop validation. assumes all snaps are in the * same pool, as does lzc_snapshot (below). */ - char pool[MAXNAMELEN]; + char pool[ZFS_MAX_DATASET_NAME_LEN]; elem = nvlist_next_nvpair(snaps, NULL); (void) strlcpy(pool, nvpair_name(elem), sizeof (pool)); pool[strcspn(pool, "/@")] = '\0'; @@ -3742,7 +3742,7 @@ zfs_snapshot(libzfs_handle_t *hdl, const { int ret; snapdata_t sd = { 0 }; - char fsname[ZFS_MAXNAMELEN]; + char fsname[ZFS_MAX_DATASET_NAME_LEN]; char *cp; zfs_handle_t *zhp; char errbuf[1024]; @@ -3921,7 +3921,7 @@ zfs_rename(zfs_handle_t *zhp, const char prop_changelist_t *cl = NULL; zfs_handle_t *zhrp = NULL; char *parentname = NULL; - char parent[ZFS_MAXNAMELEN]; + char parent[ZFS_MAX_DATASET_NAME_LEN]; char property[ZFS_MAXPROPLEN]; libzfs_handle_t *hdl = zhp->zfs_hdl; char errbuf[1024]; @@ -4435,7 +4435,7 @@ static int zfs_hold_one(zfs_handle_t *zhp, void *arg) { struct holdarg *ha = arg; - char name[ZFS_MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; int rv = 0; (void) snprintf(name, sizeof (name), @@ -4554,7 +4554,7 @@ static int zfs_release_one(zfs_handle_t *zhp, void *arg) { struct holdarg *ha = arg; - char name[ZFS_MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; int rv = 0; nvlist_t *existing_holds; @@ -4683,7 +4683,7 @@ tryagain: zc.zc_nvlist_dst_size = nvsz; zc.zc_nvlist_dst = (uintptr_t)nvbuf; - (void) strlcpy(zc.zc_name, zhp->zfs_name, ZFS_MAXNAMELEN); + (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); if (ioctl(hdl->libzfs_fd, ZFS_IOC_GET_FSACL, &zc) != 0) { (void) snprintf(errbuf, sizeof (errbuf), Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c Wed Oct 12 05:15:09 2016 (r307108) @@ -22,6 +22,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2015 by Delphix. All rights reserved. * Copyright 2016 Joyent, Inc. * Copyright 2016 Igor Kozhukhov */ @@ -618,7 +619,7 @@ get_snapshot_names(differ_info_t *di, co * not the same dataset name, might be okay if * tosnap is a clone of a fromsnap descendant. */ - char origin[ZFS_MAXNAMELEN]; + char origin[ZFS_MAX_DATASET_NAME_LEN]; zprop_source_t src; zfs_handle_t *zhp; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Wed Oct 12 05:15:09 2016 (r307108) @@ -22,18 +22,18 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2013 Martin Matuska . All rights reserved. */ #ifndef _LIBZFS_IMPL_H #define _LIBZFS_IMPL_H -#include #include -#include #include #include +#include +#include #include #include @@ -86,7 +86,7 @@ struct libzfs_handle { struct zfs_handle { libzfs_handle_t *zfs_hdl; zpool_handle_t *zpool_hdl; - char zfs_name[ZFS_MAXNAMELEN]; + char zfs_name[ZFS_MAX_DATASET_NAME_LEN]; zfs_type_t zfs_type; /* type including snapshot */ zfs_type_t zfs_head_type; /* type excluding snapshot */ dmu_objset_stats_t zfs_dmustats; @@ -107,7 +107,7 @@ struct zfs_handle { struct zpool_handle { libzfs_handle_t *zpool_hdl; zpool_handle_t *zpool_next; - char zpool_name[ZPOOL_MAXNAMELEN]; + char zpool_name[ZFS_MAX_DATASET_NAME_LEN]; int zpool_state; size_t zpool_config_size; nvlist_t *zpool_config; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Wed Oct 12 05:15:09 2016 (r307108) @@ -197,7 +197,7 @@ zfs_iter_bookmarks(zfs_handle_t *zhp, zf for (nvpair_t *pair = nvlist_next_nvpair(bmarks, NULL); pair != NULL; pair = nvlist_next_nvpair(bmarks, pair)) { - char name[ZFS_MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; char *bmark_name; nvlist_t *bmark_props; @@ -385,7 +385,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, * exists. */ if (ssa.ssa_last[0] != '\0') { - char snapname[ZFS_MAXNAMELEN]; + char snapname[ZFS_MAX_DATASET_NAME_LEN]; (void) snprintf(snapname, sizeof (snapname), "%s@%s", zfs_get_name(fs_zhp), ssa.ssa_last); @@ -405,7 +405,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, ret = ENOENT; } } else { - char snapname[ZFS_MAXNAMELEN]; + char snapname[ZFS_MAX_DATASET_NAME_LEN]; zfs_handle_t *snap_zhp; (void) snprintf(snapname, sizeof (snapname), "%s@%s", zfs_get_name(fs_zhp), comma_separated); Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Wed Oct 12 05:15:09 2016 (r307108) @@ -236,7 +236,7 @@ static boolean_t zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen, zprop_source_t *source) { - char sourceloc[ZFS_MAXNAMELEN]; + char sourceloc[MAXNAMELEN]; zprop_source_t sourcetype; if (!zfs_prop_valid_for_type(ZFS_PROP_MOUNTPOINT, zhp->zfs_type)) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed Oct 12 05:15:09 2016 (r307108) @@ -407,7 +407,7 @@ bootfs_name_valid(const char *pool, char boolean_t zpool_is_bootable(zpool_handle_t *zhp) { - char bootfs[ZPOOL_MAXNAMELEN]; + char bootfs[ZFS_MAX_DATASET_NAME_LEN]; return (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs, sizeof (bootfs), NULL, B_FALSE) == 0 && strncmp(bootfs, "-", @@ -3803,7 +3803,7 @@ zpool_obj_to_path(zpool_handle_t *zhp, u zfs_cmd_t zc = { 0 }; boolean_t mounted = B_FALSE; char *mntpnt = NULL; - char dsname[MAXNAMELEN]; + char dsname[ZFS_MAX_DATASET_NAME_LEN]; if (dsobj == 0) { /* special case for the MOS */ @@ -4064,7 +4064,7 @@ zvol_check_dump_config(char *arg) uint_t toplevels; libzfs_handle_t *hdl; char errbuf[1024]; - char poolname[ZPOOL_MAXNAMELEN]; + char poolname[ZFS_MAX_DATASET_NAME_LEN]; int pathlen = strlen(ZVOL_FULL_DEV_DIR); int ret = 1; @@ -4087,7 +4087,7 @@ zvol_check_dump_config(char *arg) "malformed dataset name")); (void) zfs_error(hdl, EZFS_INVALIDNAME, errbuf); return (1); - } else if (p - volname >= ZFS_MAXNAMELEN) { + } else if (p - volname >= ZFS_MAX_DATASET_NAME_LEN) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "dataset name is too long")); (void) zfs_error(hdl, EZFS_NAMETOOLONG, errbuf); Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 12 05:15:09 2016 (r307108) @@ -752,7 +752,7 @@ send_iterate_prop(zfs_handle_t *zhp, nvl static uint64_t get_snap_txg(libzfs_handle_t *hdl, const char *fs, const char *snap) { - char name[ZFS_MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; uint64_t txg = 0; if (fs == NULL || fs[0] == '\0' || snap == NULL || snap[0] == '\0') @@ -920,7 +920,7 @@ typedef struct send_dump_data { /* these are all just the short snapname (the part after the @) */ const char *fromsnap; const char *tosnap; - char prevsnap[ZFS_MAXNAMELEN]; + char prevsnap[ZFS_MAX_DATASET_NAME_LEN]; uint64_t prevsnap_obj; boolean_t seenfrom, seento, replicate, doall, fromorigin; boolean_t verbose, dryrun, parsable, progress, embed_data, std_out; @@ -933,7 +933,7 @@ typedef struct send_dump_data { snapfilter_cb_t *filter_cb; void *filter_cb_arg; nvlist_t *debugnv; - char holdtag[ZFS_MAXNAMELEN]; + char holdtag[ZFS_MAX_DATASET_NAME_LEN]; int cleanup_fd; uint64_t size; } send_dump_data_t; @@ -1569,7 +1569,7 @@ zfs_send_resume(libzfs_handle_t *hdl, se uint64_t resumeobj, resumeoff, toguid, fromguid, bytes; zfs_handle_t *zhp; int error = 0; - char name[ZFS_MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; enum lzc_send_flags lzc_flags = 0; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, @@ -2163,8 +2163,8 @@ recv_rename(libzfs_handle_t *hdl, const if (err != 0 && strncmp(name + baselen, "recv-", 5) != 0) { seq++; - (void) snprintf(newname, ZFS_MAXNAMELEN, "%.*srecv-%u-%u", - baselen, name, getpid(), seq); + (void) snprintf(newname, ZFS_MAX_DATASET_NAME_LEN, + "%.*srecv-%u-%u", baselen, name, getpid(), seq); (void) strlcpy(zc.zc_value, newname, sizeof (zc.zc_value)); if (flags->verbose) { @@ -2292,7 +2292,7 @@ static int guid_to_name(libzfs_handle_t *hdl, const char *parent, uint64_t guid, boolean_t bookmark_ok, char *name) { - char pname[ZFS_MAXNAMELEN]; + char pname[ZFS_MAX_DATASET_NAME_LEN]; guid_to_name_data_t gtnd; gtnd.guid = guid; @@ -2347,7 +2347,7 @@ created_before(libzfs_handle_t *hdl, avl { nvlist_t *nvfs; char *fsname, *snapname; - char buf[ZFS_MAXNAMELEN]; + char buf[ZFS_MAX_DATASET_NAME_LEN]; int rv; zfs_handle_t *guid1hdl, *guid2hdl; uint64_t create1, create2; @@ -2398,7 +2398,7 @@ recv_incremental_replication(libzfs_hand avl_tree_t *local_avl; nvpair_t *fselem, *nextfselem; char *fromsnap; - char newname[ZFS_MAXNAMELEN]; + char newname[ZFS_MAX_DATASET_NAME_LEN]; char guidname[32]; int error; boolean_t needagain, progress, recursive; @@ -2517,7 +2517,7 @@ again: /* check for delete */ if (found == NULL) { - char name[ZFS_MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; if (!flags->force) continue; @@ -2557,8 +2557,8 @@ again: /* check for different snapname */ if (strcmp(nvpair_name(snapelem), stream_snapname) != 0) { - char name[ZFS_MAXNAMELEN]; - char tryname[ZFS_MAXNAMELEN]; + char name[ZFS_MAX_DATASET_NAME_LEN]; + char tryname[ZFS_MAX_DATASET_NAME_LEN]; (void) snprintf(name, sizeof (name), "%s@%s", fsname, nvpair_name(snapelem)); @@ -2640,7 +2640,7 @@ again: ((flags->isprefix || strcmp(tofs, fsname) != 0) && (s1 != NULL) && (s2 != NULL) && strcmp(s1, s2) != 0)) { nvlist_t *parent; - char tryname[ZFS_MAXNAMELEN]; + char tryname[ZFS_MAX_DATASET_NAME_LEN]; parent = fsavl_find(local_avl, stream_parent_fromsnap_guid, NULL); @@ -2708,8 +2708,8 @@ zfs_receive_package(libzfs_handle_t *hdl char *fromsnap = NULL; char *sendsnap = NULL; char *cp; - char tofs[ZFS_MAXNAMELEN]; - char sendfs[ZFS_MAXNAMELEN]; + char tofs[ZFS_MAX_DATASET_NAME_LEN]; + char sendfs[ZFS_MAX_DATASET_NAME_LEN]; char errbuf[1024]; dmu_replay_record_t drre; int error; @@ -2793,7 +2793,7 @@ zfs_receive_package(libzfs_handle_t *hdl nvlist_t *renamed = NULL; nvpair_t *pair = NULL; - (void) strlcpy(tofs, destname, ZFS_MAXNAMELEN); + (void) strlcpy(tofs, destname, sizeof (tofs)); if (flags->isprefix) { struct drr_begin *drrb = &drr->drr_u.drr_begin; int i; @@ -2802,7 +2802,7 @@ zfs_receive_package(libzfs_handle_t *hdl cp = strrchr(drrb->drr_toname, '/'); if (cp == NULL) { (void) strlcat(tofs, "/", - ZFS_MAXNAMELEN); + sizeof (tofs)); i = 0; } else { i = (cp - drrb->drr_toname); @@ -2812,7 +2812,7 @@ zfs_receive_package(libzfs_handle_t *hdl } /* zfs_receive_one() will create_parents() */ (void) strlcat(tofs, &drrb->drr_toname[i], - ZFS_MAXNAMELEN); + sizeof (tofs)); *strchr(tofs, '@') = '\0'; } @@ -2854,7 +2854,7 @@ zfs_receive_package(libzfs_handle_t *hdl * zfs_receive_one(). */ (void) strlcpy(sendfs, drr->drr_u.drr_begin.drr_toname, - ZFS_MAXNAMELEN); + sizeof (sendfs)); if ((cp = strchr(sendfs, '@')) != NULL) { *cp = '\0'; /* @@ -3004,7 +3004,7 @@ static void recv_ecksum_set_aux(libzfs_handle_t *hdl, const char *target_snap, boolean_t resumable) { - char target_fs[ZFS_MAXNAMELEN]; + char target_fs[ZFS_MAX_DATASET_NAME_LEN]; zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "checksum mismatch or incomplete stream")); @@ -3207,7 +3207,7 @@ zfs_receive_one(libzfs_handle_t *hdl, in if (flags->verbose) (void) printf("found clone origin %s\n", zc.zc_string); } else if (originsnap) { - (void) strncpy(zc.zc_string, originsnap, ZFS_MAXNAMELEN); + (void) strncpy(zc.zc_string, originsnap, sizeof (zc.zc_string)); if (flags->verbose) (void) printf("using provided clone origin %s\n", zc.zc_string); @@ -3232,7 +3232,7 @@ zfs_receive_one(libzfs_handle_t *hdl, in *cp = '\0'; if (cp && !zfs_dataset_exists(hdl, zc.zc_name, ZFS_TYPE_DATASET)) { - char suffix[ZFS_MAXNAMELEN]; + char suffix[ZFS_MAX_DATASET_NAME_LEN]; (void) strcpy(suffix, strrchr(zc.zc_value, '/')); if (guid_to_name(hdl, zc.zc_name, parent_snapguid, B_FALSE, zc.zc_value) == 0) { @@ -3259,7 +3259,7 @@ zfs_receive_one(libzfs_handle_t *hdl, in if ((flags->isprefix || (*(chopprefix = drrb->drr_toname + strlen(sendfs)) != '\0' && *chopprefix != '@')) && !zfs_dataset_exists(hdl, zc.zc_name, ZFS_TYPE_DATASET)) { - char snap[ZFS_MAXNAMELEN]; + char snap[ZFS_MAX_DATASET_NAME_LEN]; (void) strcpy(snap, strchr(zc.zc_value, '@')); if (guid_to_name(hdl, zc.zc_name, drrb->drr_fromguid, B_FALSE, zc.zc_value) == 0) { @@ -3709,7 +3709,7 @@ zfs_receive_impl(libzfs_handle_t *hdl, c } if (DMU_GET_STREAM_HDRTYPE(drrb->drr_versioninfo) == DMU_SUBSTREAM) { - char nonpackage_sendfs[ZFS_MAXNAMELEN]; + char nonpackage_sendfs[ZFS_MAX_DATASET_NAME_LEN]; if (sendfs == NULL) { /* * We were not called from zfs_receive_package(). Get @@ -3717,7 +3717,8 @@ zfs_receive_impl(libzfs_handle_t *hdl, c */ char *cp; (void) strlcpy(nonpackage_sendfs, - drr.drr_u.drr_begin.drr_toname, ZFS_MAXNAMELEN); + drr.drr_u.drr_begin.drr_toname, + sizeof (nonpackage_sendfs)); if ((cp = strchr(nonpackage_sendfs, '@')) != NULL) *cp = '\0'; sendfs = nonpackage_sendfs; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Oct 12 05:15:09 2016 (r307108) @@ -265,7 +265,7 @@ lzc_snapshot(nvlist_t *snaps, nvlist_t * nvpair_t *elem; nvlist_t *args; int error; - char pool[MAXNAMELEN]; + char pool[ZFS_MAX_DATASET_NAME_LEN]; *errlist = NULL; @@ -317,7 +317,7 @@ lzc_destroy_snaps(nvlist_t *snaps, boole nvpair_t *elem; nvlist_t *args; int error; - char pool[MAXNAMELEN]; + char pool[ZFS_MAX_DATASET_NAME_LEN]; /* determine the pool name */ elem = nvlist_next_nvpair(snaps, NULL); @@ -344,7 +344,7 @@ lzc_snaprange_space(const char *firstsna nvlist_t *args; nvlist_t *result; int err; - char fs[MAXNAMELEN]; + char fs[ZFS_MAX_DATASET_NAME_LEN]; char *atp; /* determine the fs name */ @@ -409,7 +409,7 @@ lzc_exists(const char *dataset) int lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist) { - char pool[MAXNAMELEN]; + char pool[ZFS_MAX_DATASET_NAME_LEN]; nvlist_t *args; nvpair_t *elem; int error; @@ -456,7 +456,7 @@ lzc_hold(nvlist_t *holds, int cleanup_fd int lzc_release(nvlist_t *holds, nvlist_t **errlist) { - char pool[MAXNAMELEN]; + char pool[ZFS_MAX_DATASET_NAME_LEN]; nvpair_t *elem; /* determine the pool name */ @@ -743,7 +743,7 @@ lzc_bookmark(nvlist_t *bookmarks, nvlist { nvpair_t *elem; int error; - char pool[MAXNAMELEN]; + char pool[ZFS_MAX_DATASET_NAME_LEN]; /* determine the pool name */ elem = nvlist_next_nvpair(bookmarks, NULL); @@ -805,7 +805,7 @@ lzc_destroy_bookmarks(nvlist_t *bmarks, { nvpair_t *elem; int error; - char pool[MAXNAMELEN]; + char pool[ZFS_MAX_DATASET_NAME_LEN]; /* determine the pool name */ elem = nvlist_next_nvpair(bmarks, NULL); Modified: stable/11/cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc ============================================================================== --- stable/11/cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc Wed Oct 12 05:15:09 2016 (r307108) @@ -82,7 +82,7 @@ struct zpool_handle { libzfs_handle_t *zpool_hdl; zpool_handle_t *zpool_next; - char zpool_name[ZPOOL_MAXNAMELEN]; + char zpool_name[ZFS_MAX_DATASET_NAME_LEN]; int zpool_state; size_t zpool_config_size; nvlist_t *zpool_config; Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c Wed Oct 12 05:14:04 2016 (r307107) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c Wed Oct 12 05:15:09 2016 (r307108) @@ -69,7 +69,7 @@ zfs_component_namecheck(const char *path { const char *loc; - if (strlen(path) >= MAXNAMELEN) { + if (strlen(path) >= ZFS_MAX_DATASET_NAME_LEN) { if (why) *why = NAME_ERR_TOOLONG; return (-1); @@ -140,14 +140,9 @@ dataset_namecheck(const char *path, name /* * Make sure the name is not too long. - * - * ZFS_MAXNAMELEN is the maximum dataset length used in the userland - * which is the same as MAXNAMELEN used in the kernel. - * If ZFS_MAXNAMELEN value is changed, make sure to cleanup all - * places using MAXNAMELEN. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:15:54 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAD35C0DCC2; Wed, 12 Oct 2016 05:15:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A231E1ECA; Wed, 12 Oct 2016 05:15:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5FrkT012287; Wed, 12 Oct 2016 05:15:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5FrTx012286; Wed, 12 Oct 2016 05:15:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120515.u9C5FrTx012286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:15:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307109 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:15:55 -0000 Author: mav Date: Wed Oct 12 05:15:53 2016 New Revision: 307109 URL: https://svnweb.freebsd.org/changeset/base/307109 Log: MFC r305210: MFV r302661: 7082 bptree_iterate() passes wrong args to zfs_dbgmsg() illumos/illumos-gate@10e67aa0db0823d5464aafdd681f3c966155c68e https://github.com/illumos/illumos-gate/commit/10e67aa0db0823d5464aafdd681f3c966 155c68e https://www.illumos.org/issues/7082 upstream DLPX-40542 bptree_iterate() passes wrong args to zfs_dbgmsg() Reviewed by: Dan Kimmel Reviewed by: George Wilson Reviewed by: Igor Kozhukhov Approved by: Dan McDonald Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Wed Oct 12 05:15:09 2016 (r307108) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Wed Oct 12 05:15:53 2016 (r307109) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -220,9 +220,10 @@ bptree_iterate(objset_t *os, uint64_t ob if (zfs_free_leak_on_eio) flags |= TRAVERSE_HARD; - zfs_dbgmsg("bptree index %d: traversing from min_txg=%lld " + zfs_dbgmsg("bptree index %lld: traversing from min_txg=%lld " "bookmark %lld/%lld/%lld/%lld", - i, (longlong_t)bte.be_birth_txg, + (longlong_t)i, + (longlong_t)bte.be_birth_txg, (longlong_t)bte.be_zb.zb_objset, (longlong_t)bte.be_zb.zb_object, (longlong_t)bte.be_zb.zb_level, From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:16:34 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1572C0DD2F; Wed, 12 Oct 2016 05:16:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E79973; Wed, 12 Oct 2016 05:16:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5GXGW012368; Wed, 12 Oct 2016 05:16:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5GX5L012366; Wed, 12 Oct 2016 05:16:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120516.u9C5GX5L012366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307110 - in stable/11: cddl/contrib/opensolaris/lib/libnvpair sys/cddl/contrib/opensolaris/common/nvpair X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:16:34 -0000 Author: mav Date: Wed Oct 12 05:16:33 2016 New Revision: 307110 URL: https://svnweb.freebsd.org/changeset/base/307110 Log: MFC r305211: MFV r302662: 6447 handful of nvpair cleanups illumos/illumos-gate@759e89be359f2af635e4122d147df56bce948773 https://github.com/illumos/illumos-gate/commit/759e89be359f2af635e4122d147df56bc e948773 https://www.illumos.org/issues/6447 I got a patch from someone who uses nvpair code outside of illumos. It fixes a couple of gcc warnings/bugs for him. 1. silence uninitialized use warnings 2. add parentheses around assignment used as truth value 3. fix printf format specifier (ll is for integers only) 4. strstr, strspn, strcspn, and strcmp are declared in string.h, not strings.h. 5. avoid scanning integer into boolean variable Reviewed by: Josef 'Jeff' Sipek Reviewed by: Andy Stormont Reviewed by: Garrett D'Amore Approved by: Robert Mustacchi Author: Steve Dougherty Modified: stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c Wed Oct 12 05:15:53 2016 (r307109) +++ stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c Wed Oct 12 05:16:33 2016 (r307110) @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include "libnvpair.h" @@ -1228,7 +1228,8 @@ nvpair_value_match_regex(nvpair_t *nvp, break; } case DATA_TYPE_BOOLEAN_VALUE: { - boolean_t val, val_arg; + int32_t val_arg; + boolean_t val; /* scanf boolean_t from value and check for match */ sr = sscanf(value, "%"SCNi32, &val_arg); @@ -1239,7 +1240,8 @@ nvpair_value_match_regex(nvpair_t *nvp, break; } case DATA_TYPE_BOOLEAN_ARRAY: { - boolean_t *val_array, val_arg; + boolean_t *val_array; + int32_t val_arg; /* check indexed value of array for match */ sr = sscanf(value, "%"SCNi32, &val_arg); Modified: stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Wed Oct 12 05:15:53 2016 (r307109) +++ stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Wed Oct 12 05:16:33 2016 (r307110) @@ -1629,6 +1629,8 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nv if ((nvl == NULL) || (name == NULL)) return (EINVAL); + sepp = NULL; + idx = 0; /* step through components of name */ for (np = name; np && *np; np = sepp) { /* ensure unique names */ @@ -2386,7 +2388,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp, */ nv_priv_init(&nvpriv, nva, 0); - if (err = nvlist_size(nvl, &alloc_size, encoding)) + if ((err = nvlist_size(nvl, &alloc_size, encoding))) return (err); if ((buf = nv_mem_zalloc(&nvpriv, alloc_size)) == NULL) From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:17:19 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32AFCC0DDCA; Wed, 12 Oct 2016 05:17:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2AFA1F2; Wed, 12 Oct 2016 05:17:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5HIpt012453; Wed, 12 Oct 2016 05:17:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5HIPX012452; Wed, 12 Oct 2016 05:17:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120517.u9C5HIPX012452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:17:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307111 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:17:19 -0000 Author: mav Date: Wed Oct 12 05:17:17 2016 New Revision: 307111 URL: https://svnweb.freebsd.org/changeset/base/307111 Log: MFC r305221: MFV r302992: 7071 lzc_snapshot does not fill in errlist on ENOENT illumos/illumos-gate@25f7d993adbfb3452ac4625b3791670746d35ae3 https://github.com/illumos/illumos-gate/commit/25f7d993adbfb3452ac4625b379167074 6d35ae3 https://www.illumos.org/issues/7071 upstream DLPX-40482 lzc_snapshot does not fill in errlist on ENOENT Reviewed by: Igor Kozhukhov Reviewed by: George Wilson Reviewed by: Dan Kimmel Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 12 05:16:33 2016 (r307110) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 12 05:17:17 2016 (r307111) @@ -500,6 +500,14 @@ zfs_secpolicy_write_perms(const char *na dsl_dataset_t *ds; dsl_pool_t *dp; + /* + * First do a quick check for root in the global zone, which + * is allowed to do all write_perms. This ensures that zfs_ioc_* + * will get to handle nonexistent datasets. + */ + if (INGLOBALZONE(curthread) && secpolicy_zfs(cr) == 0) + return (0); + error = dsl_pool_hold(name, FTAG, &dp); if (error != 0) return (error); From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:19:10 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53361C0DE8A; Wed, 12 Oct 2016 05:19:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D142396; Wed, 12 Oct 2016 05:19:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5J9OW012579; Wed, 12 Oct 2016 05:19:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5J8R2012575; Wed, 12 Oct 2016 05:19:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120519.u9C5J8R2012575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307112 - in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:19:10 -0000 Author: mav Date: Wed Oct 12 05:19:08 2016 New Revision: 307112 URL: https://svnweb.freebsd.org/changeset/base/307112 Log: MFC r305222: MFV r302993: 7104 increase indirect block size illumos/illumos-gate@4b5c8e93cab28d3c65ba9d407fd8f46e3be1db1c https://github.com/illumos/illumos-gate/commit/4b5c8e93cab28d3c65ba9d407fd8f46e3 be1db1c https://www.illumos.org/issues/7104 The current default indirect block size is 16KB. We can improve performance by increasing it to 128KB. This is especially helpful for any workload that needs to read most of the metadata, e.g. scrub/resilver, file deletion, filesystem deletion, and zfs send. We also need to fix a few space estimation errors to make the tests pass. Reviewed by: George Wilson Reviewed by: Paul Dagnelie Reviewed by: Dan McDonald Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Oct 12 05:17:17 2016 (r307111) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Oct 12 05:19:08 2016 (r307112) @@ -791,11 +791,17 @@ dmu_objset_create_impl(spa_t *spa, dsl_d /* * Determine the number of levels necessary for the meta-dnode - * to contain DN_MAX_OBJECT dnodes. + * to contain DN_MAX_OBJECT dnodes. Note that in order to + * ensure that we do not overflow 64 bits, there has to be + * a nlevels that gives us a number of blocks > DN_MAX_OBJECT + * but < 2^64. Therefore, + * (mdn->dn_indblkshift - SPA_BLKPTRSHIFT) (10) must be + * less than (64 - log2(DN_MAX_OBJECT)) (16). */ - while ((uint64_t)mdn->dn_nblkptr << (mdn->dn_datablkshift + + while ((uint64_t)mdn->dn_nblkptr << + (mdn->dn_datablkshift - DNODE_SHIFT + (levels - 1) * (mdn->dn_indblkshift - SPA_BLKPTRSHIFT)) < - DN_MAX_OBJECT * sizeof (dnode_phys_t)) + DN_MAX_OBJECT) levels++; mdn->dn_next_nlevels[tx->tx_txg & TXG_MASK] = Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Oct 12 05:17:17 2016 (r307111) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Oct 12 05:19:08 2016 (r307112) @@ -411,12 +411,20 @@ zfs_deadman_init() * it is possible to run the pool completely out of space, causing it to * be permanently read-only. * + * Note that on very small pools, the slop space will be larger than + * 3.2%, in an effort to have it be at least spa_min_slop (128MB), + * but we never allow it to be more than half the pool size. + * * See also the comments in zfs_space_check_t. */ int spa_slop_shift = 5; SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_slop_shift, CTLFLAG_RWTUN, &spa_slop_shift, 0, "Shift value of reserved space (1/(2^spa_slop_shift))."); +uint64_t spa_min_slop = 128 * 1024 * 1024; +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, spa_min_slop, CTLFLAG_RWTUN, + &spa_min_slop, 0, + "Minimal value of reserved space"); /* * ========================================================================== @@ -1723,14 +1731,16 @@ spa_get_asize(spa_t *spa, uint64_t lsize /* * Return the amount of slop space in bytes. It is 1/32 of the pool (3.2%), - * or at least 32MB. + * or at least 128MB, unless that would cause it to be more than half the + * pool size. * * See the comment above spa_slop_shift for details. */ uint64_t -spa_get_slop_space(spa_t *spa) { +spa_get_slop_space(spa_t *spa) +{ uint64_t space = spa_get_dspace(spa); - return (MAX(space >> spa_slop_shift, SPA_MINDEVSIZE >> 1)); + return (MAX(space >> spa_slop_shift, MIN(space >> 1, spa_min_slop))); } uint64_t Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Wed Oct 12 05:17:17 2016 (r307111) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Wed Oct 12 05:19:08 2016 (r307112) @@ -58,7 +58,7 @@ extern "C" { */ #define DNODE_SHIFT 9 /* 512 bytes */ #define DN_MIN_INDBLKSHIFT 12 /* 4k */ -#define DN_MAX_INDBLKSHIFT 14 /* 16k */ +#define DN_MAX_INDBLKSHIFT 17 /* 128k */ #define DNODE_BLOCK_SHIFT 14 /* 16k */ #define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */ #define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */ @@ -88,6 +88,11 @@ extern "C" { #define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT) #define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT) + +/* + * This is inaccurate if the indblkshift of the particular object is not the + * max. But it's only used by userland to calculate the zvol reservation. + */ #define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT) #define DNODES_PER_LEVEL (1ULL << DNODES_PER_LEVEL_SHIFT) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Oct 12 05:17:17 2016 (r307111) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Oct 12 05:19:08 2016 (r307112) @@ -610,6 +610,8 @@ typedef struct zpool_rewind_policy { /* * This is needed in userland to report the minimum necessary device size. + * + * Note that the zfs test suite uses 64MB vdevs. */ #define SPA_MINDEVSIZE (64ULL << 20) From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:20:07 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52930C0DF49; Wed, 12 Oct 2016 05:20:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12DCA79F; Wed, 12 Oct 2016 05:20:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5K6nU012687; Wed, 12 Oct 2016 05:20:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5K63R012686; Wed, 12 Oct 2016 05:20:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120520.u9C5K63R012686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307113 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:20:07 -0000 Author: mav Date: Wed Oct 12 05:20:06 2016 New Revision: 307113 URL: https://svnweb.freebsd.org/changeset/base/307113 Log: MFC r305224: MFV r304158: 7136 ESC_VDEV_REMOVE_AUX ought to always include vdev information 7115 6922 generates ESC_ZFS_VDEV_REMOVE_AUX a bit too often illumos/illumos-gate@b72b6bb10ad55121a1b352c6f68ebdc8e20c9086 https://github.com/illumos/illumos-gate/commit/b72b6bb10ad55121a1b352c6f68ebdc8e 20c9086 https://www.illumos.org/issues/7136 6922 added ESC_ZFS_VDEV_REMOVE_AUX and ESC_ZFS_VDEV_REMOVE_DEV sysevents whenever an aux device gets removed from a pool. However, those sysevents will be created without the vdev_guid and vdev_path fields. It would be better to always populate those fields. https://www.illumos.org/issues/7115 The addition of spa_event_notify in vdev removal code (see #6922) causes event s to be generated even if the spare failed to be removed with EBUSY. Reviewed by: George Wilson Reviewed by: Josef 'Jeff' Sipek Approved by: Robert Mustacchi Author: Alan Somers Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Oct 12 05:19:08 2016 (r307112) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Oct 12 05:20:06 2016 (r307113) @@ -151,6 +151,8 @@ const zio_taskq_info_t zio_taskqs[ZIO_TY { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* IOCTL */ }; +static sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, const char *name); +static void spa_event_post(sysevent_t *ev); static void spa_sync_version(void *arg, dmu_tx_t *tx); static void spa_sync_props(void *arg, dmu_tx_t *tx); static boolean_t spa_has_active_shared_spare(spa_t *spa); @@ -5738,6 +5740,7 @@ int spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare) { vdev_t *vd; + sysevent_t *ev = NULL; metaslab_group_t *mg; nvlist_t **spares, **l2cache, *nv; uint64_t txg = 0; @@ -5761,6 +5764,9 @@ spa_vdev_remove(spa_t *spa, uint64_t gui * in this pool. */ if (vd == NULL || unspare) { + if (vd == NULL) + vd = spa_lookup_by_guid(spa, guid, B_TRUE); + ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); spa_vdev_remove_aux(spa->spa_spares.sav_config, ZPOOL_CONFIG_SPARES, spares, nspares, nv); spa_load_spares(spa); @@ -5768,7 +5774,6 @@ spa_vdev_remove(spa_t *spa, uint64_t gui } else { error = SET_ERROR(EBUSY); } - spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); } else if (spa->spa_l2cache.sav_vdevs != NULL && nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config, ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache) == 0 && @@ -5776,11 +5781,12 @@ spa_vdev_remove(spa_t *spa, uint64_t gui /* * Cache devices can always be removed. */ + vd = spa_lookup_by_guid(spa, guid, B_TRUE); + ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); spa_vdev_remove_aux(spa->spa_l2cache.sav_config, ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv); spa_load_l2cache(spa); spa->spa_l2cache.sav_sync = B_TRUE; - spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); } else if (vd != NULL && vd->vdev_islog) { ASSERT(!locked); ASSERT(vd == vd->vdev_top); @@ -5817,9 +5823,9 @@ spa_vdev_remove(spa_t *spa, uint64_t gui /* * Clean up the vdev namespace. */ + ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV); spa_vdev_remove_from_namespace(spa, vd); - spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV); } else if (vd != NULL) { /* * Normal vdevs cannot be removed (yet). @@ -5835,6 +5841,9 @@ spa_vdev_remove(spa_t *spa, uint64_t gui if (!locked) error = spa_vdev_exit(spa, NULL, txg, error); + if (ev) + spa_event_post(ev); + return (error); } @@ -7229,24 +7238,17 @@ spa_has_active_shared_spare(spa_t *spa) return (B_FALSE); } -/* - * Post a sysevent corresponding to the given event. The 'name' must be one of - * the event definitions in sys/sysevent/eventdefs.h. The payload will be - * filled in from the spa and (optionally) the vdev. This doesn't do anything - * in the userland libzpool, as we don't want consumers to misinterpret ztest - * or zdb as real changes. - */ -void -spa_event_notify(spa_t *spa, vdev_t *vd, const char *name) +static sysevent_t * +spa_event_create(spa_t *spa, vdev_t *vd, const char *name) { + sysevent_t *ev = NULL; #ifdef _KERNEL - sysevent_t *ev; sysevent_attr_list_t *attr = NULL; sysevent_value_t value; - sysevent_id_t eid; ev = sysevent_alloc(EC_ZFS, (char *)name, SUNW_KERN_PUB "zfs", SE_SLEEP); + ASSERT(ev != NULL); value.value_type = SE_DATA_TYPE_STRING; value.value.sv_string = spa_name(spa); @@ -7278,11 +7280,34 @@ spa_event_notify(spa_t *spa, vdev_t *vd, goto done; attr = NULL; - (void) log_sysevent(ev, SE_SLEEP, &eid); - done: if (attr) sysevent_free_attr(attr); + +#endif + return (ev); +} + +static void +spa_event_post(sysevent_t *ev) +{ +#ifdef _KERNEL + sysevent_id_t eid; + + (void) log_sysevent(ev, SE_SLEEP, &eid); sysevent_free(ev); #endif } + +/* + * Post a sysevent corresponding to the given event. The 'name' must be one of + * the event definitions in sys/sysevent/eventdefs.h. The payload will be + * filled in from the spa and (optionally) the vdev. This doesn't do anything + * in the userland libzpool, as we don't want consumers to misinterpret ztest + * or zdb as real changes. + */ +void +spa_event_notify(spa_t *spa, vdev_t *vd, const char *name) +{ + spa_event_post(spa_event_create(spa, vd, name)); +} From owner-svn-src-stable-11@freebsd.org Wed Oct 12 05:50:14 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A8BFC0EB01; Wed, 12 Oct 2016 05:50:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56B23CC2; Wed, 12 Oct 2016 05:50:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C5oD0b025705; Wed, 12 Oct 2016 05:50:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C5oDGb025704; Wed, 12 Oct 2016 05:50:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610120550.u9C5oDGb025704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Oct 2016 05:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307128 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 05:50:14 -0000 Author: mav Date: Wed Oct 12 05:50:13 2016 New Revision: 307128 URL: https://svnweb.freebsd.org/changeset/base/307128 Log: MFC 306699: Do not retry on some security sense codes. Modified: stable/11/sys/cam/scsi/scsi_all.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_all.c Wed Oct 12 05:47:06 2016 (r307127) +++ stable/11/sys/cam/scsi/scsi_all.c Wed Oct 12 05:50:13 2016 (r307128) @@ -3192,10 +3192,10 @@ static struct asc_table_entry asc_table[ { SST(0x74, 0x6F, SS_RDEF, /* XXX TBD */ "External data encryption control error") }, /* DT R M E V */ - { SST(0x74, 0x71, SS_RDEF, /* XXX TBD */ + { SST(0x74, 0x71, SS_FATAL | EACCES, "Logical unit access not authorized") }, /* D */ - { SST(0x74, 0x79, SS_RDEF, /* XXX TBD */ + { SST(0x74, 0x79, SS_FATAL | EACCES, "Security conflict in translated device") } }; From owner-svn-src-stable-11@freebsd.org Wed Oct 12 09:16:17 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53502C0EB3E; Wed, 12 Oct 2016 09:16:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2301591; Wed, 12 Oct 2016 09:16:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C9GGWe004859; Wed, 12 Oct 2016 09:16:16 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C9GGev004858; Wed, 12 Oct 2016 09:16:16 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201610120916.u9C9GGev004858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 12 Oct 2016 09:16:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307135 - stable/11/sys/compat/ia32 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 09:16:17 -0000 Author: ed Date: Wed Oct 12 09:16:16 2016 New Revision: 307135 URL: https://svnweb.freebsd.org/changeset/base/307135 Log: MFC r304740: Add missing header dependency. This header depends on sigaltstack32 being declared. Modified: stable/11/sys/compat/ia32/ia32_signal.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/ia32/ia32_signal.h ============================================================================== --- stable/11/sys/compat/ia32/ia32_signal.h Wed Oct 12 09:13:16 2016 (r307134) +++ stable/11/sys/compat/ia32/ia32_signal.h Wed Oct 12 09:16:16 2016 (r307135) @@ -32,6 +32,8 @@ #ifndef _COMPAT_IA32_IA32_SIGNAL_H #define _COMPAT_IA32_IA32_SIGNAL_H +#include + #define _MC_IA32_HASSEGS 0x1 #define _MC_IA32_HASBASES 0x2 #define _MC_IA32_HASFPXSTATE 0x4 From owner-svn-src-stable-11@freebsd.org Wed Oct 12 09:17:43 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 822C8C0EBBF; Wed, 12 Oct 2016 09:17:43 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FCED216; Wed, 12 Oct 2016 09:17:43 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9C9HgVi004981; Wed, 12 Oct 2016 09:17:42 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9C9Hfii004975; Wed, 12 Oct 2016 09:17:41 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201610120917.u9C9Hfii004975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 12 Oct 2016 09:17:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307136 - in stable/11/sys/arm: arm include X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 09:17:43 -0000 Author: ed Date: Wed Oct 12 09:17:41 2016 New Revision: 307136 URL: https://svnweb.freebsd.org/changeset/base/307136 Log: MFC r306162: Make it possible to safely use TPIDRURW from userspace. On amd64, arm64 and i386, we have the possibility to switch between TLS areas in userspace. The nice thing about this is that it makes it easier to do light-weight threading, if we ever feel like doing that. On armv6, let's go into the same direction by making it possible to safely use the TPIDRURW register, which is intended for this purpose. Clean up the ARMv6 code to remove md_tp entirely. Simply add a dedicated field to the PCB to hold the value of TPIDRURW across context switches, like we do for any other register. As userspace currently uses the read-only TPIDRURO register, simply ensure that we keep both values in sync where possible. The system calls for modifying the read-only register will simply write the intended value into both registers, so that it lazily ends up in the PCB during the next context switch. Approved by: andrew Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D7951 Modified: stable/11/sys/arm/arm/genassym.c stable/11/sys/arm/arm/swtch-v6.S stable/11/sys/arm/arm/sys_machdep.c stable/11/sys/arm/arm/vm_machdep.c stable/11/sys/arm/include/frame.h stable/11/sys/arm/include/pcpu.h stable/11/sys/arm/include/proc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/genassym.c ============================================================================== --- stable/11/sys/arm/arm/genassym.c Wed Oct 12 09:16:16 2016 (r307135) +++ stable/11/sys/arm/arm/genassym.c Wed Oct 12 09:17:41 2016 (r307136) @@ -81,6 +81,9 @@ ASSYM(PCB_R12, offsetof(struct pcb, pcb_ ASSYM(PCB_SP, offsetof(struct pcb, pcb_regs.sf_sp)); ASSYM(PCB_LR, offsetof(struct pcb, pcb_regs.sf_lr)); ASSYM(PCB_PC, offsetof(struct pcb, pcb_regs.sf_pc)); +#if __ARM_ARCH >= 6 +ASSYM(PCB_TPIDRURW, offsetof(struct pcb, pcb_regs.sf_tpidrurw)); +#endif ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); @@ -100,8 +103,8 @@ ASSYM(TD_FLAGS, offsetof(struct thread, ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_MD, offsetof(struct thread, td_md)); ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); -ASSYM(MD_TP, offsetof(struct mdthread, md_tp)); #if __ARM_ARCH < 6 +ASSYM(MD_TP, offsetof(struct mdthread, md_tp)); ASSYM(MD_RAS_START, offsetof(struct mdthread, md_ras_start)); ASSYM(MD_RAS_END, offsetof(struct mdthread, md_ras_end)); #endif Modified: stable/11/sys/arm/arm/swtch-v6.S ============================================================================== --- stable/11/sys/arm/arm/swtch-v6.S Wed Oct 12 09:16:16 2016 (r307135) +++ stable/11/sys/arm/arm/swtch-v6.S Wed Oct 12 09:17:41 2016 (r307136) @@ -291,6 +291,8 @@ ENTRY(cpu_switch) ldr r3, [r0, #(TD_PCB)] add r3, #(PCB_R4) stmia r3, {r4-r12, sp, lr, pc} + mrc CP15_TPIDRURW(r4) + str r4, [r3, #(PCB_TPIDRURW - PCB_R4)] #ifdef INVARIANTS cmp r1, #0 /* new thread? */ @@ -437,9 +439,6 @@ sw1: cmp r3, r6 beq 1b #endif - /* Set the new tls */ - ldr r0, [r11, #(TD_MD + MD_TP)] - mcr CP15_TPIDRURO(r0) /* write tls thread reg 2 */ /* We have a new curthread now so make a note it */ str r11, [r8, #PC_CURTHREAD] @@ -452,7 +451,14 @@ sw1: * Restore all saved registers and return. Note that some saved * registers can be changed when either cpu_fork(), cpu_copy_thread(), * cpu_fork_kthread_handler(), or makectx() was called. - */ + * + * The value of TPIDRURW is also written into TPIDRURO, as + * userspace still uses TPIDRURO, modifying it through + * sysarch(ARM_SET_TP, addr). + */ + ldr r3, [r7, #PCB_TPIDRURW] + mcr CP15_TPIDRURW(r3) /* write tls thread reg 2 */ + mcr CP15_TPIDRURO(r3) /* write tls thread reg 3 */ add r3, r7, #PCB_R4 ldmia r3, {r4-r12, sp, pc} Modified: stable/11/sys/arm/arm/sys_machdep.c ============================================================================== --- stable/11/sys/arm/arm/sys_machdep.c Wed Oct 12 09:16:16 2016 (r307135) +++ stable/11/sys/arm/arm/sys_machdep.c Wed Oct 12 09:17:41 2016 (r307136) @@ -166,10 +166,10 @@ static int arm32_set_tp(struct thread *td, void *args) { - td->td_md.md_tp = (register_t)args; #if __ARM_ARCH >= 6 set_tls(args); #else + td->td_md.md_tp = (register_t)args; *(register_t *)ARM_TP_ADDRESS = (register_t)args; #endif return (0); @@ -180,7 +180,7 @@ arm32_get_tp(struct thread *td, void *ar { #if __ARM_ARCH >= 6 - td->td_retval[0] = td->td_md.md_tp; + td->td_retval[0] = (register_t)get_tls(); #else td->td_retval[0] = *(register_t *)ARM_TP_ADDRESS; #endif Modified: stable/11/sys/arm/arm/vm_machdep.c ============================================================================== --- stable/11/sys/arm/arm/vm_machdep.c Wed Oct 12 09:16:16 2016 (r307135) +++ stable/11/sys/arm/arm/vm_machdep.c Wed Oct 12 09:17:41 2016 (r307136) @@ -82,8 +82,8 @@ __FBSDID("$FreeBSD$"); * struct switchframe and trapframe must both be a multiple of 8 * for correct stack alignment. */ -CTASSERT(sizeof(struct switchframe) == 48); -CTASSERT(sizeof(struct trapframe) == 80); +_Static_assert((sizeof(struct switchframe) % 8) == 0, "Bad alignment"); +_Static_assert((sizeof(struct trapframe) % 8) == 0, "Bad alignment"); uint32_t initial_fpscr = VFPSCR_DN | VFPSCR_FZ; @@ -134,6 +134,9 @@ cpu_fork(register struct thread *td1, re pcb2->pcb_regs.sf_r5 = (register_t)td2; pcb2->pcb_regs.sf_lr = (register_t)fork_trampoline; pcb2->pcb_regs.sf_sp = STACKALIGN(td2->td_frame); +#if __ARM_ARCH >= 6 + pcb2->pcb_regs.sf_tpidrurw = (register_t)get_tls(); +#endif pcb2->pcb_vfpcpu = -1; pcb2->pcb_vfpstate.fpscr = initial_fpscr; @@ -147,9 +150,7 @@ cpu_fork(register struct thread *td1, re /* Setup to release spin count in fork_exit(). */ td2->td_md.md_spinlock_count = 1; td2->td_md.md_saved_cspr = PSR_SVC32_MODE; -#if __ARM_ARCH >= 6 - td2->td_md.md_tp = td1->td_md.md_tp; -#else +#if __ARM_ARCH < 6 td2->td_md.md_tp = *(register_t *)ARM_TP_ADDRESS; #endif } @@ -272,16 +273,18 @@ int cpu_set_user_tls(struct thread *td, void *tls_base) { - td->td_md.md_tp = (register_t)tls_base; - if (td == curthread) { - critical_enter(); #if __ARM_ARCH >= 6 + td->td_pcb->pcb_regs.sf_tpidrurw = (register_t)tls_base; + if (td == curthread) set_tls(tls_base); #else + td->td_md.md_tp = (register_t)tls_base; + if (td == curthread) { + critical_enter(); *(register_t *)ARM_TP_ADDRESS = (register_t)tls_base; -#endif critical_exit(); } +#endif return (0); } Modified: stable/11/sys/arm/include/frame.h ============================================================================== --- stable/11/sys/arm/include/frame.h Wed Oct 12 09:16:16 2016 (r307135) +++ stable/11/sys/arm/include/frame.h Wed Oct 12 09:17:41 2016 (r307136) @@ -117,6 +117,10 @@ struct switchframe register_t sf_sp; register_t sf_lr; register_t sf_pc; +#if __ARM_ARCH >= 6 + register_t sf_tpidrurw; + register_t sf_spare0; +#endif }; Modified: stable/11/sys/arm/include/pcpu.h ============================================================================== --- stable/11/sys/arm/include/pcpu.h Wed Oct 12 09:16:16 2016 (r307135) +++ stable/11/sys/arm/include/pcpu.h Wed Oct 12 09:17:41 2016 (r307136) @@ -103,7 +103,8 @@ get_tls(void) { void *tls; - __asm __volatile("mrc p15, 0, %0, c13, c0, 3" : "=r" (tls)); + /* TPIDRURW contains the authoritative value. */ + __asm __volatile("mrc p15, 0, %0, c13, c0, 2" : "=r" (tls)); return (tls); } @@ -111,7 +112,15 @@ static inline void set_tls(void *tls) { - __asm __volatile("mcr p15, 0, %0, c13, c0, 3" : : "r" (tls)); + /* + * Update both TPIDRURW and TPIDRURO. TPIDRURW needs to be written + * first to ensure that a context switch between the two writes will + * still give the desired result of updating both. + */ + __asm __volatile( + "mcr p15, 0, %0, c13, c0, 2\n" + "mcr p15, 0, %0, c13, c0, 3\n" + : : "r" (tls)); } #define curthread get_curthread() Modified: stable/11/sys/arm/include/proc.h ============================================================================== --- stable/11/sys/arm/include/proc.h Wed Oct 12 09:16:16 2016 (r307135) +++ stable/11/sys/arm/include/proc.h Wed Oct 12 09:17:41 2016 (r307136) @@ -53,8 +53,8 @@ struct mdthread { int md_ptrace_addr; int md_ptrace_instr_alt; int md_ptrace_addr_alt; - register_t md_tp; #if __ARM_ARCH < 6 + register_t md_tp; void *md_ras_start; void *md_ras_end; #endif From owner-svn-src-stable-11@freebsd.org Wed Oct 12 10:28:25 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B342CC0D8A1; Wed, 12 Oct 2016 10:28:25 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F71B3CC; Wed, 12 Oct 2016 10:28:25 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9CASOOp034425; Wed, 12 Oct 2016 10:28:24 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9CASMFX034405; Wed, 12 Oct 2016 10:28:22 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201610121028.u9CASMFX034405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Wed, 12 Oct 2016 10:28:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307138 - in stable/11: contrib/libarchive/cat/test contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar contrib/libarchi... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 10:28:25 -0000 Author: mm Date: Wed Oct 12 10:28:22 2016 New Revision: 307138 URL: https://svnweb.freebsd.org/changeset/base/307138 Log: MFC r306670: Sync libarchive with vendor including security fixes. Important vendor bugfixes (relevant to FreeBSD): #747: Out of bounds read in mtree parser #761: heap-based buffer overflow in read_Header (7-zip) #794: Invalid file on bsdtar command line results in internal errors (1) PR: 213092 (1) Added: stable/11/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c - copied unchanged from r306670, head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c stable/11/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu - copied unchanged from r306670, head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu Modified: stable/11/contrib/libarchive/cat/test/main.c stable/11/contrib/libarchive/cat/test/test.h stable/11/contrib/libarchive/cpio/test/main.c stable/11/contrib/libarchive/cpio/test/test.h stable/11/contrib/libarchive/libarchive/archive_read_support_format_7zip.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_mtree.c stable/11/contrib/libarchive/libarchive/test/main.c stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c stable/11/contrib/libarchive/libarchive/test/test_read_set_format.c stable/11/contrib/libarchive/tar/subst.c stable/11/contrib/libarchive/tar/test/main.c stable/11/contrib/libarchive/tar/test/test.h stable/11/contrib/libarchive/tar/test/test_option_H_upper.c stable/11/contrib/libarchive/tar/test/test_option_L_upper.c stable/11/contrib/libarchive/tar/test/test_option_U_upper.c stable/11/contrib/libarchive/tar/test/test_option_n.c stable/11/contrib/libarchive/tar/write.c stable/11/lib/libarchive/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libarchive/cat/test/main.c ============================================================================== --- stable/11/contrib/libarchive/cat/test/main.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/cat/test/main.c Wed Oct 12 10:28:22 2016 (r307138) @@ -1360,6 +1360,31 @@ assertion_file_birthtime_recent(const ch return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Verify mtime of 'pathname'. */ int assertion_file_mtime(const char *file, int line, @@ -1578,8 +1603,12 @@ assertion_make_dir(const char *file, int if (0 == _mkdir(dirname)) return (1); #else - if (0 == mkdir(dirname, mode)) - return (1); + if (0 == mkdir(dirname, mode)) { + if (0 == chmod(dirname, mode)) { + assertion_file_mode(file, line, dirname, mode); + return (1); + } + } #endif failure_start(file, line, "Could not create directory %s", dirname); failure_finish(NULL); @@ -1628,6 +1657,11 @@ assertion_make_file(const char *file, in failure_finish(NULL); return (0); } + if (0 != chmod(path, mode)) { + failure_start(file, line, "Could not chmod %s", path); + failure_finish(NULL); + return (0); + } if (contents != NULL) { ssize_t wsize; @@ -1644,6 +1678,7 @@ assertion_make_file(const char *file, in } } close(fd); + assertion_file_mode(file, line, path, mode); return (1); #endif } Modified: stable/11/contrib/libarchive/cat/test/test.h ============================================================================== --- stable/11/contrib/libarchive/cat/test/test.h Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/cat/test/test.h Wed Oct 12 10:28:22 2016 (r307138) @@ -241,6 +241,7 @@ int assertion_file_birthtime_recent(cons int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); +int assertion_file_mode(const char *, int, const char *, int); int assertion_file_mtime(const char *, int, const char *, long, long); int assertion_file_mtime_recent(const char *, int, const char *); int assertion_file_nlinks(const char *, int, const char *, int); Modified: stable/11/contrib/libarchive/cpio/test/main.c ============================================================================== --- stable/11/contrib/libarchive/cpio/test/main.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/cpio/test/main.c Wed Oct 12 10:28:22 2016 (r307138) @@ -1361,6 +1361,31 @@ assertion_file_birthtime_recent(const ch return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Verify mtime of 'pathname'. */ int assertion_file_mtime(const char *file, int line, @@ -1579,8 +1604,12 @@ assertion_make_dir(const char *file, int if (0 == _mkdir(dirname)) return (1); #else - if (0 == mkdir(dirname, mode)) - return (1); + if (0 == mkdir(dirname, mode)) { + if (0 == chmod(dirname, mode)) { + assertion_file_mode(file, line, dirname, mode); + return (1); + } + } #endif failure_start(file, line, "Could not create directory %s", dirname); failure_finish(NULL); @@ -1629,6 +1658,11 @@ assertion_make_file(const char *file, in failure_finish(NULL); return (0); } + if (0 != chmod(path, mode)) { + failure_start(file, line, "Could not chmod %s", path); + failure_finish(NULL); + return (0); + } if (contents != NULL) { ssize_t wsize; @@ -1645,6 +1679,7 @@ assertion_make_file(const char *file, in } } close(fd); + assertion_file_mode(file, line, path, mode); return (1); #endif } Modified: stable/11/contrib/libarchive/cpio/test/test.h ============================================================================== --- stable/11/contrib/libarchive/cpio/test/test.h Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/cpio/test/test.h Wed Oct 12 10:28:22 2016 (r307138) @@ -241,6 +241,7 @@ int assertion_file_birthtime_recent(cons int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); +int assertion_file_mode(const char *, int, const char *, int); int assertion_file_mtime(const char *, int, const char *, long, long); int assertion_file_mtime_recent(const char *, int, const char *); int assertion_file_nlinks(const char *, int, const char *, int); Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_7zip.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Wed Oct 12 10:28:22 2016 (r307138) @@ -2431,6 +2431,8 @@ read_Header(struct archive_read *a, stru switch (type) { case kEmptyStream: + if (h->emptyStreamBools != NULL) + return (-1); h->emptyStreamBools = calloc((size_t)zip->numFiles, sizeof(*h->emptyStreamBools)); if (h->emptyStreamBools == NULL) @@ -2451,6 +2453,8 @@ read_Header(struct archive_read *a, stru return (-1); break; } + if (h->emptyFileBools != NULL) + return (-1); h->emptyFileBools = calloc(empty_streams, sizeof(*h->emptyFileBools)); if (h->emptyFileBools == NULL) @@ -2465,6 +2469,8 @@ read_Header(struct archive_read *a, stru return (-1); break; } + if (h->antiBools != NULL) + return (-1); h->antiBools = calloc(empty_streams, sizeof(*h->antiBools)); if (h->antiBools == NULL) @@ -2491,6 +2497,8 @@ read_Header(struct archive_read *a, stru if ((ll & 1) || ll < zip->numFiles * 4) return (-1); + if (zip->entry_names != NULL) + return (-1); zip->entry_names = malloc(ll); if (zip->entry_names == NULL) return (-1); @@ -2543,6 +2551,8 @@ read_Header(struct archive_read *a, stru if ((p = header_bytes(a, 2)) == NULL) return (-1); allAreDefined = *p; + if (h->attrBools != NULL) + return (-1); h->attrBools = calloc((size_t)zip->numFiles, sizeof(*h->attrBools)); if (h->attrBools == NULL) Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_mtree.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Wed Oct 12 10:28:22 2016 (r307138) @@ -301,6 +301,15 @@ get_line_size(const char *b, ssize_t ava return (avail); } +/* + * <---------------- ravail ---------------------> + * <-- diff ------> <--- avail -----------------> + * <---- len -----------> + * | Previous lines | line being parsed nl extra | + * ^ + * b + * + */ static ssize_t next_line(struct archive_read *a, const char **b, ssize_t *avail, ssize_t *ravail, ssize_t *nl) @@ -339,7 +348,7 @@ next_line(struct archive_read *a, *b += diff; *avail -= diff; tested = len;/* Skip some bytes we already determinated. */ - len = get_line_size(*b, *avail, nl); + len = get_line_size(*b + len, *avail - len, nl); if (len >= 0) len += tested; } Modified: stable/11/contrib/libarchive/libarchive/test/main.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/main.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/libarchive/test/main.c Wed Oct 12 10:28:22 2016 (r307138) @@ -1607,8 +1607,12 @@ assertion_make_dir(const char *file, int if (0 == _mkdir(dirname)) return (1); #else - if (0 == mkdir(dirname, mode)) - return (1); + if (0 == mkdir(dirname, mode)) { + if (0 == chmod(dirname, mode)) { + assertion_file_mode(file, line, dirname, mode); + return (1); + } + } #endif failure_start(file, line, "Could not create directory %s", dirname); failure_finish(NULL); @@ -1657,6 +1661,11 @@ assertion_make_file(const char *file, in failure_finish(NULL); return (0); } + if (0 != chmod(path, mode)) { + failure_start(file, line, "Could not chmod %s", path); + failure_finish(NULL); + return (0); + } if (contents != NULL) { ssize_t wsize; @@ -1673,6 +1682,7 @@ assertion_make_file(const char *file, in } } close(fd); + assertion_file_mode(file, line, path, mode); return (1); #endif } Modified: stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c Wed Oct 12 10:28:22 2016 (r307138) @@ -93,7 +93,7 @@ static struct myacl_t acls_reg[] = { static struct myacl_t acls_dir[] = { /* For this test, we need to be able to read and write the ACL. */ - { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_ACL, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_READ_ACL, ARCHIVE_ENTRY_ACL_USER_OBJ, -1, ""}, /* An entry for each type. */ Copied: stable/11/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c (from r306670, head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c Wed Oct 12 10:28:22 2016 (r307138, copy of r306670, head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2003-2016 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" + + +/* + * Reproduce the crash reported in Github Issue #747. + */ +DEFINE_TEST(test_read_format_mtree_crash747) +{ + const char *reffile = "test_read_format_mtree_crash747.mtree.bz2"; + struct archive *a; + + extract_reference_file(reffile); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_bzip2(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_mtree(a)); + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_open_filename(a, reffile, 10240)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + Copied: stable/11/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu (from r306670, head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu Wed Oct 12 10:28:22 2016 (r307138, copy of r306670, head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu) @@ -0,0 +1,6 @@ +begin 600 test_read_format_mtree_crash747.mtree.bz2 +M0EIH.3%!62936:OH@(@``'/[@,`0`@!``'^```)A@9\`$`@@`'4)049!IIH! +MM021-0,F@&@6````9%>$(K!GIC*XFR0`$```J0+:$XP```!D-F)H[#SE9+2' +4+E"L=ASXUI%R(I"HD'ZA(5?1`Q`` +` +end Modified: stable/11/contrib/libarchive/libarchive/test/test_read_set_format.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_read_set_format.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/libarchive/test/test_read_set_format.c Wed Oct 12 10:28:22 2016 (r307138) @@ -204,7 +204,7 @@ DEFINE_TEST(test_read_append_filter_wron /* * If we have "bunzip2 -q", try using that. */ - if (!canRunCommand("bunzip2 -V")) { + if (!canRunCommand("bunzip2 -h")) { skipping("Can't run bunzip2 program on this platform"); return; } Modified: stable/11/contrib/libarchive/tar/subst.c ============================================================================== --- stable/11/contrib/libarchive/tar/subst.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/tar/subst.c Wed Oct 12 10:28:22 2016 (r307138) @@ -84,6 +84,7 @@ add_substitution(struct bsdtar *bsdtar, if (rule == NULL) lafe_errc(1, errno, "Out of memory"); rule->next = NULL; + rule->result = NULL; if (subst->last_rule == NULL) subst->first_rule = rule; Modified: stable/11/contrib/libarchive/tar/test/main.c ============================================================================== --- stable/11/contrib/libarchive/tar/test/main.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/tar/test/main.c Wed Oct 12 10:28:22 2016 (r307138) @@ -130,6 +130,13 @@ __FBSDID("$FreeBSD$"); # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1361,6 +1368,31 @@ assertion_file_birthtime_recent(const ch return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Verify mtime of 'pathname'. */ int assertion_file_mtime(const char *file, int line, @@ -1579,8 +1611,12 @@ assertion_make_dir(const char *file, int if (0 == _mkdir(dirname)) return (1); #else - if (0 == mkdir(dirname, mode)) - return (1); + if (0 == mkdir(dirname, mode)) { + if (0 == chmod(dirname, mode)) { + assertion_file_mode(file, line, dirname, mode); + return (1); + } + } #endif failure_start(file, line, "Could not create directory %s", dirname); failure_finish(NULL); @@ -1629,6 +1665,11 @@ assertion_make_file(const char *file, in failure_finish(NULL); return (0); } + if (0 != chmod(path, mode)) { + failure_start(file, line, "Could not chmod %s", path); + failure_finish(NULL); + return (0); + } if (contents != NULL) { ssize_t wsize; @@ -1645,6 +1686,7 @@ assertion_make_file(const char *file, in } } close(fd); + assertion_file_mode(file, line, path, mode); return (1); #endif } Modified: stable/11/contrib/libarchive/tar/test/test.h ============================================================================== --- stable/11/contrib/libarchive/tar/test/test.h Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/tar/test/test.h Wed Oct 12 10:28:22 2016 (r307138) @@ -241,6 +241,7 @@ int assertion_file_birthtime_recent(cons int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); +int assertion_file_mode(const char *, int, const char *, int); int assertion_file_mtime(const char *, int, const char *, long, long); int assertion_file_mtime_recent(const char *, int, const char *); int assertion_file_nlinks(const char *, int, const char *, int); @@ -326,6 +327,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; Modified: stable/11/contrib/libarchive/tar/test/test_option_H_upper.c ============================================================================== --- stable/11/contrib/libarchive/tar/test/test_option_H_upper.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/tar/test/test_option_H_upper.c Wed Oct 12 10:28:22 2016 (r307138) @@ -83,10 +83,10 @@ DEFINE_TEST(test_option_H_upper) assertChdir("test3"); assertEqualInt(0, systemf("%s -xf archive.tar >c.out 2>c.err", testprog)); - assertIsDir("ld1", 0755); + assertIsDir("ld1", umasked(0755)); assertIsSymlink("d1/linkX", "fileX"); assertIsSymlink("d1/link1", "file1"); - assertIsReg("link2", 0644); + assertIsReg("link2", umasked(0644)); assertIsSymlink("linkY", "d1/fileY"); assertChdir(".."); } Modified: stable/11/contrib/libarchive/tar/test/test_option_L_upper.c ============================================================================== --- stable/11/contrib/libarchive/tar/test/test_option_L_upper.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/tar/test/test_option_L_upper.c Wed Oct 12 10:28:22 2016 (r307138) @@ -69,10 +69,10 @@ DEFINE_TEST(test_option_L_upper) assertChdir("test2"); assertEqualInt(0, systemf("%s -xf archive.tar >c.out 2>c.err", testprog)); - assertIsDir("ld1", 0755); - assertIsReg("d1/link1", 0644); + assertIsDir("ld1", umasked(0755)); + assertIsReg("d1/link1", umasked(0644)); assertIsSymlink("d1/linkX", "fileX"); - assertIsReg("link2", 0644); + assertIsReg("link2", umasked(0644)); assertIsSymlink("linkY", "d1/fileY"); assertChdir(".."); @@ -83,10 +83,10 @@ DEFINE_TEST(test_option_L_upper) assertChdir("test3"); assertEqualInt(0, systemf("%s -xf archive.tar >c.out 2>c.err", testprog)); - assertIsDir("ld1", 0755); - assertIsReg("d1/link1", 0644); + assertIsDir("ld1", umasked(0755)); + assertIsReg("d1/link1", umasked(0644)); assertIsSymlink("d1/linkX", "fileX"); - assertIsReg("link2", 0644); + assertIsReg("link2", umasked(0644)); assertIsSymlink("linkY", "d1/fileY"); assertChdir(".."); } Modified: stable/11/contrib/libarchive/tar/test/test_option_U_upper.c ============================================================================== --- stable/11/contrib/libarchive/tar/test/test_option_U_upper.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/tar/test/test_option_U_upper.c Wed Oct 12 10:28:22 2016 (r307138) @@ -135,7 +135,7 @@ DEFINE_TEST(test_option_U_upper) assertMakeSymlink("d1/file1", "d1/realfile1"); assertEqualInt(0, systemf("%s -xf ../archive.tar d1/file1 >test.out 2>test.err", testprog)); - assertIsReg("d1/file1", 0644); + assertIsReg("d1/file1", umasked(0644)); assertFileContents("d1/file1", 8, "d1/file1"); assertFileContents("realfile1", 9, "d1/realfile1"); assertEmptyFile("test.out"); @@ -150,7 +150,7 @@ DEFINE_TEST(test_option_U_upper) assertMakeSymlink("d1/file1", "d1/realfile1"); assertEqualInt(0, systemf("%s -xPUf ../archive.tar d1/file1 >test.out 2>test.err", testprog)); - assertIsReg("d1/file1", 0644); + assertIsReg("d1/file1", umasked(0644)); assertFileContents("d1/file1", 8, "d1/file1"); assertFileContents("realfile1", 9, "d1/realfile1"); assertEmptyFile("test.out"); Modified: stable/11/contrib/libarchive/tar/test/test_option_n.c ============================================================================== --- stable/11/contrib/libarchive/tar/test/test_option_n.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/tar/test/test_option_n.c Wed Oct 12 10:28:22 2016 (r307138) @@ -55,7 +55,7 @@ DEFINE_TEST(test_option_n) systemf("%s -xf archive.tar >x.out 2>x.err", testprog)); assertEmptyFile("x.out"); assertEmptyFile("x.err"); - assertIsDir("d1", 0755); + assertIsDir("d1", umasked(0755)); assertFileNotExists("d1/file1"); assertChdir(".."); } Modified: stable/11/contrib/libarchive/tar/write.c ============================================================================== --- stable/11/contrib/libarchive/tar/write.c Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/contrib/libarchive/tar/write.c Wed Oct 12 10:28:22 2016 (r307138) @@ -886,6 +886,8 @@ write_hierarchy(struct bsdtar *bsdtar, s "%s", archive_error_string(disk)); if (r == ARCHIVE_FATAL || r == ARCHIVE_FAILED) { bsdtar->return_value = 1; + archive_entry_free(entry); + archive_read_close(disk); return; } else if (r < ARCHIVE_WARN) continue; Modified: stable/11/lib/libarchive/tests/Makefile ============================================================================== --- stable/11/lib/libarchive/tests/Makefile Wed Oct 12 09:27:39 2016 (r307137) +++ stable/11/lib/libarchive/tests/Makefile Wed Oct 12 10:28:22 2016 (r307138) @@ -149,6 +149,7 @@ TESTS_SRCS= \ test_read_format_lha_bugfix_0.c \ test_read_format_lha_filename.c \ test_read_format_mtree.c \ + test_read_format_mtree_crash747.c \ test_read_format_pax_bz2.c \ test_read_format_rar.c \ test_read_format_rar_encryption_data.c \ @@ -464,6 +465,7 @@ ${PACKAGE}FILES+= test_read_format_lha_l ${PACKAGE}FILES+= test_read_format_lha_lh7.lzh.uu ${PACKAGE}FILES+= test_read_format_lha_withjunk.lzh.uu ${PACKAGE}FILES+= test_read_format_mtree.mtree.uu +${PACKAGE}FILES+= test_read_format_mtree_crash747.mtree.bz2.uu ${PACKAGE}FILES+= test_read_format_mtree_nomagic.mtree.uu ${PACKAGE}FILES+= test_read_format_mtree_nomagic2.mtree.uu ${PACKAGE}FILES+= test_read_format_mtree_nomagic3.mtree.uu From owner-svn-src-stable-11@freebsd.org Wed Oct 12 11:48:16 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CA3CC0EDF8; Wed, 12 Oct 2016 11:48:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2141229; Wed, 12 Oct 2016 11:48:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9CBmErf064448; Wed, 12 Oct 2016 11:48:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9CBmEpo064447; Wed, 12 Oct 2016 11:48:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201610121148.u9CBmEpo064447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 12 Oct 2016 11:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307142 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 11:48:16 -0000 Author: avg Date: Wed Oct 12 11:48:14 2016 New Revision: 307142 URL: https://svnweb.freebsd.org/changeset/base/307142 Log: MFC r306665: zfs: fix a wrong assertion for extended attributes PR: 213112 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Oct 12 11:17:10 2016 (r307141) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Oct 12 11:48:14 2016 (r307142) @@ -1454,7 +1454,8 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *v ASSERT_VOP_LOCKED(dvp, __func__); #ifdef DIAGNOSTIC - ASSERT(!RRM_LOCK_HELD(&zfsvfs->z_teardown_lock)); + if ((zdp->z_pflags & ZFS_XATTR) == 0) + VERIFY(!RRM_LOCK_HELD(&zfsvfs->z_teardown_lock)); #endif if (name[0] == 0 || (name[0] == '.' && name[1] == 0)) { @@ -5973,13 +5974,15 @@ zfs_lock(ap) vp = ap->a_vp; flags = ap->a_flags; if ((flags & LK_INTERLOCK) == 0 && (flags & LK_NOWAIT) == 0 && - (vp->v_iflag & VI_DOOMED) == 0 && (zp = vp->v_data) != NULL) { + (vp->v_iflag & VI_DOOMED) == 0 && (zp = vp->v_data) != NULL && + (zp->z_pflags & ZFS_XATTR) == 0) { zfsvfs = zp->z_zfsvfs; VERIFY(!RRM_LOCK_HELD(&zfsvfs->z_teardown_lock)); } err = vop_stdlock(ap); if ((flags & LK_INTERLOCK) != 0 && (flags & LK_NOWAIT) == 0 && - (vp->v_iflag & VI_DOOMED) == 0 && (zp = vp->v_data) != NULL) { + (vp->v_iflag & VI_DOOMED) == 0 && (zp = vp->v_data) != NULL && + (zp->z_pflags & ZFS_XATTR) == 0) { zfsvfs = zp->z_zfsvfs; VERIFY(!RRM_LOCK_HELD(&zfsvfs->z_teardown_lock)); } From owner-svn-src-stable-11@freebsd.org Wed Oct 12 12:17:44 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA546C0D0B5; Wed, 12 Oct 2016 12:17:44 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E1A0D8C; Wed, 12 Oct 2016 12:17:44 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9CCHhvr075618; Wed, 12 Oct 2016 12:17:43 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9CCHgdP075603; Wed, 12 Oct 2016 12:17:42 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201610121217.u9CCHgdP075603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 12 Oct 2016 12:17:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307144 - in stable/11: share/man/man4 sys/amd64/cloudabi32 sys/amd64/cloudabi64 sys/amd64/conf sys/arm/cloudabi32 sys/arm64/cloudabi64 sys/compat/cloudabi sys/compat/cloudabi32 sys/com... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 12:17:44 -0000 Author: ed Date: Wed Oct 12 12:17:41 2016 New Revision: 307144 URL: https://svnweb.freebsd.org/changeset/base/307144 Log: MFC r303818, r303833, r303941, r304478, r304481, r304483, r304484, r304554, r304555, r304556, r304557, r304558, r304559, r304561, r304563, r304564, r304565, r304615, r304742, r304743, r304744, r304745, r304748, r304886, r304991, r305928, r305938, r305987, r306185: Bring CloudABI support back in sync with HEAD. - Add support for running 32-bit executables on amd64, armv6 and i386. - As these new architectures require the use of the vDSO, merge back vDSO support for 64-bit executables running on amd64 and arm64 as well. This has the advantage that support for vDSO-less execution can be phased out when 11.0 becomes unsupported, as opposed to 11.x. This change has been tested by running the cloudlibc unit tests on all supported architectures, which seems to work fine. Added: stable/11/sys/amd64/cloudabi32/ - copied from r304744, head/sys/amd64/cloudabi32/ stable/11/sys/arm/cloudabi32/ - copied from r305928, head/sys/arm/cloudabi32/ stable/11/sys/compat/cloudabi/cloudabi_vdso.c - copied unchanged from r303941, head/sys/compat/cloudabi/cloudabi_vdso.c stable/11/sys/compat/cloudabi/cloudabi_vdso.lds - copied unchanged from r304557, head/sys/compat/cloudabi/cloudabi_vdso.lds stable/11/sys/compat/cloudabi32/ - copied from r304564, head/sys/compat/cloudabi32/ stable/11/sys/compat/cloudabi32/cloudabi32_proto.h - copied unchanged from r304565, head/sys/compat/cloudabi32/cloudabi32_proto.h stable/11/sys/compat/cloudabi32/cloudabi32_syscall.h - copied unchanged from r304565, head/sys/compat/cloudabi32/cloudabi32_syscall.h stable/11/sys/compat/cloudabi32/cloudabi32_syscalls.c - copied unchanged from r304565, head/sys/compat/cloudabi32/cloudabi32_syscalls.c stable/11/sys/compat/cloudabi32/cloudabi32_sysent.c - copied unchanged from r304565, head/sys/compat/cloudabi32/cloudabi32_sysent.c stable/11/sys/compat/cloudabi32/cloudabi32_systrace_args.c - copied unchanged from r304565, head/sys/compat/cloudabi32/cloudabi32_systrace_args.c stable/11/sys/contrib/cloudabi/cloudabi32_types.h - copied unchanged from r304561, head/sys/contrib/cloudabi/cloudabi32_types.h stable/11/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S - copied unchanged from r304554, head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S stable/11/sys/contrib/cloudabi/cloudabi_vdso_armv6.S - copied, changed from r305928, head/sys/contrib/cloudabi/cloudabi_vdso_armv6.S stable/11/sys/contrib/cloudabi/cloudabi_vdso_i686.S - copied, changed from r304615, head/sys/contrib/cloudabi/cloudabi_vdso_i686.S stable/11/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S - copied unchanged from r304744, head/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S stable/11/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S - copied unchanged from r304554, head/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S stable/11/sys/contrib/cloudabi/syscalls32.master - copied, changed from r304561, head/sys/contrib/cloudabi/syscalls32.master - copied unchanged from r304478, head/sys/contrib/cloudabi/syscalls64.master stable/11/sys/i386/cloudabi32/ - copied from r304615, head/sys/i386/cloudabi32/ stable/11/sys/modules/cloudabi32/ - copied from r304745, head/sys/modules/cloudabi32/ Directory Properties: stable/11/sys/contrib/cloudabi/syscalls64.master (props changed) Deleted: stable/11/sys/contrib/cloudabi/syscalls.master Modified: stable/11/share/man/man4/cloudabi.4 stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c stable/11/sys/amd64/conf/NOTES stable/11/sys/arm64/cloudabi64/cloudabi64_sysvec.c stable/11/sys/compat/cloudabi/cloudabi_clock.c stable/11/sys/compat/cloudabi/cloudabi_thread.c stable/11/sys/compat/cloudabi/cloudabi_util.h stable/11/sys/compat/cloudabi64/Makefile stable/11/sys/compat/cloudabi64/cloudabi64_fd.c stable/11/sys/compat/cloudabi64/cloudabi64_module.c stable/11/sys/compat/cloudabi64/cloudabi64_poll.c stable/11/sys/compat/cloudabi64/cloudabi64_proto.h stable/11/sys/compat/cloudabi64/cloudabi64_sock.c stable/11/sys/compat/cloudabi64/cloudabi64_syscall.h stable/11/sys/compat/cloudabi64/cloudabi64_syscalls.c stable/11/sys/compat/cloudabi64/cloudabi64_sysent.c stable/11/sys/compat/cloudabi64/cloudabi64_systrace_args.c stable/11/sys/compat/cloudabi64/cloudabi64_util.h stable/11/sys/conf/files stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.arm stable/11/sys/conf/files.arm64 stable/11/sys/conf/files.i386 stable/11/sys/conf/options stable/11/sys/contrib/cloudabi/cloudabi64_types.h stable/11/sys/contrib/cloudabi/cloudabi_types_common.h stable/11/sys/i386/cloudabi32/cloudabi32_sysvec.c stable/11/sys/i386/conf/NOTES stable/11/sys/modules/Makefile stable/11/sys/modules/cloudabi/Makefile stable/11/sys/modules/cloudabi32/Makefile stable/11/sys/modules/cloudabi64/Makefile stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/cloudabi.4 ============================================================================== --- stable/11/share/man/man4/cloudabi.4 Wed Oct 12 11:48:47 2016 (r307143) +++ stable/11/share/man/man4/cloudabi.4 Wed Oct 12 12:17:41 2016 (r307144) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2015 Nuxi, https://nuxi.nl/ +.\" Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/ .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -22,17 +22,25 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd October 22, 2015 +.Dd September 22, 2016 .Dt CLOUDABI 4 .Os .Sh NAME .Nm cloudabi , +.Nm cloudabi32 , .Nm cloudabi64 .Nd CloudABI support .Sh SYNOPSIS -Support for 64-bit CloudABI executables can be compiled into the kernel +Support for 32-bit CloudABI executables can be compiled into the kernel by adding this line to the kernel configuration file: .Bd -ragged -offset indent +.Cd "options COMPAT_CLOUDABI32" +.Ed +.Pp +Similarly, +support for 64-bit CloudABI executables can be enabled by adding this +line: +.Bd -ragged -offset indent .Cd "options COMPAT_CLOUDABI64" .Ed .Pp @@ -40,6 +48,7 @@ CloudABI support can also be loaded at b .Xr loader.conf 5 : .Bd -literal -offset indent cloudabi_load="YES" +cloudabi32_load="YES" cloudabi64_load="YES" .Ed .Sh DESCRIPTION @@ -52,19 +61,21 @@ and hardened against security exploits. .Pp Support for CloudABI on .Fx -consists of two separate kernel modules. +consists of three separate kernel modules. The .Nm cloudabi kernel module implements all of the system calls that do not depend on -data structures that differ between architectures. +data structures that differ between hardware architectures. .Pp The +.Nm cloudabi32 +and .Nm cloudabi64 -kernel module provides implementations of all of the machine-dependent -system calls. -It assumes that pointers stored in data structures provided as system -call arguments are 64 bits in size. -It also provides the image activator that loads and starts 64-bit ELF +kernel modules provide implementations of all of the machine-dependent +system calls, +assuming that pointers stored in data structures are either 32 bits or +64 bits in size. +These modules also provide the image activators that load and start ELF executables. .Pp Though the @@ -72,8 +83,12 @@ Though the module can be loaded on any architecture supported by .Fx , the +.Nm cloudabi32 +module is only available on amd64, armv6 and i386. +The same holds for the .Nm cloudabi64 -module is only available for amd64 and arm64. +module, +which is only available for amd64 and arm64. .Pp A full cross compilation toolchain for CloudABI is available in the .Pa devel/cloudabi-toolchain @@ -93,6 +108,9 @@ restricted set of resources. .Xr linux 4 , .Xr elf 5 .Pp +CloudABI for FreeBSD: +.Pa https://nuxi.nl/cloudabi/freebsd/ . +.Pp cloudlibc on GitHub: .Pa https://github.com/NuxiNL/cloudlibc . .Pp Modified: stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c Wed Oct 12 11:48:47 2016 (r307143) +++ stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c Wed Oct 12 12:17:41 2016 (r307144) @@ -171,9 +171,9 @@ cloudabi64_thread_setregs(struct thread return (error); /* Perform standard register initialization. */ - stack.ss_sp = (void *)attr->stack; + stack.ss_sp = TO_PTR(attr->stack); stack.ss_size = tcbptr - attr->stack; - cpu_set_upcall(td, (void *)attr->entry_point, NULL, &stack); + cpu_set_upcall(td, TO_PTR(attr->entry_point), NULL, &stack); /* * Pass in the thread ID of the new thread and the argument @@ -196,7 +196,6 @@ static struct sysentvec cloudabi64_elf_s .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, - .sv_usrstack = USRSTACK, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_strings = cloudabi64_copyout_strings, .sv_setregs = cloudabi64_proc_setregs, Modified: stable/11/sys/amd64/conf/NOTES ============================================================================== --- stable/11/sys/amd64/conf/NOTES Wed Oct 12 11:48:47 2016 (r307143) +++ stable/11/sys/amd64/conf/NOTES Wed Oct 12 12:17:41 2016 (r307144) @@ -618,6 +618,9 @@ options COMPAT_FREEBSD32 # Emulate spx device for client side of SVR3 local X interface #XXX#options SPX_HACK +# Enable 32-bit runtime support for CloudABI binaries. +options COMPAT_CLOUDABI32 + # Enable 64-bit runtime support for CloudABI binaries. options COMPAT_CLOUDABI64 Modified: stable/11/sys/arm64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- stable/11/sys/arm64/cloudabi64/cloudabi64_sysvec.c Wed Oct 12 11:48:47 2016 (r307143) +++ stable/11/sys/arm64/cloudabi64/cloudabi64_sysvec.c Wed Oct 12 12:17:41 2016 (r307144) @@ -139,9 +139,9 @@ cloudabi64_thread_setregs(struct thread stack_t stack; /* Perform standard register initialization. */ - stack.ss_sp = (void *)attr->stack; + stack.ss_sp = TO_PTR(attr->stack); stack.ss_size = attr->stack_size; - cpu_set_upcall(td, (void *)attr->entry_point, NULL, &stack); + cpu_set_upcall(td, TO_PTR(attr->entry_point), NULL, &stack); /* * Pass in the thread ID of the new thread and the argument @@ -165,7 +165,6 @@ static struct sysentvec cloudabi64_elf_s .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, - .sv_usrstack = USRSTACK, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_strings = cloudabi64_copyout_strings, .sv_setregs = cloudabi64_proc_setregs, Modified: stable/11/sys/compat/cloudabi/cloudabi_clock.c ============================================================================== --- stable/11/sys/compat/cloudabi/cloudabi_clock.c Wed Oct 12 11:48:47 2016 (r307143) +++ stable/11/sys/compat/cloudabi/cloudabi_clock.c Wed Oct 12 12:17:41 2016 (r307144) @@ -117,7 +117,7 @@ cloudabi_sys_clock_res_get(struct thread error = cloudabi_convert_timespec(&ts, &cts); if (error != 0) return (error); - td->td_retval[0] = cts; + memcpy(td->td_retval, &cts, sizeof(cts)); return (0); } @@ -129,6 +129,6 @@ cloudabi_sys_clock_time_get(struct threa int error; error = cloudabi_clock_time_get(td, uap->clock_id, &ts); - td->td_retval[0] = ts; + memcpy(td->td_retval, &ts, sizeof(ts)); return (error); } Modified: stable/11/sys/compat/cloudabi/cloudabi_thread.c ============================================================================== --- stable/11/sys/compat/cloudabi/cloudabi_thread.c Wed Oct 12 11:48:47 2016 (r307143) +++ stable/11/sys/compat/cloudabi/cloudabi_thread.c Wed Oct 12 12:17:41 2016 (r307144) @@ -60,14 +60,6 @@ cloudabi_sys_thread_exit(struct thread * } int -cloudabi_sys_thread_tcb_set(struct thread *td, - struct cloudabi_sys_thread_tcb_set_args *uap) -{ - - return (cpu_set_user_tls(td, uap->tcb)); -} - -int cloudabi_sys_thread_yield(struct thread *td, struct cloudabi_sys_thread_yield_args *uap) { Modified: stable/11/sys/compat/cloudabi/cloudabi_util.h ============================================================================== --- stable/11/sys/compat/cloudabi/cloudabi_util.h Wed Oct 12 11:48:47 2016 (r307143) +++ stable/11/sys/compat/cloudabi/cloudabi_util.h Wed Oct 12 12:17:41 2016 (r307144) @@ -33,6 +33,7 @@ #include struct file; +struct sysentvec; struct thread; struct timespec; @@ -76,4 +77,8 @@ int cloudabi_futex_lock_wrlock(struct th cloudabi_scope_t, cloudabi_clockid_t, cloudabi_timestamp_t, cloudabi_timestamp_t); +/* vDSO setup and teardown. */ +void cloudabi_vdso_init(struct sysentvec *, char *, char *); +void cloudabi_vdso_destroy(struct sysentvec *); + #endif Copied: stable/11/sys/compat/cloudabi/cloudabi_vdso.c (from r303941, head/sys/compat/cloudabi/cloudabi_vdso.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/cloudabi/cloudabi_vdso.c Wed Oct 12 12:17:41 2016 (r307144, copy of r303941, head/sys/compat/cloudabi/cloudabi_vdso.c) @@ -0,0 +1,88 @@ +/*- + * Copyright (c) 2016 Nuxi, https://nuxi.nl/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +void +cloudabi_vdso_init(struct sysentvec *sv, char *begin, char *end) +{ + vm_page_t m; + vm_object_t obj; + vm_offset_t addr; + size_t i, pages, pages_length, vdso_length; + + /* Determine the number of pages needed to store the vDSO. */ + vdso_length = end - begin; + pages = howmany(vdso_length, PAGE_SIZE); + pages_length = pages * PAGE_SIZE; + + /* Allocate a VM object and fill it with the vDSO. */ + obj = vm_pager_allocate(OBJT_PHYS, 0, pages_length, + VM_PROT_DEFAULT, 0, NULL); + addr = kva_alloc(PAGE_SIZE); + for (i = 0; i < pages; ++i) { + VM_OBJECT_WLOCK(obj); + m = vm_page_grab(obj, i, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO); + m->valid = VM_PAGE_BITS_ALL; + VM_OBJECT_WUNLOCK(obj); + + pmap_qenter(addr, &m, 1); + memcpy((void *)addr, begin + i * PAGE_SIZE, + MIN(vdso_length - i * PAGE_SIZE, PAGE_SIZE)); + pmap_qremove(addr, 1); + } + kva_free(addr, PAGE_SIZE); + + /* + * Place the vDSO at the top of the address space. The user + * stack can start right below it. + */ + sv->sv_shared_page_base = sv->sv_maxuser - pages_length; + sv->sv_shared_page_len = pages_length; + sv->sv_shared_page_obj = obj; + sv->sv_usrstack = sv->sv_shared_page_base; +} + +void +cloudabi_vdso_destroy(struct sysentvec *sv) +{ + + vm_object_deallocate(sv->sv_shared_page_obj); +} Copied: stable/11/sys/compat/cloudabi/cloudabi_vdso.lds (from r304557, head/sys/compat/cloudabi/cloudabi_vdso.lds) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/cloudabi/cloudabi_vdso.lds Wed Oct 12 12:17:41 2016 (r307144, copy of r304557, head/sys/compat/cloudabi/cloudabi_vdso.lds) @@ -0,0 +1,51 @@ +/* + * Linker script for the vDSO for CloudABI. + * Based on sys/amd64/linux/linux_vdso.lds.s + * + * $FreeBSD$ + */ + +SECTIONS +{ + . = . + SIZEOF_HEADERS; + + .hash : { *(.hash) } :text + .gnu.hash : { *(.gnu.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + + .note : { *(.note.*) } :text :note + + .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr + .eh_frame : { KEEP (*(.eh_frame)) } :text + + .dynamic : { *(.dynamic) } :text :dynamic + + .rodata : { *(.rodata*) } :text + .data : { + *(.data*) + *(.sdata*) + *(.got.plt) *(.got) + *(.gnu.linkonce.d.*) + *(.bss*) + *(.dynbss*) + *(.gnu.linkonce.b.*) + } + + .altinstructions : { *(.altinstructions) } + .altinstr_replacement : { *(.altinstr_replacement) } + + . = ALIGN(0x100); + .text : { *(.test .text*) } :text =0x90909090 +} + +PHDRS +{ + text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */ + dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ + note PT_NOTE FLAGS(4); /* PF_R */ + eh_frame_hdr PT_GNU_EH_FRAME; +} Copied: stable/11/sys/compat/cloudabi32/cloudabi32_proto.h (from r304565, head/sys/compat/cloudabi32/cloudabi32_proto.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/cloudabi32/cloudabi32_proto.h Wed Oct 12 12:17:41 2016 (r307144, copy of r304565, head/sys/compat/cloudabi32/cloudabi32_proto.h) @@ -0,0 +1,465 @@ +/* + * System call prototypes. + * + * DO NOT EDIT-- this file is automatically generated. + * $FreeBSD$ + * created from FreeBSD: head/sys/contrib/cloudabi/syscalls32.master 304563 2016-08-21 15:56:19Z ed + */ + +#ifndef _CLOUDABI32_SYSPROTO_H_ +#define _CLOUDABI32_SYSPROTO_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include + +struct proc; + +struct thread; + +#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ + 0 : sizeof(register_t) - sizeof(t)) + +#if BYTE_ORDER == LITTLE_ENDIAN +#define PADL_(t) 0 +#define PADR_(t) PAD_(t) +#else +#define PADL_(t) PAD_(t) +#define PADR_(t) 0 +#endif + +struct cloudabi_sys_clock_res_get_args { + char clock_id_l_[PADL_(cloudabi_clockid_t)]; cloudabi_clockid_t clock_id; char clock_id_r_[PADR_(cloudabi_clockid_t)]; +}; +struct cloudabi_sys_clock_time_get_args { + char clock_id_l_[PADL_(cloudabi_clockid_t)]; cloudabi_clockid_t clock_id; char clock_id_r_[PADR_(cloudabi_clockid_t)]; + char precision_l_[PADL_(cloudabi_timestamp_t)]; cloudabi_timestamp_t precision; char precision_r_[PADR_(cloudabi_timestamp_t)]; +}; +struct cloudabi_sys_condvar_signal_args { + char condvar_l_[PADL_(cloudabi_condvar_t *)]; cloudabi_condvar_t * condvar; char condvar_r_[PADR_(cloudabi_condvar_t *)]; + char scope_l_[PADL_(cloudabi_scope_t)]; cloudabi_scope_t scope; char scope_r_[PADR_(cloudabi_scope_t)]; + char nwaiters_l_[PADL_(cloudabi_nthreads_t)]; cloudabi_nthreads_t nwaiters; char nwaiters_r_[PADR_(cloudabi_nthreads_t)]; +}; +struct cloudabi_sys_fd_close_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; +}; +struct cloudabi_sys_fd_create1_args { + char type_l_[PADL_(cloudabi_filetype_t)]; cloudabi_filetype_t type; char type_r_[PADR_(cloudabi_filetype_t)]; +}; +struct cloudabi_sys_fd_create2_args { + char type_l_[PADL_(cloudabi_filetype_t)]; cloudabi_filetype_t type; char type_r_[PADR_(cloudabi_filetype_t)]; +}; +struct cloudabi_sys_fd_datasync_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; +}; +struct cloudabi_sys_fd_dup_args { + char from_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t from; char from_r_[PADR_(cloudabi_fd_t)]; +}; +struct cloudabi32_sys_fd_pread_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char iov_l_[PADL_(const cloudabi32_iovec_t *)]; const cloudabi32_iovec_t * iov; char iov_r_[PADR_(const cloudabi32_iovec_t *)]; + char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)]; + char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; char offset_r_[PADR_(cloudabi_filesize_t)]; +}; +struct cloudabi32_sys_fd_pwrite_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char iov_l_[PADL_(const cloudabi32_ciovec_t *)]; const cloudabi32_ciovec_t * iov; char iov_r_[PADR_(const cloudabi32_ciovec_t *)]; + char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)]; + char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; char offset_r_[PADR_(cloudabi_filesize_t)]; +}; +struct cloudabi32_sys_fd_read_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char iov_l_[PADL_(const cloudabi32_iovec_t *)]; const cloudabi32_iovec_t * iov; char iov_r_[PADR_(const cloudabi32_iovec_t *)]; + char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_fd_replace_args { + char from_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t from; char from_r_[PADR_(cloudabi_fd_t)]; + char to_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t to; char to_r_[PADR_(cloudabi_fd_t)]; +}; +struct cloudabi_sys_fd_seek_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char offset_l_[PADL_(cloudabi_filedelta_t)]; cloudabi_filedelta_t offset; char offset_r_[PADR_(cloudabi_filedelta_t)]; + char whence_l_[PADL_(cloudabi_whence_t)]; cloudabi_whence_t whence; char whence_r_[PADR_(cloudabi_whence_t)]; +}; +struct cloudabi_sys_fd_stat_get_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char buf_l_[PADL_(cloudabi_fdstat_t *)]; cloudabi_fdstat_t * buf; char buf_r_[PADR_(cloudabi_fdstat_t *)]; +}; +struct cloudabi_sys_fd_stat_put_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char buf_l_[PADL_(const cloudabi_fdstat_t *)]; const cloudabi_fdstat_t * buf; char buf_r_[PADR_(const cloudabi_fdstat_t *)]; + char flags_l_[PADL_(cloudabi_fdsflags_t)]; cloudabi_fdsflags_t flags; char flags_r_[PADR_(cloudabi_fdsflags_t)]; +}; +struct cloudabi_sys_fd_sync_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; +}; +struct cloudabi32_sys_fd_write_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char iov_l_[PADL_(const cloudabi32_ciovec_t *)]; const cloudabi32_ciovec_t * iov; char iov_r_[PADR_(const cloudabi32_ciovec_t *)]; + char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_file_advise_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; char offset_r_[PADR_(cloudabi_filesize_t)]; + char len_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t len; char len_r_[PADR_(cloudabi_filesize_t)]; + char advice_l_[PADL_(cloudabi_advice_t)]; cloudabi_advice_t advice; char advice_r_[PADR_(cloudabi_advice_t)]; +}; +struct cloudabi_sys_file_allocate_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; char offset_r_[PADR_(cloudabi_filesize_t)]; + char len_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t len; char len_r_[PADR_(cloudabi_filesize_t)]; +}; +struct cloudabi_sys_file_create_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; + char type_l_[PADL_(cloudabi_filetype_t)]; cloudabi_filetype_t type; char type_r_[PADR_(cloudabi_filetype_t)]; +}; +struct cloudabi_sys_file_link_args { + char fd1_l_[PADL_(cloudabi_lookup_t)]; cloudabi_lookup_t fd1; char fd1_r_[PADR_(cloudabi_lookup_t)]; + char path1_l_[PADL_(const char *)]; const char * path1; char path1_r_[PADR_(const char *)]; + char path1len_l_[PADL_(size_t)]; size_t path1len; char path1len_r_[PADR_(size_t)]; + char fd2_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd2; char fd2_r_[PADR_(cloudabi_fd_t)]; + char path2_l_[PADL_(const char *)]; const char * path2; char path2_r_[PADR_(const char *)]; + char path2len_l_[PADL_(size_t)]; size_t path2len; char path2len_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_file_open_args { + char dirfd_l_[PADL_(cloudabi_lookup_t)]; cloudabi_lookup_t dirfd; char dirfd_r_[PADR_(cloudabi_lookup_t)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; + char oflags_l_[PADL_(cloudabi_oflags_t)]; cloudabi_oflags_t oflags; char oflags_r_[PADR_(cloudabi_oflags_t)]; + char fds_l_[PADL_(const cloudabi_fdstat_t *)]; const cloudabi_fdstat_t * fds; char fds_r_[PADR_(const cloudabi_fdstat_t *)]; +}; +struct cloudabi_sys_file_readdir_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; + char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; + char cookie_l_[PADL_(cloudabi_dircookie_t)]; cloudabi_dircookie_t cookie; char cookie_r_[PADR_(cloudabi_dircookie_t)]; +}; +struct cloudabi_sys_file_readlink_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; + char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)]; + char bufsize_l_[PADL_(size_t)]; size_t bufsize; char bufsize_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_file_rename_args { + char oldfd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t oldfd; char oldfd_r_[PADR_(cloudabi_fd_t)]; + char old_l_[PADL_(const char *)]; const char * old; char old_r_[PADR_(const char *)]; + char oldlen_l_[PADL_(size_t)]; size_t oldlen; char oldlen_r_[PADR_(size_t)]; + char newfd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t newfd; char newfd_r_[PADR_(cloudabi_fd_t)]; + char new_l_[PADL_(const char *)]; const char * new; char new_r_[PADR_(const char *)]; + char newlen_l_[PADL_(size_t)]; size_t newlen; char newlen_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_file_stat_fget_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char buf_l_[PADL_(cloudabi_filestat_t *)]; cloudabi_filestat_t * buf; char buf_r_[PADR_(cloudabi_filestat_t *)]; +}; +struct cloudabi_sys_file_stat_fput_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char buf_l_[PADL_(const cloudabi_filestat_t *)]; const cloudabi_filestat_t * buf; char buf_r_[PADR_(const cloudabi_filestat_t *)]; + char flags_l_[PADL_(cloudabi_fsflags_t)]; cloudabi_fsflags_t flags; char flags_r_[PADR_(cloudabi_fsflags_t)]; +}; +struct cloudabi_sys_file_stat_get_args { + char fd_l_[PADL_(cloudabi_lookup_t)]; cloudabi_lookup_t fd; char fd_r_[PADR_(cloudabi_lookup_t)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; + char buf_l_[PADL_(cloudabi_filestat_t *)]; cloudabi_filestat_t * buf; char buf_r_[PADR_(cloudabi_filestat_t *)]; +}; +struct cloudabi_sys_file_stat_put_args { + char fd_l_[PADL_(cloudabi_lookup_t)]; cloudabi_lookup_t fd; char fd_r_[PADR_(cloudabi_lookup_t)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; + char buf_l_[PADL_(const cloudabi_filestat_t *)]; const cloudabi_filestat_t * buf; char buf_r_[PADR_(const cloudabi_filestat_t *)]; + char flags_l_[PADL_(cloudabi_fsflags_t)]; cloudabi_fsflags_t flags; char flags_r_[PADR_(cloudabi_fsflags_t)]; +}; +struct cloudabi_sys_file_symlink_args { + char path1_l_[PADL_(const char *)]; const char * path1; char path1_r_[PADR_(const char *)]; + char path1len_l_[PADL_(size_t)]; size_t path1len; char path1len_r_[PADR_(size_t)]; + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char path2_l_[PADL_(const char *)]; const char * path2; char path2_r_[PADR_(const char *)]; + char path2len_l_[PADL_(size_t)]; size_t path2len; char path2len_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_file_unlink_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; + char flags_l_[PADL_(cloudabi_ulflags_t)]; cloudabi_ulflags_t flags; char flags_r_[PADR_(cloudabi_ulflags_t)]; +}; +struct cloudabi_sys_lock_unlock_args { + char lock_l_[PADL_(cloudabi_lock_t *)]; cloudabi_lock_t * lock; char lock_r_[PADR_(cloudabi_lock_t *)]; + char scope_l_[PADL_(cloudabi_scope_t)]; cloudabi_scope_t scope; char scope_r_[PADR_(cloudabi_scope_t)]; +}; +struct cloudabi_sys_mem_advise_args { + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char advice_l_[PADL_(cloudabi_advice_t)]; cloudabi_advice_t advice; char advice_r_[PADR_(cloudabi_advice_t)]; +}; +struct cloudabi_sys_mem_lock_args { + char addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_mem_map_args { + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char prot_l_[PADL_(cloudabi_mprot_t)]; cloudabi_mprot_t prot; char prot_r_[PADR_(cloudabi_mprot_t)]; + char flags_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t flags; char flags_r_[PADR_(cloudabi_mflags_t)]; + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char off_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t off; char off_r_[PADR_(cloudabi_filesize_t)]; +}; +struct cloudabi_sys_mem_protect_args { + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char prot_l_[PADL_(cloudabi_mprot_t)]; cloudabi_mprot_t prot; char prot_r_[PADR_(cloudabi_mprot_t)]; +}; +struct cloudabi_sys_mem_sync_args { + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char flags_l_[PADL_(cloudabi_msflags_t)]; cloudabi_msflags_t flags; char flags_r_[PADR_(cloudabi_msflags_t)]; +}; +struct cloudabi_sys_mem_unlock_args { + char addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_mem_unmap_args { + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; +}; +struct cloudabi32_sys_poll_args { + char in_l_[PADL_(const cloudabi32_subscription_t *)]; const cloudabi32_subscription_t * in; char in_r_[PADR_(const cloudabi32_subscription_t *)]; + char out_l_[PADL_(cloudabi32_event_t *)]; cloudabi32_event_t * out; char out_r_[PADR_(cloudabi32_event_t *)]; + char nsubscriptions_l_[PADL_(size_t)]; size_t nsubscriptions; char nsubscriptions_r_[PADR_(size_t)]; +}; +struct cloudabi32_sys_poll_fd_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char in_l_[PADL_(const cloudabi32_subscription_t *)]; const cloudabi32_subscription_t * in; char in_r_[PADR_(const cloudabi32_subscription_t *)]; + char nin_l_[PADL_(size_t)]; size_t nin; char nin_r_[PADR_(size_t)]; + char out_l_[PADL_(cloudabi32_event_t *)]; cloudabi32_event_t * out; char out_r_[PADR_(cloudabi32_event_t *)]; + char nout_l_[PADL_(size_t)]; size_t nout; char nout_r_[PADR_(size_t)]; + char timeout_l_[PADL_(const cloudabi32_subscription_t *)]; const cloudabi32_subscription_t * timeout; char timeout_r_[PADR_(const cloudabi32_subscription_t *)]; +}; +struct cloudabi_sys_proc_exec_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char data_l_[PADL_(const void *)]; const void * data; char data_r_[PADR_(const void *)]; + char datalen_l_[PADL_(size_t)]; size_t datalen; char datalen_r_[PADR_(size_t)]; + char fds_l_[PADL_(const cloudabi_fd_t *)]; const cloudabi_fd_t * fds; char fds_r_[PADR_(const cloudabi_fd_t *)]; + char fdslen_l_[PADL_(size_t)]; size_t fdslen; char fdslen_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_proc_exit_args { + char rval_l_[PADL_(cloudabi_exitcode_t)]; cloudabi_exitcode_t rval; char rval_r_[PADR_(cloudabi_exitcode_t)]; +}; +struct cloudabi_sys_proc_fork_args { + register_t dummy; +}; +struct cloudabi_sys_proc_raise_args { + char sig_l_[PADL_(cloudabi_signal_t)]; cloudabi_signal_t sig; char sig_r_[PADR_(cloudabi_signal_t)]; +}; +struct cloudabi_sys_random_get_args { + char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; + char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_sock_accept_args { + char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; + char buf_l_[PADL_(cloudabi_sockstat_t *)]; cloudabi_sockstat_t * buf; char buf_r_[PADR_(cloudabi_sockstat_t *)]; +}; +struct cloudabi_sys_sock_bind_args { + char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_sock_connect_args { + char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; +}; +struct cloudabi_sys_sock_listen_args { + char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; + char backlog_l_[PADL_(cloudabi_backlog_t)]; cloudabi_backlog_t backlog; char backlog_r_[PADR_(cloudabi_backlog_t)]; +}; +struct cloudabi32_sys_sock_recv_args { + char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; + char in_l_[PADL_(const cloudabi32_recv_in_t *)]; const cloudabi32_recv_in_t * in; char in_r_[PADR_(const cloudabi32_recv_in_t *)]; + char out_l_[PADL_(cloudabi32_recv_out_t *)]; cloudabi32_recv_out_t * out; char out_r_[PADR_(cloudabi32_recv_out_t *)]; +}; +struct cloudabi32_sys_sock_send_args { + char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; + char in_l_[PADL_(const cloudabi32_send_in_t *)]; const cloudabi32_send_in_t * in; char in_r_[PADR_(const cloudabi32_send_in_t *)]; + char out_l_[PADL_(cloudabi32_send_out_t *)]; cloudabi32_send_out_t * out; char out_r_[PADR_(cloudabi32_send_out_t *)]; +}; +struct cloudabi_sys_sock_shutdown_args { + char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; + char how_l_[PADL_(cloudabi_sdflags_t)]; cloudabi_sdflags_t how; char how_r_[PADR_(cloudabi_sdflags_t)]; +}; +struct cloudabi_sys_sock_stat_get_args { + char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; + char buf_l_[PADL_(cloudabi_sockstat_t *)]; cloudabi_sockstat_t * buf; char buf_r_[PADR_(cloudabi_sockstat_t *)]; + char flags_l_[PADL_(cloudabi_ssflags_t)]; cloudabi_ssflags_t flags; char flags_r_[PADR_(cloudabi_ssflags_t)]; +}; +struct cloudabi32_sys_thread_create_args { + char attr_l_[PADL_(cloudabi32_threadattr_t *)]; cloudabi32_threadattr_t * attr; char attr_r_[PADR_(cloudabi32_threadattr_t *)]; +}; +struct cloudabi_sys_thread_exit_args { + char lock_l_[PADL_(cloudabi_lock_t *)]; cloudabi_lock_t * lock; char lock_r_[PADR_(cloudabi_lock_t *)]; + char scope_l_[PADL_(cloudabi_scope_t)]; cloudabi_scope_t scope; char scope_r_[PADR_(cloudabi_scope_t)]; +}; +struct cloudabi_sys_thread_yield_args { + register_t dummy; +}; +int cloudabi_sys_clock_res_get(struct thread *, struct cloudabi_sys_clock_res_get_args *); +int cloudabi_sys_clock_time_get(struct thread *, struct cloudabi_sys_clock_time_get_args *); +int cloudabi_sys_condvar_signal(struct thread *, struct cloudabi_sys_condvar_signal_args *); +int cloudabi_sys_fd_close(struct thread *, struct cloudabi_sys_fd_close_args *); +int cloudabi_sys_fd_create1(struct thread *, struct cloudabi_sys_fd_create1_args *); +int cloudabi_sys_fd_create2(struct thread *, struct cloudabi_sys_fd_create2_args *); +int cloudabi_sys_fd_datasync(struct thread *, struct cloudabi_sys_fd_datasync_args *); +int cloudabi_sys_fd_dup(struct thread *, struct cloudabi_sys_fd_dup_args *); +int cloudabi32_sys_fd_pread(struct thread *, struct cloudabi32_sys_fd_pread_args *); +int cloudabi32_sys_fd_pwrite(struct thread *, struct cloudabi32_sys_fd_pwrite_args *); +int cloudabi32_sys_fd_read(struct thread *, struct cloudabi32_sys_fd_read_args *); +int cloudabi_sys_fd_replace(struct thread *, struct cloudabi_sys_fd_replace_args *); +int cloudabi_sys_fd_seek(struct thread *, struct cloudabi_sys_fd_seek_args *); +int cloudabi_sys_fd_stat_get(struct thread *, struct cloudabi_sys_fd_stat_get_args *); +int cloudabi_sys_fd_stat_put(struct thread *, struct cloudabi_sys_fd_stat_put_args *); +int cloudabi_sys_fd_sync(struct thread *, struct cloudabi_sys_fd_sync_args *); +int cloudabi32_sys_fd_write(struct thread *, struct cloudabi32_sys_fd_write_args *); +int cloudabi_sys_file_advise(struct thread *, struct cloudabi_sys_file_advise_args *); +int cloudabi_sys_file_allocate(struct thread *, struct cloudabi_sys_file_allocate_args *); +int cloudabi_sys_file_create(struct thread *, struct cloudabi_sys_file_create_args *); +int cloudabi_sys_file_link(struct thread *, struct cloudabi_sys_file_link_args *); +int cloudabi_sys_file_open(struct thread *, struct cloudabi_sys_file_open_args *); +int cloudabi_sys_file_readdir(struct thread *, struct cloudabi_sys_file_readdir_args *); +int cloudabi_sys_file_readlink(struct thread *, struct cloudabi_sys_file_readlink_args *); +int cloudabi_sys_file_rename(struct thread *, struct cloudabi_sys_file_rename_args *); +int cloudabi_sys_file_stat_fget(struct thread *, struct cloudabi_sys_file_stat_fget_args *); +int cloudabi_sys_file_stat_fput(struct thread *, struct cloudabi_sys_file_stat_fput_args *); +int cloudabi_sys_file_stat_get(struct thread *, struct cloudabi_sys_file_stat_get_args *); +int cloudabi_sys_file_stat_put(struct thread *, struct cloudabi_sys_file_stat_put_args *); +int cloudabi_sys_file_symlink(struct thread *, struct cloudabi_sys_file_symlink_args *); +int cloudabi_sys_file_unlink(struct thread *, struct cloudabi_sys_file_unlink_args *); +int cloudabi_sys_lock_unlock(struct thread *, struct cloudabi_sys_lock_unlock_args *); +int cloudabi_sys_mem_advise(struct thread *, struct cloudabi_sys_mem_advise_args *); +int cloudabi_sys_mem_lock(struct thread *, struct cloudabi_sys_mem_lock_args *); +int cloudabi_sys_mem_map(struct thread *, struct cloudabi_sys_mem_map_args *); +int cloudabi_sys_mem_protect(struct thread *, struct cloudabi_sys_mem_protect_args *); +int cloudabi_sys_mem_sync(struct thread *, struct cloudabi_sys_mem_sync_args *); +int cloudabi_sys_mem_unlock(struct thread *, struct cloudabi_sys_mem_unlock_args *); +int cloudabi_sys_mem_unmap(struct thread *, struct cloudabi_sys_mem_unmap_args *); +int cloudabi32_sys_poll(struct thread *, struct cloudabi32_sys_poll_args *); +int cloudabi32_sys_poll_fd(struct thread *, struct cloudabi32_sys_poll_fd_args *); +int cloudabi_sys_proc_exec(struct thread *, struct cloudabi_sys_proc_exec_args *); +int cloudabi_sys_proc_exit(struct thread *, struct cloudabi_sys_proc_exit_args *); +int cloudabi_sys_proc_fork(struct thread *, struct cloudabi_sys_proc_fork_args *); +int cloudabi_sys_proc_raise(struct thread *, struct cloudabi_sys_proc_raise_args *); +int cloudabi_sys_random_get(struct thread *, struct cloudabi_sys_random_get_args *); +int cloudabi_sys_sock_accept(struct thread *, struct cloudabi_sys_sock_accept_args *); +int cloudabi_sys_sock_bind(struct thread *, struct cloudabi_sys_sock_bind_args *); +int cloudabi_sys_sock_connect(struct thread *, struct cloudabi_sys_sock_connect_args *); +int cloudabi_sys_sock_listen(struct thread *, struct cloudabi_sys_sock_listen_args *); +int cloudabi32_sys_sock_recv(struct thread *, struct cloudabi32_sys_sock_recv_args *); +int cloudabi32_sys_sock_send(struct thread *, struct cloudabi32_sys_sock_send_args *); +int cloudabi_sys_sock_shutdown(struct thread *, struct cloudabi_sys_sock_shutdown_args *); +int cloudabi_sys_sock_stat_get(struct thread *, struct cloudabi_sys_sock_stat_get_args *); +int cloudabi32_sys_thread_create(struct thread *, struct cloudabi32_sys_thread_create_args *); +int cloudabi_sys_thread_exit(struct thread *, struct cloudabi_sys_thread_exit_args *); +int cloudabi_sys_thread_yield(struct thread *, struct cloudabi_sys_thread_yield_args *); + +#ifdef COMPAT_43 + + +#endif /* COMPAT_43 */ + + +#ifdef COMPAT_FREEBSD4 + + +#endif /* COMPAT_FREEBSD4 */ + + +#ifdef COMPAT_FREEBSD6 + + +#endif /* COMPAT_FREEBSD6 */ + + +#ifdef COMPAT_FREEBSD7 + + +#endif /* COMPAT_FREEBSD7 */ + + +#ifdef COMPAT_FREEBSD10 + + +#endif /* COMPAT_FREEBSD10 */ + +#define CLOUDABI32_SYS_AUE_cloudabi_sys_clock_res_get AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_clock_time_get AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_condvar_signal AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_fd_close AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_fd_create1 AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_fd_create2 AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_fd_datasync AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_fd_dup AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi32_sys_fd_pread AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi32_sys_fd_pwrite AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi32_sys_fd_read AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_fd_replace AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_fd_seek AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_fd_stat_get AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_fd_stat_put AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_fd_sync AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi32_sys_fd_write AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_advise AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_allocate AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_create AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_link AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_open AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_readdir AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_readlink AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_rename AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_stat_fget AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_stat_fput AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_stat_get AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_stat_put AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_symlink AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_file_unlink AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_lock_unlock AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_advise AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_lock AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_map AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_protect AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_sync AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_unlock AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_mem_unmap AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi32_sys_poll AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi32_sys_poll_fd AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_proc_exec AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_proc_exit AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_proc_fork AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_proc_raise AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_random_get AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_accept AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_bind AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_connect AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_listen AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi32_sys_sock_recv AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi32_sys_sock_send AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_shutdown AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_stat_get AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi32_sys_thread_create AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_thread_exit AUE_NULL +#define CLOUDABI32_SYS_AUE_cloudabi_sys_thread_yield AUE_NULL + +#undef PAD_ +#undef PADL_ +#undef PADR_ + +#endif /* !_CLOUDABI32_SYSPROTO_H_ */ Copied: stable/11/sys/compat/cloudabi32/cloudabi32_syscall.h (from r304565, head/sys/compat/cloudabi32/cloudabi32_syscall.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/cloudabi32/cloudabi32_syscall.h Wed Oct 12 12:17:41 2016 (r307144, copy of r304565, head/sys/compat/cloudabi32/cloudabi32_syscall.h) @@ -0,0 +1,66 @@ +/* + * System call numbers. + * + * DO NOT EDIT-- this file is automatically generated. + * $FreeBSD$ + * created from FreeBSD: head/sys/contrib/cloudabi/syscalls32.master 304563 2016-08-21 15:56:19Z ed + */ + +#define CLOUDABI32_SYS_cloudabi_sys_clock_res_get 0 +#define CLOUDABI32_SYS_cloudabi_sys_clock_time_get 1 +#define CLOUDABI32_SYS_cloudabi_sys_condvar_signal 2 +#define CLOUDABI32_SYS_cloudabi_sys_fd_close 3 +#define CLOUDABI32_SYS_cloudabi_sys_fd_create1 4 +#define CLOUDABI32_SYS_cloudabi_sys_fd_create2 5 +#define CLOUDABI32_SYS_cloudabi_sys_fd_datasync 6 +#define CLOUDABI32_SYS_cloudabi_sys_fd_dup 7 +#define CLOUDABI32_SYS_cloudabi32_sys_fd_pread 8 +#define CLOUDABI32_SYS_cloudabi32_sys_fd_pwrite 9 +#define CLOUDABI32_SYS_cloudabi32_sys_fd_read 10 +#define CLOUDABI32_SYS_cloudabi_sys_fd_replace 11 +#define CLOUDABI32_SYS_cloudabi_sys_fd_seek 12 +#define CLOUDABI32_SYS_cloudabi_sys_fd_stat_get 13 +#define CLOUDABI32_SYS_cloudabi_sys_fd_stat_put 14 +#define CLOUDABI32_SYS_cloudabi_sys_fd_sync 15 +#define CLOUDABI32_SYS_cloudabi32_sys_fd_write 16 +#define CLOUDABI32_SYS_cloudabi_sys_file_advise 17 +#define CLOUDABI32_SYS_cloudabi_sys_file_allocate 18 +#define CLOUDABI32_SYS_cloudabi_sys_file_create 19 +#define CLOUDABI32_SYS_cloudabi_sys_file_link 20 +#define CLOUDABI32_SYS_cloudabi_sys_file_open 21 +#define CLOUDABI32_SYS_cloudabi_sys_file_readdir 22 +#define CLOUDABI32_SYS_cloudabi_sys_file_readlink 23 +#define CLOUDABI32_SYS_cloudabi_sys_file_rename 24 +#define CLOUDABI32_SYS_cloudabi_sys_file_stat_fget 25 +#define CLOUDABI32_SYS_cloudabi_sys_file_stat_fput 26 +#define CLOUDABI32_SYS_cloudabi_sys_file_stat_get 27 +#define CLOUDABI32_SYS_cloudabi_sys_file_stat_put 28 +#define CLOUDABI32_SYS_cloudabi_sys_file_symlink 29 +#define CLOUDABI32_SYS_cloudabi_sys_file_unlink 30 +#define CLOUDABI32_SYS_cloudabi_sys_lock_unlock 31 +#define CLOUDABI32_SYS_cloudabi_sys_mem_advise 32 +#define CLOUDABI32_SYS_cloudabi_sys_mem_lock 33 +#define CLOUDABI32_SYS_cloudabi_sys_mem_map 34 +#define CLOUDABI32_SYS_cloudabi_sys_mem_protect 35 +#define CLOUDABI32_SYS_cloudabi_sys_mem_sync 36 +#define CLOUDABI32_SYS_cloudabi_sys_mem_unlock 37 +#define CLOUDABI32_SYS_cloudabi_sys_mem_unmap 38 +#define CLOUDABI32_SYS_cloudabi32_sys_poll 39 +#define CLOUDABI32_SYS_cloudabi32_sys_poll_fd 40 +#define CLOUDABI32_SYS_cloudabi_sys_proc_exec 41 +#define CLOUDABI32_SYS_cloudabi_sys_proc_exit 42 +#define CLOUDABI32_SYS_cloudabi_sys_proc_fork 43 +#define CLOUDABI32_SYS_cloudabi_sys_proc_raise 44 +#define CLOUDABI32_SYS_cloudabi_sys_random_get 45 +#define CLOUDABI32_SYS_cloudabi_sys_sock_accept 46 +#define CLOUDABI32_SYS_cloudabi_sys_sock_bind 47 +#define CLOUDABI32_SYS_cloudabi_sys_sock_connect 48 +#define CLOUDABI32_SYS_cloudabi_sys_sock_listen 49 +#define CLOUDABI32_SYS_cloudabi32_sys_sock_recv 50 +#define CLOUDABI32_SYS_cloudabi32_sys_sock_send 51 +#define CLOUDABI32_SYS_cloudabi_sys_sock_shutdown 52 +#define CLOUDABI32_SYS_cloudabi_sys_sock_stat_get 53 +#define CLOUDABI32_SYS_cloudabi32_sys_thread_create 54 +#define CLOUDABI32_SYS_cloudabi_sys_thread_exit 55 +#define CLOUDABI32_SYS_cloudabi_sys_thread_yield 56 +#define CLOUDABI32_SYS_MAXSYSCALL 57 Copied: stable/11/sys/compat/cloudabi32/cloudabi32_syscalls.c (from r304565, head/sys/compat/cloudabi32/cloudabi32_syscalls.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/cloudabi32/cloudabi32_syscalls.c Wed Oct 12 12:17:41 2016 (r307144, copy of r304565, head/sys/compat/cloudabi32/cloudabi32_syscalls.c) @@ -0,0 +1,67 @@ +/* + * System call names. + * + * DO NOT EDIT-- this file is automatically generated. + * $FreeBSD$ + * created from FreeBSD: head/sys/contrib/cloudabi/syscalls32.master 304563 2016-08-21 15:56:19Z ed + */ + +const char *cloudabi32_syscallnames[] = { + "cloudabi_sys_clock_res_get", /* 0 = cloudabi_sys_clock_res_get */ + "cloudabi_sys_clock_time_get", /* 1 = cloudabi_sys_clock_time_get */ + "cloudabi_sys_condvar_signal", /* 2 = cloudabi_sys_condvar_signal */ + "cloudabi_sys_fd_close", /* 3 = cloudabi_sys_fd_close */ + "cloudabi_sys_fd_create1", /* 4 = cloudabi_sys_fd_create1 */ + "cloudabi_sys_fd_create2", /* 5 = cloudabi_sys_fd_create2 */ + "cloudabi_sys_fd_datasync", /* 6 = cloudabi_sys_fd_datasync */ + "cloudabi_sys_fd_dup", /* 7 = cloudabi_sys_fd_dup */ + "cloudabi32_sys_fd_pread", /* 8 = cloudabi32_sys_fd_pread */ + "cloudabi32_sys_fd_pwrite", /* 9 = cloudabi32_sys_fd_pwrite */ + "cloudabi32_sys_fd_read", /* 10 = cloudabi32_sys_fd_read */ + "cloudabi_sys_fd_replace", /* 11 = cloudabi_sys_fd_replace */ + "cloudabi_sys_fd_seek", /* 12 = cloudabi_sys_fd_seek */ + "cloudabi_sys_fd_stat_get", /* 13 = cloudabi_sys_fd_stat_get */ + "cloudabi_sys_fd_stat_put", /* 14 = cloudabi_sys_fd_stat_put */ + "cloudabi_sys_fd_sync", /* 15 = cloudabi_sys_fd_sync */ + "cloudabi32_sys_fd_write", /* 16 = cloudabi32_sys_fd_write */ + "cloudabi_sys_file_advise", /* 17 = cloudabi_sys_file_advise */ + "cloudabi_sys_file_allocate", /* 18 = cloudabi_sys_file_allocate */ + "cloudabi_sys_file_create", /* 19 = cloudabi_sys_file_create */ + "cloudabi_sys_file_link", /* 20 = cloudabi_sys_file_link */ + "cloudabi_sys_file_open", /* 21 = cloudabi_sys_file_open */ + "cloudabi_sys_file_readdir", /* 22 = cloudabi_sys_file_readdir */ + "cloudabi_sys_file_readlink", /* 23 = cloudabi_sys_file_readlink */ + "cloudabi_sys_file_rename", /* 24 = cloudabi_sys_file_rename */ + "cloudabi_sys_file_stat_fget", /* 25 = cloudabi_sys_file_stat_fget */ + "cloudabi_sys_file_stat_fput", /* 26 = cloudabi_sys_file_stat_fput */ + "cloudabi_sys_file_stat_get", /* 27 = cloudabi_sys_file_stat_get */ + "cloudabi_sys_file_stat_put", /* 28 = cloudabi_sys_file_stat_put */ + "cloudabi_sys_file_symlink", /* 29 = cloudabi_sys_file_symlink */ + "cloudabi_sys_file_unlink", /* 30 = cloudabi_sys_file_unlink */ + "cloudabi_sys_lock_unlock", /* 31 = cloudabi_sys_lock_unlock */ + "cloudabi_sys_mem_advise", /* 32 = cloudabi_sys_mem_advise */ + "cloudabi_sys_mem_lock", /* 33 = cloudabi_sys_mem_lock */ + "cloudabi_sys_mem_map", /* 34 = cloudabi_sys_mem_map */ + "cloudabi_sys_mem_protect", /* 35 = cloudabi_sys_mem_protect */ + "cloudabi_sys_mem_sync", /* 36 = cloudabi_sys_mem_sync */ + "cloudabi_sys_mem_unlock", /* 37 = cloudabi_sys_mem_unlock */ + "cloudabi_sys_mem_unmap", /* 38 = cloudabi_sys_mem_unmap */ + "cloudabi32_sys_poll", /* 39 = cloudabi32_sys_poll */ + "cloudabi32_sys_poll_fd", /* 40 = cloudabi32_sys_poll_fd */ + "cloudabi_sys_proc_exec", /* 41 = cloudabi_sys_proc_exec */ + "cloudabi_sys_proc_exit", /* 42 = cloudabi_sys_proc_exit */ + "cloudabi_sys_proc_fork", /* 43 = cloudabi_sys_proc_fork */ + "cloudabi_sys_proc_raise", /* 44 = cloudabi_sys_proc_raise */ + "cloudabi_sys_random_get", /* 45 = cloudabi_sys_random_get */ + "cloudabi_sys_sock_accept", /* 46 = cloudabi_sys_sock_accept */ + "cloudabi_sys_sock_bind", /* 47 = cloudabi_sys_sock_bind */ + "cloudabi_sys_sock_connect", /* 48 = cloudabi_sys_sock_connect */ + "cloudabi_sys_sock_listen", /* 49 = cloudabi_sys_sock_listen */ + "cloudabi32_sys_sock_recv", /* 50 = cloudabi32_sys_sock_recv */ + "cloudabi32_sys_sock_send", /* 51 = cloudabi32_sys_sock_send */ + "cloudabi_sys_sock_shutdown", /* 52 = cloudabi_sys_sock_shutdown */ + "cloudabi_sys_sock_stat_get", /* 53 = cloudabi_sys_sock_stat_get */ + "cloudabi32_sys_thread_create", /* 54 = cloudabi32_sys_thread_create */ + "cloudabi_sys_thread_exit", /* 55 = cloudabi_sys_thread_exit */ + "cloudabi_sys_thread_yield", /* 56 = cloudabi_sys_thread_yield */ +}; Copied: stable/11/sys/compat/cloudabi32/cloudabi32_sysent.c (from r304565, head/sys/compat/cloudabi32/cloudabi32_sysent.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/cloudabi32/cloudabi32_sysent.c Wed Oct 12 12:17:41 2016 (r307144, copy of r304565, head/sys/compat/cloudabi32/cloudabi32_sysent.c) @@ -0,0 +1,75 @@ +/* + * System call switch table. + * + * DO NOT EDIT-- this file is automatically generated. + * $FreeBSD$ + * created from FreeBSD: head/sys/contrib/cloudabi/syscalls32.master 304563 2016-08-21 15:56:19Z ed + */ + +#include +#include +#include +#include + +#define AS(name) (sizeof(struct name) / sizeof(register_t)) + +/* The casts are bogus but will do for now. */ +struct sysent cloudabi32_sysent[] = { + { AS(cloudabi_sys_clock_res_get_args), (sy_call_t *)cloudabi_sys_clock_res_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 0 = cloudabi_sys_clock_res_get */ + { AS(cloudabi_sys_clock_time_get_args), (sy_call_t *)cloudabi_sys_clock_time_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 1 = cloudabi_sys_clock_time_get */ + { AS(cloudabi_sys_condvar_signal_args), (sy_call_t *)cloudabi_sys_condvar_signal, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 2 = cloudabi_sys_condvar_signal */ + { AS(cloudabi_sys_fd_close_args), (sy_call_t *)cloudabi_sys_fd_close, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 3 = cloudabi_sys_fd_close */ + { AS(cloudabi_sys_fd_create1_args), (sy_call_t *)cloudabi_sys_fd_create1, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 4 = cloudabi_sys_fd_create1 */ + { AS(cloudabi_sys_fd_create2_args), (sy_call_t *)cloudabi_sys_fd_create2, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 5 = cloudabi_sys_fd_create2 */ + { AS(cloudabi_sys_fd_datasync_args), (sy_call_t *)cloudabi_sys_fd_datasync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 6 = cloudabi_sys_fd_datasync */ + { AS(cloudabi_sys_fd_dup_args), (sy_call_t *)cloudabi_sys_fd_dup, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 7 = cloudabi_sys_fd_dup */ + { AS(cloudabi32_sys_fd_pread_args), (sy_call_t *)cloudabi32_sys_fd_pread, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 8 = cloudabi32_sys_fd_pread */ + { AS(cloudabi32_sys_fd_pwrite_args), (sy_call_t *)cloudabi32_sys_fd_pwrite, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 9 = cloudabi32_sys_fd_pwrite */ + { AS(cloudabi32_sys_fd_read_args), (sy_call_t *)cloudabi32_sys_fd_read, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 10 = cloudabi32_sys_fd_read */ + { AS(cloudabi_sys_fd_replace_args), (sy_call_t *)cloudabi_sys_fd_replace, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 11 = cloudabi_sys_fd_replace */ + { AS(cloudabi_sys_fd_seek_args), (sy_call_t *)cloudabi_sys_fd_seek, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 12 = cloudabi_sys_fd_seek */ + { AS(cloudabi_sys_fd_stat_get_args), (sy_call_t *)cloudabi_sys_fd_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 13 = cloudabi_sys_fd_stat_get */ + { AS(cloudabi_sys_fd_stat_put_args), (sy_call_t *)cloudabi_sys_fd_stat_put, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 14 = cloudabi_sys_fd_stat_put */ + { AS(cloudabi_sys_fd_sync_args), (sy_call_t *)cloudabi_sys_fd_sync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 15 = cloudabi_sys_fd_sync */ + { AS(cloudabi32_sys_fd_write_args), (sy_call_t *)cloudabi32_sys_fd_write, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 16 = cloudabi32_sys_fd_write */ + { AS(cloudabi_sys_file_advise_args), (sy_call_t *)cloudabi_sys_file_advise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 17 = cloudabi_sys_file_advise */ + { AS(cloudabi_sys_file_allocate_args), (sy_call_t *)cloudabi_sys_file_allocate, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 18 = cloudabi_sys_file_allocate */ + { AS(cloudabi_sys_file_create_args), (sy_call_t *)cloudabi_sys_file_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 19 = cloudabi_sys_file_create */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Thu Oct 13 02:32:42 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4FCEC0F791; Thu, 13 Oct 2016 02:32:42 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B14BDC6D; Thu, 13 Oct 2016 02:32:42 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9D2WfvD003687; Thu, 13 Oct 2016 02:32:41 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9D2WfTM003686; Thu, 13 Oct 2016 02:32:41 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201610130232.u9D2WfTM003686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Thu, 13 Oct 2016 02:32:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307166 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2016 02:32:43 -0000 Author: jtl Date: Thu Oct 13 02:32:41 2016 New Revision: 307166 URL: https://svnweb.freebsd.org/changeset/base/307166 Log: MFC r306766: Remove declaration of un-defined function tcp_seq_subtract(). Modified: stable/11/sys/netinet/tcp_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_var.h ============================================================================== --- stable/11/sys/netinet/tcp_var.h Thu Oct 13 02:31:32 2016 (r307165) +++ stable/11/sys/netinet/tcp_var.h Thu Oct 13 02:32:41 2016 (r307166) @@ -854,7 +854,6 @@ struct sackhole *tcp_sack_output(struct void tcp_sack_partialack(struct tcpcb *, struct tcphdr *); void tcp_free_sackholes(struct tcpcb *tp); int tcp_newreno(struct tcpcb *, struct tcphdr *); -u_long tcp_seq_subtract(u_long, u_long ); int tcp_compute_pipe(struct tcpcb *); static inline void From owner-svn-src-stable-11@freebsd.org Thu Oct 13 03:06:25 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27155C0E415; Thu, 13 Oct 2016 03:06:25 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 019111578; Thu, 13 Oct 2016 03:06:24 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9D36OOZ016142; Thu, 13 Oct 2016 03:06:24 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9D36OoK016141; Thu, 13 Oct 2016 03:06:24 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201610130306.u9D36OoK016141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Thu, 13 Oct 2016 03:06:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307171 - stable/11/contrib/blacklist/libexec X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2016 03:06:25 -0000 Author: lidl Date: Thu Oct 13 03:06:23 2016 New Revision: 307171 URL: https://svnweb.freebsd.org/changeset/base/307171 Log: MFC r306695: Make blacklist-helper commands emit a message when successful The blacklistd daemon expects to see a message on stdout, instead of just relying on the exit value from any invoked programs. Change the pf filtering to create multiple filters, attached under a the "blacklist/*" anchor point. This prevents the filtering for each port's filtering rule from overwriting the previously installed filtering rule. Check for an existing filtering rule for each port, so the installation of a given filtering rule only happens once. Reinstalling the same rule resets the counters for the pf rule, and we don't want that. Sponsored by: The FreeBSD Foundation Modified: stable/11/contrib/blacklist/libexec/blacklistd-helper Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/blacklist/libexec/blacklistd-helper ============================================================================== --- stable/11/contrib/blacklist/libexec/blacklistd-helper Thu Oct 13 03:00:56 2016 (r307170) +++ stable/11/contrib/blacklist/libexec/blacklistd-helper Thu Oct 13 03:06:23 2016 (r307171) @@ -19,8 +19,8 @@ fi if [ -z "$pf" ]; then for f in npf pf ipf; do if [ -f "/etc/$f.conf" ]; then - pf="$f" - break + pf="$f" + break fi done fi @@ -54,8 +54,8 @@ add) ipf) /sbin/ipfstat -io | /sbin/ipf -I -f - >/dev/null 2>&1 echo block in quick $proto from $addr/$mask to \ - any port=$6 head port$6 | \ - /sbin/ipf -I -f - -s >/dev/null 2>&1 + any port=$6 head port$6 | \ + /sbin/ipf -I -f - -s >/dev/null 2>&1 && echo OK ;; ipfw) # use $ipfw_offset+$port for rule number @@ -64,17 +64,21 @@ add) /sbin/ipfw table $tname create type addr 2>/dev/null /sbin/ipfw -q table $tname add "$addr/$mask" /sbin/ipfw -q add $rule drop $3 from "table("$tname")" to \ - any dst-port $6 + any dst-port $6 && echo OK ;; npf) /sbin/npfctl rule "$2" add block in final $proto from \ "$addr/$mask" to any $port ;; pf) - # insert $ip/$mask into per-protocol anchored table - /sbin/pfctl -a "$2" -t "port$6" -T add "$addr/$mask" - echo "block in quick $proto from to any $port" | \ - /sbin/pfctl -a "$2" -f - + # if the filtering rule does not exist, create it + /sbin/pfctl -a "$2/$6" -sr 2>/dev/null | \ + grep -q "" || \ + echo "block in quick $proto from to any $port" | \ + /sbin/pfctl -a "$2/$6" -f - + # insert $ip/$mask into per-protocol/port anchored table + /sbin/pfctl -a "$2/$6" -t "port$6" -T add "$addr/$mask" && \ + echo OK ;; esac ;; @@ -83,33 +87,35 @@ rem) ipf) /sbin/ipfstat -io | /sbin/ipf -I -f - >/dev/null 2>&1 echo block in quick $proto from $addr/$mask to \ - any port=$6 head port$6 | \ - /sbin/ipf -I -r -f - -s >/dev/null 2>&1 + any port=$6 head port$6 | \ + /sbin/ipf -I -r -f - -s >/dev/null 2>&1 && echo OK ;; ipfw) - /sbin/ipfw table "port$6" delete "$addr/$mask" 2>/dev/null + /sbin/ipfw table "port$6" delete "$addr/$mask" 2>/dev/null && \ + echo OK ;; npf) /sbin/npfctl rule "$2" rem-id "$7" ;; pf) - /sbin/pfctl -a "$2" -t "port$6" -T delete "$addr/$mask" + /sbin/pfctl -a "$2/$6" -t "port$6" -T delete "$addr/$mask" && \ + echo OK ;; esac ;; flush) case "$pf" in ipf) - /sbin/ipf -Z -I -Fi -s > /dev/null + /sbin/ipf -Z -I -Fi -s > /dev/null && echo OK ;; ipfw) - /sbin/ipfw table "port$6" flush 2>/dev/null + /sbin/ipfw table "port$6" flush 2>/dev/null && echo OK ;; npf) /sbin/npfctl rule "$2" flush ;; pf) - /sbin/pfctl -a "$2" -t "port$6" -T flush + /sbin/pfctl -a "$2/$6" -t "port$6" -T flush && echo OK ;; esac ;; From owner-svn-src-stable-11@freebsd.org Thu Oct 13 03:08:33 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68B96C0E4D1; Thu, 13 Oct 2016 03:08:33 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36C4F170C; Thu, 13 Oct 2016 03:08:33 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9D38WPn016269; Thu, 13 Oct 2016 03:08:32 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9D38W38016268; Thu, 13 Oct 2016 03:08:32 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201610130308.u9D38W38016268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Thu, 13 Oct 2016 03:08:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307172 - stable/11/etc/periodic/security X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2016 03:08:33 -0000 Author: lidl Date: Thu Oct 13 03:08:32 2016 New Revision: 307172 URL: https://svnweb.freebsd.org/changeset/base/307172 Log: MFC r306696: Make 502.pfdenied find blacklistd/* filter names dynamically This change is needed to make the 520.pfdenied script find the new blacklistd/* anchor points for reporting blocked traffic. Sponsored by: The FreeBSD Foundation Modified: stable/11/etc/periodic/security/520.pfdenied Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/periodic/security/520.pfdenied ============================================================================== --- stable/11/etc/periodic/security/520.pfdenied Thu Oct 13 03:06:23 2016 (r307171) +++ stable/11/etc/periodic/security/520.pfdenied Thu Oct 13 03:08:32 2016 (r307172) @@ -44,8 +44,7 @@ rc=0 if check_yesno_period security_status_pfdenied_enable then TMP=`mktemp -t security` - touch ${TMP} - for _a in "" blacklistd + for _a in "" $(pfctl -a "blacklistd" -sA 2>/dev/null) do pfctl -a ${_a} -sr -v -z 2>/dev/null | \ nawk '{if (/^block/) {buf=$0; getline; gsub(" +"," ",$0); if ($5 > 0) print buf$0;} }' >> ${TMP} From owner-svn-src-stable-11@freebsd.org Thu Oct 13 03:10:05 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87217C0E586; Thu, 13 Oct 2016 03:10:05 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40802189F; Thu, 13 Oct 2016 03:10:05 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9D3A46J016401; Thu, 13 Oct 2016 03:10:04 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9D3A4jd016400; Thu, 13 Oct 2016 03:10:04 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201610130310.u9D3A4jd016400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Thu, 13 Oct 2016 03:10:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307173 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2016 03:10:05 -0000 Author: lidl Date: Thu Oct 13 03:10:04 2016 New Revision: 307173 URL: https://svnweb.freebsd.org/changeset/base/307173 Log: MFC r306458: Properly preserve ip_tos bits for IPv4 packets Restructure code slightly to save ip_tos bits earlier. Fix the bug where the ip_tos field is zeroed out before assigning to the iptos variable. Restore the ip_tos and ip_ver fields only if they have been zeroed during the pseudo-header checksum calculation. Modified: stable/11/sys/netinet/tcp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Thu Oct 13 03:08:32 2016 (r307172) +++ stable/11/sys/netinet/tcp_input.c Thu Oct 13 03:10:04 2016 (r307173) @@ -601,7 +601,7 @@ tcp_input(struct mbuf **mp, int *offp, i #ifdef TCP_SIGNATURE uint8_t sig_checked = 0; #endif - uint8_t iptos = 0; + uint8_t iptos; struct m_tag *fwd_tag = NULL; #ifdef INET6 struct ip6_hdr *ip6 = NULL; @@ -673,6 +673,7 @@ tcp_input(struct mbuf **mp, int *offp, i /* XXX stat */ goto drop; } + iptos = (ntohl(ip6->ip6_flow) >> 20) & 0xff; } #endif #if defined(INET) && defined(INET6) @@ -699,6 +700,7 @@ tcp_input(struct mbuf **mp, int *offp, i th = (struct tcphdr *)((caddr_t)ip + off0); tlen = ntohs(ip->ip_len) - off0; + iptos = ip->ip_tos; if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) th->th_sum = m->m_pkthdr.csum_data; @@ -719,29 +721,20 @@ tcp_input(struct mbuf **mp, int *offp, i ipov->ih_len = htons(tlen); th->th_sum = in_cksum(m, len); /* Reset length for SDT probes. */ - ip->ip_len = htons(tlen + off0); + ip->ip_len = htons(len); + /* Reset TOS bits */ + ip->ip_tos = iptos; + /* Re-initialization for later version check */ + ip->ip_v = IPVERSION; } if (th->th_sum) { TCPSTAT_INC(tcps_rcvbadsum); goto drop; } - /* Re-initialization for later version check */ - ip->ip_v = IPVERSION; } #endif /* INET */ -#ifdef INET6 - if (isipv6) - iptos = (ntohl(ip6->ip6_flow) >> 20) & 0xff; -#endif -#if defined(INET) && defined(INET6) - else -#endif -#ifdef INET - iptos = ip->ip_tos; -#endif - /* * Check that TCP offset makes sense, * pull out TCP options and adjust length. XXX From owner-svn-src-stable-11@freebsd.org Fri Oct 14 01:38:30 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AC3DC106DE; Fri, 14 Oct 2016 01:38:30 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EEA91B2; Fri, 14 Oct 2016 01:38:30 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E1cTx7030090; Fri, 14 Oct 2016 01:38:29 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E1cTR5030089; Fri, 14 Oct 2016 01:38:29 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201610140138.u9E1cTR5030089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Fri, 14 Oct 2016 01:38:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307242 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 01:38:30 -0000 Author: hiren Date: Fri Oct 14 01:38:29 2016 New Revision: 307242 URL: https://svnweb.freebsd.org/changeset/base/307242 Log: MFC r306464 This adds a sysctl which allows you to disable the TCP hostcache. This is handy during testing of network related changes where cached entries may pollute your results, or during known congestion events where you don't want to unfairly penalize hosts. Prior to r232346 this would have meant you would break any connection with a sub 1500 MTU, as the hostcache was authoritative. All entries as they stand today should simply be used to pre populate values for efficiency. Modified: stable/11/sys/netinet/tcp_hostcache.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_hostcache.c ============================================================================== --- stable/11/sys/netinet/tcp_hostcache.c Fri Oct 14 01:23:21 2016 (r307241) +++ stable/11/sys/netinet/tcp_hostcache.c Fri Oct 14 01:38:29 2016 (r307242) @@ -124,6 +124,12 @@ static void tcp_hc_purge(void *); static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, hostcache, CTLFLAG_RW, 0, "TCP Host cache"); +VNET_DEFINE(int, tcp_use_hostcache) = 1; +#define V_tcp_use_hostcache VNET(tcp_use_hostcache) +SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, enable, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_use_hostcache), 0, + "Enable the TCP hostcache"); + SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, cachelimit, CTLFLAG_VNET | CTLFLAG_RDTUN, &VNET_NAME(tcp_hostcache.cache_limit), 0, "Overall entry limit for hostcache"); @@ -276,6 +282,9 @@ tcp_hc_lookup(struct in_conninfo *inc) struct hc_head *hc_head; struct hc_metrics *hc_entry; + if (!V_tcp_use_hostcache) + return NULL; + KASSERT(inc != NULL, ("tcp_hc_lookup with NULL in_conninfo pointer")); /* @@ -332,6 +341,9 @@ tcp_hc_insert(struct in_conninfo *inc) struct hc_head *hc_head; struct hc_metrics *hc_entry; + if (!V_tcp_use_hostcache) + return NULL; + KASSERT(inc != NULL, ("tcp_hc_insert with NULL in_conninfo pointer")); /* @@ -421,6 +433,9 @@ tcp_hc_get(struct in_conninfo *inc, stru { struct hc_metrics *hc_entry; + if (!V_tcp_use_hostcache) + return; + /* * Find the right bucket. */ @@ -452,7 +467,7 @@ tcp_hc_get(struct in_conninfo *inc, stru /* * External function: look up an entry in the hostcache and return the - * discovered path MTU. Returns NULL if no entry is found or value is not + * discovered path MTU. Returns 0 if no entry is found or value is not * set. */ u_long @@ -461,6 +476,9 @@ tcp_hc_getmtu(struct in_conninfo *inc) struct hc_metrics *hc_entry; u_long mtu; + if (!V_tcp_use_hostcache) + return 0; + hc_entry = tcp_hc_lookup(inc); if (hc_entry == NULL) { return 0; @@ -482,6 +500,9 @@ tcp_hc_updatemtu(struct in_conninfo *inc { struct hc_metrics *hc_entry; + if (!V_tcp_use_hostcache) + return; + /* * Find the right bucket. */ @@ -521,6 +542,9 @@ tcp_hc_update(struct in_conninfo *inc, s { struct hc_metrics *hc_entry; + if (!V_tcp_use_hostcache) + return; + hc_entry = tcp_hc_lookup(inc); if (hc_entry == NULL) { hc_entry = tcp_hc_insert(inc); From owner-svn-src-stable-11@freebsd.org Fri Oct 14 06:56:08 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29114C11D05; Fri, 14 Oct 2016 06:56:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF4ADE20; Fri, 14 Oct 2016 06:56:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E6u67R052662; Fri, 14 Oct 2016 06:56:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E6u6eM052660; Fri, 14 Oct 2016 06:56:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140656.u9E6u6eM052660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 06:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307264 - stable/11/sys/cam X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 06:56:08 -0000 Author: mav Date: Fri Oct 14 06:56:06 2016 New Revision: 307264 URL: https://svnweb.freebsd.org/changeset/base/307264 Log: MFC r306747, r307042: Fix ABI compat shims, broken by adding NVMe support. Modified: stable/11/sys/cam/cam_compat.c stable/11/sys/cam/cam_compat.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_compat.c ============================================================================== --- stable/11/sys/cam/cam_compat.c Fri Oct 14 05:47:59 2016 (r307263) +++ stable/11/sys/cam/cam_compat.c Fri Oct 14 06:56:06 2016 (r307264) @@ -149,7 +149,24 @@ cam_compat_handle_0x17(struct cdev *dev, ccbb = (uint8_t *)&hdr[1]; ccbb17 = (uint8_t *)&hdr17[1]; - bcopy(ccbb17, ccbb, CAM_0X17_DATA_LEN); + if (ccb->ccb_h.func_code == XPT_SET_TRAN_SETTINGS) { + struct ccb_trans_settings *cts; + struct ccb_trans_settings_0x17 *cts17; + + cts = &ccb->cts; + cts17 = (struct ccb_trans_settings_0x17 *)hdr17; + cts->type = cts17->type; + cts->protocol = cts17->protocol; + cts->protocol_version = cts17->protocol_version; + cts->transport = cts17->transport; + cts->transport_version = cts17->transport_version; + bcopy(&cts17->proto_specific, &cts->proto_specific, + sizeof(cts17->proto_specific)); + bcopy(&cts17->xport_specific, &cts->xport_specific, + sizeof(cts17->xport_specific)); + } else { + bcopy(ccbb17, ccbb, CAM_0X17_DATA_LEN); + } error = (cbfnp)(dev, cmd, (caddr_t)ccb, flag, td); @@ -205,6 +222,21 @@ cam_compat_handle_0x17(struct cdev *dev, cpi17->hba_device = cpi->hba_device; cpi17->hba_subvendor = cpi->hba_subvendor; cpi17->hba_subdevice = cpi->hba_subdevice; + } else if (ccb->ccb_h.func_code == XPT_GET_TRAN_SETTINGS) { + struct ccb_trans_settings *cts; + struct ccb_trans_settings_0x17 *cts17; + + cts = &ccb->cts; + cts17 = (struct ccb_trans_settings_0x17 *)hdr17; + cts17->type = cts->type; + cts17->protocol = cts->protocol; + cts17->protocol_version = cts->protocol_version; + cts17->transport = cts->transport; + cts17->transport_version = cts->transport_version; + bcopy(&cts->proto_specific, &cts17->proto_specific, + sizeof(cts17->proto_specific)); + bcopy(&cts->xport_specific, &cts17->xport_specific, + sizeof(cts17->xport_specific)); } else if (ccb->ccb_h.func_code == XPT_DEV_MATCH) { /* Copy the rest of the header over */ bcopy(ccbb, ccbb17, CAM_0X17_DATA_LEN); @@ -257,7 +289,24 @@ cam_compat_handle_0x18(struct cdev *dev, ccbb = (uint8_t *)&hdr[1]; ccbb18 = (uint8_t *)&hdr18[1]; - bcopy(ccbb18, ccbb, CAM_0X18_DATA_LEN); + if (ccb->ccb_h.func_code == XPT_SET_TRAN_SETTINGS) { + struct ccb_trans_settings *cts; + struct ccb_trans_settings_0x18 *cts18; + + cts = &ccb->cts; + cts18 = (struct ccb_trans_settings_0x18 *)hdr18; + cts->type = cts18->type; + cts->protocol = cts18->protocol; + cts->protocol_version = cts18->protocol_version; + cts->transport = cts18->transport; + cts->transport_version = cts18->transport_version; + bcopy(&cts18->proto_specific, &cts->proto_specific, + sizeof(cts18->proto_specific)); + bcopy(&cts18->xport_specific, &cts->xport_specific, + sizeof(cts18->xport_specific)); + } else { + bcopy(ccbb18, ccbb, CAM_0X18_DATA_LEN); + } error = (cbfnp)(dev, cmd, (caddr_t)ccb, flag, td); @@ -280,10 +329,27 @@ cam_compat_handle_0x18(struct cdev *dev, hdr18->sim_priv = hdr->sim_priv; hdr18->timeout = hdr->timeout; - bcopy(ccbb, ccbb18, CAM_0X18_DATA_LEN); - - if (ccb->ccb_h.func_code == XPT_DEV_MATCH) + if (ccb->ccb_h.func_code == XPT_GET_TRAN_SETTINGS) { + struct ccb_trans_settings *cts; + struct ccb_trans_settings_0x18 *cts18; + + cts = &ccb->cts; + cts18 = (struct ccb_trans_settings_0x18 *)hdr18; + cts18->type = cts->type; + cts18->protocol = cts->protocol; + cts18->protocol_version = cts->protocol_version; + cts18->transport = cts->transport; + cts18->transport_version = cts->transport_version; + bcopy(&cts->proto_specific, &cts18->proto_specific, + sizeof(cts18->proto_specific)); + bcopy(&cts->xport_specific, &cts18->xport_specific, + sizeof(cts18->xport_specific)); + } else if (ccb->ccb_h.func_code == XPT_DEV_MATCH) { + bcopy(ccbb, ccbb18, CAM_0X18_DATA_LEN); cam_compat_translate_dev_match_0x18(ccb); + } else { + bcopy(ccbb, ccbb18, CAM_0X18_DATA_LEN); + } xpt_free_ccb(ccb); Modified: stable/11/sys/cam/cam_compat.h ============================================================================== --- stable/11/sys/cam/cam_compat.h Fri Oct 14 05:47:59 2016 (r307263) +++ stable/11/sys/cam/cam_compat.h Fri Oct 14 06:56:06 2016 (r307264) @@ -43,8 +43,8 @@ int cam_compat_ioctl(struct cdev *dev, u #define CAM_VERSION_0x16 0x16 /* The size of the union ccb didn't change when going to 0x17 */ -#define CAMIOCOMMAND_0x16 _IOWR(CAM_VERSION_0x16, 2, union ccb) -#define CAMGETPASSTHRU_0x16 _IOWR(CAM_VERSION_0x16, 3, union ccb) +#define CAMIOCOMMAND_0x16 _IOC(IOC_INOUT, CAM_VERSION_0x16, 2, CAM_0X17_LEN) +#define CAMGETPASSTHRU_0x16 _IOC(IOC_INOUT, CAM_VERSION_0x16, 3, CAM_0X17_LEN) #define CAM_SCATTER_VALID_0x16 0x00000010 #define CAM_SG_LIST_PHYS_0x16 0x00040000 @@ -110,8 +110,30 @@ struct ccb_pathinq_0x17 { u_int16_t hba_subdevice; /* HBA subdevice ID */ }; -#define CAM_0X17_LEN (sizeof(union ccb) - sizeof(struct ccb_hdr) + sizeof(struct ccb_hdr_0x17)) -#define CAM_0X17_DATA_LEN (sizeof(union ccb) - sizeof(struct ccb_hdr_0x17)) +struct ccb_trans_settings_0x17 { + struct ccb_hdr_0x17 ccb_h; + cts_type type; /* Current or User settings */ + cam_proto protocol; + u_int protocol_version; + cam_xport transport; + u_int transport_version; + union { + u_int valid; /* Which fields to honor */ + struct ccb_trans_settings_ata ata; + struct ccb_trans_settings_scsi scsi; + } proto_specific; + union { + u_int valid; /* Which fields to honor */ + struct ccb_trans_settings_spi spi; + struct ccb_trans_settings_fc fc; + struct ccb_trans_settings_sas sas; + struct ccb_trans_settings_pata ata; + struct ccb_trans_settings_sata sata; + } xport_specific; +}; + +#define CAM_0X17_DATA_LEN CAM_0X18_DATA_LEN +#define CAM_0X17_LEN (sizeof(struct ccb_hdr_0x17) + CAM_0X17_DATA_LEN) #define CAMIOCOMMAND_0x17 _IOC(IOC_INOUT, CAM_VERSION_0x17, 2, CAM_0X17_LEN) #define CAMGETPASSTHRU_0x17 _IOC(IOC_INOUT, CAM_VERSION_0x17, 3, CAM_0X17_LEN) @@ -146,6 +168,28 @@ typedef enum { CAM_EXTLUN_VALID_0x18 = 0x00000001,/* 64bit lun field is valid */ } ccb_xflags_0x18; +struct ccb_trans_settings_0x18 { + struct ccb_hdr_0x18 ccb_h; + cts_type type; /* Current or User settings */ + cam_proto protocol; + u_int protocol_version; + cam_xport transport; + u_int transport_version; + union { + u_int valid; /* Which fields to honor */ + struct ccb_trans_settings_ata ata; + struct ccb_trans_settings_scsi scsi; + } proto_specific; + union { + u_int valid; /* Which fields to honor */ + struct ccb_trans_settings_spi spi; + struct ccb_trans_settings_fc fc; + struct ccb_trans_settings_sas sas; + struct ccb_trans_settings_pata ata; + struct ccb_trans_settings_sata sata; + } xport_specific; +}; + struct dev_match_result_0x18 { dev_match_type type; union { @@ -169,8 +213,8 @@ struct dev_match_result_0x18 { } result; }; -#define CAM_0X18_LEN (sizeof(union ccb) - sizeof(struct ccb_hdr) + sizeof(struct ccb_hdr_0x18)) -#define CAM_0X18_DATA_LEN (sizeof(union ccb) - sizeof(struct ccb_hdr_0x18)) +#define CAM_0X18_DATA_LEN (sizeof(union ccb) - 2*sizeof(void *) - sizeof(struct ccb_hdr)) +#define CAM_0X18_LEN (sizeof(struct ccb_hdr_0x18) + CAM_0X18_DATA_LEN) #define CAMIOCOMMAND_0x18 _IOC(IOC_INOUT, CAM_VERSION_0x18, 2, CAM_0X18_LEN) #define CAMGETPASSTHRU_0x18 _IOC(IOC_INOUT, CAM_VERSION_0x18, 3, CAM_0X18_LEN) From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:13:45 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFC9EC110F7; Fri, 14 Oct 2016 07:13:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5310C96E; Fri, 14 Oct 2016 07:13:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7DimA060343; Fri, 14 Oct 2016 07:13:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7DiKt060339; Fri, 14 Oct 2016 07:13:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140713.u9E7DiKt060339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:13:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307265 - in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:13:45 -0000 Author: mav Date: Fri Oct 14 07:13:43 2016 New Revision: 307265 URL: https://svnweb.freebsd.org/changeset/base/307265 Log: MFC r305323: MFV r302991: 6950 ARC should cache compressed data illumos/illumos-gate@dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2 https://github.com/illumos/illumos-gate/commit/dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2 https://www.illumos.org/issues/6950 When reading compressed data from disk, the ARC should keep the compressed block cached and only decompress it when consumers access the block. The uncompressed data should be short-lived allowing the ARC to cache a much larger amount of data. The DMU would also maintain a smaller cache of uncompressed blocks to minimize the impact of decompressing frequently accessed blocks. Reviewed by: Prakash Surya Reviewed by: Dan Kimmel Reviewed by: Matt Ahrens Reviewed by: Paul Dagnelie Reviewed by: Don Brady Reviewed by: Richard Elling Approved by: Richard Lowe Author: George Wilson Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_checksum.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct 14 06:56:06 2016 (r307264) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct 14 07:13:43 2016 (r307265) @@ -1289,7 +1289,7 @@ visit_indirect(spa_t *spa, const dnode_p } if (!err) ASSERT3U(fill, ==, BP_GET_FILL(bp)); - (void) arc_buf_remove_ref(buf, &buf); + arc_buf_destroy(buf, &buf); } return (err); Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Oct 14 06:56:06 2016 (r307264) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Oct 14 07:13:43 2016 (r307265) @@ -189,6 +189,7 @@ extern uint64_t metaslab_gang_bang; extern uint64_t metaslab_df_alloc_threshold; extern uint64_t zfs_deadman_synctime_ms; extern int metaslab_preload_limit; +extern boolean_t zfs_compressed_arc_enabled; static ztest_shared_opts_t *ztest_shared_opts; static ztest_shared_opts_t ztest_opts; @@ -5355,6 +5356,12 @@ ztest_resume_thread(void *arg) if (spa_suspended(spa)) ztest_resume(spa); (void) poll(NULL, 0, 100); + + /* + * Periodically change the zfs_compressed_arc_enabled setting. + */ + if (ztest_random(10) == 0) + zfs_compressed_arc_enabled = ztest_random(2); } return (NULL); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Oct 14 06:56:06 2016 (r307264) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Oct 14 07:13:43 2016 (r307265) @@ -120,9 +120,134 @@ * - ARC header release, as it removes from L2ARC buflists */ +/* + * ARC operation: + * + * Every block that is in the ARC is tracked by an arc_buf_hdr_t structure. + * This structure can point either to a block that is still in the cache or to + * one that is only accessible in an L2 ARC device, or it can provide + * information about a block that was recently evicted. If a block is + * only accessible in the L2ARC, then the arc_buf_hdr_t only has enough + * information to retrieve it from the L2ARC device. This information is + * stored in the l2arc_buf_hdr_t sub-structure of the arc_buf_hdr_t. A block + * that is in this state cannot access the data directly. + * + * Blocks that are actively being referenced or have not been evicted + * are cached in the L1ARC. The L1ARC (l1arc_buf_hdr_t) is a structure within + * the arc_buf_hdr_t that will point to the data block in memory. A block can + * only be read by a consumer if it has an l1arc_buf_hdr_t. The L1ARC + * caches data in two ways -- in a list of arc buffers (arc_buf_t) and + * also in the arc_buf_hdr_t's private physical data block pointer (b_pdata). + * Each arc buffer (arc_buf_t) is being actively accessed by a specific ARC + * consumer, and always contains uncompressed data. The ARC will provide + * references to this data and will keep it cached until it is no longer in + * use. Typically, the arc will try to cache only the L1ARC's physical data + * block and will aggressively evict any arc_buf_t that is no longer referenced. + * The amount of memory consumed by the arc_buf_t's can be seen via the + * "overhead_size" kstat. + * + * + * arc_buf_hdr_t + * +-----------+ + * | | + * | | + * | | + * +-----------+ + * l2arc_buf_hdr_t| | + * | | + * +-----------+ + * l1arc_buf_hdr_t| | + * | | arc_buf_t + * | b_buf +------------>+---------+ arc_buf_t + * | | |b_next +---->+---------+ + * | b_pdata +-+ |---------| |b_next +-->NULL + * +-----------+ | | | +---------+ + * | |b_data +-+ | | + * | +---------+ | |b_data +-+ + * +->+------+ | +---------+ | + * (potentially) | | | | + * compressed | | | | + * data +------+ | v + * +->+------+ +------+ + * uncompressed | | | | + * data | | | | + * +------+ +------+ + * + * The L1ARC's data pointer, however, may or may not be uncompressed. The + * ARC has the ability to store the physical data (b_pdata) associated with + * the DVA of the arc_buf_hdr_t. Since the b_pdata is a copy of the on-disk + * physical block, it will match its on-disk compression characteristics. + * If the block on-disk is compressed, then the physical data block + * in the cache will also be compressed and vice-versa. This behavior + * can be disabled by setting 'zfs_compressed_arc_enabled' to B_FALSE. When the + * compressed ARC functionality is disabled, the b_pdata will point to an + * uncompressed version of the on-disk data. + * + * When a consumer reads a block, the ARC must first look to see if the + * arc_buf_hdr_t is cached. If the hdr is cached and already has an arc_buf_t, + * then an additional arc_buf_t is allocated and the uncompressed data is + * bcopied from the existing arc_buf_t. If the hdr is cached but does not + * have an arc_buf_t, then the ARC allocates a new arc_buf_t and decompresses + * the b_pdata contents into the arc_buf_t's b_data. If the arc_buf_hdr_t's + * b_pdata is not compressed, then the block is shared with the newly + * allocated arc_buf_t. This block sharing only occurs with one arc_buf_t + * in the arc buffer chain. Sharing the block reduces the memory overhead + * required when the hdr is caching uncompressed blocks or the compressed + * arc functionality has been disabled via 'zfs_compressed_arc_enabled'. + * + * The diagram below shows an example of an uncompressed ARC hdr that is + * sharing its data with an arc_buf_t: + * + * arc_buf_hdr_t + * +-----------+ + * | | + * | | + * | | + * +-----------+ + * l2arc_buf_hdr_t| | + * | | + * +-----------+ + * l1arc_buf_hdr_t| | + * | | arc_buf_t (shared) + * | b_buf +------------>+---------+ arc_buf_t + * | | |b_next +---->+---------+ + * | b_pdata +-+ |---------| |b_next +-->NULL + * +-----------+ | | | +---------+ + * | |b_data +-+ | | + * | +---------+ | |b_data +-+ + * +->+------+ | +---------+ | + * | | | | + * uncompressed | | | | + * data +------+ | | + * ^ +->+------+ | + * | uncompressed | | | + * | data | | | + * | +------+ | + * +---------------------------------+ + * + * Writing to the arc requires that the ARC first discard the b_pdata + * since the physical block is about to be rewritten. The new data contents + * will be contained in the arc_buf_t (uncompressed). As the I/O pipeline + * performs the write, it may compress the data before writing it to disk. + * The ARC will be called with the transformed data and will bcopy the + * transformed on-disk block into a newly allocated b_pdata. + * + * When the L2ARC is in use, it will also take advantage of the b_pdata. The + * L2ARC will always write the contents of b_pdata to the L2ARC. This means + * that when compressed arc is enabled that the L2ARC blocks are identical + * to the on-disk block in the main data pool. This provides a significant + * advantage since the ARC can leverage the bp's checksum when reading from the + * L2ARC to determine if the contents are valid. However, if the compressed + * arc is disabled, then the L2ARC's block must be transformed to look + * like the physical block in the main data pool before comparing the + * checksum and determining its validity. + */ + #include #include +#include #include +#include #include #include #include @@ -155,10 +280,6 @@ static kcondvar_t arc_reclaim_thread_cv; static boolean_t arc_reclaim_thread_exit; static kcondvar_t arc_reclaim_waiters_cv; -static kmutex_t arc_user_evicts_lock; -static kcondvar_t arc_user_evicts_cv; -static boolean_t arc_user_evicts_thread_exit; - static kmutex_t arc_dnlc_evicts_lock; static kcondvar_t arc_dnlc_evicts_cv; static boolean_t arc_dnlc_evicts_thread_exit; @@ -234,13 +355,14 @@ uint64_t zfs_arc_meta_min = 0; int zfs_arc_grow_retry = 0; int zfs_arc_shrink_shift = 0; int zfs_arc_p_min_shift = 0; -int zfs_disable_dup_eviction = 0; uint64_t zfs_arc_average_blocksize = 8 * 1024; /* 8KB */ u_int zfs_arc_free_target = 0; /* Absolute min for arc min / max is 16MB. */ static uint64_t arc_abs_min = 16 << 20; +boolean_t zfs_compressed_arc_enabled = B_TRUE; + static int sysctl_vfs_zfs_arc_free_target(SYSCTL_HANDLER_ARGS); static int sysctl_vfs_zfs_arc_meta_limit(SYSCTL_HANDLER_ARGS); static int sysctl_vfs_zfs_arc_max(SYSCTL_HANDLER_ARGS); @@ -270,6 +392,8 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_ave SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_shrink_shift, CTLFLAG_RW, &arc_shrink_shift, 0, "log2(fraction of arc to reclaim)"); +SYSCTL_INT(_vfs_zfs, OID_AUTO, compressed_arc_enabled, CTLFLAG_RDTUN, + &zfs_compressed_arc_enabled, 0, "Enable compressed ARC"); /* * We don't have a tunable for arc_free_target due to the dependency on @@ -351,7 +475,7 @@ typedef struct arc_state { /* * total amount of evictable data in this state */ - uint64_t arcs_lsize[ARC_BUFC_NUMTYPES]; + refcount_t arcs_esize[ARC_BUFC_NUMTYPES]; /* * total amount of data in this state; this includes: evictable, * non-evictable, ARC_BUFC_DATA, and ARC_BUFC_METADATA. @@ -417,6 +541,26 @@ typedef struct arc_stats { kstat_named_t arcstat_c_max; kstat_named_t arcstat_size; /* + * Number of compressed bytes stored in the arc_buf_hdr_t's b_pdata. + * Note that the compressed bytes may match the uncompressed bytes + * if the block is either not compressed or compressed arc is disabled. + */ + kstat_named_t arcstat_compressed_size; + /* + * Uncompressed size of the data stored in b_pdata. If compressed + * arc is disabled then this value will be identical to the stat + * above. + */ + kstat_named_t arcstat_uncompressed_size; + /* + * Number of bytes stored in all the arc_buf_t's. This is classified + * as "overhead" since this data is typically short-lived and will + * be evicted from the arc when it becomes unreferenced unless the + * zfs_keep_uncompressed_metadata or zfs_keep_uncompressed_level + * values have been set (see comment in dbuf.c for more information). + */ + kstat_named_t arcstat_overhead_size; + /* * Number of bytes consumed by internal ARC structures necessary * for tracking purposes; these structures are not actually * backed by ARC buffers. This includes arc_buf_hdr_t structures @@ -561,16 +705,12 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_evict_reading; kstat_named_t arcstat_l2_evict_l1cached; kstat_named_t arcstat_l2_free_on_write; - kstat_named_t arcstat_l2_cdata_free_on_write; kstat_named_t arcstat_l2_abort_lowmem; kstat_named_t arcstat_l2_cksum_bad; kstat_named_t arcstat_l2_io_error; kstat_named_t arcstat_l2_size; kstat_named_t arcstat_l2_asize; kstat_named_t arcstat_l2_hdr_size; - kstat_named_t arcstat_l2_compress_successes; - kstat_named_t arcstat_l2_compress_zeros; - kstat_named_t arcstat_l2_compress_failures; kstat_named_t arcstat_l2_padding_needed; kstat_named_t arcstat_l2_write_trylock_fail; kstat_named_t arcstat_l2_write_passed_headroom; @@ -585,9 +725,6 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_write_buffer_list_iter; kstat_named_t arcstat_l2_write_buffer_list_null_iter; kstat_named_t arcstat_memory_throttle_count; - kstat_named_t arcstat_duplicate_buffers; - kstat_named_t arcstat_duplicate_buffers_size; - kstat_named_t arcstat_duplicate_reads; kstat_named_t arcstat_meta_used; kstat_named_t arcstat_meta_limit; kstat_named_t arcstat_meta_max; @@ -630,6 +767,9 @@ static arc_stats_t arc_stats = { { "c_min", KSTAT_DATA_UINT64 }, { "c_max", KSTAT_DATA_UINT64 }, { "size", KSTAT_DATA_UINT64 }, + { "compressed_size", KSTAT_DATA_UINT64 }, + { "uncompressed_size", KSTAT_DATA_UINT64 }, + { "overhead_size", KSTAT_DATA_UINT64 }, { "hdr_size", KSTAT_DATA_UINT64 }, { "data_size", KSTAT_DATA_UINT64 }, { "metadata_size", KSTAT_DATA_UINT64 }, @@ -663,16 +803,12 @@ static arc_stats_t arc_stats = { { "l2_evict_reading", KSTAT_DATA_UINT64 }, { "l2_evict_l1cached", KSTAT_DATA_UINT64 }, { "l2_free_on_write", KSTAT_DATA_UINT64 }, - { "l2_cdata_free_on_write", KSTAT_DATA_UINT64 }, { "l2_abort_lowmem", KSTAT_DATA_UINT64 }, { "l2_cksum_bad", KSTAT_DATA_UINT64 }, { "l2_io_error", KSTAT_DATA_UINT64 }, { "l2_size", KSTAT_DATA_UINT64 }, { "l2_asize", KSTAT_DATA_UINT64 }, { "l2_hdr_size", KSTAT_DATA_UINT64 }, - { "l2_compress_successes", KSTAT_DATA_UINT64 }, - { "l2_compress_zeros", KSTAT_DATA_UINT64 }, - { "l2_compress_failures", KSTAT_DATA_UINT64 }, { "l2_padding_needed", KSTAT_DATA_UINT64 }, { "l2_write_trylock_fail", KSTAT_DATA_UINT64 }, { "l2_write_passed_headroom", KSTAT_DATA_UINT64 }, @@ -687,9 +823,6 @@ static arc_stats_t arc_stats = { { "l2_write_buffer_list_iter", KSTAT_DATA_UINT64 }, { "l2_write_buffer_list_null_iter", KSTAT_DATA_UINT64 }, { "memory_throttle_count", KSTAT_DATA_UINT64 }, - { "duplicate_buffers", KSTAT_DATA_UINT64 }, - { "duplicate_buffers_size", KSTAT_DATA_UINT64 }, - { "duplicate_reads", KSTAT_DATA_UINT64 }, { "arc_meta_used", KSTAT_DATA_UINT64 }, { "arc_meta_limit", KSTAT_DATA_UINT64 }, { "arc_meta_max", KSTAT_DATA_UINT64 }, @@ -762,8 +895,12 @@ static arc_state_t *arc_l2c_only; #define arc_meta_used ARCSTAT(arcstat_meta_used) /* size of metadata */ #define arc_meta_max ARCSTAT(arcstat_meta_max) /* max size of metadata */ -#define L2ARC_IS_VALID_COMPRESS(_c_) \ - ((_c_) == ZIO_COMPRESS_LZ4 || (_c_) == ZIO_COMPRESS_EMPTY) +/* compressed size of entire arc */ +#define arc_compressed_size ARCSTAT(arcstat_compressed_size) +/* uncompressed size of entire arc */ +#define arc_uncompressed_size ARCSTAT(arcstat_uncompressed_size) +/* number of bytes in the arc from arc_buf_t's */ +#define arc_overhead_size ARCSTAT(arcstat_overhead_size) static int arc_no_grow; /* Don't try to grow cache size */ static uint64_t arc_tempreserve; @@ -823,6 +960,7 @@ struct arc_write_callback { */ typedef struct l1arc_buf_hdr { kmutex_t b_freeze_lock; + zio_cksum_t *b_freeze_cksum; #ifdef ZFS_DEBUG /* * used for debugging wtih kmem_flags - by allocating and freeing @@ -833,9 +971,10 @@ typedef struct l1arc_buf_hdr { #endif arc_buf_t *b_buf; - uint32_t b_datacnt; + uint32_t b_bufcnt; /* for waiting on writes to complete */ kcondvar_t b_cv; + uint8_t b_byteswap; /* protected by arc state mutex */ arc_state_t *b_state; @@ -848,8 +987,7 @@ typedef struct l1arc_buf_hdr { refcount_t b_refcnt; arc_callback_t *b_acb; - /* temporary buffer holder for in-flight compressed or padded data */ - void *b_tmp_cdata; + void *b_pdata; } l1arc_buf_hdr_t; typedef struct l2arc_dev l2arc_dev_t; @@ -858,9 +996,6 @@ typedef struct l2arc_buf_hdr { /* protected by arc_buf_hdr mutex */ l2arc_dev_t *b_dev; /* L2ARC device */ uint64_t b_daddr; /* disk address, offset byte */ - /* real alloc'd buffer size depending on b_compress applied */ - int32_t b_asize; - uint8_t b_compress; list_node_t b_l2node; } l2arc_buf_hdr_t; @@ -869,20 +1004,37 @@ struct arc_buf_hdr { /* protected by hash lock */ dva_t b_dva; uint64_t b_birth; - /* - * Even though this checksum is only set/verified when a buffer is in - * the L1 cache, it needs to be in the set of common fields because it - * must be preserved from the time before a buffer is written out to - * L2ARC until after it is read back in. - */ - zio_cksum_t *b_freeze_cksum; + arc_buf_contents_t b_type; arc_buf_hdr_t *b_hash_next; arc_flags_t b_flags; - /* immutable */ - int32_t b_size; - uint64_t b_spa; + /* + * This field stores the size of the data buffer after + * compression, and is set in the arc's zio completion handlers. + * It is in units of SPA_MINBLOCKSIZE (e.g. 1 == 512 bytes). + * + * While the block pointers can store up to 32MB in their psize + * field, we can only store up to 32MB minus 512B. This is due + * to the bp using a bias of 1, whereas we use a bias of 0 (i.e. + * a field of zeros represents 512B in the bp). We can't use a + * bias of 1 since we need to reserve a psize of zero, here, to + * represent holes and embedded blocks. + * + * This isn't a problem in practice, since the maximum size of a + * buffer is limited to 16MB, so we never need to store 32MB in + * this field. Even in the upstream illumos code base, the + * maximum size of a buffer is limited to 16MB. + */ + uint16_t b_psize; + + /* + * This field stores the size of the data buffer before + * compression, and cannot change once set. It is in units + * of SPA_MINBLOCKSIZE (e.g. 2 == 1024 bytes) + */ + uint16_t b_lsize; /* immutable */ + uint64_t b_spa; /* immutable */ /* L2ARC fields. Undefined when not in L2ARC. */ l2arc_buf_hdr_t b_l2hdr; @@ -986,9 +1138,6 @@ sysctl_vfs_zfs_arc_min(SYSCTL_HANDLER_AR } #endif -static arc_buf_t *arc_eviction_list; -static arc_buf_hdr_t arc_eviction_hdr; - #define GHOST_STATE(state) \ ((state) == arc_mru_ghost || (state) == arc_mfu_ghost || \ (state) == arc_l2c_only) @@ -997,25 +1146,35 @@ static arc_buf_hdr_t arc_eviction_hdr; #define HDR_IO_IN_PROGRESS(hdr) ((hdr)->b_flags & ARC_FLAG_IO_IN_PROGRESS) #define HDR_IO_ERROR(hdr) ((hdr)->b_flags & ARC_FLAG_IO_ERROR) #define HDR_PREFETCH(hdr) ((hdr)->b_flags & ARC_FLAG_PREFETCH) -#define HDR_FREED_IN_READ(hdr) ((hdr)->b_flags & ARC_FLAG_FREED_IN_READ) -#define HDR_BUF_AVAILABLE(hdr) ((hdr)->b_flags & ARC_FLAG_BUF_AVAILABLE) +#define HDR_COMPRESSION_ENABLED(hdr) \ + ((hdr)->b_flags & ARC_FLAG_COMPRESSED_ARC) #define HDR_L2CACHE(hdr) ((hdr)->b_flags & ARC_FLAG_L2CACHE) -#define HDR_L2COMPRESS(hdr) ((hdr)->b_flags & ARC_FLAG_L2COMPRESS) #define HDR_L2_READING(hdr) \ - (((hdr)->b_flags & ARC_FLAG_IO_IN_PROGRESS) && \ - ((hdr)->b_flags & ARC_FLAG_HAS_L2HDR)) + (((hdr)->b_flags & ARC_FLAG_IO_IN_PROGRESS) && \ + ((hdr)->b_flags & ARC_FLAG_HAS_L2HDR)) #define HDR_L2_WRITING(hdr) ((hdr)->b_flags & ARC_FLAG_L2_WRITING) #define HDR_L2_EVICTED(hdr) ((hdr)->b_flags & ARC_FLAG_L2_EVICTED) #define HDR_L2_WRITE_HEAD(hdr) ((hdr)->b_flags & ARC_FLAG_L2_WRITE_HEAD) +#define HDR_SHARED_DATA(hdr) ((hdr)->b_flags & ARC_FLAG_SHARED_DATA) #define HDR_ISTYPE_METADATA(hdr) \ - ((hdr)->b_flags & ARC_FLAG_BUFC_METADATA) + ((hdr)->b_flags & ARC_FLAG_BUFC_METADATA) #define HDR_ISTYPE_DATA(hdr) (!HDR_ISTYPE_METADATA(hdr)) #define HDR_HAS_L1HDR(hdr) ((hdr)->b_flags & ARC_FLAG_HAS_L1HDR) #define HDR_HAS_L2HDR(hdr) ((hdr)->b_flags & ARC_FLAG_HAS_L2HDR) +/* For storing compression mode in b_flags */ +#define HDR_COMPRESS_OFFSET (highbit64(ARC_FLAG_COMPRESS_0) - 1) + +#define HDR_GET_COMPRESS(hdr) ((enum zio_compress)BF32_GET((hdr)->b_flags, \ + HDR_COMPRESS_OFFSET, SPA_COMPRESSBITS)) +#define HDR_SET_COMPRESS(hdr, cmp) BF32_SET((hdr)->b_flags, \ + HDR_COMPRESS_OFFSET, SPA_COMPRESSBITS, (cmp)); + +#define ARC_BUF_LAST(buf) ((buf)->b_next == NULL) + /* * Other sizes */ @@ -1068,16 +1227,6 @@ uint64_t zfs_crc64_table[256]; #define L2ARC_FEED_SECS 1 /* caching interval secs */ #define L2ARC_FEED_MIN_MS 200 /* min caching interval ms */ -/* - * Used to distinguish headers that are being process by - * l2arc_write_buffers(), but have yet to be assigned to a l2arc disk - * address. This can happen when the header is added to the l2arc's list - * of buffers to write in the first stage of l2arc_write_buffers(), but - * has not yet been written out which happens in the second stage of - * l2arc_write_buffers(). - */ -#define L2ARC_ADDR_UNSET ((uint64_t)(-1)) - #define l2arc_writes_sent ARCSTAT(arcstat_l2_writes_sent) #define l2arc_writes_done ARCSTAT(arcstat_l2_writes_done) @@ -1112,41 +1261,47 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, l2arc_nor SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, anon_size, CTLFLAG_RD, &ARC_anon.arcs_size.rc_count, 0, "size of anonymous state"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, anon_metadata_lsize, CTLFLAG_RD, - &ARC_anon.arcs_lsize[ARC_BUFC_METADATA], 0, "size of anonymous state"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, anon_data_lsize, CTLFLAG_RD, - &ARC_anon.arcs_lsize[ARC_BUFC_DATA], 0, "size of anonymous state"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, anon_metadata_esize, CTLFLAG_RD, + &ARC_anon.arcs_esize[ARC_BUFC_METADATA].rc_count, 0, + "size of anonymous state"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, anon_data_esize, CTLFLAG_RD, + &ARC_anon.arcs_esize[ARC_BUFC_DATA].rc_count, 0, + "size of anonymous state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_size, CTLFLAG_RD, &ARC_mru.arcs_size.rc_count, 0, "size of mru state"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_metadata_lsize, CTLFLAG_RD, - &ARC_mru.arcs_lsize[ARC_BUFC_METADATA], 0, "size of metadata in mru state"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_data_lsize, CTLFLAG_RD, - &ARC_mru.arcs_lsize[ARC_BUFC_DATA], 0, "size of data in mru state"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_metadata_esize, CTLFLAG_RD, + &ARC_mru.arcs_esize[ARC_BUFC_METADATA].rc_count, 0, + "size of metadata in mru state"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_data_esize, CTLFLAG_RD, + &ARC_mru.arcs_esize[ARC_BUFC_DATA].rc_count, 0, + "size of data in mru state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_ghost_size, CTLFLAG_RD, &ARC_mru_ghost.arcs_size.rc_count, 0, "size of mru ghost state"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_ghost_metadata_lsize, CTLFLAG_RD, - &ARC_mru_ghost.arcs_lsize[ARC_BUFC_METADATA], 0, +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_ghost_metadata_esize, CTLFLAG_RD, + &ARC_mru_ghost.arcs_esize[ARC_BUFC_METADATA].rc_count, 0, "size of metadata in mru ghost state"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_ghost_data_lsize, CTLFLAG_RD, - &ARC_mru_ghost.arcs_lsize[ARC_BUFC_DATA], 0, +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_ghost_data_esize, CTLFLAG_RD, + &ARC_mru_ghost.arcs_esize[ARC_BUFC_DATA].rc_count, 0, "size of data in mru ghost state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_size, CTLFLAG_RD, &ARC_mfu.arcs_size.rc_count, 0, "size of mfu state"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_metadata_lsize, CTLFLAG_RD, - &ARC_mfu.arcs_lsize[ARC_BUFC_METADATA], 0, "size of metadata in mfu state"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_data_lsize, CTLFLAG_RD, - &ARC_mfu.arcs_lsize[ARC_BUFC_DATA], 0, "size of data in mfu state"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_metadata_esize, CTLFLAG_RD, + &ARC_mfu.arcs_esize[ARC_BUFC_METADATA].rc_count, 0, + "size of metadata in mfu state"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_data_esize, CTLFLAG_RD, + &ARC_mfu.arcs_esize[ARC_BUFC_DATA].rc_count, 0, + "size of data in mfu state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_ghost_size, CTLFLAG_RD, &ARC_mfu_ghost.arcs_size.rc_count, 0, "size of mfu ghost state"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_ghost_metadata_lsize, CTLFLAG_RD, - &ARC_mfu_ghost.arcs_lsize[ARC_BUFC_METADATA], 0, +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_ghost_metadata_esize, CTLFLAG_RD, + &ARC_mfu_ghost.arcs_esize[ARC_BUFC_METADATA].rc_count, 0, "size of metadata in mfu ghost state"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_ghost_data_lsize, CTLFLAG_RD, - &ARC_mfu_ghost.arcs_lsize[ARC_BUFC_DATA], 0, +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_ghost_data_esize, CTLFLAG_RD, + &ARC_mfu_ghost.arcs_esize[ARC_BUFC_DATA].rc_count, 0, "size of data in mfu ghost state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, l2c_only_size, CTLFLAG_RD, @@ -1179,12 +1334,10 @@ static kmutex_t l2arc_free_on_write_mtx; static uint64_t l2arc_ndev; /* number of devices */ typedef struct l2arc_read_callback { - arc_buf_t *l2rcb_buf; /* read buffer */ - spa_t *l2rcb_spa; /* spa */ + arc_buf_hdr_t *l2rcb_hdr; /* read buffer */ blkptr_t l2rcb_bp; /* original blkptr */ zbookmark_phys_t l2rcb_zb; /* original bookmark */ int l2rcb_flags; /* original flags */ - enum zio_compress l2rcb_compress; /* applied compress */ void *l2rcb_data; /* temporary buffer */ } l2arc_read_callback_t; @@ -1197,7 +1350,7 @@ typedef struct l2arc_data_free { /* protected by l2arc_free_on_write_mtx */ void *l2df_data; size_t l2df_size; - void (*l2df_func)(void *, size_t); + arc_buf_contents_t l2df_type; list_node_t l2df_list_node; } l2arc_data_free_t; @@ -1205,21 +1358,22 @@ static kmutex_t l2arc_feed_thr_lock; static kcondvar_t l2arc_feed_thr_cv; static uint8_t l2arc_thread_exit; -static void arc_get_data_buf(arc_buf_t *); +static void *arc_get_data_buf(arc_buf_hdr_t *, uint64_t, void *); +static void arc_free_data_buf(arc_buf_hdr_t *, void *, uint64_t, void *); +static void arc_hdr_free_pdata(arc_buf_hdr_t *hdr); +static void arc_hdr_alloc_pdata(arc_buf_hdr_t *); static void arc_access(arc_buf_hdr_t *, kmutex_t *); static boolean_t arc_is_overflowing(); static void arc_buf_watch(arc_buf_t *); static arc_buf_contents_t arc_buf_type(arc_buf_hdr_t *); static uint32_t arc_bufc_to_flags(arc_buf_contents_t); +static inline void arc_hdr_set_flags(arc_buf_hdr_t *hdr, arc_flags_t flags); +static inline void arc_hdr_clear_flags(arc_buf_hdr_t *hdr, arc_flags_t flags); static boolean_t l2arc_write_eligible(uint64_t, arc_buf_hdr_t *); static void l2arc_read_done(zio_t *); -static boolean_t l2arc_transform_buf(arc_buf_hdr_t *, boolean_t); -static void l2arc_decompress_zio(zio_t *, arc_buf_hdr_t *, enum zio_compress); -static void l2arc_release_cdata_buf(arc_buf_hdr_t *); - static void l2arc_trim(const arc_buf_hdr_t *hdr) { @@ -1228,13 +1382,9 @@ l2arc_trim(const arc_buf_hdr_t *hdr) ASSERT(HDR_HAS_L2HDR(hdr)); ASSERT(MUTEX_HELD(&dev->l2ad_mtx)); - if (hdr->b_l2hdr.b_daddr == L2ARC_ADDR_UNSET) - return; - if (hdr->b_l2hdr.b_asize != 0) { + if (HDR_GET_PSIZE(hdr) != 0) { trim_map_free(dev->l2ad_vdev, hdr->b_l2hdr.b_daddr, - hdr->b_l2hdr.b_asize, 0); - } else { - ASSERT3U(hdr->b_l2hdr.b_compress, ==, ZIO_COMPRESS_EMPTY); + HDR_GET_PSIZE(hdr), 0); } } @@ -1255,14 +1405,14 @@ buf_hash(uint64_t spa, const dva_t *dva, return (crc); } -#define BUF_EMPTY(buf) \ - ((buf)->b_dva.dva_word[0] == 0 && \ - (buf)->b_dva.dva_word[1] == 0) - -#define BUF_EQUAL(spa, dva, birth, buf) \ - ((buf)->b_dva.dva_word[0] == (dva)->dva_word[0]) && \ - ((buf)->b_dva.dva_word[1] == (dva)->dva_word[1]) && \ - ((buf)->b_birth == birth) && ((buf)->b_spa == spa) +#define HDR_EMPTY(hdr) \ + ((hdr)->b_dva.dva_word[0] == 0 && \ + (hdr)->b_dva.dva_word[1] == 0) + +#define HDR_EQUAL(spa, dva, birth, hdr) \ + ((hdr)->b_dva.dva_word[0] == (dva)->dva_word[0]) && \ + ((hdr)->b_dva.dva_word[1] == (dva)->dva_word[1]) && \ + ((hdr)->b_birth == birth) && ((hdr)->b_spa == spa) static void buf_discard_identity(arc_buf_hdr_t *hdr) @@ -1284,7 +1434,7 @@ buf_hash_find(uint64_t spa, const blkptr mutex_enter(hash_lock); for (hdr = buf_hash_table.ht_table[idx]; hdr != NULL; hdr = hdr->b_hash_next) { - if (BUF_EQUAL(spa, dva, birth, hdr)) { + if (HDR_EQUAL(spa, dva, birth, hdr)) { *lockp = hash_lock; return (hdr); } @@ -1322,13 +1472,13 @@ buf_hash_insert(arc_buf_hdr_t *hdr, kmut for (fhdr = buf_hash_table.ht_table[idx], i = 0; fhdr != NULL; fhdr = fhdr->b_hash_next, i++) { - if (BUF_EQUAL(hdr->b_spa, &hdr->b_dva, hdr->b_birth, fhdr)) + if (HDR_EQUAL(hdr->b_spa, &hdr->b_dva, hdr->b_birth, fhdr)) return (fhdr); } hdr->b_hash_next = buf_hash_table.ht_table[idx]; buf_hash_table.ht_table[idx] = hdr; - hdr->b_flags |= ARC_FLAG_IN_HASH_TABLE; + arc_hdr_set_flags(hdr, ARC_FLAG_IN_HASH_TABLE); /* collect some hash table performance data */ if (i > 0) { @@ -1356,12 +1506,12 @@ buf_hash_remove(arc_buf_hdr_t *hdr) hdrp = &buf_hash_table.ht_table[idx]; while ((fhdr = *hdrp) != hdr) { - ASSERT(fhdr != NULL); + ASSERT3P(fhdr, !=, NULL); hdrp = &fhdr->b_hash_next; } *hdrp = hdr->b_hash_next; hdr->b_hash_next = NULL; - hdr->b_flags &= ~ARC_FLAG_IN_HASH_TABLE; + arc_hdr_clear_flags(hdr, ARC_FLAG_IN_HASH_TABLE); /* collect some hash table performance data */ ARCSTAT_BUMPDOWN(arcstat_hash_elements); @@ -1447,7 +1597,7 @@ hdr_full_dest(void *vbuf, void *unused) { arc_buf_hdr_t *hdr = vbuf; - ASSERT(BUF_EMPTY(hdr)); + ASSERT(HDR_EMPTY(hdr)); cv_destroy(&hdr->b_l1hdr.b_cv); refcount_destroy(&hdr->b_l1hdr.b_refcnt); mutex_destroy(&hdr->b_l1hdr.b_freeze_lock); @@ -1461,7 +1611,7 @@ hdr_l2only_dest(void *vbuf, void *unused { arc_buf_hdr_t *hdr = vbuf; - ASSERT(BUF_EMPTY(hdr)); + ASSERT(HDR_EMPTY(hdr)); arc_space_return(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS); } @@ -1534,166 +1684,138 @@ retry: } } -/* - * Transition between the two allocation states for the arc_buf_hdr struct. - * The arc_buf_hdr struct can be allocated with (hdr_full_cache) or without - * (hdr_l2only_cache) the fields necessary for the L1 cache - the smaller - * version is used when a cache buffer is only in the L2ARC in order to reduce - * memory usage. - */ -static arc_buf_hdr_t * -arc_hdr_realloc(arc_buf_hdr_t *hdr, kmem_cache_t *old, kmem_cache_t *new) -{ - ASSERT(HDR_HAS_L2HDR(hdr)); - - arc_buf_hdr_t *nhdr; - l2arc_dev_t *dev = hdr->b_l2hdr.b_dev; - - ASSERT((old == hdr_full_cache && new == hdr_l2only_cache) || - (old == hdr_l2only_cache && new == hdr_full_cache)); - - nhdr = kmem_cache_alloc(new, KM_PUSHPAGE); - - ASSERT(MUTEX_HELD(HDR_LOCK(hdr))); - buf_hash_remove(hdr); - - bcopy(hdr, nhdr, HDR_L2ONLY_SIZE); - - if (new == hdr_full_cache) { - nhdr->b_flags |= ARC_FLAG_HAS_L1HDR; - /* - * arc_access and arc_change_state need to be aware that a - * header has just come out of L2ARC, so we set its state to - * l2c_only even though it's about to change. - */ - nhdr->b_l1hdr.b_state = arc_l2c_only; - - /* Verify previous threads set to NULL before freeing */ - ASSERT3P(nhdr->b_l1hdr.b_tmp_cdata, ==, NULL); - } else { - ASSERT(hdr->b_l1hdr.b_buf == NULL); - ASSERT0(hdr->b_l1hdr.b_datacnt); - - /* - * If we've reached here, We must have been called from - * arc_evict_hdr(), as such we should have already been - * removed from any ghost list we were previously on - * (which protects us from racing with arc_evict_state), - * thus no locking is needed during this check. - */ - ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node)); - - /* - * A buffer must not be moved into the arc_l2c_only - * state if it's not finished being written out to the - * l2arc device. Otherwise, the b_l1hdr.b_tmp_cdata field - * might try to be accessed, even though it was removed. - */ - VERIFY(!HDR_L2_WRITING(hdr)); - VERIFY3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL); +#define ARC_MINTIME (hz>>4) /* 62 ms */ -#ifdef ZFS_DEBUG - if (hdr->b_l1hdr.b_thawed != NULL) { - kmem_free(hdr->b_l1hdr.b_thawed, 1); - hdr->b_l1hdr.b_thawed = NULL; - } -#endif +static inline boolean_t +arc_buf_is_shared(arc_buf_t *buf) +{ + boolean_t shared = (buf->b_data != NULL && + buf->b_data == buf->b_hdr->b_l1hdr.b_pdata); + IMPLY(shared, HDR_SHARED_DATA(buf->b_hdr)); + return (shared); +} - nhdr->b_flags &= ~ARC_FLAG_HAS_L1HDR; +static inline void +arc_cksum_free(arc_buf_hdr_t *hdr) +{ + ASSERT(HDR_HAS_L1HDR(hdr)); + mutex_enter(&hdr->b_l1hdr.b_freeze_lock); + if (hdr->b_l1hdr.b_freeze_cksum != NULL) { + kmem_free(hdr->b_l1hdr.b_freeze_cksum, sizeof (zio_cksum_t)); + hdr->b_l1hdr.b_freeze_cksum = NULL; } - /* - * The header has been reallocated so we need to re-insert it into any - * lists it was on. - */ - (void) buf_hash_insert(nhdr, NULL); - - ASSERT(list_link_active(&hdr->b_l2hdr.b_l2node)); - - mutex_enter(&dev->l2ad_mtx); - - /* - * We must place the realloc'ed header back into the list at - * the same spot. Otherwise, if it's placed earlier in the list, - * l2arc_write_buffers() could find it during the function's - * write phase, and try to write it out to the l2arc. - */ - list_insert_after(&dev->l2ad_buflist, hdr, nhdr); - list_remove(&dev->l2ad_buflist, hdr); - - mutex_exit(&dev->l2ad_mtx); - - /* - * Since we're using the pointer address as the tag when - * incrementing and decrementing the l2ad_alloc refcount, we - * must remove the old pointer (that we're about to destroy) and - * add the new pointer to the refcount. Otherwise we'd remove - * the wrong pointer address when calling arc_hdr_destroy() later. - */ - - (void) refcount_remove_many(&dev->l2ad_alloc, - hdr->b_l2hdr.b_asize, hdr); - - (void) refcount_add_many(&dev->l2ad_alloc, - nhdr->b_l2hdr.b_asize, nhdr); - - buf_discard_identity(hdr); - hdr->b_freeze_cksum = NULL; - kmem_cache_free(old, hdr); - - return (nhdr); + mutex_exit(&hdr->b_l1hdr.b_freeze_lock); } - -#define ARC_MINTIME (hz>>4) /* 62 ms */ - static void arc_cksum_verify(arc_buf_t *buf) { + arc_buf_hdr_t *hdr = buf->b_hdr; zio_cksum_t zc; if (!(zfs_flags & ZFS_DEBUG_MODIFY)) return; - mutex_enter(&buf->b_hdr->b_l1hdr.b_freeze_lock); - if (buf->b_hdr->b_freeze_cksum == NULL || HDR_IO_ERROR(buf->b_hdr)) { - mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); + ASSERT(HDR_HAS_L1HDR(hdr)); + + mutex_enter(&hdr->b_l1hdr.b_freeze_lock); + if (hdr->b_l1hdr.b_freeze_cksum == NULL || HDR_IO_ERROR(hdr)) { + mutex_exit(&hdr->b_l1hdr.b_freeze_lock); return; } - fletcher_2_native(buf->b_data, buf->b_hdr->b_size, NULL, &zc); - if (!ZIO_CHECKSUM_EQUAL(*buf->b_hdr->b_freeze_cksum, zc)) + fletcher_2_native(buf->b_data, HDR_GET_LSIZE(hdr), NULL, &zc); + if (!ZIO_CHECKSUM_EQUAL(*hdr->b_l1hdr.b_freeze_cksum, zc)) panic("buffer modified while frozen!"); - mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); + mutex_exit(&hdr->b_l1hdr.b_freeze_lock); } -static int -arc_cksum_equal(arc_buf_t *buf) +static boolean_t +arc_cksum_is_equal(arc_buf_hdr_t *hdr, zio_t *zio) { - zio_cksum_t zc; - int equal; + enum zio_compress compress = BP_GET_COMPRESS(zio->io_bp); + boolean_t valid_cksum; - mutex_enter(&buf->b_hdr->b_l1hdr.b_freeze_lock); - fletcher_2_native(buf->b_data, buf->b_hdr->b_size, NULL, &zc); - equal = ZIO_CHECKSUM_EQUAL(*buf->b_hdr->b_freeze_cksum, zc); - mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); + ASSERT(!BP_IS_EMBEDDED(zio->io_bp)); + VERIFY3U(BP_GET_PSIZE(zio->io_bp), ==, HDR_GET_PSIZE(hdr)); + + /* + * We rely on the blkptr's checksum to determine if the block + * is valid or not. When compressed arc is enabled, the l2arc + * writes the block to the l2arc just as it appears in the pool. + * This allows us to use the blkptr's checksum to validate the + * data that we just read off of the l2arc without having to store + * a separate checksum in the arc_buf_hdr_t. However, if compressed + * arc is disabled, then the data written to the l2arc is always + * uncompressed and won't match the block as it exists in the main + * pool. When this is the case, we must first compress it if it is + * compressed on the main pool before we can validate the checksum. + */ + if (!HDR_COMPRESSION_ENABLED(hdr) && compress != ZIO_COMPRESS_OFF) { + ASSERT3U(HDR_GET_COMPRESS(hdr), ==, ZIO_COMPRESS_OFF); + uint64_t lsize = HDR_GET_LSIZE(hdr); + uint64_t csize; + + void *cbuf = zio_buf_alloc(HDR_GET_PSIZE(hdr)); + csize = zio_compress_data(compress, zio->io_data, cbuf, lsize); + ASSERT3U(csize, <=, HDR_GET_PSIZE(hdr)); + if (csize < HDR_GET_PSIZE(hdr)) { + /* + * Compressed blocks are always a multiple of the + * smallest ashift in the pool. Ideally, we would + * like to round up the csize to the next + * spa_min_ashift but that value may have changed + * since the block was last written. Instead, + * we rely on the fact that the hdr's psize + * was set to the psize of the block when it was + * last written. We set the csize to that value + * and zero out any part that should not contain + * data. + */ + bzero((char *)cbuf + csize, HDR_GET_PSIZE(hdr) - csize); + csize = HDR_GET_PSIZE(hdr); + } + zio_push_transform(zio, cbuf, csize, HDR_GET_PSIZE(hdr), NULL); + } - return (equal); + /* + * Block pointers always store the checksum for the logical data. + * If the block pointer has the gang bit set, then the checksum + * it represents is for the reconstituted data and not for an + * individual gang member. The zio pipeline, however, must be able to + * determine the checksum of each of the gang constituents so it + * treats the checksum comparison differently than what we need + * for l2arc blocks. This prevents us from using the + * zio_checksum_error() interface directly. Instead we must call the + * zio_checksum_error_impl() so that we can ensure the checksum is + * generated using the correct checksum algorithm and accounts for the + * logical I/O size and not just a gang fragment. + */ + valid_cksum = (zio_checksum_error_impl(zio->io_spa, zio->io_bp, + BP_GET_CHECKSUM(zio->io_bp), zio->io_data, zio->io_size, + zio->io_offset, NULL) == 0); + zio_pop_transforms(zio); + return (valid_cksum); } static void -arc_cksum_compute(arc_buf_t *buf, boolean_t force) +arc_cksum_compute(arc_buf_t *buf) { - if (!force && !(zfs_flags & ZFS_DEBUG_MODIFY)) + arc_buf_hdr_t *hdr = buf->b_hdr; + + if (!(zfs_flags & ZFS_DEBUG_MODIFY)) return; + ASSERT(HDR_HAS_L1HDR(hdr)); mutex_enter(&buf->b_hdr->b_l1hdr.b_freeze_lock); - if (buf->b_hdr->b_freeze_cksum != NULL) { - mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); + if (hdr->b_l1hdr.b_freeze_cksum != NULL) { + mutex_exit(&hdr->b_l1hdr.b_freeze_lock); return; } - buf->b_hdr->b_freeze_cksum = kmem_alloc(sizeof (zio_cksum_t), KM_SLEEP); - fletcher_2_native(buf->b_data, buf->b_hdr->b_size, - NULL, buf->b_hdr->b_freeze_cksum); - mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); + hdr->b_l1hdr.b_freeze_cksum = kmem_alloc(sizeof (zio_cksum_t), + KM_SLEEP); + fletcher_2_native(buf->b_data, HDR_GET_LSIZE(hdr), NULL, + hdr->b_l1hdr.b_freeze_cksum); + mutex_exit(&hdr->b_l1hdr.b_freeze_lock); #ifdef illumos arc_buf_watch(buf); #endif @@ -1735,7 +1857,7 @@ arc_buf_watch(arc_buf_t *buf) procctl_t ctl; ctl.cmd = PCWATCH; ctl.prwatch.pr_vaddr = (uintptr_t)buf->b_data; - ctl.prwatch.pr_size = buf->b_hdr->b_size; + ctl.prwatch.pr_size = HDR_GET_LSIZE(buf->b_hdr); ctl.prwatch.pr_wflags = WA_WRITE; result = write(arc_procfd, &ctl, sizeof (ctl)); ASSERT3U(result, ==, sizeof (ctl)); @@ -1747,11 +1869,14 @@ arc_buf_watch(arc_buf_t *buf) static arc_buf_contents_t arc_buf_type(arc_buf_hdr_t *hdr) { + arc_buf_contents_t type; if (HDR_ISTYPE_METADATA(hdr)) { - return (ARC_BUFC_METADATA); + type = ARC_BUFC_METADATA; } else { - return (ARC_BUFC_DATA); + type = ARC_BUFC_DATA; } + VERIFY3U(hdr->b_type, ==, type); + return (type); } static uint32_t @@ -1773,29 +1898,29 @@ arc_bufc_to_flags(arc_buf_contents_t typ void arc_buf_thaw(arc_buf_t *buf) { + arc_buf_hdr_t *hdr = buf->b_hdr; + if (zfs_flags & ZFS_DEBUG_MODIFY) { - if (buf->b_hdr->b_l1hdr.b_state != arc_anon) + if (hdr->b_l1hdr.b_state != arc_anon) panic("modifying non-anon buffer!"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:16:13 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EABDC11210; Fri, 14 Oct 2016 07:16:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B181CF7; Fri, 14 Oct 2016 07:16:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7GCe3060551; Fri, 14 Oct 2016 07:16:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7GC1a060548; Fri, 14 Oct 2016 07:16:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140716.u9E7GC1a060548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307267 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:16:13 -0000 Author: mav Date: Fri Oct 14 07:16:11 2016 New Revision: 307267 URL: https://svnweb.freebsd.org/changeset/base/307267 Log: MFC r305324: MFV r303077: 7072 zfs fails to expand if lun added when os is in shutdown state illumos/illumos-gate@c39a2aae1e2c439d156021edfc20910dad7f9891 https://github.com/illumos/illumos-gate/commit/c39a2aae1e2c439d156021edfc20910dad7f9891 https://www.illumos.org/issues/7072 upstream: 38733 zfs fails to expand if lun added when os is in shutdown state DLPX-36910 spares and caches should not display expandable space DLPX-39262 vdev_disk_open spam zfs_dbgmsg buffer Reviewed by: Igor Kozhukhov Reviewed by: Dan Kimmel Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Reviewed by: Alex Reece Approved by: Dan McDonald Author: George Wilson Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Fri Oct 14 07:14:35 2016 (r307266) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Fri Oct 14 07:16:11 2016 (r307267) @@ -468,7 +468,13 @@ metaslab_class_expandable_space(metaslab continue; } - space += tvd->vdev_max_asize - tvd->vdev_asize; + /* + * Calculate if we have enough space to add additional + * metaslabs. We report the expandable space in terms + * of the metaslab size since that's the unit of expansion. + */ + space += P2ALIGN(tvd->vdev_max_asize - tvd->vdev_asize, + 1ULL << tvd->vdev_ms_shift); } spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG); return (space); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Oct 14 07:14:35 2016 (r307266) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Oct 14 07:16:11 2016 (r307267) @@ -2885,6 +2885,7 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t * { spa_t *spa = vd->vdev_spa; vdev_t *rvd = spa->spa_root_vdev; + vdev_t *tvd = vd->vdev_top; ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0); @@ -2895,8 +2896,15 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t * vs->vs_rsize = vdev_get_min_asize(vd); if (vd->vdev_ops->vdev_op_leaf) vs->vs_rsize += VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; - if (vd->vdev_max_asize != 0) - vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize; + /* + * Report expandable space on top-level, non-auxillary devices only. + * The expandable space is reported in terms of metaslab sized units + * since that determines how much space the pool can expand. + */ + if (vd->vdev_aux == NULL && tvd != NULL && vd->vdev_max_asize != 0) { + vs->vs_esize = P2ALIGN(vd->vdev_max_asize - vd->vdev_asize, + 1ULL << tvd->vdev_ms_shift); + } vs->vs_configured_ashift = vd->vdev_top != NULL ? vd->vdev_top->vdev_ashift : vd->vdev_ashift; vs->vs_logical_ashift = vd->vdev_logical_ashift; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Fri Oct 14 07:14:35 2016 (r307266) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Fri Oct 14 07:16:11 2016 (r307267) @@ -241,34 +241,6 @@ vdev_disk_rele(vdev_t *vd) } } -static uint64_t -vdev_disk_get_space(vdev_t *vd, uint64_t capacity, uint_t blksz) -{ - ASSERT(vd->vdev_wholedisk); - - vdev_disk_t *dvd = vd->vdev_tsd; - dk_efi_t dk_ioc; - efi_gpt_t *efi; - uint64_t avail_space = 0; - int efisize = EFI_LABEL_SIZE * 2; - - dk_ioc.dki_data = kmem_alloc(efisize, KM_SLEEP); - dk_ioc.dki_lba = 1; - dk_ioc.dki_length = efisize; - dk_ioc.dki_data_64 = (uint64_t)(uintptr_t)dk_ioc.dki_data; - efi = dk_ioc.dki_data; - - if (ldi_ioctl(dvd->vd_lh, DKIOCGETEFI, (intptr_t)&dk_ioc, - FKIOCTL, kcred, NULL) == 0) { - uint64_t efi_altern_lba = LE_64(efi->efi_gpt_AlternateLBA); - - if (capacity > efi_altern_lba) - avail_space = (capacity - efi_altern_lba) * blksz; - } - kmem_free(dk_ioc.dki_data, efisize); - return (avail_space); -} - /* * We want to be loud in DEBUG kernels when DKIOCGMEDIAINFOEXT fails, or when * even a fallback to DKIOCGMEDIAINFO fails. @@ -559,10 +531,7 @@ skip_open: * Adjust max_psize upward accordingly since we know * we own the whole disk now. */ - *max_psize += vdev_disk_get_space(vd, capacity, blksz); - zfs_dbgmsg("capacity change: vdev %s, psize %llu, " - "max_psize %llu", vd->vdev_path, *psize, - *max_psize); + *max_psize = capacity * blksz; } /* From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:18:28 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B68BCC112F7; Fri, 14 Oct 2016 07:18:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F778FC9; Fri, 14 Oct 2016 07:18:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7IRQU060750; Fri, 14 Oct 2016 07:18:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7IRW9060749; Fri, 14 Oct 2016 07:18:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140718.u9E7IRW9060749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307269 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:18:28 -0000 Author: mav Date: Fri Oct 14 07:18:27 2016 New Revision: 307269 URL: https://svnweb.freebsd.org/changeset/base/307269 Log: MFC r305325: MFV r303078: 7086 ztest attempts dva_get_dsize_sync on an embedded blockpointer illumos/illumos-gate@926549256b71acd595f69b236779ff6b78fa08ef https://github.com/illumos/illumos-gate/commit/926549256b71acd595f69b236779ff6b7 8fa08ef https://www.illumos.org/issues/7086 In dbuf_dirty(), we need to grab the dn_struct_rwlock before looking at the db_blkptr, to prevent it from being changed by syncing context. Otherwise we may see that ztest got a segfault from this stack: libzpool.so.1`dva_get_dsize_sync+0x98(872f000, b32b240, fed7811b, 0, b4cda20, 0) libzpool.so.1`bp_get_dsize+0x60(872f000, b32b240, 0, 97cb780, 9d4c1a8, 0) libzpool.so.1`dbuf_dirty+0x9b3(ce0a100, 97cb780, 9, fecd2530) libzpool.so.1`dmu_buf_will_dirty+0xc3(ce0a100, 97cb780, ea293d6c, 1) libzpool.so.1`zap_lockdir+0x1a0(8aaa3c0, 1, 0, 97cb780, 1, 1) libzpool.so.1`zap_remove_norm+0x30(8aaa3c0, 1, 0, 8728b10, 0, 97cb780) libzpool.so.1`zap_remove+0x29(8aaa3c0, 1, 0, 8728b10, 97cb780, a) ztest_replay_remove+0x225(ea294588, 8728ae8, 0, 38010000, 0, 0) ztest_remove+0x9f(ea294588, ea293f50, 4, 3) ztest_object_init+0x78(ea294588, ea293f50, 4e0, 1) ztest_dmu_object_alloc_free+0x71(ea294588, 13) ztest_dmu_objset_create_destroy+0x224(80cef08, 13, 0, 805d36c, 9017ad44, 0) ztest_execute+0x89(a, 807c720, 13, 0) ztest_thread+0xea(13, 0, 0, 0) libc.so.1`_thrp_setup+0x88(f0983240) libc.so.1`_lwp_start(f0983240, 0, 0, 0, 0, 0) Looking into it a bit, we see that this is an embedded blockpointer, so BP_GET_NDVAS should have returned 0: b32b240::blkptr EMBEDDED [L0 ZAP_OTHER] et=0 LZ4 size=200L/4aP birth=80L Instead, it looks like another thread is modifying this blockpointer: b32b240::ugrep | ::whatis f47a0e0c is in [ stack tid=0x19f ] ebd6ec40 is in [ stack tid=0x226 ] ea293bd0 is in [ stack tid=0x244 ] ea293be4 is in [ stack tid=0x244 ] Reviewed by: Prakash Surya Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Oct 14 07:16:51 2016 (r307268) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Oct 14 07:18:27 2016 (r307269) @@ -1662,7 +1662,20 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t dnode_setdirty(dn, tx); DB_DNODE_EXIT(db); return (dr); - } else if (do_free_accounting) { + } + + /* + * The dn_struct_rwlock prevents db_blkptr from changing + * due to a write from syncing context completing + * while we are running, so we want to acquire it before + * looking at db_blkptr. + */ + if (!RW_WRITE_HELD(&dn->dn_struct_rwlock)) { + rw_enter(&dn->dn_struct_rwlock, RW_READER); + drop_struct_lock = TRUE; + } + + if (do_free_accounting) { blkptr_t *bp = db->db_blkptr; int64_t willfree = (bp && !BP_IS_HOLE(bp)) ? bp_get_dsize(os->os_spa, bp) : db->db.db_size; @@ -1678,11 +1691,6 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t dnode_willuse_space(dn, -willfree, tx); } - if (!RW_WRITE_HELD(&dn->dn_struct_rwlock)) { - rw_enter(&dn->dn_struct_rwlock, RW_READER); - drop_struct_lock = TRUE; - } - if (db->db_level == 0) { dnode_new_blkid(dn, db->db_blkid, tx, drop_struct_lock); ASSERT(dn->dn_maxblkid >= db->db_blkid); From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:20:08 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A799FC11456; Fri, 14 Oct 2016 07:20:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 834E26ED; Fri, 14 Oct 2016 07:20:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7K7x6060944; Fri, 14 Oct 2016 07:20:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7K7va060943; Fri, 14 Oct 2016 07:20:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140720.u9E7K7va060943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:20:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307271 - stable/11/cddl/contrib/opensolaris/cmd/ztest X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:20:08 -0000 Author: mav Date: Fri Oct 14 07:20:07 2016 New Revision: 307271 URL: https://svnweb.freebsd.org/changeset/base/307271 Log: MFC r305326: MFV r303079: 7147 ztest: ztest_ddt_repair fails with ztest_pattern_match assertion illumos/illumos-gate@aab80726335c76a7cae32c7300890248d73a51e3 https://github.com/illumos/illumos-gate/commit/aab80726335c76a7cae32c7300890248d 73a51e3 https://www.illumos.org/issues/7147 Here's the dbuf we're currently reading: 966f200::dbuf addr object lvl blkid holds os 966f200 4 0 0 1 ztest/ds_3 966f200::print dmu_buf_t db_data db_data = 0x9ae0400 0x9ae0400/10J 0x9ae0400: c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d The pattern we're expecting is actually this: a34ae10b5f2db2. If we attempt to read the block on disk we find that it has matches what ztest_ddt_repair() would have written: ~c1c7ced932020d=J ff3e383126cdfdf2 966f200::print dmu_buf_impl_t db_blkptr | ::blkptr DVA0=<0:71d3c00:800> [L0 UINT64_OTHER] SHA256 OFF LE contiguous dedup single size=400L/400P birth=55L/55P fill=1 cksum=18486450d3ce8c6d:75a72f4bbf117b0f:2d3a226314eb5650:2eb0fd68648b1af0 1. zdb -U /rpool/tmp/zpool.cache -R ztest 0:71d3c00:800 | head Found vdev type: mirror 0:71d3c00:800 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 000000: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>. 000010: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>. 000020: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>. 000030: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>. 000040: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>. 000050: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Robert Mustacchi Author: George Wilson Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Oct 14 07:19:08 2016 (r307270) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Oct 14 07:20:07 2016 (r307271) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. @@ -5022,9 +5022,14 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_ return; } + dmu_objset_stats_t dds; + dsl_pool_config_enter(dmu_objset_pool(os), FTAG); + dmu_objset_fast_stat(os, &dds); + dsl_pool_config_exit(dmu_objset_pool(os), FTAG); + object = od[0].od_object; blocksize = od[0].od_blocksize; - pattern = zs->zs_guid ^ dmu_objset_fsid_guid(os); + pattern = zs->zs_guid ^ dds.dds_guid; ASSERT(object != 0); @@ -5627,9 +5632,13 @@ ztest_run(ztest_shared_t *zs) metaslab_preload_limit = ztest_random(20) + 1; ztest_spa = spa; + dmu_objset_stats_t dds; VERIFY0(dmu_objset_own(ztest_opts.zo_pool, DMU_OST_ANY, B_TRUE, FTAG, &os)); - zs->zs_guid = dmu_objset_fsid_guid(os); + dsl_pool_config_enter(dmu_objset_pool(os), FTAG); + dmu_objset_fast_stat(os, &dds); + dsl_pool_config_exit(dmu_objset_pool(os), FTAG); + zs->zs_guid = dds.dds_guid; dmu_objset_disown(os, FTAG); spa->spa_dedup_ditto = 2 * ZIO_DEDUPDITTO_MIN; From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:21:57 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 415EAC115A4; Fri, 14 Oct 2016 07:21:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01397B41; Fri, 14 Oct 2016 07:21:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7Lu1o061790; Fri, 14 Oct 2016 07:21:56 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7LuGj061789; Fri, 14 Oct 2016 07:21:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140721.u9E7LuGj061789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:21:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307273 - stable/11/cddl/contrib/opensolaris/cmd/ztest X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:21:57 -0000 Author: mav Date: Fri Oct 14 07:21:55 2016 New Revision: 307273 URL: https://svnweb.freebsd.org/changeset/base/307273 Log: MFC r305327: MFV r303080: 6451 ztest fails due to checksum errors illumos/illumos-gate@f9eb9fdf196b6ed476e4ffc69cecd8b0da3cb7e7 https://github.com/illumos/illumos-gate/commit/f9eb9fdf196b6ed476e4ffc69cecd8b0d a3cb7e7 https://www.illumos.org/issues/6451 Sometimes ztest fails because zdb detects checksum errors. e.g.: Traversing all blocks to verify checksums and verify nothing leaked ... zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 8000160> DVA0=<0:1cc2000: 180000> [L0 other uint64[]] sha256 uncompressed LE contiguou s unique single size=100000L/100000P birth=271L/271P fill=1 cksum=c5a3e27d1ed0f894:843bca3a5473c4bf:f76a19b6830a2e4:91292591613a12bf -- skipping zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 800000180> DVA0=<0:ce16800: 180000> [L0 other uint64[]] sha256 uncompressed LE contigu ous unique single size=100000L/100000P birth=840L/840P fill=1 cksum=5d018f3d061e17f3:6d1584784587bf63:2805a74a0ce37369:ba68a214806c7e75 -- skipping zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 1000000360> DVA0=<0:10d37400: 180000> [L0 other uint64[]] sha256 uncompressed LE conti guous unique single size=100000L/100000P birth=904L/904P fill=1 cksum=fa1e11d4138bd14b:86c9488c444473e3:f31e43c72e72e46b:e3446472d1174d ba -- skipping zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 400000002c0> DVA0=<0:127ef400: 180000> [L0 other uint64[]] sha256 uncompressed LE cont iguous dedup single size=100000L/100000P birth=549L/549P fill=1 cksum=30e14955ebf13522:66dc2ff8067e6810:4607e750abb9d3b3:6582b8af909fcb 58 -- skipping zdb_blkptr_cb: Got error 50 reading <657, 5, 0, 1c0> DVA0=<0:1a180400:180000> [L0 other uint64[]] fletcher4 uncompressed LE contiguou s unique single size=100000L/100000P birth=1091L/1091P fill=1 cksum=a6cf1e50: 29b3bd01c57e5:36779b914035db9a:db61cdcf6bec56f0 -- skippin g The problem is that ztest_fault_inject() can inject multiple faults into the same block. It is designed such that it can inject errors on all leafs of a RAID-Z or mirror, but for a given range of offsets, it will only inject errors Reviewed by: George Wilson Reviewed by: Prakash Surya Reviewed by: Jorgen Lundman Approved by: Dan McDonald Author: Matthew Ahrens Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Oct 14 07:20:49 2016 (r307272) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Oct 14 07:21:55 2016 (r307273) @@ -4793,7 +4793,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint6 char path0[MAXPATHLEN]; char pathrand[MAXPATHLEN]; size_t fsize; - int bshift = SPA_OLD_MAXBLOCKSHIFT + 2; /* don't scrog all labels */ + int bshift = SPA_MAXBLOCKSHIFT + 2; /* don't scrog all labels */ int iters = 1000; int maxfaults; int mirror_save; @@ -4954,6 +4954,31 @@ ztest_fault_inject(ztest_ds_t *zd, uint6 fsize = lseek(fd, 0, SEEK_END); while (--iters != 0) { + /* + * The offset must be chosen carefully to ensure that + * we do not inject a given logical block with errors + * on two different leaf devices, because ZFS can not + * tolerate that (if maxfaults==1). + * + * We divide each leaf into chunks of size + * (# leaves * SPA_MAXBLOCKSIZE * 4). Within each chunk + * there is a series of ranges to which we can inject errors. + * Each range can accept errors on only a single leaf vdev. + * The error injection ranges are separated by ranges + * which we will not inject errors on any device (DMZs). + * Each DMZ must be large enough such that a single block + * can not straddle it, so that a single block can not be + * a target in two different injection ranges (on different + * leaf vdevs). + * + * For example, with 3 leaves, each chunk looks like: + * 0 to 32M: injection range for leaf 0 + * 32M to 64M: DMZ - no injection allowed + * 64M to 96M: injection range for leaf 1 + * 96M to 128M: DMZ - no injection allowed + * 128M to 160M: injection range for leaf 2 + * 160M to 192M: DMZ - no injection allowed + */ offset = ztest_random(fsize / (leaves << bshift)) * (leaves << bshift) + (leaf << bshift) + (ztest_random(1ULL << (bshift - 1)) & -8ULL); From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:23:59 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E191CC11729; Fri, 14 Oct 2016 07:23:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA8ABF5A; Fri, 14 Oct 2016 07:23:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7NwQW064798; Fri, 14 Oct 2016 07:23:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7NwbK064797; Fri, 14 Oct 2016 07:23:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140723.u9E7NwbK064797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307275 - stable/11/cddl/contrib/opensolaris/cmd/ztest X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:24:00 -0000 Author: mav Date: Fri Oct 14 07:23:58 2016 New Revision: 307275 URL: https://svnweb.freebsd.org/changeset/base/307275 Log: MFC r305328: MFV r303081: 7163 ztest failures due to excess error injection illumos/illumos-gate@f34284d835bc555f987c1310df46c034c3101155 https://github.com/illumos/illumos-gate/commit/f34284d835bc555f987c1310df46c034c 3101155 https://www.illumos.org/issues/7163 Running zloop from zfs-precommit hit this assertion: *panicstr/s 0xfffffd7fd7419370: assertion failed for thread 0xfffffd7fe29ed240, thread-id 577: parent != NULL, file ../../../uts/common/fs/zfs/dbuf.c, line 1827 $c libc.so.1`_lwp_kill+0xa() libc.so.1`_assfail+0x182(fffffd7ffb1c29fa, fffffd7ffb1cc028, 723) libc.so.1`assfail+0x19(fffffd7ffb1c29fa, fffffd7ffb1cc028, 723) libzpool.so.1`dbuf_dirty+0xc69(10e3bc10, 3601700) libzpool.so.1`dbuf_dirty+0x61e(10c73640, 3601700) libzpool.so.1`dbuf_dirty+0x61e(10e28280, 3601700) libzpool.so.1`dmu_buf_will_fill+0x64(10e28280, 3601700) libzpool.so.1`dmu_write+0x1b6(2c7e640, d, 400000002e000000, 200, 3717b40, 3601700) ztest_replay_write+0x568(4950d0, 3717a80, 0) ztest_write+0x125(4950d0, d, 400000002e000000, 200, 413f000) ztest_io+0x1bb(4950d0, d, 400000002e000000) ztest_dmu_write_parallel+0xaa(4950d0, 6) ztest_execute+0x83(1, 420c98, 6) ztest_thread+0xf4(6) libc.so.1`_thrp_setup+0x8a(fffffd7fe29ed240) libc.so.1`_lwp_start() This is another manifestation of ECKSUM in ztest: The lowest level ancestor that’s in memory is the L8 (topmost). The L7 ancestor is blkid 0x10: ::dbufs -O 0x2c7e640 -o d -l 7 |::dbuf addr object lvl blkid holds os 600be50 d 7 4 1 ztest/ds_6 719d880 d 7 0 4 ztest/ds_6 Reviewed by: George Wilson Reviewed by: Paul Dagnelie Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Oct 14 07:22:44 2016 (r307274) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Oct 14 07:23:58 2016 (r307275) @@ -4793,7 +4793,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint6 char path0[MAXPATHLEN]; char pathrand[MAXPATHLEN]; size_t fsize; - int bshift = SPA_MAXBLOCKSHIFT + 2; /* don't scrog all labels */ + int bshift = SPA_MAXBLOCKSHIFT + 2; int iters = 1000; int maxfaults; int mirror_save; @@ -4983,7 +4983,29 @@ ztest_fault_inject(ztest_ds_t *zd, uint6 (leaves << bshift) + (leaf << bshift) + (ztest_random(1ULL << (bshift - 1)) & -8ULL); - if (offset >= fsize) + /* + * Only allow damage to the labels at one end of the vdev. + * + * If all labels are damaged, the device will be totally + * inaccessible, which will result in loss of data, + * because we also damage (parts of) the other side of + * the mirror/raidz. + * + * Additionally, we will always have both an even and an + * odd label, so that we can handle crashes in the + * middle of vdev_config_sync(). + */ + if ((leaf & 1) == 0 && offset < VDEV_LABEL_START_SIZE) + continue; + + /* + * The two end labels are stored at the "end" of the disk, but + * the end of the disk (vdev_psize) is aligned to + * sizeof (vdev_label_t). + */ + uint64_t psize = P2ALIGN(fsize, sizeof (vdev_label_t)); + if ((leaf & 1) == 1 && + offset + sizeof (bad) > psize - VDEV_LABEL_END_SIZE) continue; VERIFY(mutex_lock(&ztest_vdev_lock) == 0); From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:26:21 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE468C117EA; Fri, 14 Oct 2016 07:26:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 651DB286; Fri, 14 Oct 2016 07:26:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7QKHd065030; Fri, 14 Oct 2016 07:26:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7QJhq065019; Fri, 14 Oct 2016 07:26:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140726.u9E7QJhq065019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:26:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307277 - in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:26:21 -0000 Author: mav Date: Fri Oct 14 07:26:19 2016 New Revision: 307277 URL: https://svnweb.freebsd.org/changeset/base/307277 Log: MFC r305331: MFV r304155: 7090 zfs should improve allocation order and throttle allocations illumos/illumos-gate@0f7643c7376dd69a08acbfc9d1d7d548b10c846a https://github.com/illumos/illumos-gate/commit/0f7643c7376dd69a08acbfc9d1d7d548b 10c846a https://www.illumos.org/issues/7090 When write I/Os are issued, they are issued in block order but the ZIO pipelin e will drive them asynchronously through the allocation stage which can result i n blocks being allocated out-of-order. It would be nice to preserve as much of the logical order as possible. In addition, the allocations are equally scattered across all top-level VDEVs but not all top-level VDEVs are created equally. The pipeline should be able t o detect devices that are more capable of handling allocations and should allocate more blocks to those devices. This allows for dynamic allocation distribution when devices are imbalanced as fuller devices will tend to be slower than empty devices. The change includes a new pool-wide allocation queue which would throttle and order allocations in the ZIO pipeline. The queue would be ordered by issued time and offset and would provide an initial amount of allocation of work to each top-level vdev. The allocation logic utilizes a reservation system to reserve allocations that will be performed by the allocator. Once an allocatio n is successfully completed it's scheduled on a given top-level vdev. Each top- level vdev maintains a maximum number of allocations that it can handle (mg_alloc_queue_depth). The pool-wide reserved allocations (top-levels * mg_alloc_queue_depth) are distributed across the top-level vdevs metaslab groups and round robin across all eligible metaslab groups to distribute the work. As top-levels complete their work, they receive additional work from the pool-wide allocation queue until the allocation queue is emptied. Reviewed by: Adam Leventhal Reviewed by: Alex Reece Reviewed by: Christopher Siden Reviewed by: Dan Kimmel Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Prakash Surya Reviewed by: Sebastien Roy Approved by: Robert Mustacchi Author: George Wilson Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Fri Oct 14 07:24:43 2016 (r307276) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Fri Oct 14 07:26:19 2016 (r307277) @@ -38,17 +38,8 @@ SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, metaslab, CTLFLAG_RW, 0, "ZFS metaslab"); -/* - * Allow allocations to switch to gang blocks quickly. We do this to - * avoid having to load lots of space_maps in a given txg. There are, - * however, some cases where we want to avoid "fast" ganging and instead - * we want to do an exhaustive search of all metaslabs on this device. - * Currently we don't allow any gang, slog, or dump device related allocations - * to "fast" gang. - */ -#define CAN_FASTGANG(flags) \ - (!((flags) & (METASLAB_GANG_CHILD | METASLAB_GANG_HEADER | \ - METASLAB_GANG_AVOID))) +#define GANG_ALLOCATION(flags) \ + ((flags) & (METASLAB_GANG_CHILD | METASLAB_GANG_HEADER)) #define METASLAB_WEIGHT_PRIMARY (1ULL << 63) #define METASLAB_WEIGHT_SECONDARY (1ULL << 62) @@ -256,6 +247,8 @@ metaslab_class_create(spa_t *spa, metasl mc->mc_spa = spa; mc->mc_rotor = NULL; mc->mc_ops = ops; + mutex_init(&mc->mc_lock, NULL, MUTEX_DEFAULT, NULL); + refcount_create_tracked(&mc->mc_alloc_slots); return (mc); } @@ -269,6 +262,8 @@ metaslab_class_destroy(metaslab_class_t ASSERT(mc->mc_space == 0); ASSERT(mc->mc_dspace == 0); + refcount_destroy(&mc->mc_alloc_slots); + mutex_destroy(&mc->mc_lock); kmem_free(mc, sizeof (metaslab_class_t)); } @@ -512,9 +507,10 @@ metaslab_compare(const void *x1, const v /* * Update the allocatable flag and the metaslab group's capacity. * The allocatable flag is set to true if the capacity is below - * the zfs_mg_noalloc_threshold. If a metaslab group transitions - * from allocatable to non-allocatable or vice versa then the metaslab - * group's class is updated to reflect the transition. + * the zfs_mg_noalloc_threshold or has a fragmentation value that is + * greater than zfs_mg_fragmentation_threshold. If a metaslab group + * transitions from allocatable to non-allocatable or vice versa then the + * metaslab group's class is updated to reflect the transition. */ static void metaslab_group_alloc_update(metaslab_group_t *mg) @@ -523,22 +519,45 @@ metaslab_group_alloc_update(metaslab_gro metaslab_class_t *mc = mg->mg_class; vdev_stat_t *vs = &vd->vdev_stat; boolean_t was_allocatable; + boolean_t was_initialized; ASSERT(vd == vd->vdev_top); mutex_enter(&mg->mg_lock); was_allocatable = mg->mg_allocatable; + was_initialized = mg->mg_initialized; mg->mg_free_capacity = ((vs->vs_space - vs->vs_alloc) * 100) / (vs->vs_space + 1); + mutex_enter(&mc->mc_lock); + + /* + * If the metaslab group was just added then it won't + * have any space until we finish syncing out this txg. + * At that point we will consider it initialized and available + * for allocations. We also don't consider non-activated + * metaslab groups (e.g. vdevs that are in the middle of being removed) + * to be initialized, because they can't be used for allocation. + */ + mg->mg_initialized = metaslab_group_initialized(mg); + if (!was_initialized && mg->mg_initialized) { + mc->mc_groups++; + } else if (was_initialized && !mg->mg_initialized) { + ASSERT3U(mc->mc_groups, >, 0); + mc->mc_groups--; + } + if (mg->mg_initialized) + mg->mg_no_free_space = B_FALSE; + /* * A metaslab group is considered allocatable if it has plenty * of free space or is not heavily fragmented. We only take * fragmentation into account if the metaslab group has a valid * fragmentation metric (i.e. a value between 0 and 100). */ - mg->mg_allocatable = (mg->mg_free_capacity > zfs_mg_noalloc_threshold && + mg->mg_allocatable = (mg->mg_activation_count > 0 && + mg->mg_free_capacity > zfs_mg_noalloc_threshold && (mg->mg_fragmentation == ZFS_FRAG_INVALID || mg->mg_fragmentation <= zfs_mg_fragmentation_threshold)); @@ -561,6 +580,7 @@ metaslab_group_alloc_update(metaslab_gro mc->mc_alloc_groups--; else if (!was_allocatable && mg->mg_allocatable) mc->mc_alloc_groups++; + mutex_exit(&mc->mc_lock); mutex_exit(&mg->mg_lock); } @@ -577,6 +597,9 @@ metaslab_group_create(metaslab_class_t * mg->mg_vd = vd; mg->mg_class = mc; mg->mg_activation_count = 0; + mg->mg_initialized = B_FALSE; + mg->mg_no_free_space = B_TRUE; + refcount_create_tracked(&mg->mg_alloc_queue_depth); mg->mg_taskq = taskq_create("metaslab_group_taskq", metaslab_load_pct, minclsyspri, 10, INT_MAX, TASKQ_THREADS_CPU_PCT); @@ -599,6 +622,7 @@ metaslab_group_destroy(metaslab_group_t taskq_destroy(mg->mg_taskq); avl_destroy(&mg->mg_metaslab_tree); mutex_destroy(&mg->mg_lock); + refcount_destroy(&mg->mg_alloc_queue_depth); kmem_free(mg, sizeof (metaslab_group_t)); } @@ -670,6 +694,15 @@ metaslab_group_passivate(metaslab_group_ metaslab_class_minblocksize_update(mc); } +boolean_t +metaslab_group_initialized(metaslab_group_t *mg) +{ + vdev_t *vd = mg->mg_vd; + vdev_stat_t *vs = &vd->vdev_stat; + + return (vs->vs_space != 0 && mg->mg_activation_count > 0); +} + uint64_t metaslab_group_get_space(metaslab_group_t *mg) { @@ -839,30 +872,97 @@ metaslab_group_fragmentation(metaslab_gr * group should avoid allocations if its free capacity is less than the * zfs_mg_noalloc_threshold or its fragmentation metric is greater than * zfs_mg_fragmentation_threshold and there is at least one metaslab group - * that can still handle allocations. + * that can still handle allocations. If the allocation throttle is enabled + * then we skip allocations to devices that have reached their maximum + * allocation queue depth unless the selected metaslab group is the only + * eligible group remaining. */ static boolean_t -metaslab_group_allocatable(metaslab_group_t *mg) +metaslab_group_allocatable(metaslab_group_t *mg, metaslab_group_t *rotor, + uint64_t psize) { - vdev_t *vd = mg->mg_vd; - spa_t *spa = vd->vdev_spa; + spa_t *spa = mg->mg_vd->vdev_spa; metaslab_class_t *mc = mg->mg_class; /* - * We use two key metrics to determine if a metaslab group is - * considered allocatable -- free space and fragmentation. If - * the free space is greater than the free space threshold and - * the fragmentation is less than the fragmentation threshold then - * consider the group allocatable. There are two case when we will - * not consider these key metrics. The first is if the group is - * associated with a slog device and the second is if all groups - * in this metaslab class have already been consider ineligible + * We can only consider skipping this metaslab group if it's + * in the normal metaslab class and there are other metaslab + * groups to select from. Otherwise, we always consider it eligible * for allocations. */ - return ((mg->mg_free_capacity > zfs_mg_noalloc_threshold && - (mg->mg_fragmentation == ZFS_FRAG_INVALID || - mg->mg_fragmentation <= zfs_mg_fragmentation_threshold)) || - mc != spa_normal_class(spa) || mc->mc_alloc_groups == 0); + if (mc != spa_normal_class(spa) || mc->mc_groups <= 1) + return (B_TRUE); + + /* + * If the metaslab group's mg_allocatable flag is set (see comments + * in metaslab_group_alloc_update() for more information) and + * the allocation throttle is disabled then allow allocations to this + * device. However, if the allocation throttle is enabled then + * check if we have reached our allocation limit (mg_alloc_queue_depth) + * to determine if we should allow allocations to this metaslab group. + * If all metaslab groups are no longer considered allocatable + * (mc_alloc_groups == 0) or we're trying to allocate the smallest + * gang block size then we allow allocations on this metaslab group + * regardless of the mg_allocatable or throttle settings. + */ + if (mg->mg_allocatable) { + metaslab_group_t *mgp; + int64_t qdepth; + uint64_t qmax = mg->mg_max_alloc_queue_depth; + + if (!mc->mc_alloc_throttle_enabled) + return (B_TRUE); + + /* + * If this metaslab group does not have any free space, then + * there is no point in looking further. + */ + if (mg->mg_no_free_space) + return (B_FALSE); + + qdepth = refcount_count(&mg->mg_alloc_queue_depth); + + /* + * If this metaslab group is below its qmax or it's + * the only allocatable metasable group, then attempt + * to allocate from it. + */ + if (qdepth < qmax || mc->mc_alloc_groups == 1) + return (B_TRUE); + ASSERT3U(mc->mc_alloc_groups, >, 1); + + /* + * Since this metaslab group is at or over its qmax, we + * need to determine if there are metaslab groups after this + * one that might be able to handle this allocation. This is + * racy since we can't hold the locks for all metaslab + * groups at the same time when we make this check. + */ + for (mgp = mg->mg_next; mgp != rotor; mgp = mgp->mg_next) { + qmax = mgp->mg_max_alloc_queue_depth; + + qdepth = refcount_count(&mgp->mg_alloc_queue_depth); + + /* + * If there is another metaslab group that + * might be able to handle the allocation, then + * we return false so that we skip this group. + */ + if (qdepth < qmax && !mgp->mg_no_free_space) + return (B_FALSE); + } + + /* + * We didn't find another group to handle the allocation + * so we can't skip this metaslab group even though + * we are at or over our qmax. + */ + return (B_TRUE); + + } else if (mc->mc_alloc_groups == 0 || psize == SPA_MINBLOCKSIZE) { + return (B_TRUE); + } + return (B_FALSE); } /* @@ -2130,8 +2230,57 @@ metaslab_distance(metaslab_t *msp, dva_t return (0); } +/* + * ========================================================================== + * Metaslab block operations + * ========================================================================== + */ + +static void +metaslab_group_alloc_increment(spa_t *spa, uint64_t vdev, void *tag, int flags) +{ + if (!(flags & METASLAB_ASYNC_ALLOC) || + flags & METASLAB_DONT_THROTTLE) + return; + + metaslab_group_t *mg = vdev_lookup_top(spa, vdev)->vdev_mg; + if (!mg->mg_class->mc_alloc_throttle_enabled) + return; + + (void) refcount_add(&mg->mg_alloc_queue_depth, tag); +} + +void +metaslab_group_alloc_decrement(spa_t *spa, uint64_t vdev, void *tag, int flags) +{ + if (!(flags & METASLAB_ASYNC_ALLOC) || + flags & METASLAB_DONT_THROTTLE) + return; + + metaslab_group_t *mg = vdev_lookup_top(spa, vdev)->vdev_mg; + if (!mg->mg_class->mc_alloc_throttle_enabled) + return; + + (void) refcount_remove(&mg->mg_alloc_queue_depth, tag); +} + +void +metaslab_group_alloc_verify(spa_t *spa, const blkptr_t *bp, void *tag) +{ +#ifdef ZFS_DEBUG + const dva_t *dva = bp->blk_dva; + int ndvas = BP_GET_NDVAS(bp); + + for (int d = 0; d < ndvas; d++) { + uint64_t vdev = DVA_GET_VDEV(&dva[d]); + metaslab_group_t *mg = vdev_lookup_top(spa, vdev)->vdev_mg; + VERIFY(refcount_not_held(&mg->mg_alloc_queue_depth, tag)); + } +#endif +} + static uint64_t -metaslab_group_alloc(metaslab_group_t *mg, uint64_t psize, uint64_t asize, +metaslab_group_alloc(metaslab_group_t *mg, uint64_t asize, uint64_t txg, uint64_t min_distance, dva_t *dva, int d) { spa_t *spa = mg->mg_vd->vdev_spa; @@ -2158,10 +2307,10 @@ metaslab_group_alloc(metaslab_group_t *m if (msp->ms_weight < asize) { spa_dbgmsg(spa, "%s: failed to meet weight " "requirement: vdev %llu, txg %llu, mg %p, " - "msp %p, psize %llu, asize %llu, " + "msp %p, asize %llu, " "weight %llu", spa_name(spa), mg->mg_vd->vdev_id, txg, - mg, msp, psize, asize, msp->ms_weight); + mg, msp, asize, msp->ms_weight); mutex_exit(&mg->mg_lock); return (-1ULL); } @@ -2243,7 +2392,6 @@ metaslab_group_alloc(metaslab_group_t *m msp->ms_access_txg = txg + metaslab_unload_delay; mutex_exit(&msp->ms_lock); - return (offset); } @@ -2260,7 +2408,6 @@ metaslab_alloc_dva(spa_t *spa, metaslab_ int all_zero; int zio_lock = B_FALSE; boolean_t allocatable; - uint64_t offset = -1ULL; uint64_t asize; uint64_t distance; @@ -2330,7 +2477,6 @@ top: all_zero = B_TRUE; do { ASSERT(mg->mg_activation_count == 1); - vd = mg->mg_vd; /* @@ -2346,24 +2492,23 @@ top: /* * Determine if the selected metaslab group is eligible - * for allocations. If we're ganging or have requested - * an allocation for the smallest gang block size - * then we don't want to avoid allocating to the this - * metaslab group. If we're in this condition we should - * try to allocate from any device possible so that we - * don't inadvertently return ENOSPC and suspend the pool + * for allocations. If we're ganging then don't allow + * this metaslab group to skip allocations since that would + * inadvertently return ENOSPC and suspend the pool * even though space is still available. */ - if (allocatable && CAN_FASTGANG(flags) && - psize > SPA_GANGBLOCKSIZE) - allocatable = metaslab_group_allocatable(mg); + if (allocatable && !GANG_ALLOCATION(flags) && !zio_lock) { + allocatable = metaslab_group_allocatable(mg, rotor, + psize); + } if (!allocatable) goto next; + ASSERT(mg->mg_initialized); + /* - * Avoid writing single-copy data to a failing vdev - * unless the user instructs us that it is okay. + * Avoid writing single-copy data to a failing vdev. */ if ((vd->vdev_stat.vs_write_errors > 0 || vd->vdev_state < VDEV_STATE_HEALTHY) && @@ -2383,8 +2528,32 @@ top: asize = vdev_psize_to_asize(vd, psize); ASSERT(P2PHASE(asize, 1ULL << vd->vdev_ashift) == 0); - offset = metaslab_group_alloc(mg, psize, asize, txg, distance, - dva, d); + uint64_t offset = metaslab_group_alloc(mg, asize, txg, + distance, dva, d); + + mutex_enter(&mg->mg_lock); + if (offset == -1ULL) { + mg->mg_failed_allocations++; + if (asize == SPA_GANGBLOCKSIZE) { + /* + * This metaslab group was unable to allocate + * the minimum gang block size so it must be + * out of space. We must notify the allocation + * throttle to start skipping allocation + * attempts to this metaslab group until more + * space becomes available. + * + * Note: this failure cannot be caused by the + * allocation throttle since the allocation + * throttle is only responsible for skipping + * devices and not failing block allocations. + */ + mg->mg_no_free_space = B_TRUE; + } + } + mg->mg_allocations++; + mutex_exit(&mg->mg_lock); + if (offset != -1ULL) { /* * If we've just selected this metaslab group, @@ -2565,9 +2734,57 @@ metaslab_claim_dva(spa_t *spa, const dva return (0); } +/* + * Reserve some allocation slots. The reservation system must be called + * before we call into the allocator. If there aren't any available slots + * then the I/O will be throttled until an I/O completes and its slots are + * freed up. The function returns true if it was successful in placing + * the reservation. + */ +boolean_t +metaslab_class_throttle_reserve(metaslab_class_t *mc, int slots, zio_t *zio, + int flags) +{ + uint64_t available_slots = 0; + boolean_t slot_reserved = B_FALSE; + + ASSERT(mc->mc_alloc_throttle_enabled); + mutex_enter(&mc->mc_lock); + + uint64_t reserved_slots = refcount_count(&mc->mc_alloc_slots); + if (reserved_slots < mc->mc_alloc_max_slots) + available_slots = mc->mc_alloc_max_slots - reserved_slots; + + if (slots <= available_slots || GANG_ALLOCATION(flags)) { + /* + * We reserve the slots individually so that we can unreserve + * them individually when an I/O completes. + */ + for (int d = 0; d < slots; d++) { + reserved_slots = refcount_add(&mc->mc_alloc_slots, zio); + } + zio->io_flags |= ZIO_FLAG_IO_ALLOCATING; + slot_reserved = B_TRUE; + } + + mutex_exit(&mc->mc_lock); + return (slot_reserved); +} + +void +metaslab_class_throttle_unreserve(metaslab_class_t *mc, int slots, zio_t *zio) +{ + ASSERT(mc->mc_alloc_throttle_enabled); + mutex_enter(&mc->mc_lock); + for (int d = 0; d < slots; d++) { + (void) refcount_remove(&mc->mc_alloc_slots, zio); + } + mutex_exit(&mc->mc_lock); +} + int metaslab_alloc(spa_t *spa, metaslab_class_t *mc, uint64_t psize, blkptr_t *bp, - int ndvas, uint64_t txg, blkptr_t *hintbp, int flags) + int ndvas, uint64_t txg, blkptr_t *hintbp, int flags, zio_t *zio) { dva_t *dva = bp->blk_dva; dva_t *hintdva = hintbp->blk_dva; @@ -2593,11 +2810,21 @@ metaslab_alloc(spa_t *spa, metaslab_clas if (error != 0) { for (d--; d >= 0; d--) { metaslab_free_dva(spa, &dva[d], txg, B_TRUE); + metaslab_group_alloc_decrement(spa, + DVA_GET_VDEV(&dva[d]), zio, flags); bzero(&dva[d], sizeof (dva_t)); } spa_config_exit(spa, SCL_ALLOC, FTAG); return (error); + } else { + /* + * Update the metaslab group's queue depth + * based on the newly allocated dva. + */ + metaslab_group_alloc_increment(spa, + DVA_GET_VDEV(&dva[d]), zio, flags); } + } ASSERT(error == 0); ASSERT(BP_GET_NDVAS(bp) == ndvas); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c Fri Oct 14 07:24:43 2016 (r307276) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c Fri Oct 14 07:26:19 2016 (r307277) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2015 by Delphix. All rights reserved. */ #include @@ -73,6 +73,13 @@ refcount_create(refcount_t *rc) } void +refcount_create_tracked(refcount_t *rc) +{ + refcount_create(rc); + rc->rc_tracked = B_TRUE; +} + +void refcount_create_untracked(refcount_t *rc) { refcount_create(rc); @@ -255,4 +262,60 @@ refcount_transfer_ownership(refcount_t * ASSERT(found); mutex_exit(&rc->rc_mtx); } + +/* + * If tracking is enabled, return true if a reference exists that matches + * the "holder" tag. If tracking is disabled, then return true if a reference + * might be held. + */ +boolean_t +refcount_held(refcount_t *rc, void *holder) +{ + reference_t *ref; + + mutex_enter(&rc->rc_mtx); + + if (!rc->rc_tracked) { + mutex_exit(&rc->rc_mtx); + return (rc->rc_count > 0); + } + + for (ref = list_head(&rc->rc_list); ref; + ref = list_next(&rc->rc_list, ref)) { + if (ref->ref_holder == holder) { + mutex_exit(&rc->rc_mtx); + return (B_TRUE); + } + } + mutex_exit(&rc->rc_mtx); + return (B_FALSE); +} + +/* + * If tracking is enabled, return true if a reference does not exist that + * matches the "holder" tag. If tracking is disabled, always return true + * since the reference might not be held. + */ +boolean_t +refcount_not_held(refcount_t *rc, void *holder) +{ + reference_t *ref; + + mutex_enter(&rc->rc_mtx); + + if (!rc->rc_tracked) { + mutex_exit(&rc->rc_mtx); + return (B_TRUE); + } + + for (ref = list_head(&rc->rc_list); ref; + ref = list_next(&rc->rc_list, ref)) { + if (ref->ref_holder == holder) { + mutex_exit(&rc->rc_mtx); + return (B_FALSE); + } + } + mutex_exit(&rc->rc_mtx); + return (B_TRUE); +} #endif /* ZFS_DEBUG */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Oct 14 07:24:43 2016 (r307276) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Oct 14 07:26:19 2016 (r307277) @@ -1332,7 +1332,6 @@ spa_unload(spa_t *spa) ddt_unload(spa); - /* * Drop and purge level 2 cache */ @@ -3720,6 +3719,7 @@ spa_create(const char *pool, nvlist_t *n spa->spa_uberblock.ub_txg = txg - 1; spa->spa_uberblock.ub_version = version; spa->spa_ubsync = spa->spa_uberblock; + spa->spa_load_state = SPA_LOAD_CREATE; /* * Create "The Godfather" zio to hold all async IOs @@ -3905,6 +3905,7 @@ spa_create(const char *pool, nvlist_t *n */ spa_evicting_os_wait(spa); spa->spa_minref = refcount_count(&spa->spa_refcount); + spa->spa_load_state = SPA_LOAD_NONE; mutex_exit(&spa_namespace_lock); @@ -5615,7 +5616,7 @@ spa_nvlist_lookup_by_guid(nvlist_t **nvp static void spa_vdev_remove_aux(nvlist_t *config, char *name, nvlist_t **dev, int count, - nvlist_t *dev_to_remove) + nvlist_t *dev_to_remove) { nvlist_t **newdev = NULL; @@ -6830,6 +6831,8 @@ spa_sync(spa_t *spa, uint64_t txg) vdev_t *vd; dmu_tx_t *tx; int error; + uint32_t max_queue_depth = zfs_vdev_async_write_max_active * + zfs_vdev_queue_depth_pct / 100; VERIFY(spa_writeable(spa)); @@ -6841,6 +6844,10 @@ spa_sync(spa_t *spa, uint64_t txg) spa->spa_syncing_txg = txg; spa->spa_sync_pass = 0; + mutex_enter(&spa->spa_alloc_lock); + VERIFY0(avl_numnodes(&spa->spa_alloc_tree)); + mutex_exit(&spa->spa_alloc_lock); + /* * If there are any pending vdev state changes, convert them * into config changes that go out with this transaction group. @@ -6900,6 +6907,38 @@ spa_sync(spa_t *spa, uint64_t txg) } /* + * Set the top-level vdev's max queue depth. Evaluate each + * top-level's async write queue depth in case it changed. + * The max queue depth will not change in the middle of syncing + * out this txg. + */ + uint64_t queue_depth_total = 0; + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + metaslab_group_t *mg = tvd->vdev_mg; + + if (mg == NULL || mg->mg_class != spa_normal_class(spa) || + !metaslab_group_initialized(mg)) + continue; + + /* + * It is safe to do a lock-free check here because only async + * allocations look at mg_max_alloc_queue_depth, and async + * allocations all happen from spa_sync(). + */ + ASSERT0(refcount_count(&mg->mg_alloc_queue_depth)); + mg->mg_max_alloc_queue_depth = max_queue_depth; + queue_depth_total += mg->mg_max_alloc_queue_depth; + } + metaslab_class_t *mc = spa_normal_class(spa); + ASSERT0(refcount_count(&mc->mc_alloc_slots)); + mc->mc_alloc_max_slots = queue_depth_total; + mc->mc_alloc_throttle_enabled = zio_dva_throttle_enabled; + + ASSERT3U(mc->mc_alloc_max_slots, <=, + max_queue_depth * rvd->vdev_children); + + /* * Iterate to convergence. */ do { @@ -7056,6 +7095,10 @@ spa_sync(spa_t *spa, uint64_t txg) dsl_pool_sync_done(dp, txg); + mutex_enter(&spa->spa_alloc_lock); + VERIFY0(avl_numnodes(&spa->spa_alloc_tree)); + mutex_exit(&spa->spa_alloc_lock); + /* * Update usable space statistics. */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Fri Oct 14 07:24:43 2016 (r307276) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Fri Oct 14 07:26:19 2016 (r307277) @@ -657,6 +657,7 @@ spa_add(const char *name, nvlist_t *conf mutex_init(&spa->spa_scrub_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&spa->spa_suspend_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&spa->spa_vdev_top_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&spa->spa_alloc_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&spa->spa_async_cv, NULL, CV_DEFAULT, NULL); cv_init(&spa->spa_evicting_os_cv, NULL, CV_DEFAULT, NULL); @@ -713,6 +714,9 @@ spa_add(const char *name, nvlist_t *conf spa_active_count++; } + avl_create(&spa->spa_alloc_tree, zio_timestamp_compare, + sizeof (zio_t), offsetof(zio_t, io_alloc_node)); + /* * Every pool starts with the default cachefile */ @@ -791,6 +795,7 @@ spa_remove(spa_t *spa) kmem_free(dp, sizeof (spa_config_dirent_t)); } + avl_destroy(&spa->spa_alloc_tree); list_destroy(&spa->spa_config_list); nvlist_free(spa->spa_label_features); @@ -824,6 +829,7 @@ spa_remove(spa_t *spa) cv_destroy(&spa->spa_scrub_io_cv); cv_destroy(&spa->spa_suspend_cv); + mutex_destroy(&spa->spa_alloc_lock); mutex_destroy(&spa->spa_async_lock); mutex_destroy(&spa->spa_errlist_lock); mutex_destroy(&spa->spa_errlog_lock); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h Fri Oct 14 07:24:43 2016 (r307276) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h Fri Oct 14 07:26:19 2016 (r307277) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. */ #ifndef _SYS_METASLAB_H @@ -55,14 +55,15 @@ void metaslab_sync_done(metaslab_t *, ui void metaslab_sync_reassess(metaslab_group_t *); uint64_t metaslab_block_maxsize(metaslab_t *); -#define METASLAB_HINTBP_FAVOR 0x0 -#define METASLAB_HINTBP_AVOID 0x1 -#define METASLAB_GANG_HEADER 0x2 -#define METASLAB_GANG_CHILD 0x4 -#define METASLAB_GANG_AVOID 0x8 +#define METASLAB_HINTBP_FAVOR 0x0 +#define METASLAB_HINTBP_AVOID 0x1 +#define METASLAB_GANG_HEADER 0x2 +#define METASLAB_GANG_CHILD 0x4 +#define METASLAB_ASYNC_ALLOC 0x8 +#define METASLAB_DONT_THROTTLE 0x10 int metaslab_alloc(spa_t *, metaslab_class_t *, uint64_t, - blkptr_t *, int, uint64_t, blkptr_t *, int); + blkptr_t *, int, uint64_t, blkptr_t *, int, zio_t *); void metaslab_free(spa_t *, const blkptr_t *, uint64_t, boolean_t); int metaslab_claim(spa_t *, const blkptr_t *, uint64_t); void metaslab_check_free(spa_t *, const blkptr_t *); @@ -73,6 +74,9 @@ int metaslab_class_validate(metaslab_cla void metaslab_class_histogram_verify(metaslab_class_t *); uint64_t metaslab_class_fragmentation(metaslab_class_t *); uint64_t metaslab_class_expandable_space(metaslab_class_t *); +boolean_t metaslab_class_throttle_reserve(metaslab_class_t *, int, + zio_t *, int); +void metaslab_class_throttle_unreserve(metaslab_class_t *, int, zio_t *); void metaslab_class_space_update(metaslab_class_t *, int64_t, int64_t, int64_t, int64_t); @@ -86,10 +90,13 @@ metaslab_group_t *metaslab_group_create( void metaslab_group_destroy(metaslab_group_t *); void metaslab_group_activate(metaslab_group_t *); void metaslab_group_passivate(metaslab_group_t *); +boolean_t metaslab_group_initialized(metaslab_group_t *); uint64_t metaslab_group_get_space(metaslab_group_t *); void metaslab_group_histogram_verify(metaslab_group_t *); uint64_t metaslab_group_fragmentation(metaslab_group_t *); void metaslab_group_histogram_remove(metaslab_group_t *, metaslab_t *); +void metaslab_group_alloc_decrement(spa_t *, uint64_t, void *, int); +void metaslab_group_alloc_verify(spa_t *, const blkptr_t *, void *); #ifdef __cplusplus } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Fri Oct 14 07:24:43 2016 (r307276) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Fri Oct 14 07:26:19 2016 (r307277) @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. */ #ifndef _SYS_METASLAB_IMPL_H @@ -59,11 +59,42 @@ extern "C" { * to use a block allocator that best suits that class. */ struct metaslab_class { + kmutex_t mc_lock; spa_t *mc_spa; metaslab_group_t *mc_rotor; metaslab_ops_t *mc_ops; uint64_t mc_aliquot; + + /* + * Track the number of metaslab groups that have been initialized + * and can accept allocations. An initialized metaslab group is + * one has been completely added to the config (i.e. we have + * updated the MOS config and the space has been added to the pool). + */ + uint64_t mc_groups; + + /* + * Toggle to enable/disable the allocation throttle. + */ + boolean_t mc_alloc_throttle_enabled; + + /* + * The allocation throttle works on a reservation system. Whenever + * an asynchronous zio wants to perform an allocation it must + * first reserve the number of blocks that it wants to allocate. + * If there aren't sufficient slots available for the pending zio + * then that I/O is throttled until more slots free up. The current + * number of reserved allocations is maintained by the mc_alloc_slots + * refcount. The mc_alloc_max_slots value determines the maximum + * number of allocations that the system allows. Gang blocks are + * allowed to reserve slots even if we've reached the maximum + * number of allocations allowed. + */ + uint64_t mc_alloc_max_slots; + refcount_t mc_alloc_slots; + uint64_t mc_alloc_groups; /* # of allocatable groups */ + uint64_t mc_alloc; /* total allocated space */ uint64_t mc_deferred; /* total deferred frees */ uint64_t mc_space; /* total space (alloc + free) */ @@ -86,6 +117,15 @@ struct metaslab_group { avl_tree_t mg_metaslab_tree; uint64_t mg_aliquot; boolean_t mg_allocatable; /* can we allocate? */ + + /* + * A metaslab group is considered to be initialized only after + * we have updated the MOS config and added the space to the pool. + * We only allow allocation attempts to a metaslab group if it + * has been initialized. + */ + boolean_t mg_initialized; + uint64_t mg_free_capacity; /* percentage free */ int64_t mg_bias; int64_t mg_activation_count; @@ -94,6 +134,27 @@ struct metaslab_group { taskq_t *mg_taskq; metaslab_group_t *mg_prev; metaslab_group_t *mg_next; + + /* + * Each metaslab group can handle mg_max_alloc_queue_depth allocations + * which are tracked by mg_alloc_queue_depth. It's possible for a + * metaslab group to handle more allocations than its max. This + * can occur when gang blocks are required or when other groups + * are unable to handle their share of allocations. + */ + uint64_t mg_max_alloc_queue_depth; + refcount_t mg_alloc_queue_depth; + + /* + * A metalab group that can no longer allocate the minimum block + * size will set mg_no_free_space. Once a metaslab group is out + * of space then its share of work must be distributed to other + * groups. + */ + boolean_t mg_no_free_space; + + uint64_t mg_allocations; + uint64_t mg_failed_allocations; uint64_t mg_fragmentation; uint64_t mg_histogram[RANGE_TREE_HISTOGRAM_SIZE]; }; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h Fri Oct 14 07:24:43 2016 (r307276) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h Fri Oct 14 07:26:19 2016 (r307277) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2015 by Delphix. All rights reserved. */ #ifndef _SYS_REFCOUNT_H @@ -64,6 +64,7 @@ typedef struct refcount { void refcount_create(refcount_t *rc); void refcount_create_untracked(refcount_t *rc); +void refcount_create_tracked(refcount_t *rc); void refcount_destroy(refcount_t *rc); void refcount_destroy_many(refcount_t *rc, uint64_t number); int refcount_is_zero(refcount_t *rc); @@ -74,6 +75,8 @@ int64_t refcount_add_many(refcount_t *rc int64_t refcount_remove_many(refcount_t *rc, uint64_t number, void *holder_tag); void refcount_transfer(refcount_t *dst, refcount_t *src); void refcount_transfer_ownership(refcount_t *, void *, void *); +boolean_t refcount_held(refcount_t *, void *); +boolean_t refcount_not_held(refcount_t *, void *); void refcount_sysinit(void); void refcount_fini(void); @@ -86,6 +89,7 @@ typedef struct refcount { #define refcount_create(rc) ((rc)->rc_count = 0) #define refcount_create_untracked(rc) ((rc)->rc_count = 0) +#define refcount_create_tracked(rc) ((rc)->rc_count = 0) #define refcount_destroy(rc) ((rc)->rc_count = 0) #define refcount_destroy_many(rc, number) ((rc)->rc_count = 0) #define refcount_is_zero(rc) ((rc)->rc_count == 0) @@ -102,6 +106,8 @@ typedef struct refcount { atomic_add_64(&(dst)->rc_count, __tmp); \ } #define refcount_transfer_ownership(rc, current_holder, new_holder) +#define refcount_held(rc, holder) ((rc)->rc_count > 0) +#define refcount_not_held(rc, holder) (B_TRUE) #define refcount_sysinit() #define refcount_fini() Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Fri Oct 14 07:24:43 2016 (r307276) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Fri Oct 14 07:26:19 2016 (r307277) @@ -165,6 +165,8 @@ struct spa { uint64_t spa_last_synced_guid; /* last synced guid */ list_t spa_config_dirty_list; /* vdevs with dirty config */ list_t spa_state_dirty_list; /* vdevs with dirty state */ + kmutex_t spa_alloc_lock; + avl_tree_t spa_alloc_tree; spa_aux_vdev_t spa_spares; /* hot spares */ spa_aux_vdev_t spa_l2cache; /* L2ARC cache devices */ nvlist_t *spa_label_features; /* Features for reading MOS */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Fri Oct 14 07:24:43 2016 (r307276) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Fri Oct 14 07:26:19 2016 (r307277) @@ -53,6 +53,9 @@ typedef struct vdev_queue vdev_queue_t; typedef struct vdev_cache vdev_cache_t; typedef struct vdev_cache_entry vdev_cache_entry_t; +extern int zfs_vdev_queue_depth_pct; +extern uint32_t zfs_vdev_async_write_max_active; + /* * Virtual device operations */ @@ -190,10 +193,21 @@ struct vdev { uint64_t vdev_deflate_ratio; /* deflation ratio (x512) */ uint64_t vdev_islog; /* is an intent log device */ uint64_t vdev_removing; /* device is being removed? */ - boolean_t vdev_ishole; /* is a hole in the namespace */ + boolean_t vdev_ishole; /* is a hole in the namespace */ + kmutex_t vdev_queue_lock; /* protects vdev_queue_depth */ uint64_t vdev_top_zap; /* + * The queue depth parameters determine how many async writes are + * still pending (i.e. allocated by net yet issued to disk) per + * top-level (vdev_async_write_queue_depth) and the maximum allowed + * (vdev_max_async_write_queue_depth). These values only apply to + * top-level vdevs. + */ + uint64_t vdev_async_write_queue_depth; + uint64_t vdev_max_async_write_queue_depth; + + /* * Leaf vdev state. */ range_tree_t *vdev_dtl[DTL_TYPES]; /* dirty time logs */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Oct 14 07:24:43 2016 (r307276) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Oct 14 07:26:19 2016 (r307277) @@ -175,6 +175,7 @@ enum zio_flag { ZIO_FLAG_DONT_CACHE = 1 << 11, ZIO_FLAG_NODATA = 1 << 12, ZIO_FLAG_INDUCE_DAMAGE = 1 << 13, + ZIO_FLAG_IO_ALLOCATING = 1 << 14, #define ZIO_FLAG_DDT_INHERIT (ZIO_FLAG_IO_RETRY - 1) #define ZIO_FLAG_GANG_INHERIT (ZIO_FLAG_IO_RETRY - 1) @@ -182,27 +183,27 @@ enum zio_flag { /* * Flags inherited by vdev children. */ - ZIO_FLAG_IO_RETRY = 1 << 14, /* must be first for INHERIT */ - ZIO_FLAG_PROBE = 1 << 15, - ZIO_FLAG_TRYHARD = 1 << 16, - ZIO_FLAG_OPTIONAL = 1 << 17, + ZIO_FLAG_IO_RETRY = 1 << 15, /* must be first for INHERIT */ + ZIO_FLAG_PROBE = 1 << 16, + ZIO_FLAG_TRYHARD = 1 << 17, + ZIO_FLAG_OPTIONAL = 1 << 18, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:27:32 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 045BDC1186A; Fri, 14 Oct 2016 07:27:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 973E4646; Fri, 14 Oct 2016 07:27:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7RU7A065148; Fri, 14 Oct 2016 07:27:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7RTci065138; Fri, 14 Oct 2016 07:27:29 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140727.u9E7RTci065138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 07:27:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307278 - in stable/11/sys/dev/hyperv: include vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:27:32 -0000 Author: sephe Date: Fri Oct 14 07:27:29 2016 New Revision: 307278 URL: https://svnweb.freebsd.org/changeset/base/307278 Log: MFC 302540 hyperv/vmbus: Implement a new set of APIs for post message Hypercall And use this new APIs for Initial Contact post message Hypercall. More post message Hypercalls will be converted. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6830 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_connection.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/hyperv.c stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h stable/11/sys/dev/hyperv/vmbus/hyperv_var.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 07:26:19 2016 (r307277) +++ stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 07:27:29 2016 (r307278) @@ -77,10 +77,6 @@ typedef uint8_t hv_bool_uint8_t; #define HV_VMBUS_VERSION_WIN8 ((2 << 16) | (4)) #define HV_VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) -#define HV_VMBUS_VERSION_INVALID -1 - -#define HV_VMBUS_VERSION_CURRENT HV_VMBUS_VERSION_WIN8_1 - /* * Make maximum size of pipe payload of 16K */ @@ -537,20 +533,6 @@ typedef struct { uint32_t child_rel_id; } __packed hv_vmbus_channel_relid_released; -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t vmbus_version_requested; - uint32_t padding2; - uint64_t interrupt_page; - uint64_t monitor_page_1; - uint64_t monitor_page_2; -} __packed hv_vmbus_channel_initiate_contact; - -typedef struct { - hv_vmbus_channel_msg_header header; - hv_bool_uint8_t version_supported; -} __packed hv_vmbus_channel_version_response; - typedef hv_vmbus_channel_msg_header hv_vmbus_channel_unload; #define HW_MACADDR_LEN 6 Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 07:26:19 2016 (r307277) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 07:27:29 2016 (r307278) @@ -40,29 +40,30 @@ * Internal functions */ -typedef void (*vmbus_msg_handler)(const hv_vmbus_channel_msg_header *msg); - typedef struct hv_vmbus_channel_msg_table_entry { hv_vmbus_channel_msg_type messageType; - vmbus_msg_handler messageHandler; + void (*messageHandler) + (struct vmbus_softc *sc, + const struct vmbus_message *msg); } hv_vmbus_channel_msg_table_entry; static void vmbus_channel_on_offer_internal(void *context); static void vmbus_channel_on_offer_rescind_internal(void *context); -static void vmbus_channel_on_offer(const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_open_result( - const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_offer_rescind( - const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_gpadl_created( - const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_gpadl_torndown( - const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_offers_delivered( - const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_version_response( - const hv_vmbus_channel_msg_header *hdr); +static void vmbus_channel_on_offer(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_open_result(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_offer_rescind(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_gpadl_created(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_gpadl_torndown(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_offers_delivered(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_version_response(struct vmbus_softc *, + const struct vmbus_message *); /** * Channel message dispatch table @@ -398,8 +399,11 @@ vmbus_channel_select_defcpu(struct hv_vm * object to process the offer synchronously */ static void -vmbus_channel_on_offer(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg) { + const hv_vmbus_channel_msg_header *hdr = + (const hv_vmbus_channel_msg_header *)msg->msg_data; + const hv_vmbus_channel_offer_channel *offer; hv_vmbus_channel_offer_channel *copied; @@ -476,8 +480,12 @@ vmbus_channel_on_offer_internal(void* co * synchronously */ static void -vmbus_channel_on_offer_rescind(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_offer_rescind(struct vmbus_softc *sc, + const struct vmbus_message *msg) { + const hv_vmbus_channel_msg_header *hdr = + (const hv_vmbus_channel_msg_header *)msg->msg_data; + const hv_vmbus_channel_rescind_offer *rescind; hv_vmbus_channel* channel; @@ -508,8 +516,8 @@ vmbus_channel_on_offer_rescind_internal( * @brief Invoked when all offers have been delivered. */ static void -vmbus_channel_on_offers_delivered( - const hv_vmbus_channel_msg_header *hdr __unused) +vmbus_channel_on_offers_delivered(struct vmbus_softc *sc __unused, + const struct vmbus_message *msg __unused) { mtx_lock(&vmbus_chwait_lock); @@ -526,8 +534,12 @@ vmbus_channel_on_offers_delivered( * response and signal the requesting thread. */ static void -vmbus_channel_on_open_result(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_open_result(struct vmbus_softc *sc, + const struct vmbus_message *msg) { + const hv_vmbus_channel_msg_header *hdr = + (const hv_vmbus_channel_msg_header *)msg->msg_data; + const hv_vmbus_channel_open_result *result; hv_vmbus_channel_msg_info* msg_info; hv_vmbus_channel_msg_header* requestHeader; @@ -568,8 +580,12 @@ vmbus_channel_on_open_result(const hv_vm * response and signal the requesting thread. */ static void -vmbus_channel_on_gpadl_created(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_gpadl_created(struct vmbus_softc *sc, + const struct vmbus_message *msg) { + const hv_vmbus_channel_msg_header *hdr = + (const hv_vmbus_channel_msg_header *)msg->msg_data; + const hv_vmbus_channel_gpadl_created *gpadl_created; hv_vmbus_channel_msg_info* msg_info; hv_vmbus_channel_msg_header* request_header; @@ -610,8 +626,12 @@ vmbus_channel_on_gpadl_created(const hv_ * response and signal the requesting thread */ static void -vmbus_channel_on_gpadl_torndown(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_gpadl_torndown(struct vmbus_softc *sc, + const struct vmbus_message *msg) { + const hv_vmbus_channel_msg_header *hdr = + (const hv_vmbus_channel_msg_header *)msg->msg_data; + const hv_vmbus_channel_gpadl_torndown *gpadl_torndown; hv_vmbus_channel_msg_info* msg_info; hv_vmbus_channel_msg_header* requestHeader; @@ -647,39 +667,11 @@ vmbus_channel_on_gpadl_torndown(const hv mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); } -/** - * @brief Version response handler. - * - * This is invoked when we received a response - * to our initiate contact request. Find the matching request, copy th - * response and signal the requesting thread. - */ static void -vmbus_channel_on_version_response(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_version_response(struct vmbus_softc *sc, + const struct vmbus_message *msg) { - hv_vmbus_channel_msg_info* msg_info; - hv_vmbus_channel_msg_header* requestHeader; - hv_vmbus_channel_initiate_contact* initiate; - const hv_vmbus_channel_version_response *versionResponse; - - versionResponse = (const hv_vmbus_channel_version_response *)hdr; - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, - msg_list_entry) { - requestHeader = (hv_vmbus_channel_msg_header*) msg_info->msg; - if (requestHeader->message_type - == HV_CHANNEL_MESSAGE_INITIATED_CONTACT) { - initiate = - (hv_vmbus_channel_initiate_contact*) requestHeader; - memcpy(&msg_info->response.version_response, - versionResponse, - sizeof(hv_vmbus_channel_version_response)); - sema_post(&msg_info->wait_sema); - } - } - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - + vmbus_msghc_wakeup(sc, msg); } /** @@ -865,5 +857,5 @@ vmbus_chan_msgproc(struct vmbus_softc *s entry = &g_channel_message_table[msg_type]; if (entry->messageHandler) - entry->messageHandler(hdr); + entry->messageHandler(sc, msg); } Modified: stable/11/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_connection.c Fri Oct 14 07:26:19 2016 (r307277) +++ stable/11/sys/dev/hyperv/vmbus/hv_connection.c Fri Oct 14 07:27:29 2016 (r307278) @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -49,97 +50,7 @@ hv_vmbus_connection hv_vmbus_g_connectio { .connect_state = HV_DISCONNECTED, .next_gpadl_handle = 0xE1E10, }; -uint32_t hv_vmbus_protocal_version = HV_VMBUS_VERSION_WS2008; - -static uint32_t -hv_vmbus_get_next_version(uint32_t current_ver) -{ - switch (current_ver) { - case (HV_VMBUS_VERSION_WIN7): - return(HV_VMBUS_VERSION_WS2008); - - case (HV_VMBUS_VERSION_WIN8): - return(HV_VMBUS_VERSION_WIN7); - - case (HV_VMBUS_VERSION_WIN8_1): - return(HV_VMBUS_VERSION_WIN8); - - case (HV_VMBUS_VERSION_WS2008): - default: - return(HV_VMBUS_VERSION_INVALID); - } -} - -/** - * Negotiate the highest supported hypervisor version. - */ -static int -hv_vmbus_negotiate_version(struct vmbus_softc *sc, - hv_vmbus_channel_msg_info *msg_info, uint32_t version) -{ - int ret = 0; - hv_vmbus_channel_initiate_contact *msg; - - sema_init(&msg_info->wait_sema, 0, "Msg Info Sema"); - msg = (hv_vmbus_channel_initiate_contact*) msg_info->msg; - - msg->header.message_type = HV_CHANNEL_MESSAGE_INITIATED_CONTACT; - msg->vmbus_version_requested = version; - - msg->interrupt_page = sc->vmbus_evtflags_dma.hv_paddr; - msg->monitor_page_1 = sc->vmbus_mnf1_dma.hv_paddr; - msg->monitor_page_2 = sc->vmbus_mnf2_dma.hv_paddr; - - /** - * Add to list before we send the request since we may receive the - * response before returning from this routine - */ - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - - TAILQ_INSERT_TAIL( - &hv_vmbus_g_connection.channel_msg_anchor, - msg_info, - msg_list_entry); - - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - - ret = hv_vmbus_post_message( - msg, - sizeof(hv_vmbus_channel_initiate_contact)); - - if (ret != 0) { - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_REMOVE( - &hv_vmbus_g_connection.channel_msg_anchor, - msg_info, - msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - return (ret); - } - - /** - * Wait for the connection response - */ - ret = sema_timedwait(&msg_info->wait_sema, 5 * hz); /* KYS 5 seconds */ - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_REMOVE( - &hv_vmbus_g_connection.channel_msg_anchor, - msg_info, - msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - - /** - * Check if successful - */ - if (msg_info->response.version_response.version_supported) { - hv_vmbus_g_connection.connect_state = HV_CONNECTED; - } else { - ret = ECONNREFUSED; - } - - return (ret); -} +uint32_t hv_vmbus_protocal_version; /** * Send a connect request on the partition service connection @@ -147,10 +58,6 @@ hv_vmbus_negotiate_version(struct vmbus_ int hv_vmbus_connect(struct vmbus_softc *sc) { - int ret = 0; - uint32_t version; - hv_vmbus_channel_msg_info* msg_info = NULL; - /** * Make sure we are not connecting or connected */ @@ -171,60 +78,12 @@ hv_vmbus_connect(struct vmbus_softc *sc) mtx_init(&hv_vmbus_g_connection.channel_lock, "vmbus channel", NULL, MTX_DEF); - msg_info = (hv_vmbus_channel_msg_info*) - malloc(sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_initiate_contact), - M_DEVBUF, M_WAITOK | M_ZERO); - hv_vmbus_g_connection.channels = malloc(sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); - /* - * Find the highest vmbus version number we can support. - */ - version = HV_VMBUS_VERSION_CURRENT; - - do { - ret = hv_vmbus_negotiate_version(sc, msg_info, version); - if (ret == EWOULDBLOCK) { - /* - * We timed out. - */ - goto cleanup; - } - - if (hv_vmbus_g_connection.connect_state == HV_CONNECTED) - break; - - version = hv_vmbus_get_next_version(version); - } while (version != HV_VMBUS_VERSION_INVALID); - - hv_vmbus_protocal_version = version; - if (bootverbose) - printf("VMBUS: Protocol Version: %d.%d\n", - version >> 16, version & 0xFFFF); - sema_destroy(&msg_info->wait_sema); - free(msg_info, M_DEVBUF); + hv_vmbus_g_connection.connect_state = HV_CONNECTED; return (0); - - /* - * Cleanup after failure! - */ - cleanup: - - hv_vmbus_g_connection.connect_state = HV_DISCONNECTED; - - mtx_destroy(&hv_vmbus_g_connection.channel_lock); - mtx_destroy(&hv_vmbus_g_connection.channel_msg_lock); - - if (msg_info) { - sema_destroy(&msg_info->wait_sema); - free(msg_info, M_DEVBUF); - } - - free(hv_vmbus_g_connection.channels, M_DEVBUF); - return (ret); } /** @@ -330,7 +189,7 @@ int hv_vmbus_post_message(void *buffer, */ for (retries = 0; retries < 20; retries++) { ret = hv_vmbus_post_msg_via_msg_ipc(connId, - VMBUS_MSGTYPE_CHANNEL, buffer, bufferLen); + HYPERV_MSGTYPE_CHANNEL, buffer, bufferLen); if (ret == HV_STATUS_SUCCESS) return (0); Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Oct 14 07:26:19 2016 (r307277) +++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Oct 14 07:27:29 2016 (r307278) @@ -95,7 +95,6 @@ typedef union { hv_vmbus_channel_open_result open_result; hv_vmbus_channel_gpadl_torndown gpadl_torndown; hv_vmbus_channel_gpadl_created gpadl_created; - hv_vmbus_channel_version_response version_response; } hv_vmbus_channel_msg_response; /* Modified: stable/11/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv.c Fri Oct 14 07:26:19 2016 (r307277) +++ stable/11/sys/dev/hyperv/vmbus/hyperv.c Fri Oct 14 07:27:29 2016 (r307278) @@ -118,6 +118,13 @@ hv_vmbus_do_hypercall(uint64_t value, vo in_paddr, out_paddr); } +uint64_t +hypercall_post_message(bus_addr_t msg_paddr) +{ + return hypercall_md(hypercall_context.hc_addr, + HYPERCALL_POST_MESSAGE, msg_paddr, 0); +} + /** * @brief Post a message using the hypervisor message IPC. * (This involves a hypercall.) Modified: stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h Fri Oct 14 07:26:19 2016 (r307277) +++ stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h Fri Oct 14 07:27:29 2016 (r307278) @@ -29,6 +29,8 @@ #ifndef _HYPERV_REG_H_ #define _HYPERV_REG_H_ +#include + /* * Hyper-V Synthetic MSRs */ @@ -130,4 +132,41 @@ #define CPUID_LEAF_HV_LIMITS 0x40000005 #define CPUID_LEAF_HV_HWFEATURES 0x40000006 +/* + * Hyper-V message types + */ +#define HYPERV_MSGTYPE_NONE 0 +#define HYPERV_MSGTYPE_CHANNEL 1 +#define HYPERV_MSGTYPE_TIMER_EXPIRED 0x80000010 + +/* + * Hypercall status codes + */ +#define HYPERCALL_STATUS_SUCCESS 0x0000 + +/* + * Hypercall input values + */ +#define HYPERCALL_POST_MESSAGE 0x005c + +/* + * Hypercall input parameters + */ + +/* + * HYPERCALL_POST_MESSAGE + */ +#define HYPERCALL_POSTMSGIN_DSIZE_MAX 240 +#define HYPERCALL_POSTMSGIN_SIZE 256 +#define HYPERCALL_POSTMSGIN_ALIGN 8 + +struct hypercall_postmsg_in { + uint32_t hc_connid; + uint32_t hc_rsvd; + uint32_t hc_msgtype; /* HYPERV_MSGTYPE_ */ + uint32_t hc_dsize; + uint8_t hc_data[HYPERCALL_POSTMSGIN_DSIZE_MAX]; +} __packed; +CTASSERT(sizeof(struct hypercall_postmsg_in) == HYPERCALL_POSTMSGIN_SIZE); + #endif /* !_HYPERV_REG_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/hyperv_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv_var.h Fri Oct 14 07:26:19 2016 (r307277) +++ stable/11/sys/dev/hyperv/vmbus/hyperv_var.h Fri Oct 14 07:27:29 2016 (r307278) @@ -38,4 +38,6 @@ extern u_int hyperv_features; extern u_int hyperv_recommends; +uint64_t hypercall_post_message(bus_addr_t msg_paddr); + #endif /* !_HYPERV_VAR_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 07:26:19 2016 (r307277) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 07:27:29 2016 (r307278) @@ -69,10 +69,354 @@ __FBSDID("$FreeBSD$"); #include #include "acpi_if.h" +/* + * NOTE: DO NOT CHANGE THESE + */ +#define VMBUS_CONNID_MESSAGE 1 +#define VMBUS_CONNID_EVENT 2 + +struct vmbus_msghc { + struct hypercall_postmsg_in *mh_inprm; + struct hypercall_postmsg_in mh_inprm_save; + struct hyperv_dma mh_inprm_dma; + + struct vmbus_message *mh_resp; + struct vmbus_message mh_resp0; +}; + +struct vmbus_msghc_ctx { + struct vmbus_msghc *mhc_free; + struct mtx mhc_free_lock; + uint32_t mhc_flags; + + struct vmbus_msghc *mhc_active; + struct mtx mhc_active_lock; +}; + +#define VMBUS_MSGHC_CTXF_DESTROY 0x0001 + +static int vmbus_init(struct vmbus_softc *); +static int vmbus_init_contact(struct vmbus_softc *, + uint32_t); + +static struct vmbus_msghc_ctx *vmbus_msghc_ctx_create(bus_dma_tag_t); +static void vmbus_msghc_ctx_destroy( + struct vmbus_msghc_ctx *); +static void vmbus_msghc_ctx_free(struct vmbus_msghc_ctx *); +static struct vmbus_msghc *vmbus_msghc_alloc(bus_dma_tag_t); +static void vmbus_msghc_free(struct vmbus_msghc *); +static struct vmbus_msghc *vmbus_msghc_get1(struct vmbus_msghc_ctx *, + uint32_t); + struct vmbus_softc *vmbus_sc; extern inthand_t IDTVEC(vmbus_isr); +static const uint32_t vmbus_version[] = { + HV_VMBUS_VERSION_WIN8_1, + HV_VMBUS_VERSION_WIN8, + HV_VMBUS_VERSION_WIN7, + HV_VMBUS_VERSION_WS2008 +}; + +static struct vmbus_msghc * +vmbus_msghc_alloc(bus_dma_tag_t parent_dtag) +{ + struct vmbus_msghc *mh; + + mh = malloc(sizeof(*mh), M_DEVBUF, M_WAITOK | M_ZERO); + + mh->mh_inprm = hyperv_dmamem_alloc(parent_dtag, + HYPERCALL_POSTMSGIN_ALIGN, 0, HYPERCALL_POSTMSGIN_SIZE, + &mh->mh_inprm_dma, BUS_DMA_WAITOK); + if (mh->mh_inprm == NULL) { + free(mh, M_DEVBUF); + return NULL; + } + return mh; +} + +static void +vmbus_msghc_free(struct vmbus_msghc *mh) +{ + hyperv_dmamem_free(&mh->mh_inprm_dma, mh->mh_inprm); + free(mh, M_DEVBUF); +} + +static void +vmbus_msghc_ctx_free(struct vmbus_msghc_ctx *mhc) +{ + KASSERT(mhc->mhc_active == NULL, ("still have active msg hypercall")); + KASSERT(mhc->mhc_free == NULL, ("still have hypercall msg")); + + mtx_destroy(&mhc->mhc_free_lock); + mtx_destroy(&mhc->mhc_active_lock); + free(mhc, M_DEVBUF); +} + +static struct vmbus_msghc_ctx * +vmbus_msghc_ctx_create(bus_dma_tag_t parent_dtag) +{ + struct vmbus_msghc_ctx *mhc; + + mhc = malloc(sizeof(*mhc), M_DEVBUF, M_WAITOK | M_ZERO); + mtx_init(&mhc->mhc_free_lock, "vmbus msghc free", NULL, MTX_DEF); + mtx_init(&mhc->mhc_active_lock, "vmbus msghc act", NULL, MTX_DEF); + + mhc->mhc_free = vmbus_msghc_alloc(parent_dtag); + if (mhc->mhc_free == NULL) { + vmbus_msghc_ctx_free(mhc); + return NULL; + } + return mhc; +} + +static struct vmbus_msghc * +vmbus_msghc_get1(struct vmbus_msghc_ctx *mhc, uint32_t dtor_flag) +{ + struct vmbus_msghc *mh; + + mtx_lock(&mhc->mhc_free_lock); + + while ((mhc->mhc_flags & dtor_flag) == 0 && mhc->mhc_free == NULL) { + mtx_sleep(&mhc->mhc_free, &mhc->mhc_free_lock, 0, + "gmsghc", 0); + } + if (mhc->mhc_flags & dtor_flag) { + /* Being destroyed */ + mh = NULL; + } else { + mh = mhc->mhc_free; + KASSERT(mh != NULL, ("no free hypercall msg")); + KASSERT(mh->mh_resp == NULL, + ("hypercall msg has pending response")); + mhc->mhc_free = NULL; + } + + mtx_unlock(&mhc->mhc_free_lock); + + return mh; +} + +struct vmbus_msghc * +vmbus_msghc_get(struct vmbus_softc *sc, size_t dsize) +{ + struct hypercall_postmsg_in *inprm; + struct vmbus_msghc *mh; + + if (dsize > HYPERCALL_POSTMSGIN_DSIZE_MAX) + return NULL; + + mh = vmbus_msghc_get1(sc->vmbus_msg_hc, VMBUS_MSGHC_CTXF_DESTROY); + if (mh == NULL) + return NULL; + + inprm = mh->mh_inprm; + memset(inprm, 0, HYPERCALL_POSTMSGIN_SIZE); + inprm->hc_connid = VMBUS_CONNID_MESSAGE; + inprm->hc_msgtype = HYPERV_MSGTYPE_CHANNEL; + inprm->hc_dsize = dsize; + + return mh; +} + +void +vmbus_msghc_put(struct vmbus_softc *sc, struct vmbus_msghc *mh) +{ + struct vmbus_msghc_ctx *mhc = sc->vmbus_msg_hc; + + KASSERT(mhc->mhc_active == NULL, ("msg hypercall is active")); + mh->mh_resp = NULL; + + mtx_lock(&mhc->mhc_free_lock); + KASSERT(mhc->mhc_free == NULL, ("has free hypercall msg")); + mhc->mhc_free = mh; + mtx_unlock(&mhc->mhc_free_lock); + wakeup(&mhc->mhc_free); +} + +void * +vmbus_msghc_dataptr(struct vmbus_msghc *mh) +{ + return mh->mh_inprm->hc_data; +} + +static void +vmbus_msghc_ctx_destroy(struct vmbus_msghc_ctx *mhc) +{ + struct vmbus_msghc *mh; + + mtx_lock(&mhc->mhc_free_lock); + mhc->mhc_flags |= VMBUS_MSGHC_CTXF_DESTROY; + mtx_unlock(&mhc->mhc_free_lock); + wakeup(&mhc->mhc_free); + + mh = vmbus_msghc_get1(mhc, 0); + if (mh == NULL) + panic("can't get msghc"); + + vmbus_msghc_free(mh); + vmbus_msghc_ctx_free(mhc); +} + +int +vmbus_msghc_exec_noresult(struct vmbus_msghc *mh) +{ + sbintime_t time = SBT_1MS; + int i; + + /* + * Save the input parameter so that we could restore the input + * parameter if the Hypercall failed. + * + * XXX + * Is this really necessary?! i.e. Will the Hypercall ever + * overwrite the input parameter? + */ + memcpy(&mh->mh_inprm_save, mh->mh_inprm, HYPERCALL_POSTMSGIN_SIZE); + + /* + * In order to cope with transient failures, e.g. insufficient + * resources on host side, we retry the post message Hypercall + * several times. 20 retries seem sufficient. + */ +#define HC_RETRY_MAX 20 + + for (i = 0; i < HC_RETRY_MAX; ++i) { + uint64_t status; + + status = hypercall_post_message(mh->mh_inprm_dma.hv_paddr); + if (status == HYPERCALL_STATUS_SUCCESS) + return 0; + + pause_sbt("hcpmsg", time, 0, C_HARDCLOCK); + if (time < SBT_1S * 2) + time *= 2; + + /* Restore input parameter and try again */ + memcpy(mh->mh_inprm, &mh->mh_inprm_save, + HYPERCALL_POSTMSGIN_SIZE); + } + +#undef HC_RETRY_MAX + + return EIO; +} + +int +vmbus_msghc_exec(struct vmbus_softc *sc, struct vmbus_msghc *mh) +{ + struct vmbus_msghc_ctx *mhc = sc->vmbus_msg_hc; + int error; + + KASSERT(mh->mh_resp == NULL, ("hypercall msg has pending response")); + + mtx_lock(&mhc->mhc_active_lock); + KASSERT(mhc->mhc_active == NULL, ("pending active msg hypercall")); + mhc->mhc_active = mh; + mtx_unlock(&mhc->mhc_active_lock); + + error = vmbus_msghc_exec_noresult(mh); + if (error) { + mtx_lock(&mhc->mhc_active_lock); + KASSERT(mhc->mhc_active == mh, ("msghc mismatch")); + mhc->mhc_active = NULL; + mtx_unlock(&mhc->mhc_active_lock); + } + return error; +} + +const struct vmbus_message * +vmbus_msghc_wait_result(struct vmbus_softc *sc, struct vmbus_msghc *mh) +{ + struct vmbus_msghc_ctx *mhc = sc->vmbus_msg_hc; + + mtx_lock(&mhc->mhc_active_lock); + + KASSERT(mhc->mhc_active == mh, ("msghc mismatch")); + while (mh->mh_resp == NULL) { + mtx_sleep(&mhc->mhc_active, &mhc->mhc_active_lock, 0, + "wmsghc", 0); + } + mhc->mhc_active = NULL; + + mtx_unlock(&mhc->mhc_active_lock); + + return mh->mh_resp; +} + +void +vmbus_msghc_wakeup(struct vmbus_softc *sc, const struct vmbus_message *msg) +{ + struct vmbus_msghc_ctx *mhc = sc->vmbus_msg_hc; + struct vmbus_msghc *mh; + + mtx_lock(&mhc->mhc_active_lock); + + mh = mhc->mhc_active; + KASSERT(mh != NULL, ("no pending msg hypercall")); + memcpy(&mh->mh_resp0, msg, sizeof(mh->mh_resp0)); + mh->mh_resp = &mh->mh_resp0; + + mtx_unlock(&mhc->mhc_active_lock); + wakeup(&mhc->mhc_active); +} + +static int +vmbus_init_contact(struct vmbus_softc *sc, uint32_t version) +{ + struct vmbus_chanmsg_init_contact *req; + const struct vmbus_chanmsg_version_resp *resp; + const struct vmbus_message *msg; + struct vmbus_msghc *mh; + int error, supp = 0; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) + return ENXIO; + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_INIT_CONTACT; + req->chm_ver = version; + req->chm_evtflags = sc->vmbus_evtflags_dma.hv_paddr; + req->chm_mnf1 = sc->vmbus_mnf1_dma.hv_paddr; + req->chm_mnf2 = sc->vmbus_mnf2_dma.hv_paddr; + + error = vmbus_msghc_exec(sc, mh); + if (error) { + vmbus_msghc_put(sc, mh); + return error; + } + + msg = vmbus_msghc_wait_result(sc, mh); + resp = (const struct vmbus_chanmsg_version_resp *)msg->msg_data; + supp = resp->chm_supp; + + vmbus_msghc_put(sc, mh); + + return (supp ? 0 : EOPNOTSUPP); +} + +static int +vmbus_init(struct vmbus_softc *sc) +{ + int i; + + for (i = 0; i < nitems(vmbus_version); ++i) { + int error; + + error = vmbus_init_contact(sc, vmbus_version[i]); + if (!error) { + hv_vmbus_protocal_version = vmbus_version[i]; + device_printf(sc->vmbus_dev, "version %u.%u\n", + (hv_vmbus_protocal_version >> 16), + (hv_vmbus_protocal_version & 0xffff)); + return 0; + } + } + return ENXIO; +} + static void vmbus_msg_task(void *xsc, int pending __unused) { @@ -81,19 +425,19 @@ vmbus_msg_task(void *xsc, int pending __ msg = VMBUS_PCPU_GET(sc, message, curcpu) + VMBUS_SINT_MESSAGE; for (;;) { - if (msg->msg_type == VMBUS_MSGTYPE_NONE) { + if (msg->msg_type == HYPERV_MSGTYPE_NONE) { /* No message */ break; - } else if (msg->msg_type == VMBUS_MSGTYPE_CHANNEL) { + } else if (msg->msg_type == HYPERV_MSGTYPE_CHANNEL) { /* Channel message */ vmbus_chan_msgproc(sc, __DEVOLATILE(const struct vmbus_message *, msg)); } - msg->msg_type = VMBUS_MSGTYPE_NONE; + msg->msg_type = HYPERV_MSGTYPE_NONE; /* * Make sure the write to msg_type (i.e. set to - * VMBUS_MSGTYPE_NONE) happens before we read the + * HYPERV_MSGTYPE_NONE) happens before we read the * msg_flags and EOMing. Otherwise, the EOMing will * not deliver any more messages since there is no * empty slot @@ -127,14 +471,14 @@ vmbus_handle_intr1(struct vmbus_softc *s * TODO: move this to independent IDT vector. */ msg = msg_base + VMBUS_SINT_TIMER; - if (msg->msg_type == VMBUS_MSGTYPE_TIMER_EXPIRED) { - msg->msg_type = VMBUS_MSGTYPE_NONE; + if (msg->msg_type == HYPERV_MSGTYPE_TIMER_EXPIRED) { + msg->msg_type = HYPERV_MSGTYPE_NONE; vmbus_et_intr(frame); /* * Make sure the write to msg_type (i.e. set to - * VMBUS_MSGTYPE_NONE) happens before we read the + * HYPERV_MSGTYPE_NONE) happens before we read the * msg_flags and EOMing. Otherwise, the EOMing will * not deliver any more messages since there is no * empty slot @@ -166,7 +510,7 @@ vmbus_handle_intr1(struct vmbus_softc *s * Check messages. Mainly management stuffs; ultra low rate. */ msg = msg_base + VMBUS_SINT_MESSAGE; - if (__predict_false(msg->msg_type != VMBUS_MSGTYPE_NONE)) { + if (__predict_false(msg->msg_type != HYPERV_MSGTYPE_NONE)) { taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu), VMBUS_PCPU_PTR(sc, message_task, cpu)); } @@ -620,6 +964,16 @@ vmbus_bus_init(void) sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; /* + * Create context for "post message" Hypercalls + */ + sc->vmbus_msg_hc = vmbus_msghc_ctx_create( + bus_get_dma_tag(sc->vmbus_dev)); + if (sc->vmbus_msg_hc == NULL) { + ret = ENXIO; + goto cleanup; + } + + /* * Allocate DMA stuffs. */ ret = vmbus_dma_alloc(sc); @@ -648,6 +1002,10 @@ vmbus_bus_init(void) if (ret != 0) goto cleanup; + ret = vmbus_init(sc); + if (ret != 0) + goto cleanup; + if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 || hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) sc->vmbus_event_proc = vmbus_event_proc_compat; @@ -665,6 +1023,10 @@ vmbus_bus_init(void) cleanup: vmbus_intr_teardown(sc); vmbus_dma_free(sc); + if (sc->vmbus_msg_hc != NULL) { + vmbus_msghc_ctx_destroy(sc->vmbus_msg_hc); + sc->vmbus_msg_hc = NULL; + } return (ret); } @@ -737,6 +1099,11 @@ vmbus_detach(device_t dev) vmbus_intr_teardown(sc); vmbus_dma_free(sc); + if (sc->vmbus_msg_hc != NULL) { + vmbus_msghc_ctx_destroy(sc->vmbus_msg_hc); + sc->vmbus_msg_hc = NULL; + } + return (0); } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Oct 14 07:26:19 2016 (r307277) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Oct 14 07:27:29 2016 (r307278) @@ -39,7 +39,7 @@ #define VMBUS_MSG_SIZE 256 struct vmbus_message { - uint32_t msg_type; /* VMBUS_MSGTYPE_ */ + uint32_t msg_type; /* HYPERV_MSGTYPE_ */ uint8_t msg_dsize; /* data size */ uint8_t msg_flags; /* VMBUS_MSGFLAG_ */ uint16_t msg_rsvd; @@ -48,10 +48,6 @@ struct vmbus_message { } __packed; CTASSERT(sizeof(struct vmbus_message) == VMBUS_MSG_SIZE); -#define VMBUS_MSGTYPE_NONE 0 -#define VMBUS_MSGTYPE_CHANNEL 1 -#define VMBUS_MSGTYPE_TIMER_EXPIRED 0x80000010 - #define VMBUS_MSGFLAG_PENDING 0x01 /* @@ -81,4 +77,34 @@ CTASSERT(sizeof(struct vmbus_evtflags) = #define VMBUS_CHAN_MAX_COMPAT 256 #define VMBUS_CHAN_MAX (VMBUS_EVTFLAG_LEN * VMBUS_EVTFLAGS_MAX) +/* + * Channel messages + * - Embedded in vmbus_message.msg_data, e.g. response. + * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. + */ + +#define VMBUS_CHANMSG_TYPE_INIT_CONTACT 14 /* REQ */ +#define VMBUS_CHANMSG_TYPE_VERSION_RESP 15 /* RESP */ + +struct vmbus_chanmsg_hdr { + uint32_t chm_type; /* VMBUS_CHANMSG_TYPE_ */ + uint32_t chm_rsvd; +} __packed; + +/* VMBUS_CHANMSG_TYPE_INIT_CONTACT */ +struct vmbus_chanmsg_init_contact { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_ver; + uint32_t chm_rsvd; + uint64_t chm_evtflags; + uint64_t chm_mnf1; + uint64_t chm_mnf2; +} __packed; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:28:45 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B648C1194D; Fri, 14 Oct 2016 07:28:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5CE29A9; Fri, 14 Oct 2016 07:28:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7ShVv065312; Fri, 14 Oct 2016 07:28:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7SheF065311; Fri, 14 Oct 2016 07:28:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140728.u9E7SheF065311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:28:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307280 - stable/11/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:28:45 -0000 Author: mav Date: Fri Oct 14 07:28:43 2016 New Revision: 307280 URL: https://svnweb.freebsd.org/changeset/base/307280 Log: MFC r305332: MFV r304159: 7277 zdb should be able to print zfs_dbgmsg's illumos/illumos-gate@29bdd2f916366ece37c4748bca6b3d61f57a223b https://github.com/illumos/illumos-gate/commit/29bdd2f916366ece37c4748bca6b3d61f 57a223b https://www.illumos.org/issues/7277 ztest always prints the debug messages (zfs_dbgmsg()) by calling zfs_dbgmsg_print(). We should add a flag to zdb to make it do this as well before exiting. Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Igor Kozhukhov Approved by: Dan McDonald Author: Pavel Zakharov Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct 14 07:27:40 2016 (r307279) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct 14 07:28:43 2016 (r307280) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -117,7 +117,7 @@ static void usage(void) { (void) fprintf(stderr, - "Usage: %s [-CumMdibcsDvhLXFPA] [-t txg] [-e [-p path...]] " + "Usage: %s [-CumMdibcsDvhLXFPAG] [-t txg] [-e [-p path...]] " "[-U config] [-I inflight I/Os] [-x dumpdir] poolname [object...]\n" " %s [-divPA] [-e -p path...] [-U config] dataset " "[object...]\n" @@ -178,12 +178,23 @@ usage(void) (void) fprintf(stderr, " -I -- " "specify the maximum number of " "checksumming I/Os [default is 200]\n"); + (void) fprintf(stderr, " -G dump zfs_dbgmsg buffer before " + "exiting\n"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " "to make only that option verbose\n"); (void) fprintf(stderr, "Default is to dump everything non-verbosely\n"); exit(1); } +static void +dump_debug_buffer() +{ + if (dump_opt['G']) { + (void) printf("\n"); + zfs_dbgmsg_print("zdb"); + } +} + /* * Called for usage errors that are discovered after a call to spa_open(), * dmu_bonus_hold(), or pool_match(). abort() is called for other errors. @@ -200,6 +211,8 @@ fatal(const char *fmt, ...) va_end(ap); (void) fprintf(stderr, "\n"); + dump_debug_buffer(); + exit(1); } @@ -3103,8 +3116,10 @@ dump_zpool(spa_t *spa) if (dump_opt['h']) dump_history(spa); - if (rc != 0) + if (rc != 0) { + dump_debug_buffer(); exit(rc); + } } #define ZDB_FLAG_CHECKSUM 0x0001 @@ -3575,7 +3590,7 @@ main(int argc, char **argv) spa_config_path = spa_config_path_env; while ((c = getopt(argc, argv, - "bcdhilmMI:suCDRSAFLXx:evp:t:U:P")) != -1) { + "bcdhilmMI:suCDRSAFLXx:evp:t:U:PG")) != -1) { switch (c) { case 'b': case 'c': @@ -3591,6 +3606,7 @@ main(int argc, char **argv) case 'M': case 'R': case 'S': + case 'G': dump_opt[c]++; dump_all = 0; break; @@ -3826,6 +3842,8 @@ main(int argc, char **argv) fuid_table_destroy(); sa_loaded = B_FALSE; + dump_debug_buffer(); + libzfs_fini(g_zfs); kernel_fini(); From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:30:17 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95B08C11A16; Fri, 14 Oct 2016 07:30:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49C81C7D; Fri, 14 Oct 2016 07:30:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7UGhT065504; Fri, 14 Oct 2016 07:30:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7UGiw065502; Fri, 14 Oct 2016 07:30:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140730.u9E7UGiw065502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:30:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307282 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:30:17 -0000 Author: mav Date: Fri Oct 14 07:30:16 2016 New Revision: 307282 URL: https://svnweb.freebsd.org/changeset/base/307282 Log: MFC r305333: MFV r304156: 7235 remove unused func dsl_dataset_set_blkptr illumos/illumos-gate@bd56f80007857b960e0981ed0797ad8ec844a96b https://github.com/illumos/illumos-gate/commit/bd56f80007857b960e0981ed0797ad8ec 844a96b https://www.illumos.org/issues/7235 The function dsl_dataset_set_blkptr() is unused. We should remove it. Reviewed by: George Wilson Reviewed by: Alex Reece Reviewed by: Prakash Surya Reviewed by: Igor Kozhukhov Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Oct 14 07:29:23 2016 (r307281) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Oct 14 07:30:16 2016 (r307282) @@ -1060,19 +1060,6 @@ dsl_dataset_get_blkptr(dsl_dataset_t *ds return (&dsl_dataset_phys(ds)->ds_bp); } -void -dsl_dataset_set_blkptr(dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx) -{ - ASSERT(dmu_tx_is_syncing(tx)); - /* If it's the meta-objset, set dp_meta_rootbp */ - if (ds == NULL) { - tx->tx_pool->dp_meta_rootbp = *bp; - } else { - dmu_buf_will_dirty(ds->ds_dbuf, tx); - dsl_dataset_phys(ds)->ds_bp = *bp; - } -} - spa_t * dsl_dataset_get_spa(dsl_dataset_t *ds) { Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Fri Oct 14 07:29:23 2016 (r307281) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Fri Oct 14 07:30:16 2016 (r307282) @@ -272,7 +272,6 @@ int dsl_dataset_snapshot_tmp(const char minor_t cleanup_minor, const char *htag); blkptr_t *dsl_dataset_get_blkptr(dsl_dataset_t *ds); -void dsl_dataset_set_blkptr(dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx); spa_t *dsl_dataset_get_spa(dsl_dataset_t *ds); From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:31:48 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD6AEC11B8E; Fri, 14 Oct 2016 07:31:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A68E810C5; Fri, 14 Oct 2016 07:31:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7VlIM068970; Fri, 14 Oct 2016 07:31:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7VlE0068956; Fri, 14 Oct 2016 07:31:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140731.u9E7VlE0068956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:31:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307284 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:31:48 -0000 Author: mav Date: Fri Oct 14 07:31:47 2016 New Revision: 307284 URL: https://svnweb.freebsd.org/changeset/base/307284 Log: MFC r305334: MFV r304157: 7230 add assertions to dmu_send_impl() to verify that stream includes BEGIN and END records illumos/illumos-gate@12b90ee2d3b10689fc45f4930d2392f5fe1d9cfa https://github.com/illumos/illumos-gate/commit/12b90ee2d3b10689fc45f4930d2392f5f e1d9cfa https://www.illumos.org/issues/7230 A test failure occurred where a send stream had only a BEGIN record. This should not be possible if the send returns without error. Prevented this from happening in the future by adding an assertion to dmu_send_impl() to verify that if the function returns 0 (success) both a BEGIN and END record are present. Did this by adding flags to dmu_sendarg_t (indicating whether BEGIN o r END records sent), having dump_record() set flags appropriately, adding VERIFY statement to dmu_send_impl(). Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Igor Kozhukhov Approved by: Robert Mustacchi Author: Matt Krantz Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Oct 14 07:30:54 2016 (r307283) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Oct 14 07:31:47 2016 (r307284) @@ -160,11 +160,16 @@ dump_record(dmu_sendarg_t *dsp, void *pa fletcher_4_incremental_native(dsp->dsa_drr, offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum), &dsp->dsa_zc); - if (dsp->dsa_drr->drr_type != DRR_BEGIN) { + if (dsp->dsa_drr->drr_type == DRR_BEGIN) { + dsp->dsa_sent_begin = B_TRUE; + } else { ASSERT(ZIO_CHECKSUM_IS_ZERO(&dsp->dsa_drr->drr_u. drr_checksum.drr_checksum)); dsp->dsa_drr->drr_u.drr_checksum.drr_checksum = dsp->dsa_zc; } + if (dsp->dsa_drr->drr_type == DRR_END) { + dsp->dsa_sent_end = B_TRUE; + } fletcher_4_incremental_native(&dsp->dsa_drr-> drr_u.drr_checksum.drr_checksum, sizeof (zio_cksum_t), &dsp->dsa_zc); @@ -912,6 +917,8 @@ out: list_remove(&to_ds->ds_sendstreams, dsp); mutex_exit(&to_ds->ds_sendstream_lock); + VERIFY(err != 0 || (dsp->dsa_sent_begin && dsp->dsa_sent_end)); + kmem_free(drr, sizeof (dmu_replay_record_t)); kmem_free(dsp, sizeof (dmu_sendarg_t)); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h Fri Oct 14 07:30:54 2016 (r307283) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h Fri Oct 14 07:31:47 2016 (r307284) @@ -301,6 +301,8 @@ typedef struct dmu_sendarg { uint64_t dsa_last_data_offset; uint64_t dsa_resume_object; uint64_t dsa_resume_offset; + boolean_t dsa_sent_begin; + boolean_t dsa_sent_end; } dmu_sendarg_t; void dmu_object_zapify(objset_t *, uint64_t, dmu_object_type_t, dmu_tx_t *); From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:33:37 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF30BC11CA5; Fri, 14 Oct 2016 07:33:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8EF21497; Fri, 14 Oct 2016 07:33:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7Xa4R069192; Fri, 14 Oct 2016 07:33:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7XaKp069186; Fri, 14 Oct 2016 07:33:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140733.u9E7XaKp069186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307286 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:33:38 -0000 Author: mav Date: Fri Oct 14 07:33:36 2016 New Revision: 307286 URL: https://svnweb.freebsd.org/changeset/base/307286 Log: MFC r305338: MFV r305335: 7003 zap_lockdir() should tag hold zap_lockdir() / zap_unlockdir() should take a "void *tag" argument which tags the hold on the zap. This will help diagnose programming errors which misuse the hold on the ZAP. Sponsored by: Intel Corp. Closes #108 Reviewed by: Pavel Zakharov Reviewed by: Steve Gonczi Reviewed by: George Wilson Reviewed by: Brian Behlendorf Author: Matthew Ahrens openzfs/openzfs@0780b3eab5a2c13e04328b39ecd2a6d0d3c4f7cb Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Oct 14 07:32:24 2016 (r307285) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Oct 14 07:33:36 2016 (r307286) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -2903,6 +2903,13 @@ dmu_buf_get_blkptr(dmu_buf_t *db) return (dbi->db_blkptr); } +objset_t * +dmu_buf_get_objset(dmu_buf_t *db) +{ + dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db; + return (dbi->db_objset); +} + static void dbuf_check_blkptr(dnode_t *dn, dmu_buf_impl_t *db) { Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Oct 14 07:32:24 2016 (r307285) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Oct 14 07:33:36 2016 (r307286) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright 2013 DEY Storage Systems, Inc. @@ -617,6 +617,8 @@ void *dmu_buf_remove_user(dmu_buf_t *db, */ void *dmu_buf_get_user(dmu_buf_t *db); +objset_t *dmu_buf_get_objset(dmu_buf_t *db); + /* Block until any in-progress dmu buf user evictions complete. */ void dmu_buf_user_evict_wait(void); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h Fri Oct 14 07:32:24 2016 (r307285) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h Fri Oct 14 07:33:36 2016 (r307286) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013, 2015 by Delphix. All rights reserved. + * Copyright (c) 2013, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -197,8 +197,8 @@ typedef struct zap_name { boolean_t zap_match(zap_name_t *zn, const char *matchname); int zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx, - krw_t lti, boolean_t fatreader, boolean_t adding, zap_t **zapp); -void zap_unlockdir(zap_t *zap); + krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp); +void zap_unlockdir(zap_t *zap, void *tag); void zap_evict(void *dbu); zap_name_t *zap_name_alloc(zap_t *zap, const char *key, matchtype_t mt); void zap_name_free(zap_name_t *zn); @@ -217,9 +217,10 @@ void fzap_prefetch(zap_name_t *zn); int fzap_count_write(zap_name_t *zn, int add, refcount_t *towrite, refcount_t *tooverwrite); int fzap_add(zap_name_t *zn, uint64_t integer_size, uint64_t num_integers, - const void *val, dmu_tx_t *tx); + const void *val, void *tag, dmu_tx_t *tx); int fzap_update(zap_name_t *zn, - int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx); + int integer_size, uint64_t num_integers, const void *val, + void *tag, dmu_tx_t *tx); int fzap_length(zap_name_t *zn, uint64_t *integer_size, uint64_t *num_integers); int fzap_remove(zap_name_t *zn, dmu_tx_t *tx); @@ -229,7 +230,7 @@ void zap_put_leaf(struct zap_leaf *l); int fzap_add_cd(zap_name_t *zn, uint64_t integer_size, uint64_t num_integers, - const void *val, uint32_t cd, dmu_tx_t *tx); + const void *val, uint32_t cd, void *tag, dmu_tx_t *tx); void fzap_upgrade(zap_t *zap, dmu_tx_t *tx, zap_flags_t flags); int fzap_cursor_move_to_key(zap_cursor_t *zc, zap_name_t *zn); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Fri Oct 14 07:32:24 2016 (r307285) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Fri Oct 14 07:33:36 2016 (r307286) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ @@ -596,7 +596,8 @@ zap_deref_leaf(zap_t *zap, uint64_t h, d } static int -zap_expand_leaf(zap_name_t *zn, zap_leaf_t *l, dmu_tx_t *tx, zap_leaf_t **lp) +zap_expand_leaf(zap_name_t *zn, zap_leaf_t *l, + void *tag, dmu_tx_t *tx, zap_leaf_t **lp) { zap_t *zap = zn->zn_zap; uint64_t hash = zn->zn_hash; @@ -618,9 +619,9 @@ zap_expand_leaf(zap_name_t *zn, zap_leaf uint64_t object = zap->zap_object; zap_put_leaf(l); - zap_unlockdir(zap); + zap_unlockdir(zap, tag); err = zap_lockdir(os, object, tx, RW_WRITER, - FALSE, FALSE, &zn->zn_zap); + FALSE, FALSE, tag, &zn->zn_zap); zap = zn->zn_zap; if (err) return (err); @@ -683,7 +684,8 @@ zap_expand_leaf(zap_name_t *zn, zap_leaf } static void -zap_put_leaf_maybe_grow_ptrtbl(zap_name_t *zn, zap_leaf_t *l, dmu_tx_t *tx) +zap_put_leaf_maybe_grow_ptrtbl(zap_name_t *zn, zap_leaf_t *l, + void *tag, dmu_tx_t *tx) { zap_t *zap = zn->zn_zap; int shift = zap_f_phys(zap)->zap_ptrtbl.zt_shift; @@ -703,9 +705,9 @@ zap_put_leaf_maybe_grow_ptrtbl(zap_name_ objset_t *os = zap->zap_objset; uint64_t zapobj = zap->zap_object; - zap_unlockdir(zap); + zap_unlockdir(zap, tag); err = zap_lockdir(os, zapobj, tx, - RW_WRITER, FALSE, FALSE, &zn->zn_zap); + RW_WRITER, FALSE, FALSE, tag, &zn->zn_zap); zap = zn->zn_zap; if (err) return; @@ -795,7 +797,7 @@ fzap_lookup(zap_name_t *zn, int fzap_add_cd(zap_name_t *zn, uint64_t integer_size, uint64_t num_integers, - const void *val, uint32_t cd, dmu_tx_t *tx) + const void *val, uint32_t cd, void *tag, dmu_tx_t *tx) { zap_leaf_t *l; int err; @@ -824,7 +826,7 @@ retry: if (err == 0) { zap_increment_num_entries(zap, 1, tx); } else if (err == EAGAIN) { - err = zap_expand_leaf(zn, l, tx, &l); + err = zap_expand_leaf(zn, l, tag, tx, &l); zap = zn->zn_zap; /* zap_expand_leaf() may change zap */ if (err == 0) goto retry; @@ -832,26 +834,27 @@ retry: out: if (zap != NULL) - zap_put_leaf_maybe_grow_ptrtbl(zn, l, tx); + zap_put_leaf_maybe_grow_ptrtbl(zn, l, tag, tx); return (err); } int fzap_add(zap_name_t *zn, uint64_t integer_size, uint64_t num_integers, - const void *val, dmu_tx_t *tx) + const void *val, void *tag, dmu_tx_t *tx) { int err = fzap_check(zn, integer_size, num_integers); if (err != 0) return (err); return (fzap_add_cd(zn, integer_size, num_integers, - val, ZAP_NEED_CD, tx)); + val, ZAP_NEED_CD, tag, tx)); } int fzap_update(zap_name_t *zn, - int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx) + int integer_size, uint64_t num_integers, const void *val, + void *tag, dmu_tx_t *tx) { zap_leaf_t *l; int err, create; @@ -881,14 +884,14 @@ retry: } if (err == EAGAIN) { - err = zap_expand_leaf(zn, l, tx, &l); + err = zap_expand_leaf(zn, l, tag, tx, &l); zap = zn->zn_zap; /* zap_expand_leaf() may change zap */ if (err == 0) goto retry; } if (zap != NULL) - zap_put_leaf_maybe_grow_ptrtbl(zn, l, tx); + zap_put_leaf_maybe_grow_ptrtbl(zn, l, tag, tx); return (err); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Fri Oct 14 07:32:24 2016 (r307285) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Fri Oct 14 07:33:36 2016 (r307286) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -43,7 +43,8 @@ extern inline mzap_phys_t *zap_m_phys(zap_t *zap); -static int mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, zap_flags_t flags); +static int mzap_upgrade(zap_t **zapp, + void *tag, dmu_tx_t *tx, zap_flags_t flags); uint64_t zap_getflags(zap_t *zap) @@ -468,20 +469,18 @@ handle_winner: return (winner); } -int -zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx, +static int +zap_lockdir_impl(dmu_buf_t *db, void *tag, dmu_tx_t *tx, krw_t lti, boolean_t fatreader, boolean_t adding, zap_t **zapp) { zap_t *zap; - dmu_buf_t *db; krw_t lt; - int err; - *zapp = NULL; + ASSERT0(db->db_offset); + objset_t *os = dmu_buf_get_objset(db); + uint64_t obj = db->db_object; - err = dmu_buf_hold(os, obj, 0, NULL, &db, DMU_READ_NO_PREFETCH); - if (err) - return (err); + *zapp = NULL; #ifdef ZFS_DEBUG { @@ -499,7 +498,6 @@ zap_lockdir(objset_t *os, uint64_t obj, * mzap_open() didn't like what it saw on-disk. * Check for corruption! */ - dmu_buf_rele(db, NULL); return (SET_ERROR(EIO)); } } @@ -538,10 +536,12 @@ zap_lockdir(objset_t *os, uint64_t obj, dprintf("upgrading obj %llu: num_entries=%u\n", obj, zap->zap_m.zap_num_entries); *zapp = zap; - return (mzap_upgrade(zapp, tx, 0)); + int err = mzap_upgrade(zapp, tag, tx, 0); + if (err != 0) + rw_exit(&zap->zap_rwlock); + return (err); } - err = dmu_object_set_blocksize(os, obj, newsz, 0, tx); - ASSERT0(err); + VERIFY0(dmu_object_set_blocksize(os, obj, newsz, 0, tx)); zap->zap_m.zap_num_chunks = db->db_size / MZAP_ENT_LEN - 1; } @@ -550,15 +550,31 @@ zap_lockdir(objset_t *os, uint64_t obj, return (0); } +int +zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx, + krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp) +{ + dmu_buf_t *db; + int err; + + err = dmu_buf_hold(os, obj, 0, tag, &db, DMU_READ_NO_PREFETCH); + if (err != 0) + return (err); + err = zap_lockdir_impl(db, tag, tx, lti, fatreader, adding, zapp); + if (err != 0) + dmu_buf_rele(db, tag); + return (err); +} + void -zap_unlockdir(zap_t *zap) +zap_unlockdir(zap_t *zap, void *tag) { rw_exit(&zap->zap_rwlock); - dmu_buf_rele(zap->zap_dbuf, NULL); + dmu_buf_rele(zap->zap_dbuf, tag); } static int -mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, zap_flags_t flags) +mzap_upgrade(zap_t **zapp, void *tag, dmu_tx_t *tx, zap_flags_t flags) { mzap_phys_t *mzp; int i, sz, nchunks; @@ -596,7 +612,8 @@ mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, dprintf("adding %s=%llu\n", mze->mze_name, mze->mze_value); zn = zap_name_alloc(zap, mze->mze_name, MT_EXACT); - err = fzap_add_cd(zn, 8, 1, &mze->mze_value, mze->mze_cd, tx); + err = fzap_add_cd(zn, 8, 1, &mze->mze_value, mze->mze_cd, + tag, tx); zap = zn->zn_zap; /* fzap_add_cd() may change zap */ zap_name_free(zn); if (err) @@ -635,9 +652,9 @@ mzap_create_impl(objset_t *os, uint64_t zap_t *zap; /* Only fat zap supports flags; upgrade immediately. */ VERIFY(0 == zap_lockdir(os, obj, tx, RW_WRITER, - B_FALSE, B_FALSE, &zap)); - VERIFY3U(0, ==, mzap_upgrade(&zap, tx, flags)); - zap_unlockdir(zap); + B_FALSE, B_FALSE, FTAG, &zap)); + VERIFY3U(0, ==, mzap_upgrade(&zap, FTAG, tx, flags)); + zap_unlockdir(zap, FTAG); } } @@ -732,7 +749,7 @@ zap_count(objset_t *os, uint64_t zapobj, zap_t *zap; int err; - err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, &zap); + err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap); if (err) return (err); if (!zap->zap_ismicro) { @@ -740,7 +757,7 @@ zap_count(objset_t *os, uint64_t zapobj, } else { *count = zap->zap_m.zap_num_entries; } - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -797,25 +814,19 @@ zap_lookup(objset_t *os, uint64_t zapobj num_integers, buf, MT_EXACT, NULL, 0, NULL)); } -int -zap_lookup_norm(objset_t *os, uint64_t zapobj, const char *name, +static int +zap_lookup_impl(zap_t *zap, const char *name, uint64_t integer_size, uint64_t num_integers, void *buf, matchtype_t mt, char *realname, int rn_len, boolean_t *ncp) { - zap_t *zap; - int err; + int err = 0; mzap_ent_t *mze; zap_name_t *zn; - err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, &zap); - if (err) - return (err); zn = zap_name_alloc(zap, name, mt); - if (zn == NULL) { - zap_unlockdir(zap); + if (zn == NULL) return (SET_ERROR(ENOTSUP)); - } if (!zap->zap_ismicro) { err = fzap_lookup(zn, integer_size, num_integers, buf, @@ -842,7 +853,24 @@ zap_lookup_norm(objset_t *os, uint64_t z } } zap_name_free(zn); - zap_unlockdir(zap); + return (err); +} + +int +zap_lookup_norm(objset_t *os, uint64_t zapobj, const char *name, + uint64_t integer_size, uint64_t num_integers, void *buf, + matchtype_t mt, char *realname, int rn_len, + boolean_t *ncp) +{ + zap_t *zap; + int err; + + err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap); + if (err != 0) + return (err); + err = zap_lookup_impl(zap, name, integer_size, + num_integers, buf, mt, realname, rn_len, ncp); + zap_unlockdir(zap, FTAG); return (err); } @@ -854,18 +882,18 @@ zap_prefetch_uint64(objset_t *os, uint64 int err; zap_name_t *zn; - err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, &zap); + err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap); if (err) return (err); zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); } fzap_prefetch(zn); zap_name_free(zn); - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -877,19 +905,19 @@ zap_lookup_uint64(objset_t *os, uint64_t int err; zap_name_t *zn; - err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, &zap); + err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap); if (err) return (err); zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); } err = fzap_lookup(zn, integer_size, num_integers, buf, NULL, 0, NULL); zap_name_free(zn); - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -912,12 +940,12 @@ zap_length(objset_t *os, uint64_t zapobj mzap_ent_t *mze; zap_name_t *zn; - err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, &zap); + err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap); if (err) return (err); zn = zap_name_alloc(zap, name, MT_EXACT); if (zn == NULL) { - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); } if (!zap->zap_ismicro) { @@ -934,7 +962,7 @@ zap_length(objset_t *os, uint64_t zapobj } } zap_name_free(zn); - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -946,17 +974,17 @@ zap_length_uint64(objset_t *os, uint64_t int err; zap_name_t *zn; - err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, &zap); + err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap); if (err) return (err); zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); } err = fzap_length(zn, integer_size, num_integers); zap_name_free(zn); - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -1015,22 +1043,24 @@ zap_add(objset_t *os, uint64_t zapobj, c const uint64_t *intval = val; zap_name_t *zn; - err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, &zap); + err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, FTAG, &zap); if (err) return (err); zn = zap_name_alloc(zap, key, MT_EXACT); if (zn == NULL) { - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); } if (!zap->zap_ismicro) { - err = fzap_add(zn, integer_size, num_integers, val, tx); + err = fzap_add(zn, integer_size, num_integers, val, FTAG, tx); zap = zn->zn_zap; /* fzap_add() may change zap */ } else if (integer_size != 8 || num_integers != 1 || strlen(key) >= MZAP_NAME_LEN) { - err = mzap_upgrade(&zn->zn_zap, tx, 0); - if (err == 0) - err = fzap_add(zn, integer_size, num_integers, val, tx); + err = mzap_upgrade(&zn->zn_zap, FTAG, tx, 0); + if (err == 0) { + err = fzap_add(zn, integer_size, num_integers, val, + FTAG, tx); + } zap = zn->zn_zap; /* fzap_add() may change zap */ } else { mze = mze_find(zn); @@ -1043,7 +1073,7 @@ zap_add(objset_t *os, uint64_t zapobj, c ASSERT(zap == zn->zn_zap); zap_name_free(zn); if (zap != NULL) /* may be NULL if fzap_add() failed */ - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -1056,19 +1086,19 @@ zap_add_uint64(objset_t *os, uint64_t za int err; zap_name_t *zn; - err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, &zap); + err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, FTAG, &zap); if (err) return (err); zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); } - err = fzap_add(zn, integer_size, num_integers, val, tx); + err = fzap_add(zn, integer_size, num_integers, val, FTAG, tx); zap = zn->zn_zap; /* fzap_add() may change zap */ zap_name_free(zn); if (zap != NULL) /* may be NULL if fzap_add() failed */ - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -1092,25 +1122,27 @@ zap_update(objset_t *os, uint64_t zapobj (void) zap_lookup(os, zapobj, name, 8, 1, &oldval); #endif - err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, &zap); + err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, FTAG, &zap); if (err) return (err); zn = zap_name_alloc(zap, name, MT_EXACT); if (zn == NULL) { - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); } if (!zap->zap_ismicro) { - err = fzap_update(zn, integer_size, num_integers, val, tx); + err = fzap_update(zn, integer_size, num_integers, val, + FTAG, tx); zap = zn->zn_zap; /* fzap_update() may change zap */ } else if (integer_size != 8 || num_integers != 1 || strlen(name) >= MZAP_NAME_LEN) { dprintf("upgrading obj %llu: intsz=%u numint=%llu name=%s\n", zapobj, integer_size, num_integers, name); - err = mzap_upgrade(&zn->zn_zap, tx, 0); - if (err == 0) + err = mzap_upgrade(&zn->zn_zap, FTAG, tx, 0); + if (err == 0) { err = fzap_update(zn, integer_size, num_integers, - val, tx); + val, FTAG, tx); + } zap = zn->zn_zap; /* fzap_update() may change zap */ } else { mze = mze_find(zn); @@ -1124,7 +1156,7 @@ zap_update(objset_t *os, uint64_t zapobj ASSERT(zap == zn->zn_zap); zap_name_free(zn); if (zap != NULL) /* may be NULL if fzap_upgrade() failed */ - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -1137,19 +1169,19 @@ zap_update_uint64(objset_t *os, uint64_t zap_name_t *zn; int err; - err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, &zap); + err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, FTAG, &zap); if (err) return (err); zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); } - err = fzap_update(zn, integer_size, num_integers, val, tx); + err = fzap_update(zn, integer_size, num_integers, val, FTAG, tx); zap = zn->zn_zap; /* fzap_update() may change zap */ zap_name_free(zn); if (zap != NULL) /* may be NULL if fzap_upgrade() failed */ - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -1168,12 +1200,12 @@ zap_remove_norm(objset_t *os, uint64_t z mzap_ent_t *mze; zap_name_t *zn; - err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, FALSE, &zap); + err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, FALSE, FTAG, &zap); if (err) return (err); zn = zap_name_alloc(zap, name, mt); if (zn == NULL) { - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); } if (!zap->zap_ismicro) { @@ -1190,7 +1222,7 @@ zap_remove_norm(objset_t *os, uint64_t z } } zap_name_free(zn); - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -1202,17 +1234,17 @@ zap_remove_uint64(objset_t *os, uint64_t int err; zap_name_t *zn; - err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, FALSE, &zap); + err = zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, FALSE, FTAG, &zap); if (err) return (err); zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (SET_ERROR(ENOTSUP)); } err = fzap_remove(zn, tx); zap_name_free(zn); - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } @@ -1244,7 +1276,7 @@ zap_cursor_fini(zap_cursor_t *zc) { if (zc->zc_zap) { rw_enter(&zc->zc_zap->zap_rwlock, RW_READER); - zap_unlockdir(zc->zc_zap); + zap_unlockdir(zc->zc_zap, NULL); zc->zc_zap = NULL; } if (zc->zc_leaf) { @@ -1291,7 +1323,7 @@ zap_cursor_retrieve(zap_cursor_t *zc, za if (zc->zc_zap == NULL) { int hb; err = zap_lockdir(zc->zc_objset, zc->zc_zapobj, NULL, - RW_READER, TRUE, FALSE, &zc->zc_zap); + RW_READER, TRUE, FALSE, NULL, &zc->zc_zap); if (err) return (err); @@ -1395,7 +1427,7 @@ zap_get_stats(objset_t *os, uint64_t zap int err; zap_t *zap; - err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, &zap); + err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap); if (err) return (err); @@ -1408,7 +1440,7 @@ zap_get_stats(objset_t *os, uint64_t zap } else { fzap_get_stats(zap, zs); } - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (0); } @@ -1427,7 +1459,7 @@ zap_count_write(objset_t *os, uint64_t z * - 2 blocks for possibly split leaves, * - 2 grown ptrtbl blocks * - * This also accomodates the case where an add operation to a fairly + * This also accommodates the case where an add operation to a fairly * large microzap results in a promotion to fatzap. */ if (name == NULL) { @@ -1440,10 +1472,11 @@ zap_count_write(objset_t *os, uint64_t z * We lock the zap with adding == FALSE. Because, if we pass * the actual value of add, it could trigger a mzap_upgrade(). * At present we are just evaluating the possibility of this operation - * and hence we donot want to trigger an upgrade. + * and hence we do not want to trigger an upgrade. */ - err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, &zap); - if (err) + err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, + FTAG, &zap); + if (err != 0) return (err); if (!zap->zap_ismicro) { @@ -1489,6 +1522,6 @@ zap_count_write(objset_t *os, uint64_t z } } - zap_unlockdir(zap); + zap_unlockdir(zap, FTAG); return (err); } From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:36:33 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD377C11E1F; Fri, 14 Oct 2016 07:36:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 890EC188E; Fri, 14 Oct 2016 07:36:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7aWmK069464; Fri, 14 Oct 2016 07:36:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7aWfh069463; Fri, 14 Oct 2016 07:36:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140736.u9E7aWfh069463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307288 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:36:33 -0000 Author: mav Date: Fri Oct 14 07:36:32 2016 New Revision: 307288 URL: https://svnweb.freebsd.org/changeset/base/307288 Log: MFC r305339: MFV r305336: 7247 zfs receive of deduplicated stream fails This resolves two 'zfs recv' issues. First, when receiving into an existing filesystem, a snapshot created during the receive process is not added to the guid->dataset map for the stream, resulting in failed lookups for deduped streams when a WRITE_BYREF record refers to a snapshot received earlier in the stream. Second, the newly created snapshot was also not set properly, referencing the snapshot before the new receiving dataset rather than the existing filesystem. Closes #159 Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Author: Chris Williamson openzfs/openzfs@b09697c8c18be68abfe538de9809938239402ae8 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Oct 14 07:35:43 2016 (r307287) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Oct 14 07:36:32 2016 (r307288) @@ -3113,6 +3113,9 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *t dsl_dataset_phys(origin_head)->ds_flags &= ~DS_FLAG_INCONSISTENT; + drc->drc_newsnapobj = + dsl_dataset_phys(origin_head)->ds_prev_snap_obj; + dsl_dataset_rele(origin_head, FTAG); dsl_destroy_head_sync_impl(drc->drc_ds, tx); @@ -3148,8 +3151,9 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *t (void) zap_remove(dp->dp_meta_objset, ds->ds_object, DS_FIELD_RESUME_TONAME, tx); } + drc->drc_newsnapobj = + dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj; } - drc->drc_newsnapobj = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj; /* * Release the hold from dmu_recv_begin. This must be done before * we return to open context, so that when we free the dataset's dnode, @@ -3191,8 +3195,6 @@ static int dmu_recv_end_modified_blocks static int dmu_recv_existing_end(dmu_recv_cookie_t *drc) { - int error; - #ifdef _KERNEL /* * We will be destroying the ds; make sure its origin is unmounted if @@ -3203,23 +3205,30 @@ dmu_recv_existing_end(dmu_recv_cookie_t zfs_destroy_unmount_origin(name); #endif - error = dsl_sync_task(drc->drc_tofs, + return (dsl_sync_task(drc->drc_tofs, dmu_recv_end_check, dmu_recv_end_sync, drc, - dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL); - - if (error != 0) - dmu_recv_cleanup_ds(drc); - return (error); + dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL)); } static int dmu_recv_new_end(dmu_recv_cookie_t *drc) { + return (dsl_sync_task(drc->drc_tofs, + dmu_recv_end_check, dmu_recv_end_sync, drc, + dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL)); +} + +int +dmu_recv_end(dmu_recv_cookie_t *drc, void *owner) +{ int error; - error = dsl_sync_task(drc->drc_tofs, - dmu_recv_end_check, dmu_recv_end_sync, drc, - dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL); + drc->drc_owner = owner; + + if (drc->drc_newfs) + error = dmu_recv_new_end(drc); + else + error = dmu_recv_existing_end(drc); if (error != 0) { dmu_recv_cleanup_ds(drc); @@ -3231,17 +3240,6 @@ dmu_recv_new_end(dmu_recv_cookie_t *drc) return (error); } -int -dmu_recv_end(dmu_recv_cookie_t *drc, void *owner) -{ - drc->drc_owner = owner; - - if (drc->drc_newfs) - return (dmu_recv_new_end(drc)); - else - return (dmu_recv_existing_end(drc)); -} - /* * Return TRUE if this objset is currently being received into. */ From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:39:36 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEA08C11EEF; Fri, 14 Oct 2016 07:39:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 850201BC5; Fri, 14 Oct 2016 07:39:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7dZwW069705; Fri, 14 Oct 2016 07:39:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7dYoH069697; Fri, 14 Oct 2016 07:39:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140739.u9E7dYoH069697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:39:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307290 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:39:36 -0000 Author: mav Date: Fri Oct 14 07:39:34 2016 New Revision: 307290 URL: https://svnweb.freebsd.org/changeset/base/307290 Log: MFC r305340: MFC r305337: 7004 dmu_tx_hold_zap() does dnode_hold() 7x on same object Using a benchmark which has 32 threads creating 2 million files in the same directory, on a machine with 16 CPU cores, I observed poor performance. I noticed that dmu_tx_hold_zap() was using about 30% of all CPU, and doing dnode_hold() 7 times on the same object (the ZAP object that is being held). dmu_tx_hold_zap() keeps a hold on the dnode_t the entire time it is running, in dmu_tx_hold_t:txh_dnode, so it would be nice to use the dnode_t that we already have in hand, rather than repeatedly calling dnode_hold(). To do this, we need to pass the dnode_t down through all the intermediate calls that dmu_tx_hold_zap() makes, making these routines take the dnode_t* rather than an objset_t* and a uint64_t object number. In particular, the following routines will need to have analogous *_by_dnode() variants created: dmu_buf_hold_noread() dmu_buf_hold() zap_lookup() zap_lookup_norm() zap_count_write() zap_lockdir() zap_count_write() This can improve performance on the benchmark described above by 100%, from 30,000 file creations per second to 60,000. (This improvement is on top of that provided by working around the object allocation issue. Peak performance of ~90,000 creations per second was observed with 8 CPUs; adding CPUs past that decreased performance due to lock contention.) The CPU used by dmu_tx_hold_zap() was reduced by 88%, from 340 CPU-seconds to 40 CPU-seconds. Sponsored by: Intel Corp. Closes #109 Reviewed by: Steve Gonczi Reviewed by: George Wilson Reviewed by: Pavel Zakharov Reviewed by: Ned Bass Reviewed by: Brian Behlendorf Author: Matthew Ahrens openzfs/openzfs@d3e523d489a169ab36f9ec1b2a111a60a5563a9f Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Oct 14 07:37:08 2016 (r307289) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Oct 14 07:39:34 2016 (r307290) @@ -2910,6 +2910,21 @@ dmu_buf_get_objset(dmu_buf_t *db) return (dbi->db_objset); } +dnode_t * +dmu_buf_dnode_enter(dmu_buf_t *db) +{ + dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db; + DB_DNODE_ENTER(dbi); + return (DB_DNODE(dbi)); +} + +void +dmu_buf_dnode_exit(dmu_buf_t *db) +{ + dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db; + DB_DNODE_EXIT(dbi); +} + static void dbuf_check_blkptr(dnode_t *dn, dmu_buf_impl_t *db) { Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Fri Oct 14 07:37:08 2016 (r307289) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Fri Oct 14 07:39:34 2016 (r307290) @@ -131,6 +131,26 @@ const dmu_object_byteswap_info_t dmu_ot_ }; int +dmu_buf_hold_noread_by_dnode(dnode_t *dn, uint64_t offset, + void *tag, dmu_buf_t **dbp) +{ + uint64_t blkid; + dmu_buf_impl_t *db; + + blkid = dbuf_whichblock(dn, 0, offset); + rw_enter(&dn->dn_struct_rwlock, RW_READER); + db = dbuf_hold(dn, blkid, tag); + rw_exit(&dn->dn_struct_rwlock); + + if (db == NULL) { + *dbp = NULL; + return (SET_ERROR(EIO)); + } + + *dbp = &db->db; + return (0); +} +int dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset, void *tag, dmu_buf_t **dbp) { @@ -158,6 +178,29 @@ dmu_buf_hold_noread(objset_t *os, uint64 } int +dmu_buf_hold_by_dnode(dnode_t *dn, uint64_t offset, + void *tag, dmu_buf_t **dbp, int flags) +{ + int err; + int db_flags = DB_RF_CANFAIL; + + if (flags & DMU_READ_NO_PREFETCH) + db_flags |= DB_RF_NOPREFETCH; + + err = dmu_buf_hold_noread_by_dnode(dn, offset, tag, dbp); + if (err == 0) { + dmu_buf_impl_t *db = (dmu_buf_impl_t *)(*dbp); + err = dbuf_read(db, NULL, db_flags); + if (err != 0) { + dbuf_rele(db, tag); + *dbp = NULL; + } + } + + return (err); +} + +int dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset, void *tag, dmu_buf_t **dbp, int flags) { Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Fri Oct 14 07:37:08 2016 (r307289) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Fri Oct 14 07:39:34 2016 (r307290) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -808,15 +808,14 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t o * access the name in this fat-zap so that we'll check * for i/o errors to the leaf blocks, etc. */ - err = zap_lookup(dn->dn_objset, dn->dn_object, name, - 8, 0, NULL); + err = zap_lookup_by_dnode(dn, name, 8, 0, NULL); if (err == EIO) { tx->tx_err = err; return; } } - err = zap_count_write(dn->dn_objset, dn->dn_object, name, add, + err = zap_count_write_by_dnode(dn, name, add, &txh->txh_space_towrite, &txh->txh_space_tooverwrite); /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Oct 14 07:37:08 2016 (r307289) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Oct 14 07:39:34 2016 (r307290) @@ -78,6 +78,7 @@ struct file; typedef struct objset objset_t; typedef struct dmu_tx dmu_tx_t; typedef struct dsl_dir dsl_dir_t; +typedef struct dnode dnode_t; typedef enum dmu_object_byteswap { DMU_BSWAP_UINT8, @@ -419,7 +420,7 @@ dmu_write_embedded(objset_t *os, uint64_ #define WP_DMU_SYNC 0x2 #define WP_SPILL 0x4 -void dmu_write_policy(objset_t *os, struct dnode *dn, int level, int wp, +void dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, struct zio_prop *zp); /* * The bonus data is accessed more or less like a regular buffer. @@ -445,7 +446,7 @@ int dmu_rm_spill(objset_t *, uint64_t, d */ int dmu_spill_hold_by_bonus(dmu_buf_t *bonus, void *tag, dmu_buf_t **dbp); -int dmu_spill_hold_by_dnode(struct dnode *dn, uint32_t flags, +int dmu_spill_hold_by_dnode(dnode_t *dn, uint32_t flags, void *tag, dmu_buf_t **dbp); int dmu_spill_hold_existing(dmu_buf_t *bonus, void *tag, dmu_buf_t **dbp); @@ -465,6 +466,8 @@ int dmu_spill_hold_existing(dmu_buf_t *b */ int dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset, void *tag, dmu_buf_t **, int flags); +int dmu_buf_hold_by_dnode(dnode_t *dn, uint64_t offset, + void *tag, dmu_buf_t **dbp, int flags); /* * Add a reference to a dmu buffer that has already been held via @@ -618,6 +621,8 @@ void *dmu_buf_remove_user(dmu_buf_t *db, void *dmu_buf_get_user(dmu_buf_t *db); objset_t *dmu_buf_get_objset(dmu_buf_t *db); +dnode_t *dmu_buf_dnode_enter(dmu_buf_t *db); +void dmu_buf_dnode_exit(dmu_buf_t *db); /* Block until any in-progress dmu buf user evictions complete. */ void dmu_buf_user_evict_wait(void); @@ -801,7 +806,7 @@ extern const dmu_object_byteswap_info_t */ int dmu_object_info(objset_t *os, uint64_t object, dmu_object_info_t *doi); /* Like dmu_object_info, but faster if you have a held dnode in hand. */ -void dmu_object_info_from_dnode(struct dnode *dn, dmu_object_info_t *doi); +void dmu_object_info_from_dnode(dnode_t *dn, dmu_object_info_t *doi); /* Like dmu_object_info, but faster if you have a held dbuf in hand. */ void dmu_object_info_from_db(dmu_buf_t *db, dmu_object_info_t *doi); /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Fri Oct 14 07:37:08 2016 (r307289) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Fri Oct 14 07:39:34 2016 (r307290) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ @@ -149,7 +149,7 @@ typedef struct dnode_phys { blkptr_t dn_spill; } dnode_phys_t; -typedef struct dnode { +struct dnode { /* * Protects the structure of the dnode, including the number of levels * of indirection (dn_nlevels), dn_maxblkid, and dn_next_* @@ -247,7 +247,7 @@ typedef struct dnode { /* holds prefetch structure */ struct zfetch dn_zfetch; -} dnode_t; +}; /* * Adds a level of indirection between the dbuf and the dnode to avoid Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Fri Oct 14 07:37:08 2016 (r307289) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Fri Oct 14 07:39:34 2016 (r307290) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. */ #ifndef _SYS_ZAP_H @@ -216,8 +216,14 @@ int zap_lookup_uint64(objset_t *os, uint int zap_contains(objset_t *ds, uint64_t zapobj, const char *name); int zap_prefetch_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, int key_numints); +int zap_lookup_by_dnode(dnode_t *dn, const char *name, + uint64_t integer_size, uint64_t num_integers, void *buf); +int zap_lookup_norm_by_dnode(dnode_t *dn, const char *name, + uint64_t integer_size, uint64_t num_integers, void *buf, + matchtype_t mt, char *realname, int rn_len, + boolean_t *ncp); -int zap_count_write(objset_t *os, uint64_t zapobj, const char *name, +int zap_count_write_by_dnode(dnode_t *dn, const char *name, int add, refcount_t *towrite, refcount_t *tooverwrite); /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Fri Oct 14 07:37:08 2016 (r307289) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Fri Oct 14 07:39:34 2016 (r307290) @@ -270,6 +270,7 @@ zap_table_load(zap_t *zap, zap_table_phy uint64_t blk, off; int err; dmu_buf_t *db; + dnode_t *dn; int bs = FZAP_BLOCK_SHIFT(zap); ASSERT(RW_LOCK_HELD(&zap->zap_rwlock)); @@ -277,8 +278,15 @@ zap_table_load(zap_t *zap, zap_table_phy blk = idx >> (bs-3); off = idx & ((1<<(bs-3))-1); - err = dmu_buf_hold(zap->zap_objset, zap->zap_object, + /* + * Note: this is equivalent to dmu_buf_hold(), but we use + * _dnode_enter / _by_dnode because it's faster because we don't + * have to hold the dnode. + */ + dn = dmu_buf_dnode_enter(zap->zap_dbuf); + err = dmu_buf_hold_by_dnode(dn, (tbl->zt_blk + blk) << bs, FTAG, &db, DMU_READ_NO_PREFETCH); + dmu_buf_dnode_exit(zap->zap_dbuf); if (err) return (err); *valp = ((uint64_t *)db->db_data)[off]; @@ -292,9 +300,11 @@ zap_table_load(zap_t *zap, zap_table_phy */ blk = (idx*2) >> (bs-3); - err = dmu_buf_hold(zap->zap_objset, zap->zap_object, + dn = dmu_buf_dnode_enter(zap->zap_dbuf); + err = dmu_buf_hold_by_dnode(dn, (tbl->zt_nextblk + blk) << bs, FTAG, &db, DMU_READ_NO_PREFETCH); + dmu_buf_dnode_exit(zap->zap_dbuf); if (err == 0) dmu_buf_rele(db, FTAG); } @@ -505,8 +515,10 @@ zap_get_leaf_byblk(zap_t *zap, uint64_t ASSERT(RW_LOCK_HELD(&zap->zap_rwlock)); - err = dmu_buf_hold(zap->zap_objset, zap->zap_object, + dnode_t *dn = dmu_buf_dnode_enter(zap->zap_dbuf); + err = dmu_buf_hold_by_dnode(dn, blkid << bs, NULL, &db, DMU_READ_NO_PREFETCH); + dmu_buf_dnode_exit(zap->zap_dbuf); if (err) return (err); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Fri Oct 14 07:37:08 2016 (r307289) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Fri Oct 14 07:39:34 2016 (r307290) @@ -550,6 +550,24 @@ zap_lockdir_impl(dmu_buf_t *db, void *ta return (0); } +static int +zap_lockdir_by_dnode(dnode_t *dn, dmu_tx_t *tx, + krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp) +{ + dmu_buf_t *db; + int err; + + err = dmu_buf_hold_by_dnode(dn, 0, tag, &db, DMU_READ_NO_PREFETCH); + if (err != 0) { + return (err); + } + err = zap_lockdir_impl(db, tag, tx, lti, fatreader, adding, zapp); + if (err != 0) { + dmu_buf_rele(db, tag); + } + return (err); +} + int zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx, krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp) @@ -875,6 +893,33 @@ zap_lookup_norm(objset_t *os, uint64_t z } int +zap_lookup_by_dnode(dnode_t *dn, const char *name, + uint64_t integer_size, uint64_t num_integers, void *buf) +{ + return (zap_lookup_norm_by_dnode(dn, name, integer_size, + num_integers, buf, MT_EXACT, NULL, 0, NULL)); +} + +int +zap_lookup_norm_by_dnode(dnode_t *dn, const char *name, + uint64_t integer_size, uint64_t num_integers, void *buf, + matchtype_t mt, char *realname, int rn_len, + boolean_t *ncp) +{ + zap_t *zap; + int err; + + err = zap_lockdir_by_dnode(dn, NULL, RW_READER, TRUE, FALSE, + FTAG, &zap); + if (err != 0) + return (err); + err = zap_lookup_impl(zap, name, integer_size, + num_integers, buf, mt, realname, rn_len, ncp); + zap_unlockdir(zap, FTAG); + return (err); +} + +int zap_prefetch_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, int key_numints) { @@ -1445,7 +1490,7 @@ zap_get_stats(objset_t *os, uint64_t zap } int -zap_count_write(objset_t *os, uint64_t zapobj, const char *name, int add, +zap_count_write_by_dnode(dnode_t *dn, const char *name, int add, refcount_t *towrite, refcount_t *tooverwrite) { zap_t *zap; @@ -1474,7 +1519,7 @@ zap_count_write(objset_t *os, uint64_t z * At present we are just evaluating the possibility of this operation * and hence we do not want to trigger an upgrade. */ - err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, + err = zap_lockdir_by_dnode(dn, NULL, RW_READER, TRUE, FALSE, FTAG, &zap); if (err != 0) return (err); From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:40:07 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34BA6C11F77; Fri, 14 Oct 2016 07:40:07 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C49A61D73; Fri, 14 Oct 2016 07:40:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7e5Sv069809; Fri, 14 Oct 2016 07:40:05 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7e5Ts069800; Fri, 14 Oct 2016 07:40:05 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140740.u9E7e5Ts069800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 07:40:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307291 - in stable/11/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:40:07 -0000 Author: sephe Date: Fri Oct 14 07:40:04 2016 New Revision: 307291 URL: https://svnweb.freebsd.org/changeset/base/307291 Log: MFC 302543-302545,302547,302549,302554,302556,302557,302559,302606 302543 hyperv/vmbus: Use post message Hypercall APIs for channel request Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6831 302544 hyperv/hn: Add tunable to allow tcp_lro_queue_mbuf() Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6841 302545 hyperv/vmbus: Function renaming. And pass vmbus_softc to vmbus_doattach() Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6842 302547 hyperv/vmbus: Explicitly assign channel message process array. While I'm here, remove the useless message type from message process array, which is not used and serves no purposes at all. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6858 302549 hyperv/vmbus: Add sysctl to expose vmbus version. Requested by: Hongxiong Xian Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6860 302554 hyperv/vmbus: Use post message Hypercall APIs for unload Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6861 302556 hyperv/vmbus: Create channel synchronously. The device probe/attach has been move to a different thread, so the reasons to create the channel asynchronously are no longer valid. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6862 302557 hyperv/vmbus: Save vmbus softc to channels. So that we don't need to access the global vmbus softc. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6863 302559 hyperv/vmbus: Embed channel detach task in channel itself. GC work queue stuffs. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6864 302606 hyperv/vmbus: Reorganize vmbus scan process. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6875 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_connection.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 07:39:34 2016 (r307290) +++ stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 07:40:04 2016 (r307291) @@ -713,6 +713,7 @@ typedef struct { typedef struct hv_vmbus_channel { TAILQ_ENTRY(hv_vmbus_channel) list_entry; struct hv_device* device; + struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; hv_vmbus_channel_offer_channel offer_msg; /* @@ -808,6 +809,8 @@ typedef struct hv_vmbus_channel { void *hv_chan_priv1; void *hv_chan_priv2; void *hv_chan_priv3; + + struct task ch_detach_task; } hv_vmbus_channel; #define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 14 07:39:34 2016 (r307290) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 14 07:40:04 2016 (r307291) @@ -299,6 +299,12 @@ static int hn_tx_swq_depth = 0; SYSCTL_INT(_hw_hn, OID_AUTO, tx_swq_depth, CTLFLAG_RDTUN, &hn_tx_swq_depth, 0, "Depth of IFQ or BUFRING"); +#if __FreeBSD_version >= 1100095 +static u_int hn_lro_mbufq_depth = 0; +SYSCTL_UINT(_hw_hn, OID_AUTO, lro_mbufq_depth, CTLFLAG_RDTUN, + &hn_lro_mbufq_depth, 0, "Depth of LRO mbuf queue"); +#endif + static u_int hn_cpu_index; /* @@ -1283,6 +1289,19 @@ hv_m_append(struct mbuf *m0, int len, c_ return (remainder == 0); } +#if defined(INET) || defined(INET6) +static __inline int +hn_lro_rx(struct lro_ctrl *lc, struct mbuf *m) +{ +#if __FreeBSD_version >= 1100095 + if (hn_lro_mbufq_depth) { + tcp_lro_queue_mbuf(lc, m); + return 0; + } +#endif + return tcp_lro_rx(lc, m, 0); +} +#endif /* * Called when we receive a data packet from the "wire" on the @@ -1488,7 +1507,7 @@ skip: if (lro->lro_cnt) { rxr->hn_lro_tried++; - if (tcp_lro_rx(lro, m_new, 0) == 0) { + if (hn_lro_rx(lro, m_new) == 0) { /* DONE! */ return 0; } @@ -2223,7 +2242,8 @@ hn_create_rx_data(struct hn_softc *sc, i */ #if defined(INET) || defined(INET6) #if __FreeBSD_version >= 1100095 - tcp_lro_init_args(&rxr->hn_lro, sc->hn_ifp, lroent_cnt, 0); + tcp_lro_init_args(&rxr->hn_lro, sc->hn_ifp, lroent_cnt, + hn_lro_mbufq_depth); #else tcp_lro_init(&rxr->hn_lro); rxr->hn_lro.ifp = sc->hn_ifp; Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 07:39:34 2016 (r307290) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 07:40:04 2016 (r307291) @@ -67,7 +67,7 @@ static void vmbus_channel_set_event(hv_vmbus_channel *channel) { if (channel->offer_msg.monitor_allocated) { - struct vmbus_softc *sc = vmbus_get_softc(); + struct vmbus_softc *sc = channel->vmbus_sc; hv_vmbus_monitor_page *monitor_page; uint32_t chanid = channel->offer_msg.child_rel_id; @@ -205,7 +205,7 @@ hv_vmbus_channel_open( vmbus_on_channel_open(new_channel); - new_channel->rxq = VMBUS_PCPU_GET(vmbus_get_softc(), event_tq, + new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, new_channel->target_cpu); TASK_INIT(&new_channel->channel_task, 0, VmbusProcessChannelEvent, new_channel); Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 07:39:34 2016 (r307290) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 07:40:04 2016 (r307291) @@ -36,19 +36,13 @@ #include #include -/* - * Internal functions - */ +typedef void (*vmbus_chanmsg_proc_t) + (struct vmbus_softc *, const struct vmbus_message *); -typedef struct hv_vmbus_channel_msg_table_entry { - hv_vmbus_channel_msg_type messageType; - void (*messageHandler) - (struct vmbus_softc *sc, - const struct vmbus_message *msg); -} hv_vmbus_channel_msg_table_entry; - -static void vmbus_channel_on_offer_internal(void *context); -static void vmbus_channel_on_offer_rescind_internal(void *context); +static struct hv_vmbus_channel *hv_vmbus_allocate_channel(struct vmbus_softc *); +static void vmbus_channel_on_offer_internal(struct vmbus_softc *, + const hv_vmbus_channel_offer_channel *offer); +static void vmbus_chan_detach_task(void *, int); static void vmbus_channel_on_offer(struct vmbus_softc *, const struct vmbus_message *); @@ -68,108 +62,38 @@ static void vmbus_channel_on_version_res /** * Channel message dispatch table */ -static const hv_vmbus_channel_msg_table_entry - g_channel_message_table[HV_CHANNEL_MESSAGE_COUNT] = { - { HV_CHANNEL_MESSAGE_INVALID, - NULL }, - { HV_CHANNEL_MESSAGE_OFFER_CHANNEL, - vmbus_channel_on_offer }, - { HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER, - vmbus_channel_on_offer_rescind }, - { HV_CHANNEL_MESSAGE_REQUEST_OFFERS, - NULL }, - { HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED, - vmbus_channel_on_offers_delivered }, - { HV_CHANNEL_MESSAGE_OPEN_CHANNEL, - NULL }, - { HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT, - vmbus_channel_on_open_result }, - { HV_CHANNEL_MESSAGE_CLOSE_CHANNEL, - NULL }, - { HV_CHANNEL_MESSAGEL_GPADL_HEADER, - NULL }, - { HV_CHANNEL_MESSAGE_GPADL_BODY, - NULL }, - { HV_CHANNEL_MESSAGE_GPADL_CREATED, - vmbus_channel_on_gpadl_created }, - { HV_CHANNEL_MESSAGE_GPADL_TEARDOWN, - NULL }, - { HV_CHANNEL_MESSAGE_GPADL_TORNDOWN, - vmbus_channel_on_gpadl_torndown }, - { HV_CHANNEL_MESSAGE_REL_ID_RELEASED, - NULL }, - { HV_CHANNEL_MESSAGE_INITIATED_CONTACT, - NULL }, - { HV_CHANNEL_MESSAGE_VERSION_RESPONSE, - vmbus_channel_on_version_response }, - { HV_CHANNEL_MESSAGE_UNLOAD, - NULL } +static const vmbus_chanmsg_proc_t +vmbus_chanmsg_process[HV_CHANNEL_MESSAGE_COUNT] = { + [HV_CHANNEL_MESSAGE_OFFER_CHANNEL] = + vmbus_channel_on_offer, + [HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER] = + vmbus_channel_on_offer_rescind, + [HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] = + vmbus_channel_on_offers_delivered, + [HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] = + vmbus_channel_on_open_result, + [HV_CHANNEL_MESSAGE_GPADL_CREATED] = + vmbus_channel_on_gpadl_created, + [HV_CHANNEL_MESSAGE_GPADL_TORNDOWN] = + vmbus_channel_on_gpadl_torndown, + [HV_CHANNEL_MESSAGE_VERSION_RESPONSE] = + vmbus_channel_on_version_response }; -typedef struct hv_work_item { - struct task work; - void (*callback)(void *); - void* context; -} hv_work_item; - -static struct mtx vmbus_chwait_lock; -MTX_SYSINIT(vmbus_chwait_lk, &vmbus_chwait_lock, "vmbus primarych wait lock", - MTX_DEF); -static uint32_t vmbus_chancnt; -static uint32_t vmbus_devcnt; - -#define VMBUS_CHANCNT_DONE 0x80000000 - -/** - * Implementation of the work abstraction. - */ -static void -work_item_callback(void *work, int pending) -{ - struct hv_work_item *w = (struct hv_work_item *)work; - - w->callback(w->context); - - free(w, M_DEVBUF); -} - -/** - * @brief Create work item - */ -static int -hv_queue_work_item( - void (*callback)(void *), void *context) -{ - struct hv_work_item *w = malloc(sizeof(struct hv_work_item), - M_DEVBUF, M_NOWAIT); - KASSERT(w != NULL, ("Error VMBUS: Failed to allocate WorkItem\n")); - if (w == NULL) - return (ENOMEM); - - w->callback = callback; - w->context = context; - - TASK_INIT(&w->work, 0, work_item_callback, w); - - return (taskqueue_enqueue(taskqueue_thread, &w->work)); -} - - /** * @brief Allocate and initialize a vmbus channel object */ -hv_vmbus_channel* -hv_vmbus_allocate_channel(void) +static struct hv_vmbus_channel * +hv_vmbus_allocate_channel(struct vmbus_softc *sc) { - hv_vmbus_channel* channel; + struct hv_vmbus_channel *channel; - channel = (hv_vmbus_channel*) malloc( - sizeof(hv_vmbus_channel), - M_DEVBUF, - M_WAITOK | M_ZERO); + channel = malloc(sizeof(*channel), M_DEVBUF, M_WAITOK | M_ZERO); + channel->vmbus_sc = sc; mtx_init(&channel->sc_lock, "vmbus multi channel", NULL, MTX_DEF); TAILQ_INIT(&channel->sc_list_anchor); + TASK_INIT(&channel->ch_detach_task, 0, vmbus_chan_detach_task, channel); return (channel); } @@ -192,7 +116,6 @@ static void vmbus_channel_process_offer(hv_vmbus_channel *new_channel) { hv_vmbus_channel* channel; - int ret; uint32_t relid; relid = new_channel->offer_msg.child_rel_id; @@ -297,19 +220,8 @@ vmbus_channel_process_offer(hv_vmbus_cha * binding which eventually invokes the device driver's AddDevice() * method. */ - ret = hv_vmbus_child_device_register(new_channel->device); - if (ret != 0) { - mtx_lock(&hv_vmbus_g_connection.channel_lock); - TAILQ_REMOVE(&hv_vmbus_g_connection.channel_anchor, - new_channel, list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_lock); - hv_vmbus_free_vmbus_channel(new_channel); - } - - mtx_lock(&vmbus_chwait_lock); - vmbus_devcnt++; - mtx_unlock(&vmbus_chwait_lock); - wakeup(&vmbus_devcnt); + hv_vmbus_child_device_register(new_channel->vmbus_sc, + new_channel->device); } void @@ -324,7 +236,7 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch } chan->target_cpu = cpu; - chan->target_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, cpu); + chan->target_vcpu = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", @@ -393,46 +305,28 @@ vmbus_channel_select_defcpu(struct hv_vm /** * @brief Handler for channel offers from Hyper-V/Azure * - * Handler for channel offers from vmbus in parent partition. We ignore - * all offers except network and storage offers. For each network and storage - * offers, we create a channel object and queue a work item to the channel - * object to process the offer synchronously + * Handler for channel offers from vmbus in parent partition. */ static void vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - const hv_vmbus_channel_offer_channel *offer; - hv_vmbus_channel_offer_channel *copied; - offer = (const hv_vmbus_channel_offer_channel *)hdr; + /* New channel is offered by vmbus */ + vmbus_scan_newchan(sc); - // copy offer data - copied = malloc(sizeof(*copied), M_DEVBUF, M_NOWAIT); - if (copied == NULL) { - printf("fail to allocate memory\n"); - return; - } - - memcpy(copied, hdr, sizeof(*copied)); - hv_queue_work_item(vmbus_channel_on_offer_internal, copied); - - mtx_lock(&vmbus_chwait_lock); - if ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0) - vmbus_chancnt++; - mtx_unlock(&vmbus_chwait_lock); + offer = (const hv_vmbus_channel_offer_channel *)msg->msg_data; + vmbus_channel_on_offer_internal(sc, offer); } static void -vmbus_channel_on_offer_internal(void* context) +vmbus_channel_on_offer_internal(struct vmbus_softc *sc, + const hv_vmbus_channel_offer_channel *offer) { hv_vmbus_channel* new_channel; - hv_vmbus_channel_offer_channel* offer = (hv_vmbus_channel_offer_channel*)context; /* Allocate the channel object and save this offer */ - new_channel = hv_vmbus_allocate_channel(); + new_channel = hv_vmbus_allocate_channel(sc); /* * By default we setup state to enable batched @@ -469,45 +363,41 @@ vmbus_channel_on_offer_internal(void* co vmbus_channel_select_defcpu(new_channel); vmbus_channel_process_offer(new_channel); - - free(offer, M_DEVBUF); } /** * @brief Rescind offer handler. * * We queue a work item to process this offer - * synchronously + * synchronously. + * + * XXX pretty broken; need rework. */ static void vmbus_channel_on_offer_rescind(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - const hv_vmbus_channel_rescind_offer *rescind; hv_vmbus_channel* channel; - rescind = (const hv_vmbus_channel_rescind_offer *)hdr; + rescind = (const hv_vmbus_channel_rescind_offer *)msg->msg_data; channel = hv_vmbus_g_connection.channels[rescind->child_rel_id]; if (channel == NULL) return; - - hv_queue_work_item(vmbus_channel_on_offer_rescind_internal, channel); hv_vmbus_g_connection.channels[rescind->child_rel_id] = NULL; + + taskqueue_enqueue(taskqueue_thread, &channel->ch_detach_task); } static void -vmbus_channel_on_offer_rescind_internal(void *context) +vmbus_chan_detach_task(void *xchan, int pending __unused) { - hv_vmbus_channel* channel; + struct hv_vmbus_channel *chan = xchan; - channel = (hv_vmbus_channel*)context; - if (HV_VMBUS_CHAN_ISPRIMARY(channel)) { + if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the hv_device */ - hv_vmbus_child_device_unregister(channel->device); + hv_vmbus_child_device_unregister(chan->device); } } @@ -516,14 +406,12 @@ vmbus_channel_on_offer_rescind_internal( * @brief Invoked when all offers have been delivered. */ static void -vmbus_channel_on_offers_delivered(struct vmbus_softc *sc __unused, +vmbus_channel_on_offers_delivered(struct vmbus_softc *sc, const struct vmbus_message *msg __unused) { - mtx_lock(&vmbus_chwait_lock); - vmbus_chancnt |= VMBUS_CHANCNT_DONE; - mtx_unlock(&vmbus_chwait_lock); - wakeup(&vmbus_chancnt); + /* No more new channels for the channel request. */ + vmbus_scan_done(sc); } /** @@ -675,36 +563,6 @@ vmbus_channel_on_version_response(struct } /** - * @brief Send a request to get all our pending offers. - */ -int -hv_vmbus_request_channel_offers(void) -{ - int ret; - hv_vmbus_channel_msg_header* msg; - hv_vmbus_channel_msg_info* msg_info; - - msg_info = (hv_vmbus_channel_msg_info *) - malloc(sizeof(hv_vmbus_channel_msg_info) - + sizeof(hv_vmbus_channel_msg_header), M_DEVBUF, M_NOWAIT); - - if (msg_info == NULL) { - if(bootverbose) - printf("Error VMBUS: malloc failed for Request Offers\n"); - return (ENOMEM); - } - - msg = (hv_vmbus_channel_msg_header*) msg_info->msg; - msg->message_type = HV_CHANNEL_MESSAGE_REQUEST_OFFERS; - - ret = hv_vmbus_post_message(msg, sizeof(hv_vmbus_channel_msg_header)); - - free(msg_info, M_DEVBUF); - - return (ret); -} - -/** * @brief Release channels that are unattached/unconnected (i.e., no drivers associated) */ void @@ -757,7 +615,7 @@ vmbus_select_outgoing_channel(struct hv_ return outgoing_channel; } - cur_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, smp_pro_id); + cur_vcpu = VMBUS_PCPU_GET(primary->vmbus_sc, vcpuid, smp_pro_id); TAILQ_FOREACH(new_channel, &primary->sc_list_anchor, sc_list_entry) { if (new_channel->state != HV_CHANNEL_OPENED_STATE){ @@ -786,21 +644,6 @@ vmbus_select_outgoing_channel(struct hv_ return(outgoing_channel); } -void -vmbus_scan(void) -{ - uint32_t chancnt; - - mtx_lock(&vmbus_chwait_lock); - while ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0) - mtx_sleep(&vmbus_chancnt, &vmbus_chwait_lock, 0, "waitch", 0); - chancnt = vmbus_chancnt & ~VMBUS_CHANCNT_DONE; - - while (vmbus_devcnt != chancnt) - mtx_sleep(&vmbus_devcnt, &vmbus_chwait_lock, 0, "waitdev", 0); - mtx_unlock(&vmbus_chwait_lock); -} - struct hv_vmbus_channel ** vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt) { @@ -842,20 +685,17 @@ vmbus_rel_subchan(struct hv_vmbus_channe void vmbus_chan_msgproc(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_table_entry *entry; - const hv_vmbus_channel_msg_header *hdr; - hv_vmbus_channel_msg_type msg_type; - - hdr = (const hv_vmbus_channel_msg_header *)msg->msg_data; - msg_type = hdr->message_type; + vmbus_chanmsg_proc_t msg_proc; + uint32_t msg_type; + msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type; if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) { device_printf(sc->vmbus_dev, "unknown message type 0x%x\n", msg_type); return; } - entry = &g_channel_message_table[msg_type]; - if (entry->messageHandler) - entry->messageHandler(sc, msg); + msg_proc = vmbus_chanmsg_process[msg_type]; + if (msg_proc != NULL) + msg_proc(sc, msg); } Modified: stable/11/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_connection.c Fri Oct 14 07:39:34 2016 (r307290) +++ stable/11/sys/dev/hyperv/vmbus/hv_connection.c Fri Oct 14 07:40:04 2016 (r307291) @@ -92,19 +92,13 @@ hv_vmbus_connect(struct vmbus_softc *sc) int hv_vmbus_disconnect(void) { - int ret = 0; - hv_vmbus_channel_unload msg; - - msg.message_type = HV_CHANNEL_MESSAGE_UNLOAD; - - ret = hv_vmbus_post_message(&msg, sizeof(hv_vmbus_channel_unload)); mtx_destroy(&hv_vmbus_g_connection.channel_msg_lock); free(hv_vmbus_g_connection.channels, M_DEVBUF); hv_vmbus_g_connection.connect_state = HV_DISCONNECTED; - return (ret); + return (0); } static __inline void @@ -210,7 +204,7 @@ int hv_vmbus_post_message(void *buffer, int hv_vmbus_set_event(hv_vmbus_channel *channel) { - struct vmbus_softc *sc = vmbus_get_softc(); + struct vmbus_softc *sc = channel->vmbus_sc; int ret = 0; uint32_t chanid = channel->offer_msg.child_rel_id; @@ -228,7 +222,7 @@ vmbus_on_channel_open(const struct hv_vm int flag_cnt; flag_cnt = (chan->offer_msg.child_rel_id / VMBUS_EVTFLAG_LEN) + 1; - flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flags_cnt, + flag_cnt_ptr = VMBUS_PCPU_PTR(chan->vmbus_sc, event_flags_cnt, chan->target_cpu); for (;;) { Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Oct 14 07:39:34 2016 (r307290) +++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Oct 14 07:40:04 2016 (r307291) @@ -395,9 +395,7 @@ void hv_ring_buffer_read_begin( uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); -hv_vmbus_channel* hv_vmbus_allocate_channel(void); void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); -int hv_vmbus_request_channel_offers(void); void hv_vmbus_release_unattached_channels(void); uint16_t hv_vmbus_post_msg_via_msg_ipc( @@ -413,7 +411,9 @@ struct hv_device* hv_vmbus_child_device_ hv_guid device_instance, hv_vmbus_channel *channel); -int hv_vmbus_child_device_register( +struct vmbus_softc; + +void hv_vmbus_child_device_register(struct vmbus_softc *, struct hv_device *child_dev); int hv_vmbus_child_device_unregister( struct hv_device *child_dev); @@ -421,13 +421,9 @@ int hv_vmbus_child_device_unregister( /** * Connection interfaces */ -struct vmbus_softc; int hv_vmbus_connect(struct vmbus_softc *); int hv_vmbus_disconnect(void); int hv_vmbus_post_message(void *buffer, size_t buf_size); int hv_vmbus_set_event(hv_vmbus_channel *channel); -/* Wait for device creation */ -void vmbus_scan(void); - #endif /* __HYPERV_PRIV_H__ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 07:39:34 2016 (r307290) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 07:40:04 2016 (r307291) @@ -98,6 +98,13 @@ struct vmbus_msghc_ctx { static int vmbus_init(struct vmbus_softc *); static int vmbus_init_contact(struct vmbus_softc *, uint32_t); +static int vmbus_req_channels(struct vmbus_softc *sc); +static void vmbus_uninit(struct vmbus_softc *); +static int vmbus_scan(struct vmbus_softc *); +static void vmbus_scan_wait(struct vmbus_softc *); +static void vmbus_scan_newdev(struct vmbus_softc *); + +static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS); static struct vmbus_msghc_ctx *vmbus_msghc_ctx_create(bus_dma_tag_t); static void vmbus_msghc_ctx_destroy( @@ -418,6 +425,131 @@ vmbus_init(struct vmbus_softc *sc) } static void +vmbus_uninit(struct vmbus_softc *sc) +{ + struct vmbus_chanmsg_unload *req; + struct vmbus_msghc *mh; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for unload\n"); + return; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_UNLOAD; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + if (error) { + device_printf(sc->vmbus_dev, + "unload msg hypercall failed\n"); + } +} + +static int +vmbus_req_channels(struct vmbus_softc *sc) +{ + struct vmbus_chanmsg_channel_req *req; + struct vmbus_msghc *mh; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) + return ENXIO; + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHANNEL_REQ; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + return error; +} + +void +vmbus_scan_newchan(struct vmbus_softc *sc) +{ + mtx_lock(&sc->vmbus_scan_lock); + if ((sc->vmbus_scan_chcnt & VMBUS_SCAN_CHCNT_DONE) == 0) + sc->vmbus_scan_chcnt++; + mtx_unlock(&sc->vmbus_scan_lock); +} + +void +vmbus_scan_done(struct vmbus_softc *sc) +{ + mtx_lock(&sc->vmbus_scan_lock); + sc->vmbus_scan_chcnt |= VMBUS_SCAN_CHCNT_DONE; + mtx_unlock(&sc->vmbus_scan_lock); + wakeup(&sc->vmbus_scan_chcnt); +} + +static void +vmbus_scan_newdev(struct vmbus_softc *sc) +{ + mtx_lock(&sc->vmbus_scan_lock); + sc->vmbus_scan_devcnt++; + mtx_unlock(&sc->vmbus_scan_lock); + wakeup(&sc->vmbus_scan_devcnt); +} + +static void +vmbus_scan_wait(struct vmbus_softc *sc) +{ + uint32_t chancnt; + + mtx_lock(&sc->vmbus_scan_lock); + while ((sc->vmbus_scan_chcnt & VMBUS_SCAN_CHCNT_DONE) == 0) { + mtx_sleep(&sc->vmbus_scan_chcnt, &sc->vmbus_scan_lock, 0, + "waitch", 0); + } + chancnt = sc->vmbus_scan_chcnt & ~VMBUS_SCAN_CHCNT_DONE; + + while (sc->vmbus_scan_devcnt != chancnt) { + mtx_sleep(&sc->vmbus_scan_devcnt, &sc->vmbus_scan_lock, 0, + "waitdev", 0); + } + mtx_unlock(&sc->vmbus_scan_lock); +} + +static int +vmbus_scan(struct vmbus_softc *sc) +{ + int error; + + /* + * Start vmbus scanning. + */ + error = vmbus_req_channels(sc); + if (error) { + device_printf(sc->vmbus_dev, "channel request failed: %d\n", + error); + return error; + } + + /* + * Wait for all devices are added to vmbus. + */ + vmbus_scan_wait(sc); + + /* + * Identify, probe and attach. + */ + bus_generic_probe(sc->vmbus_dev); + bus_generic_attach(sc->vmbus_dev); + + if (bootverbose) { + device_printf(sc->vmbus_dev, "device scan, probe and attach " + "done\n"); + } + return 0; +} + +static void vmbus_msg_task(void *xsc, int pending __unused) { struct vmbus_softc *sc = xsc; @@ -892,12 +1024,13 @@ hv_vmbus_child_device_create(hv_guid typ return (child_dev); } -int -hv_vmbus_child_device_register(struct hv_device *child_dev) +void +hv_vmbus_child_device_register(struct vmbus_softc *sc, + struct hv_device *child_dev) { device_t child, parent; - parent = vmbus_get_device(); + parent = sc->vmbus_dev; if (bootverbose) { char name[HYPERV_GUID_STRLEN]; @@ -909,7 +1042,8 @@ hv_vmbus_child_device_register(struct hv child_dev->device = child; device_set_ivars(child, child_dev); - return (0); + /* New device was added to vmbus */ + vmbus_scan_newdev(sc); } int @@ -927,6 +1061,17 @@ hv_vmbus_child_device_unregister(struct } static int +vmbus_sysctl_version(SYSCTL_HANDLER_ARGS) +{ + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + hv_vmbus_protocal_version >> 16, + hv_vmbus_protocal_version & 0xffff); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + +static int vmbus_probe(device_t dev) { char *id[] = { "VMBUS", NULL }; @@ -954,15 +1099,18 @@ vmbus_probe(device_t dev) * - retrieve the channel offers */ static int -vmbus_bus_init(void) +vmbus_doattach(struct vmbus_softc *sc) { - struct vmbus_softc *sc = vmbus_get_softc(); + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; int ret; if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) return (0); sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; + mtx_init(&sc->vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF); + /* * Create context for "post message" Hypercalls */ @@ -1012,11 +1160,15 @@ vmbus_bus_init(void) else sc->vmbus_event_proc = vmbus_event_proc; - hv_vmbus_request_channel_offers(); + ret = vmbus_scan(sc); + if (ret != 0) + goto cleanup; - vmbus_scan(); - bus_generic_attach(sc->vmbus_dev); - device_printf(sc->vmbus_dev, "device scan, probe and attach done\n"); + ctx = device_get_sysctl_ctx(sc->vmbus_dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->vmbus_dev)); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + vmbus_sysctl_version, "A", "vmbus version"); return (ret); @@ -1027,6 +1179,7 @@ cleanup: vmbus_msghc_ctx_destroy(sc->vmbus_msg_hc); sc->vmbus_msg_hc = NULL; } + mtx_destroy(&sc->vmbus_scan_lock); return (ret); } @@ -1059,16 +1212,17 @@ vmbus_attach(device_t dev) */ if (!cold) #endif - vmbus_bus_init(); + vmbus_doattach(vmbus_sc); - bus_generic_probe(dev); return (0); } static void vmbus_sysinit(void *arg __unused) { - if (vm_guest != VM_GUEST_HV || vmbus_get_softc() == NULL) + struct vmbus_softc *sc = vmbus_get_softc(); + + if (vm_guest != VM_GUEST_HV || sc == NULL) return; #ifndef EARLY_AP_STARTUP @@ -1080,7 +1234,7 @@ vmbus_sysinit(void *arg __unused) */ if (!cold) #endif - vmbus_bus_init(); + vmbus_doattach(sc); } static int @@ -1089,6 +1243,8 @@ vmbus_detach(device_t dev) struct vmbus_softc *sc = device_get_softc(dev); hv_vmbus_release_unattached_channels(); + + vmbus_uninit(sc); hv_vmbus_disconnect(); if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) { @@ -1104,6 +1260,7 @@ vmbus_detach(device_t dev) sc->vmbus_msg_hc = NULL; } + mtx_destroy(&sc->vmbus_scan_lock); return (0); } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Oct 14 07:39:34 2016 (r307290) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Oct 14 07:40:04 2016 (r307291) @@ -83,8 +83,10 @@ CTASSERT(sizeof(struct vmbus_evtflags) = * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. */ +#define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3 /* REQ */ #define VMBUS_CHANMSG_TYPE_INIT_CONTACT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_VERSION_RESP 15 /* RESP */ +#define VMBUS_CHANMSG_TYPE_UNLOAD 16 /* REQ */ struct vmbus_chanmsg_hdr { uint32_t chm_type; /* VMBUS_CHANMSG_TYPE_ */ @@ -107,4 +109,14 @@ struct vmbus_chanmsg_version_resp { uint8_t chm_supp; } __packed; +/* VMBUS_CHANMSG_TYPE_CHANNEL_REQ */ +struct vmbus_chanmsg_channel_req { + struct vmbus_chanmsg_hdr chm_hdr; +} __packed; + +/* VMBUS_CHANMSG_TYPE_UNLOAD */ +struct vmbus_chanmsg_unload { + struct vmbus_chanmsg_hdr chm_hdr; +} __packed; + #endif /* !_VMBUS_REG_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Fri Oct 14 07:39:34 2016 (r307290) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Fri Oct 14 07:40:04 2016 (r307291) @@ -84,6 +84,11 @@ struct vmbus_softc { void *vmbus_mnf1; /* monitored by VM, unused */ struct hyperv_dma vmbus_mnf1_dma; struct hyperv_dma vmbus_mnf2_dma; + + struct mtx vmbus_scan_lock; + uint32_t vmbus_scan_chcnt; +#define VMBUS_SCAN_CHCNT_DONE 0x80000000 + uint32_t vmbus_scan_devcnt; }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ @@ -129,4 +134,7 @@ const struct vmbus_message *vmbus_msghc_ struct vmbus_msghc *); void vmbus_msghc_wakeup(struct vmbus_softc *, const struct vmbus_message *); +void vmbus_scan_done(struct vmbus_softc *); +void vmbus_scan_newchan(struct vmbus_softc *); + #endif /* !_VMBUS_VAR_H_ */ From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:41:13 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29D99C11074; Fri, 14 Oct 2016 07:41:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E890E10C; Fri, 14 Oct 2016 07:41:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7fC2x073341; Fri, 14 Oct 2016 07:41:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7fCKs073340; Fri, 14 Oct 2016 07:41:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140741.u9E7fCKs073340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307293 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:41:13 -0000 Author: mav Date: Fri Oct 14 07:41:11 2016 New Revision: 307293 URL: https://svnweb.freebsd.org/changeset/base/307293 Log: MFC r305342: Missed FreeBSD-specific piece of r305338. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Fri Oct 14 07:40:20 2016 (r307292) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Fri Oct 14 07:41:11 2016 (r307293) @@ -1435,7 +1435,7 @@ zap_cursor_move_to_key(zap_cursor_t *zc, if (zc->zc_zap == NULL) { err = zap_lockdir(zc->zc_objset, zc->zc_zapobj, NULL, - RW_READER, TRUE, FALSE, &zc->zc_zap); + RW_READER, TRUE, FALSE, FTAG, &zc->zc_zap); if (err) return (err); } else { From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:42:54 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0E39C11227; Fri, 14 Oct 2016 07:42:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB98F90A; Fri, 14 Oct 2016 07:42:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7grfY073519; Fri, 14 Oct 2016 07:42:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7grUL073518; Fri, 14 Oct 2016 07:42:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140742.u9E7grUL073518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:42:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307295 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:42:55 -0000 Author: mav Date: Fri Oct 14 07:42:53 2016 New Revision: 307295 URL: https://svnweb.freebsd.org/changeset/base/307295 Log: MFC r305456 (by avg): fix zfs pool creation accidentally broken by r305331 The upstream change introduced a new load state, SPA_LOAD_CREATE, and vdev_geom code needs to be aware of it. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 14 07:41:44 2016 (r307294) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 14 07:42:53 2016 (r307295) @@ -777,7 +777,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi if (vd->vdev_spa->spa_splitting_newspa || (vd->vdev_prevstate == VDEV_STATE_UNKNOWN && - vd->vdev_spa->spa_load_state == SPA_LOAD_NONE)) { + vd->vdev_spa->spa_load_state == SPA_LOAD_NONE || + vd->vdev_spa->spa_load_state == SPA_LOAD_CREATE)) { /* * We are dealing with a vdev that hasn't been previously * opened (since boot), and we are not loading an From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:44:26 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C6EFC112E4; Fri, 14 Oct 2016 07:44:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E98C2BC8; Fri, 14 Oct 2016 07:44:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7iPIi073734; Fri, 14 Oct 2016 07:44:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7iPSu073733; Fri, 14 Oct 2016 07:44:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140744.u9E7iPSu073733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307297 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:44:26 -0000 Author: mav Date: Fri Oct 14 07:44:24 2016 New Revision: 307297 URL: https://svnweb.freebsd.org/changeset/base/307297 Log: MFC r305561: MFV r305560: 7278 tuning zfs_arc_max does not impact arc_c_min When changing zfs_arc_max (e.g. as zdb does), it may be set to less than the default arc_c_min. arc_c_min should decrease to not be more than arc_c_max, but it doesn't; therefore tuning of arc_c_max is ineffective. Reviewed by: Dan Kimmel Reviewed by: Paul Dagnelie Reviewed by: Prakash Surya Reviewed by: Igor Kozhukhov Author: Matthew Ahrens openzfs/openzfs@608764beadaf4bb71c5d8fe1818e8392ac66a61b Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Oct 14 07:43:28 2016 (r307296) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Oct 14 07:44:24 2016 (r307297) @@ -6062,8 +6062,10 @@ arc_init(void) * Allow the tunables to override our calculations if they are * reasonable. */ - if (zfs_arc_max > arc_abs_min && zfs_arc_max < kmem_size()) + if (zfs_arc_max > arc_abs_min && zfs_arc_max < kmem_size()) { arc_c_max = zfs_arc_max; + arc_c_min = MIN(arc_c_min, arc_c_max); + } if (zfs_arc_min > arc_abs_min && zfs_arc_min <= arc_c_max) arc_c_min = zfs_arc_min; #endif From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:46:10 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBCB5C11418; Fri, 14 Oct 2016 07:46:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 801CDF13; Fri, 14 Oct 2016 07:46:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7k9Ag073942; Fri, 14 Oct 2016 07:46:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7k9jo073941; Fri, 14 Oct 2016 07:46:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610140746.u9E7k9jo073941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 07:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307299 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:46:10 -0000 Author: mav Date: Fri Oct 14 07:46:09 2016 New Revision: 307299 URL: https://svnweb.freebsd.org/changeset/base/307299 Log: MFC r305563: MFV r305562: 7259 DS_FIELD_LARGE_BLOCKS is unused The DS_FIELD_LARGE_BLOCKS macro has been unused since the integration of this patch: commit ca0cc3918a1789fa839194af2a9245f801a06b1a Author: Matthew Ahrens Date: Fri Jul 24 09:53:55 2015 -0700 5959 clean up per-dataset feature count code Reviewed by: Toomas Soome Reviewed by: George Wilson Reviewed by: Alex Reece Approved by: Richard Lowe This patch simply removes this macro from dsl_dataset.h. Reviewed by: Dan Kimmel Reviewed by: Prakash Surya Reviewed by: Dan McDonald Reviewed by: Igor Kozhukhov Author: Matthew Ahrens Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Fri Oct 14 07:45:10 2016 (r307298) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Fri Oct 14 07:46:09 2016 (r307299) @@ -86,13 +86,6 @@ struct dsl_pool; #define DS_FIELD_BOOKMARK_NAMES "com.delphix:bookmarks" /* - * This field is present (with value=0) if this dataset may contain large - * blocks (>128KB). If it is present, then this dataset - * is counted in the refcount of the SPA_FEATURE_LARGE_BLOCKS feature. - */ -#define DS_FIELD_LARGE_BLOCKS "org.open-zfs:large_blocks" - -/* * These fields are set on datasets that are in the middle of a resumable * receive, and allow the sender to resume the send if it is interrupted. */ From owner-svn-src-stable-11@freebsd.org Fri Oct 14 07:47:37 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DB67C114D7; Fri, 14 Oct 2016 07:47:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBD88273; Fri, 14 Oct 2016 07:47:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E7lZ3n074112; Fri, 14 Oct 2016 07:47:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E7lZKa074108; Fri, 14 Oct 2016 07:47:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140747.u9E7lZKa074108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 07:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307301 - in stable/11/sys/dev/hyperv: include vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 07:47:37 -0000 Author: sephe Date: Fri Oct 14 07:47:35 2016 New Revision: 307301 URL: https://svnweb.freebsd.org/changeset/base/307301 Log: MFC 302607-302612 302607 hyperv/vmbus: Use post message Hypercall APIs for channel open Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6876 302608 hyperv/vmbus: Remove unnecessary check and unapplied comment Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6877 302609 hyperv/vmbus: Use post message Hypercall APIs for GPADL connect. This also fixes memory leakge if sub-connect messages are needed. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6878 302610 hyperv/vmbus: Use post message Hypercall APIs for channel close Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6906 302611 hyperv/vmbus: Use post message Hypercall APIs for GPA disconnect Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6912 302612 hyperv: Nuke unused stuffs Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6913 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_connection.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/hyperv.c stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 07:47:07 2016 (r307300) +++ stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 07:47:35 2016 (r307301) @@ -179,8 +179,6 @@ typedef struct hv_vmbus_channel_offer { } __packed hv_vmbus_channel_offer; -typedef uint32_t hv_gpadl_handle; - typedef struct { uint16_t type; uint16_t data_offset8; @@ -352,14 +350,6 @@ typedef struct { } __packed hv_vmbus_channel_query_vmbus_version; /* - * VMBus Version Supported parameters - */ -typedef struct { - hv_vmbus_channel_msg_header header; - hv_bool_uint8_t version_supported; -} __packed hv_vmbus_channel_version_supported; - -/* * Channel Offer parameters */ typedef struct { @@ -397,171 +387,13 @@ typedef struct uint32_t child_rel_id; } __packed hv_vmbus_channel_rescind_offer; - -/* - * Request Offer -- no parameters, SynIC message contains the partition ID - * - * Set Snoop -- no parameters, SynIC message contains the partition ID - * - * Clear Snoop -- no parameters, SynIC message contains the partition ID - * - * All Offers Delivered -- no parameters, SynIC message contains the - * partition ID - * - * Flush Client -- no parameters, SynIC message contains the partition ID - */ - - -/* - * Open Channel parameters - */ -typedef struct -{ - hv_vmbus_channel_msg_header header; - - /* - * Identifies the specific VMBus channel that is being opened. - */ - uint32_t child_rel_id; - - /* - * ID making a particular open request at a channel offer unique. - */ - uint32_t open_id; - - /* - * GPADL for the channel's ring buffer. - */ - hv_gpadl_handle ring_buffer_gpadl_handle; - - /* - * Before win8, all incoming channel interrupts are only - * delivered on cpu 0. Setting this value to 0 would - * preserve the earlier behavior. - */ - uint32_t target_vcpu; - - /* - * The upstream ring buffer begins at offset zero in the memory described - * by ring_buffer_gpadl_handle. The downstream ring buffer follows it at - * this offset (in pages). - */ - uint32_t downstream_ring_buffer_page_offset; - - /* - * User-specific data to be passed along to the server endpoint. - */ - uint8_t user_data[HV_MAX_USER_DEFINED_BYTES]; - -} __packed hv_vmbus_channel_open_channel; - -typedef uint32_t hv_nt_status; - -/* - * Open Channel Result parameters - */ -typedef struct -{ - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; - uint32_t open_id; - hv_nt_status status; -} __packed hv_vmbus_channel_open_result; - -/* - * Close channel parameters - */ -typedef struct -{ - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; -} __packed hv_vmbus_channel_close_channel; - -/* - * Channel Message GPADL - */ -#define HV_GPADL_TYPE_RING_BUFFER 1 -#define HV_GPADL_TYPE_SERVER_SAVE_AREA 2 -#define HV_GPADL_TYPE_TRANSACTION 8 - -/* - * The number of PFNs in a GPADL message is defined by the number of pages - * that would be spanned by byte_count and byte_offset. If the implied number - * of PFNs won't fit in this packet, there will be a follow-up packet that - * contains more - */ - -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; - uint32_t gpadl; - uint16_t range_buf_len; - uint16_t range_count; - hv_gpa_range range[0]; -} __packed hv_vmbus_channel_gpadl_header; - -/* - * This is the follow-up packet that contains more PFNs - */ -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t message_number; - uint32_t gpadl; - uint64_t pfn[0]; -} __packed hv_vmbus_channel_gpadl_body; - -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; - uint32_t gpadl; - uint32_t creation_status; -} __packed hv_vmbus_channel_gpadl_created; - -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; - uint32_t gpadl; -} __packed hv_vmbus_channel_gpadl_teardown; - -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t gpadl; -} __packed hv_vmbus_channel_gpadl_torndown; - typedef struct { hv_vmbus_channel_msg_header header; uint32_t child_rel_id; } __packed hv_vmbus_channel_relid_released; -typedef hv_vmbus_channel_msg_header hv_vmbus_channel_unload; - #define HW_MACADDR_LEN 6 -/* - * Fixme: Added to quiet "typeof" errors involving hv_vmbus.h when - * the including C file was compiled with "-std=c99". - */ -#ifndef typeof -#define typeof __typeof -#endif - -#ifndef NULL -#define NULL (void *)0 -#endif - -typedef void *hv_vmbus_handle; - -#ifndef CONTAINING_RECORD -#define CONTAINING_RECORD(address, type, field) ((type *)( \ - (uint8_t *)(address) - \ - (uint8_t *)(&((type *)0)->field))) -#endif /* CONTAINING_RECORD */ - - -#define container_of(ptr, type, member) ({ \ - __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - enum { HV_VMBUS_IVAR_TYPE, HV_VMBUS_IVAR_INSTANCE, Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 07:47:07 2016 (r307300) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 07:47:35 2016 (r307301) @@ -49,14 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -static int vmbus_channel_create_gpadl_header( - /* must be phys and virt contiguous*/ - void* contig_buffer, - /* page-size multiple */ - uint32_t size, - hv_vmbus_channel_msg_info** msg_info, - uint32_t* message_count); - static void vmbus_channel_set_event(hv_vmbus_channel* channel); static void VmbusProcessChannelEvent(void* channel, int pending); @@ -182,11 +174,21 @@ hv_vmbus_channel_open( hv_vmbus_pfn_channel_callback pfn_on_channel_callback, void* context) { - + struct vmbus_softc *sc = new_channel->vmbus_sc; + const struct vmbus_chanmsg_chopen_resp *resp; + const struct vmbus_message *msg; + struct vmbus_chanmsg_chopen *req; + struct vmbus_msghc *mh; + uint32_t status; int ret = 0; void *in, *out; - hv_vmbus_channel_open_channel* open_msg; - hv_vmbus_channel_msg_info* open_info; + + if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { + device_printf(sc->vmbus_dev, + "invalid udata len %u for chan%u\n", + user_data_len, new_channel->offer_msg.child_rel_id); + return EINVAL; + } mtx_lock(&new_channel->sc_lock); if (new_channel->state == HV_CHANNEL_OPEN_STATE) { @@ -248,381 +250,231 @@ hv_vmbus_channel_open( send_ring_buffer_size + recv_ring_buffer_size, &new_channel->ring_buffer_gpadl_handle); - /** - * Create and init the channel open message + /* + * Open channel w/ the bufring GPADL on the target CPU. */ - open_info = (hv_vmbus_channel_msg_info*) malloc( - sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_open_channel), - M_DEVBUF, - M_NOWAIT); - KASSERT(open_info != NULL, - ("Error VMBUS: malloc failed to allocate Open Channel message!")); - - if (open_info == NULL) - return (ENOMEM); - - sema_init(&open_info->wait_sema, 0, "Open Info Sema"); - - open_msg = (hv_vmbus_channel_open_channel*) open_info->msg; - open_msg->header.message_type = HV_CHANNEL_MESSAGE_OPEN_CHANNEL; - open_msg->open_id = new_channel->offer_msg.child_rel_id; - open_msg->child_rel_id = new_channel->offer_msg.child_rel_id; - open_msg->ring_buffer_gpadl_handle = - new_channel->ring_buffer_gpadl_handle; - open_msg->downstream_ring_buffer_page_offset = send_ring_buffer_size - >> PAGE_SHIFT; - open_msg->target_vcpu = new_channel->target_vcpu; - + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for chopen(chan%u)\n", + new_channel->offer_msg.child_rel_id); + return ENXIO; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN; + req->chm_chanid = new_channel->offer_msg.child_rel_id; + req->chm_openid = new_channel->offer_msg.child_rel_id; + req->chm_gpadl = new_channel->ring_buffer_gpadl_handle; + req->chm_vcpuid = new_channel->target_vcpu; + req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT; if (user_data_len) - memcpy(open_msg->user_data, user_data, user_data_len); - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_INSERT_TAIL( - &hv_vmbus_g_connection.channel_msg_anchor, - open_info, - msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - - ret = hv_vmbus_post_message( - open_msg, sizeof(hv_vmbus_channel_open_channel)); + memcpy(req->chm_udata, user_data, user_data_len); - if (ret != 0) - goto cleanup; - - ret = sema_timedwait(&open_info->wait_sema, 5 * hz); /* KYS 5 seconds */ - - if (ret) { - if(bootverbose) - printf("VMBUS: channel <%p> open timeout.\n", new_channel); - goto cleanup; + ret = vmbus_msghc_exec(sc, mh); + if (ret != 0) { + device_printf(sc->vmbus_dev, + "chopen(chan%u) msg hypercall exec failed: %d\n", + new_channel->offer_msg.child_rel_id, ret); + vmbus_msghc_put(sc, mh); + return ret; } - if (open_info->response.open_result.status == 0) { - new_channel->state = HV_CHANNEL_OPENED_STATE; - if(bootverbose) - printf("VMBUS: channel <%p> open success.\n", new_channel); + msg = vmbus_msghc_wait_result(sc, mh); + resp = (const struct vmbus_chanmsg_chopen_resp *)msg->msg_data; + status = resp->chm_status; + + vmbus_msghc_put(sc, mh); + + if (status == 0) { + new_channel->state = HV_CHANNEL_OPENED_STATE; + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u opened\n", + new_channel->offer_msg.child_rel_id); + } } else { - if(bootverbose) - printf("Error VMBUS: channel <%p> open failed - %d!\n", - new_channel, open_info->response.open_result.status); + device_printf(sc->vmbus_dev, "failed to open chan%u\n", + new_channel->offer_msg.child_rel_id); + ret = ENXIO; } - - cleanup: - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_REMOVE( - &hv_vmbus_g_connection.channel_msg_anchor, - open_info, - msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - sema_destroy(&open_info->wait_sema); - free(open_info, M_DEVBUF); - return (ret); } /** - * @brief Create a gpadl for the specified buffer - */ -static int -vmbus_channel_create_gpadl_header( - void* contig_buffer, - uint32_t size, /* page-size multiple */ - hv_vmbus_channel_msg_info** msg_info, - uint32_t* message_count) -{ - int i; - int page_count; - unsigned long long pfn; - uint32_t msg_size; - hv_vmbus_channel_gpadl_header* gpa_header; - hv_vmbus_channel_gpadl_body* gpadl_body; - hv_vmbus_channel_msg_info* msg_header; - hv_vmbus_channel_msg_info* msg_body; - - int pfnSum, pfnCount, pfnLeft, pfnCurr, pfnSize; - - page_count = size >> PAGE_SHIFT; - pfn = hv_get_phys_addr(contig_buffer) >> PAGE_SHIFT; - - /*do we need a gpadl body msg */ - pfnSize = HV_MAX_SIZE_CHANNEL_MESSAGE - - sizeof(hv_vmbus_channel_gpadl_header) - - sizeof(hv_gpa_range); - pfnCount = pfnSize / sizeof(uint64_t); - - if (page_count > pfnCount) { /* if(we need a gpadl body) */ - /* fill in the header */ - msg_size = sizeof(hv_vmbus_channel_msg_info) - + sizeof(hv_vmbus_channel_gpadl_header) - + sizeof(hv_gpa_range) - + pfnCount * sizeof(uint64_t); - msg_header = malloc(msg_size, M_DEVBUF, M_NOWAIT | M_ZERO); - KASSERT( - msg_header != NULL, - ("Error VMBUS: malloc failed to allocate Gpadl Message!")); - if (msg_header == NULL) - return (ENOMEM); - - TAILQ_INIT(&msg_header->sub_msg_list_anchor); - msg_header->message_size = msg_size; - - gpa_header = (hv_vmbus_channel_gpadl_header*) msg_header->msg; - gpa_header->range_count = 1; - gpa_header->range_buf_len = sizeof(hv_gpa_range) - + page_count * sizeof(uint64_t); - gpa_header->range[0].byte_offset = 0; - gpa_header->range[0].byte_count = size; - for (i = 0; i < pfnCount; i++) { - gpa_header->range[0].pfn_array[i] = pfn + i; - } - *msg_info = msg_header; - *message_count = 1; - - pfnSum = pfnCount; - pfnLeft = page_count - pfnCount; - - /* - * figure out how many pfns we can fit - */ - pfnSize = HV_MAX_SIZE_CHANNEL_MESSAGE - - sizeof(hv_vmbus_channel_gpadl_body); - pfnCount = pfnSize / sizeof(uint64_t); - - /* - * fill in the body - */ - while (pfnLeft) { - if (pfnLeft > pfnCount) { - pfnCurr = pfnCount; - } else { - pfnCurr = pfnLeft; - } - - msg_size = sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_gpadl_body) + - pfnCurr * sizeof(uint64_t); - msg_body = malloc(msg_size, M_DEVBUF, M_NOWAIT | M_ZERO); - KASSERT( - msg_body != NULL, - ("Error VMBUS: malloc failed to allocate Gpadl msg_body!")); - if (msg_body == NULL) - return (ENOMEM); - - msg_body->message_size = msg_size; - (*message_count)++; - gpadl_body = - (hv_vmbus_channel_gpadl_body*) msg_body->msg; - /* - * gpadl_body->gpadl = kbuffer; - */ - for (i = 0; i < pfnCurr; i++) { - gpadl_body->pfn[i] = pfn + pfnSum + i; - } - - TAILQ_INSERT_TAIL( - &msg_header->sub_msg_list_anchor, - msg_body, - msg_list_entry); - pfnSum += pfnCurr; - pfnLeft -= pfnCurr; - } - } else { /* else everything fits in a header */ - - msg_size = sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_gpadl_header) + - sizeof(hv_gpa_range) + - page_count * sizeof(uint64_t); - msg_header = malloc(msg_size, M_DEVBUF, M_NOWAIT | M_ZERO); - KASSERT( - msg_header != NULL, - ("Error VMBUS: malloc failed to allocate Gpadl Message!")); - if (msg_header == NULL) - return (ENOMEM); - - msg_header->message_size = msg_size; - - gpa_header = (hv_vmbus_channel_gpadl_header*) msg_header->msg; - gpa_header->range_count = 1; - gpa_header->range_buf_len = sizeof(hv_gpa_range) + - page_count * sizeof(uint64_t); - gpa_header->range[0].byte_offset = 0; - gpa_header->range[0].byte_count = size; - for (i = 0; i < page_count; i++) { - gpa_header->range[0].pfn_array[i] = pfn + i; - } - - *msg_info = msg_header; - *message_count = 1; - } - - return (0); -} - -/** * @brief Establish a GPADL for the specified buffer */ int -hv_vmbus_channel_establish_gpadl( - hv_vmbus_channel* channel, - void* contig_buffer, - uint32_t size, /* page-size multiple */ - uint32_t* gpadl_handle) - +hv_vmbus_channel_establish_gpadl(struct hv_vmbus_channel *channel, + void *contig_buffer, uint32_t size, uint32_t *gpadl0) { - int ret = 0; - hv_vmbus_channel_gpadl_header* gpadl_msg; - hv_vmbus_channel_gpadl_body* gpadl_body; - hv_vmbus_channel_msg_info* msg_info; - hv_vmbus_channel_msg_info* sub_msg_info; - uint32_t msg_count; - hv_vmbus_channel_msg_info* curr; - uint32_t next_gpadl_handle; - - next_gpadl_handle = atomic_fetchadd_int( - &hv_vmbus_g_connection.next_gpadl_handle, 1); - - ret = vmbus_channel_create_gpadl_header( - contig_buffer, size, &msg_info, &msg_count); + struct vmbus_softc *sc = channel->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_gpadl_conn *req; + const struct vmbus_message *msg; + size_t reqsz; + uint32_t gpadl, status; + int page_count, range_len, i, cnt, error; + uint64_t page_id, paddr; - if(ret != 0) { - /* - * XXX - * We can _not_ even revert the above incremental, - * if multiple GPADL establishments are running - * parallelly, decrement the global next_gpadl_handle - * is calling for _big_ trouble. A better solution - * is to have a 0-based GPADL id bitmap ... - */ - return ret; - } + /* + * Preliminary checks. + */ - sema_init(&msg_info->wait_sema, 0, "Open Info Sema"); - gpadl_msg = (hv_vmbus_channel_gpadl_header*) msg_info->msg; - gpadl_msg->header.message_type = HV_CHANNEL_MESSAGEL_GPADL_HEADER; - gpadl_msg->child_rel_id = channel->offer_msg.child_rel_id; - gpadl_msg->gpadl = next_gpadl_handle; - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_INSERT_TAIL( - &hv_vmbus_g_connection.channel_msg_anchor, - msg_info, - msg_list_entry); - - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - - ret = hv_vmbus_post_message( - gpadl_msg, - msg_info->message_size - - (uint32_t) sizeof(hv_vmbus_channel_msg_info)); + KASSERT((size & PAGE_MASK) == 0, + ("invalid GPA size %u, not multiple page size", size)); + page_count = size >> PAGE_SHIFT; - if (ret != 0) - goto cleanup; + paddr = hv_get_phys_addr(contig_buffer); + KASSERT((paddr & PAGE_MASK) == 0, + ("GPA is not page aligned %jx", (uintmax_t)paddr)); + page_id = paddr >> PAGE_SHIFT; - if (msg_count > 1) { - TAILQ_FOREACH(curr, - &msg_info->sub_msg_list_anchor, msg_list_entry) { - sub_msg_info = curr; - gpadl_body = - (hv_vmbus_channel_gpadl_body*) sub_msg_info->msg; - - gpadl_body->header.message_type = - HV_CHANNEL_MESSAGE_GPADL_BODY; - gpadl_body->gpadl = next_gpadl_handle; - - ret = hv_vmbus_post_message( - gpadl_body, - sub_msg_info->message_size - - (uint32_t) sizeof(hv_vmbus_channel_msg_info)); - /* if (the post message failed) give up and clean up */ - if(ret != 0) - goto cleanup; - } + range_len = __offsetof(struct vmbus_gpa_range, gpa_page[page_count]); + /* + * We don't support multiple GPA ranges. + */ + if (range_len > UINT16_MAX) { + device_printf(sc->vmbus_dev, "GPA too large, %d pages\n", + page_count); + return EOPNOTSUPP; } - ret = sema_timedwait(&msg_info->wait_sema, 5 * hz); /* KYS 5 seconds*/ - if (ret != 0) - goto cleanup; - - *gpadl_handle = gpadl_msg->gpadl; - -cleanup: - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_REMOVE(&hv_vmbus_g_connection.channel_msg_anchor, - msg_info, msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - - sema_destroy(&msg_info->wait_sema); - free(msg_info, M_DEVBUF); + /* + * Allocate GPADL id. + */ + gpadl = atomic_fetchadd_int( + &hv_vmbus_g_connection.next_gpadl_handle, 1); + *gpadl0 = gpadl; - return (ret); + /* + * Connect this GPADL to the target channel. + * + * NOTE: + * Since each message can only hold small set of page + * addresses, several messages may be required to + * complete the connection. + */ + if (page_count > VMBUS_CHANMSG_GPADL_CONN_PGMAX) + cnt = VMBUS_CHANMSG_GPADL_CONN_PGMAX; + else + cnt = page_count; + page_count -= cnt; + + reqsz = __offsetof(struct vmbus_chanmsg_gpadl_conn, + chm_range.gpa_page[cnt]); + mh = vmbus_msghc_get(sc, reqsz); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for gpadl->chan%u\n", + channel->offer_msg.child_rel_id); + return EIO; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_CONN; + req->chm_chanid = channel->offer_msg.child_rel_id; + req->chm_gpadl = gpadl; + req->chm_range_len = range_len; + req->chm_range_cnt = 1; + req->chm_range.gpa_len = size; + req->chm_range.gpa_ofs = 0; + for (i = 0; i < cnt; ++i) + req->chm_range.gpa_page[i] = page_id++; + + error = vmbus_msghc_exec(sc, mh); + if (error) { + device_printf(sc->vmbus_dev, + "gpadl->chan%u msg hypercall exec failed: %d\n", + channel->offer_msg.child_rel_id, error); + vmbus_msghc_put(sc, mh); + return error; + } + + while (page_count > 0) { + struct vmbus_chanmsg_gpadl_subconn *subreq; + + if (page_count > VMBUS_CHANMSG_GPADL_SUBCONN_PGMAX) + cnt = VMBUS_CHANMSG_GPADL_SUBCONN_PGMAX; + else + cnt = page_count; + page_count -= cnt; + + reqsz = __offsetof(struct vmbus_chanmsg_gpadl_subconn, + chm_gpa_page[cnt]); + vmbus_msghc_reset(mh, reqsz); + + subreq = vmbus_msghc_dataptr(mh); + subreq->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_SUBCONN; + subreq->chm_gpadl = gpadl; + for (i = 0; i < cnt; ++i) + subreq->chm_gpa_page[i] = page_id++; + + vmbus_msghc_exec_noresult(mh); + } + KASSERT(page_count == 0, ("invalid page count %d", page_count)); + + msg = vmbus_msghc_wait_result(sc, mh); + status = ((const struct vmbus_chanmsg_gpadl_connresp *) + msg->msg_data)->chm_status; + + vmbus_msghc_put(sc, mh); + + if (status != 0) { + device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " + "status %u\n", channel->offer_msg.child_rel_id, status); + return EIO; + } + return 0; } -/** - * @brief Teardown the specified GPADL handle +/* + * Disconnect the GPA from the target channel */ int -hv_vmbus_channel_teardown_gpdal( - hv_vmbus_channel* channel, - uint32_t gpadl_handle) +hv_vmbus_channel_teardown_gpdal(struct hv_vmbus_channel *chan, uint32_t gpadl) { - int ret = 0; - hv_vmbus_channel_gpadl_teardown* msg; - hv_vmbus_channel_msg_info* info; - - info = (hv_vmbus_channel_msg_info *) - malloc( sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_gpadl_teardown), - M_DEVBUF, M_NOWAIT); - KASSERT(info != NULL, - ("Error VMBUS: malloc failed to allocate Gpadl Teardown Msg!")); - if (info == NULL) { - ret = ENOMEM; - goto cleanup; - } - - sema_init(&info->wait_sema, 0, "Open Info Sema"); - - msg = (hv_vmbus_channel_gpadl_teardown*) info->msg; - - msg->header.message_type = HV_CHANNEL_MESSAGE_GPADL_TEARDOWN; - msg->child_rel_id = channel->offer_msg.child_rel_id; - msg->gpadl = gpadl_handle; - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_INSERT_TAIL(&hv_vmbus_g_connection.channel_msg_anchor, - info, msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - - ret = hv_vmbus_post_message(msg, - sizeof(hv_vmbus_channel_gpadl_teardown)); - if (ret != 0) - goto cleanup; - - ret = sema_timedwait(&info->wait_sema, 5 * hz); /* KYS 5 seconds */ - -cleanup: - /* - * Received a torndown response - */ - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_REMOVE(&hv_vmbus_g_connection.channel_msg_anchor, - info, msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - sema_destroy(&info->wait_sema); - free(info, M_DEVBUF); + struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_gpadl_disconn *req; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for gpa x->chan%u\n", + chan->offer_msg.child_rel_id); + return EBUSY; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_DISCONN; + req->chm_chanid = chan->offer_msg.child_rel_id; + req->chm_gpadl = gpadl; + + error = vmbus_msghc_exec(sc, mh); + if (error) { + device_printf(sc->vmbus_dev, + "gpa x->chan%u msg hypercall exec failed: %d\n", + chan->offer_msg.child_rel_id, error); + vmbus_msghc_put(sc, mh); + return error; + } + + vmbus_msghc_wait_result(sc, mh); + /* Discard result; no useful information */ + vmbus_msghc_put(sc, mh); - return (ret); + return 0; } static void hv_vmbus_channel_close_internal(hv_vmbus_channel *channel) { - int ret = 0; + struct vmbus_softc *sc = channel->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_chclose *req; struct taskqueue *rxq = channel->rxq; - hv_vmbus_channel_close_channel* msg; - hv_vmbus_channel_msg_info* info; + int error; channel->state = HV_CHANNEL_OPEN_STATE; @@ -636,20 +488,31 @@ hv_vmbus_channel_close_internal(hv_vmbus /** * Send a closing message */ - info = (hv_vmbus_channel_msg_info *) - malloc( sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_close_channel), - M_DEVBUF, M_NOWAIT); - KASSERT(info != NULL, ("VMBUS: malloc failed hv_vmbus_channel_close!")); - if(info == NULL) - return; - - msg = (hv_vmbus_channel_close_channel*) info->msg; - msg->header.message_type = HV_CHANNEL_MESSAGE_CLOSE_CHANNEL; - msg->child_rel_id = channel->offer_msg.child_rel_id; - ret = hv_vmbus_post_message( - msg, sizeof(hv_vmbus_channel_close_channel)); + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for chclose(chan%u)\n", + channel->offer_msg.child_rel_id); + return; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHCLOSE; + req->chm_chanid = channel->offer_msg.child_rel_id; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + if (error) { + device_printf(sc->vmbus_dev, + "chclose(chan%u) msg hypercall exec failed: %d\n", + channel->offer_msg.child_rel_id, error); + return; + } else if (bootverbose) { + device_printf(sc->vmbus_dev, "close chan%u\n", + channel->offer_msg.child_rel_id); + } /* Tear down the gpadl for the channel's ring buffer */ if (channel->ring_buffer_gpadl_handle) { @@ -665,8 +528,6 @@ hv_vmbus_channel_close_internal(hv_vmbus contigfree(channel->ring_buffer_pages, channel->ring_buffer_size, M_DEVBUF); - - free(info, M_DEVBUF); } /** @@ -988,23 +849,6 @@ VmbusProcessChannelEvent(void* context, hv_vmbus_channel* channel = (hv_vmbus_channel*)context; boolean_t is_batched_reading; - /** - * Find the channel based on this relid and invokes - * the channel callback to process the event - */ - - if (channel == NULL) { - return; - } - /** - * To deal with the race condition where we might - * receive a packet while the relevant driver is - * being unloaded, dispatch the callback while - * holding the channel lock. The unloading driver - * will acquire the same channel lock to set the - * callback to NULL. This closes the window. - */ - if (channel->on_channel_callback != NULL) { arg = channel->channel_callback_context; is_batched_reading = channel->batched_reading; Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 07:47:07 2016 (r307300) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 07:47:35 2016 (r307301) @@ -418,46 +418,13 @@ vmbus_channel_on_offers_delivered(struct * @brief Open result handler. * * This is invoked when we received a response - * to our channel open request. Find the matching request, copy the - * response and signal the requesting thread. + * to our channel open request. */ static void vmbus_channel_on_open_result(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - - const hv_vmbus_channel_open_result *result; - hv_vmbus_channel_msg_info* msg_info; - hv_vmbus_channel_msg_header* requestHeader; - hv_vmbus_channel_open_channel* openMsg; - - result = (const hv_vmbus_channel_open_result *)hdr; - - /* - * Find the open msg, copy the result and signal/unblock the wait event - */ - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - - TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, - msg_list_entry) { - requestHeader = (hv_vmbus_channel_msg_header*) msg_info->msg; - - if (requestHeader->message_type == - HV_CHANNEL_MESSAGE_OPEN_CHANNEL) { - openMsg = (hv_vmbus_channel_open_channel*) msg_info->msg; - if (openMsg->child_rel_id == result->child_rel_id - && openMsg->open_id == result->open_id) { - memcpy(&msg_info->response.open_result, result, - sizeof(hv_vmbus_channel_open_result)); - sema_post(&msg_info->wait_sema); - break; - } - } - } - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - + vmbus_msghc_wakeup(sc, msg); } /** @@ -471,39 +438,7 @@ static void vmbus_channel_on_gpadl_created(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - - const hv_vmbus_channel_gpadl_created *gpadl_created; - hv_vmbus_channel_msg_info* msg_info; - hv_vmbus_channel_msg_header* request_header; - hv_vmbus_channel_gpadl_header* gpadl_header; - - gpadl_created = (const hv_vmbus_channel_gpadl_created *)hdr; - - /* Find the establish msg, copy the result and signal/unblock - * the wait event - */ - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, - msg_list_entry) { - request_header = (hv_vmbus_channel_msg_header*) msg_info->msg; - if (request_header->message_type == - HV_CHANNEL_MESSAGEL_GPADL_HEADER) { - gpadl_header = - (hv_vmbus_channel_gpadl_header*) request_header; - - if ((gpadl_created->child_rel_id == gpadl_header->child_rel_id) - && (gpadl_created->gpadl == gpadl_header->gpadl)) { - memcpy(&msg_info->response.gpadl_created, - gpadl_created, - sizeof(hv_vmbus_channel_gpadl_created)); - sema_post(&msg_info->wait_sema); - break; - } - } - } - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); + vmbus_msghc_wakeup(sc, msg); } /** @@ -517,42 +452,7 @@ static void vmbus_channel_on_gpadl_torndown(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - - const hv_vmbus_channel_gpadl_torndown *gpadl_torndown; - hv_vmbus_channel_msg_info* msg_info; - hv_vmbus_channel_msg_header* requestHeader; - hv_vmbus_channel_gpadl_teardown* gpadlTeardown; - - gpadl_torndown = (const hv_vmbus_channel_gpadl_torndown *)hdr; - - /* - * Find the open msg, copy the result and signal/unblock the - * wait event. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Oct 14 08:02:40 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91734C11BB3; Fri, 14 Oct 2016 08:02:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5432BFC1; Fri, 14 Oct 2016 08:02:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E82dNO081739; Fri, 14 Oct 2016 08:02:39 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E82cjl081723; Fri, 14 Oct 2016 08:02:38 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140802.u9E82cjl081723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 08:02:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307302 - in stable/11/sys: conf dev/hyperv/include dev/hyperv/netvsc dev/hyperv/storvsc dev/hyperv/vmbus modules/hyperv/netvsc modules/hyperv/storvsc modules/hyperv/vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 08:02:40 -0000 Author: sephe Date: Fri Oct 14 08:02:37 2016 New Revision: 307302 URL: https://svnweb.freebsd.org/changeset/base/307302 Log: MFC 302617-302621,302623,302629-302631 302617 hyperv/vmbus: Flatten channel message response processing. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6914 302618 hyperv/vmbus: Avoid tx_evtflags setting code duplication. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6915 302619 hyperv/vmbus: Busdma-fy Hypercall signal event input parameter. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6916 302620 hyperv: Nuke unused stuffs Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6917 302621 hyperv/vmbus: Don't be oversmart in default cpu selection. Pin the channel to cpu0 by default. Drivers having special channel-cpu mapping requirement should call vmbus_channel_cpu_{set,rr}() themselves. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6918 302623 hyperv/vmbus: Minor renaming Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6919 302629 hyperv/vmbus: Rework vmbus version accessing. Instead of global variable, vmbus version is accessed through a vmbus DEVMETHOD now. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6953 302630 hyperv/vmbus: Move GPADL index into vmbus_softc Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6954 302631 hyperv/vmbus: Move channel list to vmbus_softc Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6956 Added: stable/11/sys/dev/hyperv/vmbus/vmbus_if.m - copied unchanged from r302629, head/sys/dev/hyperv/vmbus/vmbus_if.m Modified: stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/include/hyperv_busdma.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_connection.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/hyperv.c stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h stable/11/sys/dev/hyperv/vmbus/hyperv_var.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h stable/11/sys/dev/hyperv/vmbus/vmbus_var.h stable/11/sys/modules/hyperv/netvsc/Makefile stable/11/sys/modules/hyperv/storvsc/Makefile stable/11/sys/modules/hyperv/vmbus/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files.amd64 ============================================================================== --- stable/11/sys/conf/files.amd64 Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/conf/files.amd64 Fri Oct 14 08:02:37 2016 (r307302) @@ -309,6 +309,7 @@ dev/hyperv/vmbus/hyperv.c optional hy dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv +dev/hyperv/vmbus/vmbus_if.m optional hyperv dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv dev/nfe/if_nfe.c optional nfe pci Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/conf/files.i386 Fri Oct 14 08:02:37 2016 (r307302) @@ -266,6 +266,7 @@ dev/hyperv/vmbus/hyperv.c optional hy dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv +dev/hyperv/vmbus/vmbus_if.m optional hyperv dev/hyperv/vmbus/i386/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/i386/vmbus_vector.S optional hyperv dev/ichwd/ichwd.c optional ichwd Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 08:02:37 2016 (r307302) @@ -55,6 +55,7 @@ #include #include +#include typedef uint8_t hv_bool_uint8_t; @@ -72,10 +73,13 @@ typedef uint8_t hv_bool_uint8_t; * 2.4 -- Windows 8 * 3.0 -- Windows 8.1 */ -#define HV_VMBUS_VERSION_WS2008 ((0 << 16) | (13)) -#define HV_VMBUS_VERSION_WIN7 ((1 << 16) | (1)) -#define HV_VMBUS_VERSION_WIN8 ((2 << 16) | (4)) -#define HV_VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) +#define VMBUS_VERSION_WS2008 ((0 << 16) | (13)) +#define VMBUS_VERSION_WIN7 ((1 << 16) | (1)) +#define VMBUS_VERSION_WIN8 ((2 << 16) | (4)) +#define VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) + +#define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) +#define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) /* * Make maximum size of pipe payload of 16K @@ -528,22 +532,7 @@ typedef union { } __packed hv_vmbus_connection_id; -/* - * Definition of the hv_vmbus_signal_event hypercall input structure - */ -typedef struct { - hv_vmbus_connection_id connection_id; - uint16_t flag_number; - uint16_t rsvd_z; -} __packed hv_vmbus_input_signal_event; - -typedef struct { - uint64_t align8; - hv_vmbus_input_signal_event event; -} __packed hv_vmbus_input_signal_event_buffer; - typedef struct hv_vmbus_channel { - TAILQ_ENTRY(hv_vmbus_channel) list_entry; struct hv_device* device; struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; @@ -589,14 +578,8 @@ typedef struct hv_vmbus_channel { boolean_t is_dedicated_interrupt; - /* - * Used as an input param for HV_CALL_SIGNAL_EVENT hypercall. - */ - hv_vmbus_input_signal_event_buffer signal_event_buffer; - /* - * 8-bytes aligned of the buffer above - */ - hv_vmbus_input_signal_event *signal_event_param; + struct hypercall_sigevt_in *ch_sigevt; + struct hyperv_dma ch_sigevt_dma; /* * From Win8, this field specifies the target virtual process @@ -643,6 +626,7 @@ typedef struct hv_vmbus_channel { void *hv_chan_priv3; struct task ch_detach_task; + TAILQ_ENTRY(hv_vmbus_channel) ch_link; } hv_vmbus_channel; #define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) @@ -726,6 +710,7 @@ int hv_vmbus_channel_teardown_gpdal( struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); +void vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan); struct hv_vmbus_channel ** vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt); void vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt); @@ -741,5 +726,4 @@ hv_get_phys_addr(void *virt) return (ret); } -extern uint32_t hv_vmbus_protocal_version; #endif /* __HYPERV_H__ */ Modified: stable/11/sys/dev/hyperv/include/hyperv_busdma.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv_busdma.h Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/include/hyperv_busdma.h Fri Oct 14 08:02:37 2016 (r307302) @@ -29,6 +29,10 @@ #ifndef _HYPERV_BUSDMA_H_ #define _HYPERV_BUSDMA_H_ +#include +#include +#include + struct hyperv_dma { bus_addr_t hv_paddr; bus_dma_tag_t hv_dtag; Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 14 08:02:37 2016 (r307302) @@ -114,9 +114,11 @@ __FBSDID("$FreeBSD$"); #include #include + #include "hv_net_vsc.h" #include "hv_rndis.h" #include "hv_rndis_filter.h" +#include "vmbus_if.h" #define hv_chan_rxr hv_chan_priv1 #define hv_chan_txr hv_chan_priv2 @@ -2369,8 +2371,10 @@ static int hn_create_tx_ring(struct hn_softc *sc, int id) { struct hn_tx_ring *txr = &sc->hn_tx_ring[id]; + device_t dev = sc->hn_dev; bus_dma_tag_t parent_dtag; int error, i; + uint32_t version; txr->hn_sc = sc; txr->hn_tx_idx = id; @@ -2409,10 +2413,18 @@ hn_create_tx_ring(struct hn_softc *sc, i } txr->hn_direct_tx_size = hn_direct_tx_size; - if (hv_vmbus_protocal_version >= HV_VMBUS_VERSION_WIN8_1) + version = VMBUS_GET_VERSION(device_get_parent(dev), dev); + if (version >= VMBUS_VERSION_WIN8_1) { txr->hn_csum_assist = HN_CSUM_ASSIST; - else + } else { txr->hn_csum_assist = HN_CSUM_ASSIST_WIN8; + if (id == 0) { + device_printf(dev, "bus version %u.%u, " + "no UDP checksum offloading\n", + VMBUS_VERSION_MAJOR(version), + VMBUS_VERSION_MINOR(version)); + } + } /* * Always schedule transmission instead of trying to do direct @@ -2420,7 +2432,7 @@ hn_create_tx_ring(struct hn_softc *sc, i */ txr->hn_sched_tx = 1; - parent_dtag = bus_get_dma_tag(sc->hn_dev); + parent_dtag = bus_get_dma_tag(dev); /* DMA tag for RNDIS messages. */ error = bus_dma_tag_create(parent_dtag, /* parent */ @@ -2437,7 +2449,7 @@ hn_create_tx_ring(struct hn_softc *sc, i NULL, /* lockfuncarg */ &txr->hn_tx_rndis_dtag); if (error) { - device_printf(sc->hn_dev, "failed to create rndis dmatag\n"); + device_printf(dev, "failed to create rndis dmatag\n"); return error; } @@ -2456,7 +2468,7 @@ hn_create_tx_ring(struct hn_softc *sc, i NULL, /* lockfuncarg */ &txr->hn_tx_data_dtag); if (error) { - device_printf(sc->hn_dev, "failed to create data dmatag\n"); + device_printf(dev, "failed to create data dmatag\n"); return error; } @@ -2473,7 +2485,7 @@ hn_create_tx_ring(struct hn_softc *sc, i BUS_DMA_WAITOK | BUS_DMA_COHERENT, &txd->rndis_msg_dmap); if (error) { - device_printf(sc->hn_dev, + device_printf(dev, "failed to allocate rndis_msg, %d\n", i); return error; } @@ -2484,7 +2496,7 @@ hn_create_tx_ring(struct hn_softc *sc, i hyperv_dma_map_paddr, &txd->rndis_msg_paddr, BUS_DMA_NOWAIT); if (error) { - device_printf(sc->hn_dev, + device_printf(dev, "failed to load rndis_msg, %d\n", i); bus_dmamem_free(txr->hn_tx_rndis_dtag, txd->rndis_msg, txd->rndis_msg_dmap); @@ -2495,7 +2507,7 @@ hn_create_tx_ring(struct hn_softc *sc, i error = bus_dmamap_create(txr->hn_tx_data_dtag, 0, &txd->data_dmap); if (error) { - device_printf(sc->hn_dev, + device_printf(dev, "failed to allocate tx data dmamap\n"); bus_dmamap_unload(txr->hn_tx_rndis_dtag, txd->rndis_msg_dmap); @@ -2523,7 +2535,7 @@ hn_create_tx_ring(struct hn_softc *sc, i * Create per TX ring sysctl tree: * dev.hn.UNIT.tx.RINGID */ - ctx = device_get_sysctl_ctx(sc->hn_dev); + ctx = device_get_sysctl_ctx(dev); child = SYSCTL_CHILDREN(sc->hn_tx_sysctl_tree); snprintf(name, sizeof(name), "%d", id); Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 14 08:02:37 2016 (r307302) @@ -72,7 +72,9 @@ __FBSDID("$FreeBSD$"); #include #include + #include "hv_vstorage.h" +#include "vmbus_if.h" #define STORVSC_RINGBUFFER_SIZE (20*PAGE_SIZE) #define STORVSC_MAX_LUNS_PER_TARGET (64) @@ -361,6 +363,7 @@ storvsc_subchan_attach(struct hv_vmbus_c memset(&props, 0, sizeof(props)); + vmbus_channel_cpu_rr(new_channel); ret = hv_vmbus_channel_open(new_channel, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, @@ -464,6 +467,7 @@ hv_storvsc_channel_init(struct hv_device struct storvsc_softc *sc; uint16_t max_chans = 0; boolean_t support_multichannel = FALSE; + uint32_t version; max_chans = 0; support_multichannel = FALSE; @@ -588,8 +592,9 @@ hv_storvsc_channel_init(struct hv_device /* multi-channels feature is supported by WIN8 and above version */ max_chans = vstor_packet->u.chan_props.max_channel_cnt; - if ((hv_vmbus_protocal_version != HV_VMBUS_VERSION_WIN7) && - (hv_vmbus_protocal_version != HV_VMBUS_VERSION_WS2008) && + version = VMBUS_GET_VERSION(device_get_parent(dev->device), + dev->device); + if (version != VMBUS_VERSION_WIN7 && version != VMBUS_VERSION_WS2008 && (vstor_packet->u.chan_props.flags & HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) { support_multichannel = TRUE; @@ -655,7 +660,7 @@ hv_storvsc_connect_vsp(struct hv_device /* * Open the channel */ - + vmbus_channel_cpu_rr(dev->channel); ret = hv_vmbus_channel_open( dev->channel, sc->hs_drv_props->drv_ringbuffer_size, Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 08:02:37 2016 (r307302) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -58,21 +59,21 @@ static void VmbusProcessChannelEvent(voi static void vmbus_channel_set_event(hv_vmbus_channel *channel) { + struct vmbus_softc *sc = channel->vmbus_sc; + uint32_t chanid = channel->offer_msg.child_rel_id; + + atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], + 1UL << (chanid & VMBUS_EVTFLAG_MASK)); + if (channel->offer_msg.monitor_allocated) { - struct vmbus_softc *sc = channel->vmbus_sc; hv_vmbus_monitor_page *monitor_page; - uint32_t chanid = channel->offer_msg.child_rel_id; - - atomic_set_long( - &sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], - 1UL << (chanid & VMBUS_EVTFLAG_MASK)); monitor_page = sc->vmbus_mnf2; synch_set_bit(channel->monitor_bit, (uint32_t *)&monitor_page-> trigger_group[channel->monitor_group].u.pending); } else { - hv_vmbus_set_event(channel); + hypercall_signal_event(channel->ch_sigevt_dma.hv_paddr); } } @@ -342,8 +343,7 @@ hv_vmbus_channel_establish_gpadl(struct /* * Allocate GPADL id. */ - gpadl = atomic_fetchadd_int( - &hv_vmbus_g_connection.next_gpadl_handle, 1); + gpadl = vmbus_gpadl_alloc(sc); *gpadl0 = gpadl; /* Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 08:02:37 2016 (r307302) @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -46,18 +47,10 @@ static void vmbus_chan_detach_task(void static void vmbus_channel_on_offer(struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_open_result(struct vmbus_softc *, - const struct vmbus_message *); static void vmbus_channel_on_offer_rescind(struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_gpadl_created(struct vmbus_softc *, - const struct vmbus_message *); -static void vmbus_channel_on_gpadl_torndown(struct vmbus_softc *, - const struct vmbus_message *); static void vmbus_channel_on_offers_delivered(struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_version_response(struct vmbus_softc *, - const struct vmbus_message *); /** * Channel message dispatch table @@ -71,13 +64,13 @@ vmbus_chanmsg_process[HV_CHANNEL_MESSAGE [HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] = vmbus_channel_on_offers_delivered, [HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] = - vmbus_channel_on_open_result, + vmbus_msghc_wakeup, [HV_CHANNEL_MESSAGE_GPADL_CREATED] = - vmbus_channel_on_gpadl_created, + vmbus_msghc_wakeup, [HV_CHANNEL_MESSAGE_GPADL_TORNDOWN] = - vmbus_channel_on_gpadl_torndown, + vmbus_msghc_wakeup, [HV_CHANNEL_MESSAGE_VERSION_RESPONSE] = - vmbus_channel_on_version_response + vmbus_msghc_wakeup }; /** @@ -115,6 +108,7 @@ hv_vmbus_free_vmbus_channel(hv_vmbus_cha static void vmbus_channel_process_offer(hv_vmbus_channel *new_channel) { + struct vmbus_softc *sc = new_channel->vmbus_sc; hv_vmbus_channel* channel; uint32_t relid; @@ -122,7 +116,7 @@ vmbus_channel_process_offer(hv_vmbus_cha /* * Make sure this is a new offer */ - mtx_lock(&hv_vmbus_g_connection.channel_lock); + mtx_lock(&sc->vmbus_chlist_lock); if (relid == 0) { /* * XXX channel0 will not be processed; skip it. @@ -132,8 +126,7 @@ vmbus_channel_process_offer(hv_vmbus_cha hv_vmbus_g_connection.channels[relid] = new_channel; } - TAILQ_FOREACH(channel, &hv_vmbus_g_connection.channel_anchor, - list_entry) { + TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { if (memcmp(&channel->offer_msg.offer.interface_type, &new_channel->offer_msg.offer.interface_type, sizeof(hv_guid)) == 0 && @@ -145,10 +138,9 @@ vmbus_channel_process_offer(hv_vmbus_cha if (channel == NULL) { /* Install the new primary channel */ - TAILQ_INSERT_TAIL(&hv_vmbus_g_connection.channel_anchor, - new_channel, list_entry); + TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, ch_link); } - mtx_unlock(&hv_vmbus_g_connection.channel_lock); + mtx_unlock(&sc->vmbus_chlist_lock); if (channel != NULL) { /* @@ -172,11 +164,19 @@ vmbus_channel_process_offer(hv_vmbus_cha new_channel->offer_msg.offer.sub_channel_index); } - /* Insert new channel into channel_anchor. */ - mtx_lock(&hv_vmbus_g_connection.channel_lock); - TAILQ_INSERT_TAIL(&hv_vmbus_g_connection.channel_anchor, - new_channel, list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_lock); + /* + * Insert the new channel to the end of the global + * channel list. + * + * NOTE: + * The new sub-channel MUST be inserted AFTER it's + * primary channel, so that the primary channel will + * be found in the above loop for its baby siblings. + */ + mtx_lock(&sc->vmbus_chlist_lock); + TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, + ch_link); + mtx_unlock(&sc->vmbus_chlist_lock); if(bootverbose) printf("VMBUS: new multi-channel offer <%p>, " @@ -229,8 +229,8 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch { KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); - if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 || - hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) { + if (chan->vmbus_sc->vmbus_version == VMBUS_VERSION_WS2008 || + chan->vmbus_sc->vmbus_version == VMBUS_VERSION_WIN7) { /* Only cpu0 is supported */ cpu = 0; } @@ -245,61 +245,25 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch } } -/** - * Array of device guids that are performance critical. We try to distribute - * the interrupt load for these devices across all online cpus. - */ -static const hv_guid high_perf_devices[] = { - {HV_NIC_GUID, }, - {HV_IDE_GUID, }, - {HV_SCSI_GUID, }, -}; - -enum { - PERF_CHN_NIC = 0, - PERF_CHN_IDE, - PERF_CHN_SCSI, - MAX_PERF_CHN, -}; +void +vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan) +{ + static uint32_t vmbus_chan_nextcpu; + int cpu; -/* - * We use this static number to distribute the channel interrupt load. - */ -static uint32_t next_vcpu; + cpu = atomic_fetchadd_int(&vmbus_chan_nextcpu, 1) % mp_ncpus; + vmbus_channel_cpu_set(chan, cpu); +} -/** - * Starting with Win8, we can statically distribute the incoming - * channel interrupt load by binding a channel to VCPU. We - * implement here a simple round robin scheme for distributing - * the interrupt load. - * We will bind channels that are not performance critical to cpu 0 and - * performance critical channels (IDE, SCSI and Network) will be uniformly - * distributed across all available CPUs. - */ static void -vmbus_channel_select_defcpu(struct hv_vmbus_channel *channel) +vmbus_channel_select_defcpu(struct hv_vmbus_channel *chan) { - uint32_t current_cpu; - int i; - boolean_t is_perf_channel = FALSE; - const hv_guid *guid = &channel->offer_msg.offer.interface_type; - - for (i = PERF_CHN_NIC; i < MAX_PERF_CHN; i++) { - if (memcmp(guid->data, high_perf_devices[i].data, - sizeof(hv_guid)) == 0) { - is_perf_channel = TRUE; - break; - } - } - - if (!is_perf_channel) { - /* Stick to cpu0 */ - vmbus_channel_cpu_set(channel, 0); - return; - } - /* mp_ncpus should have the number cpus currently online */ - current_cpu = (++next_vcpu % mp_ncpus); - vmbus_channel_cpu_set(channel, current_cpu); + /* + * By default, pin the channel to cpu0. Devices having + * special channel-cpu mapping requirement should call + * vmbus_channel_cpu_{set,rr}(). + */ + vmbus_channel_cpu_set(chan, 0); } /** @@ -335,23 +299,23 @@ vmbus_channel_on_offer_internal(struct v */ new_channel->batched_reading = TRUE; - new_channel->signal_event_param = - (hv_vmbus_input_signal_event *) - (HV_ALIGN_UP((unsigned long) - &new_channel->signal_event_buffer, - HV_HYPERCALL_PARAM_ALIGN)); - - new_channel->signal_event_param->connection_id.as_uint32_t = 0; - new_channel->signal_event_param->connection_id.u.id = - HV_VMBUS_EVENT_CONNECTION_ID; - new_channel->signal_event_param->flag_number = 0; - new_channel->signal_event_param->rsvd_z = 0; + new_channel->ch_sigevt = hyperv_dmamem_alloc( + bus_get_dma_tag(sc->vmbus_dev), + HYPERCALL_SIGEVTIN_ALIGN, 0, sizeof(struct hypercall_sigevt_in), + &new_channel->ch_sigevt_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (new_channel->ch_sigevt == NULL) { + device_printf(sc->vmbus_dev, "sigevt alloc failed\n"); + /* XXX */ + mtx_destroy(&new_channel->sc_lock); + free(new_channel, M_DEVBUF); + return; + } + new_channel->ch_sigevt->hc_connid = VMBUS_CONNID_EVENT; - if (hv_vmbus_protocal_version != HV_VMBUS_VERSION_WS2008) { + if (sc->vmbus_version != VMBUS_VERSION_WS2008) { new_channel->is_dedicated_interrupt = (offer->is_dedicated_interrupt != 0); - new_channel->signal_event_param->connection_id.u.id = - offer->connection_id; + new_channel->ch_sigevt->hc_connid = offer->connection_id; } memcpy(&new_channel->offer_msg, offer, @@ -415,67 +379,18 @@ vmbus_channel_on_offers_delivered(struct } /** - * @brief Open result handler. - * - * This is invoked when we received a response - * to our channel open request. - */ -static void -vmbus_channel_on_open_result(struct vmbus_softc *sc, - const struct vmbus_message *msg) -{ - vmbus_msghc_wakeup(sc, msg); -} - -/** - * @brief GPADL created handler. - * - * This is invoked when we received a response - * to our gpadl create request. Find the matching request, copy the - * response and signal the requesting thread. - */ -static void -vmbus_channel_on_gpadl_created(struct vmbus_softc *sc, - const struct vmbus_message *msg) -{ - vmbus_msghc_wakeup(sc, msg); -} - -/** - * @brief GPADL torndown handler. - * - * This is invoked when we received a respons - * to our gpadl teardown request. Find the matching request, copy the - * response and signal the requesting thread - */ -static void -vmbus_channel_on_gpadl_torndown(struct vmbus_softc *sc, - const struct vmbus_message *msg) -{ - vmbus_msghc_wakeup(sc, msg); -} - -static void -vmbus_channel_on_version_response(struct vmbus_softc *sc, - const struct vmbus_message *msg) -{ - vmbus_msghc_wakeup(sc, msg); -} - -/** * @brief Release channels that are unattached/unconnected (i.e., no drivers associated) */ void -hv_vmbus_release_unattached_channels(void) +hv_vmbus_release_unattached_channels(struct vmbus_softc *sc) { hv_vmbus_channel *channel; - mtx_lock(&hv_vmbus_g_connection.channel_lock); + mtx_lock(&sc->vmbus_chlist_lock); - while (!TAILQ_EMPTY(&hv_vmbus_g_connection.channel_anchor)) { - channel = TAILQ_FIRST(&hv_vmbus_g_connection.channel_anchor); - TAILQ_REMOVE(&hv_vmbus_g_connection.channel_anchor, - channel, list_entry); + while (!TAILQ_EMPTY(&sc->vmbus_chlist)) { + channel = TAILQ_FIRST(&sc->vmbus_chlist); + TAILQ_REMOVE(&sc->vmbus_chlist, channel, ch_link); if (HV_VMBUS_CHAN_ISPRIMARY(channel)) { /* Only primary channel owns the hv_device */ @@ -485,7 +400,8 @@ hv_vmbus_release_unattached_channels(voi } bzero(hv_vmbus_g_connection.channels, sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX); - mtx_unlock(&hv_vmbus_g_connection.channel_lock); + + mtx_unlock(&sc->vmbus_chlist_lock); } /** Modified: stable/11/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_connection.c Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/vmbus/hv_connection.c Fri Oct 14 08:02:37 2016 (r307302) @@ -47,10 +47,7 @@ * Globals */ hv_vmbus_connection hv_vmbus_g_connection = - { .connect_state = HV_DISCONNECTED, - .next_gpadl_handle = 0xE1E10, }; - -uint32_t hv_vmbus_protocal_version; + { .connect_state = HV_DISCONNECTED }; /** * Send a connect request on the partition service connection @@ -70,10 +67,6 @@ hv_vmbus_connect(struct vmbus_softc *sc) */ hv_vmbus_g_connection.connect_state = HV_CONNECTING; - TAILQ_INIT(&hv_vmbus_g_connection.channel_anchor); - mtx_init(&hv_vmbus_g_connection.channel_lock, "vmbus channel", - NULL, MTX_DEF); - hv_vmbus_g_connection.channels = malloc(sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); @@ -158,23 +151,6 @@ vmbus_event_proc_compat(struct vmbus_sof } } -/** - * Send an event notification to the parent - */ -int -hv_vmbus_set_event(hv_vmbus_channel *channel) -{ - struct vmbus_softc *sc = channel->vmbus_sc; - int ret = 0; - uint32_t chanid = channel->offer_msg.child_rel_id; - - atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], - 1UL << (chanid & VMBUS_EVTFLAG_MASK)); - ret = hv_vmbus_signal_event(channel->signal_event_param); - - return (ret); -} - void vmbus_on_channel_open(const struct hv_vmbus_channel *chan) { Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Oct 14 08:02:37 2016 (r307302) @@ -38,28 +38,7 @@ #include - -/* - * Status codes for hypervisor operations. - */ - -typedef uint16_t hv_vmbus_status; - -#define HV_MESSAGE_SIZE (256) -#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240) -#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30) -#define HV_ANY_VP (0xFFFFFFFF) - -/* - * MessageId: HV_STATUS_INSUFFICIENT_BUFFERS - * MessageText: - * You did not supply enough message buffers to send a message. - */ - -#define HV_STATUS_SUCCESS ((uint16_t)0) -#define HV_STATUS_INSUFFICIENT_BUFFERS ((uint16_t)0x0013) - -typedef void (*hv_vmbus_channel_callback)(void *context); +struct vmbus_softc; typedef struct { void* data; @@ -118,74 +97,6 @@ typedef struct hv_vmbus_channel_packet_m hv_vmbus_multipage_buffer range; } __packed hv_vmbus_channel_packet_multipage_buffer; -enum { - HV_VMBUS_MESSAGE_CONNECTION_ID = 1, - HV_VMBUS_MESSAGE_PORT_ID = 1, - HV_VMBUS_EVENT_CONNECTION_ID = 2, - HV_VMBUS_EVENT_PORT_ID = 2, - HV_VMBUS_MONITOR_CONNECTION_ID = 3, - HV_VMBUS_MONITOR_PORT_ID = 3, -}; - -#define HV_PRESENT_BIT 0x80000000 - -#define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t) - -/* - * Define hypervisor message types - */ -typedef enum { - - HV_MESSAGE_TYPE_NONE = 0x00000000, - - /* - * Memory access messages - */ - HV_MESSAGE_TYPE_UNMAPPED_GPA = 0x80000000, - HV_MESSAGE_TYPE_GPA_INTERCEPT = 0x80000001, - - /* - * Timer notification messages - */ - HV_MESSAGE_TIMER_EXPIRED = 0x80000010, - - /* - * Error messages - */ - HV_MESSAGE_TYPE_INVALID_VP_REGISTER_VALUE = 0x80000020, - HV_MESSAGE_TYPE_UNRECOVERABLE_EXCEPTION = 0x80000021, - HV_MESSAGE_TYPE_UNSUPPORTED_FEATURE = 0x80000022, - - /* - * Trace buffer complete messages - */ - HV_MESSAGE_TYPE_EVENT_LOG_BUFFER_COMPLETE = 0x80000040, - - /* - * Platform-specific processor intercept messages - */ - HV_MESSAGE_TYPE_X64_IO_PORT_INTERCEPT = 0x80010000, - HV_MESSAGE_TYPE_X64_MSR_INTERCEPT = 0x80010001, - HV_MESSAGE_TYPE_X64_CPU_INTERCEPT = 0x80010002, - HV_MESSAGE_TYPE_X64_EXCEPTION_INTERCEPT = 0x80010003, - HV_MESSAGE_TYPE_X64_APIC_EOI = 0x80010004, - HV_MESSAGE_TYPE_X64_LEGACY_FP_ERROR = 0x80010005 - -} hv_vmbus_msg_type; - -/* - * Define port identifier type - */ -typedef union _hv_vmbus_port_id { - uint32_t as_uint32_t; - struct { - uint32_t id:24; - uint32_t reserved:8; - } u ; -} hv_vmbus_port_id; - -typedef uint64_t hv_vmbus_partition_id; - /* * VM Bus connection states */ @@ -196,19 +107,8 @@ typedef enum { HV_DISCONNECTING } hv_vmbus_connect_state; -#define HV_MAX_SIZE_CHANNEL_MESSAGE HV_MESSAGE_PAYLOAD_BYTE_COUNT - - typedef struct { hv_vmbus_connect_state connect_state; - uint32_t next_gpadl_handle; - - /** - * List of primary channels. Sub channels will be linked - * under their primary channel. - */ - TAILQ_HEAD(, hv_vmbus_channel) channel_anchor; - struct mtx channel_lock; /** * channel table for fast lookup through id. @@ -277,14 +177,6 @@ typedef struct { uint8_t rsvd_z4[1984]; } hv_vmbus_monitor_page; -/* - * Declare the various hypercall operations - */ -typedef enum { - HV_CALL_POST_MESSAGE = 0x005c, - HV_CALL_SIGNAL_EVENT = 0x005d, -} hv_vmbus_call_code; - /** * Global variables */ @@ -342,17 +234,14 @@ uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); -void hv_vmbus_release_unattached_channels(void); - -uint16_t hv_vmbus_signal_event(void *con_id); +void hv_vmbus_release_unattached_channels( + struct vmbus_softc *); struct hv_device* hv_vmbus_child_device_create( hv_guid device_type, hv_guid device_instance, hv_vmbus_channel *channel); -struct vmbus_softc; - void hv_vmbus_child_device_register(struct vmbus_softc *, struct hv_device *child_dev); int hv_vmbus_child_device_unregister( @@ -363,6 +252,5 @@ int hv_vmbus_child_device_unregister( */ int hv_vmbus_connect(struct vmbus_softc *); int hv_vmbus_disconnect(void); -int hv_vmbus_set_event(hv_vmbus_channel *channel); #endif /* __HYPERV_PRIV_H__ */ Modified: stable/11/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv.c Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/vmbus/hyperv.c Fri Oct 14 08:02:37 2016 (r307302) @@ -101,23 +101,6 @@ hyperv_get_timecount(struct timecounter return rdmsr(MSR_HV_TIME_REF_COUNT); } -/** - * @brief Invoke the specified hypercall - */ -static uint64_t -hv_vmbus_do_hypercall(uint64_t value, void *input, void *output) -{ - uint64_t in_paddr = 0, out_paddr = 0; - - if (input != NULL) - in_paddr = hv_get_phys_addr(input); - if (output != NULL) - out_paddr = hv_get_phys_addr(output); - - return hypercall_md(hypercall_context.hc_addr, value, - in_paddr, out_paddr); -} - uint64_t hypercall_post_message(bus_addr_t msg_paddr) { @@ -125,21 +108,11 @@ hypercall_post_message(bus_addr_t msg_pa HYPERCALL_POST_MESSAGE, msg_paddr, 0); } -/** - * @brief Signal an event on the specified connection using the hypervisor - * event IPC. (This involves a hypercall.) - */ -hv_vmbus_status -hv_vmbus_signal_event(void *con_id) -{ - hv_vmbus_status status; - - status = hv_vmbus_do_hypercall( - HV_CALL_SIGNAL_EVENT, - con_id, - 0) & 0xFFFF; - - return (status); +uint64_t +hypercall_signal_event(bus_addr_t sigevt_paddr) +{ + return hypercall_md(hypercall_context.hc_addr, + HYPERCALL_SIGNAL_EVENT, sigevt_paddr, 0); } int Modified: stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h Fri Oct 14 08:02:37 2016 (r307302) @@ -148,6 +148,7 @@ * Hypercall input values */ #define HYPERCALL_POST_MESSAGE 0x005c +#define HYPERCALL_SIGNAL_EVENT 0x005d /* * Hypercall input parameters @@ -169,4 +170,15 @@ struct hypercall_postmsg_in { } __packed; CTASSERT(sizeof(struct hypercall_postmsg_in) == HYPERCALL_POSTMSGIN_SIZE); +/* + * HYPERCALL_SIGNAL_EVENT + */ +#define HYPERCALL_SIGEVTIN_ALIGN 8 + +struct hypercall_sigevt_in { + uint32_t hc_connid; + uint16_t hc_evtflag_ofs; + uint16_t hc_rsvd; +} __packed; + #endif /* !_HYPERV_REG_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/hyperv_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv_var.h Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/vmbus/hyperv_var.h Fri Oct 14 08:02:37 2016 (r307302) @@ -39,5 +39,6 @@ extern u_int hyperv_features; extern u_int hyperv_recommends; uint64_t hypercall_post_message(bus_addr_t msg_paddr); +uint64_t hypercall_signal_event(bus_addr_t sigevt_paddr); #endif /* !_HYPERV_VAR_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 07:47:35 2016 (r307301) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 08:02:37 2016 (r307302) @@ -68,12 +68,9 @@ __FBSDID("$FreeBSD$"); #include #include "acpi_if.h" +#include "vmbus_if.h" -/* - * NOTE: DO NOT CHANGE THESE - */ -#define VMBUS_CONNID_MESSAGE 1 -#define VMBUS_CONNID_EVENT 2 +#define VMBUS_GPADL_START 0xe1e10 struct vmbus_msghc { struct hypercall_postmsg_in *mh_inprm; @@ -96,10 +93,9 @@ struct vmbus_msghc_ctx { #define VMBUS_MSGHC_CTXF_DESTROY 0x0001 static int vmbus_init(struct vmbus_softc *); -static int vmbus_init_contact(struct vmbus_softc *, - uint32_t); +static int vmbus_connect(struct vmbus_softc *, uint32_t); static int vmbus_req_channels(struct vmbus_softc *sc); -static void vmbus_uninit(struct vmbus_softc *); +static void vmbus_disconnect(struct vmbus_softc *); static int vmbus_scan(struct vmbus_softc *); static void vmbus_scan_wait(struct vmbus_softc *); static void vmbus_scan_newdev(struct vmbus_softc *); @@ -120,10 +116,10 @@ struct vmbus_softc *vmbus_sc; extern inthand_t IDTVEC(vmbus_isr); static const uint32_t vmbus_version[] = { - HV_VMBUS_VERSION_WIN8_1, - HV_VMBUS_VERSION_WIN8, - HV_VMBUS_VERSION_WIN7, - HV_VMBUS_VERSION_WS2008 + VMBUS_VERSION_WIN8_1, + VMBUS_VERSION_WIN8, + VMBUS_VERSION_WIN7, + VMBUS_VERSION_WS2008 }; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Oct 14 08:14:52 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E73A0C11EB5; Fri, 14 Oct 2016 08:14:52 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD29E792; Fri, 14 Oct 2016 08:14:52 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E8EpiG086010; Fri, 14 Oct 2016 08:14:51 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E8EphR086005; Fri, 14 Oct 2016 08:14:51 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140814.u9E8EphR086005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 08:14:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307303 - in stable/11/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 08:14:53 -0000 Author: sephe Date: Fri Oct 14 08:14:51 2016 New Revision: 307303 URL: https://svnweb.freebsd.org/changeset/base/307303 Log: MFC 302632-302634 302632 hyperv/vmbus: More verbose for GPADL_connect/chan_{rescind,offer} Reviewed by: Dexuan Cui , Hongjiang Zhang Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6976 302633 hyperv/vmbus: Free sysctl properly upon channel close. Prepare for sub-channel re-open. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6977 302634 hyperv/vmbus: Fix sub-channel re-open support. For multi-channel devices, once the primary channel is closed, a set of 'rescind' messages for sub-channels will be delivered by Hypervisor. Sub-channel MUST be freed according to these 'rescind' messages; directly re-openning sub-channels in the same fashion as the primary channel's re-opening does NOT work at all. After the primary channel is re-opened, requested # of sub- channels will be delivered though 'channel offer' messages, and this set of newly offered channels can be opened along side with the primary channel. This unbreaks the MTU setting for hn(4), which requires re- openning all existsing channels upon MTU change. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6978 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 08:02:37 2016 (r307302) +++ stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 08:14:51 2016 (r307303) @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -627,6 +628,8 @@ typedef struct hv_vmbus_channel { struct task ch_detach_task; TAILQ_ENTRY(hv_vmbus_channel) ch_link; + + struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; #define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) @@ -714,6 +717,7 @@ void vmbus_channel_cpu_rr(struct hv_vmb struct hv_vmbus_channel ** vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt); void vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt); +void vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan); /** * @brief Get physical address from virtual Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 14 08:02:37 2016 (r307302) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 14 08:14:51 2016 (r307303) @@ -345,6 +345,7 @@ static void hn_destroy_rx_data(struct hn static void hn_set_tx_chimney_size(struct hn_softc *, int); static void hn_channel_attach(struct hn_softc *, struct hv_vmbus_channel *); static void hn_subchan_attach(struct hn_softc *, struct hv_vmbus_channel *); +static void hn_subchan_setup(struct hn_softc *); static int hn_transmit(struct ifnet *, struct mbuf *); static void hn_xmit_qflush(struct ifnet *); @@ -575,25 +576,8 @@ netvsc_attach(device_t dev) device_printf(dev, "%d TX ring, %d RX ring\n", sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse); - if (sc->net_dev->num_channel > 1) { - struct hv_vmbus_channel **subchan; - int subchan_cnt = sc->net_dev->num_channel - 1; - int i; - - /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(pri_chan, subchan_cnt); - - /* Attach the sub-channels. */ - for (i = 0; i < subchan_cnt; ++i) { - /* NOTE: Calling order is critical. */ - hn_subchan_attach(sc, subchan[i]); - hv_nv_subchan_attach(subchan[i]); - } - - /* Release the sub-channels */ - vmbus_rel_subchan(subchan, subchan_cnt); - device_printf(dev, "%d sub-channels setup done\n", subchan_cnt); - } + if (sc->net_dev->num_channel > 1) + hn_subchan_setup(sc); #if __FreeBSD_version >= 1100099 if (sc->hn_rx_ring_inuse > 1) { @@ -1620,6 +1604,10 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, NV_UNLOCK(sc); break; } + + /* Wait for subchannels to be destroyed */ + vmbus_drain_subchan(hn_dev->channel); + error = hv_rf_on_device_add(hn_dev, &device_info, sc->hn_rx_ring_inuse); if (error) { @@ -1628,6 +1616,26 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, NV_UNLOCK(sc); break; } + KASSERT(sc->hn_rx_ring_cnt == sc->net_dev->num_channel, + ("RX ring count %d and channel count %u mismatch", + sc->hn_rx_ring_cnt, sc->net_dev->num_channel)); + if (sc->net_dev->num_channel > 1) { + int r; + + /* + * Skip the rings on primary channel; they are + * handled by the hv_rf_on_device_add() above. + */ + for (r = 1; r < sc->hn_rx_ring_cnt; ++r) { + sc->hn_rx_ring[r].hn_rx_flags &= + ~HN_RX_FLAG_ATTACHED; + } + for (r = 1; r < sc->hn_tx_ring_cnt; ++r) { + sc->hn_tx_ring[r].hn_tx_flags &= + ~HN_TX_FLAG_ATTACHED; + } + hn_subchan_setup(sc); + } sc->hn_tx_chimney_max = sc->net_dev->send_section_size; if (sc->hn_tx_ring[0].hn_tx_chimney_size > @@ -2980,6 +2988,29 @@ hn_subchan_attach(struct hn_softc *sc, s } static void +hn_subchan_setup(struct hn_softc *sc) +{ + struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev); + struct hv_vmbus_channel **subchan; + int subchan_cnt = sc->net_dev->num_channel - 1; + int i; + + /* Wait for sub-channels setup to complete. */ + subchan = vmbus_get_subchan(device_ctx->channel, subchan_cnt); + + /* Attach the sub-channels. */ + for (i = 0; i < subchan_cnt; ++i) { + /* NOTE: Calling order is critical. */ + hn_subchan_attach(sc, subchan[i]); + hv_nv_subchan_attach(subchan[i]); + } + + /* Release the sub-channels */ + vmbus_rel_subchan(subchan, subchan_cnt); + if_printf(sc->hn_ifp, "%d sub-channels setup done\n", subchan_cnt); +} + +static void hn_tx_taskq_create(void *arg __unused) { if (!hn_share_tx_taskq) Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 08:02:37 2016 (r307302) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 08:14:51 2016 (r307303) @@ -111,7 +111,8 @@ vmbus_channel_sysctl_create(hv_vmbus_cha ch_id = primary_ch->offer_msg.child_rel_id; sub_ch_id = channel->offer_msg.offer.sub_channel_index; } - ctx = device_get_sysctl_ctx(dev); + ctx = &channel->ch_sysctl_ctx; + sysctl_ctx_init(ctx); /* This creates dev.DEVNAME.DEVUNIT.channel tree */ devch_sysctl = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), @@ -423,6 +424,11 @@ hv_vmbus_channel_establish_gpadl(struct device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " "status %u\n", channel->offer_msg.child_rel_id, status); return EIO; + } else { + if (bootverbose) { + device_printf(sc->vmbus_dev, "gpadl->chan%u " + "succeeded\n", channel->offer_msg.child_rel_id); + } } return 0; } @@ -477,6 +483,7 @@ hv_vmbus_channel_close_internal(hv_vmbus int error; channel->state = HV_CHANNEL_OPEN_STATE; + sysctl_ctx_free(&channel->ch_sysctl_ctx); /* * set rxq to NULL to avoid more requests be scheduled Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 08:02:37 2016 (r307302) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 08:14:51 2016 (r307303) @@ -142,6 +142,19 @@ vmbus_channel_process_offer(hv_vmbus_cha } mtx_unlock(&sc->vmbus_chlist_lock); + if (bootverbose) { + char logstr[64]; + + logstr[0] = '\0'; + if (channel != NULL) { + snprintf(logstr, sizeof(logstr), ", primary chan%u", + channel->offer_msg.child_rel_id); + } + device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n", + new_channel->offer_msg.child_rel_id, + new_channel->offer_msg.offer.sub_channel_index, logstr); + } + if (channel != NULL) { /* * Check if this is a sub channel. @@ -157,13 +170,6 @@ vmbus_channel_process_offer(hv_vmbus_cha new_channel, sc_list_entry); mtx_unlock(&channel->sc_lock); - if (bootverbose) { - printf("VMBUS get multi-channel offer, " - "rel=%u, sub=%u\n", - new_channel->offer_msg.child_rel_id, - new_channel->offer_msg.offer.sub_channel_index); - } - /* * Insert the new channel to the end of the global * channel list. @@ -178,11 +184,6 @@ vmbus_channel_process_offer(hv_vmbus_cha ch_link); mtx_unlock(&sc->vmbus_chlist_lock); - if(bootverbose) - printf("VMBUS: new multi-channel offer <%p>, " - "its primary channel is <%p>.\n", - new_channel, new_channel->primary_channel); - new_channel->state = HV_CHANNEL_OPEN_STATE; /* @@ -345,6 +346,10 @@ vmbus_channel_on_offer_rescind(struct vm hv_vmbus_channel* channel; rescind = (const hv_vmbus_channel_rescind_offer *)msg->msg_data; + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u rescind\n", + rescind->child_rel_id); + } channel = hv_vmbus_g_connection.channels[rescind->child_rel_id]; if (channel == NULL) @@ -362,6 +367,54 @@ vmbus_chan_detach_task(void *xchan, int if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the hv_device */ hv_vmbus_child_device_unregister(chan->device); + /* NOTE: DO NOT free primary channel for now */ + } else { + struct vmbus_softc *sc = chan->vmbus_sc; + struct hv_vmbus_channel *pri_chan = chan->primary_channel; + struct vmbus_chanmsg_chfree *req; + struct vmbus_msghc *mh; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for chfree(chan%u)\n", + chan->offer_msg.child_rel_id); + goto remove; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHFREE; + req->chm_chanid = chan->offer_msg.child_rel_id; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + if (error) { + device_printf(sc->vmbus_dev, + "chfree(chan%u) failed: %d", + chan->offer_msg.child_rel_id, error); + /* NOTE: Move on! */ + } else { + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u freed\n", + chan->offer_msg.child_rel_id); + } + } +remove: + mtx_lock(&sc->vmbus_chlist_lock); + TAILQ_REMOVE(&sc->vmbus_chlist, chan, ch_link); + mtx_unlock(&sc->vmbus_chlist_lock); + + mtx_lock(&pri_chan->sc_lock); + TAILQ_REMOVE(&pri_chan->sc_list_anchor, chan, sc_list_entry); + KASSERT(pri_chan->subchan_cnt > 0, + ("invalid subchan_cnt %d", pri_chan->subchan_cnt)); + pri_chan->subchan_cnt--; + mtx_unlock(&pri_chan->sc_lock); + wakeup(pri_chan); + + hv_vmbus_free_vmbus_channel(chan); } } @@ -499,6 +552,15 @@ vmbus_rel_subchan(struct hv_vmbus_channe } void +vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan) +{ + mtx_lock(&pri_chan->sc_lock); + while (pri_chan->subchan_cnt > 0) + mtx_sleep(pri_chan, &pri_chan->sc_lock, 0, "dsubch", 0); + mtx_unlock(&pri_chan->sc_lock); +} + +void vmbus_chan_msgproc(struct vmbus_softc *sc, const struct vmbus_message *msg) { vmbus_chanmsg_proc_t msg_proc; Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Oct 14 08:02:37 2016 (r307302) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Oct 14 08:14:51 2016 (r307303) @@ -102,6 +102,7 @@ struct vmbus_gpa_range { #define VMBUS_CHANMSG_TYPE_GPADL_CONNRESP 10 /* RESP */ #define VMBUS_CHANMSG_TYPE_GPADL_DISCONN 11 /* REQ */ #define VMBUS_CHANMSG_TYPE_GPADL_DISCONNRESP 12 /* RESP */ +#define VMBUS_CHANMSG_TYPE_CHFREE 13 /* REQ */ #define VMBUS_CHANMSG_TYPE_CONNECT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_CONNECT_RESP 15 /* RESP */ #define VMBUS_CHANMSG_TYPE_DISCONNECT 16 /* REQ */ @@ -206,4 +207,10 @@ struct vmbus_chanmsg_gpadl_disconn { uint32_t chm_gpadl; } __packed; +/* VMBUS_CHANMSG_TYPE_CHFREE */ +struct vmbus_chanmsg_chfree { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_chanid; +} __packed; + #endif /* !_VMBUS_REG_H_ */ From owner-svn-src-stable-11@freebsd.org Fri Oct 14 08:18:57 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 182CBC11FAD; Fri, 14 Oct 2016 08:18:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA7C49C4; Fri, 14 Oct 2016 08:18:56 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E8ItEv086214; Fri, 14 Oct 2016 08:18:55 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E8ItuE086209; Fri, 14 Oct 2016 08:18:55 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140818.u9E8ItuE086209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 08:18:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307304 - stable/11/sys/dev/hyperv/vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 08:18:57 -0000 Author: sephe Date: Fri Oct 14 08:18:55 2016 New Revision: 307304 URL: https://svnweb.freebsd.org/changeset/base/307304 Log: MFC 302636-302638 302636 hyperv/vmbus: Move channel map to vmbus_softc Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6982 302637 hyperv/vmbus: Remove needed bits Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7002 302638 hyperv/vmbus: Destroy channel list lock upon attach failure and detach. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7003 Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_connection.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 08:14:51 2016 (r307303) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 08:18:55 2016 (r307304) @@ -123,7 +123,7 @@ vmbus_channel_process_offer(hv_vmbus_cha */ printf("VMBUS: got channel0 offer\n"); } else { - hv_vmbus_g_connection.channels[relid] = new_channel; + sc->vmbus_chmap[relid] = new_channel; } TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { @@ -351,10 +351,10 @@ vmbus_channel_on_offer_rescind(struct vm rescind->child_rel_id); } - channel = hv_vmbus_g_connection.channels[rescind->child_rel_id]; + channel = sc->vmbus_chmap[rescind->child_rel_id]; if (channel == NULL) return; - hv_vmbus_g_connection.channels[rescind->child_rel_id] = NULL; + sc->vmbus_chmap[rescind->child_rel_id] = NULL; taskqueue_enqueue(taskqueue_thread, &channel->ch_detach_task); } @@ -451,8 +451,8 @@ hv_vmbus_release_unattached_channels(str } hv_vmbus_free_vmbus_channel(channel); } - bzero(hv_vmbus_g_connection.channels, - sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX); + bzero(sc->vmbus_chmap, + sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); mtx_unlock(&sc->vmbus_chlist_lock); } Modified: stable/11/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_connection.c Fri Oct 14 08:14:51 2016 (r307303) +++ stable/11/sys/dev/hyperv/vmbus/hv_connection.c Fri Oct 14 08:18:55 2016 (r307304) @@ -43,53 +43,9 @@ #include #include -/* - * Globals - */ -hv_vmbus_connection hv_vmbus_g_connection = - { .connect_state = HV_DISCONNECTED }; - -/** - * Send a connect request on the partition service connection - */ -int -hv_vmbus_connect(struct vmbus_softc *sc) -{ - /** - * Make sure we are not connecting or connected - */ - if (hv_vmbus_g_connection.connect_state != HV_DISCONNECTED) { - return (-1); - } - - /** - * Initialize the vmbus connection - */ - hv_vmbus_g_connection.connect_state = HV_CONNECTING; - - hv_vmbus_g_connection.channels = malloc(sizeof(hv_vmbus_channel*) * - VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); - - hv_vmbus_g_connection.connect_state = HV_CONNECTED; - - return (0); -} - -/** - * Send a disconnect request on the partition service connection - */ -int -hv_vmbus_disconnect(void) -{ - - free(hv_vmbus_g_connection.channels, M_DEVBUF); - hv_vmbus_g_connection.connect_state = HV_DISCONNECTED; - - return (0); -} - static __inline void -vmbus_event_flags_proc(volatile u_long *event_flags, int flag_cnt) +vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags, + int flag_cnt) { int f; @@ -112,7 +68,7 @@ vmbus_event_flags_proc(volatile u_long * flags &= ~(1UL << bit); rel_id = rel_id_base + bit; - channel = hv_vmbus_g_connection.channels[rel_id]; + channel = sc->vmbus_chmap[rel_id]; /* if channel is closed or closing */ if (channel == NULL || channel->rxq == NULL) @@ -135,7 +91,7 @@ vmbus_event_proc(struct vmbus_softc *sc, * to get the id of the channel that has the pending interrupt. */ eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; - vmbus_event_flags_proc(eventf->evt_flags, + vmbus_event_flags_proc(sc, eventf->evt_flags, VMBUS_PCPU_GET(sc, event_flags_cnt, cpu)); } @@ -146,7 +102,7 @@ vmbus_event_proc_compat(struct vmbus_sof eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; if (atomic_testandclear_long(&eventf->evt_flags[0], 0)) { - vmbus_event_flags_proc(sc->vmbus_rx_evtflags, + vmbus_event_flags_proc(sc, sc->vmbus_rx_evtflags, VMBUS_CHAN_MAX_COMPAT >> VMBUS_EVTFLAG_SHIFT); } } Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Oct 14 08:14:51 2016 (r307303) +++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Oct 14 08:18:55 2016 (r307304) @@ -97,25 +97,6 @@ typedef struct hv_vmbus_channel_packet_m hv_vmbus_multipage_buffer range; } __packed hv_vmbus_channel_packet_multipage_buffer; -/* - * VM Bus connection states - */ -typedef enum { - HV_DISCONNECTED, - HV_CONNECTING, - HV_CONNECTED, - HV_DISCONNECTING -} hv_vmbus_connect_state; - -typedef struct { - hv_vmbus_connect_state connect_state; - - /** - * channel table for fast lookup through id. - */ - hv_vmbus_channel **channels; -} hv_vmbus_connection; - typedef union { uint32_t as_uint32_t; struct { @@ -177,12 +158,6 @@ typedef struct { uint8_t rsvd_z4[1984]; } hv_vmbus_monitor_page; -/** - * Global variables - */ - -extern hv_vmbus_connection hv_vmbus_g_connection; - /* * Private, VM Bus functions */ @@ -247,10 +222,4 @@ void hv_vmbus_child_device_register(st int hv_vmbus_child_device_unregister( struct hv_device *child_dev); -/** - * Connection interfaces - */ -int hv_vmbus_connect(struct vmbus_softc *); -int hv_vmbus_disconnect(void); - #endif /* __HYPERV_PRIV_H__ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 08:14:51 2016 (r307303) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 08:18:55 2016 (r307304) @@ -1132,6 +1132,9 @@ vmbus_doattach(struct vmbus_softc *sc) sc->vmbus_gpadl = VMBUS_GPADL_START; mtx_init(&sc->vmbus_chlist_lock, "vmbus chlist", NULL, MTX_DEF); TAILQ_INIT(&sc->vmbus_chlist); + sc->vmbus_chmap = malloc( + sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX, M_DEVBUF, + M_WAITOK | M_ZERO); /* * Create context for "post message" Hypercalls @@ -1166,12 +1169,8 @@ vmbus_doattach(struct vmbus_softc *sc) sc->vmbus_flags |= VMBUS_FLAG_SYNIC; /* - * Connect to VMBus in the root partition + * Initialize vmbus, e.g. connect to Hypervisor. */ - ret = hv_vmbus_connect(sc); - if (ret != 0) - goto cleanup; - ret = vmbus_init(sc); if (ret != 0) goto cleanup; @@ -1201,7 +1200,9 @@ cleanup: vmbus_msghc_ctx_destroy(sc->vmbus_msg_hc); sc->vmbus_msg_hc = NULL; } + free(sc->vmbus_chmap, M_DEVBUF); mtx_destroy(&sc->vmbus_scan_lock); + mtx_destroy(&sc->vmbus_chlist_lock); return (ret); } @@ -1267,7 +1268,6 @@ vmbus_detach(device_t dev) hv_vmbus_release_unattached_channels(sc); vmbus_disconnect(sc); - hv_vmbus_disconnect(); if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) { sc->vmbus_flags &= ~VMBUS_FLAG_SYNIC; @@ -1282,7 +1282,10 @@ vmbus_detach(device_t dev) sc->vmbus_msg_hc = NULL; } + free(sc->vmbus_chmap, M_DEVBUF); mtx_destroy(&sc->vmbus_scan_lock); + mtx_destroy(&sc->vmbus_chlist_lock); + return (0); } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Fri Oct 14 08:14:51 2016 (r307303) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Fri Oct 14 08:18:55 2016 (r307304) @@ -75,6 +75,7 @@ struct vmbus_softc { u_long *vmbus_rx_evtflags; /* compat evtflgs from host */ + struct hv_vmbus_channel **vmbus_chmap; struct vmbus_msghc_ctx *vmbus_msg_hc; struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; From owner-svn-src-stable-11@freebsd.org Fri Oct 14 08:26:18 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4F02C10267; Fri, 14 Oct 2016 08:26:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACB1E2DE; Fri, 14 Oct 2016 08:26:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E8QHQ7089800; Fri, 14 Oct 2016 08:26:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E8QHIk089795; Fri, 14 Oct 2016 08:26:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140826.u9E8QHIk089795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 08:26:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307305 - in stable/11/sys: conf dev/hyperv/vmbus modules/hyperv/vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 08:26:18 -0000 Author: sephe Date: Fri Oct 14 08:26:17 2016 New Revision: 307305 URL: https://svnweb.freebsd.org/changeset/base/307305 Log: MFC 302692 hyperv/vmbus: Merge hv_connection.c into hv_channel.c Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7004 Deleted: stable/11/sys/dev/hyperv/vmbus/hv_connection.c Modified: stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/vmbus_var.h stable/11/sys/modules/hyperv/vmbus/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files.amd64 ============================================================================== --- stable/11/sys/conf/files.amd64 Fri Oct 14 08:18:55 2016 (r307304) +++ stable/11/sys/conf/files.amd64 Fri Oct 14 08:26:17 2016 (r307305) @@ -303,7 +303,6 @@ dev/hyperv/utilities/hv_timesync.c opt dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hv_channel.c optional hyperv dev/hyperv/vmbus/hv_channel_mgmt.c optional hyperv -dev/hyperv/vmbus/hv_connection.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Fri Oct 14 08:18:55 2016 (r307304) +++ stable/11/sys/conf/files.i386 Fri Oct 14 08:26:17 2016 (r307305) @@ -260,7 +260,6 @@ dev/hyperv/utilities/hv_timesync.c opt dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hv_channel.c optional hyperv dev/hyperv/vmbus/hv_channel_mgmt.c optional hyperv -dev/hyperv/vmbus/hv_connection.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 08:18:55 2016 (r307304) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 08:26:17 2016 (r307305) @@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$"); static void vmbus_channel_set_event(hv_vmbus_channel* channel); static void VmbusProcessChannelEvent(void* channel, int pending); +static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, + const struct hv_vmbus_channel *); /** * @brief Trigger an event notification on the specified channel @@ -207,7 +209,7 @@ hv_vmbus_channel_open( new_channel->on_channel_callback = pfn_on_channel_callback; new_channel->channel_callback_context = context; - vmbus_on_channel_open(new_channel); + vmbus_chan_update_evtflagcnt(sc, new_channel); new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, new_channel->target_cpu); @@ -883,3 +885,95 @@ VmbusProcessChannelEvent(void* context, } while (is_batched_reading && (bytes_to_read != 0)); } } + +static __inline void +vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags, + int flag_cnt) +{ + int f; + + for (f = 0; f < flag_cnt; ++f) { + uint32_t rel_id_base; + u_long flags; + int bit; + + if (event_flags[f] == 0) + continue; + + flags = atomic_swap_long(&event_flags[f], 0); + rel_id_base = f << VMBUS_EVTFLAG_SHIFT; + + while ((bit = ffsl(flags)) != 0) { + struct hv_vmbus_channel *channel; + uint32_t rel_id; + + --bit; /* NOTE: ffsl is 1-based */ + flags &= ~(1UL << bit); + + rel_id = rel_id_base + bit; + channel = sc->vmbus_chmap[rel_id]; + + /* if channel is closed or closing */ + if (channel == NULL || channel->rxq == NULL) + continue; + + if (channel->batched_reading) + hv_ring_buffer_read_begin(&channel->inbound); + taskqueue_enqueue(channel->rxq, &channel->channel_task); + } + } +} + +void +vmbus_event_proc(struct vmbus_softc *sc, int cpu) +{ + struct vmbus_evtflags *eventf; + + /* + * On Host with Win8 or above, the event page can be checked directly + * to get the id of the channel that has the pending interrupt. + */ + eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; + vmbus_event_flags_proc(sc, eventf->evt_flags, + VMBUS_PCPU_GET(sc, event_flags_cnt, cpu)); +} + +void +vmbus_event_proc_compat(struct vmbus_softc *sc, int cpu) +{ + struct vmbus_evtflags *eventf; + + eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; + if (atomic_testandclear_long(&eventf->evt_flags[0], 0)) { + vmbus_event_flags_proc(sc, sc->vmbus_rx_evtflags, + VMBUS_CHAN_MAX_COMPAT >> VMBUS_EVTFLAG_SHIFT); + } +} + +static void +vmbus_chan_update_evtflagcnt(struct vmbus_softc *sc, + const struct hv_vmbus_channel *chan) +{ + volatile int *flag_cnt_ptr; + int flag_cnt; + + flag_cnt = (chan->offer_msg.child_rel_id / VMBUS_EVTFLAG_LEN) + 1; + flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->target_cpu); + + for (;;) { + int old_flag_cnt; + + old_flag_cnt = *flag_cnt_ptr; + if (old_flag_cnt >= flag_cnt) + break; + if (atomic_cmpset_int(flag_cnt_ptr, old_flag_cnt, flag_cnt)) { + if (bootverbose) { + device_printf(sc->vmbus_dev, + "channel%u update cpu%d flag_cnt to %d\n", + chan->offer_msg.child_rel_id, + chan->target_cpu, flag_cnt); + } + break; + } + } +} Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Fri Oct 14 08:18:55 2016 (r307304) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Fri Oct 14 08:26:17 2016 (r307305) @@ -131,7 +131,6 @@ struct trapframe; struct vmbus_message; struct vmbus_msghc; -void vmbus_on_channel_open(const struct hv_vmbus_channel *); void vmbus_event_proc(struct vmbus_softc *, int); void vmbus_event_proc_compat(struct vmbus_softc *, int); void vmbus_handle_intr(struct trapframe *); Modified: stable/11/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- stable/11/sys/modules/hyperv/vmbus/Makefile Fri Oct 14 08:18:55 2016 (r307304) +++ stable/11/sys/modules/hyperv/vmbus/Makefile Fri Oct 14 08:26:17 2016 (r307305) @@ -6,7 +6,6 @@ KMOD= hv_vmbus SRCS= hv_channel.c \ hv_channel_mgmt.c \ - hv_connection.c \ hv_ring_buffer.c \ hyperv.c \ hyperv_busdma.c \ From owner-svn-src-stable-11@freebsd.org Fri Oct 14 08:34:46 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C9D7C1051F; Fri, 14 Oct 2016 08:34:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40F05B53; Fri, 14 Oct 2016 08:34:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E8YjTU093500; Fri, 14 Oct 2016 08:34:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E8YidU093494; Fri, 14 Oct 2016 08:34:44 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140834.u9E8YidU093494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 08:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307306 - in stable/11/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 08:34:46 -0000 Author: sephe Date: Fri Oct 14 08:34:44 2016 New Revision: 307306 URL: https://svnweb.freebsd.org/changeset/base/307306 Log: MFC 302693-302697 302693 hyperv/vmbus: Make channel id a field of hv_vmbus_channel. This prepares to remove the unnecessary offer message embedding in hv_vmbus_channel. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7014 302694 hyperv/vmbus: Make subchan index a field of hv_vmbus_channel. This prepares to remove the unnecessary offer message embedding in hv_vmbus_channel. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7015 302695 hyperv/vmbus: Add flags field into hv_vmbus_channel for MNF indication This prepares to remove the unnecessary offer message embedding in hv_vmbus_channel. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7019 302696 hyperv/vmbus: Add type/instance guid fields into hv_vmbus_channel This prepares to remove the unnecessary offer message embedding in hv_vmbus_channel. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7020 302697 hyperv/vmbus: Remove the embedded offer message from hv_vmbus_channel Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7021 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/vmbus.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 08:26:17 2016 (r307305) +++ stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 08:34:44 2016 (r307306) @@ -537,7 +537,8 @@ typedef struct hv_vmbus_channel { struct hv_device* device; struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; - hv_vmbus_channel_offer_channel offer_msg; + uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ + uint32_t ch_id; /* channel id */ /* * These are based on the offer_msg.monitor_id. * Save it here for easy access. @@ -628,12 +629,18 @@ typedef struct hv_vmbus_channel { struct task ch_detach_task; TAILQ_ENTRY(hv_vmbus_channel) ch_link; + uint32_t ch_subidx; /* subchan index */ + + struct hv_guid ch_guid_type; + struct hv_guid ch_guid_inst; struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; #define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) +#define VMBUS_CHAN_FLAG_HASMNF 0x0001 + static inline void hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t state) { Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 14 08:26:17 2016 (r307305) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 14 08:34:44 2016 (r307306) @@ -518,9 +518,9 @@ netvsc_attach(device_t dev) */ pri_chan = device_ctx->channel; KASSERT(HV_VMBUS_CHAN_ISPRIMARY(pri_chan), ("not primary channel")); - KASSERT(pri_chan->offer_msg.offer.sub_channel_index == 0, + KASSERT(pri_chan->ch_subidx == 0, ("primary channel subidx %u", - pri_chan->offer_msg.offer.sub_channel_index)); + pri_chan->ch_subidx)); hn_channel_attach(sc, pri_chan); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -809,8 +809,8 @@ hn_tx_done(struct hv_vmbus_channel *chan txr = txd->txr; KASSERT(txr->hn_chan == chan, ("channel mismatch, on channel%u, should be channel%u", - chan->offer_msg.offer.sub_channel_index, - txr->hn_chan->offer_msg.offer.sub_channel_index)); + chan->ch_subidx, + txr->hn_chan->ch_subidx)); txr->hn_has_txeof = 1; hn_txdesc_put(txr, txd); @@ -2940,7 +2940,7 @@ hn_channel_attach(struct hn_softc *sc, s struct hn_rx_ring *rxr; int idx; - idx = chan->offer_msg.offer.sub_channel_index; + idx = chan->ch_subidx; KASSERT(idx >= 0 && idx < sc->hn_rx_ring_inuse, ("invalid channel index %d, should > 0 && < %d", @@ -2953,7 +2953,7 @@ hn_channel_attach(struct hn_softc *sc, s chan->hv_chan_rxr = rxr; if (bootverbose) { if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n", - idx, chan->offer_msg.child_rel_id); + idx, chan->ch_id); } if (idx < sc->hn_tx_ring_inuse) { @@ -2967,7 +2967,7 @@ hn_channel_attach(struct hn_softc *sc, s txr->hn_chan = chan; if (bootverbose) { if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n", - idx, chan->offer_msg.child_rel_id); + idx, chan->ch_id); } } @@ -2981,9 +2981,9 @@ hn_subchan_attach(struct hn_softc *sc, s KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan), ("subchannel callback on primary channel")); - KASSERT(chan->offer_msg.offer.sub_channel_index > 0, + KASSERT(chan->ch_subidx > 0, ("invalid channel subidx %u", - chan->offer_msg.offer.sub_channel_index)); + chan->ch_subidx)); hn_channel_attach(sc, chan); } Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 08:26:17 2016 (r307305) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 08:34:44 2016 (r307306) @@ -62,12 +62,12 @@ static void vmbus_channel_set_event(hv_vmbus_channel *channel) { struct vmbus_softc *sc = channel->vmbus_sc; - uint32_t chanid = channel->offer_msg.child_rel_id; + uint32_t chanid = channel->ch_id; atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], 1UL << (chanid & VMBUS_EVTFLAG_MASK)); - if (channel->offer_msg.monitor_allocated) { + if (channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { hv_vmbus_monitor_page *monitor_page; monitor_page = sc->vmbus_mnf2; @@ -86,7 +86,7 @@ vmbus_channel_sysctl_monalloc(SYSCTL_HAN struct hv_vmbus_channel *chan = arg1; int alloc = 0; - if (chan->offer_msg.monitor_allocated) + if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) alloc = 1; return sysctl_handle_int(oidp, &alloc, 0, req); } @@ -107,11 +107,11 @@ vmbus_channel_sysctl_create(hv_vmbus_cha if (primary_ch == NULL) { dev = channel->device->device; - ch_id = channel->offer_msg.child_rel_id; + ch_id = channel->ch_id; } else { dev = primary_ch->device->device; - ch_id = primary_ch->offer_msg.child_rel_id; - sub_ch_id = channel->offer_msg.offer.sub_channel_index; + ch_id = primary_ch->ch_id; + sub_ch_id = channel->ch_subidx; } ctx = &channel->ch_sysctl_ctx; sysctl_ctx_init(ctx); @@ -136,7 +136,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "chanid", CTLFLAG_RD, - &channel->offer_msg.child_rel_id, 0, "channel id"); + &channel->ch_id, 0, "channel id"); } SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "cpu", CTLFLAG_RD, &channel->target_cpu, 0, "owner CPU id"); @@ -190,7 +190,7 @@ hv_vmbus_channel_open( if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { device_printf(sc->vmbus_dev, "invalid udata len %u for chan%u\n", - user_data_len, new_channel->offer_msg.child_rel_id); + user_data_len, new_channel->ch_id); return EINVAL; } @@ -261,14 +261,14 @@ hv_vmbus_channel_open( if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for chopen(chan%u)\n", - new_channel->offer_msg.child_rel_id); + new_channel->ch_id); return ENXIO; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN; - req->chm_chanid = new_channel->offer_msg.child_rel_id; - req->chm_openid = new_channel->offer_msg.child_rel_id; + req->chm_chanid = new_channel->ch_id; + req->chm_openid = new_channel->ch_id; req->chm_gpadl = new_channel->ring_buffer_gpadl_handle; req->chm_vcpuid = new_channel->target_vcpu; req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT; @@ -279,7 +279,7 @@ hv_vmbus_channel_open( if (ret != 0) { device_printf(sc->vmbus_dev, "chopen(chan%u) msg hypercall exec failed: %d\n", - new_channel->offer_msg.child_rel_id, ret); + new_channel->ch_id, ret); vmbus_msghc_put(sc, mh); return ret; } @@ -294,11 +294,11 @@ hv_vmbus_channel_open( new_channel->state = HV_CHANNEL_OPENED_STATE; if (bootverbose) { device_printf(sc->vmbus_dev, "chan%u opened\n", - new_channel->offer_msg.child_rel_id); + new_channel->ch_id); } } else { device_printf(sc->vmbus_dev, "failed to open chan%u\n", - new_channel->offer_msg.child_rel_id); + new_channel->ch_id); ret = ENXIO; } return (ret); @@ -369,13 +369,13 @@ hv_vmbus_channel_establish_gpadl(struct if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for gpadl->chan%u\n", - channel->offer_msg.child_rel_id); + channel->ch_id); return EIO; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_CONN; - req->chm_chanid = channel->offer_msg.child_rel_id; + req->chm_chanid = channel->ch_id; req->chm_gpadl = gpadl; req->chm_range_len = range_len; req->chm_range_cnt = 1; @@ -388,7 +388,7 @@ hv_vmbus_channel_establish_gpadl(struct if (error) { device_printf(sc->vmbus_dev, "gpadl->chan%u msg hypercall exec failed: %d\n", - channel->offer_msg.child_rel_id, error); + channel->ch_id, error); vmbus_msghc_put(sc, mh); return error; } @@ -424,12 +424,12 @@ hv_vmbus_channel_establish_gpadl(struct if (status != 0) { device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " - "status %u\n", channel->offer_msg.child_rel_id, status); + "status %u\n", channel->ch_id, status); return EIO; } else { if (bootverbose) { device_printf(sc->vmbus_dev, "gpadl->chan%u " - "succeeded\n", channel->offer_msg.child_rel_id); + "succeeded\n", channel->ch_id); } } return 0; @@ -450,20 +450,20 @@ hv_vmbus_channel_teardown_gpdal(struct h if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for gpa x->chan%u\n", - chan->offer_msg.child_rel_id); + chan->ch_id); return EBUSY; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_DISCONN; - req->chm_chanid = chan->offer_msg.child_rel_id; + req->chm_chanid = chan->ch_id; req->chm_gpadl = gpadl; error = vmbus_msghc_exec(sc, mh); if (error) { device_printf(sc->vmbus_dev, "gpa x->chan%u msg hypercall exec failed: %d\n", - chan->offer_msg.child_rel_id, error); + chan->ch_id, error); vmbus_msghc_put(sc, mh); return error; } @@ -502,13 +502,13 @@ hv_vmbus_channel_close_internal(hv_vmbus if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for chclose(chan%u)\n", - channel->offer_msg.child_rel_id); + channel->ch_id); return; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHCLOSE; - req->chm_chanid = channel->offer_msg.child_rel_id; + req->chm_chanid = channel->ch_id; error = vmbus_msghc_exec_noresult(mh); vmbus_msghc_put(sc, mh); @@ -516,11 +516,11 @@ hv_vmbus_channel_close_internal(hv_vmbus if (error) { device_printf(sc->vmbus_dev, "chclose(chan%u) msg hypercall exec failed: %d\n", - channel->offer_msg.child_rel_id, error); + channel->ch_id, error); return; } else if (bootverbose) { device_printf(sc->vmbus_dev, "close chan%u\n", - channel->offer_msg.child_rel_id); + channel->ch_id); } /* Tear down the gpadl for the channel's ring buffer */ @@ -957,7 +957,7 @@ vmbus_chan_update_evtflagcnt(struct vmbu volatile int *flag_cnt_ptr; int flag_cnt; - flag_cnt = (chan->offer_msg.child_rel_id / VMBUS_EVTFLAG_LEN) + 1; + flag_cnt = (chan->ch_id / VMBUS_EVTFLAG_LEN) + 1; flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->target_cpu); for (;;) { @@ -970,7 +970,7 @@ vmbus_chan_update_evtflagcnt(struct vmbu if (bootverbose) { device_printf(sc->vmbus_dev, "channel%u update cpu%d flag_cnt to %d\n", - chan->offer_msg.child_rel_id, + chan->ch_id, chan->target_cpu, flag_cnt); } break; Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 08:26:17 2016 (r307305) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 08:34:44 2016 (r307306) @@ -112,7 +112,7 @@ vmbus_channel_process_offer(hv_vmbus_cha hv_vmbus_channel* channel; uint32_t relid; - relid = new_channel->offer_msg.child_rel_id; + relid = new_channel->ch_id; /* * Make sure this is a new offer */ @@ -127,11 +127,9 @@ vmbus_channel_process_offer(hv_vmbus_cha } TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { - if (memcmp(&channel->offer_msg.offer.interface_type, - &new_channel->offer_msg.offer.interface_type, + if (memcmp(&channel->ch_guid_type, &new_channel->ch_guid_type, sizeof(hv_guid)) == 0 && - memcmp(&channel->offer_msg.offer.interface_instance, - &new_channel->offer_msg.offer.interface_instance, + memcmp(&channel->ch_guid_inst, &new_channel->ch_guid_inst, sizeof(hv_guid)) == 0) break; } @@ -148,18 +146,18 @@ vmbus_channel_process_offer(hv_vmbus_cha logstr[0] = '\0'; if (channel != NULL) { snprintf(logstr, sizeof(logstr), ", primary chan%u", - channel->offer_msg.child_rel_id); + channel->ch_id); } device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n", - new_channel->offer_msg.child_rel_id, - new_channel->offer_msg.offer.sub_channel_index, logstr); + new_channel->ch_id, + new_channel->ch_subidx, logstr); } if (channel != NULL) { /* * Check if this is a sub channel. */ - if (new_channel->offer_msg.offer.sub_channel_index != 0) { + if (new_channel->ch_subidx != 0) { /* * It is a sub channel offer, process it. */ @@ -200,7 +198,7 @@ vmbus_channel_process_offer(hv_vmbus_cha } printf("VMBUS: duplicated primary channel%u\n", - new_channel->offer_msg.child_rel_id); + new_channel->ch_id); hv_vmbus_free_vmbus_channel(new_channel); return; } @@ -212,9 +210,7 @@ vmbus_channel_process_offer(hv_vmbus_cha * (We need to set the device field before calling * hv_vmbus_child_device_add()) */ - new_channel->device = hv_vmbus_child_device_create( - new_channel->offer_msg.offer.interface_type, - new_channel->offer_msg.offer.interface_instance, new_channel); + new_channel->device = hv_vmbus_child_device_create(new_channel); /* * Add the new device to the bus. This will kick off device-driver @@ -241,7 +237,7 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", - chan->offer_msg.child_rel_id, + chan->ch_id, chan->target_cpu, chan->target_vcpu); } } @@ -292,6 +288,12 @@ vmbus_channel_on_offer_internal(struct v /* Allocate the channel object and save this offer */ new_channel = hv_vmbus_allocate_channel(sc); + new_channel->ch_id = offer->child_rel_id; + new_channel->ch_subidx = offer->offer.sub_channel_index; + if (offer->monitor_allocated) + new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + new_channel->ch_guid_type = offer->offer.interface_type; + new_channel->ch_guid_inst = offer->offer.interface_instance; /* * By default we setup state to enable batched @@ -319,8 +321,6 @@ vmbus_channel_on_offer_internal(struct v new_channel->ch_sigevt->hc_connid = offer->connection_id; } - memcpy(&new_channel->offer_msg, offer, - sizeof(hv_vmbus_channel_offer_channel)); new_channel->monitor_group = (uint8_t) offer->monitor_id / 32; new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32; @@ -379,13 +379,13 @@ vmbus_chan_detach_task(void *xchan, int if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for chfree(chan%u)\n", - chan->offer_msg.child_rel_id); + chan->ch_id); goto remove; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHFREE; - req->chm_chanid = chan->offer_msg.child_rel_id; + req->chm_chanid = chan->ch_id; error = vmbus_msghc_exec_noresult(mh); vmbus_msghc_put(sc, mh); @@ -393,12 +393,12 @@ vmbus_chan_detach_task(void *xchan, int if (error) { device_printf(sc->vmbus_dev, "chfree(chan%u) failed: %d", - chan->offer_msg.child_rel_id, error); + chan->ch_id, error); /* NOTE: Move on! */ } else { if (bootverbose) { device_printf(sc->vmbus_dev, "chan%u freed\n", - chan->offer_msg.child_rel_id); + chan->ch_id); } } remove: Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Oct 14 08:26:17 2016 (r307305) +++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Oct 14 08:34:44 2016 (r307306) @@ -213,9 +213,7 @@ void hv_vmbus_release_unattached_chann struct vmbus_softc *); struct hv_device* hv_vmbus_child_device_create( - hv_guid device_type, - hv_guid device_instance, - hv_vmbus_channel *channel); + struct hv_vmbus_channel *channel); void hv_vmbus_child_device_register(struct vmbus_softc *, struct hv_device *child_dev); Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 08:26:17 2016 (r307305) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 08:34:44 2016 (r307306) @@ -1017,8 +1017,7 @@ vmbus_child_pnpinfo_str(device_t dev, de } struct hv_device * -hv_vmbus_child_device_create(hv_guid type, hv_guid instance, - hv_vmbus_channel *channel) +hv_vmbus_child_device_create(struct hv_vmbus_channel *channel) { hv_device *child_dev; @@ -1028,8 +1027,8 @@ hv_vmbus_child_device_create(hv_guid typ child_dev = malloc(sizeof(hv_device), M_DEVBUF, M_WAITOK | M_ZERO); child_dev->channel = channel; - memcpy(&child_dev->class_id, &type, sizeof(hv_guid)); - memcpy(&child_dev->device_id, &instance, sizeof(hv_guid)); + child_dev->class_id = channel->ch_guid_type; + child_dev->device_id = channel->ch_guid_inst; return (child_dev); } From owner-svn-src-stable-11@freebsd.org Fri Oct 14 08:45:55 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE214C109F1; Fri, 14 Oct 2016 08:45:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DF6424F; Fri, 14 Oct 2016 08:45:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E8jsEf097506; Fri, 14 Oct 2016 08:45:54 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E8jsVl097498; Fri, 14 Oct 2016 08:45:54 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140845.u9E8jsVl097498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 08:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307307 - in stable/11/sys: dev/hyperv/include dev/hyperv/netvsc dev/hyperv/storvsc dev/hyperv/utilities dev/hyperv/vmbus modules/hyperv/utilities X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 08:45:56 -0000 Author: sephe Date: Fri Oct 14 08:45:53 2016 New Revision: 307307 URL: https://svnweb.freebsd.org/changeset/base/307307 Log: MFC 302698-302704,302706 302698 hyperv/vmbus: Add vmbus method for GUID base device probing. Reduce the exposure of hv_device. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7024 302699 hyperv/vmbus: All ivars are read-only; nuke unnecessary write_ivar Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7025 302700 hyperv/vmbus: Add channel ivar accessor. This makes life easier during the transition period to nuke the hv_device. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7026 302701 hyperv/stor: Avoid the hv_device and nuke the broken get_stor_device This paves way to nuke the hv_device, which is actually an unncessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7027 302702 hyperv/util: Avoid the hv_device This paves way to nuke the hv_device, which is actually an unncessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7028 302703 hyperv/vmbus: Deprecate the usage of hv_device. This paves way to nuke the hv_device, which is actually an unncessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7032 302704 hyperv/hn: Avoid the hv_device This paves way to nuke the hv_device, which is actually an unncessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7033 302706 hyperv: Get rid of hv_device, which is unnecessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7034 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_kvp.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/utilities/hv_util.c stable/11/sys/dev/hyperv/utilities/hv_util.h stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_if.m stable/11/sys/modules/hyperv/utilities/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 08:34:44 2016 (r307306) +++ stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 08:45:53 2016 (r307307) @@ -399,20 +399,6 @@ typedef struct { #define HW_MACADDR_LEN 6 -enum { - HV_VMBUS_IVAR_TYPE, - HV_VMBUS_IVAR_INSTANCE, - HV_VMBUS_IVAR_NODE, - HV_VMBUS_IVAR_DEVCTX -}; - -#define HV_VMBUS_ACCESSOR(var, ivar, type) \ - __BUS_ACCESSOR(vmbus, var, HV_VMBUS, ivar, type) - -HV_VMBUS_ACCESSOR(type, TYPE, const char *) -HV_VMBUS_ACCESSOR(devctx, DEVCTX, struct hv_device *) - - /* * Common defines for Hyper-V ICs */ @@ -534,7 +520,7 @@ typedef union { } __packed hv_vmbus_connection_id; typedef struct hv_vmbus_channel { - struct hv_device* device; + device_t ch_dev; struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ @@ -647,15 +633,6 @@ hv_set_channel_read_state(hv_vmbus_chann channel->batched_reading = state; } -typedef struct hv_device { - hv_guid class_id; - hv_guid device_id; - device_t device; - hv_vmbus_channel* channel; -} hv_device; - - - int hv_vmbus_channel_recv_packet( hv_vmbus_channel* channel, void* buffer, @@ -737,4 +714,10 @@ hv_get_phys_addr(void *virt) return (ret); } +static __inline struct hv_vmbus_channel * +vmbus_get_channel(device_t dev) +{ + return device_get_ivars(dev); +} + #endif /* __HYPERV_H__ */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Oct 14 08:34:44 2016 (r307306) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Oct 14 08:45:53 2016 (r307307) @@ -58,31 +58,30 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper * Forward declarations */ static void hv_nv_on_channel_callback(void *xchan); -static int hv_nv_init_send_buffer_with_net_vsp(struct hv_device *device); -static int hv_nv_init_rx_buffer_with_net_vsp(struct hv_device *device); +static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc); +static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *); static int hv_nv_destroy_send_buffer(netvsc_dev *net_dev); static int hv_nv_destroy_rx_buffer(netvsc_dev *net_dev); -static int hv_nv_connect_to_vsp(struct hv_device *device); +static int hv_nv_connect_to_vsp(struct hn_softc *sc); static void hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_device *device, struct hv_vmbus_channel *, hv_vm_packet_descriptor *pkt); + struct hv_vmbus_channel *, hv_vm_packet_descriptor *pkt); static void hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, uint64_t tid, uint32_t status); static void hv_nv_on_receive(netvsc_dev *net_dev, - struct hv_device *device, struct hv_vmbus_channel *chan, + struct hn_softc *sc, struct hv_vmbus_channel *chan, hv_vm_packet_descriptor *pkt); /* * */ static inline netvsc_dev * -hv_nv_alloc_net_device(struct hv_device *device) +hv_nv_alloc_net_device(struct hn_softc *sc) { netvsc_dev *net_dev; - hn_softc_t *sc = device_get_softc(device->device); net_dev = malloc(sizeof(netvsc_dev), M_NETVSC, M_WAITOK | M_ZERO); - net_dev->dev = device; + net_dev->sc = sc; net_dev->destroy = FALSE; sc->net_dev = net_dev; @@ -90,43 +89,21 @@ hv_nv_alloc_net_device(struct hv_device } /* - * + * XXX unnecessary; nuke it. */ static inline netvsc_dev * -hv_nv_get_outbound_net_device(struct hv_device *device) +hv_nv_get_outbound_net_device(struct hn_softc *sc) { - hn_softc_t *sc = device_get_softc(device->device); - netvsc_dev *net_dev = sc->net_dev;; - - if ((net_dev != NULL) && net_dev->destroy) { - return (NULL); - } - - return (net_dev); + return sc->net_dev; } /* - * + * XXX unnecessary; nuke it. */ static inline netvsc_dev * -hv_nv_get_inbound_net_device(struct hv_device *device) +hv_nv_get_inbound_net_device(struct hn_softc *sc) { - hn_softc_t *sc = device_get_softc(device->device); - netvsc_dev *net_dev = sc->net_dev;; - - if (net_dev == NULL) { - return (net_dev); - } - /* - * When the device is being destroyed; we only - * permit incoming packets if and only if there - * are outstanding sends. - */ - if (net_dev->destroy) { - return (NULL); - } - - return (net_dev); + return sc->net_dev; } int @@ -164,13 +141,13 @@ hv_nv_get_next_send_section(netvsc_dev * * Hyper-V extensible switch and the synthetic data path. */ static int -hv_nv_init_rx_buffer_with_net_vsp(struct hv_device *device) +hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc) { netvsc_dev *net_dev; nvsp_msg *init_pkt; int ret = 0; - net_dev = hv_nv_get_outbound_net_device(device); + net_dev = hv_nv_get_outbound_net_device(sc); if (!net_dev) { return (ENODEV); } @@ -185,7 +162,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct * GPADL: Guest physical address descriptor list. */ ret = hv_vmbus_channel_establish_gpadl( - device->channel, net_dev->rx_buf, + sc->hn_prichan, net_dev->rx_buf, net_dev->rx_buf_size, &net_dev->rx_buf_gpadl_handle); if (ret != 0) { goto cleanup; @@ -206,7 +183,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct /* Send the gpadl notification request */ - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); @@ -256,13 +233,13 @@ exit: * Net VSC initialize send buffer with net VSP */ static int -hv_nv_init_send_buffer_with_net_vsp(struct hv_device *device) +hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc) { netvsc_dev *net_dev; nvsp_msg *init_pkt; int ret = 0; - net_dev = hv_nv_get_outbound_net_device(device); + net_dev = hv_nv_get_outbound_net_device(sc); if (!net_dev) { return (ENODEV); } @@ -279,7 +256,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru * Note: This call uses the vmbus connection rather than the * channel to establish the gpadl handle. */ - ret = hv_vmbus_channel_establish_gpadl(device->channel, + ret = hv_vmbus_channel_establish_gpadl(sc->hn_prichan, net_dev->send_buf, net_dev->send_buf_size, &net_dev->send_buf_gpadl_handle); if (ret != 0) { @@ -300,7 +277,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru /* Send the gpadl notification request */ - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); @@ -360,7 +337,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ revoke_pkt->msgs.vers_1_msgs.revoke_rx_buf.id = NETVSC_RECEIVE_BUFFER_ID; - ret = hv_vmbus_channel_send_packet(net_dev->dev->channel, + ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, revoke_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)revoke_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); @@ -376,7 +353,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ /* Tear down the gpadl on the vsp end */ if (net_dev->rx_buf_gpadl_handle) { - ret = hv_vmbus_channel_teardown_gpdal(net_dev->dev->channel, + ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, net_dev->rx_buf_gpadl_handle); /* * If we failed here, we might as well return and have a leak @@ -428,7 +405,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne revoke_pkt->msgs.vers_1_msgs.revoke_send_buf.id = NETVSC_SEND_BUFFER_ID; - ret = hv_vmbus_channel_send_packet(net_dev->dev->channel, + ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, revoke_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)revoke_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); @@ -443,7 +420,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne /* Tear down the gpadl on the vsp end */ if (net_dev->send_buf_gpadl_handle) { - ret = hv_vmbus_channel_teardown_gpdal(net_dev->dev->channel, + ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, net_dev->send_buf_gpadl_handle); /* @@ -478,7 +455,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne * to the negotiated version, so we cannot rely on that. */ static int -hv_nv_negotiate_nvsp_protocol(struct hv_device *device, netvsc_dev *net_dev, +hv_nv_negotiate_nvsp_protocol(struct hn_softc *sc, netvsc_dev *net_dev, uint32_t nvsp_ver) { nvsp_msg *init_pkt; @@ -495,7 +472,7 @@ hv_nv_negotiate_nvsp_protocol(struct hv_ init_pkt->msgs.init_msgs.init.protocol_version_2 = nvsp_ver; /* Send the init request */ - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); @@ -516,13 +493,13 @@ hv_nv_negotiate_nvsp_protocol(struct hv_ * Not valid for NDIS version 1. */ static int -hv_nv_send_ndis_config(struct hv_device *device, uint32_t mtu) +hv_nv_send_ndis_config(struct hn_softc *sc, uint32_t mtu) { netvsc_dev *net_dev; nvsp_msg *init_pkt; int ret; - net_dev = hv_nv_get_outbound_net_device(device); + net_dev = hv_nv_get_outbound_net_device(sc); if (!net_dev) return (-ENODEV); @@ -539,7 +516,7 @@ hv_nv_send_ndis_config(struct hv_device = 1; /* Send the configuration packet */ - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); if (ret != 0) @@ -552,7 +529,7 @@ hv_nv_send_ndis_config(struct hv_device * Net VSC connect to VSP */ static int -hv_nv_connect_to_vsp(struct hv_device *device) +hv_nv_connect_to_vsp(struct hn_softc *sc) { netvsc_dev *net_dev; nvsp_msg *init_pkt; @@ -564,20 +541,16 @@ hv_nv_connect_to_vsp(struct hv_device *d int i; int protocol_number = nitems(protocol_list); int ret = 0; - device_t dev = device->device; - hn_softc_t *sc = device_get_softc(dev); + device_t dev = sc->hn_dev; struct ifnet *ifp = sc->hn_ifp; - net_dev = hv_nv_get_outbound_net_device(device); - if (!net_dev) { - return (ENODEV); - } + net_dev = hv_nv_get_outbound_net_device(sc); /* * Negotiate the NVSP version. Try the latest NVSP first. */ for (i = protocol_number - 1; i >= 0; i--) { - if (hv_nv_negotiate_nvsp_protocol(device, net_dev, + if (hv_nv_negotiate_nvsp_protocol(sc, net_dev, protocol_list[i]) == 0) { net_dev->nvsp_version = protocol_list[i]; if (bootverbose) @@ -599,7 +572,7 @@ hv_nv_connect_to_vsp(struct hv_device *d * This needs to be right after the NVSP init message per Haiyang */ if (net_dev->nvsp_version >= NVSP_PROTOCOL_VERSION_2) - ret = hv_nv_send_ndis_config(device, ifp->if_mtu); + ret = hv_nv_send_ndis_config(sc, ifp->if_mtu); /* * Send the NDIS version @@ -622,7 +595,7 @@ hv_nv_connect_to_vsp(struct hv_device *d /* Send the init request */ - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); if (ret != 0) { @@ -643,9 +616,9 @@ hv_nv_connect_to_vsp(struct hv_device *d net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE; net_dev->send_buf_size = NETVSC_SEND_BUFFER_SIZE; - ret = hv_nv_init_rx_buffer_with_net_vsp(device); + ret = hv_nv_init_rx_buffer_with_net_vsp(sc); if (ret == 0) - ret = hv_nv_init_send_buffer_with_net_vsp(device); + ret = hv_nv_init_send_buffer_with_net_vsp(sc); cleanup: return (ret); @@ -677,13 +650,13 @@ hv_nv_subchan_attach(struct hv_vmbus_cha * Callback when the device belonging to this driver is added */ netvsc_dev * -hv_nv_on_device_add(struct hv_device *device, void *additional_info) +hv_nv_on_device_add(struct hn_softc *sc, void *additional_info) { - struct hv_vmbus_channel *chan = device->channel; + struct hv_vmbus_channel *chan = sc->hn_prichan; netvsc_dev *net_dev; int ret = 0; - net_dev = hv_nv_alloc_net_device(device); + net_dev = hv_nv_alloc_net_device(sc); if (net_dev == NULL) return NULL; @@ -707,7 +680,7 @@ hv_nv_on_device_add(struct hv_device *de /* * Connect with the NetVsp */ - ret = hv_nv_connect_to_vsp(device); + ret = hv_nv_connect_to_vsp(sc); if (ret != 0) goto close; @@ -733,9 +706,8 @@ cleanup: * Net VSC on device remove */ int -hv_nv_on_device_remove(struct hv_device *device, boolean_t destroy_channel) +hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel) { - hn_softc_t *sc = device_get_softc(device->device); netvsc_dev *net_dev = sc->net_dev;; /* Stop outbound traffic ie sends and receives completions */ @@ -748,12 +720,12 @@ hv_nv_on_device_remove(struct hv_device /* Now, we can close the channel safely */ if (!destroy_channel) { - device->channel->state = + sc->hn_prichan->state = HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE; } - free(device->channel->hv_chan_rdbuf, M_NETVSC); - hv_vmbus_channel_close(device->channel); + free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC); + hv_vmbus_channel_close(sc->hn_prichan); sema_destroy(&net_dev->channel_init_sema); free(net_dev, M_NETVSC); @@ -765,8 +737,7 @@ hv_nv_on_device_remove(struct hv_device * Net VSC on send completion */ static void -hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_device *device, struct hv_vmbus_channel *chan, +hv_nv_on_send_completion(netvsc_dev *net_dev, struct hv_vmbus_channel *chan, hv_vm_packet_descriptor *pkt) { nvsp_msg *nvsp_msg_pkt; @@ -871,14 +842,14 @@ hv_nv_on_send(struct hv_vmbus_channel *c * with virtual addresses. */ static void -hv_nv_on_receive(netvsc_dev *net_dev, struct hv_device *device, +hv_nv_on_receive(netvsc_dev *net_dev, struct hn_softc *sc, struct hv_vmbus_channel *chan, hv_vm_packet_descriptor *pkt) { hv_vm_transfer_page_packet_header *vm_xfer_page_pkt; nvsp_msg *nvsp_msg_pkt; netvsc_packet vsc_pkt; netvsc_packet *net_vsc_pkt = &vsc_pkt; - device_t dev = device->device; + device_t dev = sc->hn_dev; int count = 0; int i = 0; int status = nvsp_status_success; @@ -912,7 +883,6 @@ hv_nv_on_receive(netvsc_dev *net_dev, st } count = vm_xfer_page_pkt->range_count; - net_vsc_pkt->device = device; /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ for (i = 0; i < count; i++) { @@ -922,7 +892,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st net_vsc_pkt->tot_data_buf_len = vm_xfer_page_pkt->ranges[i].byte_count; - hv_rf_on_receive(net_dev, device, chan, net_vsc_pkt); + hv_rf_on_receive(net_dev, chan, net_vsc_pkt); if (net_vsc_pkt->status != nvsp_status_success) { status = nvsp_status_failure; } @@ -978,14 +948,14 @@ retry_send_cmplt: * Net VSC receiving vRSS send table from VSP */ static void -hv_nv_send_table(struct hv_device *device, hv_vm_packet_descriptor *pkt) +hv_nv_send_table(struct hn_softc *sc, hv_vm_packet_descriptor *pkt) { netvsc_dev *net_dev; nvsp_msg *nvsp_msg_pkt; int i; uint32_t count, *table; - net_dev = hv_nv_get_inbound_net_device(device); + net_dev = hv_nv_get_inbound_net_device(sc); if (!net_dev) return; @@ -1021,9 +991,9 @@ static void hv_nv_on_channel_callback(void *xchan) { struct hv_vmbus_channel *chan = xchan; - struct hv_device *device = chan->device; + device_t dev = chan->ch_dev; + struct hn_softc *sc = device_get_softc(dev); netvsc_dev *net_dev; - device_t dev = device->device; uint32_t bytes_rxed; uint64_t request_id; hv_vm_packet_descriptor *desc; @@ -1031,7 +1001,7 @@ hv_nv_on_channel_callback(void *xchan) int bufferlen = NETVSC_PACKET_SIZE; int ret = 0; - net_dev = hv_nv_get_inbound_net_device(device); + net_dev = hv_nv_get_inbound_net_device(sc); if (net_dev == NULL) return; @@ -1045,14 +1015,14 @@ hv_nv_on_channel_callback(void *xchan) desc = (hv_vm_packet_descriptor *)buffer; switch (desc->type) { case HV_VMBUS_PACKET_TYPE_COMPLETION: - hv_nv_on_send_completion(net_dev, device, - chan, desc); + hv_nv_on_send_completion(net_dev, chan, + desc); break; case HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES: - hv_nv_on_receive(net_dev, device, chan, desc); + hv_nv_on_receive(net_dev, sc, chan, desc); break; case HV_VMBUS_PACKET_TYPE_DATA_IN_BAND: - hv_nv_send_table(device, desc); + hv_nv_send_table(sc, desc); break; default: device_printf(dev, Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Oct 14 08:34:44 2016 (r307306) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Oct 14 08:45:53 2016 (r307307) @@ -1040,7 +1040,7 @@ typedef struct nvsp_msg_ { * Per netvsc channel-specific */ typedef struct netvsc_dev_ { - struct hv_device *dev; + struct hn_softc *sc; /* Send buffer allocated by us but manages by NetVSP */ void *send_buf; @@ -1107,7 +1107,6 @@ typedef void (*pfn_on_send_rx_completion #endif typedef struct netvsc_packet_ { - struct hv_device *device; hv_bool_uint8_t is_data_pkt; /* One byte */ uint16_t vlan_tci; uint32_t status; @@ -1239,8 +1238,8 @@ typedef struct hn_softc { int hn_initdone; /* See hv_netvsc_drv_freebsd.c for rules on how to use */ int temp_unusable; - struct hv_device *hn_dev_obj; netvsc_dev *net_dev; + struct hv_vmbus_channel *hn_prichan; int hn_rx_ring_cnt; int hn_rx_ring_inuse; @@ -1262,10 +1261,10 @@ typedef struct hn_softc { */ extern int hv_promisc_mode; -void netvsc_linkstatus_callback(struct hv_device *device_obj, uint32_t status); -netvsc_dev *hv_nv_on_device_add(struct hv_device *device, +void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); +netvsc_dev *hv_nv_on_device_add(struct hn_softc *sc, void *additional_info); -int hv_nv_on_device_remove(struct hv_device *device, +int hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel); int hv_nv_on_send(struct hv_vmbus_channel *chan, netvsc_packet *pkt); int hv_nv_get_next_send_section(netvsc_dev *net_dev); Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 14 08:34:44 2016 (r307306) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 14 08:45:53 2016 (r307307) @@ -411,18 +411,12 @@ static const hv_guid g_net_vsc_device_ty static int netvsc_probe(device_t dev) { - const char *p; - - p = vmbus_get_type(dev); - if (!memcmp(p, &g_net_vsc_device_type.data, sizeof(hv_guid))) { + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, + &g_net_vsc_device_type) == 0) { device_set_desc(dev, "Hyper-V Network Interface"); - if (bootverbose) - printf("Netvsc probe... DONE \n"); - - return (BUS_PROBE_DEFAULT); + return BUS_PROBE_DEFAULT; } - - return (ENXIO); + return ENXIO; } /* @@ -434,8 +428,6 @@ netvsc_probe(device_t dev) static int netvsc_attach(device_t dev) { - struct hv_device *device_ctx = vmbus_get_devctx(dev); - struct hv_vmbus_channel *pri_chan; netvsc_device_info device_info; hn_softc_t *sc; int unit = device_get_unit(dev); @@ -449,6 +441,7 @@ netvsc_attach(device_t dev) sc->hn_unit = unit; sc->hn_dev = dev; + sc->hn_prichan = vmbus_get_channel(dev); if (hn_tx_taskq == NULL) { sc->hn_tx_taskq = taskqueue_create("hn_tx", M_WAITOK, @@ -472,8 +465,6 @@ netvsc_attach(device_t dev) } NV_LOCK_INIT(sc, "NetVSCLock"); - sc->hn_dev_obj = device_ctx; - ifp = sc->hn_ifp = if_alloc(IFT_ETHER); ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); @@ -516,12 +507,7 @@ netvsc_attach(device_t dev) /* * Associate the first TX/RX ring w/ the primary channel. */ - pri_chan = device_ctx->channel; - KASSERT(HV_VMBUS_CHAN_ISPRIMARY(pri_chan), ("not primary channel")); - KASSERT(pri_chan->ch_subidx == 0, - ("primary channel subidx %u", - pri_chan->ch_subidx)); - hn_channel_attach(sc, pri_chan); + hn_channel_attach(sc, sc->hn_prichan); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; @@ -558,7 +544,7 @@ netvsc_attach(device_t dev) IFCAP_LRO; ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO; - error = hv_rf_on_device_add(device_ctx, &device_info, ring_cnt); + error = hv_rf_on_device_add(sc, &device_info, ring_cnt); if (error) goto failed; KASSERT(sc->net_dev->num_channel > 0 && @@ -632,7 +618,6 @@ static int netvsc_detach(device_t dev) { struct hn_softc *sc = device_get_softc(dev); - struct hv_device *hv_device = vmbus_get_devctx(dev); if (bootverbose) printf("netvsc_detach\n"); @@ -648,7 +633,7 @@ netvsc_detach(device_t dev) * the netdevice. */ - hv_rf_on_device_remove(hv_device, HV_RF_NV_DESTROY_CHANNEL); + hv_rf_on_device_remove(sc, HV_RF_NV_DESTROY_CHANNEL); hn_stop_tx_tasks(sc); @@ -1207,10 +1192,8 @@ hn_start_locked(struct hn_tx_ring *txr, * Link up/down notification */ void -netvsc_linkstatus_callback(struct hv_device *device_obj, uint32_t status) +netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status) { - hn_softc_t *sc = device_get_softc(device_obj->device); - if (status == 1) { sc->hn_carrier = 1; } else { @@ -1531,7 +1514,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, struct ifaddr *ifa = (struct ifaddr *)data; #endif netvsc_device_info device_info; - struct hv_device *hn_dev; int mask, error = 0; int retry_cnt = 500; @@ -1549,8 +1531,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, error = ether_ioctl(ifp, cmd, data); break; case SIOCSIFMTU: - hn_dev = vmbus_get_devctx(sc->hn_dev); - /* Check MTU value change */ if (ifp->if_mtu == ifr->ifr_mtu) break; @@ -1597,7 +1577,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, * MTU to take effect. This includes tearing down, but not * deleting the channel, then bringing it back up. */ - error = hv_rf_on_device_remove(hn_dev, HV_RF_NV_RETAIN_CHANNEL); + error = hv_rf_on_device_remove(sc, HV_RF_NV_RETAIN_CHANNEL); if (error) { NV_LOCK(sc); sc->temp_unusable = FALSE; @@ -1606,9 +1586,9 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } /* Wait for subchannels to be destroyed */ - vmbus_drain_subchan(hn_dev->channel); + vmbus_drain_subchan(sc->hn_prichan); - error = hv_rf_on_device_add(hn_dev, &device_info, + error = hv_rf_on_device_add(sc, &device_info, sc->hn_rx_ring_inuse); if (error) { NV_LOCK(sc); @@ -1773,7 +1753,6 @@ hn_stop(hn_softc_t *sc) { struct ifnet *ifp; int ret, i; - struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev); ifp = sc->hn_ifp; @@ -1788,7 +1767,7 @@ hn_stop(hn_softc_t *sc) if_link_state_change(ifp, LINK_STATE_DOWN); sc->hn_initdone = 0; - ret = hv_rf_on_close(device_ctx); + ret = hv_rf_on_close(sc); } /* @@ -1856,7 +1835,6 @@ static void hn_ifinit_locked(hn_softc_t *sc) { struct ifnet *ifp; - struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev); int ret, i; ifp = sc->hn_ifp; @@ -1867,7 +1845,7 @@ hn_ifinit_locked(hn_softc_t *sc) hv_promisc_mode = 1; - ret = hv_rf_on_open(device_ctx); + ret = hv_rf_on_open(sc); if (ret != 0) { return; } else { @@ -2990,13 +2968,12 @@ hn_subchan_attach(struct hn_softc *sc, s static void hn_subchan_setup(struct hn_softc *sc) { - struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev); struct hv_vmbus_channel **subchan; int subchan_cnt = sc->net_dev->num_channel - 1; int i; /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(device_ctx->channel, subchan_cnt); + subchan = vmbus_get_subchan(sc->hn_prichan, subchan_cnt); /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 14 08:34:44 2016 (r307306) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 14 08:45:53 2016 (r307307) @@ -88,7 +88,7 @@ static int hv_rf_close_device(rndis_dev static void hv_rf_on_send_request_completion(struct hv_vmbus_channel *, void *context); static void hv_rf_on_send_request_halt_completion(struct hv_vmbus_channel *, void *context); int -hv_rf_send_offload_request(struct hv_device *device, +hv_rf_send_offload_request(struct hn_softc *sc, rndis_offload_params *offloads); /* * Set the Per-Packet-Info with the specified type @@ -298,7 +298,7 @@ hv_rf_send_request(rndis_device *device, packet->send_buf_section_size = 0; sendit: - ret = hv_nv_on_send(device->net_dev->dev->channel, packet); + ret = hv_nv_on_send(device->net_dev->sc->hn_prichan, packet); return (ret); } @@ -350,7 +350,7 @@ hv_rf_receive_response(rndis_device *dev } int -hv_rf_send_offload_request(struct hv_device *device, +hv_rf_send_offload_request(struct hn_softc *sc, rndis_offload_params *offloads) { rndis_request *request; @@ -358,8 +358,7 @@ hv_rf_send_offload_request(struct hv_dev rndis_offload_params *offload_req; rndis_set_complete *set_complete; rndis_device *rndis_dev; - hn_softc_t *sc = device_get_softc(device->device); - device_t dev = device->device; + device_t dev = sc->hn_dev; netvsc_dev *net_dev = sc->net_dev; uint32_t vsp_version = net_dev->nvsp_version; uint32_t extlen = sizeof(rndis_offload_params); @@ -436,14 +435,14 @@ hv_rf_receive_indicate_status(rndis_devi switch(indicate->status) { case RNDIS_STATUS_MEDIA_CONNECT: - netvsc_linkstatus_callback(device->net_dev->dev, 1); + netvsc_linkstatus_callback(device->net_dev->sc, 1); break; case RNDIS_STATUS_MEDIA_DISCONNECT: - netvsc_linkstatus_callback(device->net_dev->dev, 0); + netvsc_linkstatus_callback(device->net_dev->sc, 0); break; default: /* TODO: */ - device_printf(device->net_dev->dev->device, + device_printf(device->net_dev->sc->hn_dev, "unknown status %d received\n", indicate->status); break; } @@ -536,7 +535,7 @@ hv_rf_receive_data(rndis_device *device, { rndis_packet *rndis_pkt; uint32_t data_offset; - device_t dev = device->net_dev->dev->device; + device_t dev = device->net_dev->sc->hn_dev; struct hv_rf_recvinfo info; rndis_pkt = &message->msg.packet; @@ -579,7 +578,7 @@ hv_rf_receive_data(rndis_device *device, * RNDIS filter on receive */ int -hv_rf_on_receive(netvsc_dev *net_dev, struct hv_device *device, +hv_rf_on_receive(netvsc_dev *net_dev, struct hv_vmbus_channel *chan, netvsc_packet *pkt) { rndis_device *rndis_dev; @@ -1061,7 +1060,7 @@ hv_rf_close_device(rndis_device *device) * RNDIS filter on device add */ int -hv_rf_on_device_add(struct hv_device *device, void *additl_info, +hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int nchan) { int ret; @@ -1072,7 +1071,7 @@ hv_rf_on_device_add(struct hv_device *de struct rndis_recv_scale_cap rsscaps; uint32_t rsscaps_size = sizeof(struct rndis_recv_scale_cap); netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; - device_t dev = device->device; + device_t dev = sc->hn_dev; rndis_dev = hv_get_rndis_device(); if (rndis_dev == NULL) { @@ -1085,7 +1084,7 @@ hv_rf_on_device_add(struct hv_device *de * (hv_rf_on_receive()) before this call is completed. * Note: Earlier code used a function pointer here. */ - net_dev = hv_nv_on_device_add(device, additl_info); + net_dev = hv_nv_on_device_add(sc, additl_info); if (!net_dev) { hv_put_rndis_device(rndis_dev); @@ -1123,7 +1122,7 @@ hv_rf_on_device_add(struct hv_device *de offloads.udp_ipv6_csum = RNDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; offloads.lso_v2_ipv4 = RNDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED; - ret = hv_rf_send_offload_request(device, &offloads); + ret = hv_rf_send_offload_request(sc, &offloads); if (ret != 0) { /* TODO: shut down rndis device and the channel */ device_printf(dev, @@ -1170,7 +1169,7 @@ hv_rf_on_device_add(struct hv_device *de init_pkt->msgs.vers_5_msgs.subchannel_request.num_subchannels = net_dev->num_channel - 1; - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); @@ -1204,9 +1203,8 @@ out: * RNDIS filter on device remove */ int -hv_rf_on_device_remove(struct hv_device *device, boolean_t destroy_channel) +hv_rf_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel) { - hn_softc_t *sc = device_get_softc(device->device); netvsc_dev *net_dev = sc->net_dev; rndis_device *rndis_dev = (rndis_device *)net_dev->extension; int ret; @@ -1218,7 +1216,7 @@ hv_rf_on_device_remove(struct hv_device net_dev->extension = NULL; /* Pass control to inner driver to remove the device */ - ret |= hv_nv_on_device_remove(device, destroy_channel); + ret |= hv_nv_on_device_remove(sc, destroy_channel); return (ret); } @@ -1227,9 +1225,8 @@ hv_rf_on_device_remove(struct hv_device * RNDIS filter on open */ int -hv_rf_on_open(struct hv_device *device) +hv_rf_on_open(struct hn_softc *sc) { - hn_softc_t *sc = device_get_softc(device->device); netvsc_dev *net_dev = sc->net_dev; return (hv_rf_open_device((rndis_device *)net_dev->extension)); @@ -1239,9 +1236,8 @@ hv_rf_on_open(struct hv_device *device) * RNDIS filter on close */ int -hv_rf_on_close(struct hv_device *device) +hv_rf_on_close(struct hn_softc *sc) { - hn_softc_t *sc = device_get_softc(device->device); netvsc_dev *net_dev = sc->net_dev; return (hv_rf_close_device((rndis_device *)net_dev->extension)); Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Oct 14 08:34:44 2016 (r307306) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Oct 14 08:45:53 2016 (r307307) @@ -111,15 +111,16 @@ typedef struct rndis_device_ { * Externs */ struct hv_vmbus_channel; +struct hn_softc; -int hv_rf_on_receive(netvsc_dev *net_dev, struct hv_device *device, +int hv_rf_on_receive(netvsc_dev *net_dev, struct hv_vmbus_channel *chan, netvsc_packet *pkt); void hv_rf_receive_rollup(netvsc_dev *net_dev); void hv_rf_channel_rollup(struct hv_vmbus_channel *chan); -int hv_rf_on_device_add(struct hv_device *device, void *additl_info, int nchan); -int hv_rf_on_device_remove(struct hv_device *device, boolean_t destroy_channel); -int hv_rf_on_open(struct hv_device *device); -int hv_rf_on_close(struct hv_device *device); +int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int nchan); +int hv_rf_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel); +int hv_rf_on_open(struct hn_softc *sc); +int hv_rf_on_close(struct hn_softc *sc); #endif /* __HV_RNDIS_FILTER_H__ */ Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 14 08:34:44 2016 (r307306) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 14 08:45:53 2016 (r307307) @@ -125,7 +125,7 @@ struct hv_storvsc_request { }; struct storvsc_softc { - struct hv_device *hs_dev; + struct hv_vmbus_channel *hs_chan; LIST_HEAD(, hv_storvsc_request) hs_free_list; struct mtx hs_lock; struct storvsc_driver_props *hs_drv_props; @@ -139,6 +139,7 @@ struct storvsc_softc { struct sema hs_drain_sema; struct hv_storvsc_request hs_init_req; struct hv_storvsc_request hs_reset_req; + device_t hs_dev; }; @@ -264,11 +265,11 @@ static int create_storvsc_request(union static void storvsc_free_request(struct storvsc_softc *sc, struct hv_storvsc_request *reqp); static enum hv_storage_type storvsc_get_storage_type(device_t dev); static void hv_storvsc_rescan_target(struct storvsc_softc *sc); -static void hv_storvsc_on_channel_callback(void *context); +static void hv_storvsc_on_channel_callback(void *xchan); static void hv_storvsc_on_iocompletion( struct storvsc_softc *sc, struct vstor_packet *vstor_packet, struct hv_storvsc_request *request); -static int hv_storvsc_connect_vsp(struct hv_device *device); +static int hv_storvsc_connect_vsp(struct storvsc_softc *); static void storvsc_io_done(struct hv_storvsc_request *reqp); static void storvsc_copy_sgl_to_bounce_buf(struct sglist *bounce_sgl, bus_dma_segment_t *orig_sgl, @@ -297,72 +298,16 @@ DRIVER_MODULE(storvsc, vmbus, storvsc_dr MODULE_VERSION(storvsc, 1); MODULE_DEPEND(storvsc, vmbus, 1, 1, 1); - -/** - * The host is capable of sending messages to us that are - * completely unsolicited. So, we need to address the race - * condition where we may be in the process of unloading the - * driver when the host may send us an unsolicited message. - * We address this issue by implementing a sequentially - * consistent protocol: - * - * 1. Channel callback is invoked while holding the channel lock - * and an unloading driver will reset the channel callback under - * the protection of this channel lock. - * - * 2. To ensure bounded wait time for unloading a driver, we don't - * permit outgoing traffic once the device is marked as being - * destroyed. - * - * 3. Once the device is marked as being destroyed, we only - * permit incoming traffic to properly account for - * packets already sent out. - */ -static inline struct storvsc_softc * -get_stor_device(struct hv_device *device, - boolean_t outbound) -{ - struct storvsc_softc *sc; - - sc = device_get_softc(device->device); - - if (outbound) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Oct 14 08:55:51 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80A7AC10E55; Fri, 14 Oct 2016 08:55:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AC3AB80; Fri, 14 Oct 2016 08:55:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E8toXC001653; Fri, 14 Oct 2016 08:55:50 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E8tori001647; Fri, 14 Oct 2016 08:55:50 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140855.u9E8tori001647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 08:55:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307308 - in stable/11/sys/dev/hyperv: include vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 08:55:51 -0000 Author: sephe Date: Fri Oct 14 08:55:49 2016 New Revision: 307308 URL: https://svnweb.freebsd.org/changeset/base/307308 Log: MFC 302707-302709 302707 hyperv/vmbus: Nuke unused field from hv_vmbus_channel. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7036 302708 hyperv/bufring: Remove unused fields Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7037 302709 hyperv/vmbus: Pack bool field into flags field Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7038 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 08:45:53 2016 (r307307) +++ stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 08:55:49 2016 (r307308) @@ -471,7 +471,7 @@ typedef struct { uint8_t reserved[4084]; /* - * WARNING: Ring data starts here + ring_data_start_offset + * WARNING: Ring data starts here * !!! DO NOT place any fields below this !!! */ uint8_t buffer[0]; /* doubles as interrupt mask */ @@ -491,10 +491,8 @@ typedef struct { typedef struct { hv_vmbus_ring_buffer* ring_buffer; - uint32_t ring_size; /* Include the shared header */ struct mtx ring_lock; uint32_t ring_data_size; /* ring_size */ - uint32_t ring_data_start_offset; } hv_vmbus_ring_buffer_info; typedef void (*hv_vmbus_pfn_channel_callback)(void *context); @@ -553,19 +551,6 @@ typedef struct hv_vmbus_channel { hv_vmbus_pfn_channel_callback on_channel_callback; void* channel_callback_context; - /* - * If batched_reading is set to "true", mask the interrupt - * and read until the channel is empty. - * If batched_reading is set to "false", the channel is not - * going to perform batched reading. - * - * Batched reading is enabled by default; specific - * drivers that don't want this behavior can turn it off. - */ - boolean_t batched_reading; - - boolean_t is_dedicated_interrupt; - struct hypercall_sigevt_in *ch_sigevt; struct hyperv_dma ch_sigevt_dma; @@ -626,11 +611,23 @@ typedef struct hv_vmbus_channel { #define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) #define VMBUS_CHAN_FLAG_HASMNF 0x0001 +/* + * If this flag is set, this channel's interrupt will be masked in ISR, + * and the RX bufring will be drained before this channel's interrupt is + * unmasked. + * + * This flag is turned on by default. Drivers can turn it off according + * to their own requirement. + */ +#define VMBUS_CHAN_FLAG_BATCHREAD 0x0002 static inline void -hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t state) +hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t on) { - channel->batched_reading = state; + if (!on) + channel->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD; + else + channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; } int hv_vmbus_channel_recv_packet( Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 08:45:53 2016 (r307307) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 08:55:49 2016 (r307308) @@ -856,11 +856,13 @@ VmbusProcessChannelEvent(void* context, void* arg; uint32_t bytes_to_read; hv_vmbus_channel* channel = (hv_vmbus_channel*)context; - boolean_t is_batched_reading; + bool is_batched_reading = false; + + if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + is_batched_reading = true; if (channel->on_channel_callback != NULL) { arg = channel->channel_callback_context; - is_batched_reading = channel->batched_reading; /* * Optimize host to guest signaling by ensuring: * 1. While reading the channel, we disable interrupts from @@ -917,7 +919,7 @@ vmbus_event_flags_proc(struct vmbus_soft if (channel == NULL || channel->rxq == NULL) continue; - if (channel->batched_reading) + if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) hv_ring_buffer_read_begin(&channel->inbound); taskqueue_enqueue(channel->rxq, &channel->channel_task); } Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 08:45:53 2016 (r307307) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 08:55:49 2016 (r307308) @@ -282,21 +282,19 @@ vmbus_channel_on_offer_internal(struct v { hv_vmbus_channel* new_channel; - /* Allocate the channel object and save this offer */ + /* + * Allocate the channel object and save this offer + */ new_channel = hv_vmbus_allocate_channel(sc); new_channel->ch_id = offer->child_rel_id; new_channel->ch_subidx = offer->offer.sub_channel_index; - if (offer->monitor_allocated) - new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; new_channel->ch_guid_type = offer->offer.interface_type; new_channel->ch_guid_inst = offer->offer.interface_instance; - /* - * By default we setup state to enable batched - * reading. A specific service can choose to - * disable this prior to opening the channel. - */ - new_channel->batched_reading = TRUE; + /* Batch reading is on by default */ + new_channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; + if (offer->monitor_allocated) + new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; new_channel->ch_sigevt = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), @@ -310,12 +308,8 @@ vmbus_channel_on_offer_internal(struct v return; } new_channel->ch_sigevt->hc_connid = VMBUS_CONNID_EVENT; - - if (sc->vmbus_version != VMBUS_VERSION_WS2008) { - new_channel->is_dedicated_interrupt = - (offer->is_dedicated_interrupt != 0); + if (sc->vmbus_version != VMBUS_VERSION_WS2008) new_channel->ch_sigevt->hc_connid = offer->connection_id; - } new_channel->monitor_group = (uint8_t) offer->monitor_id / 32; new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32; Modified: stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Oct 14 08:45:53 2016 (r307307) +++ stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Oct 14 08:55:49 2016 (r307308) @@ -286,7 +286,6 @@ hv_vmbus_ring_buffer_init( ring_info->ring_buffer->read_index = ring_info->ring_buffer->write_index = 0; - ring_info->ring_size = buffer_len; ring_info->ring_data_size = buffer_len - sizeof(hv_vmbus_ring_buffer); mtx_init(&ring_info->ring_lock, "vmbus ring buffer", NULL, MTX_SPIN); From owner-svn-src-stable-11@freebsd.org Fri Oct 14 09:00:30 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AB0CC111FD; Fri, 14 Oct 2016 09:00:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33A62D6E; Fri, 14 Oct 2016 09:00:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E90TSb001912; Fri, 14 Oct 2016 09:00:29 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E90TXo001911; Fri, 14 Oct 2016 09:00:29 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140900.u9E90TXo001911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 09:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307309 - stable/11/sys/dev/hyperv/vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 09:00:30 -0000 Author: sephe Date: Fri Oct 14 09:00:29 2016 New Revision: 307309 URL: https://svnweb.freebsd.org/changeset/base/307309 Log: MFC 302710,302713 302710 hyperv/vmbus: Remove unnecessary callback check. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7046 302713 hyperv/vmbus: Install different task function for batch/non-batch channels This avoids bunch of unnecessary checks on hot path and simplifies the channel processing. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7085 Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 08:55:49 2016 (r307308) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 09:00:29 2016 (r307309) @@ -51,9 +51,10 @@ __FBSDID("$FreeBSD$"); #include static void vmbus_channel_set_event(hv_vmbus_channel* channel); -static void VmbusProcessChannelEvent(void* channel, int pending); static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); +static void vmbus_chan_task(void *, int); +static void vmbus_chan_task_nobatch(void *, int); /** * @brief Trigger an event notification on the specified channel @@ -213,7 +214,13 @@ hv_vmbus_channel_open( new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, new_channel->target_cpu); - TASK_INIT(&new_channel->channel_task, 0, VmbusProcessChannelEvent, new_channel); + if (new_channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) { + TASK_INIT(&new_channel->channel_task, 0, + vmbus_chan_task, new_channel); + } else { + TASK_INIT(&new_channel->channel_task, 0, + vmbus_chan_task_nobatch, new_channel); + } /* Allocate the ring buffer */ out = contigmalloc((send_ring_buffer_size + recv_ring_buffer_size), @@ -846,46 +853,48 @@ hv_vmbus_channel_recv_packet_raw( return (0); } - -/** - * Process a channel event notification - */ static void -VmbusProcessChannelEvent(void* context, int pending) +vmbus_chan_task(void *xchan, int pending __unused) { - void* arg; - uint32_t bytes_to_read; - hv_vmbus_channel* channel = (hv_vmbus_channel*)context; - bool is_batched_reading = false; + struct hv_vmbus_channel *chan = xchan; + void (*callback)(void *); + void *arg; + + arg = chan->channel_callback_context; + callback = chan->on_channel_callback; + + /* + * Optimize host to guest signaling by ensuring: + * 1. While reading the channel, we disable interrupts from + * host. + * 2. Ensure that we process all posted messages from the host + * before returning from this callback. + * 3. Once we return, enable signaling from the host. Once this + * state is set we check to see if additional packets are + * available to read. In this case we repeat the process. + * + * NOTE: Interrupt has been disabled in the ISR. + */ + for (;;) { + uint32_t left; - if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) - is_batched_reading = true; + callback(arg); - if (channel->on_channel_callback != NULL) { - arg = channel->channel_callback_context; - /* - * Optimize host to guest signaling by ensuring: - * 1. While reading the channel, we disable interrupts from - * host. - * 2. Ensure that we process all posted messages from the host - * before returning from this callback. - * 3. Once we return, enable signaling from the host. Once this - * state is set we check to see if additional packets are - * available to read. In this case we repeat the process. - */ - do { - if (is_batched_reading) - hv_ring_buffer_read_begin(&channel->inbound); + left = hv_ring_buffer_read_end(&chan->inbound); + if (left == 0) { + /* No more data in RX bufring; done */ + break; + } + hv_ring_buffer_read_begin(&chan->inbound); + } +} - channel->on_channel_callback(arg); +static void +vmbus_chan_task_nobatch(void *xchan, int pending __unused) +{ + struct hv_vmbus_channel *chan = xchan; - if (is_batched_reading) - bytes_to_read = - hv_ring_buffer_read_end(&channel->inbound); - else - bytes_to_read = 0; - } while (is_batched_reading && (bytes_to_read != 0)); - } + chan->on_channel_callback(chan->channel_callback_context); } static __inline void From owner-svn-src-stable-11@freebsd.org Fri Oct 14 09:10:43 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60152C11580; Fri, 14 Oct 2016 09:10:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B3B27CA; Fri, 14 Oct 2016 09:10:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E9Aglj006371; Fri, 14 Oct 2016 09:10:42 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E9AfZg006362; Fri, 14 Oct 2016 09:10:41 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610140910.u9E9AfZg006362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 14 Oct 2016 09:10:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307310 - in stable/11/sys/dev/hyperv: include vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 09:10:43 -0000 Author: sephe Date: Fri Oct 14 09:10:41 2016 New Revision: 307310 URL: https://svnweb.freebsd.org/changeset/base/307310 Log: MFC 302723,302726,302731 302723 hyperv: All Hypercall parameters have same alignment requirement. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7086 302726 hyperv: Signal event input parameter is shared w/ MNF Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7087 302731 hyperv/vmbus: Reorganize MNF event sending. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7088 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hyperv.c stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h stable/11/sys/dev/hyperv/vmbus/hyperv_var.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 09:00:29 2016 (r307309) +++ stable/11/sys/dev/hyperv/include/hyperv.h Fri Oct 14 09:10:41 2016 (r307310) @@ -523,12 +523,13 @@ typedef struct hv_vmbus_channel { hv_vmbus_channel_state state; uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ uint32_t ch_id; /* channel id */ + /* * These are based on the offer_msg.monitor_id. * Save it here for easy access. */ - uint8_t monitor_group; - uint8_t monitor_bit; + int ch_montrig_idx; /* MNF trig index */ + uint32_t ch_montrig_mask;/* MNF trig mask */ uint32_t ring_buffer_gpadl_handle; /* @@ -551,8 +552,8 @@ typedef struct hv_vmbus_channel { hv_vmbus_pfn_channel_callback on_channel_callback; void* channel_callback_context; - struct hypercall_sigevt_in *ch_sigevt; - struct hyperv_dma ch_sigevt_dma; + struct hyperv_mon_param *ch_monprm; + struct hyperv_dma ch_monprm_dma; /* * From Win8, this field specifies the target virtual process Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 09:00:29 2016 (r307309) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Fri Oct 14 09:10:41 2016 (r307310) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -static void vmbus_channel_set_event(hv_vmbus_channel* channel); +static void vmbus_chan_send_event(hv_vmbus_channel* channel); static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); static void vmbus_chan_task(void *, int); @@ -60,7 +60,7 @@ static void vmbus_chan_task_nobatch(void * @brief Trigger an event notification on the specified channel */ static void -vmbus_channel_set_event(hv_vmbus_channel *channel) +vmbus_chan_send_event(hv_vmbus_channel *channel) { struct vmbus_softc *sc = channel->vmbus_sc; uint32_t chanid = channel->ch_id; @@ -69,16 +69,12 @@ vmbus_channel_set_event(hv_vmbus_channel 1UL << (chanid & VMBUS_EVTFLAG_MASK)); if (channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { - hv_vmbus_monitor_page *monitor_page; - - monitor_page = sc->vmbus_mnf2; - synch_set_bit(channel->monitor_bit, - (uint32_t *)&monitor_page-> - trigger_group[channel->monitor_group].u.pending); + atomic_set_int( + &sc->vmbus_mnf2->mnf_trigs[channel->ch_montrig_idx].mt_pending, + channel->ch_montrig_mask); } else { - hypercall_signal_event(channel->ch_sigevt_dma.hv_paddr); + hypercall_signal_event(channel->ch_monprm_dma.hv_paddr); } - } static int @@ -622,9 +618,8 @@ hv_vmbus_channel_send_packet( &need_sig); /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) { - vmbus_channel_set_event(channel); - } + if (ret == 0 && need_sig) + vmbus_chan_send_event(channel); return (ret); } @@ -690,9 +685,8 @@ hv_vmbus_channel_send_packet_pagebuffer( &need_sig); /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) { - vmbus_channel_set_event(channel); - } + if (ret == 0 && need_sig) + vmbus_chan_send_event(channel); return (ret); } @@ -766,9 +760,8 @@ hv_vmbus_channel_send_packet_multipagebu &need_sig); /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) { - vmbus_channel_set_event(channel); - } + if (ret == 0 && need_sig) + vmbus_chan_send_event(channel); return (ret); } Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 09:00:29 2016 (r307309) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Oct 14 09:10:41 2016 (r307310) @@ -296,23 +296,29 @@ vmbus_channel_on_offer_internal(struct v if (offer->monitor_allocated) new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; - new_channel->ch_sigevt = hyperv_dmamem_alloc( + new_channel->ch_monprm = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), - HYPERCALL_SIGEVTIN_ALIGN, 0, sizeof(struct hypercall_sigevt_in), - &new_channel->ch_sigevt_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); - if (new_channel->ch_sigevt == NULL) { - device_printf(sc->vmbus_dev, "sigevt alloc failed\n"); + HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), + &new_channel->ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (new_channel->ch_monprm == NULL) { + device_printf(sc->vmbus_dev, "monprm alloc failed\n"); /* XXX */ mtx_destroy(&new_channel->sc_lock); free(new_channel, M_DEVBUF); return; } - new_channel->ch_sigevt->hc_connid = VMBUS_CONNID_EVENT; + new_channel->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; if (sc->vmbus_version != VMBUS_VERSION_WS2008) - new_channel->ch_sigevt->hc_connid = offer->connection_id; + new_channel->ch_monprm->mp_connid = offer->connection_id; - new_channel->monitor_group = (uint8_t) offer->monitor_id / 32; - new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32; + if (new_channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { + new_channel->ch_montrig_idx = + offer->monitor_id / VMBUS_MONTRIG_LEN; + if (new_channel->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) + panic("invalid monitor id %u", offer->monitor_id); + new_channel->ch_montrig_mask = + 1 << (offer->monitor_id % VMBUS_MONTRIG_LEN); + } /* Select default cpu for this channel. */ vmbus_channel_select_defcpu(new_channel); Modified: stable/11/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv.c Fri Oct 14 09:00:29 2016 (r307309) +++ stable/11/sys/dev/hyperv/vmbus/hyperv.c Fri Oct 14 09:10:41 2016 (r307310) @@ -109,10 +109,10 @@ hypercall_post_message(bus_addr_t msg_pa } uint64_t -hypercall_signal_event(bus_addr_t sigevt_paddr) +hypercall_signal_event(bus_addr_t monprm_paddr) { return hypercall_md(hypercall_context.hc_addr, - HYPERCALL_SIGNAL_EVENT, sigevt_paddr, 0); + HYPERCALL_SIGNAL_EVENT, monprm_paddr, 0); } int Modified: stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h Fri Oct 14 09:00:29 2016 (r307309) +++ stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h Fri Oct 14 09:10:41 2016 (r307310) @@ -133,6 +133,15 @@ #define CPUID_LEAF_HV_HWFEATURES 0x40000006 /* + * Hyper-V Monitor Notification Facility + */ +struct hyperv_mon_param { + uint32_t mp_connid; + uint16_t mp_evtflag_ofs; + uint16_t mp_rsvd; +} __packed; + +/* * Hyper-V message types */ #define HYPERV_MSGTYPE_NONE 0 @@ -153,13 +162,22 @@ /* * Hypercall input parameters */ +#define HYPERCALL_PARAM_ALIGN 8 +#if 0 +/* + * XXX + * <> requires + * input parameters size to be multiple of 8, however, many post + * message input parameters do _not_ meet this requirement. + */ +#define HYPERCALL_PARAM_SIZE_ALIGN 8 +#endif /* * HYPERCALL_POST_MESSAGE */ #define HYPERCALL_POSTMSGIN_DSIZE_MAX 240 #define HYPERCALL_POSTMSGIN_SIZE 256 -#define HYPERCALL_POSTMSGIN_ALIGN 8 struct hypercall_postmsg_in { uint32_t hc_connid; @@ -172,13 +190,8 @@ CTASSERT(sizeof(struct hypercall_postmsg /* * HYPERCALL_SIGNAL_EVENT + * + * struct hyperv_mon_param. */ -#define HYPERCALL_SIGEVTIN_ALIGN 8 - -struct hypercall_sigevt_in { - uint32_t hc_connid; - uint16_t hc_evtflag_ofs; - uint16_t hc_rsvd; -} __packed; #endif /* !_HYPERV_REG_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/hyperv_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv_var.h Fri Oct 14 09:00:29 2016 (r307309) +++ stable/11/sys/dev/hyperv/vmbus/hyperv_var.h Fri Oct 14 09:10:41 2016 (r307310) @@ -39,6 +39,6 @@ extern u_int hyperv_features; extern u_int hyperv_recommends; uint64_t hypercall_post_message(bus_addr_t msg_paddr); -uint64_t hypercall_signal_event(bus_addr_t sigevt_paddr); +uint64_t hypercall_signal_event(bus_addr_t monprm_paddr); #endif /* !_HYPERV_VAR_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 09:00:29 2016 (r307309) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Fri Oct 14 09:10:41 2016 (r307310) @@ -130,7 +130,7 @@ vmbus_msghc_alloc(bus_dma_tag_t parent_d mh = malloc(sizeof(*mh), M_DEVBUF, M_WAITOK | M_ZERO); mh->mh_inprm = hyperv_dmamem_alloc(parent_dtag, - HYPERCALL_POSTMSGIN_ALIGN, 0, HYPERCALL_POSTMSGIN_SIZE, + HYPERCALL_PARAM_ALIGN, 0, HYPERCALL_POSTMSGIN_SIZE, &mh->mh_inprm_dma, BUS_DMA_WAITOK); if (mh->mh_inprm == NULL) { free(mh, M_DEVBUF); @@ -835,7 +835,8 @@ vmbus_dma_alloc(struct vmbus_softc *sc) return ENOMEM; sc->vmbus_mnf2 = hyperv_dmamem_alloc(parent_dtag, PAGE_SIZE, 0, - PAGE_SIZE, &sc->vmbus_mnf2_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + sizeof(struct vmbus_mnf), &sc->vmbus_mnf2_dma, + BUS_DMA_WAITOK | BUS_DMA_ZERO); if (sc->vmbus_mnf2 == NULL) return ENOMEM; Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Oct 14 09:00:29 2016 (r307309) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Oct 14 09:10:41 2016 (r307310) @@ -72,6 +72,34 @@ struct vmbus_evtflags { CTASSERT(sizeof(struct vmbus_evtflags) == VMBUS_EVTFLAGS_SIZE); /* + * Hyper-V Monitor Notification Facility + */ + +struct vmbus_mon_trig { + uint32_t mt_pending; + uint32_t mt_armed; +} __packed; + +#define VMBUS_MONTRIGS_MAX 4 +#define VMBUS_MONTRIG_LEN 32 + +struct vmbus_mnf { + uint32_t mnf_state; + uint32_t mnf_rsvd1; + + struct vmbus_mon_trig mnf_trigs[VMBUS_MONTRIGS_MAX]; + uint8_t mnf_rsvd2[536]; + + uint16_t mnf_lat[VMBUS_MONTRIGS_MAX][VMBUS_MONTRIG_LEN]; + uint8_t mnf_rsvd3[256]; + + struct hyperv_mon_param + mnf_param[VMBUS_MONTRIGS_MAX][VMBUS_MONTRIG_LEN]; + uint8_t mnf_rsvd4[1984]; +} __packed; +CTASSERT(sizeof(struct vmbus_mnf) == PAGE_SIZE); + +/* * Channel */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Fri Oct 14 09:00:29 2016 (r307309) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Fri Oct 14 09:10:41 2016 (r307310) @@ -71,7 +71,7 @@ struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); u_long *vmbus_tx_evtflags; /* event flags to host */ - void *vmbus_mnf2; /* monitored by host */ + struct vmbus_mnf *vmbus_mnf2; /* monitored by host */ u_long *vmbus_rx_evtflags; /* compat evtflgs from host */ From owner-svn-src-stable-11@freebsd.org Fri Oct 14 09:29:01 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2743BC11C3E; Fri, 14 Oct 2016 09:29:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9370373; Fri, 14 Oct 2016 09:29:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E9T0dx012936; Fri, 14 Oct 2016 09:29:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E9T0Ew012935; Fri, 14 Oct 2016 09:29:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610140929.u9E9T0Ew012935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 14 Oct 2016 09:29:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307311 - stable/11/lib/libc/gen X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 09:29:01 -0000 Author: kib Date: Fri Oct 14 09:28:59 2016 New Revision: 307311 URL: https://svnweb.freebsd.org/changeset/base/307311 Log: MFC r307036: Fill msg_len for the initial element of msgvec. Modified: stable/11/lib/libc/gen/recvmmsg.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/recvmmsg.c ============================================================================== --- stable/11/lib/libc/gen/recvmmsg.c Fri Oct 14 09:10:41 2016 (r307310) +++ stable/11/lib/libc/gen/recvmmsg.c Fri Oct 14 09:28:59 2016 (r307311) @@ -69,6 +69,8 @@ recvmmsg(int s, struct mmsghdr *__restri if (ret == -1) return (ret); + msgvec[0].msg_len = ret; + /* * Do non-blocking receive for second and later messages if * WAITFORONE is set. From owner-svn-src-stable-11@freebsd.org Fri Oct 14 09:34:50 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F128AC11E14; Fri, 14 Oct 2016 09:34:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1F67A1A; Fri, 14 Oct 2016 09:34:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9E9Ym2c016877; Fri, 14 Oct 2016 09:34:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9E9Ymlc016876; Fri, 14 Oct 2016 09:34:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610140934.u9E9Ymlc016876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 14 Oct 2016 09:34:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307312 - stable/11/lib/libc/gen X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 09:34:50 -0000 Author: kib Date: Fri Oct 14 09:34:48 2016 New Revision: 307312 URL: https://svnweb.freebsd.org/changeset/base/307312 Log: MFC r307037: Correct indent. Modified: stable/11/lib/libc/gen/recvmmsg.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/recvmmsg.c ============================================================================== --- stable/11/lib/libc/gen/recvmmsg.c Fri Oct 14 09:28:59 2016 (r307311) +++ stable/11/lib/libc/gen/recvmmsg.c Fri Oct 14 09:34:48 2016 (r307312) @@ -83,10 +83,9 @@ recvmmsg(int s, struct mmsghdr *__restri ret = __sys_recvmsg(s, &msgvec[i].msg_hdr, flags); if (ret == -1) { /* We have received messages. Let caller know - * about the data received, socket - * error is returned on next - * invocation. - */ + * about the data received, socket error is + * returned on next invocation. + */ return (rcvd); } From owner-svn-src-stable-11@freebsd.org Fri Oct 14 18:42:31 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA90BC12578; Fri, 14 Oct 2016 18:42:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5C2CA14; Fri, 14 Oct 2016 18:42:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9EIgUSU026429; Fri, 14 Oct 2016 18:42:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9EIgUvW026428; Fri, 14 Oct 2016 18:42:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610141842.u9EIgUvW026428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 14 Oct 2016 18:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307330 - stable/11/sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 18:42:32 -0000 Author: mav Date: Fri Oct 14 18:42:30 2016 New Revision: 307330 URL: https://svnweb.freebsd.org/changeset/base/307330 Log: Bump __FreeBSD_version for todays ZFS merges. Modified: stable/11/sys/sys/param.h Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Fri Oct 14 17:43:39 2016 (r307329) +++ stable/11/sys/sys/param.h Fri Oct 14 18:42:30 2016 (r307330) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100503 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100504 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-11@freebsd.org Sat Oct 15 07:28:48 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C529C1240C; Sat, 15 Oct 2016 07:28:48 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 358DD1CC; Sat, 15 Oct 2016 07:28:48 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9F7SlsP014603; Sat, 15 Oct 2016 07:28:47 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9F7SkNE014599; Sat, 15 Oct 2016 07:28:46 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201610150728.u9F7SkNE014599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 15 Oct 2016 07:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307340 - in stable/11: . share/man/man9 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 07:28:48 -0000 Author: avos Date: Sat Oct 15 07:28:46 2016 New Revision: 307340 URL: https://svnweb.freebsd.org/changeset/base/307340 Log: MFC r307000, r307001: mbuf(9), mbuf_tags(9): fix function prototypes. - Add m_getclr(9) symlink to ObsoleteFiles.inc (removed in r295481). - Add const qualifiers in m_dup(), m_dup_pkthdr() and m_tag_copy_chain() (r286450). - Fix m_dup_pkthdr() definition (it's not the same as m_move_pkthdr()). Modified: stable/11/ObsoleteFiles.inc stable/11/share/man/man9/Makefile stable/11/share/man/man9/mbuf.9 stable/11/share/man/man9/mbuf_tags.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Sat Oct 15 06:16:35 2016 (r307339) +++ stable/11/ObsoleteFiles.inc Sat Oct 15 07:28:46 2016 (r307340) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20161015: remove link to removed m_getclr(9) macro +OLD_FILES+=usr/share/man/man9/m_getclr.9.gz # 20160703: POSIXify locales with variants OLD_FILES+=usr/share/locale/zh_Hant_TW.UTF-8/LC_COLLATE OLD_FILES+=usr/share/locale/zh_Hant_TW.UTF-8/LC_CTYPE Modified: stable/11/share/man/man9/Makefile ============================================================================== --- stable/11/share/man/man9/Makefile Sat Oct 15 06:16:35 2016 (r307339) +++ stable/11/share/man/man9/Makefile Sat Oct 15 07:28:46 2016 (r307340) @@ -1089,7 +1089,6 @@ MLINKS+=\ mbuf.9 m_get2.9 \ mbuf.9 m_getjcl.9 \ mbuf.9 m_getcl.9 \ - mbuf.9 m_getclr.9 \ mbuf.9 MGETHDR.9 \ mbuf.9 m_gethdr.9 \ mbuf.9 m_getm.9 \ Modified: stable/11/share/man/man9/mbuf.9 ============================================================================== --- stable/11/share/man/man9/mbuf.9 Sat Oct 15 06:16:35 2016 (r307339) +++ stable/11/share/man/man9/mbuf.9 Sat Oct 15 07:28:46 2016 (r307340) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 29, 2016 +.Dd October 10, 2016 .Dt MBUF 9 .Os .\" @@ -79,8 +79,6 @@ .Ft struct mbuf * .Fn m_getcl "int how" "short type" "int flags" .Ft struct mbuf * -.Fn m_getclr "int how" "short type" -.Ft struct mbuf * .Fn m_gethdr "int how" "short type" .Ft struct mbuf * .Fn m_free "struct mbuf *mbuf" @@ -107,7 +105,7 @@ .Ft struct mbuf * .Fn m_copypacket "struct mbuf *mbuf" "int how" .Ft struct mbuf * -.Fn m_dup "struct mbuf *mbuf" "int how" +.Fn m_dup "const struct mbuf *mbuf" "int how" .Ft void .Fn m_copydata "const struct mbuf *mbuf" "int offset" "int len" "caddr_t buf" .Ft void @@ -126,8 +124,8 @@ .Fn m_catpkt "struct mbuf *m" "struct mbuf *n" .Ft u_int .Fn m_fixhdr "struct mbuf *mbuf" -.Ft void -.Fn m_dup_pkthdr "struct mbuf *to" "struct mbuf *from" +.Ft int +.Fn m_dup_pkthdr "struct mbuf *to" "const struct mbuf *from" "int how" .Ft void .Fn m_move_pkthdr "struct mbuf *to" "struct mbuf *from" .Ft u_int @@ -602,10 +600,6 @@ This is like but it the size of the cluster allocated will be large enough for .Fa size bytes. -.It Fn m_getclr how type -Allocate an -.Vt mbuf -and zero out the data region. .It Fn m_free mbuf Frees .Vt mbuf . Modified: stable/11/share/man/man9/mbuf_tags.9 ============================================================================== --- stable/11/share/man/man9/mbuf_tags.9 Sat Oct 15 06:16:35 2016 (r307339) +++ stable/11/share/man/man9/mbuf_tags.9 Sat Oct 15 07:28:46 2016 (r307340) @@ -33,7 +33,7 @@ .Ft "struct m_tag *" .Fn m_tag_copy "struct m_tag *t" "int how" .Ft int -.Fn m_tag_copy_chain "struct mbuf *to" "struct mbuf *from" "int how" +.Fn m_tag_copy_chain "struct mbuf *to" "const struct mbuf *from" "int how" .Ft void .Fn m_tag_delete "struct mbuf *m" "struct m_tag *t" .Ft void From owner-svn-src-stable-11@freebsd.org Sat Oct 15 07:30:14 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAF2BC124B2; Sat, 15 Oct 2016 07:30:14 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9AD5739F; Sat, 15 Oct 2016 07:30:14 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9F7UD8B014727; Sat, 15 Oct 2016 07:30:13 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9F7UDhm014726; Sat, 15 Oct 2016 07:30:13 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201610150730.u9F7UDhm014726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 15 Oct 2016 07:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307341 - stable/11/sys/arm/arm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 07:30:14 -0000 Author: mmel Date: Sat Oct 15 07:30:13 2016 New Revision: 307341 URL: https://svnweb.freebsd.org/changeset/base/307341 Log: MFC r306754: ARM: Remove unused variable. Not a functional change. Modified: stable/11/sys/arm/arm/locore-v6.S Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/locore-v6.S ============================================================================== --- stable/11/sys/arm/arm/locore-v6.S Sat Oct 15 07:28:46 2016 (r307340) +++ stable/11/sys/arm/arm/locore-v6.S Sat Oct 15 07:30:13 2016 (r307341) @@ -439,9 +439,6 @@ boot_pt1: .text .align 2 -.Lcpufuncs: - .word _C_LABEL(cpufuncs) - #if defined(SMP) ASENTRY_NP(mpentry) From owner-svn-src-stable-11@freebsd.org Sat Oct 15 07:38:28 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FEFCC1280A; Sat, 15 Oct 2016 07:38:28 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30B6EBB4; Sat, 15 Oct 2016 07:38:28 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9F7cRGo018409; Sat, 15 Oct 2016 07:38:27 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9F7cRX4018407; Sat, 15 Oct 2016 07:38:27 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201610150738.u9F7cRX4018407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 15 Oct 2016 07:38:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307342 - in stable/11/sys/arm: arm include X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 07:38:28 -0000 Author: mmel Date: Sat Oct 15 07:38:27 2016 New Revision: 307342 URL: https://svnweb.freebsd.org/changeset/base/307342 Log: MFC r306755: ARM: Add identifiers for ARM Cortex v8 and Marvell Sheeva v7 cores. Not a functional change. Modified: stable/11/sys/arm/arm/cpuinfo.c stable/11/sys/arm/include/cpuinfo.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/cpuinfo.c ============================================================================== --- stable/11/sys/arm/arm/cpuinfo.c Sat Oct 15 07:30:13 2016 (r307341) +++ stable/11/sys/arm/arm/cpuinfo.c Sat Oct 15 07:38:27 2016 (r307342) @@ -163,7 +163,11 @@ cpuinfo_get_actlr_modifier(uint32_t *act if (cpuinfo.implementer == CPU_IMPLEMENTER_ARM) { switch (cpuinfo.part_number) { - + case CPU_ARCH_CORTEX_A72: + case CPU_ARCH_CORTEX_A57: + case CPU_ARCH_CORTEX_A53: + /* Nothing to do for AArch32 */ + break; case CPU_ARCH_CORTEX_A17: case CPU_ARCH_CORTEX_A12: /* A12 is merged to A17 */ /* Modified: stable/11/sys/arm/include/cpuinfo.h ============================================================================== --- stable/11/sys/arm/include/cpuinfo.h Sat Oct 15 07:30:13 2016 (r307341) +++ stable/11/sys/arm/include/cpuinfo.h Sat Oct 15 07:38:27 2016 (r307342) @@ -45,10 +45,18 @@ #define CPU_ARCH_CORTEX_A12 0xC0D #define CPU_ARCH_CORTEX_A15 0xC0F #define CPU_ARCH_CORTEX_A17 0xC11 +#define CPU_ARCH_CORTEX_A53 0xD03 +#define CPU_ARCH_CORTEX_A57 0xD07 +#define CPU_ARCH_CORTEX_A72 0xD08 + /* QCOM */ #define CPU_ARCH_KRAIT_300 0x06F +/* MRVL */ +#define CPU_ARCH_SHEEVA_851 0x581 /* PJ4/PJ4B */ +#define CPU_ARCH_SHEEVA_584 0x584 /* PJ4B-MP/PJ4C */ + struct cpuinfo { /* raw id registers */ uint32_t midr; From owner-svn-src-stable-11@freebsd.org Sat Oct 15 08:27:57 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B747EC11859; Sat, 15 Oct 2016 08:27:57 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EAB77CE; Sat, 15 Oct 2016 08:27:57 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9F8RuPf037364; Sat, 15 Oct 2016 08:27:56 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9F8RtEa037349; Sat, 15 Oct 2016 08:27:55 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201610150827.u9F8RtEa037349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 15 Oct 2016 08:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307344 - in stable/11/sys/arm: allwinner altera/socfpga amlogic/aml8726 arm broadcom/bcm2835 freescale/imx include mv/armada38x nvidia/tegra124 rockchip samsung/exynos ti/omap4 xilinx X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 08:27:57 -0000 Author: mmel Date: Sat Oct 15 08:27:54 2016 New Revision: 307344 URL: https://svnweb.freebsd.org/changeset/base/307344 Log: MFC r306756: ARM: SEV/WFE instructions are implemented starting from ARMv6K, use it directly. Modified: stable/11/sys/arm/allwinner/aw_mp.c stable/11/sys/arm/altera/socfpga/socfpga_mp.c stable/11/sys/arm/amlogic/aml8726/aml8726_mp.c stable/11/sys/arm/arm/cpufunc_asm_armv7.S stable/11/sys/arm/arm/mp_machdep.c stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c stable/11/sys/arm/freescale/imx/imx6_mp.c stable/11/sys/arm/include/cpu-v6.h stable/11/sys/arm/include/cpufunc.h stable/11/sys/arm/mv/armada38x/pmsu.c stable/11/sys/arm/nvidia/tegra124/tegra124_mp.c stable/11/sys/arm/rockchip/rk30xx_mp.c stable/11/sys/arm/samsung/exynos/exynos5_mp.c stable/11/sys/arm/ti/omap4/omap4_mp.c stable/11/sys/arm/xilinx/zy7_mp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/aw_mp.c ============================================================================== --- stable/11/sys/arm/allwinner/aw_mp.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/allwinner/aw_mp.c Sat Oct 15 08:27:54 2016 (r307344) @@ -193,7 +193,8 @@ aw_mp_start_ap(platform_t plat) val |= (1 << i); bus_space_write_4(fdtbus_bs_tag, cpucfg, CPUCFG_DBGCTL1, val); - armv7_sev(); + dsb(); + sev(); bus_space_unmap(fdtbus_bs_tag, cpucfg, CPUCFG_SIZE); if (soc_family != ALLWINNERSOC_SUN7I) bus_space_unmap(fdtbus_bs_tag, prcm, PRCM_SIZE); @@ -279,7 +280,8 @@ a83t_mp_start_ap(platform_t plat) panic("Couldn't map the PRCM\n"); aw_mc_mp_start_ap(cpuscfg, cpuxcfg, prcm); - armv7_sev(); + dsb(); + sev(); bus_space_unmap(fdtbus_bs_tag, cpuxcfg, CPUXCFG_SIZE); bus_space_unmap(fdtbus_bs_tag, cpuscfg, CPUCFG_SIZE); bus_space_unmap(fdtbus_bs_tag, prcm, PRCM_SIZE); Modified: stable/11/sys/arm/altera/socfpga/socfpga_mp.c ============================================================================== --- stable/11/sys/arm/altera/socfpga/socfpga_mp.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/altera/socfpga/socfpga_mp.c Sat Oct 15 08:27:54 2016 (r307344) @@ -151,7 +151,8 @@ platform_mp_start_ap(void) /* Put CPU1 out from reset */ bus_space_write_4(fdtbus_bs_tag, rst, MPUMODRST, 0); - armv7_sev(); + dsb(); + sev(); bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE); bus_space_unmap(fdtbus_bs_tag, rst, RSTMGR_SIZE); Modified: stable/11/sys/arm/amlogic/aml8726/aml8726_mp.c ============================================================================== --- stable/11/sys/arm/amlogic/aml8726/aml8726_mp.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/amlogic/aml8726/aml8726_mp.c Sat Oct 15 08:27:54 2016 (r307344) @@ -487,7 +487,8 @@ platform_mp_start_ap(void) CPUCONF_BARRIER(AML_CPUCONF_CONTROL_REG); /* Wakeup the now enabled APs */ - armv7_sev(); + dsb(); + sev(); /* * Free the resources which are not needed after startup. Modified: stable/11/sys/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- stable/11/sys/arm/arm/cpufunc_asm_armv7.S Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/arm/cpufunc_asm_armv7.S Sat Oct 15 08:27:54 2016 (r307344) @@ -297,13 +297,6 @@ ENTRY(armv7_drain_writebuf) RET END(armv7_drain_writebuf) -ENTRY(armv7_sev) - dsb - sev - nop - RET -END(armv7_sev) - ENTRY(armv7_auxctrl) mrc CP15_ACTLR(r2) bic r3, r2, r0 /* Clear bits */ Modified: stable/11/sys/arm/arm/mp_machdep.c ============================================================================== --- stable/11/sys/arm/arm/mp_machdep.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/arm/mp_machdep.c Sat Oct 15 08:27:54 2016 (r307344) @@ -467,9 +467,8 @@ release_aps(void *dummy __unused) #endif atomic_store_rel_int(&aps_ready, 1); /* Wake the other threads up */ -#if __ARM_ARCH >= 7 - armv7_sev(); -#endif + dsb(); + sev(); printf("Release APs\n"); Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c Sat Oct 15 08:27:54 2016 (r307344) @@ -132,7 +132,8 @@ platform_mp_start_ap(void) } while (1); /* dsb and sev */ - armv7_sev(); + dsb(); + sev(); /* recode AP in CPU map */ CPU_SET(i, &all_cpus); Modified: stable/11/sys/arm/freescale/imx/imx6_mp.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_mp.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/freescale/imx/imx6_mp.c Sat Oct 15 08:27:54 2016 (r307344) @@ -150,7 +150,8 @@ platform_mp_start_ap(void) } bus_space_write_4(fdtbus_bs_tag, src, SRC_CONTROL_REG, val); - armv7_sev(); + dsb(); + sev(); bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE); bus_space_unmap(fdtbus_bs_tag, src, SRC_SIZE); Modified: stable/11/sys/arm/include/cpu-v6.h ============================================================================== --- stable/11/sys/arm/include/cpu-v6.h Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/include/cpu-v6.h Sat Oct 15 08:27:54 2016 (r307344) @@ -56,6 +56,8 @@ extern uint32_t ccnt_hi[MAXCPU]; extern int pmu_attched; #endif /* DEV_PMU */ +#define sev() __asm __volatile("sev" : : : "memory") +#define wfe() __asm __volatile("wfe" : : : "memory") /* * Macros to generate CP15 (system control processor) read/write functions. Modified: stable/11/sys/arm/include/cpufunc.h ============================================================================== --- stable/11/sys/arm/include/cpufunc.h Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/include/cpufunc.h Sat Oct 15 08:27:54 2016 (r307344) @@ -289,7 +289,6 @@ void armv7_cpu_sleep (int); void armv7_setup (void); void armv7_context_switch (void); void armv7_drain_writebuf (void); -void armv7_sev (void); u_int armv7_auxctrl (u_int, u_int); void armadaxp_idcache_wbinv_all (void); Modified: stable/11/sys/arm/mv/armada38x/pmsu.c ============================================================================== --- stable/11/sys/arm/mv/armada38x/pmsu.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/mv/armada38x/pmsu.c Sat Oct 15 08:27:54 2016 (r307344) @@ -146,7 +146,8 @@ pmsu_boot_secondary_cpu(void) pmap_kextract((vm_offset_t)mpentry)); dcache_wbinv_poc_all(); - armv7_sev(); + dsb(); + sev(); bus_space_unmap(fdtbus_bs_tag, vaddr, MV_PMSU_REGS_LEN); Modified: stable/11/sys/arm/nvidia/tegra124/tegra124_mp.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra124/tegra124_mp.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/nvidia/tegra124/tegra124_mp.c Sat Oct 15 08:27:54 2016 (r307344) @@ -121,7 +121,8 @@ tegra124_mp_start_ap(platform_t plat) } } - armv7_sev(); + dsb(); + sev(); bus_space_unmap(fdtbus_bs_tag, pmc, PMC_SIZE); bus_space_unmap(fdtbus_bs_tag, exvec, TEGRA_EXCEPTION_VECTORS_SIZE); } Modified: stable/11/sys/arm/rockchip/rk30xx_mp.c ============================================================================== --- stable/11/sys/arm/rockchip/rk30xx_mp.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/rockchip/rk30xx_mp.c Sat Oct 15 08:27:54 2016 (r307344) @@ -163,7 +163,8 @@ platform_mp_start_ap(void) val &= ~(1 << i); bus_space_write_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON, val); - armv7_sev(); + dsb(); + sev(); bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE); bus_space_unmap(fdtbus_bs_tag, imem, IMEM_SIZE); Modified: stable/11/sys/arm/samsung/exynos/exynos5_mp.c ============================================================================== --- stable/11/sys/arm/samsung/exynos/exynos5_mp.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/samsung/exynos/exynos5_mp.c Sat Oct 15 08:27:54 2016 (r307344) @@ -124,7 +124,8 @@ platform_mp_start_ap(void) dcache_wbinv_poc_all(); - armv7_sev(); + dsb(); + sev(); bus_space_unmap(fdtbus_bs_tag, sysram, 0x100); bus_space_unmap(fdtbus_bs_tag, pmu, 0x20000); } Modified: stable/11/sys/arm/ti/omap4/omap4_mp.c ============================================================================== --- stable/11/sys/arm/ti/omap4/omap4_mp.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/ti/omap4/omap4_mp.c Sat Oct 15 08:27:54 2016 (r307344) @@ -64,6 +64,7 @@ platform_mp_start_ap(void) ti_smc0(0x200, 0xfffffdff, MODIFY_AUX_CORE_0); ti_smc0(pmap_kextract((vm_offset_t)mpentry), 0, WRITE_AUX_CORE_1); - armv7_sev(); + dsb(); + sev(); bus_space_unmap(fdtbus_bs_tag, scu_addr, 0x1000); } Modified: stable/11/sys/arm/xilinx/zy7_mp.c ============================================================================== --- stable/11/sys/arm/xilinx/zy7_mp.c Sat Oct 15 08:09:55 2016 (r307343) +++ stable/11/sys/arm/xilinx/zy7_mp.c Sat Oct 15 08:27:54 2016 (r307344) @@ -94,5 +94,6 @@ platform_mp_start_ap(void) dcache_wbinv_poc_all(); /* Wake up CPU1. */ - armv7_sev(); + dsb(); + sev(); } From owner-svn-src-stable-11@freebsd.org Sat Oct 15 08:31:48 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44F15C11A17; Sat, 15 Oct 2016 08:31:48 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1375AAB7; Sat, 15 Oct 2016 08:31:48 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9F8Vloh039572; Sat, 15 Oct 2016 08:31:47 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9F8VlAm039571; Sat, 15 Oct 2016 08:31:47 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201610150831.u9F8VlAm039571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 15 Oct 2016 08:31:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307345 - stable/11/sys/arm/arm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 08:31:48 -0000 Author: mmel Date: Sat Oct 15 08:31:46 2016 New Revision: 307345 URL: https://svnweb.freebsd.org/changeset/base/307345 Log: MFC r306759: ARM: Remove ARMv4 #defines from busdma_machdep-v6.c, it's ARMv6 specific file. Consistently use BUSDMA_DCACHE_ALIGN for cache line alignment. Modified: stable/11/sys/arm/arm/busdma_machdep-v6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- stable/11/sys/arm/arm/busdma_machdep-v6.c Sat Oct 15 08:27:54 2016 (r307344) +++ stable/11/sys/arm/arm/busdma_machdep-v6.c Sat Oct 15 08:31:46 2016 (r307345) @@ -61,13 +61,8 @@ __FBSDID("$FreeBSD$"); #include #include -#if __ARM_ARCH < 6 -#define BUSDMA_DCACHE_ALIGN arm_dcache_align -#define BUSDMA_DCACHE_MASK arm_dcache_align_mask -#else #define BUSDMA_DCACHE_ALIGN cpuinfo.dcache_line_size #define BUSDMA_DCACHE_MASK cpuinfo.dcache_line_mask -#endif #define MAX_BPAGES 64 #define MAX_DMA_SEGMENTS 4096 @@ -340,7 +335,7 @@ cacheline_bounce(bus_dmamap_t map, bus_a if (map->flags & (DMAMAP_DMAMEM_ALLOC | DMAMAP_COHERENT | DMAMAP_MBUF)) return (0); - return ((addr | size) & arm_dcache_align_mask); + return ((addr | size) & BUSDMA_DCACHE_MASK); } /* From owner-svn-src-stable-11@freebsd.org Sat Oct 15 08:52:43 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C70E0C12CFE; Sat, 15 Oct 2016 08:52:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C278BF3; Sat, 15 Oct 2016 08:52:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9F8qgTk048214; Sat, 15 Oct 2016 08:52:42 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9F8qgeR048213; Sat, 15 Oct 2016 08:52:42 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201610150852.u9F8qgeR048213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 15 Oct 2016 08:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307346 - stable/11/sys/dev/ofw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 08:52:43 -0000 Author: mmel Date: Sat Oct 15 08:52:42 2016 New Revision: 307346 URL: https://svnweb.freebsd.org/changeset/base/307346 Log: MFC r302560: OFWPCI: Fix style(9). No functional change. Modified: stable/11/sys/dev/ofw/ofwpci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ofw/ofwpci.c ============================================================================== --- stable/11/sys/dev/ofw/ofwpci.c Sat Oct 15 08:31:46 2016 (r307345) +++ stable/11/sys/dev/ofw/ofwpci.c Sat Oct 15 08:52:42 2016 (r307346) @@ -195,7 +195,7 @@ ofw_pci_init(device_t dev) sc->sc_io_rman.rm_type = RMAN_ARRAY; sc->sc_io_rman.rm_descr = "PCI I/O Ports"; error = rman_init(&sc->sc_io_rman); - if (error) { + if (error != 0) { device_printf(dev, "rman_init() failed. error = %d\n", error); goto out; } @@ -203,7 +203,7 @@ ofw_pci_init(device_t dev) sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "PCI Memory"; error = rman_init(&sc->sc_mem_rman); - if (error) { + if (error != 0) { device_printf(dev, "rman_init() failed. error = %d\n", error); goto out; } @@ -226,7 +226,7 @@ ofw_pci_init(device_t dev) break; } - if (error) { + if (error != 0) { device_printf(dev, "rman_manage_region(%x, %#jx, %#jx) failed. " "error = %d\n", rp->pci_hi & @@ -257,7 +257,7 @@ ofw_pci_attach(device_t dev) sc = device_get_softc(dev); if (!sc->sc_initialized) { error = ofw_pci_init(dev); - if (error) + if (error != 0) return (error); } @@ -437,9 +437,11 @@ ofw_pci_release_resource(device_t bus, d { if (rman_get_flags(res) & RF_ACTIVE) { - int error = bus_deactivate_resource(child, type, rid, res); - if (error) - return error; + int error; + + error = bus_deactivate_resource(child, type, rid, res); + if (error != 0) + return (error); } return (rman_release_resource(res)); @@ -544,9 +546,10 @@ static int ofw_pci_adjust_resource(device_t bus, device_t child, int type, struct resource *res, rman_res_t start, rman_res_t end) { - struct rman *rm = NULL; - struct ofw_pci_softc *sc = device_get_softc(bus); + struct rman *rm; + struct ofw_pci_softc *sc; + sc = device_get_softc(bus); KASSERT(!(rman_get_flags(res) & RF_ACTIVE), ("active resources cannot be adjusted")); if (rman_get_flags(res) & RF_ACTIVE) From owner-svn-src-stable-11@freebsd.org Sat Oct 15 09:09:27 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46D3FC123D3; Sat, 15 Oct 2016 09:09:27 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0899422D; Sat, 15 Oct 2016 09:09:26 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9F99QMd052458; Sat, 15 Oct 2016 09:09:26 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9F99Qvi052455; Sat, 15 Oct 2016 09:09:26 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201610150909.u9F99Qvi052455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 15 Oct 2016 09:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307347 - stable/11/sys/dev/ofw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 09:09:27 -0000 Author: mmel Date: Sat Oct 15 09:09:25 2016 New Revision: 307347 URL: https://svnweb.freebsd.org/changeset/base/307347 Log: MFC r302951,r302952,r304071: r302951: OFWPCI: Improve resource handling. - add new rman for prefetchable memory. Is used only if given 'ranges' property contains prefetchable memory range. r302952: OFWPCI: Add support for NEW_PCIB. r304071: OFWPCI: Don't strip RF_ACTIVE from flags when parent bus method is called. Modified: stable/11/sys/dev/ofw/ofwpci.c stable/11/sys/dev/ofw/ofwpci.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ofw/ofwpci.c ============================================================================== --- stable/11/sys/dev/ofw/ofwpci.c Sat Oct 15 08:52:42 2016 (r307346) +++ stable/11/sys/dev/ofw/ofwpci.c Sat Oct 15 09:09:25 2016 (r307347) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -94,6 +95,7 @@ static phandle_t ofw_pci_get_node(device * local methods */ static int ofw_pci_fill_ranges(phandle_t, struct ofw_pci_range *); +static struct rman *ofw_pci_get_rman(struct ofw_pci_softc *, int, u_int); /* * Driver methods. @@ -137,13 +139,14 @@ ofw_pci_init(device_t dev) phandle_t node; u_int32_t busrange[2]; struct ofw_pci_range *rp; - int error; + int i, error; struct ofw_pci_cell_info *cell_info; node = ofw_bus_get_node(dev); sc = device_get_softc(dev); sc->sc_initialized = 1; sc->sc_range = NULL; + sc->sc_pci_domain = device_get_unit(dev); cell_info = (struct ofw_pci_cell_info *)malloc(sizeof(*cell_info), M_DEVBUF, M_WAITOK | M_ZERO); @@ -201,17 +204,27 @@ ofw_pci_init(device_t dev) } sc->sc_mem_rman.rm_type = RMAN_ARRAY; - sc->sc_mem_rman.rm_descr = "PCI Memory"; + sc->sc_mem_rman.rm_descr = "PCI Non Prefetchable Memory"; error = rman_init(&sc->sc_mem_rman); if (error != 0) { device_printf(dev, "rman_init() failed. error = %d\n", error); goto out; } - for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && - rp->pci_hi != 0; rp++) { + sc->sc_pmem_rman.rm_type = RMAN_ARRAY; + sc->sc_pmem_rman.rm_descr = "PCI Prefetchable Memory"; + error = rman_init(&sc->sc_pmem_rman); + if (error != 0) { + device_printf(dev, "rman_init() failed. error = %d\n", error); + goto out; + } + + for (i = 0; i < sc->sc_nrange; i++) { error = 0; + rp = sc->sc_range + i; + if (sc->sc_range_mask & ((uint64_t)1 << i)) + continue; switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { case OFW_PCI_PHYS_HI_SPACE_CONFIG: break; @@ -221,8 +234,14 @@ ofw_pci_init(device_t dev) break; case OFW_PCI_PHYS_HI_SPACE_MEM32: case OFW_PCI_PHYS_HI_SPACE_MEM64: - error = rman_manage_region(&sc->sc_mem_rman, rp->pci, - rp->pci + rp->size - 1); + if (rp->pci_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) { + sc->sc_have_pmem = 1; + error = rman_manage_region(&sc->sc_pmem_rman, + rp->pci, rp->pci + rp->size - 1); + } else { + error = rman_manage_region(&sc->sc_mem_rman, + rp->pci, rp->pci + rp->size - 1); + } break; } @@ -244,6 +263,7 @@ out: free(sc->sc_range, M_DEVBUF); rman_fini(&sc->sc_io_rman); rman_fini(&sc->sc_mem_rman); + rman_fini(&sc->sc_pmem_rman); return (error); } @@ -318,7 +338,7 @@ ofw_pci_read_ivar(device_t dev, device_t switch (which) { case PCIB_IVAR_DOMAIN: - *result = device_get_unit(dev); + *result = sc->sc_pci_domain; return (0); case PCIB_IVAR_BUS: *result = sc->sc_bus; @@ -385,28 +405,23 @@ ofw_pci_alloc_resource(device_t bus, dev struct rman *rm; int needactivate; + needactivate = flags & RF_ACTIVE; flags &= ~RF_ACTIVE; sc = device_get_softc(bus); - switch (type) { - case SYS_RES_MEMORY: - rm = &sc->sc_mem_rman; - break; - - case SYS_RES_IOPORT: - rm = &sc->sc_io_rman; - break; - - case SYS_RES_IRQ: - return (bus_alloc_resource(bus, type, rid, start, end, count, - flags)); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) { + return (pci_domain_alloc_bus(sc->sc_pci_domain, child, rid, + start, end, count, flags | needactivate)); + } +#endif - default: - device_printf(bus, "unknown resource request from %s\n", - device_get_nameunit(child)); - return (NULL); + rm = ofw_pci_get_rman(sc, type, flags); + if (rm == NULL) { + return (bus_generic_alloc_resource(bus, child, type, rid, + start, end, count, flags | needactivate)); } rv = rman_reserve_resource(rm, start, end, count, flags, child); @@ -435,15 +450,30 @@ static int ofw_pci_release_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { + struct ofw_pci_softc *sc; + struct rman *rm; + int error; - if (rman_get_flags(res) & RF_ACTIVE) { - int error; + sc = device_get_softc(bus); + +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) + return (pci_domain_release_bus(sc->sc_pci_domain, child, rid, + res)); +#endif + rm = ofw_pci_get_rman(sc, type, rman_get_flags(res)); + if (rm == NULL) { + return (bus_generic_release_resource(bus, child, type, rid, + res)); + } + KASSERT(rman_is_region_manager(res, rm), ("rman mismatch")); + + if (rman_get_flags(res) & RF_ACTIVE) { error = bus_deactivate_resource(child, type, rid, res); if (error != 0) return (error); } - return (rman_release_resource(res)); } @@ -454,63 +484,62 @@ ofw_pci_activate_resource(device_t bus, struct ofw_pci_softc *sc; bus_space_handle_t handle; bus_space_tag_t tag; + struct ofw_pci_range *rp; + vm_paddr_t start; + int space; int rv; sc = device_get_softc(bus); - if (type == SYS_RES_IRQ) { - return (bus_activate_resource(bus, type, rid, res)); + if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY) { + return (bus_generic_activate_resource(bus, child, type, rid, + res)); } - if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { - struct ofw_pci_range *rp; - vm_paddr_t start; - int space; - - start = (vm_paddr_t)rman_get_start(res); - - /* - * Map this through the ranges list - */ - for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && - rp->pci_hi != 0; rp++) { - if (start < rp->pci || start >= rp->pci + rp->size) - continue; - - switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { - case OFW_PCI_PHYS_HI_SPACE_IO: - space = SYS_RES_IOPORT; - break; - case OFW_PCI_PHYS_HI_SPACE_MEM32: - case OFW_PCI_PHYS_HI_SPACE_MEM64: - space = SYS_RES_MEMORY; - break; - default: - space = -1; - } - if (type == space) { - start += (rp->host - rp->pci); - break; + start = (vm_paddr_t)rman_get_start(res); + + /* + * Map this through the ranges list + */ + for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && + rp->pci_hi != 0; rp++) { + if (start < rp->pci || start >= rp->pci + rp->size) + continue; + + switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { + case OFW_PCI_PHYS_HI_SPACE_IO: + space = SYS_RES_IOPORT; + break; + case OFW_PCI_PHYS_HI_SPACE_MEM32: + case OFW_PCI_PHYS_HI_SPACE_MEM64: + space = SYS_RES_MEMORY; + break; + default: + space = -1; } + + if (type == space) { + start += (rp->host - rp->pci); + break; } + } - if (bootverbose) - printf("ofw_pci mapdev: start %jx, len %jd\n", - (rman_res_t)start, rman_get_size(res)); - - tag = BUS_GET_BUS_TAG(child, child); - if (tag == NULL) - return (ENOMEM); - - rman_set_bustag(res, tag); - rv = bus_space_map(tag, start, - rman_get_size(res), 0, &handle); - if (rv != 0) - return (ENOMEM); + if (bootverbose) + printf("ofw_pci mapdev: start %jx, len %jd\n", + (rman_res_t)start, rman_get_size(res)); + + tag = BUS_GET_BUS_TAG(child, child); + if (tag == NULL) + return (ENOMEM); + + rman_set_bustag(res, tag); + rv = bus_space_map(tag, start, + rman_get_size(res), 0, &handle); + if (rv != 0) + return (ENOMEM); - rman_set_bushandle(res, handle); - rman_set_virtual(res, (void *)handle); /* XXX for powerpc only ? */ - } + rman_set_bushandle(res, handle); + rman_set_virtual(res, (void *)handle); /* XXX for powerpc only ? */ return (rman_activate_resource(res)); } @@ -528,17 +557,19 @@ static int ofw_pci_deactivate_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { + struct ofw_pci_softc *sc; + vm_size_t psize; - /* - * If this is a memory resource, unmap it. - */ - if ((type == SYS_RES_MEMORY) || (type == SYS_RES_IOPORT)) { - u_int32_t psize; + sc = device_get_softc(bus); - psize = rman_get_size(res); - pmap_unmapdev((vm_offset_t)rman_get_virtual(res), psize); + if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY) { + return (bus_generic_deactivate_resource(bus, child, type, rid, + res)); } + psize = rman_get_size(res); + pmap_unmapdev((vm_offset_t)rman_get_virtual(res), psize); + return (rman_deactivate_resource(res)); } @@ -550,24 +581,20 @@ ofw_pci_adjust_resource(device_t bus, de struct ofw_pci_softc *sc; sc = device_get_softc(bus); - KASSERT(!(rman_get_flags(res) & RF_ACTIVE), - ("active resources cannot be adjusted")); - if (rman_get_flags(res) & RF_ACTIVE) - return (EINVAL); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) + return (pci_domain_adjust_bus(sc->sc_pci_domain, child, res, + start, end)); +#endif - switch (type) { - case SYS_RES_MEMORY: - rm = &sc->sc_mem_rman; - break; - case SYS_RES_IOPORT: - rm = &sc->sc_io_rman; - break; - default: - return (ENXIO); + rm = ofw_pci_get_rman(sc, type, rman_get_flags(res)); + if (rm == NULL) { + return (bus_generic_adjust_resource(bus, child, type, res, + start, end)); } - - if (!rman_is_region_manager(res, rm)) - return (EINVAL); + KASSERT(rman_is_region_manager(res, rm), ("rman mismatch")); + KASSERT(!(rman_get_flags(res) & RF_ACTIVE), + ("active resources cannot be adjusted")); return (rman_adjust_resource(res, start, end)); } @@ -629,3 +656,22 @@ ofw_pci_fill_ranges(phandle_t node, stru free(base_ranges, M_DEVBUF); return (nranges); } + +static struct rman * +ofw_pci_get_rman(struct ofw_pci_softc *sc, int type, u_int flags) +{ + + switch (type) { + case SYS_RES_IOPORT: + return (&sc->sc_io_rman); + case SYS_RES_MEMORY: + if (sc->sc_have_pmem && (flags & RF_PREFETCHABLE)) + return (&sc->sc_pmem_rman); + else + return (&sc->sc_mem_rman); + default: + break; + } + + return (NULL); +} Modified: stable/11/sys/dev/ofw/ofwpci.h ============================================================================== --- stable/11/sys/dev/ofw/ofwpci.h Sat Oct 15 08:52:42 2016 (r307346) +++ stable/11/sys/dev/ofw/ofwpci.h Sat Oct 15 09:09:25 2016 (r307347) @@ -60,15 +60,19 @@ struct ofw_pci_softc { int sc_bus; int sc_initialized; int sc_quirks; + int sc_have_pmem; struct ofw_pci_range *sc_range; int sc_nrange; + uint64_t sc_range_mask; struct ofw_pci_cell_info *sc_cell_info; struct rman sc_io_rman; struct rman sc_mem_rman; + struct rman sc_pmem_rman; bus_space_tag_t sc_memt; bus_dma_tag_t sc_dmat; + int sc_pci_domain; struct ofw_bus_iinfo sc_pci_iinfo; }; From owner-svn-src-stable-11@freebsd.org Sat Oct 15 12:22:07 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C60C1C11A88; Sat, 15 Oct 2016 12:22:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60AE1E47; Sat, 15 Oct 2016 12:22:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9FCM65s026966; Sat, 15 Oct 2016 12:22:06 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9FCM6bt026965; Sat, 15 Oct 2016 12:22:06 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610151222.u9FCM6bt026965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 15 Oct 2016 12:22:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307353 - stable/11/share/misc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 12:22:07 -0000 Author: bapt Date: Sat Oct 15 12:22:06 2016 New Revision: 307353 URL: https://svnweb.freebsd.org/changeset/base/307353 Log: MFC r306854 Update pci_vendors to 2016-10-03 Modified: stable/11/share/misc/pci_vendors Directory Properties: stable/11/ (props changed) Modified: stable/11/share/misc/pci_vendors ============================================================================== --- stable/11/share/misc/pci_vendors Sat Oct 15 12:11:30 2016 (r307352) +++ stable/11/share/misc/pci_vendors Sat Oct 15 12:22:06 2016 (r307353) @@ -3,8 +3,8 @@ # # List of PCI ID's # -# Version: 2016.05.23 -# Date: 2016-05-23 03:15:02 +# Version: 2016.10.03 +# Date: 2016-10-03 03:15:01 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at http://pci-ids.ucw.cz/. @@ -244,6 +244,19 @@ 1000 1000 LSI53C895A PCI to Ultra2 SCSI Controller 0013 53c875a 1000 1000 LSI53C875A PCI to Ultra SCSI Controller + 0014 MegaRAID Tri-Mode SAS3516 + 1d49 0602 ThinkSystem RAID 930-16i 4GB Flash PCIe 12Gb Adapter + 0016 MegaRAID Tri-Mode SAS3508 + 1d49 0601 ThinkSystem RAID 930-8i 2GB Flash PCIe 12Gb Adapter + 1d49 0603 ThinkSystem RAID 930-24i 4GB Flash PCIe 12Gb Adapter + 1d49 0604 ThinkSystem RAID 930-8e 4GB Flash PCIe 12Gb Adapter + 0017 MegaRAID Tri-Mode SAS3408 + 1d49 0500 ThinkSystem RAID 530-8i PCIe 12Gb Adapter + 1d49 0502 ThinkSystem RAID 530-8i Dense Adapter + 001b MegaRAID Tri-Mode SAS3504 + 1d49 0605 ThinkSystem RAID 930-4i 2GB Flash Flex Adapter + 001c MegaRAID Tri-Mode SAS3404 + 1d49 0501 ThinkSystem RAID 530-4i Flex Adapter 0020 53c1010 Ultra3 SCSI Adapter 1000 1000 LSI53C1010-33 PCI to Dual Channel Ultra160 SCSI Controller 107b 1040 Server Onboard 53C1010-33 @@ -351,6 +364,8 @@ 005c SAS1064A PCI-X Fusion-MPT SAS 005d MegaRAID SAS-3 3108 [Invader] 1000 9361 MegaRAID SAS 9361-8i + 1000 9364 MegaRAID SAS 9364-8i + 1000 936a MegaRAID SAS 9364-8i 1028 1f41 PERC H830 Adapter 1028 1f42 PERC H730P Adapter 1028 1f43 PERC H730 Adapter @@ -363,6 +378,7 @@ 1028 1f54 PERC FD33xD 17aa 1052 ThinkServer RAID 720i 17aa 1053 ThinkServer RAID 720ix + 1d49 0600 ThinkSystem RAID 730-8i 1GB Cache PCIe 12Gb Adapter 005e SAS1066 PCI-X Fusion-MPT SAS 005f MegaRAID SAS-3 3008 [Fury] 1028 1f44 PERC H330 Adapter @@ -506,6 +522,7 @@ 0087 SAS2308 PCI-Express Fusion-MPT SAS-2 1000 3020 9207-8i SAS2.1 HBA 1000 3040 9207-8e SAS2.1 HBA + 1000 3050 SAS9217-8i 1590 0044 H220i 008f 53c875J 1092 8000 FirePort 40 SCSI Controller @@ -516,8 +533,20 @@ 0095 SAS3108 PCI-Express Fusion-MPT SAS-3 0096 SAS3004 PCI-Express Fusion-MPT SAS-3 0097 SAS3008 PCI-Express Fusion-MPT SAS-3 + 1000 3090 SAS9311-8i + 1000 30e0 SAS9300-8i 1028 1f45 12GB/s HBA internal 1028 1f46 12Gbps HBA + 00ab SAS3516 Fusion-MPT Tri-Mode RAID On Chip (ROC) + 00ac SAS3416 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) + 1d49 0201 ThinkSystem 9400-16i PCIe 12Gb HBA + 1d49 0203 ThinkSystem 9400-16e PCIe 12Gb HBA + 00ae SAS3508 Fusion-MPT Tri-Mode RAID On Chip (ROC) + 00af SAS3408 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) + 1d49 0200 ThinkSystem 9400-8i PCIe 12Gb HBA + 1d49 0202 ThinkSystem 9400-8e PCIe 12Gb HBA + 00be SAS3504 Fusion-MPT Tri-Mode RAID On Chip (ROC) + 00bf SAS3404 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) 00c0 SAS3324 PCI-Express Fusion-MPT SAS-3 00c1 SAS3324 PCI-Express Fusion-MPT SAS-3 00c2 SAS3324 PCI-Express Fusion-MPT SAS-3 @@ -533,6 +562,9 @@ 1000 9390 MegaRAID SAS 9380-8i8e 00cf MegaRAID SAS-3 3324 [Intruder] 1000 9370 MegaRAID SAS 9361-24i + 00d0 SAS3716 Fusion-MPT Tri-Mode RAID Controller Chip (ROC) + 00d1 SAS3616 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) + 00d3 MegaRAID Tri-Mode SAS3716W 0407 MegaRAID 1000 0530 MegaRAID 530 SCSI 320-0X RAID Controller 1000 0531 MegaRAID 531 SCSI 320-4X RAID Controller @@ -1389,23 +1421,23 @@ 5a11 RD890 Northbridge only single slot PCI-e GFX Hydra part 5a12 RD890 Northbridge only dual slot (2x8) PCI-e GFX Hydra part 15d9 a811 H8DGU - 5a13 RD890 PCI to PCI bridge (external gfx0 port A) - 5a14 RD890 PCI to PCI bridge (external gfx0 port B) + 5a13 RD890S/SR5650 Host Bridge + 5a14 RD9x0/RX980 Host Bridge 5a15 RD890 PCI to PCI bridge (PCI express gpp port A) - 5a16 RD890 PCI to PCI bridge (PCI express gpp port B) - 5a17 RD890 PCI to PCI bridge (PCI express gpp port C) - 5a18 RD890 PCI to PCI bridge (PCI express gpp port D) + 5a16 RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GFX port 0) + 5a17 RD890/RD9x0 PCI to PCI bridge (PCI Express GFX port 1) + 5a18 RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 0) 15d9 a811 H8DGU - 5a19 RD890 PCI to PCI bridge (PCI express gpp port E) - 5a1a RD890 PCI to PCI bridge (PCI express gpp port F) - 5a1b RD890 PCI to PCI bridge (PCI express gpp port G) - 5a1c RD890 PCI to PCI bridge (PCI express gpp port H) - 5a1d RD890 PCI to PCI bridge (external gfx1 port A) - 5a1e RD890 PCI to PCI bridge (external gfx1 port B) - 5a1f RD890 PCI to PCI bridge (NB-SB link) + 5a19 RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 1) + 5a1a RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 2) + 5a1b RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 3) + 5a1c RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 4) + 5a1d RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 5) + 5a1e RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP2 Port 0) + 5a1f RD890/RD990 PCI to PCI bridge (PCI Express GFX2 port 0) 15d9 a811 H8DGU - 5a20 RD890S PCI Express bridge for GPP2 port 1 - 5a23 RD990 I/O Memory Management Unit (IOMMU) + 5a20 RD890/RD990 PCI to PCI bridge (PCI Express GFX2 port 1) + 5a23 RD890S/RD990 I/O Memory Management Unit (IOMMU) 5a31 RC410 Host Bridge 5a33 RS400 Host Bridge 5a34 RS4xx PCI Express Port [ext gfx] @@ -1527,6 +1559,7 @@ 6649 Bonaire [FirePro W5100] 1002 0b0c FirePro W4300 103c 0b0c Bonaire [FirePro W4300] + 103c 230c FirePro W5100 6650 Bonaire 6651 Bonaire 6658 Bonaire XTX [Radeon R7 260X/360] @@ -1566,6 +1599,7 @@ 17aa 390c Radeon R5 M330 6663 Sun PRO [Radeon HD 8570A/8570M] 1025 0846 Radeon HD 8570A + 17aa 3805 Radeon HD 8570M 6664 Jet XT [Radeon R5 M240] 6665 Jet PRO [Radeon R5 M230] 17aa 368f Radeon R5 A230 @@ -2100,6 +2134,7 @@ 1462 8036 Radeon HD 8990 OEM 148c 8990 Radeon HD 8990 OEM 679e Tahiti LE [Radeon HD 7870 XT] + 1787 2328 Radeon HD 7870 Black Edition 2 GB GDDR5 [2GBD5-2DHV3E] 679f Tahiti 67a0 Hawaii XT GL [FirePro W9100] 1002 0335 FirePro S9150 @@ -2150,15 +2185,31 @@ 67b1 Hawaii PRO [Radeon R9 290/390] 1043 04dd STRIX R9 390 148c 2358 Radeon R9 390 + 174b e324 Sapphire Nitro R9 390 67b9 Vesuvius [Radeon R9 295X2] 67be Hawaii LE 67c0 Ellesmere [Polaris10] - 67df Ellesmere [Polaris10] + 67df Ellesmere [Radeon RX 470/480] + 1002 0b37 Radeon RX 480 + 1043 04a8 Radeon RX 480 + 1043 04b0 Radeon RX 470 + 1043 04fb Radeon RX 480 + 1462 3411 Radeon RX 470 + 1462 3413 Radeon RX 480 + 148c 2372 Radeon RX 480 + 148c 2373 Radeon RX 470 + 1682 9470 Radeon RX 470 + 1682 9480 Radeon RX 480 + 174b e347 Radeon RX 470/480 + 174b e349 Radeon RX 470 + 1787 a470 Radeon RX 470 + 1787 a480 Radeon RX 480 67e0 Baffin [Polaris11] 67e1 Baffin [Polaris11] 67e8 Baffin [Polaris11] 67e9 Baffin [Polaris11] 67eb Baffin [Polaris11] + 67ef Baffin [Radeon RX 460] 67ff Baffin [Polaris11] 6800 Wimbledon XT [Radeon HD 7970M] 1002 0124 Radeon HD 7970M @@ -2980,6 +3031,7 @@ 72b3 RV560 [Radeon X1650 GT] (Secondary) 7300 Fiji [Radeon R9 FURY / NANO Series] 1002 0b36 Radeon R9 FURY X / NANO + 1002 1b36 Radeon Pro Duo 1043 049e Radeon R9 FURY 1043 04a0 Radeon R9 FURY X 174b e329 Radeon R9 FURY @@ -3174,7 +3226,7 @@ 95cc RV620 GL [FirePro V3700] 95cd RV620 [FirePro 2450] 95cf RV620 GL [FirePro 2260] - 960f RS780 HDMI Audio [Radeon (HD) 3000 Series] + 960f RS780 HDMI Audio [Radeon 3000/3100 / HD 3200/3300] 9610 RS780 [Radeon HD 3200] 1458 d000 GA-MA78GM-S2H Motherboard 9611 RS780C [Radeon 3100] @@ -3275,7 +3327,7 @@ 9917 Trinity [Radeon HD 7620G] 9918 Trinity [Radeon HD 7600G] 9919 Trinity [Radeon HD 7500G] - 9920 Liverpool Graphics + 9920 Liverpool [Playstation 4 APU] 9921 Liverpool HDMI/DP Audio Controller 9990 Trinity [Radeon HD 7520G] 9991 Trinity [Radeon HD 7540D] @@ -3295,40 +3347,41 @@ 99a0 Trinity [Radeon HD 7520G] 99a2 Trinity [Radeon HD 7420G] 99a4 Trinity [Radeon HD 7400G] - aa00 R600 HDMI Audio [Radeon HD 2900 Series] + aa00 R600 HDMI Audio [Radeon HD 2900 GT/PRO/XT] + aa01 RV635 HDMI Audio [Radeon HD 3650/3730/3750] aa08 RV630 HDMI Audio [Radeon HD 2600 Series] - aa10 RV610 HDMI Audio [Radeon HD 2350/2400 Series] + aa10 RV610 HDMI Audio [Radeon HD 2350 PRO / 2400 PRO/XT / HD 3410] 174b aa10 Radeon HD 2400 PRO 18bc aa10 Radeon HD 2400 PRO aa18 RV670/680 HDMI Audio [Radeon HD 3690/3800 Series] - aa20 RV635 HDMI Audio [Radeon HD 3600 Series] - aa28 RV620 HDMI Audio [Radeon HD 3400 Series] + aa20 RV635 HDMI Audio [Radeon HD 3650/3730/3750] + aa28 RV620 HDMI Audio [Radeon HD 3450/3470/3550/3570] aa30 RV770 HDMI Audio [Radeon HD 4850/4870] 174b aa30 Radeon HD 4850 512MB GDDR3 PCI-E Dual Slot Fansink aa38 RV710/730 HDMI Audio [Radeon HD 4000 series] 103c 3628 dv6-1190en - aa50 Cypress HDMI Audio [Radeon HD 5800 Series] + aa50 Cypress HDMI Audio [Radeon HD 5830/5850/5870 / 6850/6870 Rebrand] aa58 Juniper HDMI Audio [Radeon HD 5700 Series] # 5500, 5600 and mobile 5700 series aa60 Redwood HDMI Audio [Radeon HD 5000 Series] 1025 033d Mobility Radeon HD 5650 1025 0347 Aspire 7740G - aa68 Cedar HDMI Audio [Radeon HD 5400/6300 Series] + aa68 Cedar HDMI Audio [Radeon HD 5400/6300/7300 Series] 1028 aa68 XPS 8300 - aa80 Cayman/Antilles HDMI Audio [Radeon HD 6900 Series] + aa80 Cayman/Antilles HDMI Audio [Radeon HD 6930/6950/6970/6990] aa88 Barts HDMI Audio [Radeon HD 6800 Series] - aa90 Turks/Whistler HDMI Audio [Radeon HD 6000 Series] + aa90 Turks HDMI Audio [Radeon HD 6500/6600 / 6700M Series] 1028 04a3 Precision M4600 aa98 Caicos HDMI Audio [Radeon HD 6400 Series] 174b aa98 Radeon HD 6450 1GB DDR3 - aaa0 Tahiti XT HDMI Audio [Radeon HD 7970 Series] + aaa0 Tahiti HDMI Audio [Radeon HD 7870 XT / 7950/7970] aab0 Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] aac0 Tobago HDMI Audio [Radeon R7 360 / R9 360 OEM] - aac8 Hawaii HDMI Audio + aac8 Hawaii HDMI Audio [Radeon R9 290/290X / 390/390X] # I have a Tonga card and this is the HDMI Audio part aad8 Tonga HDMI Audio [Radeon R9 285/380] 174b aad8 Radeon R9 285/380 HDMI Audio - aae8 Fiji HDMI/DP Audio Controller + aae8 Fiji HDMI/DP Audio [Radeon R9 Nano / FURY/FURY X] ac00 Theater 600 Pro ac02 TV Wonder HD 600 PCIe ac12 Theater HD T507 (DVB-T) TV tuner/capture device @@ -3751,6 +3804,7 @@ 04da PCI-E IPR SAS+ Adapter (ASIC) 1014 04fb PCIe3 x16 20GB Cache 12Gb Quad SAS RAID+ Adapter(580B) 1014 04fc PCIe3 x8 12Gb Quad SAS RAID+ Adapter(580A) + 04ed Internal Shared Memory (ISM) virtual PCI device 3022 QLA3022 Network Adapter 4022 QLA3022 Network Adapter ffff MPIC-2 interrupt controller @@ -4421,6 +4475,11 @@ 102b 2241 M9138 LP PCIe x16 102b 2280 M9188 ATX PCIe x16 102b 22c0 M9128 LP PCIe x16 + 0550 SV2 + 102b 00c0 MURA-IPX-I4EF + 102b 00c1 MURA-IPX-I4DF + 102b 00c3 MURA-IPX-I4DHF + 102b 00c5 MURA-IPX-I4EHF 0d10 MGA Ultima/Impression 1000 MGA G100 [Productiva] 102b ff01 Productiva G100 @@ -5947,8 +6006,14 @@ 1077 029a QLE2742 Dual Port 32Gb Fibre Channel to PCIe Adapter 1077 029b QLE2690 Single Port 16Gb Fibre Channel to PCIe Adapter 1077 029c QLE2692 Dual Port 16Gb Fibre Channel to PCIe Adapter + 1077 02a7 QLE2690 Single Port 16Gb FC to PCIe Gen3 x8 Adapter + 1077 02a8 QLE2692 Dual Port 16Gb FC to PCIe Gen3 x8 Adapter + 1077 02ab QLE2740 Single Port 32Gb FC to PCIe Gen3 x8 Adapter + 1077 02ac QLE2742 Dual Port 32Gb FC to PCIe Gen3 x8 Adapter 1590 00f9 HPE StoreFabric SN1100Q 16Gb Single Port Fibre Channel Host Bus Adapter 1590 00fa HPE StoreFabric SN1100Q 16Gb Dual Port Fibre Channel Host Bus Adapter + 1590 0203 HPE StoreFabric SN1600Q 32Gb Single Port Fibre Channel Host Bus Adapter + 1590 0204 HPE StoreFabric SN1600Q 32Gb Dual Port Fibre Channel Host Bus Adapter 2300 QLA2300 64-bit Fibre Channel Adapter 2312 ISP2312-based 2Gb Fibre Channel to PCI-X HBA 103c 0131 2Gb Fibre Channel - Single port [A7538A] @@ -7308,9 +7373,11 @@ 8696 PEX 8696 96-lane, 24-Port PCI Express Gen 2 (5.0 GT/s) Multi-Root Switch 8717 PEX 8717 16-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch with DMA 8718 PEX 8718 16-Lane, 5-Port PCI Express Gen 3 (8.0 GT/s) Switch + 8724 PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA 8732 PEX 8732 32-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch 8734 PEX 8734 32-lane, 8-Port PCI Express Gen 3 (8.0GT/s) Switch 8747 PEX 8747 48-Lane, 5-Port PCI Express Gen 3 (8.0 GT/s) Switch + 8748 PEX 8748 48-Lane, 12-Port PCI Express Gen 3 (8 GT/s) Switch, 27 x 27mm FCBGA # This is the Non-Transparent-Bridge Virtualized Port as presented by the PLX PEX 8732 chip, the physical bridges show up at 10b5:8732 87b0 PEX 8732 32-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch 1093 7761 PXIe-8830mc @@ -7450,6 +7517,7 @@ 1885 0700 Tsunami FPGA PMC with Altera Stratix S40 1885 0701 Tsunami FPGA PMC with Altera Stratix S30 9733 PEX 9733 33-lane, 9-port PCI Express Gen 3 (8.0 GT/s) Switch + 1d49 0001 ThinkSystem P310W-4P NVMe Switch Card 9749 PEX 9749 49-lane, 13-port PCI Express Gen 3 (8.0 GT/s) Switch a100 Blackmagic Design DeckLink bb04 B&B 3PCIOSD1A Isolated PCI Serial @@ -9992,6 +10060,7 @@ 10c3 GT218 [GeForce 8400 GS Rev. 3] 10c5 GT218 [GeForce 405] 10d8 GT218 [NVS 300] + 10f0 GP104 High Definition Audio Controller 1140 GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] 1019 0799 GeForce 820M 1019 999f GeForce GT 720M @@ -10187,7 +10256,7 @@ 144d c0e3 NVS 5200M 144d c0e4 NVS 5200M 144d c10d GeForce 820M - 144d c652 GeForce GT 620M + 144d c652 GeForce GT 620M on NP300E5C series laptop 144d c709 GeForce 710M 144d c711 GeForce 710M 144d c736 GeForce 710M @@ -10518,7 +10587,9 @@ 13ba GM107GL [Quadro K2200] 13bb GM107GL [Quadro K620] 13bc GM107GL [Quadro K1200] - 13bd GM107GL [GRID M40] + 13bd GM107GL [Tesla M10] + 10de 110a GRID M40 + 10de 1160 Tesla M10 13c0 GM204 [GeForce GTX 980] 1043 8504 GTX980-4GD5 13c1 GM204 @@ -10535,6 +10606,7 @@ 13f8 GM204GLM [Quadro M5000M] 13f9 GM204GLM [Quadro M4000M] 13fa GM204GLM [Quadro M3000M] + 10de 11c9 Quadro M3000 SE 13fb GM204GLM [Quadro M5500] 1401 GM206 [GeForce GTX 960] 1402 GM206 [GeForce GTX 950] @@ -10543,17 +10615,54 @@ 1427 GM206M [GeForce GTX 965M] 1430 GM206GL [Quadro M2000] 1431 GM206GL [Tesla M4] + 15f0 GP100GL + 15f1 GP100GL + 15f8 GP100GL + 15f9 GP100GL 1617 GM204M [GeForce GTX 980M] 1618 GM204M [GeForce GTX 970M] 1619 GM204M [GeForce GTX 965M] 161a GM204M [GeForce GTX 980] 1667 GM204M [GeForce GTX 965M] + 1725 GP100 + 172e GP100 + 172f GP100 17c2 GM200 [GeForce GTX TITAN X] 17c8 GM200 [GeForce GTX 980 Ti] 17f0 GM200GL [Quadro M6000] 17f1 GM200GL [Quadro M6000 24GB] 17fd GM200GL [Tesla M40] + 1b00 GP102 [TITAN X] + 1b01 GP102 + 1b30 GP102GL [Quadro P6000] + 1b70 GP102GL + 1b78 GP102GL 1b80 GP104 [GeForce GTX 1080] + 1b81 GP104 [GeForce GTX 1070] + 1b82 GP104 + 1b83 GP104 + 1ba0 GP104M [GeForce GTX 1080] + 1ba1 GP104M [GeForce GTX 1070] + 1bb0 GP104GL [Quadro P5000] + 1bb1 GP104GL + 1bb4 GP104GL + 1be0 GP104M [GeForce GTX 1080] + 1be1 GP104M [GeForce GTX 1070] + 1c00 GP106 + 1c01 GP106 + 1c02 GP106 [GeForce GTX 1060 3GB] + 1c03 GP106 [GeForce GTX 1060 6GB] + 1c20 GP106M [GeForce GTX 1060] + 1c30 GP106GL + 1c60 GP106M [GeForce GTX 1060] + 1c70 GP106GL + 1c80 GP107 + 1c81 GP107 + 1c82 GP107 [GeForce GTX 1050 Ti] + 1ca7 GP107GL + 1ca8 GP107GL + 1caa GP107GL + 1d01 GP108 10df Emulex Corporation 0720 OneConnect NIC (Skyhawk) 103c 1934 FlexFabric 20Gb 2-port 650M Adapter @@ -10723,6 +10832,7 @@ 5250 RTS5250 PCI Express Card Reader 525a RTS525A PCI Express Card Reader 5286 RTS5286 PCI Express Card Reader + 5287 RTL8411B PCI Express Card Reader 5288 RTS5288 PCI Express Card Reader 5289 RTL8411 PCI Express Card Reader 1043 1457 K55A Laptop @@ -10738,6 +10848,7 @@ 11ec 8129 RTL8111/8168 PCIe Gigabit Ethernet (misconfigured) 8136 RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller 103c 1985 Pavilion 17-e163sg Notebook PC + 103c 2a8c Compaq 500B Microtower 103c 2ab1 Pavilion p6774 103c 30cc Pavilion dv6700 1179 ff64 RTL8102E PCI-E Fast Ethernet NIC @@ -10804,6 +10915,7 @@ 1028 0283 Vostro 220 1028 04b2 Vostro 3350 1028 04da Vostro 3750 + 1028 06f3 Latitude 3570 103c 1611 Pavilion DM1Z-3000 103c 1950 ProBook 450/455 103c 2a6f Asus IPIBL-LB Motherboard @@ -10815,7 +10927,8 @@ 1043 8505 P8 series motherboard 105b 0d7c D270S/D250S Motherboard 10ec 8168 RTL8111/8168 PCI Express Gigabit Ethernet controller - 1458 e000 Motherboard + 144d c652 RTL8168 on a NP300E5C series laptop + 1458 e000 Onboard Ethernet 1462 238c Onboard RTL8111b on MSI P965 Platinum Mainboard 1462 368c K9AG Neo2 1462 4180 Wind PC MS-7418 @@ -10845,10 +10958,12 @@ 8173 RTL8192SE Wireless LAN Controller 8174 RTL8192SE Wireless LAN Controller 8176 RTL8188CE 802.11b/g/n WiFi Adapter + 1043 84b5 PCE-N10 1a3b 1139 AW-NE139H Half-size Mini PCIe Card 8177 RTL8191CE PCIe Wireless Network Adapter 8178 RTL8192CE PCIe Wireless Network Adapter 8179 RTL8188EE Wireless Network Adapter + 103c 197d RTL8188EE mini-PCIe card 8180 RTL8180L 802.11b MAC 1385 4700 MA521 802.11b Wireless PC Card 1737 0019 WPC11v4 802.11b Wireless-B Notebook Adapter @@ -10858,6 +10973,7 @@ 8191 RTL8192CE PCIe Wireless Network Adapter 8192 RTL8192E/RTL8192SE Wireless LAN Controller 8193 RTL8192DE Wireless LAN Controller + 8196 RTL8196 Integrated PCI-e Bridge 8197 SmartLAN56 56K Modem 8199 RTL8187SE Wireless LAN Controller 1462 6894 MN54G2 / MS-6894 Wireless Mini PCIe Card @@ -10886,6 +11002,8 @@ 3fc4 RME Digi9652 (Hammerfall) 3fc5 RME Hammerfall DSP 3fc6 RME Hammerfall DSP MADI + 7038 FPGA Card XC7VX690T + 17aa 402f FPGA XC7VX690T-3FFG1157E 8380 Ellips ProfiXpress Profibus Master 8381 Ellips Santos Frame Grabber d154 Copley Controls CAN card (PCI-CAN-02) @@ -10930,46 +11048,88 @@ 9500 INI-950 SCSI Adapter 9502 INI-950P Ultra Wide SCSI Adapter 1102 Creative Labs - 0002 SB Live! EMU10k1 + 0002 EMU10k1 [Sound Blaster Live! Series] 100a 1102 SB Live! 5.1 Digital OEM SB0220 EMU10K1-JFF - 1102 0020 CT4850 SBLive! Value + 1102 0020 CT4670/4850 SBLive! Value 1102 0021 CT4620 SBLive! - 1102 002f SBLive! mainboard implementation - 1102 100a SB Live! 5.1 Digital OEM [SB0220] + 1102 002f M002/M003 Integrated SBLive! + 1102 100a SB0220/0229 SBLive! 5.1 Digital OEM 1102 4001 E-mu APS 1102 8022 CT4780 SBLive! Value 1102 8023 CT4790 SoundBlaster PCI512 1102 8024 CT4760 SBLive! - 1102 8025 SBLive! Mainboard Implementation + 1102 8025 CT1140/SB0040 Integrated SBLive! 1102 8026 CT4830 SBLive! Value 1102 8027 CT4832 SBLive! Value - 1102 8028 CT4760 SBLive! OEM version + 1102 8028 CT4870 SBLive! Value + 1102 8029 CT4872 SBLive! Value + 1102 802a CT4890 SoundBlaster PCI256 + 1102 802b CT4891 SoundBlaster PCI256 1102 8031 CT4831 SBLive! Value + 1102 8032 CT4871 SBLive! Value + 1102 8033 CT4893 SoundBlaster PCI256 + 1102 8035 CT0060 SBLive! 1102 8040 CT4760 SBLive! + 1102 8050 CT4750 SoundBlaster PCI512 1102 8051 CT4850 SBLive! Value - 1102 8061 SBLive! Player 5.1 - 1102 8064 SBLive! 5.1 Model SB0100 - 1102 8065 SBLive! 5.1 Digital Model SB0220 - 1102 8066 Live! 5.1 Digital [SB0228] - 1102 8067 SBLive! 5.1 eMicro 28028 - 0004 SB Audigy - 1102 0051 SB0090 Audigy Player - 1102 0053 SB0090 Audigy Player/OEM - 1102 0058 SB0090 Audigy Player/OEM - 1102 1002 SB Audigy2 Platinum - 1102 1003 SB0350 Audigy 2 - 1102 1007 SB0240 Audigy 2 Platinum 6.1 - 1102 1009 SB Audigy2 OEM HP - 1102 2001 SB Audigy 2 ZS Platinum Pro - 1102 2002 SB Audigy 2 ZS (SB0350) - 1102 4001 E-MU 1010 + 1102 8061 SB060 SBLive! Player 5.1 + 1102 8062 SB0100 SBLive! 5.1 + 1102 8063 DXW Integrated SBLive! 5.1 + 1102 8064 SB0100/SB0102 SBLive! 5.1 + 1102 8065 SB0220/0222 SBLive! 5.1 Digital + 1102 8066 SB0228 SBLive! 5.1 Digital + 1102 8067 SB0220 SBLive! 5.1 + 1102 8068 CT0061 SBLive! + 1102 8069 SB0101 SBLive! 5.1 Value + 1102 806a SB0103 SBLive! 5.1 + 1102 806b SB0105 SBLive! 5.1 + 1102 806c SB0221 SBLive! 5.1 + 1102 8071 SB0150 SoundBlaster PCI512 +# EMU8008 PCI version of emu8000 chip + 0003 SB AWE64(D) + 0004 EMU10k2/CA0100/CA0102/CA10200 [Sound Blaster Audigy Series] + 1102 0040 SB0090 Audigy Player +# Probably an early engineering sample + 1102 0041 CT4820 SBLive!2 + 1102 0042 CT0070 Audigy + 1102 0043 CT0072 Audigy + 1102 0051 SB0090 Audigy Player/Platinum (EX) + 1102 0052 SB0162 Audigy ES + 1102 0053 CT0090/SB0092 Audigy Player/OEM + 1102 0054 SB0161 Audigy ES + 1102 0055 SB0192 Audigy + 1102 0056 SB0191 Audigy + 1102 0057 SB0091 Audigy + 1102 0058 SB0095 Audigy Player/OEM + 1102 0059 SB0230 Audigy + 1102 005a SB0231 Audigy + 1102 005b SB0232 Audigy + 1102 005c SB0238 Audigy + 1102 1002 SB0240 Audigy 2 Platinum 6.1 + 1102 1003 SB0350 Audigy 2 / SB0243 Audigy 2 OEM + 1102 1004 SB0242 Audigy 2 + 1102 1005 SB0280 Audigy 2 Platinum Ex + 1102 1006 SB0245 Audigy 2 OEM + 1102 1007 SB0240/SB0244 Audigy 2 Platinum + 1102 1008 SB0320 Audigy 2 + 1102 1009 SB0249 Audigy 2 OEM + 1102 100a SB0246 Audigy 2 + 1102 2001 SB0360 Audigy 2 ZS Platinum Pro + 1102 2002 SB0350 Audigy 2 ZS + 1102 2003 SB0352 Audigy 2 ZS + 1102 2004 SB0355 Audigy 2 ZS + 1102 2005 SB0359 Audigy 2 ZS + 1102 2006 SB035x Audigy 2 OEM + 1102 2007 SB0380 Audigy 4 Pro + 1102 4001 E-MU 1010 [MAEM8810] 1102 4002 E-MU 0404 - 0005 SB X-Fi + 1102 4003 E-MU 1010 + 0005 EMU20k1 [Sound Blaster X-Fi Series] 1102 0021 X-Fi Platinum 1102 002c X-Fi XtremeGamer FATAL1TY PRO 1102 1003 X-Fi XtremeMusic - 0006 [SB Live! Value] EMU10k1X - 0007 CA0106 Soundblaster + 0006 EMU10k1X [SB Live! Value/OEM Series] + 0007 CA0106/CA0111 [SB Live!/Audigy/X-Fi Series] 1102 0007 SBLive! 24bit 1102 1001 SB0310 Audigy LS 1102 1002 SB0312 Audigy LS @@ -10978,15 +11138,30 @@ 1102 1012 SB0790 X-Fi XA 1102 1013 Soundblaster X-Fi Xtreme Audio 1462 1009 K8N Diamond - 0008 SB0400 Audigy2 Value + 0008 CA0108/CA10300 [Sound Blaster Audigy Series] 1102 0008 EMU0404 Digital Audio System + 1102 1001 SB0400 Audigy 2 Value + 1102 1021 SB0610 Audigy 4 Value + 1102 1022 SBxxx Audigy 2/4 Value + 1102 1023 SB0612 Audigy 2 LS + 1102 1024 SB1550 Audigy 5/Rx + 1102 1101 SBxxxx Audigy 2 SA + 1102 2001 SB0530 Audigy 2 ZS Notebook + 1102 2021 SBxxxx Audigy 4 Notebook + 1102 4002 E-MU 0404 + 1102 4003 E-MU 1010 1102 4004 EMU1010 Digital Audio System [MAEM8960] - 0009 [SB X-Fi Xtreme Audio] CA0110-IBG - 1102 0010 [SB X-Fi Xtreme Audio] CA0110-IBG - 1102 0018 SB1040 - 000b EMU20k2 [X-Fi Titanium Series] + 1102 4005 E-MU 0404 [MAEM8984] + 1102 4007 E-MU 1010 [MAEM8982] + 1102 4201 E-MU 0202 [MAEM8950] + 0009 CA0110 [Sound Blaster X-Fi Xtreme Audio] + 1102 0010 MB0820 Integrated + 1102 0018 SB1040 PCI Express + 000b EMU20k2 [Sound Blaster X-Fi Titanium Series] 1102 0041 SB0880 [SoundBlaster X-Fi Titanium PCI-e] - 0012 SB Recon3D + 1102 0062 SB1270 [SoundBlaster X-Fi Titanium HD] + 0012 Sound Core3D [Sound Blaster Recon3D / Z-Series] + 1102 0010 SB1570 SB Audigy Fx 4001 SB Audigy FireWire Port 1102 0010 SB Audigy FireWire Port 7002 SB Live! Game Port @@ -11900,6 +12075,7 @@ 1093 75ff PXIe-8383mc DMA 1093 7600 PXIe-8383mc DMA 1093 7602 PXIe-8384 + 808e PES24NT24G2 PCI Express Switch # 32 port / 8 lane PCIe Gen 2 packet switch 808f PES32NT8AG2 80cf F32P08xG3 [PCIe boot mode] @@ -12820,7 +12996,7 @@ 103c 30b5 Presario V3242AU 103c 30b7 Presario V6133CL 103c 30cc Pavilion dv6700 - 103c 30cf Pavilion dv9500/9600/9700 series + 103c 30cf Pavilion dv95xx/96xx/97xx/98xx series 1043 1237 A6J-Q008 1043 1967 V6800V 144d c018 X20 IV @@ -13542,6 +13718,16 @@ 8032 ATTO Celerity FC8xEN 117c 003b Celerity FC-82EN Fibre Channel Adapter 117c 003c Celerity FC-84EN Fibre Channel Adapter + 8053 PM8053 SXP 12G 24-port SAS/SATA expander + 8054 PM8054 SXP 12G 36-port SAS/SATA expander + 8055 PM8055 SXP 12G 48-port SAS/SATA expander + 8056 PM8056 SXP 12G 68-port SAS/SATA expander + 8060 PM8060 SRCv 12G eight-port SAS/SATA RoC + 8063 PM8063 SRCv 12G 16-port SAS/SATA RoC + 8070 PM8070 Tachyon SPCv 12G eight-port SAS/SATA controller + 8071 PM8071 Tachyon SPCve 12G eight-port SAS/SATA controller + 8072 PM8072 Tachyon SPCv 12G 16-port SAS/SATA controller + 8073 PM8073 Tachyon SPCve 12G 16-port SAS/SATA controller 11f9 I-Cube Inc 11fa Kasan Electronics Company, Ltd. 11fb Datel Inc @@ -13595,6 +13781,7 @@ 1202 9844 SK-9843 SX dual link 1203 Bayer Corporation, Agfa Division 1204 Lattice Semiconductor Corporation + 1965 SB6501 802.11ad Wireless Network Adapter 1205 Array Corporation 1206 Amdahl Corporation 1208 Parsytec GmbH @@ -13685,6 +13872,7 @@ 1028 04a3 Precision M4600 8331 O2 Flash Memory Card 8520 SD/MMC Card Reader Controller + 8621 SD/MMC Card Reader Controller 1218 Hybricon Corp. 1219 First Virtual Corporation 121a 3Dfx Interactive, Inc. @@ -13906,6 +14094,7 @@ 1969 ES1938/ES1946/ES1969 Solo-1 Audiodrive 1014 0166 ES1969 SOLO-1 AudioDrive on IBM Aptiva Mainboard 125d 8888 Solo-1 Audio Adapter + 125d 8898 ES1938S TTSOLO1-SL [TerraTec 128i PCI] 153b 111b Terratec 128i PCI 1978 ES1978 Maestro 2E 0e11 b112 Armada M700/E500 @@ -14030,13 +14219,13 @@ 0002 DirecPC 1274 Ensoniq 1171 ES1373 / Creative Labs CT5803 [AudioPCI] - 1371 ES1371 / Creative Labs CT2518/ES1373 + 1371 ES1371/ES1373 / Creative Labs CT2518 0e11 0024 AudioPCI on Motherboard Compaq Deskpro 0e11 b1a7 ES1371, ES1373 AudioPCI 1033 80ac ES1371, ES1373 AudioPCI 1042 1854 Tazer 107b 8054 Tabor2 - 1274 1371 AudioPCI 64V/128 / Creative CT4810/CT5803/CT5806 [Sound Blaster PCI] + 1274 1371 Audio PCI 64V/128/5200 / Creative CT4810/CT5803/CT5806 [Sound Blaster PCI] 1274 8001 CT4751 board 1462 6470 ES1371, ES1373 AudioPCI On Motherboard MS-6147 1.1A 1462 6560 ES1371, ES1373 AudioPCI On Motherboard MS-6156 1.10 @@ -14319,7 +14508,7 @@ 12a8 News Datacom 12a9 Xiotech Corporation 12aa SDL Communications, Inc. -12ab Yuan Yuan Enterprise Co., Ltd. +12ab YUAN High-Tech Development Co., Ltd. 0000 MPG160/Kuroutoshikou ITVC15-STVLP 0002 AU8830 [Vortex2] Based Sound Card With A3D Support 0003 T507 (DVB-T) TV tuner/capture device @@ -14868,6 +15057,7 @@ 0206 GPS180PEX GPS Receiver (PCI Express) 0207 GLN180PEX GPS/GLONASS receiver (PCI Express) 0208 GPS180AMC GPS Receiver (PCI Express / MicroTCA / AdvancedMC) + 0209 GRC181PEX GPS/GLONASS/BEIDOU receiver (PCI Express) 0301 TCR510PCI IRIG Timecode Reader 0302 TCR167PCI IRIG Timecode Reader 0303 TCR511PCI IRIG Timecode Reader @@ -15758,6 +15948,7 @@ 5015 T502-BT Unified Wire Ethernet Controller 5016 T580-OCP-SO Unified Wire Ethernet Controller 5017 T520-OCP-SO Unified Wire Ethernet Controller + 5018 T540-BT Unified Wire Ethernet Controller 5080 T540-5080 Unified Wire Ethernet Controller 5081 T540-5081 Unified Wire Ethernet Controller 5082 T504-5082 Unified Wire Ethernet Controller @@ -15804,6 +15995,7 @@ 5415 T502-BT Unified Wire Ethernet Controller 5416 T580-OCP-SO Unified Wire Ethernet Controller 5417 T520-OCP-SO Unified Wire Ethernet Controller + 5418 T540-BT Unified Wire Ethernet Controller 5480 T540-5080 Unified Wire Ethernet Controller 5481 T540-5081 Unified Wire Ethernet Controller 5482 T504-5082 Unified Wire Ethernet Controller @@ -15850,6 +16042,7 @@ 5515 T502-BT Unified Wire Storage Controller 5516 T580-OCP-SO Unified Wire Storage Controller 5517 T520-OCP-SO Unified Wire Storage Controller + 5518 T540-BT Unified Wire Storage Controller 5580 T540-5080 Unified Wire Storage Controller 5581 T540-5081 Unified Wire Storage Controller 5582 T504-5082 Unified Wire Storage Controller @@ -15896,6 +16089,7 @@ 5615 T502-BT Unified Wire Storage Controller 5616 T580-OCP-SO Unified Wire Storage Controller 5617 T520-OCP-SO Unified Wire Storage Controller + 5618 T540-BT Unified Wire Storage Controller 5680 T540-5080 Unified Wire Storage Controller 5681 T540-5081 Unified Wire Storage Controller 5682 T504-5082 Unified Wire Storage Controller @@ -15981,6 +16175,7 @@ 5815 T502-BT Unified Wire Ethernet Controller [VF] 5816 T580-OCP-SO Unified Wire Ethernet Controller [VF] 5817 T520-OCP-SO Unified Wire Ethernet Controller [VF] + 5818 T540-BT Unified Wire Ethernet Controller [VF] 5880 T540-5080 Unified Wire Ethernet Controller [VF] 5881 T540-5081 Unified Wire Ethernet Controller [VF] 5882 T504-5082 Unified Wire Ethernet Controller [VF] @@ -16341,7 +16536,8 @@ 14e1 INVERTEX 14e2 INFOLIBRIA 14e3 AMTELCO -14e4 Broadcom Corporation +# Formerly Broadcom Corporation +14e4 Broadcom Limited 0576 BCM43224 802.11a/b/g/n 0800 Sentry5 Chipcommon I/O Controller 0804 Sentry5 PCI Bridge @@ -16725,15 +16921,41 @@ 103c 1321 Core I/O LAN/SCSI Combo [AB314A] 14e4 0009 NetXtreme BCM5703 1000Base-T 14e4 000a NetXtreme BCM5703 1000Base-SX - 16c8 BCM57301 NetXtreme-C Single-port 10Gb Ethernet - 16c9 BCM57302 NetXtreme-C Dual-port 10Gb/25Gb Ethernet - 16ca BCM57304 NetXtreme-C Dual-port 10Gb/25Gb/40Gb/50Gb Ethernet + 16c8 BCM57301 NetXtreme-C 10Gb Ethernet Controller + 16c9 BCM57302 NetXtreme-C 10Gb/25Gb Ethernet Controller + 16ca BCM57304 NetXtreme-C 10Gb/25Gb/40Gb/50Gb Ethernet Controller 16cb BCM57304 NetXtreme-C Ethernet Virtual Function - 16d0 BCM57402 NetXtreme-E Dual-port 10Gb Ethernet - 16d1 BCM57404 NetXtreme-E Dual-port 10Gb/25Gb Ethernet - 16d2 BCM57406 NetXtreme-E Dual-port 10GBase-T Ethernet + 16cc BCM57417 NetXtreme-E Ethernet Partition + 16ce BCM57311 NetXtreme-C 10Gb RDMA Ethernet Controller + 16cf BCM57312 NetXtreme-C 10Gb/25Gb RDMA Ethernet Controller + 16d0 BCM57402 NetXtreme-E 10Gb Ethernet Controller + 16d1 BCM57404 NetXtreme-E 10Gb/25Gb Ethernet Controller + 16d2 BCM57406 NetXtreme-E 10GBASE-T Ethernet Controller 16d3 BCM57404 NetXtreme-E Ethernet Virtual Function + 16d4 BCM57402 NetXtreme-E Ethernet Partition + 16d5 BCM57407 NetXtreme-E 10GBase-T Ethernet Controller + 16d6 BCM57412 NetXtreme-E 10Gb RDMA Ethernet Controller + 16d7 BCM57414 NetXtreme-E 10Gb/25Gb RDMA Ethernet Controller + 1590 020e Ethernet 25Gb 2-port 631SFP28 Adapter + 1590 0211 Ethernet 25Gb 2-port 631FLR-SFP28 Adapter + 16d8 BCM57416 NetXtreme-E 10GBase-T RDMA Ethernet Controller + 1590 020c Ethernet 10Gb 2-port 535T Adapter + 1590 0212 Ethernet 10Gb 2-port 535FLR-T Adapter + 16d9 BCM57417 NetXtreme-E 10GBASE-T RDMA Ethernet Controller + 108e 4866 Dual Port 10GBase-T Ethernet Controller + 16dc BCM57414 NetXtreme-E Ethernet Virtual Function 16dd NetLink BCM5781 Gigabit Ethernet PCI Express + 16de BCM57412 NetXtreme-E Ethernet Partition + 16df BCM57314 NetXtreme-C 10Gb/25Gb/40Gb/50Gb RDMA Ethernet Controller + 16e1 BCM57314 NetXtreme-C Ethernet Virtual Function + 16e2 BCM57417 NetXtreme-E 10Gb/25Gb RDMA Ethernet Controller + 108e 4866 Dual Port 10Gb/25Gb SFP28 Ethernet Controller + 16e3 BCM57416 NetXtreme-E 10Gb RDMA Ethernet Controller + 16e7 BCM57404 NetXtreme-E Ethernet Partition + 16e8 BCM57406 NetXtreme-E Ethernet Partition + 16e9 BCM57407 NetXtreme-E 25Gb Ethernet Controller + 16ec BCM57414 NetXtreme-E Ethernet Partition + 16ee BCM57416 NetXtreme-E Ethernet Partition 16f3 NetXtreme BCM5727 Gigabit Ethernet PCIe 16f7 NetXtreme BCM5753 Gigabit Ethernet PCI Express 16fd NetXtreme BCM5753M Gigabit Ethernet PCI Express @@ -17282,6 +17504,7 @@ 0070 8010 WinTV HVR-1400 ExpressCard 0070 f038 WinTV HVR-5525 107d 6f22 WinFast PxTV1200 + 12ab d585 PE988J Hybrid ATSC/QAM PCI-E AVS Video Capture (SoftEncoder) 13c2 3013 TT-budget CT2-4500 CI 1461 c039 AVerTV Hybrid Express (A577) 153b 117e Cinergy T PCIe Dual @@ -17432,6 +17655,7 @@ 1410 CB1410 Cardbus Controller 1025 003c CL50 motherboard 1025 005a TravelMate 290 + 103c 30d5 530 Laptop 1411 CB-710/2/4 Cardbus Controller 103c 006a NX9500 1412 CB-712/4 Cardbus Controller @@ -17481,6 +17705,7 @@ 9277 5 Volt Delta Sigma Converter Card 9278 10 Volt Delta Sigma Converter Card 9287 Analog Output Card + 9290 FPGA Card 1543 SILICON Laboratories 3052 Intel 537 [Winmodem] 4c22 Si3036 MC'97 DAA @@ -17657,6 +17882,10 @@ 0209 MT27700 Family [ConnectX-4 Flash Recovery] 020b MT27710 Family [ConnectX-4 Lx Flash Recovery] 020d MT28800 Family [ConnectX-5 Flash Recovery] +# reserved for RM#105916 + 024e MT53100 [Spectrum-2, Flash recovery mode] +# Actual value to be used + 024f MT53100 [Spectrum-2, Flash recovery mode] 0262 MT27710 [ConnectX-4 Lx Programmable] EN 0263 MT27710 [ConnectX-4 Lx Programmable Virtual Function] EN 1002 MT25400 Family [ConnectX-2 Virtual Function] @@ -17691,10 +17920,10 @@ 1014 MT27700 Family [ConnectX-4 Virtual Function] 1015 MT27710 Family [ConnectX-4 Lx] 1016 MT27710 Family [ConnectX-4 Lx Virtual Function] - 1017 MT27800 Family [ConnectX-5, PCIe 3.0] + 1017 MT27800 Family [ConnectX-5] 1018 MT28800 Family [ConnectX-5 Virtual Function] - 1019 MT28800 Family [ConnectX-5, PCIe 4.0] - 101a MT28830 + 1019 MT28800 Family [ConnectX-5 Ex] + 101a MT28800 Family [ConnectX-5 Ex Virtual Function] 101b MT28831 101c MT28840 101d MT28841 @@ -17702,6 +17931,7 @@ 101f MT28851 1020 MT28860 1021 MT28861 + 1974 MT28800 Family [ConnectX-5 PCIe Bridge] 5274 MT21108 InfiniBridge 5a44 MT23108 InfiniHost 5a45 MT23108 [Infinihost HCA Flash Recovery] @@ -17744,6 +17974,9 @@ caf1 ConnectX-4 CAPI Function # Spectrum, 100GbE Switch cb84 MT52100 + cf08 MT53236 + cf6c MT53100 [Spectrum-2, 64 x 100GbE switch] + d2f0 Switch-IB 3 HDR (200Gbps) switch 15b4 CCI/TRIAD 15b5 Cimetrics Inc 15b6 Texas Memory Systems Inc @@ -18015,6 +18248,7 @@ 7181 Proc10a_27S 7191 Proc10a_48S 71a1 Proc10a_66S + 71b1 Proc10A 165d Hsing Tech. Enterprise Co., Ltd. 165f Linux Media Labs, LLC 1020 LMLM4 MPEG-4 encoder @@ -18261,9 +18495,12 @@ 1028 0208 Wireless 1506 WLAN Half Mini-Card 103c 1838 AR9485/HB125 802.11bgn 1×1 Wi-Fi Adapter 105b e044 Unex DHXA-225 + 144d 410e AR9485WB-EG 802.11b/g/n mini-PCIe card on a series 3 laptop 1a3b 1186 AW-NE186H - 0033 AR9580 Wireless Network Adapter + 0033 AR958x 802.11abgn Wireless Network Adapter + 168c a120 AR9582 802.11a/n WLAN Mini-PCIe Adapter 0034 AR9462 Wireless Network Adapter + 1028 0300 Wireless 1802 802.11abgn Adapter 1a56 2003 Killer Wireless-N 1202 Half-size Mini PCIe Card 0036 QCA9565 / AR9565 Wireless Network Adapter 0037 AR9485 Wireless Network Adapter @@ -18393,6 +18630,16 @@ 7005 XMC-7K410CC: User-Configurable Kintex-7 FPGA, 410k logic cells, conduction-cooled 7006 XMC-7A200: User-Configurable Artix-7 FPGA, 200k logic cells with Plug-In I/O 7007 XMC-7A200CC: User-Configurable Conduction-Cooled Artix-7 FPGA, with 200k logic cells + 7011 AP440-1: 32-Channel Isolated Digital Input Module + 7012 AP440-2: 32-Channel Isolated Digital Input Module + 7013 AP440-3: 32-Channel Isolated Digital Input Module + 7014 AP445: 32-Channel Isolated Digital Output Module + 7016 AP470 48-Channel TTL Level Digital Input/Output Module + 7018 AP408: 32-Channel Digital I/O Module + 701a AP220-16 12-Bit, 16-Channel Analog Output Module + 701b AP231-16 16-Bit, 16-Channel Analog Output Module + 7042 AP482 Counter Timer Module with TTL Level Input/Output + 7044 AP484 Counter Timer Module with RS422 Input/Output 16da Advantech Co., Ltd. 0011 INES GPIB-PCI 16df PIKA Technologies Inc. @@ -18494,7 +18741,7 @@ 177d 0003 CN2350 [LiquidIO II] 2-port 10GbE SRIOV Virtual Function 9713 CN23XX [LiquidIO II] NVMe SRIOV Virtual Function 9800 Octeon Fusion CNF75XX Processor - a001 THUNDERX MRML Bridge + a001 ThunderX MRML(Master RML Bridge to RSL devices) a002 THUNDERX PCC Bridge 177d a102 CN88XX PCC Bridge a008 THUNDERX SMMU @@ -18532,15 +18779,24 @@ a026 THUNDERX BGX (Common Ethernet Interface) a027 THUNDERX IOBN a029 THUNDERX NCSI (Network Controller Sideband Interface) - a02a THUNDERX SGP + a02a ThunderX SGPIO (Serial GPIO controller for SATA disk lights) a02b THUNDERX SMI / MDIO Controller a02c THUNDERX DAP (Debug Access Port) a02d THUNDERX PCIERC (PCIe Root Complex) - a02e THUNDERX L2C-TAD + a02e ThunderX L2C-TAD (Level 2 cache tag and data) a02f THUNDERX L2C-CBC a030 THUNDERX L2C-MCI a031 THUNDERX MIO-FUS (Fuse Access Controller) a032 THUNDERX FUSF (Fuse Controller) + a033 THUNDERX Random Number Generator virtual function + a034 THUNDERX Network Interface Controller virtual function + a035 THUNDERX Parallel Bus + a036 ThunderX RAD (RAID acceleration engine) virtual function + a037 THUNDERX ZIP virtual function + a040 THUNDERX CPT Cryptographic Accelerator + a100 THUNDERX CN88XX 48 core SoC + a200 OCTEON TX CN81XX/CN80XX + a300 OCTEON TX CN83XX 1787 Hightech Information System Ltd. 1789 Ennyah Technologies Corp. # also used by Struck Innovative Systeme for joint developments @@ -18600,6 +18856,7 @@ 8083 GL880 USB 1.1 UHCI controller 8084 GL880 USB 2.0 EHCI controller 17aa Lenovo + 402b Intel 82599ES 10Gb 2-port Server Adapter X520-2 17ab Phillips Components 17af Hightech Information System Ltd. 17b3 Hawking Technologies @@ -18612,13 +18869,16 @@ 0017 StorSecure 300 GZIP Compression and AES Encryption Card 17c0 Wistron Corp. 17c2 Newisys, Inc. -17cb Airgo Networks, Inc. +# nee Airgo Networks, Inc. +17cb Qualcomm 0001 AGN100 802.11 a/b/g True MIMO Wireless Card 1385 5c00 WGM511 Pre-N 802.11g Wireless CardBus Adapter 1737 0045 WMP54GX v1 802.11g Wireless-G PCI Adapter with SRX 0002 AGN300 802.11 a/b/g True MIMO Wireless Card 1385 6d00 WPNT511 RangeMax 240 Mbps Wireless CardBus Adapter 1737 0054 WPC54GX4 v1 802.11g Wireless-G Notebook Adapter with SRX400 + 0400 Datacenter Technologies QDF2432 PCI Express Root Port + 0401 Datacenter Technologies QDF2400 PCI Express Root Port 17cc NetChip Technology, Inc 2280 USB 2.0 17cf Z-Com, Inc. @@ -18692,6 +18952,44 @@ 17db Cray Inc 0101 XT Series [Seastar] 3D Toroidal Router 17de KWorld Computer Co. Ltd. +17df Dini Group + 1864 Virtex4 PCI Board w/ QL5064 Bridge [DN7000K10PCI/DN8000K10PCI/DN8000K10PSX/NOTUS] + 1865 Virtex4 ASIC Emulator [DN8000K10PCIe] + 1866 Virtex4 ASIC Emulator Cable Connection [DN8000K10PCI] + 1867 Virtex4 ASIC Emulator Cable Connection [DN8000K10PCIe] + 1868 Virtex4 ASIC Emulator [DN8000K10PCIe-8] + 1900 Virtex5 PCIe ASIC Emulator [DN9000K10PCIe8T/DN9002K10PCIe8T/DN9200K10PCIe8T/DN7006K10PCIe8T/DN7406K10PCIe8T] + 1901 Virtex5 PCIe ASIC Emulator Large BARs [DN9000K10PCIe8T/DN9002K10PCIe8T/DN9200K10PCIe8T/DN7006K10PCIe8T/DN7406K10PCIe8T] + 1902 Virtex5 PCIe ASIC Emulator Low Power [Interceptor] + 1903 Spartan6 PCIe FPGA Accelerator Board [DNBFCS12PCIe] + 1904 Virtex6 PCIe ASIC Emulation Board [DNDUALV6_PCIe4] + 1905 Virtex6 PCIe ASIC Emulation Board [DNV6F6PCIe] + 1906 Virtex6 PCIe ASIC Emulation Board [DN2076K10] + 1907 Virtex6 PCIe ASIC Emulation Board [DNV6F2PCIe] + 1908 Virtex6 PCIe ASIC Emulation Board Large BARs[DNV6F2PCIe] *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sat Oct 15 12:35:17 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B523CC130E8; Sat, 15 Oct 2016 12:35:17 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CCB6DEE; Sat, 15 Oct 2016 12:35:17 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9FCZGtS031760; Sat, 15 Oct 2016 12:35:16 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9FCZGPg031759; Sat, 15 Oct 2016 12:35:16 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610151235.u9FCZGPg031759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 15 Oct 2016 12:35:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307357 - stable/11/tools/build/options X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 12:35:17 -0000 Author: bapt Date: Sat Oct 15 12:35:16 2016 New Revision: 307357 URL: https://svnweb.freebsd.org/changeset/base/307357 Log: MFC r306877 Remove the WITH_FMAKE option left over from r284464 Deleted: stable/11/tools/build/options/WITH_FMAKE Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable-11@freebsd.org Sat Oct 15 12:37:58 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E19E2C13188; Sat, 15 Oct 2016 12:37:58 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC020102B; Sat, 15 Oct 2016 12:37:58 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9FCbvlT032020; Sat, 15 Oct 2016 12:37:57 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9FCbvuQ032018; Sat, 15 Oct 2016 12:37:57 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610151237.u9FCbvuQ032018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 15 Oct 2016 12:37:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307358 - stable/11/contrib/tzcode/zic X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 12:37:59 -0000 Author: bapt Date: Sat Oct 15 12:37:57 2016 New Revision: 307358 URL: https://svnweb.freebsd.org/changeset/base/307358 Log: MFC r306852 Incorporate a change from OpenBSD by millert@OpenBSD.org Don't warn about valid time zone abbreviations. POSIX through 2000 says that an abbreviation cannot start with ':', and cannot contain ',', '-', '+', NUL, or a digit. POSIX from 2001 on changes this rule to say that an abbreviation can contain only '-', '+', and alphanumeric characters from the portable character set in the current locale. To be portable to both sets of rules, an abbreviation must therefore use only ASCII letters." Adapted from tzcode2015f. This is needed to be able to update tzdata to a newer version Modified: stable/11/contrib/tzcode/zic/zdump.c stable/11/contrib/tzcode/zic/zic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tzcode/zic/zdump.c ============================================================================== --- stable/11/contrib/tzcode/zic/zdump.c Sat Oct 15 12:35:16 2016 (r307357) +++ stable/11/contrib/tzcode/zic/zdump.c Sat Oct 15 12:37:57 2016 (r307358) @@ -212,24 +212,16 @@ const char * const zone; return; cp = abbrp; wp = NULL; - while (isascii((unsigned char) *cp) && isalpha((unsigned char) *cp)) + while (isascii((unsigned char) *cp) && + (isalnum((unsigned char)*cp) || *cp == '-' || *cp == '+')) ++cp; - if (cp - abbrp == 0) - wp = _("lacks alphabetic at start"); - else if (cp - abbrp < 3) - wp = _("has fewer than 3 alphabetics"); + if (cp - abbrp < 3) + wp = _("has fewer than 3 characters"); else if (cp - abbrp > 6) - wp = _("has more than 6 alphabetics"); - if (wp == NULL && (*cp == '+' || *cp == '-')) { - ++cp; - if (isascii((unsigned char) *cp) && - isdigit((unsigned char) *cp)) - if (*cp++ == '1' && *cp >= '0' && *cp <= '4') - ++cp; - if (*cp != '\0') - wp = _("differs from POSIX standard"); - } - if (wp == NULL) + wp = _("has more than 6 characters"); + else if (*cp) + wp = "has characters other than ASCII alphanumerics, '-' or '+'"; + else return; (void) fflush(stdout); (void) fprintf(stderr, Modified: stable/11/contrib/tzcode/zic/zic.c ============================================================================== --- stable/11/contrib/tzcode/zic/zic.c Sat Oct 15 12:35:16 2016 (r307357) +++ stable/11/contrib/tzcode/zic/zic.c Sat Oct 15 12:37:57 2016 (r307358) @@ -2615,29 +2615,15 @@ const char * const string; register const char * cp; register char * wp; - /* - ** Want one to ZIC_MAX_ABBR_LEN_WO_WARN alphabetics - ** optionally followed by a + or - and a number from 1 to 14. - */ cp = string; wp = NULL; while (isascii((unsigned char) *cp) && - isalpha((unsigned char) *cp)) + (isalnum((unsigned char)*cp) || *cp == '-' || *cp == '+')) ++cp; - if (cp - string == 0) -wp = _("time zone abbreviation lacks alphabetic at start"); if (noise && cp - string > 3) -wp = _("time zone abbreviation has more than 3 alphabetics"); +wp = _("time zone abbreviation has more than 3 characters"); if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN) -wp = _("time zone abbreviation has too many alphabetics"); - if (wp == NULL && (*cp == '+' || *cp == '-')) { - ++cp; - if (isascii((unsigned char) *cp) && - isdigit((unsigned char) *cp)) - if (*cp++ == '1' && - *cp >= '0' && *cp <= '4') - ++cp; - } +wp = _("time zone abbreviation has too many characters"); if (*cp != '\0') wp = _("time zone abbreviation differs from POSIX standard"); if (wp != NULL) { From owner-svn-src-stable-11@freebsd.org Sat Oct 15 12:41:13 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B9CAC132A9; Sat, 15 Oct 2016 12:41:13 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E18D1638; Sat, 15 Oct 2016 12:41:13 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9FCfCSs034314; Sat, 15 Oct 2016 12:41:12 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9FCfCPc034309; Sat, 15 Oct 2016 12:41:12 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610151241.u9FCfCPc034309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 15 Oct 2016 12:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307361 - stable/11/contrib/tzdata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 12:41:13 -0000 Author: bapt Date: Sat Oct 15 12:41:11 2016 New Revision: 307361 URL: https://svnweb.freebsd.org/changeset/base/307361 Log: MFC r306853 Import tzdata 2016g Modified: stable/11/contrib/tzdata/africa stable/11/contrib/tzdata/antarctica stable/11/contrib/tzdata/asia stable/11/contrib/tzdata/australasia stable/11/contrib/tzdata/backward stable/11/contrib/tzdata/etcetera stable/11/contrib/tzdata/europe stable/11/contrib/tzdata/factory stable/11/contrib/tzdata/leap-seconds.list stable/11/contrib/tzdata/leapseconds stable/11/contrib/tzdata/northamerica stable/11/contrib/tzdata/southamerica stable/11/contrib/tzdata/zone.tab stable/11/contrib/tzdata/zone1970.tab Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tzdata/africa ============================================================================== --- stable/11/contrib/tzdata/africa Sat Oct 15 12:38:50 2016 (r307360) +++ stable/11/contrib/tzdata/africa Sat Oct 15 12:41:11 2016 (r307361) @@ -343,6 +343,12 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 # decision to abandon DST permanently. See Ahram Online 2015-04-24. # http://english.ahram.org.eg/NewsContent/1/64/128509/Egypt/Politics-/Sisi-cancels-daylight-saving-time-in-Egypt.aspx +# From Steffen Thorsen (2016-04-29): +# Egypt will have DST from July 7 until the end of October.... +# http://english.ahram.org.eg/NewsContentP/1/204655/Egypt/Daylight-savings-time-returning-to-Egypt-on--July.aspx +# From Mina Samuel (2016-07-04): +# Egyptian government took the decision to cancel the DST, + Rule Egypt 2008 only - Aug lastThu 24:00 0 - Rule Egypt 2009 only - Aug 20 24:00 0 - Rule Egypt 2010 only - Aug 10 24:00 0 - @@ -458,7 +464,7 @@ Zone Africa/Monrovia -0:43:08 - LMT 1882 # http://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/ # # From Paul Eggert (2013-10-25): -# For now, assume they're reverting to the pre-2012 rules of permanent UTC+2. +# For now, assume they're reverting to the pre-2012 rules of permanent UT +02. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Libya 1951 only - Oct 14 2:00 1:00 S @@ -858,11 +864,11 @@ Rule Morocco 2009 only - Aug 21 0:00 0 Rule Morocco 2010 only - May 2 0:00 1:00 S Rule Morocco 2010 only - Aug 8 0:00 0 - Rule Morocco 2011 only - Apr 3 0:00 1:00 S -Rule Morocco 2011 only - Jul 31 0 0 - +Rule Morocco 2011 only - Jul 31 0:00 0 - Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 S -Rule Morocco 2012 only - Sep 30 3:00 0 - Rule Morocco 2012 only - Jul 20 3:00 0 - Rule Morocco 2012 only - Aug 20 2:00 1:00 S +Rule Morocco 2012 only - Sep 30 3:00 0 - Rule Morocco 2013 only - Jul 7 3:00 0 - Rule Morocco 2013 only - Aug 10 2:00 1:00 S Rule Morocco 2013 max - Oct lastSun 3:00 0 - Modified: stable/11/contrib/tzdata/antarctica ============================================================================== --- stable/11/contrib/tzdata/antarctica Sat Oct 15 12:38:50 2016 (r307360) +++ stable/11/contrib/tzdata/antarctica Sat Oct 15 12:41:11 2016 (r307361) @@ -10,10 +10,8 @@ # http://www.spri.cam.ac.uk/bob/periant.htm # for information. # Unless otherwise specified, we have no time zone information. -# -# Except for the French entries, -# I made up all time zone abbreviations mentioned here; corrections welcome! -# FORMAT is 'zzz' and GMTOFF is 0 for locations while uninhabited. + +# FORMAT is '-00' and GMTOFF is 0 for locations while uninhabited. # Argentina - year-round bases # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05 @@ -29,7 +27,7 @@ # previously sealers and scientific personnel wintered # Margaret Turner reports # http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html -# (1999-09-30) that they're UTC+5, with no DST; +# (1999-09-30) that they're UT +05, with no DST; # presumably this is when they have visitors. # # year-round bases @@ -67,24 +65,23 @@ # http://www.timeanddate.com/news/time/antartica-time-changes-2010.html # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Antarctica/Casey 0 - zzz 1969 - 8:00 - AWST 2009 Oct 18 2:00 - # Australian Western Std Time - 11:00 - CAST 2010 Mar 5 2:00 # Casey Time - 8:00 - AWST 2011 Oct 28 2:00 - 11:00 - CAST 2012 Feb 21 17:00u - 8:00 - AWST -Zone Antarctica/Davis 0 - zzz 1957 Jan 13 - 7:00 - DAVT 1964 Nov # Davis Time - 0 - zzz 1969 Feb - 7:00 - DAVT 2009 Oct 18 2:00 - 5:00 - DAVT 2010 Mar 10 20:00u - 7:00 - DAVT 2011 Oct 28 2:00 - 5:00 - DAVT 2012 Feb 21 20:00u - 7:00 - DAVT -Zone Antarctica/Mawson 0 - zzz 1954 Feb 13 - 6:00 - MAWT 2009 Oct 18 2:00 # Mawson Time - 5:00 - MAWT +Zone Antarctica/Casey 0 - -00 1969 + 8:00 - +08 2009 Oct 18 2:00 + 11:00 - +11 2010 Mar 5 2:00 + 8:00 - +08 2011 Oct 28 2:00 + 11:00 - +11 2012 Feb 21 17:00u + 8:00 - +08 +Zone Antarctica/Davis 0 - -00 1957 Jan 13 + 7:00 - +07 1964 Nov + 0 - -00 1969 Feb + 7:00 - +07 2009 Oct 18 2:00 + 5:00 - +05 2010 Mar 10 20:00u + 7:00 - +07 2011 Oct 28 2:00 + 5:00 - +05 2012 Feb 21 20:00u + 7:00 - +07 +Zone Antarctica/Mawson 0 - -00 1954 Feb 13 + 6:00 - +06 2009 Oct 18 2:00 + 5:00 - +05 # References: # Casey Weather (1998-02-26) # http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html @@ -137,8 +134,8 @@ Zone Antarctica/Mawson 0 - zzz 1954 Feb # fishing stations operated variously 1819/1931 # # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Kerguelen 0 - zzz 1950 # Port-aux-Français - 5:00 - TFT # ISO code TF Time +Zone Indian/Kerguelen 0 - -00 1950 # Port-aux-Français + 5:00 - +05 # # year-round base in the main continent # Dumont d'Urville, Île des Pétrels, -6640+14001, since 1956-11 @@ -148,10 +145,10 @@ Zone Indian/Kerguelen 0 - zzz 1950 # Por # It was destroyed by fire on 1952-01-14. # # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Antarctica/DumontDUrville 0 - zzz 1947 - 10:00 - PMT 1952 Jan 14 # Port-Martin Time - 0 - zzz 1956 Nov - 10:00 - DDUT # Dumont-d'Urville Time +Zone Antarctica/DumontDUrville 0 - -00 1947 + 10:00 - +10 1952 Jan 14 + 0 - -00 1956 Nov + 10:00 - +10 # France & Italy - year-round base # Concordia, -750600+1232000, since 2005 @@ -176,8 +173,8 @@ Zone Antarctica/DumontDUrville 0 - zzz 1 # was established on 1957-01-29. Since Syowa station is still the main # station of Japan, it's appropriate for the principal location. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Antarctica/Syowa 0 - zzz 1957 Jan 29 - 3:00 - SYOT # Syowa Time +Zone Antarctica/Syowa 0 - -00 1957 Jan 29 + 3:00 - +03 # See: # NIPR Antarctic Research Activities (1999-08-17) # http://www.nipr.ac.jp/english/ara01.html @@ -214,19 +211,19 @@ Zone Antarctica/Syowa 0 - zzz 1957 Jan 2 # correct, but they should be quite close to the actual dates. # # From Paul Eggert (2014-03-21): -# The CET-switching Troll rules require zic from tzcode 2014b or later, so as +# The CET-switching Troll rules require zic from tz 2014b or later, so as # suggested by Bengt-Inge Larsson comment them out for now, and approximate # with only UTC and CEST. Uncomment them when 2014b is more prevalent. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -#Rule Troll 2005 max - Mar 1 1:00u 1:00 CET -Rule Troll 2005 max - Mar lastSun 1:00u 2:00 CEST -#Rule Troll 2005 max - Oct lastSun 1:00u 1:00 CET -#Rule Troll 2004 max - Nov 7 1:00u 0:00 UTC +#Rule Troll 2005 max - Mar 1 1:00u 1:00 +01 +Rule Troll 2005 max - Mar lastSun 1:00u 2:00 +02 +#Rule Troll 2005 max - Oct lastSun 1:00u 1:00 +01 +#Rule Troll 2004 max - Nov 7 1:00u 0:00 +00 # Remove the following line when uncommenting the above '#Rule' lines. -Rule Troll 2004 max - Oct lastSun 1:00u 0:00 UTC +Rule Troll 2004 max - Oct lastSun 1:00u 0:00 +00 # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Antarctica/Troll 0 - zzz 2005 Feb 12 +Zone Antarctica/Troll 0 - -00 2005 Feb 12 0:00 Troll %s # Poland - year-round base @@ -265,10 +262,10 @@ Zone Antarctica/Troll 0 - zzz 2005 Feb 1 # changes during the year and does not necessarily correspond to mean # solar noon. So the Vostok time might have been whatever the clocks # happened to be during their visit. So we still don't really know what time -# it is at Vostok. But we'll guess UTC+6. +# it is at Vostok. But we'll guess +06. # -Zone Antarctica/Vostok 0 - zzz 1957 Dec 16 - 6:00 - VOST # Vostok time +Zone Antarctica/Vostok 0 - -00 1957 Dec 16 + 6:00 - +06 # S Africa - year-round bases # Marion Island, -4653+03752 @@ -300,8 +297,8 @@ Zone Antarctica/Vostok 0 - zzz 1957 Dec # says Rothera is -03 all year. # # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Antarctica/Rothera 0 - zzz 1976 Dec 1 - -3:00 - ROTT # Rothera time +Zone Antarctica/Rothera 0 - -00 1976 Dec 1 + -3:00 - -03 # Uruguay - year round base # Artigas, King George Island, -621104-0585107 Modified: stable/11/contrib/tzdata/asia ============================================================================== --- stable/11/contrib/tzdata/asia Sat Oct 15 12:38:50 2016 (r307360) +++ stable/11/contrib/tzdata/asia Sat Oct 15 12:41:11 2016 (r307361) @@ -79,13 +79,9 @@ Rule E-EurAsia 1979 1995 - Sep lastSun Rule E-EurAsia 1996 max - Oct lastSun 0:00 0 - Rule RussiaAsia 1981 1984 - Apr 1 0:00 1:00 S Rule RussiaAsia 1981 1983 - Oct 1 0:00 0 - -Rule RussiaAsia 1984 1991 - Sep lastSun 2:00s 0 - -Rule RussiaAsia 1985 1991 - Mar lastSun 2:00s 1:00 S -Rule RussiaAsia 1992 only - Mar lastSat 23:00 1:00 S -Rule RussiaAsia 1992 only - Sep lastSat 23:00 0 - -Rule RussiaAsia 1993 max - Mar lastSun 2:00s 1:00 S -Rule RussiaAsia 1993 1995 - Sep lastSun 2:00s 0 - -Rule RussiaAsia 1996 max - Oct lastSun 2:00s 0 - +Rule RussiaAsia 1984 1995 - Sep lastSun 2:00s 0 - +Rule RussiaAsia 1985 2011 - Mar lastSun 2:00s 1:00 S +Rule RussiaAsia 1996 2011 - Oct lastSun 2:00s 0 - # Afghanistan # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -120,31 +116,37 @@ Zone Asia/Kabul 4:36:48 - LMT 1890 # http://www.worldtimezone.com/dst_news/dst_news_armenia03.html # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 - 3:00 - YERT 1957 Mar # Yerevan Time - 4:00 RussiaAsia YER%sT 1991 Mar 31 2:00s - 3:00 1:00 YERST 1991 Sep 23 # independence - 3:00 RussiaAsia AM%sT 1995 Sep 24 2:00s - 4:00 - AMT 1997 - 4:00 RussiaAsia AM%sT 2012 Mar 25 2:00s - 4:00 - AMT + 3:00 - +03 1957 Mar + 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s + 3:00 RussiaAsia +03/+04 1995 Sep 24 2:00s + 4:00 - +04 1997 + 4:00 RussiaAsia +04/+05 # Azerbaijan + # From Rustam Aliyev of the Azerbaijan Internet Forum (2005-10-23): # According to the resolution of Cabinet of Ministers, 1997 # From Paul Eggert (2015-09-17): It was Resolution No. 21 (1997-03-17). # http://code.az/files/daylight_res.pdf + +# From Steffen Thorsen (2016-03-17): +# ... the Azerbaijani Cabinet of Ministers has cancelled switching to +# daylight saving time.... +# http://www.azernews.az/azerbaijan/94137.html +# http://vestnikkavkaza.net/news/Azerbaijani-Cabinet-of-Ministers-cancels-daylight-saving-time.html +# http://en.apa.az/xeber_azerbaijan_abolishes_daylight_savings_ti_240862.html + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Azer 1997 max - Mar lastSun 4:00 1:00 S -Rule Azer 1997 max - Oct lastSun 5:00 0 - +Rule Azer 1997 2015 - Mar lastSun 4:00 1:00 S +Rule Azer 1997 2015 - Oct lastSun 5:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Baku 3:19:24 - LMT 1924 May 2 - 3:00 - BAKT 1957 Mar # Baku Time - 4:00 RussiaAsia BAK%sT 1991 Mar 31 2:00s - 3:00 1:00 BAKST 1991 Aug 30 # independence - 3:00 RussiaAsia AZ%sT 1992 Sep lastSat 23:00 - 4:00 - AZT 1996 # Azerbaijan Time - 4:00 EUAsia AZ%sT 1997 - 4:00 Azer AZ%sT + 3:00 - +03 1957 Mar + 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s + 3:00 RussiaAsia +03/+04 1992 Sep lastSun 2:00s + 4:00 - +04 1996 + 4:00 EUAsia +04/+05 1997 + 4:00 Azer +04/+05 # Bahrain # See Asia/Qatar. @@ -263,7 +265,7 @@ Zone Asia/Brunei 7:39:40 - LMT 1926 Mar # Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Rangoon 6:24:40 - LMT 1880 # or Yangon +Zone Asia/Yangon 6:24:40 - LMT 1880 # or Rangoon 6:24:40 - RMT 1920 # Rangoon Mean Time? 6:30 - BURT 1942 May # Burma Time 9:00 - JST 1945 May 3 @@ -378,7 +380,7 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1: # Lewiston (ME) Daily Sun (1939-05-29), p 17, said "Even the time is # different - the occupied districts going by Tokyo time, an hour # ahead of that prevailing in the rest of Shanghai." Guess that the -# Xujiahui Observatory was under French control and stuck with UT+8. +# Xujiahui Observatory was under French control and stuck with UT +08. # # In earlier versions of this file, China had many separate Zone entries, but # this was based on what were apparently incorrect data in Shanks & Pottenger. @@ -387,26 +389,26 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1: # Proposed in 1918 and theoretically in effect until 1949 (although in practice # mainly observed in coastal areas), the five zones were: # -# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT+8.5 +# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT +08:30 # Asia/Harbin (currently a link to Asia/Shanghai) # Heilongjiang (except Mohe county), Jilin # -# Zhongyuan Time ("Central plain Time") UT+8 +# Zhongyuan Time ("Central plain Time") UT +08 # Asia/Shanghai # most of China # This currently represents most other zones as well, # as apparently these regions have been the same since 1970. # Milne gives 8:05:43.2 for Xujiahui Observatory time; round to nearest. -# Guo says Shanghai switched to UT+8 "from the end of the 19th century". +# Guo says Shanghai switched to UT +08 "from the end of the 19th century". # -# Long-shu Time (probably due to Long and Shu being two names of that area) UT+7 +# Long-shu Time (probably due to Long and Shu being two names of the area) UT +07 # Asia/Chongqing (currently a link to Asia/Shanghai) # Guangxi, Guizhou, Hainan, Ningxia, Sichuan, Shaanxi, and Yunnan; # most of Gansu; west Inner Mongolia; west Qinghai; and the Guangdong # counties Deqing, Enping, Kaiping, Luoding, Taishan, Xinxing, # Yangchun, Yangjiang, Yu'nan, and Yunfu. # -# Xin-zang Time ("Xinjiang-Tibet Time") UT+6 +# Xin-zang Time ("Xinjiang-Tibet Time") UT +06 # Asia/Urumqi # This currently represents Kunlun Time as well, # as apparently the two regions have been the same since 1970. @@ -419,7 +421,7 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1: # Shihezi, Changji, Yanqi, Heshuo, Tuokexun, Tulufan, Shanshan, Hami, # Fukang, Kuitun, Kumukuli, Miquan, Qitai, and Turfan. # -# Kunlun Time UT+5.5 +# Kunlun Time UT +05:30 # Asia/Kashgar (currently a link to Asia/Urumqi) # West Tibet, including Pulan, Aheqi, Shufu, Shule; # West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke, @@ -435,7 +437,7 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1: # # On the other hand, ethnic Uyghurs, who make up about half the # population of Xinjiang, typically use "Xinjiang time" which is two -# hours behind Beijing time, or UTC +0600. The government of the Xinjiang +# hours behind Beijing time, or UT +06. The government of the Xinjiang # Uyghur Autonomous Region, (XAUR, or just Xinjiang for short) as well as # local governments such as the Ürümqi city government use both times in # publications, referring to what is popularly called Xinjiang time as @@ -491,8 +493,8 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1: # having the same time as Beijing. # From Paul Eggert (2014-06-30): -# In the early days of the PRC, Tibet was given its own time zone (UT+6) but -# this was withdrawn in 1959 and never reinstated; see Tubten Khétsun, +# In the early days of the PRC, Tibet was given its own time zone (UT +06) +# but this was withdrawn in 1959 and never reinstated; see Tubten Khétsun, # Memories of life in Lhasa under Chinese Rule, Columbia U Press, ISBN # 978-0231142861 (2008), translator's introduction by Matthew Akester, p x. # As this is before our 1970 cutoff, Tibet doesn't need a separate zone. @@ -506,12 +508,12 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1: # Republics, the Soviet Union, the Kuomintang, and the People's Republic of # China, and tracking down all these organizations' timekeeping rules would be # quite a trick. Approximate this lost history by a transition from LMT to -# XJT at the start of 1928, the year of accession of the warlord Jin Shuren, +# UT +06 at the start of 1928, the year of accession of the warlord Jin Shuren, # which happens to be the date given by Shanks & Pottenger (no doubt as a -# guess) as the transition from LMT. Ignore the usage of UT+8 before -# 1986-02-01 under the theory that the transition date to UT+8 is unknown and +# guess) as the transition from LMT. Ignore the usage of +08 before +# 1986-02-01 under the theory that the transition date to +08 is unknown and # that the sort of users who prefer Asia/Urumqi now typically ignored the -# UT+8 mandate back then. +# +08 mandate back then. # Zone NAME GMTOFF RULES FORMAT [UNTIL] # Beijing time, used throughout China; represented by Shanghai. @@ -716,7 +718,7 @@ Zone Asia/Hong_Kong 7:36:42 - LMT 1904 O # be found from historical government announcement database. # From Paul Eggert (2014-07-03): -# As per Yu-Cheng Chuang, say that Taiwan was at UT+9 from 1937-10-01 +# As per Yu-Cheng Chuang, say that Taiwan was at UT +09 from 1937-10-01 # until 1945-09-21 at 01:00, overriding Shanks & Pottenger. # Likewise, use Yu-Cheng Chuang's data for DST in Taiwan. @@ -830,16 +832,15 @@ Link Asia/Nicosia Europe/Nicosia # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Tbilisi 2:59:11 - LMT 1880 2:59:11 - TBMT 1924 May 2 # Tbilisi Mean Time - 3:00 - TBIT 1957 Mar # Tbilisi Time - 4:00 RussiaAsia TBI%sT 1991 Mar 31 2:00s - 3:00 1:00 TBIST 1991 Apr 9 # independence - 3:00 RussiaAsia GE%sT 1992 # Georgia Time - 3:00 E-EurAsia GE%sT 1994 Sep lastSun - 4:00 E-EurAsia GE%sT 1996 Oct lastSun - 4:00 1:00 GEST 1997 Mar lastSun - 4:00 E-EurAsia GE%sT 2004 Jun 27 - 3:00 RussiaAsia GE%sT 2005 Mar lastSun 2:00 - 4:00 - GET + 3:00 - +03 1957 Mar + 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s + 3:00 RussiaAsia +03/+04 1992 + 3:00 E-EurAsia +03/+04 1994 Sep lastSun + 4:00 E-EurAsia +04/+05 1996 Oct lastSun + 4:00 1:00 +05 1997 Mar lastSun + 4:00 E-EurAsia +04/+05 2004 Jun 27 + 3:00 RussiaAsia +03/+04 2005 Mar lastSun 2:00 + 4:00 - +04 # East Timor @@ -874,6 +875,15 @@ Zone Asia/Dili 8:22:20 - LMT 1912 Jan 1 9:00 - TLT # India + +# From Ian P. Beacock, in "A brief history of (modern) time", The Atlantic +# http://www.theatlantic.com/technology/archive/2015/12/the-creation-of-modern-time/421419/ +# (2015-12-22): +# In January 1906, several thousand cotton-mill workers rioted on the +# outskirts of Bombay.... They were protesting the proposed abolition of +# local time in favor of Indian Standard Time.... Journalists called this +# dispute the "Battle of the Clocks." It lasted nearly half a century. + # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Kolkata 5:53:28 - LMT 1880 # Kolkata 5:53:20 - HMT 1941 Oct # Howrah Mean Time? @@ -907,7 +917,7 @@ Zone Asia/Kolkata 5:53:28 - LMT 1880 # These would be the earliest possible times for a change. # Régimes horaires pour le monde entier, by Henri Le Corre, (Éditions # Traditionnelles, 1987, Paris) says that Java and Madura switched -# from JST to UTC+07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura +# from UT +09 to +07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura # (Hollandia). For now, assume all Indonesian locations other than Jayapura # switched on 1945-09-23. # @@ -918,11 +928,11 @@ Zone Asia/Kolkata 5:53:28 - LMT 1880 # summary published by the Time and Frequency Laboratory of the # Research Center for Calibration, Instrumentation and Metrology, # Indonesia, (2006-09-29). -# The abbreviations are: +# The time zone abbreviations and UT offsets are: # -# WIB - UTC+7 - Waktu Indonesia Barat (Indonesia western time) -# WITA - UTC+8 - Waktu Indonesia Tengah (Indonesia central time) -# WIT - UTC+9 - Waktu Indonesia Timur (Indonesia eastern time) +# WIB - +07 - Waktu Indonesia Barat (Indonesia western time) +# WITA - +08 - Waktu Indonesia Tengah (Indonesia central time) +# WIT - +09 - Waktu Indonesia Timur (Indonesia eastern time) # # Zone NAME GMTOFF RULES FORMAT [UNTIL] # Java, Sumatra @@ -1084,8 +1094,15 @@ Rule Iran 2032 2033 - Mar 21 0:00 1:00 D Rule Iran 2032 2033 - Sep 21 0:00 0 S Rule Iran 2034 2035 - Mar 22 0:00 1:00 D Rule Iran 2034 2035 - Sep 22 0:00 0 S -Rule Iran 2036 2037 - Mar 21 0:00 1:00 D -Rule Iran 2036 2037 - Sep 21 0:00 0 S +# +# The following rules are approximations starting in the year 2038. +# These are the best post-2037 approximations available, given the +# restrictions of a single rule using a Gregorian-based data format. +# At some point this table will need to be extended, though quite +# possibly Iran will change the rules first. +Rule Iran 2036 max - Mar 21 0:00 1:00 D +Rule Iran 2036 max - Sep 21 0:00 0 S + # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Tehran 3:25:44 - LMT 1916 3:25:44 - TMT 1946 # Tehran Mean Time @@ -1542,23 +1559,6 @@ Zone Asia/Amman 2:23:44 - LMT 1931 # Kazakhstan -# From Paul Eggert (1996-11-22): -# Andrew Evtichov (1996-04-13) writes that Kazakhstan -# stayed in sync with Moscow after 1990, and that Aqtobe (formerly Aktyubinsk) -# and Aqtau (formerly Shevchenko) are the largest cities in their zones. -# Guess that Aqtau and Aqtobe diverged in 1995, since that's the first time -# IATA SSIM mentions a third time zone in Kazakhstan. - -# From Paul Eggert (2006-03-22): -# German Iofis, ELSI, Almaty (2001-10-09) reports that Kazakhstan uses -# RussiaAsia rules, instead of switching at 00:00 as the IATA has it. -# Go with Shanks & Pottenger, who have them always using RussiaAsia rules. -# Also go with the following claims of Shanks & Pottenger: -# -# - Kazakhstan did not observe DST in 1991. -# - Qyzylorda switched from +5:00 to +6:00 on 1992-01-19 02:00. -# - Oral switched from +5:00 to +4:00 in spring 1989. - # From Kazakhstan Embassy's News Bulletin No. 11 # (2005-03-21): # The Government of Kazakhstan passed a resolution March 15 abolishing @@ -1575,61 +1575,232 @@ Zone Asia/Amman 2:23:44 - LMT 1931 # everything else.... I guess that would make Kazakhstan time zones # de jure UTC+5 and UTC+6 respectively. +# From Stepan Golosunov (2016-03-27) ([*] means see later comments below): +# Review of the linked documents from http://adilet.zan.kz/ +# produced the following data for post-1991 Kazakhstan: +# +# 0. Act of the Cabinet of Ministers of the USSR +# from 1991-02-04 No. 20 +# http://pravo.gov.ru/proxy/ips/?docbody=&nd=102010545 +# removed the extra hour ("decree time") on the territory of the USSR +# starting with the last Sunday of March 1991. +# It also allowed (but not mandated) Kazakh SSR, Kirghiz SSR, Tajik SSR, +# Turkmen SSR and Uzbek SSR to not have "summer" time. +# +# The 1992-01-13 act also refers to the act of the Cabinet of Ministers +# of the Kazakh SSR from 1991-03-20 No. 170 "About the act of the Cabinet +# of Ministers of the USSR from 1991-02-04 No. 20" but I didn't found its +# text. +# +# According to Izvestia newspaper No. 68 (23334) from 1991-03-20 +# (page 6; available at http://libinfo.org/newsr/newsr2574.djvu via +# http://libinfo.org/index.php?id=58564) on 1991-03-31 at 2:00 during +# transition to "summer" time: +# Republic of Georgia, Latvian SSR, Lithuanian SSR, SSR Moldova, +# Estonian SSR; Komi ASSR; Kaliningrad oblast; Nenets autonomous okrug +# were to move clocks 1 hour forward. +# Kazakh SSR (excluding Uralsk oblast); Republic of Kyrgyzstan, Tajik +# SSR; Andijan, Jizzakh, Namangan, Sirdarya, Tashkent, Fergana oblasts +# of the Uzbek SSR were to move clocks 1 hour backwards. +# Other territories were to not move clocks. +# When the "summer" time would end on 1991-09-29, clocks were to be +# moved 1 hour backwards on the territory of the USSR excluding +# Kazakhstan, Kirghizia, Uzbekistan, Turkmenia, Tajikistan. +# +# Apparently there were last minute changes. Apparently Kazakh act No. 170 +# was one of such changes. +# +# https://ru.wikipedia.org/wiki/Декретное время +# claims that Sovetskaya Rossiya newspaper on 1991-03-29 published that +# Nenets autonomous okrug, Komi and Kazakhstan (excluding Uralsk oblast) +# were to not move clocks and Uralsk oblast was to move clocks +# forward; on 1991-09-29 Kazakhstan was to move clocks backwards. +# (Probably there were changes even after that publication. There is an +# article claiming that Kaliningrad oblast decided on 1991-03-29 to not +# move clocks.) +# +# This implies that on 1991-03-31 Asia/Oral remained on +04/+05 while +# the rest of Kazakhstan switched from +06/+07 to +05/06 or from +05/06 +# to +04/+05. It's unclear how Kzyl-Orda oblast moved into the fifth +# time belt. (By switching from +04/+05 to +05/+06 on 1991-09-29?) ... +# +# 1. Act of the Cabinet of Ministers of the Republic of Kazakhstan +# from 1992-01-13 No. 28 +# http://adilet.zan.kz/rus/docs/P920000028_ +# (text includes modification from the 1996 act) +# introduced new rules for calculation of time, mirroring Russian +# 1992-01-08 act. It specified that time would be calculated +# according to time belts plus extra hour ("decree time"), moved clocks +# on the whole territory of Kazakhstan 1 hour forward on 1992-01-19 at +# 2:00, specified DST rules. It acknowledged that Kazakhstan was +# located in the fourth and the fifth time belts and specified the +# border between them to be located east of Kustanay and Aktyubinsk +# oblasts (notably including Turgai and Kzyl-Orda oblasts into the fifth +# time belt). +# +# This means switch on 1992-01-19 at 2:00 from +04/+05 to +05/+06 for +# Asia/Aqtau, Asia/Aqtobe, Asia/Oral, Atyrau and Kustanay oblasts; from +# +05/+06 to +06/+07 for Asia/Almaty and Asia/Qyzylorda (and Arkalyk) [*].... +# +# 2. Act of the Cabinet of Ministers of the Republic of Kazakhstan +# from 1992-03-27 No. 284 +# http://adilet.zan.kz/rus/docs/P920000284_ +# cancels extra hour ("decree time") for Uralsk and Kzyl-Orda oblasts +# since the last Sunday of March 1992, while keeping them in the fourth +# and the fifth time belts respectively. +# +# 3. Order of the Prime Minister of the Republic of Kazakhstan +# from 1994-09-23 No. 384 +# http://adilet.zan.kz/rus/docs/R940000384_ +# cancels the extra hour ("decree time") on the territory of Mangystau +# oblast since the last Sunday of September 1994 (saying that time on +# the territory would correspond to the third time belt as a +# result).... +# +# 4. Act of the Government of the Republic of Kazakhstan +# from 1996-05-08 No. 575 +# http://adilet.zan.kz/rus/docs/P960000575_ +# amends the 1992-01-13 act to end summer time in October instead +# of September, mirroring identical Russian change from 1996-04-23 act. +# +# 5. Act of the Government of the Republic of Kazakhstan +# from 1999-03-26 No. 305 +# http://adilet.zan.kz/rus/docs/P990000305_ +# cancels the extra hour ("decree time") for Atyrau oblast since the +# last Sunday of March 1999 while retaining the oblast in the fourth +# time belt. +# +# This means change from +05/+06 to +04/+05. +# +# There is no zone for Atyrau currently (listed under Asia/Aqtau in +# zone1970.tab).[*] +# +# 6. Act of the Government of the Republic of Kazakhstan +# from 2000-11-23 No. 1749 +# http://adilet.zan.kz/rus/archive/docs/P000001749_/23.11.2000 +# replaces the previous five documents. +# +# The only changes I noticed are in definition of the border between the +# fourth and the fifth time belts. They account for changes in spelling +# and administrative division (splitting of Turgai oblast in 1997 +# probably changed time in territories incorporated into Kostanay oblast +# (including Arkalyk) from +06/+07 to +05/+06) and move Kyzylorda oblast +# from being in the fifth time belt and not using decree time into the +# fourth time belt (no change in practice).[*] +# +# 7. Act of the Government of the Republic of Kazakhstan +# from 2003-12-29 No. 1342 +# http://adilet.zan.kz/rus/docs/P030001342_ +# modified the 2000-11-23 act. No relevant changes, apparently. +# +# 8. Act of the Government of the Republic of Kazakhstan +# from 2004-07-20 No. 775 +# http://adilet.zan.kz/rus/archive/docs/P040000775_/20.07.2004 +# modified the 2000-11-23 act to move Kostanay and Kyzylorda oblasts into +# the fifth time belt and add Aktobe oblast to the list of regions not +# using extra hour ("decree time"), leaving Kazakhstan with only 2 time +# zones (+04/+05 and +06/+07). The changes were to be implemented +# during DST transitions in 2004 and 2005 but the acts got radically +# amended before implementation happened. +# +# 9. Act of the Government of the Republic of Kazakhstan +# from 2004-09-15 No. 1059 +# http://adilet.zan.kz/rus/docs/P040001059_ +# modified the 2000-11-23 act to remove exceptions from the "decree time" +# (leaving Kazakhstan in +05/+06 and +06/+07 zones), amended the +# 2004-07-20 act to implement changes for Atyrau, West Kazakhstan, +# Kostanay, Kyzylorda and Mangystau oblasts by not moving clocks +# during the 2014 transition to "winter" time. +# +# This means transition from +04/+05 to +05/+06 for Atyrau oblast (no +# zone currently), Asia/Oral, Asia/Aqtau and transition from +05/+06 to +# +06/+07 for Kostanay oblast (Kostanay and Arkalyk, no zones currently) +# and Asia/Qyzylorda on 2004-10-31 at 3:00....[*] +# +# 10. Act of the Government of the Republic of Kazakhstan +# from 2005-03-15 No. 231 +# http://adilet.zan.kz/rus/docs/P050000231_ +# removes DST provisions from the 2000-11-23 act, removes most of the +# (already implemented) provisions from the 2004-07-20 and 2004-09-15 +# acts, comes into effect 10 days after official publication. +# The only practical effect seems to be the abolition of the summer +# time. +# +# Unamended version of the act of the Government of the Russian Federation +# No. 23 from 1992-01-08 [See 'europe' file for details]. +# Kazakh 1992-01-13 act appears to provide the same rules and 1992-03-27 +# act was to be enacted on the last Sunday of March 1992. + +# From Paul Eggert (2016-04-15): +# The tables below should reflect Stepan Golosunov's remarks above, +# except for the items marked "[*]" which I haven't gotten to yet. +# It looks like we will need new zones Asia/Atyrau and Asia/Qostanay +# to handle changes from 1992 through 2004 that we did not previously +# know about. + # # Zone NAME GMTOFF RULES FORMAT [UNTIL] # # Almaty (formerly Alma-Ata), representing most locations in Kazakhstan +# This includes KZ-AKM, KZ-ALA, KZ-ALM, KZ-AST, KZ-BAY, KZ-VOS, KZ-ZHA, +# KZ-KAR, KZ-SEV, KZ-PAV, and KZ-YUZ. Zone Asia/Almaty 5:07:48 - LMT 1924 May 2 # or Alma-Ata - 5:00 - ALMT 1930 Jun 21 # Alma-Ata Time - 6:00 RussiaAsia ALM%sT 1991 - 6:00 - ALMT 1992 - 6:00 RussiaAsia ALM%sT 2005 Mar 15 - 6:00 - ALMT -# Qyzylorda (aka Kyzylorda, Kizilorda, Kzyl-Orda, etc.) + 5:00 - +05 1930 Jun 21 + 6:00 RussiaAsia +06/+07 1991 Mar 31 2:00s + 5:00 RussiaAsia +05/+06 1992 Jan 19 2:00s + 6:00 RussiaAsia +06/+07 2004 Oct 31 2:00s + 6:00 - +06 +# Qyzylorda (aka Kyzylorda, Kizilorda, Kzyl-Orda, etc.) (KZ-KZY) Zone Asia/Qyzylorda 4:21:52 - LMT 1924 May 2 - 4:00 - KIZT 1930 Jun 21 # Kizilorda Time - 5:00 - KIZT 1981 Apr 1 - 5:00 1:00 KIZST 1981 Oct 1 - 6:00 - KIZT 1982 Apr 1 - 5:00 RussiaAsia KIZ%sT 1991 - 5:00 - KIZT 1991 Dec 16 # independence - 5:00 - QYZT 1992 Jan 19 2:00 - 6:00 RussiaAsia QYZ%sT 2005 Mar 15 - 6:00 - QYZT -# Aqtobe (aka Aktobe, formerly Aktyubinsk) + 4:00 - +04 1930 Jun 21 + 5:00 - +05 1981 Apr 1 + 5:00 1:00 +06 1981 Oct 1 + 6:00 - +06 1982 Apr 1 + 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s + 4:00 RussiaAsia +04/+05 1991 Sep 29 2:00s + 5:00 RussiaAsia +05/+06 1992 Jan 19 2:00s + 6:00 RussiaAsia +06/+07 1992 Mar 29 2:00s + 5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s + 6:00 - +06 +# Aqtobe (aka Aktobe, formerly Aktyubinsk) (KZ-AKT) Zone Asia/Aqtobe 3:48:40 - LMT 1924 May 2 - 4:00 - AKTT 1930 Jun 21 # Aktyubinsk Time - 5:00 - AKTT 1981 Apr 1 - 5:00 1:00 AKTST 1981 Oct 1 - 6:00 - AKTT 1982 Apr 1 - 5:00 RussiaAsia AKT%sT 1991 - 5:00 - AKTT 1991 Dec 16 # independence - 5:00 RussiaAsia AQT%sT 2005 Mar 15 # Aqtobe Time - 5:00 - AQTT -# Mangghystau + 4:00 - +04 1930 Jun 21 + 5:00 - +05 1981 Apr 1 + 5:00 1:00 +06 1981 Oct 1 + 6:00 - +06 1982 Apr 1 + 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s + 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s + 5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s + 5:00 - +05 +# Qostanay (KZ-KUS) + +# Mangghystau (KZ-MAN) # Aqtau was not founded until 1963, but it represents an inhabited region, # so include time stamps before 1963. Zone Asia/Aqtau 3:21:04 - LMT 1924 May 2 - 4:00 - FORT 1930 Jun 21 # Fort Shevchenko T - 5:00 - FORT 1963 - 5:00 - SHET 1981 Oct 1 # Shevchenko Time - 6:00 - SHET 1982 Apr 1 - 5:00 RussiaAsia SHE%sT 1991 - 5:00 - SHET 1991 Dec 16 # independence - 5:00 RussiaAsia AQT%sT 1995 Mar lastSun 2:00 # Aqtau Time - 4:00 RussiaAsia AQT%sT 2005 Mar 15 - 5:00 - AQTT -# West Kazakhstan + 4:00 - +04 1930 Jun 21 + 5:00 - +05 1963 + 5:00 - +05 1981 Oct 1 + 6:00 - +06 1982 Apr 1 + 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s + 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s + 5:00 RussiaAsia +05/+06 1994 Sep 25 2:00s + 4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s + 5:00 - +05 + +# West Kazakhstan (KZ-ZAP) +# From Paul Eggert (2016-03-18): +# The 1989 transition is from USSR act No. 227 (1989-03-14). Zone Asia/Oral 3:25:24 - LMT 1924 May 2 # or Ural'sk - 4:00 - URAT 1930 Jun 21 # Ural'sk time - 5:00 - URAT 1981 Apr 1 - 5:00 1:00 URAST 1981 Oct 1 - 6:00 - URAT 1982 Apr 1 - 5:00 RussiaAsia URA%sT 1989 Mar 26 2:00 - 4:00 RussiaAsia URA%sT 1991 - 4:00 - URAT 1991 Dec 16 # independence - 4:00 RussiaAsia ORA%sT 2005 Mar 15 # Oral Time - 5:00 - ORAT + 4:00 - +04 1930 Jun 21 + 5:00 - +05 1981 Apr 1 + 5:00 1:00 +06 1981 Oct 1 + 6:00 - +06 1982 Apr 1 + 5:00 RussiaAsia +05/+06 1989 Mar 26 2:00s + 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s + 5:00 RussiaAsia +05/+06 1992 Mar 29 2:00s + 4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s + 5:00 - +05 # Kyrgyzstan (Kirgizstan) # Transitions through 1991 are from Shanks & Pottenger. @@ -1650,11 +1821,11 @@ Rule Kyrgyz 1997 2005 - Mar lastSun 2:30 Rule Kyrgyz 1997 2004 - Oct lastSun 2:30 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Bishkek 4:58:24 - LMT 1924 May 2 - 5:00 - FRUT 1930 Jun 21 # Frunze Time - 6:00 RussiaAsia FRU%sT 1991 Mar 31 2:00s - 5:00 1:00 FRUST 1991 Aug 31 2:00 # independence - 5:00 Kyrgyz KG%sT 2005 Aug 12 # Kyrgyzstan Time - 6:00 - KGT + 5:00 - +05 1930 Jun 21 + 6:00 RussiaAsia +06/+07 1991 Mar 31 2:00s + 5:00 RussiaAsia +05/+06 1991 Aug 31 2:00 + 5:00 Kyrgyz +05/+06 2005 Aug 12 + 6:00 - +06 ############################################################################### @@ -1693,25 +1864,24 @@ Rule ROK 1957 1960 - Sep Sun>=18 0:00 0 Rule ROK 1987 1988 - May Sun>=8 2:00 1:00 D Rule ROK 1987 1988 - Oct Sun>=8 3:00 0 S -# From Paul Eggert (2014-10-30): +# From Paul Eggert (2016-08-23): # The Korean Wikipedia entry gives the following sources for UT offsets: # -# 1908: Official Journal Article No. 3994 (Edict No. 5) +# 1908: Official Journal Article No. 3994 (decree No. 5) # 1912: Governor-General of Korea Official Gazette Issue No. 367 # (Announcement No. 338) # 1954: Presidential Decree No. 876 (1954-03-17) # 1961: Law No. 676 (1961-08-07) -# 1987: Law No. 3919 (1986-12-31) # -# The Wikipedia entry also has confusing information about a change -# to UT+9 in April 1910, but then what would be the point of the later change -# to UT+9 on 1912-01-01? Omit the 1910 change for now. +# (Another source "1987: Law No. 3919 (1986-12-31)" was in the 2014-10-30 +# edition of the Korean Wikipedia entry.) # # I guessed that time zone abbreviations through 1945 followed the same # rules as discussed under Taiwan, with nominal switches from JST to KST # when the respective cities were taken over by the Allies after WWII. # -# For Pyongyang we have no information; guess no changes since World War II. +# For Pyongyang, guess no changes from World War II until 2015, as we +# have no information otherwise. # From Steffen Thorsen (2015-08-07): # According to many news sources, North Korea is going to change to @@ -1871,7 +2041,7 @@ Zone Indian/Maldives 4:54:00 - LMT 1880 # Bill Bonnet (2005-05-19) reports that the US Embassy in Ulaanbaatar says # there is only one time zone and that DST is observed, citing Microsoft # Windows XP as the source. Risto Nykänen (2005-05-16) reports that -# travelmongolia.org says there are two time zones (UTC+7, UTC+8) with no DST. +# travelmongolia.org says there are two time zones (UT +07, +08) with no DST. # Oscar van Vlijmen (2005-05-20) reports that the Mongolian Embassy in # Washington, DC says there are two time zones, with DST observed. # He also found @@ -2111,8 +2281,8 @@ Zone Asia/Kathmandu 5:41:16 - LMT 1920 # http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=99374&Itemid=2 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Pakistan 2002 only - Apr Sun>=2 0:01 1:00 S -Rule Pakistan 2002 only - Oct Sun>=2 0:01 0 - +Rule Pakistan 2002 only - Apr Sun>=2 0:00 1:00 S +Rule Pakistan 2002 only - Oct Sun>=2 0:00 0 - Rule Pakistan 2008 only - Jun 1 0:00 1:00 S Rule Pakistan 2008 2009 - Nov 1 0:00 0 - Rule Pakistan 2009 only - Apr 15 0:00 1:00 S @@ -2380,6 +2550,16 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # http://www.timeanddate.com/time/change/gaza-strip/gaza # http://www.timeanddate.com/time/change/west-bank/hebron +# From Hannah Kreitem (2016-03-09): +# http://www.palestinecabinet.gov.ps/WebSite/ar/ViewDetails?ID=31728 +# [Google translation]: "The Council also decided to start daylight +# saving in Palestine as of one o'clock on Saturday morning, +# 2016-03-26, to provide the clock 60 minutes ahead." +# +# From Paul Eggert (2016-03-12): +# Predict spring transitions on March's last Saturday at 01:00 from now on. +# Leave fall predictions alone for now. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -2408,7 +2588,8 @@ Rule Palestine 2012 2014 - Mar lastThu 2 Rule Palestine 2012 only - Sep 21 1:00 0 - Rule Palestine 2013 only - Sep Fri>=21 0:00 0 - Rule Palestine 2014 max - Oct Fri>=21 0:00 0 - -Rule Palestine 2015 max - Mar lastFri 24:00 1:00 S +Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S +Rule Palestine 2016 max - Mar lastSat 1:00 1:00 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct @@ -2496,7 +2677,7 @@ Link Asia/Qatar Asia/Bahrain # earlier date. # # Shanks & Pottenger also state that until 1968-05-01 Saudi Arabia had two -# time zones; the other zone, at UTC+4, was in the far eastern part of +# time zones; the other zone, at UT +04, was in the far eastern part of # the country. Ignore this, as it's before our 1970 cutoff. # # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2765,10 +2946,10 @@ Zone Asia/Damascus 2:25:12 - LMT 1920 # # From Shanks & Pottenger. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Dushanbe 4:35:12 - LMT 1924 May 2 - 5:00 - DUST 1930 Jun 21 # Dushanbe Time - 6:00 RussiaAsia DUS%sT 1991 Mar 31 2:00s - 5:00 1:00 DUSST 1991 Sep 9 2:00s - 5:00 - TJT # Tajikistan Time + 5:00 - +05 1930 Jun 21 + 6:00 RussiaAsia +06/+07 1991 Mar 31 2:00s + 5:00 1:00 +05/+06 1991 Sep 9 2:00s + 5:00 - +05 # Thailand # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2782,11 +2963,10 @@ Link Asia/Bangkok Asia/Vientiane # Laos # From Shanks & Pottenger. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Ashgabat 3:53:32 - LMT 1924 May 2 # or Ashkhabad - 4:00 - ASHT 1930 Jun 21 # Ashkhabad Time - 5:00 RussiaAsia ASH%sT 1991 Mar 31 2:00 - 4:00 RussiaAsia ASH%sT 1991 Oct 27 # independence - 4:00 RussiaAsia TM%sT 1992 Jan 19 2:00 - 5:00 - TMT + 4:00 - +04 1930 Jun 21 + 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00 + 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00 + 5:00 - +05 # United Arab Emirates # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2798,20 +2978,18 @@ Link Asia/Dubai Asia/Muscat # Oman # Byalokoz 1919 says Uzbekistan was 4:27:53. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Samarkand 4:27:53 - LMT 1924 May 2 - 4:00 - SAMT 1930 Jun 21 # Samarkand Time - 5:00 - SAMT 1981 Apr 1 - 5:00 1:00 SAMST 1981 Oct 1 - 6:00 - TAST 1982 Apr 1 # Tashkent Time - 5:00 RussiaAsia SAM%sT 1991 Sep 1 # independence - 5:00 RussiaAsia UZ%sT 1992 - 5:00 - UZT + 4:00 - +04 1930 Jun 21 + 5:00 - +05 1981 Apr 1 + 5:00 1:00 +06 1981 Oct 1 + 6:00 - +06 1982 Apr 1 + 5:00 RussiaAsia +05/+06 1992 + 5:00 - +05 # Milne says Tashkent was 4:37:10.8; round to nearest. Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 - 5:00 - TAST 1930 Jun 21 # Tashkent Time - 6:00 RussiaAsia TAS%sT 1991 Mar 31 2:00 - 5:00 RussiaAsia TAS%sT 1991 Sep 1 # independence - 5:00 RussiaAsia UZ%sT 1992 - 5:00 - UZT + 5:00 - +05 1930 Jun 21 + 6:00 RussiaAsia +06/+07 1991 Mar 31 2:00 + 5:00 RussiaAsia +05/+06 1992 + 5:00 - +05 # Vietnam Modified: stable/11/contrib/tzdata/australasia ============================================================================== --- stable/11/contrib/tzdata/australasia Sat Oct 15 12:38:50 2016 (r307360) +++ stable/11/contrib/tzdata/australasia Sat Oct 15 12:41:11 2016 (r307361) @@ -60,6 +60,14 @@ Zone Australia/Eucla 8:35:28 - LMT 1895 # Hamilton is the largest, but there is also a Hamilton in Victoria, # so use Lindeman. # +# From J William Piggott (2016-02-20): +# There is no location named Holiday Islands in Queensland Australia; holiday +# islands is a colloquial term used globally. Hayman and Lindeman are at the +# north and south extremes of the Whitsunday Islands archipelago, and +# Hamilton is in between; it is reasonable to believe that this time zone +# applies to all of the Whitsundays. +# http://www.australia.gov.au/about-australia/australian-story/austn-islands +# # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule AQ 1971 only - Oct lastSun 2:00s 1:00 D Rule AQ 1972 only - Feb lastSun 2:00s 0 S @@ -235,11 +243,11 @@ Zone Australia/Lord_Howe 10:36:20 - LMT # will produce a binary file with an [A]EST-type as the first 32-bit type; # this is required for correct handling of times before 1916 by # pre-2013 versions of localtime. -Zone Antarctica/Macquarie 0 - zzz 1899 Nov +Zone Antarctica/Macquarie 0 - -00 1899 Nov 10:00 - AEST 1916 Oct 1 2:00 10:00 1:00 AEDT 1917 Feb 10:00 Aus AE%sT 1919 Apr 1 0:00s - 0 - zzz 1948 Mar 25 + 0 - -00 1948 Mar 25 10:00 Aus AE%sT 1967 10:00 AT AE%sT 2010 Apr 4 3:00 11:00 - MIST # Macquarie I Standard Time @@ -537,7 +545,7 @@ Zone Pacific/Port_Moresby 9:48:40 - LMT # Base the Bougainville entry on the Arawa-Kieta region, which appears to have # the most people even though it was devastated in the Bougainville Civil War. # -# Although Shanks gives 1942-03-15 / 1943-11-01 for JST, these dates +# Although Shanks gives 1942-03-15 / 1943-11-01 for UT +09, these dates # are apparently rough guesswork from the starts of military campaigns. # The World War II entries below are instead based on Arawa-Kieta. # The Japanese occupied Kieta in July 1942, @@ -545,8 +553,8 @@ Zone Pacific/Port_Moresby 9:48:40 - LMT # http://pwencycl.kgbudge.com/B/o/Bougainville.htm # and seem to have controlled it until their 1945-08-21 surrender. # -# The Autonomous Region of Bougainville plans to switch from UTC+10 to UTC+11 -# on 2014-12-28 at 02:00. They call UTC+11 "Bougainville Standard Time"; +# The Autonomous Region of Bougainville switched from UT +10 to +11 +# on 2014-12-28 at 02:00. They call +11 "Bougainville Standard Time"; # abbreviate this as BST. See: # http://www.bougainville24.com/bougainville-issues/bougainville-gets-own-timezone/ # @@ -612,7 +620,7 @@ Link Pacific/Pago_Pago Pacific/Midway # # From Paul Eggert (2014-06-27): # The International Date Line Act 2011 # http://www.parliament.gov.ws/images/ACTS/International_Date_Line_Act__2011_-_Eng.pdf -# changed Samoa from UTC-11 to UTC+13, effective "12 o'clock midnight, on +# changed Samoa from UT -11 to +13, effective "12 o'clock midnight, on # Thursday 29th December 2011". The International Date Line was adjusted # accordingly. @@ -707,7 +715,7 @@ Zone Pacific/Funafuti 11:56:52 - LMT 190 # 1886-1891; Baker was similar but exact dates are not known. # Inhabited by civilians 1935-1942; U.S. military bases 1943-1944; # uninhabited thereafter. -# Howland observed Hawaii Standard Time (UT-10:30) in 1937; +# Howland observed Hawaii Standard Time (UT -10:30) in 1937; # see page 206 of Elgen M. Long and Marie K. Long, # Amelia Earhart: the Mystery Solved, Simon & Schuster (2000). # So most likely Howland and Baker observed Hawaii Time from 1935 @@ -1465,7 +1473,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # Zealand time. I understand that is the time they keep locally, anyhow." # For now, assume this practice goes back to the introduction of standard time # in New Zealand, as this would make Chatham Islands time almost exactly match -# LMT back when New Zealand was at UTC+11:30; also, assume Chatham Islands did +# LMT back when New Zealand was at UT +11:30; also, assume Chatham Islands did # not observe New Zealand's prewar DST. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sat Oct 15 13:39:32 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DCFAC121C1; Sat, 15 Oct 2016 13:39:32 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3EA97B0; Sat, 15 Oct 2016 13:39:31 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9FDdUPO054651; Sat, 15 Oct 2016 13:39:30 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9FDdUHP054650; Sat, 15 Oct 2016 13:39:30 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201610151339.u9FDdUHP054650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Sat, 15 Oct 2016 13:39:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307367 - stable/11/sys/dev/sfxge/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 13:39:32 -0000 Author: arybchik Date: Sat Oct 15 13:39:30 2016 New Revision: 307367 URL: https://svnweb.freebsd.org/changeset/base/307367 Log: MFC r306944 sfxge(4): sync tlv_layout.h with firmwaresrc and update port-mode definition use It fixes driver attach issue to a new firmware which reports a new port-modes. Submitted by: Tom Millington Sponsored by: Solarflare Communications, Inc. Modified: stable/11/sys/dev/sfxge/common/ef10_nic.c stable/11/sys/dev/sfxge/common/ef10_tlv_layout.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sfxge/common/ef10_nic.c ============================================================================== --- stable/11/sys/dev/sfxge/common/ef10_nic.c Sat Oct 15 13:27:01 2016 (r307366) +++ stable/11/sys/dev/sfxge/common/ef10_nic.c Sat Oct 15 13:39:30 2016 (r307367) @@ -164,6 +164,7 @@ ef10_nic_get_port_mode_bandwidth( break; case TLV_PORT_MODE_10G_10G_10G_10G: case TLV_PORT_MODE_10G_10G_10G_10G_Q: + case TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2: case TLV_PORT_MODE_10G_10G_10G_10G_Q2: bandwidth = 10000 * 4; break; @@ -1122,8 +1123,7 @@ static struct { { EFX_FAMILY_MEDFORD, (1 << TLV_PORT_MODE_10G) | - (1 << TLV_PORT_MODE_10G_10G) | - (1 << TLV_PORT_MODE_10G_10G_10G_10G), + (1 << TLV_PORT_MODE_10G_10G), 1 }, /* Supported modes requiring 2 outputs per port */ @@ -1140,13 +1140,15 @@ static struct { (1 << TLV_PORT_MODE_40G) | (1 << TLV_PORT_MODE_40G_40G) | (1 << TLV_PORT_MODE_40G_10G_10G) | - (1 << TLV_PORT_MODE_10G_10G_40G), + (1 << TLV_PORT_MODE_10G_10G_40G) | + (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2), 2 }, /* Supported modes requiring 4 outputs per port */ { EFX_FAMILY_MEDFORD, (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q) | + (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q1) | (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q2), 4 }, Modified: stable/11/sys/dev/sfxge/common/ef10_tlv_layout.h ============================================================================== --- stable/11/sys/dev/sfxge/common/ef10_tlv_layout.h Sat Oct 15 13:27:01 2016 (r307366) +++ stable/11/sys/dev/sfxge/common/ef10_tlv_layout.h Sat Oct 15 13:39:30 2016 (r307367) @@ -553,12 +553,14 @@ struct tlv_global_port_mode { #define TLV_PORT_MODE_40G (1) /* 40G, single QSFP/40G-KR */ #define TLV_PORT_MODE_10G_10G (2) /* 2x10G, dual SFP/10G-KR or single QSFP */ #define TLV_PORT_MODE_40G_40G (3) /* 40G + 40G, dual QSFP/40G-KR (Greenport, Medford) */ -#define TLV_PORT_MODE_10G_10G_10G_10G (4) /* 2x10G + 2x10G, quad SFP/10G-KR or dual QSFP (Greenport, Medford) */ -#define TLV_PORT_MODE_10G_10G_10G_10G_Q (5) /* 4x10G, single QSFP, cage 0 (Medford) */ +#define TLV_PORT_MODE_10G_10G_10G_10G (4) /* 2x10G + 2x10G, quad SFP/10G-KR or dual QSFP (Greenport) */ +#define TLV_PORT_MODE_10G_10G_10G_10G_Q1 (4) /* 4x10G, single QSFP, cage 0 (Medford) */ +#define TLV_PORT_MODE_10G_10G_10G_10G_Q (5) /* 4x10G, single QSFP, cage 0 (Medford) OBSOLETE DO NOT USE */ #define TLV_PORT_MODE_40G_10G_10G (6) /* 1x40G + 2x10G, dual QSFP (Greenport, Medford) */ #define TLV_PORT_MODE_10G_10G_40G (7) /* 2x10G + 1x40G, dual QSFP (Greenport, Medford) */ #define TLV_PORT_MODE_10G_10G_10G_10G_Q2 (8) /* 4x10G, single QSFP, cage 1 (Medford) */ -#define TLV_PORT_MODE_MAX TLV_PORT_MODE_10G_10G_10G_10G_Q2 +#define TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2 (9) /* 2x10G + 2x10G, dual QSFP (Medford) */ +#define TLV_PORT_MODE_MAX TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2 }; /* Type of the v-switch created implicitly by the firmware */ @@ -765,8 +767,8 @@ struct tlv_rx_event_merging_config { #define TLV_RX_EVENT_MERGING_CONFIG_MAX_EVENTS_MAX ((1 << 4) - 1) uint32_t timeout_ns; }; -#define TLV_RX_EVENT_MERGING_MAX_EVENTS_DEFAULT 7 -#define TLV_RX_EVENT_MERGING_TIMEOUT_NS_DEFAULT 8740 +#define TLV_RX_EVENT_MERGING_MAX_EVENTS_DEFAULT (0xffffffff) +#define TLV_RX_EVENT_MERGING_TIMEOUT_NS_DEFAULT (0xffffffff) #define TLV_TAG_PCIE_LINK_SETTINGS (0x101f0000) struct tlv_pcie_link_settings { @@ -791,9 +793,9 @@ struct tlv_tx_event_merging_config { uint32_t timeout_ns; uint32_t qempty_timeout_ns; /* Medford only */ }; -#define TLV_TX_EVENT_MERGING_MAX_EVENTS_DEFAULT 7 -#define TLV_TX_EVENT_MERGING_TIMEOUT_NS_DEFAULT 1400 -#define TLV_TX_EVENT_MERGING_QEMPTY_TIMEOUT_NS_DEFAULT 700 +#define TLV_TX_EVENT_MERGING_MAX_EVENTS_DEFAULT (0xffffffff) +#define TLV_TX_EVENT_MERGING_TIMEOUT_NS_DEFAULT (0xffffffff) +#define TLV_TX_EVENT_MERGING_QEMPTY_TIMEOUT_NS_DEFAULT (0xffffffff) /* Tx vFIFO Low latency configuration * @@ -809,6 +811,20 @@ struct tlv_tx_vfifo_ull_mode { #define TLV_TX_VFIFO_ULL_MODE_DEFAULT 0 }; +/* BIU mode + * + * Medford2 tag for selecting VI window decode (see values below) + */ +#define TLV_TAG_BIU_VI_WINDOW_MODE (0x10280000) +struct tlv_biu_vi_window_mode { + uint32_t tag; + uint32_t length; + uint8_t mode; +#define TLV_BIU_VI_WINDOW_MODE_8K 0 /* 8k per VI, CTPIO not mapped, medford/hunt compatible */ +#define TLV_BIU_VI_WINDOW_MODE_16K 1 /* 16k per VI, CTPIO mapped */ +#define TLV_BIU_VI_WINDOW_MODE_64K 2 /* 64k per VI, CTPIO mapped, POWER-friendly */ +}; + #define TLV_TAG_LICENSE (0x30800000) typedef struct tlv_license { From owner-svn-src-stable-11@freebsd.org Sat Oct 15 13:42:54 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F8E3C1242B; Sat, 15 Oct 2016 13:42:54 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6BE9E03; Sat, 15 Oct 2016 13:42:53 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9FDgqFt058196; Sat, 15 Oct 2016 13:42:52 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9FDgq57058195; Sat, 15 Oct 2016 13:42:52 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201610151342.u9FDgq57058195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Sat, 15 Oct 2016 13:42:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307370 - stable/11/sys/dev/sfxge/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 13:42:54 -0000 Author: arybchik Date: Sat Oct 15 13:42:52 2016 New Revision: 307370 URL: https://svnweb.freebsd.org/changeset/base/307370 Log: MFC r307038 sfxge(4): update external port mapping for Medford Extend the mapping table for external port numbering to support port modes which output to the second external port only. Where supported, map from the current port mode rather than inferring from all the available modes. Updated comments for clarity. Submitted by: Richard Houldsworth Sponsored by: Solarflare Communications, Inc. Modified: stable/11/sys/dev/sfxge/common/ef10_nic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sfxge/common/ef10_nic.c ============================================================================== --- stable/11/sys/dev/sfxge/common/ef10_nic.c Sat Oct 15 13:42:38 2016 (r307369) +++ stable/11/sys/dev/sfxge/common/ef10_nic.c Sat Oct 15 13:42:52 2016 (r307370) @@ -1099,41 +1099,50 @@ fail1: /* - * The external port mapping is a one-based numbering of the external - * connectors on the board. It does not distinguish off-board separated - * outputs such as multi-headed cables. - * The number of ports that map to each external port connector - * on the board is determined by the chip family and the port modes to - * which the NIC can be configured. The mapping table lists modes with - * port numbering requirements in increasing order. + * Table of mapping schemes from port number to the number of the external + * connector on the board. The external numbering does not distinguish + * off-board separated outputs such as from multi-headed cables. + * + * The count of adjacent port numbers that map to each external port + * and the offset in the numbering, is determined by the chip family and + * current port mode. + * + * For the Huntington family, the current port mode cannot be discovered, + * so the mapping used is instead the last match in the table to the full + * set of port modes to which the NIC can be configured. Therefore the + * ordering of entries in the the mapping table is significant. */ static struct { efx_family_t family; uint32_t modes_mask; - uint32_t stride; + int32_t count; + int32_t offset; } __ef10_external_port_mappings[] = { - /* Supported modes requiring 1 output per port */ + /* Supported modes with 1 output per external port */ { EFX_FAMILY_HUNTINGTON, (1 << TLV_PORT_MODE_10G) | (1 << TLV_PORT_MODE_10G_10G) | (1 << TLV_PORT_MODE_10G_10G_10G_10G), + 1, 1 }, { EFX_FAMILY_MEDFORD, (1 << TLV_PORT_MODE_10G) | (1 << TLV_PORT_MODE_10G_10G), + 1, 1 }, - /* Supported modes requiring 2 outputs per port */ + /* Supported modes with 2 outputs per external port */ { EFX_FAMILY_HUNTINGTON, (1 << TLV_PORT_MODE_40G) | (1 << TLV_PORT_MODE_40G_40G) | (1 << TLV_PORT_MODE_40G_10G_10G) | (1 << TLV_PORT_MODE_10G_10G_40G), - 2 + 2, + 1 }, { EFX_FAMILY_MEDFORD, @@ -1142,15 +1151,22 @@ static struct { (1 << TLV_PORT_MODE_40G_10G_10G) | (1 << TLV_PORT_MODE_10G_10G_40G) | (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2), - 2 + 2, + 1 }, - /* Supported modes requiring 4 outputs per port */ + /* Supported modes with 4 outputs per external port */ { EFX_FAMILY_MEDFORD, (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q) | - (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q1) | + (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q1), + 4, + 1, + }, + { + EFX_FAMILY_MEDFORD, (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q2), - 4 + 4, + 2 }, }; @@ -1164,11 +1180,26 @@ ef10_external_port_mapping( int i; uint32_t port_modes; uint32_t matches; - uint32_t stride = 1; /* default 1-1 mapping */ - - if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, NULL)) != 0) { - /* No port mode information available - use default mapping */ - goto out; + uint32_t current; + int32_t count = 1; /* Default 1-1 mapping */ + int32_t offset = 1; /* Default starting external port number */ + + if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, ¤t)) != 0) { + /* + * No current port mode information + * - infer mapping from available modes + */ + if ((rc = efx_mcdi_get_port_modes(enp, + &port_modes, NULL)) != 0) { + /* + * No port mode information available + * - use default mapping + */ + goto out; + } + } else { + /* Only need to scan the current mode */ + port_modes = 1 << current; } /* @@ -1182,7 +1213,8 @@ ef10_external_port_mapping( matches = (__ef10_external_port_mappings[i].modes_mask & port_modes); if (matches != 0) { - stride = __ef10_external_port_mappings[i].stride; + count = __ef10_external_port_mappings[i].count; + offset = __ef10_external_port_mappings[i].offset; port_modes &= ~matches; } } @@ -1196,9 +1228,9 @@ ef10_external_port_mapping( out: /* * Scale as required by last matched mode and then convert to - * one-based numbering + * correctly offset numbering */ - *external_portp = (uint8_t)(port / stride) + 1; + *external_portp = (uint8_t)((port / count) + offset); return (0); fail1: