From owner-svn-src-head@freebsd.org Sun Aug 6 06:31:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CECFBDC6E20; Sun, 6 Aug 2017 06:31:48 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9EC4874FD5; Sun, 6 Aug 2017 06:31:48 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v766Vl7k052961; Sun, 6 Aug 2017 06:31:47 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v766VlJg052960; Sun, 6 Aug 2017 06:31:47 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201708060631.v766VlJg052960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 6 Aug 2017 06:31:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322112 - head/kerberos5/lib/libkafs5 X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/kerberos5/lib/libkafs5 X-SVN-Commit-Revision: 322112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Aug 2017 06:31:48 -0000 Author: cy Date: Sun Aug 6 06:31:47 2017 New Revision: 322112 URL: https://svnweb.freebsd.org/changeset/base/322112 Log: krb5_err.h is generated from a .et file in kerberos5/lib/libkrb5. As kerberos5/lib/krb5 include files are already referenced it makes no sense to generate it again here. MFC after: 1 month Modified: head/kerberos5/lib/libkafs5/Makefile Modified: head/kerberos5/lib/libkafs5/Makefile ============================================================================== --- head/kerberos5/lib/libkafs5/Makefile Sat Aug 5 23:54:26 2017 (r322111) +++ head/kerberos5/lib/libkafs5/Makefile Sun Aug 6 06:31:47 2017 (r322112) @@ -22,7 +22,7 @@ MLINKS= kafs5.3 k_afs_cell_of_file.3 \ kafs5.3 krb_afslog.3 \ kafs5.3 krb_afslog_uid.3 -SRCS= afssys.c afskrb5.c common.c krb5_err.h +SRCS= afssys.c afskrb5.c common.c CFLAGS+= -I${KRB5DIR}/lib/kafs \ -I${KRB5DIR}/lib/krb5 \ From owner-svn-src-head@freebsd.org Sun Aug 6 06:35:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E1E1DC73DB; Sun, 6 Aug 2017 06:35:42 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BCF87532B; Sun, 6 Aug 2017 06:35:41 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v766Zfo7055992; Sun, 6 Aug 2017 06:35:41 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v766ZfU8055991; Sun, 6 Aug 2017 06:35:41 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201708060635.v766ZfU8055991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 6 Aug 2017 06:35:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322113 - head/kerberos5/libexec/ipropd-master X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/kerberos5/libexec/ipropd-master X-SVN-Commit-Revision: 322113 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Aug 2017 06:35:42 -0000 Author: cy Date: Sun Aug 6 06:35:40 2017 New Revision: 322113 URL: https://svnweb.freebsd.org/changeset/base/322113 Log: Remove dead target introduced in r178828. MFC after: 1 week Modified: head/kerberos5/libexec/ipropd-master/Makefile Modified: head/kerberos5/libexec/ipropd-master/Makefile ============================================================================== --- head/kerberos5/libexec/ipropd-master/Makefile Sun Aug 6 06:31:47 2017 (r322112) +++ head/kerberos5/libexec/ipropd-master/Makefile Sun Aug 6 06:35:40 2017 (r322113) @@ -10,9 +10,6 @@ DPADD= ${LDAPDPADD} LDADD= ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} -foo:: - echo ${LIBHX509} - .include .PATH: ${KRB5DIR}/lib/kadm5 From owner-svn-src-head@freebsd.org Sun Aug 6 11:39:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AC63DD4B1F; Sun, 6 Aug 2017 11:39:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id E15DB82816; Sun, 6 Aug 2017 11:39:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 6FAF51047DC3; Sun, 6 Aug 2017 21:39:19 +1000 (AEST) Date: Sun, 6 Aug 2017 21:39:18 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r321920 - head/sys/sys In-Reply-To: <20170805074243.GX1700@kib.kiev.ua> Message-ID: <20170806213334.V1366@besplex.bde.org> References: <201708021014.v72AEHEk061037@repo.freebsd.org> <37abc595-c80e-a8da-04a8-815f42c634de@selasky.org> <20170802135455.GG1700@kib.kiev.ua> <20170803122015.Q1093@besplex.bde.org> <20170803075747.GJ1700@kib.kiev.ua> <20170803180419.R2314@besplex.bde.org> <20170803120729.GO1700@kib.kiev.ua> <20170805112924.W1055@besplex.bde.org> <20170805074243.GX1700@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=RFnRnYDGFsOq-WPcPKwA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Aug 2017 11:39:29 -0000 On Sat, 5 Aug 2017, Konstantin Belousov wrote: > On Sat, Aug 05, 2017 at 12:26:03PM +1000, Bruce Evans wrote: >>> +#define minor(x) ((int)(x)) >> >> Another nice simplification. Strictly, it should be (int)(dev_t)(x) since >> the pseudo-prototype says that the arg is converted to dev_t, but yesterday >> I couldn't see any differences even for exotic x and exotic arches. >> >> Today I can see some difference for exotic x and perverse implementations. >> E.g., x with extra bits in a large signed integer type to invoke >> implementation-defined behaviour, and a perverse implementation that >> truncates to 0 for direct conversion to int but does the right thing >> for indirect conversion). But we depend on the implementation doing >> the right thing for other casts to int. >> >> Also, if dev_t == uintptr_t, it is valid for the caller to keep dev_t's >> in void *'s internally but not to pass void * to minor() or major() >> according to the prototype. However, casting in the macros breaks the >> warning for this. I think pure macros should not cast their args or >> pretend to have prototypes, but require callers to pass args of supported >> types. The old dev_t macros were closer to this -- they have expressions >> like ((x) << 8) which will fail if x is not an integral type or give >> wrong results ix x has extra bits. > So you are arguing to keep the & 0xffffffff operation ? No, I don't want to go that deep. > I think this is not needed, since your note about cast being equivalent > holds for all supported architectures and I do not see anywhere a contract > for the operations to work on non-dev_t. The pseudo-prototypes look like they provide such a contract. They must be read sort of backwards as saying that it is the caller's responsibility to pass args of the type in the pseudo-prototype, like for a K&R function or a C90 function with prototype is in scope. > So are you fine with the posted patch to sys/types.h ? OK. Bruce From owner-svn-src-head@freebsd.org Sun Aug 6 12:27:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE8E5DD7829; Sun, 6 Aug 2017 12:27:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D02384596; Sun, 6 Aug 2017 12:27:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v76CRKsI099109; Sun, 6 Aug 2017 12:27:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76CRKmp099108; Sun, 6 Aug 2017 12:27:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708061227.v76CRKmp099108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Aug 2017 12:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322118 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 322118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Aug 2017 12:27:21 -0000 Author: kib Date: Sun Aug 6 12:27:20 2017 New Revision: 322118 URL: https://svnweb.freebsd.org/changeset/base/322118 Log: Remove trivial comments. Remove and-ing with UINT_MAX for minor(), cast to int already does the required truncation of significant bits. Requested and reviewed by: bde Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/types.h Modified: head/sys/sys/types.h ============================================================================== --- head/sys/sys/types.h Sun Aug 6 10:07:25 2017 (r322117) +++ head/sys/sys/types.h Sun Aug 6 12:27:20 2017 (r322118) @@ -364,9 +364,9 @@ __bitcount64(__uint64_t _x) #include -#define major(x) ((int)((dev_t)(x) >> 32)) /* major number */ -#define minor(x) ((int)((x) & 0xffffffff)) /* minor number */ -#define makedev(x, y) (((dev_t)(x) << 32) | (unsigned)(y)) /* create dev_t */ +#define major(x) ((int)((dev_t)(x) >> 32)) +#define minor(x) ((int)(x)) +#define makedev(x, y) (((dev_t)(x) << 32) | (unsigned)(y)) /* * These declarations belong elsewhere, but are repeated here and in From owner-svn-src-head@freebsd.org Sun Aug 6 19:46:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB72FDC5EDF; Sun, 6 Aug 2017 19:46:00 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADA3E6B50D; Sun, 6 Aug 2017 19:46:00 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v76Jjx25077977; Sun, 6 Aug 2017 19:45:59 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76Jjxxw077976; Sun, 6 Aug 2017 19:45:59 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708061945.v76Jjxxw077976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 6 Aug 2017 19:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322123 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 322123 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Aug 2017 19:46:01 -0000 Author: np Date: Sun Aug 6 19:45:59 2017 New Revision: 322123 URL: https://svnweb.freebsd.org/changeset/base/322123 Log: cxgbe(4): Avoid a NULL dereference that would occur during module unload if there were problems earlier during attach. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sched.c Modified: head/sys/dev/cxgbe/t4_sched.c ============================================================================== --- head/sys/dev/cxgbe/t4_sched.c Sun Aug 6 16:12:56 2017 (r322122) +++ head/sys/dev/cxgbe/t4_sched.c Sun Aug 6 19:45:59 2017 (r322123) @@ -382,8 +382,10 @@ t4_free_tx_sched(struct adapter *sc) taskqueue_drain(taskqueue_thread, &sc->tc_task); - for_each_port(sc, i) - free(sc->port[i]->sched_params, M_CXGBE); + for_each_port(sc, i) { + if (sc->port[i] != NULL) + free(sc->port[i]->sched_params, M_CXGBE); + } if (mtx_initialized(&sc->tc_lock)) mtx_destroy(&sc->tc_lock); From owner-svn-src-head@freebsd.org Sun Aug 6 21:54:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90D67DCC1A4; Sun, 6 Aug 2017 21:54:44 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C0376F601; Sun, 6 Aug 2017 21:54:44 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v76LshS9029771; Sun, 6 Aug 2017 21:54:43 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76LshbH029770; Sun, 6 Aug 2017 21:54:43 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201708062154.v76LshbH029770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Aug 2017 21:54:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322124 - head/usr.sbin/bluetooth/rfcomm_pppd X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: head/usr.sbin/bluetooth/rfcomm_pppd X-SVN-Commit-Revision: 322124 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Aug 2017 21:54:44 -0000 Author: avos Date: Sun Aug 6 21:54:43 2017 New Revision: 322124 URL: https://svnweb.freebsd.org/changeset/base/322124 Log: rfcomm_pppd.8: fix a typo (SPD -> SDP). MFC after: 3 days Modified: head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Modified: head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 ============================================================================== --- head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Sun Aug 6 19:45:59 2017 (r322123) +++ head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Sun Aug 6 21:54:43 2017 (r322124) @@ -348,7 +348,7 @@ label. The .Nm utility in server mode will try to register the Bluetooth LAN Access Over PPP -service with the local SPD daemon. +service with the local SDP daemon. If the local SDP daemon is not running, .Nm will exit with an error. From owner-svn-src-head@freebsd.org Mon Aug 7 08:45:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2065EDC4524; Mon, 7 Aug 2017 08:45:10 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF11716E3; Mon, 7 Aug 2017 08:45:09 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v778j9V7092671; Mon, 7 Aug 2017 08:45:09 GMT (envelope-from gahr@FreeBSD.org) Received: (from gahr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v778j8gS092667; Mon, 7 Aug 2017 08:45:08 GMT (envelope-from gahr@FreeBSD.org) Message-Id: <201708070845.v778j8gS092667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gahr set sender to gahr@FreeBSD.org using -f From: Pietro Cerutti Date: Mon, 7 Aug 2017 08:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322139 - in head: contrib/top usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: gahr X-SVN-Commit-Paths: in head: contrib/top usr.bin/top X-SVN-Commit-Revision: 322139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 08:45:10 -0000 Author: gahr (ports committer) Date: Mon Aug 7 08:45:08 2017 New Revision: 322139 URL: https://svnweb.freebsd.org/changeset/base/322139 Log: Enhance top(1) to filter on multiple usernames Reviewed by: cognet, bapt Approved by: cognet MFC after: 1 week Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11840 Modified: head/contrib/top/machine.h head/contrib/top/top.c head/contrib/top/top.xs head/usr.bin/top/machine.c Modified: head/contrib/top/machine.h ============================================================================== --- head/contrib/top/machine.h Mon Aug 7 07:40:00 2017 (r322138) +++ head/contrib/top/machine.h Mon Aug 7 08:45:08 2017 (r322139) @@ -70,7 +70,8 @@ struct process_select int self; /* show self */ int system; /* show system processes */ int thread; /* show threads */ - int uid; /* only this uid (unless uid == -1) */ +#define TOP_MAX_UIDS 8 + int uid[TOP_MAX_UIDS]; /* only these uids (unless uid[0] == -1) */ int wcpu; /* show weighted cpu */ int jid; /* only this jid (unless jid == -1) */ int jail; /* show jail ID */ Modified: head/contrib/top/top.c ============================================================================== --- head/contrib/top/top.c Mon Aug 7 07:40:00 2017 (r322138) +++ head/contrib/top/top.c Mon Aug 7 08:45:08 2017 (r322139) @@ -134,7 +134,110 @@ void (*d_process)(int line, char *thisline) = i_proces void reset_display(void); +static void +reset_uids() +{ + for (size_t i = 0; i < TOP_MAX_UIDS; ++i) + ps.uid[i] = -1; +} +static int +add_uid(int uid) +{ + size_t i = 0; + + /* Add the uid if there's room */ + for (; i < TOP_MAX_UIDS; ++i) + { + if (ps.uid[i] == -1 || ps.uid[i] == uid) + { + ps.uid[i] = uid; + break; + } + } + + return (i == TOP_MAX_UIDS); +} + +static void +rem_uid(int uid) +{ + size_t i = 0; + size_t where = TOP_MAX_UIDS; + + /* Look for the user to remove - no problem if it's not there */ + for (; i < TOP_MAX_UIDS; ++i) + { + if (ps.uid[i] == -1) + break; + if (ps.uid[i] == uid) + where = i; + } + + /* Make sure we don't leave a hole in the middle */ + if (where != TOP_MAX_UIDS) + { + ps.uid[where] = ps.uid[i-1]; + ps.uid[i-1] = -1; + } +} + +static int +handle_user(char *buf, size_t buflen) +{ + int rc = 0; + int uid = -1; + char *buf2 = buf; + + new_message(MT_standout, "Username to show (+ for all): "); + if (readline(buf, buflen, No) <= 0) + { + clear_message(); + return rc; + } + + if (buf[0] == '+' || buf[0] == '-') + { + if (buf[1] == '\0') + { + reset_uids(); + goto end; + } + else + ++buf2; + } + + if ((uid = userid(buf2)) == -1) + { + new_message(MT_standout, " %s: unknown user", buf2); + rc = 1; + goto end; + } + + if (buf2 == buf) + { + reset_uids(); + ps.uid[0] = uid; + goto end; + } + + if (buf[0] == '+') + { + if (add_uid(uid)) + { + new_message(MT_standout, " too many users, reset with '+'"); + rc = 1; + goto end; + } + } + else + rem_uid(uid); + +end: + putchar('\r'); + return rc; +} + int main(argc, argv) @@ -252,7 +355,7 @@ char *argv[]; ps.idle = Yes; ps.self = -1; ps.system = No; - ps.uid = -1; + reset_uids(); ps.thread = No; ps.wcpu = 1; ps.jid = -1; @@ -299,7 +402,7 @@ char *argv[]; break; case 'U': /* display only username's processes */ - if ((ps.uid = userid(optarg)) == -1) + if ((ps.uid[0] = userid(optarg)) == -1) { fprintf(stderr, "%s: unknown user\n", optarg); exit(1); @@ -1004,31 +1107,8 @@ restart: break; case CMD_user: - new_message(MT_standout, - "Username to show (+ for all): "); - if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) - { - if (tempbuf2[0] == '+' && - tempbuf2[1] == '\0') - { - ps.uid = -1; - } - else if ((i = userid(tempbuf2)) == -1) - { - new_message(MT_standout, - " %s: unknown user", tempbuf2); - no_command = Yes; - } - else - { - ps.uid = i; - } - putchar('\r'); - } - else - { - clear_message(); - } + if (handle_user(tempbuf2, sizeof(tempbuf2))) + no_command = Yes; break; case CMD_thrtog: Modified: head/contrib/top/top.xs ============================================================================== --- head/contrib/top/top.xs Mon Aug 7 07:40:00 2017 (r322138) +++ head/contrib/top/top.xs Mon Aug 7 08:45:08 2017 (r322139) @@ -307,9 +307,11 @@ This acts similarly to the command .IR renice (8)). .TP .B u -Display only processes owned by a specific username (prompt for username). -If the username specified is simply \*(lq+\*(rq, then processes belonging -to all users will be displayed. +Display only processes owned by a specific set of usernames (prompt for +username). If the username specified is simply \*(lq+\*(rq or \*(lq-\*(rq, +then processes belonging to all users will be displayed. Usernames can be added +to and removed from the set by prepending them with \*(lq+\*(rq and +\*(lq-\*(rq, respectively. .TP .B o Change the order in which the display is sorted. This command is not Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Mon Aug 7 07:40:00 2017 (r322138) +++ head/usr.bin/top/machine.c Mon Aug 7 08:45:08 2017 (r322139) @@ -273,7 +273,19 @@ static const char *format_nice(const struct kinfo_proc static void getsysctl(const char *name, void *ptr, size_t len); static int swapmode(int *retavail, int *retfree); static void update_layout(void); +static int find_uid(uid_t needle, int *haystack); +static int +find_uid(uid_t needle, int *haystack) +{ + size_t i = 0; + + for (; i < TOP_MAX_UIDS; ++i) + if ((uid_t)haystack[i] == needle) + return 1; + return 0; +} + void toggle_pcpustats(void) { @@ -847,7 +859,7 @@ get_process_info(struct system_info *si, struct proces show_jid = sel->jid != -1; show_self = sel->self == -1; show_system = sel->system; - show_uid = sel->uid != -1; + show_uid = sel->uid[0] != -1; show_command = sel->command != NULL; show_kidle = sel->kidle; @@ -906,7 +918,7 @@ get_process_info(struct system_info *si, struct proces /* skip proc. that don't belong to the selected JID */ continue; - if (show_uid && pp->ki_ruid != (uid_t)sel->uid) + if (show_uid && !find_uid(pp->ki_ruid, sel->uid)) /* skip proc. that don't belong to the selected UID */ continue; From owner-svn-src-head@freebsd.org Mon Aug 7 14:04:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D7DFDD5786; Mon, 7 Aug 2017 14:04:20 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 788BE6D757; Mon, 7 Aug 2017 14:04:20 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77E4JLJ024046; Mon, 7 Aug 2017 14:04:19 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77E4JRQ024045; Mon, 7 Aug 2017 14:04:19 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708071404.v77E4JRQ024045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 7 Aug 2017 14:04:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322167 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 322167 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 14:04:20 -0000 Author: np Date: Mon Aug 7 14:04:19 2017 New Revision: 322167 URL: https://svnweb.freebsd.org/changeset/base/322167 Log: cxgbe(4): Add the T6 and T5 Unified Wire configuration files to the kernel, just like for T4, when the driver is compiled into the kernel. Reported by: mav@ MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Aug 7 13:27:35 2017 (r322166) +++ head/sys/conf/files Mon Aug 7 14:04:19 2017 (r322167) @@ -1399,7 +1399,7 @@ t4fw.fw optional cxgbe \ no-obj no-implicit-rule \ clean "t4fw.fw" t5fw_cfg.c optional cxgbe \ - compile-with "${AWK} -f $S/tools/fw_stub.awk t5fw_cfg.fw:t5fw_cfg t5fw.fw:t5fw -mt5fw_cfg -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk t5fw_cfg.fw:t5fw_cfg t5fw_cfg_uwire.fw:t5fw_cfg_uwire t4fw.fw:t4fw -mt5fw_cfg -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "t5fw_cfg.c" t5fw_cfg.fwo optional cxgbe \ @@ -1412,6 +1412,16 @@ t5fw_cfg.fw optional cxgbe \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw_cfg.fw" +t5fw_cfg_uwire.fwo optional cxgbe \ + dependency "t5fw_cfg_uwire.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "t5fw_cfg_uwire.fwo" +t5fw_cfg_uwire.fw optional cxgbe \ + dependency "$S/dev/cxgbe/firmware/t5fw_cfg_uwire.txt" \ + compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ + no-obj no-implicit-rule \ + clean "t5fw_cfg_uwire.fw" t5fw.fwo optional cxgbe \ dependency "t5fw.fw" \ compile-with "${NORMAL_FWO}" \ @@ -1423,7 +1433,7 @@ t5fw.fw optional cxgbe \ no-obj no-implicit-rule \ clean "t5fw.fw" t6fw_cfg.c optional cxgbe \ - compile-with "${AWK} -f $S/tools/fw_stub.awk t6fw_cfg.fw:t6fw_cfg t6fw.fw:t6fw -mt6fw_cfg -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk t6fw_cfg.fw:t6fw_cfg t6fw_cfg_uwire.fw:t6fw_cfg_uwire t6fw.fw:t6fw -mt6fw_cfg -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "t6fw_cfg.c" t6fw_cfg.fwo optional cxgbe \ @@ -1436,6 +1446,16 @@ t6fw_cfg.fw optional cxgbe \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw_cfg.fw" +t6fw_cfg_uwire.fwo optional cxgbe \ + dependency "t6fw_cfg_uwire.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "t6fw_cfg_uwire.fwo" +t6fw_cfg_uwire.fw optional cxgbe \ + dependency "$S/dev/cxgbe/firmware/t6fw_cfg_uwire.txt" \ + compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ + no-obj no-implicit-rule \ + clean "t6fw_cfg_uwire.fw" t6fw.fwo optional cxgbe \ dependency "t6fw.fw" \ compile-with "${NORMAL_FWO}" \ From owner-svn-src-head@freebsd.org Mon Aug 7 14:10:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A11ADDD5A88; Mon, 7 Aug 2017 14:10:01 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68EB76D95F; Mon, 7 Aug 2017 14:10:01 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77EA0WU024334; Mon, 7 Aug 2017 14:10:00 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77E9vZw024276; Mon, 7 Aug 2017 14:09:57 GMT (envelope-from br@FreeBSD.org) Message-Id: <201708071409.v77E9vZw024276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 7 Aug 2017 14:09:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322168 - in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/compiler-rt/lib/builtins contrib/compiler-rt/lib/sanitizer_common contrib/elftoolchain/libelf contrib/jemalloc/i... X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/compiler-rt/lib/builtins contrib/compiler-rt/lib/sanitizer_common contrib/elftoolchain/libelf contrib/jemalloc/include/jemalloc contrib/j... X-SVN-Commit-Revision: 322168 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 14:10:01 -0000 Author: br Date: Mon Aug 7 14:09:57 2017 New Revision: 322168 URL: https://svnweb.freebsd.org/changeset/base/322168 Log: o Replace __riscv__ with __riscv o Replace __riscv64 with (__riscv && __riscv_xlen == 64) This is required to support new GCC 7.1 compiler. This is compatible with current GCC 6.1 compiler. RISC-V is extensible ISA and the idea here is to have built-in define per each extension, so together with __riscv we will have some subset of these as well (depending on -march string passed to compiler): __riscv_compressed __riscv_atomic __riscv_mul __riscv_div __riscv_muldiv __riscv_fdiv __riscv_fsqrt __riscv_float_abi_soft __riscv_float_abi_single __riscv_float_abi_double __riscv_cmodel_medlow __riscv_cmodel_medany __riscv_cmodel_pic __riscv_xlen Reviewed by: ngie Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11901 Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c head/contrib/compiler-rt/lib/builtins/int_lib.h head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h head/contrib/elftoolchain/libelf/_libelf_config.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h head/contrib/llvm/projects/libunwind/include/__libunwind_config.h head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S head/contrib/llvm/projects/libunwind/src/config.h head/contrib/llvm/projects/libunwind/src/libunwind.cpp head/contrib/netbsd-tests/lib/libc/gen/t_dir.c head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c head/contrib/zstd/lib/common/xxhash.c head/lib/libc/gen/tls.c head/lib/libproc/proc_bkpt.c head/lib/libproc/proc_regs.c head/libexec/rtld-elf/rtld.c head/share/man/man7/arch.7 head/sys/cddl/compat/opensolaris/sys/atomic.h head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h head/sys/cddl/dev/profile/profile.c head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/dev/sym/sym_hipd.c head/sys/kern/subr_devmap.c head/sys/modules/dtrace/dtraceall/dtraceall.c head/sys/sys/cdefs.h head/usr.bin/ldd/ldd.c head/usr.bin/xlint/lint1/param.h Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Mon Aug 7 14:09:57 2017 (r322168) @@ -250,7 +250,7 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__L dofr[j].dofr_offset + 4; rel->r_info = ELF32_R_INFO(count + dep->de_global, R_PPC_REL32); -#elif defined(__riscv__) +#elif defined(__riscv) /* XXX */ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); #else @@ -430,7 +430,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dofr[j].dofr_offset; rel->r_info = ELF64_R_INFO(count + dep->de_global, R_PPC64_REL64); -#elif defined(__riscv__) +#elif defined(__riscv) /* XXX */ #elif defined(__i386) || defined(__amd64) rel->r_offset = s->dofs_offset + @@ -904,7 +904,7 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, return (0); } -#elif defined(__riscv__) +#elif defined(__riscv) /* XXX */ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Mon Aug 7 14:09:57 2017 (r322168) @@ -311,7 +311,7 @@ pfprint_fp(dtrace_hdl_t *dtp, FILE *fp, const char *fo return (dt_printf(dtp, fp, format, *((double *)addr) / n)); #if !defined(__arm__) && !defined(__powerpc__) && \ - !defined(__mips__) && !defined(__riscv__) + !defined(__mips__) && !defined(__riscv) case sizeof (long double): return (dt_printf(dtp, fp, format, *((long double *)addr) / ldn)); Modified: head/contrib/compiler-rt/lib/builtins/int_lib.h ============================================================================== --- head/contrib/compiler-rt/lib/builtins/int_lib.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/compiler-rt/lib/builtins/int_lib.h Mon Aug 7 14:09:57 2017 (r322168) @@ -92,7 +92,7 @@ * does not have dedicated bit counting instructions. */ #if defined(__FreeBSD__) && (defined(__sparc64__) || \ - defined(__mips_n64) || defined(__mips_o64) || defined(__riscv__)) + defined(__mips_n64) || defined(__mips_o64) || defined(__riscv)) si_int __clzsi2(si_int); si_int __ctzsi2(si_int); #define __builtin_clz __clzsi2 Modified: head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h ============================================================================== --- head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h Mon Aug 7 14:09:57 2017 (r322168) @@ -83,7 +83,7 @@ namespace __sanitizer { #elif defined(__powerpc64__) const unsigned struct_kernel_stat_sz = 144; const unsigned struct_kernel_stat64_sz = 104; -#elif defined(__riscv__) +#elif defined(__riscv) /* RISCVTODO: check that these values are correct */ const unsigned struct_kernel_stat_sz = 128; const unsigned struct_kernel_stat64_sz = 128; @@ -126,7 +126,7 @@ namespace __sanitizer { #if SANITIZER_LINUX || SANITIZER_FREEBSD -#if defined(__powerpc64__) || defined(__riscv__) || defined(__s390__) +#if defined(__powerpc64__) || defined(__riscv) || defined(__s390__) const unsigned struct___old_kernel_stat_sz = 0; #elif !defined(__sparc__) const unsigned struct___old_kernel_stat_sz = 32; @@ -554,7 +554,7 @@ namespace __sanitizer { typedef long __sanitizer___kernel_off_t; #endif -#if defined(__powerpc__) || defined(__mips__) || defined(__riscv__) +#if defined(__powerpc__) || defined(__mips__) || defined(__riscv) typedef unsigned int __sanitizer___kernel_old_uid_t; typedef unsigned int __sanitizer___kernel_old_gid_t; #else Modified: head/contrib/elftoolchain/libelf/_libelf_config.h ============================================================================== --- head/contrib/elftoolchain/libelf/_libelf_config.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/elftoolchain/libelf/_libelf_config.h Mon Aug 7 14:09:57 2017 (r322168) @@ -97,7 +97,7 @@ #define LIBELF_BYTEORDER ELFDATA2MSB #define LIBELF_CLASS ELFCLASS32 -#elif defined(__riscv64) +#elif defined(__riscv) && (__riscv_xlen == 64) #define LIBELF_ARCH EM_RISCV #define LIBELF_BYTEORDER ELFDATA2LSB Modified: head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h Mon Aug 7 14:09:57 2017 (r322168) @@ -88,7 +88,7 @@ typedef int malloc_cpuid_t; # ifdef __powerpc__ # define LG_QUANTUM 4 # endif -# ifdef __riscv__ +# ifdef __riscv # define LG_QUANTUM 4 # endif # ifdef __s390__ Modified: head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Mon Aug 7 14:09:57 2017 (r322168) @@ -67,7 +67,7 @@ # define LG_VADDR 32 # define LG_SIZEOF_PTR 2 #endif -#ifdef __riscv__ +#ifdef __riscv # define LG_VADDR 64 # define LG_SIZEOF_PTR 3 #endif Modified: head/contrib/llvm/projects/libunwind/include/__libunwind_config.h ============================================================================== --- head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Mon Aug 7 14:09:57 2017 (r322168) @@ -48,7 +48,7 @@ # define _LIBUNWIND_CONTEXT_SIZE 16 # define _LIBUNWIND_CURSOR_SIZE 28 # define _LIBUNWIND_MAX_REGISTER 32 -# elif defined(__riscv__) +# elif defined(__riscv) # define _LIBUNWIND_TARGET_RISCV 1 # define _LIBUNWIND_CONTEXT_SIZE 64 # define _LIBUNWIND_CURSOR_SIZE 76 Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Mon Aug 7 14:09:57 2017 (r322168) @@ -478,7 +478,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind14Regis l.jr r9 l.nop -#elif defined(__riscv__) +#elif defined(__riscv) // // void libunwind::Registers_riscv::jumpto() Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S Mon Aug 7 14:09:57 2017 (r322168) @@ -464,7 +464,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext) l.sw 120(r3), r30 l.sw 124(r3), r31 -#elif defined(__riscv__) +#elif defined(__riscv) /* RISCVTODO */ Modified: head/contrib/llvm/projects/libunwind/src/config.h ============================================================================== --- head/contrib/llvm/projects/libunwind/src/config.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/llvm/projects/libunwind/src/config.h Mon Aug 7 14:09:57 2017 (r322168) @@ -71,7 +71,7 @@ (!defined(__APPLE__) && defined(__arm__)) || \ (defined(__arm64__) || defined(__aarch64__)) || \ (defined(__APPLE__) && defined(__mips__)) || \ - defined(__riscv__) + defined(__riscv) #define _LIBUNWIND_BUILD_ZERO_COST_APIS 1 #else #define _LIBUNWIND_BUILD_ZERO_COST_APIS 0 Modified: head/contrib/llvm/projects/libunwind/src/libunwind.cpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/libunwind.cpp Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/llvm/projects/libunwind/src/libunwind.cpp Mon Aug 7 14:09:57 2017 (r322168) @@ -57,7 +57,7 @@ _LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cur # define REGISTER_KIND Registers_arm #elif defined(__or1k__) # define REGISTER_KIND Registers_or1k -#elif defined(__riscv__) +#elif defined(__riscv) # define REGISTER_KIND Registers_riscv #elif defined(__mips__) # warning The MIPS architecture is not supported. Modified: head/contrib/netbsd-tests/lib/libc/gen/t_dir.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_dir.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/netbsd-tests/lib/libc/gen/t_dir.c Mon Aug 7 14:09:57 2017 (r322168) @@ -135,7 +135,7 @@ ATF_TC_BODY(seekdir_basic, tc) } /* There is no sbrk on AArch64 and RISC-V */ -#if !defined(__aarch64__) && !defined(__riscv__) +#if !defined(__aarch64__) && !defined(__riscv) ATF_TC(telldir_leak); ATF_TC_HEAD(telldir_leak, tc) { @@ -185,7 +185,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, seekdir_basic); -#if !defined(__aarch64__) && !defined(__riscv__) +#if !defined(__aarch64__) && !defined(__riscv) ATF_TP_ADD_TC(tp, telldir_leak); #endif Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Mon Aug 7 14:09:57 2017 (r322168) @@ -103,7 +103,7 @@ ATF_TC_BODY(mlock_err, tc) unsigned long vmin = 0; size_t len = sizeof(vmin); #endif -#if !defined(__aarch64__) && !defined(__riscv__) +#if !defined(__aarch64__) && !defined(__riscv) void *invalid_ptr; #endif int null_errno = ENOMEM; /* error expected for NULL */ @@ -155,7 +155,7 @@ ATF_TC_BODY(mlock_err, tc) ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); /* There is no sbrk on AArch64 and RISC-V */ -#if !defined(__aarch64__) && !defined(__riscv__) +#if !defined(__aarch64__) && !defined(__riscv) /* * These are permitted to fail (EINVAL) but do not on NetBSD */ Modified: head/contrib/zstd/lib/common/xxhash.c ============================================================================== --- head/contrib/zstd/lib/common/xxhash.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/zstd/lib/common/xxhash.c Mon Aug 7 14:09:57 2017 (r322168) @@ -206,7 +206,7 @@ static U64 XXH_read64(const void* memPtr) #if defined(_MSC_VER) /* Visual Studio */ # define XXH_swap32 _byteswap_ulong # define XXH_swap64 _byteswap_uint64 -#elif (GCC_VERSION >= 403 && !defined(__riscv__)) +#elif (GCC_VERSION >= 403 && !defined(__riscv)) # define XXH_swap32 __builtin_bswap32 # define XXH_swap64 __builtin_bswap64 #else Modified: head/lib/libc/gen/tls.c ============================================================================== --- head/lib/libc/gen/tls.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/lib/libc/gen/tls.c Mon Aug 7 14:09:57 2017 (r322168) @@ -66,7 +66,7 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t #if defined(__amd64__) #define TLS_TCB_ALIGN 16 #elif defined(__aarch64__) || defined(__arm__) || defined(__i386__) || \ - defined(__mips__) || defined(__powerpc__) || defined(__riscv__) || \ + defined(__mips__) || defined(__powerpc__) || defined(__riscv) || \ defined(__sparc64__) #define TLS_TCB_ALIGN sizeof(void *) #else @@ -74,7 +74,7 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t #endif #if defined(__aarch64__) || defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__riscv__) + defined(__powerpc__) || defined(__riscv) #define TLS_VARIANT_I #endif #if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) Modified: head/lib/libproc/proc_bkpt.c ============================================================================== --- head/lib/libproc/proc_bkpt.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/lib/libproc/proc_bkpt.c Mon Aug 7 14:09:57 2017 (r322168) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); #elif defined(__powerpc__) #define BREAKPOINT_INSTR 0x7fe00008 /* trap */ #define BREAKPOINT_INSTR_SZ 4 -#elif defined(__riscv__) +#elif defined(__riscv) #define BREAKPOINT_INSTR 0x00100073 /* sbreak */ #define BREAKPOINT_INSTR_SZ 4 #else Modified: head/lib/libproc/proc_regs.c ============================================================================== --- head/lib/libproc/proc_regs.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/lib/libproc/proc_regs.c Mon Aug 7 14:09:57 2017 (r322168) @@ -67,7 +67,7 @@ proc_regget(struct proc_handle *phdl, proc_reg_t reg, *regvalue = regs.r_regs[PC]; #elif defined(__powerpc__) *regvalue = regs.pc; -#elif defined(__riscv__) +#elif defined(__riscv) *regvalue = regs.sepc; #endif break; @@ -84,7 +84,7 @@ proc_regget(struct proc_handle *phdl, proc_reg_t reg, *regvalue = regs.r_regs[SP]; #elif defined(__powerpc__) *regvalue = regs.fixreg[1]; -#elif defined(__riscv__) +#elif defined(__riscv) *regvalue = regs.sp; #endif break; @@ -122,7 +122,7 @@ proc_regset(struct proc_handle *phdl, proc_reg_t reg, regs.r_regs[PC] = regvalue; #elif defined(__powerpc__) regs.pc = regvalue; -#elif defined(__riscv__) +#elif defined(__riscv) regs.sepc = regvalue; #endif break; @@ -139,7 +139,7 @@ proc_regset(struct proc_handle *phdl, proc_reg_t reg, regs.r_regs[PC] = regvalue; #elif defined(__powerpc__) regs.fixreg[1] = regvalue; -#elif defined(__riscv__) +#elif defined(__riscv) regs.sp = regvalue; #endif break; Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/libexec/rtld-elf/rtld.c Mon Aug 7 14:09:57 2017 (r322168) @@ -4662,7 +4662,7 @@ tls_get_addr_common(Elf_Addr **dtvp, int index, size_t } #if defined(__aarch64__) || defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__riscv__) + defined(__powerpc__) || defined(__riscv) /* * Allocate Static TLS using the Variant I method. Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Mon Aug 7 14:04:19 2017 (r322167) +++ head/share/man/man7/arch.7 Mon Aug 7 14:09:57 2017 (r322168) @@ -337,8 +337,8 @@ Architecture-specific macros: .It powerpc Ta Dv __powerpc__ .It powerpcspe Ta Dv __powerpc__, Dv __SPE__ .It powerpc64 Ta Dv __powerpc__, Dv __powerpc64__ -.It riscv64 Ta Dv __riscv__, Dv __riscv64 -.It riscv64sf Ta Dv __riscv__, Dv __riscv64 +.It riscv64 Ta Dv __riscv, Dv __riscv_xlen == 64 +.It riscv64sf Ta Dv __riscv, Dv __riscv_xlen == 64 .It sparc64 Ta Dv __sparc64__ .El .Sh SEE ALSO Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/atomic.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Mon Aug 7 14:09:57 2017 (r322168) @@ -51,7 +51,7 @@ extern uint8_t atomic_or_8_nv(volatile uint8_t *target extern void membar_producer(void); #if defined(__sparc64__) || defined(__powerpc__) || defined(__arm__) || \ - defined(__mips__) || defined(__aarch64__) || defined(__riscv__) + defined(__mips__) || defined(__aarch64__) || defined(__riscv) extern void atomic_or_8(volatile uint8_t *target, uint8_t value); #else static __inline void Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Mon Aug 7 14:09:57 2017 (r322168) @@ -12120,7 +12120,7 @@ err: *factor = 1; #if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ - defined(__mips__) || defined(__powerpc__) || defined(__riscv__) + defined(__mips__) || defined(__powerpc__) || defined(__riscv) /* * FreeBSD isn't good at limiting the amount of memory we * ask to malloc, so let's place a limit here before trying Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Aug 7 14:09:57 2017 (r322168) @@ -2492,7 +2492,7 @@ extern void dtrace_helpers_destroy(proc_t *); #define DTRACE_INVOP_SD 1 #define DTRACE_INVOP_LD 2 -#elif defined(__riscv__) +#elif defined(__riscv) #define SD_RA_SP_MASK 0x01fff07f #define SD_RA_SP 0x00113023 Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Mon Aug 7 14:09:57 2017 (r322168) @@ -388,7 +388,7 @@ extern "C" { #define _DONT_USE_1275_GENERIC_NAMES #define _HAVE_CPUID_INSN -#elif defined(__riscv__) +#elif defined(__riscv) /* * Define the appropriate "processor characteristics" Modified: head/sys/cddl/dev/profile/profile.c ============================================================================== --- head/sys/cddl/dev/profile/profile.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/cddl/dev/profile/profile.c Mon Aug 7 14:09:57 2017 (r322168) @@ -143,7 +143,7 @@ struct profile_probe_percpu; #define PROF_ARTIFICIAL_FRAMES 10 #endif -#ifdef __riscv__ +#ifdef __riscv /* TODO: verify */ #define PROF_ARTIFICIAL_FRAMES 10 #endif Modified: head/sys/compat/linuxkpi/common/src/linux_page.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_page.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/compat/linuxkpi/common/src/linux_page.c Mon Aug 7 14:09:57 2017 (r322168) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__amd64__) || defined(__aarch64__) || defined(__riscv__) +#if defined(__amd64__) || defined(__aarch64__) || defined(__riscv) #define LINUXKPI_HAVE_DMAP #else #undef LINUXKPI_HAVE_DMAP Modified: head/sys/dev/sym/sym_hipd.c ============================================================================== --- head/sys/dev/sym/sym_hipd.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/dev/sym/sym_hipd.c Mon Aug 7 14:09:57 2017 (r322168) @@ -138,7 +138,7 @@ typedef u_int32_t u32; #define MEMORY_BARRIER() dmb() #elif defined __aarch64__ #define MEMORY_BARRIER() dmb(sy) -#elif defined __riscv__ +#elif defined __riscv #define MEMORY_BARRIER() fence() #else #error "Not supported platform" Modified: head/sys/kern/subr_devmap.c ============================================================================== --- head/sys/kern/subr_devmap.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/kern/subr_devmap.c Mon Aug 7 14:09:57 2017 (r322168) @@ -53,7 +53,7 @@ static struct devmap_entry akva_devmap_entries[AKVA_DE static u_int akva_devmap_idx; static vm_offset_t akva_devmap_vaddr = DEVMAP_MAX_VADDR; -#if defined(__aarch64__) || defined(__riscv__) +#if defined(__aarch64__) || defined(__riscv) extern int early_boot; #endif @@ -197,7 +197,7 @@ devmap_bootstrap(vm_offset_t l1pt, const struct devmap pmap_map_chunk(l1pt, pd->pd_va, pd->pd_pa, pd->pd_size, VM_PROT_READ | VM_PROT_WRITE, PTE_DEVICE); #endif -#elif defined(__aarch64__) || defined(__riscv__) +#elif defined(__aarch64__) || defined(__riscv) pmap_kenter_device(pd->pd_va, pd->pd_size, pd->pd_pa); #endif } @@ -270,7 +270,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size) pa = trunc_page(pa); size = round_page(size + offset); -#if defined(__aarch64__) || defined(__riscv__) +#if defined(__aarch64__) || defined(__riscv) if (early_boot) { akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - size); va = akva_devmap_vaddr; Modified: head/sys/modules/dtrace/dtraceall/dtraceall.c ============================================================================== --- head/sys/modules/dtrace/dtraceall/dtraceall.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/modules/dtrace/dtraceall/dtraceall.c Mon Aug 7 14:09:57 2017 (r322168) @@ -70,7 +70,7 @@ MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, 1); MODULE_DEPEND(dtraceall, dtnfscl, 1, 1, 1); #endif #if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ - defined(__i386__) || defined(__powerpc__) || defined(__riscv__) + defined(__i386__) || defined(__powerpc__) || defined(__riscv) MODULE_DEPEND(dtraceall, fbt, 1, 1, 1); #endif #if defined(__amd64__) || defined(__i386__) Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/sys/cdefs.h Mon Aug 7 14:09:57 2017 (r322168) @@ -782,7 +782,7 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ -#if defined(__mips) || defined(__powerpc64__) || defined(__riscv__) +#if defined(__mips) || defined(__powerpc64__) || defined(__riscv) #define __NO_TLS 1 #endif Modified: head/usr.bin/ldd/ldd.c ============================================================================== --- head/usr.bin/ldd/ldd.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/usr.bin/ldd/ldd.c Mon Aug 7 14:09:57 2017 (r322168) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" /* We don't support a.out executables on arm64 and riscv */ -#if !defined(__aarch64__) && !defined(__riscv__) +#if !defined(__aarch64__) && !defined(__riscv) #include #define AOUT_SUPPORTED #endif Modified: head/usr.bin/xlint/lint1/param.h ============================================================================== --- head/usr.bin/xlint/lint1/param.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/usr.bin/xlint/lint1/param.h Mon Aug 7 14:09:57 2017 (r322168) @@ -80,7 +80,7 @@ #elif __powerpc__ #define PTRDIFF_IS_LONG 0 #define SIZEOF_IS_ULONG 0 -#elif __riscv__ +#elif __riscv #define PTRDIFF_IS_LONG 1 #define SIZEOF_IS_ULONG 1 #elif __sparc__ From owner-svn-src-head@freebsd.org Mon Aug 7 14:34:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BC70DD6D4F; Mon, 7 Aug 2017 14:34:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07E516E9F4; Mon, 7 Aug 2017 14:34:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77EY6Wf036369; Mon, 7 Aug 2017 14:34:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77EY516036367; Mon, 7 Aug 2017 14:34:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708071434.v77EY516036367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 7 Aug 2017 14:34:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322169 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 322169 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 14:34:07 -0000 Author: mav Date: Mon Aug 7 14:34:05 2017 New Revision: 322169 URL: https://svnweb.freebsd.org/changeset/base/322169 Log: Fix hrtimer_active() in case of cancellation. While there, switch to FreeBSD internal callout active status. Reviewed by: markj, hselasky Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D11900 Modified: head/sys/compat/linuxkpi/common/include/linux/hrtimer.h head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Modified: head/sys/compat/linuxkpi/common/include/linux/hrtimer.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/hrtimer.h Mon Aug 7 14:09:57 2017 (r322168) +++ head/sys/compat/linuxkpi/common/include/linux/hrtimer.h Mon Aug 7 14:34:05 2017 (r322169) @@ -48,7 +48,6 @@ struct hrtimer { enum hrtimer_restart (*function)(struct hrtimer *); struct mtx mtx; struct callout callout; - uint32_t flags; }; #define hrtimer_active(hrtimer) linux_hrtimer_active(hrtimer) Modified: head/sys/compat/linuxkpi/common/src/linux_hrtimer.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Mon Aug 7 14:09:57 2017 (r322168) +++ head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Mon Aug 7 14:34:05 2017 (r322169) @@ -37,9 +37,6 @@ __FBSDID("$FreeBSD$"); #include -/* hrtimer flags */ -#define HRTIMER_ACTIVE 0x01 - static void hrtimer_call_handler(void *arg) { @@ -49,7 +46,7 @@ hrtimer_call_handler(void *arg) hrtimer = arg; ret = hrtimer->function(hrtimer); MPASS(ret == HRTIMER_NORESTART); - hrtimer->flags &= ~HRTIMER_ACTIVE; + callout_deactivate(&hrtimer->callout); } bool @@ -58,19 +55,20 @@ linux_hrtimer_active(struct hrtimer *hrtimer) bool ret; mtx_lock(&hrtimer->mtx); - ret = (hrtimer->flags & HRTIMER_ACTIVE) != 0; + ret = callout_active(&hrtimer->callout); mtx_unlock(&hrtimer->mtx); return (ret); } +/* + * Cancel active hrtimer. + * Return 1 if timer was active and cancellation succeeded, or 0 otherwise. + */ int linux_hrtimer_cancel(struct hrtimer *hrtimer) { - if (!hrtimer_active(hrtimer)) - return (0); - (void)callout_drain(&hrtimer->callout); - return (1); + return (callout_drain(&hrtimer->callout) > 0); } void @@ -78,7 +76,6 @@ linux_hrtimer_init(struct hrtimer *hrtimer) { hrtimer->function = NULL; - hrtimer->flags = 0; mtx_init(&hrtimer->mtx, "hrtimer", NULL, MTX_DEF | MTX_RECURSE); callout_init_mtx(&hrtimer->callout, &hrtimer->mtx, 0); } @@ -103,6 +100,5 @@ linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, mtx_lock(&hrtimer->mtx); callout_reset_sbt(&hrtimer->callout, nstosbt(time.tv64), nstosbt(nsec), hrtimer_call_handler, hrtimer, 0); - hrtimer->flags |= HRTIMER_ACTIVE; mtx_unlock(&hrtimer->mtx); } From owner-svn-src-head@freebsd.org Mon Aug 7 16:23:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2A3CDB44CB; Mon, 7 Aug 2017 16:23:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D4E872EA1; Mon, 7 Aug 2017 16:23:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77GNrq6081023; Mon, 7 Aug 2017 16:23:53 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77GNrFZ081021; Mon, 7 Aug 2017 16:23:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708071623.v77GNrFZ081021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 7 Aug 2017 16:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322170 - head X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322170 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 16:23:54 -0000 Author: dim Date: Mon Aug 7 16:23:53 2017 New Revision: 322170 URL: https://svnweb.freebsd.org/changeset/base/322170 Log: Follow-up to r321684 (Don't use libc++ when cross-building for gcc arches), and handle two more cases where libc++ includes could be incorrectly enabled, in case the host compiler is clang 5.0.0, and the target (cross) compiler is gcc 4.2.1. Noted by: bdrewery MFC after: 3 days X-MFC-With: 321684 Modified: head/Makefile.inc1 head/Makefile.libcompat Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Aug 7 14:34:05 2017 (r322169) +++ head/Makefile.inc1 Mon Aug 7 16:23:53 2017 (r322170) @@ -2742,8 +2742,7 @@ CD2CFLAGS+= -isystem ${XDDESTDIR}/usr/include -L${XDDE # combined with --sysroot. CD2CFLAGS+= -B${XDDESTDIR}/usr/lib # Force using libc++ for external GCC. -# XXX: This should be checking MK_GNUCXX == no -.if ${X_COMPILER_VERSION} >= 40800 +.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 CD2CXXFLAGS+= -isystem ${XDDESTDIR}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ .endif Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Mon Aug 7 14:34:05 2017 (r322169) +++ head/Makefile.libcompat Mon Aug 7 16:23:53 2017 (r322170) @@ -99,8 +99,7 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat # sysroot path which --sysroot does not actually do for headers. LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include # Force using libc++ for external GCC. -# XXX: This should be checking MK_GNUCXX == no -.if ${X_COMPILER_VERSION} >= 40800 && \ +.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 && \ (${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no") LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ From owner-svn-src-head@freebsd.org Mon Aug 7 17:23:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8CB9DBC6A6; Mon, 7 Aug 2017 17:23:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96B267587E; Mon, 7 Aug 2017 17:23:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77HNAZ9005306; Mon, 7 Aug 2017 17:23:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77HNAJG005305; Mon, 7 Aug 2017 17:23:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708071723.v77HNAJG005305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 7 Aug 2017 17:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322171 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322171 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 17:23:11 -0000 Author: kib Date: Mon Aug 7 17:23:10 2017 New Revision: 322171 URL: https://svnweb.freebsd.org/changeset/base/322171 Log: Explain why delayed invalidation is not required in pmap_protect() and pmap_remove_pages(). Submitted by: alc MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Aug 7 16:23:53 2017 (r322170) +++ head/sys/amd64/amd64/pmap.c Mon Aug 7 17:23:10 2017 (r322171) @@ -4085,6 +4085,26 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t PG_RW = pmap_rw_bit(pmap); anychanged = FALSE; + /* + * Although this function delays and batches the invalidation + * of stale TLB entries, it does not need to call + * pmap_delayed_invl_started() and + * pmap_delayed_invl_finished(), because it does not + * ordinarily destroy mappings. Stale TLB entries from + * protection-only changes need only be invalidated before the + * pmap lock is released, because protection-only changes do + * not destroy PV entries. Even operations that iterate over + * a physical page's PV list of mappings, like + * pmap_remove_write(), acquire the pmap lock for each + * mapping. Consequently, for protection-only changes, the + * pmap lock suffices to synchronize both page table and TLB + * updates. + * + * This function only destroys a mapping if pmap_demote_pde() + * fails. In that case, stale TLB entries are immediately + * invalidated. + */ + PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { @@ -5469,6 +5489,15 @@ pmap_page_is_mapped(vm_page_t m) * no processor is currently accessing the user address space. In * particular, a page table entry's dirty bit won't change state once * this function starts. + * + * Although this function destroys all of the pmap's managed, + * non-wired mappings, it can delay and batch the invalidation of TLB + * entries without calling pmap_delayed_invl_started() and + * pmap_delayed_invl_finished(). Because the pmap is not active on + * any other processor, none of these TLB entries will ever be used + * before their eventual invalidation. Consequently, there is no need + * for either pmap_remove_all() or pmap_remove_write() to wait for + * that eventual TLB invalidation. */ void pmap_remove_pages(pmap_t pmap) From owner-svn-src-head@freebsd.org Mon Aug 7 17:29:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F264DBCDDF; Mon, 7 Aug 2017 17:29:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5C7075E02; Mon, 7 Aug 2017 17:29:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77HTtZA005748; Mon, 7 Aug 2017 17:29:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77HTtFa005747; Mon, 7 Aug 2017 17:29:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708071729.v77HTtFa005747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 7 Aug 2017 17:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322175 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322175 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 17:29:56 -0000 Author: kib Date: Mon Aug 7 17:29:54 2017 New Revision: 322175 URL: https://svnweb.freebsd.org/changeset/base/322175 Log: Avoid DI recursion when reclaim_pv_chunk() is called from pmap_advise() or pmap_remove(). Reported and tested by: pho (previous version) Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Aug 7 17:29:48 2017 (r322174) +++ head/sys/amd64/amd64/pmap.c Mon Aug 7 17:29:54 2017 (r322175) @@ -428,8 +428,15 @@ static struct lock_object invl_gen_ts = { .lo_name = "invlts", }; +static bool +pmap_not_in_di(void) +{ + + return (curthread->td_md.md_invl_gen.gen == 0); +} + #define PMAP_ASSERT_NOT_IN_DI() \ - KASSERT(curthread->td_md.md_invl_gen.gen == 0, ("DI already started")) + KASSERT(pmap_not_in_di(), ("DI already started")) /* * Start a new Delayed Invalidation (DI) block of code, executed by @@ -2856,6 +2863,19 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG "Current number of spare pv entries"); #endif +static void +reclaim_pv_chunk_leave_pmap(pmap_t pmap, pmap_t locked_pmap, bool start_di) +{ + + if (pmap == NULL) + return; + pmap_invalidate_all(pmap); + if (pmap != locked_pmap) + PMAP_UNLOCK(pmap); + if (start_di) + pmap_delayed_invl_finished(); +} + /* * We are in a serious low memory condition. Resort to * drastic measures to free some pages so we can allocate @@ -2883,6 +2903,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l struct spglist free; uint64_t inuse; int bit, field, freed; + bool start_di; PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED); KASSERT(lockp != NULL, ("reclaim_pv_chunk: lockp is NULL")); @@ -2891,19 +2912,21 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l PG_G = PG_A = PG_M = PG_RW = 0; SLIST_INIT(&free); TAILQ_INIT(&new_tail); - pmap_delayed_invl_started(); + + /* + * A delayed invalidation block should already be active if + * pmap_advise() or pmap_remove() called this function by way + * of pmap_demote_pde_locked(). + */ + start_di = pmap_not_in_di(); + mtx_lock(&pv_chunks_mutex); while ((pc = TAILQ_FIRST(&pv_chunks)) != NULL && SLIST_EMPTY(&free)) { TAILQ_REMOVE(&pv_chunks, pc, pc_lru); mtx_unlock(&pv_chunks_mutex); if (pmap != pc->pc_pmap) { - if (pmap != NULL) { - pmap_invalidate_all(pmap); - if (pmap != locked_pmap) - PMAP_UNLOCK(pmap); - } - pmap_delayed_invl_finished(); - pmap_delayed_invl_started(); + reclaim_pv_chunk_leave_pmap(pmap, locked_pmap, + start_di); pmap = pc->pc_pmap; /* Avoid deadlock and lock recursion. */ if (pmap > locked_pmap) { @@ -2920,6 +2943,8 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l PG_A = pmap_accessed_bit(pmap); PG_M = pmap_modified_bit(pmap); PG_RW = pmap_rw_bit(pmap); + if (start_di) + pmap_delayed_invl_started(); } /* @@ -2994,12 +3019,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l } TAILQ_CONCAT(&pv_chunks, &new_tail, pc_lru); mtx_unlock(&pv_chunks_mutex); - if (pmap != NULL) { - pmap_invalidate_all(pmap); - if (pmap != locked_pmap) - PMAP_UNLOCK(pmap); - } - pmap_delayed_invl_finished(); + reclaim_pv_chunk_leave_pmap(pmap, locked_pmap, start_di); if (m_pc == NULL && !SLIST_EMPTY(&free)) { m_pc = SLIST_FIRST(&free); SLIST_REMOVE_HEAD(&free, plinks.s.ss); From owner-svn-src-head@freebsd.org Mon Aug 7 18:01:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C21EDBEB97; Mon, 7 Aug 2017 18:01:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E47A775A3; Mon, 7 Aug 2017 18:01:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77I1SbA020916; Mon, 7 Aug 2017 18:01:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77I1SIG020914; Mon, 7 Aug 2017 18:01:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708071801.v77I1SIG020914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 7 Aug 2017 18:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322177 - head/usr.bin/indent X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/indent X-SVN-Commit-Revision: 322177 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 18:01:29 -0000 Author: kevans Date: Mon Aug 7 18:01:27 2017 New Revision: 322177 URL: https://svnweb.freebsd.org/changeset/base/322177 Log: Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1) Instead of using a non-configurable ".BAK" suffix, respect the SIMPLE_BACKUP_SUFFIX environment variable also used by patch(1). This simplifies cleanup operations in some patch/indent workflows. Reviewed by: cem (earlier version), emaste, pstef Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D10921 Modified: head/usr.bin/indent/indent.1 head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.1 ============================================================================== --- head/usr.bin/indent/indent.1 Mon Aug 7 17:30:22 2017 (r322176) +++ head/usr.bin/indent/indent.1 Mon Aug 7 18:01:27 2017 (r322177) @@ -30,7 +30,7 @@ .\" @(#)indent.1 8.1 (Berkeley) 7/1/93 .\" $FreeBSD$ .\" -.Dd July 25, 2017 +.Dd August 7, 2017 .Dt INDENT 1 .Os .Sh NAME @@ -119,7 +119,10 @@ If is named .Sq Pa /blah/blah/file , the backup file is named -.Sq Pa file.BAK . +.Sq Pa file.BAK +by default. The extension used for the backup file may be overridden using the +.Ev SIMPLE_BACKUP_SUFFIX +environment variable. .Pp If .Ar output-file Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Mon Aug 7 17:30:22 2017 (r322176) +++ head/usr.bin/indent/indent.c Mon Aug 7 18:01:27 2017 (r322177) @@ -71,6 +71,8 @@ const char *in_name = "Standard Input"; /* will always * file */ const char *out_name = "Standard Output"; /* will always point to name * of output file */ +const char *simple_backup_suffix = ".BAK"; /* Suffix to use for backup + * files */ char bakfile[MAXPATHLEN] = ""; int @@ -99,8 +101,8 @@ main(int argc, char **argv) int last_else = 0; /* true iff last keyword was an else */ const char *profile_name = NULL; + const char *envval = NULL; - /*-----------------------------------------------*\ | INITIALIZATION | \*-----------------------------------------------*/ @@ -160,6 +162,10 @@ main(int argc, char **argv) output = NULL; tabs_to_var = 0; + envval = getenv("SIMPLE_BACKUP_SUFFIX"); + if (envval) + simple_backup_suffix = envval; + /*--------------------------------------------------*\ | COMMAND LINE SCAN | \*--------------------------------------------------*/ @@ -1234,7 +1240,7 @@ bakcopy(void) p--; if (*p == '/') p++; - sprintf(bakfile, "%s.BAK", p); + sprintf(bakfile, "%s%s", p, simple_backup_suffix); /* copy in_name to backup file */ bakchn = creat(bakfile, 0600); From owner-svn-src-head@freebsd.org Mon Aug 7 19:18:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAF21DC2B80; Mon, 7 Aug 2017 19:18:28 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C63F27E81C; Mon, 7 Aug 2017 19:18:28 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77JIShs052317; Mon, 7 Aug 2017 19:18:28 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JISXB052316; Mon, 7 Aug 2017 19:18:28 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708071918.v77JISXB052316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 7 Aug 2017 19:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322178 - head/sys/geom/journal X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/geom/journal X-SVN-Commit-Revision: 322178 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 19:18:29 -0000 Author: mckusick Date: Mon Aug 7 19:18:27 2017 New Revision: 322178 URL: https://svnweb.freebsd.org/changeset/base/322178 Log: sysctl kern.geom.journal.cache.limit shows negative value for FreeBSD/amd64 system having over 4GB RAM. That's due to: 1) the limit being u_int instead of u_long like vm.kmem_size (the limit is half of vm.kmem_size by default for amd64); 2) sysctl handler g_journal_cache_limit_sysctl() using u_int instead of u_long. The fix is to replace u_int with u_long for the kern.geom.journal.cache.limit sysctl variable. PR: 198500 Submitted by: Dr. Andreas Longwitz Reported by: Eugene Grosbein Discussed with: kib MFC after: 1 week Modified: head/sys/geom/journal/g_journal.c Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Mon Aug 7 18:01:27 2017 (r322177) +++ head/sys/geom/journal/g_journal.c Mon Aug 7 19:18:27 2017 (r322178) @@ -130,26 +130,26 @@ SYSCTL_PROC(_kern_geom_journal, OID_AUTO, record_entri SYSCTL_UINT(_kern_geom_journal, OID_AUTO, optimize, CTLFLAG_RW, &g_journal_do_optimize, 0, "Try to combine bios on flush and copy"); -static u_int g_journal_cache_used = 0; -static u_int g_journal_cache_limit = 64 * 1024 * 1024; +static u_long g_journal_cache_used = 0; +static u_long g_journal_cache_limit = 64 * 1024 * 1024; static u_int g_journal_cache_divisor = 2; static u_int g_journal_cache_switch = 90; static u_int g_journal_cache_misses = 0; static u_int g_journal_cache_alloc_failures = 0; -static u_int g_journal_cache_low = 0; +static u_long g_journal_cache_low = 0; static SYSCTL_NODE(_kern_geom_journal, OID_AUTO, cache, CTLFLAG_RW, 0, "GEOM_JOURNAL cache"); -SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, used, CTLFLAG_RD, +SYSCTL_ULONG(_kern_geom_journal_cache, OID_AUTO, used, CTLFLAG_RD, &g_journal_cache_used, 0, "Number of allocated bytes"); static int g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS) { - u_int limit; + u_long limit; int error; limit = g_journal_cache_limit; - error = sysctl_handle_int(oidp, &limit, 0, req); + error = sysctl_handle_long(oidp, &limit, 0, req); if (error != 0 || req->newptr == NULL) return (error); g_journal_cache_limit = limit; @@ -157,7 +157,7 @@ g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS) return (0); } SYSCTL_PROC(_kern_geom_journal_cache, OID_AUTO, limit, - CTLTYPE_UINT | CTLFLAG_RWTUN, NULL, 0, g_journal_cache_limit_sysctl, "I", + CTLTYPE_ULONG | CTLFLAG_RWTUN, NULL, 0, g_journal_cache_limit_sysctl, "I", "Maximum number of allocated bytes"); SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, divisor, CTLFLAG_RDTUN, &g_journal_cache_divisor, 0, @@ -3046,9 +3046,9 @@ g_journal_switcher(void *arg) kproc_exit(0); } if (error == 0 && g_journal_sync_requested == 0) { - GJ_DEBUG(1, "Out of cache, force switch (used=%u " - "limit=%u).", g_journal_cache_used, - g_journal_cache_limit); + GJ_DEBUG(1, "Out of cache, force switch (used=%jd " + "limit=%jd).", (intmax_t)g_journal_cache_used, + (intmax_t)g_journal_cache_limit); } GJ_TIMER_START(1, &bt); g_journal_do_switch(mp); From owner-svn-src-head@freebsd.org Mon Aug 7 19:40:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62395DC4070; Mon, 7 Aug 2017 19:40:04 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 315BD7F332; Mon, 7 Aug 2017 19:40:04 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77Je3Kl060493; Mon, 7 Aug 2017 19:40:03 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77Je3g3060491; Mon, 7 Aug 2017 19:40:03 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708071940.v77Je3g3060491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 7 Aug 2017 19:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322179 - head/sys/geom/journal X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/geom/journal X-SVN-Commit-Revision: 322179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 19:40:04 -0000 Author: mckusick Date: Mon Aug 7 19:40:03 2017 New Revision: 322179 URL: https://svnweb.freebsd.org/changeset/base/322179 Log: gjournal is broken in handling its flush_queue. If we have 10 bio's in the flush_queue: 1 2 3 4 5 6 7 8 9 10 and another 10 bio's go into the flush queue after only the first five bio's are removed from the flush queue, the queue should look like: 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20, but because of the bug we end up with 6 11 12 13 14 15 16 17 18 19 20 7 8 9 10. So the sequence of the bio's is damaged in the flush queue (and therefore in the journal on disk !). This error can be triggered by ffs_snapshot() when a block is read with readblock() and gjournal finds this block in the broken flush queue before it goes to the correct active queue. The fix is to place all new blocks at the end of the queue. Submitted by: Dr. Andreas Longwitz Discussed with: kib MFC after: 1 week Modified: head/sys/geom/journal/g_journal.c head/sys/geom/journal/g_journal.h Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Mon Aug 7 19:18:27 2017 (r322178) +++ head/sys/geom/journal/g_journal.c Mon Aug 7 19:40:03 2017 (r322179) @@ -1261,7 +1261,7 @@ g_journal_flush(struct g_journal_softc *sc) strlcpy(hdr.jrh_magic, GJ_RECORD_HEADER_MAGIC, sizeof(hdr.jrh_magic)); bioq = &sc->sc_active.jj_queue; - pbp = sc->sc_flush_queue; + GJQ_LAST(sc->sc_flush_queue, pbp); fbp = g_alloc_bio(); fbp->bio_parent = NULL; Modified: head/sys/geom/journal/g_journal.h ============================================================================== --- head/sys/geom/journal/g_journal.h Mon Aug 7 19:18:27 2017 (r322178) +++ head/sys/geom/journal/g_journal.h Mon Aug 7 19:40:03 2017 (r322179) @@ -182,6 +182,17 @@ struct g_journal_softc { (pbp)->bio_next = (bp); \ } \ } while (0) +#define GJQ_LAST(head, bp) do { \ + struct bio *_bp; \ + \ + if ((head) == NULL) { \ + (bp) = (head); \ + break; \ + } \ + for (_bp = (head); _bp->bio_next != NULL; _bp = _bp->bio_next) \ + continue; \ + (bp) = (_bp); \ +} while (0) #define GJQ_FIRST(head) (head) #define GJQ_REMOVE(head, bp) do { \ struct bio *_bp; \ From owner-svn-src-head@freebsd.org Mon Aug 7 21:12:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB6CDDC8FBE; Mon, 7 Aug 2017 21:12:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 843FD83111; Mon, 7 Aug 2017 21:12:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77LCSIK001385; Mon, 7 Aug 2017 21:12:28 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LCSxL001381; Mon, 7 Aug 2017 21:12:28 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708072112.v77LCSxL001381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 7 Aug 2017 21:12:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322196 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 322196 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:12:29 -0000 Author: imp Date: Mon Aug 7 21:12:28 2017 New Revision: 322196 URL: https://svnweb.freebsd.org/changeset/base/322196 Log: Add aliasing concept to geom. Add an alias name list to geoms. Use them in geom_dev to create aliases. Previously, geom_dev would create an device node for the name of the geom. Now, additional nodes are created pointing back to the primary node with make_dev_alias_p. Aliases must be in place on the geom before any tasting occurs. Differential Revision: https://reviews.freebsd.org/D11873 Modified: head/sys/geom/geom.h head/sys/geom/geom_dev.c head/sys/geom/geom_dump.c head/sys/geom/geom_subr.c Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Mon Aug 7 19:56:09 2017 (r322195) +++ head/sys/geom/geom.h Mon Aug 7 21:12:28 2017 (r322196) @@ -120,6 +120,15 @@ struct g_class { LIST_HEAD(,g_geom) geom; }; +/* + * The g_geom_alias is a list node for aliases for the geom name + * for device node creation. + */ +struct g_geom_alias { + LIST_ENTRY(g_geom_alias) ga_next; + const char *ga_alias; +}; + #define G_VERSION_00 0x19950323 #define G_VERSION_01 0x20041207 /* add fflag to g_ioctl_t */ #define G_VERSION G_VERSION_01 @@ -150,6 +159,7 @@ struct g_geom { unsigned flags; #define G_GEOM_WITHER 1 #define G_GEOM_VOLATILE_BIO 2 + LIST_HEAD(,g_geom_alias) aliases; }; /* @@ -269,6 +279,7 @@ void g_destroy_provider(struct g_provider *pp); void g_detach(struct g_consumer *cp); void g_error_provider(struct g_provider *pp, int error); struct g_provider *g_provider_by_name(char const *arg); +void g_geom_add_alias(struct g_geom *gp, const char *alias); int g_getattr__(const char *attr, struct g_consumer *cp, void *var, int len); #define g_getattr(a, c, v) g_getattr__((a), (c), (v), sizeof *(v)) int g_handleattr(struct bio *bp, const char *attribute, const void *val, Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Mon Aug 7 19:56:09 2017 (r322195) +++ head/sys/geom/geom_dev.c Mon Aug 7 21:12:28 2017 (r322196) @@ -315,10 +315,11 @@ static struct g_geom * g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) { struct g_geom *gp; + struct g_geom_alias *gap; struct g_consumer *cp; struct g_dev_softc *sc; int error; - struct cdev *dev; + struct cdev *dev, *adev; char buf[SPECNAMELEN + 6]; g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name); @@ -357,6 +358,23 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, g_dev_attrchanged(cp, "GEOM::physpath"); snprintf(buf, sizeof(buf), "cdev=%s", gp->name); devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK); + /* + * Now add all the aliases for this drive + */ + LIST_FOREACH(gap, &pp->geom->aliases, ga_next) { + error = make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &adev, dev, + "%s", gap->ga_alias); + if (error) { + printf("%s: make_dev_alias_p() failed (name=%s, error=%d)\n", + __func__, gap->ga_alias, error); + continue; + } + adev->si_flags |= SI_UNMAPPED; + adev->si_iosize_max = dev->si_iosize_max; + adev->si_drv2 = dev->si_drv2; + snprintf(buf, sizeof(buf), "cdev=%s", gap->ga_alias); + devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK); + } return (gp); } Modified: head/sys/geom/geom_dump.c ============================================================================== --- head/sys/geom/geom_dump.c Mon Aug 7 19:56:09 2017 (r322195) +++ head/sys/geom/geom_dump.c Mon Aug 7 21:12:28 2017 (r322196) @@ -234,6 +234,7 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct { struct g_consumer *cp2; struct g_provider *pp2; + struct g_geom_alias *gap; sbuf_printf(sb, " \n", gp); sbuf_printf(sb, " \n", gp->class); @@ -258,6 +259,11 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct if (pp != NULL && pp != pp2) continue; g_conf_provider(sb, pp2); + } + LIST_FOREACH(gap, &gp->aliases, ga_next) { + sbuf_printf(sb, " \n"); + g_conf_printf_escaped(sb, "%s", gap->ga_alias); + sbuf_printf(sb, " \n"); } sbuf_printf(sb, " \n"); } Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Mon Aug 7 19:56:09 2017 (r322195) +++ head/sys/geom/geom_subr.c Mon Aug 7 21:12:28 2017 (r322196) @@ -347,6 +347,7 @@ g_new_geomf(struct g_class *mp, const char *fmt, ...) gp->rank = 1; LIST_INIT(&gp->consumer); LIST_INIT(&gp->provider); + LIST_INIT(&gp->aliases); LIST_INSERT_HEAD(&mp->geom, gp, geom); TAILQ_INSERT_HEAD(&geoms, gp, geoms); strcpy(gp->name, sbuf_data(sb)); @@ -367,6 +368,7 @@ g_new_geomf(struct g_class *mp, const char *fmt, ...) void g_destroy_geom(struct g_geom *gp) { + struct g_geom_alias *gap, *gaptmp; g_topology_assert(); G_VALID_GEOM(gp); @@ -380,6 +382,8 @@ g_destroy_geom(struct g_geom *gp) g_cancel_event(gp); LIST_REMOVE(gp, geom); TAILQ_REMOVE(&geoms, gp, geoms); + LIST_FOREACH_SAFE(gap, &gp->aliases, ga_next, gaptmp) + g_free(gap); g_free(gp->name); g_free(gp); } @@ -1210,6 +1214,18 @@ g_compare_names(const char *namea, const char *nameb) if (strcmp(namea + deva, nameb + devb) == 0) return (1); return (0); +} + +void +g_geom_add_alias(struct g_geom *gp, const char *alias) +{ + struct g_geom_alias *gap; + + gap = (struct g_geom_alias *)g_malloc( + sizeof(struct g_geom_alias) + strlen(alias) + 1, M_WAITOK); + strcpy((char *)(gap + 1), alias); + gap->ga_alias = (const char *)(gap + 1); + LIST_INSERT_HEAD(&gp->aliases, gap, ga_next); } #if defined(DIAGNOSTIC) || defined(DDB) From owner-svn-src-head@freebsd.org Mon Aug 7 21:12:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B534BDC8FDA; Mon, 7 Aug 2017 21:12:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7876C83126; Mon, 7 Aug 2017 21:12:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77LCXof001438; Mon, 7 Aug 2017 21:12:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LCXcH001437; Mon, 7 Aug 2017 21:12:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708072112.v77LCXcH001437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 7 Aug 2017 21:12:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322197 - head/sys/geom/part X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/geom/part X-SVN-Commit-Revision: 322197 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:12:34 -0000 Author: imp Date: Mon Aug 7 21:12:33 2017 New Revision: 322197 URL: https://svnweb.freebsd.org/changeset/base/322197 Log: Add alias support to gpart. When we're creating new providers for each of the partitions, add aliases to the geom before we create the provider so when geom_dev tastes the provider, the aliases are in place so the proper /dev entries are created. So foo5p6 gets created as an alias for bar5p6 when foo is an alias for bar in the geom we're partitioning with g_part. This also copies aliases from the container geom (eg disk) to the label geom (the disk with GPT partitioning) so that aliases nest properly. Differential Revision: https://reviews.freebsd.org/D11873 Modified: head/sys/geom/part/g_part.c Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Mon Aug 7 21:12:28 2017 (r322196) +++ head/sys/geom/part/g_part.c Mon Aug 7 21:12:33 2017 (r322197) @@ -429,6 +429,7 @@ g_part_new_provider(struct g_geom *gp, struct g_part_t struct g_consumer *cp; struct g_provider *pp; struct sbuf *sb; + struct g_geom_alias *gap; off_t offset; cp = LIST_FIRST(&gp->consumer); @@ -439,6 +440,19 @@ g_part_new_provider(struct g_geom *gp, struct g_part_t entry->gpe_offset = offset; if (entry->gpe_pp == NULL) { + /* + * Add aliases to the geom before we create the provider so that + * geom_dev can taste it with all the aliases in place so all + * the aliased dev_t instances get created for each partition + * (eg foo5p7 gets created for bar5p7 when foo is an alias of bar). + */ + LIST_FOREACH(gap, &table->gpt_gp->aliases, ga_next) { + sb = sbuf_new_auto(); + G_PART_FULLNAME(table, entry, sb, gap->ga_alias); + sbuf_finish(sb); + g_geom_add_alias(gp, sbuf_data(sb)); + sbuf_delete(sb); + } sb = sbuf_new_auto(); G_PART_FULLNAME(table, entry, sb, gp->name); sbuf_finish(sb); @@ -1901,6 +1915,7 @@ g_part_taste(struct g_class *mp, struct g_provider *pp struct g_part_entry *entry; struct g_part_table *table; struct root_hold_token *rht; + struct g_geom_alias *gap; int attr, depth; int error; @@ -1913,10 +1928,12 @@ g_part_taste(struct g_class *mp, struct g_provider *pp /* * Create a GEOM with consumer and hook it up to the provider. - * With that we become part of the topology. Optain read access + * With that we become part of the topology. Obtain read access * to the provider. */ gp = g_new_geomf(mp, "%s", pp->name); + LIST_FOREACH(gap, &pp->geom->aliases, ga_next) + g_geom_add_alias(gp, gap->ga_alias); cp = g_new_consumer(gp); cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); From owner-svn-src-head@freebsd.org Mon Aug 7 21:12:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CEBFDC9022; Mon, 7 Aug 2017 21:12:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAD2083196; Mon, 7 Aug 2017 21:12:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77LCdEt001492; Mon, 7 Aug 2017 21:12:39 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LCcXm001489; Mon, 7 Aug 2017 21:12:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708072112.v77LCcXm001489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 7 Aug 2017 21:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322198 - in head: share/man/man9 sys/geom X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: share/man/man9 sys/geom X-SVN-Commit-Revision: 322198 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:12:40 -0000 Author: imp Date: Mon Aug 7 21:12:38 2017 New Revision: 322198 URL: https://svnweb.freebsd.org/changeset/base/322198 Log: Expose API to allow disks to ask for alias names in devfs. Implement disk_add_alias to allow aliases to be added to disks. All disk have a primary name (say "foo") can also have secondary names (say "bar") such that all instances of "foo" also have a "bar" alias. So if you have foo0, foo0p1, foo1, foo1s1 and foo1s1a nodes created by the foo driver and gpart, device nodes bar0, bar0p1, bar1, bar1s1 and bar1s1a will appear as symlinks back to the original nodes. This generalizes to multiple aliases. However, since the unit number follows the primary name, multiple device drivers can't create the same aliases unless those drives coorinate the unit number space (eg you couldn't add an alias 'disk' to both 'da' and 'ada' because it's possible to have da0 and ada0, because 'disk0' is ambiguous). Differential Revision: https://reviews.freebsd.org/D11873 Modified: head/share/man/man9/disk.9 head/sys/geom/geom_disk.c head/sys/geom/geom_disk.h Modified: head/share/man/man9/disk.9 ============================================================================== --- head/share/man/man9/disk.9 Mon Aug 7 21:12:33 2017 (r322197) +++ head/share/man/man9/disk.9 Mon Aug 7 21:12:38 2017 (r322198) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 30, 2012 +.Dd August 3, 2017 .Dt DISK 9 .Os .Sh NAME @@ -45,6 +45,8 @@ .Fn disk_destroy "struct disk *disk" .Ft int .Fn disk_resize "struct disk *disk" "int flags" +.Ft void +.Fn disk_add_alias "struct disk *disk" "const char *alias" .Sh DESCRIPTION The disk storage API permits kernel device drivers providing access to disk-like storage devices to advertise the device to other kernel @@ -69,6 +71,20 @@ function, fill in the fields and call .Fn disk_create when the device is ready to service requests. +.Fn disk_add_alias +adds an alias for the disk and must be called before +.Fn disk_create , +but may be called multiple times. +For each alias added, a device node will be created with +.Xr make_dev_alias 9 +in the same way primary device nodes are created with +.Xr make_dev 9 +for +.Va d_name +and +.Va d_unit . +Care should be taken to ensure that only one driver creates aliases +for any given name. .Fn disk_resize can be called by the driver after modifying .Va d_mediasize @@ -227,7 +243,13 @@ structure for this disk device. .El .Sh SEE ALSO .Xr GEOM 4 , -.Xr devfs 5 +.Xr devfs 5 , +.Xr MAKE_DEV 9 .Sh AUTHORS This manual page was written by .An Robert Watson . +.Sh BUGS +Disk aliases are not a general purpose aliasing mechanism, but are +intended only to ease the transition from one name to another. +They can be used to ensure that nvd0 and nda0 are the same thing. +They cannot be used to implement the diskX concept from macOS. Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Mon Aug 7 21:12:33 2017 (r322197) +++ head/sys/geom/geom_disk.c Mon Aug 7 21:12:38 2017 (r322198) @@ -676,6 +676,7 @@ g_disk_create(void *arg, int flag) struct g_provider *pp; struct disk *dp; struct g_disk_softc *sc; + struct disk_alias *dap; char tmpstr[80]; if (flag == EV_CANCEL) @@ -704,6 +705,10 @@ g_disk_create(void *arg, int flag) sc->dp = dp; gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit); gp->softc = sc; + LIST_FOREACH(dap, &dp->d_aliases, da_next) { + snprintf(tmpstr, sizeof(tmpstr), "%s%d", dap->da_alias, dp->d_unit); + g_geom_add_alias(gp, tmpstr); + } pp = g_new_providerf(gp, "%s", gp->name); devstat_remove_entry(pp->stat); pp->stat = NULL; @@ -791,6 +796,7 @@ g_disk_destroy(void *ptr, int flag) struct disk *dp; struct g_geom *gp; struct g_disk_softc *sc; + struct disk_alias *dap, *daptmp; g_topology_assert(); dp = ptr; @@ -802,6 +808,8 @@ g_disk_destroy(void *ptr, int flag) dp->d_geom = NULL; g_wither_geom(gp, ENXIO); } + LIST_FOREACH_SAFE(dap, &dp->d_aliases, da_next, daptmp) + g_free(dap); g_free(dp); } @@ -834,8 +842,11 @@ g_disk_ident_adjust(char *ident, size_t size) struct disk * disk_alloc(void) { + struct disk *dp; - return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO)); + dp = g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO); + LIST_INIT(&dp->d_aliases); + return (dp); } void @@ -882,6 +893,18 @@ disk_destroy(struct disk *dp) if (dp->d_devstat != NULL) devstat_remove_entry(dp->d_devstat); g_post_event(g_disk_destroy, dp, M_WAITOK, NULL); +} + +void +disk_add_alias(struct disk *dp, const char *name) +{ + struct disk_alias *dap; + + dap = (struct disk_alias *)g_malloc( + sizeof(struct disk_alias) + strlen(name) + 1, M_WAITOK); + strcpy((char *)(dap + 1), name); + dap->da_alias = (const char *)(dap + 1); + LIST_INSERT_HEAD(&dp->d_aliases, dap, da_next); } void Modified: head/sys/geom/geom_disk.h ============================================================================== --- head/sys/geom/geom_disk.h Mon Aug 7 21:12:33 2017 (r322197) +++ head/sys/geom/geom_disk.h Mon Aug 7 21:12:38 2017 (r322198) @@ -66,6 +66,11 @@ typedef enum { DISK_INIT_DONE } disk_init_level; +struct disk_alias { + LIST_ENTRY(disk_alias) da_next; + const char *da_alias; +}; + struct disk { /* Fields which are private to geom_disk */ struct g_geom *d_geom; @@ -109,6 +114,9 @@ struct disk { /* Fields private to the driver */ void *d_drv1; + + /* Fields private to geom_disk, to be moved on next version bump */ + LIST_HEAD(,disk_alias) d_aliases; }; #define DISKFLAG_RESERVED 0x1 /* Was NEEDSGIANT */ @@ -132,6 +140,7 @@ void disk_attr_changed(struct disk *dp, const char *at void disk_media_changed(struct disk *dp, int flag); void disk_media_gone(struct disk *dp, int flag); int disk_resize(struct disk *dp, int flag); +void disk_add_alias(struct disk *disk, const char *); #define DISK_VERSION_00 0x58561059 #define DISK_VERSION_01 0x5856105a From owner-svn-src-head@freebsd.org Mon Aug 7 21:12:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E778DC9074; Mon, 7 Aug 2017 21:12:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0DD68322F; Mon, 7 Aug 2017 21:12:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77LChjK001555; Mon, 7 Aug 2017 21:12:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LChcT001554; Mon, 7 Aug 2017 21:12:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708072112.v77LChcT001554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 7 Aug 2017 21:12:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322199 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 322199 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:12:45 -0000 Author: imp Date: Mon Aug 7 21:12:43 2017 New Revision: 322199 URL: https://svnweb.freebsd.org/changeset/base/322199 Log: Add nvd alias to nda ndoes. All ndaX and ndaXpY nodes will appear as nvdX and nvdXpY as well (through symlinks in devfs via the normal disk aliasing mechanism in GEOM). Differential Revision: https://reviews.freebsd.org/D11873 Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Mon Aug 7 21:12:38 2017 (r322198) +++ head/sys/cam/nvme/nvme_da.c Mon Aug 7 21:12:43 2017 (r322199) @@ -808,6 +808,10 @@ ndaregister(struct cam_periph *periph, void *arg) DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT | XPORT_DEVSTAT_TYPE(cpi.transport), DEVSTAT_PRIORITY_DISK); + /* + * Add alias for older nvd drives to ease transition. + */ + disk_add_alias(disk, "nvd"); /* * Acquire a reference to the periph before we register with GEOM. From owner-svn-src-head@freebsd.org Mon Aug 7 21:23:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9EBBDC99ED; Mon, 7 Aug 2017 21:23:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B454B83ACF; Mon, 7 Aug 2017 21:23:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77LNs3C005749; Mon, 7 Aug 2017 21:23:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LNsfC005748; Mon, 7 Aug 2017 21:23:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708072123.v77LNsfC005748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 7 Aug 2017 21:23:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322200 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 322200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:23:56 -0000 Author: imp Date: Mon Aug 7 21:23:54 2017 New Revision: 322200 URL: https://svnweb.freebsd.org/changeset/base/322200 Log: Make it possible to ignore superblock mismatch. This will not fix such a mismatch, but will allow fsck to continue when the last alternate superblock gets corrupted somehow. Also, remove searching for alternate super blocks. It should have been removed two years ago with r276737 by imp@. Leave minor vestiges in place in case someone wants to solve the hard problem of knowing where altnernate superblocks live without access to data formerly stored in disklabels. Differential Revision: https://reviews.freebsd.org/D11589 Modified: head/sbin/fsck_ffs/setup.c Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Mon Aug 7 21:12:43 2017 (r322199) +++ head/sbin/fsck_ffs/setup.c Mon Aug 7 21:23:54 2017 (r322200) @@ -68,10 +68,9 @@ static void badsb(int listerr, const char *s); int setup(char *dev) { - long cg, asked, i, j; + long asked, i, j; long bmapsize; struct stat statb; - struct fs proto; size_t size; havesb = 0; @@ -178,26 +177,8 @@ setup(char *dev) skipclean = 0; if (bflag || preen) return(0); - if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0) - return (0); - for (cg = 0; cg < proto.fs_ncg; cg++) { - bflag = fsbtodb(&proto, cgsblock(&proto, cg)); - if (readsb(0) != 0) - break; - } - if (cg >= proto.fs_ncg) { - printf("%s %s\n%s %s\n%s %s\n", - "SEARCH FOR ALTERNATE SUPER-BLOCK", - "FAILED. YOU MUST USE THE", - "-b OPTION TO FSCK TO SPECIFY THE", - "LOCATION OF AN ALTERNATE", - "SUPER-BLOCK TO SUPPLY NEEDED", - "INFORMATION; SEE fsck_ffs(8)."); - bflag = 0; - return(0); - } - pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag); - bflag = 0; + /* Looking for alternates is hard punt for now but retain structure */ + return (0); } if (skipclean && ckclean && sblock.fs_clean) { pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); @@ -393,9 +374,16 @@ readsb(int listerr) altsblock.fs_ipg != sblock.fs_ipg || altsblock.fs_fpg != sblock.fs_fpg || altsblock.fs_magic != sblock.fs_magic) { - badsb(listerr, - "VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE"); - return (0); + if (listerr == 0) + return (0); + if (preen) + printf("%s: ", cdevname); + printf( + "VALUES IN SUPER BLOCK LSB=%jd DISAGREE WITH THOSE IN\n" + "FIRST ALTERNATE LSB=%jd\n", + sblk.b_bno, asblk.b_bno); + if (reply("IGNORE ALTERNATE SUPER BLOCK") == 0) + return (0); } out: /* @@ -415,17 +403,6 @@ out: } havesb = 1; return (1); -} - -static void -badsb(int listerr, const char *s) -{ - - if (!listerr) - return; - if (preen) - printf("%s: ", cdevname); - pfatal("BAD SUPER BLOCK: %s\n", s); } void From owner-svn-src-head@freebsd.org Mon Aug 7 21:24:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EBF6DC9A36; Mon, 7 Aug 2017 21:24:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F02AC83B35; Mon, 7 Aug 2017 21:24:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77LO0sl005806; Mon, 7 Aug 2017 21:24:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LO0fj005805; Mon, 7 Aug 2017 21:24:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708072124.v77LO0fj005805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 7 Aug 2017 21:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322201 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 322201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:24:01 -0000 Author: imp Date: Mon Aug 7 21:23:59 2017 New Revision: 322201 URL: https://svnweb.freebsd.org/changeset/base/322201 Log: In debug mode, print the differences between the superblock and alternate superblock when the values disagree and we're going to reject it. Differential Revision: https://reviews.freebsd.org/D11589 Modified: head/sbin/fsck_ffs/setup.c Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Mon Aug 7 21:23:54 2017 (r322200) +++ head/sbin/fsck_ffs/setup.c Mon Aug 7 21:23:59 2017 (r322201) @@ -294,7 +294,7 @@ int readsb(int listerr) { ufs2_daddr_t super; - int i; + int i, bad; if (bflag) { super = bflag; @@ -344,43 +344,53 @@ readsb(int listerr) dev_bsize = sblock.fs_fsize / fsbtodb(&sblock, 1); sblk.b_bno = super / dev_bsize; sblk.b_size = SBLOCKSIZE; - if (bflag) - goto out; /* * Compare all fields that should not differ in alternate super block. * When an alternate super-block is specified this check is skipped. */ + if (bflag) + goto out; getblk(&asblk, cgsblock(&sblock, sblock.fs_ncg - 1), sblock.fs_sbsize); if (asblk.b_errs) return (0); - if (altsblock.fs_sblkno != sblock.fs_sblkno || - altsblock.fs_cblkno != sblock.fs_cblkno || - altsblock.fs_iblkno != sblock.fs_iblkno || - altsblock.fs_dblkno != sblock.fs_dblkno || - altsblock.fs_ncg != sblock.fs_ncg || - altsblock.fs_bsize != sblock.fs_bsize || - altsblock.fs_fsize != sblock.fs_fsize || - altsblock.fs_frag != sblock.fs_frag || - altsblock.fs_bmask != sblock.fs_bmask || - altsblock.fs_fmask != sblock.fs_fmask || - altsblock.fs_bshift != sblock.fs_bshift || - altsblock.fs_fshift != sblock.fs_fshift || - altsblock.fs_fragshift != sblock.fs_fragshift || - altsblock.fs_fsbtodb != sblock.fs_fsbtodb || - altsblock.fs_sbsize != sblock.fs_sbsize || - altsblock.fs_nindir != sblock.fs_nindir || - altsblock.fs_inopb != sblock.fs_inopb || - altsblock.fs_cssize != sblock.fs_cssize || - altsblock.fs_ipg != sblock.fs_ipg || - altsblock.fs_fpg != sblock.fs_fpg || - altsblock.fs_magic != sblock.fs_magic) { + bad = 0; +#define CHK(x, y) \ + if (altsblock.x != sblock.x) { \ + bad++; \ + if (listerr && debug) \ + printf("SUPER BLOCK VS ALTERNATE MISMATCH %s: " y " vs " y "\n", \ + #x, (intmax_t)sblock.x, (intmax_t)altsblock.x); \ + } + CHK(fs_sblkno, "%jd"); + CHK(fs_cblkno, "%jd"); + CHK(fs_iblkno, "%jd"); + CHK(fs_dblkno, "%jd"); + CHK(fs_ncg, "%jd"); + CHK(fs_bsize, "%jd"); + CHK(fs_fsize, "%jd"); + CHK(fs_frag, "%jd"); + CHK(fs_bmask, "%#jx"); + CHK(fs_fmask, "%#jx"); + CHK(fs_bshift, "%jd"); + CHK(fs_fshift, "%jd"); + CHK(fs_fragshift, "%jd"); + CHK(fs_fsbtodb, "%jd"); + CHK(fs_sbsize, "%jd"); + CHK(fs_nindir, "%jd"); + CHK(fs_inopb, "%jd"); + CHK(fs_cssize, "%jd"); + CHK(fs_ipg, "%jd"); + CHK(fs_fpg, "%jd"); + CHK(fs_magic, "%#jx"); +#undef CHK + if (bad) { if (listerr == 0) return (0); if (preen) printf("%s: ", cdevname); printf( "VALUES IN SUPER BLOCK LSB=%jd DISAGREE WITH THOSE IN\n" - "FIRST ALTERNATE LSB=%jd\n", + "LAST ALTERNATE LSB=%jd\n", sblk.b_bno, asblk.b_bno); if (reply("IGNORE ALTERNATE SUPER BLOCK") == 0) return (0); From owner-svn-src-head@freebsd.org Mon Aug 7 21:29:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C457DC9E71; Mon, 7 Aug 2017 21:29:29 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC1C583F1C; Mon, 7 Aug 2017 21:29:28 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from aurora.physics.berkeley.edu (aurora.physics.berkeley.edu [128.32.117.67]) (authenticated bits=0) by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id v77LJ9at020655 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 7 Aug 2017 14:19:09 -0700 Subject: Re: svn commit: r322198 - in head: share/man/man9 sys/geom To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201708072112.v77LCcXm001489@repo.freebsd.org> From: Nathan Whitehorn Message-ID: Date: Mon, 7 Aug 2017 14:19:08 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <201708072112.v77LCcXm001489@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Sonic-CAuth: UmFuZG9tSVZanR1XNDjwUc+d68kKRHx9cZPgvD2jA9A4qr1UorDYX7HUzHVija80Qsyyp6dGYx6Ffx1jBBljpnoYyED+uRJF4Nw54js4q08= X-Sonic-ID: C;kngODbZ75xGdWMGbEi49jA== M;4uhNDbZ75xGdWMGbEi49jA== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:29:29 -0000 It would be really nice to let gpart provide aliases correct to partition labels, which would fix the existing racy and unreliable glabel code. Do you see any obstacles to using this code for that? -Nathan On 08/07/17 14:12, Warner Losh wrote: > Author: imp > Date: Mon Aug 7 21:12:38 2017 > New Revision: 322198 > URL: https://svnweb.freebsd.org/changeset/base/322198 > > Log: > Expose API to allow disks to ask for alias names in devfs. > > Implement disk_add_alias to allow aliases to be added to disks. All > disk have a primary name (say "foo") can also have secondary names > (say "bar") such that all instances of "foo" also have a "bar" > alias. So if you have foo0, foo0p1, foo1, foo1s1 and foo1s1a nodes > created by the foo driver and gpart, device nodes bar0, bar0p1, bar1, > bar1s1 and bar1s1a will appear as symlinks back to the original nodes. > This generalizes to multiple aliases. However, since the unit number > follows the primary name, multiple device drivers can't create the > same aliases unless those drives coorinate the unit number space (eg > you couldn't add an alias 'disk' to both 'da' and 'ada' because it's > possible to have da0 and ada0, because 'disk0' is ambiguous). > > Differential Revision: https://reviews.freebsd.org/D11873 > > Modified: > head/share/man/man9/disk.9 > head/sys/geom/geom_disk.c > head/sys/geom/geom_disk.h > > Modified: head/share/man/man9/disk.9 > ============================================================================== > --- head/share/man/man9/disk.9 Mon Aug 7 21:12:33 2017 (r322197) > +++ head/share/man/man9/disk.9 Mon Aug 7 21:12:38 2017 (r322198) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd October 30, 2012 > +.Dd August 3, 2017 > .Dt DISK 9 > .Os > .Sh NAME > @@ -45,6 +45,8 @@ > .Fn disk_destroy "struct disk *disk" > .Ft int > .Fn disk_resize "struct disk *disk" "int flags" > +.Ft void > +.Fn disk_add_alias "struct disk *disk" "const char *alias" > .Sh DESCRIPTION > The disk storage API permits kernel device drivers providing access to > disk-like storage devices to advertise the device to other kernel > @@ -69,6 +71,20 @@ function, > fill in the fields and call > .Fn disk_create > when the device is ready to service requests. > +.Fn disk_add_alias > +adds an alias for the disk and must be called before > +.Fn disk_create , > +but may be called multiple times. > +For each alias added, a device node will be created with > +.Xr make_dev_alias 9 > +in the same way primary device nodes are created with > +.Xr make_dev 9 > +for > +.Va d_name > +and > +.Va d_unit . > +Care should be taken to ensure that only one driver creates aliases > +for any given name. > .Fn disk_resize > can be called by the driver after modifying > .Va d_mediasize > @@ -227,7 +243,13 @@ structure for this disk device. > .El > .Sh SEE ALSO > .Xr GEOM 4 , > -.Xr devfs 5 > +.Xr devfs 5 , > +.Xr MAKE_DEV 9 > .Sh AUTHORS > This manual page was written by > .An Robert Watson . > +.Sh BUGS > +Disk aliases are not a general purpose aliasing mechanism, but are > +intended only to ease the transition from one name to another. > +They can be used to ensure that nvd0 and nda0 are the same thing. > +They cannot be used to implement the diskX concept from macOS. > > Modified: head/sys/geom/geom_disk.c > ============================================================================== > --- head/sys/geom/geom_disk.c Mon Aug 7 21:12:33 2017 (r322197) > +++ head/sys/geom/geom_disk.c Mon Aug 7 21:12:38 2017 (r322198) > @@ -676,6 +676,7 @@ g_disk_create(void *arg, int flag) > struct g_provider *pp; > struct disk *dp; > struct g_disk_softc *sc; > + struct disk_alias *dap; > char tmpstr[80]; > > if (flag == EV_CANCEL) > @@ -704,6 +705,10 @@ g_disk_create(void *arg, int flag) > sc->dp = dp; > gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit); > gp->softc = sc; > + LIST_FOREACH(dap, &dp->d_aliases, da_next) { > + snprintf(tmpstr, sizeof(tmpstr), "%s%d", dap->da_alias, dp->d_unit); > + g_geom_add_alias(gp, tmpstr); > + } > pp = g_new_providerf(gp, "%s", gp->name); > devstat_remove_entry(pp->stat); > pp->stat = NULL; > @@ -791,6 +796,7 @@ g_disk_destroy(void *ptr, int flag) > struct disk *dp; > struct g_geom *gp; > struct g_disk_softc *sc; > + struct disk_alias *dap, *daptmp; > > g_topology_assert(); > dp = ptr; > @@ -802,6 +808,8 @@ g_disk_destroy(void *ptr, int flag) > dp->d_geom = NULL; > g_wither_geom(gp, ENXIO); > } > + LIST_FOREACH_SAFE(dap, &dp->d_aliases, da_next, daptmp) > + g_free(dap); > > g_free(dp); > } > @@ -834,8 +842,11 @@ g_disk_ident_adjust(char *ident, size_t size) > struct disk * > disk_alloc(void) > { > + struct disk *dp; > > - return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO)); > + dp = g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO); > + LIST_INIT(&dp->d_aliases); > + return (dp); > } > > void > @@ -882,6 +893,18 @@ disk_destroy(struct disk *dp) > if (dp->d_devstat != NULL) > devstat_remove_entry(dp->d_devstat); > g_post_event(g_disk_destroy, dp, M_WAITOK, NULL); > +} > + > +void > +disk_add_alias(struct disk *dp, const char *name) > +{ > + struct disk_alias *dap; > + > + dap = (struct disk_alias *)g_malloc( > + sizeof(struct disk_alias) + strlen(name) + 1, M_WAITOK); > + strcpy((char *)(dap + 1), name); > + dap->da_alias = (const char *)(dap + 1); > + LIST_INSERT_HEAD(&dp->d_aliases, dap, da_next); > } > > void > > Modified: head/sys/geom/geom_disk.h > ============================================================================== > --- head/sys/geom/geom_disk.h Mon Aug 7 21:12:33 2017 (r322197) > +++ head/sys/geom/geom_disk.h Mon Aug 7 21:12:38 2017 (r322198) > @@ -66,6 +66,11 @@ typedef enum { > DISK_INIT_DONE > } disk_init_level; > > +struct disk_alias { > + LIST_ENTRY(disk_alias) da_next; > + const char *da_alias; > +}; > + > struct disk { > /* Fields which are private to geom_disk */ > struct g_geom *d_geom; > @@ -109,6 +114,9 @@ struct disk { > > /* Fields private to the driver */ > void *d_drv1; > + > + /* Fields private to geom_disk, to be moved on next version bump */ > + LIST_HEAD(,disk_alias) d_aliases; > }; > > #define DISKFLAG_RESERVED 0x1 /* Was NEEDSGIANT */ > @@ -132,6 +140,7 @@ void disk_attr_changed(struct disk *dp, const char *at > void disk_media_changed(struct disk *dp, int flag); > void disk_media_gone(struct disk *dp, int flag); > int disk_resize(struct disk *dp, int flag); > +void disk_add_alias(struct disk *disk, const char *); > > #define DISK_VERSION_00 0x58561059 > #define DISK_VERSION_01 0x5856105a > From owner-svn-src-head@freebsd.org Mon Aug 7 21:29:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2216EDC9ED7; Mon, 7 Aug 2017 21:29:43 +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 A8CBD83FDB; Mon, 7 Aug 2017 21:29:42 +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 v77LTbCV054758 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 8 Aug 2017 00:29:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v77LTbCV054758 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v77LTbZm054757; Tue, 8 Aug 2017 00:29:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 8 Aug 2017 00:29:37 +0300 From: Konstantin Belousov To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322196 - head/sys/geom Message-ID: <20170807212937.GJ1700@kib.kiev.ua> References: <201708072112.v77LCSxL001381@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201708072112.v77LCSxL001381@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:29:43 -0000 On Mon, Aug 07, 2017 at 09:12:28PM +0000, Warner Losh wrote: > + LIST_FOREACH(gap, &pp->geom->aliases, ga_next) { > + error = make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &adev, dev, > + "%s", gap->ga_alias); > + if (error) { > + printf("%s: make_dev_alias_p() failed (name=%s, error=%d)\n", > + __func__, gap->ga_alias, error); > + continue; > + } > + adev->si_flags |= SI_UNMAPPED; Why do you set the flag unconditionally ? > + adev->si_iosize_max = dev->si_iosize_max; > + adev->si_drv2 = dev->si_drv2; And what are you trying to do by these initializations, including the si_flags adjustment ? Aliases cause creation of symlinks in the devfs populate loop, which makes it impossible to access the alias cdevs. From owner-svn-src-head@freebsd.org Mon Aug 7 21:29:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2575DC9F58; Mon, 7 Aug 2017 21:29:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0C1984121; Mon, 7 Aug 2017 21:29:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77LTtIt006046; Mon, 7 Aug 2017 21:29:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LTtDB006045; Mon, 7 Aug 2017 21:29:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708072129.v77LTtDB006045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 7 Aug 2017 21:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322202 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:29:57 -0000 Author: emaste Date: Mon Aug 7 21:29:55 2017 New Revision: 322202 URL: https://svnweb.freebsd.org/changeset/base/322202 Log: UPDATING: clarify what the RCMDS knob controls Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Aug 7 21:23:59 2017 (r322201) +++ head/UPDATING Mon Aug 7 21:29:55 2017 (r322202) @@ -64,8 +64,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: and upgrading, if you are not already using clang 3.5.0 or higher. 20170701: - WITHOUT_RCMDS is now the default. Set WITH_RCMDS if you need them to be - built with the base system. + WITHOUT_RCMDS is now the default. Set WITH_RCMDS if you need the + r-commands (rlogin, rsh, etc.) to be built with the base system. 20170625: The FreeBSD/powerpc platform now uses a 64-bit type for time_t. This is From owner-svn-src-head@freebsd.org Mon Aug 7 21:32:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 326A1DCA358 for ; Mon, 7 Aug 2017 21:32:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com [IPv6:2607:f8b0:4001:c0b::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA93884583 for ; Mon, 7 Aug 2017 21:32:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22e.google.com with SMTP id 77so9730800itj.1 for ; Mon, 07 Aug 2017 14:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=uvmBlFI9/OKaLGRNZINyvZi35LbG4SJzA0YnDK6uPMY=; b=AnkYRzeBMqvSBkJzCV/jELo5OtAzV6jZFmk/OyZQwXX5cV4wo5kNWr+TPBljbe//Pk VWQJu8eo1POQJM+kEhBfuJT+WmPR7kFlFw1qmJ65eWV6bwM8HqaMBN1Lwm6HO6PaAncQ gvDxCgM7c2E81l9+u+ipbcdjAzJii8rJ67hRxqcapgWe2rrk4B7cx3BQTlv2KZidBhDG yH2l6gyuZeyYwSK0ZWBhx4qKkhQrTG66pLv42SwXH4MLqpEhKcqpDiQIwJQPFlh3m+p9 /d0R3wldDtSFYQzsfiktdBcV1h6kgKDSIeEQNb6zCEYsaUuj9C+CRp/OflZExKAC7SzO djmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=uvmBlFI9/OKaLGRNZINyvZi35LbG4SJzA0YnDK6uPMY=; b=rKW1iRMRDrVDMmqAfjXBvEoQI8pyCMG7FoxkWGVyH78QQUMi/2lc6sMFNyEj9cUWs8 LgdW/KVK7xunIF5n9prgr8rtVzPpWwhuy+ijFzCZU2Zoc6VVTaK2elB7IN0jCVrkWb2l NjvITQ25j4CEl4/K4KI3XWYWo6vhfA0z3RQ4L9XeI6Da7EkrqXJi0HsZeh77kpIQCcQl ZNypuO6ttEtwg94vmX4HzLTKFu98B+tftoMMGBE1U3wdcypbUUGx+7IzDa7H9iEyDXEw nnVrD9JcQxJn0izyzTFMSc00zWsZeHVySb4k5UaXnlhh0idC0N0t9GgvNqWt3L+TT19T ffmA== X-Gm-Message-State: AIVw110IVGwGmw6873lAhIsbhK5r/tZ7OTkpIRqXxxlMCU0hwTTxvqek jAbtYdyPp0SFUVbpbPwbx35QFppN5xub X-Received: by 10.36.101.2 with SMTP id u2mr2271056itb.38.1502141523246; Mon, 07 Aug 2017 14:32:03 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Mon, 7 Aug 2017 14:32:02 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:f809:2296:13f6:2a42] In-Reply-To: References: <201708072112.v77LCcXm001489@repo.freebsd.org> From: Warner Losh Date: Mon, 7 Aug 2017 15:32:02 -0600 X-Google-Sender-Auth: 04HUKsAClqfiG0KP1UGUg_AXnJ8 Message-ID: Subject: Re: svn commit: r322198 - in head: share/man/man9 sys/geom To: Nathan Whitehorn Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:32:04 -0000 On Mon, Aug 7, 2017 at 3:19 PM, Nathan Whitehorn wrote: > It would be really nice to let gpart provide aliases correct to partition > labels, which would fix the existing racy and unreliable glabel code. Do > you see any obstacles to using this code for that? I'm not sure I understand well enough the issue here to have an opinion. Warner On 08/07/17 14:12, Warner Losh wrote: > >> Author: imp >> Date: Mon Aug 7 21:12:38 2017 >> New Revision: 322198 >> URL: https://svnweb.freebsd.org/changeset/base/322198 >> >> Log: >> Expose API to allow disks to ask for alias names in devfs. >> Implement disk_add_alias to allow aliases to be added to disks. All >> disk have a primary name (say "foo") can also have secondary names >> (say "bar") such that all instances of "foo" also have a "bar" >> alias. So if you have foo0, foo0p1, foo1, foo1s1 and foo1s1a nodes >> created by the foo driver and gpart, device nodes bar0, bar0p1, bar1, >> bar1s1 and bar1s1a will appear as symlinks back to the original nodes. >> This generalizes to multiple aliases. However, since the unit number >> follows the primary name, multiple device drivers can't create the >> same aliases unless those drives coorinate the unit number space (eg >> you couldn't add an alias 'disk' to both 'da' and 'ada' because it's >> possible to have da0 and ada0, because 'disk0' is ambiguous). >> Differential Revision: https://reviews.freebsd.org/D11873 >> >> Modified: >> head/share/man/man9/disk.9 >> head/sys/geom/geom_disk.c >> head/sys/geom/geom_disk.h >> >> Modified: head/share/man/man9/disk.9 >> ============================================================ >> ================== >> --- head/share/man/man9/disk.9 Mon Aug 7 21:12:33 2017 (r322197) >> +++ head/share/man/man9/disk.9 Mon Aug 7 21:12:38 2017 (r322198) >> @@ -27,7 +27,7 @@ >> .\" >> .\" $FreeBSD$ >> .\" >> -.Dd October 30, 2012 >> +.Dd August 3, 2017 >> .Dt DISK 9 >> .Os >> .Sh NAME >> @@ -45,6 +45,8 @@ >> .Fn disk_destroy "struct disk *disk" >> .Ft int >> .Fn disk_resize "struct disk *disk" "int flags" >> +.Ft void >> +.Fn disk_add_alias "struct disk *disk" "const char *alias" >> .Sh DESCRIPTION >> The disk storage API permits kernel device drivers providing access to >> disk-like storage devices to advertise the device to other kernel >> @@ -69,6 +71,20 @@ function, >> fill in the fields and call >> .Fn disk_create >> when the device is ready to service requests. >> +.Fn disk_add_alias >> +adds an alias for the disk and must be called before >> +.Fn disk_create , >> +but may be called multiple times. >> +For each alias added, a device node will be created with >> +.Xr make_dev_alias 9 >> +in the same way primary device nodes are created with >> +.Xr make_dev 9 >> +for >> +.Va d_name >> +and >> +.Va d_unit . >> +Care should be taken to ensure that only one driver creates aliases >> +for any given name. >> .Fn disk_resize >> can be called by the driver after modifying >> .Va d_mediasize >> @@ -227,7 +243,13 @@ structure for this disk device. >> .El >> .Sh SEE ALSO >> .Xr GEOM 4 , >> -.Xr devfs 5 >> +.Xr devfs 5 , >> +.Xr MAKE_DEV 9 >> .Sh AUTHORS >> This manual page was written by >> .An Robert Watson . >> +.Sh BUGS >> +Disk aliases are not a general purpose aliasing mechanism, but are >> +intended only to ease the transition from one name to another. >> +They can be used to ensure that nvd0 and nda0 are the same thing. >> +They cannot be used to implement the diskX concept from macOS. >> >> Modified: head/sys/geom/geom_disk.c >> ============================================================ >> ================== >> --- head/sys/geom/geom_disk.c Mon Aug 7 21:12:33 2017 (r322197) >> +++ head/sys/geom/geom_disk.c Mon Aug 7 21:12:38 2017 (r322198) >> @@ -676,6 +676,7 @@ g_disk_create(void *arg, int flag) >> struct g_provider *pp; >> struct disk *dp; >> struct g_disk_softc *sc; >> + struct disk_alias *dap; >> char tmpstr[80]; >> if (flag == EV_CANCEL) >> @@ -704,6 +705,10 @@ g_disk_create(void *arg, int flag) >> sc->dp = dp; >> gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit); >> gp->softc = sc; >> + LIST_FOREACH(dap, &dp->d_aliases, da_next) { >> + snprintf(tmpstr, sizeof(tmpstr), "%s%d", dap->da_alias, >> dp->d_unit); >> + g_geom_add_alias(gp, tmpstr); >> + } >> pp = g_new_providerf(gp, "%s", gp->name); >> devstat_remove_entry(pp->stat); >> pp->stat = NULL; >> @@ -791,6 +796,7 @@ g_disk_destroy(void *ptr, int flag) >> struct disk *dp; >> struct g_geom *gp; >> struct g_disk_softc *sc; >> + struct disk_alias *dap, *daptmp; >> g_topology_assert(); >> dp = ptr; >> @@ -802,6 +808,8 @@ g_disk_destroy(void *ptr, int flag) >> dp->d_geom = NULL; >> g_wither_geom(gp, ENXIO); >> } >> + LIST_FOREACH_SAFE(dap, &dp->d_aliases, da_next, daptmp) >> + g_free(dap); >> g_free(dp); >> } >> @@ -834,8 +842,11 @@ g_disk_ident_adjust(char *ident, size_t size) >> struct disk * >> disk_alloc(void) >> { >> + struct disk *dp; >> - return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO)); >> + dp = g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO); >> + LIST_INIT(&dp->d_aliases); >> + return (dp); >> } >> void >> @@ -882,6 +893,18 @@ disk_destroy(struct disk *dp) >> if (dp->d_devstat != NULL) >> devstat_remove_entry(dp->d_devstat); >> g_post_event(g_disk_destroy, dp, M_WAITOK, NULL); >> +} >> + >> +void >> +disk_add_alias(struct disk *dp, const char *name) >> +{ >> + struct disk_alias *dap; >> + >> + dap = (struct disk_alias *)g_malloc( >> + sizeof(struct disk_alias) + strlen(name) + 1, M_WAITOK); >> + strcpy((char *)(dap + 1), name); >> + dap->da_alias = (const char *)(dap + 1); >> + LIST_INSERT_HEAD(&dp->d_aliases, dap, da_next); >> } >> void >> >> Modified: head/sys/geom/geom_disk.h >> ============================================================ >> ================== >> --- head/sys/geom/geom_disk.h Mon Aug 7 21:12:33 2017 (r322197) >> +++ head/sys/geom/geom_disk.h Mon Aug 7 21:12:38 2017 (r322198) >> @@ -66,6 +66,11 @@ typedef enum { >> DISK_INIT_DONE >> } disk_init_level; >> +struct disk_alias { >> + LIST_ENTRY(disk_alias) da_next; >> + const char *da_alias; >> +}; >> + >> struct disk { >> /* Fields which are private to geom_disk */ >> struct g_geom *d_geom; >> @@ -109,6 +114,9 @@ struct disk { >> /* Fields private to the driver */ >> void *d_drv1; >> + >> + /* Fields private to geom_disk, to be moved on next version bump >> */ >> + LIST_HEAD(,disk_alias) d_aliases; >> }; >> #define DISKFLAG_RESERVED 0x1 /* Was NEEDSGIANT */ >> @@ -132,6 +140,7 @@ void disk_attr_changed(struct disk *dp, const char *at >> void disk_media_changed(struct disk *dp, int flag); >> void disk_media_gone(struct disk *dp, int flag); >> int disk_resize(struct disk *dp, int flag); >> +void disk_add_alias(struct disk *disk, const char *); >> #define DISK_VERSION_00 0x58561059 >> #define DISK_VERSION_01 0x5856105a >> >> > From owner-svn-src-head@freebsd.org Mon Aug 7 21:37:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81CD8DCA74F for ; Mon, 7 Aug 2017 21:37:58 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E29D84866 for ; Mon, 7 Aug 2017 21:37:58 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x233.google.com with SMTP id 77so9791055itj.1 for ; Mon, 07 Aug 2017 14:37:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=NI8SPRm+PsybPL/kAX0p0cNCCji6y3xyJswDwJNTVac=; b=vOIomLcSp2yrp+UN9u/QEofg+M7T9X/u4YEvt7+gp1ymHo5hZMeXuR0l+ssV5mVx+u WTSKjg7lL/Ytzu3CsPSRvzNTrbWHQtuTYh5VIiAyDTNwmkcM4cYbjQZ1zjxHGAoPPKvv HqVHvjvNtnYP+jE4dEnQQyrfDEgjr2kpmCTrMVasou++WsruT0GmOvSkQ7By0Is1XssM kCvDCgiZl1Sm3Lzd6mTaw1uehHe22jqPCx8zE0Wy3ZE5oVUj/LOHT+QxYnM6eS27tiE5 gg6V66YC31jKBKwfWKVVI5pNLlYm+smcWw8RDlJHO/wb3eHIVnLfRTw0leFkaO7234kh pT4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=NI8SPRm+PsybPL/kAX0p0cNCCji6y3xyJswDwJNTVac=; b=NAHIhPe7IDg0vwh5dWRKxfilwOhAYTOum4vx3h0v79mC6XpUSfkLCsnoa9GQaaIZZN E2H0RpJXoOOmQHVKsZYEIno2XEQVViTfXQwjt/KrnYpx9UUPNvKHrSnDp2vEVJfLHiPb Ysl1ZLpKdXimuU/QmMQAxINMwMPuzrl8pTNSPQX5xC+XNAaqvTq3AzIUSCuuSPCMsFI0 xDjVSKboh31g3RSsL0a4WSkxzoHne8mFCPixGDA7eiruuYRC6Pm7PBCAkRjI4fgQiKiF YH0VHtnlfhmLNHH4gQ8CHlP8XYH7Ww2eMAVOsuiasKccnFrnJHsD9m1AZLxYK+pNmXJL kVYA== X-Gm-Message-State: AIVw110vQ+DqTB6CeCVvUJsNtNAGquHQKecKwoAZbgDWi+JVCLb0wy2J bD+vq3IHCFKlZU26kyvNyIy7zI+NC4Cr X-Received: by 10.36.68.193 with SMTP id o184mr2089095ita.59.1502141877712; Mon, 07 Aug 2017 14:37:57 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Mon, 7 Aug 2017 14:37:57 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:f809:2296:13f6:2a42] In-Reply-To: <20170807212937.GJ1700@kib.kiev.ua> References: <201708072112.v77LCSxL001381@repo.freebsd.org> <20170807212937.GJ1700@kib.kiev.ua> From: Warner Losh Date: Mon, 7 Aug 2017 15:37:57 -0600 X-Google-Sender-Auth: _YaedL6OTiTGDFf4VI-Q-BhVgXU Message-ID: Subject: Re: svn commit: r322196 - head/sys/geom To: Konstantin Belousov Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:37:58 -0000 On Mon, Aug 7, 2017 at 3:29 PM, Konstantin Belousov wrote: > On Mon, Aug 07, 2017 at 09:12:28PM +0000, Warner Losh wrote: > > + LIST_FOREACH(gap, &pp->geom->aliases, ga_next) { > > + error = make_dev_alias_p(MAKEDEV_CHECKNAME | > MAKEDEV_WAITOK, &adev, dev, > > + "%s", gap->ga_alias); > > + if (error) { > > + printf("%s: make_dev_alias_p() failed (name=%s, > error=%d)\n", > > + __func__, gap->ga_alias, error); > > + continue; > > + } > > + adev->si_flags |= SI_UNMAPPED; > Why do you set the flag unconditionally ? Because it's set for "dev" unconditionally and the old compat code did it too... > + adev->si_iosize_max = dev->si_iosize_max; > > + adev->si_drv2 = dev->si_drv2; > And what are you trying to do by these initializations, including the > si_flags adjustment ? > The old (ad->ada) compat code set them. Though to be honest, I didn't drill down into the devfs code to see if that as still relevant. It sounds like maybe not relevant... > Aliases cause creation of symlinks in the devfs populate loop, which > makes it impossible to access the alias cdevs. > True enough. If so, do you think these adjustments to adev can just be removed entirely? A quick look in devfs code suggests that it doesn't matter since, as you point out, it's a symlink not a new, different node. Thanks for the feedback. Warner From owner-svn-src-head@freebsd.org Mon Aug 7 21:38:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F332DCA7AF; Mon, 7 Aug 2017 21:38:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 439A58491E; Mon, 7 Aug 2017 21:38:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77LcAY2009903; Mon, 7 Aug 2017 21:38:10 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LcAiY009902; Mon, 7 Aug 2017 21:38:10 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708072138.v77LcAiY009902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 7 Aug 2017 21:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322203 - head/usr.sbin/tzsetup X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/usr.sbin/tzsetup X-SVN-Commit-Revision: 322203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:38:11 -0000 Author: marius Date: Mon Aug 7 21:38:10 2017 New Revision: 322203 URL: https://svnweb.freebsd.org/changeset/base/322203 Log: Revert the parts of r322097 related to /etc/wall_cmos_clock handling as the previous behavior actually is required for setting up configurations in which the RTC is using UTC but the timezone is not. Still, besides uniform error handling, that file should get the same treatment in the non-interactive variants supported by tzsetup(8). Modified: head/usr.sbin/tzsetup/tzsetup.c Modified: head/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- head/usr.sbin/tzsetup/tzsetup.c Mon Aug 7 21:29:55 2017 (r322202) +++ head/usr.sbin/tzsetup/tzsetup.c Mon Aug 7 21:38:10 2017 (r322203) @@ -866,48 +866,10 @@ install_zoneinfo_file(const char *zoneinfo_file) static int install_zoneinfo(const char *zoneinfo) { - int fd, rv; + int rv; FILE *f; char path_zoneinfo_file[MAXPATHLEN]; - char prompt[SILLY_BUFFER_SIZE], title[64]; - if (reallydoit) { - if (strcmp(zoneinfo, "UTC") == 0) { - if (unlink(path_wall_cmos_clock) < 0 && - errno != ENOENT) { - snprintf(title, sizeof(title), "Error"); - snprintf(prompt, sizeof(prompt), - "Could not delete %s: %s", - path_wall_cmos_clock, strerror(errno)); -#ifdef HAVE_DIALOG - if (usedialog) - dialog_msgbox(title, prompt, 8, 72, 1); - else -#endif - fprintf(stderr, "%s\n", prompt); - - return (DITEM_FAILURE | DITEM_RECREATE); - } - } else { - fd = open(path_wall_cmos_clock, O_WRONLY | O_CREAT | - O_TRUNC, S_IRUSR | S_IRGRP | S_IROTH); - if (fd < 0) { - snprintf(title, sizeof(title), "Error"); - snprintf(prompt, sizeof(prompt), - "Could not create %s: %s", - path_wall_cmos_clock, strerror(errno)); -#ifdef HAVE_DIALOG - if (usedialog) - dialog_msgbox(title, prompt, 8, 72, 1); - else -#endif - fprintf(stderr, "%s\n", prompt); - return (DITEM_FAILURE | DITEM_RECREATE); - } - close(fd); - } - } - if ((size_t)snprintf(path_zoneinfo_file, sizeof(path_zoneinfo_file), "%s/%s", path_zoneinfo, zoneinfo) >= sizeof(path_zoneinfo_file)) errx(1, "%s/%s name too long", path_zoneinfo, zoneinfo); @@ -938,6 +900,7 @@ main(int argc, char **argv) { #ifdef HAVE_DIALOG char title[64], prompt[128]; + int fd; #endif int c, rv, skiputc; char vm_guest[16] = ""; @@ -992,7 +955,6 @@ main(int argc, char **argv) _PATH_WALL_CMOS_CLOCK); } - /* Override the user-supplied umask. */ (void)umask(S_IWGRP | S_IWOTH); @@ -1059,11 +1021,19 @@ main(int argc, char **argv) yesno = dialog_yesno(title, prompt, 7, 73); dlg_restore_vars(&save_vars); if (!yesno) { + if (reallydoit) + unlink(path_wall_cmos_clock); + } else { if (reallydoit) { - rv = install_zoneinfo("UTC"); - dlg_clear(); - end_dialog(); - exit(rv & ~DITEM_LEAVE_MENU); + fd = open(path_wall_cmos_clock, + O_WRONLY | O_CREAT | O_TRUNC, + S_IRUSR | S_IRGRP | S_IROTH); + if (fd < 0) { + end_dialog(); + err(1, "create %s", + path_wall_cmos_clock); + } + close(fd); } } dlg_clear(); From owner-svn-src-head@freebsd.org Mon Aug 7 21:51:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0545FDCB600; Mon, 7 Aug 2017 21:51:48 +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 8E03086E; Mon, 7 Aug 2017 21:51:47 +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 v77Lpa5J060342 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 8 Aug 2017 00:51:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v77Lpa5J060342 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v77LpaGH060341; Tue, 8 Aug 2017 00:51:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 8 Aug 2017 00:51:36 +0300 From: Konstantin Belousov To: Warner Losh Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322196 - head/sys/geom Message-ID: <20170807215136.GK1700@kib.kiev.ua> References: <201708072112.v77LCSxL001381@repo.freebsd.org> <20170807212937.GJ1700@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 21:51:48 -0000 On Mon, Aug 07, 2017 at 03:37:57PM -0600, Warner Losh wrote: > On Mon, Aug 7, 2017 at 3:29 PM, Konstantin Belousov > wrote: > > > On Mon, Aug 07, 2017 at 09:12:28PM +0000, Warner Losh wrote: > > > + LIST_FOREACH(gap, &pp->geom->aliases, ga_next) { > > > + error = make_dev_alias_p(MAKEDEV_CHECKNAME | > > MAKEDEV_WAITOK, &adev, dev, > > > + "%s", gap->ga_alias); > > > + if (error) { > > > + printf("%s: make_dev_alias_p() failed (name=%s, > > error=%d)\n", > > > + __func__, gap->ga_alias, error); > > > + continue; > > > + } > > > + adev->si_flags |= SI_UNMAPPED; > > Why do you set the flag unconditionally ? > > > Because it's set for "dev" unconditionally and the old compat code did it > too... > > > + adev->si_iosize_max = dev->si_iosize_max; > > > + adev->si_drv2 = dev->si_drv2; > > And what are you trying to do by these initializations, including the > > si_flags adjustment ? > > > > The old (ad->ada) compat code set them. Though to be honest, I didn't drill > down into the devfs code to see if that as still relevant. It sounds like > maybe not relevant... > > > > Aliases cause creation of symlinks in the devfs populate loop, which > > makes it impossible to access the alias cdevs. > > > > True enough. If so, do you think these adjustments to adev can just be > removed entirely? A quick look in devfs code suggests that it doesn't > matter since, as you point out, it's a symlink not a new, different node. Yes, I think that the adev tweaks are not needed. I will be surprised if it appears to be used, but then there might be some hole in the devfs symlinks handling. That said, since you mentioned ada/ad aliases, are they still in the tree ? If yes, do you plan to convert them as well ? From owner-svn-src-head@freebsd.org Mon Aug 7 22:00:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1ABE5DCBB40 for ; Mon, 7 Aug 2017 22:00:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D30B9C2D for ; Mon, 7 Aug 2017 22:00:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x234.google.com with SMTP id c74so7349617iod.4 for ; Mon, 07 Aug 2017 15:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=q9IEw/sgQBHuytiSK/3Slfhhg/o4WaAk8MN2W4ngBfQ=; b=fhAqw36yCnkoJB/dZQCsTETdNPM8ij0/8hTjv/KlIyLTg7MdpV8B6B1fqbl3BbYrbS eqiaH3Te/LMi4c7uXJC9Oq8ekUx2YsF2STm4BNdC3Ziv01ap5DnTq75/+XrdszKSfWPO 5mOcqYqE5upi0vn1ccju/o1lYQF7HraCkk2D2FANH4nRuDxBMt2K9UlVNWNQb48Yzut8 R25z70+0PVf9ieaKYPLccNUxrp+pJUXV/Rh91r3S4L8CRbOwHzNTO16SKwE0C6x3+ftM 6nJfTrCi8mdYWiEvEkHqG3udCXeB/DnxtpsAR5oYyMyGPI27ZZY3TIVsrm43Fkl6B/xQ 0/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=q9IEw/sgQBHuytiSK/3Slfhhg/o4WaAk8MN2W4ngBfQ=; b=WN0Guzlsk1tQ8dAkUDt16NfuYNcm6SW44xneC1PQimzFvIeTUPxXHtxlP3NCo8itxO HunIb7Ndl37pWdxAC+ieTlCs/pzG3oziMMwGJdzxRlI+sMSYCeSQ82QCNNL6Zfssdm9D 1Gg0ef4Wx9lOLAc+9T0I9jvB5I61XtzmMjTlq+SMI+NXI1ii9WTcM68ibmManw+rKPE8 uvDZXZ4/QHi57YAKM8Kcyl1LFzsKXd4aWB7vDoQoDvDLHgofIteZNrXZYti788AhjVNw OxyUIf5p/skpnWJji58YofAiYbEsi5ricXLUela3BdNPk1E6tDBROdUrHLH6bWUA6Y+C vpGA== X-Gm-Message-State: AIVw112zcPAKSQBXRHZxlEYlMk6YmsjnY6YHA5HVX7z71I9Wuwz5RhHB qEOuuVp/1ahLhLgglERBkKcdezctGX/b X-Received: by 10.107.147.133 with SMTP id v127mr1812624iod.128.1502143218296; Mon, 07 Aug 2017 15:00:18 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Mon, 7 Aug 2017 15:00:17 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:f809:2296:13f6:2a42] In-Reply-To: <20170807215136.GK1700@kib.kiev.ua> References: <201708072112.v77LCSxL001381@repo.freebsd.org> <20170807212937.GJ1700@kib.kiev.ua> <20170807215136.GK1700@kib.kiev.ua> From: Warner Losh Date: Mon, 7 Aug 2017 16:00:17 -0600 X-Google-Sender-Auth: xeMD_KUYpArcONA3TBQ_hvNYx1s Message-ID: Subject: Re: svn commit: r322196 - head/sys/geom To: Konstantin Belousov Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 22:00:19 -0000 On Mon, Aug 7, 2017 at 3:51 PM, Konstantin Belousov wrote: > On Mon, Aug 07, 2017 at 03:37:57PM -0600, Warner Losh wrote: > > On Mon, Aug 7, 2017 at 3:29 PM, Konstantin Belousov > > > wrote: > > > > > On Mon, Aug 07, 2017 at 09:12:28PM +0000, Warner Losh wrote: > > > > + LIST_FOREACH(gap, &pp->geom->aliases, ga_next) { > > > > + error = make_dev_alias_p(MAKEDEV_CHECKNAME | > > > MAKEDEV_WAITOK, &adev, dev, > > > > + "%s", gap->ga_alias); > > > > + if (error) { > > > > + printf("%s: make_dev_alias_p() failed (name=%s, > > > error=%d)\n", > > > > + __func__, gap->ga_alias, error); > > > > + continue; > > > > + } > > > > + adev->si_flags |= SI_UNMAPPED; > > > Why do you set the flag unconditionally ? > > > > > > Because it's set for "dev" unconditionally and the old compat code did it > > too... > > > > > + adev->si_iosize_max = dev->si_iosize_max; > > > > + adev->si_drv2 = dev->si_drv2; > > > And what are you trying to do by these initializations, including the > > > si_flags adjustment ? > > > > > > > The old (ad->ada) compat code set them. Though to be honest, I didn't > drill > > down into the devfs code to see if that as still relevant. It sounds like > > maybe not relevant... > > > > > > > Aliases cause creation of symlinks in the devfs populate loop, which > > > makes it impossible to access the alias cdevs. > > > > > > > True enough. If so, do you think these adjustments to adev can just be > > removed entirely? A quick look in devfs code suggests that it doesn't > > matter since, as you point out, it's a symlink not a new, different node. > Yes, I think that the adev tweaks are not needed. I will be surprised > if it appears to be used, but then there might be some hole in the > devfs symlinks handling. > Maybe I'm just setting 'dead variables' here that don't matter. I don't know that this is required, just kept the same code that used to 'work'. > That said, since you mentioned ada/ad aliases, are they still in the tree ? > If yes, do you plan to convert them as well ? > That code was removed in 11. I thought about bringing the code that ada used to implement them back verbatim for nda (and soon mda), but thought this approach was better and more general (and less error prone). I have no plans to re-add them. Warner From owner-svn-src-head@freebsd.org Mon Aug 7 22:20:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CB4EDCC8C8; Mon, 7 Aug 2017 22:20:20 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73F3516AA; Mon, 7 Aug 2017 22:20:19 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from aurora.physics.berkeley.edu (aurora.physics.berkeley.edu [128.32.117.67]) (authenticated bits=0) by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id v77MKFch016136 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 7 Aug 2017 15:20:16 -0700 Subject: Re: svn commit: r322198 - in head: share/man/man9 sys/geom To: Warner Losh Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201708072112.v77LCcXm001489@repo.freebsd.org> From: Nathan Whitehorn Message-ID: Date: Mon, 7 Aug 2017 15:20:15 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Sonic-CAuth: UmFuZG9tSVb9xHFseSlKGqz/QUV2bNmClrWf5AS1Bg7C0zDLKPqfcqZE2hTydO9Ok3QDeZL7HTKC057/Xx+6RlBRu1KuPZXEwkLleUlfPjE= X-Sonic-ID: C;2tiIlr575xGvjcGbEi49jA== M;kl3Tlr575xGvjcGbEi49jA== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 22:20:20 -0000 On 08/07/17 14:32, Warner Losh wrote: > > > On Mon, Aug 7, 2017 at 3:19 PM, Nathan Whitehorn > > wrote: > > It would be really nice to let gpart provide aliases correct to > partition labels, which would fix the existing racy and unreliable > glabel code. Do you see any obstacles to using this code for that? > > > I'm not sure I understand well enough the issue here to have an opinion. We get /dev/gpt/foo (etc.) right now by parsing the GPT labels with a completely parallel piece of code to gpart and then create an extra geom provider based on the label. This falls down in four ways: 1. The code is racy. It is perfectly possible to get a GPT label set by gpart but not have it picked up by glabel for some period of time that may be infinite (until a retaste), since the events don't propagate. 2. The resulting /dev entry is unpredictable from the label, since glabel internally does some fixups related to spaces, etc. You need to copy and paste glabel's munging code. 3. It isn't implemented for all of the schemes gpart supports since it has a reimplementation of the partition table parser. 4. Because it uses an extra provider, mounting, say, /dev/adaXpY causes /dev/gpt/Z to vanish. This combination of things is why we don't currently use labels in the installer and never have. Having gpart internally create symlinks would fix all of this at a stroke. I will take a look at this some more and see how hard it would be to implement; at the very least, I think you would also need a disk_remove_alias() or the like. -Nathan > Warner > > On 08/07/17 14:12, Warner Losh wrote: > > Author: imp > Date: Mon Aug 7 21:12:38 2017 > New Revision: 322198 > URL: https://svnweb.freebsd.org/changeset/base/322198 > > > Log: > Expose API to allow disks to ask for alias names in devfs. > Implement disk_add_alias to allow aliases to be added to > disks. All > disk have a primary name (say "foo") can also have > secondary names > (say "bar") such that all instances of "foo" also have a "bar" > alias. So if you have foo0, foo0p1, foo1, foo1s1 and > foo1s1a nodes > created by the foo driver and gpart, device nodes bar0, > bar0p1, bar1, > bar1s1 and bar1s1a will appear as symlinks back to the > original nodes. > This generalizes to multiple aliases. However, since the > unit number > follows the primary name, multiple device drivers can't > create the > same aliases unless those drives coorinate the unit number > space (eg > you couldn't add an alias 'disk' to both 'da' and 'ada' > because it's > possible to have da0 and ada0, because 'disk0' is ambiguous). > Differential Revision: > https://reviews.freebsd.org/D11873 > > > Modified: > head/share/man/man9/disk.9 > head/sys/geom/geom_disk.c > head/sys/geom/geom_disk.h > > Modified: head/share/man/man9/disk.9 > ============================================================================== > --- head/share/man/man9/disk.9 Mon Aug 7 21:12:33 2017 > (r322197) > +++ head/share/man/man9/disk.9 Mon Aug 7 21:12:38 2017 > (r322198) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd October 30, 2012 > +.Dd August 3, 2017 > .Dt DISK 9 > .Os > .Sh NAME > @@ -45,6 +45,8 @@ > .Fn disk_destroy "struct disk *disk" > .Ft int > .Fn disk_resize "struct disk *disk" "int flags" > +.Ft void > +.Fn disk_add_alias "struct disk *disk" "const char *alias" > .Sh DESCRIPTION > The disk storage API permits kernel device drivers providing > access to > disk-like storage devices to advertise the device to other > kernel > @@ -69,6 +71,20 @@ function, > fill in the fields and call > .Fn disk_create > when the device is ready to service requests. > +.Fn disk_add_alias > +adds an alias for the disk and must be called before > +.Fn disk_create , > +but may be called multiple times. > +For each alias added, a device node will be created with > +.Xr make_dev_alias 9 > +in the same way primary device nodes are created with > +.Xr make_dev 9 > +for > +.Va d_name > +and > +.Va d_unit . > +Care should be taken to ensure that only one driver creates > aliases > +for any given name. > .Fn disk_resize > can be called by the driver after modifying > .Va d_mediasize > @@ -227,7 +243,13 @@ structure for this disk device. > .El > .Sh SEE ALSO > .Xr GEOM 4 , > -.Xr devfs 5 > +.Xr devfs 5 , > +.Xr MAKE_DEV 9 > .Sh AUTHORS > This manual page was written by > .An Robert Watson . > +.Sh BUGS > +Disk aliases are not a general purpose aliasing mechanism, > but are > +intended only to ease the transition from one name to another. > +They can be used to ensure that nvd0 and nda0 are the same thing. > +They cannot be used to implement the diskX concept from macOS. > > Modified: head/sys/geom/geom_disk.c > ============================================================================== > --- head/sys/geom/geom_disk.c Mon Aug 7 21:12:33 2017 > (r322197) > +++ head/sys/geom/geom_disk.c Mon Aug 7 21:12:38 2017 > (r322198) > @@ -676,6 +676,7 @@ g_disk_create(void *arg, int flag) > struct g_provider *pp; > struct disk *dp; > struct g_disk_softc *sc; > + struct disk_alias *dap; > char tmpstr[80]; > if (flag == EV_CANCEL) > @@ -704,6 +705,10 @@ g_disk_create(void *arg, int flag) > sc->dp = dp; > gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, > dp->d_unit); > gp->softc = sc; > + LIST_FOREACH(dap, &dp->d_aliases, da_next) { > + snprintf(tmpstr, sizeof(tmpstr), "%s%d", > dap->da_alias, dp->d_unit); > + g_geom_add_alias(gp, tmpstr); > + } > pp = g_new_providerf(gp, "%s", gp->name); > devstat_remove_entry(pp->stat); > pp->stat = NULL; > @@ -791,6 +796,7 @@ g_disk_destroy(void *ptr, int flag) > struct disk *dp; > struct g_geom *gp; > struct g_disk_softc *sc; > + struct disk_alias *dap, *daptmp; > g_topology_assert(); > dp = ptr; > @@ -802,6 +808,8 @@ g_disk_destroy(void *ptr, int flag) > dp->d_geom = NULL; > g_wither_geom(gp, ENXIO); > } > + LIST_FOREACH_SAFE(dap, &dp->d_aliases, da_next, daptmp) > + g_free(dap); > g_free(dp); > } > @@ -834,8 +842,11 @@ g_disk_ident_adjust(char *ident, size_t size) > struct disk * > disk_alloc(void) > { > + struct disk *dp; > - return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO)); > + dp = g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO); > + LIST_INIT(&dp->d_aliases); > + return (dp); > } > void > @@ -882,6 +893,18 @@ disk_destroy(struct disk *dp) > if (dp->d_devstat != NULL) > devstat_remove_entry(dp->d_devstat); > g_post_event(g_disk_destroy, dp, M_WAITOK, NULL); > +} > + > +void > +disk_add_alias(struct disk *dp, const char *name) > +{ > + struct disk_alias *dap; > + > + dap = (struct disk_alias *)g_malloc( > + sizeof(struct disk_alias) + strlen(name) + 1, > M_WAITOK); > + strcpy((char *)(dap + 1), name); > + dap->da_alias = (const char *)(dap + 1); > + LIST_INSERT_HEAD(&dp->d_aliases, dap, da_next); > } > void > > Modified: head/sys/geom/geom_disk.h > ============================================================================== > --- head/sys/geom/geom_disk.h Mon Aug 7 21:12:33 2017 > (r322197) > +++ head/sys/geom/geom_disk.h Mon Aug 7 21:12:38 2017 > (r322198) > @@ -66,6 +66,11 @@ typedef enum { > DISK_INIT_DONE > } disk_init_level; > +struct disk_alias { > + LIST_ENTRY(disk_alias) da_next; > + const char *da_alias; > +}; > + > struct disk { > /* Fields which are private to geom_disk */ > struct g_geom *d_geom; > @@ -109,6 +114,9 @@ struct disk { > /* Fields private to the driver */ > void *d_drv1; > + > + /* Fields private to geom_disk, to be moved on next > version bump */ > + LIST_HEAD(,disk_alias) d_aliases; > }; > #define DISKFLAG_RESERVED 0x1 /* Was NEEDSGIANT */ > @@ -132,6 +140,7 @@ void disk_attr_changed(struct disk *dp, > const char *at > void disk_media_changed(struct disk *dp, int flag); > void disk_media_gone(struct disk *dp, int flag); > int disk_resize(struct disk *dp, int flag); > +void disk_add_alias(struct disk *disk, const char *); > #define DISK_VERSION_00 0x58561059 > #define DISK_VERSION_01 0x5856105a > > > From owner-svn-src-head@freebsd.org Mon Aug 7 22:27:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1360DCCE63 for ; Mon, 7 Aug 2017 22:27:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x230.google.com (mail-io0-x230.google.com [IPv6:2607:f8b0:4001:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A43931C7E for ; Mon, 7 Aug 2017 22:27:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x230.google.com with SMTP id j32so7594733iod.0 for ; Mon, 07 Aug 2017 15:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Dj4uVpHicX8f2cJwwuQVH4o8zHcichwoVDCHKZZXRBE=; b=oMx32OaBhmiD9xOyFcwRz1f8ajEl90Lw/Cuq21yzmotJuQYRCLGDS2AjBvBWyaWDis HssXcQ+pHu95p3MXb0Tcc/itbh2n6FcRS8otqEbt1iCgRdKDzzmHl5fv0ayLbRWbhcOO 8my7PLdob4IlBT3Ml5vnBSL3N9z3jtbnTuQ55jhe4xZ3azc/qyhxMekILiMUR67dTHQF 9PrwdA3D3RFbo//j2RiafyXH/P8HN/kBJJy/0pnO8QmUUrvQsPurVphyWkL52fMybNQY UzaOwfpNpOrA/gqicd0JcEIMZK8CWFNvFrN0+OuPKzkwYy3LsxBRQpMOtejkj658/MKp GkMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Dj4uVpHicX8f2cJwwuQVH4o8zHcichwoVDCHKZZXRBE=; b=Ttt+sLw5sM2Qu8zC0YlQTsE+5K70S8GaUShtTZCbi5eCQx7Fj/n5RtExsh97wr8B6n c4OW6qupYd+jH8hz6NmveZUDeopjShuFfPucwNK7552N/qDtoC4zZVImGsi0PjVCabAB HvolQccJaSApsvWD6CHYFUw8UKXcrOLg2ppQbUTsOJS9TS1s/cV3JJnadjAW/S3uGDqM Eu9lOjQ+4vzKgk7iqMKMDbWW1w+i5P2dKAadNjmUCs3577yI4QzHz8SLvhXNzhSoRGCy okjPS48wWG9RPweeYVQdbo0+Uf1Bkg6Q6q8OcZvZBb1/KYN74trTp6NMM6oCCQRCf1ha vjIQ== X-Gm-Message-State: AHYfb5jkYYNZ3vdsuDQ2fB9Gd94ys6w4I/3ojqjcyfHpLkbZJ3Gdh5zw oiXX/qvQq1G2EWhhwlblHp+10B/pEpkD X-Received: by 10.107.36.18 with SMTP id k18mr1998886iok.147.1502144847006; Mon, 07 Aug 2017 15:27:27 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Mon, 7 Aug 2017 15:27:26 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:f809:2296:13f6:2a42] In-Reply-To: References: <201708072112.v77LCcXm001489@repo.freebsd.org> From: Warner Losh Date: Mon, 7 Aug 2017 16:27:26 -0600 X-Google-Sender-Auth: v2RLNhOy1-V9VJ32s9o_BFXmqFI Message-ID: Subject: Re: svn commit: r322198 - in head: share/man/man9 sys/geom To: Nathan Whitehorn Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 22:27:28 -0000 On Mon, Aug 7, 2017 at 4:20 PM, Nathan Whitehorn wrote: > > > On 08/07/17 14:32, Warner Losh wrote: > > > > On Mon, Aug 7, 2017 at 3:19 PM, Nathan Whitehorn > wrote: > >> It would be really nice to let gpart provide aliases correct to partition >> labels, which would fix the existing racy and unreliable glabel code. Do >> you see any obstacles to using this code for that? > > > I'm not sure I understand well enough the issue here to have an opinion. > > > We get /dev/gpt/foo (etc.) right now by parsing the GPT labels with a > completely parallel piece of code to gpart and then create an extra geom > provider based on the label. This falls down in four ways: > 1. The code is racy. It is perfectly possible to get a GPT label set by > gpart but not have it picked up by glabel for some period of time that may > be infinite (until a retaste), since the events don't propagate. > 2. The resulting /dev entry is unpredictable from the label, since glabel > internally does some fixups related to spaces, etc. You need to copy and > paste glabel's munging code. > 3. It isn't implemented for all of the schemes gpart supports since it has > a reimplementation of the partition table parser. > 4. Because it uses an extra provider, mounting, say, /dev/adaXpY causes > /dev/gpt/Z to vanish. > > This combination of things is why we don't currently use labels in the > installer and never have. Having gpart internally create symlinks would fix > all of this at a stroke. I will take a look at this some more and see how > hard it would be to implement; at the very least, I think you would also > need a disk_remove_alias() or the like. > I've experienced all but #1 and #2. I've run systems for about a decade with root mounted on /dev/gpt/HOST-root, usr on /dev/gpt/HOST-usr, etc. Must have gotten lucky, or not hit the use case that you've seen. Not sure what's up with #3, but it sounds orthogonal and an incomplete gpart/glabel integration. #4 has always bothered me. While device aliases like I've done here would solve that problem, I'm not sure what other issues there'd be demoting glabel devices to mere /dev/ nodes from first class geom objects. The main issue I see is needing to have the aliases in place when tasting time comes for the geom being tasted. I haven't thought through geom's sequence enough to know if that would be more robust or not. Warner -Nathan > > > Warner > > On 08/07/17 14:12, Warner Losh wrote: >> >>> Author: imp >>> Date: Mon Aug 7 21:12:38 2017 >>> New Revision: 322198 >>> URL: https://svnweb.freebsd.org/changeset/base/322198 >>> >>> Log: >>> Expose API to allow disks to ask for alias names in devfs. >>> Implement disk_add_alias to allow aliases to be added to disks. All >>> disk have a primary name (say "foo") can also have secondary names >>> (say "bar") such that all instances of "foo" also have a "bar" >>> alias. So if you have foo0, foo0p1, foo1, foo1s1 and foo1s1a nodes >>> created by the foo driver and gpart, device nodes bar0, bar0p1, bar1, >>> bar1s1 and bar1s1a will appear as symlinks back to the original nodes. >>> This generalizes to multiple aliases. However, since the unit number >>> follows the primary name, multiple device drivers can't create the >>> same aliases unless those drives coorinate the unit number space (eg >>> you couldn't add an alias 'disk' to both 'da' and 'ada' because it's >>> possible to have da0 and ada0, because 'disk0' is ambiguous). >>> Differential Revision: https://reviews.freebsd.org/D11873 >>> >>> Modified: >>> head/share/man/man9/disk.9 >>> head/sys/geom/geom_disk.c >>> head/sys/geom/geom_disk.h >>> >>> Modified: head/share/man/man9/disk.9 >>> ============================================================ >>> ================== >>> --- head/share/man/man9/disk.9 Mon Aug 7 21:12:33 2017 (r322197) >>> +++ head/share/man/man9/disk.9 Mon Aug 7 21:12:38 2017 (r322198) >>> @@ -27,7 +27,7 @@ >>> .\" >>> .\" $FreeBSD$ >>> .\" >>> -.Dd October 30, 2012 >>> +.Dd August 3, 2017 >>> .Dt DISK 9 >>> .Os >>> .Sh NAME >>> @@ -45,6 +45,8 @@ >>> .Fn disk_destroy "struct disk *disk" >>> .Ft int >>> .Fn disk_resize "struct disk *disk" "int flags" >>> +.Ft void >>> +.Fn disk_add_alias "struct disk *disk" "const char *alias" >>> .Sh DESCRIPTION >>> The disk storage API permits kernel device drivers providing access to >>> disk-like storage devices to advertise the device to other kernel >>> @@ -69,6 +71,20 @@ function, >>> fill in the fields and call >>> .Fn disk_create >>> when the device is ready to service requests. >>> +.Fn disk_add_alias >>> +adds an alias for the disk and must be called before >>> +.Fn disk_create , >>> +but may be called multiple times. >>> +For each alias added, a device node will be created with >>> +.Xr make_dev_alias 9 >>> +in the same way primary device nodes are created with >>> +.Xr make_dev 9 >>> +for >>> +.Va d_name >>> +and >>> +.Va d_unit . >>> +Care should be taken to ensure that only one driver creates aliases >>> +for any given name. >>> .Fn disk_resize >>> can be called by the driver after modifying >>> .Va d_mediasize >>> @@ -227,7 +243,13 @@ structure for this disk device. >>> .El >>> .Sh SEE ALSO >>> .Xr GEOM 4 , >>> -.Xr devfs 5 >>> +.Xr devfs 5 , >>> +.Xr MAKE_DEV 9 >>> .Sh AUTHORS >>> This manual page was written by >>> .An Robert Watson . >>> +.Sh BUGS >>> +Disk aliases are not a general purpose aliasing mechanism, but are >>> +intended only to ease the transition from one name to another. >>> +They can be used to ensure that nvd0 and nda0 are the same thing. >>> +They cannot be used to implement the diskX concept from macOS. >>> >>> Modified: head/sys/geom/geom_disk.c >>> ============================================================ >>> ================== >>> --- head/sys/geom/geom_disk.c Mon Aug 7 21:12:33 2017 (r322197) >>> +++ head/sys/geom/geom_disk.c Mon Aug 7 21:12:38 2017 (r322198) >>> @@ -676,6 +676,7 @@ g_disk_create(void *arg, int flag) >>> struct g_provider *pp; >>> struct disk *dp; >>> struct g_disk_softc *sc; >>> + struct disk_alias *dap; >>> char tmpstr[80]; >>> if (flag == EV_CANCEL) >>> @@ -704,6 +705,10 @@ g_disk_create(void *arg, int flag) >>> sc->dp = dp; >>> gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit); >>> gp->softc = sc; >>> + LIST_FOREACH(dap, &dp->d_aliases, da_next) { >>> + snprintf(tmpstr, sizeof(tmpstr), "%s%d", dap->da_alias, >>> dp->d_unit); >>> + g_geom_add_alias(gp, tmpstr); >>> + } >>> pp = g_new_providerf(gp, "%s", gp->name); >>> devstat_remove_entry(pp->stat); >>> pp->stat = NULL; >>> @@ -791,6 +796,7 @@ g_disk_destroy(void *ptr, int flag) >>> struct disk *dp; >>> struct g_geom *gp; >>> struct g_disk_softc *sc; >>> + struct disk_alias *dap, *daptmp; >>> g_topology_assert(); >>> dp = ptr; >>> @@ -802,6 +808,8 @@ g_disk_destroy(void *ptr, int flag) >>> dp->d_geom = NULL; >>> g_wither_geom(gp, ENXIO); >>> } >>> + LIST_FOREACH_SAFE(dap, &dp->d_aliases, da_next, daptmp) >>> + g_free(dap); >>> g_free(dp); >>> } >>> @@ -834,8 +842,11 @@ g_disk_ident_adjust(char *ident, size_t size) >>> struct disk * >>> disk_alloc(void) >>> { >>> + struct disk *dp; >>> - return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO)); >>> + dp = g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO); >>> + LIST_INIT(&dp->d_aliases); >>> + return (dp); >>> } >>> void >>> @@ -882,6 +893,18 @@ disk_destroy(struct disk *dp) >>> if (dp->d_devstat != NULL) >>> devstat_remove_entry(dp->d_devstat); >>> g_post_event(g_disk_destroy, dp, M_WAITOK, NULL); >>> +} >>> + >>> +void >>> +disk_add_alias(struct disk *dp, const char *name) >>> +{ >>> + struct disk_alias *dap; >>> + >>> + dap = (struct disk_alias *)g_malloc( >>> + sizeof(struct disk_alias) + strlen(name) + 1, M_WAITOK); >>> + strcpy((char *)(dap + 1), name); >>> + dap->da_alias = (const char *)(dap + 1); >>> + LIST_INSERT_HEAD(&dp->d_aliases, dap, da_next); >>> } >>> void >>> >>> Modified: head/sys/geom/geom_disk.h >>> ============================================================ >>> ================== >>> --- head/sys/geom/geom_disk.h Mon Aug 7 21:12:33 2017 (r322197) >>> +++ head/sys/geom/geom_disk.h Mon Aug 7 21:12:38 2017 (r322198) >>> @@ -66,6 +66,11 @@ typedef enum { >>> DISK_INIT_DONE >>> } disk_init_level; >>> +struct disk_alias { >>> + LIST_ENTRY(disk_alias) da_next; >>> + const char *da_alias; >>> +}; >>> + >>> struct disk { >>> /* Fields which are private to geom_disk */ >>> struct g_geom *d_geom; >>> @@ -109,6 +114,9 @@ struct disk { >>> /* Fields private to the driver */ >>> void *d_drv1; >>> + >>> + /* Fields private to geom_disk, to be moved on next version bump >>> */ >>> + LIST_HEAD(,disk_alias) d_aliases; >>> }; >>> #define DISKFLAG_RESERVED 0x1 /* Was NEEDSGIANT */ >>> @@ -132,6 +140,7 @@ void disk_attr_changed(struct disk *dp, const char >>> *at >>> void disk_media_changed(struct disk *dp, int flag); >>> void disk_media_gone(struct disk *dp, int flag); >>> int disk_resize(struct disk *dp, int flag); >>> +void disk_add_alias(struct disk *disk, const char *); >>> #define DISK_VERSION_00 0x58561059 >>> #define DISK_VERSION_01 0x5856105a >>> >>> >> > > From owner-svn-src-head@freebsd.org Mon Aug 7 22:42:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6ED5CDCDAC6; Mon, 7 Aug 2017 22:42:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BC8E2784; Mon, 7 Aug 2017 22:42:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77Mgkal038377; Mon, 7 Aug 2017 22:42:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77Mgk5H038376; Mon, 7 Aug 2017 22:42:46 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708072242.v77Mgk5H038376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 7 Aug 2017 22:42:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322206 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 322206 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 22:42:47 -0000 Author: imp Date: Mon Aug 7 22:42:46 2017 New Revision: 322206 URL: https://svnweb.freebsd.org/changeset/base/322206 Log: Eliminate useless adjustments of aliased device. No need to set any fields in the cloned device. devfs uses symlinks, so the adev entries returned won't be presented to the drivers. Since we don't save copies, nothing else will see them. This code came from the old compat code, and it appears to be obsolete or never needed. Submitted by: kib@ Differential Review: https://reviews.freebsd.org/D11919 Modified: head/sys/geom/geom_dev.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Mon Aug 7 22:30:18 2017 (r322205) +++ head/sys/geom/geom_dev.c Mon Aug 7 22:42:46 2017 (r322206) @@ -369,9 +369,6 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, __func__, gap->ga_alias, error); continue; } - adev->si_flags |= SI_UNMAPPED; - adev->si_iosize_max = dev->si_iosize_max; - adev->si_drv2 = dev->si_drv2; snprintf(buf, sizeof(buf), "cdev=%s", gap->ga_alias); devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK); } From owner-svn-src-head@freebsd.org Mon Aug 7 23:33:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60399DD02AD; Mon, 7 Aug 2017 23:33:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F04F636E2; Mon, 7 Aug 2017 23:33:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77NX6L5058684; Mon, 7 Aug 2017 23:33:06 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77NX6T7058679; Mon, 7 Aug 2017 23:33:06 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708072333.v77NX6T7058679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 7 Aug 2017 23:33:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322209 - head/sys/dev/mmc X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/mmc X-SVN-Commit-Revision: 322209 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2017 23:33:07 -0000 Author: marius Date: Mon Aug 7 23:33:05 2017 New Revision: 322209 URL: https://svnweb.freebsd.org/changeset/base/322209 Log: - If available, use TRIM instead of ERASE for implementing BIO_DELETE. This also involves adding a quirk table as TRIM is broken for some Kingston eMMC devices, though. Compared to ERASE (declared "legacy" in the eMMC specification v5.1), TRIM has the advantage of operating on write sectors rather than on erase sectors, which typically are of a much larger size. Thus, employing TRIM, we don't need to fiddle with coalescing BIO_DELETE requests that are also of (write) sector units into erase sectors, which might not even add up in all cases. - For some SanDisk iNAND devices, the CMD38 argument, e. g. ERASE, TRIM etc., has to be specified via EXT_CSD[113], which now is also handled via a quirk. - My initial understanding was that for eMMC partitions, the granularity should be used as erase sector size, e. g. 128 KB for boot partitions. However, rereading the relevant parts of the eMMC specification v5.1, this isn't actually correct. So drop the code which used partition granularities for delmaxsize and stripesize. For the most part, this change is a NOP, though, because a) for ERASE, mmcsd_delete() used the erase sector size unconditionally for all partitions anyway and b) g_disk_limit() doesn't actually take the stripesize into account. - Take some more advantage of mmcsd_errmsg() in mmcsd(4) for making error codes human readable. Modified: head/sys/dev/mmc/bridge.h head/sys/dev/mmc/mmc.c head/sys/dev/mmc/mmcreg.h head/sys/dev/mmc/mmcsd.c head/sys/dev/mmc/mmcvar.h Modified: head/sys/dev/mmc/bridge.h ============================================================================== --- head/sys/dev/mmc/bridge.h Mon Aug 7 23:32:00 2017 (r322208) +++ head/sys/dev/mmc/bridge.h Mon Aug 7 23:33:05 2017 (r322209) @@ -180,7 +180,7 @@ struct mmc_host { extern driver_t mmc_driver; extern devclass_t mmc_devclass; -#define MMC_VERSION 4 +#define MMC_VERSION 5 #define MMC_DECLARE_BRIDGE(name) \ DRIVER_MODULE(mmc, name, mmc_driver, mmc_devclass, NULL, NULL); \ Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Mon Aug 7 23:32:00 2017 (r322208) +++ head/sys/dev/mmc/mmc.c Mon Aug 7 23:33:05 2017 (r322209) @@ -104,12 +104,34 @@ struct mmc_ivars { uint32_t hs_tran_speed; /* Max speed in high speed mode */ uint32_t erase_sector; /* Card native erase sector size */ uint32_t cmd6_time; /* Generic switch timeout [us] */ + uint32_t quirks; /* Quirks as per mmc_quirk->quirks */ char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */ char card_sn_string[16];/* Formatted serial # for disk->d_ident */ }; #define CMD_RETRIES 3 +static const struct mmc_quirk mmc_quirks[] = { + /* + * For some SanDisk iNAND devices, the CMD38 argument needs to be + * provided in EXT_CSD[113]. + */ + { 0x2, 0x100, "SEM02G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM04G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM08G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM16G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM32G", MMC_QUIRK_INAND_CMD38 }, + + /* + * Disable TRIM for Kingston eMMCs where a firmware bug can lead to + * unrecoverable data corruption. + */ + { 0x70, MMC_QUIRK_OID_ANY, "V10008", MMC_QUIRK_BROKEN_TRIM }, + { 0x70, MMC_QUIRK_OID_ANY, "V10016", MMC_QUIRK_BROKEN_TRIM }, + + { 0x0, 0x0, NULL, 0x0 } +}; + static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver"); static int mmc_debug; @@ -1109,7 +1131,7 @@ mmc_format_card_id_string(struct mmc_ivars *ivar) /* * Format a card ID string for use by the mmcsd driver, it's what * appears between the <> in the following: - * mmcsd0: 968MB at mmc0 + * mmcsd0: 968MB at mmc0 * 22.5MHz/4bit/128-block * * Also format just the card serial number, which the mmcsd driver will @@ -1547,6 +1569,7 @@ mmc_log_card(device_t dev, struct mmc_ivars *ivar, int break; } } + device_printf(dev, " quirks: %b\n", ivar->quirks, MMC_QUIRKS_FMT); device_printf(dev, " bus: %ubit, %uMHz (%s timing)\n", (ivar->bus_width == bus_width_1 ? 1 : (ivar->bus_width == bus_width_4 ? 4 : 8)), @@ -1563,6 +1586,7 @@ mmc_discover_cards(struct mmc_softc *sc) u_char switch_res[64]; uint32_t raw_cid[4]; struct mmc_ivars *ivar = NULL; + const struct mmc_quirk *quirk; device_t child; int err, host_caps, i, newcard; uint32_t resp, sec_count, status; @@ -1870,6 +1894,18 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->raw_ext_csd[EXT_CSD_REV] >= 5); child_common: + for (quirk = &mmc_quirks[0]; quirk->mid != 0x0; quirk++) { + if ((quirk->mid == MMC_QUIRK_MID_ANY || + quirk->mid == ivar->cid.mid) && + (quirk->oid == MMC_QUIRK_OID_ANY || + quirk->oid == ivar->cid.oid) && + strncmp(quirk->pnm, ivar->cid.pnm, + sizeof(ivar->cid.pnm)) == 0) { + ivar->quirks = quirk->quirks; + break; + } + } + /* * Some cards that report maximum I/O block sizes greater * than 512 require the block length to be set to 512, even @@ -2470,6 +2506,12 @@ mmc_read_ivar(device_t bus, device_t child, int which, break; case MMC_IVAR_MAX_DATA: *result = mmcbr_get_max_data(bus); + break; + case MMC_IVAR_CMD6_TIMEOUT: + *result = ivar->cmd6_time; + break; + case MMC_IVAR_QUIRKS: + *result = ivar->quirks; break; case MMC_IVAR_CARD_ID_STRING: *(char **)result = ivar->card_id_string; Modified: head/sys/dev/mmc/mmcreg.h ============================================================================== --- head/sys/dev/mmc/mmcreg.h Mon Aug 7 23:32:00 2017 (r322208) +++ head/sys/dev/mmc/mmcreg.h Mon Aug 7 23:33:05 2017 (r322209) @@ -268,6 +268,13 @@ struct mmc_request { #define MMC_ERASE_GROUP_END 36 /* 37 -- reserved old command */ #define MMC_ERASE 38 +#define MMC_ERASE_ERASE 0x00000000 +#define MMC_ERASE_TRIM 0x00000001 +#define MMC_ERASE_FULE 0x00000002 +#define MMC_ERASE_DISCARD 0x00000003 +#define MMC_ERASE_SECURE_ERASE 0x80000000 +#define MMC_ERASE_SECURE_TRIM1 0x80000001 +#define MMC_ERASE_SECURE_TRIM2 0x80008000 /* Class 9: I/O mode commands */ #define MMC_FAST_IO 39 @@ -375,6 +382,7 @@ struct mmc_request { #define EXT_CSD_ERASE_TO_MULT 223 /* RO */ #define EXT_CSD_ERASE_GRP_SIZE 224 /* RO */ #define EXT_CSD_BOOT_SIZE_MULT 226 /* RO */ +#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ #define EXT_CSD_PWR_CL_200_195 236 /* RO */ #define EXT_CSD_PWR_CL_200_360 237 /* RO */ #define EXT_CSD_PWR_CL_52_195_DDR 238 /* RO */ @@ -459,6 +467,22 @@ struct mmc_request { #define EXT_CSD_STROBE_SUPPORT_EN 0x01 +#define EXT_CSD_SEC_FEATURE_SUPPORT_ER_EN 0x01 +#define EXT_CSD_SEC_FEATURE_SUPPORT_BD_BLK_EN 0x04 +#define EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN 0x10 +#define EXT_CSD_SEC_FEATURE_SUPPORT_SANITIZE 0x40 + +/* + * Vendor specific EXT_CSD fields + */ +/* SanDisk iNAND */ +#define EXT_CSD_INAND_CMD38 113 +#define EXT_CSD_INAND_CMD38_ERASE 0x00 +#define EXT_CSD_INAND_CMD38_TRIM 0x01 +#define EXT_CSD_INAND_CMD38_SECURE_ERASE 0x80 +#define EXT_CSD_INAND_CMD38_SECURE_TRIM1 0x81 +#define EXT_CSD_INAND_CMD38_SECURE_TRIM2 0x82 + #define MMC_TYPE_HS_26_MAX 26000000 #define MMC_TYPE_HS_52_MAX 52000000 #define MMC_TYPE_DDR52_MAX 52000000 @@ -600,8 +624,7 @@ struct mmc_cid { uint8_t fwrev; }; -struct mmc_csd -{ +struct mmc_csd { uint8_t csd_structure; uint8_t spec_vers; uint16_t ccc; @@ -627,16 +650,14 @@ struct mmc_csd wp_grp_enable:1; }; -struct mmc_scr -{ +struct mmc_scr { unsigned char sda_vsn; unsigned char bus_widths; #define SD_SCR_BUS_WIDTH_1 (1 << 0) #define SD_SCR_BUS_WIDTH_4 (1 << 2) }; -struct mmc_sd_status -{ +struct mmc_sd_status { uint8_t bus_width; uint8_t secured_mode; uint16_t card_type; @@ -648,6 +669,19 @@ struct mmc_sd_status uint8_t erase_timeout; uint8_t erase_offset; }; + +struct mmc_quirk { + uint32_t mid; +#define MMC_QUIRK_MID_ANY ((uint32_t)-1) + uint16_t oid; +#define MMC_QUIRK_OID_ANY ((uint16_t)-1) + const char *pnm; + uint32_t quirks; +#define MMC_QUIRK_INAND_CMD38 0x0001 +#define MMC_QUIRK_BROKEN_TRIM 0x0002 +}; + +#define MMC_QUIRKS_FMT "\020" "\001INAND_CMD38" "\002BROKEN_TRIM" /* * Various MMC/SD constants Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Mon Aug 7 23:32:00 2017 (r322208) +++ head/sys/dev/mmc/mmcsd.c Mon Aug 7 23:33:05 2017 (r322209) @@ -126,6 +126,10 @@ struct mmcsd_softc { uint8_t part_curr; /* Partition currently switched to */ uint8_t ext_csd[MMC_EXTCSD_SIZE]; uint16_t rca; + uint32_t flags; +#define MMCSD_INAND_CMD38 0x0001 +#define MMCSD_USE_TRIM 0x0002 + uint32_t cmd6_time; /* Generic switch timeout [us] */ uint32_t part_time; /* Partition switch timeout [us] */ off_t enh_base; /* Enhanced user data area slice base ... */ off_t enh_size; /* ... and size [bytes] */ @@ -168,9 +172,10 @@ static int mmcsd_ioctl_rpmb(struct cdev *dev, u_long c int fflag, struct thread *td); static void mmcsd_add_part(struct mmcsd_softc *sc, u_int type, - const char *name, u_int cnt, off_t media_size, off_t erase_size, bool ro); + const char *name, u_int cnt, off_t media_size, bool ro); static int mmcsd_bus_bit_width(device_t dev); static daddr_t mmcsd_delete(struct mmcsd_part *part, struct bio *bp); +static const char *mmcsd_errmsg(int e); static int mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data, int fflag); static int mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, @@ -221,6 +226,7 @@ mmcsd_attach(device_t dev) off_t erase_size, sector_size, size, wp_size; uintmax_t bytes; int err, i; + uint32_t quirks; uint8_t rev; bool comp, ro; char unit[2]; @@ -239,21 +245,48 @@ mmcsd_attach(device_t dev) * place either. */ sc->max_data = mmc_get_max_data(dev); - sc->erase_sector = mmc_get_erase_sector(dev); sc->high_cap = mmc_get_high_cap(dev); sc->rca = mmc_get_rca(dev); + sc->cmd6_time = mmc_get_cmd6_timeout(dev); + quirks = mmc_get_quirks(dev); /* Only MMC >= 4.x devices support EXT_CSD. */ if (mmc_get_spec_vers(dev) >= 4) { MMCBUS_ACQUIRE_BUS(mmcbus, dev); err = mmc_send_ext_csd(mmcbus, dev, sc->ext_csd); MMCBUS_RELEASE_BUS(mmcbus, dev); - if (err != MMC_ERR_NONE) - bzero(sc->ext_csd, sizeof(sc->ext_csd)); + if (err != MMC_ERR_NONE) { + device_printf(dev, "Error reading EXT_CSD %s\n", + mmcsd_errmsg(err)); + return (ENXIO); + } } ext_csd = sc->ext_csd; + if ((quirks & MMC_QUIRK_INAND_CMD38) != 0) { + if (mmc_get_spec_vers(dev) < 4) { + device_printf(dev, + "MMC_QUIRK_INAND_CMD38 set but no EXT_CSD\n"); + return (EINVAL); + } + sc->flags |= MMCSD_INAND_CMD38; + } + /* + * EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN denotes support for both + * insecure and secure TRIM. + */ + if ((ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT] & + EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN) != 0 && + (quirks & MMC_QUIRK_BROKEN_TRIM) == 0) { + if (bootverbose) + device_printf(dev, "taking advantage of TRIM\n"); + sc->flags |= MMCSD_USE_TRIM; + sc->erase_sector = 1; + } else + sc->erase_sector = mmc_get_erase_sector(dev); + + /* * Enhanced user data area and general purpose partitions are only * supported in revision 1.4 (EXT_CSD_REV == 4) and later, the RPMB * partition in revision 1.5 (MMC v4.41, EXT_CSD_REV == 5) and later. @@ -306,8 +339,7 @@ mmcsd_attach(device_t dev) */ ro = mmc_get_read_only(dev); mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_DEFAULT, "mmcsd", - device_get_unit(dev), mmc_get_media_size(dev) * sector_size, - sc->erase_sector * sector_size, ro); + device_get_unit(dev), mmc_get_media_size(dev) * sector_size, ro); if (mmc_get_spec_vers(dev) < 3) return (0); @@ -332,11 +364,11 @@ mmcsd_attach(device_t dev) size = ext_csd[EXT_CSD_BOOT_SIZE_MULT] * MMC_BOOT_RPMB_BLOCK_SIZE; if (size > 0 && (mmcbr_get_caps(mmcbus) & MMC_CAP_BOOT_NOACC) == 0) { mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_BOOT0, - MMCSD_FMT_BOOT, 0, size, MMC_BOOT_RPMB_BLOCK_SIZE, + MMCSD_FMT_BOOT, 0, size, ro | ((ext_csd[EXT_CSD_BOOT_WP_STATUS] & EXT_CSD_BOOT_WP_STATUS_BOOT0_MASK) != 0)); mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_BOOT1, - MMCSD_FMT_BOOT, 1, size, MMC_BOOT_RPMB_BLOCK_SIZE, + MMCSD_FMT_BOOT, 1, size, ro | ((ext_csd[EXT_CSD_BOOT_WP_STATUS] & EXT_CSD_BOOT_WP_STATUS_BOOT1_MASK) != 0)); } @@ -345,7 +377,7 @@ mmcsd_attach(device_t dev) size = ext_csd[EXT_CSD_RPMB_MULT] * MMC_BOOT_RPMB_BLOCK_SIZE; if (rev >= 5 && size > 0) mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_RPMB, - MMCSD_FMT_RPMB, 0, size, MMC_BOOT_RPMB_BLOCK_SIZE, ro); + MMCSD_FMT_RPMB, 0, size, ro); if (rev <= 3 || comp == FALSE) return (0); @@ -365,8 +397,7 @@ mmcsd_attach(device_t dev) if (size == 0) continue; mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_GP0 + i, - MMCSD_FMT_GP, i, size * erase_size * wp_size, - erase_size, ro); + MMCSD_FMT_GP, i, size * erase_size * wp_size, ro); } } return (0); @@ -419,7 +450,7 @@ static struct cdevsw mmcsd_rpmb_cdevsw = { static void mmcsd_add_part(struct mmcsd_softc *sc, u_int type, const char *name, u_int cnt, - off_t media_size, off_t erase_size, bool ro) + off_t media_size, bool ro) { struct make_dev_args args; device_t dev, mmcbus; @@ -482,10 +513,10 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, con d->d_sectorsize = mmc_get_sector_size(dev); d->d_maxsize = sc->max_data * d->d_sectorsize; d->d_mediasize = media_size; - d->d_stripesize = erase_size; + d->d_stripesize = sc->erase_sector * d->d_sectorsize; d->d_unit = cnt; d->d_flags = DISKFLAG_CANDELETE; - d->d_delmaxsize = erase_size; + d->d_delmaxsize = mmc_get_erase_sector(dev) * d->d_sectorsize; strlcpy(d->d_ident, mmc_get_card_sn_string(dev), sizeof(d->d_ident)); strlcpy(d->d_descr, mmc_get_card_id_string(dev), @@ -1151,6 +1182,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) struct mmcsd_softc *sc; device_t dev, mmcbus; u_int erase_sector, sz; + int err; + bool use_trim; sc = part->sc; dev = sc->dev; @@ -1159,24 +1192,46 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) block = bp->bio_pblkno; sz = part->disk->d_sectorsize; end = bp->bio_pblkno + (bp->bio_bcount / sz); - /* Coalesce with part remaining from previous request. */ - if (block > part->eblock && block <= part->eend) - block = part->eblock; - if (end >= part->eblock && end < part->eend) - end = part->eend; - /* Safe round to the erase sector boundaries. */ - erase_sector = sc->erase_sector; - start = block + erase_sector - 1; /* Round up. */ - start -= start % erase_sector; - stop = end; /* Round down. */ - stop -= end % erase_sector; - /* We can't erase an area smaller than a sector, store it for later. */ - if (start >= stop) { - part->eblock = block; - part->eend = end; - return (end); + use_trim = sc->flags & MMCSD_USE_TRIM; + if (use_trim == true) { + start = block; + stop = end; + } else { + /* Coalesce with the remainder of the previous request. */ + if (block > part->eblock && block <= part->eend) + block = part->eblock; + if (end >= part->eblock && end < part->eend) + end = part->eend; + /* Safely round to the erase sector boundaries. */ + erase_sector = sc->erase_sector; + start = block + erase_sector - 1; /* Round up. */ + start -= start % erase_sector; + stop = end; /* Round down. */ + stop -= end % erase_sector; + /* + * We can't erase an area smaller than an erase sector, so + * store it for later. + */ + if (start >= stop) { + part->eblock = block; + part->eend = end; + return (end); + } } + if ((sc->flags & MMCSD_INAND_CMD38) != 0) { + err = mmc_switch(mmcbus, dev, sc->rca, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_INAND_CMD38, use_trim == true ? + EXT_CSD_INAND_CMD38_TRIM : EXT_CSD_INAND_CMD38_ERASE, + sc->cmd6_time, true); + if (err != MMC_ERR_NONE) { + device_printf(dev, + "Setting iNAND erase command failed %s\n", + mmcsd_errmsg(err)); + return (block); + } + } + /* * Pause re-tuning so it won't interfere with the order of erase * commands. Note that these latter don't use the data lines, so @@ -1198,8 +1253,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - device_printf(dev, "Setting erase start position failed %d\n", - req.cmd->error); + device_printf(dev, "Setting erase start position failed %s\n", + mmcsd_errmsg(req.cmd->error)); block = bp->bio_pblkno; goto unpause; } @@ -1218,8 +1273,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - device_printf(dev, "Setting erase stop position failed %d\n", - req.cmd->error); + device_printf(dev, "Setting erase stop position failed %s\n", + mmcsd_errmsg(req.cmd->error)); block = bp->bio_pblkno; goto unpause; } @@ -1228,23 +1283,24 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) memset(&cmd, 0, sizeof(cmd)); req.cmd = &cmd; cmd.opcode = MMC_ERASE; - cmd.arg = 0; + cmd.arg = use_trim == true ? MMC_ERASE_TRIM : MMC_ERASE_ERASE; cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - device_printf(dev, "erase err3: %d\n", req.cmd->error); - device_printf(dev, "Issuing erase command failed %d\n", - req.cmd->error); + device_printf(dev, "Issuing erase command failed %s\n", + mmcsd_errmsg(req.cmd->error)); block = bp->bio_pblkno; goto unpause; } - /* Store one of remaining parts for the next call. */ - if (bp->bio_pblkno >= part->eblock || block == start) { - part->eblock = stop; /* Predict next forward. */ - part->eend = end; - } else { - part->eblock = block; /* Predict next backward. */ - part->eend = start; + if (use_trim == false) { + /* Store one of the remaining parts for the next call. */ + if (bp->bio_pblkno >= part->eblock || block == start) { + part->eblock = stop; /* Predict next forward. */ + part->eend = end; + } else { + part->eblock = block; /* Predict next backward. */ + part->eend = start; + } } block = end; unpause: Modified: head/sys/dev/mmc/mmcvar.h ============================================================================== --- head/sys/dev/mmc/mmcvar.h Mon Aug 7 23:32:00 2017 (r322208) +++ head/sys/dev/mmc/mmcvar.h Mon Aug 7 23:33:05 2017 (r322209) @@ -68,6 +68,8 @@ enum mmc_device_ivars { MMC_IVAR_BUS_WIDTH, MMC_IVAR_ERASE_SECTOR, MMC_IVAR_MAX_DATA, + MMC_IVAR_CMD6_TIMEOUT, + MMC_IVAR_QUIRKS, MMC_IVAR_CARD_ID_STRING, MMC_IVAR_CARD_SN_STRING, }; @@ -90,6 +92,8 @@ MMC_ACCESSOR(card_type, CARD_TYPE, int) MMC_ACCESSOR(bus_width, BUS_WIDTH, int) MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int) MMC_ACCESSOR(max_data, MAX_DATA, int) +MMC_ACCESSOR(cmd6_timeout, CMD6_TIMEOUT, u_int) +MMC_ACCESSOR(quirks, QUIRKS, u_int) MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *) MMC_ACCESSOR(card_sn_string, CARD_SN_STRING, const char *) From owner-svn-src-head@freebsd.org Tue Aug 8 00:31:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1ECDDD2CD9; Tue, 8 Aug 2017 00:31:11 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FCB365092; Tue, 8 Aug 2017 00:31:11 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v780VAK0081188; Tue, 8 Aug 2017 00:31:10 GMT (envelope-from lstewart@FreeBSD.org) Received: (from lstewart@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v780VAij081187; Tue, 8 Aug 2017 00:31:10 GMT (envelope-from lstewart@FreeBSD.org) Message-Id: <201708080031.v780VAij081187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lstewart set sender to lstewart@FreeBSD.org using -f From: Lawrence Stewart Date: Tue, 8 Aug 2017 00:31:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322210 - head/bin/pkill X-SVN-Group: head X-SVN-Commit-Author: lstewart X-SVN-Commit-Paths: head/bin/pkill X-SVN-Commit-Revision: 322210 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 00:31:11 -0000 Author: lstewart Date: Tue Aug 8 00:31:10 2017 New Revision: 322210 URL: https://svnweb.freebsd.org/changeset/base/322210 Log: pgrep naively appends the delimiter to all PIDs including the last e.g. "pgrep -d, getty" outputs "1399,1386,1309,1308,1307,1306,1305,1302," Ensure the list is correctly delimited by suppressing the emission of the delimiter after the final PID. Reviewed by: imp, kib MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D8537 Modified: head/bin/pkill/pkill.c Modified: head/bin/pkill/pkill.c ============================================================================== --- head/bin/pkill/pkill.c Mon Aug 7 23:33:05 2017 (r322209) +++ head/bin/pkill/pkill.c Tue Aug 8 00:31:10 2017 (r322210) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -656,10 +657,12 @@ killact(const struct kinfo_proc *kp) static int grepact(const struct kinfo_proc *kp) { + static bool first = true; - show_process(kp); - if (!quiet) + if (!quiet && !first) printf("%s", delim); + show_process(kp); + first = false; return (1); } From owner-svn-src-head@freebsd.org Tue Aug 8 04:10:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5270ADBE781; Tue, 8 Aug 2017 04:10:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F2F96D450; Tue, 8 Aug 2017 04:10:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v784AlOG069261; Tue, 8 Aug 2017 04:10:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v784AkDP069258; Tue, 8 Aug 2017 04:10:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708080410.v784AkDP069258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 8 Aug 2017 04:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322211 - in head: contrib/netbsd-tests/lib/libc/regex/data lib/libc/regex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: contrib/netbsd-tests/lib/libc/regex/data lib/libc/regex X-SVN-Commit-Revision: 322211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 04:10:48 -0000 Author: kevans Date: Tue Aug 8 04:10:46 2017 New Revision: 322211 URL: https://svnweb.freebsd.org/changeset/base/322211 Log: regex(3): Handle invalid {} constructs consistently and adjust tests Currently, regex(3) exhibits the following wrong behavior as demonstrated with sed: - echo "a{1,2,3}b" | sed -r "s/{/_/" (1) - echo "a{1,2,3}b" | sed "s/\}/_/" (2) - echo "a{1,2,3}b" | sed -r "s/{}/_/" (3) Cases (1) and (3) should throw errors but they actually succeed, and (2) throws an error when it should match the literal '}'. The correct behavior was decided by comparing to the behavior with the equivalent BRE (1)(3) or ERE (2) and consulting POSIX, along with some reasonable evaluation. Tests were also adjusted/added accordingly. PR: 166861 Reviewed by: emaste, ngie, pfg Approved by: emaste (mentor) MFC after: never Differential Revision: https://reviews.freebsd.org/D10315 Modified: head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in head/lib/libc/regex/regcomp.c Modified: head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in ============================================================================== --- head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in Tue Aug 8 00:31:10 2017 (r322210) +++ head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in Tue Aug 8 04:10:46 2017 (r322211) @@ -1,9 +1,24 @@ # the dreaded bounded repetitions -{ & { { -{abc & {abc {abc +# Begin FreeBSD +{ C BADRPT +{ b { { +\{ - { { +\{ bC BADRPT +{} C BADRPT +{} b {} {} +\{\} - {} {} +\{\} bC BADRPT +} & } } +\} & } } +{abc b {abc {abc +{abc C BADRPT +# End FreeBSD {1 C BADRPT {1} C BADRPT -a{b & a{b a{b +# Begin FreeBSD +a{b b a{b a{b +a{b C BADRPT +# End FreeBSD a{1}b - ab ab a\{1\}b b ab ab a{1,}b - ab ab @@ -16,9 +31,15 @@ a{1a C EBRACE a\{1a bC EBRACE a{1a} C BADBR a\{1a\} bC BADBR -a{,2} - a{,2} a{,2} +# Begin FreeBSD +a{,2} b a{,2} a{,2} +a{,2} C BADBR +# End FreeBSD a\{,2\} bC BADBR -a{,} - a{,} a{,} +# Begin FreeBSD +a{,} b a{,} a{,} +a{,} C BADBR +# End FreeBSD a\{,\} bC BADBR a{1,x} C BADBR a\{1,x\} bC BADBR Modified: head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in ============================================================================== --- head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in Tue Aug 8 00:31:10 2017 (r322210) +++ head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in Tue Aug 8 04:10:46 2017 (r322211) @@ -15,7 +15,10 @@ a?{1} C BADRPT a{1}* C BADRPT a{1}+ C BADRPT a{1}? C BADRPT -a*{b} - a{b} a{b} +# Begin FreeBSD +a*{b} b a{b} a{b} +a*{b} C BADRPT +# End FreeBSD a\{1\}\{1\} bC BADRPT a*\{1\} bC BADRPT a\{1\}* bC BADRPT Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Tue Aug 8 00:31:10 2017 (r322210) +++ head/lib/libc/regex/regcomp.c Tue Aug 8 04:10:46 2017 (r322211) @@ -412,6 +412,7 @@ p_ere_exp(struct parse *p, struct branchc *bc) case '*': case '+': case '?': + case '{': SETERROR(REG_BADRPT); break; case '.': @@ -438,9 +439,6 @@ p_ere_exp(struct parse *p, struct branchc *bc) break; } break; - case '{': /* okay as ordinary except if digit follows */ - (void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT); - /* FALLTHROUGH */ default: if (p->error != 0) return (false); @@ -454,9 +452,11 @@ p_ere_exp(struct parse *p, struct branchc *bc) return (false); c = PEEK(); /* we call { a repetition if followed by a digit */ - if (!( c == '*' || c == '+' || c == '?' || - (c == '{' && MORE2() && isdigit((uch)PEEK2())) )) + if (!( c == '*' || c == '+' || c == '?' || c == '{')) return (false); /* no repetition, we're done */ + else if (c == '{') + (void)REQUIRE(MORE2() && \ + (isdigit((uch)PEEK2()) || PEEK2() == ','), REG_BADRPT); NEXT(); (void)REQUIRE(!wascaret, REG_BADRPT); @@ -757,7 +757,6 @@ p_simp_re(struct parse *p, struct branchc *bc) (void)REQUIRE(EATTWO('\\', ')'), REG_EPAREN); break; case BACKSL|')': /* should not get here -- must be user */ - case BACKSL|'}': SETERROR(REG_EPAREN); break; case BACKSL|'1': From owner-svn-src-head@freebsd.org Tue Aug 8 04:30:24 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 458C8DBF97E; Tue, 8 Aug 2017 04:30:24 +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 mx1.freebsd.org (Postfix) with ESMTPS id 120A36DEFD; Tue, 8 Aug 2017 04:30:24 +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 v784UN0e077232; Tue, 8 Aug 2017 04:30:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v784UN92077230; Tue, 8 Aug 2017 04:30:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708080430.v784UN92077230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 8 Aug 2017 04:30:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322212 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 322212 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 04:30:24 -0000 Author: markj Date: Tue Aug 8 04:30:22 2017 New Revision: 322212 URL: https://svnweb.freebsd.org/changeset/base/322212 Log: Add macros for defining attribute groups and for WO and RW attributes. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11872 Modified: head/sys/compat/linuxkpi/common/include/linux/device.h head/sys/compat/linuxkpi/common/include/linux/sysfs.h Modified: head/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/device.h Tue Aug 8 04:10:46 2017 (r322211) +++ head/sys/compat/linuxkpi/common/include/linux/device.h Tue Aug 8 04:30:22 2017 (r322212) @@ -142,7 +142,13 @@ struct device_attribute { #define DEVICE_ATTR(_name, _mode, _show, _store) \ struct device_attribute dev_attr_##_name = \ - { { #_name, NULL, _mode }, _show, _store } + __ATTR(_name, _mode, _show, _store) +#define DEVICE_ATTR_RO(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_RO(_name) +#define DEVICE_ATTR_WO(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_WO(_name) +#define DEVICE_ATTR_RW(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_RW(_name) /* Simple class attribute that is just a static string */ struct class_attribute_string { Modified: head/sys/compat/linuxkpi/common/include/linux/sysfs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/sysfs.h Tue Aug 8 04:10:46 2017 (r322211) +++ head/sys/compat/linuxkpi/common/include/linux/sysfs.h Tue Aug 8 04:30:22 2017 (r322212) @@ -54,13 +54,20 @@ struct attribute_group { .attr = { .name = __stringify(_name), .mode = _mode }, \ .show = _show, .store = _store, \ } +#define __ATTR_RO(_name) __ATTR(_name, 0444, _name##_show, NULL) +#define __ATTR_WO(_name) __ATTR(_name, 0200, NULL, _name##_store) +#define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store) -#define __ATTR_RO(_name) { \ - .attr = { .name = __stringify(_name), .mode = 0444 }, \ - .show = _name##_show, \ -} - #define __ATTR_NULL { .attr = { .name = NULL } } + +#define ATTRIBUTE_GROUPS(_name) \ + static struct attribute_group _name##_group = { \ + .attrs = _name##_attrs, \ + }; \ + static struct attribute_group *_name##_groups[] = { \ + &_name##_group, \ + NULL, \ + }; /* * Handle our generic '\0' terminated 'C' string. From owner-svn-src-head@freebsd.org Tue Aug 8 04:34:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0F7ADBFE4B; Tue, 8 Aug 2017 04:34:03 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9CE016E390; Tue, 8 Aug 2017 04:34:03 +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 v784Y2I3081105; Tue, 8 Aug 2017 04:34:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v784Y2ph081103; Tue, 8 Aug 2017 04:34:02 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708080434.v784Y2ph081103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 8 Aug 2017 04:34:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322213 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 322213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 04:34:03 -0000 Author: markj Date: Tue Aug 8 04:34:02 2017 New Revision: 322213 URL: https://svnweb.freebsd.org/changeset/base/322213 Log: Add round_jiffies_up(), local_clock() and __setup_timer() to the LinuxKPI. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11871 Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h head/sys/compat/linuxkpi/common/include/linux/timer.h Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/sched.h Tue Aug 8 04:30:22 2017 (r322212) +++ head/sys/compat/linuxkpi/common/include/linux/sched.h Tue Aug 8 04:34:02 2017 (r322213) @@ -36,14 +36,16 @@ #include #include #include +#include +#include #include #include +#include #include #include -#include #include -#include +#include #include @@ -149,5 +151,14 @@ int linux_schedule_timeout(int timeout); #define io_schedule() schedule() #define io_schedule_timeout(timeout) schedule_timeout(timeout) + +static inline uint64_t +local_clock(void) +{ + struct timespec ts; + + nanotime(&ts); + return ((uint64_t)ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec); +} #endif /* _LINUX_SCHED_H_ */ Modified: head/sys/compat/linuxkpi/common/include/linux/timer.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/timer.h Tue Aug 8 04:30:22 2017 (r322212) +++ head/sys/compat/linuxkpi/common/include/linux/timer.h Tue Aug 8 04:34:02 2017 (r322213) @@ -46,15 +46,20 @@ struct timer_list { extern unsigned long linux_timer_hz_mask; -#define setup_timer(timer, func, dat) \ -do { \ +#define TIMER_IRQSAFE 0x0001 + +#define setup_timer(timer, func, dat) do { \ (timer)->function = (func); \ (timer)->data = (dat); \ callout_init(&(timer)->timer_callout, 1); \ } while (0) -#define init_timer(timer) \ -do { \ +#define __setup_timer(timer, func, dat, flags) do { \ + CTASSERT(((flags) & ~TIMER_IRQSAFE) == 0); \ + setup_timer(timer, func, dat); \ +} while (0) + +#define init_timer(timer) do { \ (timer)->function = NULL; \ (timer)->data = 0; \ callout_init(&(timer)->timer_callout, 1); \ @@ -67,9 +72,10 @@ extern void add_timer_on(struct timer_list *, int cpu) #define del_timer(timer) callout_stop(&(timer)->timer_callout) #define del_timer_sync(timer) callout_drain(&(timer)->timer_callout) #define timer_pending(timer) callout_pending(&(timer)->timer_callout) -#define round_jiffies(j) \ +#define round_jiffies(j) \ ((unsigned long)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask)) -#define round_jiffies_relative(j) \ - round_jiffies(j) +#define round_jiffies_relative(j) round_jiffies(j) +#define round_jiffies_up(j) round_jiffies(j) +#define round_jiffies_up_relative(j) round_jiffies_up(j) #endif /* _LINUX_TIMER_H_ */ From owner-svn-src-head@freebsd.org Tue Aug 8 04:59:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A45EDC1375; Tue, 8 Aug 2017 04:59:18 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA0086ED98; Tue, 8 Aug 2017 04:59:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v784xGIH089104; Tue, 8 Aug 2017 04:59:16 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v784xGvm089103; Tue, 8 Aug 2017 04:59:16 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708080459.v784xGvm089103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 8 Aug 2017 04:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322214 - in head/tests: etc/rc.d sys/acl sys/file sys/geom/class/eli sys/geom/class/gate sys/geom/class/mirror sys/geom/class/nop sys/geom/class/uzip sys/kern sys/kqueue/libkqueue sys/... X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in head/tests: etc/rc.d sys/acl sys/file sys/geom/class/eli sys/geom/class/gate sys/geom/class/mirror sys/geom/class/nop sys/geom/class/uzip sys/kern sys/kqueue/libkqueue sys/mac/portacl sys/mqueue sy... X-SVN-Commit-Revision: 322214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 04:59:18 -0000 Author: ngie Date: Tue Aug 8 04:59:16 2017 New Revision: 322214 URL: https://svnweb.freebsd.org/changeset/base/322214 Log: Make test scripts under tests/... non-executable Executable bits should be set at install time instead of in the repo. Setting executable bits on files triggers false positives with Phabricator. MFC after: 2 months Modified: Directory Properties: head/tests/etc/rc.d/routing_test.sh (props changed) head/tests/sys/acl/aclfuzzer.sh (props changed) head/tests/sys/acl/mktrivial.sh (props changed) head/tests/sys/file/flock_test.sh (props changed) head/tests/sys/geom/class/eli/conf.sh (props changed) head/tests/sys/geom/class/eli/init_alias_test.sh (props changed) head/tests/sys/geom/class/gate/ggate_test.sh (props changed) head/tests/sys/geom/class/mirror/8_test.sh (props changed) head/tests/sys/geom/class/mirror/9_test.sh (props changed) head/tests/sys/geom/class/nop/nop_test.sh (props changed) head/tests/sys/geom/class/uzip/conf.sh (props changed) head/tests/sys/kern/coredump_phnum_test.sh (props changed) head/tests/sys/kqueue/libkqueue/kqueue_test.sh (props changed) head/tests/sys/mac/portacl/misc.sh (props changed) head/tests/sys/mac/portacl/nobody_test.sh (props changed) head/tests/sys/mac/portacl/root_test.sh (props changed) head/tests/sys/mqueue/mqueue_test.sh (props changed) head/tests/sys/netinet/fibs_test.sh (props changed) head/tests/sys/opencrypto/runtests.sh (props changed) head/tests/sys/vfs/trailing_slash.sh (props changed) From owner-svn-src-head@freebsd.org Tue Aug 8 10:30:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C8D9DD1A20; Tue, 8 Aug 2017 10:30:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59CAA7D69B; Tue, 8 Aug 2017 10:30:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78AUnlj022476; Tue, 8 Aug 2017 10:30:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AUnST022475; Tue, 8 Aug 2017 10:30:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081030.v78AUnST022475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 10:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322218 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 322218 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 10:30:50 -0000 Author: avg Date: Tue Aug 8 10:30:49 2017 New Revision: 322218 URL: https://svnweb.freebsd.org/changeset/base/322218 Log: MFV r322217: 8418 zfs_prop_get_table() call in zfs_validate_name() is a no-op illumos/illumos-gate@e09ba01dcda5e24964b8632718777b39166d86e4 https://github.com/illumos/illumos-gate/commit/e09ba01dcda5e24964b8632718777b39166d86e4 https://www.illumos.org/issues/8418 The following line in zfs_validate_name() is just a no-op and it should be removed: 108 (void) zfs_prop_get_table(); Reviewed by: Vitaliy Gusev Approved by: Matthew Ahrens Author: Marcel Telka MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Aug 8 10:28:01 2017 (r322217) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Aug 8 10:30:49 2017 (r322218) @@ -103,7 +103,6 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *pa namecheck_err_t why; char what; - (void) zfs_prop_get_table(); if (entity_namecheck(path, &why, &what) != 0) { if (hdl != NULL) { switch (why) { From owner-svn-src-head@freebsd.org Tue Aug 8 10:36:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35654DD1F20; Tue, 8 Aug 2017 10:36:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F08817DBF5; Tue, 8 Aug 2017 10:36:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78Aa8rg026472; Tue, 8 Aug 2017 10:36:08 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Aa81J026471; Tue, 8 Aug 2017 10:36:08 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081036.v78Aa81J026471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 10:36:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322220 - head/sys/cddl/contrib/opensolaris X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris X-SVN-Commit-Revision: 322220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 10:36:09 -0000 Author: avg Date: Tue Aug 8 10:36:07 2017 New Revision: 322220 URL: https://svnweb.freebsd.org/changeset/base/322220 Log: MFV r322219: 8416 abd.h is not C++ friendly FreeBSD note: this is a record-only commit, we had to apply the change in r320156. illumos/illumos-gate@5e2a074725cb7c16ea1c6554da11ab4d6b4e7aee https://github.com/illumos/illumos-gate/commit/5e2a074725cb7c16ea1c6554da11ab4d6b4e7aee https://www.illumos.org/issues/8416 A C++ compiler fails to compile abd_is_linear(), which is an inline function defined in abd.h, with the following error: error: cannot initialize return object of type 'boolean_t' with an rvalue of type 'bool' That happens because a bool can not be converted to an enum in C++. That's a problem because abd.h can be visible through other header files that a C++ program that works with ZFS can include. Reviewed by: Igor Kozhukhov Reviewed by: Dan Kimmel Reviewed by: Alek Pinchuk Approved by: Robert Mustacchi Author: Andriy Gapon Modified: Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) From owner-svn-src-head@freebsd.org Tue Aug 8 10:43:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A5EEDD28B4; Tue, 8 Aug 2017 10:43:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63C1A7E3C0; Tue, 8 Aug 2017 10:43:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78Ahfel030337; Tue, 8 Aug 2017 10:43:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Ahf0E030336; Tue, 8 Aug 2017 10:43:41 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081043.v78Ahf0E030336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 10:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322222 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 322222 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 10:43:42 -0000 Author: avg Date: Tue Aug 8 10:43:41 2017 New Revision: 322222 URL: https://svnweb.freebsd.org/changeset/base/322222 Log: MFV r322221: 7910 l2arc_write_buffers() may write beyond target_sz FreeBD note: the essence of this change was committed to FreeBSD in r314274. This commit catches up with differences between what was committed to FreeBSD and what was committed to OpenZFS, mainly more logical variable names. illumos/illumos-gate@16a7e5ac116c85d965007a5f201104b564e82210 https://github.com/illumos/illumos-gate/commit/16a7e5ac116c85d965007a5f201104b564e82210 https://www.illumos.org/issues/7910 It seems that the change in issue #6950 resurrected the problem that was earlier fixed by the change in issue #5219. Please also see the following FreeBSD bug report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216178 Reviewed by: George Wilson Reviewed by: Dan Kimmel Approved by: Robert Mustacchi Author: Andriy Gapon MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Aug 8 10:37:03 2017 (r322221) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Aug 8 10:43:41 2017 (r322222) @@ -712,8 +712,8 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_abort_lowmem; kstat_named_t arcstat_l2_cksum_bad; kstat_named_t arcstat_l2_io_error; - kstat_named_t arcstat_l2_size; - kstat_named_t arcstat_l2_asize; + kstat_named_t arcstat_l2_lsize; + kstat_named_t arcstat_l2_psize; kstat_named_t arcstat_l2_hdr_size; kstat_named_t arcstat_l2_write_trylock_fail; kstat_named_t arcstat_l2_write_passed_headroom; @@ -3338,19 +3338,19 @@ arc_hdr_l2hdr_destroy(arc_buf_hdr_t *hdr) { l2arc_buf_hdr_t *l2hdr = &hdr->b_l2hdr; l2arc_dev_t *dev = l2hdr->b_dev; - uint64_t asize = arc_hdr_size(hdr); + uint64_t psize = arc_hdr_size(hdr); ASSERT(MUTEX_HELD(&dev->l2ad_mtx)); ASSERT(HDR_HAS_L2HDR(hdr)); list_remove(&dev->l2ad_buflist, hdr); - ARCSTAT_INCR(arcstat_l2_asize, -asize); - ARCSTAT_INCR(arcstat_l2_size, -HDR_GET_LSIZE(hdr)); + ARCSTAT_INCR(arcstat_l2_psize, -psize); + ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr)); - vdev_space_update(dev->l2ad_vdev, -asize, 0, 0); + vdev_space_update(dev->l2ad_vdev, -psize, 0, 0); - (void) refcount_remove_many(&dev->l2ad_alloc, asize, hdr); + (void) refcount_remove_many(&dev->l2ad_alloc, psize, hdr); arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR); } @@ -7051,8 +7051,8 @@ top: l2arc_trim(hdr); arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR); - ARCSTAT_INCR(arcstat_l2_asize, -arc_hdr_size(hdr)); - ARCSTAT_INCR(arcstat_l2_size, -HDR_GET_LSIZE(hdr)); + ARCSTAT_INCR(arcstat_l2_psize, -arc_hdr_size(hdr)); + ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr)); bytes_dropped += arc_hdr_size(hdr); (void) refcount_remove_many(&dev->l2ad_alloc, @@ -7311,7 +7311,7 @@ top: /* * This doesn't exist in the ARC. Destroy. * arc_hdr_destroy() will call list_remove() - * and decrement arcstat_l2_size. + * and decrement arcstat_l2_lsize. */ arc_change_state(arc_anon, hdr, hash_lock); arc_hdr_destroy(hdr); @@ -7353,7 +7353,7 @@ static uint64_t l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) { arc_buf_hdr_t *hdr, *hdr_prev, *head; - uint64_t write_asize, write_psize, write_sz, headroom; + uint64_t write_asize, write_psize, write_lsize, headroom; boolean_t full; l2arc_write_callback_t *cb; zio_t *pio, *wzio; @@ -7363,7 +7363,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint ASSERT3P(dev->l2ad_vdev, !=, NULL); pio = NULL; - write_sz = write_asize = write_psize = 0; + write_lsize = write_asize = write_psize = 0; full = B_FALSE; head = kmem_cache_alloc(hdr_l2only_cache, KM_PUSHPAGE); arc_hdr_set_flags(head, ARC_FLAG_L2_WRITE_HEAD | ARC_FLAG_HAS_L2HDR); @@ -7440,11 +7440,11 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint ASSERT3U(HDR_GET_PSIZE(hdr), >, 0); ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); ASSERT3U(arc_hdr_size(hdr), >, 0); - uint64_t size = arc_hdr_size(hdr); + uint64_t psize = arc_hdr_size(hdr); uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev, - size); + psize); - if ((write_psize + asize) > target_sz) { + if ((write_asize + asize) > target_sz) { full = B_TRUE; mutex_exit(hash_lock); ARCSTAT_BUMP(arcstat_l2_write_full); @@ -7479,7 +7479,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint list_insert_head(&dev->l2ad_buflist, hdr); mutex_exit(&dev->l2ad_mtx); - (void) refcount_add_many(&dev->l2ad_alloc, size, hdr); + (void) refcount_add_many(&dev->l2ad_alloc, psize, hdr); /* * Normally the L2ARC can use the hdr's data, but if @@ -7496,15 +7496,15 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint * add it to the l2arc_free_on_write queue. */ abd_t *to_write; - if (!HDR_SHARED_DATA(hdr) && size == asize) { + if (!HDR_SHARED_DATA(hdr) && psize == asize) { to_write = hdr->b_l1hdr.b_pabd; } else { to_write = abd_alloc_for_io(asize, HDR_ISTYPE_METADATA(hdr)); - abd_copy(to_write, hdr->b_l1hdr.b_pabd, size); - if (asize != size) { - abd_zero_off(to_write, size, - asize - size); + abd_copy(to_write, hdr->b_l1hdr.b_pabd, psize); + if (asize != psize) { + abd_zero_off(to_write, psize, + asize - psize); } l2arc_free_abd_on_write(to_write, asize, arc_buf_type(hdr)); @@ -7515,12 +7515,12 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_CANFAIL, B_FALSE); - write_sz += HDR_GET_LSIZE(hdr); + write_lsize += HDR_GET_LSIZE(hdr); DTRACE_PROBE2(l2arc__write, vdev_t *, dev->l2ad_vdev, zio_t *, wzio); - write_asize += size; - write_psize += asize; + write_psize += psize; + write_asize += asize; dev->l2ad_hand += asize; mutex_exit(hash_lock); @@ -7536,7 +7536,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint /* No buffers selected for writing? */ if (pio == NULL) { - ASSERT0(write_sz); + ASSERT0(write_lsize); ASSERT(!HDR_HAS_L1HDR(head)); kmem_cache_free(hdr_l2only_cache, head); return (0); @@ -7544,10 +7544,10 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint ASSERT3U(write_psize, <=, target_sz); ARCSTAT_BUMP(arcstat_l2_writes_sent); - ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize); - ARCSTAT_INCR(arcstat_l2_size, write_sz); - ARCSTAT_INCR(arcstat_l2_asize, write_asize); - vdev_space_update(dev->l2ad_vdev, write_asize, 0, 0); + ARCSTAT_INCR(arcstat_l2_write_bytes, write_psize); + ARCSTAT_INCR(arcstat_l2_lsize, write_lsize); + ARCSTAT_INCR(arcstat_l2_psize, write_psize); + vdev_space_update(dev->l2ad_vdev, write_psize, 0, 0); /* * Bump device hand to the device start if it is approaching the end. From owner-svn-src-head@freebsd.org Tue Aug 8 10:46:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 680EBDD2C26; Tue, 8 Aug 2017 10:46:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4327D7E9E1; Tue, 8 Aug 2017 10:46:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78AkqHR030690; Tue, 8 Aug 2017 10:46:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Akq6g030686; Tue, 8 Aug 2017 10:46:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081046.v78Akq6g030686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 10:46:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322226 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 322226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 10:46:53 -0000 Author: avg Date: Tue Aug 8 10:46:51 2017 New Revision: 322226 URL: https://svnweb.freebsd.org/changeset/base/322226 Log: MFV r322223: 8378 crash due to bp in-memory modification of nopwrite block illumos/illumos-gate@b7edcb940884114e61382937505433c4c38c0278 https://github.com/illumos/illumos-gate/commit/b7edcb940884114e61382937505433c4c38c0278 https://www.illumos.org/issues/8378 The problem is that zfs_get_data() supplies a stale zgd_bp to dmu_sync(), which we then nopwrite against. zfs_get_data() doesn't hold any DMU-related locks, so after it copies db_blkptr to zgd_bp, dbuf_write_ready() could change db_blkptr, and dbuf_write_done() could remove the dirty record. dmu_sync() then sees the stale BP and that the dbuf it not dirty, so it is eligible for nop-writing. The fix is for dmu_sync() to copy db_blkptr to zgd_bp after acquiring the db_mtx. We could still see a stale db_blkptr, but if it is stale then the dirty record will still exist and thus we won't attempt to nopwrite. Reviewed by: Prakash Surya Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Matthew Ahrens MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Aug 8 10:45:22 2017 (r322225) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Aug 8 10:46:51 2017 (r322226) @@ -1838,7 +1838,6 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z uint64_t object = lr->lr_foid; uint64_t offset = lr->lr_offset; uint64_t size = lr->lr_length; - blkptr_t *bp = &lr->lr_blkptr; uint64_t txg = lr->lr_common.lrc_txg; uint64_t crtxg; dmu_object_info_t doi; @@ -1892,11 +1891,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z DMU_READ_NO_PREFETCH); if (error == 0) { - blkptr_t *obp = dmu_buf_get_blkptr(db); - if (obp) { - ASSERT(BP_IS_HOLE(bp)); - *bp = *obp; - } + blkptr_t *bp = &lr->lr_blkptr; zgd->zgd_db = db; zgd->zgd_bp = bp; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Aug 8 10:45:22 2017 (r322225) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Aug 8 10:46:51 2017 (r322226) @@ -1657,6 +1657,7 @@ dmu_sync_done(zio_t *zio, arc_buf_t *buf, void *varg) uint8_t chksum = BP_GET_CHECKSUM(bp_orig); ASSERT(BP_EQUAL(bp, bp_orig)); + VERIFY(BP_EQUAL(bp, db->db_blkptr)); ASSERT(zio->io_prop.zp_compress != ZIO_COMPRESS_OFF); ASSERT(zio_checksum_table[chksum].ci_flags & ZCHECKSUM_FLAG_NOPWRITE); @@ -1697,19 +1698,11 @@ dmu_sync_late_arrival_done(zio_t *zio) blkptr_t *bp_orig = &zio->io_bp_orig; if (zio->io_error == 0 && !BP_IS_HOLE(bp)) { - /* - * If we didn't allocate a new block (i.e. ZIO_FLAG_NOPWRITE) - * then there is nothing to do here. Otherwise, free the - * newly allocated block in this txg. - */ - if (zio->io_flags & ZIO_FLAG_NOPWRITE) { - ASSERT(BP_EQUAL(bp, bp_orig)); - } else { - ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig)); - ASSERT(zio->io_bp->blk_birth == zio->io_txg); - ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa)); - zio_free(zio->io_spa, zio->io_txg, zio->io_bp); - } + ASSERT(!(zio->io_flags & ZIO_FLAG_NOPWRITE)); + ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig)); + ASSERT(zio->io_bp->blk_birth == zio->io_txg); + ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa)); + zio_free(zio->io_spa, zio->io_txg, zio->io_bp); } dmu_tx_commit(dsa->dsa_tx); @@ -1741,6 +1734,29 @@ dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sy dsa->dsa_zgd = zgd; dsa->dsa_tx = tx; + /* + * Since we are currently syncing this txg, it's nontrivial to + * determine what BP to nopwrite against, so we disable nopwrite. + * + * When syncing, the db_blkptr is initially the BP of the previous + * txg. We can not nopwrite against it because it will be changed + * (this is similar to the non-late-arrival case where the dbuf is + * dirty in a future txg). + * + * Then dbuf_write_ready() sets bp_blkptr to the location we will write. + * We can not nopwrite against it because although the BP will not + * (typically) be changed, the data has not yet been persisted to this + * location. + * + * Finally, when dbuf_write_done() is called, it is theoretically + * possible to always nopwrite, because the data that was written in + * this txg is the same data that we are trying to write. However we + * would need to check that this dbuf is not dirty in any future + * txg's (as we do in the normal dmu_sync() path). For simplicity, we + * don't nopwrite in this case. + */ + zp->zp_nopwrite = B_FALSE; + zio_nowait(zio_write(pio, os->os_spa, dmu_tx_get_txg(tx), zgd->zgd_bp, abd_get_from_buf(zgd->zgd_db->db_data, zgd->zgd_db->db_size), zgd->zgd_db->db_size, zgd->zgd_db->db_size, zp, @@ -1778,7 +1794,6 @@ dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sy int dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done, zgd_t *zgd) { - blkptr_t *bp = zgd->zgd_bp; dmu_buf_impl_t *db = (dmu_buf_impl_t *)zgd->zgd_db; objset_t *os = db->db_objset; dsl_dataset_t *ds = os->os_dsl_dataset; @@ -1845,6 +1860,21 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done ASSERT(dr->dr_next == NULL || dr->dr_next->dr_txg < txg); + if (db->db_blkptr != NULL) { + /* + * We need to fill in zgd_bp with the current blkptr so that + * the nopwrite code can check if we're writing the same + * data that's already on disk. We can only nopwrite if we + * are sure that after making the copy, db_blkptr will not + * change until our i/o completes. We ensure this by + * holding the db_mtx, and only allowing nopwrite if the + * block is not already dirty (see below). This is verified + * by dmu_sync_done(), which VERIFYs that the db_blkptr has + * not changed. + */ + *zgd->zgd_bp = *db->db_blkptr; + } + /* * Assume the on-disk data is X, the current syncing data (in * txg - 1) is Y, and the current in-memory data is Z (currently @@ -1896,7 +1926,7 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done dsa->dsa_tx = NULL; zio_nowait(arc_write(pio, os->os_spa, txg, - bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), + zgd->zgd_bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), &zp, dmu_sync_ready, NULL, NULL, dmu_sync_done, dsa, ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb)); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Aug 8 10:45:22 2017 (r322225) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Aug 8 10:46:51 2017 (r322226) @@ -1297,7 +1297,6 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio uint64_t object = lr->lr_foid; uint64_t offset = lr->lr_offset; uint64_t size = lr->lr_length; - blkptr_t *bp = &lr->lr_blkptr; dmu_buf_t *db; zgd_t *zgd; int error = 0; @@ -1374,11 +1373,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio DMU_READ_NO_PREFETCH); if (error == 0) { - blkptr_t *obp = dmu_buf_get_blkptr(db); - if (obp) { - ASSERT(BP_IS_HOLE(bp)); - *bp = *obp; - } + blkptr_t *bp = &lr->lr_blkptr; zgd->zgd_db = db; zgd->zgd_bp = bp; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Aug 8 10:45:22 2017 (r322225) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Aug 8 10:46:51 2017 (r322226) @@ -27,7 +27,7 @@ * Portions Copyright 2010 Robert Milkowski * * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -1340,7 +1340,6 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zi uint64_t object = ZVOL_OBJ; uint64_t offset = lr->lr_offset; uint64_t size = lr->lr_length; /* length of user data */ - blkptr_t *bp = &lr->lr_blkptr; dmu_buf_t *db; zgd_t *zgd; int error; @@ -1368,11 +1367,7 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zi error = dmu_buf_hold(os, object, offset, zgd, &db, DMU_READ_NO_PREFETCH); if (error == 0) { - blkptr_t *obp = dmu_buf_get_blkptr(db); - if (obp) { - ASSERT(BP_IS_HOLE(bp)); - *bp = *obp; - } + blkptr_t *bp = &lr->lr_blkptr; zgd->zgd_db = db; zgd->zgd_bp = bp; From owner-svn-src-head@freebsd.org Tue Aug 8 10:48:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76240DD2E2E; Tue, 8 Aug 2017 10:48:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 447D87EC72; Tue, 8 Aug 2017 10:48:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78AmqJo030853; Tue, 8 Aug 2017 10:48:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Amqvm030852; Tue, 8 Aug 2017 10:48:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081048.v78Amqvm030852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 10:48:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322228 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 322228 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 10:48:53 -0000 Author: avg Date: Tue Aug 8 10:48:52 2017 New Revision: 322228 URL: https://svnweb.freebsd.org/changeset/base/322228 Log: MFV r322227: 8377 Panic in bookmark deletion illumos/illumos-gate@42418f9e73f0d007aa87675ecc206c26fc8e073e https://github.com/illumos/illumos-gate/commit/42418f9e73f0d007aa87675ecc206c26fc8e073e https://www.illumos.org/issues/8377 The problem is that when dsl_bookmark_destroy_check() is executed from open context (the pre-check), it fills in dbda_success based on the existence of the bookmark. But the bookmark (or containing filesystem as in this case) can be destroyed before we get to syncing context. When we re-run dsl_bookmark_destroy_check() in syncing context, it will not add the deleted bookmark to dbda_success, intending for dsl_bookmark_destroy_sync() to not process it. But because the bookmark is still in dbda_success from the open-context call, we do try to destroy it. The fix is that dsl_bookmark_destroy_check() should not modify dbda_success when called from open context. Reviewed by: Paul Dagnelie Reviewed by: Pavel Zakharov Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Matthew Ahrens MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Tue Aug 8 10:47:56 2017 (r322227) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Tue Aug 8 10:48:52 2017 (r322228) @@ -354,6 +354,9 @@ dsl_bookmark_destroy_check(void *arg, dmu_tx_t *tx) dsl_pool_t *dp = dmu_tx_pool(tx); int rv = 0; + ASSERT(nvlist_empty(dbda->dbda_success)); + ASSERT(nvlist_empty(dbda->dbda_errors)); + if (!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_BOOKMARKS)) return (0); @@ -383,7 +386,10 @@ dsl_bookmark_destroy_check(void *arg, dmu_tx_t *tx) } } if (error == 0) { - fnvlist_add_boolean(dbda->dbda_success, fullname); + if (dmu_tx_is_syncing(tx)) { + fnvlist_add_boolean(dbda->dbda_success, + fullname); + } } else { fnvlist_add_int32(dbda->dbda_errors, fullname, error); rv = error; From owner-svn-src-head@freebsd.org Tue Aug 8 10:52:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59FDEDD3252; Tue, 8 Aug 2017 10:52:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3658A7F278; Tue, 8 Aug 2017 10:52:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78Aq2QU034598; Tue, 8 Aug 2017 10:52:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Aq1Rl034592; Tue, 8 Aug 2017 10:52:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081052.v78Aq1Rl034592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 10:52:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322230 - in head: cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris... X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 322230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 10:52:03 -0000 Author: avg Date: Tue Aug 8 10:52:01 2017 New Revision: 322230 URL: https://svnweb.freebsd.org/changeset/base/322230 Log: MFV r322229: 7600 zfs rollback should pass target snapshot to kernel illumos/illumos-gate@77b171372ed21642e04c873ef1e87fe2365520df https://github.com/illumos/illumos-gate/commit/77b171372ed21642e04c873ef1e87fe2365520df https://www.illumos.org/issues/7600 At present, the kernel side code seems to blindly rollback to whatever happens to be the latest snapshot at the time when the rollback task is processed. The expected target's name should be passed to the kernel driver and the sync task should validate that the target exists and that it is the latest snapshot indeed. Reviewed by: Matthew Ahrens Reviewed by: Pavel Zakharov Approved by: Robert Mustacchi Author: Andriy Gapon MFC after: 3 weeks Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Aug 8 10:49:56 2017 (r322229) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Aug 8 10:52:01 2017 (r322230) @@ -3957,14 +3957,19 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo } /* - * We rely on zfs_iter_children() to verify that there are no - * newer snapshots for the given dataset. Therefore, we can - * simply pass the name on to the ioctl() call. There is still - * an unlikely race condition where the user has taken a - * snapshot since we verified that this was the most recent. + * Pass both the filesystem and the wanted snapshot names, + * we would get an error back if the snapshot is destroyed or + * a new snapshot is created before this request is processed. */ - err = lzc_rollback(zhp->zfs_name, NULL, 0); - if (err != 0) { + err = lzc_rollback_to(zhp->zfs_name, snap->zfs_name); + if (err == EXDEV) { + zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN, + "'%s' is not the latest snapshot"), snap->zfs_name); + (void) zfs_error_fmt(zhp->zfs_hdl, EZFS_BUSY, + dgettext(TEXT_DOMAIN, "cannot rollback '%s'"), + zhp->zfs_name); + return (err); + } else if (err != 0) { (void) zfs_standard_error_fmt(zhp->zfs_hdl, errno, dgettext(TEXT_DOMAIN, "cannot rollback '%s'"), zhp->zfs_name); Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Tue Aug 8 10:49:56 2017 (r322229) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Tue Aug 8 10:52:01 2017 (r322230) @@ -765,6 +765,9 @@ lzc_receive_with_header(const char *snapname, nvlist_t * Roll back this filesystem or volume to its most recent snapshot. * If snapnamebuf is not NULL, it will be filled in with the name * of the most recent snapshot. + * Note that the latest snapshot may change if a new one is concurrently + * created or the current one is destroyed. lzc_rollback_to can be used + * to roll back to a specific latest snapshot. * * Return 0 on success or an errno on failure. */ @@ -784,6 +787,27 @@ lzc_rollback(const char *fsname, char *snapnamebuf, in } nvlist_free(result); + return (err); +} + +/* + * Roll back this filesystem or volume to the specified snapshot, + * if possible. + * + * Return 0 on success or an errno on failure. + */ +int +lzc_rollback_to(const char *fsname, const char *snapname) +{ + nvlist_t *args; + nvlist_t *result; + int err; + + args = fnvlist_alloc(); + fnvlist_add_string(args, "target", snapname); + err = lzc_ioctl(ZFS_IOC_ROLLBACK, fsname, args, &result); + nvlist_free(args); + nvlist_free(result); return (err); } Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Tue Aug 8 10:49:56 2017 (r322229) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Tue Aug 8 10:52:01 2017 (r322230) @@ -84,6 +84,7 @@ int lzc_receive_with_header(const char *, nvlist_t *, boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); +int lzc_rollback_to(const char *, const char *); #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Tue Aug 8 10:49:56 2017 (r322229) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Tue Aug 8 10:52:01 2017 (r322230) @@ -2259,6 +2259,7 @@ dsl_dataset_handoff_check(dsl_dataset_t *ds, void *own typedef struct dsl_dataset_rollback_arg { const char *ddra_fsname; + const char *ddra_tosnap; void *ddra_owner; nvlist_t *ddra_result; } dsl_dataset_rollback_arg_t; @@ -2300,6 +2301,18 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx) return (SET_ERROR(EAGAIN)); } + /* + * If the expected target snapshot is specified, then check that + * the latest snapshot is it. + */ + if (ddra->ddra_tosnap != NULL) { + char namebuf[ZFS_MAX_DATASET_NAME_LEN]; + + dsl_dataset_name(ds->ds_prev, namebuf); + if (strcmp(namebuf, ddra->ddra_tosnap) != 0) + return (SET_ERROR(EXDEV)); + } + /* must not have any bookmarks after the most recent snapshot */ nvlist_t *proprequest = fnvlist_alloc(); fnvlist_add_boolean(proprequest, zfs_prop_to_name(ZFS_PROP_CREATETXG)); @@ -2401,11 +2414,13 @@ dsl_dataset_rollback_sync(void *arg, dmu_tx_t *tx) * notes above zfs_suspend_fs() for further details. */ int -dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result) +dsl_dataset_rollback(const char *fsname, const char *tosnap, void *owner, + nvlist_t *result) { dsl_dataset_rollback_arg_t ddra; ddra.ddra_fsname = fsname; + ddra.ddra_tosnap = tosnap; ddra.ddra_owner = owner; ddra.ddra_result = result; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Tue Aug 8 10:49:56 2017 (r322229) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Tue Aug 8 10:52:01 2017 (r322230) @@ -334,7 +334,8 @@ void dsl_dataset_set_refreservation_sync_impl(dsl_data void dsl_dataset_zapify(dsl_dataset_t *ds, dmu_tx_t *tx); boolean_t dsl_dataset_is_zapified(dsl_dataset_t *ds); boolean_t dsl_dataset_has_resume_receive_state(dsl_dataset_t *ds); -int dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result); +int dsl_dataset_rollback(const char *fsname, const char *tosnap, void *owner, + nvlist_t *result); void dsl_dataset_deactivate_feature(uint64_t dsobj, spa_feature_t f, dmu_tx_t *tx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Aug 8 10:49:56 2017 (r322229) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Aug 8 10:52:01 2017 (r322230) @@ -3780,18 +3780,29 @@ zfs_ioc_destroy(zfs_cmd_t *zc) /* * fsname is name of dataset to rollback (to most recent snapshot) * - * innvl is not used. + * innvl may contain name of expected target snapshot * * outnvl: "target" -> name of most recent snapshot * } */ /* ARGSUSED */ static int -zfs_ioc_rollback(const char *fsname, nvlist_t *args, nvlist_t *outnvl) +zfs_ioc_rollback(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl) { zfsvfs_t *zfsvfs; + char *target = NULL; int error; + (void) nvlist_lookup_string(innvl, "target", &target); + if (target != NULL) { + int fslen = strlen(fsname); + + if (strncmp(fsname, target, fslen) != 0) + return (SET_ERROR(EINVAL)); + if (target[fslen] != '@') + return (SET_ERROR(EINVAL)); + } + if (getzfsvfs(fsname, &zfsvfs) == 0) { dsl_dataset_t *ds; @@ -3800,7 +3811,8 @@ zfs_ioc_rollback(const char *fsname, nvlist_t *args, n if (error == 0) { int resume_err; - error = dsl_dataset_rollback(fsname, zfsvfs, outnvl); + error = dsl_dataset_rollback(fsname, target, zfsvfs, + outnvl); resume_err = zfs_resume_fs(zfsvfs, ds); error = error ? error : resume_err; } @@ -3810,7 +3822,7 @@ zfs_ioc_rollback(const char *fsname, nvlist_t *args, n vfs_unbusy(zfsvfs->z_vfs); #endif } else { - error = dsl_dataset_rollback(fsname, NULL, outnvl); + error = dsl_dataset_rollback(fsname, target, NULL, outnvl); } return (error); } From owner-svn-src-head@freebsd.org Tue Aug 8 10:59:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC6F7DD3809; Tue, 8 Aug 2017 10:59:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A48EC7F743; Tue, 8 Aug 2017 10:59:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78AxIQl034994; Tue, 8 Aug 2017 10:59:18 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AxIH1034993; Tue, 8 Aug 2017 10:59:18 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081059.v78AxIH1034993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 10:59:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322233 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 322233 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 10:59:20 -0000 Author: avg Date: Tue Aug 8 10:59:18 2017 New Revision: 322233 URL: https://svnweb.freebsd.org/changeset/base/322233 Log: MFV r322232: 8426 mark immutable buffer arguments as such in abd.h illumos/illumos-gate@9b195260e22529ac0e2580faaf89402420589c1c https://github.com/illumos/illumos-gate/commit/9b195260e22529ac0e2580faaf89402420589c1c https://www.illumos.org/issues/8426 abd_copy_from_buf and abd_cmp_buf do not modify their void *buf arguments, so qualify them with const. abd_copy_from_buf_off and abd_cmp_buf_off already had that type for the corresponding arguments. Reviewed by: Matt Ahrens Approved by: Robert Mustacchi Author: Andriy Gapon MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Tue Aug 8 10:58:01 2017 (r322232) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Tue Aug 8 10:59:18 2017 (r322233) @@ -117,7 +117,7 @@ abd_copy(abd_t *dabd, abd_t *sabd, size_t size) } inline void -abd_copy_from_buf(abd_t *abd, void *buf, size_t size) +abd_copy_from_buf(abd_t *abd, const void *buf, size_t size) { abd_copy_from_buf_off(abd, buf, 0, size); } @@ -129,7 +129,7 @@ abd_copy_to_buf(void* buf, abd_t *abd, size_t size) } inline int -abd_cmp_buf(abd_t *abd, void *buf, size_t size) +abd_cmp_buf(abd_t *abd, const void *buf, size_t size) { return (abd_cmp_buf_off(abd, buf, 0, size)); } From owner-svn-src-head@freebsd.org Tue Aug 8 11:07:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A411DD3F0C; Tue, 8 Aug 2017 11:07:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA5197FCC0; Tue, 8 Aug 2017 11:07:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78B7Y16039162; Tue, 8 Aug 2017 11:07:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78B7Yvm039161; Tue, 8 Aug 2017 11:07:34 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081107.v78B7Yvm039161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 11:07:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322234 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 322234 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 11:07:36 -0000 Author: avg Date: Tue Aug 8 11:07:34 2017 New Revision: 322234 URL: https://svnweb.freebsd.org/changeset/base/322234 Log: zfs: no need for __DECONST after abd constification in r322233 Note that vdev_label_write_pad2() is FreeBSD specific. MFC after: 2 weeks X-MFC after: r322233 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Tue Aug 8 10:59:18 2017 (r322233) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Tue Aug 8 11:07:34 2017 (r322234) @@ -899,7 +899,7 @@ vdev_label_write_pad2(vdev_t *vd, const char *buf, siz pad2 = abd_alloc_for_io(VDEV_PAD_SIZE, B_TRUE); abd_zero(pad2, VDEV_PAD_SIZE); - abd_copy_from_buf(pad2, __DECONST(void *, buf), size); + abd_copy_from_buf(pad2, buf, size); retry: zio = zio_root(spa, NULL, NULL, flags); From owner-svn-src-head@freebsd.org Tue Aug 8 11:14:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41603DD468D; Tue, 8 Aug 2017 11:14:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EF058071F; Tue, 8 Aug 2017 11:14:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BEfx0043278; Tue, 8 Aug 2017 11:14:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BEfuf043277; Tue, 8 Aug 2017 11:14:41 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081114.v78BEfuf043277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 11:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322237 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 322237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 11:14:42 -0000 Author: avg Date: Tue Aug 8 11:14:40 2017 New Revision: 322237 URL: https://svnweb.freebsd.org/changeset/base/322237 Log: MFV r322236: 8126 ztest assertion failed in dbuf_dirty due to dn_nlevels changing illumos/illumos-gate@dcb6872c565819ac88acbc2ece999ef241c8b982 https://github.com/illumos/illumos-gate/commit/dcb6872c565819ac88acbc2ece999ef241c8b982 https://www.illumos.org/issues/8126 The sync thread is concurrently modifying dn_phys->dn_nlevels while dbuf_dirty() is trying to assert something about it, without holding the necessary lock. We need to move this assertion further down in the function, after we have acquired the dn_struct_rwlock. Reviewed by: Pavel Zakharov Reviewed by: Serapheim Dimitropoulos Approved by: Robert Mustacchi Author: Matthew Ahrens MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Aug 8 11:13:27 2017 (r322236) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Aug 8 11:14:40 2017 (r322237) @@ -1542,11 +1542,6 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) (dmu_tx_is_syncing(tx) ? DN_DIRTY_SYNC : DN_DIRTY_OPEN)); ASSERT3U(dn->dn_nlevels, >, db->db_level); - ASSERT((dn->dn_phys->dn_nlevels == 0 && db->db_level == 0) || - dn->dn_phys->dn_nlevels > db->db_level || - dn->dn_next_nlevels[txgoff] > db->db_level || - dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level || - dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level); /* * We should only be dirtying in syncing context if it's the @@ -1662,6 +1657,16 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) rw_enter(&dn->dn_struct_rwlock, RW_READER); drop_struct_lock = TRUE; } + + /* + * We need to hold the dn_struct_rwlock to make this assertion, + * because it protects dn_phys / dn_next_nlevels from changing. + */ + ASSERT((dn->dn_phys->dn_nlevels == 0 && db->db_level == 0) || + dn->dn_phys->dn_nlevels > db->db_level || + dn->dn_next_nlevels[txgoff] > db->db_level || + dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level || + dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level); /* * If we are overwriting a dedup BP, then unless it is snapshotted, From owner-svn-src-head@freebsd.org Tue Aug 8 11:19:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EFA3DD4A0C; Tue, 8 Aug 2017 11:19:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B4BA80A3C; Tue, 8 Aug 2017 11:19:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BJEkm043524; Tue, 8 Aug 2017 11:19:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BJE37043523; Tue, 8 Aug 2017 11:19:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081119.v78BJE37043523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 11:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322239 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 322239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 11:19:15 -0000 Author: avg Date: Tue Aug 8 11:19:14 2017 New Revision: 322239 URL: https://svnweb.freebsd.org/changeset/base/322239 Log: MFV r322238: 7915 checks in l2arc_evict could use some cleaning up illumos/illumos-gate@267ae6c3a88d2fc39276af66caafa978b0935b82 https://github.com/illumos/illumos-gate/commit/267ae6c3a88d2fc39276af66caafa978b0935b82 https://www.illumos.org/issues/7915 l2arc_evict() is strictly serialized with respect to l2arc_write_buffers() and l2arc_write_done(). Normally, l2arc_evict() and l2arc_write_buffers() are called from the same thread, so they can not be concurrent. Also, l2arc_write_buffers() uses zio_wait() on the parent zio of all cache zio-s. That ensures that l2arc_write_done() is completed before l2arc_write_buffers() returns. Finally, if a cache device is removed, then l2arc_evict() is called under SCL_ALL in the exclusive mode. That ensures that it can not be concurrent with the normal L2ARC accesses to the device (including writing and evicting buffers). Given the above, some checks and actions in l2arc_evict() do not make sense. For instance, it must never encounter the write head header let alone remove it from the buffer list. Reviewed by: Dan Kimmel Reviewed by: Prakash Surya Approved by: Matthew Ahrens Author: Andriy Gapon MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Aug 8 11:15:36 2017 (r322238) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Aug 8 11:19:14 2017 (r322239) @@ -7284,18 +7284,16 @@ top: goto top; } - if (HDR_L2_WRITE_HEAD(hdr)) { - /* - * We hit a write head node. Leave it for - * l2arc_write_done(). - */ - list_remove(buflist, hdr); - mutex_exit(hash_lock); - continue; - } + /* + * A header can't be on this list if it doesn't have L2 header. + */ + ASSERT(HDR_HAS_L2HDR(hdr)); - if (!all && HDR_HAS_L2HDR(hdr) && - (hdr->b_l2hdr.b_daddr >= taddr || + /* Ensure this header has finished being written. */ + ASSERT(!HDR_L2_WRITING(hdr)); + ASSERT(!HDR_L2_WRITE_HEAD(hdr)); + + if (!all && (hdr->b_l2hdr.b_daddr >= taddr || hdr->b_l2hdr.b_daddr < dev->l2ad_hand)) { /* * We've evicted to the target address, @@ -7305,7 +7303,6 @@ top: break; } - ASSERT(HDR_HAS_L2HDR(hdr)); if (!HDR_HAS_L1HDR(hdr)) { ASSERT(!HDR_L2_READING(hdr)); /* @@ -7327,9 +7324,6 @@ top: ARCSTAT_BUMP(arcstat_l2_evict_reading); arc_hdr_set_flags(hdr, ARC_FLAG_L2_EVICTED); } - - /* Ensure this header has finished being written */ - ASSERT(!HDR_L2_WRITING(hdr)); arc_hdr_l2hdr_destroy(hdr); } From owner-svn-src-head@freebsd.org Tue Aug 8 11:21:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64A14DD4D2E; Tue, 8 Aug 2017 11:21:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 312F480F9F; Tue, 8 Aug 2017 11:21:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BLwX7046497; Tue, 8 Aug 2017 11:21:58 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BLwII046496; Tue, 8 Aug 2017 11:21:58 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081121.v78BLwII046496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 11:21:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322241 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 322241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 11:21:59 -0000 Author: avg Date: Tue Aug 8 11:21:58 2017 New Revision: 322241 URL: https://svnweb.freebsd.org/changeset/base/322241 Log: MFV r322240: 8491 uberblock on-disk padding to reserve space for smoothly merging zpool checkpoint & MMP in ZFS illumos/illumos-gate@79c2b812ee2010ebf20fdd92dc5f06b59000a94c https://github.com/illumos/illumos-gate/commit/79c2b812ee2010ebf20fdd92dc5f06b59000a94c https://www.illumos.org/issues/8491 The zpool checkpoint feature in DxOS added a new field in the uberblock. The Multi-Modifier Protection Pull Request from ZoL adds two new fields in the uberblock (Reference: https://github.com/zfsonlinux/zfs/pull/6279). As these two changes come from two different sources and once upstreamed and deployed will introduce an incompatibility with each other we want to upstream a change that will reserve the padding for both of them so integration goes smoothly and everyone gets both features. Reviewed by: Matthew Ahrens Reviewed by: Brian Behlendorf Reviewed by: Olaf Faaland Approved by: Gordon Ross Author: Serapheim Dimitropoulos MFC after: 3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h Tue Aug 8 11:19:56 2017 (r322240) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h Tue Aug 8 11:21:58 2017 (r322241) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017 by Delphix. All rights reserved. */ #ifndef _SYS_UBERBLOCK_IMPL_H @@ -54,6 +55,12 @@ struct uberblock { /* highest SPA_VERSION supported by software that wrote this txg */ uint64_t ub_software_version; + + /* These fields are reserved for features that are under development: */ + uint64_t ub_mmp_magic; + uint64_t ub_mmp_delay; + uint64_t ub_mmp_seq; + uint64_t ub_checkpoint_txg; }; #ifdef __cplusplus From owner-svn-src-head@freebsd.org Tue Aug 8 11:26:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B652EDD5298; Tue, 8 Aug 2017 11:26:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82E22815A2; Tue, 8 Aug 2017 11:26:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BQ3re047572; Tue, 8 Aug 2017 11:26:03 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BQ3Lr047571; Tue, 8 Aug 2017 11:26:03 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081126.v78BQ3Lr047571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 11:26:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322245 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 322245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 11:26:04 -0000 Author: avg Date: Tue Aug 8 11:26:03 2017 New Revision: 322245 URL: https://svnweb.freebsd.org/changeset/base/322245 Log: MFV r322242: 8373 TXG_WAIT in ZIL commit path illumos/illumos-gate@d28671a3b094af696bea87f52272d4c4d89321c7 https://github.com/illumos/illumos-gate/commit/d28671a3b094af696bea87f52272d4c4d89321c7 https://www.illumos.org/issues/8373 The code that writes ZIL blocks uses dmu_tx_assign(TXG_WAIT) to assign a transaction to a transaction group. That seems to be logically incorrect as writing of the ZIL block does not introduce any new dirty data. Also, when there is a lot of dirty data, the call can introduce significant delays into the ZIL commit path, thus affecting all synchronous writes. Additionally, ARC throttling may affect the ZIL writing. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Dan McDonald Author: Andriy Gapon MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Aug 8 11:25:09 2017 (r322244) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Aug 8 11:26:03 2017 (r322245) @@ -985,7 +985,24 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb, boolea * to clean up in the event of allocation failure or I/O failure. */ tx = dmu_tx_create(zilog->zl_os); - VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0); + + /* + * Since we are not going to create any new dirty data and we can even + * help with clearing the existing dirty data, we should not be subject + * to the dirty data based delays. + * We (ab)use TXG_WAITED to bypass the delay mechanism. + * One side effect from using TXG_WAITED is that dmu_tx_assign() can + * fail if the pool is suspended. Those are dramatic circumstances, + * so we return NULL to signal that the normal ZIL processing is not + * possible and txg_wait_synced() should be used to ensure that the data + * is on disk. + */ + error = dmu_tx_assign(tx, TXG_WAITED); + if (error != 0) { + ASSERT3S(error, ==, EIO); + dmu_tx_abort(tx); + return (NULL); + } dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); txg = dmu_tx_get_txg(tx); From owner-svn-src-head@freebsd.org Tue Aug 8 11:28:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27882DD554A; Tue, 8 Aug 2017 11:28:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8E24818CB; Tue, 8 Aug 2017 11:28:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BScvX047756; Tue, 8 Aug 2017 11:28:38 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BScI1047755; Tue, 8 Aug 2017 11:28:38 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708081128.v78BScI1047755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Aug 2017 11:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322247 - head/sys/cddl/contrib/opensolaris X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris X-SVN-Commit-Revision: 322247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 11:28:40 -0000 Author: avg Date: Tue Aug 8 11:28:38 2017 New Revision: 322247 URL: https://svnweb.freebsd.org/changeset/base/322247 Log: MFV r322246: 8508 Mounting a zpool on 32-bit platforms panics FreeBSD note: this is a record-only commit, the actual change originated from FreeBSD. illumos/illumos-gate@b11fe8c01471a5bff68e83e1fe5f809ad16b3be8 https://github.com/illumos/illumos-gate/commit/b11fe8c01471a5bff68e83e1fe5f809ad16b3be8 https://www.illumos.org/issues/8508 Mounting a zpool on a 32-bit system triggers a panic in spa_history_log_version () due to a type format mismatch for ZPL_VERSION. ZPL_VERSION is a unsigned long long, but the format expects an integer. On 64-bit platforms this may not be an issue due to word size and alignment. On 32-bit platforms a word size is half that of a long long, causing the second word of the long long to be seen as the string pointer for utsname.nodename. Reviewed by: Matt Ahrens Approved by: Dan McDonald Author: Justin Hibbits Modified: Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) From owner-svn-src-head@freebsd.org Tue Aug 8 11:35:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CC1BDD5C74; Tue, 8 Aug 2017 11:35:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1999F81F49; Tue, 8 Aug 2017 11:35:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BZ3rM051676; Tue, 8 Aug 2017 11:35:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BZ2tO051670; Tue, 8 Aug 2017 11:35:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708081135.v78BZ2tO051670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 8 Aug 2017 11:35:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322248 - in head/sys/dev/mlx4: . mlx4_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx4: . mlx4_en X-SVN-Commit-Revision: 322248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 11:35:04 -0000 Author: hselasky Date: Tue Aug 8 11:35:02 2017 New Revision: 322248 URL: https://svnweb.freebsd.org/changeset/base/322248 Log: Fix for mlx4en(4) to properly call m_defrag(). The m_defrag() function can only defrag mbuf chains which have a valid mbuf packet header. In r291699 when the mlx4en(4) driver was converted into using BUSDMA(9), the call to m_defrag() was moved after the part of the transmit routine which strips the header from the mbuf chain. This effectivly disabled the mbuf defrag mechanism and such packets simply got dropped. This patch removes the stripping of mbufs from a chain and loads all mbufs using busdma. If busdma finds there are no segments, unload the DMA map and free the mbuf right away, because that means all data in the mbuf has been inlined in the TX ring. Else proceed as usual. Add a per-ring rounter for the number of defrag attempts and make sure the oversized_packets counter gets zeroed while at it. The counters are per-ring to avoid excessive cache misses in the TX path. Submitted by: mjoras@ Differential Revision: https://reviews.freebsd.org/D11683 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/en.h head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c head/sys/dev/mlx4/stats.h Modified: head/sys/dev/mlx4/mlx4_en/en.h ============================================================================== --- head/sys/dev/mlx4/mlx4_en/en.h Tue Aug 8 11:28:38 2017 (r322247) +++ head/sys/dev/mlx4/mlx4_en/en.h Tue Aug 8 11:35:02 2017 (r322248) @@ -278,6 +278,8 @@ struct mlx4_en_tx_ring { unsigned long queue_stopped; unsigned long oversized_packets; unsigned long wake_queue; + unsigned long tso_packets; + unsigned long defrag_attempts; struct mlx4_bf bf; bool bf_enabled; int hwtstamp_tx_type; Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Tue Aug 8 11:28:38 2017 (r322247) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Tue Aug 8 11:35:02 2017 (r322248) @@ -2681,6 +2681,8 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_chksum_offload", CTLFLAG_RD, &priv->port_stats.tx_chksum_offload, "TX checksum offloads"); + SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "defrag_attempts", CTLFLAG_RD, + &priv->port_stats.defrag_attempts, "Oversized chains defragged"); /* Could strdup the names and add in a loop. This is simpler. */ SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_bytes", CTLFLAG_RD, @@ -2774,6 +2776,10 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p CTLFLAG_RD, &tx_ring->packets, "TX packets"); SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "bytes", CTLFLAG_RD, &tx_ring->bytes, "TX bytes"); + SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "tso_packets", + CTLFLAG_RD, &tx_ring->tso_packets, "TSO packets"); + SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "defrag_attempts", + CTLFLAG_RD, &tx_ring->defrag_attempts, "Oversized chains defragged"); } for (i = 0; i < priv->rx_ring_num; i++) { Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Tue Aug 8 11:28:38 2017 (r322247) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Tue Aug 8 11:35:02 2017 (r322248) @@ -191,11 +191,16 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u priv->port_stats.tx_chksum_offload = 0; priv->port_stats.queue_stopped = 0; priv->port_stats.wake_queue = 0; + priv->port_stats.oversized_packets = 0; + priv->port_stats.tso_packets = 0; + priv->port_stats.defrag_attempts = 0; for (i = 0; i < priv->tx_ring_num; i++) { priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum; priv->port_stats.queue_stopped += priv->tx_ring[i]->queue_stopped; priv->port_stats.wake_queue += priv->tx_ring[i]->wake_queue; priv->port_stats.oversized_packets += priv->tx_ring[i]->oversized_packets; + priv->port_stats.tso_packets += priv->tx_ring[i]->tso_packets; + priv->port_stats.defrag_attempts += priv->tx_ring[i]->defrag_attempts; } /* RX Statistics */ priv->pkstats.rx_packets = be64_to_cpu(mlx4_en_stats->RTOT_prio_0) + Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Tue Aug 8 11:28:38 2017 (r322247) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Tue Aug 8 11:35:02 2017 (r322248) @@ -793,7 +793,7 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int num_pkts = DIV_ROUND_UP(payload_len, mss); ring->bytes += payload_len + (num_pkts * ihs); ring->packets += num_pkts; - priv->port_stats.tso_packets++; + ring->tso_packets++; /* store pointer to inline header */ dseg_inline = dseg; /* copy data inline */ @@ -814,20 +814,11 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int } m_adj(mb, ihs); - /* trim off empty mbufs */ - while (mb->m_len == 0) { - mb = m_free(mb); - /* check if all data has been inlined */ - if (mb == NULL) { - nr_segs = 0; - goto skip_dma; - } - } - err = bus_dmamap_load_mbuf_sg(ring->dma_tag, tx_info->dma_map, mb, segs, &nr_segs, BUS_DMA_NOWAIT); if (unlikely(err == EFBIG)) { /* Too many mbuf fragments */ + ring->defrag_attempts++; m = m_defrag(mb, M_NOWAIT); if (m == NULL) { ring->oversized_packets++; @@ -843,11 +834,18 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int ring->oversized_packets++; goto tx_drop; } - /* make sure all mbuf data is written to RAM */ - bus_dmamap_sync(ring->dma_tag, tx_info->dma_map, - BUS_DMASYNC_PREWRITE); + /* If there were no errors and we didn't load anything, don't sync. */ + if (nr_segs != 0) { + /* make sure all mbuf data is written to RAM */ + bus_dmamap_sync(ring->dma_tag, tx_info->dma_map, + BUS_DMASYNC_PREWRITE); + } else { + /* All data was inlined, free the mbuf. */ + bus_dmamap_unload(ring->dma_tag, tx_info->dma_map); + m_freem(mb); + mb = NULL; + } -skip_dma: /* compute number of DS needed */ ds_cnt = (dseg - ((volatile struct mlx4_wqe_data_seg *)tx_desc)) + nr_segs; Modified: head/sys/dev/mlx4/stats.h ============================================================================== --- head/sys/dev/mlx4/stats.h Tue Aug 8 11:28:38 2017 (r322247) +++ head/sys/dev/mlx4/stats.h Tue Aug 8 11:35:02 2017 (r322248) @@ -126,6 +126,7 @@ struct mlx4_en_port_stats { unsigned long rx_chksum_good; unsigned long rx_chksum_none; unsigned long tx_chksum_offload; + unsigned long defrag_attempts; }; struct mlx4_en_perf_stats { From owner-svn-src-head@freebsd.org Tue Aug 8 11:36:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09C79DD5F52; Tue, 8 Aug 2017 11:36:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB688822BA; Tue, 8 Aug 2017 11:36:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BavNh051822; Tue, 8 Aug 2017 11:36:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Bavr0051821; Tue, 8 Aug 2017 11:36:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708081136.v78Bavr0051821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 8 Aug 2017 11:36:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322250 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 11:36:59 -0000 Author: hselasky Date: Tue Aug 8 11:36:57 2017 New Revision: 322250 URL: https://svnweb.freebsd.org/changeset/base/322250 Log: Count drop events due to lack of PCI bandwidth as queue drops and not as input errors in the mlx5en(4) driver. This improves the sysadmin view of physical port errors. Submitted by: gallatin@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Aug 8 11:35:27 2017 (r322249) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Aug 8 11:36:57 2017 (r322250) @@ -552,7 +552,6 @@ mlx5e_update_stats_work(struct work_struct *work) priv->stats.pport.alignment_err + priv->stats.pport.check_seq_err + priv->stats.pport.crc_align_errors + - priv->stats.pport.drop_events + priv->stats.pport.in_range_len_errors + priv->stats.pport.jabbers + priv->stats.pport.out_of_range_len + @@ -561,7 +560,8 @@ mlx5e_update_stats_work(struct work_struct *work) priv->stats.pport.too_long_errors + priv->stats.pport.undersize_pkts + priv->stats.pport.unsupported_op_rx; - ifp->if_iqdrops = s->rx_out_of_buffer; + ifp->if_iqdrops = s->rx_out_of_buffer + + priv->stats.pport.drop_events; ifp->if_opackets = s->tx_packets; ifp->if_oerrors = s->tx_error_packets; ifp->if_snd.ifq_drops = s->tx_queue_dropped; @@ -2467,7 +2467,6 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt) priv->stats.pport.alignment_err + priv->stats.pport.check_seq_err + priv->stats.pport.crc_align_errors + - priv->stats.pport.drop_events + priv->stats.pport.in_range_len_errors + priv->stats.pport.jabbers + priv->stats.pport.out_of_range_len + @@ -2478,7 +2477,8 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt) priv->stats.pport.unsupported_op_rx; break; case IFCOUNTER_IQDROPS: - retval = priv->stats.vport.rx_out_of_buffer; + retval = priv->stats.vport.rx_out_of_buffer + + priv->stats.pport.drop_events; break; case IFCOUNTER_OPACKETS: retval = priv->stats.vport.tx_packets; From owner-svn-src-head@freebsd.org Tue Aug 8 11:49:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3177EDD69EC; Tue, 8 Aug 2017 11:49:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F27DB82AA9; Tue, 8 Aug 2017 11:49:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BnbZd056190; Tue, 8 Aug 2017 11:49:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BnbGw056189; Tue, 8 Aug 2017 11:49:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708081149.v78BnbGw056189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 8 Aug 2017 11:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322251 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 11:49:38 -0000 Author: hselasky Date: Tue Aug 8 11:49:36 2017 New Revision: 322251 URL: https://svnweb.freebsd.org/changeset/base/322251 Log: Make sure the received IP header gets 32-bit aligned for short packets in the mlx5en(4) driver. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Aug 8 11:36:57 2017 (r322250) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Aug 8 11:49:36 2017 (r322251) @@ -355,9 +355,11 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) rq->stats.wqe_err++; goto wq_ll_pop; } - - if (MHLEN >= byte_cnt && + if ((MHLEN - MLX5E_NET_IP_ALIGN) >= byte_cnt && (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { + /* get IP header aligned */ + mb->m_data += MLX5E_NET_IP_ALIGN; + bcopy(rq->mbuf[wqe_counter].data, mtod(mb, caddr_t), byte_cnt); } else { From owner-svn-src-head@freebsd.org Tue Aug 8 12:18:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE024DD8D90; Tue, 8 Aug 2017 12:18:12 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B85B74B; Tue, 8 Aug 2017 12:18:12 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78CIBmw068414; Tue, 8 Aug 2017 12:18:11 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78CIBvL068413; Tue, 8 Aug 2017 12:18:11 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201708081218.v78CIBvL068413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 8 Aug 2017 12:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322252 - head/usr.bin/vmstat X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/usr.bin/vmstat X-SVN-Commit-Revision: 322252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 12:18:12 -0000 Author: manu Date: Tue Aug 8 12:18:11 2017 New Revision: 322252 URL: https://svnweb.freebsd.org/changeset/base/322252 Log: vmstat: Always emit a space after the free-memory column When displaying in non-human form, if the free-memory number is large (more than 7 digits), there is no space between it and the page fault column. PR: 221290 Submitted by: Josuah Demangeon (Original version) Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Tue Aug 8 11:49:36 2017 (r322251) +++ head/usr.bin/vmstat/vmstat.c Tue Aug 8 12:18:11 2017 (r322252) @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps) xo_emit(" "); xo_emit("{:free-memory/%7d}", vmstat_pgtok(total.t_free)); + xo_emit(" "); } xo_emit("{:total-page-faults/%5lu} ", (unsigned long)rate(sum.v_vm_faults - From owner-svn-src-head@freebsd.org Tue Aug 8 13:27:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C51EDAB321; Tue, 8 Aug 2017 13:27:33 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69CD72DB3; Tue, 8 Aug 2017 13:27:33 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78DRWQ0096544; Tue, 8 Aug 2017 13:27:32 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78DRW6G096543; Tue, 8 Aug 2017 13:27:32 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <201708081327.v78DRW6G096543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Tue, 8 Aug 2017 13:27:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322253 - head/sys/dev/cyapa X-SVN-Group: head X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: head/sys/dev/cyapa X-SVN-Commit-Revision: 322253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 13:27:33 -0000 Author: grembo (ports committer) Date: Tue Aug 8 13:27:32 2017 New Revision: 322253 URL: https://svnweb.freebsd.org/changeset/base/322253 Log: Fix typo in cyapa out of bounds check. PR: 217783 Submitted by: razmyslov@viva64.com MFC after: 1 week Modified: head/sys/dev/cyapa/cyapa.c Modified: head/sys/dev/cyapa/cyapa.c ============================================================================== --- head/sys/dev/cyapa/cyapa.c Tue Aug 8 12:18:11 2017 (r322252) +++ head/sys/dev/cyapa/cyapa.c Tue Aug 8 13:27:32 2017 (r322253) @@ -1455,7 +1455,7 @@ cyapa_raw_input(struct cyapa_softc *sc, struct cyapa_r sc->delta_x = sc->cap_resx; if (sc->delta_x < -sc->cap_resx) sc->delta_x = -sc->cap_resx; - if (sc->delta_y > sc->cap_resx) + if (sc->delta_y > sc->cap_resy) sc->delta_y = sc->cap_resy; if (sc->delta_y < -sc->cap_resy) sc->delta_y = -sc->cap_resy; From owner-svn-src-head@freebsd.org Tue Aug 8 13:56:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FE46DB4FF0; Tue, 8 Aug 2017 13:56:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id C47386342B; Tue, 8 Aug 2017 13:56:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 32CAF104AEEA; Tue, 8 Aug 2017 23:55:53 +1000 (AEST) Date: Tue, 8 Aug 2017 23:55:52 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Emmanuel Vadot cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322252 - head/usr.bin/vmstat In-Reply-To: <201708081218.v78CIBvL068413@repo.freebsd.org> Message-ID: <20170808225104.I3528@besplex.bde.org> References: <201708081218.v78CIBvL068413@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=Q9sN3FMeAAAA:8 a=IM31cjteyJiYWX7TRqIA:9 a=wIYqAnBEUc7iLIlU:21 a=DlAg6Rs7D7Kog30i:21 a=CjuIK1q_8ugA:10 a=mnDzqiP7QBHErLppGYsC:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 13:56:01 -0000 On Tue, 8 Aug 2017, Emmanuel Vadot wrote: > Log: > vmstat: Always emit a space after the free-memory column > > When displaying in non-human form, if the free-memory number > is large (more than 7 digits), there is no space between it and > the page fault column. > > PR: 221290 > Submitted by: Josuah Demangeon (Original version) > > Modified: > head/usr.bin/vmstat/vmstat.c > > Modified: head/usr.bin/vmstat/vmstat.c > ============================================================================== > --- head/usr.bin/vmstat/vmstat.c Tue Aug 8 11:49:36 2017 (r322251) > +++ head/usr.bin/vmstat/vmstat.c Tue Aug 8 12:18:11 2017 (r322252) > @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps) > xo_emit(" "); > xo_emit("{:free-memory/%7d}", > vmstat_pgtok(total.t_free)); > + xo_emit(" "); > } > xo_emit("{:total-page-faults/%5lu} ", > (unsigned long)rate(sum.v_vm_faults - This seems to break the formatting. There was a negative amount of space available for expansion, and since the header was not expanded to match its alignment with the fields is more random than before. With -h, the width was 80 columns, giving ugly line wrap on 80-column terminals with auto-wrap. Now it is 81 columns, giving uglier line wrap on all 80- column terminals. The bugs were mostly in the first line of the header: - the second line of the header was correct for vmstat -h - for vmstat without -h, the second line of the header was apparently broken by a change like the one here, that added a space after the "r b w" fields without adding one in the "r b w" header - most of the fields in the first line of the header are misaligned with the second lone. Many have drifted 3 to the left of where the were in a sort of center-justified place. Some of these might have actually been intended to be left justified, but had an off by +1 error. Now these have an error of off by -2 relative to left justifications. Only the "memory" header in the first line is better than in old versions. It is now left justified. Left justifying all headers in the first line is probably best. I couldn't find a good way to delimit the right hand side of the extents of the headers in the first line. The second line of the headers already uses right justification consistently and this works well. Bruce From owner-svn-src-head@freebsd.org Tue Aug 8 14:15:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3186DB6028; Tue, 8 Aug 2017 14:15:20 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D809463E0A; Tue, 8 Aug 2017 14:15:18 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id d0a43a1c; Tue, 8 Aug 2017 16:15:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=j90AO2uKb8a+TCyvXumjW/Lu9rw=; b=HIF8HbVeVNSIxXLEatRPHBxjcqBL r/PHGQTLckdR5dPCfYd7DXsDiaBqPCgQ78nH9X1IUs3kp7BUGtpGmyyhovhluLFx JmPcviDV0gzMJ+fqLVumzrGMTjgehgp5TWsDsbUXTgMCRjXE/rayDHDn7hl58c85 7+wh3Yuow2Y8oNc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=HArmG9I3ADKaIJBP7SzK9MHSgD/JX5cqMuS6KbibH1+d70WywW2EwRf5 fe4d1sNNkGujjVDkeI8IEV6GH+CPwqNHHxYek9fCiuXaEt5R0n8nrfW/GgXWG0Lj 675qQbqC2EoFLl4oaubXh0CQHGHpweroMOjyV8atb2rjxqeJhDQ= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 84b4059f TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Tue, 8 Aug 2017 16:15:09 +0200 (CEST) Date: Tue, 8 Aug 2017 16:15:07 +0200 From: Emmanuel Vadot To: Bruce Evans Cc: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322252 - head/usr.bin/vmstat Message-Id: <20170808161507.2d185d394dc921eac6729d89@bidouilliste.com> In-Reply-To: <20170808225104.I3528@besplex.bde.org> References: <201708081218.v78CIBvL068413@repo.freebsd.org> <20170808225104.I3528@besplex.bde.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 14:15:21 -0000 On Tue, 8 Aug 2017 23:55:52 +1000 (EST) Bruce Evans wrote: > On Tue, 8 Aug 2017, Emmanuel Vadot wrote: > > > Log: > > vmstat: Always emit a space after the free-memory column > > > > When displaying in non-human form, if the free-memory number > > is large (more than 7 digits), there is no space between it and > > the page fault column. > > > > PR: 221290 > > Submitted by: Josuah Demangeon (Original version) > > > > Modified: > > head/usr.bin/vmstat/vmstat.c > > > > Modified: head/usr.bin/vmstat/vmstat.c > > ============================================================================== > > --- head/usr.bin/vmstat/vmstat.c Tue Aug 8 11:49:36 2017 (r322251) > > +++ head/usr.bin/vmstat/vmstat.c Tue Aug 8 12:18:11 2017 (r322252) > > @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps) > > xo_emit(" "); > > xo_emit("{:free-memory/%7d}", > > vmstat_pgtok(total.t_free)); > > + xo_emit(" "); > > } > > xo_emit("{:total-page-faults/%5lu} ", > > (unsigned long)rate(sum.v_vm_faults - > > This seems to break the formatting. There was a negative amount of space > available for expansion, and since the header was not expanded to match > its alignment with the fields is more random than before. With -h, the > width was 80 columns, giving ugly line wrap on 80-column terminals with > auto-wrap. Now it is 81 columns, giving uglier line wrap on all 80- > column terminals. This break nothing, This was the case before too (with or without -h), just tested in tmux with force-width 80. > The bugs were mostly in the first line of the header: > - the second line of the header was correct for vmstat -h > - for vmstat without -h, the second line of the header was apparently broken > by a change like the one here, that added a space after the "r b w" fields > without adding one in the "r b w" header > - most of the fields in the first line of the header are misaligned with the > second lone. Many have drifted 3 to the left of where the were in a sort > of center-justified place. Some of these might have actually been > intended to be left justified, but had an off by +1 error. Now these > have an error of off by -2 relative to left justifications. > > Only the "memory" header in the first line is better than in old versions. > It is now left justified. Left justifying all headers in the first line > is probably best. I couldn't find a good way to delimit the right hand > side of the extents of the headers in the first line. The second line of > the headers already uses right justification consistently and this works > well. > > Bruce I think that all this might be true but you might talk about the whole libxo conversion that was done, not my commit right ? -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Tue Aug 8 15:37:22 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA2E4DBE9B9; Tue, 8 Aug 2017 15:37:22 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A89606688E; Tue, 8 Aug 2017 15:37:22 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78FbLKQ049560; Tue, 8 Aug 2017 15:37:21 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78FbLUp049559; Tue, 8 Aug 2017 15:37:21 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708081537.v78FbLUp049559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 8 Aug 2017 15:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322255 - head/tests/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/netinet X-SVN-Commit-Revision: 322255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 15:37:23 -0000 Author: asomers Date: Tue Aug 8 15:37:21 2017 New Revision: 322255 URL: https://svnweb.freebsd.org/changeset/base/322255 Log: tests/sys/netinet/fibs_test: skip selected tests when firewalls are enabled Some tests send packets over epair(4) interfaces. Firewalls can cause spurious failures. Reviewed by: ngie MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11917 Modified: head/tests/sys/netinet/fibs_test.sh Modified: head/tests/sys/netinet/fibs_test.sh ============================================================================== --- head/tests/sys/netinet/fibs_test.sh Tue Aug 8 13:44:32 2017 (r322254) +++ head/tests/sys/netinet/fibs_test.sh Tue Aug 8 15:37:21 2017 (r322255) @@ -766,6 +766,12 @@ get_epair() { local EPAIRD + if (which pfctl && pfctl -s info | grep -q 'Status: Enabled') || + [ `sysctl -n net.inet.ip.fw.enable` = "1" ] || + (which ipf && ipf -V); then + atf_skip "firewalls interfere with this test" + fi + if EPAIRD=`ifconfig epair create`; then # Record the epair device so we can clean it up later echo ${EPAIRD} >> "ifaces_to_cleanup" From owner-svn-src-head@freebsd.org Tue Aug 8 15:37:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E12CEDBEA8E; Tue, 8 Aug 2017 15:37:45 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7547F669E0; Tue, 8 Aug 2017 15:37:45 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-wm0-x234.google.com with SMTP id t201so10505854wmt.1; Tue, 08 Aug 2017 08:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=+QoJ5nLEdlva+48nefCUfmlEdR6Xo7uX1Gi/t1hAd0o=; b=iq5M+s4Ask3Jdgjvq01KqeBOqBH2gwCzhwAhJRHVEMf/MSV/99ix6miijoIVExU0Yc e+mRciFfjPG75CtvTxwYnt/UQ66bOs0U7YFhM1G7Rv5SY2utZdv6y4BHTqF6yvYpr53f usUiFGzsIG+dpHqBL3ITI/h/p1ZovZX4viPHb+umilQV1byjztlOmUOXDfsjVcbbtdLk Sx8WFCOCTbTDWJQ0teglHRyuingtnyiBiYhy7uv/af0HypBrCmYpQXhtt+VRqhQ0BJ7e ctQb1+ZWZvK1fMDmVVNxOu4FWb5xNxmqGwzoEQLCYksrTm0BT1e01IFpSBf+XycdIaWI WlZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=+QoJ5nLEdlva+48nefCUfmlEdR6Xo7uX1Gi/t1hAd0o=; b=SjaAkvdBDdVibd03e06s3XaioP2uHeUa9/xlT1zS9fgmCFOCbvJBVataJAGpXN7gIs lxOj00LeEkBXIY/pvp2zcQ43UdCdIA0tR3APLAH0Hr4F6d4X72OikQ9w/sFc/fZkrp29 fXOVKvZfN4Rv6G5DABF4fKKvnoKeFUJyG0paaTQhX8U3aQ8fISVthQZo4h9cVR51lDC1 i1KaAcXro1ANheZNu+mhtKlQlijVdao1/NIInTiyx/slPBrvKUQ4lw41ZgXk6EGZ72s/ qfW/0w/McUJwzzjuJ//kamrhf5IX7JLNDH2FXA5Qnz9kDtVWaGdkEuqMDs7OrdgHWY9l J+MQ== X-Gm-Message-State: AHYfb5gsN72YFexL4AK3ziUIfLyyV7GE/xZop2gi6rYC+ad2/+TsJVqb PzDEg6vV3zBQLEeDvBtVOjVWbeyYBA== X-Received: by 10.28.207.77 with SMTP id f74mr3251733wmg.166.1502206663327; Tue, 08 Aug 2017 08:37:43 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.28.208.3 with HTTP; Tue, 8 Aug 2017 08:37:42 -0700 (PDT) In-Reply-To: <201708080459.v784xGvm089103@repo.freebsd.org> References: <201708080459.v784xGvm089103@repo.freebsd.org> From: Alan Somers Date: Tue, 8 Aug 2017 09:37:42 -0600 X-Google-Sender-Auth: bRmhaGVNx65__NTTqcntfrCbUBA Message-ID: Subject: Re: svn commit: r322214 - in head/tests: etc/rc.d sys/acl sys/file sys/geom/class/eli sys/geom/class/gate sys/geom/class/mirror sys/geom/class/nop sys/geom/class/uzip sys/kern sys/kqueue/libkqueue sys/... To: Ngie Cooper Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 15:37:46 -0000 On Mon, Aug 7, 2017 at 10:59 PM, Ngie Cooper wrote: > Author: ngie > Date: Tue Aug 8 04:59:16 2017 > New Revision: 322214 > URL: https://svnweb.freebsd.org/changeset/base/322214 > > Log: > Make test scripts under tests/... non-executable > > Executable bits should be set at install time instead of in the repo. > Setting executable bits on files triggers false positives with Phabricator. > > MFC after: 2 months Thanks! That was really annoying. From owner-svn-src-head@freebsd.org Tue Aug 8 15:46:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F3DEDBF3FF; Tue, 8 Aug 2017 15:46:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2FBD66F80; Tue, 8 Aug 2017 15:46:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78FkTWH053762; Tue, 8 Aug 2017 15:46:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78FkTr8053761; Tue, 8 Aug 2017 15:46:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708081546.v78FkTr8053761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 8 Aug 2017 15:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322256 - head/sys/dev/hwpmc X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/hwpmc X-SVN-Commit-Revision: 322256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 15:46:31 -0000 Author: kib Date: Tue Aug 8 15:46:29 2017 New Revision: 322256 URL: https://svnweb.freebsd.org/changeset/base/322256 Log: Fix logic error in the the assert, causing the condition to be always true. Also improve the formatting of the corresponding KASSERT message. Based on the submission by: Svyatoslav Found by: PVS-Studio PR: 217741 Reviewed by: emaste Sponsored by: The FreeBSD Foundation (kib) MFC after: 1 week Modified: head/sys/dev/hwpmc/hwpmc_piv.c Modified: head/sys/dev/hwpmc/hwpmc_piv.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_piv.c Tue Aug 8 15:37:21 2017 (r322255) +++ head/sys/dev/hwpmc/hwpmc_piv.c Tue Aug 8 15:46:29 2017 (r322256) @@ -809,8 +809,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm) mtx_lock_spin(&pc->pc_mtx); cfgflags = P4_PCPU_GET_CFGFLAGS(pc,ri); - KASSERT(cfgflags >= 0 || cfgflags <= 3, - ("[p4,%d] illegal cfgflags cfg=%d on cpu=%d ri=%d", __LINE__, + KASSERT((cfgflags & ~0x3) == 0, + ("[p4,%d] illegal cfgflags cfg=%#x on cpu=%d ri=%d", __LINE__, cfgflags, cpu, ri)); KASSERT(cfgflags == 0 || phw->phw_pmc, @@ -835,8 +835,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm) phw->phw_pmc = NULL; } - KASSERT(cfgflags >= 0 || cfgflags <= 3, - ("[p4,%d] illegal runcount cfg=%d on cpu=%d ri=%d", __LINE__, + KASSERT((cfgflags & ~0x3) == 0, + ("[p4,%d] illegal runcount cfg=%#x on cpu=%d ri=%d", __LINE__, cfgflags, cpu, ri)); P4_PCPU_SET_CFGFLAGS(pc,ri,cfgflags); From owner-svn-src-head@freebsd.org Tue Aug 8 15:54:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 417FEDBFCD9; Tue, 8 Aug 2017 15:54:58 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDF5B67734; Tue, 8 Aug 2017 15:54:57 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-wm0-x22d.google.com with SMTP id m85so10927994wma.0; Tue, 08 Aug 2017 08:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=r59vfEwSpV8HuaQHJI5uk0WH51BnEwLyYVk57jS6ru8=; b=dbdjcY6bP3c4e/lYjOQfcA/3nT2eeg7F8oKaOb8TaF27NhR/ybn8APiSxOQay5mjrP 1qhIEnZJwQYnVC56GybUnEqI7DTba4oteVe40RrhJ/4ZsHngI+HPTVtWH6zbqW52xASs 1hjdLmFlNMpOXfG/YXxhmzPDWJN9jM5VIL8wXiFppQm98t/ejQ8MXF+2GDFnMcWbBOwC pd32ElxPfF37oYBCGbdtsRpa7tb7bZlLuxRaeDdRDLBeULe3b45p+MOsi1Dx4ZDL2K9T 7bTv+OXABo/887nOSE6ILaGYkX62xsKcnuoMkKhfUs/wEHP0P5umkA49+X6P/FbF7fnx qoVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=r59vfEwSpV8HuaQHJI5uk0WH51BnEwLyYVk57jS6ru8=; b=fK0l17qTADq2tHXkqkhucyBtOJXOuWx4BcvrQKoN9ZTlB3Gaim25wffRTSiORDXx68 jTQ6LErTjT/H6PdncPIc8/5Ib3KGU2WYTCRTmFdEiZMts2z66XEX9MoFO3/2gfGNL+9G DpEPhq2nKjRLn313Xl0z5S933tvhv2k7V/tkgFB0J6ZQ/5XLMPpZn980Xy9TwgKPv1f9 yybekX5EULiQ/ZTTDusUfOHjugZJYFGmfzm81ul14BDydUaaEd/npyBUrI/ccqJN6v3k 82bWFYcwrSPipwVAAoJr2FpLeYVQUIzjT154UH0FKYs4G5jwK+MmExgC+IizJZd0l/eY cIdw== X-Gm-Message-State: AHYfb5hhtm8XQBhTb9O10zEjl4s9gKlsBzIv1Qh1Jbuc7PaDfQRogI0m 6Gel5PqpICxNlDLyEQwYsZZSDP7uNw== X-Received: by 10.28.152.143 with SMTP id a137mr2874298wme.176.1502207695940; Tue, 08 Aug 2017 08:54:55 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.28.208.3 with HTTP; Tue, 8 Aug 2017 08:54:55 -0700 (PDT) In-Reply-To: <201607082344.u68NiAcj026917@repo.freebsd.org> References: <201607082344.u68NiAcj026917@repo.freebsd.org> From: Alan Somers Date: Tue, 8 Aug 2017 09:54:55 -0600 X-Google-Sender-Auth: w67BqhUpB5ESk340_FIizwV63ck Message-ID: Subject: Re: svn commit: r302474 - in head: cddl/lib/libdtrace tests/sys/netinet To: "George V. Neville-Neil" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 15:54:58 -0000 On Fri, Jul 8, 2016 at 5:44 PM, George V. Neville-Neil wrote: > Author: gnn > Date: Fri Jul 8 23:44:09 2016 > New Revision: 302474 > URL: https://svnweb.freebsd.org/changeset/base/302474 > > Log: > On FreeBSD there is a setsockopt option SO_USER_COOKIE which allows > setting a 32 bit value on each socket. This can be used by applications > and DTrace as a rendezvous point so that an applicaton's data can > more easily be captured at run time. Expose the user cookie via > DTrace by updating the translator in tcp.d and add a quick test > program, a TCP server, that sets the cookie on each connection > accepted. > > Reviewed by: hiren > MFC after: 1 week > Sponsored by: Limelight Networks > Differential Revision: https://reviews.freebsd.org/D7152 I just noticed that the test program isn't hooked up to Kyua at all. Nothing will ever run it. Is there supposed to be a short atf-sh script that invokes it? -Alan From owner-svn-src-head@freebsd.org Tue Aug 8 16:06:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 637A1DC07BC; Tue, 8 Aug 2017 16:06:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B07B67E42; Tue, 8 Aug 2017 16:06:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78G6GZv062612; Tue, 8 Aug 2017 16:06:16 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78G6GSI062611; Tue, 8 Aug 2017 16:06:16 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708081606.v78G6GSI062611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 8 Aug 2017 16:06:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322257 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 322257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 16:06:17 -0000 Author: imp Date: Tue Aug 8 16:06:16 2017 New Revision: 322257 URL: https://svnweb.freebsd.org/changeset/base/322257 Log: Use the correct queue depth for nda devices. Submitted by: Matt Williams Modified: head/sys/dev/nvme/nvme_sim.c Modified: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- head/sys/dev/nvme/nvme_sim.c Tue Aug 8 15:46:29 2017 (r322256) +++ head/sys/dev/nvme/nvme_sim.c Tue Aug 8 16:06:16 2017 (r322257) @@ -253,7 +253,7 @@ nvme_sim_new_controller(struct nvme_controller *ctrlr) int unit; struct nvme_sim_softc *sc = NULL; - max_trans = 256;/* XXX not so simple -- must match queues */ + max_trans = ctrlr->num_io_queues; unit = device_get_unit(ctrlr->dev); devq = cam_simq_alloc(max_trans); if (devq == NULL) From owner-svn-src-head@freebsd.org Tue Aug 8 16:14:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58D76DC0D93; Tue, 8 Aug 2017 16:14:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34F31683EB; Tue, 8 Aug 2017 16:14:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78GEWl2066450; Tue, 8 Aug 2017 16:14:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78GEVGY066448; Tue, 8 Aug 2017 16:14:31 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708081614.v78GEVGY066448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 8 Aug 2017 16:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322258 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 16:14:33 -0000 Author: asomers Date: Tue Aug 8 16:14:31 2017 New Revision: 322258 URL: https://svnweb.freebsd.org/changeset/base/322258 Log: Make p1003_1b.aio_listio_max a tunable p1003_1b.aio_listio_max is now a tunable. Its value is reflected in the sysctl of the same name, and the sysconf(3) variable _SC_AIO_LISTIO_MAX. Its value will be bounded from below by the compile-time constant AIO_LISTIO_MAX and from above by the compile-time constant MAX_AIO_QUEUE_PER_PROC and the tunable vfs.aio.max_aio_queue. Reviewed by: jhb, kib MFC after: 3 weeks Relnotes: yes Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11601 Modified: head/sys/kern/posix4_mib.c head/sys/kern/vfs_aio.c Modified: head/sys/kern/posix4_mib.c ============================================================================== --- head/sys/kern/posix4_mib.c Tue Aug 8 16:06:16 2017 (r322257) +++ head/sys/kern/posix4_mib.c Tue Aug 8 16:14:31 2017 (r322258) @@ -91,7 +91,6 @@ P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync); P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects); P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io); P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers); -P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max); P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max); P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max); P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max); Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Aug 8 16:06:16 2017 (r322257) +++ head/sys/kern/vfs_aio.c Tue Aug 8 16:14:31 2017 (r322258) @@ -102,6 +102,7 @@ static uint64_t jobseqno; #endif FEATURE(aio, "Asynchronous I/O"); +SYSCTL_DECL(_p1003_1b); static MALLOC_DEFINE(M_LIO, "lio", "listio aio control block list"); @@ -168,6 +169,11 @@ static int max_buf_aio = MAX_BUF_AIO; SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0, "Maximum buf aio requests per process (stored in the process)"); +static int aio_listio_max = AIO_LISTIO_MAX; +SYSCTL_INT(_p1003_1b, CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max, + CTLFLAG_RDTUN | CTLFLAG_CAPRD, &aio_listio_max, 0, + "Maximum aio requests for a single lio_listio call"); + #ifdef COMPAT_FREEBSD6 typedef struct oaiocb { int aio_fildes; /* File descriptor */ @@ -388,6 +394,11 @@ static int aio_onceonly(void) { + if (aio_listio_max < AIO_LISTIO_MAX) + aio_listio_max = AIO_LISTIO_MAX; + if (aio_listio_max > MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count)) + aio_listio_max = MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count); + exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL, EVENTHANDLER_PRI_ANY); exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown_exec, @@ -405,14 +416,13 @@ aio_onceonly(void) NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiocb_zone = uma_zcreate("AIOCB", sizeof(struct kaiocb), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - aiol_zone = uma_zcreate("AIOL", AIO_LISTIO_MAX*sizeof(intptr_t) , NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + aiol_zone = uma_zcreate("AIOL", aio_listio_max * sizeof(intptr_t) , + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiolio_zone = uma_zcreate("AIOLIO", sizeof(struct aioliojob), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiod_lifetime = AIOD_LIFETIME_DEFAULT; jobrefid = 1; p31b_setcfg(CTL_P1003_1B_ASYNCHRONOUS_IO, _POSIX_ASYNCHRONOUS_IO); - p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, AIO_LISTIO_MAX); p31b_setcfg(CTL_P1003_1B_AIO_MAX, MAX_AIO_QUEUE); p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, 0); @@ -1943,7 +1953,7 @@ sys_aio_suspend(struct thread *td, struct aio_suspend_ struct aiocb **ujoblist; int error; - if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX) + if (uap->nent < 0 || uap->nent > aio_listio_max) return (EINVAL); if (uap->timeout) { @@ -2151,7 +2161,7 @@ kern_lio_listio(struct thread *td, int mode, struct ai if ((mode != LIO_NOWAIT) && (mode != LIO_WAIT)) return (EINVAL); - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (p->p_aioinfo == NULL) @@ -2283,7 +2293,7 @@ freebsd6_lio_listio(struct thread *td, struct freebsd6 return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2320,7 +2330,7 @@ sys_lio_listio(struct thread *td, struct lio_listio_ar return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2789,7 +2799,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs uint32_t *ujoblist32; int error, i; - if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX) + if (uap->nent < 0 || uap->nent > aio_listio_max) return (EINVAL); if (uap->timeout) { @@ -2915,7 +2925,7 @@ freebsd6_freebsd32_lio_listio(struct thread *td, return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2961,7 +2971,7 @@ freebsd32_lio_listio(struct thread *td, struct freebsd return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { From owner-svn-src-head@freebsd.org Tue Aug 8 17:40:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D99E8DC5886 for ; Tue, 8 Aug 2017 17:40:01 +0000 (UTC) (envelope-from alex.brown@united-email.info) Received: from mserver.united-email.info (mail.united-email.info [137.59.52.162]) by mx1.freebsd.org (Postfix) with ESMTP id 4DA436BC58 for ; Tue, 8 Aug 2017 17:39:59 +0000 (UTC) (envelope-from alex.brown@united-email.info) Received: from unitedPC (unknown [202.133.79.30]) by mserver.united-email.info (Postfix) with ESMTPA id 87EEC101F39C9 for ; Tue, 8 Aug 2017 23:14:53 +0530 (IST) Reply-To: From: "Alex Brown" To: Subject: List Procurement Date: Tue, 8 Aug 2017 12:39:16 -0500 Message-ID: MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdMQbUBnnD5T6pQMSG2qS/6PVOdH6w== Content-Language: en-us Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 17:40:01 -0000 Hello, Would you be interested in highly potential and responsive business Database for your business mktg, events, exhibitions and conferences? The file would include COMPANY NAME, CONTACT NAME, TITLE, OPT-IN EMAIL, PHONE NUMBER, PHYSICAL ADDRESS, ZIP/POSTAL CODE, INDUSTRY, SIC CODE, EMPLOYEE SIZE, REVENUE SIZE, ETC. INDUSTRY: (Any INDUSTRY you prefer) 01-09 Agriculture, Forestry, Fishing 10-14 Mining 15-17 Construction 20-39 Manufacturing 40-49 Transportation & Public Utilities 50-51 Wholesale Trade 52-59 Retail Trade 60-67 Finance, Insurance, Real Estate 70-89 Services 91-99 Public Administration TITLE: Owner, Founders, CEO, CTO, CFO, CMO, VP, Directors, Heads, Managers, Executives, from any department GEOGRAPHY: Any country/region you prefer across the Globe Let me know your target requirement like: Industries : ?, Job Titles : ?, Geography : ? We look forward to hearing from you. Best Regards, Alex Brown | Business Development Associate | T: +1 610 572 4885 Global Business Data - Email Append - Data Append. If you are not interested in receiving further emails, please reply back with "LEAVEOUT" in the subject line". From owner-svn-src-head@freebsd.org Tue Aug 8 17:49:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A95DDC60D3; Tue, 8 Aug 2017 17:49:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D96116C090; Tue, 8 Aug 2017 17:49:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78HnvAg027493; Tue, 8 Aug 2017 17:49:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Hnvju027492; Tue, 8 Aug 2017 17:49:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708081749.v78Hnvju027492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 8 Aug 2017 17:49:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322270 - head/sys/dev/mly X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/mly X-SVN-Commit-Revision: 322270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 17:49:59 -0000 Author: jhb Date: Tue Aug 8 17:49:57 2017 New Revision: 322270 URL: https://svnweb.freebsd.org/changeset/base/322270 Log: Fix a NULL pointer dereference in mly_user_command(). If mly_user_command fails to allocate a command slot it jumps to an 'out' label used for error handling. The error handling code checks for a data buffer in 'mc->mc_data' to free before checking if 'mc' is NULL. Fix by just returning directly if we fail to allocate a command and only using the 'out' label for subsequent errors when there is actual cleanup to perform. PR: 217747 Reported by: PVS-Studio Reviewed by: emaste MFC after: 1 week Modified: head/sys/dev/mly/mly.c Modified: head/sys/dev/mly/mly.c ============================================================================== --- head/sys/dev/mly/mly.c Tue Aug 8 17:26:19 2017 (r322269) +++ head/sys/dev/mly/mly.c Tue Aug 8 17:49:57 2017 (r322270) @@ -2892,8 +2892,7 @@ mly_user_command(struct mly_softc *sc, struct mly_user MLY_LOCK(sc); if (mly_alloc_command(sc, &mc)) { MLY_UNLOCK(sc); - error = ENOMEM; - goto out; /* XXX Linux version will wait for a command */ + return (ENOMEM); /* XXX Linux version will wait for a command */ } MLY_UNLOCK(sc); @@ -2952,11 +2951,9 @@ mly_user_command(struct mly_softc *sc, struct mly_user out: if (mc->mc_data != NULL) free(mc->mc_data, M_DEVBUF); - if (mc != NULL) { - MLY_LOCK(sc); - mly_release_command(mc); - MLY_UNLOCK(sc); - } + MLY_LOCK(sc); + mly_release_command(mc); + MLY_UNLOCK(sc); return(error); } From owner-svn-src-head@freebsd.org Tue Aug 8 18:31:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFFDADC86F5; Tue, 8 Aug 2017 18:31:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F9606E1BA; Tue, 8 Aug 2017 18:31:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78IVewE047831; Tue, 8 Aug 2017 18:31:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78IVea9047830; Tue, 8 Aug 2017 18:31:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708081831.v78IVea9047830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 8 Aug 2017 18:31:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322271 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 322271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 18:31:41 -0000 Author: emaste Date: Tue Aug 8 18:31:40 2017 New Revision: 322271 URL: https://svnweb.freebsd.org/changeset/base/322271 Log: Remove now-unused badsb declaration, missed in r322200 Sponsored by: The FreeBSD Foundation Modified: head/sbin/fsck_ffs/setup.c Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Tue Aug 8 17:49:57 2017 (r322270) +++ head/sbin/fsck_ffs/setup.c Tue Aug 8 18:31:40 2017 (r322271) @@ -58,8 +58,6 @@ struct bufarea asblk; #define altsblock (*asblk.b_un.b_fs) #define POWEROF2(num) (((num) & ((num) - 1)) == 0) -static void badsb(int listerr, const char *s); - /* * Read in a superblock finding an alternate if necessary. * Return 1 if successful, 0 if unsuccessful, -1 if file system From owner-svn-src-head@freebsd.org Tue Aug 8 19:36:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DACADCBDCF; Tue, 8 Aug 2017 19:36:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A0BE7091B; Tue, 8 Aug 2017 19:36:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78JaY8X074052; Tue, 8 Aug 2017 19:36:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78JaY4m074051; Tue, 8 Aug 2017 19:36:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708081936.v78JaY4m074051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 8 Aug 2017 19:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322272 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 322272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 19:36:35 -0000 Author: mav Date: Tue Aug 8 19:36:34 2017 New Revision: 322272 URL: https://svnweb.freebsd.org/changeset/base/322272 Log: Fix few issues of LinuxKPI workqueue. LinuxKPI workqueue wrappers reported "successful" cancellation for works already completed in normal way. This change brings reported status and real cancellation fact into sync. This required for drm-next operation. Reviewed by: hselasky (earlier version) Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D11904 Modified: head/sys/compat/linuxkpi/common/src/linux_work.c Modified: head/sys/compat/linuxkpi/common/src/linux_work.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_work.c Tue Aug 8 18:31:40 2017 (r322271) +++ head/sys/compat/linuxkpi/common/src/linux_work.c Tue Aug 8 19:36:34 2017 (r322272) @@ -214,7 +214,7 @@ linux_work_fn(void *context, int pending) [WORK_ST_TIMER] = WORK_ST_EXEC, /* delayed work w/o timeout */ [WORK_ST_TASK] = WORK_ST_EXEC, /* call callback */ [WORK_ST_EXEC] = WORK_ST_IDLE, /* complete callback */ - [WORK_ST_CANCEL] = WORK_ST_IDLE, /* complete cancel */ + [WORK_ST_CANCEL] = WORK_ST_EXEC, /* failed to cancel */ }; struct work_struct *work; struct workqueue_struct *wq; @@ -236,6 +236,7 @@ linux_work_fn(void *context, int pending) switch (linux_update_state(&work->state, states)) { case WORK_ST_TIMER: case WORK_ST_TASK: + case WORK_ST_CANCEL: WQ_EXEC_UNLOCK(wq); /* call work function */ @@ -266,13 +267,14 @@ linux_delayed_work_timer_fn(void *arg) [WORK_ST_IDLE] = WORK_ST_IDLE, /* NOP */ [WORK_ST_TIMER] = WORK_ST_TASK, /* start queueing task */ [WORK_ST_TASK] = WORK_ST_TASK, /* NOP */ - [WORK_ST_EXEC] = WORK_ST_TASK, /* queue task another time */ - [WORK_ST_CANCEL] = WORK_ST_IDLE, /* complete cancel */ + [WORK_ST_EXEC] = WORK_ST_EXEC, /* NOP */ + [WORK_ST_CANCEL] = WORK_ST_TASK, /* failed to cancel */ }; struct delayed_work *dwork = arg; switch (linux_update_state(&dwork->work.state, states)) { case WORK_ST_TIMER: + case WORK_ST_CANCEL: linux_delayed_work_enqueue(dwork); break; default: @@ -290,10 +292,10 @@ linux_cancel_work_sync(struct work_struct *work) { static const uint8_t states[WORK_ST_MAX] __aligned(8) = { [WORK_ST_IDLE] = WORK_ST_IDLE, /* NOP */ - [WORK_ST_TIMER] = WORK_ST_IDLE, /* idle */ - [WORK_ST_TASK] = WORK_ST_IDLE, /* idle */ - [WORK_ST_EXEC] = WORK_ST_IDLE, /* idle */ - [WORK_ST_CANCEL] = WORK_ST_IDLE, /* idle */ + [WORK_ST_TIMER] = WORK_ST_TIMER, /* can't happen */ + [WORK_ST_TASK] = WORK_ST_IDLE, /* cancel and drain */ + [WORK_ST_EXEC] = WORK_ST_IDLE, /* too late, drain */ + [WORK_ST_CANCEL] = WORK_ST_IDLE, /* cancel and drain */ }; struct taskqueue *tq; @@ -302,7 +304,13 @@ linux_cancel_work_sync(struct work_struct *work) switch (linux_update_state(&work->state, states)) { case WORK_ST_IDLE: + case WORK_ST_TIMER: return (0); + case WORK_ST_EXEC: + tq = work->work_queue->taskqueue; + if (taskqueue_cancel(tq, &work->work_task, NULL) != 0) + taskqueue_drain(tq, &work->work_task); + return (0); default: tq = work->work_queue->taskqueue; if (taskqueue_cancel(tq, &work->work_task, NULL) != 0) @@ -343,23 +351,29 @@ linux_cancel_delayed_work(struct delayed_work *dwork) { static const uint8_t states[WORK_ST_MAX] __aligned(8) = { [WORK_ST_IDLE] = WORK_ST_IDLE, /* NOP */ - [WORK_ST_TIMER] = WORK_ST_CANCEL, /* cancel */ - [WORK_ST_TASK] = WORK_ST_CANCEL, /* cancel */ - [WORK_ST_EXEC] = WORK_ST_CANCEL, /* cancel */ - [WORK_ST_CANCEL] = WORK_ST_CANCEL, /* cancel */ + [WORK_ST_TIMER] = WORK_ST_CANCEL, /* try to cancel */ + [WORK_ST_TASK] = WORK_ST_CANCEL, /* try to cancel */ + [WORK_ST_EXEC] = WORK_ST_EXEC, /* NOP */ + [WORK_ST_CANCEL] = WORK_ST_CANCEL, /* NOP */ }; struct taskqueue *tq; switch (linux_update_state(&dwork->work.state, states)) { case WORK_ST_TIMER: - if (linux_cancel_timer(dwork, 0)) + case WORK_ST_CANCEL: + if (linux_cancel_timer(dwork, 0)) { + atomic_cmpxchg(&dwork->work.state, + WORK_ST_CANCEL, WORK_ST_IDLE); return (1); + } /* FALLTHROUGH */ case WORK_ST_TASK: - case WORK_ST_EXEC: tq = dwork->work.work_queue->taskqueue; - if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) == 0) + if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) == 0) { + atomic_cmpxchg(&dwork->work.state, + WORK_ST_CANCEL, WORK_ST_IDLE); return (1); + } /* FALLTHROUGH */ default: return (0); @@ -376,10 +390,10 @@ linux_cancel_delayed_work_sync(struct delayed_work *dw { static const uint8_t states[WORK_ST_MAX] __aligned(8) = { [WORK_ST_IDLE] = WORK_ST_IDLE, /* NOP */ - [WORK_ST_TIMER] = WORK_ST_IDLE, /* idle */ - [WORK_ST_TASK] = WORK_ST_IDLE, /* idle */ - [WORK_ST_EXEC] = WORK_ST_IDLE, /* idle */ - [WORK_ST_CANCEL] = WORK_ST_IDLE, /* idle */ + [WORK_ST_TIMER] = WORK_ST_IDLE, /* cancel and drain */ + [WORK_ST_TASK] = WORK_ST_IDLE, /* cancel and drain */ + [WORK_ST_EXEC] = WORK_ST_IDLE, /* too late, drain */ + [WORK_ST_CANCEL] = WORK_ST_IDLE, /* cancel and drain */ }; struct taskqueue *tq; @@ -389,7 +403,13 @@ linux_cancel_delayed_work_sync(struct delayed_work *dw switch (linux_update_state(&dwork->work.state, states)) { case WORK_ST_IDLE: return (0); + case WORK_ST_EXEC: + tq = dwork->work.work_queue->taskqueue; + if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) != 0) + taskqueue_drain(tq, &dwork->work.work_task); + return (0); case WORK_ST_TIMER: + case WORK_ST_CANCEL: if (linux_cancel_timer(dwork, 1)) { /* * Make sure taskqueue is also drained before @@ -468,6 +488,7 @@ linux_work_pending(struct work_struct *work) switch (atomic_read(&work->state)) { case WORK_ST_TIMER: case WORK_ST_TASK: + case WORK_ST_CANCEL: return (1); default: return (0); @@ -486,7 +507,6 @@ linux_work_busy(struct work_struct *work) case WORK_ST_IDLE: return (0); case WORK_ST_EXEC: - case WORK_ST_CANCEL: tq = work->work_queue->taskqueue; return (taskqueue_poll_is_busy(tq, &work->work_task)); default: From owner-svn-src-head@freebsd.org Tue Aug 8 20:07:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86232DCD828; Tue, 8 Aug 2017 20:07:10 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B3EF71E0B; Tue, 8 Aug 2017 20:07:10 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78K79iL086573; Tue, 8 Aug 2017 20:07:09 GMT (envelope-from jlh@FreeBSD.org) Received: (from jlh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78K79T1086567; Tue, 8 Aug 2017 20:07:09 GMT (envelope-from jlh@FreeBSD.org) Message-Id: <201708082007.v78K79T1086567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jlh set sender to jlh@FreeBSD.org using -f From: Jeremie Le Hen Date: Tue, 8 Aug 2017 20:07:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322276 - in head: usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod X-SVN-Group: head X-SVN-Commit-Author: jlh X-SVN-Commit-Paths: in head: usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod X-SVN-Commit-Revision: 322276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 20:07:10 -0000 Author: jlh Date: Tue Aug 8 20:07:08 2017 New Revision: 322276 URL: https://svnweb.freebsd.org/changeset/base/322276 Log: Revert r322029 and r322031 so as to recommit them with a better commit log. PR: 220953 Reported by: ngie@ Modified: head/usr.bin/Makefile head/usr.bin/ruptime/ruptime.1 head/usr.bin/rwho/rwho.1 head/usr.sbin/Makefile head/usr.sbin/rwhod/rwhod.8 Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Tue Aug 8 19:53:06 2017 (r322275) +++ head/usr.bin/Makefile Tue Aug 8 20:07:08 2017 (r322276) @@ -133,10 +133,8 @@ SUBDIR= alias \ rpcinfo \ rs \ rup \ - ruptime \ rusers \ rwall \ - rwho \ script \ sdiff \ sed \ @@ -253,6 +251,8 @@ SUBDIR.${MK_OPENSSL}+= newkey SUBDIR.${MK_QUOTAS}+= quota SUBDIR.${MK_RCMDS}+= rlogin SUBDIR.${MK_RCMDS}+= rsh +SUBDIR.${MK_RCMDS}+= ruptime +SUBDIR.${MK_RCMDS}+= rwho SUBDIR.${MK_SENDMAIL}+= vacation SUBDIR.${MK_TALK}+= talk SUBDIR.${MK_TELNET}+= telnet Modified: head/usr.bin/ruptime/ruptime.1 ============================================================================== --- head/usr.bin/ruptime/ruptime.1 Tue Aug 8 19:53:06 2017 (r322275) +++ head/usr.bin/ruptime/ruptime.1 Tue Aug 8 20:07:08 2017 (r322276) @@ -38,6 +38,15 @@ .Nm .Op Fl alrtu .Op Ar host ... +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: head/usr.bin/rwho/rwho.1 ============================================================================== --- head/usr.bin/rwho/rwho.1 Tue Aug 8 19:53:06 2017 (r322275) +++ head/usr.bin/rwho/rwho.1 Tue Aug 8 20:07:08 2017 (r322276) @@ -37,6 +37,15 @@ .Sh SYNOPSIS .Nm .Op Fl a +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Tue Aug 8 19:53:06 2017 (r322275) +++ head/usr.sbin/Makefile Tue Aug 8 20:07:08 2017 (r322276) @@ -74,7 +74,6 @@ SUBDIR= adduser \ rpc.statd \ rpc.umntall \ rtprio \ - rwhod \ service \ services_mkdb \ sesutil \ @@ -192,6 +191,7 @@ SUBDIR.${MK_PPP}+= ppp SUBDIR.${MK_QUOTAS}+= edquota SUBDIR.${MK_QUOTAS}+= quotaon SUBDIR.${MK_QUOTAS}+= repquota +SUBDIR.${MK_RCMDS}+= rwhod SUBDIR.${MK_SENDMAIL}+= editmap SUBDIR.${MK_SENDMAIL}+= mailstats SUBDIR.${MK_SENDMAIL}+= makemap Modified: head/usr.sbin/rwhod/rwhod.8 ============================================================================== --- head/usr.sbin/rwhod/rwhod.8 Tue Aug 8 19:53:06 2017 (r322275) +++ head/usr.sbin/rwhod/rwhod.8 Tue Aug 8 20:07:08 2017 (r322276) @@ -40,6 +40,15 @@ .Op Fl p .Op Fl l .Op Fl m Op Ar ttl +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm From owner-svn-src-head@freebsd.org Tue Aug 8 20:17:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BA0CDCDF66; Tue, 8 Aug 2017 20:17:09 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57CD57235C; Tue, 8 Aug 2017 20:17:09 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78KH8VR090661; Tue, 8 Aug 2017 20:17:08 GMT (envelope-from jlh@FreeBSD.org) Received: (from jlh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78KH7av090655; Tue, 8 Aug 2017 20:17:07 GMT (envelope-from jlh@FreeBSD.org) Message-Id: <201708082017.v78KH7av090655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jlh set sender to jlh@FreeBSD.org using -f From: Jeremie Le Hen Date: Tue, 8 Aug 2017 20:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322277 - in head: tools/build/mk usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod X-SVN-Group: head X-SVN-Commit-Author: jlh X-SVN-Commit-Paths: in head: tools/build/mk usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod X-SVN-Commit-Revision: 322277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 20:17:09 -0000 Author: jlh Date: Tue Aug 8 20:17:07 2017 New Revision: 322277 URL: https://svnweb.freebsd.org/changeset/base/322277 Log: rwho/ruptime/rwhod shouldn't be gated by RCMDS. As peter@ points out in pr/220953: "rwho, rwhod and ruptime are not part of the remote login suite (rsh, rlogin etc). They should *not* be in the rcmds package which is disabled by default. We rely on rwho/rwhod/ruptime in the freebsd.org cluster." This commit is a re-commit of r322029 and r322031 with a better commit log, as pointed out by ngie@. This also includes the necesary changes to OptionalObsoleteFiles.inc, as requested by jhb@. PR: 220953 Reported by: peter@, jhb@ Differential Revision: https://reviews.freebsd.org/D11743 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.bin/Makefile head/usr.bin/ruptime/ruptime.1 head/usr.bin/rwho/rwho.1 head/usr.sbin/Makefile head/usr.sbin/rwhod/rwhod.8 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Tue Aug 8 20:07:08 2017 (r322276) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Tue Aug 8 20:17:07 2017 (r322277) @@ -6895,24 +6895,16 @@ OLD_FILES+=usr/share/man/man8/rbootd.8.gz .if ${MK_RCMDS} == no OLD_FILES+=bin/rcp -OLD_FILES+=etc/rc.d/rwho -OLD_FILES+=etc/periodic/daily/140.clean-rwho OLD_FILES+=rescue/rcp OLD_FILES+=usr/bin/rlogin OLD_FILES+=usr/bin/rsh -OLD_FILES+=usr/bin/ruptime -OLD_FILES+=usr/bin/rwho OLD_FILES+=usr/libexec/rlogind OLD_FILES+=usr/libexec/rshd -OLD_FILES+=usr/sbin/rwhod OLD_FILES+=usr/share/man/man1/rcp.1.gz OLD_FILES+=usr/share/man/man1/rlogin.1.gz OLD_FILES+=usr/share/man/man1/rsh.1.gz -OLD_FILES+=usr/share/man/man1/ruptime.1.gz -OLD_FILES+=usr/share/man/man1/rwho.1.gz OLD_FILES+=usr/share/man/man8/rlogind.8.gz OLD_FILES+=usr/share/man/man8/rshd.8.gz -OLD_FILES+=usr/share/man/man8/rwhod.8.gz .endif .if ${MK_RESCUE} == no Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Tue Aug 8 20:07:08 2017 (r322276) +++ head/usr.bin/Makefile Tue Aug 8 20:17:07 2017 (r322277) @@ -133,8 +133,10 @@ SUBDIR= alias \ rpcinfo \ rs \ rup \ + ruptime \ rusers \ rwall \ + rwho \ script \ sdiff \ sed \ @@ -251,8 +253,6 @@ SUBDIR.${MK_OPENSSL}+= newkey SUBDIR.${MK_QUOTAS}+= quota SUBDIR.${MK_RCMDS}+= rlogin SUBDIR.${MK_RCMDS}+= rsh -SUBDIR.${MK_RCMDS}+= ruptime -SUBDIR.${MK_RCMDS}+= rwho SUBDIR.${MK_SENDMAIL}+= vacation SUBDIR.${MK_TALK}+= talk SUBDIR.${MK_TELNET}+= telnet Modified: head/usr.bin/ruptime/ruptime.1 ============================================================================== --- head/usr.bin/ruptime/ruptime.1 Tue Aug 8 20:07:08 2017 (r322276) +++ head/usr.bin/ruptime/ruptime.1 Tue Aug 8 20:17:07 2017 (r322277) @@ -38,15 +38,6 @@ .Nm .Op Fl alrtu .Op Ar host ... -.Sh DEPRECATION NOTICE -.Nm -is deprecated and will be removed from future versions of the -.Fx -base system. -If -.Nm -is still required, it can be installed from ports or packages -(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: head/usr.bin/rwho/rwho.1 ============================================================================== --- head/usr.bin/rwho/rwho.1 Tue Aug 8 20:07:08 2017 (r322276) +++ head/usr.bin/rwho/rwho.1 Tue Aug 8 20:17:07 2017 (r322277) @@ -37,15 +37,6 @@ .Sh SYNOPSIS .Nm .Op Fl a -.Sh DEPRECATION NOTICE -.Nm -is deprecated and will be removed from future versions of the -.Fx -base system. -If -.Nm -is still required, it can be installed from ports or packages -(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Tue Aug 8 20:07:08 2017 (r322276) +++ head/usr.sbin/Makefile Tue Aug 8 20:17:07 2017 (r322277) @@ -74,6 +74,7 @@ SUBDIR= adduser \ rpc.statd \ rpc.umntall \ rtprio \ + rwhod \ service \ services_mkdb \ sesutil \ @@ -191,7 +192,6 @@ SUBDIR.${MK_PPP}+= ppp SUBDIR.${MK_QUOTAS}+= edquota SUBDIR.${MK_QUOTAS}+= quotaon SUBDIR.${MK_QUOTAS}+= repquota -SUBDIR.${MK_RCMDS}+= rwhod SUBDIR.${MK_SENDMAIL}+= editmap SUBDIR.${MK_SENDMAIL}+= mailstats SUBDIR.${MK_SENDMAIL}+= makemap Modified: head/usr.sbin/rwhod/rwhod.8 ============================================================================== --- head/usr.sbin/rwhod/rwhod.8 Tue Aug 8 20:07:08 2017 (r322276) +++ head/usr.sbin/rwhod/rwhod.8 Tue Aug 8 20:17:07 2017 (r322277) @@ -40,15 +40,6 @@ .Op Fl p .Op Fl l .Op Fl m Op Ar ttl -.Sh DEPRECATION NOTICE -.Nm -is deprecated and will be removed from future versions of the -.Fx -base system. -If -.Nm -is still required, it can be installed from ports or packages -(net/bsdrcmds). .Sh DESCRIPTION The .Nm From owner-svn-src-head@freebsd.org Tue Aug 8 20:18:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A16C1DCE13B; Tue, 8 Aug 2017 20:18:40 +0000 (UTC) (envelope-from jlehen@gmail.com) Received: from mail-qt0-x241.google.com (mail-qt0-x241.google.com [IPv6:2607:f8b0:400d:c0d::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5AB44724FE; Tue, 8 Aug 2017 20:18:40 +0000 (UTC) (envelope-from jlehen@gmail.com) Received: by mail-qt0-x241.google.com with SMTP id i19so4085981qte.1; Tue, 08 Aug 2017 13:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=lRRcVkBh+zxRrgJgeFO5sQs3ID3N1Vr01II+CMRAwgo=; b=bS3ebeCIbDLlaDfRUvtBNLEh5mCEWtZohpojFIRB/8Ydos/R7hcSJrTQXvYr0YZot1 7mJ1qpSDhXJHhEM2DyZtUGnxLG05tpRCSEeslvpqQxURgjVsUxwB/tAAzgUvG4jySASx RumG/KFUkWruQbXj2RSfcp/sojgNKXTmlHTVrPDj06uTk+Oo82ozld59jOtSyCNgEa1D KL26x2CSrqHbrU6lk+LmNZHIcmRxAFUwKd1+xkYdfnwow3HOLlFB/ZfOPSIaGTaZtBj6 b2D9sYZXErnyQilYkgA7vnZPWCZ4kV+wzsh1Zb0q6SPOzA3xPuODU8SdyUEADYErSErU a1cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=lRRcVkBh+zxRrgJgeFO5sQs3ID3N1Vr01II+CMRAwgo=; b=GguJWfWFH72eLJVdnWoR9GUcU8cE+b985OqOhU+6WAPc2b0n55PkhOvsXqK9cfgE7q mZV2YNb+9Zob97fx7sFtYKSPbjg+djydYIuXLuekgDTlLXJdCtWe7k6GqDgztr0N+NR7 0iSiCwrnUnlB9zuq28CN7km4dBstB0i8r0CHFaIfhFnaIME2RyYCw4kIuCXYAeZDoKzN v+Mn9dy9CpnnMmxj+A655jyfpRNFLDDEdRQEHVc2g9IpsvwrjwPApUqt2lu5NkpJ/MJd lHfTIHnfkgWwEQVoW7jWCiXAL2AKsriJnoY0f8qKnz7gSVsmI0MbePgG+qZXlH55wEw7 TSQw== X-Gm-Message-State: AHYfb5j1HuTicb6I5cye6NCeifqvu/a+y82KRsGAUK2SQ1aeF5k78v3+ ly5+Jcm9u8FCHbKvhm9lm/HzOpsKf1SwJ2k= X-Received: by 10.200.56.48 with SMTP id q45mr7188026qtb.36.1502223519512; Tue, 08 Aug 2017 13:18:39 -0700 (PDT) MIME-Version: 1.0 Sender: jlehen@gmail.com Received: by 10.12.180.155 with HTTP; Tue, 8 Aug 2017 13:18:38 -0700 (PDT) In-Reply-To: <20170805133842.GC16195@spindle.one-eyed-alien.net> References: <201708032130.v73LUC2H045637@repo.freebsd.org> <20170805133842.GC16195@spindle.one-eyed-alien.net> From: Jeremie Le Hen Date: Tue, 8 Aug 2017 22:18:38 +0200 X-Google-Sender-Auth: YtLGSWd7L32Y47zUS-6Z3MGGyE4 Message-ID: Subject: Re: svn commit: r322029 - in head: usr.bin usr.sbin To: Brooks Davis Cc: "Ngie Cooper (yaneurabeya)" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 20:18:40 -0000 On Sat, Aug 5, 2017 at 3:38 PM, Brooks Davis wrote: > On Fri, Aug 04, 2017 at 04:50:32PM +0200, Jeremie Le Hen wrote: >> On Fri, Aug 4, 2017 at 12:42 AM, Ngie Cooper (yaneurabeya) >> wrote: >> > >> >> On Aug 3, 2017, at 14:30, Jeremie Le Hen wrote: >> >> >> >> Author: jlh >> >> Date: Thu Aug 3 21:30:12 2017 >> >> New Revision: 322029 >> >> URL: https://svnweb.freebsd.org/changeset/base/322029 >> >> >> >> Log: >> >> rwho/ruptime/rwhod shouldn't be gated by RCMDS. >> > >> > The why in this commit and the next you made (r322031) would have been incredibly helpful. If bugzilla disappears I only have the commit history tracking the what. >> >> I agree, I realized this only afterwards. I don't know how to fix this though. > > Reverting the change and reapplying it with a meaningful message will > produce the best result. OK thanks. FYI this is submitted in r322277, with changes to tools/build/mk/OptionalObsoleteFiles.inc as requested by jhb@. Thanks all for your patience :-). -- Jeremie Le Hen jlh@FreeBSD.org From owner-svn-src-head@freebsd.org Tue Aug 8 20:44:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 609FBDCF4C8; Tue, 8 Aug 2017 20:44:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32C417312E; Tue, 8 Aug 2017 20:44:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78KiHlr002792; Tue, 8 Aug 2017 20:44:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78KiH9F002789; Tue, 8 Aug 2017 20:44:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708082044.v78KiH9F002789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 8 Aug 2017 20:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322278 - in head/sys: amd64/amd64 amd64/include dev/efidev X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include dev/efidev X-SVN-Commit-Revision: 322278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 20:44:18 -0000 Author: imp Date: Tue Aug 8 20:44:16 2017 New Revision: 322278 URL: https://svnweb.freebsd.org/changeset/base/322278 Log: Fail to open efirt device when no EFI on system. libefivar expects opening /dev/efi to indicate if the we can make efi runtime calls. With a null routine, it was always succeeding leading efi_variables_supported() to return the wrong value. Only succeed if we have an efi_runtime table. Also, while I'm hear, out of an abundance of caution, add a likely redundant check to make sure efi_systbl is not NULL before dereferencing it. I know it can't be NULL if efi_cfgtbl is non-NULL, but the compiler doesn't. Modified: head/sys/amd64/amd64/efirt.c head/sys/amd64/include/efi.h head/sys/dev/efidev/efidev.c Modified: head/sys/amd64/amd64/efirt.c ============================================================================== --- head/sys/amd64/amd64/efirt.c Tue Aug 8 20:17:07 2017 (r322277) +++ head/sys/amd64/amd64/efirt.c Tue Aug 8 20:44:16 2017 (r322278) @@ -421,12 +421,21 @@ efi_uninit(void) } int +efi_rt_ok(void) +{ + + if (efi_runtime == NULL) + return (ENXIO); + return (0); +} + +int efi_get_table(struct uuid *uuid, void **ptr) { struct efi_cfgtbl *ct; u_long count; - if (efi_cfgtbl == NULL) + if (efi_cfgtbl == NULL || efi_systbl == NULL) return (ENXIO); count = efi_systbl->st_entries; ct = efi_cfgtbl; Modified: head/sys/amd64/include/efi.h ============================================================================== --- head/sys/amd64/include/efi.h Tue Aug 8 20:17:07 2017 (r322277) +++ head/sys/amd64/include/efi.h Tue Aug 8 20:44:16 2017 (r322278) @@ -49,6 +49,7 @@ struct uuid; struct efi_tm; +int efi_rt_ok(void); int efi_get_table(struct uuid *uuid, void **ptr); int efi_get_time(struct efi_tm *tm); int efi_get_time_locked(struct efi_tm *tm); Modified: head/sys/dev/efidev/efidev.c ============================================================================== --- head/sys/dev/efidev/efidev.c Tue Aug 8 20:17:07 2017 (r322277) +++ head/sys/dev/efidev/efidev.c Tue Aug 8 20:44:16 2017 (r322278) @@ -39,14 +39,27 @@ __FBSDID("$FreeBSD$"); #include #include +static d_open_t efidev_open; static d_ioctl_t efidev_ioctl; static struct cdevsw efi_cdevsw = { .d_name = "efi", .d_version = D_VERSION, + .d_open = efidev_open, .d_ioctl = efidev_ioctl, }; +static int +efidev_open(struct cdev *dev __unused, int oflags __unused, + int devtype __unused, struct thread *td __unused) +{ + /* + * Only return success when we have an actual runtime to call. + */ + + return efi_rt_ok(); +} + static int efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr, int flags __unused, struct thread *td __unused) From owner-svn-src-head@freebsd.org Tue Aug 8 21:01:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42A7CDD014F; Tue, 8 Aug 2017 21:01:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1089773964; Tue, 8 Aug 2017 21:01:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78L1CGD010351; Tue, 8 Aug 2017 21:01:12 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78L1CtG010350; Tue, 8 Aug 2017 21:01:12 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708082101.v78L1CtG010350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 8 Aug 2017 21:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322279 - head/sys/dev/efidev X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/efidev X-SVN-Commit-Revision: 322279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 21:01:13 -0000 Author: imp Date: Tue Aug 8 21:01:11 2017 New Revision: 322279 URL: https://svnweb.freebsd.org/changeset/base/322279 Log: Turns out to be even simpler to just not create /dev/efi if we don't have a efi runtime. Modified: head/sys/dev/efidev/efidev.c Modified: head/sys/dev/efidev/efidev.c ============================================================================== --- head/sys/dev/efidev/efidev.c Tue Aug 8 20:44:16 2017 (r322278) +++ head/sys/dev/efidev/efidev.c Tue Aug 8 21:01:11 2017 (r322279) @@ -39,28 +39,15 @@ __FBSDID("$FreeBSD$"); #include #include -static d_open_t efidev_open; static d_ioctl_t efidev_ioctl; static struct cdevsw efi_cdevsw = { .d_name = "efi", .d_version = D_VERSION, - .d_open = efidev_open, .d_ioctl = efidev_ioctl, }; static int -efidev_open(struct cdev *dev __unused, int oflags __unused, - int devtype __unused, struct thread *td __unused) -{ - /* - * Only return success when we have an actual runtime to call. - */ - - return efi_rt_ok(); -} - -static int efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr, int flags __unused, struct thread *td __unused) { @@ -195,6 +182,11 @@ efidev_modevents(module_t m, int event, void *arg __un switch (event) { case MOD_LOAD: + /* + * If we have no efi environment, then don't create the device. + */ + if (efi_rt_ok() != 0) + return (0); make_dev_args_init(&mda); mda.mda_flags = MAKEDEV_WAITOK | MAKEDEV_CHECKNAME; mda.mda_devsw = &efi_cdevsw; From owner-svn-src-head@freebsd.org Tue Aug 8 21:09:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68F93DD087D; Tue, 8 Aug 2017 21:09:27 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34C8873E29; Tue, 8 Aug 2017 21:09:27 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78L9Qn1011323; Tue, 8 Aug 2017 21:09:26 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78L9Q45011322; Tue, 8 Aug 2017 21:09:26 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201708082109.v78L9Q45011322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 8 Aug 2017 21:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322280 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 322280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 21:09:27 -0000 Author: kp Date: Tue Aug 8 21:09:26 2017 New Revision: 322280 URL: https://svnweb.freebsd.org/changeset/base/322280 Log: pf_get_sport(): Prevent possible endless loop when searching for an unused nat port This is an import of Alexander Bluhm's OpenBSD commit r1.60, the first chunk had to be modified because on OpenBSD the 'cut' declaration is located elsewhere. Upstream report by Jingmin Zhou: https://marc.info/?l=openbsd-pf&m=150020133510896&w=2 OpenBSD commit message: Use a 32 bit variable to detect integer overflow when searching for an unused nat port. Prevents a possible endless loop if high port is 65535 or low port is 0. report and analysis Jingmin Zhou; OK sashan@ visa@ Quoted from: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/net/pf_lb.c PR: 221201 Submitted by: Fabian Keil Obtained from: OpenBSD via ElectroBSD MFC after: 1 week Modified: head/sys/netpfil/pf/pf_lb.c Modified: head/sys/netpfil/pf/pf_lb.c ============================================================================== --- head/sys/netpfil/pf/pf_lb.c Tue Aug 8 21:01:11 2017 (r322279) +++ head/sys/netpfil/pf/pf_lb.c Tue Aug 8 21:09:26 2017 (r322280) @@ -259,7 +259,8 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf return (0); } } else { - uint16_t tmp, cut; + uint32_t tmp; + uint16_t cut; if (low > high) { tmp = low; @@ -269,7 +270,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf /* low < high */ cut = arc4random() % (1 + high - low) + low; /* low <= cut <= high */ - for (tmp = cut; tmp <= high; ++(tmp)) { + for (tmp = cut; tmp <= high && tmp <= 0xffff; ++tmp) { key.port[1] = htons(tmp); if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { @@ -277,7 +278,8 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf return (0); } } - for (tmp = cut - 1; tmp >= low; --(tmp)) { + tmp = cut; + for (tmp -= 1; tmp >= low && tmp <= 0xffff; --tmp) { key.port[1] = htons(tmp); if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { From owner-svn-src-head@freebsd.org Tue Aug 8 22:40:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0FCDDD50A9; Tue, 8 Aug 2017 22:40:27 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DB8976DFE; Tue, 8 Aug 2017 22:40:27 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78MeQW4048259; Tue, 8 Aug 2017 22:40:26 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78MeQ8f048258; Tue, 8 Aug 2017 22:40:26 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201708082240.v78MeQ8f048258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Tue, 8 Aug 2017 22:40:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322281 - head/sbin/ifconfig X-SVN-Group: head X-SVN-Commit-Author: garga X-SVN-Commit-Paths: head/sbin/ifconfig X-SVN-Commit-Revision: 322281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 22:40:27 -0000 Author: garga (ports committer) Date: Tue Aug 8 22:40:26 2017 New Revision: 322281 URL: https://svnweb.freebsd.org/changeset/base/322281 Log: Add missing parenthesis on error message Approved by: loos MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sbin/ifconfig/ifconfig.c Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Tue Aug 8 21:09:26 2017 (r322280) +++ head/sbin/ifconfig/ifconfig.c Tue Aug 8 22:40:26 2017 (r322281) @@ -760,7 +760,7 @@ top: if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0 && (uafp != NULL || errno != EAFNOSUPPORT || (s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0)) - err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family); + err(1, "socket(family %u,SOCK_DGRAM)", ifr.ifr_addr.sa_family); while (argc > 0) { p = cmd_lookup(*argv, iscreate); From owner-svn-src-head@freebsd.org Tue Aug 8 22:58:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D922DD5E70; Tue, 8 Aug 2017 22:58:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0504B77678; Tue, 8 Aug 2017 22:58:34 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78MwYXk056460; Tue, 8 Aug 2017 22:58:34 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78MwYtw056459; Tue, 8 Aug 2017 22:58:34 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708082258.v78MwYtw056459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 8 Aug 2017 22:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322282 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 322282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2017 22:58:35 -0000 Author: ian Date: Tue Aug 8 22:58:34 2017 New Revision: 322282 URL: https://svnweb.freebsd.org/changeset/base/322282 Log: Remove the ds133x and s35390a i2c RTC drivers for now. They both do i2c transfers in their probe() or attach() routines, and that doesn't work when the low-level controller requires interrupts to be functional. The DS133x family of chips is nearly identical to the DS1307 and support for them should be added to that driver, then the ds133x driver can be deleted. The s35390a driver just needs a non-trivial workover. In both cases that work will be done and committed separately. Modified: head/sys/arm/conf/GENERIC Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Tue Aug 8 22:40:26 2017 (r322281) +++ head/sys/arm/conf/GENERIC Tue Aug 8 22:58:34 2017 (r322282) @@ -139,11 +139,9 @@ device twl_clks # twl external clocks # i2c RTCs device ds1307 # Dallas DS1307 RTC and compatible -device ds133x # Dallas DS1337, DS1338 and DS1339 RTC device ds1672 # Dallas DS1672 RTC device ds3231 # Dallas DS3231 RTC + temperature device nxprtc # NXP RTCs: PCA/PFC212x PCA/PCF85xx -device s35390a # Seiko Instruments S-35390A RTC # GPIO device gpio From owner-svn-src-head@freebsd.org Wed Aug 9 00:45:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C810DDB1F6; Wed, 9 Aug 2017 00:45:26 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B4097EBEE; Wed, 9 Aug 2017 00:45:26 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v790jPPS001357; Wed, 9 Aug 2017 00:45:25 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v790jPo8001356; Wed, 9 Aug 2017 00:45:25 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090045.v790jPo8001356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 00:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322285 - head/sys/dev/fdt X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/fdt X-SVN-Commit-Revision: 322285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 00:45:26 -0000 Author: mw Date: Wed Aug 9 00:45:25 2017 New Revision: 322285 URL: https://svnweb.freebsd.org/changeset/base/322285 Log: Enable parsing simple-bus 'ranges' with multiple entries This patch makes possible to boot with up to 8 ranges in soc. Dynamic allocation cannot be used, because ftd_get_ranges function is called early, when malloc is not available. Change is required for the alignment of Marvell Armada 38x device trees present in sys/gnu/dts/arm - originally the platform has 6 entries in simple-bus 'ranges'. Submitted by: Patryk Duda Reviewed by: manu, nwhitehorn, cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11876 Modified: head/sys/dev/fdt/fdt_common.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Tue Aug 8 23:55:38 2017 (r322284) +++ head/sys/dev/fdt/fdt_common.c Wed Aug 9 00:45:25 2017 (r322285) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #define FDT_TYPE_LEN 64 #define FDT_REG_CELLS 4 +#define FDT_RANGES_SIZE 48 SYSCTL_NODE(_hw, OID_AUTO, fdt, CTLFLAG_RD, 0, "Flattened Device Tree"); @@ -149,7 +150,7 @@ fdt_get_range_by_busaddr(phandle_t node, u_long addr, int fdt_get_range(phandle_t node, int range_id, u_long *base, u_long *size) { - pcell_t ranges[6], *rangesptr; + pcell_t ranges[FDT_RANGES_SIZE], *rangesptr; pcell_t addr_cells, size_cells, par_addr_cells; u_long par_bus_addr, pbase, psize; int err, len, tuple_size, tuples; From owner-svn-src-head@freebsd.org Wed Aug 9 00:51:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2CCFDDB710; Wed, 9 Aug 2017 00:51:46 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E2F77F0F1; Wed, 9 Aug 2017 00:51:46 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v790pjaa002662; Wed, 9 Aug 2017 00:51:45 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v790pj2I002659; Wed, 9 Aug 2017 00:51:45 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090051.v790pj2I002659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 00:51:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322286 - head/sys/boot/fdt/dts/arm X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/boot/fdt/dts/arm X-SVN-Commit-Revision: 322286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 00:51:46 -0000 Author: mw Date: Wed Aug 9 00:51:45 2017 New Revision: 322286 URL: https://svnweb.freebsd.org/changeset/base/322286 Log: Restore original /soc ranges on Marvell Armada 38x boards Because fdt_get_ranges can process now multiple 'ranges' entries, restoring the ranges from original Linux device trees is possible. Submitted by: Patryk Duda Reviewed by: cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11877 Modified: head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts head/sys/boot/fdt/dts/arm/armada-388-gp.dts head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi Modified: head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts Wed Aug 9 00:45:25 2017 (r322285) +++ head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts Wed Aug 9 00:51:45 2017 (r322286) @@ -60,7 +60,11 @@ }; soc { - ranges = ; + ranges = ; internal-regs { i2c0: i2c@11000 { Modified: head/sys/boot/fdt/dts/arm/armada-388-gp.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/armada-388-gp.dts Wed Aug 9 00:45:25 2017 (r322285) +++ head/sys/boot/fdt/dts/arm/armada-388-gp.dts Wed Aug 9 00:51:45 2017 (r322286) @@ -59,7 +59,11 @@ }; soc { - ranges = ; + ranges = ; internal-regs { crypto@90000 { Modified: head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi Wed Aug 9 00:45:25 2017 (r322285) +++ head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi Wed Aug 9 00:51:45 2017 (r322286) @@ -57,7 +57,11 @@ }; soc { - ranges = ; + ranges = ; internal-regs { ethernet@70000 { From owner-svn-src-head@freebsd.org Wed Aug 9 00:56:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 216B3DDBA8F; Wed, 9 Aug 2017 00:56:31 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E03867F457; Wed, 9 Aug 2017 00:56:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v790uT4w005761; Wed, 9 Aug 2017 00:56:29 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v790uTv4005760; Wed, 9 Aug 2017 00:56:29 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090056.v790uTv4005760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 00:56:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322287 - head/sys/dev/ofw X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ofw X-SVN-Commit-Revision: 322287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 00:56:31 -0000 Author: mw Date: Wed Aug 9 00:56:29 2017 New Revision: 322287 URL: https://svnweb.freebsd.org/changeset/base/322287 Log: Add support for "compatible" parameter in ofw_fdt_fixup Sometimes it's convenient to provide fixup to many boards that use the same SoC family (eg. Marvell Armada 38x). Instead of putting multiple entries in fdt_fixup_table, use one entry which refers to all boards with given SoC. Submitted by: Patryk Duda Reviewed by: nwhitehorn, cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11878 Modified: head/sys/dev/ofw/ofw_fdt.c Modified: head/sys/dev/ofw/ofw_fdt.c ============================================================================== --- head/sys/dev/ofw/ofw_fdt.c Wed Aug 9 00:51:45 2017 (r322286) +++ head/sys/dev/ofw/ofw_fdt.c Wed Aug 9 00:56:29 2017 (r322287) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "ofw_if.h" @@ -450,7 +451,15 @@ ofw_fdt_fixup(ofw_t ofw) for (i = 0; fdt_fixup_table[i].model != NULL; i++) { if (strncmp(model, fdt_fixup_table[i].model, FDT_MODEL_LEN) != 0) - continue; + /* + * Sometimes it's convenient to provide one + * fixup entry that refers to many boards. + * To handle this case, simply check if model + * is compatible parameter + */ + if(!ofw_bus_node_is_compatible(root, + fdt_fixup_table[i].model)) + continue; if (fdt_fixup_table[i].handler != NULL) (*fdt_fixup_table[i].handler)(root); From owner-svn-src-head@freebsd.org Wed Aug 9 01:04:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4AE3DAB2DD; Wed, 9 Aug 2017 01:04:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 905EF7FA51; Wed, 9 Aug 2017 01:04:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7914a6D010122; Wed, 9 Aug 2017 01:04:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7914a3w010121; Wed, 9 Aug 2017 01:04:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708090104.v7914a3w010121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 01:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322288 - head/lib/libc/regex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/regex X-SVN-Commit-Revision: 322288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 01:04:37 -0000 Author: kevans Date: Wed Aug 9 01:04:36 2017 New Revision: 322288 URL: https://svnweb.freebsd.org/changeset/base/322288 Log: regex(3): Refactor fast/slow stepping bits in the matching engine Adding features for matching is fairly straightforward, but this requires some duplication because of this fast/slow setup. They can be fairly trivially combined into a single walk(), so do it to make future additions less error prone. Reviewed by: cem (earlier version), emaste, pfg Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11233 Modified: head/lib/libc/regex/engine.c Modified: head/lib/libc/regex/engine.c ============================================================================== --- head/lib/libc/regex/engine.c Wed Aug 9 00:56:29 2017 (r322287) +++ head/lib/libc/regex/engine.c Wed Aug 9 01:04:36 2017 (r322288) @@ -36,6 +36,8 @@ #include __FBSDID("$FreeBSD$"); +#include + /* * The matching engine and friends. This file is #included by regexec.c * after suitable #defines of a variety of macros used herein, so that @@ -45,8 +47,7 @@ __FBSDID("$FreeBSD$"); #ifdef SNAMES #define matcher smatcher -#define fast sfast -#define slow sslow +#define walk swalk #define dissect sdissect #define backref sbackref #define step sstep @@ -56,8 +57,7 @@ __FBSDID("$FreeBSD$"); #endif #ifdef LNAMES #define matcher lmatcher -#define fast lfast -#define slow lslow +#define walk lwalk #define dissect ldissect #define backref lbackref #define step lstep @@ -67,8 +67,7 @@ __FBSDID("$FreeBSD$"); #endif #ifdef MNAMES #define matcher mmatcher -#define fast mfast -#define slow mslow +#define walk mwalk #define dissect mdissect #define backref mbackref #define step mstep @@ -104,8 +103,7 @@ extern "C" { static int matcher(struct re_guts *g, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags); static const char *dissect(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst); static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev, int); -static const char *fast(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst); -static const char *slow(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst); +static const char *walk(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, bool fast); static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_t ch, states aft); #define MAX_RECURSION 100 #define BOL (OUT-1) @@ -251,7 +249,7 @@ matcher(struct re_guts *g, /* this loop does only one repetition except for backrefs */ for (;;) { - endp = fast(m, start, stop, gf, gl); + endp = walk(m, start, stop, gf, gl, true); if (endp == NULL) { /* a miss */ if (m->pmatch != NULL) free((char *)m->pmatch); @@ -267,7 +265,7 @@ matcher(struct re_guts *g, assert(m->coldp != NULL); for (;;) { NOTE("finding start"); - endp = slow(m, m->coldp, stop, gf, gl); + endp = walk(m, m->coldp, stop, gf, gl, false); if (endp != NULL) break; assert(m->coldp < m->endp); @@ -312,7 +310,7 @@ matcher(struct re_guts *g, if (dp != NULL || endp <= m->coldp) break; /* defeat */ NOTE("backoff"); - endp = slow(m, m->coldp, endp-1, gf, gl); + endp = walk(m, m->coldp, endp-1, gf, gl, false); if (endp == NULL) break; /* defeat */ /* try it on a shorter possibility */ @@ -430,10 +428,10 @@ dissect(struct match *m, stp = stop; for (;;) { /* how long could this one be? */ - rest = slow(m, sp, stp, ss, es); + rest = walk(m, sp, stp, ss, es, false); assert(rest != NULL); /* it did match */ /* could the rest match the rest? */ - tail = slow(m, rest, stop, es, stopst); + tail = walk(m, rest, stop, es, stopst, false); if (tail == stop) break; /* yes! */ /* no -- try a shorter match for this one */ @@ -443,7 +441,7 @@ dissect(struct match *m, ssub = ss + 1; esub = es - 1; /* did innards match? */ - if (slow(m, sp, rest, ssub, esub) != NULL) { + if (walk(m, sp, rest, ssub, esub, false) != NULL) { dp = dissect(m, sp, rest, ssub, esub); assert(dp == rest); } else /* no */ @@ -454,10 +452,10 @@ dissect(struct match *m, stp = stop; for (;;) { /* how long could this one be? */ - rest = slow(m, sp, stp, ss, es); + rest = walk(m, sp, stp, ss, es, false); assert(rest != NULL); /* it did match */ /* could the rest match the rest? */ - tail = slow(m, rest, stop, es, stopst); + tail = walk(m, rest, stop, es, stopst, false); if (tail == stop) break; /* yes! */ /* no -- try a shorter match for this one */ @@ -469,7 +467,7 @@ dissect(struct match *m, ssp = sp; oldssp = ssp; for (;;) { /* find last match of innards */ - sep = slow(m, ssp, rest, ssub, esub); + sep = walk(m, ssp, rest, ssub, esub, false); if (sep == NULL || sep == ssp) break; /* failed or matched null */ oldssp = ssp; /* on to next try */ @@ -481,7 +479,7 @@ dissect(struct match *m, ssp = oldssp; } assert(sep == rest); /* must exhaust substring */ - assert(slow(m, ssp, sep, ssub, esub) == rest); + assert(walk(m, ssp, sep, ssub, esub, false) == rest); dp = dissect(m, ssp, sep, ssub, esub); assert(dp == sep); sp = rest; @@ -490,10 +488,10 @@ dissect(struct match *m, stp = stop; for (;;) { /* how long could this one be? */ - rest = slow(m, sp, stp, ss, es); + rest = walk(m, sp, stp, ss, es, false); assert(rest != NULL); /* it did match */ /* could the rest match the rest? */ - tail = slow(m, rest, stop, es, stopst); + tail = walk(m, rest, stop, es, stopst, false); if (tail == stop) break; /* yes! */ /* no -- try a shorter match for this one */ @@ -504,7 +502,7 @@ dissect(struct match *m, esub = ss + OPND(m->g->strip[ss]) - 1; assert(OP(m->g->strip[esub]) == OOR1); for (;;) { /* find first matching branch */ - if (slow(m, sp, rest, ssub, esub) == rest) + if (walk(m, sp, rest, ssub, esub, false) == rest) break; /* it matched all of it */ /* that one missed, try next one */ assert(OP(m->g->strip[esub]) == OOR1); @@ -757,124 +755,16 @@ backref(struct match *m, } /* - - fast - step through the string at top speed - == static const char *fast(struct match *m, const char *start, \ - == const char *stop, sopno startst, sopno stopst); + - walk - step through the string either quickly or slowly + == static const char *walk(struct match *m, const char *start, \ + == const char *stop, sopno startst, sopno stopst, bool fast); */ -static const char * /* where tentative match ended, or NULL */ -fast( struct match *m, - const char *start, - const char *stop, - sopno startst, - sopno stopst) +static const char * /* where it ended, or NULL */ +walk(struct match *m, const char *start, const char *stop, sopno startst, + sopno stopst, bool fast) { states st = m->st; states fresh = m->fresh; - states tmp = m->tmp; - const char *p = start; - wint_t c; - wint_t lastc; /* previous c */ - wint_t flagch; - int i; - const char *coldp; /* last p after which no match was underway */ - size_t clen; - - CLEAR(st); - SET1(st, startst); - SP("fast", st, *p); - st = step(m->g, startst, stopst, st, NOTHING, st); - ASSIGN(fresh, st); - SP("start", st, *p); - coldp = NULL; - if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) - c = OUT; - else { - /* - * XXX Wrong if the previous character was multi-byte. - * Newline never is (in encodings supported by FreeBSD), - * so this only breaks the ISWORD tests below. - */ - c = (uch)*(start - 1); - } - for (;;) { - /* next character */ - lastc = c; - if (p == m->endp) { - clen = 0; - c = OUT; - } else - clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR); - if (EQ(st, fresh)) - coldp = p; - - /* is there an EOL and/or BOL between lastc and c? */ - flagch = '\0'; - i = 0; - if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { - flagch = BOL; - i = m->g->nbol; - } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_NOTEOL)) ) { - flagch = (flagch == BOL) ? BOLEOL : EOL; - i += m->g->neol; - } - if (i != 0) { - for (; i > 0; i--) - st = step(m->g, startst, stopst, st, flagch, st); - SP("boleol", st, c); - } - - /* how about a word boundary? */ - if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && - (c != OUT && ISWORD(c)) ) { - flagch = BOW; - } - if ( (lastc != OUT && ISWORD(lastc)) && - (flagch == EOL || (c != OUT && !ISWORD(c))) ) { - flagch = EOW; - } - if (flagch == BOW || flagch == EOW) { - st = step(m->g, startst, stopst, st, flagch, st); - SP("boweow", st, c); - } - - /* are we done? */ - if (ISSET(st, stopst) || p == stop || clen > stop - p) - break; /* NOTE BREAK OUT */ - - /* no, we must deal with this character */ - ASSIGN(tmp, st); - ASSIGN(st, fresh); - assert(c != OUT); - st = step(m->g, startst, stopst, tmp, c, st); - SP("aft", st, c); - assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); - p += clen; - } - - assert(coldp != NULL); - m->coldp = coldp; - if (ISSET(st, stopst)) - return(p+XMBRTOWC(NULL, p, stop - p, &m->mbs, 0)); - else - return(NULL); -} - -/* - - slow - step through the string more deliberately - == static const char *slow(struct match *m, const char *start, \ - == const char *stop, sopno startst, sopno stopst); - */ -static const char * /* where it ended */ -slow( struct match *m, - const char *start, - const char *stop, - sopno startst, - sopno stopst) -{ - states st = m->st; states empty = m->empty; states tmp = m->tmp; const char *p = start; @@ -890,6 +780,8 @@ slow( struct match *m, SET1(st, startst); SP("sstart", st, *p); st = step(m->g, startst, stopst, st, NOTHING, st); + if (fast) + ASSIGN(fresh, st); matchp = NULL; if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) c = OUT; @@ -910,6 +802,9 @@ slow( struct match *m, } else clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR); + if (fast && EQ(st, fresh)) + matchp = p; + /* is there an EOL and/or BOL between lastc and c? */ flagch = '\0'; i = 0; @@ -944,14 +839,21 @@ slow( struct match *m, } /* are we done? */ - if (ISSET(st, stopst)) - matchp = p; + if (ISSET(st, stopst)) { + if (fast) + break; + else + matchp = p; + } if (EQ(st, empty) || p == stop || clen > stop - p) break; /* NOTE BREAK OUT */ /* no, we must deal with this character */ ASSIGN(tmp, st); - ASSIGN(st, empty); + if (fast) + ASSIGN(st, fresh); + else + ASSIGN(st, empty); assert(c != OUT); st = step(m->g, startst, stopst, tmp, c, st); SP("saft", st, c); @@ -959,10 +861,17 @@ slow( struct match *m, p += clen; } - return(matchp); + if (fast) { + assert(matchp != NULL); + m->coldp = matchp; + if (ISSET(st, stopst)) + return (p + XMBRTOWC(NULL, p, stop - p, &m->mbs, 0)); + else + return (NULL); + } else + return (matchp); } - /* - step - map set of states reachable before char to set reachable after == static states step(struct re_guts *g, sopno start, sopno stop, \ @@ -1173,8 +1082,7 @@ pchar(int ch) #endif #undef matcher -#undef fast -#undef slow +#undef walk #undef dissect #undef backref #undef step From owner-svn-src-head@freebsd.org Wed Aug 9 01:06:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0810DAB536; Wed, 9 Aug 2017 01:06:41 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E56E7FBED; Wed, 9 Aug 2017 01:06:41 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7916euN010234; Wed, 9 Aug 2017 01:06:40 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7916eC9010233; Wed, 9 Aug 2017 01:06:40 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090106.v7916eC9010233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 01:06:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322289 - head/sys/dev/ofw X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ofw X-SVN-Commit-Revision: 322289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 01:06:41 -0000 Author: mw Date: Wed Aug 9 01:06:40 2017 New Revision: 322289 URL: https://svnweb.freebsd.org/changeset/base/322289 Log: Enable using ofw_bus_find_compatible in early platform code Before this patch function ofw_bus_find_compatible was using memory allocations in order to find compatible node and the property's length. This way there was always a suited buffer for property, however this approach had also disadvantages - ofw_bus_find_compatible couldn't be used when malloc is not available, e.g. during fdt fixup stage. In order to remove the usage limitation of ofw_bus_find_compatible(), this patch modifies the function to use ofw_bus_node_is_compatible() (instead of the one without _int suffix), which uses a fixed buffer on stack instead of dynamic allocations. Submitted by: Patryk Duda Reviewed by: nwhitehorn, cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11880 Modified: head/sys/dev/ofw/ofw_bus_subr.c Modified: head/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_bus_subr.c Wed Aug 9 01:04:36 2017 (r322288) +++ head/sys/dev/ofw/ofw_bus_subr.c Wed Aug 9 01:06:40 2017 (r322289) @@ -720,22 +720,14 @@ phandle_t ofw_bus_find_compatible(phandle_t node, const char *onecompat) { phandle_t child, ret; - void *compat; - int len; /* * Traverse all children of 'start' node, and find first with * matching 'compatible' property. */ for (child = OF_child(node); child != 0; child = OF_peer(child)) { - len = OF_getprop_alloc(child, "compatible", 1, &compat); - if (len >= 0) { - ret = ofw_bus_node_is_compatible_int(compat, len, - onecompat); - free(compat, M_OFWPROP); - if (ret != 0) - return (child); - } + if (ofw_bus_node_is_compatible(child, onecompat) != 0) + return (child); ret = ofw_bus_find_compatible(child, onecompat); if (ret != 0) From owner-svn-src-head@freebsd.org Wed Aug 9 01:14:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAFA4DABCBD; Wed, 9 Aug 2017 01:14:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A99B800CC; Wed, 9 Aug 2017 01:14:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791ETAB014053; Wed, 9 Aug 2017 01:14:29 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791ETgk014052; Wed, 9 Aug 2017 01:14:29 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090114.v791ETgk014052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 01:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322290 - head/sys/arm/mv X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/arm/mv X-SVN-Commit-Revision: 322290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 01:14:30 -0000 Author: mw Date: Wed Aug 9 01:14:29 2017 New Revision: 322290 URL: https://svnweb.freebsd.org/changeset/base/322290 Log: Dynamically configure timers' base frequency for Armada 38x Instead of using 'clock-frequency' device tree property for global/twd mpcore timers of Armada 38x SoCs, set it in platform_late_init stage with arm_tmr_change_frequency() function. Reviewed by: cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11881 Modified: head/sys/arm/mv/mv_machdep.c Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Wed Aug 9 01:06:40 2017 (r322289) +++ head/sys/arm/mv/mv_machdep.c Wed Aug 9 01:14:29 2017 (r322290) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -294,6 +295,9 @@ platform_late_init(void) #endif #if defined(SOC_MV_ARMADA38X) + /* Configure timers' base frequency */ + arm_tmr_change_frequency(get_cpu_freq() / 2); + /* * Workaround for Marvell Armada38X family HW issue * between Cortex-A9 CPUs and on-chip devices that may From owner-svn-src-head@freebsd.org Wed Aug 9 01:19:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10AA2DB525A; Wed, 9 Aug 2017 01:19:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3F8E8048A; Wed, 9 Aug 2017 01:19:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791JJ41014248; Wed, 9 Aug 2017 01:19:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791JJeB014244; Wed, 9 Aug 2017 01:19:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708090119.v791JJeB014244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 01:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322291 - in head/usr.bin/du: . tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/usr.bin/du: . tests X-SVN-Commit-Revision: 322291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 01:19:21 -0000 Author: kevans Date: Wed Aug 9 01:19:19 2017 New Revision: 322291 URL: https://svnweb.freebsd.org/changeset/base/322291 Log: du(1): Add --si option to display in terms of powers of 1000 Reviewed by: cem (earlier version), emaste Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11748 Modified: head/usr.bin/du/du.1 head/usr.bin/du/du.c head/usr.bin/du/tests/du_test.sh Modified: head/usr.bin/du/du.1 ============================================================================== --- head/usr.bin/du/du.1 Wed Aug 9 01:14:29 2017 (r322290) +++ head/usr.bin/du/du.1 Wed Aug 9 01:19:19 2017 (r322291) @@ -28,7 +28,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 4, 2012 +.Dd August 8, 2017 .Dt DU 1 .Os .Sh NAME @@ -63,9 +63,10 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl h, k, m +.Fl h, k, m, +.Fl Fl si and -.Fl g +.Fl g options or setting .Ev BLOCKSIZE and gives an estimate of how much space the examined file hierarchy would @@ -101,7 +102,7 @@ Display block counts in 1073741824-byte (1 GiB) blocks .Dq Human-readable output. Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. +Gigabyte, Terabyte and Petabyte based on powers of 1024. .It Fl k Display block counts in 1024-byte (1 kiB) blocks. .It Fl l @@ -131,6 +132,11 @@ This option exists solely for conformance with Display an entry for each specified file. (Equivalent to .Fl d Li 0 ) +.It Fl Fl si +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte based on powers of 1000. .It Fl t Ar threshold Display only entries for which size exceeds .Ar threshold . @@ -166,9 +172,9 @@ options override each other and the command's actions by the last one specified. .Pp The -.Fl h, k +.Fl h, k, m and -.Fl m +.Fl Fl si options all override each other; the last one specified determines the block counts used. .Sh ENVIRONMENT @@ -177,17 +183,17 @@ the block counts used. If the environment variable .Ev BLOCKSIZE is set, and the -.Fl h, k +.Fl h, k, m or -.Fl m +.Fl Fl si options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl h, k +.Fl h, k, m or -.Fl m +.Fl Fl si options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Wed Aug 9 01:14:29 2017 (r322290) +++ head/usr.bin/du/du.c Wed Aug 9 01:19:19 2017 (r322291) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -60,6 +61,11 @@ __FBSDID("$FreeBSD$"); #include #include +#define SI_OPT (CHAR_MAX + 1) + +#define UNITS_2 1 +#define UNITS_SI 2 + static SLIST_HEAD(ignhead, ignentry) ignores; struct ignentry { char *mask; @@ -75,10 +81,16 @@ static int ignorep(FTSENT *); static void siginfo(int __unused); static int nodumpflag = 0; -static int Aflag; +static int Aflag, hflag; static long blocksize, cblocksize; static volatile sig_atomic_t info; +static const struct option long_options[] = +{ + { "si", no_argument, NULL, SI_OPT }, + { NULL, no_argument, NULL, 0 }, +}; + int main(int argc, char *argv[]) { @@ -89,14 +101,13 @@ main(int argc, char *argv[]) int ftsoptions; int depth; int Hflag, Lflag, aflag, sflag, dflag, cflag; - int hflag, lflag, ch, notused, rval; + int lflag, ch, notused, rval; char **save; static char dot[] = "."; setlocale(LC_ALL, ""); - Hflag = Lflag = aflag = sflag = dflag = cflag = hflag = - lflag = Aflag = 0; + Hflag = Lflag = aflag = sflag = dflag = cflag = lflag = Aflag = 0; save = argv; ftsoptions = FTS_PHYSICAL; @@ -108,7 +119,8 @@ main(int argc, char *argv[]) depth = INT_MAX; SLIST_INIT(&ignores); - while ((ch = getopt(argc, argv, "AB:HI:LPasd:cghklmnrt:x")) != -1) + while ((ch = getopt_long(argc, argv, "+AB:HI:LPasd:cghklmnrt:x", + long_options, NULL)) != -1) switch (ch) { case 'A': Aflag = 1; @@ -160,7 +172,7 @@ main(int argc, char *argv[]) blocksize = 1073741824; break; case 'h': - hflag = 1; + hflag = UNITS_2; break; case 'k': hflag = 0; @@ -189,6 +201,9 @@ main(int argc, char *argv[]) case 'x': ftsoptions |= FTS_XDEV; break; + case SI_OPT: + hflag = UNITS_SI; + break; case '?': default: usage(); @@ -270,7 +285,7 @@ main(int argc, char *argv[]) if (p->fts_level <= depth && threshold <= threshold_sign * howmany(p->fts_bignum * cblocksize, blocksize)) { - if (hflag) { + if (hflag > 0) { prthumanval(p->fts_bignum); (void)printf("\t%s\n", p->fts_path); } else { @@ -306,7 +321,7 @@ main(int argc, char *argv[]) howmany(p->fts_statp->st_blocks, cblocksize); if (aflag || p->fts_level == 0) { - if (hflag) { + if (hflag > 0) { prthumanval(curblocks); (void)printf("\t%s\n", p->fts_path); } else { @@ -326,7 +341,7 @@ main(int argc, char *argv[]) err(1, "fts_read"); if (cflag) { - if (hflag) { + if (hflag > 0) { prthumanval(savednumber); (void)printf("\ttotal\n"); } else { @@ -474,13 +489,16 @@ static void prthumanval(int64_t bytes) { char buf[5]; + int flags; bytes *= cblocksize; + flags = HN_B | HN_NOSPACE | HN_DECIMAL; if (!Aflag) bytes *= DEV_BSIZE; + if (hflag == UNITS_SI) + flags |= HN_DIVISOR_1000; - humanize_number(buf, sizeof(buf), bytes, "", HN_AUTOSCALE, - HN_B | HN_NOSPACE | HN_DECIMAL); + humanize_number(buf, sizeof(buf), bytes, "", HN_AUTOSCALE, flags); (void)printf("%4s", buf); } Modified: head/usr.bin/du/tests/du_test.sh ============================================================================== --- head/usr.bin/du/tests/du_test.sh Wed Aug 9 01:14:29 2017 (r322290) +++ head/usr.bin/du/tests/du_test.sh Wed Aug 9 01:19:19 2017 (r322291) @@ -141,6 +141,20 @@ m_flag_body() atf_check -o inline:'1\tA\n1\tB\n1024\tC\n' du -Am A B C } +atf_test_case si_flag +si_flag_head() +{ + atf_set "descr" "Verify --si output" +} +si_flag_body() +{ + atf_check truncate -s 1500000 A + atf_check truncate -s 1572864 B + + atf_check -o inline:'1.4M\tA\n1.5M\tB\n' du -Ah A B + atf_check -o inline:'1.5M\tA\n1.6M\tB\n' du -A --si A B +} + atf_init_test_cases() { atf_add_test_case A_flag @@ -150,4 +164,5 @@ atf_init_test_cases() atf_add_test_case h_flag atf_add_test_case k_flag atf_add_test_case m_flag + atf_add_test_case si_flag } From owner-svn-src-head@freebsd.org Wed Aug 9 01:20:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC4BBDB5411; Wed, 9 Aug 2017 01:20:54 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BE9480661; Wed, 9 Aug 2017 01:20:54 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791KrlZ014359; Wed, 9 Aug 2017 01:20:53 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791Krwm014358; Wed, 9 Aug 2017 01:20:53 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090120.v791Krwm014358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 01:20:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322292 - head/sys/boot/fdt/dts/arm X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/boot/fdt/dts/arm X-SVN-Commit-Revision: 322292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 01:20:54 -0000 Author: mw Date: Wed Aug 9 01:20:53 2017 New Revision: 322292 URL: https://svnweb.freebsd.org/changeset/base/322292 Log: Remove clock-frequency properties from Armada 38x timer nodes Since the timers' base frequency setting is added to the platform code, this patch removes clock-frequency properties from global and twd timers, aligning both to the Linux device tree. Submitted by: Patryk Duda Reviewed by: cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11882 Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/armada-38x.dtsi Wed Aug 9 01:19:19 2017 (r322291) +++ head/sys/boot/fdt/dts/arm/armada-38x.dtsi Wed Aug 9 01:20:53 2017 (r322292) @@ -189,7 +189,6 @@ compatible = "arm,cortex-a9-global-timer"; reg = <0xc200 0x20>; interrupts = ; - clock-frequency = <800000000>; clocks = <&coreclk 2>; }; @@ -197,7 +196,6 @@ compatible = "arm,cortex-a9-twd-timer"; reg = <0xc600 0x20>; interrupts = ; - clock-frequency = <800000000>; clocks = <&coreclk 2>; }; From owner-svn-src-head@freebsd.org Wed Aug 9 01:24:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F16FDB59BE; Wed, 9 Aug 2017 01:24:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C4F780B5F; Wed, 9 Aug 2017 01:24:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791Oq5s018039; Wed, 9 Aug 2017 01:24:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791Oq49018037; Wed, 9 Aug 2017 01:24:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708090124.v791Oq49018037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 01:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322293 - head/bin/df X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/bin/df X-SVN-Commit-Revision: 322293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 01:24:53 -0000 Author: kevans Date: Wed Aug 9 01:24:52 2017 New Revision: 322293 URL: https://svnweb.freebsd.org/changeset/base/322293 Log: df(1): Add --si as an alias for -H Reviewed by: cem (earlier version), emaste Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11749 Modified: head/bin/df/df.1 head/bin/df/df.c Modified: head/bin/df/df.1 ============================================================================== --- head/bin/df/df.1 Wed Aug 9 01:20:53 2017 (r322292) +++ head/bin/df/df.1 Wed Aug 9 01:24:52 2017 (r322293) @@ -29,7 +29,7 @@ .\" @(#)df.1 8.3 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd December 1, 2015 +.Dd August 8, 2017 .Dt DF 1 .Os .Sh NAME @@ -97,7 +97,7 @@ output. Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and Pebibyte (based on powers of 1024) in order to reduce the number of digits to four or fewer. -.It Fl H +.It Fl H , Fl Fl si .Dq Human-readable output. Use unit suffixes: Byte, Kilobyte, Megabyte, Modified: head/bin/df/df.c ============================================================================== --- head/bin/df/df.c Wed Aug 9 01:20:53 2017 (r322292) +++ head/bin/df/df.c Wed Aug 9 01:24:52 2017 (r322293) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #include #include #ifdef MOUNT_CHAR_DEVS @@ -107,6 +108,12 @@ static int thousands; static struct ufs_args mdev; #endif +static const struct option long_options[] = +{ + { "si", no_argument, NULL, 'H' }, + { NULL, no_argument, NULL, 0 }, +}; + int main(int argc, char *argv[]) { @@ -142,7 +149,8 @@ main(int argc, char *argv[]) if (argc < 0) exit(1); - while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T,")) != -1) + while ((ch = getopt_long(argc, argv, "+abcgHhiklmnPt:T,", long_options, + NULL)) != -1) switch (ch) { case 'a': aflag = 1; From owner-svn-src-head@freebsd.org Wed Aug 9 01:25:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2C5BDB5B67; Wed, 9 Aug 2017 01:25:48 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81C4580D0D; Wed, 9 Aug 2017 01:25:48 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791PlUF018120; Wed, 9 Aug 2017 01:25:47 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791Plrp018119; Wed, 9 Aug 2017 01:25:47 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090125.v791Plrp018119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 01:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322294 - head/sys/arm/mv/armada38x X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/arm/mv/armada38x X-SVN-Commit-Revision: 322294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 01:25:48 -0000 Author: mw Date: Wed Aug 9 01:25:47 2017 New Revision: 322294 URL: https://svnweb.freebsd.org/changeset/base/322294 Log: Enable pl310 coherent operation in platform init for Armada 38x Updating PL310 sotfware context sc_io_coherent field in platform_pl310_init() routine for Armada 38x helps to avoid using 'arm,io-coherent' property, which is by default not present in the device tree node in Linux. This way another step for DT unification between two operating systems is done. The improvemnt will also work after enabling PLATFORM for Marvell ARMv7 SoCs. Reviewed by: andrew, cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11883 Modified: head/sys/arm/mv/armada38x/armada38x_pl310.c Modified: head/sys/arm/mv/armada38x/armada38x_pl310.c ============================================================================== --- head/sys/arm/mv/armada38x/armada38x_pl310.c Wed Aug 9 01:24:52 2017 (r322293) +++ head/sys/arm/mv/armada38x/armada38x_pl310.c Wed Aug 9 01:25:47 2017 (r322294) @@ -57,6 +57,9 @@ platform_pl310_init(struct pl310_softc *sc) pl310_write4(sc, PL310_PREFETCH_CTRL, PREFETCH_CTRL_DL | PREFETCH_CTRL_DATA_PREFETCH | PREFETCH_CTRL_INCR_DL | PREFETCH_CTRL_DL_ON_WRAP); + + /* Disable L2 cache sync for IO coherent operation */ + sc->sc_io_coherent = true; } void From owner-svn-src-head@freebsd.org Wed Aug 9 01:31:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01479DB60ED; Wed, 9 Aug 2017 01:31:07 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C447A81060; Wed, 9 Aug 2017 01:31:06 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791V6OL019006; Wed, 9 Aug 2017 01:31:06 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791V5lM019004; Wed, 9 Aug 2017 01:31:05 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090131.v791V5lM019004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 01:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322295 - head/sys/boot/fdt/dts/arm X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/boot/fdt/dts/arm X-SVN-Commit-Revision: 322295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 01:31:07 -0000 Author: mw Date: Wed Aug 9 01:31:05 2017 New Revision: 322295 URL: https://svnweb.freebsd.org/changeset/base/322295 Log: Update pl310 node in Armada 38x DTS to match the one used in Linux Since the cache controller nodes fixup is added to the platform code, this patch aligns it to the Linux device tree representation. Submitted by: Patryk Duda Reviewed by: cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11884 Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/armada-38x.dtsi Wed Aug 9 01:25:47 2017 (r322294) +++ head/sys/boot/fdt/dts/arm/armada-38x.dtsi Wed Aug 9 01:31:05 2017 (r322295) @@ -177,7 +177,10 @@ reg = <0x8000 0x1000>; cache-unified; cache-level = <2>; - arm,io-coherent; + arm,double-linefill-incr = <1>; + arm,double-linefill-wrap = <0>; + arm,double-linefill = <1>; + prefetch-data = <1>; }; scu@c000 { From owner-svn-src-head@freebsd.org Wed Aug 9 04:09:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E575DC1E11; Wed, 9 Aug 2017 04:09:18 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from APC01-HK2-obe.outbound.protection.outlook.com (mail-hk2apc01on0120.outbound.protection.outlook.com [104.47.124.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C7BE1777; Wed, 9 Aug 2017 04:09:16 +0000 (UTC) (envelope-from decui@microsoft.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/r/oxQBttJaDD/9NNNIPK1NyWl/iEkGApSDZ4eji1g4=; b=WGXRHXOwyqaB57DTGLHBQSxUgSMm3SrpLS83kLoKFgqhGf6HPiEwqxQNzCL2IDnRGL6N7tKgq/Lm3odzfkbMm3ZEEux6fYreRbHz8vZRlcEXPS8I6AhGPv6nEgCviKYiPG95jNbBXVzq/wejRx2fyk7QQ0EdrB2iJRh8t3O0zlQ= Received: from KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM (10.170.167.145) by KL1P15301MB0039.APCP153.PROD.OUTLOOK.COM (10.170.168.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.4; Wed, 9 Aug 2017 04:09:09 +0000 Received: from KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM ([10.170.167.145]) by KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM ([10.170.167.145]) with mapi id 15.01.1362.003; Wed, 9 Aug 2017 04:09:08 +0000 From: Dexuan Cui To: Jung-uk Kim , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" CC: Yanmin Qiao , Hongjiang Zhang Subject: RE: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 Thread-Topic: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 Thread-Index: AQHTDbgLhcqLEIRH8UKGIazjERHYm6J7bHlA Date: Wed, 9 Aug 2017 04:09:07 +0000 Message-ID: References: <201708050656.v756uk48076256@repo.freebsd.org> In-Reply-To: <201708050656.v756uk48076256@repo.freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Ref=https://api.informationprotection.azure.com/api/72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=decui@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2017-08-08T21:09:05.9146953-07:00; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [50.35.78.155] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; KL1P15301MB0039; 6:wrLmHIpAZhwSyClR7HrNyievuZqr+R0FA6TQ+5GqMJGA1CzoTT3cgdq/wEaQa6/nYi8u/yyZNjT/wEziRqE8vEpVxLpyfrS/gnV2moQdsIItd6JZ6jG4CxWpONDmmx5SQDW3x3sfy2kygVY9mCNuElP73JUozK+tbDTIpIwwjifpKDu4Tp5gl7mO7WphgTzF2p7nv8yRcGgitZezZBlu+An3jAumjf/xhq9PPf9+kgRU8i0dkFf8jUnkqTT+RS1chU/Y3RU0QCr2BjqLE6MlsEeUvok2XoHEzllfw5Qx+rRgxzfYLZ8rk5e22jTLqYIzblefxK8Q2UjdINeDXh0AOA==; 5:dDvs0Pus2R/Bz308xyPvtDv1cwx1k1mJMzdt/bUBp58MbqCzhkwAZHJt0PFgQW7N95onkPk9CP1V/KlhOGUHkbrlcu/tr56iMgH/9qXYeksmy1J4px9Ta6PHXV6mMFGqnBaRMEm4wmV8Fi9vIkmfxg==; 24:Gs+SPHFSUGeySq09i4X5D0F/n5odJ7nOZF9jUVIKRIx4bI9ydTYueJIcvYw67qw5YQXoh61eIyQQPVNc9yqL2PBgeduUNRzFkCrdgY7D7iE=; 7:MG/k8j5SxoIytjRy3RbVBfq5m+O34TlH0YMQdxQaUi9yjuSAsf6CBMzz/y+NQn5ZtcesN9SgwLunE+ANxONXFNQVHLwdXLMJT/6/63EYhdmPvsLc2EOxMYCNBmifyX8xz4DD6iXn2ParemDHME+XMEhAHSOmxLr4KD4KhuonC5zHwVRfhVmJRUBOQLvfhbM++Y11EDP6Ho2eei2vrnl5YxpCRYq7q4aKmBmMI4kEzOg= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(6009001)(39400400002)(39860400002)(39450400003)(39850400002)(39840400002)(39410400002)(47760400005)(13464003)(189002)(199003)(50986999)(54356999)(2201001)(76176999)(86612001)(74316002)(8990500004)(3660700001)(2900100001)(6246003)(53936002)(25786009)(305945005)(68736007)(101416001)(105586002)(97736004)(2950100002)(106356001)(53546010)(8936002)(189998001)(5005710100001)(2501003)(66066001)(8676002)(6506006)(10090500001)(6436002)(81166006)(81156014)(4326008)(450100002)(5660300001)(2906002)(966005)(229853002)(9686003)(6306002)(3280700002)(7736002)(86362001)(575784001)(10290500003)(478600001)(54906002)(3846002)(7696004)(33656002)(6116002)(102836003)(38730400002)(107886003)(14454004)(77096006)(55016002); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1P15301MB0039; H:KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: 07c2b888-caae-48df-6fd7-08d4dedc61f8 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:KL1P15301MB0039; x-ms-traffictypediagnostic: KL1P15301MB0039: x-exchange-antispam-report-test: UriScan:(189930954265078)(219752817060721); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(61425038)(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123558100)(20161123564025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:KL1P15301MB0039; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:KL1P15301MB0039; x-forefront-prvs: 0394259C80 received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Aug 2017 04:09:07.8612 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1P15301MB0039 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 04:09:18 -0000 SGkgamtpbSwNClRoZSBwYXRjaCBicmVha3MgRnJlZUJTRCBWTSBvbiBIeXBlci1WLg0KDQppZGVu dGlmeV9oeXBlcnZpc29yKCkgaXMgbW92ZWQgZnJvbSBpZGVudGlmeV9jcHUoKSB0byBhbiBlYXJs aWVyIHBsYWNlLCBidXQgdGhlIGdsb2JhbCANCnZhcmlhYmxlIGNwdV9mZWF0dXJlMiB1c2VkIGJ5 IHRoZSBmdW5jdGlvbiBpcyBzdGlsbCBpbml0aWFsaXplZCBpbiBpZGVudGlmeV9jcHUoKS4NCg0K SSdtIG5vdCBzdXJlIGFib3V0IHRoZSBiYWNrZ3JvdW5kIG9mIHlvdXIgcGF0Y2guIENhbiB5b3Ug cGxlYXNlIGhhdmUgYSBsb29rPw0KDQpUaGFua3MsDQotLSBEZXh1YW4NCg0KPiAtLS0tLU9yaWdp bmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBvd25lci1zcmMtY29tbWl0dGVyc0BmcmVlYnNkLm9y ZyBbbWFpbHRvOm93bmVyLXNyYy0NCj4gY29tbWl0dGVyc0BmcmVlYnNkLm9yZ10gT24gQmVoYWxm IE9mIEp1bmctdWsgS2ltDQo+IFNlbnQ6IEZyaWRheSwgQXVndXN0IDQsIDIwMTcgMjM6NTcNCj4g VG86IHNyYy1jb21taXR0ZXJzQGZyZWVic2Qub3JnOyBzdm4tc3JjLWFsbEBmcmVlYnNkLm9yZzsg c3ZuLXNyYy0NCj4gaGVhZEBmcmVlYnNkLm9yZw0KPiBTdWJqZWN0OiBzdm4gY29tbWl0OiByMzIy MDc2IC0gaW4gaGVhZC9zeXM6IGFtZDY0L2FtZDY0IGkzODYvaTM4Ng0KPiB4ODYvaW5jbHVkZSB4 ODYveDg2DQo+IA0KPiBBdXRob3I6IGpraW0NCj4gRGF0ZTogU2F0IEF1ZyAgNSAwNjo1Njo0NiAy MDE3DQo+IE5ldyBSZXZpc2lvbjogMzIyMDc2DQo+IFVSTDoNCj4gaHR0cHM6Ly9uYTAxLnNhZmVs aW5rcy5wcm90ZWN0aW9uLm91dGxvb2suY29tLz91cmw9aHR0cHMlM0ElMkYlMkZzdm53ZWIuZnIN Cj4gZWVic2Qub3JnJTJGY2hhbmdlc2V0JTJGYmFzZSUyRjMyMjA3NiZkYXRhPTAyJTdDMDElN0Nk ZWN1aSU0MG1pY3INCj4gb3NvZnQuY29tJTdDNWE4MjYyMzVlMDhiNDE1ZmMzY2IwOGQ0ZGJjZjJi ODAlN0M3MmY5ODhiZjg2ZjE0MWFmOTFhYg0KPiAyZDdjZDAxMWRiNDclN0MxJTdDMCU3QzYzNjM3 NTEzMDIxNzE5MjA0NyZzZGF0YT0lMkJjWmhsciUyQjJ6WDVTDQo+IFMxZUEzMmZXTXB6Y2tOSE9R bEd6OFVITFhDYVVOMHMlM0QmcmVzZXJ2ZWQ9MA0KPiANCj4gTG9nOg0KPiAgIERldGVjdCBoeXBl cnZpc29ycyBlYXJseS4gIFdlIHVzZWQgdG8gc2V0IGxvd2VyIGh6IG9uIGh5cGVydmlzb3JzIGJ5 IGRlZmF1bHQNCj4gICBidXQgaXQgd2FzIGJyb2tlbiBzaW5jZSByMjczODAwIChhbmQgcjI3ODUy MiwgaXRzIE1GQyB0byBzdGFibGUvMTApIGJlY2F1c2UNCj4gICBpZGVudGlmeV9jcHUoKSBpcyBj YWxsZWQgdG9vIGxhdGUsIGkuZS4sIGFmdGVyIGluaXRfcGFyYW0xKCkuDQo+IA0KPiAgIE1GQyBh ZnRlcjoJMyBkYXlzDQo+IA0KPiBNb2RpZmllZDoNCj4gICBoZWFkL3N5cy9hbWQ2NC9hbWQ2NC9t YWNoZGVwLmMNCj4gICBoZWFkL3N5cy9pMzg2L2kzODYvbWFjaGRlcC5jDQo+ICAgaGVhZC9zeXMv eDg2L2luY2x1ZGUveDg2X3Zhci5oDQo+ICAgaGVhZC9zeXMveDg2L3g4Ni9pZGVudGNwdS5jDQo+ IA0KPiBNb2RpZmllZDogaGVhZC9zeXMvYW1kNjQvYW1kNjQvbWFjaGRlcC5jDQo+ID09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 DQo+ID09PT09PT09PT09PT0NCj4gLS0tIGhlYWQvc3lzL2FtZDY0L2FtZDY0L21hY2hkZXAuYwlT YXQgQXVnICA1IDA2OjQ2OjA2IDIwMTcNCj4gCShyMzIyMDc1KQ0KPiArKysgaGVhZC9zeXMvYW1k NjQvYW1kNjQvbWFjaGRlcC5jCVNhdCBBdWcgIDUgMDY6NTY6NDYgMjAxNw0KPiAJKHIzMjIwNzYp DQo+IEBAIC0xNTM3LDYgKzE1MzcsOCBAQCBoYW1tZXJfdGltZSh1X2ludDY0X3QgbW9kdWxlcCwg dV9pbnQ2NF90IHBoeXNmcmVlKQ0KPiANCj4gIAlrbWRwID0gaW5pdF9vcHMucGFyc2VfcHJlbG9h ZF9kYXRhKG1vZHVsZXApOw0KPiANCj4gKwlpZGVudGlmeV9oeXBlcnZpc29yKCk7DQo+ICsNCj4g IAkvKiBJbml0IGJhc2ljIHR1bmFibGVzLCBoeiBldGMgKi8NCj4gIAlpbml0X3BhcmFtMSgpOw0K PiANCj4gDQo+IE1vZGlmaWVkOiBoZWFkL3N5cy9pMzg2L2kzODYvbWFjaGRlcC5jDQo+ID09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09DQo+ID09PT09PT09PT09PT0NCj4gLS0tIGhlYWQvc3lzL2kzODYvaTM4Ni9tYWNoZGVwLmMJ U2F0IEF1ZyAgNSAwNjo0NjowNiAyMDE3DQo+IAkocjMyMjA3NSkNCj4gKysrIGhlYWQvc3lzL2kz ODYvaTM4Ni9tYWNoZGVwLmMJU2F0IEF1ZyAgNSAwNjo1Njo0NiAyMDE3DQo+IAkocjMyMjA3NikN Cj4gQEAgLTIxODUsNiArMjE4NSw4IEBAIGluaXQzODYoaW50IGZpcnN0KQ0KPiAgCWVsc2UNCj4g IAkJaW5pdF9zdGF0aWNfa2VudihOVUxMLCAwKTsNCj4gDQo+ICsJaWRlbnRpZnlfaHlwZXJ2aXNv cigpOw0KPiArDQo+ICAJLyogSW5pdCBiYXNpYyB0dW5hYmxlcywgaHogZXRjICovDQo+ICAJaW5p dF9wYXJhbTEoKTsNCj4gDQo+IA0KPiBNb2RpZmllZDogaGVhZC9zeXMveDg2L2luY2x1ZGUveDg2 X3Zhci5oDQo+ID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09DQo+ID09PT09PT09PT09PT0NCj4gLS0tIGhlYWQvc3lzL3g4Ni9p bmNsdWRlL3g4Nl92YXIuaAlTYXQgQXVnICA1IDA2OjQ2OjA2IDIwMTcNCj4gCShyMzIyMDc1KQ0K PiArKysgaGVhZC9zeXMveDg2L2luY2x1ZGUveDg2X3Zhci5oCVNhdCBBdWcgIDUgMDY6NTY6NDYg MjAxNw0KPiAJKHIzMjIwNzYpDQo+IEBAIC0xMTYsNiArMTE2LDcgQEAgdm9pZAljcHVfc2V0cmVn cyh2b2lkKTsNCj4gIHZvaWQJZHVtcF9hZGRfcGFnZSh2bV9wYWRkcl90KTsNCj4gIHZvaWQJZHVt cF9kcm9wX3BhZ2Uodm1fcGFkZHJfdCk7DQo+ICB2b2lkCWlkZW50aWZ5X2NwdSh2b2lkKTsNCj4g K3ZvaWQJaWRlbnRpZnlfaHlwZXJ2aXNvcih2b2lkKTsNCj4gIHZvaWQJaW5pdGlhbGl6ZWNwdSh2 b2lkKTsNCj4gIHZvaWQJaW5pdGlhbGl6ZWNwdWNhY2hlKHZvaWQpOw0KPiAgYm9vbAlmaXhfY3B1 aWQodm9pZCk7DQo+IA0KPiBNb2RpZmllZDogaGVhZC9zeXMveDg2L3g4Ni9pZGVudGNwdS5jDQo+ ID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09DQo+ID09PT09PT09PT09PT0NCj4gLS0tIGhlYWQvc3lzL3g4Ni94ODYvaWRlbnRj cHUuYwlTYXQgQXVnICA1IDA2OjQ2OjA2IDIwMTcJKHIzMjIwNzUpDQo+ICsrKyBoZWFkL3N5cy94 ODYveDg2L2lkZW50Y3B1LmMJU2F0IEF1ZyAgNSAwNjo1Njo0NiAyMDE3DQo+IAkocjMyMjA3NikN Cj4gQEAgLTEyNTIsNyArMTI1Miw3IEBAIHN0YXRpYyBjb25zdCBjaGFyICpjb25zdCB2bV9wbmFt ZXNbXSA9IHsNCj4gIAlOVUxMDQo+ICB9Ow0KPiANCj4gLXN0YXRpYyB2b2lkDQo+ICt2b2lkDQo+ ICBpZGVudGlmeV9oeXBlcnZpc29yKHZvaWQpDQo+ICB7DQo+ICAJdV9pbnQgcmVnc1s0XTsNCj4g QEAgLTE0MDMsNyArMTQwMyw2IEBAIGlkZW50aWZ5X2NwdSh2b2lkKQ0KPiAgCWNwdV9mZWF0dXJl MiA9IHJlZ3NbMl07DQo+ICAjZW5kaWYNCj4gDQo+IC0JaWRlbnRpZnlfaHlwZXJ2aXNvcigpOw0K PiAgCWNwdV92ZW5kb3JfaWQgPSBmaW5kX2NwdV92ZW5kb3JfaWQoKTsNCj4gDQo+ICAJaWYgKGZp eF9jcHVpZCgpKSB7DQoNCg== From owner-svn-src-head@freebsd.org Wed Aug 9 04:23:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FA01DC23D0; Wed, 9 Aug 2017 04:23:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF0661F4A; Wed, 9 Aug 2017 04:23:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v794N5QL091676; Wed, 9 Aug 2017 04:23:05 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v794N4Kd091671; Wed, 9 Aug 2017 04:23:04 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201708090423.v794N4Kd091671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 9 Aug 2017 04:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322296 - in head/sys: kern sparc64/sparc64 vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys: kern sparc64/sparc64 vm X-SVN-Commit-Revision: 322296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 04:23:06 -0000 Author: alc Date: Wed Aug 9 04:23:04 2017 New Revision: 322296 URL: https://svnweb.freebsd.org/changeset/base/322296 Log: Introduce vm_page_grab_pages(), which is intended to replace loops calling vm_page_grab() on consecutive page indices. Besides simplifying the code in the caller, vm_page_grab_pages() allows for batching optimizations. For example, the current implementation replaces calls to vm_page_lookup() on consecutive page indices by cheaper calls to vm_page_next(). Reviewed by: kib, markj Tested by: pho (an earlier version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11926 Modified: head/sys/kern/vfs_bio.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/vm_glue.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Aug 9 01:31:05 2017 (r322295) +++ head/sys/kern/vfs_bio.c Wed Aug 9 04:23:04 2017 (r322296) @@ -2735,7 +2735,7 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int */ obj = bp->b_bufobj->bo_object; VM_OBJECT_WLOCK(obj); - while (bp->b_npages < desiredpages) { + if (bp->b_npages < desiredpages) { /* * We must allocate system pages since blocking * here could interfere with paging I/O, no @@ -2746,14 +2746,12 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int * deadlocks once allocbuf() is called after * pages are vfs_busy_pages(). */ - m = vm_page_grab(obj, OFF_TO_IDX(bp->b_offset) + bp->b_npages, - VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM | - VM_ALLOC_WIRED | VM_ALLOC_IGN_SBUSY | - VM_ALLOC_COUNT(desiredpages - bp->b_npages)); - if (m->valid == 0) - bp->b_flags &= ~B_CACHE; - bp->b_pages[bp->b_npages] = m; - ++bp->b_npages; + vm_page_grab_pages(obj, + OFF_TO_IDX(bp->b_offset) + bp->b_npages, + VM_ALLOC_SYSTEM | VM_ALLOC_IGN_SBUSY | + VM_ALLOC_NOBUSY | VM_ALLOC_WIRED, + &bp->b_pages[bp->b_npages], desiredpages - bp->b_npages); + bp->b_npages = desiredpages; } /* Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Wed Aug 9 01:31:05 2017 (r322295) +++ head/sys/sparc64/sparc64/pmap.c Wed Aug 9 04:23:04 2017 (r322296) @@ -1226,7 +1226,6 @@ int pmap_pinit(pmap_t pm) { vm_page_t ma[TSB_PAGES]; - vm_page_t m; int i; /* @@ -1249,14 +1248,11 @@ pmap_pinit(pmap_t pm) CPU_ZERO(&pm->pm_active); VM_OBJECT_WLOCK(pm->pm_tsb_obj); - for (i = 0; i < TSB_PAGES; i++) { - m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); - m->valid = VM_PAGE_BITS_ALL; - m->md.pmap = pm; - ma[i] = m; - } + vm_page_grab_pages(pm->pm_tsb_obj, 0, VM_ALLOC_NORMAL | + VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | VM_ALLOC_ZERO, ma, TSB_PAGES); VM_OBJECT_WUNLOCK(pm->pm_tsb_obj); + for (i = 0; i < TSB_PAGES; i++) + ma[i]->md.pmap = pm; pmap_qenter((vm_offset_t)pm->pm_tsb, ma, TSB_PAGES); bzero(&pm->pm_stats, sizeof(pm->pm_stats)); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Wed Aug 9 01:31:05 2017 (r322295) +++ head/sys/vm/vm_glue.c Wed Aug 9 04:23:04 2017 (r322296) @@ -322,7 +322,7 @@ vm_thread_new(struct thread *td, int pages) { vm_object_t ksobj; vm_offset_t ks; - vm_page_t m, ma[KSTACK_MAX_PAGES]; + vm_page_t ma[KSTACK_MAX_PAGES]; struct kstack_cache_entry *ks_ce; int i; @@ -391,15 +391,10 @@ vm_thread_new(struct thread *td, int pages) * page of stack. */ VM_OBJECT_WLOCK(ksobj); - for (i = 0; i < pages; i++) { - /* - * Get a kernel stack page. - */ - m = vm_page_grab(ksobj, i, VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED); - ma[i] = m; - m->valid = VM_PAGE_BITS_ALL; - } + vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_WIRED, ma, pages); + for (i = 0; i < pages; i++) + ma[i]->valid = VM_PAGE_BITS_ALL; VM_OBJECT_WUNLOCK(ksobj); pmap_qenter(ks, ma, pages); return (1); @@ -573,9 +568,8 @@ vm_thread_swapin(struct thread *td) pages = td->td_kstack_pages; ksobj = td->td_kstack_obj; VM_OBJECT_WLOCK(ksobj); - for (int i = 0; i < pages; i++) - ma[i] = vm_page_grab(ksobj, i, VM_ALLOC_NORMAL | - VM_ALLOC_WIRED); + vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED, ma, + pages); for (int i = 0; i < pages;) { int j, a, count, rv; Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Aug 9 01:31:05 2017 (r322295) +++ head/sys/vm/vm_page.c Wed Aug 9 04:23:04 2017 (r322296) @@ -3155,6 +3155,100 @@ retrylookup: } /* + * Return the specified range of pages from the given object. For each + * page offset within the range, if a page already exists within the object + * at that offset and it is busy, then wait for it to change state. If, + * instead, the page doesn't exist, then allocate it. + * + * The caller must always specify an allocation class. + * + * allocation classes: + * VM_ALLOC_NORMAL normal process request + * VM_ALLOC_SYSTEM system *really* needs the pages + * + * The caller must always specify that the pages are to be busied and/or + * wired. + * + * optional allocation flags: + * VM_ALLOC_IGN_SBUSY do not sleep on soft busy pages + * VM_ALLOC_NOBUSY do not exclusive busy the page + * VM_ALLOC_SBUSY set page to sbusy state + * VM_ALLOC_WIRED wire the pages + * VM_ALLOC_ZERO zero and validate any invalid pages + * + * This routine may sleep. + */ +void +vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, + vm_page_t *ma, int count) +{ + vm_page_t m; + int i; + bool sleep; + + VM_OBJECT_ASSERT_WLOCKED(object); + KASSERT(((u_int)allocflags >> VM_ALLOC_COUNT_SHIFT) == 0, + ("vm_page_grap_pages: VM_ALLOC_COUNT() is not allowed")); + KASSERT((allocflags & VM_ALLOC_NOBUSY) == 0 || + (allocflags & VM_ALLOC_WIRED) != 0, + ("vm_page_grab_pages: the pages must be busied or wired")); + KASSERT((allocflags & VM_ALLOC_SBUSY) == 0 || + (allocflags & VM_ALLOC_IGN_SBUSY) != 0, + ("vm_page_grab_pages: VM_ALLOC_SBUSY/IGN_SBUSY mismatch")); + if (count == 0) + return; + i = 0; +retrylookup: + m = vm_page_lookup(object, pindex + i); + for (; i < count; i++) { + if (m != NULL) { + sleep = (allocflags & VM_ALLOC_IGN_SBUSY) != 0 ? + vm_page_xbusied(m) : vm_page_busied(m); + if (sleep) { + /* + * Reference the page before unlocking and + * sleeping so that the page daemon is less + * likely to reclaim it. + */ + vm_page_aflag_set(m, PGA_REFERENCED); + vm_page_lock(m); + VM_OBJECT_WUNLOCK(object); + vm_page_busy_sleep(m, "grbmaw", (allocflags & + VM_ALLOC_IGN_SBUSY) != 0); + VM_OBJECT_WLOCK(object); + goto retrylookup; + } + if ((allocflags & VM_ALLOC_WIRED) != 0) { + vm_page_lock(m); + vm_page_wire(m); + vm_page_unlock(m); + } + if ((allocflags & (VM_ALLOC_NOBUSY | + VM_ALLOC_SBUSY)) == 0) + vm_page_xbusy(m); + if ((allocflags & VM_ALLOC_SBUSY) != 0) + vm_page_sbusy(m); + } else { + m = vm_page_alloc(object, pindex + i, (allocflags & + ~VM_ALLOC_IGN_SBUSY) | VM_ALLOC_COUNT(count - i)); + if (m == NULL) { + VM_OBJECT_WUNLOCK(object); + VM_WAIT; + VM_OBJECT_WLOCK(object); + goto retrylookup; + } + } + if (m->valid == 0 && (allocflags & VM_ALLOC_ZERO) != 0) { + if ((m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + m->valid = VM_PAGE_BITS_ALL; + } + ma[i] = m; + m = vm_page_next(m); + } +} + +/* * Mapping function for valid or dirty bits in a page. * * Inputs are required to range within a page. Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Aug 9 01:31:05 2017 (r322295) +++ head/sys/vm/vm_page.h Wed Aug 9 04:23:04 2017 (r322296) @@ -394,6 +394,9 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); * vm_page_alloc_freelist(). Some functions support only a subset * of the flags, and ignore others, see the flags legend. * + * The meaning of VM_ALLOC_ZERO differs slightly between the vm_page_alloc*() + * and the vm_page_grab*() functions. See these functions for details. + * * Bits 0 - 1 define class. * Bits 2 - 15 dedicated for flags. * Legend: @@ -401,6 +404,7 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); * (c) - vm_page_alloc_contig() supports the flag. * (f) - vm_page_alloc_freelist() supports the flag. * (g) - vm_page_grab() supports the flag. + * (p) - vm_page_grab_pages() supports the flag. * Bits above 15 define the count of additional pages that the caller * intends to allocate. */ @@ -408,13 +412,13 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_INTERRUPT 1 #define VM_ALLOC_SYSTEM 2 #define VM_ALLOC_CLASS_MASK 3 -#define VM_ALLOC_WIRED 0x0020 /* (acfg) Allocate non pageable page */ -#define VM_ALLOC_ZERO 0x0040 /* (acfg) Try to obtain a zeroed page */ +#define VM_ALLOC_WIRED 0x0020 /* (acfgp) Allocate a wired page */ +#define VM_ALLOC_ZERO 0x0040 /* (acfgp) Allocate a prezeroed page */ #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ -#define VM_ALLOC_NOBUSY 0x0200 /* (acg) Do not busy the page */ -#define VM_ALLOC_IGN_SBUSY 0x1000 /* (g) Ignore shared busy flag */ +#define VM_ALLOC_NOBUSY 0x0200 /* (acgp) Do not excl busy the page */ +#define VM_ALLOC_IGN_SBUSY 0x1000 /* (gp) Ignore shared busy flag */ #define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */ -#define VM_ALLOC_SBUSY 0x4000 /* (acg) Shared busy the page */ +#define VM_ALLOC_SBUSY 0x4000 /* (acgp) Shared busy the page */ #define VM_ALLOC_NOWAIT 0x8000 /* (g) Do not sleep, return NULL */ #define VM_ALLOC_COUNT_SHIFT 16 #define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT) @@ -466,6 +470,8 @@ vm_page_t vm_page_alloc_contig(vm_object_t object, vm_ vm_paddr_t boundary, vm_memattr_t memattr); vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); +void vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, + vm_page_t *ma, int count); int vm_page_try_to_free (vm_page_t); void vm_page_deactivate (vm_page_t); void vm_page_deactivate_noreuse(vm_page_t); From owner-svn-src-head@freebsd.org Wed Aug 9 05:17:22 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF6EEDC2CBD; Wed, 9 Aug 2017 05:17:22 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8FB230A5; Wed, 9 Aug 2017 05:17:22 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v795HLM8011850; Wed, 9 Aug 2017 05:17:21 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v795HLtb011847; Wed, 9 Aug 2017 05:17:21 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708090517.v795HLtb011847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 9 Aug 2017 05:17:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322297 - in head: sbin/fsck_ffs sbin/newfs sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head: sbin/fsck_ffs sbin/newfs sys/ufs/ffs X-SVN-Commit-Revision: 322297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 05:17:22 -0000 Author: mckusick Date: Wed Aug 9 05:17:21 2017 New Revision: 322297 URL: https://svnweb.freebsd.org/changeset/base/322297 Log: Since the switch to GPT disk labels, fsck for UFS/FFS has been unable to automatically find alternate superblocks. This checkin places the information needed to find alternate superblocks to the end of the area reserved for the boot block. Filesystems created with a newfs of this vintage or later will create the recovery information. If you have a filesystem created prior to this change and wish to have a recovery block created for your filesystem, you can do so by running fsck in forground mode (i.e., do not use the -p or -y options). As it starts, fsck will ask ``SAVE DATA TO FIND ALTERNATE SUPERBLOCKS'' to which you should answer yes. Discussed with: kib, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11589 Modified: head/sbin/fsck_ffs/setup.c head/sbin/newfs/mkfs.c head/sys/ufs/ffs/fs.h Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Wed Aug 9 04:23:04 2017 (r322296) +++ head/sbin/fsck_ffs/setup.c Wed Aug 9 05:17:21 2017 (r322297) @@ -58,6 +58,10 @@ struct bufarea asblk; #define altsblock (*asblk.b_un.b_fs) #define POWEROF2(num) (((num) & ((num) - 1)) == 0) +static int calcsb(char *dev, int devfd, struct fs *fs); +static void saverecovery(int readfd, int writefd); +static int chkrecovery(int devfd); + /* * Read in a superblock finding an alternate if necessary. * Return 1 if successful, 0 if unsuccessful, -1 if file system @@ -66,9 +70,10 @@ struct bufarea asblk; int setup(char *dev) { - long asked, i, j; + long cg, asked, i, j; long bmapsize; struct stat statb; + struct fs proto; size_t size; havesb = 0; @@ -173,10 +178,28 @@ setup(char *dev) */ if (readsb(1) == 0) { skipclean = 0; - if (bflag || preen) + if (bflag || preen || calcsb(dev, fsreadfd, &proto) == 0) return(0); - /* Looking for alternates is hard punt for now but retain structure */ - return (0); + if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0) + return (0); + for (cg = 0; cg < proto.fs_ncg; cg++) { + bflag = fsbtodb(&proto, cgsblock(&proto, cg)); + if (readsb(0) != 0) + break; + } + if (cg >= proto.fs_ncg) { + printf("%s %s\n%s %s\n%s %s\n", + "SEARCH FOR ALTERNATE SUPER-BLOCK", + "FAILED. YOU MUST USE THE", + "-b OPTION TO FSCK TO SPECIFY THE", + "LOCATION OF AN ALTERNATE", + "SUPER-BLOCK TO SUPPLY NEEDED", + "INFORMATION; SEE fsck_ffs(8)."); + bflag = 0; + return(0); + } + pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag); + bflag = 0; } if (skipclean && ckclean && sblock.fs_clean) { pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); @@ -213,6 +236,10 @@ setup(char *dev) memmove(&altsblock, &sblock, (size_t)sblock.fs_sbsize); flush(fswritefd, &asblk); } + if (preen == 0 && yflag == 0 && sblock.fs_magic == FS_UFS2_MAGIC && + fswritefd != -1 && chkrecovery(fsreadfd) == 0 && + reply("SAVE DATA TO FIND ALTERNATE SUPERBLOCKS") != 0) + saverecovery(fsreadfd, fswritefd); /* * read in the summary info. */ @@ -427,4 +454,74 @@ sblock_init(void) if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL) errx(EEXIT, "cannot allocate space for superblock"); dev_bsize = secsize = DEV_BSIZE; +} + +/* + * Calculate a prototype superblock based on information in the boot area. + * When done the cgsblock macro can be calculated and the fs_ncg field + * can be used. Do NOT attempt to use other macros without verifying that + * their needed information is available! + */ +static int +calcsb(char *dev, int devfd, struct fs *fs) +{ + struct fsrecovery fsr; + + /* + * We need fragments-per-group and the partition-size. + * + * Newfs stores these details at the end of the boot block area + * at the start of the filesystem partition. If they have been + * overwritten by a boot block, we fail. But usually they are + * there and we can use them. + */ + if (blread(devfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) || + fsr.fsr_magic != FS_UFS2_MAGIC) + return (0); + memset(fs, 0, sizeof(struct fs)); + fs->fs_fpg = fsr.fsr_fpg; + fs->fs_fsbtodb = fsr.fsr_fsbtodb; + fs->fs_sblkno = fsr.fsr_sblkno; + fs->fs_magic = fsr.fsr_magic; + fs->fs_ncg = fsr.fsr_ncg; + return (1); +} + +/* + * Check to see if recovery information exists. + */ +static int +chkrecovery(int devfd) +{ + struct fsrecovery fsr; + + if (blread(devfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) || + fsr.fsr_magic != FS_UFS2_MAGIC) + return (0); + return (1); +} + +/* + * Read the last sector of the boot block, replace the last + * 20 bytes with the recovery information, then write it back. + * The recovery information only works for UFS2 filesystems. + */ +static void +saverecovery(int readfd, int writefd) +{ + struct fsrecovery fsr; + + if (sblock.fs_magic != FS_UFS2_MAGIC || + blread(readfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr))) + return; + fsr.fsr_magic = sblock.fs_magic; + fsr.fsr_fpg = sblock.fs_fpg; + fsr.fsr_fsbtodb = sblock.fs_fsbtodb; + fsr.fsr_sblkno = sblock.fs_sblkno; + fsr.fsr_ncg = sblock.fs_ncg; + blwrite(writefd, (char *)&fsr, (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, + sizeof(fsr)); } Modified: head/sbin/newfs/mkfs.c ============================================================================== --- head/sbin/newfs/mkfs.c Wed Aug 9 04:23:04 2017 (r322296) +++ head/sbin/newfs/mkfs.c Wed Aug 9 05:17:21 2017 (r322297) @@ -121,6 +121,7 @@ mkfs(struct partition *pp, char *fsys) ino_t maxinum; int minfragsperinode; /* minimum ratio of frags to inodes */ char tmpbuf[100]; /* XXX this will break in about 2,500 years */ + struct fsrecovery fsr; union { struct fs fdummy; char cdummy[SBLOCKSIZE]; @@ -616,6 +617,25 @@ restart: wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)), MIN(sblock.fs_cssize - i, sblock.fs_bsize), ((char *)fscs) + i); + /* + * Read the last sector of the boot block, replace the last + * 20 bytes with the recovery information, then write it back. + * The recovery information only works for UFS2 filesystems. + */ + if (sblock.fs_magic == FS_UFS2_MAGIC) { + i = bread(&disk, + part_ofs + (SBLOCK_UFS2 - sizeof(fsr)) / disk.d_bsize, + (char *)&fsr, sizeof(fsr)); + if (i == -1) + err(1, "can't read recovery area: %s", disk.d_error); + fsr.fsr_magic = sblock.fs_magic; + fsr.fsr_fpg = sblock.fs_fpg; + fsr.fsr_fsbtodb = sblock.fs_fsbtodb; + fsr.fsr_sblkno = sblock.fs_sblkno; + fsr.fsr_ncg = sblock.fs_ncg; + wtfs((SBLOCK_UFS2 - sizeof(fsr)) / disk.d_bsize, sizeof(fsr), + (char *)&fsr); + } /* * Update information about this partition in pack * label, to that it may be updated on disk. Modified: head/sys/ufs/ffs/fs.h ============================================================================== --- head/sys/ufs/ffs/fs.h Wed Aug 9 04:23:04 2017 (r322296) +++ head/sys/ufs/ffs/fs.h Wed Aug 9 05:17:21 2017 (r322297) @@ -234,6 +234,20 @@ struct fsck_cmd { }; /* + * A recovery structure placed at the end of the boot block area by newfs + * that can be used by fsck to search for alternate superblocks. + */ +#define RESID (4096 - 20) /* disk sector size minus recovery area size */ +struct fsrecovery { + char block[RESID]; /* unused part of sector */ + int32_t fsr_magic; /* magic number */ + int32_t fsr_fsbtodb; /* fsbtodb and dbtofsb shift constant */ + int32_t fsr_sblkno; /* offset of super-block in filesys */ + int32_t fsr_fpg; /* blocks per group * fs_frag */ + u_int32_t fsr_ncg; /* number of cylinder groups */ +}; + +/* * Per cylinder group information; summarized in blocks allocated * from first cylinder group data blocks. These blocks have to be * read in from fs_csaddr (size fs_cssize) in addition to the From owner-svn-src-head@freebsd.org Wed Aug 9 05:21:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9721ADC3026; Wed, 9 Aug 2017 05:21:58 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61E25355F; Wed, 9 Aug 2017 05:21:58 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v795LvoX015802; Wed, 9 Aug 2017 05:21:57 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v795LvgP015801; Wed, 9 Aug 2017 05:21:57 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708090521.v795LvgP015801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 9 Aug 2017 05:21:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322298 - head X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 05:21:58 -0000 Author: mckusick Date: Wed Aug 9 05:21:57 2017 New Revision: 322298 URL: https://svnweb.freebsd.org/changeset/base/322298 Log: Add an entry to UPDATING for r322297 which restores the ability of fsck to automatically find alternate superblocks when the standard one is trashed or unavailable. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11589 Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Aug 9 05:17:21 2017 (r322297) +++ head/UPDATING Wed Aug 9 05:21:57 2017 (r322298) @@ -51,6 +51,19 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20170808: + Since the switch to GPT disk labels, fsck for UFS/FFS has been + unable to automatically find alternate superblocks. As of r322297, + the information needed to find alternate superblocks has been + moved to the end of the area reserved for the boot block. + Filesystems created with a newfs of this vintage or later + will create the recovery information. If you have a filesystem + created prior to this change and wish to have a recovery block + created for your filesystem, you can do so by running fsck in + forground mode (i.e., do not use the -p or -y options). As it + starts, fsck will ask ``SAVE DATA TO FIND ALTERNATE SUPERBLOCKS'' + to which you should answer yes. + 20170728: As of r321665, an NFSv4 server configuration that services Kerberos mounts or clients that do not support the uid/gid in From owner-svn-src-head@freebsd.org Wed Aug 9 05:59:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4532DDC3A30; Wed, 9 Aug 2017 05:59:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00B29635C9; Wed, 9 Aug 2017 05:59:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v795xjN9027950; Wed, 9 Aug 2017 05:59:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v795xjbZ027948; Wed, 9 Aug 2017 05:59:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708090559.v795xjbZ027948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 9 Aug 2017 05:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322299 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 05:59:46 -0000 Author: sephe Date: Wed Aug 9 05:59:45 2017 New Revision: 322299 URL: https://svnweb.freebsd.org/changeset/base/322299 Log: hyperv/hn: Implement transparent mode network VF. How network VF works with hn(4) on Hyper-V in transparent mode: - Each network VF has a cooresponding hn(4). - The network VF and the it's cooresponding hn(4) have the same hardware address. - Once the network VF is attached, the cooresponding hn(4) waits several seconds to make sure that the network VF attach routing completes, then: o Set the intersection of the network VF's if_capabilities and the cooresponding hn(4)'s if_capabilities to the cooresponding hn(4)'s if_capabilities. And adjust the cooresponding hn(4) if_capable and if_hwassist accordingly. (*) o Make sure that the cooresponding hn(4)'s TSO parameters meet the constraints posed by both the network VF and the cooresponding hn(4). (*) o The network VF's if_input is overridden. The overriding if_input changes the input packet's rcvif to the cooreponding hn(4). The network layers are tricked into thinking that all packets are neceived by the cooresponding hn(4). o If the cooresponding hn(4) was brought up, bring up the network VF. The transmission dispatched to the cooresponding hn(4) are redispatched to the network VF. o Bringing down the cooresponding hn(4) also brings down the network VF. o All IOCTLs issued to the cooresponding hn(4) are pass-through'ed to the network VF; the cooresponding hn(4) changes its internal state if necessary. o The media status of the cooresponding hn(4) solely relies on the network VF. o If there are multicast filters on the cooresponding hn(4), allmulti will be enabled on the network VF. (**) - Once the network VF is detached. Undo all damages did to the cooresponding hn(4) in the above item. NOTE: No operation should be issued directly to the network VF, if the network VF transparent mode is enabled. The network VF transparent mode can be enabled by setting tunable hw.hn.vf_transparent to 1. The network VF transparent mode is _not_ enabled by default, as of this commit. The benefit of the network VF transparent mode is that the network VF attachment and detachment are transparent to all network layers; e.g. live migration detaches and reattaches the network VF. The major drawbacks of the network VF transparent mode: - The netmap(4) support is lost, even if the VF supports it. - ALTQ does not work, since if_start method cannot be properly supported. (*) These decisions were made so that things will not be messed up too much during the transition period. (**) This does _not_ need to go through the fancy multicast filter management stuffs like what vlan(4) has, at least currently: - As of this write, multicast does not work in Azure. - As of this write, multicast packets go through the cooresponding hn(4). MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11803 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnreg.h head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Aug 9 05:21:57 2017 (r322298) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Aug 9 05:59:45 2017 (r322299) @@ -123,6 +123,8 @@ __FBSDID("$FreeBSD$"); #define HN_VFMAP_SIZE_DEF 8 +#define HN_XPNT_VF_ATTWAIT_MIN 2 /* seconds */ + /* YYY should get it from the underlying channel */ #define HN_TX_DESC_CNT 512 @@ -263,6 +265,7 @@ static void hn_ifnet_event(void *, struct ifnet *, i static void hn_ifaddr_event(void *, struct ifnet *); static void hn_ifnet_attevent(void *, struct ifnet *); static void hn_ifnet_detevent(void *, struct ifnet *); +static void hn_ifnet_lnkevent(void *, struct ifnet *, int); static bool hn_ismyvf(const struct hn_softc *, const struct ifnet *); @@ -270,6 +273,15 @@ static void hn_rxvf_change(struct hn_softc *, struct ifnet *, bool); static void hn_rxvf_set(struct hn_softc *, struct ifnet *); static void hn_rxvf_set_task(void *, int); +static void hn_xpnt_vf_input(struct ifnet *, struct mbuf *); +static int hn_xpnt_vf_iocsetflags(struct hn_softc *); +static int hn_xpnt_vf_iocsetcaps(struct hn_softc *, + struct ifreq *); +static void hn_xpnt_vf_saveifflags(struct hn_softc *); +static bool hn_xpnt_vf_isready(struct hn_softc *); +static void hn_xpnt_vf_setready(struct hn_softc *); +static void hn_xpnt_vf_init_taskfunc(void *, int); +static void hn_xpnt_vf_init(struct hn_softc *); static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); @@ -322,6 +334,8 @@ static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vflist_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_xpnt_vf_accbpf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_xpnt_vf_enabled_sysctl(SYSCTL_HANDLER_ARGS); static void hn_stop(struct hn_softc *, bool); static void hn_init_locked(struct hn_softc *); @@ -352,6 +366,7 @@ static void hn_disable_rx(struct hn_softc *); static void hn_drain_rxtx(struct hn_softc *, int); static void hn_polling(struct hn_softc *, u_int); static void hn_chan_polling(struct vmbus_channel *, u_int); +static void hn_mtu_change_fixup(struct hn_softc *); static void hn_update_link_status(struct hn_softc *); static void hn_change_network(struct hn_softc *); @@ -529,6 +544,22 @@ SYSCTL_PROC(_hw_hn, OID_AUTO, vflist, CTLFLAG_RD | CTL SYSCTL_PROC(_hw_hn, OID_AUTO, vfmap, CTLFLAG_RD | CTLTYPE_STRING, 0, 0, hn_vfmap_sysctl, "A", "VF mapping"); +/* Transparent VF */ +static int hn_xpnt_vf = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_transparent, CTLFLAG_RDTUN, + &hn_xpnt_vf, 0, "Transparent VF mod"); + +/* Accurate BPF support for Transparent VF */ +static int hn_xpnt_vf_accbpf = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_xpnt_accbpf, CTLFLAG_RDTUN, + &hn_xpnt_vf_accbpf, 0, "Accurate BPF for transparent VF"); + +/* Extra wait for transparent VF attach routing; unit seconds. */ +static int hn_xpnt_vf_attwait = HN_XPNT_VF_ATTWAIT_MIN; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_xpnt_attwait, CTLFLAG_RWTUN, + &hn_xpnt_vf_attwait, 0, + "Extra wait for transparent VF attach routing; unit: seconds"); + static u_int hn_cpu_index; /* next CPU for channel */ static struct taskqueue **hn_tx_taskque;/* shared TX taskqueues */ @@ -807,8 +838,12 @@ hn_rxfilter_config(struct hn_softc *sc) HN_LOCK_ASSERT(sc); - if ((ifp->if_flags & IFF_PROMISC) || - (sc->hn_flags & HN_FLAG_RXVF)) { + /* + * If the non-transparent mode VF is activated, we don't know how + * its RX filter is configured, so stick the synthetic device in + * the promiscous mode. + */ + if ((ifp->if_flags & IFF_PROMISC) || (sc->hn_flags & HN_FLAG_RXVF)) { filter = NDIS_PACKET_TYPE_PROMISCUOUS; } else { filter = NDIS_PACKET_TYPE_DIRECTED; @@ -1086,7 +1121,7 @@ hn_rxvf_change(struct hn_softc *sc, struct ifnet *ifp, } hn_nvs_set_datapath(sc, - rxvf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTHETIC); + rxvf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTH); hn_rxvf_set(sc, rxvf ? ifp : NULL); @@ -1126,7 +1161,323 @@ hn_ifaddr_event(void *arg, struct ifnet *ifp) hn_rxvf_change(arg, ifp, ifp->if_flags & IFF_UP); } +static int +hn_xpnt_vf_iocsetcaps(struct hn_softc *sc, struct ifreq *ifr) +{ + struct ifnet *ifp, *vf_ifp; + uint64_t tmp; + int error; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + vf_ifp = sc->hn_vf_ifp; + + /* + * Fix up requested capabilities w/ supported capabilities, + * since the supported capabilities could have been changed. + */ + ifr->ifr_reqcap &= ifp->if_capabilities; + /* Pass SIOCSIFCAP to VF. */ + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFCAP, (caddr_t)ifr); + + /* + * NOTE: + * The error will be propagated to the callers, however, it + * is _not_ useful here. + */ + + /* + * Merge VF's enabled capabilities. + */ + ifp->if_capenable = vf_ifp->if_capenable & ifp->if_capabilities; + + tmp = vf_ifp->if_hwassist & HN_CSUM_IP_HWASSIST(sc); + if (ifp->if_capenable & IFCAP_TXCSUM) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & HN_CSUM_IP6_HWASSIST(sc); + if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & CSUM_IP_TSO; + if (ifp->if_capenable & IFCAP_TSO4) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & CSUM_IP6_TSO; + if (ifp->if_capenable & IFCAP_TSO6) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + return (error); +} + +static int +hn_xpnt_vf_iocsetflags(struct hn_softc *sc) +{ + struct ifnet *vf_ifp; + struct ifreq ifr; + + HN_LOCK_ASSERT(sc); + vf_ifp = sc->hn_vf_ifp; + + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_flags = vf_ifp->if_flags & 0xffff; + ifr.ifr_flagshigh = vf_ifp->if_flags >> 16; + return (vf_ifp->if_ioctl(vf_ifp, SIOCSIFFLAGS, (caddr_t)&ifr)); +} + static void +hn_xpnt_vf_saveifflags(struct hn_softc *sc) +{ + struct ifnet *ifp = sc->hn_ifp; + int allmulti = 0; + + HN_LOCK_ASSERT(sc); + + /* XXX vlan(4) style mcast addr maintenance */ + if (!TAILQ_EMPTY(&ifp->if_multiaddrs)) + allmulti = IFF_ALLMULTI; + + /* Always set the VF's if_flags */ + sc->hn_vf_ifp->if_flags = ifp->if_flags | allmulti; +} + +static void +hn_xpnt_vf_input(struct ifnet *vf_ifp, struct mbuf *m) +{ + struct rm_priotracker pt; + struct ifnet *hn_ifp = NULL; + struct mbuf *mn; + + /* + * XXX racy, if hn(4) ever detached. + */ + rm_rlock(&hn_vfmap_lock, &pt); + if (vf_ifp->if_index < hn_vfmap_size) + hn_ifp = hn_vfmap[vf_ifp->if_index]; + rm_runlock(&hn_vfmap_lock, &pt); + + if (hn_ifp != NULL) { + /* + * Fix up rcvif and go through hn(4)'s if_input and + * increase ipackets. + */ + for (mn = m; mn != NULL; mn = mn->m_nextpkt) { + /* Allow tapping on the VF. */ + ETHER_BPF_MTAP(vf_ifp, mn); + mn->m_pkthdr.rcvif = hn_ifp; + if_inc_counter(hn_ifp, IFCOUNTER_IPACKETS, 1); + } + hn_ifp->if_input(hn_ifp, m); + } else { + /* + * In the middle of the transition; free this + * mbuf chain. + */ + while (m != NULL) { + mn = m->m_nextpkt; + m->m_nextpkt = NULL; + m_freem(m); + m = mn; + } + } +} + +static void +hn_mtu_change_fixup(struct hn_softc *sc) +{ + struct ifnet *ifp; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + + hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu); +#if __FreeBSD_version >= 1100099 + if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < HN_LRO_LENLIM_MIN(ifp)) + hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); +#endif +} + +static void +hn_xpnt_vf_setready(struct hn_softc *sc) +{ + struct ifnet *ifp, *vf_ifp; + struct ifreq ifr; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + vf_ifp = sc->hn_vf_ifp; + + /* + * Mark the VF ready. + */ + sc->hn_vf_rdytick = 0; + + /* + * Save information for restoration. + */ + sc->hn_saved_caps = ifp->if_capabilities; + sc->hn_saved_tsomax = ifp->if_hw_tsomax; + sc->hn_saved_tsosegcnt = ifp->if_hw_tsomaxsegcount; + sc->hn_saved_tsosegsz = ifp->if_hw_tsomaxsegsize; + + /* + * Intersect supported/enabled capabilities. + * + * NOTE: + * if_hwassist is not changed here. + */ + ifp->if_capabilities &= vf_ifp->if_capabilities; + ifp->if_capenable &= ifp->if_capabilities; + + /* + * Fix TSO settings. + */ + if (ifp->if_hw_tsomax > vf_ifp->if_hw_tsomax) + ifp->if_hw_tsomax = vf_ifp->if_hw_tsomax; + if (ifp->if_hw_tsomaxsegcount > vf_ifp->if_hw_tsomaxsegcount) + ifp->if_hw_tsomaxsegcount = vf_ifp->if_hw_tsomaxsegcount; + if (ifp->if_hw_tsomaxsegsize > vf_ifp->if_hw_tsomaxsegsize) + ifp->if_hw_tsomaxsegsize = vf_ifp->if_hw_tsomaxsegsize; + + /* + * Change VF's enabled capabilities. + */ + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_reqcap = ifp->if_capenable; + hn_xpnt_vf_iocsetcaps(sc, &ifr); + + if (ifp->if_mtu != ETHERMTU) { + int error; + + /* + * Change VF's MTU. + */ + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_mtu = ifp->if_mtu; + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFMTU, (caddr_t)&ifr); + if (error) { + if_printf(ifp, "%s SIOCSIFMTU %u failed\n", + vf_ifp->if_xname, ifp->if_mtu); + if (ifp->if_mtu > ETHERMTU) { + if_printf(ifp, "change MTU to %d\n", ETHERMTU); + + /* + * XXX + * No need to adjust the synthetic parts' MTU; + * failure of the adjustment will cause us + * infinite headache. + */ + ifp->if_mtu = ETHERMTU; + hn_mtu_change_fixup(sc); + } + } + } +} + +static bool +hn_xpnt_vf_isready(struct hn_softc *sc) +{ + + HN_LOCK_ASSERT(sc); + + if (!hn_xpnt_vf || sc->hn_vf_ifp == NULL) + return (false); + + if (sc->hn_vf_rdytick == 0) + return (true); + + if (sc->hn_vf_rdytick > ticks) + return (false); + + /* Mark VF as ready. */ + hn_xpnt_vf_setready(sc); + return (true); +} + +static void +hn_xpnt_vf_init(struct hn_softc *sc) +{ + int error; + + HN_LOCK_ASSERT(sc); + + KASSERT((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) == 0, + ("%s: transparent VF was enabled", sc->hn_ifp->if_xname)); + + if (bootverbose) { + if_printf(sc->hn_ifp, "try bringing up %s\n", + sc->hn_vf_ifp->if_xname); + } + + /* + * Bring the VF up. + */ + hn_xpnt_vf_saveifflags(sc); + sc->hn_vf_ifp->if_flags |= IFF_UP; + error = hn_xpnt_vf_iocsetflags(sc); + if (error) { + if_printf(sc->hn_ifp, "bringing up %s failed: %d\n", + sc->hn_vf_ifp->if_xname, error); + return; + } + + /* + * NOTE: + * Datapath setting must happen _after_ bringing the VF up. + */ + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_VF); + + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + sc->hn_xvf_flags |= HN_XVFFLAG_ENABLED; + rm_wunlock(&sc->hn_vf_lock); +} + +static void +hn_xpnt_vf_init_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + HN_LOCK(sc); + + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) + goto done; + if (sc->hn_vf_ifp == NULL) + goto done; + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + goto done; + + if (sc->hn_vf_rdytick != 0) { + /* Mark VF as ready. */ + hn_xpnt_vf_setready(sc); + } + + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* + * Delayed VF initialization. + */ + if (bootverbose) { + if_printf(sc->hn_ifp, "delayed initialize %s\n", + sc->hn_vf_ifp->if_xname); + } + hn_xpnt_vf_init(sc); + } +done: + HN_UNLOCK(sc); +} + +static void hn_ifnet_attevent(void *xsc, struct ifnet *ifp) { struct hn_softc *sc = xsc; @@ -1145,6 +1496,16 @@ hn_ifnet_attevent(void *xsc, struct ifnet *ifp) goto done; } + if (hn_xpnt_vf && ifp->if_start != NULL) { + /* + * ifnet.if_start is _not_ supported by transparent + * mode VF; mainly due to the IFF_DRV_OACTIVE flag. + */ + if_printf(sc->hn_ifp, "%s uses if_start, which is unsupported " + "in transparent VF mode.\n", ifp->if_xname); + goto done; + } + rm_wlock(&hn_vfmap_lock); if (ifp->if_index >= hn_vfmap_size) { @@ -1168,7 +1529,37 @@ hn_ifnet_attevent(void *xsc, struct ifnet *ifp) rm_wunlock(&hn_vfmap_lock); + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + KASSERT((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) == 0, + ("%s: transparent VF was enabled", sc->hn_ifp->if_xname)); sc->hn_vf_ifp = ifp; + rm_wunlock(&sc->hn_vf_lock); + + if (hn_xpnt_vf) { + int wait_ticks; + + /* + * Install if_input for vf_ifp, which does vf_ifp -> hn_ifp. + * Save vf_ifp's current if_input for later restoration. + */ + sc->hn_vf_input = ifp->if_input; + ifp->if_input = hn_xpnt_vf_input; + + /* + * Stop link status management; use the VF's. + */ + hn_suspend_mgmt(sc); + + /* + * Give VF sometime to complete its attach routing. + */ + wait_ticks = hn_xpnt_vf_attwait * hz; + sc->hn_vf_rdytick = ticks + wait_ticks; + + taskqueue_enqueue_timeout(sc->hn_vf_taskq, &sc->hn_vf_init, + wait_ticks); + } done: HN_UNLOCK(sc); } @@ -1186,7 +1577,61 @@ hn_ifnet_detevent(void *xsc, struct ifnet *ifp) if (!hn_ismyvf(sc, ifp)) goto done; + if (hn_xpnt_vf) { + /* + * Make sure that the delayed initialization is not running. + * + * NOTE: + * - This lock _must_ be released, since the hn_vf_init task + * will try holding this lock. + * - It is safe to release this lock here, since the + * hn_ifnet_attevent() is interlocked by the hn_vf_ifp. + * + * XXX racy, if hn(4) ever detached. + */ + HN_UNLOCK(sc); + taskqueue_drain_timeout(sc->hn_vf_taskq, &sc->hn_vf_init); + HN_LOCK(sc); + + KASSERT(sc->hn_vf_input != NULL, ("%s VF input is not saved", + sc->hn_ifp->if_xname)); + ifp->if_input = sc->hn_vf_input; + sc->hn_vf_input = NULL; + + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_SYNTH); + + if (sc->hn_vf_rdytick == 0) { + /* + * The VF was ready; restore some settings. + */ + sc->hn_ifp->if_capabilities = sc->hn_saved_caps; + /* + * NOTE: + * There is _no_ need to fixup if_capenable and + * if_hwassist, since the if_capabilities before + * restoration was an intersection of the VF's + * if_capabilites and the synthetic device's + * if_capabilites. + */ + sc->hn_ifp->if_hw_tsomax = sc->hn_saved_tsomax; + sc->hn_ifp->if_hw_tsomaxsegcount = + sc->hn_saved_tsosegcnt; + sc->hn_ifp->if_hw_tsomaxsegsize = sc->hn_saved_tsosegsz; + } + + /* + * Resume link status management, which was suspended + * by hn_ifnet_attevent(). + */ + hn_resume_mgmt(sc); + } + + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + sc->hn_xvf_flags &= ~HN_XVFFLAG_ENABLED; sc->hn_vf_ifp = NULL; + rm_wunlock(&sc->hn_vf_lock); rm_wlock(&hn_vfmap_lock); @@ -1205,6 +1650,15 @@ done: HN_UNLOCK(sc); } +static void +hn_ifnet_lnkevent(void *xsc, struct ifnet *ifp, int link_state) +{ + struct hn_softc *sc = xsc; + + if (sc->hn_vf_ifp == ifp) + if_link_state_change(sc->hn_ifp, link_state); +} + /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ static const struct hyperv_guid g_net_vsc_device_type = { .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, @@ -1236,6 +1690,9 @@ hn_attach(device_t dev) sc->hn_dev = dev; sc->hn_prichan = vmbus_get_channel(dev); HN_LOCK_INIT(sc); + rm_init(&sc->hn_vf_lock, "hnvf"); + if (hn_xpnt_vf && hn_xpnt_vf_accbpf) + sc->hn_xvf_flags |= HN_XVFFLAG_ACCBPF; /* * Initialize these tunables once. @@ -1275,6 +1732,18 @@ hn_attach(device_t dev) TIMEOUT_TASK_INIT(sc->hn_mgmt_taskq0, &sc->hn_netchg_status, 0, hn_netchg_status_taskfunc, sc); + if (hn_xpnt_vf) { + /* + * Setup taskqueue for VF tasks, e.g. delayed VF bringing up. + */ + sc->hn_vf_taskq = taskqueue_create("hn_vf", M_WAITOK, + taskqueue_thread_enqueue, &sc->hn_vf_taskq); + taskqueue_start_threads(&sc->hn_vf_taskq, 1, PI_NET, "%s vf", + device_get_nameunit(dev)); + TIMEOUT_TASK_INIT(sc->hn_vf_taskq, &sc->hn_vf_init, 0, + hn_xpnt_vf_init_taskfunc, sc); + } + /* * Allocate ifnet and setup its name earlier, so that if_printf * can be used by functions, which will be called after @@ -1401,6 +1870,14 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "hwassist", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_hwassist_sysctl, "A", "hwassist"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_max", + CTLFLAG_RD, &ifp->if_hw_tsomax, 0, "max TSO size"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_maxsegcnt", + CTLFLAG_RD, &ifp->if_hw_tsomaxsegcount, 0, + "max # of TSO segments"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_maxsegsz", + CTLFLAG_RD, &ifp->if_hw_tsomaxsegsize, 0, + "max size of TSO segment"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_rxfilter_sysctl, "A", "rxfilter"); @@ -1445,9 +1922,20 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_vf_sysctl, "A", "Virtual Function's name"); - SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, - hn_rxvf_sysctl, "A", "activated Virtual Function's name"); + if (!hn_xpnt_vf) { + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxvf_sysctl, "A", "activated Virtual Function's name"); + } else { + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf_xpnt_enabled", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_xpnt_vf_enabled_sysctl, "I", + "Transparent VF enabled"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf_xpnt_accbpf", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_xpnt_vf_accbpf_sysctl, "I", + "Accurate BPF for transparent VF"); + } /* * Setup the ifmedia, which has been initialized earlier. @@ -1480,7 +1968,7 @@ hn_attach(device_t dev) ifp->if_qflush = hn_xmit_qflush; } - ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_LRO; + ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_LRO | IFCAP_LINKSTATE; #ifdef foo /* We can't diff IPv6 packets from IPv4 packets on RX path. */ ifp->if_capabilities |= IFCAP_RXCSUM_IPV6; @@ -1515,7 +2003,13 @@ hn_attach(device_t dev) ifp->if_hwassist &= ~(HN_CSUM_IP6_MASK | CSUM_IP6_TSO); if (ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) { + /* + * Lock hn_set_tso_maxsize() to simplify its + * internal logic. + */ + HN_LOCK(sc); hn_set_tso_maxsize(sc, hn_tso_maxlen, ETHERMTU); + HN_UNLOCK(sc); ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX; ifp->if_hw_tsomaxsegsize = PAGE_SIZE; } @@ -1536,10 +2030,15 @@ hn_attach(device_t dev) sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; hn_update_link_status(sc); - sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, - hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); - sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, - hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + if (!hn_xpnt_vf) { + sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, + hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); + sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, + hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + } else { + sc->hn_ifnet_lnkhand = EVENTHANDLER_REGISTER(ifnet_link_event, + hn_ifnet_lnkevent, sc, EVENTHANDLER_PRI_ANY); + } /* * NOTE: @@ -1566,6 +2065,14 @@ hn_detach(device_t dev) struct hn_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->hn_ifp, *vf_ifp; + if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { + /* + * In case that the vmbus missed the orphan handler + * installation. + */ + vmbus_xact_ctx_orphan(sc->hn_xact); + } + if (sc->hn_ifaddr_evthand != NULL) EVENTHANDLER_DEREGISTER(ifaddr_event, sc->hn_ifaddr_evthand); if (sc->hn_ifnet_evthand != NULL) @@ -1578,20 +2085,14 @@ hn_detach(device_t dev) EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->hn_ifnet_dethand); } + if (sc->hn_ifnet_lnkhand != NULL) + EVENTHANDLER_DEREGISTER(ifnet_link_event, sc->hn_ifnet_lnkhand); vf_ifp = sc->hn_vf_ifp; __compiler_membar(); if (vf_ifp != NULL) hn_ifnet_detevent(sc, vf_ifp); - if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { - /* - * In case that the vmbus missed the orphan handler - * installation. - */ - vmbus_xact_ctx_orphan(sc->hn_xact); - } - if (device_is_attached(dev)) { HN_LOCK(sc); if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) { @@ -1621,6 +2122,8 @@ hn_detach(device_t dev) free(sc->hn_tx_taskqs, M_DEVBUF); } taskqueue_free(sc->hn_mgmt_taskq0); + if (sc->hn_vf_taskq != NULL) + taskqueue_free(sc->hn_vf_taskq); if (sc->hn_xact != NULL) { /* @@ -1634,6 +2137,7 @@ hn_detach(device_t dev) if_free(ifp); HN_LOCK_DESTROY(sc); + rm_destroy(&sc->hn_vf_lock); return (0); } @@ -2699,7 +3203,8 @@ static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct hn_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; + struct ifreq *ifr = (struct ifreq *)data, ifr_vf; + struct ifnet *vf_ifp; int mask, error = 0; switch (cmd) { @@ -2728,6 +3233,21 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } + if (hn_xpnt_vf_isready(sc)) { + vf_ifp = sc->hn_vf_ifp; + ifr_vf = *ifr; + strlcpy(ifr_vf.ifr_name, vf_ifp->if_xname, + sizeof(ifr_vf.ifr_name)); + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFMTU, + (caddr_t)&ifr_vf); + if (error) { + HN_UNLOCK(sc); + if_printf(ifp, "%s SIOCSIFMTU %d failed: %d\n", + vf_ifp->if_xname, ifr->ifr_mtu, error); + break; + } + } + /* * Suspend this interface before the synthetic parts * are ripped. @@ -2756,23 +3276,32 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_mtu = ifr->ifr_mtu; /* - * Make sure that various parameters based on MTU are - * still valid, after the MTU change. + * Synthetic parts' reattach may change the chimney + * sending size; update it. */ if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); - hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu); -#if __FreeBSD_version >= 1100099 - if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < - HN_LRO_LENLIM_MIN(ifp)) - hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); -#endif /* + * Make sure that various parameters based on MTU are + * still valid, after the MTU change. + */ + hn_mtu_change_fixup(sc); + + /* * All done! Resume the interface now. */ hn_resume(sc); + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) { + /* + * Since we have reattached the NVS part, + * change the datapath to VF again; in case + * that it is lost, after the NVS was detached. + */ + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_VF); + } + HN_UNLOCK(sc); break; @@ -2784,6 +3313,9 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } + if (hn_xpnt_vf_isready(sc)) + hn_xpnt_vf_saveifflags(sc); + if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* @@ -2794,6 +3326,9 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) HN_NO_SLEEPING(sc); hn_rxfilter_config(sc); HN_SLEEPING_OK(sc); + + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + error = hn_xpnt_vf_iocsetflags(sc); } else { hn_init_locked(sc); } @@ -2808,8 +3343,23 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFCAP: HN_LOCK(sc); - mask = ifr->ifr_reqcap ^ ifp->if_capenable; + if (hn_xpnt_vf_isready(sc)) { + ifr_vf = *ifr; + strlcpy(ifr_vf.ifr_name, sc->hn_vf_ifp->if_xname, + sizeof(ifr_vf.ifr_name)); + error = hn_xpnt_vf_iocsetcaps(sc, &ifr_vf); + HN_UNLOCK(sc); + break; + } + + /* + * Fix up requested capabilities w/ supported capabilities, + * since the supported capabilities could have been changed. + */ + mask = (ifr->ifr_reqcap & ifp->if_capabilities) ^ + ifp->if_capenable; + if (mask & IFCAP_TXCSUM) { ifp->if_capenable ^= IFCAP_TXCSUM; if (ifp->if_capenable & IFCAP_TXCSUM) @@ -2873,11 +3423,42 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) HN_SLEEPING_OK(sc); } + /* XXX vlan(4) style mcast addr maintenance */ + if (hn_xpnt_vf_isready(sc)) { + int old_if_flags; + + old_if_flags = sc->hn_vf_ifp->if_flags; + hn_xpnt_vf_saveifflags(sc); + + if ((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) && + ((old_if_flags ^ sc->hn_vf_ifp->if_flags) & + IFF_ALLMULTI)) + error = hn_xpnt_vf_iocsetflags(sc); + } + HN_UNLOCK(sc); break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: + HN_LOCK(sc); + if (hn_xpnt_vf_isready(sc)) { + /* + * SIOCGIFMEDIA expects ifmediareq, so don't + * create and pass ifr_vf to the VF here; just + * replace the ifr_name. + */ + vf_ifp = sc->hn_vf_ifp; + strlcpy(ifr->ifr_name, vf_ifp->if_xname, + sizeof(ifr->ifr_name)); + error = vf_ifp->if_ioctl(vf_ifp, cmd, data); + /* Restore the ifr_name. */ + strlcpy(ifr->ifr_name, ifp->if_xname, + sizeof(ifr->ifr_name)); + HN_UNLOCK(sc); + break; + } + HN_UNLOCK(sc); error = ifmedia_ioctl(ifp, ifr, &sc->hn_media, cmd); break; @@ -2899,11 +3480,37 @@ hn_stop(struct hn_softc *sc, bool detaching) KASSERT(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED, ("synthetic parts were not attached")); + /* Clear RUNNING bit ASAP. */ + atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); + /* Disable polling. */ hn_polling(sc, 0); - /* Clear RUNNING bit _before_ hn_suspend_data() */ - atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) { + KASSERT(sc->hn_vf_ifp != NULL, + ("%s: VF is not attached", ifp->if_xname)); + + /* NOTE: hn_vf_lock for hn_transmit() */ + rm_wlock(&sc->hn_vf_lock); + sc->hn_xvf_flags &= ~HN_XVFFLAG_ENABLED; + rm_wunlock(&sc->hn_vf_lock); + + /* + * NOTE: + * Datapath setting must happen _before_ bringing + * the VF down. + */ + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_SYNTH); + + /* + * Bring the VF down. + */ + hn_xpnt_vf_saveifflags(sc); + sc->hn_vf_ifp->if_flags &= ~IFF_UP; + hn_xpnt_vf_iocsetflags(sc); + } + + /* Suspend data transfers. */ hn_suspend_data(sc); /* Clear OACTIVE bit. */ @@ -2912,8 +3519,8 @@ hn_stop(struct hn_softc *sc, bool detaching) sc->hn_tx_ring[i].hn_oactive = 0; /* - * If the VF is active, make sure the filter is not 0, even if - * the synthetic NIC is down. + * If the non-transparent mode VF is active, make sure + * that the RX filter still allows packet reception. */ if (!detaching && (sc->hn_flags & HN_FLAG_RXVF)) hn_rxfilter_config(sc); @@ -2944,6 +3551,11 @@ hn_init_locked(struct hn_softc *sc) /* Clear TX 'suspended' bit. */ hn_resume_tx(sc, sc->hn_tx_ring_inuse); + if (hn_xpnt_vf_isready(sc)) { + /* Initialize transparent VF. */ + hn_xpnt_vf_init(sc); + } + /* Everything is ready; unleash! */ atomic_set_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); @@ -3567,6 +4179,42 @@ hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_xpnt_vf_accbpf_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int error, onoff = 0; + + if (sc->hn_xvf_flags & HN_XVFFLAG_ACCBPF) + onoff = 1; + error = sysctl_handle_int(oidp, &onoff, 0, req); + if (error || req->newptr == NULL) + return (error); + + HN_LOCK(sc); + /* NOTE: hn_vf_lock for hn_transmit() */ + rm_wlock(&sc->hn_vf_lock); + if (onoff) + sc->hn_xvf_flags |= HN_XVFFLAG_ACCBPF; + else + sc->hn_xvf_flags &= ~HN_XVFFLAG_ACCBPF; + rm_wunlock(&sc->hn_vf_lock); + HN_UNLOCK(sc); + + return (0); +} + +static int +hn_xpnt_vf_enabled_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int enabled = 0; + + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + enabled = 1; + return (sysctl_handle_int(oidp, &enabled, 0, req)); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; @@ -4282,8 +4930,11 @@ static void hn_set_tso_maxsize(struct hn_softc *sc, int tso_maxlen, int mtu) { struct ifnet *ifp = sc->hn_ifp; + u_int hw_tsomax; int tso_minlen; + HN_LOCK_ASSERT(sc); + if ((ifp->if_capabilities & (IFCAP_TSO4 | IFCAP_TSO6)) == 0) return; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Aug 9 07:05:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C69EDC4C25; Wed, 9 Aug 2017 07:05:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 2A99765100; Wed, 9 Aug 2017 07:05:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 9DDA7D6709B; Wed, 9 Aug 2017 17:05:16 +1000 (AEST) Date: Wed, 9 Aug 2017 17:05:09 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alan Somers cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322258 - head/sys/kern In-Reply-To: <201708081614.v78GEVGY066448@repo.freebsd.org> Message-ID: <20170809141608.I1096@besplex.bde.org> References: <201708081614.v78GEVGY066448@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=oIpZr1xkWgYFOLge9vcA:9 a=ryAa0PDDeZGzOGob:21 a=tOHjCrgPa2CUQTTv:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 07:05:30 -0000 On Tue, 8 Aug 2017, Alan Somers wrote: > Log: > Make p1003_1b.aio_listio_max a tunable > > p1003_1b.aio_listio_max is now a tunable. Its value is reflected in the > sysctl of the same name, and the sysconf(3) variable _SC_AIO_LISTIO_MAX. > Its value will be bounded from below by the compile-time constant > AIO_LISTIO_MAX and from above by the compile-time constant > MAX_AIO_QUEUE_PER_PROC and the tunable vfs.aio.max_aio_queue. I don't like tunables or sysctls being limited or silently limiting them. This is not done for more important sysctls like kern.maxfilesperproc. Lots of silent runtime limiting is done for a few more important limits like kern.maxfilesperproc. The limiting is also buggy: - vfs.aio.max_aio_queue isn't a tunable as stated. It is a r/w sysctl - if vfs.aio.max_aio_queue were a r/o tunable, then there would be a solvable ordering problem initializing it before using it - since vfs.aio.max_aio_queue is only a sysctl, it is unusable at boot time (and module load time), but it is used there. Other bugs in vfs.aio.max_aio_queue: - its name is too long, yet not very descriptive - its name repeats "aio" - its name but doesn't say "len", so it looks like it limits a number of queues and not the length of a single queue. This is backwards relative to the corresponding variable name. That is missing "aio" when it is needed, but only spells "length" badly as "count". It is max_queue_count, but should be something like aio_max_qlen. All sysctl variables should have an aio_ prefix which is removed in the leaf name in the sysctl tree. Other names have similar or worse bugs. Bugs start with parameter names MAX_AIO_* instead of AIO_*_MAX, and variable names track this. There is some ambiguity from global vs per-process limits and counts, and the noise word "num" is sprinkled to get names which differ without describing any difference. > Modified: head/sys/kern/vfs_aio.c > ============================================================================== > --- head/sys/kern/vfs_aio.c Tue Aug 8 16:06:16 2017 (r322257) > +++ head/sys/kern/vfs_aio.c Tue Aug 8 16:14:31 2017 (r322258) > @@ -102,6 +102,7 @@ static uint64_t jobseqno; > #endif > > FEATURE(aio, "Asynchronous I/O"); > +SYSCTL_DECL(_p1003_1b); > > static MALLOC_DEFINE(M_LIO, "lio", "listio aio control block list"); > > @@ -168,6 +169,11 @@ static int max_buf_aio = MAX_BUF_AIO; > SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0, > "Maximum buf aio requests per process (stored in the process)"); > > +static int aio_listio_max = AIO_LISTIO_MAX; > +SYSCTL_INT(_p1003_1b, CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max, > + CTLFLAG_RDTUN | CTLFLAG_CAPRD, &aio_listio_max, 0, > + "Maximum aio requests for a single lio_listio call"); > + The POSIX namespace is missing all of the bugs described above. It has aio first (except, for historical reasons it unfortunately has p10031b instead of vfs.aio for the sysctl prefix), and max last. > #ifdef COMPAT_FREEBSD6 > typedef struct oaiocb { > int aio_fildes; /* File descriptor */ > @@ -388,6 +394,11 @@ static int > aio_onceonly(void) > { > > + if (aio_listio_max < AIO_LISTIO_MAX) > + aio_listio_max = AIO_LISTIO_MAX; > + if (aio_listio_max > MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count)) > + aio_listio_max = MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count); > + max_queue_count is not initialized here, except to a default at compile time. Except for module (re)load, it always has the default value MAX_AIO_QUEUE = 1024 (this 1024 is bogusly ifdefed. MAX_AIO_QUEUE is not defined in any header file and is not a supported option, and the tunable makes the option less needed than before). MAX_AIO_QUEUE_PER_PROC = 256, modulo a similar unsupported option. Thus MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count) is an obfuscated spelling of 256. MAX_AIO_QUEUE_PER_PROC is also just the default for a variable (max_aio_queue_per_proc), so using it here has the same bugs except for the obfuscation. Using MIN() instead of imin() is a style bug. OTOH, AIO_LISTIO_MAX is defined (as 16) in a header file, and is not bogusly ifdefed. It is 1 of 3 aio limits specified by POSIX. The checking would be buggy if it were done later, since max_queue_count is not checked and limiting to it can corrupt aio_listio_max (when it is negative or just too small). The compile-time definition of AIO_LISTIO_MAX seems to be broken. I think POSIX species that AIO_LISTIO_MAX shall not be defined if the value of {AIO_LISTIO_MAX} varies at runtime, but it is still defined. FreeBSD has this bug for many other sysconf() variables, e.g., {OPEN_MAX}. Perhaps AIO_LISTIO_MAX is easier to fix since it is not hard-coded as often as OPEN_MAX. AIO_LISTIO_MAX is now just the FreeBSD default, but the first check in the above restricts {AIO_LISTIO_MAX} to this default (16) instead of to the POSIX limit of _POSIX_IO_LISTIO_MAX (2). Relaxing this check would cause more problems with hard-coded AIO_LISTIO_MAX. If the second check in the above were done at runtime so that it worked for changed max_queue_count, then it would reduce aio_listio_max below the POSIX limit of 2 slightly before it reduces to garbage zero and negative values. The first check should be large, or if you want to give a preference for >= the old limit of 16 and a hard limit of the POSIX limit of 2, check keep checking the old limit first and the POSIX limit last. > exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL, > EVENTHANDLER_PRI_ANY); > exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown_exec, > @@ -405,14 +416,13 @@ aio_onceonly(void) > NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); > aiocb_zone = uma_zcreate("AIOCB", sizeof(struct kaiocb), NULL, NULL, > NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); > - aiol_zone = uma_zcreate("AIOL", AIO_LISTIO_MAX*sizeof(intptr_t) , NULL, > - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); > + aiol_zone = uma_zcreate("AIOL", aio_listio_max * sizeof(intptr_t) , > + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); Allocations like this are hard to adjust later (I forget if the size limit is hard or soft, but it should be hard). The user must be allowed to set aio_listio_max to value larger than the default, so as to prepare for expansion of the other limits later. However, this doesn't work, since it leaves the other limits inconsistent until they are expanded. It seems best to adjust all the other limits based on the aio_listio_max tunable. Usually this is not set. Use the old parameters then, but remove all the macros and compile-time initializers for them. Do onceonly initialization like if (aio_listio_max == 16) { max_queue_count = 1024; /* historical MAX_AIO_QUEUE */ ... } When aio_listio_max != 16, calculate the parameters somehow. I don't know how to do this. At least make them consistent. After initialization, the other parameters are still restricted by the choice for aio_listio_max. Leave it to the user to not choose bad combinations. The aio sysctls seem to already break many of the POSIX sysctls. E.g., MAX_AIO_QUEUE is used as the default for the r/w sysctl vfs.aio.max_aio_queue and as the value for the sysctl r/o sysctl p1003_1b.aio_max. Any change to the first sysctl breaks the second sysctl. The 3 POSIX (2001) aio sysctls thus have quite different invariance bugs: - {AIO_MAX}: AIO_MAX is correctly not defined. {AIO_MAX} is variable by a low-level sysctl but the p1003 sysctl used to report {AIO_MAX} doesn't see the change. - {AIO_PRIO_DELTA_MAX}: no low-level sysctl or variable to break it (value is always 0) - {AIO_LISTIO_MAX}: was constant until this commit. There is not low-level sysctl for it, and the low-level variable for it is correctly exported, but AIO_LISTIO_MAX was incorrectly defined so it is hard to change now. {AIO_LISTIO_MAX} is inconsistent with the macro whenever the tunable is used to change its default. Bruce From owner-svn-src-head@freebsd.org Wed Aug 9 07:24:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8CFDDC5369; Wed, 9 Aug 2017 07:24:59 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0E0B65B97; Wed, 9 Aug 2017 07:24:59 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v797OwCl064446; Wed, 9 Aug 2017 07:24:58 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v797OwJb064445; Wed, 9 Aug 2017 07:24:58 GMT (envelope-from des@FreeBSD.org) Message-Id: <201708090724.v797OwJb064445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Wed, 9 Aug 2017 07:24:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322300 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: des X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 322300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 07:25:00 -0000 Author: des Date: Wed Aug 9 07:24:58 2017 New Revision: 322300 URL: https://svnweb.freebsd.org/changeset/base/322300 Log: Correct sysctl names. Modified: head/sys/netinet/in.h Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Wed Aug 9 05:59:45 2017 (r322299) +++ head/sys/netinet/in.h Wed Aug 9 07:24:58 2017 (r322300) @@ -289,7 +289,7 @@ __END_DECLS * if you trust the remote host to restrict these ports. * * The default range of ports and the high range can be changed by - * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto) + * sysctl(3). (net.inet.ip.portrange.{hi,low,}{first,last}) * * Changing those values has bad security implications if you are * using a stateless firewall that is allowing packets outside of that From owner-svn-src-head@freebsd.org Wed Aug 9 08:44:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24966DC6D7D; Wed, 9 Aug 2017 08:44:23 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id C7FB36858C; Wed, 9 Aug 2017 08:44:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 6A3EB3CCF6C; Wed, 9 Aug 2017 18:44:19 +1000 (AEST) Date: Wed, 9 Aug 2017 18:44:19 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Emmanuel Vadot cc: Bruce Evans , Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322252 - head/usr.bin/vmstat In-Reply-To: <20170808161507.2d185d394dc921eac6729d89@bidouilliste.com> Message-ID: <20170809171526.B1567@besplex.bde.org> References: <201708081218.v78CIBvL068413@repo.freebsd.org> <20170808225104.I3528@besplex.bde.org> <20170808161507.2d185d394dc921eac6729d89@bidouilliste.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=LI0WeNe9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=Q9sN3FMeAAAA:8 a=3W0Di7-B9xzAe2TjPFYA:9 a=4JXGKAPf0pKDMlew:21 a=AfNcCDu4C7j3jd7Y:21 a=CjuIK1q_8ugA:10 a=mnDzqiP7QBHErLppGYsC:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 08:44:23 -0000 On Tue, 8 Aug 2017, Emmanuel Vadot wrote: > On Tue, 8 Aug 2017 23:55:52 +1000 (EST) > Bruce Evans wrote: > >> On Tue, 8 Aug 2017, Emmanuel Vadot wrote: >> >>> Log: >>> vmstat: Always emit a space after the free-memory column >>> >>> When displaying in non-human form, if the free-memory number >>> is large (more than 7 digits), there is no space between it and >>> the page fault column. >>> >>> PR: 221290 >>> Submitted by: Josuah Demangeon (Original version) >>> >>> Modified: >>> head/usr.bin/vmstat/vmstat.c >>> >>> Modified: head/usr.bin/vmstat/vmstat.c >>> ============================================================================== >>> --- head/usr.bin/vmstat/vmstat.c Tue Aug 8 11:49:36 2017 (r322251) >>> +++ head/usr.bin/vmstat/vmstat.c Tue Aug 8 12:18:11 2017 (r322252) >>> @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps) >>> xo_emit(" "); >>> xo_emit("{:free-memory/%7d}", >>> vmstat_pgtok(total.t_free)); >>> + xo_emit(" "); >>> } >>> xo_emit("{:total-page-faults/%5lu} ", >>> (unsigned long)rate(sum.v_vm_faults - >> >> This seems to break the formatting. There was a negative amount of space >> available for expansion, and since the header was not expanded to match >> its alignment with the fields is more random than before. With -h, the >> width was 80 columns, giving ugly line wrap on 80-column terminals with >> auto-wrap. Now it is 81 columns, giving uglier line wrap on all 80- >> column terminals. > > This break nothing, This was the case before too (with or without > -h), just tested in tmux with force-width 80. Testing shows that it breaks the -H case as expected. (I had misread the change as affecting the -h case too.) Before: X procs memory page disks faults cpu X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id X 0 0 0 12719376 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 Misformatting in the data line starts with the avm field taking 8 of the 7 columns reserved for it. This and all subsequent fields are misaligned with the header. The header is pre-misformatted to width 85, with lots of inconsistencies in the first line. Old versions were carefully formatted to width 79, with no inconsistencies in the first line. The extra width for avm makes the extra width for the header not even work to line up. X procs memory page disks faults cpu X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id X 0 0 0 12719380 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 The new bugs are that the extra space before the "flt" field increases the off-by-1 error to off-by-2 for this field and all subsequent fields. All fields starting with "flt" now have an error of at least off-by-1 even if none are too wide, since the header was not expanded to match. Expansion would increase its breakage from 6 to wide to 7 too wide. >> The bugs were mostly in the first line of the header: >> - the second line of the header was correct for vmstat -h >> - for vmstat without -h, the second line of the header was apparently broken >> by a change like the one here, that added a space after the "r b w" fields >> without adding one in the "r b w" header >> - most of the fields in the first line of the header are misaligned with the >> second lone. Many have drifted 3 to the left of where the were in a sort >> of center-justified place. Some of these might have actually been >> intended to be left justified, but had an off by +1 error. Now these >> have an error of off by -2 relative to left justifications. >> >> Only the "memory" header in the first line is better than in old versions. >> It is now left justified. Left justifying all headers in the first line >> is probably best. I couldn't find a good way to delimit the right hand >> side of the extents of the headers in the first line. The second line of >> the headers already uses right justification consistently and this works >> well. > > I think that all this might be true but you might talk about the whole > libxo conversion that was done, not my commit right ? I try not to look at libxo, since its misformattings are enormous starting in the source code. My columnize.awk script works almost perfectly to fix the above misformattings: X BEGIN { X columns = 79 # XXX X } X X { X # Determine fields and field widths for current line. X # awk's field splitting feature turned out to be inadequate, X # and this would be even easier in C. X n = split($0, a, "") X f = 1 X j = 1 X while (j <= n) { X cpw[f] = 0 X cfw[f] = 0 X while (j <= n && a[j] == " ") { X cpw[f]++ # current (left) padding width X j++ X } X if (j > n) X break X while (j <= n && a[j] != " ") { X cfw[f]++ # current field width without padding X j++ X } X fld[f] = substr($0, j - cfw[f], cfw[f]) X if (f != 1) { X cpw[f]-- X cfw[f]++ # current field width with min padding X } X f++ X } X nf = f - 1 # no need to use or trust NF X X if (NR == 1 || NR < 3 && nf != anf) { X # Make current field widths (with full padding) the maximum X # ones. When NR > 1, this discards the previous maximums. X # Good enough for vmstat, where the widths from NR == 1 are X # garbage. X # X # Make current field widths (with minimal padding) the minimum X # ones. X anf = nf X for (f = 1; f <= anf; f++) { X Mfw[f] = cpw[f] + cfw[f] X mfw[f] = cfw[f] X } X } else if (nf < anf) { X # Some non-tabular line after warming up. Probably an ornate X # line in the next header. Too hard to handle properly. X printf("%.*s oops\n", columns - 5, $0) X fflush(stdout) X next X } else if (nf > anf) { X # Some non-tabular line after warming up. Hopefully just X # a single trailing field with inadequate field separators X # like the COMMAND field in ps and top. Append the extras X # to the last field with minimal separators. X for (f = anf + 1; f <= nf; f++) X fld[anf] = fld[anf] " " fld[f] X nf = anf X cfw[nf] = 1 + length(fld[nf]) X } X X # Update the maximum and minimum field widths if this line needs X # wider fields. X len = 0 X for (f = 1; f <= nf; f++) { X if (Mfw[f] < cfw[f]) X Mfw[f] = cfw[f] X len += Mfw[f] X if (mfw[f] < cfw[f]) X mfw[f] = cfw[f] X } X X # If the line would be too wide, reduce the maximum field widths X # minimally towards minimum ones. X while (len > columns) { X for (f = 1; f <= nf; f++) { X if (Mfw[f] > mfw[f]) { X Mfw[f]-- X len-- X break X } X } X if (f > nf) X break X } X X s = "" X for (f = 1; f <= nf - 1; f++) X s = s sprintf("%*s", Mfw[f], fld[f]) X s = s sprintf(" %-*s", Mfw[nf] - 1, fld[nf]) X printf("%.*s\n", columns, s) X fflush(stdout) X } When applied to the above saved output (old then new, quoted by X's), it produces: X procs memory page disks faults cpu X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id X 0 0 0 12719376 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 X procs memory page disks faults oops X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id X 0 0 0 12719380 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 It removed enough spaces to fit in 79 columns even with the X's. It can't handle the first line of the header very well since this line has an ornate format whose columns don't match the rest of the output in any simple way (programs should produce more parseable formats, like ps does). All that that it did for the first line was move "cpu" to a less worse place in the old output and change it to "oops" in the new output. Even programs like ps and df that attempt to do the necessary dynamic formatting often produce worse results than the above script. df on freefall now produces a mess lots of spaces giving long lines even with -h, I think because the mountpoint names are very long and df has hard- coded formats for everything else. columnize.awk only manages to almost clean this up for the -h case. It has a problem that it is stream-based and doesn't backtrack to adjust early lines. This is necessary for use in filters. vmstat 1 | awk -f columize.awk is a good example of using columize.awk in a filter. This use also requires it to understand headers not in the first few lines of output. This is not easy, and in practice it gets confused by the first line of the vmstat header unless it is the first line of the output. This is why it printed "oops" in the abov concatenated output. The first header line just has an unusual number of fields so cannot be handled right. When it is the first line in the output, it is printed verbatim except possibly for removing spaces, since it gives the only available information on the expected columnar output. Bruce From owner-svn-src-head@freebsd.org Wed Aug 9 09:13:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4594DDC7A9D; Wed, 9 Aug 2017 09:13:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 135A769BD3; Wed, 9 Aug 2017 09:13:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v799DGZ9011216; Wed, 9 Aug 2017 09:13:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v799DGiv011215; Wed, 9 Aug 2017 09:13:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708090913.v799DGiv011215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 9 Aug 2017 09:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322302 - head/sys/cam/ctl X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/ctl X-SVN-Commit-Revision: 322302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 09:13:17 -0000 Author: mav Date: Wed Aug 9 09:13:15 2017 New Revision: 322302 URL: https://svnweb.freebsd.org/changeset/base/322302 Log: Do not loose CCB flags after r320493. There is at least CAM_UNLOCKED that should be kept. MFC after: 3 days Modified: head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Wed Aug 9 08:57:00 2017 (r322301) +++ head/sys/cam/ctl/scsi_ctl.c Wed Aug 9 09:13:15 2017 (r322302) @@ -1003,7 +1003,8 @@ ctlfe_requeue_ccb(struct cam_periph *periph, union ccb * target/lun. Reset the target and LUN fields back to the wildcard * values before we send them back down to the SIM. */ - xpt_setup_ccb(&ccb->ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_ccb_flags(&ccb->ccb_h, periph->path, CAM_PRIORITY_NONE, + ccb->ccb_h.flags); xpt_action(ccb); } From owner-svn-src-head@freebsd.org Wed Aug 9 09:40:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D426DC81CB; Wed, 9 Aug 2017 09:40:52 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 62D796AC6D; Wed, 9 Aug 2017 09:40:50 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 622c0cbf; Wed, 9 Aug 2017 11:40:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=YHlYNx1ueOQ1mJD02d0Dw2TKYKQ=; b=kD0Uz7hXb5dY/sojLfBufpJwbjW8 bWszu/vcA9QwgqEqj7DDL+kEFnjv8IvLC9DPLoX5DQkCeACKeyR7XxJvcYpRs6qj pR96z7PxUpW1t/wp2rR3zlaZSgebVINSsim8U3KU+QjC/JUQI9OlU/ZnQOUiwxKj FR72iA/4KeRPHc8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=MKR1o5mjiBJ13SopBz044PfeZTniB86PKJPU0zND2ZFg96j1lQg93vqk 7FthG1dNpH05XoWeWzslAI4REgSo5ezChoQPtSL6cyjQVgWWoyKnjBZi8MvNtUzJ S1EyPSAeLySguhm1J/ptEX8ArIki8o7tH7msqQ0XmGe/9oBlHWA= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id d970e6e3 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Wed, 9 Aug 2017 11:40:46 +0200 (CEST) Date: Wed, 9 Aug 2017 11:40:46 +0200 From: Emmanuel Vadot To: Bruce Evans Cc: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322252 - head/usr.bin/vmstat Message-Id: <20170809114046.6e55bb881d98d19f8b88ddc2@bidouilliste.com> In-Reply-To: <20170809171526.B1567@besplex.bde.org> References: <201708081218.v78CIBvL068413@repo.freebsd.org> <20170808225104.I3528@besplex.bde.org> <20170808161507.2d185d394dc921eac6729d89@bidouilliste.com> <20170809171526.B1567@besplex.bde.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 09:40:52 -0000 On Wed, 9 Aug 2017 18:44:19 +1000 (EST) Bruce Evans wrote: > On Tue, 8 Aug 2017, Emmanuel Vadot wrote: > > > On Tue, 8 Aug 2017 23:55:52 +1000 (EST) > > Bruce Evans wrote: > > > >> On Tue, 8 Aug 2017, Emmanuel Vadot wrote: > >> > >>> Log: > >>> vmstat: Always emit a space after the free-memory column > >>> > >>> When displaying in non-human form, if the free-memory number > >>> is large (more than 7 digits), there is no space between it and > >>> the page fault column. > >>> > >>> PR: 221290 > >>> Submitted by: Josuah Demangeon (Original version) > >>> > >>> Modified: > >>> head/usr.bin/vmstat/vmstat.c > >>> > >>> Modified: head/usr.bin/vmstat/vmstat.c > >>> ============================================================================== > >>> --- head/usr.bin/vmstat/vmstat.c Tue Aug 8 11:49:36 2017 (r322251) > >>> +++ head/usr.bin/vmstat/vmstat.c Tue Aug 8 12:18:11 2017 (r322252) > >>> @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps) > >>> xo_emit(" "); > >>> xo_emit("{:free-memory/%7d}", > >>> vmstat_pgtok(total.t_free)); > >>> + xo_emit(" "); > >>> } > >>> xo_emit("{:total-page-faults/%5lu} ", > >>> (unsigned long)rate(sum.v_vm_faults - > >> > >> This seems to break the formatting. There was a negative amount of space > >> available for expansion, and since the header was not expanded to match > >> its alignment with the fields is more random than before. With -h, the > >> width was 80 columns, giving ugly line wrap on 80-column terminals with > >> auto-wrap. Now it is 81 columns, giving uglier line wrap on all 80- > >> column terminals. > > > > This break nothing, This was the case before too (with or without > > -h), just tested in tmux with force-width 80. > > Testing shows that it breaks the -H case as expected. (I had misread the > change as affecting the -h case too.) > > Before: > > X procs memory page disks faults cpu > X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id > X 0 0 0 12719376 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 > > Misformatting in the data line starts with the avm field taking 8 of the 7 > columns reserved for it. This and all subsequent fields are misaligned with > the header. > > The header is pre-misformatted to width 85, with lots of inconsistencies in > the first line. Old versions were carefully formatted to width 79, with no > inconsistencies in the first line. The extra width for avm makes the extra > width for the header not even work to line up. > > X procs memory page disks faults cpu > X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id > X 0 0 0 12719380 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 > > The new bugs are that the extra space before the "flt" field increases the > off-by-1 error to off-by-2 for this field and all subsequent fields. All > fields starting with "flt" now have an error of at least off-by-1 even > if none are too wide, since the header was not expanded to match. Expansion > would increase its breakage from 6 to wide to 7 too wide. Thanks, I know see the problem. I'll see if this could be corrected easily with libxo ... > >> The bugs were mostly in the first line of the header: > >> - the second line of the header was correct for vmstat -h > >> - for vmstat without -h, the second line of the header was apparently broken > >> by a change like the one here, that added a space after the "r b w" fields > >> without adding one in the "r b w" header > >> - most of the fields in the first line of the header are misaligned with the > >> second lone. Many have drifted 3 to the left of where the were in a sort > >> of center-justified place. Some of these might have actually been > >> intended to be left justified, but had an off by +1 error. Now these > >> have an error of off by -2 relative to left justifications. > >> > >> Only the "memory" header in the first line is better than in old versions. > >> It is now left justified. Left justifying all headers in the first line > >> is probably best. I couldn't find a good way to delimit the right hand > >> side of the extents of the headers in the first line. The second line of > >> the headers already uses right justification consistently and this works > >> well. > > > > I think that all this might be true but you might talk about the whole > > libxo conversion that was done, not my commit right ? > > I try not to look at libxo, since its misformattings are enormous starting > in the source code. > > My columnize.awk script works almost perfectly to fix the above > misformattings: > > X BEGIN { > X columns = 79 # XXX > X } > X > X { > X # Determine fields and field widths for current line. > X # awk's field splitting feature turned out to be inadequate, > X # and this would be even easier in C. > X n = split($0, a, "") > X f = 1 > X j = 1 > X while (j <= n) { > X cpw[f] = 0 > X cfw[f] = 0 > X while (j <= n && a[j] == " ") { > X cpw[f]++ # current (left) padding width > X j++ > X } > X if (j > n) > X break > X while (j <= n && a[j] != " ") { > X cfw[f]++ # current field width without padding > X j++ > X } > X fld[f] = substr($0, j - cfw[f], cfw[f]) > X if (f != 1) { > X cpw[f]-- > X cfw[f]++ # current field width with min padding > X } > X f++ > X } > X nf = f - 1 # no need to use or trust NF > X > X if (NR == 1 || NR < 3 && nf != anf) { > X # Make current field widths (with full padding) the maximum > X # ones. When NR > 1, this discards the previous maximums. > X # Good enough for vmstat, where the widths from NR == 1 are > X # garbage. > X # > X # Make current field widths (with minimal padding) the minimum > X # ones. > X anf = nf > X for (f = 1; f <= anf; f++) { > X Mfw[f] = cpw[f] + cfw[f] > X mfw[f] = cfw[f] > X } > X } else if (nf < anf) { > X # Some non-tabular line after warming up. Probably an ornate > X # line in the next header. Too hard to handle properly. > X printf("%.*s oops\n", columns - 5, $0) > X fflush(stdout) > X next > X } else if (nf > anf) { > X # Some non-tabular line after warming up. Hopefully just > X # a single trailing field with inadequate field separators > X # like the COMMAND field in ps and top. Append the extras > X # to the last field with minimal separators. > X for (f = anf + 1; f <= nf; f++) > X fld[anf] = fld[anf] " " fld[f] > X nf = anf > X cfw[nf] = 1 + length(fld[nf]) > X } > X > X # Update the maximum and minimum field widths if this line needs > X # wider fields. > X len = 0 > X for (f = 1; f <= nf; f++) { > X if (Mfw[f] < cfw[f]) > X Mfw[f] = cfw[f] > X len += Mfw[f] > X if (mfw[f] < cfw[f]) > X mfw[f] = cfw[f] > X } > X > X # If the line would be too wide, reduce the maximum field widths > X # minimally towards minimum ones. > X while (len > columns) { > X for (f = 1; f <= nf; f++) { > X if (Mfw[f] > mfw[f]) { > X Mfw[f]-- > X len-- > X break > X } > X } > X if (f > nf) > X break > X } > X > X s = "" > X for (f = 1; f <= nf - 1; f++) > X s = s sprintf("%*s", Mfw[f], fld[f]) > X s = s sprintf(" %-*s", Mfw[nf] - 1, fld[nf]) > X printf("%.*s\n", columns, s) > X fflush(stdout) > X } > > When applied to the above saved output (old then new, quoted by X's), it > produces: > > X procs memory page disks faults cpu > X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id > X 0 0 0 12719376 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 > X procs memory page disks faults oops > X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id > X 0 0 0 12719380 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 > > It removed enough spaces to fit in 79 columns even with the X's. It can't > handle the first line of the header very well since this line has an ornate > format whose columns don't match the rest of the output in any simple way > (programs should produce more parseable formats, like ps does). All that > that it did for the first line was move "cpu" to a less worse place in the > old output and change it to "oops" in the new output. > > Even programs like ps and df that attempt to do the necessary dynamic > formatting often produce worse results than the above script. df on > freefall now produces a mess lots of spaces giving long lines even with > -h, I think because the mountpoint names are very long and df has hard- > coded formats for everything else. columnize.awk only manages to almost > clean this up for the -h case. It has a problem that it is stream-based > and doesn't backtrack to adjust early lines. This is necessary for use > in filters. > > vmstat 1 | awk -f columize.awk is a good example of using columize.awk > in a filter. This use also requires it to understand headers not in > the first few lines of output. This is not easy, and in practice it > gets confused by the first line of the vmstat header unless it is the > first line of the output. This is why it printed "oops" in the > abov concatenated output. The first header line just has an unusual > number of fields so cannot be handled right. When it is the first > line in the output, it is printed verbatim except possibly for removing > spaces, since it gives the only available information on the expected > columnar output. > > Bruce -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Wed Aug 9 10:27:22 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B023DC8CD6; Wed, 9 Aug 2017 10:27:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52AF66BE6F; Wed, 9 Aug 2017 10:27:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79ARLrb040212; Wed, 9 Aug 2017 10:27:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79ARLwv040211; Wed, 9 Aug 2017 10:27:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708091027.v79ARLwv040211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 9 Aug 2017 10:27:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322304 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 322304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 10:27:22 -0000 Author: hselasky Date: Wed Aug 9 10:27:21 2017 New Revision: 322304 URL: https://svnweb.freebsd.org/changeset/base/322304 Log: Add support for RX and TX statistics when the mlx4en(4) PCI device is in VF or SRIOV mode typically in a virtual machine environment. Submitted by: Sepherosa Ziehau MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Wed Aug 9 09:16:16 2017 (r322303) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Wed Aug 9 10:27:21 2017 (r322304) @@ -124,11 +124,45 @@ out: return err; } +static void mlx4_en_fold_software_stats(struct net_device *dev) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_dev *mdev = priv->mdev; + u64 packets, bytes; + int i; + + if (!priv->port_up || mlx4_is_master(mdev->dev)) + return; + + packets = 0; + bytes = 0; + for (i = 0; i < priv->rx_ring_num; i++) { + const struct mlx4_en_rx_ring *ring = priv->rx_ring[i]; + + packets += READ_ONCE(ring->packets); + bytes += READ_ONCE(ring->bytes); + } + priv->pkstats.rx_packets = packets; + priv->pkstats.rx_bytes = bytes; + + packets = 0; + bytes = 0; + for (i = 0; i < priv->tx_ring_num; i++) { + const struct mlx4_en_tx_ring *ring = priv->tx_ring[i]; + + packets += READ_ONCE(ring->packets); + bytes += READ_ONCE(ring->bytes); + } + priv->pkstats.tx_packets = packets; + priv->pkstats.tx_bytes = bytes; +} + int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) { struct mlx4_en_stat_out_mbox *mlx4_en_stats; struct mlx4_en_stat_out_flow_control_mbox *flowstats; - struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]); + struct net_device *dev = mdev->pndev[port]; + struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_vport_stats *vport_stats = &priv->vport_stats; struct mlx4_cmd_mailbox *mailbox = NULL; struct mlx4_cmd_mailbox *mailbox_flow = NULL; @@ -138,7 +172,6 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u int do_if_stat = 1; unsigned long period = (unsigned long) (jiffies - priv->last_ifq_jiffies); struct mlx4_en_vport_stats tmp_vport_stats; - struct net_device *dev; if (jiffies_to_msecs(period) < EN_IFQ_MIN_INTERVAL || priv->counter_index == 0xff) @@ -528,8 +561,12 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u be64_to_cpu(flowstats[i].tx_pause_transition); } - memset(&tmp_vport_stats, 0, sizeof(tmp_vport_stats)); + mlx4_en_fold_software_stats(dev); + spin_unlock(&priv->stats_lock); + + memset(&tmp_vport_stats, 0, sizeof(tmp_vport_stats)); + err = mlx4_get_vport_ethtool_stats(mdev->dev, port, &tmp_vport_stats, reset); spin_lock(&priv->stats_lock); @@ -552,42 +589,37 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u vport_stats->tx_errors = tmp_vport_stats.tx_errors; } - if (!mlx4_is_mfunc(mdev->dev)) { -/* netdevice stats format */ #if __FreeBSD_version >= 1100000 - if (reset == 0) { - dev = mdev->pndev[port]; - if_inc_counter(dev, IFCOUNTER_IPACKETS, - priv->pkstats.rx_packets - priv->pkstats_last.rx_packets); - if_inc_counter(dev, IFCOUNTER_OPACKETS, - priv->pkstats.tx_packets - priv->pkstats_last.tx_packets); - if_inc_counter(dev, IFCOUNTER_IBYTES, - priv->pkstats.rx_bytes - priv->pkstats_last.rx_bytes); - if_inc_counter(dev, IFCOUNTER_OBYTES, - priv->pkstats.tx_bytes - priv->pkstats_last.tx_bytes); - if_inc_counter(dev, IFCOUNTER_IERRORS, - priv->pkstats.rx_errors - priv->pkstats_last.rx_errors); - if_inc_counter(dev, IFCOUNTER_IQDROPS, - priv->pkstats.rx_dropped - priv->pkstats_last.rx_dropped); - if_inc_counter(dev, IFCOUNTER_IMCASTS, - priv->pkstats.rx_multicast_packets - priv->pkstats_last.rx_multicast_packets); - if_inc_counter(dev, IFCOUNTER_OMCASTS, - priv->pkstats.tx_multicast_packets - priv->pkstats_last.tx_multicast_packets); - } - priv->pkstats_last = priv->pkstats; + if (reset == 0) { + if_inc_counter(dev, IFCOUNTER_IPACKETS, + priv->pkstats.rx_packets - priv->pkstats_last.rx_packets); + if_inc_counter(dev, IFCOUNTER_OPACKETS, + priv->pkstats.tx_packets - priv->pkstats_last.tx_packets); + if_inc_counter(dev, IFCOUNTER_IBYTES, + priv->pkstats.rx_bytes - priv->pkstats_last.rx_bytes); + if_inc_counter(dev, IFCOUNTER_OBYTES, + priv->pkstats.tx_bytes - priv->pkstats_last.tx_bytes); + if_inc_counter(dev, IFCOUNTER_IERRORS, + priv->pkstats.rx_errors - priv->pkstats_last.rx_errors); + if_inc_counter(dev, IFCOUNTER_IQDROPS, + priv->pkstats.rx_dropped - priv->pkstats_last.rx_dropped); + if_inc_counter(dev, IFCOUNTER_IMCASTS, + priv->pkstats.rx_multicast_packets - priv->pkstats_last.rx_multicast_packets); + if_inc_counter(dev, IFCOUNTER_OMCASTS, + priv->pkstats.tx_multicast_packets - priv->pkstats_last.tx_multicast_packets); + } + priv->pkstats_last = priv->pkstats; #else - dev = mdev->pndev[port]; - dev->if_ipackets = priv->pkstats.rx_packets; - dev->if_opackets = priv->pkstats.tx_packets; - dev->if_ibytes = priv->pkstats.rx_bytes; - dev->if_obytes = priv->pkstats.tx_bytes; - dev->if_ierrors = priv->pkstats.rx_errors; - dev->if_iqdrops = priv->pkstats.rx_dropped; - dev->if_imcasts = priv->pkstats.rx_multicast_packets; - dev->if_omcasts = priv->pkstats.tx_multicast_packets; - dev->if_collisions = 0; + dev->if_ipackets = priv->pkstats.rx_packets; + dev->if_opackets = priv->pkstats.tx_packets; + dev->if_ibytes = priv->pkstats.rx_bytes; + dev->if_obytes = priv->pkstats.tx_bytes; + dev->if_ierrors = priv->pkstats.rx_errors; + dev->if_iqdrops = priv->pkstats.rx_dropped; + dev->if_imcasts = priv->pkstats.rx_multicast_packets; + dev->if_omcasts = priv->pkstats.tx_multicast_packets; + dev->if_collisions = 0; #endif - } spin_unlock(&priv->stats_lock); From owner-svn-src-head@freebsd.org Wed Aug 9 10:30:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A1E4DC8F2C; Wed, 9 Aug 2017 10:30:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 099716C1B8; Wed, 9 Aug 2017 10:30:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79AUu0B040528; Wed, 9 Aug 2017 10:30:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79AUuPi040511; Wed, 9 Aug 2017 10:30:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708091030.v79AUuPi040511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 9 Aug 2017 10:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322305 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 322305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 10:30:57 -0000 Author: hselasky Date: Wed Aug 9 10:30:55 2017 New Revision: 322305 URL: https://svnweb.freebsd.org/changeset/base/322305 Log: Increment queue drops in the network statistics when transmitted packets are dropped by the mlx4en(4) driver. Submitted by: Sepherosa Ziehau MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Wed Aug 9 10:27:21 2017 (r322304) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Wed Aug 9 10:30:55 2017 (r322305) @@ -1071,6 +1071,10 @@ mlx4_en_transmit(struct ifnet *dev, struct mbuf *m) taskqueue_enqueue(cq->tq, &cq->cq_task); } +#if __FreeBSD_version >= 1100000 + if (unlikely(err != 0)) + if_inc_counter(dev, IFCOUNTER_IQDROPS, 1); +#endif return (err); } From owner-svn-src-head@freebsd.org Wed Aug 9 10:32:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A01CDC9101; Wed, 9 Aug 2017 10:32:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66D666C539; Wed, 9 Aug 2017 10:32:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79AWpsj044415; Wed, 9 Aug 2017 10:32:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79AWpJX044414; Wed, 9 Aug 2017 10:32:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708091032.v79AWpJX044414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 9 Aug 2017 10:32:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322306 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 322306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 10:32:52 -0000 Author: hselasky Date: Wed Aug 9 10:32:51 2017 New Revision: 322306 URL: https://svnweb.freebsd.org/changeset/base/322306 Log: Print maximum MTU when trying to set invalid MTU in the mlx4en(4) driver. Useful for debugging. Submitted by: Sepherosa Ziehau MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Aug 9 10:30:55 2017 (r322305) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Aug 9 10:32:51 2017 (r322306) @@ -1771,7 +1771,8 @@ static int mlx4_en_change_mtu(struct net_device *dev, (unsigned)dev->if_mtu, (unsigned)new_mtu); if ((new_mtu < MLX4_EN_MIN_MTU) || (new_mtu > priv->max_mtu)) { - en_err(priv, "Bad MTU size:%d.\n", new_mtu); + en_err(priv, "Bad MTU size:%d, max %u.\n", new_mtu, + priv->max_mtu); return -EPERM; } mutex_lock(&mdev->state_lock); From owner-svn-src-head@freebsd.org Wed Aug 9 10:46:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65EB6DC9777; Wed, 9 Aug 2017 10:46:35 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 331026CC9D; Wed, 9 Aug 2017 10:46:35 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79AkYpN048470; Wed, 9 Aug 2017 10:46:34 GMT (envelope-from oleg@FreeBSD.org) Received: (from oleg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79AkY2V048469; Wed, 9 Aug 2017 10:46:34 GMT (envelope-from oleg@FreeBSD.org) Message-Id: <201708091046.v79AkY2V048469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oleg set sender to oleg@FreeBSD.org using -f From: Oleg Bulyzhin Date: Wed, 9 Aug 2017 10:46:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322307 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: oleg X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 322307 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 10:46:35 -0000 Author: oleg Date: Wed Aug 9 10:46:34 2017 New Revision: 322307 URL: https://svnweb.freebsd.org/changeset/base/322307 Log: Fix comment typo. Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Wed Aug 9 10:32:51 2017 (r322306) +++ head/sys/netinet/if_ether.c Wed Aug 9 10:46:34 2017 (r322307) @@ -1279,7 +1279,7 @@ arp_mark_lle_reachable(struct llentry *la) } /* - * Add pernament link-layer record for given interface address. + * Add permanent link-layer record for given interface address. */ static __noinline void arp_add_ifa_lle(struct ifnet *ifp, const struct sockaddr *dst) From owner-svn-src-head@freebsd.org Wed Aug 9 12:03:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E549DCB60F; Wed, 9 Aug 2017 12:03:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74A6A6F502; Wed, 9 Aug 2017 12:03:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79C3C4d081252; Wed, 9 Aug 2017 12:03:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79C3C1o081247; Wed, 9 Aug 2017 12:03:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708091203.v79C3C1o081247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 9 Aug 2017 12:03:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322308 - in head/sys/dev: ahci sound/pci/hda usb/controller X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/dev: ahci sound/pci/hda usb/controller X-SVN-Commit-Revision: 322308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 12:03:13 -0000 Author: mav Date: Wed Aug 9 12:03:12 2017 New Revision: 322308 URL: https://svnweb.freebsd.org/changeset/base/322308 Log: Add new Intel Lewisburg and Union Point chipset PCI IDs. While there, polish some old AHCI ones, since they are still reused. MFC after: 1 week Modified: head/sys/dev/ahci/ahci_pci.c head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdac.h head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Wed Aug 9 10:46:34 2017 (r322307) +++ head/sys/dev/ahci/ahci_pci.c Wed Aug 9 12:03:12 2017 (r322308) @@ -92,10 +92,10 @@ static const struct { {0x27c58086, 0x00, "Intel ICH7M", 0}, {0x27c68086, 0x00, "Intel ICH7M", 0}, {0x28218086, 0x00, "Intel ICH8", 0}, - {0x28228086, 0x00, "Intel ICH8", 0}, + {0x28228086, 0x00, "Intel ICH8+ (RAID)", 0}, {0x28248086, 0x00, "Intel ICH8", 0}, {0x28298086, 0x00, "Intel ICH8M", 0}, - {0x282a8086, 0x00, "Intel ICH8M", 0}, + {0x282a8086, 0x00, "Intel ICH8M+ (RAID)", 0}, {0x29228086, 0x00, "Intel ICH9", 0}, {0x29238086, 0x00, "Intel ICH9", 0}, {0x29248086, 0x00, "Intel ICH9", 0}, @@ -108,14 +108,14 @@ static const struct { {0x292f8086, 0x00, "Intel ICH9M", 0}, {0x294d8086, 0x00, "Intel ICH9", 0}, {0x294e8086, 0x00, "Intel ICH9M", 0}, - {0x3a058086, 0x00, "Intel ICH10", 0}, + {0x3a058086, 0x00, "Intel ICH10 (RAID)", 0}, {0x3a228086, 0x00, "Intel ICH10", 0}, - {0x3a258086, 0x00, "Intel ICH10", 0}, + {0x3a258086, 0x00, "Intel ICH10 (RAID)", 0}, {0x3b228086, 0x00, "Intel 5 Series/3400 Series", 0}, {0x3b238086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b258086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b258086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, {0x3b298086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, {0x3b2f8086, 0x00, "Intel 5 Series/3400 Series", 0}, {0x19b08086, 0x00, "Intel Denverton", 0}, {0x19b18086, 0x00, "Intel Denverton", 0}, @@ -139,12 +139,13 @@ static const struct { {0x19cf8086, 0x00, "Intel Denverton", 0}, {0x1c028086, 0x00, "Intel Cougar Point", 0}, {0x1c038086, 0x00, "Intel Cougar Point", 0}, - {0x1c048086, 0x00, "Intel Cougar Point", 0}, - {0x1c058086, 0x00, "Intel Cougar Point", 0}, + {0x1c048086, 0x00, "Intel Cougar Point (RAID)", 0}, + {0x1c058086, 0x00, "Intel Cougar Point (RAID)", 0}, + {0x1c068086, 0x00, "Intel Cougar Point (RAID)", 0}, {0x1d028086, 0x00, "Intel Patsburg", 0}, {0x1d048086, 0x00, "Intel Patsburg", 0}, {0x1d068086, 0x00, "Intel Patsburg", 0}, - {0x28268086, 0x00, "Intel Patsburg (RAID)", 0}, + {0x28268086, 0x00, "Intel Patsburg+ (RAID)", 0}, {0x1e028086, 0x00, "Intel Panther Point", 0}, {0x1e038086, 0x00, "Intel Panther Point", 0}, {0x1e048086, 0x00, "Intel Panther Point (RAID)", 0}, @@ -170,8 +171,6 @@ static const struct { {0x1f3e8086, 0x00, "Intel Avoton (RAID)", 0}, {0x1f3f8086, 0x00, "Intel Avoton (RAID)", 0}, {0x23a38086, 0x00, "Intel Coleto Creek", 0}, - {0x28238086, 0x00, "Intel Wellsburg (RAID)", 0}, - {0x28278086, 0x00, "Intel Wellsburg (RAID)", 0}, {0x8c028086, 0x00, "Intel Lynx Point", 0}, {0x8c038086, 0x00, "Intel Lynx Point", 0}, {0x8c048086, 0x00, "Intel Lynx Point (RAID)", 0}, @@ -195,6 +194,8 @@ static const struct { {0x8d648086, 0x00, "Intel Wellsburg (RAID)", 0}, {0x8d668086, 0x00, "Intel Wellsburg (RAID)", 0}, {0x8d6e8086, 0x00, "Intel Wellsburg (RAID)", 0}, + {0x28238086, 0x00, "Intel Wellsburg+ (RAID)", 0}, + {0x28278086, 0x00, "Intel Wellsburg+ (RAID)", 0}, {0x9c028086, 0x00, "Intel Lynx Point-LP", 0}, {0x9c038086, 0x00, "Intel Lynx Point-LP", 0}, {0x9c048086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, @@ -212,6 +213,17 @@ static const struct { {0xa1068086, 0x00, "Intel Sunrise Point (RAID)", 0}, {0xa1078086, 0x00, "Intel Sunrise Point (RAID)", 0}, {0xa10f8086, 0x00, "Intel Sunrise Point (RAID)", 0}, + {0xa1828086, 0x00, "Intel Lewisburg", 0}, + {0xa1868086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa1d28086, 0x00, "Intel Lewisburg", 0}, + {0xa1d68086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa2028086, 0x00, "Intel Lewisburg", 0}, + {0xa2068086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa2528086, 0x00, "Intel Lewisburg", 0}, + {0xa2568086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa2828086, 0x00, "Intel Union Point", 0}, + {0xa2868086, 0x00, "Intel Union Point (RAID)", 0}, + {0xa28e8086, 0x00, "Intel Union Point (RAID)", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE | AHCI_Q_1CH}, Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Wed Aug 9 10:46:34 2017 (r322307) +++ head/sys/dev/sound/pci/hda/hdac.c Wed Aug 9 12:03:12 2017 (r322308) @@ -97,6 +97,8 @@ static const struct { { HDA_INTEL_KBLKLP, "Intel Kabylake-LP", 0, 0 }, { HDA_INTEL_SRPT, "Intel Sunrise Point", 0, 0 }, { HDA_INTEL_KBLK, "Intel Kabylake", 0, 0 }, + { HDA_INTEL_KBLKH, "Intel Kabylake-H", 0, 0 }, + { HDA_INTEL_CFLK, "Intel Coffelake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, Modified: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Wed Aug 9 10:46:34 2017 (r322307) +++ head/sys/dev/sound/pci/hda/hdac.h Wed Aug 9 12:03:12 2017 (r322308) @@ -73,6 +73,8 @@ #define HDA_INTEL_KBLKLP HDA_MODEL_CONSTRUCT(INTEL, 0x9d71) #define HDA_INTEL_SRPT HDA_MODEL_CONSTRUCT(INTEL, 0xa170) #define HDA_INTEL_KBLK HDA_MODEL_CONSTRUCT(INTEL, 0xa171) +#define HDA_INTEL_KBLKH HDA_MODEL_CONSTRUCT(INTEL, 0xa2f0) +#define HDA_INTEL_CFLK HDA_MODEL_CONSTRUCT(INTEL, 0xa348) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Wed Aug 9 10:46:34 2017 (r322307) +++ head/sys/dev/usb/controller/xhci_pci.c Wed Aug 9 12:03:12 2017 (r322308) @@ -134,6 +134,10 @@ xhci_pci_match(device_t self) return ("Intel Sunrise Point-LP USB 3.0 controller"); case 0xa12f8086: return ("Intel Sunrise Point USB 3.0 controller"); + case 0xa1af8086: + return ("Intel Lewisburg USB 3.0 controller"); + case 0xa2af8086: + return ("Intel Union Point USB 3.0 controller"); case 0xa01b177d: return ("Cavium ThunderX USB 3.0 controller"); From owner-svn-src-head@freebsd.org Wed Aug 9 12:21:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD858DCBD36; Wed, 9 Aug 2017 12:21:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3CBF6FDEA; Wed, 9 Aug 2017 12:21:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79CLHF8085632; Wed, 9 Aug 2017 12:21:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79CLHqg085628; Wed, 9 Aug 2017 12:21:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708091221.v79CLHqg085628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 9 Aug 2017 12:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322309 - in head/sys/dev: ahci ata ata/chipsets sound/pci/hda X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/dev: ahci ata ata/chipsets sound/pci/hda X-SVN-Commit-Revision: 322309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 12:21:19 -0000 Author: mav Date: Wed Aug 9 12:21:17 2017 New Revision: 322309 URL: https://svnweb.freebsd.org/changeset/base/322309 Log: Use "Ibex Peak" codename for "5 Series/3400 Series" chipsets. This is shorter and unifies naming with later chipsets. MFC after: 1 week Modified: head/sys/dev/ahci/ahci_pci.c head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-intel.c head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Wed Aug 9 12:03:12 2017 (r322308) +++ head/sys/dev/ahci/ahci_pci.c Wed Aug 9 12:21:17 2017 (r322309) @@ -111,12 +111,12 @@ static const struct { {0x3a058086, 0x00, "Intel ICH10 (RAID)", 0}, {0x3a228086, 0x00, "Intel ICH10", 0}, {0x3a258086, 0x00, "Intel ICH10 (RAID)", 0}, - {0x3b228086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b238086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b258086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, - {0x3b298086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, - {0x3b2f8086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b228086, 0x00, "Intel Ibex Peak", 0}, + {0x3b238086, 0x00, "Intel Ibex Peak", 0}, + {0x3b258086, 0x00, "Intel Ibex Peak (RAID)", 0}, + {0x3b298086, 0x00, "Intel Ibex Peak-M", 0}, + {0x3b2c8086, 0x00, "Intel Ibex Peak-M (RAID)", 0}, + {0x3b2f8086, 0x00, "Intel Ibex Peak-M Series", 0}, {0x19b08086, 0x00, "Intel Denverton", 0}, {0x19b18086, 0x00, "Intel Denverton", 0}, {0x19b28086, 0x00, "Intel Denverton", 0}, Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Wed Aug 9 12:03:12 2017 (r322308) +++ head/sys/dev/ata/ata-pci.h Wed Aug 9 12:21:17 2017 (r322309) @@ -193,12 +193,12 @@ struct ata_pci_controller { #define ATA_I82801JI_S1 0x3a208086 #define ATA_I82801JI_S2 0x3a268086 -#define ATA_5Series_S1 0x3b208086 -#define ATA_5Series_S2 0x3b218086 -#define ATA_5Series_S3 0x3b268086 -#define ATA_5Series_S4 0x3b288086 -#define ATA_5Series_S5 0x3b2d8086 -#define ATA_5Series_S6 0x3b2e8086 +#define ATA_IBP_S1 0x3b208086 +#define ATA_IBP_S2 0x3b218086 +#define ATA_IBP_S3 0x3b268086 +#define ATA_IBP_S4 0x3b288086 +#define ATA_IBP_S5 0x3b2d8086 +#define ATA_IBP_S6 0x3b2e8086 #define ATA_CPT_S1 0x1c008086 #define ATA_CPT_S2 0x1c018086 Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Wed Aug 9 12:03:12 2017 (r322308) +++ head/sys/dev/ata/chipsets/ata-intel.c Wed Aug 9 12:21:17 2017 (r322309) @@ -149,12 +149,12 @@ ata_intel_probe(device_t dev) { ATA_I82801JD_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, - { ATA_5Series_S1, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S2, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S3, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S4, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S5, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S6, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_IBP_S1, 0, INTEL_6CH, 0, ATA_SA300, "Ibex Peak" }, + { ATA_IBP_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Ibex Peak" }, + { ATA_IBP_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Ibex Peak" }, + { ATA_IBP_S4, 0, INTEL_6CH, 0, ATA_SA300, "Ibex Peak-M" }, + { ATA_IBP_S5, 0, INTEL_6CH2, 0, ATA_SA300, "Ibex Peak-M" }, + { ATA_IBP_S6, 0, INTEL_6CH, 0, ATA_SA300, "Ibex Peak-M" }, { ATA_CPT_S1, 0, INTEL_6CH, 0, ATA_SA600, "Cougar Point" }, { ATA_CPT_S2, 0, INTEL_6CH, 0, ATA_SA600, "Cougar Point" }, { ATA_CPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Wed Aug 9 12:03:12 2017 (r322308) +++ head/sys/dev/sound/pci/hda/hdac.c Wed Aug 9 12:21:17 2017 (r322309) @@ -106,8 +106,8 @@ static const struct { { HDA_INTEL_82801I, "Intel 82801I", 0, 0 }, { HDA_INTEL_82801JI, "Intel 82801JI", 0, 0 }, { HDA_INTEL_82801JD, "Intel 82801JD", 0, 0 }, - { HDA_INTEL_PCH, "Intel 5 Series/3400 Series", 0, 0 }, - { HDA_INTEL_PCH2, "Intel 5 Series/3400 Series", 0, 0 }, + { HDA_INTEL_PCH, "Intel Ibex Peak", 0, 0 }, + { HDA_INTEL_PCH2, "Intel Ibex Peak", 0, 0 }, { HDA_INTEL_SCH, "Intel SCH", 0, 0 }, { HDA_NVIDIA_MCP51, "NVIDIA MCP51", 0, HDAC_QUIRK_MSI }, { HDA_NVIDIA_MCP55, "NVIDIA MCP55", 0, HDAC_QUIRK_MSI }, From owner-svn-src-head@freebsd.org Wed Aug 9 12:24:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EC56DCBE37; Wed, 9 Aug 2017 12:24:08 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3534070141; Wed, 9 Aug 2017 12:24:08 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79CO7f1089699; Wed, 9 Aug 2017 12:24:07 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79CO7m6089697; Wed, 9 Aug 2017 12:24:07 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708091224.v79CO7m6089697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 9 Aug 2017 12:24:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322310 - in head: share/man/man4 sys/net X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: share/man/man4 sys/net X-SVN-Commit-Revision: 322310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 12:24:08 -0000 Author: ae Date: Wed Aug 9 12:24:07 2017 New Revision: 322310 URL: https://svnweb.freebsd.org/changeset/base/322310 Log: Add to if_enc(4) ability to capture packets via BPF after pfil processing. New flag 0x4 can be configured in net.enc.[in|out].ipsec_bpf_mask. When it is set, if_enc(4) additionally captures a packet via BPF after invoking pfil hook. This may be useful for debugging. MFC after: 2 weeks Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D11804 Modified: head/share/man/man4/enc.4 head/sys/net/if_enc.c Modified: head/share/man/man4/enc.4 ============================================================================== --- head/share/man/man4/enc.4 Wed Aug 9 12:21:17 2017 (r322309) +++ head/share/man/man4/enc.4 Wed Aug 9 12:24:07 2017 (r322310) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 28, 2007 +.Dd August 9, 2017 .Dt ENC 4 .Os .Sh NAME @@ -44,6 +44,13 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device enc" .Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_enc_load="YES" +.Ed .Sh DESCRIPTION The .Nm @@ -115,6 +122,11 @@ outgoing path Most people will want to run with the suggested defaults for .Cm ipsec_filter_mask and rely on the security policy database for the outer headers. +.Pp +Note that packets are captured by BPF before firewall processing. +The special value 0x4 can be configured in the +.Ar ipsec_bpf_mask +and packets will be also captured after firewall processing. .Sh EXAMPLES To see the packets the processed via .Xr ipsec 4 , Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Wed Aug 9 12:21:17 2017 (r322309) +++ head/sys/net/if_enc.c Wed Aug 9 12:24:07 2017 (r322310) @@ -99,9 +99,15 @@ static void enc_remove_hhooks(struct enc_softc *); static const char encname[] = "enc"; +#define IPSEC_ENC_AFTER_PFIL 0x04 /* * Before and after are relative to when we are stripping the * outer IP header. + * + * AFTER_PFIL flag used only for bpf_mask_*. It enables BPF capturing + * after PFIL hook execution. It might be useful when PFIL hook does + * some changes to the packet, e.g. address translation. If PFIL hook + * consumes mbuf, nothing will be captured. */ static VNET_DEFINE(int, filter_mask_in) = IPSEC_ENC_BEFORE; static VNET_DEFINE(int, bpf_mask_in) = IPSEC_ENC_BEFORE; @@ -194,6 +200,30 @@ enc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (0); } +static void +enc_bpftap(struct ifnet *ifp, struct mbuf *m, const struct secasvar *sav, + int32_t hhook_type, uint8_t enc, uint8_t af) +{ + struct enchdr hdr; + + if (hhook_type == HHOOK_TYPE_IPSEC_IN && + (enc & V_bpf_mask_in) == 0) + return; + else if (hhook_type == HHOOK_TYPE_IPSEC_OUT && + (enc & V_bpf_mask_out) == 0) + return; + if (bpf_peers_present(ifp->if_bpf) == 0) + return; + hdr.af = af; + hdr.spi = sav->spi; + hdr.flags = 0; + if (sav->alg_enc != SADB_EALG_NONE) + hdr.flags |= M_CONF; + if (sav->alg_auth != SADB_AALG_NONE) + hdr.flags |= M_AUTH; + bpf_mtap2(ifp->if_bpf, &hdr, sizeof(hdr), m); +} + /* * One helper hook function is used by any hook points. * + from hhook_type we can determine the packet direction: @@ -206,7 +236,6 @@ static int enc_hhook(int32_t hhook_type, int32_t hhook_id, void *udata, void *ctx_data, void *hdata, struct osd *hosd) { - struct enchdr hdr; struct ipsec_ctx_data *ctx; struct enc_softc *sc; struct ifnet *ifp, *rcvif; @@ -223,21 +252,7 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void * if (ctx->af != hhook_id) return (EPFNOSUPPORT); - if (((hhook_type == HHOOK_TYPE_IPSEC_IN && - (ctx->enc & V_bpf_mask_in) != 0) || - (hhook_type == HHOOK_TYPE_IPSEC_OUT && - (ctx->enc & V_bpf_mask_out) != 0)) && - bpf_peers_present(ifp->if_bpf) != 0) { - hdr.af = ctx->af; - hdr.spi = ctx->sav->spi; - hdr.flags = 0; - if (ctx->sav->alg_enc != SADB_EALG_NONE) - hdr.flags |= M_CONF; - if (ctx->sav->alg_auth != SADB_AALG_NONE) - hdr.flags |= M_AUTH; - bpf_mtap2(ifp->if_bpf, &hdr, sizeof(hdr), *ctx->mp); - } - + enc_bpftap(ifp, *ctx->mp, ctx->sav, hhook_type, ctx->enc, ctx->af); switch (hhook_type) { case HHOOK_TYPE_IPSEC_IN: if (ctx->enc == IPSEC_ENC_BEFORE) { @@ -290,6 +305,8 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void * return (EACCES); } (*ctx->mp)->m_pkthdr.rcvif = rcvif; + enc_bpftap(ifp, *ctx->mp, ctx->sav, hhook_type, + IPSEC_ENC_AFTER_PFIL, ctx->af); return (0); } From owner-svn-src-head@freebsd.org Wed Aug 9 13:25:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96F33DCCF84; Wed, 9 Aug 2017 13:25:28 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6409A71FE5; Wed, 9 Aug 2017 13:25:28 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79DPRpf013878; Wed, 9 Aug 2017 13:25:27 GMT (envelope-from jonathan@FreeBSD.org) Received: (from jonathan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79DPRlm013877; Wed, 9 Aug 2017 13:25:27 GMT (envelope-from jonathan@FreeBSD.org) Message-Id: <201708091325.v79DPRlm013877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jonathan set sender to jonathan@FreeBSD.org using -f From: Jonathan Anderson Date: Wed, 9 Aug 2017 13:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322314 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: jonathan X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322314 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 13:25:28 -0000 Author: jonathan Date: Wed Aug 9 13:25:27 2017 New Revision: 322314 URL: https://svnweb.freebsd.org/changeset/base/322314 Log: Add birthday information for jonathan@. As requested by mckusick@... Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Wed Aug 9 12:55:58 2017 (r322313) +++ head/usr.bin/calendar/calendars/calendar.freebsd Wed Aug 9 13:25:27 2017 (r322314) @@ -123,6 +123,7 @@ 03/24 Marcel Moolenaar born in Hilversum, the Netherlands, 1968 03/24 Emanuel Haupt born in Zurich, Switzerland, 1979 03/25 Andrew R. Reiter born in Springfield, Massachusetts, United States, 1980 +03/26 Jonathan Anderson born in Ottawa, Ontario, Canada, 1983 03/27 Josef El-Rayes born in Linz, Austria, 1982 03/28 Sean C. Farley born in Indianapolis, Indiana, United States, 1970 03/29 Thierry Thomas born in Luxeuil les Bains, France, 1961 From owner-svn-src-head@freebsd.org Wed Aug 9 13:46:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E4BDDCD76C; Wed, 9 Aug 2017 13:46:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E078A72C35; Wed, 9 Aug 2017 13:46:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79DkH3c022296; Wed, 9 Aug 2017 13:46:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79DkHCM022295; Wed, 9 Aug 2017 13:46:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708091346.v79DkHCM022295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 9 Aug 2017 13:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322316 - head/sys/dev/ahci X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ahci X-SVN-Commit-Revision: 322316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 13:46:18 -0000 Author: mav Date: Wed Aug 9 13:46:16 2017 New Revision: 322316 URL: https://svnweb.freebsd.org/changeset/base/322316 Log: Missing remanant of 322309. MFC after: 1 week Modified: head/sys/dev/ahci/ahci_pci.c Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Wed Aug 9 13:26:12 2017 (r322315) +++ head/sys/dev/ahci/ahci_pci.c Wed Aug 9 13:46:16 2017 (r322316) @@ -116,7 +116,7 @@ static const struct { {0x3b258086, 0x00, "Intel Ibex Peak (RAID)", 0}, {0x3b298086, 0x00, "Intel Ibex Peak-M", 0}, {0x3b2c8086, 0x00, "Intel Ibex Peak-M (RAID)", 0}, - {0x3b2f8086, 0x00, "Intel Ibex Peak-M Series", 0}, + {0x3b2f8086, 0x00, "Intel Ibex Peak-M", 0}, {0x19b08086, 0x00, "Intel Denverton", 0}, {0x19b18086, 0x00, "Intel Denverton", 0}, {0x19b28086, 0x00, "Intel Denverton", 0}, From owner-svn-src-head@freebsd.org Wed Aug 9 16:15:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D83E7DD06A6; Wed, 9 Aug 2017 16:15:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4759779BC; Wed, 9 Aug 2017 16:15:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79GFPVc083490; Wed, 9 Aug 2017 16:15:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79GFPk9083482; Wed, 9 Aug 2017 16:15:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708091615.v79GFPk9083482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 9 Aug 2017 16:15:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322318 - in head: share/man/man4 sys/conf sys/geom X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/geom X-SVN-Commit-Revision: 322318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 16:15:26 -0000 Author: imp Date: Wed Aug 9 16:15:24 2017 New Revision: 322318 URL: https://svnweb.freebsd.org/changeset/base/322318 Log: Mark geom classes as deprecated. geom_bsd, geom_mbr and geom_sunlabel have been obsolete since Marcel Moolenaar's geom_part was in FreeBSD 7. They haven't been in GENERIC since FreeBSD 8. Add warning when used. geom_vol_ffs has been obsolete since ufs support to geom_label was committed in FreeBSD 5. It hasn't been in GENERIC since FreeBSD 5. Add warning when used. geom_fox has been obsolete since gmultipath was committed in FreeBSD 7. (no warning added, since this is a very obscure class). These will all be removed in FreeBSD 12. MFC After: 3 days Differential Revision: https://reviews.freebsd.org/D11935 Note: Classes will be removed after MFC Modified: head/share/man/man4/geom.4 head/share/man/man4/geom_fox.4 head/sys/conf/NOTES head/sys/geom/geom_bsd.c head/sys/geom/geom_mbr.c head/sys/geom/geom_sunlabel.c head/sys/geom/geom_vol_ffs.c Modified: head/share/man/man4/geom.4 ============================================================================== --- head/share/man/man4/geom.4 Wed Aug 9 15:38:24 2017 (r322317) +++ head/share/man/man4/geom.4 Wed Aug 9 16:15:24 2017 (r322318) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 20, 2017 +.Dd August 9, 2017 .Dt GEOM 4 .Os .Sh NAME @@ -43,17 +43,14 @@ .Sh SYNOPSIS .Cd options GEOM_AES .Cd options GEOM_BDE -.Cd options GEOM_BSD .Cd options GEOM_CACHE .Cd options GEOM_CONCAT .Cd options GEOM_ELI -.Cd options GEOM_FOX .Cd options GEOM_GATE .Cd options GEOM_JOURNAL .Cd options GEOM_LABEL .Cd options GEOM_LINUX_LVM .Cd options GEOM_MAP -.Cd options GEOM_MBR .Cd options GEOM_MIRROR .Cd options GEOM_MOUNTVER .Cd options GEOM_MULTIPATH @@ -71,10 +68,8 @@ .Cd options GEOM_RAID3 .Cd options GEOM_SHSEC .Cd options GEOM_STRIPE -.Cd options GEOM_SUNLABEL .Cd options GEOM_UZIP .Cd options GEOM_VIRSTOR -.Cd options GEOM_VOL .Cd options GEOM_ZERO .Sh DESCRIPTION The @@ -449,6 +444,24 @@ This is unused at this time. .It 0x80 Pq Dv G_F_CTLDUMP Dump contents of gctl requests. .El +.Sh OBSOLETE OPTIONS +.Pp +The following options have been deprecated and will be removed in +.Fx 12 : +.Cd GEOM_BSD , +.Cd GEOM_FOX , +.Cd GEOM_MBR , +.Cd GEOM_SUNLABEL , +and +.Cd GEOM_VOL . +.Pp +Use +.Cd GEOM_PART_BSD , +.Cd GEOM_MULTIPATH , +.Cd GEOM_PART_MBR , +.Cd GEOM_PART_VTOC8 , +.Cd GEOM_LABEL +options, respectively, instead. .Sh SEE ALSO .Xr libgeom 3 , .Xr DECLARE_GEOM_CLASS 9 , Modified: head/share/man/man4/geom_fox.4 ============================================================================== --- head/share/man/man4/geom_fox.4 Wed Aug 9 15:38:24 2017 (r322317) +++ head/share/man/man4/geom_fox.4 Wed Aug 9 16:15:24 2017 (r322318) @@ -51,6 +51,8 @@ This driver is obsolete. Users are advised to use .Xr gmultipath 8 instead. +This driver will be removed in +.Fx 12 . .Ef .Pp The intent of the Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Aug 9 15:38:24 2017 (r322317) +++ head/sys/conf/NOTES Wed Aug 9 16:15:24 2017 (r322318) @@ -147,17 +147,17 @@ options BOOTHOWTO=RB_MULTIPLE options GEOM_AES # Don't use, use GEOM_BDE options GEOM_BDE # Disk encryption. -options GEOM_BSD # BSD disklabels +options GEOM_BSD # BSD disklabels (obsolete, gone in 12) options GEOM_CACHE # Disk cache. options GEOM_CONCAT # Disk concatenation. options GEOM_ELI # Disk encryption. -options GEOM_FOX # Redundant path mitigation +options GEOM_FOX # Redundant path mitigation (obsolete, gone in 12) options GEOM_GATE # Userland services. options GEOM_JOURNAL # Journaling. options GEOM_LABEL # Providers labelization. options GEOM_LINUX_LVM # Linux LVM2 volumes options GEOM_MAP # Map based partitioning -options GEOM_MBR # DOS/MBR partitioning +options GEOM_MBR # DOS/MBR partitioning (obsolete, gone in 12) options GEOM_MIRROR # Disk mirroring. options GEOM_MULTIPATH # Disk multipath options GEOM_NOP # Test class. @@ -174,11 +174,11 @@ options GEOM_RAID # Soft RAID functionality. options GEOM_RAID3 # RAID3 functionality. options GEOM_SHSEC # Shared secret. options GEOM_STRIPE # Disk striping. -options GEOM_SUNLABEL # Sun/Solaris partitioning +options GEOM_SUNLABEL # Sun/Solaris partitioning (obsolete, gone in 12) options GEOM_UZIP # Read-only compressed disks options GEOM_VINUM # Vinum logical volume manager options GEOM_VIRSTOR # Virtual storage. -options GEOM_VOL # Volume names from UFS superblock +options GEOM_VOL # Volume names from UFS superblock (obsolete, gone in 12) options GEOM_ZERO # Performance testing helper. # Modified: head/sys/geom/geom_bsd.c ============================================================================== --- head/sys/geom/geom_bsd.c Wed Aug 9 15:38:24 2017 (r322317) +++ head/sys/geom/geom_bsd.c Wed Aug 9 16:15:24 2017 (r322318) @@ -72,6 +72,8 @@ FEATURE(geom_bsd, "GEOM BSD disklabels support"); #define LABELSIZE (148 + 16 * MAXPARTITIONS) +static int g_bsd_once; + static void g_bsd_hotwrite(void *arg, int flag); /* * Our private data about one instance. All the rest is handled by the @@ -504,6 +506,12 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, g_slice_conf_hot(gp, 0, ms->labeloffset, LABELSIZE, G_SLICE_HOT_ALLOW, G_SLICE_HOT_DENY, G_SLICE_HOT_CALL); gsp->hot = g_bsd_hotwrite; + if (!g_bsd_once) { + g_bsd_once = 1; + printf( + "WARNING: geom_bsd (geom %s) is deprecated, " + "use gpart instead.\n", gp->name); + } return (gp); } /* Modified: head/sys/geom/geom_mbr.c ============================================================================== --- head/sys/geom/geom_mbr.c Wed Aug 9 15:38:24 2017 (r322317) +++ head/sys/geom/geom_mbr.c Wed Aug 9 16:15:24 2017 (r322318) @@ -57,6 +57,8 @@ FEATURE(geom_mbr, "GEOM DOS/MBR partitioning support") #define MBR_CLASS_NAME "MBR" #define MBREXT_CLASS_NAME "MBREXT" +static int g_mbr_once = 0; + static struct dos_partition historical_bogus_partition_table[NDOSPART] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, @@ -315,6 +317,12 @@ g_mbr_taste(struct g_class *mp, struct g_provider *pp, if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); + } + if (!g_mbr_once) { + g_mbr_once = 1; + printf( + "WARNING: geom_mbr (geom %s) is deprecated, " + "use gpart instead.\n", gp->name); } return (gp); } Modified: head/sys/geom/geom_sunlabel.c ============================================================================== --- head/sys/geom/geom_sunlabel.c Wed Aug 9 15:38:24 2017 (r322317) +++ head/sys/geom/geom_sunlabel.c Wed Aug 9 16:15:24 2017 (r322318) @@ -65,6 +65,8 @@ struct g_sunlabel_softc { u_char labelsum[16]; }; +static int g_sunlabel_once = 0; + static int g_sunlabel_modify(struct g_geom *gp, struct g_sunlabel_softc *ms, u_char *sec0) { @@ -312,6 +314,12 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider g_slice_conf_hot(gp, 0, 0, SUN_SIZE, G_SLICE_HOT_ALLOW, G_SLICE_HOT_DENY, G_SLICE_HOT_CALL); gsp->hot = g_sunlabel_hotwrite; + if (!g_sunlabel_once) { + g_sunlabel_once = 1; + printf( + "WARNING: geom_sunlabel (geom %s) is deprecated, " + "use gpart instead.\n", gp->name); + } return (gp); } Modified: head/sys/geom/geom_vol_ffs.c ============================================================================== --- head/sys/geom/geom_vol_ffs.c Wed Aug 9 15:38:24 2017 (r322317) +++ head/sys/geom/geom_vol_ffs.c Wed Aug 9 16:15:24 2017 (r322318) @@ -48,6 +48,7 @@ FEATURE(geom_vol, "GEOM support for volume names from #define VOL_FFS_CLASS_NAME "VOL_FFS" static int superblocks[] = SBLOCKSEARCH; +static int g_vol_ffs_once; struct g_vol_ffs_softc { char * vol; @@ -144,6 +145,12 @@ g_vol_ffs_taste(struct g_class *mp, struct g_provider if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); + } + if (!g_vol_ffs_once) { + g_vol_ffs_once = 1; + printf( + "WARNING: geom_vol_Ffs (geom %s) is deprecated, " + "use glabel instead.\n", gp->name); } return (gp); } From owner-svn-src-head@freebsd.org Wed Aug 9 16:37:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29CB1DD0AF4; Wed, 9 Aug 2017 16:37:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBB557C3DE; Wed, 9 Aug 2017 16:37:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79Gbc87091519; Wed, 9 Aug 2017 16:37:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79Gbct7091518; Wed, 9 Aug 2017 16:37:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708091637.v79Gbct7091518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 9 Aug 2017 16:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322319 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 322319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 16:37:39 -0000 Author: imp Date: Wed Aug 9 16:37:37 2017 New Revision: 322319 URL: https://svnweb.freebsd.org/changeset/base/322319 Log: Also provide a warning for geom_fox. Differential Review: https://reviews.freebsd.org/D11935 Requested by: jhb@ MFC After: 3 days Modified: head/sys/geom/geom_fox.c Modified: head/sys/geom/geom_fox.c ============================================================================== --- head/sys/geom/geom_fox.c Wed Aug 9 16:15:24 2017 (r322318) +++ head/sys/geom/geom_fox.c Wed Aug 9 16:37:37 2017 (r322319) @@ -53,6 +53,8 @@ #define FOX_CLASS_NAME "FOX" #define FOX_MAGIC "GEOM::FOX" +static int g_fox_once; + FEATURE(geom_fox, "GEOM FOX redundant path mitigation support"); struct g_fox_softc { @@ -438,8 +440,15 @@ printf("fox %s lock %p\n", gp->name, &sc->lock); g_free(buf); g_access(cp, -1, 0, 0); - if (!LIST_EMPTY(&gp->provider)) + if (!LIST_EMPTY(&gp->provider)) { + if (!g_fox_once) { + g_fox_once = 1; + printf( + "WARNING: geom_fox (geom %s) is deprecated, " + "use gmultipath instead.\n", gp->name); + } return (gp); + } g_free(gp->softc); g_detach(cp); From owner-svn-src-head@freebsd.org Wed Aug 9 16:42:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C1FDDD0CCC; Wed, 9 Aug 2017 16:42:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEAEF7C948; Wed, 9 Aug 2017 16:42:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id B88D510AF07; Wed, 9 Aug 2017 12:41:56 -0400 (EDT) From: John Baldwin To: Jeremie Le Hen Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322277 - in head: tools/build/mk usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod Date: Wed, 09 Aug 2017 09:13:33 -0700 Message-ID: <57853544.8eSNM9xh9N@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201708082017.v78KH7av090655@repo.freebsd.org> References: <201708082017.v78KH7av090655@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 09 Aug 2017 12:41:56 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 16:42:13 -0000 On Tuesday, August 08, 2017 08:17:07 PM Jeremie Le Hen wrote: > Author: jlh > Date: Tue Aug 8 20:17:07 2017 > New Revision: 322277 > URL: https://svnweb.freebsd.org/changeset/base/322277 > > Log: > rwho/ruptime/rwhod shouldn't be gated by RCMDS. > > As peter@ points out in pr/220953: > "rwho, rwhod and ruptime are not part of the remote login suite (rsh, rlogin > etc). > > They should *not* be in the rcmds package which is disabled by default. We > rely on rwho/rwhod/ruptime in the freebsd.org cluster." > > This commit is a re-commit of r322029 and r322031 with a better commit log, as > pointed out by ngie@. > > This also includes the necesary changes to OptionalObsoleteFiles.inc, as > requested by jhb@. > > PR: 220953 > Reported by: peter@, jhb@ > Differential Revision: https://reviews.freebsd.org/D11743 You still need to fix the Makefiles that install /etc/rc.d/rwho and /etc/periodic/daily/140.clean-rwho to install those files unconditionally. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Aug 9 17:02:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA82ADD14C5; Wed, 9 Aug 2017 17:02:54 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) by mx1.freebsd.org (Postfix) with ESMTP id 3F7A97D3F6; Wed, 9 Aug 2017 17:02:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 To: Dexuan Cui , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Cc: Yanmin Qiao , Hongjiang Zhang References: <201708050656.v756uk48076256@repo.freebsd.org> From: Jung-uk Kim Message-ID: <331d02b4-a315-70e5-7fe9-2e767554a148@FreeBSD.org> Date: Wed, 9 Aug 2017 13:02:42 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 17:02:55 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW Content-Type: multipart/mixed; boundary="WDQBVTA42pmju0a29PpWBPQKg2FLjcBPJ"; protected-headers="v1" From: Jung-uk Kim To: Dexuan Cui , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Cc: Yanmin Qiao , Hongjiang Zhang Message-ID: <331d02b4-a315-70e5-7fe9-2e767554a148@FreeBSD.org> Subject: Re: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 References: <201708050656.v756uk48076256@repo.freebsd.org> In-Reply-To: --WDQBVTA42pmju0a29PpWBPQKg2FLjcBPJ Content-Type: multipart/mixed; boundary="------------370644EAE7D50A34E0B3E01F" Content-Language: en-US This is a multi-part message in MIME format. --------------370644EAE7D50A34E0B3E01F Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/09/2017 00:09, Dexuan Cui wrote: > Hi jkim, > The patch breaks FreeBSD VM on Hyper-V. >=20 > identify_hypervisor() is moved from identify_cpu() to an earlier place,= but the global=20 > variable cpu_feature2 used by the function is still initialized in iden= tify_cpu(). >=20 > I'm not sure about the background of your patch. Can you please have a = look? Can you please test the attached patch? Jung-uk Kim --------------370644EAE7D50A34E0B3E01F Content-Type: text/x-patch; name="cpuid.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cpuid.diff" Index: sys/amd64/amd64/machdep.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/amd64/amd64/machdep.c (revision 322319) +++ sys/amd64/amd64/machdep.c (working copy) @@ -1537,6 +1537,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) =20 kmdp =3D init_ops.parse_preload_data(modulep); =20 + identify_cpu(); identify_hypervisor(); =20 /* Init basic tunables, hz etc */ @@ -1643,7 +1644,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) !=3D NULL) vty_set_preferred(VTY_VT); =20 - identify_cpu(); /* Final stage of CPU initialization */ + finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ initializecpucache(); =20 Index: sys/i386/include/md_var.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/i386/include/md_var.h (revision 322319) +++ sys/i386/include/md_var.h (working copy) @@ -59,7 +59,6 @@ void doreti_popl_es(void) __asm(__STRING(doreti_po void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); -void finishidentcpu(void); void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); void i686_pagezero(void *addr); void sse2_pagezero(void *addr); Index: sys/x86/include/x86_var.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/x86/include/x86_var.h (revision 322319) +++ sys/x86/include/x86_var.h (working copy) @@ -115,6 +115,7 @@ void cpu_probe_amdc1e(void); void cpu_setregs(void); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); +void finishidentcpu(void); void identify_cpu(void); void identify_hypervisor(void); void initializecpu(void); Index: sys/x86/x86/identcpu.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/x86/x86/identcpu.c (revision 322319) +++ sys/x86/x86/identcpu.c (working copy) @@ -1372,23 +1372,12 @@ fix_cpuid(void) return (false); } =20 -/* - * Final stage of CPU identification. - */ -#ifdef __i386__ +#ifdef __amd64__ void -finishidentcpu(void) -#else -void identify_cpu(void) -#endif { - u_int regs[4], cpu_stdext_disable; -#ifdef __i386__ - u_char ccr3; -#endif + u_int regs[4]; =20 -#ifdef __amd64__ do_cpuid(0, regs); cpu_high =3D regs[0]; ((u_int *)&cpu_vendor)[0] =3D regs[1]; @@ -1401,8 +1390,20 @@ identify_cpu(void) cpu_procinfo =3D regs[1]; cpu_feature =3D regs[3]; cpu_feature2 =3D regs[2]; +} #endif =20 +/* + * Final stage of CPU identification. + */ +void +finishidentcpu(void) +{ + u_int regs[4], cpu_stdext_disable; +#ifdef __i386__ + u_char ccr3; +#endif + cpu_vendor_id =3D find_cpu_vendor_id(); =20 if (fix_cpuid()) { --------------370644EAE7D50A34E0B3E01F-- --WDQBVTA42pmju0a29PpWBPQKg2FLjcBPJ-- --icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEl1bqgKaRyqfWXu/CfJ+WJvzb8UYFAlmLQDIACgkQfJ+WJvzb 8Ub0pwf/T59R175CWocqyBfEXVKgvQj0xzk5nJPTvbSNknVvbn+aLNbcJq0qPflj fskzMxqWw8rfSGwtkJke8Up1VMwKBybT1b73f7Bq7TrBlkcp6YX2frsMaALjqHtu Dbrgz3RCDx+P99Hz9+GzwNqrI2sg276IMX/QD9fPtBZo0estB+oDC07TrEBq0wYx lzE4LDwBInoWwLBCgYm1WZOE8va0iANycEDULGQd7vWgDA9CKhxgM9sjYn7w8ay1 emPpx5/0HcUEN1EC4yOHu7jqfqYH1SzEezbGzZ/zeH22HErGOrCncVRwW3f6bTEB A2XI0NeWiha/3llOYxy8/N6FRNYSjQ== =wIVS -----END PGP SIGNATURE----- --icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW-- From owner-svn-src-head@freebsd.org Wed Aug 9 17:32:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 660B8DD1CE0; Wed, 9 Aug 2017 17:32:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1FD37E236; Wed, 9 Aug 2017 17:32:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79HWiVf015851; Wed, 9 Aug 2017 17:32:44 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79HWegF015814; Wed, 9 Aug 2017 17:32:40 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708091732.v79HWegF015814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 9 Aug 2017 17:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322320 - in head: contrib/libc++/include contrib/llvm/include/llvm/Analysis contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/Analysis contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGe... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/libc++/include contrib/llvm/include/llvm/Analysis contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/Analysis contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGen/SelectionDAG contrib/ll... X-SVN-Commit-Revision: 322320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 17:32:45 -0000 Author: dim Date: Wed Aug 9 17:32:39 2017 New Revision: 322320 URL: https://svnweb.freebsd.org/changeset/base/322320 Log: Upgrade our copies of clang, llvm and libc++ to r310316 from the upstream release_50 branch. MFC after: 2 months X-MFC-with: r321369 Modified: head/contrib/libc++/include/__bsd_locale_defaults.h head/contrib/libc++/include/__bsd_locale_fallbacks.h head/contrib/libc++/include/__locale head/contrib/libc++/include/mutex head/contrib/libc++/include/sstream head/contrib/llvm/include/llvm/Analysis/ValueTracking.h head/contrib/llvm/include/llvm/CodeGen/MachineFunction.h head/contrib/llvm/include/llvm/CodeGen/MachineInstr.h head/contrib/llvm/lib/Analysis/ValueTracking.cpp head/contrib/llvm/lib/CodeGen/BranchFolding.cpp head/contrib/llvm/lib/CodeGen/MachineFunction.cpp head/contrib/llvm/lib/CodeGen/MachineInstr.cpp head/contrib/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp head/contrib/llvm/lib/CodeGen/StackColoring.cpp head/contrib/llvm/lib/IR/ConstantFold.cpp head/contrib/llvm/lib/Object/COFFImportFile.cpp head/contrib/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp head/contrib/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp head/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td head/contrib/llvm/lib/Target/AArch64/AArch64MacroFusion.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Target/X86/X86InstrSSE.td head/contrib/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp head/contrib/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp head/contrib/llvm/lib/Transforms/Scalar/SCCP.cpp head/contrib/llvm/lib/Transforms/Utils/CloneModule.cpp head/contrib/llvm/tools/clang/include/clang/AST/StmtCXX.h head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def head/contrib/llvm/tools/clang/include/clang/Driver/Options.td head/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h head/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp head/contrib/llvm/tools/clang/lib/AST/StmtCXX.cpp head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/OpenBSD.cpp head/contrib/llvm/tools/clang/lib/Headers/avx2intrin.h head/contrib/llvm/tools/clang/lib/Headers/avx512fintrin.h head/contrib/llvm/tools/clang/lib/Headers/avxintrin.h head/contrib/llvm/tools/clang/lib/Headers/float.h head/contrib/llvm/tools/clang/lib/Sema/Sema.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp head/contrib/llvm/tools/clang/lib/Serialization/ASTReaderStmt.cpp head/contrib/llvm/tools/clang/lib/Serialization/ASTWriterStmt.cpp head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/lld/Config/Version.inc head/lib/clang/include/llvm/Support/VCSRevision.h Directory Properties: head/contrib/compiler-rt/ (props changed) head/contrib/libc++/ (props changed) head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) head/contrib/llvm/tools/lld/ (props changed) head/contrib/llvm/tools/lldb/ (props changed) Modified: head/contrib/libc++/include/__bsd_locale_defaults.h ============================================================================== --- head/contrib/libc++/include/__bsd_locale_defaults.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/libc++/include/__bsd_locale_defaults.h Wed Aug 9 17:32:39 2017 (r322320) @@ -15,6 +15,10 @@ #ifndef _LIBCPP_BSD_LOCALE_DEFAULTS_H #define _LIBCPP_BSD_LOCALE_DEFAULTS_H +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + #define __libcpp_mb_cur_max_l(loc) MB_CUR_MAX_L(loc) #define __libcpp_btowc_l(ch, loc) btowc_l(ch, loc) #define __libcpp_wctob_l(wch, loc) wctob_l(wch, loc) Modified: head/contrib/libc++/include/__bsd_locale_fallbacks.h ============================================================================== --- head/contrib/libc++/include/__bsd_locale_fallbacks.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/libc++/include/__bsd_locale_fallbacks.h Wed Aug 9 17:32:39 2017 (r322320) @@ -18,6 +18,10 @@ #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + _LIBCPP_BEGIN_NAMESPACE_STD inline _LIBCPP_ALWAYS_INLINE Modified: head/contrib/libc++/include/__locale ============================================================================== --- head/contrib/libc++/include/__locale Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/libc++/include/__locale Wed Aug 9 17:32:39 2017 (r322320) @@ -34,7 +34,7 @@ # include #elif defined(_NEWLIB_VERSION) # include -#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \ +#elif (defined(__APPLE__) || defined(__FreeBSD__) \ || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) # include #elif defined(__Fuchsia__) Modified: head/contrib/libc++/include/mutex ============================================================================== --- head/contrib/libc++/include/mutex Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/libc++/include/mutex Wed Aug 9 17:32:39 2017 (r322320) @@ -116,7 +116,7 @@ class scoped_lock // C++17 (public) using mutex_type = Mutex; // If MutexTypes... consists of the single type Mutex explicit scoped_lock(MutexTypes&... m); - scoped_lock(MutexTypes&... m, adopt_lock_t); + scoped_lock(adopt_lock_t, MutexTypes&... m); ~scoped_lock(); scoped_lock(scoped_lock const&) = delete; scoped_lock& operator=(scoped_lock const&) = delete; @@ -500,7 +500,7 @@ class _LIBCPP_TEMPLATE_VIS scoped_lock<_Mutex> { (publ ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();} _LIBCPP_INLINE_VISIBILITY - explicit scoped_lock(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) + explicit scoped_lock(adopt_lock_t, mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) : __m_(__m) {} scoped_lock(scoped_lock const&) = delete; @@ -522,7 +522,7 @@ class _LIBCPP_TEMPLATE_VIS scoped_lock (public) } _LIBCPP_INLINE_VISIBILITY - scoped_lock(_MArgs&... __margs, adopt_lock_t) + scoped_lock(adopt_lock_t, _MArgs&... __margs) : __t_(__margs...) { } Modified: head/contrib/libc++/include/sstream ============================================================================== --- head/contrib/libc++/include/sstream Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/libc++/include/sstream Wed Aug 9 17:32:39 2017 (r322320) @@ -249,7 +249,8 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_st template basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s, ios_base::openmode __wch) - : __hm_(0), + : __str_(__s.get_allocator()), + __hm_(0), __mode_(__wch) { str(__s); Modified: head/contrib/llvm/include/llvm/Analysis/ValueTracking.h ============================================================================== --- head/contrib/llvm/include/llvm/Analysis/ValueTracking.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/include/llvm/Analysis/ValueTracking.h Wed Aug 9 17:32:39 2017 (r322320) @@ -312,6 +312,12 @@ template class ArrayRef; const DataLayout &DL, LoopInfo *LI = nullptr, unsigned MaxLookup = 6); + /// This is a wrapper around GetUnderlyingObjects and adds support for basic + /// ptrtoint+arithmetic+inttoptr sequences. + void getUnderlyingObjectsForCodeGen(const Value *V, + SmallVectorImpl &Objects, + const DataLayout &DL); + /// Return true if the only users of this pointer are lifetime markers. bool onlyUsedByLifetimeMarkers(const Value *V); Modified: head/contrib/llvm/include/llvm/CodeGen/MachineFunction.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/MachineFunction.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/include/llvm/CodeGen/MachineFunction.h Wed Aug 9 17:32:39 2017 (r322320) @@ -661,6 +661,12 @@ class MachineFunction { (public) MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, int64_t Offset, uint64_t Size); + /// Allocate a new MachineMemOperand by copying an existing one, + /// replacing only AliasAnalysis information. MachineMemOperands are owned + /// by the MachineFunction and need not be explicitly deallocated. + MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, + const AAMDNodes &AAInfo); + using OperandCapacity = ArrayRecycler::Capacity; /// Allocate an array of MachineOperands. This is only intended for use by Modified: head/contrib/llvm/include/llvm/CodeGen/MachineInstr.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/MachineInstr.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/include/llvm/CodeGen/MachineInstr.h Wed Aug 9 17:32:39 2017 (r322320) @@ -379,6 +379,9 @@ class MachineInstr (public) return NumMemRefs == 1; } + /// Return the number of memory operands. + unsigned getNumMemOperands() const { return NumMemRefs; } + /// API for querying MachineInstr properties. They are the same as MCInstrDesc /// queries but they are bundle aware. Modified: head/contrib/llvm/lib/Analysis/ValueTracking.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ValueTracking.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Analysis/ValueTracking.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -3277,6 +3277,69 @@ void llvm::GetUnderlyingObjects(Value *V, SmallVectorI } while (!Worklist.empty()); } +/// This is the function that does the work of looking through basic +/// ptrtoint+arithmetic+inttoptr sequences. +static const Value *getUnderlyingObjectFromInt(const Value *V) { + do { + if (const Operator *U = dyn_cast(V)) { + // If we find a ptrtoint, we can transfer control back to the + // regular getUnderlyingObjectFromInt. + if (U->getOpcode() == Instruction::PtrToInt) + return U->getOperand(0); + // If we find an add of a constant, a multiplied value, or a phi, it's + // likely that the other operand will lead us to the base + // object. We don't have to worry about the case where the + // object address is somehow being computed by the multiply, + // because our callers only care when the result is an + // identifiable object. + if (U->getOpcode() != Instruction::Add || + (!isa(U->getOperand(1)) && + Operator::getOpcode(U->getOperand(1)) != Instruction::Mul && + !isa(U->getOperand(1)))) + return V; + V = U->getOperand(0); + } else { + return V; + } + assert(V->getType()->isIntegerTy() && "Unexpected operand type!"); + } while (true); +} + +/// This is a wrapper around GetUnderlyingObjects and adds support for basic +/// ptrtoint+arithmetic+inttoptr sequences. +void llvm::getUnderlyingObjectsForCodeGen(const Value *V, + SmallVectorImpl &Objects, + const DataLayout &DL) { + SmallPtrSet Visited; + SmallVector Working(1, V); + do { + V = Working.pop_back_val(); + + SmallVector Objs; + GetUnderlyingObjects(const_cast(V), Objs, DL); + + for (Value *V : Objs) { + if (!Visited.insert(V).second) + continue; + if (Operator::getOpcode(V) == Instruction::IntToPtr) { + const Value *O = + getUnderlyingObjectFromInt(cast(V)->getOperand(0)); + if (O->getType()->isPointerTy()) { + Working.push_back(O); + continue; + } + } + // If GetUnderlyingObjects fails to find an identifiable object, + // getUnderlyingObjectsForCodeGen also fails for safety. + if (!isIdentifiedObject(V)) { + Objects.clear(); + return; + } + Objects.push_back(const_cast(V)); + } + } while (!Working.empty()); +} + /// Return true if the only users of this pointer are lifetime markers. bool llvm::onlyUsedByLifetimeMarkers(const Value *V) { for (const User *U : V->users()) { Modified: head/contrib/llvm/lib/CodeGen/BranchFolding.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/BranchFolding.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/BranchFolding.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -1475,13 +1475,14 @@ ReoptimizeBlock: bool PredAnalyzable = !TII->analyzeBranch(*Pred, PredTBB, PredFBB, PredCond, true); - if (PredAnalyzable && !PredCond.empty() && PredTBB == MBB) { + if (PredAnalyzable && !PredCond.empty() && PredTBB == MBB && + PredTBB != PredFBB) { // The predecessor has a conditional branch to this block which consists // of only a tail call. Try to fold the tail call into the conditional // branch. if (TII->canMakeTailCallConditional(PredCond, TailCall)) { // TODO: It would be nice if analyzeBranch() could provide a pointer - // to the branch insturction so replaceBranchWithTailCall() doesn't + // to the branch instruction so replaceBranchWithTailCall() doesn't // have to search for it. TII->replaceBranchWithTailCall(*Pred, PredCond, TailCall); ++NumTailCalls; Modified: head/contrib/llvm/lib/CodeGen/MachineFunction.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/MachineFunction.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/MachineFunction.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -330,6 +330,20 @@ MachineFunction::getMachineMemOperand(const MachineMem MMO->getOrdering(), MMO->getFailureOrdering()); } +MachineMemOperand * +MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO, + const AAMDNodes &AAInfo) { + MachinePointerInfo MPI = MMO->getValue() ? + MachinePointerInfo(MMO->getValue(), MMO->getOffset()) : + MachinePointerInfo(MMO->getPseudoValue(), MMO->getOffset()); + + return new (Allocator) + MachineMemOperand(MPI, MMO->getFlags(), MMO->getSize(), + MMO->getBaseAlignment(), AAInfo, + MMO->getRanges(), MMO->getSyncScopeID(), + MMO->getOrdering(), MMO->getFailureOrdering()); +} + MachineInstr::mmo_iterator MachineFunction::allocateMemRefsArray(unsigned long Num) { return Allocator.Allocate(Num); Modified: head/contrib/llvm/lib/CodeGen/MachineInstr.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/MachineInstr.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/MachineInstr.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -578,10 +578,8 @@ bool MachinePointerInfo::isDereferenceable(unsigned Si if (BasePtr == nullptr) return false; - return isDereferenceableAndAlignedPointer(BasePtr, 1, - APInt(DL.getPointerSize(), - Offset + Size), - DL); + return isDereferenceableAndAlignedPointer( + BasePtr, 1, APInt(DL.getPointerSizeInBits(), Offset + Size), DL); } /// getConstantPool - Return a MachinePointerInfo record that refers to the Modified: head/contrib/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -121,63 +121,6 @@ ScheduleDAGInstrs::ScheduleDAGInstrs(MachineFunction & SchedModel.init(ST.getSchedModel(), &ST, TII); } -/// This is the function that does the work of looking through basic -/// ptrtoint+arithmetic+inttoptr sequences. -static const Value *getUnderlyingObjectFromInt(const Value *V) { - do { - if (const Operator *U = dyn_cast(V)) { - // If we find a ptrtoint, we can transfer control back to the - // regular getUnderlyingObjectFromInt. - if (U->getOpcode() == Instruction::PtrToInt) - return U->getOperand(0); - // If we find an add of a constant, a multiplied value, or a phi, it's - // likely that the other operand will lead us to the base - // object. We don't have to worry about the case where the - // object address is somehow being computed by the multiply, - // because our callers only care when the result is an - // identifiable object. - if (U->getOpcode() != Instruction::Add || - (!isa(U->getOperand(1)) && - Operator::getOpcode(U->getOperand(1)) != Instruction::Mul && - !isa(U->getOperand(1)))) - return V; - V = U->getOperand(0); - } else { - return V; - } - assert(V->getType()->isIntegerTy() && "Unexpected operand type!"); - } while (true); -} - -/// This is a wrapper around GetUnderlyingObjects and adds support for basic -/// ptrtoint+arithmetic+inttoptr sequences. -static void getUnderlyingObjects(const Value *V, - SmallVectorImpl &Objects, - const DataLayout &DL) { - SmallPtrSet Visited; - SmallVector Working(1, V); - do { - V = Working.pop_back_val(); - - SmallVector Objs; - GetUnderlyingObjects(const_cast(V), Objs, DL); - - for (Value *V : Objs) { - if (!Visited.insert(V).second) - continue; - if (Operator::getOpcode(V) == Instruction::IntToPtr) { - const Value *O = - getUnderlyingObjectFromInt(cast(V)->getOperand(0)); - if (O->getType()->isPointerTy()) { - Working.push_back(O); - continue; - } - } - Objects.push_back(const_cast(V)); - } - } while (!Working.empty()); -} - /// If this machine instr has memory reference information and it can be tracked /// to a normal reference to a known object, return the Value for that object. static void getUnderlyingObjectsForInstr(const MachineInstr *MI, @@ -208,12 +151,10 @@ static void getUnderlyingObjectsForInstr(const Machine Objects.push_back(UnderlyingObjectsVector::value_type(PSV, MayAlias)); } else if (const Value *V = MMO->getValue()) { SmallVector Objs; - getUnderlyingObjects(V, Objs, DL); + getUnderlyingObjectsForCodeGen(V, Objs, DL); for (Value *V : Objs) { - if (!isIdentifiedObject(V)) - return false; - + assert(isIdentifiedObject(V)); Objects.push_back(UnderlyingObjectsVector::value_type(V, true)); } } else Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -99,6 +99,27 @@ LimitFPPrecision("limit-float-precision", // store [4096 x i8] %data, [4096 x i8]* %buffer static const unsigned MaxParallelChains = 64; +// True if the Value passed requires ABI mangling as it is a parameter to a +// function or a return value from a function which is not an intrinsic. +static bool isABIRegCopy(const Value * V) { + const bool IsRetInst = V && isa(V); + const bool IsCallInst = V && isa(V); + const bool IsInLineAsm = + IsCallInst && static_cast(V)->isInlineAsm(); + const bool IsIndirectFunctionCall = + IsCallInst && !IsInLineAsm && + !static_cast(V)->getCalledFunction(); + // It is possible that the call instruction is an inline asm statement or an + // indirect function call in which case the return value of + // getCalledFunction() would be nullptr. + const bool IsInstrinsicCall = + IsCallInst && !IsInLineAsm && !IsIndirectFunctionCall && + static_cast(V)->getCalledFunction()->getIntrinsicID() != + Intrinsic::not_intrinsic; + + return IsRetInst || (IsCallInst && (!IsInLineAsm && !IsInstrinsicCall)); +} + static SDValue getCopyFromPartsVector(SelectionDAG &DAG, const SDLoc &DL, const SDValue *Parts, unsigned NumParts, MVT PartVT, EVT ValueVT, const Value *V, @@ -1026,13 +1047,9 @@ SDValue SelectionDAGBuilder::getCopyFromRegs(const Val if (It != FuncInfo.ValueMap.end()) { unsigned InReg = It->second; - bool IsABIRegCopy = - V && ((isa(V) && - !(static_cast(V))->isInlineAsm()) || - isa(V)); RegsForValue RFV(*DAG.getContext(), DAG.getTargetLoweringInfo(), - DAG.getDataLayout(), InReg, Ty, IsABIRegCopy); + DAG.getDataLayout(), InReg, Ty, isABIRegCopy(V)); SDValue Chain = DAG.getEntryNode(); Result = RFV.getCopyFromRegs(DAG, FuncInfo, getCurSDLoc(), Chain, nullptr, V); @@ -1221,13 +1238,9 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value // If this is an instruction which fast-isel has deferred, select it now. if (const Instruction *Inst = dyn_cast(V)) { unsigned InReg = FuncInfo.InitializeRegForValue(Inst); - bool IsABIRegCopy = - V && ((isa(V) && - !(static_cast(V))->isInlineAsm()) || - isa(V)); RegsForValue RFV(*DAG.getContext(), TLI, DAG.getDataLayout(), InReg, - Inst->getType(), IsABIRegCopy); + Inst->getType(), isABIRegCopy(V)); SDValue Chain = DAG.getEntryNode(); return RFV.getCopyFromRegs(DAG, FuncInfo, getCurSDLoc(), Chain, nullptr, V); } @@ -8281,13 +8294,9 @@ SelectionDAGBuilder::CopyValueToVirtualRegister(const const TargetLowering &TLI = DAG.getTargetLoweringInfo(); // If this is an InlineAsm we have to match the registers required, not the // notional registers required by the type. - bool IsABIRegCopy = - V && ((isa(V) && - !(static_cast(V))->isInlineAsm()) || - isa(V)); RegsForValue RFV(V->getContext(), TLI, DAG.getDataLayout(), Reg, - V->getType(), IsABIRegCopy); + V->getType(), isABIRegCopy(V)); SDValue Chain = DAG.getEntryNode(); ISD::NodeType ExtendType = (FuncInfo.PreferredExtendType.find(V) == Modified: head/contrib/llvm/lib/CodeGen/StackColoring.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/StackColoring.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/StackColoring.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -37,6 +37,7 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/PseudoSourceValue.h" +#include "llvm/CodeGen/SelectionDAGNodes.h" #include "llvm/CodeGen/SlotIndexes.h" #include "llvm/CodeGen/StackProtector.h" #include "llvm/CodeGen/WinEHFuncInfo.h" @@ -889,6 +890,10 @@ void StackColoring::remapInstructions(DenseMap Allocas; + + // Keep a list of allocas which has been affected by the remap. + SmallPtrSet MergedAllocas; + for (const std::pair &SI : SlotRemap) { const AllocaInst *From = MFI->getObjectAllocation(SI.first); const AllocaInst *To = MFI->getObjectAllocation(SI.second); @@ -908,6 +913,10 @@ void StackColoring::remapInstructions(DenseMapadjustForColoring(From, To); @@ -939,13 +948,6 @@ void StackColoring::remapInstructions(DenseMap(MMO->getValue()); @@ -997,6 +999,48 @@ void StackColoring::remapInstructions(DenseMapallocateMemRefsArray(I.getNumMemOperands()); + unsigned MemOpIdx = 0; + bool ReplaceMemOps = false; + for (MachineMemOperand *MMO : I.memoperands()) { + // If this memory location can be a slot remapped here, + // we remove AA information. + bool MayHaveConflictingAAMD = false; + if (MMO->getAAInfo()) { + if (const Value *MMOV = MMO->getValue()) { + SmallVector Objs; + getUnderlyingObjectsForCodeGen(MMOV, Objs, MF->getDataLayout()); + + if (Objs.empty()) + MayHaveConflictingAAMD = true; + else + for (Value *V : Objs) { + // If this memory location comes from a known stack slot + // that is not remapped, we continue checking. + // Otherwise, we need to invalidate AA infomation. + const AllocaInst *AI = dyn_cast_or_null(V); + if (AI && MergedAllocas.count(AI)) { + MayHaveConflictingAAMD = true; + break; + } + } + } + } + if (MayHaveConflictingAAMD) { + NewMemOps[MemOpIdx++] = MF->getMachineMemOperand(MMO, AAMDNodes()); + ReplaceMemOps = true; + } + else + NewMemOps[MemOpIdx++] = MMO; + } + + // If any memory operand is updated, set memory references of + // this instruction. + if (ReplaceMemOps) + I.setMemRefs(std::make_pair(NewMemOps, I.getNumMemOperands())); } // Update the location of C++ catch objects for the MSVC personality routine. Modified: head/contrib/llvm/lib/IR/ConstantFold.cpp ============================================================================== --- head/contrib/llvm/lib/IR/ConstantFold.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/IR/ConstantFold.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -2097,15 +2097,19 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *Pointe // Subsequent evaluation would get confused and produce erroneous results. // // The following prohibits such a GEP from being formed by checking to see - // if the index is in-range with respect to an array or vector. + // if the index is in-range with respect to an array. + // TODO: This code may be extended to handle vectors as well. bool PerformFold = false; if (Idx0->isNullValue()) PerformFold = true; else if (LastI.isSequential()) if (ConstantInt *CI = dyn_cast(Idx0)) - PerformFold = - !LastI.isBoundedSequential() || - isIndexInRangeOfArrayType(LastI.getSequentialNumElements(), CI); + PerformFold = (!LastI.isBoundedSequential() || + isIndexInRangeOfArrayType( + LastI.getSequentialNumElements(), CI)) && + !CE->getOperand(CE->getNumOperands() - 1) + ->getType() + ->isVectorTy(); if (PerformFold) { SmallVector NewIndices; Modified: head/contrib/llvm/lib/Object/COFFImportFile.cpp ============================================================================== --- head/contrib/llvm/lib/Object/COFFImportFile.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Object/COFFImportFile.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -542,15 +542,12 @@ NewArchiveMember ObjectFactory::createWeakExternal(Str SymbolTable[2].Name.Offset.Offset = sizeof(uint32_t); //__imp_ String Table - if (Imp) { - SymbolTable[3].Name.Offset.Offset = sizeof(uint32_t) + Sym.size() + 7; - writeStringTable(Buffer, {std::string("__imp_").append(Sym), - std::string("__imp_").append(Weak)}); - } else { - SymbolTable[3].Name.Offset.Offset = sizeof(uint32_t) + Sym.size() + 1; - writeStringTable(Buffer, {Sym, Weak}); - } + StringRef Prefix = Imp ? "__imp_" : ""; + SymbolTable[3].Name.Offset.Offset = + sizeof(uint32_t) + Sym.size() + Prefix.size() + 1; append(Buffer, SymbolTable); + writeStringTable(Buffer, {(Prefix + Sym).str(), + (Prefix + Weak).str()}); // Copied here so we can still use writeStringTable char *Buf = Alloc.Allocate(Buffer.size()); Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -946,6 +946,18 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock & case AArch64::CMP_SWAP_128: return expandCMP_SWAP_128(MBB, MBBI, NextMBBI); + case AArch64::AESMCrrTied: + case AArch64::AESIMCrrTied: { + MachineInstrBuilder MIB = + BuildMI(MBB, MBBI, MI.getDebugLoc(), + TII->get(Opcode == AArch64::AESMCrrTied ? AArch64::AESMCrr : + AArch64::AESIMCrr)) + .add(MI.getOperand(0)) + .add(MI.getOperand(1)); + transferImpOps(MI, MIB, MIB); + MI.eraseFromParent(); + return true; + } } return false; } Modified: head/contrib/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -506,19 +506,23 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio return; } - auto CSStackSize = AFI->getCalleeSavedStackSize(); + bool IsWin64 = + Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv()); + unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0; + + auto PrologueSaveSize = AFI->getCalleeSavedStackSize() + FixedObject; // All of the remaining stack allocations are for locals. - AFI->setLocalStackSize(NumBytes - CSStackSize); + AFI->setLocalStackSize(NumBytes - PrologueSaveSize); bool CombineSPBump = shouldCombineCSRLocalStackBump(MF, NumBytes); if (CombineSPBump) { emitFrameOffset(MBB, MBBI, DL, AArch64::SP, AArch64::SP, -NumBytes, TII, MachineInstr::FrameSetup); NumBytes = 0; - } else if (CSStackSize != 0) { + } else if (PrologueSaveSize != 0) { MBBI = convertCalleeSaveRestoreToSPPrePostIncDec(MBB, MBBI, DL, TII, - -CSStackSize); - NumBytes -= CSStackSize; + -PrologueSaveSize); + NumBytes -= PrologueSaveSize; } assert(NumBytes >= 0 && "Negative stack allocation size!?"); @@ -532,8 +536,9 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio ++MBBI; } if (HasFP) { - // Only set up FP if we actually need to. Frame pointer is fp = sp - 16. - int FPOffset = CSStackSize - 16; + // Only set up FP if we actually need to. Frame pointer is fp = + // sp - fixedobject - 16. + int FPOffset = AFI->getCalleeSavedStackSize() - 16; if (CombineSPBump) FPOffset += AFI->getLocalStackSize(); @@ -672,8 +677,8 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio if (HasFP) { // Define the current CFA rule to use the provided FP. unsigned Reg = RegInfo->getDwarfRegNum(FramePtr, true); - unsigned CFIIndex = MF.addFrameInst( - MCCFIInstruction::createDefCfa(nullptr, Reg, 2 * StackGrowth)); + unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa( + nullptr, Reg, 2 * StackGrowth - FixedObject)); BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex) .setMIFlags(MachineInstr::FrameSetup); @@ -759,12 +764,16 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio // AArch64TargetLowering::LowerCall figures out ArgumentPopSize and keeps // it as the 2nd argument of AArch64ISD::TC_RETURN. - auto CSStackSize = AFI->getCalleeSavedStackSize(); + bool IsWin64 = + Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv()); + unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0; + + auto PrologueSaveSize = AFI->getCalleeSavedStackSize() + FixedObject; bool CombineSPBump = shouldCombineCSRLocalStackBump(MF, NumBytes); - if (!CombineSPBump && CSStackSize != 0) + if (!CombineSPBump && PrologueSaveSize != 0) convertCalleeSaveRestoreToSPPrePostIncDec( - MBB, std::prev(MBB.getFirstTerminator()), DL, TII, CSStackSize); + MBB, std::prev(MBB.getFirstTerminator()), DL, TII, PrologueSaveSize); // Move past the restores of the callee-saved registers. MachineBasicBlock::iterator LastPopI = MBB.getFirstTerminator(); @@ -786,7 +795,7 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio return; } - NumBytes -= CSStackSize; + NumBytes -= PrologueSaveSize; assert(NumBytes >= 0 && "Negative stack allocation size!?"); if (!hasFP(MF)) { @@ -796,7 +805,7 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio if (RedZone && ArgumentPopSize == 0) return; - bool NoCalleeSaveRestore = CSStackSize == 0; + bool NoCalleeSaveRestore = PrologueSaveSize == 0; int StackRestoreBytes = RedZone ? 0 : NumBytes; if (NoCalleeSaveRestore) StackRestoreBytes += ArgumentPopSize; @@ -815,7 +824,8 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio // be able to save any instructions. if (MFI.hasVarSizedObjects() || AFI->isStackRealigned()) emitFrameOffset(MBB, LastPopI, DL, AArch64::SP, AArch64::FP, - -CSStackSize + 16, TII, MachineInstr::FrameDestroy); + -AFI->getCalleeSavedStackSize() + 16, TII, + MachineInstr::FrameDestroy); else if (NumBytes) emitFrameOffset(MBB, LastPopI, DL, AArch64::SP, AArch64::SP, NumBytes, TII, MachineInstr::FrameDestroy); @@ -845,7 +855,11 @@ int AArch64FrameLowering::resolveFrameIndexReference(c const AArch64RegisterInfo *RegInfo = static_cast( MF.getSubtarget().getRegisterInfo()); const AArch64FunctionInfo *AFI = MF.getInfo(); - int FPOffset = MFI.getObjectOffset(FI) + 16; + const AArch64Subtarget &Subtarget = MF.getSubtarget(); + bool IsWin64 = + Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv()); + unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0; + int FPOffset = MFI.getObjectOffset(FI) + FixedObject + 16; int Offset = MFI.getObjectOffset(FI) + MFI.getStackSize(); bool isFixed = MFI.isFixedObjectIndex(FI); @@ -955,12 +969,6 @@ static void computeCalleeSaveRegisterPairs( (Count & 1) == 0) && "Odd number of callee-saved regs to spill!"); int Offset = AFI->getCalleeSavedStackSize(); - - unsigned GPRSaveSize = AFI->getVarArgsGPRSize(); - const AArch64Subtarget &Subtarget = MF.getSubtarget(); - bool IsWin64 = Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv()); - if (IsWin64) - Offset -= alignTo(GPRSaveSize, 16); for (unsigned i = 0; i < Count; ++i) { RegPairInfo RPI; Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -9586,8 +9586,8 @@ static bool performTBISimplification(SDValue Addr, SelectionDAG &DAG) { APInt DemandedMask = APInt::getLowBitsSet(64, 56); KnownBits Known; - TargetLowering::TargetLoweringOpt TLO(DAG, DCI.isBeforeLegalize(), - DCI.isBeforeLegalizeOps()); + TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(), + !DCI.isBeforeLegalizeOps()); const TargetLowering &TLI = DAG.getTargetLoweringInfo(); if (TLI.SimplifyDemandedBits(Addr, DemandedMask, Known, TLO)) { DCI.CommitTargetLoweringOpt(TLO); Modified: head/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td Wed Aug 9 17:32:39 2017 (r322320) @@ -37,6 +37,9 @@ def HasFullFP16 : Predicate<"Subtarget->hasFullFP AssemblerPredicate<"FeatureFullFP16", "fullfp16">; def HasSPE : Predicate<"Subtarget->hasSPE()">, AssemblerPredicate<"FeatureSPE", "spe">; +def HasFuseAES : Predicate<"Subtarget->hasFuseAES()">, + AssemblerPredicate<"FeatureFuseAES", + "fuse-aes">; def HasSVE : Predicate<"Subtarget->hasSVE()">, AssemblerPredicate<"FeatureSVE", "sve">; @@ -5303,6 +5306,31 @@ def AESErr : AESTiedInst<0b0100, "aese", int_aarch def AESDrr : AESTiedInst<0b0101, "aesd", int_aarch64_crypto_aesd>; def AESMCrr : AESInst< 0b0110, "aesmc", int_aarch64_crypto_aesmc>; def AESIMCrr : AESInst< 0b0111, "aesimc", int_aarch64_crypto_aesimc>; + +// Pseudo instructions for AESMCrr/AESIMCrr with a register constraint required +// for AES fusion on some CPUs. +let hasSideEffects = 0, mayStore = 0, mayLoad = 0 in { +def AESMCrrTied: Pseudo<(outs V128:$Rd), (ins V128:$Rn), [], "$Rn = $Rd">, + Sched<[WriteV]>; +def AESIMCrrTied: Pseudo<(outs V128:$Rd), (ins V128:$Rn), [], "$Rn = $Rd">, + Sched<[WriteV]>; +} + +// Only use constrained versions of AES(I)MC instructions if they are paired with +// AESE/AESD. +def : Pat<(v16i8 (int_aarch64_crypto_aesmc + (v16i8 (int_aarch64_crypto_aese (v16i8 V128:$src1), + (v16i8 V128:$src2))))), + (v16i8 (AESMCrrTied (v16i8 (AESErr (v16i8 V128:$src1), + (v16i8 V128:$src2)))))>, + Requires<[HasFuseAES]>; + +def : Pat<(v16i8 (int_aarch64_crypto_aesimc + (v16i8 (int_aarch64_crypto_aesd (v16i8 V128:$src1), + (v16i8 V128:$src2))))), + (v16i8 (AESIMCrrTied (v16i8 (AESDrr (v16i8 V128:$src1), + (v16i8 V128:$src2)))))>, + Requires<[HasFuseAES]>; def SHA1Crrr : SHATiedInstQSV<0b000, "sha1c", int_aarch64_crypto_sha1c>; def SHA1Prrr : SHATiedInstQSV<0b001, "sha1p", int_aarch64_crypto_sha1p>; Modified: head/contrib/llvm/lib/Target/AArch64/AArch64MacroFusion.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64MacroFusion.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/AArch64/AArch64MacroFusion.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -118,11 +118,13 @@ static bool shouldScheduleAdjacent(const TargetInstrIn // Fuse AES crypto operations. switch(SecondOpcode) { // AES encode. - case AArch64::AESMCrr : + case AArch64::AESMCrr: + case AArch64::AESMCrrTied: return FirstOpcode == AArch64::AESErr || FirstOpcode == AArch64::INSTRUCTION_LIST_END; // AES decode. case AArch64::AESIMCrr: + case AArch64::AESIMCrrTied: return FirstOpcode == AArch64::AESDrr || FirstOpcode == AArch64::INSTRUCTION_LIST_END; } Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -3984,6 +3984,13 @@ bool MatchingStackOffset(SDValue Arg, unsigned Offset, if (Offset != MFI.getObjectOffset(FI)) return false; + // If this is not byval, check that the argument stack object is immutable. + // inalloca and argument copy elision can create mutable argument stack + // objects. Byval objects can be mutated, but a byval call intends to pass the + // mutated memory. + if (!Flags.isByVal() && !MFI.isImmutableObjectIndex(FI)) + return false; + if (VA.getLocVT().getSizeInBits() > Arg.getValueSizeInBits()) { // If the argument location is wider than the argument type, check that any // extension flags match. @@ -30605,8 +30612,8 @@ static SDValue combineSelect(SDNode *N, SelectionDAG & assert(BitWidth >= 8 && BitWidth <= 64 && "Invalid mask size"); APInt DemandedMask(APInt::getSignMask(BitWidth)); KnownBits Known; - TargetLowering::TargetLoweringOpt TLO(DAG, DCI.isBeforeLegalize(), - DCI.isBeforeLegalizeOps()); + TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(), + !DCI.isBeforeLegalizeOps()); if (TLI.ShrinkDemandedConstant(Cond, DemandedMask, TLO) || TLI.SimplifyDemandedBits(Cond, DemandedMask, Known, TLO)) { // If we changed the computation somewhere in the DAG, this change will Modified: head/contrib/llvm/lib/Target/X86/X86InstrSSE.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrSSE.td Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/X86/X86InstrSSE.td Wed Aug 9 17:32:39 2017 (r322320) @@ -3697,8 +3697,7 @@ let SchedRW = [WriteNop] in { // Pause. This "instruction" is encoded as "rep; nop", so even though it // was introduced with SSE2, it's backward compatible. def PAUSE : I<0x90, RawFrm, (outs), (ins), - "pause", [(int_x86_sse2_pause)], IIC_SSE_PAUSE>, - OBXS, Requires<[HasSSE2]>; + "pause", [(int_x86_sse2_pause)], IIC_SSE_PAUSE>, OBXS; } let SchedRW = [WriteFence] in { Modified: head/contrib/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -356,7 +356,7 @@ doPromotion(Function *F, SmallPtrSetImpl & // Just add all the struct element types. Type *AgTy = cast(I->getType())->getElementType(); Value *TheAlloca = new AllocaInst(AgTy, DL.getAllocaAddrSpace(), nullptr, - "", InsertPt); + I->getParamAlignment(), "", InsertPt); StructType *STy = cast(AgTy); Value *Idxs[2] = {ConstantInt::get(Type::getInt32Ty(F->getContext()), 0), nullptr}; Modified: head/contrib/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -756,7 +756,8 @@ struct FunctionStackPoisoner : public InstVisitor llvm::CloneModule( SmallVector, 1> MDs; I->getAllMetadata(MDs); for (auto MD : MDs) - GV->addMetadata(MD.first, *MapMetadata(MD.second, VMap)); + GV->addMetadata(MD.first, + *MapMetadata(MD.second, VMap, RF_MoveDistinctMDs)); copyComdat(GV, &*I); } Modified: head/contrib/llvm/tools/clang/include/clang/AST/StmtCXX.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/AST/StmtCXX.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/include/clang/AST/StmtCXX.h Wed Aug 9 17:32:39 2017 (r322320) @@ -317,6 +317,7 @@ class CoroutineBodyStmt final unsigned NumParams; friend class ASTStmtReader; + friend class ASTReader; friend TrailingObjects; Stmt **getStoredStmts() { return getTrailingObjects(); } @@ -347,6 +348,8 @@ class CoroutineBodyStmt final public: static CoroutineBodyStmt *Create(const ASTContext &C, CtorArgs const &Args); + static CoroutineBodyStmt *Create(const ASTContext &C, EmptyShell, + unsigned NumParams); bool hasDependentPromiseType() const { return getPromiseDecl()->getType()->isDependentType(); @@ -443,6 +446,8 @@ class CoreturnStmt : public Stmt { (public) SubStmts[SubStmt::Operand] = Operand; SubStmts[SubStmt::PromiseCall] = PromiseCall; } + + CoreturnStmt(EmptyShell) : CoreturnStmt({}, {}, {}) {} SourceLocation getKeywordLoc() const { return CoreturnLoc; } Modified: head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def Wed Aug 9 17:32:39 2017 (r322320) @@ -338,8 +338,8 @@ TARGET_BUILTIN(__builtin_ia32_lfence, "v", "", "sse2") TARGET_HEADER_BUILTIN(_mm_lfence, "v", "h", "emmintrin.h", ALL_LANGUAGES, "sse2") TARGET_BUILTIN(__builtin_ia32_mfence, "v", "", "sse2") TARGET_HEADER_BUILTIN(_mm_mfence, "v", "h", "emmintrin.h", ALL_LANGUAGES, "sse2") -TARGET_BUILTIN(__builtin_ia32_pause, "v", "", "sse2") -TARGET_HEADER_BUILTIN(_mm_pause, "v", "h", "emmintrin.h", ALL_LANGUAGES, "sse2") +TARGET_BUILTIN(__builtin_ia32_pause, "v", "", "") +TARGET_HEADER_BUILTIN(_mm_pause, "v", "h", "emmintrin.h", ALL_LANGUAGES, "") TARGET_BUILTIN(__builtin_ia32_pmuludq128, "V2LLiV4iV4i", "", "sse2") TARGET_BUILTIN(__builtin_ia32_psraw128, "V8sV8sV8s", "", "sse2") TARGET_BUILTIN(__builtin_ia32_psrad128, "V4iV4iV4i", "", "sse2") Modified: head/contrib/llvm/tools/clang/include/clang/Driver/Options.td ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Driver/Options.td Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/include/clang/Driver/Options.td Wed Aug 9 17:32:39 2017 (r322320) @@ -2019,10 +2019,6 @@ def mdspr2 : Flag<["-"], "mdspr2">, Group; def mno_dspr2 : Flag<["-"], "mno-dspr2">, Group; def msingle_float : Flag<["-"], "msingle-float">, Group; def mdouble_float : Flag<["-"], "mdouble-float">, Group; -def mmadd4 : Flag<["-"], "mmadd4">, Group, - HelpText<"Enable the generation of 4-operand madd.s, madd.d and related instructions.">; -def mno_madd4 : Flag<["-"], "mno-madd4">, Group, - HelpText<"Disable the generation of 4-operand madd.s, madd.d and related instructions.">; def mmsa : Flag<["-"], "mmsa">, Group, HelpText<"Enable MSA ASE (MIPS only)">; def mno_msa : Flag<["-"], "mno-msa">, Group, Modified: head/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h Wed Aug 9 17:32:39 2017 (r322320) @@ -1545,9 +1545,14 @@ namespace clang { // ARC EXPR_OBJC_BRIDGED_CAST, // ObjCBridgedCastExpr - + STMT_MS_DEPENDENT_EXISTS, // MSDependentExistsStmt - EXPR_LAMBDA // LambdaExpr + EXPR_LAMBDA, // LambdaExpr + STMT_COROUTINE_BODY, + STMT_CORETURN, + EXPR_COAWAIT, + EXPR_COYIELD, + EXPR_DEPENDENT_COAWAIT, }; /// \brief The kinds of designators that can occur in a Modified: head/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -378,8 +378,12 @@ void ODRHash::AddCXXRecordDecl(const CXXRecordDecl *Re assert(Record && Record->hasDefinition() && "Expected non-null record to be a definition."); - if (isa(Record)) { - return; + const DeclContext *DC = Record; + while (DC) { + if (isa(DC)) { + return; + } + DC = DC->getParent(); } AddDecl(Record); Modified: head/contrib/llvm/tools/clang/lib/AST/StmtCXX.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/AST/StmtCXX.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/lib/AST/StmtCXX.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -96,6 +96,20 @@ CoroutineBodyStmt *CoroutineBodyStmt::Create( return new (Mem) CoroutineBodyStmt(Args); } +CoroutineBodyStmt *CoroutineBodyStmt::Create(const ASTContext &C, EmptyShell, + unsigned NumParams) { + std::size_t Size = totalSizeToAlloc( + CoroutineBodyStmt::FirstParamMove + NumParams); + + void *Mem = C.Allocate(Size, alignof(CoroutineBodyStmt)); + auto *Result = new (Mem) CoroutineBodyStmt(CtorArgs()); + Result->NumParams = NumParams; + auto *ParamBegin = Result->getStoredStmts() + SubStmt::FirstParamMove; + std::uninitialized_fill(ParamBegin, ParamBegin + NumParams, + static_cast(nullptr)); + return Result; +} + CoroutineBodyStmt::CoroutineBodyStmt(CoroutineBodyStmt::CtorArgs const &Args) : Stmt(CoroutineBodyStmtClass), NumParams(Args.ParamMoves.size()) { Stmt **SubStmts = getStoredStmts(); Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -8050,7 +8050,6 @@ class MipsTargetInfo : public TargetInfo { NoDSP, DSP1, DSP2 } DspRev; bool HasMSA; - bool DisableMadd4; protected: bool HasFP64; @@ -8061,7 +8060,7 @@ class MipsTargetInfo : public TargetInfo { : TargetInfo(Triple), IsMips16(false), IsMicromips(false), IsNan2008(false), IsSingleFloat(false), IsNoABICalls(false), CanUseBSDABICalls(false), FloatABI(HardFloat), DspRev(NoDSP), - HasMSA(false), DisableMadd4(false), HasFP64(false) { + HasMSA(false), HasFP64(false) { TheCXXABI.set(TargetCXXABI::GenericMIPS); setABI((getTriple().getArch() == llvm::Triple::mips || @@ -8307,9 +8306,6 @@ class MipsTargetInfo : public TargetInfo { if (HasMSA) Builder.defineMacro("__mips_msa", Twine(1)); - if (DisableMadd4) - Builder.defineMacro("__mips_no_madd4", Twine(1)); - Builder.defineMacro("_MIPS_SZPTR", Twine(getPointerWidth(0))); Builder.defineMacro("_MIPS_SZINT", Twine(getIntWidth())); Builder.defineMacro("_MIPS_SZLONG", Twine(getLongWidth())); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Aug 9 17:34:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 070F7DD1DF5; Wed, 9 Aug 2017 17:34:50 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from APC01-PU1-obe.outbound.protection.outlook.com (mail-pu1apc01on0119.outbound.protection.outlook.com [104.47.126.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 43E8E7E419; Wed, 9 Aug 2017 17:34:48 +0000 (UTC) (envelope-from decui@microsoft.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sIm3DsVbZhJrqNPJQ/E9H/Tdbt+CJ/sVtn9J6ffIxXw=; b=ZdJHsNOdV3xrlbEKuXz3678zbkAPth8txhE663tUZ5P6HviA7bAwERIr0tXJFcJiQ9ivUztttxpU7//kTIJcSQa52CBewfXigy1Oin0exCIYNQQ9i1hnHYQscx67zIGFzKcpn950K0KHIbheQDYPSU/q2GEfCNQp7nihGv8OKdQ= Received: from KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM (10.170.167.145) by KL1P15301MB0086.APCP153.PROD.OUTLOOK.COM (10.170.164.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.4; Wed, 9 Aug 2017 17:34:41 +0000 Received: from KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM ([10.170.167.145]) by KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM ([10.170.167.145]) with mapi id 15.01.1362.006; Wed, 9 Aug 2017 17:34:40 +0000 From: Dexuan Cui To: Jung-uk Kim , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" CC: Yanmin Qiao , Hongjiang Zhang Subject: RE: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 Thread-Topic: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 Thread-Index: AQHTDbgLhcqLEIRH8UKGIazjERHYm6J7bHlAgADatwCAAAhoUA== Date: Wed, 9 Aug 2017 17:34:39 +0000 Message-ID: References: <201708050656.v756uk48076256@repo.freebsd.org> <331d02b4-a315-70e5-7fe9-2e767554a148@FreeBSD.org> In-Reply-To: <331d02b4-a315-70e5-7fe9-2e767554a148@FreeBSD.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Ref=https://api.informationprotection.azure.com/api/72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=decui@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2017-08-09T10:34:37.2441482-07:00; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [167.220.1.135] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; KL1P15301MB0086; 6:urOIieXJtcvY9zexK44h8PLW01uRwmKDqi3+kNNri6UdPCaoYx+lOWRo9zz4wa1cRg9tfXyY1NdsVmpIC44EAF155sTHDgCTwfiQt/gIgxDuy3ebyjGG+Aut8RHti9zvtGhqblCgExtsjNg5nQuf7ySkcDT3vTdJRnn2+k9G02Ks7zHw+GEqy2A7GMsQ/s5R81P34NKIjch5c0xZF4a/IAZmHNR2zdC5/8HVRp0sxuzPHwutQYiyVytLUj++e67wXyHsG3CgN9DzFOprkE8pvq+K5xWGwS4wlnRWCRorrq+g7iSKd1HnpZ4ULFlwpP0iwd3rwHoQOpvVjM8nnFH2xg==; 5:WaXXGW5IU1OHGQh3Vz3TjisN42kspDF1Mnw/Wa3+nJH+BlpvJeriM1scBrLXRJUCA6rqyuCK4+7bdotJougyDvLy21wxakf02Z0Qvh1JMKn6h7A7dfvmCTOGJZCWZbnj/XO/P3qFgahttNKT8IWVkQ==; 24:tVp0HLhA1qWXLrlJ5PtlpE+AyzaEEtYmV0en1su2ta/oQMwgAqS9kXPS4ZKg+jW9hj4YiICle0NXbE5J5jT6kcn7i1xtqU3nKBw4r6PvtCk=; 7:yp160NEANd/AiV+SW7KMRc35RIxt11SoWUo5bnP+aUBFZXursks7+2pED+31hL1n32iGc3DOTDC4RFtAhDHjg6+pR58qXNxpdaw5goaIIG1aQEB8i3QymK4Tdexxtyqep1TypyvCyvypx6ZNt9CZqpccmlxUYJuaIdq57JB/qjNzllzlP5+1UB/PDsmIwT1Wsxizz33etEHdEUKvSw2BxPYDBJspXvctv6KlgrQdvoc= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(6009001)(39850400002)(39410400002)(39840400002)(39450400003)(39400400002)(39860400002)(47760400005)(189002)(199003)(51914003)(24454002)(68736007)(8936002)(5005710100001)(107886003)(38730400002)(2906002)(2201001)(14454004)(33656002)(2501003)(2900100001)(5890100001)(6246003)(3846002)(6116002)(102836003)(189998001)(10090500001)(7736002)(229853002)(77096006)(4326008)(450100002)(6506006)(6436002)(8990500004)(5660300001)(25786009)(76176999)(54356999)(81166006)(50986999)(66066001)(10290500003)(86612001)(54906002)(53546010)(2950100002)(3280700002)(305945005)(3660700001)(7696004)(106356001)(8676002)(81156014)(74316002)(53936002)(105586002)(86362001)(101416001)(97736004)(9686003)(55016002)(478600001); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1P15301MB0086; H:KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: 763ac651-0cb2-4701-d959-08d4df4cea21 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:KL1P15301MB0086; x-ms-traffictypediagnostic: KL1P15301MB0086: x-exchange-antispam-report-test: UriScan:(89211679590171); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(61425038)(6040450)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(6055026)(61426038)(61427038)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:KL1P15301MB0086; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:KL1P15301MB0086; x-forefront-prvs: 0394259C80 received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Aug 2017 17:34:39.5520 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1P15301MB0086 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 17:34:50 -0000 PiBGcm9tOiBvd25lci1zcmMtY29tbWl0dGVyc0BmcmVlYnNkLm9yZyBbbWFpbHRvOm93bmVyLXNy Yy0NCj4gY29tbWl0dGVyc0BmcmVlYnNkLm9yZ10gT24gQmVoYWxmIE9mIEp1bmctdWsgS2ltDQo+ IFNlbnQ6IFdlZG5lc2RheSwgQXVndXN0IDksIDIwMTcgMTA6MDMNCj4gVG86IERleHVhbiBDdWkg PGRlY3VpQG1pY3Jvc29mdC5jb20+OyBzcmMtY29tbWl0dGVyc0BmcmVlYnNkLm9yZzsgc3ZuLXNy Yy0NCj4gYWxsQGZyZWVic2Qub3JnOyBzdm4tc3JjLWhlYWRAZnJlZWJzZC5vcmcNCj4gQ2M6IFlh bm1pbiBRaWFvIDx5YXFpYUBtaWNyb3NvZnQuY29tPjsgSG9uZ2ppYW5nIFpoYW5nDQo+IDxob256 aGFuQG1pY3Jvc29mdC5jb20+DQo+IFN1YmplY3Q6IFJlOiBzdm4gY29tbWl0OiByMzIyMDc2IC0g aW4gaGVhZC9zeXM6IGFtZDY0L2FtZDY0IGkzODYvaTM4Ng0KPiB4ODYvaW5jbHVkZSB4ODYveDg2 DQo+IA0KPiBPbiAwOC8wOS8yMDE3IDAwOjA5LCBEZXh1YW4gQ3VpIHdyb3RlOg0KPiA+IEhpIGpr aW0sDQo+ID4gVGhlIHBhdGNoIGJyZWFrcyBGcmVlQlNEIFZNIG9uIEh5cGVyLVYuDQo+ID4NCj4g PiBpZGVudGlmeV9oeXBlcnZpc29yKCkgaXMgbW92ZWQgZnJvbSBpZGVudGlmeV9jcHUoKSB0byBh biBlYXJsaWVyIHBsYWNlLCBidXQgdGhlDQo+IGdsb2JhbA0KPiA+IHZhcmlhYmxlIGNwdV9mZWF0 dXJlMiB1c2VkIGJ5IHRoZSBmdW5jdGlvbiBpcyBzdGlsbCBpbml0aWFsaXplZCBpbiBpZGVudGlm eV9jcHUoKS4NCj4gPg0KPiA+IEknbSBub3Qgc3VyZSBhYm91dCB0aGUgYmFja2dyb3VuZCBvZiB5 b3VyIHBhdGNoLiBDYW4geW91IHBsZWFzZSBoYXZlIGEgbG9vaz8NCj4gDQo+IENhbiB5b3UgcGxl YXNlIHRlc3QgdGhlIGF0dGFjaGVkIHBhdGNoPw0KPiANCj4gSnVuZy11ayBLaW0NCg0KSSB0ZXN0 ZWQgdGhlIHBhdGNoIG9ubHkgd2l0aCBteSAgeDg2XzY0IFZNLCBhbmQgaXQgd29ya2VkLiAgDQoN ClRoYW5rcyBmb3IgdGhlIHF1aWNrIGZpeCENCg0KLS0gRGV4dWFuDQoNCg== From owner-svn-src-head@freebsd.org Wed Aug 9 17:48:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7859DDD2254; Wed, 9 Aug 2017 17:48:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 476917EADF; Wed, 9 Aug 2017 17:48:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79HmcPN019967; Wed, 9 Aug 2017 17:48:38 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79HmcP7019966; Wed, 9 Aug 2017 17:48:38 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201708091748.v79HmcP7019966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 9 Aug 2017 17:48:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322321 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 17:48:39 -0000 Author: glebius Date: Wed Aug 9 17:48:38 2017 New Revision: 322321 URL: https://svnweb.freebsd.org/changeset/base/322321 Log: Plug uninitialized stack variable leak in sendfile(2). Reported by: Ilja Van Sprundel Submitted by: Domagoj Stolfa MFC after: 1 week Security: uninitialized stack variable leak Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Wed Aug 9 17:32:39 2017 (r322320) +++ head/sys/kern/kern_sendfile.c Wed Aug 9 17:48:38 2017 (r322321) @@ -945,6 +945,7 @@ sendfile(struct thread *td, struct sendfile_args *uap, if (uap->offset < 0) return (EINVAL); + sbytes = 0; hdr_uio = trl_uio = NULL; if (uap->hdtr != NULL) { From owner-svn-src-head@freebsd.org Wed Aug 9 18:06:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F547DD2792; Wed, 9 Aug 2017 18:06:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27F757F38A; Wed, 9 Aug 2017 18:06:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79I6SHH028197; Wed, 9 Aug 2017 18:06:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79I6SAf028195; Wed, 9 Aug 2017 18:06:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708091806.v79I6SAf028195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 18:06:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322322 - head/lib/libusb X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libusb X-SVN-Commit-Revision: 322322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 18:06:29 -0000 Author: kevans Date: Wed Aug 9 18:06:27 2017 New Revision: 322322 URL: https://svnweb.freebsd.org/changeset/base/322322 Log: libusb(3): Expose device caps as libusb_bos_descriptor::dev_capability Some libusb consumers in Linux-land (in this case, libusb4java) expect a dev_capability member that they can use to enumerate the device capabilities. No particular layout is expected of this, just that it can be traversed using the bLength member until bNumDeviceCapabilities are read and that the consumer may then use one of the libusb_get_*_descriptor methods to extract specific (usb 2.0 vs. ss) capability information. In collaboration with: hselasky Reviewed by: hselasky Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11494 Modified: head/lib/libusb/libusb.h head/lib/libusb/libusb10_desc.c Modified: head/lib/libusb/libusb.h ============================================================================== --- head/lib/libusb/libusb.h Wed Aug 9 17:48:38 2017 (r322321) +++ head/lib/libusb/libusb.h Wed Aug 9 18:06:27 2017 (r322322) @@ -388,6 +388,7 @@ typedef struct libusb_bos_descriptor { uint8_t bNumDeviceCapabilities; struct libusb_usb_2_0_device_capability_descriptor *usb_2_0_ext_cap; struct libusb_ss_usb_device_capability_descriptor *ss_usb_cap; + struct libusb_bos_dev_capability_descriptor **dev_capability; } libusb_bos_descriptor __aligned(sizeof(void *)); typedef struct libusb_usb_2_0_extension_descriptor { Modified: head/lib/libusb/libusb10_desc.c ============================================================================== --- head/lib/libusb/libusb10_desc.c Wed Aug 9 17:48:38 2017 (r322321) +++ head/lib/libusb/libusb10_desc.c Wed Aug 9 18:06:27 2017 (r322322) @@ -433,6 +433,7 @@ libusb_parse_bos_descriptor(const void *buf, int len, struct libusb_bos_descriptor *ptr; struct libusb_usb_2_0_device_capability_descriptor *dcap_20 = NULL; struct libusb_ss_usb_device_capability_descriptor *ss_cap = NULL; + uint8_t index = 0; if (buf == NULL || bos == NULL || len < 1) return (LIBUSB_ERROR_INVALID_PARAM); @@ -453,7 +454,8 @@ libusb_parse_bos_descriptor(const void *buf, int len, break; if (dlen >= LIBUSB_DT_BOS_SIZE && - dtype == LIBUSB_DT_BOS) { + dtype == LIBUSB_DT_BOS && + ptr == NULL) { ptr = malloc(sizeof(*ptr) + sizeof(*dcap_20) + sizeof(*ss_cap)); @@ -470,6 +472,11 @@ libusb_parse_bos_descriptor(const void *buf, int len, ptr->bNumDeviceCapabilities = ((const uint8_t *)buf)[4]; ptr->usb_2_0_ext_cap = NULL; ptr->ss_usb_cap = NULL; + ptr->dev_capability = calloc(ptr->bNumDeviceCapabilities, sizeof(void *)); + if (ptr->dev_capability == NULL) { + free(ptr); + return (LIBUSB_ERROR_NO_MEM); + } dcap_20 = (void *)(ptr + 1); ss_cap = (void *)(dcap_20 + 1); @@ -477,6 +484,15 @@ libusb_parse_bos_descriptor(const void *buf, int len, if (dlen >= 3 && ptr != NULL && dtype == LIBUSB_DT_DEVICE_CAPABILITY) { + if (index != ptr->bNumDeviceCapabilities) { + ptr->dev_capability[index] = malloc(dlen); + if (ptr->dev_capability[index] == NULL) { + libusb_free_bos_descriptor(ptr); + return LIBUSB_ERROR_NO_MEM; + } + memcpy(ptr->dev_capability[index], buf, dlen); + index++; + } switch (((const uint8_t *)buf)[2]) { case LIBUSB_USB_2_0_EXTENSION_DEVICE_CAPABILITY: if (ptr->usb_2_0_ext_cap != NULL || dcap_20 == NULL) @@ -523,8 +539,11 @@ libusb_parse_bos_descriptor(const void *buf, int len, buf = ((const uint8_t *)buf) + dlen; len -= dlen; } - if (ptr != NULL) + + if (ptr != NULL) { + ptr->bNumDeviceCapabilities = index; return (0); /* success */ + } return (LIBUSB_ERROR_IO); } @@ -532,9 +551,14 @@ libusb_parse_bos_descriptor(const void *buf, int len, void libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos) { + uint8_t i; + if (bos == NULL) return; + for (i = 0; i != bos->bNumDeviceCapabilities; i++) + free(bos->dev_capability[i]); + free(bos->dev_capability); free(bos); } From owner-svn-src-head@freebsd.org Wed Aug 9 18:09:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE555DD2815; Wed, 9 Aug 2017 18:09:10 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6F5C7F520; Wed, 9 Aug 2017 18:09:10 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79I99Tm028334; Wed, 9 Aug 2017 18:09:09 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79I9924028330; Wed, 9 Aug 2017 18:09:09 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201708091809.v79I9924028330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 9 Aug 2017 18:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322323 - in head/sys: amd64/amd64 i386/include x86/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/include x86/include x86/x86 X-SVN-Commit-Revision: 322323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 18:09:10 -0000 Author: jkim Date: Wed Aug 9 18:09:09 2017 New Revision: 322323 URL: https://svnweb.freebsd.org/changeset/base/322323 Log: Split identify_cpu() into two functions for amd64 as we do for i386. This reduces diff between amd64 and i386. Also, it fixes a regression introduced in r322076, i.e., identify_hypervisor() failed to identify some hypervisors. This function assumes cpu_feature2 is already initialized. Reported by: dexuan Tested by: dexuan Modified: head/sys/amd64/amd64/machdep.c head/sys/i386/include/md_var.h head/sys/x86/include/x86_var.h head/sys/x86/x86/identcpu.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Aug 9 18:06:27 2017 (r322322) +++ head/sys/amd64/amd64/machdep.c Wed Aug 9 18:09:09 2017 (r322323) @@ -1537,6 +1537,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) kmdp = init_ops.parse_preload_data(modulep); + identify_cpu(); identify_hypervisor(); /* Init basic tunables, hz etc */ @@ -1643,7 +1644,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) != NULL) vty_set_preferred(VTY_VT); - identify_cpu(); /* Final stage of CPU initialization */ + finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ initializecpucache(); Modified: head/sys/i386/include/md_var.h ============================================================================== --- head/sys/i386/include/md_var.h Wed Aug 9 18:06:27 2017 (r322322) +++ head/sys/i386/include/md_var.h Wed Aug 9 18:09:09 2017 (r322323) @@ -59,7 +59,6 @@ void doreti_popl_es(void) __asm(__STRING(doreti_popl_e void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); -void finishidentcpu(void); void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); void i686_pagezero(void *addr); void sse2_pagezero(void *addr); Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Wed Aug 9 18:06:27 2017 (r322322) +++ head/sys/x86/include/x86_var.h Wed Aug 9 18:09:09 2017 (r322323) @@ -115,6 +115,7 @@ void cpu_probe_amdc1e(void); void cpu_setregs(void); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); +void finishidentcpu(void); void identify_cpu(void); void identify_hypervisor(void); void initializecpu(void); Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Wed Aug 9 18:06:27 2017 (r322322) +++ head/sys/x86/x86/identcpu.c Wed Aug 9 18:09:09 2017 (r322323) @@ -1372,23 +1372,12 @@ fix_cpuid(void) return (false); } -/* - * Final stage of CPU identification. - */ -#ifdef __i386__ +#ifdef __amd64__ void -finishidentcpu(void) -#else -void identify_cpu(void) -#endif { - u_int regs[4], cpu_stdext_disable; -#ifdef __i386__ - u_char ccr3; -#endif + u_int regs[4]; -#ifdef __amd64__ do_cpuid(0, regs); cpu_high = regs[0]; ((u_int *)&cpu_vendor)[0] = regs[1]; @@ -1401,6 +1390,18 @@ identify_cpu(void) cpu_procinfo = regs[1]; cpu_feature = regs[3]; cpu_feature2 = regs[2]; +} +#endif + +/* + * Final stage of CPU identification. + */ +void +finishidentcpu(void) +{ + u_int regs[4], cpu_stdext_disable; +#ifdef __i386__ + u_char ccr3; #endif cpu_vendor_id = find_cpu_vendor_id(); From owner-svn-src-head@freebsd.org Wed Aug 9 18:15:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03475DD2B01; Wed, 9 Aug 2017 18:15:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C41877FA4D; Wed, 9 Aug 2017 18:15:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79IF7LR032138; Wed, 9 Aug 2017 18:15:07 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79IF7Nx032137; Wed, 9 Aug 2017 18:15:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708091815.v79IF7Nx032137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 18:15:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322324 - head/lib/libcapsicum X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libcapsicum X-SVN-Commit-Revision: 322324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 18:15:09 -0000 Author: kevans Date: Wed Aug 9 18:15:07 2017 New Revision: 322324 URL: https://svnweb.freebsd.org/changeset/base/322324 Log: capsicum_helpers: Add FIODTYPE to default ioctls allowed FIODTYPE will be needed by hexdump(1) to speed up the -s flag on devices that should be able to support fseek(3); specifically, in an attempt to correct for the fact that most tape drives don't support seeking yet don't indicate as such when fseeko(3) is invoked. Related: D10939 Reviewed by: cem, emaste, oshogbo Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D10937 Modified: head/lib/libcapsicum/capsicum_helpers.h Modified: head/lib/libcapsicum/capsicum_helpers.h ============================================================================== --- head/lib/libcapsicum/capsicum_helpers.h Wed Aug 9 18:09:09 2017 (r322323) +++ head/lib/libcapsicum/capsicum_helpers.h Wed Aug 9 18:15:07 2017 (r322324) @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -47,7 +48,7 @@ static __inline int caph_limit_stream(int fd, int flags) { cap_rights_t rights; - unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ }; + unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ, FIODTYPE }; cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL); From owner-svn-src-head@freebsd.org Wed Aug 9 18:23:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8977DD2D8E; Wed, 9 Aug 2017 18:23:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 738F77FF40; Wed, 9 Aug 2017 18:23:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79INkUG036151; Wed, 9 Aug 2017 18:23:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79INktO036150; Wed, 9 Aug 2017 18:23:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708091823.v79INktO036150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 9 Aug 2017 18:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322325 - head/bin/cat X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/bin/cat X-SVN-Commit-Revision: 322325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 18:23:47 -0000 Author: emaste Date: Wed Aug 9 18:23:46 2017 New Revision: 322325 URL: https://svnweb.freebsd.org/changeset/base/322325 Log: cat: fix build with -DNO_UDOM_SUPPORT Sponsored by: The FreeBSD Foundation Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c ============================================================================== --- head/bin/cat/cat.c Wed Aug 9 18:15:07 2017 (r322324) +++ head/bin/cat/cat.c Wed Aug 9 18:23:46 2017 (r322325) @@ -51,12 +51,12 @@ __FBSDID("$FreeBSD$"); #ifndef NO_UDOM_SUPPORT #include #include -#include #include #endif #include #include +#include #include #include #include From owner-svn-src-head@freebsd.org Wed Aug 9 19:09:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FDE8DD3A3D; Wed, 9 Aug 2017 19:09:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4543781879; Wed, 9 Aug 2017 19:09:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79J9Owt053567; Wed, 9 Aug 2017 19:09:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79J9N0U053557; Wed, 9 Aug 2017 19:09:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708091909.v79J9N0U053557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 9 Aug 2017 19:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322326 - in head/contrib/llvm/tools/lldb: include/lldb/Target source/Plugins/ABI/SysV-i386 source/Plugins/Platform/FreeBSD source/Plugins/Platform/NetBSD source/Plugins/Platform/OpenBS... X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/contrib/llvm/tools/lldb: include/lldb/Target source/Plugins/ABI/SysV-i386 source/Plugins/Platform/FreeBSD source/Plugins/Platform/NetBSD source/Plugins/Platform/OpenBSD source/Plugins/Process/... X-SVN-Commit-Revision: 322326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 19:09:25 -0000 Author: emaste Date: Wed Aug 9 19:09:23 2017 New Revision: 322326 URL: https://svnweb.freebsd.org/changeset/base/322326 Log: lldb: Make i386-*-freebsd expression work on JIT path * Enable i386 ABI creation for freebsd * Added an extra argument in ABISysV_i386::PrepareTrivialCall for mmap syscall * Unlike linux, the last argument of mmap is actually 64-bit(off_t). This requires us to push an additional word for the higher order bits. * Prior to this change, ktrace dump will show mmap failures due to invalid argument coming from the 6th mmap argument. Submitted by: Karnajit Wangkhem Differential Revision: https://reviews.llvm.org/D34776 Modified: head/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h head/contrib/llvm/tools/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h head/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp head/contrib/llvm/tools/lldb/source/Target/Platform.cpp Modified: head/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h ============================================================================== --- head/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h Wed Aug 9 19:09:23 2017 (r322326) @@ -53,6 +53,7 @@ class PlatformProperties : public Properties { (public }; typedef std::shared_ptr PlatformPropertiesSP; +typedef llvm::SmallVector MmapArgList; //---------------------------------------------------------------------- /// @class Platform Platform.h "lldb/Target/Platform.h" @@ -628,8 +629,11 @@ class Platform : public PluginInterface { (public) virtual Status Unlink(const FileSpec &file_spec); - virtual uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags); + virtual MmapArgList GetMmapArgumentList(const ArchSpec &arch, + lldb::addr_t addr, + lldb::addr_t length, + unsigned prot, unsigned flags, + lldb::addr_t fd, lldb::addr_t offset); virtual bool GetSupportsRSync() { return m_supports_rsync; } Modified: head/contrib/llvm/tools/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -206,7 +206,7 @@ ABISP ABISysV_i386::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; if ((arch.GetTriple().getArch() == llvm::Triple::x86) && - arch.GetTriple().isOSLinux()) { + (arch.GetTriple().isOSLinux() || arch.GetTriple().isOSFreeBSD())) { if (!g_abi_sp) g_abi_sp.reset(new ABISysV_i386(process_sp)); return g_abi_sp; Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -314,13 +314,19 @@ void PlatformFreeBSD::CalculateTrapHandlerSymbolNames( m_trap_handlers.push_back(ConstString("_sigtramp")); } -uint64_t PlatformFreeBSD::ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) { +MmapArgList PlatformFreeBSD::GetMmapArgumentList(const ArchSpec &arch, + addr_t addr, addr_t length, + unsigned prot, unsigned flags, + addr_t fd, addr_t offset) { uint64_t flags_platform = 0; if (flags & eMmapFlagsPrivate) flags_platform |= MAP_PRIVATE; if (flags & eMmapFlagsAnon) flags_platform |= MAP_ANON; - return flags_platform; + + MmapArgList args({addr, length, prot, flags_platform, fd, offset}); + if (arch.GetTriple().getArch() == llvm::Triple::x86) + args.push_back(0); + return args; } Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h Wed Aug 9 19:09:23 2017 (r322326) @@ -61,8 +61,10 @@ class PlatformFreeBSD : public PlatformPOSIX { (public void CalculateTrapHandlerSymbolNames() override; - uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) override; + MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr, + lldb::addr_t length, unsigned prot, + unsigned flags, lldb::addr_t fd, + lldb::addr_t offset) override; private: DISALLOW_COPY_AND_ASSIGN(PlatformFreeBSD); Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -420,13 +420,17 @@ void PlatformNetBSD::CalculateTrapHandlerSymbolNames() m_trap_handlers.push_back(ConstString("_sigtramp")); } -uint64_t PlatformNetBSD::ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) { +MmapArgList PlatformNetBSD::GetMmapArgumentList(const ArchSpec &arch, + addr_t addr, addr_t length, + unsigned prot, unsigned flags, + addr_t fd, addr_t offset) { uint64_t flags_platform = 0; if (flags & eMmapFlagsPrivate) flags_platform |= MAP_PRIVATE; if (flags & eMmapFlagsAnon) flags_platform |= MAP_ANON; - return flags_platform; + + MmapArgList args({addr, length, prot, flags_platform, fd, offset}); + return args; } Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h Wed Aug 9 19:09:23 2017 (r322326) @@ -59,8 +59,10 @@ class PlatformNetBSD : public PlatformPOSIX { (public) void CalculateTrapHandlerSymbolNames() override; - uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) override; + MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr, + lldb::addr_t length, unsigned prot, + unsigned flags, lldb::addr_t fd, + lldb::addr_t offset) override; private: DISALLOW_COPY_AND_ASSIGN(PlatformNetBSD); Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -219,5 +219,7 @@ uint64_t PlatformOpenBSD::ConvertMmapFlagsToPlatform(c flags_platform |= MAP_PRIVATE; if (flags & eMmapFlagsAnon) flags_platform |= MAP_ANON; - return flags_platform; + + MmapArgList args({addr, length, prot, flags_platform, fd, offset}); + return args; } Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h Wed Aug 9 19:09:23 2017 (r322326) @@ -53,8 +53,10 @@ class PlatformOpenBSD : public PlatformPOSIX { (public void CalculateTrapHandlerSymbolNames() override; - uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) override; + MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr, + lldb::addr_t length, unsigned prot, + unsigned flags, lldb::addr_t fd, + lldb::addr_t offset) override; private: DISALLOW_COPY_AND_ASSIGN(PlatformOpenBSD); Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -64,7 +64,7 @@ bool lldb_private::InferiorCallMmap(Process *process, options.SetTimeout(std::chrono::milliseconds(500)); options.SetTrapExceptions(false); - addr_t prot_arg, flags_arg = 0; + addr_t prot_arg; if (prot == eMmapProtNone) prot_arg = PROT_NONE; else { @@ -77,11 +77,6 @@ bool lldb_private::InferiorCallMmap(Process *process, prot_arg |= PROT_WRITE; } - const ArchSpec arch = process->GetTarget().GetArchitecture(); - flags_arg = - process->GetTarget().GetPlatform()->ConvertMmapFlagsToPlatform(arch, - flags); - AddressRange mmap_range; if (sc.GetAddressRange(range_scope, 0, use_inline_block_range, mmap_range)) { @@ -89,7 +84,10 @@ bool lldb_private::InferiorCallMmap(Process *process, process->GetTarget().GetScratchClangASTContext(); CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); - lldb::addr_t args[] = {addr, length, prot_arg, flags_arg, fd, offset}; + const ArchSpec arch = process->GetTarget().GetArchitecture(); + MmapArgList args = + process->GetTarget().GetPlatform()->GetMmapArgumentList( + arch, addr, length, prot_arg, flags, fd, offset); lldb::ThreadPlanSP call_plan_sp( new ThreadPlanCallFunction(*thread, mmap_range.GetBaseAddress(), clang_void_ptr_type, args, options)); Modified: head/contrib/llvm/tools/lldb/source/Target/Platform.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Target/Platform.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Target/Platform.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -1316,14 +1316,18 @@ Status Platform::Unlink(const FileSpec &path) { return error; } -uint64_t Platform::ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) { +MmapArgList Platform::GetMmapArgumentList(const ArchSpec &arch, addr_t addr, + addr_t length, unsigned prot, + unsigned flags, addr_t fd, + addr_t offset) { uint64_t flags_platform = 0; if (flags & eMmapFlagsPrivate) flags_platform |= MAP_PRIVATE; if (flags & eMmapFlagsAnon) flags_platform |= MAP_ANON; - return flags_platform; + + MmapArgList args({addr, length, prot, flags_platform, fd, offset}); + return args; } lldb_private::Status Platform::RunShellCommand( From owner-svn-src-head@freebsd.org Wed Aug 9 19:16:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CF40DD3DB9; Wed, 9 Aug 2017 19:16:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0658081EDE; Wed, 9 Aug 2017 19:16:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79JGtGj057402; Wed, 9 Aug 2017 19:16:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79JGsL4057398; Wed, 9 Aug 2017 19:16:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708091916.v79JGsL4057398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 9 Aug 2017 19:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322327 - in head: . release/packages X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in head: . release/packages X-SVN-Commit-Revision: 322327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 19:16:56 -0000 Author: gjb Date: Wed Aug 9 19:16:54 2017 New Revision: 322327 URL: https://svnweb.freebsd.org/changeset/base/322327 Log: Add a dependency on the kernel package for the runtime package. The idea here is that, provided upstream pkg(8) maintainers accept the proposed change, the kernel.ucl will contain a post-install script causing pkg(8) to emit a message informing to reboot the system after the kernel is upgraded using 'pkg upgrade', so the new userland is installed on the running new kernel. At present, this functionality does not exist in pkg(8), but will help ensure the upgrade path follows that from UPDATING. To work around this for now, evaluate ASSUME_ALWAYS_YES, and prompt the user if they wish to proceed if not set to true. Since there is a kernel dependency, and a non-GENERIC kernel may be in use, update Makefile.inc1 to replace '%KERNCONF%' in the runtime.ucl with the first-built kernel set either via command line or in make.conf(5). MFC after: 5 days Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 head/release/packages/kernel.ucl head/release/packages/runtime.ucl Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Aug 9 19:09:23 2017 (r322326) +++ head/Makefile.inc1 Wed Aug 9 19:16:54 2017 (r322327) @@ -1618,7 +1618,10 @@ create-world-package-${pkgname}: .PHONY @awk -F\" ' \ /^name/ { printf("===> Creating %s-", $$2); next } \ /^version/ { print $$2; next } \ - ' ${WSTAGEDIR}/${pkgname}.ucl ; \ + ' ${WSTAGEDIR}/${pkgname}.ucl ; + @if [ "${pkgname}" == "runtime" ]; then \ + sed -i '' -e "s/%KERNCONF%/${INSTALLKERNEL:tl}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ + fi ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ create -M ${WSTAGEDIR}/${pkgname}.ucl \ -p ${WSTAGEDIR}/${pkgname}.plist \ Modified: head/release/packages/kernel.ucl ============================================================================== --- head/release/packages/kernel.ucl Wed Aug 9 19:09:23 2017 (r322326) +++ head/release/packages/kernel.ucl Wed Aug 9 19:16:54 2017 (r322327) @@ -16,6 +16,39 @@ desc = < Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C55B0DD4ECF; Wed, 9 Aug 2017 19:58:39 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98491841F3; Wed, 9 Aug 2017 19:58:39 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79Jwc1V075399; Wed, 9 Aug 2017 19:58:38 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79JwcLk075398; Wed, 9 Aug 2017 19:58:38 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708091958.v79JwcLk075398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 9 Aug 2017 19:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322328 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 322328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 19:58:39 -0000 Author: ae Date: Wed Aug 9 19:58:38 2017 New Revision: 322328 URL: https://svnweb.freebsd.org/changeset/base/322328 Log: Make user supplied data checks a bit stricter. key_msg2sp() is used for parsing data from setsockopt(IP[V6]_IPSEC_POLICY) call. This socket option is usually used to configure IPsec bypass for socket. Only privileged user can set this socket option. The message syntax is described here http://www.kame.net/newsletter/20021210/ and our libipsec is usually used to create the correct request. Add additional checks: * that sadb_x_ipsecrequest_len is not out of bounds of user supplied buffer * that src/dst's sa_len is the same * that 2*sa_len is not out of bounds of user supplied buffer * that 2*sa_len fits into bounds of sadb_x_ipsecrequest Reported by: Ilja van Sprundel MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11796 Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Wed Aug 9 19:16:54 2017 (r322327) +++ head/sys/netipsec/key.c Wed Aug 9 19:58:38 2017 (r322328) @@ -1403,7 +1403,8 @@ key_msg2sp(struct sadb_x_policy *xpl0, size_t len, int while (tlen > 0) { /* length check */ - if (xisr->sadb_x_ipsecrequest_len < sizeof(*xisr)) { + if (xisr->sadb_x_ipsecrequest_len < sizeof(*xisr) || + xisr->sadb_x_ipsecrequest_len > tlen) { ipseclog((LOG_DEBUG, "%s: invalid ipsecrequest " "length.\n", __func__)); key_freesp(&newsp); @@ -1517,10 +1518,12 @@ key_msg2sp(struct sadb_x_policy *xpl0, size_t len, int if (xisr->sadb_x_ipsecrequest_len > sizeof(*xisr)) { struct sockaddr *paddr; + len = tlen - sizeof(*xisr); paddr = (struct sockaddr *)(xisr + 1); /* validity check */ - if (paddr->sa_len - > sizeof(isr->saidx.src)) { + if (len < sizeof(struct sockaddr) || + len < 2 * paddr->sa_len || + paddr->sa_len > sizeof(isr->saidx.src)) { ipseclog((LOG_DEBUG, "%s: invalid " "request address length.\n", __func__)); @@ -1528,13 +1531,26 @@ key_msg2sp(struct sadb_x_policy *xpl0, size_t len, int *error = EINVAL; return NULL; } + /* + * Request length should be enough to keep + * source and destination addresses. + */ + if (xisr->sadb_x_ipsecrequest_len < + sizeof(*xisr) + 2 * paddr->sa_len) { + ipseclog((LOG_DEBUG, "%s: invalid " + "ipsecrequest length.\n", + __func__)); + key_freesp(&newsp); + *error = EINVAL; + return (NULL); + } bcopy(paddr, &isr->saidx.src, paddr->sa_len); paddr = (struct sockaddr *)((caddr_t)paddr + paddr->sa_len); /* validity check */ - if (paddr->sa_len - > sizeof(isr->saidx.dst)) { + if (paddr->sa_len != + isr->saidx.src.sa.sa_len) { ipseclog((LOG_DEBUG, "%s: invalid " "request address length.\n", __func__)); From owner-svn-src-head@freebsd.org Wed Aug 9 20:13:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A65CDD5342; Wed, 9 Aug 2017 20:13:51 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D151A84AAD; Wed, 9 Aug 2017 20:13:50 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79KDnT1083325; Wed, 9 Aug 2017 20:13:49 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79KDnup083324; Wed, 9 Aug 2017 20:13:49 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708092013.v79KDnup083324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Wed, 9 Aug 2017 20:13:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322329 - head/sys/boot/i386/boot2 X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/boot/i386/boot2 X-SVN-Commit-Revision: 322329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 20:13:51 -0000 Author: rlibby Date: Wed Aug 9 20:13:49 2017 New Revision: 322329 URL: https://svnweb.freebsd.org/changeset/base/322329 Log: i386/boot2: -fno-asynchronous-unwind-tables for gcc The amd64 build of boot2 was failing with gcc 6.3.0 due to being more than 1 kB too large. It was apparently generating a .eh_frame section which was not being removed by objcopy -S. The .eh_frame section seems to be mandatory per the amd64 ABI, but boot2 is compiled for i386 (uses -m32), and therefore should be optional in this context. Suppress generation of .eh_frame with the -fno-asynchronous-unwind-tables flag to gcc. This saves 1348 bytes (the limit is 7680 bytes). Reviewed by: dim, imp Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11928 Modified: head/sys/boot/i386/boot2/Makefile Modified: head/sys/boot/i386/boot2/Makefile ============================================================================== --- head/sys/boot/i386/boot2/Makefile Wed Aug 9 19:58:38 2017 (r322328) +++ head/sys/boot/i386/boot2/Makefile Wed Aug 9 20:13:49 2017 (r322329) @@ -38,6 +38,7 @@ CFLAGS= -fomit-frame-pointer \ -Winline CFLAGS.gcc+= -Os \ + -fno-asynchronous-unwind-tables \ --param max-inline-insns-single=100 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201 CFLAGS.gcc+= -mno-align-long-strings From owner-svn-src-head@freebsd.org Wed Aug 9 21:44:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D162DD6AA7; Wed, 9 Aug 2017 21:44:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4661C2B0E; Wed, 9 Aug 2017 21:44:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79LitAF020167; Wed, 9 Aug 2017 21:44:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79Litsf020166; Wed, 9 Aug 2017 21:44:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708092144.v79Litsf020166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 21:44:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322330 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 21:44:56 -0000 Author: kevans Date: Wed Aug 9 21:44:55 2017 New Revision: 322330 URL: https://svnweb.freebsd.org/changeset/base/322330 Log: Add myself to calendar.freebsd Requested by: mckusick Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11936 Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Wed Aug 9 20:13:49 2017 (r322329) +++ head/usr.bin/calendar/calendars/calendar.freebsd Wed Aug 9 21:44:55 2017 (r322330) @@ -343,6 +343,7 @@ 09/22 Bryan Drewery born in San Diego, California, United States, 1984 09/23 Martin Matuska born in Bratislava, Slovakia, 1979 09/24 Larry Rosenman born in Queens, New York, United States, 1957 +09/27 Kyle Evans born in Oklahoma City, Oklahoma, United States, 1991 09/27 Neil Blakey-Milner born in Port Elizabeth, South Africa, 1978 09/27 Renato Botelho born in Araras, Sao Paulo, Brazil, 1979 09/28 Greg Lehey born in Melbourne, Victoria, Australia, 1948 From owner-svn-src-head@freebsd.org Wed Aug 9 22:18:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12A43DD7250; Wed, 9 Aug 2017 22:18:51 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBABF3921; Wed, 9 Aug 2017 22:18:50 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79MInII032029; Wed, 9 Aug 2017 22:18:49 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79MInEd032026; Wed, 9 Aug 2017 22:18:49 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708092218.v79MInEd032026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 9 Aug 2017 22:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322331 - in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Group: head X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Commit-Revision: 322331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 22:18:51 -0000 Author: davidcs Date: Wed Aug 9 22:18:49 2017 New Revision: 322331 URL: https://svnweb.freebsd.org/changeset/base/322331 Log: Provide compile to choose receive processing in either Ithread or Taskqueue Thread. Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c head/sys/dev/qlnx/qlnxe/qlnx_ver.h head/sys/modules/qlnx/qlnxe/Makefile Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_os.c Wed Aug 9 21:44:55 2017 (r322330) +++ head/sys/dev/qlnx/qlnxe/qlnx_os.c Wed Aug 9 22:18:49 2017 (r322331) @@ -397,10 +397,14 @@ qlnx_fp_taskqueue(void *context, int pending) struct ifnet *ifp; struct mbuf *mp; int ret = -1; + struct thread *cthread; + +#ifdef QLNX_RCV_IN_TASKQ int lro_enable; int rx_int = 0, total_rx_count = 0; - struct thread *cthread; +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ + fp = context; if (fp == NULL) @@ -419,55 +423,60 @@ qlnx_fp_taskqueue(void *context, int pending) ifp = ha->ifp; - lro_enable = ha->ifp->if_capenable & IFCAP_LRO; +#ifdef QLNX_RCV_IN_TASKQ + { + lro_enable = ifp->if_capenable & IFCAP_LRO; - rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); - if (rx_int) { - fp->rx_pkts += rx_int; - total_rx_count += rx_int; - } + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } #ifdef QLNX_SOFT_LRO - { - struct lro_ctrl *lro; + { + struct lro_ctrl *lro; + + lro = &fp->rxq->lro; - lro = &fp->rxq->lro; + if (lro_enable && total_rx_count) { - if (lro_enable && total_rx_count) { - #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) - if (ha->dbg_trace_lro_cnt) { - if (lro->lro_mbuf_count & ~1023) - fp->lro_cnt_1024++; - else if (lro->lro_mbuf_count & ~511) - fp->lro_cnt_512++; - else if (lro->lro_mbuf_count & ~255) - fp->lro_cnt_256++; - else if (lro->lro_mbuf_count & ~127) - fp->lro_cnt_128++; - else if (lro->lro_mbuf_count & ~63) - fp->lro_cnt_64++; - } - tcp_lro_flush_all(lro); + if (ha->dbg_trace_lro_cnt) { + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; + } + tcp_lro_flush_all(lro); #else - struct lro_entry *queued; + struct lro_entry *queued; - while ((!SLIST_EMPTY(&lro->lro_active))) { - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, next); - tcp_lro_flush(lro, queued); - } + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, next); + tcp_lro_flush(lro, queued); + } #endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + } } - } #endif /* #ifdef QLNX_SOFT_LRO */ - ecore_sb_update_sb_idx(fp->sb_info); - rmb(); + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); + } +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ + mtx_lock(&fp->tx_mtx); if (((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != @@ -477,10 +486,6 @@ qlnx_fp_taskqueue(void *context, int pending) goto qlnx_fp_taskqueue_exit; } -// for (tc = 0; tc < ha->num_tc; tc++) { -// (void)qlnx_tx_int(ha, fp, fp->txq[tc]); -// } - mp = drbr_peek(ifp, fp->tx_br); while (mp != NULL) { @@ -516,13 +521,11 @@ qlnx_fp_taskqueue(void *context, int pending) mp = drbr_peek(ifp, fp->tx_br); } -// for (tc = 0; tc < ha->num_tc; tc++) { -// (void)qlnx_tx_int(ha, fp, fp->txq[tc]); -// } - mtx_unlock(&fp->tx_mtx); qlnx_fp_taskqueue_exit: + +#ifdef QLNX_RCV_IN_TASKQ if (rx_int) { if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); @@ -532,6 +535,7 @@ qlnx_fp_taskqueue_exit: } ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1); } +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ QL_DPRINT2(ha, "exit ret = %d\n", ret); return; @@ -4262,6 +4266,7 @@ next_cqe: /* don't consume bd rx buffer */ return rx_pkt; } + /* * fast path interrupt */ @@ -4292,9 +4297,82 @@ qlnx_fp_isr(void *arg) if (fp == NULL) { ha->err_fp_null++; } else { + +#ifdef QLNX_RCV_IN_TASKQ ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0); if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); +#else + int rx_int = 0, total_rx_count = 0; + int lro_enable, tc; + + lro_enable = ha->ifp->if_capenable & IFCAP_LRO; + + ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0); + + do { + for (tc = 0; tc < ha->num_tc; tc++) { + if (mtx_trylock(&fp->tx_mtx)) { + qlnx_tx_int(ha, fp, fp->txq[tc]); + mtx_unlock(&fp->tx_mtx); + } + } + + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, + lro_enable); + + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } + + } while (rx_int); + + +#ifdef QLNX_SOFT_LRO + { + struct lro_ctrl *lro; + + lro = &fp->rxq->lro; + + if (lro_enable && total_rx_count) { + +#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) + +#ifdef QLNX_TRACE_LRO_CNT + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; +#endif /* #ifdef QLNX_TRACE_LRO_CNT */ + + tcp_lro_flush_all(lro); + +#else + struct lro_entry *queued; + + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, \ + next); + tcp_lro_flush(lro, queued); + } +#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + } + } +#endif /* #ifdef QLNX_SOFT_LRO */ + + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); + ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1); + +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ } return; Modified: head/sys/dev/qlnx/qlnxe/qlnx_ver.h ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_ver.h Wed Aug 9 21:44:55 2017 (r322330) +++ head/sys/dev/qlnx/qlnxe/qlnx_ver.h Wed Aug 9 22:18:49 2017 (r322331) @@ -39,5 +39,5 @@ #define QLNX_VERSION_MAJOR 1 #define QLNX_VERSION_MINOR 4 -#define QLNX_VERSION_BUILD 5 +#define QLNX_VERSION_BUILD 6 Modified: head/sys/modules/qlnx/qlnxe/Makefile ============================================================================== --- head/sys/modules/qlnx/qlnxe/Makefile Wed Aug 9 21:44:55 2017 (r322330) +++ head/sys/modules/qlnx/qlnxe/Makefile Wed Aug 9 22:18:49 2017 (r322331) @@ -65,5 +65,6 @@ CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/includ #CFLAGS += -DQLNX_SOFT_LRO #CFLAGS += -DQLNX_QSORT_LRO #CFLAGS += -DQLNX_MAX_COALESCE +#CFLAGS += -DQLNX_RCV_IN_TASKQ CWARNFLAGS+= -Wno-cast-qual From owner-svn-src-head@freebsd.org Wed Aug 9 22:58:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 762B2DD7B35; Wed, 9 Aug 2017 22:58:43 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 425EE63C36; Wed, 9 Aug 2017 22:58:43 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79Mwg2u048248; Wed, 9 Aug 2017 22:58:42 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79Mwg0o048246; Wed, 9 Aug 2017 22:58:42 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708092258.v79Mwg0o048246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Wed, 9 Aug 2017 22:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322332 - in head: contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: in head: contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc X-SVN-Commit-Revision: 322332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 22:58:43 -0000 Author: rlibby Date: Wed Aug 9 22:58:42 2017 New Revision: 322332 URL: https://svnweb.freebsd.org/changeset/base/322332 Log: Pick 'Remove external linkage for spin_adaptive' from upstream jemalloc Apply the changes from upstream jemalloc 048c6679. This is actually not quite a cherry pick due to makefile difference and because FreeBSD does not carry the msvc project files which were also modified in that commit. Approved by: jasone (maintainer), markj (mentor) Sponsored by: Dell EMC Isilon Deleted: head/contrib/jemalloc/src/spin.c Modified: head/contrib/jemalloc/include/jemalloc/internal/spin.h head/lib/libc/stdlib/jemalloc/Makefile.inc Modified: head/contrib/jemalloc/include/jemalloc/internal/spin.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/spin.h Wed Aug 9 22:18:49 2017 (r322331) +++ head/contrib/jemalloc/include/jemalloc/internal/spin.h Wed Aug 9 22:58:42 2017 (r322332) @@ -1,19 +1,13 @@ #ifndef JEMALLOC_INTERNAL_SPIN_H #define JEMALLOC_INTERNAL_SPIN_H -#ifdef JEMALLOC_SPIN_C_ -# define SPIN_INLINE extern inline -#else -# define SPIN_INLINE inline -#endif - #define SPIN_INITIALIZER {0U} typedef struct { unsigned iteration; } spin_t; -SPIN_INLINE void +static inline void spin_adaptive(spin_t *spin) { volatile uint32_t i; Modified: head/lib/libc/stdlib/jemalloc/Makefile.inc ============================================================================== --- head/lib/libc/stdlib/jemalloc/Makefile.inc Wed Aug 9 22:18:49 2017 (r322331) +++ head/lib/libc/stdlib/jemalloc/Makefile.inc Wed Aug 9 22:58:42 2017 (r322332) @@ -5,7 +5,7 @@ JEMALLOCSRCS:= jemalloc.c arena.c background_thread.c base.c bitmap.c ckh.c \ ctl.c extent.c extent_dss.c extent_mmap.c hash.c hooks.c large.c \ malloc_io.c mutex.c mutex_pool.c nstime.c pages.c prng.c prof.c \ - rtree.c spin.c stats.c sz.c tcache.c ticker.c tsd.c witness.c + rtree.c stats.c sz.c tcache.c ticker.c tsd.c witness.c SYM_MAPS+=${LIBC_SRCTOP}/stdlib/jemalloc/Symbol.map From owner-svn-src-head@freebsd.org Thu Aug 10 02:15:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DA94DDCD32; Thu, 10 Aug 2017 02:15:41 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D29B6A498; Thu, 10 Aug 2017 02:15:41 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A2FeXo032111; Thu, 10 Aug 2017 02:15:40 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A2Femo032110; Thu, 10 Aug 2017 02:15:40 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708100215.v7A2Femo032110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Thu, 10 Aug 2017 02:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322335 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 02:15:41 -0000 Author: rlibby Date: Thu Aug 10 02:15:40 2017 New Revision: 322335 URL: https://svnweb.freebsd.org/changeset/base/322335 Log: Add myself (rlibby) to calendar.freebsd Reported by: mckusick Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D11947 Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 00:39:02 2017 (r322334) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 02:15:40 2017 (r322335) @@ -219,6 +219,7 @@ 06/04 Zack Kirsch born in Memphis, Tennessee, United States, 1982 06/04 Johannes Jost Meixner born in Wiesbaden, Germany, 1987 06/06 Sergei Kolobov born in Karpinsk, Russian Federation, 1972 +06/06 Ryan Libby born in Kirkland, Washington, United States, 1985 06/06 Alan Eldridge died in Denver, Colorado, 2003 06/07 Jimmy Olgeni born in Milano, Italy, 1976 06/07 Benjamin Close born in Adelaide, Australia, 1978 From owner-svn-src-head@freebsd.org Thu Aug 10 02:55:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5904BDB4BC8; Thu, 10 Aug 2017 02:55:23 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 283736BAE2; Thu, 10 Aug 2017 02:55:23 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A2tMUh048242; Thu, 10 Aug 2017 02:55:22 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A2tMXu048241; Thu, 10 Aug 2017 02:55:22 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708100255.v7A2tMXu048241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 10 Aug 2017 02:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322336 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 02:55:23 -0000 Author: sbruno Date: Thu Aug 10 02:55:22 2017 New Revision: 322336 URL: https://svnweb.freebsd.org/changeset/base/322336 Log: Add sbruno@ birthday information. Reported by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 02:15:40 2017 (r322335) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 02:55:22 2017 (r322336) @@ -427,6 +427,7 @@ 12/18 Semen Ustimenko born in Novosibirsk, Russian Federation, 1979 12/19 Stephen Hurd born in Estevan, Saskatchewan, Canada, 1975 12/19 Emmanuel Vadot born in Decines-Charpieu, France, 1983 +12/20 Sean Bruno born in Monterey, California, USA, 1974 12/21 Rong-En Fan born in Taipei, Taiwan, Republic of China, 1982 12/22 Alan L. Cox born in Warren, Ohio, United States, 1964 12/22 Maxim Sobolev born in Dnepropetrovsk, Ukraine, 1976 From owner-svn-src-head@freebsd.org Thu Aug 10 03:11:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 650E5DB5796; Thu, 10 Aug 2017 03:11:06 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33E5F6C6D8; Thu, 10 Aug 2017 03:11:06 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A3B51h053191; Thu, 10 Aug 2017 03:11:05 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A3B5dl053190; Thu, 10 Aug 2017 03:11:05 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708100311.v7A3B5dl053190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 10 Aug 2017 03:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322337 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 322337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 03:11:06 -0000 Author: sbruno Date: Thu Aug 10 03:11:05 2017 New Revision: 322337 URL: https://svnweb.freebsd.org/changeset/base/322337 Log: Export IFCAP_HWSTATS so that we don't experience double stats counting on iflib enabled devices. PR: 220198 Submitted by: Matt Macy Reported by: Ben Woods Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Aug 10 02:55:22 2017 (r322336) +++ head/sys/net/iflib.c Thu Aug 10 03:11:05 2017 (r322337) @@ -3723,7 +3723,7 @@ iflib_if_qflush(if_t ifp) #define IFCAP_FLAGS (IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6 | IFCAP_HWCSUM | IFCAP_LRO | \ - IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTAGGING | \ + IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTAGGING | IFCAP_HWSTATS | \ IFCAP_VLAN_MTU | IFCAP_VLAN_HWFILTER | IFCAP_VLAN_HWTSO) static int @@ -4096,8 +4096,8 @@ iflib_device_register(device_t dev, void *sc, if_share MPASS(scctx->isc_tx_csum_flags); #endif - if_setcapabilities(ifp, scctx->isc_capenable); - if_setcapenable(ifp, scctx->isc_capenable); + if_setcapabilities(ifp, scctx->isc_capenable | IFCAP_HWSTATS); + if_setcapenable(ifp, scctx->isc_capenable | IFCAP_HWSTATS); if (scctx->isc_ntxqsets == 0 || (scctx->isc_ntxqsets_max && scctx->isc_ntxqsets_max < scctx->isc_ntxqsets)) scctx->isc_ntxqsets = scctx->isc_ntxqsets_max; From owner-svn-src-head@freebsd.org Thu Aug 10 03:43:24 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3784DDC22A2; Thu, 10 Aug 2017 03:43:24 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 051BC6D7DE; Thu, 10 Aug 2017 03:43:23 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A3hNEf068838; Thu, 10 Aug 2017 03:43:23 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A3hNwR068837; Thu, 10 Aug 2017 03:43:23 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708100343.v7A3hNwR068837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 10 Aug 2017 03:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322338 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 322338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 03:43:24 -0000 Author: sbruno Date: Thu Aug 10 03:43:23 2017 New Revision: 322338 URL: https://svnweb.freebsd.org/changeset/base/322338 Log: Don't leak mbufs if clusers exceeds the number of segments. This would leak mbufs over time causing crashes. PR: 221202 Submitted by: Matt Macy Reported by: gergely.czuczy@harmless.hu Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Aug 10 03:11:05 2017 (r322337) +++ head/sys/net/iflib.c Thu Aug 10 03:43:23 2017 (r322338) @@ -267,6 +267,8 @@ iflib_get_sctx(if_ctx_t ctx) #define RX_SW_DESC_INUSE (1 << 3) #define TX_SW_DESC_MAPPED (1 << 4) +#define M_TOOBIG M_UNUSED_8 + typedef struct iflib_sw_rx_desc_array { bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ struct mbuf **ifsd_m; /* pkthdr mbufs */ @@ -2930,8 +2932,11 @@ iflib_busdma_load_mbuf_sg(iflib_txq_t txq, bus_dma_tag m = m->m_next; count++; } while (m != NULL); - if (count > *nsegs) + if (count > *nsegs) { + ifsd_m[pidx] = *m0; + ifsd_m[pidx]->m_flags |= M_TOOBIG; return (0); + } m = *m0; count = 0; do { @@ -3241,8 +3246,15 @@ iflib_tx_desc_free(iflib_txq_t txq, int n) if ((m = ifsd_m[cidx]) != NULL) { /* XXX we don't support any drivers that batch packets yet */ MPASS(m->m_nextpkt == NULL); - - m_free(m); + /* if the number of clusters exceeds the number of segments + * there won't be space on the ring to save a pointer to each + * cluster so we simply free the list here + */ + if (m->m_flags & M_TOOBIG) { + m_freem(m); + } else { + m_free(m); + } ifsd_m[cidx] = NULL; #if MEMORY_LOGGING txq->ift_dequeued++; From owner-svn-src-head@freebsd.org Thu Aug 10 08:22:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90CE3DCB383; Thu, 10 Aug 2017 08:22:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 5671B7694F; Thu, 10 Aug 2017 08:22:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 5F3D1D44261; Thu, 10 Aug 2017 18:22:00 +1000 (AEST) Date: Thu, 10 Aug 2017 18:21:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322318 - in head: share/man/man4 sys/conf sys/geom In-Reply-To: <201708091615.v79GFPk9083482@repo.freebsd.org> Message-ID: <20170810165627.A1346@besplex.bde.org> References: <201708091615.v79GFPk9083482@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=L0oNAlR-A_7cc9sh_MoA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 08:22:08 -0000 On Wed, 9 Aug 2017, Warner Losh wrote: > Log: > Mark geom classes as deprecated. > > geom_bsd, geom_mbr and geom_sunlabel have been obsolete since Marcel > Moolenaar's geom_part was in FreeBSD 7. They haven't been in GENERIC > since FreeBSD 8. Add warning when used. > > geom_vol_ffs has been obsolete since ufs support to geom_label was > committed in FreeBSD 5. It hasn't been in GENERIC since FreeBSD 5. > Add warning when used. > > geom_fox has been obsolete since gmultipath was committed in FreeBSD 7. > (no warning added, since this is a very obscure class). > > These will all be removed in FreeBSD 12. geom_bsd (and possibly geom_mbr) can't be remove because they provide more features than geom_part*. The only loss that I noticed is for nested partitions on a backup drive: GEOM_BSD + GEOM_MBR gives: da1 da1s4aa da1s4be da1s4cs3d da1s4e da1s1 da1s4ac da1s4c da1s4cs4 da1s4f da1s1a da1s4ad da1s4cs1 da1s4cs4a da1s4g da1s1c da1s4b da1s4cs2 da1s4cs4c da1s3 da1s4ba da1s4cs3 da1s4cs4d da1s4 da1s4bc da1s4cs3a da1s4cs4e da1s4a da1s4bd da1s4cs3c da1s4d Here da1s4 = da1s4c contains an image backup of a whole drive modified to hold a BSD label in the second sector. The first sector contains a copy of the MBR of the original drive, with offsets adjusted. This works right nested, but can only point to 4 slices. The BSD label points to these 4 and has 2 extras (for damaged and/or recovery areas). The nested MBR gives slices da1s4cs[1-4]. da1s4cs[3-4] are BSD slices containing nested labels. These give the nested partitions da1s4cs[3-4][a-h]. The BSD label in da1s4 gives aliases for da1s4cs[1-4]. 2 of these are for BSD slices (da1s4a == da1s4cs3 and da1s4b == da1s4cs4). Nested labels in these give the nested alasias da1s4[a-b][a-h]. GEOM_PART_BSD + GEOM_PART_EBR + GEM_PART_EBR_COMPAT + GEOM_PART_MBR only gives: da1 da1s1a da1s4 da1s4b da1s4e da1s4g da1s1 da1s3 da1s4a da1s4d da1s4f It doesn't give any nesting. It doesn't create 'c' devices for this or any other drive. Nesting and aliases give large complications, and I don't like even the 2-level MBR+label nesting that I normally use, but the above is what turned up naturally and it is too hard to untangle it. Bruce From owner-svn-src-head@freebsd.org Thu Aug 10 09:15:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D2CEDCCB16; Thu, 10 Aug 2017 09:15:20 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23AC27C68E; Thu, 10 Aug 2017 09:15:20 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A9FJLv002483; Thu, 10 Aug 2017 09:15:19 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A9FIke002476; Thu, 10 Aug 2017 09:15:18 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708100915.v7A9FIke002476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 10 Aug 2017 09:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322347 - in head/sys/x86: acpica include x86 xen X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: in head/sys/x86: acpica include x86 xen X-SVN-Commit-Revision: 322347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 09:15:20 -0000 Author: royger Date: Thu Aug 10 09:15:18 2017 New Revision: 322347 URL: https://svnweb.freebsd.org/changeset/base/322347 Log: apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase Populate the lapics arrays and call cpu_add/lapic_create in the setup phase instead. Also store the max APIC ID found in the newly introduced max_apic_id global variable. This is a requirement in order to make the static arrays currently using MAX_LAPIC_ID dynamic. Sponsored by: Citrix Systems R&D MFC after: 1 month Reviewed by: kib Differential revision: https://reviews.freebsd.org/D11911 Modified: head/sys/x86/acpica/madt.c head/sys/x86/acpica/srat.c head/sys/x86/include/x86_var.h head/sys/x86/x86/local_apic.c head/sys/x86/x86/mp_x86.c head/sys/x86/x86/mptable.c head/sys/x86/xen/pvcpu_enum.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/acpica/madt.c Thu Aug 10 09:15:18 2017 (r322347) @@ -83,6 +83,8 @@ static int madt_probe(void); static int madt_probe_cpus(void); static void madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg __unused); +static void madt_setup_cpus_handler(ACPI_SUBTABLE_HEADER *entry, + void *arg __unused); static void madt_register(void *dummy); static int madt_setup_local(void); static int madt_setup_io(void); @@ -140,6 +142,7 @@ madt_setup_local(void) bool bios_x2apic; madt = pmap_mapbios(madt_physaddr, madt_length); + madt_walk_table(madt_setup_cpus_handler, NULL); if ((cpu_feature2 & CPUID2_X2APIC) != 0) { reason = NULL; @@ -302,6 +305,19 @@ madt_walk_table(acpi_subtable_handler *handler, void * } static void +madt_parse_cpu(unsigned int apic_id, unsigned int flags) +{ + + if (!(flags & ACPI_MADT_ENABLED) || mp_ncpus == MAXCPU || + apic_id > MAX_APIC_ID) + return; + + mp_ncpus++; + mp_maxid = mp_ncpus - 1; + max_apic_id = max(apic_id, max_apic_id); +} + +static void madt_add_cpu(u_int acpi_id, u_int apic_id, u_int flags) { struct lapic_info *la; @@ -331,6 +347,24 @@ madt_add_cpu(u_int acpi_id, u_int apic_id, u_int flags static void madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + ACPI_MADT_LOCAL_APIC *proc; + ACPI_MADT_LOCAL_X2APIC *x2apic; + + switch (entry->Type) { + case ACPI_MADT_TYPE_LOCAL_APIC: + proc = (ACPI_MADT_LOCAL_APIC *)entry; + madt_parse_cpu(proc->Id, proc->LapicFlags); + break; + case ACPI_MADT_TYPE_LOCAL_X2APIC: + x2apic = (ACPI_MADT_LOCAL_X2APIC *)entry; + madt_parse_cpu(x2apic->LocalApicId, x2apic->LapicFlags); + break; + } +} + +static void +madt_setup_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) { ACPI_MADT_LOCAL_APIC *proc; ACPI_MADT_LOCAL_X2APIC *x2apic; Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/acpica/srat.c Thu Aug 10 09:15:18 2017 (r322347) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/include/x86_var.h Thu Aug 10 09:15:18 2017 (r322347) @@ -78,6 +78,7 @@ extern int _ufssel; extern int _ugssel; extern int use_xsave; extern uint64_t xsave_mask; +extern u_int max_apic_id; struct pcb; struct thread; Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/x86/local_apic.c Thu Aug 10 09:15:18 2017 (r322347) @@ -184,6 +184,7 @@ static struct eventtimer lapic_et; #ifdef SMP static uint64_t lapic_ipi_wait_mult; #endif +unsigned int max_apic_id; SYSCTL_NODE(_hw, OID_AUTO, apic, CTLFLAG_RD, 0, "APIC options"); SYSCTL_INT(_hw_apic, OID_AUTO, x2apic_mode, CTLFLAG_RD, &x2apic_mode, 0, ""); Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/x86/mp_x86.c Thu Aug 10 09:15:18 2017 (r322347) @@ -825,10 +825,6 @@ cpu_add(u_int apic_id, char boot_cpu) boot_cpu_id = apic_id; cpu_info[apic_id].cpu_bsp = 1; } - if (mp_ncpus < MAXCPU) { - mp_ncpus++; - mp_maxid = mp_ncpus - 1; - } if (bootverbose) printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" : "AP"); Modified: head/sys/x86/x86/mptable.c ============================================================================== --- head/sys/x86/x86/mptable.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/x86/mptable.c Thu Aug 10 09:15:18 2017 (r322347) @@ -191,6 +191,7 @@ static void mptable_pci_setup(void); static int mptable_probe(void); static int mptable_probe_cpus(void); static void mptable_probe_cpus_handler(u_char *entry, void *arg __unused); +static void mptable_setup_cpus_handler(u_char *entry, void *arg __unused); static void mptable_register(void *dummy); static int mptable_setup_local(void); static int mptable_setup_io(void); @@ -329,14 +330,11 @@ mptable_probe_cpus(void) /* Is this a pre-defined config? */ if (mpfps->config_type != 0) { - lapic_create(0, 1); - lapic_create(1, 0); + mp_ncpus = 2; + mp_maxid = 1; + max_apic_id = 1; } else { - cpu_mask = 0; mptable_walk_table(mptable_probe_cpus_handler, &cpu_mask); -#ifdef MPTABLE_FORCE_HTT - mptable_hyperthread_fixup(cpu_mask); -#endif } return (0); } @@ -352,9 +350,17 @@ mptable_setup_local(void) /* Is this a pre-defined config? */ printf("MPTable: <"); if (mpfps->config_type != 0) { + lapic_create(0, 1); + lapic_create(1, 0); addr = DEFAULT_APIC_BASE; printf("Default Configuration %d", mpfps->config_type); + } else { + cpu_mask = 0; + mptable_walk_table(mptable_setup_cpus_handler, &cpu_mask); +#ifdef MPTABLE_FORCE_HTT + mptable_hyperthread_fixup(cpu_mask); +#endif addr = mpct->apic_address; printf("%.*s %.*s", (int)sizeof(mpct->oem_id), mpct->oem_id, (int)sizeof(mpct->product_id), mpct->product_id); @@ -464,6 +470,25 @@ mptable_walk_extended_table(mptable_extended_entry_han static void mptable_probe_cpus_handler(u_char *entry, void *arg) +{ + proc_entry_ptr proc; + + switch (*entry) { + case MPCT_ENTRY_PROCESSOR: + proc = (proc_entry_ptr)entry; + if (proc->cpu_flags & PROCENTRY_FLAG_EN && + proc->apic_id < MAX_LAPIC_ID && mp_ncpus < MAXCPU) { + mp_ncpus++; + mp_maxid = mp_ncpus - 1; + max_apic_id = max(max_apic_id, proc->apic_id); + } + break; + } +} + + +static void +mptable_setup_cpus_handler(u_char *entry, void *arg) { proc_entry_ptr proc; u_int *cpu_mask; Modified: head/sys/x86/xen/pvcpu_enum.c ============================================================================== --- head/sys/x86/xen/pvcpu_enum.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/xen/pvcpu_enum.c Thu Aug 10 09:15:18 2017 (r322347) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -151,11 +152,12 @@ xenpv_probe_cpus(void) #ifdef SMP int i, ret; - for (i = 0; i < MAXCPU; i++) { + for (i = 0; i < MAXCPU && (i * 2) < MAX_APIC_ID; i++) { ret = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); - if (ret >= 0) - lapic_create((i * 2), (i == 0)); + mp_ncpus = min(mp_ncpus + 1, MAXCPU); } + mp_maxid = mp_ncpus - 1; + max_apic_id = mp_ncpus * 2; #endif return (0); } @@ -166,6 +168,16 @@ xenpv_probe_cpus(void) static int xenpv_setup_local(void) { +#ifdef SMP + int i, ret; + + for (i = 0; i < MAXCPU && (i * 2) < MAX_APIC_ID; i++) { + ret = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); + if (ret >= 0) + lapic_create((i * 2), (i == 0)); + } +#endif + PCPU_SET(vcpu_id, 0); lapic_init(0); return (0); From owner-svn-src-head@freebsd.org Thu Aug 10 09:16:05 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78048DCCBB6; Thu, 10 Aug 2017 09:16:05 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 527A17C812; Thu, 10 Aug 2017 09:16:05 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A9G4Bx002557; Thu, 10 Aug 2017 09:16:04 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A9G3Rc002550; Thu, 10 Aug 2017 09:16:03 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708100916.v7A9G3Rc002550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 10 Aug 2017 09:16:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322348 - in head/sys/x86: acpica include x86 X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: in head/sys/x86: acpica include x86 X-SVN-Commit-Revision: 322348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 09:16:05 -0000 Author: royger Date: Thu Aug 10 09:16:03 2017 New Revision: 322348 URL: https://svnweb.freebsd.org/changeset/base/322348 Log: x86: make the arrays that depend on MAX_APIC_ID dynamic So that MAX_APIC_ID can be bumped without wasting memory. Note that the usage of MAX_APIC_ID in the SRAT parsing forces the parser to allocate memory directly from the phys_avail physical memory array, which is not the best approach probably, but I haven't found any other way to allocate memory so early in boot. This memory is not returned to the system afterwards, but at least it's sized according to the maximum APIC ID found in the MADT table. Sponsored by: Citrix Systems R&D MFC after: 1 month Reviewed by: kib Differential revision: https://reviews.freebsd.org/D11912 Modified: head/sys/x86/acpica/madt.c head/sys/x86/acpica/srat.c head/sys/x86/include/apicvar.h head/sys/x86/include/x86_smp.h head/sys/x86/x86/local_apic.c head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/acpica/madt.c Thu Aug 10 09:16:03 2017 (r322348) @@ -59,7 +59,7 @@ static struct { static struct lapic_info { u_int la_enabled; u_int la_acpi_id; -} lapics[MAX_APIC_ID + 1]; +} *lapics; int madt_found_sci_override; static ACPI_TABLE_MADT *madt; @@ -141,8 +141,6 @@ madt_setup_local(void) int user_x2apic; bool bios_x2apic; - madt = pmap_mapbios(madt_physaddr, madt_length); - madt_walk_table(madt_setup_cpus_handler, NULL); if ((cpu_feature2 & CPUID2_X2APIC) != 0) { reason = NULL; @@ -214,6 +212,11 @@ madt_setup_local(void) } } + madt = pmap_mapbios(madt_physaddr, madt_length); + lapics = malloc(sizeof(*lapics) * (max_apic_id + 1), M_MADT, + M_WAITOK | M_ZERO); + madt_walk_table(madt_setup_cpus_handler, NULL); + lapic_init(madt->Address); printf("ACPI APIC Table: <%.*s %.*s>\n", (int)sizeof(madt->Header.OemId), madt->Header.OemId, @@ -236,6 +239,8 @@ madt_setup_io(void) u_int pin; int i; + KASSERT(lapics != NULL, ("local APICs not initialized")); + /* Try to initialize ACPI so that we can access the FADT. */ i = acpi_Startup(); if (ACPI_FAILURE(i)) { @@ -282,6 +287,10 @@ madt_setup_io(void) free(ioapics, M_MADT); ioapics = NULL; + /* NB: this is the last use of the lapics array. */ + free(lapics, M_MADT); + lapics = NULL; + return (0); } @@ -332,7 +341,7 @@ madt_add_cpu(u_int acpi_id, u_int apic_id, u_int flags "enabled" : "disabled"); if (!(flags & ACPI_MADT_ENABLED)) return; - if (apic_id > MAX_APIC_ID) { + if (apic_id > max_apic_id) { printf("MADT: Ignoring local APIC ID %u (too high)\n", apic_id); return; @@ -471,7 +480,7 @@ madt_find_cpu(u_int acpi_id, u_int *apic_id) { int i; - for (i = 0; i <= MAX_APIC_ID; i++) { + for (i = 0; i <= max_apic_id; i++) { if (!lapics[i].la_enabled) continue; if (lapics[i].la_acpi_id != acpi_id) @@ -723,6 +732,9 @@ madt_set_ids(void *dummy) if (madt == NULL) return; + + KASSERT(lapics != NULL, ("local APICs not initialized")); + CPU_FOREACH(i) { pc = pcpu_find(i); KASSERT(pc != NULL, ("no pcpu data for CPU %u", i)); Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/acpica/srat.c Thu Aug 10 09:16:03 2017 (r322348) @@ -55,11 +55,11 @@ __FBSDID("$FreeBSD$"); #include #if MAXMEMDOM > 1 -struct cpu_info { +static struct cpu_info { int enabled:1; int has_memory:1; int domain; -} cpus[MAX_APIC_ID + 1]; +} *cpus; struct mem_affinity mem_info[VM_PHYSSEG_MAX + 1]; int num_mem; @@ -204,7 +204,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar "enabled" : "disabled"); if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) break; - if (cpu->ApicId > MAX_APIC_ID) { + if (cpu->ApicId > max_apic_id) { printf("SRAT: Ignoring local APIC ID %u (too high)\n", cpu->ApicId); break; @@ -228,7 +228,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar "enabled" : "disabled"); if (!(x2apic->Flags & ACPI_SRAT_CPU_ENABLED)) break; - if (x2apic->ApicId > MAX_APIC_ID) { + if (x2apic->ApicId > max_apic_id) { printf("SRAT: Ignoring local APIC ID %u (too high)\n", x2apic->ApicId); break; @@ -294,7 +294,7 @@ check_domains(void) for (i = 0; i < num_mem; i++) { found = 0; - for (j = 0; j <= MAX_APIC_ID; j++) + for (j = 0; j <= max_apic_id; j++) if (cpus[j].enabled && cpus[j].domain == mem_info[i].domain) { cpus[j].has_memory = 1; @@ -306,7 +306,7 @@ check_domains(void) return (ENXIO); } } - for (i = 0; i <= MAX_APIC_ID; i++) + for (i = 0; i <= max_apic_id; i++) if (cpus[i].enabled && !cpus[i].has_memory) { printf("SRAT: No memory found for CPU %d\n", i); return (ENXIO); @@ -401,7 +401,7 @@ renumber_domains(void) for (j = 0; j < num_mem; j++) if (mem_info[j].domain == domain_pxm[i]) mem_info[j].domain = i; - for (j = 0; j <= MAX_APIC_ID; j++) + for (j = 0; j <= max_apic_id; j++) if (cpus[j].enabled && cpus[j].domain == domain_pxm[i]) cpus[j].domain = i; } @@ -415,6 +415,8 @@ renumber_domains(void) static int parse_srat(void) { + unsigned int idx, size; + vm_paddr_t addr; int error; if (resource_disabled("srat", 0)) @@ -423,6 +425,25 @@ parse_srat(void) srat_physaddr = acpi_find_table(ACPI_SIG_SRAT); if (srat_physaddr == 0) return (-1); + + /* + * Allocate data structure: + * + * Find the last physical memory region and steal some memory from + * it. This is done because at this point in the boot process + * malloc is still not usable. + */ + for (idx = 0; phys_avail[idx + 1] != 0; idx += 2); + KASSERT(idx != 0, ("phys_avail is empty!")); + idx -= 2; + + size = sizeof(*cpus) * (max_apic_id + 1); + addr = trunc_page(phys_avail[idx + 1] - size); + KASSERT(addr >= phys_avail[idx], + ("Not enough memory for SRAT table items")); + phys_avail[idx + 1] = addr - 1; + + cpus = (struct cpu_info *)PHYS_TO_DMAP(addr); /* * Make a pass over the table to populate the cpus[] and Modified: head/sys/x86/include/apicvar.h ============================================================================== --- head/sys/x86/include/apicvar.h Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/include/apicvar.h Thu Aug 10 09:16:03 2017 (r322348) @@ -182,7 +182,7 @@ inthand_t IDTVEC(spuriousint), IDTVEC(timerint); extern vm_paddr_t lapic_paddr; -extern int apic_cpuids[]; +extern int *apic_cpuids; void apic_register_enumerator(struct apic_enumerator *enumerator); void *ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase); Modified: head/sys/x86/include/x86_smp.h ============================================================================== --- head/sys/x86/include/x86_smp.h Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/include/x86_smp.h Thu Aug 10 09:16:03 2017 (r322348) @@ -54,7 +54,7 @@ struct cpu_info { int cpu_disabled:1; int cpu_hyperthread:1; }; -extern struct cpu_info cpu_info[]; +extern struct cpu_info *cpu_info; #ifdef COUNT_IPIS extern u_long *ipi_invltlb_counts[MAXCPU]; Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/x86/local_apic.c Thu Aug 10 09:16:03 2017 (r322348) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -83,6 +84,8 @@ __FBSDID("$FreeBSD$"); #define GSEL_APIC GSEL(GCODE_SEL, SEL_KPL) #endif +static MALLOC_DEFINE(M_LAPIC, "local_apic", "Local APIC items"); + /* Sanity checks on IDT vectors. */ CTASSERT(APIC_IO_INTS + APIC_NUM_IOINTS == APIC_TIMER_INT); CTASSERT(APIC_TIMER_INT < APIC_LOCAL_INTS); @@ -134,7 +137,7 @@ struct lapic { uint32_t lvt_timer_last; /* Include IDT_SYSCALL to make indexing easier. */ int la_ioint_irqs[APIC_NUM_IOINTS + 1]; -} static lapics[MAX_APIC_ID + 1]; +} static *lapics; /* Global defaults for local APIC LVT entries. */ static struct lvt lvts[APIC_LVT_MAX + 1] = { @@ -601,7 +604,7 @@ native_lapic_create(u_int apic_id, int boot_cpu) { int i; - if (apic_id > MAX_APIC_ID) { + if (apic_id > max_apic_id) { printf("APIC: Ignoring local APIC with ID %d\n", apic_id); if (boot_cpu) panic("Can't ignore BSP"); @@ -1661,7 +1664,7 @@ DB_SHOW_COMMAND(apic, db_show_apic) verbose = 1; else verbose = 0; - for (apic_id = 0; apic_id <= MAX_APIC_ID; apic_id++) { + for (apic_id = 0; apic_id <= max_apic_id; apic_id++) { if (lapics[apic_id].la_present == 0) continue; db_printf("Interrupts bound to lapic %u\n", apic_id); @@ -1861,6 +1864,9 @@ apic_setup_local(void *dummy __unused) if (best_enum == NULL) return; + + lapics = malloc(sizeof(*lapics) * (max_apic_id + 1), M_LAPIC, + M_WAITOK | M_ZERO); /* Initialize the local APIC. */ retval = best_enum->apic_setup_local(); Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/x86/mp_x86.c Thu Aug 10 09:16:03 2017 (r322348) @@ -84,6 +84,8 @@ __FBSDID("$FreeBSD$"); #define BIOS_RESET (0x0f) #define BIOS_WARM (0x0a) +static MALLOC_DEFINE(M_CPUS, "cpus", "CPU items"); + /* lock region used by kernel profiling */ int mcount_lock; @@ -132,8 +134,8 @@ volatile int aps_ready = 0; * Store data from cpu_add() until later in the boot when we actually setup * the APs. */ -struct cpu_info cpu_info[MAX_APIC_ID + 1]; -int apic_cpuids[MAX_APIC_ID + 1]; +struct cpu_info *cpu_info; +int *apic_cpuids; int cpu_apic_ids[MAXCPU]; /* Holds pending bitmap based IPIs per CPU */ @@ -546,7 +548,7 @@ topo_probe(void) nlayers++; topo_init_root(&topo_root); - for (i = 0; i <= MAX_APIC_ID; ++i) { + for (i = 0; i <= max_apic_id; ++i) { if (!cpu_info[i].cpu_present) continue; @@ -803,6 +805,19 @@ cpu_topo(void) return (cg_root); } +static void +cpu_alloc(void *dummy __unused) +{ + /* + * Dynamically allocate the arrays that depend on the + * maximum APIC ID. + */ + cpu_info = malloc(sizeof(*cpu_info) * (max_apic_id + 1), M_CPUS, + M_WAITOK | M_ZERO); + apic_cpuids = malloc(sizeof(*apic_cpuids) * (max_apic_id + 1), M_CPUS, + M_WAITOK | M_ZERO); +} +SYSINIT(cpu_alloc, SI_SUB_CPU, SI_ORDER_FIRST, cpu_alloc, NULL); /* * Add a logical CPU to the topology. @@ -811,7 +826,7 @@ void cpu_add(u_int apic_id, char boot_cpu) { - if (apic_id > MAX_APIC_ID) { + if (apic_id > max_apic_id) { panic("SMP: APIC ID %d too high", apic_id); return; } From owner-svn-src-head@freebsd.org Thu Aug 10 09:16:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0017DCCC49; Thu, 10 Aug 2017 09:16:41 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A3F67C96A; Thu, 10 Aug 2017 09:16:41 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A9Ged2002619; Thu, 10 Aug 2017 09:16:40 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A9Genk002615; Thu, 10 Aug 2017 09:16:40 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708100916.v7A9Genk002615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 10 Aug 2017 09:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322349 - in head/sys/x86: acpica include x86 X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: in head/sys/x86: acpica include x86 X-SVN-Commit-Revision: 322349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 09:16:41 -0000 Author: royger Date: Thu Aug 10 09:16:40 2017 New Revision: 322349 URL: https://svnweb.freebsd.org/changeset/base/322349 Log: x86: bump MAX_APIC_ID to 512 Introduce a new define to take int account the xAPIC ID limit, for systems where x2APIC is not available/reliable. Also change some of the usages of the APIC ID to use an unsigned int (which is the correct storage type to deal with x2APIC IDs as found in x2APIC MADT entries). This allows booting FreeBSD on a box with 256 CPUs and APIC IDs up to 295: FreeBSD/SMP: Multiprocessor System Detected: 256 CPUs FreeBSD/SMP: 1 package(s) x 64 core(s) x 4 hardware threads Package HW ID = 0 Core HW ID = 0 CPU0 (BSP): APIC ID: 0 CPU1 (AP/HT): APIC ID: 1 CPU2 (AP/HT): APIC ID: 2 CPU3 (AP/HT): APIC ID: 3 [...] Core HW ID = 73 CPU252 (AP): APIC ID: 292 CPU253 (AP/HT): APIC ID: 293 CPU254 (AP/HT): APIC ID: 294 CPU255 (AP/HT): APIC ID: 295 Submitted by: kib (previous version) Relnotes: yes MFC after: 1 month Reviewed by: kib Differential revision: https://reviews.freebsd.org/D11913 Modified: head/sys/x86/acpica/madt.c head/sys/x86/include/apicvar.h head/sys/x86/x86/mp_x86.c head/sys/x86/x86/mptable.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Thu Aug 10 09:16:03 2017 (r322348) +++ head/sys/x86/acpica/madt.c Thu Aug 10 09:16:40 2017 (r322349) @@ -212,6 +212,14 @@ madt_setup_local(void) } } + /* + * Truncate max_apic_id if not in x2APIC mode. Some structures + * will already be allocated with the previous max_apic_id, but + * at least we can prevent wasting more memory elsewhere. + */ + if (!x2apic_mode) + max_apic_id = min(max_apic_id, xAPIC_MAX_APIC_ID); + madt = pmap_mapbios(madt_physaddr, madt_length); lapics = malloc(sizeof(*lapics) * (max_apic_id + 1), M_MADT, M_WAITOK | M_ZERO); @@ -250,7 +258,7 @@ madt_setup_io(void) panic("Using MADT but ACPI doesn't work"); } - ioapics = malloc(sizeof(*ioapics) * (MAX_APIC_ID + 1), M_MADT, + ioapics = malloc(sizeof(*ioapics) * (IOAPIC_MAX_ID + 1), M_MADT, M_WAITOK | M_ZERO); /* First, we run through adding I/O APIC's. */ @@ -277,7 +285,7 @@ madt_setup_io(void) } /* Third, we register all the I/O APIC's. */ - for (i = 0; i <= MAX_APIC_ID; i++) + for (i = 0; i <= IOAPIC_MAX_ID; i++) if (ioapics[i].io_apic != NULL) ioapic_register(ioapics[i].io_apic); @@ -408,7 +416,7 @@ madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *ar "MADT: Found IO APIC ID %u, Interrupt %u at %p\n", apic->Id, apic->GlobalIrqBase, (void *)(uintptr_t)apic->Address); - if (apic->Id > MAX_APIC_ID) + if (apic->Id > IOAPIC_MAX_ID) panic("%s: I/O APIC ID %u too high", __func__, apic->Id); if (ioapics[apic->Id].io_apic != NULL) @@ -501,7 +509,7 @@ madt_find_interrupt(int intr, void **apic, u_int *pin) int i, best; best = -1; - for (i = 0; i <= MAX_APIC_ID; i++) { + for (i = 0; i <= IOAPIC_MAX_ID; i++) { if (ioapics[i].io_apic == NULL || ioapics[i].io_vector > intr) continue; Modified: head/sys/x86/include/apicvar.h ============================================================================== --- head/sys/x86/include/apicvar.h Thu Aug 10 09:16:03 2017 (r322348) +++ head/sys/x86/include/apicvar.h Thu Aug 10 09:16:40 2017 (r322349) @@ -74,8 +74,12 @@ * I/O device! */ -#define MAX_APIC_ID 0xfe -#define APIC_ID_ALL 0xff +#define xAPIC_MAX_APIC_ID 0xfe +#define xAPIC_ID_ALL 0xff +#define MAX_APIC_ID 0x200 +#define APIC_ID_ALL 0xffffffff + +#define IOAPIC_MAX_ID xAPIC_MAX_APIC_ID /* I/O Interrupts are used for external devices such as ISA, PCI, etc. */ #define APIC_IO_INTS (IDT_IO_INTS + 16) Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Thu Aug 10 09:16:03 2017 (r322348) +++ head/sys/x86/x86/mp_x86.c Thu Aug 10 09:16:40 2017 (r322349) @@ -137,6 +137,10 @@ volatile int aps_ready = 0; struct cpu_info *cpu_info; int *apic_cpuids; int cpu_apic_ids[MAXCPU]; +_Static_assert(MAXCPU <= MAX_APIC_ID, + "MAXCPU cannot be larger that MAX_APIC_ID"); +_Static_assert(xAPIC_MAX_APIC_ID <= MAX_APIC_ID, + "xAPIC_MAX_APIC_ID cannot be larger that MAX_APIC_ID"); /* Holds pending bitmap based IPIs per CPU */ volatile u_int cpu_ipi_pending[MAXCPU]; @@ -830,18 +834,18 @@ cpu_add(u_int apic_id, char boot_cpu) panic("SMP: APIC ID %d too high", apic_id); return; } - KASSERT(cpu_info[apic_id].cpu_present == 0, ("CPU %d added twice", + KASSERT(cpu_info[apic_id].cpu_present == 0, ("CPU %u added twice", apic_id)); cpu_info[apic_id].cpu_present = 1; if (boot_cpu) { KASSERT(boot_cpu_id == -1, - ("CPU %d claims to be BSP, but CPU %d already is", apic_id, + ("CPU %u claims to be BSP, but CPU %u already is", apic_id, boot_cpu_id)); boot_cpu_id = apic_id; cpu_info[apic_id].cpu_bsp = 1; } if (bootverbose) - printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" : + printf("SMP: Added CPU %u (%s)\n", apic_id, boot_cpu ? "BSP" : "AP"); } Modified: head/sys/x86/x86/mptable.c ============================================================================== --- head/sys/x86/x86/mptable.c Thu Aug 10 09:16:03 2017 (r322348) +++ head/sys/x86/x86/mptable.c Thu Aug 10 09:16:40 2017 (r322349) @@ -159,7 +159,7 @@ struct pci_route_interrupt_args { static mpfps_t mpfps; static mpcth_t mpct; static ext_entry_ptr mpet; -static void *ioapics[MAX_APIC_ID + 1]; +static void *ioapics[IOAPIC_MAX_ID + 1]; static bus_datum *busses; static int mptable_nioapics, mptable_nbusses, mptable_maxbusid; static int pci0 = -1; @@ -393,7 +393,7 @@ mptable_setup_io(void) mptable_parse_ints(); /* Fourth, we register all the I/O APIC's. */ - for (i = 0; i <= MAX_APIC_ID; i++) + for (i = 0; i <= IOAPIC_MAX_ID; i++) if (ioapics[i] != NULL) ioapic_register(ioapics[i]); @@ -589,7 +589,7 @@ mptable_parse_apics_and_busses_handler(u_char *entry, apic = (io_apic_entry_ptr)entry; if (!(apic->apic_flags & IOAPICENTRY_FLAG_EN)) break; - if (apic->apic_id > MAX_APIC_ID) + if (apic->apic_id > IOAPIC_MAX_ID) panic("%s: I/O APIC ID %d too high", __func__, apic->apic_id); if (ioapics[apic->apic_id] != NULL) @@ -736,7 +736,7 @@ mptable_parse_io_int(int_entry_ptr intr) return; } } - if (apic_id > MAX_APIC_ID) { + if (apic_id > IOAPIC_MAX_ID) { printf("MPTable: Ignoring interrupt entry for ioapic%d\n", intr->dst_apic_id); return; From owner-svn-src-head@freebsd.org Thu Aug 10 09:17:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C914EDCCCA6; Thu, 10 Aug 2017 09:17:17 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 983507CABF; Thu, 10 Aug 2017 09:17:17 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A9HGMr002687; Thu, 10 Aug 2017 09:17:16 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A9HGNS002686; Thu, 10 Aug 2017 09:17:16 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708100917.v7A9HGNS002686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 10 Aug 2017 09:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322350 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 09:17:17 -0000 Author: royger Date: Thu Aug 10 09:17:16 2017 New Revision: 322350 URL: https://svnweb.freebsd.org/changeset/base/322350 Log: calendars: add myself to the FreeBSD calendar Reported by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 09:16:40 2017 (r322349) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 09:17:16 2017 (r322350) @@ -223,6 +223,7 @@ 06/06 Alan Eldridge died in Denver, Colorado, 2003 06/07 Jimmy Olgeni born in Milano, Italy, 1976 06/07 Benjamin Close born in Adelaide, Australia, 1978 +06/07 Roger Pau Monne born in Reus, Catalunya, Spain, 1986 06/08 Ravi Pokala born in Royal Oak, Michigan, United States, 1980 06/09 Stanislav Galabov born in Sofia, Bulgaria 1978 06/11 Alonso Cardenas Marquez born in Arequipa, Peru, 1979 From owner-svn-src-head@freebsd.org Thu Aug 10 10:59:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF4DEDCEABC; Thu, 10 Aug 2017 10:59:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 848CD7F4D3; Thu, 10 Aug 2017 10:59:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AAx5Bb043135; Thu, 10 Aug 2017 10:59:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AAx5f8043134; Thu, 10 Aug 2017 10:59:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708101059.v7AAx5f8043134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 10 Aug 2017 10:59:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322351 - head/usr.sbin/acpi/acpidump X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 322351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 10:59:07 -0000 Author: mav Date: Thu Aug 10 10:59:05 2017 New Revision: 322351 URL: https://svnweb.freebsd.org/changeset/base/322351 Log: Add two NFIT fields missed in r321298. MFC after: 2 weeks Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 10 09:17:16 2017 (r322350) +++ head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 10 10:59:05 2017 (r322351) @@ -1236,6 +1236,7 @@ acpi_print_nfit(ACPI_NFIT_HEADER *nfit) (uintmax_t)mmap->RegionOffset); printf("\tAddress=0x%016jx\n", (uintmax_t)mmap->Address); printf("\tInterleaveIndex=%u\n", (u_int)mmap->InterleaveIndex); + printf("\tInterleaveWays=%u\n", (u_int)mmap->InterleaveWays); #define PRINTFLAG(var, flag) printflag((var), ACPI_NFIT_MEM_## flag, #flag) @@ -1283,6 +1284,7 @@ acpi_print_nfit(ACPI_NFIT_HEADER *nfit) (u_int)ctlreg->ManufacturingDate); printf("\tSerialNumber=%u\n", (u_int)ctlreg->SerialNumber); + printf("\tCode=0x%04x\n", (u_int)ctlreg->Code); printf("\tWindows=%u\n", (u_int)ctlreg->Windows); printf("\tWindowSize=0x%016jx\n", (uintmax_t)ctlreg->WindowSize); From owner-svn-src-head@freebsd.org Thu Aug 10 12:30:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7854DD14E0; Thu, 10 Aug 2017 12:30:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 857D082172; Thu, 10 Aug 2017 12:30:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ACUYuv079720; Thu, 10 Aug 2017 12:30:34 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ACUYla079719; Thu, 10 Aug 2017 12:30:34 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708101230.v7ACUYla079719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 10 Aug 2017 12:30:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322352 - head/release/packages X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/packages X-SVN-Commit-Revision: 322352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 12:30:35 -0000 Author: gjb Date: Thu Aug 10 12:30:34 2017 New Revision: 322352 URL: https://svnweb.freebsd.org/changeset/base/322352 Log: Revise part of r322327 in release/packages/kernel.ucl. It appears I misunderstand process forking and signal handling in how the pre-/post-install scripts are executed internally by pkg(8). In some cases (not all), ^C when prompted to cancel the kernel package update will stop the pre-install script from executing, but allow pkg(8) to continue extracting the package when it is not the intent. In order to keep somewhat of an anti-footshooting measure in place, print the recommendation to install the kernel package first if ASSUME_ALWAYS_YES is false and TERM is set, then sleep for 5 seconds to allow the user to see the message. MFC after: 5 days MFC with: r322327 X-MFC-Note: Maybe not until I am happy with this.. Sponsored by: The FreeBSD Foundation Modified: head/release/packages/kernel.ucl Modified: head/release/packages/kernel.ucl ============================================================================== --- head/release/packages/kernel.ucl Thu Aug 10 10:59:05 2017 (r322351) +++ head/release/packages/kernel.ucl Thu Aug 10 12:30:34 2017 (r322352) @@ -25,6 +25,9 @@ scripts: { continue ;; esac + if [ -z "${TERM}" ]; then + exit 0 + fi echo "****************************************************************" echo "It is recommended to install the FreeBSD-%PKGNAME% package" echo "with:" @@ -37,16 +40,7 @@ scripts: { echo " pkg upgrade" echo echo "****************************************************************" - echo - echo "Do you want to continue anyway?" - echo "[Enter] to continue, ^C to cancel." - echo - read ANSWER - case ${ANSWER} in - *) - continue - ;; - esac + sleep 5 EOD post-install = < Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 863B4DD1744; Thu, 10 Aug 2017 12:31:56 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 506BC823E6; Thu, 10 Aug 2017 12:31:56 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ACVtDe082585; Thu, 10 Aug 2017 12:31:55 GMT (envelope-from oleg@FreeBSD.org) Received: (from oleg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ACVttu082584; Thu, 10 Aug 2017 12:31:55 GMT (envelope-from oleg@FreeBSD.org) Message-Id: <201708101231.v7ACVttu082584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oleg set sender to oleg@FreeBSD.org using -f From: Oleg Bulyzhin Date: Thu, 10 Aug 2017 12:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322353 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: oleg X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 12:31:56 -0000 Author: oleg Date: Thu Aug 10 12:31:55 2017 New Revision: 322353 URL: https://svnweb.freebsd.org/changeset/base/322353 Log: Add myself. Reported by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 12:30:34 2017 (r322352) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 12:31:55 2017 (r322353) @@ -155,6 +155,7 @@ 04/22 Jakub Klama born in Blachownia, Silesia, Poland, 1989 04/25 Richard Gallamore born in Kissimmee, Florida, United States, 1987 04/26 Rene Ladan born in Geldrop, the Netherlands, 1980 +04/28 Oleg Bulyzhin born in Kharkov, USSR, 1976 04/28 Andriy Voskoboinyk born in Bila Tserkva, Ukraine, 1992 04/29 Adam Weinberger born in Berkeley, California, United States, 1980 04/29 Eric Anholt born in Portland, Oregon, United States, 1983 From owner-svn-src-head@freebsd.org Thu Aug 10 12:51:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BD09DD1CD2; Thu, 10 Aug 2017 12:51:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17DC882D08; Thu, 10 Aug 2017 12:51:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ACp5g0088243; Thu, 10 Aug 2017 12:51:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ACp5oL088242; Thu, 10 Aug 2017 12:51:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708101251.v7ACp5oL088242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 10 Aug 2017 12:51:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322354 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 322354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 12:51:06 -0000 Author: hselasky Date: Thu Aug 10 12:51:04 2017 New Revision: 322354 URL: https://svnweb.freebsd.org/changeset/base/322354 Log: Make sure the linux_wait_event_common() function in the LinuxKPI properly handles a timeout value of MAX_SCHEDULE_TIMEOUT which basically means there is no timeout. This is a regression issue after r319757. While at it change the type of returned variable from "long" to "int" to match the actual return type. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_schedule.c Modified: head/sys/compat/linuxkpi/common/src/linux_schedule.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_schedule.c Thu Aug 10 12:31:55 2017 (r322353) +++ head/sys/compat/linuxkpi/common/src/linux_schedule.c Thu Aug 10 12:51:04 2017 (r322354) @@ -213,12 +213,18 @@ linux_wait_event_common(wait_queue_head_t *wqh, wait_q unsigned int state, spinlock_t *lock) { struct task_struct *task; - long ret; + int ret; if (lock != NULL) spin_unlock_irq(lock); DROP_GIANT(); + + /* range check timeout */ + if (timeout < 1) + timeout = 1; + else if (timeout == MAX_SCHEDULE_TIMEOUT) + timeout = 0; task = current; From owner-svn-src-head@freebsd.org Thu Aug 10 13:00:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE622DD1EA2; Thu, 10 Aug 2017 13:00:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D2C683326; Thu, 10 Aug 2017 13:00:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AD0AvK091860; Thu, 10 Aug 2017 13:00:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AD0AIN091859; Thu, 10 Aug 2017 13:00:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708101300.v7AD0AIN091859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 10 Aug 2017 13:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322355 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 322355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 13:00:11 -0000 Author: hselasky Date: Thu Aug 10 13:00:10 2017 New Revision: 322355 URL: https://svnweb.freebsd.org/changeset/base/322355 Log: Fixes for wait event in the LinuxKPI. These are regression issues after r319757. 1) Correct the return value from __wait_event_common() from 1 to 0 in case the timeout is specified as MAX_SCHEDULE_TIMEOUT. In the other case __ret is zero and will be substituted in the last part of the macro with the appropriate value before return. 2) Make sure the "timeout" argument is casted to "int" before evaluating negativity. Else the signedness of a "long" might be checked instead of the signedness of an integer. 3) The wait_event() function should not have a return value. Found by: KrishnamRaju ErapaRaju MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/wait.h Thu Aug 10 12:51:04 2017 (r322354) +++ head/sys/compat/linuxkpi/common/include/linux/wait.h Thu Aug 10 13:00:10 2017 (r322355) @@ -127,16 +127,14 @@ int linux_wait_event_common(wait_queue_head_t *, wait_ */ #define __wait_event_common(wqh, cond, timeout, state, lock) ({ \ DEFINE_WAIT(__wq); \ - const int __timeout = (timeout) < 1 ? 1 : (timeout); \ + const int __timeout = ((int)(timeout)) < 1 ? 1 : (timeout); \ int __start = ticks; \ int __ret = 0; \ \ for (;;) { \ linux_prepare_to_wait(&(wqh), &__wq, state); \ - if (cond) { \ - __ret = 1; \ + if (cond) \ break; \ - } \ __ret = linux_wait_event_common(&(wqh), &__wq, \ __timeout, state, lock); \ if (__ret != 0) \ @@ -158,10 +156,10 @@ int linux_wait_event_common(wait_queue_head_t *, wait_ __ret; \ }) -#define wait_event(wqh, cond) ({ \ - __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ +#define wait_event(wqh, cond) do { \ + (void) __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ TASK_UNINTERRUPTIBLE, NULL); \ -}) +} while (0) #define wait_event_timeout(wqh, cond, timeout) ({ \ __wait_event_common(wqh, cond, timeout, TASK_UNINTERRUPTIBLE, \ From owner-svn-src-head@freebsd.org Thu Aug 10 13:01:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD826DD203B; Thu, 10 Aug 2017 13:01:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C9F183600; Thu, 10 Aug 2017 13:01:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AD1JoB095843; Thu, 10 Aug 2017 13:01:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AD1JPM095842; Thu, 10 Aug 2017 13:01:19 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708101301.v7AD1JPM095842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 10 Aug 2017 13:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322356 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 13:01:20 -0000 Author: emaste Date: Thu Aug 10 13:01:19 2017 New Revision: 322356 URL: https://svnweb.freebsd.org/changeset/base/322356 Log: Mark PROFILE option as broken when targetting mips64 The assembly in sys/mips/include/profile.h will only work for o32 ABI. Submitted by: Alexander Richardson MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11950 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Thu Aug 10 13:00:10 2017 (r322355) +++ head/share/mk/src.opts.mk Thu Aug 10 13:01:19 2017 (r322356) @@ -282,7 +282,10 @@ BROKEN_OPTIONS+=SSP .if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*} BROKEN_OPTIONS+=EFI .endif - +.if ${__T:Mmips64*} +# profiling won't work on MIPS64 because there is only assembly for o32 +BROKEN_OPTIONS+=PROFILE +.endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ ${__T} == "powerpc64" || ${__T} == "sparc64" __DEFAULT_YES_OPTIONS+=CXGBETOOL From owner-svn-src-head@freebsd.org Thu Aug 10 13:05:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21498DD20D8; Thu, 10 Aug 2017 13:05:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F18A083882; Thu, 10 Aug 2017 13:05:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AD5fT6096021; Thu, 10 Aug 2017 13:05:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AD5eK3096017; Thu, 10 Aug 2017 13:05:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708101305.v7AD5eK3096017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 10 Aug 2017 13:05:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322357 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 322357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 13:05:42 -0000 Author: hselasky Date: Thu Aug 10 13:05:40 2017 New Revision: 322357 URL: https://svnweb.freebsd.org/changeset/base/322357 Log: Use integer type to pass around jiffies and/or ticks values in the LinuxKPI because in FreeBSD ticks are 32-bit. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/completion.h head/sys/compat/linuxkpi/common/include/linux/jiffies.h head/sys/compat/linuxkpi/common/include/linux/timer.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/completion.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/completion.h Thu Aug 10 13:01:19 2017 (r322356) +++ head/sys/compat/linuxkpi/common/include/linux/completion.h Thu Aug 10 13:05:40 2017 (r322357) @@ -61,8 +61,8 @@ struct completion { linux_completion_done(c) extern void linux_complete_common(struct completion *, int); -extern long linux_wait_for_common(struct completion *, int); -extern long linux_wait_for_timeout_common(struct completion *, long, int); +extern int linux_wait_for_common(struct completion *, int); +extern int linux_wait_for_timeout_common(struct completion *, int, int); extern int linux_try_wait_for_completion(struct completion *); extern int linux_completion_done(struct completion *); Modified: head/sys/compat/linuxkpi/common/include/linux/jiffies.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/jiffies.h Thu Aug 10 13:01:19 2017 (r322356) +++ head/sys/compat/linuxkpi/common/include/linux/jiffies.h Thu Aug 10 13:05:40 2017 (r322357) @@ -141,7 +141,7 @@ get_jiffies_64(void) } static inline int -linux_timer_jiffies_until(unsigned long expires) +linux_timer_jiffies_until(int expires) { int delta = expires - jiffies; /* guard against already expired values */ Modified: head/sys/compat/linuxkpi/common/include/linux/timer.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/timer.h Thu Aug 10 13:01:19 2017 (r322356) +++ head/sys/compat/linuxkpi/common/include/linux/timer.h Thu Aug 10 13:05:40 2017 (r322357) @@ -41,7 +41,7 @@ struct timer_list { struct callout timer_callout; void (*function) (unsigned long); unsigned long data; - unsigned long expires; + int expires; }; extern unsigned long linux_timer_hz_mask; @@ -65,7 +65,7 @@ extern unsigned long linux_timer_hz_mask; callout_init(&(timer)->timer_callout, 1); \ } while (0) -extern void mod_timer(struct timer_list *, unsigned long); +extern void mod_timer(struct timer_list *, int); extern void add_timer(struct timer_list *); extern void add_timer_on(struct timer_list *, int cpu); @@ -73,7 +73,7 @@ extern void add_timer_on(struct timer_list *, int cpu) #define del_timer_sync(timer) callout_drain(&(timer)->timer_callout) #define timer_pending(timer) callout_pending(&(timer)->timer_callout) #define round_jiffies(j) \ - ((unsigned long)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask)) + ((int)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask)) #define round_jiffies_relative(j) round_jiffies(j) #define round_jiffies_up(j) round_jiffies(j) #define round_jiffies_up_relative(j) round_jiffies_up(j) Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Aug 10 13:01:19 2017 (r322356) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Aug 10 13:05:40 2017 (r322357) @@ -1598,7 +1598,7 @@ linux_timer_callback_wrapper(void *context) } void -mod_timer(struct timer_list *timer, unsigned long expires) +mod_timer(struct timer_list *timer, int expires) { timer->expires = expires; @@ -1660,10 +1660,10 @@ linux_complete_common(struct completion *c, int all) /* * Indefinite wait for done != 0 with or without signals. */ -long +int linux_wait_for_common(struct completion *c, int flags) { - long error; + int error; if (SCHEDULER_STOPPED()) return (0); @@ -1700,10 +1700,11 @@ intr: /* * Time limited wait for done != 0 with or without signals. */ -long -linux_wait_for_timeout_common(struct completion *c, long timeout, int flags) +int +linux_wait_for_timeout_common(struct completion *c, int timeout, int flags) { - long end = jiffies + timeout, error; + int end = jiffies + timeout; + int error; int ret; if (SCHEDULER_STOPPED()) From owner-svn-src-head@freebsd.org Thu Aug 10 13:32:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17A48DD2CC4; Thu, 10 Aug 2017 13:32:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D66C3E20; Thu, 10 Aug 2017 13:32:05 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ADW5iS008389; Thu, 10 Aug 2017 13:32:05 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ADW52T008388; Thu, 10 Aug 2017 13:32:05 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708101332.v7ADW52T008388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 10 Aug 2017 13:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322358 - head/release/packages X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/packages X-SVN-Commit-Revision: 322358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 13:32:06 -0000 Author: gjb Date: Thu Aug 10 13:32:04 2017 New Revision: 322358 URL: https://svnweb.freebsd.org/changeset/base/322358 Log: Further revise r322327 and r322352 in release/packages/kernel.ucl. Use PPID and PID to kill off the pre-install and parent pkg(8) processes unless 'Y' or 'y' are entered at the prompt if the user wants to proceed with upgrading the kernel and userland at the same time. This restores some of the logic and intent of r322327, with the caveat of printing "child process terminated unexpectedly." MFC after: 5 days MFC with: r322327, r322352 Sponsored by: The FreeBSD Foundation Modified: head/release/packages/kernel.ucl Modified: head/release/packages/kernel.ucl ============================================================================== --- head/release/packages/kernel.ucl Thu Aug 10 13:05:40 2017 (r322357) +++ head/release/packages/kernel.ucl Thu Aug 10 13:32:04 2017 (r322358) @@ -40,7 +40,17 @@ scripts: { echo " pkg upgrade" echo echo "****************************************************************" - sleep 5 + echo + echo "Do you want to continue anyway? (N/y)" + read ANSWER + case ${ANSWER} in + [Yy]) + exit 0 + ;; + *) + kill ${PPID} ${PID} + ;; + esac EOD post-install = < Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEE33DD34E6; Thu, 10 Aug 2017 13:45:57 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE329174C; Thu, 10 Aug 2017 13:45:57 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ADjunl012425; Thu, 10 Aug 2017 13:45:56 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ADjuCl012424; Thu, 10 Aug 2017 13:45:56 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708101345.v7ADjuCl012424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 10 Aug 2017 13:45:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322359 - head/sys/dev/ofw X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ofw X-SVN-Commit-Revision: 322359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 13:45:58 -0000 Author: mw Date: Thu Aug 10 13:45:56 2017 New Revision: 322359 URL: https://svnweb.freebsd.org/changeset/base/322359 Log: Enable OF_setprop API function to add property in FDT This patch modifies function ofw_fdt_setprop (called by OF_setprop), so that it can add property, when replacing is not possible. Adding property is needed to fixup FDT's that have missing properties. Submitted by: Patryk Duda Reviewed by: nwhitehorn, cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11879 Modified: head/sys/dev/ofw/ofw_fdt.c Modified: head/sys/dev/ofw/ofw_fdt.c ============================================================================== --- head/sys/dev/ofw/ofw_fdt.c Thu Aug 10 13:32:04 2017 (r322358) +++ head/sys/dev/ofw/ofw_fdt.c Thu Aug 10 13:45:56 2017 (r322359) @@ -381,7 +381,11 @@ ofw_fdt_setprop(ofw_t ofw, phandle_t package, const ch if (offset < 0) return (-1); - return (fdt_setprop_inplace(fdtp, offset, propname, buf, len)); + if (fdt_setprop_inplace(fdtp, offset, propname, buf, len) != 0) + /* Try to add property, when setting value inplace failed */ + return (fdt_setprop(fdtp, offset, propname, buf, len)); + + return (0); } /* Convert a device specifier to a fully qualified pathname. */ From owner-svn-src-head@freebsd.org Thu Aug 10 13:51:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02870DD380F; Thu, 10 Aug 2017 13:51:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D19641B60; Thu, 10 Aug 2017 13:51:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ADp4g4012645; Thu, 10 Aug 2017 13:51:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ADp4N1012641; Thu, 10 Aug 2017 13:51:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708101351.v7ADp4N1012641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 10 Aug 2017 13:51:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322360 - head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD X-SVN-Commit-Revision: 322360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 13:51:06 -0000 Author: emaste Date: Thu Aug 10 13:51:04 2017 New Revision: 322360 URL: https://svnweb.freebsd.org/changeset/base/322360 Log: lldb: Report inferior signals as signals, not exceptions, on FreeBSD This is the FreeBSD equivalent of LLVM r238549. This serves 2 purposes: * LLDB should handle inferior process signals SIGSEGV/SIGILL/SIGBUS/ SIGFPE the way it is suppose to be handled. Prior to this fix these signals will neither create a coredump, nor exit from the debugger or work for signal handling scenario. * eInvalidCrashReason need not report "unknown crash reason" if we have a valid si_signo llvm.org/pr23699 Patch by Karnajit Wangkhem Differential Revision: https://reviews.llvm.org/D35223 Submitted by: Karnajit Wangkhem Obtained from: LLVM r310591 Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.h head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp Thu Aug 10 13:45:56 2017 (r322359) +++ head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp Thu Aug 10 13:51:04 2017 (r322360) @@ -375,6 +375,7 @@ void FreeBSDThread::Notify(const ProcessMessage &messa LimboNotify(message); break; + case ProcessMessage::eCrashMessage: case ProcessMessage::eSignalMessage: SignalNotify(message); break; @@ -395,10 +396,6 @@ void FreeBSDThread::Notify(const ProcessMessage &messa WatchNotify(message); break; - case ProcessMessage::eCrashMessage: - CrashNotify(message); - break; - case ProcessMessage::eExecMessage: ExecNotify(message); break; @@ -577,27 +574,19 @@ void FreeBSDThread::LimboNotify(const ProcessMessage & void FreeBSDThread::SignalNotify(const ProcessMessage &message) { int signo = message.GetSignal(); - SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo)); + if (message.GetKind() == ProcessMessage::eCrashMessage) { + std::string stop_description = GetCrashReasonString( + message.GetCrashReason(), message.GetFaultAddress()); + SetStopInfo(StopInfo::CreateStopReasonWithSignal( + *this, signo, stop_description.c_str())); + } else { + SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo)); + } } void FreeBSDThread::SignalDeliveredNotify(const ProcessMessage &message) { int signo = message.GetSignal(); SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo)); -} - -void FreeBSDThread::CrashNotify(const ProcessMessage &message) { - // FIXME: Update stop reason as per bugzilla 14598 - int signo = message.GetSignal(); - - assert(message.GetKind() == ProcessMessage::eCrashMessage); - - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); - if (log) - log->Printf("FreeBSDThread::%s () signo = %i, reason = '%s'", __FUNCTION__, - signo, message.PrintCrashReason()); - - SetStopInfo(lldb::StopInfoSP(new POSIXCrashStopInfo( - *this, signo, message.GetCrashReason(), message.GetFaultAddress()))); } unsigned FreeBSDThread::GetRegisterIndexFromOffset(unsigned offset) { Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp Thu Aug 10 13:45:56 2017 (r322359) +++ head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp Thu Aug 10 13:51:04 2017 (r322360) @@ -28,22 +28,6 @@ bool POSIXLimboStopInfo::ShouldStop(Event *event_ptr) bool POSIXLimboStopInfo::ShouldNotify(Event *event_ptr) { return false; } //===----------------------------------------------------------------------===// -// POSIXCrashStopInfo - -POSIXCrashStopInfo::POSIXCrashStopInfo(FreeBSDThread &thread, uint32_t status, - CrashReason reason, - lldb::addr_t fault_addr) - : POSIXStopInfo(thread, status) { - m_description = ::GetCrashReasonString(reason, fault_addr); -} - -POSIXCrashStopInfo::~POSIXCrashStopInfo() {} - -lldb::StopReason POSIXCrashStopInfo::GetStopReason() const { - return lldb::eStopReasonException; -} - -//===----------------------------------------------------------------------===// // POSIXNewThreadStopInfo POSIXNewThreadStopInfo::~POSIXNewThreadStopInfo() {} Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.h ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.h Thu Aug 10 13:45:56 2017 (r322359) +++ head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.h Thu Aug 10 13:51:04 2017 (r322360) @@ -45,19 +45,6 @@ class POSIXLimboStopInfo : public POSIXStopInfo { (pub }; //===----------------------------------------------------------------------===// -/// @class POSIXCrashStopInfo -/// @brief Represents the stop state of process that is ready to crash. -/// -class POSIXCrashStopInfo : public POSIXStopInfo { -public: - POSIXCrashStopInfo(FreeBSDThread &thread, uint32_t status, CrashReason reason, - lldb::addr_t fault_addr); - ~POSIXCrashStopInfo(); - - lldb::StopReason GetStopReason() const; -}; - -//===----------------------------------------------------------------------===// /// @class POSIXNewThreadStopInfo /// @brief Represents the stop state of process when a new thread is spawned. /// Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Thu Aug 10 13:45:56 2017 (r322359) +++ head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Thu Aug 10 13:51:04 2017 (r322360) @@ -1192,7 +1192,9 @@ ProcessMessage ProcessMonitor::MonitorSignal(ProcessMo case SIGBUS: lldb::addr_t fault_addr = reinterpret_cast(info->si_addr); const auto reason = GetCrashReason(*info); - return ProcessMessage::Crash(tid, reason, signo, fault_addr); + if (reason != CrashReason::eInvalidCrashReason) { + return ProcessMessage::Crash(tid, reason, signo, fault_addr); + } // else; Use atleast si_signo info for other si_code } // Everything else is "normal" and does not require any special action on From owner-svn-src-head@freebsd.org Thu Aug 10 14:18:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D33FDD3F06; Thu, 10 Aug 2017 14:18:12 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47C9F29A8; Thu, 10 Aug 2017 14:18:12 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AEIBpL024833; Thu, 10 Aug 2017 14:18:11 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AEI9bx024812; Thu, 10 Aug 2017 14:18:09 GMT (envelope-from br@FreeBSD.org) Message-Id: <201708101418.v7AEI9bx024812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 10 Aug 2017 14:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322361 - in head: lib/csu/riscv lib/libc/riscv/gen libexec/rtld-elf/riscv share/mk sys/boot/fdt/dts/riscv sys/conf sys/riscv/conf sys/riscv/include sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head: lib/csu/riscv lib/libc/riscv/gen libexec/rtld-elf/riscv share/mk sys/boot/fdt/dts/riscv sys/conf sys/riscv/conf sys/riscv/include sys/riscv/riscv X-SVN-Commit-Revision: 322361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 14:18:12 -0000 Author: br Date: Thu Aug 10 14:18:09 2017 New Revision: 322361 URL: https://svnweb.freebsd.org/changeset/base/322361 Log: Support for v1.10 (latest) of RISC-V privilege specification. New version is not compatible on supervisor mode with v1.9.1 (previous version). Highlights: o BBL (Berkeley Boot Loader) provides no initial page tables anymore allowing us to choose VM, to build page tables manually and enable MMU in S-mode. o SBI interface changed. o GENERIC kernel. FDT is now chosen standard for RISC-V hardware description. DTB is now provided by Spike (golden model simulator). This allows us to introduce GENERIC kernel. However, description for console and timer devices is not provided in DTB, so move these devices temporary to nexus bus. o Supervisor can't access userspace by default. Solution is to set SUM (permit Supervisor User Memory access) bit in sstatus register. o Compressed extension is now turned on by default. o External GCC 7.1 compiler used. o _gp renamed to __global_pointer$ o Compiler -march= string is now in use allowing us to choose required extensions (compressed, FPU, atomic, etc). Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11800 Deleted: head/sys/boot/fdt/dts/riscv/ head/sys/riscv/conf/LOWRISC head/sys/riscv/conf/LOWRISC.hints head/sys/riscv/conf/QEMU head/sys/riscv/conf/ROCKET head/sys/riscv/conf/SPIKE head/sys/riscv/riscv/sbi.S Modified: head/lib/csu/riscv/crt1.c head/lib/csu/riscv/crti.S head/lib/libc/riscv/gen/fabs.S head/libexec/rtld-elf/riscv/reloc.c head/share/mk/bsd.cpu.mk head/share/mk/bsd.stand.mk head/sys/conf/Makefile.riscv head/sys/conf/files.riscv head/sys/conf/kern.mk head/sys/riscv/conf/GENERIC head/sys/riscv/include/machdep.h head/sys/riscv/include/riscvreg.h head/sys/riscv/include/sbi.h head/sys/riscv/riscv/cpufunc_asm.S head/sys/riscv/riscv/exception.S head/sys/riscv/riscv/intr_machdep.c head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/machdep.c head/sys/riscv/riscv/nexus.c head/sys/riscv/riscv/pmap.c head/sys/riscv/riscv/riscv_console.c head/sys/riscv/riscv/swtch.S head/sys/riscv/riscv/timer.c head/sys/riscv/riscv/trap.c head/sys/riscv/riscv/vm_machdep.c Modified: head/lib/csu/riscv/crt1.c ============================================================================== --- head/lib/csu/riscv/crt1.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/lib/csu/riscv/crt1.c Thu Aug 10 14:18:09 2017 (r322361) @@ -1,7 +1,7 @@ /* LINTLIBRARY */ /*- * Copyright 1996-1998 John D. Polstra. - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -64,7 +64,10 @@ __asm(" .text \n" " slli t0, a0, 3 \n" /* mult by arg size */ " add a2, a1, t0 \n" /* env is after argv */ " addi a2, a2, 8 \n" /* argv is null terminated */ -" lla gp, _gp \n" /* load global pointer */ +" .option push \n" +" .option norelax \n" +" lla gp, __global_pointer$\n" +" .option pop \n" " call __start"); void Modified: head/lib/csu/riscv/crti.S ============================================================================== --- head/lib/csu/riscv/crti.S Thu Aug 10 13:51:04 2017 (r322360) +++ head/lib/csu/riscv/crti.S Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -35,12 +35,13 @@ #include __FBSDID("$FreeBSD$"); -# this puts _gp into .dynsym, so symlook_obj can now find that (see reloc.c) - .weak _gp -_gp: +# this puts __global_pointer$ into .dynsym, so symlook_obj can now find that +# (see reloc.c) + .weak __global_pointer$ +__global_pointer$: .section .init,"ax",@progbits - .align 2 + .align 0 .globl _init .type _init,@function _init: @@ -48,7 +49,7 @@ _init: sd ra, 0(sp) .section .fini,"ax",@progbits - .align 2 + .align 0 .globl _fini .type _fini,@function _fini: Modified: head/lib/libc/riscv/gen/fabs.S ============================================================================== --- head/lib/libc/riscv/gen/fabs.S Thu Aug 10 13:51:04 2017 (r322360) +++ head/lib/libc/riscv/gen/fabs.S Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -35,7 +35,9 @@ #include __FBSDID("$FreeBSD$"); +#ifndef SOFTFLOAT ENTRY(fabs) fabs.d fa0, fa0 ret END(fabs) +#endif Modified: head/libexec/rtld-elf/riscv/reloc.c ============================================================================== --- head/libexec/rtld-elf/riscv/reloc.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/libexec/rtld-elf/riscv/reloc.c Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * This software was developed by SRI International and the University of @@ -62,7 +62,7 @@ set_gp(Obj_Entry *obj) __asm __volatile("mv %0, gp" : "=r"(old)); - symlook_init(&req, "_gp"); + symlook_init(&req, "__global_pointer$"); req.ventry = NULL; req.flags = SYMLOOK_EARLY; res = symlook_obj(&req, obj); Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Thu Aug 10 13:51:04 2017 (r322360) +++ head/share/mk/bsd.cpu.mk Thu Aug 10 14:18:09 2017 (r322361) @@ -364,8 +364,11 @@ CFLAGS += -mcpu=8540 -Wa,-me500 -mspe=yes -mabi=spe -m .if ${MACHINE_CPUARCH} == "riscv" .if ${TARGET_ARCH:Mriscv*sf} -CFLAGS += -mno-float -ACFLAGS += -mno-float +CFLAGS += -march=rv64imac -mabi=lp64 +ACFLAGS += -march=rv64imac -mabi=lp64 +.else +CFLAGS += -march=rv64imafdc -mabi=lp64 +ACFLAGS += -march=rv64imafdc -mabi=lp64 .endif .endif Modified: head/share/mk/bsd.stand.mk ============================================================================== --- head/share/mk/bsd.stand.mk Thu Aug 10 13:51:04 2017 (r322360) +++ head/share/mk/bsd.stand.mk Thu Aug 10 14:18:09 2017 (r322361) @@ -7,7 +7,7 @@ CFLAGS+= -ffreestanding -Wformat CFLAGS+= ${CFLAGS_NO_SIMD} -D_STANDALONE .if ${MACHINE_CPUARCH} == "riscv" -CFLAGS+= -mno-float +CFLAGS+= -march=rv64imac -mabi=lp64 .elif ${MACHINE_CPUARCH} != "aarch64" CFLAGS+= -msoft-float .endif Modified: head/sys/conf/Makefile.riscv ============================================================================== --- head/sys/conf/Makefile.riscv Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/conf/Makefile.riscv Thu Aug 10 14:18:09 2017 (r322361) @@ -28,6 +28,11 @@ S= ../../.. INCLUDES+= -I$S/contrib/libfdt +SYSTEM_LD= @${LD} -N -m ${LD_EMULATION} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} \ + --no-warn-mismatch --warn-common --export-dynamic \ + --dynamic-linker /red/herring \ + -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o + .if !empty(DDB_ENABLED) CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls .endif Modified: head/sys/conf/files.riscv ============================================================================== --- head/sys/conf/files.riscv Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/conf/files.riscv Thu Aug 10 14:18:09 2017 (r322361) @@ -46,7 +46,6 @@ riscv/riscv/nexus.c standard riscv/riscv/ofw_machdep.c optional fdt riscv/riscv/pmap.c standard riscv/riscv/riscv_console.c optional rcons -riscv/riscv/sbi.S standard riscv/riscv/stack_machdep.c optional ddb | stack riscv/riscv/support.S standard riscv/riscv/swtch.S standard Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/conf/kern.mk Thu Aug 10 14:18:09 2017 (r322361) @@ -121,7 +121,7 @@ INLINE_LIMIT?= 8000 .endif .if ${MACHINE_CPUARCH} == "riscv" -CFLAGS.gcc+= -mcmodel=medany +CFLAGS.gcc+= -mcmodel=medany -march=rv64imafdc -mabi=lp64 INLINE_LIMIT?= 8000 .endif Modified: head/sys/riscv/conf/GENERIC ============================================================================== --- head/sys/riscv/conf/GENERIC Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/conf/GENERIC Thu Aug 10 14:18:09 2017 (r322361) @@ -75,6 +75,9 @@ options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.en options RCTL # Resource limits options SMP +# RISC-V SBI console +device rcons + # Uncomment for memory disk # options MD_ROOT # options MD_ROOT_SIZE=32768 # 32MB ram disk Modified: head/sys/riscv/include/machdep.h ============================================================================== --- head/sys/riscv/include/machdep.h Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/include/machdep.h Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -39,7 +39,10 @@ struct riscv_bootparams { vm_offset_t kern_l1pt; /* Kernel L1 base */ + vm_offset_t kern_phys; /* Kernel base (physical) addr */ vm_offset_t kern_stack; + vm_offset_t dtbp_virt; /* Device tree blob virtual addr */ + vm_offset_t dtbp_phys; /* Device tree blob physical addr */ }; extern vm_paddr_t physmap[]; Modified: head/sys/riscv/include/riscvreg.h ============================================================================== --- head/sys/riscv/include/riscvreg.h Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/include/riscvreg.h Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -51,6 +51,9 @@ #define EXCP_SUPERVISOR_ECALL 9 #define EXCP_HYPERVISOR_ECALL 10 #define EXCP_MACHINE_ECALL 11 +#define EXCP_INST_PAGE_FAULT 12 +#define EXCP_LOAD_PAGE_FAULT 13 +#define EXCP_STORE_PAGE_FAULT 15 #define EXCP_INTR (1ul << 63) #define SSTATUS_UIE (1 << 0) @@ -68,7 +71,7 @@ #define SSTATUS_FS_MASK (0x3 << SSTATUS_FS_SHIFT) #define SSTATUS_XS_SHIFT 15 #define SSTATUS_XS_MASK (0x3 << SSTATUS_XS_SHIFT) -#define SSTATUS_PUM (1 << 18) +#define SSTATUS_SUM (1 << 18) #define SSTATUS32_SD (1 << 63) #define SSTATUS64_SD (1 << 31) @@ -140,6 +143,15 @@ /* Note: sip register has no SIP_STIP bit in Spike simulator */ #define SIP_SSIP (1 << 1) #define SIP_STIP (1 << 5) + +#define SATP_PPN_S 0 +#define SATP_PPN_M (0xfffffffffff << SATP_PPN_S) +#define SATP_ASID_S 44 +#define SATP_ASID_M (0xffff << SATP_ASID_S) +#define SATP_MODE_S 60 +#define SATP_MODE_M (0xf << SATP_MODE_S) +#define SATP_MODE_SV39 (8ULL << SATP_MODE_S) +#define SATP_MODE_SV48 (9ULL << SATP_MODE_S) #if 0 /* lowRISC TODO */ Modified: head/sys/riscv/include/sbi.h ============================================================================== --- head/sys/riscv/include/sbi.h Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/include/sbi.h Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Ruslan Bukin + * Copyright (c) 2016-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -37,29 +37,97 @@ #ifndef _MACHINE_SBI_H_ #define _MACHINE_SBI_H_ -typedef struct { - uint64_t base; - uint64_t size; - uint64_t node_id; -} memory_block_info; +#define SBI_SET_TIMER 0 +#define SBI_CONSOLE_PUTCHAR 1 +#define SBI_CONSOLE_GETCHAR 2 +#define SBI_CLEAR_IPI 3 +#define SBI_SEND_IPI 4 +#define SBI_REMOTE_FENCE_I 5 +#define SBI_REMOTE_SFENCE_VMA 6 +#define SBI_REMOTE_SFENCE_VMA_ASID 7 +#define SBI_SHUTDOWN 8 -uint64_t sbi_query_memory(uint64_t id, memory_block_info *p); -uint64_t sbi_hart_id(void); -uint64_t sbi_num_harts(void); -uint64_t sbi_timebase(void); -void sbi_set_timer(uint64_t stime_value); -void sbi_send_ipi(uint64_t hart_id); -uint64_t sbi_clear_ipi(void); -void sbi_shutdown(void); +static __inline uint64_t +sbi_call(uint64_t arg7, uint64_t arg0, uint64_t arg1, uint64_t arg2) +{ -void sbi_console_putchar(unsigned char ch); -int sbi_console_getchar(void); + register uintptr_t a0 __asm ("a0") = (uintptr_t)(arg0); + register uintptr_t a1 __asm ("a1") = (uintptr_t)(arg1); + register uintptr_t a2 __asm ("a2") = (uintptr_t)(arg2); + register uintptr_t a7 __asm ("a7") = (uintptr_t)(arg7); + __asm __volatile( \ + "ecall" \ + :"+r"(a0) \ + :"r"(a1), "r"(a2), "r"(a7) \ + :"memory"); -void sbi_remote_sfence_vm(uint64_t hart_mask_ptr, uint64_t asid); -void sbi_remote_sfence_vm_range(uint64_t hart_mask_ptr, uint64_t asid, uint64_t start, uint64_t size); -void sbi_remote_fence_i(uint64_t hart_mask_ptr); + return (a0); +} -uint64_t sbi_mask_interrupt(uint64_t which); -uint64_t sbi_unmask_interrupt(uint64_t which); +static __inline void +sbi_console_putchar(int ch) +{ + + sbi_call(SBI_CONSOLE_PUTCHAR, ch, 0, 0); +} + +static __inline int +sbi_console_getchar(void) +{ + + return (sbi_call(SBI_CONSOLE_GETCHAR, 0, 0, 0)); +} + +static __inline void +sbi_set_timer(uint64_t val) +{ + + sbi_call(SBI_SET_TIMER, val, 0, 0); +} + +static __inline void +sbi_shutdown(void) +{ + + sbi_call(SBI_SHUTDOWN, 0, 0, 0); +} + +static __inline void +sbi_clear_ipi(void) +{ + + sbi_call(SBI_CLEAR_IPI, 0, 0, 0); +} + +static __inline void +sbi_send_ipi(const unsigned long *hart_mask) +{ + + sbi_call(SBI_SEND_IPI, (uint64_t)hart_mask, 0, 0); +} + +static __inline void +sbi_remote_fence_i(const unsigned long *hart_mask) +{ + + sbi_call(SBI_REMOTE_FENCE_I, (uint64_t)hart_mask, 0, 0); +} + +static __inline void +sbi_remote_sfence_vma(const unsigned long *hart_mask, + unsigned long start, unsigned long size) +{ + + sbi_call(SBI_REMOTE_SFENCE_VMA, (uint64_t)hart_mask, 0, 0); +} + +static __inline void +sbi_remote_sfence_vma_asid(const unsigned long *hart_mask, + unsigned long start, unsigned long size, + unsigned long asid) +{ + + sbi_call(SBI_REMOTE_SFENCE_VMA_ASID, (uint64_t)hart_mask, 0, 0); +} #endif /* !_MACHINE_SBI_H_ */ Modified: head/sys/riscv/riscv/cpufunc_asm.S ============================================================================== --- head/sys/riscv/riscv/cpufunc_asm.S Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/cpufunc_asm.S Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -51,12 +51,12 @@ END(riscv_nullop) */ ENTRY(riscv_tlb_flushID) - sfence.vm + sfence.vma ret END(riscv_tlb_flushID) ENTRY(riscv_tlb_flushID_SE) - sfence.vm + sfence.vma ret END(riscv_tlb_flushID_SE) @@ -64,7 +64,7 @@ END(riscv_tlb_flushID_SE) * void riscv_dcache_wb_range(vm_offset_t, vm_size_t) */ ENTRY(riscv_dcache_wb_range) - sfence.vm + sfence.vma ret END(riscv_dcache_wb_range) @@ -72,7 +72,7 @@ END(riscv_dcache_wb_range) * void riscv_dcache_wbinv_range(vm_offset_t, vm_size_t) */ ENTRY(riscv_dcache_wbinv_range) - sfence.vm + sfence.vma ret END(riscv_dcache_wbinv_range) @@ -80,7 +80,7 @@ END(riscv_dcache_wbinv_range) * void riscv_dcache_inv_range(vm_offset_t, vm_size_t) */ ENTRY(riscv_dcache_inv_range) - sfence.vm + sfence.vma ret END(riscv_dcache_inv_range) @@ -89,7 +89,7 @@ END(riscv_dcache_inv_range) */ ENTRY(riscv_idcache_wbinv_range) fence.i - sfence.vm + sfence.vma ret END(riscv_idcache_wbinv_range) Modified: head/sys/riscv/riscv/exception.S ============================================================================== --- head/sys/riscv/riscv/exception.S Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/exception.S Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -116,8 +116,11 @@ __FBSDID("$FreeBSD$"); .macro load_registers el ld t0, (TF_SSTATUS)(sp) .if \el == 0 - /* Ensure user interrupts will be enabled on eret. */ - li t1, SSTATUS_SPIE + /* + * Ensure user interrupts will be enabled on eret + * and supervisor mode can access userspace on trap. + */ + li t1, (SSTATUS_SPIE | SSTATUS_SUM) or t0, t0, t1 .else /* Modified: head/sys/riscv/riscv/intr_machdep.c ============================================================================== --- head/sys/riscv/riscv/intr_machdep.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/intr_machdep.c Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -265,12 +265,15 @@ riscv_unmask_ipi(void) static void ipi_send(struct pcpu *pc, int ipi) { + uintptr_t mask; CTR3(KTR_SMP, "%s: cpu=%d, ipi=%x", __func__, pc->pc_cpuid, ipi); atomic_set_32(&pc->pc_pending_ipis, ipi); - sbi_send_ipi(pc->pc_cpuid); + mask = (1 << (pc->pc_cpuid)); + sbi_send_ipi(&mask); + CTR1(KTR_SMP, "%s: sent", __func__); } @@ -302,16 +305,20 @@ void ipi_selected(cpuset_t cpus, u_int ipi) { struct pcpu *pc; + uintptr_t mask; CTR1(KTR_SMP, "ipi_selected: ipi: %x", ipi); + mask = 0; STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (CPU_ISSET(pc->pc_cpuid, &cpus)) { CTR3(KTR_SMP, "%s: pc: %p, ipi: %x\n", __func__, pc, ipi); - ipi_send(pc, ipi); + atomic_set_32(&pc->pc_pending_ipis, ipi); + mask |= (1 << (pc->pc_cpuid)); } } + sbi_send_ipi(&mask); } #endif Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/locore.S Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -53,149 +53,119 @@ .text .globl _start _start: - /* Setup supervisor trap vector */ - la t0, cpu_exception_handler - csrw stvec, t0 + /* Get the physical address kernel loaded to */ + la t0, virt_map + ld t1, 0(t0) + sub t1, t1, t0 + li t2, KERNBASE + sub s9, t2, t1 /* s9 = physmem base */ + mv s10, a0 /* s10 = hart id */ + mv s11, a1 /* s11 = dtbp */ - /* Ensure sscratch is zero */ - li t0, 0 - csrw sscratch, t0 + li t0, SSTATUS_SUM + csrs sstatus, t0 - /* Load physical memory information */ - li a0, 0 - la a1, memory_info - call sbi_query_memory - - /* Store base to s6 */ - la s6, memory_info - ld s6, 0(s6) /* s6 = physmem base */ - /* Direct secondary cores to mpentry */ - call sbi_hart_id - bnez a0, mpentry + bnez s10, mpentry /* * Page tables */ - /* Create an L1 page for early devmap */ + /* Add L1 entry for kernel */ la s1, pagetable_l1 - la s2, pagetable_l2_devmap /* Link to next level PN */ - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 + la s2, pagetable_l2 /* Link to next level PN */ srli s2, s2, PAGE_SHIFT - li a5, (VM_MAX_KERNEL_ADDRESS - L2_SIZE) + li a5, KERNBASE srli a5, a5, L1_SHIFT /* >> L1_SHIFT */ andi a5, a5, 0x1ff /* & 0x1ff */ li t4, PTE_V slli t5, s2, PTE_PPN0_S /* (s2 << PTE_PPN0_S) */ or t6, t4, t5 - /* Store single level1 PTE entry to position */ + /* Store L1 PTE entry to position */ li a6, PTE_SIZE mulw a5, a5, a6 add t0, s1, a5 sd t6, (t0) - /* Create an L1 page for SBI */ - la s1, pagetable_l1 - la s2, pagetable_l2_sbi /* Link to next level PN */ - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 - srli s2, s2, PAGE_SHIFT - li a5, 511 - li t4, PTE_V - slli t5, s2, PTE_PPN0_S /* (s2 << PTE_PPN0_S) */ - or t6, t4, t5 + /* Level 2 superpages (512 x 2MiB) */ + la s1, pagetable_l2 + srli t4, s9, 21 /* Div physmem base by 2 MiB */ + li t2, 512 /* Build 512 entries */ + add t3, t4, t2 + li t5, 0 +2: + li t0, (PTE_V | PTE_RWX | PTE_D) + slli t2, t4, PTE_PPN1_S /* << PTE_PPN1_S */ + or t5, t0, t2 + sd t5, (s1) /* Store PTE entry to position */ + addi s1, s1, PTE_SIZE - /* Store SBI L1 PTE entry to position */ - li a6, PTE_SIZE - mulw a5, a5, a6 - add t0, s1, a5 - sd t6, (t0) + addi t4, t4, 1 + bltu t4, t3, 2b - /* Create an L2 page for SBI */ - la s1, pagetable_l2_sbi - la s2, pagetable_l3_sbi /* Link to next level PN */ - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 + /* Create an L1 page for early devmap */ + la s1, pagetable_l1 + la s2, pagetable_l2_devmap /* Link to next level PN */ srli s2, s2, PAGE_SHIFT - li a5, 511 + + li a5, (VM_MAX_KERNEL_ADDRESS - L2_SIZE) + srli a5, a5, L1_SHIFT /* >> L1_SHIFT */ + andi a5, a5, 0x1ff /* & 0x1ff */ li t4, PTE_V slli t5, s2, PTE_PPN0_S /* (s2 << PTE_PPN0_S) */ or t6, t4, t5 - /* Store SBI L2 PTE entry to position */ + /* Store single level1 PTE entry to position */ li a6, PTE_SIZE mulw a5, a5, a6 add t0, s1, a5 sd t6, (t0) - /* Create an L3 page for SBI */ - la s1, pagetable_l3_sbi - li s2, 0x8000b000 + /* Create an L2 page superpage for DTB */ + la s1, pagetable_l2_devmap + mv s2, s11 srli s2, s2, PAGE_SHIFT - li a5, 511 - li t4, PTE_V | PTE_RX | PTE_W - slli t5, s2, PTE_PPN0_S /* (s2 << PTE_PPN0_S) */ - or t6, t4, t5 - /* Store SBI L3 PTE entry to position */ - li a6, PTE_SIZE - mulw a5, a5, a6 - add t0, s1, a5 - sd t6, (t0) - /* END SBI page creation */ + li t0, (PTE_V | PTE_RWX | PTE_D) + slli t2, s2, PTE_PPN0_S /* << PTE_PPN0_S */ + or t0, t0, t2 - /* Add L1 entry for kernel */ - la s1, pagetable_l1 - la s2, pagetable_l2 /* Link to next level PN */ - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 - srli s2, s2, PAGE_SHIFT - - li a5, KERNBASE - srli a5, a5, L1_SHIFT /* >> L1_SHIFT */ - andi a5, a5, 0x1ff /* & 0x1ff */ - li t4, PTE_V - slli t5, s2, PTE_PPN0_S /* (s2 << PTE_PPN0_S) */ - or t6, t4, t5 - - /* Store L1 PTE entry to position */ + /* Store PTE entry to position */ li a6, PTE_SIZE + li a5, 510 mulw a5, a5, a6 - add t0, s1, a5 - sd t6, (t0) + add t1, s1, a5 + sd t0, (t1) - /* Level 2 superpages (512 x 2MiB) */ - la s1, pagetable_l2 - srli t4, s6, 21 /* Div physmem base by 2 MiB */ - li t2, 512 /* Build 512 entries */ - add t3, t4, t2 - li t5, 0 -2: - li t0, (PTE_V | PTE_RWX) - slli t2, t4, PTE_PPN1_S /* << PTE_PPN1_S */ - or t5, t0, t2 - sd t5, (s1) /* Store PTE entry to position */ - addi s1, s1, PTE_SIZE + /* Page tables END */ - addi t4, t4, 1 - bltu t4, t3, 2b + /* Setup supervisor trap vector */ + la t0, va + sub t0, t0, s9 + li t1, KERNBASE + add t0, t0, t1 + csrw stvec, t0 /* Set page tables base register */ la s2, pagetable_l1 - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 srli s2, s2, PAGE_SHIFT + li t0, SATP_MODE_SV39 + or s2, s2, t0 + sfence.vma csrw sptbr, s2 +va: + /* Setup supervisor trap vector */ + la t0, cpu_exception_handler + csrw stvec, t0 + + /* Ensure sscratch is zero */ + li t0, 0 + csrw sscratch, t0 + /* Initialize stack pointer */ la s3, initstack_end mv sp, s3 @@ -210,14 +180,19 @@ _start: bltu a0, s1, 1b /* Fill riscv_bootparams */ - addi sp, sp, -16 + addi sp, sp, -40 la t0, pagetable_l1 sd t0, 0(sp) /* kern_l1pt */ + sd s9, 8(sp) /* kern_phys */ la t0, initstack_end - sd t0, 8(sp) /* kern_stack */ + sd t0, 16(sp) /* kern_stack */ + li t0, (VM_MAX_KERNEL_ADDRESS - 2 * L2_SIZE) + sd t0, 24(sp) /* dtbp_virt */ + sd s11, 32(sp) /* dtbp_phys */ + mv a0, sp call _C_LABEL(initriscv) /* Off we go */ call _C_LABEL(mi_startup) @@ -258,15 +233,17 @@ pagetable_l2: .space PAGE_SIZE pagetable_l2_devmap: .space PAGE_SIZE -pagetable_l2_sbi: - .space PAGE_SIZE -pagetable_l3_sbi: - .space PAGE_SIZE - .globl memory_info -memory_info: - .space (24) + .align 3 +virt_map: + .quad virt_map + /* Not in use, but required for linking. */ + .align 3 + .globl __global_pointer$ +__global_pointer$: + .space 8 + .globl init_pt_va init_pt_va: .quad pagetable_l2 /* XXX: Keep page tables VA */ @@ -284,6 +261,37 @@ END(mpentry) * Called by a core when it is being brought online. */ ENTRY(mpentry) + /* Setup stack pointer */ + la t0, secondary_stacks + li t1, (PAGE_SIZE * KSTACK_PAGES) + mulw t1, t1, s10 + add t0, t0, t1 + sub t0, t0, s9 + li t1, KERNBASE + add sp, t0, t1 + + /* Setup supervisor trap vector */ + la t0, mpva + sub t0, t0, s9 + li t1, KERNBASE + add t0, t0, t1 + csrw stvec, t0 + + /* Set page tables base register */ + la s2, pagetable_l1 + srli s2, s2, PAGE_SHIFT + li t0, SATP_MODE_SV39 + or s2, s2, t0 + sfence.vma + csrw sptbr, s2 +mpva: + /* Setup supervisor trap vector */ + la t0, cpu_exception_handler + csrw stvec, t0 + + /* Ensure sscratch is zero */ + li t0, 0 + csrw sscratch, t0 /* * Calculate the offset to __riscv_boot_ap * for current core, cpuid in a0. @@ -298,20 +306,6 @@ ENTRY(mpentry) /* Wait the kernel to be ready */ lw t1, 0(t0) beqz t1, 1b - - /* Set page tables base register */ - la s2, pagetable_l1 - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 - srli s2, s2, PAGE_SHIFT - csrw sptbr, s2 - - /* Setup stack pointer */ - la t0, secondary_stacks - li t1, (PAGE_SIZE * KSTACK_PAGES) - mulw t1, t1, a0 - add sp, t0, t1 call init_secondary END(mpentry) Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/machdep.c Thu Aug 10 14:18:09 2017 (r322361) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Andrew Turner - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -105,6 +105,8 @@ int cold = 1; long realmem = 0; long Maxmem = 0; +#define DTB_SIZE_MAX (1024 * 1024) + #define PHYSMAP_SIZE (2 * (VM_PHYSSEG_MAX - 1)) vm_paddr_t physmap[PHYSMAP_SIZE]; u_int physmap_idx; @@ -117,7 +119,6 @@ int64_t idcache_line_size; /* The minimum cache line s extern int *end; extern int *initstack_end; -extern memory_block_info memory_info; struct pcpu *pcpup; @@ -315,6 +316,9 @@ CTASSERT(sizeof(((struct trapframe *)0)->tf_s) == CTASSERT(sizeof(((struct trapframe *)0)->tf_t) == sizeof((struct reg *)0)->t); +/* Support for FDT configurations only. */ +CTASSERT(FDT); + int get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) { @@ -714,16 +718,13 @@ add_physmap_entry(uint64_t base, uint64_t length, vm_p #ifdef FDT static void -try_load_dtb(caddr_t kmdp) +try_load_dtb(caddr_t kmdp, vm_offset_t dtbp) { - vm_offset_t dtbp; #if defined(FDT_DTB_STATIC) dtbp = (vm_offset_t)&fdt_static_dtb; -#else - /* TODO */ - dtbp = (vm_offset_t)NULL; #endif + if (dtbp == (vm_offset_t)NULL) { printf("ERROR loading DTB\n"); return; @@ -803,9 +804,14 @@ fake_preload_metadata(struct riscv_bootparams *rvbp __ void initriscv(struct riscv_bootparams *rvbp) { + struct mem_region mem_regions[FDT_MEM_REGIONS]; + vm_offset_t rstart, rend; + vm_offset_t s, e; + int mem_regions_sz; vm_offset_t lastaddr; vm_size_t kernlen; caddr_t kmdp; + int i; /* Set the module data location */ lastaddr = fake_preload_metadata(rvbp); @@ -821,27 +827,35 @@ initriscv(struct riscv_bootparams *rvbp) kern_envp = NULL; #ifdef FDT - try_load_dtb(kmdp); + try_load_dtb(kmdp, rvbp->dtbp_virt); #endif /* Load the physical memory ranges */ physmap_idx = 0; -#if 0 - struct mem_region mem_regions[FDT_MEM_REGIONS]; - int mem_regions_sz; - int i; +#ifdef FDT /* Grab physical memory regions information from device tree. */ if (fdt_get_mem_regions(mem_regions, &mem_regions_sz, NULL) != 0) panic("Cannot get physical memory regions"); - for (i = 0; i < mem_regions_sz; i++) - add_physmap_entry(mem_regions[i].mr_start, - mem_regions[i].mr_size, physmap, &physmap_idx); -#endif - add_physmap_entry(memory_info.base, memory_info.size, - physmap, &physmap_idx); + s = rvbp->dtbp_phys; + e = s + DTB_SIZE_MAX; + for (i = 0; i < mem_regions_sz; i++) { + rstart = mem_regions[i].mr_start; + rend = (mem_regions[i].mr_start + mem_regions[i].mr_size); + + if ((rstart < s) && (rend > e)) { + /* Exclude DTB region. */ + add_physmap_entry(rstart, (s - rstart), physmap, &physmap_idx); + add_physmap_entry(e, (rend - e), physmap, &physmap_idx); + } else { + add_physmap_entry(mem_regions[i].mr_start, + mem_regions[i].mr_size, physmap, &physmap_idx); + } + } +#endif + /* Set the pcpu data, this is needed by pmap_bootstrap */ pcpup = &__pcpu[0]; pcpu_init(pcpup, 0, sizeof(struct pcpu)); @@ -858,7 +872,7 @@ initriscv(struct riscv_bootparams *rvbp) /* Bootstrap enough of pmap to enter the kernel proper */ kernlen = (lastaddr - KERNBASE); - pmap_bootstrap(rvbp->kern_l1pt, memory_info.base, kernlen); + pmap_bootstrap(rvbp->kern_l1pt, mem_regions[0].mr_start, kernlen); cninit(); @@ -866,7 +880,7 @@ initriscv(struct riscv_bootparams *rvbp) /* set page table base register for thread0 */ thread0.td_pcb->pcb_l1addr = \ - (rvbp->kern_l1pt - KERNBASE + memory_info.base); + (rvbp->kern_l1pt - KERNBASE + rvbp->kern_phys); msgbufinit(msgbufp, msgbufsize); mutex_init(); Modified: head/sys/riscv/riscv/nexus.c ============================================================================== --- head/sys/riscv/riscv/nexus.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/nexus.c Thu Aug 10 14:18:09 2017 (r322361) @@ -156,6 +156,8 @@ nexus_attach(device_t dev) if (rman_init(&irq_rman) || rman_manage_region(&irq_rman, 0, ~0)) panic("nexus_attach irq_rman"); + nexus_add_child(dev, 8, "timer", 0); + nexus_add_child(dev, 9, "rcons", 0); nexus_add_child(dev, 10, "ofwbus", 0); bus_generic_probe(dev); Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/pmap.c Thu Aug 10 14:18:09 2017 (r322361) @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * This code is derived from software contributed to Berkeley by @@ -596,8 +596,10 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, min_pa = physmap[i]; if (physmap[i + 1] > max_pa) max_pa = physmap[i + 1]; - break; } + printf("physmap_idx %lx\n", physmap_idx); + printf("min_pa %lx\n", min_pa); + printf("max_pa %lx\n", max_pa); /* Create a direct map region early so we can use it for pa -> va */ pmap_bootstrap_dmap(l1pt, min_pa, max_pa); @@ -771,7 +773,7 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) /* TODO */ sched_pin(); - __asm __volatile("sfence.vm"); + __asm __volatile("sfence.vma %0" :: "r" (va) : "memory"); sched_unpin(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Aug 10 14:19:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31C04DD3F82; Thu, 10 Aug 2017 14:19:00 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3E112B12; Thu, 10 Aug 2017 14:18:59 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AEIxmC024898; Thu, 10 Aug 2017 14:18:59 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AEIxlQ024897; Thu, 10 Aug 2017 14:18:59 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708101418.v7AEIxlQ024897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 10 Aug 2017 14:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322362 - head X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 14:19:00 -0000 Author: gjb Date: Thu Aug 10 14:18:58 2017 New Revision: 322362 URL: https://svnweb.freebsd.org/changeset/base/322362 Log: Indent nested conditionals for readability. Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Aug 10 14:18:09 2017 (r322361) +++ head/Makefile.inc1 Thu Aug 10 14:18:58 2017 (r322362) @@ -1632,7 +1632,7 @@ create-world-package-${pkgname}: .PHONY create-kernel-packages: .PHONY _default_flavor= -default .if exists(${KSTAGEDIR}/kernel.meta) -.for flavor in "" -debug +. for flavor in "" -debug create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY @cd ${KSTAGEDIR}/${DISTDIR} ; \ @@ -1658,12 +1658,12 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul -p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \ -r ${KSTAGEDIR}/${DISTDIR} \ -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} -.endfor +. endfor .endif .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" -.for _kernel in ${BUILDKERNELS:[2..-1]} -.if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) -.for flavor in "" -debug +. for _kernel in ${BUILDKERNELS:[2..-1]} +. if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) +. for flavor in "" -debug create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel} create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .PHONY @cd ${KSTAGEDIR}/kernel.${_kernel} ; \ @@ -1689,9 +1689,9 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_ -p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \ -r ${KSTAGEDIR}/kernel.${_kernel} \ -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} -.endfor -.endif -.endfor +. endfor +. endif +. endfor .endif sign-packages: _pkgbootstrap .PHONY From owner-svn-src-head@freebsd.org Thu Aug 10 14:21:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57D49DD401E; Thu, 10 Aug 2017 14:21:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C2622D0D; Thu, 10 Aug 2017 14:21:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x22f.google.com with SMTP id m34so13634633iti.1; Thu, 10 Aug 2017 07:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=InPxDjAGd6j69YsgWblsD4SvkErAPL0pB9E8f/Kkdko=; b=F8AdsgnNWdhI780bS6h5GCkPxbzHdeMoqGgnQbucZSIZVgrSKCRGDucjPk0Z76NPGB 8K8nsKscadpa5OyjmBSsoaPVD+GFnS7d4bgCf4q6Z46Tz8jHqLS4CkiBN/G2Swkh8rZA IjJwBWu4tgaBF9dfBwMPL1EsWqKcq8kEkQrS9/Qj13VTw1Q06fLW3pi9PJhhKwpfsiqX 0/sFXdLkctuiww78fe/M/uT1nuVsculSoL3qu9vTDA0lmhJdfVau9c0hN7fSnJhgeIot rdYhPgF6ywF8/hO2LmL9dKkWqH/b0HcDsRfeQt8YsMfyRkXwtc7f07Ss13Yr/z0OxeU6 /DZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=InPxDjAGd6j69YsgWblsD4SvkErAPL0pB9E8f/Kkdko=; b=imusECMd+uqPZxBbhl6zZCOuovFaur64S4dy6Nriy99PLMfUffZBS5Ow6/sspSz6ba EdgUzGN7rQHLgPICNrtfFHiABzTKVSyP/WpVUPvi4emy8WFTVjg+EvHGV8zU6JWAjCDL etkEmsBuNzhRQnwbLNc2NESGUSpqlcQngYdJTi4aSASCEXnc8bPEBsPhB6K/irNkeltW QGQvtLg3XaEwubq98aNX/+LCSNSpoN1rwMUy8YXLMRpaKrP6aC9PUDl5qDQDmwemLYlO 8OdqKRygE7YHrJsiRDG41txLA1SyxMlyAOezGCdAouogNqxQnIVT1MQrKSC7iUC1H8r8 Sx8Q== X-Gm-Message-State: AIVw11038g2QM0TRXO+3rkW2w5gZ4sJMQ9BkewYwMlmuCII8tlgVQSlT T2HEX+7GUphTlS/L7qZjUFxjFA9go1UHfrQ= X-Received: by 10.36.113.70 with SMTP id n67mr11710213itc.39.1502374880201; Thu, 10 Aug 2017 07:21:20 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.24.66 with HTTP; Thu, 10 Aug 2017 07:20:59 -0700 (PDT) In-Reply-To: <201708100915.v7A9FIke002476@repo.freebsd.org> References: <201708100915.v7A9FIke002476@repo.freebsd.org> From: Ed Maste Date: Thu, 10 Aug 2017 10:20:59 -0400 X-Google-Sender-Auth: EkT6eAI6OkcwBwUUCu1IBf4fEC4 Message-ID: Subject: Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen To: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 14:21:21 -0000 On 10 August 2017 at 05:15, Roger Pau Monn=C3=A9 wrote= : > Author: royger > Date: Thu Aug 10 09:15:18 2017 > New Revision: 322347 > URL: https://svnweb.freebsd.org/changeset/base/322347 > > Log: > apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase i386 is failing with: 13:55:08 --- mptable.o --- 13:55:08 /usr/src/sys/x86/x86/mptable.c:333:3: error: use of undeclared identifier 'mp_ncpus' 13:55:08 mp_ncpus =3D 2; 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:334:3: error: use of undeclared identifier 'mp_maxid' 13:55:08 mp_maxid =3D 1; 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:359:3: error: use of undeclared identifier 'cpu_mask' 13:55:08 cpu_mask =3D 0; 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:360:51: error: use of undeclared identifier 'cpu_mask' 13:55:08 mptable_walk_table(mptable_setup_cpus_handler, &cpu_mask); 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:480:39: error: use of undeclared identifier 'mp_ncpus' 13:55:08 proc->apic_id < MAX_LAPIC_ID && mp_ncpus < MAXCPU) { 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:481:4: error: use of undeclared identifier 'mp_ncpus' 13:55:08 mp_ncpus++; 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:482:4: error: use of undeclared identifier 'mp_maxid' 13:55:08 mp_maxid =3D mp_ncpus - 1; 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:482:15: error: use of undeclared identifier 'mp_ncpus' 13:55:08 mp_maxid =3D mp_ncpus - 1; 13:55:08 ^ 13:55:08 8 errors generated. 13:55:08 *** [mptable.o] Error code 1 https://ci.freebsd.org/job/FreeBSD-head-i386-build/3457/console From owner-svn-src-head@freebsd.org Thu Aug 10 14:54:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 062E6DD4D50; Thu, 10 Aug 2017 14:54:38 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6CB4634E8; Thu, 10 Aug 2017 14:54:37 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AEsajX041632; Thu, 10 Aug 2017 14:54:36 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AEsa0A041631; Thu, 10 Aug 2017 14:54:36 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708101454.v7AEsa0A041631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 10 Aug 2017 14:54:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322363 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 322363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 14:54:38 -0000 Author: sbruno Date: Thu Aug 10 14:54:36 2017 New Revision: 322363 URL: https://svnweb.freebsd.org/changeset/base/322363 Log: Purge deprecated locking macros. Submitted by: Matt Macy Sponsored by: Limelight Networks Modified: head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Thu Aug 10 14:18:58 2017 (r322362) +++ head/sys/dev/e1000/if_em.h Thu Aug 10 14:54:36 2017 (r322363) @@ -555,26 +555,6 @@ typedef struct _em_vendor_info_t { void em_dump_rs(struct adapter *); -#define EM_CORE_LOCK_INIT(_sc, _name) \ - mtx_init(&(_sc)->core_mtx, _name, "EM Core Lock", MTX_DEF) -#define EM_TX_LOCK_INIT(_sc, _name) \ - mtx_init(&(_sc)->tx_mtx, _name, "EM TX Lock", MTX_DEF) -#define EM_RX_LOCK_INIT(_sc, _name) \ - mtx_init(&(_sc)->rx_mtx, _name, "EM RX Lock", MTX_DEF) -#define EM_CORE_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->core_mtx) -#define EM_TX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->tx_mtx) -#define EM_RX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rx_mtx) -#define EM_CORE_LOCK(_sc) mtx_lock(&(_sc)->core_mtx) -#define EM_TX_LOCK(_sc) mtx_lock(&(_sc)->tx_mtx) -#define EM_TX_TRYLOCK(_sc) mtx_trylock(&(_sc)->tx_mtx) -#define EM_RX_LOCK(_sc) mtx_lock(&(_sc)->rx_mtx) -#define EM_CORE_UNLOCK(_sc) mtx_unlock(&(_sc)->core_mtx) -#define EM_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->tx_mtx) -#define EM_RX_UNLOCK(_sc) mtx_unlock(&(_sc)->rx_mtx) -#define EM_CORE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->core_mtx, MA_OWNED) -#define EM_TX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->tx_mtx, MA_OWNED) -#define EM_RX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->rx_mtx, MA_OWNED) - #define EM_RSSRK_SIZE 4 #define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \ key[(i) * EM_RSSRK_SIZE + 1] << 8 | \ From owner-svn-src-head@freebsd.org Thu Aug 10 14:59:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64CD9DD4F2C; Thu, 10 Aug 2017 14:59:20 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8395F637EE; Thu, 10 Aug 2017 14:59:19 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AExIIN041860; Thu, 10 Aug 2017 14:59:18 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AExHlf041850; Thu, 10 Aug 2017 14:59:17 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708101459.v7AExHlf041850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 10 Aug 2017 14:59:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322364 - in head/sys/dev: mpr mps X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in head/sys/dev: mpr mps X-SVN-Commit-Revision: 322364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 14:59:20 -0000 Author: ken Date: Thu Aug 10 14:59:17 2017 New Revision: 322364 URL: https://svnweb.freebsd.org/changeset/base/322364 Log: Changes to make mps(4) and mpr(4) handle reinit with reallocation. When the mps(4) and mpr(4) drivers need to reinitialize the firmware, they sometimes need to reallocate all of the memory allocated by the driver. The reallocation happens whenever the IOC Facts change. That should only happen after a firmware upgrade. If the reinitialization happens as a result of a timed out command sent to the card, the command that timed out and triggered the reinit may have been freed if iocfacts_allocate() reallocated all memory. If the caller attempts to access the command after that, the kernel will panic because the caller will be dereferencing freed memory. The solution is to set a flag in the softc when we reallocate, and avoid dereferencing the command strucure if we've reallocated. The changes are largely the same in both drivers, since mpr(4) is a derivative of mps(4). o In iocfacts_allocate(), if the IOC Facts have changed and we need to reallocate, set the REALLOCATED flag in the softc. o Change wait_command() to take a struct mps_command ** instead of a struct mps_command *. This allows us to NULL out the caller's command pointer if we have to reinit the controller and the data structures get reallocated. (The REALLOCATED flag will be set in the softc if that has happened.) o In every place that calls wait_command(), make sure we handle the case where the command is NULL after the call. o The mpr(4) driver has mpr_request_polled() which can also reinitialize the card. Also check for reallocation there. Reviewed by: scottl, slm MFC after: 1 week Sponsored by: Spectra Logic Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_config.c head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_sas_lsi.c head/sys/dev/mpr/mpr_user.c head/sys/dev/mpr/mprvar.h head/sys/dev/mps/mps.c head/sys/dev/mps/mps_config.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mps_sas_lsi.c head/sys/dev/mps/mps_user.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mpr.c Thu Aug 10 14:59:17 2017 (r322364) @@ -436,6 +436,8 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at /* Only deallocate and reallocate if relevant IOC Facts have changed */ reallocating = FALSE; + sc->mpr_flags &= ~MPR_FLAGS_REALLOCATED; + if ((!attaching) && ((saved_facts.MsgVersion != sc->facts->MsgVersion) || (saved_facts.HeaderVersion != sc->facts->HeaderVersion) || @@ -458,6 +460,9 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at (saved_facts.MaxPersistentEntries != sc->facts->MaxPersistentEntries))) { reallocating = TRUE; + + /* Record that we reallocated everything */ + sc->mpr_flags |= MPR_FLAGS_REALLOCATED; } /* @@ -2229,8 +2234,8 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve uint8_t *mask) { MPI2_EVENT_NOTIFICATION_REQUEST *evtreq; - MPI2_EVENT_NOTIFICATION_REPLY *reply; - struct mpr_command *cm; + MPI2_EVENT_NOTIFICATION_REPLY *reply = NULL; + struct mpr_command *cm = NULL; struct mpr_event_handle *eh; int error, i; @@ -2263,8 +2268,9 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_request_polled(sc, cm); - reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; if ((reply == NULL) || (reply->IOCStatus & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS) error = ENXIO; @@ -2274,7 +2280,8 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve mpr_dprint(sc, MPR_TRACE, "%s finished error %d\n", __func__, error); - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (error); } @@ -3260,11 +3267,12 @@ mpr_map_command(struct mpr_softc *sc, struct mpr_comma * be executed and enqueued automatically. Other errors come from msleep(). */ int -mpr_wait_command(struct mpr_softc *sc, struct mpr_command *cm, int timeout, +mpr_wait_command(struct mpr_softc *sc, struct mpr_command **cmp, int timeout, int sleep_flag) { int error, rc; struct timeval cur_time, start_time; + struct mpr_command *cm = *cmp; if (sc->mpr_flags & MPR_FLAGS_DIAGRESET) return EBUSY; @@ -3319,6 +3327,13 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm rc = mpr_reinit(sc); mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); + if (sc->mpr_flags & MPR_FLAGS_REALLOCATED) { + /* + * Tell the caller that we freed the command in a + * reinit. + */ + *cmp = NULL; + } error = ETIMEDOUT; } return (error); @@ -3329,10 +3344,11 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm * completion. Its use should be rare. */ int -mpr_request_polled(struct mpr_softc *sc, struct mpr_command *cm) +mpr_request_polled(struct mpr_softc *sc, struct mpr_command **cmp) { - int error, timeout = 0, rc; + int error, rc; struct timeval cur_time, start_time; + struct mpr_command *cm = *cmp; error = 0; @@ -3340,7 +3356,7 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co cm->cm_complete = NULL; mpr_map_command(sc, cm); - getmicrotime(&start_time); + getmicrouptime(&start_time); while ((cm->cm_flags & MPR_CM_FLAGS_COMPLETE) == 0) { mpr_intr_locked(sc); @@ -3353,9 +3369,9 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co /* * Check for real-time timeout and fail if more than 60 seconds. */ - getmicrotime(&cur_time); - timeout = cur_time.tv_sec - start_time.tv_sec; - if (timeout > 60) { + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + if (cur_time.tv_sec > 60) { mpr_dprint(sc, MPR_FAULT, "polling failed\n"); error = ETIMEDOUT; break; @@ -3367,6 +3383,14 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co rc = mpr_reinit(sc); mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); + + if (sc->mpr_flags & MPR_FLAGS_REALLOCATED) { + /* + * Tell the caller that we freed the command in a + * reinit. + */ + *cmp = NULL; + } } return (error); } @@ -3432,11 +3456,12 @@ mpr_read_config_page(struct mpr_softc *sc, struct mpr_ cm->cm_complete = mpr_config_complete; return (mpr_map_command(sc, cm)); } else { - error = mpr_wait_command(sc, cm, 0, CAN_SLEEP); + error = mpr_wait_command(sc, &cm, 0, CAN_SLEEP); if (error) { mpr_dprint(sc, MPR_FAULT, "Error %d reading config page\n", error); - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (error); } mpr_config_complete(sc, cm); Modified: head/sys/dev/mpr/mpr_config.c ============================================================================== --- head/sys/dev/mpr/mpr_config.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mpr_config.c Thu Aug 10 14:59:17 2017 (r322364) @@ -95,8 +95,9 @@ mpr_config_get_ioc_pg8(struct mpr_softc *sc, Mpi2Confi request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -153,8 +154,9 @@ mpr_config_get_ioc_pg8(struct mpr_softc *sc, Mpi2Confi } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -225,8 +227,9 @@ mpr_config_get_iounit_pg8(struct mpr_softc *sc, Mpi2Co request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -283,8 +286,9 @@ mpr_config_get_iounit_pg8(struct mpr_softc *sc, Mpi2Co } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -393,8 +397,9 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2Confi MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -453,8 +458,9 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2Confi goto out; } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -529,8 +535,9 @@ int mpr_config_set_dpm_pg0(struct mpr_softc *sc, Mpi2C request->PageAddress |= htole16(entry_idx); cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -591,8 +598,9 @@ int mpr_config_set_dpm_pg0(struct mpr_softc *sc, Mpi2C bcopy(config_page, page, MIN(cm->cm_length, (sizeof(Mpi2DriverMappingPage0_t)))); cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -664,8 +672,9 @@ mpr_config_get_sas_device_pg0(struct mpr_softc *sc, Mp request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -724,8 +733,9 @@ mpr_config_get_sas_device_pg0(struct mpr_softc *sc, Mp } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -799,8 +809,9 @@ mpr_config_get_pcie_device_pg0(struct mpr_softc *sc, M request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -859,8 +870,9 @@ mpr_config_get_pcie_device_pg0(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -934,8 +946,9 @@ mpr_config_get_pcie_device_pg2(struct mpr_softc *sc, M request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -994,8 +1007,9 @@ mpr_config_get_pcie_device_pg2(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1066,8 +1080,9 @@ mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2Conf request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1124,8 +1139,9 @@ mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2Conf } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1173,7 +1189,7 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 page_address) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mpr_command *cm; Mpi2RaidVolPage0_t *page = NULL; int error = 0; @@ -1201,8 +1217,9 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1258,8 +1275,9 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1325,8 +1343,9 @@ mpr_config_get_raid_volume_pg1(struct mpr_softc *sc, M request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1384,8 +1403,9 @@ mpr_config_get_raid_volume_pg1(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1459,7 +1479,7 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C Mpi2RaidPhysDiskPage0_t *config_page, u32 page_address) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mpr_command *cm; Mpi2RaidPhysDiskPage0_t *page = NULL; int error = 0; @@ -1487,8 +1507,9 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1544,8 +1565,9 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mpr_sas.c Thu Aug 10 14:59:17 2017 (r322364) @@ -1193,13 +1193,8 @@ mprsas_complete_all_commands(struct mpr_softc *sc) completed = 1; } - if (cm->cm_sc->io_cmds_active != 0) { + if (cm->cm_sc->io_cmds_active != 0) cm->cm_sc->io_cmds_active--; - } else { - mpr_dprint(cm->cm_sc, MPR_INFO, "Warning: " - "io_cmds_active is out of sync - resynching to " - "0\n"); - } if ((completed == 0) && (cm->cm_state != MPR_CM_STATE_FREE)) { /* this should never happen, but if it does, log */ Modified: head/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- head/sys/dev/mpr/mpr_sas_lsi.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mpr_sas_lsi.c Thu Aug 10 14:59:17 2017 (r322364) @@ -324,7 +324,7 @@ mprsas_fw_work(struct mpr_softc *sc, struct mpr_fw_eve { // build RAID Action message Mpi2RaidActionRequest_t *action; - Mpi2RaidActionReply_t *reply; + Mpi2RaidActionReply_t *reply = NULL; struct mpr_command *cm; int error = 0; if ((cm = mpr_alloc_command(sc)) == NULL) { @@ -344,8 +344,10 @@ mprsas_fw_work(struct mpr_softc *sc, struct mpr_fw_eve action->PhysDiskNum = element->PhysDiskNum; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; - error = mpr_request_polled(sc, cm); - reply = (Mpi2RaidActionReply_t *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (Mpi2RaidActionReply_t *) + cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1132,12 +1134,14 @@ mprsas_get_sata_identify(struct mpr_softc *sc, u16 han "command\n", __func__); callout_reset(&cm->cm_callout, MPR_ATA_ID_TIMEOUT * hz, mprsas_ata_id_timeout, cm); - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); mpr_dprint(sc, MPR_XINFO, "%s stop timeout counter for SATA ID " "command\n", __func__); + /* XXX KDM need to fix the case where this command is destroyed */ callout_stop(&cm->cm_callout); - reply = (Mpi2SataPassthroughReply_t *)cm->cm_reply; + if (cm != NULL) + reply = (Mpi2SataPassthroughReply_t *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1603,7 +1607,7 @@ mprsas_ir_shutdown(struct mpr_softc *sc) action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; mpr_lock(sc); - mpr_wait_command(sc, cm, 5, CAN_SLEEP); + mpr_wait_command(sc, &cm, 5, CAN_SLEEP); mpr_unlock(sc); /* Modified: head/sys/dev/mpr/mpr_user.c ============================================================================== --- head/sys/dev/mpr/mpr_user.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mpr_user.c Thu Aug 10 14:59:17 2017 (r322364) @@ -652,7 +652,7 @@ static int mpr_user_command(struct mpr_softc *sc, struct mpr_usr_command *cmd) { MPI2_REQUEST_HEADER *hdr; - MPI2_DEFAULT_REPLY *rpl; + MPI2_DEFAULT_REPLY *rpl = NULL; void *buf = NULL; struct mpr_command *cm = NULL; int err = 0; @@ -664,7 +664,7 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ if (cm == NULL) { mpr_printf(sc, "%s: no mpr requests\n", __func__); err = ENOMEM; - goto Ret; + goto RetFree; } mpr_unlock(sc); @@ -706,15 +706,16 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ goto RetFreeUnlocked; mpr_lock(sc); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); - if (err) { + if (err || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, err); - goto Ret; + goto RetFree; } - rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; + if (cm != NULL) + rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; if (rpl != NULL) sz = rpl->MsgLength * 4; else @@ -734,9 +735,9 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ RetFreeUnlocked: mpr_lock(sc); +RetFree: if (cm != NULL) mpr_free_command(sc, cm); -Ret: mpr_unlock(sc); if (buf != NULL) free(buf, M_MPRUSER); @@ -850,7 +851,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru err = 1; } else { mprsas_prepare_for_tm(sc, cm, targ, CAM_LUN_WILDCARD); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); } if (err != 0) { @@ -861,7 +862,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru /* * Copy the reply data and sense data to user space. */ - if (cm->cm_reply != NULL) { + if ((cm != NULL) && (cm->cm_reply != NULL)) { rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; sz = rpl->MsgLength * 4; @@ -1054,13 +1055,12 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru mpr_lock(sc); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); - if (err) { + if (err || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, err); - mpr_unlock(sc); - goto RetFreeUnlocked; + goto RetFree; } /* @@ -1153,6 +1153,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru RetFreeUnlocked: mpr_lock(sc); +RetFree: if (cm != NULL) { if (cm->cm_data) free(cm->cm_data, M_MPRUSER); @@ -1301,8 +1302,8 @@ mpr_post_fw_diag_buffer(struct mpr_softc *sc, /* * Send command synchronously. */ - status = mpr_wait_command(sc, cm, 30, CAN_SLEEP); - if (status) { + status = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); + if (status || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, status); status = MPR_DIAG_FAILURE; @@ -1333,7 +1334,8 @@ mpr_post_fw_diag_buffer(struct mpr_softc *sc, status = MPR_DIAG_SUCCESS; done: - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (status); } @@ -1387,8 +1389,8 @@ mpr_release_fw_diag_buffer(struct mpr_softc *sc, /* * Send command synchronously. */ - status = mpr_wait_command(sc, cm, 30, CAN_SLEEP); - if (status) { + status = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); + if (status || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, status); status = MPR_DIAG_FAILURE; @@ -1423,6 +1425,9 @@ mpr_release_fw_diag_buffer(struct mpr_softc *sc, } done: + if (cm != NULL) + mpr_free_command(sc, cm); + return (status); } Modified: head/sys/dev/mpr/mprvar.h ============================================================================== --- head/sys/dev/mpr/mprvar.h Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mprvar.h Thu Aug 10 14:59:17 2017 (r322364) @@ -275,6 +275,7 @@ struct mpr_softc { #define MPR_FLAGS_DIAGRESET (1 << 4) #define MPR_FLAGS_ATTACH_DONE (1 << 5) #define MPR_FLAGS_GEN35_IOC (1 << 6) +#define MPR_FLAGS_REALLOCATED (1 << 7) u_int mpr_debug; u_int disable_msix; u_int disable_msi; @@ -732,9 +733,9 @@ void mprsas_record_event(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event_reply); int mpr_map_command(struct mpr_softc *sc, struct mpr_command *cm); -int mpr_wait_command(struct mpr_softc *sc, struct mpr_command *cm, int timeout, +int mpr_wait_command(struct mpr_softc *sc, struct mpr_command **cm, int timeout, int sleep_flag); -int mpr_request_polled(struct mpr_softc *sc, struct mpr_command *cm); +int mpr_request_polled(struct mpr_softc *sc, struct mpr_command **cm); int mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, Mpi2BiosPage3_t *config_page); Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mps/mps.c Thu Aug 10 14:59:17 2017 (r322364) @@ -427,6 +427,8 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at /* Only deallocate and reallocate if relevant IOC Facts have changed */ reallocating = FALSE; + sc->mps_flags &= ~MPS_FLAGS_REALLOCATED; + if ((!attaching) && ((saved_facts.MsgVersion != sc->facts->MsgVersion) || (saved_facts.HeaderVersion != sc->facts->HeaderVersion) || @@ -447,6 +449,9 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at (saved_facts.MaxPersistentEntries != sc->facts->MaxPersistentEntries))) { reallocating = TRUE; + + /* Record that we reallocated everything */ + sc->mps_flags |= MPS_FLAGS_REALLOCATED; } /* @@ -2075,7 +2080,7 @@ mps_update_events(struct mps_softc *sc, struct mps_eve u32 *mask) { MPI2_EVENT_NOTIFICATION_REQUEST *evtreq; - MPI2_EVENT_NOTIFICATION_REPLY *reply; + MPI2_EVENT_NOTIFICATION_REPLY *reply = NULL; struct mps_command *cm; int error, i; @@ -2113,8 +2118,9 @@ mps_update_events(struct mps_softc *sc, struct mps_eve cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, 0); - reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, 0); + if (cm != NULL) + reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; if ((reply == NULL) || (reply->IOCStatus & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS) error = ENXIO; @@ -2124,7 +2130,8 @@ mps_update_events(struct mps_softc *sc, struct mps_eve mps_dprint(sc, MPS_TRACE, "%s finished error %d\n", __func__, error); - mps_free_command(sc, cm); + if (cm != NULL) + mps_free_command(sc, cm); return (error); } @@ -2530,11 +2537,12 @@ mps_map_command(struct mps_softc *sc, struct mps_comma * be executed and enqueued automatically. Other errors come from msleep(). */ int -mps_wait_command(struct mps_softc *sc, struct mps_command *cm, int timeout, +mps_wait_command(struct mps_softc *sc, struct mps_command **cmp, int timeout, int sleep_flag) { int error, rc; struct timeval cur_time, start_time; + struct mps_command *cm = *cmp; if (sc->mps_flags & MPS_FLAGS_DIAGRESET) return EBUSY; @@ -2588,6 +2596,13 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm rc = mps_reinit(sc); mps_dprint(sc, MPS_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); + if (sc->mps_flags & MPS_FLAGS_REALLOCATED) { + /* + * Tell the caller that we freed the command in a + * reinit. + */ + *cmp = NULL; + } error = ETIMEDOUT; } return (error); @@ -2654,11 +2669,12 @@ mps_read_config_page(struct mps_softc *sc, struct mps_ cm->cm_complete = mps_config_complete; return (mps_map_command(sc, cm)); } else { - error = mps_wait_command(sc, cm, 0, CAN_SLEEP); + error = mps_wait_command(sc, &cm, 0, CAN_SLEEP); if (error) { mps_dprint(sc, MPS_FAULT, "Error %d reading config page\n", error); - mps_free_command(sc, cm); + if (cm != NULL) + mps_free_command(sc, cm); return (error); } mps_config_complete(sc, cm); Modified: head/sys/dev/mps/mps_config.c ============================================================================== --- head/sys/dev/mps/mps_config.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mps/mps_config.c Thu Aug 10 14:59:17 2017 (r322364) @@ -71,7 +71,7 @@ mps_config_get_ioc_pg8(struct mps_softc *sc, Mpi2Confi Mpi2IOCPage8_t *config_page) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; MPI2_CONFIG_PAGE_IOC_8 *page = NULL; int error = 0; @@ -94,8 +94,9 @@ mps_config_get_ioc_pg8(struct mps_softc *sc, Mpi2Confi request->Header.PageVersion = MPI2_IOCPAGE8_PAGEVERSION; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -152,8 +153,9 @@ mps_config_get_ioc_pg8(struct mps_softc *sc, Mpi2Confi } cm->cm_data = page; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -200,7 +202,7 @@ int mps_config_get_man_pg10(struct mps_softc *sc, Mpi2ConfigReply_t *mpi_reply) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; pMpi2ManufacturingPagePS_t page = NULL; uint32_t *pPS_info; @@ -230,8 +232,9 @@ mps_config_get_man_pg10(struct mps_softc *sc, Mpi2Conf * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_wait_command(sc, cm, 60, 0); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, 0); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -286,8 +289,9 @@ mps_config_get_man_pg10(struct mps_softc *sc, Mpi2Conf * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_wait_command(sc, cm, 60, 0); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, 0); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -559,7 +563,7 @@ mps_config_get_dpm_pg0(struct mps_softc *sc, Mpi2Confi Mpi2DriverMappingPage0_t *config_page, u16 sz) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; Mpi2DriverMappingPage0_t *page = NULL; int error = 0; @@ -586,8 +590,9 @@ mps_config_get_dpm_pg0(struct mps_softc *sc, Mpi2Confi MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -646,8 +651,9 @@ mps_config_get_dpm_pg0(struct mps_softc *sc, Mpi2Confi goto out; } cm->cm_data = page; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -695,7 +701,7 @@ int mps_config_set_dpm_pg0(struct mps_softc *sc, Mpi2C Mpi2DriverMappingPage0_t *config_page, u16 entry_idx) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; MPI2_CONFIG_PAGE_DRIVER_MAPPING_0 *page = NULL; int error = 0; @@ -722,8 +728,9 @@ int mps_config_set_dpm_pg0(struct mps_softc *sc, Mpi2C request->PageAddress |= htole16(entry_idx); cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -784,8 +791,9 @@ int mps_config_set_dpm_pg0(struct mps_softc *sc, Mpi2C bcopy(config_page, page, MIN(cm->cm_length, (sizeof(Mpi2DriverMappingPage0_t)))); cm->cm_data = page; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -833,7 +841,7 @@ mps_config_get_sas_device_pg0(struct mps_softc *sc, Mp *mpi_reply, Mpi2SasDevicePage0_t *config_page, u32 form, u16 handle) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; Mpi2SasDevicePage0_t *page = NULL; int error = 0; @@ -857,8 +865,9 @@ mps_config_get_sas_device_pg0(struct mps_softc *sc, Mp request->Header.PageVersion = MPI2_SASDEVICE0_PAGEVERSION; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -917,8 +926,9 @@ mps_config_get_sas_device_pg0(struct mps_softc *sc, Mp } cm->cm_data = page; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -966,7 +976,7 @@ mps_config_get_bios_pg3(struct mps_softc *sc, Mpi2Conf Mpi2BiosPage3_t *config_page) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; Mpi2BiosPage3_t *page = NULL; int error = 0; @@ -989,8 +999,9 @@ mps_config_get_bios_pg3(struct mps_softc *sc, Mpi2Conf request->Header.PageVersion = MPI2_BIOSPAGE3_PAGEVERSION; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1047,8 +1058,9 @@ mps_config_get_bios_pg3(struct mps_softc *sc, Mpi2Conf } cm->cm_data = page; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1096,7 +1108,7 @@ mps_config_get_raid_volume_pg0(struct mps_softc *sc, M *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 page_address) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; Mpi2RaidVolPage0_t *page = NULL; int error = 0; @@ -1124,8 +1136,9 @@ mps_config_get_raid_volume_pg0(struct mps_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_wait_command(sc, cm, 60, 0); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, 0); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1181,8 +1194,9 @@ mps_config_get_raid_volume_pg0(struct mps_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_wait_command(sc, cm, 60, 0); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, 0); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1225,7 +1239,7 @@ mps_config_get_raid_volume_pg1(struct mps_softc *sc, M *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form, u16 handle) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; Mpi2RaidVolPage1_t *page = NULL; int error = 0; @@ -1248,8 +1262,9 @@ mps_config_get_raid_volume_pg1(struct mps_softc *sc, M request->Header.PageVersion = MPI2_RAIDVOLPAGE1_PAGEVERSION; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Aug 10 15:31:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CD12DD5CF8; Thu, 10 Aug 2017 15:31:47 +0000 (UTC) (envelope-from rcyu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7BCB651EF; Thu, 10 Aug 2017 15:31:46 +0000 (UTC) (envelope-from rcyu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AFVkJi055909; Thu, 10 Aug 2017 15:31:46 GMT (envelope-from rcyu@FreeBSD.org) Received: (from rcyu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AFVkPf055908; Thu, 10 Aug 2017 15:31:46 GMT (envelope-from rcyu@FreeBSD.org) Message-Id: <201708101531.v7AFVkPf055908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rcyu set sender to rcyu@FreeBSD.org using -f From: Ruey-Cherng Yu Date: Thu, 10 Aug 2017 15:31:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322365 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: rcyu X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 15:31:47 -0000 Author: rcyu (doc committer) Date: Thu Aug 10 15:31:45 2017 New Revision: 322365 URL: https://svnweb.freebsd.org/changeset/base/322365 Log: Add myself. Reported by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 14:59:17 2017 (r322364) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 15:31:45 2017 (r322365) @@ -144,6 +144,7 @@ 04/11 Bruce A. Mah born in Fresno, California, United States, 1969 04/12 Patrick Gardella born in Columbus, Ohio, United States, 1967 04/12 Ed Schouten born in Oss, the Netherlands, 1986 +04/12 Ruey-Cherng Yu born in Keelung, Taiwan, 1978 04/13 Oliver Braun born in Nuremberg, Bavaria, Germany, 1972 04/14 Crist J. Clark born in Milwaukee, Wisconsin, United States, 1970 04/14 Glen J. Barber born in Wilkes-Barre, Pennsylvania, United States, 1981 From owner-svn-src-head@freebsd.org Thu Aug 10 15:42:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E624FDD62F9; Thu, 10 Aug 2017 15:42:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B430365FAF; Thu, 10 Aug 2017 15:42:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AFgPJF064596; Thu, 10 Aug 2017 15:42:25 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AFgPmQ064595; Thu, 10 Aug 2017 15:42:25 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708101542.v7AFgPmQ064595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 10 Aug 2017 15:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322368 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 322368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 15:42:27 -0000 Author: pfg Date: Thu Aug 10 15:42:25 2017 New Revision: 322368 URL: https://svnweb.freebsd.org/changeset/base/322368 Log: fnmatch(3): improve POSIX conformance. In a recent interpretation[1], "\\" shall return a non-zero value (indicating either no match or an error). The fix involves a change over r254091 and now the behavior matches the Sun/IBM/HP closed source implementations and also likely musl libc. Submitted by: Joerg Schilling MFC after: 1 week [1] http://austingroupbugs.net/view.php?id=806 Modified: head/lib/libc/gen/fnmatch.c Modified: head/lib/libc/gen/fnmatch.c ============================================================================== --- head/lib/libc/gen/fnmatch.c Thu Aug 10 15:34:50 2017 (r322367) +++ head/lib/libc/gen/fnmatch.c Thu Aug 10 15:42:25 2017 (r322368) @@ -184,7 +184,8 @@ fnmatch1(const char *pattern, const char *string, cons if (!(flags & FNM_NOESCAPE)) { pclen = mbrtowc(&pc, pattern, MB_LEN_MAX, &patmbs); - if (pclen == (size_t)-1 || pclen == (size_t)-2) + if (pclen == 0 || pclen == (size_t)-1 || + pclen == (size_t)-2) return (FNM_NOMATCH); pattern += pclen; } From owner-svn-src-head@freebsd.org Thu Aug 10 16:45:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B4DCDD78CE; Thu, 10 Aug 2017 16:45:07 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5B4468B88; Thu, 10 Aug 2017 16:45:06 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AGj51o089921; Thu, 10 Aug 2017 16:45:05 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AGj5r4089920; Thu, 10 Aug 2017 16:45:05 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201708101645.v7AGj5r4089920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Thu, 10 Aug 2017 16:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322369 - head/lib/libutil X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libutil X-SVN-Commit-Revision: 322369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 16:45:07 -0000 Author: oshogbo Date: Thu Aug 10 16:45:05 2017 New Revision: 322369 URL: https://svnweb.freebsd.org/changeset/base/322369 Log: Store directory descriptor in the pidfh structure and use unlinkat(2) function instead of unlink(2). Now when pidfile_remove() uses unlinkat(2) to remove the pidfile it is safe to use this function in capability mode. Style fix: sort headers. PR: 220524 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D11692 Modified: head/lib/libutil/pidfile.c Modified: head/lib/libutil/pidfile.c ============================================================================== --- head/lib/libutil/pidfile.c Thu Aug 10 15:42:25 2017 (r322368) +++ head/lib/libutil/pidfile.c Thu Aug 10 16:45:05 2017 (r322369) @@ -31,19 +31,22 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include #include #include -#include -#include #include #include -#include -#include -#include +#include struct pidfh { + int pf_dirfd; int pf_fd; - char pf_path[MAXPATHLEN + 1]; + char pf_dir[MAXPATHLEN + 1]; + char pf_filename[MAXPATHLEN + 1]; dev_t pf_dev; ino_t pf_ino; }; @@ -68,12 +71,12 @@ pidfile_verify(const struct pidfh *pfh) } static int -pidfile_read(const char *path, pid_t *pidptr) +pidfile_read(int dirfd, const char *filename, pid_t *pidptr) { char buf[16], *endptr; int error, fd, i; - fd = open(path, O_RDONLY | O_CLOEXEC); + fd = openat(dirfd, filename, O_RDONLY | O_CLOEXEC); if (fd == -1) return (errno); @@ -98,32 +101,50 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid { struct pidfh *pfh; struct stat sb; - int error, fd, len, count; + int error, fd, dirfd, dirlen, filenamelen, count; struct timespec rqtp; pfh = malloc(sizeof(*pfh)); if (pfh == NULL) return (NULL); - if (path == NULL) - len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), - "/var/run/%s.pid", getprogname()); - else - len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), + if (path == NULL) { + dirlen = snprintf(pfh->pf_dir, sizeof(pfh->pf_dir), + "/var/run/"); + filenamelen = snprintf(pfh->pf_filename, + sizeof(pfh->pf_filename), "%s.pid", getprogname()); + } else { + dirlen = snprintf(pfh->pf_dir, sizeof(pfh->pf_dir), "%s", path); - if (len >= (int)sizeof(pfh->pf_path)) { + filenamelen = snprintf(pfh->pf_filename, + sizeof(pfh->pf_filename), "%s", path); + + dirname(pfh->pf_dir); + basename(pfh->pf_filename); + } + + if (dirlen >= (int)sizeof(pfh->pf_dir) || + filenamelen >= (int)sizeof(pfh->pf_filename)) { free(pfh); errno = ENAMETOOLONG; return (NULL); } + dirfd = open(pfh->pf_dir, O_CLOEXEC | O_DIRECTORY | O_NONBLOCK); + if (dirfd == -1) { + error = errno; + free(pfh); + errno = error; + return (NULL); + } + /* * Open the PID file and obtain exclusive lock. * We truncate PID file here only to remove old PID immediately, * PID file will be truncated again in pidfile_write(), so * pidfile_write() can be called multiple times. */ - fd = flopen(pfh->pf_path, + fd = flopenat(dirfd, pfh->pf_filename, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NONBLOCK, mode); if (fd == -1) { if (errno == EWOULDBLOCK) { @@ -134,8 +155,8 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid rqtp.tv_sec = 0; rqtp.tv_nsec = 5000000; for (;;) { - errno = pidfile_read(pfh->pf_path, - pidptr); + errno = pidfile_read(dirfd, + pfh->pf_filename, pidptr); if (errno != EAGAIN || --count == 0) break; nanosleep(&rqtp, 0); @@ -146,7 +167,10 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid errno = EEXIST; } } + error = errno; + close(dirfd); free(pfh); + errno = error; return (NULL); } @@ -156,13 +180,15 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid */ if (fstat(fd, &sb) == -1) { error = errno; - unlink(pfh->pf_path); + unlinkat(dirfd, pfh->pf_filename, 0); + close(dirfd); close(fd); free(pfh); errno = error; return (NULL); } + pfh->pf_dirfd = dirfd; pfh->pf_fd = fd; pfh->pf_dev = sb.st_dev; pfh->pf_ino = sb.st_ino; @@ -223,6 +249,9 @@ pidfile_close(struct pidfh *pfh) if (close(pfh->pf_fd) == -1) error = errno; + if (close(pfh->pf_dirfd) == -1 && error == 0) + error = errno; + free(pfh); if (error != 0) { errno = error; @@ -242,12 +271,12 @@ _pidfile_remove(struct pidfh *pfh, int freeit) return (-1); } - if (unlink(pfh->pf_path) == -1) + if (unlinkat(pfh->pf_dirfd, pfh->pf_filename, 0) == -1) error = errno; - if (close(pfh->pf_fd) == -1) { - if (error == 0) - error = errno; - } + if (close(pfh->pf_fd) == -1 && error == 0) + error = errno; + if (close(pfh->pf_dirfd) == -1 && error == 0) + error = errno; if (freeit) free(pfh); else From owner-svn-src-head@freebsd.org Thu Aug 10 16:50:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E24FDD7A9D; Thu, 10 Aug 2017 16:50:15 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7F3C6936E; Thu, 10 Aug 2017 16:50:14 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AGoDeu090171; Thu, 10 Aug 2017 16:50:13 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AGoD6I090170; Thu, 10 Aug 2017 16:50:13 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201708101650.v7AGoD6I090170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Thu, 10 Aug 2017 16:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322370 - head/lib/libutil X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libutil X-SVN-Commit-Revision: 322370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 16:50:15 -0000 Author: oshogbo Date: Thu Aug 10 16:50:13 2017 New Revision: 322370 URL: https://svnweb.freebsd.org/changeset/base/322370 Log: Limit descriptors stored in the pidfh structure. Reviewed by: markj, cem Differential Revision: https://reviews.freebsd.org/D11741 Modified: head/lib/libutil/pidfile.c Modified: head/lib/libutil/pidfile.c ============================================================================== --- head/lib/libutil/pidfile.c Thu Aug 10 16:45:05 2017 (r322369) +++ head/lib/libutil/pidfile.c Thu Aug 10 16:50:13 2017 (r322370) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -103,6 +104,7 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid struct stat sb; int error, fd, dirfd, dirlen, filenamelen, count; struct timespec rqtp; + cap_rights_t caprights; pfh = malloc(sizeof(*pfh)); if (pfh == NULL) @@ -179,21 +181,35 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid * to the proper descriptor. */ if (fstat(fd, &sb) == -1) { - error = errno; - unlinkat(dirfd, pfh->pf_filename, 0); - close(dirfd); - close(fd); - free(pfh); - errno = error; - return (NULL); + goto failed; } + if (cap_rights_limit(dirfd, + cap_rights_init(&caprights, CAP_UNLINKAT)) < 0 && errno != ENOSYS) { + goto failed; + } + + if (cap_rights_limit(fd, cap_rights_init(&caprights, CAP_PWRITE, + CAP_FSTAT, CAP_FTRUNCATE)) < 0 && + errno != ENOSYS) { + goto failed; + } + pfh->pf_dirfd = dirfd; pfh->pf_fd = fd; pfh->pf_dev = sb.st_dev; pfh->pf_ino = sb.st_ino; return (pfh); + +failed: + error = errno; + unlinkat(dirfd, pfh->pf_filename, 0); + close(dirfd); + close(fd); + free(pfh); + errno = error; + return (NULL); } int From owner-svn-src-head@freebsd.org Thu Aug 10 17:03:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9130BDD81FE; Thu, 10 Aug 2017 17:03:47 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5DFFE69D34; Thu, 10 Aug 2017 17:03:47 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AH3k5k098214; Thu, 10 Aug 2017 17:03:46 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AH3kju098213; Thu, 10 Aug 2017 17:03:46 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708101703.v7AH3kju098213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 10 Aug 2017 17:03:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322371 - head/lib/libc/tests/gen X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libc/tests/gen X-SVN-Commit-Revision: 322371 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 17:03:47 -0000 Author: pfg Date: Thu Aug 10 17:03:46 2017 New Revision: 322371 URL: https://svnweb.freebsd.org/changeset/base/322371 Log: fnmatch(3): Update testcase for r322368. Modified: head/lib/libc/tests/gen/fnmatch_testcases.h Modified: head/lib/libc/tests/gen/fnmatch_testcases.h ============================================================================== --- head/lib/libc/tests/gen/fnmatch_testcases.h Thu Aug 10 16:50:13 2017 (r322370) +++ head/lib/libc/tests/gen/fnmatch_testcases.h Thu Aug 10 17:03:46 2017 (r322371) @@ -131,7 +131,7 @@ struct testcase { { "\\(", "\\(", 0, FNM_NOMATCH }, { "\\a", "\\a", 0, FNM_NOMATCH }, { "\\", "\\", 0, FNM_NOMATCH }, - { "\\", "", 0, 0 }, + { "\\", "", 0, FNM_NOMATCH }, { "\\*", "\\*", FNM_NOESCAPE, 0 }, { "\\?", "\\?", FNM_NOESCAPE, 0 }, { "\\", "\\", FNM_NOESCAPE, 0 }, From owner-svn-src-head@freebsd.org Thu Aug 10 17:46:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 601B2DD8BB3; Thu, 10 Aug 2017 17:46:58 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FAC26ADF7; Thu, 10 Aug 2017 17:46:58 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AHkvbV014741; Thu, 10 Aug 2017 17:46:57 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AHkvdw014739; Thu, 10 Aug 2017 17:46:57 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708101746.v7AHkvdw014739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 10 Aug 2017 17:46:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322372 - in head/sys/x86: acpica x86 X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: in head/sys/x86: acpica x86 X-SVN-Commit-Revision: 322372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 17:46:58 -0000 Author: royger Date: Thu Aug 10 17:46:57 2017 New Revision: 322372 URL: https://svnweb.freebsd.org/changeset/base/322372 Log: mptable: fix i386 build failure Reported by: emaste X-MFC-with: r322347 Modified: head/sys/x86/acpica/madt.c head/sys/x86/x86/mptable.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Thu Aug 10 17:03:46 2017 (r322371) +++ head/sys/x86/acpica/madt.c Thu Aug 10 17:46:57 2017 (r322372) @@ -325,12 +325,17 @@ static void madt_parse_cpu(unsigned int apic_id, unsigned int flags) { - if (!(flags & ACPI_MADT_ENABLED) || mp_ncpus == MAXCPU || + if (!(flags & ACPI_MADT_ENABLED) || +#ifdef SMP + mp_ncpus == MAXCPU || +#endif apic_id > MAX_APIC_ID) return; +#ifdef SMP mp_ncpus++; mp_maxid = mp_ncpus - 1; +#endif max_apic_id = max(apic_id, max_apic_id); } Modified: head/sys/x86/x86/mptable.c ============================================================================== --- head/sys/x86/x86/mptable.c Thu Aug 10 17:03:46 2017 (r322371) +++ head/sys/x86/x86/mptable.c Thu Aug 10 17:46:57 2017 (r322372) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef NEW_PCIB #include #endif @@ -330,8 +331,10 @@ mptable_probe_cpus(void) /* Is this a pre-defined config? */ if (mpfps->config_type != 0) { +#ifdef SMP mp_ncpus = 2; mp_maxid = 1; +#endif max_apic_id = 1; } else { mptable_walk_table(mptable_probe_cpus_handler, &cpu_mask); @@ -346,6 +349,7 @@ static int mptable_setup_local(void) { vm_paddr_t addr; + u_int cpu_mask; /* Is this a pre-defined config? */ printf("MPTable: <"); @@ -478,8 +482,10 @@ mptable_probe_cpus_handler(u_char *entry, void *arg) proc = (proc_entry_ptr)entry; if (proc->cpu_flags & PROCENTRY_FLAG_EN && proc->apic_id < MAX_LAPIC_ID && mp_ncpus < MAXCPU) { +#ifdef SMP mp_ncpus++; mp_maxid = mp_ncpus - 1; +#endif max_apic_id = max(max_apic_id, proc->apic_id); } break; From owner-svn-src-head@freebsd.org Thu Aug 10 17:48:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CC5DDD8CDD; Thu, 10 Aug 2017 17:48:59 +0000 (UTC) (envelope-from royger@gmail.com) Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B31D46AFE2; Thu, 10 Aug 2017 17:48:58 +0000 (UTC) (envelope-from royger@gmail.com) Received: by mail-wm0-x233.google.com with SMTP id i66so28820246wmg.0; Thu, 10 Aug 2017 10:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=XAxHsNMlZYUppIGhBkZpXNl0hYKIA5XoJkiYa+3hwBA=; b=L1HlJTzK5/MQ6ZzI5kIUFs/MGv49K5lX6JSMy3+ycJ4pcFNVzIQKjUApleQHx5ECmh HCYmvenFSoppMmobvnKXpZY3S9YBi53GPJ+kCKhkymz8+4n3+AZ5lYjPDBbgKePnp4RS p+Y2WZe2jTwANP6Kn3HmudVD29EB4iXS2L8EOPfRFGbj41I5S8NR/cGWnMJft7VgI4R5 i+prp4pOtzHB9rP72oPl8Rv3OywnKJ6TmavzxLpt2IzWauJtyCdfiYvafN76oXamJl5U faxZlvbdWCNrKywTabTq4/ruVdQRif6yT/XnazS9ixXGiJDzBde7ftIKR7jV8kVzFxvv mTag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=XAxHsNMlZYUppIGhBkZpXNl0hYKIA5XoJkiYa+3hwBA=; b=jl44L7zqG59benMTkEGYzmqQ2E26a6JZarBT9kMe+HrqeTnWAkiJK5Mgw9mJwndPFX /Jm2YCXzrzHflKZvlHGrYNoFVa4ZO4wCcpMaNbVGRhfvgj43eIfXSpd2uJvqx3PeyUF2 ZsaqUvsfn/BXRTk7rKcqNYutStIE4FHgeoUEQPdaiHDzWh4+SAkxzw1iT/Sd6EzAY2uo VIRWzIaO4R3PfK2C5uUyGLDb6485JUIaYBDF+YyfRFsmY8e18xF7EFkJZU0bTA7lXLB3 hTkNWEMPUFPl77+/ZSM50BIav0qzP4UnejfLEkNQFbS0iTdj16bjzQScEAT6xUWK8e3f NsNg== X-Gm-Message-State: AHYfb5h0Q2vhlVJD3+f15cOWJaZElAMLYH4WN577tmngJK5LtcebE7BQ 14Otvm3PTBbAX33m X-Received: by 10.80.164.173 with SMTP id w42mr12883328edb.76.1502387336925; Thu, 10 Aug 2017 10:48:56 -0700 (PDT) Received: from localhost (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id i23sm2679866edj.13.2017.08.10.10.48.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Aug 2017 10:48:56 -0700 (PDT) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Date: Thu, 10 Aug 2017 18:48:53 +0100 From: Roger Pau =?iso-8859-1?Q?Monn=E9?= To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen Message-ID: <20170810174853.6xzxzxscm4cmd5vy@dhcp-3-128.uk.xensource.com> References: <201708100915.v7A9FIke002476@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170714 (1.8.3) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 17:48:59 -0000 On Thu, Aug 10, 2017 at 10:20:59AM -0400, Ed Maste wrote: > On 10 August 2017 at 05:15, Roger Pau Monné wrote: > > Author: royger > > Date: Thu Aug 10 09:15:18 2017 > > New Revision: 322347 > > URL: https://svnweb.freebsd.org/changeset/base/322347 > > > > Log: > > apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase > > i386 is failing with: Thanks for the heads up! Should be fixed in r322372, will keep an eye on the CI. Roger. From owner-svn-src-head@freebsd.org Thu Aug 10 19:42:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5918DDB425; Thu, 10 Aug 2017 19:42:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72DCF6F0E9; Thu, 10 Aug 2017 19:42:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AJgUSm064776; Thu, 10 Aug 2017 19:42:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AJgUui064775; Thu, 10 Aug 2017 19:42:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708101942.v7AJgUui064775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 10 Aug 2017 19:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322373 - head/sys/arm/ti/am335x X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/ti/am335x X-SVN-Commit-Revision: 322373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 19:42:31 -0000 Author: ian Date: Thu Aug 10 19:42:30 2017 New Revision: 322373 URL: https://svnweb.freebsd.org/changeset/base/322373 Log: Ensure the clocks driver is attached before any drivers that need to enable clocks in their attach(). Modified: head/sys/arm/ti/am335x/am335x_prcm.c Modified: head/sys/arm/ti/am335x/am335x_prcm.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_prcm.c Thu Aug 10 17:46:57 2017 (r322372) +++ head/sys/arm/ti/am335x/am335x_prcm.c Thu Aug 10 19:42:30 2017 (r322373) @@ -465,8 +465,8 @@ static driver_t am335x_prcm_driver = { static devclass_t am335x_prcm_devclass; -DRIVER_MODULE(am335x_prcm, simplebus, am335x_prcm_driver, - am335x_prcm_devclass, 0, 0); +EARLY_DRIVER_MODULE(am335x_prcm, simplebus, am335x_prcm_driver, + am335x_prcm_devclass, 0, 0, BUS_PASS_TIMER + BUS_PASS_ORDER_EARLY); MODULE_VERSION(am335x_prcm, 1); MODULE_DEPEND(am335x_prcm, ti_scm, 1, 1, 1); From owner-svn-src-head@freebsd.org Thu Aug 10 20:26:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A740DDC30D; Thu, 10 Aug 2017 20:26:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBCDF703E3; Thu, 10 Aug 2017 20:26:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AKQ84q081033; Thu, 10 Aug 2017 20:26:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AKQ8LJ081032; Thu, 10 Aug 2017 20:26:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708102026.v7AKQ8LJ081032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 10 Aug 2017 20:26:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322374 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/bsdinstall/scripts X-SVN-Commit-Revision: 322374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 20:26:09 -0000 Author: emaste Date: Thu Aug 10 20:26:07 2017 New Revision: 322374 URL: https://svnweb.freebsd.org/changeset/base/322374 Log: bsdinstall: record DHCP config after obtaining lease Previously we added an ifconfig_$INTERFACE line to rc.conf for each unsuccessful DCHP attempt. PR: 219515 Reviewed by: allanjude MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D11967 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu Aug 10 19:42:30 2017 (r322373) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu Aug 10 20:26:07 2017 (r322374) @@ -48,8 +48,6 @@ esac dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0 if [ $? -eq $DIALOG_OK ]; then - echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/._rc.conf.net - if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0 err=$( dhclient $INTERFACE 2>&1 ) @@ -59,6 +57,7 @@ if [ $? -eq $DIALOG_OK ]; then exec $0 ${INTERFACE} "${IFCONFIG_PREFIX}" fi fi + echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/._rc.conf.net exit 0 fi From owner-svn-src-head@freebsd.org Thu Aug 10 22:03:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2C67DDDF19; Thu, 10 Aug 2017 22:03:29 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4764E732F6; Thu, 10 Aug 2017 22:03:29 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AM3SGf022074; Thu, 10 Aug 2017 22:03:28 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AM3QJ7022058; Thu, 10 Aug 2017 22:03:26 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201708102203.v7AM3QJ7022058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Thu, 10 Aug 2017 22:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322380 - in head/contrib/subversion: . subversion/include subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_svn subversion/libsvn_repos subve... X-SVN-Group: head X-SVN-Commit-Author: peter X-SVN-Commit-Paths: in head/contrib/subversion: . subversion/include subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_svn subversion/libsvn_repos subversion/libsvn_subr subvers... X-SVN-Commit-Revision: 322380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 22:03:29 -0000 Author: peter Date: Thu Aug 10 22:03:26 2017 New Revision: 322380 URL: https://svnweb.freebsd.org/changeset/base/322380 Log: Update subversion 1.9.5 -> 1.9.7 This includes a client-side fix for CVE-2017-9800. Modified: head/contrib/subversion/CHANGES head/contrib/subversion/NOTICE head/contrib/subversion/build-outputs.mk head/contrib/subversion/configure head/contrib/subversion/subversion/include/svn_version.h head/contrib/subversion/subversion/libsvn_client/copy.c head/contrib/subversion/subversion/libsvn_client/merge.c head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c head/contrib/subversion/subversion/libsvn_fs_fs/transaction.c head/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h head/contrib/subversion/subversion/libsvn_ra_svn/client.c head/contrib/subversion/subversion/libsvn_repos/dump.c head/contrib/subversion/subversion/libsvn_subr/config_file.c head/contrib/subversion/subversion/libsvn_subr/internal_statements.h head/contrib/subversion/subversion/libsvn_subr/io.c head/contrib/subversion/subversion/libsvn_subr/version.c head/contrib/subversion/subversion/libsvn_wc/wc-checks.h head/contrib/subversion/subversion/libsvn_wc/wc-metadata.h head/contrib/subversion/subversion/libsvn_wc/wc-queries.h head/contrib/subversion/subversion/svnadmin/svnadmin.c head/contrib/subversion/win-tests.py Directory Properties: head/contrib/subversion/ (props changed) Modified: head/contrib/subversion/CHANGES ============================================================================== --- head/contrib/subversion/CHANGES Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/CHANGES Thu Aug 10 22:03:26 2017 (r322380) @@ -1,3 +1,63 @@ +Version 1.9.7 +(10 Aug 2017, from /branches/1.9.x) +http://svn.apache.org/repos/asf/subversion/tags/1.9.7 + + User-visible changes: + - Client-side bugfixes: + * Fix arbitrary code execution vulnerability CVE-2017-9800 + See + for details. + + - Server-side bugfixes: + (none) + + - Bindings bugfixes: + (none) + + Developer-visible changes: + - General: + (none) + + - API changes: + (none) + + +Version 1.9.6 +(5 Jul 2017, from /branches/1.9.x) +http://svn.apache.org/repos/asf/subversion/tags/1.9.6 + + User-visible changes: + - Client-side bugfixes: + * cp/mv: improve error message when target is an unversioned dir (r1779948) + * merge: reduce memory usage with large amounts of mergeinfo (issue #4667) + + - Server-side bugfixes: + * 'svnadmin freeze': document the purpose more clearly (r1774109) + * dump: fix segfault when a revision has no revprops (r1781507) + * fsfs: improve error message upon failure to open rep-cache (r1781655) + * fsfs: never attempt to share directory representations (r1785053) + * fsfs: make consistency independent of hash algorithms (r1785737 et al) + This change makes Subversion resilient to collision attacks, including + SHA-1 collision attacks such as . See also our + documentation at and + . + + - Client-side and server-side bugfixes: + * work around an APR bug related to file truncation (r1759116) + + - Bindings bugfixes: + * javahl: follow redirects when opening a connection (r1667738, r1796720) + + Developer-visible changes: + - General: + * win_tests.py: make the --bin option work, rather than abort (r1706432) + (regression introduced in 1.9.2) + * windows: support building with 'zlibstat.lib' in install-layout (r1783704) + + - API changes: + (none) + + Version 1.9.5 (29 Nov 2016, from /branches/1.9.x) http://svn.apache.org/repos/asf/subversion/tags/1.9.5 @@ -19,7 +79,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.5 * fsfs: fix "offset too large" error during pack (issue #4657) * svnserve: enable hook script environments (r1769152) * fsfs: fix possible data reconstruction error (issue #4658) - * fix source of spurious 'incoming edit' tree conflicts (r1770108) + * fix source of spurious 'incoming edit' tree conflicts (r1760570) * fsfs: improve caching for large directories (r1721285) * fsfs: fix crash when encountering all-zero checksums (r1759686) * fsfs: fix potential source of repository corruptions (r1756266) @@ -34,19 +94,19 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.5 - Bindings bugfixes: * swig-pl: do not corrupt "{DATE}" revision variable (r1767768) - * javahl: fix temporary accepting SSL server certificates (r1764851) + * javahl: fix temporarily accepting SSL server certificates (r1764851) * swig-pl: fix possible stack corruption (r1683266, r1683267) Developer-visible changes: - General: * add zlib discovery through pkg-config (issue #4655) * fix potential build issue with invalid SVN_LOCALE_DIR (issue #4653) - * ruby: fix test failures with ruby >= 2.2 (r1766621) - * fix link error with --disable-keychain on OS X (r1765385) + * ruby: fix test failures with ruby >= 2.2 (r1766240) + * fix link error with --disable-keychain on OS X (r1761755) * swig: enable building with SWIG >= 3.0.6 (r1721488 et al) * swig: fix building with -Wdate-time in $CPPFLAGS (r1722164) * update serf download URI in build scripts (r1700130 et al) - * raise minimal httpd version from 2.0 to 2.2 (r1754193) + * raise minimal httpd version from 2.0 to 2.2 (r1754190) Version 1.9.4 @@ -105,7 +165,6 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.3 * svn: report lock/unlock errors as failures (r1701598 et al) * svn: cleanup user deleted external registrations (r1705843, r1710558) * svn: allow simple resolving of binary file text conflicts (r1703581) - * svnlook: properly remove tempfiles on diff errors (r1711346) * ra_serf: report built- and run-time versions of libserf (r1704847) * ra_serf: set Content-Type header in outgoing requests (r1715224 et al) * svn: fix merging deletes of svn:eol-style CRLF/CR files (r1703689 et al) @@ -118,6 +177,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.3 * mod_dav_svn: use LimitXMLRequestBody for skel-encoded requests (r1687812) * svnadmin dump: preserve no-op changes (r1709388 et al, issue #4598) * fsfs: avoid unneeded I/O when opening transactions (r1715793) + * svnlook: properly remove tempfiles on diff errors (r1711346) - Client-side and server-side bugfixes: * fix heap overflow in svn:// protocol parser (CVE-2015-5259) @@ -942,18 +1002,18 @@ http://svn.apache.org/repos/asf/subversion/tags/1.8.17 - Client-side bugfixes: * fix handling of newly secured subdirectories in working copy (r1724448) * ra_serf: fix deleting directories with many files (issue #4557) - * svnlook: properly remove tempfiles on diff errors (r1711346) * gpg-agent: properly handle passwords with percent characters (issue #4611) * merge: fix crash when merging to a local add (r1702299 et al) - Server-side bugfixes: * fsfs: fix possible data reconstruction error (issue #4658) + * svnlook: properly remove tempfiles on diff errors (r1711346) - Client-side and server-side bugfixes: * fix potential memory access bugs (r1722860 et al) - Bindings bugfixes: - * javahl: fix temporary accepting SSL server certificates (r1764851) + * javahl: fix temporarily accepting SSL server certificates (r1764851) * swig-pl: do not corrupt "{DATE}" revision variable (r1767768) * swig-pl: fix possible stack corruption (r1683266) Modified: head/contrib/subversion/NOTICE ============================================================================== --- head/contrib/subversion/NOTICE Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/NOTICE Thu Aug 10 22:03:26 2017 (r322380) @@ -1,5 +1,5 @@ Apache Subversion -Copyright 2016 The Apache Software Foundation +Copyright 2017 The Apache Software Foundation This product includes software developed by many people, and distributed under Contributor License Agreements to The Apache Software Foundation Modified: head/contrib/subversion/build-outputs.mk ============================================================================== --- head/contrib/subversion/build-outputs.mk Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/build-outputs.mk Thu Aug 10 22:03:26 2017 (r322380) @@ -2782,7 +2782,7 @@ subversion/libsvn_ra_serf/util_error.lo: subversion/li subversion/libsvn_ra_serf/xml.lo: subversion/libsvn_ra_serf/xml.c subversion/include/private/svn_dav_protocol.h subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_string_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_dav.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/include/svn_xml.h subversion/libsvn_ra/ra_loader.h subversion/libsvn_ra_serf/blncache.h subversion/libsvn_ra_serf/ra_se rf.h subversion/svn_private_config.h -subversion/libsvn_ra_svn/client.lo: subversion/libsvn_ra_svn/client.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fspath.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_ra_svn_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_compat.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/libsvn_ra/ra_loader.h sub version/libsvn_ra/wrapper_template.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h +subversion/libsvn_ra_svn/client.lo: subversion/libsvn_ra_svn/client.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fspath.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_ra_svn_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_compat.h subversion/include/svn_config.h subversion/include/svn_ctype.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version.h subve rsion/libsvn_ra/ra_loader.h subversion/libsvn_ra/wrapper_template.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h subversion/libsvn_ra_svn/cram.lo: subversion/libsvn_ra_svn/cram.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_ra_svn_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h Modified: head/contrib/subversion/configure ============================================================================== --- head/contrib/subversion/configure Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/configure Thu Aug 10 22:03:26 2017 (r322380) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for subversion 1.9.5. +# Generated by GNU Autoconf 2.69 for subversion 1.9.7. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='subversion' PACKAGE_TARNAME='subversion' -PACKAGE_VERSION='1.9.5' -PACKAGE_STRING='subversion 1.9.5' +PACKAGE_VERSION='1.9.7' +PACKAGE_STRING='subversion 1.9.7' PACKAGE_BUGREPORT='http://subversion.apache.org/' PACKAGE_URL='' @@ -1471,7 +1471,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures subversion 1.9.5 to adapt to many kinds of systems. +\`configure' configures subversion 1.9.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1537,7 +1537,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of subversion 1.9.5:";; + short | recursive ) echo "Configuration of subversion 1.9.7:";; esac cat <<\_ACEOF @@ -1751,7 +1751,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -subversion configure 1.9.5 +subversion configure 1.9.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2295,7 +2295,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by subversion $as_me 1.9.5, which was +It was created by subversion $as_me 1.9.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2675,8 +2675,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please -{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.5" >&5 -$as_echo "$as_me: Configuring Subversion 1.9.5" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.7" >&5 +$as_echo "$as_me: Configuring Subversion 1.9.7" >&6;} abs_srcdir="`cd $srcdir && pwd`" @@ -26756,7 +26756,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by subversion $as_me 1.9.5, which was +This file was extended by subversion $as_me 1.9.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -26822,7 +26822,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -subversion config.status 1.9.5 +subversion config.status 1.9.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/subversion/subversion/include/svn_version.h ============================================================================== --- head/contrib/subversion/subversion/include/svn_version.h Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/include/svn_version.h Thu Aug 10 22:03:26 2017 (r322380) @@ -70,7 +70,7 @@ extern "C" { * * @since New in 1.1. */ -#define SVN_VER_PATCH 5 +#define SVN_VER_PATCH 7 /** @deprecated Provided for backward compatibility with the 1.0 API. */ @@ -93,7 +93,7 @@ extern "C" { * * Always change this at the same time as SVN_VER_NUMTAG. */ -#define SVN_VER_TAG " (r1770682)" +#define SVN_VER_TAG " (r1800392)" /** Number tag: a string describing the version. @@ -117,7 +117,7 @@ extern "C" { * file version. Its value remains 0 in the repository except in release * tags where it is the revision from which the tag was created. */ -#define SVN_VER_REVISION 1770682 +#define SVN_VER_REVISION 1800392 /* Version strings composed from the above definitions. */ Modified: head/contrib/subversion/subversion/libsvn_client/copy.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_client/copy.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_client/copy.c Thu Aug 10 22:03:26 2017 (r322380) @@ -1057,10 +1057,24 @@ verify_wc_dsts(const apr_array_header_t *copy_pairs, ctx->wc_ctx, pair->dst_parent_abspath, FALSE, TRUE, iterpool)); - if (make_parents && dst_parent_kind == svn_node_none) + if (dst_parent_kind == svn_node_none) { - SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath, - TRUE, ctx, iterpool)); + if (make_parents) + SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath, + TRUE, ctx, iterpool)); + else + { + SVN_ERR(svn_io_check_path(pair->dst_parent_abspath, + &dst_parent_kind, scratch_pool)); + return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL, + (dst_parent_kind == svn_node_dir) + ? _("Directory '%s' is not under " + "version control") + : _("Path '%s' is not a directory"), + svn_dirent_local_style( + pair->dst_parent_abspath, + scratch_pool)); + } } else if (dst_parent_kind != svn_node_dir) { Modified: head/contrib/subversion/subversion/libsvn_client/merge.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_client/merge.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_client/merge.c Thu Aug 10 22:03:26 2017 (r322380) @@ -6465,6 +6465,7 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ { int i; apr_pool_t *iterpool = svn_pool_create(scratch_pool); + apr_pool_t *swmi_pool; apr_hash_t *subtrees_with_mergeinfo; apr_hash_t *excluded_subtrees; apr_hash_t *switched_subtrees; @@ -6473,10 +6474,13 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ struct pre_merge_status_baton_t pre_merge_status_baton; /* Case 1: Subtrees with explicit mergeinfo. */ + /* Use a subpool for subtrees_with_mergeinfo, as it can be very large + and is temporary. */ + swmi_pool = svn_pool_create(scratch_pool); SVN_ERR(get_wc_explicit_mergeinfo_catalog(&subtrees_with_mergeinfo, target->abspath, depth, ctx, - result_pool, scratch_pool)); + swmi_pool, swmi_pool)); if (subtrees_with_mergeinfo) { apr_hash_index_t *hi; @@ -6513,6 +6517,7 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ children_with_mergeinfo->elt_size, compare_merge_path_t_as_paths); } + svn_pool_destroy(swmi_pool); /* Case 2: Switched subtrees Case 10: Paths at depths of 'empty' or 'files' @@ -12331,6 +12336,10 @@ find_last_merged_location(svn_client__pathrev_t **base svn_revnum_t youngest_merged_rev = SVN_INVALID_REVNUM; svn_mergeinfo_catalog_t target_mergeinfo_cat = NULL; + /* Using a local subpool for 'target_mergeinfo_cat' can make a big + reduction in overall memory usage. */ + apr_pool_t *tmic_pool = svn_pool_create(scratch_pool); + source_peg_rev.kind = svn_opt_revision_number; source_peg_rev.value.number = source_branch->tip->rev; source_start_rev.kind = svn_opt_revision_number; @@ -12351,7 +12360,7 @@ find_last_merged_location(svn_client__pathrev_t **base operative_rev_receiver, &youngest_merged_rev, ctx, ra_session, - result_pool, scratch_pool)); + tmic_pool, tmic_pool)); if (!SVN_IS_VALID_REVNUM(youngest_merged_rev)) { @@ -12387,7 +12396,7 @@ find_last_merged_location(svn_client__pathrev_t **base operative_rev_receiver, &oldest_eligible_rev, ctx, ra_session, - scratch_pool, scratch_pool)); + tmic_pool, tmic_pool)); /* If there are revisions eligible for merging, use the oldest one to calculate the base. Otherwise there are no operative revisions @@ -12409,6 +12418,7 @@ find_last_merged_location(svn_client__pathrev_t **base result_pool, scratch_pool)); } + svn_pool_destroy(tmic_pool); return SVN_NO_ERROR; } Modified: head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c Thu Aug 10 22:03:26 2017 (r322380) @@ -2029,8 +2029,13 @@ rep_read_contents(void *baton, SVN_ERR(skip_contents(rb, rb->fulltext_delivered)); } - /* Get the next block of data. */ - SVN_ERR(get_contents_from_windows(rb, buf, len)); + /* Get the next block of data. + * Keep in mind that the representation might be empty and leave us + * already positioned at the end of the rep. */ + if (rb->off == rb->len) + *len = 0; + else + SVN_ERR(get_contents_from_windows(rb, buf, len)); if (rb->current_fulltext) svn_stringbuf_appendbytes(rb->current_fulltext, buf, *len); @@ -2119,6 +2124,96 @@ svn_fs_fs__get_contents(svn_stream_t **contents_p, rep_read_contents); svn_stream_set_close(*contents_p, rep_read_contents_close); } + + return SVN_NO_ERROR; +} + +svn_error_t * +svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p, + svn_fs_t *fs, + representation_t *rep, + apr_file_t *file, + apr_off_t offset, + apr_pool_t *pool) +{ + struct rep_read_baton *rb; + pair_cache_key_t fulltext_cache_key = { SVN_INVALID_REVNUM, 0 }; + rep_state_t *rs = apr_pcalloc(pool, sizeof(*rs)); + svn_fs_fs__rep_header_t *rh; + + /* Initialize the reader baton. Some members may added lazily + * while reading from the stream. */ + SVN_ERR(rep_read_get_baton(&rb, fs, rep, fulltext_cache_key, pool)); + + /* Continue constructing RS. Leave caches as NULL. */ + rs->size = rep->size; + rs->revision = SVN_INVALID_REVNUM; + rs->item_index = 0; + rs->ver = -1; + rs->start = -1; + + /* Provide just enough file access info to allow for a basic read from + * FILE but leave all index / footer info with empty values b/c FILE + * probably is not a complete revision file. */ + rs->sfile = apr_pcalloc(pool, sizeof(*rs->sfile)); + rs->sfile->revision = rep->revision; + rs->sfile->pool = pool; + rs->sfile->fs = fs; + rs->sfile->rfile = apr_pcalloc(pool, sizeof(*rs->sfile->rfile)); + rs->sfile->rfile->start_revision = SVN_INVALID_REVNUM; + rs->sfile->rfile->file = file; + rs->sfile->rfile->stream = svn_stream_from_aprfile2(file, TRUE, pool); + + /* Read the rep header. */ + SVN_ERR(aligned_seek(fs, file, NULL, offset, pool)); + SVN_ERR(svn_fs_fs__read_rep_header(&rh, rs->sfile->rfile->stream, + pool, pool)); + SVN_ERR(get_file_offset(&rs->start, rs, pool)); + rs->header_size = rh->header_size; + + /* Log the access. */ + SVN_ERR(dbg_log_access(fs, SVN_INVALID_REVNUM, 0, rh, + SVN_FS_FS__ITEM_TYPE_ANY_REP, pool)); + + /* Build the representation list (delta chain). */ + if (rh->type == svn_fs_fs__rep_plain) + { + rb->rs_list = apr_array_make(pool, 0, sizeof(rep_state_t *)); + rb->src_state = rs; + } + else if (rh->type == svn_fs_fs__rep_self_delta) + { + rb->rs_list = apr_array_make(pool, 1, sizeof(rep_state_t *)); + APR_ARRAY_PUSH(rb->rs_list, rep_state_t *) = rs; + rb->src_state = NULL; + } + else + { + representation_t next_rep = { 0 }; + + /* skip "SVNx" diff marker */ + rs->current = 4; + + /* REP's base rep is inside a proper revision. + * It can be reconstructed in the usual way. */ + next_rep.revision = rh->base_revision; + next_rep.item_index = rh->base_item_index; + next_rep.size = rh->base_length; + svn_fs_fs__id_txn_reset(&next_rep.txn_id); + + SVN_ERR(build_rep_list(&rb->rs_list, &rb->base_window, + &rb->src_state, &rb->len, rb->fs, &next_rep, + rb->filehandle_pool)); + + /* Insert the access to REP as the first element of the delta chain. */ + svn_sort__array_insert(rb->rs_list, &rs, 0); + } + + /* Now, the baton is complete and we can assemble the stream around it. */ + *contents_p = svn_stream_create(rb, pool); + svn_stream_set_read2(*contents_p, NULL /* only full read support */, + rep_read_contents); + svn_stream_set_close(*contents_p, rep_read_contents_close); return SVN_NO_ERROR; } Modified: head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h Thu Aug 10 22:03:26 2017 (r322380) @@ -81,6 +81,18 @@ svn_fs_fs__get_contents(svn_stream_t **contents_p, svn_boolean_t cache_fulltext, apr_pool_t *pool); +/* Set *CONTENTS_P to be a readable svn_stream_t that receives the text + representation REP as seen in filesystem FS. Read the latest element + of the delta chain from FILE at offset OFFSET. + Use POOL for allocations. */ +svn_error_t * +svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p, + svn_fs_t *fs, + representation_t *rep, + apr_file_t *file, + apr_off_t offset, + apr_pool_t *pool); + /* Attempt to fetch the text representation of node-revision NODEREV as seen in filesystem FS and pass it along with the BATON to the PROCESSOR. Set *SUCCESS only of the data could be provided and the processing Modified: head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h Thu Aug 10 22:03:26 2017 (r322380) @@ -1,4 +1,4 @@ -/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.5/subversion/libsvn_fs_fs/token-map.h. +/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.7/subversion/libsvn_fs_fs/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_CREATE_SCHEMA 0 Modified: head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c Thu Aug 10 22:03:26 2017 (r322380) @@ -128,7 +128,10 @@ svn_fs_fs__open_rep_cache(svn_fs_t *fs, fs_fs_data_t *ffd = fs->fsap_data; svn_error_t *err = svn_atomic__init_once(&ffd->rep_cache_db_opened, open_rep_cache, fs, pool); - return svn_error_quick_wrap(err, _("Couldn't open rep-cache database")); + return svn_error_quick_wrapf(err, + _("Couldn't open rep-cache database '%s'"), + svn_dirent_local_style( + path_rep_cache_db(fs->path, pool), pool)); } svn_error_t * Modified: head/contrib/subversion/subversion/libsvn_fs_fs/transaction.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_fs/transaction.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_fs/transaction.c Thu Aug 10 22:03:26 2017 (r322380) @@ -2128,6 +2128,11 @@ rep_write_get_baton(struct rep_write_baton **wb_p, there may be new duplicate representations within the same uncommitted revision, those can be passed in REPS_HASH (maps a sha1 digest onto representation_t*), otherwise pass in NULL for REPS_HASH. + + The content of both representations will be compared, taking REP's content + from FILE at OFFSET. Only if they actually match, will *OLD_REP not be + NULL. + Use RESULT_POOL for *OLD_REP allocations and SCRATCH_POOL for temporaries. The lifetime of *OLD_REP is limited by both, RESULT_POOL and REP lifetime. */ @@ -2135,6 +2140,8 @@ static svn_error_t * get_shared_rep(representation_t **old_rep, svn_fs_t *fs, representation_t *rep, + apr_file_t *file, + apr_off_t offset, apr_hash_t *reps_hash, apr_pool_t *result_pool, apr_pool_t *scratch_pool) @@ -2142,6 +2149,10 @@ get_shared_rep(representation_t **old_rep, svn_error_t *err; fs_fs_data_t *ffd = fs->fsap_data; + svn_checksum_t checksum; + checksum.digest = rep->sha1_digest; + checksum.kind = svn_checksum_sha1; + /* Return NULL, if rep sharing has been disabled. */ *old_rep = NULL; if (!ffd->rep_sharing_allowed) @@ -2158,9 +2169,6 @@ get_shared_rep(representation_t **old_rep, /* If we haven't found anything yet, try harder and consult our DB. */ if (*old_rep == NULL) { - svn_checksum_t checksum; - checksum.digest = rep->sha1_digest; - checksum.kind = svn_checksum_sha1; err = svn_fs_fs__get_rep_reference(old_rep, fs, &checksum, result_pool); /* ### Other error codes that we shouldn't mask out? */ if (err == SVN_NO_ERROR) @@ -2235,6 +2243,72 @@ get_shared_rep(representation_t **old_rep, (*old_rep)->uniquifier = rep->uniquifier; } + /* If we (very likely) found a matching representation, compare the actual + * contents such that we can be sure that no rep-cache.db corruption or + * hash collision produced a false positive. */ + if (*old_rep) + { + apr_off_t old_position; + svn_stream_t *contents; + svn_stream_t *old_contents; + svn_boolean_t same; + + /* The existing representation may itself be part of the current + * transaction. In that case, it may be in different stages of + * the commit finalization process. + * + * OLD_REP_NORM is the same as that OLD_REP but it is assigned + * explicitly to REP's transaction if OLD_REP does not point + * to an already committed revision. This then prevents the + * revision lookup and the txn data will be accessed. + */ + representation_t old_rep_norm = **old_rep; + if ( !SVN_IS_VALID_REVNUM(old_rep_norm.revision) + || old_rep_norm.revision > ffd->youngest_rev_cache) + old_rep_norm.txn_id = rep->txn_id; + + /* Make sure we can later restore FILE's current position. */ + SVN_ERR(svn_fs_fs__get_file_offset(&old_position, file, scratch_pool)); + + /* Compare the two representations. + * Note that the stream comparison might also produce MD5 checksum + * errors or other failures in case of SHA1 collisions. */ + SVN_ERR(svn_fs_fs__get_contents_from_file(&contents, fs, rep, file, + offset, scratch_pool)); + SVN_ERR(svn_fs_fs__get_contents(&old_contents, fs, &old_rep_norm, + FALSE, scratch_pool)); + err = svn_stream_contents_same2(&same, contents, old_contents, + scratch_pool); + + /* A mismatch should be extremely rare. + * If it does happen, reject the commit. */ + if (!same || err) + { + /* SHA1 collision or worse. */ + svn_stringbuf_t *old_rep_str + = svn_fs_fs__unparse_representation(*old_rep, + ffd->format, FALSE, + scratch_pool, + scratch_pool); + svn_stringbuf_t *rep_str + = svn_fs_fs__unparse_representation(rep, + ffd->format, FALSE, + scratch_pool, + scratch_pool); + const char *checksum__str + = svn_checksum_to_cstring_display(&checksum, scratch_pool); + + return svn_error_createf(SVN_ERR_FS_GENERAL, + err, "SHA1 of reps '%s' and '%s' " + "matches (%s) but contents differ", + old_rep_str->data, rep_str->data, + checksum__str); + } + + /* Restore FILE's read / write position. */ + SVN_ERR(svn_io_file_seek(file, APR_SET, &old_position, scratch_pool)); + } + return SVN_NO_ERROR; } @@ -2293,8 +2367,8 @@ rep_write_contents_close(void *baton) /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, b->fs, rep, NULL, b->result_pool, - b->scratch_pool)); + SVN_ERR(get_shared_rep(&old_rep, b->fs, rep, b->file, b->rep_offset, NULL, + b->result_pool, b->scratch_pool)); if (old_rep) { @@ -2519,11 +2593,16 @@ write_directory_to_stream(svn_stream_t *stream, /* Write out the COLLECTION as a text representation to file FILE using WRITER. In the process, record position, the total size of the dump and MD5 as well as SHA1 in REP. Add the representation of type ITEM_TYPE to - the indexes if necessary. If rep sharing has been enabled and REPS_HASH - is not NULL, it will be used in addition to the on-disk cache to find - earlier reps with the same content. When such existing reps can be - found, we will truncate the one just written from the file and return - the existing rep. Perform temporary allocations in SCRATCH_POOL. */ + the indexes if necessary. + + If ALLOW_REP_SHARING is FALSE, rep-sharing will not be used, regardless + of any other option and rep-sharing settings. If rep sharing has been + enabled and REPS_HASH is not NULL, it will be used in addition to the + on-disk cache to find earlier reps with the same content. If such + existing reps can be found, we will truncate the one just written from + the file and return the existing rep. + + Perform temporary allocations in SCRATCH_POOL. */ static svn_error_t * write_container_rep(representation_t *rep, apr_file_t *file, @@ -2531,14 +2610,15 @@ write_container_rep(representation_t *rep, collection_writer_t writer, svn_fs_t *fs, apr_hash_t *reps_hash, + svn_boolean_t allow_rep_sharing, apr_uint32_t item_type, apr_pool_t *scratch_pool) { svn_stream_t *stream; struct write_container_baton *whb; svn_checksum_ctx_t *fnv1a_checksum_ctx; - representation_t *old_rep; apr_off_t offset = 0; + svn_fs_fs__p2l_entry_t entry; SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); @@ -2562,58 +2642,62 @@ write_container_rep(representation_t *rep, /* Store the results. */ SVN_ERR(digests_final(rep, whb->md5_ctx, whb->sha1_ctx, scratch_pool)); + /* Update size info. */ + rep->expanded_size = whb->size; + rep->size = whb->size; + /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, fs, rep, reps_hash, scratch_pool, - scratch_pool)); - - if (old_rep) + if (allow_rep_sharing) { - /* We need to erase from the protorev the data we just wrote. */ - SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + representation_t *old_rep; + SVN_ERR(get_shared_rep(&old_rep, fs, rep, file, offset, reps_hash, + scratch_pool, scratch_pool)); - /* Use the old rep for this content. */ - memcpy(rep, old_rep, sizeof (*rep)); + if (old_rep) + { + /* We need to erase from the protorev the data we just wrote. */ + SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + + /* Use the old rep for this content. */ + memcpy(rep, old_rep, sizeof (*rep)); + return SVN_NO_ERROR; + } } - else - { - svn_fs_fs__p2l_entry_t entry; - /* Write out our cosmetic end marker. */ - SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n")); + /* Write out our cosmetic end marker. */ + SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n")); - SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, - offset, scratch_pool)); + SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, + offset, scratch_pool)); - entry.offset = offset; - SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); - entry.size = offset - entry.offset; - entry.type = item_type; - entry.item.revision = SVN_INVALID_REVNUM; - entry.item.number = rep->item_index; - SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, - fnv1a_checksum_ctx, - scratch_pool)); + entry.offset = offset; + SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); + entry.size = offset - entry.offset; + entry.type = item_type; + entry.item.revision = SVN_INVALID_REVNUM; + entry.item.number = rep->item_index; + SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, + fnv1a_checksum_ctx, + scratch_pool)); - SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); + SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); - /* update the representation */ - rep->size = whb->size; - rep->expanded_size = whb->size; - } - return SVN_NO_ERROR; } /* Write out the COLLECTION pertaining to the NODEREV in FS as a deltified text representation to file FILE using WRITER. In the process, record the total size and the md5 digest in REP and add the representation of type - ITEM_TYPE to the indexes if necessary. If rep sharing has been enabled and - REPS_HASH is not NULL, it will be used in addition to the on-disk cache to - find earlier reps with the same content. When such existing reps can be - found, we will truncate the one just written from the file and return the - existing rep. + ITEM_TYPE to the indexes if necessary. + If ALLOW_REP_SHARING is FALSE, rep-sharing will not be used, regardless + of any other option and rep-sharing settings. If rep sharing has been + enabled and REPS_HASH is not NULL, it will be used in addition to the + on-disk cache to find earlier reps with the same content. If such + existing reps can be found, we will truncate the one just written from + the file and return the existing rep. + If ITEM_TYPE is IS_PROPS equals SVN_FS_FS__ITEM_TYPE_*_PROPS, assume that we want to a props representation as the base for our delta. Perform temporary allocations in SCRATCH_POOL. @@ -2626,6 +2710,7 @@ write_container_delta_rep(representation_t *rep, svn_fs_t *fs, node_revision_t *noderev, apr_hash_t *reps_hash, + svn_boolean_t allow_rep_sharing, apr_uint32_t item_type, apr_pool_t *scratch_pool) { @@ -2635,10 +2720,10 @@ write_container_delta_rep(representation_t *rep, svn_stream_t *file_stream; svn_stream_t *stream; representation_t *base_rep; - representation_t *old_rep; svn_checksum_ctx_t *fnv1a_checksum_ctx; svn_stream_t *source; svn_fs_fs__rep_header_t header = { 0 }; + svn_fs_fs__p2l_entry_t entry; apr_off_t rep_end = 0; apr_off_t delta_start = 0; @@ -2701,47 +2786,48 @@ write_container_delta_rep(representation_t *rep, /* Store the results. */ SVN_ERR(digests_final(rep, whb->md5_ctx, whb->sha1_ctx, scratch_pool)); + /* Update size info. */ + SVN_ERR(svn_fs_fs__get_file_offset(&rep_end, file, scratch_pool)); + rep->size = rep_end - delta_start; + rep->expanded_size = whb->size; + /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, fs, rep, reps_hash, scratch_pool, - scratch_pool)); - - if (old_rep) + if (allow_rep_sharing) { - /* We need to erase from the protorev the data we just wrote. */ - SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + representation_t *old_rep; + SVN_ERR(get_shared_rep(&old_rep, fs, rep, file, offset, reps_hash, + scratch_pool, scratch_pool)); - /* Use the old rep for this content. */ - memcpy(rep, old_rep, sizeof (*rep)); + if (old_rep) + { + /* We need to erase from the protorev the data we just wrote. */ + SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + + /* Use the old rep for this content. */ + memcpy(rep, old_rep, sizeof (*rep)); + return SVN_NO_ERROR; + } } - else - { - svn_fs_fs__p2l_entry_t entry; - /* Write out our cosmetic end marker. */ - SVN_ERR(svn_fs_fs__get_file_offset(&rep_end, file, scratch_pool)); - SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n")); + /* Write out our cosmetic end marker. */ + SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n")); - SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, - offset, scratch_pool)); + SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, + offset, scratch_pool)); - entry.offset = offset; - SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); - entry.size = offset - entry.offset; - entry.type = item_type; - entry.item.revision = SVN_INVALID_REVNUM; - entry.item.number = rep->item_index; - SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, - fnv1a_checksum_ctx, - scratch_pool)); + entry.offset = offset; + SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); + entry.size = offset - entry.offset; + entry.type = item_type; + entry.item.revision = SVN_INVALID_REVNUM; + entry.item.number = rep->item_index; + SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, + fnv1a_checksum_ctx, + scratch_pool)); - SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); + SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); - /* update the representation */ - rep->expanded_size = whb->size; - rep->size = rep_end - delta_start; - } - return SVN_NO_ERROR; } @@ -2920,13 +3006,14 @@ write_final_rev(const svn_fs_id_t **new_id_p, SVN_ERR(write_container_delta_rep(noderev->data_rep, file, entries, write_directory_to_stream, - fs, noderev, NULL, + fs, noderev, NULL, FALSE, SVN_FS_FS__ITEM_TYPE_DIR_REP, pool)); else SVN_ERR(write_container_rep(noderev->data_rep, file, entries, write_directory_to_stream, fs, NULL, - SVN_FS_FS__ITEM_TYPE_DIR_REP, pool)); + FALSE, SVN_FS_FS__ITEM_TYPE_DIR_REP, + pool)); reset_txn_in_rep(noderev->data_rep); } @@ -2971,11 +3058,11 @@ write_final_rev(const svn_fs_id_t **new_id_p, if (ffd->deltify_properties) SVN_ERR(write_container_delta_rep(noderev->prop_rep, file, proplist, write_hash_to_stream, fs, noderev, - reps_hash, item_type, pool)); + reps_hash, TRUE, item_type, pool)); else SVN_ERR(write_container_rep(noderev->prop_rep, file, proplist, write_hash_to_stream, fs, reps_hash, - item_type, pool)); + TRUE, item_type, pool)); reset_txn_in_rep(noderev->prop_rep); } Modified: head/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h Thu Aug 10 22:03:26 2017 (r322380) @@ -1,4 +1,4 @@ -/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.5/subversion/libsvn_fs_x/token-map.h. +/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.7/subversion/libsvn_fs_x/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_CREATE_SCHEMA 0 Modified: head/contrib/subversion/subversion/libsvn_ra_svn/client.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_ra_svn/client.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_ra_svn/client.c Thu Aug 10 22:03:26 2017 (r322380) @@ -46,6 +46,7 @@ #include "svn_props.h" #include "svn_mergeinfo.h" #include "svn_version.h" +#include "svn_ctype.h" #include "svn_private_config.h" @@ -396,7 +397,7 @@ static svn_error_t *find_tunnel_agent(const char *tunn * versions have it too. If the user is using some other ssh * implementation that doesn't accept it, they can override it * in the [tunnels] section of the config. */ - val = "$SVN_SSH ssh -q"; + val = "$SVN_SSH ssh -q --"; } if (!val || !*val) @@ -441,7 +442,7 @@ static svn_error_t *find_tunnel_agent(const char *tunn for (n = 0; cmd_argv[n] != NULL; n++) argv[n] = cmd_argv[n]; - argv[n++] = svn_path_uri_decode(hostinfo, pool); + argv[n++] = hostinfo; argv[n++] = "svnserve"; argv[n++] = "-t"; argv[n] = NULL; @@ -802,7 +803,33 @@ ra_svn_get_schemes(apr_pool_t *pool) } +/* A simple whitelist to ensure the following are valid: + * user@server + * [::1]:22 + * server-name + * server_name + * 127.0.0.1 + * with an extra restriction that a leading '-' is invalid. + */ +static svn_boolean_t +is_valid_hostinfo(const char *hostinfo) +{ + const char *p = hostinfo; + if (p[0] == '-') + return FALSE; + + while (*p) + { + if (!svn_ctype_isalnum(*p) && !strchr(":.-_[]@", *p)) + return FALSE; + + ++p; + } + + return TRUE; +} + static svn_error_t *ra_svn_open(svn_ra_session_t *session, const char **corrected_url, const char *url, @@ -835,8 +862,18 @@ static svn_error_t *ra_svn_open(svn_ra_session_t *sess || (callbacks->check_tunnel_func && callbacks->open_tunnel_func && !callbacks->check_tunnel_func(callbacks->tunnel_baton, tunnel)))) - SVN_ERR(find_tunnel_agent(tunnel, uri.hostinfo, &tunnel_argv, config, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Aug 10 22:43:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6B44C0886F; Thu, 10 Aug 2017 22:43:39 +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 mx1.freebsd.org (Postfix) with ESMTPS id B5FE0744B9; Thu, 10 Aug 2017 22:43:39 +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 v7AMhcYJ038266; Thu, 10 Aug 2017 22:43:38 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AMhcoN038265; Thu, 10 Aug 2017 22:43:38 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708102243.v7AMhcoN038265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 10 Aug 2017 22:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322383 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 322383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 22:43:40 -0000 Author: markj Date: Thu Aug 10 22:43:38 2017 New Revision: 322383 URL: https://svnweb.freebsd.org/changeset/base/322383 Log: Make vm_page_sunbusy() assert that the page is unlocked. Reviewed by: kib MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11946 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Aug 10 22:15:42 2017 (r322382) +++ head/sys/vm/vm_page.c Thu Aug 10 22:43:38 2017 (r322383) @@ -757,6 +757,7 @@ vm_page_sunbusy(vm_page_t m) { u_int x; + vm_page_lock_assert(m, MA_NOTOWNED); vm_page_assert_sbusied(m); for (;;) { From owner-svn-src-head@freebsd.org Fri Aug 11 00:00:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D60E7C7A980; Fri, 11 Aug 2017 00:00:02 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9007B76ADD; Fri, 11 Aug 2017 00:00:02 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7B001ia067107; Fri, 11 Aug 2017 00:00:01 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B001kI067102; Fri, 11 Aug 2017 00:00:01 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201708110000.v7B001kI067102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Fri, 11 Aug 2017 00:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322386 - in head/contrib/sqlite3: . tea tea/generic X-SVN-Group: head X-SVN-Commit-Author: peter X-SVN-Commit-Paths: in head/contrib/sqlite3: . tea tea/generic X-SVN-Commit-Revision: 322386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 00:00:03 -0000 Author: peter Date: Fri Aug 11 00:00:01 2017 New Revision: 322386 URL: https://svnweb.freebsd.org/changeset/base/322386 Log: Update from sqlite3-3.14.1 to sqlite3-3.20.0. This is a private lib. This fixes a possible client-side crash when parsing corrupt databases. Modified: head/contrib/sqlite3/Makefile.msc head/contrib/sqlite3/configure head/contrib/sqlite3/configure.ac head/contrib/sqlite3/shell.c head/contrib/sqlite3/sqlite3.c head/contrib/sqlite3/sqlite3.h head/contrib/sqlite3/sqlite3ext.h head/contrib/sqlite3/tea/configure head/contrib/sqlite3/tea/configure.ac head/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: head/contrib/sqlite3/ (props changed) Modified: head/contrib/sqlite3/Makefile.msc ============================================================================== --- head/contrib/sqlite3/Makefile.msc Thu Aug 10 23:45:32 2017 (r322385) +++ head/contrib/sqlite3/Makefile.msc Fri Aug 11 00:00:01 2017 (r322386) @@ -21,9 +21,16 @@ TOP = . # Set this non-0 to enable full warnings (-W4, etc) when compiling. # !IFNDEF USE_FULLWARN -USE_FULLWARN = 0 +USE_FULLWARN = 1 !ENDIF +# Set this non-0 to enable treating warnings as errors (-WX, etc) when +# compiling. +# +!IFNDEF USE_FATAL_WARN +USE_FATAL_WARN = 0 +!ENDIF + # Set this non-0 to enable full runtime error checks (-RTC1, etc). This # has no effect if (any) optimizations are enabled. # @@ -31,6 +38,13 @@ USE_FULLWARN = 0 USE_RUNTIME_CHECKS = 0 !ENDIF +# Set this non-0 to create a SQLite amalgamation file that excludes the +# various built-in extensions. +# +!IFNDEF MINIMAL_AMALGAMATION +MINIMAL_AMALGAMATION = 0 +!ENDIF + # Set this non-0 to use "stdcall" calling convention for the core library # and shell executable. # @@ -255,12 +269,15 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb !ENDIF !ENDIF + # These are the "standard" SQLite compilation options used when compiling for # the Windows platform. # !IFNDEF OPT_FEATURE_FLAGS +!IF $(MINIMAL_AMALGAMATION)==0 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 +!ENDIF OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1 !ENDIF @@ -444,6 +461,12 @@ TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $ TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS) !ENDIF +# Check if warnings should be treated as errors when compiling. +# +!IF $(USE_FATAL_WARN)!=0 +TCC = $(TCC) -WX +!ENDIF + TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS) @@ -622,7 +645,11 @@ RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1 !IF $(DEBUG)>2 TCC = $(TCC) -DSQLITE_DEBUG=1 RCC = $(RCC) -DSQLITE_DEBUG=1 +!IF $(DYNAMIC_SHELL)==0 +TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE +RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE !ENDIF +!ENDIF !IF $(DEBUG)>4 || $(OSTRACE)!=0 TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1 @@ -900,7 +927,7 @@ LIBRESOBJS = # when the shell is not being dynamically linked. # !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0 -SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_STMTVTAB !ENDIF @@ -927,7 +954,7 @@ Replace.exe: sqlite3.def: Replace.exe $(LIBOBJ) echo EXPORTS > sqlite3.def dumpbin /all $(LIBOBJ) \ - | .\Replace.exe "^\s+/EXPORT:_?(sqlite3_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \ + | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \ | sort >> sqlite3.def $(SQLITE3EXE): $(TOP)\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H) Modified: head/contrib/sqlite3/configure ============================================================================== --- head/contrib/sqlite3/configure Thu Aug 10 23:45:32 2017 (r322385) +++ head/contrib/sqlite3/configure Fri Aug 11 00:00:01 2017 (r322386) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.14.1. +# Generated by GNU Autoconf 2.69 for sqlite 3.20.0. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.14.1' -PACKAGE_STRING='sqlite 3.14.1' +PACKAGE_VERSION='3.20.0' +PACKAGE_STRING='sqlite 3.20.0' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1330,7 +1330,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.14.1 to adapt to many kinds of systems. +\`configure' configures sqlite 3.20.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1400,7 +1400,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.14.1:";; + short | recursive ) echo "Configuration of sqlite 3.20.0:";; esac cat <<\_ACEOF @@ -1521,7 +1521,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.14.1 +sqlite configure 3.20.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1936,7 +1936,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.14.1, which was +It was created by sqlite $as_me 3.20.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2802,7 +2802,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.14.1' + VERSION='3.20.0' cat >>confdefs.h <<_ACEOF @@ -13108,7 +13108,7 @@ for ac_lib in '' edit; do ac_res="none required" else ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + LIBS="-l$ac_lib -ltinfo $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_readline=$ac_res @@ -13136,7 +13136,7 @@ if test "$ac_res" != no; then : $as_echo "#define HAVE_EDITLINE 1" >>confdefs.h - READLINE_LIBS=$LIBS + READLINE_LIBS="$LIBS -ltinfo" enable_readline=no fi @@ -14227,7 +14227,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.14.1, which was +This file was extended by sqlite $as_me 3.20.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14284,7 +14284,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.14.1 +sqlite config.status 3.20.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/sqlite3/configure.ac ============================================================================== --- head/contrib/sqlite3/configure.ac Thu Aug 10 23:45:32 2017 (r322385) +++ head/contrib/sqlite3/configure.ac Fri Aug 11 00:00:01 2017 (r322386) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.14.1, http://www.sqlite.org) +AC_INIT(sqlite, 3.20.0, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) # Use automake. @@ -55,9 +55,9 @@ AS_IF([ test x"$enable_editline" != xno ],[ LIBS="" AC_SEARCH_LIBS([readline],[edit],[ AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline) - READLINE_LIBS=$LIBS + READLINE_LIBS="$LIBS -ltinfo" enable_readline=no - ]) + ],[],[-ltinfo]) AS_UNSET(ac_cv_search_readline) LIBS=$sLIBS ]) Modified: head/contrib/sqlite3/shell.c ============================================================================== --- head/contrib/sqlite3/shell.c Thu Aug 10 23:45:32 2017 (r322385) +++ head/contrib/sqlite3/shell.c Fri Aug 11 00:00:01 2017 (r322386) @@ -1,3 +1,21 @@ +/* DO NOT EDIT! +** This file is automatically generated by the script in the canonical +** SQLite source tree at tool/mkshellc.tcl. That script combines source +** code from various constituent source files of SQLite into this single +** "shell.c" file used to implement the SQLite command-line shell. +** +** Most of the code found below comes from the "src/shell.c.in" file in +** the canonical SQLite source tree. That main file contains "INCLUDE" +** lines that specify other files in the canonical source tree that are +** inserted to getnerate this complete program source file. +** +** The code from multiple files is combined into this single "shell.c" +** source file to help make the command-line program easier to compile. +** +** To modify this program, get a copy of the canonical SQLite source tree, +** edit the src/shell.c.in" and/or some of the other files that are included +** by "src/shell.c.in", then rerun the tool/mkshellc.tcl script. +*/ /* ** 2001 September 15 ** @@ -18,11 +36,25 @@ #endif /* -** If requested, include the SQLite compiler options file for MSVC. +** Warning pragmas copied from msvc.h in the core. */ -#if defined(INCLUDE_MSVC_H) -#include "msvc.h" -#endif +#if defined(_MSC_VER) +#pragma warning(disable : 4054) +#pragma warning(disable : 4055) +#pragma warning(disable : 4100) +#pragma warning(disable : 4127) +#pragma warning(disable : 4130) +#pragma warning(disable : 4152) +#pragma warning(disable : 4189) +#pragma warning(disable : 4206) +#pragma warning(disable : 4210) +#pragma warning(disable : 4232) +#pragma warning(disable : 4244) +#pragma warning(disable : 4305) +#pragma warning(disable : 4306) +#pragma warning(disable : 4702) +#pragma warning(disable : 4706) +#endif /* defined(_MSC_VER) */ /* ** No support for loadable extensions in VxWorks. @@ -143,6 +175,7 @@ extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR); extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int); extern char *sqlite3_win32_utf8_to_mbcs_v2(const char *, int); +extern LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText); #endif /* On Windows, we normally run with output mode of TEXT so that \n characters @@ -426,7 +459,37 @@ static void SQLITE_CDECL iotracePrintf(const char *zFo } #endif +/* +** Output string zUtf to stream pOut as w characters. If w is negative, +** then right-justify the text. W is the width in UTF-8 characters, not +** in bytes. This is different from the %*.*s specification in printf +** since with %*.*s the width is measured in bytes, not characters. +*/ +static void utf8_width_print(FILE *pOut, int w, const char *zUtf){ + int i; + int n; + int aw = w<0 ? -w : w; + char zBuf[1000]; + if( aw>(int)sizeof(zBuf)/3 ) aw = (int)sizeof(zBuf)/3; + for(i=n=0; zUtf[i]; i++){ + if( (zUtf[i]&0xc0)!=0x80 ){ + n++; + if( n==aw ){ + do{ i++; }while( (zUtf[i]&0xc0)==0x80 ); + break; + } + } + } + if( n>=aw ){ + utf8_printf(pOut, "%.*s", i, zUtf); + }else if( w<0 ){ + utf8_printf(pOut, "%*s%s", aw-n, "", zUtf); + }else{ + utf8_printf(pOut, "%s%*s", zUtf, aw-n, ""); + } +} + /* ** Determines if a string is a number of not. */ @@ -455,28 +518,6 @@ static int isNumber(const char *z, int *realnum){ } /* -** A global char* and an SQL function to access its current value -** from within an SQL statement. This program used to use the -** sqlite_exec_printf() API to substitue a string into an SQL statement. -** The correct way to do this with sqlite3 is to use the bind API, but -** since the shell is built around the callback paradigm it would be a lot -** of work. Instead just use this hack, which is quite harmless. -*/ -static const char *zShellStatic = 0; -static void shellstaticFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - assert( 0==argc ); - assert( zShellStatic ); - UNUSED_PARAMETER(argc); - UNUSED_PARAMETER(argv); - sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC); -} - - -/* ** Compute a string length that is limited to what can be stored in ** lower 30 bits of a 32-bit signed integer. */ @@ -487,6 +528,18 @@ static int strlen30(const char *z){ } /* +** Return the length of a string in characters. Multibyte UTF8 characters +** count as a single character. +*/ +static int strlenChar(const char *z){ + int n = 0; + while( *z ){ + if( (0xc0&*(z++))!=0x80 ) n++; + } + return n; +} + +/* ** This routine reads a line of text from FILE in, stores ** the text in memory obtained from malloc() and returns a pointer ** to the text. NULL is returned at end of file, or if malloc() @@ -524,7 +577,7 @@ static char *local_getline(char *zLine, FILE *in){ #if defined(_WIN32) || defined(WIN32) /* For interactive input on Windows systems, translate the ** multi-byte characterset characters into UTF-8. */ - if( stdin_is_interactive ){ + if( stdin_is_interactive && in==stdin ){ char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0); if( zTrans ){ int nTrans = strlen30(zTrans)+1; @@ -576,7 +629,1534 @@ static char *one_input_line(FILE *in, char *zPrior, in } return zResult; } +/* +** A variable length string to which one can append text. +*/ +typedef struct ShellText ShellText; +struct ShellText { + char *z; + int n; + int nAlloc; +}; +/* +** Initialize and destroy a ShellText object +*/ +static void initText(ShellText *p){ + memset(p, 0, sizeof(*p)); +} +static void freeText(ShellText *p){ + free(p->z); + initText(p); +} + +/* zIn is either a pointer to a NULL-terminated string in memory obtained +** from malloc(), or a NULL pointer. The string pointed to by zAppend is +** added to zIn, and the result returned in memory obtained from malloc(). +** zIn, if it was not NULL, is freed. +** +** If the third argument, quote, is not '\0', then it is used as a +** quote character for zAppend. +*/ +static void appendText(ShellText *p, char const *zAppend, char quote){ + int len; + int i; + int nAppend = strlen30(zAppend); + + len = nAppend+p->n+1; + if( quote ){ + len += 2; + for(i=0; in+len>=p->nAlloc ){ + p->nAlloc = p->nAlloc*2 + len + 20; + p->z = realloc(p->z, p->nAlloc); + if( p->z==0 ){ + memset(p, 0, sizeof(*p)); + return; + } + } + + if( quote ){ + char *zCsr = p->z+p->n; + *zCsr++ = quote; + for(i=0; in = (int)(zCsr - p->z); + *zCsr = '\0'; + }else{ + memcpy(p->z+p->n, zAppend, nAppend); + p->n += nAppend; + p->z[p->n] = '\0'; + } +} + +/* +** Attempt to determine if identifier zName needs to be quoted, either +** because it contains non-alphanumeric characters, or because it is an +** SQLite keyword. Be conservative in this estimate: When in doubt assume +** that quoting is required. +** +** Return '"' if quoting is required. Return 0 if no quoting is required. +*/ +static char quoteChar(const char *zName){ + /* All SQLite keywords, in alphabetical order */ + static const char *azKeywords[] = { + "ABORT", "ACTION", "ADD", "AFTER", "ALL", "ALTER", "ANALYZE", "AND", "AS", + "ASC", "ATTACH", "AUTOINCREMENT", "BEFORE", "BEGIN", "BETWEEN", "BY", + "CASCADE", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "COMMIT", + "CONFLICT", "CONSTRAINT", "CREATE", "CROSS", "CURRENT_DATE", + "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATABASE", "DEFAULT", "DEFERRABLE", + "DEFERRED", "DELETE", "DESC", "DETACH", "DISTINCT", "DROP", "EACH", + "ELSE", "END", "ESCAPE", "EXCEPT", "EXCLUSIVE", "EXISTS", "EXPLAIN", + "FAIL", "FOR", "FOREIGN", "FROM", "FULL", "GLOB", "GROUP", "HAVING", "IF", + "IGNORE", "IMMEDIATE", "IN", "INDEX", "INDEXED", "INITIALLY", "INNER", + "INSERT", "INSTEAD", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY", + "LEFT", "LIKE", "LIMIT", "MATCH", "NATURAL", "NO", "NOT", "NOTNULL", + "NULL", "OF", "OFFSET", "ON", "OR", "ORDER", "OUTER", "PLAN", "PRAGMA", + "PRIMARY", "QUERY", "RAISE", "RECURSIVE", "REFERENCES", "REGEXP", + "REINDEX", "RELEASE", "RENAME", "REPLACE", "RESTRICT", "RIGHT", + "ROLLBACK", "ROW", "SAVEPOINT", "SELECT", "SET", "TABLE", "TEMP", + "TEMPORARY", "THEN", "TO", "TRANSACTION", "TRIGGER", "UNION", "UNIQUE", + "UPDATE", "USING", "VACUUM", "VALUES", "VIEW", "VIRTUAL", "WHEN", "WHERE", + "WITH", "WITHOUT", + }; + int i, lwr, upr, mid, c; + if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"'; + for(i=0; zName[i]; i++){ + if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"'; + } + lwr = 0; + upr = sizeof(azKeywords)/sizeof(azKeywords[0]) - 1; + while( lwr<=upr ){ + mid = (lwr+upr)/2; + c = sqlite3_stricmp(azKeywords[mid], zName); + if( c==0 ) return '"'; + if( c<0 ){ + lwr = mid+1; + }else{ + upr = mid-1; + } + } + return 0; +} + +/* +** SQL function: shell_add_schema(S,X) +** +** Add the schema name X to the CREATE statement in S and return the result. +** Examples: +** +** CREATE TABLE t1(x) -> CREATE TABLE xyz.t1(x); +** +** Also works on +** +** CREATE INDEX +** CREATE UNIQUE INDEX +** CREATE VIEW +** CREATE TRIGGER +** CREATE VIRTUAL TABLE +** +** This UDF is used by the .schema command to insert the schema name of +** attached databases into the middle of the sqlite_master.sql field. +*/ +static void shellAddSchemaName( + sqlite3_context *pCtx, + int nVal, + sqlite3_value **apVal +){ + static const char *aPrefix[] = { + "TABLE", + "INDEX", + "UNIQUE INDEX", + "VIEW", + "TRIGGER", + "VIRTUAL TABLE" + }; + int i = 0; + const char *zIn = (const char*)sqlite3_value_text(apVal[0]); + const char *zSchema = (const char*)sqlite3_value_text(apVal[1]); + assert( nVal==2 ); + if( zIn!=0 && strncmp(zIn, "CREATE ", 7)==0 ){ + for(i=0; i<(int)(sizeof(aPrefix)/sizeof(aPrefix[0])); i++){ + int n = strlen30(aPrefix[i]); + if( strncmp(zIn+7, aPrefix[i], n)==0 && zIn[n+7]==' ' ){ + char cQuote = quoteChar(zSchema); + char *z; + if( cQuote ){ + z = sqlite3_mprintf("%.*s \"%w\".%s", n+7, zIn, zSchema, zIn+n+8); + }else{ + z = sqlite3_mprintf("%.*s %s.%s", n+7, zIn, zSchema, zIn+n+8); + } + sqlite3_result_text(pCtx, z, -1, sqlite3_free); + return; + } + } + } + sqlite3_result_value(pCtx, apVal[0]); +} + +/* +** The source code for several run-time loadable extensions is inserted +** below by the ../tool/mkshellc.tcl script. Before processing that included +** code, we need to override some macros to make the included program code +** work here in the middle of this regular program. +*/ +#define SQLITE_EXTENSION_INIT1 +#define SQLITE_EXTENSION_INIT2(X) (void)(X) + +/************************* Begin ../ext/misc/shathree.c ******************/ +/* +** 2017-03-08 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This SQLite extension implements a functions that compute SHA1 hashes. +** Two SQL functions are implemented: +** +** sha3(X,SIZE) +** sha3_query(Y,SIZE) +** +** The sha3(X) function computes the SHA3 hash of the input X, or NULL if +** X is NULL. +** +** The sha3_query(Y) function evalutes all queries in the SQL statements of Y +** and returns a hash of their results. +** +** The SIZE argument is optional. If omitted, the SHA3-256 hash algorithm +** is used. If SIZE is included it must be one of the integers 224, 256, +** 384, or 512, to determine SHA3 hash variant that is computed. +*/ +SQLITE_EXTENSION_INIT1 +#include +#include +#include +typedef sqlite3_uint64 u64; + +/****************************************************************************** +** The Hash Engine +*/ +/* +** Macros to determine whether the machine is big or little endian, +** and whether or not that determination is run-time or compile-time. +** +** For best performance, an attempt is made to guess at the byte-order +** using C-preprocessor macros. If that is unsuccessful, or if +** -DSHA3_BYTEORDER=0 is set, then byte-order is determined +** at run-time. +*/ +#ifndef SHA3_BYTEORDER +# if defined(i386) || defined(__i386__) || defined(_M_IX86) || \ + defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \ + defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \ + defined(__arm__) +# define SHA3_BYTEORDER 1234 +# elif defined(sparc) || defined(__ppc__) +# define SHA3_BYTEORDER 4321 +# else +# define SHA3_BYTEORDER 0 +# endif +#endif + + +/* +** State structure for a SHA3 hash in progress +*/ +typedef struct SHA3Context SHA3Context; +struct SHA3Context { + union { + u64 s[25]; /* Keccak state. 5x5 lines of 64 bits each */ + unsigned char x[1600]; /* ... or 1600 bytes */ + } u; + unsigned nRate; /* Bytes of input accepted per Keccak iteration */ + unsigned nLoaded; /* Input bytes loaded into u.x[] so far this cycle */ + unsigned ixMask; /* Insert next input into u.x[nLoaded^ixMask]. */ +}; + +/* +** A single step of the Keccak mixing function for a 1600-bit state +*/ +static void KeccakF1600Step(SHA3Context *p){ + int i; + u64 B0, B1, B2, B3, B4; + u64 C0, C1, C2, C3, C4; + u64 D0, D1, D2, D3, D4; + static const u64 RC[] = { + 0x0000000000000001ULL, 0x0000000000008082ULL, + 0x800000000000808aULL, 0x8000000080008000ULL, + 0x000000000000808bULL, 0x0000000080000001ULL, + 0x8000000080008081ULL, 0x8000000000008009ULL, + 0x000000000000008aULL, 0x0000000000000088ULL, + 0x0000000080008009ULL, 0x000000008000000aULL, + 0x000000008000808bULL, 0x800000000000008bULL, + 0x8000000000008089ULL, 0x8000000000008003ULL, + 0x8000000000008002ULL, 0x8000000000000080ULL, + 0x000000000000800aULL, 0x800000008000000aULL, + 0x8000000080008081ULL, 0x8000000000008080ULL, + 0x0000000080000001ULL, 0x8000000080008008ULL + }; +# define A00 (p->u.s[0]) +# define A01 (p->u.s[1]) +# define A02 (p->u.s[2]) +# define A03 (p->u.s[3]) +# define A04 (p->u.s[4]) +# define A10 (p->u.s[5]) +# define A11 (p->u.s[6]) +# define A12 (p->u.s[7]) +# define A13 (p->u.s[8]) +# define A14 (p->u.s[9]) +# define A20 (p->u.s[10]) +# define A21 (p->u.s[11]) +# define A22 (p->u.s[12]) +# define A23 (p->u.s[13]) +# define A24 (p->u.s[14]) +# define A30 (p->u.s[15]) +# define A31 (p->u.s[16]) +# define A32 (p->u.s[17]) +# define A33 (p->u.s[18]) +# define A34 (p->u.s[19]) +# define A40 (p->u.s[20]) +# define A41 (p->u.s[21]) +# define A42 (p->u.s[22]) +# define A43 (p->u.s[23]) +# define A44 (p->u.s[24]) +# define ROL64(a,x) ((a<>(64-x))) + + for(i=0; i<24; i+=4){ + C0 = A00^A10^A20^A30^A40; + C1 = A01^A11^A21^A31^A41; + C2 = A02^A12^A22^A32^A42; + C3 = A03^A13^A23^A33^A43; + C4 = A04^A14^A24^A34^A44; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A11^D1), 44); + B2 = ROL64((A22^D2), 43); + B3 = ROL64((A33^D3), 21); + B4 = ROL64((A44^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i]; + A11 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A20^D0), 3); + B3 = ROL64((A31^D1), 45); + B4 = ROL64((A42^D2), 61); + B0 = ROL64((A03^D3), 28); + B1 = ROL64((A14^D4), 20); + A20 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A40^D0), 18); + B0 = ROL64((A01^D1), 1); + B1 = ROL64((A12^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A34^D4), 8); + A40 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A10^D0), 36); + B2 = ROL64((A21^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A43^D3), 56); + B0 = ROL64((A04^D4), 27); + A10 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A30^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A02^D2), 62); + B1 = ROL64((A13^D3), 55); + B2 = ROL64((A24^D4), 39); + A30 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + C0 = A00^A20^A40^A10^A30; + C1 = A11^A31^A01^A21^A41; + C2 = A22^A42^A12^A32^A02; + C3 = A33^A03^A23^A43^A13; + C4 = A44^A14^A34^A04^A24; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A31^D1), 44); + B2 = ROL64((A12^D2), 43); + B3 = ROL64((A43^D3), 21); + B4 = ROL64((A24^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+1]; + A31 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A40^D0), 3); + B3 = ROL64((A21^D1), 45); + B4 = ROL64((A02^D2), 61); + B0 = ROL64((A33^D3), 28); + B1 = ROL64((A14^D4), 20); + A40 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A30^D0), 18); + B0 = ROL64((A11^D1), 1); + B1 = ROL64((A42^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A04^D4), 8); + A30 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A20^D0), 36); + B2 = ROL64((A01^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A13^D3), 56); + B0 = ROL64((A44^D4), 27); + A20 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A10^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A22^D2), 62); + B1 = ROL64((A03^D3), 55); + B2 = ROL64((A34^D4), 39); + A10 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + C0 = A00^A40^A30^A20^A10; + C1 = A31^A21^A11^A01^A41; + C2 = A12^A02^A42^A32^A22; + C3 = A43^A33^A23^A13^A03; + C4 = A24^A14^A04^A44^A34; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A21^D1), 44); + B2 = ROL64((A42^D2), 43); + B3 = ROL64((A13^D3), 21); + B4 = ROL64((A34^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+2]; + A21 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A30^D0), 3); + B3 = ROL64((A01^D1), 45); + B4 = ROL64((A22^D2), 61); + B0 = ROL64((A43^D3), 28); + B1 = ROL64((A14^D4), 20); + A30 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A10^D0), 18); + B0 = ROL64((A31^D1), 1); + B1 = ROL64((A02^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A44^D4), 8); + A10 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A40^D0), 36); + B2 = ROL64((A11^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A03^D3), 56); + B0 = ROL64((A24^D4), 27); + A40 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A20^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A12^D2), 62); + B1 = ROL64((A33^D3), 55); + B2 = ROL64((A04^D4), 39); + A20 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + C0 = A00^A30^A10^A40^A20; + C1 = A21^A01^A31^A11^A41; + C2 = A42^A22^A02^A32^A12; + C3 = A13^A43^A23^A03^A33; + C4 = A34^A14^A44^A24^A04; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A01^D1), 44); + B2 = ROL64((A02^D2), 43); + B3 = ROL64((A03^D3), 21); + B4 = ROL64((A04^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+3]; + A01 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A10^D0), 3); + B3 = ROL64((A11^D1), 45); + B4 = ROL64((A12^D2), 61); + B0 = ROL64((A13^D3), 28); + B1 = ROL64((A14^D4), 20); + A10 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A20^D0), 18); + B0 = ROL64((A21^D1), 1); + B1 = ROL64((A22^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A24^D4), 8); + A20 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A30^D0), 36); + B2 = ROL64((A31^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A33^D3), 56); + B0 = ROL64((A34^D4), 27); + A30 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A40^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A42^D2), 62); + B1 = ROL64((A43^D3), 55); + B2 = ROL64((A44^D4), 39); + A40 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + } +} + +/* +** Initialize a new hash. iSize determines the size of the hash +** in bits and should be one of 224, 256, 384, or 512. Or iSize +** can be zero to use the default hash size of 256 bits. +*/ +static void SHA3Init(SHA3Context *p, int iSize){ + memset(p, 0, sizeof(*p)); + if( iSize>=128 && iSize<=512 ){ + p->nRate = (1600 - ((iSize + 31)&~31)*2)/8; + }else{ + p->nRate = (1600 - 2*256)/8; + } +#if SHA3_BYTEORDER==1234 + /* Known to be little-endian at compile-time. No-op */ +#elif SHA3_BYTEORDER==4321 + p->ixMask = 7; /* Big-endian */ +#else + { + static unsigned int one = 1; + if( 1==*(unsigned char*)&one ){ + /* Little endian. No byte swapping. */ + p->ixMask = 0; + }else{ + /* Big endian. Byte swap. */ + p->ixMask = 7; + } + } +#endif +} + +/* +** Make consecutive calls to the SHA3Update function to add new content +** to the hash +*/ +static void SHA3Update( + SHA3Context *p, + const unsigned char *aData, + unsigned int nData +){ + unsigned int i = 0; +#if SHA3_BYTEORDER==1234 + if( (p->nLoaded % 8)==0 && ((aData - (const unsigned char*)0)&7)==0 ){ + for(; i+7u.s[p->nLoaded/8] ^= *(u64*)&aData[i]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Aug 11 03:09:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08E75D7D0C7; Fri, 11 Aug 2017 03:09:13 +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 mx1.freebsd.org (Postfix) with ESMTPS id CA76881623; Fri, 11 Aug 2017 03:09:12 +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 v7B39C8i044251; Fri, 11 Aug 2017 03:09:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B39C7d044250; Fri, 11 Aug 2017 03:09:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708110309.v7B39C7d044250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Aug 2017 03:09:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322391 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 322391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 03:09:13 -0000 Author: markj Date: Fri Aug 11 03:09:11 2017 New Revision: 322391 URL: https://svnweb.freebsd.org/changeset/base/322391 Log: Micro-optimize kmem_unback(). We can remove some unnecessary object radix tree lookups by using the object memq to iterate over pages in the specified range. This does not, however, eliminate the lookup needed in vm_page_free_toq() to remove each tree entry. Reviewed by: alc, kib (previous revision) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11945 Modified: head/sys/vm/vm_kern.c Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Fri Aug 11 00:43:50 2017 (r322390) +++ head/sys/vm/vm_kern.c Fri Aug 11 03:09:11 2017 (r322391) @@ -386,17 +386,19 @@ retry: void kmem_unback(vm_object_t object, vm_offset_t addr, vm_size_t size) { - vm_page_t m; - vm_offset_t i, offset; + vm_page_t m, next; + vm_offset_t end, offset; KASSERT(object == kmem_object || object == kernel_object, ("kmem_unback: only supports kernel objects.")); pmap_remove(kernel_pmap, addr, addr + size); offset = addr - VM_MIN_KERNEL_ADDRESS; + end = offset + size; VM_OBJECT_WLOCK(object); - for (i = 0; i < size; i += PAGE_SIZE) { - m = vm_page_lookup(object, atop(offset + i)); + for (m = vm_page_lookup(object, atop(offset)); offset < end; + offset += PAGE_SIZE, m = next) { + next = vm_page_next(m); vm_page_unwire(m, PQ_NONE); vm_page_free(m); } From owner-svn-src-head@freebsd.org Fri Aug 11 03:21:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 875AFD7DED8; Fri, 11 Aug 2017 03:21:41 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A77E81D92; Fri, 11 Aug 2017 03:21:40 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id g0VvdLIZNI8mCg0Vwddjuc; Thu, 10 Aug 2017 21:21:33 -0600 X-Authority-Analysis: v=2.2 cv=HahkdmM8 c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=KeKAF7QvOSUA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=xLBErZT-l1r7BnHmJr8A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 5427C8B1; Thu, 10 Aug 2017 20:21:31 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v7B3KGAb026027; Thu, 10 Aug 2017 20:20:16 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201708110320.v7B3KGAb026027@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Peter Wemm cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322380 - in head/contrib/subversion: . subversion/include subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_svn subversion/libsvn_repos subve... In-Reply-To: Message from Peter Wemm of "Thu, 10 Aug 2017 22:03:26 -0000." <201708102203.v7AM3QJ7022058@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 10 Aug 2017 20:20:16 -0700 X-CMAE-Envelope: MS4wfCme+HKjTRjtFzmn5e+JCooyDMfl7l5APJc5bP8gesqn22A/cCslyim7Efg3fkGLdsI/gYkemxtLR8OOeKZo/842Qn/X1Y2obo2g+OB6pmG/0egQJA43 pTmhOtE96jckb+6LXscdTAbLE5g8Q8mXTZJahgpfKk3MWIZPsH0WbTZ45k/5pxXTxk26VMkJcaOJIdugeiBvq4fEIgMmDK1YFyH25iE+bzF6fdPqyAot8p6l Qg+mgzl3pX7XgfATK/kFLE2B+0dkQY7cKFY13uTkRlAfBHTumDw3oZROPh6QqPwv X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 03:21:41 -0000 In message <201708102203.v7AM3QJ7022058@repo.freebsd.org>, Peter Wemm writes: > Author: peter > Date: Thu Aug 10 22:03:26 2017 > New Revision: 322380 > URL: https://svnweb.freebsd.org/changeset/base/322380 > > Log: > Update subversion 1.9.5 -> 1.9.7 Cool. Thanks. I'll submit a PR or phab diff for the port... Currently build/run testing here. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Fri Aug 11 03:59:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EA10D928F6; Fri, 11 Aug 2017 03:59:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id 18D6B8316C; Fri, 11 Aug 2017 03:59:50 +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 v7B3xnsq064491; Fri, 11 Aug 2017 03:59:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B3xnl4064488; Fri, 11 Aug 2017 03:59:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708110359.v7B3xnl4064488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Aug 2017 03:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322392 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 322392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 03:59:50 -0000 Author: markj Date: Fri Aug 11 03:59:48 2017 New Revision: 322392 URL: https://svnweb.freebsd.org/changeset/base/322392 Log: Add a specialized function for DRM drivers to register themselves. Such drivers attach to a vgapci bus rather than directly to a pci bus. For the rest of the LinuxKPI to work correctly in this case, we override the vgapci bus' ivars with those of the grandparent. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11932 Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Fri Aug 11 03:09:11 2017 (r322391) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Fri Aug 11 03:59:48 2017 (r322392) @@ -187,8 +187,14 @@ struct pci_driver { devclass_t bsdclass; struct device_driver driver; const struct pci_error_handlers *err_handler; + bool isdrm; }; +struct pci_bus { + struct pci_dev *self; + int number; +}; + extern struct list_head pci_drivers; extern struct list_head pci_devices; extern spinlock_t pci_lock; @@ -199,6 +205,7 @@ struct pci_dev { struct device dev; struct list_head links; struct pci_driver *pdrv; + struct pci_bus *bus; uint64_t dma_mask; uint16_t device; uint16_t vendor; @@ -502,8 +509,12 @@ pci_write_config_dword(struct pci_dev *pdev, int where return (0); } -extern int pci_register_driver(struct pci_driver *pdrv); -extern void pci_unregister_driver(struct pci_driver *pdrv); +int linux_pci_register_driver(struct pci_driver *pdrv); +int linux_pci_register_drm_driver(struct pci_driver *pdrv); +void linux_pci_unregister_driver(struct pci_driver *pdrv); + +#define pci_register_driver(pdrv) linux_pci_register_driver(pdrv) +#define pci_unregister_driver(pdrv) linux_pci_unregister_driver(pdrv) struct msix_entry { int entry; Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Fri Aug 11 03:09:11 2017 (r322391) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Fri Aug 11 03:59:48 2017 (r322392) @@ -118,17 +118,29 @@ static int linux_pci_attach(device_t dev) { struct resource_list_entry *rle; + struct pci_bus *pbus; struct pci_dev *pdev; struct pci_devinfo *dinfo; struct pci_driver *pdrv; const struct pci_device_id *id; + device_t parent; + devclass_t devclass; int error; - dinfo = device_get_ivars(dev); - linux_set_current(curthread); + pdrv = linux_pci_find(dev, &id); pdev = device_get_softc(dev); + + parent = device_get_parent(dev); + devclass = device_get_devclass(parent); + if (pdrv->isdrm) { + dinfo = device_get_ivars(parent); + device_set_ivars(dev, dinfo); + } else { + dinfo = device_get_ivars(dev); + } + pdev->dev.parent = &linux_root_device; pdev->dev.bsddev = dev; INIT_LIST_HEAD(&pdev->dev.irqents); @@ -151,6 +163,13 @@ linux_pci_attach(device_t dev) else pdev->dev.irq = LINUX_IRQ_INVALID; pdev->irq = pdev->dev.irq; + + if (pdev->bus == NULL) { + pbus = malloc(sizeof(*pbus), M_DEVBUF, M_WAITOK | M_ZERO); + pbus->self = pdev; + pdev->bus = pbus; + } + DROP_GIANT(); spin_lock(&pci_lock); list_add(&pdev->links, &pci_devices); @@ -246,14 +265,11 @@ linux_pci_shutdown(device_t dev) return (0); } -int -pci_register_driver(struct pci_driver *pdrv) +static int +_linux_pci_register_driver(struct pci_driver *pdrv, devclass_t dc) { - devclass_t bus; - int error = 0; + int error; - bus = devclass_find("pci"); - linux_set_current(curthread); spin_lock(&pci_lock); list_add(&pdrv->links, &pci_drivers); @@ -263,16 +279,39 @@ pci_register_driver(struct pci_driver *pdrv) pdrv->bsddriver.size = sizeof(struct pci_dev); mtx_lock(&Giant); - if (bus != NULL) { - error = devclass_add_driver(bus, &pdrv->bsddriver, - BUS_PASS_DEFAULT, &pdrv->bsdclass); - } + error = devclass_add_driver(dc, &pdrv->bsddriver, + BUS_PASS_DEFAULT, &pdrv->bsdclass); mtx_unlock(&Giant); return (-error); } +int +linux_pci_register_driver(struct pci_driver *pdrv) +{ + devclass_t dc; + + dc = devclass_find("pci"); + if (dc == NULL) + return (-ENXIO); + pdrv->isdrm = false; + return (_linux_pci_register_driver(pdrv, dc)); +} + +int +linux_pci_register_drm_driver(struct pci_driver *pdrv) +{ + devclass_t dc; + + dc = devclass_create("vgapci"); + if (dc == NULL) + return (-ENXIO); + pdrv->isdrm = true; + pdrv->name = "drmn"; + return (_linux_pci_register_driver(pdrv, dc)); +} + void -pci_unregister_driver(struct pci_driver *pdrv) +linux_pci_unregister_driver(struct pci_driver *pdrv) { devclass_t bus; From owner-svn-src-head@freebsd.org Fri Aug 11 10:10:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10B78DC2DF5; Fri, 11 Aug 2017 10:10:16 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E33676AE32; Fri, 11 Aug 2017 10:10:15 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1129) id 226A710B93; Fri, 11 Aug 2017 10:10:15 +0000 (UTC) Date: Fri, 11 Aug 2017 10:10:15 +0000 From: Li-Wen Hsu To: Roger Pau Monn Cc: Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen Message-ID: <20170811101015.GA83032@freefall.freebsd.org> References: <201708100915.v7A9FIke002476@repo.freebsd.org> <20170810174853.6xzxzxscm4cmd5vy@dhcp-3-128.uk.xensource.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170810174853.6xzxzxscm4cmd5vy@dhcp-3-128.uk.xensource.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 10:10:16 -0000 On Thu, Aug 10, 2017 at 18:48:53 +0100, Roger Pau Monn wrote: > On Thu, Aug 10, 2017 at 10:20:59AM -0400, Ed Maste wrote: > > On 10 August 2017 at 05:15, Roger Pau Monné wrote: > > > Author: royger > > > Date: Thu Aug 10 09:15:18 2017 > > > New Revision: 322347 > > > URL: https://svnweb.freebsd.org/changeset/base/322347 > > > > > > Log: > > > apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase > > > > i386 is failing with: > > Thanks for the heads up! Should be fixed in r322372, will keep an eye on > the CI. It seems i386 LINT is still failing: /workspace/src/sys/x86/acpica/srat.c:446:28: error: implicit declaration of function 'PHYS_TO_DMAP' is invalid in C99 [-Werror,-Wimplicit-function-declaration] cpus = (struct cpu_info *)PHYS_TO_DMAP(addr); ^ Could you also chcek this one? https://ci.freebsd.org/job/FreeBSD-head-i386-LINT/2833/console Thanks, Li-Wen -- Li-Wen Hsu https://lwhsu.org From owner-svn-src-head@freebsd.org Fri Aug 11 10:44:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A5FBDC4F5B; Fri, 11 Aug 2017 10:44:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 073666C477; Fri, 11 Aug 2017 10:44:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BAifPR032307; Fri, 11 Aug 2017 10:44:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BAif9v032305; Fri, 11 Aug 2017 10:44:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708111044.v7BAif9v032305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 11 Aug 2017 10:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322397 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 322397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 10:44:42 -0000 Author: hselasky Date: Fri Aug 11 10:44:40 2017 New Revision: 322397 URL: https://svnweb.freebsd.org/changeset/base/322397 Log: Make sure the "vm_flags" and "vm_page_prot" fields get set correctly in the VM area structure in the LinuxKPI when doing mmap() and that unsupported bits are masked away. While at it fix some redundant use of parenthesing inside some related macros. Found by: KrishnamRaju ErapaRaju MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/page.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/page.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/page.h Fri Aug 11 10:08:18 2017 (r322396) +++ head/sys/compat/linuxkpi/common/include/linux/page.h Fri Aug 11 10:44:40 2017 (r322397) @@ -48,38 +48,36 @@ typedef unsigned long pgprot_t; #define page vm_page -#define LINUXKPI_PROT_VALID (1 << 4) -#define LINUXKPI_CACHE_MODE_SHIFT 3 +#define LINUXKPI_PROT_VALID (1 << 3) +#define LINUXKPI_CACHE_MODE_SHIFT 4 +CTASSERT((VM_PROT_ALL & -LINUXKPI_PROT_VALID) == 0); + static inline pgprot_t cachemode2protval(vm_memattr_t attr) { - return ((attr | LINUXKPI_PROT_VALID) << LINUXKPI_CACHE_MODE_SHIFT); + return ((attr << LINUXKPI_CACHE_MODE_SHIFT) | LINUXKPI_PROT_VALID); } static inline vm_memattr_t pgprot2cachemode(pgprot_t prot) { - int val; - - val = prot >> LINUXKPI_CACHE_MODE_SHIFT; - - if (val & LINUXKPI_PROT_VALID) - return (val & ~LINUXKPI_PROT_VALID); + if (prot & LINUXKPI_PROT_VALID) + return (prot >> LINUXKPI_CACHE_MODE_SHIFT); else return (VM_MEMATTR_DEFAULT); } -#define virt_to_page(x) PHYS_TO_VM_PAGE(vtophys((x))) -#define page_to_pfn(pp) (VM_PAGE_TO_PHYS((pp)) >> PAGE_SHIFT) +#define virt_to_page(x) PHYS_TO_VM_PAGE(vtophys(x)) +#define page_to_pfn(pp) (VM_PAGE_TO_PHYS(pp) >> PAGE_SHIFT) #define pfn_to_page(pfn) (PHYS_TO_VM_PAGE((pfn) << PAGE_SHIFT)) -#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) +#define nth_page(page,n) pfn_to_page(page_to_pfn(page) + (n)) -#define clear_page(page) memset((page), 0, PAGE_SIZE) +#define clear_page(page) memset(page, 0, PAGE_SIZE) #define pgprot_noncached(prot) \ - ((prot) | cachemode2protval(VM_MEMATTR_UNCACHEABLE)) + (((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_UNCACHEABLE)) #define pgprot_writecombine(prot) \ - ((prot) | cachemode2protval(VM_MEMATTR_WRITE_COMBINING)) + (((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_WRITE_COMBINING)) #undef PAGE_MASK #define PAGE_MASK (~(PAGE_SIZE-1)) Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Fri Aug 11 10:08:18 2017 (r322396) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Fri Aug 11 10:44:40 2017 (r322397) @@ -1210,7 +1210,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t * vmap->vm_end = size; vmap->vm_pgoff = *offset / PAGE_SIZE; vmap->vm_pfn = 0; - vmap->vm_flags = vmap->vm_page_prot = nprot; + vmap->vm_flags = vmap->vm_page_prot = (nprot & VM_PROT_ALL); vmap->vm_ops = NULL; vmap->vm_file = get_file(filp); vmap->vm_mm = mm; From owner-svn-src-head@freebsd.org Fri Aug 11 12:45:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6B0EDCC8BE; Fri, 11 Aug 2017 12:45:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B617A7084A; Fri, 11 Aug 2017 12:45:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BCjwXP081417; Fri, 11 Aug 2017 12:45:58 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BCjwPV081416; Fri, 11 Aug 2017 12:45:58 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708111245.v7BCjwPV081416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 11 Aug 2017 12:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322400 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 12:46:00 -0000 Author: andrew Date: Fri Aug 11 12:45:58 2017 New Revision: 322400 URL: https://svnweb.freebsd.org/changeset/base/322400 Log: Only return the current cpu if it's in the cpumask. When we restrict the cpumask it probably means we are unable to sent interrupts to CPUs outside the map. As such only return the current CPU when it's within the mask otherwise return the first valid CPU. This is needed on ThunderX as, in a dual socket configuration, we are unable to send MSI/MSI-X interrupts between sockets. Reviewed by: mmel Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11957 Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Fri Aug 11 11:38:04 2017 (r322399) +++ head/sys/kern/subr_intr.c Fri Aug 11 12:45:58 2017 (r322400) @@ -1169,9 +1169,17 @@ intr_bind_irq(device_t dev, struct resource *res, int u_int intr_irq_next_cpu(u_int last_cpu, cpuset_t *cpumask) { + u_int cpu; - if (!irq_assign_cpu || mp_ncpus == 1) - return (PCPU_GET(cpuid)); + KASSERT(!CPU_EMPTY(cpumask), ("%s: Empty CPU mask", __func__)); + if (!irq_assign_cpu || mp_ncpus == 1) { + cpu = PCPU_GET(cpuid); + + if (CPU_ISSET(cpu, cpumask)) + return (curcpu); + + return (CPU_FFS(cpumask) - 1); + } do { last_cpu++; From owner-svn-src-head@freebsd.org Fri Aug 11 14:18:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E86B7DD1A6A; Fri, 11 Aug 2017 14:18:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C470173B65; Fri, 11 Aug 2017 14:18:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BEICQ7018524; Fri, 11 Aug 2017 14:18:12 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BEICB1018523; Fri, 11 Aug 2017 14:18:12 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708111418.v7BEICB1018523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 11 Aug 2017 14:18:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322401 - head X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 14:18:13 -0000 Author: gjb Date: Fri Aug 11 14:18:11 2017 New Revision: 322401 URL: https://svnweb.freebsd.org/changeset/base/322401 Log: Avoid creating kernel-dbg.txz distribution sets and kernel-debug packages when MK_DEBUG_FILES is 'no'. MFC after: 5 days Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Aug 11 12:45:58 2017 (r322400) +++ head/Makefile.inc1 Fri Aug 11 14:18:11 2017 (r322401) @@ -1493,20 +1493,24 @@ packagekernel: .PHONY @${DESTDIR}/${DISTDIR}/kernel.meta | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz .endif +.if ${MK_DEBUG_FILES} != "no" cd ${DESTDIR}/${DISTDIR}/kernel; \ tar cvf - --include '*/*/*.debug' \ @${DESTDIR}/${DISTDIR}/kernel.meta | \ ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz +.endif .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" .for _kernel in ${BUILDKERNELS:[2..-1]} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ tar cvf - --exclude '*.debug' \ @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz +.if ${MK_DEBUG_FILES} != "no" cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ tar cvf - --include '*/*/*.debug' \ @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz +.endif .endfor .endif .else @@ -1515,17 +1519,21 @@ packagekernel: .PHONY tar cvf - --exclude '*.debug' . | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz .endif +.if ${MK_DEBUG_FILES} != "no" cd ${DESTDIR}/${DISTDIR}/kernel; \ tar cvf - --include '*/*/*.debug' $$(eval find .) | \ ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz +.endif .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" .for _kernel in ${BUILDKERNELS:[2..-1]} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ tar cvf - --exclude '*.debug' . | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz +.if ${MK_DEBUG_FILES} != "no" cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ tar cvf - --include '*/*/*.debug' $$(eval find .) | \ ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz +.endif .endfor .endif .endif @@ -1632,7 +1640,10 @@ create-world-package-${pkgname}: .PHONY create-kernel-packages: .PHONY _default_flavor= -default .if exists(${KSTAGEDIR}/kernel.meta) -. for flavor in "" -debug +.if ${MK_DEBUG_FILES} != "no" +_debug=-debug +.endif +. for flavor in "" ${_debug} create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY @cd ${KSTAGEDIR}/${DISTDIR} ; \ @@ -1663,7 +1674,10 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" . for _kernel in ${BUILDKERNELS:[2..-1]} . if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) -. for flavor in "" -debug +. if ${MK_DEBUG_FILES} != "no" +_debug=-debug +. endif +. for flavor in "" ${_debug} create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel} create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .PHONY @cd ${KSTAGEDIR}/kernel.${_kernel} ; \ From owner-svn-src-head@freebsd.org Fri Aug 11 14:19:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A3F2DD1C64; Fri, 11 Aug 2017 14:19:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4888673D3C; Fri, 11 Aug 2017 14:19:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BEJV8E018607; Fri, 11 Aug 2017 14:19:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BEJVvF018606; Fri, 11 Aug 2017 14:19:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708111419.v7BEJVvF018606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 11 Aug 2017 14:19:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322402 - head X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 14:19:32 -0000 Author: gjb Date: Fri Aug 11 14:19:31 2017 New Revision: 322402 URL: https://svnweb.freebsd.org/changeset/base/322402 Log: Fix indentation from r322401. MFC after: 3 days MFC with: r322401 Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Aug 11 14:18:11 2017 (r322401) +++ head/Makefile.inc1 Fri Aug 11 14:19:31 2017 (r322402) @@ -1640,9 +1640,9 @@ create-world-package-${pkgname}: .PHONY create-kernel-packages: .PHONY _default_flavor= -default .if exists(${KSTAGEDIR}/kernel.meta) -.if ${MK_DEBUG_FILES} != "no" +. if ${MK_DEBUG_FILES} != "no" _debug=-debug -.endif +. endif . for flavor in "" ${_debug} create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY @@ -1674,9 +1674,9 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" . for _kernel in ${BUILDKERNELS:[2..-1]} . if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) -. if ${MK_DEBUG_FILES} != "no" +. if ${MK_DEBUG_FILES} != "no" _debug=-debug -. endif +. endif . for flavor in "" ${_debug} create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel} create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .PHONY From owner-svn-src-head@freebsd.org Fri Aug 11 14:19:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC3DFDD1CFA; Fri, 11 Aug 2017 14:19:56 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B65F73E89; Fri, 11 Aug 2017 14:19:56 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BEJtkw018665; Fri, 11 Aug 2017 14:19:55 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BEJt6O018664; Fri, 11 Aug 2017 14:19:55 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708111419.v7BEJt6O018664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Fri, 11 Aug 2017 14:19:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322403 - head/sys/x86/acpica X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: head/sys/x86/acpica X-SVN-Commit-Revision: 322403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 14:19:56 -0000 Author: royger Date: Fri Aug 11 14:19:55 2017 New Revision: 322403 URL: https://svnweb.freebsd.org/changeset/base/322403 Log: acpi/srat: fix build without DMAP Use pmap_mapbios to map memory used to store the cpus array. Reported by: lwhsu X-MFC-with: r322348 Modified: head/sys/x86/acpica/srat.c Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Fri Aug 11 14:19:31 2017 (r322402) +++ head/sys/x86/acpica/srat.c Fri Aug 11 14:19:55 2017 (r322403) @@ -443,7 +443,12 @@ parse_srat(void) ("Not enough memory for SRAT table items")); phys_avail[idx + 1] = addr - 1; - cpus = (struct cpu_info *)PHYS_TO_DMAP(addr); + /* + * We cannot rely on PHYS_TO_DMAP because this code is also used in + * i386, so use pmap_mapbios to map the memory, this will end up using + * the default memory attribute (WB), and the DMAP when available. + */ + cpus = (struct cpu_info *)pmap_mapbios(addr, size); /* * Make a pass over the table to populate the cpus[] and @@ -529,6 +534,10 @@ srat_set_cpus(void *dummy) printf("SRAT: CPU %u has memory domain %d\n", i, cpu->domain); } + + /* Last usage of the cpus array, unmap it. */ + pmap_unmapdev((vm_offset_t)cpus, sizeof(*cpus) * (max_apic_id + 1)); + cpus = NULL; } SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL); From owner-svn-src-head@freebsd.org Fri Aug 11 14:28:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12091DD26C0; Fri, 11 Aug 2017 14:28:27 +0000 (UTC) (envelope-from royger@gmail.com) Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95FC57468B; Fri, 11 Aug 2017 14:28:26 +0000 (UTC) (envelope-from royger@gmail.com) Received: by mail-wm0-x22a.google.com with SMTP id f15so48865181wmg.1; Fri, 11 Aug 2017 07:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=5pRxAOR7Osl0Y7dfH0e8K1pNpFiMM9PFYhGps8kliwc=; b=ItEoEYmPKrXzq9JJAu3zfngi7kKRmeSOyotaMiV/1s/dWWWpIUC7TXxGxs6hIDh4gc aeUFP7xVIq4bMgJIwN3uwv4hahQ3HOwcsA47vgsaIhipTriDI9F+HKQYczLgD6cFmC/q rH3H9sQZWKBB20magvs59x7KkEUgtc98chTG3e2uudAZb3AQDNncBjlxyBB1TKX23ufK ZGb7jmcVwJzxV6fqlpcQg8biptQSWkiqZf2DhtS2AKVS7s3p9wt5Qp6SBEwhI87tQGny J9dVKW2dfdsn1L3YrvEaA+F2PjaWBNegHcDcVS+Na4hrawzs1UsYl4NhEh73z8yzdM0w kB7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=5pRxAOR7Osl0Y7dfH0e8K1pNpFiMM9PFYhGps8kliwc=; b=Icq985iExbrkLFdNlhvUtJCE5kJicxW5L9fH9mMm4bnbVPYMCh599QZIK2ooI7xFpW ZtmSJkW/FE5JXOoiLczfWIc1Tb/oEr3KYLI+jsHo/tgh7/As67Aa6sUwAHylr7L5vrpo TMoMZfXXbmYyg+2LTSTT/BDFP2qUqsYpyVdZA5R+PQDgpzQYbScGC2gr+rbUXVOVLyU3 LUjajncbeEH5ZfSbBcH4v76BRV2IrSutIwqrwUCNjAloF5Ll20r8Y6y19Z4LqZbVkSC4 hoBeXUAxP52f4lGe1kgIH/mXhozQEOK7bt34VMszWx82N+7F8vbGKQi8wZsnC7D8/dY3 Lsqw== X-Gm-Message-State: AHYfb5jUKRGYgFFDa0jVZqfyOnXiIRT799/Rb2ldQBB4GZWezfMmvjV0 Fhwt04DXOV7iklyp X-Received: by 10.80.241.66 with SMTP id z2mr15688245edl.21.1502461704938; Fri, 11 Aug 2017 07:28:24 -0700 (PDT) Received: from localhost (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id g44sm743299edc.27.2017.08.11.07.28.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Aug 2017 07:28:22 -0700 (PDT) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Date: Fri, 11 Aug 2017 15:28:17 +0100 From: Roger Pau Monn To: Li-Wen Hsu Cc: Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen Message-ID: <20170811142817.vdcz5pzn45zild55@dhcp-3-128.uk.xensource.com> References: <201708100915.v7A9FIke002476@repo.freebsd.org> <20170810174853.6xzxzxscm4cmd5vy@dhcp-3-128.uk.xensource.com> <20170811101015.GA83032@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170811101015.GA83032@freefall.freebsd.org> User-Agent: NeoMutt/20170714 (1.8.3) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 14:28:27 -0000 On Fri, Aug 11, 2017 at 10:10:15AM +0000, Li-Wen Hsu wrote: > On Thu, Aug 10, 2017 at 18:48:53 +0100, Roger Pau Monn wrote: > > On Thu, Aug 10, 2017 at 10:20:59AM -0400, Ed Maste wrote: > > > On 10 August 2017 at 05:15, Roger Pau Monné wrote: > > > > Author: royger > > > > Date: Thu Aug 10 09:15:18 2017 > > > > New Revision: 322347 > > > > URL: https://svnweb.freebsd.org/changeset/base/322347 > > > > > > > > Log: > > > > apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase > > > > > > i386 is failing with: > > > > Thanks for the heads up! Should be fixed in r322372, will keep an eye on > > the CI. > > It seems i386 LINT is still failing: > > /workspace/src/sys/x86/acpica/srat.c:446:28: error: implicit declaration of function 'PHYS_TO_DMAP' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > cpus = (struct cpu_info *)PHYS_TO_DMAP(addr); > ^ > > Could you also chcek this one? https://ci.freebsd.org/job/FreeBSD-head-i386-LINT/2833/console Sorry again for the breakage, should be fixed in r322403. Not sure if it makes much sense to parse the SRAT on i386 anyway. Roger. From owner-svn-src-head@freebsd.org Fri Aug 11 16:27:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1D8DDD94BF; Fri, 11 Aug 2017 16:27:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FA0A7CBC0; Fri, 11 Aug 2017 16:27:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BGRs44072576; Fri, 11 Aug 2017 16:27:54 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BGRsa7072575; Fri, 11 Aug 2017 16:27:54 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201708111627.v7BGRsa7072575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 11 Aug 2017 16:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322404 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 16:27:55 -0000 Author: alc Date: Fri Aug 11 16:27:54 2017 New Revision: 322404 URL: https://svnweb.freebsd.org/changeset/base/322404 Log: An invalid page can't be dirty. Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Fri Aug 11 14:19:55 2017 (r322403) +++ head/sys/kern/kern_sendfile.c Fri Aug 11 16:27:54 2017 (r322404) @@ -355,7 +355,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o &a)) { pmap_zero_page(pa[i]); pa[i]->valid = VM_PAGE_BITS_ALL; - pa[i]->dirty = 0; + MPASS(pa[i]->dirty == 0); vm_page_xunbusy(pa[i]); i++; continue; From owner-svn-src-head@freebsd.org Fri Aug 11 16:29:24 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A98ADD95F9; Fri, 11 Aug 2017 16:29:24 +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 mx1.freebsd.org (Postfix) with ESMTPS id 1655E7CD30; Fri, 11 Aug 2017 16:29:24 +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 v7BGTNxA072671; Fri, 11 Aug 2017 16:29:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BGTMpO072666; Fri, 11 Aug 2017 16:29:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708111629.v7BGTMpO072666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Aug 2017 16:29:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322405 - in head/sys: kern sparc64/sparc64 vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern sparc64/sparc64 vm X-SVN-Commit-Revision: 322405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 16:29:24 -0000 Author: markj Date: Fri Aug 11 16:29:22 2017 New Revision: 322405 URL: https://svnweb.freebsd.org/changeset/base/322405 Log: Modify vm_page_grab_pages() to handle VM_ALLOC_NOWAIT. This will allow its use in sendfile_swapin(). Reviewed by: alc, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11942 Modified: head/sys/kern/vfs_bio.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/vm_glue.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri Aug 11 16:27:54 2017 (r322404) +++ head/sys/kern/vfs_bio.c Fri Aug 11 16:29:22 2017 (r322405) @@ -2746,7 +2746,7 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int * deadlocks once allocbuf() is called after * pages are vfs_busy_pages(). */ - vm_page_grab_pages(obj, + (void)vm_page_grab_pages(obj, OFF_TO_IDX(bp->b_offset) + bp->b_npages, VM_ALLOC_SYSTEM | VM_ALLOC_IGN_SBUSY | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED, Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Fri Aug 11 16:27:54 2017 (r322404) +++ head/sys/sparc64/sparc64/pmap.c Fri Aug 11 16:29:22 2017 (r322405) @@ -1248,7 +1248,7 @@ pmap_pinit(pmap_t pm) CPU_ZERO(&pm->pm_active); VM_OBJECT_WLOCK(pm->pm_tsb_obj); - vm_page_grab_pages(pm->pm_tsb_obj, 0, VM_ALLOC_NORMAL | + (void)vm_page_grab_pages(pm->pm_tsb_obj, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | VM_ALLOC_ZERO, ma, TSB_PAGES); VM_OBJECT_WUNLOCK(pm->pm_tsb_obj); for (i = 0; i < TSB_PAGES; i++) Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Fri Aug 11 16:27:54 2017 (r322404) +++ head/sys/vm/vm_glue.c Fri Aug 11 16:29:22 2017 (r322405) @@ -391,7 +391,7 @@ vm_thread_new(struct thread *td, int pages) * page of stack. */ VM_OBJECT_WLOCK(ksobj); - vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + (void)vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED, ma, pages); for (i = 0; i < pages; i++) ma[i]->valid = VM_PAGE_BITS_ALL; @@ -568,7 +568,7 @@ vm_thread_swapin(struct thread *td) pages = td->td_kstack_pages; ksobj = td->td_kstack_obj; VM_OBJECT_WLOCK(ksobj); - vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED, ma, + (void)vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED, ma, pages); for (int i = 0; i < pages;) { int j, a, count, rv; Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Aug 11 16:27:54 2017 (r322404) +++ head/sys/vm/vm_page.c Fri Aug 11 16:29:22 2017 (r322405) @@ -3173,13 +3173,15 @@ retrylookup: * optional allocation flags: * VM_ALLOC_IGN_SBUSY do not sleep on soft busy pages * VM_ALLOC_NOBUSY do not exclusive busy the page + * VM_ALLOC_NOWAIT do not sleep * VM_ALLOC_SBUSY set page to sbusy state * VM_ALLOC_WIRED wire the pages * VM_ALLOC_ZERO zero and validate any invalid pages * - * This routine may sleep. + * If VM_ALLOC_NOWAIT is not specified, this routine may sleep. Otherwise, it + * may return a partial prefix of the requested range. */ -void +int vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, vm_page_t *ma, int count) { @@ -3197,7 +3199,7 @@ vm_page_grab_pages(vm_object_t object, vm_pindex_t pin (allocflags & VM_ALLOC_IGN_SBUSY) != 0, ("vm_page_grab_pages: VM_ALLOC_SBUSY/IGN_SBUSY mismatch")); if (count == 0) - return; + return (0); i = 0; retrylookup: m = vm_page_lookup(object, pindex + i); @@ -3206,6 +3208,8 @@ retrylookup: sleep = (allocflags & VM_ALLOC_IGN_SBUSY) != 0 ? vm_page_xbusied(m) : vm_page_busied(m); if (sleep) { + if ((allocflags & VM_ALLOC_NOWAIT) != 0) + break; /* * Reference the page before unlocking and * sleeping so that the page daemon is less @@ -3233,6 +3237,8 @@ retrylookup: m = vm_page_alloc(object, pindex + i, (allocflags & ~VM_ALLOC_IGN_SBUSY) | VM_ALLOC_COUNT(count - i)); if (m == NULL) { + if ((allocflags & VM_ALLOC_NOWAIT) != 0) + break; VM_OBJECT_WUNLOCK(object); VM_WAIT; VM_OBJECT_WLOCK(object); @@ -3247,6 +3253,7 @@ retrylookup: ma[i] = m; m = vm_page_next(m); } + return (i); } /* Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Fri Aug 11 16:27:54 2017 (r322404) +++ head/sys/vm/vm_page.h Fri Aug 11 16:29:22 2017 (r322405) @@ -419,7 +419,7 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_IGN_SBUSY 0x1000 /* (gp) Ignore shared busy flag */ #define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */ #define VM_ALLOC_SBUSY 0x4000 /* (acgp) Shared busy the page */ -#define VM_ALLOC_NOWAIT 0x8000 /* (g) Do not sleep, return NULL */ +#define VM_ALLOC_NOWAIT 0x8000 /* (gp) Do not sleep */ #define VM_ALLOC_COUNT_SHIFT 16 #define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT) @@ -470,7 +470,7 @@ vm_page_t vm_page_alloc_contig(vm_object_t object, vm_ vm_paddr_t boundary, vm_memattr_t memattr); vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); -void vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, +int vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, vm_page_t *ma, int count); int vm_page_try_to_free (vm_page_t); void vm_page_deactivate (vm_page_t); From owner-svn-src-head@freebsd.org Fri Aug 11 16:32:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A22BDD99DB; Fri, 11 Aug 2017 16:32:26 +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 mx1.freebsd.org (Postfix) with ESMTPS id DCACF7D21F; Fri, 11 Aug 2017 16:32:25 +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 v7BGWPWF076375; Fri, 11 Aug 2017 16:32:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BGWPMN076374; Fri, 11 Aug 2017 16:32:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708111632.v7BGWPMN076374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Aug 2017 16:32:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322406 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 16:32:26 -0000 Author: markj Date: Fri Aug 11 16:32:24 2017 New Revision: 322406 URL: https://svnweb.freebsd.org/changeset/base/322406 Log: Have sendfile_swapin() use vm_page_grab_pages(). Reviewed by: alc, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11942 Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Fri Aug 11 16:29:22 2017 (r322405) +++ head/sys/kern/kern_sendfile.c Fri Aug 11 16:32:24 2017 (r322406) @@ -309,7 +309,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o int npages, int rhpages, int flags) { vm_page_t *pa = sfio->pa; - int nios; + int grabbed, nios; nios = 0; flags = (flags & SF_NODISKIO) ? VM_ALLOC_NOWAIT : 0; @@ -319,14 +319,14 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o * only required pages. Readahead pages are dealt with later. */ VM_OBJECT_WLOCK(obj); - for (int i = 0; i < npages; i++) { - pa[i] = vm_page_grab(obj, OFF_TO_IDX(vmoff(i, off)), - VM_ALLOC_WIRED | VM_ALLOC_NORMAL | flags); - if (pa[i] == NULL) { - npages = i; - rhpages = 0; - break; - } + + grabbed = vm_page_grab_pages(obj, OFF_TO_IDX(off), + VM_ALLOC_NORMAL | VM_ALLOC_WIRED | flags, pa, npages); + if (grabbed < npages) { + for (int i = grabbed; i < npages; i++) + pa[i] = NULL; + npages = grabbed; + rhpages = 0; } for (int i = 0; i < npages;) { From owner-svn-src-head@freebsd.org Fri Aug 11 17:05:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BAEDDDBD29; Fri, 11 Aug 2017 17:05:32 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3801A7EEA2; Fri, 11 Aug 2017 17:05:32 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BH5V3Z088967; Fri, 11 Aug 2017 17:05:31 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BH5V7r088966; Fri, 11 Aug 2017 17:05:31 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708111705.v7BH5V7r088966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Fri, 11 Aug 2017 17:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322407 - head/sys/libkern/x86 X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/libkern/x86 X-SVN-Commit-Revision: 322407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 17:05:32 -0000 Author: rlibby Date: Fri Aug 11 17:05:31 2017 New Revision: 322407 URL: https://svnweb.freebsd.org/changeset/base/322407 Log: x86/crc32_sse42.c: quiet unused function warning Reviewed by: cem Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11980 Modified: head/sys/libkern/x86/crc32_sse42.c Modified: head/sys/libkern/x86/crc32_sse42.c ============================================================================== --- head/sys/libkern/x86/crc32_sse42.c Fri Aug 11 16:32:24 2017 (r322406) +++ head/sys/libkern/x86/crc32_sse42.c Fri Aug 11 17:05:31 2017 (r322407) @@ -52,19 +52,21 @@ _mm_crc32_u8(uint32_t x, uint8_t y) return (x); } -static __inline uint32_t -_mm_crc32_u32(uint32_t x, uint32_t y) -{ - __asm("crc32l %1,%0" : "+r" (x) : "r" (y)); - return (x); -} - +#ifdef __amd64__ static __inline uint64_t _mm_crc32_u64(uint64_t x, uint64_t y) { __asm("crc32q %1,%0" : "+r" (x) : "r" (y)); return (x); } +#else +static __inline uint32_t +_mm_crc32_u32(uint32_t x, uint32_t y) +{ + __asm("crc32l %1,%0" : "+r" (x) : "r" (y)); + return (x); +} +#endif /* CRC-32C (iSCSI) polynomial in reversed bit order. */ #define POLY 0x82f63b78 From owner-svn-src-head@freebsd.org Fri Aug 11 17:43:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAE7CDDDE87; Fri, 11 Aug 2017 17:43:26 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71D7D80432; Fri, 11 Aug 2017 17:43:26 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BHhPuh005448; Fri, 11 Aug 2017 17:43:25 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BHhPET005443; Fri, 11 Aug 2017 17:43:25 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708111743.v7BHhPET005443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Fri, 11 Aug 2017 17:43:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322408 - in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Group: head X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Commit-Revision: 322408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 17:43:26 -0000 Author: davidcs Date: Fri Aug 11 17:43:25 2017 New Revision: 322408 URL: https://svnweb.freebsd.org/changeset/base/322408 Log: Performance enhancements to reduce CPU utililization for large number of TCP connections (order of tens of thousands), with predominantly Transmits. Choice to perform receive operations either in IThread or Taskqueue Thread. Submitted by:Vaishali.Kulkarni@cavium.com MFC after:5 days Modified: head/sys/dev/qlnx/qlnxe/qlnx_def.h head/sys/dev/qlnx/qlnxe/qlnx_os.c head/sys/dev/qlnx/qlnxe/qlnx_ver.h head/sys/modules/qlnx/qlnxe/Makefile Modified: head/sys/dev/qlnx/qlnxe/qlnx_def.h ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_def.h Fri Aug 11 17:05:31 2017 (r322407) +++ head/sys/dev/qlnx/qlnxe/qlnx_def.h Fri Aug 11 17:43:25 2017 (r322408) @@ -50,9 +50,10 @@ struct qlnx_ivec { typedef struct qlnx_ivec qlnx_ivec_t; -//#define QLNX_MAX_RSS 30 -#define QLNX_MAX_RSS 16 -#define QLNX_MAX_TC 1 +//#define QLNX_MAX_RSS 30 +#define QLNX_MAX_RSS 36 +#define QLNX_DEFAULT_RSS 16 +#define QLNX_MAX_TC 1 enum QLNX_STATE { QLNX_STATE_CLOSED, @@ -201,6 +202,17 @@ struct qlnx_fastpath { uint64_t tx_pkts_freed; uint64_t tx_pkts_transmitted; uint64_t tx_pkts_completed; + uint64_t tx_tso_pkts; + uint64_t tx_non_tso_pkts; + +#ifdef QLNX_TRACE_PERF_DATA + uint64_t tx_pkts_trans_ctx; + uint64_t tx_pkts_compl_ctx; + uint64_t tx_pkts_trans_fp; + uint64_t tx_pkts_compl_fp; + uint64_t tx_pkts_compl_intr; +#endif + uint64_t tx_lso_wnd_min_len; uint64_t tx_defrag; uint64_t tx_nsegs_gt_elem_left; @@ -209,6 +221,13 @@ struct qlnx_fastpath { uint32_t tx_tso_max_pkt_len; uint32_t tx_tso_min_pkt_len; uint64_t tx_pkts[QLNX_FP_MAX_SEGS]; + +#ifdef QLNX_TRACE_PERF_DATA + uint64_t tx_pkts_hist[QLNX_FP_MAX_SEGS]; + uint64_t tx_comInt[QLNX_FP_MAX_SEGS]; + uint64_t tx_pkts_q[QLNX_FP_MAX_SEGS]; +#endif + uint64_t err_tx_nsegs_gt_elem_left; uint64_t err_tx_dmamap_create; uint64_t err_tx_defrag_dmamap_load; @@ -301,8 +320,13 @@ typedef struct qlnx_link_output qlnx_link_output_t; #define QLNX_MFW_VERSION_LENGTH 32 #define QLNX_STORMFW_VERSION_LENGTH 32 -#define QLNX_TX_ELEM_RESERVE 2 +#define QLNX_TX_ELEM_RESERVE 2 +#define QLNX_TX_ELEM_THRESH 128 +#define QLNX_TX_ELEM_MAX_THRESH 512 +#define QLNX_TX_ELEM_MIN_THRESH 32 +#define QLNX_TX_COMPL_THRESH 32 + #define QLNX_TPA_MAX_AGG_BUFFERS (20) #define QLNX_MAX_NUM_MULTICAST_ADDRS ECORE_MAX_MC_ADDRS @@ -454,6 +478,7 @@ struct qlnx_host { qlnx_storm_stats_t storm_stats[QLNX_STORM_STATS_TOTAL]; uint32_t storm_stats_index; uint32_t storm_stats_enable; + uint32_t storm_stats_gather; uint32_t personality; }; @@ -470,8 +495,11 @@ typedef struct qlnx_host qlnx_host_t; #define QLNX_MAX_MTU 9000 #define QLNX_MAX_SEGMENTS_NON_TSO (ETH_TX_MAX_BDS_PER_NON_LSO_PACKET - 1) -#define QLNX_MAX_TSO_FRAME_SIZE ((64 * 1024 - 1) + 22) +//#define QLNX_MAX_TSO_FRAME_SIZE ((64 * 1024 - 1) + 22) +#define QLNX_MAX_TSO_FRAME_SIZE 65536 +#define QLNX_MAX_TX_MBUF_SIZE 65536 /* bytes - bd_len = 16bits */ + #define QL_MAC_CMP(mac1, mac2) \ ((((*(uint32_t *) mac1) == (*(uint32_t *) mac2) && \ (*(uint16_t *)(mac1 + 4)) == (*(uint16_t *)(mac2 + 4)))) ? 0 : 1) @@ -702,6 +730,18 @@ extern void qlnx_fill_link(struct ecore_hwfn *hwfn, #define CQE_HAS_VLAN(flags) \ ((flags) & (PARSING_AND_ERR_FLAGS_TAG8021QEXIST_MASK \ << PARSING_AND_ERR_FLAGS_TAG8021QEXIST_SHIFT)) + +#if defined(__i386__) || defined(__amd64__) + +static __inline +void prefetch(void *x) +{ + __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); +} + +#else +#define prefetch(x) +#endif #endif /* #ifndef _QLNX_DEF_H_ */ Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_os.c Fri Aug 11 17:05:31 2017 (r322407) +++ head/sys/dev/qlnx/qlnxe/qlnx_os.c Fri Aug 11 17:43:25 2017 (r322408) @@ -94,6 +94,8 @@ static int qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha); static uint32_t qlnx_get_optics(qlnx_host_t *ha, struct qlnx_link_output *if_link); static int qlnx_transmit(struct ifnet *ifp, struct mbuf *mp); +static int qlnx_transmit_locked(struct ifnet *ifp, struct qlnx_fastpath *fp, + struct mbuf *mp); static void qlnx_qflush(struct ifnet *ifp); static int qlnx_alloc_parent_dma_tag(qlnx_host_t *ha); @@ -133,6 +135,8 @@ static void qlnx_timer(void *arg); static int qlnx_alloc_tx_br(qlnx_host_t *ha, struct qlnx_fastpath *fp); static void qlnx_free_tx_br(qlnx_host_t *ha, struct qlnx_fastpath *fp); static void qlnx_trigger_dump(qlnx_host_t *ha); +static uint16_t qlnx_num_tx_compl(qlnx_host_t *ha, struct qlnx_fastpath *fp, + struct qlnx_tx_queue *txq); static void qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, struct qlnx_tx_queue *txq); static int qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget, @@ -215,6 +219,12 @@ char qlnx_name_str[NAME_SIZE]; #define QLOGIC_PCI_DEVICE_ID_8070 0x8070 #endif +SYSCTL_NODE(_hw, OID_AUTO, qlnxe, CTLFLAG_RD, 0, "qlnxe driver parameters"); +/* Number of Queues: 0 (Auto) or 1 to 32 (fixed queue number) */ +static int qlnxe_queue_count = QLNX_DEFAULT_RSS; +SYSCTL_INT(_hw_qlnxe, OID_AUTO, queue_count, CTLFLAG_RDTUN, + &qlnxe_queue_count, 0, "Multi-Queue queue count"); + static int qlnx_valid_device(device_t dev) { @@ -302,7 +312,26 @@ qlnx_pci_probe(device_t dev) return (BUS_PROBE_DEFAULT); } +static uint16_t +qlnx_num_tx_compl(qlnx_host_t *ha, struct qlnx_fastpath *fp, + struct qlnx_tx_queue *txq) +{ + u16 hw_bd_cons; + u16 ecore_cons_idx; + uint16_t diff; + hw_bd_cons = le16toh(*txq->hw_cons_ptr); + + ecore_cons_idx = ecore_chain_get_cons_idx(&txq->tx_pbl); + if (hw_bd_cons < ecore_cons_idx) { + diff = (1 << 16) - (ecore_cons_idx - hw_bd_cons); + } else { + diff = hw_bd_cons - ecore_cons_idx; + } + return diff; +} + + static void qlnx_sp_intr(void *arg) { @@ -395,14 +424,11 @@ qlnx_fp_taskqueue(void *context, int pending) struct qlnx_fastpath *fp; qlnx_host_t *ha; struct ifnet *ifp; - struct mbuf *mp; - int ret = -1; - struct thread *cthread; #ifdef QLNX_RCV_IN_TASKQ int lro_enable; int rx_int = 0, total_rx_count = 0; - + struct thread *cthread; #endif /* #ifdef QLNX_RCV_IN_TASKQ */ fp = context; @@ -410,6 +436,12 @@ qlnx_fp_taskqueue(void *context, int pending) if (fp == NULL) return; + ha = (qlnx_host_t *)fp->edev; + + ifp = ha->ifp; + +#ifdef QLNX_RCV_IN_TASKQ + cthread = curthread; thread_lock(cthread); @@ -419,112 +451,81 @@ qlnx_fp_taskqueue(void *context, int pending) thread_unlock(cthread); - ha = (qlnx_host_t *)fp->edev; + lro_enable = ifp->if_capenable & IFCAP_LRO; - ifp = ha->ifp; + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); -#ifdef QLNX_RCV_IN_TASKQ - { - lro_enable = ifp->if_capenable & IFCAP_LRO; + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } - rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); - - if (rx_int) { - fp->rx_pkts += rx_int; - total_rx_count += rx_int; - } - #ifdef QLNX_SOFT_LRO - { - struct lro_ctrl *lro; - - lro = &fp->rxq->lro; + { + struct lro_ctrl *lro; - if (lro_enable && total_rx_count) { + lro = &fp->rxq->lro; + if (lro_enable && total_rx_count) { + #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) - if (ha->dbg_trace_lro_cnt) { - if (lro->lro_mbuf_count & ~1023) - fp->lro_cnt_1024++; - else if (lro->lro_mbuf_count & ~511) - fp->lro_cnt_512++; - else if (lro->lro_mbuf_count & ~255) - fp->lro_cnt_256++; - else if (lro->lro_mbuf_count & ~127) - fp->lro_cnt_128++; - else if (lro->lro_mbuf_count & ~63) - fp->lro_cnt_64++; - } - tcp_lro_flush_all(lro); + if (ha->dbg_trace_lro_cnt) { + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; + } + tcp_lro_flush_all(lro); #else - struct lro_entry *queued; + struct lro_entry *queued; - while ((!SLIST_EMPTY(&lro->lro_active))) { - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, next); - tcp_lro_flush(lro, queued); - } -#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, next); + tcp_lro_flush(lro, queued); } +#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ } + } #endif /* #ifdef QLNX_SOFT_LRO */ - ecore_sb_update_sb_idx(fp->sb_info); - rmb(); - } + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); #endif /* #ifdef QLNX_RCV_IN_TASKQ */ - mtx_lock(&fp->tx_mtx); + if(ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) || (!ha->link_up)) { + if (!drbr_empty(ifp, fp->tx_br)) { - mtx_unlock(&fp->tx_mtx); - goto qlnx_fp_taskqueue_exit; - } + if(mtx_trylock(&fp->tx_mtx)) { - mp = drbr_peek(ifp, fp->tx_br); +#ifdef QLNX_TRACE_PERF_DATA + tx_pkts = fp->tx_pkts_transmitted; + tx_compl = fp->tx_pkts_completed; +#endif - while (mp != NULL) { + qlnx_transmit_locked(ifp, fp, NULL); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - ret = qlnx_send(ha, fp, &mp); - } else { - ret = -1; - } - - if (ret) { - - if (mp != NULL) { - drbr_putback(ifp, fp->tx_br, mp); - } else { - fp->tx_pkts_processed++; - drbr_advance(ifp, fp->tx_br); +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_trans_fp += + (fp->tx_pkts_transmitted - tx_pkts); + fp->tx_pkts_compl_fp += + (fp->tx_pkts_completed - tx_compl); +#endif + mtx_unlock(&fp->tx_mtx); } - - mtx_unlock(&fp->tx_mtx); - - goto qlnx_fp_taskqueue_exit; - - } else { - drbr_advance(ifp, fp->tx_br); - fp->tx_pkts_transmitted++; - fp->tx_pkts_processed++; } - - if (fp->tx_ring_full) - break; - - mp = drbr_peek(ifp, fp->tx_br); } - mtx_unlock(&fp->tx_mtx); - -qlnx_fp_taskqueue_exit: - #ifdef QLNX_RCV_IN_TASKQ if (rx_int) { if (fp->fp_taskqueue != NULL) @@ -537,7 +538,7 @@ qlnx_fp_taskqueue_exit: } #endif /* #ifdef QLNX_RCV_IN_TASKQ */ - QL_DPRINT2(ha, "exit ret = %d\n", ret); + QL_DPRINT2(ha, "exit \n"); return; } @@ -611,6 +612,17 @@ qlnx_drain_fp_taskqueues(qlnx_host_t *ha) return; } +static void +qlnx_get_params(qlnx_host_t *ha) +{ + if ((qlnxe_queue_count < 0) || (qlnxe_queue_count > QLNX_MAX_RSS)) { + device_printf(ha->pci_dev, "invalid queue_count value (%d)\n", + qlnxe_queue_count); + qlnxe_queue_count = 0; + } + return; +} + /* * Name: qlnx_pci_attach * Function: attaches the device to the operating system @@ -706,10 +718,21 @@ qlnx_pci_attach(device_t dev) if (qlnx_init_hw(ha) != 0) goto qlnx_pci_attach_err; + qlnx_get_params(ha); + + if((pci_get_device(dev) == QLOGIC_PCI_DEVICE_ID_1644) && + (qlnxe_queue_count == QLNX_DEFAULT_RSS)) { + qlnxe_queue_count = QLNX_MAX_RSS; + } + /* * Allocate MSI-x vectors */ - ha->num_rss = QLNX_MAX_RSS; + if(qlnxe_queue_count == 0) + ha->num_rss = QLNX_DEFAULT_RSS; + else + ha->num_rss = qlnxe_queue_count; + ha->num_tc = QLNX_MAX_TC; ha->msix_count = pci_msix_count(dev); @@ -1236,6 +1259,44 @@ qlnx_add_fp_stats_sysctls(qlnx_host_t *ha) CTLFLAG_RD, &ha->fp_array[i].tx_pkts_completed, "No. of transmit completions"); + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_non_tso_pkts", + CTLFLAG_RD, &ha->fp_array[i].tx_non_tso_pkts, + "No. of non LSO transmited packets"); + +#ifdef QLNX_TRACE_PERF_DATA + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_trans_ctx", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_trans_ctx, + "No. of transmitted packets in transmit context"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_ctx", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_ctx, + "No. of transmit completions in transmit context"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_trans_fp", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_trans_fp, + "No. of transmitted packets in taskqueue"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_fp", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_fp, + "No. of transmit completions in taskqueue"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_intr", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_intr, + "No. of transmit completions in interrupt ctx"); +#endif + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_tso_pkts", + CTLFLAG_RD, &ha->fp_array[i].tx_tso_pkts, + "No. of LSO transmited packets"); + SYSCTL_ADD_QUAD(ctx, node_children, OID_AUTO, "tx_lso_wnd_min_len", CTLFLAG_RD, &ha->fp_array[i].tx_lso_wnd_min_len, @@ -1284,6 +1345,39 @@ qlnx_add_fp_stats_sysctls(qlnx_host_t *ha) &ha->fp_array[i].tx_pkts[j], name_str); } +#ifdef QLNX_TRACE_PERF_DATA + for (j = 0; j < 18; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_pkts_hist_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_pkts_hist[j], name_str); + } + for (j = 0; j < 5; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_comInt_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_comInt[j], name_str); + } + for (j = 0; j < 18; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_pkts_q_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_pkts_q[j], name_str); + } +#endif + SYSCTL_ADD_QUAD(ctx, node_children, OID_AUTO, "err_tx_nsegs_gt_elem_left", CTLFLAG_RD, &ha->fp_array[i].err_tx_nsegs_gt_elem_left, @@ -1979,6 +2073,12 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) ifp->if_capabilities |= IFCAP_TSO6; ifp->if_capabilities |= IFCAP_LRO; + ifp->if_hw_tsomax = QLNX_MAX_TSO_FRAME_SIZE - + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + ifp->if_hw_tsomaxsegcount = QLNX_MAX_SEGMENTS - 1 /* hdr */; + ifp->if_hw_tsomaxsegsize = QLNX_MAX_TX_MBUF_SIZE; + + ifp->if_capenable = ifp->if_capabilities; ifp->if_hwassist = CSUM_IP; @@ -2543,6 +2643,7 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, u16 hw_bd_cons; u16 ecore_cons_idx; uint16_t diff; + uint16_t idx, idx2; hw_bd_cons = le16toh(*txq->hw_cons_ptr); @@ -2580,6 +2681,11 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, qlnx_trigger_dump(ha); } + idx = (txq->sw_tx_cons + 1) & (TX_RING_SIZE - 1); + idx2 = (txq->sw_tx_cons + 2) & (TX_RING_SIZE - 1); + prefetch(txq->sw_tx_ring[idx].mp); + prefetch(txq->sw_tx_ring[idx2].mp); + qlnx_free_tx_pkt(ha, fp, txq); txq->sw_tx_cons = (txq->sw_tx_cons + 1) & (TX_RING_SIZE - 1); @@ -2588,12 +2694,71 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, } static int +qlnx_transmit_locked(struct ifnet *ifp,struct qlnx_fastpath *fp, struct mbuf *mp) +{ + int ret = 0; + struct qlnx_tx_queue *txq; + qlnx_host_t * ha; + uint16_t elem_left; + + txq = fp->txq[0]; + ha = (qlnx_host_t *)fp->edev; + + + if ((!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || (!ha->link_up)) { + if(mp != NULL) + ret = drbr_enqueue(ifp, fp->tx_br, mp); + return (ret); + } + + if(mp != NULL) + ret = drbr_enqueue(ifp, fp->tx_br, mp); + + mp = drbr_peek(ifp, fp->tx_br); + + while (mp != NULL) { + + if (qlnx_send(ha, fp, &mp)) { + + if (mp != NULL) { + drbr_putback(ifp, fp->tx_br, mp); + } else { + fp->tx_pkts_processed++; + drbr_advance(ifp, fp->tx_br); + } + goto qlnx_transmit_locked_exit; + + } else { + drbr_advance(ifp, fp->tx_br); + fp->tx_pkts_transmitted++; + fp->tx_pkts_processed++; + } + + mp = drbr_peek(ifp, fp->tx_br); + } + +qlnx_transmit_locked_exit: + if((qlnx_num_tx_compl(ha,fp, fp->txq[0]) > QLNX_TX_COMPL_THRESH) || + ((int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl)) + < QLNX_TX_ELEM_MAX_THRESH)) + (void)qlnx_tx_int(ha, fp, fp->txq[0]); + + QL_DPRINT2(ha, "%s: exit ret = %d\n", __func__, ret); + return ret; +} + + +static int qlnx_transmit(struct ifnet *ifp, struct mbuf *mp) { qlnx_host_t *ha = (qlnx_host_t *)ifp->if_softc; struct qlnx_fastpath *fp; int rss_id = 0, ret = 0; +#ifdef QLNX_TRACEPERF_DATA + uint64_t tx_pkts = 0, tx_compl = 0; +#endif + QL_DPRINT2(ha, "enter\n"); #if __FreeBSD_version >= 1100000 @@ -2611,15 +2776,27 @@ qlnx_transmit(struct ifnet *ifp, struct mbuf *mp) goto qlnx_transmit_exit; } - if (mp != NULL) { - ret = drbr_enqueue(ifp, fp->tx_br, mp); - } + if (mtx_trylock(&fp->tx_mtx)) { - if (fp->fp_taskqueue != NULL) - taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); +#ifdef QLNX_TRACEPERF_DATA + tx_pkts = fp->tx_pkts_transmitted; + tx_compl = fp->tx_pkts_completed; +#endif - ret = 0; + ret = qlnx_transmit_locked(ifp, fp, mp); +#ifdef QLNX_TRACEPERF_DATA + fp->tx_pkts_trans_ctx += (fp->tx_pkts_transmitted - tx_pkts); + fp->tx_pkts_compl_ctx += (fp->tx_pkts_completed - tx_compl); +#endif + mtx_unlock(&fp->tx_mtx); + } else { + if (mp != NULL && (fp->fp_taskqueue != NULL)) { + ret = drbr_enqueue(ifp, fp->tx_br, mp); + taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); + } + } + qlnx_transmit_exit: QL_DPRINT2(ha, "exit ret = %d\n", ret); @@ -2799,6 +2976,10 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s uint32_t nbds_in_hdr = 0; uint32_t offset = 0; +#ifdef QLNX_TRACE_PERF_DATA + uint16_t bd_used; +#endif + QL_DPRINT8(ha, "enter\n"); if (!ha->link_up) @@ -2811,15 +2992,15 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s txq = fp->txq[0]; - if (fp->tx_ring_full) { - elem_left = ecore_chain_get_elem_left(&txq->tx_pbl); + if ((int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl)) < + QLNX_TX_ELEM_MIN_THRESH) { - if (elem_left < (TX_RING_SIZE >> 4)) - return (-1); - else - fp->tx_ring_full = 0; - } + fp->tx_nsegs_gt_elem_left++; + fp->err_tx_nsegs_gt_elem_left++; + return (ENOBUFS); + } + idx = txq->sw_tx_prod; map = txq->sw_tx_ring[idx].map; @@ -2829,14 +3010,18 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s BUS_DMA_NOWAIT); if (ha->dbg_trace_tso_pkt_len) { - if (!fp->tx_tso_min_pkt_len) { - fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - } else { - if (fp->tx_tso_min_pkt_len > m_head->m_pkthdr.len) + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + if (!fp->tx_tso_min_pkt_len) { fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - if (fp->tx_tso_max_pkt_len < m_head->m_pkthdr.len) - fp->tx_tso_max_pkt_len = m_head->m_pkthdr.len; + fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; + } else { + if (fp->tx_tso_min_pkt_len > m_head->m_pkthdr.len) + fp->tx_tso_min_pkt_len = + m_head->m_pkthdr.len; + if (fp->tx_tso_max_pkt_len < m_head->m_pkthdr.len) + fp->tx_tso_max_pkt_len = + m_head->m_pkthdr.len; + } } } @@ -2923,6 +3108,105 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s fp->tx_pkts[(QLNX_FP_MAX_SEGS - 1)]++; } +#ifdef QLNX_TRACE_PERF_DATA + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + if(m_head->m_pkthdr.len <= 2048) + fp->tx_pkts_hist[0]++; + else if((m_head->m_pkthdr.len > 2048) && + (m_head->m_pkthdr.len <= 4096)) + fp->tx_pkts_hist[1]++; + else if((m_head->m_pkthdr.len > 4096) && + (m_head->m_pkthdr.len <= 8192)) + fp->tx_pkts_hist[2]++; + else if((m_head->m_pkthdr.len > 8192) && + (m_head->m_pkthdr.len <= 12288 )) + fp->tx_pkts_hist[3]++; + else if((m_head->m_pkthdr.len > 11288) && + (m_head->m_pkthdr.len <= 16394)) + fp->tx_pkts_hist[4]++; + else if((m_head->m_pkthdr.len > 16384) && + (m_head->m_pkthdr.len <= 20480)) + fp->tx_pkts_hist[5]++; + else if((m_head->m_pkthdr.len > 20480) && + (m_head->m_pkthdr.len <= 24576)) + fp->tx_pkts_hist[6]++; + else if((m_head->m_pkthdr.len > 24576) && + (m_head->m_pkthdr.len <= 28672)) + fp->tx_pkts_hist[7]++; + else if((m_head->m_pkthdr.len > 28762) && + (m_head->m_pkthdr.len <= 32768)) + fp->tx_pkts_hist[8]++; + else if((m_head->m_pkthdr.len > 32768) && + (m_head->m_pkthdr.len <= 36864)) + fp->tx_pkts_hist[9]++; + else if((m_head->m_pkthdr.len > 36864) && + (m_head->m_pkthdr.len <= 40960)) + fp->tx_pkts_hist[10]++; + else if((m_head->m_pkthdr.len > 40960) && + (m_head->m_pkthdr.len <= 45056)) + fp->tx_pkts_hist[11]++; + else if((m_head->m_pkthdr.len > 45056) && + (m_head->m_pkthdr.len <= 49152)) + fp->tx_pkts_hist[12]++; + else if((m_head->m_pkthdr.len > 49512) && + m_head->m_pkthdr.len <= 53248)) + fp->tx_pkts_hist[13]++; + else if((m_head->m_pkthdr.len > 53248) && + (m_head->m_pkthdr.len <= 57344)) + fp->tx_pkts_hist[14]++; + else if((m_head->m_pkthdr.len > 53248) && + (m_head->m_pkthdr.len <= 57344)) + fp->tx_pkts_hist[15]++; + else if((m_head->m_pkthdr.len > 57344) && + (m_head->m_pkthdr.len <= 61440)) + fp->tx_pkts_hist[16]++; + else + fp->tx_pkts_hist[17]++; + } + + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + + elem_left = ecore_chain_get_elem_left(&txq->tx_pbl); + bd_used = TX_RING_SIZE - elem_left; + + if(bd_used <= 100) + fp->tx_pkts_q[0]++; + else if((bd_used > 100) && (bd_used <= 500)) + fp->tx_pkts_q[1]++; + else if((bd_used > 500) && (bd_used <= 1000)) + fp->tx_pkts_q[2]++; + else if((bd_used > 1000) && (bd_used <= 2000)) + fp->tx_pkts_q[3]++; + else if((bd_used > 3000) && (bd_used <= 4000)) + fp->tx_pkts_q[4]++; + else if((bd_used > 4000) && (bd_used <= 5000)) + fp->tx_pkts_q[5]++; + else if((bd_used > 6000) && (bd_used <= 7000)) + fp->tx_pkts_q[6]++; + else if((bd_used > 7000) && (bd_used <= 8000)) + fp->tx_pkts_q[7]++; + else if((bd_used > 8000) && (bd_used <= 9000)) + fp->tx_pkts_q[8]++; + else if((bd_used > 9000) && (bd_used <= 10000)) + fp->tx_pkts_q[9]++; + else if((bd_used > 10000) && (bd_used <= 11000)) + fp->tx_pkts_q[10]++; + else if((bd_used > 11000) && (bd_used <= 12000)) + fp->tx_pkts_q[11]++; + else if((bd_used > 12000) && (bd_used <= 13000)) + fp->tx_pkts_q[12]++; + else if((bd_used > 13000) && (bd_used <= 14000)) + fp->tx_pkts_q[13]++; + else if((bd_used > 14000) && (bd_used <= 15000)) + fp->tx_pkts_q[14]++; + else if((bd_used > 15000) && (bd_used <= 16000)) + fp->tx_pkts_q[15]++; + else + fp->tx_pkts_q[16]++; + } + +#endif /* end of QLNX_TRACE_PERF_DATA */ + if ((nsegs + QLNX_TX_ELEM_RESERVE) > (int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl))) { @@ -2943,7 +3227,8 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s fp->err_tx_nsegs_gt_elem_left++; fp->tx_ring_full = 1; - ha->storm_stats_enable = 1; + if (ha->storm_stats_enable) + ha->storm_stats_gather = 1; return (ENOBUFS); } } @@ -3131,6 +3416,7 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s third_bd->data.bitfields |= (nbds_in_hdr<tx_tso_pkts++; } else { segs++; for (seg_idx = 1; seg_idx < nsegs; seg_idx++) { @@ -3147,6 +3433,7 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s << ETH_TX_DATA_1ST_BD_PKT_LEN_SHIFT; first_bd->data.bitfields = htole16(first_bd->data.bitfields); + fp->tx_non_tso_pkts++; } @@ -4303,8 +4590,10 @@ qlnx_fp_isr(void *arg) if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); #else - int rx_int = 0, total_rx_count = 0; - int lro_enable, tc; + int rx_int = 0, total_rx_count = 0; + int lro_enable, tc; + struct qlnx_tx_queue *txq; + uint16_t elem_left; lro_enable = ha->ifp->if_capenable & IFCAP_LRO; @@ -4312,10 +4601,36 @@ qlnx_fp_isr(void *arg) do { for (tc = 0; tc < ha->num_tc; tc++) { - if (mtx_trylock(&fp->tx_mtx)) { - qlnx_tx_int(ha, fp, fp->txq[tc]); - mtx_unlock(&fp->tx_mtx); - } + + txq = fp->txq[tc]; + + if((int)(elem_left = + ecore_chain_get_elem_left(&txq->tx_pbl)) < + QLNX_TX_ELEM_THRESH) { + + if (mtx_trylock(&fp->tx_mtx)) { +#ifdef QLNX_TRACE_PERF_DATA + tx_compl = fp->tx_pkts_completed; +#endif + + qlnx_tx_int(ha, fp, fp->txq[tc]); +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_compl_intr += + (fp->tx_pkts_completed - tx_compl); + if ((fp->tx_pkts_completed - tx_compl) <= 32) + fp->tx_comInt[0]++; + else if (((fp->tx_pkts_completed - tx_compl) > 32) && + ((fp->tx_pkts_completed - tx_compl) <= 64)) + fp->tx_comInt[1]++; + else if(((fp->tx_pkts_completed - tx_compl) > 64) && + ((fp->tx_pkts_completed - tx_compl) <= 128)) + fp->tx_comInt[2]++; + else if(((fp->tx_pkts_completed - tx_compl) > 128)) + fp->tx_comInt[3]++; +#endif + mtx_unlock(&fp->tx_mtx); + } + } } rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, @@ -4328,7 +4643,6 @@ qlnx_fp_isr(void *arg) } while (rx_int); - #ifdef QLNX_SOFT_LRO { struct lro_ctrl *lro; @@ -4608,8 +4922,8 @@ qlnx_alloc_tx_dma_tag(qlnx_host_t *ha) NULL, NULL, /* filter, filterarg */ QLNX_MAX_TSO_FRAME_SIZE, /* maxsize */ QLNX_MAX_SEGMENTS, /* nsegments */ - (PAGE_SIZE * 4), /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + QLNX_MAX_TX_MBUF_SIZE, /* maxsegsize */ + 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ &ha->tx_tag)) { @@ -4642,7 +4956,7 @@ qlnx_alloc_rx_dma_tag(qlnx_host_t *ha) MJUM9BYTES, /* maxsize */ 1, /* nsegments */ MJUM9BYTES, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ &ha->rx_tag)) { @@ -5255,6 +5569,14 @@ qlnx_init_fp(qlnx_host_t *ha) fp->tx_pkts_freed = 0; fp->tx_pkts_transmitted = 0; fp->tx_pkts_completed = 0; + +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_trans_ctx = 0; + fp->tx_pkts_compl_ctx = 0; + fp->tx_pkts_trans_fp = 0; + fp->tx_pkts_compl_fp = 0; + fp->tx_pkts_compl_intr = 0; +#endif fp->tx_lso_wnd_min_len = 0; fp->tx_defrag = 0; fp->tx_nsegs_gt_elem_left = 0; @@ -6606,7 +6928,7 @@ qlnx_timer(void *arg) ecore_get_vport_stats(&ha->cdev, &ha->hw_stats); - if (ha->storm_stats_enable) + if (ha->storm_stats_gather) qlnx_sample_storm_stats(ha); callout_reset(&ha->qlnx_callout, hz, qlnx_timer, ha); @@ -6855,7 +7177,7 @@ qlnx_sample_storm_stats(qlnx_host_t *ha) struct ecore_hwfn *hwfn; if (ha->storm_stats_index >= QLNX_STORM_STATS_SAMPLES_PER_HWFN) { - ha->storm_stats_enable = 0; + ha->storm_stats_gather = 0; return; } Modified: head/sys/dev/qlnx/qlnxe/qlnx_ver.h ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_ver.h Fri Aug 11 17:05:31 2017 (r322407) +++ head/sys/dev/qlnx/qlnxe/qlnx_ver.h Fri Aug 11 17:43:25 2017 (r322408) @@ -39,5 +39,5 @@ #define QLNX_VERSION_MAJOR 1 #define QLNX_VERSION_MINOR 4 -#define QLNX_VERSION_BUILD 6 +#define QLNX_VERSION_BUILD 7 Modified: head/sys/modules/qlnx/qlnxe/Makefile ============================================================================== --- head/sys/modules/qlnx/qlnxe/Makefile Fri Aug 11 17:05:31 2017 (r322407) +++ head/sys/modules/qlnx/qlnxe/Makefile Fri Aug 11 17:43:25 2017 (r322408) @@ -52,7 +52,7 @@ SRCS+= pci_if.h .include -CFLAGS += -DQLNX_DEBUG +#CFLAGS += -DQLNX_DEBUG CFLAGS += -DECORE_PACKAGE CFLAGS += -DCONFIG_ECORE_L2 CFLAGS += -DECORE_CONFIG_DIRECT_HWFN From owner-svn-src-head@freebsd.org Fri Aug 11 18:09:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35D19DDF054; Fri, 11 Aug 2017 18:09:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0396B8105C; Fri, 11 Aug 2017 18:09:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BI9RKF014245; Fri, 11 Aug 2017 18:09:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BI9R06014244; Fri, 11 Aug 2017 18:09:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708111809.v7BI9R06014244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 11 Aug 2017 18:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322409 - head/sys/arm/at91 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm/at91 X-SVN-Commit-Revision: 322409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 18:09:28 -0000 Author: emaste Date: Fri Aug 11 18:09:26 2017 New Revision: 322409 URL: https://svnweb.freebsd.org/changeset/base/322409 Log: Rename at91_pmc's M_PMC malloc type to avoid duplicate definition M_PMC is defined in sys/dev/hwpmc/hwpmc_mod.c, and the LINT kernel build fails when linking with lld due to a duplicate symbol error. Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/at91/at91_pmc.c Modified: head/sys/arm/at91/at91_pmc.c ============================================================================== --- head/sys/arm/at91/at91_pmc.c Fri Aug 11 17:43:25 2017 (r322408) +++ head/sys/arm/at91/at91_pmc.c Fri Aug 11 18:09:26 2017 (r322409) @@ -63,8 +63,8 @@ static struct at91_pmc_softc { static uint32_t pllb_init; -MALLOC_DECLARE(M_PMC); -MALLOC_DEFINE(M_PMC, "at91_pmc_clocks", "AT91 PMC Clock descriptors"); +MALLOC_DECLARE(M_PMC_CLK); +MALLOC_DEFINE(M_PMC_CLK, "at91_pmc_clocks", "AT91 PMC Clock descriptors"); #define AT91_PMC_BASE 0xffffc00 @@ -300,12 +300,12 @@ at91_pmc_clock_add(const char *name, uint32_t irq, struct at91_pmc_clock *clk; int i, buflen; - clk = malloc(sizeof(*clk), M_PMC, M_NOWAIT | M_ZERO); + clk = malloc(sizeof(*clk), M_PMC_CLK, M_NOWAIT | M_ZERO); if (clk == NULL) goto err; buflen = strlen(name) + 1; - clk->name = malloc(buflen, M_PMC, M_NOWAIT); + clk->name = malloc(buflen, M_PMC_CLK, M_NOWAIT); if (clk->name == NULL) goto err; @@ -326,8 +326,8 @@ at91_pmc_clock_add(const char *name, uint32_t irq, err: if (clk != NULL) { if (clk->name != NULL) - free(clk->name, M_PMC); - free(clk, M_PMC); + free(clk->name, M_PMC_CLK); + free(clk, M_PMC_CLK); } panic("could not allocate pmc clock '%s'", name); From owner-svn-src-head@freebsd.org Fri Aug 11 18:40:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 108D3DE0994; Fri, 11 Aug 2017 18:40:19 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBBBF82353; Fri, 11 Aug 2017 18:40:18 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-io0-x241.google.com with SMTP id q64so3946608ioi.0; Fri, 11 Aug 2017 11:40:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VTWNxO4gcQgtT7+0+aeH7a3UF7zz78wDDfl1ri+XYLQ=; b=j3eQQSkzEURa0lhNSG7U1KWiEn1X1r5fhBuAONUK0aPID73dNrBT4gyw96KrYBR266 b6Fh1QkOl5X2HfZ/xN7nji+QRNK0R2LIs9r1W4sTbogzxgODcqNryr2ewYW6E/ncwB7J lG6NhNzRLFOTg0+lBJjYvv6UFi97wFXh+LzX2IUe1Byr7Kubyyb+1Y/0SBgs+jaIa7Qc 9dtbw7i7DFzTUvGD8BXp4p+5T+Kt9Zrfa+NPkxHjs5888XOOFnlCrS7A2w+PO5AkryVK vQmlrWENDK1heqqd3yHjDXaD/OLeqtk3DB7PVmLDB1jiGrwiGWdLuA6XbkvrtMpv+DVx bmYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VTWNxO4gcQgtT7+0+aeH7a3UF7zz78wDDfl1ri+XYLQ=; b=m5JkozCZFY0T2XSYO5qcita7EgVtVz5trV4RoXqTyJef1Zv5OvUeZy0W435DdNrvQk ddPb7c+iS5nxiGYqOo2oJGPLwwgItx+bX2wmNTMzXzeKQqwzw/rv4cIsMs2QDctTlElp AiZGOuIZ+lCOvQbEcryVpgkCwHKFfyDd7Au7vo2SNtlPQGa9WXLvwZGmntBXw7jv7xdQ nDrt7W9n6orH8Xv4DwW7hqN/TDVzDXdwhuDO6AF9XMrdPRsJq7KBzZLIuzUNk0Es9sso hItDw1WQJiX02X8QV1HbWN2g5dIXretlAiq18qawaNcgYRsk75nRjeYDpBCph9kOpCdT RxGQ== X-Gm-Message-State: AHYfb5hGZ7S/hwchroS28Zv/8hOEj5/85dxHH7/LyB4O7tMIimNN1ukP qSfq7pQ+LsXwktgGLyc= X-Received: by 10.107.52.6 with SMTP id b6mr10814381ioa.162.1502476818126; Fri, 11 Aug 2017 11:40:18 -0700 (PDT) Received: from ?IPv6:2607:fb90:6c47:db5a:5118:d2cf:3ecb:8385? ([2607:fb90:6c47:db5a:5118:d2cf:3ecb:8385]) by smtp.gmail.com with ESMTPSA id d96sm673222ioj.75.2017.08.11.11.40.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Aug 2017 11:40:17 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r322371 - head/lib/libc/tests/gen From: Ngie Cooper X-Mailer: iPhone Mail (14G60) In-Reply-To: <201708101703.v7AH3kju098213@repo.freebsd.org> Date: Fri, 11 Aug 2017 12:40:15 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <29D777B5-212F-47DD-991D-34C2A69F90E3@gmail.com> References: <201708101703.v7AH3kju098213@repo.freebsd.org> To: "Pedro F. Giffuni" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 18:40:19 -0000 > On Aug 10, 2017, at 11:03, Pedro F. Giffuni wrote: > > Author: pfg > Date: Thu Aug 10 17:03:46 2017 > New Revision: 322371 > URL: https://svnweb.freebsd.org/changeset/base/322371 > > Log: > fnmatch(3): Update testcase for r322368. > > Modified: > head/lib/libc/tests/gen/fnmatch_testcases.h Thank you!! -Ngie From owner-svn-src-head@freebsd.org Fri Aug 11 18:43:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B6F3DE0D73; Fri, 11 Aug 2017 18:43:54 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 188BA8290D; Fri, 11 Aug 2017 18:43:54 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BIhrI8030560; Fri, 11 Aug 2017 18:43:53 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BIhrri030559; Fri, 11 Aug 2017 18:43:53 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708111843.v7BIhrri030559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 11 Aug 2017 18:43:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322410 - head/usr.bin/mt X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: head/usr.bin/mt X-SVN-Commit-Revision: 322410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 18:43:54 -0000 Author: ken Date: Fri Aug 11 18:43:52 2017 New Revision: 322410 URL: https://svnweb.freebsd.org/changeset/base/322410 Log: Add historical notes on QIC tape drives and fix a couple of issues in mt(1). o Density code 0x5 is also known as QIC-11, and should have a footnote reference. o Add notes on QIC tape drives from the bug report. These may help anyone trying to use a QIC drive. o Take out a "more more" instance found by igor. o Bump the man page date. The PR is 14 years old, so it's past time to retire it. PR: doc/53596 Submitted by: tedm@toybox.placo.com Reviewed by: bcr Sponsored by: Spectra Logic Modified: head/usr.bin/mt/mt.1 Modified: head/usr.bin/mt/mt.1 ============================================================================== --- head/usr.bin/mt/mt.1 Fri Aug 11 18:09:26 2017 (r322409) +++ head/usr.bin/mt/mt.1 Fri Aug 11 18:43:52 2017 (r322410) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd August 3, 2017 +.Dd August 11, 2017 .Dt MT 1 .Os .Sh NAME @@ -333,7 +333,7 @@ The default protection method used is Reed-Solomon CRC 1), as specified in ECMA-319. The default protection information length used with Reed-Solomon CRC is 4 bytes. -To enable all settings except one more more settings, specify the +To enable all settings except one more setting, specify the .Fl e argument and then explicitly disable settings that you do not wish to enable. @@ -463,7 +463,7 @@ Value Width Tracks Density Code Typ 0x01 12.7 (0.5) 9 32 (800) NRZI R X3.22-1983 2 0x02 12.7 (0.5) 9 63 (1,600) PE R X3.39-1986 2 0x03 12.7 (0.5) 9 246 (6,250) GCR R X3.54-1986 2 -0x05 6.3 (0.25) 4/9 315 (8,000) GCR C X3.136-1986 1 +0x05 6.3 (0.25) 4/9 315 (8,000) GCR C X3.136-1986 1,3 0x06 12.7 (0.5) 9 126 (3,200) PE R X3.157-1987 2 0x07 6.3 (0.25) 4 252 (6,400) IMFM C X3.116-1986 1 0x08 3.81 (0.15) 4 315 (8,000) GCR CS X3.158-1987 1 @@ -566,6 +566,60 @@ NOTES density code is 0x8c. 13. This density code (0x48) was also used for DAT-160. .Ed +.Bd -literal -offset 2n +NOTE ON QIC STREAMERS + +The following is a table of Data Cartridge types as used in the 1/4 inch +tape drives such as the Archive Viper 150, Wangtek 5525ES, and Tandberg +TDC4220 tape drives: + +Value Reference Format Cartridge Type Capacity Tracks Length +----- --------- ------ -------------- -------- ------ ------ + +0x05 QIC-11 DC300 15MB 4 300ft +0x05 QIC-11 DC300XL/P 20MB 4 450ft +0x05 QIC-11 DC600 27MB 4 600ft +0x05 X3.136-1986 QIC-24 DC615A 15MB 9 150ft +0x05 X3.136-1986 QIC-24 DC300XL/P 45MB 9 450ft +0x05 X3.136-1986 QIC-24 DC600A 60MB 9 600ft +0x0F QIC-120 QIC-120 DC600A/DC6150 120MB 15 620ft +0x10 QIC-150 QIC-150 DC600XTD/DC6150 150MB 18 620ft +0x10 QIC-150 QIC-150 DC6250 250MB 18 1,020ft +0x11 QIC-320 QIC-525 DC6320 320MB 26 620ft +0x11 QIC-320 QIC-525 DC6525 525MB 26 1,020ft +0x1E QIC-1000C QIC-1000 DC9100/DL9135 1.0GB 30 760ft +0x1E QIC-1000C QIC-1000 DC9150 1.2GB 30 950ft +0x22 QIC-2GB(C) QIC-2GB DC9200 2.0GB 42 950ft +0x22 QIC-2GB(C) QIC-2GB DC9250 2.5GB 42 1,200ft +.Ed +.Pp +Notes: +.Pp +QIC-24, QIC-120, QIC-150 use fixed blocksize of 512 bytes, QIC-525, QIC-1000 +and QIC-2GB can use blocksize of 1,024 bytes. +DDS (DAT) drives generally use variable blocks. +.Pp +QIC-02 and QIC-36 are interface standards for tape drives. +The QIC-02 and QIC-36 streamers such as the Wangtek 5250EQ are otherwise +identical to their SCSI versions (i.e.: Wangtek 5250ES). +.Pp +It seems that the 150MB and larger streamers cannot write QIC-24 9 track +formats, only read them. +.Pp +DC600A cartridges marked "10,000ftpi" can only be used as QIC-11, QIC-24, +and QIC-120 format. +DC600A cartridges marked 12,500ftpi can be used as both QIC-120 and QIC-150 +format. +.Pp +Some manufacturers do not use "DC" on their cartridges. +Verbatim uses DL, Maxell uses MC, Sony uses QD, Quill uses DQ. +.Pp +3M/Imation & Fuji use DC. +Thus a DL6250, MC-6250, QD6250, DQ6250 are all identical media to a DC6250. +.Pp +QIC tape media is not "connected" to the take up reels and will de-spool +if the tape drive has dust covering the light sensor that looks for the end +of tape holes in the media. .Sh ENVIRONMENT .Bl -tag -width ".Ev TAPE" .It Ev TAPE From owner-svn-src-head@freebsd.org Fri Aug 11 19:02:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02346D9441F; Fri, 11 Aug 2017 19:02:13 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C37E7837AF; Fri, 11 Aug 2017 19:02:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BJ2BkI038632; Fri, 11 Aug 2017 19:02:11 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BJ2BEG038353; Fri, 11 Aug 2017 19:02:11 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708111902.v7BJ2BEG038353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 11 Aug 2017 19:02:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322411 - in head/sys: dev/xen/timer isa x86/isa X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: dev/xen/timer isa x86/isa X-SVN-Commit-Revision: 322411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 19:02:13 -0000 Author: ian Date: Fri Aug 11 19:02:11 2017 New Revision: 322411 URL: https://svnweb.freebsd.org/changeset/base/322411 Log: Stop calling atrtc_set() from the xen timer clock_settime() method. That removes the only reference to atrtc_set() from outside of atrtc.c, so make it static. The xen timer driver registers as a realtime clock with 1us resolution. In the past that resulted in only the xen timer's clock_settime() getting called, so it would call atrtc_set() to set the hardware clock as well. As of r32090, the clock_settime() method of all registered realtime clocks gets called, so the xen driver no longer needs to chain-call the lower-resolution driver. Thanks to royger@ for talking me through the xen stuff, and for testing. Modified: head/sys/dev/xen/timer/timer.c head/sys/isa/rtc.h head/sys/x86/isa/atrtc.c Modified: head/sys/dev/xen/timer/timer.c ============================================================================== --- head/sys/dev/xen/timer/timer.c Fri Aug 11 18:43:52 2017 (r322410) +++ head/sys/dev/xen/timer/timer.c Fri Aug 11 19:02:11 2017 (r322411) @@ -64,8 +64,6 @@ __FBSDID("$FreeBSD$"); #include -#include - #include "clock_if.h" static devclass_t xentimer_devclass; @@ -228,9 +226,6 @@ xentimer_settime(device_t dev __unused, struct timespe */ if (!xen_initial_domain()) return (0); - - /* Set the native RTC. */ - atrtc_set(ts); settime.cmd = XENPF_settime64; settime.u.settime64.mbz = 0; Modified: head/sys/isa/rtc.h ============================================================================== --- head/sys/isa/rtc.h Fri Aug 11 18:43:52 2017 (r322410) +++ head/sys/isa/rtc.h Fri Aug 11 19:02:11 2017 (r322411) @@ -118,7 +118,6 @@ extern int atrtcclock_disable; int rtcin(int reg); void atrtc_restore(void); void writertc(int reg, u_char val); -void atrtc_set(struct timespec *ts); #endif #endif /* _I386_ISA_RTC_H_ */ Modified: head/sys/x86/isa/atrtc.c ============================================================================== --- head/sys/x86/isa/atrtc.c Fri Aug 11 18:43:52 2017 (r322410) +++ head/sys/x86/isa/atrtc.c Fri Aug 11 19:02:11 2017 (r322411) @@ -164,7 +164,7 @@ atrtc_restore(void) rtcin(RTC_INTR); } -void +static void atrtc_set(struct timespec *ts) { struct clocktime ct; From owner-svn-src-head@freebsd.org Fri Aug 11 19:21:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8964DB5989; Fri, 11 Aug 2017 19:21:41 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B597A6A0; Fri, 11 Aug 2017 19:21:41 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BJLefA044687; Fri, 11 Aug 2017 19:21:40 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BJLeLF044683; Fri, 11 Aug 2017 19:21:40 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708111921.v7BJLeLF044683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 11 Aug 2017 19:21:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322412 - in head: . release/packages share/mk X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in head: . release/packages share/mk X-SVN-Commit-Revision: 322412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 19:21:42 -0000 Author: gjb Date: Fri Aug 11 19:21:40 2017 New Revision: 322412 URL: https://svnweb.freebsd.org/changeset/base/322412 Log: Add SVNVERSION_CMD to bsd.own.mk, adding the capability to include svnversion metadata to the runtime and kernel packages. Instead of traversing src/sys, as is done by newvers.sh for uname(1), a full tree walk is done to prevent userland and/or modifications from not being reflected in a modified tree (M). MFC after: 5 days Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 head/release/packages/kernel.ucl head/release/packages/runtime.ucl head/share/mk/bsd.own.mk Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Aug 11 19:02:11 2017 (r322411) +++ head/Makefile.inc1 Fri Aug 11 19:21:40 2017 (r322412) @@ -346,6 +346,12 @@ SVN= ${_P}/${_S} . endfor .endif SVNFLAGS?= -r HEAD +.if !defined(VCS_REVISION) && empty(VCS_REVISION) +_VCS_REVISION?= $$(eval ${SVNVERSION_CMD} ${SRCDIR}) +. if !empty(_VCS_REVISION) +VCS_REVISION= $$(echo r${_VCS_REVISION}) +. endif +.endif .if !defined(OSRELDATE) .if exists(/usr/include/osreldate.h) @@ -1626,9 +1632,10 @@ create-world-package-${pkgname}: .PHONY @awk -F\" ' \ /^name/ { printf("===> Creating %s-", $$2); next } \ /^version/ { print $$2; next } \ - ' ${WSTAGEDIR}/${pkgname}.ucl ; + ' ${WSTAGEDIR}/${pkgname}.ucl @if [ "${pkgname}" == "runtime" ]; then \ sed -i '' -e "s/%KERNCONF%/${INSTALLKERNEL:tl}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ + sed -i '' -e "s/%VCS_REVISION%/${VCS_REVISION}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ fi ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ create -M ${WSTAGEDIR}/${pkgname}.ucl \ @@ -1658,6 +1665,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ -e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \ + -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ ${SRCDIR}/release/packages/kernel.ucl \ > ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ awk -F\" ' \ @@ -1692,6 +1700,7 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_ -e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ -e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \ + -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ ${SRCDIR}/release/packages/kernel.ucl \ > ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ awk -F\" ' \ Modified: head/release/packages/kernel.ucl ============================================================================== --- head/release/packages/kernel.ucl Fri Aug 11 19:02:11 2017 (r322411) +++ head/release/packages/kernel.ucl Fri Aug 11 19:21:40 2017 (r322412) @@ -5,7 +5,7 @@ name = "FreeBSD-%PKGNAME%" origin = "base" version = "%VERSION%" -comment = "%COMMENT%" +comment = "%COMMENT% %VCS_REVISION%" categories = [ base ] maintainer = "re@FreeBSD.org" www = "https://www.FreeBSD.org" Modified: head/release/packages/runtime.ucl ============================================================================== --- head/release/packages/runtime.ucl Fri Aug 11 19:02:11 2017 (r322411) +++ head/release/packages/runtime.ucl Fri Aug 11 19:21:40 2017 (r322412) @@ -5,7 +5,7 @@ name = "FreeBSD-%PKGNAME%" origin = "base" version = "%VERSION%" -comment = "%COMMENT%" +comment = "%COMMENT% %VCS_REVISION%" categories = [ base ] maintainer = "re@FreeBSD.org" www = "https://www.FreeBSD.org" Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Fri Aug 11 19:02:11 2017 (r322411) +++ head/share/mk/bsd.own.mk Fri Aug 11 19:21:40 2017 (r322412) @@ -233,6 +233,17 @@ XZ_CMD?= xz -T ${XZ_THREADS} XZ_CMD?= xz .endif +.if !defined(SVNVERSION_CMD) && empty(SVNVERSION_CMD) +. for _D in ${PATH:S,:, ,g} +. if exists(${_D}/svnversion) +SVNVERSION_CMD?=${_D}/svnversion +. endif +. if exists(${_D}/svnliteversion) +SVNVERSION_CMD?=${_D}/svnliteversion +. endif +. endfor +.endif + PKG_CMD?= pkg # Pointer to the top directory into which tests are installed. Should not be From owner-svn-src-head@freebsd.org Fri Aug 11 19:24:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4D48DB5DB6; Fri, 11 Aug 2017 19:24: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 mx1.freebsd.org (Postfix) with ESMTPS id 74EC99E9; Fri, 11 Aug 2017 19:24: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 v7BJO8bg047121; Fri, 11 Aug 2017 19:24:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BJO8H6047120; Fri, 11 Aug 2017 19:24:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708111924.v7BJO8H6047120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Aug 2017 19:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322413 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 322413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 19:24:09 -0000 Author: markj Date: Fri Aug 11 19:24:08 2017 New Revision: 322413 URL: https://svnweb.freebsd.org/changeset/base/322413 Log: Bump KERNELDUMP_BUFFER_SIZE to 4096. The encrypted kernel dump code writes data in blocks of this size. A buffer size of 4096 allows encrypted dumps to work with 4Kn drives. Reviewed by: cem Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11870 Modified: head/sys/sys/kerneldump.h Modified: head/sys/sys/kerneldump.h ============================================================================== --- head/sys/sys/kerneldump.h Fri Aug 11 19:21:40 2017 (r322412) +++ head/sys/sys/kerneldump.h Fri Aug 11 19:24:08 2017 (r322413) @@ -58,7 +58,7 @@ #define KERNELDUMP_ENC_NONE 0 #define KERNELDUMP_ENC_AES_256_CBC 1 -#define KERNELDUMP_BUFFER_SIZE 1024 +#define KERNELDUMP_BUFFER_SIZE 4096 #define KERNELDUMP_IV_MAX_SIZE 32 #define KERNELDUMP_KEY_MAX_SIZE 64 #define KERNELDUMP_ENCKEY_MAX_SIZE (16384 / 8) From owner-svn-src-head@freebsd.org Fri Aug 11 19:49:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECCC7DB7856; Fri, 11 Aug 2017 19:49:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBEDD18F3; Fri, 11 Aug 2017 19:49:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BJnTnV055133; Fri, 11 Aug 2017 19:49:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BJnTqd055132; Fri, 11 Aug 2017 19:49:29 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708111949.v7BJnTqd055132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 11 Aug 2017 19:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322414 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 322414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 19:49:31 -0000 Author: emaste Date: Fri Aug 11 19:49:29 2017 New Revision: 322414 URL: https://svnweb.freebsd.org/changeset/base/322414 Log: arm: enable ARM_MANY_BOARD in NOTES for LINT build Added in r238189, ARM_MANY_BOARD adds support for multiple ARM boards in a single kernel. Include it for LINT builds to avoid duplicate symbol errors when linking with lld. Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/conf/NOTES Modified: head/sys/arm/conf/NOTES ============================================================================== --- head/sys/arm/conf/NOTES Fri Aug 11 19:24:08 2017 (r322413) +++ head/sys/arm/conf/NOTES Fri Aug 11 19:49:29 2017 (r322414) @@ -36,6 +36,7 @@ options SOC_MV_DISCOVERY options SOC_MV_KIRKWOOD options SOC_MV_ORION +options ARM_MANY_BOARD device at91_board_bwct device at91_board_ethernut5 device at91_board_hl200 From owner-svn-src-head@freebsd.org Fri Aug 11 20:11:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B49D2DC2DD8; Fri, 11 Aug 2017 20:11:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FA2C265A; Fri, 11 Aug 2017 20:11:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BKBhmj064954; Fri, 11 Aug 2017 20:11:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BKBh5D064953; Fri, 11 Aug 2017 20:11:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708112011.v7BKBh5D064953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 11 Aug 2017 20:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322415 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 20:11:44 -0000 Author: emaste Date: Fri Aug 11 20:11:43 2017 New Revision: 322415 URL: https://svnweb.freebsd.org/changeset/base/322415 Log: lldb: enable on i386 It is functional on FreeBSD/i386 as of r322326. Sponsored by: The FreeBSD Foundation Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Aug 11 19:49:29 2017 (r322414) +++ head/share/mk/src.opts.mk Fri Aug 11 20:11:43 2017 (r322415) @@ -255,7 +255,7 @@ __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .else __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .endif -.if ${__T} == "aarch64" || ${__T} == "amd64" +.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" __DEFAULT_YES_OPTIONS+=LLDB .else __DEFAULT_NO_OPTIONS+=LLDB From owner-svn-src-head@freebsd.org Fri Aug 11 20:44:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04FC5DC4FB8; Fri, 11 Aug 2017 20:44:19 +0000 (UTC) (envelope-from bhd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C653E3730; Fri, 11 Aug 2017 20:44:18 +0000 (UTC) (envelope-from bhd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BKiHN7079274; Fri, 11 Aug 2017 20:44:17 GMT (envelope-from bhd@FreeBSD.org) Received: (from bhd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BKiHYU079273; Fri, 11 Aug 2017 20:44:17 GMT (envelope-from bhd@FreeBSD.org) Message-Id: <201708112044.v7BKiHYU079273@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bhd set sender to bhd@FreeBSD.org using -f From: Bjoern Heidotting Date: Fri, 11 Aug 2017 20:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322416 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: bhd X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 20:44:19 -0000 Author: bhd (doc committer) Date: Fri Aug 11 20:44:17 2017 New Revision: 322416 URL: https://svnweb.freebsd.org/changeset/base/322416 Log: add myself to calendar.freebsd Requested by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 11 20:11:43 2017 (r322415) +++ head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 11 20:44:17 2017 (r322416) @@ -60,6 +60,7 @@ 02/04 Eitan Adler born in West Hempstead, New York, United States, 1991 02/05 Frank Laszlo born in Howell, Michigan, United States, 1983 02/06 Julien Charbon born in Saint Etienne, Loire, France, 1978 +02/07 Bjoern Heidotting born in Uelsen, Germany, 1980 02/10 David Greenman born in Portland, Oregon, United States, 1968 02/10 Paul Richards born in Ammanford, Carmarthenshire, United Kingdom, 1968 02/10 Simon Barner born in Rosenheim, Bayern, Germany, 1980 From owner-svn-src-head@freebsd.org Fri Aug 11 20:46:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AC1FDC528B; Fri, 11 Aug 2017 20:46:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 35F4438F4; Fri, 11 Aug 2017 20:46:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id E406010AF0F; Fri, 11 Aug 2017 16:46:49 -0400 (EDT) From: John Baldwin To: Roger Pau =?ISO-8859-1?Q?Monn=E9?= Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322403 - head/sys/x86/acpica Date: Fri, 11 Aug 2017 12:14:09 -0700 Message-ID: <1711735.ULtvsIt8zT@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201708111419.v7BEJt6O018664@repo.freebsd.org> References: <201708111419.v7BEJt6O018664@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 11 Aug 2017 16:46:50 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 20:46:58 -0000 On Friday, August 11, 2017 02:19:55 PM Roger Pau Monn=E9 wrote: > Author: royger > Date: Fri Aug 11 14:19:55 2017 > New Revision: 322403 > URL: https://svnweb.freebsd.org/changeset/base/322403 >=20 > Log: > acpi/srat: fix build without DMAP > =20 > Use pmap_mapbios to map memory used to store the cpus array. > =20 > Reported by:=09lwhsu > X-MFC-with:=09r322348 >=20 > Modified: > head/sys/x86/acpica/srat.c >=20 > Modified: head/sys/x86/acpica/srat.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D > --- head/sys/x86/acpica/srat.c=09Fri Aug 11 14:19:31 2017=09(r322402)= > +++ head/sys/x86/acpica/srat.c=09Fri Aug 11 14:19:55 2017=09(r322403)= > @@ -443,7 +443,12 @@ parse_srat(void) > =09 ("Not enough memory for SRAT table items")); > =09phys_avail[idx + 1] =3D addr - 1; > =20 > -=09cpus =3D (struct cpu_info *)PHYS_TO_DMAP(addr); > +=09/* > +=09 * We cannot rely on PHYS_TO_DMAP because this code is also used = in > +=09 * i386, so use pmap_mapbios to map the memory, this will end up = using > +=09 * the default memory attribute (WB), and the DMAP when available= . > +=09 */ > +=09cpus =3D (struct cpu_info *)pmap_mapbios(addr, size); > =20 > =09/* > =09 * Make a pass over the table to populate the cpus[] and > @@ -529,6 +534,10 @@ srat_set_cpus(void *dummy) > =09=09=09printf("SRAT: CPU %u has memory domain %d\n", i, > =09=09=09 cpu->domain); > =09} > + > +=09/* Last usage of the cpus array, unmap it. */ > +=09pmap_unmapdev((vm_offset_t)cpus, sizeof(*cpus) * (max_apic_id + 1= )); Please pair pmap_mapbios with pmap_unmapbios. --=20 John Baldwin From owner-svn-src-head@freebsd.org Fri Aug 11 22:41:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 381A0DCC5DE; Fri, 11 Aug 2017 22:41:26 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 144D767D95; Fri, 11 Aug 2017 22:41:26 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BMfPGu028266; Fri, 11 Aug 2017 22:41:25 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BMfP5X028262; Fri, 11 Aug 2017 22:41:25 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708112241.v7BMfP5X028262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Fri, 11 Aug 2017 22:41:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322418 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 322418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 22:41:26 -0000 Author: rlibby Date: Fri Aug 11 22:41:24 2017 New Revision: 322418 URL: https://svnweb.freebsd.org/changeset/base/322418 Log: lib/msun: avoid referring to broken LDBL_MAX LDBL_MAX is broken on i386: https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32 for some time, and newer versions of gcc are now warning that the "floating constant exceeds range of 'long double'". Avoid this by referring to half the value of LDBL_MAX instead. Reviewed by: bde Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Modified: head/lib/msun/src/catrigl.c head/lib/msun/src/math_private.h head/lib/msun/src/s_csqrtl.c Modified: head/lib/msun/src/catrigl.c ============================================================================== --- head/lib/msun/src/catrigl.c Fri Aug 11 22:39:38 2017 (r322417) +++ head/lib/msun/src/catrigl.c Fri Aug 11 22:41:24 2017 (r322418) @@ -307,7 +307,7 @@ clog_for_large_values(long double complex z) ay = t; } - if (ax > LDBL_MAX / 2) + if (ax >= HALF_LDBL_MAX) return (CMPLXL(logl(hypotl(x / m_e, y / m_e)) + 1, atan2l(y, x))); Modified: head/lib/msun/src/math_private.h ============================================================================== --- head/lib/msun/src/math_private.h Fri Aug 11 22:39:38 2017 (r322417) +++ head/lib/msun/src/math_private.h Fri Aug 11 22:41:24 2017 (r322418) @@ -272,6 +272,15 @@ do { \ #define LD80C(m, ex, v) { .e = (v), } #endif +/* + * XXX LDBL_MAX is broken on i386. If the precise value of LDBL_MAX is not + * needed, this may be worked around by instead referring to a proxy, such + * as HALF_LDBL_MAX, below. HALF_LDBL_MAX is approximately LDBL_MAX / 2, + * actually just greater than. Note that 2 * HALF_LDBL_MAX will always + * overflow to infinity, regardless of the precision and rounding modes. + */ +#define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L) + #ifdef FLT_EVAL_METHOD /* * Attempt to get strict C99 semantics for assignment with non-C99 compilers. Modified: head/lib/msun/src/s_csqrtl.c ============================================================================== --- head/lib/msun/src/s_csqrtl.c Fri Aug 11 22:39:38 2017 (r322417) +++ head/lib/msun/src/s_csqrtl.c Fri Aug 11 22:41:24 2017 (r322418) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #pragma STDC CX_LIMITED_RANGE ON /* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). */ -#define THRESH (LDBL_MAX / 2.414213562373095048801688724209698L) +#define THRESH (HALF_LDBL_MAX / 1.207106781186547524400844362104849L) long double complex csqrtl(long double complex z) From owner-svn-src-head@freebsd.org Fri Aug 11 22:47:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00112DCCBC7; Fri, 11 Aug 2017 22:47:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEE61681E4; Fri, 11 Aug 2017 22:47:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BMlWmE030822; Fri, 11 Aug 2017 22:47:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BMlWuq030821; Fri, 11 Aug 2017 22:47:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708112247.v7BMlWuq030821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 11 Aug 2017 22:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322419 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 322419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 22:47:34 -0000 Author: jhb Date: Fri Aug 11 22:47:32 2017 New Revision: 322419 URL: https://svnweb.freebsd.org/changeset/base/322419 Log: Fix a typo. Modified: head/sys/arm64/arm64/vfp.c Modified: head/sys/arm64/arm64/vfp.c ============================================================================== --- head/sys/arm64/arm64/vfp.c Fri Aug 11 22:41:24 2017 (r322418) +++ head/sys/arm64/arm64/vfp.c Fri Aug 11 22:47:32 2017 (r322419) @@ -206,7 +206,7 @@ vfp_restore_state(void) /* * If the previous thread on this cpu to use the VFP was not the - * current threas, or the current thread last used it on a different + * current thread, or the current thread last used it on a different * cpu we need to restore the old state. */ if (PCPU_GET(fpcurthread) != curthread || cpu != curpcb->pcb_vfpcpu) { From owner-svn-src-head@freebsd.org Sat Aug 12 02:57:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77EA2DDB252; Sat, 12 Aug 2017 02:57:38 +0000 (UTC) (envelope-from David.Somayajulu@cavium.com) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0066.outbound.protection.outlook.com [104.47.40.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 23D116F4A9; Sat, 12 Aug 2017 02:57:37 +0000 (UTC) (envelope-from David.Somayajulu@cavium.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=5mAN0LgbORV3fWHx8IsvenDvzOHVeZHEcIzolini+8w=; b=MGSopwOha77CvlNRtooiHiW26KJtJ8+HR9wcBhQs/CBZUIOFmJCaSFFCq6Z6b/nbQR8N5FAPU/I/aEUoOTH1iDohCBe7YeMo1/HmFKlpaqf3m8bvYIyfvFOvugk8UJo8sYRtANq5eWZagtsKd5yA6ui66t8ZYeR2HwTD+smivCw= Received: from BY2PR07MB1474.namprd07.prod.outlook.com (10.162.76.152) by BY2PR07MB1475.namprd07.prod.outlook.com (10.162.76.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1320.16; Sat, 12 Aug 2017 02:57:35 +0000 Received: from BY2PR07MB1474.namprd07.prod.outlook.com ([10.162.76.152]) by BY2PR07MB1474.namprd07.prod.outlook.com ([10.162.76.152]) with mapi id 15.01.1320.021; Sat, 12 Aug 2017 02:57:35 +0000 From: "Somayajulu, David" To: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: RE: svn commit: r322331 - in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe Thread-Topic: svn commit: r322331 - in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe Thread-Index: AQHTEV2FHCrAquH5BEm/2TOYjHsfd6KACmCg Date: Sat, 12 Aug 2017 02:57:35 +0000 Message-ID: References: <201708092218.v79MInEd032026@repo.freebsd.org> In-Reply-To: <201708092218.v79MInEd032026@repo.freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=David.Somayajulu@cavium.com; x-originating-ip: [198.186.0.2] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BY2PR07MB1475; 6:xfAB+J4FepulCoil78wre5mwzF0rL/sTCTISpW9O59jrqZL3erSqijLeVfTwertNum3jhZSX6Oe+H3Gqx5oq4LD4NQ1Em2nBCWZfmIUDf1ZdpeyHMnBVtURjokWqWv2WAkczamoBBBdREBErq+50CEiDmGVK8lxZeFUC+BAu+oQ1LbOgGp07Bfy0gQYj0S4dBo/T3AVTMYYi9sWhOUB1fXoZ32nqDBiaFN4owXvNfpq1z/5vWGs7AvihOEppSCrq/ceIgcGjTn9SepRTrgI6DXqOAOPF3+lutvYPyXB4YbxWlmJ1VSSoiW+DKtRiPHmXf9pmflfoVN5u5C4UuGW0gg==; 5:/xsTfHa7tvKOI27Et5XnyNWHvU90z7khMpZB0dAIUihSRwhqcvYDFqXySttWejzt1XTcOl1WdJ/FNyI3FdSrl+UaCZ6eD0lXs+mKZbFrNfmxaMhPUUhvcGYmwnLgQGHaFJe/1mSJh74+lgA2Ai0oug==; 24:zdyHUUshwAQyC/SeyWcF6OIHA3qYW20/ijf6gWBmy68MjkcuVhFQycIJHlxCk0Yrod+gq9XVxOMpjKJ+/m3i1huzQy1ZKkaRDS1xEoUYLf8=; 7:YK5cSb7P8KyFWOK7mnPqFMbavo2GUBceE+nIVIShuLFFlagN0DdEwHjBn4Qh5WcpfN4Z0wcLgrFrL5sonfUkKe20hBCz+BIkrIC/uOhskETxntFvgCJmPFrU4qyDbNkZ3G+/YVne9DE79GCJz17WPaSaMw0HXca5RSomt7ocwAiuIDeEuk/pGrTP4dtpfzxXcemFrZ6Uvy25iUg1higui41cDwI/nT3v6A7xTbhTvBc= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: eba61a82-acdb-4563-81b4-08d4e12de2b5 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR07MB1475; x-ms-traffictypediagnostic: BY2PR07MB1475: x-exchange-antispam-report-test: UriScan:(56005881305849); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR07MB1475; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR07MB1475; x-forefront-prvs: 039735BC4E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(53754006)(377454003)(199003)(189002)(13464003)(54356999)(101416001)(6246003)(106356001)(76176999)(189998001)(86362001)(2906002)(50986999)(105586002)(55016002)(6436002)(2501003)(99286003)(229853002)(33656002)(8936002)(66066001)(74316002)(68736007)(81156014)(8676002)(25786009)(97736004)(6306002)(81166006)(14454004)(5660300001)(53936002)(77096006)(2201001)(478600001)(9686003)(72206003)(7736002)(6506006)(305945005)(7696004)(53546010)(2950100002)(3280700002)(3846002)(102836003)(2900100001)(3660700001)(6116002)(450100002)(966005); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB1475; H:BY2PR07MB1474.namprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Aug 2017 02:57:35.5753 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB1475 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 02:57:38 -0000 SEkgQWxsLA0KQXBvbG9naXplIGZvciB0aGUgaW5jb252ZW5pZW5jZS4gDQpJIGZvcmdvdCB0byBt ZW50aW9uIHRoZSBmb2xsb3dpbmcuDQoNCk1GQyBhZnRlcjo1IGRheXMNCg0KVGhhbmtzDQpEYXZp ZCBTLiAoZGF2aWRjc0BmcmVlYnNkLm9yZykNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpG cm9tOiBvd25lci1zcmMtY29tbWl0dGVyc0BmcmVlYnNkLm9yZyBbbWFpbHRvOm93bmVyLXNyYy1j b21taXR0ZXJzQGZyZWVic2Qub3JnXSBPbiBCZWhhbGYgT2YgRGF2aWQgQyBTb21heWFqdWx1DQpT ZW50OiBXZWRuZXNkYXksIEF1Z3VzdCAwOSwgMjAxNyAzOjE5IFBNDQpUbzogc3JjLWNvbW1pdHRl cnNAZnJlZWJzZC5vcmc7IHN2bi1zcmMtYWxsQGZyZWVic2Qub3JnOyBzdm4tc3JjLWhlYWRAZnJl ZWJzZC5vcmcNClN1YmplY3Q6IHN2biBjb21taXQ6IHIzMjIzMzEgLSBpbiBoZWFkL3N5czogZGV2 L3FsbngvcWxueGUgbW9kdWxlcy9xbG54L3FsbnhlDQoNCkF1dGhvcjogZGF2aWRjcw0KRGF0ZTog V2VkIEF1ZyAgOSAyMjoxODo0OSAyMDE3DQpOZXcgUmV2aXNpb246IDMyMjMzMQ0KVVJMOiBodHRw czovL3N2bndlYi5mcmVlYnNkLm9yZy9jaGFuZ2VzZXQvYmFzZS8zMjIzMzENCg0KTG9nOg0KICBQ cm92aWRlIGNvbXBpbGUgdG8gY2hvb3NlIHJlY2VpdmUgcHJvY2Vzc2luZyBpbiBlaXRoZXIgSXRo cmVhZCBvciBUYXNrcXVldWUgVGhyZWFkLg0KDQpNb2RpZmllZDoNCiAgaGVhZC9zeXMvZGV2L3Fs bngvcWxueGUvcWxueF9vcy5jDQogIGhlYWQvc3lzL2Rldi9xbG54L3FsbnhlL3FsbnhfdmVyLmgN CiAgaGVhZC9zeXMvbW9kdWxlcy9xbG54L3FsbnhlL01ha2VmaWxlDQoNCk1vZGlmaWVkOiBoZWFk L3N5cy9kZXYvcWxueC9xbG54ZS9xbG54X29zLmMgPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQotLS0g aGVhZC9zeXMvZGV2L3FsbngvcWxueGUvcWxueF9vcy5jCVdlZCBBdWcgIDkgMjE6NDQ6NTUgMjAx NwkocjMyMjMzMCkNCisrKyBoZWFkL3N5cy9kZXYvcWxueC9xbG54ZS9xbG54X29zLmMJV2VkIEF1 ZyAgOSAyMjoxODo0OSAyMDE3CShyMzIyMzMxKQ0KQEAgLTM5NywxMCArMzk3LDE0IEBAIHFsbnhf ZnBfdGFza3F1ZXVlKHZvaWQgKmNvbnRleHQsIGludCBwZW5kaW5nKQ0KICAgICAgICAgc3RydWN0 IGlmbmV0CQkqaWZwOw0KICAgICAgICAgc3RydWN0IG1idWYJCSptcDsNCiAgICAgICAgIGludAkJ CXJldCA9IC0xOw0KKwlzdHJ1Y3QgdGhyZWFkCQkqY3RocmVhZDsNCisNCisjaWZkZWYgUUxOWF9S Q1ZfSU5fVEFTS1ENCiAJaW50CQkJbHJvX2VuYWJsZTsNCiAJaW50CQkJcnhfaW50ID0gMCwgdG90 YWxfcnhfY291bnQgPSAwOw0KLQlzdHJ1Y3QgdGhyZWFkCQkqY3RocmVhZDsNCiANCisjZW5kaWYg LyogI2lmZGVmIFFMTlhfUkNWX0lOX1RBU0tRICovDQorDQogICAgICAgICBmcCA9IGNvbnRleHQ7 DQogDQogICAgICAgICBpZiAoZnAgPT0gTlVMTCkNCkBAIC00MTksNTUgKzQyMyw2MCBAQCBxbG54 X2ZwX3Rhc2txdWV1ZSh2b2lkICpjb250ZXh0LCBpbnQgcGVuZGluZykNCiANCiAgICAgICAgIGlm cCA9IGhhLT5pZnA7DQogDQotCWxyb19lbmFibGUgPSBoYS0+aWZwLT5pZl9jYXBlbmFibGUgJiBJ RkNBUF9MUk87DQorI2lmZGVmIFFMTlhfUkNWX0lOX1RBU0tRDQorCXsNCisJCWxyb19lbmFibGUg PSBpZnAtPmlmX2NhcGVuYWJsZSAmIElGQ0FQX0xSTzsNCiANCi0JcnhfaW50ID0gcWxueF9yeF9p bnQoaGEsIGZwLCBoYS0+cnhfcGt0X3RocmVzaG9sZCwgbHJvX2VuYWJsZSk7DQorCQlyeF9pbnQg PSBxbG54X3J4X2ludChoYSwgZnAsIGhhLT5yeF9wa3RfdGhyZXNob2xkLCBscm9fZW5hYmxlKTsN CiANCi0JaWYgKHJ4X2ludCkgew0KLQkJZnAtPnJ4X3BrdHMgKz0gcnhfaW50Ow0KLQkJdG90YWxf cnhfY291bnQgKz0gcnhfaW50Ow0KLQl9DQorCQlpZiAocnhfaW50KSB7DQorCQkJZnAtPnJ4X3Br dHMgKz0gcnhfaW50Ow0KKwkJCXRvdGFsX3J4X2NvdW50ICs9IHJ4X2ludDsNCisJCX0NCiANCiAj aWZkZWYgUUxOWF9TT0ZUX0xSTw0KLQl7DQotCQlzdHJ1Y3QgbHJvX2N0cmwgKmxybzsNCisJCXsN CisJCQlzdHJ1Y3QgbHJvX2N0cmwgKmxybzsNCisJDQorCQkJbHJvID0gJmZwLT5yeHEtPmxybzsN CiANCi0JCWxybyA9ICZmcC0+cnhxLT5scm87DQorCQkJaWYgKGxyb19lbmFibGUgJiYgdG90YWxf cnhfY291bnQpIHsNCiANCi0JCWlmIChscm9fZW5hYmxlICYmIHRvdGFsX3J4X2NvdW50KSB7DQot DQogI2lmIChfX0ZyZWVCU0RfdmVyc2lvbiA+PSAxMTAwMTAxKSB8fCAoZGVmaW5lZCBRTE5YX1FT T1JUX0xSTykNCiANCi0JCQlpZiAoaGEtPmRiZ190cmFjZV9scm9fY250KSB7DQotCQkJCWlmIChs cm8tPmxyb19tYnVmX2NvdW50ICYgfjEwMjMpDQotCQkJCQlmcC0+bHJvX2NudF8xMDI0Kys7DQot CQkJCWVsc2UgaWYgKGxyby0+bHJvX21idWZfY291bnQgJiB+NTExKQ0KLQkJCQkJZnAtPmxyb19j bnRfNTEyKys7DQotCQkJCWVsc2UgaWYgKGxyby0+bHJvX21idWZfY291bnQgJiB+MjU1KQ0KLQkJ CQkJZnAtPmxyb19jbnRfMjU2Kys7DQotCQkJCWVsc2UgaWYgKGxyby0+bHJvX21idWZfY291bnQg JiB+MTI3KQ0KLQkJCQkJZnAtPmxyb19jbnRfMTI4Kys7DQotCQkJCWVsc2UgaWYgKGxyby0+bHJv X21idWZfY291bnQgJiB+NjMpDQotCQkJCQlmcC0+bHJvX2NudF82NCsrOw0KLQkJCX0NCi0JCQl0 Y3BfbHJvX2ZsdXNoX2FsbChscm8pOw0KKwkJCQlpZiAoaGEtPmRiZ190cmFjZV9scm9fY250KSB7 DQorCQkJCQlpZiAobHJvLT5scm9fbWJ1Zl9jb3VudCAmIH4xMDIzKQ0KKwkJCQkJCWZwLT5scm9f Y250XzEwMjQrKzsNCisJCQkJCWVsc2UgaWYgKGxyby0+bHJvX21idWZfY291bnQgJiB+NTExKQ0K KwkJCQkJCWZwLT5scm9fY250XzUxMisrOw0KKwkJCQkJZWxzZSBpZiAobHJvLT5scm9fbWJ1Zl9j b3VudCAmIH4yNTUpDQorCQkJCQkJZnAtPmxyb19jbnRfMjU2Kys7DQorCQkJCQllbHNlIGlmIChs cm8tPmxyb19tYnVmX2NvdW50ICYgfjEyNykNCisJCQkJCQlmcC0+bHJvX2NudF8xMjgrKzsNCisJ CQkJCWVsc2UgaWYgKGxyby0+bHJvX21idWZfY291bnQgJiB+NjMpDQorCQkJCQkJZnAtPmxyb19j bnRfNjQrKzsNCisJCQkJfQ0KKwkJCQl0Y3BfbHJvX2ZsdXNoX2FsbChscm8pOw0KIA0KICNlbHNl DQotCQkJc3RydWN0IGxyb19lbnRyeSAqcXVldWVkOw0KKwkJCQlzdHJ1Y3QgbHJvX2VudHJ5ICpx dWV1ZWQ7DQogDQotCQkJd2hpbGUgKCghU0xJU1RfRU1QVFkoJmxyby0+bHJvX2FjdGl2ZSkpKSB7 DQotCQkJCXF1ZXVlZCA9IFNMSVNUX0ZJUlNUKCZscm8tPmxyb19hY3RpdmUpOw0KLQkJCQlTTElT VF9SRU1PVkVfSEVBRCgmbHJvLT5scm9fYWN0aXZlLCBuZXh0KTsNCi0JCQkJdGNwX2xyb19mbHVz aChscm8sIHF1ZXVlZCk7DQotCQkJfQ0KKwkJCQl3aGlsZSAoKCFTTElTVF9FTVBUWSgmbHJvLT5s cm9fYWN0aXZlKSkpIHsNCisJCQkJCXF1ZXVlZCA9IFNMSVNUX0ZJUlNUKCZscm8tPmxyb19hY3Rp dmUpOw0KKwkJCQkJU0xJU1RfUkVNT1ZFX0hFQUQoJmxyby0+bHJvX2FjdGl2ZSwgbmV4dCk7DQor CQkJCQl0Y3BfbHJvX2ZsdXNoKGxybywgcXVldWVkKTsNCisJCQkJfQ0KICNlbmRpZiAvKiAjaWYg KF9fRnJlZUJTRF92ZXJzaW9uID49IDExMDAxMDEpIHx8IChkZWZpbmVkIFFMTlhfUVNPUlRfTFJP KSAqLw0KKwkJCX0NCiAJCX0NCi0JfQ0KICNlbmRpZiAvKiAjaWZkZWYgUUxOWF9TT0ZUX0xSTyAq Lw0KIA0KLQllY29yZV9zYl91cGRhdGVfc2JfaWR4KGZwLT5zYl9pbmZvKTsNCi0Jcm1iKCk7DQor CQllY29yZV9zYl91cGRhdGVfc2JfaWR4KGZwLT5zYl9pbmZvKTsNCisJCXJtYigpOw0KKwl9DQog DQorI2VuZGlmIC8qICNpZmRlZiBRTE5YX1JDVl9JTl9UQVNLUSAqLw0KKw0KICAgICAgICAgbXR4 X2xvY2soJmZwLT50eF9tdHgpOw0KIA0KICAgICAgICAgaWYgKCgoaWZwLT5pZl9kcnZfZmxhZ3Mg JiAoSUZGX0RSVl9SVU5OSU5HIHwgSUZGX0RSVl9PQUNUSVZFKSkgIT0gQEAgLTQ3NywxMCArNDg2 LDYgQEAgcWxueF9mcF90YXNrcXVldWUodm9pZCAqY29udGV4dCwgaW50IHBlbmRpbmcpDQogICAg ICAgICAgICAgICAgIGdvdG8gcWxueF9mcF90YXNrcXVldWVfZXhpdDsNCiAgICAgICAgIH0NCiAN Ci0vLwlmb3IgKHRjID0gMDsgdGMgPCBoYS0+bnVtX3RjOyB0YysrKSB7DQotLy8JCSh2b2lkKXFs bnhfdHhfaW50KGhhLCBmcCwgZnAtPnR4cVt0Y10pOw0KLS8vCX0NCi0NCiAgICAgICAgIG1wID0g ZHJicl9wZWVrKGlmcCwgZnAtPnR4X2JyKTsNCiANCiAgICAgICAgIHdoaWxlIChtcCAhPSBOVUxM KSB7DQpAQCAtNTE2LDEzICs1MjEsMTEgQEAgcWxueF9mcF90YXNrcXVldWUodm9pZCAqY29udGV4 dCwgaW50IHBlbmRpbmcpDQogICAgICAgICAgICAgICAgIG1wID0gZHJicl9wZWVrKGlmcCwgZnAt PnR4X2JyKTsNCiAgICAgICAgIH0NCiANCi0vLwlmb3IgKHRjID0gMDsgdGMgPCBoYS0+bnVtX3Rj OyB0YysrKSB7DQotLy8JCSh2b2lkKXFsbnhfdHhfaW50KGhhLCBmcCwgZnAtPnR4cVt0Y10pOw0K LS8vCX0NCi0NCiAgICAgICAgIG10eF91bmxvY2soJmZwLT50eF9tdHgpOw0KIA0KIHFsbnhfZnBf dGFza3F1ZXVlX2V4aXQ6DQorDQorI2lmZGVmIFFMTlhfUkNWX0lOX1RBU0tRDQogCWlmIChyeF9p bnQpIHsNCiAJCWlmIChmcC0+ZnBfdGFza3F1ZXVlICE9IE5VTEwpDQogCQkJdGFza3F1ZXVlX2Vu cXVldWUoZnAtPmZwX3Rhc2txdWV1ZSwgJmZwLT5mcF90YXNrKTsgQEAgLTUzMiw2ICs1MzUsNyBA QCBxbG54X2ZwX3Rhc2txdWV1ZV9leGl0Og0KIAkJfQ0KIAkJZWNvcmVfc2JfYWNrKGZwLT5zYl9p bmZvLCBJR1VfSU5UX0VOQUJMRSwgMSk7DQogCX0NCisjZW5kaWYgLyogI2lmZGVmIFFMTlhfUkNW X0lOX1RBU0tRICovDQogDQogICAgICAgICBRTF9EUFJJTlQyKGhhLCAiZXhpdCByZXQgPSAlZFxu IiwgcmV0KTsNCiAgICAgICAgIHJldHVybjsNCkBAIC00MjYyLDYgKzQyNjYsNyBAQCBuZXh0X2Nx ZToJLyogZG9uJ3QgY29uc3VtZSBiZCByeCBidWZmZXIgKi8NCiAgICAgICAgIHJldHVybiByeF9w a3Q7DQogfQ0KIA0KKw0KIC8qDQogICogZmFzdCBwYXRoIGludGVycnVwdA0KICAqLw0KQEAgLTQy OTIsOSArNDI5Nyw4MiBAQCBxbG54X2ZwX2lzcih2b2lkICphcmcpDQogICAgICAgICBpZiAoZnAg PT0gTlVMTCkgew0KICAgICAgICAgICAgICAgICBoYS0+ZXJyX2ZwX251bGwrKzsNCiAgICAgICAg IH0gZWxzZSB7DQorDQorI2lmZGVmIFFMTlhfUkNWX0lOX1RBU0tRDQogICAgICAgICAgICAgICAg IGVjb3JlX3NiX2FjayhmcC0+c2JfaW5mbywgSUdVX0lOVF9ESVNBQkxFLCAwKTsNCiAJCWlmIChm cC0+ZnBfdGFza3F1ZXVlICE9IE5VTEwpDQogCQkJdGFza3F1ZXVlX2VucXVldWUoZnAtPmZwX3Rh c2txdWV1ZSwgJmZwLT5mcF90YXNrKTsNCisjZWxzZQ0KKwkJaW50CXJ4X2ludCA9IDAsIHRvdGFs X3J4X2NvdW50ID0gMDsNCisJCWludCAJbHJvX2VuYWJsZSwgdGM7DQorDQorCQlscm9fZW5hYmxl ID0gaGEtPmlmcC0+aWZfY2FwZW5hYmxlICYgSUZDQVBfTFJPOw0KKw0KKyAgICAgICAgICAgICAg ICBlY29yZV9zYl9hY2soZnAtPnNiX2luZm8sIElHVV9JTlRfRElTQUJMRSwgMCk7DQorDQorICAg ICAgICAgICAgICAgIGRvIHsNCisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHRjID0gMDsg dGMgPCBoYS0+bnVtX3RjOyB0YysrKSB7DQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBpZiAobXR4X3RyeWxvY2soJmZwLT50eF9tdHgpKSB7DQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHFsbnhfdHhfaW50KGhhLCBmcCwgZnAtPnR4cVt0Y10pOw0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtdHhfdW5sb2NrKCZmcC0+dHhf bXR4KTsNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICAg ICAgICAgICAgICB9DQorDQorICAgICAgICAgICAgICAgICAgICAgICAgcnhfaW50ID0gcWxueF9y eF9pbnQoaGEsIGZwLCBoYS0+cnhfcGt0X3RocmVzaG9sZCwNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgbHJvX2VuYWJsZSk7DQorDQorICAgICAgICAgICAgICAgICAg ICAgICAgaWYgKHJ4X2ludCkgew0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnAt PnJ4X3BrdHMgKz0gcnhfaW50Ow0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG90 YWxfcnhfY291bnQgKz0gcnhfaW50Ow0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0NCisNCisg ICAgICAgICAgICAgICAgfSB3aGlsZSAocnhfaW50KTsNCisNCisNCisjaWZkZWYgUUxOWF9TT0ZU X0xSTw0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0 IGxyb19jdHJsICpscm87DQorDQorICAgICAgICAgICAgICAgICAgICAgICAgbHJvID0gJmZwLT5y eHEtPmxybzsNCisNCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobHJvX2VuYWJsZSAmJiB0 b3RhbF9yeF9jb3VudCkgew0KKw0KKyNpZiAoX19GcmVlQlNEX3ZlcnNpb24gPj0gMTEwMDEwMSkg fHwgKGRlZmluZWQgUUxOWF9RU09SVF9MUk8pDQorDQorI2lmZGVmIFFMTlhfVFJBQ0VfTFJPX0NO VA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxyby0+bHJvX21idWZfY291 bnQgJiB+MTAyMykNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnAt Pmxyb19jbnRfMTAyNCsrOw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBp ZiAobHJvLT5scm9fbWJ1Zl9jb3VudCAmIH41MTEpDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGZwLT5scm9fY250XzUxMisrOw0KKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgZWxzZSBpZiAobHJvLT5scm9fbWJ1Zl9jb3VudCAmIH4yNTUpDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZwLT5scm9fY250XzI1NisrOw0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAobHJvLT5scm9fbWJ1Zl9jb3Vu dCAmIH4xMjcpDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZwLT5s cm9fY250XzEyOCsrOw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAo bHJvLT5scm9fbWJ1Zl9jb3VudCAmIH42MykNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgZnAtPmxyb19jbnRfNjQrKzsgI2VuZGlmIC8qIA0KKyNpZmRlZiBRTE5YX1RS QUNFX0xST19DTlQgKi8NCisNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRjcF9s cm9fZmx1c2hfYWxsKGxybyk7DQorDQorI2Vsc2UNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHN0cnVjdCBscm9fZW50cnkgKnF1ZXVlZDsNCisNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHdoaWxlICgoIVNMSVNUX0VNUFRZKCZscm8tPmxyb19hY3RpdmUpKSkgew0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWV1ZWQgPSBTTElTVF9G SVJTVCgmbHJvLT5scm9fYWN0aXZlKTsNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgU0xJU1RfUkVNT1ZFX0hFQUQoJmxyby0+bHJvX2FjdGl2ZSwgXA0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQpOw0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Y3BfbHJvX2ZsdXNoKGxybywgcXVldWVk KTsNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCisjZW5kaWYgLyogI2lmIChf X0ZyZWVCU0RfdmVyc2lvbiA+PSAxMTAwMTAxKSB8fCAoZGVmaW5lZCBRTE5YX1FTT1JUX0xSTykg Ki8NCisgICAgICAgICAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgICAgIH0NCisjZW5k aWYgLyogI2lmZGVmIFFMTlhfU09GVF9MUk8gKi8NCisNCisgICAgICAgICAgICAgICAgZWNvcmVf c2JfdXBkYXRlX3NiX2lkeChmcC0+c2JfaW5mbyk7DQorICAgICAgICAgICAgICAgIHJtYigpOw0K KyAgICAgICAgICAgICAgICBlY29yZV9zYl9hY2soZnAtPnNiX2luZm8sIElHVV9JTlRfRU5BQkxF LCAxKTsNCisNCisjZW5kaWYgLyogI2lmZGVmIFFMTlhfUkNWX0lOX1RBU0tRICovDQogICAgICAg ICB9DQogDQogICAgICAgICByZXR1cm47DQoNCk1vZGlmaWVkOiBoZWFkL3N5cy9kZXYvcWxueC9x bG54ZS9xbG54X3Zlci5oDQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0NCi0tLSBoZWFkL3N5cy9kZXYv cWxueC9xbG54ZS9xbG54X3Zlci5oCVdlZCBBdWcgIDkgMjE6NDQ6NTUgMjAxNwkocjMyMjMzMCkN CisrKyBoZWFkL3N5cy9kZXYvcWxueC9xbG54ZS9xbG54X3Zlci5oCVdlZCBBdWcgIDkgMjI6MTg6 NDkgMjAxNwkocjMyMjMzMSkNCkBAIC0zOSw1ICszOSw1IEBADQogDQogI2RlZmluZSBRTE5YX1ZF UlNJT05fTUFKT1IgICAgICAxDQogI2RlZmluZSBRTE5YX1ZFUlNJT05fTUlOT1IgICAgICA0DQot I2RlZmluZSBRTE5YX1ZFUlNJT05fQlVJTEQgICAgICA1DQorI2RlZmluZSBRTE5YX1ZFUlNJT05f QlVJTEQgICAgICA2DQogDQoNCk1vZGlmaWVkOiBoZWFkL3N5cy9tb2R1bGVzL3FsbngvcWxueGUv TWFrZWZpbGUNCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIGhlYWQvc3lzL21vZHVsZXMvcWxu eC9xbG54ZS9NYWtlZmlsZQlXZWQgQXVnICA5IDIxOjQ0OjU1IDIwMTcJKHIzMjIzMzApDQorKysg aGVhZC9zeXMvbW9kdWxlcy9xbG54L3FsbnhlL01ha2VmaWxlCVdlZCBBdWcgIDkgMjI6MTg6NDkg MjAxNwkocjMyMjMzMSkNCkBAIC02NSw1ICs2NSw2IEBAIENGTEFHUys9IC1JJHtTUkNUT1B9L3N5 cy9jb21wYXQvbGludXhrcGkvY29tbW9uL2luY2x1ZA0KICNDRkxBR1MgKz0gLURRTE5YX1NPRlRf TFJPDQogI0NGTEFHUyArPSAtRFFMTlhfUVNPUlRfTFJPDQogI0NGTEFHUyArPSAtRFFMTlhfTUFY X0NPQUxFU0NFDQorI0NGTEFHUyArPSAtRFFMTlhfUkNWX0lOX1RBU0tRDQogDQogQ1dBUk5GTEFH Uys9IC1Xbm8tY2FzdC1xdWFsDQoNCg== From owner-svn-src-head@freebsd.org Sat Aug 12 12:17:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 830EBDD2DA4; Sat, 12 Aug 2017 12:17:39 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB7F83E99; Sat, 12 Aug 2017 12:17:39 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CCHcRA059745; Sat, 12 Aug 2017 12:17:38 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CCHcQV059744; Sat, 12 Aug 2017 12:17:38 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201708121217.v7CCHcQV059744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sat, 12 Aug 2017 12:17:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322424 - head/usr.bin/units X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/usr.bin/units X-SVN-Commit-Revision: 322424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 12:17:39 -0000 Author: sevan (doc committer) Date: Sat Aug 12 12:17:38 2017 New Revision: 322424 URL: https://svnweb.freebsd.org/changeset/base/322424 Log: Correct the -H longopt equivillant PR: 209876 Submitted by: Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D11988 Modified: head/usr.bin/units/units.1 Modified: head/usr.bin/units/units.1 ============================================================================== --- head/usr.bin/units/units.1 Sat Aug 12 10:22:18 2017 (r322423) +++ head/usr.bin/units/units.1 Sat Aug 12 12:17:38 2017 (r322424) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd July 4, 2014 +.Dd August 12, 2017 .Dt UNITS 1 .Os .Sh NAME @@ -18,7 +18,7 @@ The following options are available: Show an overview of options .It Fl f Ar filename \&No , Fl -file Ar filename Specify the name of the units data file to load. -.It Fl H Ar filename \&No , Fl -historyfile Ar filename +.It Fl H Ar filename \&No , Fl -history Ar filename Ignored, for compatibility with GNU units. .It Fl e , Fl -exponential Behave as if -o '%6e' was typed. From owner-svn-src-head@freebsd.org Sat Aug 12 14:02:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49CB6DD859A; Sat, 12 Aug 2017 14:02:21 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25CCD2A9C; Sat, 12 Aug 2017 14:02:21 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CE2KiQ005506; Sat, 12 Aug 2017 14:02:20 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CE2K1O005503; Sat, 12 Aug 2017 14:02:20 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708121402.v7CE2K1O005503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 12 Aug 2017 14:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322425 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 322425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 14:02:21 -0000 Author: np Date: Sat Aug 12 14:02:19 2017 New Revision: 322425 URL: https://svnweb.freebsd.org/changeset/base/322425 Log: cxgbe(4): Save the last reported link parameters and compare them with the current state to determine whether to generate a link-state change notification. This fixes a bug introduced in r321063 that caused the driver to sometimes skip these notifications. Reported by: Jason Eggleston @ LLNW MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Sat Aug 12 12:17:38 2017 (r322424) +++ head/sys/dev/cxgbe/adapter.h Sat Aug 12 14:02:19 2017 (r322425) @@ -287,6 +287,7 @@ struct port_info { uint8_t rx_chan_map; /* rx MPS channel bitmap */ struct link_config link_cfg; + struct link_config old_link_cfg; struct timeval last_refreshed; struct port_stats stats; @@ -1124,8 +1125,8 @@ extern device_method_t cxgbe_methods[]; int t4_os_find_pci_capability(struct adapter *, int); int t4_os_pci_save_state(struct adapter *); int t4_os_pci_restore_state(struct adapter *); -void t4_os_portmod_changed(struct port_info *, int, int, struct link_config *); -void t4_os_link_changed(struct port_info *, struct link_config *); +void t4_os_portmod_changed(struct port_info *); +void t4_os_link_changed(struct port_info *); void t4_iterate(void (*)(struct adapter *, void *), void *); void t4_init_devnames(struct adapter *); void t4_add_adapter(struct adapter *); Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Sat Aug 12 12:17:38 2017 (r322424) +++ head/sys/dev/cxgbe/common/t4_hw.c Sat Aug 12 14:02:19 2017 (r322425) @@ -7715,7 +7715,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6 int i, old_ptype, old_mtype; int chan = G_FW_PORT_CMD_PORTID(be32_to_cpu(p->op_to_portid)); struct port_info *pi = NULL; - struct link_config *lc, old_lc; + struct link_config *lc, *old_lc; for_each_port(adap, i) { pi = adap2pinfo(adap, i); @@ -7724,19 +7724,20 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6 } lc = &pi->link_cfg; - old_lc = *lc; + old_lc = &pi->old_link_cfg; old_ptype = pi->port_type; old_mtype = pi->mod_type; handle_port_info(pi, &p->u.info); if (old_ptype != pi->port_type || old_mtype != pi->mod_type) { - t4_os_portmod_changed(pi, old_ptype, old_mtype, - &old_lc); + t4_os_portmod_changed(pi); } - if (old_lc.link_ok != lc->link_ok || - old_lc.speed != lc->speed || - old_lc.fc != lc->fc) { - t4_os_link_changed(pi, &old_lc); + if (old_lc->link_ok != lc->link_ok || + old_lc->speed != lc->speed || + old_lc->fec != lc->fec || + old_lc->fc != lc->fc) { + t4_os_link_changed(pi); + *old_lc = *lc; } } else { CH_WARN_RATELIMIT(adap, "Unknown firmware reply %d\n", opcode); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Aug 12 12:17:38 2017 (r322424) +++ head/sys/dev/cxgbe/t4_main.c Sat Aug 12 14:02:19 2017 (r322425) @@ -4335,7 +4335,8 @@ cxgbe_uninit_synchronized(struct vi_info *vi) pi->link_cfg.link_ok = 0; pi->link_cfg.speed = 0; pi->link_cfg.link_down_rc = 255; - t4_os_link_changed(pi, NULL); + t4_os_link_changed(pi); + pi->old_link_cfg = pi->link_cfg; return (0); } @@ -9274,8 +9275,7 @@ t4_os_pci_restore_state(struct adapter *sc) } void -t4_os_portmod_changed(struct port_info *pi, int old_ptype, int old_mtype, - struct link_config *old_lc) +t4_os_portmod_changed(struct port_info *pi) { struct vi_info *vi; struct ifnet *ifp; @@ -9312,7 +9312,7 @@ t4_os_portmod_changed(struct port_info *pi, int old_pt } void -t4_os_link_changed(struct port_info *pi, struct link_config *old_lc) +t4_os_link_changed(struct port_info *pi) { struct vi_info *vi; struct ifnet *ifp; From owner-svn-src-head@freebsd.org Sat Aug 12 14:58:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1E6DDDB928; Sat, 12 Aug 2017 14:58:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C4C063B9A; Sat, 12 Aug 2017 14:58:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CEw9bI026909; Sat, 12 Aug 2017 14:58:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CEw9HP026908; Sat, 12 Aug 2017 14:58:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708121458.v7CEw9HP026908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 12 Aug 2017 14:58:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322426 - head/lib/libc/string X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/string X-SVN-Commit-Revision: 322426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 14:58:10 -0000 Author: kib Date: Sat Aug 12 14:58:09 2017 New Revision: 322426 URL: https://svnweb.freebsd.org/changeset/base/322426 Log: Fix indent. Submitted by: Yuri Pankov MFC after: 3 days Modified: head/lib/libc/string/memset_s.c Modified: head/lib/libc/string/memset_s.c ============================================================================== --- head/lib/libc/string/memset_s.c Sat Aug 12 14:02:19 2017 (r322425) +++ head/lib/libc/string/memset_s.c Sat Aug 12 14:58:09 2017 (r322426) @@ -49,7 +49,7 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n) __throw_constraint_handler_s("memset_s : s is NULL", ret); } else if (smax > RSIZE_MAX) { __throw_constraint_handler_s("memset_s : smax > RSIZE_MAX", - ret); + ret); } else if (n > RSIZE_MAX) { __throw_constraint_handler_s("memset_s : n > RSIZE_MAX", ret); } else { From owner-svn-src-head@freebsd.org Sat Aug 12 15:18:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78C82DDCAF4; Sat, 12 Aug 2017 15:18:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54A0B64755; Sat, 12 Aug 2017 15:18:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CFIHiP035167; Sat, 12 Aug 2017 15:18:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CFIHld035164; Sat, 12 Aug 2017 15:18:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708121518.v7CFIHld035164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 12 Aug 2017 15:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322427 - in head/lib/libc: stdlib string tests/string X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/lib/libc: stdlib string tests/string X-SVN-Commit-Revision: 322427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 15:18:18 -0000 Author: kib Date: Sat Aug 12 15:18:17 2017 New Revision: 322427 URL: https://svnweb.freebsd.org/changeset/base/322427 Log: Improve standard compliance for memset_s() and abort_handler_s(). abort_handler_s() currently simply calls abort(), though the standard specifies more: "Writes an implementation-defined message to stderr which must include the string pointed to by msg and calls abort()." memset_s() is missing error condition "n > smax", and does not invoke the constraint handler after filling the buffer: "following errors are detected at runtime and call the currently installed constraint handler function after storing ch in every location of the destination range [dest, dest+destsz) if dest and destsz are themselves valid", one of the errors is "n > smax" itself. Submitted by: Yuri Pankov MFC after: 1 week Differential revision: https://reviews.freebsd.org/D11991 Modified: head/lib/libc/stdlib/set_constraint_handler_s.c head/lib/libc/string/memset_s.c head/lib/libc/tests/string/memset_s_test.c Modified: head/lib/libc/stdlib/set_constraint_handler_s.c ============================================================================== --- head/lib/libc/stdlib/set_constraint_handler_s.c Sat Aug 12 14:58:09 2017 (r322426) +++ head/lib/libc/stdlib/set_constraint_handler_s.c Sat Aug 12 15:18:17 2017 (r322427) @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "un-namespace.h" #include "libc_private.h" @@ -81,10 +83,14 @@ __throw_constraint_handler_s(const char * restrict msg } void -abort_handler_s(const char * restrict msg __unused, - void * restrict ptr __unused, errno_t error __unused) +abort_handler_s(const char * restrict msg, void * restrict ptr __unused, + errno_t error __unused) { + static const char ahs[] = "abort_handler_s : "; + (void) _write(STDERR_FILENO, ahs, sizeof(ahs) - 1); + (void) _write(STDERR_FILENO, msg, strlen(msg)); + (void) _write(STDERR_FILENO, "\n", 1); abort(); } Modified: head/lib/libc/string/memset_s.c ============================================================================== --- head/lib/libc/string/memset_s.c Sat Aug 12 14:58:09 2017 (r322426) +++ head/lib/libc/string/memset_s.c Sat Aug 12 15:18:17 2017 (r322427) @@ -42,7 +42,7 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n) volatile unsigned char *dst; ret = EINVAL; - lim = smax; + lim = n < smax ? n : smax; v = (unsigned char)c; dst = (unsigned char *)s; if (s == NULL) { @@ -53,11 +53,14 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n) } else if (n > RSIZE_MAX) { __throw_constraint_handler_s("memset_s : n > RSIZE_MAX", ret); } else { - if (n < smax) - lim = n; while (lim > 0) dst[--lim] = v; - ret = 0; + if (n > smax) { + __throw_constraint_handler_s("memset_s : n > smax", + ret); + } else { + ret = 0; + } } return (ret); } Modified: head/lib/libc/tests/string/memset_s_test.c ============================================================================== --- head/lib/libc/tests/string/memset_s_test.c Sat Aug 12 14:58:09 2017 (r322426) +++ head/lib/libc/tests/string/memset_s_test.c Sat Aug 12 15:18:17 2017 (r322427) @@ -109,13 +109,18 @@ ATF_TC_BODY(n_lt_smax, tc) assert(b[2] == 3); } -/* n > smax */ +/* n > smax, handler */ ATF_TC_WITHOUT_HEAD(n_gt_smax); ATF_TC_BODY(n_gt_smax, tc) { char b[3] = {1, 2, 3}; - assert(memset_s(&b[0], 1, 9, 3) == 0); + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b[0], 1, 9, 3) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : n > smax") == 0); assert(b[0] == 9); assert(b[1] == 2); assert(b[2] == 3); From owner-svn-src-head@freebsd.org Sat Aug 12 15:51:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CAF2DDEC69; Sat, 12 Aug 2017 15:51:47 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46D7E65F39; Sat, 12 Aug 2017 15:51:47 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CFpkkf048900; Sat, 12 Aug 2017 15:51:46 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CFpkbS048899; Sat, 12 Aug 2017 15:51:46 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201708121551.v7CFpkbS048899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sat, 12 Aug 2017 15:51:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322428 - head/usr.bin/mkesdb X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/usr.bin/mkesdb X-SVN-Commit-Revision: 322428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 15:51:47 -0000 Author: sevan (doc committer) Date: Sat Aug 12 15:51:46 2017 New Revision: 322428 URL: https://svnweb.freebsd.org/changeset/base/322428 Log: Set usage() to show -d flag mkesdb supports the -d flag for enabling debug mode, as documented in the manual. PR: 209865 Submitted by: Maya Rashish Reviewed by: imp Approved by: bcr (mentor) Obtained from: NetBSD MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D11987 Modified: head/usr.bin/mkesdb/yacc.y Modified: head/usr.bin/mkesdb/yacc.y ============================================================================== --- head/usr.bin/mkesdb/yacc.y Sat Aug 12 15:18:17 2017 (r322427) +++ head/usr.bin/mkesdb/yacc.y Sat Aug 12 15:51:46 2017 (r322428) @@ -278,8 +278,8 @@ usage(void) { errx(EXIT_FAILURE, "usage:\n" - "\t%s [-o outfile] [infile]\n" - "\t%s -m [-o outfile] [infile]", + "\t%s [-d] [-o outfile] [infile]\n" + "\t%s -m [-d] [-o outfile] [infile]", getprogname(), getprogname()); } From owner-svn-src-head@freebsd.org Sat Aug 12 16:16:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 528A1DE0127; Sat, 12 Aug 2017 16:16:38 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-pg0-f51.google.com (mail-pg0-f51.google.com [74.125.83.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D6E966BE3; Sat, 12 Aug 2017 16:16:37 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-pg0-f51.google.com with SMTP id l64so26213210pge.5; Sat, 12 Aug 2017 09:16:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=HwktBXzSMQLFrKNqzfmXGAr/jt9+iFq0lg2sXAmuRqQ=; b=TR961h7XHbZVlZVytk8t8sLEokAtEP/7Qf/WuJ6n/7nYoThlT0NSKqehQhk7kZgMWq 8gcTaQdBoVkPvXDXZGZY8UvWVOy4+32uSBqwtZFNEPOHJuERyK6VittRa4DCbUnQIDb1 kdLR82u2lU27HE8P5n5hXfwW7S7djp4ccwC490rN/v8eQzJTDI3WXnwy+MyyAceE8OtG CBA/LruWomQXp4pNEAwjdpi4noYI32zM+MMhVtpzTMSj+5cKQ8iSKAVf9DW7ciOp0vdv cNaf0xwqZJg29A/S5AEiylb/wfCTMyz/mETvd8OBMhY0f3cqIHExyJ1WKki0c8QVxJLA TJLg== X-Gm-Message-State: AHYfb5gKyg9wl9vZcFcvTH5NePr1KDwl3EL6uFIDft/V57gOvfstqilS tbA2ohBZSyT7ByvB14g= X-Received: by 10.99.175.1 with SMTP id w1mr18442935pge.392.1502554596955; Sat, 12 Aug 2017 09:16:36 -0700 (PDT) Received: from mail-pf0-f176.google.com (mail-pf0-f176.google.com. [209.85.192.176]) by smtp.gmail.com with ESMTPSA id b4sm6517025pfg.132.2017.08.12.09.16.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Aug 2017 09:16:36 -0700 (PDT) Received: by mail-pf0-f176.google.com with SMTP id h68so26873173pfk.0; Sat, 12 Aug 2017 09:16:36 -0700 (PDT) X-Received: by 10.98.70.200 with SMTP id o69mr19948077pfi.325.1502554596638; Sat, 12 Aug 2017 09:16:36 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.100.150.15 with HTTP; Sat, 12 Aug 2017 09:16:36 -0700 (PDT) In-Reply-To: <201708121518.v7CFIHld035164@repo.freebsd.org> References: <201708121518.v7CFIHld035164@repo.freebsd.org> From: Conrad Meyer Date: Sat, 12 Aug 2017 09:16:36 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322427 - in head/lib/libc: stdlib string tests/string To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 16:16:38 -0000 On Sat, Aug 12, 2017 at 8:18 AM, Konstantin Belousov wrote: > Author: kib > Date: Sat Aug 12 15:18:17 2017 > New Revision: 322427 > URL: https://svnweb.freebsd.org/changeset/base/322427 > > Log: > Improve standard compliance for memset_s() and abort_handler_s(). > > abort_handler_s() currently simply calls abort(), though the standard > specifies more: "Writes an implementation-defined message to stderr > which must include the string pointed to by msg and calls abort()." > > memset_s() is missing error condition "n > smax", and does not invoke > the constraint handler after filling the buffer: "following errors are > detected at runtime and call the currently installed constraint > handler function after storing ch in every location of the destination > range [dest, dest+destsz) if dest and destsz are themselves valid", > one of the errors is "n > smax" itself. > > Submitted by: Yuri Pankov > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D11991 PR: 221323 From owner-svn-src-head@freebsd.org Sat Aug 12 16:26:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 950F4DE0983 for ; Sat, 12 Aug 2017 16:26:35 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (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 78FE367153 for ; Sat, 12 Aug 2017 16:26:35 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: feb95366-7f7a-11e7-b49e-71a67e0dab63 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id feb95366-7f7a-11e7-b49e-71a67e0dab63; Sat, 12 Aug 2017 16:26:29 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v7CGQV8E003870; Sat, 12 Aug 2017 10:26:31 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1502555191.47886.30.camel@freebsd.org> Subject: Re: svn commit: r322418 - head/lib/msun/src From: Ian Lepore To: Ryan Libby , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 12 Aug 2017 10:26:31 -0600 In-Reply-To: <201708112241.v7BMfP5X028262@repo.freebsd.org> References: <201708112241.v7BMfP5X028262@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 16:26:35 -0000 On Fri, 2017-08-11 at 22:41 +0000, Ryan Libby wrote: > Author: rlibby > Date: Fri Aug 11 22:41:24 2017 > New Revision: 322418 > URL: https://svnweb.freebsd.org/changeset/base/322418 > > Log: >   lib/msun: avoid referring to broken LDBL_MAX >    >   LDBL_MAX is broken on i386: >   https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September > /000288.html >    >   Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32 >   for some time, and newer versions of gcc are now warning that the >   "floating constant exceeds range of 'long double'".  Avoid this by >   referring to half the value of LDBL_MAX instead. >    >   Reviewed by: bde >   Approved by: markj (mentor) >   Sponsored by: Dell EMC Isilon > I now get this error when building toolchain for sparc: cc -isystem /b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/include -L/b/staging/freebsd/head/obj/sparc64.spar c64/b/staging/freebsd/head/src/tmp/usr/lib -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/lib --sysroot=/b/ staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/ src/tmp/usr/bin -fPIC -DPIC -g -O2 -pipe -I/b/staging/freebsd/head/src/lib/msun/ld128 -I/b/staging/freebsd/head/src/lib/msun/sparc64 -I/b/sta ging/freebsd/head/src/lib/msun/src -I/b/staging/freebsd/head/src/lib/libc/include  -I/b/staging/freebsd/head/src/lib/libc/sparc64   -MD  -MF. depend.catrigl.pico -MTcatrigl.pico -std=gnu99 -fstack-protector-strong -Wsystem-headers -Werror -Wno-pointer-sign -Wno-unknown-pragmas     - c /b/staging/freebsd/head/src/lib/msun/src/catrigl.c -o catrigl.pico /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting "0x0.8p" and "(" does not give a valid preprocessing token /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: exponent has no digits /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting ")" and "L" does not give a valid preprocessing token /b/staging/freebsd/head/src/lib/msun/src/catrigl.c: In function 'clog_for_large_values': /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310: error: expected ')' before 'L' *** [catrigl.pico] Error code 1 From owner-svn-src-head@freebsd.org Sat Aug 12 16:57:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B436DD93620; Sat, 12 Aug 2017 16:57:41 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pg0-f44.google.com (mail-pg0-f44.google.com [74.125.83.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EE9B681FF; Sat, 12 Aug 2017 16:57:41 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pg0-f44.google.com with SMTP id v77so26473135pgb.3; Sat, 12 Aug 2017 09:57:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=VhR92VbNFOvyGUQmoqImmA6Aq6yT5mnaXSghQ0cZGPM=; b=ksTNz+hKAfN6Iu+CDalg8IS8aueTjNUk+EuqE2Tand4o0lsK7LqdgVftDqiN5wBOGA MFRsUlnkn11XLj8jgtDaoPCR29vnii0oT9pNRTHbqM3RKWJ/7o0tiB76GNh6Fd+gXF6K UU3vWanNKHy9O494TjG1i9bjSjdEv0QfFh2fUFkOBvyW5gbcq6EzIsS7NvQeecdMmzAu LiWyBcB8cthmuxhQKuucY+VZ9llB12L4hHFE/ZbEXd5+DzJ8dbVhpjooKe/81E1pZbdk m2STP3cjfv6kcow6qIRu8/0B5jXnCQeZODaWgK/EUrxszE5viajiP+OkhPT7ql4gNyAq T2rw== X-Gm-Message-State: AHYfb5jDN0b8VQtOsQVggAGTwMMRwxaKDNn1uYyRDz+0h6cdHqA2a7qJ +6+KYrAUbksM1pkQ8ck6Ig== X-Received: by 10.98.198.145 with SMTP id x17mr20199330pfk.272.1502557054862; Sat, 12 Aug 2017 09:57:34 -0700 (PDT) Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com. [209.85.192.181]) by smtp.gmail.com with ESMTPSA id f15sm7228583pfj.127.2017.08.12.09.57.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Aug 2017 09:57:34 -0700 (PDT) Received: by mail-pf0-f181.google.com with SMTP id t86so27034684pfe.2; Sat, 12 Aug 2017 09:57:33 -0700 (PDT) X-Received: by 10.99.96.67 with SMTP id u64mr18496115pgb.424.1502557053761; Sat, 12 Aug 2017 09:57:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.207.193 with HTTP; Sat, 12 Aug 2017 09:57:33 -0700 (PDT) In-Reply-To: <1502555191.47886.30.camel@freebsd.org> References: <201708112241.v7BMfP5X028262@repo.freebsd.org> <1502555191.47886.30.camel@freebsd.org> From: Ryan Libby Date: Sat, 12 Aug 2017 09:57:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322418 - head/lib/msun/src To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 16:57:41 -0000 On Sat, Aug 12, 2017 at 9:26 AM, Ian Lepore wrote: > On Fri, 2017-08-11 at 22:41 +0000, Ryan Libby wrote: >> Author: rlibby >> Date: Fri Aug 11 22:41:24 2017 >> New Revision: 322418 >> URL: https://svnweb.freebsd.org/changeset/base/322418 >> >> Log: >> lib/msun: avoid referring to broken LDBL_MAX >> >> LDBL_MAX is broken on i386: >> https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September >> /000288.html >> >> Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32 >> for some time, and newer versions of gcc are now warning that the >> "floating constant exceeds range of 'long double'". Avoid this by >> referring to half the value of LDBL_MAX instead. >> >> Reviewed by: bde >> Approved by: markj (mentor) >> Sponsored by: Dell EMC Isilon >> > > I now get this error when building toolchain for sparc: > > cc -isystem /b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/include -L/b/staging/freebsd/head/obj/sparc64.spar > c64/b/staging/freebsd/head/src/tmp/usr/lib -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/lib --sysroot=/b/ > staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/ > src/tmp/usr/bin -fPIC -DPIC -g -O2 -pipe -I/b/staging/freebsd/head/src/lib/msun/ld128 -I/b/staging/freebsd/head/src/lib/msun/sparc64 -I/b/sta > ging/freebsd/head/src/lib/msun/src -I/b/staging/freebsd/head/src/lib/libc/include -I/b/staging/freebsd/head/src/lib/libc/sparc64 -MD -MF. > depend.catrigl.pico -MTcatrigl.pico -std=gnu99 -fstack-protector-strong -Wsystem-headers -Werror -Wno-pointer-sign -Wno-unknown-pragmas - > c /b/staging/freebsd/head/src/lib/msun/src/catrigl.c -o catrigl.pico > /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting "0x0.8p" and "(" does not give a valid preprocessing token > /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: exponent has no digits > /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting ")" and "L" does not give a valid preprocessing token > /b/staging/freebsd/head/src/lib/msun/src/catrigl.c: In function 'clog_for_large_values': > /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310: error: expected ')' before 'L' > *** [catrigl.pico] Error code 1 Thanks, I see it. It also shows up on the sparc64 ci build [1]. Let me see if I can find a quick fix, else I guess we can just back it out for now. [1] https://ci.freebsd.org/job/FreeBSD-head-sparc64-build/2534/ From owner-svn-src-head@freebsd.org Sat Aug 12 17:07:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4D98D93F9A; Sat, 12 Aug 2017 17:07:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9EA696871B; Sat, 12 Aug 2017 17:07:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CH7Rca079852; Sat, 12 Aug 2017 17:07:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CH7Rjh079846; Sat, 12 Aug 2017 17:07:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708121707.v7CH7Rjh079846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 12 Aug 2017 17:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322429 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk X-SVN-Commit-Revision: 322429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 17:07:28 -0000 Author: imp Date: Sat Aug 12 17:07:27 2017 New Revision: 322429 URL: https://svnweb.freebsd.org/changeset/base/322429 Log: Make _TO_CPUARCH macro for ARCH to CPUARCH conversions Consolidate all the regular expressions to convert from MACHINE_ARCH to MACHINE_CPUARCH into a variable and use that variable in preference to the almost identical copies in the tree (which should have been identical). Differential Revision: https://reviews.freebsd.org/D11986 Modified: head/Makefile head/gnu/usr.bin/binutils/Makefile.inc0 head/gnu/usr.bin/cc/Makefile.tgt head/gnu/usr.bin/gdb/Makefile.inc head/gnu/usr.bin/gdb/libgdb/Makefile head/share/mk/sys.mk Modified: head/Makefile ============================================================================== --- head/Makefile Sat Aug 12 15:51:46 2017 (r322428) +++ head/Makefile Sat Aug 12 17:07:27 2017 (r322429) @@ -245,12 +245,17 @@ _MAKE+= MK_META_MODE=no .endif # !exists(/dev/filemon) && !defined(NO_FILEMON) .endif # !defined(_CAN_USE_META_MODE) -# Guess machine architecture from machine type, and vice versa. +# Guess target architecture from target type, and vice versa, based on +# historic FreeBSD practice of tending to have TARGET == TARGET_ARCH +# expanding to TARGET == TARGET_CPUARCH in recent times, with known +# exceptions. .if !defined(TARGET_ARCH) && defined(TARGET) +# T->TA mapping is usually TARGET with arm64 the odd man out _TARGET_ARCH= ${TARGET:S/arm64/aarch64/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} -_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/powerpcspe/powerpc/:C/riscv64(sf)?/riscv/} +# TA->T mapping is accidentally CPUARCH with aarch64 the odd man out +_TARGET= ${TARGET_ARCH:${__TO_CPUARCH}:C/aarch64/arm64/} .endif .if defined(TARGET) && !defined(_TARGET) _TARGET=${TARGET} Modified: head/gnu/usr.bin/binutils/Makefile.inc0 ============================================================================== --- head/gnu/usr.bin/binutils/Makefile.inc0 Sat Aug 12 15:51:46 2017 (r322428) +++ head/gnu/usr.bin/binutils/Makefile.inc0 Sat Aug 12 17:07:27 2017 (r322429) @@ -7,7 +7,7 @@ VERSION= "2.17.50 [FreeBSD] 2007-07-03" .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/cc/Makefile.tgt ============================================================================== --- head/gnu/usr.bin/cc/Makefile.tgt Sat Aug 12 15:51:46 2017 (r322428) +++ head/gnu/usr.bin/cc/Makefile.tgt Sat Aug 12 17:07:27 2017 (r322429) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv64/} +TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- head/gnu/usr.bin/gdb/Makefile.inc Sat Aug 12 15:51:46 2017 (r322428) +++ head/gnu/usr.bin/gdb/Makefile.inc Sat Aug 12 17:07:27 2017 (r322429) @@ -23,7 +23,7 @@ OBJ_RL= ${OBJTOP}/gnu/lib/libreadline/readline # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/gdb/libgdb/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/libgdb/Makefile Sat Aug 12 15:51:46 2017 (r322428) +++ head/gnu/usr.bin/gdb/libgdb/Makefile Sat Aug 12 17:07:27 2017 (r322429) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Sat Aug 12 15:51:46 2017 (r322428) +++ head/share/mk/sys.mk Sat Aug 12 17:07:27 2017 (r322429) @@ -8,12 +8,13 @@ unix ?= We run FreeBSD, not UNIX. # # MACHINE_CPUARCH defines a collection of MACHINE_ARCH. Machines with # the same MACHINE_ARCH can run each other's binaries, so it necessarily -# has word size and endian swizzled in. However, support files for +# has word size and endian swizzled in. However, the source files for # these machines often are shared amongst all combinations of size # and/or endian. This is called MACHINE_CPU in NetBSD, but that's used # for something different in FreeBSD. # -MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/} +__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/ +MACHINE_CPUARCH=${MACHINE_ARCH:${__TO_CPUARCH}} .endif From owner-svn-src-head@freebsd.org Sat Aug 12 17:07:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27C92D9400E; Sat, 12 Aug 2017 17:07:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E06ED6874B; Sat, 12 Aug 2017 17:07:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CH7XEN079905; Sat, 12 Aug 2017 17:07:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CH7X78079904; Sat, 12 Aug 2017 17:07:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708121707.v7CH7X78079904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 12 Aug 2017 17:07:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322430 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 17:07:34 -0000 Author: imp Date: Sat Aug 12 17:07:32 2017 New Revision: 322430 URL: https://svnweb.freebsd.org/changeset/base/322430 Log: arm*hf is no longer a thing, remove it from the conversion now that it's easy. Submitted by: andyt@ Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Sat Aug 12 17:07:27 2017 (r322429) +++ head/share/mk/sys.mk Sat Aug 12 17:07:32 2017 (r322430) @@ -13,7 +13,7 @@ unix ?= We run FreeBSD, not UNIX. # and/or endian. This is called MACHINE_CPU in NetBSD, but that's used # for something different in FreeBSD. # -__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/ +__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/ MACHINE_CPUARCH=${MACHINE_ARCH:${__TO_CPUARCH}} .endif From owner-svn-src-head@freebsd.org Sat Aug 12 17:39:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B802DB6422; Sat, 12 Aug 2017 17:39:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AC9A6A0D2; Sat, 12 Aug 2017 17:39:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CHdWDn092505; Sat, 12 Aug 2017 17:39:32 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CHdWYG092504; Sat, 12 Aug 2017 17:39:32 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708121739.v7CHdWYG092504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 12 Aug 2017 17:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322431 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 322431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 17:39:35 -0000 Author: ian Date: Sat Aug 12 17:39:32 2017 New Revision: 322431 URL: https://svnweb.freebsd.org/changeset/base/322431 Log: Bid for the device with BUS_PROBE_GENERIC, because this is very much a generic driver with minimal feature support for a large number of chips. More featureful per-chip drivers might exist (especially out-of-tree) and those should win the bidding even if they use BUS_PROBE_DEFAULT. Modified: head/sys/dev/iicbus/nxprtc.c Modified: head/sys/dev/iicbus/nxprtc.c ============================================================================== --- head/sys/dev/iicbus/nxprtc.c Sat Aug 12 17:07:32 2017 (r322430) +++ head/sys/dev/iicbus/nxprtc.c Sat Aug 12 17:39:32 2017 (r322431) @@ -702,7 +702,7 @@ nxprtc_probe(device_t dev) #endif device_set_desc(dev, desc_strings[chiptype]); - return (BUS_PROBE_DEFAULT); + return (BUS_PROBE_GENERIC); } static int From owner-svn-src-head@freebsd.org Sat Aug 12 17:46:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23BC8DB7049; Sat, 12 Aug 2017 17:46:52 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5C076A787; Sat, 12 Aug 2017 17:46:51 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CHkokc096567; Sat, 12 Aug 2017 17:46:50 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CHkoGT096566; Sat, 12 Aug 2017 17:46:50 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201708121746.v7CHkoGT096566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sat, 12 Aug 2017 17:46:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322432 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 322432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 17:46:52 -0000 Author: sevan (doc committer) Date: Sat Aug 12 17:46:50 2017 New Revision: 322432 URL: https://svnweb.freebsd.org/changeset/base/322432 Log: Add missing header. S_IRUSR is defined in sys/stat.h PR: 209229 Submitted by: Approved by: bcr (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D12007 Modified: head/lib/libc/sys/shmget.2 Modified: head/lib/libc/sys/shmget.2 ============================================================================== --- head/lib/libc/sys/shmget.2 Sat Aug 12 17:39:32 2017 (r322431) +++ head/lib/libc/sys/shmget.2 Sat Aug 12 17:46:50 2017 (r322432) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 17, 2010 +.Dd August 12, 2017 .Dt SHMGET 2 .Os .Sh NAME @@ -35,6 +35,7 @@ .Lb libc .Sh SYNOPSIS .In sys/types.h +.In sys/stat.h .In sys/ipc.h .In sys/shm.h .Ft int From owner-svn-src-head@freebsd.org Sat Aug 12 17:55:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42168DB7A80; Sat, 12 Aug 2017 17:55:54 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pf0-f180.google.com (mail-pf0-f180.google.com [209.85.192.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B6E56ADF7; Sat, 12 Aug 2017 17:55:53 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pf0-f180.google.com with SMTP id t86so27328961pfe.2; Sat, 12 Aug 2017 10:55:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wo1LcNez6oa2HxQYx3ewCFu2SCftSL/b9PCL6Wjgjvc=; b=bf4C242SCT9f7jJsJTtgiluqwZ9Cwk71nZkU25lYMufD5wTJ17lQXEqMnZrZnjd6OK 08BLalJVLIHdIYN/0/too6ykZHD0Ldl7+BnJaAYFy27yhkn/uG9SAqBKQOO9FyVlb5si dsK1YIDIVuLJxTiZl9UQt4xeHmc68fVS00M45wlj8FotMQkgmwXWwmXb4GT5Te5UUoOo EHrmWdfCrnGfW6soV92/JXh8WELG04CN6ssqvhWTgCGg9dc9AaawMd2mtoV2O+QzI5lu 2nqGbN81pSgah9xLN/KVjkXSAJ3w5+SFMG+y2KERnsndEVQXLYDYBVLxhK3Xo1w3qRfB BzGg== X-Gm-Message-State: AHYfb5jfoLzr1lOQvf3SuQVVX3Yx+PjxjetXUcMa/DUYWvXF9lpfV+aq bZ2Hq66bzVwMB4RwXzb4DQ== X-Received: by 10.98.64.196 with SMTP id f65mr19762026pfd.123.1502560552948; Sat, 12 Aug 2017 10:55:52 -0700 (PDT) Received: from mail-pg0-f52.google.com (mail-pg0-f52.google.com. [74.125.83.52]) by smtp.gmail.com with ESMTPSA id e128sm6394626pfg.114.2017.08.12.10.55.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Aug 2017 10:55:52 -0700 (PDT) Received: by mail-pg0-f52.google.com with SMTP id u5so26886378pgn.0; Sat, 12 Aug 2017 10:55:52 -0700 (PDT) X-Received: by 10.98.78.73 with SMTP id c70mr19765970pfb.17.1502560552402; Sat, 12 Aug 2017 10:55:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.207.193 with HTTP; Sat, 12 Aug 2017 10:55:51 -0700 (PDT) In-Reply-To: References: <201708112241.v7BMfP5X028262@repo.freebsd.org> <1502555191.47886.30.camel@freebsd.org> From: Ryan Libby Date: Sat, 12 Aug 2017 10:55:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322418 - head/lib/msun/src To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Bruce Evans Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 17:55:54 -0000 On Sat, Aug 12, 2017 at 9:57 AM, Ryan Libby wrote: > On Sat, Aug 12, 2017 at 9:26 AM, Ian Lepore wrote: >> On Fri, 2017-08-11 at 22:41 +0000, Ryan Libby wrote: >>> Author: rlibby >>> Date: Fri Aug 11 22:41:24 2017 >>> New Revision: 322418 >>> URL: https://svnweb.freebsd.org/changeset/base/322418 >>> >>> Log: >>> lib/msun: avoid referring to broken LDBL_MAX >>> >>> LDBL_MAX is broken on i386: >>> https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September >>> /000288.html >>> >>> Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32 >>> for some time, and newer versions of gcc are now warning that the >>> "floating constant exceeds range of 'long double'". Avoid this by >>> referring to half the value of LDBL_MAX instead. >>> >>> Reviewed by: bde >>> Approved by: markj (mentor) >>> Sponsored by: Dell EMC Isilon >>> >> >> I now get this error when building toolchain for sparc: >> >> cc -isystem /b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/include -L/b/staging/freebsd/head/obj/sparc64.spar >> c64/b/staging/freebsd/head/src/tmp/usr/lib -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/lib --sysroot=/b/ >> staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/ >> src/tmp/usr/bin -fPIC -DPIC -g -O2 -pipe -I/b/staging/freebsd/head/src/lib/msun/ld128 -I/b/staging/freebsd/head/src/lib/msun/sparc64 -I/b/sta >> ging/freebsd/head/src/lib/msun/src -I/b/staging/freebsd/head/src/lib/libc/include -I/b/staging/freebsd/head/src/lib/libc/sparc64 -MD -MF. >> depend.catrigl.pico -MTcatrigl.pico -std=gnu99 -fstack-protector-strong -Wsystem-headers -Werror -Wno-pointer-sign -Wno-unknown-pragmas - >> c /b/staging/freebsd/head/src/lib/msun/src/catrigl.c -o catrigl.pico >> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting "0x0.8p" and "(" does not give a valid preprocessing token >> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: exponent has no digits >> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting ")" and "L" does not give a valid preprocessing token >> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c: In function 'clog_for_large_values': >> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310: error: expected ')' before 'L' >> *** [catrigl.pico] Error code 1 > > Thanks, I see it. It also shows up on the sparc64 ci build [1]. Let me > see if I can find a quick fix, else I guess we can just back it out for > now. > > [1] https://ci.freebsd.org/job/FreeBSD-head-sparc64-build/2534/ A few possible quick fixes: - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP definitions from (+16384) to 16384. - Change HALF_LDBL_MAX from #define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L) to #if LDBL_MAX_EXP != 0x4000 #error "Unsupported long double format" #endif #define HALF_LDBL_MAX 0x0.8p16384L - Change the HALF_LDBL_MAX constant to a variable constructed with LD80C(), I think with LD80C(0x8000000000000000, 16383, 5.9486574767861588254e+4931L) but this also requires #error for LDBL_MAX_EXP != 0x4000, so not really any better than the above. I think I will back the patch out for now and go back to review. From owner-svn-src-head@freebsd.org Sat Aug 12 18:11:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94112DC2BD3; Sat, 12 Aug 2017 18:11:42 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 636FE6B7B4; Sat, 12 Aug 2017 18:11:42 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CIBfU9005344; Sat, 12 Aug 2017 18:11:41 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CIBf29005343; Sat, 12 Aug 2017 18:11:41 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201708121811.v7CIBf29005343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 12 Aug 2017 18:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322434 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 18:11:42 -0000 Author: lwhsu (ports committer) Date: Sat Aug 12 18:11:41 2017 New Revision: 322434 URL: https://svnweb.freebsd.org/changeset/base/322434 Log: Re-remove excess / for installing SYMLINKS This excess / was introduced in r280129, and fixed in r295230, but got re-introduced while merging another branch in r298107. Approved by: gjb Differential Revision: https://reviews.freebsd.org/D11995 Modified: head/share/mk/bsd.links.mk Modified: head/share/mk/bsd.links.mk ============================================================================== --- head/share/mk/bsd.links.mk Sat Aug 12 17:50:22 2017 (r322433) +++ head/share/mk/bsd.links.mk Sat Aug 12 18:11:41 2017 (r322434) @@ -20,5 +20,5 @@ _installlinks: .endfor .for s t in ${SYMLINKS} @${ECHO} "${t} -> ${s}" ;\ - ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}/${t} + ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}${t} .endfor From owner-svn-src-head@freebsd.org Sat Aug 12 18:28:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87A2DDC3B7C; Sat, 12 Aug 2017 18:28:03 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5722B6C01C; Sat, 12 Aug 2017 18:28:03 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CIS2b9013816; Sat, 12 Aug 2017 18:28:02 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CIS2RY013813; Sat, 12 Aug 2017 18:28:02 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708121828.v7CIS2RY013813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Sat, 12 Aug 2017 18:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322435 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 322435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 18:28:03 -0000 Author: rlibby Date: Sat Aug 12 18:28:02 2017 New Revision: 322435 URL: https://svnweb.freebsd.org/changeset/base/322435 Log: Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches Either need a different way to spell HALF_LDBL_MAX, or a different way to spell LDBL_MAX_EXP, or a different approach. Reported by: ian Modified: head/lib/msun/src/catrigl.c head/lib/msun/src/math_private.h head/lib/msun/src/s_csqrtl.c Modified: head/lib/msun/src/catrigl.c ============================================================================== --- head/lib/msun/src/catrigl.c Sat Aug 12 18:11:41 2017 (r322434) +++ head/lib/msun/src/catrigl.c Sat Aug 12 18:28:02 2017 (r322435) @@ -307,7 +307,7 @@ clog_for_large_values(long double complex z) ay = t; } - if (ax >= HALF_LDBL_MAX) + if (ax > LDBL_MAX / 2) return (CMPLXL(logl(hypotl(x / m_e, y / m_e)) + 1, atan2l(y, x))); Modified: head/lib/msun/src/math_private.h ============================================================================== --- head/lib/msun/src/math_private.h Sat Aug 12 18:11:41 2017 (r322434) +++ head/lib/msun/src/math_private.h Sat Aug 12 18:28:02 2017 (r322435) @@ -272,15 +272,6 @@ do { \ #define LD80C(m, ex, v) { .e = (v), } #endif -/* - * XXX LDBL_MAX is broken on i386. If the precise value of LDBL_MAX is not - * needed, this may be worked around by instead referring to a proxy, such - * as HALF_LDBL_MAX, below. HALF_LDBL_MAX is approximately LDBL_MAX / 2, - * actually just greater than. Note that 2 * HALF_LDBL_MAX will always - * overflow to infinity, regardless of the precision and rounding modes. - */ -#define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L) - #ifdef FLT_EVAL_METHOD /* * Attempt to get strict C99 semantics for assignment with non-C99 compilers. Modified: head/lib/msun/src/s_csqrtl.c ============================================================================== --- head/lib/msun/src/s_csqrtl.c Sat Aug 12 18:11:41 2017 (r322434) +++ head/lib/msun/src/s_csqrtl.c Sat Aug 12 18:28:02 2017 (r322435) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #pragma STDC CX_LIMITED_RANGE ON /* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). */ -#define THRESH (HALF_LDBL_MAX / 1.207106781186547524400844362104849L) +#define THRESH (LDBL_MAX / 2.414213562373095048801688724209698L) long double complex csqrtl(long double complex z) From owner-svn-src-head@freebsd.org Sat Aug 12 18:38:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8CCCDC48D9; Sat, 12 Aug 2017 18:38:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7306A6C7A9; Sat, 12 Aug 2017 18:38:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CIcIJr017757; Sat, 12 Aug 2017 18:38:18 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CIcIIn017756; Sat, 12 Aug 2017 18:38:18 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708121838.v7CIcIIn017756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 12 Aug 2017 18:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322436 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 322436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 18:38:19 -0000 Author: jhb Date: Sat Aug 12 18:38:18 2017 New Revision: 322436 URL: https://svnweb.freebsd.org/changeset/base/322436 Log: Don't panic for PT_GETFPREGS. Only fetch the VFP state from the CPU if the thread whose registers are being requested is the current thread. If a stopped thread's registers are being fetched by a debugger, the saved state in the PCB is already valid. Reviewed by: andrew MFC after: 1 week Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sat Aug 12 18:28:02 2017 (r322435) +++ head/sys/arm64/arm64/machdep.c Sat Aug 12 18:38:18 2017 (r322436) @@ -222,7 +222,8 @@ fill_fpregs(struct thread *td, struct fpreg *regs) * If we have just been running VFP instructions we will * need to save the state to memcpy it below. */ - vfp_save_state(td, pcb); + if (td == curthread) + vfp_save_state(td, pcb); KASSERT(pcb->pcb_fpusaved == &pcb->pcb_fpustate, ("Called fill_fpregs while the kernel is using the VFP")); From owner-svn-src-head@freebsd.org Sat Aug 12 18:42:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 582D9DC4E57; Sat, 12 Aug 2017 18:42:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3433E6CC34; Sat, 12 Aug 2017 18:42:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CIgtQ6021492; Sat, 12 Aug 2017 18:42:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CIgtJA021488; Sat, 12 Aug 2017 18:42:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708121842.v7CIgtJA021488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 12 Aug 2017 18:42:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322437 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 322437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 18:42:56 -0000 Author: jhb Date: Sat Aug 12 18:42:54 2017 New Revision: 322437 URL: https://svnweb.freebsd.org/changeset/base/322437 Log: Reliably enable debug exceptions on all CPUs. Previously, debug exceptions were only enabled on the boot CPU if DDB was enabled in the dbg_monitor_init() function. APs also called this function, but since mp_machdep.c doesn't include opt_ddb.h, the APs ended up calling an empty stub defined in instead of the real function. Also, if DDB was not enabled in the kernel, the boot CPU would not enable debug exceptions. Fix this by adding a new dbg_init() function that always clears the OS lock to enable debug exceptions which the boot CPU and the APs call. This function also calls dbg_monitor_init() to enable hardware breakpoints from DDB on all CPUs if DDB is enabled. Eventually base support for hardware breakpoints/watchpoints will need to move out of the DDB-only debug_monitor.c for use by userland debuggers. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D12001 Modified: head/sys/arm64/arm64/debug_monitor.c head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/include/machdep.h Modified: head/sys/arm64/arm64/debug_monitor.c ============================================================================== --- head/sys/arm64/arm64/debug_monitor.c Sat Aug 12 18:38:18 2017 (r322436) +++ head/sys/arm64/arm64/debug_monitor.c Sat Aug 12 18:42:54 2017 (r322437) @@ -453,15 +453,12 @@ dbg_monitor_init(void) { u_int i; - /* Clear OS lock */ - WRITE_SPECIALREG(OSLAR_EL1, 0); - /* Find out many breakpoints and watchpoints we can use */ dbg_watchpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 20) & 0xf) + 1; dbg_breakpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 12) & 0xf) + 1; if (bootverbose && PCPU_GET(cpuid) == 0) { - db_printf("%d watchpoints and %d breakpoints supported\n", + printf("%d watchpoints and %d breakpoints supported\n", dbg_watchpoint_num, dbg_breakpoint_num); } Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sat Aug 12 18:38:18 2017 (r322436) +++ head/sys/arm64/arm64/machdep.c Sat Aug 12 18:42:54 2017 (r322437) @@ -1051,11 +1051,24 @@ initarm(struct arm64_bootparams *abp) mutex_init(); init_param2(physmem); - dbg_monitor_init(); + dbg_init(); kdb_init(); pan_enable(); early_boot = 0; +} + +void +dbg_init(void) +{ + + /* Clear OS lock */ + WRITE_SPECIALREG(OSLAR_EL1, 0); + + /* This permits DDB to use debug registers for watchpoints. */ + dbg_monitor_init(); + + /* TODO: Eventually will need to initialize debug registers here. */ } #ifdef DDB Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Sat Aug 12 18:38:18 2017 (r322436) +++ head/sys/arm64/arm64/mp_machdep.c Sat Aug 12 18:42:54 2017 (r322437) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -272,7 +271,7 @@ init_secondary(uint64_t cpu) vfp_init(); #endif - dbg_monitor_init(); + dbg_init(); pan_enable(); /* Enable interrupts */ Modified: head/sys/arm64/include/machdep.h ============================================================================== --- head/sys/arm64/include/machdep.h Sat Aug 12 18:38:18 2017 (r322436) +++ head/sys/arm64/include/machdep.h Sat Aug 12 18:42:54 2017 (r322437) @@ -48,6 +48,7 @@ extern enum arm64_bus arm64_bus_method; extern vm_paddr_t physmap[]; extern u_int physmap_idx; +void dbg_init(void); void initarm(struct arm64_bootparams *); extern void (*pagezero)(void *); From owner-svn-src-head@freebsd.org Sat Aug 12 19:17:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C3D8DC6561; Sat, 12 Aug 2017 19:17:50 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 668656E362; Sat, 12 Aug 2017 19:17:50 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CJHnME035284; Sat, 12 Aug 2017 19:17:49 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CJHmUp035277; Sat, 12 Aug 2017 19:17:48 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201708121917.v7CJHmUp035277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 12 Aug 2017 19:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322438 - in head: bin/sh/tests bin/sh/tests/invocation etc/mtree X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: in head: bin/sh/tests bin/sh/tests/invocation etc/mtree X-SVN-Commit-Revision: 322438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 19:17:50 -0000 Author: jilles Date: Sat Aug 12 19:17:48 2017 New Revision: 322438 URL: https://svnweb.freebsd.org/changeset/base/322438 Log: sh: Add tests for sh -c that already pass. PR: 220587 Submitted by: Ryan Moeller Added: head/bin/sh/tests/invocation/ head/bin/sh/tests/invocation/Makefile (contents, props changed) head/bin/sh/tests/invocation/sh-ac1.0 (contents, props changed) head/bin/sh/tests/invocation/sh-c1.0 (contents, props changed) head/bin/sh/tests/invocation/sh-ca1.0 (contents, props changed) head/bin/sh/tests/invocation/sh-fca1.0 (contents, props changed) Modified: head/bin/sh/tests/Makefile head/etc/mtree/BSD.tests.dist Modified: head/bin/sh/tests/Makefile ============================================================================== --- head/bin/sh/tests/Makefile Sat Aug 12 18:42:54 2017 (r322437) +++ head/bin/sh/tests/Makefile Sat Aug 12 19:17:48 2017 (r322438) @@ -6,6 +6,7 @@ TESTS_SUBDIRS+= builtins TESTS_SUBDIRS+= errors TESTS_SUBDIRS+= execution TESTS_SUBDIRS+= expansion +TESTS_SUBDIRS+= invocation TESTS_SUBDIRS+= parameters TESTS_SUBDIRS+= parser TESTS_SUBDIRS+= set-e Added: head/bin/sh/tests/invocation/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/Makefile Sat Aug 12 19:17:48 2017 (r322438) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T} + +.PATH: ${.CURDIR:H} +ATF_TESTS_SH= functional_test + +${PACKAGE}FILES+= sh-ac1.0 +${PACKAGE}FILES+= sh-c1.0 +${PACKAGE}FILES+= sh-ca1.0 +${PACKAGE}FILES+= sh-fca1.0 + +.include Added: head/bin/sh/tests/invocation/sh-ac1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/sh-ac1.0 Sat Aug 12 19:17:48 2017 (r322438) @@ -0,0 +1,7 @@ +# $FreeBSD$ +# Test that attached options before c are processed + +case `${SH} -ac 'echo $-:$0' moo` in +*a*:moo) true ;; +*) false ;; +esac Added: head/bin/sh/tests/invocation/sh-c1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/sh-c1.0 Sat Aug 12 19:17:48 2017 (r322438) @@ -0,0 +1,4 @@ +# $FreeBSD$ +# Test that -c executes command_string with the given name and arg + +${SH} -c 'echo $0 $@' moo foo | grep -qx -- "moo foo" Added: head/bin/sh/tests/invocation/sh-ca1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/sh-ca1.0 Sat Aug 12 19:17:48 2017 (r322438) @@ -0,0 +1,7 @@ +# $FreeBSD$ +# Test that attached options after c are processed + +case `${SH} -ca 'echo $-:$0' moo` in +*a*:moo) true ;; +*) false ;; +esac Added: head/bin/sh/tests/invocation/sh-fca1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/sh-fca1.0 Sat Aug 12 19:17:48 2017 (r322438) @@ -0,0 +1,7 @@ +# $FreeBSD$ +# Test that attached options before and after c are processed + +case `${SH} -fca 'echo $-:$-:$0:$@' foo -bar` in +*f*:*a*:foo:-bar) true ;; +*) false ;; +esac Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Sat Aug 12 18:42:54 2017 (r322437) +++ head/etc/mtree/BSD.tests.dist Sat Aug 12 19:17:48 2017 (r322438) @@ -39,6 +39,8 @@ .. expansion .. + invocation + .. parameters .. parser From owner-svn-src-head@freebsd.org Sat Aug 12 19:45:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7832DC708D; Sat, 12 Aug 2017 19:45:10 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6E0F6F0E1; Sat, 12 Aug 2017 19:45:10 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 7B92F10AF07; Sat, 12 Aug 2017 15:45:09 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322437 - in head/sys/arm64: arm64 include Date: Sat, 12 Aug 2017 11:45:42 -0700 Message-ID: <2695757.2orfonibFk@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201708121842.v7CIgtJA021488@repo.freebsd.org> References: <201708121842.v7CIgtJA021488@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Sat, 12 Aug 2017 15:45:09 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 19:45:11 -0000 On Saturday, August 12, 2017 06:42:55 PM John Baldwin wrote: > Author: jhb > Date: Sat Aug 12 18:42:54 2017 > New Revision: 322437 > URL: https://svnweb.freebsd.org/changeset/base/322437 > > Log: > Reliably enable debug exceptions on all CPUs. > > Previously, debug exceptions were only enabled on the boot CPU if > DDB was enabled in the dbg_monitor_init() function. APs also called > this function, but since mp_machdep.c doesn't include opt_ddb.h, the > APs ended up calling an empty stub defined in > instead of the real function. Also, if DDB was not enabled in the kernel, > the boot CPU would not enable debug exceptions. > > Fix this by adding a new dbg_init() function that always clears the OS > lock to enable debug exceptions which the boot CPU and the APs call. > This function also calls dbg_monitor_init() to enable hardware breakpoints > from DDB on all CPUs if DDB is enabled. Eventually base support for > hardware breakpoints/watchpoints will need to move out of the DDB-only > debug_monitor.c for use by userland debuggers. > > Reviewed by: andrew > Differential Revision: https://reviews.freebsd.org/D12001 In particular, this fixes single stepping of userland processes when the process is running on a CPU other than CPU 0. -- John Baldwin From owner-svn-src-head@freebsd.org Sat Aug 12 21:20:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FA0CDC8F2B; Sat, 12 Aug 2017 21:20:53 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF72F71776; Sat, 12 Aug 2017 21:20:52 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CLKqHW087522; Sat, 12 Aug 2017 21:20:52 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CLKptr087517; Sat, 12 Aug 2017 21:20:51 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201708122120.v7CLKptr087517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 12 Aug 2017 21:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322439 - in head/usr.sbin/bluetooth: bthidcontrol bthidd X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in head/usr.sbin/bluetooth: bthidcontrol bthidd X-SVN-Commit-Revision: 322439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 21:20:53 -0000 Author: wulf Date: Sat Aug 12 21:20:51 2017 New Revision: 322439 URL: https://svnweb.freebsd.org/changeset/base/322439 Log: bthidd(8): Add support for vendor_id, product_id and version. Extend bthidd.conf format to store vendor and product IDs of remote Bluetooth HID devices to make possible implementation of device specific quirks inside bthidd(8). Add support for querying of this information from device's SDP records with bthidcontrol(8) "Query" command. Submitted by: Dirk Engling Reviewed by: emax Approved by: bapt (mentor), gonzo (mentor) Differential Revision: https://reviews.freebsd.org/D3702 Modified: head/usr.sbin/bluetooth/bthidcontrol/sdp.c head/usr.sbin/bluetooth/bthidd/bthid_config.h head/usr.sbin/bluetooth/bthidd/bthidd.conf.sample head/usr.sbin/bluetooth/bthidd/lexer.l head/usr.sbin/bluetooth/bthidd/parser.y Modified: head/usr.sbin/bluetooth/bthidcontrol/sdp.c ============================================================================== --- head/usr.sbin/bluetooth/bthidcontrol/sdp.c Sat Aug 12 19:17:48 2017 (r322438) +++ head/usr.sbin/bluetooth/bthidcontrol/sdp.c Sat Aug 12 21:20:51 2017 (r322439) @@ -47,7 +47,20 @@ static int32_t hid_sdp_parse_protocol_descriptor_list static int32_t hid_sdp_parse_hid_descriptor (sdp_attr_p a); static int32_t hid_sdp_parse_boolean (sdp_attr_p a); +/* + * Hard coded attibute IDs taken from the + * DEVICE IDENTIFICATION PROFILE SPECIFICATION V13 p.12 + */ + +#define SDP_ATTR_DEVICE_ID_SERVICE_VENDORID 0x0201 +#define SDP_ATTR_DEVICE_ID_SERVICE_PRODUCTID 0x0202 +#define SDP_ATTR_DEVICE_ID_SERVICE_VERSION 0x0203 +#define SDP_ATTR_DEVICE_ID_RANGE SDP_ATTR_RANGE( \ + SDP_ATTR_DEVICE_ID_SERVICE_VENDORID, SDP_ATTR_DEVICE_ID_SERVICE_VERSION ) + static uint16_t service = SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE; +static uint16_t service_devid = SDP_SERVICE_CLASS_PNP_INFORMATION; +static uint32_t attrs_devid = SDP_ATTR_DEVICE_ID_RANGE; static uint32_t attrs[] = { SDP_ATTR_RANGE( SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST, @@ -85,27 +98,34 @@ static uint8_t buffer[nvalues][512]; return (((e) == 0)? 0 : -1); \ } +static void +hid_init_return_values() { + int i; + for (i = 0; i < nvalues; i ++) { + values[i].flags = SDP_ATTR_INVALID; + values[i].attr = 0; + values[i].vlen = sizeof(buffer[i]); + values[i].value = buffer[i]; + } +} + static int32_t hid_sdp_query(bdaddr_t const *local, struct hid_device *hd, int32_t *error) { void *ss = NULL; - uint8_t *hid_descriptor = NULL; + uint8_t *hid_descriptor = NULL, *v; int32_t i, control_psm = -1, interrupt_psm = -1, reconnect_initiate = -1, normally_connectable = 0, battery_power = 0, - hid_descriptor_length = -1; + hid_descriptor_length = -1, type; + int16_t vendor_id = 0, product_id = 0, version = 0; if (local == NULL) local = NG_HCI_BDADDR_ANY; if (hd == NULL) hid_sdp_query_exit(EINVAL); - for (i = 0; i < nvalues; i ++) { - values[i].flags = SDP_ATTR_INVALID; - values[i].attr = 0; - values[i].vlen = sizeof(buffer[i]); - values[i].value = buffer[i]; - } + hid_init_return_values(); if ((ss = sdp_open(local, &hd->bdaddr)) == NULL) hid_sdp_query_exit(ENOMEM); @@ -114,9 +134,6 @@ hid_sdp_query(bdaddr_t const *local, struct hid_device if (sdp_search(ss, 1, &service, nattrs, attrs, nvalues, values) != 0) hid_sdp_query_exit(sdp_error(ss)); - sdp_close(ss); - ss = NULL; - for (i = 0; i < nvalues; i ++) { if (values[i].flags != SDP_ATTR_OK) continue; @@ -151,11 +168,51 @@ hid_sdp_query(bdaddr_t const *local, struct hid_device } } + hid_init_return_values(); + + if (sdp_search(ss, 1, &service_devid, 1, &attrs_devid, nvalues, values) != 0) + hid_sdp_query_exit(sdp_error(ss)); + + sdp_close(ss); + ss = NULL; + + /* If search is successful, scan through return vals */ + for (i = 0; i < 3; i ++ ) { + if (values[i].flags == SDP_ATTR_INVALID ) + continue; + + /* Expecting tag + uint16_t on all 3 attributes */ + if (values[i].vlen != 3) + continue; + + /* Make sure, we're reading a uint16_t */ + v = values[i].value; + SDP_GET8(type, v); + if (type != SDP_DATA_UINT16 ) + continue; + + switch (values[i].attr) { + case SDP_ATTR_DEVICE_ID_SERVICE_VENDORID: + SDP_GET16(vendor_id, v); + break; + case SDP_ATTR_DEVICE_ID_SERVICE_PRODUCTID: + SDP_GET16(product_id, v); + break; + case SDP_ATTR_DEVICE_ID_SERVICE_VERSION: + SDP_GET16(version, v); + break; + default: + break; + } + } + if (control_psm == -1 || interrupt_psm == -1 || reconnect_initiate == -1 || hid_descriptor == NULL || hid_descriptor_length == -1) hid_sdp_query_exit(ENOATTR); - + hd->vendor_id = vendor_id; + hd->product_id = product_id; + hd->version = version; hd->control_psm = control_psm; hd->interrupt_psm = interrupt_psm; hd->reconnect_initiate = reconnect_initiate? 1 : 0; Modified: head/usr.sbin/bluetooth/bthidd/bthid_config.h ============================================================================== --- head/usr.sbin/bluetooth/bthidd/bthid_config.h Sat Aug 12 19:17:48 2017 (r322438) +++ head/usr.sbin/bluetooth/bthidd/bthid_config.h Sat Aug 12 21:20:51 2017 (r322439) @@ -42,6 +42,9 @@ struct hid_device bdaddr_t bdaddr; /* HID device BDADDR */ uint16_t control_psm; /* control PSM */ uint16_t interrupt_psm; /* interrupt PSM */ + uint16_t vendor_id; /* primary vendor id */ + uint16_t product_id; + uint16_t version; unsigned new_device : 1; unsigned reconnect_initiate : 1; unsigned battery_power : 1; Modified: head/usr.sbin/bluetooth/bthidd/bthidd.conf.sample ============================================================================== --- head/usr.sbin/bluetooth/bthidd/bthidd.conf.sample Sat Aug 12 19:17:48 2017 (r322438) +++ head/usr.sbin/bluetooth/bthidd/bthidd.conf.sample Sat Aug 12 21:20:51 2017 (r322439) @@ -2,6 +2,9 @@ device { bdaddr 00:50:f2:e5:68:84; + vendor_id 0x0000; + product_id 0x0000; + version 0x0000; control_psm 0x11; interrupt_psm 0x13; reconnect_initiate true; @@ -24,6 +27,9 @@ device { device { bdaddr 00:50:f2:e3:fb:e1; + vendor_id 0x0000; + product_id 0x0000; + version 0x0000; control_psm 0x11; interrupt_psm 0x13; reconnect_initiate true; Modified: head/usr.sbin/bluetooth/bthidd/lexer.l ============================================================================== --- head/usr.sbin/bluetooth/bthidd/lexer.l Sat Aug 12 19:17:48 2017 (r322438) +++ head/usr.sbin/bluetooth/bthidd/lexer.l Sat Aug 12 21:20:51 2017 (r322439) @@ -50,9 +50,13 @@ comment \#.* hexdigit [0-9a-fA-F] hexbyte {hexdigit}{hexdigit}? +hexword {hexdigit}{hexdigit}?{hexdigit}?{hexdigit}? device_word device bdaddr_word bdaddr +vendor_id_word vendor_id +product_id_word product_id +version_word version control_psm_word control_psm interrupt_psm_word interrupt_psm reconnect_initiate_word reconnect_initiate @@ -64,6 +68,7 @@ false_word false bdaddrstring {hexbyte}:{hexbyte}:{hexbyte}:{hexbyte}:{hexbyte}:{hexbyte} hexbytestring 0x{hexbyte} +hexwordstring 0x{hexword} %% @@ -78,6 +83,9 @@ hexbytestring 0x{hexbyte} {device_word} return (T_DEVICE); {bdaddr_word} return (T_BDADDR); +{vendor_id_word} return (T_VENDOR_ID); +{product_id_word} return (T_PRODUCT_ID); +{version_word} return (T_VERSION); {control_psm_word} return (T_CONTROL_PSM); {interrupt_psm_word} return (T_INTERRUPT_PSM); {reconnect_initiate_word} return (T_RECONNECT_INITIATE); @@ -98,6 +106,14 @@ hexbytestring 0x{hexbyte} yylval.num = strtoul(yytext, &ep, 16); return (*ep == '\0'? T_HEXBYTE : T_ERROR); + } + +{hexwordstring} { + char *ep; + + yylval.num = strtoul(yytext, &ep, 16); + + return (*ep == '\0'? T_HEXWORD : T_ERROR); } . return (T_ERROR); Modified: head/usr.sbin/bluetooth/bthidd/parser.y ============================================================================== --- head/usr.sbin/bluetooth/bthidd/parser.y Sat Aug 12 19:17:48 2017 (r322438) +++ head/usr.sbin/bluetooth/bthidd/parser.y Sat Aug 12 21:20:51 2017 (r322439) @@ -87,8 +87,10 @@ static LIST_HEAD(, hid_device) hid_devices; %token T_BDADDRSTRING %token T_HEXBYTE -%token T_DEVICE T_BDADDR T_CONTROL_PSM T_INTERRUPT_PSM T_RECONNECT_INITIATE -%token T_BATTERY_POWER T_NORMALLY_CONNECTABLE T_HID_DESCRIPTOR +%token T_HEXWORD +%token T_DEVICE T_BDADDR T_VENDOR_ID T_PRODUCT_ID T_VERSION T_CONTROL_PSM +%token T_INTERRUPT_PSM T_RECONNECT_INITIATE T_BATTERY_POWER +%token T_NORMALLY_CONNECTABLE T_HID_DESCRIPTOR %token T_TRUE T_FALSE T_ERROR %% @@ -124,6 +126,9 @@ options: option ';' ; option: bdaddr + | vendor_id + | product_id + | version | control_psm | interrupt_psm | reconnect_initiate @@ -139,6 +144,24 @@ bdaddr: T_BDADDR T_BDADDRSTRING } ; +vendor_id: T_VENDOR_ID T_HEXWORD + { + hid_device->vendor_id = $2; + } + ; + +product_id: T_PRODUCT_ID T_HEXWORD + { + hid_device->product_id = $2; + } + ; + +version: T_VERSION T_HEXWORD + { + hid_device->version = $2; + } + ; + control_psm: T_CONTROL_PSM T_HEXBYTE { hid_device->control_psm = $2; @@ -307,6 +330,9 @@ print_hid_device(hid_device_p d, FILE *f) fprintf(f, "device {\n" \ " bdaddr %s;\n" \ +" vendor_id 0x%04x;\n" \ +" product_id 0x%04x;\n" \ +" version 0x%04x;\n" \ " control_psm 0x%x;\n" \ " interrupt_psm 0x%x;\n" \ " reconnect_initiate %s;\n" \ @@ -314,6 +340,7 @@ print_hid_device(hid_device_p d, FILE *f) " normally_connectable %s;\n" \ " hid_descriptor {", bt_ntoa(&d->bdaddr, NULL), + d->vendor_id, d->product_id, d->version, d->control_psm, d->interrupt_psm, d->reconnect_initiate? "true" : "false", d->battery_power? "true" : "false", From owner-svn-src-head@freebsd.org Sat Aug 12 21:23:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E65CDDC912D; Sat, 12 Aug 2017 21:23:34 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0D3D71B2F; Sat, 12 Aug 2017 21:23:34 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CLNX3p089387; Sat, 12 Aug 2017 21:23:33 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CLNXLx089383; Sat, 12 Aug 2017 21:23:33 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201708122123.v7CLNXLx089383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 12 Aug 2017 21:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322440 - head/usr.sbin/bluetooth/bthidd X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/usr.sbin/bluetooth/bthidd X-SVN-Commit-Revision: 322440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 21:23:35 -0000 Author: wulf Date: Sat Aug 12 21:23:33 2017 New Revision: 322440 URL: https://svnweb.freebsd.org/changeset/base/322440 Log: bthidd(8): Add support for Apple's magic mouse Note: Mouse's bthidd.conf record should contain vendor and device IDs to make proper device detection. If it does not contain IDs, regenerate record with "Query" command of recent bthidcontrol(8). Submitted by: Dirk Engling Reviewed by: emax Approved by: bapt (mentor), gonzo (mentor) Differential Revision: https://reviews.freebsd.org/D3702 Modified: head/usr.sbin/bluetooth/bthidd/bthidd.h head/usr.sbin/bluetooth/bthidd/hid.c head/usr.sbin/bluetooth/bthidd/server.c head/usr.sbin/bluetooth/bthidd/session.c Modified: head/usr.sbin/bluetooth/bthidd/bthidd.h ============================================================================== --- head/usr.sbin/bluetooth/bthidd/bthidd.h Sat Aug 12 21:20:51 2017 (r322439) +++ head/usr.sbin/bluetooth/bthidd/bthidd.h Sat Aug 12 21:23:33 2017 (r322440) @@ -60,6 +60,7 @@ struct bthid_session int32_t ctrl; /* control channel */ int32_t intr; /* interrupt channel */ int32_t vkbd; /* virual keyboard */ + void *ctx; /* product specific dev state */ bdaddr_t bdaddr;/* remote bdaddr */ uint16_t state; /* session state */ #define CLOSED 0 @@ -86,6 +87,7 @@ bthid_session_p session_by_bdaddr(bthid_server_p srv, bthid_session_p session_by_fd (bthid_server_p srv, int32_t fd); void session_close (bthid_session_p s); +void hid_initialise (bthid_session_p s); int32_t hid_control (bthid_session_p s, uint8_t *data, int32_t len); int32_t hid_interrupt (bthid_session_p s, uint8_t *data, int32_t len); Modified: head/usr.sbin/bluetooth/bthidd/hid.c ============================================================================== --- head/usr.sbin/bluetooth/bthidd/hid.c Sat Aug 12 21:20:51 2017 (r322439) +++ head/usr.sbin/bluetooth/bthidd/hid.c Sat Aug 12 21:23:33 2017 (r322440) @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,50 @@ #include "kbd.h" /* + * Inoffical and unannounced report ids for Apple Mice and trackpad + */ +#define TRACKPAD_REPORT_ID 0x28 +#define AMM_REPORT_ID 0x29 +#define BATT_STAT_REPORT_ID 0x30 +#define BATT_STRENGTH_REPORT_ID 0x47 +#define SURFACE_REPORT_ID 0x61 + +/* + * Apple magic mouse (AMM) specific device state + */ +#define AMM_MAX_BUTTONS 16 +struct apple_state { + int y [AMM_MAX_BUTTONS]; + int button_state; +}; + +#define MAGIC_MOUSE(D) (((D)->vendor_id == 0x5ac) && ((D)->product_id == 0x30d)) +#define AMM_BASIC_BLOCK 5 +#define AMM_FINGER_BLOCK 8 +#define AMM_VALID_REPORT(L) (((L) >= AMM_BASIC_BLOCK) && \ + ((L) <= 16*AMM_FINGER_BLOCK + AMM_BASIC_BLOCK) && \ + ((L) % AMM_FINGER_BLOCK) == AMM_BASIC_BLOCK) +#define AMM_WHEEL_SPEED 100 + +/* + * Probe for per-device initialisation + */ +void +hid_initialise(bthid_session_p s) +{ + hid_device_p hid_device = get_hid_device(&s->bdaddr); + + if (hid_device && MAGIC_MOUSE(hid_device)) { + /* Magic report to enable trackpad on Apple's Magic Mouse */ + static uint8_t rep[] = {0x53, 0xd7, 0x01}; + + if ((s->ctx = calloc(1, sizeof(struct apple_state))) == NULL) + return; + write(s->ctrl, rep, 3); + } +} + +/* * Process data from control channel */ @@ -369,6 +414,91 @@ hid_interrupt(bthid_session_p s, uint8_t *data, int32_ } } hid_end_parse(d); + + /* + * Apple adheres to no standards and sends reports it does + * not introduce in its hid descriptor for its magic mouse. + * Handle those reports here. + */ + if (MAGIC_MOUSE(hid_device) && s->ctx) { + struct apple_state *c = (struct apple_state *)s->ctx; + int firm = 0, middle = 0; + int16_t v; + + data++, len--; /* Chomp report_id */ + + if (report_id != AMM_REPORT_ID || !AMM_VALID_REPORT(len)) + goto check_middle_button; + + /* + * The basics. When touches are detected, no normal mouse + * reports are sent. Collect clicks and dx/dy + */ + if (data[2] & 1) + mouse_butt |= 0x1; + if (data[2] & 2) + mouse_butt |= 0x4; + + if ((v = data[0] + ((data[2] & 0x0C) << 6))) + mouse_x += ((int16_t)(v << 6)) >> 6, mevents++; + if ((v = data[1] + ((data[2] & 0x30) << 4))) + mouse_y += ((int16_t)(v << 6)) >> 6, mevents++; + + /* + * The hard part: accumulate touch events and emulate middle + */ + for (data += AMM_BASIC_BLOCK, len -= AMM_BASIC_BLOCK; + len >= AMM_FINGER_BLOCK; + data += AMM_FINGER_BLOCK, len -= AMM_FINGER_BLOCK) { + int x, y, z, force, id; + + v = data[0] | ((data[1] & 0xf) << 8); + x = ((int16_t)(v << 4)) >> 4; + + v = (data[1] >> 4) | (data[2] << 4); + y = -(((int16_t)(v << 4)) >> 4); + + force = data[5] & 0x3f; + id = 0xf & ((data[5] >> 6) | (data[6] << 2)); + z = (y - c->y[id]) / AMM_WHEEL_SPEED; + + switch ((data[7] >> 4) & 0x7) { /* Phase */ + case 3: /* First touch */ + c->y[id] = y; + break; + case 4: /* Touch dragged */ + if (z) { + mouse_z += z; + c->y[id] += z * AMM_WHEEL_SPEED; + mevents++; + } + break; + default: + break; + } + /* Count firm touches vs. firm+middle touches */ + if (force >= 8 && ++firm && x > -350 && x < 350) + ++middle; + } + + /* + * If a new click is registered by mouse and there are firm + * touches which are all in center, make it a middle click + */ + if (mouse_butt && !c->button_state && firm && middle == firm) + mouse_butt = 0x2; + + /* + * If we're still clicking and have converted the click + * to a middle click, keep it middle clicking + */ +check_middle_button: + if (mouse_butt && c->button_state == 0x2) + mouse_butt = 0x2; + + if (mouse_butt != c->button_state) + c->button_state = mouse_butt, mevents++; + } /* * XXX FIXME Feed keyboard events into kernel. Modified: head/usr.sbin/bluetooth/bthidd/server.c ============================================================================== --- head/usr.sbin/bluetooth/bthidd/server.c Sat Aug 12 21:20:51 2017 (r322439) +++ head/usr.sbin/bluetooth/bthidd/server.c Sat Aug 12 21:23:33 2017 (r322440) @@ -289,6 +289,10 @@ server_accept(bthid_server_p srv, int32_t fd) srv->maxfd = s->vkbd; } + /* Pass device for probing after both channels are established */ + if (s->state == OPEN) + hid_initialise(s); + return (0); } Modified: head/usr.sbin/bluetooth/bthidd/session.c ============================================================================== --- head/usr.sbin/bluetooth/bthidd/session.c Sat Aug 12 21:20:51 2017 (r322439) +++ head/usr.sbin/bluetooth/bthidd/session.c Sat Aug 12 21:23:33 2017 (r322440) @@ -66,6 +66,7 @@ session_open(bthid_server_p srv, hid_device_p const d) memcpy(&s->bdaddr, &d->bdaddr, sizeof(s->bdaddr)); s->ctrl = -1; s->intr = -1; + s->ctx = NULL; if (d->keyboard) { /* Open /dev/vkbdctl */ @@ -176,6 +177,7 @@ session_close(bthid_session_p s) s->srv->maxfd --; } + free(s->ctx); free(s->keys1); free(s->keys2); From owner-svn-src-head@freebsd.org Sat Aug 12 21:26:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48BD2DC9383; Sat, 12 Aug 2017 21:26:47 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17EB271D09; Sat, 12 Aug 2017 21:26:47 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CLQkgM089532; Sat, 12 Aug 2017 21:26:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CLQkJX089531; Sat, 12 Aug 2017 21:26:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708122126.v7CLQkJX089531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 12 Aug 2017 21:26:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322441 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 21:26:47 -0000 Author: ngie Date: Sat Aug 12 21:26:46 2017 New Revision: 322441 URL: https://svnweb.freebsd.org/changeset/base/322441 Log: Delete trailing whitespace MFC after: 1 month Modified: head/share/mk/bsd.cpu.mk Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Sat Aug 12 21:23:33 2017 (r322440) +++ head/share/mk/bsd.cpu.mk Sat Aug 12 21:26:46 2017 (r322441) @@ -399,7 +399,7 @@ CFLAGS_NO_SIMD= -mno-mmx -mno-sse .endif CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}} -# Add in any architecture-specific CFLAGS. +# Add in any architecture-specific CFLAGS. # These come from make.conf or the command line or the environment. CFLAGS += ${CFLAGS.${MACHINE_ARCH}} CXXFLAGS += ${CXXFLAGS.${MACHINE_ARCH}} From owner-svn-src-head@freebsd.org Sat Aug 12 21:45:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9B32DCA4AF; Sat, 12 Aug 2017 21:45:56 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x231.google.com (mail-pg0-x231.google.com [IPv6:2607:f8b0:400e:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A215B72623; Sat, 12 Aug 2017 21:45:56 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x231.google.com with SMTP id u185so27797869pgb.1; Sat, 12 Aug 2017 14:45:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=wHtsmVXHgznhA2o4GJz/Ajf4qyG7oqr+8UbML9lt+cQ=; b=YsLkoxRJPOSjvQBlc6DjWxTel/cTgiCYWY4GE0x/hhMlEPmp2XTlM8RdFxdcWwIoqh /aZw+M5/7x9c483htfYv+nKvHm2y52Te1apkYU3f4hB0qAWx0TI3eGF6CK4xuFzNcO6j DGAl3MzWGRZ7slJsbFrsv7TZNcb18grwU32InJTSYp15gRcftAjvDcwiu9ZQNA4GT9hq E3k4VTNjQ/U9VMgIG2dsdqWRocTTn8ktS3wYTeGecRU+r02tJH84seKopk30JDHLzlno aHz+lyxcARjcfbAwXSTYkfOuAf2QPlMBnQS/Y0WKRlFsJ2Y4/aZfscczf0a7eL0HVGDF aImg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=wHtsmVXHgznhA2o4GJz/Ajf4qyG7oqr+8UbML9lt+cQ=; b=aGDXuf7utKU85X5E95gABgj7HUGzmmjM/RB27AiutS6N1/aoMKcXdwCAh2tHLzKdbs YKxq85b6KA/uLk/W3M27XyFvjtGn9be2r26Xg8nftcWoqn1vddj3wsSo1aRbEb+e1NQ0 HOKFlp35p8yGgygyzfk9ArWwRQ6+2kBiRRFfosMp/wKA3Sff0dTiQGeX8i70OPQ2yiVk M82eSWGcUQnjp2gK5XCGcuCu98/a5yZWs+Q18UcROzzYRbVJOujCaj6tb4lwOvY7nl+d QtonvMVfpPtx+jv8U3Q9OAjkAwD+MZnDDQOWZDm5ZZSTafIx4mCU+LkLcLPDDb0SGXVj C7Rg== X-Gm-Message-State: AHYfb5h1qsMlEOE8qFfOtPKGMQbz0zNmihhcrzL4aNtpXIpPa6126Dod S/zf77CctXT5Ri00D7Q= X-Received: by 10.84.247.9 with SMTP id n9mr11207257pll.451.1502574355713; Sat, 12 Aug 2017 14:45:55 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id c7sm7367590pfg.29.2017.08.12.14.45.54 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 12 Aug 2017 14:45:54 -0700 (PDT) Subject: Re: svn commit: r322418 - head/lib/msun/src Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_D3F0B8CF-3165-4A57-B6AD-9A720E908915"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: Date: Sat, 12 Aug 2017 14:45:53 -0700 Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Bruce Evans Message-Id: <5672BE7A-0640-4C8B-9B41-44AD83D7B59E@gmail.com> References: <201708112241.v7BMfP5X028262@repo.freebsd.org> <1502555191.47886.30.camel@freebsd.org> To: Ryan Libby X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 21:45:57 -0000 --Apple-Mail=_D3F0B8CF-3165-4A57-B6AD-9A720E908915 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 12, 2017, at 10:55, Ryan Libby wrote: =E2=80=A6 > A few possible quick fixes: >=20 > - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP > definitions from (+16384) to 16384. >=20 > - Change HALF_LDBL_MAX from > #define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L) > to > #if LDBL_MAX_EXP !=3D 0x4000 > #error "Unsupported long double format" > #endif > #define HALF_LDBL_MAX 0x0.8p16384L >=20 > - Change the HALF_LDBL_MAX constant to a variable constructed with > LD80C(), I think with > LD80C(0x8000000000000000, 16383, 5.9486574767861588254e+4931L) > but this also requires #error for LDBL_MAX_EXP !=3D 0x4000, so not > really any better than the above. >=20 > I think I will back the patch out for now and go back to review. The issue is an inconsistency with how LDBL_MAX_EXP is defined in the MD = headers: $ grep -r LDBL_MAX_EXP sys/sparc64/ sys/sparc64/include/float.h:#define LDBL_MAX_EXP (+16384) $ grep -r LDBL_MAX_EXP sys/x86/ sys/x86/include/float.h:#define LDBL_MAX_EXP 16384 Cheers, -Ngie --Apple-Mail=_D3F0B8CF-3165-4A57-B6AD-9A720E908915 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZj3cRAAoJEPWDqSZpMIYVmIwQAMNw+sDbhRARTgI5+idAgLEn VJQASSEIYpWOJ8TkwoqRRY0oKGMS50thM9NCbHAEb2+6X0FyUbdkuVqj6oUw9qc7 8TjOEJIs2iLUTP2bnVtOdv6FpI3eiT0RljdVVXp9GdOm//JkHx9o7x5ym3VOD9d8 B2B44oJ9avveX217G8rrbTZD5KkyAZYMUDJOF8ir/eMVgpK+51QOgHtCxTVOyCnj GvrDJuyA6zTzJyx/CHigbLIp3BCLf97MigNZ2N/9w4f5MgYBy0ouOM2+VulcWVpM GAMM+NkLlAbucb2PgcsrT9YGblREcT7VSJJaqpn2nR7vAEQcEnadHXTvhVUtlK0b z2UsBz5TE3pOGFzJ0uUD1hMyeGUXf1F3ysSc8TWxfTnu5MF2eE+yOXdkdlJuN9ow 1i9/0XX93jeuJplMr4boS/dymcPJyU0VD9M86HltzNpqda5Wof5CDLgdkvsLNthV TPVN1ZL2DYvFsk8PwqcITlImTu6EzkzlueGHe4Mvcr3VWWkQccGh0yg8WQMKNw9E HZuNPw+turGtykjW0/BxgZ/r4vR+eyZ3CCYzXVO/JFRES830+Wn/CpYx/ylzPuF6 50gL/0HlnQ++3VGQv5X4y01EDIUyKW5fC4HZ/Cl6e/OSgFvg5fqktvD4lNUkj9vx CVMJGelbvypV6YiopWUa =5zwd -----END PGP SIGNATURE----- --Apple-Mail=_D3F0B8CF-3165-4A57-B6AD-9A720E908915-- From owner-svn-src-head@freebsd.org Sat Aug 12 21:53:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20346DCADC5; Sat, 12 Aug 2017 21:53:51 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x22d.google.com (mail-pf0-x22d.google.com [IPv6:2607:f8b0:400e:c00::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD8C972C9E; Sat, 12 Aug 2017 21:53:50 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x22d.google.com with SMTP id t86so28368647pfe.2; Sat, 12 Aug 2017 14:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=NRQz+pdrR2nC+04oKItrsJkhPkbfg/9wCT0PM8O0Zns=; b=apN5AiHpk8WTYIt3qa/cVH4VywRlx6OtU6+k2C/Uc9taW2yiq6ai1BgmBcINbqZ22B WuL+4QWn3zfXcq2beTm+i+YD9s2B984CfssnX2HGe+zUDvhpsaCCtDCL0uxQYHpwtr82 6PzYFzH7JeKrTXPkaRR74vzuhn5v/jjH5oG5RtHe7OvwbBijEXfed9Klf8e+CwxUYQ7B 2B3L/3P/k5X2FJBw28+rrRZ0Xyg7yOJx5C5zTTXHdL235V70OzFXzImXmZU8ERJ8oxcq KKDU+ojtFx5J//yu+auM2WzY7cnVJJ5apAxWNtciYWnTLzA/+e1rXUl6b3MqjLAKoTNS v7xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=NRQz+pdrR2nC+04oKItrsJkhPkbfg/9wCT0PM8O0Zns=; b=HdNyy6/fwCmzrqLcqxSna7h7BNsTA/V/Y5sZC8GPvTN3gEkcAcqNEwFMYUo9OdJdDY ZRhcqFKwZDHIhqNXLusKdLmjUva2JJQGrQnTFROdQ0FvnvMW6np82zW7ThlcyFkniA8F 3xBodIjgO6BtB2yTdNQATTmrivxUuAhQe7gVriNCgoDtaqKyZAgXIMje/rZSrQDcXPHt iF03cmOE4hkJxgu+f9pFbREoWfcLpbFpY2yCUuXtXrf3bv/vwezRWjbIUxhiFK4iMinR oxuSY4m0KB7F6gAEgwfBpPym3Kcd/OvxkRs1DsKbPq0DbyTjV5ef2LLdcOEtj/6NEzFx mkNg== X-Gm-Message-State: AHYfb5hGfBiNjSJaEYctSJghmWDhtnva7KdSgvb+meNBANDCAT7LI7mx 8u5bxWNTzZKKFg2HCx0= X-Received: by 10.84.229.12 with SMTP id b12mr17966024plk.325.1502574830111; Sat, 12 Aug 2017 14:53:50 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id t5sm7313432pfd.96.2017.08.12.14.53.49 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 12 Aug 2017 14:53:49 -0700 (PDT) Subject: Re: svn commit: r322418 - head/lib/msun/src Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <5672BE7A-0640-4C8B-9B41-44AD83D7B59E@gmail.com> Date: Sat, 12 Aug 2017 14:53:48 -0700 Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Bruce Evans Message-Id: References: <201708112241.v7BMfP5X028262@repo.freebsd.org> <1502555191.47886.30.camel@freebsd.org> <5672BE7A-0640-4C8B-9B41-44AD83D7B59E@gmail.com> To: Ryan Libby X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 21:53:51 -0000 --Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 12, 2017, at 14:45, Ngie Cooper (yaneurabeya) = wrote: >=20 >>=20 >> On Aug 12, 2017, at 10:55, Ryan Libby wrote: >=20 > =E2=80=A6 >=20 >> A few possible quick fixes: >>=20 >> - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP >> definitions from (+16384) to 16384. >>=20 >> - Change HALF_LDBL_MAX from >> #define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L) >> to >> #if LDBL_MAX_EXP !=3D 0x4000 >> #error "Unsupported long double format" >> #endif >> #define HALF_LDBL_MAX 0x0.8p16384L >>=20 >> - Change the HALF_LDBL_MAX constant to a variable constructed with >> LD80C(), I think with >> LD80C(0x8000000000000000, 16383, 5.9486574767861588254e+4931L) >> but this also requires #error for LDBL_MAX_EXP !=3D 0x4000, so not >> really any better than the above. >>=20 >> I think I will back the patch out for now and go back to review. >=20 > The issue is an inconsistency with how LDBL_MAX_EXP is defined in the = MD headers: * is an -> is due to an > $ grep -r LDBL_MAX_EXP sys/sparc64/ > sys/sparc64/include/float.h:#define LDBL_MAX_EXP (+16384) > $ grep -r LDBL_MAX_EXP sys/x86/ > sys/x86/include/float.h:#define LDBL_MAX_EXP 16384 Here are the full gamut of definitions for LDBL_MAX_EXP. It = seems that sparc64 isn=E2=80=99t the only architecture using this = pattern: $ grep -r DBL_MAX_EXP sys/*/include sys/arm/include/float.h:#define DBL_MAX_EXP 1024 sys/arm/include/float.h:#define LDBL_MAX_EXP DBL_MAX_EXP sys/arm64/include/float.h:#define DBL_MAX_EXP 1024 sys/arm64/include/float.h:#define LDBL_MAX_EXP (+16384) sys/mips/include/float.h:#define DBL_MAX_EXP 1024 sys/mips/include/float.h:#define LDBL_MAX_EXP DBL_MAX_EXP sys/powerpc/include/float.h:#define DBL_MAX_EXP 1024 sys/powerpc/include/float.h:#define LDBL_MAX_EXP DBL_MAX_EXP sys/riscv/include/float.h:#define DBL_MAX_EXP 1024 sys/riscv/include/float.h:#define LDBL_MAX_EXP (+16384) sys/sparc64/include/float.h:#define DBL_MAX_EXP 1024 sys/sparc64/include/float.h:#define LDBL_MAX_EXP (+16384) sys/x86/include/float.h:#define DBL_MAX_EXP 1024 sys/x86/include/float.h:#define LDBL_MAX_EXP 16384 It might also be an inconsistency with how clang vs gcc [4.2.1] = handles __CONCAT, and what -std=3D flags are passed to ${CC} in the = Makefile, since the implementation is predicated by whether or not = it=E2=80=99s C++ or __STDC__ is defined. There might be an update that = we can grab from NetBSD (since the macro originated there). I don=E2=80=99t understand [right now] why the (+foo) form is = used *shrugs*. Cheers, -Ngie --Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZj3jsAAoJEPWDqSZpMIYVuNIP/A2L0Q2+TY9QRBVFTFofoDJF PGjMe3E87pDLGuCePk0W3IBo6raGJ1tQw8WhYJast4H/z38J5VImuF0er//ZzUTf E76rB44simjn9tsM38lTNGFmBWKgvbrXJxTVFyEEE3tGL7rWW3sG0tf44HW3Z3tk cR/+8lO6RkFV3RodrPS1VhNFgV6WvzAgyyO4oYcx176HBdY/qlzXeFbww2swfgnZ rLTmmUQD4wLgfSSxkBCoKdru/YOGpCNeqQg1Dy7WDVBsMs2m7UL3RO0olgtdE0kr DDc2FCuUcDM2DpQBvG9PoRm3maK/OfVUgK16cc4np7mAg2cn4kERuSJMmE7PJFdS FOKcfBi+ACZJXFWkEGfEoUeW8QDjiBUC8sLfmuPQgjgYhyn9zsYhMj2bI6/W9L28 wzECELQl+F5yFxKg1QGRod/5BwqjLITTJSXMWGpuSE2tNMWiRxTpB/tjCofkbqES WhizL2QiZVdKZJLnUJAHW5IS4rAYdE4fZ3Y4rBwp3+TvZcDm+Y9z0XTIc6giUQfB kQkAxKRyz9wsW4Mw5wnb+RPiCSFpc4ptAD5OIQBY9UAJr9i7iT65IsBXZzDwobPj aygOzSs8hgQKQvJ5i+cUm80gcrKNIJRzR6LAMwhokrN+eFuTuPgp+JqIeUIKlFRa qrr+NeAAd4dM93ur8m4u =43lZ -----END PGP SIGNATURE----- --Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5-- From owner-svn-src-head@freebsd.org Sat Aug 12 22:13:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5851FDCC255; Sat, 12 Aug 2017 22:13:07 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2774173910; Sat, 12 Aug 2017 22:13:07 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CMD66V009801; Sat, 12 Aug 2017 22:13:06 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CMD6gN009800; Sat, 12 Aug 2017 22:13:06 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201708122213.v7CMD6gN009800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 12 Aug 2017 22:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322443 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 322443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 22:13:07 -0000 Author: nwhitehorn Date: Sat Aug 12 22:13:06 2017 New Revision: 322443 URL: https://svnweb.freebsd.org/changeset/base/322443 Log: Move NVME controller shutdown from being called as part of module unloading to being called through the newbus DEVICE_SHUTDOWN() path. This ensures that the NVME controller gets shut down before the device and bus disappear and prevents data corruption on shutdown on at least Samsung EVO 960 SSDs. PR: kern/211852 Reviewed by: imp MFC after: 2 weeks Modified: head/sys/dev/nvme/nvme.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Sat Aug 12 22:12:09 2017 (r322442) +++ head/sys/dev/nvme/nvme.c Sat Aug 12 22:13:06 2017 (r322443) @@ -58,6 +58,7 @@ MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocati static int nvme_probe(device_t); static int nvme_attach(device_t); static int nvme_detach(device_t); +static int nvme_shutdown(device_t); static int nvme_modevent(module_t mod, int type, void *arg); static devclass_t nvme_devclass; @@ -67,6 +68,7 @@ static device_method_t nvme_pci_methods[] = { DEVMETHOD(device_probe, nvme_probe), DEVMETHOD(device_attach, nvme_attach), DEVMETHOD(device_detach, nvme_detach), + DEVMETHOD(device_shutdown, nvme_shutdown), { 0, 0 } }; @@ -179,22 +181,15 @@ nvme_unload(void) { } -static void -nvme_shutdown(void) +static int +nvme_shutdown(device_t dev) { - device_t *devlist; struct nvme_controller *ctrlr; - int dev, devcount; - if (devclass_get_devices(nvme_devclass, &devlist, &devcount)) - return; + ctrlr = DEVICE2SOFTC(dev); + nvme_ctrlr_shutdown(ctrlr); - for (dev = 0; dev < devcount; dev++) { - ctrlr = DEVICE2SOFTC(devlist[dev]); - nvme_ctrlr_shutdown(ctrlr); - } - - free(devlist, M_TEMP); + return (0); } static int @@ -207,9 +202,6 @@ nvme_modevent(module_t mod, int type, void *arg) break; case MOD_UNLOAD: nvme_unload(); - break; - case MOD_SHUTDOWN: - nvme_shutdown(); break; default: break; From owner-svn-src-head@freebsd.org Sat Aug 12 22:20:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3614DCCA98; Sat, 12 Aug 2017 22:20:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7320773ECF; Sat, 12 Aug 2017 22:20:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CMK8e1010296; Sat, 12 Aug 2017 22:20:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CMK8Md010295; Sat, 12 Aug 2017 22:20:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708122220.v7CMK8Md010295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 12 Aug 2017 22:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322445 - head/lib/ncurses/ncurses X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/ncurses/ncurses X-SVN-Commit-Revision: 322445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 22:20:09 -0000 Author: ngie Date: Sat Aug 12 22:20:08 2017 New Revision: 322445 URL: https://svnweb.freebsd.org/changeset/base/322445 Log: Hide `sccsid` under #if 0, per example in style(9) This fixes a -Wunused warning with gcc 6.3.0/7.0.0. MFC after: 1 week Modified: head/lib/ncurses/ncurses/termcap.c Modified: head/lib/ncurses/ncurses/termcap.c ============================================================================== --- head/lib/ncurses/ncurses/termcap.c Sat Aug 12 22:14:09 2017 (r322444) +++ head/lib/ncurses/ncurses/termcap.c Sat Aug 12 22:20:08 2017 (r322445) @@ -59,9 +59,11 @@ #include __FBSDID("$FreeBSD$"); +#if 0 #ifndef lint static const char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ +#endif #include #include