From owner-svn-src-user@freebsd.org Sun Mar 11 00:07:15 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 0EF05F4329E for ; Sun, 11 Mar 2018 00:07:15 +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 A97D26D263; Sun, 11 Mar 2018 00:07:14 +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 9FA0014E76; Sun, 11 Mar 2018 00:07:14 +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 w2B07EA7058290; Sun, 11 Mar 2018 00:07:14 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2B07E8F058289; Sun, 11 Mar 2018 00:07:14 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803110007.w2B07E8F058289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 11 Mar 2018 00:07:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330751 - 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: 330751 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: Sun, 11 Mar 2018 00:07:15 -0000 Author: jeff Date: Sun Mar 11 00:07:14 2018 New Revision: 330751 URL: https://svnweb.freebsd.org/changeset/base/330751 Log: This branch requires the vm page to be locked before free_prep. 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 Mar 10 23:47:03 2018 (r330750) +++ user/jeff/numa/sys/vm/vm_page.c Sun Mar 11 00:07:14 2018 (r330751) @@ -3374,8 +3374,10 @@ vm_page_free_pages_toq(struct spglist *free, bool upda while ((m = SLIST_FIRST(free)) != NULL) { count++; SLIST_REMOVE_HEAD(free, plinks.s.ss); + vm_page_lock(m); if (vm_page_free_prep(m, false)) TAILQ_INSERT_TAIL(&pgl, m, listq); + vm_page_unlock(m); } vm_page_free_phys_pglist(&pgl); From owner-svn-src-user@freebsd.org Sun Mar 11 02:45:53 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 A7149F4DFF1 for ; Sun, 11 Mar 2018 02:45:53 +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 4EB9B735C2; Sun, 11 Mar 2018 02:45:53 +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 46F3D16A02; Sun, 11 Mar 2018 02:45:53 +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 w2B2jrwc037792; Sun, 11 Mar 2018 02:45:53 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2B2jrhF037791; Sun, 11 Mar 2018 02:45:53 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803110245.w2B2jrhF037791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 11 Mar 2018 02:45:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330755 - 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: 330755 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: Sun, 11 Mar 2018 02:45:53 -0000 Author: jeff Date: Sun Mar 11 02:45:52 2018 New Revision: 330755 URL: https://svnweb.freebsd.org/changeset/base/330755 Log: Leave a note for myself to cleanup some locking before commit to head. 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 Sun Mar 11 01:09:31 2018 (r330754) +++ user/jeff/numa/sys/vm/vm_page.c Sun Mar 11 02:45:52 2018 (r330755) @@ -3374,6 +3374,7 @@ vm_page_free_pages_toq(struct spglist *free, bool upda while ((m = SLIST_FIRST(free)) != NULL) { count++; SLIST_REMOVE_HEAD(free, plinks.s.ss); + /* XXX batch locks. */ vm_page_lock(m); if (vm_page_free_prep(m, false)) TAILQ_INSERT_TAIL(&pgl, m, listq); From owner-svn-src-user@freebsd.org Sun Mar 11 10:06:12 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 D2195F410BE for ; Sun, 11 Mar 2018 10:06:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3644084BA6; Sun, 11 Mar 2018 10:06:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w2BA60sv035221 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 11 Mar 2018 12:06:04 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2BA60sv035221 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2BA609t035220; Sun, 11 Mar 2018 12:06:00 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 11 Mar 2018 12:06:00 +0200 From: Konstantin Belousov To: Jeff Roberson Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r330755 - user/jeff/numa/sys/vm Message-ID: <20180311100600.GB76926@kib.kiev.ua> References: <201803110245.w2B2jrhF037791@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201803110245.w2B2jrhF037791@repo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home 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: Sun, 11 Mar 2018 10:06:13 -0000 On Sun, Mar 11, 2018 at 02:45:53AM +0000, Jeff Roberson wrote: > Author: jeff > Date: Sun Mar 11 02:45:52 2018 > New Revision: 330755 > URL: https://svnweb.freebsd.org/changeset/base/330755 > > Log: > Leave a note for myself to cleanup some locking before commit to head. > > 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 Sun Mar 11 01:09:31 2018 (r330754) > +++ user/jeff/numa/sys/vm/vm_page.c Sun Mar 11 02:45:52 2018 (r330755) > @@ -3374,6 +3374,7 @@ vm_page_free_pages_toq(struct spglist *free, bool upda > while ((m = SLIST_FIRST(free)) != NULL) { > count++; > SLIST_REMOVE_HEAD(free, plinks.s.ss); > + /* XXX batch locks. */ > vm_page_lock(m); > if (vm_page_free_prep(m, false)) > TAILQ_INSERT_TAIL(&pgl, m, listq); Is the added vm_page_lock() due to the new uses of vm_page_free_pages_toq() ? I believe that the function was only used for the unmanaged pages. From owner-svn-src-user@freebsd.org Sun Mar 11 18:31:22 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 6C28EF4425C for ; Sun, 11 Mar 2018 18:31: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 1F54677DBE; Sun, 11 Mar 2018 18: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 1A77120DB2; Sun, 11 Mar 2018 18: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 w2BIVLAK015679; Sun, 11 Mar 2018 18:31:21 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2BIVLNj015678; Sun, 11 Mar 2018 18:31:21 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803111831.w2BIVLNj015678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 11 Mar 2018 18:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330774 - 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: 330774 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: Sun, 11 Mar 2018 18:31:22 -0000 Author: jeff Date: Sun Mar 11 18:31:21 2018 New Revision: 330774 URL: https://svnweb.freebsd.org/changeset/base/330774 Log: Fix invariants compile. Modified: user/jeff/numa/sys/vm/vm_phys.h Modified: user/jeff/numa/sys/vm/vm_phys.h ============================================================================== --- user/jeff/numa/sys/vm/vm_phys.h Sun Mar 11 18:20:49 2018 (r330773) +++ user/jeff/numa/sys/vm/vm_phys.h Sun Mar 11 18:31:21 2018 (r330774) @@ -52,6 +52,7 @@ struct mem_affinity { extern struct mem_affinity *mem_affinity; extern int *mem_locality; #endif +extern int vm_ndomains; struct vm_freelist { struct pglist pl; From owner-svn-src-user@freebsd.org Sun Mar 11 18:43: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 0C94FF45107 for ; Sun, 11 Mar 2018 18:43: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 B49507880A; Sun, 11 Mar 2018 18:43: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 AF80321091; Sun, 11 Mar 2018 18:43: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 w2BIhaMQ022881; Sun, 11 Mar 2018 18:43:36 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2BIhawQ022880; Sun, 11 Mar 2018 18:43:36 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803111843.w2BIhawQ022880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 11 Mar 2018 18:43:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330776 - 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: 330776 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: Sun, 11 Mar 2018 18:43:37 -0000 Author: jeff Date: Sun Mar 11 18:43:36 2018 New Revision: 330776 URL: https://svnweb.freebsd.org/changeset/base/330776 Log: Correct bogus assert from mismerge. Modified: user/jeff/numa/sys/vm/vm_reserv.c Modified: user/jeff/numa/sys/vm/vm_reserv.c ============================================================================== --- user/jeff/numa/sys/vm/vm_reserv.c Sun Mar 11 18:37:55 2018 (r330775) +++ user/jeff/numa/sys/vm/vm_reserv.c Sun Mar 11 18:43:36 2018 (r330776) @@ -1118,7 +1118,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); } From owner-svn-src-user@freebsd.org Mon Mar 12 00:33: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 744EDF34DCB for ; Mon, 12 Mar 2018 00:33: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 1E07386EE7; Mon, 12 Mar 2018 00:33: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 14693247C5; Mon, 12 Mar 2018 00:33: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 w2C0X2xT098172; Mon, 12 Mar 2018 00:33:02 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2C0X2tP098171; Mon, 12 Mar 2018 00:33:02 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803120033.w2C0X2tP098171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 12 Mar 2018 00:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330786 - 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: 330786 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, 12 Mar 2018 00:33:02 -0000 Author: jeff Date: Mon Mar 12 00:33:01 2018 New Revision: 330786 URL: https://svnweb.freebsd.org/changeset/base/330786 Log: Make the dirty queues per-domain. This solves a bug where an entire buf domain can be saturated with dirty bufs while we're still below hidirtybuffers. There is still a single buf_daemon() servicing every queue. Multiple threads would compete for running space and a single thread can generate a substantial volume of write traffic. Reported by: pho 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 Sun Mar 11 23:14:50 2018 (r330785) +++ user/jeff/numa/sys/kern/vfs_bio.c Mon Mar 12 00:33:01 2018 (r330786) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -100,6 +101,7 @@ struct buf_ops buf_ops_bio = { .bop_bdflush = bufbdflush, }; +struct bufdomain; static struct buf *buf; /* buffer header pool */ extern struct buf *swbuf; /* Swap buffer header pool. */ caddr_t unmapped_buf; @@ -123,8 +125,8 @@ static int vfs_bio_clcheck(struct vnode *vp, int size, daddr_t lblkno, daddr_t blkno); static void breada(struct vnode *, daddr_t *, int *, int, struct ucred *, int, void (*)(struct buf *)); -static int buf_flush(struct vnode *vp, int); -static int flushbufqueues(struct vnode *, int, int); +static int buf_flush(struct vnode *vp, struct bufdomain *, int); +static int flushbufqueues(struct vnode *, struct bufdomain *, int, int); static void buf_daemon(void); static __inline void bd_wakeup(void); static int sysctl_runningspace(SYSCTL_HANDLER_ARGS); @@ -133,6 +135,7 @@ static void bufkva_free(struct buf *); static int buf_import(void *, void **, int, int, int); static void buf_release(void *, void **, int); static void maxbcachebuf_adjust(void); +static inline struct bufdomain *bufdomain(struct buf *); static int sysctl_bufspace(SYSCTL_HANDLER_ARGS); int vmiodirenable = TRUE; @@ -147,22 +150,22 @@ static counter_u64_t bufkvaspace; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, bufkvaspace, CTLFLAG_RD, &bufkvaspace, "Kernel virtual memory used for buffers"); static long maxbufspace; -SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RW, &maxbufspace, 0, +SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, "Maximum allowed value of bufspace (including metadata)"); static long bufmallocspace; SYSCTL_LONG(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0, "Amount of malloced memory for buffers"); static long maxbufmallocspace; -SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, +SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RD, &maxbufmallocspace, 0, "Maximum amount of malloced memory for buffers"); static long lobufspace; -SYSCTL_LONG(_vfs, OID_AUTO, lobufspace, CTLFLAG_RW, &lobufspace, 0, +SYSCTL_LONG(_vfs, OID_AUTO, lobufspace, CTLFLAG_RD, &lobufspace, 0, "Minimum amount of buffers we want to have"); long hibufspace; -SYSCTL_LONG(_vfs, OID_AUTO, hibufspace, CTLFLAG_RW, &hibufspace, 0, +SYSCTL_LONG(_vfs, OID_AUTO, hibufspace, CTLFLAG_RD, &hibufspace, 0, "Maximum allowed value of bufspace (excluding metadata)"); long bufspacethresh; -SYSCTL_LONG(_vfs, OID_AUTO, bufspacethresh, CTLFLAG_RW, &bufspacethresh, +SYSCTL_LONG(_vfs, OID_AUTO, bufspacethresh, CTLFLAG_RD, &bufspacethresh, 0, "Bufspace consumed before waking the daemon to free some"); static counter_u64_t buffreekvacnt; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, buffreekvacnt, CTLFLAG_RW, &buffreekvacnt, @@ -190,26 +193,27 @@ SYSCTL_INT(_vfs, OID_AUTO, altbufferflushes, CTLFLAG_R static int recursiveflushes; SYSCTL_INT(_vfs, OID_AUTO, recursiveflushes, CTLFLAG_RW, &recursiveflushes, 0, "Number of flushes skipped due to being recursive"); -static int numdirtybuffers; -SYSCTL_INT(_vfs, OID_AUTO, numdirtybuffers, CTLFLAG_RD, &numdirtybuffers, 0, +static int sysctl_numdirtybuffers(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RD, NULL, 0, sysctl_numdirtybuffers, "I", "Number of buffers that are dirty (has unwritten changes) at the moment"); static int lodirtybuffers; -SYSCTL_INT(_vfs, OID_AUTO, lodirtybuffers, CTLFLAG_RW, &lodirtybuffers, 0, +SYSCTL_INT(_vfs, OID_AUTO, lodirtybuffers, CTLFLAG_RD, &lodirtybuffers, 0, "How many buffers we want to have free before bufdaemon can sleep"); static int hidirtybuffers; -SYSCTL_INT(_vfs, OID_AUTO, hidirtybuffers, CTLFLAG_RW, &hidirtybuffers, 0, +SYSCTL_INT(_vfs, OID_AUTO, hidirtybuffers, CTLFLAG_RD, &hidirtybuffers, 0, "When the number of dirty buffers is considered severe"); int dirtybufthresh; -SYSCTL_INT(_vfs, OID_AUTO, dirtybufthresh, CTLFLAG_RW, &dirtybufthresh, +SYSCTL_INT(_vfs, OID_AUTO, dirtybufthresh, CTLFLAG_RD, &dirtybufthresh, 0, "Number of bdwrite to bawrite conversions to clear dirty buffers"); static int numfreebuffers; SYSCTL_INT(_vfs, OID_AUTO, numfreebuffers, CTLFLAG_RD, &numfreebuffers, 0, "Number of free buffers"); static int lofreebuffers; -SYSCTL_INT(_vfs, OID_AUTO, lofreebuffers, CTLFLAG_RW, &lofreebuffers, 0, +SYSCTL_INT(_vfs, OID_AUTO, lofreebuffers, CTLFLAG_RD, &lofreebuffers, 0, "Target number of free buffers"); static int hifreebuffers; -SYSCTL_INT(_vfs, OID_AUTO, hifreebuffers, CTLFLAG_RW, &hifreebuffers, 0, +SYSCTL_INT(_vfs, OID_AUTO, hifreebuffers, CTLFLAG_RD, &hifreebuffers, 0, "Threshold for clean buffer recycling"); static counter_u64_t getnewbufcalls; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RD, @@ -308,10 +312,10 @@ struct bufqueue { #define BQ_ASSERT_LOCKED(bq) mtx_assert(BQ_LOCKPTR((bq)), MA_OWNED) struct bufqueue __exclusive_cache_line bqempty; -struct bufqueue __exclusive_cache_line bqdirty; struct bufdomain { struct bufqueue bd_subq[MAXCPU + 1]; /* Per-cpu sub queues + global */ + struct bufqueue bd_dirtyq; struct bufqueue *bd_cleanq; struct mtx_padalign bd_run_lock; /* Constants */ @@ -321,10 +325,14 @@ struct bufdomain { long bd_bufspacethresh; int bd_hifreebuffers; int bd_lofreebuffers; + int bd_hidirtybuffers; + int bd_lodirtybuffers; + int bd_dirtybufthresh; int bd_lim; /* atomics */ int bd_wanted; - int __aligned(CACHE_LINE_SIZE) bd_running; + int __aligned(CACHE_LINE_SIZE) bd_numdirtybuffers; + int __aligned(CACHE_LINE_SIZE) bd_running; long __aligned(CACHE_LINE_SIZE) bd_bufspace; int __aligned(CACHE_LINE_SIZE) bd_freebuffers; } __aligned(CACHE_LINE_SIZE); @@ -336,15 +344,19 @@ struct bufdomain { #define BD_RUN_LOCKPTR(bd) (&(bd)->bd_run_lock) #define BD_RUN_LOCK(bd) mtx_lock(BD_RUN_LOCKPTR((bd))) #define BD_RUN_UNLOCK(bd) mtx_unlock(BD_RUN_LOCKPTR((bd))) -#define BD_DOMAIN(bd) (bd - bdclean) +#define BD_DOMAIN(bd) (bd - bdomain) -/* Maximum number of clean buffer domains. */ -#define CLEAN_DOMAINS 8 +/* Maximum number of buffer domains. */ +#define BUF_DOMAINS 8 +BITSET_DEFINE(bufdomainset, BUF_DOMAINS); +struct bufdomainset bdlodirty; /* Domains > lodirty */ +struct bufdomainset bdhidirty; /* Domains > hidirty */ + /* Configured number of clean queues. */ -static int __read_mostly clean_domains; +static int __read_mostly buf_domains; -struct bufdomain __exclusive_cache_line bdclean[CLEAN_DOMAINS]; +struct bufdomain __exclusive_cache_line bdomain[BUF_DOMAINS]; static void bq_remove(struct bufqueue *bq, struct buf *bp); static void bq_insert(struct bufqueue *bq, struct buf *bp, bool unlock); @@ -403,8 +415,8 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) int i; lvalue = 0; - for (i = 0; i < clean_domains; i++) - lvalue += bdclean[i].bd_bufspace; + for (i = 0; i < buf_domains; i++) + lvalue += bdomain[i].bd_bufspace; if (sizeof(int) == sizeof(long) || req->oldlen >= sizeof(long)) return (sysctl_handle_long(oidp, &lvalue, 0, req)); if (lvalue > INT_MAX) @@ -421,12 +433,24 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) int i; lvalue = 0; - for (i = 0; i < clean_domains; i++) - lvalue += bdclean[i].bd_bufspace; + for (i = 0; i < buf_domains; i++) + lvalue += bdomain[i].bd_bufspace; return (sysctl_handle_long(oidp, &lvalue, 0, req)); } #endif +static int +sysctl_numdirtybuffers(SYSCTL_HANDLER_ARGS) +{ + int value; + int i; + + value = 0; + for (i = 0; i < buf_domains; i++) + value += bdomain[i].bd_numdirtybuffers; + return (sysctl_handle_int(oidp, &value, 0, req)); +} + /* * bdirtywakeup: * @@ -444,18 +468,59 @@ bdirtywakeup(void) } /* + * bd_clear: + * + * Clear a domain from the appropriate bitsets when dirtybuffers + * is decremented. + */ +static void +bd_clear(struct bufdomain *bd) +{ + + mtx_lock(&bdirtylock); + if (bd->bd_numdirtybuffers <= bd->bd_lodirtybuffers) + BIT_CLR(BUF_DOMAINS, BD_DOMAIN(bd), &bdlodirty); + if (bd->bd_numdirtybuffers <= bd->bd_hidirtybuffers) + BIT_CLR(BUF_DOMAINS, BD_DOMAIN(bd), &bdhidirty); + mtx_unlock(&bdirtylock); +} + +/* + * bd_set: + * + * Set a domain in the appropriate bitsets when dirtybuffers + * is incremented. + */ +static void +bd_set(struct bufdomain *bd) +{ + + mtx_lock(&bdirtylock); + if (bd->bd_numdirtybuffers > bd->bd_lodirtybuffers) + BIT_SET(BUF_DOMAINS, BD_DOMAIN(bd), &bdlodirty); + if (bd->bd_numdirtybuffers > bd->bd_hidirtybuffers) + BIT_SET(BUF_DOMAINS, BD_DOMAIN(bd), &bdhidirty); + mtx_unlock(&bdirtylock); +} + +/* * bdirtysub: * * Decrement the numdirtybuffers count by one and wakeup any * threads blocked in bwillwrite(). */ static void -bdirtysub(void) +bdirtysub(struct buf *bp) { + struct bufdomain *bd; + int num; - if (atomic_fetchadd_int(&numdirtybuffers, -1) == - (lodirtybuffers + hidirtybuffers) / 2) + bd = bufdomain(bp); + num = atomic_fetchadd_int(&bd->bd_numdirtybuffers, -1); + if (num == (bd->bd_lodirtybuffers + bd->bd_hidirtybuffers) / 2) bdirtywakeup(); + if (num == bd->bd_lodirtybuffers || num == bd->bd_hidirtybuffers) + bd_clear(bd); } /* @@ -465,16 +530,21 @@ bdirtysub(void) * daemon if needed. */ static void -bdirtyadd(void) +bdirtyadd(struct buf *bp) { + struct bufdomain *bd; + int num; /* * Only do the wakeup once as we cross the boundary. The * buf daemon will keep running until the condition clears. */ - if (atomic_fetchadd_int(&numdirtybuffers, 1) == - (lodirtybuffers + hidirtybuffers) / 2) + bd = bufdomain(bp); + num = atomic_fetchadd_int(&bd->bd_numdirtybuffers, 1); + if (num == (bd->bd_lodirtybuffers + bd->bd_hidirtybuffers) / 2) bd_wakeup(); + if (num == bd->bd_lodirtybuffers || num == bd->bd_hidirtybuffers) + bd_set(bd); } /* @@ -539,7 +609,7 @@ bufspace_adjust(struct buf *bp, int bufsize) KASSERT((bp->b_flags & B_MALLOC) == 0, ("bufspace_adjust: malloc buf %p", bp)); - bd = &bdclean[bp->b_domain]; + bd = bufdomain(bp); diff = bufsize - bp->b_bufsize; if (diff < 0) { atomic_subtract_long(&bd->bd_bufspace, -diff); @@ -638,7 +708,7 @@ bufspace_wait(struct bufdomain *bd, struct vnode *vp, * recursion. */ td->td_pflags |= TDP_BUFNEED | TDP_NORUNNINGBUF; - fl = buf_flush(vp, flushbufqtarget); + fl = buf_flush(vp, bd, flushbufqtarget); td->td_pflags &= norunbuf; BD_LOCK(bd); if (fl != 0) @@ -700,7 +770,6 @@ bufspace_daemon(void *arg) if (buf_recycle(bd, false) != 0) { if (bd_flushall(bd)) continue; - bd_speedup(); BD_LOCK(bd); if (bd->bd_wanted) { msleep(&bd->bd_wanted, BD_LOCKPTR(bd), @@ -1026,7 +1095,6 @@ bufinit(void) ("maxbcachebuf (%d) must be >= MAXBSIZE (%d)\n", maxbcachebuf, MAXBSIZE)); bq_init(&bqempty, QUEUE_EMPTY, -1, "bufq empty lock"); - bq_init(&bqdirty, QUEUE_DIRTY, -1, "bufq dirty lock"); mtx_init(&rbreqlock, "runningbufspace lock", NULL, MTX_DEF); mtx_init(&bdlock, "buffer daemon lock", NULL, MTX_DEF); mtx_init(&bdirtylock, "dirty buf lock", NULL, MTX_DEF); @@ -1094,7 +1162,6 @@ bufinit(void) */ hidirtybuffers = nbuf / 4 + 20; dirtybufthresh = hidirtybuffers * 9 / 10; - numdirtybuffers = 0; /* * To support extreme low-memory systems, make sure hidirtybuffers * cannot eat up all available buffer space. This occurs when our @@ -1129,22 +1196,26 @@ bufinit(void) * One queue per-256mb up to the max. More queues gives better * concurrency but less accurate LRU. */ - clean_domains = MIN(howmany(maxbufspace, 256*1024*1024), CLEAN_DOMAINS); - for (i = 0 ; i < clean_domains; i++) { + buf_domains = MIN(howmany(maxbufspace, 256*1024*1024), BUF_DOMAINS); + for (i = 0 ; i < buf_domains; i++) { struct bufdomain *bd; - bd = &bdclean[i]; + bd = &bdomain[i]; bd_init(bd); - bd->bd_freebuffers = nbuf / clean_domains; - bd->bd_hifreebuffers = hifreebuffers / clean_domains; - bd->bd_lofreebuffers = lofreebuffers / clean_domains; + bd->bd_freebuffers = nbuf / buf_domains; + bd->bd_hifreebuffers = hifreebuffers / buf_domains; + bd->bd_lofreebuffers = lofreebuffers / buf_domains; bd->bd_bufspace = 0; - bd->bd_maxbufspace = maxbufspace / clean_domains; - bd->bd_hibufspace = hibufspace / clean_domains; - bd->bd_lobufspace = lobufspace / clean_domains; - bd->bd_bufspacethresh = bufspacethresh / clean_domains; + bd->bd_maxbufspace = maxbufspace / buf_domains; + bd->bd_hibufspace = hibufspace / buf_domains; + bd->bd_lobufspace = lobufspace / buf_domains; + bd->bd_bufspacethresh = bufspacethresh / buf_domains; + bd->bd_numdirtybuffers = 0; + bd->bd_hidirtybuffers = hidirtybuffers / buf_domains; + bd->bd_lodirtybuffers = lodirtybuffers / buf_domains; + bd->bd_dirtybufthresh = dirtybufthresh / buf_domains; /* Don't allow more than 2% of bufs in the per-cpu caches. */ - bd->bd_lim = nbuf / clean_domains / 50 / mp_ncpus; + bd->bd_lim = nbuf / buf_domains / 50 / mp_ncpus; } getnewbufcalls = counter_u64_alloc(M_WAITOK); getnewbufrestarts = counter_u64_alloc(M_WAITOK); @@ -1328,6 +1399,13 @@ bpmap_qenter(struct buf *bp) (vm_offset_t)(bp->b_offset & PAGE_MASK)); } +static inline struct bufdomain * +bufdomain(struct buf *bp) +{ + + return (&bdomain[bp->b_domain]); +} + static struct bufqueue * bufqueue(struct buf *bp) { @@ -1340,9 +1418,9 @@ bufqueue(struct buf *bp) case QUEUE_EMPTY: return (&bqempty); case QUEUE_DIRTY: - return (&bqdirty); + return (&bufdomain(bp)->bd_dirtyq); case QUEUE_CLEAN: - return (&bdclean[bp->b_domain].bd_subq[bp->b_subqueue]); + return (&bufdomain(bp)->bd_subq[bp->b_subqueue]); default: break; } @@ -1405,14 +1483,14 @@ binsfree(struct buf *bp, int qindex) bq_remove(bq, bp); BQ_UNLOCK(bq); } + bd = bufdomain(bp); if (qindex == QUEUE_CLEAN) { - bd = &bdclean[bp->b_domain]; if (bd->bd_lim != 0) bq = &bd->bd_subq[PCPU_GET(cpuid)]; else bq = bd->bd_cleanq; } else - bq = &bqdirty; + bq = &bd->bd_dirtyq; bq_insert(bq, bp, true); } @@ -1440,7 +1518,7 @@ buf_free(struct buf *bp) if (!LIST_EMPTY(&bp->b_dep)) buf_deallocate(bp); bufkva_free(bp); - atomic_add_int(&bdclean[bp->b_domain].bd_freebuffers, 1); + atomic_add_int(&bufdomain(bp)->bd_freebuffers, 1); BUF_UNLOCK(bp); uma_zfree(buf_zone, bp); } @@ -1716,9 +1794,10 @@ bd_init(struct bufdomain *bd) int domain; int i; - domain = bd - bdclean; + domain = bd - bdomain; bd->bd_cleanq = &bd->bd_subq[mp_maxid + 1]; bq_init(bd->bd_cleanq, QUEUE_CLEAN, mp_maxid + 1, "bufq clean lock"); + bq_init(&bd->bd_dirtyq, QUEUE_DIRTY, -1, "bufq dirty lock"); for (i = 0; i <= mp_maxid; i++) bq_init(&bd->bd_subq[i], QUEUE_CLEAN, i, "bufq clean subqueue lock"); @@ -1810,7 +1889,7 @@ bq_insert(struct bufqueue *bq, struct buf *bp, bool un if (bp->b_qindex != QUEUE_NONE) panic("bq_insert: free buffer %p onto another queue?", bp); - bd = &bdclean[bp->b_domain]; + bd = bufdomain(bp); if (bp->b_flags & B_AGE) { /* Place this buf directly on the real queue. */ if (bq->bq_index == QUEUE_CLEAN) @@ -1927,8 +2006,8 @@ bufkva_reclaim(vmem_t *vmem, int flags) done = false; for (i = 0; i < 5; i++) { - for (q = 0; q < clean_domains; q++) - if (buf_recycle(&bdclean[q], true) != 0) + for (q = 0; q < buf_domains; q++) + if (buf_recycle(&bdomain[q], true) != 0) done = true; if (done) break; @@ -2320,7 +2399,7 @@ bdirty(struct buf *bp) if ((bp->b_flags & B_DELWRI) == 0) { bp->b_flags |= /* XXX B_DONE | */ B_DELWRI; reassignbuf(bp); - bdirtyadd(); + bdirtyadd(bp); } } @@ -2348,7 +2427,7 @@ bundirty(struct buf *bp) if (bp->b_flags & B_DELWRI) { bp->b_flags &= ~B_DELWRI; reassignbuf(bp); - bdirtysub(); + bdirtysub(bp); } /* * Since it is now being written, we can clear its deferred write flag. @@ -2420,9 +2499,9 @@ void bwillwrite(void) { - if (numdirtybuffers >= hidirtybuffers) { + if (buf_dirty_count_severe()) { mtx_lock(&bdirtylock); - while (numdirtybuffers >= hidirtybuffers) { + while (buf_dirty_count_severe()) { bdirtywait = 1; msleep(&bdirtywait, &bdirtylock, (PRIBIO + 4), "flswai", 0); @@ -2438,7 +2517,7 @@ int buf_dirty_count_severe(void) { - return(numdirtybuffers >= hidirtybuffers); + return (!BIT_EMPTY(BUF_DOMAINS, &bdhidirty)); } /* @@ -2523,7 +2602,7 @@ brelse(struct buf *bp) if (!LIST_EMPTY(&bp->b_dep)) buf_deallocate(bp); if (bp->b_flags & B_DELWRI) - bdirtysub(); + bdirtysub(bp); bp->b_flags &= ~(B_DELWRI | B_CACHE); if ((bp->b_flags & B_VMIO) == 0) { allocbuf(bp, 0); @@ -3136,9 +3215,9 @@ getnewbuf(struct vnode *vp, int slpflag, int slptimeo, else metadata = false; if (vp == NULL) - bd = &bdclean[0]; + bd = &bdomain[0]; else - bd = &bdclean[vp->v_bufobj.bo_domain]; + bd = &bdomain[vp->v_bufobj.bo_domain]; counter_u64_add(getnewbufcalls, 1); reserved = false; @@ -3184,11 +3263,11 @@ static struct kproc_desc buf_kp = { SYSINIT(bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start, &buf_kp); static int -buf_flush(struct vnode *vp, int target) +buf_flush(struct vnode *vp, struct bufdomain *bd, int target) { int flushed; - flushed = flushbufqueues(vp, target, 0); + flushed = flushbufqueues(vp, bd, target, 0); if (flushed == 0) { /* * Could not find any buffers without rollback @@ -3197,7 +3276,7 @@ buf_flush(struct vnode *vp, int target) */ if (vp != NULL && target > 2) target /= 2; - flushbufqueues(vp, target, 1); + flushbufqueues(vp, bd, target, 1); } return (flushed); } @@ -3205,6 +3284,8 @@ buf_flush(struct vnode *vp, int target) static void buf_daemon() { + struct bufdomain *bd; + int speedupreq; int lodirty; int i; @@ -3217,11 +3298,11 @@ buf_daemon() /* * Start the buf clean daemons as children threads. */ - for (i = 0 ; i < clean_domains; i++) { + for (i = 0 ; i < buf_domains; i++) { int error; error = kthread_add((void (*)(void *))bufspace_daemon, - &bdclean[i], curproc, NULL, 0, 0, "bufspacedaemon-%d", i); + &bdomain[i], curproc, NULL, 0, 0, "bufspacedaemon-%d", i); if (error) panic("error %d spawning bufspace daemon", error); } @@ -3236,20 +3317,30 @@ buf_daemon() mtx_unlock(&bdlock); kproc_suspend_check(bufdaemonproc); - lodirty = lodirtybuffers; - if (bd_speedupreq) { - lodirty = numdirtybuffers / 2; - bd_speedupreq = 0; - } + /* - * Do the flush. Limit the amount of in-transit I/O we - * allow to build up, otherwise we would completely saturate - * the I/O system. + * Save speedupreq for this pass and reset to capture new + * requests. */ - while (numdirtybuffers > lodirty) { - if (buf_flush(NULL, numdirtybuffers - lodirty) == 0) - break; - kern_yield(PRI_USER); + speedupreq = bd_speedupreq; + bd_speedupreq = 0; + + /* + * Flush each domain sequentially according to its level and + * the speedup request. + */ + for (i = 0; i < buf_domains; i++) { + bd = &bdomain[i]; + if (speedupreq) + lodirty = bd->bd_numdirtybuffers / 2; + else + lodirty = bd->bd_lodirtybuffers; + while (bd->bd_numdirtybuffers > lodirty) { + if (buf_flush(NULL, bd, + bd->bd_numdirtybuffers - lodirty) == 0) + break; + kern_yield(PRI_USER); + } } /* @@ -3263,7 +3354,7 @@ buf_daemon() * to avoid endless loops on unlockable buffers. */ mtx_lock(&bdlock); - if (numdirtybuffers <= lodirtybuffers) { + if (!BIT_EMPTY(BUF_DOMAINS, &bdlodirty)) { /* * We reached our low water mark, reset the * request and sleep until we are needed again. @@ -3302,7 +3393,8 @@ SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps, CTLFLAG_RW, 0, "Number of buffers flushed with dependecies that require rollbacks"); static int -flushbufqueues(struct vnode *lvp, int target, int flushdeps) +flushbufqueues(struct vnode *lvp, struct bufdomain *bd, int target, + int flushdeps) { struct bufqueue *bq; struct buf *sentinel; @@ -3315,7 +3407,7 @@ flushbufqueues(struct vnode *lvp, int target, int flus bool unlock; flushed = 0; - bq = &bqdirty; + bq = &bd->bd_dirtyq; bp = NULL; sentinel = malloc(sizeof(struct buf), M_TEMP, M_WAITOK | M_ZERO); sentinel->b_qindex = QUEUE_SENTINEL; @@ -3651,7 +3743,7 @@ bp_unmapped_get_kva(struct buf *bp, daddr_t blkno, int panic("GB_NOWAIT_BD and GB_UNMAPPED %p", bp); } counter_u64_add(mappingrestarts, 1); - bufspace_wait(&bdclean[bp->b_domain], bp->b_vp, gbflags, 0, 0); + bufspace_wait(bufdomain(bp), bp->b_vp, gbflags, 0, 0); } has_addr: if (need_mapping) { @@ -3849,7 +3941,7 @@ loop: */ if (flags & GB_NOCREAT) return NULL; - if (bdclean[bo->bo_domain].bd_freebuffers == 0 && + if (bdomain[bo->bo_domain].bd_freebuffers == 0 && TD_IS_IDLETHREAD(curthread)) return NULL; @@ -3906,7 +3998,7 @@ loop: if (gbincore(bo, blkno)) { BO_UNLOCK(bo); bp->b_flags |= B_INVAL; - bufspace_release(&bdclean[bp->b_domain], maxsize); + bufspace_release(bufdomain(bp), maxsize); brelse(bp); goto loop; } @@ -3941,7 +4033,7 @@ loop: } allocbuf(bp, size); - bufspace_release(&bdclean[bp->b_domain], maxsize); + bufspace_release(bufdomain(bp), maxsize); bp->b_flags &= ~B_DONE; } CTR4(KTR_BUF, "getblk(%p, %ld, %d) = %p", vp, (long)blkno, size, bp); @@ -3970,7 +4062,7 @@ geteblk(int size, int flags) return (NULL); } allocbuf(bp, size); - bufspace_release(&bdclean[bp->b_domain], maxsize); + bufspace_release(bufdomain(bp), maxsize); bp->b_flags |= B_INVAL; /* b_dep cleared by getnewbuf() */ BUF_ASSERT_HELD(bp); return (bp); @@ -4839,7 +4931,7 @@ bufobj_init(struct bufobj *bo, void *private) static volatile int bufobj_cleanq; bo->bo_domain = - atomic_fetchadd_int(&bufobj_cleanq, 1) % clean_domains; + atomic_fetchadd_int(&bufobj_cleanq, 1) % buf_domains; rw_init(BO_LOCKPTR(bo), "bufobj interlock"); bo->bo_private = private; TAILQ_INIT(&bo->bo_clean.bv_hd); @@ -5184,10 +5276,9 @@ DB_SHOW_COMMAND(bufqueues, bufqueues) int i, j; db_printf("bqempty: %d\n", bqempty.bq_len); - db_printf("bqdirty: %d\n", bqdirty.bq_len); - for (i = 0; i < clean_domains; i++) { - bd = &bdclean[i]; + for (i = 0; i < buf_domains; i++) { + bd = &bdomain[i]; db_printf("Buf domain %d\n", i); db_printf("\tfreebufs\t%d\n", bd->bd_freebuffers); db_printf("\tlofreebufs\t%d\n", bd->bd_lofreebuffers); @@ -5199,7 +5290,13 @@ 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("\tnumdirtybuffers\t%d\n", bd->bd_numdirtybuffers); + db_printf("\tlodirtybuffers\t%d\n", bd->bd_lodirtybuffers); + db_printf("\thidirtybufferss\t%d\n", bd->bd_hidirtybuffers); + db_printf("\tdirtybufthresh\t%d\n", bd->bd_dirtybufthresh); + db_printf("\n"); db_printf("\tcleanq count\t%d\n", bd->bd_cleanq->bq_len); + db_printf("\tdirtyq count\t%d\n", bd->bd_dirtyq.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 "); From owner-svn-src-user@freebsd.org Mon Mar 12 21:50:00 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 71517F4E062 for ; Mon, 12 Mar 2018 21:50:00 +0000 (UTC) (envelope-from pho@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 23D0D76070; Mon, 12 Mar 2018 21:50:00 +0000 (UTC) (envelope-from pho@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 1A5FA113EE; Mon, 12 Mar 2018 21:50:00 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2CLnxAp043403; Mon, 12 Mar 2018 21:49:59 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2CLnxwo043401; Mon, 12 Mar 2018 21:49:59 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201803122149.w2CLnxwo043401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 12 Mar 2018 21:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330816 - user/pho/stress2/misc X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/misc X-SVN-Commit-Revision: 330816 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, 12 Mar 2018 21:50:00 -0000 Author: pho Date: Mon Mar 12 21:49:59 2018 New Revision: 330816 URL: https://svnweb.freebsd.org/changeset/base/330816 Log: Added two tests for triggering a "newbuf" deadlock. Sponsored by: Dell EMC Isilon Added: user/pho/stress2/misc/fdatasync.sh (contents, props changed) user/pho/stress2/misc/fdatasync2.sh (contents, props changed) Added: user/pho/stress2/misc/fdatasync.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/fdatasync.sh Mon Mar 12 21:49:59 2018 (r330816) @@ -0,0 +1,202 @@ +#!/bin/sh + +# +# Copyright (c) 2018 Dell EMC Isilon +# 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$ +# + +# fdatasync(2) fuzz. + +# Deadlock seen: +# https://people.freebsd.org/~pho/stress/log/fdatasync.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +dir=$RUNDIR +nfiles=500 +[ `df -i $dir | tail -1 | awk '{print $7}'` -lt $nfiles ] && exit 0 + +odir=`pwd` +cd /tmp +sed '1,/^EOF/d' < $odir/$0 > fdatasync.c +rm -f /tmp/fdatasync +mycc -o fdatasync -Wall -Wextra -O2 -g fdatasync.c -lpthread || exit 1 +rm -f fdatasync.c + +mkdir -p $dir && chmod 777 $dir + +cd $dir +jot $nfiles | xargs touch +jot $nfiles | xargs chmod 666 +cd $odir + +(cd /tmp; /tmp/fdatasync $dir) +e=$? + +rm -rf $dir/* /tmp/fdatasync +exit $e +EOF +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define N (128 * 1024 / (int)sizeof(u_int32_t)) +#define RUNTIME 180 +#define THREADS 2 + +static int fd[900]; +static u_int32_t r[N]; +static char *args[2]; + +static unsigned long +makearg(void) +{ + unsigned long val; + + val = arc4random(); +#if defined(__LP64__) + val = (val << 32) | arc4random(); + val = val & 0x00007fffffffffffUL; +#endif + + return(val); +} + +static void * +test(void *arg __unused) +{ + FTS *fts; + FTSENT *p; + int ftsoptions, i, n; + + ftsoptions = FTS_PHYSICAL; + + for (;;) { + for (i = 0; i < N; i++) + r[i] = arc4random(); + if ((fts = fts_open(args, ftsoptions, NULL)) == NULL) + err(1, "fts_open"); + + i = n = 0; + while ((p = fts_read(fts)) != NULL) { + if (fd[i] > 0) + close(fd[i]); + if ((fd[i] = open(p->fts_path, O_RDWR)) == -1) + if ((fd[i] = open(p->fts_path, O_WRONLY)) == + -1) + continue; + if (ftruncate(fd[i], 0) != 0) + err(1, "ftruncate"); + i++; + i = i % nitems(fd); + } + + if (fts_close(fts) == -1) + err(1, "fts_close()"); + sleep(1); + } + return(0); +} + +static void * +calls(void *arg __unused) +{ + off_t offset; + time_t start; + int fd2; + + start = time(NULL); + while ((time(NULL) - start) < RUNTIME) { + fd2 = makearg() % nitems(fd) + 3; + offset = makearg(); + if (lseek(fd2, offset - 1, SEEK_SET) != -1) { + if (write(fd2, "x", 1) != 1) + if (errno != EBADF && errno != ENOSPC && + errno != E2BIG && errno != ESTALE && + errno != EFBIG) + warn("write"); + } else + if (errno != EBADF) + warn("lseek"); + if (fdatasync(fd2) == -1) + if (errno != EBADF) + warn("x"); + + } + + return (0); +} + +int +main(int argc, char **argv) +{ + struct passwd *pw; + pthread_t rp, cp[THREADS]; + int e, i; + + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(1); + } + args[0] = argv[1]; + args[1] = 0; + + if ((pw = getpwnam("nobody")) == NULL) + err(1, "failed to resolve nobody"); + if (setgroups(1, &pw->pw_gid) || + setegid(pw->pw_gid) || setgid(pw->pw_gid) || + seteuid(pw->pw_uid) || setuid(pw->pw_uid)) + err(1, "Can't drop privileges to \"nobody\""); + endpwent(); + + if ((e = pthread_create(&rp, NULL, test, NULL)) != 0) + errc(1, e, "pthread_create"); + usleep(1000); + for (i = 0; i < THREADS; i++) + if ((e = pthread_create(&cp[i], NULL, calls, NULL)) != 0) + errc(1, e, "pthread_create"); + for (i = 0; i < THREADS; i++) + pthread_join(cp[i], NULL); + + return (0); +} Added: user/pho/stress2/misc/fdatasync2.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/fdatasync2.sh Mon Mar 12 21:49:59 2018 (r330816) @@ -0,0 +1,201 @@ +#!/bin/sh + +# +# Copyright (c) 2018 Dell EMC Isilon +# 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$ +# + +# fdatasync(2) fuzz. Variation of fdatasync.sh. +# https://people.freebsd.org/~pho/stress/log/fdatasync2.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +dir=$RUNDIR +nfiles=10000 +[ `df -i $dir | tail -1 | awk '{print $7}'` -lt $nfiles ] && exit 0 + +odir=`pwd` +cd /tmp +sed '1,/^EOF/d' < $odir/$0 > fdatasync2.c +rm -f /tmp/fdatasync2 +mycc -o fdatasync2 -Wall -Wextra -O2 -g fdatasync2.c -lpthread || exit 1 +rm -f fdatasync2.c + +mkdir -p $dir && chmod 777 $dir + +cd $dir +jot $nfiles | xargs touch +jot $nfiles | xargs chmod 666 +cd $odir + +(cd /tmp; /tmp/fdatasync2 $dir) +e=$? + +rm -rf $dir/* /tmp/fdatasync2 +exit $e +EOF +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define N (128 * 1024 / (int)sizeof(u_int32_t)) +#define RUNTIME 180 +#define THREADS 6 + +static int fd[900]; +static u_int32_t r[N]; +static char *args[2]; + +static unsigned long +makearg(void) +{ + unsigned long val; + + val = arc4random(); +#if defined(__LP64__) + val = (val << 32) | arc4random(); + val = val & 0x00007fffffffffffUL; +#endif + + return(val); +} + +static void * +test(void *arg __unused) +{ + FTS *fts; + FTSENT *p; + int ftsoptions, i, n; + + ftsoptions = FTS_PHYSICAL; + + for (;;) { + for (i = 0; i < N; i++) + r[i] = arc4random(); + if ((fts = fts_open(args, ftsoptions, NULL)) == NULL) + err(1, "fts_open"); + + i = n = 0; + while ((p = fts_read(fts)) != NULL) { + if (fd[i] > 0) + close(fd[i]); + if ((fd[i] = open(p->fts_path, O_RDWR)) == -1) + if ((fd[i] = open(p->fts_path, O_WRONLY)) == + -1) + continue; + if (ftruncate(fd[i], 0) != 0) + err(1, "ftruncate"); + i++; + i = i % nitems(fd); + } + + if (fts_close(fts) == -1) + err(1, "fts_close()"); + sleep(1); + } + return(0); +} + +static void * +calls(void *arg __unused) +{ + off_t offset; + time_t start; + int fd2; + + start = time(NULL); + while ((time(NULL) - start) < RUNTIME) { + fd2 = makearg() % nitems(fd) + 3; + offset = makearg(); + if (lseek(fd2, offset - 1, SEEK_SET) != -1) { + if (write(fd2, "x", 1) != 1) + if (errno != EBADF && errno != ENOSPC && + errno != E2BIG && errno != ESTALE && + errno != EFBIG) + warn("write"); + } else + if (errno != EBADF) + warn("lseek"); + if (fdatasync(fd2) == -1) + if (errno != EBADF) + warn("x"); + + } + + return (0); +} + +int +main(int argc, char **argv) +{ + struct passwd *pw; + pthread_t rp, cp[THREADS]; + int e, i, threads; + + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(1); + } + args[0] = argv[1]; + args[1] = 0; + threads = arc4random() % (THREADS -1 ) + 2; /* 2 - THREADS */ + + if ((pw = getpwnam("nobody")) == NULL) + err(1, "failed to resolve nobody"); + if (setgroups(1, &pw->pw_gid) || + setegid(pw->pw_gid) || setgid(pw->pw_gid) || + seteuid(pw->pw_uid) || setuid(pw->pw_uid)) + err(1, "Can't drop privileges to \"nobody\""); + endpwent(); + + if ((e = pthread_create(&rp, NULL, test, NULL)) != 0) + errc(1, e, "pthread_create"); + usleep(1000); + for (i = 0; i < threads; i++) + if ((e = pthread_create(&cp[i], NULL, calls, NULL)) != 0) + errc(1, e, "pthread_create"); + for (i = 0; i < threads; i++) + pthread_join(cp[i], NULL); + + return (0); +} From owner-svn-src-user@freebsd.org Mon Mar 12 22:17:15 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 A897DF4FE3A for ; Mon, 12 Mar 2018 22:17:15 +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 58997776A2; Mon, 12 Mar 2018 22:17:15 +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 537311187D; Mon, 12 Mar 2018 22:17:15 +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 w2CMHFen059219; Mon, 12 Mar 2018 22:17:15 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2CMHEHw059214; Mon, 12 Mar 2018 22:17:14 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803122217.w2CMHEHw059214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 12 Mar 2018 22:17:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330818 - 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: 330818 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, 12 Mar 2018 22:17:15 -0000 Author: jeff Date: Mon Mar 12 22:17:14 2018 New Revision: 330818 URL: https://svnweb.freebsd.org/changeset/base/330818 Log: Provide convenience routines for manipulating domainsets in the kernel. domainset_create() will take a key, validate it, and return a valid domainset that can be placed on an object or other. sysctl_handle_domainset() allows manipulation of policy from sysctl. Use this to make a default vnode domainset. Clean-up some header creep. Define a generic bitset type. Rewrite some string functions to be more generic. Modified: user/jeff/numa/sys/kern/kern_cpuset.c user/jeff/numa/sys/sys/_bitset.h user/jeff/numa/sys/sys/domainset.h user/jeff/numa/sys/sys/proc.h user/jeff/numa/sys/vm/vnode_pager.c Modified: user/jeff/numa/sys/kern/kern_cpuset.c ============================================================================== --- user/jeff/numa/sys/kern/kern_cpuset.c Mon Mar 12 22:10:06 2018 (r330817) +++ user/jeff/numa/sys/kern/kern_cpuset.c Mon Mar 12 22:17:14 2018 (r330818) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -112,6 +114,9 @@ __FBSDID("$FreeBSD$"); * meaning 'curthread'. It may query available cpus for that tid with a * getaffinity call using (CPU_LEVEL_CPUSET, CPU_WHICH_PID, -1, ...). */ + +LIST_HEAD(domainlist, domainset); + static uma_zone_t cpuset_zone; static uma_zone_t domainset_zone; static struct mtx cpuset_lock; @@ -119,6 +124,7 @@ static struct setlist cpuset_ids; static struct domainlist cpuset_domains; static struct unrhdr *cpuset_unr; static struct cpuset *cpuset_zero, *cpuset_default, *cpuset_kernel; +static struct domainset domainset0, domainset2; /* Return the size of cpuset_t at the kernel level */ SYSCTL_INT(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD | CTLFLAG_CAPRD, @@ -477,11 +483,24 @@ _domainset_create(struct domainset *domain, struct dom /* * Create or lookup a domainset based on the key held in 'domain'. */ -static struct domainset * +struct domainset * domainset_create(const struct domainset *domain) { struct domainset *ndomain; + /* + * Validate the policy. It must specify a useable policy number with + * only valid domains. Preferred must include the preferred domain + * in the mask. + */ + if (domain->ds_policy <= DOMAINSET_POLICY_INVALID || + domain->ds_policy > DOMAINSET_POLICY_MAX) + return (NULL); + if (domain->ds_policy == DOMAINSET_POLICY_PREFER && + !DOMAINSET_ISSET(domain->ds_prefer, &domain->ds_mask)) + return (NULL); + if (!DOMAINSET_SUBSET(&domainset0.ds_mask, &domain->ds_mask)) + return (NULL); ndomain = uma_zalloc(domainset_zone, M_WAITOK | M_ZERO); domainset_copy(domain, ndomain); return _domainset_create(ndomain, NULL); @@ -1132,6 +1151,55 @@ out: return (error); } +static int +bitset_strprint(char *buf, size_t bufsiz, const struct bitset *set, int setlen) +{ + size_t bytes; + int i, once; + char *p; + + once = 0; + p = buf; + for (i = 0; i < __bitset_words(setlen); i++) { + if (once != 0) { + if (bufsiz < 1) + return (0); + *p = ','; + p++; + bufsiz--; + } else + once = 1; + if (bufsiz < sizeof(__STRING(ULONG_MAX))) + return (0); + bytes = snprintf(p, bufsiz, "%lx", set->__bits[i]); + p += bytes; + bufsiz -= bytes; + } + return (p - buf); +} + +static int +bitset_strscan(struct bitset *set, int setlen, const char *buf) +{ + int i, ret; + const char *p; + + BIT_ZERO(setlen, set); + p = buf; + for (i = 0; i < __bitset_words(setlen); i++) { + if (*p == ',') { + p++; + continue; + } + ret = sscanf(p, "%lx", &set->__bits[i]); + if (ret == 0 || ret == -1) + break; + while (isxdigit(*p)) + p++; + } + return (p - buf); +} + /* * Return a string representing a valid layout for a cpuset_t object. * It expects an incoming buffer at least sized as CPUSETBUFSIZ. @@ -1139,19 +1207,9 @@ out: char * cpusetobj_strprint(char *buf, const cpuset_t *set) { - char *tbuf; - size_t i, bytesp, bufsiz; - tbuf = buf; - bytesp = 0; - bufsiz = CPUSETBUFSIZ; - - for (i = 0; i < (_NCPUWORDS - 1); i++) { - bytesp = snprintf(tbuf, bufsiz, "%lx,", set->__bits[i]); - bufsiz -= bytesp; - tbuf += bytesp; - } - snprintf(tbuf, bufsiz, "%lx", set->__bits[_NCPUWORDS - 1]); + bitset_strprint(buf, CPUSETBUFSIZ, (const struct bitset *)set, + CPU_SETSIZE); return (buf); } @@ -1162,37 +1220,71 @@ cpusetobj_strprint(char *buf, const cpuset_t *set) int cpusetobj_strscan(cpuset_t *set, const char *buf) { - u_int nwords; - int i, ret; + char p; if (strlen(buf) > CPUSETBUFSIZ - 1) return (-1); - /* Allow to pass a shorter version of the mask when necessary. */ - nwords = 1; - for (i = 0; buf[i] != '\0'; i++) - if (buf[i] == ',') - nwords++; - if (nwords > _NCPUWORDS) + p = buf[bitset_strscan((struct bitset *)set, CPU_SETSIZE, buf)]; + if (p != '\0') return (-1); - CPU_ZERO(set); - for (i = 0; i < (nwords - 1); i++) { - ret = sscanf(buf, "%lx,", &set->__bits[i]); - if (ret == 0 || ret == -1) - return (-1); - buf = strstr(buf, ","); - if (buf == NULL) - return (-1); - buf++; - } - ret = sscanf(buf, "%lx", &set->__bits[nwords - 1]); - if (ret == 0 || ret == -1) - return (-1); return (0); } /* + * Handle a domainset specifier in the sysctl tree. A poiner to a pointer to + * a domainset is in arg1. If the user specifies a valid domainset the + * pointer is updated. + * + * Format is: + * hex mask word 0,hex mask word 1,...:decimal policy:decimal preferred + */ +int +sysctl_handle_domainset(SYSCTL_HANDLER_ARGS) +{ + char buf[DOMAINSETBUFSIZ]; + struct domainset *dset; + struct domainset key; + char *p; + int error; + + dset = *(struct domainset **)arg1; + error = 0; + + if (dset != NULL) { + p = buf + bitset_strprint(buf, DOMAINSETBUFSIZ, + (const struct bitset *)&dset->ds_mask, DOMAINSET_SETSIZE); + sprintf(p, ":%d:%d", dset->ds_policy, dset->ds_prefer); + } else + sprintf(buf, ""); + error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + if (error != 0 || req->newptr == NULL) + return (error); + + /* + * Read in and validate the string. + */ + memset(&key, 0, sizeof(key)); + p = &buf[bitset_strscan((struct bitset *)&key.ds_mask, + DOMAINSET_SETSIZE, buf)]; + if (p == buf) + return (EINVAL); + if (sscanf(p, ":%hd:%hhd", &key.ds_policy, &key.ds_prefer) != 2) + return (EINVAL); + + /* Domainset_create() validates the policy.*/ + dset = domainset_create(&key); + if (dset == NULL) + return (EINVAL); + *(struct domainset **)arg1 = dset; + + return (error); +} + +#ifdef DDB + +/* * Apply an anonymous mask or a domain to a single thread. */ static int @@ -1256,8 +1348,6 @@ cpuset_setithread(lwpid_t id, int cpu) /* * Create the domainset for cpuset 0, 1 and cpuset 2. */ -static struct domainset domainset0, domainset2; - void domainset_zero(void) { @@ -2079,8 +2169,6 @@ out: return (error); } -#ifdef DDB -BITSET_DEFINE(bitset, 1); static void ddb_display_bitset(const struct bitset *set, int size) { Modified: user/jeff/numa/sys/sys/_bitset.h ============================================================================== --- user/jeff/numa/sys/sys/_bitset.h Mon Mar 12 22:10:06 2018 (r330817) +++ user/jeff/numa/sys/sys/_bitset.h Mon Mar 12 22:17:14 2018 (r330818) @@ -57,4 +57,10 @@ struct t { \ */ #define BITSET_DEFINE_VAR(t) BITSET_DEFINE(t, 1) +/* + * Define a default type that can be used while manually specifying size + * to every call. + */ +BITSET_DEFINE(bitset, 1); + #endif /* !_SYS__BITSET_H_ */ Modified: user/jeff/numa/sys/sys/domainset.h ============================================================================== --- user/jeff/numa/sys/sys/domainset.h Mon Mar 12 22:10:06 2018 (r330817) +++ user/jeff/numa/sys/sys/domainset.h Mon Mar 12 22:17:14 2018 (r330818) @@ -28,8 +28,8 @@ * $FreeBSD$ */ -#ifndef _SYS_DOMAINSETSET_H_ -#define _SYS_DOMAINSETSET_H_ +#ifndef _SYS_DOMAINSET_H_ +#define _SYS_DOMAINSET_H_ #include @@ -38,8 +38,12 @@ #define _NDOMAINSETBITS _BITSET_BITS #define _NDOMAINSETWORDS __bitset_words(DOMAINSET_SETSIZE) -#define DOMAINSETSETBUFSIZ ((2 + sizeof(long) * 2) * _NDOMAINSETWORDS) +#define DOMAINSETBUFSIZ \ + (((2 + sizeof(long) * 2) * _NDOMAINSETWORDS) + \ + sizeof("::") + sizeof(__XSTRING(DOMAINSET_POLICY_MAX)) + \ + sizeof(__XSTRING(MAXMEMDOM))) + #define DOMAINSET_CLR(n, p) BIT_CLR(DOMAINSET_SETSIZE, n, p) #define DOMAINSET_COPY(f, t) BIT_COPY(DOMAINSET_SETSIZE, f, t) #define DOMAINSET_ISSET(n, p) BIT_ISSET(DOMAINSET_SETSIZE, n, p) @@ -77,9 +81,6 @@ #define DOMAINSET_POLICY_MAX DOMAINSET_POLICY_INTERLEAVE #ifdef _KERNEL -#include -LIST_HEAD(domainlist, domainset); - #if MAXMEMDOM < 256 typedef uint8_t domainid_t; #else @@ -97,6 +98,16 @@ struct domainset { void domainset_zero(void); +/* + * Add a domainset to the system based on a key initializing policy, prefer, + * and mask. Do not create and directly use domainset structures. The + * returned value will not match the key pointer. + */ +struct domainset *domainset_create(const struct domainset *); +#ifdef _SYS_SYSCTL_H_ +int sysctl_handle_domainset(SYSCTL_HANDLER_ARGS); +#endif + #else __BEGIN_DECLS int cpuset_getdomain(cpulevel_t, cpuwhich_t, id_t, size_t, domainset_t *, @@ -106,4 +117,4 @@ int cpuset_setdomain(cpulevel_t, cpuwhich_t, id_t, siz __END_DECLS #endif -#endif /* !_SYS_DOMAINSETSET_H_ */ +#endif /* !_SYS_DOMAINSET_H_ */ Modified: user/jeff/numa/sys/sys/proc.h ============================================================================== --- user/jeff/numa/sys/sys/proc.h Mon Mar 12 22:10:06 2018 (r330817) +++ user/jeff/numa/sys/sys/proc.h Mon Mar 12 22:17:14 2018 (r330818) @@ -67,7 +67,7 @@ #include #include #include -#include +#include #include /* Machine-dependent proc substruct. */ #ifdef _KERNEL Modified: user/jeff/numa/sys/vm/vnode_pager.c ============================================================================== --- user/jeff/numa/sys/vm/vnode_pager.c Mon Mar 12 22:10:06 2018 (r330817) +++ user/jeff/numa/sys/vm/vnode_pager.c Mon Mar 12 22:17:14 2018 (r330818) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -69,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -108,6 +110,12 @@ struct pagerops vnodepagerops = { int vnode_pbuf_freecnt; int vnode_async_pbuf_freecnt; +static struct domainset *vnode_domainset = NULL; + +SYSCTL_PROC(_debug, OID_AUTO, vnode_domainset, CTLTYPE_STRING | CTLFLAG_RW, + &vnode_domainset, 0, sysctl_handle_domainset, "A", + "Default vnode NUMA policy"); + /* Create the VM system backing object for this vnode */ int vnode_create_vobject(struct vnode *vp, off_t isize, struct thread *td) @@ -242,6 +250,7 @@ retry: object->un_pager.vnp.vnp_size = size; object->un_pager.vnp.writemappings = 0; object->iosize = vp->v_mount->mnt_stat.f_iosize; + object->domain.dr_policy = vnode_domainset; object->handle = handle; VI_LOCK(vp); From owner-svn-src-user@freebsd.org Tue Mar 13 03:53:34 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 74044B7DFED for ; Tue, 13 Mar 2018 03:53:34 +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 2551886AD7; Tue, 13 Mar 2018 03:53:34 +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 2047D14F99; Tue, 13 Mar 2018 03:53:34 +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 w2D3rYK6029675; Tue, 13 Mar 2018 03:53:34 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2D3rXIc029673; Tue, 13 Mar 2018 03:53:33 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803130353.w2D3rXIc029673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 13 Mar 2018 03:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330827 - 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: 330827 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, 13 Mar 2018 03:53:34 -0000 Author: jeff Date: Tue Mar 13 03:53:33 2018 New Revision: 330827 URL: https://svnweb.freebsd.org/changeset/base/330827 Log: Fix a smattering of bugs in my lockless free_count work and a recent merge. There was an overflow bug in vm_domain_allocate(). Some double counting of frees, and a locking bug in reclaim_run that may exist in CURRENT. Reported by: pho Modified: user/jeff/numa/sys/vm/vm_page.c 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 Tue Mar 13 03:02:09 2018 (r330826) +++ user/jeff/numa/sys/vm/vm_page.c Tue Mar 13 03:53:33 2018 (r330827) @@ -184,7 +184,7 @@ static uma_zone_t fakepg_zone; static void vm_page_alloc_check(vm_page_t m); static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); static void vm_page_enqueue(uint8_t queue, vm_page_t m); -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); +static int vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); static void vm_page_init(void *dummy); static int vm_page_insert_after(vm_page_t m, vm_object_t object, vm_pindex_t pindex, vm_page_t mpred); @@ -1733,11 +1733,12 @@ vm_domain_allocate(struct vm_domain *vmd, int req, int /* * Attempt to reserve the pages. Fail if we're below the limit. */ + limit += npages; do { old = vmd->vmd_free_count; - new = old - npages; - if (new < limit) + if (old < limit) return (0); + new = old - npages; } while (atomic_cmpset_int(&vmd->vmd_free_count, old, new) == 0); /* Wake the page daemon if we've crossed the threshold. */ @@ -2233,7 +2234,7 @@ vm_page_release(void *arg, void **store, int cnt) vm_phys_free_pages(m, 0); } vm_domain_free_unlock(vmd); - vm_domain_freecnt_inc(vmd, i); + vm_domain_freecnt_inc(vmd, cnt); } #define VPSC_ANY 0 /* No restrictions. */ @@ -2584,7 +2585,12 @@ retry: m->pindex, m); m->valid = 0; vm_page_undirty(m); - + m->oflags = VPO_UNMANAGED; +#if VM_NRESERVLEVEL > 0 + if (!vm_reserv_free_page(m)) +#endif + SLIST_INSERT_HEAD(&free, m, + plinks.s.ss); /* * The new page must be deactivated * before the object is unlocked. @@ -2597,19 +2603,20 @@ retry: vm_page_remove(m); KASSERT(m->dirty == 0, ("page %p is dirty", m)); - } + m->oflags = VPO_UNMANAGED; #if VM_NRESERVLEVEL > 0 - if (!vm_reserv_free_page(m)) + if (!vm_reserv_free_page(m)) #endif - SLIST_INSERT_HEAD(&free, m, - plinks.s.ss); + SLIST_INSERT_HEAD(&free, m, + plinks.s.ss); + } } else error = EBUSY; unlock: VM_OBJECT_WUNLOCK(object); } else { MPASS(vm_phys_domain(m) == domain); - vm_page_lock(m); + /* XXX order unsynchronized? */ order = m->order; if (order < VM_NFREEORDER) { /* @@ -2626,7 +2633,6 @@ unlock: else if (vm_reserv_is_page_free(m)) order = 0; #endif - vm_page_unlock(m); if (order == VM_NFREEORDER) error = EINVAL; } @@ -3284,16 +3290,18 @@ vm_page_free_prep(vm_page_t m, bool pagequeue_locked) * queues. This is the last step to free a page. The caller is * responsible for adjusting the free page count. */ -static void +static int vm_page_free_phys(struct vm_domain *vmd, vm_page_t m) { vm_domain_free_assert_locked(vmd); #if VM_NRESERVLEVEL > 0 - if (!vm_reserv_free_page(m)) + if (vm_reserv_free_page(m)) + return (0); #endif - vm_phys_free_pages(m, 0); + vm_phys_free_pages(m, 0); + return (1); } void @@ -3317,8 +3325,7 @@ vm_page_free_phys_pglist(struct pglist *tq) vmd = vm_pagequeue_domain(m); vm_domain_free_lock(vmd); } - vm_page_free_phys(vmd, m); - cnt++; + cnt += vm_page_free_phys(vmd, m); } if (vmd != NULL) { vm_domain_free_unlock(vmd); @@ -3339,14 +3346,16 @@ void vm_page_free_toq(vm_page_t m) { struct vm_domain *vmd; + int freed; if (!vm_page_free_prep(m, false)) return; vmd = vm_pagequeue_domain(m); vm_domain_free_lock(vmd); - vm_page_free_phys(vmd, m); + freed = vm_page_free_phys(vmd, m); vm_domain_free_unlock(vmd); - vm_domain_freecnt_inc(vmd, 1); + if (freed) + vm_domain_freecnt_inc(vmd, 1); } /* @@ -3374,11 +3383,8 @@ vm_page_free_pages_toq(struct spglist *free, bool upda while ((m = SLIST_FIRST(free)) != NULL) { count++; SLIST_REMOVE_HEAD(free, plinks.s.ss); - /* XXX batch locks. */ - vm_page_lock(m); if (vm_page_free_prep(m, false)) TAILQ_INSERT_TAIL(&pgl, m, listq); - vm_page_unlock(m); } vm_page_free_phys_pglist(&pgl); Modified: user/jeff/numa/sys/vm/vm_reserv.c ============================================================================== --- user/jeff/numa/sys/vm/vm_reserv.c Tue Mar 13 03:02:09 2018 (r330826) +++ user/jeff/numa/sys/vm/vm_reserv.c Tue Mar 13 03:53:33 2018 (r330827) @@ -455,20 +455,8 @@ 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; - 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); + return (&vm_reserv_array[VM_PAGE_TO_PHYS(m) >> VM_LEVEL_0_SHIFT]); } /* @@ -790,14 +778,14 @@ vm_reserv_alloc_contig(int req, vm_object_t object, vm */ m = NULL; vmd = VM_DOMAIN(domain); - if (vm_domain_allocate(vmd, req, allocpages)) { + if (vm_domain_allocate(vmd, req, npages)) { 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); vm_domain_free_unlock(vmd); if (m == NULL) { - vm_domain_freecnt_inc(vmd, allocpages); + vm_domain_freecnt_inc(vmd, npages); return (NULL); } } else From owner-svn-src-user@freebsd.org Tue Mar 13 03:54:42 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 79288B7E192 for ; Tue, 13 Mar 2018 03:54:42 +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 2AB4486C35; Tue, 13 Mar 2018 03:54:42 +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 25CBF14F9C; Tue, 13 Mar 2018 03:54:42 +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 w2D3sgmb029755; Tue, 13 Mar 2018 03:54:42 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2D3sgen029754; Tue, 13 Mar 2018 03:54:42 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803130354.w2D3sgen029754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 13 Mar 2018 03:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330828 - 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: 330828 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, 13 Mar 2018 03:54:42 -0000 Author: jeff Date: Tue Mar 13 03:54:41 2018 New Revision: 330828 URL: https://svnweb.freebsd.org/changeset/base/330828 Log: Most of the time bufspace_adjust() shouldn't be adjusting anything. In this case don't waste time on an expensive atomic. 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 Tue Mar 13 03:53:33 2018 (r330827) +++ user/jeff/numa/sys/kern/vfs_bio.c Tue Mar 13 03:54:41 2018 (r330828) @@ -613,7 +613,7 @@ bufspace_adjust(struct buf *bp, int bufsize) diff = bufsize - bp->b_bufsize; if (diff < 0) { atomic_subtract_long(&bd->bd_bufspace, -diff); - } else { + } else if (diff > 0) { space = atomic_fetchadd_long(&bd->bd_bufspace, diff); /* Wake up the daemon on the transition. */ if (space < bd->bd_bufspacethresh && From owner-svn-src-user@freebsd.org Tue Mar 13 10:40:12 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 C690FF3987C for ; Tue, 13 Mar 2018 10:40:12 +0000 (UTC) (envelope-from pho@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 7C3B175C91; Tue, 13 Mar 2018 10:40:12 +0000 (UTC) (envelope-from pho@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 770A718CBF; Tue, 13 Mar 2018 10:40:12 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2DAeC2Q029079; Tue, 13 Mar 2018 10:40:12 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2DAeCqM029075; Tue, 13 Mar 2018 10:40:12 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201803131040.w2DAeCqM029075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Tue, 13 Mar 2018 10:40:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330839 - user/pho/stress2/misc X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/misc X-SVN-Commit-Revision: 330839 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, 13 Mar 2018 10:40:13 -0000 Author: pho Date: Tue Mar 13 10:40:11 2018 New Revision: 330839 URL: https://svnweb.freebsd.org/changeset/base/330839 Log: Set KERNBUILDDIR and SYSDIR when building kernel modules. Added a variation of the contigmalloc() tests. Sponsored by: Dell EMC Isilon Added: user/pho/stress2/misc/contigmalloc3.sh (contents, props changed) Modified: user/pho/stress2/misc/contigmalloc.sh user/pho/stress2/misc/contigmalloc2.sh Modified: user/pho/stress2/misc/contigmalloc.sh ============================================================================== --- user/pho/stress2/misc/contigmalloc.sh Tue Mar 13 10:00:14 2018 (r330838) +++ user/pho/stress2/misc/contigmalloc.sh Tue Mar 13 10:40:11 2018 (r330839) @@ -45,6 +45,9 @@ [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 [ -d /usr/src/sys ] || exit 0 +builddir=`sysctl kern.version | grep @ | sed 's/.*://'` +[ -d "$builddir" ] && export KERNBUILDDIR=$builddir || exit 0 +export SYSDIR=`echo $builddir | sed 's#/sys.*#/sys#'` . ../default.cfg Modified: user/pho/stress2/misc/contigmalloc2.sh ============================================================================== --- user/pho/stress2/misc/contigmalloc2.sh Tue Mar 13 10:00:14 2018 (r330838) +++ user/pho/stress2/misc/contigmalloc2.sh Tue Mar 13 10:40:11 2018 (r330839) @@ -35,6 +35,9 @@ [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 [ -d /usr/src/sys ] || exit 0 +builddir=`sysctl kern.version | grep @ | sed 's/.*://'` +[ -d "$builddir" ] && export KERNBUILDDIR=$builddir || exit 0 +export SYSDIR=`echo $builddir | sed 's#/sys.*#/sys#'` . ../default.cfg Added: user/pho/stress2/misc/contigmalloc3.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/contigmalloc3.sh Tue Mar 13 10:40:11 2018 (r330839) @@ -0,0 +1,223 @@ +#!/bin/sh + +# +# Copyright (c) 2014 EMC Corp. +# 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$ +# + +# contigmalloc(9) / contigfree(9) test scenario. +# Test allocation with 1GB + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +[ -d /usr/src/sys ] || exit 0 +builddir=`sysctl kern.version | grep @ | sed 's/.*://'` +[ -d "$builddir" ] && export KERNBUILDDIR=$builddir || exit 0 +export SYSDIR=`echo $builddir | sed 's#/sys.*#/sys#'` + +. ../default.cfg + +odir=`pwd` +dir=/tmp/contigmalloc +rm -rf $dir; mkdir -p $dir +cat > $dir/ctest.c < +#include + +#include +#include +#include +#include +#include + +#define MAXBUF (1LL * 1024 * 1024 * 1024) /* Max buffer size */ +#define TALLOC 1 +#define TFREE 2 + +void +test(int argc, char *argv[]) +{ + long mw, size; + int i, no, ps, res; + char *cp; + + if (argc == 3) { + no = atoi(argv[1]); + mw = atol(argv[2]); + } + if (argc != 3 || no == 0 || mw == 0) + errx(1, "Usage: %s ", argv[0]); + + ps = getpagesize(); + if (mw < MAXBUF / ps) { + fprintf(stderr, "max_wired too small for this test\n"); + exit (0); + } + i = 0; + size = round_page(MAXBUF); + res = syscall(no, TALLOC, &cp, &size); + if (res == -1) { + err(1, "contigmalloc(%lu MB) failed", + size / 1024 / 1024); + } else { +#if defined(TEST) + fprintf(stderr, "contigmalloc(%lu pages) %luMB\n", + size / ps, size / 1024 / 1024); +#endif + } + + res = syscall(no, TFREE, &cp, &size); +#if defined(TEST) + fprintf(stderr, "contigfree(%lu pages) %luMB\n", + size / ps, size / 1024 / 1024); +#endif +} + +int +main(int argc, char *argv[]) +{ + + test(argc, argv); + + return (0); +} + +EOF +mycc -o /tmp/ctest -Wall -Wextra -O0 -g $dir/ctest.c || exit 1 +rm $dir/ctest.c + +cd $dir +cat > Makefile < +EOF + +sed '1,/^EOF2/d' < $odir/$0 > cmalloc.c +make || exit 1 +kldload $dir/cmalloc.ko || exit 1 + +cd $odir +mw=`sysctl -n vm.max_wired` || exit 1 +/tmp/ctest `sysctl -n debug.cmalloc_offset` $mw 2>&1 | tail -5 +kldunload $dir/cmalloc.ko +rm -rf $dir /tmp/ctest +exit 0 + +EOF2 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TALLOC 1 +#define TFREE 2 + +/* + * Hook up a syscall for contigmalloc testing. + */ + +struct cmalloc_args { + int a_op; + void *a_ptr; + void *a_size; +}; + +static int +cmalloc(struct thread *td, struct cmalloc_args *uap) +{ + void *p; + unsigned long size; + int error; + + error = copyin(uap->a_size, &size, sizeof(size)); + if (error != 0) { + return (error); + } + switch (uap->a_op) { + case TFREE: + error = copyin(uap->a_ptr, &p, sizeof(p)); + if (error == 0) { + if (p != NULL) + contigfree(p, size, M_TEMP); + } + return (error); + + case TALLOC: + p = contigmalloc(size, M_TEMP, M_NOWAIT, 0ul, ~0ul, 4096, 0); + if (p != NULL) { + error = copyout(&p, uap->a_ptr, sizeof(p)); + return (error); + } + return (ENOMEM); + } + return (EINVAL); +} + +/* + * The sysent for the new syscall + */ +static struct sysent cmalloc_sysent = { + 3, /* sy_narg */ + (sy_call_t *) cmalloc /* sy_call */ +}; + +/* + * The offset in sysent where the syscall is allocated. + */ +static int cmalloc_offset = NO_SYSCALL; + +SYSCTL_INT(_debug, OID_AUTO, cmalloc_offset, CTLFLAG_RD, &cmalloc_offset, 0, + "cmalloc syscall number"); + +/* + * The function called at load/unload. + */ + +static int +cmalloc_load(struct module *module, int cmd, void *arg) +{ + int error = 0; + + switch (cmd) { + case MOD_LOAD : + break; + case MOD_UNLOAD : + break; + default : + error = EOPNOTSUPP; + break; + } + return (error); +} + +SYSCALL_MODULE(cmalloc_syscall, &cmalloc_offset, &cmalloc_sysent, + cmalloc_load, NULL); From owner-svn-src-user@freebsd.org Tue Mar 13 12:35:38 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 DEE27F4A433 for ; Tue, 13 Mar 2018 12:35:37 +0000 (UTC) (envelope-from pho@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 94EF27AE58; Tue, 13 Mar 2018 12:35:37 +0000 (UTC) (envelope-from pho@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 8F3D519F3D; Tue, 13 Mar 2018 12:35:37 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2DCZb8J088936; Tue, 13 Mar 2018 12:35:37 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2DCZbif088935; Tue, 13 Mar 2018 12:35:37 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201803131235.w2DCZbif088935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Tue, 13 Mar 2018 12:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330840 - user/pho/stress2/misc X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/misc X-SVN-Commit-Revision: 330840 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, 13 Mar 2018 12:35:38 -0000 Author: pho Date: Tue Mar 13 12:35:37 2018 New Revision: 330840 URL: https://svnweb.freebsd.org/changeset/base/330840 Log: Added a kevent(2) test, which has triggered a OOM problem. Sponsored by: Dell EMC Isilon Added: user/pho/stress2/misc/kevent11.sh (contents, props changed) Added: user/pho/stress2/misc/kevent11.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/kevent11.sh Tue Mar 13 12:35:37 2018 (r330840) @@ -0,0 +1,181 @@ +#!/bin/sh + +# +# Copyright (c) 2017 Dell EMC Isilon +# 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$ +# + +# Variation of kevent5.sh +# OOM seen: https://people.freebsd.org/~pho/stress/log/mark018.txt + +. ../default.cfg +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +dir=/tmp +odir=`pwd` +cd $dir +sed '1,/^EOF/d' < $odir/$0 > $dir/kevent11.c +mycc -o kevent11 -Wall -Wextra -O0 -g kevent11.c || exit 1 +rm -f kevent11.c +cd $odir + +set -e +mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint +[ -c /dev/md$mdstart ] && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 2g -u $mdstart +bsdlabel -w md$mdstart auto +newfs $newfs_flags md${mdstart}$part > /dev/null +mount /dev/md${mdstart}$part $mntpoint +set +e + +(cd $odir/../testcases/swap; ./swap -t 5m -i 20 -h -l 100 > /dev/null) & +cd $mntpoint +$dir/kevent11 +s=$? +[ -f kevent11.core -a $s -eq 0 ] && + { ls -l kevent11.core; mv kevent11.core /tmp; s=1; } +cd $odir +while pkill -9 swap; do :; done +wait + +for i in `jot 6`; do + mount | grep -q "on $mntpoint " || break + umount $mntpoint && break || sleep 10 +done +[ $i -eq 6 ] && exit 1 +mdconfig -d -u $mdstart +rm -rf $dir/kevent11 +exit $s + +EOF +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static volatile u_int *share; +static char *file = "file"; + +#define PARALLEL 256 +#define RUNTIME (3 * 60) +#define SYNC 0 + +static void +test(void) +{ + struct kevent ev[2]; + struct timespec ts; + int kq = -1; + int fd, n; + + if ((fd = open(file, O_RDONLY, 0)) == -1) + err(1, "open(%s). %s:%d", file, __func__, __LINE__); + + if ((kq = kqueue()) < 0) + err(1, "kqueue()"); + + n = 0; + EV_SET(&ev[n], fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, + NOTE_DELETE, 0, 0); + n++; + + if (kevent(kq, ev, n, NULL, 0, NULL) < 0) + err(1, "kevent()"); + + setproctitle("presync"); + atomic_add_int(&share[SYNC], 1); + while (share[SYNC] != PARALLEL) + usleep(10000); + setproctitle("postsync"); + + memset(&ev, 0, sizeof(ev)); + n = kevent(kq, NULL, 0, ev, 1, &ts); + close(fd); + close(kq); + + _exit(0); +} + +int +main(void) +{ + pid_t pids[PARALLEL]; + size_t len; + time_t start; + int e, fd, i, status; + + e = 0; + len = PAGE_SIZE; + if ((share = mmap(NULL, len, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_SHARED, -1, 0)) == MAP_FAILED) + err(1, "mmap"); + + start = time(NULL); + while ((time(NULL) - start) < RUNTIME && e == 0) { + if ((fd = open(file, O_CREAT | O_TRUNC | O_RDWR, 0660)) == + -1) + err(1, "open(%s)", file); + close(fd); + share[SYNC] = 0; + for (i = 0; i < PARALLEL; i++) { + + if ((pids[i] = fork()) == 0) + test(); + if (pids[i] == -1) + err(1, "fork()"); + } + while (share[SYNC] != PARALLEL) + usleep(10000); + if (unlink(file) == -1) + err(1, "unlink(%s). %s:%d\n", file, + __FILE__, __LINE__); + for (i = 0; i < PARALLEL; i++) { + if (waitpid(pids[i], &status, 0) == -1) + err(1, "waitpid(%d)", pids[i]); + if (status != 0) { + if (WIFSIGNALED(status)) + fprintf(stderr, + "pid %d exit signal %d\n", + pids[i], WTERMSIG(status)); + } + e += status == 0 ? 0 : 1; + } + } + + return (e); +} From owner-svn-src-user@freebsd.org Tue Mar 13 12:38:27 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 3CB94F4A7D8 for ; Tue, 13 Mar 2018 12:38:27 +0000 (UTC) (envelope-from pho@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 DFA887B071; Tue, 13 Mar 2018 12:38:26 +0000 (UTC) (envelope-from pho@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 DA8D419F40; Tue, 13 Mar 2018 12:38:26 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2DCcQkJ089064; Tue, 13 Mar 2018 12:38:26 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2DCcQ0g089063; Tue, 13 Mar 2018 12:38:26 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201803131238.w2DCcQ0g089063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Tue, 13 Mar 2018 12:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330841 - user/pho/stress2/misc X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/misc X-SVN-Commit-Revision: 330841 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, 13 Mar 2018 12:38:27 -0000 Author: pho Date: Tue Mar 13 12:38:26 2018 New Revision: 330841 URL: https://svnweb.freebsd.org/changeset/base/330841 Log: Do not loop forever on an umount failure. Return fsck status code. Sponsored by: Dell EMC Isilon Modified: user/pho/stress2/misc/full.sh Modified: user/pho/stress2/misc/full.sh ============================================================================== --- user/pho/stress2/misc/full.sh Tue Mar 13 12:35:37 2018 (r330840) +++ user/pho/stress2/misc/full.sh Tue Mar 13 12:38:26 2018 (r330841) @@ -57,8 +57,12 @@ export TESTPROGS=`cd ..; find testcases/ -perm -1 -typ su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' ../tools/killall.sh -while mount | grep "on $mntpoint " | grep -q /dev/md; do - umount $mntpoint || sleep 1 +for i in `jot 6`; do + mount | grep -q "on $mntpoint " || break + umount $mntpoint && break || sleep 10 + [ $i -eq 6 ] && + { echo FATAL; fstat -mf $mntpoint; exit 1; } done -checkfs /dev/md${mdstart}$part +checkfs /dev/md${mdstart}$part; s=$? mdconfig -d -u $mdstart +return $s From owner-svn-src-user@freebsd.org Tue Mar 13 17:57:54 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 651A2F37AE4 for ; Tue, 13 Mar 2018 17:57:54 +0000 (UTC) (envelope-from markj@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 1AD3D6C03E; Tue, 13 Mar 2018 17:57:54 +0000 (UTC) (envelope-from markj@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 1126C1D116; Tue, 13 Mar 2018 17:57:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2DHvrvN051452; Tue, 13 Mar 2018 17:57:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2DHvrJV051451; Tue, 13 Mar 2018 17:57:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803131757.w2DHvrJV051451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 13 Mar 2018 17:57:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330869 - user/markj/vm-playground/sys/vm X-SVN-Group: user X-SVN-Commit-Author: markj X-SVN-Commit-Paths: user/markj/vm-playground/sys/vm X-SVN-Commit-Revision: 330869 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, 13 Mar 2018 17:57:54 -0000 Author: markj Date: Tue Mar 13 17:57:53 2018 New Revision: 330869 URL: https://svnweb.freebsd.org/changeset/base/330869 Log: Make VM_BATCHQ_FOREACH safe. Modified: user/markj/vm-playground/sys/vm/vm_pagequeue.h Modified: user/markj/vm-playground/sys/vm/vm_pagequeue.h ============================================================================== --- user/markj/vm-playground/sys/vm/vm_pagequeue.h Tue Mar 13 17:10:52 2018 (r330868) +++ user/markj/vm-playground/sys/vm/vm_pagequeue.h Tue Mar 13 17:57:53 2018 (r330869) @@ -82,10 +82,10 @@ struct vm_batchqueue { int bq_cnt; } __aligned(CACHE_LINE_SIZE); -#define VM_BATCHQ_FOREACH(batchqp, page) \ - page = (batchqp)->bq_pa[0]; \ - for (int __index = 0; __index < (batchqp)->bq_cnt; \ - __index++, (page) = (batchqp)->bq_pa[__index]) +#define VM_BATCHQ_FOREACH(batchqp, page) \ + for (vm_page_t *__mp = &(batchqp)->bq_pa[0]; \ + (page) = *__mp, __mp != &(batchqp)->bq_pa[(batchqp)->bq_cnt]; \ + __mp++) #include #include From owner-svn-src-user@freebsd.org Tue Mar 13 18:33: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 C855FF40185 for ; Tue, 13 Mar 2018 18:33:51 +0000 (UTC) (envelope-from markj@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 7BE2E6E04B; Tue, 13 Mar 2018 18:33:51 +0000 (UTC) (envelope-from markj@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 75E5F1D781; Tue, 13 Mar 2018 18:33:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2DIXpXU071066; Tue, 13 Mar 2018 18:33:51 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2DIXpWU071061; Tue, 13 Mar 2018 18:33:51 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803131833.w2DIXpWU071061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 13 Mar 2018 18:33:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330873 - in user/markj/vm-playground/sys: kern sys vm X-SVN-Group: user X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in user/markj/vm-playground/sys: kern sys vm X-SVN-Commit-Revision: 330873 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, 13 Mar 2018 18:33:52 -0000 Author: markj Date: Tue Mar 13 18:33:50 2018 New Revision: 330873 URL: https://svnweb.freebsd.org/changeset/base/330873 Log: Merge from user/jeff/numa at r330828. Modified: user/markj/vm-playground/sys/kern/kern_cpuset.c user/markj/vm-playground/sys/kern/vfs_bio.c user/markj/vm-playground/sys/sys/_bitset.h user/markj/vm-playground/sys/sys/domainset.h user/markj/vm-playground/sys/sys/proc.h user/markj/vm-playground/sys/vm/vm_domainset.c user/markj/vm-playground/sys/vm/vm_page.c user/markj/vm-playground/sys/vm/vm_pageout.c user/markj/vm-playground/sys/vm/vm_phys.h user/markj/vm-playground/sys/vm/vm_reserv.c user/markj/vm-playground/sys/vm/vnode_pager.c Directory Properties: user/markj/vm-playground/ (props changed) Modified: user/markj/vm-playground/sys/kern/kern_cpuset.c ============================================================================== --- user/markj/vm-playground/sys/kern/kern_cpuset.c Tue Mar 13 18:30:26 2018 (r330872) +++ user/markj/vm-playground/sys/kern/kern_cpuset.c Tue Mar 13 18:33:50 2018 (r330873) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -112,6 +114,9 @@ __FBSDID("$FreeBSD$"); * meaning 'curthread'. It may query available cpus for that tid with a * getaffinity call using (CPU_LEVEL_CPUSET, CPU_WHICH_PID, -1, ...). */ + +LIST_HEAD(domainlist, domainset); + static uma_zone_t cpuset_zone; static uma_zone_t domainset_zone; static struct mtx cpuset_lock; @@ -119,6 +124,7 @@ static struct setlist cpuset_ids; static struct domainlist cpuset_domains; static struct unrhdr *cpuset_unr; static struct cpuset *cpuset_zero, *cpuset_default, *cpuset_kernel; +static struct domainset domainset0, domainset2; /* Return the size of cpuset_t at the kernel level */ SYSCTL_INT(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD | CTLFLAG_CAPRD, @@ -477,11 +483,24 @@ _domainset_create(struct domainset *domain, struct dom /* * Create or lookup a domainset based on the key held in 'domain'. */ -static struct domainset * +struct domainset * domainset_create(const struct domainset *domain) { struct domainset *ndomain; + /* + * Validate the policy. It must specify a useable policy number with + * only valid domains. Preferred must include the preferred domain + * in the mask. + */ + if (domain->ds_policy <= DOMAINSET_POLICY_INVALID || + domain->ds_policy > DOMAINSET_POLICY_MAX) + return (NULL); + if (domain->ds_policy == DOMAINSET_POLICY_PREFER && + !DOMAINSET_ISSET(domain->ds_prefer, &domain->ds_mask)) + return (NULL); + if (!DOMAINSET_SUBSET(&domainset0.ds_mask, &domain->ds_mask)) + return (NULL); ndomain = uma_zalloc(domainset_zone, M_WAITOK | M_ZERO); domainset_copy(domain, ndomain); return _domainset_create(ndomain, NULL); @@ -1132,6 +1151,55 @@ out: return (error); } +static int +bitset_strprint(char *buf, size_t bufsiz, const struct bitset *set, int setlen) +{ + size_t bytes; + int i, once; + char *p; + + once = 0; + p = buf; + for (i = 0; i < __bitset_words(setlen); i++) { + if (once != 0) { + if (bufsiz < 1) + return (0); + *p = ','; + p++; + bufsiz--; + } else + once = 1; + if (bufsiz < sizeof(__STRING(ULONG_MAX))) + return (0); + bytes = snprintf(p, bufsiz, "%lx", set->__bits[i]); + p += bytes; + bufsiz -= bytes; + } + return (p - buf); +} + +static int +bitset_strscan(struct bitset *set, int setlen, const char *buf) +{ + int i, ret; + const char *p; + + BIT_ZERO(setlen, set); + p = buf; + for (i = 0; i < __bitset_words(setlen); i++) { + if (*p == ',') { + p++; + continue; + } + ret = sscanf(p, "%lx", &set->__bits[i]); + if (ret == 0 || ret == -1) + break; + while (isxdigit(*p)) + p++; + } + return (p - buf); +} + /* * Return a string representing a valid layout for a cpuset_t object. * It expects an incoming buffer at least sized as CPUSETBUFSIZ. @@ -1139,19 +1207,9 @@ out: char * cpusetobj_strprint(char *buf, const cpuset_t *set) { - char *tbuf; - size_t i, bytesp, bufsiz; - tbuf = buf; - bytesp = 0; - bufsiz = CPUSETBUFSIZ; - - for (i = 0; i < (_NCPUWORDS - 1); i++) { - bytesp = snprintf(tbuf, bufsiz, "%lx,", set->__bits[i]); - bufsiz -= bytesp; - tbuf += bytesp; - } - snprintf(tbuf, bufsiz, "%lx", set->__bits[_NCPUWORDS - 1]); + bitset_strprint(buf, CPUSETBUFSIZ, (const struct bitset *)set, + CPU_SETSIZE); return (buf); } @@ -1162,37 +1220,71 @@ cpusetobj_strprint(char *buf, const cpuset_t *set) int cpusetobj_strscan(cpuset_t *set, const char *buf) { - u_int nwords; - int i, ret; + char p; if (strlen(buf) > CPUSETBUFSIZ - 1) return (-1); - /* Allow to pass a shorter version of the mask when necessary. */ - nwords = 1; - for (i = 0; buf[i] != '\0'; i++) - if (buf[i] == ',') - nwords++; - if (nwords > _NCPUWORDS) + p = buf[bitset_strscan((struct bitset *)set, CPU_SETSIZE, buf)]; + if (p != '\0') return (-1); - CPU_ZERO(set); - for (i = 0; i < (nwords - 1); i++) { - ret = sscanf(buf, "%lx,", &set->__bits[i]); - if (ret == 0 || ret == -1) - return (-1); - buf = strstr(buf, ","); - if (buf == NULL) - return (-1); - buf++; - } - ret = sscanf(buf, "%lx", &set->__bits[nwords - 1]); - if (ret == 0 || ret == -1) - return (-1); return (0); } /* + * Handle a domainset specifier in the sysctl tree. A poiner to a pointer to + * a domainset is in arg1. If the user specifies a valid domainset the + * pointer is updated. + * + * Format is: + * hex mask word 0,hex mask word 1,...:decimal policy:decimal preferred + */ +int +sysctl_handle_domainset(SYSCTL_HANDLER_ARGS) +{ + char buf[DOMAINSETBUFSIZ]; + struct domainset *dset; + struct domainset key; + char *p; + int error; + + dset = *(struct domainset **)arg1; + error = 0; + + if (dset != NULL) { + p = buf + bitset_strprint(buf, DOMAINSETBUFSIZ, + (const struct bitset *)&dset->ds_mask, DOMAINSET_SETSIZE); + sprintf(p, ":%d:%d", dset->ds_policy, dset->ds_prefer); + } else + sprintf(buf, ""); + error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + if (error != 0 || req->newptr == NULL) + return (error); + + /* + * Read in and validate the string. + */ + memset(&key, 0, sizeof(key)); + p = &buf[bitset_strscan((struct bitset *)&key.ds_mask, + DOMAINSET_SETSIZE, buf)]; + if (p == buf) + return (EINVAL); + if (sscanf(p, ":%hd:%hhd", &key.ds_policy, &key.ds_prefer) != 2) + return (EINVAL); + + /* Domainset_create() validates the policy.*/ + dset = domainset_create(&key); + if (dset == NULL) + return (EINVAL); + *(struct domainset **)arg1 = dset; + + return (error); +} + +#ifdef DDB + +/* * Apply an anonymous mask or a domain to a single thread. */ static int @@ -1256,8 +1348,6 @@ cpuset_setithread(lwpid_t id, int cpu) /* * Create the domainset for cpuset 0, 1 and cpuset 2. */ -static struct domainset domainset0, domainset2; - void domainset_zero(void) { @@ -2079,8 +2169,6 @@ out: return (error); } -#ifdef DDB -BITSET_DEFINE(bitset, 1); static void ddb_display_bitset(const struct bitset *set, int size) { Modified: user/markj/vm-playground/sys/kern/vfs_bio.c ============================================================================== --- user/markj/vm-playground/sys/kern/vfs_bio.c Tue Mar 13 18:30:26 2018 (r330872) +++ user/markj/vm-playground/sys/kern/vfs_bio.c Tue Mar 13 18:33:50 2018 (r330873) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -100,6 +101,7 @@ struct buf_ops buf_ops_bio = { .bop_bdflush = bufbdflush, }; +struct bufdomain; static struct buf *buf; /* buffer header pool */ extern struct buf *swbuf; /* Swap buffer header pool. */ caddr_t unmapped_buf; @@ -123,8 +125,8 @@ static int vfs_bio_clcheck(struct vnode *vp, int size, daddr_t lblkno, daddr_t blkno); static void breada(struct vnode *, daddr_t *, int *, int, struct ucred *, int, void (*)(struct buf *)); -static int buf_flush(struct vnode *vp, int); -static int flushbufqueues(struct vnode *, int, int); +static int buf_flush(struct vnode *vp, struct bufdomain *, int); +static int flushbufqueues(struct vnode *, struct bufdomain *, int, int); static void buf_daemon(void); static __inline void bd_wakeup(void); static int sysctl_runningspace(SYSCTL_HANDLER_ARGS); @@ -133,6 +135,7 @@ static void bufkva_free(struct buf *); static int buf_import(void *, void **, int, int, int); static void buf_release(void *, void **, int); static void maxbcachebuf_adjust(void); +static inline struct bufdomain *bufdomain(struct buf *); static int sysctl_bufspace(SYSCTL_HANDLER_ARGS); int vmiodirenable = TRUE; @@ -147,22 +150,22 @@ static counter_u64_t bufkvaspace; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, bufkvaspace, CTLFLAG_RD, &bufkvaspace, "Kernel virtual memory used for buffers"); static long maxbufspace; -SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RW, &maxbufspace, 0, +SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, "Maximum allowed value of bufspace (including metadata)"); static long bufmallocspace; SYSCTL_LONG(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0, "Amount of malloced memory for buffers"); static long maxbufmallocspace; -SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, +SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RD, &maxbufmallocspace, 0, "Maximum amount of malloced memory for buffers"); static long lobufspace; -SYSCTL_LONG(_vfs, OID_AUTO, lobufspace, CTLFLAG_RW, &lobufspace, 0, +SYSCTL_LONG(_vfs, OID_AUTO, lobufspace, CTLFLAG_RD, &lobufspace, 0, "Minimum amount of buffers we want to have"); long hibufspace; -SYSCTL_LONG(_vfs, OID_AUTO, hibufspace, CTLFLAG_RW, &hibufspace, 0, +SYSCTL_LONG(_vfs, OID_AUTO, hibufspace, CTLFLAG_RD, &hibufspace, 0, "Maximum allowed value of bufspace (excluding metadata)"); long bufspacethresh; -SYSCTL_LONG(_vfs, OID_AUTO, bufspacethresh, CTLFLAG_RW, &bufspacethresh, +SYSCTL_LONG(_vfs, OID_AUTO, bufspacethresh, CTLFLAG_RD, &bufspacethresh, 0, "Bufspace consumed before waking the daemon to free some"); static counter_u64_t buffreekvacnt; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, buffreekvacnt, CTLFLAG_RW, &buffreekvacnt, @@ -190,26 +193,27 @@ SYSCTL_INT(_vfs, OID_AUTO, altbufferflushes, CTLFLAG_R static int recursiveflushes; SYSCTL_INT(_vfs, OID_AUTO, recursiveflushes, CTLFLAG_RW, &recursiveflushes, 0, "Number of flushes skipped due to being recursive"); -static int numdirtybuffers; -SYSCTL_INT(_vfs, OID_AUTO, numdirtybuffers, CTLFLAG_RD, &numdirtybuffers, 0, +static int sysctl_numdirtybuffers(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers, + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RD, NULL, 0, sysctl_numdirtybuffers, "I", "Number of buffers that are dirty (has unwritten changes) at the moment"); static int lodirtybuffers; -SYSCTL_INT(_vfs, OID_AUTO, lodirtybuffers, CTLFLAG_RW, &lodirtybuffers, 0, +SYSCTL_INT(_vfs, OID_AUTO, lodirtybuffers, CTLFLAG_RD, &lodirtybuffers, 0, "How many buffers we want to have free before bufdaemon can sleep"); static int hidirtybuffers; -SYSCTL_INT(_vfs, OID_AUTO, hidirtybuffers, CTLFLAG_RW, &hidirtybuffers, 0, +SYSCTL_INT(_vfs, OID_AUTO, hidirtybuffers, CTLFLAG_RD, &hidirtybuffers, 0, "When the number of dirty buffers is considered severe"); int dirtybufthresh; -SYSCTL_INT(_vfs, OID_AUTO, dirtybufthresh, CTLFLAG_RW, &dirtybufthresh, +SYSCTL_INT(_vfs, OID_AUTO, dirtybufthresh, CTLFLAG_RD, &dirtybufthresh, 0, "Number of bdwrite to bawrite conversions to clear dirty buffers"); static int numfreebuffers; SYSCTL_INT(_vfs, OID_AUTO, numfreebuffers, CTLFLAG_RD, &numfreebuffers, 0, "Number of free buffers"); static int lofreebuffers; -SYSCTL_INT(_vfs, OID_AUTO, lofreebuffers, CTLFLAG_RW, &lofreebuffers, 0, +SYSCTL_INT(_vfs, OID_AUTO, lofreebuffers, CTLFLAG_RD, &lofreebuffers, 0, "Target number of free buffers"); static int hifreebuffers; -SYSCTL_INT(_vfs, OID_AUTO, hifreebuffers, CTLFLAG_RW, &hifreebuffers, 0, +SYSCTL_INT(_vfs, OID_AUTO, hifreebuffers, CTLFLAG_RD, &hifreebuffers, 0, "Threshold for clean buffer recycling"); static counter_u64_t getnewbufcalls; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RD, @@ -308,10 +312,10 @@ struct bufqueue { #define BQ_ASSERT_LOCKED(bq) mtx_assert(BQ_LOCKPTR((bq)), MA_OWNED) struct bufqueue __exclusive_cache_line bqempty; -struct bufqueue __exclusive_cache_line bqdirty; struct bufdomain { struct bufqueue bd_subq[MAXCPU + 1]; /* Per-cpu sub queues + global */ + struct bufqueue bd_dirtyq; struct bufqueue *bd_cleanq; struct mtx_padalign bd_run_lock; /* Constants */ @@ -321,10 +325,14 @@ struct bufdomain { long bd_bufspacethresh; int bd_hifreebuffers; int bd_lofreebuffers; + int bd_hidirtybuffers; + int bd_lodirtybuffers; + int bd_dirtybufthresh; int bd_lim; /* atomics */ int bd_wanted; - int __aligned(CACHE_LINE_SIZE) bd_running; + int __aligned(CACHE_LINE_SIZE) bd_numdirtybuffers; + int __aligned(CACHE_LINE_SIZE) bd_running; long __aligned(CACHE_LINE_SIZE) bd_bufspace; int __aligned(CACHE_LINE_SIZE) bd_freebuffers; } __aligned(CACHE_LINE_SIZE); @@ -336,15 +344,19 @@ struct bufdomain { #define BD_RUN_LOCKPTR(bd) (&(bd)->bd_run_lock) #define BD_RUN_LOCK(bd) mtx_lock(BD_RUN_LOCKPTR((bd))) #define BD_RUN_UNLOCK(bd) mtx_unlock(BD_RUN_LOCKPTR((bd))) -#define BD_DOMAIN(bd) (bd - bdclean) +#define BD_DOMAIN(bd) (bd - bdomain) -/* Maximum number of clean buffer domains. */ -#define CLEAN_DOMAINS 8 +/* Maximum number of buffer domains. */ +#define BUF_DOMAINS 8 +BITSET_DEFINE(bufdomainset, BUF_DOMAINS); +struct bufdomainset bdlodirty; /* Domains > lodirty */ +struct bufdomainset bdhidirty; /* Domains > hidirty */ + /* Configured number of clean queues. */ -static int __read_mostly clean_domains; +static int __read_mostly buf_domains; -struct bufdomain __exclusive_cache_line bdclean[CLEAN_DOMAINS]; +struct bufdomain __exclusive_cache_line bdomain[BUF_DOMAINS]; static void bq_remove(struct bufqueue *bq, struct buf *bp); static void bq_insert(struct bufqueue *bq, struct buf *bp, bool unlock); @@ -403,8 +415,8 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) int i; lvalue = 0; - for (i = 0; i < clean_domains; i++) - lvalue += bdclean[i].bd_bufspace; + for (i = 0; i < buf_domains; i++) + lvalue += bdomain[i].bd_bufspace; if (sizeof(int) == sizeof(long) || req->oldlen >= sizeof(long)) return (sysctl_handle_long(oidp, &lvalue, 0, req)); if (lvalue > INT_MAX) @@ -421,12 +433,24 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) int i; lvalue = 0; - for (i = 0; i < clean_domains; i++) - lvalue += bdclean[i].bd_bufspace; + for (i = 0; i < buf_domains; i++) + lvalue += bdomain[i].bd_bufspace; return (sysctl_handle_long(oidp, &lvalue, 0, req)); } #endif +static int +sysctl_numdirtybuffers(SYSCTL_HANDLER_ARGS) +{ + int value; + int i; + + value = 0; + for (i = 0; i < buf_domains; i++) + value += bdomain[i].bd_numdirtybuffers; + return (sysctl_handle_int(oidp, &value, 0, req)); +} + /* * bdirtywakeup: * @@ -444,18 +468,59 @@ bdirtywakeup(void) } /* + * bd_clear: + * + * Clear a domain from the appropriate bitsets when dirtybuffers + * is decremented. + */ +static void +bd_clear(struct bufdomain *bd) +{ + + mtx_lock(&bdirtylock); + if (bd->bd_numdirtybuffers <= bd->bd_lodirtybuffers) + BIT_CLR(BUF_DOMAINS, BD_DOMAIN(bd), &bdlodirty); + if (bd->bd_numdirtybuffers <= bd->bd_hidirtybuffers) + BIT_CLR(BUF_DOMAINS, BD_DOMAIN(bd), &bdhidirty); + mtx_unlock(&bdirtylock); +} + +/* + * bd_set: + * + * Set a domain in the appropriate bitsets when dirtybuffers + * is incremented. + */ +static void +bd_set(struct bufdomain *bd) +{ + + mtx_lock(&bdirtylock); + if (bd->bd_numdirtybuffers > bd->bd_lodirtybuffers) + BIT_SET(BUF_DOMAINS, BD_DOMAIN(bd), &bdlodirty); + if (bd->bd_numdirtybuffers > bd->bd_hidirtybuffers) + BIT_SET(BUF_DOMAINS, BD_DOMAIN(bd), &bdhidirty); + mtx_unlock(&bdirtylock); +} + +/* * bdirtysub: * * Decrement the numdirtybuffers count by one and wakeup any * threads blocked in bwillwrite(). */ static void -bdirtysub(void) +bdirtysub(struct buf *bp) { + struct bufdomain *bd; + int num; - if (atomic_fetchadd_int(&numdirtybuffers, -1) == - (lodirtybuffers + hidirtybuffers) / 2) + bd = bufdomain(bp); + num = atomic_fetchadd_int(&bd->bd_numdirtybuffers, -1); + if (num == (bd->bd_lodirtybuffers + bd->bd_hidirtybuffers) / 2) bdirtywakeup(); + if (num == bd->bd_lodirtybuffers || num == bd->bd_hidirtybuffers) + bd_clear(bd); } /* @@ -465,16 +530,21 @@ bdirtysub(void) * daemon if needed. */ static void -bdirtyadd(void) +bdirtyadd(struct buf *bp) { + struct bufdomain *bd; + int num; /* * Only do the wakeup once as we cross the boundary. The * buf daemon will keep running until the condition clears. */ - if (atomic_fetchadd_int(&numdirtybuffers, 1) == - (lodirtybuffers + hidirtybuffers) / 2) + bd = bufdomain(bp); + num = atomic_fetchadd_int(&bd->bd_numdirtybuffers, 1); + if (num == (bd->bd_lodirtybuffers + bd->bd_hidirtybuffers) / 2) bd_wakeup(); + if (num == bd->bd_lodirtybuffers || num == bd->bd_hidirtybuffers) + bd_set(bd); } /* @@ -539,11 +609,11 @@ bufspace_adjust(struct buf *bp, int bufsize) KASSERT((bp->b_flags & B_MALLOC) == 0, ("bufspace_adjust: malloc buf %p", bp)); - bd = &bdclean[bp->b_domain]; + bd = bufdomain(bp); diff = bufsize - bp->b_bufsize; if (diff < 0) { atomic_subtract_long(&bd->bd_bufspace, -diff); - } else { + } else if (diff > 0) { space = atomic_fetchadd_long(&bd->bd_bufspace, diff); /* Wake up the daemon on the transition. */ if (space < bd->bd_bufspacethresh && @@ -638,7 +708,7 @@ bufspace_wait(struct bufdomain *bd, struct vnode *vp, * recursion. */ td->td_pflags |= TDP_BUFNEED | TDP_NORUNNINGBUF; - fl = buf_flush(vp, flushbufqtarget); + fl = buf_flush(vp, bd, flushbufqtarget); td->td_pflags &= norunbuf; BD_LOCK(bd); if (fl != 0) @@ -700,7 +770,6 @@ bufspace_daemon(void *arg) if (buf_recycle(bd, false) != 0) { if (bd_flushall(bd)) continue; - bd_speedup(); BD_LOCK(bd); if (bd->bd_wanted) { msleep(&bd->bd_wanted, BD_LOCKPTR(bd), @@ -1026,7 +1095,6 @@ bufinit(void) ("maxbcachebuf (%d) must be >= MAXBSIZE (%d)\n", maxbcachebuf, MAXBSIZE)); bq_init(&bqempty, QUEUE_EMPTY, -1, "bufq empty lock"); - bq_init(&bqdirty, QUEUE_DIRTY, -1, "bufq dirty lock"); mtx_init(&rbreqlock, "runningbufspace lock", NULL, MTX_DEF); mtx_init(&bdlock, "buffer daemon lock", NULL, MTX_DEF); mtx_init(&bdirtylock, "dirty buf lock", NULL, MTX_DEF); @@ -1094,7 +1162,6 @@ bufinit(void) */ hidirtybuffers = nbuf / 4 + 20; dirtybufthresh = hidirtybuffers * 9 / 10; - numdirtybuffers = 0; /* * To support extreme low-memory systems, make sure hidirtybuffers * cannot eat up all available buffer space. This occurs when our @@ -1129,22 +1196,26 @@ bufinit(void) * One queue per-256mb up to the max. More queues gives better * concurrency but less accurate LRU. */ - clean_domains = MIN(howmany(maxbufspace, 256*1024*1024), CLEAN_DOMAINS); - for (i = 0 ; i < clean_domains; i++) { + buf_domains = MIN(howmany(maxbufspace, 256*1024*1024), BUF_DOMAINS); + for (i = 0 ; i < buf_domains; i++) { struct bufdomain *bd; - bd = &bdclean[i]; + bd = &bdomain[i]; bd_init(bd); - bd->bd_freebuffers = nbuf / clean_domains; - bd->bd_hifreebuffers = hifreebuffers / clean_domains; - bd->bd_lofreebuffers = lofreebuffers / clean_domains; + bd->bd_freebuffers = nbuf / buf_domains; + bd->bd_hifreebuffers = hifreebuffers / buf_domains; + bd->bd_lofreebuffers = lofreebuffers / buf_domains; bd->bd_bufspace = 0; - bd->bd_maxbufspace = maxbufspace / clean_domains; - bd->bd_hibufspace = hibufspace / clean_domains; - bd->bd_lobufspace = lobufspace / clean_domains; - bd->bd_bufspacethresh = bufspacethresh / clean_domains; + bd->bd_maxbufspace = maxbufspace / buf_domains; + bd->bd_hibufspace = hibufspace / buf_domains; + bd->bd_lobufspace = lobufspace / buf_domains; + bd->bd_bufspacethresh = bufspacethresh / buf_domains; + bd->bd_numdirtybuffers = 0; + bd->bd_hidirtybuffers = hidirtybuffers / buf_domains; + bd->bd_lodirtybuffers = lodirtybuffers / buf_domains; + bd->bd_dirtybufthresh = dirtybufthresh / buf_domains; /* Don't allow more than 2% of bufs in the per-cpu caches. */ - bd->bd_lim = nbuf / clean_domains / 50 / mp_ncpus; + bd->bd_lim = nbuf / buf_domains / 50 / mp_ncpus; } getnewbufcalls = counter_u64_alloc(M_WAITOK); getnewbufrestarts = counter_u64_alloc(M_WAITOK); @@ -1328,6 +1399,13 @@ bpmap_qenter(struct buf *bp) (vm_offset_t)(bp->b_offset & PAGE_MASK)); } +static inline struct bufdomain * +bufdomain(struct buf *bp) +{ + + return (&bdomain[bp->b_domain]); +} + static struct bufqueue * bufqueue(struct buf *bp) { @@ -1340,9 +1418,9 @@ bufqueue(struct buf *bp) case QUEUE_EMPTY: return (&bqempty); case QUEUE_DIRTY: - return (&bqdirty); + return (&bufdomain(bp)->bd_dirtyq); case QUEUE_CLEAN: - return (&bdclean[bp->b_domain].bd_subq[bp->b_subqueue]); + return (&bufdomain(bp)->bd_subq[bp->b_subqueue]); default: break; } @@ -1405,14 +1483,14 @@ binsfree(struct buf *bp, int qindex) bq_remove(bq, bp); BQ_UNLOCK(bq); } + bd = bufdomain(bp); if (qindex == QUEUE_CLEAN) { - bd = &bdclean[bp->b_domain]; if (bd->bd_lim != 0) bq = &bd->bd_subq[PCPU_GET(cpuid)]; else bq = bd->bd_cleanq; } else - bq = &bqdirty; + bq = &bd->bd_dirtyq; bq_insert(bq, bp, true); } @@ -1440,7 +1518,7 @@ buf_free(struct buf *bp) if (!LIST_EMPTY(&bp->b_dep)) buf_deallocate(bp); bufkva_free(bp); - atomic_add_int(&bdclean[bp->b_domain].bd_freebuffers, 1); + atomic_add_int(&bufdomain(bp)->bd_freebuffers, 1); BUF_UNLOCK(bp); uma_zfree(buf_zone, bp); } @@ -1716,9 +1794,10 @@ bd_init(struct bufdomain *bd) int domain; int i; - domain = bd - bdclean; + domain = bd - bdomain; bd->bd_cleanq = &bd->bd_subq[mp_maxid + 1]; bq_init(bd->bd_cleanq, QUEUE_CLEAN, mp_maxid + 1, "bufq clean lock"); + bq_init(&bd->bd_dirtyq, QUEUE_DIRTY, -1, "bufq dirty lock"); for (i = 0; i <= mp_maxid; i++) bq_init(&bd->bd_subq[i], QUEUE_CLEAN, i, "bufq clean subqueue lock"); @@ -1810,7 +1889,7 @@ bq_insert(struct bufqueue *bq, struct buf *bp, bool un if (bp->b_qindex != QUEUE_NONE) panic("bq_insert: free buffer %p onto another queue?", bp); - bd = &bdclean[bp->b_domain]; + bd = bufdomain(bp); if (bp->b_flags & B_AGE) { /* Place this buf directly on the real queue. */ if (bq->bq_index == QUEUE_CLEAN) @@ -1927,8 +2006,8 @@ bufkva_reclaim(vmem_t *vmem, int flags) done = false; for (i = 0; i < 5; i++) { - for (q = 0; q < clean_domains; q++) - if (buf_recycle(&bdclean[q], true) != 0) + for (q = 0; q < buf_domains; q++) + if (buf_recycle(&bdomain[q], true) != 0) done = true; if (done) break; @@ -2320,7 +2399,7 @@ bdirty(struct buf *bp) if ((bp->b_flags & B_DELWRI) == 0) { bp->b_flags |= /* XXX B_DONE | */ B_DELWRI; reassignbuf(bp); - bdirtyadd(); + bdirtyadd(bp); } } @@ -2348,7 +2427,7 @@ bundirty(struct buf *bp) if (bp->b_flags & B_DELWRI) { bp->b_flags &= ~B_DELWRI; reassignbuf(bp); - bdirtysub(); + bdirtysub(bp); } /* * Since it is now being written, we can clear its deferred write flag. @@ -2420,9 +2499,9 @@ void bwillwrite(void) { - if (numdirtybuffers >= hidirtybuffers) { + if (buf_dirty_count_severe()) { mtx_lock(&bdirtylock); - while (numdirtybuffers >= hidirtybuffers) { + while (buf_dirty_count_severe()) { bdirtywait = 1; msleep(&bdirtywait, &bdirtylock, (PRIBIO + 4), "flswai", 0); @@ -2438,7 +2517,7 @@ int buf_dirty_count_severe(void) { - return(numdirtybuffers >= hidirtybuffers); + return (!BIT_EMPTY(BUF_DOMAINS, &bdhidirty)); } /* @@ -2523,7 +2602,7 @@ brelse(struct buf *bp) if (!LIST_EMPTY(&bp->b_dep)) buf_deallocate(bp); if (bp->b_flags & B_DELWRI) - bdirtysub(); + bdirtysub(bp); bp->b_flags &= ~(B_DELWRI | B_CACHE); if ((bp->b_flags & B_VMIO) == 0) { allocbuf(bp, 0); @@ -3136,9 +3215,9 @@ getnewbuf(struct vnode *vp, int slpflag, int slptimeo, else metadata = false; if (vp == NULL) - bd = &bdclean[0]; + bd = &bdomain[0]; else - bd = &bdclean[vp->v_bufobj.bo_domain]; + bd = &bdomain[vp->v_bufobj.bo_domain]; counter_u64_add(getnewbufcalls, 1); reserved = false; @@ -3184,11 +3263,11 @@ static struct kproc_desc buf_kp = { SYSINIT(bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start, &buf_kp); static int -buf_flush(struct vnode *vp, int target) +buf_flush(struct vnode *vp, struct bufdomain *bd, int target) { int flushed; - flushed = flushbufqueues(vp, target, 0); + flushed = flushbufqueues(vp, bd, target, 0); if (flushed == 0) { /* * Could not find any buffers without rollback @@ -3197,7 +3276,7 @@ buf_flush(struct vnode *vp, int target) */ if (vp != NULL && target > 2) target /= 2; - flushbufqueues(vp, target, 1); + flushbufqueues(vp, bd, target, 1); } return (flushed); } @@ -3205,6 +3284,8 @@ buf_flush(struct vnode *vp, int target) static void buf_daemon() { + struct bufdomain *bd; + int speedupreq; int lodirty; int i; @@ -3217,11 +3298,11 @@ buf_daemon() /* * Start the buf clean daemons as children threads. */ - for (i = 0 ; i < clean_domains; i++) { + for (i = 0 ; i < buf_domains; i++) { int error; error = kthread_add((void (*)(void *))bufspace_daemon, - &bdclean[i], curproc, NULL, 0, 0, "bufspacedaemon-%d", i); + &bdomain[i], curproc, NULL, 0, 0, "bufspacedaemon-%d", i); if (error) panic("error %d spawning bufspace daemon", error); } @@ -3236,20 +3317,30 @@ buf_daemon() mtx_unlock(&bdlock); kproc_suspend_check(bufdaemonproc); - lodirty = lodirtybuffers; - if (bd_speedupreq) { - lodirty = numdirtybuffers / 2; - bd_speedupreq = 0; - } + /* - * Do the flush. Limit the amount of in-transit I/O we - * allow to build up, otherwise we would completely saturate - * the I/O system. + * Save speedupreq for this pass and reset to capture new + * requests. */ - while (numdirtybuffers > lodirty) { - if (buf_flush(NULL, numdirtybuffers - lodirty) == 0) - break; - kern_yield(PRI_USER); + speedupreq = bd_speedupreq; + bd_speedupreq = 0; + + /* + * Flush each domain sequentially according to its level and + * the speedup request. + */ + for (i = 0; i < buf_domains; i++) { + bd = &bdomain[i]; + if (speedupreq) + lodirty = bd->bd_numdirtybuffers / 2; + else + lodirty = bd->bd_lodirtybuffers; + while (bd->bd_numdirtybuffers > lodirty) { + if (buf_flush(NULL, bd, + bd->bd_numdirtybuffers - lodirty) == 0) + break; + kern_yield(PRI_USER); + } } /* @@ -3263,7 +3354,7 @@ buf_daemon() * to avoid endless loops on unlockable buffers. */ mtx_lock(&bdlock); - if (numdirtybuffers <= lodirtybuffers) { + if (!BIT_EMPTY(BUF_DOMAINS, &bdlodirty)) { /* * We reached our low water mark, reset the * request and sleep until we are needed again. @@ -3302,7 +3393,8 @@ SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps, CTLFLAG_RW, 0, "Number of buffers flushed with dependecies that require rollbacks"); static int -flushbufqueues(struct vnode *lvp, int target, int flushdeps) +flushbufqueues(struct vnode *lvp, struct bufdomain *bd, int target, + int flushdeps) { struct bufqueue *bq; struct buf *sentinel; @@ -3315,7 +3407,7 @@ flushbufqueues(struct vnode *lvp, int target, int flus bool unlock; flushed = 0; - bq = &bqdirty; + bq = &bd->bd_dirtyq; bp = NULL; sentinel = malloc(sizeof(struct buf), M_TEMP, M_WAITOK | M_ZERO); sentinel->b_qindex = QUEUE_SENTINEL; @@ -3651,7 +3743,7 @@ bp_unmapped_get_kva(struct buf *bp, daddr_t blkno, int panic("GB_NOWAIT_BD and GB_UNMAPPED %p", bp); } counter_u64_add(mappingrestarts, 1); - bufspace_wait(&bdclean[bp->b_domain], bp->b_vp, gbflags, 0, 0); + bufspace_wait(bufdomain(bp), bp->b_vp, gbflags, 0, 0); } has_addr: if (need_mapping) { @@ -3849,7 +3941,7 @@ loop: */ if (flags & GB_NOCREAT) return NULL; - if (bdclean[bo->bo_domain].bd_freebuffers == 0 && + if (bdomain[bo->bo_domain].bd_freebuffers == 0 && TD_IS_IDLETHREAD(curthread)) return NULL; @@ -3906,7 +3998,7 @@ loop: if (gbincore(bo, blkno)) { BO_UNLOCK(bo); bp->b_flags |= B_INVAL; - bufspace_release(&bdclean[bp->b_domain], maxsize); + bufspace_release(bufdomain(bp), maxsize); brelse(bp); goto loop; } @@ -3941,7 +4033,7 @@ loop: } allocbuf(bp, size); - bufspace_release(&bdclean[bp->b_domain], maxsize); + bufspace_release(bufdomain(bp), maxsize); bp->b_flags &= ~B_DONE; } CTR4(KTR_BUF, "getblk(%p, %ld, %d) = %p", vp, (long)blkno, size, bp); @@ -3970,7 +4062,7 @@ geteblk(int size, int flags) return (NULL); } allocbuf(bp, size); - bufspace_release(&bdclean[bp->b_domain], maxsize); + bufspace_release(bufdomain(bp), maxsize); bp->b_flags |= B_INVAL; /* b_dep cleared by getnewbuf() */ BUF_ASSERT_HELD(bp); return (bp); @@ -4839,7 +4931,7 @@ bufobj_init(struct bufobj *bo, void *private) static volatile int bufobj_cleanq; bo->bo_domain = - atomic_fetchadd_int(&bufobj_cleanq, 1) % clean_domains; + atomic_fetchadd_int(&bufobj_cleanq, 1) % buf_domains; rw_init(BO_LOCKPTR(bo), "bufobj interlock"); bo->bo_private = private; TAILQ_INIT(&bo->bo_clean.bv_hd); @@ -5184,10 +5276,9 @@ DB_SHOW_COMMAND(bufqueues, bufqueues) int i, j; db_printf("bqempty: %d\n", bqempty.bq_len); - db_printf("bqdirty: %d\n", bqdirty.bq_len); - for (i = 0; i < clean_domains; i++) { - bd = &bdclean[i]; + for (i = 0; i < buf_domains; i++) { + bd = &bdomain[i]; db_printf("Buf domain %d\n", i); db_printf("\tfreebufs\t%d\n", bd->bd_freebuffers); db_printf("\tlofreebufs\t%d\n", bd->bd_lofreebuffers); @@ -5199,7 +5290,13 @@ 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("\tnumdirtybuffers\t%d\n", bd->bd_numdirtybuffers); + db_printf("\tlodirtybuffers\t%d\n", bd->bd_lodirtybuffers); + db_printf("\thidirtybufferss\t%d\n", bd->bd_hidirtybuffers); + db_printf("\tdirtybufthresh\t%d\n", bd->bd_dirtybufthresh); + db_printf("\n"); db_printf("\tcleanq count\t%d\n", bd->bd_cleanq->bq_len); + db_printf("\tdirtyq count\t%d\n", bd->bd_dirtyq.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 "); Modified: user/markj/vm-playground/sys/sys/_bitset.h ============================================================================== --- user/markj/vm-playground/sys/sys/_bitset.h Tue Mar 13 18:30:26 2018 (r330872) +++ user/markj/vm-playground/sys/sys/_bitset.h Tue Mar 13 18:33:50 2018 (r330873) @@ -57,4 +57,10 @@ struct t { \ */ #define BITSET_DEFINE_VAR(t) BITSET_DEFINE(t, 1) +/* + * Define a default type that can be used while manually specifying size + * to every call. + */ +BITSET_DEFINE(bitset, 1); + #endif /* !_SYS__BITSET_H_ */ Modified: user/markj/vm-playground/sys/sys/domainset.h ============================================================================== --- user/markj/vm-playground/sys/sys/domainset.h Tue Mar 13 18:30:26 2018 (r330872) +++ user/markj/vm-playground/sys/sys/domainset.h Tue Mar 13 18:33:50 2018 (r330873) @@ -28,8 +28,8 @@ * $FreeBSD$ */ -#ifndef _SYS_DOMAINSETSET_H_ -#define _SYS_DOMAINSETSET_H_ +#ifndef _SYS_DOMAINSET_H_ +#define _SYS_DOMAINSET_H_ #include @@ -38,8 +38,12 @@ #define _NDOMAINSETBITS _BITSET_BITS #define _NDOMAINSETWORDS __bitset_words(DOMAINSET_SETSIZE) -#define DOMAINSETSETBUFSIZ ((2 + sizeof(long) * 2) * _NDOMAINSETWORDS) +#define DOMAINSETBUFSIZ \ + (((2 + sizeof(long) * 2) * _NDOMAINSETWORDS) + \ + sizeof("::") + sizeof(__XSTRING(DOMAINSET_POLICY_MAX)) + \ + sizeof(__XSTRING(MAXMEMDOM))) + #define DOMAINSET_CLR(n, p) BIT_CLR(DOMAINSET_SETSIZE, n, p) #define DOMAINSET_COPY(f, t) BIT_COPY(DOMAINSET_SETSIZE, f, t) #define DOMAINSET_ISSET(n, p) BIT_ISSET(DOMAINSET_SETSIZE, n, p) @@ -77,9 +81,6 @@ #define DOMAINSET_POLICY_MAX DOMAINSET_POLICY_INTERLEAVE #ifdef _KERNEL -#include -LIST_HEAD(domainlist, domainset); - #if MAXMEMDOM < 256 typedef uint8_t domainid_t; #else *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@freebsd.org Tue Mar 13 19:28:04 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 943D2F4934F for ; Tue, 13 Mar 2018 19:28:04 +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 39D7770120; Tue, 13 Mar 2018 19:28:04 +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 30A9D1DF7B; Tue, 13 Mar 2018 19:28:04 +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 w2DJS4KH096199; Tue, 13 Mar 2018 19:28:04 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2DJS4Ax096198; Tue, 13 Mar 2018 19:28:04 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803131928.w2DJS4Ax096198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 13 Mar 2018 19:28:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330874 - 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: 330874 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, 13 Mar 2018 19:28:05 -0000 Author: jeff Date: Tue Mar 13 19:28:03 2018 New Revision: 330874 URL: https://svnweb.freebsd.org/changeset/base/330874 Log: Resolve a deadlock when softdep leaves too many buffers locked waiting on I/O. Add some new debugging output to bufqueues. Make sysctls R/W again. Reported by: pho, bde 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 Tue Mar 13 18:33:50 2018 (r330873) +++ user/jeff/numa/sys/kern/vfs_bio.c Tue Mar 13 19:28:03 2018 (r330874) @@ -101,7 +101,52 @@ struct buf_ops buf_ops_bio = { .bop_bdflush = bufbdflush, }; -struct bufdomain; +struct bufqueue { + struct mtx_padalign bq_lock; + TAILQ_HEAD(, buf) bq_queue; + uint8_t bq_index; + uint16_t bq_subqueue; + int bq_len; +} __aligned(CACHE_LINE_SIZE); + +#define BQ_LOCKPTR(bq) (&(bq)->bq_lock) +#define BQ_LOCK(bq) mtx_lock(BQ_LOCKPTR((bq))) +#define BQ_UNLOCK(bq) mtx_unlock(BQ_LOCKPTR((bq))) +#define BQ_ASSERT_LOCKED(bq) mtx_assert(BQ_LOCKPTR((bq)), MA_OWNED) + +struct bufdomain { + struct bufqueue bd_subq[MAXCPU + 1]; /* Per-cpu sub queues + global */ + struct bufqueue bd_dirtyq; + struct bufqueue *bd_cleanq; + struct mtx_padalign bd_run_lock; + /* Constants */ + long bd_maxbufspace; + long bd_hibufspace; + long bd_lobufspace; + long bd_bufspacethresh; + int bd_hifreebuffers; + int bd_lofreebuffers; + int bd_hidirtybuffers; + int bd_lodirtybuffers; + int bd_dirtybufthresh; + int bd_lim; + /* atomics */ + int bd_wanted; + int __aligned(CACHE_LINE_SIZE) bd_numdirtybuffers; + int __aligned(CACHE_LINE_SIZE) bd_running; + long __aligned(CACHE_LINE_SIZE) bd_bufspace; + int __aligned(CACHE_LINE_SIZE) bd_freebuffers; +} __aligned(CACHE_LINE_SIZE); + +#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) +#define BD_RUN_LOCKPTR(bd) (&(bd)->bd_run_lock) +#define BD_RUN_LOCK(bd) mtx_lock(BD_RUN_LOCKPTR((bd))) +#define BD_RUN_UNLOCK(bd) mtx_unlock(BD_RUN_LOCKPTR((bd))) +#define BD_DOMAIN(bd) (bd - bdomain) + static struct buf *buf; /* buffer header pool */ extern struct buf *swbuf; /* Swap buffer header pool. */ caddr_t unmapped_buf; @@ -136,6 +181,15 @@ static int buf_import(void *, void **, int, int, int); static void buf_release(void *, void **, int); static void maxbcachebuf_adjust(void); static inline struct bufdomain *bufdomain(struct buf *); +static void bq_remove(struct bufqueue *bq, struct buf *bp); +static void bq_insert(struct bufqueue *bq, struct buf *bp, bool unlock); +static int buf_recycle(struct bufdomain *, bool kva); +static void bq_init(struct bufqueue *bq, int qindex, int cpu, + const char *lockname); +static void bd_init(struct bufdomain *bd); +static int bd_flushall(struct bufdomain *bd); +static int sysctl_bufdomain_long(SYSCTL_HANDLER_ARGS); +static int sysctl_bufdomain_int(SYSCTL_HANDLER_ARGS); static int sysctl_bufspace(SYSCTL_HANDLER_ARGS); int vmiodirenable = TRUE; @@ -150,23 +204,31 @@ static counter_u64_t bufkvaspace; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, bufkvaspace, CTLFLAG_RD, &bufkvaspace, "Kernel virtual memory used for buffers"); static long maxbufspace; -SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, +SYSCTL_PROC(_vfs, OID_AUTO, maxbufspace, + CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &maxbufspace, + __offsetof(struct bufdomain, bd_maxbufspace), sysctl_bufdomain_long, "L", "Maximum allowed value of bufspace (including metadata)"); static long bufmallocspace; SYSCTL_LONG(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0, "Amount of malloced memory for buffers"); static long maxbufmallocspace; -SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RD, &maxbufmallocspace, +SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, 0, "Maximum amount of malloced memory for buffers"); static long lobufspace; -SYSCTL_LONG(_vfs, OID_AUTO, lobufspace, CTLFLAG_RD, &lobufspace, 0, +SYSCTL_PROC(_vfs, OID_AUTO, lobufspace, + CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lobufspace, + __offsetof(struct bufdomain, bd_lobufspace), sysctl_bufdomain_long, "L", "Minimum amount of buffers we want to have"); long hibufspace; -SYSCTL_LONG(_vfs, OID_AUTO, hibufspace, CTLFLAG_RD, &hibufspace, 0, +SYSCTL_PROC(_vfs, OID_AUTO, hibufspace, + CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &hibufspace, + __offsetof(struct bufdomain, bd_hibufspace), sysctl_bufdomain_long, "L", "Maximum allowed value of bufspace (excluding metadata)"); long bufspacethresh; -SYSCTL_LONG(_vfs, OID_AUTO, bufspacethresh, CTLFLAG_RD, &bufspacethresh, - 0, "Bufspace consumed before waking the daemon to free some"); +SYSCTL_PROC(_vfs, OID_AUTO, bufspacethresh, + CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &bufspacethresh, + __offsetof(struct bufdomain, bd_bufspacethresh), sysctl_bufdomain_long, "L", + "Bufspace consumed before waking the daemon to free some"); static counter_u64_t buffreekvacnt; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, buffreekvacnt, CTLFLAG_RW, &buffreekvacnt, "Number of times we have freed the KVA space from some buffer"); @@ -198,22 +260,32 @@ SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RD, NULL, 0, sysctl_numdirtybuffers, "I", "Number of buffers that are dirty (has unwritten changes) at the moment"); static int lodirtybuffers; -SYSCTL_INT(_vfs, OID_AUTO, lodirtybuffers, CTLFLAG_RD, &lodirtybuffers, 0, +SYSCTL_PROC(_vfs, OID_AUTO, lodirtybuffers, + CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, + __offsetof(struct bufdomain, bd_lodirtybuffers), sysctl_bufdomain_int, "L", "How many buffers we want to have free before bufdaemon can sleep"); static int hidirtybuffers; -SYSCTL_INT(_vfs, OID_AUTO, hidirtybuffers, CTLFLAG_RD, &hidirtybuffers, 0, +SYSCTL_PROC(_vfs, OID_AUTO, hidirtybuffers, + CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &hidirtybuffers, + __offsetof(struct bufdomain, bd_hidirtybuffers), sysctl_bufdomain_int, "L", "When the number of dirty buffers is considered severe"); int dirtybufthresh; -SYSCTL_INT(_vfs, OID_AUTO, dirtybufthresh, CTLFLAG_RD, &dirtybufthresh, - 0, "Number of bdwrite to bawrite conversions to clear dirty buffers"); +SYSCTL_PROC(_vfs, OID_AUTO, dirtybufthresh, + CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &dirtybufthresh, + __offsetof(struct bufdomain, bd_dirtybufthresh), sysctl_bufdomain_int, "L", + "Number of bdwrite to bawrite conversions to clear dirty buffers"); static int numfreebuffers; SYSCTL_INT(_vfs, OID_AUTO, numfreebuffers, CTLFLAG_RD, &numfreebuffers, 0, "Number of free buffers"); static int lofreebuffers; -SYSCTL_INT(_vfs, OID_AUTO, lofreebuffers, CTLFLAG_RD, &lofreebuffers, 0, +SYSCTL_PROC(_vfs, OID_AUTO, lofreebuffers, + CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lofreebuffers, + __offsetof(struct bufdomain, bd_lofreebuffers), sysctl_bufdomain_int, "L", "Target number of free buffers"); static int hifreebuffers; -SYSCTL_INT(_vfs, OID_AUTO, hifreebuffers, CTLFLAG_RD, &hifreebuffers, 0, +SYSCTL_PROC(_vfs, OID_AUTO, hifreebuffers, + CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &hifreebuffers, + __offsetof(struct bufdomain, bd_hifreebuffers), sysctl_bufdomain_int, "L", "Threshold for clean buffer recycling"); static counter_u64_t getnewbufcalls; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RD, @@ -298,74 +370,19 @@ static int bdirtywait; #define QUEUE_CLEAN 3 /* non-B_DELWRI buffers */ #define QUEUE_SENTINEL 4 /* not an queue index, but mark for sentinel */ -struct bufqueue { - struct mtx_padalign bq_lock; - TAILQ_HEAD(, buf) bq_queue; - uint8_t bq_index; - uint16_t bq_subqueue; - int bq_len; -} __aligned(CACHE_LINE_SIZE); - -#define BQ_LOCKPTR(bq) (&(bq)->bq_lock) -#define BQ_LOCK(bq) mtx_lock(BQ_LOCKPTR((bq))) -#define BQ_UNLOCK(bq) mtx_unlock(BQ_LOCKPTR((bq))) -#define BQ_ASSERT_LOCKED(bq) mtx_assert(BQ_LOCKPTR((bq)), MA_OWNED) - -struct bufqueue __exclusive_cache_line bqempty; - -struct bufdomain { - struct bufqueue bd_subq[MAXCPU + 1]; /* Per-cpu sub queues + global */ - struct bufqueue bd_dirtyq; - struct bufqueue *bd_cleanq; - struct mtx_padalign bd_run_lock; - /* Constants */ - long bd_maxbufspace; - long bd_hibufspace; - long bd_lobufspace; - long bd_bufspacethresh; - int bd_hifreebuffers; - int bd_lofreebuffers; - int bd_hidirtybuffers; - int bd_lodirtybuffers; - int bd_dirtybufthresh; - int bd_lim; - /* atomics */ - int bd_wanted; - int __aligned(CACHE_LINE_SIZE) bd_numdirtybuffers; - int __aligned(CACHE_LINE_SIZE) bd_running; - long __aligned(CACHE_LINE_SIZE) bd_bufspace; - int __aligned(CACHE_LINE_SIZE) bd_freebuffers; -} __aligned(CACHE_LINE_SIZE); - -#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) -#define BD_RUN_LOCKPTR(bd) (&(bd)->bd_run_lock) -#define BD_RUN_LOCK(bd) mtx_lock(BD_RUN_LOCKPTR((bd))) -#define BD_RUN_UNLOCK(bd) mtx_unlock(BD_RUN_LOCKPTR((bd))) -#define BD_DOMAIN(bd) (bd - bdomain) - /* Maximum number of buffer domains. */ #define BUF_DOMAINS 8 -BITSET_DEFINE(bufdomainset, BUF_DOMAINS); struct bufdomainset bdlodirty; /* Domains > lodirty */ struct bufdomainset bdhidirty; /* Domains > hidirty */ /* Configured number of clean queues. */ static int __read_mostly buf_domains; +BITSET_DEFINE(bufdomainset, BUF_DOMAINS); struct bufdomain __exclusive_cache_line bdomain[BUF_DOMAINS]; +struct bufqueue __exclusive_cache_line bqempty; -static void bq_remove(struct bufqueue *bq, struct buf *bp); -static void bq_insert(struct bufqueue *bq, struct buf *bp, bool unlock); -static int buf_recycle(struct bufdomain *, bool kva); -static void bq_init(struct bufqueue *bq, int qindex, int cpu, - const char *lockname); -static void bd_init(struct bufdomain *bd); -static int bd_flushall(struct bufdomain *bd); - /* * per-cpu empty buffer cache. */ @@ -405,6 +422,44 @@ sysctl_runningspace(SYSCTL_HANDLER_ARGS) return (error); } +static int +sysctl_bufdomain_int(SYSCTL_HANDLER_ARGS) +{ + int error; + int value; + int i; + + value = *(int *)arg1; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + *(int *)arg1 = value; + for (i = 0; i < buf_domains; i++) + *(int *)(((uintptr_t)&bdomain[i]) + arg2) = + value / buf_domains; + + return (error); +} + +static int +sysctl_bufdomain_long(SYSCTL_HANDLER_ARGS) +{ + long value; + int error; + int i; + + value = *(long *)arg1; + error = sysctl_handle_long(oidp, &value, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + *(long *)arg1 = value; + for (i = 0; i < buf_domains; i++) + *(long *)(((uintptr_t)&bdomain[i]) + arg2) = + value / buf_domains; + + return (error); +} + #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) static int @@ -770,6 +825,15 @@ bufspace_daemon(void *arg) if (buf_recycle(bd, false) != 0) { if (bd_flushall(bd)) continue; + /* + * Speedup dirty if we've run out of clean + * buffers. This is possible in particular + * because softdep may held many bufs locked + * pending writes to other bufs which are + * marked for delayed write, exhausting + * clean space until they are written. + */ + bd_speedup(); BD_LOCK(bd); if (bd->bd_wanted) { msleep(&bd->bd_wanted, BD_LOCKPTR(bd), @@ -5253,6 +5317,7 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) } db_printf("\n"); } + BUF_LOCKPRINTINFO(bp); #if defined(FULL_BUF_TRACKING) db_printf("b_io_tracking: b_io_tcnt = %u\n", bp->b_io_tcnt); @@ -5267,13 +5332,14 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) db_printf("b_io_tracking: %s\n", bp->b_io_tracking); #endif db_printf(" "); - BUF_LOCKPRINTINFO(bp); } DB_SHOW_COMMAND(bufqueues, bufqueues) { struct bufdomain *bd; - int i, j; + struct buf *bp; + long total; + int i, j, cnt; db_printf("bqempty: %d\n", bqempty.bq_len); @@ -5292,17 +5358,41 @@ DB_SHOW_COMMAND(bufqueues, bufqueues) db_printf("\n"); db_printf("\tnumdirtybuffers\t%d\n", bd->bd_numdirtybuffers); db_printf("\tlodirtybuffers\t%d\n", bd->bd_lodirtybuffers); - db_printf("\thidirtybufferss\t%d\n", bd->bd_hidirtybuffers); + db_printf("\thidirtybuffers\t%d\n", bd->bd_hidirtybuffers); db_printf("\tdirtybufthresh\t%d\n", bd->bd_dirtybufthresh); db_printf("\n"); - db_printf("\tcleanq count\t%d\n", bd->bd_cleanq->bq_len); - db_printf("\tdirtyq count\t%d\n", bd->bd_dirtyq.bq_len); + total = 0; + TAILQ_FOREACH(bp, &bd->bd_cleanq->bq_queue, b_freelist) + total += bp->b_bufsize; + db_printf("\tcleanq count\t%d (%ld)\n", + bd->bd_cleanq->bq_len, total); + total = 0; + TAILQ_FOREACH(bp, &bd->bd_dirtyq.bq_queue, b_freelist) + total += bp->b_bufsize; + db_printf("\tdirtyq count\t%d (%ld)\n", + bd->bd_dirtyq.bq_len, total); 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; j++) db_printf("%d, ", bd->bd_subq[j].bq_len); db_printf("\n"); + cnt = 0; + total = 0; + for (j = 0; j < nbuf; j++) + if (buf[j].b_domain == i && BUF_ISLOCKED(&buf[j])) { + cnt++; + total += buf[j].b_bufsize; + } + db_printf("\tLocked buffers: %d space %jd\n", cnt, total); + cnt = 0; + total = 0; + for (j = 0; j < nbuf; j++) + if (buf[j].b_domain == i) { + cnt++; + total += buf[j].b_bufsize; + } + db_printf("\tTotal buffers: %d space %jd\n", cnt, total); } } From owner-svn-src-user@freebsd.org Wed Mar 14 00:30:50 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 4B7EDF3064A for ; Wed, 14 Mar 2018 00:30:50 +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 F2E317EBDD; Wed, 14 Mar 2018 00:30:49 +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 EDAAA20E3D; Wed, 14 Mar 2018 00:30:49 +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 w2E0Un1q050283; Wed, 14 Mar 2018 00:30:49 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2E0Un73050279; Wed, 14 Mar 2018 00:30:49 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803140030.w2E0Un73050279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Wed, 14 Mar 2018 00:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330889 - 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: 330889 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: Wed, 14 Mar 2018 00:30:50 -0000 Author: jeff Date: Wed Mar 14 00:30:49 2018 New Revision: 330889 URL: https://svnweb.freebsd.org/changeset/base/330889 Log: Add a lock to the reservation structure to fix a LOR between the page and pmap locks. This lock adds 1MB of memory per 64GB of ram on amd64. Modified: user/jeff/numa/sys/vm/vm_kern.c user/jeff/numa/sys/vm/vm_page.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 Wed Mar 14 00:27:25 2018 (r330888) +++ user/jeff/numa/sys/vm/vm_kern.c Wed Mar 14 00:30:49 2018 (r330889) @@ -519,9 +519,7 @@ _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 Wed Mar 14 00:27:25 2018 (r330888) +++ user/jeff/numa/sys/vm/vm_page.c Wed Mar 14 00:30:49 2018 (r330889) @@ -800,12 +800,7 @@ vm_page_startup(vm_offset_t vaddr) vm_page_blacklist_check(list, NULL); freeenv(list); -#if VM_NRESERVLEVEL > 0 - /* - * Initialize the reservation management system. - */ - vm_reserv_init(); -#endif + /* * Set an initial domain policy for thread0 so that allocations * can work. Modified: user/jeff/numa/sys/vm/vm_reserv.c ============================================================================== --- user/jeff/numa/sys/vm/vm_reserv.c Wed Mar 14 00:27:25 2018 (r330888) +++ user/jeff/numa/sys/vm/vm_reserv.c Wed Mar 14 00:30:49 2018 (r330889) @@ -175,22 +175,24 @@ popmap_is_set(popmap_t popmap[], int i) * c - constant after boot */ struct vm_reserv { + struct mtx lock; /* reservation lock. */ 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; /* (r) # of pages in use */ + domainid_t domain; /* (c) NUMA domain. */ + uint16_t 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) +#define vm_reserv_lockptr(rv) (&(rv)->lock) +#define vm_reserv_assert_locked(rv) \ + mtx_assert(vm_reserv_lockptr(rv), MA_OWNED) +#define vm_reserv_lock(rv) mtx_lock(vm_reserv_lockptr(rv)) +#define vm_reserv_trylock(rv) mtx_trylock(vm_reserv_lockptr(rv)) +#define vm_reserv_unlock(rv) mtx_unlock(vm_reserv_lockptr(rv)) static struct mtx_padalign vm_reserv_domain_locks[MAXMEMDOM]; @@ -256,6 +258,8 @@ static counter_u64_t vm_reserv_reclaimed = EARLY_COUNT SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, reclaimed, CTLFLAG_RD, &vm_reserv_reclaimed, "Cumulative number of reclaimed reservations"); +static __read_mostly int vm_reserv_enabled; + /* * The object lock pool is used to synchronize the rvq. We can not use a * pool mutex because it is required before malloc works. @@ -574,6 +578,8 @@ vm_reserv_extend_contig(int req, vm_object_t object, v VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(npages != 0, ("vm_reserv_alloc_contig: npages is 0")); + if (vm_reserv_enabled == 0) + return (NULL); /* * Is a reservation fundamentally impossible? @@ -671,6 +677,8 @@ vm_reserv_alloc_contig(int req, vm_object_t object, vm VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(npages != 0, ("vm_reserv_alloc_contig: npages is 0")); + if (vm_reserv_enabled == 0) + return (NULL); /* * Is a reservation fundamentally impossible? @@ -843,6 +851,8 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde int index; VM_OBJECT_ASSERT_WLOCKED(object); + if (vm_reserv_enabled == 0) + return (NULL); /* * Could a reservation currently exist? @@ -903,6 +913,8 @@ vm_reserv_alloc_page(int req, vm_object_t object, vm_p int index; VM_OBJECT_ASSERT_WLOCKED(object); + if (vm_reserv_enabled == 0) + return (NULL); /* * Is a reservation fundamentally impossible? @@ -1102,47 +1114,21 @@ boolean_t vm_reserv_free_page(vm_page_t m) { vm_reserv_t rv; + boolean_t ret; rv = vm_reserv_from_page(m); if (rv->object == NULL) return (FALSE); - vm_reserv_depopulate(rv, m - rv->pages); - return (TRUE); -} + vm_reserv_lock(rv); + /* Re-validate after lock. */ + if (rv->object != NULL) { + vm_reserv_depopulate(rv, m - rv->pages); + ret = TRUE; + } else + ret = FALSE; + vm_reserv_unlock(rv); -/* - * Initializes the reservation management system. Specifically, initializes - * the reservation array. - * - * Requires that vm_page_array and first_page are initialized! - */ -void -vm_reserv_init(void) -{ - vm_paddr_t paddr; - struct vm_phys_seg *seg; - int i, segind; - - /* - * Initialize the reservation array. Specifically, initialize the - * "pages" field for every element that has an underlying superpage. - */ - for (segind = 0; segind < vm_phys_nsegs; segind++) { - seg = &vm_phys_segs[segind]; - paddr = roundup2(seg->start, VM_LEVEL_0_SIZE); - while (paddr + VM_LEVEL_0_SIZE <= seg->end) { - vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT].pages = - PHYS_TO_VM_PAGE(paddr); - vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT].domain = - seg->domain; - paddr += VM_LEVEL_0_SIZE; - } - } - 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]); - } + return (ret); } /* @@ -1157,7 +1143,6 @@ vm_reserv_is_page_free(vm_page_t m) rv = vm_reserv_from_page(m); if (rv->object == NULL) return (false); - vm_reserv_assert_locked(rv); return (popmap_is_clear(rv->popmap, m - rv->pages)); } @@ -1225,6 +1210,8 @@ vm_reserv_reclaim_inactive(int domain) { vm_reserv_t rv; + if (vm_reserv_enabled == 0) + return (false); while ((rv = TAILQ_FIRST(&vm_rvq_partpop[domain])) != NULL) { vm_reserv_lock(rv); if (rv != TAILQ_FIRST(&vm_rvq_partpop[domain])) { @@ -1254,6 +1241,8 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm vm_reserv_t rv, rvn; int hi, i, lo, low_index, next_free; + if (vm_reserv_enabled == 0) + return (FALSE); if (npages > VM_LEVEL_0_NPAGES - 1) return (FALSE); size = npages << PAGE_SHIFT; @@ -1344,7 +1333,7 @@ again: } while (i < NPOPMAP); vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); - if (!rvn->inpartpopq) + if (rvn != NULL && !rvn->inpartpopq) goto again; } vm_reserv_domain_unlock(domain); @@ -1411,7 +1400,6 @@ vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end, { vm_paddr_t new_end; size_t size; - int i; /* * Calculate the size (in bytes) of the reservation array. Round up @@ -1431,26 +1419,58 @@ vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end, VM_PROT_READ | VM_PROT_WRITE); bzero(vm_reserv_array, size); - for (i = 0; i < VM_RESERV_OBJ_LOCK_COUNT; i++) - mtx_init(&vm_reserv_object_mtx[i], "resv obj lock", NULL, - MTX_DEF); - /* * Return the next available physical address. */ return (new_end); } +/* + * Initializes the reservation management system. Specifically, initializes + * the reservation array. + * + * Requires that vm_page_array and first_page are initialized! + */ static void -vm_reserv_counter_startup(void) +vm_reserv_init(void *unused) { + vm_paddr_t paddr; + struct vm_reserv *rv; + struct vm_phys_seg *seg; + int i, segind; + /* + * Initialize the reservation array. Specifically, initialize the + * "pages" field for every element that has an underlying superpage. + */ + for (segind = 0; segind < vm_phys_nsegs; segind++) { + seg = &vm_phys_segs[segind]; + paddr = roundup2(seg->start, VM_LEVEL_0_SIZE); + while (paddr + VM_LEVEL_0_SIZE <= seg->end) { + rv = &vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT]; + rv->pages = PHYS_TO_VM_PAGE(paddr); + rv->domain = seg->domain; + mtx_init(&rv->lock, "vm reserv", NULL, MTX_DEF); + paddr += VM_LEVEL_0_SIZE; + } + } + 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]); + } + + for (i = 0; i < VM_RESERV_OBJ_LOCK_COUNT; i++) + mtx_init(&vm_reserv_object_mtx[i], "resv obj lock", NULL, + MTX_DEF); + vm_reserv_freed = counter_u64_alloc(M_WAITOK); vm_reserv_broken = counter_u64_alloc(M_WAITOK); vm_reserv_reclaimed = counter_u64_alloc(M_WAITOK); + + vm_reserv_enabled = 1; } -SYSINIT(vm_reserv_counters, SI_SUB_CPU, SI_ORDER_ANY, - vm_reserv_counter_startup, NULL); +SYSINIT(vm_reserv_init, SI_SUB_CPU, SI_ORDER_ANY, vm_reserv_init, 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 Wed Mar 14 00:27:25 2018 (r330888) +++ user/jeff/numa/sys/vm/vm_reserv.h Wed Mar 14 00:30:49 2018 (r330889) @@ -60,7 +60,6 @@ vm_page_t vm_reserv_extend(int req, vm_object_t object vm_pindex_t pindex, int domain, vm_page_t mpred); void vm_reserv_break_all(vm_object_t object); boolean_t vm_reserv_free_page(vm_page_t m); -void vm_reserv_init(void); bool vm_reserv_is_page_free(vm_page_t m); int vm_reserv_level(vm_page_t m); int vm_reserv_level_iffullpop(vm_page_t m); From owner-svn-src-user@freebsd.org Thu Mar 15 13:07: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 A24E0F50722 for ; Thu, 15 Mar 2018 13:07:16 +0000 (UTC) (envelope-from pho@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 51BE080113; Thu, 15 Mar 2018 13:07:16 +0000 (UTC) (envelope-from pho@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 3286816724; Thu, 15 Mar 2018 13:07:16 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2FD7Gn4071133; Thu, 15 Mar 2018 13:07:16 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2FD7FXf071127; Thu, 15 Mar 2018 13:07:15 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201803151307.w2FD7FXf071127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Thu, 15 Mar 2018 13:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r330999 - user/pho/stress2/misc X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/misc X-SVN-Commit-Revision: 330999 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, 15 Mar 2018 13:07:16 -0000 Author: pho Date: Thu Mar 15 13:07:15 2018 New Revision: 330999 URL: https://svnweb.freebsd.org/changeset/base/330999 Log: White space fixes. Sponsored by: Dell EMC Isilon Modified: user/pho/stress2/misc/context.sh user/pho/stress2/misc/graid1_3.sh user/pho/stress2/misc/kevent9.sh user/pho/stress2/misc/marcus4.sh user/pho/stress2/misc/shm.sh Modified: user/pho/stress2/misc/context.sh ============================================================================== --- user/pho/stress2/misc/context.sh Thu Mar 15 12:59:15 2018 (r330998) +++ user/pho/stress2/misc/context.sh Thu Mar 15 13:07:15 2018 (r330999) @@ -114,7 +114,7 @@ main(void) } } - } /* parent */ + } /* parent */ for (j = 0; time(NULL) - start < RUNTIME; j++) { token = j; Modified: user/pho/stress2/misc/graid1_3.sh ============================================================================== --- user/pho/stress2/misc/graid1_3.sh Thu Mar 15 12:59:15 2018 (r330998) +++ user/pho/stress2/misc/graid1_3.sh Thu Mar 15 13:07:15 2018 (r330999) @@ -66,7 +66,7 @@ set +e while true; do gmirror label markj-mirror md${u1}p1 - gmirror destroy markj-mirror + gmirror destroy markj-mirror done 2>/dev/null & pid1=$! while true; do Modified: user/pho/stress2/misc/kevent9.sh ============================================================================== --- user/pho/stress2/misc/kevent9.sh Thu Mar 15 12:59:15 2018 (r330998) +++ user/pho/stress2/misc/kevent9.sh Thu Mar 15 13:07:15 2018 (r330999) @@ -57,7 +57,7 @@ void *procmaker(void *arg __unused) } } printf("done forking\n"); - return NULL; + return NULL; } void *reaper(void *arg __unused) Modified: user/pho/stress2/misc/marcus4.sh ============================================================================== --- user/pho/stress2/misc/marcus4.sh Thu Mar 15 12:59:15 2018 (r330998) +++ user/pho/stress2/misc/marcus4.sh Thu Mar 15 13:07:15 2018 (r330999) @@ -78,5 +78,5 @@ sleep $((16 * 60)) wait ./cleanup.sh -[ $restart ] && service watchdogd start > /dev/null +[ $restart ] && service watchdogd start > /dev/null exit 0 Modified: user/pho/stress2/misc/shm.sh ============================================================================== --- user/pho/stress2/misc/shm.sh Thu Mar 15 12:59:15 2018 (r330998) +++ user/pho/stress2/misc/shm.sh Thu Mar 15 13:07:15 2018 (r330999) @@ -125,7 +125,7 @@ static void * t2(void *arg __unused) { key_t shmkey; - size_t i; + size_t i; time_t start; char *cp; From owner-svn-src-user@freebsd.org Thu Mar 15 19:32:33 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 D51AEF4C188 for ; Thu, 15 Mar 2018 19:32:33 +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 8B7A173BF7; Thu, 15 Mar 2018 19:32:33 +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 869AB1A3AC; Thu, 15 Mar 2018 19:32:33 +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 w2FJWXle069686; Thu, 15 Mar 2018 19:32:33 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2FJWX00069685; Thu, 15 Mar 2018 19:32:33 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803151932.w2FJWX00069685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Thu, 15 Mar 2018 19:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r331020 - 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: 331020 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, 15 Mar 2018 19:32:34 -0000 Author: jeff Date: Thu Mar 15 19:32:33 2018 New Revision: 331020 URL: https://svnweb.freebsd.org/changeset/base/331020 Log: Correct print formats. Reported by: pho 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 Thu Mar 15 19:31:39 2018 (r331019) +++ user/jeff/numa/sys/kern/vfs_bio.c Thu Mar 15 19:32:33 2018 (r331020) @@ -5384,7 +5384,7 @@ DB_SHOW_COMMAND(bufqueues, bufqueues) cnt++; total += buf[j].b_bufsize; } - db_printf("\tLocked buffers: %d space %jd\n", cnt, total); + db_printf("\tLocked buffers: %d space %ld\n", cnt, total); cnt = 0; total = 0; for (j = 0; j < nbuf; j++) @@ -5392,7 +5392,7 @@ DB_SHOW_COMMAND(bufqueues, bufqueues) cnt++; total += buf[j].b_bufsize; } - db_printf("\tTotal buffers: %d space %jd\n", cnt, total); + db_printf("\tTotal buffers: %d space %ld\n", cnt, total); } } From owner-svn-src-user@freebsd.org Thu Mar 15 20: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 51098F506AD for ; Thu, 15 Mar 2018 20: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 E9696766B5; Thu, 15 Mar 2018 20: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 E07141AB73; Thu, 15 Mar 2018 20: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 w2FKP9wI095101; Thu, 15 Mar 2018 20:25:09 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2FKP7tD095075; Thu, 15 Mar 2018 20:25:07 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201803152025.w2FKP7tD095075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Thu, 15 Mar 2018 20:25:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r331024 - in user/jeff/numa: . bin/ps contrib/llvm/lib/Target/ARM etc/mtree etc/rc.d gnu/usr.bin/gdb/kgdb lib/libc/net lib/libc/sys lib/libdpv lib/libfigpar lib/libipsec lib/libmagic li... X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in user/jeff/numa: . bin/ps contrib/llvm/lib/Target/ARM etc/mtree etc/rc.d gnu/usr.bin/gdb/kgdb lib/libc/net lib/libc/sys lib/libdpv lib/libfigpar lib/libipsec lib/libmagic lib/libsysdecode libexec/tf... X-SVN-Commit-Revision: 331024 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, 15 Mar 2018 20:25:10 -0000 Author: jeff Date: Thu Mar 15 20:25:06 2018 New Revision: 331024 URL: https://svnweb.freebsd.org/changeset/base/331024 Log: Merge from head. Added: user/jeff/numa/libexec/tftpd/tests/ - copied from r331022, head/libexec/tftpd/tests/ user/jeff/numa/sbin/nvmecontrol/format.c - copied unchanged from r331022, head/sbin/nvmecontrol/format.c user/jeff/numa/stand/efi/libefi/efienv.c - copied unchanged from r331022, head/stand/efi/libefi/efienv.c user/jeff/numa/sys/contrib/zstd/doc/images/zstd_logo86.png - copied unchanged from r331022, head/sys/contrib/zstd/doc/images/zstd_logo86.png user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_compress_internal.h - copied unchanged from r331022, head/sys/contrib/zstd/lib/compress/zstd_compress_internal.h user/jeff/numa/sys/contrib/zstd/tests/seqgen.c - copied unchanged from r331022, head/sys/contrib/zstd/tests/seqgen.c user/jeff/numa/sys/contrib/zstd/tests/seqgen.h - copied unchanged from r331022, head/sys/contrib/zstd/tests/seqgen.h user/jeff/numa/sys/dev/cxgbe/tom/t4_tls.c - copied unchanged from r331022, head/sys/dev/cxgbe/tom/t4_tls.c user/jeff/numa/sys/dev/cxgbe/tom/t4_tls.h - copied unchanged from r331022, head/sys/dev/cxgbe/tom/t4_tls.h user/jeff/numa/usr.sbin/cxgbetool/tcb_common.c - copied unchanged from r331022, head/usr.sbin/cxgbetool/tcb_common.c user/jeff/numa/usr.sbin/cxgbetool/tcb_common.h - copied unchanged from r331022, head/usr.sbin/cxgbetool/tcb_common.h user/jeff/numa/usr.sbin/cxgbetool/tcbinfot4.c - copied unchanged from r331022, head/usr.sbin/cxgbetool/tcbinfot4.c user/jeff/numa/usr.sbin/cxgbetool/tcbinfot5.c - copied unchanged from r331022, head/usr.sbin/cxgbetool/tcbinfot5.c user/jeff/numa/usr.sbin/cxgbetool/tcbinfot6.c - copied unchanged from r331022, head/usr.sbin/cxgbetool/tcbinfot6.c user/jeff/numa/usr.sbin/cxgbetool/tcbshowt4.c - copied unchanged from r331022, head/usr.sbin/cxgbetool/tcbshowt4.c user/jeff/numa/usr.sbin/cxgbetool/tcbshowt5.c - copied unchanged from r331022, head/usr.sbin/cxgbetool/tcbshowt5.c user/jeff/numa/usr.sbin/cxgbetool/tcbshowt6.c - copied unchanged from r331022, head/usr.sbin/cxgbetool/tcbshowt6.c user/jeff/numa/usr.sbin/mpsutil/mps_debug.c - copied unchanged from r331022, head/usr.sbin/mpsutil/mps_debug.c Deleted: user/jeff/numa/sys/arm/conf/BEAGLEBONE-MMCCAM user/jeff/numa/sys/arm/conf/IMX6-MMCCAM user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_compress.h user/jeff/numa/sys/i386/include/pcaudioio.h user/jeff/numa/sys/sys/dataacq.h Modified: user/jeff/numa/Makefile.inc1 user/jeff/numa/bin/ps/extern.h user/jeff/numa/bin/ps/keyword.c user/jeff/numa/bin/ps/print.c user/jeff/numa/bin/ps/ps.1 user/jeff/numa/bin/ps/ps.c user/jeff/numa/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp user/jeff/numa/etc/mtree/BSD.tests.dist user/jeff/numa/etc/rc.d/fsck user/jeff/numa/etc/rc.d/hostname user/jeff/numa/gnu/usr.bin/gdb/kgdb/trgt_amd64.c user/jeff/numa/lib/libc/net/getnameinfo.3 user/jeff/numa/lib/libc/net/getnameinfo.c user/jeff/numa/lib/libc/sys/sendfile.2 user/jeff/numa/lib/libdpv/dialog_util.c user/jeff/numa/lib/libdpv/dpv.3 user/jeff/numa/lib/libdpv/util.c user/jeff/numa/lib/libfigpar/figpar.3 user/jeff/numa/lib/libipsec/pfkey.c user/jeff/numa/lib/libmagic/Makefile user/jeff/numa/lib/libsysdecode/mktables user/jeff/numa/libexec/tftpd/Makefile user/jeff/numa/libexec/tftpd/tftp-transfer.c user/jeff/numa/libexec/tftpd/tftpd.c user/jeff/numa/release/packages/kernel.ucl user/jeff/numa/sbin/ipfw/ipfw.8 user/jeff/numa/sbin/mount/mount.c user/jeff/numa/sbin/nvmecontrol/Makefile user/jeff/numa/sbin/nvmecontrol/identify.c user/jeff/numa/sbin/nvmecontrol/logpage.c user/jeff/numa/sbin/nvmecontrol/nvmecontrol.8 user/jeff/numa/sbin/nvmecontrol/nvmecontrol.c user/jeff/numa/sbin/nvmecontrol/nvmecontrol.h user/jeff/numa/sbin/sysctl/sysctl.8 user/jeff/numa/sbin/sysctl/sysctl.c user/jeff/numa/share/examples/Makefile user/jeff/numa/share/man/man4/atrtc.4 user/jeff/numa/share/man/man5/rc.conf.5 user/jeff/numa/share/man/man9/style.9 user/jeff/numa/share/misc/committers-ports.dot user/jeff/numa/share/misc/pci_vendors user/jeff/numa/share/termcap/termcap user/jeff/numa/stand/common/bootstrap.h user/jeff/numa/stand/common/disk.c user/jeff/numa/stand/common/disk.h user/jeff/numa/stand/common/interp_lua.c user/jeff/numa/stand/common/isapnp.c user/jeff/numa/stand/common/load_elf.c user/jeff/numa/stand/common/load_elf_obj.c user/jeff/numa/stand/common/metadata.c user/jeff/numa/stand/common/misc.c user/jeff/numa/stand/common/pnp.c user/jeff/numa/stand/efi/boot1/boot1.c user/jeff/numa/stand/efi/boot1/ufs_module.c user/jeff/numa/stand/efi/include/efi.h user/jeff/numa/stand/efi/include/efilib.h user/jeff/numa/stand/efi/libefi/Makefile user/jeff/numa/stand/efi/libefi/devicename.c user/jeff/numa/stand/efi/libefi/efipart.c user/jeff/numa/stand/efi/libefi/efizfs.c user/jeff/numa/stand/efi/libefi/env.c user/jeff/numa/stand/efi/loader/arch/arm/exec.c user/jeff/numa/stand/efi/loader/bootinfo.c user/jeff/numa/stand/efi/loader/main.c user/jeff/numa/stand/ficl/aarch64/sysdep.c user/jeff/numa/stand/ficl/amd64/sysdep.c user/jeff/numa/stand/ficl/arm/sysdep.c user/jeff/numa/stand/ficl/i386/sysdep.c user/jeff/numa/stand/ficl/mips/sysdep.c user/jeff/numa/stand/ficl/mips64/sysdep.c user/jeff/numa/stand/ficl/powerpc/sysdep.c user/jeff/numa/stand/ficl/riscv/sysdep.c user/jeff/numa/stand/ficl/sparc64/sysdep.c user/jeff/numa/stand/i386/btx/lib/btxv86.h user/jeff/numa/stand/i386/libi386/biosacpi.c user/jeff/numa/stand/i386/libi386/bioscd.c user/jeff/numa/stand/i386/libi386/biosdisk.c user/jeff/numa/stand/i386/libi386/biospnp.c user/jeff/numa/stand/i386/libi386/bootinfo32.c user/jeff/numa/stand/i386/libi386/bootinfo64.c user/jeff/numa/stand/i386/libi386/devicename.c user/jeff/numa/stand/i386/libi386/elf64_freebsd.c user/jeff/numa/stand/i386/libi386/libi386.h user/jeff/numa/stand/i386/libi386/multiboot.c user/jeff/numa/stand/i386/libi386/pxe.c user/jeff/numa/stand/i386/loader/chain.c user/jeff/numa/stand/i386/loader/main.c user/jeff/numa/stand/libsa/arp.c user/jeff/numa/stand/libsa/bootp.c user/jeff/numa/stand/libsa/bootparam.c user/jeff/numa/stand/libsa/dosfs.h user/jeff/numa/stand/libsa/ext2fs.c user/jeff/numa/stand/libsa/net.h user/jeff/numa/stand/libsa/rpc.c user/jeff/numa/stand/libsa/stand.h user/jeff/numa/stand/loader.mk user/jeff/numa/stand/lua/config.lua user/jeff/numa/stand/lua/core.lua user/jeff/numa/stand/lua/menu.lua user/jeff/numa/stand/mips/beri/boot2/boot2.c user/jeff/numa/stand/mips/beri/common/altera_jtag_uart.c user/jeff/numa/stand/mips/beri/common/cons.h user/jeff/numa/stand/mips/beri/loader/beri_console.c user/jeff/numa/stand/mips/beri/loader/beri_disk_cfi.c user/jeff/numa/stand/mips/beri/loader/beri_disk_sdcard.c user/jeff/numa/stand/mips/beri/loader/devicename.c user/jeff/numa/stand/ofw/libofw/devicename.c user/jeff/numa/stand/ofw/libofw/libofw.h user/jeff/numa/stand/ofw/libofw/openfirm.c user/jeff/numa/stand/powerpc/boot1.chrp/boot1.c user/jeff/numa/stand/powerpc/kboot/ppc64_elf_freebsd.c user/jeff/numa/stand/powerpc/ofw/elf_freebsd.c user/jeff/numa/stand/powerpc/ofw/main.c user/jeff/numa/stand/powerpc/ofw/ppc64_elf_freebsd.c user/jeff/numa/stand/sparc64/boot1/boot1.c user/jeff/numa/stand/sparc64/loader/main.c user/jeff/numa/stand/uboot/common/main.c user/jeff/numa/stand/uboot/lib/devicename.c user/jeff/numa/stand/uboot/lib/disk.c user/jeff/numa/stand/uboot/lib/elf_freebsd.c user/jeff/numa/stand/uboot/lib/libuboot.h user/jeff/numa/stand/userboot/userboot/bootinfo32.c user/jeff/numa/stand/userboot/userboot/bootinfo64.c user/jeff/numa/stand/userboot/userboot/devicename.c user/jeff/numa/stand/userboot/userboot/elf64_freebsd.c user/jeff/numa/stand/userboot/userboot/main.c user/jeff/numa/stand/userboot/userboot/userboot_disk.c user/jeff/numa/stand/zfs/libzfs.h user/jeff/numa/stand/zfs/zfs.c user/jeff/numa/sys/amd64/amd64/efirt_machdep.c (contents, props changed) user/jeff/numa/sys/amd64/linux/linux_sysvec.c user/jeff/numa/sys/amd64/linux32/linux32_sysvec.c user/jeff/numa/sys/arm/allwinner/clkng/ccu_sun8i_r.c user/jeff/numa/sys/arm/broadcom/bcm2835/bcm2835_rng.c user/jeff/numa/sys/arm64/arm64/efirt_machdep.c user/jeff/numa/sys/arm64/arm64/gicv3_its.c user/jeff/numa/sys/cam/ata/ata_da.c user/jeff/numa/sys/cam/cam_iosched.c user/jeff/numa/sys/cam/cam_periph.c user/jeff/numa/sys/cam/cam_periph.h user/jeff/numa/sys/cam/ctl/ctl_frontend_iscsi.c user/jeff/numa/sys/cam/ctl/ctl_frontend_iscsi.h user/jeff/numa/sys/cam/nvme/nvme_da.c user/jeff/numa/sys/cam/scsi/scsi_da.c user/jeff/numa/sys/cam/scsi/scsi_enc.c user/jeff/numa/sys/cam/scsi/scsi_pass.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/sys/dmu_objset.h 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/zfs_ioctl.c user/jeff/numa/sys/compat/linux/linux_ioctl.c user/jeff/numa/sys/compat/linux/linux_signal.c user/jeff/numa/sys/compat/linux/linux_stats.c user/jeff/numa/sys/compat/linux/linux_util.c user/jeff/numa/sys/compat/linuxkpi/common/include/linux/kernel.h user/jeff/numa/sys/compat/linuxkpi/common/src/linux_compat.c user/jeff/numa/sys/conf/NOTES user/jeff/numa/sys/conf/config.mk user/jeff/numa/sys/conf/files.powerpc user/jeff/numa/sys/conf/kern.mk user/jeff/numa/sys/conf/kern.opts.mk user/jeff/numa/sys/conf/kern.post.mk user/jeff/numa/sys/conf/kern.pre.mk user/jeff/numa/sys/conf/options user/jeff/numa/sys/contrib/dev/acpica/changes.txt user/jeff/numa/sys/contrib/dev/acpica/components/debugger/dbdisply.c user/jeff/numa/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c user/jeff/numa/sys/contrib/dev/acpica/components/events/evevent.c user/jeff/numa/sys/contrib/dev/acpica/components/events/evgpe.c user/jeff/numa/sys/contrib/dev/acpica/components/events/evgpeblk.c user/jeff/numa/sys/contrib/dev/acpica/components/events/evrgnini.c user/jeff/numa/sys/contrib/dev/acpica/components/events/evxface.c user/jeff/numa/sys/contrib/dev/acpica/components/events/evxfgpe.c user/jeff/numa/sys/contrib/dev/acpica/components/executer/exdebug.c user/jeff/numa/sys/contrib/dev/acpica/components/hardware/hwgpe.c user/jeff/numa/sys/contrib/dev/acpica/components/hardware/hwsleep.c user/jeff/numa/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c user/jeff/numa/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c user/jeff/numa/sys/contrib/dev/acpica/components/namespace/nseval.c user/jeff/numa/sys/contrib/dev/acpica/components/namespace/nsload.c user/jeff/numa/sys/contrib/dev/acpica/components/namespace/nsparse.c user/jeff/numa/sys/contrib/dev/acpica/components/namespace/nsxfname.c user/jeff/numa/sys/contrib/dev/acpica/components/parser/psargs.c user/jeff/numa/sys/contrib/dev/acpica/components/parser/psloop.c user/jeff/numa/sys/contrib/dev/acpica/components/parser/psobject.c user/jeff/numa/sys/contrib/dev/acpica/components/tables/tbdata.c user/jeff/numa/sys/contrib/dev/acpica/components/tables/tbinstal.c user/jeff/numa/sys/contrib/dev/acpica/components/tables/tbxfload.c user/jeff/numa/sys/contrib/dev/acpica/components/utilities/utosi.c user/jeff/numa/sys/contrib/dev/acpica/components/utilities/utxfinit.c user/jeff/numa/sys/contrib/dev/acpica/include/acevents.h user/jeff/numa/sys/contrib/dev/acpica/include/acmacros.h user/jeff/numa/sys/contrib/dev/acpica/include/acpixf.h user/jeff/numa/sys/contrib/dev/acpica/include/actypes.h user/jeff/numa/sys/contrib/zstd/Makefile user/jeff/numa/sys/contrib/zstd/NEWS user/jeff/numa/sys/contrib/zstd/README.md user/jeff/numa/sys/contrib/zstd/circle.yml user/jeff/numa/sys/contrib/zstd/contrib/meson/meson.build user/jeff/numa/sys/contrib/zstd/doc/zstd_compression_format.md user/jeff/numa/sys/contrib/zstd/doc/zstd_manual.html user/jeff/numa/sys/contrib/zstd/lib/BUCK user/jeff/numa/sys/contrib/zstd/lib/common/bitstream.h user/jeff/numa/sys/contrib/zstd/lib/common/mem.h user/jeff/numa/sys/contrib/zstd/lib/common/pool.c user/jeff/numa/sys/contrib/zstd/lib/common/xxhash.c user/jeff/numa/sys/contrib/zstd/lib/common/zstd_common.c user/jeff/numa/sys/contrib/zstd/lib/common/zstd_internal.h user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_compress.c user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_double_fast.c user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_double_fast.h user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_fast.c user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_fast.h user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_lazy.c user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_lazy.h user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_ldm.h user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_opt.c user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_opt.h user/jeff/numa/sys/contrib/zstd/lib/compress/zstdmt_compress.c user/jeff/numa/sys/contrib/zstd/lib/compress/zstdmt_compress.h user/jeff/numa/sys/contrib/zstd/lib/decompress/zstd_decompress.c user/jeff/numa/sys/contrib/zstd/lib/deprecated/zbuff_compress.c user/jeff/numa/sys/contrib/zstd/lib/dictBuilder/zdict.c user/jeff/numa/sys/contrib/zstd/lib/legacy/zstd_v01.c user/jeff/numa/sys/contrib/zstd/lib/legacy/zstd_v02.c user/jeff/numa/sys/contrib/zstd/lib/legacy/zstd_v03.c user/jeff/numa/sys/contrib/zstd/lib/legacy/zstd_v04.c user/jeff/numa/sys/contrib/zstd/lib/legacy/zstd_v05.c user/jeff/numa/sys/contrib/zstd/lib/legacy/zstd_v06.c user/jeff/numa/sys/contrib/zstd/lib/legacy/zstd_v07.c user/jeff/numa/sys/contrib/zstd/lib/zstd.h user/jeff/numa/sys/contrib/zstd/programs/BUCK user/jeff/numa/sys/contrib/zstd/programs/Makefile user/jeff/numa/sys/contrib/zstd/programs/bench.c user/jeff/numa/sys/contrib/zstd/programs/bench.h user/jeff/numa/sys/contrib/zstd/programs/dibio.c user/jeff/numa/sys/contrib/zstd/programs/fileio.c user/jeff/numa/sys/contrib/zstd/programs/fileio.h user/jeff/numa/sys/contrib/zstd/programs/platform.h user/jeff/numa/sys/contrib/zstd/programs/util.h user/jeff/numa/sys/contrib/zstd/programs/zstd.1 user/jeff/numa/sys/contrib/zstd/programs/zstd.1.md user/jeff/numa/sys/contrib/zstd/programs/zstdcli.c user/jeff/numa/sys/contrib/zstd/tests/Makefile user/jeff/numa/sys/contrib/zstd/tests/decodecorpus.c user/jeff/numa/sys/contrib/zstd/tests/fullbench.c user/jeff/numa/sys/contrib/zstd/tests/fuzzer.c user/jeff/numa/sys/contrib/zstd/tests/paramgrill.c user/jeff/numa/sys/contrib/zstd/tests/playTests.sh user/jeff/numa/sys/contrib/zstd/tests/zbufftest.c user/jeff/numa/sys/contrib/zstd/tests/zstreamtest.c user/jeff/numa/sys/contrib/zstd/zlibWrapper/BUCK user/jeff/numa/sys/contrib/zstd/zlibWrapper/examples/zwrapbench.c user/jeff/numa/sys/contrib/zstd/zlibWrapper/zstd_zlibwrapper.c user/jeff/numa/sys/crypto/aesni/aesni.c user/jeff/numa/sys/dev/aac/aac.c user/jeff/numa/sys/dev/aacraid/aacraid.c user/jeff/numa/sys/dev/acpica/acpi.c user/jeff/numa/sys/dev/acpica/acpivar.h user/jeff/numa/sys/dev/bwn/if_bwn.c user/jeff/numa/sys/dev/cxgbe/adapter.h user/jeff/numa/sys/dev/cxgbe/firmware/t6fw_cfg.txt user/jeff/numa/sys/dev/cxgbe/offload.h user/jeff/numa/sys/dev/cxgbe/t4_main.c user/jeff/numa/sys/dev/cxgbe/tom/t4_connect.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_listen.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/e1000/e1000_82575.c user/jeff/numa/sys/dev/e1000/e1000_mbx.c user/jeff/numa/sys/dev/e1000/e1000_phy.c user/jeff/numa/sys/dev/e1000/e1000_vf.c user/jeff/numa/sys/dev/efidev/efirt.c (contents, props changed) user/jeff/numa/sys/dev/extres/regulator/regulator.c user/jeff/numa/sys/dev/extres/regulator/regulator.h user/jeff/numa/sys/dev/iscsi/iscsi.c user/jeff/numa/sys/dev/isp/isp.c user/jeff/numa/sys/dev/isp/isp_freebsd.c user/jeff/numa/sys/dev/md/md.c user/jeff/numa/sys/dev/mlx5/driver.h user/jeff/numa/sys/dev/mpr/mpr.c user/jeff/numa/sys/dev/mps/mps.c user/jeff/numa/sys/dev/mps/mps_sas_lsi.c user/jeff/numa/sys/dev/mps/mpsvar.h user/jeff/numa/sys/dev/nvme/nvme.h user/jeff/numa/sys/dev/nvme/nvme_ctrlr.c user/jeff/numa/sys/dev/nvme/nvme_ns.c user/jeff/numa/sys/dev/nvme/nvme_qpair.c user/jeff/numa/sys/dev/otus/if_otus.c user/jeff/numa/sys/dev/ral/rt2560.c user/jeff/numa/sys/dev/ral/rt2661.c user/jeff/numa/sys/dev/rtwn/rtl8188e/r88e_chan.c user/jeff/numa/sys/dev/rtwn/rtl8192c/r92c_chan.c user/jeff/numa/sys/dev/usb/wlan/if_rum.c user/jeff/numa/sys/dev/usb/wlan/if_run.c user/jeff/numa/sys/dev/usb/wlan/if_uath.c user/jeff/numa/sys/dev/usb/wlan/if_upgt.c user/jeff/numa/sys/dev/usb/wlan/if_ural.c user/jeff/numa/sys/dev/usb/wlan/if_urtw.c user/jeff/numa/sys/dev/usb/wlan/if_zyd.c user/jeff/numa/sys/dev/vt/hw/vga/vt_vga.c user/jeff/numa/sys/dts/arm/rpi.dts user/jeff/numa/sys/dts/arm/rpi2.dts user/jeff/numa/sys/geom/geom.h user/jeff/numa/sys/geom/geom_subr.c user/jeff/numa/sys/i386/linux/imgact_linux.c user/jeff/numa/sys/i386/linux/linux_machdep.c user/jeff/numa/sys/i386/linux/linux_sysvec.c user/jeff/numa/sys/isa/rtc.h user/jeff/numa/sys/kern/imgact_aout.c user/jeff/numa/sys/kern/imgact_binmisc.c user/jeff/numa/sys/kern/imgact_elf.c user/jeff/numa/sys/kern/imgact_gzip.c user/jeff/numa/sys/kern/imgact_shell.c user/jeff/numa/sys/kern/subr_gtaskqueue.c user/jeff/numa/sys/kern/subr_uio.c user/jeff/numa/sys/kern/tty_compat.c user/jeff/numa/sys/kern/vfs_bio.c user/jeff/numa/sys/kern/vfs_mountroot.c user/jeff/numa/sys/mips/include/param.h user/jeff/numa/sys/mips/mips/support.S user/jeff/numa/sys/modules/aac/Makefile user/jeff/numa/sys/modules/aacraid/Makefile user/jeff/numa/sys/modules/cam/Makefile user/jeff/numa/sys/modules/cxgbe/tom/Makefile user/jeff/numa/sys/modules/isp/Makefile user/jeff/numa/sys/modules/usb/rum/Makefile user/jeff/numa/sys/modules/usb/run/Makefile user/jeff/numa/sys/modules/usb/uath/Makefile user/jeff/numa/sys/modules/usb/upgt/Makefile user/jeff/numa/sys/modules/usb/ural/Makefile user/jeff/numa/sys/modules/usb/urtw/Makefile user/jeff/numa/sys/modules/usb/zyd/Makefile user/jeff/numa/sys/net80211/ieee80211_output.c user/jeff/numa/sys/net80211/ieee80211_proto.h user/jeff/numa/sys/netipsec/keysock.c user/jeff/numa/sys/netipsec/keysock.h user/jeff/numa/sys/netpfil/ipfw/ip_fw2.c user/jeff/numa/sys/powerpc/aim/aim_machdep.c user/jeff/numa/sys/powerpc/aim/locore64.S user/jeff/numa/sys/powerpc/aim/mmu_oea64.c user/jeff/numa/sys/powerpc/ofw/ofw_machdep.c user/jeff/numa/sys/powerpc/ofw/ofwcall64.S user/jeff/numa/sys/powerpc/powerpc/machdep.c user/jeff/numa/sys/sys/aac_ioctl.h user/jeff/numa/sys/sys/imgact_elf.h user/jeff/numa/sys/sys/mdioctl.h user/jeff/numa/sys/vm/vm_page.c user/jeff/numa/sys/x86/isa/atrtc.c user/jeff/numa/sys/x86/isa/clock.c user/jeff/numa/sys/x86/x86/identcpu.c user/jeff/numa/tests/sys/cddl/zfs/include/libtest.kshlib user/jeff/numa/tests/sys/cddl/zfs/tests/cache/cache.kshlib user/jeff/numa/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh user/jeff/numa/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_005_neg.ksh user/jeff/numa/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.kshlib user/jeff/numa/tests/sys/cddl/zfs/tests/cli_root/zpool_export/setup.ksh user/jeff/numa/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export.cfg user/jeff/numa/tests/sys/cddl/zfs/tests/cli_root/zpool_get/setup.ksh user/jeff/numa/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg user/jeff/numa/tests/sys/cddl/zfs/tests/cli_root/zpool_history/setup.ksh user/jeff/numa/tests/sys/cddl/zfs/tests/cli_root/zpool_history/zpool_history.cfg user/jeff/numa/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_test.sh user/jeff/numa/tests/sys/cddl/zfs/tests/hotplug/setup.ksh user/jeff/numa/tests/sys/cddl/zfs/tests/slog/slog.kshlib user/jeff/numa/usr.bin/calendar/calendars/calendar.freebsd user/jeff/numa/usr.bin/dpv/dpv.1 user/jeff/numa/usr.bin/iscsictl/iscsictl.c user/jeff/numa/usr.bin/tftp/tftp.c user/jeff/numa/usr.sbin/bhyvectl/bhyvectl.c user/jeff/numa/usr.sbin/bsdconfig/bsdconfig.8 user/jeff/numa/usr.sbin/cxgbetool/Makefile user/jeff/numa/usr.sbin/cxgbetool/cxgbetool.c user/jeff/numa/usr.sbin/lpr/common_source/ctlinfo.c user/jeff/numa/usr.sbin/mpsutil/Makefile user/jeff/numa/usr.sbin/mpsutil/mps_show.c user/jeff/numa/usr.sbin/mpsutil/mpsutil.c user/jeff/numa/usr.sbin/mpsutil/mpsutil.h user/jeff/numa/usr.sbin/usbconfig/usbconfig.8 user/jeff/numa/usr.sbin/usbconfig/usbconfig.c Directory Properties: user/jeff/numa/ (props changed) user/jeff/numa/contrib/llvm/ (props changed) user/jeff/numa/gnu/usr.bin/gdb/ (props changed) user/jeff/numa/sys/cddl/contrib/opensolaris/ (props changed) user/jeff/numa/sys/contrib/dev/acpica/ (props changed) user/jeff/numa/sys/contrib/zstd/ (props changed) user/jeff/numa/usr.sbin/cxgbetool/reg_defs_t5.c (props changed) user/jeff/numa/usr.sbin/cxgbetool/reg_defs_t6.c (props changed) Modified: user/jeff/numa/Makefile.inc1 ============================================================================== --- user/jeff/numa/Makefile.inc1 Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/Makefile.inc1 Thu Mar 15 20:25:06 2018 (r331024) @@ -1698,6 +1698,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ sed -e "s/%VERSION%/${PKG_VERSION}/" \ -e "s/%PKGNAME%/kernel-${INSTALLKERNEL:tl}${flavor}/" \ + -e "s/%KERNELDIR%/kernel/" \ -e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ @@ -1733,6 +1734,7 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_ pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ sed -e "s/%VERSION%/${PKG_VERSION}/" \ -e "s/%PKGNAME%/kernel-${_kernel:tl}${flavor}/" \ + -e "s/%KERNELDIR%/kernel.${_kernel}/" \ -e "s/%COMMENT%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ Modified: user/jeff/numa/bin/ps/extern.h ============================================================================== --- user/jeff/numa/bin/ps/extern.h Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/bin/ps/extern.h Thu Mar 15 20:25:06 2018 (r331024) @@ -55,6 +55,7 @@ char *emulname(KINFO *, VARENT *); VARENT *find_varentry(VAR *); const char *fmt_argv(char **, char *, char *, size_t); double getpcpu(const KINFO *); +char *jailname(KINFO *, VARENT *); char *kvar(KINFO *, VARENT *); char *label(KINFO *, VARENT *); char *loginclass(KINFO *, VARENT *); Modified: user/jeff/numa/bin/ps/keyword.c ============================================================================== --- user/jeff/numa/bin/ps/keyword.c Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/bin/ps/keyword.c Thu Mar 15 20:25:06 2018 (r331024) @@ -108,6 +108,7 @@ static VAR var[] = { {"inblk", "INBLK", NULL, "read-blocks", USER, rvar, ROFF(ru_inblock), LONG, "ld", 0}, {"inblock", "", "inblk", NULL, 0, NULL, 0, CHAR, NULL, 0}, + {"jail", "JAIL", NULL, "jail-name", LJUST, jailname, 0, CHAR, NULL, 0}, {"jid", "JID", NULL, "jail-id", 0, kvar, KOFF(ki_jid), INT, "d", 0}, {"jobc", "JOBC", NULL, "job-control-count", 0, kvar, KOFF(ki_jobc), SHORT, "d", 0}, Modified: user/jeff/numa/bin/ps/print.c ============================================================================== --- user/jeff/numa/bin/ps/print.c Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/bin/ps/print.c Thu Mar 15 20:25:06 2018 (r331024) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -839,4 +840,17 @@ loginclass(KINFO *k, VARENT *ve __unused) return (strdup("-")); } return (strdup(k->ki_p->ki_loginclass)); +} + +char * +jailname(KINFO *k, VARENT *ve __unused) +{ + char *name; + + if (k->ki_p->ki_jid == 0) + return (strdup("-")); + name = jail_getname(k->ki_p->ki_jid); + if (name == NULL) + return (strdup("-")); + return (name); } Modified: user/jeff/numa/bin/ps/ps.1 ============================================================================== --- user/jeff/numa/bin/ps/ps.1 Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/bin/ps/ps.1 Thu Mar 15 20:25:06 2018 (r331024) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd January 23, 2018 +.Dd March 13, 2018 .Dt PS 1 .Os .Sh NAME @@ -101,6 +101,14 @@ The default output format includes, for each process, controlling terminal, state, CPU time (including both user and system time) and associated command. .Pp +If the +.Nm +process is associated with a terminal, the default output width is that of the +terminal; otherwise the output width is unlimited. +See also the +.Fl w +option. +.Pp The options are as follows: .Bl -tag -width indent .It Fl -libxo @@ -257,13 +265,15 @@ option implies the .Fl m option. .It Fl w -Use 132 columns to display information, instead of the default which -is your window size. +Use at least 132 columns to display information, instead of the default which +is the window size if +.Nm +is associated with a terminal. If the .Fl w option is specified more than once, .Nm -will use as many columns as necessary without regard for your window size. +will use as many columns as necessary without regard for the window size. Note that this option has no effect if the .Dq command column is not the last column displayed. @@ -566,6 +576,8 @@ group name (from egid) (alias .It Cm inblk total blocks read (alias .Cm inblock ) +.It Cm jail +jail name .It Cm jid jail ID .It Cm jobc Modified: user/jeff/numa/bin/ps/ps.c ============================================================================== --- user/jeff/numa/bin/ps/ps.c Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/bin/ps/ps.c Thu Mar 15 20:25:06 2018 (r331024) @@ -202,6 +202,11 @@ main(int argc, char *argv[]) * any of stdout, stderr, or stdin is a terminal. The intent * is that "ps", "ps | more", and "ps | grep" all use the same * default line length unless -w is specified. + * + * If not interactive, the default length was traditionally 79. + * It has been changed to unlimited. This is mostly for the + * benefit of non-interactive scripts, which arguably should + * use -ww, but is compatible with Linux. */ if ((cols = getenv("COLUMNS")) != NULL && *cols != '\0') termwidth = atoi(cols); @@ -209,7 +214,7 @@ main(int argc, char *argv[]) ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&ws) == -1) || ws.ws_col == 0) - termwidth = 79; + termwidth = UNLIMITED; else termwidth = ws.ws_col - 1; Modified: user/jeff/numa/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp ============================================================================== --- user/jeff/numa/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Thu Mar 15 20:25:06 2018 (r331024) @@ -10201,7 +10201,14 @@ static SDValue PerformSHLSimplify(SDNode *N, case ISD::XOR: case ISD::SETCC: case ARMISD::CMP: - // Check that its not already using a shl. + // Check that the user isn't already using a constant because there + // aren't any instructions that support an immediate operand and a + // shifted operand. + if (isa(U->getOperand(0)) || + isa(U->getOperand(1))) + return SDValue(); + + // Check that it's not already using a shift. if (U->getOperand(0).getOpcode() == ISD::SHL || U->getOperand(1).getOpcode() == ISD::SHL) return SDValue(); @@ -10223,8 +10230,6 @@ static SDValue PerformSHLSimplify(SDNode *N, if (!C1ShlC2 || !C2) return SDValue(); - DEBUG(dbgs() << "Trying to simplify shl: "; N->dump()); - APInt C2Int = C2->getAPIntValue(); APInt C1Int = C1ShlC2->getAPIntValue(); @@ -10238,12 +10243,12 @@ static SDValue PerformSHLSimplify(SDNode *N, C1Int.lshrInPlace(C2Int); // The immediates are encoded as an 8-bit value that can be rotated. - unsigned Zeros = C1Int.countLeadingZeros() + C1Int.countTrailingZeros(); - if (C1Int.getBitWidth() - Zeros > 8) - return SDValue(); + auto LargeImm = [](const APInt &Imm) { + unsigned Zeros = Imm.countLeadingZeros() + Imm.countTrailingZeros(); + return Imm.getBitWidth() - Zeros > 8; + }; - Zeros = C2Int.countLeadingZeros() + C2Int.countTrailingZeros(); - if (C2Int.getBitWidth() - Zeros > 8) + if (LargeImm(C1Int) || LargeImm(C2Int)) return SDValue(); SelectionDAG &DAG = DCI.DAG; @@ -10253,6 +10258,10 @@ static SDValue PerformSHLSimplify(SDNode *N, DAG.getConstant(C1Int, dl, MVT::i32)); // Shift left to compensate for the lshr of C1Int. SDValue Res = DAG.getNode(ISD::SHL, dl, MVT::i32, BinOp, SHL.getOperand(1)); + + DEBUG(dbgs() << "Simplify shl use:\n"; SHL.getOperand(0).dump(); SHL.dump(); + N->dump()); + DEBUG(dbgs() << "Into:\n"; X.dump(); BinOp.dump(); Res.dump()); DAG.ReplaceAllUsesWith(SDValue(N, 0), Res); return SDValue(N, 0); Modified: user/jeff/numa/etc/mtree/BSD.tests.dist ============================================================================== --- user/jeff/numa/etc/mtree/BSD.tests.dist Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/etc/mtree/BSD.tests.dist Thu Mar 15 20:25:06 2018 (r331024) @@ -382,6 +382,8 @@ .. rtld-elf .. + tftpd + .. .. sbin dhclient Modified: user/jeff/numa/etc/rc.d/fsck ============================================================================== --- user/jeff/numa/etc/rc.d/fsck Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/etc/rc.d/fsck Thu Mar 15 20:25:06 2018 (r331024) @@ -57,7 +57,7 @@ fsck_start() echo "Reboot failed; help!" stop_boot ;; - 8) + 8|16) if checkyesno fsck_y_enable; then echo "File system preen failed, trying fsck -y ${fsck_y_flags}" fsck -y ${fsck_y_flags} Modified: user/jeff/numa/etc/rc.d/hostname ============================================================================== --- user/jeff/numa/etc/rc.d/hostname Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/etc/rc.d/hostname Thu Mar 15 20:25:06 2018 (r331024) @@ -60,9 +60,11 @@ hostname_start() # Have we got a hostname yet? # if [ -z "${hostname}" ]; then - # Null hostname is probably OK if DHCP is in use. + # Null hostname is probably OK if DHCP is in use, + # or when hostname is already set (common for jails). # - if [ -z "`list_net_interfaces dhcp`" ]; then + if [ -z "`list_net_interfaces dhcp`" -a \ + -z "`/bin/hostname`" ]; then warn "\$hostname is not set -- see rc.conf(5)." fi return Modified: user/jeff/numa/gnu/usr.bin/gdb/kgdb/trgt_amd64.c ============================================================================== --- user/jeff/numa/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Thu Mar 15 20:25:06 2018 (r331024) @@ -189,6 +189,7 @@ kgdb_trgt_trapframe_sniffer(struct frame_info *next_fr if (pname == NULL) return (NULL); if (strcmp(pname, "calltrap") == 0 || + strcmp(pname, "fast_syscall_common") == 0 || strcmp(pname, "mchk_calltrap") == 0 || strcmp(pname, "nmi_calltrap") == 0 || (pname[0] == 'X' && pname[1] != '_')) Modified: user/jeff/numa/lib/libc/net/getnameinfo.3 ============================================================================== --- user/jeff/numa/lib/libc/net/getnameinfo.3 Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/lib/libc/net/getnameinfo.3 Thu Mar 15 20:25:06 2018 (r331024) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 28, 2016 +.Dd March 15, 2018 .Dt GETNAMEINFO 3 .Os .Sh NAME @@ -80,6 +80,20 @@ or UNIX-domain respectively that is .Fa salen bytes long. +If +.Fa salen +is shorter than the length corresponding to the specified +address family or longer than +.Fn sizeof "struct sockaddr_storage" , +it returns +.Er EAI_FAMILY . +Note that +.Va sa->sa_len +should be consistent with +.Fa salen +though the value of +.Va sa->sa_len +is not directly used in this function. .Pp The host and service names associated with .Fa sa Modified: user/jeff/numa/lib/libc/net/getnameinfo.c ============================================================================== --- user/jeff/numa/lib/libc/net/getnameinfo.c Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/lib/libc/net/getnameinfo.c Thu Mar 15 20:25:06 2018 (r331024) @@ -124,26 +124,36 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen afd = find_afd(sa->sa_family); if (afd == NULL) return (EAI_FAMILY); + /* + * getnameinfo() accepts an salen of sizeof(struct sockaddr_storage) + * at maximum as shown in RFC 4038 Sec.6.2.3. + */ + if (salen > sizeof(struct sockaddr_storage)) + return (EAI_FAMILY); + switch (sa->sa_family) { case PF_LOCAL: /* - * PF_LOCAL uses variable sa->sa_len depending on the + * PF_LOCAL uses variable salen depending on the * content length of sun_path. Require 1 byte in * sun_path at least. */ - if (salen > afd->a_socklen || - salen <= afd->a_socklen - + if (salen <= afd->a_socklen - sizeofmember(struct sockaddr_un, sun_path)) - return (EAI_FAIL); + return (EAI_FAMILY); + else if (salen > afd->a_socklen) + salen = afd->a_socklen; break; case PF_LINK: if (salen <= afd->a_socklen - sizeofmember(struct sockaddr_dl, sdl_data)) - return (EAI_FAIL); + return (EAI_FAMILY); break; default: - if (salen != afd->a_socklen) - return (EAI_FAIL); + if (salen < afd->a_socklen) + return (EAI_FAMILY); + else + salen = afd->a_socklen; break; } @@ -517,7 +527,7 @@ getnameinfo_un(const struct afd *afd, if (serv != NULL && servlen > 0) *serv = '\0'; if (host != NULL && hostlen > 0) { - pathlen = sa->sa_len - afd->a_off; + pathlen = salen - afd->a_off; if (pathlen + 1 > hostlen) { *host = '\0'; Modified: user/jeff/numa/lib/libc/sys/sendfile.2 ============================================================================== --- user/jeff/numa/lib/libc/sys/sendfile.2 Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/lib/libc/sys/sendfile.2 Thu Mar 15 20:25:06 2018 (r331024) @@ -129,8 +129,8 @@ Starting with .Nm sending files off the .Xr ffs 7 -filesystem doesn't block on I/O -(see +filesystem does not block on I/O +(see .Sx IMPLEMENTATION NOTES ), so the condition no longer applies. However, it is safe if an application utilizes @@ -140,8 +140,8 @@ and on performs the same action as it did in older .Fx -versions, e.g. -.Xr aio_read 2, +versions, e.g., +.Xr aio_read 2 , .Xr read 2 or .Nm @@ -210,7 +210,7 @@ The .Fx implementation of .Fn sendfile -doesn't block on disk I/O when it sends a file off the +does not block on disk I/O when it sends a file off the .Xr ffs 7 filesystem. The syscall returns success before the actual I/O completes, and data Modified: user/jeff/numa/lib/libdpv/dialog_util.c ============================================================================== --- user/jeff/numa/lib/libdpv/dialog_util.c Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/lib/libdpv/dialog_util.c Thu Mar 15 20:25:06 2018 (r331024) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Devin Teske + * Copyright (c) 2013-2018 Devin Teske * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -328,8 +328,7 @@ dialog_spawn_gauge(char *init_prompt, pid_t *pid) posix_spawn_file_actions_addclose(&action, stdin_pipe[1]); error = posix_spawnp(pid, dialog, &action, (const posix_spawnattr_t *)NULL, dargv, environ); - if (error != 0) - err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__); + if (error != 0) err(EXIT_FAILURE, "%s", dialog); /* NB: Do not free(3) *dargv[], else SIGSEGV */ Modified: user/jeff/numa/lib/libdpv/dpv.3 ============================================================================== --- user/jeff/numa/lib/libdpv/dpv.3 Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/lib/libdpv/dpv.3 Thu Mar 15 20:25:06 2018 (r331024) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2013-2016 Devin Teske +.\" Copyright (c) 2013-2018 Devin Teske .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jan 26, 2016 +.Dd March 13, 2018 .Dt DPV 3 .Os .Sh NAME @@ -36,7 +36,8 @@ .In dpv.h .Ft int .Fo dpv -.Fa "struct dpv_config *config, struct dpv_file_node *file_list" +.Fa "struct dpv_config *config" +.Fa "struct dpv_file_node *file_list" .Fc .Ft void .Fo dpv_free @@ -60,8 +61,7 @@ or The .Fn dpv .Fa config -argument contains the following properties for configuring global display -features: +argument properties for configuring global display features: .Bd -literal -offset indent struct dpv_config { uint8_t keep_tite; /* Cleaner exit for scripts */ @@ -113,11 +113,12 @@ member of the .Fn dpv .Fa config argument is a mask of bit fields indicating various processing options. -Possible flags are as follows: +Possible flags are: .Bl -tag -width DPV_NO_OVERRUN .It Dv DPV_TEST_MODE Enable test mode. -In test mode, the +In test mode, +the .Fn action callback of the .Fa config @@ -126,18 +127,21 @@ Appends .Dq [TEST MODE] to the status line .Po -to override, set the +to override, +set the .Va status_format member of the .Fn dpv .Fa config argument; -e.g., to +for example, +to .Dv DPV_STATUS_DEFAULT .Pc . .It Dv DPV_WIDE_MODE Enable wide mode. -In wide mode, the length of the +In wide mode, +the length of the .Va aprompt and .Va pprompt @@ -169,7 +173,8 @@ does not support color environment variable is ignored .Pc . .It Dv DPV_NO_OVERRUN -When enabled, callbacks for the current +When enabled, +callbacks for the current .Vt dpv_file_node are terminated when .Fn action @@ -189,7 +194,7 @@ argument to .Fn dpv is a pointer to a .Dq linked-list , -described as follows in +described in .In dpv.h : .Bd -literal -offset indent struct dpv_file_node { @@ -206,7 +211,8 @@ struct dpv_file_node { For each of the items in the .Fa file_list .Dq linked-list -argument, the +argument, +the .Fn action callback member of the .Fn dpv @@ -214,7 +220,7 @@ callback member of the argument is called. The .Fn action -function should perform a +function performs a .Dq nominal action on the file and return. The return value of @@ -231,7 +237,7 @@ provides a reference to the current .Vt dpv_file_node being processed. .Fa out -provides a file descriptor where the data should go. +provides a file descriptor where the data goes. .Pp If the .Va output @@ -244,7 +250,7 @@ the .Fa out file descriptor of .Fn action -will be zero and should be ignored. +will be zero and can be ignored. If .Fa output was set to DPV_OUTPUT_FILE, @@ -257,14 +263,16 @@ was set to DPV_OUTPUT_SHELL, will be an open file descriptor to a pipe for a spawned shell program. When .Fa out -is greater than zero, you should write any data you have read back to +is greater than zero, +write data that has been read back to .Fa out . .Pp To abort .Fn dpv , either from the .Fn action -callback or asynchronously from a signal handler, two globals are provided via +callback or asynchronously from a signal handler, +two globals are provided via .In dpv.h : .Bd -literal -offset indent extern int dpv_interrupt; /* Set to TRUE in interrupt handler */ @@ -272,11 +280,12 @@ extern int dpv_abort; /* Set to true in callback t .Ed .Pp These globals are not automatically reset and must be manually maintained. -Don't forget to reset these globals before subsequent invocations of +Do not forget to reset these globals before subsequent invocations of .Fn dpv when making multiple calls from the same program. .Pp -In addition, the +In addition, +the .Va status member of the .Fn action @@ -284,7 +293,7 @@ member of the argument can be used to control callbacks for the current file. The .Va status -member can be set to any of the following from +member can be set to any of the below from .In dpv.h : .Bd -literal -offset indent enum dpv_status { @@ -296,13 +305,17 @@ enum dpv_status { .Pp The default .Fa status -is zero, DPV_STATUS_RUNING, which keeps the callbacks coming for the current +is zero, +DPV_STATUS_RUNNING, +which keeps the callbacks coming for the current .Fn file . Setting .Ql file->status to anything other than DPV_STATUS_RUNNING will cause .Fn dpv -to loop to the next file, effecting the next callback, if any. +to loop to the next file, +effecting the next callback, +if any. .Pp The .Fn action @@ -318,7 +331,7 @@ Percentages are reported through the return value of the .Fn action callback. -Throughput statistics are calculated from the following global +Throughput statistics are calculated from the below global .Vt int in .In dpv.h : @@ -326,7 +339,7 @@ in extern int dpv_overall_read; .Ed .Pp -This should be set to the number of bytes that have been read for all files. +Set this to the number of bytes that have been read for all files. Throughput information is displayed in the status line .Pq only available when using Xr dialog 3 at the bottom of the screen. @@ -335,18 +348,20 @@ See DPV_DISPLAY_LIBDIALOG above. Note that .Va dpv_overall_read does not have to represent bytes. -For example, you can change the +For example, +the .Va status_format -to display something other than +can be changed to display something other than .Dq Li bytes and increment .Va dpv_overall_read accordingly -.Pq e.g., counting lines . +.Pq for example, counting lines . .Pp When .Fn dpv -is processing the current file, the +is processing the current file, +the .Va length and .Va read @@ -355,7 +370,8 @@ members of the .Fa file argument are used for calculating the display of mini progress bars .Po -if enabled; see +if enabled; +see .Va pbar_size above .Pc . @@ -381,7 +397,7 @@ function performs on private global variables initialized by .Fn dpv . .Sh ENVIRONMENT -The following environment variables are referenced by +The below environment variables are referenced by .Nm : .Bl -tag -width ".Ev USE_COLOR" .It Ev DIALOG @@ -398,17 +414,20 @@ or .Ql Xdialog .Pq for Dv DPV_DISPLAY_XDIALOG . .It Ev DIALOGRC -If set and non-NULL, path to +If set and non-NULL, +path to .Ql .dialogrc file. .It Ev HOME If .Ql Ev $DIALOGRC -is either not set or NULL, used as a prefix to +is either not set or NULL, +used as a prefix to .Ql .dialogrc -.Pq i.e., Ql $HOME/.dialogrc . +.Pq that is, Ql $HOME/.dialogrc . .It Ev USE_COLOR -If set and NULL, disables the use of color when using +If set and NULL, +disables the use of color when using .Xr dialog 1 .Pq does not apply to Xr Xdialog 1 . .It Ev msg_done Ev msg_fail Ev msg_pending @@ -418,7 +437,8 @@ Internationalization strings for overriding the defaul and .Ql Pending respectively. -To prevent their usage, explicitly set the +To prevent their usage, +explicitly set the .Va msg_done , .Va msg_fail , and @@ -471,11 +491,11 @@ This is a known issue with the .Ql --gauge widget in .Xr Xdialog 1 . -Embed escaped newlines within prompt text(s) to force line breaks. +Embed escaped newlines within prompt text to force line breaks. .Pp .Xr dialog 1 does not display the first character after a series of escaped escape-sequences -(e.g., ``\\\\n'' produces ``\\'' instead of ``\\n''). +(for example, ``\\\\n'' produces ``\\'' instead of ``\\n''). This is a known issue with .Xr dialog 1 and does not affect @@ -483,10 +503,10 @@ and does not affect or .Xr Xdialog 1 . .Pp -If your application ignores +If an application ignores .Ev USE_COLOR when set and NULL before calling -.Xr dpv 3 +.Fn dpv with color escape sequences anyway, .Xr dialog 3 and Modified: user/jeff/numa/lib/libdpv/util.c ============================================================================== --- user/jeff/numa/lib/libdpv/util.c Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/lib/libdpv/util.c Thu Mar 15 20:25:06 2018 (r331024) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Devin Teske + * Copyright (c) 2013-2018 Devin Teske * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,8 +100,7 @@ shell_spawn_pipecmd(const char *cmd, const char *label posix_spawn_file_actions_addclose(&action, stdin_pipe[1]); error = posix_spawnp(pid, shellcmd, &action, (const posix_spawnattr_t *)NULL, shellcmd_argv, environ); - if (error != 0) - err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__); + if (error != 0) err(EXIT_FAILURE, "%s", shellcmd); return stdin_pipe[1]; } Modified: user/jeff/numa/lib/libfigpar/figpar.3 ============================================================================== --- user/jeff/numa/lib/libfigpar/figpar.3 Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/lib/libfigpar/figpar.3 Thu Mar 15 20:25:06 2018 (r331024) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2013-2015 Devin Teske +.\" Copyright (c) 2013-2018 Devin Teske .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Nov 2, 2015 +.Dd March 13, 2018 .Dt FIGPAR 3 .Os .Sh NAME @@ -38,22 +38,30 @@ .In figpar.h .Ft int .Fo parse_config -.Fa "struct figpar_config options[], const char *path" -.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option, uint32_t line" -.Fa "char *directive, char *value\*[rp], uint8_t processing_options" +.Fa "struct figpar_config options[]" +.Fa "const char *path" +.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option" +.Fa "uint32_t line" +.Fa "char *directive" +.Fa "char *value\*[rp]" +.Fa "uint8_t processing_options" .Fc .Ft "struct figpar_config *" .Fo get_config_option -.Fa "struct figpar_config options[], const char *directive" +.Fa "struct figpar_config options[]" +.Fa "const char *directive" .Fc .In string_m.h .Ft int .Fo replaceall -.Fa "char *source, const char *find, const char *replace" +.Fa "char *source" +.Fa "const char *find" +.Fa "const char *replace" .Fc .Ft unsigned int .Fo strcount -.Fa "const char *source, const char *find" +.Fa "const char *source" +.Fa "const char *find" .Fc .Ft void .Fo strexpand @@ -70,7 +78,8 @@ .Sh DESCRIPTION The .Nm -library provides a light-weight, portable framework for parsing configuration +library provides a light-weight, +portable framework for parsing configuration files. The library uses .Xr open 2 , @@ -87,8 +96,9 @@ provides raw data to a set of callback functions. These callback functions can in-turn initiate abort through their return value, allowing custom syntax validation during parsing. .Pp -Configuration directives, types, and callback functions are provided through -data structures defined in +Configuration directives, +types, +and callback functions are provided through data structures defined in .In figpar.h : .Bd -literal -offset indent struct figpar_config { @@ -132,7 +142,7 @@ argument to .Fn parse_config is a mask of bit fields which indicate various processing options. -The possible flags are as follows: +The possible flags are: .Bl -tag -width FIGPAR_BREAK_ON_SEMICOLON .It Dv FIGPAR_BREAK_ON_EQUALS An equals sign @@ -151,7 +161,8 @@ Normally directives are matched case insensitively usi .Xr fnmatch 3 . This flag enables directive matching to be case sensitive. .It Dv FIGPAR_REQUIRE_EQUALS -If a directive is not followed by an equals, processing is aborted. +If a directive is not followed by an equals, +processing is aborted. .It Dv FIGPAR_STRICT_EQUALS Equals must be part of the directive to be considered a delimiter between directive and value. @@ -159,7 +170,7 @@ directive and value. .Pp The .Fa options -struct array pointer can be NULL and every directive will invoke the +struct array pointer can be NULL and every directive will run the .Fn unknown function argument. .Pp @@ -168,13 +179,16 @@ The directive for each figpar_config item in the options argument is matched against each parsed directive using .Xr fnmatch 3 until a match is found. -If a match is found, the +If a match is found, +the .Fn action -function for that figpar_config directive is invoked with the line number, -directive, and value. -Otherwise if no match, the +function for that figpar_config directive is run with the line number, +directive, +and value. +Otherwise if no match, +the .Fn unknown -function is invoked +function is run .Pq with the same arguments . .Pp If either @@ -197,19 +211,20 @@ is entirely optional as-is the use of .Fa "enum figpar_cfgtype" or .Fa "union figpar_cfgvalue" . -For example, you could choose to pass a NULL pointer to +For example, +a NULL pointer can be passed to .Fn parse_config -for the first argument and then provide a simple +for the first argument while providing a simple .Fa unknown function based on .Xr queue 3 -that populates a singly-linked list of your own struct containing the +that populates a singly-linked list of a struct containing the .Fa directive and .Fa value . .Pp -In addition, the following miscellaneous string manipulation routines are -provided by +In addition, +miscellaneous string manipulation routines are provided by .In string_m.h : .Bl -tag -width strexpandnl() .It Fn replaceall @@ -224,8 +239,7 @@ Count the number of occurrences of one string that app .Fa source string. Return value is the total count. -An example use would be if you need to know how large a block of memory needs -to be for a +An example use would be to show how large a block of memory needs to be for a .Fn replaceall series. .It Fn strexpand Modified: user/jeff/numa/lib/libipsec/pfkey.c ============================================================================== --- user/jeff/numa/lib/libipsec/pfkey.c Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/lib/libipsec/pfkey.c Thu Mar 15 20:25:06 2018 (r331024) @@ -1595,10 +1595,12 @@ pfkey_send_x5(so, type, spid) * others : success and return value of socket. */ int -pfkey_open() +pfkey_open(void) { int so; - const int bufsiz = 128 * 1024; /*is 128K enough?*/ + int bufsiz_current, bufsiz_wanted; + int ret; + socklen_t len; if ((so = socket(PF_KEY, SOCK_RAW, PF_KEY_V2)) < 0) { __ipsec_set_strerror(strerror(errno)); @@ -1609,8 +1611,28 @@ pfkey_open() * This is a temporary workaround for KAME PR 154. * Don't really care even if it fails. */ - (void)setsockopt(so, SOL_SOCKET, SO_SNDBUF, &bufsiz, sizeof(bufsiz)); - (void)setsockopt(so, SOL_SOCKET, SO_RCVBUF, &bufsiz, sizeof(bufsiz)); + /* Try to have 128k. If we have more, do not lower it. */ + bufsiz_wanted = 128 * 1024; + len = sizeof(bufsiz_current); + ret = getsockopt(so, SOL_SOCKET, SO_SNDBUF, + &bufsiz_current, &len); + if ((ret < 0) || (bufsiz_current < bufsiz_wanted)) + (void)setsockopt(so, SOL_SOCKET, SO_SNDBUF, + &bufsiz_wanted, sizeof(bufsiz_wanted)); + + /* Try to have have at least 2MB. If we have more, do not lower it. */ + bufsiz_wanted = 2 * 1024 * 1024; + len = sizeof(bufsiz_current); + ret = getsockopt(so, SOL_SOCKET, SO_RCVBUF, + &bufsiz_current, &len); + if (ret < 0) + bufsiz_current = 128 * 1024; + + for (; bufsiz_wanted > bufsiz_current; bufsiz_wanted /= 2) { + if (setsockopt(so, SOL_SOCKET, SO_RCVBUF, + &bufsiz_wanted, sizeof(bufsiz_wanted)) == 0) + break; + } __ipsec_errcode = EIPSEC_NO_ERROR; return so; Modified: user/jeff/numa/lib/libmagic/Makefile ============================================================================== --- user/jeff/numa/lib/libmagic/Makefile Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/lib/libmagic/Makefile Thu Mar 15 20:25:06 2018 (r331024) @@ -8,7 +8,9 @@ CONTRDIR= ${SRCTOP}/contrib/file LIB= magic SHLIB_MAJOR= 4 +.if !make(build-tools) LIBADD= z +.endif MAN= libmagic.3 magic.5 SRCS= apprentice.c apptype.c ascmagic.c cdf.c cdf_time.c compress.c \ Modified: user/jeff/numa/lib/libsysdecode/mktables ============================================================================== --- user/jeff/numa/lib/libsysdecode/mktables Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/lib/libsysdecode/mktables Thu Mar 15 20:25:06 2018 (r331024) @@ -146,7 +146,7 @@ gen_table "socktype" "SOCK_[A-Z]+[[:space:]]+[1 gen_table "thrcreateflags" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h" gen_table "umtxop" "UMTX_OP_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" gen_table "vmprot" "VM_PROT_[A-Z]+[[:space:]]+\(\(vm_prot_t\)[[:space:]]+0x[0-9]+\)" "vm/vm.h" -gen_table "vmresult" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h" +gen_table "vmresult" "KERN_[A-Z_]+[[:space:]]+[0-9]+" "vm/vm_param.h" gen_table "wait6opt" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h" gen_table "seekwhence" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h" gen_table "fcntlcmd" "F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]+" "sys/fcntl.h" "F_CANCEL|F_..LCK" Modified: user/jeff/numa/libexec/tftpd/Makefile ============================================================================== --- user/jeff/numa/libexec/tftpd/Makefile Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/libexec/tftpd/Makefile Thu Mar 15 20:25:06 2018 (r331024) @@ -14,4 +14,7 @@ CFLAGS+= -DLIBWRAP LIBADD= wrap .endif +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Modified: user/jeff/numa/libexec/tftpd/tftp-transfer.c ============================================================================== --- user/jeff/numa/libexec/tftpd/tftp-transfer.c Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/libexec/tftpd/tftp-transfer.c Thu Mar 15 20:25:06 2018 (r331024) @@ -304,6 +304,8 @@ send_ack: gettimeofday(&(ts->tstop), NULL); } while (n_data == segsize); + write_close(); + /* Don't do late packet management for the client implementation */ if (acting_as_client) return; Modified: user/jeff/numa/libexec/tftpd/tftpd.c ============================================================================== --- user/jeff/numa/libexec/tftpd/tftpd.c Thu Mar 15 20:09:24 2018 (r331023) +++ user/jeff/numa/libexec/tftpd/tftpd.c Thu Mar 15 20:25:06 2018 (r331024) @@ -421,8 +421,7 @@ main(int argc, char *argv[]) "%s read access denied", peername); exit(1); } - } - if (tp->th_opcode == WRQ) { + } else if (tp->th_opcode == WRQ) { if (allow_wo) tftp_wrq(peer, tp->th_stuff, n - 1); else { @@ -430,7 +429,8 @@ main(int argc, char *argv[]) "%s write access denied", peername); exit(1); } - } + } else + send_error(peer, EBADOP); exit(1); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@freebsd.org Fri Mar 16 16:04: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 0CF4AF59F7C for ; Fri, 16 Mar 2018 16:04:10 +0000 (UTC) (envelope-from markj@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 97773866B3; Fri, 16 Mar 2018 16:04:09 +0000 (UTC) (envelope-from markj@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 8D167260AC; Fri, 16 Mar 2018 16:04:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2GG4953091588; Fri, 16 Mar 2018 16:04:09 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2GG47co091563; Fri, 16 Mar 2018 16:04:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803161604.w2GG47co091563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 16 Mar 2018 16:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r331062 - in user/markj/vm-playground: . bin/ps contrib/llvm/lib/Target/ARM etc/mtree etc/rc.d gnu/usr.bin/gdb/kgdb lib/libc/net lib/libc/sys lib/libdpv lib/libfigpar lib/libipsec lib/l... X-SVN-Group: user X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in user/markj/vm-playground: . bin/ps contrib/llvm/lib/Target/ARM etc/mtree etc/rc.d gnu/usr.bin/gdb/kgdb lib/libc/net lib/libc/sys lib/libdpv lib/libfigpar lib/libipsec lib/libmagic lib/libsysdecode ... X-SVN-Commit-Revision: 331062 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, 16 Mar 2018 16:04:10 -0000 Author: markj Date: Fri Mar 16 16:04:06 2018 New Revision: 331062 URL: https://svnweb.freebsd.org/changeset/base/331062 Log: Merge from user/jeff/numa at r331061. Added: user/markj/vm-playground/libexec/tftpd/tests/ - copied from r331061, user/jeff/numa/libexec/tftpd/tests/ user/markj/vm-playground/sbin/nvmecontrol/format.c - copied unchanged from r331061, user/jeff/numa/sbin/nvmecontrol/format.c user/markj/vm-playground/stand/efi/libefi/efienv.c - copied unchanged from r331061, user/jeff/numa/stand/efi/libefi/efienv.c user/markj/vm-playground/sys/contrib/zstd/doc/images/zstd_logo86.png - copied unchanged from r331061, user/jeff/numa/sys/contrib/zstd/doc/images/zstd_logo86.png user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_compress_internal.h - copied unchanged from r331061, user/jeff/numa/sys/contrib/zstd/lib/compress/zstd_compress_internal.h user/markj/vm-playground/sys/contrib/zstd/tests/seqgen.c - copied unchanged from r331061, user/jeff/numa/sys/contrib/zstd/tests/seqgen.c user/markj/vm-playground/sys/contrib/zstd/tests/seqgen.h - copied unchanged from r331061, user/jeff/numa/sys/contrib/zstd/tests/seqgen.h user/markj/vm-playground/sys/dev/cxgbe/tom/t4_tls.c - copied unchanged from r331061, user/jeff/numa/sys/dev/cxgbe/tom/t4_tls.c user/markj/vm-playground/sys/dev/cxgbe/tom/t4_tls.h - copied unchanged from r331061, user/jeff/numa/sys/dev/cxgbe/tom/t4_tls.h user/markj/vm-playground/usr.sbin/cxgbetool/tcb_common.c - copied unchanged from r331061, user/jeff/numa/usr.sbin/cxgbetool/tcb_common.c user/markj/vm-playground/usr.sbin/cxgbetool/tcb_common.h - copied unchanged from r331061, user/jeff/numa/usr.sbin/cxgbetool/tcb_common.h user/markj/vm-playground/usr.sbin/cxgbetool/tcbinfot4.c - copied unchanged from r331061, user/jeff/numa/usr.sbin/cxgbetool/tcbinfot4.c user/markj/vm-playground/usr.sbin/cxgbetool/tcbinfot5.c - copied unchanged from r331061, user/jeff/numa/usr.sbin/cxgbetool/tcbinfot5.c user/markj/vm-playground/usr.sbin/cxgbetool/tcbinfot6.c - copied unchanged from r331061, user/jeff/numa/usr.sbin/cxgbetool/tcbinfot6.c user/markj/vm-playground/usr.sbin/cxgbetool/tcbshowt4.c - copied unchanged from r331061, user/jeff/numa/usr.sbin/cxgbetool/tcbshowt4.c user/markj/vm-playground/usr.sbin/cxgbetool/tcbshowt5.c - copied unchanged from r331061, user/jeff/numa/usr.sbin/cxgbetool/tcbshowt5.c user/markj/vm-playground/usr.sbin/cxgbetool/tcbshowt6.c - copied unchanged from r331061, user/jeff/numa/usr.sbin/cxgbetool/tcbshowt6.c user/markj/vm-playground/usr.sbin/mpsutil/mps_debug.c - copied unchanged from r331061, user/jeff/numa/usr.sbin/mpsutil/mps_debug.c Deleted: user/markj/vm-playground/sys/arm/conf/BEAGLEBONE-MMCCAM user/markj/vm-playground/sys/arm/conf/IMX6-MMCCAM user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_compress.h user/markj/vm-playground/sys/i386/include/pcaudioio.h user/markj/vm-playground/sys/sys/dataacq.h Modified: user/markj/vm-playground/Makefile.inc1 user/markj/vm-playground/bin/ps/extern.h user/markj/vm-playground/bin/ps/keyword.c user/markj/vm-playground/bin/ps/print.c user/markj/vm-playground/bin/ps/ps.1 user/markj/vm-playground/bin/ps/ps.c user/markj/vm-playground/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp user/markj/vm-playground/etc/mtree/BSD.tests.dist user/markj/vm-playground/etc/rc.d/fsck user/markj/vm-playground/etc/rc.d/hostname user/markj/vm-playground/gnu/usr.bin/gdb/kgdb/trgt_amd64.c user/markj/vm-playground/lib/libc/net/getnameinfo.3 user/markj/vm-playground/lib/libc/net/getnameinfo.c user/markj/vm-playground/lib/libc/sys/sendfile.2 user/markj/vm-playground/lib/libdpv/dialog_util.c user/markj/vm-playground/lib/libdpv/dpv.3 user/markj/vm-playground/lib/libdpv/util.c user/markj/vm-playground/lib/libfigpar/figpar.3 user/markj/vm-playground/lib/libipsec/pfkey.c user/markj/vm-playground/lib/libmagic/Makefile user/markj/vm-playground/lib/libsysdecode/mktables user/markj/vm-playground/libexec/tftpd/Makefile user/markj/vm-playground/libexec/tftpd/tftp-transfer.c user/markj/vm-playground/libexec/tftpd/tftpd.c user/markj/vm-playground/release/packages/kernel.ucl user/markj/vm-playground/sbin/ipfw/ipfw.8 user/markj/vm-playground/sbin/mount/mount.c user/markj/vm-playground/sbin/nvmecontrol/Makefile user/markj/vm-playground/sbin/nvmecontrol/identify.c user/markj/vm-playground/sbin/nvmecontrol/logpage.c user/markj/vm-playground/sbin/nvmecontrol/nvmecontrol.8 user/markj/vm-playground/sbin/nvmecontrol/nvmecontrol.c user/markj/vm-playground/sbin/nvmecontrol/nvmecontrol.h user/markj/vm-playground/sbin/sysctl/sysctl.8 user/markj/vm-playground/sbin/sysctl/sysctl.c user/markj/vm-playground/share/examples/Makefile user/markj/vm-playground/share/man/man4/atrtc.4 user/markj/vm-playground/share/man/man5/rc.conf.5 user/markj/vm-playground/share/man/man9/style.9 user/markj/vm-playground/share/misc/committers-ports.dot user/markj/vm-playground/share/misc/pci_vendors user/markj/vm-playground/share/termcap/termcap user/markj/vm-playground/stand/common/bootstrap.h user/markj/vm-playground/stand/common/disk.c user/markj/vm-playground/stand/common/disk.h user/markj/vm-playground/stand/common/interp_lua.c user/markj/vm-playground/stand/common/isapnp.c user/markj/vm-playground/stand/common/load_elf.c user/markj/vm-playground/stand/common/load_elf_obj.c user/markj/vm-playground/stand/common/metadata.c user/markj/vm-playground/stand/common/misc.c user/markj/vm-playground/stand/common/pnp.c user/markj/vm-playground/stand/efi/boot1/boot1.c user/markj/vm-playground/stand/efi/boot1/ufs_module.c user/markj/vm-playground/stand/efi/include/efi.h user/markj/vm-playground/stand/efi/include/efilib.h user/markj/vm-playground/stand/efi/libefi/Makefile user/markj/vm-playground/stand/efi/libefi/devicename.c user/markj/vm-playground/stand/efi/libefi/efipart.c user/markj/vm-playground/stand/efi/libefi/efizfs.c user/markj/vm-playground/stand/efi/libefi/env.c user/markj/vm-playground/stand/efi/loader/arch/arm/exec.c user/markj/vm-playground/stand/efi/loader/bootinfo.c user/markj/vm-playground/stand/efi/loader/main.c user/markj/vm-playground/stand/ficl/aarch64/sysdep.c user/markj/vm-playground/stand/ficl/amd64/sysdep.c user/markj/vm-playground/stand/ficl/arm/sysdep.c user/markj/vm-playground/stand/ficl/i386/sysdep.c user/markj/vm-playground/stand/ficl/mips/sysdep.c user/markj/vm-playground/stand/ficl/mips64/sysdep.c user/markj/vm-playground/stand/ficl/powerpc/sysdep.c user/markj/vm-playground/stand/ficl/riscv/sysdep.c user/markj/vm-playground/stand/ficl/sparc64/sysdep.c user/markj/vm-playground/stand/i386/btx/lib/btxv86.h user/markj/vm-playground/stand/i386/libi386/biosacpi.c user/markj/vm-playground/stand/i386/libi386/bioscd.c user/markj/vm-playground/stand/i386/libi386/biosdisk.c user/markj/vm-playground/stand/i386/libi386/biospnp.c user/markj/vm-playground/stand/i386/libi386/bootinfo32.c user/markj/vm-playground/stand/i386/libi386/bootinfo64.c user/markj/vm-playground/stand/i386/libi386/devicename.c user/markj/vm-playground/stand/i386/libi386/elf64_freebsd.c user/markj/vm-playground/stand/i386/libi386/libi386.h user/markj/vm-playground/stand/i386/libi386/multiboot.c user/markj/vm-playground/stand/i386/libi386/pxe.c user/markj/vm-playground/stand/i386/loader/chain.c user/markj/vm-playground/stand/i386/loader/main.c user/markj/vm-playground/stand/libsa/arp.c user/markj/vm-playground/stand/libsa/bootp.c user/markj/vm-playground/stand/libsa/bootparam.c user/markj/vm-playground/stand/libsa/dosfs.h user/markj/vm-playground/stand/libsa/ext2fs.c user/markj/vm-playground/stand/libsa/net.h user/markj/vm-playground/stand/libsa/rpc.c user/markj/vm-playground/stand/libsa/stand.h user/markj/vm-playground/stand/loader.mk user/markj/vm-playground/stand/lua/config.lua user/markj/vm-playground/stand/lua/core.lua user/markj/vm-playground/stand/lua/menu.lua user/markj/vm-playground/stand/mips/beri/boot2/boot2.c user/markj/vm-playground/stand/mips/beri/common/altera_jtag_uart.c user/markj/vm-playground/stand/mips/beri/common/cons.h user/markj/vm-playground/stand/mips/beri/loader/beri_console.c user/markj/vm-playground/stand/mips/beri/loader/beri_disk_cfi.c user/markj/vm-playground/stand/mips/beri/loader/beri_disk_sdcard.c user/markj/vm-playground/stand/mips/beri/loader/devicename.c user/markj/vm-playground/stand/ofw/libofw/devicename.c user/markj/vm-playground/stand/ofw/libofw/libofw.h user/markj/vm-playground/stand/ofw/libofw/openfirm.c user/markj/vm-playground/stand/powerpc/boot1.chrp/boot1.c user/markj/vm-playground/stand/powerpc/kboot/ppc64_elf_freebsd.c user/markj/vm-playground/stand/powerpc/ofw/elf_freebsd.c user/markj/vm-playground/stand/powerpc/ofw/main.c user/markj/vm-playground/stand/powerpc/ofw/ppc64_elf_freebsd.c user/markj/vm-playground/stand/sparc64/boot1/boot1.c user/markj/vm-playground/stand/sparc64/loader/main.c user/markj/vm-playground/stand/uboot/common/main.c user/markj/vm-playground/stand/uboot/lib/devicename.c user/markj/vm-playground/stand/uboot/lib/disk.c user/markj/vm-playground/stand/uboot/lib/elf_freebsd.c user/markj/vm-playground/stand/uboot/lib/libuboot.h user/markj/vm-playground/stand/userboot/userboot/bootinfo32.c user/markj/vm-playground/stand/userboot/userboot/bootinfo64.c user/markj/vm-playground/stand/userboot/userboot/devicename.c user/markj/vm-playground/stand/userboot/userboot/elf64_freebsd.c user/markj/vm-playground/stand/userboot/userboot/main.c user/markj/vm-playground/stand/userboot/userboot/userboot_disk.c user/markj/vm-playground/stand/zfs/libzfs.h user/markj/vm-playground/stand/zfs/zfs.c user/markj/vm-playground/sys/amd64/amd64/efirt_machdep.c (contents, props changed) user/markj/vm-playground/sys/amd64/linux/linux_sysvec.c user/markj/vm-playground/sys/amd64/linux32/linux32_sysvec.c user/markj/vm-playground/sys/arm/allwinner/clkng/ccu_sun8i_r.c user/markj/vm-playground/sys/arm/broadcom/bcm2835/bcm2835_rng.c user/markj/vm-playground/sys/arm64/arm64/efirt_machdep.c user/markj/vm-playground/sys/arm64/arm64/gicv3_its.c user/markj/vm-playground/sys/cam/ata/ata_da.c user/markj/vm-playground/sys/cam/cam_iosched.c user/markj/vm-playground/sys/cam/cam_periph.c user/markj/vm-playground/sys/cam/cam_periph.h user/markj/vm-playground/sys/cam/ctl/ctl_frontend_iscsi.c user/markj/vm-playground/sys/cam/ctl/ctl_frontend_iscsi.h user/markj/vm-playground/sys/cam/nvme/nvme_da.c user/markj/vm-playground/sys/cam/scsi/scsi_da.c user/markj/vm-playground/sys/cam/scsi/scsi_enc.c user/markj/vm-playground/sys/cam/scsi/scsi_pass.c user/markj/vm-playground/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c user/markj/vm-playground/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h user/markj/vm-playground/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c user/markj/vm-playground/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c user/markj/vm-playground/sys/compat/linux/linux_ioctl.c user/markj/vm-playground/sys/compat/linux/linux_signal.c user/markj/vm-playground/sys/compat/linux/linux_stats.c user/markj/vm-playground/sys/compat/linux/linux_util.c user/markj/vm-playground/sys/compat/linuxkpi/common/include/linux/kernel.h user/markj/vm-playground/sys/compat/linuxkpi/common/src/linux_compat.c user/markj/vm-playground/sys/conf/NOTES user/markj/vm-playground/sys/conf/config.mk user/markj/vm-playground/sys/conf/files.powerpc user/markj/vm-playground/sys/conf/kern.mk user/markj/vm-playground/sys/conf/kern.opts.mk user/markj/vm-playground/sys/conf/kern.post.mk user/markj/vm-playground/sys/conf/kern.pre.mk user/markj/vm-playground/sys/conf/options user/markj/vm-playground/sys/contrib/dev/acpica/changes.txt user/markj/vm-playground/sys/contrib/dev/acpica/components/debugger/dbdisply.c user/markj/vm-playground/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c user/markj/vm-playground/sys/contrib/dev/acpica/components/events/evevent.c user/markj/vm-playground/sys/contrib/dev/acpica/components/events/evgpe.c user/markj/vm-playground/sys/contrib/dev/acpica/components/events/evgpeblk.c user/markj/vm-playground/sys/contrib/dev/acpica/components/events/evrgnini.c user/markj/vm-playground/sys/contrib/dev/acpica/components/events/evxface.c user/markj/vm-playground/sys/contrib/dev/acpica/components/events/evxfgpe.c user/markj/vm-playground/sys/contrib/dev/acpica/components/executer/exdebug.c user/markj/vm-playground/sys/contrib/dev/acpica/components/hardware/hwgpe.c user/markj/vm-playground/sys/contrib/dev/acpica/components/hardware/hwsleep.c user/markj/vm-playground/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c user/markj/vm-playground/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c user/markj/vm-playground/sys/contrib/dev/acpica/components/namespace/nseval.c user/markj/vm-playground/sys/contrib/dev/acpica/components/namespace/nsload.c user/markj/vm-playground/sys/contrib/dev/acpica/components/namespace/nsparse.c user/markj/vm-playground/sys/contrib/dev/acpica/components/namespace/nsxfname.c user/markj/vm-playground/sys/contrib/dev/acpica/components/parser/psargs.c user/markj/vm-playground/sys/contrib/dev/acpica/components/parser/psloop.c user/markj/vm-playground/sys/contrib/dev/acpica/components/parser/psobject.c user/markj/vm-playground/sys/contrib/dev/acpica/components/tables/tbdata.c user/markj/vm-playground/sys/contrib/dev/acpica/components/tables/tbinstal.c user/markj/vm-playground/sys/contrib/dev/acpica/components/tables/tbxfload.c user/markj/vm-playground/sys/contrib/dev/acpica/components/utilities/utosi.c user/markj/vm-playground/sys/contrib/dev/acpica/components/utilities/utxfinit.c user/markj/vm-playground/sys/contrib/dev/acpica/include/acevents.h user/markj/vm-playground/sys/contrib/dev/acpica/include/acmacros.h user/markj/vm-playground/sys/contrib/dev/acpica/include/acpixf.h user/markj/vm-playground/sys/contrib/dev/acpica/include/actypes.h user/markj/vm-playground/sys/contrib/zstd/Makefile user/markj/vm-playground/sys/contrib/zstd/NEWS user/markj/vm-playground/sys/contrib/zstd/README.md user/markj/vm-playground/sys/contrib/zstd/circle.yml user/markj/vm-playground/sys/contrib/zstd/contrib/meson/meson.build user/markj/vm-playground/sys/contrib/zstd/doc/zstd_compression_format.md user/markj/vm-playground/sys/contrib/zstd/doc/zstd_manual.html user/markj/vm-playground/sys/contrib/zstd/lib/BUCK user/markj/vm-playground/sys/contrib/zstd/lib/common/bitstream.h user/markj/vm-playground/sys/contrib/zstd/lib/common/mem.h user/markj/vm-playground/sys/contrib/zstd/lib/common/pool.c user/markj/vm-playground/sys/contrib/zstd/lib/common/xxhash.c user/markj/vm-playground/sys/contrib/zstd/lib/common/zstd_common.c user/markj/vm-playground/sys/contrib/zstd/lib/common/zstd_internal.h user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_compress.c user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_double_fast.c user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_double_fast.h user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_fast.c user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_fast.h user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_lazy.c user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_lazy.h user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_ldm.h user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_opt.c user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstd_opt.h user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstdmt_compress.c user/markj/vm-playground/sys/contrib/zstd/lib/compress/zstdmt_compress.h user/markj/vm-playground/sys/contrib/zstd/lib/decompress/zstd_decompress.c user/markj/vm-playground/sys/contrib/zstd/lib/deprecated/zbuff_compress.c user/markj/vm-playground/sys/contrib/zstd/lib/dictBuilder/zdict.c user/markj/vm-playground/sys/contrib/zstd/lib/legacy/zstd_v01.c user/markj/vm-playground/sys/contrib/zstd/lib/legacy/zstd_v02.c user/markj/vm-playground/sys/contrib/zstd/lib/legacy/zstd_v03.c user/markj/vm-playground/sys/contrib/zstd/lib/legacy/zstd_v04.c user/markj/vm-playground/sys/contrib/zstd/lib/legacy/zstd_v05.c user/markj/vm-playground/sys/contrib/zstd/lib/legacy/zstd_v06.c user/markj/vm-playground/sys/contrib/zstd/lib/legacy/zstd_v07.c user/markj/vm-playground/sys/contrib/zstd/lib/zstd.h user/markj/vm-playground/sys/contrib/zstd/programs/BUCK user/markj/vm-playground/sys/contrib/zstd/programs/Makefile user/markj/vm-playground/sys/contrib/zstd/programs/bench.c user/markj/vm-playground/sys/contrib/zstd/programs/bench.h user/markj/vm-playground/sys/contrib/zstd/programs/dibio.c user/markj/vm-playground/sys/contrib/zstd/programs/fileio.c user/markj/vm-playground/sys/contrib/zstd/programs/fileio.h user/markj/vm-playground/sys/contrib/zstd/programs/platform.h user/markj/vm-playground/sys/contrib/zstd/programs/util.h user/markj/vm-playground/sys/contrib/zstd/programs/zstd.1 user/markj/vm-playground/sys/contrib/zstd/programs/zstd.1.md user/markj/vm-playground/sys/contrib/zstd/programs/zstdcli.c user/markj/vm-playground/sys/contrib/zstd/tests/Makefile user/markj/vm-playground/sys/contrib/zstd/tests/decodecorpus.c user/markj/vm-playground/sys/contrib/zstd/tests/fullbench.c user/markj/vm-playground/sys/contrib/zstd/tests/fuzzer.c user/markj/vm-playground/sys/contrib/zstd/tests/paramgrill.c user/markj/vm-playground/sys/contrib/zstd/tests/playTests.sh user/markj/vm-playground/sys/contrib/zstd/tests/zbufftest.c user/markj/vm-playground/sys/contrib/zstd/tests/zstreamtest.c user/markj/vm-playground/sys/contrib/zstd/zlibWrapper/BUCK user/markj/vm-playground/sys/contrib/zstd/zlibWrapper/examples/zwrapbench.c user/markj/vm-playground/sys/contrib/zstd/zlibWrapper/zstd_zlibwrapper.c user/markj/vm-playground/sys/crypto/aesni/aesni.c user/markj/vm-playground/sys/dev/aac/aac.c user/markj/vm-playground/sys/dev/aacraid/aacraid.c user/markj/vm-playground/sys/dev/acpica/acpi.c user/markj/vm-playground/sys/dev/acpica/acpivar.h user/markj/vm-playground/sys/dev/bwn/if_bwn.c user/markj/vm-playground/sys/dev/cxgbe/adapter.h user/markj/vm-playground/sys/dev/cxgbe/firmware/t6fw_cfg.txt user/markj/vm-playground/sys/dev/cxgbe/offload.h user/markj/vm-playground/sys/dev/cxgbe/t4_main.c user/markj/vm-playground/sys/dev/cxgbe/tom/t4_connect.c user/markj/vm-playground/sys/dev/cxgbe/tom/t4_cpl_io.c user/markj/vm-playground/sys/dev/cxgbe/tom/t4_ddp.c user/markj/vm-playground/sys/dev/cxgbe/tom/t4_listen.c user/markj/vm-playground/sys/dev/cxgbe/tom/t4_tom.c user/markj/vm-playground/sys/dev/cxgbe/tom/t4_tom.h user/markj/vm-playground/sys/dev/e1000/e1000_82575.c user/markj/vm-playground/sys/dev/e1000/e1000_mbx.c user/markj/vm-playground/sys/dev/e1000/e1000_phy.c user/markj/vm-playground/sys/dev/e1000/e1000_vf.c user/markj/vm-playground/sys/dev/efidev/efirt.c (contents, props changed) user/markj/vm-playground/sys/dev/extres/regulator/regulator.c user/markj/vm-playground/sys/dev/extres/regulator/regulator.h user/markj/vm-playground/sys/dev/iscsi/iscsi.c user/markj/vm-playground/sys/dev/isp/isp.c user/markj/vm-playground/sys/dev/isp/isp_freebsd.c user/markj/vm-playground/sys/dev/md/md.c user/markj/vm-playground/sys/dev/mlx5/driver.h user/markj/vm-playground/sys/dev/mpr/mpr.c user/markj/vm-playground/sys/dev/mps/mps.c user/markj/vm-playground/sys/dev/mps/mps_sas_lsi.c user/markj/vm-playground/sys/dev/mps/mpsvar.h user/markj/vm-playground/sys/dev/nvme/nvme.h user/markj/vm-playground/sys/dev/nvme/nvme_ctrlr.c user/markj/vm-playground/sys/dev/nvme/nvme_ns.c user/markj/vm-playground/sys/dev/nvme/nvme_qpair.c user/markj/vm-playground/sys/dev/otus/if_otus.c user/markj/vm-playground/sys/dev/ral/rt2560.c user/markj/vm-playground/sys/dev/ral/rt2661.c user/markj/vm-playground/sys/dev/rtwn/rtl8188e/r88e_chan.c user/markj/vm-playground/sys/dev/rtwn/rtl8192c/r92c_chan.c user/markj/vm-playground/sys/dev/usb/wlan/if_rum.c user/markj/vm-playground/sys/dev/usb/wlan/if_run.c user/markj/vm-playground/sys/dev/usb/wlan/if_uath.c user/markj/vm-playground/sys/dev/usb/wlan/if_upgt.c user/markj/vm-playground/sys/dev/usb/wlan/if_ural.c user/markj/vm-playground/sys/dev/usb/wlan/if_urtw.c user/markj/vm-playground/sys/dev/usb/wlan/if_zyd.c user/markj/vm-playground/sys/dev/vt/hw/vga/vt_vga.c user/markj/vm-playground/sys/dts/arm/rpi.dts user/markj/vm-playground/sys/dts/arm/rpi2.dts user/markj/vm-playground/sys/geom/geom.h user/markj/vm-playground/sys/geom/geom_subr.c user/markj/vm-playground/sys/i386/linux/imgact_linux.c user/markj/vm-playground/sys/i386/linux/linux_machdep.c user/markj/vm-playground/sys/i386/linux/linux_sysvec.c user/markj/vm-playground/sys/isa/rtc.h user/markj/vm-playground/sys/kern/imgact_aout.c user/markj/vm-playground/sys/kern/imgact_binmisc.c user/markj/vm-playground/sys/kern/imgact_elf.c user/markj/vm-playground/sys/kern/imgact_gzip.c user/markj/vm-playground/sys/kern/imgact_shell.c user/markj/vm-playground/sys/kern/subr_gtaskqueue.c user/markj/vm-playground/sys/kern/subr_uio.c user/markj/vm-playground/sys/kern/tty_compat.c user/markj/vm-playground/sys/kern/vfs_bio.c user/markj/vm-playground/sys/kern/vfs_mountroot.c user/markj/vm-playground/sys/mips/include/param.h user/markj/vm-playground/sys/mips/mips/support.S user/markj/vm-playground/sys/modules/aac/Makefile user/markj/vm-playground/sys/modules/aacraid/Makefile user/markj/vm-playground/sys/modules/cam/Makefile user/markj/vm-playground/sys/modules/cxgbe/tom/Makefile user/markj/vm-playground/sys/modules/isp/Makefile user/markj/vm-playground/sys/modules/usb/rum/Makefile user/markj/vm-playground/sys/modules/usb/run/Makefile user/markj/vm-playground/sys/modules/usb/uath/Makefile user/markj/vm-playground/sys/modules/usb/upgt/Makefile user/markj/vm-playground/sys/modules/usb/ural/Makefile user/markj/vm-playground/sys/modules/usb/urtw/Makefile user/markj/vm-playground/sys/modules/usb/zyd/Makefile user/markj/vm-playground/sys/net80211/ieee80211_output.c user/markj/vm-playground/sys/net80211/ieee80211_proto.h user/markj/vm-playground/sys/netipsec/keysock.c user/markj/vm-playground/sys/netipsec/keysock.h user/markj/vm-playground/sys/netpfil/ipfw/ip_fw2.c user/markj/vm-playground/sys/powerpc/aim/aim_machdep.c user/markj/vm-playground/sys/powerpc/aim/locore64.S user/markj/vm-playground/sys/powerpc/aim/mmu_oea64.c user/markj/vm-playground/sys/powerpc/ofw/ofw_machdep.c user/markj/vm-playground/sys/powerpc/ofw/ofwcall64.S user/markj/vm-playground/sys/powerpc/powerpc/machdep.c user/markj/vm-playground/sys/sys/aac_ioctl.h user/markj/vm-playground/sys/sys/imgact_elf.h user/markj/vm-playground/sys/sys/mdioctl.h user/markj/vm-playground/sys/vm/vm_kern.c user/markj/vm-playground/sys/vm/vm_page.c user/markj/vm-playground/sys/vm/vm_reserv.c user/markj/vm-playground/sys/vm/vm_reserv.h user/markj/vm-playground/sys/x86/isa/atrtc.c user/markj/vm-playground/sys/x86/isa/clock.c user/markj/vm-playground/sys/x86/x86/identcpu.c user/markj/vm-playground/tests/sys/cddl/zfs/include/libtest.kshlib user/markj/vm-playground/tests/sys/cddl/zfs/tests/cache/cache.kshlib user/markj/vm-playground/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh user/markj/vm-playground/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_005_neg.ksh user/markj/vm-playground/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.kshlib user/markj/vm-playground/tests/sys/cddl/zfs/tests/cli_root/zpool_export/setup.ksh user/markj/vm-playground/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export.cfg user/markj/vm-playground/tests/sys/cddl/zfs/tests/cli_root/zpool_get/setup.ksh user/markj/vm-playground/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg user/markj/vm-playground/tests/sys/cddl/zfs/tests/cli_root/zpool_history/setup.ksh user/markj/vm-playground/tests/sys/cddl/zfs/tests/cli_root/zpool_history/zpool_history.cfg user/markj/vm-playground/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_test.sh user/markj/vm-playground/tests/sys/cddl/zfs/tests/hotplug/setup.ksh user/markj/vm-playground/tests/sys/cddl/zfs/tests/slog/slog.kshlib user/markj/vm-playground/usr.bin/calendar/calendars/calendar.freebsd user/markj/vm-playground/usr.bin/dpv/dpv.1 user/markj/vm-playground/usr.bin/iscsictl/iscsictl.c user/markj/vm-playground/usr.bin/tftp/tftp.c user/markj/vm-playground/usr.sbin/bhyvectl/bhyvectl.c user/markj/vm-playground/usr.sbin/bsdconfig/bsdconfig.8 user/markj/vm-playground/usr.sbin/cxgbetool/Makefile user/markj/vm-playground/usr.sbin/cxgbetool/cxgbetool.c user/markj/vm-playground/usr.sbin/lpr/common_source/ctlinfo.c user/markj/vm-playground/usr.sbin/mpsutil/Makefile user/markj/vm-playground/usr.sbin/mpsutil/mps_show.c user/markj/vm-playground/usr.sbin/mpsutil/mpsutil.c user/markj/vm-playground/usr.sbin/mpsutil/mpsutil.h user/markj/vm-playground/usr.sbin/usbconfig/usbconfig.8 user/markj/vm-playground/usr.sbin/usbconfig/usbconfig.c Directory Properties: user/markj/vm-playground/ (props changed) user/markj/vm-playground/contrib/llvm/ (props changed) user/markj/vm-playground/gnu/usr.bin/gdb/ (props changed) user/markj/vm-playground/sys/cddl/contrib/opensolaris/ (props changed) user/markj/vm-playground/sys/contrib/dev/acpica/ (props changed) user/markj/vm-playground/sys/contrib/zstd/ (props changed) user/markj/vm-playground/usr.sbin/cxgbetool/reg_defs_t5.c (props changed) user/markj/vm-playground/usr.sbin/cxgbetool/reg_defs_t6.c (props changed) Modified: user/markj/vm-playground/Makefile.inc1 ============================================================================== --- user/markj/vm-playground/Makefile.inc1 Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/Makefile.inc1 Fri Mar 16 16:04:06 2018 (r331062) @@ -1698,6 +1698,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ sed -e "s/%VERSION%/${PKG_VERSION}/" \ -e "s/%PKGNAME%/kernel-${INSTALLKERNEL:tl}${flavor}/" \ + -e "s/%KERNELDIR%/kernel/" \ -e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ @@ -1733,6 +1734,7 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_ pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ sed -e "s/%VERSION%/${PKG_VERSION}/" \ -e "s/%PKGNAME%/kernel-${_kernel:tl}${flavor}/" \ + -e "s/%KERNELDIR%/kernel.${_kernel}/" \ -e "s/%COMMENT%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ Modified: user/markj/vm-playground/bin/ps/extern.h ============================================================================== --- user/markj/vm-playground/bin/ps/extern.h Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/bin/ps/extern.h Fri Mar 16 16:04:06 2018 (r331062) @@ -55,6 +55,7 @@ char *emulname(KINFO *, VARENT *); VARENT *find_varentry(VAR *); const char *fmt_argv(char **, char *, char *, size_t); double getpcpu(const KINFO *); +char *jailname(KINFO *, VARENT *); char *kvar(KINFO *, VARENT *); char *label(KINFO *, VARENT *); char *loginclass(KINFO *, VARENT *); Modified: user/markj/vm-playground/bin/ps/keyword.c ============================================================================== --- user/markj/vm-playground/bin/ps/keyword.c Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/bin/ps/keyword.c Fri Mar 16 16:04:06 2018 (r331062) @@ -108,6 +108,7 @@ static VAR var[] = { {"inblk", "INBLK", NULL, "read-blocks", USER, rvar, ROFF(ru_inblock), LONG, "ld", 0}, {"inblock", "", "inblk", NULL, 0, NULL, 0, CHAR, NULL, 0}, + {"jail", "JAIL", NULL, "jail-name", LJUST, jailname, 0, CHAR, NULL, 0}, {"jid", "JID", NULL, "jail-id", 0, kvar, KOFF(ki_jid), INT, "d", 0}, {"jobc", "JOBC", NULL, "job-control-count", 0, kvar, KOFF(ki_jobc), SHORT, "d", 0}, Modified: user/markj/vm-playground/bin/ps/print.c ============================================================================== --- user/markj/vm-playground/bin/ps/print.c Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/bin/ps/print.c Fri Mar 16 16:04:06 2018 (r331062) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -839,4 +840,17 @@ loginclass(KINFO *k, VARENT *ve __unused) return (strdup("-")); } return (strdup(k->ki_p->ki_loginclass)); +} + +char * +jailname(KINFO *k, VARENT *ve __unused) +{ + char *name; + + if (k->ki_p->ki_jid == 0) + return (strdup("-")); + name = jail_getname(k->ki_p->ki_jid); + if (name == NULL) + return (strdup("-")); + return (name); } Modified: user/markj/vm-playground/bin/ps/ps.1 ============================================================================== --- user/markj/vm-playground/bin/ps/ps.1 Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/bin/ps/ps.1 Fri Mar 16 16:04:06 2018 (r331062) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd January 23, 2018 +.Dd March 13, 2018 .Dt PS 1 .Os .Sh NAME @@ -101,6 +101,14 @@ The default output format includes, for each process, controlling terminal, state, CPU time (including both user and system time) and associated command. .Pp +If the +.Nm +process is associated with a terminal, the default output width is that of the +terminal; otherwise the output width is unlimited. +See also the +.Fl w +option. +.Pp The options are as follows: .Bl -tag -width indent .It Fl -libxo @@ -257,13 +265,15 @@ option implies the .Fl m option. .It Fl w -Use 132 columns to display information, instead of the default which -is your window size. +Use at least 132 columns to display information, instead of the default which +is the window size if +.Nm +is associated with a terminal. If the .Fl w option is specified more than once, .Nm -will use as many columns as necessary without regard for your window size. +will use as many columns as necessary without regard for the window size. Note that this option has no effect if the .Dq command column is not the last column displayed. @@ -566,6 +576,8 @@ group name (from egid) (alias .It Cm inblk total blocks read (alias .Cm inblock ) +.It Cm jail +jail name .It Cm jid jail ID .It Cm jobc Modified: user/markj/vm-playground/bin/ps/ps.c ============================================================================== --- user/markj/vm-playground/bin/ps/ps.c Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/bin/ps/ps.c Fri Mar 16 16:04:06 2018 (r331062) @@ -202,6 +202,11 @@ main(int argc, char *argv[]) * any of stdout, stderr, or stdin is a terminal. The intent * is that "ps", "ps | more", and "ps | grep" all use the same * default line length unless -w is specified. + * + * If not interactive, the default length was traditionally 79. + * It has been changed to unlimited. This is mostly for the + * benefit of non-interactive scripts, which arguably should + * use -ww, but is compatible with Linux. */ if ((cols = getenv("COLUMNS")) != NULL && *cols != '\0') termwidth = atoi(cols); @@ -209,7 +214,7 @@ main(int argc, char *argv[]) ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&ws) == -1) || ws.ws_col == 0) - termwidth = 79; + termwidth = UNLIMITED; else termwidth = ws.ws_col - 1; Modified: user/markj/vm-playground/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp ============================================================================== --- user/markj/vm-playground/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Fri Mar 16 16:04:06 2018 (r331062) @@ -10201,7 +10201,14 @@ static SDValue PerformSHLSimplify(SDNode *N, case ISD::XOR: case ISD::SETCC: case ARMISD::CMP: - // Check that its not already using a shl. + // Check that the user isn't already using a constant because there + // aren't any instructions that support an immediate operand and a + // shifted operand. + if (isa(U->getOperand(0)) || + isa(U->getOperand(1))) + return SDValue(); + + // Check that it's not already using a shift. if (U->getOperand(0).getOpcode() == ISD::SHL || U->getOperand(1).getOpcode() == ISD::SHL) return SDValue(); @@ -10223,8 +10230,6 @@ static SDValue PerformSHLSimplify(SDNode *N, if (!C1ShlC2 || !C2) return SDValue(); - DEBUG(dbgs() << "Trying to simplify shl: "; N->dump()); - APInt C2Int = C2->getAPIntValue(); APInt C1Int = C1ShlC2->getAPIntValue(); @@ -10238,12 +10243,12 @@ static SDValue PerformSHLSimplify(SDNode *N, C1Int.lshrInPlace(C2Int); // The immediates are encoded as an 8-bit value that can be rotated. - unsigned Zeros = C1Int.countLeadingZeros() + C1Int.countTrailingZeros(); - if (C1Int.getBitWidth() - Zeros > 8) - return SDValue(); + auto LargeImm = [](const APInt &Imm) { + unsigned Zeros = Imm.countLeadingZeros() + Imm.countTrailingZeros(); + return Imm.getBitWidth() - Zeros > 8; + }; - Zeros = C2Int.countLeadingZeros() + C2Int.countTrailingZeros(); - if (C2Int.getBitWidth() - Zeros > 8) + if (LargeImm(C1Int) || LargeImm(C2Int)) return SDValue(); SelectionDAG &DAG = DCI.DAG; @@ -10253,6 +10258,10 @@ static SDValue PerformSHLSimplify(SDNode *N, DAG.getConstant(C1Int, dl, MVT::i32)); // Shift left to compensate for the lshr of C1Int. SDValue Res = DAG.getNode(ISD::SHL, dl, MVT::i32, BinOp, SHL.getOperand(1)); + + DEBUG(dbgs() << "Simplify shl use:\n"; SHL.getOperand(0).dump(); SHL.dump(); + N->dump()); + DEBUG(dbgs() << "Into:\n"; X.dump(); BinOp.dump(); Res.dump()); DAG.ReplaceAllUsesWith(SDValue(N, 0), Res); return SDValue(N, 0); Modified: user/markj/vm-playground/etc/mtree/BSD.tests.dist ============================================================================== --- user/markj/vm-playground/etc/mtree/BSD.tests.dist Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/etc/mtree/BSD.tests.dist Fri Mar 16 16:04:06 2018 (r331062) @@ -382,6 +382,8 @@ .. rtld-elf .. + tftpd + .. .. sbin dhclient Modified: user/markj/vm-playground/etc/rc.d/fsck ============================================================================== --- user/markj/vm-playground/etc/rc.d/fsck Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/etc/rc.d/fsck Fri Mar 16 16:04:06 2018 (r331062) @@ -57,7 +57,7 @@ fsck_start() echo "Reboot failed; help!" stop_boot ;; - 8) + 8|16) if checkyesno fsck_y_enable; then echo "File system preen failed, trying fsck -y ${fsck_y_flags}" fsck -y ${fsck_y_flags} Modified: user/markj/vm-playground/etc/rc.d/hostname ============================================================================== --- user/markj/vm-playground/etc/rc.d/hostname Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/etc/rc.d/hostname Fri Mar 16 16:04:06 2018 (r331062) @@ -60,9 +60,11 @@ hostname_start() # Have we got a hostname yet? # if [ -z "${hostname}" ]; then - # Null hostname is probably OK if DHCP is in use. + # Null hostname is probably OK if DHCP is in use, + # or when hostname is already set (common for jails). # - if [ -z "`list_net_interfaces dhcp`" ]; then + if [ -z "`list_net_interfaces dhcp`" -a \ + -z "`/bin/hostname`" ]; then warn "\$hostname is not set -- see rc.conf(5)." fi return Modified: user/markj/vm-playground/gnu/usr.bin/gdb/kgdb/trgt_amd64.c ============================================================================== --- user/markj/vm-playground/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Fri Mar 16 16:04:06 2018 (r331062) @@ -189,6 +189,7 @@ kgdb_trgt_trapframe_sniffer(struct frame_info *next_fr if (pname == NULL) return (NULL); if (strcmp(pname, "calltrap") == 0 || + strcmp(pname, "fast_syscall_common") == 0 || strcmp(pname, "mchk_calltrap") == 0 || strcmp(pname, "nmi_calltrap") == 0 || (pname[0] == 'X' && pname[1] != '_')) Modified: user/markj/vm-playground/lib/libc/net/getnameinfo.3 ============================================================================== --- user/markj/vm-playground/lib/libc/net/getnameinfo.3 Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/lib/libc/net/getnameinfo.3 Fri Mar 16 16:04:06 2018 (r331062) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 28, 2016 +.Dd March 15, 2018 .Dt GETNAMEINFO 3 .Os .Sh NAME @@ -80,6 +80,20 @@ or UNIX-domain respectively that is .Fa salen bytes long. +If +.Fa salen +is shorter than the length corresponding to the specified +address family or longer than +.Fn sizeof "struct sockaddr_storage" , +it returns +.Er EAI_FAMILY . +Note that +.Va sa->sa_len +should be consistent with +.Fa salen +though the value of +.Va sa->sa_len +is not directly used in this function. .Pp The host and service names associated with .Fa sa Modified: user/markj/vm-playground/lib/libc/net/getnameinfo.c ============================================================================== --- user/markj/vm-playground/lib/libc/net/getnameinfo.c Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/lib/libc/net/getnameinfo.c Fri Mar 16 16:04:06 2018 (r331062) @@ -124,26 +124,36 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen afd = find_afd(sa->sa_family); if (afd == NULL) return (EAI_FAMILY); + /* + * getnameinfo() accepts an salen of sizeof(struct sockaddr_storage) + * at maximum as shown in RFC 4038 Sec.6.2.3. + */ + if (salen > sizeof(struct sockaddr_storage)) + return (EAI_FAMILY); + switch (sa->sa_family) { case PF_LOCAL: /* - * PF_LOCAL uses variable sa->sa_len depending on the + * PF_LOCAL uses variable salen depending on the * content length of sun_path. Require 1 byte in * sun_path at least. */ - if (salen > afd->a_socklen || - salen <= afd->a_socklen - + if (salen <= afd->a_socklen - sizeofmember(struct sockaddr_un, sun_path)) - return (EAI_FAIL); + return (EAI_FAMILY); + else if (salen > afd->a_socklen) + salen = afd->a_socklen; break; case PF_LINK: if (salen <= afd->a_socklen - sizeofmember(struct sockaddr_dl, sdl_data)) - return (EAI_FAIL); + return (EAI_FAMILY); break; default: - if (salen != afd->a_socklen) - return (EAI_FAIL); + if (salen < afd->a_socklen) + return (EAI_FAMILY); + else + salen = afd->a_socklen; break; } @@ -517,7 +527,7 @@ getnameinfo_un(const struct afd *afd, if (serv != NULL && servlen > 0) *serv = '\0'; if (host != NULL && hostlen > 0) { - pathlen = sa->sa_len - afd->a_off; + pathlen = salen - afd->a_off; if (pathlen + 1 > hostlen) { *host = '\0'; Modified: user/markj/vm-playground/lib/libc/sys/sendfile.2 ============================================================================== --- user/markj/vm-playground/lib/libc/sys/sendfile.2 Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/lib/libc/sys/sendfile.2 Fri Mar 16 16:04:06 2018 (r331062) @@ -129,8 +129,8 @@ Starting with .Nm sending files off the .Xr ffs 7 -filesystem doesn't block on I/O -(see +filesystem does not block on I/O +(see .Sx IMPLEMENTATION NOTES ), so the condition no longer applies. However, it is safe if an application utilizes @@ -140,8 +140,8 @@ and on performs the same action as it did in older .Fx -versions, e.g. -.Xr aio_read 2, +versions, e.g., +.Xr aio_read 2 , .Xr read 2 or .Nm @@ -210,7 +210,7 @@ The .Fx implementation of .Fn sendfile -doesn't block on disk I/O when it sends a file off the +does not block on disk I/O when it sends a file off the .Xr ffs 7 filesystem. The syscall returns success before the actual I/O completes, and data Modified: user/markj/vm-playground/lib/libdpv/dialog_util.c ============================================================================== --- user/markj/vm-playground/lib/libdpv/dialog_util.c Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/lib/libdpv/dialog_util.c Fri Mar 16 16:04:06 2018 (r331062) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Devin Teske + * Copyright (c) 2013-2018 Devin Teske * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -328,8 +328,7 @@ dialog_spawn_gauge(char *init_prompt, pid_t *pid) posix_spawn_file_actions_addclose(&action, stdin_pipe[1]); error = posix_spawnp(pid, dialog, &action, (const posix_spawnattr_t *)NULL, dargv, environ); - if (error != 0) - err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__); + if (error != 0) err(EXIT_FAILURE, "%s", dialog); /* NB: Do not free(3) *dargv[], else SIGSEGV */ Modified: user/markj/vm-playground/lib/libdpv/dpv.3 ============================================================================== --- user/markj/vm-playground/lib/libdpv/dpv.3 Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/lib/libdpv/dpv.3 Fri Mar 16 16:04:06 2018 (r331062) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2013-2016 Devin Teske +.\" Copyright (c) 2013-2018 Devin Teske .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jan 26, 2016 +.Dd March 13, 2018 .Dt DPV 3 .Os .Sh NAME @@ -36,7 +36,8 @@ .In dpv.h .Ft int .Fo dpv -.Fa "struct dpv_config *config, struct dpv_file_node *file_list" +.Fa "struct dpv_config *config" +.Fa "struct dpv_file_node *file_list" .Fc .Ft void .Fo dpv_free @@ -60,8 +61,7 @@ or The .Fn dpv .Fa config -argument contains the following properties for configuring global display -features: +argument properties for configuring global display features: .Bd -literal -offset indent struct dpv_config { uint8_t keep_tite; /* Cleaner exit for scripts */ @@ -113,11 +113,12 @@ member of the .Fn dpv .Fa config argument is a mask of bit fields indicating various processing options. -Possible flags are as follows: +Possible flags are: .Bl -tag -width DPV_NO_OVERRUN .It Dv DPV_TEST_MODE Enable test mode. -In test mode, the +In test mode, +the .Fn action callback of the .Fa config @@ -126,18 +127,21 @@ Appends .Dq [TEST MODE] to the status line .Po -to override, set the +to override, +set the .Va status_format member of the .Fn dpv .Fa config argument; -e.g., to +for example, +to .Dv DPV_STATUS_DEFAULT .Pc . .It Dv DPV_WIDE_MODE Enable wide mode. -In wide mode, the length of the +In wide mode, +the length of the .Va aprompt and .Va pprompt @@ -169,7 +173,8 @@ does not support color environment variable is ignored .Pc . .It Dv DPV_NO_OVERRUN -When enabled, callbacks for the current +When enabled, +callbacks for the current .Vt dpv_file_node are terminated when .Fn action @@ -189,7 +194,7 @@ argument to .Fn dpv is a pointer to a .Dq linked-list , -described as follows in +described in .In dpv.h : .Bd -literal -offset indent struct dpv_file_node { @@ -206,7 +211,8 @@ struct dpv_file_node { For each of the items in the .Fa file_list .Dq linked-list -argument, the +argument, +the .Fn action callback member of the .Fn dpv @@ -214,7 +220,7 @@ callback member of the argument is called. The .Fn action -function should perform a +function performs a .Dq nominal action on the file and return. The return value of @@ -231,7 +237,7 @@ provides a reference to the current .Vt dpv_file_node being processed. .Fa out -provides a file descriptor where the data should go. +provides a file descriptor where the data goes. .Pp If the .Va output @@ -244,7 +250,7 @@ the .Fa out file descriptor of .Fn action -will be zero and should be ignored. +will be zero and can be ignored. If .Fa output was set to DPV_OUTPUT_FILE, @@ -257,14 +263,16 @@ was set to DPV_OUTPUT_SHELL, will be an open file descriptor to a pipe for a spawned shell program. When .Fa out -is greater than zero, you should write any data you have read back to +is greater than zero, +write data that has been read back to .Fa out . .Pp To abort .Fn dpv , either from the .Fn action -callback or asynchronously from a signal handler, two globals are provided via +callback or asynchronously from a signal handler, +two globals are provided via .In dpv.h : .Bd -literal -offset indent extern int dpv_interrupt; /* Set to TRUE in interrupt handler */ @@ -272,11 +280,12 @@ extern int dpv_abort; /* Set to true in callback t .Ed .Pp These globals are not automatically reset and must be manually maintained. -Don't forget to reset these globals before subsequent invocations of +Do not forget to reset these globals before subsequent invocations of .Fn dpv when making multiple calls from the same program. .Pp -In addition, the +In addition, +the .Va status member of the .Fn action @@ -284,7 +293,7 @@ member of the argument can be used to control callbacks for the current file. The .Va status -member can be set to any of the following from +member can be set to any of the below from .In dpv.h : .Bd -literal -offset indent enum dpv_status { @@ -296,13 +305,17 @@ enum dpv_status { .Pp The default .Fa status -is zero, DPV_STATUS_RUNING, which keeps the callbacks coming for the current +is zero, +DPV_STATUS_RUNNING, +which keeps the callbacks coming for the current .Fn file . Setting .Ql file->status to anything other than DPV_STATUS_RUNNING will cause .Fn dpv -to loop to the next file, effecting the next callback, if any. +to loop to the next file, +effecting the next callback, +if any. .Pp The .Fn action @@ -318,7 +331,7 @@ Percentages are reported through the return value of the .Fn action callback. -Throughput statistics are calculated from the following global +Throughput statistics are calculated from the below global .Vt int in .In dpv.h : @@ -326,7 +339,7 @@ in extern int dpv_overall_read; .Ed .Pp -This should be set to the number of bytes that have been read for all files. +Set this to the number of bytes that have been read for all files. Throughput information is displayed in the status line .Pq only available when using Xr dialog 3 at the bottom of the screen. @@ -335,18 +348,20 @@ See DPV_DISPLAY_LIBDIALOG above. Note that .Va dpv_overall_read does not have to represent bytes. -For example, you can change the +For example, +the .Va status_format -to display something other than +can be changed to display something other than .Dq Li bytes and increment .Va dpv_overall_read accordingly -.Pq e.g., counting lines . +.Pq for example, counting lines . .Pp When .Fn dpv -is processing the current file, the +is processing the current file, +the .Va length and .Va read @@ -355,7 +370,8 @@ members of the .Fa file argument are used for calculating the display of mini progress bars .Po -if enabled; see +if enabled; +see .Va pbar_size above .Pc . @@ -381,7 +397,7 @@ function performs on private global variables initialized by .Fn dpv . .Sh ENVIRONMENT -The following environment variables are referenced by +The below environment variables are referenced by .Nm : .Bl -tag -width ".Ev USE_COLOR" .It Ev DIALOG @@ -398,17 +414,20 @@ or .Ql Xdialog .Pq for Dv DPV_DISPLAY_XDIALOG . .It Ev DIALOGRC -If set and non-NULL, path to +If set and non-NULL, +path to .Ql .dialogrc file. .It Ev HOME If .Ql Ev $DIALOGRC -is either not set or NULL, used as a prefix to +is either not set or NULL, +used as a prefix to .Ql .dialogrc -.Pq i.e., Ql $HOME/.dialogrc . +.Pq that is, Ql $HOME/.dialogrc . .It Ev USE_COLOR -If set and NULL, disables the use of color when using +If set and NULL, +disables the use of color when using .Xr dialog 1 .Pq does not apply to Xr Xdialog 1 . .It Ev msg_done Ev msg_fail Ev msg_pending @@ -418,7 +437,8 @@ Internationalization strings for overriding the defaul and .Ql Pending respectively. -To prevent their usage, explicitly set the +To prevent their usage, +explicitly set the .Va msg_done , .Va msg_fail , and @@ -471,11 +491,11 @@ This is a known issue with the .Ql --gauge widget in .Xr Xdialog 1 . -Embed escaped newlines within prompt text(s) to force line breaks. +Embed escaped newlines within prompt text to force line breaks. .Pp .Xr dialog 1 does not display the first character after a series of escaped escape-sequences -(e.g., ``\\\\n'' produces ``\\'' instead of ``\\n''). +(for example, ``\\\\n'' produces ``\\'' instead of ``\\n''). This is a known issue with .Xr dialog 1 and does not affect @@ -483,10 +503,10 @@ and does not affect or .Xr Xdialog 1 . .Pp -If your application ignores +If an application ignores .Ev USE_COLOR when set and NULL before calling -.Xr dpv 3 +.Fn dpv with color escape sequences anyway, .Xr dialog 3 and Modified: user/markj/vm-playground/lib/libdpv/util.c ============================================================================== --- user/markj/vm-playground/lib/libdpv/util.c Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/lib/libdpv/util.c Fri Mar 16 16:04:06 2018 (r331062) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Devin Teske + * Copyright (c) 2013-2018 Devin Teske * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,8 +100,7 @@ shell_spawn_pipecmd(const char *cmd, const char *label posix_spawn_file_actions_addclose(&action, stdin_pipe[1]); error = posix_spawnp(pid, shellcmd, &action, (const posix_spawnattr_t *)NULL, shellcmd_argv, environ); - if (error != 0) - err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__); + if (error != 0) err(EXIT_FAILURE, "%s", shellcmd); return stdin_pipe[1]; } Modified: user/markj/vm-playground/lib/libfigpar/figpar.3 ============================================================================== --- user/markj/vm-playground/lib/libfigpar/figpar.3 Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/lib/libfigpar/figpar.3 Fri Mar 16 16:04:06 2018 (r331062) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2013-2015 Devin Teske +.\" Copyright (c) 2013-2018 Devin Teske .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Nov 2, 2015 +.Dd March 13, 2018 .Dt FIGPAR 3 .Os .Sh NAME @@ -38,22 +38,30 @@ .In figpar.h .Ft int .Fo parse_config -.Fa "struct figpar_config options[], const char *path" -.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option, uint32_t line" -.Fa "char *directive, char *value\*[rp], uint8_t processing_options" +.Fa "struct figpar_config options[]" +.Fa "const char *path" +.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option" +.Fa "uint32_t line" +.Fa "char *directive" +.Fa "char *value\*[rp]" +.Fa "uint8_t processing_options" .Fc .Ft "struct figpar_config *" .Fo get_config_option -.Fa "struct figpar_config options[], const char *directive" +.Fa "struct figpar_config options[]" +.Fa "const char *directive" .Fc .In string_m.h .Ft int .Fo replaceall -.Fa "char *source, const char *find, const char *replace" +.Fa "char *source" +.Fa "const char *find" +.Fa "const char *replace" .Fc .Ft unsigned int .Fo strcount -.Fa "const char *source, const char *find" +.Fa "const char *source" +.Fa "const char *find" .Fc .Ft void .Fo strexpand @@ -70,7 +78,8 @@ .Sh DESCRIPTION The .Nm -library provides a light-weight, portable framework for parsing configuration +library provides a light-weight, +portable framework for parsing configuration files. The library uses .Xr open 2 , @@ -87,8 +96,9 @@ provides raw data to a set of callback functions. These callback functions can in-turn initiate abort through their return value, allowing custom syntax validation during parsing. .Pp -Configuration directives, types, and callback functions are provided through -data structures defined in +Configuration directives, +types, +and callback functions are provided through data structures defined in .In figpar.h : .Bd -literal -offset indent struct figpar_config { @@ -132,7 +142,7 @@ argument to .Fn parse_config is a mask of bit fields which indicate various processing options. -The possible flags are as follows: +The possible flags are: .Bl -tag -width FIGPAR_BREAK_ON_SEMICOLON .It Dv FIGPAR_BREAK_ON_EQUALS An equals sign @@ -151,7 +161,8 @@ Normally directives are matched case insensitively usi .Xr fnmatch 3 . This flag enables directive matching to be case sensitive. .It Dv FIGPAR_REQUIRE_EQUALS -If a directive is not followed by an equals, processing is aborted. +If a directive is not followed by an equals, +processing is aborted. .It Dv FIGPAR_STRICT_EQUALS Equals must be part of the directive to be considered a delimiter between directive and value. @@ -159,7 +170,7 @@ directive and value. .Pp The .Fa options -struct array pointer can be NULL and every directive will invoke the +struct array pointer can be NULL and every directive will run the .Fn unknown function argument. .Pp @@ -168,13 +179,16 @@ The directive for each figpar_config item in the options argument is matched against each parsed directive using .Xr fnmatch 3 until a match is found. -If a match is found, the +If a match is found, +the .Fn action -function for that figpar_config directive is invoked with the line number, -directive, and value. -Otherwise if no match, the +function for that figpar_config directive is run with the line number, +directive, +and value. +Otherwise if no match, +the .Fn unknown -function is invoked +function is run .Pq with the same arguments . .Pp If either @@ -197,19 +211,20 @@ is entirely optional as-is the use of .Fa "enum figpar_cfgtype" or .Fa "union figpar_cfgvalue" . -For example, you could choose to pass a NULL pointer to +For example, +a NULL pointer can be passed to .Fn parse_config -for the first argument and then provide a simple +for the first argument while providing a simple .Fa unknown function based on .Xr queue 3 -that populates a singly-linked list of your own struct containing the +that populates a singly-linked list of a struct containing the .Fa directive and .Fa value . .Pp -In addition, the following miscellaneous string manipulation routines are -provided by +In addition, +miscellaneous string manipulation routines are provided by .In string_m.h : .Bl -tag -width strexpandnl() .It Fn replaceall @@ -224,8 +239,7 @@ Count the number of occurrences of one string that app .Fa source string. Return value is the total count. -An example use would be if you need to know how large a block of memory needs -to be for a +An example use would be to show how large a block of memory needs to be for a .Fn replaceall series. .It Fn strexpand Modified: user/markj/vm-playground/lib/libipsec/pfkey.c ============================================================================== --- user/markj/vm-playground/lib/libipsec/pfkey.c Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/lib/libipsec/pfkey.c Fri Mar 16 16:04:06 2018 (r331062) @@ -1595,10 +1595,12 @@ pfkey_send_x5(so, type, spid) * others : success and return value of socket. */ int -pfkey_open() +pfkey_open(void) { int so; - const int bufsiz = 128 * 1024; /*is 128K enough?*/ + int bufsiz_current, bufsiz_wanted; + int ret; + socklen_t len; if ((so = socket(PF_KEY, SOCK_RAW, PF_KEY_V2)) < 0) { __ipsec_set_strerror(strerror(errno)); @@ -1609,8 +1611,28 @@ pfkey_open() * This is a temporary workaround for KAME PR 154. * Don't really care even if it fails. */ - (void)setsockopt(so, SOL_SOCKET, SO_SNDBUF, &bufsiz, sizeof(bufsiz)); - (void)setsockopt(so, SOL_SOCKET, SO_RCVBUF, &bufsiz, sizeof(bufsiz)); + /* Try to have 128k. If we have more, do not lower it. */ + bufsiz_wanted = 128 * 1024; + len = sizeof(bufsiz_current); + ret = getsockopt(so, SOL_SOCKET, SO_SNDBUF, + &bufsiz_current, &len); + if ((ret < 0) || (bufsiz_current < bufsiz_wanted)) + (void)setsockopt(so, SOL_SOCKET, SO_SNDBUF, + &bufsiz_wanted, sizeof(bufsiz_wanted)); + + /* Try to have have at least 2MB. If we have more, do not lower it. */ + bufsiz_wanted = 2 * 1024 * 1024; + len = sizeof(bufsiz_current); + ret = getsockopt(so, SOL_SOCKET, SO_RCVBUF, + &bufsiz_current, &len); + if (ret < 0) + bufsiz_current = 128 * 1024; + + for (; bufsiz_wanted > bufsiz_current; bufsiz_wanted /= 2) { + if (setsockopt(so, SOL_SOCKET, SO_RCVBUF, + &bufsiz_wanted, sizeof(bufsiz_wanted)) == 0) + break; + } __ipsec_errcode = EIPSEC_NO_ERROR; return so; Modified: user/markj/vm-playground/lib/libmagic/Makefile ============================================================================== --- user/markj/vm-playground/lib/libmagic/Makefile Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/lib/libmagic/Makefile Fri Mar 16 16:04:06 2018 (r331062) @@ -8,7 +8,9 @@ CONTRDIR= ${SRCTOP}/contrib/file LIB= magic SHLIB_MAJOR= 4 +.if !make(build-tools) LIBADD= z +.endif MAN= libmagic.3 magic.5 SRCS= apprentice.c apptype.c ascmagic.c cdf.c cdf_time.c compress.c \ Modified: user/markj/vm-playground/lib/libsysdecode/mktables ============================================================================== --- user/markj/vm-playground/lib/libsysdecode/mktables Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/lib/libsysdecode/mktables Fri Mar 16 16:04:06 2018 (r331062) @@ -146,7 +146,7 @@ gen_table "socktype" "SOCK_[A-Z]+[[:space:]]+[1 gen_table "thrcreateflags" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h" gen_table "umtxop" "UMTX_OP_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" gen_table "vmprot" "VM_PROT_[A-Z]+[[:space:]]+\(\(vm_prot_t\)[[:space:]]+0x[0-9]+\)" "vm/vm.h" -gen_table "vmresult" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h" +gen_table "vmresult" "KERN_[A-Z_]+[[:space:]]+[0-9]+" "vm/vm_param.h" gen_table "wait6opt" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h" gen_table "seekwhence" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h" gen_table "fcntlcmd" "F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]+" "sys/fcntl.h" "F_CANCEL|F_..LCK" Modified: user/markj/vm-playground/libexec/tftpd/Makefile ============================================================================== --- user/markj/vm-playground/libexec/tftpd/Makefile Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/libexec/tftpd/Makefile Fri Mar 16 16:04:06 2018 (r331062) @@ -14,4 +14,7 @@ CFLAGS+= -DLIBWRAP LIBADD= wrap .endif +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Modified: user/markj/vm-playground/libexec/tftpd/tftp-transfer.c ============================================================================== --- user/markj/vm-playground/libexec/tftpd/tftp-transfer.c Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/libexec/tftpd/tftp-transfer.c Fri Mar 16 16:04:06 2018 (r331062) @@ -304,6 +304,8 @@ send_ack: gettimeofday(&(ts->tstop), NULL); } while (n_data == segsize); + write_close(); + /* Don't do late packet management for the client implementation */ if (acting_as_client) return; Modified: user/markj/vm-playground/libexec/tftpd/tftpd.c ============================================================================== --- user/markj/vm-playground/libexec/tftpd/tftpd.c Fri Mar 16 15:26:07 2018 (r331061) +++ user/markj/vm-playground/libexec/tftpd/tftpd.c Fri Mar 16 16:04:06 2018 (r331062) @@ -421,8 +421,7 @@ main(int argc, char *argv[]) "%s read access denied", peername); exit(1); } - } - if (tp->th_opcode == WRQ) { + } else if (tp->th_opcode == WRQ) { if (allow_wo) tftp_wrq(peer, tp->th_stuff, n - 1); else { @@ -430,7 +429,8 @@ main(int argc, char *argv[]) "%s write access denied", peername); exit(1); } - } + } else + send_error(peer, EBADOP); exit(1); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@freebsd.org Fri Mar 16 19:26:59 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 36045F41376 for ; Fri, 16 Mar 2018 19:26:59 +0000 (UTC) (envelope-from markj@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 CF84F7059B; Fri, 16 Mar 2018 19:26:58 +0000 (UTC) (envelope-from markj@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 BBAA427EE3; Fri, 16 Mar 2018 19:26:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2GJQwj6092612; Fri, 16 Mar 2018 19:26:58 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2GJQwsq092611; Fri, 16 Mar 2018 19:26:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803161926.w2GJQwsq092611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 16 Mar 2018 19:26:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r331071 - user/markj/vm-playground/sys/vm X-SVN-Group: user X-SVN-Commit-Author: markj X-SVN-Commit-Paths: user/markj/vm-playground/sys/vm X-SVN-Commit-Revision: 331071 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, 16 Mar 2018 19:26:59 -0000 Author: markj Date: Fri Mar 16 19:26:58 2018 New Revision: 331071 URL: https://svnweb.freebsd.org/changeset/base/331071 Log: Fix mismerge. Modified: user/markj/vm-playground/sys/vm/vm_page.c Modified: user/markj/vm-playground/sys/vm/vm_page.c ============================================================================== --- user/markj/vm-playground/sys/vm/vm_page.c Fri Mar 16 18:50:26 2018 (r331070) +++ user/markj/vm-playground/sys/vm/vm_page.c Fri Mar 16 19:26:58 2018 (r331071) @@ -3682,7 +3682,7 @@ vm_page_free_toq(vm_page_t m) freed += vm_page_free_phys(vmd, m); vm_domain_free_unlock(vmd); if (freed) - vm_domain_freecnt_inc(vmd, 1); + vm_domain_freecnt_inc(vmd, freed); } /* From owner-svn-src-user@freebsd.org Fri Mar 16 20:04:53 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 789FBF49363 for ; Fri, 16 Mar 2018 20:04:53 +0000 (UTC) (envelope-from markj@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 1FCF571D92; Fri, 16 Mar 2018 20:04:53 +0000 (UTC) (envelope-from markj@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 19239559; Fri, 16 Mar 2018 20:04:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2GK4qi9012679; Fri, 16 Mar 2018 20:04:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2GK4q3s012678; Fri, 16 Mar 2018 20:04:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803162004.w2GK4q3s012678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 16 Mar 2018 20:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r331072 - user/markj/vm-playground/sys/kern X-SVN-Group: user X-SVN-Commit-Author: markj X-SVN-Commit-Paths: user/markj/vm-playground/sys/kern X-SVN-Commit-Revision: 331072 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, 16 Mar 2018 20:04:53 -0000 Author: markj Date: Fri Mar 16 20:04:52 2018 New Revision: 331072 URL: https://svnweb.freebsd.org/changeset/base/331072 Log: Elide the object lock in vfs_vmio_truncate() in the common case. Rather attempting to free invalid pages, accelerate their reclamation by moving them near the head of the inactive queue. With this change, bufspace threads don't touch the object lock. Modified: user/markj/vm-playground/sys/kern/vfs_bio.c Modified: user/markj/vm-playground/sys/kern/vfs_bio.c ============================================================================== --- user/markj/vm-playground/sys/kern/vfs_bio.c Fri Mar 16 19:26:58 2018 (r331071) +++ user/markj/vm-playground/sys/kern/vfs_bio.c Fri Mar 16 20:04:52 2018 (r331072) @@ -2915,24 +2915,14 @@ vfs_vmio_unwire(struct buf *bp, vm_page_t m) vm_page_lock(m); if (vm_page_unwire_noq(m)) { - /* - * Determine if the page should be freed before adding - * it to the inactive queue. - */ - if (m->valid == 0) { - freed = !vm_page_busied(m); - if (freed) - vm_page_free(m); - } else if ((bp->b_flags & B_DIRECT) != 0) - freed = vm_page_try_to_free(m); - else - freed = false; - if (!freed) { + if ((bp->b_flags & B_DIRECT) == 0 || !vm_page_try_to_free(m)) { /* - * If the page is unlikely to be reused, let the - * VM know. Otherwise, maintain LRU. + * Use a racy check of the valid bits to determine + * whether we can accelerate reclamation of the page. + * This allows elision of the object write lock in the + * common case. */ - if ((bp->b_flags & B_NOREUSE) != 0) + if (m->valid == 0 || (bp->b_flags & B_NOREUSE) != 0) vm_page_deactivate_noreuse(m); else if (m->queue == PQ_ACTIVE) vm_page_reference(m); @@ -3021,7 +3011,12 @@ vfs_vmio_truncate(struct buf *bp, int desiredpages) (desiredpages << PAGE_SHIFT), bp->b_npages - desiredpages); } else BUF_CHECK_UNMAPPED(bp); - obj = bp->b_bufobj->bo_object; + + /* + * The object lock is needed only if we attempt to free the buffer's + * pages. + */ + obj = (bp->b_flags & B_DIRECT) != 0 ? bp->b_bufobj->bo_object : NULL; if (obj != NULL) VM_OBJECT_WLOCK(obj); for (i = desiredpages; i < bp->b_npages; i++) {