From owner-svn-src-user@freebsd.org Mon Feb 19 21:58:13 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D911F02195 for ; Mon, 19 Feb 2018 21:58:13 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 23A7E6DA5E; Mon, 19 Feb 2018 21:58:13 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A087203C4; Mon, 19 Feb 2018 21:58:13 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JLwCSu067007; Mon, 19 Feb 2018 21:58:12 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JLwCgc067006; Mon, 19 Feb 2018 21:58:12 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802192158.w1JLwCgc067006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 19 Feb 2018 21:58:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329604 - user/jeff/numa/sys/vm X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: user/jeff/numa/sys/vm X-SVN-Commit-Revision: 329604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 21:58:13 -0000 Author: jeff Date: Mon Feb 19 21:58:12 2018 New Revision: 329604 URL: https://svnweb.freebsd.org/changeset/base/329604 Log: Use vm_page_held() instead of a direct check for hold count. Fix and simply the count in vm_pageout_free_pages(). Modified: user/jeff/numa/sys/vm/vm_pageout.c Modified: user/jeff/numa/sys/vm/vm_pageout.c ============================================================================== --- user/jeff/numa/sys/vm/vm_pageout.c Mon Feb 19 19:55:29 2018 (r329603) +++ user/jeff/numa/sys/vm/vm_pageout.c Mon Feb 19 21:58:12 2018 (r329604) @@ -1139,7 +1139,7 @@ vm_pageout_free_pages(struct pgo_pglist *pglist, vm_ob int pcount, count; pcount = MAX(object->iosize / PAGE_SIZE, 1); - count = 0; + count = 1; if (pcount == 1 || vm_object_reserv(object)) { vm_page_free(m); vm_page_unlock(m); @@ -1156,8 +1156,7 @@ vm_pageout_free_pages(struct pgo_pglist *pglist, vm_ob mtx = vm_page_lockptr(m); if (p == m) p = vm_page_next(m); - if (vm_pageout_pglist_append(pglist, m)) - count++; + vm_pageout_pglist_append(pglist, m); /* Iterate through the block range and free compatible pages. */ for (m = p; m != NULL && m->pindex < start + pcount; m = p) { p = TAILQ_NEXT(m, listq); @@ -1166,7 +1165,7 @@ vm_pageout_free_pages(struct pgo_pglist *pglist, vm_ob mtx = vm_page_lockptr(m); mtx_lock(mtx); } - if (m->hold_count || vm_page_busied(m) || + if (vm_page_held(m) || vm_page_busied(m) || m->queue != PQ_INACTIVE) continue; if (m->valid == 0) From owner-svn-src-user@freebsd.org Mon Feb 19 22:00:05 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A40FF023F3 for ; Mon, 19 Feb 2018 22:00:05 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 44F1E6DCD0; Mon, 19 Feb 2018 22:00:05 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B985203C8; Mon, 19 Feb 2018 22:00:05 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JM05fT067192; Mon, 19 Feb 2018 22:00:05 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JM02Vu067164; Mon, 19 Feb 2018 22:00:02 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802192200.w1JM02Vu067164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 19 Feb 2018 22:00:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329605 - in user/jeff/numa: . bin/df cddl/contrib/opensolaris/cmd/zpool contrib/llvm/tools/clang/lib/CodeGen contrib/netbsd-tests/lib/libc/sys crypto/openssl/doc/man3 etc/devd lib/clan... X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in user/jeff/numa: . bin/df cddl/contrib/opensolaris/cmd/zpool contrib/llvm/tools/clang/lib/CodeGen contrib/netbsd-tests/lib/libc/sys crypto/openssl/doc/man3 etc/devd lib/clang/libllvm lib/libc/rpc li... X-SVN-Commit-Revision: 329605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:00:06 -0000 Author: jeff Date: Mon Feb 19 22:00:02 2018 New Revision: 329605 URL: https://svnweb.freebsd.org/changeset/base/329605 Log: Commit missing !sys portion of last merge. Added: user/jeff/numa/share/man/man9/syscall_helper_register.9 - copied unchanged from r329139, head/share/man/man9/syscall_helper_register.9 user/jeff/numa/stand/usb/test/ - copied from r329139, head/stand/usb/test/ user/jeff/numa/tools/build/options/WITHOUT_LLVM_COV - copied unchanged from r329139, head/tools/build/options/WITHOUT_LLVM_COV user/jeff/numa/tools/build/options/WITH_LLVM_COV - copied unchanged from r329139, head/tools/build/options/WITH_LLVM_COV user/jeff/numa/tools/diag/prtblknos/ - copied from r329139, head/tools/diag/prtblknos/ Deleted: user/jeff/numa/crypto/openssl/doc/man3/ user/jeff/numa/secure/usr.bin/openssl/man/c_rehash.1 user/jeff/numa/stand/usb/Makefile.test user/jeff/numa/stand/usb/bsd_usbloader_test.c user/jeff/numa/tools/regression/sockets/socketpair/ Modified: user/jeff/numa/Makefile user/jeff/numa/Makefile.inc1 user/jeff/numa/ObsoleteFiles.inc user/jeff/numa/bin/df/df.c user/jeff/numa/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c user/jeff/numa/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp user/jeff/numa/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c user/jeff/numa/etc/devd/usb.conf user/jeff/numa/lib/clang/libllvm/Makefile user/jeff/numa/lib/libc/rpc/svc_dg.c user/jeff/numa/lib/libc/sys/fsync.2 user/jeff/numa/lib/libc/sys/socketpair.2 user/jeff/numa/lib/libcompat/4.3/rexec.c user/jeff/numa/sbin/dumpfs/dumpfs.c user/jeff/numa/sbin/fsck_ffs/fsck.h user/jeff/numa/sbin/fsck_ffs/globs.c user/jeff/numa/sbin/fsck_ffs/main.c user/jeff/numa/sbin/fsck_ffs/pass5.c user/jeff/numa/sbin/geom/class/part/gpart.8 user/jeff/numa/sbin/newfs/mkfs.c user/jeff/numa/secure/lib/libcrypto/Makefile.inc user/jeff/numa/secure/usr.bin/openssl/Makefile.man user/jeff/numa/share/man/man4/dtrace_tcp.4 user/jeff/numa/share/man/man5/src.conf.5 user/jeff/numa/share/man/man9/Makefile user/jeff/numa/share/misc/committers-src.dot user/jeff/numa/share/misc/organization.dot user/jeff/numa/share/mk/bsd.compiler.mk user/jeff/numa/share/mk/bsd.linker.mk user/jeff/numa/share/mk/src.opts.mk user/jeff/numa/share/zoneinfo/Makefile user/jeff/numa/stand/common/boot.c user/jeff/numa/stand/common/bootstrap.h user/jeff/numa/stand/common/interp.c user/jeff/numa/stand/common/interp_backslash.c user/jeff/numa/stand/common/interp_forth.c user/jeff/numa/stand/common/interp_parse.c user/jeff/numa/stand/common/interp_simple.c user/jeff/numa/stand/common/load_elf.c user/jeff/numa/stand/defs.mk user/jeff/numa/stand/kshim/bsd_kernel.h user/jeff/numa/stand/usb/usbcore.mk user/jeff/numa/stand/userboot/userboot/Makefile user/jeff/numa/tools/diag/README user/jeff/numa/tools/tools/nanobsd/embedded/beaglebone.cfg user/jeff/numa/tools/tools/nanobsd/embedded/common user/jeff/numa/tools/tools/nanobsd/embedded/pandaboard.cfg user/jeff/numa/tools/tools/nanobsd/embedded/qemu-amd64-uefi-bios.cfg user/jeff/numa/tools/tools/nanobsd/embedded/qemu-amd64-uefi.cfg user/jeff/numa/tools/tools/nanobsd/embedded/qemu-amd64.cfg user/jeff/numa/tools/tools/nanobsd/embedded/qemu-armv7.cfg user/jeff/numa/tools/tools/nanobsd/embedded/rpi2.cfg user/jeff/numa/usr.bin/clang/Makefile user/jeff/numa/usr.bin/clang/lld/ld.lld.1 user/jeff/numa/usr.bin/lex/initparse.c user/jeff/numa/usr.bin/lock/Makefile user/jeff/numa/usr.bin/lock/lock.c user/jeff/numa/usr.bin/sort/radixsort.c user/jeff/numa/usr.bin/tftp/main.c user/jeff/numa/usr.bin/vmstat/vmstat.c user/jeff/numa/usr.sbin/acpi/iasl/Makefile user/jeff/numa/usr.sbin/mountd/mountd.c user/jeff/numa/usr.sbin/ppp/defs.h user/jeff/numa/usr.sbin/ppp/iface.c user/jeff/numa/usr.sbin/ppp/ip.c user/jeff/numa/usr.sbin/ppp/ipv6cp.c user/jeff/numa/usr.sbin/ppp/ncpaddr.c user/jeff/numa/usr.sbin/ppp/route.c user/jeff/numa/usr.sbin/ypserv/yp_svc_udp.c Directory Properties: user/jeff/numa/ (props changed) user/jeff/numa/cddl/ (props changed) user/jeff/numa/cddl/contrib/opensolaris/ (props changed) user/jeff/numa/contrib/llvm/ (props changed) user/jeff/numa/contrib/llvm/tools/clang/ (props changed) user/jeff/numa/contrib/netbsd-tests/ (props changed) user/jeff/numa/crypto/openssl/ (props changed) Modified: user/jeff/numa/Makefile ============================================================================== --- user/jeff/numa/Makefile Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/Makefile Mon Feb 19 22:00:02 2018 (r329605) @@ -106,9 +106,13 @@ # # This is included so CC is set to ccache for -V, and COMPILER_TYPE/VERSION -# can be cached for sub-makes. +# can be cached for sub-makes. We can't do this while still running on the +# old fmake from FreeBSD 9.x or older, so avoid including it then to avoid +# heartburn upgrading from older systems. The need for CC is done with new +# make later in the build, and caching COMPILER_TYPE/VERSION is only an +# optimization. Also sinclude it to be friendlier to foreign OS hosted builds. .if ${MAKE_VERSION} >= 20140620 && defined(.PARSEDIR) -.include +.sinclude .endif # Note: we use this awkward construct to be compatible with FreeBSD's Modified: user/jeff/numa/Makefile.inc1 ============================================================================== --- user/jeff/numa/Makefile.inc1 Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/Makefile.inc1 Mon Feb 19 22:00:02 2018 (r329605) @@ -85,8 +85,10 @@ MK_GCC_BOOTSTRAP= no .-include "${OBJTOP}/compiler-metadata.mk" .endif -# Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. -.include +# Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. Pull it from the +# tree to be friendlier to foreign OS builds. It's safe to do so unconditionally +# here since we will always have the right make, unlike in src/Makefile +.include "share/mk/bsd.compiler.mk" .include "share/mk/src.opts.mk" # Check if there is a local compiler that can satisfy as an external compiler. @@ -165,11 +167,11 @@ test-system-compiler: .PHONY .if !defined(X_COMPILER_TYPE) CROSSENV+= COMPILER_VERSION=${COMPILER_VERSION} \ COMPILER_TYPE=${COMPILER_TYPE} \ - COMPILER_FEATURES=${COMPILER_FEATURES} \ + COMPILER_FEATURES="${COMPILER_FEATURES}" \ COMPILER_FREEBSD_VERSION=${COMPILER_FREEBSD_VERSION} .else CROSSENV+= COMPILER_VERSION=${X_COMPILER_VERSION} \ - COMPILER_FEATURES=${X_COMPILER_FEATURES} \ + COMPILER_FEATURES="${X_COMPILER_FEATURES}" \ COMPILER_TYPE=${X_COMPILER_TYPE} \ COMPILER_FREEBSD_VERSION=${X_COMPILER_FREEBSD_VERSION} .endif @@ -1107,7 +1109,7 @@ _zoneinfo= zic tzsetup ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \ date echo egrep find grep id install ${_install-info} \ ln make mkdir mtree mv pwd_mkdb \ - rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \ + rm sed services_mkdb sh sort strip sysctl test true uname wc ${_zoneinfo} \ ${LOCAL_ITOOLS} # Needed for share/man Modified: user/jeff/numa/ObsoleteFiles.inc ============================================================================== --- user/jeff/numa/ObsoleteFiles.inc Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/ObsoleteFiles.inc Mon Feb 19 22:00:02 2018 (r329605) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20180208: remove c_rehash(1) +OLD_FILES+=usr/share/openssl/man/man1/c_rehash.1.gz # 20180206: remove gdbtui OLD_FILES+=usr/bin/gdbtui # 20180201: Obsolete forth files Modified: user/jeff/numa/bin/df/df.c ============================================================================== --- user/jeff/numa/bin/df/df.c Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/bin/df/df.c Mon Feb 19 22:00:02 2018 (r329605) @@ -254,9 +254,11 @@ main(int argc, char *argv[]) rv = 1; continue; } -#ifdef MOUNT_CHAR_DEVS } else if (S_ISCHR(stbuf.st_mode)) { if ((mntpt = getmntpt(*argv)) == NULL) { +#ifdef MOUNT_CHAR_DEVS + xo_warnx( + "df on unmounted devices is deprecated"); mdev.fspec = *argv; mntpath = strdup("/tmp/df.XXXXXX"); if (mntpath == NULL) { @@ -305,8 +307,12 @@ main(int argc, char *argv[]) (void)rmdir(mntpt); free(mntpath); continue; - } +#else + xo_warnx("%s: not mounted", *argv); + rv = 1; + continue; #endif + } } else mntpt = *argv; Modified: user/jeff/numa/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c ============================================================================== --- user/jeff/numa/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Mon Feb 19 22:00:02 2018 (r329605) @@ -688,6 +688,21 @@ get_replication(nvlist_t *nvroot, boolean_t fatal) verify(nvlist_lookup_string(cnv, ZPOOL_CONFIG_TYPE, &childtype) == 0); + if (strcmp(childtype, + VDEV_TYPE_SPARE) == 0) { + /* We have a replacing vdev with + * a spare child. Get the first + * real child of the spare + */ + verify( + nvlist_lookup_nvlist_array( + cnv, + ZPOOL_CONFIG_CHILDREN, + &rchild, + &rchildren) == 0); + assert(rchildren >= 2); + cnv = rchild[0]; + } } verify(nvlist_lookup_string(cnv, Modified: user/jeff/numa/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp ============================================================================== --- user/jeff/numa/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp Mon Feb 19 22:00:02 2018 (r329605) @@ -3543,7 +3543,17 @@ ABIArgInfo X86_64ABIInfo::classifyRegCallStructType(Qu void X86_64ABIInfo::computeInfo(CGFunctionInfo &FI) const { - bool IsRegCall = FI.getCallingConvention() == llvm::CallingConv::X86_RegCall; + const unsigned CallingConv = FI.getCallingConvention(); + // It is possible to force Win64 calling convention on any x86_64 target by + // using __attribute__((ms_abi)). In such case to correctly emit Win64 + // compatible code delegate this call to WinX86_64ABIInfo::computeInfo. + if (CallingConv == llvm::CallingConv::Win64) { + WinX86_64ABIInfo Win64ABIInfo(CGT); + Win64ABIInfo.computeInfo(FI); + return; + } + + bool IsRegCall = CallingConv == llvm::CallingConv::X86_RegCall; // Keep track of the number of assigned registers. unsigned FreeIntRegs = IsRegCall ? 11 : 6; Modified: user/jeff/numa/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c ============================================================================== --- user/jeff/numa/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c Mon Feb 19 22:00:02 2018 (r329605) @@ -56,7 +56,7 @@ connected(int fd) } static void -run(int flags) +run(int domain, int type, int flags) { int fd[2], i; @@ -69,7 +69,7 @@ run(int flags) ATF_REQUIRE(closefrom(3) != -1); #endif - ATF_REQUIRE(socketpair(AF_UNIX, SOCK_DGRAM | flags, 0, fd) == 0); + ATF_REQUIRE(socketpair(domain, type | flags, 0, fd) == 0); ATF_REQUIRE(fd[0] == 3); ATF_REQUIRE(fd[1] == 4); @@ -97,6 +97,42 @@ run(int flags) ATF_REQUIRE(close(fd[1]) != -1); } +ATF_TC(inet); +ATF_TC_HEAD(inet, tc) +{ + atf_tc_set_md_var(tc, "descr", + "socketpair(2) does not work in the PF_INET domain"); +} + +ATF_TC_BODY(inet, tc) +{ + int fd[2]; + + ATF_REQUIRE_EQ(socketpair(PF_INET, SOCK_DGRAM, 0, fd), -1); + ATF_REQUIRE_EQ(EOPNOTSUPP, errno); + ATF_REQUIRE_EQ(socketpair(PF_INET, SOCK_STREAM, 0, fd), -1); + ATF_REQUIRE_EQ(EOPNOTSUPP, errno); +} + +ATF_TC(null_sv); +ATF_TC_HEAD(null_sv, tc) +{ + atf_tc_set_md_var(tc, "descr", + "socketpair(2) should fail without return storage"); +} + +ATF_TC_BODY(null_sv, tc) +{ + int fd; + + closefrom(3); + ATF_REQUIRE_EQ(socketpair(AF_UNIX, SOCK_DGRAM, 0, NULL), -1); + ATF_REQUIRE_EQ(EFAULT, errno); + fd = open("/", O_RDONLY); + ATF_REQUIRE_EQ_MSG(fd, 3, + "socketpair(..., NULL) allocated descriptors"); +} + ATF_TC(socketpair_basic); ATF_TC_HEAD(socketpair_basic, tc) { @@ -105,7 +141,7 @@ ATF_TC_HEAD(socketpair_basic, tc) ATF_TC_BODY(socketpair_basic, tc) { - run(0); + run(AF_UNIX, SOCK_DGRAM, 0); } ATF_TC(socketpair_nonblock); @@ -116,7 +152,7 @@ ATF_TC_HEAD(socketpair_nonblock, tc) ATF_TC_BODY(socketpair_nonblock, tc) { - run(SOCK_NONBLOCK); + run(AF_UNIX, SOCK_DGRAM, SOCK_NONBLOCK); } ATF_TC(socketpair_cloexec); @@ -127,15 +163,29 @@ ATF_TC_HEAD(socketpair_cloexec, tc) ATF_TC_BODY(socketpair_cloexec, tc) { - run(SOCK_CLOEXEC); + run(AF_UNIX, SOCK_DGRAM, SOCK_CLOEXEC); } +ATF_TC(socketpair_stream); +ATF_TC_HEAD(socketpair_stream, tc) +{ + atf_tc_set_md_var(tc, "descr", "A stream-oriented socketpair(2)"); +} + +ATF_TC_BODY(socketpair_stream, tc) +{ + run(AF_UNIX, SOCK_STREAM, 0); +} + ATF_TP_ADD_TCS(tp) { + ATF_TP_ADD_TC(tp, inet); + ATF_TP_ADD_TC(tp, null_sv); ATF_TP_ADD_TC(tp, socketpair_basic); ATF_TP_ADD_TC(tp, socketpair_nonblock); ATF_TP_ADD_TC(tp, socketpair_cloexec); + ATF_TP_ADD_TC(tp, socketpair_stream); return atf_no_error(); } Modified: user/jeff/numa/etc/devd/usb.conf ============================================================================== --- user/jeff/numa/etc/devd/usb.conf Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/etc/devd/usb.conf Mon Feb 19 22:00:02 2018 (r329605) @@ -145,7 +145,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0403"; - match "product" "(0x5259|0x6001|0x6004|0x6006|0x6006|0x6010|0x6011|0x6014|0x6015|0x8372|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xa6d1|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbbe2|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbcda|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed73|0xed7 4|0xee18|0xeee8|0xeee9|0xeeea|0xeeeb|0xeeec|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; + match "product" "(0x5259|0x6001|0x6004|0x6006|0x6006|0x6010|0x6011|0x6014|0x6015|0x8372|0x8a98|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xa6d1|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbbe2|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbcda|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed7 3|0xed74|0xee18|0xeee8|0xeee9|0xeeea|0xeeeb|0xeeec|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; action "kldload -n uftdi"; }; @@ -2793,7 +2793,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0bda"; - match "product" "0x8754"; + match "product" "(0x8754|0x8812)"; action "kldload -n if_rtwn_usb"; }; @@ -3681,7 +3681,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x10c4"; - match "product" "(0x8066|0x806f|0x807a|0x80c4|0x80ca|0x80dd|0x80ed|0x80f6|0x8115|0x813d|0x813f|0x814a|0x814a|0x814b|0x8156|0x815e|0x815f|0x818b|0x819f|0x81a6|0x81a9|0x81ac|0x81ad|0x81c8|0x81e2|0x81e7|0x81e8|0x81f2|0x8218|0x822b|0x826b|0x8293|0x82f9|0x8341|0x8382|0x83a8|0x83d8|0x8411|0x8418|0x846e|0x8477|0x85ea|0x85eb|0x85f8|0x8664|0x8665|0x88a4|0x88a5|0xea60|0xea61|0xea70|0xea71|0xea80|0xf001|0xf002|0xf003|0xf004)"; + match "product" "(0x8066|0x806f|0x807a|0x80c4|0x80ca|0x80dd|0x80ed|0x80f6|0x8115|0x813d|0x813f|0x814a|0x814a|0x814b|0x8156|0x815e|0x815f|0x818b|0x819f|0x81a6|0x81a9|0x81ac|0x81ad|0x81c8|0x81e2|0x81e7|0x81e8|0x81f2|0x8218|0x822b|0x826b|0x8293|0x82f9|0x8341|0x8382|0x83a8|0x83d8|0x8411|0x8418|0x846e|0x8477|0x85ea|0x85eb|0x85f8|0x8664|0x8665|0x88a4|0x88a5|0x8a2a|0xea60|0xea61|0xea70|0xea71|0xea80|0xf001|0xf002|0xf003|0xf004)"; action "kldload -n uslcom"; }; @@ -3921,7 +3921,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x12d1"; - match "product" "(0x1573|0x15c1|0x1803|0x1c05|0x1c0b)"; + match "product" "(0x155b|0x1573|0x15c1|0x1803|0x1c05|0x1c0b|0x1c1e)"; action "kldload -n u3g"; }; @@ -4432,6 +4432,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x15eb"; + match "product" "0x7d0e"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1614"; match "product" "(0x0800|0x0802|0x7002)"; action "kldload -n u3g"; @@ -5328,6 +5336,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x2357"; + match "product" "0x0601"; + action "kldload -n if_ure"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x2405"; match "product" "0x0003"; action "kldload -n uslcom"; @@ -5352,6 +5368,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x2c7c"; + match "product" "0x0125"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x3195"; match "product" "(0xf190|0xf280|0xf281)"; action "kldload -n uslcom"; @@ -5727,6 +5751,46 @@ nomatch 32 { match "vendor" "0x12d1"; match "intclass" "0xff"; match "intsubclass" "0x02"; + match "intprotocol" "0x01"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x02"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x10"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x12"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; match "intprotocol" "0x16"; action "kldload -n if_cdce"; }; @@ -5747,12 +5811,42 @@ nomatch 32 { match "vendor" "0x12d1"; match "intclass" "0xff"; match "intsubclass" "0x02"; + match "intprotocol" "0x61"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x62"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; match "intprotocol" "0x76"; action "kldload -n if_cdce"; }; nomatch 32 { match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x03"; + match "intprotocol" "0x16"; + action "kldload -n if_cdce"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; match "mode" "(host|device)"; match "intclass" "0x02"; match "intsubclass" "0x02"; @@ -5921,5 +6015,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2760 USB entries processed +# 2775 USB entries processed Modified: user/jeff/numa/lib/clang/libllvm/Makefile ============================================================================== --- user/jeff/numa/lib/clang/libllvm/Makefile Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/lib/clang/libllvm/Makefile Mon Feb 19 22:00:02 2018 (r329605) @@ -664,7 +664,7 @@ SRCS_MIN+= Passes/PassBuilder.cpp SRCS_MIN+= ProfileData/Coverage/CoverageMapping.cpp SRCS_MIN+= ProfileData/Coverage/CoverageMappingReader.cpp SRCS_MIN+= ProfileData/Coverage/CoverageMappingWriter.cpp -SRCS_EXT+= ProfileData/GCOV.cpp +SRCS_MIN+= ProfileData/GCOV.cpp SRCS_MIN+= ProfileData/InstrProf.cpp SRCS_MIN+= ProfileData/InstrProfReader.cpp SRCS_MIN+= ProfileData/InstrProfWriter.cpp Modified: user/jeff/numa/lib/libc/rpc/svc_dg.c ============================================================================== --- user/jeff/numa/lib/libc/rpc/svc_dg.c Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/lib/libc/rpc/svc_dg.c Mon Feb 19 22:00:02 2018 (r329605) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); #include "rpc_com.h" #include "mt_misc.h" -#define su_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2)) +#define su_data(xprt) ((struct svc_dg_data *)((xprt)->xp_p2)) #define rpc_buffer(xprt) ((xprt)->xp_p1) #ifndef MAX Modified: user/jeff/numa/lib/libc/sys/fsync.2 ============================================================================== --- user/jeff/numa/lib/libc/sys/fsync.2 Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/lib/libc/sys/fsync.2 Mon Feb 19 22:00:02 2018 (r329605) @@ -34,7 +34,7 @@ .\" @(#)fsync.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd May 24, 2017 +.Dd February 6, 2018 .Dt FSYNC 2 .Os .Sh NAME @@ -108,6 +108,7 @@ refers to a socket, not to a file. An I/O error occurred while reading from or writing to the file system. .El .Sh SEE ALSO +.Xr fsync 1 , .Xr sync 2 , .Xr syncer 4 , .Xr sync 8 Modified: user/jeff/numa/lib/libc/sys/socketpair.2 ============================================================================== --- user/jeff/numa/lib/libc/sys/socketpair.2 Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/lib/libc/sys/socketpair.2 Mon Feb 19 22:00:02 2018 (r329605) @@ -28,7 +28,7 @@ .\" @(#)socketpair.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd May 4, 2015 +.Dd February 10, 2018 .Dt SOCKETPAIR 2 .Os .Sh NAME @@ -89,6 +89,13 @@ process address space. .Xr read 2 , .Xr socket 2 , .Xr write 2 +.Sh STANDARDS +The +.Fn socketpair +system call conforms to +.St -p1003.1-2001 +and +.St -p1003.1-2008 . .Sh HISTORY The .Fn socketpair Modified: user/jeff/numa/lib/libcompat/4.3/rexec.c ============================================================================== --- user/jeff/numa/lib/libcompat/4.3/rexec.c Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/lib/libcompat/4.3/rexec.c Mon Feb 19 22:00:02 2018 (r329605) @@ -356,7 +356,7 @@ retry: goto bad; } port = ntohs((u_short)sin2.sin_port); - (void) sprintf(num, "%u", port); + (void) sprintf(num, "%hu", port); (void) write(s, num, strlen(num)+1); { int len = sizeof (from); s3 = accept(s2, (struct sockaddr *)&from, &len); Modified: user/jeff/numa/sbin/dumpfs/dumpfs.c ============================================================================== --- user/jeff/numa/sbin/dumpfs/dumpfs.c Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/sbin/dumpfs/dumpfs.c Mon Feb 19 22:00:02 2018 (r329605) @@ -257,9 +257,9 @@ dumpfs(const char *name) if (fsflags & FS_DOSOFTDEP) printf("soft-updates%s ", (fsflags & FS_SUJ) ? "+journal" : ""); if (fsflags & FS_NEEDSFSCK) - printf("needs fsck run "); + printf("needs-fsck-run "); if (fsflags & FS_INDEXDIRS) - printf("indexed directories "); + printf("indexed-directories "); if (fsflags & FS_ACLS) printf("acls "); if (fsflags & FS_MULTILABEL) @@ -267,31 +267,33 @@ dumpfs(const char *name) if (fsflags & FS_GJOURNAL) printf("gjournal "); if (fsflags & FS_FLAGS_UPDATED) - printf("fs_flags expanded "); + printf("fs_flags-expanded "); if (fsflags & FS_NFS4ACLS) printf("nfsv4acls "); if (fsflags & FS_TRIM) printf("trim "); - fsflags &= ~(FS_UNCLEAN | FS_DOSOFTDEP | FS_NEEDSFSCK | FS_INDEXDIRS | + fsflags &= ~(FS_UNCLEAN | FS_DOSOFTDEP | FS_NEEDSFSCK | FS_METACKHASH | FS_ACLS | FS_MULTILABEL | FS_GJOURNAL | FS_FLAGS_UPDATED | - FS_NFS4ACLS | FS_SUJ | FS_TRIM); + FS_NFS4ACLS | FS_SUJ | FS_TRIM | FS_INDEXDIRS); if (fsflags != 0) - printf("unknown flags (%#x)", fsflags); + printf("unknown-flags (%#x)", fsflags); putchar('\n'); - printf("check hashes\t"); - fsflags = afs.fs_metackhash; - if (fsflags == 0) - printf("none"); - if (fsflags & CK_SUPERBLOCK) - printf("superblock "); - if (fsflags & CK_CYLGRP) - printf("cylinder-groups "); - if (fsflags & CK_INODE) - printf("inodes "); - if (fsflags & CK_INDIR) - printf("indirect-blocks "); - if (fsflags & CK_DIR) - printf("directories "); + if (afs.fs_flags & FS_METACKHASH) { + printf("check hashes\t"); + fsflags = afs.fs_metackhash; + if (fsflags == 0) + printf("none"); + if (fsflags & CK_SUPERBLOCK) + printf("superblock "); + if (fsflags & CK_CYLGRP) + printf("cylinder-groups "); + if (fsflags & CK_INODE) + printf("inodes "); + if (fsflags & CK_INDIR) + printf("indirect-blocks "); + if (fsflags & CK_DIR) + printf("directories "); + } fsflags &= ~(CK_SUPERBLOCK | CK_CYLGRP | CK_INODE | CK_INDIR | CK_DIR); if (fsflags != 0) printf("unknown flags (%#x)", fsflags); Modified: user/jeff/numa/sbin/fsck_ffs/fsck.h ============================================================================== --- user/jeff/numa/sbin/fsck_ffs/fsck.h Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/sbin/fsck_ffs/fsck.h Mon Feb 19 22:00:02 2018 (r329605) @@ -315,6 +315,7 @@ extern int Zflag; /* zero empty data blocks */ extern int inoopt; /* trim out unused inodes */ extern char ckclean; /* only do work if not cleanly unmounted */ extern int cvtlevel; /* convert to newer file system format */ +extern int ckhashadd; /* check hashes to be added */ extern int bkgrdcheck; /* determine if background check is possible */ extern int bkgrdsumadj; /* whether the kernel have ability to adjust superblock summary */ extern char usedsoftdep; /* just fix soft dependency inconsistencies */ Modified: user/jeff/numa/sbin/fsck_ffs/globs.c ============================================================================== --- user/jeff/numa/sbin/fsck_ffs/globs.c Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/sbin/fsck_ffs/globs.c Mon Feb 19 22:00:02 2018 (r329605) @@ -87,6 +87,7 @@ int Zflag; /* zero empty data blocks */ int inoopt; /* trim out unused inodes */ char ckclean; /* only do work if not cleanly unmounted */ int cvtlevel; /* convert to newer file system format */ +int ckhashadd; /* check hashes to be added */ int bkgrdcheck; /* determine if background check is possible */ int bkgrdsumadj; /* whether the kernel have ability to adjust superblock summary */ char usedsoftdep; /* just fix soft dependency inconsistencies */ Modified: user/jeff/numa/sbin/fsck_ffs/main.c ============================================================================== --- user/jeff/numa/sbin/fsck_ffs/main.c Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/sbin/fsck_ffs/main.c Mon Feb 19 22:00:02 2018 (r329605) @@ -43,6 +43,7 @@ static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14 #include __FBSDID("$FreeBSD$"); +#define IN_RTLD /* So we pickup the P_OSREL defines */ #include #include #include @@ -440,7 +441,46 @@ checkfilesys(char *filesys) flush(fswritefd, &sblk); fsmodified = ofsmodified; } - + /* + * If the filesystem was run on an old kernel that did not + * support check hashes, clear the check-hash flags so that + * we do not try to verify them. + */ + if ((sblock.fs_flags & FS_METACKHASH) == 0) + sblock.fs_metackhash = 0; + /* + * If we are running on a kernel that can provide check hashes + * that are not yet enabled for the filesystem and we are + * running manually without the -y flag, offer to add any + * supported check hashes that are not already enabled. + */ + ckhashadd = 0; + if (preen == 0 && yflag == 0 && sblock.fs_magic != FS_UFS1_MAGIC && + fswritefd != -1 && getosreldate() >= P_OSREL_CK_CYLGRP) { + if ((sblock.fs_metackhash & CK_CYLGRP) == 0 && + reply("ADD CYLINDER GROUP CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_CYLGRP; +#ifdef notyet + if ((sblock.fs_metackhash & CK_SUPERBLOCK) == 0 && + getosreldate() >= P_OSREL_CK_SUPERBLOCK && + reply("ADD SUPERBLOCK CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_SUPERBLOCK; + if ((sblock.fs_metackhash & CK_INODE) == 0 && + getosreldate() >= P_OSREL_CK_INODE && + reply("ADD INODE CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_INODE; + if ((sblock.fs_metackhash & CK_INDIR) == 0 && + getosreldate() >= P_OSREL_CK_INDIR && + reply("ADD INDIRECT BLOCK CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_INDIR; + if ((sblock.fs_metackhash & CK_DIR) == 0 && + getosreldate() >= P_OSREL_CK_DIR && + reply("ADD DIRECTORY CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_DIR; +#endif /* notyet */ + if (ckhashadd != 0) + sblock.fs_flags |= FS_METACKHASH; + } /* * Cleared if any questions answered no. Used to decide if * the superblock should be marked clean. Modified: user/jeff/numa/sbin/fsck_ffs/pass5.c ============================================================================== --- user/jeff/numa/sbin/fsck_ffs/pass5.c Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/sbin/fsck_ffs/pass5.c Mon Feb 19 22:00:02 2018 (r329605) @@ -37,7 +37,6 @@ static const char sccsid[] = "@(#)pass5.c 8.9 (Berkele #include __FBSDID("$FreeBSD$"); -#define IN_RTLD /* So we pickup the P_OSREL defines */ #include #include @@ -63,7 +62,7 @@ pass5(void) int inomapsize, blkmapsize; struct fs *fs = &sblock; ufs2_daddr_t d, dbase, dmax, start; - int rewritecg = 0, cgckadd = 0; + int rewritecg = 0; struct csum *cs; struct csum_total cstotal; struct inodesc idesc[3]; @@ -74,13 +73,10 @@ pass5(void) inoinfo(UFS_WINO)->ino_state = USTATE; memset(newcg, 0, (size_t)fs->fs_cgsize); newcg->cg_niblk = fs->fs_ipg; - if (preen == 0 && yflag == 0 && fs->fs_magic == FS_UFS2_MAGIC && - fswritefd != -1 && (fs->fs_metackhash & CK_CYLGRP) == 0 && - getosreldate() >= P_OSREL_CK_CYLGRP && - reply("ADD CYLINDER GROUP CHECKSUM PROTECTION") != 0) { + /* check to see if we are to add a cylinder group check hash */ + if ((ckhashadd & CK_CYLGRP) != 0) { fs->fs_metackhash |= CK_CYLGRP; rewritecg = 1; - cgckadd = 1; sbdirty(); } if (cvtlevel >= 3) { @@ -178,14 +174,20 @@ pass5(void) cg = cgbp->b_un.b_cg; if (!cg_chkmagic(cg)) pfatal("CG %d: BAD MAGIC NUMBER\n", c); - if ((fs->fs_metackhash & CK_CYLGRP) != 0 && cgckadd == 0) { + /* + * If we have a cylinder group check hash and are not adding + * it for the first time, verify that it is good. + */ + if ((fs->fs_metackhash & CK_CYLGRP) != 0 && + (ckhashadd & CK_CYLGRP) == 0) { uint32_t ckhash, thishash; ckhash = cg->cg_ckhash; cg->cg_ckhash = 0; thishash = calculate_crc32c(~0L, cg, fs->fs_cgsize); if (ckhash != thishash) - pwarn("CG %d: BAD CHECKSUM %#x vs %#x", c, ckhash, thishash); + pwarn("CG %d: BAD CHECK-HASH %#x vs %#x", + c, ckhash, thishash); cg->cg_ckhash = ckhash; } newcg->cg_time = cg->cg_time; Modified: user/jeff/numa/sbin/geom/class/part/gpart.8 ============================================================================== --- user/jeff/numa/sbin/geom/class/part/gpart.8 Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/sbin/geom/class/part/gpart.8 Mon Feb 19 22:00:02 2018 (r329605) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 19, 2017 +.Dd February 10, 2018 .Dt GPART 8 .Os .Sh NAME @@ -654,6 +654,8 @@ Another symbolic names that can be used with .Cm gpart utility are: .Bl -tag -width ".Cm dragonfly-disklabel64" +.It Cm apple-apfs +An Apple macOS partition used for the Apple file system, APFS. .It Cm apple-core-storage An Apple Mac OS X partition used by logical volume manager known as Core Storage. Modified: user/jeff/numa/sbin/newfs/mkfs.c ============================================================================== --- user/jeff/numa/sbin/newfs/mkfs.c Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/sbin/newfs/mkfs.c Mon Feb 19 22:00:02 2018 (r329605) @@ -489,9 +489,15 @@ restart: } /* * Set flags for metadata that is being check-hashed. + * + * Metadata check hashes are not supported in the UFS version 1 + * filesystem to keep it as small and simple as possible. */ - if (Oflag > 1 && getosreldate() >= P_OSREL_CK_CYLGRP) - sblock.fs_metackhash = CK_CYLGRP; + if (Oflag > 1) { + sblock.fs_flags |= FS_METACKHASH; + if (getosreldate() >= P_OSREL_CK_CYLGRP) + sblock.fs_metackhash = CK_CYLGRP; + } /* * Dump out summary information about file system. Modified: user/jeff/numa/secure/lib/libcrypto/Makefile.inc ============================================================================== --- user/jeff/numa/secure/lib/libcrypto/Makefile.inc Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/secure/lib/libcrypto/Makefile.inc Mon Feb 19 22:00:02 2018 (r329605) @@ -64,14 +64,11 @@ MANDIR= ${SHAREDIR}/openssl/man/man .if defined(LIB) _docs= ${LIB} -.if ${LIB} == ssl -_docs+= man3 -.endif _skip= SSLeay_version des_modes _sec= 3 .else _docs= apps -_skip= config +_skip= c_rehash config _sec= 1 .endif Modified: user/jeff/numa/secure/usr.bin/openssl/Makefile.man ============================================================================== --- user/jeff/numa/secure/usr.bin/openssl/Makefile.man Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/secure/usr.bin/openssl/Makefile.man Mon Feb 19 22:00:02 2018 (r329605) @@ -2,7 +2,6 @@ # DO NOT EDIT: generated from man-makefile-update target MAN+= CA.pl.1 MAN+= asn1parse.1 -MAN+= c_rehash.1 MAN+= ca.1 MAN+= ciphers.1 MAN+= cms.1 Modified: user/jeff/numa/share/man/man4/dtrace_tcp.4 ============================================================================== --- user/jeff/numa/share/man/man4/dtrace_tcp.4 Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/share/man/man4/dtrace_tcp.4 Mon Feb 19 22:00:02 2018 (r329605) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 15, 2016 +.Dd February 10, 2018 .Dt DTRACE_TCP 4 .Os .Sh NAME @@ -135,7 +135,7 @@ Its first, third and fifth arguments are currently alw .Dv NULL . Its last argument describes the from-state in the transition, and the to-state can be obtained from -.Dv args[2]->tcps_state . +.Dv args[3]->tcps_state . .Sh ARGUMENTS The .Vt pktinfo_t Modified: user/jeff/numa/share/man/man5/src.conf.5 ============================================================================== --- user/jeff/numa/share/man/man5/src.conf.5 Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/share/man/man5/src.conf.5 Mon Feb 19 22:00:02 2018 (r329605) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 12, 2018 +.Dd February 9, 2018 .Dt SRC.CONF 5 .Os .Sh NAME @@ -314,6 +314,8 @@ When set, it enforces these options: .Va WITHOUT_CLANG_EXTRAS .It .Va WITHOUT_CLANG_FULL +.It +.Va WITHOUT_LLVM_COV .El .It Va WITH_CLANG Set to build the Clang C/C++ compiler during the normal phase of the build. @@ -463,6 +465,8 @@ When set, it enforces these options: .It .Va WITHOUT_GNUCXX .It +.Va WITHOUT_LLVM_COV +.It .Va WITHOUT_TESTS .It .Va WITHOUT_TESTS_SUPPORT @@ -986,6 +990,20 @@ Set to use LLVM's LLD as the system linker, instead of .Pp This is a default setting on arm64/aarch64. +.It Va WITHOUT_LLVM_COV +Set to not build the +.Xr llvm-cov 1 +tool. +.Pp +This is a default setting on +riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +.It Va WITH_LLVM_COV +Set to build the +.Xr llvm-cov 1 +tool. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_LLVM_LIBUNWIND Set to use GCC's stack unwinder (instead of LLVM's libunwind). .Pp @@ -1494,6 +1512,8 @@ When set, it enforces these options: .Va WITHOUT_LLD .It .Va WITHOUT_LLDB +.It +.Va WITHOUT_LLVM_COV .El .It Va WITHOUT_UNBOUND Set to not build Modified: user/jeff/numa/share/man/man9/Makefile ============================================================================== --- user/jeff/numa/share/man/man9/Makefile Mon Feb 19 21:58:12 2018 (r329604) +++ user/jeff/numa/share/man/man9/Makefile Mon Feb 19 22:00:02 2018 (r329605) @@ -285,6 +285,7 @@ MAN= accept_filter.9 \ style.9 \ swi.9 \ sx.9 \ + syscall_helper_register.9 \ SYSCALL_MODULE.9 \ sysctl.9 \ sysctl_add_oid.9 \ @@ -1921,6 +1922,11 @@ MLINKS+=sx.9 sx_assert.9 \ sx.9 sx_xlock_sig.9 \ sx.9 sx_xlocked.9 \ sx.9 sx_xunlock.9 +MLINKS+=syscall_helper_register.9 syscall_helper_unregister.9 \ + syscall_helper_register.9 SYSCALL_INIT_HELPER.9 \ + syscall_helper_register.9 SYSCALL_INIT_HELPER_COMPAT.9 \ + syscall_helper_register.9 SYSCALL_INIT_HELPER_COMPAT_F.9 \ + syscall_helper_register.9 SYSCALL_INIT_HELPER_F.9 MLINKS+=sysctl.9 SYSCTL_DECL.9 \ sysctl.9 SYSCTL_ADD_INT.9 \ sysctl.9 SYSCTL_ADD_LONG.9 \ Copied: user/jeff/numa/share/man/man9/syscall_helper_register.9 (from r329139, head/share/man/man9/syscall_helper_register.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jeff/numa/share/man/man9/syscall_helper_register.9 Mon Feb 19 22:00:02 2018 (r329605, copy of r329139, head/share/man/man9/syscall_helper_register.9) @@ -0,0 +1,139 @@ +.\" Copyright (c) 2018 Conrad Meyer +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd February 10, 2018 +.Dt SYSCALL_HELPER_REGISTER 9 +.Os +.Sh NAME +.Nm syscall_helper_register , +.Nm syscall_helper_unregister +.Nd kernel syscall registration routines +.\" +.Sh SYNOPSIS +.In sys/sysent.h +.Ft int +.Fn syscall_helper_register "struct syscall_helper_data *sd" "int flags" +.Ft int +.Fn syscall_helper_unregister "struct syscall_helper_data *sd" +.\" +.Ss INITIALIZER MACROS +.Ft struct syscall_helper_data +.Fn SYSCALL_INIT_HELPER "syscallname" +.Ft struct syscall_helper_data +.Fn SYSCALL_INIT_HELPER_F "syscallname" "int flags" +.\" +.Ss COMPATIBILITY INITIALIZER MACROS +.Ft struct syscall_helper_data +.Fn SYSCALL_INIT_HELPER_COMPAT "syscallname" +.Ft struct syscall_helper_data +.Fn SYSCALL_INIT_HELPER_COMPAT_F "syscallname" "int flags" +.\" +.Sh DESCRIPTION +The +.Fn syscall_helper_register +registers a system call. +This function takes the structure +.Va struct syscall_helper_data sd , +which specifies the parameters for syscall registration: +.Pp +.Bd -literal -offset indent -compact +struct syscall_helper_data { + struct sysent new_sysent; + struct sysent old_sysent; + int syscall_no; + int registered; +}; +.Ed +.Pp +The only valid flag for the +.Fa flags +argument to +.Fn syscall_helper_register +is +.Dv SY_THR_STATIC . +This flag prevents the syscall from being unregistered. +.\" +.Pp +Before use, the structure must be initialized with one of the +.Fn SYSCALL_INIT_HELPER* +macros. +In new code, syscall implementation functions shall be named +.Fn sys_syscallname +and the regular macros shall be used. +.Pp +For legacy syscall functions named without "sys_" prefixes, the "COMPAT" +versions of the macros may be used. +.Pp +The only valid flag for the +.Fa flags +argument to the "F" variants of the initializer macros is +.Dv SYF_CAPENABLED . +This flag indicates that the syscall is allowed in capability mode. +.Pp +The +.Fn syscall_helper_unregister +unregisters a system call. +This function takes the same structure +.Va struct syscall_helper_data sd +that was previously initialized in the manner described above and used in a +successful invocation of +.Fn syscall_helper_register . +.\" +.Sh RETURN VALUES +If successful, +.Fn syscall_helper_register +and +.Fn syscall_helper_unregister +will return 0. +Otherwise, they will return an error. +.\" +.Sh ERRORS +The +.Fn syscall_helper_register +call will fail and the syscall will not be registered if: +.Bl -tag -width Er *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@freebsd.org Mon Feb 19 22:19:47 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E661F03E87 for ; Mon, 19 Feb 2018 22:19:47 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E269B6F210; Mon, 19 Feb 2018 22:19:46 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C352B20707; Mon, 19 Feb 2018 22:19:46 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JMJkn1077707; Mon, 19 Feb 2018 22:19:46 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JMJjJ0077689; Mon, 19 Feb 2018 22:19:45 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802192219.w1JMJjJ0077689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 19 Feb 2018 22:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329607 - in user/jeff/numa/sys: amd64/amd64 amd64/conf amd64/include amd64/linux32 amd64/vmm/amd amd64/vmm/intel arm/allwinner arm/arm arm/conf arm/freescale/imx arm/include arm64/arm6... X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in user/jeff/numa/sys: amd64/amd64 amd64/conf amd64/include amd64/linux32 amd64/vmm/amd amd64/vmm/intel arm/allwinner arm/arm arm/conf arm/freescale/imx arm/include arm64/arm64 arm64/include cam cddl/... X-SVN-Commit-Revision: 329607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:19:47 -0000 Author: jeff Date: Mon Feb 19 22:19:44 2018 New Revision: 329607 URL: https://svnweb.freebsd.org/changeset/base/329607 Log: Merge from head Added: user/jeff/numa/sys/compat/linuxkpi/common/include/linux/dcache.h - copied unchanged from r329605, head/sys/compat/linuxkpi/common/include/linux/dcache.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/irqreturn.h - copied unchanged from r329605, head/sys/compat/linuxkpi/common/include/linux/irqreturn.h user/jeff/numa/sys/dev/bhnd/siba/siba_eromvar.h - copied unchanged from r329605, head/sys/dev/bhnd/siba/siba_eromvar.h user/jeff/numa/sys/dev/mthca/ - copied from r329605, head/sys/dev/mthca/ user/jeff/numa/sys/modules/i2c/ofw_iicbus/ - copied from r329605, head/sys/modules/i2c/ofw_iicbus/ user/jeff/numa/sys/modules/imx/ - copied from r329605, head/sys/modules/imx/ user/jeff/numa/sys/modules/mthca/ - copied from r329605, head/sys/modules/mthca/ user/jeff/numa/sys/modules/spi/ - copied from r329605, head/sys/modules/spi/ user/jeff/numa/sys/ofed/include/uapi/rdma/mthca-abi.h - copied unchanged from r329605, head/sys/ofed/include/uapi/rdma/mthca-abi.h Deleted: user/jeff/numa/sys/amd64/include/varargs.h user/jeff/numa/sys/i386/include/varargs.h user/jeff/numa/sys/mips/include/varargs.h user/jeff/numa/sys/powerpc/include/varargs.h user/jeff/numa/sys/sparc64/include/varargs.h Modified: user/jeff/numa/sys/amd64/amd64/efirt_machdep.c (contents, props changed) user/jeff/numa/sys/amd64/amd64/pmap.c user/jeff/numa/sys/amd64/conf/NOTES user/jeff/numa/sys/amd64/include/asmacros.h user/jeff/numa/sys/amd64/include/pcpu.h user/jeff/numa/sys/amd64/linux32/linux32_dummy.c user/jeff/numa/sys/amd64/vmm/amd/amdvi_hw.c user/jeff/numa/sys/amd64/vmm/amd/amdvi_priv.h user/jeff/numa/sys/amd64/vmm/amd/ivrs_drv.c user/jeff/numa/sys/amd64/vmm/amd/svm.c user/jeff/numa/sys/amd64/vmm/amd/svm_support.S user/jeff/numa/sys/amd64/vmm/intel/vmcs.c user/jeff/numa/sys/amd64/vmm/intel/vmx.h user/jeff/numa/sys/amd64/vmm/intel/vmx_support.S user/jeff/numa/sys/arm/allwinner/aw_mmc.c user/jeff/numa/sys/arm/arm/gic_acpi.c user/jeff/numa/sys/arm/arm/pmap-v6.c user/jeff/numa/sys/arm/conf/IMX53 user/jeff/numa/sys/arm/conf/IMX6 user/jeff/numa/sys/arm/freescale/imx/imx6_machdep.c user/jeff/numa/sys/arm/freescale/imx/imx_i2c.c user/jeff/numa/sys/arm/include/_types.h user/jeff/numa/sys/arm64/arm64/efirt_machdep.c user/jeff/numa/sys/arm64/arm64/pmap.c user/jeff/numa/sys/arm64/include/_types.h user/jeff/numa/sys/cam/cam_periph.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c user/jeff/numa/sys/compat/freebsd32/freebsd32_misc.c user/jeff/numa/sys/compat/freebsd32/freebsd32_proto.h user/jeff/numa/sys/compat/freebsd32/freebsd32_syscall.h user/jeff/numa/sys/compat/freebsd32/freebsd32_syscalls.c user/jeff/numa/sys/compat/freebsd32/freebsd32_sysent.c user/jeff/numa/sys/compat/freebsd32/freebsd32_systrace_args.c user/jeff/numa/sys/compat/freebsd32/syscalls.master user/jeff/numa/sys/compat/linux/linux_file.c user/jeff/numa/sys/compat/linux/linux_ioctl.c user/jeff/numa/sys/compat/linux/linux_ipc.c user/jeff/numa/sys/compat/linux/linux_mib.c user/jeff/numa/sys/compat/linux/linux_signal.c user/jeff/numa/sys/compat/linux/linux_socket.c user/jeff/numa/sys/compat/linux/linux_stats.c user/jeff/numa/sys/compat/linux/linux_sysctl.c user/jeff/numa/sys/compat/linuxkpi/common/include/asm/atomic.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/compiler.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/device.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/fs.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/gfp.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/interrupt.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/kernel.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/kref.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/ktime.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/list.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/lockdep.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/mm.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/mm_types.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/mutex.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/pid.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/printk.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/radix-tree.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/rcupdate.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/slab.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/spinlock.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/string.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/uaccess.h user/jeff/numa/sys/compat/linuxkpi/common/src/linux_compat.c user/jeff/numa/sys/compat/linuxkpi/common/src/linux_hrtimer.c user/jeff/numa/sys/compat/linuxkpi/common/src/linux_radix.c user/jeff/numa/sys/compat/linuxkpi/common/src/linux_tasklet.c user/jeff/numa/sys/conf/NOTES user/jeff/numa/sys/conf/files user/jeff/numa/sys/conf/kern.post.mk user/jeff/numa/sys/conf/kmod.mk user/jeff/numa/sys/conf/options user/jeff/numa/sys/contrib/ck/include/ck_md.h user/jeff/numa/sys/contrib/dev/acpica/include/actbl2.h user/jeff/numa/sys/contrib/zstd/lib/freebsd/stdlib.h user/jeff/numa/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h user/jeff/numa/sys/dev/bhnd/siba/siba.c user/jeff/numa/sys/dev/bhnd/siba/siba_erom.c user/jeff/numa/sys/dev/bhnd/siba/siba_subr.c user/jeff/numa/sys/dev/bhnd/siba/sibavar.h user/jeff/numa/sys/dev/bwn/if_bwn.c user/jeff/numa/sys/dev/bwn/if_bwn_debug.h user/jeff/numa/sys/dev/bwn/if_bwn_phy_g.c user/jeff/numa/sys/dev/gpio/gpiobusvar.h user/jeff/numa/sys/dev/gpio/ofw_gpiobus.c user/jeff/numa/sys/dev/iicbus/iicbus.h user/jeff/numa/sys/dev/iicbus/ofw_iicbus.c user/jeff/numa/sys/dev/mpr/mpr.c user/jeff/numa/sys/dev/mpr/mpr_sas.c user/jeff/numa/sys/dev/mpr/mprvar.h user/jeff/numa/sys/dev/mps/mps.c user/jeff/numa/sys/dev/mps/mps_sas.c user/jeff/numa/sys/dev/mps/mpsvar.h user/jeff/numa/sys/dev/mxge/if_mxge.c user/jeff/numa/sys/dev/ofw/ofw_standard.c user/jeff/numa/sys/dev/pci/hostb_pci.c user/jeff/numa/sys/dev/pci/pci.c user/jeff/numa/sys/dev/pci/pci_if.m user/jeff/numa/sys/dev/pci/pci_private.h user/jeff/numa/sys/dev/pci/pcivar.h user/jeff/numa/sys/dev/pci/vga_pci.c user/jeff/numa/sys/dev/sdhci/fsl_sdhci.c user/jeff/numa/sys/dev/spibus/ofw_spibus.c user/jeff/numa/sys/dev/spibus/spibusvar.h user/jeff/numa/sys/dev/usb/controller/ehci_imx.c user/jeff/numa/sys/dev/usb/quirk/usb_quirk.c user/jeff/numa/sys/dev/usb/usb_lookup.c user/jeff/numa/sys/dev/usb/usbdevs user/jeff/numa/sys/dev/usb/usbdi.h user/jeff/numa/sys/dev/virtio/virtio.c user/jeff/numa/sys/dev/virtio/virtio.h user/jeff/numa/sys/dev/virtio/virtio_bus_if.m user/jeff/numa/sys/dev/virtio/virtqueue.c user/jeff/numa/sys/dev/virtio/virtqueue.h user/jeff/numa/sys/geom/eli/g_eli.c user/jeff/numa/sys/geom/geom_io.c user/jeff/numa/sys/geom/journal/g_journal_ufs.c user/jeff/numa/sys/geom/label/g_label_ufs.c user/jeff/numa/sys/geom/part/g_part.c user/jeff/numa/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c user/jeff/numa/sys/i386/conf/NOTES user/jeff/numa/sys/i386/i386/pmap.c user/jeff/numa/sys/i386/linux/imgact_linux.c user/jeff/numa/sys/i386/linux/linux_dummy.c user/jeff/numa/sys/i386/linux/linux_machdep.c user/jeff/numa/sys/i386/linux/linux_ptrace.c user/jeff/numa/sys/i386/linux/linux_sysvec.c user/jeff/numa/sys/kern/kern_exit.c user/jeff/numa/sys/kern/kern_fork.c user/jeff/numa/sys/kern/kern_mutex.c user/jeff/numa/sys/kern/kern_rwlock.c user/jeff/numa/sys/kern/kern_shutdown.c user/jeff/numa/sys/kern/kern_sig.c user/jeff/numa/sys/kern/kern_sx.c user/jeff/numa/sys/kern/kern_time.c user/jeff/numa/sys/kern/subr_clock.c user/jeff/numa/sys/kern/subr_compressor.c user/jeff/numa/sys/kern/subr_rtc.c user/jeff/numa/sys/kern/sys_capability.c user/jeff/numa/sys/kern/sysv_msg.c user/jeff/numa/sys/kern/sysv_sem.c user/jeff/numa/sys/kern/sysv_shm.c user/jeff/numa/sys/kern/vfs_acl.c user/jeff/numa/sys/kern/vfs_bio.c user/jeff/numa/sys/kgssapi/gss_impl.c user/jeff/numa/sys/libkern/strcmp.c user/jeff/numa/sys/libkern/strncat.c user/jeff/numa/sys/libkern/strncpy.c user/jeff/numa/sys/libkern/strsep.c user/jeff/numa/sys/libkern/strstr.c user/jeff/numa/sys/mips/include/_types.h user/jeff/numa/sys/mips/include/stdarg.h user/jeff/numa/sys/mips/mips/pmap.c user/jeff/numa/sys/modules/Makefile user/jeff/numa/sys/modules/bwn/Makefile user/jeff/numa/sys/modules/i2c/Makefile user/jeff/numa/sys/modules/i2c/iicbus/Makefile user/jeff/numa/sys/netgraph/ng_pppoe.c user/jeff/numa/sys/netgraph/ng_pppoe.h user/jeff/numa/sys/netinet6/nd6_rtr.c user/jeff/numa/sys/netipsec/ipsec.c user/jeff/numa/sys/netipsec/ipsec.h user/jeff/numa/sys/netipsec/xform_ah.c user/jeff/numa/sys/powerpc/aim/aim_machdep.c user/jeff/numa/sys/powerpc/aim/mmu_oea64.c user/jeff/numa/sys/powerpc/aim/moea64_native.c user/jeff/numa/sys/powerpc/aim/slb.c user/jeff/numa/sys/powerpc/booke/booke_machdep.c user/jeff/numa/sys/powerpc/booke/pmap.c user/jeff/numa/sys/powerpc/include/_types.h user/jeff/numa/sys/powerpc/include/pcpu.h user/jeff/numa/sys/powerpc/include/stdarg.h user/jeff/numa/sys/powerpc/ofw/ofw_real.c user/jeff/numa/sys/powerpc/powerpc/genassym.c user/jeff/numa/sys/powerpc/powerpc/trap.c user/jeff/numa/sys/powerpc/ps3/mmu_ps3.c user/jeff/numa/sys/powerpc/pseries/mmu_phyp.c user/jeff/numa/sys/powerpc/pseries/phyp-hvcall.h user/jeff/numa/sys/powerpc/pseries/platform_chrp.c user/jeff/numa/sys/riscv/include/_types.h user/jeff/numa/sys/riscv/include/stdarg.h user/jeff/numa/sys/riscv/riscv/pmap.c user/jeff/numa/sys/security/mac/mac_syscalls.c user/jeff/numa/sys/sparc64/include/_types.h user/jeff/numa/sys/sparc64/include/stdarg.h user/jeff/numa/sys/sparc64/sparc64/pmap.c user/jeff/numa/sys/sys/_types.h user/jeff/numa/sys/sys/aio.h user/jeff/numa/sys/sys/clock.h user/jeff/numa/sys/sys/compressor.h user/jeff/numa/sys/sys/ipc.h user/jeff/numa/sys/sys/kerneldump.h user/jeff/numa/sys/sys/lockstat.h user/jeff/numa/sys/sys/module.h user/jeff/numa/sys/sys/msg.h user/jeff/numa/sys/sys/mutex.h user/jeff/numa/sys/sys/param.h user/jeff/numa/sys/sys/sem.h user/jeff/numa/sys/sys/shm.h user/jeff/numa/sys/sys/vmmeter.h user/jeff/numa/sys/ufs/ffs/ffs_subr.c user/jeff/numa/sys/ufs/ffs/ffs_vfsops.c user/jeff/numa/sys/vm/swap_pager.c user/jeff/numa/sys/vm/vm_fault.c user/jeff/numa/sys/vm/vm_page.c user/jeff/numa/sys/vm/vm_reserv.c user/jeff/numa/sys/x86/include/_types.h user/jeff/numa/sys/x86/include/specialreg.h user/jeff/numa/sys/x86/iommu/intel_gas.c user/jeff/numa/sys/x86/x86/cpu_machdep.c user/jeff/numa/sys/x86/x86/mp_x86.c user/jeff/numa/sys/x86/xen/pv.c user/jeff/numa/sys/x86/xen/xenpv.c Directory Properties: user/jeff/numa/sys/cddl/contrib/opensolaris/ (props changed) user/jeff/numa/sys/contrib/ck/ (props changed) user/jeff/numa/sys/contrib/dev/acpica/ (props changed) user/jeff/numa/sys/contrib/zstd/ (props changed) Modified: user/jeff/numa/sys/amd64/amd64/efirt_machdep.c ============================================================================== --- user/jeff/numa/sys/amd64/amd64/efirt_machdep.c Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/amd64/efirt_machdep.c Mon Feb 19 22:19:44 2018 (r329607) @@ -74,8 +74,7 @@ efi_destroy_1t1_map(void) VM_OBJECT_RLOCK(obj_1t1_pt); TAILQ_FOREACH(m, &obj_1t1_pt->memq, listq) m->wire_count = 0; - VM_CNT_ADD(v_wire_count, - -obj_1t1_pt->resident_page_count); + vm_wire_sub(obj_1t1_pt->resident_page_count); VM_OBJECT_RUNLOCK(obj_1t1_pt); vm_object_deallocate(obj_1t1_pt); } Modified: user/jeff/numa/sys/amd64/amd64/pmap.c ============================================================================== --- user/jeff/numa/sys/amd64/amd64/pmap.c Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/amd64/pmap.c Mon Feb 19 22:19:44 2018 (r329607) @@ -11,17 +11,11 @@ * All rights reserved. * Copyright (c) 2005-2010 Alan L. Cox * All rights reserved. - * Copyright (c) 2014-2018 The FreeBSD Foundation - * All rights reserved. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer * Science Department and William Jolitz of UUNET Technologies Inc. * - * Portions of this software were developed by - * Konstantin Belousov under sponsorship from - * the FreeBSD Foundation. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -54,6 +48,7 @@ */ /*- * Copyright (c) 2003 Networks Associates Technology, Inc. + * Copyright (c) 2014-2018 The FreeBSD Foundation * All rights reserved. * * This software was developed for the FreeBSD Project by Jake Burkholder, @@ -62,6 +57,10 @@ * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA * CHATS research program. * + * Portions of this software were developed by + * Konstantin Belousov under sponsorship from + * the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -1244,7 +1243,9 @@ pmap_init(void) ("pmap_init: page table page is out of range")); mpte->pindex = pmap_pde_pindex(KERNBASE) + i; mpte->phys_addr = KPTphys + (i << PAGE_SHIFT); + mpte->wire_count = 1; } + vm_wire_add(nkpt); /* * If the kernel is running on a virtual machine, then it must assume @@ -2337,7 +2338,7 @@ pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) pa = VM_PAGE_TO_PHYS(m) | cache_bits; if ((*pte & (PG_FRAME | X86_PG_PTE_CACHE)) != pa) { oldpte |= *pte; - pte_store(pte, pa | pg_g | X86_PG_RW | X86_PG_V); + pte_store(pte, pa | pg_g | pg_nx | X86_PG_RW | X86_PG_V); } pte++; } @@ -2379,7 +2380,7 @@ pmap_free_zero_pages(struct spglist *free) /* Preserve the page's PG_ZERO setting. */ vm_page_free_toq(m); } - VM_CNT_ADD(v_wire_count, -count); + vm_wire_sub(count); } /* Modified: user/jeff/numa/sys/amd64/conf/NOTES ============================================================================== --- user/jeff/numa/sys/amd64/conf/NOTES Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/conf/NOTES Mon Feb 19 22:19:44 2018 (r329607) @@ -315,6 +315,7 @@ options DRM_DEBUG # Include debug printfs (slow) # Requires the iwn firmware module # ixl: Intel XL710 40Gbe PCIE Ethernet # ixlv: Intel XL710 40Gbe VF PCIE Ethernet +# mthca: Mellanox HCA InfiniBand # mlx4ib: Mellanox ConnectX HCA InfiniBand # mlx4en: Mellanox ConnectX HCA Ethernet # nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) @@ -334,6 +335,7 @@ device iwn # Intel 4965/1000/5000/6000 wireless NICs device ixl # Intel XL710 40Gbe PCIE Ethernet options IXL_IW # Enable iWARP Client Interface in ixl(4) device ixlv # Intel XL710 40Gbe VF PCIE Ethernet +device mthca # Mellanox HCA InfiniBand device mlx4 # Shared code module between IB and Ethernet device mlx4ib # Mellanox ConnectX HCA InfiniBand device mlx4en # Mellanox ConnectX HCA Ethernet Modified: user/jeff/numa/sys/amd64/include/asmacros.h ============================================================================== --- user/jeff/numa/sys/amd64/include/asmacros.h Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/include/asmacros.h Mon Feb 19 22:19:44 2018 (r329607) @@ -175,11 +175,11 @@ .endm .macro MOVE_STACKS qw - offset=0 + .L.offset=0 .rept \qw - movq offset(%rsp),%rdx - movq %rdx,offset(%rax) - offset=offset+8 + movq .L.offset(%rsp),%rdx + movq %rdx,.L.offset(%rax) + .L.offset=.L.offset+8 .endr .endm Modified: user/jeff/numa/sys/amd64/include/pcpu.h ============================================================================== --- user/jeff/numa/sys/amd64/include/pcpu.h Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/include/pcpu.h Mon Feb 19 22:19:44 2018 (r329607) @@ -75,7 +75,7 @@ uint32_t pc_pcid_gen; \ uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ uint32_t pc_ibpb_set; \ - char __pad[216] /* be divisor of PAGE_SIZE \ + char __pad[224] /* be divisor of PAGE_SIZE \ after cache alignment */ #define PC_DBREG_CMD_NONE 0 Modified: user/jeff/numa/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- user/jeff/numa/sys/amd64/linux32/linux32_dummy.c Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/linux32/linux32_dummy.c Mon Feb 19 22:19:44 2018 (r329607) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1994-1995 Søren Schmidt * All rights reserved. @@ -8,24 +8,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: user/jeff/numa/sys/amd64/vmm/amd/amdvi_hw.c ============================================================================== --- user/jeff/numa/sys/amd64/vmm/amd/amdvi_hw.c Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/vmm/amd/amdvi_hw.c Mon Feb 19 22:19:44 2018 (r329607) @@ -745,23 +745,8 @@ amdvi_print_pci_cap(device_t dev) softc->pci_cap = cap >> 24; device_printf(softc->dev, "PCI cap 0x%x@0x%x feature:%b\n", cap, off, softc->pci_cap, - "\020\001IOTLB\002HT\003NPCache\004EFR"); + "\20\1IOTLB\2HT\3NPCache\4EFR\5CapExt"); - /* IOMMU spec Rev 2.0, section 3.7.2.1 */ - softc->pci_efr = softc->ctrl->ex_feature; - if (softc->pci_efr) { - device_printf(softc->dev, "PCI extended Feature:%b\n", - (int)softc->pci_efr, - "\020\001PreFSup\002PPRSup\003XTSup\004NXSup\006IASup" - "\007GASup\008HESup\009PCSup"); - device_printf(softc->dev, - "PCI HATS = %d GATS = %d GLXSup = %d, max PASID: 0x%x ", - (int)((softc->pci_efr >> 10) & 0x3), - (int)((softc->pci_efr >> 12) & 0x3), - (int)((softc->pci_efr >> 14) & 0x3), - (int)((softc->pci_efr >> 32) & 0x1F) + 1); - } - return (0); } @@ -1040,7 +1025,7 @@ amdvi_init(void) } if (!amdvi_enable_user && ivhd_count) { printf("bhyve: Found %d AMD-Vi/IOMMU device(s), " - "use hw.vmm.amdvi_enable=1 to enable pass-through.\n", + "use hw.vmm.amdvi.enable=1 to enable pass-through.\n", ivhd_count); return (EINVAL); } @@ -1315,40 +1300,41 @@ static void amdvi_set_dte(struct amdvi_domain *domain, uint16_t devid, bool enable) { struct amdvi_softc *softc; - struct amdvi_dte temp; + struct amdvi_dte* temp; + KASSERT(domain, ("domain is NULL for pci_rid:0x%x\n", devid)); + softc = amdvi_find_iommu(devid); KASSERT(softc, ("softc is NULL for pci_rid:0x%x\n", devid)); - memset(&temp, 0, sizeof(struct amdvi_dte)); + temp = &amdvi_dte[devid]; #ifdef AMDVI_ATS_ENABLE /* If IOMMU and device support IOTLB, enable it. */ if (amdvi_dev_support_iotlb(softc, devid) && softc->iotlb) - temp.iotlb_enable = 1; + temp->iotlb_enable = 1; #endif /* Avoid duplicate I/O faults. */ - temp.sup_second_io_fault = 1; - temp.sup_all_io_fault = amdvi_disable_io_fault; + temp->sup_second_io_fault = 1; + temp->sup_all_io_fault = amdvi_disable_io_fault; - temp.dt_valid = 1; - temp.domain_id = domain->id; + temp->dt_valid = 1; + temp->domain_id = domain->id; if (enable) { if (domain->ptp) { - temp.pt_base = vtophys(domain->ptp) >> 12; - temp.pt_level = amdvi_ptp_level; + temp->pt_base = vtophys(domain->ptp) >> 12; + temp->pt_level = amdvi_ptp_level; } /* * XXX: Page table valid[TV] bit must be set even if host domain * page tables are not enabled. */ - temp.pt_valid = 1; - temp.read_allow = 1; - temp.write_allow = 1; + temp->pt_valid = 1; + temp->read_allow = 1; + temp->write_allow = 1; } - amdvi_dte[devid] = temp; } static void Modified: user/jeff/numa/sys/amd64/vmm/amd/amdvi_priv.h ============================================================================== --- user/jeff/numa/sys/amd64/vmm/amd/amdvi_priv.h Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/vmm/amd/amdvi_priv.h Mon Feb 19 22:19:44 2018 (r329607) @@ -29,6 +29,8 @@ #ifndef _AMDVI_PRIV_H_ #define _AMDVI_PRIV_H_ +#include + #define BIT(n) (1ULL << (n)) /* Return value of bits[n:m] where n and (n >= ) m are bit positions. */ #define REG_BITS(x, n, m) (((x) >> (m)) & \ @@ -358,6 +360,7 @@ struct amdvi_domain { struct amdvi_softc { struct amdvi_ctrl *ctrl; /* Control area. */ device_t dev; /* IOMMU device. */ + enum AcpiIvrsType ivhd_type; /* IOMMU IVHD type 0x10/0x11 or 0x40 */ bool iotlb; /* IOTLB supported by IOMMU */ struct amdvi_cmd *cmd; /* Command descriptor area. */ int cmd_max; /* Max number of commands. */ @@ -370,11 +373,11 @@ struct amdvi_softc { int event_rid; /* ACPI various flags. */ uint32_t ivhd_flag; /* ACPI IVHD flag. */ - uint32_t ivhd_efr; /* ACPI v1 Reserved or v2 EFR . */ + uint32_t ivhd_feature; /* ACPI v1 Reserved or v2 attribute. */ + uint64_t ext_feature; /* IVHD EFR */ /* PCI related. */ uint16_t cap_off; /* PCI Capability offset. */ uint8_t pci_cap; /* PCI capability. */ - uint64_t pci_efr; /* PCI EFR for rev2.0 */ uint16_t pci_seg; /* IOMMU PCI domain/segment. */ uint16_t pci_rid; /* PCI BDF of IOMMU */ /* Device range under this IOMMU. */ Modified: user/jeff/numa/sys/amd64/vmm/amd/ivrs_drv.c ============================================================================== --- user/jeff/numa/sys/amd64/vmm/amd/ivrs_drv.c Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/vmm/amd/ivrs_drv.c Mon Feb 19 22:19:44 2018 (r329607) @@ -47,12 +47,16 @@ __FBSDID("$FreeBSD$"); #include "amdvi_priv.h" device_t *ivhd_devs; /* IVHD or AMD-Vi device list. */ -int ivhd_count; /* Number of IVHD or AMD-Vi devices. */ +int ivhd_count; /* Number of IVHD header. */ +/* + * Cached IVHD header list. + * Single entry for each IVHD, filtered the legacy one. + */ +ACPI_IVRS_HARDWARE *ivhd_hdrs[10]; extern int amdvi_ptp_level; /* Page table levels. */ -typedef int (*ivhd_iter_t)(ACPI_IVRS_HEADER * ptr, void *arg); - +typedef int (*ivhd_iter_t)(ACPI_IVRS_HEADER *ptr, void *arg); /* * Iterate IVRS table for IVHD and IVMD device type. */ @@ -107,14 +111,19 @@ ivrs_hdr_iterate_tbl(ivhd_iter_t iter, void *arg) } } -static int +static bool ivrs_is_ivhd(UINT8 type) { - if ((type == ACPI_IVRS_TYPE_HARDWARE) || (type == 0x11) || (type == 0x40)) - return (1); + switch(type) { + case ACPI_IVRS_TYPE_HARDWARE: + case ACPI_IVRS_TYPE_HARDWARE_EXT1: + case ACPI_IVRS_TYPE_HARDWARE_EXT2: + return (true); - return (0); + default: + return (false); + } } /* Count the number of AMD-Vi devices in the system. */ @@ -184,7 +193,7 @@ ivhd_dev_add_entry(struct amdvi_softc *softc, uint32_t * Record device attributes as suggested by BIOS. */ static int -ivhd_dev_parse(ACPI_IVRS_HARDWARE * ivhd, struct amdvi_softc *softc) +ivhd_dev_parse(ACPI_IVRS_HARDWARE* ivhd, struct amdvi_softc *softc) { ACPI_IVRS_DE_HEADER *de; uint8_t *p, *end; @@ -196,11 +205,26 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE * ivhd, struct amdvi softc->start_dev_rid = ~0; softc->end_dev_rid = 0; - /* - * XXX The following actually depends on Header.Type and - * is only true for 0x10. - */ - p = (uint8_t *)ivhd + sizeof(ACPI_IVRS_HARDWARE); + switch (ivhd->Header.Type) { + case ACPI_IVRS_TYPE_HARDWARE_EXT1: + case ACPI_IVRS_TYPE_HARDWARE_EXT2: + p = (uint8_t *)ivhd + sizeof(ACPI_IVRS_HARDWARE_NEW); + de = (ACPI_IVRS_DE_HEADER *) ((uint8_t *)ivhd + + sizeof(ACPI_IVRS_HARDWARE_NEW)); + break; + + case ACPI_IVRS_TYPE_HARDWARE: + p = (uint8_t *)ivhd + sizeof(ACPI_IVRS_HARDWARE); + de = (ACPI_IVRS_DE_HEADER *) ((uint8_t *)ivhd + + sizeof(ACPI_IVRS_HARDWARE)); + break; + + default: + device_printf(softc->dev, + "unknown type: 0x%x\n", ivhd->Header.Type); + return (-1); + } + end = (uint8_t *)ivhd + ivhd->Header.Length; while (p < end) { @@ -285,14 +309,30 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE * ivhd, struct amdvi return (0); } +static bool +ivhd_is_newer(ACPI_IVRS_HEADER *old, ACPI_IVRS_HEADER *new) +{ + /* + * Newer IVRS header type take precedence. + */ + if ((old->DeviceId == new->DeviceId) && + (old->Type == ACPI_IVRS_TYPE_HARDWARE) && + ((new->Type == ACPI_IVRS_TYPE_HARDWARE_EXT1) || + (new->Type == ACPI_IVRS_TYPE_HARDWARE_EXT1))) { + return (true); + } + + return (false); +} + static void ivhd_identify(driver_t *driver, device_t parent) { ACPI_TABLE_IVRS *ivrs; ACPI_IVRS_HARDWARE *ivhd; ACPI_STATUS status; - uint32_t info; int i, count = 0; + uint32_t ivrs_ivinfo; if (acpi_disabled("ivhd")) return; @@ -305,25 +345,41 @@ ivhd_identify(driver_t *driver, device_t parent) return; } - info = ivrs->Info; - printf("AMD-Vi IVRS VAsize = %d PAsize = %d GVAsize = %d flags:%b\n", - REG_BITS(info, 21, 15), REG_BITS(info, 14, 8), - REG_BITS(info, 7, 5), REG_BITS(info, 22, 22), - "\020\001HtAtsResv"); + ivrs_ivinfo = ivrs->Info; + printf("AMD-Vi: IVRS Info VAsize = %d PAsize = %d GVAsize = %d" + " flags:%b\n", + REG_BITS(ivrs_ivinfo, 21, 15), REG_BITS(ivrs_ivinfo, 14, 8), + REG_BITS(ivrs_ivinfo, 7, 5), REG_BITS(ivrs_ivinfo, 22, 22), + "\020\001EFRSup"); ivrs_hdr_iterate_tbl(ivhd_count_iter, NULL); if (!ivhd_count) return; - ivhd_devs = malloc(sizeof(device_t) * ivhd_count, M_DEVBUF, - M_WAITOK | M_ZERO); for (i = 0; i < ivhd_count; i++) { ivhd = ivhd_find_by_index(i); - if (ivhd == NULL) { - printf("Can't find IVHD entry%d\n", i); - continue; + KASSERT(ivhd, ("ivhd%d is NULL\n", i)); + ivhd_hdrs[i] = ivhd; + } + + /* + * Scan for presence of legacy and non-legacy device type + * for same AMD-Vi device and override the old one. + */ + for (i = ivhd_count - 1 ; i > 0 ; i--){ + if (ivhd_is_newer(&ivhd_hdrs[i-1]->Header, + &ivhd_hdrs[i]->Header)) { + ivhd_hdrs[i-1] = ivhd_hdrs[i]; + ivhd_count--; } + } + ivhd_devs = malloc(sizeof(device_t) * ivhd_count, M_DEVBUF, + M_WAITOK | M_ZERO); + for (i = 0; i < ivhd_count; i++) { + ivhd = ivhd_hdrs[i]; + KASSERT(ivhd, ("ivhd%d is NULL\n", i)); + /* * Use a high order to ensure that this driver is probed after * the Host-PCI bridge and the root PCI bus. @@ -338,7 +394,7 @@ ivhd_identify(driver_t *driver, device_t parent) if (ivhd_devs[i] == NULL) { ivhd_devs[i] = device_find_child(parent, "ivhd", i); if (ivhd_devs[i] == NULL) { - printf("AMD-Vi: cant find AMD-Vi dev%d\n", i); + printf("AMD-Vi: cant find ivhd%d\n", i); break; } } @@ -354,14 +410,169 @@ ivhd_identify(driver_t *driver, device_t parent) static int ivhd_probe(device_t dev) { + ACPI_IVRS_HARDWARE *ivhd; + int unit; if (acpi_get_handle(dev) != NULL) return (ENXIO); - device_set_desc(dev, "AMD-Vi/IOMMU or ivhd"); + unit = device_get_unit(dev); + KASSERT((unit < ivhd_count), + ("ivhd unit %d > count %d", unit, ivhd_count)); + ivhd = ivhd_hdrs[unit]; + KASSERT(ivhd, ("ivhd is NULL")); + + if (ivhd->Header.Type == ACPI_IVRS_TYPE_HARDWARE) + device_set_desc(dev, "AMD-Vi/IOMMU ivhd"); + else + device_set_desc(dev, "AMD-Vi/IOMMU ivhd with EFR"); + return (BUS_PROBE_NOWILDCARD); } +static void +ivhd_print_flag(device_t dev, enum AcpiIvrsType ivhd_type, uint8_t flag) +{ + /* + * IVHD lgeacy type has two extra high bits in flag which has + * been moved to EFR for non-legacy device. + */ + switch (ivhd_type) { + case ACPI_IVRS_TYPE_HARDWARE: + device_printf(dev, "Flag:%b\n", flag, + "\020" + "\001HtTunEn" + "\002PassPW" + "\003ResPassPW" + "\004Isoc" + "\005IotlbSup" + "\006Coherent" + "\007PreFSup" + "\008PPRSup"); + break; + + case ACPI_IVRS_TYPE_HARDWARE_EXT1: + case ACPI_IVRS_TYPE_HARDWARE_EXT2: + device_printf(dev, "Flag:%b\n", flag, + "\020" + "\001HtTunEn" + "\002PassPW" + "\003ResPassPW" + "\004Isoc" + "\005IotlbSup" + "\006Coherent"); + break; + + default: + device_printf(dev, "Can't decode flag of ivhd type :0x%x\n", + ivhd_type); + break; + } +} + +/* + * Feature in legacy IVHD type(0x10) and attribute in newer type(0x11 and 0x40). + */ +static void +ivhd_print_feature(device_t dev, enum AcpiIvrsType ivhd_type, uint32_t feature) +{ + switch (ivhd_type) { + case ACPI_IVRS_TYPE_HARDWARE: + device_printf(dev, "Features(type:0x%x) HATS = %d GATS = %d" + " MsiNumPPR = %d PNBanks= %d PNCounters= %d\n", + ivhd_type, + REG_BITS(feature, 31, 30), + REG_BITS(feature, 29, 28), + REG_BITS(feature, 27, 23), + REG_BITS(feature, 22, 17), + REG_BITS(feature, 16, 13)); + device_printf(dev, "max PASID = %d GLXSup = %d Feature:%b\n", + REG_BITS(feature, 12, 8), + REG_BITS(feature, 4, 3), + feature, + "\020" + "\002NXSup" + "\003GTSup" + "\004" + "\005IASup" + "\006GASup" + "\007HESup"); + break; + + /* Fewer features or attributes are reported in non-legacy type. */ + case ACPI_IVRS_TYPE_HARDWARE_EXT1: + case ACPI_IVRS_TYPE_HARDWARE_EXT2: + device_printf(dev, "Features(type:0x%x) MsiNumPPR = %d" + " PNBanks= %d PNCounters= %d\n", + ivhd_type, + REG_BITS(feature, 27, 23), + REG_BITS(feature, 22, 17), + REG_BITS(feature, 16, 13)); + break; + + default: /* Other ivhd type features are not decoded. */ + device_printf(dev, "Can't decode ivhd type :0x%x\n", ivhd_type); + } +} + +/* Print extended features of IOMMU. */ +static void +ivhd_print_ext_feature(device_t dev, uint64_t ext_feature) +{ + uint32_t ext_low, ext_high; + + if (!ext_feature) + return; + + ext_low = ext_feature; + device_printf(dev, "Extended features[31:0]:%b " + "HATS = 0x%x GATS = 0x%x " + "GLXSup = 0x%x SmiFSup = 0x%x SmiFRC = 0x%x " + "GAMSup = 0x%x DualPortLogSup = 0x%x DualEventLogSup = 0x%x\n", + (int)ext_low, + "\020" + "\001PreFSup" + "\002PPRSup" + "\003" + "\004NXSup" + "\005GTSup" + "\006" + "\007IASup" + "\008GASup" + "\009HESup" + "\010PCSup", + REG_BITS(ext_low, 11, 10), + REG_BITS(ext_low, 13, 12), + REG_BITS(ext_low, 15, 14), + REG_BITS(ext_low, 17, 16), + REG_BITS(ext_low, 20, 18), + REG_BITS(ext_low, 23, 21), + REG_BITS(ext_low, 25, 24), + REG_BITS(ext_low, 29, 28)); + + ext_high = ext_feature >> 32; + device_printf(dev, "Extended features[62:32]:%b " + "Max PASID: 0x%x DevTblSegSup = 0x%x " + "MarcSup = 0x%x\n", + (int)(ext_high), + "\020" + "\006USSup" + "\009PprOvrflwEarlySup" + "\010PPRAutoRspSup" + "\013BlKStopMrkSup" + "\014PerfOptSup" + "\015MsiCapMmioSup" + "\017GIOSup" + "\018HASup" + "\019EPHSup" + "\020AttrFWSup" + "\021HDSup" + "\023InvIotlbSup", + REG_BITS(ext_high, 5, 0), + REG_BITS(ext_high, 8, 7), + REG_BITS(ext_high, 11, 10)); +} + static int ivhd_print_cap(struct amdvi_softc *softc, ACPI_IVRS_HARDWARE * ivhd) { @@ -369,41 +580,23 @@ ivhd_print_cap(struct amdvi_softc *softc, ACPI_IVRS_HA int max_ptp_level; dev = softc->dev; - device_printf(dev, "Flag:%b\n", softc->ivhd_flag, - "\020\001HtTunEn\002PassPW\003ResPassPW\004Isoc\005IotlbSup" - "\006Coherent\007PreFSup\008PPRSup"); - /* - * If no extended feature[EFR], its rev1 with maximum paging level as 7. - */ + + ivhd_print_flag(dev, softc->ivhd_type, softc->ivhd_flag); + ivhd_print_feature(dev, softc->ivhd_type, softc->ivhd_feature); + ivhd_print_ext_feature(dev, softc->ext_feature); max_ptp_level = 7; - if (softc->ivhd_efr) { - device_printf(dev, "EFR HATS = %d GATS = %d GLXSup = %d " - "MsiNumPr = %d PNBanks= %d PNCounters= %d\n" - "max PASID = %d EFR: %b \n", - REG_BITS(softc->ivhd_efr, 31, 30), - REG_BITS(softc->ivhd_efr, 29, 28), - REG_BITS(softc->ivhd_efr, 4, 3), - REG_BITS(softc->ivhd_efr, 27, 23), - REG_BITS(softc->ivhd_efr, 22, 17), - REG_BITS(softc->ivhd_efr, 16, 13), - REG_BITS(softc->ivhd_efr, 12, 8), - softc->ivhd_efr, "\020\001XTSup\002NXSup\003GTSup\005IASup" - "\006GASup\007HESup\008PPRSup"); - - max_ptp_level = REG_BITS(softc->ivhd_efr, 31, 30) + 4; - } - /* Make sure device support minimum page level as requested by user. */ if (max_ptp_level < amdvi_ptp_level) { - device_printf(dev, "Insufficient PTP level:%d\n", - max_ptp_level); + device_printf(dev, "insufficient PTP level:%d\n", + max_ptp_level); return (EINVAL); + } else { + device_printf(softc->dev, "supported paging level:%d, will use only: %d\n", + max_ptp_level, amdvi_ptp_level); } - device_printf(softc->dev, "max supported paging level:%d restricting to: %d\n", - max_ptp_level, amdvi_ptp_level); - device_printf(softc->dev, "device supported range " - "[0x%x - 0x%x]\n", softc->start_dev_rid, softc->end_dev_rid); + device_printf(softc->dev, "device range: 0x%x - 0x%x\n", + softc->start_dev_rid, softc->end_dev_rid); return (0); } @@ -412,25 +605,32 @@ static int ivhd_attach(device_t dev) { ACPI_IVRS_HARDWARE *ivhd; + ACPI_IVRS_HARDWARE_NEW *ivhd1; struct amdvi_softc *softc; int status, unit; unit = device_get_unit(dev); + KASSERT((unit < ivhd_count), + ("ivhd unit %d > count %d", unit, ivhd_count)); /* Make sure its same device for which attach is called. */ - if (ivhd_devs[unit] != dev) - panic("Not same device old %p new %p", ivhd_devs[unit], dev); + KASSERT((ivhd_devs[unit] == dev), + ("Not same device old %p new %p", ivhd_devs[unit], dev)); softc = device_get_softc(dev); softc->dev = dev; - ivhd = ivhd_find_by_index(unit); - if (ivhd == NULL) - return (EINVAL); + ivhd = ivhd_hdrs[unit]; + KASSERT(ivhd, ("ivhd is NULL")); + softc->ivhd_type = ivhd->Header.Type; softc->pci_seg = ivhd->PciSegmentGroup; softc->pci_rid = ivhd->Header.DeviceId; softc->ivhd_flag = ivhd->Header.Flags; - softc->ivhd_efr = ivhd->Reserved; /* + * On lgeacy IVHD type(0x10), it is documented as feature + * but in newer type it is attribute. + */ + softc->ivhd_feature = ivhd->Reserved; + /* * PCI capability has more capabilities that are not part of IVRS. */ softc->cap_off = ivhd->CapabilityOffset; @@ -439,6 +639,15 @@ ivhd_attach(device_t dev) /* IVHD Info bit[4:0] is event MSI/X number. */ softc->event_msix = ivhd->Info & 0x1F; #endif + switch (ivhd->Header.Type) { + case ACPI_IVRS_TYPE_HARDWARE_EXT1: + case ACPI_IVRS_TYPE_HARDWARE_EXT2: + ivhd1 = (ACPI_IVRS_HARDWARE_NEW *)ivhd; + softc->ext_feature = ivhd1->ExtFR; + break; + + } + softc->ctrl = (struct amdvi_ctrl *) PHYS_TO_DMAP(ivhd->BaseAddress); status = ivhd_dev_parse(ivhd, softc); if (status != 0) { Modified: user/jeff/numa/sys/amd64/vmm/amd/svm.c ============================================================================== --- user/jeff/numa/sys/amd64/vmm/amd/svm.c Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/vmm/amd/svm.c Mon Feb 19 22:19:44 2018 (r329607) @@ -969,6 +969,7 @@ svm_save_intinfo(struct svm_softc *svm_sc, int vcpu) vm_exit_intinfo(svm_sc->vm, vcpu, intinfo); } +#ifdef INVARIANTS static __inline int vintr_intercept_enabled(struct svm_softc *sc, int vcpu) { @@ -976,6 +977,7 @@ vintr_intercept_enabled(struct svm_softc *sc, int vcpu return (svm_get_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_VINTR)); } +#endif static __inline void enable_intr_window_exiting(struct svm_softc *sc, int vcpu) Modified: user/jeff/numa/sys/amd64/vmm/amd/svm_support.S ============================================================================== --- user/jeff/numa/sys/amd64/vmm/amd/svm_support.S Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/vmm/amd/svm_support.S Mon Feb 19 22:19:44 2018 (r329607) @@ -113,6 +113,23 @@ ENTRY(svm_launch) movq %rdi, SCTX_RDI(%rax) movq %rsi, SCTX_RSI(%rax) + /* + * To prevent malicious branch target predictions from + * affecting the host, overwrite all entries in the RSB upon + * exiting a guest. + */ + mov $16, %ecx /* 16 iterations, two calls per loop */ + mov %rsp, %rax +0: call 2f /* create an RSB entry. */ +1: pause + call 1b /* capture rogue speculation. */ +2: call 2f /* create an RSB entry. */ +1: pause + call 1b /* capture rogue speculation. */ +2: sub $1, %ecx + jnz 0b + mov %rax, %rsp + /* Restore host state */ pop %r15 pop %r14 Modified: user/jeff/numa/sys/amd64/vmm/intel/vmcs.c ============================================================================== --- user/jeff/numa/sys/amd64/vmm/intel/vmcs.c Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/vmm/intel/vmcs.c Mon Feb 19 22:19:44 2018 (r329607) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -52,6 +53,12 @@ __FBSDID("$FreeBSD$"); #include #endif +SYSCTL_DECL(_hw_vmm_vmx); + +static int no_flush_rsb; +SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, no_flush_rsb, CTLFLAG_RW, + &no_flush_rsb, 0, "Do not flush RSB upon vmexit"); + static uint64_t vmcs_fix_regval(uint32_t encoding, uint64_t val) { @@ -403,8 +410,15 @@ vmcs_init(struct vmcs *vmcs) goto done; /* instruction pointer */ - if ((error = vmwrite(VMCS_HOST_RIP, (u_long)vmx_exit_guest)) != 0) - goto done; + if (no_flush_rsb) { + if ((error = vmwrite(VMCS_HOST_RIP, + (u_long)vmx_exit_guest)) != 0) + goto done; + } else { + if ((error = vmwrite(VMCS_HOST_RIP, + (u_long)vmx_exit_guest_flush_rsb)) != 0) + goto done; + } /* link pointer */ if ((error = vmwrite(VMCS_LINK_POINTER, ~0)) != 0) Modified: user/jeff/numa/sys/amd64/vmm/intel/vmx.h ============================================================================== --- user/jeff/numa/sys/amd64/vmm/intel/vmx.h Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/vmm/intel/vmx.h Mon Feb 19 22:19:44 2018 (r329607) @@ -150,5 +150,6 @@ u_long vmx_fix_cr4(u_long cr4); int vmx_set_tsc_offset(struct vmx *vmx, int vcpu, uint64_t offset); extern char vmx_exit_guest[]; +extern char vmx_exit_guest_flush_rsb[]; #endif Modified: user/jeff/numa/sys/amd64/vmm/intel/vmx_support.S ============================================================================== --- user/jeff/numa/sys/amd64/vmm/intel/vmx_support.S Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/amd64/vmm/intel/vmx_support.S Mon Feb 19 22:19:44 2018 (r329607) @@ -42,6 +42,29 @@ #define VLEAVE pop %rbp /* + * Save the guest context. + */ +#define VMX_GUEST_SAVE \ + movq %rdi,VMXCTX_GUEST_RDI(%rsp); \ + movq %rsi,VMXCTX_GUEST_RSI(%rsp); \ + movq %rdx,VMXCTX_GUEST_RDX(%rsp); \ + movq %rcx,VMXCTX_GUEST_RCX(%rsp); \ + movq %r8,VMXCTX_GUEST_R8(%rsp); \ + movq %r9,VMXCTX_GUEST_R9(%rsp); \ + movq %rax,VMXCTX_GUEST_RAX(%rsp); \ + movq %rbx,VMXCTX_GUEST_RBX(%rsp); \ + movq %rbp,VMXCTX_GUEST_RBP(%rsp); \ + movq %r10,VMXCTX_GUEST_R10(%rsp); \ + movq %r11,VMXCTX_GUEST_R11(%rsp); \ + movq %r12,VMXCTX_GUEST_R12(%rsp); \ + movq %r13,VMXCTX_GUEST_R13(%rsp); \ + movq %r14,VMXCTX_GUEST_R14(%rsp); \ + movq %r15,VMXCTX_GUEST_R15(%rsp); \ + movq %cr2,%rdi; \ + movq %rdi,VMXCTX_GUEST_CR2(%rsp); \ + movq %rsp,%rdi; + +/* * Assumes that %rdi holds a pointer to the 'vmxctx'. * * On "return" all registers are updated to reflect guest state. The two @@ -211,31 +234,55 @@ inst_error: * The VMCS-restored %rsp points to the struct vmxctx */ ALIGN_TEXT - .globl vmx_exit_guest -vmx_exit_guest: + .globl vmx_exit_guest_flush_rsb +vmx_exit_guest_flush_rsb: /* * Save guest state that is not automatically saved in the vmcs. */ - movq %rdi,VMXCTX_GUEST_RDI(%rsp) - movq %rsi,VMXCTX_GUEST_RSI(%rsp) - movq %rdx,VMXCTX_GUEST_RDX(%rsp) - movq %rcx,VMXCTX_GUEST_RCX(%rsp) - movq %r8,VMXCTX_GUEST_R8(%rsp) - movq %r9,VMXCTX_GUEST_R9(%rsp) - movq %rax,VMXCTX_GUEST_RAX(%rsp) - movq %rbx,VMXCTX_GUEST_RBX(%rsp) - movq %rbp,VMXCTX_GUEST_RBP(%rsp) - movq %r10,VMXCTX_GUEST_R10(%rsp) - movq %r11,VMXCTX_GUEST_R11(%rsp) - movq %r12,VMXCTX_GUEST_R12(%rsp) - movq %r13,VMXCTX_GUEST_R13(%rsp) - movq %r14,VMXCTX_GUEST_R14(%rsp) - movq %r15,VMXCTX_GUEST_R15(%rsp) + VMX_GUEST_SAVE - movq %cr2,%rdi - movq %rdi,VMXCTX_GUEST_CR2(%rsp) + /* + * Deactivate guest pmap from this cpu. + */ + movq VMXCTX_PMAP(%rdi), %r11 + movl PCPU(CPUID), %r10d + LK btrl %r10d, PM_ACTIVE(%r11) - movq %rsp,%rdi + VMX_HOST_RESTORE + + VMX_GUEST_CLOBBER + + /* + * To prevent malicious branch target predictions from + * affecting the host, overwrite all entries in the RSB upon + * exiting a guest. + */ + mov $16, %ecx /* 16 iterations, two calls per loop */ + mov %rsp, %rax +0: call 2f /* create an RSB entry. */ +1: pause + call 1b /* capture rogue speculation. */ +2: call 2f /* create an RSB entry. */ +1: pause + call 1b /* capture rogue speculation. */ +2: sub $1, %ecx + jnz 0b + mov %rax, %rsp + + /* + * This will return to the caller of 'vmx_enter_guest()' with a return + * value of VMX_GUEST_VMEXIT. + */ + movl $VMX_GUEST_VMEXIT, %eax + VLEAVE + ret + + .globl vmx_exit_guest +vmx_exit_guest: + /* + * Save guest state that is not automatically saved in the vmcs. + */ + VMX_GUEST_SAVE /* * Deactivate guest pmap from this cpu. Modified: user/jeff/numa/sys/arm/allwinner/aw_mmc.c ============================================================================== --- user/jeff/numa/sys/arm/allwinner/aw_mmc.c Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/arm/allwinner/aw_mmc.c Mon Feb 19 22:19:44 2018 (r329607) @@ -117,6 +117,7 @@ struct aw_mmc_softc { int32_t aw_vdd; regulator_t aw_reg_vmmc; regulator_t aw_reg_vqmmc; + unsigned int aw_clock; /* Fields required for DMA access. */ bus_addr_t aw_dma_desc_phys; @@ -939,8 +940,8 @@ aw_mmc_update_ios(device_t bus, device_t child) reg &= ~AW_MMC_CTRL_DDR_MOD_SEL; AW_MMC_WRITE_4(sc, AW_MMC_GCTL, reg); - if (ios->clock) { - clock = ios->clock; + if (ios->clock && ios->clock != sc->aw_clock) { + sc->aw_clock = clock = ios->clock; /* Disable clock */ error = aw_mmc_update_clock(sc, 0); Modified: user/jeff/numa/sys/arm/arm/gic_acpi.c ============================================================================== --- user/jeff/numa/sys/arm/arm/gic_acpi.c Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/arm/arm/gic_acpi.c Mon Feb 19 22:19:44 2018 (r329607) @@ -342,5 +342,5 @@ DEFINE_CLASS_1(gicv2m, arm_gicv2m_acpi_driver, arm_gic static devclass_t arm_gicv2m_acpi_devclass; -EARLY_DRIVER_MODULE(gicv2m, gic, arm_gicv2m_acpi_driver, +EARLY_DRIVER_MODULE(gicv2m_acpi, gic, arm_gicv2m_acpi_driver, arm_gicv2m_acpi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: user/jeff/numa/sys/arm/arm/pmap-v6.c ============================================================================== --- user/jeff/numa/sys/arm/arm/pmap-v6.c Mon Feb 19 22:09:49 2018 (r329606) +++ user/jeff/numa/sys/arm/arm/pmap-v6.c Mon Feb 19 22:19:44 2018 (r329607) @@ -2639,7 +2639,7 @@ pmap_unwire_pt2pg(pmap_t pmap, vm_offset_t va, vm_page * down is begun. */ wmb(); - VM_CNT_ADD(v_wire_count, -1); + vm_wire_sub(1); } /* @@ -2946,7 +2946,7 @@ out: SLIST_REMOVE_HEAD(&free, plinks.s.ss); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@freebsd.org Mon Feb 19 22:22:37 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A8EDF042CC for ; Mon, 19 Feb 2018 22:22:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DFD376F5FE; Mon, 19 Feb 2018 22:22:36 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA62420898; Mon, 19 Feb 2018 22:22:36 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JMMav1082244; Mon, 19 Feb 2018 22:22:36 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JMMZpv082232; Mon, 19 Feb 2018 22:22:35 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802192222.w1JMMZpv082232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 19 Feb 2018 22:22:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329608 - in user/jeff/numa: . bin/sh bin/uuidgen cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris... X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in user/jeff/numa: . bin/sh bin/uuidgen cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzpool/common/sys ... X-SVN-Commit-Revision: 329608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:22:37 -0000 Author: jeff Date: Mon Feb 19 22:22:35 2018 New Revision: 329608 URL: https://svnweb.freebsd.org/changeset/base/329608 Log: Merge from head > Description of fields to fill in above: 76 columns --| > PR: If and which Problem Report is related. > Submitted by: If someone else sent in the change. > Reported by: If someone else reported the issue. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > MFH: Ports tree branch name. Request approval for merge. > Relnotes: Set to 'yes' for mention in release notes. > Security: Vulnerability reference (one per line) or description. > Sponsored by: If the change was sponsored by an organization. > Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed). > Empty fields above will be automatically removed. _M . MM MAINTAINERS M ObsoleteFiles.inc M UPDATING M bin/sh/var.c M bin/uuidgen/uuidgen.c _M cddl _M cddl/contrib/opensolaris _M cddl/contrib/opensolaris/cmd/zdb M cddl/contrib/opensolaris/cmd/zdb/zdb.c A + cddl/contrib/opensolaris/cmd/zdb/zdb.h M cddl/contrib/opensolaris/cmd/zdb/zdb_il.c M cddl/contrib/opensolaris/cmd/ztest/ztest.c _M cddl/contrib/opensolaris/lib/libzfs M cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c M cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h M cddl/lib/libdtrace/errno.d M cddl/lib/libdtrace/io.d M cddl/lib/libdtrace/ip.d M cddl/lib/libdtrace/libproc_compat.h M cddl/lib/libdtrace/psinfo.d M cddl/lib/libdtrace/regs_x86.d M cddl/lib/libdtrace/sched.d M cddl/lib/libdtrace/tcp.d M cddl/lib/libdtrace/udp.d M cddl/usr.sbin/zfsd/case_file.cc M cddl/usr.sbin/zfsd/case_file.h M cddl/usr.sbin/zfsd/zfsd.cc M cddl/usr.sbin/zfsd/zfsd_event.cc M cddl/usr.sbin/zfsd/zfsd_event.h _M contrib/compiler-rt M contrib/compiler-rt/lib/asan/asan_linux.cc _M contrib/less M contrib/less/NEWS M contrib/less/README M contrib/less/command.c M contrib/less/help.c M contrib/less/less.nro M contrib/less/lessecho.nro M contrib/less/lesskey.nro M contrib/less/version.c _M contrib/libc++ _M contrib/llvm M contrib/llvm/include/llvm/IR/IntrinsicsAMDGPU.td M contrib/llvm/include/llvm/IR/IntrinsicsX86.td A + contrib/llvm/include/llvm/MC/MCAsmMacro.h M contrib/llvm/include/llvm/MC/MCContext.h M contrib/llvm/include/llvm/Support/GenericDomTreeConstruction.h M contrib/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp M contrib/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp M contrib/llvm/lib/CodeGen/LivePhysRegs.cpp M contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp M contrib/llvm/lib/CodeGen/SplitKit.cpp M contrib/llvm/lib/CodeGen/SplitKit.h M contrib/llvm/lib/IR/AutoUpgrade.cpp M contrib/llvm/lib/MC/MCParser/AsmParser.cpp M contrib/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp M contrib/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h M contrib/llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.cpp M contrib/llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.h M contrib/llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.td M contrib/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp M contrib/llvm/lib/Target/AMDGPU/SIISelLowering.cpp M contrib/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp M contrib/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h M contrib/llvm/lib/Target/AMDGPU/VOP2Instructions.td M contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp M contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp M contrib/llvm/lib/Target/X86/X86DomainReassignment.cpp M contrib/llvm/lib/Target/X86/X86ISelLowering.cpp M contrib/llvm/lib/Target/X86/X86IntrinsicsInfo.h M contrib/llvm/lib/Target/X86/X86RetpolineThunks.cpp M contrib/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp _M contrib/llvm/tools/clang M contrib/llvm/tools/clang/include/clang/AST/DeclBase.h M contrib/llvm/tools/clang/lib/AST/ASTContext.cpp M contrib/llvm/tools/clang/lib/AST/DeclBase.cpp M contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp M contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp M contrib/llvm/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp M contrib/llvm/tools/clang/lib/Format/TokenAnnotator.cpp M contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.cpp M contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.h M contrib/llvm/tools/clang/lib/Headers/avx512bwintrin.h M contrib/llvm/tools/clang/lib/Headers/avx512fintrin.h M contrib/llvm/tools/clang/lib/Lex/LiteralSupport.cpp M contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp M contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp M contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp _M contrib/llvm/tools/lld M contrib/llvm/tools/lld/COFF/PDB.cpp M contrib/llvm/tools/lld/ELF/Driver.cpp M contrib/llvm/tools/lld/ELF/InputFiles.cpp M contrib/llvm/tools/lld/ELF/Options.td _M contrib/llvm/tools/lldb M contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp M contrib/llvm/tools/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp _M contrib/netbsd-tests M contrib/netbsd-tests/kernel/t_sysv.c M contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c M etc/autofs/special_media M etc/defaults/rc.conf M etc/devd/Makefile A + etc/devd/devmatch.conf D etc/devd/usb.conf M etc/mtree/BSD.root.dist M etc/mtree/BSD.tests.dist M etc/rc.d/Makefile A + etc/rc.d/devmatch M etc/rc.d/resolv M include/varargs.h M lib/clang/include/clang/Basic/Version.inc M lib/clang/include/lld/Common/Version.inc M lib/clang/include/llvm/Support/VCSRevision.h M lib/libc/string/Makefile.inc M lib/libc/string/memset.3 M lib/libcasper/libcasper/Makefile M lib/libcasper/libcasper/libcasper.3 M lib/libcasper/libcasper/libcasper.c M lib/libcasper/libcasper/libcasper.h M lib/libcasper/libcasper/libcasper_impl.h M lib/libcasper/libcasper/libcasper_service.c M lib/libcasper/libcasper/libcasper_service.h M lib/libcasper/libcasper/service.c M lib/libcasper/services/cap_dns/Makefile M lib/libcasper/services/cap_dns/cap_dns.c M lib/libcasper/services/cap_grp/Makefile M lib/libcasper/services/cap_grp/cap_grp.c M lib/libcasper/services/cap_pwd/Makefile M lib/libcasper/services/cap_pwd/cap_pwd.c M lib/libcasper/services/cap_random/Makefile M lib/libcasper/services/cap_random/cap_random.c M lib/libcasper/services/cap_sysctl/Makefile M lib/libcasper/services/cap_sysctl/cap_sysctl.c M lib/libcasper/services/cap_syslog/Makefile M lib/libcasper/services/cap_syslog/cap_syslog.c M lib/libdevdctl/event.cc M lib/libufs/sblock.c M lib/msun/src/e_atan2.c M release/arm64/PINE64.conf M sbin/Makefile M sbin/devd/devd.cc A + sbin/devmatch M sbin/dumpon/dumpon.8 M sbin/dumpon/dumpon.c M sbin/ipfw/ipfw.8 M sbin/savecore/savecore.c M share/man/man4/bnxt.4 M share/man/man4/ng_pppoe.4 M share/man/man5/core.5 M share/man/man5/rc.conf.5 M share/man/man9/DECLARE_MODULE.9 M share/man/man9/DRIVER_MODULE.9 A + share/man/man9/MODULE_PNP_INFO.9 M share/man/man9/Makefile M share/man/man9/device_add_child.9 M share/man/man9/module.9 M share/man/man9/pci.9 M share/man/man9/pmap_enter.9 M share/man/man9/pmap_qenter.9 A + share/man/man9/style.lua.9 M share/misc/organization.dot M share/misc/pci_vendors D share/mk/bsd.stand.mk M share/mk/src.opts.mk M stand/Makefile M stand/Makefile.amd64 A + stand/common/interp_lua.c A + stand/common/metadata.c M stand/defs.mk M stand/efi/include/efidevp.h M stand/efi/include/efilib.h M stand/efi/libefi/efipart.c M stand/efi/loader/main.c M stand/fdt/Makefile M stand/ficl/Makefile M stand/geli/Makefile A + stand/liblua A + stand/liblua32 M stand/libsa/Makefile M stand/libsa/arp.c M stand/libsa/bootp.c M stand/libsa/ip.c M stand/libsa/net.c M stand/libsa/net.h M stand/libsa/rarp.c M stand/libsa/rpc.c M stand/libsa/tftp.c M stand/libsa/ufs.c M stand/loader.mk A + stand/lua A + stand/lua.mk M stand/mips/beri/loader/Makefile M stand/mips/beri/loader/exec.c M stand/mips/beri/loader/loader.h D stand/mips/beri/loader/metadata.c M stand/mips/uboot/Makefile M stand/powerpc/kboot/Makefile M stand/powerpc/kboot/main.c D stand/powerpc/kboot/metadata.c M stand/powerpc/ofw/Makefile D stand/powerpc/ofw/metadata.c M stand/sparc64/loader/Makefile D stand/sparc64/loader/metadata.c D stand/uboot/common/metadata.c M stand/uboot/fdt/Makefile M stand/uboot/lib/Makefile M stand/uboot/lib/elf_freebsd.c M stand/uboot.mk M stand/zfs/Makefile M tests/sys/geom/class/Makefile M tests/sys/geom/class/eli/Makefile A + tests/sys/geom/class/eli/misc_test.sh A + tests/sys/geom/class/part A + tools/boot/lua-img.sh A + tools/boot/lua-test.sh M tools/boot/universe.sh A + tools/build/options/WITH_LOADER_LUA D tools/tools/bus_autoconf M tools/tools/net80211/w00t/ap/ap.c M usr.bin/ipcrm/ipcrm.c M usr.bin/ipcs/ipc.c M usr.bin/ipcs/ipc.h M usr.bin/ipcs/ipcs.c M usr.sbin/Makefile D usr.sbin/devmatch M usr.sbin/kldxref/kldxref.c M usr.sbin/trpt/Makefile M usr.sbin/trpt/trpt.8 M usr.sbin/trpt/trpt.c Added: user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.h - copied unchanged from r329605, head/cddl/contrib/opensolaris/cmd/zdb/zdb.h user/jeff/numa/contrib/llvm/include/llvm/MC/MCAsmMacro.h - copied unchanged from r329605, head/contrib/llvm/include/llvm/MC/MCAsmMacro.h user/jeff/numa/etc/devd/devmatch.conf - copied unchanged from r329605, head/etc/devd/devmatch.conf user/jeff/numa/etc/rc.d/devmatch - copied unchanged from r329605, head/etc/rc.d/devmatch user/jeff/numa/sbin/devmatch/ - copied from r329605, head/sbin/devmatch/ user/jeff/numa/share/man/man9/MODULE_PNP_INFO.9 - copied unchanged from r329605, head/share/man/man9/MODULE_PNP_INFO.9 user/jeff/numa/share/man/man9/style.lua.9 - copied unchanged from r329605, head/share/man/man9/style.lua.9 user/jeff/numa/stand/common/interp_lua.c - copied unchanged from r329605, head/stand/common/interp_lua.c user/jeff/numa/stand/common/metadata.c - copied unchanged from r329605, head/stand/common/metadata.c user/jeff/numa/stand/liblua/ - copied from r329605, head/stand/liblua/ user/jeff/numa/stand/liblua32/ - copied from r329605, head/stand/liblua32/ user/jeff/numa/stand/lua/ - copied from r329605, head/stand/lua/ user/jeff/numa/stand/lua.mk - copied unchanged from r329605, head/stand/lua.mk user/jeff/numa/tests/sys/geom/class/eli/misc_test.sh - copied unchanged from r329605, head/tests/sys/geom/class/eli/misc_test.sh user/jeff/numa/tests/sys/geom/class/part/ - copied from r329605, head/tests/sys/geom/class/part/ user/jeff/numa/tools/boot/lua-img.sh - copied unchanged from r329605, head/tools/boot/lua-img.sh user/jeff/numa/tools/boot/lua-test.sh - copied unchanged from r329605, head/tools/boot/lua-test.sh user/jeff/numa/tools/build/options/WITH_LOADER_LUA - copied unchanged from r329605, head/tools/build/options/WITH_LOADER_LUA Deleted: user/jeff/numa/etc/devd/usb.conf user/jeff/numa/share/mk/bsd.stand.mk user/jeff/numa/stand/mips/beri/loader/metadata.c user/jeff/numa/stand/powerpc/kboot/metadata.c user/jeff/numa/stand/powerpc/ofw/metadata.c user/jeff/numa/stand/sparc64/loader/metadata.c user/jeff/numa/stand/uboot/common/metadata.c user/jeff/numa/tools/tools/bus_autoconf/ user/jeff/numa/usr.sbin/devmatch/ Modified: user/jeff/numa/MAINTAINERS (contents, props changed) user/jeff/numa/ObsoleteFiles.inc user/jeff/numa/UPDATING user/jeff/numa/bin/sh/var.c user/jeff/numa/bin/uuidgen/uuidgen.c user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.c user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c user/jeff/numa/cddl/contrib/opensolaris/cmd/ztest/ztest.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h user/jeff/numa/cddl/lib/libdtrace/errno.d user/jeff/numa/cddl/lib/libdtrace/io.d user/jeff/numa/cddl/lib/libdtrace/ip.d user/jeff/numa/cddl/lib/libdtrace/libproc_compat.h user/jeff/numa/cddl/lib/libdtrace/psinfo.d user/jeff/numa/cddl/lib/libdtrace/regs_x86.d user/jeff/numa/cddl/lib/libdtrace/sched.d user/jeff/numa/cddl/lib/libdtrace/tcp.d user/jeff/numa/cddl/lib/libdtrace/udp.d user/jeff/numa/cddl/usr.sbin/zfsd/case_file.cc user/jeff/numa/cddl/usr.sbin/zfsd/case_file.h user/jeff/numa/cddl/usr.sbin/zfsd/zfsd.cc user/jeff/numa/cddl/usr.sbin/zfsd/zfsd_event.cc user/jeff/numa/cddl/usr.sbin/zfsd/zfsd_event.h user/jeff/numa/contrib/compiler-rt/lib/asan/asan_linux.cc user/jeff/numa/contrib/less/NEWS user/jeff/numa/contrib/less/README user/jeff/numa/contrib/less/command.c user/jeff/numa/contrib/less/help.c user/jeff/numa/contrib/less/less.nro user/jeff/numa/contrib/less/lessecho.nro user/jeff/numa/contrib/less/lesskey.nro user/jeff/numa/contrib/less/version.c user/jeff/numa/contrib/llvm/include/llvm/IR/IntrinsicsAMDGPU.td user/jeff/numa/contrib/llvm/include/llvm/IR/IntrinsicsX86.td user/jeff/numa/contrib/llvm/include/llvm/MC/MCContext.h user/jeff/numa/contrib/llvm/include/llvm/Support/GenericDomTreeConstruction.h user/jeff/numa/contrib/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp user/jeff/numa/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp user/jeff/numa/contrib/llvm/lib/CodeGen/LivePhysRegs.cpp user/jeff/numa/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp user/jeff/numa/contrib/llvm/lib/CodeGen/SplitKit.cpp user/jeff/numa/contrib/llvm/lib/CodeGen/SplitKit.h user/jeff/numa/contrib/llvm/lib/IR/AutoUpgrade.cpp user/jeff/numa/contrib/llvm/lib/MC/MCParser/AsmParser.cpp user/jeff/numa/contrib/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp user/jeff/numa/contrib/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h user/jeff/numa/contrib/llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.cpp user/jeff/numa/contrib/llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.h user/jeff/numa/contrib/llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.td user/jeff/numa/contrib/llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp user/jeff/numa/contrib/llvm/lib/Target/AMDGPU/SIISelLowering.cpp user/jeff/numa/contrib/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp user/jeff/numa/contrib/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h user/jeff/numa/contrib/llvm/lib/Target/AMDGPU/VOP2Instructions.td user/jeff/numa/contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp user/jeff/numa/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp user/jeff/numa/contrib/llvm/lib/Target/X86/X86DomainReassignment.cpp user/jeff/numa/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp user/jeff/numa/contrib/llvm/lib/Target/X86/X86IntrinsicsInfo.h user/jeff/numa/contrib/llvm/lib/Target/X86/X86RetpolineThunks.cpp user/jeff/numa/contrib/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp user/jeff/numa/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h user/jeff/numa/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp user/jeff/numa/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp user/jeff/numa/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp user/jeff/numa/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp user/jeff/numa/contrib/llvm/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp user/jeff/numa/contrib/llvm/tools/clang/lib/Format/TokenAnnotator.cpp user/jeff/numa/contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.cpp user/jeff/numa/contrib/llvm/tools/clang/lib/Format/UnwrappedLineParser.h user/jeff/numa/contrib/llvm/tools/clang/lib/Headers/avx512bwintrin.h user/jeff/numa/contrib/llvm/tools/clang/lib/Headers/avx512fintrin.h user/jeff/numa/contrib/llvm/tools/clang/lib/Lex/LiteralSupport.cpp user/jeff/numa/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp user/jeff/numa/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp user/jeff/numa/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp user/jeff/numa/contrib/llvm/tools/lld/COFF/PDB.cpp user/jeff/numa/contrib/llvm/tools/lld/ELF/Driver.cpp user/jeff/numa/contrib/llvm/tools/lld/ELF/InputFiles.cpp user/jeff/numa/contrib/llvm/tools/lld/ELF/Options.td user/jeff/numa/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp user/jeff/numa/contrib/llvm/tools/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp user/jeff/numa/contrib/netbsd-tests/kernel/t_sysv.c user/jeff/numa/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c user/jeff/numa/etc/autofs/special_media user/jeff/numa/etc/defaults/rc.conf user/jeff/numa/etc/devd/Makefile user/jeff/numa/etc/mtree/BSD.root.dist user/jeff/numa/etc/mtree/BSD.tests.dist user/jeff/numa/etc/rc.d/Makefile user/jeff/numa/etc/rc.d/resolv user/jeff/numa/include/varargs.h user/jeff/numa/lib/clang/include/clang/Basic/Version.inc user/jeff/numa/lib/clang/include/lld/Common/Version.inc user/jeff/numa/lib/clang/include/llvm/Support/VCSRevision.h user/jeff/numa/lib/libc/string/Makefile.inc user/jeff/numa/lib/libc/string/memset.3 user/jeff/numa/lib/libcasper/libcasper/Makefile user/jeff/numa/lib/libcasper/libcasper/libcasper.3 user/jeff/numa/lib/libcasper/libcasper/libcasper.c user/jeff/numa/lib/libcasper/libcasper/libcasper.h user/jeff/numa/lib/libcasper/libcasper/libcasper_impl.h user/jeff/numa/lib/libcasper/libcasper/libcasper_service.c user/jeff/numa/lib/libcasper/libcasper/libcasper_service.h user/jeff/numa/lib/libcasper/libcasper/service.c user/jeff/numa/lib/libcasper/services/cap_dns/Makefile user/jeff/numa/lib/libcasper/services/cap_dns/cap_dns.c user/jeff/numa/lib/libcasper/services/cap_grp/Makefile user/jeff/numa/lib/libcasper/services/cap_grp/cap_grp.c user/jeff/numa/lib/libcasper/services/cap_pwd/Makefile user/jeff/numa/lib/libcasper/services/cap_pwd/cap_pwd.c user/jeff/numa/lib/libcasper/services/cap_random/Makefile user/jeff/numa/lib/libcasper/services/cap_random/cap_random.c user/jeff/numa/lib/libcasper/services/cap_sysctl/Makefile user/jeff/numa/lib/libcasper/services/cap_sysctl/cap_sysctl.c user/jeff/numa/lib/libcasper/services/cap_syslog/Makefile user/jeff/numa/lib/libcasper/services/cap_syslog/cap_syslog.c user/jeff/numa/lib/libdevdctl/event.cc user/jeff/numa/lib/libufs/sblock.c user/jeff/numa/lib/msun/src/e_atan2.c user/jeff/numa/release/arm64/PINE64.conf user/jeff/numa/sbin/Makefile user/jeff/numa/sbin/devd/devd.cc user/jeff/numa/sbin/dumpon/dumpon.8 user/jeff/numa/sbin/dumpon/dumpon.c user/jeff/numa/sbin/ipfw/ipfw.8 user/jeff/numa/sbin/savecore/savecore.c user/jeff/numa/share/man/man4/bnxt.4 user/jeff/numa/share/man/man4/ng_pppoe.4 user/jeff/numa/share/man/man5/core.5 user/jeff/numa/share/man/man5/rc.conf.5 user/jeff/numa/share/man/man9/DECLARE_MODULE.9 user/jeff/numa/share/man/man9/DRIVER_MODULE.9 user/jeff/numa/share/man/man9/Makefile user/jeff/numa/share/man/man9/device_add_child.9 user/jeff/numa/share/man/man9/module.9 user/jeff/numa/share/man/man9/pci.9 user/jeff/numa/share/man/man9/pmap_enter.9 user/jeff/numa/share/man/man9/pmap_qenter.9 user/jeff/numa/share/misc/organization.dot user/jeff/numa/share/misc/pci_vendors user/jeff/numa/share/mk/src.opts.mk user/jeff/numa/stand/Makefile user/jeff/numa/stand/Makefile.amd64 user/jeff/numa/stand/defs.mk user/jeff/numa/stand/efi/include/efidevp.h user/jeff/numa/stand/efi/include/efilib.h user/jeff/numa/stand/efi/libefi/efipart.c user/jeff/numa/stand/efi/loader/main.c user/jeff/numa/stand/fdt/Makefile user/jeff/numa/stand/ficl/Makefile user/jeff/numa/stand/geli/Makefile user/jeff/numa/stand/libsa/Makefile user/jeff/numa/stand/libsa/arp.c user/jeff/numa/stand/libsa/bootp.c user/jeff/numa/stand/libsa/ip.c user/jeff/numa/stand/libsa/net.c user/jeff/numa/stand/libsa/net.h user/jeff/numa/stand/libsa/rarp.c user/jeff/numa/stand/libsa/rpc.c user/jeff/numa/stand/libsa/tftp.c user/jeff/numa/stand/libsa/ufs.c user/jeff/numa/stand/loader.mk user/jeff/numa/stand/mips/beri/loader/Makefile user/jeff/numa/stand/mips/beri/loader/exec.c user/jeff/numa/stand/mips/beri/loader/loader.h user/jeff/numa/stand/mips/uboot/Makefile user/jeff/numa/stand/powerpc/kboot/Makefile user/jeff/numa/stand/powerpc/kboot/main.c user/jeff/numa/stand/powerpc/ofw/Makefile user/jeff/numa/stand/sparc64/loader/Makefile user/jeff/numa/stand/uboot.mk user/jeff/numa/stand/uboot/fdt/Makefile user/jeff/numa/stand/uboot/lib/Makefile user/jeff/numa/stand/uboot/lib/elf_freebsd.c user/jeff/numa/stand/zfs/Makefile user/jeff/numa/tests/sys/geom/class/Makefile user/jeff/numa/tests/sys/geom/class/eli/Makefile user/jeff/numa/tools/boot/universe.sh user/jeff/numa/tools/tools/net80211/w00t/ap/ap.c user/jeff/numa/usr.bin/ipcrm/ipcrm.c user/jeff/numa/usr.bin/ipcs/ipc.c user/jeff/numa/usr.bin/ipcs/ipc.h user/jeff/numa/usr.bin/ipcs/ipcs.c user/jeff/numa/usr.sbin/Makefile user/jeff/numa/usr.sbin/kldxref/kldxref.c user/jeff/numa/usr.sbin/trpt/Makefile user/jeff/numa/usr.sbin/trpt/trpt.8 user/jeff/numa/usr.sbin/trpt/trpt.c Directory Properties: user/jeff/numa/ (props changed) user/jeff/numa/cddl/ (props changed) user/jeff/numa/cddl/contrib/opensolaris/ (props changed) user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/ (props changed) user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/ (props changed) user/jeff/numa/contrib/compiler-rt/ (props changed) user/jeff/numa/contrib/less/ (props changed) user/jeff/numa/contrib/libc++/ (props changed) user/jeff/numa/contrib/llvm/ (props changed) user/jeff/numa/contrib/llvm/tools/clang/ (props changed) user/jeff/numa/contrib/llvm/tools/lld/ (props changed) user/jeff/numa/contrib/llvm/tools/lldb/ (props changed) user/jeff/numa/contrib/netbsd-tests/ (props changed) Modified: user/jeff/numa/MAINTAINERS ============================================================================== --- user/jeff/numa/MAINTAINERS Mon Feb 19 22:19:44 2018 (r329607) +++ user/jeff/numa/MAINTAINERS Mon Feb 19 22:22:35 2018 (r329608) @@ -65,7 +65,6 @@ lpr gad Pre-commit review requested, particularly for nanobsd imp Pre-commit phabricator review requested. net80211 adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org nfs freebsd-fs@FreeBSD.org, rmacklem is best for reviews. -nis(8), yp(8) araujo Pre-commit review requested. nvd(4) jimharris Pre-commit review requested. nvme(4) jimharris Pre-commit review requested. nvmecontrol(8) jimharris Pre-commit review requested. @@ -93,8 +92,11 @@ sys/dev/ixgbe erj Pre-commit phabricator review reques sys/dev/ixl erj Pre-commit phabricator review requested. sys/dev/sound/usb hselasky If in doubt, ask. sys/dev/usb hselasky If in doubt, ask. +sys/dev/xen royger Pre-commit review recommended. sys/netinet/ip_carp.c glebius Pre-commit review recommended. sys/netpfil/pf kp,glebius Pre-commit review recommended. +sys/x86/xen royger Pre-commit review recommended. +sys/xen royger Pre-commit review recommended. tests freebsd-testing,ngie Pre-commit review requested. usr.sbin/bsdconfig dteske Pre-commit phabricator review requested. usr.sbin/dpv dteske Pre-commit review requested. Keep in sync with libdpv. Modified: user/jeff/numa/ObsoleteFiles.inc ============================================================================== --- user/jeff/numa/ObsoleteFiles.inc Mon Feb 19 22:19:44 2018 (r329607) +++ user/jeff/numa/ObsoleteFiles.inc Mon Feb 19 22:22:35 2018 (r329608) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20180212: move devmatch +OLD_FILES+=usr/sbin/devmatch +# 20180211: remove usb.conf +OLD_FILES+=etc/devd/usb.conf # 20180208: remove c_rehash(1) OLD_FILES+=usr/share/openssl/man/man1/c_rehash.1.gz # 20180206: remove gdbtui Modified: user/jeff/numa/UPDATING ============================================================================== --- user/jeff/numa/UPDATING Mon Feb 19 22:19:44 2018 (r329607) +++ user/jeff/numa/UPDATING Mon Feb 19 22:22:35 2018 (r329608) @@ -51,6 +51,19 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20180212: + FreeBSD boot loader enhanced with Lua scripting. It's purely opt-in for + now by building WITH_LOADER_LUA and WITHOUT_FORTH in /etc/src.conf. + Co-existance for the transition period will come shortly. Booting is a + complex environment and test coverage for Lua-enabled loaders has been + thin, so it would be prudent to assume it might not work and make + provisions for backup boot methods. + +20180211: + devmatch functionality has been turned on in devd. It will automatically + load drivers for unattached devices. This may cause unexpected drivers to + be loaded. Please report any problems to current@ and imp@freebsd.org. + 20180114: Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to 6.0.0. Please see the 20141231 entry below for information about Modified: user/jeff/numa/bin/sh/var.c ============================================================================== --- user/jeff/numa/bin/sh/var.c Mon Feb 19 22:19:44 2018 (r329607) +++ user/jeff/numa/bin/sh/var.c Mon Feb 19 22:22:35 2018 (r329608) @@ -71,7 +71,9 @@ __FBSDID("$FreeBSD$"); #endif +#ifndef VTABSIZE #define VTABSIZE 39 +#endif struct varinit { Modified: user/jeff/numa/bin/uuidgen/uuidgen.c ============================================================================== --- user/jeff/numa/bin/uuidgen/uuidgen.c Mon Feb 19 22:19:44 2018 (r329607) +++ user/jeff/numa/bin/uuidgen/uuidgen.c Mon Feb 19 22:22:35 2018 (r329608) @@ -28,6 +28,9 @@ #include __FBSDID("$FreeBSD$"); +#include + +#include #include #include #include @@ -79,6 +82,12 @@ main(int argc, char *argv[]) if (argc) usage(); + + caph_cache_catpages(); + if (caph_limit_stdio() < 0) + err(1, "Unable to limit stdio"); + if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); if (count == -1) count = 1; Modified: user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Feb 19 22:19:44 2018 (r329607) +++ user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Feb 19 22:22:35 2018 (r329608) @@ -67,6 +67,8 @@ #undef verify #include +#include "zdb.h" + #define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \ zio_compress_table[(idx)].ci_name : "UNKNOWN") #define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \ @@ -90,14 +92,13 @@ uint64_t zfs_arc_max, zfs_arc_meta_limit; int zfs_vdev_async_read_max_active; #endif -const char cmdname[] = "zdb"; +static const char cmdname[] = "zdb"; uint8_t dump_opt[256]; typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size); -extern void dump_intent_log(zilog_t *); static uint64_t *zopt_object = NULL; -static int zopt_objects = 0; +static unsigned zopt_objects = 0; static libzfs_handle_t *g_zfs; static uint64_t max_inflight = 1000; @@ -285,8 +286,8 @@ zdb_nicenum(uint64_t num, char *buf, size_t buflen) nicenum(num, buf, sizeof (buf)); } -const char histo_stars[] = "****************************************"; -const int histo_width = sizeof (histo_stars) - 1; +static const char histo_stars[] = "****************************************"; +static const uint64_t histo_width = sizeof (histo_stars) - 1; static void dump_histogram(const uint64_t *histo, int size, int offset) @@ -392,7 +393,7 @@ dump_unknown(objset_t *os, uint64_t object, void *data } /*ARGSUSED*/ -void +static void dump_uint8(objset_t *os, uint64_t object, void *data, size_t size) { } @@ -410,7 +411,7 @@ dump_zap(objset_t *os, uint64_t object, void *data, si zap_cursor_t zc; zap_attribute_t attr; void *prop; - int i; + unsigned i; dump_zap_stats(os, object); (void) printf("\n"); @@ -573,7 +574,7 @@ dump_sa_layouts(objset_t *os, uint64_t object, void *d zap_cursor_t zc; zap_attribute_t attr; uint16_t *layout_attrs; - int i; + unsigned i; dump_zap_stats(os, object); (void) printf("\n"); @@ -642,7 +643,7 @@ dump_zpldir(objset_t *os, uint64_t object, void *data, zap_cursor_fini(&zc); } -int +static int get_dtl_refcount(vdev_t *vd) { int refcount = 0; @@ -656,18 +657,18 @@ get_dtl_refcount(vdev_t *vd) return (0); } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) refcount += get_dtl_refcount(vd->vdev_child[c]); return (refcount); } -int +static int get_metaslab_refcount(vdev_t *vd) { int refcount = 0; if (vd->vdev_top == vd && !vd->vdev_removing) { - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (unsigned m = 0; m < vd->vdev_ms_count; m++) { space_map_t *sm = vd->vdev_ms[m]->ms_sm; if (sm != NULL && @@ -675,7 +676,7 @@ get_metaslab_refcount(vdev_t *vd) refcount++; } } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) refcount += get_metaslab_refcount(vd->vdev_child[c]); return (refcount); @@ -707,7 +708,7 @@ static void dump_spacemap(objset_t *os, space_map_t *sm) { uint64_t alloc, offset, entry; - char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", + const char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" }; if (sm == NULL) @@ -844,7 +845,7 @@ dump_metaslab_groups(spa_t *spa) metaslab_class_histogram_verify(mc); - for (int c = 0; c < rvd->vdev_children; c++) { + for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; metaslab_group_t *mg = tvd->vdev_mg; @@ -923,7 +924,7 @@ dump_dde(const ddt_t *ddt, const ddt_entry_t *dde, uin { const ddt_phys_t *ddp = dde->dde_phys; const ddt_key_t *ddk = &dde->dde_key; - char *types[4] = { "ditto", "single", "double", "triple" }; + const char *types[4] = { "ditto", "single", "double", "triple" }; char blkbuf[BP_SPRINTF_LEN]; blkptr_t blk; @@ -1016,9 +1017,12 @@ dump_ddt(ddt_t *ddt, enum ddt_type type, enum ddt_clas static void dump_all_ddts(spa_t *spa) { - ddt_histogram_t ddh_total = { 0 }; - ddt_stat_t dds_total = { 0 }; + ddt_histogram_t ddh_total; + ddt_stat_t dds_total; + bzero(&ddh_total, sizeof (ddh_total)); + bzero(&dds_total, sizeof (dds_total)); + for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { ddt_t *ddt = spa->spa_ddt[c]; for (enum ddt_type type = 0; type < DDT_TYPES; type++) { @@ -1064,7 +1068,8 @@ dump_dtl(vdev_t *vd, int indent) { spa_t *spa = vd->vdev_spa; boolean_t required; - char *name[DTL_TYPES] = { "missing", "partial", "scrub", "outage" }; + const char *name[DTL_TYPES] = { "missing", "partial", "scrub", + "outage" }; char prefix[256]; spa_vdev_state_enter(spa, SCL_NONE); @@ -1092,7 +1097,7 @@ dump_dtl(vdev_t *vd, int indent) dump_spacemap(spa->spa_meta_objset, vd->vdev_dtl_sm); } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) dump_dtl(vd->vdev_child[c], indent + 4); } @@ -1150,7 +1155,7 @@ dump_history(spa_t *spa) free(buf); (void) printf("\nHistory:\n"); - for (int i = 0; i < num; i++) { + for (unsigned i = 0; i < num; i++) { uint64_t time, txg, ievent; char *cmd, *intstr; boolean_t printed = B_FALSE; @@ -1172,8 +1177,8 @@ dump_history(spa_t *spa) (void) snprintf(internalstr, sizeof (internalstr), - "[internal %s txg:%lld] %s", - zfs_history_event_names[ievent], txg, + "[internal %s txg:%ju] %s", + zfs_history_event_names[ievent], (uintmax_t)txg, intstr); cmd = internalstr; } @@ -1490,7 +1495,7 @@ dump_bptree_cb(void *arg, const blkptr_t *bp, dmu_tx_t } static void -dump_bptree(objset_t *os, uint64_t obj, char *name) +dump_bptree(objset_t *os, uint64_t obj, const char *name) { char bytes[32]; bptree_phys_t *bt; @@ -1530,7 +1535,7 @@ dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t } static void -dump_full_bpobj(bpobj_t *bpo, char *name, int indent) +dump_full_bpobj(bpobj_t *bpo, const char *name, int indent) { char bytes[32]; char comp[32]; @@ -2034,7 +2039,7 @@ dump_object(objset_t *os, uint64_t object, int verbosi dmu_buf_rele(db, FTAG); } -static char *objset_types[DMU_OST_NUMTYPES] = { +static const char *objset_types[DMU_OST_NUMTYPES] = { "NONE", "META", "ZPL", "ZVOL", "OTHER", "ANY" }; static void @@ -2046,10 +2051,11 @@ dump_dir(objset_t *os) char numbuf[32]; char blkbuf[BP_SPRINTF_LEN + 20]; char osname[ZFS_MAX_DATASET_NAME_LEN]; - char *type = "UNKNOWN"; + const char *type = "UNKNOWN"; int verbosity = dump_opt['d']; int print_header = 1; - int i, error; + unsigned i; + int error; /* make sure nicenum has enough space */ CTASSERT(sizeof (numbuf) >= NN_NUMBUF_SZ); @@ -2139,7 +2145,7 @@ dump_uberblock(uberblock_t *ub, const char *header, co { time_t timestamp = ub->ub_timestamp; - (void) printf(header ? header : ""); + (void) printf("%s", header ? header : ""); (void) printf("\tmagic = %016llx\n", (u_longlong_t)ub->ub_magic); (void) printf("\tversion = %llu\n", (u_longlong_t)ub->ub_version); (void) printf("\ttxg = %llu\n", (u_longlong_t)ub->ub_txg); @@ -2151,7 +2157,7 @@ dump_uberblock(uberblock_t *ub, const char *header, co snprintf_blkptr(blkbuf, sizeof (blkbuf), &ub->ub_rootbp); (void) printf("\trootbp = %s\n", blkbuf); } - (void) printf(footer ? footer : ""); + (void) printf("%s", footer ? footer : ""); } static void @@ -2494,7 +2500,7 @@ typedef struct zdb_blkstats { #define ZDB_OT_OTHER (DMU_OT_NUMTYPES + 2) #define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 3) -static char *zdb_ot_extname[] = { +static const char *zdb_ot_extname[] = { "deferred free", "dedup ditto", "other", @@ -2511,7 +2517,7 @@ typedef struct zdb_cb { uint64_t zcb_embedded_histogram[NUM_BP_EMBEDDED_TYPES] [BPE_PAYLOAD_SIZE]; uint64_t zcb_start; - uint64_t zcb_lastprint; + hrtime_t zcb_lastprint; uint64_t zcb_totalasize; uint64_t zcb_errors[256]; int zcb_readfails; @@ -2546,7 +2552,7 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const b * SPA_OLD_MAXBLOCKSIZE; larger blocks go into the last, * "other", bucket. */ - int idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT; + unsigned idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT; idx = MIN(idx, SPA_OLD_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1); zb->zb_psize_histogram[idx]++; @@ -2753,10 +2759,11 @@ static metaslab_ops_t zdb_metaslab_ops = { static void zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) { - ddt_bookmark_t ddb = { 0 }; + ddt_bookmark_t ddb; ddt_entry_t dde; int error; + bzero(&ddb, sizeof (ddb)); while ((error = ddt_walk(spa, &ddb, &dde)) == 0) { blkptr_t blk; ddt_phys_t *ddp = dde.dde_phys; @@ -2864,10 +2871,10 @@ zdb_leak_fini(spa_t *spa) { if (!dump_opt['L']) { vdev_t *rvd = spa->spa_root_vdev; - for (int c = 0; c < rvd->vdev_children; c++) { + for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; metaslab_group_t *mg = vd->vdev_mg; - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (unsigned m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; ASSERT3P(mg, ==, msp->ms_group); mutex_enter(&msp->ms_lock); @@ -2913,12 +2920,13 @@ count_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t static int dump_block_stats(spa_t *spa) { - zdb_cb_t zcb = { 0 }; + zdb_cb_t zcb; zdb_blkstats_t *zb, *tzb; uint64_t norm_alloc, norm_space, total_alloc, total_found; int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; boolean_t leaks = B_FALSE; + bzero(&zcb, sizeof (zcb)); (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n", (dump_opt['c'] || !dump_opt['L']) ? "to verify " : "", (dump_opt['c'] == 1) ? "metadata " : "", @@ -3069,7 +3077,7 @@ dump_block_stats(spa_t *spa) for (t = 0; t <= ZDB_OT_TOTAL; t++) { char csize[32], lsize[32], psize[32], asize[32]; char avg[32], gang[32]; - char *typename; + const char *typename; /* make sure nicenum has enough space */ CTASSERT(sizeof (csize) >= NN_NUMBUF_SZ); @@ -3220,9 +3228,11 @@ dump_simulated_ddt(spa_t *spa) avl_tree_t t; void *cookie = NULL; zdb_ddt_entry_t *zdde; - ddt_histogram_t ddh_total = { 0 }; - ddt_stat_t dds_total = { 0 }; + ddt_histogram_t ddh_total; + ddt_stat_t dds_total; + bzero(&ddh_total, sizeof (ddh_total)); + bzero(&dds_total, sizeof (dds_total)); avl_create(&t, ddt_entry_compare, sizeof (zdb_ddt_entry_t), offsetof(zdb_ddt_entry_t, zdde_node)); @@ -3369,7 +3379,7 @@ dump_zpool(spa_t *spa) #define ZDB_FLAG_RAW 0x0040 #define ZDB_FLAG_PRINT_BLKPTR 0x0080 -int flagbits[256]; +static int flagbits[256]; static void zdb_print_blkptr(blkptr_t *bp, int flags) @@ -3410,10 +3420,11 @@ static void zdb_dump_block(char *label, void *buf, uint64_t size, int flags) { uint64_t *d = (uint64_t *)buf; - int nwords = size / sizeof (uint64_t); + unsigned nwords = size / sizeof (uint64_t); int do_bswap = !!(flags & ZDB_FLAG_BSWAP); - int i, j; - char *hdr, *c; + unsigned i, j; + const char *hdr; + char *c; if (do_bswap) @@ -3446,19 +3457,19 @@ zdb_dump_block(char *label, void *buf, uint64_t size, * RAID-Zs, you can specify either RAID-Z vdev with 0.0 or 0.1 . */ static vdev_t * -zdb_vdev_lookup(vdev_t *vdev, char *path) +zdb_vdev_lookup(vdev_t *vdev, const char *path) { char *s, *p, *q; - int i; + unsigned i; if (vdev == NULL) return (NULL); /* First, assume the x.x.x.x format */ - i = (int)strtoul(path, &s, 10); + i = strtoul(path, &s, 10); if (s == path || (s && *s != '.' && *s != '\0')) goto name; - if (i < 0 || i >= vdev->vdev_children) + if (i >= vdev->vdev_children) return (NULL); vdev = vdev->vdev_child[i]; @@ -3533,7 +3544,8 @@ zdb_read_block(char *thing, spa_t *spa) vdev_t *vd; abd_t *pabd; void *lbuf, *buf; - char *s, *p, *dup, *vdev, *flagstr; + const char *s, *vdev; + char *p, *dup, *flagstr; int i, error; dup = strdup(thing); @@ -3544,7 +3556,10 @@ zdb_read_block(char *thing, spa_t *spa) s = strtok(NULL, ":"); size = strtoull(s ? s : "", NULL, 16); s = strtok(NULL, ":"); - flagstr = s ? s : ""; + if (s) + flagstr = strdup(s); + else + flagstr = strdup(""); s = NULL; if (size == 0) @@ -3586,6 +3601,7 @@ zdb_read_block(char *thing, spa_t *spa) i += p - &flagstr[i + 1]; /* skip over the number */ } } + free(flagstr); vd = zdb_vdev_lookup(spa->spa_root_vdev, vdev); if (vd == NULL) { @@ -3722,11 +3738,12 @@ out: static void zdb_embedded_block(char *thing) { - blkptr_t bp = { 0 }; + blkptr_t bp; unsigned long long *words = (void *)&bp; char *buf; int err; + bzero(&bp, sizeof (bp)); err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:" "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx", words + 0, words + 1, words + 2, words + 3, @@ -3779,8 +3796,9 @@ find_zpool(char **target, nvlist_t **configp, int dirc char *sepp = NULL; char sep = '\0'; int count = 0; - importargs_t args = { 0 }; + importargs_t args; + bzero(&args, sizeof (args)); args.paths = dirc; args.path = dirv; args.can_be_active = B_TRUE; @@ -3840,7 +3858,7 @@ find_zpool(char **target, nvlist_t **configp, int dirc int main(int argc, char **argv) { - int i, c; + int c; struct rlimit rl = { 1024, 1024 }; spa_t *spa = NULL; objset_t *os = NULL; @@ -4121,7 +4139,7 @@ main(int argc, char **argv) if (argc > 0) { zopt_objects = argc; zopt_object = calloc(zopt_objects, sizeof (uint64_t)); - for (i = 0; i < zopt_objects; i++) { + for (unsigned i = 0; i < zopt_objects; i++) { errno = 0; zopt_object[i] = strtoull(argv[i], NULL, 0); if (zopt_object[i] == 0 && errno != 0) @@ -4146,7 +4164,7 @@ main(int argc, char **argv) flagbits['p'] = ZDB_FLAG_PHYS; flagbits['r'] = ZDB_FLAG_RAW; - for (i = 0; i < argc; i++) + for (int i = 0; i < argc; i++) zdb_read_block(argv[i], spa); } Copied: user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.h (from r329605, head/cddl/contrib/opensolaris/cmd/zdb/zdb.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.h Mon Feb 19 22:22:35 2018 (r329608, copy of r329605, head/cddl/contrib/opensolaris/cmd/zdb/zdb.h) @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2017 Spectra Logic Corp Inc. All rights reserved. + * Use is subject to license terms. + */ + + +#ifndef _ZDB_H +#define _ZDB_H + +void dump_intent_log(zilog_t *); +extern uint8_t dump_opt[256]; + +#endif /* _ZDB_H */ Modified: user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c ============================================================================== --- user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Mon Feb 19 22:19:44 2018 (r329607) +++ user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Mon Feb 19 22:22:35 2018 (r329608) @@ -43,9 +43,11 @@ #include #include +#include "zdb.h" + extern uint8_t dump_opt[256]; -static char prefix[4] = "\t\t\t"; +static char tab_prefix[4] = "\t\t\t"; static void print_log_bp(const blkptr_t *bp, const char *prefix) @@ -58,8 +60,9 @@ print_log_bp(const blkptr_t *bp, const char *prefix) /* ARGSUSED */ static void -zil_prt_rec_create(zilog_t *zilog, int txtype, lr_create_t *lr) +zil_prt_rec_create(zilog_t *zilog, int txtype, void *arg) { + lr_create_t *lr = arg; time_t crtime = lr->lr_crtime[0]; char *name, *link; lr_attr_t *lrattr; @@ -74,47 +77,53 @@ zil_prt_rec_create(zilog_t *zilog, int txtype, lr_crea if (txtype == TX_SYMLINK) { link = name + strlen(name) + 1; - (void) printf("%s%s -> %s\n", prefix, name, link); + (void) printf("%s%s -> %s\n", tab_prefix, name, link); } else if (txtype != TX_MKXATTR) { - (void) printf("%s%s\n", prefix, name); + (void) printf("%s%s\n", tab_prefix, name); } - (void) printf("%s%s", prefix, ctime(&crtime)); - (void) printf("%sdoid %llu, foid %llu, mode %llo\n", prefix, + (void) printf("%s%s", tab_prefix, ctime(&crtime)); + (void) printf("%sdoid %llu, foid %llu, mode %llo\n", tab_prefix, (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_foid, (longlong_t)lr->lr_mode); - (void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n", prefix, + (void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n", + tab_prefix, (u_longlong_t)lr->lr_uid, (u_longlong_t)lr->lr_gid, (u_longlong_t)lr->lr_gen, (u_longlong_t)lr->lr_rdev); } /* ARGSUSED */ static void -zil_prt_rec_remove(zilog_t *zilog, int txtype, lr_remove_t *lr) +zil_prt_rec_remove(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sdoid %llu, name %s\n", prefix, + lr_remove_t *lr = arg; + + (void) printf("%sdoid %llu, name %s\n", tab_prefix, (u_longlong_t)lr->lr_doid, (char *)(lr + 1)); } /* ARGSUSED */ static void -zil_prt_rec_link(zilog_t *zilog, int txtype, lr_link_t *lr) +zil_prt_rec_link(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sdoid %llu, link_obj %llu, name %s\n", prefix, + lr_link_t *lr = arg; + + (void) printf("%sdoid %llu, link_obj %llu, name %s\n", tab_prefix, (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_link_obj, (char *)(lr + 1)); } /* ARGSUSED */ static void -zil_prt_rec_rename(zilog_t *zilog, int txtype, lr_rename_t *lr) +zil_prt_rec_rename(zilog_t *zilog, int txtype, void *arg) { + lr_rename_t *lr = arg; char *snm = (char *)(lr + 1); char *tnm = snm + strlen(snm) + 1; - (void) printf("%ssdoid %llu, tdoid %llu\n", prefix, + (void) printf("%ssdoid %llu, tdoid %llu\n", tab_prefix, (u_longlong_t)lr->lr_sdoid, (u_longlong_t)lr->lr_tdoid); - (void) printf("%ssrc %s tgt %s\n", prefix, snm, tnm); + (void) printf("%ssrc %s tgt %s\n", tab_prefix, snm, tnm); } /* ARGSUSED */ @@ -122,7 +131,7 @@ static int zil_prt_rec_write_cb(void *data, size_t len, void *unused) { char *cdata = data; - for (int i = 0; i < len; i++) { + for (size_t i = 0; i < len; i++) { if (isprint(*cdata)) (void) printf("%c ", *cdata); else @@ -134,15 +143,16 @@ zil_prt_rec_write_cb(void *data, size_t len, void *unu /* ARGSUSED */ static void -zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr) +zil_prt_rec_write(zilog_t *zilog, int txtype, void *arg) { + lr_write_t *lr = arg; abd_t *data; blkptr_t *bp = &lr->lr_blkptr; zbookmark_phys_t zb; int verbose = MAX(dump_opt['d'], dump_opt['i']); int error; - (void) printf("%sfoid %llu, offset %llx, length %llx\n", prefix, + (void) printf("%sfoid %llu, offset %llx, length %llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_offset, (u_longlong_t)lr->lr_length); @@ -150,20 +160,21 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write return; if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) { - (void) printf("%shas blkptr, %s\n", prefix, + (void) printf("%shas blkptr, %s\n", tab_prefix, !BP_IS_HOLE(bp) && bp->blk_birth >= spa_first_txg(zilog->zl_spa) ? "will claim" : "won't claim"); - print_log_bp(bp, prefix); + print_log_bp(bp, tab_prefix); if (BP_IS_HOLE(bp)) { (void) printf("\t\t\tLSIZE 0x%llx\n", (u_longlong_t)BP_GET_LSIZE(bp)); - (void) printf("%s\n", prefix); + (void) printf("%s\n", tab_prefix); return; } if (bp->blk_birth < zilog->zl_header->zh_claim_txg) { - (void) printf("%s\n", prefix); + (void) printf("%s\n", + tab_prefix); return; } @@ -183,7 +194,7 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write abd_copy_from_buf(data, lr + 1, lr->lr_length); } - (void) printf("%s", prefix); + (void) printf("%s", tab_prefix); (void) abd_iterate_func(data, 0, MIN(lr->lr_length, (verbose < 6 ? 20 : SPA_MAXBLOCKSIZE)), zil_prt_rec_write_cb, NULL); @@ -195,52 +206,55 @@ out: /* ARGSUSED */ static void -zil_prt_rec_truncate(zilog_t *zilog, int txtype, lr_truncate_t *lr) +zil_prt_rec_truncate(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sfoid %llu, offset 0x%llx, length 0x%llx\n", prefix, + lr_truncate_t *lr = arg; + + (void) printf("%sfoid %llu, offset 0x%llx, length 0x%llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (longlong_t)lr->lr_offset, (u_longlong_t)lr->lr_length); } /* ARGSUSED */ static void -zil_prt_rec_setattr(zilog_t *zilog, int txtype, lr_setattr_t *lr) +zil_prt_rec_setattr(zilog_t *zilog, int txtype, void *arg) { + lr_setattr_t *lr = arg; time_t atime = (time_t)lr->lr_atime[0]; time_t mtime = (time_t)lr->lr_mtime[0]; - (void) printf("%sfoid %llu, mask 0x%llx\n", prefix, + (void) printf("%sfoid %llu, mask 0x%llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_mask); if (lr->lr_mask & AT_MODE) { - (void) printf("%sAT_MODE %llo\n", prefix, + (void) printf("%sAT_MODE %llo\n", tab_prefix, (longlong_t)lr->lr_mode); } if (lr->lr_mask & AT_UID) { - (void) printf("%sAT_UID %llu\n", prefix, + (void) printf("%sAT_UID %llu\n", tab_prefix, (u_longlong_t)lr->lr_uid); } if (lr->lr_mask & AT_GID) { - (void) printf("%sAT_GID %llu\n", prefix, + (void) printf("%sAT_GID %llu\n", tab_prefix, (u_longlong_t)lr->lr_gid); } if (lr->lr_mask & AT_SIZE) { - (void) printf("%sAT_SIZE %llu\n", prefix, + (void) printf("%sAT_SIZE %llu\n", tab_prefix, (u_longlong_t)lr->lr_size); } if (lr->lr_mask & AT_ATIME) { - (void) printf("%sAT_ATIME %llu.%09llu %s", prefix, + (void) printf("%sAT_ATIME %llu.%09llu %s", tab_prefix, (u_longlong_t)lr->lr_atime[0], (u_longlong_t)lr->lr_atime[1], ctime(&atime)); } if (lr->lr_mask & AT_MTIME) { - (void) printf("%sAT_MTIME %llu.%09llu %s", prefix, + (void) printf("%sAT_MTIME %llu.%09llu %s", tab_prefix, (u_longlong_t)lr->lr_mtime[0], (u_longlong_t)lr->lr_mtime[1], ctime(&mtime)); @@ -249,41 +263,43 @@ zil_prt_rec_setattr(zilog_t *zilog, int txtype, lr_set /* ARGSUSED */ static void -zil_prt_rec_acl(zilog_t *zilog, int txtype, lr_acl_t *lr) +zil_prt_rec_acl(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sfoid %llu, aclcnt %llu\n", prefix, + lr_acl_t *lr = arg; + + (void) printf("%sfoid %llu, aclcnt %llu\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_aclcnt); } -typedef void (*zil_prt_rec_func_t)(); +typedef void (*zil_prt_rec_func_t)(zilog_t *, int, void *); typedef struct zil_rec_info { zil_prt_rec_func_t zri_print; - char *zri_name; + const char *zri_name; uint64_t zri_count; } zil_rec_info_t; static zil_rec_info_t zil_rec_info[TX_MAX_TYPE] = { - { NULL, "Total " }, - { zil_prt_rec_create, "TX_CREATE " }, - { zil_prt_rec_create, "TX_MKDIR " }, - { zil_prt_rec_create, "TX_MKXATTR " }, - { zil_prt_rec_create, "TX_SYMLINK " }, - { zil_prt_rec_remove, "TX_REMOVE " }, - { zil_prt_rec_remove, "TX_RMDIR " }, - { zil_prt_rec_link, "TX_LINK " }, - { zil_prt_rec_rename, "TX_RENAME " }, - { zil_prt_rec_write, "TX_WRITE " }, - { zil_prt_rec_truncate, "TX_TRUNCATE " }, - { zil_prt_rec_setattr, "TX_SETATTR " }, - { zil_prt_rec_acl, "TX_ACL_V0 " }, - { zil_prt_rec_acl, "TX_ACL_ACL " }, - { zil_prt_rec_create, "TX_CREATE_ACL " }, - { zil_prt_rec_create, "TX_CREATE_ATTR " }, - { zil_prt_rec_create, "TX_CREATE_ACL_ATTR " }, - { zil_prt_rec_create, "TX_MKDIR_ACL " }, - { zil_prt_rec_create, "TX_MKDIR_ATTR " }, - { zil_prt_rec_create, "TX_MKDIR_ACL_ATTR " }, - { zil_prt_rec_write, "TX_WRITE2 " }, + {.zri_print = NULL, .zri_name = "Total "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKXATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_SYMLINK "}, + {.zri_print = zil_prt_rec_remove, .zri_name = "TX_REMOVE "}, + {.zri_print = zil_prt_rec_remove, .zri_name = "TX_RMDIR "}, + {.zri_print = zil_prt_rec_link, .zri_name = "TX_LINK "}, + {.zri_print = zil_prt_rec_rename, .zri_name = "TX_RENAME "}, + {.zri_print = zil_prt_rec_write, .zri_name = "TX_WRITE "}, + {.zri_print = zil_prt_rec_truncate, .zri_name = "TX_TRUNCATE "}, + {.zri_print = zil_prt_rec_setattr, .zri_name = "TX_SETATTR "}, + {.zri_print = zil_prt_rec_acl, .zri_name = "TX_ACL_V0 "}, + {.zri_print = zil_prt_rec_acl, .zri_name = "TX_ACL_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ACL_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ACL_ATTR "}, + {.zri_print = zil_prt_rec_write, .zri_name = "TX_WRITE2 "}, }; /* ARGSUSED */ @@ -321,7 +337,7 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *ar { char blkbuf[BP_SPRINTF_LEN + 10]; int verbose = MAX(dump_opt['d'], dump_opt['i']); - char *claim; + const char *claim; if (verbose <= 3) return (0); @@ -350,7 +366,7 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *ar static void print_log_stats(int verbose) { - int i, w, p10; + unsigned i, w, p10; if (verbose > 3) (void) printf("\n"); Modified: user/jeff/numa/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- user/jeff/numa/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Feb 19 22:19:44 2018 (r329607) +++ user/jeff/numa/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Feb 19 22:22:35 2018 (r329608) @@ -1425,8 +1425,10 @@ ztest_log_setattr(ztest_ds_t *zd, dmu_tx_t *tx, lr_set * ZIL replay ops */ static int -ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, boolean_t byteswap) +ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_create_t *lr = arg2; char *name = (void *)(lr + 1); /* name follows lr */ objset_t *os = zd->zd_os; ztest_block_tag_t *bbt; @@ -1509,8 +1511,10 @@ ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, b } static int -ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, boolean_t byteswap) +ztest_replay_remove(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_remove_t *lr = arg2; char *name = (void *)(lr + 1); /* name follows lr */ objset_t *os = zd->zd_os; dmu_object_info_t doi; @@ -1560,8 +1564,10 @@ ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, b } static int -ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boolean_t byteswap) +ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_write_t *lr = arg2; objset_t *os = zd->zd_os; void *data = lr + 1; /* data follows lr */ uint64_t offset, length; @@ -1685,8 +1691,10 @@ ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boo } static int -ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *lr, boolean_t byteswap) +ztest_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_truncate_t *lr = arg2; objset_t *os = zd->zd_os; dmu_tx_t *tx; uint64_t txg; @@ -1724,8 +1732,10 @@ ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *l } static int -ztest_replay_setattr(ztest_ds_t *zd, lr_setattr_t *lr, boolean_t byteswap) +ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_setattr_t *lr = arg2; objset_t *os = zd->zd_os; dmu_tx_t *tx; dmu_buf_t *db; Modified: user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Feb 19 22:19:44 2018 (r329607) +++ user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Feb 19 22:22:35 2018 (r329608) @@ -24,6 +24,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 + * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. */ @@ -610,8 +611,14 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int servic int ret = SA_OK; #ifdef illumos + /* + * libshare is either not installed or we're in a branded zone. The + * rest of the wrapper functions around the libshare calls already + * handle NULL function pointers, but we don't want the callers of + * zfs_init_libshare() to fail prematurely if libshare is not available. + */ if (_sa_init == NULL) - ret = SA_CONFIG_ERR; + return (SA_OK); if (ret == SA_OK && zhandle->libzfs_shareflags & ZFSSHARE_MISS) { /* Modified: user/jeff/numa/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- user/jeff/numa/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Mon Feb 19 22:19:44 2018 (r329607) +++ user/jeff/numa/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Mon Feb 19 22:22:35 2018 (r329608) @@ -237,7 +237,7 @@ extern struct proc p0; #define PS_NONE -1 -extern kthread_t *zk_thread_create(void (*func)(), void *arg); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@freebsd.org Tue Feb 20 02:30:52 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E5D5F1AD19 for ; Tue, 20 Feb 2018 02:30:52 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0465D7AB6D; Tue, 20 Feb 2018 02:30:52 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F366223210; Tue, 20 Feb 2018 02:30:51 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K2UpmP003023; Tue, 20 Feb 2018 02:30:51 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K2Up5F003016; Tue, 20 Feb 2018 02:30:51 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802200230.w1K2Up5F003016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 20 Feb 2018 02:30:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329616 - in user/jeff/numa/sys: kern sys vm X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in user/jeff/numa/sys: kern sys vm X-SVN-Commit-Revision: 329616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 02:30:52 -0000 Author: jeff Date: Tue Feb 20 02:30:51 2018 New Revision: 329616 URL: https://svnweb.freebsd.org/changeset/base/329616 Log: PID Controlled page daemon Differential Revision: https://reviews.freebsd.org/D14402 Added: user/jeff/numa/sys/kern/subr_pidctrl.c (contents, props changed) user/jeff/numa/sys/sys/pidctrl.h (contents, props changed) Modified: user/jeff/numa/sys/vm/vm_meter.c user/jeff/numa/sys/vm/vm_page.c user/jeff/numa/sys/vm/vm_pageout.c user/jeff/numa/sys/vm/vm_pagequeue.h Added: user/jeff/numa/sys/kern/subr_pidctrl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jeff/numa/sys/kern/subr_pidctrl.c Tue Feb 20 02:30:51 2018 (r329616) @@ -0,0 +1,157 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017, Jeffrey Roberson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +void +pidctrl_init(struct pidctrl *pc, int interval, int setpoint, int bound, + int Kpd, int Kid, int Kdd) +{ + + bzero(pc, sizeof(*pc)); + pc->pc_setpoint = setpoint; + pc->pc_interval = interval; + pc->pc_bound = bound * setpoint * Kid; + pc->pc_Kpd = Kpd; + pc->pc_Kid = Kid; + pc->pc_Kdd = Kdd; +} + +void +pidctrl_init_sysctl(struct pidctrl *pc, struct sysctl_oid_list *parent) +{ + + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "error", CTLFLAG_RD, + &pc->pc_error, 0, "Current difference from setpoint value (P)"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "olderror", CTLFLAG_RD, + &pc->pc_olderror, 0, "Error value from last interval"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "integral", CTLFLAG_RD, + &pc->pc_integral, 0, "Accumulated error integral (I)"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "derivative", + CTLFLAG_RD, &pc->pc_derivative, 0, "Error derivative (I)"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "input", CTLFLAG_RD, + &pc->pc_input, 0, "Last controller process variable input"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "output", CTLFLAG_RD, + &pc->pc_output, 0, "Last controller output"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "ticks", CTLFLAG_RD, + &pc->pc_ticks, 0, "Last controler runtime"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "setpoint", CTLFLAG_RW, + &pc->pc_setpoint, 0, "Desired level for process variable"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "interval", CTLFLAG_RD, + &pc->pc_interval, 0, "Interval between calculations (ticks)"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "bound", CTLFLAG_RW, + &pc->pc_bound, 0, "Integral wind-up limit"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "kpd", CTLFLAG_RW, + &pc->pc_Kpd, 0, "Inverse of proportional gain"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "kid", CTLFLAG_RW, + &pc->pc_Kid, 0, "Inverse of integral gain"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "kdd", CTLFLAG_RW, + &pc->pc_Kdd, 0, "Inverse of derivative gain"); +} + +int +pidctrl_classic(struct pidctrl *pc, int input) +{ + int output, error; + int Kpd, Kid, Kdd; + + error = pc->pc_setpoint - input; + pc->pc_ticks = ticks; + pc->pc_olderror = pc->pc_error; + + /* Fetch gains and prevent divide by zero. */ + Kpd = MAX(pc->pc_Kpd, 1); + Kid = MAX(pc->pc_Kid, 1); + Kdd = MAX(pc->pc_Kdd, 1); + + /* Compute P (proportional error), I (integral), D (derivative) */ + pc->pc_error = error; + pc->pc_integral = + MAX(MIN(pc->pc_integral + error, pc->pc_bound), -pc->pc_bound); + pc->pc_derivative = error - pc->pc_olderror; + + /* Divide by inverse gain values to produce output. */ + output = ((pc->pc_error / pc->pc_Kpd) + + (pc->pc_integral / pc->pc_Kid)) + + (pc->pc_derivative / pc->pc_Kdd); + /* Save for sysctl. */ + pc->pc_output = output; + pc->pc_input = input; + + return output; +} + +int +pidctrl_daemon(struct pidctrl *pc, int input) +{ + int output, error; + int Kpd, Kid, Kdd; + + error = pc->pc_setpoint - input; + /* + * When ticks expired we reset our variables and start a new + * interval. If we're called multiple times during one interval + * we attempt to report a target as if the entire error came at + * the interval boundary. + */ + if ((u_int)(ticks - pc->pc_ticks) >= pc->pc_interval) { + pc->pc_ticks = ticks; + pc->pc_olderror = pc->pc_error; + pc->pc_output = pc->pc_error = 0; + } else { + error = MAX(error + pc->pc_error, 0); + } + + /* Fetch gains and prevent divide by zero. */ + Kpd = MAX(pc->pc_Kpd, 1); + Kid = MAX(pc->pc_Kid, 1); + Kdd = MAX(pc->pc_Kdd, 1); + + /* Compute P (proportional error), I (integral), D (derivative) */ + pc->pc_error = error; + pc->pc_integral = + MAX(MIN(pc->pc_integral + error, pc->pc_bound), 0); + pc->pc_derivative = error - pc->pc_olderror; + + /* Divide by inverse gain values to produce output. */ + output = ((error / pc->pc_Kpd) + + (pc->pc_integral / pc->pc_Kid)) + + (pc->pc_derivative / pc->pc_Kdd); + output = MAX(output - pc->pc_output, 0); + pc->pc_output += output; + pc->pc_input = input; + + return output; +} Added: user/jeff/numa/sys/sys/pidctrl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/jeff/numa/sys/sys/pidctrl.h Tue Feb 20 02:30:51 2018 (r329616) @@ -0,0 +1,123 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017, Jeffrey Roberson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_PIDCTRL_H_ +#define _SYS_PIDCTRL_H_ + +/* + * Proportional Integral Derivative controller. + * + * This controller is intended to replace a multitude of threshold based + * daemon regulation systems. These systems produce sharp sawtooths of + * activity which can cause latency spikes and other undesireable bursty + * behavior. The PID controller adapts to changing load conditions and + * adjusts the work done by the daemon to keep a smoother output. + * + * The setpoint can be thought of as a single watermark that the controller + * is always trying to reach. Compared to a high water/low water type + * algorithm the pid controller is dynamically deciding the low water and + * regulating to the high water. The setpoint should be high enough that + * the controller and daemon have time to observe the rise in value and + * respond to it, else the resource may be exhausted. More frequent wakeups + * permit higher setpoints and less underutilized resources. + * + * The controller has been optimised for simplicity of math making it quite + * inexpensive to execute. There is no floating point and so the gains must + * be the inverse of whole integers. + * + * Failing to measure and tune the gain parameters can result in wild + * oscillations in output. It is strongly encouraged that controllers are + * tested and tuned under a wide variety of workloads before gain values are + * picked. Some reasonable defaults are provided below. + */ + +struct pidctrl { + /* Saved control variables. */ + int pc_error; /* Current error. */ + int pc_olderror; /* Saved error for derivative. */ + int pc_integral; /* Integral accumulator. */ + int pc_derivative; /* Change from last error. */ + int pc_input; /* Last input. */ + int pc_output; /* Last output. */ + int pc_ticks; /* Last sampling time. */ + /* configuration options, runtime tunable via sysctl */ + int pc_setpoint; /* Desired level */ + int pc_interval; /* Update interval in ticks. */ + int pc_bound; /* Integral wind-up limit. */ + int pc_Kpd; /* Proportional gain divisor. */ + int pc_Kid; /* Integral gain divisor. */ + int pc_Kdd; /* Derivative gain divisor. */ +}; + +/* + * Reasonable default divisors. + * + * Actual gains are 1/divisor. Gains interact in complex ways with the + * setpoint and interval. Measurement under multiple loads should be + * taken to ensure adequate stability and rise time. + */ +#define PIDCTRL_KPD 3 /* Default proportional divisor. */ +#define PIDCTRL_KID 4 /* Default integral divisor. */ +#define PIDCTRL_KDD 8 /* Default derivative divisor. */ +#define PIDCTRL_BOUND 4 /* Bound factor, setpoint multiple. */ + +struct sysctl_oid_list; + +void pidctrl_init(struct pidctrl *pc, int interval, int setpoint, + int bound, int Kpd, int Kid, int Kdd); +void pidctrl_init_sysctl(struct pidctrl *pc, struct sysctl_oid_list *parent); + +/* + * This is the classic PID controller where the interval is clamped to + * [-bound, bound] and the output may be negative. This should be used + * in continuous control loops that can adjust a process variable in + * either direction. This is a descrete time controller and should + * only be called once per-interval or the derivative term will be + * inaccurate. + */ +int pidctrl_classic(struct pidctrl *pc, int input); + +/* + * This controler is intended for consumer type daemons that can only + * regulate in a positive direction, that is to say, they can not exert + * positive pressure on the process variable or input. They can only + * reduce it by doing work. As such the integral is bound between [0, bound] + * and the output is similarly a positive value reflecting the units of + * work necessary to be completed in the current interval to eliminate error. + * + * It is a descrete time controller but can be invoked more than once in a + * given time interval for ease of client implementation. This should only + * be done in overload situations or the controller may not produce a stable + * output. Calling it less frequently when there is no work to be done will + * increase the rise time but should otherwise be harmless. + */ +int pidctrl_daemon(struct pidctrl *pc, int input); + +#endif /* !_SYS_PIDCTRL_H_ */ Modified: user/jeff/numa/sys/vm/vm_meter.c ============================================================================== --- user/jeff/numa/sys/vm/vm_meter.c Tue Feb 20 02:18:30 2018 (r329615) +++ user/jeff/numa/sys/vm/vm_meter.c Tue Feb 20 02:30:51 2018 (r329616) @@ -473,3 +473,58 @@ vm_laundry_count(void) return vm_pagequeue_count(PQ_LAUNDRY); } +static void +vm_domain_stats_init(struct vm_domain *vmd, struct sysctl_oid *parent) +{ + struct sysctl_oid *oid; + + vmd->vmd_oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(parent), OID_AUTO, + vmd->vmd_name, CTLFLAG_RD, NULL, ""); + oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(vmd->vmd_oid), OID_AUTO, + "stats", CTLFLAG_RD, NULL, ""); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_count", CTLFLAG_RD, &vmd->vmd_free_count, 0, + "Free pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "active", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_ACTIVE].pq_cnt, 0, + "Active pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "inactive", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_INACTIVE].pq_cnt, 0, + "Inactive pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "laundry", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt, 0, + "laundry pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "unswappable", + CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_UNSWAPPABLE].pq_cnt, 0, + "Unswappable pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "inactive_target", CTLFLAG_RD, &vmd->vmd_inactive_target, 0, + "Target inactive pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_target", CTLFLAG_RD, &vmd->vmd_free_target, 0, + "Target free pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_reserved", CTLFLAG_RD, &vmd->vmd_free_reserved, 0, + "Reserved free pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_min", CTLFLAG_RD, &vmd->vmd_free_min, 0, + "Minimum free pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_severe", CTLFLAG_RD, &vmd->vmd_free_severe, 0, + "Severe free pages"); + +} + +static void +vm_stats_init(void *arg __unused) +{ + struct sysctl_oid *oid; + int i; + + oid = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_vm), OID_AUTO, + "domain", CTLFLAG_RD, NULL, ""); + for (i = 0; i < vm_ndomains; i++) + vm_domain_stats_init(VM_DOMAIN(i), oid); +} + +SYSINIT(vmstats_init, SI_SUB_VM_CONF, SI_ORDER_FIRST, vm_stats_init, NULL); Modified: user/jeff/numa/sys/vm/vm_page.c ============================================================================== --- user/jeff/numa/sys/vm/vm_page.c Tue Feb 20 02:18:30 2018 (r329615) +++ user/jeff/numa/sys/vm/vm_page.c Tue Feb 20 02:30:51 2018 (r329616) @@ -476,6 +476,7 @@ vm_page_domain_init(int domain) } } mtx_init(&vmd->vmd_free_mtx, "vm page free queue", NULL, MTX_DEF); + snprintf(vmd->vmd_name, sizeof(vmd->vmd_name), "%d", domain); } /* @@ -2934,9 +2935,9 @@ vm_wait(void) * consume all freed pages while old allocators wait. */ mtx_lock(&vm_domainset_lock); - if (vm_page_count_min()) { + if (vm_page_count_severe()) { vm_min_waiters++; - msleep(&vm_min_domains, &vm_domainset_lock, PVM, + msleep(&vm_severe_domains, &vm_domainset_lock, PVM, "vmwait", 0); } mtx_unlock(&vm_domainset_lock); @@ -3204,7 +3205,7 @@ vm_domain_free_wakeup(struct vm_domain *vmd) * high water mark. And wakeup scheduler process if we have * lots of memory. this process will swapin processes. */ - if (vmd->vmd_pages_needed && !vm_paging_min(vmd)) { + if (vmd->vmd_pages_needed && !vm_paging_severe(vmd)) { vmd->vmd_pages_needed = false; wakeup(&vmd->vmd_free_count); } Modified: user/jeff/numa/sys/vm/vm_pageout.c ============================================================================== --- user/jeff/numa/sys/vm/vm_pageout.c Tue Feb 20 02:18:30 2018 (r329615) +++ user/jeff/numa/sys/vm/vm_pageout.c Tue Feb 20 02:30:51 2018 (r329616) @@ -124,7 +124,7 @@ static void vm_pageout(void); static void vm_pageout_init(void); static int vm_pageout_clean(vm_page_t m, int *numpagedout); static int vm_pageout_cluster(vm_page_t m); -static bool vm_pageout_scan(struct vm_domain *vmd, int pass); +static bool vm_pageout_scan(struct vm_domain *vmd, int pass, int shortage); static void vm_pageout_mightbe_oom(struct vm_domain *vmd, int page_shortage, int starting_page_shortage); @@ -146,7 +146,7 @@ SDT_PROBE_DEFINE(vm, , , vm__lowmem_scan); /* Pagedaemon activity rates, in subdivisions of one second. */ #define VM_LAUNDER_RATE 10 -#define VM_INACT_SCAN_RATE 2 +#define VM_INACT_SCAN_RATE 10 static int vm_pageout_oom_seq = 12; @@ -1206,7 +1206,7 @@ out: * queue scan to meet the target. */ static bool -vm_pageout_scan(struct vm_domain *vmd, int pass) +vm_pageout_scan(struct vm_domain *vmd, int pass, int shortage) { struct pgo_pglist pglist; vm_page_t m, next; @@ -1251,7 +1251,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass) */ if (pass > 0) { deficit = atomic_readandclear_int(&vmd->vmd_pageout_deficit); - page_shortage = vm_paging_target(vmd) + deficit; + page_shortage = shortage + deficit; } else page_shortage = deficit = 0; starting_page_shortage = page_shortage; @@ -1505,7 +1505,7 @@ lock_queue: */ inactq_shortage = vmd->vmd_inactive_target - (pq->pq_cnt + vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt / act_scan_laundry_weight) + - vm_paging_target(vmd) + deficit + addl_page_shortage; + shortage + deficit + addl_page_shortage; inactq_shortage *= act_scan_laundry_weight; pq = &vmd->vmd_pagequeues[PQ_ACTIVE]; @@ -1875,12 +1875,13 @@ static void vm_pageout_worker(void *arg) { struct vm_domain *vmd; - int domain, pass; + int domain, pass, shortage; bool target_met; domain = (uintptr_t)arg; vmd = VM_DOMAIN(domain); pass = 0; + shortage = 0; target_met = true; /* @@ -1918,54 +1919,40 @@ vm_pageout_worker(void *arg) vmd->vmd_pages_needed = false; wakeup(&vmd->vmd_free_count); } - /* - * Do not clear vmd_pageout_wanted until we reach our free page - * target. Otherwise, we may be awakened over and over again, - * wasting CPU time. + * Might the page daemon need to run again? */ - if (vmd->vmd_pageout_wanted && target_met) - vmd->vmd_pageout_wanted = false; - - /* - * Might the page daemon receive a wakeup call? - */ - if (vmd->vmd_pageout_wanted) { + if (vm_paging_needed(vmd, vmd->vmd_free_count)) { /* - * No. Either vmd_pageout_wanted was set by another - * thread during the previous scan, which must have - * been a level 0 scan, or vmd_pageout_wanted was - * already set and the scan failed to free enough - * pages. If we haven't yet performed a level >= 1 - * (page reclamation) scan, then increase the level - * and scan again now. Otherwise, sleep a bit and - * try again later. + * Yes, the scan failed to free enough pages. If + * we have performed a level >= 1 (page reclamation) + * scan, then sleep a bit and try again. */ vm_domain_free_unlock(vmd); - if (pass >= 1) + if (pass > 1) pause("pwait", hz / VM_INACT_SCAN_RATE); - pass++; } else { /* - * Yes. If threads are still sleeping in VM_WAIT - * then we immediately start a new scan. Otherwise, - * sleep until the next wakeup or until pages need to - * have their reference stats updated. + * No, sleep until the next wakeup or until pages + * need to have their reference stats updated. */ - if (vmd->vmd_pages_needed) { - vm_domain_free_unlock(vmd); - if (pass == 0) - pass++; - } else if (mtx_sleep(&vmd->vmd_pageout_wanted, + vmd->vmd_pageout_wanted = false; + if (mtx_sleep(&vmd->vmd_pageout_wanted, vm_domain_free_lockptr(vmd), PDROP | PVM, - "psleep", hz) == 0) { + "psleep", hz / VM_INACT_SCAN_RATE) == 0) VM_CNT_INC(v_pdwakeups); - pass = 1; - } else - pass = 0; } + shortage = pidctrl_daemon(&vmd->vmd_pid, vmd->vmd_free_count); + if (shortage && pass == 0) + pass = 1; - target_met = vm_pageout_scan(vmd, pass); + target_met = vm_pageout_scan(vmd, pass, shortage); + /* + * If the target was not met we must increase the pass to + * more aggressively reclaim. + */ + if (!target_met) + pass++; } } @@ -1976,6 +1963,7 @@ static void vm_pageout_init_domain(int domain) { struct vm_domain *vmd; + struct sysctl_oid *oid; int lim, i, j; vmd = VM_DOMAIN(domain); @@ -2003,10 +1991,10 @@ vm_pageout_init_domain(int domain) vmd->vmd_inactive_target = vmd->vmd_free_count / 3; /* - * Set the default wakeup threshold to be 10% above the minimum - * page limit. This keeps the steady state out of shortfall. + * Set the default wakeup threshold to be 10% below the paging + * target. This keeps the steady state out of shortfall. */ - vmd->vmd_pageout_wakeup_thresh = (vmd->vmd_free_min / 10) * 11; + vmd->vmd_pageout_wakeup_thresh = (vmd->vmd_free_target / 10) * 9; /* * Target amount of memory to move out of the laundry queue during a @@ -2031,6 +2019,14 @@ vm_pageout_init_domain(int domain) for (i = 0; i < PQ_COUNT; i++) for (j = 0; j < BPQ_COUNT; j++) vmd->vmd_pagequeues[i].pq_bpqs[j].bpq_lim = lim; + + /* Initialize the pageout daemon pid controller. */ + pidctrl_init(&vmd->vmd_pid, hz / VM_INACT_SCAN_RATE, + vmd->vmd_free_target, PIDCTRL_BOUND, + PIDCTRL_KPD, PIDCTRL_KID, PIDCTRL_KDD); + oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(vmd->vmd_oid), OID_AUTO, + "pidctrl", CTLFLAG_RD, NULL, ""); + pidctrl_init_sysctl(&vmd->vmd_pid, SYSCTL_CHILDREN(oid)); } static void Modified: user/jeff/numa/sys/vm/vm_pagequeue.h ============================================================================== --- user/jeff/numa/sys/vm/vm_pagequeue.h Tue Feb 20 02:18:30 2018 (r329615) +++ user/jeff/numa/sys/vm/vm_pagequeue.h Tue Feb 20 02:30:51 2018 (r329616) @@ -86,7 +86,10 @@ struct vm_pagequeue { } __aligned(CACHE_LINE_SIZE); #include +#include +struct sysctl_oid; + struct vm_domain { struct vm_pagequeue vmd_pagequeues[PQ_COUNT]; struct mtx_padalign vmd_free_mtx; @@ -97,6 +100,7 @@ struct vm_domain { long vmd_segs; /* bitmask of the segments */ /* Paging control variables, locked by domain_free_mtx. */ + struct pidctrl vmd_pid; /* Pageout controller. */ u_int vmd_free_count; boolean_t vmd_oom; int vmd_oom_seq; @@ -129,6 +133,10 @@ struct vm_domain { u_int vmd_pageout_wakeup_thresh;/* (c) min pages to wake pagedaemon */ u_int vmd_interrupt_free_min; /* (c) reserved pages for int code */ u_int vmd_free_severe; /* (c) severe page depletion point */ + + /* Name for sysctl etc. */ + struct sysctl_oid *vmd_oid; + char vmd_name[sizeof(__XSTRING(MAXMEMDOM))]; } __aligned(CACHE_LINE_SIZE); extern struct vm_domain vm_dom[MAXMEMDOM]; From owner-svn-src-user@freebsd.org Tue Feb 20 02:31:23 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E8E9F1AEF3 for ; Tue, 20 Feb 2018 02:31:23 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F0BFF7ACD5; Tue, 20 Feb 2018 02:31:22 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBBDD2324C; Tue, 20 Feb 2018 02:31:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K2VMih003094; Tue, 20 Feb 2018 02:31:22 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K2VMoM003092; Tue, 20 Feb 2018 02:31:22 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802200231.w1K2VMoM003092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 20 Feb 2018 02:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329617 - user/jeff/numa/sys/conf X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: user/jeff/numa/sys/conf X-SVN-Commit-Revision: 329617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 02:31:23 -0000 Author: jeff Date: Tue Feb 20 02:31:22 2018 New Revision: 329617 URL: https://svnweb.freebsd.org/changeset/base/329617 Log: Add PID controller to the build Modified: user/jeff/numa/sys/conf/files Modified: user/jeff/numa/sys/conf/files ============================================================================== --- user/jeff/numa/sys/conf/files Tue Feb 20 02:30:51 2018 (r329616) +++ user/jeff/numa/sys/conf/files Tue Feb 20 02:31:22 2018 (r329617) @@ -3857,6 +3857,7 @@ kern/subr_msgbuf.c standard kern/subr_param.c standard kern/subr_pcpu.c standard kern/subr_pctrie.c standard +kern/subr_pidctrl.c standard kern/subr_power.c standard kern/subr_prf.c standard kern/subr_prof.c standard From owner-svn-src-user@freebsd.org Tue Feb 20 02:32:23 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD080F1B1A9 for ; Tue, 20 Feb 2018 02:32:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90DCA7B01E; Tue, 20 Feb 2018 02:32:22 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BCE623290; Tue, 20 Feb 2018 02:32:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K2WMEK006811; Tue, 20 Feb 2018 02:32:22 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K2WMjT006809; Tue, 20 Feb 2018 02:32:22 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802200232.w1K2WMjT006809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 20 Feb 2018 02:32:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329618 - in user/jeff/numa/sys: kern sys X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in user/jeff/numa/sys: kern sys X-SVN-Commit-Revision: 329618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 02:32:23 -0000 Author: jeff Date: Tue Feb 20 02:32:22 2018 New Revision: 329618 URL: https://svnweb.freebsd.org/changeset/base/329618 Log: Catch up with the version in head. Modified: user/jeff/numa/sys/kern/vfs_bio.c user/jeff/numa/sys/sys/buf.h Modified: user/jeff/numa/sys/kern/vfs_bio.c ============================================================================== --- user/jeff/numa/sys/kern/vfs_bio.c Tue Feb 20 02:31:22 2018 (r329617) +++ user/jeff/numa/sys/kern/vfs_bio.c Tue Feb 20 02:32:22 2018 (r329618) @@ -298,7 +298,7 @@ struct bufqueue { struct mtx_padalign bq_lock; TAILQ_HEAD(, buf) bq_queue; uint8_t bq_index; - uint16_t bq_cpu; + uint16_t bq_subqueue; int bq_len; } __aligned(CACHE_LINE_SIZE); @@ -311,8 +311,8 @@ struct bufqueue __exclusive_cache_line bqempty; struct bufqueue __exclusive_cache_line bqdirty; struct bufdomain { - struct bufqueue bd_cpuq[MAXCPU]; - struct bufqueue bd_cleanq; + struct bufqueue bd_subq[MAXCPU + 1]; /* Per-cpu sub queues + global */ + struct bufqueue *bd_cleanq; struct mtx_padalign bd_run_lock; /* Constants */ long bd_maxbufspace; @@ -329,7 +329,7 @@ struct bufdomain { int __aligned(CACHE_LINE_SIZE) bd_freebuffers; } __aligned(CACHE_LINE_SIZE); -#define BD_LOCKPTR(bd) (&(bd)->bd_cleanq.bq_lock) +#define BD_LOCKPTR(bd) (&(bd)->bd_cleanq->bq_lock) #define BD_LOCK(bd) mtx_lock(BD_LOCKPTR((bd))) #define BD_UNLOCK(bd) mtx_unlock(BD_LOCKPTR((bd))) #define BD_ASSERT_LOCKED(bd) mtx_assert(BD_LOCKPTR((bd)), MA_OWNED) @@ -491,7 +491,7 @@ bufspace_daemon_wakeup(struct bufdomain *bd) */ if (atomic_fetchadd_int(&bd->bd_running, 1) == 0) { BD_RUN_LOCK(bd); - bd->bd_running = 1; + atomic_store_int(&bd->bd_running, 1); wakeup(&bd->bd_running); BD_RUN_UNLOCK(bd); } @@ -1041,7 +1041,7 @@ bufinit(void) bp->b_wcred = NOCRED; bp->b_qindex = QUEUE_NONE; bp->b_domain = -1; - bp->b_cpu = -1; + bp->b_subqueue = mp_ncpus; bp->b_xflags = 0; bp->b_data = bp->b_kvabase = unmapped_buf; LIST_INIT(&bp->b_dep); @@ -1330,8 +1330,6 @@ bpmap_qenter(struct buf *bp) static struct bufqueue * bufqueue(struct buf *bp) { - struct bufdomain *bd; - int cpu; switch (bp->b_qindex) { case QUEUE_NONE: @@ -1343,17 +1341,11 @@ bufqueue(struct buf *bp) case QUEUE_DIRTY: return (&bqdirty); case QUEUE_CLEAN: - /* FALLTHROUGH */ - break; + return (&bdclean[bp->b_domain].bd_subq[bp->b_subqueue]); default: - panic("bufqueue(%p): Unhandled type %d\n", bp, bp->b_qindex); + break; } - bd = &bdclean[bp->b_domain]; - /* cpu may be changed by bd_flush(). Read it only once. */ - cpu = bp->b_cpu; - if (cpu > mp_maxid) - return (&bd->bd_cleanq); - return (&bd->bd_cpuq[cpu]); + panic("bufqueue(%p): Unhandled type %d\n", bp, bp->b_qindex); } /* @@ -1415,14 +1407,12 @@ binsfree(struct buf *bp, int qindex) if (qindex == QUEUE_CLEAN) { bd = &bdclean[bp->b_domain]; if (bd->bd_lim != 0) - bq = &bd->bd_cpuq[PCPU_GET(cpuid)]; + bq = &bd->bd_subq[PCPU_GET(cpuid)]; else - bq = &bd->bd_cleanq; + bq = bd->bd_cleanq; } else bq = &bqdirty; bq_insert(bq, bp, true); - - return; } /* @@ -1592,7 +1582,7 @@ buf_recycle(struct bufdomain *bd, bool kva) if (kva) counter_u64_add(bufdefragcnt, 1); nbp = NULL; - bq = &bd->bd_cleanq; + bq = bd->bd_cleanq; BQ_LOCK(bq); KASSERT(BQ_LOCKPTR(bq) == BD_LOCKPTR(bd), ("buf_recycle: Locks don't match")); @@ -1709,14 +1699,14 @@ bremfreef(struct buf *bp) } static void -bq_init(struct bufqueue *bq, int qindex, int cpu, const char *lockname) +bq_init(struct bufqueue *bq, int qindex, int subqueue, const char *lockname) { mtx_init(&bq->bq_lock, lockname, NULL, MTX_DEF); TAILQ_INIT(&bq->bq_queue); bq->bq_len = 0; bq->bq_index = qindex; - bq->bq_cpu = cpu; + bq->bq_subqueue = subqueue; } static void @@ -1726,10 +1716,11 @@ bd_init(struct bufdomain *bd) int i; domain = bd - bdclean; - bq_init(&bd->bd_cleanq, QUEUE_CLEAN, -1, "bufq clean lock"); + bd->bd_cleanq = &bd->bd_subq[mp_ncpus]; + bq_init(bd->bd_cleanq, QUEUE_CLEAN, -1, "bufq clean lock"); for (i = 0; i <= mp_maxid; i++) - bq_init(&bd->bd_cpuq[i], QUEUE_CLEAN, i, - "bufq clean cpu lock"); + bq_init(&bd->bd_subq[i], QUEUE_CLEAN, i, + "bufq clean subqueue lock"); mtx_init(&bd->bd_run_lock, "bufspace daemon run lock", NULL, MTX_DEF); } @@ -1759,7 +1750,7 @@ bq_remove(struct bufqueue *bq, struct buf *bp) TAILQ_REMOVE(&bq->bq_queue, bp, b_freelist); bq->bq_len--; bp->b_qindex = QUEUE_NONE; - bp->b_flags &= ~(B_REMFREE|B_REUSE); + bp->b_flags &= ~(B_REMFREE | B_REUSE); } static void @@ -1768,22 +1759,22 @@ bd_flush(struct bufdomain *bd, struct bufqueue *bq) struct buf *bp; BQ_ASSERT_LOCKED(bq); - if (bq != &bd->bd_cleanq) { + if (bq != bd->bd_cleanq) { BD_LOCK(bd); while ((bp = TAILQ_FIRST(&bq->bq_queue)) != NULL) { TAILQ_REMOVE(&bq->bq_queue, bp, b_freelist); - TAILQ_INSERT_TAIL(&bd->bd_cleanq.bq_queue, bp, + TAILQ_INSERT_TAIL(&bd->bd_cleanq->bq_queue, bp, b_freelist); - bp->b_cpu = -1; + bp->b_subqueue = mp_ncpus; } - bd->bd_cleanq.bq_len += bq->bq_len; + bd->bd_cleanq->bq_len += bq->bq_len; bq->bq_len = 0; } if (bd->bd_wanted) { bd->bd_wanted = 0; wakeup(&bd->bd_wanted); } - if (bq != &bd->bd_cleanq) + if (bq != bd->bd_cleanq) BD_UNLOCK(bd); } @@ -1798,7 +1789,7 @@ bd_flushall(struct bufdomain *bd) return (0); flushed = 0; for (i = 0; i < mp_maxid; i++) { - bq = &bd->bd_cpuq[i]; + bq = &bd->bd_subq[i]; if (bq->bq_len == 0) continue; BQ_LOCK(bq); @@ -1822,7 +1813,7 @@ bq_insert(struct bufqueue *bq, struct buf *bp, bool un if (bp->b_flags & B_AGE) { /* Place this buf directly on the real queue. */ if (bq->bq_index == QUEUE_CLEAN) - bq = &bd->bd_cleanq; + bq = bd->bd_cleanq; BQ_LOCK(bq); TAILQ_INSERT_HEAD(&bq->bq_queue, bp, b_freelist); } else { @@ -1832,7 +1823,7 @@ bq_insert(struct bufqueue *bq, struct buf *bp, bool un bp->b_flags &= ~(B_AGE | B_REUSE); bq->bq_len++; bp->b_qindex = bq->bq_index; - bp->b_cpu = bq->bq_cpu; + bp->b_subqueue = bq->bq_subqueue; /* * Unlock before we notify so that we don't wakeup a waiter that @@ -1845,7 +1836,7 @@ bq_insert(struct bufqueue *bq, struct buf *bp, bool un /* * Flush the per-cpu queue and notify any waiters. */ - if (bd->bd_wanted || (bq != &bd->bd_cleanq && + if (bd->bd_wanted || (bq != bd->bd_cleanq && bq->bq_len >= bd->bd_lim)) bd_flush(bd, bq); } @@ -5207,12 +5198,12 @@ DB_SHOW_COMMAND(bufqueues, bufqueues) db_printf("\tlobufspace\t%ld\n", bd->bd_lobufspace); db_printf("\tbufspacethresh\t%ld\n", bd->bd_bufspacethresh); db_printf("\n"); - db_printf("\tcleanq count\t%d\n", bd->bd_cleanq.bq_len); + db_printf("\tcleanq count\t%d\n", bd->bd_cleanq->bq_len); db_printf("\twakeup\t\t%d\n", bd->bd_wanted); db_printf("\tlim\t\t%d\n", bd->bd_lim); db_printf("\tCPU "); for (j = 0; j < mp_maxid + 1; j++) - db_printf("%d, ", bd->bd_cpuq[j].bq_len); + db_printf("%d, ", bd->bd_subq[j].bq_len); db_printf("\n"); } } Modified: user/jeff/numa/sys/sys/buf.h ============================================================================== --- user/jeff/numa/sys/sys/buf.h Tue Feb 20 02:31:22 2018 (r329617) +++ user/jeff/numa/sys/sys/buf.h Tue Feb 20 02:32:22 2018 (r329618) @@ -114,7 +114,7 @@ struct buf { uint32_t b_vflags; /* (V) BV_* flags */ uint8_t b_qindex; /* (Q) buffer queue index */ uint8_t b_domain; /* (Q) buf domain this resides in */ - uint16_t b_cpu; /* (Q) per-cpu q if any */ + uint16_t b_subqueue; /* (Q) per-cpu q if any */ uint32_t b_flags; /* B_* flags. */ b_xflags_t b_xflags; /* extra flags */ struct lock b_lock; /* Buffer lock */ From owner-svn-src-user@freebsd.org Thu Feb 22 23:06:41 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D99CEF0B0BF for ; Thu, 22 Feb 2018 23:06:40 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B3797E28A; Thu, 22 Feb 2018 23:06:40 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8170F6556; Thu, 22 Feb 2018 23:06:40 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MN6ecX002246; Thu, 22 Feb 2018 23:06:40 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MN6enZ002243; Thu, 22 Feb 2018 23:06:40 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802222306.w1MN6enZ002243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Thu, 22 Feb 2018 23:06:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329842 - in user/jeff/numa/sys: kern sys X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in user/jeff/numa/sys: kern sys X-SVN-Commit-Revision: 329842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 23:06:41 -0000 Author: jeff Date: Thu Feb 22 23:06:39 2018 New Revision: 329842 URL: https://svnweb.freebsd.org/changeset/base/329842 Log: Make a dedicated set for the kernel and all kernel threads so we can apply policy independently. Modified: user/jeff/numa/sys/kern/kern_cpuset.c user/jeff/numa/sys/kern/kern_kthread.c user/jeff/numa/sys/sys/cpuset.h Modified: user/jeff/numa/sys/kern/kern_cpuset.c ============================================================================== --- user/jeff/numa/sys/kern/kern_cpuset.c Thu Feb 22 22:25:26 2018 (r329841) +++ user/jeff/numa/sys/kern/kern_cpuset.c Thu Feb 22 23:06:39 2018 (r329842) @@ -118,7 +118,7 @@ static struct mtx cpuset_lock; static struct setlist cpuset_ids; static struct domainlist cpuset_domains; static struct unrhdr *cpuset_unr; -static struct cpuset *cpuset_zero, *cpuset_default; +static struct cpuset *cpuset_zero, *cpuset_default, *cpuset_kernel; /* Return the size of cpuset_t at the kernel level */ SYSCTL_INT(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD | CTLFLAG_CAPRD, @@ -507,7 +507,7 @@ domainset_notify(void) PROC_UNLOCK(p); } sx_sunlock(&allproc_lock); - kernel_object->domain.dr_policy = cpuset_default->cs_domain; + kernel_object->domain.dr_policy = cpuset_kernel->cs_domain; } /* @@ -1239,94 +1239,20 @@ cpuset_setthread(lwpid_t id, cpuset_t *mask) int cpuset_setithread(lwpid_t id, int cpu) { - struct setlist cpusets; - struct cpuset *nset, *rset; - struct cpuset *parent, *old_set; - struct thread *td; - struct proc *p; - cpusetid_t cs_id; cpuset_t mask; - int error; - cpuset_freelist_init(&cpusets, 1); - rset = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - cs_id = CPUSET_INVALID; - CPU_ZERO(&mask); if (cpu == NOCPU) CPU_COPY(cpuset_root, &mask); else CPU_SET(cpu, &mask); - - error = cpuset_which(CPU_WHICH_TID, id, &p, &td, &old_set); - if (error != 0 || ((cs_id = alloc_unr(cpuset_unr)) == CPUSET_INVALID)) - goto out; - - /* cpuset_which() returns with PROC_LOCK held. */ - old_set = td->td_cpuset; - - if (cpu == NOCPU) { - nset = LIST_FIRST(&cpusets); - LIST_REMOVE(nset, cs_link); - - /* - * roll back to default set. We're not using cpuset_shadow() - * here because we can fail CPU_SUBSET() check. This can happen - * if default set does not contain all CPUs. - */ - error = _cpuset_create(nset, cpuset_default, &mask, NULL, - CPUSET_INVALID); - - goto applyset; - } - - if (old_set->cs_id == 1 || (old_set->cs_id == CPUSET_INVALID && - old_set->cs_parent->cs_id == 1)) { - - /* - * Current set is either default (1) or - * shadowed version of default set. - * - * Allocate new root set to be able to shadow it - * with any mask. - */ - error = _cpuset_create(rset, cpuset_zero, - &cpuset_zero->cs_mask, NULL, cs_id); - if (error != 0) { - PROC_UNLOCK(p); - goto out; - } - rset->cs_flags |= CPU_SET_ROOT; - parent = rset; - rset = NULL; - cs_id = CPUSET_INVALID; - } else { - /* Assume existing set was already allocated by previous call */ - parent = old_set; - old_set = NULL; - } - - error = cpuset_shadow(parent, &nset, &mask, NULL, &cpusets, NULL); -applyset: - if (error == 0) { - thread_lock(td); - old_set = cpuset_update_thread(td, nset); - thread_unlock(td); - } else - old_set = NULL; - PROC_UNLOCK(p); - if (old_set != NULL) - cpuset_rel(old_set); -out: - cpuset_freelist_free(&cpusets); - if (rset != NULL) - uma_zfree(cpuset_zone, rset); - if (cs_id != CPUSET_INVALID) - free_unr(cpuset_unr, cs_id); - return (error); + return _cpuset_setthread(id, &mask, NULL); } -static struct domainset domainset0; +/* + * Create the domainset for cpuset 0, 1 and cpuset 2. + */ +static struct domainset domainset0, domainset2; void domainset_zero(void) @@ -1344,10 +1270,14 @@ domainset_zero(void) dset->ds_prefer = -1; curthread->td_domain.dr_policy = _domainset_create(dset, NULL); kernel_object->domain.dr_policy = curthread->td_domain.dr_policy; + + domainset_copy(dset, &domainset2); + domainset2.ds_policy = DOMAINSET_POLICY_ROUNDROBIN; + kernel_object->domain.dr_policy = _domainset_create(&domainset2, NULL); } /* - * Creates system-wide cpusets and the cpuset for thread0 including two + * Creates system-wide cpusets and the cpuset for thread0 including three * sets: * * 0 - The root set which should represent all valid processors in the @@ -1357,6 +1287,8 @@ domainset_zero(void) * 1 - The default set which all processes are a member of until changed. * This allows an administrator to move all threads off of given cpus to * dedicate them to high priority tasks or save power etc. + * 2 - The kernel set which allows restriction and policy to be applied only + * to kernel threads and the kernel_object. */ struct cpuset * cpuset_thread0(void) @@ -1370,7 +1302,7 @@ cpuset_thread0(void) NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); /* - * Create the root system set for the whole machine. Doesn't use + * Create the root system set (0) for the whole machine. Doesn't use * cpuset_create() due to NULL parent. */ set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); @@ -1384,12 +1316,20 @@ cpuset_thread0(void) cpuset_root = &set->cs_mask; /* - * Now derive a default, modifiable set from that to give out. + * Now derive a default (1), modifiable set from that to give out. */ set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); error = _cpuset_create(set, cpuset_zero, NULL, NULL, 1); KASSERT(error == 0, ("Error creating default set: %d\n", error)); cpuset_default = set; + /* + * Create the kernel set (2). + */ + set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); + error = _cpuset_create(set, cpuset_zero, NULL, NULL, 2); + KASSERT(error == 0, ("Error creating kernel set: %d\n", error)); + set->cs_domain = &domainset2; + cpuset_kernel = set; /* * Initialize the unit allocator. 0 and 1 are allocated above. @@ -1397,6 +1337,18 @@ cpuset_thread0(void) cpuset_unr = new_unrhdr(2, INT_MAX, NULL); return (set); +} + +void +cpuset_kernthread(struct thread *td) +{ + struct cpuset *set; + + thread_lock(td); + set = td->td_cpuset; + td->td_cpuset = cpuset_ref(cpuset_kernel); + thread_unlock(td); + cpuset_rel(set); } /* Modified: user/jeff/numa/sys/kern/kern_kthread.c ============================================================================== --- user/jeff/numa/sys/kern/kern_kthread.c Thu Feb 22 22:25:26 2018 (r329841) +++ user/jeff/numa/sys/kern/kern_kthread.c Thu Feb 22 23:06:39 2018 (r329842) @@ -131,7 +131,7 @@ kproc_create(void (*func)(void *), void *arg, cpu_fork_kthread_handler(td, func, arg); /* Avoid inheriting affinity from a random parent. */ - cpuset_setthread(td->td_tid, cpuset_root); + cpuset_kernthread(td); thread_lock(td); TD_SET_CAN_RUN(td); sched_prio(td, PVM); @@ -309,7 +309,7 @@ kthread_add(void (*func)(void *), void *arg, struct pr tidhash_add(newtd); /* Avoid inheriting affinity from a random parent. */ - cpuset_setthread(newtd->td_tid, cpuset_root); + cpuset_kernthread(newtd); /* Delay putting it on the run queue until now. */ if (!(flags & RFSTOPPED)) { Modified: user/jeff/numa/sys/sys/cpuset.h ============================================================================== --- user/jeff/numa/sys/sys/cpuset.h Thu Feb 22 22:25:26 2018 (r329841) +++ user/jeff/numa/sys/sys/cpuset.h Thu Feb 22 23:06:39 2018 (r329842) @@ -139,6 +139,7 @@ int cpuset_create_root(struct prison *, struct cpuset int cpuset_setproc_update_set(struct proc *, struct cpuset *); int cpuset_which(cpuwhich_t, id_t, struct proc **, struct thread **, struct cpuset **); +void cpuset_kernthread(struct thread *); char *cpusetobj_strprint(char *, const cpuset_t *); int cpusetobj_strscan(cpuset_t *, const char *); From owner-svn-src-user@freebsd.org Fri Feb 23 01:20:16 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66171F1685B for ; Fri, 23 Feb 2018 01:20:16 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19987835D3; Fri, 23 Feb 2018 01:20:16 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FE7D7AE3; Fri, 23 Feb 2018 01:20:16 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N1KFTo067381; Fri, 23 Feb 2018 01:20:15 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N1KEq2067371; Fri, 23 Feb 2018 01:20:14 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802230120.w1N1KEq2067371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 23 Feb 2018 01:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329849 - in user/jeff/numa/sys: amd64/include i386/include sys vm x86/x86 x86/xen X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in user/jeff/numa/sys: amd64/include i386/include sys vm x86/x86 x86/xen X-SVN-Commit-Revision: 329849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 01:20:16 -0000 Author: jeff Date: Fri Feb 23 01:20:14 2018 New Revision: 329849 URL: https://svnweb.freebsd.org/changeset/base/329849 Log: By default, round-robin assign interrupts only within the domain that the device is connected to. Modified: user/jeff/numa/sys/amd64/include/intr_machdep.h user/jeff/numa/sys/i386/include/intr_machdep.h user/jeff/numa/sys/sys/smp.h user/jeff/numa/sys/vm/vm_phys.h user/jeff/numa/sys/vm/vm_reserv.c user/jeff/numa/sys/x86/x86/intr_machdep.c user/jeff/numa/sys/x86/x86/io_apic.c user/jeff/numa/sys/x86/x86/msi.c user/jeff/numa/sys/x86/x86/nexus.c user/jeff/numa/sys/x86/xen/xen_intr.c Modified: user/jeff/numa/sys/amd64/include/intr_machdep.h ============================================================================== --- user/jeff/numa/sys/amd64/include/intr_machdep.h Fri Feb 23 01:11:57 2018 (r329848) +++ user/jeff/numa/sys/amd64/include/intr_machdep.h Fri Feb 23 01:20:14 2018 (r329849) @@ -132,6 +132,7 @@ struct intsrc { u_long *is_straycount; u_int is_index; u_int is_handlers; + u_int is_domain; u_int is_cpu; }; @@ -168,7 +169,7 @@ void intr_add_cpu(u_int cpu); #endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, - void **cookiep); + void **cookiep, int domain); #ifdef SMP int intr_bind(u_int vector, u_char cpu); #endif @@ -176,7 +177,7 @@ int intr_config_intr(int vector, enum intr_trigger tri enum intr_polarity pol); int intr_describe(u_int vector, void *ih, const char *descr); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); -u_int intr_next_cpu(void); +u_int intr_next_cpu(int domain); struct intsrc *intr_lookup_source(int vector); int intr_register_pic(struct pic *pic); int intr_register_source(struct intsrc *isrc); Modified: user/jeff/numa/sys/i386/include/intr_machdep.h ============================================================================== --- user/jeff/numa/sys/i386/include/intr_machdep.h Fri Feb 23 01:11:57 2018 (r329848) +++ user/jeff/numa/sys/i386/include/intr_machdep.h Fri Feb 23 01:20:14 2018 (r329849) @@ -132,6 +132,7 @@ struct intsrc { u_long *is_straycount; u_int is_index; u_int is_handlers; + u_int is_domain; u_int is_cpu; }; @@ -158,7 +159,8 @@ void elcr_write_trigger(u_int irq, enum intr_trigger t void intr_add_cpu(u_int cpu); #endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, - driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); + driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep, + int domain); #ifdef SMP int intr_bind(u_int vector, u_char cpu); #endif @@ -166,7 +168,7 @@ int intr_config_intr(int vector, enum intr_trigger tri enum intr_polarity pol); int intr_describe(u_int vector, void *ih, const char *descr); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); -u_int intr_next_cpu(void); +u_int intr_next_cpu(int domain); struct intsrc *intr_lookup_source(int vector); int intr_register_pic(struct pic *pic); int intr_register_source(struct intsrc *isrc); Modified: user/jeff/numa/sys/sys/smp.h ============================================================================== --- user/jeff/numa/sys/sys/smp.h Fri Feb 23 01:11:57 2018 (r329848) +++ user/jeff/numa/sys/sys/smp.h Fri Feb 23 01:20:14 2018 (r329849) @@ -169,6 +169,7 @@ extern u_int mp_maxid; extern int mp_maxcpus; extern int mp_ncpus; extern volatile int smp_started; +extern int vm_ndomains; extern cpuset_t all_cpus; extern cpuset_t cpuset_domain[MAXMEMDOM]; /* CPUs in each NUMA domain. */ Modified: user/jeff/numa/sys/vm/vm_phys.h ============================================================================== --- user/jeff/numa/sys/vm/vm_phys.h Fri Feb 23 01:11:57 2018 (r329848) +++ user/jeff/numa/sys/vm/vm_phys.h Fri Feb 23 01:20:14 2018 (r329849) @@ -52,7 +52,6 @@ struct mem_affinity { extern struct mem_affinity *mem_affinity; extern int *mem_locality; #endif -extern int vm_ndomains; struct vm_freelist { struct pglist pl; Modified: user/jeff/numa/sys/vm/vm_reserv.c ============================================================================== --- user/jeff/numa/sys/vm/vm_reserv.c Fri Feb 23 01:11:57 2018 (r329848) +++ user/jeff/numa/sys/vm/vm_reserv.c Fri Feb 23 01:20:14 2018 (r329849) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: user/jeff/numa/sys/x86/x86/intr_machdep.c ============================================================================== --- user/jeff/numa/sys/x86/x86/intr_machdep.c Fri Feb 23 01:11:57 2018 (r329848) +++ user/jeff/numa/sys/x86/x86/intr_machdep.c Fri Feb 23 01:20:14 2018 (r329849) @@ -183,7 +183,8 @@ intr_lookup_source(int vector) int intr_add_handler(const char *name, int vector, driver_filter_t filter, - driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep) + driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep, + int domain) { struct intsrc *isrc; int error; @@ -198,6 +199,7 @@ intr_add_handler(const char *name, int vector, driver_ intrcnt_updatename(isrc); isrc->is_handlers++; if (isrc->is_handlers == 1) { + isrc->is_domain = domain; isrc->is_pic->pic_enable_intr(isrc); isrc->is_pic->pic_enable_source(isrc); } @@ -505,14 +507,14 @@ DB_SHOW_COMMAND(irqs, db_show_irqs) */ cpuset_t intr_cpus = CPUSET_T_INITIALIZER(0x1); -static int current_cpu; +static int current_cpu[MAXMEMDOM]; /* * Return the CPU that the next interrupt source should use. For now * this just returns the next local APIC according to round-robin. */ u_int -intr_next_cpu(void) +intr_next_cpu(int domain) { u_int apic_id; @@ -527,12 +529,13 @@ intr_next_cpu(void) #endif mtx_lock_spin(&icu_lock); - apic_id = cpu_apic_ids[current_cpu]; + apic_id = cpu_apic_ids[current_cpu[domain]]; do { - current_cpu++; - if (current_cpu > mp_maxid) - current_cpu = 0; - } while (!CPU_ISSET(current_cpu, &intr_cpus)); + current_cpu[domain]++; + if (current_cpu[domain] > mp_maxid) + current_cpu[domain] = 0; + } while (!CPU_ISSET(current_cpu[domain], &intr_cpus) || + !CPU_ISSET(current_cpu[domain], &cpuset_domain[domain])); mtx_unlock_spin(&icu_lock); return (apic_id); } @@ -597,12 +600,12 @@ intr_shuffle_irqs(void *arg __unused) */ cpu = isrc->is_event->ie_cpu; if (cpu == NOCPU) - cpu = current_cpu; + cpu = current_cpu[isrc->is_domain]; if (isrc->is_pic->pic_assign_cpu(isrc, cpu_apic_ids[cpu]) == 0) { isrc->is_cpu = cpu; if (isrc->is_event->ie_cpu == NOCPU) - intr_next_cpu(); + intr_next_cpu(isrc->is_domain); } } } @@ -633,10 +636,11 @@ sysctl_hw_intrs(SYSCTL_HANDLER_ARGS) isrc = interrupt_sources[i]; if (isrc == NULL) continue; - sbuf_printf(&sbuf, "%s:%d @%d: %ld\n", + sbuf_printf(&sbuf, "%s:%d @cpu%d(domain%d): %ld\n", isrc->is_event->ie_fullname, isrc->is_index, isrc->is_cpu, + isrc->is_domain, *isrc->is_count); } @@ -695,7 +699,8 @@ intr_balance(void *dummy __unused, int pending __unuse * Restart the scan from the same location to avoid moving in the * common case. */ - current_cpu = 0; + for (i = 0; i < vm_ndomains; i++) + current_cpu[i] = 0; /* * Assign round-robin from most loaded to least. @@ -704,8 +709,8 @@ intr_balance(void *dummy __unused, int pending __unuse isrc = interrupt_sorted[i]; if (isrc == NULL || isrc->is_event->ie_cpu != NOCPU) continue; - cpu = current_cpu; - intr_next_cpu(); + cpu = current_cpu[isrc->is_domain]; + intr_next_cpu(isrc->is_domain); if (isrc->is_cpu != cpu && isrc->is_pic->pic_assign_cpu(isrc, cpu_apic_ids[cpu]) == 0) @@ -733,7 +738,7 @@ SYSINIT(intr_balance_init, SI_SUB_SMP, SI_ORDER_ANY, i * Always route interrupts to the current processor in the UP case. */ u_int -intr_next_cpu(void) +intr_next_cpu(int domain) { return (PCPU_GET(apic_id)); Modified: user/jeff/numa/sys/x86/x86/io_apic.c ============================================================================== --- user/jeff/numa/sys/x86/x86/io_apic.c Fri Feb 23 01:11:57 2018 (r329848) +++ user/jeff/numa/sys/x86/x86/io_apic.c Fri Feb 23 01:20:14 2018 (r329849) @@ -499,7 +499,7 @@ ioapic_enable_intr(struct intsrc *isrc) struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc; if (intpin->io_vector == 0) - if (ioapic_assign_cpu(isrc, intr_next_cpu()) != 0) + if (ioapic_assign_cpu(isrc, intr_next_cpu(isrc->is_domain)) != 0) panic("Couldn't find an APIC vector for IRQ %d", intpin->io_irq); apic_enable_vector(intpin->io_cpu, intpin->io_vector); Modified: user/jeff/numa/sys/x86/x86/msi.c ============================================================================== --- user/jeff/numa/sys/x86/x86/msi.c Fri Feb 23 01:11:57 2018 (r329848) +++ user/jeff/numa/sys/x86/x86/msi.c Fri Feb 23 01:20:14 2018 (r329849) @@ -363,7 +363,7 @@ int msi_alloc(device_t dev, int count, int maxcount, int *irqs) { struct msi_intsrc *msi, *fsrc; - u_int cpu; + u_int cpu, domain; int cnt, i, *mirqs, vector; #ifdef ACPI_DMAR u_int cookies[count]; @@ -373,6 +373,9 @@ msi_alloc(device_t dev, int count, int maxcount, int * if (!msi_enabled) return (ENXIO); + if (bus_get_domain(dev, &domain) != 0) + domain = 0; + if (count > 1) mirqs = malloc(count * sizeof(*mirqs), M_MSI, M_WAITOK); else @@ -420,7 +423,7 @@ again: KASSERT(cnt == count, ("count mismatch")); /* Allocate 'count' IDT vectors. */ - cpu = intr_next_cpu(); + cpu = intr_next_cpu(domain); vector = apic_alloc_vectors(cpu, irqs, count, maxcount); if (vector == 0) { mtx_unlock(&msi_lock); @@ -610,7 +613,7 @@ int msix_alloc(device_t dev, int *irq) { struct msi_intsrc *msi; - u_int cpu; + u_int cpu, domain; int i, vector; #ifdef ACPI_DMAR u_int cookie; @@ -620,6 +623,9 @@ msix_alloc(device_t dev, int *irq) if (!msi_enabled) return (ENXIO); + if (bus_get_domain(dev, &domain) != 0) + domain = 0; + again: mtx_lock(&msi_lock); @@ -651,7 +657,7 @@ again: } /* Allocate an IDT vector. */ - cpu = intr_next_cpu(); + cpu = intr_next_cpu(domain); vector = apic_alloc_vector(cpu, i); if (vector == 0) { mtx_unlock(&msi_lock); Modified: user/jeff/numa/sys/x86/x86/nexus.c ============================================================================== --- user/jeff/numa/sys/x86/x86/nexus.c Fri Feb 23 01:11:57 2018 (r329848) +++ user/jeff/numa/sys/x86/x86/nexus.c Fri Feb 23 01:20:14 2018 (r329849) @@ -573,7 +573,7 @@ nexus_setup_intr(device_t bus, device_t child, struct int flags, driver_filter_t filter, void (*ihand)(void *), void *arg, void **cookiep) { - int error; + int error, domain; /* somebody tried to setup an irq that failed to allocate! */ if (irq == NULL) @@ -589,9 +589,11 @@ nexus_setup_intr(device_t bus, device_t child, struct error = rman_activate_resource(irq); if (error) return (error); + if (bus_get_domain(child, &domain) != 0) + domain = 0; error = intr_add_handler(device_get_nameunit(child), - rman_get_start(irq), filter, ihand, arg, flags, cookiep); + rman_get_start(irq), filter, ihand, arg, flags, cookiep, domain); return (error); } Modified: user/jeff/numa/sys/x86/xen/xen_intr.c ============================================================================== --- user/jeff/numa/sys/x86/xen/xen_intr.c Fri Feb 23 01:11:57 2018 (r329848) +++ user/jeff/numa/sys/x86/xen/xen_intr.c Fri Feb 23 01:20:14 2018 (r329849) @@ -430,7 +430,7 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port * unless specified otherwise, so shuffle them to balance * the interrupt load. */ - xen_intr_assign_cpu(&isrc->xi_intsrc, intr_next_cpu()); + xen_intr_assign_cpu(&isrc->xi_intsrc, intr_next_cpu(0)); } #endif @@ -1562,7 +1562,7 @@ xen_intr_add_handler(const char *name, driver_filter_t return (EINVAL); error = intr_add_handler(name, isrc->xi_vector,filter, handler, arg, - flags|INTR_EXCL, &isrc->xi_cookie); + flags|INTR_EXCL, &isrc->xi_cookie, 0); if (error != 0) { printf( "%s: xen_intr_add_handler: intr_add_handler failed: %d\n", From owner-svn-src-user@freebsd.org Fri Feb 23 23:16:17 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3FF3F2939C for ; Fri, 23 Feb 2018 23:16:16 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 744D87E96A; Fri, 23 Feb 2018 23:16:16 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6ADEB1D119; Fri, 23 Feb 2018 23:16:16 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NNGGfg036058; Fri, 23 Feb 2018 23:16:16 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NNGGYT036055; Fri, 23 Feb 2018 23:16:16 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802232316.w1NNGGYT036055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 23 Feb 2018 23:16:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329884 - in user/jeff/numa: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opens... X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in user/jeff/numa: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common ... X-SVN-Commit-Revision: 329884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 23:16:17 -0000 Author: jeff Date: Fri Feb 23 23:16:15 2018 New Revision: 329884 URL: https://svnweb.freebsd.org/changeset/base/329884 Log: Merge from head. Added: user/jeff/numa/lib/libifconfig/libifconfig_carp.c - copied unchanged from r329883, head/lib/libifconfig/libifconfig_carp.c user/jeff/numa/lib/libifconfig/libifconfig_inet.c - copied unchanged from r329883, head/lib/libifconfig/libifconfig_inet.c user/jeff/numa/lib/libifconfig/libifconfig_inet6.c - copied unchanged from r329883, head/lib/libifconfig/libifconfig_inet6.c user/jeff/numa/lib/libifconfig/libifconfig_lagg.c - copied unchanged from r329883, head/lib/libifconfig/libifconfig_lagg.c user/jeff/numa/lib/libifconfig/libifconfig_media.c - copied unchanged from r329883, head/lib/libifconfig/libifconfig_media.c user/jeff/numa/sbin/Makefile.powerpc64 - copied unchanged from r329883, head/sbin/Makefile.powerpc64 user/jeff/numa/share/examples/libifconfig/ifchangevlan.c - copied unchanged from r329883, head/share/examples/libifconfig/ifchangevlan.c user/jeff/numa/share/examples/libifconfig/ifcreatevlan.c - copied unchanged from r329883, head/share/examples/libifconfig/ifcreatevlan.c user/jeff/numa/share/examples/libifconfig/status.c - copied unchanged from r329883, head/share/examples/libifconfig/status.c user/jeff/numa/share/man/man4/chvgpio.4 - copied unchanged from r329883, head/share/man/man4/chvgpio.4 user/jeff/numa/share/man/man4/jedec_dimm.4 - copied unchanged from r329883, head/share/man/man4/jedec_dimm.4 user/jeff/numa/stand/common/zfs_cmd.c - copied unchanged from r329883, head/stand/common/zfs_cmd.c user/jeff/numa/stand/liblua/lerrno.c - copied unchanged from r329883, head/stand/liblua/lerrno.c user/jeff/numa/stand/liblua/lerrno.h - copied unchanged from r329883, head/stand/liblua/lerrno.h user/jeff/numa/stand/lua/cli.lua - copied unchanged from r329883, head/stand/lua/cli.lua user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_indirect_births.h - copied unchanged from r329883, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_indirect_births.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_indirect_mapping.h - copied unchanged from r329883, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_indirect_mapping.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h - copied unchanged from r329883, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h - copied unchanged from r329883, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c - copied unchanged from r329883, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_births.c - copied unchanged from r329883, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_births.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_mapping.c - copied unchanged from r329883, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_mapping.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c - copied unchanged from r329883, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c - copied unchanged from r329883, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c user/jeff/numa/sys/dev/gpio/chvgpio.c - copied unchanged from r329883, head/sys/dev/gpio/chvgpio.c user/jeff/numa/sys/dev/gpio/chvgpio_reg.h - copied unchanged from r329883, head/sys/dev/gpio/chvgpio_reg.h user/jeff/numa/sys/dev/jedec_dimm/ - copied from r329883, head/sys/dev/jedec_dimm/ user/jeff/numa/sys/modules/chvgpio/ - copied from r329883, head/sys/modules/chvgpio/ user/jeff/numa/sys/modules/i2c/jedec_dimm/ - copied from r329883, head/sys/modules/i2c/jedec_dimm/ user/jeff/numa/sys/powerpc/powerpc/cpu_subr64.S - copied unchanged from r329883, head/sys/powerpc/powerpc/cpu_subr64.S user/jeff/numa/tests/sys/cddl/ - copied from r329883, head/tests/sys/cddl/ user/jeff/numa/tests/sys/net/ - copied from r329883, head/tests/sys/net/ user/jeff/numa/tools/boot/lua-lint.sh - copied unchanged from r329883, head/tools/boot/lua-lint.sh Modified: user/jeff/numa/Makefile.inc1 user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.c user/jeff/numa/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c user/jeff/numa/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c user/jeff/numa/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h user/jeff/numa/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c user/jeff/numa/cddl/contrib/opensolaris/cmd/ztest/ztest.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h user/jeff/numa/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c user/jeff/numa/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h user/jeff/numa/cddl/usr.sbin/zdb/Makefile user/jeff/numa/cddl/usr.sbin/zfsd/case_file.cc user/jeff/numa/contrib/compiler-rt/lib/builtins/int_types.h user/jeff/numa/contrib/lua/src/llimits.h user/jeff/numa/contrib/lua/src/lstrlib.c user/jeff/numa/etc/mtree/BSD.tests.dist user/jeff/numa/etc/rc.d/ipfw user/jeff/numa/etc/rc.firewall user/jeff/numa/include/time.h user/jeff/numa/lib/libc/gen/getpeereid.c user/jeff/numa/lib/libc/stdio/xprintf_int.c user/jeff/numa/lib/libifconfig/Makefile user/jeff/numa/lib/libifconfig/libifconfig.c user/jeff/numa/lib/libifconfig/libifconfig.h user/jeff/numa/lib/libifconfig/libifconfig_internal.c user/jeff/numa/lib/libifconfig/libifconfig_internal.h user/jeff/numa/lib/libvmmapi/vmmapi.c user/jeff/numa/lib/libvmmapi/vmmapi.h user/jeff/numa/libexec/getty/Makefile user/jeff/numa/libexec/getty/chat.c user/jeff/numa/libexec/getty/main.c user/jeff/numa/libexec/getty/subr.c user/jeff/numa/sbin/devmatch/devmatch.c user/jeff/numa/sbin/dhclient/Makefile user/jeff/numa/sbin/dhclient/clparse.c user/jeff/numa/sbin/dhclient/conflex.c user/jeff/numa/sbin/dhclient/dhclient.c user/jeff/numa/sbin/dhclient/dhcpd.h user/jeff/numa/sbin/dhclient/dispatch.c user/jeff/numa/sbin/dhclient/errwarn.c user/jeff/numa/sbin/dhclient/hash.c user/jeff/numa/sbin/dhclient/options.c user/jeff/numa/sbin/dhclient/privsep.c user/jeff/numa/sbin/dhclient/privsep.h user/jeff/numa/sbin/dhclient/tables.c user/jeff/numa/sbin/dhclient/tests/fake.c user/jeff/numa/sbin/dhclient/tree.h user/jeff/numa/sbin/fsck_ffs/inode.c user/jeff/numa/sbin/nvmecontrol/devlist.c user/jeff/numa/sbin/nvmecontrol/firmware.c user/jeff/numa/sbin/nvmecontrol/identify.c user/jeff/numa/sbin/nvmecontrol/logpage.c user/jeff/numa/sbin/nvmecontrol/nvmecontrol.c user/jeff/numa/sbin/nvmecontrol/perftest.c user/jeff/numa/sbin/nvmecontrol/power.c user/jeff/numa/sbin/nvmecontrol/wdc.c user/jeff/numa/sbin/route/route.8 user/jeff/numa/share/examples/libifconfig/Makefile user/jeff/numa/share/examples/libifconfig/ifcreate.c user/jeff/numa/share/examples/libifconfig/ifdestroy.c user/jeff/numa/share/examples/libifconfig/setdescription.c user/jeff/numa/share/examples/libifconfig/setmtu.c user/jeff/numa/share/man/man4/Makefile user/jeff/numa/share/man/man9/style.lua.9 user/jeff/numa/share/mk/atf.test.mk user/jeff/numa/share/mk/bsd.own.mk user/jeff/numa/stand/common/interp_lua.c user/jeff/numa/stand/common/load_elf.c user/jeff/numa/stand/defs.mk user/jeff/numa/stand/efi/libefi/efizfs.c user/jeff/numa/stand/efi/loader/Makefile user/jeff/numa/stand/efi/loader/main.c user/jeff/numa/stand/i386/boot2/boot2.c user/jeff/numa/stand/i386/loader/Makefile user/jeff/numa/stand/i386/loader/conf.c user/jeff/numa/stand/i386/loader/main.c user/jeff/numa/stand/liblua/Makefile user/jeff/numa/stand/liblua/lfs.c user/jeff/numa/stand/liblua/luaconf.h user/jeff/numa/stand/liblua/lutils.c user/jeff/numa/stand/libsa/cd9660.c user/jeff/numa/stand/libsa/nfs.c user/jeff/numa/stand/libsa/nullfs.c user/jeff/numa/stand/libsa/stand.h user/jeff/numa/stand/libsa/tftp.c user/jeff/numa/stand/libsa/ufs.c user/jeff/numa/stand/libsa/write.c user/jeff/numa/stand/loader.mk user/jeff/numa/stand/lua.mk user/jeff/numa/stand/lua/Makefile user/jeff/numa/stand/lua/color.lua user/jeff/numa/stand/lua/config.lua user/jeff/numa/stand/lua/core.lua user/jeff/numa/stand/lua/drawer.lua user/jeff/numa/stand/lua/loader.lua user/jeff/numa/stand/lua/menu.lua user/jeff/numa/stand/lua/password.lua user/jeff/numa/stand/lua/screen.lua user/jeff/numa/stand/sparc64/loader/Makefile user/jeff/numa/stand/sparc64/loader/main.c user/jeff/numa/stand/userboot/userboot/Makefile user/jeff/numa/stand/userboot/userboot/host.c user/jeff/numa/stand/userboot/userboot/main.c user/jeff/numa/stand/zfs/libzfs.h user/jeff/numa/stand/zfs/zfs.c user/jeff/numa/sys/amd64/amd64/fpu.c user/jeff/numa/sys/amd64/amd64/pmap.c user/jeff/numa/sys/amd64/include/fpu.h user/jeff/numa/sys/amd64/include/vmm_dev.h user/jeff/numa/sys/amd64/linux/linux_dummy.c user/jeff/numa/sys/amd64/linux/linux_sysvec.c user/jeff/numa/sys/amd64/linux/syscalls.master user/jeff/numa/sys/amd64/linux32/linux32_dummy.c user/jeff/numa/sys/amd64/linux32/linux32_sysvec.c user/jeff/numa/sys/amd64/linux32/syscalls.master user/jeff/numa/sys/amd64/vmm/vmm_dev.c user/jeff/numa/sys/arm/arm/pmap-v4.c user/jeff/numa/sys/arm/arm/pmap-v6.c user/jeff/numa/sys/arm/freescale/imx/imx6_ccmreg.h user/jeff/numa/sys/arm/include/_types.h user/jeff/numa/sys/arm/nvidia/drm2/tegra_bo.c user/jeff/numa/sys/arm64/arm64/pmap.c user/jeff/numa/sys/arm64/arm64/vfp.c user/jeff/numa/sys/arm64/include/_types.h user/jeff/numa/sys/arm64/include/vfp.h user/jeff/numa/sys/cam/cam_iosched.c user/jeff/numa/sys/cam/nvme/nvme_all.c user/jeff/numa/sys/cam/nvme/nvme_da.c user/jeff/numa/sys/cam/scsi/scsi_cd.c user/jeff/numa/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c user/jeff/numa/sys/cddl/compat/opensolaris/sys/kmem.h user/jeff/numa/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c user/jeff/numa/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c user/jeff/numa/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h user/jeff/numa/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c user/jeff/numa/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.h user/jeff/numa/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c user/jeff/numa/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/Makefile.files user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lgc.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/llex.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lstrlib.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ltable.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_reftree.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bpobj.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deadlist.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_priority.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/sys/cpupart.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/sys/fm/util.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h user/jeff/numa/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h user/jeff/numa/sys/compat/freebsd32/freebsd32_misc.c user/jeff/numa/sys/compat/freebsd32/freebsd32_util.h user/jeff/numa/sys/compat/freebsd32/syscalls.master user/jeff/numa/sys/compat/linux/linux_emul.c user/jeff/numa/sys/compat/linux/linux_file.c user/jeff/numa/sys/compat/linux/linux_ioctl.c user/jeff/numa/sys/compat/linux/linux_mib.c user/jeff/numa/sys/compat/linux/linux_misc.c user/jeff/numa/sys/compat/linux/linux_mmap.c user/jeff/numa/sys/compat/linux/linux_socket.c user/jeff/numa/sys/compat/linuxkpi/common/include/linux/mutex.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/rwsem.h user/jeff/numa/sys/compat/linuxkpi/common/include/linux/sched.h user/jeff/numa/sys/compat/linuxkpi/common/src/linux_compat.c user/jeff/numa/sys/compat/linuxkpi/common/src/linux_lock.c user/jeff/numa/sys/compat/linuxkpi/common/src/linux_page.c user/jeff/numa/sys/compat/linuxkpi/common/src/linux_schedule.c user/jeff/numa/sys/conf/NOTES user/jeff/numa/sys/conf/files user/jeff/numa/sys/conf/files.amd64 user/jeff/numa/sys/conf/files.i386 user/jeff/numa/sys/conf/files.powerpc user/jeff/numa/sys/crypto/aesni/aesni.c user/jeff/numa/sys/crypto/armv8/armv8_crypto.c user/jeff/numa/sys/crypto/via/padlock.c user/jeff/numa/sys/crypto/via/padlock_cipher.c user/jeff/numa/sys/crypto/via/padlock_hash.c user/jeff/numa/sys/dev/aic7xxx/aic7xxx.seq user/jeff/numa/sys/dev/cxgbe/adapter.h user/jeff/numa/sys/dev/cxgbe/common/t4_msg.h user/jeff/numa/sys/dev/cxgbe/common/t4_tcb.h user/jeff/numa/sys/dev/cxgbe/t4_netmap.c user/jeff/numa/sys/dev/cxgbe/tom/t4_cpl_io.c user/jeff/numa/sys/dev/cxgbe/tom/t4_ddp.c user/jeff/numa/sys/dev/cxgbe/tom/t4_tom.c user/jeff/numa/sys/dev/cxgbe/tom/t4_tom.h user/jeff/numa/sys/dev/drm2/drm_fb_helper.c user/jeff/numa/sys/dev/drm2/i915/i915_gem.c user/jeff/numa/sys/dev/drm2/i915/i915_gem_gtt.c user/jeff/numa/sys/dev/drm2/ttm/ttm_bo_vm.c user/jeff/numa/sys/dev/drm2/ttm/ttm_page_alloc.c user/jeff/numa/sys/dev/efidev/efirt.c (contents, props changed) user/jeff/numa/sys/dev/flash/at45d.c user/jeff/numa/sys/dev/flash/mx25l.c user/jeff/numa/sys/dev/isci/scil/intel_ata.h user/jeff/numa/sys/dev/isci/scil/sati_write_long.c user/jeff/numa/sys/dev/mpr/mpr_sas.c user/jeff/numa/sys/dev/nvme/nvme.c user/jeff/numa/sys/dev/nvme/nvme.h user/jeff/numa/sys/dev/nvme/nvme_ctrlr.c user/jeff/numa/sys/dev/nvme/nvme_ctrlr_cmd.c user/jeff/numa/sys/dev/nvme/nvme_ns.c user/jeff/numa/sys/dev/nvme/nvme_ns_cmd.c user/jeff/numa/sys/dev/nvme/nvme_private.h user/jeff/numa/sys/dev/nvme/nvme_qpair.c user/jeff/numa/sys/dev/qlxgbe/ql_dbg.h user/jeff/numa/sys/dev/qlxgbe/ql_def.h user/jeff/numa/sys/dev/qlxgbe/ql_glbl.h user/jeff/numa/sys/dev/qlxgbe/ql_hw.c user/jeff/numa/sys/dev/qlxgbe/ql_hw.h user/jeff/numa/sys/dev/qlxgbe/ql_inline.h user/jeff/numa/sys/dev/qlxgbe/ql_ioctl.c user/jeff/numa/sys/dev/qlxgbe/ql_ioctl.h user/jeff/numa/sys/dev/qlxgbe/ql_isr.c user/jeff/numa/sys/dev/qlxgbe/ql_misc.c user/jeff/numa/sys/dev/qlxgbe/ql_os.c user/jeff/numa/sys/dev/qlxgbe/ql_os.h user/jeff/numa/sys/dev/qlxgbe/ql_ver.h user/jeff/numa/sys/dev/random/nehemiah.c user/jeff/numa/sys/dev/vt/vt_core.c user/jeff/numa/sys/dev/xen/blkback/blkback.c user/jeff/numa/sys/dev/xen/netback/netback.c user/jeff/numa/sys/i386/i386/npx.c user/jeff/numa/sys/i386/i386/pmap.c user/jeff/numa/sys/i386/ibcs2/syscalls.master user/jeff/numa/sys/i386/include/npx.h user/jeff/numa/sys/i386/linux/imgact_linux.c user/jeff/numa/sys/i386/linux/linux_dummy.c user/jeff/numa/sys/i386/linux/linux_machdep.c user/jeff/numa/sys/i386/linux/linux_ptrace.c user/jeff/numa/sys/i386/linux/linux_sysvec.c user/jeff/numa/sys/i386/linux/syscalls.master user/jeff/numa/sys/i386/pci/pci_pir.c user/jeff/numa/sys/kern/kern_exit.c user/jeff/numa/sys/kern/kern_fork.c user/jeff/numa/sys/kern/kern_mutex.c user/jeff/numa/sys/kern/kern_sig.c user/jeff/numa/sys/kern/kern_syscalls.c user/jeff/numa/sys/kern/sched_ule.c user/jeff/numa/sys/kern/sys_procdesc.c user/jeff/numa/sys/kern/syscalls.master user/jeff/numa/sys/kern/vfs_bio.c user/jeff/numa/sys/kern/vfs_default.c user/jeff/numa/sys/mips/include/_types.h user/jeff/numa/sys/mips/mips/pmap.c user/jeff/numa/sys/mips/mips/uma_machdep.c user/jeff/numa/sys/modules/Makefile user/jeff/numa/sys/modules/i2c/Makefile user/jeff/numa/sys/modules/imx/imx_i2c/Makefile user/jeff/numa/sys/modules/spi/at45d/Makefile user/jeff/numa/sys/modules/spi/mx25l/Makefile user/jeff/numa/sys/net/iflib.c user/jeff/numa/sys/net/iflib.h user/jeff/numa/sys/net/rtsock.c user/jeff/numa/sys/netgraph/ng_atmllc.c user/jeff/numa/sys/powerpc/aim/locore64.S user/jeff/numa/sys/powerpc/aim/mmu_oea.c user/jeff/numa/sys/powerpc/aim/mmu_oea64.c user/jeff/numa/sys/powerpc/aim/mp_cpudep.c user/jeff/numa/sys/powerpc/aim/trap_subr64.S user/jeff/numa/sys/powerpc/booke/pmap.c user/jeff/numa/sys/powerpc/conf/GENERIC64 user/jeff/numa/sys/powerpc/include/_types.h user/jeff/numa/sys/powerpc/include/cpu.h user/jeff/numa/sys/powerpc/include/pcb.h user/jeff/numa/sys/powerpc/include/pte.h user/jeff/numa/sys/powerpc/include/spr.h user/jeff/numa/sys/powerpc/powernv/opal_dev.c user/jeff/numa/sys/powerpc/powernv/platform_powernv.c user/jeff/numa/sys/powerpc/powerpc/clock.c user/jeff/numa/sys/powerpc/powerpc/cpu.c user/jeff/numa/sys/powerpc/powerpc/trap.c user/jeff/numa/sys/riscv/include/_types.h user/jeff/numa/sys/riscv/riscv/pmap.c user/jeff/numa/sys/sparc64/include/_types.h user/jeff/numa/sys/sys/_types.h user/jeff/numa/sys/sys/sysent.h user/jeff/numa/sys/ufs/ffs/ffs_subr.c user/jeff/numa/sys/vm/vm_fault.c user/jeff/numa/sys/vm/vm_page.c user/jeff/numa/sys/vm/vm_pageout.c user/jeff/numa/sys/vm/vm_pageout.h user/jeff/numa/sys/vm/vm_pagequeue.h user/jeff/numa/sys/x86/include/_types.h user/jeff/numa/sys/x86/include/apicvar.h user/jeff/numa/sys/x86/x86/intr_machdep.c user/jeff/numa/tests/sys/Makefile user/jeff/numa/tools/boot/universe.sh user/jeff/numa/usr.bin/ministat/ministat.c user/jeff/numa/usr.bin/tail/reverse.c user/jeff/numa/usr.bin/tail/tests/tail_test.sh user/jeff/numa/usr.sbin/mountd/mountd.c user/jeff/numa/usr.sbin/mptutil/mpt_config.c user/jeff/numa/usr.sbin/mptutil/mpt_drive.c user/jeff/numa/usr.sbin/mptutil/mpt_evt.c user/jeff/numa/usr.sbin/mptutil/mpt_show.c user/jeff/numa/usr.sbin/mptutil/mpt_volume.c user/jeff/numa/usr.sbin/wlandebug/wlandebug.c Directory Properties: user/jeff/numa/ (props changed) user/jeff/numa/cddl/ (props changed) user/jeff/numa/cddl/contrib/opensolaris/ (props changed) user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/ (props changed) user/jeff/numa/cddl/contrib/opensolaris/cmd/zfs/ (props changed) user/jeff/numa/cddl/contrib/opensolaris/lib/libzfs/ (props changed) user/jeff/numa/contrib/compiler-rt/ (props changed) user/jeff/numa/sys/cddl/contrib/opensolaris/ (props changed) Modified: user/jeff/numa/Makefile.inc1 ============================================================================== --- user/jeff/numa/Makefile.inc1 Fri Feb 23 23:07:41 2018 (r329883) +++ user/jeff/numa/Makefile.inc1 Fri Feb 23 23:16:15 2018 (r329884) @@ -339,21 +339,33 @@ BUILDENV_SHELL?=${SHELL} BUILDENV_SHELL?=/bin/sh .endif -.if !defined(SVN) || empty(SVN) +.if !defined(SVN_CMD) || empty(SVN_CMD) . for _P in /usr/bin /usr/local/bin . for _S in svn svnlite . if exists(${_P}/${_S}) -SVN= ${_P}/${_S} +SVN_CMD= ${_P}/${_S} . endif . endfor . endfor +.export SVN_CMD .endif SVNFLAGS?= -r HEAD -.if !defined(VCS_REVISION) && empty(VCS_REVISION) +.if !defined(VCS_REVISION) || empty(VCS_REVISION) +.if !defined(SVNVERSION_CMD) || empty(SVNVERSION_CMD) +. for _D in ${PATH:S,:, ,g} +. if exists(${_D}/svnversion) +SVNVERSION_CMD?=${_D}/svnversion +. endif +. if exists(${_D}/svnliteversion) +SVNVERSION_CMD?=${_D}/svnliteversion +. endif +. endfor +.endif _VCS_REVISION?= $$(eval ${SVNVERSION_CMD} ${SRCDIR}) . if !empty(_VCS_REVISION) VCS_REVISION= $$(echo r${_VCS_REVISION}) . endif +.export VCS_REVISION .endif .if !defined(OSRELDATE) @@ -1783,7 +1795,7 @@ update: .PHONY @echo "--------------------------------------------------------------" @echo ">>> Updating ${.CURDIR} using Subversion" @echo "--------------------------------------------------------------" - @(cd ${.CURDIR}; ${SVN} update ${SVNFLAGS}) + @(cd ${.CURDIR}; ${SVN_CMD} update ${SVNFLAGS}) .endif # Modified: user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Feb 23 23:07:41 2018 (r329883) +++ user/jeff/numa/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Feb 23 23:16:15 2018 (r329884) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. */ @@ -77,19 +77,23 @@ dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \ dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN") #define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : \ - (((idx) == DMU_OTN_ZAP_DATA || (idx) == DMU_OTN_ZAP_METADATA) ? \ - DMU_OT_ZAP_OTHER : DMU_OT_NUMTYPES)) + (idx) == DMU_OTN_ZAP_DATA || (idx) == DMU_OTN_ZAP_METADATA ? \ + DMU_OT_ZAP_OTHER : \ + (idx) == DMU_OTN_UINT64_DATA || (idx) == DMU_OTN_UINT64_METADATA ? \ + DMU_OT_UINT64_OTHER : DMU_OT_NUMTYPES) #ifndef lint extern int reference_tracking_enable; extern boolean_t zfs_recover; extern uint64_t zfs_arc_max, zfs_arc_meta_limit; extern int zfs_vdev_async_read_max_active; +extern boolean_t spa_load_verify_dryrun; #else int reference_tracking_enable; boolean_t zfs_recover; uint64_t zfs_arc_max, zfs_arc_meta_limit; int zfs_vdev_async_read_max_active; +boolean_t spa_load_verify_dryrun; #endif static const char cmdname[] = "zdb"; @@ -667,8 +671,8 @@ get_metaslab_refcount(vdev_t *vd) { int refcount = 0; - if (vd->vdev_top == vd && !vd->vdev_removing) { - for (unsigned m = 0; m < vd->vdev_ms_count; m++) { + if (vd->vdev_top == vd) { + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { space_map_t *sm = vd->vdev_ms[m]->ms_sm; if (sm != NULL && @@ -683,6 +687,45 @@ get_metaslab_refcount(vdev_t *vd) } static int +get_obsolete_refcount(vdev_t *vd) +{ + int refcount = 0; + + uint64_t obsolete_sm_obj = vdev_obsolete_sm_object(vd); + if (vd->vdev_top == vd && obsolete_sm_obj != 0) { + dmu_object_info_t doi; + VERIFY0(dmu_object_info(vd->vdev_spa->spa_meta_objset, + obsolete_sm_obj, &doi)); + if (doi.doi_bonus_size == sizeof (space_map_phys_t)) { + refcount++; + } + } else { + ASSERT3P(vd->vdev_obsolete_sm, ==, NULL); + ASSERT3U(obsolete_sm_obj, ==, 0); + } + for (unsigned c = 0; c < vd->vdev_children; c++) { + refcount += get_obsolete_refcount(vd->vdev_child[c]); + } + + return (refcount); +} + +static int +get_prev_obsolete_spacemap_refcount(spa_t *spa) +{ + uint64_t prev_obj = + spa->spa_condensing_indirect_phys.scip_prev_obsolete_sm_object; + if (prev_obj != 0) { + dmu_object_info_t doi; + VERIFY0(dmu_object_info(spa->spa_meta_objset, prev_obj, &doi)); + if (doi.doi_bonus_size == sizeof (space_map_phys_t)) { + return (1); + } + } + return (0); +} + +static int verify_spacemap_refcounts(spa_t *spa) { uint64_t expected_refcount = 0; @@ -693,6 +736,8 @@ verify_spacemap_refcounts(spa_t *spa) &expected_refcount); actual_refcount = get_dtl_refcount(spa->spa_root_vdev); actual_refcount += get_metaslab_refcount(spa->spa_root_vdev); + actual_refcount += get_obsolete_refcount(spa->spa_root_vdev); + actual_refcount += get_prev_obsolete_spacemap_refcount(spa); if (expected_refcount != actual_refcount) { (void) printf("space map refcount mismatch: expected %lld != " @@ -708,12 +753,19 @@ static void dump_spacemap(objset_t *os, space_map_t *sm) { uint64_t alloc, offset, entry; - const char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", - "INVALID", "INVALID", "INVALID", "INVALID" }; + char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", + "INVALID", "INVALID", "INVALID", "INVALID" }; if (sm == NULL) return; + (void) printf("space map object %llu:\n", + (longlong_t)sm->sm_phys->smp_object); + (void) printf(" smp_objsize = 0x%llx\n", + (longlong_t)sm->sm_phys->smp_objsize); + (void) printf(" smp_alloc = 0x%llx\n", + (longlong_t)sm->sm_phys->smp_alloc); + /* * Print out the freelist entries in both encoded and decoded form. */ @@ -818,9 +870,7 @@ dump_metaslab(metaslab_t *msp) if (dump_opt['d'] > 5 || dump_opt['m'] > 3) { ASSERT(msp->ms_size == (1ULL << vd->vdev_ms_shift)); - mutex_enter(&msp->ms_lock); dump_spacemap(spa->spa_meta_objset, msp->ms_sm); - mutex_exit(&msp->ms_lock); } } @@ -878,6 +928,78 @@ dump_metaslab_groups(spa_t *spa) } static void +print_vdev_indirect(vdev_t *vd) +{ + vdev_indirect_config_t *vic = &vd->vdev_indirect_config; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + vdev_indirect_births_t *vib = vd->vdev_indirect_births; + + if (vim == NULL) { + ASSERT3P(vib, ==, NULL); + return; + } + + ASSERT3U(vdev_indirect_mapping_object(vim), ==, + vic->vic_mapping_object); + ASSERT3U(vdev_indirect_births_object(vib), ==, + vic->vic_births_object); + + (void) printf("indirect births obj %llu:\n", + (longlong_t)vic->vic_births_object); + (void) printf(" vib_count = %llu\n", + (longlong_t)vdev_indirect_births_count(vib)); + for (uint64_t i = 0; i < vdev_indirect_births_count(vib); i++) { + vdev_indirect_birth_entry_phys_t *cur_vibe = + &vib->vib_entries[i]; + (void) printf("\toffset %llx -> txg %llu\n", + (longlong_t)cur_vibe->vibe_offset, + (longlong_t)cur_vibe->vibe_phys_birth_txg); + } + (void) printf("\n"); + + (void) printf("indirect mapping obj %llu:\n", + (longlong_t)vic->vic_mapping_object); + (void) printf(" vim_max_offset = 0x%llx\n", + (longlong_t)vdev_indirect_mapping_max_offset(vim)); + (void) printf(" vim_bytes_mapped = 0x%llx\n", + (longlong_t)vdev_indirect_mapping_bytes_mapped(vim)); + (void) printf(" vim_count = %llu\n", + (longlong_t)vdev_indirect_mapping_num_entries(vim)); + + if (dump_opt['d'] <= 5 && dump_opt['m'] <= 3) + return; + + uint32_t *counts = vdev_indirect_mapping_load_obsolete_counts(vim); + + for (uint64_t i = 0; i < vdev_indirect_mapping_num_entries(vim); i++) { + vdev_indirect_mapping_entry_phys_t *vimep = + &vim->vim_entries[i]; + (void) printf("\t<%llx:%llx:%llx> -> " + "<%llx:%llx:%llx> (%x obsolete)\n", + (longlong_t)vd->vdev_id, + (longlong_t)DVA_MAPPING_GET_SRC_OFFSET(vimep), + (longlong_t)DVA_GET_ASIZE(&vimep->vimep_dst), + (longlong_t)DVA_GET_VDEV(&vimep->vimep_dst), + (longlong_t)DVA_GET_OFFSET(&vimep->vimep_dst), + (longlong_t)DVA_GET_ASIZE(&vimep->vimep_dst), + counts[i]); + } + (void) printf("\n"); + + uint64_t obsolete_sm_object = vdev_obsolete_sm_object(vd); + if (obsolete_sm_object != 0) { + objset_t *mos = vd->vdev_spa->spa_meta_objset; + (void) printf("obsolete space map object %llu:\n", + (u_longlong_t)obsolete_sm_object); + ASSERT(vd->vdev_obsolete_sm != NULL); + ASSERT3U(space_map_object(vd->vdev_obsolete_sm), ==, + obsolete_sm_object); + dump_spacemap(mos, vd->vdev_obsolete_sm); + (void) printf("\n"); + } +} + +static void dump_metaslabs(spa_t *spa) { vdev_t *vd, *rvd = spa->spa_root_vdev; @@ -913,6 +1035,8 @@ dump_metaslabs(spa_t *spa) vd = rvd->vdev_child[c]; print_vdev_metaslab_header(vd); + print_vdev_indirect(vd); + for (m = 0; m < vd->vdev_ms_count; m++) dump_metaslab(vd->vdev_ms[m]); (void) printf("\n"); @@ -1090,9 +1214,7 @@ dump_dtl(vdev_t *vd, int indent) continue; (void) snprintf(prefix, sizeof (prefix), "\t%*s%s", indent + 2, "", name[t]); - mutex_enter(rt->rt_lock); range_tree_walk(rt, dump_dtl_seg, prefix); - mutex_exit(rt->rt_lock); if (dump_opt['d'] > 5 && vd->vdev_children == 0) dump_spacemap(spa->spa_meta_objset, vd->vdev_dtl_sm); } @@ -2107,9 +2229,16 @@ dump_dir(objset_t *os) if (dump_opt['i'] != 0 || verbosity >= 2) dump_intent_log(dmu_objset_zil(os)); - if (dmu_objset_ds(os) != NULL) - dump_deadlist(&dmu_objset_ds(os)->ds_deadlist); + if (dmu_objset_ds(os) != NULL) { + dsl_dataset_t *ds = dmu_objset_ds(os); + dump_deadlist(&ds->ds_deadlist); + if (dsl_dataset_remap_deadlist_exists(ds)) { + (void) printf("ds_remap_deadlist:\n"); + dump_deadlist(&ds->ds_remap_deadlist); + } + } + if (verbosity < 2) return; @@ -2452,6 +2581,7 @@ dump_label(const char *dev) } static uint64_t dataset_feature_count[SPA_FEATURES]; +static uint64_t remap_deadlist_count = 0; /*ARGSUSED*/ static int @@ -2472,6 +2602,10 @@ dump_one_dir(const char *dsname, void *arg) dataset_feature_count[f]++; } + if (dsl_dataset_remap_deadlist_exists(dmu_objset_ds(os))) { + remap_deadlist_count++; + } + dump_dir(os); close_objset(os, FTAG); fuid_table_destroy(); @@ -2511,6 +2645,7 @@ static const char *zdb_ot_extname[] = { typedef struct zdb_cb { zdb_blkstats_t zcb_type[ZB_TOTAL + 1][ZDB_OT_TOTAL + 1]; + uint64_t zcb_removing_size; uint64_t zcb_dedup_asize; uint64_t zcb_dedup_blocks; uint64_t zcb_embedded_blocks[NUM_BP_EMBEDDED_TYPES]; @@ -2523,6 +2658,7 @@ typedef struct zdb_cb { int zcb_readfails; int zcb_haderrors; spa_t *zcb_spa; + uint32_t **zcb_vd_obsolete_counts; } zdb_cb_t; static void @@ -2797,12 +2933,208 @@ zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) ASSERT(error == ENOENT); } +/* ARGSUSED */ static void +claim_segment_impl_cb(uint64_t inner_offset, vdev_t *vd, uint64_t offset, + uint64_t size, void *arg) +{ + /* + * This callback was called through a remap from + * a device being removed. Therefore, the vdev that + * this callback is applied to is a concrete + * vdev. + */ + ASSERT(vdev_is_concrete(vd)); + + VERIFY0(metaslab_claim_impl(vd, offset, size, + spa_first_txg(vd->vdev_spa))); +} + +static void +claim_segment_cb(void *arg, uint64_t offset, uint64_t size) +{ + vdev_t *vd = arg; + + vdev_indirect_ops.vdev_op_remap(vd, offset, size, + claim_segment_impl_cb, NULL); +} + +/* + * After accounting for all allocated blocks that are directly referenced, + * we might have missed a reference to a block from a partially complete + * (and thus unused) indirect mapping object. We perform a secondary pass + * through the metaslabs we have already mapped and claim the destination + * blocks. + */ +static void +zdb_claim_removing(spa_t *spa, zdb_cb_t *zcb) +{ + if (spa->spa_vdev_removal == NULL) + return; + + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); + + spa_vdev_removal_t *svr = spa->spa_vdev_removal; + vdev_t *vd = svr->svr_vdev; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + + for (uint64_t msi = 0; msi < vd->vdev_ms_count; msi++) { + metaslab_t *msp = vd->vdev_ms[msi]; + + if (msp->ms_start >= vdev_indirect_mapping_max_offset(vim)) + break; + + ASSERT0(range_tree_space(svr->svr_allocd_segs)); + + if (msp->ms_sm != NULL) { + VERIFY0(space_map_load(msp->ms_sm, + svr->svr_allocd_segs, SM_ALLOC)); + + /* + * Clear everything past what has been synced, + * because we have not allocated mappings for it yet. + */ + range_tree_clear(svr->svr_allocd_segs, + vdev_indirect_mapping_max_offset(vim), + msp->ms_sm->sm_start + msp->ms_sm->sm_size - + vdev_indirect_mapping_max_offset(vim)); + } + + zcb->zcb_removing_size += + range_tree_space(svr->svr_allocd_segs); + range_tree_vacate(svr->svr_allocd_segs, claim_segment_cb, vd); + } + + spa_config_exit(spa, SCL_CONFIG, FTAG); +} + +/* + * vm_idxp is an in-out parameter which (for indirect vdevs) is the + * index in vim_entries that has the first entry in this metaslab. On + * return, it will be set to the first entry after this metaslab. + */ +static void +zdb_leak_init_ms(metaslab_t *msp, uint64_t *vim_idxp) +{ + metaslab_group_t *mg = msp->ms_group; + vdev_t *vd = mg->mg_vd; + vdev_t *rvd = vd->vdev_spa->spa_root_vdev; + + mutex_enter(&msp->ms_lock); + metaslab_unload(msp); + + /* + * We don't want to spend the CPU manipulating the size-ordered + * tree, so clear the range_tree ops. + */ + msp->ms_tree->rt_ops = NULL; + + (void) fprintf(stderr, + "\rloading vdev %llu of %llu, metaslab %llu of %llu ...", + (longlong_t)vd->vdev_id, + (longlong_t)rvd->vdev_children, + (longlong_t)msp->ms_id, + (longlong_t)vd->vdev_ms_count); + + /* + * For leak detection, we overload the metaslab ms_tree to + * contain allocated segments instead of free segments. As a + * result, we can't use the normal metaslab_load/unload + * interfaces. + */ + if (vd->vdev_ops == &vdev_indirect_ops) { + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + for (; *vim_idxp < vdev_indirect_mapping_num_entries(vim); + (*vim_idxp)++) { + vdev_indirect_mapping_entry_phys_t *vimep = + &vim->vim_entries[*vim_idxp]; + uint64_t ent_offset = DVA_MAPPING_GET_SRC_OFFSET(vimep); + uint64_t ent_len = DVA_GET_ASIZE(&vimep->vimep_dst); + ASSERT3U(ent_offset, >=, msp->ms_start); + if (ent_offset >= msp->ms_start + msp->ms_size) + break; + + /* + * Mappings do not cross metaslab boundaries, + * because we create them by walking the metaslabs. + */ + ASSERT3U(ent_offset + ent_len, <=, + msp->ms_start + msp->ms_size); + range_tree_add(msp->ms_tree, ent_offset, ent_len); + } + } else if (msp->ms_sm != NULL) { + VERIFY0(space_map_load(msp->ms_sm, msp->ms_tree, SM_ALLOC)); + } + + if (!msp->ms_loaded) { + msp->ms_loaded = B_TRUE; + } + mutex_exit(&msp->ms_lock); +} + +/* ARGSUSED */ +static int +increment_indirect_mapping_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) +{ + zdb_cb_t *zcb = arg; + spa_t *spa = zcb->zcb_spa; + vdev_t *vd; + const dva_t *dva = &bp->blk_dva[0]; + + ASSERT(!dump_opt['L']); + ASSERT3U(BP_GET_NDVAS(bp), ==, 1); + + spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); + vd = vdev_lookup_top(zcb->zcb_spa, DVA_GET_VDEV(dva)); + ASSERT3P(vd, !=, NULL); + spa_config_exit(spa, SCL_VDEV, FTAG); + + ASSERT(vd->vdev_indirect_config.vic_mapping_object != 0); + ASSERT3P(zcb->zcb_vd_obsolete_counts[vd->vdev_id], !=, NULL); + + vdev_indirect_mapping_increment_obsolete_count( + vd->vdev_indirect_mapping, + DVA_GET_OFFSET(dva), DVA_GET_ASIZE(dva), + zcb->zcb_vd_obsolete_counts[vd->vdev_id]); + + return (0); +} + +static uint32_t * +zdb_load_obsolete_counts(vdev_t *vd) +{ + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + spa_t *spa = vd->vdev_spa; + spa_condensing_indirect_phys_t *scip = + &spa->spa_condensing_indirect_phys; + uint32_t *counts; + + EQUIV(vdev_obsolete_sm_object(vd) != 0, vd->vdev_obsolete_sm != NULL); + counts = vdev_indirect_mapping_load_obsolete_counts(vim); + if (vd->vdev_obsolete_sm != NULL) { + vdev_indirect_mapping_load_obsolete_spacemap(vim, counts, + vd->vdev_obsolete_sm); + } + if (scip->scip_vdev == vd->vdev_id && + scip->scip_prev_obsolete_sm_object != 0) { + space_map_t *prev_obsolete_sm = NULL; + VERIFY0(space_map_open(&prev_obsolete_sm, spa->spa_meta_objset, + scip->scip_prev_obsolete_sm_object, 0, vd->vdev_asize, 0)); + space_map_update(prev_obsolete_sm); + vdev_indirect_mapping_load_obsolete_spacemap(vim, counts, + prev_obsolete_sm); + space_map_close(prev_obsolete_sm); + } + return (counts); +} + +static void zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) { zcb->zcb_spa = spa; if (!dump_opt['L']) { + dsl_pool_t *dp = spa->spa_dsl_pool; vdev_t *rvd = spa->spa_root_vdev; /* @@ -2813,50 +3145,51 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) spa->spa_normal_class->mc_ops = &zdb_metaslab_ops; spa->spa_log_class->mc_ops = &zdb_metaslab_ops; + zcb->zcb_vd_obsolete_counts = + umem_zalloc(rvd->vdev_children * sizeof (uint32_t *), + UMEM_NOFAIL); + + for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; - metaslab_group_t *mg = vd->vdev_mg; - for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { - metaslab_t *msp = vd->vdev_ms[m]; - ASSERT3P(msp->ms_group, ==, mg); - mutex_enter(&msp->ms_lock); - metaslab_unload(msp); + uint64_t vim_idx = 0; + ASSERT3U(c, ==, vd->vdev_id); + + /* + * Note: we don't check for mapping leaks on + * removing vdevs because their ms_tree's are + * used to look for leaks in allocated space. + */ + if (vd->vdev_ops == &vdev_indirect_ops) { + zcb->zcb_vd_obsolete_counts[c] = + zdb_load_obsolete_counts(vd); + /* - * For leak detection, we overload the metaslab - * ms_tree to contain allocated segments - * instead of free segments. As a result, - * we can't use the normal metaslab_load/unload - * interfaces. + * Normally, indirect vdevs don't have any + * metaslabs. We want to set them up for + * zio_claim(). */ - if (msp->ms_sm != NULL) { - (void) fprintf(stderr, - "\rloading space map for " - "vdev %llu of %llu, " - "metaslab %llu of %llu ...", - (longlong_t)c, - (longlong_t)rvd->vdev_children, - (longlong_t)m, - (longlong_t)vd->vdev_ms_count); + VERIFY0(vdev_metaslab_init(vd, 0)); + } - /* - * We don't want to spend the CPU - * manipulating the size-ordered - * tree, so clear the range_tree - * ops. - */ - msp->ms_tree->rt_ops = NULL; - VERIFY0(space_map_load(msp->ms_sm, - msp->ms_tree, SM_ALLOC)); - - if (!msp->ms_loaded) { - msp->ms_loaded = B_TRUE; - } - } - mutex_exit(&msp->ms_lock); + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { + zdb_leak_init_ms(vd->vdev_ms[m], &vim_idx); } + if (vd->vdev_ops == &vdev_indirect_ops) { + ASSERT3U(vim_idx, ==, + vdev_indirect_mapping_num_entries( + vd->vdev_indirect_mapping)); + } } (void) fprintf(stderr, "\n"); + + if (bpobj_is_open(&dp->dp_obsolete_bpobj)) { + ASSERT(spa_feature_is_enabled(spa, + SPA_FEATURE_DEVICE_REMOVAL)); + (void) bpobj_iterate_nofree(&dp->dp_obsolete_bpobj, + increment_indirect_mapping_cb, zcb, NULL); + } } spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); @@ -2866,18 +3199,93 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) spa_config_exit(spa, SCL_CONFIG, FTAG); } -static void -zdb_leak_fini(spa_t *spa) +static boolean_t +zdb_check_for_obsolete_leaks(vdev_t *vd, zdb_cb_t *zcb) { + boolean_t leaks = B_FALSE; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + uint64_t total_leaked = 0; + + ASSERT(vim != NULL); + + for (uint64_t i = 0; i < vdev_indirect_mapping_num_entries(vim); i++) { + vdev_indirect_mapping_entry_phys_t *vimep = + &vim->vim_entries[i]; + uint64_t obsolete_bytes = 0; + uint64_t offset = DVA_MAPPING_GET_SRC_OFFSET(vimep); + metaslab_t *msp = vd->vdev_ms[offset >> vd->vdev_ms_shift]; + + /* + * This is not very efficient but it's easy to + * verify correctness. + */ + for (uint64_t inner_offset = 0; + inner_offset < DVA_GET_ASIZE(&vimep->vimep_dst); + inner_offset += 1 << vd->vdev_ashift) { + if (range_tree_contains(msp->ms_tree, + offset + inner_offset, 1 << vd->vdev_ashift)) { + obsolete_bytes += 1 << vd->vdev_ashift; + } + } + + int64_t bytes_leaked = obsolete_bytes - + zcb->zcb_vd_obsolete_counts[vd->vdev_id][i]; + ASSERT3U(DVA_GET_ASIZE(&vimep->vimep_dst), >=, + zcb->zcb_vd_obsolete_counts[vd->vdev_id][i]); + if (bytes_leaked != 0 && + (vdev_obsolete_counts_are_precise(vd) || + dump_opt['d'] >= 5)) { + (void) printf("obsolete indirect mapping count " + "mismatch on %llu:%llx:%llx : %llx bytes leaked\n", + (u_longlong_t)vd->vdev_id, + (u_longlong_t)DVA_MAPPING_GET_SRC_OFFSET(vimep), + (u_longlong_t)DVA_GET_ASIZE(&vimep->vimep_dst), + (u_longlong_t)bytes_leaked); + } + total_leaked += ABS(bytes_leaked); + } + + if (!vdev_obsolete_counts_are_precise(vd) && total_leaked > 0) { + int pct_leaked = total_leaked * 100 / + vdev_indirect_mapping_bytes_mapped(vim); + (void) printf("cannot verify obsolete indirect mapping " + "counts of vdev %llu because precise feature was not " + "enabled when it was removed: %d%% (%llx bytes) of mapping" + "unreferenced\n", + (u_longlong_t)vd->vdev_id, pct_leaked, + (u_longlong_t)total_leaked); + } else if (total_leaked > 0) { + (void) printf("obsolete indirect mapping count mismatch " + "for vdev %llu -- %llx total bytes mismatched\n", + (u_longlong_t)vd->vdev_id, + (u_longlong_t)total_leaked); + leaks |= B_TRUE; + } + + vdev_indirect_mapping_free_obsolete_counts(vim, + zcb->zcb_vd_obsolete_counts[vd->vdev_id]); + zcb->zcb_vd_obsolete_counts[vd->vdev_id] = NULL; + + return (leaks); +} + +static boolean_t +zdb_leak_fini(spa_t *spa, zdb_cb_t *zcb) +{ + boolean_t leaks = B_FALSE; if (!dump_opt['L']) { vdev_t *rvd = spa->spa_root_vdev; for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; metaslab_group_t *mg = vd->vdev_mg; - for (unsigned m = 0; m < vd->vdev_ms_count; m++) { + + if (zcb->zcb_vd_obsolete_counts[c] != NULL) { + leaks |= zdb_check_for_obsolete_leaks(vd, zcb); + } + + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; ASSERT3P(mg, ==, msp->ms_group); - mutex_enter(&msp->ms_lock); /* * The ms_tree has been overloaded to @@ -2887,18 +3295,30 @@ zdb_leak_fini(spa_t *spa) * represents an allocated block that we * did not claim during the traversal. * Claimed blocks would have been removed - * from the ms_tree. + * from the ms_tree. For indirect vdevs, + * space remaining in the tree represents + * parts of the mapping that are not + * referenced, which is not a bug. */ - range_tree_vacate(msp->ms_tree, zdb_leak, vd); + if (vd->vdev_ops == &vdev_indirect_ops) { + range_tree_vacate(msp->ms_tree, + NULL, NULL); + } else { + range_tree_vacate(msp->ms_tree, + zdb_leak, vd); + } if (msp->ms_loaded) { msp->ms_loaded = B_FALSE; } - - mutex_exit(&msp->ms_lock); } } + + umem_free(zcb->zcb_vd_obsolete_counts, + rvd->vdev_children * sizeof (uint32_t *)); + zcb->zcb_vd_obsolete_counts = NULL; } + return (leaks); } /* ARGSUSED */ @@ -2949,10 +3369,14 @@ dump_block_stats(spa_t *spa) */ (void) bpobj_iterate_nofree(&spa->spa_deferred_bpobj, count_block_cb, &zcb, NULL); + if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, count_block_cb, &zcb, NULL); } + + zdb_claim_removing(spa, &zcb); + if (spa_feature_is_active(spa, SPA_FEATURE_ASYNC_DESTROY)) { VERIFY3U(0, ==, bptree_iterate(spa->spa_meta_objset, spa->spa_dsl_pool->dp_bptree_obj, B_FALSE, count_block_cb, @@ -2994,7 +3418,7 @@ dump_block_stats(spa_t *spa) /* * Report any leaked segments. */ - zdb_leak_fini(spa); + leaks |= zdb_leak_fini(spa, &zcb); tzb = &zcb.zcb_type[ZB_TOTAL][ZDB_OT_TOTAL]; @@ -3002,7 +3426,8 @@ dump_block_stats(spa_t *spa) norm_space = metaslab_class_get_space(spa_normal_class(spa)); total_alloc = norm_alloc + metaslab_class_get_alloc(spa_log_class(spa)); - total_found = tzb->zb_asize - zcb.zcb_dedup_asize; + total_found = tzb->zb_asize - zcb.zcb_dedup_asize + + zcb.zcb_removing_size; if (total_found == total_alloc) { if (!dump_opt['L']) @@ -3069,6 +3494,24 @@ dump_block_stats(spa_t *spa) (longlong_t)tzb->zb_ditto_samevdev); } + for (uint64_t v = 0; v < spa->spa_root_vdev->vdev_children; v++) { + vdev_t *vd = spa->spa_root_vdev->vdev_child[v]; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + + if (vim == NULL) { + continue; + } + + char mem[32]; + zdb_nicenum(vdev_indirect_mapping_num_entries(vim), + mem, vdev_indirect_mapping_size(vim)); + + (void) printf("\tindirect vdev id %llu has %llu segments " + "(%s in memory)\n", + (longlong_t)vd->vdev_id, + (longlong_t)vdev_indirect_mapping_num_entries(vim), mem); + } + if (dump_opt['b'] >= 2) { int l, t, level; (void) printf("\nBlocks\tLSIZE\tPSIZE\tASIZE" @@ -3275,6 +3718,124 @@ dump_simulated_ddt(spa_t *spa) dump_dedup_ratio(&dds_total); } +static int +verify_device_removal_feature_counts(spa_t *spa) +{ + uint64_t dr_feature_refcount = 0; + uint64_t oc_feature_refcount = 0; + uint64_t indirect_vdev_count = 0; + uint64_t precise_vdev_count = 0; + uint64_t obsolete_counts_object_count = 0; + uint64_t obsolete_sm_count = 0; + uint64_t obsolete_counts_count = 0; + uint64_t scip_count = 0; + uint64_t obsolete_bpobj_count = 0; + int ret = 0; + + spa_condensing_indirect_phys_t *scip = + &spa->spa_condensing_indirect_phys; + if (scip->scip_next_mapping_object != 0) { + vdev_t *vd = spa->spa_root_vdev->vdev_child[scip->scip_vdev]; + ASSERT(scip->scip_prev_obsolete_sm_object != 0); + ASSERT3P(vd->vdev_ops, ==, &vdev_indirect_ops); + + (void) printf("Condensing indirect vdev %llu: new mapping " + "object %llu, prev obsolete sm %llu\n", + (u_longlong_t)scip->scip_vdev, + (u_longlong_t)scip->scip_next_mapping_object, + (u_longlong_t)scip->scip_prev_obsolete_sm_object); + if (scip->scip_prev_obsolete_sm_object != 0) { + space_map_t *prev_obsolete_sm = NULL; + VERIFY0(space_map_open(&prev_obsolete_sm, + spa->spa_meta_objset, + scip->scip_prev_obsolete_sm_object, + 0, vd->vdev_asize, 0)); + space_map_update(prev_obsolete_sm); + dump_spacemap(spa->spa_meta_objset, prev_obsolete_sm); + (void) printf("\n"); + space_map_close(prev_obsolete_sm); + } + + scip_count += 2; + } + + for (uint64_t i = 0; i < spa->spa_root_vdev->vdev_children; i++) { + vdev_t *vd = spa->spa_root_vdev->vdev_child[i]; + vdev_indirect_config_t *vic = &vd->vdev_indirect_config; + + if (vic->vic_mapping_object != 0) { + ASSERT(vd->vdev_ops == &vdev_indirect_ops || + vd->vdev_removing); + indirect_vdev_count++; + + if (vd->vdev_indirect_mapping->vim_havecounts) { + obsolete_counts_count++; + } + } + if (vdev_obsolete_counts_are_precise(vd)) { + ASSERT(vic->vic_mapping_object != 0); + precise_vdev_count++; + } + if (vdev_obsolete_sm_object(vd) != 0) { + ASSERT(vic->vic_mapping_object != 0); + obsolete_sm_count++; + } + } + + (void) feature_get_refcount(spa, + &spa_feature_table[SPA_FEATURE_DEVICE_REMOVAL], + &dr_feature_refcount); + (void) feature_get_refcount(spa, + &spa_feature_table[SPA_FEATURE_OBSOLETE_COUNTS], + &oc_feature_refcount); + + if (dr_feature_refcount != indirect_vdev_count) { + ret = 1; + (void) printf("Number of indirect vdevs (%llu) " \ + "does not match feature count (%llu)\n", + (u_longlong_t)indirect_vdev_count, + (u_longlong_t)dr_feature_refcount); + } else { + (void) printf("Verified device_removal feature refcount " \ + "of %llu is correct\n", + (u_longlong_t)dr_feature_refcount); + } + + if (zap_contains(spa_meta_objset(spa), DMU_POOL_DIRECTORY_OBJECT, + DMU_POOL_OBSOLETE_BPOBJ) == 0) { + obsolete_bpobj_count++; + } + + + obsolete_counts_object_count = precise_vdev_count; + obsolete_counts_object_count += obsolete_sm_count; + obsolete_counts_object_count += obsolete_counts_count; + obsolete_counts_object_count += scip_count; + obsolete_counts_object_count += obsolete_bpobj_count; + obsolete_counts_object_count += remap_deadlist_count; + + if (oc_feature_refcount != obsolete_counts_object_count) { + ret = 1; + (void) printf("Number of obsolete counts objects (%llu) " \ + "does not match feature count (%llu)\n", + (u_longlong_t)obsolete_counts_object_count, + (u_longlong_t)oc_feature_refcount); + (void) printf("pv:%llu os:%llu oc:%llu sc:%llu " + "ob:%llu rd:%llu\n", + (u_longlong_t)precise_vdev_count, + (u_longlong_t)obsolete_sm_count, + (u_longlong_t)obsolete_counts_count, + (u_longlong_t)scip_count, + (u_longlong_t)obsolete_bpobj_count, + (u_longlong_t)remap_deadlist_count); + } else { + (void) printf("Verified indirect_refcount feature refcount " \ + "of %llu is correct\n", + (u_longlong_t)oc_feature_refcount); + } + return (ret); +} + static void dump_zpool(spa_t *spa) { @@ -3308,18 +3869,24 @@ dump_zpool(spa_t *spa) if (dump_opt['d'] || dump_opt['i']) { dump_dir(dp->dp_meta_objset); if (dump_opt['d'] >= 3) { + dsl_pool_t *dp = spa->spa_dsl_pool; dump_full_bpobj(&spa->spa_deferred_bpobj, "Deferred frees", 0); if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { - dump_full_bpobj( - &spa->spa_dsl_pool->dp_free_bpobj, + dump_full_bpobj(&dp->dp_free_bpobj, "Pool snapshot frees", 0); } + if (bpobj_is_open(&dp->dp_obsolete_bpobj)) { + ASSERT(spa_feature_is_enabled(spa, + SPA_FEATURE_DEVICE_REMOVAL)); + dump_full_bpobj(&dp->dp_obsolete_bpobj, + "Pool obsolete blocks", 0); + } if (spa_feature_is_active(spa, SPA_FEATURE_ASYNC_DESTROY)) { dump_bptree(spa->spa_meta_objset, - spa->spa_dsl_pool->dp_bptree_obj, + dp->dp_bptree_obj, "Pool dataset frees"); } dump_dtl(spa->spa_root_vdev, 0); @@ -3351,6 +3918,10 @@ dump_zpool(spa_t *spa) (longlong_t)refcount); } } + + if (rc == 0) { + rc = verify_device_removal_feature_counts(spa); + } } if (rc == 0 && (dump_opt['b'] || dump_opt['c'])) rc = dump_block_stats(spa); @@ -3570,6 +4141,7 @@ zdb_read_block(char *thing, spa_t *spa) s = "offset must be a multiple of sector size"; if (s) { (void) printf("Invalid block specifier: %s - %s\n", thing, s); + free(flagstr); free(dup); return; } @@ -3595,6 +4167,7 @@ zdb_read_block(char *thing, spa_t *spa) blkptr_offset = strtoull(p, &p, 16); if (*p != ':' && *p != '\0') { (void) printf("***Invalid flag arg: '%s'\n", s); + free(flagstr); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@freebsd.org Sat Feb 24 02:08:19 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8700AF097FD for ; Sat, 24 Feb 2018 02:08:19 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 35A2A8645E; Sat, 24 Feb 2018 02:08:19 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3089D1EEAD; Sat, 24 Feb 2018 02:08:19 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O28J0L021776; Sat, 24 Feb 2018 02:08:19 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O28I6k021771; Sat, 24 Feb 2018 02:08:18 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802240208.w1O28I6k021771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 24 Feb 2018 02:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329893 - user/jeff/numa/sys/vm X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: user/jeff/numa/sys/vm X-SVN-Commit-Revision: 329893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 02:08:19 -0000 Author: jeff Date: Sat Feb 24 02:08:18 2018 New Revision: 329893 URL: https://svnweb.freebsd.org/changeset/base/329893 Log: Protect pageout wakeup with atomics and a new lock. Protect free_count with atomics and move it out from under the free lock. Only wakeup pageout on transitions to low states. Only set and clear bits from threads making transitions across count thresholds. Modified: user/jeff/numa/sys/vm/vm_page.c user/jeff/numa/sys/vm/vm_pageout.c user/jeff/numa/sys/vm/vm_pagequeue.h user/jeff/numa/sys/vm/vm_reserv.c Modified: user/jeff/numa/sys/vm/vm_page.c ============================================================================== --- user/jeff/numa/sys/vm/vm_page.c Sat Feb 24 01:58:53 2018 (r329892) +++ user/jeff/numa/sys/vm/vm_page.c Sat Feb 24 02:08:18 2018 (r329893) @@ -146,6 +146,8 @@ extern int vmem_startup_count(void); struct vm_domain vm_dom[MAXMEMDOM]; struct mtx_padalign __exclusive_cache_line pa_lock[PA_LOCK_COUNT]; + +/* The following fields are protected by the domainset lock. */ struct mtx_padalign __exclusive_cache_line vm_domainset_lock; domainset_t __exclusive_cache_line vm_min_domains; domainset_t __exclusive_cache_line vm_severe_domains; @@ -153,7 +155,6 @@ static int vm_min_waiters; static int vm_severe_waiters; static int vm_pageproc_waiters; - /* * bogus page -- for I/O to/from partially complete buffers, * or for paging into sparsely invalid regions. @@ -191,7 +192,6 @@ static void vm_page_insert_radixdone(vm_page_t m, vm_o vm_page_t mpred); static int vm_page_reclaim_run(int req_class, int domain, u_long npages, vm_page_t m_run, vm_paddr_t high); -static void vm_domain_free_wakeup(struct vm_domain *); static int vm_domain_alloc_fail(struct vm_domain *vmd, vm_object_t object, int req); static int vm_page_import(void *arg, void **store, int cnt, int domain, @@ -476,6 +476,7 @@ vm_page_domain_init(int domain) } } mtx_init(&vmd->vmd_free_mtx, "vm page free queue", NULL, MTX_DEF); + mtx_init(&vmd->vmd_pageout_mtx, "vm pageout lock", NULL, MTX_DEF); snprintf(vmd->vmd_name, sizeof(vmd->vmd_name), "%d", domain); } @@ -777,8 +778,8 @@ vm_page_startup(vm_offset_t vaddr) vmd = VM_DOMAIN(seg->domain); vm_domain_free_lock(vmd); vm_phys_free_contig(m, pagecount); - vm_domain_freecnt_adj(vmd, (int)pagecount); vm_domain_free_unlock(vmd); + vm_domain_freecnt_inc(vmd, (int)pagecount); vm_cnt.v_page_count += (u_int)pagecount; vmd = VM_DOMAIN(seg->domain);; @@ -1740,7 +1741,6 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind struct vm_domain *vmd; vm_page_t m; int flags; - u_int free_count; KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) && (object != NULL || (req & VM_ALLOC_SBUSY) == 0) && @@ -1799,6 +1799,9 @@ again: #endif } } + if (m != NULL) + vm_domain_freecnt_dec(vmd, 1); + vm_domain_free_unlock(vmd); if (m == NULL) { /* * Not allocatable, give up. @@ -1812,15 +1815,7 @@ again: * At this point we had better have found a good page. */ KASSERT(m != NULL, ("missing page")); - free_count = vm_domain_freecnt_adj(vmd, -1); - vm_domain_free_unlock(vmd); - /* - * Don't wakeup too often - wakeup the pageout daemon when - * we would be nearly out of memory. - */ - if (vm_paging_needed(vmd, free_count)) - pagedaemon_wakeup(vmd->vmd_domain); found: vm_page_alloc_check(m); @@ -1854,7 +1849,6 @@ found: if (object != NULL) { if (vm_page_insert_after(m, object, pindex, mpred)) { - pagedaemon_wakeup(domain); if (req & VM_ALLOC_WIRED) { vm_wire_sub(1); m->wire_count = 0; @@ -2011,13 +2005,14 @@ retry: goto retry; #endif } + if (m_ret != NULL) + vm_domain_freecnt_dec(vmd, npages); + vm_domain_free_unlock(vmd); if (m_ret == NULL) { if (vm_domain_alloc_fail(vmd, object, req)) goto again; return (NULL); } - vm_domain_freecnt_adj(vmd, -npages); - vm_domain_free_unlock(vmd); #if VM_NRESERVLEVEL > 0 found: #endif @@ -2056,7 +2051,6 @@ found: m->oflags = oflags; if (object != NULL) { if (vm_page_insert_after(m, object, pindex, mpred)) { - pagedaemon_wakeup(domain); if ((req & VM_ALLOC_WIRED) != 0) vm_wire_sub(npages); KASSERT(m->object == NULL, @@ -2085,9 +2079,6 @@ found: pmap_page_set_memattr(m, memattr); pindex++; } - vmd = VM_DOMAIN(domain); - if (vm_paging_needed(vmd, vmd->vmd_free_count)) - pagedaemon_wakeup(domain); return (m_ret); } @@ -2150,7 +2141,7 @@ vm_page_alloc_freelist_domain(int domain, int freelist { struct vm_domain *vmd; vm_page_t m; - u_int flags, free_count; + u_int flags; /* * Do not allocate reserved pages unless the req has asked for it. @@ -2161,13 +2152,14 @@ again: if (vm_domain_available(vmd, req, 1)) m = vm_phys_alloc_freelist_pages(domain, freelist, VM_FREEPOOL_DIRECT, 0); + if (m != NULL) + vm_domain_freecnt_dec(vmd, 1); + vm_domain_free_unlock(vmd); if (m == NULL) { if (vm_domain_alloc_fail(vmd, NULL, req)) goto again; return (NULL); } - free_count = vm_domain_freecnt_adj(vmd, -1); - vm_domain_free_unlock(vmd); vm_page_alloc_check(m); /* @@ -2188,8 +2180,6 @@ again: } /* Unmanaged pages don't use "act_count". */ m->oflags = VPO_UNMANAGED; - if (vm_paging_needed(vmd, free_count)) - pagedaemon_wakeup(domain); return (m); } @@ -2215,7 +2205,7 @@ vm_page_import(void *arg, void **store, int cnt, int d store[i+j] = m++; } if (i != 0) - vm_domain_freecnt_adj(vmd, -i); + vm_domain_freecnt_dec(vmd, i); vm_domain_free_unlock(vmd); return (i); @@ -2238,9 +2228,8 @@ vm_page_release(void *arg, void **store, int cnt) #endif vm_phys_free_pages(m, 0); } - vm_domain_freecnt_adj(vmd, i); - vm_domain_free_wakeup(vmd); vm_domain_free_unlock(vmd); + vm_domain_freecnt_inc(vmd, i); } #define VPSC_ANY 0 /* No restrictions. */ @@ -2639,15 +2628,19 @@ unlock: if (m_mtx != NULL) mtx_unlock(m_mtx); if ((m = SLIST_FIRST(&free)) != NULL) { + int cnt; + + cnt = 0; vmd = VM_DOMAIN(domain); vm_domain_free_lock(vmd); do { MPASS(vm_phys_domain(m) == domain); SLIST_REMOVE_HEAD(&free, plinks.s.ss); vm_page_free_phys(vmd, m); + cnt++; } while ((m = SLIST_FIRST(&free)) != NULL); - vm_domain_free_wakeup(vmd); vm_domain_free_unlock(vmd); + vm_domain_freecnt_inc(vmd, cnt); } return (error); } @@ -2810,7 +2803,7 @@ vm_domain_set(struct vm_domain *vmd) /* * Clear the domain from the appropriate page level domainset. */ -static void +void vm_domain_clear(struct vm_domain *vmd) { @@ -2831,6 +2824,21 @@ vm_domain_clear(struct vm_domain *vmd) wakeup(&vm_severe_domains); } } + /* + * if pageout daemon needs pages, then tell it that there are + * some free. + */ + if (vmd->vmd_pageout_pages_needed && + vmd->vmd_free_count >= vmd->vmd_pageout_free_min) { + wakeup(&vmd->vmd_pageout_pages_needed); + vmd->vmd_pageout_pages_needed = 0; + } + + /* See comments in vm_wait(); */ + if (vm_pageproc_waiters) { + vm_pageproc_waiters = 0; + wakeup(&vm_pageproc_waiters); + } mtx_unlock(&vm_domainset_lock); } @@ -2869,7 +2877,7 @@ u_int vm_wait_count(void) { - return (vm_severe_waiters + vm_min_waiters); + return (vm_severe_waiters + vm_min_waiters + vm_pageproc_waiters); } static void @@ -2887,9 +2895,8 @@ vm_wait_doms(const domainset_t *wdoms) if (curproc == pageproc) { mtx_lock(&vm_domainset_lock); vm_pageproc_waiters++; - msleep(&vm_pageproc_waiters, &vm_domainset_lock, PVM, + msleep(&vm_pageproc_waiters, &vm_domainset_lock, PVM | PDROP, "pageprocwait", 1); - mtx_unlock(&vm_domainset_lock); } else { /* * XXX Ideally we would wait only until the allocation could @@ -2919,14 +2926,17 @@ vm_wait_domain(int domain) domainset_t wdom; vmd = VM_DOMAIN(domain); - vm_domain_free_assert_locked(vmd); + vm_domain_free_assert_unlocked(vmd); if (curproc == pageproc) { - vmd->vmd_pageout_pages_needed = 1; - msleep(&vmd->vmd_pageout_pages_needed, - vm_domain_free_lockptr(vmd), PDROP | PSWP, "VMWait", 0); + mtx_lock(&vm_domainset_lock); + if (vmd->vmd_free_count < vmd->vmd_pageout_free_min) { + vmd->vmd_pageout_pages_needed = 1; + msleep(&vmd->vmd_pageout_pages_needed, + &vm_domainset_lock, PDROP | PSWP, "VMWait", 0); + } else + mtx_unlock(&vm_domainset_lock); } else { - vm_domain_free_unlock(vmd); if (pageproc == NULL) panic("vm_wait in early boot"); DOMAINSET_ZERO(&wdom); @@ -2976,7 +2986,7 @@ static int vm_domain_alloc_fail(struct vm_domain *vmd, vm_object_t object, int req) { - vm_domain_free_assert_locked(vmd); + vm_domain_free_assert_unlocked(vmd); atomic_add_int(&vmd->vmd_pageout_deficit, max((u_int)req >> VM_ALLOC_COUNT_SHIFT, 1)); @@ -2988,10 +2998,8 @@ vm_domain_alloc_fail(struct vm_domain *vmd, vm_object_ VM_OBJECT_WLOCK(object); if (req & VM_ALLOC_WAITOK) return (EAGAIN); - } else { - vm_domain_free_unlock(vmd); - pagedaemon_wakeup(vmd->vmd_domain); } + return (0); } @@ -3196,46 +3204,6 @@ vm_page_activate(vm_page_t m) } /* - * vm_domain_free_wakeup: - * - * Helper routine for vm_page_free_toq(). This routine is called - * when a page is added to the free queues. - * - * The page queues must be locked. - */ -static void -vm_domain_free_wakeup(struct vm_domain *vmd) -{ - - vm_domain_free_assert_locked(vmd); - - /* - * if pageout daemon needs pages, then tell it that there are - * some free. - */ - if (vmd->vmd_pageout_pages_needed && - vmd->vmd_free_count >= vmd->vmd_pageout_free_min) { - wakeup(&vmd->vmd_pageout_pages_needed); - vmd->vmd_pageout_pages_needed = 0; - } - /* - * wakeup processes that are waiting on memory if we hit a - * high water mark. And wakeup scheduler process if we have - * lots of memory. this process will swapin processes. - */ - if ((vmd->vmd_minset && !vm_paging_min(vmd)) || - (vmd->vmd_severeset && !vm_paging_severe(vmd))) - vm_domain_clear(vmd); - - /* See comments in vm_wait(); */ - if (vm_pageproc_waiters) { - vm_pageproc_waiters = 0; - wakeup(&vm_pageproc_waiters); - } - -} - -/* * vm_page_free_prep: * * Prepares the given page to be put on the free list, @@ -3316,7 +3284,8 @@ vm_page_free_prep(vm_page_t m, bool pagequeue_locked) /* * Insert the page into the physical memory allocator's free page - * queues. This is the last step to free a page. + * queues. This is the last step to free a page. The caller is + * responsible for adjusting the free page count. */ static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m) @@ -3324,7 +3293,6 @@ vm_page_free_phys(struct vm_domain *vmd, vm_page_t m) vm_domain_free_assert_locked(vmd); - vm_domain_freecnt_adj(vmd, 1); #if VM_NRESERVLEVEL > 0 if (!vm_reserv_free_page(m)) #endif @@ -3336,24 +3304,28 @@ vm_page_free_phys_pglist(struct pglist *tq) { struct vm_domain *vmd; vm_page_t m; + int cnt; if (TAILQ_EMPTY(tq)) return; vmd = NULL; + cnt = 0; TAILQ_FOREACH(m, tq, listq) { if (vmd != vm_pagequeue_domain(m)) { if (vmd != NULL) { - vm_domain_free_wakeup(vmd); vm_domain_free_unlock(vmd); + vm_domain_freecnt_inc(vmd, cnt); + cnt = 0; } vmd = vm_pagequeue_domain(m); vm_domain_free_lock(vmd); } vm_page_free_phys(vmd, m); + cnt++; } if (vmd != NULL) { - vm_domain_free_wakeup(vmd); vm_domain_free_unlock(vmd); + vm_domain_freecnt_inc(vmd, cnt); } } @@ -3376,8 +3348,8 @@ vm_page_free_toq(vm_page_t m) vmd = vm_pagequeue_domain(m); vm_domain_free_lock(vmd); vm_page_free_phys(vmd, m); - vm_domain_free_wakeup(vmd); vm_domain_free_unlock(vmd); + vm_domain_freecnt_inc(vmd, 1); } /* Modified: user/jeff/numa/sys/vm/vm_pageout.c ============================================================================== --- user/jeff/numa/sys/vm/vm_pageout.c Sat Feb 24 01:58:53 2018 (r329892) +++ user/jeff/numa/sys/vm/vm_pageout.c Sat Feb 24 02:08:18 2018 (r329893) @@ -1897,7 +1897,13 @@ vm_pageout_worker(void *arg) * The pageout daemon worker is never done, so loop forever. */ while (TRUE) { - vm_domain_free_lock(vmd); + vm_domain_pageout_lock(vmd); + /* + * Wwe need to clear wanted before we check the limits. This + * prevents races with wakers who will check wanted after they + * reach the limit. + */ + atomic_store_int(&vmd->vmd_pageout_wanted, 0); /* * Might the page daemon need to run again? @@ -1908,7 +1914,7 @@ vm_pageout_worker(void *arg) * we have performed a level >= 1 (page reclamation) * scan, then sleep a bit and try again. */ - vm_domain_free_unlock(vmd); + vm_domain_pageout_unlock(vmd); if (pass > 1) pause("pwait", hz / VM_INACT_SCAN_RATE); } else { @@ -1916,12 +1922,18 @@ vm_pageout_worker(void *arg) * No, sleep until the next wakeup or until pages * need to have their reference stats updated. */ - vmd->vmd_pageout_wanted = false; if (mtx_sleep(&vmd->vmd_pageout_wanted, - vm_domain_free_lockptr(vmd), PDROP | PVM, + vm_domain_pageout_lockptr(vmd), PDROP | PVM, "psleep", hz / VM_INACT_SCAN_RATE) == 0) VM_CNT_INC(v_pdwakeups); } + /* Prevent spurior wakeups by ensuring that wanted is set. */ + atomic_store_int(&vmd->vmd_pageout_wanted, 1); + + /* + * Use the controller to calculate how many pages to free in + * this interval. + */ shortage = pidctrl_daemon(&vmd->vmd_pid, vmd->vmd_free_count); if (shortage && pass == 0) pass = 1; @@ -2093,10 +2105,14 @@ pagedaemon_wakeup(int domain) struct vm_domain *vmd; vmd = VM_DOMAIN(domain); - vm_domain_free_assert_unlocked(vmd); + vm_domain_pageout_assert_unlocked(vmd); + if (curthread->td_proc == pageproc) + return; - if (!vmd->vmd_pageout_wanted && curthread->td_proc != pageproc) { - vmd->vmd_pageout_wanted = true; + if (atomic_fetchadd_int(&vmd->vmd_pageout_wanted, 1) == 0) { + vm_domain_pageout_lock(vmd); + atomic_store_int(&vmd->vmd_pageout_wanted, 1); wakeup(&vmd->vmd_pageout_wanted); + vm_domain_pageout_unlock(vmd); } } Modified: user/jeff/numa/sys/vm/vm_pagequeue.h ============================================================================== --- user/jeff/numa/sys/vm/vm_pagequeue.h Sat Feb 24 01:58:53 2018 (r329892) +++ user/jeff/numa/sys/vm/vm_pagequeue.h Sat Feb 24 02:08:18 2018 (r329893) @@ -90,18 +90,32 @@ struct vm_pagequeue { struct sysctl_oid; +/* + * One vm_domain per-numa domain. Contains pagequeues, free page structures, + * and accounting. + * + * Lock Key: + * f vmd_free_mtx + * p vmd_pageout_mtx + * d vm_domainset_lock + * a atomic + * c const after boot + */ struct vm_domain { struct vm_pagequeue vmd_pagequeues[PQ_COUNT]; struct mtx_padalign vmd_free_mtx; - uma_zone_t vmd_pgcache; - struct vmem *vmd_kernel_arena; - u_int vmd_domain; /* Domain number. */ - u_int vmd_page_count; - long vmd_segs; /* bitmask of the segments */ + struct mtx_padalign vmd_pageout_mtx; + uma_zone_t vmd_pgcache; /* (c) per-domain page free cache. */ + struct vmem *vmd_kernel_arena; /* (c) per-domain kva arena. */ + u_int vmd_domain; /* (c) Domain number. */ + u_int vmd_page_count; /* (c) Total page count. */ + long vmd_segs; /* (c) bitmask of the segments */ + u_int __aligned(CACHE_LINE_SIZE) vmd_free_count; /* (a,f) free page count */ + u_int vmd_pageout_deficit; /* (a) Estimated number of pages deficit */ + uint8_t vmd_pad[CACHE_LINE_SIZE - (sizeof(u_int) * 2)]; - /* Paging control variables, locked by domain_free_mtx. */ + /* Paging control variables, used within single threaded page daemon. */ struct pidctrl vmd_pid; /* Pageout controller. */ - u_int vmd_free_count; boolean_t vmd_oom; int vmd_oom_seq; int vmd_last_active_scan; @@ -109,11 +123,10 @@ struct vm_domain { struct vm_page vmd_marker; /* marker for pagedaemon private use */ struct vm_page vmd_inacthead; /* marker for LRU-defeating insertions */ - int vmd_pageout_pages_needed; /* page daemon waiting for pages? */ - int vmd_pageout_deficit; /* Estimated number of pages deficit */ - bool vmd_pageout_wanted; /* pageout daemon wait channel */ - bool vmd_minset; /* Are we in vm_min_domains? */ - bool vmd_severeset; /* Are we in vm_severe_domains? */ + int vmd_pageout_wanted; /* (a, p) pageout daemon wait channel */ + int vmd_pageout_pages_needed; /* (d) page daemon waiting for pages? */ + bool vmd_minset; /* (d) Are we in vm_min_domains? */ + bool vmd_severeset; /* (d) Are we in vm_severe_domains? */ int vmd_inactq_scans; enum { VM_LAUNDRY_IDLE = 0, @@ -157,6 +170,17 @@ extern struct vm_domain vm_dom[MAXMEMDOM]; #define vm_domain_free_unlock(d) \ mtx_unlock(vm_domain_free_lockptr((d))) +#define vm_domain_pageout_lockptr(d) \ + (&(d)->vmd_pageout_mtx) +#define vm_domain_pageout_assert_locked(n) \ + mtx_assert(vm_domain_pageout_lockptr((n)), MA_OWNED) +#define vm_domain_pageout_assert_unlocked(n) \ + mtx_assert(vm_domain_pageout_lockptr((n)), MA_NOTOWNED) +#define vm_domain_pageout_lock(d) \ + mtx_lock(vm_domain_pageout_lockptr((d))) +#define vm_domain_pageout_unlock(d) \ + mtx_unlock(vm_domain_pageout_lockptr((d))) + static __inline void vm_pagequeue_cnt_add(struct vm_pagequeue *pq, int addend) { @@ -170,6 +194,7 @@ vm_pagequeue_cnt_add(struct vm_pagequeue *pq, int adde #define vm_pagequeue_cnt_dec(pq) vm_pagequeue_cnt_add((pq), -1) void vm_domain_set(struct vm_domain *vmd); +void vm_domain_clear(struct vm_domain *vmd); int vm_domain_available(struct vm_domain *vmd, int req, int npages); /* @@ -236,18 +261,39 @@ vm_laundry_target(struct vm_domain *vmd) return (vm_paging_target(vmd)); } -static inline u_int -vm_domain_freecnt_adj(struct vm_domain *vmd, int adj) +void pagedaemon_wakeup(int domain); + +static inline void +vm_domain_freecnt_inc(struct vm_domain *vmd, int adj) { - u_int ret; + u_int old, new; - vm_domain_free_assert_locked(vmd); - ret = vmd->vmd_free_count += adj; - if ((!vmd->vmd_minset && vm_paging_min(vmd)) || - (!vmd->vmd_severeset && vm_paging_severe(vmd))) - vm_domain_set(vmd); + old = atomic_fetchadd_int(&vmd->vmd_free_count, adj); + new = old + adj; + /* + * Only update bitsets on transitions. Notice we short-circuit the + * rest of the checks if we're above min already. + */ + if (old < vmd->vmd_free_min && (new >= vmd->vmd_free_min || + (old < vmd->vmd_free_severe && new >= vmd->vmd_free_severe) || + (old < vmd->vmd_pageout_free_min && + new >= vmd->vmd_pageout_free_min))) + vm_domain_clear(vmd); +} - return (ret); +static inline void +vm_domain_freecnt_dec(struct vm_domain *vmd, int adj) +{ + u_int old, new; + + old = atomic_fetchadd_int(&vmd->vmd_free_count, -adj); + new = old - adj; + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) + pagedaemon_wakeup(vmd->vmd_domain); + /* Only update bitsets on transitions. */ + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) + vm_domain_set(vmd); } Modified: user/jeff/numa/sys/vm/vm_reserv.c ============================================================================== --- user/jeff/numa/sys/vm/vm_reserv.c Sat Feb 24 01:58:53 2018 (r329892) +++ user/jeff/numa/sys/vm/vm_reserv.c Sat Feb 24 02:08:18 2018 (r329893) @@ -599,7 +599,7 @@ vm_reserv_extend_contig(int req, vm_object_t object, v } for (i = 0; i < npages; i++) vm_reserv_populate(rv, index + i); - vm_domain_freecnt_adj(vmd, -npages); + vm_domain_freecnt_dec(vmd, npages); out: vm_domain_free_unlock(vmd); return (m); @@ -792,7 +792,7 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde struct vm_domain *vmd; vm_page_t m, msucc; vm_reserv_t rv; - int index, free_count; + int index; VM_OBJECT_ASSERT_WLOCKED(object); @@ -825,13 +825,9 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde m = NULL; if (m != NULL) { vm_reserv_populate(rv, index); - free_count = vm_domain_freecnt_adj(vmd, -1); - } else - free_count = vmd->vmd_free_count; + vm_domain_freecnt_dec(vmd, 1); + } vm_domain_free_unlock(vmd); - - if (vm_paging_needed(vmd, free_count)) - pagedaemon_wakeup(domain); return (m); } From owner-svn-src-user@freebsd.org Sat Feb 24 02:52:41 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D997CF0D323 for ; Sat, 24 Feb 2018 02:52:40 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 883CC68022; Sat, 24 Feb 2018 02:52:40 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 830181F7AA; Sat, 24 Feb 2018 02:52:40 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O2qedD046653; Sat, 24 Feb 2018 02:52:40 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O2qeHk046648; Sat, 24 Feb 2018 02:52:40 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802240252.w1O2qeHk046648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 24 Feb 2018 02:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329894 - user/jeff/numa/sys/vm X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: user/jeff/numa/sys/vm X-SVN-Commit-Revision: 329894 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 02:52:41 -0000 Author: jeff Date: Sat Feb 24 02:52:39 2018 New Revision: 329894 URL: https://svnweb.freebsd.org/changeset/base/329894 Log: Fine grain lock reservations. This permits us to free to a reservation without the domain free lock held. It further reduces the scope of the free lock so that it now only protects the queues and allocation from the free count. Modified: user/jeff/numa/sys/vm/vm_kern.c user/jeff/numa/sys/vm/vm_page.c user/jeff/numa/sys/vm/vm_pageout.c user/jeff/numa/sys/vm/vm_reserv.c user/jeff/numa/sys/vm/vm_reserv.h Modified: user/jeff/numa/sys/vm/vm_kern.c ============================================================================== --- user/jeff/numa/sys/vm/vm_kern.c Sat Feb 24 02:08:18 2018 (r329893) +++ user/jeff/numa/sys/vm/vm_kern.c Sat Feb 24 02:52:39 2018 (r329894) @@ -519,7 +519,9 @@ _kmem_unback(vm_object_t object, vm_offset_t addr, vm_ for (; offset < end; offset += PAGE_SIZE, m = next) { next = vm_page_next(m); vm_page_unwire(m, PQ_NONE); + vm_page_lock(m); vm_page_free(m); + vm_page_unlock(m); } VM_OBJECT_WUNLOCK(object); Modified: user/jeff/numa/sys/vm/vm_page.c ============================================================================== --- user/jeff/numa/sys/vm/vm_page.c Sat Feb 24 02:08:18 2018 (r329893) +++ user/jeff/numa/sys/vm/vm_page.c Sat Feb 24 02:52:39 2018 (r329894) @@ -1758,9 +1758,12 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind again: m = NULL; #if VM_NRESERVLEVEL > 0 + /* + * Can we allocate the page from a reservation? + */ if (vm_object_reserv(object) && - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) - != NULL) { + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != NULL || + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) != NULL)) { domain = vm_phys_domain(m); vmd = VM_DOMAIN(domain); goto found; @@ -1776,32 +1779,18 @@ again: vm_domain_free_lock(vmd); if (vm_domain_available(vmd, req, 1)) { /* - * Can we allocate the page from a reservation? + * If not, allocate it from the free page queues. */ -#if VM_NRESERVLEVEL > 0 - if (!vm_object_reserv(object) || - (m = vm_reserv_alloc_page(object, pindex, - domain, mpred)) == NULL) -#endif - { - /* - * If not, allocate it from the free page queues. - */ - m = vm_phys_alloc_pages(domain, object != NULL ? - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); -#if VM_NRESERVLEVEL > 0 - if (m == NULL && vm_reserv_reclaim_inactive(domain)) { - m = vm_phys_alloc_pages(domain, - object != NULL ? - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, - 0); - } -#endif - } + m = vm_phys_alloc_pages(domain, object != NULL ? + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); + if (m != NULL) + vm_domain_freecnt_dec(vmd, 1); } - if (m != NULL) - vm_domain_freecnt_dec(vmd, 1); vm_domain_free_unlock(vmd); +#if VM_NRESERVLEVEL > 0 + if (m == NULL && vm_reserv_reclaim_inactive(domain)) + goto again; +#endif if (m == NULL) { /* * Not allocatable, give up. @@ -1973,9 +1962,14 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pin */ again: #if VM_NRESERVLEVEL > 0 + /* + * Can we allocate the pages from a reservation? + */ if (vm_object_reserv(object) && - (m_ret = vm_reserv_extend_contig(req, object, pindex, domain, - npages, low, high, alignment, boundary, mpred)) != NULL) { + ((m_ret = vm_reserv_extend_contig(req, object, pindex, domain, + npages, low, high, alignment, boundary, mpred)) != NULL || + (m_ret = vm_reserv_alloc_contig(req, object, pindex, domain, + npages, low, high, alignment, boundary, mpred)) != NULL)) { domain = vm_phys_domain(m_ret); vmd = VM_DOMAIN(domain); goto found; @@ -1986,28 +1980,20 @@ again: vm_domain_free_lock(vmd); if (vm_domain_available(vmd, req, npages)) { /* - * Can we allocate the pages from a reservation? + * allocate them from the free page queues. */ -#if VM_NRESERVLEVEL > 0 -retry: - if (!vm_object_reserv(object) || - (m_ret = vm_reserv_alloc_contig(object, pindex, domain, - npages, low, high, alignment, boundary, mpred)) == NULL) -#endif - /* - * If not, allocate them from the free page queues. - */ - m_ret = vm_phys_alloc_contig(domain, npages, low, high, - alignment, boundary); -#if VM_NRESERVLEVEL > 0 - if (m_ret == NULL && vm_reserv_reclaim_contig( - domain, npages, low, high, alignment, boundary)) - goto retry; -#endif + m_ret = vm_phys_alloc_contig(domain, npages, low, high, + alignment, boundary); + if (m_ret != NULL) + vm_domain_freecnt_dec(vmd, npages); } - if (m_ret != NULL) - vm_domain_freecnt_dec(vmd, npages); vm_domain_free_unlock(vmd); +#if VM_NRESERVLEVEL > 0 + if (m_ret == NULL && + vm_reserv_reclaim_contig(domain, npages, low, high, alignment, + boundary)) + goto again; +#endif if (m_ret == NULL) { if (vm_domain_alloc_fail(vmd, object, req)) goto again; @@ -2222,10 +2208,6 @@ vm_page_release(void *arg, void **store, int cnt) vm_domain_free_lock(vmd); for (i = 0; i < cnt; i++) { m = (vm_page_t)store[i]; -#if VM_NRESERVLEVEL > 0 - KASSERT(vm_reserv_free_page(m) == false, - ("vm_page_release: Cached page belonged to reservation.")); -#endif vm_phys_free_pages(m, 0); } vm_domain_free_unlock(vmd); @@ -2595,15 +2577,18 @@ retry: KASSERT(m->dirty == 0, ("page %p is dirty", m)); } - SLIST_INSERT_HEAD(&free, m, plinks.s.ss); +#if VM_NRESERVLEVEL > 0 + if (!vm_reserv_free_page(m)) +#endif + SLIST_INSERT_HEAD(&free, m, + plinks.s.ss); } else error = EBUSY; unlock: VM_OBJECT_WUNLOCK(object); } else { MPASS(vm_phys_domain(m) == domain); - vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); + vm_page_lock(m); order = m->order; if (order < VM_NFREEORDER) { /* @@ -2620,7 +2605,7 @@ unlock: else if (vm_reserv_is_page_free(m)) order = 0; #endif - vm_domain_free_unlock(vmd); + vm_page_unlock(m); if (order == VM_NFREEORDER) error = EINVAL; } @@ -3278,6 +3263,10 @@ vm_page_free_prep(vm_page_t m, bool pagequeue_locked) */ if (pmap_page_get_memattr(m) != VM_MEMATTR_DEFAULT) pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT); +#if VM_NRESERVLEVEL > 0 + if (vm_reserv_free_page(m)) + return (false); +#endif return (true); } Modified: user/jeff/numa/sys/vm/vm_pageout.c ============================================================================== --- user/jeff/numa/sys/vm/vm_pageout.c Sat Feb 24 02:08:18 2018 (r329893) +++ user/jeff/numa/sys/vm/vm_pageout.c Sat Feb 24 02:52:39 2018 (r329894) @@ -1107,16 +1107,14 @@ vm_pageout_pglist_init(struct pgo_pglist *pglist) pglist->count = 0; } -static bool +static void vm_pageout_pglist_append(struct pgo_pglist *pglist, vm_page_t m) { if (vm_page_free_prep(m, false)) { m->flags &= ~PG_ZERO; TAILQ_INSERT_TAIL(&pglist->pgl, m, listq); pglist->count++; - return (true); } - return (false); } static void @@ -1139,11 +1137,10 @@ vm_pageout_free_pages(struct pgo_pglist *pglist, vm_ob int pcount, count; pcount = MAX(object->iosize / PAGE_SIZE, 1); + mtx = vm_page_lockptr(m); count = 1; - if (pcount == 1 || vm_object_reserv(object)) { - vm_page_free(m); - vm_page_unlock(m); - VM_OBJECT_WUNLOCK(object); + if (pcount == 1) { + vm_pageout_pglist_append(pglist, m); goto out; } @@ -1153,7 +1150,6 @@ vm_pageout_free_pages(struct pgo_pglist *pglist, vm_ob p = pp); /* Free the original page so we don't validate it twice. */ - mtx = vm_page_lockptr(m); if (p == m) p = vm_page_next(m); vm_pageout_pglist_append(pglist, m); @@ -1184,13 +1180,13 @@ vm_pageout_free_pages(struct pgo_pglist *pglist, vm_ob if (m->dirty) continue; free_page: - if (vm_pageout_pglist_append(pglist, m)) - count++; + vm_pageout_pglist_append(pglist, m); + count++; } +out: mtx_unlock(mtx); VM_OBJECT_WUNLOCK(object); vm_pageout_pglist_flush(pglist, false); -out: VM_CNT_ADD(v_dfree, count); return (count); Modified: user/jeff/numa/sys/vm/vm_reserv.c ============================================================================== --- user/jeff/numa/sys/vm/vm_reserv.c Sat Feb 24 02:08:18 2018 (r329893) +++ user/jeff/numa/sys/vm/vm_reserv.c Sat Feb 24 02:52:39 2018 (r329894) @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -167,22 +169,35 @@ popmap_is_set(popmap_t popmap[], int i) * * A partially populated reservation can be broken and reclaimed at any time. * - * f - vm_domain_free_lock + * r - vm_reserv_lock + * d - vm_reserv_domain_lock * o - vm_reserv_object_lock * c - constant after boot */ struct vm_reserv { - TAILQ_ENTRY(vm_reserv) partpopq; /* (f) per-domain queue. */ - LIST_ENTRY(vm_reserv) objq; /* (o, f) object queue */ - vm_object_t object; /* (o, f) containing object */ - vm_pindex_t pindex; /* (o, f) offset in object */ + TAILQ_ENTRY(vm_reserv) partpopq; /* (d) per-domain queue. */ + LIST_ENTRY(vm_reserv) objq; /* (o, r) object queue */ + vm_object_t object; /* (o, r) containing object */ + vm_pindex_t pindex; /* (o, r) offset in object */ vm_page_t pages; /* (c) first page */ int domain; /* (c) NUMA domain. */ - int popcnt; /* (f) # of pages in use */ - char inpartpopq; /* (f) */ - popmap_t popmap[NPOPMAP]; /* (f) bit vector, used pages */ + int popcnt; /* (r) # of pages in use */ + char inpartpopq; /* (d) */ + popmap_t popmap[NPOPMAP]; /* (r) bit vector, used pages */ }; +#define vm_reserv_assert_locked(rv) vm_page_assert_locked((rv)->pages) +#define vm_reserv_lockptr(rv) vm_page_lockptr((rv)->pages) +#define vm_reserv_lock(rv) vm_page_lock((rv)->pages) +#define vm_reserv_trylock(rv) vm_page_trylock((rv)->pages) +#define vm_reserv_unlock(rv) vm_page_unlock((rv)->pages) + +static struct mtx_padalign vm_reserv_domain_locks[MAXMEMDOM]; + +#define vm_reserv_domain_lockptr(d) &vm_reserv_domain_locks[(d)] +#define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) +#define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) + /* * The reservation array * @@ -219,13 +234,13 @@ static TAILQ_HEAD(, vm_reserv) vm_rvq_partpop[MAXMEMDO static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD, 0, "Reservation Info"); -static long vm_reserv_broken; -SYSCTL_LONG(_vm_reserv, OID_AUTO, broken, CTLFLAG_RD, - &vm_reserv_broken, 0, "Cumulative number of broken reservations"); +static counter_u64_t vm_reserv_broken = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, broken, CTLFLAG_RD, + &vm_reserv_broken, "Cumulative number of broken reservations"); -static long vm_reserv_freed; -SYSCTL_LONG(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD, - &vm_reserv_freed, 0, "Cumulative number of freed reservations"); +static counter_u64_t vm_reserv_freed = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD, + &vm_reserv_freed, "Cumulative number of freed reservations"); static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS); @@ -237,9 +252,9 @@ static int sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_AR SYSCTL_OID(_vm_reserv, OID_AUTO, partpopq, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, sysctl_vm_reserv_partpopq, "A", "Partially populated reservation queues"); -static long vm_reserv_reclaimed; -SYSCTL_LONG(_vm_reserv, OID_AUTO, reclaimed, CTLFLAG_RD, - &vm_reserv_reclaimed, 0, "Cumulative number of reclaimed reservations"); +static counter_u64_t vm_reserv_reclaimed = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, reclaimed, CTLFLAG_RD, + &vm_reserv_reclaimed, "Cumulative number of reclaimed reservations"); /* * The object lock pool is used to synchronize the rvq. We can not use a @@ -314,12 +329,12 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) for (level = -1; level <= VM_NRESERVLEVEL - 2; level++) { counter = 0; unused_pages = 0; - vm_domain_free_lock(VM_DOMAIN(domain)); + vm_reserv_domain_lock(domain); TAILQ_FOREACH(rv, &vm_rvq_partpop[domain], partpopq) { counter++; unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } - vm_domain_free_unlock(VM_DOMAIN(domain)); + vm_reserv_domain_unlock(domain); sbuf_printf(&sbuf, "%6d, %7d, %6dK, %6d\n", domain, level, unused_pages * ((int)PAGE_SIZE / 1024), counter); @@ -338,6 +353,9 @@ vm_reserv_remove(vm_reserv_t rv) { vm_object_t object; + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); KASSERT(rv->object != NULL, ("vm_reserv_remove: reserv %p is free", rv)); KASSERT(!rv->inpartpopq, @@ -357,6 +375,11 @@ vm_reserv_insert(vm_reserv_t rv, vm_object_t object, v { int i; + vm_reserv_assert_locked(rv); + CTR6(KTR_VM, + "%s: rv %p(%p) object %p new %p popcnt %d", + __FUNCTION__, rv, rv->pages, rv->object, object, + rv->popcnt); KASSERT(rv->object == NULL, ("vm_reserv_insert: reserv %p isn't free", rv)); KASSERT(rv->popcnt == 0, @@ -378,14 +401,15 @@ vm_reserv_insert(vm_reserv_t rv, vm_object_t object, v * becomes zero, the reservation is destroyed. Additionally, moves the * reservation to the tail of the partially populated reservation queue if the * population count is non-zero. - * - * The free page queue lock must be held. */ static void vm_reserv_depopulate(vm_reserv_t rv, int index) { + struct vm_domain *vmd; - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); KASSERT(rv->object != NULL, ("vm_reserv_depopulate: reserv %p is free", rv)); KASSERT(popmap_is_set(rv->popmap, index), @@ -396,10 +420,7 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, ("vm_reserv_depopulate: reserv %p's domain is corrupted %d", rv, rv->domain)); - if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); - rv->inpartpopq = FALSE; - } else { + if (rv->popcnt == VM_LEVEL_0_NPAGES) { KASSERT(rv->pages->psind == 1, ("vm_reserv_depopulate: reserv %p is already demoted", rv)); @@ -407,14 +428,25 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) } popmap_clear(rv->popmap, index); rv->popcnt--; + vm_reserv_domain_lock(rv->domain); + if (rv->inpartpopq) { + TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + rv->inpartpopq = FALSE; + } + if (rv->popcnt != 0) { + rv->inpartpopq = TRUE; + TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + } + vm_reserv_domain_unlock(rv->domain); + vmd = VM_DOMAIN(rv->domain); if (rv->popcnt == 0) { vm_reserv_remove(rv); + vm_domain_free_lock(vmd); vm_phys_free_pages(rv->pages, VM_LEVEL_0_ORDER); - vm_reserv_freed++; - } else { - rv->inpartpopq = TRUE; - TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + vm_domain_free_unlock(vmd); + counter_u64_add(vm_reserv_freed, 1); } + vm_domain_freecnt_inc(vmd, 1); } /* @@ -423,8 +455,20 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) static __inline vm_reserv_t vm_reserv_from_page(vm_page_t m) { + vm_reserv_t rv; - return (&vm_reserv_array[VM_PAGE_TO_PHYS(m) >> VM_LEVEL_0_SHIFT]); + rv = &vm_reserv_array[VM_PAGE_TO_PHYS(m) >> VM_LEVEL_0_SHIFT]; +#if 0 + if (rv->pages == NULL) + panic("vm_reserv_from_page: Bad reservation %p page %p phys %p segind %d start %p end %p first page %p domain %d\n", + rv, m, (void *)m->phys_addr, m->segind, + (void *)vm_phys_segs[m->segind].start, + (void *)vm_phys_segs[m->segind].end, + vm_phys_segs[m->segind].first_page, + vm_phys_segs[m->segind].domain); +#endif + + return (rv); } /* @@ -485,7 +529,9 @@ static void vm_reserv_populate(vm_reserv_t rv, int index) { - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); KASSERT(rv->object != NULL, ("vm_reserv_populate: reserv %p is free", rv)); KASSERT(popmap_is_clear(rv->popmap, index), @@ -498,17 +544,23 @@ vm_reserv_populate(vm_reserv_t rv, int index) KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, ("vm_reserv_populate: reserv %p's domain is corrupted %d", rv, rv->domain)); + popmap_set(rv->popmap, index); + rv->popcnt++; + vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); rv->inpartpopq = FALSE; } - popmap_set(rv->popmap, index); - rv->popcnt++; if (rv->popcnt < VM_LEVEL_0_NPAGES) { rv->inpartpopq = TRUE; TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); - } else + } else { + KASSERT(rv->pages->psind == 0, + ("vm_reserv_populate: reserv %p is already promoted", + rv)); rv->pages->psind = 1; + } + vm_reserv_domain_unlock(rv->domain); } /* @@ -578,31 +630,34 @@ vm_reserv_extend_contig(int req, vm_object_t object, v return (NULL); domain = rv->domain; vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); - if (rv->object != object || !vm_domain_available(vmd, req, npages)) { - m = NULL; + vm_reserv_lock(rv); + if (rv->object != object) goto out; - } m = &rv->pages[index]; pa = VM_PAGE_TO_PHYS(m); if (pa < low || pa + size > high || (pa & (alignment - 1)) != 0 || - ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) { - m = NULL; + ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) goto out; - } /* Handle vm_page_rename(m, new_object, ...). */ for (i = 0; i < npages; i++) { - if (popmap_is_set(rv->popmap, index + i)) { - m = NULL; + if (popmap_is_set(rv->popmap, index + i)) goto out; - } } - for (i = 0; i < npages; i++) - vm_reserv_populate(rv, index + i); + vm_domain_free_lock(vmd); + if (!vm_domain_available(vmd, req, npages)) { + vm_domain_free_unlock(vmd); + goto out; + } vm_domain_freecnt_dec(vmd, npages); -out: vm_domain_free_unlock(vmd); + for (i = 0; i < npages; i++) + vm_reserv_populate(rv, index + i); + vm_reserv_unlock(rv); return (m); + +out: + vm_reserv_unlock(rv); + return (NULL); } /* @@ -621,10 +676,11 @@ out: * The object and free page queue must be locked. */ vm_page_t -vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, int domain, +vm_reserv_alloc_contig(int req, vm_object_t object, vm_pindex_t pindex, int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_page_t mpred) { + struct vm_domain *vmd; vm_paddr_t pa, size; vm_page_t m, m_ret, msucc; vm_pindex_t first, leftcap, rightcap; @@ -632,7 +688,6 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t u_long allocpages, maxpages, minpages; int i, index, n; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(npages != 0, ("vm_reserv_alloc_contig: npages is 0")); @@ -740,8 +795,16 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t * specified index may not be the first page within the first new * reservation. */ - m = vm_phys_alloc_contig(domain, allocpages, low, high, ulmax(alignment, - VM_LEVEL_0_SIZE), boundary > VM_LEVEL_0_SIZE ? boundary : 0); + m = NULL; + vmd = VM_DOMAIN(domain); + vm_domain_free_lock(vmd); + if (vm_domain_available(vmd, req, allocpages)) + m = vm_phys_alloc_contig(domain, allocpages, low, high, + ulmax(alignment, VM_LEVEL_0_SIZE), + boundary > VM_LEVEL_0_SIZE ? boundary : 0); + if (m != NULL) + vm_domain_freecnt_dec(vmd, allocpages); + vm_domain_free_unlock(vmd); if (m == NULL) return (NULL); KASSERT(vm_phys_domain(m) == domain, @@ -760,6 +823,7 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t KASSERT(rv->pages == m, ("vm_reserv_alloc_contig: reserv %p's pages is corrupted", rv)); + vm_reserv_lock(rv); vm_reserv_insert(rv, object, first); n = ulmin(VM_LEVEL_0_NPAGES - index, npages); for (i = 0; i < n; i++) @@ -769,6 +833,7 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t m_ret = &rv->pages[index]; index = 0; } + vm_reserv_unlock(rv); m += VM_LEVEL_0_NPAGES; first += VM_LEVEL_0_NPAGES; allocpages -= VM_LEVEL_0_NPAGES; @@ -816,18 +881,25 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde vmd = VM_DOMAIN(domain); index = VM_RESERV_INDEX(object, pindex); m = &rv->pages[index]; - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, 1) == 0 || - /* Handle reclaim race. */ - rv->object != object || + vm_reserv_lock(rv); + /* Handle reclaim race. */ + if (rv->object != object || /* Handle vm_page_rename(m, new_object, ...). */ - popmap_is_set(rv->popmap, index)) + popmap_is_set(rv->popmap, index)) { m = NULL; + goto out; + } + vm_domain_free_lock(vmd); + if (vm_domain_available(vmd, req, 1) == 0) + m = NULL; + else + vm_domain_freecnt_dec(vmd, 1); + vm_domain_free_unlock(vmd); if (m != NULL) { vm_reserv_populate(rv, index); - vm_domain_freecnt_dec(vmd, 1); } - vm_domain_free_unlock(vmd); +out: + vm_reserv_unlock(rv); return (m); } @@ -841,15 +913,15 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde * The object and free page queue must be locked. */ vm_page_t -vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex, int domain, +vm_reserv_alloc_page(int req, vm_object_t object, vm_pindex_t pindex, int domain, vm_page_t mpred) { + struct vm_domain *vmd; vm_page_t m, msucc; vm_pindex_t first, leftcap, rightcap; vm_reserv_t rv; int index; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); VM_OBJECT_ASSERT_WLOCKED(object); /* @@ -918,15 +990,27 @@ vm_reserv_alloc_page(vm_object_t object, vm_pindex_t p /* * Allocate and populate the new reservation. */ - m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DEFAULT, VM_LEVEL_0_ORDER); + m = NULL; + vmd = VM_DOMAIN(domain); + vm_domain_free_lock(vmd); + if (vm_domain_available(vmd, req, VM_LEVEL_0_ORDER)) { + m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DEFAULT, + VM_LEVEL_0_ORDER); + if (m != NULL) + vm_domain_freecnt_dec(vmd, 1); + } + vm_domain_free_unlock(vmd); if (m == NULL) return (NULL); rv = vm_reserv_from_page(m); + vm_reserv_lock(rv); KASSERT(rv->pages == m, ("vm_reserv_alloc_page: reserv %p's pages is corrupted", rv)); vm_reserv_insert(rv, object, first); index = VM_RESERV_INDEX(object, pindex); vm_reserv_populate(rv, index); + vm_reserv_unlock(rv); + return (&rv->pages[index]); } @@ -943,7 +1027,9 @@ vm_reserv_break(vm_reserv_t rv) { int begin_zeroes, hi, i, lo; - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); vm_reserv_remove(rv); rv->pages->psind = 0; i = hi = 0; @@ -982,12 +1068,14 @@ vm_reserv_break(vm_reserv_t rv) if (i != NPOPMAP) /* Convert from ffsl() to ordinary bit numbering. */ hi--; + vm_domain_free_lock(VM_DOMAIN(rv->domain)); vm_phys_free_contig(&rv->pages[begin_zeroes], NBPOPMAP * i + hi - begin_zeroes); + vm_domain_free_unlock(VM_DOMAIN(rv->domain)); } while (i < NPOPMAP); KASSERT(rv->popcnt == 0, ("vm_reserv_break: reserv %p's popcnt is corrupted", rv)); - vm_reserv_broken++; + counter_u64_add(vm_reserv_broken, 1); } /* @@ -997,7 +1085,6 @@ void vm_reserv_break_all(vm_object_t object) { vm_reserv_t rv; - struct vm_domain *vmd; /* * This access of object->rvq is unsynchronized so that the @@ -1006,27 +1093,22 @@ vm_reserv_break_all(vm_object_t object) * lock prevents new additions, so we are guaranteed that when * it returns NULL the object is properly empty. */ - vmd = NULL; while ((rv = LIST_FIRST(&object->rvq)) != NULL) { - if (vmd != VM_DOMAIN(rv->domain)) { - if (vmd != NULL) - vm_domain_free_unlock(vmd); - vmd = VM_DOMAIN(rv->domain); - vm_domain_free_lock(vmd); - } + vm_reserv_lock(rv); /* Reclaim race. */ - if (rv->object != object) + if (rv->object != object) { + vm_reserv_unlock(rv); continue; - KASSERT(rv->object == object, - ("vm_reserv_break_all: reserv %p is corrupted", rv)); + } + vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); rv->inpartpopq = FALSE; } + vm_reserv_domain_unlock(rv->domain); vm_reserv_break(rv); + vm_reserv_unlock(rv); } - if (vmd != NULL) - vm_domain_free_unlock(vmd); } /* @@ -1043,7 +1125,6 @@ vm_reserv_free_page(vm_page_t m) rv = vm_reserv_from_page(m); if (rv->object == NULL) return (FALSE); - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); vm_reserv_depopulate(rv, m - rv->pages); return (TRUE); } @@ -1076,8 +1157,11 @@ vm_reserv_init(void) paddr += VM_LEVEL_0_SIZE; } } - for (i = 0; i < MAXMEMDOM; i++) + for (i = 0; i < MAXMEMDOM; i++) { + mtx_init(&vm_reserv_domain_locks[i], "VM reserv domain", NULL, + MTX_DEF); TAILQ_INIT(&vm_rvq_partpop[i]); + } } /* @@ -1092,7 +1176,7 @@ vm_reserv_is_page_free(vm_page_t m) rv = vm_reserv_from_page(m); if (rv->object == NULL) return (false); - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); return (popmap_is_clear(rv->popmap, m - rv->pages)); } @@ -1132,7 +1216,10 @@ static void vm_reserv_reclaim(vm_reserv_t rv) { - vm_domain_free_assert_locked(VM_DOMAIN(rv->domain)); + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); + vm_reserv_domain_lock(rv->domain); KASSERT(rv->inpartpopq, ("vm_reserv_reclaim: reserv %p's inpartpopq is FALSE", rv)); KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains, @@ -1140,8 +1227,9 @@ vm_reserv_reclaim(vm_reserv_t rv) rv, rv->domain)); TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); rv->inpartpopq = FALSE; + vm_reserv_domain_unlock(rv->domain); vm_reserv_break(rv); - vm_reserv_reclaimed++; + counter_u64_add(vm_reserv_reclaimed, 1); } /* @@ -1156,9 +1244,14 @@ vm_reserv_reclaim_inactive(int domain) { vm_reserv_t rv; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); - if ((rv = TAILQ_FIRST(&vm_rvq_partpop[domain])) != NULL) { + while ((rv = TAILQ_FIRST(&vm_rvq_partpop[domain])) != NULL) { + vm_reserv_lock(rv); + if (rv != TAILQ_FIRST(&vm_rvq_partpop[domain])) { + vm_reserv_unlock(rv); + continue; + } vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); return (TRUE); } return (FALSE); @@ -1177,14 +1270,16 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm vm_paddr_t high, u_long alignment, vm_paddr_t boundary) { vm_paddr_t pa, size; - vm_reserv_t rv; + vm_reserv_t rv, rvn; int hi, i, lo, low_index, next_free; - vm_domain_free_assert_locked(VM_DOMAIN(domain)); if (npages > VM_LEVEL_0_NPAGES - 1) return (FALSE); size = npages << PAGE_SHIFT; - TAILQ_FOREACH(rv, &vm_rvq_partpop[domain], partpopq) { + vm_reserv_domain_lock(domain); +again: + for (rv = TAILQ_FIRST(&vm_rvq_partpop[domain]); rv != NULL; rv = rvn) { + rvn = TAILQ_NEXT(rv, partpopq); pa = VM_PAGE_TO_PHYS(&rv->pages[VM_LEVEL_0_NPAGES - 1]); if (pa + PAGE_SIZE - size < low) { /* This entire reservation is too low; go to next. */ @@ -1195,6 +1290,17 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm /* This entire reservation is too high; go to next. */ continue; } + if (vm_reserv_trylock(rv) == 0) { + vm_reserv_domain_unlock(domain); + vm_reserv_lock(rv); + if (!rv->inpartpopq) { + vm_reserv_domain_lock(domain); + if (!rvn->inpartpopq) + goto again; + continue; + } + } else + vm_reserv_domain_unlock(domain); if (pa < low) { /* Start the search for free pages at "low". */ low_index = (low + PAGE_MASK - pa) >> PAGE_SHIFT; @@ -1240,6 +1346,7 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm if ((NBPOPMAP * i - next_free) * PAGE_SIZE >= size) { vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); return (TRUE); } hi = ffsl(rv->popmap[i]); @@ -1250,10 +1357,16 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm if ((NBPOPMAP * i + hi - next_free) * PAGE_SIZE >= size) { vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); return (TRUE); } } while (i < NPOPMAP); + vm_reserv_unlock(rv); + vm_reserv_domain_lock(domain); + if (!rvn->inpartpopq) + goto again; } + vm_reserv_domain_unlock(domain); return (FALSE); } @@ -1271,7 +1384,11 @@ vm_reserv_rename(vm_page_t m, vm_object_t new_object, VM_OBJECT_ASSERT_WLOCKED(new_object); rv = vm_reserv_from_page(m); if (rv->object == old_object) { - vm_domain_free_lock(VM_DOMAIN(rv->domain)); + vm_reserv_lock(rv); + CTR6(KTR_VM, + "%s: rv %p object %p new %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, new_object, rv->popcnt, + rv->inpartpopq); if (rv->object == old_object) { vm_reserv_object_lock(old_object); rv->object = NULL; @@ -1283,7 +1400,7 @@ vm_reserv_rename(vm_page_t m, vm_object_t new_object, LIST_INSERT_HEAD(&new_object->rvq, rv, objq); vm_reserv_object_unlock(new_object); } - vm_domain_free_unlock(VM_DOMAIN(rv->domain)); + vm_reserv_unlock(rv); } } @@ -1342,6 +1459,17 @@ vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end, */ return (new_end); } + +static void +vm_reserv_counter_startup(void) +{ + + vm_reserv_freed = counter_u64_alloc(M_WAITOK); + vm_reserv_broken = counter_u64_alloc(M_WAITOK); + vm_reserv_reclaimed = counter_u64_alloc(M_WAITOK); +} +SYSINIT(vm_reserv_counters, SI_SUB_CPU, SI_ORDER_ANY, + vm_reserv_counter_startup, NULL); /* * Returns the superpage containing the given page. Modified: user/jeff/numa/sys/vm/vm_reserv.h ============================================================================== --- user/jeff/numa/sys/vm/vm_reserv.h Sat Feb 24 02:08:18 2018 (r329893) +++ user/jeff/numa/sys/vm/vm_reserv.h Sat Feb 24 02:52:39 2018 (r329894) @@ -47,14 +47,14 @@ /* * The following functions are only to be used by the virtual memory system. */ -vm_page_t vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, +vm_page_t vm_reserv_alloc_contig(int req, vm_object_t object, vm_pindex_t pindex, int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_page_t mpred); vm_page_t vm_reserv_extend_contig(int req, vm_object_t object, vm_pindex_t pindex, int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_page_t mpred); -vm_page_t vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex, +vm_page_t vm_reserv_alloc_page(int req, vm_object_t object, vm_pindex_t pindex, int domain, vm_page_t mpred); vm_page_t vm_reserv_extend(int req, vm_object_t object, vm_pindex_t pindex, int domain, vm_page_t mpred); From owner-svn-src-user@freebsd.org Sat Feb 24 03:45:51 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52E15F1098C for ; Sat, 24 Feb 2018 03:45:51 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F2FF66AC53; Sat, 24 Feb 2018 03:45:50 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDC7D200ED; Sat, 24 Feb 2018 03:45:50 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O3jogm072606; Sat, 24 Feb 2018 03:45:50 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O3joBB072601; Sat, 24 Feb 2018 03:45:50 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802240345.w1O3joBB072601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 24 Feb 2018 03:45:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329900 - user/jeff/numa/sys/vm X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: user/jeff/numa/sys/vm X-SVN-Commit-Revision: 329900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 03:45:51 -0000 Author: jeff Date: Sat Feb 24 03:45:50 2018 New Revision: 329900 URL: https://svnweb.freebsd.org/changeset/base/329900 Log: Use atomics to allocate from the free count. Modified: user/jeff/numa/sys/vm/vm_page.c user/jeff/numa/sys/vm/vm_pagequeue.h user/jeff/numa/sys/vm/vm_reserv.c Modified: user/jeff/numa/sys/vm/vm_page.c ============================================================================== --- user/jeff/numa/sys/vm/vm_page.c Sat Feb 24 03:43:10 2018 (r329899) +++ user/jeff/numa/sys/vm/vm_page.c Sat Feb 24 03:45:50 2018 (r329900) @@ -1712,10 +1712,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi * for the request class and false otherwise. */ int -vm_domain_available(struct vm_domain *vmd, int req, int npages) +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) { + u_int limit, old, new; - vm_domain_free_assert_locked(vmd); req = req & VM_ALLOC_CLASS_MASK; /* @@ -1723,15 +1723,33 @@ vm_domain_available(struct vm_domain *vmd, int req, in */ if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) req = VM_ALLOC_SYSTEM; + if (req == VM_ALLOC_INTERRUPT) + limit = 0; + else if (req == VM_ALLOC_SYSTEM) + limit = vmd->vmd_interrupt_free_min; + else + limit = vmd->vmd_free_reserved; - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || - (req == VM_ALLOC_SYSTEM && - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) || - (req == VM_ALLOC_INTERRUPT && - vmd->vmd_free_count >= npages)) - return (1); + /* + * Attempt to reserve the pages. Fail if we're below the limit. + */ + do { + old = vmd->vmd_free_count; + new = old - npages; + if (new < limit) + return (0); + } while (atomic_cmpset_int(&vmd->vmd_free_count, old, new) == 0); - return (0); + /* Wake the page daemon if we've crossed the threshold. */ + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) + pagedaemon_wakeup(vmd->vmd_domain); + + /* Only update bitsets on transitions. */ + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) + vm_domain_set(vmd); + + return (1); } vm_page_t @@ -1776,22 +1794,22 @@ again: if (m != NULL) goto found; } - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, 1)) { + if (vm_domain_allocate(vmd, req, 1)) { /* * If not, allocate it from the free page queues. */ + vm_domain_free_lock(vmd); m = vm_phys_alloc_pages(domain, object != NULL ? VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); - if (m != NULL) - vm_domain_freecnt_dec(vmd, 1); + vm_domain_free_unlock(vmd); + if (m == NULL) + vm_domain_freecnt_inc(vmd, 1); } - vm_domain_free_unlock(vmd); + if (m == NULL) { #if VM_NRESERVLEVEL > 0 - if (m == NULL && vm_reserv_reclaim_inactive(domain)) - goto again; + if (vm_reserv_reclaim_inactive(domain)) + goto again; #endif - if (m == NULL) { /* * Not allocatable, give up. */ @@ -1977,24 +1995,23 @@ again: #endif m_ret = NULL; vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, npages)) { + if (vm_domain_allocate(vmd, req, npages)) { /* * allocate them from the free page queues. */ + vm_domain_free_lock(vmd); m_ret = vm_phys_alloc_contig(domain, npages, low, high, alignment, boundary); - if (m_ret != NULL) - vm_domain_freecnt_dec(vmd, npages); + vm_domain_free_unlock(vmd); + if (m_ret == NULL) + vm_domain_freecnt_inc(vmd, npages); } - vm_domain_free_unlock(vmd); + if (m_ret == NULL) { #if VM_NRESERVLEVEL > 0 - if (m_ret == NULL && - vm_reserv_reclaim_contig(domain, npages, low, high, alignment, - boundary)) - goto again; + if (vm_reserv_reclaim_contig(domain, npages, low, high, alignment, + boundary)) + goto again; #endif - if (m_ret == NULL) { if (vm_domain_alloc_fail(vmd, object, req)) goto again; return (NULL); @@ -2134,13 +2151,14 @@ vm_page_alloc_freelist_domain(int domain, int freelist */ vmd = VM_DOMAIN(domain); again: - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, 1)) + if (vm_domain_allocate(vmd, req, 1)) { + vm_domain_free_lock(vmd); m = vm_phys_alloc_freelist_pages(domain, freelist, VM_FREEPOOL_DIRECT, 0); - if (m != NULL) - vm_domain_freecnt_dec(vmd, 1); - vm_domain_free_unlock(vmd); + vm_domain_free_unlock(vmd); + if (m == NULL) + vm_domain_freecnt_inc(vmd, 1); + } if (m == NULL) { if (vm_domain_alloc_fail(vmd, NULL, req)) goto again; @@ -2181,17 +2199,17 @@ vm_page_import(void *arg, void **store, int cnt, int d n = 64; /* Starting stride. */ vm_domain_free_lock(vmd); for (i = 0; i < cnt; i+=n) { - if (!vm_domain_available(vmd, VM_ALLOC_NORMAL, n)) - break; n = vm_phys_alloc_npages(domain, VM_FREELIST_DEFAULT, &m, MIN(n, cnt-i)); if (n == 0) break; + if (!vm_domain_allocate(vmd, VM_ALLOC_NORMAL, n)) { + vm_phys_free_contig(m, n); + break; + } for (j = 0; j < n; j++) store[i+j] = m++; } - if (i != 0) - vm_domain_freecnt_dec(vmd, i); vm_domain_free_unlock(vmd); return (i); Modified: user/jeff/numa/sys/vm/vm_pagequeue.h ============================================================================== --- user/jeff/numa/sys/vm/vm_pagequeue.h Sat Feb 24 03:43:10 2018 (r329899) +++ user/jeff/numa/sys/vm/vm_pagequeue.h Sat Feb 24 03:45:50 2018 (r329900) @@ -195,7 +195,7 @@ vm_pagequeue_cnt_add(struct vm_pagequeue *pq, int adde void vm_domain_set(struct vm_domain *vmd); void vm_domain_clear(struct vm_domain *vmd); -int vm_domain_available(struct vm_domain *vmd, int req, int npages); +int vm_domain_allocate(struct vm_domain *vmd, int req, int npages); /* * vm_pagequeue_domain: @@ -280,22 +280,6 @@ vm_domain_freecnt_inc(struct vm_domain *vmd, int adj) new >= vmd->vmd_pageout_free_min))) vm_domain_clear(vmd); } - -static inline void -vm_domain_freecnt_dec(struct vm_domain *vmd, int adj) -{ - u_int old, new; - - old = atomic_fetchadd_int(&vmd->vmd_free_count, -adj); - new = old - adj; - if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) - pagedaemon_wakeup(vmd->vmd_domain); - /* Only update bitsets on transitions. */ - if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || - (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) - vm_domain_set(vmd); -} - #endif /* _KERNEL */ #endif /* !_VM_PAGEQUEUE_ */ Modified: user/jeff/numa/sys/vm/vm_reserv.c ============================================================================== --- user/jeff/numa/sys/vm/vm_reserv.c Sat Feb 24 03:43:10 2018 (r329899) +++ user/jeff/numa/sys/vm/vm_reserv.c Sat Feb 24 03:45:50 2018 (r329900) @@ -643,13 +643,8 @@ vm_reserv_extend_contig(int req, vm_object_t object, v if (popmap_is_set(rv->popmap, index + i)) goto out; } - vm_domain_free_lock(vmd); - if (!vm_domain_available(vmd, req, npages)) { - vm_domain_free_unlock(vmd); + if (!vm_domain_allocate(vmd, req, npages)) goto out; - } - vm_domain_freecnt_dec(vmd, npages); - vm_domain_free_unlock(vmd); for (i = 0; i < npages; i++) vm_reserv_populate(rv, index + i); vm_reserv_unlock(rv); @@ -797,15 +792,17 @@ vm_reserv_alloc_contig(int req, vm_object_t object, vm */ m = NULL; vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, allocpages)) + if (vm_domain_allocate(vmd, req, allocpages)) { + vm_domain_free_lock(vmd); m = vm_phys_alloc_contig(domain, allocpages, low, high, ulmax(alignment, VM_LEVEL_0_SIZE), boundary > VM_LEVEL_0_SIZE ? boundary : 0); - if (m != NULL) - vm_domain_freecnt_dec(vmd, allocpages); - vm_domain_free_unlock(vmd); - if (m == NULL) + vm_domain_free_unlock(vmd); + if (m == NULL) { + vm_domain_freecnt_inc(vmd, allocpages); + return (NULL); + } + } else return (NULL); KASSERT(vm_phys_domain(m) == domain, ("vm_reserv_alloc_contig: Page domain does not match requested.")); @@ -889,15 +886,10 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde m = NULL; goto out; } - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, 1) == 0) + if (vm_domain_allocate(vmd, req, 1) == 0) m = NULL; else - vm_domain_freecnt_dec(vmd, 1); - vm_domain_free_unlock(vmd); - if (m != NULL) { vm_reserv_populate(rv, index); - } out: vm_reserv_unlock(rv); @@ -992,15 +984,16 @@ vm_reserv_alloc_page(int req, vm_object_t object, vm_p */ m = NULL; vmd = VM_DOMAIN(domain); - vm_domain_free_lock(vmd); - if (vm_domain_available(vmd, req, VM_LEVEL_0_ORDER)) { + if (vm_domain_allocate(vmd, req, 1)) { + vm_domain_free_lock(vmd); m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DEFAULT, VM_LEVEL_0_ORDER); - if (m != NULL) - vm_domain_freecnt_dec(vmd, 1); - } - vm_domain_free_unlock(vmd); - if (m == NULL) + vm_domain_free_unlock(vmd); + if (m == NULL) { + vm_domain_freecnt_inc(vmd, 1); + return (NULL); + } + } else return (NULL); rv = vm_reserv_from_page(m); vm_reserv_lock(rv); From owner-svn-src-user@freebsd.org Sat Feb 24 19:25:10 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F8F9F07111 for ; Sat, 24 Feb 2018 19:25:10 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBAAB72B90; Sat, 24 Feb 2018 19:25:09 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D696629CCD; Sat, 24 Feb 2018 19:25:09 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OJP9qV048448; Sat, 24 Feb 2018 19:25:09 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OJP9bd048447; Sat, 24 Feb 2018 19:25:09 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802241925.w1OJP9bd048447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 24 Feb 2018 19:25:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329920 - user/jeff/numa/sys/kern X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: user/jeff/numa/sys/kern X-SVN-Commit-Revision: 329920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 19:25:10 -0000 Author: jeff Date: Sat Feb 24 19:25:09 2018 New Revision: 329920 URL: https://svnweb.freebsd.org/changeset/base/329920 Log: Fix a missed queue in bd_flushall(). Use a more obvious assignment when switching queues. Modified: user/jeff/numa/sys/kern/vfs_bio.c Modified: user/jeff/numa/sys/kern/vfs_bio.c ============================================================================== --- user/jeff/numa/sys/kern/vfs_bio.c Sat Feb 24 18:16:28 2018 (r329919) +++ user/jeff/numa/sys/kern/vfs_bio.c Sat Feb 24 19:25:09 2018 (r329920) @@ -1765,7 +1765,7 @@ bd_flush(struct bufdomain *bd, struct bufqueue *bq) TAILQ_REMOVE(&bq->bq_queue, bp, b_freelist); TAILQ_INSERT_TAIL(&bd->bd_cleanq->bq_queue, bp, b_freelist); - bp->b_subqueue = mp_ncpus; + bp->b_subqueue = bd->bd_cleanq->bq_subqueue; } bd->bd_cleanq->bq_len += bq->bq_len; bq->bq_len = 0; @@ -1788,7 +1788,7 @@ bd_flushall(struct bufdomain *bd) if (bd->bd_lim == 0) return (0); flushed = 0; - for (i = 0; i < mp_maxid; i++) { + for (i = 0; i < mp_ncpus; i++) { bq = &bd->bd_subq[i]; if (bq->bq_len == 0) continue; From owner-svn-src-user@freebsd.org Sat Feb 24 20:12:02 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 841A4F0BDD7 for ; Sat, 24 Feb 2018 20:12:02 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C04774A9A; Sat, 24 Feb 2018 20:12:02 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 254372A4AF; Sat, 24 Feb 2018 20:12:02 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OKC1gJ072649; Sat, 24 Feb 2018 20:12:01 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OKC1dd072648; Sat, 24 Feb 2018 20:12:01 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802242012.w1OKC1dd072648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 24 Feb 2018 20:12:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329925 - user/jeff/numa/sys/vm X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: user/jeff/numa/sys/vm X-SVN-Commit-Revision: 329925 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 20:12:02 -0000 Author: jeff Date: Sat Feb 24 20:12:01 2018 New Revision: 329925 URL: https://svnweb.freebsd.org/changeset/base/329925 Log: Acquire the page lock when freeing a page we failed to allocate so that we can properly consult reservations. Reported by: pho Modified: user/jeff/numa/sys/vm/vm_page.c Modified: user/jeff/numa/sys/vm/vm_page.c ============================================================================== --- user/jeff/numa/sys/vm/vm_page.c Sat Feb 24 20:07:39 2018 (r329924) +++ user/jeff/numa/sys/vm/vm_page.c Sat Feb 24 20:12:01 2018 (r329925) @@ -1864,7 +1864,9 @@ found: m->oflags = VPO_UNMANAGED; m->busy_lock = VPB_UNBUSIED; /* Don't change PG_ZERO. */ + vm_page_lock(m); vm_page_free_toq(m); + vm_page_unlock(m); if (req & VM_ALLOC_WAITFAIL) { VM_OBJECT_WUNLOCK(object); vm_radix_wait(); @@ -2066,7 +2068,9 @@ found: m->oflags = VPO_UNMANAGED; m->busy_lock = VPB_UNBUSIED; /* Don't change PG_ZERO. */ + vm_page_lock(m); vm_page_free_toq(m); + vm_page_unlock(m); } if (req & VM_ALLOC_WAITFAIL) { VM_OBJECT_WUNLOCK(object);