From owner-svn-src-head@freebsd.org Sun Nov 13 00:10:57 2016 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 4D94BC3EB88; Sun, 13 Nov 2016 00:10:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CC561D19; Sun, 13 Nov 2016 00:10:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0Au4E093984; Sun, 13 Nov 2016 00:10:56 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0AuE7093983; Sun, 13 Nov 2016 00:10:56 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130010.uAD0AuE7093983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308597 - head/share/mk X-SVN-Group: head 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, 13 Nov 2016 00:10:57 -0000 Author: bdrewery Date: Sun Nov 13 00:10:56 2016 New Revision: 308597 URL: https://svnweb.freebsd.org/changeset/base/308597 Log: Always set CLEANFILES, even if not building. This will ensure that 'make clean' does the right thing. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Sat Nov 12 23:58:07 2016 (r308596) +++ head/share/mk/bsd.lib.mk Sun Nov 13 00:10:56 2016 (r308597) @@ -304,7 +304,6 @@ all: .else .if defined(_LIBS) && !empty(_LIBS) all: ${_LIBS} -CLEANFILES+= ${_LIBS} .endif .if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) @@ -312,6 +311,8 @@ all: all-man .endif .endif +CLEANFILES+= ${_LIBS} + _EXTRADEPEND: .if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME) .if defined(DPADD) && !empty(DPADD) From owner-svn-src-head@freebsd.org Sun Nov 13 00:11:00 2016 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 79441C3EBB1; Sun, 13 Nov 2016 00:11:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4928C1D4D; Sun, 13 Nov 2016 00:11:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0AxSZ094030; Sun, 13 Nov 2016 00:10:59 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0AxEL094029; Sun, 13 Nov 2016 00:10:59 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130010.uAD0AxEL094029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308598 - head/share/mk X-SVN-Group: head 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, 13 Nov 2016 00:11:00 -0000 Author: bdrewery Date: Sun Nov 13 00:10:59 2016 New Revision: 308598 URL: https://svnweb.freebsd.org/changeset/base/308598 Log: DIRDEPS_BUILD: Don't hook 'beforebuild' into 'all' in MAKELEVEL 0. This was a mistake in r295641, but is effectively prevented from being a problem due to r296699 preventing 'make all' from being usable at MAKELEVEL 0 for DIRDEPS_BUILD. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.init.mk Modified: head/share/mk/bsd.init.mk ============================================================================== --- head/share/mk/bsd.init.mk Sun Nov 13 00:10:56 2016 (r308597) +++ head/share/mk/bsd.init.mk Sun Nov 13 00:10:59 2016 (r308598) @@ -15,10 +15,6 @@ ____: .endif .include .MAIN: all -beforebuild: .PHONY .NOTMAIN -.if !defined(_SKIP_BUILD) -all: beforebuild .WAIT -.endif .if ${.MAKE.LEVEL:U1} == 0 && ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) # this tells lib.mk and prog.mk to not actually build anything @@ -28,6 +24,11 @@ _SKIP_BUILD = not building at level 0 .warning ${_SKIP_BUILD} .endif +beforebuild: .PHONY .NOTMAIN +.if !defined(_SKIP_BUILD) +all: beforebuild .WAIT +.endif + .if ${MK_META_MODE} == "yes" .if !exists(/dev/filemon) && \ ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \ From owner-svn-src-head@freebsd.org Sun Nov 13 00:11:04 2016 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 0617FC3EBD6; Sun, 13 Nov 2016 00:11:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0DA61DF9; Sun, 13 Nov 2016 00:11:03 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0B2Xf094105; Sun, 13 Nov 2016 00:11:02 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0B2tl094103; Sun, 13 Nov 2016 00:11:02 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130011.uAD0B2tl094103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:11:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308599 - head/share/mk X-SVN-Group: head 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, 13 Nov 2016 00:11:04 -0000 Author: bdrewery Date: Sun Nov 13 00:11:02 2016 New Revision: 308599 URL: https://svnweb.freebsd.org/changeset/base/308599 Log: Consolidate the "don't build" optimizations into _SKIP_BUILD. _SKIP_BUILD will be set when nothing is expected to be built. This can be used to optimize some tree-walks and operations which don't need to load dependency files or generate dependencies via beforebuild-style hacks. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.dep.mk head/share/mk/bsd.init.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Sun Nov 13 00:10:59 2016 (r308598) +++ head/share/mk/bsd.dep.mk Sun Nov 13 00:11:02 2016 (r308599) @@ -77,12 +77,10 @@ _meta_filemon= 1 .endif # Skip reading .depend when not needed to speed up tree-walks and simple -# lookups. For install, only do this if no other targets are specified. +# lookups. See _SKIP_BUILD logic in bsd.init.mk for more details. # Also skip generating or including .depend.* files if in meta+filemon mode # since it will track dependencies itself. OBJS_DEPEND_GUESS is still used. -.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \ - ${.TARGETS:M*install*} == ${.TARGETS} || \ - make(analyze) || defined(_meta_filemon) || make(print-dir) +.if defined(_SKIP_BUILD) || defined(_meta_filemon) _SKIP_READ_DEPEND= 1 .if ${MK_DIRDEPS_BUILD} == "no" || make(analyze) || make(print-dir) .MAKE.DEPENDFILE= /dev/null Modified: head/share/mk/bsd.init.mk ============================================================================== --- head/share/mk/bsd.init.mk Sun Nov 13 00:10:59 2016 (r308598) +++ head/share/mk/bsd.init.mk Sun Nov 13 00:11:02 2016 (r308599) @@ -16,11 +16,27 @@ ____: .include .MAIN: all -.if ${.MAKE.LEVEL:U1} == 0 && ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) -# this tells lib.mk and prog.mk to not actually build anything -_SKIP_BUILD = not building at level 0 +# Some targets need to know when something may build. This is used to +# optimize targets that are only needed when building something, such as +# (not) reading in depend files. For DIRDEPS_BUILD, it will only calculate +# the dependency graph at .MAKE.LEVEL==0, so nothing should be built there. +# Skip "build" logic if: +# - DIRDEPS_BUILD at MAKELEVEL 0 +# - make -V is used without an override +# - make install is used without other targets. This is to avoid breaking +# things like 'make all install' or 'make foo install'. +# - non-build targets are called +.if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL:U1} == 0 && \ + ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) +_SKIP_BUILD= not building at level 0 +.elseif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \ + ${.TARGETS:M*install*} == ${.TARGETS} || \ + make(clean*) || make(obj) || make(analyze) || make(print-dir) || \ + make(destroy*) +# Skip building, but don't show a warning. +_SKIP_BUILD= .endif -.if ${.MAKE.LEVEL} > 0 && !empty(_SKIP_BUILD) +.if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL} > 0 && !empty(_SKIP_BUILD) .warning ${_SKIP_BUILD} .endif From owner-svn-src-head@freebsd.org Sun Nov 13 00:11:10 2016 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 BC938C3EC40; Sun, 13 Nov 2016 00:11:10 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 458EE1FAB; Sun, 13 Nov 2016 00:11:10 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0B9xA094202; Sun, 13 Nov 2016 00:11:09 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0B9Bg094201; Sun, 13 Nov 2016 00:11:09 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130011.uAD0B9Bg094201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:11:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308601 - head/share/mk X-SVN-Group: head 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, 13 Nov 2016 00:11:11 -0000 Author: bdrewery Date: Sun Nov 13 00:11:09 2016 New Revision: 308601 URL: https://svnweb.freebsd.org/changeset/base/308601 Log: Fix 'rebuild during install' error to only trigger on 'make install'. This allows 'make foo install' or 'make all install'. It is a similar fix as r304697 did for reading dependency files. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Sun Nov 13 00:11:05 2016 (r308600) +++ head/share/mk/bsd.sys.mk Sun Nov 13 00:11:09 2016 (r308601) @@ -209,7 +209,7 @@ CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}} .if defined(SRCTOP) # Prevent rebuilding during install to support read-only objdirs. -.if !make(all) && make(install) && empty(.MAKE.MODE:Mmeta) +.if ${.TARGETS:M*install*} == ${.TARGETS} && empty(.MAKE.MODE:Mmeta) CFLAGS+= ERROR-tried-to-rebuild-during-make-install .endif .endif From owner-svn-src-head@freebsd.org Sun Nov 13 00:11:07 2016 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 92E1EC3EC05; Sun, 13 Nov 2016 00:11:07 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 307811EE0; Sun, 13 Nov 2016 00:11:07 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0B6Ck094154; Sun, 13 Nov 2016 00:11:06 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0B64j094152; Sun, 13 Nov 2016 00:11:06 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130011.uAD0B64j094152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:11:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308600 - head/share/mk X-SVN-Group: head 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, 13 Nov 2016 00:11:07 -0000 Author: bdrewery Date: Sun Nov 13 00:11:05 2016 New Revision: 308600 URL: https://svnweb.freebsd.org/changeset/base/308600 Log: DIRDEPS_BUILD: Consolidate some logic for skipping of reading Makefile.depend. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.dep.mk head/share/mk/bsd.subdir.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Sun Nov 13 00:11:02 2016 (r308599) +++ head/share/mk/bsd.dep.mk Sun Nov 13 00:11:05 2016 (r308600) @@ -82,7 +82,8 @@ _meta_filemon= 1 # since it will track dependencies itself. OBJS_DEPEND_GUESS is still used. .if defined(_SKIP_BUILD) || defined(_meta_filemon) _SKIP_READ_DEPEND= 1 -.if ${MK_DIRDEPS_BUILD} == "no" || make(analyze) || make(print-dir) +.if ${MK_DIRDEPS_BUILD} == "no" || make(analyze) || make(print-dir) || \ + make(obj) || make(clean*) || make(destroy*) .MAKE.DEPENDFILE= /dev/null .endif .endif @@ -196,7 +197,7 @@ CFLAGS+= ${DEPEND_CFLAGS} .endif # !defined(_meta_filemon) .endif # defined(SRCS) -.if ${MK_DIRDEPS_BUILD} == "yes" && !make(analyze) && !make(print-dir) +.if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.DEPENDFILE} != "/dev/null" # Prevent meta.autodep.mk from tracking "local dependencies". .depend: .include Modified: head/share/mk/bsd.subdir.mk ============================================================================== --- head/share/mk/bsd.subdir.mk Sun Nov 13 00:11:02 2016 (r308599) +++ head/share/mk/bsd.subdir.mk Sun Nov 13 00:11:05 2016 (r308600) @@ -70,7 +70,10 @@ print-dir: .PHONY .endif .if !defined(NEED_SUBDIR) -.if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD} == "yes" && !empty(SUBDIR) && !(make(clean*) || make(destroy*)) +# .MAKE.DEPENDFILE==/dev/null is set by bsd.dep.mk to avoid reading +# Makefile.depend +.if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD} == "yes" && !empty(SUBDIR) && \ + ${.MAKE.DEPENDFILE} != "/dev/null" .include # ignore this _SUBDIR: From owner-svn-src-head@freebsd.org Sun Nov 13 00:11:13 2016 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 DDB68C3EC8E; Sun, 13 Nov 2016 00:11:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8200D1082; Sun, 13 Nov 2016 00:11:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0BCFo094248; Sun, 13 Nov 2016 00:11:12 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0BCP4094246; Sun, 13 Nov 2016 00:11:12 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130011.uAD0BCP4094246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:11:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308602 - head/lib/libsysdecode X-SVN-Group: head 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, 13 Nov 2016 00:11:14 -0000 Author: bdrewery Date: Sun Nov 13 00:11:12 2016 New Revision: 308602 URL: https://svnweb.freebsd.org/changeset/base/308602 Log: Generate and use a proper .depend file for tables.h. Reported by: jhb MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/lib/libsysdecode/Makefile head/lib/libsysdecode/mktables Modified: head/lib/libsysdecode/Makefile ============================================================================== --- head/lib/libsysdecode/Makefile Sun Nov 13 00:11:09 2016 (r308601) +++ head/lib/libsysdecode/Makefile Sun Nov 13 00:11:12 2016 (r308602) @@ -110,8 +110,9 @@ CFLAGS.gcc.ioctl.c+= -Wno-unused CFLAGS.gcc+= ${CFLAGS.gcc.${.IMPSRC}} +DEPENDOBJS+= tables.h tables.h: mktables - sh ${.CURDIR}/mktables ${DESTDIR}${INCLUDEDIR} > ${.TARGET} + sh ${.CURDIR}/mktables ${DESTDIR}${INCLUDEDIR} ${.TARGET} ioctl.c: mkioctls env MACHINE=${MACHINE} CPP="${CPP}" \ Modified: head/lib/libsysdecode/mktables ============================================================================== --- head/lib/libsysdecode/mktables Sun Nov 13 00:11:09 2016 (r308601) +++ head/lib/libsysdecode/mktables Sun Nov 13 00:11:12 2016 (r308602) @@ -37,11 +37,16 @@ LC_ALL=C; export LC_ALL if [ -z "$1" ] then - echo "usage: sh $0 include-dir" + echo "usage: sh $0 include-dir [output-file]" exit 1 fi include_dir=$1 +if [ -n "$2" ]; then + output_file="$2" + exec > "$output_file" +fi +all_headers= # # Generate a table C #definitions. The including file can define the # TABLE_NAME(n), TABLE_ENTRY(x), and TABLE_END macros to define what @@ -60,6 +65,7 @@ gen_table() else filter="egrep -v" fi + all_headers="${all_headers:+${all_headers} }${file}" cat <<_EOF_ TABLE_START(${name}) _EOF_ @@ -142,3 +148,12 @@ gen_table "sigcode" "SI_[A-Z]+[[ gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/umtx.h" gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+" "sys/umtx.h" gen_table "caprights" "CAP_[A-Z_]+[[:space:]]+CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\)" "sys/capsicum.h" + +# Generate a .depend file for our output file +if [ -n "$output_file" ]; then + echo "$output_file: \\" > ".depend.$output_file" + echo "$all_headers" | tr ' ' '\n' | sort -u | + sed -e "s,^, $include_dir/," -e 's,$, \\,' >> \ + ".depend.$output_file" + echo >> ".depend.$output_file" +fi From owner-svn-src-head@freebsd.org Sun Nov 13 00:11:17 2016 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 24A10C3ECAC; Sun, 13 Nov 2016 00:11:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D12B111A0; Sun, 13 Nov 2016 00:11:16 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0BGiI094299; Sun, 13 Nov 2016 00:11:16 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0BFKP094296; Sun, 13 Nov 2016 00:11:15 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130011.uAD0BFKP094296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308603 - in head: . lib/libsysdecode X-SVN-Group: head 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, 13 Nov 2016 00:11:17 -0000 Author: bdrewery Date: Sun Nov 13 00:11:15 2016 New Revision: 308603 URL: https://svnweb.freebsd.org/changeset/base/308603 Log: Move libsysdecode-specific hack out of buildworld. This should fix the lib32 build since it was not removing the generated ioctl.c. This file is generated by a find(1) call, so cannot use normal dependency tracking methods. Reported by: jhb MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/Makefile.inc1 head/lib/libsysdecode/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sun Nov 13 00:11:12 2016 (r308602) +++ head/Makefile.inc1 Sun Nov 13 00:11:15 2016 (r308603) @@ -676,9 +676,6 @@ _worldtmp: .PHONY .endif .else rm -rf ${WORLDTMP}/legacy/usr/include -# XXX - These can depend on any header file. - rm -f ${OBJTREE}${.CURDIR}/lib/libsysdecode/ioctl.c - rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c .endif .for _dir in \ lib lib/casper usr legacy/bin legacy/usr Modified: head/lib/libsysdecode/Makefile ============================================================================== --- head/lib/libsysdecode/Makefile Sun Nov 13 00:11:12 2016 (r308602) +++ head/lib/libsysdecode/Makefile Sun Nov 13 00:11:15 2016 (r308603) @@ -114,7 +114,12 @@ DEPENDOBJS+= tables.h tables.h: mktables sh ${.CURDIR}/mktables ${DESTDIR}${INCLUDEDIR} ${.TARGET} -ioctl.c: mkioctls +# mkioctls runs find(1) for headers so needs to rebuild every time. This used +# to be a hack only done in buildworld. +.if !defined(_SKIP_BUILD) +ioctl.c: .PHONY +.endif +ioctl.c: mkioctls .META env MACHINE=${MACHINE} CPP="${CPP}" \ /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > ${.TARGET} From owner-svn-src-head@freebsd.org Sun Nov 13 00:11:20 2016 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 B775EC3ECE1; Sun, 13 Nov 2016 00:11:20 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 431891287; Sun, 13 Nov 2016 00:11:20 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0BJhX094345; Sun, 13 Nov 2016 00:11:19 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0BJfp094344; Sun, 13 Nov 2016 00:11:19 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130011.uAD0BJfp094344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:11:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308604 - head/targets/pseudo/userland/gnu X-SVN-Group: head 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, 13 Nov 2016 00:11:20 -0000 Author: bdrewery Date: Sun Nov 13 00:11:19 2016 New Revision: 308604 URL: https://svnweb.freebsd.org/changeset/base/308604 Log: Remove lingering ELFCOPY_AS_OBJCOPY missed in r306649. Sponsored by: Dell EMC Isilon Modified: head/targets/pseudo/userland/gnu/Makefile.depend Modified: head/targets/pseudo/userland/gnu/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/gnu/Makefile.depend Sun Nov 13 00:11:15 2016 (r308603) +++ head/targets/pseudo/userland/gnu/Makefile.depend Sun Nov 13 00:11:19 2016 (r308604) @@ -111,10 +111,6 @@ DIRDEPS = \ gnu/usr.bin/texinfo/makeinfo \ gnu/usr.bin/texinfo/texindex \ -.if ${MK_ELFCOPY_AS_OBJCOPY} == "no" -DIRDEPS+= gnu/usr.bin/binutils/objcopy -.endif - .if ${MK_GPL_DTC} != "no" DIRDEPS+= gnu/usr.bin/dtc .endif From owner-svn-src-head@freebsd.org Sun Nov 13 00:11:25 2016 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 28B05C3ED28; Sun, 13 Nov 2016 00:11:25 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDEAD13B9; Sun, 13 Nov 2016 00:11:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0BNnq094396; Sun, 13 Nov 2016 00:11:24 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0BNIM094390; Sun, 13 Nov 2016 00:11:23 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130011.uAD0BNIM094390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:11:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308605 - in head: lib/libcapsicum lib/libefivar sbin/zfsbootcfg targets/pseudo/userland/misc usr.sbin/efivar X-SVN-Group: head 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, 13 Nov 2016 00:11:25 -0000 Author: bdrewery Date: Sun Nov 13 00:11:23 2016 New Revision: 308605 URL: https://svnweb.freebsd.org/changeset/base/308605 Log: DIRDEPS_BUILD: Connect new dependencies. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Added: head/lib/libcapsicum/Makefile.depend (contents, props changed) head/lib/libefivar/Makefile.depend (contents, props changed) head/sbin/zfsbootcfg/Makefile.depend (contents, props changed) head/usr.sbin/efivar/Makefile.depend (contents, props changed) Modified: head/targets/pseudo/userland/misc/Makefile.depend Added: head/lib/libcapsicum/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcapsicum/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) @@ -0,0 +1,11 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Added: head/lib/libefivar/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libefivar/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) @@ -0,0 +1,18 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Added: head/sbin/zfsbootcfg/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/zfsbootcfg/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) @@ -0,0 +1,32 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + cddl/lib/libavl \ + cddl/lib/libnvpair \ + cddl/lib/libumem \ + cddl/lib/libuutil \ + cddl/lib/libzfs \ + cddl/lib/libzfs_core \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libexpat \ + lib/libgeom \ + lib/libmd \ + lib/libsbuf \ + lib/libthr \ + lib/libutil \ + lib/libz \ + lib/msun \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Modified: head/targets/pseudo/userland/misc/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/misc/Makefile.depend Sun Nov 13 00:11:19 2016 (r308604) +++ head/targets/pseudo/userland/misc/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) @@ -58,6 +58,9 @@ DIRDEPS.x86sys+= \ sys/boot/i386/zfsboot \ sys/boot/i386/zfsloader \ +DIRDEPS+= \ + sbin/zfsbootcfg \ + .endif DIRDEPS.amd64= \ @@ -75,6 +78,12 @@ DIRDEPS.amd64+= \ .endif +.if ${MK_EFI} != "no" +DIRDEPS+= \ + usr.sbin/efivar \ + +.endif + DIRDEPS.arm= ${_sys_boot_fdt} ${_sys_boot_efi} DIRDEPS.arm64= ${_sys_boot_fdt} ${_sys_boot_efi} DIRDEPS.i386= ${DIRDEPS.x86sys} ${_sys_boot_efi} Added: head/usr.sbin/efivar/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/efivar/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) @@ -0,0 +1,19 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libefivar \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif From owner-svn-src-head@freebsd.org Sun Nov 13 00:11:34 2016 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 21BBDC3EE2C; Sun, 13 Nov 2016 00:11:34 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B80B2168C; Sun, 13 Nov 2016 00:11:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0BWwY095095; Sun, 13 Nov 2016 00:11:32 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0BU89095074; Sun, 13 Nov 2016 00:11:30 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130011.uAD0BU89095074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:11:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308606 - in head: bin/echo bin/sleep rescue/rescue sbin/md5 usr.bin/basename usr.bin/cmp usr.bin/col usr.bin/dc usr.bin/dirname usr.bin/elfdump usr.bin/fold usr.bin/getopt usr.bin/jot ... X-SVN-Group: head 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, 13 Nov 2016 00:11:34 -0000 Author: bdrewery Date: Sun Nov 13 00:11:30 2016 New Revision: 308606 URL: https://svnweb.freebsd.org/changeset/base/308606 Log: DIRDEPS_BUILD: Update dependencies. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/bin/echo/Makefile.depend head/bin/sleep/Makefile.depend head/rescue/rescue/Makefile.depend head/sbin/md5/Makefile.depend head/usr.bin/basename/Makefile.depend head/usr.bin/cmp/Makefile.depend head/usr.bin/col/Makefile.depend head/usr.bin/dc/Makefile.depend head/usr.bin/dirname/Makefile.depend head/usr.bin/elfdump/Makefile.depend head/usr.bin/fold/Makefile.depend head/usr.bin/getopt/Makefile.depend head/usr.bin/jot/Makefile.depend head/usr.bin/kdump/Makefile.depend head/usr.bin/locate/bigram/Makefile.depend head/usr.bin/logname/Makefile.depend head/usr.bin/printenv/Makefile.depend head/usr.bin/tee/Makefile.depend head/usr.bin/tr/Makefile.depend head/usr.bin/write/Makefile.depend head/usr.bin/yes/Makefile.depend head/usr.sbin/daemon/Makefile.depend Modified: head/bin/echo/Makefile.depend ============================================================================== --- head/bin/echo/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/bin/echo/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/bin/sleep/Makefile.depend ============================================================================== --- head/bin/sleep/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/bin/sleep/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/rescue/rescue/Makefile.depend ============================================================================== --- head/rescue/rescue/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/rescue/rescue/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -24,6 +24,7 @@ DIRDEPS = \ lib/libbz2 \ lib/libc \ lib/libcam \ + lib/libcapsicum \ lib/libcompiler_rt \ lib/libcrypt \ lib/libdevstat \ Modified: head/sbin/md5/Makefile.depend ============================================================================== --- head/sbin/md5/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/sbin/md5/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ lib/libmd \ Modified: head/usr.bin/basename/Makefile.depend ============================================================================== --- head/usr.bin/basename/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/basename/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/cmp/Makefile.depend ============================================================================== --- head/usr.bin/cmp/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/cmp/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/col/Makefile.depend ============================================================================== --- head/usr.bin/col/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/col/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/dc/Makefile.depend ============================================================================== --- head/usr.bin/dc/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/dc/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ secure/lib/libcrypto \ secure/lib/libssl \ Modified: head/usr.bin/dirname/Makefile.depend ============================================================================== --- head/usr.bin/dirname/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/dirname/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -5,8 +5,10 @@ DIRDEPS = \ gnu/lib/csu \ gnu/lib/libgcc \ include \ + include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/elfdump/Makefile.depend ============================================================================== --- head/usr.bin/elfdump/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/elfdump/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/fold/Makefile.depend ============================================================================== --- head/usr.bin/fold/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/fold/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/getopt/Makefile.depend ============================================================================== --- head/usr.bin/getopt/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/getopt/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -5,8 +5,10 @@ DIRDEPS = \ gnu/lib/csu \ gnu/lib/libgcc \ include \ + include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/jot/Makefile.depend ============================================================================== --- head/usr.bin/jot/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/jot/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/kdump/Makefile.depend ============================================================================== --- head/usr.bin/kdump/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/kdump/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -9,6 +9,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcasper/libcasper \ lib/libcasper/services/cap_grp \ lib/libcasper/services/cap_pwd \ Modified: head/usr.bin/locate/bigram/Makefile.depend ============================================================================== --- head/usr.bin/locate/bigram/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/locate/bigram/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -5,8 +5,10 @@ DIRDEPS = \ gnu/lib/csu \ gnu/lib/libgcc \ include \ + include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/logname/Makefile.depend ============================================================================== --- head/usr.bin/logname/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/logname/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -5,8 +5,10 @@ DIRDEPS = \ gnu/lib/csu \ gnu/lib/libgcc \ include \ + include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/printenv/Makefile.depend ============================================================================== --- head/usr.bin/printenv/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/printenv/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/tee/Makefile.depend ============================================================================== --- head/usr.bin/tee/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/tee/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/tr/Makefile.depend ============================================================================== --- head/usr.bin/tr/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/tr/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/write/Makefile.depend ============================================================================== --- head/usr.bin/write/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/write/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -8,6 +8,7 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.bin/yes/Makefile.depend ============================================================================== --- head/usr.bin/yes/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.bin/yes/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -5,8 +5,10 @@ DIRDEPS = \ gnu/lib/csu \ gnu/lib/libgcc \ include \ + include/xlocale \ lib/${CSU_DIR} \ lib/libc \ + lib/libcapsicum \ lib/libcompiler_rt \ Modified: head/usr.sbin/daemon/Makefile.depend ============================================================================== --- head/usr.sbin/daemon/Makefile.depend Sun Nov 13 00:11:23 2016 (r308605) +++ head/usr.sbin/daemon/Makefile.depend Sun Nov 13 00:11:30 2016 (r308606) @@ -5,6 +5,7 @@ DIRDEPS = \ gnu/lib/csu \ gnu/lib/libgcc \ include \ + include/xlocale \ lib/${CSU_DIR} \ lib/libc \ lib/libcompiler_rt \ From owner-svn-src-head@freebsd.org Sun Nov 13 00:46:12 2016 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 73FD4C3D96E; Sun, 13 Nov 2016 00:46:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BDDA1A74; Sun, 13 Nov 2016 00:46:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0kBcq007865; Sun, 13 Nov 2016 00:46:11 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0kBeE007864; Sun, 13 Nov 2016 00:46:11 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201611130046.uAD0kBeE007864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 13 Nov 2016 00:46:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308607 - head/sys/kern X-SVN-Group: head 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, 13 Nov 2016 00:46:12 -0000 Author: jhibbits Date: Sun Nov 13 00:46:11 2016 New Revision: 308607 URL: https://svnweb.freebsd.org/changeset/base/308607 Log: Add two new ddb commands: show device/show all devices Shows several useful pieces of information from the device including the softc and ivars pointers. Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Sun Nov 13 00:11:30 2016 (r308606) +++ head/sys/kern/subr_bus.c Sun Nov 13 00:46:11 2016 (r308607) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include "opt_bus.h" +#include "opt_ddb.h" #include #include @@ -65,6 +66,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + SYSCTL_NODE(_hw, OID_AUTO, bus, CTLFLAG_RW, NULL, NULL); SYSCTL_ROOT_NODE(OID_AUTO, dev, CTLFLAG_RW, NULL, NULL); @@ -143,6 +146,9 @@ static MALLOC_DEFINE(M_BUS_SC, "bus-sc", static void devctl2_init(void); +#define DRIVERNAME(d) ((d)? d->name : "no driver") +#define DEVCLANAME(d) ((d)? d->name : "no devclass") + #ifdef BUS_DEBUG static int bus_debug = 1; @@ -151,8 +157,6 @@ SYSCTL_INT(_debug, OID_AUTO, bus_debug, #define PDEBUG(a) if (bus_debug) {printf("%s:%d: ", __func__, __LINE__), printf a; printf("\n");} #define DEVICENAME(d) ((d)? device_get_name(d): "no device") -#define DRIVERNAME(d) ((d)? d->name : "no driver") -#define DEVCLANAME(d) ((d)? d->name : "no devclass") /** * Produce the indenting, indent*2 spaces plus a '.' ahead of that to @@ -176,8 +180,6 @@ void print_devclass_list(void); /* Make the compiler ignore the function calls */ #define PDEBUG(a) /* nop */ #define DEVICENAME(d) /* nop */ -#define DRIVERNAME(d) /* nop */ -#define DEVCLANAME(d) /* nop */ #define print_device_short(d,i) /* nop */ #define print_device(d,i) /* nop */ @@ -5586,3 +5588,32 @@ devctl2_init(void) make_dev_credf(MAKEDEV_ETERNAL, &devctl2_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0600, "devctl2"); } + +#ifdef DDB +DB_SHOW_COMMAND(device, db_show_device) +{ + device_t dev; + + if (!have_addr) + return; + + dev = (device_t)addr; + + db_printf("name: %s\n", device_get_nameunit(dev)); + db_printf(" driver: %s\n", DRIVERNAME(dev->driver)); + db_printf(" class: %s\n", DEVCLANAME(dev->devclass)); + db_printf(" addr: %p\n", dev); + db_printf(" parent: %p\n", dev->parent); + db_printf(" softc: %p\n", dev->softc); + db_printf(" ivars: %p\n", dev->ivars); +} + +DB_SHOW_ALL_COMMAND(devices, db_show_all_devices) +{ + device_t dev; + + TAILQ_FOREACH(dev, &bus_data_devices, devlink) { + db_show_device((db_expr_t)dev, true, count, modif); + } +} +#endif From owner-svn-src-head@freebsd.org Sun Nov 13 01:05:08 2016 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 8740BC3DDD3; Sun, 13 Nov 2016 01:05:08 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x235.google.com (mail-it0-x235.google.com [IPv6:2607:f8b0:4001:c0b::235]) (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 56E4F1218; Sun, 13 Nov 2016 01:05:08 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x235.google.com with SMTP id q124so45834460itd.1; Sat, 12 Nov 2016 17:05:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=zKGzWJ8rXQ3jhio5ITgniTkCjOnG36Ow0a+AAKxh1Pc=; b=vDMYB4o6d1F5X45NlOfeTBAjtOVU8Q3VqKRyQMFt/HjTC7yhh6Kwd7YIq1Fcj6R31y d02B6LG/p/r0l4kNJ4t4SBIsy79QqxR+mN0fikZ8DMe1kL00fA9ieaj+uiTlKsg98xp6 pcUmEGRfBMoY38yCLmN846Pwl9lm2QbBQOBhjb0BUJAz4bVCkSC8wXBwVT2bNNBhg9JE 9gf31Y3Q7S0kGMWSa64YCL2u7BPwm7DGrfj8SkQzNV6F74WI707iNRpv0Fq88lEyVN8g dMW1XwI2BfDg8b7tSAmoNJDGeMOGvvk330bV6/RrilLUlN4H45030CmO5Ef02LRtRQtz gz0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=zKGzWJ8rXQ3jhio5ITgniTkCjOnG36Ow0a+AAKxh1Pc=; b=PWn5BzfuMBu2O3FvxKgzCkt43I/jKaJjIUQW5IVO+96pAhGAOENGtU3bqtllOXYVNd mCJfyPufxyl09zJQ4Qzk9KeeDC1AAg8knE/xET9LQSE8LWKldHgo4Tr+mXfmUXmY5bB5 3hgodHXI8+sLhJmyZIE+9EnEA3D8TM/3Q1Bq9wP/jDarzBd/Ehr/8dLAMBgXaE3vNtyP P5oA/BgwsbZaNP+Tc7/9NWOUyv+GeW/1QaDCqwnKqsnwK0M+AZQ7vFhZV3UgGEkq+G9X IRjkKK2TTVVLIqy9Ff0oSnPOPfP5iFhJEe61+v+ONMz0l1NzwLtqVtP5BcUjLCC+6wUq JgFg== X-Gm-Message-State: ABUngveswD/G43boxgj3CPwEi0DAuC9vv5FOfMttVm+LpS7lEjZRv5cyNF4uYcianW99xb2xuGSh5kCZmzsefg== X-Received: by 10.36.43.193 with SMTP id h184mr2418032ita.29.1478999107447; Sat, 12 Nov 2016 17:05:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Sat, 12 Nov 2016 17:05:06 -0800 (PST) In-Reply-To: <201611110242.uAB2gsfj074107@repo.freebsd.org> References: <201611110242.uAB2gsfj074107@repo.freebsd.org> From: Adrian Chadd Date: Sat, 12 Nov 2016 17:05:06 -0800 Message-ID: Subject: Re: svn commit: r308493 - in head: contrib/amd contrib/amd/amd contrib/amd/amq contrib/amd/conf/checkmount contrib/amd/conf/mtab contrib/amd/conf/nfs_prot contrib/amd/conf/transp contrib/amd/conf/umoun... To: Cy Schubert 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: Sun, 13 Nov 2016 01:05:08 -0000 Fails to build on -mips: /usr/home/adrian/work/freebsd/head-embedded/src/contrib/amd/amd/readdir.c: In function 'amfs_generic_readdir': /usr/home/adrian/work/freebsd/head-embedded/src/contrib/amd/amd/readdir.c:947:42: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] return amfs_readdir3_browsable(mp, (am_cookie3) cookie, dp, ep, count, full); ^ -adrian From owner-svn-src-head@freebsd.org Sun Nov 13 01:27:17 2016 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 5A0DFC3E367; Sun, 13 Nov 2016 01:27:17 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::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 228C21881; Sun, 13 Nov 2016 01:27:17 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x230.google.com with SMTP id q124so40329651itd.1; Sat, 12 Nov 2016 17:27:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+rKqChieJMZaemVBEkMHaHI5iGtzoG2qAHkmDxA65YE=; b=kKPSGdzMhtycRyyI7+FiyYp7tnKd+4Fu5TVllvIIqg2JHHNW6WMEI3nTbS+CiQHi/7 0t/NLQvFmYUJMFnOOBvfzAPBXWBszl9eXKa7E//oNNrg6mLOR3merHFRzpWk9Z6czvoF ERYRQ0IOLPiF34ELVFPhKcmocJw7gCM6Yg3In+AFoSrMx8vp/ToahUTHqkZwwdky488T /cZXPuGRAnRTtjJwhW6tZSbi/z43BUNS3eRElIvSchMLf8iUIPmPC6/kUB1SBnfl7ulb yYt7JE257n8bUp/DzNSvOQPiA6STBmoHZAYA5dgTUZ/qHBTwZk99lSuDR8uGiHlcFGDY hYRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+rKqChieJMZaemVBEkMHaHI5iGtzoG2qAHkmDxA65YE=; b=de8dnJZIeqU8WTxDFhAXzznNeSxfidN/AaGm7tasXNpW9C0X6nDraCNjsPhFHMl2RG dtjmqZCMXOeS+uPQEtbnVZAR8wfleeAvh/TkAxRxikw5ieNW5QnT/K6Aki/uQyq9mH/f 5Rqezmc0kgcGUsNEbhwJWm6b8acVTvCVtRVSbols02Pk8UzMHQ/Vf0y3V24uhtoS2BFS 6H1ECC/mMrtOgN29dVQZ9b9aLW6n+t9ztvFZZ22/3j0Yzyvksib0UEFpPIYApMkZQVCw 5AWgQbL/SoQA3D+OHXNSzFWs9nHnEvzDH90ja1peWHgaI2BWGmwltNX2iQf9k3BRw8l6 b36w== X-Gm-Message-State: ABUngvfXDaeQBzr4Ztn1wwxliC8irxI3Icvx2lczaz++OKjY2j13AeQlCbNSXm3sd+aMlMQPt9HJ5XAMdyCi/Q== X-Received: by 10.107.136.86 with SMTP id k83mr17728967iod.99.1479000436383; Sat, 12 Nov 2016 17:27:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Sat, 12 Nov 2016 17:27:15 -0800 (PST) In-Reply-To: References: <201611110242.uAB2gsfj074107@repo.freebsd.org> From: Adrian Chadd Date: Sat, 12 Nov 2016 17:27:15 -0800 Message-ID: Subject: Re: svn commit: r308493 - in head: contrib/amd contrib/amd/amd contrib/amd/amq contrib/amd/conf/checkmount contrib/amd/conf/mtab contrib/amd/conf/nfs_prot contrib/amd/conf/transp contrib/amd/conf/umoun... To: Cy Schubert 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: Sun, 13 Nov 2016 01:27:17 -0000 After looking at this, i'm not sure how this is supposed to work on a 32 bit platform at all. Is there some vendor patch to fix compilation on 32 bit platforms? If not, can we back this out until we get it compiling on 32 bit platforms? Thanks, -adrian From owner-svn-src-head@freebsd.org Sun Nov 13 01:54:26 2016 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 21204C3D5A2; Sun, 13 Nov 2016 01:54:26 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (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 C96321A70; Sun, 13 Nov 2016 01:54:25 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id 5jxScoznqKjjy5jxTcwn98; Sat, 12 Nov 2016 18:51:48 -0700 X-Authority-Analysis: v=2.2 cv=SPoybKnH c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=L24OOQBejmoA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=QwYikicNIiV6aTP_wy4A:9 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 37C576AA; Sat, 12 Nov 2016 17:51:46 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id uAD1pkXn018583; Sat, 12 Nov 2016 17:51:46 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201611130151.uAD1pkXn018583@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: Adrian Chadd cc: Cy Schubert , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r308493 - in head: contrib/amd contrib/amd/amd contrib/amd/amq contrib/amd/conf/checkmount contrib/amd/conf/mtab contrib/amd/conf/nfs_prot contrib/amd/conf/transp contrib/amd/conf/umoun... In-Reply-To: Message from Adrian Chadd of "Sat, 12 Nov 2016 17:27:15 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 12 Nov 2016 17:51:46 -0800 X-CMAE-Envelope: MS4wfEC21cLxi9MR1gADKJihpFPxk8pwAJtNVjyexvj4J0l+fUI0HW55mb3OwmMJHsM9smxUA0hab4ev5QOPZiBjmJpFiAwRp/Enfn4VT2GZltFfi0lIEHz5 RM2JsLZ//Q0R0jJIivauVd/dx3NaznBJYon6kngLk+0FRbjfOTKUb/caV6f3Tm/+XIjYEf3EdIg34RqQKZiUA/9IOCtbYTUpAUBgHr5aKbJH62mB4x7A0ZRI lmrSnEr5No88zbKVMajQQG/k2vGEz1eRBg8pNr49Y7Kmjixi7msb5G5ieBT48Nae5cFbqzwaJTLGE6R50nSEXQ== 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, 13 Nov 2016 01:54:26 -0000 In message , Adrian Chadd writes: > After looking at this, i'm not sure how this is supposed to work on a > 32 bit platform at all. > > Is there some vendor patch to fix compilation on 32 bit platforms? If > not, can we back this out until we get it compiling on 32 bit > platforms? It builds and runs on i386 here. I'll figure something out tonight. -- 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 Sun Nov 13 03:56:28 2016 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 43C77C2E760; Sun, 13 Nov 2016 03:56:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D69B4B5; Sun, 13 Nov 2016 03:56:27 +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 uAD3uRb3083256; Sun, 13 Nov 2016 03:56:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD3uQl5083254; Sun, 13 Nov 2016 03:56:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611130356.uAD3uQl5083254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 13 Nov 2016 03:56:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308608 - head/sys/geom/mirror X-SVN-Group: head 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, 13 Nov 2016 03:56:30 -0000 Author: mav Date: Sun Nov 13 03:56:26 2016 New Revision: 308608 URL: https://svnweb.freebsd.org/changeset/base/308608 Log: Use providergone method to cover race between destroy and g_access(). Reviewed by: markj MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror.h Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Sun Nov 13 00:46:11 2016 (r308607) +++ head/sys/geom/mirror/g_mirror.c Sun Nov 13 03:56:26 2016 (r308608) @@ -79,12 +79,12 @@ SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, static eventhandler_tag g_mirror_post_sync = NULL; static int g_mirror_shutdown = 0; -static int g_mirror_destroy_geom(struct gctl_req *req, struct g_class *mp, - struct g_geom *gp); +static g_ctl_destroy_geom_t g_mirror_destroy_geom; static g_taste_t g_mirror_taste; +static g_init_t g_mirror_init; +static g_fini_t g_mirror_fini; +static g_provgone_t g_mirror_providergone; static g_resize_t g_mirror_resize; -static void g_mirror_init(struct g_class *mp); -static void g_mirror_fini(struct g_class *mp); struct g_class g_mirror_class = { .name = G_MIRROR_CLASS_NAME, @@ -94,6 +94,7 @@ struct g_class g_mirror_class = { .destroy_geom = g_mirror_destroy_geom, .init = g_mirror_init, .fini = g_mirror_fini, + .providergone = g_mirror_providergone, .resize = g_mirror_resize }; @@ -508,6 +509,26 @@ g_mirror_destroy_disk(struct g_mirror_di } static void +g_mirror_free_device(struct g_mirror_softc *sc) +{ + + mtx_destroy(&sc->sc_queue_mtx); + mtx_destroy(&sc->sc_events_mtx); + mtx_destroy(&sc->sc_done_mtx); + sx_destroy(&sc->sc_lock); + free(sc, M_MIRROR); +} + +static void +g_mirror_providergone(struct g_provider *pp) +{ + struct g_mirror_softc *sc = pp->private; + + if ((--sc->sc_refcnt) == 0) + g_mirror_free_device(sc); +} + +static void g_mirror_destroy_device(struct g_mirror_softc *sc) { struct g_mirror_disk *disk; @@ -549,12 +570,10 @@ g_mirror_destroy_device(struct g_mirror_ g_wither_geom(sc->sc_sync.ds_geom, ENXIO); G_MIRROR_DEBUG(0, "Device %s destroyed.", gp->name); g_wither_geom(gp, ENXIO); - g_topology_unlock(); - mtx_destroy(&sc->sc_queue_mtx); - mtx_destroy(&sc->sc_events_mtx); - mtx_destroy(&sc->sc_done_mtx); sx_xunlock(&sc->sc_lock); - sx_destroy(&sc->sc_lock); + if ((--sc->sc_refcnt) == 0) + g_mirror_free_device(sc); + g_topology_unlock(); } static void @@ -868,7 +887,7 @@ g_mirror_flush_done(struct bio *bp) struct bio *pbp; pbp = bp->bio_parent; - sc = pbp->bio_to->geom->softc; + sc = pbp->bio_to->private; mtx_lock(&sc->sc_done_mtx); if (pbp->bio_error == 0) pbp->bio_error = bp->bio_error; @@ -905,7 +924,7 @@ g_mirror_regular_request(struct bio *bp) g_topology_assert_not(); pbp = bp->bio_parent; - sc = pbp->bio_to->geom->softc; + sc = pbp->bio_to->private; bp->bio_from->index--; if (bp->bio_cmd == BIO_WRITE) sc->sc_writes--; @@ -1036,7 +1055,7 @@ g_mirror_candelete(struct bio *bp) struct g_mirror_disk *disk; int *val; - sc = bp->bio_to->geom->softc; + sc = bp->bio_to->private; LIST_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_flags & G_MIRROR_DISK_FLAG_CANDELETE) break; @@ -1061,7 +1080,7 @@ g_mirror_kernel_dump(struct bio *bp) * we will not be able to read the dump after the reboot if it will be * connected and synchronized later. Can we do something better? */ - sc = bp->bio_to->geom->softc; + sc = bp->bio_to->private; disk = LIST_FIRST(&sc->sc_disks); gkd = (struct g_kerneldump *)bp->bio_data; @@ -1121,7 +1140,7 @@ g_mirror_start(struct bio *bp) { struct g_mirror_softc *sc; - sc = bp->bio_to->geom->softc; + sc = bp->bio_to->private; /* * If sc == NULL or there are no valid disks, provider's error * should be set and g_mirror_start() should not be called at all. @@ -1637,7 +1656,7 @@ g_mirror_register_request(struct bio *bp { struct g_mirror_softc *sc; - sc = bp->bio_to->geom->softc; + sc = bp->bio_to->private; switch (bp->bio_cmd) { case BIO_READ: switch (sc->sc_balance) { @@ -1804,7 +1823,6 @@ g_mirror_try_destroy(struct g_mirror_sof } else { g_topology_unlock(); g_mirror_destroy_device(sc); - free(sc, M_MIRROR); } return (1); } @@ -2117,6 +2135,8 @@ g_mirror_launch_provider(struct g_mirror } } } + pp->private = sc; + sc->sc_refcnt++; sc->sc_provider = pp; g_error_provider(pp, 0); g_topology_unlock(); @@ -2898,9 +2918,7 @@ g_mirror_access(struct g_provider *pp, i G_MIRROR_DEBUG(2, "Access request for %s: r%dw%de%d.", pp->name, acr, acw, ace); - sc = pp->geom->softc; - if (sc == NULL && acr <= 0 && acw <= 0 && ace <= 0) - return (0); + sc = pp->private; KASSERT(sc != NULL, ("NULL softc (provider=%s).", pp->name)); g_topology_unlock(); @@ -2959,6 +2977,7 @@ g_mirror_create(struct g_class *mp, cons sc->sc_idle = 1; sc->sc_last_write = time_uptime; sc->sc_writes = 0; + sc->sc_refcnt = 1; sx_init(&sc->sc_lock, "gmirror:lock"); bioq_init(&sc->sc_queue); mtx_init(&sc->sc_queue_mtx, "gmirror:queue", NULL, MTX_DEF); @@ -2989,12 +3008,8 @@ g_mirror_create(struct g_class *mp, cons G_MIRROR_DEBUG(1, "Cannot create kernel thread for %s.", sc->sc_name); g_destroy_geom(sc->sc_sync.ds_geom); - mtx_destroy(&sc->sc_done_mtx); - mtx_destroy(&sc->sc_events_mtx); - mtx_destroy(&sc->sc_queue_mtx); - sx_destroy(&sc->sc_lock); g_destroy_geom(sc->sc_geom); - free(sc, M_MIRROR); + g_mirror_free_device(sc); return (NULL); } @@ -3017,8 +3032,6 @@ g_mirror_destroy(struct g_mirror_softc * struct g_mirror_disk *disk; g_topology_assert_not(); - if (sc == NULL) - return (ENXIO); sx_assert(&sc->sc_lock, SX_XLOCKED); if (sc->sc_provider_open != 0 || SCHEDULER_STOPPED()) { @@ -3068,7 +3081,6 @@ g_mirror_destroy(struct g_mirror_softc * G_MIRROR_DEBUG(4, "%s: Woken up %p.", __func__, &sc->sc_worker); sx_xlock(&sc->sc_lock); g_mirror_destroy_device(sc); - free(sc, M_MIRROR); return (0); } Modified: head/sys/geom/mirror/g_mirror.h ============================================================================== --- head/sys/geom/mirror/g_mirror.h Sun Nov 13 00:46:11 2016 (r308607) +++ head/sys/geom/mirror/g_mirror.h Sun Nov 13 03:56:26 2016 (r308608) @@ -207,6 +207,7 @@ struct g_mirror_softc { int sc_idle; /* DIRTY flags removed. */ time_t sc_last_write; u_int sc_writes; + u_int sc_refcnt; /* Number of softc references */ TAILQ_HEAD(, g_mirror_event) sc_events; struct mtx sc_events_mtx; From owner-svn-src-head@freebsd.org Sun Nov 13 06:59:02 2016 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 21DF4C3F4EB; Sun, 13 Nov 2016 06:59:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::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 927FB189E; Sun, 13 Nov 2016 06:59:01 +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 uAD6wpeD081383 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 13 Nov 2016 08:58:52 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua uAD6wpeD081383 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id uAD6wpti081382; Sun, 13 Nov 2016 08:58:51 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 13 Nov 2016 08:58:51 +0200 From: Konstantin Belousov To: Adrian Chadd Cc: "freebsd-mips@freebsd.org" , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r307626 - head/sys/ufs/ffs Message-ID: <20161113065851.GD54029@kib.kiev.ua> References: <201610191109.u9JB9TTC002727@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) 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: Sun, 13 Nov 2016 06:59:02 -0000 On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote: > hi! > > This broke freebsd on mips24k. > > BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read > fault (type 0x2) at 0 > Trapframe Register Dump: > zero: 0 at: 0 v0: 0 v1: 0 > a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 > t0: 0 t1: 0 t2: 0 t3: 0 > t4: 0 t5: 0 t6: 0 t7: 0 > t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 > s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 > s6: 0 s7: 0 k0: 0 k1: 0 > gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 > sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 > cause: 0x8 pc: 0x4002a4 > Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda > Dumping 4 words starting at pc address 0x4002a4: > 8c420000 14400003 00908021 8f828024 > Page table info for bad address 0: pde = 0, pte = 0 MIPS24k has split I/D caches, and both are VIPT, am I right ? I was not able to find the handling of cache aliasing in mips/pmap.c. Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf to 1 change anything. > > .. and yes, I've spent three days bisecting everything to get to this > particular commit. From owner-svn-src-head@freebsd.org Sun Nov 13 07:10:44 2016 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 A7864C3F6CC; Sun, 13 Nov 2016 07:10:44 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (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 8123C1DE3; Sun, 13 Nov 2016 07:10:44 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x236.google.com with SMTP id c20so24451292itb.0; Sat, 12 Nov 2016 23:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=e8XXx5i3xTFbb8svbnL6u4XSlfEDmpzN4mQb6amV1o8=; b=Ix8N7OYV81f/jwe57I0PIwf/a1+WhS89U9E98IPwfEIeubT0pue77Uk+hM1md97rF7 Wzby8PjQIXLDQyW7P91cUV03CQULaCPs9cYcl6+zfazrUUgQsi2JbOLBjqO9nEnLERIn oa5oUCd+PH06vFqidJ7J+Wcr3nsT7bjjPT/GvrfOsVTpd7EaW1YJrxb0W++/DV56TX+Z 3Pj3Kqb+1IZIveClnziR3KRF5LOHI2RCd6v8ENeUysFq93xM7ri1y7DUQd/uDirVwUgH CiOPQI6GIAdF2Gjsz1xQGZ4wnHK/FlZYKttR7BJLjiaYc2FjGKOalGmHh/OX12rE9DGo kNyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=e8XXx5i3xTFbb8svbnL6u4XSlfEDmpzN4mQb6amV1o8=; b=eVurqIvyTGUIAuusQeS4xsx+PfDbYDM1MTMVtn8CYYtvh+iCGReGOrcjsTd2wu0Ng7 +h8naOEldrg+LaDZw1cKlQy3Ujo2dBPP1e+al/qBY2XENURP/gbZ3nwEv1B5HGkfI0f5 mp6DIo7jbrfXlNCWuw2YlszrdAbqCen7vRfelghXoJ8tP275c/FpiDuY68SF3we6YdsU DyK9QB0QTpXWGZ3Tg2t77IUtagnnhCfGLU3Psyuz/UOR+iOzRvUCiziEq93ynkDVq2rB e+lX2GQvjrs31eF9z/uDhxtd+LW6PXHxI6ALPjCll6zLV/8PySLhIoJHs00BXZemN7ML 569w== X-Gm-Message-State: ABUngve2D4p0MgQ09bTWxJhHgELLYGCOuZC43TUHnTfcueqTyOafpoVFN/gSvQvjVinqFu+L8Lfl+ToF5QzNPg== X-Received: by 10.36.65.216 with SMTP id b85mr2693568itd.39.1479021043864; Sat, 12 Nov 2016 23:10:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Sat, 12 Nov 2016 23:10:43 -0800 (PST) In-Reply-To: <20161113065851.GD54029@kib.kiev.ua> References: <201610191109.u9JB9TTC002727@repo.freebsd.org> <20161113065851.GD54029@kib.kiev.ua> From: Adrian Chadd Date: Sat, 12 Nov 2016 23:10:43 -0800 Message-ID: Subject: Re: svn commit: r307626 - head/sys/ufs/ffs To: Konstantin Belousov Cc: "freebsd-mips@freebsd.org" , "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: Sun, 13 Nov 2016 07:10:44 -0000 That disappeared from the file in a later commit? -a On 12 November 2016 at 22:58, Konstantin Belousov wrote: > On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote: >> hi! >> >> This broke freebsd on mips24k. >> >> BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read >> fault (type 0x2) at 0 >> Trapframe Register Dump: >> zero: 0 at: 0 v0: 0 v1: 0 >> a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 >> t0: 0 t1: 0 t2: 0 t3: 0 >> t4: 0 t5: 0 t6: 0 t7: 0 >> t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 >> s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 >> s6: 0 s7: 0 k0: 0 k1: 0 >> gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 >> sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 >> cause: 0x8 pc: 0x4002a4 >> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda >> Dumping 4 words starting at pc address 0x4002a4: >> 8c420000 14400003 00908021 8f828024 >> Page table info for bad address 0: pde = 0, pte = 0 > MIPS24k has split I/D caches, and both are VIPT, am I right ? > I was not able to find the handling of cache aliasing in mips/pmap.c. > > Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf > to 1 change anything. > >> >> .. and yes, I've spent three days bisecting everything to get to this >> particular commit. From owner-svn-src-head@freebsd.org Sun Nov 13 07:12:03 2016 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 E08A8C3F884 for ; Sun, 13 Nov 2016 07:12:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (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 A8D6E1D4 for ; Sun, 13 Nov 2016 07:12:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x242.google.com with SMTP id q124so5798950itd.1 for ; Sat, 12 Nov 2016 23:12:03 -0800 (PST) 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=3tHGgvU3+NGA/go9h/VmsAmB54OHtiv2UaLnDWOlVwQ=; b=vxCDfH1/4PZbj0hl3jFyH3mXGOEgxFtjLJ2wi5HqQ61K/PDWMLzU/qjo0s5uvXnrlC A+XaKJYMWiap3dJChAuzFbSONaH1vHzgyozzb50yhH6AIIUnyb67T/erfzqT16Bm7zpB WbUlywcHBKmGIBFqtrONFiZ69IvMB8T1QMkXDet6LigD1ZfhZR/+/7DDvzI5ooSlwzZB hxmGULfQ4fWuk786EnXeqBEpD9aZVyA9Sx+nT0BUPC0Wdv/9Jn+587esEr/lJ59x4dqT R47Fg4+EqWdL28YX3liqdC0Lnxwhoxw//Yn9ONwPX2Zou3OV2tbBipiQ5S88JWApQ/h3 ewNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=3tHGgvU3+NGA/go9h/VmsAmB54OHtiv2UaLnDWOlVwQ=; b=lEhG0b9r4TXBgDcxmqtDNEBHOhrugO/8lFSO7JKznrg3mkl5X1Eql/MWpxhiplctOv Wo/Ra19GKfQzSLs812tEN+KV4edxjVUVC2FPzzsndc3qEpnWHNICNthx+u1dc+SbpGQD 6UX1nUYWbxil61SX1PnSRtEzZtUuewhYck9JCzlr6qp7z4UmoT0lkf2pCxU6SsatV7Ys 3oausNu9T9M32W5vZnrorflxAhd+x8t+jzoJqVJREeS51qOGvShnu9DvHnK9tqJNV9ft YSmkuaX8egM2kpaOAQHsEMklk8DKrR8v2S/QZY9EwjpYPZ5mXKaMY/s+dsuEodmD6yRL 3XwA== X-Gm-Message-State: ABUngvdw6/8OwmhpvlCS8EKuvwxcD+YP68jrqEBGZp2EJ7JoA+/d7OuGvF68emJiEltDzwJ7wirF/YqGiP9Drw== X-Received: by 10.36.93.193 with SMTP id w184mr2750930ita.85.1479021123080; Sat, 12 Nov 2016 23:12:03 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.134.66 with HTTP; Sat, 12 Nov 2016 23:12:02 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <20161113065851.GD54029@kib.kiev.ua> References: <201610191109.u9JB9TTC002727@repo.freebsd.org> <20161113065851.GD54029@kib.kiev.ua> From: Warner Losh Date: Sun, 13 Nov 2016 00:12:02 -0700 X-Google-Sender-Auth: XlygBA0tK0iZSK9dNQyfFSHmLvs Message-ID: Subject: Re: svn commit: r307626 - head/sys/ufs/ffs To: Konstantin Belousov Cc: Adrian Chadd , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "freebsd-mips@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: Sun, 13 Nov 2016 07:12:04 -0000 On Sat, Nov 12, 2016 at 11:58 PM, Konstantin Belousov wrote: > On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote: >> hi! >> >> This broke freebsd on mips24k. >> >> BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read >> fault (type 0x2) at 0 >> Trapframe Register Dump: >> zero: 0 at: 0 v0: 0 v1: 0 >> a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 >> t0: 0 t1: 0 t2: 0 t3: 0 >> t4: 0 t5: 0 t6: 0 t7: 0 >> t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 >> s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 >> s6: 0 s7: 0 k0: 0 k1: 0 >> gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 >> sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 >> cause: 0x8 pc: 0x4002a4 >> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda >> Dumping 4 words starting at pc address 0x4002a4: >> 8c420000 14400003 00908021 8f828024 >> Page table info for bad address 0: pde = 0, pte = 0 > MIPS24k has split I/D caches, and both are VIPT, am I right ? > I was not able to find the handling of cache aliasing in mips/pmap.c. > > Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf > to 1 change anything. MIPS caches are such that creating two virtual mappings to the same physical page will cause corruption. It's simply not allowed, at least for the class of MIPS machines I used to bring up the port originally. Warner From owner-svn-src-head@freebsd.org Sun Nov 13 07:15:53 2016 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 8DA11C3F952; Sun, 13 Nov 2016 07:15:53 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::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 54D4B679; Sun, 13 Nov 2016 07:15:53 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x231.google.com with SMTP id q124so46113329itd.1; Sat, 12 Nov 2016 23:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=IbaRXHYXAmQnbUBUMwTTb59dAWjnkMpP50MXxqSJt0Y=; b=b6KCgI8IRqwcjTspWHFTLXkaHtk4mpBjE6PdEmV8WSxSUY2WRf3MkK/BNcXyNU732Y qYrgFdCEf42pI7dfL4TsR5iP5TcVMFdNgyLTofy1iR1BwFwp53vyovrFGYMJN6Ne2h/K 7g/aN8NUuIKkyt+XbgdtyWWro+HZ59ClLrkGzuzgMElDh1ueRcboeWUjQIXnJpM3O9ma IQP+CzbcWRInj+CvaPo85VDKUPkFIxLlGGMPQRqaerHamurZgoy2CsRxr9WWX0/NcYQ0 8g5r1xXDQRar3tjqIfIkmUtr6bI2LvPgDSGvX/fmRBINe29tRIMnn21M2TtX3bF9cfqa If+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IbaRXHYXAmQnbUBUMwTTb59dAWjnkMpP50MXxqSJt0Y=; b=dLudv8SM1ZDyWVs6ptEDGlEj+R3zW0IjTmf6nRCJmyTG+TnuLSQtMTF0WKgHgnT3hx 2WQHZccANbf6b8vxLBuCuzs3waYAeVFRXEWCKhyF0hls/oB+DLriAncwIOQwjeEx8Dxh hf8xBzAvO9Z8bDAHYrIDaw4rtkIf4CT7HtcirwzwYQTTMnIE2B712KzbpelojtmCzbJO GN5crDGm/YFCYcpgKlMoW9ocBrM71iNv9j5EMXbiEgZIriG7ni6/g7tVBcex/bdVwfs5 JzbjBlouncbyLuQtdD5ip846wDa0KrG6F74tvzkx+r7OjVduIUYtm51I+oczEy7fsghY qSqA== X-Gm-Message-State: ABUngvd68FZkqyqFr+a0tZl9KHig0SiROoOYxwaGgSiJcmKSsFfPs8RHWNW8GJUHMDRybXxXPmyOC8bsRtSkjw== X-Received: by 10.36.138.67 with SMTP id v64mr2646348itd.39.1479021352828; Sat, 12 Nov 2016 23:15:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Sat, 12 Nov 2016 23:15:52 -0800 (PST) In-Reply-To: References: <201610191109.u9JB9TTC002727@repo.freebsd.org> <20161113065851.GD54029@kib.kiev.ua> From: Adrian Chadd Date: Sat, 12 Nov 2016 23:15:52 -0800 Message-ID: Subject: Re: svn commit: r307626 - head/sys/ufs/ffs To: Warner Losh Cc: Konstantin Belousov , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "freebsd-mips@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: Sun, 13 Nov 2016 07:15:53 -0000 On 12 November 2016 at 23:12, Warner Losh wrote: > On Sat, Nov 12, 2016 at 11:58 PM, Konstantin Belousov > wrote: >> On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote: >>> hi! >>> >>> This broke freebsd on mips24k. >>> >>> BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read >>> fault (type 0x2) at 0 >>> Trapframe Register Dump: >>> zero: 0 at: 0 v0: 0 v1: 0 >>> a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 >>> t0: 0 t1: 0 t2: 0 t3: 0 >>> t4: 0 t5: 0 t6: 0 t7: 0 >>> t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 >>> s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 >>> s6: 0 s7: 0 k0: 0 k1: 0 >>> gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 >>> sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 >>> cause: 0x8 pc: 0x4002a4 >>> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda >>> Dumping 4 words starting at pc address 0x4002a4: >>> 8c420000 14400003 00908021 8f828024 >>> Page table info for bad address 0: pde = 0, pte = 0 >> MIPS24k has split I/D caches, and both are VIPT, am I right ? >> I was not able to find the handling of cache aliasing in mips/pmap.c. >> >> Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf >> to 1 change anything. > > MIPS caches are such that creating two virtual mappings to the same > physical page will cause corruption. It's simply not allowed, at least > for the class of MIPS machines I used to bring up the port originally. Hi, Right - the bulk of MIPS hardware (including 24k/74k) are VIPT, and we're not allowed to do cache aliasing in that manner. -adrian From owner-svn-src-head@freebsd.org Sun Nov 13 07:16:10 2016 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 7A2FEC3F9A3; Sun, 13 Nov 2016 07:16:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::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 E9D8985D; Sun, 13 Nov 2016 07:16:09 +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 uAD7G58o085733 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 13 Nov 2016 09:16:05 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua uAD7G58o085733 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id uAD7G5jN085731; Sun, 13 Nov 2016 09:16:05 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 13 Nov 2016 09:16:05 +0200 From: Konstantin Belousov To: Adrian Chadd Cc: "freebsd-mips@freebsd.org" , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r307626 - head/sys/ufs/ffs Message-ID: <20161113071605.GE54029@kib.kiev.ua> References: <201610191109.u9JB9TTC002727@repo.freebsd.org> <20161113065851.GD54029@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) 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: Sun, 13 Nov 2016 07:16:10 -0000 On Sat, Nov 12, 2016 at 11:10:43PM -0800, Adrian Chadd wrote: > That disappeared from the file in a later commit? >From which commit did it disappeared ? The tunable is present since sys/kern/vfs_bio.c r308026. I did not removed it, and did not see any commit removing the code by somebody else. > > > > -a > > > On 12 November 2016 at 22:58, Konstantin Belousov wrote: > > On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote: > >> hi! > >> > >> This broke freebsd on mips24k. > >> > >> BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read > >> fault (type 0x2) at 0 > >> Trapframe Register Dump: > >> zero: 0 at: 0 v0: 0 v1: 0 > >> a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 > >> t0: 0 t1: 0 t2: 0 t3: 0 > >> t4: 0 t5: 0 t6: 0 t7: 0 > >> t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 > >> s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 > >> s6: 0 s7: 0 k0: 0 k1: 0 > >> gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 > >> sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 > >> cause: 0x8 pc: 0x4002a4 > >> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda > >> Dumping 4 words starting at pc address 0x4002a4: > >> 8c420000 14400003 00908021 8f828024 > >> Page table info for bad address 0: pde = 0, pte = 0 > > MIPS24k has split I/D caches, and both are VIPT, am I right ? > > I was not able to find the handling of cache aliasing in mips/pmap.c. > > > > Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf > > to 1 change anything. > > > >> > >> .. and yes, I've spent three days bisecting everything to get to this > >> particular commit. From owner-svn-src-head@freebsd.org Sun Nov 13 07:16:55 2016 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 08D08C3FA41; Sun, 13 Nov 2016 07:16:55 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::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 C58BCA2A; Sun, 13 Nov 2016 07:16:54 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x22d.google.com with SMTP id q124so46129614itd.1; Sat, 12 Nov 2016 23:16:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=TPq8IXaoDJM+iHbykObJzBAnYWwTj7qvjk1erWUBpzk=; b=FJApDe3GPV3fjZ2Kb01ILf0N9BP8ljv7WijHVNrQJrYX3ftn7fOh+t/CSetNrnFawf TrifCyn2BRdRhPgplP0uHWK2T0FBDvGCqRKfpJbRbwdOomgXMvdpmWzJNsqaLxMwJW4A Xm7Cb8IlwB7bvOpXF+pxU+PKZLcqzibAaBAvUkfb4Maw77wNNa76kbKTtp5z4P6KvaDJ XDrOpdT8/2JM7blAQXBG60u9d9imLFxfBgynj5DyJ/KUELA2z1Xj6VLdNNeSsjkV35Kn qAfbDlyrOe5A1vcHE0nOKhIZhh51JtAAiAOa9beAYldmevCvhJ5nSys5jmCg3fakf+2q fNHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=TPq8IXaoDJM+iHbykObJzBAnYWwTj7qvjk1erWUBpzk=; b=gRTRBvKd6wTgnN6/isthTBBMtf4+czRSFZTMF0JZ2XvYREZeliCOa20YOO72lOEnyO 5WAitVAejAkhM00NQbYLG0dQDG8o5Q9nJBThnpbHQ4b+TTWkGjPONUfQ3Bz78FcnL5yM BrbqIjJkubl9XPti85juUfYgAnZDav1Wo2ke6ItwnP5MA999n31eHp8SZX3mwhIlhcg4 /1xyiTxVDErPvetgC3dDSFnmx93kI6qHoL7QjslBwquCofOiKGpiW9X29GTmQYi18hwK ByWVdX0s0R/O9Okfz8QuGSl/ytxNc2h6IHAwXim+Ye3ds/yHNaSg0PWWp46LotrwqkLc UkYg== X-Gm-Message-State: ABUngveiFxCtPS7rpgoJALYN3gBF4zdVVOy+fLaWJRi3tVb8Uz7RjmAnNvKUqfs5DSHZnLQEWQ2pYZ0cMdwrzQ== X-Received: by 10.107.136.86 with SMTP id k83mr18258314iod.99.1479021414266; Sat, 12 Nov 2016 23:16:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Sat, 12 Nov 2016 23:16:53 -0800 (PST) In-Reply-To: <20161113071605.GE54029@kib.kiev.ua> References: <201610191109.u9JB9TTC002727@repo.freebsd.org> <20161113065851.GD54029@kib.kiev.ua> <20161113071605.GE54029@kib.kiev.ua> From: Adrian Chadd Date: Sat, 12 Nov 2016 23:16:53 -0800 Message-ID: Subject: Re: svn commit: r307626 - head/sys/ufs/ffs To: Konstantin Belousov Cc: "freebsd-mips@freebsd.org" , "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: Sun, 13 Nov 2016 07:16:55 -0000 On 12 November 2016 at 23:16, Konstantin Belousov wrote: > On Sat, Nov 12, 2016 at 11:10:43PM -0800, Adrian Chadd wrote: >> That disappeared from the file in a later commit? > From which commit did it disappeared ? > > The tunable is present since sys/kern/vfs_bio.c r308026. I did not removed > it, and did not see any commit removing the code by somebody else. I'll go look tomorrow. I could've sworn I only saw one sysctl in there in -head when i did my last bisect (up to head.) If it's there I'll go try it out. -adrian > >> >> >> >> -a >> >> >> On 12 November 2016 at 22:58, Konstantin Belousov wrote: >> > On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote: >> >> hi! >> >> >> >> This broke freebsd on mips24k. >> >> >> >> BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read >> >> fault (type 0x2) at 0 >> >> Trapframe Register Dump: >> >> zero: 0 at: 0 v0: 0 v1: 0 >> >> a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 >> >> t0: 0 t1: 0 t2: 0 t3: 0 >> >> t4: 0 t5: 0 t6: 0 t7: 0 >> >> t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 >> >> s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 >> >> s6: 0 s7: 0 k0: 0 k1: 0 >> >> gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 >> >> sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 >> >> cause: 0x8 pc: 0x4002a4 >> >> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda >> >> Dumping 4 words starting at pc address 0x4002a4: >> >> 8c420000 14400003 00908021 8f828024 >> >> Page table info for bad address 0: pde = 0, pte = 0 >> > MIPS24k has split I/D caches, and both are VIPT, am I right ? >> > I was not able to find the handling of cache aliasing in mips/pmap.c. >> > >> > Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf >> > to 1 change anything. >> > >> >> >> >> .. and yes, I've spent three days bisecting everything to get to this >> >> particular commit. From owner-svn-src-head@freebsd.org Sun Nov 13 07:19:17 2016 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 B1C49C3FB15; Sun, 13 Nov 2016 07:19:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::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 5918BC0F; Sun, 13 Nov 2016 07:19:17 +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 uAD7JB1Z086203 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 13 Nov 2016 09:19:12 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua uAD7JB1Z086203 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id uAD7JBtl086202; Sun, 13 Nov 2016 09:19:11 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 13 Nov 2016 09:19:11 +0200 From: Konstantin Belousov To: Warner Losh Cc: Adrian Chadd , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "freebsd-mips@freebsd.org" Subject: Re: svn commit: r307626 - head/sys/ufs/ffs Message-ID: <20161113071911.GF54029@kib.kiev.ua> References: <201610191109.u9JB9TTC002727@repo.freebsd.org> <20161113065851.GD54029@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) 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: Sun, 13 Nov 2016 07:19:17 -0000 On Sun, Nov 13, 2016 at 12:12:02AM -0700, Warner Losh wrote: > On Sat, Nov 12, 2016 at 11:58 PM, Konstantin Belousov > wrote: > > On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote: > >> hi! > >> > >> This broke freebsd on mips24k. > >> > >> BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read > >> fault (type 0x2) at 0 > >> Trapframe Register Dump: > >> zero: 0 at: 0 v0: 0 v1: 0 > >> a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 > >> t0: 0 t1: 0 t2: 0 t3: 0 > >> t4: 0 t5: 0 t6: 0 t7: 0 > >> t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 > >> s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 > >> s6: 0 s7: 0 k0: 0 k1: 0 > >> gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 > >> sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 > >> cause: 0x8 pc: 0x4002a4 > >> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda > >> Dumping 4 words starting at pc address 0x4002a4: > >> 8c420000 14400003 00908021 8f828024 > >> Page table info for bad address 0: pde = 0, pte = 0 > > MIPS24k has split I/D caches, and both are VIPT, am I right ? > > I was not able to find the handling of cache aliasing in mips/pmap.c. > > > > Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf > > to 1 change anything. > > MIPS caches are such that creating two virtual mappings to the same > physical page will cause corruption. It's simply not allowed, at least > for the class of MIPS machines I used to bring up the port originally. Yes, caches are VIPT on 24k, according to the "MIPS32(R) 24K(R) Processor Core Family Software User's Manual " rev 3.11. My question is, how is that handled in the mips pmap.c. I was not able to locate the alias detection and prevention code, or e.g. switching to uncached mode for the page when aliasing is detected, after browsing pmap. Does FreeBSD/mips run with the caches enabled ? From owner-svn-src-head@freebsd.org Sun Nov 13 07:33:58 2016 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 ED88BC3FEA7 for ; Sun, 13 Nov 2016 07:33:58 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::22b]) (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 B39E81376 for ; Sun, 13 Nov 2016 07:33:58 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22b.google.com with SMTP id q124so46400484itd.1 for ; Sat, 12 Nov 2016 23:33:58 -0800 (PST) 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=P60tCRo7+0t2WYjzM+DMkCnS6F78O/xVgBJ3ROX7boI=; b=KM+V34Z44+qH20/uOTUSmzeW5P0x6N1nb2WsyNG8e5jTbqLvNb+pTjOcRqONDbh743 MayOPYAtxZjoSCF5Eji+Yz5WzVcTflOfQjrYKaPTjJm/dL3eoFM49jqh5N6QN1OPygzM fGX3cClaSilEPqZ2rMY0THi2Bxy6kRKYO12Bsxz4kbH2LWWjLLRWTq0Z1BkegMbHHhuB hsmfeUjfDzOgMqN9YPkU5NyulFNQnNSYGqW5jrs786BxCozu6niVmDlrFSNoh8LrnP8C 6VW9+seLUB1gFT4bP6odYpARejKexv+Jd4mjo9lOndLC8V5ZmUM9MqTndVI/P/rA1Py0 c64g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=P60tCRo7+0t2WYjzM+DMkCnS6F78O/xVgBJ3ROX7boI=; b=VFD+GW3jWS/bHWRToXIRvbTnPyuYzE1qqxVDJXAceSvTdYdU5mvg4ucTQPO3xmJ02d FsIO3gu9/T+rVftofw6bL+6yz/rJPjD5dhPREcdVHH/xFqTaAe6uroo8jKaUDMBmMahy fOVH2P67ATsaYfpDBT/M+aZGoJ1/hkDPbvpo5vBXF6W/2vDAS2x0K9aw8jsHSp8yFFKy VPPlBPKd5TCikpBbKrvRkFwYWPNpLM2t1CowY24QC0d+lKdEWJLg//IH9ApGi3L0P+Lp M14URc5aqivRbVFYD02aLqMPfqwsNoBr7cxQlvF92C4k5Xgw9P5j9QGIh8wuu3b7Hr8Z M3Rg== X-Gm-Message-State: ABUngveJc8X/+xEDpjEp+A4AODTLFz6sbD5W9DV1YmLx8zFINJ51m06H+zud3mw+gEHrJWdU5vuyscXr0G7+OA== X-Received: by 10.107.132.74 with SMTP id g71mr18900252iod.19.1479022438017; Sat, 12 Nov 2016 23:33:58 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.134.66 with HTTP; Sat, 12 Nov 2016 23:33:57 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <20161113071911.GF54029@kib.kiev.ua> References: <201610191109.u9JB9TTC002727@repo.freebsd.org> <20161113065851.GD54029@kib.kiev.ua> <20161113071911.GF54029@kib.kiev.ua> From: Warner Losh Date: Sun, 13 Nov 2016 00:33:57 -0700 X-Google-Sender-Auth: QbSIAsv0K34Qsd0xXm2Kd4Wj640 Message-ID: Subject: Re: svn commit: r307626 - head/sys/ufs/ffs To: Konstantin Belousov Cc: Adrian Chadd , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "freebsd-mips@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: Sun, 13 Nov 2016 07:33:59 -0000 On Sun, Nov 13, 2016 at 12:19 AM, Konstantin Belousov wrote: > On Sun, Nov 13, 2016 at 12:12:02AM -0700, Warner Losh wrote: >> On Sat, Nov 12, 2016 at 11:58 PM, Konstantin Belousov >> wrote: >> > On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote: >> >> hi! >> >> >> >> This broke freebsd on mips24k. >> >> >> >> BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read >> >> fault (type 0x2) at 0 >> >> Trapframe Register Dump: >> >> zero: 0 at: 0 v0: 0 v1: 0 >> >> a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 >> >> t0: 0 t1: 0 t2: 0 t3: 0 >> >> t4: 0 t5: 0 t6: 0 t7: 0 >> >> t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 >> >> s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 >> >> s6: 0 s7: 0 k0: 0 k1: 0 >> >> gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 >> >> sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 >> >> cause: 0x8 pc: 0x4002a4 >> >> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda >> >> Dumping 4 words starting at pc address 0x4002a4: >> >> 8c420000 14400003 00908021 8f828024 >> >> Page table info for bad address 0: pde = 0, pte = 0 >> > MIPS24k has split I/D caches, and both are VIPT, am I right ? >> > I was not able to find the handling of cache aliasing in mips/pmap.c. >> > >> > Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf >> > to 1 change anything. >> >> MIPS caches are such that creating two virtual mappings to the same >> physical page will cause corruption. It's simply not allowed, at least >> for the class of MIPS machines I used to bring up the port originally. > > Yes, caches are VIPT on 24k, according to the "MIPS32(R) 24K(R) > Processor Core Family Software User's Manual " rev 3.11. My question is, > how is that handled in the mips pmap.c. I was not able to locate > the alias detection and prevention code, or e.g. switching to uncached mode > for the page when aliasing is detected, after browsing pmap. Aliases are not permitted. IIRC, there's no code that detects this condition. One must simply never ever have multiple cached mappings of a page at once. A quick glance at the code doesn't locate anything. > Does FreeBSD/mips run with the caches enabled ? Yes. The implementation is easier w/o caches enabled, but the performance sucks too bad to even contemplate it except for debugging. Warner From owner-svn-src-head@freebsd.org Sun Nov 13 07:42:08 2016 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 96139C3F0D9; Sun, 13 Nov 2016 07:42:08 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 29E8816DD; Sun, 13 Nov 2016 07:42:08 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-wm0-x244.google.com with SMTP id u144so6895606wmu.0; Sat, 12 Nov 2016 23:42:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=kSaZacgfmcZDuurI3elFkFGX6otoD+XpJTYu0uU2F6k=; b=o/5C7ALrcFyYpJbicetuwlel5UJw10jcdJrKXxTdjv3/NbwOpn+fhDx4uBvedpIhQJ bfck53EVFJLPdLJdc4QxHjuhqNrurprZi/EcHzlWSxlRli3Ex2gyKOC9vma8rBlFI52O WC6z6Ge7JdE51s02VH+ugJVVuRmLV8ksXUJvVT+2zlbb6pFJd+QbQ9KFERKKRnsEQkch fWPo0mlFY3bCpy6se9lag/HI4Lt2bm0o1tii5Qdzn52r/p6U1hmu8yhPlQzg24WFSVct 1WDLGCS+VJQ80I8eTQPxew2hgn5bJsCt45n8Cg8MknEbuv9VsF40R1+F4C7zUaEA4Okj SCGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=kSaZacgfmcZDuurI3elFkFGX6otoD+XpJTYu0uU2F6k=; b=Vi5VLxXU9vykjA1zbzsAp5XVXvNDnqmCtxQascKv9YvYPcXgyHNNJhncG5Org2fJz8 UR8MP8cHdD3Nqen2LbNzZUTuZp6uX1BCuszLpzhIUlZJwMhIKttGffnYdOYofbczB1aF /owe3rzPtbd5rjHSp+3IUsBoZ1bxCjS2od8AzZikag0RKKNv3a7sCpawf+uLckd2fwAA +CDXkOeRC862lhEveqYa9xYpChI5J5HdttaX6sXNrhkzO489VVjJgtcSaOLfZsLt/APc Y8jXGXHbnF+NoDGQsghKMPe2WiNwP4zMcLdXugm9TiX/pGxKYj2gS9J4xIQsSpnXOGgU yHSg== X-Gm-Message-State: ABUngvdFAGYUukiFGrPftWWOzSrXlrAAarbGPI0WAEqDJKhWCMsjT6a223shNFWOiTwG3Q== X-Received: by 10.28.43.198 with SMTP id r189mr4707968wmr.67.1479022926503; Sat, 12 Nov 2016 23:42:06 -0800 (PST) Received: from ernst.home (p578E2891.dip0.t-ipconnect.de. [87.142.40.145]) by smtp.gmail.com with ESMTPSA id g17sm21111891wjs.38.2016.11.12.23.42.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 12 Nov 2016 23:42:06 -0800 (PST) Date: Sun, 13 Nov 2016 08:42:03 +0100 From: Gary Jennejohn To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308565 - head/sys/kern Message-ID: <20161113084203.60ff80f4@ernst.home> In-Reply-To: <9d2a931d-cd92-4a82-0c47-a6737d6c6104@FreeBSD.org> References: <201611120023.uAC0N9fe018532@repo.freebsd.org> <20161112102833.5cc951b8@ernst.home> <9d2a931d-cd92-4a82-0c47-a6737d6c6104@FreeBSD.org> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; 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: Sun, 13 Nov 2016 07:42:08 -0000 On Sat, 12 Nov 2016 08:40:28 -0800 John Baldwin wrote: > On 11/12/16 1:28 AM, Gary Jennejohn wrote: > > On Sat, 12 Nov 2016 00:23:09 +0000 (UTC) > > John Baldwin wrote: > > > >> Author: jhb > >> Date: Sat Nov 12 00:23:09 2016 > >> New Revision: 308565 > >> URL: https://svnweb.freebsd.org/changeset/base/308565 > >> > >> Log: > >> Allow scheduling during early boot. > >> > >> - Send IPI wakeups once SMP is started even if cold is true. > >> - Permit preemptions when cold is true. > >> > >> These changes are needed for EARLY_AP_STARTUP. > >> > >> MFC after: 2 weeks > >> Sponsored by: Netflix > >> > >> Modified: > >> head/sys/kern/sched_4bsd.c > >> > > > > Thank you, jhb! > > I believe the previous change fixed the original issue you > reported as I was finally able to reproduce a similar hang > with sched_bind when igb0 was pinning its interrupts. It was > quite a bit of a PITA to track down. :( If you get a chance, > can you please verify that 4BSD + EARLY_AP_STARTUP now works for > you? > I'm now happily running this combination of options. -- Gary Jennejohn From owner-svn-src-head@freebsd.org Sun Nov 13 07:56:03 2016 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 BEA27C3F344; Sun, 13 Nov 2016 07:56:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::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 4BBE11D4E; Sun, 13 Nov 2016 07:56:03 +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 uAD7tvoN095317 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 13 Nov 2016 09:55:57 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua uAD7tvoN095317 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id uAD7tvgg095316; Sun, 13 Nov 2016 09:55:57 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 13 Nov 2016 09:55:57 +0200 From: Konstantin Belousov To: Warner Losh Cc: Adrian Chadd , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "freebsd-mips@freebsd.org" Subject: Re: svn commit: r307626 - head/sys/ufs/ffs Message-ID: <20161113075557.GH54029@kib.kiev.ua> References: <201610191109.u9JB9TTC002727@repo.freebsd.org> <20161113065851.GD54029@kib.kiev.ua> <20161113071911.GF54029@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) 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: Sun, 13 Nov 2016 07:56:03 -0000 On Sun, Nov 13, 2016 at 12:33:57AM -0700, Warner Losh wrote: > On Sun, Nov 13, 2016 at 12:19 AM, Konstantin Belousov > wrote: > > On Sun, Nov 13, 2016 at 12:12:02AM -0700, Warner Losh wrote: > >> On Sat, Nov 12, 2016 at 11:58 PM, Konstantin Belousov > >> wrote: > >> > On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote: > >> >> hi! > >> >> > >> >> This broke freebsd on mips24k. > >> >> > >> >> BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read > >> >> fault (type 0x2) at 0 > >> >> Trapframe Register Dump: > >> >> zero: 0 at: 0 v0: 0 v1: 0 > >> >> a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 > >> >> t0: 0 t1: 0 t2: 0 t3: 0 > >> >> t4: 0 t5: 0 t6: 0 t7: 0 > >> >> t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 > >> >> s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 > >> >> s6: 0 s7: 0 k0: 0 k1: 0 > >> >> gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 > >> >> sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 > >> >> cause: 0x8 pc: 0x4002a4 > >> >> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda > >> >> Dumping 4 words starting at pc address 0x4002a4: > >> >> 8c420000 14400003 00908021 8f828024 > >> >> Page table info for bad address 0: pde = 0, pte = 0 > >> > MIPS24k has split I/D caches, and both are VIPT, am I right ? > >> > I was not able to find the handling of cache aliasing in mips/pmap.c. > >> > > >> > Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf > >> > to 1 change anything. > >> > >> MIPS caches are such that creating two virtual mappings to the same > >> physical page will cause corruption. It's simply not allowed, at least > >> for the class of MIPS machines I used to bring up the port originally. > > > > Yes, caches are VIPT on 24k, according to the "MIPS32(R) 24K(R) > > Processor Core Family Software User's Manual " rev 3.11. My question is, > > how is that handled in the mips pmap.c. I was not able to locate > > the alias detection and prevention code, or e.g. switching to uncached mode > > for the page when aliasing is detected, after browsing pmap. > > Aliases are not permitted. IIRC, there's no code that detects this > condition. One must simply never ever have multiple cached mappings of > a page at once. A quick glance at the code doesn't locate anything. Then, the obvious next question is what does prevent such aliased mappings ? Not only usermode might establish such situation by double-mapping, but also e.g. our coherent buffer/page cache maps page into KVA and the same page might be mapped into usermode. The later situation is my current thought about possible cause of the reported init(8) fault. > > > Does FreeBSD/mips run with the caches enabled ? > > Yes. The implementation is easier w/o caches enabled, but the > performance sucks too bad to even contemplate it except for debugging. > > Warner From owner-svn-src-head@freebsd.org Sun Nov 13 08:42:04 2016 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 1E4FBC3EA62; Sun, 13 Nov 2016 08:42:04 +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 D84941C2E; Sun, 13 Nov 2016 08:42:03 +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 uAD8g33c097470; Sun, 13 Nov 2016 08:42:03 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD8g3LD097469; Sun, 13 Nov 2016 08:42:03 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611130842.uAD8g3LD097469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 13 Nov 2016 08:42:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308609 - head/sys/conf X-SVN-Group: head 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, 13 Nov 2016 08:42:04 -0000 Author: andrew Date: Sun Nov 13 08:42:02 2016 New Revision: 308609 URL: https://svnweb.freebsd.org/changeset/base/308609 Log: Remove bcm2835_common.c from files.arm64, it no longer exists. Sponsored by: ABT Systems Ltd Modified: head/sys/conf/files.arm64 Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sun Nov 13 03:56:26 2016 (r308608) +++ head/sys/conf/files.arm64 Sun Nov 13 08:42:02 2016 (r308609) @@ -52,7 +52,6 @@ arm/arm/pmu.c standard arm/broadcom/bcm2835/bcm2835_audio.c optional sound vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc soc_brcm_bcm2837 -arm/broadcom/bcm2835/bcm2835_common.c optional fdt soc_brcm_bcm2837 arm/broadcom/bcm2835/bcm2835_cpufreq.c optional soc_brcm_bcm2837 arm/broadcom/bcm2835/bcm2835_dma.c optional soc_brcm_bcm2837 arm/broadcom/bcm2835/bcm2835_fbd.c optional vt soc_brcm_bcm2837 From owner-svn-src-head@freebsd.org Sun Nov 13 09:33:42 2016 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 8648DC3B812; Sun, 13 Nov 2016 09:33:42 +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 556D82F1; Sun, 13 Nov 2016 09:33:42 +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 uAD9XfH5017788; Sun, 13 Nov 2016 09:33:41 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD9Xfuo017787; Sun, 13 Nov 2016 09:33:41 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611130933.uAD9Xfuo017787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 13 Nov 2016 09:33:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308610 - head/sys/mips/mediatek X-SVN-Group: head 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, 13 Nov 2016 09:33:42 -0000 Author: andrew Date: Sun Nov 13 09:33:41 2016 New Revision: 308610 URL: https://svnweb.freebsd.org/changeset/base/308610 Log: Use the new ofw_bus_node_is_compatible function in the mips code. Sponsored by: ABT Systems Ltd Modified: head/sys/mips/mediatek/mtk_soc.c Modified: head/sys/mips/mediatek/mtk_soc.c ============================================================================== --- head/sys/mips/mediatek/mtk_soc.c Sun Nov 13 08:42:02 2016 (r308609) +++ head/sys/mips/mediatek/mtk_soc.c Sun Nov 13 09:33:41 2016 (r308610) @@ -248,7 +248,7 @@ mtk_soc_try_early_detect(void) return; for (i = 0; compat_data[i].ocd_str != NULL; i++) { - if (fdt_is_compatible(node, compat_data[i].ocd_str)) { + if (ofw_bus_node_is_compatible(node, compat_data[i].ocd_str)) { mtk_soc_socid = compat_data[i].ocd_data; break; } From owner-svn-src-head@freebsd.org Sun Nov 13 12:06:27 2016 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 28BF7C3F851; Sun, 13 Nov 2016 12:06:27 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE723106C; Sun, 13 Nov 2016 12:06:26 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uADC6QKI080436; Sun, 13 Nov 2016 12:06:26 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uADC6Q5V080435; Sun, 13 Nov 2016 12:06:26 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201611131206.uADC6Q5V080435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 13 Nov 2016 12:06:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308611 - head/sys/fs/autofs X-SVN-Group: head 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, 13 Nov 2016 12:06:27 -0000 Author: trasz Date: Sun Nov 13 12:06:25 2016 New Revision: 308611 URL: https://svnweb.freebsd.org/changeset/base/308611 Log: Remove spurious space. MFC after: 1 month Modified: head/sys/fs/autofs/autofs.c Modified: head/sys/fs/autofs/autofs.c ============================================================================== --- head/sys/fs/autofs/autofs.c Sun Nov 13 09:33:41 2016 (r308610) +++ head/sys/fs/autofs/autofs.c Sun Nov 13 12:06:25 2016 (r308611) @@ -61,7 +61,7 @@ */ #include - __FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD$"); #include #include From owner-svn-src-head@freebsd.org Sun Nov 13 13:31:25 2016 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 3A8F4C3F2A3; Sun, 13 Nov 2016 13:31:25 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF0DC1AF4; Sun, 13 Nov 2016 13:31:24 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uADDVOxC015224; Sun, 13 Nov 2016 13:31:24 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uADDVNiF015219; Sun, 13 Nov 2016 13:31:23 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201611131331.uADDVNiF015219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 13 Nov 2016 13:31:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308612 - in head/sys/dev/drm2: . ttm X-SVN-Group: head 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, 13 Nov 2016 13:31:25 -0000 Author: mmel Date: Sun Nov 13 13:31:23 2016 New Revision: 308612 URL: https://svnweb.freebsd.org/changeset/base/308612 Log: Allow DRM2 code to be built on platforms without AGP. This patch is taken from original drm-3.8 code. Differential Revision: https://reviews.freebsd.org/D8454 MFC after: 3 weeks Modified: head/sys/dev/drm2/drmP.h head/sys/dev/drm2/drm_memory.c head/sys/dev/drm2/drm_os_freebsd.c head/sys/dev/drm2/drm_os_freebsd.h head/sys/dev/drm2/ttm/ttm_bo_util.c Modified: head/sys/dev/drm2/drmP.h ============================================================================== --- head/sys/dev/drm2/drmP.h Sun Nov 13 12:06:25 2016 (r308611) +++ head/sys/dev/drm2/drmP.h Sun Nov 13 13:31:23 2016 (r308612) @@ -1204,17 +1204,6 @@ int drm_mmap_single(struct cdev *kdev, v vm_size_t size, struct vm_object **obj_res, int nprot); d_poll_t drm_poll; - /* Memory management support (drm_memory.h) */ -extern void drm_free_agp(DRM_AGP_MEM * handle, int pages); -extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); -#ifdef FREEBSD_NOTYET -extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, - struct page **pages, - unsigned long num_pages, - uint32_t gtt_offset, - uint32_t type); -#endif /* FREEBSD_NOTYET */ -extern int drm_unbind_agp(DRM_AGP_MEM * handle); /* Misc. IOCTL support (drm_ioctl.h) */ extern int drm_irq_by_busid(struct drm_device *dev, void *data, @@ -1363,32 +1352,6 @@ extern void drm_vblank_post_modeset(stru extern int drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv); - /* AGP/GART support (drm_agpsupport.h) */ -extern struct drm_agp_head *drm_agp_init(struct drm_device *dev); -extern int drm_agp_acquire(struct drm_device *dev); -extern int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); -extern int drm_agp_release(struct drm_device *dev); -extern int drm_agp_release_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); -extern int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode); -extern int drm_agp_enable_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); -extern int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info); -extern int drm_agp_info_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); -extern int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request); -extern int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); -extern int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request); -extern int drm_agp_free_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); -extern int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request); -extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); -extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); -extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); /* Stub support (drm_stub.h) */ extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, @@ -1814,5 +1777,175 @@ int ttm_bo_mmap_single(struct ttm_bo_dev struct ttm_buffer_object; void ttm_bo_release_mmap(struct ttm_buffer_object *bo); +#if __OS_HAS_AGP + /* Memory management support (drm_memory.h) */ +extern void drm_free_agp(DRM_AGP_MEM * handle, int pages); +extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); +#ifdef FREEBSD_NOTYET +extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, + struct page **pages, + unsigned long num_pages, + uint32_t gtt_offset, + uint32_t type); +#endif /* FREEBSD_NOTYET */ +extern int drm_unbind_agp(DRM_AGP_MEM * handle); + + /* AGP/GART support (drm_agpsupport.h) */ +extern struct drm_agp_head *drm_agp_init(struct drm_device *dev); +extern int drm_agp_acquire(struct drm_device *dev); +extern int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); +extern int drm_agp_release(struct drm_device *dev); +extern int drm_agp_release_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); +extern int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode); +extern int drm_agp_enable_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); +extern int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info); +extern int drm_agp_info_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); +extern int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request); +extern int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); +extern int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request); +extern int drm_agp_free_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); +extern int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request); +extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); +extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); +extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); + +#else + +static inline void drm_free_agp(DRM_AGP_MEM * handle, int pages) +{ +} + +static inline int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start) +{ + return -ENODEV; +} + +static inline int drm_unbind_agp(DRM_AGP_MEM * handle) +{ + return -ENODEV; +} +#ifdef FREEBSD_NOTYET +static inline struct agp_memory *drm_agp_bind_pages(struct drm_device *dev, + struct page **pages, + unsigned long num_pages, + uint32_t gtt_offset, + uint32_t type) +{ + return NULL; +} +#endif +static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev) +{ + return NULL; +} + +static inline void drm_agp_clear(struct drm_device *dev) +{ +} + +static inline int drm_agp_acquire(struct drm_device *dev) +{ + return -ENODEV; +} + +static inline int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + return -ENODEV; +} + +static inline int drm_agp_release(struct drm_device *dev) +{ + return -ENODEV; +} + +static inline int drm_agp_release_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + return -ENODEV; +} + +static inline int drm_agp_enable(struct drm_device *dev, + struct drm_agp_mode mode) +{ + return -ENODEV; +} + +static inline int drm_agp_enable_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + return -ENODEV; +} + +static inline int drm_agp_info(struct drm_device *dev, + struct drm_agp_info *info) +{ + return -ENODEV; +} + +static inline int drm_agp_info_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + return -ENODEV; +} + +static inline int drm_agp_alloc(struct drm_device *dev, + struct drm_agp_buffer *request) +{ + return -ENODEV; +} + +static inline int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + return -ENODEV; +} + +static inline int drm_agp_free(struct drm_device *dev, + struct drm_agp_buffer *request) +{ + return -ENODEV; +} + +static inline int drm_agp_free_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + return -ENODEV; +} + +static inline int drm_agp_unbind(struct drm_device *dev, + struct drm_agp_binding *request) +{ + return -ENODEV; +} + +static inline int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + return -ENODEV; +} + +static inline int drm_agp_bind(struct drm_device *dev, + struct drm_agp_binding *request) +{ + return -ENODEV; +} + +static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + return -ENODEV; +} + +#endif /* __OS_HAS_AGP */ + #endif /* __KERNEL__ */ #endif Modified: head/sys/dev/drm2/drm_memory.c ============================================================================== --- head/sys/dev/drm2/drm_memory.c Sun Nov 13 12:06:25 2016 (r308611) +++ head/sys/dev/drm2/drm_memory.c Sun Nov 13 13:31:23 2016 (r308612) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include +#define vunmap(handle) + #if __OS_HAS_AGP static void *agp_remap(unsigned long offset, unsigned long size, struct drm_device * dev) @@ -50,8 +52,6 @@ static void *agp_remap(unsigned long off return NULL; } -#define vunmap(handle) - /** Wrapper around agp_free_memory() */ void drm_free_agp(DRM_AGP_MEM * handle, int pages) { Modified: head/sys/dev/drm2/drm_os_freebsd.c ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.c Sun Nov 13 12:06:25 2016 (r308611) +++ head/sys/dev/drm2/drm_os_freebsd.c Sun Nov 13 13:31:23 2016 (r308612) @@ -347,6 +347,7 @@ dmi_check_system(const struct dmi_system return (res); } +#if __OS_HAS_MTRR int drm_mtrr_add(unsigned long offset, unsigned long size, unsigned int flags) { @@ -375,6 +376,7 @@ drm_mtrr_del(int handle __unused, unsign strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner)); return (-mem_range_attr_set(&mrdesc, &act)); } +#endif void drm_clflush_pages(vm_page_t *pages, unsigned long num_pages) Modified: head/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.h Sun Nov 13 12:06:25 2016 (r308611) +++ head/sys/dev/drm2/drm_os_freebsd.h Sun Nov 13 13:31:23 2016 (r308612) @@ -592,8 +592,10 @@ typedef struct drm_pci_id_list #define CONFIG_COMPAT #endif +#ifndef __arm__ #define CONFIG_AGP 1 #define CONFIG_MTRR 1 +#endif #define CONFIG_FB 1 extern const char *fb_mode_option; Modified: head/sys/dev/drm2/ttm/ttm_bo_util.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_util.c Sun Nov 13 12:06:25 2016 (r308611) +++ head/sys/dev/drm2/ttm/ttm_bo_util.c Sun Nov 13 13:31:23 2016 (r308612) @@ -439,7 +439,8 @@ ttm_buffer_object_transfer(struct ttm_bu vm_memattr_t ttm_io_prot(uint32_t caching_flags) { -#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) +#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || \ + defined(__arm__) if (caching_flags & TTM_PL_FLAG_WC) return (VM_MEMATTR_WRITE_COMBINING); else From owner-svn-src-head@freebsd.org Sun Nov 13 16:31:25 2016 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 1A1C4C404B8; Sun, 13 Nov 2016 16:31:25 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9D3112F0; Sun, 13 Nov 2016 16:31:24 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uADGVNZL090071; Sun, 13 Nov 2016 16:31:23 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uADGVNaI090070; Sun, 13 Nov 2016 16:31:23 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201611131631.uADGVNaI090070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 13 Nov 2016 16:31:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308614 - head/sys/conf X-SVN-Group: head 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, 13 Nov 2016 16:31:25 -0000 Author: mmel Date: Sun Nov 13 16:31:23 2016 New Revision: 308614 URL: https://svnweb.freebsd.org/changeset/base/308614 Log: Allow embeding DRM2 code into kernel. It's usefull for development (for netboot) and it also helps to boot FreeBSD on some embeded platforms (where we must boot kernel directly, without standard boot loader). MFC after: 3 weeks Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Nov 13 16:20:06 2016 (r308613) +++ head/sys/conf/files Sun Nov 13 16:31:23 2016 (r308614) @@ -1466,6 +1466,49 @@ dev/drm/via_map.c optional viadrm dev/drm/via_mm.c optional viadrm dev/drm/via_verifier.c optional viadrm dev/drm/via_video.c optional viadrm +dev/drm2/drm_agpsupport.c optional drm2 +dev/drm2/drm_auth.c optional drm2 +dev/drm2/drm_bufs.c optional drm2 +dev/drm2/drm_buffer.c optional drm2 +dev/drm2/drm_context.c optional drm2 +dev/drm2/drm_crtc.c optional drm2 +dev/drm2/drm_crtc_helper.c optional drm2 +dev/drm2/drm_dma.c optional drm2 +dev/drm2/drm_dp_helper.c optional drm2 +dev/drm2/drm_dp_iic_helper.c optional drm2 +dev/drm2/drm_drv.c optional drm2 +dev/drm2/drm_edid.c optional drm2 +dev/drm2/drm_fb_helper.c optional drm2 +dev/drm2/drm_fops.c optional drm2 +dev/drm2/drm_gem.c optional drm2 +dev/drm2/drm_gem_names.c optional drm2 +dev/drm2/drm_global.c optional drm2 +dev/drm2/drm_hashtab.c optional drm2 +dev/drm2/drm_ioctl.c optional drm2 +dev/drm2/drm_irq.c optional drm2 +dev/drm2/drm_linux_list_sort.c optional drm2 +dev/drm2/drm_lock.c optional drm2 +dev/drm2/drm_memory.c optional drm2 +dev/drm2/drm_mm.c optional drm2 +dev/drm2/drm_modes.c optional drm2 +dev/drm2/drm_pci.c optional drm2 +dev/drm2/drm_scatter.c optional drm2 +dev/drm2/drm_stub.c optional drm2 +dev/drm2/drm_sysctl.c optional drm2 +dev/drm2/drm_vm.c optional drm2 +dev/drm2/drm_os_freebsd.c optional drm2 +dev/drm2/ttm/ttm_agp_backend.c optional drm2 +dev/drm2/ttm/ttm_lock.c optional drm2 +dev/drm2/ttm/ttm_object.c optional drm2 +dev/drm2/ttm/ttm_tt.c optional drm2 +dev/drm2/ttm/ttm_bo_util.c optional drm2 +dev/drm2/ttm/ttm_bo.c optional drm2 +dev/drm2/ttm/ttm_bo_manager.c optional drm2 +dev/drm2/ttm/ttm_execbuf_util.c optional drm2 +dev/drm2/ttm/ttm_memory.c optional drm2 +dev/drm2/ttm/ttm_page_alloc.c optional drm2 +dev/drm2/ttm/ttm_bo_vm.c optional drm2 +dev/drm2/ati_pcigart.c optional drm2 agp pci dev/ed/if_ed.c optional ed dev/ed/if_ed_novell.c optional ed dev/ed/if_ed_rtl80x9.c optional ed From owner-svn-src-head@freebsd.org Sun Nov 13 17:28:33 2016 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 5E730C40FC1; Sun, 13 Nov 2016 17:28:33 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 316101735; Sun, 13 Nov 2016 17:28:33 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uADHSW2t010185; Sun, 13 Nov 2016 17:28:32 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uADHSWml010183; Sun, 13 Nov 2016 17:28:32 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201611131728.uADHSWml010183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Sun, 13 Nov 2016 17:28:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308615 - head/share/examples/jails X-SVN-Group: head 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, 13 Nov 2016 17:28:33 -0000 Author: brd (doc,ports committer) Date: Sun Nov 13 17:28:32 2016 New Revision: 308615 URL: https://svnweb.freebsd.org/changeset/base/308615 Log: Attempt to make the parts that people are supposed to change stand out more by capitalizing them. Approved by: dteske Modified: head/share/examples/jails/rc.conf.jails head/share/examples/jails/rcjail.xxx.conf Modified: head/share/examples/jails/rc.conf.jails ============================================================================== --- head/share/examples/jails/rc.conf.jails Sun Nov 13 16:31:23 2016 (r308614) +++ head/share/examples/jails/rc.conf.jails Sun Nov 13 17:28:32 2016 (r308615) @@ -5,7 +5,7 @@ ############################################################################### jail_enable="YES" -jail_list="xxx" +jail_list="XXX" # # Global presets for all jails @@ -57,19 +57,19 @@ jail_devfs_enable="YES" # mount devfs # # XXX # -jail_xxx_hostname="xxx.yyy" # hostname -jail_xxx_rootdir="/vm/xxx" # root directory +jail_XXX_hostname="XXX.YYY" # hostname +jail_XXX_rootdir="/vm/XXX" # root directory # netgraph -jail_xxx_vnet_interface="ng0_xxx" # vnet interface(s) -jail_xxx_exec_prestart0="jng bridge xxx em0" # bridge interface(s) -jail_xxx_exec_poststop0="jng shutdown xxx" # destroy interface(s) +jail_XXX_vnet_interface="ng0_XXX" # vnet interface(s) +jail_XXX_exec_prestart0="jng bridge XXX em0" # bridge interface(s) +jail_XXX_exec_poststop0="jng shutdown XXX" # destroy interface(s) # if_bridge -#jail_xxx_vnet_interface="e0b_xxx" # vnet interface(s) -#jail_xxx_exec_prestart0="jib addm xxx em0" # bridge interface(s) -#jail_xxx_exec_poststop0="jib destroy xxx" # destroy interface(s) +#jail_XXX_vnet_interface="e0b_XXX" # vnet interface(s) +#jail_XXX_exec_prestart0="jib addm XXX em0" # bridge interface(s) +#jail_XXX_exec_poststop0="jib destroy XXX" # destroy interface(s) # Optional (default off) -#jail_xxx_devfs_ruleset="11" # rule to unhide bpf for DHCP -#jail_xxx_mount_enable="YES" # mount /etc/fstab.xxx +#jail_XXX_devfs_ruleset="11" # rule to unhide bpf for DHCP +#jail_XXX_mount_enable="YES" # mount /etc/fstab.XXX ################################################################################ # END Modified: head/share/examples/jails/rcjail.xxx.conf ============================================================================== --- head/share/examples/jails/rcjail.xxx.conf Sun Nov 13 16:31:23 2016 (r308614) +++ head/share/examples/jails/rcjail.xxx.conf Sun Nov 13 17:28:32 2016 (r308615) @@ -1,25 +1,25 @@ # $FreeBSD$ -jail_xxx_hostname="xxx.yyy" # hostname -jail_xxx_rootdir="/vm/xxx" # root directory +jail_XXX_hostname="XXX.YYY" # hostname +jail_XXX_rootdir="/vm/XXX" # root directory # # NB: Below 3 lines required # # netgraph -jail_xxx_vnet_interface="ng0_xxx" # vnet interface(s) -jail_xxx_exec_prestart0="jng bridge xxx em0" # bridge interface(s) -jail_xxx_exec_poststop0="jng shutdown xxx" # destroy interface(s) +jail_XXX_vnet_interface="ng0_XXX" # vnet interface(s) +jail_XXX_exec_prestart0="jng bridge XXX em0" # bridge interface(s) +jail_XXX_exec_poststop0="jng shutdown XXX" # destroy interface(s) # if_bridge -#jail_xxx_vnet_interface="e0b_xxx" # vnet interface(s) -#jail_xxx_exec_prestart0="jib addm xxx em0" # bridge interface(s) -#jail_xxx_exec_poststop0="jib destroy xxx" # destroy interface(s) +#jail_XXX_vnet_interface="e0b_XXX" # vnet interface(s) +#jail_XXX_exec_prestart0="jib addm XXX em0" # bridge interface(s) +#jail_XXX_exec_poststop0="jib destroy XXX" # destroy interface(s) # Standard recipe -jail_xxx_devfs_enable="YES" # mount devfs +jail_XXX_devfs_enable="YES" # mount devfs # Optional (default off) -#jail_xxx_devfs_ruleset="11" # rule to unhide bpf for DHCP -#jail_xxx_mount_enable="YES" # mount /etc/fstab.xxx -#jail_xxx_set_hostname_allow="YES" # Allow hostname to change -#jail_xxx_sysvipc_allow="YES" # Allow SysV Interprocess Comm. +#jail_XXX_devfs_ruleset="11" # rule to unhide bpf for DHCP +#jail_XXX_mount_enable="YES" # mount /etc/fstab.XXX +#jail_XXX_set_hostname_allow="YES" # Allow hostname to change +#jail_XXX_sysvipc_allow="YES" # Allow SysV Interprocess Comm. From owner-svn-src-head@freebsd.org Sun Nov 13 17:55:28 2016 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 C67DCC3F764; Sun, 13 Nov 2016 17:55:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9687E148F; Sun, 13 Nov 2016 17:55:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uADHtRCo022188; Sun, 13 Nov 2016 17:55:27 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uADHtRc4022187; Sun, 13 Nov 2016 17:55:27 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201611131755.uADHtRc4022187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 13 Nov 2016 17:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308616 - head/usr.sbin/bhyvectl X-SVN-Group: head 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, 13 Nov 2016 17:55:28 -0000 Author: tuexen Date: Sun Nov 13 17:55:27 2016 New Revision: 308616 URL: https://svnweb.freebsd.org/changeset/base/308616 Log: Fix typo. MFC after: 1 month Sponsored by: Netflix Modified: head/usr.sbin/bhyvectl/bhyvectl.8 Modified: head/usr.sbin/bhyvectl/bhyvectl.8 ============================================================================== --- head/usr.sbin/bhyvectl/bhyvectl.8 Sun Nov 13 17:28:32 2016 (r308615) +++ head/usr.sbin/bhyvectl/bhyvectl.8 Sun Nov 13 17:55:27 2016 (r308616) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2016 +.Dd November 13, 2016 .Dt BHYVECTL 8 .Os .Sh NAME @@ -64,7 +64,7 @@ Operate on the virtual machine Create the specified VM. .It Fl -destroy Destroy the specified VM. -.It Fl -get-state +.It Fl -get-stats Retrieve statistics for the specified VM. .It Fl -inject-nmi Inject a non-maskable interrupt (NMI) into the VM. From owner-svn-src-head@freebsd.org Sun Nov 13 21:06:02 2016 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 875CFC40EA7; Sun, 13 Nov 2016 21:06:02 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (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 364BD1DAE; Sun, 13 Nov 2016 21:06:01 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id 61yLctaEdKjjy61yMcylu5; Sun, 13 Nov 2016 14:05:55 -0700 X-Authority-Analysis: v=2.2 cv=SPoybKnH c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L24OOQBejmoA:10 a=XldT38RWNwACPDQzwzUA:9 a=BhoTE4oazmdckCm9QMcA:9 a=CjuIK1q_8ugA:10 a=xr5EFR828UCq0TXsHGoA:9 a=EdegKuqBs0Cm16o9:21 a=AAdyl_OY14z4h87p:21 a=hquHOILUSkIA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=ics_IjAVWSmO8OVX31YA:9 a=BOg4e644cxQA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id DFAF11951; Sun, 13 Nov 2016 13:05:52 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id uADL5qie048679; Sun, 13 Nov 2016 13:05:52 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201611132105.uADL5qie048679@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: Adrian Chadd cc: Cy Schubert , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r308493 - in head: contrib/amd contrib/amd/amd contrib/amd/amq contrib/amd/conf/checkmount contrib/amd/conf/mtab contrib/amd/conf/nfs_prot contrib/amd/conf/transp contrib/amd/conf/umoun... In-Reply-To: Message from Adrian Chadd of "Sat, 12 Nov 2016 17:27:15 -0800." Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="==_Exmh_1479071040_95650" Date: Sun, 13 Nov 2016 13:05:52 -0800 X-CMAE-Envelope: MS4wfDmMq0jBmImM+zs4qpEIfqGY5yoOHfD6HckSRXuM+hM1knyGs4zDKL/Z067RmwtYRWvKOk1OCIWeXBmCMu2/njt+M0BxriD6koKOyHaS7dhgOaeaYTR2 WKnevSoZhFNLvR45EZ1xQVBvyRQGmtbPKoYCmDbTpL6df7fC+UhibndLsvIZ9+wf3+0OZJ85dHI3fkDbGA650DJoim7vlF6Zj21qxzA3oX6GntreRDkoIe1L GsA5W3T7WaJi5TDfxcLRu+A7qaXuTu2kUl2ySM9cS/s7k7gt0ZFVGlUsMTt2e8iYNpGesaf6g7LR5BRersnGaQ== 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, 13 Nov 2016 21:06:02 -0000 This is a multipart MIME message. --==_Exmh_1479071040_95650 Content-Type: text/plain; charset=us-ascii In message , Adrian Chadd writes: > After looking at this, i'm not sure how this is supposed to work on a > 32 bit platform at all. > > Is there some vendor patch to fix compilation on 32 bit platforms? If > not, can we back this out until we get it compiling on 32 bit > platforms? Hi Adrian, Can you retry with the following attachment? You'll need to cd to src/contrib to apply it. It appears the upline's git commit to address 32 bit issues didn't go far enough. Strangely though, only mips failed to build. I'm sorry about this. --==_Exmh_1479071040_95650 Content-Type: text/plain ; name="amd.diff"; charset=us-ascii Content-Description: amd.diff Content-Disposition: attachment; filename="amd.diff" Index: amd/amd/readdir.c =================================================================== --- amd/amd/readdir.c (revision 308608) +++ amd/amd/readdir.c (working copy) @@ -38,6 +38,7 @@ */ +#include #ifdef HAVE_CONFIG_H # include #endif /* HAVE_CONFIG_H */ @@ -201,7 +202,7 @@ static int amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count, int fully_browsable) { - u_int gen = *(u_int *) cookie; + u_int gen = *(u_int *) (uintptr_t) cookie; int chain_length, i; static nfsentry *te, *te_next; static int j; @@ -364,7 +365,7 @@ static int amfs_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count) { - u_int gen = *(u_int *) cookie; + u_int gen = *(u_int *) (uintptr_t) cookie; am_node *xp; dp->dl_eof = FALSE; /* assume readdir not done */ @@ -639,7 +640,7 @@ am_dirlist3 *dp, am_entry3 *ep, u_int count, int fully_browsable) { - uint64 gen = *(uint64 *) cookie; + uint64 gen = *(uint64 *) (uintptr_t) cookie; int chain_length, i; static am_entry3 *te, *te_next; static int j; @@ -796,7 +797,7 @@ amfs_readdir3(am_node *mp, am_cookie3 cookie, am_dirlist3 *dp, am_entry3 *ep, u_int count) { - uint64 gen = *(uint64 *) cookie; + uint64 gen = *(uint64 *) (uintptr_t) cookie; am_node *xp; if (amuDebug(D_READDIR)) @@ -944,8 +945,8 @@ return amfs_readdir(mp, cookie, dp, ep, count); } else { if (browsable) - return amfs_readdir3_browsable(mp, (am_cookie3) cookie, dp, ep, count, full); + return amfs_readdir3_browsable(mp, (am_cookie3) (uintptr_t) cookie, dp, ep, count, full); else - return amfs_readdir3(mp, (am_cookie3) cookie, dp, ep, count); + return amfs_readdir3(mp, (am_cookie3) (uintptr_t) cookie, dp, ep, count); } } Index: amd/amq/amq.c =================================================================== --- amd/amq/amq.c (revision 308608) +++ amd/amq/amq.c (working copy) @@ -79,7 +79,7 @@ static void time_print(time_type tt) { - time_t t = (time_t)tt; + time_t t = (time_t)*tt; struct tm *tp = localtime(&t); printf("%02d/%02d/%04d %02d:%02d:%02d", tp->tm_mon + 1, tp->tm_mday, Index: amd/include/amq_defs.h =================================================================== --- amd/include/amq_defs.h (revision 308608) +++ amd/include/amq_defs.h (working copy) @@ -66,7 +66,7 @@ /* * TYPEDEFS */ -typedef long *time_type; +typedef time_t *time_type; typedef struct amq_mount_info amq_mount_info; typedef struct amq_map_info amq_map_info; typedef struct amq_mount_stats amq_mount_stats; --==_Exmh_1479071040_95650 Content-Type: text/plain; charset=us-ascii Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. --==_Exmh_1479071040_95650-- From owner-svn-src-head@freebsd.org Sun Nov 13 21:39:57 2016 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 23183C3FA7C; Sun, 13 Nov 2016 21:39:57 +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 CCA151DFA; Sun, 13 Nov 2016 21:39:56 +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 uADLdu5m012077; Sun, 13 Nov 2016 21:39:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uADLdtjV012076; Sun, 13 Nov 2016 21:39:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611132139.uADLdtjV012076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 13 Nov 2016 21:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308617 - head/sys/kern X-SVN-Group: head 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, 13 Nov 2016 21:39:57 -0000 Author: kib Date: Sun Nov 13 21:39:55 2016 New Revision: 308617 URL: https://svnweb.freebsd.org/changeset/base/308617 Log: Move common cleanup code into helper. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Sun Nov 13 17:55:27 2016 (r308616) +++ head/sys/kern/vfs_mount.c Sun Nov 13 21:39:55 2016 (r308617) @@ -1235,6 +1235,24 @@ vfs_check_usecounts(struct mount *mp) return (0); } +static void +dounmount_cleanup(struct mount *mp, struct vnode *coveredvp, int mntkflags) +{ + + mtx_assert(MNT_MTX(mp), MA_OWNED); + mp->mnt_kern_flag &= ~mntkflags; + if ((mp->mnt_kern_flag & MNTK_MWAIT) != 0) { + mp->mnt_kern_flag &= ~MNTK_MWAIT; + wakeup(mp); + } + MNT_IUNLOCK(mp); + if (coveredvp != NULL) { + VOP_UNLOCK(coveredvp, 0); + vdrop(coveredvp); + } + vn_finished_write(mp); +} + /* * Do the actual filesystem unmount. */ @@ -1282,12 +1300,7 @@ dounmount(struct mount *mp, int flags, s MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 || !TAILQ_EMPTY(&mp->mnt_uppers)) { - MNT_IUNLOCK(mp); - if (coveredvp != NULL) { - VOP_UNLOCK(coveredvp, 0); - vdrop(coveredvp); - } - vn_finished_write(mp); + dounmount_cleanup(mp, coveredvp, 0); return (EBUSY); } mp->mnt_kern_flag |= MNTK_UNMOUNT | MNTK_NOINSMNTQ; @@ -1296,17 +1309,8 @@ dounmount(struct mount *mp, int flags, s error = vfs_check_usecounts(mp); MNT_ILOCK(mp); if (error != 0) { - mp->mnt_kern_flag &= ~(MNTK_UNMOUNT | MNTK_NOINSMNTQ); - if (mp->mnt_kern_flag & MNTK_MWAIT) { - mp->mnt_kern_flag &= ~MNTK_MWAIT; - wakeup(mp); - } - MNT_IUNLOCK(mp); - if (coveredvp != NULL) { - VOP_UNLOCK(coveredvp, 0); - vdrop(coveredvp); - } - vn_finished_write(mp); + dounmount_cleanup(mp, coveredvp, MNTK_UNMOUNT | + MNTK_NOINSMNTQ); return (error); } } From owner-svn-src-head@freebsd.org Sun Nov 13 21:49:52 2016 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 9F9FFC3FCF2; Sun, 13 Nov 2016 21:49:52 +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 6BF73136F; Sun, 13 Nov 2016 21:49:52 +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 uADLnpNl016428; Sun, 13 Nov 2016 21:49:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uADLnpac016426; Sun, 13 Nov 2016 21:49:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611132149.uADLnpac016426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 13 Nov 2016 21:49:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308618 - in head/sys: kern ufs/ffs X-SVN-Group: head 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, 13 Nov 2016 21:49:52 -0000 Author: kib Date: Sun Nov 13 21:49:51 2016 New Revision: 308618 URL: https://svnweb.freebsd.org/changeset/base/308618 Log: Provide simple mutual exclusion between mount point update and unmount. Currently mount update keeps vfs_busy(9) reference on the mount point during MNT_UPDATE VFS_MOUNT() vfsops call. This already provides the exclusion, but is problematic for filesystems which need to perform namei(9) during VFS_MOUNT(MNT_UPDATE) operations, e.g. to refresh mnt_from path, because namei(9) must not be called while the vfs_busy(9) reference is owned. Check for MNT_UPDATE flag before setting MNTK_UNMOUNT, and for MNTK_UNMOUNT before entering innards of vfs_domount_update(), failing syscalls with EBUSY if conflict is detected. Keep vfs_busy(9) reference around VFS_MOUNT(MNT_UPDATE) calls still to not change VFS KPI. In the update path in ffs_mount(), drop vfs_busy() reference around namei(), which is now safe due to unmount never executing in parallel with VFS_MOUNT(MNT_UPDATE), and which avoids the deadlock. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/vfs_mount.c head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Sun Nov 13 21:39:55 2016 (r308617) +++ head/sys/kern/vfs_mount.c Sun Nov 13 21:49:51 2016 (r308618) @@ -940,6 +940,11 @@ vfs_domount_update( VOP_UNLOCK(vp, 0); MNT_ILOCK(mp); + if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) { + MNT_IUNLOCK(mp); + error = EBUSY; + goto end; + } mp->mnt_flag &= ~MNT_UPDATEMASK; mp->mnt_flag |= fsflags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT | MNT_ROOTFS | MNT_UPDATEMASK | MNT_RDONLY); @@ -1299,6 +1304,7 @@ dounmount(struct mount *mp, int flags, s vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 || + (mp->mnt_flag & MNT_UPDATE) != 0 || !TAILQ_EMPTY(&mp->mnt_uppers)) { dounmount_cleanup(mp, coveredvp, 0); return (EBUSY); Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Sun Nov 13 21:39:55 2016 (r308617) +++ head/sys/ufs/ffs/ffs_vfsops.c Sun Nov 13 21:49:51 2016 (r308618) @@ -147,7 +147,7 @@ ffs_mount(struct mount *mp) struct ufsmount *ump = NULL; struct fs *fs; pid_t fsckpid = 0; - int error, flags; + int error, error1, flags; uint64_t mntorflags; accmode_t accmode; struct nameidata ndp; @@ -453,6 +453,11 @@ ffs_mount(struct mount *mp) */ if (mp->mnt_flag & MNT_SNAPSHOT) return (ffs_snapshot(mp, fspec)); + + /* + * Must not call namei() while owning busy ref. + */ + vfs_unbusy(mp); } /* @@ -460,7 +465,18 @@ ffs_mount(struct mount *mp) * and verify that it refers to a sensible disk device. */ NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td); - if ((error = namei(&ndp)) != 0) + error = namei(&ndp); + if ((mp->mnt_flag & MNT_UPDATE) != 0) { + /* + * Unmount does not start if MNT_UPDATE is set. Mount + * update busies mp before setting MNT_UPDATE. We + * must be able to retain our busy ref succesfully, + * without sleep. + */ + error1 = vfs_busy(mp, MBF_NOWAIT); + MPASS(error1 == 0); + } + if (error != 0) return (error); NDFREE(&ndp, NDF_ONLY_PNBUF); devvp = ndp.ni_vp; From owner-svn-src-head@freebsd.org Sun Nov 13 22:56:26 2016 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 EF7A5C40100; Sun, 13 Nov 2016 22:56:26 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (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 9AE2B1964; Sun, 13 Nov 2016 22:56:26 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id 63hAc6Gahr8m463hBc5j6S; Sun, 13 Nov 2016 15:56:18 -0700 X-Authority-Analysis: v=2.2 cv=b8XC2pOx c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=L24OOQBejmoA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=X5jR-XQrizcZoH-9dUQA:9 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id E01231A7D; Sun, 13 Nov 2016 14:56:15 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id uADMuFmH068141; Sun, 13 Nov 2016 14:56:15 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201611132256.uADMuFmH068141@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: Kamil Czekirda cc: Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys... In-Reply-To: Message from Kamil Czekirda of "Thu, 10 Nov 2016 23:21:15 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 13 Nov 2016 14:56:15 -0800 X-CMAE-Envelope: MS4wfMGOMetxL8KY5gTjN3muSycVcF5ISmJHVL6XYDdiALwUHAtamOW1PaBJDsB1izy7bq9CDnNR48xKVggih/8UhL1+cJ1UlEm2FkPU76sFH4dmt8ZAcDDd N0WnCYgdLMyBdIJu6snDgXcSmHj9S0IVn+CEgIyJ07rp2qfRjCsPq2zpV8mnyDHPmMWgzglJ6Fxq0ZxLDVADQXT+10ed2SdlAIpwcjJAYSuqOHIw21kpm8S6 ldO3ckLYgCCIJMz9cmiWPAbKOOAbqy3eYe6NkPAvAS3Y/pH2WSQeyVwECJ6Lq/dO2h44/QSgj6wupJWesRC/eQ== 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, 13 Nov 2016 22:56:27 -0000 In message , Kamil Czekirda writes: > --089e01493e848991660540f9cc32 > Content-Type: text/plain; charset=UTF-8 > > Hi, > > I got the following: > > root@current:/usr/src # svnlite up -r r308434 > Updating '.': > U lib/libstand/stand.h > U sys/boot/common/dev_net.c > U sys/boot/common/module.c > U sys/boot/common/part.c > U sys/boot/common/util.c > U sys/boot/common/util.h > U sys/boot/efi/libefi/efinet.c > U sys/boot/efi/libefi/efipart.c > U sys/boot/efi/loader/main.c > U sys/boot/i386/libfirewire/firewire.c > U sys/boot/i386/libi386/bioscd.c > U sys/boot/i386/libi386/biosdisk.c > U sys/boot/mips/beri/loader/beri_disk_cfi.c > U sys/boot/mips/beri/loader/beri_disk_sdcard.c > U sys/boot/ofw/libofw/ofw_disk.c > U sys/boot/pc98/libpc98/bioscd.c > U sys/boot/pc98/libpc98/biosdisk.c > U sys/boot/powerpc/kboot/hostdisk.c > U sys/boot/powerpc/ps3/ps3cdrom.c > U sys/boot/powerpc/ps3/ps3disk.c > U sys/boot/uboot/lib/disk.c > U sys/boot/usb/storage/umass_loader.c > U sys/boot/userboot/userboot/host.c > U sys/boot/userboot/userboot/userboot_disk.c > U sys/boot/zfs/zfs.c > U sys/boot/zfs/zfsimpl.c > U sys/boot/i386/libi386/pxe.c > Updated to revision 308434. > root@current:/usr/src # cd sys/boot/ > root@current:/usr/src/sys/boot # make clean > (...) > root@current:/usr/src/sys/boot # make obj > (...) > root@current:/usr/src/sys/boot # make > (...) > cc -O2 -pipe -DSKEIN_LOOP=111 -fPIC -I/usr/src/sys/boot/efi/loader > -I/usr/src/sys/boot/efi/loader/arch/amd64 > -I/usr/src/sys/boot/efi/loader/../include > -I/usr/src/sys/boot/efi/loader/../include/amd64 > -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include > -I/usr/src/sys/boot/efi/loader/../../.. > -I/usr/src/sys/boot/efi/loader/../../i386/libi386 > -I/usr/src/sys/boot/efi/loader/../../zfs > -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs > -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT > -DNO_PCI -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH > -I/usr/src/sys/boot/efi/loader/../../ficl > -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 > -DLOADER_DISK_SUPPORT -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC > -I/usr/src/sys/boot/ficl -I/usr/src/sys/boot/ficl/amd64 > -I/usr/src/sys/boot/ficl/../common -I/usr/src/sys/boot/efi/loader/../../comm > on > -ffreestanding -Wformat -msoft-float -mno-mmx -mno-sse -mno-avx > -fshort-wchar -mno-red-zone -mno-aes -g -MD -MF.depend.vers.o -MTvers.o > -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W > -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes > -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body > -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare > -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function > -Wno-enum-conversion -Wno-unused-local-typedef -Qunused-arguments -c > vers.c -o vers.o > cc -O2 -pipe -DSKEIN_LOOP=111 -fPIC -I/usr/src/sys/boot/efi/loader > -I/usr/src/sys/boot/efi/loader/arch/amd64 > -I/usr/src/sys/boot/efi/loader/../include > -I/usr/src/sys/boot/efi/loader/../include/amd64 > -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include > -I/usr/src/sys/boot/efi/loader/../../.. > -I/usr/src/sys/boot/efi/loader/../../i386/libi386 > -I/usr/src/sys/boot/efi/loader/../../zfs > -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs > -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT > -DNO_PCI -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH > -I/usr/src/sys/boot/efi/loader/../../ficl > -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 > -DLOADER_DISK_SUPPORT -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC > -I/usr/src/sys/boot/ficl -I/usr/src/sys/boot/ficl/amd64 > -I/usr/src/sys/boot/ficl/../common -I/usr/src/sys/boot/efi/loader/../../comm > on > -ffreestanding -Wformat -msoft-float -mno-mmx -mno-sse -mno-avx > -fshort-wchar -mno-red-zone -mno-aes -g -MD -MF.depend.zfs.o -MTzfs.o > -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W > -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes > -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body > -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare > -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function > -Wno-enum-conversion -Wno-unused-local-typedef -Wno-sign-compare > -Wno-array-bounds -Wno-missing-prototypes -Qunused-arguments -c > /usr/src/sys/boot/efi/loader/../../zfs/zfs.c -o zfs.o > /usr/src/sys/boot/efi/loader/../../zfs/zfs.c:599:14: error: incompatible > pointer types initializing 'void (*)(int)' with an expression of type 'int > (int)' [-Werror,-Wincompatible-pointer-types] > .dv_print = zfs_dev_print, > ^~~~~~~~~~~~~ > 1 error generated. > *** Error code 1 > > Stop. > make[2]: stopped in /usr/src/sys/boot/efi/loader > *** Error code 1 > > Stop. > make[1]: stopped in /usr/src/sys/boot/efi > *** Error code 1 > > Stop. > make: stopped in /usr/src/sys/boot While working on another issue I get something different. The following on mips/mips64 but not other targets/arches, just mips/mips64. ===> sys/boot/mips/beri/loader (all) /home/cy/current/sys/boot/mips/beri/loader/devicename.c: In function 'beri_arch_ parsedev': /home/cy/current/sys/boot/mips/beri/loader/devicename.c:127: warning: passing ar gument 2 of 'strtol' from incompatible pointer type In file included from /home/cy/current/sys/boot/mips/beri/loader/exec.c:41: /home/cy/current/sys/boot/mips/beri/loader/loader.h:44: warning: 'struct env_var ' declared inside parameter list /home/cy/current/sys/boot/mips/beri/loader/loader.h:44: warning: its scope is on ly this definition or declaration, which is probably not what you want /home/cy/current/sys/boot/mips/beri/loader/exec.c: In function 'beri_elf64_exec' : /home/cy/current/sys/boot/mips/beri/loader/exec.c:122: warning: passing argument 4 of 'entry' makes integer from pointer without a cast /home/cy/current/sys/boot/mips/beri/loader/beri_disk_sdcard.c:123: error: confli cting types for 'beri_sdcard_disk_print' /home/cy/current/sys/boot/mips/beri/loader/beri_disk_sdcard.c:50: error: previou s declaration of 'beri_sdcard_disk_print' was here /home/cy/current/sys/boot/mips/beri/loader/beri_disk_sdcard.c: In function 'beri _sdcard_disk_print': /home/cy/current/sys/boot/mips/beri/loader/beri_disk_sdcard.c: In function 'beri _sdcard_disk_print': /home/cy/current/sys/boot/mips/beri/loader/beri_disk_sdcard.c:131: warning: 'ret urn' with a value, in function returning void /home/cy/current/sys/boot/mips/beri/loader/beri_disk_sdcard.c:142: warning: 'ret urn' with a value, in function returning void --- beri_disk_sdcard.o --- *** [beri_disk_sdcard.o] Error code 1 make[9]: stopped in /home/cy/current/sys/boot/mips/beri/loader -- 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 Mon Nov 14 00:33:04 2016 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 F3695C3F97E; Mon, 14 Nov 2016 00:33:04 +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 D0540119C; Mon, 14 Nov 2016 00:33:04 +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 uAE0X4Zj084500; Mon, 14 Nov 2016 00:33:04 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAE0X31u084497; Mon, 14 Nov 2016 00:33:03 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201611140033.uAE0X31u084497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 14 Nov 2016 00:33:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308619 - in head/contrib/amd: amd amq include X-SVN-Group: head 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, 14 Nov 2016 00:33:05 -0000 Author: cy Date: Mon Nov 14 00:33:03 2016 New Revision: 308619 URL: https://svnweb.freebsd.org/changeset/base/308619 Log: Fix mips 32-bit buildworld. Reported by: adrian MFC after: 6 weeks X-MFC with: r308493 Modified: head/contrib/amd/amd/readdir.c head/contrib/amd/amq/amq.c head/contrib/amd/include/amq_defs.h Modified: head/contrib/amd/amd/readdir.c ============================================================================== --- head/contrib/amd/amd/readdir.c Sun Nov 13 21:49:51 2016 (r308618) +++ head/contrib/amd/amd/readdir.c Mon Nov 14 00:33:03 2016 (r308619) @@ -38,6 +38,7 @@ */ +#include #ifdef HAVE_CONFIG_H # include #endif /* HAVE_CONFIG_H */ @@ -201,7 +202,7 @@ make_entry_chain(am_node *mp, const nfse static int amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count, int fully_browsable) { - u_int gen = *(u_int *) cookie; + u_int gen = *(u_int *) (uintptr_t) cookie; int chain_length, i; static nfsentry *te, *te_next; static int j; @@ -364,7 +365,7 @@ amfs_readdir_browsable(am_node *mp, nfsc static int amfs_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count) { - u_int gen = *(u_int *) cookie; + u_int gen = *(u_int *) (uintptr_t) cookie; am_node *xp; dp->dl_eof = FALSE; /* assume readdir not done */ @@ -639,7 +640,7 @@ amfs_readdir3_browsable(am_node *mp, am_ am_dirlist3 *dp, am_entry3 *ep, u_int count, int fully_browsable) { - uint64 gen = *(uint64 *) cookie; + uint64 gen = *(uint64 *) (uintptr_t) cookie; int chain_length, i; static am_entry3 *te, *te_next; static int j; @@ -796,7 +797,7 @@ static int amfs_readdir3(am_node *mp, am_cookie3 cookie, am_dirlist3 *dp, am_entry3 *ep, u_int count) { - uint64 gen = *(uint64 *) cookie; + uint64 gen = *(uint64 *) (uintptr_t) cookie; am_node *xp; if (amuDebug(D_READDIR)) @@ -944,8 +945,8 @@ amfs_generic_readdir(am_node *mp, voidp return amfs_readdir(mp, cookie, dp, ep, count); } else { if (browsable) - return amfs_readdir3_browsable(mp, (am_cookie3) cookie, dp, ep, count, full); + return amfs_readdir3_browsable(mp, (am_cookie3) (uintptr_t) cookie, dp, ep, count, full); else - return amfs_readdir3(mp, (am_cookie3) cookie, dp, ep, count); + return amfs_readdir3(mp, (am_cookie3) (uintptr_t) cookie, dp, ep, count); } } Modified: head/contrib/amd/amq/amq.c ============================================================================== --- head/contrib/amd/amq/amq.c Sun Nov 13 21:49:51 2016 (r308618) +++ head/contrib/amd/amq/amq.c Mon Nov 14 00:33:03 2016 (r308619) @@ -79,7 +79,7 @@ enum show_opt { static void time_print(time_type tt) { - time_t t = (time_t)tt; + time_t t = (time_t)*tt; struct tm *tp = localtime(&t); printf("%02d/%02d/%04d %02d:%02d:%02d", tp->tm_mon + 1, tp->tm_mday, Modified: head/contrib/amd/include/amq_defs.h ============================================================================== --- head/contrib/amd/include/amq_defs.h Sun Nov 13 21:49:51 2016 (r308618) +++ head/contrib/amd/include/amq_defs.h Mon Nov 14 00:33:03 2016 (r308619) @@ -66,7 +66,7 @@ /* * TYPEDEFS */ -typedef long *time_type; +typedef time_t *time_type; typedef struct amq_mount_info amq_mount_info; typedef struct amq_map_info amq_map_info; typedef struct amq_mount_stats amq_mount_stats; From owner-svn-src-head@freebsd.org Mon Nov 14 01:50:17 2016 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 D7926C3F6B9; Mon, 14 Nov 2016 01:50:17 +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 A28A91861; Mon, 14 Nov 2016 01:50:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c110-21-100-78.carlnfd1.nsw.optusnet.com.au [110.21.100.78]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 7BA133C3ED5; Mon, 14 Nov 2016 12:24:24 +1100 (AEDT) Date: Mon, 14 Nov 2016 12:24:23 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Michal Meloun cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308614 - head/sys/conf In-Reply-To: <201611131631.uADGVNaI090070@repo.freebsd.org> Message-ID: <20161114121639.N864@besplex.bde.org> References: <201611131631.uADGVNaI090070@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=BKLDlBYG c=1 sm=1 tr=0 a=uGjuzT6u7JdBDS7kH8taPg==:117 a=uGjuzT6u7JdBDS7kH8taPg==:17 a=kj9zAlcOel0A:10 a=CoUIx9lQcjXp2lZ4spwA: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: Mon, 14 Nov 2016 01:50:17 -0000 On Sun, 13 Nov 2016, Michal Meloun wrote: > Log: > Allow embeding DRM2 code into kernel. Thanks. > It's usefull for development (for netboot) and it also helps to boot > FreeBSD on some embeded platforms (where we must boot kernel directly, > without standard boot loader). It is required for LINT to work (this commit doesn't fix it being missing in LINT). It helps to boot FreeBSD on some non-embedded platform (where system policy doesn't allow either modules or the standard boot loader). Many other subsystems have the same bug. Some can be detected by checking for their files being in LINT/.depend. Bruce From owner-svn-src-head@freebsd.org Mon Nov 14 10:41:06 2016 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 3B844C3EEB7; Mon, 14 Nov 2016 10:41:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0ED594; Mon, 14 Nov 2016 10:41:05 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAEAf5lw028968; Mon, 14 Nov 2016 10:41:05 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAEAf5qS028967; Mon, 14 Nov 2016 10:41:05 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201611141041.uAEAf5qS028967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 14 Nov 2016 10:41:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308637 - head/share/man/man9 X-SVN-Group: head 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, 14 Nov 2016 10:41:06 -0000 Author: trasz Date: Mon Nov 14 10:41:04 2016 New Revision: 308637 URL: https://svnweb.freebsd.org/changeset/base/308637 Log: Fix function prototypes in usbdi(9) man page, and tweak it a little. MFC after: 1 month Modified: head/share/man/man9/usbdi.9 Modified: head/share/man/man9/usbdi.9 ============================================================================== --- head/share/man/man9/usbdi.9 Mon Nov 14 09:12:19 2016 (r308636) +++ head/share/man/man9/usbdi.9 Mon Nov 14 10:41:04 2016 (r308637) @@ -24,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd June 24, 2009 +.Dd November 14, 2016 .Dt USBDI 9 .Os .Sh NAME @@ -84,60 +84,40 @@ .In dev/usb/usb.h .In dev/usb/usbdi.h .In dev/usb/usbdi_util.h -.Sh DESCRIPTION -The Universal Serial Bus (USB) driver programming interface provides -USB peripheral drivers with a host controller independent API for -controlling and communicating with USB peripherals. -The -.Nm usb -module supports both USB Host and USB Device side mode. -. -.Sh USB KERNEL PROGRAMMING -Here is a list of commonly used functions: -.Pp -. .Ft "usb_error_t" .Fo "usbd_transfer_setup" -.Fa "udev" -.Fa "ifaces" -.Fa "pxfer" -.Fa "setup_start" -.Fa "n_setup" -.Fa "priv_sc" -.Fa "priv_mtx" +.Fa "struct usb_device *udev" +.Fa "const uint8_t *ifaces" +.Fa "struct usb_xfer **pxfer" +.Fa "const struct usb_config *setup_start" +.Fa "uint16_t n_setup" +.Fa "void *priv_sc" +.Fa "struct mtx *priv_mtx" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_unsetup" -.Fa "pxfer" -.Fa "n_setup" +.Fa "struct usb_xfer **pxfer" +.Fa "uint16_t n_setup" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_start" -.Fa "xfer" +.Fa "struct usb_xfer *xfer" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_stop" -.Fa "xfer" +.Fa "struct usb_xfer *xfer" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_drain" -.Fa "xfer" +.Fa "struct usb_xfer *xfer" .Fc -. -. -. +.Sh DESCRIPTION +The Universal Serial Bus (USB) driver programming interface provides +USB peripheral drivers with a host controller independent API for +controlling and communicating with USB peripherals. +The +.Nm usb +module supports both USB Host and USB Device side mode. .Sh USB TRANSFER MANAGEMENT FUNCTIONS The USB standard defines four types of USB transfers. . @@ -552,7 +532,7 @@ for the 8-bytes of SETUP header. These 8-bytes are not counted by the "xfer->max_data_length" variable. . -This flag can not be changed during operation. +This flag cannot be changed during operation. . . .It ext_buffer @@ -561,7 +541,7 @@ allocated. . Instead the USB client must supply a data buffer. . -This flag can not be changed during operation. +This flag cannot be changed during operation. . . .It manual_status @@ -579,7 +559,7 @@ This flag can be changed during operatio . .It no_pipe_ok Setting this flag causes the USB_ERR_NO_PIPE error to be ignored. -This flag can not be changed during operation. +This flag cannot be changed during operation. . . .It stall_pipe From owner-svn-src-head@freebsd.org Mon Nov 14 11:41:34 2016 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 19858C4167E; Mon, 14 Nov 2016 11:41:34 +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 B720C6CA; Mon, 14 Nov 2016 11:41:33 +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 uAEBfWnx051663; Mon, 14 Nov 2016 11:41:32 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAEBfMI7051561; Mon, 14 Nov 2016 11:41:22 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611141141.uAEBfMI7051561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 14 Nov 2016 11:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308638 - in head/sys/arm: allwinner allwinner/a10 allwinner/a20 allwinner/clk altera/socfpga amlogic/aml8726 annapurna/alpine arm at91 broadcom/bcm2835 freescale/imx freescale/vybrid l... X-SVN-Group: head 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, 14 Nov 2016 11:41:34 -0000 Author: andrew Date: Mon Nov 14 11:41:22 2016 New Revision: 308638 URL: https://svnweb.freebsd.org/changeset/base/308638 Log: Stop including fdt_common.h from the arm code when it's unneeded. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/allwinner/a10/a10_intc.c head/sys/arm/allwinner/a10_sramc.c head/sys/arm/allwinner/a20/a20_cpu_cfg.c head/sys/arm/allwinner/aw_ccu.c head/sys/arm/allwinner/aw_cir.c head/sys/arm/allwinner/aw_machdep.c head/sys/arm/allwinner/aw_nmi.c head/sys/arm/allwinner/aw_ts.c head/sys/arm/allwinner/aw_wdog.c head/sys/arm/allwinner/clk/aw_gate.c head/sys/arm/allwinner/if_emac.c head/sys/arm/allwinner/timer.c head/sys/arm/altera/socfpga/socfpga_gpio.c head/sys/arm/altera/socfpga/socfpga_manager.c head/sys/arm/amlogic/aml8726/aml8726_ccm.c head/sys/arm/amlogic/aml8726/aml8726_fb.c head/sys/arm/amlogic/aml8726/aml8726_gpio.c head/sys/arm/amlogic/aml8726/aml8726_i2c.c head/sys/arm/amlogic/aml8726/aml8726_mmc.c head/sys/arm/amlogic/aml8726/aml8726_pic.c head/sys/arm/amlogic/aml8726/aml8726_rng.c head/sys/arm/amlogic/aml8726/aml8726_rtc.c head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c head/sys/arm/amlogic/aml8726/aml8726_timer.c head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c head/sys/arm/amlogic/aml8726/aml8726_wdt.c head/sys/arm/amlogic/aml8726/uart_dev_aml8726.c head/sys/arm/annapurna/alpine/alpine_machdep.c head/sys/arm/arm/generic_timer.c head/sys/arm/arm/gic.c head/sys/arm/arm/gic_fdt.c head/sys/arm/arm/mp_machdep.c head/sys/arm/arm/mpcore_timer.c head/sys/arm/arm/pl190.c head/sys/arm/arm/pl310.c head/sys/arm/arm/pmu.c head/sys/arm/at91/at91_aic.c head/sys/arm/at91/at91_mci.c head/sys/arm/at91/at91_ohci_fdt.c head/sys/arm/at91/at91_pinctrl.c head/sys/arm/at91/at91_pio.c head/sys/arm/at91/at91_pit.c head/sys/arm/at91/at91_pmc.c head/sys/arm/at91/at91_rst.c head/sys/arm/at91/at91_sdramc.c head/sys/arm/at91/at91_shdwc.c head/sys/arm/at91/at91_spi.c head/sys/arm/at91/at91_tcb.c head/sys/arm/at91/at91_twi.c head/sys/arm/at91/at91_wdt.c head/sys/arm/at91/if_ate.c head/sys/arm/at91/if_macb.c head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c head/sys/arm/broadcom/bcm2835/bcm2835_dma.c head/sys/arm/broadcom/bcm2835/bcm2835_fb.c head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c head/sys/arm/broadcom/bcm2835/bcm2835_intr.c head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c head/sys/arm/broadcom/bcm2835/bcm2835_spi.c head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c head/sys/arm/freescale/imx/imx51_ccm.c head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c head/sys/arm/freescale/imx/imx6_audmux.c head/sys/arm/freescale/imx/imx6_ipu.c head/sys/arm/freescale/imx/imx6_sdma.c head/sys/arm/freescale/imx/imx6_ssi.c head/sys/arm/freescale/imx/imx_gpio.c head/sys/arm/freescale/imx/imx_gpt.c head/sys/arm/freescale/imx/imx_i2c.c head/sys/arm/freescale/imx/imx_wdog.c head/sys/arm/freescale/imx/tzic.c head/sys/arm/freescale/vybrid/vf_adc.c head/sys/arm/freescale/vybrid/vf_anadig.c head/sys/arm/freescale/vybrid/vf_dmamux.c head/sys/arm/freescale/vybrid/vf_ehci.c head/sys/arm/freescale/vybrid/vf_gpio.c head/sys/arm/freescale/vybrid/vf_i2c.c head/sys/arm/freescale/vybrid/vf_machdep.c head/sys/arm/freescale/vybrid/vf_mscm.c head/sys/arm/freescale/vybrid/vf_port.c head/sys/arm/freescale/vybrid/vf_spi.c head/sys/arm/freescale/vybrid/vf_src.c head/sys/arm/freescale/vybrid/vf_tcon.c head/sys/arm/lpc/lpc_machdep.c head/sys/arm/mv/armadaxp/armadaxp.c head/sys/arm/mv/mv_ts.c head/sys/arm/nvidia/tegra124/tegra124_machdep.c head/sys/arm/nvidia/tegra124/tegra124_pmc.c head/sys/arm/nvidia/tegra_abpmisc.c head/sys/arm/nvidia/tegra_ahci.c head/sys/arm/nvidia/tegra_efuse.c head/sys/arm/nvidia/tegra_gpio.c head/sys/arm/nvidia/tegra_i2c.c head/sys/arm/nvidia/tegra_pcie.c head/sys/arm/nvidia/tegra_rtc.c head/sys/arm/nvidia/tegra_uart.c head/sys/arm/nvidia/tegra_usbphy.c head/sys/arm/rockchip/rk30xx_grf.c head/sys/arm/rockchip/rk30xx_machdep.c head/sys/arm/rockchip/rk30xx_pmu.c head/sys/arm/rockchip/rk30xx_wdog.c head/sys/arm/samsung/exynos/exynos5_common.c head/sys/arm/ti/aintc.c head/sys/arm/ti/am335x/am335x_ecap.c head/sys/arm/ti/am335x/am335x_ehrpwm.c head/sys/arm/ti/am335x/am335x_gpio.c head/sys/arm/ti/am335x/am335x_lcd_syscons.c head/sys/arm/ti/am335x/am335x_musb.c head/sys/arm/ti/am335x/am335x_prcm.c head/sys/arm/ti/am335x/am335x_pwmss.c head/sys/arm/ti/am335x/am335x_usbss.c head/sys/arm/ti/cpsw/if_cpsw.c head/sys/arm/ti/omap4/omap4_gpio.c head/sys/arm/ti/omap4/omap4_prcm_clks.c head/sys/arm/ti/ti_edma3.c head/sys/arm/ti/ti_gpio.c head/sys/arm/ti/ti_hwmods.c head/sys/arm/ti/ti_mbox.c head/sys/arm/ti/ti_pruss.c head/sys/arm/ti/ti_sdma.c head/sys/arm/ti/ti_spi.c head/sys/arm/ti/ti_wdt.c head/sys/arm/ti/usb/omap_ehci.c head/sys/arm/ti/usb/omap_host.c head/sys/arm/ti/usb/omap_tll.c head/sys/arm/versatile/pl050.c head/sys/arm/versatile/versatile_clcd.c head/sys/arm/versatile/versatile_machdep.c head/sys/arm/versatile/versatile_pci.c head/sys/arm/versatile/versatile_sic.c head/sys/arm/versatile/versatile_timer.c head/sys/arm/xilinx/zy7_devcfg.c head/sys/arm/xilinx/zy7_ehci.c head/sys/arm/xilinx/zy7_gpio.c head/sys/arm/xilinx/zy7_machdep.c Modified: head/sys/arm/allwinner/a10/a10_intc.c ============================================================================== --- head/sys/arm/allwinner/a10/a10_intc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/a10/a10_intc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/allwinner/a10_sramc.c ============================================================================== --- head/sys/arm/allwinner/a10_sramc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/a10_sramc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/allwinner/a20/a20_cpu_cfg.c ============================================================================== --- head/sys/arm/allwinner/a20/a20_cpu_cfg.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/a20/a20_cpu_cfg.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/allwinner/aw_ccu.c ============================================================================== --- head/sys/arm/allwinner/aw_ccu.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/aw_ccu.c Mon Nov 14 11:41:22 2016 (r308638) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/allwinner/aw_cir.c ============================================================================== --- head/sys/arm/allwinner/aw_cir.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/aw_cir.c Mon Nov 14 11:41:22 2016 (r308638) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/allwinner/aw_machdep.c ============================================================================== --- head/sys/arm/allwinner/aw_machdep.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/aw_machdep.c Mon Nov 14 11:41:22 2016 (r308638) @@ -48,8 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include #include Modified: head/sys/arm/allwinner/aw_nmi.c ============================================================================== --- head/sys/arm/allwinner/aw_nmi.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/aw_nmi.c Mon Nov 14 11:41:22 2016 (r308638) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/allwinner/aw_ts.c ============================================================================== --- head/sys/arm/allwinner/aw_ts.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/aw_ts.c Mon Nov 14 11:41:22 2016 (r308638) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/allwinner/aw_wdog.c ============================================================================== --- head/sys/arm/allwinner/aw_wdog.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/aw_wdog.c Mon Nov 14 11:41:22 2016 (r308638) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/allwinner/clk/aw_gate.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_gate.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/clk/aw_gate.c Mon Nov 14 11:41:22 2016 (r308638) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include Modified: head/sys/arm/allwinner/if_emac.c ============================================================================== --- head/sys/arm/allwinner/if_emac.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/if_emac.c Mon Nov 14 11:41:22 2016 (r308638) @@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/allwinner/timer.c ============================================================================== --- head/sys/arm/allwinner/timer.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/allwinner/timer.c Mon Nov 14 11:41:22 2016 (r308638) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/altera/socfpga/socfpga_gpio.c ============================================================================== --- head/sys/arm/altera/socfpga/socfpga_gpio.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/altera/socfpga/socfpga_gpio.c Mon Nov 14 11:41:22 2016 (r308638) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/altera/socfpga/socfpga_manager.c ============================================================================== --- head/sys/arm/altera/socfpga/socfpga_manager.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/altera/socfpga/socfpga_manager.c Mon Nov 14 11:41:22 2016 (r308638) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_ccm.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_ccm.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_ccm.c Mon Nov 14 11:41:22 2016 (r308638) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_fb.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_fb.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_fb.c Mon Nov 14 11:41:22 2016 (r308638) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_gpio.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_gpio.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_gpio.c Mon Nov 14 11:41:22 2016 (r308638) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_i2c.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_i2c.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_i2c.c Mon Nov 14 11:41:22 2016 (r308638) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_mmc.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_mmc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_mmc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_pic.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_pic.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_pic.c Mon Nov 14 11:41:22 2016 (r308638) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_rng.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_rng.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_rng.c Mon Nov 14 11:41:22 2016 (r308638) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_rtc.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_rtc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_rtc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c Mon Nov 14 11:41:22 2016 (r308638) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_timer.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_timer.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_timer.c Mon Nov 14 11:41:22 2016 (r308638) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c Mon Nov 14 11:41:22 2016 (r308638) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_wdt.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_wdt.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/aml8726_wdt.c Mon Nov 14 11:41:22 2016 (r308638) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include Modified: head/sys/arm/amlogic/aml8726/uart_dev_aml8726.c ============================================================================== --- head/sys/arm/amlogic/aml8726/uart_dev_aml8726.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/amlogic/aml8726/uart_dev_aml8726.c Mon Nov 14 11:41:22 2016 (r308638) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/annapurna/alpine/alpine_machdep.c ============================================================================== --- head/sys/arm/annapurna/alpine/alpine_machdep.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/annapurna/alpine/alpine_machdep.c Mon Nov 14 11:41:22 2016 (r308638) @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include "opt_ddb.h" #include "opt_platform.h" Modified: head/sys/arm/arm/generic_timer.c ============================================================================== --- head/sys/arm/arm/generic_timer.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/arm/generic_timer.c Mon Nov 14 11:41:22 2016 (r308638) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); #endif #ifdef FDT -#include #include #include #include Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/arm/gic.c Mon Nov 14 11:41:22 2016 (r308638) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/arm/gic_fdt.c ============================================================================== --- head/sys/arm/arm/gic_fdt.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/arm/gic_fdt.c Mon Nov 14 11:41:22 2016 (r308638) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include Modified: head/sys/arm/arm/mp_machdep.c ============================================================================== --- head/sys/arm/arm/mp_machdep.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/arm/mp_machdep.c Mon Nov 14 11:41:22 2016 (r308638) @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #endif #ifdef CPU_MV_PJ4B #include -#include #endif extern struct pcpu __pcpu[]; Modified: head/sys/arm/arm/mpcore_timer.c ============================================================================== --- head/sys/arm/arm/mpcore_timer.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/arm/mpcore_timer.c Mon Nov 14 11:41:22 2016 (r308638) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/arm/pl190.c ============================================================================== --- head/sys/arm/arm/pl190.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/arm/pl190.c Mon Nov 14 11:41:22 2016 (r308638) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/arm/pl310.c ============================================================================== --- head/sys/arm/arm/pl310.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/arm/pl310.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/arm/pmu.c ============================================================================== --- head/sys/arm/arm/pmu.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/arm/pmu.c Mon Nov 14 11:41:22 2016 (r308638) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/at91/at91_aic.c ============================================================================== --- head/sys/arm/at91/at91_aic.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_aic.c Mon Nov 14 11:41:22 2016 (r308638) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/at91_mci.c ============================================================================== --- head/sys/arm/at91/at91_mci.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_mci.c Mon Nov 14 11:41:22 2016 (r308638) @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/at91_ohci_fdt.c ============================================================================== --- head/sys/arm/at91/at91_ohci_fdt.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_ohci_fdt.c Mon Nov 14 11:41:22 2016 (r308638) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include Modified: head/sys/arm/at91/at91_pinctrl.c ============================================================================== --- head/sys/arm/at91/at91_pinctrl.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_pinctrl.c Mon Nov 14 11:41:22 2016 (r308638) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/at91/at91_pio.c ============================================================================== --- head/sys/arm/at91/at91_pio.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_pio.c Mon Nov 14 11:41:22 2016 (r308638) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/at91_pit.c ============================================================================== --- head/sys/arm/at91/at91_pit.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_pit.c Mon Nov 14 11:41:22 2016 (r308638) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/at91_pmc.c ============================================================================== --- head/sys/arm/at91/at91_pmc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_pmc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/at91_rst.c ============================================================================== --- head/sys/arm/at91/at91_rst.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_rst.c Mon Nov 14 11:41:22 2016 (r308638) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #define FDT_HACKS 1 Modified: head/sys/arm/at91/at91_sdramc.c ============================================================================== --- head/sys/arm/at91/at91_sdramc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_sdramc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/at91_shdwc.c ============================================================================== --- head/sys/arm/at91/at91_shdwc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_shdwc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/at91_spi.c ============================================================================== --- head/sys/arm/at91/at91_spi.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_spi.c Mon Nov 14 11:41:22 2016 (r308638) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/at91_tcb.c ============================================================================== --- head/sys/arm/at91/at91_tcb.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_tcb.c Mon Nov 14 11:41:22 2016 (r308638) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/at91_twi.c ============================================================================== --- head/sys/arm/at91/at91_twi.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_twi.c Mon Nov 14 11:41:22 2016 (r308638) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/at91_wdt.c ============================================================================== --- head/sys/arm/at91/at91_wdt.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/at91_wdt.c Mon Nov 14 11:41:22 2016 (r308638) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/if_ate.c Mon Nov 14 11:41:22 2016 (r308638) @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/at91/if_macb.c ============================================================================== --- head/sys/arm/at91/if_macb.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/at91/if_macb.c Mon Nov 14 11:41:22 2016 (r308638) @@ -76,7 +76,6 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT -#include #include #include #endif Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Mon Nov 14 11:41:22 2016 (r308638) @@ -44,8 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Mon Nov 14 11:41:22 2016 (r308638) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Mon Nov 14 11:41:22 2016 (r308638) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Mon Nov 14 11:41:22 2016 (r308638) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Mon Nov 14 11:41:22 2016 (r308638) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include Modified: head/sys/arm/broadcom/bcm2835/bcm2835_spi.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_spi.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/broadcom/bcm2835/bcm2835_spi.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Mon Nov 14 11:41:22 2016 (r308638) @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/imx/imx51_ccm.c ============================================================================== --- head/sys/arm/freescale/imx/imx51_ccm.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/imx51_ccm.c Mon Nov 14 11:41:22 2016 (r308638) @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c ============================================================================== --- head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c Mon Nov 14 11:41:22 2016 (r308638) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/freescale/imx/imx6_audmux.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_audmux.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/imx6_audmux.c Mon Nov 14 11:41:22 2016 (r308638) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/imx/imx6_ipu.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_ipu.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/imx6_ipu.c Mon Nov 14 11:41:22 2016 (r308638) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include Modified: head/sys/arm/freescale/imx/imx6_sdma.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_sdma.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/imx6_sdma.c Mon Nov 14 11:41:22 2016 (r308638) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/imx/imx6_ssi.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_ssi.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/imx6_ssi.c Mon Nov 14 11:41:22 2016 (r308638) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/imx_gpio.c Mon Nov 14 11:41:22 2016 (r308638) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/imx/imx_gpt.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpt.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/imx_gpt.c Mon Nov 14 11:41:22 2016 (r308638) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- head/sys/arm/freescale/imx/imx_i2c.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/imx_i2c.c Mon Nov 14 11:41:22 2016 (r308638) @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include "iicbus_if.h" -#include #include #include #include Modified: head/sys/arm/freescale/imx/imx_wdog.c ============================================================================== --- head/sys/arm/freescale/imx/imx_wdog.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/imx_wdog.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/imx/tzic.c ============================================================================== --- head/sys/arm/freescale/imx/tzic.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/imx/tzic.c Mon Nov 14 11:41:22 2016 (r308638) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/vybrid/vf_adc.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_adc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_adc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/vybrid/vf_anadig.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_anadig.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_anadig.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/vybrid/vf_dmamux.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_dmamux.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_dmamux.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/vybrid/vf_ehci.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_ehci.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_ehci.c Mon Nov 14 11:41:22 2016 (r308638) @@ -55,8 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include Modified: head/sys/arm/freescale/vybrid/vf_gpio.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_gpio.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_gpio.c Mon Nov 14 11:41:22 2016 (r308638) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/vybrid/vf_i2c.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_i2c.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_i2c.c Mon Nov 14 11:41:22 2016 (r308638) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" -#include #include #include #include Modified: head/sys/arm/freescale/vybrid/vf_machdep.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_machdep.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_machdep.c Mon Nov 14 11:41:22 2016 (r308638) @@ -42,8 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - vm_offset_t platform_lastaddr(void) { Modified: head/sys/arm/freescale/vybrid/vf_mscm.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_mscm.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_mscm.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/vybrid/vf_port.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_port.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_port.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/vybrid/vf_spi.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_spi.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_spi.c Mon Nov 14 11:41:22 2016 (r308638) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include "spibus_if.h" -#include #include #include #include Modified: head/sys/arm/freescale/vybrid/vf_src.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_src.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_src.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/freescale/vybrid/vf_tcon.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_tcon.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/freescale/vybrid/vf_tcon.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/lpc/lpc_machdep.c ============================================================================== --- head/sys/arm/lpc/lpc_machdep.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/lpc/lpc_machdep.c Mon Nov 14 11:41:22 2016 (r308638) @@ -58,8 +58,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - vm_offset_t platform_lastaddr(void) { Modified: head/sys/arm/mv/armadaxp/armadaxp.c ============================================================================== --- head/sys/arm/mv/armadaxp/armadaxp.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/mv/armadaxp/armadaxp.c Mon Nov 14 11:41:22 2016 (r308638) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/mv/mv_ts.c ============================================================================== --- head/sys/arm/mv/mv_ts.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/mv/mv_ts.c Mon Nov 14 11:41:22 2016 (r308638) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/nvidia/tegra124/tegra124_machdep.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_machdep.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra124/tegra124_machdep.c Mon Nov 14 11:41:22 2016 (r308638) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/nvidia/tegra124/tegra124_pmc.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_pmc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra124/tegra124_pmc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -38,7 +38,6 @@ #include #include -#include #include #include Modified: head/sys/arm/nvidia/tegra_abpmisc.c ============================================================================== --- head/sys/arm/nvidia/tegra_abpmisc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra_abpmisc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/nvidia/tegra_ahci.c ============================================================================== --- head/sys/arm/nvidia/tegra_ahci.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra_ahci.c Mon Nov 14 11:41:22 2016 (r308638) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/arm/nvidia/tegra_efuse.c ============================================================================== --- head/sys/arm/nvidia/tegra_efuse.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra_efuse.c Mon Nov 14 11:41:22 2016 (r308638) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/nvidia/tegra_gpio.c ============================================================================== --- head/sys/arm/nvidia/tegra_gpio.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra_gpio.c Mon Nov 14 11:41:22 2016 (r308638) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/nvidia/tegra_i2c.c ============================================================================== --- head/sys/arm/nvidia/tegra_i2c.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra_i2c.c Mon Nov 14 11:41:22 2016 (r308638) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/arm/nvidia/tegra_pcie.c ============================================================================== --- head/sys/arm/nvidia/tegra_pcie.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra_pcie.c Mon Nov 14 11:41:22 2016 (r308638) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/arm/nvidia/tegra_rtc.c ============================================================================== --- head/sys/arm/nvidia/tegra_rtc.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra_rtc.c Mon Nov 14 11:41:22 2016 (r308638) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/nvidia/tegra_uart.c ============================================================================== --- head/sys/arm/nvidia/tegra_uart.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra_uart.c Mon Nov 14 11:41:22 2016 (r308638) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -248,4 +247,4 @@ static driver_t tegra_uart_driver = { }; DRIVER_MODULE(tegra_uart, simplebus, tegra_uart_driver, uart_devclass, - 0, 0); \ No newline at end of file + 0, 0); Modified: head/sys/arm/nvidia/tegra_usbphy.c ============================================================================== --- head/sys/arm/nvidia/tegra_usbphy.c Mon Nov 14 10:41:04 2016 (r308637) +++ head/sys/arm/nvidia/tegra_usbphy.c Mon Nov 14 11:41:22 2016 (r308638) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Nov 14 11:52:24 2016 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 C43DDC41908; Mon, 14 Nov 2016 11:52:24 +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 8E254D8F; Mon, 14 Nov 2016 11:52:24 +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 uAEBqNfv058419; Mon, 14 Nov 2016 11:52:23 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAEBqN4T058413; Mon, 14 Nov 2016 11:52:23 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611141152.uAEBqN4T058413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 14 Nov 2016 11:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308639 - in head/sys/arm: allwinner amlogic/aml8726 annapurna/alpine freescale/imx ti X-SVN-Group: head 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, 14 Nov 2016 11:52:24 -0000 Author: andrew Date: Mon Nov 14 11:52:22 2016 New Revision: 308639 URL: https://svnweb.freebsd.org/changeset/base/308639 Log: Move including fdt_pinctrl.h after openfirm.h to get th edefinition of phandle_t and remove the need for including fdt_common.h. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/allwinner/a10_gpio.c head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c head/sys/arm/annapurna/alpine/alpine_machdep_mp.c head/sys/arm/freescale/imx/imx_iomux.c head/sys/arm/ti/ti_pinmux.c head/sys/arm/ti/ti_scm.c Modified: head/sys/arm/allwinner/a10_gpio.c ============================================================================== --- head/sys/arm/allwinner/a10_gpio.c Mon Nov 14 11:41:22 2016 (r308638) +++ head/sys/arm/allwinner/a10_gpio.c Mon Nov 14 11:52:22 2016 (r308639) @@ -44,11 +44,10 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include #include +#include #include #include Modified: head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c Mon Nov 14 11:41:22 2016 (r308638) +++ head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c Mon Nov 14 11:52:22 2016 (r308639) @@ -45,10 +45,9 @@ __FBSDID("$FreeBSD$"); #include -#include -#include #include #include +#include #include #include Modified: head/sys/arm/annapurna/alpine/alpine_machdep_mp.c ============================================================================== --- head/sys/arm/annapurna/alpine/alpine_machdep_mp.c Mon Nov 14 11:41:22 2016 (r308638) +++ head/sys/arm/annapurna/alpine/alpine_machdep_mp.c Mon Nov 14 11:52:22 2016 (r308639) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/arm/freescale/imx/imx_iomux.c ============================================================================== --- head/sys/arm/freescale/imx/imx_iomux.c Mon Nov 14 11:41:22 2016 (r308638) +++ head/sys/arm/freescale/imx/imx_iomux.c Mon Nov 14 11:52:22 2016 (r308639) @@ -59,11 +59,10 @@ #include -#include -#include #include #include #include +#include #include #include Modified: head/sys/arm/ti/ti_pinmux.c ============================================================================== --- head/sys/arm/ti/ti_pinmux.c Mon Nov 14 11:41:22 2016 (r308638) +++ head/sys/arm/ti/ti_pinmux.c Mon Nov 14 11:52:22 2016 (r308639) @@ -49,11 +49,10 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include #include +#include #include "ti_pinmux.h" Modified: head/sys/arm/ti/ti_scm.c ============================================================================== --- head/sys/arm/ti/ti_scm.c Mon Nov 14 11:41:22 2016 (r308638) +++ head/sys/arm/ti/ti_scm.c Mon Nov 14 11:52:22 2016 (r308639) @@ -61,11 +61,10 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include #include +#include #include "ti_scm.h" From owner-svn-src-head@freebsd.org Mon Nov 14 12:03:12 2016 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 81DB8C4055A; Mon, 14 Nov 2016 12:03:12 +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 300A418BA; Mon, 14 Nov 2016 12:03:12 +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 uAEC3BTc062275; Mon, 14 Nov 2016 12:03:11 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAEC39vY062250; Mon, 14 Nov 2016 12:03:09 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611141203.uAEC39vY062250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 14 Nov 2016 12:03:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308640 - in head/sys/arm: altera/socfpga broadcom/bcm2835 freescale/imx freescale/vybrid lpc mv rockchip ti ti/am335x versatile xilinx X-SVN-Group: head 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, 14 Nov 2016 12:03:12 -0000 Author: andrew Date: Mon Nov 14 12:03:08 2016 New Revision: 308640 URL: https://svnweb.freebsd.org/changeset/base/308640 Log: Use the correct OF_getencprop over OF_getprop + fdt32_to_cpu to read integer data from the device tree. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/altera/socfpga/socfpga_common.c head/sys/arm/altera/socfpga/socfpga_rstmgr.c head/sys/arm/broadcom/bcm2835/bcm2835_fb.c head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c head/sys/arm/freescale/imx/imx51_ipuv3.c head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c head/sys/arm/freescale/imx/imx6_ssi.c head/sys/arm/freescale/vybrid/vf_common.c head/sys/arm/freescale/vybrid/vf_dcu4.c head/sys/arm/freescale/vybrid/vf_edma.c head/sys/arm/freescale/vybrid/vf_iomuxc.c head/sys/arm/freescale/vybrid/vf_sai.c head/sys/arm/lpc/lpc_fb.c head/sys/arm/lpc/lpc_timer.c head/sys/arm/mv/gpio.c head/sys/arm/mv/mv_machdep.c head/sys/arm/rockchip/rk30xx_gpio.c head/sys/arm/ti/am335x/am335x_lcd.c head/sys/arm/ti/am335x/am335x_lcd_syscons.c head/sys/arm/ti/ti_adc.c head/sys/arm/ti/ti_sdhci.c head/sys/arm/versatile/sp804.c head/sys/arm/xilinx/zy7_slcr.c Modified: head/sys/arm/altera/socfpga/socfpga_common.c ============================================================================== --- head/sys/arm/altera/socfpga/socfpga_common.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/altera/socfpga/socfpga_common.c Mon Nov 14 12:03:08 2016 (r308640) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -47,7 +46,7 @@ __FBSDID("$FreeBSD$"); void cpu_reset(void) { - uint32_t addr, paddr; + uint32_t paddr; bus_addr_t vaddr; phandle_t node; @@ -58,9 +57,8 @@ cpu_reset(void) if (node == -1) goto end; - if ((OF_getprop(node, "reg", &paddr, sizeof(paddr))) > 0) { - addr = fdt32_to_cpu(paddr); - if (bus_space_map(fdtbus_bs_tag, addr, 0x8, 0, &vaddr) == 0) { + if ((OF_getencprop(node, "reg", &paddr, sizeof(paddr))) > 0) { + if (bus_space_map(fdtbus_bs_tag, paddr, 0x8, 0, &vaddr) == 0) { bus_space_write_4(fdtbus_bs_tag, vaddr, RSTMGR_CTRL, CTRL_SWWARMRSTREQ); } Modified: head/sys/arm/altera/socfpga/socfpga_rstmgr.c ============================================================================== --- head/sys/arm/altera/socfpga/socfpga_rstmgr.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/altera/socfpga/socfpga_rstmgr.c Mon Nov 14 12:03:08 2016 (r308640) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -84,7 +83,7 @@ enum { static int l3remap(struct rstmgr_softc *sc, int remap, int enable) { - uint32_t addr, paddr; + uint32_t paddr; bus_addr_t vaddr; phandle_t node; int reg; @@ -106,9 +105,8 @@ l3remap(struct rstmgr_softc *sc, int rem return (1); } - if ((OF_getprop(node, "reg", &paddr, sizeof(paddr))) > 0) { - addr = fdt32_to_cpu(paddr); - if (bus_space_map(fdtbus_bs_tag, addr, 0x4, 0, &vaddr) == 0) { + if ((OF_getencprop(node, "reg", &paddr, sizeof(paddr))) > 0) { + if (bus_space_map(fdtbus_bs_tag, paddr, 0x4, 0, &vaddr) == 0) { bus_space_write_4(fdtbus_bs_tag, vaddr, L3REGS_REMAP, reg); return (0); Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Mon Nov 14 12:03:08 2016 (r308640) @@ -473,15 +473,15 @@ bcmfb_configure(int flags) if ((root != 0) && (display = fdt_find_compatible(root, "broadcom,bcm2835-fb", 1))) { if (sc->width == 0) { - if ((OF_getprop(display, "broadcom,width", + if ((OF_getencprop(display, "broadcom,width", &cell, sizeof(cell))) > 0) - sc->width = (int)fdt32_to_cpu(cell); + sc->width = cell; } if (sc->height == 0) { if ((OF_getprop(display, "broadcom,height", &cell, sizeof(cell))) > 0) - sc->height = (int)fdt32_to_cpu(cell); + sc->height = cell; } } Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Nov 14 12:03:08 2016 (r308640) @@ -78,13 +78,15 @@ bcm2835_late_init(platform_t plat) system = OF_finddevice("/system"); if (system != 0) { - len = OF_getprop(system, "linux,serial", &cells, sizeof(cells)); + len = OF_getencprop(system, "linux,serial", cells, + sizeof(cells)); if (len > 0) - board_set_serial(fdt64_to_cpu(*((uint64_t *)cells))); + board_set_serial(((uint64_t)cells[0]) << 32 | cells[1]); - len = OF_getprop(system, "linux,revision", &cells, sizeof(cells)); + len = OF_getencprop(system, "linux,revision", cells, + sizeof(cells)); if (len > 0) - board_set_revision(fdt32_to_cpu(*((uint32_t *)cells))); + board_set_revision(cells[0]); } } Modified: head/sys/arm/freescale/imx/imx51_ipuv3.c ============================================================================== --- head/sys/arm/freescale/imx/imx51_ipuv3.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/freescale/imx/imx51_ipuv3.c Mon Nov 14 12:03:08 2016 (r308640) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -313,10 +312,10 @@ ipu3_fb_attach(device_t dev) * On i.MX53, the offset is 0. */ node = ofw_bus_get_node(dev); - if ((OF_getprop(node, "reg", ®, sizeof(reg))) <= 0) + if ((OF_getencprop(node, "reg", ®, sizeof(reg))) <= 0) base = 0; else - base = fdt32_to_cpu(reg) - IPU_CM_BASE(0); + base = reg - IPU_CM_BASE(0); /* map controller registers */ err = bus_space_map(iot, IPU_CM_BASE(base), IPU_CM_SIZE, 0, &ioh); if (err) Modified: head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c ============================================================================== --- head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c Mon Nov 14 12:03:08 2016 (r308640) @@ -221,10 +221,10 @@ ipu3_fb_attach(device_t dev) * On i.MX53, the offset is 0. */ node = ofw_bus_get_node(dev); - if ((OF_getprop(node, "reg", ®, sizeof(reg))) <= 0) + if ((OF_getencprop(node, "reg", ®, sizeof(reg))) <= 0) base = 0; else - base = fdt32_to_cpu(reg) - IPU_CM_BASE(0); + base = reg - IPU_CM_BASE(0); /* map controller registers */ err = bus_space_map(iot, IPU_CM_BASE(base), IPU_CM_SIZE, 0, &ioh); if (err) Modified: head/sys/arm/freescale/imx/imx6_ssi.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_ssi.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/freescale/imx/imx6_ssi.c Mon Nov 14 12:03:08 2016 (r308640) @@ -446,12 +446,12 @@ find_sdma_controller(struct sc_info *sc) if ((len = OF_getproplen(node, "dmas")) <= 0) return (ENXIO); - OF_getprop(node, "dmas", &dts_value, len); + OF_getencprop(node, "dmas", &dts_value, len); - sc->sdma_ev_rx = fdt32_to_cpu(dts_value[1]); - sc->sdma_ev_tx = fdt32_to_cpu(dts_value[5]); + sc->sdma_ev_rx = dts_value[1]; + sc->sdma_ev_tx = dts_value[5]; - sdma_node = OF_node_from_xref(fdt32_to_cpu(dts_value[0])); + sdma_node = OF_node_from_xref(dts_value[0]); sdma_sc = NULL; Modified: head/sys/arm/freescale/vybrid/vf_common.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_common.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/freescale/vybrid/vf_common.c Mon Nov 14 12:03:08 2016 (r308640) @@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -44,16 +43,15 @@ void cpu_reset(void) { phandle_t src; - uint32_t addr, paddr; + uint32_t paddr; bus_addr_t vaddr; if (src_swreset() == 0) goto end; src = OF_finddevice("src"); - if ((src != 0) && (OF_getprop(src, "reg", &paddr, sizeof(paddr))) > 0) { - addr = fdt32_to_cpu(paddr); - if (bus_space_map(fdtbus_bs_tag, addr, 0x10, 0, &vaddr) == 0) { + if ((src != 0) && (OF_getencprop(src, "reg", &paddr, sizeof(paddr))) > 0) { + if (bus_space_map(fdtbus_bs_tag, paddr, 0x10, 0, &vaddr) == 0) { bus_space_write_4(fdtbus_bs_tag, vaddr, 0x00, SW_RST); } } Modified: head/sys/arm/freescale/vybrid/vf_dcu4.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_dcu4.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/freescale/vybrid/vf_dcu4.c Mon Nov 14 12:03:08 2016 (r308640) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -246,37 +245,37 @@ get_panel_info(struct dcu_softc *sc, str /* panel size */ if ((len = OF_getproplen(node, "panel-size")) <= 0) return (ENXIO); - OF_getprop(node, "panel-size", &dts_value, len); - panel->width = fdt32_to_cpu(dts_value[0]); - panel->height = fdt32_to_cpu(dts_value[1]); + OF_getencprop(node, "panel-size", dts_value, len); + panel->width = dts_value[0]; + panel->height = dts_value[1]; /* hsync */ if ((len = OF_getproplen(node, "panel-hsync")) <= 0) return (ENXIO); - OF_getprop(node, "panel-hsync", &dts_value, len); - panel->h_back_porch = fdt32_to_cpu(dts_value[0]); - panel->h_pulse_width = fdt32_to_cpu(dts_value[1]); - panel->h_front_porch = fdt32_to_cpu(dts_value[2]); + OF_getencprop(node, "panel-hsync", dts_value, len); + panel->h_back_porch = dts_value[0]; + panel->h_pulse_width = dts_value[1]; + panel->h_front_porch = dts_value[2]; /* vsync */ if ((len = OF_getproplen(node, "panel-vsync")) <= 0) return (ENXIO); - OF_getprop(node, "panel-vsync", &dts_value, len); - panel->v_back_porch = fdt32_to_cpu(dts_value[0]); - panel->v_pulse_width = fdt32_to_cpu(dts_value[1]); - panel->v_front_porch = fdt32_to_cpu(dts_value[2]); + OF_getencprop(node, "panel-vsync", dts_value, len); + panel->v_back_porch = dts_value[0]; + panel->v_pulse_width = dts_value[1]; + panel->v_front_porch = dts_value[2]; /* clk divider */ if ((len = OF_getproplen(node, "panel-clk-div")) <= 0) return (ENXIO); - OF_getprop(node, "panel-clk-div", &dts_value, len); - panel->clk_div = fdt32_to_cpu(dts_value[0]); + OF_getencprop(node, "panel-clk-div", dts_value, len); + panel->clk_div = dts_value[0]; /* backlight pin */ if ((len = OF_getproplen(node, "panel-backlight-pin")) <= 0) return (ENXIO); - OF_getprop(node, "panel-backlight-pin", &dts_value, len); - panel->backlight_pin = fdt32_to_cpu(dts_value[0]); + OF_getencprop(node, "panel-backlight-pin", dts_value, len); + panel->backlight_pin = dts_value[0]; return (0); } Modified: head/sys/arm/freescale/vybrid/vf_edma.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_edma.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/freescale/vybrid/vf_edma.c Mon Nov 14 12:03:08 2016 (r308640) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -284,8 +283,8 @@ edma_attach(device_t dev) if ((len = OF_getproplen(node, "device-id")) <= 0) return (ENXIO); - OF_getprop(node, "device-id", &dts_value, len); - sc->device_id = fdt32_to_cpu(dts_value); + OF_getencprop(node, "device-id", &dts_value, len); + sc->device_id = dts_value; sc->dma_stop = dma_stop; sc->dma_setup = dma_setup; Modified: head/sys/arm/freescale/vybrid/vf_iomuxc.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_iomuxc.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/freescale/vybrid/vf_iomuxc.c Mon Nov 14 12:03:08 2016 (r308640) @@ -148,12 +148,12 @@ pinmux_set(struct iomuxc_softc *sc) continue; if ((len = OF_getproplen(child, "iomux_config")) > 0) { - OF_getprop(child, "iomux_config", &iomux_config, len); + OF_getencprop(child, "iomux_config", iomux_config, len); values = len / (sizeof(uint32_t)); for (i = 0; i < values; i += 2) { - pin = fdt32_to_cpu(iomux_config[i]); - pin_cfg = fdt32_to_cpu(iomux_config[i+1]); + pin = iomux_config[i]; + pin_cfg = iomux_config[i+1]; #if 0 device_printf(sc->dev, "Set pin %d to 0x%08x\n", pin, pin_cfg); Modified: head/sys/arm/freescale/vybrid/vf_sai.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_sai.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/freescale/vybrid/vf_sai.c Mon Nov 14 12:03:08 2016 (r308640) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -424,19 +423,19 @@ find_edma_controller(struct sc_info *sc) if ((len = OF_getproplen(node, "edma-mux-group")) <= 0) return (ENXIO); - OF_getprop(node, "edma-src-transmit", &dts_value, len); - edma_src_transmit = fdt32_to_cpu(dts_value); - OF_getprop(node, "edma-mux-group", &dts_value, len); - edma_mux_group = fdt32_to_cpu(dts_value); - OF_getprop(node, "edma-controller", &dts_value, len); - edma_node = OF_node_from_xref(fdt32_to_cpu(dts_value)); + OF_getencprop(node, "edma-src-transmit", &dts_value, len); + edma_src_transmit = dts_value; + OF_getencprop(node, "edma-mux-group", &dts_value, len); + edma_mux_group = dts_value; + OF_getencprop(node, "edma-controller", &dts_value, len); + edma_node = OF_node_from_xref(dts_value); if ((len = OF_getproplen(edma_node, "device-id")) <= 0) { return (ENXIO); } - OF_getprop(edma_node, "device-id", &dts_value, len); - edma_device_id = fdt32_to_cpu(dts_value); + OF_getencprop(edma_node, "device-id", &dts_value, len); + edma_device_id = dts_value; edma_sc = NULL; Modified: head/sys/arm/lpc/lpc_fb.c ============================================================================== --- head/sys/arm/lpc/lpc_fb.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/lpc/lpc_fb.c Mon Nov 14 12:03:08 2016 (r308640) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -280,10 +279,9 @@ lpc_fb_intr(void *arg) static int lpc_fb_fdt_read(phandle_t node, const char *name, uint32_t *ret) { - if (OF_getprop(node, name, ret, sizeof(uint32_t)) <= 0) + if (OF_getencprop(node, name, ret, sizeof(uint32_t)) <= 0) return (ENOENT); - *ret = fdt32_to_cpu(*ret); return (0); } Modified: head/sys/arm/lpc/lpc_timer.c ============================================================================== --- head/sys/arm/lpc/lpc_timer.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/lpc/lpc_timer.c Mon Nov 14 12:03:08 2016 (r308640) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -158,7 +157,7 @@ lpc_timer_attach(device_t dev) /* Get PERIPH_CLK encoded in parent bus 'bus-frequency' property */ node = ofw_bus_get_node(dev); - if (OF_getprop(OF_parent(node), "bus-frequency", &freq, + if (OF_getencprop(OF_parent(node), "bus-frequency", &freq, sizeof(pcell_t)) <= 0) { bus_release_resources(dev, lpc_timer_spec, sc->lt_res); bus_teardown_intr(dev, sc->lt_res[2], intrcookie); @@ -166,8 +165,6 @@ lpc_timer_attach(device_t dev) return (ENXIO); } - freq = fdt32_to_cpu(freq); - /* Set desired frequency in event timer and timecounter */ sc->lt_et.et_frequency = (uint64_t)freq; lpc_timecounter.tc_frequency = (uint64_t)freq; Modified: head/sys/arm/mv/gpio.c ============================================================================== --- head/sys/arm/mv/gpio.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/mv/gpio.c Mon Nov 14 12:03:08 2016 (r308640) @@ -113,7 +113,7 @@ struct gpio_ctrl_entry { gpios_phandler_t handler; }; -int mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len); +static int mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len); int gpio_get_config_from_dt(void); struct gpio_ctrl_entry gpio_controllers[] = { @@ -540,7 +540,7 @@ mv_gpio_value_set(uint32_t pin, uint8_t mv_gpio_reg_clear(reg, pin); } -int +static int mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len) { pcell_t gpio_cells, pincnt; @@ -554,10 +554,8 @@ mv_handle_gpios_prop(phandle_t ctrl, pce /* Node is not a GPIO controller. */ return (ENXIO); - if (OF_getprop(ctrl, "#gpio-cells", &gpio_cells, sizeof(pcell_t)) < 0) + if (OF_getencprop(ctrl, "#gpio-cells", &gpio_cells, sizeof(pcell_t)) < 0) return (ENXIO); - - gpio_cells = fdt32_to_cpu(gpio_cells); if (gpio_cells != 3) return (ENXIO); @@ -567,9 +565,9 @@ mv_handle_gpios_prop(phandle_t ctrl, pce if (fdt_regsize(ctrl, &gpio_ctrl, &size)) return (ENXIO); - if (OF_getprop(ctrl, "pin-count", &pincnt, sizeof(pcell_t)) < 0) + if (OF_getencprop(ctrl, "pin-count", &pincnt, sizeof(pcell_t)) < 0) return (ENXIO); - sc.pin_num = fdt32_to_cpu(pincnt); + sc.pin_num = pincnt; /* * Skip controller reference, since controller's phandle is given @@ -579,9 +577,9 @@ mv_handle_gpios_prop(phandle_t ctrl, pce gpios += inc; for (t = 0; t < tuples; t++) { - pin = fdt32_to_cpu(gpios[0]); - dir = fdt32_to_cpu(gpios[1]); - flags = fdt32_to_cpu(gpios[2]); + pin = gpios[0]; + dir = gpios[1]; + flags = gpios[2]; mv_gpio_configure(pin, flags); @@ -630,7 +628,7 @@ mv_gpio_init(void) return (ENXIO); /* Get 'gpios' property. */ - OF_getprop(child, "gpios", &gpios, len); + OF_getencprop(child, "gpios", gpios, len); e = (struct gpio_ctrl_entry *)&gpio_controllers; @@ -641,7 +639,7 @@ mv_gpio_init(void) * contain a ref. to a node defining GPIO * controller. */ - ctrl = OF_node_from_xref(fdt32_to_cpu(gpios[0])); + ctrl = OF_node_from_xref(gpios[0]); if (ofw_bus_node_is_compatible(ctrl, e->compat)) /* Call a handler. */ Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/mv/mv_machdep.c Mon Nov 14 12:03:08 2016 (r308640) @@ -147,21 +147,19 @@ moveon: /* * Process 'pin-count' and 'pin-map' props. */ - if (OF_getprop(node, "pin-count", &pin_count, sizeof(pin_count)) <= 0) + if (OF_getencprop(node, "pin-count", &pin_count, sizeof(pin_count)) <= 0) return (ENXIO); - pin_count = fdt32_to_cpu(pin_count); if (pin_count > MPP_PIN_MAX) return (ERANGE); - if (OF_getprop(node, "#pin-cells", &pin_cells, sizeof(pin_cells)) <= 0) + if (OF_getencprop(node, "#pin-cells", &pin_cells, sizeof(pin_cells)) <= 0) pin_cells = MPP_PIN_CELLS; - pin_cells = fdt32_to_cpu(pin_cells); if (pin_cells > MPP_PIN_CELLS) return (ERANGE); tuple_size = sizeof(pcell_t) * pin_cells; bzero(pinmap, sizeof(pinmap)); - len = OF_getprop(node, "pin-map", pinmap, sizeof(pinmap)); + len = OF_getencprop(node, "pin-map", pinmap, sizeof(pinmap)); if (len <= 0) return (ERANGE); if (len % tuple_size) @@ -176,8 +174,8 @@ moveon: bzero(mpp, sizeof(mpp)); pinmap_ptr = pinmap; for (i = 0; i < pins; i++) { - mpp_pin = fdt32_to_cpu(*pinmap_ptr); - mpp_function = fdt32_to_cpu(*(pinmap_ptr + 1)); + mpp_pin = *pinmap_ptr; + mpp_function = *(pinmap_ptr + 1); mpp[mpp_pin] = mpp_function; pinmap_ptr += pin_cells; } @@ -409,12 +407,10 @@ platform_devmap_init(void) if (ofw_bus_node_is_compatible(child, "mrvl,lbc")) { /* Check available space */ - if (OF_getprop(child, "bank-count", (void *)&bank_count, + if (OF_getencprop(child, "bank-count", &bank_count, sizeof(bank_count)) <= 0) /* If no property, use default value */ bank_count = 1; - else - bank_count = fdt32_to_cpu(bank_count); if ((i + bank_count) >= FDT_DEVMAP_MAX) return (ENOMEM); Modified: head/sys/arm/rockchip/rk30xx_gpio.c ============================================================================== --- head/sys/arm/rockchip/rk30xx_gpio.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/rockchip/rk30xx_gpio.c Mon Nov 14 12:03:08 2016 (r308640) @@ -526,10 +526,8 @@ rk30_gpios_prop_handle(phandle_t ctrl, p if (sc == NULL) return ENXIO; - if (OF_getprop(ctrl, "#gpio-cells", &gpio_cells, sizeof(pcell_t)) < 0) + if (OF_getencprop(ctrl, "#gpio-cells", &gpio_cells, sizeof(pcell_t)) < 0) return (ENXIO); - - gpio_cells = fdt32_to_cpu(gpio_cells); if (gpio_cells != 2) return (ENXIO); @@ -546,9 +544,9 @@ rk30_gpios_prop_handle(phandle_t ctrl, p inc = sizeof(ihandle_t) / sizeof(pcell_t); gpios += inc; for (t = 0; t < tuples; t++) { - pin = fdt32_to_cpu(gpios[0]); - dir = fdt32_to_cpu(gpios[1]); - flags = fdt32_to_cpu(gpios[2]); + pin = gpios[0]; + dir = gpios[1]; + flags = gpios[2]; for (i = 0; i < sc->sc_gpio_npins; i++) { if (sc->sc_gpio_pins[i].gp_pin == pin) @@ -601,7 +599,7 @@ rk30_gpio_init(void) return (ENXIO); /* Get 'gpios' property. */ - OF_getprop(child, "gpios", &gpios, len); + OF_getencprop(child, "gpios", gpios, len); e = (struct gpio_ctrl_entry *)&gpio_controllers; @@ -612,7 +610,7 @@ rk30_gpio_init(void) * contain a ref. to a node defining GPIO * controller. */ - ctrl = OF_node_from_xref(fdt32_to_cpu(gpios[0])); + ctrl = OF_node_from_xref(gpios[0]); if (ofw_bus_node_is_compatible(ctrl, e->compat)) /* Call a handler. */ Modified: head/sys/arm/ti/am335x/am335x_lcd.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_lcd.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/ti/am335x/am335x_lcd.c Mon Nov 14 12:03:08 2016 (r308640) @@ -359,13 +359,13 @@ am335x_read_property(device_t dev, phand { pcell_t cell; - if ((OF_getprop(node, name, &cell, sizeof(cell))) <= 0) { + if ((OF_getencprop(node, name, &cell, sizeof(cell))) <= 0) { device_printf(dev, "missing '%s' attribute in LCD panel info\n", name); return (ENXIO); } - *val = fdt32_to_cpu(cell); + *val = cell; return (0); } Modified: head/sys/arm/ti/am335x/am335x_lcd_syscons.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_lcd_syscons.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/ti/am335x/am335x_lcd_syscons.c Mon Nov 14 12:03:08 2016 (r308640) @@ -382,13 +382,13 @@ am335x_syscons_configure(int flags) root = OF_finddevice("/"); if ((root != 0) && (display = am335x_syscons_find_panel_node(root))) { - if ((OF_getprop(display, "panel_width", - &cell, sizeof(cell))) > 0) - va_sc->width = (int)fdt32_to_cpu(cell); - - if ((OF_getprop(display, "panel_height", - &cell, sizeof(cell))) > 0) - va_sc->height = (int)fdt32_to_cpu(cell); + if ((OF_getencprop(display, "panel_width", &cell, + sizeof(cell))) > 0) + va_sc->width = cell; + + if ((OF_getencprop(display, "panel_height", &cell, + sizeof(cell))) > 0) + va_sc->height = cell; } if (va_sc->width == 0) Modified: head/sys/arm/ti/ti_adc.c ============================================================================== --- head/sys/arm/ti/ti_adc.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/ti/ti_adc.c Mon Nov 14 12:03:08 2016 (r308640) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -767,14 +766,17 @@ ti_adc_attach(device_t dev) /* Read "tsc" node properties */ child = ofw_bus_find_child(node, "tsc"); if (child != 0 && OF_hasprop(child, "ti,wires")) { - if ((OF_getprop(child, "ti,wires", &cell, sizeof(cell))) > 0) - sc->sc_tsc_wires = fdt32_to_cpu(cell); - if ((OF_getprop(child, "ti,coordinate-readouts", &cell, sizeof(cell))) > 0) - sc->sc_coord_readouts = fdt32_to_cpu(cell); - if ((OF_getprop(child, "ti,x-plate-resistance", &cell, sizeof(cell))) > 0) - sc->sc_x_plate_resistance = fdt32_to_cpu(cell); - if ((OF_getprop(child, "ti,charge-delay", &cell, sizeof(cell))) > 0) - sc->sc_charge_delay = fdt32_to_cpu(cell); + if ((OF_getencprop(child, "ti,wires", &cell, sizeof(cell))) > 0) + sc->sc_tsc_wires = cell; + if ((OF_getencprop(child, "ti,coordinate-readouts", &cell, + sizeof(cell))) > 0) + sc->sc_coord_readouts = cell; + if ((OF_getencprop(child, "ti,x-plate-resistance", &cell, + sizeof(cell))) > 0) + sc->sc_x_plate_resistance = cell; + if ((OF_getencprop(child, "ti,charge-delay", &cell, + sizeof(cell))) > 0) + sc->sc_charge_delay = cell; nwire_configs = OF_getencprop_alloc(child, "ti,wire-config", sizeof(*wire_configs), (void **)&wire_configs); if (nwire_configs != sc->sc_tsc_wires) { Modified: head/sys/arm/ti/ti_sdhci.c ============================================================================== --- head/sys/arm/ti/ti_sdhci.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/ti/ti_sdhci.c Mon Nov 14 12:03:08 2016 (r308640) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -506,10 +505,10 @@ ti_sdhci_attach(device_t dev) * See if we've got a GPIO-based write detect pin. This is not the * standard documented property for this, we added it in freebsd. */ - if ((OF_getprop(node, "mmchs-wp-gpio-pin", &prop, sizeof(prop))) <= 0) + if ((OF_getencprop(node, "mmchs-wp-gpio-pin", &prop, sizeof(prop))) <= 0) sc->wp_gpio_pin = 0xffffffff; else - sc->wp_gpio_pin = fdt32_to_cpu(prop); + sc->wp_gpio_pin = prop; if (sc->wp_gpio_pin != 0xffffffff) { sc->gpio_dev = devclass_get_device(devclass_find("gpio"), 0); Modified: head/sys/arm/versatile/sp804.c ============================================================================== --- head/sys/arm/versatile/sp804.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/versatile/sp804.c Mon Nov 14 12:03:08 2016 (r308640) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -223,8 +222,8 @@ sp804_timer_attach(device_t dev) sc->sysclk_freq = DEFAULT_FREQUENCY; /* Get the base clock frequency */ node = ofw_bus_get_node(dev); - if ((OF_getprop(node, "clock-frequency", &clock, sizeof(clock))) > 0) { - sc->sysclk_freq = fdt32_to_cpu(clock); + if ((OF_getencprop(node, "clock-frequency", &clock, sizeof(clock))) > 0) { + sc->sysclk_freq = clock; } /* Setup and enable the timer */ Modified: head/sys/arm/xilinx/zy7_slcr.c ============================================================================== --- head/sys/arm/xilinx/zy7_slcr.c Mon Nov 14 11:52:22 2016 (r308639) +++ head/sys/arm/xilinx/zy7_slcr.c Mon Nov 14 12:03:08 2016 (r308640) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -621,8 +620,8 @@ zy7_slcr_attach(device_t dev) /* Derive PLL frequencies from PS_CLK. */ node = ofw_bus_get_node(dev); - if (OF_getprop(node, "clock-frequency", &cell, sizeof(cell)) > 0) - ps_clk_frequency = fdt32_to_cpu(cell); + if (OF_getencprop(node, "clock-frequency", &cell, sizeof(cell)) > 0) + ps_clk_frequency = cell; else ps_clk_frequency = ZYNQ_DEFAULT_PS_CLK_FREQUENCY; From owner-svn-src-head@freebsd.org Mon Nov 14 12:56:19 2016 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 4D800C3D6F9; Mon, 14 Nov 2016 12:56:19 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CC3D12CE; Mon, 14 Nov 2016 12:56:19 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAECuI29082147; Mon, 14 Nov 2016 12:56:18 GMT (envelope-from def@FreeBSD.org) Received: (from def@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAECuI9i082146; Mon, 14 Nov 2016 12:56:18 GMT (envelope-from def@FreeBSD.org) Message-Id: <201611141256.uAECuI9i082146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: def set sender to def@FreeBSD.org using -f From: Konrad Witaszczyk Date: Mon, 14 Nov 2016 12:56:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308641 - head/sys/sys X-SVN-Group: head 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, 14 Nov 2016 12:56:19 -0000 Author: def Date: Mon Nov 14 12:56:18 2016 New Revision: 308641 URL: https://svnweb.freebsd.org/changeset/base/308641 Log: Move text dump version as it's not an architecture version. Reported by: jhb Approved by: pjd (mentor) Modified: head/sys/sys/kerneldump.h Modified: head/sys/sys/kerneldump.h ============================================================================== --- head/sys/sys/kerneldump.h Mon Nov 14 12:03:08 2016 (r308640) +++ head/sys/sys/kerneldump.h Mon Nov 14 12:56:18 2016 (r308641) @@ -64,7 +64,8 @@ struct kerneldumpheader { #define KERNELDUMPMAGIC_CLEARED "Cleared Kernel Dump" char architecture[12]; uint32_t version; -#define KERNELDUMPVERSION 1 +#define KERNELDUMPVERSION 1 +#define KERNELDUMP_TEXT_VERSION 1 uint32_t architectureversion; #define KERNELDUMP_AARCH64_VERSION 1 #define KERNELDUMP_AMD64_VERSION 2 @@ -74,7 +75,6 @@ struct kerneldumpheader { #define KERNELDUMP_POWERPC_VERSION 1 #define KERNELDUMP_RISCV_VERSION 1 #define KERNELDUMP_SPARC64_VERSION 1 -#define KERNELDUMP_TEXT_VERSION 1 uint64_t dumplength; /* excl headers */ uint64_t dumptime; uint32_t blocksize; From owner-svn-src-head@freebsd.org Mon Nov 14 13:20:11 2016 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 93077C3DE6F; Mon, 14 Nov 2016 13:20: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 601C19B; Mon, 14 Nov 2016 13:20: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 uAEDKAeD089936; Mon, 14 Nov 2016 13:20:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAEDKAYN089935; Mon, 14 Nov 2016 13:20:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611141320.uAEDKAYN089935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 14 Nov 2016 13:20:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308642 - head/sys/kern X-SVN-Group: head 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, 14 Nov 2016 13:20:11 -0000 Author: kib Date: Mon Nov 14 13:20:10 2016 New Revision: 308642 URL: https://svnweb.freebsd.org/changeset/base/308642 Log: Initialize reserved bytes in struct mq_attr and its 32compat counterpart, to avoid kernel stack content leak in kmq_setattr(2) syscall. Also slightly simplify the checks around copyout()s. Reported by: Vlad Tsyrklevich PR: 214488 MFC after: 1 week Modified: head/sys/kern/uipc_mqueue.c Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Mon Nov 14 12:56:18 2016 (r308641) +++ head/sys/kern/uipc_mqueue.c Mon Nov 14 13:20:10 2016 (r308642) @@ -2242,10 +2242,10 @@ sys_kmq_setattr(struct thread *td, struc } error = kern_kmq_setattr(td, uap->mqd, uap->attr != NULL ? &attr : NULL, &oattr); - if (error != 0) - return (error); - if (uap->oattr != NULL) + if (error == 0 && uap->oattr != NULL) { + bzero(oattr.__reserved, sizeof(oattr.__reserved)); error = copyout(&oattr, uap->oattr, sizeof(oattr)); + } return (error); } @@ -2759,10 +2759,9 @@ freebsd32_kmq_setattr(struct thread *td, } error = kern_kmq_setattr(td, uap->mqd, uap->attr != NULL ? &attr : NULL, &oattr); - if (error != 0) - return (error); - if (uap->oattr != NULL) { + if (error == 0 && uap->oattr != NULL) { mq_attr_to32(&oattr, &oattr32); + bzero(oattr32.__reserved, sizeof(oattr32.__reserved)); error = copyout(&oattr32, uap->oattr, sizeof(oattr32)); } return (error); From owner-svn-src-head@freebsd.org Mon Nov 14 13:25:49 2016 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 608DEC3F089; Mon, 14 Nov 2016 13:25:49 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mail.made4.biz (mail.made4.biz [IPv6:2001:41d0:2:c018::1:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 247017A7; Mon, 14 Nov 2016 13:25:49 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from 141.7.19.93.rev.sfr.net ([93.19.7.141] helo=magellan.dumbbell.fr) by mail.made4.biz with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1c6HGb-000J8h-S4; Mon, 14 Nov 2016 14:25:47 +0100 Subject: Re: svn commit: r308432 - in head: bin/echo bin/sleep usr.bin/basename usr.bin/dc usr.bin/dirname usr.bin/fold usr.bin/getopt usr.bin/locate/bigram usr.bin/logname usr.bin/printenv usr.bin/yes To: "Conrad E. Meyer" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201611080531.uA85V2DL025382@repo.freebsd.org> From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Message-ID: Date: Mon, 14 Nov 2016 14:25:40 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <201611080531.uA85V2DL025382@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="E0R4dmpv15ohqaFENihLgFM2xpgcaVkLh" 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, 14 Nov 2016 13:25:49 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --E0R4dmpv15ohqaFENihLgFM2xpgcaVkLh Content-Type: multipart/mixed; boundary="khboWtKqTDqWgVT489LeAhxcFLtI53Xkq"; protected-headers="v1" From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= To: "Conrad E. Meyer" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r308432 - in head: bin/echo bin/sleep usr.bin/basename usr.bin/dc usr.bin/dirname usr.bin/fold usr.bin/getopt usr.bin/locate/bigram usr.bin/logname usr.bin/printenv usr.bin/yes References: <201611080531.uA85V2DL025382@repo.freebsd.org> In-Reply-To: <201611080531.uA85V2DL025382@repo.freebsd.org> --khboWtKqTDqWgVT489LeAhxcFLtI53Xkq Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08.11.2016 06:31, Conrad E. Meyer wrote: > Author: cem > Date: Tue Nov 8 05:31:01 2016 > New Revision: 308432 > URL: https://svnweb.freebsd.org/changeset/base/308432 >=20 > Log: > Capsicumize some trivial stdio programs > =20 > Trivially capsicumize some simple programs that just interact with > stdio. This list of programs uses 'pledge("stdio")' in OpenBSD. Hi! fold(1) is broken after this commit: fold -s src/rabbit_ctl_usage.erl.tmp2 fold: src/rabbit_ctl_usage.erl.tmp2: Not permitted in capability mode I don't know how Capsicum works, but fold(1) works with files in addition to stdio, so perhaps caph_limit_stdio() is incorrect for this program. --=20 Jean-S=C3=A9bastien P=C3=A9dron --khboWtKqTDqWgVT489LeAhxcFLtI53Xkq-- --E0R4dmpv15ohqaFENihLgFM2xpgcaVkLh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJYKbtUAAoJEDnpl2Gl/ZTMYpEP/RtQGzr/EGhayKjDJdqyYb35 FzpCH4AJkfQ1Aw3z1yhLIhbp4Ws8gAE0EVhWkocwI/0hMPbmV/Bb9o13nLzWA4NM VmTLz2zeWVDul4rL5uwAtDF3alTTxHvFJpF3UasJ12mTM0LyHyo50LgxCQ2gH5Wh djdwKOgAPyJcf1xIO0nDAlwHyRQwQD2EO+xe42/jzpxNzLBHYgk96fMzaqP4Vr5Q Bl0rqQNcS/4GKFHcOcqCs/wO/93KYReKpv+YYc39G0TaWOkWHAoSdHvVYEZkOdlS 93shiHb8MziysJhy8R6P3Qly2y3IPcpFITEBY9z2XZM1zEKlCVFvmEww8jTH72TU O5Ga+HsJ/I1QjlzPh9Xdh+kwFk+jrljDhz43k3ni7lkVpQkJUOeKYdMckReT1qt9 PZuvEpL5g7z49IYUHQ4IN2cl4RTgPRweEt9NcDX1MKQk9Hvh54R6tHvpUXvSbAgT Oi3SjYGqSnTz22MUW3xLyS6L7Y63LiM51AvrK34hY8kwuuy2qqvY8Av78HmntDa5 29VwO17X7oNhfwf/Mxud7KB6Nxag87bnHOMPMYdSrHUW/srfx2qdCAPx321+9epZ kXVWv3rDjnnkMBY/uxJoYfdk3IXs5fyqx8uavc+ffMypu5VAEbel321rYfXi1tMA 79OTFeqIALftOhb14/+4 =kO53 -----END PGP SIGNATURE----- --E0R4dmpv15ohqaFENihLgFM2xpgcaVkLh-- From owner-svn-src-head@freebsd.org Mon Nov 14 17:19:05 2016 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 055E2C4194C; Mon, 14 Nov 2016 17:19:05 +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 B06271392; Mon, 14 Nov 2016 17:19:04 +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 uAEHJ3TF092702; Mon, 14 Nov 2016 17:19:03 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAEHJ3rq092701; Mon, 14 Nov 2016 17:19:03 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201611141719.uAEHJ3rq092701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Mon, 14 Nov 2016 17:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308643 - head/sys/dev/e1000 X-SVN-Group: head 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, 14 Nov 2016 17:19:05 -0000 Author: sbruno Date: Mon Nov 14 17:19:03 2016 New Revision: 308643 URL: https://svnweb.freebsd.org/changeset/base/308643 Log: Update WOL support for newer em(4) devices. Do not overwrite the contents of the WUC register, add E1000_WUC_PME_EN to the register contents, leaving the default contents intact. PR: 208343 Submitted by: Kaho Toshikazu Reviewed by: jeffrey piper Approved by: erj@ MFC after: 2 weeks Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Nov 14 13:20:10 2016 (r308642) +++ head/sys/dev/e1000/if_em.c Mon Nov 14 17:19:03 2016 (r308643) @@ -5274,6 +5274,8 @@ em_get_wakeup(device_t dev) case e1000_ich10lan: case e1000_pchlan: case e1000_pch2lan: + case e1000_pch_lpt: + case e1000_pch_spt: apme_mask = E1000_WUC_APME; adapter->has_amt = TRUE; eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); @@ -5322,7 +5324,7 @@ em_enable_wakeup(device_t dev) { struct adapter *adapter = device_get_softc(dev); if_t ifp = adapter->ifp; - u32 pmc, ctrl, ctrl_ext, rctl; + u32 pmc, ctrl, ctrl_ext, rctl, wuc; u16 status; if ((pci_find_cap(dev, PCIY_PMG, &pmc) != 0)) @@ -5332,7 +5334,9 @@ em_enable_wakeup(device_t dev) ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); + wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); + wuc |= E1000_WUC_PME_EN; + E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); if ((adapter->hw.mac.type == e1000_ich8lan) || (adapter->hw.mac.type == e1000_pchlan) || @@ -5363,8 +5367,10 @@ em_enable_wakeup(device_t dev) E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); } - if ((adapter->hw.mac.type == e1000_pchlan) || - (adapter->hw.mac.type == e1000_pch2lan)) { + if ((adapter->hw.mac.type == e1000_pchlan) || + (adapter->hw.mac.type == e1000_pch2lan) || + (adapter->hw.mac.type == e1000_pch_lpt) || + (adapter->hw.mac.type == e1000_pch_spt)) { if (em_enable_phy_wakeup(adapter)) return; } else { From owner-svn-src-head@freebsd.org Mon Nov 14 18:30:04 2016 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 9E74BC41914; Mon, 14 Nov 2016 18:30:04 +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 70B11189D; Mon, 14 Nov 2016 18:30:04 +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 uAEIU3RV020977; Mon, 14 Nov 2016 18:30:03 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAEIU35P020976; Mon, 14 Nov 2016 18:30:03 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611141830.uAEIU35P020976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 14 Nov 2016 18:30:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308644 - head/sys/riscv/riscv X-SVN-Group: head 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, 14 Nov 2016 18:30:04 -0000 Author: br Date: Mon Nov 14 18:30:03 2016 New Revision: 308644 URL: https://svnweb.freebsd.org/changeset/base/308644 Log: Check if L2 entry exists for the given VA before loading L3 entry. This is a fix for a panic that was easy to reproduce executing "(/bin/ls &)" in the shell. Sponsored by: DARPA, AFRL Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Mon Nov 14 17:19:03 2016 (r308643) +++ head/sys/riscv/riscv/pmap.c Mon Nov 14 18:30:03 2016 (r308644) @@ -1992,6 +1992,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sv l2 = pmap_l1_to_l2(l1, sva); if (l2 == NULL) continue; + if (pmap_load(l2) == 0) + continue; if ((pmap_load(l2) & PTE_RX) != 0) continue; From owner-svn-src-head@freebsd.org Mon Nov 14 19:53:47 2016 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 ACC4BC40140; Mon, 14 Nov 2016 19:53:47 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78088F9E; Mon, 14 Nov 2016 19:53:47 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAEJrkFG057417; Mon, 14 Nov 2016 19:53:46 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAEJrkjx057416; Mon, 14 Nov 2016 19:53:46 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201611141953.uAEJrkjx057416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 14 Nov 2016 19:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308649 - head/sys/arm/conf X-SVN-Group: head 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, 14 Nov 2016 19:53:47 -0000 Author: loos Date: Mon Nov 14 19:53:46 2016 New Revision: 308649 URL: https://svnweb.freebsd.org/changeset/base/308649 Log: Build the Ti/AM335x DTBs as part of GENERIC kernel. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/conf/GENERIC Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Mon Nov 14 18:57:21 2016 (r308648) +++ head/sys/arm/conf/GENERIC Mon Nov 14 19:53:46 2016 (r308649) @@ -219,4 +219,4 @@ options EFI # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA="dtb/allwinner dtb/nvidia dtb/rpi" +makeoptions MODULES_EXTRA="dtb/allwinner dtb/am335x dtb/nvidia dtb/rpi" From owner-svn-src-head@freebsd.org Mon Nov 14 20:37:08 2016 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 CE782C40D18; Mon, 14 Nov 2016 20:37:08 +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 806B2240; Mon, 14 Nov 2016 20:37:08 +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 uAEKb77J073210; Mon, 14 Nov 2016 20:37:07 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAEKb7LC073207; Mon, 14 Nov 2016 20:37:07 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611142037.uAEKb7LC073207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 14 Nov 2016 20:37:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308650 - in head/sys/dev/rtwn: rtl8192c/usb rtl8812a/usb rtl8821a/usb X-SVN-Group: head 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, 14 Nov 2016 20:37:08 -0000 Author: avos Date: Mon Nov 14 20:37:07 2016 New Revision: 308650 URL: https://svnweb.freebsd.org/changeset/base/308650 Log: rtwn: drop excessive includes. Since rom_defs.h is included in rxxx_var.h there is no need to include both of them. Submitted by: kevlo Modified: head/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Modified: head/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c ============================================================================== --- head/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c Mon Nov 14 19:53:46 2016 (r308649) +++ head/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c Mon Nov 14 20:37:07 2016 (r308650) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c ============================================================================== --- head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c Mon Nov 14 19:53:46 2016 (r308649) +++ head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c Mon Nov 14 20:37:07 2016 (r308650) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c ============================================================================== --- head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Mon Nov 14 19:53:46 2016 (r308649) +++ head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Mon Nov 14 20:37:07 2016 (r308650) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include From owner-svn-src-head@freebsd.org Mon Nov 14 20:57:32 2016 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 31289C410F4; Mon, 14 Nov 2016 20:57:32 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3CA3E13; Mon, 14 Nov 2016 20:57:31 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAEKvVqx081166; Mon, 14 Nov 2016 20:57:31 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAEKvVkZ081165; Mon, 14 Nov 2016 20:57:31 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201611142057.uAEKvVkZ081165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 14 Nov 2016 20:57:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308651 - head/sys/arm/conf X-SVN-Group: head 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, 14 Nov 2016 20:57:32 -0000 Author: loos Date: Mon Nov 14 20:57:30 2016 New Revision: 308651 URL: https://svnweb.freebsd.org/changeset/base/308651 Log: Add the cpsw, the NIC driver for ti/am335x, to GENERIC kernel. While here: - remove 'device mii' - included by miibus; - remove 'device smcphy' - included by miibus; - sorted the network drivers list; - added a comment about miibus based on amd64/GENERIC. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/conf/GENERIC Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Mon Nov 14 20:37:07 2016 (r308650) +++ head/sys/arm/conf/GENERIC Mon Nov 14 20:57:30 2016 (r308651) @@ -182,18 +182,18 @@ device usfs device loop device ether device vlan # 802.1Q VLAN support -device mii device bpf -device emac # 10/100 integrated EMAC controller -device dwc # 10/100/1000 integrated GMAC controller -device awg # 10/100/1000 integrated EMAC controller - -# USB ethernet support, requires miibus -device smcphy -device smsc +# Ethernet NICs that use the common MII bus controller code. +# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus +device awg # 10/100/1000 integrated EMAC controller +device cpsw # TI Common Platform Ethernet Switch (CPSW) +device dwc # 10/100/1000 integrated GMAC controller +device emac # 10/100 integrated EMAC controller +device smsc # SMSC LAN91C111 + # Sound support device sound From owner-svn-src-head@freebsd.org Mon Nov 14 21:38:37 2016 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 B12D5C419C0; Mon, 14 Nov 2016 21:38:37 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6752C68F; Mon, 14 Nov 2016 21:38:37 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAELcaui097101; Mon, 14 Nov 2016 21:38:36 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAELcaVI097099; Mon, 14 Nov 2016 21:38:36 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201611142138.uAELcaVI097099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Mon, 14 Nov 2016 21:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308653 - in head/sys/mips: include mips X-SVN-Group: head 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, 14 Nov 2016 21:38:37 -0000 Author: mizhka Date: Mon Nov 14 21:38:36 2016 New Revision: 308653 URL: https://svnweb.freebsd.org/changeset/base/308653 Log: [MIPS] Print Config7 on boot for several MIPS architectures Config7 contains useful fields, for instance, field AR indicating that the D-cache is configured to avoid cache aliases. This patch brings printing of config7 for MIPS 24K, 74K, 1004K. Reviewed by: adrian Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8514 Modified: head/sys/mips/include/cpufunc.h head/sys/mips/mips/cpu.c Modified: head/sys/mips/include/cpufunc.h ============================================================================== --- head/sys/mips/include/cpufunc.h Mon Nov 14 21:27:18 2016 (r308652) +++ head/sys/mips/include/cpufunc.h Mon Nov 14 21:38:36 2016 (r308653) @@ -249,7 +249,8 @@ MIPS_RW32_COP0_SEL(config5, MIPS_COP_0_C #if defined(CPU_NLM) || defined(BERI_LARGE_TLB) MIPS_RW32_COP0_SEL(config6, MIPS_COP_0_CONFIG, 6); #endif -#if defined(CPU_NLM) || defined(CPU_MIPS1004K) +#if defined(CPU_NLM) || defined(CPU_MIPS1004K) || defined (CPU_MIPS74K) || \ + defined(CPU_MIPS24K) MIPS_RW32_COP0_SEL(config7, MIPS_COP_0_CONFIG, 7); #endif MIPS_RW32_COP0(count, MIPS_COP_0_COUNT); Modified: head/sys/mips/mips/cpu.c ============================================================================== --- head/sys/mips/mips/cpu.c Mon Nov 14 21:27:18 2016 (r308652) +++ head/sys/mips/mips/cpu.c Mon Nov 14 21:38:36 2016 (r308653) @@ -337,6 +337,9 @@ static void cpu_identify(void) { uint32_t cfg0, cfg1, cfg2, cfg3; +#if defined(CPU_MIPS1004K) || defined (CPU_MIPS74K) || defined (CPU_MIPS24K) + uint32_t cfg7; +#endif printf("cpu%d: ", 0); /* XXX per-cpu */ switch (cpuinfo.cpu_vendor) { case MIPS_PRID_CID_MTI: @@ -479,6 +482,11 @@ cpu_identify(void) /* Print Config3 if it contains any useful info */ if (cfg3 & ~(0x80000000)) printf(" Config3=0x%b\n", cfg3, "\20\14ULRI\2SmartMIPS\1TraceLogic"); + +#if defined(CPU_MIPS1004K) || defined (CPU_MIPS74K) || defined (CPU_MIPS24K) + cfg7 = mips_rd_config7(); + printf(" Config7=0x%b\n", cfg7, "\20\40WII\21AR"); +#endif } static struct rman cpu_hardirq_rman; From owner-svn-src-head@freebsd.org Mon Nov 14 22:59:50 2016 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 B2DBDC41F59; Mon, 14 Nov 2016 22:59:50 +0000 (UTC) (envelope-from jmcneill@invisible.ca) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:c:538::194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69D0DFA4; Mon, 14 Nov 2016 22:59:50 +0000 (UTC) (envelope-from jmcneill@invisible.ca) Received: from mfilter22-d.gandi.net (mfilter22-d.gandi.net [217.70.178.150]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id E422EC5A4E; Mon, 14 Nov 2016 23:59:39 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter22-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter22-d.gandi.net (mfilter22-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id eKnFfx1_idZn; Mon, 14 Nov 2016 23:59:38 +0100 (CET) X-Originating-IP: 142.163.95.249 Received: from [192.168.2.99] (stjhnbsu1kw-142163095249.dhcp-dynamic.FibreOP.nb.bellaliant.net [142.163.95.249]) (Authenticated sender: jmcneill@invisible.ca) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 32C96C5A49; Mon, 14 Nov 2016 23:59:36 +0100 (CET) From: Jared McNeill Message-Id: Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r308640 - in head/sys/arm: altera/socfpga broadcom/bcm2835 freescale/imx freescale/vybrid lpc mv rockchip ti ti/am335x versatile xilinx Date: Mon, 14 Nov 2016 18:59:37 -0400 In-Reply-To: <201611141203.uAEC39vY062250@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Andrew Turner References: <201611141203.uAEC39vY062250@repo.freebsd.org> X-Mailer: Apple Mail (2.3251) 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: Mon, 14 Nov 2016 22:59:50 -0000 On Nov 14, 2016, at 8:03 AM, Andrew Turner wrote: > > Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c ... > if (sc->height == 0) { > if ((OF_getprop(display, "broadcom,height", > &cell, sizeof(cell))) > 0) > - sc->height = (int)fdt32_to_cpu(cell); > + sc->height = cell; > } > } Looks like you missed an OF_getprop -> OF_getencprop here. Cheers, Jared From owner-svn-src-head@freebsd.org Mon Nov 14 23:51:29 2016 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 ADA7AC4182D; Mon, 14 Nov 2016 23:51:29 +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 8AAD967A; Mon, 14 Nov 2016 23:51:29 +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 uAENpScq050835; Mon, 14 Nov 2016 23:51:28 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAENpSTC050829; Mon, 14 Nov 2016 23:51:28 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201611142351.uAENpSTC050829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 14 Nov 2016 23:51:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308656 - head/sys/net80211 X-SVN-Group: head 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, 14 Nov 2016 23:51:29 -0000 Author: avos Date: Mon Nov 14 23:51:28 2016 New Revision: 308656 URL: https://svnweb.freebsd.org/changeset/base/308656 Log: net80211: switch from ieee80211_iterate_nodes() to ieee80211_iterate_nodes_vap() where possible; this should make the code a bit cleaner. Modified: head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_tdma.c Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Mon Nov 14 22:39:33 2016 (r308655) +++ head/sys/net80211/ieee80211_adhoc.c Mon Nov 14 23:51:28 2016 (r308656) @@ -120,9 +120,9 @@ adhoc_vattach(struct ieee80211vap *vap) static void sta_leave(void *arg, struct ieee80211_node *ni) { - struct ieee80211vap *vap = arg; + struct ieee80211vap *vap = ni->ni_vap; - if (ni->ni_vap == vap && ni != vap->iv_bss) + if (ni != vap->iv_bss) ieee80211_node_leave(ni); } @@ -164,7 +164,8 @@ adhoc_newstate(struct ieee80211vap *vap, switch (ostate) { case IEEE80211_S_RUN: /* beacon miss */ /* purge station table; entries are stale */ - ieee80211_iterate_nodes(&ic->ic_sta, sta_leave, vap); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + sta_leave, NULL); /* fall thru... */ case IEEE80211_S_INIT: if (vap->iv_des_chan != IEEE80211_CHAN_ANYC && Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Mon Nov 14 22:39:33 2016 (r308655) +++ head/sys/net80211/ieee80211_hostap.c Mon Nov 14 23:51:28 2016 (r308656) @@ -107,9 +107,8 @@ hostap_vattach(struct ieee80211vap *vap) static void sta_disassoc(void *arg, struct ieee80211_node *ni) { - struct ieee80211vap *vap = arg; - if (ni->ni_vap == vap && ni->ni_associd != 0) { + if (ni->ni_associd != 0) { IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DISASSOC, IEEE80211_REASON_ASSOC_LEAVE); ieee80211_node_leave(ni); @@ -119,9 +118,9 @@ sta_disassoc(void *arg, struct ieee80211 static void sta_csa(void *arg, struct ieee80211_node *ni) { - struct ieee80211vap *vap = arg; + struct ieee80211vap *vap = ni->ni_vap; - if (ni->ni_vap == vap && ni->ni_associd != 0) + if (ni->ni_associd != 0) if (ni->ni_inact > vap->iv_inact_init) { ni->ni_inact = vap->iv_inact_init; IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, @@ -132,9 +131,8 @@ sta_csa(void *arg, struct ieee80211_node static void sta_drop(void *arg, struct ieee80211_node *ni) { - struct ieee80211vap *vap = arg; - if (ni->ni_vap == vap && ni->ni_associd != 0) + if (ni->ni_associd != 0) ieee80211_node_leave(ni); } @@ -179,7 +177,8 @@ hostap_newstate(struct ieee80211vap *vap ieee80211_dfs_cac_stop(vap); break; case IEEE80211_S_RUN: - ieee80211_iterate_nodes(&ic->ic_sta, sta_disassoc, vap); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + sta_disassoc, NULL); break; default: break; @@ -195,7 +194,8 @@ hostap_newstate(struct ieee80211vap *vap switch (ostate) { case IEEE80211_S_CSA: case IEEE80211_S_RUN: - ieee80211_iterate_nodes(&ic->ic_sta, sta_disassoc, vap); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + sta_disassoc, NULL); /* * Clear overlapping BSS state; the beacon frame * will be reconstructed on transition to the RUN @@ -289,7 +289,8 @@ hostap_newstate(struct ieee80211vap *vap * Shorten inactivity timer of associated stations * to weed out sta's that don't follow a CSA. */ - ieee80211_iterate_nodes(&ic->ic_sta, sta_csa, vap); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + sta_csa, NULL); /* * Update bss node channel to reflect where * we landed after CSA. @@ -340,7 +341,8 @@ hostap_newstate(struct ieee80211vap *vap * such as capabilities and the negotiated rate * set may/will be wrong). */ - ieee80211_iterate_nodes(&ic->ic_sta, sta_drop, vap); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + sta_drop, NULL); } break; default: Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Mon Nov 14 22:39:33 2016 (r308655) +++ head/sys/net80211/ieee80211_ioctl.c Mon Nov 14 23:51:28 2016 (r308656) @@ -347,7 +347,6 @@ ieee80211_ioctl_getscanresults(struct ie } struct stainforeq { - struct ieee80211vap *vap; struct ieee80211req_sta_info *si; size_t space; }; @@ -366,8 +365,6 @@ get_sta_space(void *arg, struct ieee8021 struct stainforeq *req = arg; size_t ielen; - if (req->vap != ni->ni_vap) - return; if (ni->ni_vap->iv_opmode == IEEE80211_M_HOSTAP && ni->ni_associd == 0) /* only associated stations */ return; @@ -383,8 +380,6 @@ get_sta_info(void *arg, struct ieee80211 size_t ielen, len; uint8_t *cp; - if (req->vap != ni->ni_vap) - return; if (vap->iv_opmode == IEEE80211_M_HOSTAP && ni->ni_associd == 0) /* only associated stations */ return; @@ -472,10 +467,10 @@ getstainfo_common(struct ieee80211vap *v error = 0; req.space = 0; - req.vap = vap; - if (ni == NULL) - ieee80211_iterate_nodes(&ic->ic_sta, get_sta_space, &req); - else + if (ni == NULL) { + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, get_sta_space, + &req); + } else get_sta_space(&req, ni); if (req.space > ireq->i_len) req.space = ireq->i_len; @@ -489,9 +484,10 @@ getstainfo_common(struct ieee80211vap *v goto bad; } req.si = p; - if (ni == NULL) - ieee80211_iterate_nodes(&ic->ic_sta, get_sta_info, &req); - else + if (ni == NULL) { + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + get_sta_info, &req); + } else get_sta_info(&req, ni); ireq->i_len = space - req.space; error = copyout(p, (uint8_t *) ireq->i_data+off, ireq->i_len); Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Mon Nov 14 22:39:33 2016 (r308655) +++ head/sys/net80211/ieee80211_node.c Mon Nov 14 23:51:28 2016 (r308656) @@ -2717,7 +2717,6 @@ done: } struct rssiinfo { - struct ieee80211vap *vap; int rssi_samples; uint32_t rssi_total; }; @@ -2729,8 +2728,6 @@ get_hostap_rssi(void *arg, struct ieee80 struct ieee80211vap *vap = ni->ni_vap; int8_t rssi; - if (info->vap != vap) - return; /* only associated stations */ if (ni->ni_associd == 0) return; @@ -2748,8 +2745,6 @@ get_adhoc_rssi(void *arg, struct ieee802 struct ieee80211vap *vap = ni->ni_vap; int8_t rssi; - if (info->vap != vap) - return; /* only neighbors */ /* XXX check bssid */ if ((ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) == 0) @@ -2769,8 +2764,6 @@ get_mesh_rssi(void *arg, struct ieee8021 struct ieee80211vap *vap = ni->ni_vap; int8_t rssi; - if (info->vap != vap) - return; /* only neighbors that peered successfully */ if (ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) return; @@ -2791,18 +2784,20 @@ ieee80211_getrssi(struct ieee80211vap *v info.rssi_total = 0; info.rssi_samples = 0; - info.vap = vap; switch (vap->iv_opmode) { case IEEE80211_M_IBSS: /* average of all ibss neighbors */ case IEEE80211_M_AHDEMO: /* average of all neighbors */ - ieee80211_iterate_nodes(&ic->ic_sta, get_adhoc_rssi, &info); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, get_adhoc_rssi, + &info); break; case IEEE80211_M_HOSTAP: /* average of all associated stations */ - ieee80211_iterate_nodes(&ic->ic_sta, get_hostap_rssi, &info); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, get_hostap_rssi, + &info); break; #ifdef IEEE80211_SUPPORT_MESH case IEEE80211_M_MBSS: /* average of all mesh neighbors */ - ieee80211_iterate_nodes(&ic->ic_sta, get_mesh_rssi, &info); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, get_mesh_rssi, + &info); break; #endif case IEEE80211_M_MONITOR: /* XXX */ Modified: head/sys/net80211/ieee80211_tdma.c ============================================================================== --- head/sys/net80211/ieee80211_tdma.c Mon Nov 14 22:39:33 2016 (r308655) +++ head/sys/net80211/ieee80211_tdma.c Mon Nov 14 23:51:28 2016 (r308656) @@ -209,9 +209,9 @@ tdma_vdetach(struct ieee80211vap *vap) static void sta_leave(void *arg, struct ieee80211_node *ni) { - struct ieee80211vap *vap = arg; + struct ieee80211vap *vap = ni->ni_vap; - if (ni->ni_vap == vap && ni != vap->iv_bss) + if (ni != vap->iv_bss) ieee80211_node_leave(ni); } @@ -246,7 +246,8 @@ tdma_newstate(struct ieee80211vap *vap, ieee80211_cancel_scan(vap); /* background scan */ if (ostate == IEEE80211_S_RUN) { /* purge station table; entries are stale */ - ieee80211_iterate_nodes(&ic->ic_sta, sta_leave, vap); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + sta_leave, NULL); } if (vap->iv_flags_ext & IEEE80211_FEXT_SCANREQ) { ieee80211_check_scan(vap, From owner-svn-src-head@freebsd.org Tue Nov 15 00:24:19 2016 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 B4BE2C3048E; Tue, 15 Nov 2016 00:24:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84F0F15C3; Tue, 15 Nov 2016 00:24:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF0OIJN063535; Tue, 15 Nov 2016 00:24:18 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF0OIxp063534; Tue, 15 Nov 2016 00:24:18 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201611150024.uAF0OIxp063534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 15 Nov 2016 00:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308657 - head/usr.bin/fold X-SVN-Group: head 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, 15 Nov 2016 00:24:19 -0000 Author: cem Date: Tue Nov 15 00:24:18 2016 New Revision: 308657 URL: https://svnweb.freebsd.org/changeset/base/308657 Log: fold(1): Revert incorrect r308432 As Jean-Sébastien notes, fold(1) requires handling argv-supplied files. That will require a slightly more sophisticated approach. Reported by: dumbbell@ Sponsored by: Dell EMC Isilon Modified: head/usr.bin/fold/fold.c Modified: head/usr.bin/fold/fold.c ============================================================================== --- head/usr.bin/fold/fold.c Mon Nov 14 23:51:28 2016 (r308656) +++ head/usr.bin/fold/fold.c Tue Nov 15 00:24:18 2016 (r308657) @@ -45,7 +45,6 @@ static char sccsid[] = "@(#)fold.c 8.1 ( #include __FBSDID("$FreeBSD$"); -#include #include #include #include @@ -73,9 +72,6 @@ main(int argc, char **argv) (void) setlocale(LC_CTYPE, ""); - if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS)) - err(1, "capsicum"); - width = -1; previous_ch = 0; while ((ch = getopt(argc, argv, "0123456789bsw:")) != -1) { From owner-svn-src-head@freebsd.org Tue Nov 15 00:24:52 2016 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 7BB2EC3051E; Tue, 15 Nov 2016 00:24:52 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com [209.85.214.50]) (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 4D1BA172E; Tue, 15 Nov 2016 00:24:51 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f50.google.com with SMTP id c20so114787472itb.0; Mon, 14 Nov 2016 16:24:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=s5CjC13FyqoRLbIhTqGXPOawNEQBJfXtChayI9C03mI=; b=RZIw5o/P3INcoa/Z30qgu7sfmzzxgv/Wdr9lfXD83JCawtiQCgKLbFbHBM6H+ieqsd seN/rEovZL/3JrzBgrbJNuIlN8U3HOhTiXSPSI244aNQa76i/jufNq/4nXkl7it2h9gO YdV80XplvsRSpDsM3UEVbelBZ0rv/jW+3Y8cFEP5ljj+0wAZ+ilXddVqwKy2++Cp6OvO CjMhgBpuQeEBTAxjtxqySdeGDZAXzbl8eNHF75DOiIAUJPoxQpiUmfHBt3Rfnf7FJTIf wW8uXN3bqZ1lOnFaKg7wL1jfp967BSbFUx8u5SM2FqoIfeLxYFRDZLYHOKZK6tjwzk6j ZcLA== X-Gm-Message-State: ABUngvcr7vhKhoWoPZgV2JMfrUZend/+E3mwV6EPlKsrNqsIJj2pvjz1sbLeQMaY3VEq0A== X-Received: by 10.107.130.197 with SMTP id m66mr26344688ioi.38.1479169490388; Mon, 14 Nov 2016 16:24:50 -0800 (PST) Received: from mail-it0-f49.google.com (mail-it0-f49.google.com. [209.85.214.49]) by smtp.gmail.com with ESMTPSA id l74sm463352ita.15.2016.11.14.16.24.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Nov 2016 16:24:50 -0800 (PST) Received: by mail-it0-f49.google.com with SMTP id q124so136363359itd.1; Mon, 14 Nov 2016 16:24:50 -0800 (PST) X-Received: by 10.107.16.170 with SMTP id 42mr26524135ioq.93.1479169490130; Mon, 14 Nov 2016 16:24:50 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.199 with HTTP; Mon, 14 Nov 2016 16:24:49 -0800 (PST) In-Reply-To: References: <201611080531.uA85V2DL025382@repo.freebsd.org> From: Conrad Meyer Date: Mon, 14 Nov 2016 16:24:49 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r308432 - in head: bin/echo bin/sleep usr.bin/basename usr.bin/dc usr.bin/dirname usr.bin/fold usr.bin/getopt usr.bin/locate/bigram usr.bin/logname usr.bin/printenv usr.bin/yes To: =?UTF-8?B?SmVhbi1Tw6liYXN0aWVuIFDDqWRyb24=?= Cc: src-committers , 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: Tue, 15 Nov 2016 00:24:52 -0000 On Mon, Nov 14, 2016 at 5:25 AM, Jean-S=C3=A9bastien P=C3=A9dron wrote: > On 08.11.2016 06:31, Conrad E. Meyer wrote: >> Author: cem >> Date: Tue Nov 8 05:31:01 2016 >> New Revision: 308432 >> URL: https://svnweb.freebsd.org/changeset/base/308432 >> >> Log: >> Capsicumize some trivial stdio programs >> >> Trivially capsicumize some simple programs that just interact with >> stdio. This list of programs uses 'pledge("stdio")' in OpenBSD. > > Hi! > > fold(1) is broken after this commit: > > fold -s src/rabbit_ctl_usage.erl.tmp2 > fold: src/rabbit_ctl_usage.erl.tmp2: Not permitted in capability mode > > I don't know how Capsicum works, but fold(1) works with files in > addition to stdio, so perhaps caph_limit_stdio() is incorrect for this > program. Hi, Yes, this program is incorrectly capsicumized. My mistake. I have reverted the change to fold(1) in r308657. Thanks, Conrad From owner-svn-src-head@freebsd.org Tue Nov 15 00:58:32 2016 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 A2D20C350AD; Tue, 15 Nov 2016 00:58:32 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7498217A9; Tue, 15 Nov 2016 00:58:32 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF0wV8A075482; Tue, 15 Nov 2016 00:58:31 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF0wV8d075481; Tue, 15 Nov 2016 00:58:31 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201611150058.uAF0wV8d075481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Tue, 15 Nov 2016 00:58:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308659 - head/sys/contrib/vchiq/interface/compat X-SVN-Group: head 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, 15 Nov 2016 00:58:32 -0000 Author: loos Date: Tue Nov 15 00:58:31 2016 New Revision: 308659 URL: https://svnweb.freebsd.org/changeset/base/308659 Log: Reduce dmesg verbosity. Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.c Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.c ============================================================================== --- head/sys/contrib/vchiq/interface/compat/vchi_bsd.c Tue Nov 15 00:28:07 2016 (r308658) +++ head/sys/contrib/vchiq/interface/compat/vchi_bsd.c Tue Nov 15 00:58:31 2016 (r308659) @@ -300,7 +300,6 @@ void sema_sysinit(void *arg) { struct semaphore *s = arg; - printf("sema_sysinit\n"); _sema_init(s, 1); } From owner-svn-src-head@freebsd.org Tue Nov 15 01:34:39 2016 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 6CE1AC402D5; Tue, 15 Nov 2016 01:34:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EE06144A; Tue, 15 Nov 2016 01:34:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF1Yc97090946; Tue, 15 Nov 2016 01:34:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF1YcbE090944; Tue, 15 Nov 2016 01:34:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611150134.uAF1YcbE090944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 15 Nov 2016 01:34:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308661 - in head/sys: conf kern X-SVN-Group: head 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, 15 Nov 2016 01:34:39 -0000 Author: adrian Date: Tue Nov 15 01:34:38 2016 New Revision: 308661 URL: https://svnweb.freebsd.org/changeset/base/308661 Log: [mips] make UMTX_CHAINS configurable at compile time. The default (512) wastes quite a bit of space which doesn't really buy us much on highly embedded systems which don't take a lot of locks in parallel. This makes it at least build time configurable so people can experiment. Modified: head/sys/conf/options head/sys/kern/kern_umtx.c Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Nov 15 01:20:36 2016 (r308660) +++ head/sys/conf/options Tue Nov 15 01:34:38 2016 (r308661) @@ -220,6 +220,7 @@ SYSVSHM opt_sysvipc.h SW_WATCHDOG opt_watchdog.h TURNSTILE_PROFILING UMTX_PROFILING +UMTX_CHAINS opt_global.h VERBOSE_SYSINIT # POSIX kernel options @@ -996,3 +997,4 @@ GPIO_SPI_DEBUG opt_gpio.h EVDEV_SUPPORT opt_evdev.h EVDEV_DEBUG opt_evdev.h UINPUT_DEBUG opt_evdev.h + Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Tue Nov 15 01:20:36 2016 (r308660) +++ head/sys/kern/kern_umtx.c Tue Nov 15 01:34:38 2016 (r308661) @@ -198,7 +198,9 @@ struct umtxq_chain { PRI_MAX_TIMESHARE : (td)->td_user_pri) #define GOLDEN_RATIO_PRIME 2654404609U +#ifndef UMTX_CHAINS #define UMTX_CHAINS 512 +#endif #define UMTX_SHIFTS (__WORD_BIT - 9) #define GET_SHARE(flags) \ From owner-svn-src-head@freebsd.org Tue Nov 15 01:41:46 2016 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 CF5E6C409D8; Tue, 15 Nov 2016 01:41:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A144F1B33; Tue, 15 Nov 2016 01:41:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF1fjJm092906; Tue, 15 Nov 2016 01:41:45 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF1fjkg092905; Tue, 15 Nov 2016 01:41:45 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611150141.uAF1fjkg092905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 15 Nov 2016 01:41:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308662 - head/sys/kern X-SVN-Group: head 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, 15 Nov 2016 01:41:46 -0000 Author: adrian Date: Tue Nov 15 01:41:45 2016 New Revision: 308662 URL: https://svnweb.freebsd.org/changeset/base/308662 Log: [mips] enable relbuf on mips for now to work around page aliasing in mips hardware. Although the higher end MIPS hardware handles cache aliasing issues in hardware, the older cores (r4k, etc) and some compile versions of the newer cores (mips24k, mips34k, mips74k) don't have this feature. This means we end up with some very unfortunate behaviour that was made very obvious by some recent changes to the FFS pager by kib. So, flip this off until we get our MIPS pmap/cache code upgraded to handle aliased pages in software. Discussed with: kib, bsdimp, juli Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Nov 15 01:34:38 2016 (r308661) +++ head/sys/kern/vfs_bio.c Tue Nov 15 01:41:45 2016 (r308662) @@ -4655,7 +4655,24 @@ bdata2bio(struct buf *bp, struct bio *bi } } -static int buf_pager_relbuf; +/* + * The MIPS pmap code currently doesn't handle aliased pages. + * The VIPT caches may not handle page aliasing themselves, leading + * to data corruption. + * + * As such, this code makes a system extremely unhappy if said + * system doesn't support unaliasing the above situation in hardware. + * Some "recent" systems (eg some mips24k/mips74k cores) don't enable + * this feature at build time, so it has to be handled in software. + * + * Once the MIPS pmap/cache code grows to support this function on + * earlier chips, it should be flipped back off. + */ +#ifdef __mips__ +static int buf_pager_relbuf = 1; +#else +static int buf_pager_relbuf = 0; +#endif SYSCTL_INT(_vfs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN, &buf_pager_relbuf, 0, "Make buffer pager release buffers after reading"); From owner-svn-src-head@freebsd.org Tue Nov 15 01:47:38 2016 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 9D514C41016; Tue, 15 Nov 2016 01:47:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78B161014; Tue, 15 Nov 2016 01:47:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF1lbid095222; Tue, 15 Nov 2016 01:47:37 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF1lb3f095221; Tue, 15 Nov 2016 01:47:37 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611150147.uAF1lb3f095221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 15 Nov 2016 01:47:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308663 - head/sys/net80211 X-SVN-Group: head 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, 15 Nov 2016 01:47:38 -0000 Author: adrian Date: Tue Nov 15 01:47:37 2016 New Revision: 308663 URL: https://svnweb.freebsd.org/changeset/base/308663 Log: [net80211] announce 11n capabilities in probe requests in IBSS mode. The 802.11-2012 specification notes that a subset of IEs should be present in IBSS probe requests. This is what (initially) allows nodes to discover that other nodes are 11n capable. Notably - HTCAP, but not HTINFO. This isn't everything required to reliably enable 11n between net80211 peers; there's more work to come. Tested: * AR9380, IBSS+11n mode Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Tue Nov 15 01:41:45 2016 (r308662) +++ head/sys/net80211/ieee80211_output.c Tue Nov 15 01:47:37 2016 (r308663) @@ -2074,6 +2074,7 @@ ieee80211_send_probereq(struct ieee80211 { struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_node *bss; const struct ieee80211_txparam *tp; struct ieee80211_bpf_params params; const struct ieee80211_rateset *rs; @@ -2081,10 +2082,13 @@ ieee80211_send_probereq(struct ieee80211 uint8_t *frm; int ret; + bss = ieee80211_ref_node(vap->iv_bss); + if (vap->iv_state == IEEE80211_S_CAC) { IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, "block %s frame in CAC state", "probe request"); vap->iv_stats.is_tx_badstate++; + ieee80211_free_node(bss); return EIO; /* XXX */ } @@ -2106,6 +2110,7 @@ ieee80211_send_probereq(struct ieee80211 * [tlv] supported rates * [tlv] RSN (optional) * [tlv] extended supported rates + * [tlv] HT cap (optional) * [tlv] WPA (optional) * [tlv] user-specified ie's */ @@ -2113,6 +2118,8 @@ ieee80211_send_probereq(struct ieee80211 ic->ic_headroom + sizeof(struct ieee80211_frame), 2 + IEEE80211_NWID_LEN + 2 + IEEE80211_RATE_SIZE + + sizeof(struct ieee80211_ie_htcap) + + sizeof(struct ieee80211_ie_htinfo) + sizeof(struct ieee80211_ie_wpa) + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) + sizeof(struct ieee80211_ie_wpa) @@ -2122,6 +2129,7 @@ ieee80211_send_probereq(struct ieee80211 if (m == NULL) { vap->iv_stats.is_tx_nobuf++; ieee80211_free_node(ni); + ieee80211_free_node(bss); return ENOMEM; } @@ -2130,6 +2138,27 @@ ieee80211_send_probereq(struct ieee80211 frm = ieee80211_add_rates(frm, rs); frm = ieee80211_add_rsn(frm, vap); frm = ieee80211_add_xrates(frm, rs); + + /* + * Note: we can't use bss; we don't have one yet. + * + * So, we should announce our capabilities + * in this channel mode (2g/5g), not the + * channel details itself. + */ + if ((vap->iv_opmode == IEEE80211_M_IBSS) && + (vap->iv_flags_ht & IEEE80211_FHT_HT)) { + struct ieee80211_channel *c; + + /* + * Get the HT channel that we should try upgrading to. + * If we can do 40MHz then this'll upgrade it appropriately. + */ + c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, + vap->iv_flags_ht); + frm = ieee80211_add_htcap_ch(frm, vap, c); + } + frm = ieee80211_add_wpa(frm, vap); if (vap->iv_appie_probereq != NULL) frm = add_appie(frm, vap->iv_appie_probereq); @@ -2141,6 +2170,7 @@ ieee80211_send_probereq(struct ieee80211 if (m == NULL) { /* NB: cannot happen */ ieee80211_free_node(ni); + ieee80211_free_node(bss); return ENOMEM; } @@ -2157,8 +2187,11 @@ ieee80211_send_probereq(struct ieee80211 IEEE80211_NODE_STAT(ni, tx_mgmt); IEEE80211_DPRINTF(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_DUMPPKTS, - "send probe req on channel %u bssid %s ssid \"%.*s\"\n", - ieee80211_chan2ieee(ic, ic->ic_curchan), ether_sprintf(bssid), + "send probe req on channel %u bssid %s sa %6D da %6D ssid \"%.*s\"\n", + ieee80211_chan2ieee(ic, ic->ic_curchan), + ether_sprintf(bssid), + sa, ":", + da, ":", ssidlen, ssid); memset(¶ms, 0, sizeof(params)); @@ -2173,6 +2206,7 @@ ieee80211_send_probereq(struct ieee80211 params.ibp_power = ni->ni_txpower; ret = ieee80211_raw_output(vap, ni, m, ¶ms); IEEE80211_TX_UNLOCK(ic); + ieee80211_free_node(bss); return (ret); } From owner-svn-src-head@freebsd.org Tue Nov 15 02:36:15 2016 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 1F8AFC41095; Tue, 15 Nov 2016 02:36:15 +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 AA255E3E; Tue, 15 Nov 2016 02:36:14 +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 uAF2aD5b015117; Tue, 15 Nov 2016 02:36:13 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF2aCV8015106; Tue, 15 Nov 2016 02:36:12 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611150236.uAF2aCV8015106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 15 Nov 2016 02:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308664 - in head: contrib/hyperv/tools etc/devd etc/mtree include share/man/man4 sys/conf sys/dev/hyperv/utilities sys/modules/hyperv/utilities usr.sbin/hyperv usr.sbin/hyperv/tools us... X-SVN-Group: head 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, 15 Nov 2016 02:36:15 -0000 Author: sephe Date: Tue Nov 15 02:36:12 2016 New Revision: 308664 URL: https://svnweb.freebsd.org/changeset/base/308664 Log: hyperv/vss: Add driver and tools for VSS VSS stands for "Volume Shadow Copy Service". Unlike virtual machine snapshot, it only takes snapshot for the virtual disks, so both filesystem and applications have to aware of it, and cooperate the whole VSS process. This driver exposes two device files to the userland: /dev/hv_fsvss_dev Normally userland programs should _not_ mess with this device file. It is currently used by the hv_vss_daemon(8), which freezes and thaws the filesystem. NOTE: currently only UFS is supported, if the system mounts _any_ other filesystems, the hv_vss_daemon(8) will veto the VSS process. If hv_vss_daemon(8) was disabled, then this device file must be opened, and proper ioctls must be issued to keep the VSS working. /dev/hv_appvss_dev Userland application can opened this device file to receive the VSS freeze notification, hold the VSS for a while (mainly to flush application data to filesystem), release the VSS process, and receive the VSS thaw notification i.e. applications can run again. The VSS will still work, even if this device file is not opened. However, only filesystem consistency is promised, if this device file is not opened or is not operated properly. hv_vss_daemon(8) is started by devd(8) by default. It can be disabled by editting /etc/devd/hyperv.conf. Submitted by: Hongjiang Zhang Reviewed by: kib, mckusick MFC after: 3 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8224 Added: head/contrib/hyperv/tools/hv_vss_daemon.8 head/contrib/hyperv/tools/hv_vss_daemon.c head/share/man/man4/hv_vss.4 (contents, props changed) head/sys/dev/hyperv/utilities/hv_snapshot.c (contents, props changed) head/sys/dev/hyperv/utilities/hv_snapshot.h (contents, props changed) head/usr.sbin/hyperv/tools/kvp/ head/usr.sbin/hyperv/tools/kvp/Makefile - copied, changed from r308663, head/usr.sbin/hyperv/tools/Makefile head/usr.sbin/hyperv/tools/kvp/Makefile.depend - copied unchanged from r308663, head/usr.sbin/hyperv/tools/Makefile.depend head/usr.sbin/hyperv/tools/vss/ head/usr.sbin/hyperv/tools/vss/Makefile (contents, props changed) head/usr.sbin/hyperv/tools/vss/Makefile.depend (contents, props changed) Deleted: head/usr.sbin/hyperv/tools/Makefile head/usr.sbin/hyperv/tools/Makefile.depend Modified: head/etc/devd/hyperv.conf head/etc/mtree/BSD.include.dist head/include/Makefile head/share/man/man4/Makefile head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/hyperv/utilities/Makefile head/usr.sbin/hyperv/Makefile Added: head/contrib/hyperv/tools/hv_vss_daemon.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/hyperv/tools/hv_vss_daemon.8 Tue Nov 15 02:36:12 2016 (r308664) @@ -0,0 +1,88 @@ +.\" Copyright (c) 2016 Microsoft Corp. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.Dd October 12, 2016 +.Dt HV_VSS_DAEMON 8 +.Os +.Sh NAME +.Nm hv_vss_daemon +.Nd Hyper-V Volume Shadow Copy Service Daemon +.Sh SYNOPSIS +.Nm +.Op Fl dn +.Sh DESCRIPTION +The +.Nm +daemon provides the ability to freeze and thaw the file system for +.Fx +guest partitions running on Hyper-V. +.Pp +Hyper-V allows administrators to backup or restore the +.Fx +guest partition. +Administrators can +use Windows Powershell scripts to backup or restore the +.Fx +VM. +.Pp +The +.Nm +accepts file system freeze and thaw requests from the +.Xr hv_utils 4 +driver and performs the actual file-system operation. +.Pp +The file system freeze and thaw functionality is +useful when the Hyper-V host wants to do live backup of +.Fx +guest. Hyper-V host sends file system freezing request to +.Nm +which conducts the real operation. After successfully freezing file +system, Hyper-V host takes a snapshot of the VM. In the future, +Hyper-V host can restore the +.Fx +VM through that snapshot. +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl d +Run as regular process instead of a daemon for debugging purpose. +.It Fl n +Generate debugging output. +.El +.Sh SEE ALSO +.Xr hv_vmbus 4 , +.Xr hv_utils 4 , +.Xr hv_netvsc 4 , +.Xr hv_storvsc 4 , +.Xr hv_kvp 4 +.Sh HISTORY +The daemon was introduced in October 2016 and developed by Microsoft Corp. +.Sh AUTHORS +.An -nosplit +.Fx +support for +.Nm +was first added by +.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . Added: head/contrib/hyperv/tools/hv_vss_daemon.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/hyperv/tools/hv_vss_daemon.c Tue Nov 15 02:36:12 2016 (r308664) @@ -0,0 +1,275 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hv_snapshot.h" + +#define UNDEF_FREEZE_THAW (0) +#define FREEZE (1) +#define THAW (2) + +#define VSS_LOG(priority, format, args...) do { \ + if (is_debugging == 1) { \ + if (is_daemon == 1) \ + syslog(priority, format, ## args); \ + else \ + printf(format, ## args); \ + } else { \ + if (priority < LOG_DEBUG) { \ + if (is_daemon == 1) \ + syslog(priority, format, ## args); \ + else \ + printf(format, ## args); \ + } \ + } \ + } while(0) + +static int is_daemon = 1; +static int is_debugging = 0; +static int g_ufs_suspend_handle = -1; + +static const char *dev = "/dev"; + +static int +check(void) +{ + struct statfs *mntbuf, *statfsp; + int mntsize; + int i; + + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); + if (mntsize == 0) { + VSS_LOG(LOG_ERR, "There is no mount information\n"); + return (EINVAL); + } + for (i = mntsize - 1; i >= 0; --i) + { + statfsp = &mntbuf[i]; + + if (strncmp(statfsp->f_mntonname, dev, strlen(dev)) == 0) { + continue; /* skip to freeze '/dev' */ + } else if (statfsp->f_flags & MNT_RDONLY) { + continue; /* skip to freeze RDONLY partition */ + } else if (strncmp(statfsp->f_fstypename, "ufs", 3) != 0) { + return (EPERM); /* only UFS can be freezed */ + } + } + + return (0); +} + +static int +freeze(void) +{ + struct statfs *mntbuf, *statfsp; + int mntsize; + int error = 0; + int i; + + g_ufs_suspend_handle = open(_PATH_UFSSUSPEND, O_RDWR); + if (g_ufs_suspend_handle == -1) { + VSS_LOG(LOG_ERR, "unable to open %s", _PATH_UFSSUSPEND); + return (errno); + } + + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); + if (mntsize == 0) { + VSS_LOG(LOG_ERR, "There is no mount information\n"); + return (EINVAL); + } + for (i = mntsize - 1; i >= 0; --i) + { + statfsp = &mntbuf[i]; + + if (strncmp(statfsp->f_mntonname, dev, strlen(dev)) == 0) { + continue; /* skip to freeze '/dev' */ + } else if (statfsp->f_flags & MNT_RDONLY) { + continue; /* skip to freeze RDONLY partition */ + } else if (strncmp(statfsp->f_fstypename, "ufs", 3) != 0) { + continue; /* only UFS can be freezed */ + } + error = ioctl(g_ufs_suspend_handle, UFSSUSPEND, &statfsp->f_fsid); + if (error != 0) { + VSS_LOG(LOG_ERR, "error: %d\n", errno); + error = errno; + } else { + VSS_LOG(LOG_INFO, "Successfully suspend fs: %s\n", + statfsp->f_mntonname); + } + } + + return (error); +} + +/** + * close the opened handle will thaw the FS. + */ +static int +thaw(void) +{ + int error = 0; + if (g_ufs_suspend_handle != -1) { + error = close(g_ufs_suspend_handle); + if (!error) { + g_ufs_suspend_handle = -1; + VSS_LOG(LOG_INFO, "Successfully thaw the fs\n"); + } else { + error = errno; + VSS_LOG(LOG_ERR, "Fail to thaw the fs: " + "%d %s\n", errno, strerror(errno)); + } + } else { + VSS_LOG(LOG_INFO, "The fs has already been thawed\n"); + } + + return (error); +} + +static void +usage(const char* cmd) +{ + fprintf(stderr, "%s: daemon for UFS file system freeze/thaw\n" + " -d : enable debug log printing. Default is disabled.\n" + " -n : run as a regular process instead of a daemon. Default is a daemon.\n" + " -h : print usage.\n", cmd); + exit(1); +} + +int +main(int argc, char* argv[]) +{ + struct hv_vss_opt_msg userdata; + + struct pollfd hv_vss_poll_fd[1]; + uint32_t op; + int ch, r, len, error; + int hv_vss_dev_fd; + + int freeze_thaw = UNDEF_FREEZE_THAW; + while ((ch = getopt(argc, argv, "dnh")) != -1) { + switch (ch) { + case 'n': + /* Run as regular process for debugging purpose. */ + is_daemon = 0; + break; + case 'd': + /* Generate debugging output */ + is_debugging = 1; + break; + case 'h': + default: + usage(argv[0]); + break; + } + } + + openlog("HV_VSS", 0, LOG_USER); + + /* Become daemon first. */ + if (is_daemon == 1) + daemon(1, 0); + else + VSS_LOG(LOG_DEBUG, "Run as regular process.\n"); + + VSS_LOG(LOG_INFO, "HV_VSS starting; pid is: %d\n", getpid()); + + memset(&userdata, 0, sizeof(struct hv_vss_opt_msg)); + /* register the daemon */ + hv_vss_dev_fd = open(VSS_DEV(FS_VSS_DEV_NAME), O_RDWR); + + if (hv_vss_dev_fd < 0) { + VSS_LOG(LOG_ERR, "Fail to open %s, error: %d %s\n", + VSS_DEV(FS_VSS_DEV_NAME), errno, strerror(errno)); + exit(EXIT_FAILURE); + } + hv_vss_poll_fd[0].fd = hv_vss_dev_fd; + hv_vss_poll_fd[0].events = POLLIN | POLLRDNORM; + + while (1) { + r = poll(hv_vss_poll_fd, 1, INFTIM); + + VSS_LOG(LOG_DEBUG, "poll returned r = %d, revent = 0x%x\n", + r, hv_vss_poll_fd[0].revents); + + if (r == 0 || (r < 0 && errno == EAGAIN) || + (r < 0 && errno == EINTR)) { + /* Nothing to read */ + continue; + } + + if (r < 0) { + /* + * For poll return failure other than EAGAIN, + * we want to exit. + */ + VSS_LOG(LOG_ERR, "Poll failed.\n"); + perror("poll"); + exit(EIO); + } + + /* Read from character device */ + error = ioctl(hv_vss_dev_fd, IOCHVVSSREAD, &userdata); + if (error < 0) { + VSS_LOG(LOG_ERR, "Read failed.\n"); + perror("pread"); + exit(EIO); + } + + if (userdata.status != 0) { + VSS_LOG(LOG_ERR, "data read error\n"); + continue; + } + + /* + * We will use the KVP header information to pass back + * the error from this daemon. So, first save the op + * and pool info to local variables. + */ + + op = userdata.opt; + + switch (op) { + case HV_VSS_CHECK: + error = check(); + break; + case HV_VSS_FREEZE: + error = freeze(); + break; + case HV_VSS_THAW: + error = thaw(); + break; + default: + VSS_LOG(LOG_ERR, "Illegal operation: %d\n", op); + error = VSS_FAIL; + } + if (error) + userdata.status = VSS_FAIL; + else + userdata.status = VSS_SUCCESS; + error = ioctl(hv_vss_dev_fd, IOCHVVSSWRITE, &userdata); + if (error != 0) { + VSS_LOG(LOG_ERR, "Fail to write to device\n"); + exit(EXIT_FAILURE); + } else { + VSS_LOG(LOG_INFO, "Send response %d for %s to kernel\n", + userdata.status, op == HV_VSS_FREEZE ? "Freeze" : + (op == HV_VSS_THAW ? "Thaw" : "Check")); + } + } +} Modified: head/etc/devd/hyperv.conf ============================================================================== --- head/etc/devd/hyperv.conf Tue Nov 15 01:47:37 2016 (r308663) +++ head/etc/devd/hyperv.conf Tue Nov 15 02:36:12 2016 (r308664) @@ -17,3 +17,19 @@ notify 10 { match "cdev" "hv_kvp_dev"; action "pkill -x hv_kvp_daemon"; }; + +notify 11 { + match "system" "DEVFS"; + match "subsystem" "CDEV"; + match "type" "CREATE"; + match "cdev" "hv_fsvss_dev"; + action "/usr/sbin/hv_vss_daemon"; +}; + +notify 11 { + match "system" "DEVFS"; + match "subsystem" "CDEV"; + match "type" "DESTROY"; + match "cdev" "hv_fsvss_dev"; + action "pkill -x hv_vss_daemon"; +}; Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Tue Nov 15 01:47:37 2016 (r308663) +++ head/etc/mtree/BSD.include.dist Tue Nov 15 02:36:12 2016 (r308664) @@ -118,6 +118,8 @@ .. hwpmc .. + hyperv + .. ic .. iicbus Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Tue Nov 15 01:47:37 2016 (r308663) +++ head/include/Makefile Tue Nov 15 02:36:12 2016 (r308664) @@ -44,7 +44,7 @@ LDIRS= bsm cam geom net net80211 netgrap LSUBDIRS= cam/ata cam/nvme cam/scsi \ dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ - dev/hwpmc \ + dev/hwpmc dev/hyperv \ dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/utopia dev/vkbd dev/wi \ @@ -155,7 +155,7 @@ copies: .PHONY .META done; \ fi .endfor -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} cd ${.CURDIR}/../sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${DESTDIR}${INCLUDEDIR}/$i @@ -185,6 +185,9 @@ copies: .PHONY .META ${DESTDIR}${INCLUDEDIR}/dev/evdev; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 uinput.h \ ${DESTDIR}${INCLUDEDIR}/dev/evdev + cd ${.CURDIR}/../sys/dev/hyperv/utilities; \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hv_snapshot.h \ + ${DESTDIR}${INCLUDEDIR}/dev/hyperv cd ${.CURDIR}/../sys/dev/pci; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ ${DESTDIR}${INCLUDEDIR}/dev/pci @@ -257,7 +260,7 @@ symlinks: .PHONY .META ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ done .endfor -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/nand:Ndev/pci} +.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/nand:Ndev/pci} cd ${.CURDIR}/../sys/$i; \ for h in *.h; do \ ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ @@ -290,6 +293,11 @@ symlinks: .PHONY .META ln -fs ../../../../sys/dev/evdev/$$h \ ${DESTDIR}${INCLUDEDIR}/dev/evdev; \ done + cd ${.CURDIR}/../sys/dev/hyperv/utilities; \ + for h in hv_snapshot.h; do \ + ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/utilities/$$h \ + ${DESTDIR}${INCLUDEDIR}/dev/hyperv; \ + done cd ${.CURDIR}/../sys/dev/pci; \ for h in pcireg.h; do \ ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/pci/$$h \ Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Tue Nov 15 01:47:37 2016 (r308663) +++ head/share/man/man4/Makefile Tue Nov 15 02:36:12 2016 (r308664) @@ -192,6 +192,7 @@ MAN= aac.4 \ hv_storvsc.4 \ hv_utils.4 \ hv_vmbus.4 \ + hv_vss.4 \ hwpmc.4 \ ichsmb.4 \ ${_ichwd.4} \ Added: head/share/man/man4/hv_vss.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/hv_vss.4 Tue Nov 15 02:36:12 2016 (r308664) @@ -0,0 +1,366 @@ +.\" Copyright (c) 2016 Microsoft Corp. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.Dd October 12, 2016 +.Dt HV_VSS 4 +.Os +.Sh NAME +.Nm hv_vss +.Nd Hyper-V Volume Shadow Copy Service API +.Sh SYNOPSIS +.In dev/hyperv/hv_snapshot.h +.Bd -literal +#define VSS_SUCCESS 0x00000000 +#define VSS_FAIL 0x00000001 + +enum hv_vss_op_t { + HV_VSS_NONE = 0, + HV_VSS_CHECK, + HV_VSS_FREEZE, + HV_VSS_THAW, + HV_VSS_COUNT +}; + +struct hv_vss_opt_msg { + uint32_t opt; /* operation */ + uint32_t status; /* 0 for success, 1 for error */ + uint64_t msgid; /* an ID used to identify the transaction */ + uint8_t reserved[48]; /* reserved values are all zeroes */ +}; +.Ed +.Sh DESCRIPTION +The freeze or thaw functionality of application is important to guarantee +the application consistent backup. On windows platform, VSS is defined to do +live backup. But for VM guest running on Hyper-V, the corresponding VSS is +not defined yet. For example, a running database server instance, it knows when the +applications' freeze/thaw should start or finish. But it is not aware of +the freeze/thaw notification from Hyper-V host. The +.Nm +is designed to notify application freeze/thaw request. +Thus, it plays a role of broker to forward the freeze/thaw command from Hyper-V host +to userland application if it registered VSS service on +.Fx +VM, and sends the result back to Hyper-V host. +.Pp +Generally, +.Xr hv_vss_daemon 8 +takes the responsiblity to freeze/thaw UFS file system, +and it is automatically launched after system boots. When Hyper-V host wants to +take a snapshot of the +.Fx +VM, it will first send VSS capability check to +.Fx +VM. The +.Nm +received the request and forward the request to userland application if it is +registered. Only after +.Nm +received the VSS_SUCCESS response from application, the +.Xr hv_vss_daemon 8 +will be informed to check whether file system freeze/thaw is supported. Any error +occurs during this period, +.Nm +will inform Hyper-V host that VSS is not supported. In addition, there is a default +timeout limit before sending response to Hyper-V host. +If the total response time from application and +.Xr hv_vss_daemon 8 +exceeds this value, timeout +will occurs and VSS unsupported is responsed to Hyper-V host. +.Pp +After Hyper-V host confirmed the +.Fx +VM supports VSS, it will send freeze request to VM, and +.Nm +will first forward it to application. After application finished freezing, it should +inform +.Nm +and file system level freezing will be triggered by +.Xr hv_vss_daemon 8 . After all freezing +on both application and +.Xr hv_vss_daemon 8 +were finished, the +.Nm +will inform Hyper-V host that freezing is done. Of course, there is a timeout limit as +same as VSS capability is set to make sure freezing on +.Fx +VM is not hang. If there is any error occurs or timeout happened, the freezing is failed +on Hyper-V side. +.Pp +Hyper-V host will send thaw request after taking the snapshot, typically, this period is +very short in order not to block the running application. +.Nm +firstly thaw the file system by notifying +.Xr hv_vss_daemon 8 , +then notifies user registered +application. There is also a timeout check before sending response to Hyper-V host. +.Pp +All the default timeout limit used in VSS capability check, freeze or thaw is the same. +It is 15 seconds currently. +.Sh NOTES +.Nm +only support UFS currently. If any of file system partition is non UFS, the VSS capability +check will fail. If application does not register VSS, +.Nm +only support backup for file system level consistent. The device should be closed before it +was opened again. If you want to simultaneously open "/dev/hv_appvss_dev" two or more times, +an error (-1) will be returned, and errno was set. +.Pp +If +.Xr hv_vss_daemon 8 +was killed after system boots, the VSS functionality will not work. +.Sh EXAMPLES +The following is a complete example which does nothing except for waiting 2 seconds when +receiving those notifications from +.Nm +.Bd -literal +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define UNDEF_FREEZE_THAW (0) +#define FREEZE (1) +#define THAW (2) +#define CHECK (3) + +#define VSS_LOG(priority, format, args...) do { \\ + if (is_debugging == 1) { \\ + if (is_daemon == 1) \\ + syslog(priority, format, ## args); \\ + else \\ + printf(format, ## args); \\ + } else { \\ + if (priority < LOG_DEBUG) { \\ + if (is_daemon == 1) \\ + syslog(priority, format, ## args); \\ + else \\ + printf(format, ## args); \\ + } \\ + } \\ + } while(0) + +#define CHECK_TIMEOUT 1 +#define CHECK_FAIL 2 +#define FREEZE_TIMEOUT 1 +#define FREEZE_FAIL 2 +#define THAW_TIMEOUT 1 +#define THAW_FAIL 2 + +static int is_daemon = 1; +static int is_debugging = 0; +static int simu_opt_waiting = 2; // seconds + +#define GENERIC_OPT(TIMEOUT, FAIL) \\ + do { \\ + sleep(simu_opt_waiting); \\ + if (opt == CHECK_TIMEOUT) { \\ + sleep(simu_opt_waiting * 10); \\ + VSS_LOG(LOG_INFO, "%s timeout simulation\\n", \\ + __func__); \\ + return (0); \\ + } else if (opt == CHECK_FAIL) { \\ + VSS_LOG(LOG_INFO, "%s failure simulation\\n", \\ + __func__); \\ + return (CHECK_FAIL); \\ + } else { \\ + VSS_LOG(LOG_INFO, "%s success simulation\\n", \\ + __func__); \\ + return (0); \\ + } \\ + } while (0) + +static int +check(int opt) +{ + GENERIC_OPT(CHECK_TIMEOUT, CHECK_FAIL); +} + +static int +freeze(int opt) +{ + GENERIC_OPT(FREEZE_TIMEOUT, FREEZE_FAIL); +} + +static int +thaw(int opt) +{ + GENERIC_OPT(THAW_TIMEOUT, THAW_FAIL); +} + +static void usage(const char* cmd) { + fprintf(stderr, + "%s -f <0|1|2>: simulate app freeze." + " 0: successful, 1: freeze timeout, 2: freeze failed\\n" + " -c <0|1|2>: simulate vss feature check" + " -t <0|1|2>: simulate app thaw." + " 0: successful, 1: freeze timeout, 2: freeze failed\\n" + " -d : enable debug mode\\n" + " -n : run this tool under non-daemon mode\\n", cmd); +} + +int +main(int argc, char* argv[]) { + int ch, freezesimuop = 0, thawsimuop = 0, checksimuop = 0, fd, r, error; + uint32_t op; + struct pollfd app_vss_fd[1]; + struct hv_vss_opt_msg userdata; + + while ((ch = getopt(argc, argv, "f:c:t:dnh")) != -1) { + switch (ch) { + case 'f': + /* Run as regular process for debugging purpose. */ + freezesimuop = (int)strtol(optarg, NULL, 10); + break; + case 't': + thawsimuop = (int)strtol(optarg, NULL, 10); + break; + case 'c': + checksimuop = (int)strtol(optarg, NULL, 10); + break; + case 'd': + is_debugging = 1; + break; + case 'n': + is_daemon = 0; + break; + case 'h': + default: + usage(argv[0]); + exit(0); + } + } + + openlog("APPVSS", 0, LOG_USER); + /* Become daemon first. */ + if (is_daemon == 1) + daemon(1, 0); + else + VSS_LOG(LOG_DEBUG, "Run as regular process.\\n"); + + VSS_LOG(LOG_INFO, "HV_VSS starting; pid is: %d\\n", getpid()); + + fd = open(VSS_DEV(APP_VSS_DEV_NAME), O_RDWR); + if (fd < 0) { + VSS_LOG(LOG_ERR, "Fail to open %s, error: %d %s\\n", + VSS_DEV(APP_VSS_DEV_NAME), errno, strerror(errno)); + exit(EXIT_FAILURE); + } + app_vss_fd[0].fd = fd; + app_vss_fd[0].events = POLLIN | POLLRDNORM; + + while (1) { + r = poll(app_vss_fd, 1, INFTIM); + + VSS_LOG(LOG_DEBUG, "poll returned r = %d, revent = 0x%x\\n", + r, app_vss_fd[0].revents); + + if (r == 0 || (r < 0 && errno == EAGAIN) || + (r < 0 && errno == EINTR)) { + /* Nothing to read */ + continue; + } + + if (r < 0) { + /* + * For poll return failure other than EAGAIN, + * we want to exit. + */ + VSS_LOG(LOG_ERR, "Poll failed.\\n"); + perror("poll"); + exit(EIO); + } + + /* Read from character device */ + error = ioctl(fd, IOCHVVSSREAD, &userdata); + if (error < 0) { + VSS_LOG(LOG_ERR, "Read failed.\\n"); + perror("pread"); + exit(EIO); + } + + if (userdata.status != 0) { + VSS_LOG(LOG_ERR, "data read error\\n"); + continue; + } + + op = userdata.opt; + + switch (op) { + case HV_VSS_CHECK: + error = check(checksimuop); + break; + case HV_VSS_FREEZE: + error = freeze(freezesimuop); + break; + case HV_VSS_THAW: + error = thaw(thawsimuop); + break; + default: + VSS_LOG(LOG_ERR, "Illegal operation: %d\\n", op); + error = VSS_FAIL; + } + if (error) + userdata.status = VSS_FAIL; + else + userdata.status = VSS_SUCCESS; + error = ioctl(fd, IOCHVVSSWRITE, &userdata); + if (error != 0) { + VSS_LOG(LOG_ERR, "Fail to write to device\\n"); + exit(EXIT_FAILURE); + } else { + VSS_LOG(LOG_INFO, "Send response %d for %s to kernel\\n", + userdata.status, op == HV_VSS_FREEZE ? "Freeze" : + (op == HV_VSS_THAW ? "Thaw" : "Check")); + } + } + return 0; +} +.Sh SEE ALSO +.Xr hv_vss_daemon 8 , +.Xr hv_utils 4 +.Sh HISTORY +The daemon was introduced in October 2016 and developed by Microsoft Corp. +.Sh AUTHORS +.An -nosplit +.Fx +support for +.Nm +was first added by +.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Nov 15 01:47:37 2016 (r308663) +++ head/sys/conf/files.amd64 Tue Nov 15 02:36:12 2016 (r308664) @@ -298,6 +298,7 @@ dev/hyperv/netvsc/if_hn.c optional hy dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv dev/hyperv/utilities/hv_heartbeat.c optional hyperv dev/hyperv/utilities/hv_kvp.c optional hyperv +dev/hyperv/utilities/hv_snapshot.c optional hyperv dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Nov 15 01:47:37 2016 (r308663) +++ head/sys/conf/files.i386 Tue Nov 15 02:36:12 2016 (r308664) @@ -255,6 +255,7 @@ dev/hyperv/netvsc/if_hn.c optional hy dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv dev/hyperv/utilities/hv_heartbeat.c optional hyperv dev/hyperv/utilities/hv_kvp.c optional hyperv +dev/hyperv/utilities/hv_snapshot.c optional hyperv dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv Added: head/sys/dev/hyperv/utilities/hv_snapshot.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Nov 15 02:36:12 2016 (r308664) @@ -0,0 +1,1061 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "hv_util.h" +#include "hv_snapshot.h" +#include "vmbus_if.h" + +#define VSS_MAJOR 5 +#define VSS_MINOR 0 +#define VSS_MSGVER VMBUS_IC_VERSION(VSS_MAJOR, VSS_MINOR) + +#define VSS_FWVER_MAJOR 3 +#define VSS_FWVER VMBUS_IC_VERSION(VSS_FWVER_MAJOR, 0) + +#define TIMEOUT_LIMIT (15) // seconds +enum hv_vss_op { + VSS_OP_CREATE = 0, + VSS_OP_DELETE, + VSS_OP_HOT_BACKUP, + VSS_OP_GET_DM_INFO, + VSS_OP_BU_COMPLETE, + /* + * Following operations are only supported with IC version >= 5.0 + */ + VSS_OP_FREEZE, /* Freeze the file systems in the VM */ + VSS_OP_THAW, /* Unfreeze the file systems */ + VSS_OP_AUTO_RECOVER, + VSS_OP_COUNT /* Number of operations, must be last */ +}; + +/* + * Header for all VSS messages. + */ +struct hv_vss_hdr { + struct vmbus_icmsg_hdr ic_hdr; + uint8_t operation; + uint8_t reserved[7]; +} __packed; + + +/* + * Flag values for the hv_vss_check_feature. Here supports only + * one value. + */ +#define VSS_HBU_NO_AUTO_RECOVERY 0x00000005 + +struct hv_vss_check_feature { + uint32_t flags; +} __packed; + +struct hv_vss_check_dm_info { + uint32_t flags; +} __packed; + +struct hv_vss_msg { + union { + struct hv_vss_hdr vss_hdr; + } hdr; + union { + struct hv_vss_check_feature vss_cf; + struct hv_vss_check_dm_info dm_info; + } body; +} __packed; + +struct hv_vss_req { + struct hv_vss_opt_msg opt_msg; /* used to communicate with daemon */ + struct hv_vss_msg msg; /* used to communicate with host */ +} __packed; + +/* hv_vss debug control */ +static int hv_vss_log = 0; + +#define hv_vss_log_error(...) do { \ + if (hv_vss_log > 0) \ + log(LOG_ERR, "hv_vss: " __VA_ARGS__); \ +} while (0) + +#define hv_vss_log_info(...) do { \ + if (hv_vss_log > 1) \ + log(LOG_INFO, "hv_vss: " __VA_ARGS__); \ +} while (0) + +static const struct vmbus_ic_desc vmbus_vss_descs[] = { + { + .ic_guid = { .hv_guid = { + 0x29, 0x2e, 0xfa, 0x35, 0x23, 0xea, 0x36, 0x42, + 0x96, 0xae, 0x3a, 0x6e, 0xba, 0xcb, 0xa4, 0x40} }, + .ic_desc = "Hyper-V VSS" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Nov 15 03:38:06 2016 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 A1EF6C425A4; Tue, 15 Nov 2016 03:38:06 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EF2417DB; Tue, 15 Nov 2016 03:38:06 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF3c5qN039245; Tue, 15 Nov 2016 03:38:05 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF3c50c039244; Tue, 15 Nov 2016 03:38:05 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201611150338.uAF3c50c039244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 15 Nov 2016 03:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308665 - head/sys/kern X-SVN-Group: head 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, 15 Nov 2016 03:38:06 -0000 Author: mjg Date: Tue Nov 15 03:38:05 2016 New Revision: 308665 URL: https://svnweb.freebsd.org/changeset/base/308665 Log: cache: fix a race between entry removal and demotion The negative list shrinker can demote an entry with only hotlist + neglist locks held. On the other hand entry removal possibly sets the NCF_DVDROP without aformentioned locks held prior to detaching it from the respective netlist., which can lose the update made by the shrinker. Reported and tested by: truckman Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Tue Nov 15 02:36:12 2016 (r308664) +++ head/sys/kern/vfs_cache.c Tue Nov 15 03:38:05 2016 (r308665) @@ -868,6 +868,13 @@ cache_zap_locked(struct namecache *ncp, nc_get_name(ncp), ncp->nc_neghits); } LIST_REMOVE(ncp, nc_hash); + if (!(ncp->nc_flag & NCF_NEGATIVE)) { + TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst); + if (ncp == ncp->nc_vp->v_cache_dd) + ncp->nc_vp->v_cache_dd = NULL; + } else { + cache_negative_remove(ncp, neg_locked); + } if (ncp->nc_flag & NCF_ISDOTDOT) { if (ncp == ncp->nc_dvp->v_cache_dd) ncp->nc_dvp->v_cache_dd = NULL; @@ -878,13 +885,6 @@ cache_zap_locked(struct namecache *ncp, atomic_subtract_rel_long(&numcachehv, 1); } } - if (!(ncp->nc_flag & NCF_NEGATIVE)) { - TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst); - if (ncp == ncp->nc_vp->v_cache_dd) - ncp->nc_vp->v_cache_dd = NULL; - } else { - cache_negative_remove(ncp, neg_locked); - } atomic_subtract_rel_long(&numcache, 1); } From owner-svn-src-head@freebsd.org Tue Nov 15 03:43:12 2016 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 2AB1AC4297A; Tue, 15 Nov 2016 03:43:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBC791ED2; Tue, 15 Nov 2016 03:43:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF3hBu7043092; Tue, 15 Nov 2016 03:43:11 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF3hBb6043091; Tue, 15 Nov 2016 03:43:11 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201611150343.uAF3hBb6043091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 15 Nov 2016 03:43:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308667 - head/sys/kern X-SVN-Group: head 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, 15 Nov 2016 03:43:12 -0000 Author: mjg Date: Tue Nov 15 03:43:10 2016 New Revision: 308667 URL: https://svnweb.freebsd.org/changeset/base/308667 Log: cache: plug a write-only variable in cache_negative_zap_one Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Tue Nov 15 03:40:22 2016 (r308666) +++ head/sys/kern/vfs_cache.c Tue Nov 15 03:43:10 2016 (r308667) @@ -783,7 +783,7 @@ cache_negative_shrink_select(int start, static void cache_negative_zap_one(void) { - struct namecache *ncp, *ncp2, *ncpc; + struct namecache *ncp, *ncp2; struct neglist *neglist; struct mtx *dvlp; struct rwlock *blp; @@ -791,7 +791,6 @@ cache_negative_zap_one(void) if (!mtx_trylock(&ncneg_shrink_lock)) return; - ncpc = NULL; mtx_lock(&ncneg_hot.nl_lock); ncp = TAILQ_FIRST(&ncneg_hot.nl_list); if (ncp != NULL) { From owner-svn-src-head@freebsd.org Tue Nov 15 04:12:20 2016 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 77489C42A5E; Tue, 15 Nov 2016 04:12:20 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A62514ED; Tue, 15 Nov 2016 04:12:20 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF4CJJA054894; Tue, 15 Nov 2016 04:12:19 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF4CJha054892; Tue, 15 Nov 2016 04:12:19 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201611150412.uAF4CJha054892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 15 Nov 2016 04:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308668 - in head/sys: dev/kbdmux modules/kbdmux X-SVN-Group: head 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, 15 Nov 2016 04:12:20 -0000 Author: gonzo Date: Tue Nov 15 04:12:19 2016 New Revision: 308668 URL: https://svnweb.freebsd.org/changeset/base/308668 Log: [evdev] Add evdev support to kbdmux(4) driver To enable event sourcing from kbdmux(4) kern.evdev.rcpt_mask value should have bit 1 set (this is default) Submitted by: Vladimir Kondratiev MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8437 Modified: head/sys/dev/kbdmux/kbdmux.c head/sys/modules/kbdmux/Makefile Modified: head/sys/dev/kbdmux/kbdmux.c ============================================================================== --- head/sys/dev/kbdmux/kbdmux.c Tue Nov 15 03:43:10 2016 (r308667) +++ head/sys/dev/kbdmux/kbdmux.c Tue Nov 15 04:12:19 2016 (r308668) @@ -32,6 +32,7 @@ */ #include "opt_compat.h" +#include "opt_evdev.h" #include "opt_kbd.h" #include "opt_kbdmux.h" @@ -64,6 +65,11 @@ #include +#ifdef EVDEV_SUPPORT +#include +#include +#endif + #define KEYBOARD_NAME "kbdmux" MALLOC_DECLARE(M_KBDMUX); @@ -159,6 +165,11 @@ struct kbdmux_state u_int ks_composed_char; /* composed char code */ u_char ks_prefix; /* AT scan code prefix */ +#ifdef EVDEV_SUPPORT + struct evdev_dev * ks_evdev; + int ks_evdev_state; +#endif + SLIST_HEAD(, kbdmux_kbd) ks_kbds; /* keyboards */ KBDMUX_LOCK_DECL_GLOBAL; @@ -371,6 +382,12 @@ static keyboard_switch_t kbdmuxsw = { .diag = genkbd_diag, }; +#ifdef EVDEV_SUPPORT +static const struct evdev_methods kbdmux_evdev_methods = { + .ev_event = evdev_ev_kbd_event, +}; +#endif + /* * Return the number of found keyboards */ @@ -404,6 +421,10 @@ kbdmux_init(int unit, keyboard_t **kbdp, accentmap_t *accmap = NULL; fkeytab_t *fkeymap = NULL; int error, needfree, fkeymap_size, delay[2]; +#ifdef EVDEV_SUPPORT + struct evdev_dev *evdev; + char phys_loc[NAMELEN]; +#endif if (*kbdp == NULL) { *kbdp = kbd = malloc(sizeof(*kbd), M_KBDMUX, M_NOWAIT | M_ZERO); @@ -464,6 +485,30 @@ kbdmux_init(int unit, keyboard_t **kbdp, delay[1] = kbd->kb_delay2; kbdmux_ioctl(kbd, KDSETREPEAT, (caddr_t)delay); +#ifdef EVDEV_SUPPORT + /* register as evdev provider */ + evdev = evdev_alloc(); + evdev_set_name(evdev, "System keyboard multiplexer"); + snprintf(phys_loc, NAMELEN, KEYBOARD_NAME"%d", unit); + evdev_set_phys(evdev, phys_loc); + evdev_set_id(evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_set_methods(evdev, kbd, &kbdmux_evdev_methods); + evdev_support_event(evdev, EV_SYN); + evdev_support_event(evdev, EV_KEY); + evdev_support_event(evdev, EV_LED); + evdev_support_event(evdev, EV_REP); + evdev_support_all_known_keys(evdev); + evdev_support_led(evdev, LED_NUML); + evdev_support_led(evdev, LED_CAPSL); + evdev_support_led(evdev, LED_SCROLLL); + + if (evdev_register(evdev)) + evdev_free(evdev); + else + state->ks_evdev = evdev; + state->ks_evdev_state = 0; +#endif + KBD_INIT_DONE(kbd); } @@ -532,6 +577,10 @@ kbdmux_term(keyboard_t *kbd) kbd_unregister(kbd); +#ifdef EVDEV_SUPPORT + evdev_free(state->ks_evdev); +#endif + KBDMUX_LOCK_DESTROY(state); bzero(state, sizeof(*state)); free(state, M_KBDMUX); @@ -694,6 +743,20 @@ next_code: kbd->kb_count ++; +#ifdef EVDEV_SUPPORT + /* push evdev event */ + if (evdev_rcpt_mask & EVDEV_RCPT_KBDMUX && state->ks_evdev != NULL) { + uint16_t key = evdev_scancode2key(&state->ks_evdev_state, + scancode); + + if (key != KEY_RESERVED) { + evdev_push_event(state->ks_evdev, EV_KEY, + key, scancode & 0x80 ? 0 : 1); + evdev_sync(state->ks_evdev); + } + } +#endif + /* return the byte as is for the K_RAW mode */ if (state->ks_mode == K_RAW) { KBDMUX_UNLOCK(state); @@ -1120,7 +1183,11 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd } KBD_LED_VAL(kbd) = *(int *)arg; - +#ifdef EVDEV_SUPPORT + if (state->ks_evdev != NULL && + evdev_rcpt_mask & EVDEV_RCPT_KBDMUX) + evdev_push_leds(state->ks_evdev, *(int *)arg); +#endif /* KDSETLED on all slave keyboards */ SLIST_FOREACH(k, &state->ks_kbds, next) (void)kbdd_ioctl(k->kbd, KDSETLED, arg); @@ -1197,7 +1264,11 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd kbd->kb_delay1 = delays[(mode >> 5) & 3]; kbd->kb_delay2 = rates[mode & 0x1f]; - +#ifdef EVDEV_SUPPORT + if (state->ks_evdev != NULL && + evdev_rcpt_mask & EVDEV_RCPT_KBDMUX) + evdev_push_repeats(state->ks_evdev, kbd); +#endif /* perform command on all slave keyboards */ SLIST_FOREACH(k, &state->ks_kbds, next) (void)kbdd_ioctl(k->kbd, cmd, arg); @@ -1396,4 +1467,6 @@ kbdmux_modevent(module_t mod, int type, } DEV_MODULE(kbdmux, kbdmux_modevent, NULL); - +#ifdef EVDEV_SUPPORT +MODULE_DEPEND(kbdmux, evdev, 1, 1, 1); +#endif Modified: head/sys/modules/kbdmux/Makefile ============================================================================== --- head/sys/modules/kbdmux/Makefile Tue Nov 15 03:43:10 2016 (r308667) +++ head/sys/modules/kbdmux/Makefile Tue Nov 15 04:12:19 2016 (r308668) @@ -4,7 +4,8 @@ .PATH: ${.CURDIR}/../../dev/kbdmux KMOD= kbdmux -SRCS= kbdmux.c opt_compat.h opt_kbd.h opt_kbdmux.h bus_if.h device_if.h +SRCS= kbdmux.c opt_compat.h opt_evdev.h opt_kbd.h opt_kbdmux.h bus_if.h \ + device_if.h .if !defined(KERNBUILDDIR) opt_compat.h: From owner-svn-src-head@freebsd.org Tue Nov 15 04:49:27 2016 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 97A10C42FD0; Tue, 15 Nov 2016 04:49:27 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66CFEBF1; Tue, 15 Nov 2016 04:49:27 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF4nQkf066873; Tue, 15 Nov 2016 04:49:26 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF4nQYp066872; Tue, 15 Nov 2016 04:49:26 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201611150449.uAF4nQYp066872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 15 Nov 2016 04:49:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308669 - head/sys/powerpc/mpc85xx X-SVN-Group: head 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, 15 Nov 2016 04:49:27 -0000 Author: jhibbits Date: Tue Nov 15 04:49:26 2016 New Revision: 308669 URL: https://svnweb.freebsd.org/changeset/base/308669 Log: Write to the correct GPIO registers. Offset 0 is the direction register, not the data register. MFC after: 1 week Modified: head/sys/powerpc/mpc85xx/qoriq_gpio.c Modified: head/sys/powerpc/mpc85xx/qoriq_gpio.c ============================================================================== --- head/sys/powerpc/mpc85xx/qoriq_gpio.c Tue Nov 15 04:12:19 2016 (r308668) +++ head/sys/powerpc/mpc85xx/qoriq_gpio.c Tue Nov 15 04:49:26 2016 (r308669) @@ -173,7 +173,7 @@ qoriq_gpio_pin_set(device_t dev, uint32_ outvals = bus_read_4(sc->sc_mem, GPIO_GPDAT); outvals &= ~(1 << pinbit); outvals |= (value << pinbit); - bus_write_4(sc->sc_mem, 0, outvals); + bus_write_4(sc->sc_mem, GPIO_GPDAT, outvals); GPIO_UNLOCK(sc); @@ -208,7 +208,7 @@ qoriq_gpio_pin_toggle(device_t dev, uint val = bus_read_4(sc->sc_mem, GPIO_GPDAT); val ^= (1 << (31 - pin)); - bus_write_4(sc->sc_mem, 0, val); + bus_write_4(sc->sc_mem, GPIO_GPDAT, val); GPIO_UNLOCK(sc); From owner-svn-src-head@freebsd.org Tue Nov 15 05:05:53 2016 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 49B19C3F72E; Tue, 15 Nov 2016 05:05:53 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15C131484; Tue, 15 Nov 2016 05:05:53 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF55qRw074495; Tue, 15 Nov 2016 05:05:52 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF55qGx074494; Tue, 15 Nov 2016 05:05:52 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201611150505.uAF55qGx074494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 15 Nov 2016 05:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308670 - head/sys/powerpc/conf X-SVN-Group: head 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, 15 Nov 2016 05:05:53 -0000 Author: jhibbits Date: Tue Nov 15 05:05:51 2016 New Revision: 308670 URL: https://svnweb.freebsd.org/changeset/base/308670 Log: Add sdhci and mmc drivers to MPC85XX/MPC85XXSPE sdhci was missing from MPC85XXSPE, and mmc/mmcsd were missing from both. Modified: head/sys/powerpc/conf/MPC85XX head/sys/powerpc/conf/MPC85XXSPE Modified: head/sys/powerpc/conf/MPC85XX ============================================================================== --- head/sys/powerpc/conf/MPC85XX Tue Nov 15 04:49:26 2016 (r308669) +++ head/sys/powerpc/conf/MPC85XX Tue Nov 15 05:05:51 2016 (r308670) @@ -81,6 +81,8 @@ device iicbus device loop device md device miibus +device mmc +device mmcsd device pass device pci device quicc Modified: head/sys/powerpc/conf/MPC85XXSPE ============================================================================== --- head/sys/powerpc/conf/MPC85XXSPE Tue Nov 15 04:49:26 2016 (r308669) +++ head/sys/powerpc/conf/MPC85XXSPE Tue Nov 15 05:05:51 2016 (r308670) @@ -81,6 +81,8 @@ device iicbus device loop device md device miibus +device mmc +device mmcsd device pass device pci device quicc @@ -88,6 +90,7 @@ device random #device rl device scbus device scc +device sdhci device sec device tsec device dpaa From owner-svn-src-head@freebsd.org Tue Nov 15 06:37:45 2016 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 4013BC42B20; Tue, 15 Nov 2016 06:37:45 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F7CB1390; Tue, 15 Nov 2016 06:37:44 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF6biN6010175; Tue, 15 Nov 2016 06:37:44 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF6bi1S010174; Tue, 15 Nov 2016 06:37:44 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201611150637.uAF6bi1S010174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Tue, 15 Nov 2016 06:37:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308671 - head/share/zoneinfo X-SVN-Group: head 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, 15 Nov 2016 06:37:45 -0000 Author: julian Date: Tue Nov 15 06:37:44 2016 New Revision: 308671 URL: https://svnweb.freebsd.org/changeset/base/308671 Log: When you select make OLDTIMEZONES=1 then you need a few added directories to be made or the command fails Sponsored by: panzura Modified: head/share/zoneinfo/Makefile Modified: head/share/zoneinfo/Makefile ============================================================================== --- head/share/zoneinfo/Makefile Tue Nov 15 05:05:51 2016 (r308670) +++ head/share/zoneinfo/Makefile Tue Nov 15 06:37:44 2016 (r308671) @@ -67,6 +67,10 @@ TZBUILDSUBDIRS= \ Pacific \ SystemV +.if defined(OLDTIMEZONES) +TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil +.endif + .if !defined(_SKIP_BUILD) all: zoneinfo .endif From owner-svn-src-head@freebsd.org Tue Nov 15 07:08:34 2016 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 85F25C42523; Tue, 15 Nov 2016 07:08:34 +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 5DA7F1E8; Tue, 15 Nov 2016 07:08:34 +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 uAF78Xdp022179; Tue, 15 Nov 2016 07:08:33 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF78XBN022176; Tue, 15 Nov 2016 07:08:33 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201611150708.uAF78XBN022176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 15 Nov 2016 07:08:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308672 - in head/sys: arm/allwinner arm/allwinner/clk boot/fdt/dts/arm X-SVN-Group: head 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, 15 Nov 2016 07:08:34 -0000 Author: manu Date: Tue Nov 15 07:08:33 2016 New Revision: 308672 URL: https://svnweb.freebsd.org/changeset/base/308672 Log: Upstream DTS provides PLL3 and PLL7 nodes (and their x2 form), so remove them from our DTS and adapt the code to handle them correctly. This fix HDMI video on A20. Modified: head/sys/arm/allwinner/a10_hdmi.c head/sys/arm/allwinner/clk/aw_pll.c head/sys/boot/fdt/dts/arm/sun7i-a20-hdmi.dtsi Modified: head/sys/arm/allwinner/a10_hdmi.c ============================================================================== --- head/sys/arm/allwinner/a10_hdmi.c Tue Nov 15 06:37:44 2016 (r308671) +++ head/sys/arm/allwinner/a10_hdmi.c Tue Nov 15 07:08:33 2016 (r308672) @@ -581,7 +581,7 @@ a10hdmi_get_tcon_config(struct a10hdmi_s /* Detect LCD CH1 special clock using a 1X or 2X source */ /* XXX */ pname = clk_get_name(clk_lcd_parent); - if (strcmp(pname, "pll3-1x") == 0 || strcmp(pname, "pll7-1x") == 0) + if (strcmp(pname, "pll3") == 0 || strcmp(pname, "pll7") == 0) *dbl = 0; else *dbl = 1; Modified: head/sys/arm/allwinner/clk/aw_pll.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_pll.c Tue Nov 15 06:37:44 2016 (r308671) +++ head/sys/arm/allwinner/clk/aw_pll.c Tue Nov 15 07:08:33 2016 (r308672) @@ -180,9 +180,6 @@ __FBSDID("$FreeBSD$"); #define H3_PLL2_PRE_DIV (0x1f << 0) #define H3_PLL2_PRE_DIV_SHIFT 0 -#define CLKID_A10_PLL3_1X 0 -#define CLKID_A10_PLL3_2X 1 - #define CLKID_A10_PLL5_DDR 0 #define CLKID_A10_PLL5_OTHER 1 @@ -476,9 +473,6 @@ a10_pll3_recalc(struct aw_pll_sc *sc, ui *freq = 297000000; } - if (sc->id == CLKID_A10_PLL3_2X) - *freq *= 2; - return (0); } @@ -489,14 +483,10 @@ a10_pll3_set_freq(struct aw_pll_sc *sc, uint32_t val, m, mode, func; m = *fout / A10_PLL3_REF_FREQ; - if (sc->id == CLKID_A10_PLL3_2X) - m /= 2; mode = A10_PLL3_MODE_SEL_INT; func = 0; *fout = m * A10_PLL3_REF_FREQ; - if (sc->id == CLKID_A10_PLL3_2X) - *fout *= 2; DEVICE_LOCK(sc); PLL_READ(sc, &val); Modified: head/sys/boot/fdt/dts/arm/sun7i-a20-hdmi.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/sun7i-a20-hdmi.dtsi Tue Nov 15 06:37:44 2016 (r308671) +++ head/sys/boot/fdt/dts/arm/sun7i-a20-hdmi.dtsi Tue Nov 15 07:08:33 2016 (r308672) @@ -28,25 +28,11 @@ / { clocks { - pll3: clk@01c20010 { - #clock-cells = <1>; - compatible = "allwinner,sun4i-a10-pll3-clk"; - reg = <0x01c20010 0x4>; - clock-output-names = "pll3-1x", "pll3-2x"; - }; - - pll7: clk@01c20030 { - #clock-cells = <1>; - compatible = "allwinner,sun4i-a10-pll3-clk"; - reg = <0x01c20030 0x4>; - clock-output-names = "pll7-1x", "pll7-2x"; - }; - hdmi_clk: clk@01c20150 { #clock-cells = <0>; compatible = "allwinner,sun4i-a10-hdmi-clk"; reg = <0x01c20150 0x4>; - clocks = <&pll3 0>, <&pll7 0>, <&pll3 1>, <&pll7 1>; + clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll7x2>; clock-output-names = "hdmi"; }; @@ -55,7 +41,7 @@ #reset-cells = <0>; compatible = "allwinner,sun4i-a10-lcd-ch0-clk"; reg = <0x01c20118 0x4>; - clocks = <&pll3 0>, <&pll7 0>, <&pll3 1>, <&pll6 2>; + clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll6 2>; clock-output-names = "lcd0_ch0"; }; @@ -63,7 +49,7 @@ #clock-cells = <1>; compatible = "allwinner,sun4i-a10-lcd-ch1-clk"; reg = <0x01c2012c 0x4>; - clocks = <&pll3 0>, <&pll7 0>, <&pll3 1>, <&pll7 1>; + clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll7x2>; clock-output-names = "lcd0_ch1_sclk1", "lcd0_ch1_sclk2"; }; @@ -73,7 +59,7 @@ #reset-cells = <0>; compatible = "allwinner,sun4i-a10-de-be-clk"; reg = <0x01c20104 0x4>; - clocks = <&pll3 0>, <&pll7 0>, <&pll5 1>; + clocks = <&pll3>, <&pll7>, <&pll5 1>; clock-output-names = "de_be0"; }; }; From owner-svn-src-head@freebsd.org Tue Nov 15 07:13:17 2016 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 E0286C42829; Tue, 15 Nov 2016 07:13:17 +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 A47B79A8; Tue, 15 Nov 2016 07:13:17 +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 uAF7DGs8025893; Tue, 15 Nov 2016 07:13:16 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF7DGIU025890; Tue, 15 Nov 2016 07:13:16 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201611150713.uAF7DGIU025890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 15 Nov 2016 07:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308673 - head/sbin/ipfw X-SVN-Group: head 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, 15 Nov 2016 07:13:18 -0000 Author: ae Date: Tue Nov 15 07:13:16 2016 New Revision: 308673 URL: https://svnweb.freebsd.org/changeset/base/308673 Log: Add missing support of named lookup tables to the IPv6 code. PR: 214419 MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h head/sbin/ipfw/ipv6.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Nov 15 07:08:33 2016 (r308672) +++ head/sbin/ipfw/ipfw2.c Tue Nov 15 07:13:16 2016 (r308673) @@ -2910,8 +2910,9 @@ pack_table(struct tidx *tstate, char *na return (pack_object(tstate, name, IPFW_TLV_TBL_NAME)); } -static void -fill_table(ipfw_insn *cmd, char *av, uint8_t opcode, struct tidx *tstate) +void +fill_table(struct _ipfw_insn *cmd, char *av, uint8_t opcode, + struct tidx *tstate) { uint32_t *d = ((ipfw_insn_u32 *)cmd)->d; uint16_t uidx; @@ -3570,7 +3571,7 @@ add_src(ipfw_insn *cmd, char *av, u_char if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || inet_pton(AF_INET6, host, &a) == 1) - ret = add_srcip6(cmd, av, cblen); + ret = add_srcip6(cmd, av, cblen, tstate); /* XXX: should check for IPv4, not !IPv6 */ if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 || inet_pton(AF_INET6, host, &a) != 1)) @@ -3601,7 +3602,7 @@ add_dst(ipfw_insn *cmd, char *av, u_char if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || inet_pton(AF_INET6, host, &a) == 1) - ret = add_dstip6(cmd, av, cblen); + ret = add_dstip6(cmd, av, cblen, tstate); /* XXX: should check for IPv4, not !IPv6 */ if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 || inet_pton(AF_INET6, host, &a) != 1)) @@ -4670,14 +4671,14 @@ read_options: case TOK_SRCIP6: NEED1("missing source IP6"); - if (add_srcip6(cmd, *av, cblen)) { + if (add_srcip6(cmd, *av, cblen, tstate)) { av++; } break; case TOK_DSTIP6: NEED1("missing destination IP6"); - if (add_dstip6(cmd, *av, cblen)) { + if (add_dstip6(cmd, *av, cblen, tstate)) { av++; } break; Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Tue Nov 15 07:08:33 2016 (r308672) +++ head/sbin/ipfw/ipfw2.h Tue Nov 15 07:13:16 2016 (r308673) @@ -396,8 +396,11 @@ void print_flow6id(struct buf_pr *bp, st void print_icmp6types(struct buf_pr *bp, struct _ipfw_insn_u32 *cmd); void print_ext6hdr(struct buf_pr *bp, struct _ipfw_insn *cmd ); -struct _ipfw_insn *add_srcip6(struct _ipfw_insn *cmd, char *av, int cblen); -struct _ipfw_insn *add_dstip6(struct _ipfw_insn *cmd, char *av, int cblen); +struct tidx; +struct _ipfw_insn *add_srcip6(struct _ipfw_insn *cmd, char *av, int cblen, + struct tidx *tstate); +struct _ipfw_insn *add_dstip6(struct _ipfw_insn *cmd, char *av, int cblen, + struct tidx *tstate); void fill_flow6(struct _ipfw_insn_u32 *cmd, char *av, int cblen); void fill_unreach6_code(u_short *codep, char *str); @@ -406,6 +409,8 @@ int fill_ext6hdr(struct _ipfw_insn *cmd, /* ipfw2.c */ void bp_flush(struct buf_pr *b); +void fill_table(struct _ipfw_insn *cmd, char *av, uint8_t opcode, + struct tidx *tstate); /* tables.c */ struct _ipfw_obj_ctlv; Modified: head/sbin/ipfw/ipv6.c ============================================================================== --- head/sbin/ipfw/ipv6.c Tue Nov 15 07:08:33 2016 (r308672) +++ head/sbin/ipfw/ipv6.c Tue Nov 15 07:13:16 2016 (r308673) @@ -335,7 +335,7 @@ lookup_host6 (char *host, struct in6_add * Return 1 on success, 0 on failure. */ static int -fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen) +fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, struct tidx *tstate) { int len = 0; struct in6_addr *d = &(cmd->addr6); @@ -361,18 +361,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, i } if (strncmp(av, "table(", 6) == 0) { - char *p = strchr(av + 6, ','); - uint32_t *dm = ((ipfw_insn_u32 *)cmd)->d; - - if (p) - *p++ = '\0'; - cmd->o.opcode = O_IP_DST_LOOKUP; - cmd->o.arg1 = strtoul(av + 6, NULL, 0); - if (p) { - cmd->o.len |= F_INSN_SIZE(ipfw_insn_u32); - dm[0] = strtoul(p, NULL, 0); - } else - cmd->o.len |= F_INSN_SIZE(ipfw_insn); + fill_table(&cmd->o, av, O_IP_DST_LOOKUP, tstate); return (1); } @@ -498,10 +487,10 @@ fill_flow6( ipfw_insn_u32 *cmd, char *av } ipfw_insn * -add_srcip6(ipfw_insn *cmd, char *av, int cblen) +add_srcip6(ipfw_insn *cmd, char *av, int cblen, struct tidx *tstate) { - fill_ip6((ipfw_insn_ip6 *)cmd, av, cblen); + fill_ip6((ipfw_insn_ip6 *)cmd, av, cblen, tstate); if (cmd->opcode == O_IP_DST_SET) /* set */ cmd->opcode = O_IP_SRC_SET; else if (cmd->opcode == O_IP_DST_LOOKUP) /* table */ @@ -520,10 +509,10 @@ add_srcip6(ipfw_insn *cmd, char *av, int } ipfw_insn * -add_dstip6(ipfw_insn *cmd, char *av, int cblen) +add_dstip6(ipfw_insn *cmd, char *av, int cblen, struct tidx *tstate) { - fill_ip6((ipfw_insn_ip6 *)cmd, av, cblen); + fill_ip6((ipfw_insn_ip6 *)cmd, av, cblen, tstate); if (cmd->opcode == O_IP_DST_SET) /* set */ ; else if (cmd->opcode == O_IP_DST_LOOKUP) /* table */ From owner-svn-src-head@freebsd.org Tue Nov 15 09:20:29 2016 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 B077BC43A8D; Tue, 15 Nov 2016 09:20:29 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FD671C8A; Tue, 15 Nov 2016 09:20:29 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAF9KSZw074525; Tue, 15 Nov 2016 09:20:28 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF9KSCj074524; Tue, 15 Nov 2016 09:20:28 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611150920.uAF9KSCj074524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Tue, 15 Nov 2016 09:20:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308686 - head/share/misc X-SVN-Group: head 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, 15 Nov 2016 09:20:29 -0000 Author: dexuan Date: Tue Nov 15 09:20:28 2016 New Revision: 308686 URL: https://svnweb.freebsd.org/changeset/base/308686 Log: Add myself (dexuan) as a src committer and sephe as my mentor. Approved by: sephe (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Tue Nov 15 09:00:01 2016 (r308685) +++ head/share/misc/committers-src.dot Tue Nov 15 09:20:28 2016 (r308686) @@ -146,6 +146,7 @@ dchagin [label="Dmitry Chagin\ndchagin@F def [label="Konrad Witaszczyk\ndef@FreeBSD.org\n2016/11/02"] delphij [label="Xin Li\ndelphij@FreeBSD.org\n2004/09/14"] des [label="Dag-Erling Smorgrav\ndes@FreeBSD.org\n1998/04/03"] +dexuan [label="Dexuan Cui\ndexuan@FreeBSD.org\n2016/10/24"] dfr [label="Doug Rabson\ndfr@FreeBSD.org\n????/??/??"] dg [label="David Greenman\ndg@FreeBSD.org\n1993/06/14"] dim [label="Dimitry Andric\ndim@FreeBSD.org\n2010/08/30"] @@ -755,6 +756,8 @@ scottl -> sbruno scottl -> slm scottl -> yongari +sephe -> dexuan + sheldonh -> dwmalone sheldonh -> iedowse From owner-svn-src-head@freebsd.org Tue Nov 15 09:37:36 2016 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 D0102C41141; Tue, 15 Nov 2016 09:37:36 +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 9CD0DA59; Tue, 15 Nov 2016 09:37:36 +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 uAF9bZDg082364; Tue, 15 Nov 2016 09:37:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF9bZPg082363; Tue, 15 Nov 2016 09:37:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611150937.uAF9bZPg082363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 15 Nov 2016 09:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308687 - head/libexec/rtld-elf X-SVN-Group: head 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, 15 Nov 2016 09:37:36 -0000 Author: kib Date: Tue Nov 15 09:37:35 2016 New Revision: 308687 URL: https://svnweb.freebsd.org/changeset/base/308687 Log: Update hint to utilize user variable. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/libexec/rtld-elf/Makefile Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Tue Nov 15 09:20:28 2016 (r308686) +++ head/libexec/rtld-elf/Makefile Tue Nov 15 09:37:35 2016 (r308687) @@ -2,7 +2,7 @@ # Use the following command to build local debug version of dynamic # linker: -# make DEBUG_FLAGS=-g DEBUG=-DDEBUG MK_TESTS=no all +# make DEBUG_FLAGS=-g DEBUG=-DDEBUG WITHOUT_TESTS=yes all .include PACKAGE= clibs From owner-svn-src-head@freebsd.org Tue Nov 15 09:40:05 2016 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 0EEBBC411F0; Tue, 15 Nov 2016 09:40:05 +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 D21E0DC4; Tue, 15 Nov 2016 09:40:04 +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 uAF9e4n3082507; Tue, 15 Nov 2016 09:40:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF9e4bf082506; Tue, 15 Nov 2016 09:40:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611150940.uAF9e4bf082506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 15 Nov 2016 09:40:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308688 - head/libexec/rtld-elf X-SVN-Group: head 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, 15 Nov 2016 09:40:05 -0000 Author: kib Date: Tue Nov 15 09:40:03 2016 New Revision: 308688 URL: https://svnweb.freebsd.org/changeset/base/308688 Log: Assert that there is no unresolved symbols during rtld linking. Reviewed by: emaste, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D8448 Modified: head/libexec/rtld-elf/Makefile Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Tue Nov 15 09:37:35 2016 (r308687) +++ head/libexec/rtld-elf/Makefile Tue Nov 15 09:40:03 2016 (r308688) @@ -47,7 +47,7 @@ CFLAGS+= -DPIC $(DEBUG) .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" CFLAGS+= -fvisibility=hidden .endif -LDFLAGS+= -shared -Wl,-Bsymbolic +LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs LIBADD= c_pic .if ${MK_TOOLCHAIN} == "no" LDFLAGS+= -L${LIBCDIR} From owner-svn-src-head@freebsd.org Tue Nov 15 09:43:29 2016 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 CFD6EC41456; Tue, 15 Nov 2016 09:43:29 +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 982C31228; Tue, 15 Nov 2016 09:43:29 +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 uAF9hSQ5086067; Tue, 15 Nov 2016 09:43:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAF9hQks086047; Tue, 15 Nov 2016 09:43:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611150943.uAF9hQks086047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 15 Nov 2016 09:43:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308689 - in head/libexec/rtld-elf: . aarch64 amd64 arm i386 mips powerpc powerpc64 riscv sparc64 X-SVN-Group: head 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, 15 Nov 2016 09:43:29 -0000 Author: kib Date: Tue Nov 15 09:43:26 2016 New Revision: 308689 URL: https://svnweb.freebsd.org/changeset/base/308689 Log: Pass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) and CPUID[7].%ebx (cpu_stdext_feature), %ecx (cpu_stdext_feature2) to the ifunc resolvers on x86. It is much more clean to use CPUID instruction in usermode to retrieve this information than to pass AT_HWCAP aux vector from kernel, on x86. Still, the change does allow for use of AT_HWCAP on arches where it is needed, by passing aux array to ifunc_init() initializer which should prepare arguments for ifunc resolvers. Current signature for resolvers on x86 is func_t iresolve(uint32_t cpu_feature, uint32_t cpu_feature2, uint32_t cpu_stdext_feature, uint32_t cpu_stdext_feature2); where arguments have identical meaning as the kernel variables of the same name. The ABIs allow to use resolvers with the void or shortened list of arguments. Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D8448 Modified: head/libexec/rtld-elf/aarch64/reloc.c head/libexec/rtld-elf/aarch64/rtld_machdep.h head/libexec/rtld-elf/amd64/reloc.c head/libexec/rtld-elf/amd64/rtld_machdep.h head/libexec/rtld-elf/arm/reloc.c head/libexec/rtld-elf/arm/rtld_machdep.h head/libexec/rtld-elf/i386/reloc.c head/libexec/rtld-elf/i386/rtld_machdep.h head/libexec/rtld-elf/mips/reloc.c head/libexec/rtld-elf/mips/rtld_machdep.h head/libexec/rtld-elf/powerpc/reloc.c head/libexec/rtld-elf/powerpc/rtld_machdep.h head/libexec/rtld-elf/powerpc64/reloc.c head/libexec/rtld-elf/powerpc64/rtld_machdep.h head/libexec/rtld-elf/riscv/reloc.c head/libexec/rtld-elf/riscv/rtld_machdep.h head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h head/libexec/rtld-elf/sparc64/reloc.c head/libexec/rtld-elf/sparc64/rtld_machdep.h Modified: head/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- head/libexec/rtld-elf/aarch64/reloc.c Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/aarch64/reloc.c Tue Nov 15 09:43:26 2016 (r308689) @@ -299,6 +299,11 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr return target; } +void +ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused) +{ +} + /* * Process non-PLT relocations */ Modified: head/libexec/rtld-elf/aarch64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/aarch64/rtld_machdep.h Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/aarch64/rtld_machdep.h Tue Nov 15 09:43:26 2016 (r308689) @@ -61,7 +61,10 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) -#define round(size, align) \ +#define call_ifunc_resolver(ptr) \ + (((Elf_Addr (*)(void))ptr)()) + +#define round(size, align) \ (((size) + (align) - 1) & ~((align) - 1)) #define calculate_first_tls_offset(size, align) \ round(16, align) Modified: head/libexec/rtld-elf/amd64/reloc.c ============================================================================== --- head/libexec/rtld-elf/amd64/reloc.c Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/amd64/reloc.c Tue Nov 15 09:43:26 2016 (r308689) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -406,7 +407,7 @@ reloc_iresolve(Obj_Entry *obj, RtldLockS ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); where = (Elf_Addr *)(obj->relocbase + rela->r_offset); lock_release(rtld_bind_lock, lockstate); - target = ((Elf_Addr (*)(void))ptr)(); + target = call_ifunc_resolver(ptr); wlock_acquire(rtld_bind_lock, lockstate); *where = target; break; @@ -450,6 +451,25 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flag return (0); } +uint32_t cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2; + +void +ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused) +{ + u_int p[4], cpu_high; + + do_cpuid(1, p); + cpu_feature = p[3]; + cpu_feature2 = p[2]; + do_cpuid(0, p); + cpu_high = p[0]; + if (cpu_high >= 7) { + cpuid_count(7, 0, p); + cpu_stdext_feature = p[1]; + cpu_stdext_feature2 = p[2]; + } +} + void allocate_initial_tls(Obj_Entry *objs) { Modified: head/libexec/rtld-elf/amd64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/amd64/rtld_machdep.h Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/amd64/rtld_machdep.h Tue Nov 15 09:43:26 2016 (r308689) @@ -61,6 +61,14 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) +extern uint32_t cpu_feature; +extern uint32_t cpu_feature2; +extern uint32_t cpu_stdext_feature; +extern uint32_t cpu_stdext_feature2; +#define call_ifunc_resolver(ptr) \ + (((Elf_Addr (*)(uint32_t, uint32_t, uint32_t, uint32_t))ptr)( \ + cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2)) + #define round(size, align) \ (((size) + (align) - 1) & ~((align) - 1)) #define calculate_first_tls_offset(size, align) \ Modified: head/libexec/rtld-elf/arm/reloc.c ============================================================================== --- head/libexec/rtld-elf/arm/reloc.c Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/arm/reloc.c Tue Nov 15 09:43:26 2016 (r308689) @@ -480,6 +480,11 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr } void +ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused) +{ +} + +void allocate_initial_tls(Obj_Entry *objs) { #ifdef ARM_TP_ADDRESS Modified: head/libexec/rtld-elf/arm/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/arm/rtld_machdep.h Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/arm/rtld_machdep.h Tue Nov 15 09:43:26 2016 (r308689) @@ -51,6 +51,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) +#define call_ifunc_resolver(ptr) \ + (((Elf_Addr (*)(void))ptr)()) + #define TLS_TCB_SIZE 8 typedef struct { unsigned long ti_module; Modified: head/libexec/rtld-elf/i386/reloc.c ============================================================================== --- head/libexec/rtld-elf/i386/reloc.c Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/i386/reloc.c Tue Nov 15 09:43:26 2016 (r308689) @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -359,7 +360,7 @@ reloc_iresolve(Obj_Entry *obj, RtldLockS case R_386_IRELATIVE: where = (Elf_Addr *)(obj->relocbase + rel->r_offset); lock_release(rtld_bind_lock, lockstate); - target = ((Elf_Addr (*)(void))(obj->relocbase + *where))(); + target = call_ifunc_resolver(obj->relocbase + *where); wlock_acquire(rtld_bind_lock, lockstate); *where = target; break; @@ -404,6 +405,45 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flag return (0); } +uint32_t cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2; + +void +ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused) +{ + u_int p[4], cpu_high; + int cpuid_supported; + + __asm __volatile( + " pushfl\n" + " popl %%eax\n" + " movl %%eax,%%ecx\n" + " xorl $0x200000,%%eax\n" + " pushl %%eax\n" + " popfl\n" + " pushfl\n" + " popl %%eax\n" + " xorl %%eax,%%ecx\n" + " je 1f\n" + " movl $1,%0\n" + " jmp 2f\n" + "1: movl $0,%0\n" + "2:\n" + : "=r" (cpuid_supported) : : "eax", "ecx"); + if (!cpuid_supported) + return; + + do_cpuid(1, p); + cpu_feature = p[3]; + cpu_feature2 = p[2]; + do_cpuid(0, p); + cpu_high = p[0]; + if (cpu_high >= 7) { + cpuid_count(7, 0, p); + cpu_stdext_feature = p[1]; + cpu_stdext_feature2 = p[2]; + } +} + void allocate_initial_tls(Obj_Entry *objs) { Modified: head/libexec/rtld-elf/i386/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/i386/rtld_machdep.h Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/i386/rtld_machdep.h Tue Nov 15 09:43:26 2016 (r308689) @@ -61,6 +61,14 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) +extern uint32_t cpu_feature; +extern uint32_t cpu_feature2; +extern uint32_t cpu_stdext_feature; +extern uint32_t cpu_stdext_feature2; +#define call_ifunc_resolver(ptr) \ + (((Elf_Addr (*)(uint32_t, uint32_t, uint32_t, uint32_t))ptr)( \ + cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2)) + #define round(size, align) \ (((size) + (align) - 1) & ~((align) - 1)) #define calculate_first_tls_offset(size, align) \ Modified: head/libexec/rtld-elf/mips/reloc.c ============================================================================== --- head/libexec/rtld-elf/mips/reloc.c Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/mips/reloc.c Tue Nov 15 09:43:26 2016 (r308689) @@ -618,6 +618,11 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr } void +ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused) +{ +} + +void allocate_initial_tls(Obj_Entry *objs) { char *tls; Modified: head/libexec/rtld-elf/mips/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/mips/rtld_machdep.h Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/mips/rtld_machdep.h Tue Nov 15 09:43:26 2016 (r308689) @@ -52,6 +52,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) +#define call_ifunc_resolver(ptr) \ + (((Elf_Addr (*)(void))ptr)()) + typedef struct { unsigned long ti_module; unsigned long ti_offset; Modified: head/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc/reloc.c Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/powerpc/reloc.c Tue Nov 15 09:43:26 2016 (r308689) @@ -620,6 +620,11 @@ init_pltgot(Obj_Entry *obj) } void +ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused) +{ +} + +void allocate_initial_tls(Obj_Entry *list) { Elf_Addr **tp; Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/powerpc/rtld_machdep.h Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/powerpc/rtld_machdep.h Tue Nov 15 09:43:26 2016 (r308689) @@ -51,6 +51,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) +#define call_ifunc_resolver(ptr) \ + (((Elf_Addr (*)(void))ptr)()) + /* * Lazy binding entry point, called via PLT. */ Modified: head/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc64/reloc.c Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/powerpc64/reloc.c Tue Nov 15 09:43:26 2016 (r308689) @@ -524,6 +524,11 @@ init_pltgot(Obj_Entry *obj) } void +ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused) +{ +} + +void allocate_initial_tls(Obj_Entry *list) { Elf_Addr **tp; Modified: head/libexec/rtld-elf/powerpc64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/powerpc64/rtld_machdep.h Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/powerpc64/rtld_machdep.h Tue Nov 15 09:43:26 2016 (r308689) @@ -51,6 +51,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) +#define call_ifunc_resolver(ptr) \ + (((Elf_Addr (*)(void))ptr)()) + /* * Lazy binding entry point, called via PLT. */ Modified: head/libexec/rtld-elf/riscv/reloc.c ============================================================================== --- head/libexec/rtld-elf/riscv/reloc.c Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/riscv/reloc.c Tue Nov 15 09:43:26 2016 (r308689) @@ -367,6 +367,11 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry } void +ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused) +{ +} + +void allocate_initial_tls(Obj_Entry *objs) { Elf_Addr **tp; Modified: head/libexec/rtld-elf/riscv/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/riscv/rtld_machdep.h Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/riscv/rtld_machdep.h Tue Nov 15 09:43:26 2016 (r308689) @@ -78,6 +78,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, __asm __volatile("mv gp, %0" :: "r"(old1)); \ }) +#define call_ifunc_resolver(ptr) \ + (((Elf_Addr (*)(void))ptr)()) + /* * Lazy binding entry point, called via PLT. */ Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/rtld.c Tue Nov 15 09:43:26 2016 (r308689) @@ -642,6 +642,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ r_debug_state(NULL, &obj_main->linkmap); /* say hello to gdb! */ map_stacks_exec(NULL); + ifunc_init(aux); dbg("resolving ifuncs"); if (resolve_objects_ifunc(obj_main, @@ -690,7 +691,7 @@ rtld_resolve_ifunc(const Obj_Entry *obj, Elf_Addr target; ptr = (void *)make_function_pointer(def, obj); - target = ((Elf_Addr (*)(void))ptr)(); + target = call_ifunc_resolver(ptr); return ((void *)target); } Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/rtld.h Tue Nov 15 09:43:26 2016 (r308689) @@ -367,6 +367,7 @@ void dump_Elf_Rela(Obj_Entry *, const El unsigned long elf_hash(const char *); const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *, const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *); +void ifunc_init(Elf_Auxinfo[static AT_COUNT]); void init_pltgot(Obj_Entry *); void lockdflt_init(void); void digest_notes(Obj_Entry *, Elf_Addr, Elf_Addr); Modified: head/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/sparc64/reloc.c Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/sparc64/reloc.c Tue Nov 15 09:43:26 2016 (r308689) @@ -786,6 +786,11 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr return (target); } +void +ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused) +{ +} + /* * Install rtld function call into this PLT slot. */ Modified: head/libexec/rtld-elf/sparc64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/sparc64/rtld_machdep.h Tue Nov 15 09:40:03 2016 (r308688) +++ head/libexec/rtld-elf/sparc64/rtld_machdep.h Tue Nov 15 09:43:26 2016 (r308689) @@ -53,7 +53,10 @@ Elf_Addr reloc_jmpslot(Elf_Addr *, Elf_A #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) -#define round(size, align) \ +#define call_ifunc_resolver(ptr) \ + (((Elf_Addr (*)(void))ptr)()) + +#define round(size, align) \ (((size) + (align) - 1) & ~((align) - 1)) #define calculate_first_tls_offset(size, align) \ round(size, align) From owner-svn-src-head@freebsd.org Tue Nov 15 14:48:35 2016 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 6E1B4C42E0F; Tue, 15 Nov 2016 14:48:35 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mail.made4.biz (mail.made4.biz [IPv6:2001:41d0:2:c018::1:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D4FB1E3F; Tue, 15 Nov 2016 14:48:35 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from 141.7.19.93.rev.sfr.net ([93.19.7.141] helo=magellan.dumbbell.fr) by mail.made4.biz with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1c6f2F-0007z1-56; Tue, 15 Nov 2016 15:48:32 +0100 Subject: Re: svn commit: r308432 - in head: bin/echo bin/sleep usr.bin/basename usr.bin/dc usr.bin/dirname usr.bin/fold usr.bin/getopt usr.bin/locate/bigram usr.bin/logname usr.bin/printenv usr.bin/yes To: cem@freebsd.org References: <201611080531.uA85V2DL025382@repo.freebsd.org> Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Message-ID: <76184909-78ee-6e18-4daf-a9910bde9387@FreeBSD.org> Date: Tue, 15 Nov 2016 15:48:25 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7cFGtrTirtbrRhV3dbrANF1bgLnbbPqgN" 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, 15 Nov 2016 14:48:35 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --7cFGtrTirtbrRhV3dbrANF1bgLnbbPqgN Content-Type: multipart/mixed; boundary="eCHWUBSJcDMB5RIEK6QaeOCsOnWNvctJq"; protected-headers="v1" From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= To: cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <76184909-78ee-6e18-4daf-a9910bde9387@FreeBSD.org> Subject: Re: svn commit: r308432 - in head: bin/echo bin/sleep usr.bin/basename usr.bin/dc usr.bin/dirname usr.bin/fold usr.bin/getopt usr.bin/locate/bigram usr.bin/logname usr.bin/printenv usr.bin/yes References: <201611080531.uA85V2DL025382@repo.freebsd.org> In-Reply-To: --eCHWUBSJcDMB5RIEK6QaeOCsOnWNvctJq Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 15.11.2016 01:24, Conrad Meyer wrote: > Yes, this program is incorrectly capsicumized. My mistake. I have > reverted the change to fold(1) in r308657. Thank you! --=20 Jean-S=C3=A9bastien P=C3=A9dron --eCHWUBSJcDMB5RIEK6QaeOCsOnWNvctJq-- --7cFGtrTirtbrRhV3dbrANF1bgLnbbPqgN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJYKyA+AAoJEDnpl2Gl/ZTM9XYQAKuDDzkYJGZQpQ2i6AATvVvx 7KYTjA4IwTFzRzXQaYMg0gKnXX92acVaG10JLXgDh8r46+ux0PQDOpsNT0bAqzE8 i7JI54XZJ2K6K8Wooyaatx+9vPP1MpU91CCARtu04iCdZBbkKEBUv0U2U6z2i7I6 RSIZTw1zVxjS5Ai1JIGVwsEYodhIUndrySPevWCrEhRCwZI6jO3s/Mp/AavBkhqm V8PvLzp08oqVu6FcagNyT7wTX25G4IW0rLBwzrnJ9q1XgmyIMjOsLPZD7HPjPaA5 U7pcxEaSGhyRUbqzdAzt9+V9F6qXQzmm5YKihrsLrNz9ZwSnS7OkqPqEol8zgNIj wvuG5vp5rc9CVEsAq7LRBRVlrO8LuTtmZdfKQQXefWtL+79tiQdcqdIkN6wq4vN+ wmmZiu7WE2MP13dRKn1L9doXqOrBz19wZ8pzwvXuIAJzIruj6AwpGl1CmKGzhZQF vpKU2rs7dkXaMZz+Fq4aRGf9zJC6vPycorIu+SpGSB0RBCoanlfsbr9hBs7AXDkt HVVHrs4dGWopjCPaqF2CkOZfv73xtjbNavh3FHqkqfkzKO/89rKBij8GMcX8Q35A pxfSYwJl3To9899fvdTWDKVT+zBADsg2fZo3dUUY51weCfATjLfPBVIB6oDPM3RO pXtrK9DiHDjqVGP/j4bn =a9C/ -----END PGP SIGNATURE----- --7cFGtrTirtbrRhV3dbrANF1bgLnbbPqgN-- From owner-svn-src-head@freebsd.org Tue Nov 15 15:52:30 2016 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 CA86AC436D4; Tue, 15 Nov 2016 15:52:30 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-qk0-x231.google.com (mail-qk0-x231.google.com [IPv6:2607:f8b0:400d:c09::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 86597EEA; Tue, 15 Nov 2016 15:52:30 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-qk0-x231.google.com with SMTP id q130so140168950qke.1; Tue, 15 Nov 2016 07:52:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ivGgN7iZ/UVhPkj14QMn1+Mcf9+rH4nRCM7Ww3wpU+M=; b=SVG+Hk2pQkbDVJUVXKzL8oxqAMFSstd+wWw7meZZoTZi4JCH51S7X8833x5MOkYRlu 4UO+7Xob/kawnuMmkPHBYopY5ckvDpKTCjW7sdpsDuyYAU4fAN9aCKiAK/3ulXagdo9j zVYF2XIONTj/6i3atVCLPHzpia/7WTfLTXK68nlF1EQD/eN8+EiQG59F5uyIy50Yb24a 6zY2nPN0wtZEgdr5sOSzS2vrfSkleo99LrOLf0mo9Ah4hzmLuY0rfTUgrksvAJ4jNyIc eJu7hU9ZC6NCtV45mvmO8fAT5qAjamCRfp36FWfNZ+ilVIedIaNBRzLtV2w8C8V6JP8K 8VZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ivGgN7iZ/UVhPkj14QMn1+Mcf9+rH4nRCM7Ww3wpU+M=; b=CMVkAAwGvdLER1NdGHR8IEPNoimho5os44058z62bUm4lLwk4mW2anrP//B0xIhmCo 1YOKiV2zxc2+mfOsgwOXdyqZuUJ5UzbH2vwYHQIH18eLVrnycW0Rj2pi/peI40c4OS1E Pd6Bsx48Ivi5J9mGrH4fth0eF9b7RVI9gh65Ji3g/wwr7iQWTCOi7NLz3wIQwt9LPeLu Dhvtl+oY0hrxVUGR9Vm1b1lLslIloj7Tz0b8CWuOmzoOf0jByYXKU9UW0E4adT8jgAvm 8kTwEwJjvLRZVIesOu5IPICRkCXns4AWhDx5R+IdAaIu9FkX4vBaIGZMyf1YpFBzE3t8 2ESQ== X-Gm-Message-State: ABUngvfQbxS8JYPswyh/8pnXRfAHL2DzK2QGX2wf/B025c50GF/WVxzAlM+5FNnTKLxzZRRKouMSaBod9K9CUw== X-Received: by 10.55.104.208 with SMTP id d199mr23130580qkc.222.1479225149547; Tue, 15 Nov 2016 07:52:29 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.12.166.129 with HTTP; Tue, 15 Nov 2016 07:52:29 -0800 (PST) In-Reply-To: <201402251844.s1PIiYh9055297@svn.freebsd.org> References: <201402251844.s1PIiYh9055297@svn.freebsd.org> From: Alan Somers Date: Tue, 15 Nov 2016 08:52:29 -0700 X-Google-Sender-Auth: w2EclO_VW5emKCTD8VeRjCoaM7E Message-ID: Subject: Re: svn commit: r262489 - in head/sys: net netinet netinet6 netipsec sys To: John Baldwin 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, 15 Nov 2016 15:52:30 -0000 On Tue, Feb 25, 2014 at 11:44 AM, John Baldwin wrote: > Author: jhb > Date: Tue Feb 25 18:44:33 2014 > New Revision: 262489 > URL: http://svnweb.freebsd.org/changeset/base/262489 > > Log: > Remove more constants related to static sysctl nodes. The MAXID constants > were primarily used to size the sysctl name list macros that were removed > in r254295. A few other constants either did not have an associated > sysctl node, or the associated node used OID_AUTO instead. > > PR: ports/184525 (exp-run) > > Modified: > head/sys/net/if_pfsync.h > head/sys/netinet/icmp_var.h > head/sys/netinet/igmp_var.h > head/sys/netinet/in.h > head/sys/netinet/pim_var.h > head/sys/netinet/tcp_var.h > head/sys/netinet/udp_var.h > head/sys/netinet6/pim6_var.h > head/sys/netipsec/ipsec.h > head/sys/netipsec/key_var.h > head/sys/sys/socket.h > head/sys/sys/sysctl.h > For the record, John meant 254925, not 254295. From owner-svn-src-head@freebsd.org Tue Nov 15 17:01:49 2016 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 D695BC43D64; Tue, 15 Nov 2016 17:01:49 +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 A555419A0; Tue, 15 Nov 2016 17:01:49 +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 uAFH1mvc060109; Tue, 15 Nov 2016 17:01:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFH1mV2060108; Tue, 15 Nov 2016 17:01:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611151701.uAFH1mV2060108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 15 Nov 2016 17:01:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308690 - head/sys/mips/mips X-SVN-Group: head 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, 15 Nov 2016 17:01:49 -0000 Author: jhb Date: Tue Nov 15 17:01:48 2016 New Revision: 308690 URL: https://svnweb.freebsd.org/changeset/base/308690 Log: Sync instruction cache's after writing user breakpoints on MIPS. Add an implementation for pmaps_sync_icache() on MIPS that sync's the instruction cache on all CPUs via smp_rendezvous() after a debugger inserts a breakpoint via ptrace(PT_IO). Tested by: kan (on Creator CI20 running Ingenic JZ4780 SOC) MFC after: 2 weeks Sponsored by: DARPA / AFRL Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Nov 15 09:43:26 2016 (r308689) +++ head/sys/mips/mips/pmap.c Tue Nov 15 17:01:48 2016 (r308690) @@ -74,11 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef SMP #include -#else -#include -#endif #include #include @@ -3266,9 +3262,19 @@ pmap_activate(struct thread *td) critical_exit(); } +static void +pmap_sync_icache_one(void *arg __unused) +{ + + mips_icache_sync_all(); + mips_dcache_wbinv_all(); +} + void pmap_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz) { + + smp_rendezvous(NULL, pmap_sync_icache_one, NULL, NULL); } /* From owner-svn-src-head@freebsd.org Tue Nov 15 18:22:53 2016 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 5677DC437D0; Tue, 15 Nov 2016 18:22:53 +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 E8803BE6; Tue, 15 Nov 2016 18:22:52 +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 uAFIMqBK092596; Tue, 15 Nov 2016 18:22:52 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFIMoj2092581; Tue, 15 Nov 2016 18:22:50 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201611151822.uAFIMoj2092581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 15 Nov 2016 18:22:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm X-SVN-Group: head 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, 15 Nov 2016 18:22:53 -0000 Author: alc Date: Tue Nov 15 18:22:50 2016 New Revision: 308691 URL: https://svnweb.freebsd.org/changeset/base/308691 Log: Remove most of the code for implementing PG_CACHED pages. (This change does not remove user-space visible fields from vm_cnt or all of the references to cached pages from comments. Those changes will come later.) Reviewed by: kib, markj Tested by: pho Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8497 Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/fs/tmpfs/tmpfs_subr.c head/sys/kern/kern_exec.c head/sys/kern/uipc_shm.c head/sys/vm/swap_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_mmap.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_reserv.c head/sys/vm/vm_reserv.h head/sys/vm/vnode_pager.c Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 15 18:22:50 2016 (r308691) @@ -75,8 +75,7 @@ vn_is_readonly(vnode_t *vp) #define vn_mountedvfs(vp) ((vp)->v_mountedhere) #define vn_has_cached_data(vp) \ ((vp)->v_object != NULL && \ - ((vp)->v_object->resident_page_count > 0 || \ - !vm_object_cache_is_empty((vp)->v_object))) + (vp)->v_object->resident_page_count > 0) #define vn_exists(vp) do { } while (0) #define vn_invalid(vp) do { } while (0) #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0) 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 Nov 15 17:01:48 2016 (r308690) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Nov 15 18:22:50 2016 (r308691) @@ -426,10 +426,6 @@ page_busy(vnode_t *vp, int64_t start, in continue; } vm_page_sbusy(pp); - } else if (pp == NULL) { - pp = vm_page_alloc(obj, OFF_TO_IDX(start), - VM_ALLOC_SYSTEM | VM_ALLOC_IFCACHED | - VM_ALLOC_SBUSY); } else { ASSERT(pp != NULL && !pp->valid); pp = NULL; Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 15 18:22:50 2016 (r308691) @@ -1372,12 +1372,9 @@ retry: VM_WAIT; VM_OBJECT_WLOCK(uobj); goto retry; - } else if (m->valid != VM_PAGE_BITS_ALL) - rv = vm_pager_get_pages(uobj, &m, 1, - NULL, NULL); - else - /* A cached page was reactivated. */ - rv = VM_PAGER_OK; + } + rv = vm_pager_get_pages(uobj, &m, 1, NULL, + NULL); vm_page_lock(m); if (rv == VM_PAGER_OK) { vm_page_deactivate(m); Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/kern/kern_exec.c Tue Nov 15 18:22:50 2016 (r308691) @@ -1006,7 +1006,7 @@ exec_map_first_page(imgp) break; } else { ma[i] = vm_page_alloc(object, i, - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); + VM_ALLOC_NORMAL); if (ma[i] == NULL) break; } Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/kern/uipc_shm.c Tue Nov 15 18:22:50 2016 (r308691) @@ -455,12 +455,9 @@ retry: VM_WAIT; VM_OBJECT_WLOCK(object); goto retry; - } else if (m->valid != VM_PAGE_BITS_ALL) - rv = vm_pager_get_pages(object, &m, 1, - NULL, NULL); - else - /* A cached page was reactivated. */ - rv = VM_PAGER_OK; + } + rv = vm_pager_get_pages(object, &m, 1, NULL, + NULL); vm_page_lock(m); if (rv == VM_PAGER_OK) { vm_page_deactivate(m); Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/vm/swap_pager.c Tue Nov 15 18:22:50 2016 (r308691) @@ -1126,7 +1126,7 @@ swap_pager_getpages(vm_object_t object, if (shift != 0) { for (i = 1; i <= shift; i++) { p = vm_page_alloc(object, m[0]->pindex - i, - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); + VM_ALLOC_NORMAL); if (p == NULL) { /* Shift allocated pages to the left. */ for (j = 0; j < i - 1; j++) @@ -1144,8 +1144,7 @@ swap_pager_getpages(vm_object_t object, if (rahead != NULL) { for (i = 0; i < *rahead; i++) { p = vm_page_alloc(object, - m[reqcount - 1]->pindex + i + 1, - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); + m[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); if (p == NULL) break; bp->b_pages[shift + reqcount + i] = p; Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/vm/vm_fault.c Tue Nov 15 18:22:50 2016 (r308691) @@ -559,8 +559,7 @@ fast_failed: unlock_and_deallocate(&fs); VM_WAITPFAULT; goto RetryFault; - } else if (fs.m->valid == VM_PAGE_BITS_ALL) - break; + } } readrest: Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/vm/vm_mmap.c Tue Nov 15 18:22:50 2016 (r308691) @@ -877,9 +877,6 @@ RestartScan: pindex = OFF_TO_IDX(current->offset + (addr - current->start)); m = vm_page_lookup(object, pindex); - if (m == NULL && - vm_page_is_cached(object, pindex)) - mincoreinfo = MINCORE_INCORE; if (m != NULL && m->valid == 0) m = NULL; if (m != NULL) Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/vm/vm_object.c Tue Nov 15 18:22:50 2016 (r308691) @@ -178,9 +178,6 @@ vm_object_zdtor(void *mem, int size, voi ("object %p has reservations", object)); #endif - KASSERT(vm_object_cache_is_empty(object), - ("object %p has cached pages", - object)); KASSERT(object->paging_in_progress == 0, ("object %p paging_in_progress = %d", object, object->paging_in_progress)); @@ -212,8 +209,6 @@ vm_object_zinit(void *mem, int size, int object->paging_in_progress = 0; object->resident_page_count = 0; object->shadow_count = 0; - object->cache.rt_root = 0; - object->cache.rt_flags = 0; mtx_lock(&vm_object_list_mtx); TAILQ_INSERT_TAIL(&vm_object_list, object, object_list); @@ -792,8 +787,6 @@ vm_object_terminate(vm_object_t object) if (__predict_false(!LIST_EMPTY(&object->rvq))) vm_reserv_break_all(object); #endif - if (__predict_false(!vm_object_cache_is_empty(object))) - vm_page_cache_free(object, 0, 0); KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || object->type == OBJT_SWAP, @@ -1135,13 +1128,6 @@ shadowlookup: } else if ((tobject->flags & OBJ_UNMANAGED) != 0) goto unlock_tobject; m = vm_page_lookup(tobject, tpindex); - if (m == NULL && advise == MADV_WILLNEED) { - /* - * If the page is cached, reactivate it. - */ - m = vm_page_alloc(tobject, tpindex, VM_ALLOC_IFCACHED | - VM_ALLOC_NOBUSY); - } if (m == NULL) { /* * There may be swap even if there is no backing page @@ -1406,19 +1392,6 @@ retry: swap_pager_copy(orig_object, new_object, offidxstart, 0); TAILQ_FOREACH(m, &new_object->memq, listq) vm_page_xunbusy(m); - - /* - * Transfer any cached pages from orig_object to new_object. - * If swap_pager_copy() found swapped out pages within the - * specified range of orig_object, then it changed - * new_object's type to OBJT_SWAP when it transferred those - * pages to new_object. Otherwise, new_object's type - * should still be OBJT_DEFAULT and orig_object should not - * contain any cached pages within the specified range. - */ - if (__predict_false(!vm_object_cache_is_empty(orig_object))) - vm_page_cache_transfer(orig_object, offidxstart, - new_object); } VM_OBJECT_WUNLOCK(orig_object); VM_OBJECT_WUNLOCK(new_object); @@ -1754,13 +1727,6 @@ vm_object_collapse(vm_object_t object) backing_object, object, OFF_TO_IDX(object->backing_object_offset), TRUE); - - /* - * Free any cached pages from backing_object. - */ - if (__predict_false( - !vm_object_cache_is_empty(backing_object))) - vm_page_cache_free(backing_object, 0, 0); } /* * Object now shadows whatever backing_object did. @@ -1889,7 +1855,7 @@ vm_object_page_remove(vm_object_t object (options & (OBJPR_CLEANONLY | OBJPR_NOTMAPPED)) == OBJPR_NOTMAPPED, ("vm_object_page_remove: illegal options for object %p", object)); if (object->resident_page_count == 0) - goto skipmemq; + return; vm_object_pip_add(object, 1); again: p = vm_page_find_least(object, start); @@ -1946,9 +1912,6 @@ next: vm_page_unlock(p); } vm_object_pip_wakeup(object); -skipmemq: - if (__predict_false(!vm_object_cache_is_empty(object))) - vm_page_cache_free(object, start, end); } /* Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/vm/vm_object.h Tue Nov 15 18:22:50 2016 (r308691) @@ -118,7 +118,6 @@ struct vm_object { vm_ooffset_t backing_object_offset;/* Offset in backing object */ TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ - struct vm_radix cache; /* (o + f) root of the cache page radix trie */ void *handle; union { /* @@ -290,13 +289,6 @@ void vm_object_pip_wakeup(vm_object_t ob void vm_object_pip_wakeupn(vm_object_t object, short i); void vm_object_pip_wait(vm_object_t object, char *waitid); -static __inline boolean_t -vm_object_cache_is_empty(vm_object_t object) -{ - - return (vm_radix_is_empty(&object->cache)); -} - void umtx_shm_object_init(vm_object_t object); void umtx_shm_object_terminated(vm_object_t object); extern int umtx_shm_vnobj_persistent; Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/vm/vm_page.c Tue Nov 15 18:22:50 2016 (r308691) @@ -154,8 +154,7 @@ static int vm_pageout_pages_needed; static uma_zone_t fakepg_zone; -static struct vnode *vm_page_alloc_init(vm_page_t m); -static void vm_page_cache_turn_free(vm_page_t m); +static void vm_page_alloc_check(vm_page_t m); static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); static void vm_page_enqueue(uint8_t queue, vm_page_t m); static void vm_page_free_wakeup(void); @@ -1118,9 +1117,7 @@ void vm_page_dirty_KBI(vm_page_t m) { - /* These assertions refer to this operation by its public name. */ - KASSERT((m->flags & PG_CACHED) == 0, - ("vm_page_dirty: page in cache!")); + /* Refer to this operation by its public name. */ KASSERT(m->valid == VM_PAGE_BITS_ALL, ("vm_page_dirty: page is invalid!")); m->dirty = VM_PAGE_BITS_ALL; @@ -1459,142 +1456,6 @@ vm_page_rename(vm_page_t m, vm_object_t } /* - * Convert all of the given object's cached pages that have a - * pindex within the given range into free pages. If the value - * zero is given for "end", then the range's upper bound is - * infinity. If the given object is backed by a vnode and it - * transitions from having one or more cached pages to none, the - * vnode's hold count is reduced. - */ -void -vm_page_cache_free(vm_object_t object, vm_pindex_t start, vm_pindex_t end) -{ - vm_page_t m; - boolean_t empty; - - mtx_lock(&vm_page_queue_free_mtx); - if (__predict_false(vm_radix_is_empty(&object->cache))) { - mtx_unlock(&vm_page_queue_free_mtx); - return; - } - while ((m = vm_radix_lookup_ge(&object->cache, start)) != NULL) { - if (end != 0 && m->pindex >= end) - break; - vm_radix_remove(&object->cache, m->pindex); - vm_page_cache_turn_free(m); - } - empty = vm_radix_is_empty(&object->cache); - mtx_unlock(&vm_page_queue_free_mtx); - if (object->type == OBJT_VNODE && empty) - vdrop(object->handle); -} - -/* - * Returns the cached page that is associated with the given - * object and offset. If, however, none exists, returns NULL. - * - * The free page queue must be locked. - */ -static inline vm_page_t -vm_page_cache_lookup(vm_object_t object, vm_pindex_t pindex) -{ - - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); - return (vm_radix_lookup(&object->cache, pindex)); -} - -/* - * Remove the given cached page from its containing object's - * collection of cached pages. - * - * The free page queue must be locked. - */ -static void -vm_page_cache_remove(vm_page_t m) -{ - - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); - KASSERT((m->flags & PG_CACHED) != 0, - ("vm_page_cache_remove: page %p is not cached", m)); - vm_radix_remove(&m->object->cache, m->pindex); - m->object = NULL; - vm_cnt.v_cache_count--; -} - -/* - * Transfer all of the cached pages with offset greater than or - * equal to 'offidxstart' from the original object's cache to the - * new object's cache. However, any cached pages with offset - * greater than or equal to the new object's size are kept in the - * original object. Initially, the new object's cache must be - * empty. Offset 'offidxstart' in the original object must - * correspond to offset zero in the new object. - * - * The new object must be locked. - */ -void -vm_page_cache_transfer(vm_object_t orig_object, vm_pindex_t offidxstart, - vm_object_t new_object) -{ - vm_page_t m; - - /* - * Insertion into an object's collection of cached pages - * requires the object to be locked. In contrast, removal does - * not. - */ - VM_OBJECT_ASSERT_WLOCKED(new_object); - KASSERT(vm_radix_is_empty(&new_object->cache), - ("vm_page_cache_transfer: object %p has cached pages", - new_object)); - mtx_lock(&vm_page_queue_free_mtx); - while ((m = vm_radix_lookup_ge(&orig_object->cache, - offidxstart)) != NULL) { - /* - * Transfer all of the pages with offset greater than or - * equal to 'offidxstart' from the original object's - * cache to the new object's cache. - */ - if ((m->pindex - offidxstart) >= new_object->size) - break; - vm_radix_remove(&orig_object->cache, m->pindex); - /* Update the page's object and offset. */ - m->object = new_object; - m->pindex -= offidxstart; - if (vm_radix_insert(&new_object->cache, m)) - vm_page_cache_turn_free(m); - } - mtx_unlock(&vm_page_queue_free_mtx); -} - -/* - * Returns TRUE if a cached page is associated with the given object and - * offset, and FALSE otherwise. - * - * The object must be locked. - */ -boolean_t -vm_page_is_cached(vm_object_t object, vm_pindex_t pindex) -{ - vm_page_t m; - - /* - * Insertion into an object's collection of cached pages requires the - * object to be locked. Therefore, if the object is locked and the - * object's collection is empty, there is no need to acquire the free - * page queues lock in order to prove that the specified page doesn't - * exist. - */ - VM_OBJECT_ASSERT_WLOCKED(object); - if (__predict_true(vm_object_cache_is_empty(object))) - return (FALSE); - mtx_lock(&vm_page_queue_free_mtx); - m = vm_page_cache_lookup(object, pindex); - mtx_unlock(&vm_page_queue_free_mtx); - return (m != NULL); -} - -/* * vm_page_alloc: * * Allocate and return a page that is associated with the specified @@ -1610,9 +1471,6 @@ vm_page_is_cached(vm_object_t object, vm * optional allocation flags: * VM_ALLOC_COUNT(number) the number of additional pages that the caller * intends to allocate - * VM_ALLOC_IFCACHED return page only if it is cached - * VM_ALLOC_IFNOTCACHED return NULL, do not reactivate if the page - * is cached * VM_ALLOC_NOBUSY do not exclusive busy the page * VM_ALLOC_NODUMP do not include the page in a kernel core dump * VM_ALLOC_NOOBJ page is not associated with an object and @@ -1626,8 +1484,6 @@ vm_page_is_cached(vm_object_t object, vm vm_page_t vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) { - struct vnode *vp = NULL; - vm_object_t m_object; vm_page_t m, mpred; int flags, req_class; @@ -1670,31 +1526,12 @@ vm_page_alloc(vm_object_t object, vm_pin * Allocate from the free queue if the number of free pages * exceeds the minimum for the request class. */ - if (object != NULL && - (m = vm_page_cache_lookup(object, pindex)) != NULL) { - if ((req & VM_ALLOC_IFNOTCACHED) != 0) { - mtx_unlock(&vm_page_queue_free_mtx); - return (NULL); - } - if (vm_phys_unfree_page(m)) - vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, 0); -#if VM_NRESERVLEVEL > 0 - else if (!vm_reserv_reactivate_page(m)) -#else - else -#endif - panic("vm_page_alloc: cache page %p is missing" - " from the free queue", m); - } else if ((req & VM_ALLOC_IFCACHED) != 0) { - mtx_unlock(&vm_page_queue_free_mtx); - return (NULL); #if VM_NRESERVLEVEL > 0 - } else if (object == NULL || (object->flags & (OBJ_COLORED | + if (object == NULL || (object->flags & (OBJ_COLORED | OBJ_FICTITIOUS)) != OBJ_COLORED || (m = - vm_reserv_alloc_page(object, pindex, mpred)) == NULL) { -#else - } else { + vm_reserv_alloc_page(object, pindex, mpred)) == NULL) #endif + { m = vm_phys_alloc_pages(object != NULL ? VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); #if VM_NRESERVLEVEL > 0 @@ -1720,33 +1557,9 @@ vm_page_alloc(vm_object_t object, vm_pin * At this point we had better have found a good page. */ KASSERT(m != NULL, ("vm_page_alloc: missing page")); - KASSERT(m->queue == PQ_NONE, - ("vm_page_alloc: page %p has unexpected queue %d", m, m->queue)); - KASSERT(m->wire_count == 0, ("vm_page_alloc: page %p is wired", m)); - KASSERT(m->hold_count == 0, ("vm_page_alloc: page %p is held", m)); - KASSERT(!vm_page_busied(m), ("vm_page_alloc: page %p is busy", m)); - KASSERT(m->dirty == 0, ("vm_page_alloc: page %p is dirty", m)); - KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, - ("vm_page_alloc: page %p has unexpected memattr %d", m, - pmap_page_get_memattr(m))); - if ((m->flags & PG_CACHED) != 0) { - KASSERT((m->flags & PG_ZERO) == 0, - ("vm_page_alloc: cached page %p is PG_ZERO", m)); - KASSERT(m->valid != 0, - ("vm_page_alloc: cached page %p is invalid", m)); - if (m->object != object || m->pindex != pindex) - m->valid = 0; - m_object = m->object; - vm_page_cache_remove(m); - if (m_object->type == OBJT_VNODE && - vm_object_cache_is_empty(m_object)) - vp = m_object->handle; - } else { - KASSERT(m->valid == 0, - ("vm_page_alloc: free page %p is valid", m)); - vm_phys_freecnt_adj(m, -1); - } + vm_phys_freecnt_adj(m, -1); mtx_unlock(&vm_page_queue_free_mtx); + vm_page_alloc_check(m); /* * Initialize the page. Only the PG_ZERO flag is inherited. @@ -1778,9 +1591,6 @@ vm_page_alloc(vm_object_t object, vm_pin if (object != NULL) { if (vm_page_insert_after(m, object, pindex, mpred)) { - /* See the comment below about hold count. */ - if (vp != NULL) - vdrop(vp); pagedaemon_wakeup(); if (req & VM_ALLOC_WIRED) { atomic_subtract_int(&vm_cnt.v_wire_count, 1); @@ -1801,15 +1611,6 @@ vm_page_alloc(vm_object_t object, vm_pin m->pindex = pindex; /* - * The following call to vdrop() must come after the above call - * to vm_page_insert() in case both affect the same object and - * vnode. Otherwise, the affected vnode's hold count could - * temporarily become zero. - */ - if (vp != NULL) - vdrop(vp); - - /* * Don't wakeup too often - wakeup the pageout daemon when * we would be nearly out of memory. */ @@ -1819,16 +1620,6 @@ vm_page_alloc(vm_object_t object, vm_pin return (m); } -static void -vm_page_alloc_contig_vdrop(struct spglist *lst) -{ - - while (!SLIST_EMPTY(lst)) { - vdrop((struct vnode *)SLIST_FIRST(lst)-> plinks.s.pv); - SLIST_REMOVE_HEAD(lst, plinks.s.ss); - } -} - /* * vm_page_alloc_contig: * @@ -1873,8 +1664,6 @@ vm_page_alloc_contig(vm_object_t object, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_memattr_t memattr) { - struct vnode *drop; - struct spglist deferred_vdrop_list; vm_page_t m, m_tmp, m_ret; u_int flags; int req_class; @@ -1900,7 +1689,6 @@ vm_page_alloc_contig(vm_object_t object, if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) req_class = VM_ALLOC_SYSTEM; - SLIST_INIT(&deferred_vdrop_list); mtx_lock(&vm_page_queue_free_mtx); if (vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages + vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && @@ -1922,17 +1710,7 @@ retry: return (NULL); } if (m_ret != NULL) - for (m = m_ret; m < &m_ret[npages]; m++) { - drop = vm_page_alloc_init(m); - if (drop != NULL) { - /* - * Enqueue the vnode for deferred vdrop(). - */ - m->plinks.s.pv = drop; - SLIST_INSERT_HEAD(&deferred_vdrop_list, m, - plinks.s.ss); - } - } + vm_phys_freecnt_adj(m_ret, -npages); else { #if VM_NRESERVLEVEL > 0 if (vm_reserv_reclaim_contig(npages, low, high, alignment, @@ -1943,6 +1721,8 @@ retry: mtx_unlock(&vm_page_queue_free_mtx); if (m_ret == NULL) return (NULL); + for (m = m_ret; m < &m_ret[npages]; m++) + vm_page_alloc_check(m); /* * Initialize the pages. Only the PG_ZERO flag is inherited. @@ -1975,8 +1755,6 @@ retry: m->oflags = VPO_UNMANAGED; if (object != NULL) { if (vm_page_insert(m, object, pindex)) { - vm_page_alloc_contig_vdrop( - &deferred_vdrop_list); if (vm_paging_needed()) pagedaemon_wakeup(); if ((req & VM_ALLOC_WIRED) != 0) @@ -2001,57 +1779,28 @@ retry: pmap_page_set_memattr(m, memattr); pindex++; } - vm_page_alloc_contig_vdrop(&deferred_vdrop_list); if (vm_paging_needed()) pagedaemon_wakeup(); return (m_ret); } /* - * Initialize a page that has been freshly dequeued from a freelist. - * The caller has to drop the vnode returned, if it is not NULL. - * - * This function may only be used to initialize unmanaged pages. - * - * To be called with vm_page_queue_free_mtx held. + * Check a page that has been freshly dequeued from a freelist. */ -static struct vnode * -vm_page_alloc_init(vm_page_t m) +static void +vm_page_alloc_check(vm_page_t m) { - struct vnode *drop; - vm_object_t m_object; KASSERT(m->queue == PQ_NONE, - ("vm_page_alloc_init: page %p has unexpected queue %d", - m, m->queue)); - KASSERT(m->wire_count == 0, - ("vm_page_alloc_init: page %p is wired", m)); - KASSERT(m->hold_count == 0, - ("vm_page_alloc_init: page %p is held", m)); - KASSERT(!vm_page_busied(m), - ("vm_page_alloc_init: page %p is busy", m)); - KASSERT(m->dirty == 0, - ("vm_page_alloc_init: page %p is dirty", m)); + ("page %p has unexpected queue %d", m, m->queue)); + KASSERT(m->wire_count == 0, ("page %p is wired", m)); + KASSERT(m->hold_count == 0, ("page %p is held", m)); + KASSERT(!vm_page_busied(m), ("page %p is busy", m)); + KASSERT(m->dirty == 0, ("page %p is dirty", m)); KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, - ("vm_page_alloc_init: page %p has unexpected memattr %d", + ("page %p has unexpected memattr %d", m, pmap_page_get_memattr(m))); - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); - drop = NULL; - if ((m->flags & PG_CACHED) != 0) { - KASSERT((m->flags & PG_ZERO) == 0, - ("vm_page_alloc_init: cached page %p is PG_ZERO", m)); - m->valid = 0; - m_object = m->object; - vm_page_cache_remove(m); - if (m_object->type == OBJT_VNODE && - vm_object_cache_is_empty(m_object)) - drop = m_object->handle; - } else { - KASSERT(m->valid == 0, - ("vm_page_alloc_init: free page %p is valid", m)); - vm_phys_freecnt_adj(m, -1); - } - return (drop); + KASSERT(m->valid == 0, ("free page %p is valid", m)); } /* @@ -2077,7 +1826,6 @@ vm_page_alloc_init(vm_page_t m) vm_page_t vm_page_alloc_freelist(int flind, int req) { - struct vnode *drop; vm_page_t m; u_int flags; int req_class; @@ -2111,8 +1859,9 @@ vm_page_alloc_freelist(int flind, int re mtx_unlock(&vm_page_queue_free_mtx); return (NULL); } - drop = vm_page_alloc_init(m); + vm_phys_freecnt_adj(m, -1); mtx_unlock(&vm_page_queue_free_mtx); + vm_page_alloc_check(m); /* * Initialize the page. Only the PG_ZERO flag is inherited. @@ -2132,8 +1881,6 @@ vm_page_alloc_freelist(int flind, int re } /* Unmanaged pages don't use "act_count". */ m->oflags = VPO_UNMANAGED; - if (drop != NULL) - vdrop(drop); if (vm_paging_needed()) pagedaemon_wakeup(); return (m); @@ -2259,38 +2006,8 @@ retry: /* Don't care: PG_NODUMP, PG_ZERO. */ if (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && - object->type != OBJT_VNODE) + object->type != OBJT_VNODE) { run_ext = 0; - else if ((m->flags & PG_CACHED) != 0 || - m != vm_page_lookup(object, m->pindex)) { - /* - * The page is cached or recently converted - * from cached to free. - */ -#if VM_NRESERVLEVEL > 0 - if (level >= 0) { - /* - * The page is reserved. Extend the - * current run by one page. - */ - run_ext = 1; - } else -#endif - if ((order = m->order) < VM_NFREEORDER) { - /* - * The page is enqueued in the - * physical memory allocator's cache/ - * free page queues. Moreover, it is - * the first page in a power-of-two- - * sized run of contiguous cache/free - * pages. Add these pages to the end - * of the current run, and jump - * ahead. - */ - run_ext = 1 << order; - m_inc = 1 << order; - } else - run_ext = 0; #if VM_NRESERVLEVEL > 0 } else if ((options & VPSC_NOSUPER) != 0 && (level = vm_reserv_level_iffullpop(m)) >= 0) { @@ -2457,15 +2174,7 @@ retry: object->type != OBJT_SWAP && object->type != OBJT_VNODE) error = EINVAL; - else if ((m->flags & PG_CACHED) != 0 || - m != vm_page_lookup(object, m->pindex)) { - /* - * The page is cached or recently converted - * from cached to free. - */ - VM_OBJECT_WUNLOCK(object); - goto cached; - } else if (object->memattr != VM_MEMATTR_DEFAULT) + else if (object->memattr != VM_MEMATTR_DEFAULT) error = EINVAL; else if (m->queue != PQ_NONE && !vm_page_busied(m)) { KASSERT(pmap_page_get_memattr(m) == @@ -2566,7 +2275,6 @@ retry: unlock: VM_OBJECT_WUNLOCK(object); } else { -cached: mtx_lock(&vm_page_queue_free_mtx); order = m->order; if (order < VM_NFREEORDER) { @@ -2964,27 +2672,6 @@ vm_page_free_wakeup(void) } /* - * Turn a cached page into a free page, by changing its attributes. - * Keep the statistics up-to-date. - * - * The free page queue must be locked. - */ -static void -vm_page_cache_turn_free(vm_page_t m) -{ - - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); - - m->object = NULL; - m->valid = 0; - KASSERT((m->flags & PG_CACHED) != 0, - ("vm_page_cache_turn_free: page %p is not cached", m)); - m->flags &= ~PG_CACHED; - vm_cnt.v_cache_count--; - vm_phys_freecnt_adj(m, 1); -} - -/* * vm_page_free_toq: * * Returns the given page to the free list, @@ -3383,8 +3070,7 @@ retrylookup: VM_WAIT; VM_OBJECT_WLOCK(object); goto retrylookup; - } else if (m->valid != 0) - return (m); + } if (allocflags & VM_ALLOC_ZERO && (m->flags & PG_ZERO) == 0) pmap_zero_page(m); return (m); Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/vm/vm_page.h Tue Nov 15 18:22:50 2016 (r308691) @@ -326,7 +326,6 @@ extern struct mtx_padalign pa_lock[]; * Page flags. If changed at any other time than page allocation or * freeing, the modification must be protected by the vm_page lock. */ -#define PG_CACHED 0x0001 /* page is cached */ #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ #define PG_ZERO 0x0008 /* page is zeroed */ #define PG_MARKER 0x0010 /* special queue marker page */ @@ -409,8 +408,6 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa) #define VM_ALLOC_ZERO 0x0040 /* (acfg) Try to obtain a zeroed page */ #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ #define VM_ALLOC_NOBUSY 0x0200 /* (acg) Do not busy the page */ -#define VM_ALLOC_IFCACHED 0x0400 /* (ag) Fail if page is not cached */ -#define VM_ALLOC_IFNOTCACHED 0x0800 /* (ag) Fail if page is cached */ #define VM_ALLOC_IGN_SBUSY 0x1000 /* (g) 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 */ @@ -453,8 +450,6 @@ vm_page_t vm_page_alloc_contig(vm_object 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_cache_free(vm_object_t, vm_pindex_t, vm_pindex_t); -void vm_page_cache_transfer(vm_object_t, vm_pindex_t, vm_object_t); int vm_page_try_to_free (vm_page_t); void vm_page_deactivate (vm_page_t); void vm_page_deactivate_noreuse(vm_page_t); @@ -464,7 +459,6 @@ vm_page_t vm_page_find_least(vm_object_t vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); -boolean_t vm_page_is_cached(vm_object_t object, vm_pindex_t pindex); void vm_page_launder(vm_page_t m); vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); vm_page_t vm_page_next(vm_page_t m); Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/vm/vm_reserv.c Tue Nov 15 18:22:50 2016 (r308691) @@ -908,45 +908,6 @@ vm_reserv_level_iffullpop(vm_page_t m) } /* - * Prepare for the reactivation of a cached page. - * - * First, suppose that the given page "m" was allocated individually, i.e., not - * as part of a reservation, and cached. Then, suppose a reservation - * containing "m" is allocated by the same object. Although "m" and the - * reservation belong to the same object, "m"'s pindex may not match the - * reservation's. - * - * The free page queue must be locked. - */ -boolean_t -vm_reserv_reactivate_page(vm_page_t m) -{ - vm_reserv_t rv; - int index; - - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); - rv = vm_reserv_from_page(m); - if (rv->object == NULL) - return (FALSE); - KASSERT((m->flags & PG_CACHED) != 0, - ("vm_reserv_reactivate_page: page %p is not cached", m)); - if (m->object == rv->object && - m->pindex - rv->pindex == (index = VM_RESERV_INDEX(m->object, - m->pindex))) - vm_reserv_populate(rv, index); - else { - KASSERT(rv->inpartpopq, - ("vm_reserv_reactivate_page: reserv %p's inpartpopq is FALSE", - rv)); - TAILQ_REMOVE(&vm_rvq_partpop, rv, partpopq); - rv->inpartpopq = FALSE; - /* Don't release "m" to the physical memory allocator. */ - vm_reserv_break(rv, m); - } - return (TRUE); -} - -/* * Breaks the given partially-populated reservation, releasing its cached and * free pages to the physical memory allocator. * Modified: head/sys/vm/vm_reserv.h ============================================================================== --- head/sys/vm/vm_reserv.h Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/vm/vm_reserv.h Tue Nov 15 18:22:50 2016 (r308691) @@ -56,7 +56,6 @@ void vm_reserv_init(void); bool vm_reserv_is_page_free(vm_page_t m); int vm_reserv_level(vm_page_t m); int vm_reserv_level_iffullpop(vm_page_t m); -boolean_t vm_reserv_reactivate_page(vm_page_t m); boolean_t vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary); boolean_t vm_reserv_reclaim_inactive(void); Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Tue Nov 15 17:01:48 2016 (r308690) +++ head/sys/vm/vnode_pager.c Tue Nov 15 18:22:50 2016 (r308691) @@ -466,10 +466,6 @@ vnode_pager_setsize(struct vnode *vp, vm * replacement from working properly. */ vm_page_clear_dirty(m, base, PAGE_SIZE - base); - } else if ((nsize & PAGE_MASK) && - vm_page_is_cached(object, OFF_TO_IDX(nsize))) { - vm_page_cache_free(object, OFF_TO_IDX(nsize), - nobjsize); } } object->un_pager.vnp.vnp_size = nsize; @@ -894,8 +890,7 @@ vnode_pager_generic_getpages(struct vnod for (tpindex = m[0]->pindex - 1; tpindex >= startpindex && tpindex < m[0]->pindex; tpindex--, i++) { - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | - VM_ALLOC_IFNOTCACHED); + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); if (p == NULL) { /* Shift the array. */ for (int j = 0; j < i; j++) @@ -932,8 +927,7 @@ vnode_pager_generic_getpages(struct vnod for (tpindex = m[count - 1]->pindex + 1; tpindex < endpindex; i++, tpindex++) { - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | - VM_ALLOC_IFNOTCACHED); + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); if (p == NULL) break; bp->b_pages[i] = p; From owner-svn-src-head@freebsd.org Tue Nov 15 18:57:27 2016 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 1C100C4327C; Tue, 15 Nov 2016 18:57:27 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E08D01D1A; Tue, 15 Nov 2016 18:57:26 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFIvQTl005121; Tue, 15 Nov 2016 18:57:26 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFIvQii005120; Tue, 15 Nov 2016 18:57:26 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201611151857.uAFIvQii005120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Tue, 15 Nov 2016 18:57:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308692 - head/sys/arm/ti X-SVN-Group: head 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, 15 Nov 2016 18:57:27 -0000 Author: loos Date: Tue Nov 15 18:57:25 2016 New Revision: 308692 URL: https://svnweb.freebsd.org/changeset/base/308692 Log: Fix ti_gpio_detach() to avoid crashing if something goes wrong. Sponsored by: Rubicon Communication, LLC (Netgate) Modified: head/sys/arm/ti/ti_gpio.c Modified: head/sys/arm/ti/ti_gpio.c ============================================================================== --- head/sys/arm/ti/ti_gpio.c Tue Nov 15 18:22:50 2016 (r308691) +++ head/sys/arm/ti/ti_gpio.c Tue Nov 15 18:57:25 2016 (r308692) @@ -710,7 +710,8 @@ ti_gpio_detach(device_t dev) /* Disable all interrupts */ if (sc->sc_mem_res != NULL) ti_gpio_intr_clr(sc, 0xffffffff); - gpiobus_detach_bus(dev); + if (sc->sc_busdev != NULL) + gpiobus_detach_bus(dev); if (sc->sc_isrcs != NULL) ti_gpio_pic_detach(sc); /* Release the memory and IRQ resources. */ @@ -718,10 +719,12 @@ ti_gpio_detach(device_t dev) bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_hdl); } - bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, - sc->sc_irq_res); - bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_mem_rid, - sc->sc_mem_res); + if (sc->sc_irq_res) + bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, + sc->sc_irq_res); + if (sc->sc_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_mem_rid, + sc->sc_mem_res); TI_GPIO_LOCK_DESTROY(sc); return (0); From owner-svn-src-head@freebsd.org Tue Nov 15 19:09:37 2016 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 CAD6FC435AC; Tue, 15 Nov 2016 19:09:37 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CC502DE; Tue, 15 Nov 2016 19:09:37 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFJ9acV009552; Tue, 15 Nov 2016 19:09:36 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFJ9aVK009551; Tue, 15 Nov 2016 19:09:36 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201611151909.uAFJ9aVK009551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Tue, 15 Nov 2016 19:09:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308693 - head/sys/arm/ti X-SVN-Group: head 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, 15 Nov 2016 19:09:37 -0000 Author: loos Date: Tue Nov 15 19:09:36 2016 New Revision: 308693 URL: https://svnweb.freebsd.org/changeset/base/308693 Log: Change the TI aintc driver name to "ti_aintc" to avoid the conflict with the aintc driver for Allwinner A10. This fixes the boot of the GENERIC ARM kernel on TI/AM335x SoCs. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/ti/aintc.c Modified: head/sys/arm/ti/aintc.c ============================================================================== --- head/sys/arm/ti/aintc.c Tue Nov 15 18:57:25 2016 (r308692) +++ head/sys/arm/ti/aintc.c Tue Nov 15 19:09:36 2016 (r308693) @@ -297,13 +297,13 @@ static device_method_t ti_aintc_methods[ }; static driver_t ti_aintc_driver = { - "aintc", + "ti_aintc", ti_aintc_methods, sizeof(struct ti_aintc_softc), }; static devclass_t ti_aintc_devclass; -EARLY_DRIVER_MODULE(aintc, simplebus, ti_aintc_driver, ti_aintc_devclass, +EARLY_DRIVER_MODULE(ti_aintc, simplebus, ti_aintc_driver, ti_aintc_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); SIMPLEBUS_PNP_INFO(compat_data); From owner-svn-src-head@freebsd.org Tue Nov 15 19:23:50 2016 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 1916EC43C67; Tue, 15 Nov 2016 19:23: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 D42CBF22; Tue, 15 Nov 2016 19:23:49 +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 uAFJNmPM016901; Tue, 15 Nov 2016 19:23:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFJNmJC016900; Tue, 15 Nov 2016 19:23:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201611151923.uAFJNmJC016900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Nov 2016 19:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308694 - head/sys/net X-SVN-Group: head 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, 15 Nov 2016 19:23:50 -0000 Author: markj Date: Tue Nov 15 19:23:48 2016 New Revision: 308694 URL: https://svnweb.freebsd.org/changeset/base/308694 Log: Plug a lock leak in sysctl_ifmalist(). Fix style in the local variable declarations. PR: 214542 MFC after: 1 week Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Tue Nov 15 19:09:36 2016 (r308693) +++ head/sys/net/rtsock.c Tue Nov 15 19:23:48 2016 (r308694) @@ -1773,13 +1773,15 @@ done: static int sysctl_ifmalist(int af, struct walkarg *w) { - struct ifnet *ifp; - struct ifmultiaddr *ifma; - struct rt_addrinfo info; - int len, error = 0; + struct rt_addrinfo info; struct ifaddr *ifa; + struct ifmultiaddr *ifma; + struct ifnet *ifp; + int error, len; + error = 0; bzero((caddr_t)&info, sizeof(info)); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) @@ -1799,7 +1801,7 @@ sysctl_ifmalist(int af, struct walkarg * ifma->ifma_lladdr : NULL; error = rtsock_msg_buffer(RTM_NEWMADDR, &info, w, &len); if (error != 0) - goto done; + break; if (w->w_req && w->w_tmem) { struct ifma_msghdr *ifmam; @@ -1808,15 +1810,14 @@ sysctl_ifmalist(int af, struct walkarg * ifmam->ifmam_flags = 0; ifmam->ifmam_addrs = info.rti_addrs; error = SYSCTL_OUT(w->w_req, w->w_tmem, len); - if (error) { - IF_ADDR_RUNLOCK(ifp); - goto done; - } + if (error != 0) + break; } } IF_ADDR_RUNLOCK(ifp); + if (error != 0) + break; } -done: IFNET_RUNLOCK_NOSLEEP(); return (error); } From owner-svn-src-head@freebsd.org Tue Nov 15 20:05:24 2016 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 F13D8C436B6; Tue, 15 Nov 2016 20:05:23 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C16DB7EE; Tue, 15 Nov 2016 20:05:23 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFK5M3E032841; Tue, 15 Nov 2016 20:05:22 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFK5MJ5032839; Tue, 15 Nov 2016 20:05:22 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201611152005.uAFK5MJ5032839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Tue, 15 Nov 2016 20:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308695 - head/sys/dev/bhnd/bcma X-SVN-Group: head 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, 15 Nov 2016 20:05:24 -0000 Author: mizhka Date: Tue Nov 15 20:05:22 2016 New Revision: 308695 URL: https://svnweb.freebsd.org/changeset/base/308695 Log: [BHND] correct spelling error in macro name This commit is part of D6920 review. One of macro had wrong prefix: BMCA => BCMA Reviewed by: landonf, adrian (mentor) Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6920 Modified: head/sys/dev/bhnd/bcma/bcma.c head/sys/dev/bhnd/bcma/bcma_dmp.h Modified: head/sys/dev/bhnd/bcma/bcma.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma.c Tue Nov 15 19:23:48 2016 (r308694) +++ head/sys/dev/bhnd/bcma/bcma.c Tue Nov 15 20:05:22 2016 (r308695) @@ -274,7 +274,7 @@ bcma_is_hw_suspended(device_t dev, devic return (true); } - if (rst & BMCA_DMP_RC_RESET) + if (rst & BCMA_DMP_RC_RESET) return (true); /* Is core clocked? */ @@ -367,11 +367,11 @@ bcma_suspend_hw(device_t dev, device_t c /* Already in reset? */ rst = bhnd_bus_read_4(r, BCMA_DMP_RESETCTRL); - if (rst & BMCA_DMP_RC_RESET) + if (rst & BCMA_DMP_RC_RESET) return (0); /* Put core into reset */ - if ((error = bcma_dmp_write_reset(child, dinfo, BMCA_DMP_RC_RESET))) + if ((error = bcma_dmp_write_reset(child, dinfo, BCMA_DMP_RC_RESET))) return (error); /* Clear core flags */ Modified: head/sys/dev/bhnd/bcma/bcma_dmp.h ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_dmp.h Tue Nov 15 19:23:48 2016 (r308694) +++ head/sys/dev/bhnd/bcma/bcma_dmp.h Tue Nov 15 20:05:22 2016 (r308695) @@ -252,7 +252,7 @@ #define BCMA_DMP_IOST_MASK 0x0000FFFF /* resetctrl */ -#define BMCA_DMP_RC_RESET 0x00000001 +#define BCMA_DMP_RC_RESET 0x00000001 /* config */ #define BCMA_DMP_CFG_OOB 0x00000020 From owner-svn-src-head@freebsd.org Tue Nov 15 20:35:31 2016 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 2EA8EC43E01; Tue, 15 Nov 2016 20:35:31 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCD2316B7; Tue, 15 Nov 2016 20:35:30 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFKZUjL045029; Tue, 15 Nov 2016 20:35:30 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFKZTQB045021; Tue, 15 Nov 2016 20:35:29 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201611152035.uAFKZTQB045021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Tue, 15 Nov 2016 20:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308696 - in head: share/man/man4 sys/boot/forth sys/conf sys/dev/bnxt sys/modules sys/modules/bnxt X-SVN-Group: head 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, 15 Nov 2016 20:35:31 -0000 Author: shurd (ports committer) Date: Tue Nov 15 20:35:29 2016 New Revision: 308696 URL: https://svnweb.freebsd.org/changeset/base/308696 Log: New driver for Broadcom NetXtreme-C and NetXtreme-E devices. This driver uses the iflib framework supporting Broadcom 25/50Gbps devices. Reviewed by: gallatin, wblock Approved by: davidch MFC after: 2 weeks Relnotes: yes Sponsored by: Broadcom Limited Differential Revision: https://reviews.freebsd.org/D7551 Added: head/share/man/man4/bnxt.4 (contents, props changed) head/sys/dev/bnxt/ head/sys/dev/bnxt/bnxt.h (contents, props changed) head/sys/dev/bnxt/bnxt_hwrm.c (contents, props changed) head/sys/dev/bnxt/bnxt_hwrm.h (contents, props changed) head/sys/dev/bnxt/bnxt_ioctl.h (contents, props changed) head/sys/dev/bnxt/bnxt_sysctl.c (contents, props changed) head/sys/dev/bnxt/bnxt_sysctl.h (contents, props changed) head/sys/dev/bnxt/bnxt_txrx.c (contents, props changed) head/sys/dev/bnxt/convert_hsi.pl (contents, props changed) head/sys/dev/bnxt/hsi_struct_def.h (contents, props changed) head/sys/dev/bnxt/if_bnxt.c (contents, props changed) head/sys/modules/bnxt/ head/sys/modules/bnxt/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/boot/forth/loader.conf head/sys/conf/NOTES head/sys/conf/files head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Tue Nov 15 20:05:22 2016 (r308695) +++ head/share/man/man4/Makefile Tue Nov 15 20:35:29 2016 (r308696) @@ -79,6 +79,7 @@ MAN= aac.4 \ bhndb.4 \ bktr.4 \ blackhole.4 \ + bnxt.4 \ bpf.4 \ bridge.4 \ bt.4 \ @@ -592,6 +593,7 @@ MLINKS+=bce.4 if_bce.4 MLINKS+=bfe.4 if_bfe.4 MLINKS+=bge.4 if_bge.4 MLINKS+=bktr.4 brooktree.4 +MLINKS+=bnxt.4 if_bnxt.4 MLINKS+=bridge.4 if_bridge.4 MLINKS+=bwi.4 if_bwi.4 MLINKS+=bwn.4 if_bwn.4 Added: head/share/man/man4/bnxt.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/bnxt.4 Tue Nov 15 20:35:29 2016 (r308696) @@ -0,0 +1,222 @@ +.\" Copyright (c) 2016 Broadcom, All Rights Reserved. +.\" The term Broadcom refers to Broadcom Limited and/or its subsidiaries +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' +.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +.\" THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 12, 2016 +.Dt BNXT 4 +.Os +.Sh NAME +.Nm bnxt +.Nd "Broadcom NetXtreme-C/NetXtreme-E Family Ethernet driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device bnxt" +.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_bnxt_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for various NICs based on the Broadcom BCM57301/2/4, +and BCM57402/4/6 Ethernet controller chips. +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver provides support for various NICs based on the Broadcom NetXtreme-C and +NetXtreme-E families of Gigabit Ethernet controller chips, including the +following: +.Pp +.Bl -bullet -compact +.It +Broadcom BCM57301 NetXtreme-C 10Gb Ethernet Controller +.It +Broadcom BCM57302 NetXtreme-C 10Gb/25Gb Ethernet Controller +.It +Broadcom BCM57304 NetXtreme-C 10Gb/25Gb/40Gb/50Gb Ethernet Controller +.It +Broadcom BCM57402 NetXtreme-E 10Gb Ethernet Controller +.It +Broadcom BCM57404 NetXtreme-E 10Gb/25Gb Ethernet Controller +.It +Broadcom BCM57406 NetXtreme-E 10GBase-T Ethernet Controller +.It +Broadcom BCM57402 NetXtreme-E Partition +.It +Broadcom BCM57407 NetXtreme-E 10GBase-T Ethernet Controller +.It +Broadcom BCM57404 NetXtreme-E Partition +.It +Broadcom BCM57406 NetXtreme-E Partition +.It +Broadcom BCM57407 NetXtreme-E 25Gb Ethernet Controller +.It +Broadcom BCM57304 NetXtreme-C Virtual Function +.It +Broadcom BCM57404 NetXtreme-E Virtual Function +.El +.Sh SYSCTL VARIABLES +These variables must be set before loading the driver, either via +.Xr loader.conf 5 +or through the use of +.Xr kenv 1 . +These are provided by the +.Xr iflib 9 +framework, and might be better documented there. +.Bl -tag -width indent +.It Va dev.bnxt.X.iflib.override_nrxds +Override the number of RX descriptors for each queue. +The value is a comma separated list of three positive integers: the size of the +completion ring, +the size of the receive ring, and the size of the aggregation ring respectively. +The completion ring should be at least the size of the aggregation ring plus +four times the size of the receive ring. +These numbers must be powers of two, and zero means to use the default. +Defaults to 0,0,0. +.It Va dev.bnxt.X.iflib.override_ntxds +Override the number of TX descriptors for each queue. +The value is a comma separated list of two positive integers: the size of the +completion ring, and the size of the transmit ring respectively. +The completion ring should be at least twice the size of the transmit ring. +These numbers must be powers of two, and zero means to use the default. +Defaults to 0,0. +.It Va override_qs_enable +When set, allows the number of transmit and receive queues to be different. +If not set, the lower of the number of TX or RX queues will be used for both. +.It Va override_nrxqs +Set the number of RX queues. +If zero, the number of RX queues is derived from the number of cores on the +socket connected to the controller. +Defaults to 0. +.It Va override_ntxqs +Set the number of TX queues. +If zero, the number of TX queues is derived from the number of cores on the +socket connected to the controller. +.El +.Pp +These +.Xr sysctl 8 +variables can be changed at any time: +.Bl -tag -width indent +.It Va dev.bnxt.X.vlan_only +Require that incoming frames must have a VLAN tag on them that matches one that +is configured for the NIC. +Normally, both frames that have a matching VLAN tag and frames that have no +VLAN tag are accepted. +Defaults to 0. +.It Va dev.bnxt.X.vlan_strip +When non-zero the NIC strips VLAN tags on receive. +Defaults to 0. +.It Va dev.bnxt.X.rx_stall +Enable buffering rather than dropping frames when there are no available host +RX buffers for DMA. +Defaults to 0. +.It Va dev.bnxt.X.rss_type +Comma-separated list of RSS hash types to support. +Default is all types. +Defaults to ipv4,tcp_ipv4,udp_ipv4,ipv6,tcp_ipv6,udp_ipv6. +.It Va dev.bnxt.X.rss_key +Current RSS key. +Defaults to a randomly generated value which is generated for each device +during attach. +.It Va dev.bnxt.X.ver.hwrm_min_ver +Minimum HWRM (HardWare Resource Manager) firmware API to support. +If the firmware implements an older version, a warning will be printed, and the +firmware should be upgraded. +Defaults to 1.2.2. +.El +.Pp +These +.Xr sysctl 8 +variables are read-only: +.Bl -tag -width indent +.It Va dev.bnxt.X.if_name +Current interface name of the device. +This will normally be +.Va bnxtX , +but this can be changed using +.Cm ifconfig name . +This sysctl allows correlating an interface with a child of dev.bnxt. +.It Va dev.bnxt.X.nvram.* +Information about the NVRAM device which contains the device firmware. +.It Va dev.bnxt.X.ver.* +Version-related information about the device and firmware: +.It Va dev.bnxt.X.ver.hwrm_if +Supported HWRM API version of the currently running firmware. +.It Va dev.bnxt.X.ver.driver_hwrm_if +HWRM API version the driver was built to support. +.It Va dev.bnxt.X.hwstats.* +Per-queue statistics tracked by the hardware. +.It Va dev.bnxt.X.hwstats.rxq0.drop_pkts +Number of packets dropped by hardware on queue zero. +This number might seem high, but the count includes packets dropped due to +incorrect destination MAC, unsubscribed multicast address, and other normal +reasons to ignore Ethernet frames. +.El +.Sh DIAGNOSTICS +.Bl -diag +.It "bnxt%d: %s command returned %s error." +Device firmware rejected a command from the driver. +There might be a driver/firmware HWRM API mismatch. +.It "bnxt%d: Timeout sending %s (timeout: %d) seq %d\n" +Device firmware unresponsive. +A PCI device reset is likely needed. +.It "bnxt%d: Timeout sending %s (timeout: %d) msg {0x%x 0x%x} len:%d v: %d\n" +Partial firmware response. +A PCI device reset is likely needed. +.Pp +As of this writing, the system must be rebooted to initiate a PCI device reset. +.El +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr vlan 4 , +.Xr ifconfig 8 , +.Xr iflib 4 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Jack Vogel Aq Mt jfvogel@gmail.com . +and is currently maintained by +.An Stephen Hurd Aq Mt stephen.hurd@broadcom.com . Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Tue Nov 15 20:05:22 2016 (r308695) +++ head/sys/boot/forth/loader.conf Tue Nov 15 20:35:29 2016 (r308696) @@ -312,6 +312,7 @@ if_axe_load="NO" # ASIX Electronics AX8 if_bce_load="NO" # Broadcom NetXtreme II Gigabit Ethernet if_bfe_load="NO" # Broadcom BCM4401 if_bge_load="NO" # Broadcom BCM570x PCI Gigabit Ethernet +if_bnxt_load="NO" # Broadcom NetXtreme-C/NetXtreme-E if_bridge_load="NO" # if_bridge(4) devices if_bwi_load="NO" # Broadcom BCM53xx IEEE 802.11b/g wireness NICs if_bwn_load="NO" # Broadcom BCM43xx IEEE 802.11 wireless NICs Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Tue Nov 15 20:05:22 2016 (r308695) +++ head/sys/conf/NOTES Tue Nov 15 20:35:29 2016 (r308696) @@ -1903,6 +1903,7 @@ device amphy # AMD AM79c873 / Davicom device atphy # Attansic/Atheros F1 device axphy # Asix Semiconductor AX88x9x device bmtphy # Broadcom BCM5201/BCM5202 and 3Com 3c905C +device bnxt # Broadcom NetXtreme-C/NetXtreme-E device brgphy # Broadcom BCM54xx/57xx 1000baseTX device ciphy # Cicada/Vitesse CS/VSC8xxx device e1000phy # Marvell 88E1000 1000/100/10-BT @@ -1943,6 +1944,7 @@ device xmphy # XaQti XMAC II # BCM570x family of controllers, including the 3Com 3c996-T, # the Netgear GA302T, the SysKonnect SK-9D21 and SK-9D41, and # the embedded gigE NICs on Dell PowerEdge 2550 servers. +# bnxt: Broadcom NetXtreme-C and NetXtreme-E PCIe 10/25/50G Ethernet adapters. # bxe: Broadcom NetXtreme II (BCM5771X/BCM578XX) PCIe 10Gb Ethernet # adapters. # bwi: Broadcom BCM430* and BCM431* family of wireless adapters. Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Nov 15 20:05:22 2016 (r308695) +++ head/sys/conf/files Tue Nov 15 20:35:29 2016 (r308696) @@ -1242,6 +1242,10 @@ dev/bktr/bktr_i2c.c optional bktr pci s dev/bktr/bktr_os.c optional bktr pci dev/bktr/bktr_tuner.c optional bktr pci dev/bktr/msp34xx.c optional bktr pci +dev/bnxt/bnxt_hwrm.c optional bnxt iflib pci +dev/bnxt/bnxt_sysctl.c optional bnxt iflib pci +dev/bnxt/bnxt_txrx.c optional bnxt iflib pci +dev/bnxt/if_bnxt.c optional bnxt iflib pci dev/buslogic/bt.c optional bt dev/buslogic/bt_eisa.c optional bt eisa dev/buslogic/bt_isa.c optional bt isa Added: head/sys/dev/bnxt/bnxt.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bnxt/bnxt.h Tue Nov 15 20:35:29 2016 (r308696) @@ -0,0 +1,568 @@ +/*- + * Broadcom NetXtreme-C/E network driver. + * + * Copyright (c) 2016 Broadcom, All Rights Reserved. + * The term Broadcom refers to Broadcom Limited and/or its subsidiaries + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#ifndef _BNXT_H +#define _BNXT_H + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "hsi_struct_def.h" + +/* PCI IDs */ +#define BROADCOM_VENDOR_ID 0x14E4 + +#define BCM57301 0x16c8 +#define BCM57302 0x16c9 +#define BCM57304 0x16ca +#define BCM57402 0x16d0 +#define BCM57404 0x16d1 +#define BCM57406 0x16d2 +#define BCM57402_NPAR 0x16d4 +#define BCM57407 0x16d5 +#define BCM57404_NPAR 0x16e7 +#define BCM57406_NPAR 0x16e8 +#define BCM57407_SFP 0x16e9 +#define BCM57304_VF 0x16cb +#define BCM57404_VF 0x16d3 + +#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ + CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ + CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) + +#define BNXT_MAX_MTU 9000 + +/* Completion related defines */ +#define CMP_VALID(cmp, v_bit) \ + ((!!(((struct cmpl_base *)(cmp))->info3_v & htole32(CMPL_BASE_V))) == !!(v_bit) ) + +#define NEXT_CP_CONS_V(ring, cons, v_bit) do { \ + if (__predict_false(++(cons) == (ring)->ring_size)) \ + ((cons) = 0, (v_bit) = !v_bit); \ +} while (0) + +#define RING_NEXT(ring, idx) (__predict_false(idx + 1 == (ring)->ring_size) ? \ + 0 : idx + 1) + +#define CMPL_PREFETCH_NEXT(cpr, idx) \ + __builtin_prefetch(&((struct cmpl_base *)(cpr)->ring.vaddr)[((idx) +\ + (CACHE_LINE_SIZE / sizeof(struct cmpl_base))) & \ + ((cpr)->ring.ring_size - 1)]) + +/* + * If we update the index, a write barrier is needed after the write to ensure + * the completion ring has space before the RX/TX ring does. Since we can't + * make the RX and AG doorbells covered by the same barrier without remapping + * MSI-X vectors, we create the barrier over the enture doorbell bar. + * TODO: Remap the MSI-X vectors to allow a barrier to only cover the doorbells + * for a single ring group. + * + * A barrier of just the size of the write is used to ensure the ordering + * remains correct and no writes are lost. + */ +#define BNXT_CP_DISABLE_DB(ring) do { \ + bus_space_barrier((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, (ring)->doorbell, 4, \ + BUS_SPACE_BARRIER_WRITE); \ + bus_space_barrier((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, 0, \ + (ring)->softc->doorbell_bar.size, BUS_SPACE_BARRIER_WRITE); \ + bus_space_write_4((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, (ring)->doorbell, \ + htole32(CMPL_DOORBELL_KEY_CMPL | CMPL_DOORBELL_MASK)); \ +} while (0) + +#define BNXT_CP_ENABLE_DB(ring) do { \ + bus_space_barrier((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, (ring)->doorbell, 4, \ + BUS_SPACE_BARRIER_WRITE); \ + bus_space_barrier((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, 0, \ + (ring)->softc->doorbell_bar.size, BUS_SPACE_BARRIER_WRITE); \ + bus_space_write_4((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, (ring)->doorbell, \ + htole32(CMPL_DOORBELL_KEY_CMPL)); \ +} while (0) + +#define BNXT_CP_IDX_ENABLE_DB(ring, cons) do { \ + bus_space_barrier((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, (ring)->doorbell, 4, \ + BUS_SPACE_BARRIER_WRITE); \ + bus_space_write_4((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, (ring)->doorbell, \ + htole32(CMPL_DOORBELL_KEY_CMPL | CMPL_DOORBELL_IDX_VALID | \ + (cons))); \ + bus_space_barrier((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, 0, \ + (ring)->softc->doorbell_bar.size, BUS_SPACE_BARRIER_WRITE); \ +} while (0) + +#define BNXT_CP_IDX_DISABLE_DB(ring, cons) do { \ + bus_space_barrier((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, (ring)->doorbell, 4, \ + BUS_SPACE_BARRIER_WRITE); \ + bus_space_write_4((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, (ring)->doorbell, \ + htole32(CMPL_DOORBELL_KEY_CMPL | CMPL_DOORBELL_IDX_VALID | \ + CMPL_DOORBELL_MASK | (cons))); \ + bus_space_barrier((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, 0, \ + (ring)->softc->doorbell_bar.size, BUS_SPACE_BARRIER_WRITE); \ +} while (0) + +#define BNXT_TX_DB(ring, idx) do { \ + bus_space_barrier((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, (ring)->doorbell, 4, \ + BUS_SPACE_BARRIER_WRITE); \ + bus_space_write_4( \ + (ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, \ + (ring)->doorbell, htole32(TX_DOORBELL_KEY_TX | (idx))); \ +} while (0) + +#define BNXT_RX_DB(ring, idx) do { \ + bus_space_barrier((ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, (ring)->doorbell, 4, \ + BUS_SPACE_BARRIER_WRITE); \ + bus_space_write_4( \ + (ring)->softc->doorbell_bar.tag, \ + (ring)->softc->doorbell_bar.handle, \ + (ring)->doorbell, htole32(RX_DOORBELL_KEY_RX | (idx))); \ +} while (0) + +/* Lock macros */ +#define BNXT_HWRM_LOCK_INIT(_softc, _name) \ + mtx_init(&(_softc)->hwrm_lock, _name, "BNXT HWRM Lock", MTX_DEF) +#define BNXT_HWRM_LOCK(_softc) mtx_lock(&(_softc)->hwrm_lock) +#define BNXT_HWRM_UNLOCK(_softc) mtx_unlock(&(_softc)->hwrm_lock) +#define BNXT_HWRM_LOCK_DESTROY(_softc) mtx_destroy(&(_softc)->hwrm_lock) +#define BNXT_HWRM_LOCK_ASSERT(_softc) mtx_assert(&(_softc)->hwrm_lock, \ + MA_OWNED) + +/* Chip info */ +#define BNXT_TSO_SIZE UINT16_MAX + +/* NVRAM access */ +enum bnxt_nvm_directory_type { + BNX_DIR_TYPE_UNUSED = 0, + BNX_DIR_TYPE_PKG_LOG = 1, + BNX_DIR_TYPE_UPDATE = 2, + BNX_DIR_TYPE_CHIMP_PATCH = 3, + BNX_DIR_TYPE_BOOTCODE = 4, + BNX_DIR_TYPE_VPD = 5, + BNX_DIR_TYPE_EXP_ROM_MBA = 6, + BNX_DIR_TYPE_AVS = 7, + BNX_DIR_TYPE_PCIE = 8, + BNX_DIR_TYPE_PORT_MACRO = 9, + BNX_DIR_TYPE_APE_FW = 10, + BNX_DIR_TYPE_APE_PATCH = 11, + BNX_DIR_TYPE_KONG_FW = 12, + BNX_DIR_TYPE_KONG_PATCH = 13, + BNX_DIR_TYPE_BONO_FW = 14, + BNX_DIR_TYPE_BONO_PATCH = 15, + BNX_DIR_TYPE_TANG_FW = 16, + BNX_DIR_TYPE_TANG_PATCH = 17, + BNX_DIR_TYPE_BOOTCODE_2 = 18, + BNX_DIR_TYPE_CCM = 19, + BNX_DIR_TYPE_PCI_CFG = 20, + BNX_DIR_TYPE_TSCF_UCODE = 21, + BNX_DIR_TYPE_ISCSI_BOOT = 22, + BNX_DIR_TYPE_ISCSI_BOOT_IPV6 = 24, + BNX_DIR_TYPE_ISCSI_BOOT_IPV4N6 = 25, + BNX_DIR_TYPE_ISCSI_BOOT_CFG6 = 26, + BNX_DIR_TYPE_EXT_PHY = 27, + BNX_DIR_TYPE_SHARED_CFG = 40, + BNX_DIR_TYPE_PORT_CFG = 41, + BNX_DIR_TYPE_FUNC_CFG = 42, + BNX_DIR_TYPE_MGMT_CFG = 48, + BNX_DIR_TYPE_MGMT_DATA = 49, + BNX_DIR_TYPE_MGMT_WEB_DATA = 50, + BNX_DIR_TYPE_MGMT_WEB_META = 51, + BNX_DIR_TYPE_MGMT_EVENT_LOG = 52, + BNX_DIR_TYPE_MGMT_AUDIT_LOG = 53 +}; + +enum bnxnvm_pkglog_field_index { + BNX_PKG_LOG_FIELD_IDX_INSTALLED_TIMESTAMP = 0, + BNX_PKG_LOG_FIELD_IDX_PKG_DESCRIPTION = 1, + BNX_PKG_LOG_FIELD_IDX_PKG_VERSION = 2, + BNX_PKG_LOG_FIELD_IDX_PKG_TIMESTAMP = 3, + BNX_PKG_LOG_FIELD_IDX_PKG_CHECKSUM = 4, + BNX_PKG_LOG_FIELD_IDX_INSTALLED_ITEMS = 5, + BNX_PKG_LOG_FIELD_IDX_INSTALLED_MASK = 6 +}; + +#define BNX_DIR_ORDINAL_FIRST 0 +#define BNX_DIR_EXT_NONE 0 + +struct bnxt_bar_info { + struct resource *res; + bus_space_tag_t tag; + bus_space_handle_t handle; + bus_size_t size; + int rid; +}; + +struct bnxt_link_info { + uint8_t media_type; + uint8_t transceiver; + uint8_t phy_addr; + uint8_t phy_link_status; + uint8_t wire_speed; + uint8_t loop_back; + uint8_t link_up; + uint8_t last_link_up; + uint8_t duplex; + uint8_t last_duplex; + uint8_t pause; + uint8_t last_pause; + uint8_t auto_pause; + uint8_t force_pause; + uint8_t duplex_setting; + uint8_t auto_mode; +#define PHY_VER_LEN 3 + uint8_t phy_ver[PHY_VER_LEN]; + uint8_t phy_type; + uint16_t link_speed; + uint16_t support_speeds; + uint16_t auto_link_speeds; + uint16_t auto_link_speed; + uint16_t force_link_speed; + uint32_t preemphasis; + + /* copy of requested setting */ + uint8_t autoneg; +#define BNXT_AUTONEG_SPEED 1 +#define BNXT_AUTONEG_FLOW_CTRL 2 + uint8_t req_duplex; + uint8_t req_flow_ctrl; + uint16_t req_link_speed; +}; + +enum bnxt_cp_type { + BNXT_DEFAULT, + BNXT_TX, + BNXT_RX, + BNXT_SHARED +}; + +struct bnxt_cos_queue { + uint8_t id; + uint8_t profile; +}; + +struct bnxt_func_info { + uint32_t fw_fid; + uint8_t mac_addr[ETHER_ADDR_LEN]; + uint16_t max_rsscos_ctxs; + uint16_t max_cp_rings; + uint16_t max_tx_rings; + uint16_t max_rx_rings; + uint16_t max_hw_ring_grps; + uint16_t max_irqs; + uint16_t max_l2_ctxs; + uint16_t max_vnics; + uint16_t max_stat_ctxs; +}; + +struct bnxt_pf_info { +#define BNXT_FIRST_PF_FID 1 +#define BNXT_FIRST_VF_FID 128 + uint8_t port_id; + uint32_t first_vf_id; + uint16_t active_vfs; + uint16_t max_vfs; + uint32_t max_encap_records; + uint32_t max_decap_records; + uint32_t max_tx_em_flows; + uint32_t max_tx_wm_flows; + uint32_t max_rx_em_flows; + uint32_t max_rx_wm_flows; + unsigned long *vf_event_bmap; + uint16_t hwrm_cmd_req_pages; + void *hwrm_cmd_req_addr[4]; + bus_addr_t hwrm_cmd_req_dma_addr[4]; +}; + +struct bnxt_vf_info { + uint16_t fw_fid; + uint8_t mac_addr[ETHER_ADDR_LEN]; + uint16_t max_rsscos_ctxs; + uint16_t max_cp_rings; + uint16_t max_tx_rings; + uint16_t max_rx_rings; + uint16_t max_hw_ring_grps; + uint16_t max_l2_ctxs; + uint16_t max_irqs; + uint16_t max_vnics; + uint16_t max_stat_ctxs; + uint32_t vlan; +#define BNXT_VF_QOS 0x1 +#define BNXT_VF_SPOOFCHK 0x2 +#define BNXT_VF_LINK_FORCED 0x4 +#define BNXT_VF_LINK_UP 0x8 + uint32_t flags; + uint32_t func_flags; /* func cfg flags */ + uint32_t min_tx_rate; + uint32_t max_tx_rate; + void *hwrm_cmd_req_addr; + bus_addr_t hwrm_cmd_req_dma_addr; +}; + +#define BNXT_FLAG_VF (1<<1) + +#define BNXT_PF(softc) (!((softc)->flags & BNXT_FLAG_VF)) +#define BNXT_VF(softc) ((softc)->flags & BNXT_FLAG_VF) + +struct bnxt_vlan_tag { + SLIST_ENTRY(bnxt_vlan_tag) next; + uint16_t tpid; + uint16_t tag; +}; + +struct bnxt_vnic_info { + uint16_t id; + uint16_t def_ring_grp; + uint16_t cos_rule; + uint16_t lb_rule; + uint16_t mru; + + uint32_t rx_mask; + bool vlan_only; + struct iflib_dma_info mc_list; + int mc_list_count; +#define BNXT_MAX_MC_ADDRS 16 + + uint32_t flags; +#define BNXT_VNIC_FLAG_DEFAULT 0x01 +#define BNXT_VNIC_FLAG_BD_STALL 0x02 +#define BNXT_VNIC_FLAG_VLAN_STRIP 0x04 + + uint64_t filter_id; + uint32_t flow_id; + + uint16_t rss_id; + uint32_t rss_hash_type; + uint8_t rss_hash_key[HW_HASH_KEY_SIZE]; + struct iflib_dma_info rss_hash_key_tbl; + struct iflib_dma_info rss_grp_tbl; + SLIST_HEAD(vlan_head, bnxt_vlan_tag) vlan_tags; + struct iflib_dma_info vlan_tag_list; +}; + +struct bnxt_grp_info { + uint16_t stats_ctx; + uint16_t grp_id; + uint16_t rx_ring_id; + uint16_t cp_ring_id; + uint16_t ag_ring_id; +}; + +struct bnxt_ring { + uint64_t paddr; + vm_offset_t doorbell; + caddr_t vaddr; + struct bnxt_softc *softc; + uint32_t ring_size; /* Must be a power of two */ + uint16_t id; /* Logical ID */ + uint16_t phys_id; +}; + +struct bnxt_cp_ring { + struct bnxt_ring ring; + struct if_irq irq; + uint32_t cons; + bool v_bit; /* Value of valid bit */ + struct ctx_hw_stats *stats; + uint32_t stats_ctx_id; + uint32_t last_idx; /* Used by RX rings only + * set to the last read pidx + */ +}; + +struct bnxt_full_tpa_start { + struct rx_tpa_start_cmpl low; + struct rx_tpa_start_cmpl_hi high; +}; + +/* All the version information for the part */ +#define BNXT_VERSTR_SIZE (3*3+2+1) /* ie: "255.255.255\0" */ +#define BNXT_NAME_SIZE 17 +struct bnxt_ver_info { + uint8_t hwrm_if_major; + uint8_t hwrm_if_minor; + uint8_t hwrm_if_update; + char hwrm_if_ver[BNXT_VERSTR_SIZE]; + char driver_hwrm_if_ver[BNXT_VERSTR_SIZE]; + char hwrm_fw_ver[BNXT_VERSTR_SIZE]; + char mgmt_fw_ver[BNXT_VERSTR_SIZE]; + char netctrl_fw_ver[BNXT_VERSTR_SIZE]; + char roce_fw_ver[BNXT_VERSTR_SIZE]; + char phy_ver[BNXT_VERSTR_SIZE]; + char pkg_ver[64]; + + char hwrm_fw_name[BNXT_NAME_SIZE]; + char mgmt_fw_name[BNXT_NAME_SIZE]; + char netctrl_fw_name[BNXT_NAME_SIZE]; + char roce_fw_name[BNXT_NAME_SIZE]; + char phy_vendor[BNXT_NAME_SIZE]; + char phy_partnumber[BNXT_NAME_SIZE]; + + uint16_t chip_num; + uint8_t chip_rev; + uint8_t chip_metal; + uint8_t chip_bond_id; + uint8_t chip_type; + + uint8_t hwrm_min_major; + uint8_t hwrm_min_minor; + uint8_t hwrm_min_update; + + struct sysctl_ctx_list ver_ctx; + struct sysctl_oid *ver_oid; +}; + +struct bnxt_nvram_info { + uint16_t mfg_id; + uint16_t device_id; + uint32_t sector_size; + uint32_t size; + uint32_t reserved_size; + uint32_t available_size; + + struct sysctl_ctx_list nvm_ctx; + struct sysctl_oid *nvm_oid; +}; + +struct bnxt_softc { + device_t dev; + if_ctx_t ctx; + if_softc_ctx_t scctx; + if_shared_ctx_t sctx; + struct ifmedia *media; + + struct bnxt_bar_info hwrm_bar; + struct bnxt_bar_info doorbell_bar; + struct bnxt_link_info link_info; +#define BNXT_FLAG_NPAR 1 + uint32_t flags; + uint32_t total_msix; + + struct bnxt_func_info func; + struct bnxt_pf_info pf; + struct bnxt_vf_info vf; + + uint16_t hwrm_cmd_seq; + uint32_t hwrm_cmd_timeo; /* milliseconds */ + struct iflib_dma_info hwrm_cmd_resp; + /* Interrupt info for HWRM */ + struct if_irq irq; + struct mtx hwrm_lock; + uint16_t hwrm_max_req_len; + +#define BNXT_MAX_QUEUE 8 + uint8_t max_tc; + struct bnxt_cos_queue q_info[BNXT_MAX_QUEUE]; + + struct iflib_dma_info hw_rx_port_stats; + struct iflib_dma_info hw_tx_port_stats; + struct rx_port_stats *rx_port_stats; + struct tx_port_stats *tx_port_stats; + + int num_cp_rings; + + struct bnxt_ring *tx_rings; + struct bnxt_cp_ring *tx_cp_rings; + struct iflib_dma_info tx_stats; + int ntxqsets; + + struct bnxt_vnic_info vnic_info; + struct bnxt_ring *ag_rings; + struct bnxt_ring *rx_rings; + struct bnxt_cp_ring *rx_cp_rings; + struct bnxt_grp_info *grp_info; + struct iflib_dma_info rx_stats; + int nrxqsets; + + struct bnxt_cp_ring def_cp_ring; + struct iflib_dma_info def_cp_ring_mem; + struct grouptask def_cp_task; + + struct sysctl_ctx_list hw_stats; + struct sysctl_oid *hw_stats_oid; + + struct bnxt_full_tpa_start *tpa_start; + struct bnxt_ver_info *ver_info; + struct bnxt_nvram_info *nvm_info; +}; + +struct bnxt_filter_info { + STAILQ_ENTRY(bnxt_filter_info) next; + uint64_t fw_l2_filter_id; +#define INVALID_MAC_INDEX ((uint16_t)-1) + uint16_t mac_index; + + /* Filter Characteristics */ + uint32_t flags; + uint32_t enables; + uint8_t l2_addr[ETHER_ADDR_LEN]; + uint8_t l2_addr_mask[ETHER_ADDR_LEN]; + uint16_t l2_ovlan; + uint16_t l2_ovlan_mask; + uint16_t l2_ivlan; + uint16_t l2_ivlan_mask; + uint8_t t_l2_addr[ETHER_ADDR_LEN]; + uint8_t t_l2_addr_mask[ETHER_ADDR_LEN]; + uint16_t t_l2_ovlan; + uint16_t t_l2_ovlan_mask; + uint16_t t_l2_ivlan; + uint16_t t_l2_ivlan_mask; + uint8_t tunnel_type; + uint16_t mirror_vnic_id; + uint32_t vni; + uint8_t pri_hint; + uint64_t l2_filter_id_hint; +}; + +/* Function declarations */ +void bnxt_report_link(struct bnxt_softc *softc); +bool bnxt_check_hwrm_version(struct bnxt_softc *softc); + +#endif /* _BNXT_H */ Added: head/sys/dev/bnxt/bnxt_hwrm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bnxt/bnxt_hwrm.c Tue Nov 15 20:35:29 2016 (r308696) @@ -0,0 +1,1485 @@ +/*- + * Broadcom NetXtreme-C/E network driver. + * + * Copyright (c) 2016 Broadcom, All Rights Reserved. + * The term Broadcom refers to Broadcom Limited and/or its subsidiaries + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include "bnxt.h" +#include "bnxt_hwrm.h" +#include "hsi_struct_def.h" + +static int bnxt_hwrm_err_map(uint16_t err); +static inline int _is_valid_ether_addr(uint8_t *); +static inline void get_random_ether_addr(uint8_t *); +static void bnxt_hwrm_set_link_common(struct bnxt_softc *softc, + struct hwrm_port_phy_cfg_input *req); +static void bnxt_hwrm_set_pause_common(struct bnxt_softc *softc, + struct hwrm_port_phy_cfg_input *req); +static void bnxt_hwrm_set_eee(struct bnxt_softc *softc, + struct hwrm_port_phy_cfg_input *req); +static int _hwrm_send_message(struct bnxt_softc *, void *, uint32_t); +static int hwrm_send_message(struct bnxt_softc *, void *, uint32_t); +static void bnxt_hwrm_cmd_hdr_init(struct bnxt_softc *, void *, uint16_t); + +/* NVRam stuff has a five minute timeout */ +#define BNXT_NVM_TIMEO (5 * 60 * 1000) + +static int +bnxt_hwrm_err_map(uint16_t err) +{ + int rc; + + switch (err) { + case HWRM_ERR_CODE_SUCCESS: + return 0; + case HWRM_ERR_CODE_INVALID_PARAMS: + case HWRM_ERR_CODE_INVALID_FLAGS: + case HWRM_ERR_CODE_INVALID_ENABLES: + return EINVAL; + case HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED: + return EACCES; + case HWRM_ERR_CODE_RESOURCE_ALLOC_ERROR: + return ENOMEM; + case HWRM_ERR_CODE_CMD_NOT_SUPPORTED: + return ENOSYS; + case HWRM_ERR_CODE_FAIL: + return EIO; + case HWRM_ERR_CODE_HWRM_ERROR: + case HWRM_ERR_CODE_UNKNOWN_ERR: + default: + return EDOOFUS; + } + + return rc; +} + +int +bnxt_alloc_hwrm_dma_mem(struct bnxt_softc *softc) +{ + int rc; + + rc = iflib_dma_alloc(softc->ctx, PAGE_SIZE, &softc->hwrm_cmd_resp, + BUS_DMA_NOWAIT); + return rc; +} + +void +bnxt_free_hwrm_dma_mem(struct bnxt_softc *softc) +{ + if (softc->hwrm_cmd_resp.idi_vaddr) + iflib_dma_free(&softc->hwrm_cmd_resp); + softc->hwrm_cmd_resp.idi_vaddr = NULL; + return; +} + +static void +bnxt_hwrm_cmd_hdr_init(struct bnxt_softc *softc, void *request, + uint16_t req_type) +{ + struct input *req = request; + + req->req_type = htole16(req_type); + req->cmpl_ring = 0xffff; + req->target_id = 0xffff; + req->resp_addr = htole64(softc->hwrm_cmd_resp.idi_paddr); +} + +static int +_hwrm_send_message(struct bnxt_softc *softc, void *msg, uint32_t msg_len) +{ + struct input *req = msg; + struct hwrm_err_output *resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; + uint32_t *data = msg; + int i; + uint16_t cp_ring_id; + uint8_t *valid; + uint16_t err; + + /* TODO: DMASYNC in here. */ + req->seq_id = htole16(softc->hwrm_cmd_seq++); + memset(resp, 0, PAGE_SIZE); + cp_ring_id = le16toh(req->cmpl_ring); + + /* Write request msg to hwrm channel */ + for (i = 0; i < msg_len; i += 4) { + bus_space_write_4(softc->hwrm_bar.tag, + softc->hwrm_bar.handle, + i, *data); + data++; + } + + /* Clear to the end of the request buffer */ + for (i = msg_len; i < HWRM_MAX_REQ_LEN; i += 4) + bus_space_write_4(softc->hwrm_bar.tag, softc->hwrm_bar.handle, + i, 0); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Nov 15 20:44:20 2016 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 73A9BC43163; Tue, 15 Nov 2016 20:44:20 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45B3F1CE3; Tue, 15 Nov 2016 20:44:20 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFKiJlW049245; Tue, 15 Nov 2016 20:44:19 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFKiJgF049244; Tue, 15 Nov 2016 20:44:19 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201611152044.uAFKiJgF049244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Tue, 15 Nov 2016 20:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308697 - head/sys/mips/mips X-SVN-Group: head 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, 15 Nov 2016 20:44:20 -0000 Author: mizhka Date: Tue Nov 15 20:44:19 2016 New Revision: 308697 URL: https://svnweb.freebsd.org/changeset/base/308697 Log: [MIPS] Fix Config3[ULRI] printing Bit identifier of printf %b is octal integer, but not decimal. ULRI bit is 13-th bit (starting with 0) according to MIPS Architecture Volume III v.6. In this case the bit identifier (starts with 1) should be \16. Reviewed by: gonzo Approved by: adrian(mentor) Differential Revision: https://reviews.freebsd.org/D8516 Modified: head/sys/mips/mips/cpu.c Modified: head/sys/mips/mips/cpu.c ============================================================================== --- head/sys/mips/mips/cpu.c Tue Nov 15 20:35:29 2016 (r308696) +++ head/sys/mips/mips/cpu.c Tue Nov 15 20:44:19 2016 (r308697) @@ -481,7 +481,7 @@ cpu_identify(void) /* Print Config3 if it contains any useful info */ if (cfg3 & ~(0x80000000)) - printf(" Config3=0x%b\n", cfg3, "\20\14ULRI\2SmartMIPS\1TraceLogic"); + printf(" Config3=0x%b\n", cfg3, "\20\16ULRI\2SmartMIPS\1TraceLogic"); #if defined(CPU_MIPS1004K) || defined (CPU_MIPS74K) || defined (CPU_MIPS24K) cfg7 = mips_rd_config7(); From owner-svn-src-head@freebsd.org Tue Nov 15 21:18:56 2016 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 4852AC43A3B; Tue, 15 Nov 2016 21:18:56 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16DB4FE2; Tue, 15 Nov 2016 21:18:56 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFLItR2061810; Tue, 15 Nov 2016 21:18:55 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFLItux061809; Tue, 15 Nov 2016 21:18:55 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201611152118.uAFLItux061809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Tue, 15 Nov 2016 21:18:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308698 - head/sys/arm/ti X-SVN-Group: head 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, 15 Nov 2016 21:18:56 -0000 Author: loos Date: Tue Nov 15 21:18:55 2016 New Revision: 308698 URL: https://svnweb.freebsd.org/changeset/base/308698 Log: After r308533, the platform compatible string must be an exact match. Use "ti,am33xx" instead of "ti,am335x", which gives an exact match in every DTS we support. This fixes the boot on TI SoCs after r308533. Suggested by: gonzo Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/ti/ti_machdep.c Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Tue Nov 15 20:44:19 2016 (r308697) +++ head/sys/arm/ti/ti_machdep.c Tue Nov 15 21:18:55 2016 (r308698) @@ -124,5 +124,5 @@ static platform_method_t am335x_methods[ PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am335x", 200); +FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am33xx", 200); #endif From owner-svn-src-head@freebsd.org Tue Nov 15 21:46:00 2016 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 D14EEC4353E; Tue, 15 Nov 2016 21:46:00 +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 AF0D6EB; Tue, 15 Nov 2016 21:46:00 +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 810FD10A745; Tue, 15 Nov 2016 16:45:52 -0500 (EST) From: John Baldwin To: Alan Somers Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r262489 - in head/sys: net netinet netinet6 netipsec sys Date: Tue, 15 Nov 2016 13:16:44 -0800 Message-ID: <2581345.YaPtPGdUKV@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201402251844.s1PIiYh9055297@svn.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); Tue, 15 Nov 2016 16:45:52 -0500 (EST) 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: Tue, 15 Nov 2016 21:46:00 -0000 On Tuesday, November 15, 2016 08:52:29 AM Alan Somers wrote: > On Tue, Feb 25, 2014 at 11:44 AM, John Baldwin wrote: > > Author: jhb > > Date: Tue Feb 25 18:44:33 2014 > > New Revision: 262489 > > URL: http://svnweb.freebsd.org/changeset/base/262489 > > > > Log: > > Remove more constants related to static sysctl nodes. The MAXID constants > > were primarily used to size the sysctl name list macros that were removed > > in r254295. A few other constants either did not have an associated > > sysctl node, or the associated node used OID_AUTO instead. > > > > PR: ports/184525 (exp-run) > > > > Modified: > > head/sys/net/if_pfsync.h > > head/sys/netinet/icmp_var.h > > head/sys/netinet/igmp_var.h > > head/sys/netinet/in.h > > head/sys/netinet/pim_var.h > > head/sys/netinet/tcp_var.h > > head/sys/netinet/udp_var.h > > head/sys/netinet6/pim6_var.h > > head/sys/netipsec/ipsec.h > > head/sys/netipsec/key_var.h > > head/sys/sys/socket.h > > head/sys/sys/sysctl.h > > > > For the record, John meant 254925, not 254295. Doh, transposition strikes again! Thanks. -- John Baldwin From owner-svn-src-head@freebsd.org Tue Nov 15 21:49:02 2016 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 E2EFEC4372A; Tue, 15 Nov 2016 21:49:02 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9C5C3C3; Tue, 15 Nov 2016 21:49:02 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFLn12d074010; Tue, 15 Nov 2016 21:49:01 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFLn1VU074009; Tue, 15 Nov 2016 21:49:01 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201611152149.uAFLn1VU074009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Tue, 15 Nov 2016 21:49:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308699 - head/sys/dev/etherswitch/e6000sw X-SVN-Group: head 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, 15 Nov 2016 21:49:03 -0000 Author: mizhka Date: Tue Nov 15 21:49:01 2016 New Revision: 308699 URL: https://svnweb.freebsd.org/changeset/base/308699 Log: [etherswitch] add Marvell 88e6060 switch support Add 88e6060 basic support: only port-based VLAN is supported. No vlan(4) support. Submitted by: Hiroki Mori Reviewed by: mizhka, adrian Approved by: adrian(mentor) Differential Revision: https://reviews.freebsd.org/D8344 Added: head/sys/dev/etherswitch/e6000sw/e6060sw.c (contents, props changed) Added: head/sys/dev/etherswitch/e6000sw/e6060sw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/etherswitch/e6000sw/e6060sw.c Tue Nov 15 21:49:01 2016 (r308699) @@ -0,0 +1,703 @@ +/*- + * Copyright (c) 2016 Hiroki Mori + * Copyright (c) 2013 Luiz Otavio O Souza. + * Copyright (c) 2011-2012 Stefan Bethke. + * Copyright (c) 2012 Adrian Chadd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * This code is Marvell 88E6060 ethernet switch support code on etherswitch + * framework. + * Current code is only support port base vlan. Not support ingress/egress + * trailer. This switch chip can't work vlan(4) support. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "mdio_if.h" +#include "miibus_if.h" +#include "etherswitch_if.h" + +#define SMI_OFFSET 0x10 +#define CORE_REGISTER (SMI_OFFSET + 8) + +#define SWITCH_ID 3 +#define PORT_VLAN_MAP 6 + +MALLOC_DECLARE(M_E6060SW); +MALLOC_DEFINE(M_E6060SW, "e6060sw", "e6060sw data structures"); + +struct e6060sw_softc { + struct mtx sc_mtx; /* serialize access to softc */ + device_t sc_dev; + int vlan_mode; + int media; /* cpu port media */ + int cpuport; /* which PHY is connected to the CPU */ + int phymask; /* PHYs we manage */ + int numports; /* number of ports */ + int ifpport[MII_NPHY]; + int *portphy; + char **ifname; + device_t **miibus; + struct ifnet **ifp; + struct callout callout_tick; + etherswitch_info_t info; +}; + +#define E6060SW_LOCK(_sc) \ + mtx_lock(&(_sc)->sc_mtx) +#define E6060SW_UNLOCK(_sc) \ + mtx_unlock(&(_sc)->sc_mtx) +#define E6060SW_LOCK_ASSERT(_sc, _what) \ + mtx_assert(&(_sc)->sc_mtx, (_what)) +#define E6060SW_TRYLOCK(_sc) \ + mtx_trylock(&(_sc)->sc_mtx) + +#if defined(DEBUG) +#define DPRINTF(dev, args...) device_printf(dev, args) +#else +#define DPRINTF(dev, args...) +#endif + +static inline int e6060sw_portforphy(struct e6060sw_softc *, int); +static void e6060sw_tick(void *); +static int e6060sw_ifmedia_upd(struct ifnet *); +static void e6060sw_ifmedia_sts(struct ifnet *, struct ifmediareq *); + +static int +e6060sw_probe(device_t dev) +{ + int data; + struct e6060sw_softc *sc; + + sc = device_get_softc(dev); + bzero(sc, sizeof(*sc)); + + data = MDIO_READREG(device_get_parent(dev), CORE_REGISTER, SWITCH_ID); + if (bootverbose) + device_printf(dev,"Switch Identifier Register %x\n", data); + + if ((data >> 4) != 0x060) { + return (ENXIO); + } + + device_set_desc_copy(dev, "Marvell 88E6060 MDIO switch driver"); + return (BUS_PROBE_DEFAULT); +} + +static int +e6060sw_attach_phys(struct e6060sw_softc *sc) +{ + int phy, port, err; + char name[IFNAMSIZ]; + + port = 0; + err = 0; + /* PHYs need an interface, so we generate a dummy one */ + snprintf(name, IFNAMSIZ, "%sport", device_get_nameunit(sc->sc_dev)); + for (phy = 0; phy < sc->numports; phy++) { + if (((1 << phy) & sc->phymask) == 0) + continue; + sc->ifpport[phy] = port; + sc->portphy[port] = phy; + sc->ifp[port] = if_alloc(IFT_ETHER); + sc->ifp[port]->if_softc = sc; + sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | + IFF_DRV_RUNNING | IFF_SIMPLEX; + if_initname(sc->ifp[port], name, port); + sc->miibus[port] = malloc(sizeof(device_t), M_E6060SW, + M_WAITOK | M_ZERO); + err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port], + e6060sw_ifmedia_upd, e6060sw_ifmedia_sts, \ + BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); + DPRINTF(sc->sc_dev, "%s attached to pseudo interface %s\n", + device_get_nameunit(*sc->miibus[port]), + sc->ifp[port]->if_xname); + if (err != 0) { + device_printf(sc->sc_dev, + "attaching PHY %d failed\n", + phy); + break; + } + ++port; + } + sc->info.es_nports = port; + if (sc->cpuport != -1) { + /* assume cpuport is last one */ + sc->ifpport[sc->cpuport] = port; + sc->portphy[port] = sc->cpuport; + ++sc->info.es_nports; + } + return (err); +} + +static int +e6060sw_attach(device_t dev) +{ + struct e6060sw_softc *sc; + int err; + + sc = device_get_softc(dev); + err = 0; + + sc->sc_dev = dev; + mtx_init(&sc->sc_mtx, "e6060sw", NULL, MTX_DEF); + strlcpy(sc->info.es_name, device_get_desc(dev), + sizeof(sc->info.es_name)); + + /* XXX Defaults */ + sc->numports = 6; + sc->phymask = 0x1f; + sc->cpuport = 5; + sc->media = 100; + + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "numports", &sc->numports); + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "phymask", &sc->phymask); + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "cpuport", &sc->cpuport); + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "media", &sc->media); + + sc->info.es_nvlangroups = sc->numports; + sc->info.es_vlan_caps = ETHERSWITCH_VLAN_PORT; + + sc->ifp = malloc(sizeof(struct ifnet *) * sc->numports, M_E6060SW, + M_WAITOK | M_ZERO); + sc->ifname = malloc(sizeof(char *) * sc->numports, M_E6060SW, + M_WAITOK | M_ZERO); + sc->miibus = malloc(sizeof(device_t *) * sc->numports, M_E6060SW, + M_WAITOK | M_ZERO); + sc->portphy = malloc(sizeof(int) * sc->numports, M_E6060SW, + M_WAITOK | M_ZERO); + + /* + * Attach the PHYs and complete the bus enumeration. + */ + err = e6060sw_attach_phys(sc); + if (err != 0) + return (err); + + bus_generic_probe(dev); + bus_enumerate_hinted_children(dev); + err = bus_generic_attach(dev); + if (err != 0) + return (err); + + callout_init(&sc->callout_tick, 0); + + e6060sw_tick(sc); + + return (err); +} + +static int +e6060sw_detach(device_t dev) +{ + struct e6060sw_softc *sc; + int i, port; + + sc = device_get_softc(dev); + + callout_drain(&sc->callout_tick); + + for (i = 0; i < MII_NPHY; i++) { + if (((1 << i) & sc->phymask) == 0) + continue; + port = e6060sw_portforphy(sc, i); + if (sc->miibus[port] != NULL) + device_delete_child(dev, (*sc->miibus[port])); + if (sc->ifp[port] != NULL) + if_free(sc->ifp[port]); + free(sc->ifname[port], M_E6060SW); + free(sc->miibus[port], M_E6060SW); + } + + free(sc->portphy, M_E6060SW); + free(sc->miibus, M_E6060SW); + free(sc->ifname, M_E6060SW); + free(sc->ifp, M_E6060SW); + + bus_generic_detach(dev); + mtx_destroy(&sc->sc_mtx); + + return (0); +} + +/* + * Convert PHY number to port number. + */ +static inline int +e6060sw_portforphy(struct e6060sw_softc *sc, int phy) +{ + + return (sc->ifpport[phy]); +} + +static inline struct mii_data * +e6060sw_miiforport(struct e6060sw_softc *sc, int port) +{ + + if (port < 0 || port > sc->numports) + return (NULL); + if (port == sc->cpuport) + return (NULL); + return (device_get_softc(*sc->miibus[port])); +} + +static inline struct ifnet * +e6060sw_ifpforport(struct e6060sw_softc *sc, int port) +{ + + if (port < 0 || port > sc->numports) + return (NULL); + return (sc->ifp[port]); +} + +/* + * Poll the status for all PHYs. + */ +static void +e6060sw_miipollstat(struct e6060sw_softc *sc) +{ + int i, port; + struct mii_data *mii; + struct mii_softc *miisc; + + E6060SW_LOCK_ASSERT(sc, MA_NOTOWNED); + + for (i = 0; i < MII_NPHY; i++) { + if (((1 << i) & sc->phymask) == 0) + continue; + port = e6060sw_portforphy(sc, i); + if ((*sc->miibus[port]) == NULL) + continue; + mii = device_get_softc(*sc->miibus[port]); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) { + if (IFM_INST(mii->mii_media.ifm_cur->ifm_media) != + miisc->mii_inst) + continue; + ukphy_status(miisc); + mii_phy_update(miisc, MII_POLLSTAT); + } + } +} + +static void +e6060sw_tick(void *arg) +{ + struct e6060sw_softc *sc; + + sc = arg; + + e6060sw_miipollstat(sc); + callout_reset(&sc->callout_tick, hz, e6060sw_tick, sc); +} + +static void +e6060sw_lock(device_t dev) +{ + struct e6060sw_softc *sc; + + sc = device_get_softc(dev); + + E6060SW_LOCK_ASSERT(sc, MA_NOTOWNED); + E6060SW_LOCK(sc); +} + +static void +e6060sw_unlock(device_t dev) +{ + struct e6060sw_softc *sc; + + sc = device_get_softc(dev); + + E6060SW_LOCK_ASSERT(sc, MA_OWNED); + E6060SW_UNLOCK(sc); +} + +static etherswitch_info_t * +e6060sw_getinfo(device_t dev) +{ + struct e6060sw_softc *sc; + + sc = device_get_softc(dev); + + return (&sc->info); +} + +static int +e6060sw_getport(device_t dev, etherswitch_port_t *p) +{ + struct e6060sw_softc *sc; + struct mii_data *mii; + struct ifmediareq *ifmr; + int err, phy; + + sc = device_get_softc(dev); + ifmr = &p->es_ifmr; + + if (p->es_port < 0 || p->es_port >= sc->numports) + return (ENXIO); + p->es_pvid = 0; + + phy = sc->portphy[p->es_port]; + mii = e6060sw_miiforport(sc, p->es_port); + if (sc->cpuport != -1 && phy == sc->cpuport) { + /* fill in fixed values for CPU port */ + p->es_flags |= ETHERSWITCH_PORT_CPU; + ifmr->ifm_count = 0; + if (sc->media == 100) + ifmr->ifm_current = ifmr->ifm_active = + IFM_ETHER | IFM_100_TX | IFM_FDX; + else + ifmr->ifm_current = ifmr->ifm_active = + IFM_ETHER | IFM_1000_T | IFM_FDX; + ifmr->ifm_mask = 0; + ifmr->ifm_status = IFM_ACTIVE | IFM_AVALID; + } else if (mii != NULL) { + err = ifmedia_ioctl(mii->mii_ifp, &p->es_ifr, + &mii->mii_media, SIOCGIFMEDIA); + if (err) + return (err); + } else { + return (ENXIO); + } + return (0); +} + +static int +e6060sw_setport(device_t dev, etherswitch_port_t *p) +{ + struct e6060sw_softc *sc; + struct ifmedia *ifm; + struct mii_data *mii; + struct ifnet *ifp; + int err; + + sc = device_get_softc(dev); + + if (p->es_port < 0 || p->es_port >= sc->numports) + return (ENXIO); + + if (sc->portphy[p->es_port] == sc->cpuport) + return (ENXIO); + + mii = e6060sw_miiforport(sc, p->es_port); + if (mii == NULL) + return (ENXIO); + + ifp = e6060sw_ifpforport(sc, p->es_port); + + ifm = &mii->mii_media; + err = ifmedia_ioctl(ifp, &p->es_ifr, ifm, SIOCSIFMEDIA); + return (err); +} + +static int +e6060sw_getvgroup(device_t dev, etherswitch_vlangroup_t *vg) +{ + struct e6060sw_softc *sc; + int data; + + sc = device_get_softc(dev); + + if (sc->vlan_mode == ETHERSWITCH_VLAN_PORT) { + vg->es_vid = ETHERSWITCH_VID_VALID; + vg->es_vid |= vg->es_vlangroup; + data = MDIO_READREG(device_get_parent(dev), CORE_REGISTER + vg->es_vlangroup, PORT_VLAN_MAP); + vg->es_member_ports = data & 0x3f; + vg->es_untagged_ports = vg->es_member_ports; + vg->es_fid = 0; + } else { + vg->es_vid = 0; + } + return (0); +} + +static int +e6060sw_setvgroup(device_t dev, etherswitch_vlangroup_t *vg) +{ + struct e6060sw_softc *sc; + int data; + + sc = device_get_softc(dev); + + if (sc->vlan_mode == ETHERSWITCH_VLAN_PORT) { + data = MDIO_READREG(device_get_parent(dev), CORE_REGISTER + vg->es_vlangroup, PORT_VLAN_MAP); + data &= ~0x3f; + data |= vg->es_member_ports; + MDIO_WRITEREG(device_get_parent(dev), CORE_REGISTER + vg->es_vlangroup, PORT_VLAN_MAP, data); + } + + return (0); +} + +static void +e6060sw_reset_vlans(device_t dev) +{ + struct e6060sw_softc *sc; + uint32_t ports; + int i; + int data; + + sc = device_get_softc(dev); + + for (i = 0; i <= sc->numports; i++) { + ports = (1 << (sc->numports + 1)) - 1; + ports &= ~(1 << i); + if (sc->vlan_mode == ETHERSWITCH_VLAN_PORT) { + data = i << 12; + } else { + data = 0; + } + data |= ports; + MDIO_WRITEREG(device_get_parent(dev), CORE_REGISTER + i, PORT_VLAN_MAP, data); + } +} + +static int +e6060sw_getconf(device_t dev, etherswitch_conf_t *conf) +{ + struct e6060sw_softc *sc; + + sc = device_get_softc(dev); + + /* Return the VLAN mode. */ + conf->cmd = ETHERSWITCH_CONF_VLAN_MODE; + conf->vlan_mode = sc->vlan_mode; + + return (0); +} + +static int +e6060sw_setconf(device_t dev, etherswitch_conf_t *conf) +{ + struct e6060sw_softc *sc; + + sc = device_get_softc(dev); + + /* Set the VLAN mode. */ + if (conf->cmd & ETHERSWITCH_CONF_VLAN_MODE) { + if (conf->vlan_mode == ETHERSWITCH_VLAN_PORT) { + sc->vlan_mode = ETHERSWITCH_VLAN_PORT; + } else { + sc->vlan_mode = 0; + } + + /* Reset VLANs. */ + e6060sw_reset_vlans(dev); + } + + return (0); +} + +static void +e6060sw_statchg(device_t dev) +{ + + DPRINTF(dev, "%s\n", __func__); +} + +static int +e6060sw_ifmedia_upd(struct ifnet *ifp) +{ + struct e6060sw_softc *sc; + struct mii_data *mii; + + sc = ifp->if_softc; + mii = e6060sw_miiforport(sc, ifp->if_dunit); + + DPRINTF(sc->sc_dev, "%s\n", __func__); + if (mii == NULL) + return (ENXIO); + mii_mediachg(mii); + return (0); +} + +static void +e6060sw_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + struct e6060sw_softc *sc; + struct mii_data *mii; + + sc = ifp->if_softc; + mii = e6060sw_miiforport(sc, ifp->if_dunit); + + DPRINTF(sc->sc_dev, "%s\n", __func__); + + if (mii == NULL) + return; + mii_pollstat(mii); + ifmr->ifm_active = mii->mii_media_active; + ifmr->ifm_status = mii->mii_media_status; +} + +static int +e6060sw_readphy(device_t dev, int phy, int reg) +{ + struct e6060sw_softc *sc; + int data; + + phy += SMI_OFFSET; + + sc = device_get_softc(dev); + E6060SW_LOCK_ASSERT(sc, MA_NOTOWNED); + + if (phy < 0 || phy >= 32) + return (ENXIO); + if (reg < 0 || reg >= 32) + return (ENXIO); + + E6060SW_LOCK(sc); + data = MDIO_READREG(device_get_parent(dev), phy, reg); + E6060SW_UNLOCK(sc); + + return (data); +} + +static int +e6060sw_writephy(device_t dev, int phy, int reg, int data) +{ + struct e6060sw_softc *sc; + int err; + + phy += SMI_OFFSET; + + sc = device_get_softc(dev); + E6060SW_LOCK_ASSERT(sc, MA_NOTOWNED); + + if (phy < 0 || phy >= 32) + return (ENXIO); + if (reg < 0 || reg >= 32) + return (ENXIO); + + E6060SW_LOCK(sc); + err = MDIO_WRITEREG(device_get_parent(dev), phy, reg, data); + E6060SW_UNLOCK(sc); + + return (err); +} + +/* addr is 5-8 bit is SMI Device Addres, 0-4 bit is SMI Register Address */ + +static int +e6060sw_readreg(device_t dev, int addr) +{ + int devaddr, regaddr; + + devaddr = (addr >> 5) & 0xf; + regaddr = addr & 0x1f; + + return MDIO_READREG(device_get_parent(dev), devaddr+SMI_OFFSET, regaddr); +} + +/* addr is 5-8 bit is SMI Device Addres, 0-4 bit is SMI Register Address */ + +static int +e6060sw_writereg(device_t dev, int addr, int value) +{ + int devaddr, regaddr; + + devaddr = (addr >> 5) & 0xf; + regaddr = addr & 0x1f; + + return (MDIO_WRITEREG(device_get_parent(dev), devaddr+SMI_OFFSET, regaddr, value)); +} + +static device_method_t e6060sw_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, e6060sw_probe), + DEVMETHOD(device_attach, e6060sw_attach), + DEVMETHOD(device_detach, e6060sw_detach), + + /* bus interface */ + DEVMETHOD(bus_add_child, device_add_child_ordered), + + /* MII interface */ + DEVMETHOD(miibus_readreg, e6060sw_readphy), + DEVMETHOD(miibus_writereg, e6060sw_writephy), + DEVMETHOD(miibus_statchg, e6060sw_statchg), + + /* MDIO interface */ + DEVMETHOD(mdio_readreg, e6060sw_readphy), + DEVMETHOD(mdio_writereg, e6060sw_writephy), + + /* etherswitch interface */ + DEVMETHOD(etherswitch_lock, e6060sw_lock), + DEVMETHOD(etherswitch_unlock, e6060sw_unlock), + DEVMETHOD(etherswitch_getinfo, e6060sw_getinfo), + DEVMETHOD(etherswitch_readreg, e6060sw_readreg), + DEVMETHOD(etherswitch_writereg, e6060sw_writereg), + DEVMETHOD(etherswitch_readphyreg, e6060sw_readphy), + DEVMETHOD(etherswitch_writephyreg, e6060sw_writephy), + DEVMETHOD(etherswitch_getport, e6060sw_getport), + DEVMETHOD(etherswitch_setport, e6060sw_setport), + DEVMETHOD(etherswitch_getvgroup, e6060sw_getvgroup), + DEVMETHOD(etherswitch_setvgroup, e6060sw_setvgroup), + DEVMETHOD(etherswitch_setconf, e6060sw_setconf), + DEVMETHOD(etherswitch_getconf, e6060sw_getconf), + + DEVMETHOD_END +}; + +DEFINE_CLASS_0(e6060sw, e6060sw_driver, e6060sw_methods, + sizeof(struct e6060sw_softc)); +static devclass_t e6060sw_devclass; + +DRIVER_MODULE(e6060sw, mdio, e6060sw_driver, e6060sw_devclass, 0, 0); +DRIVER_MODULE(miibus, e6060sw, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE(mdio, e6060sw, mdio_driver, mdio_devclass, 0, 0); +DRIVER_MODULE(etherswitch, e6060sw, etherswitch_driver, etherswitch_devclass, 0, 0); +MODULE_VERSION(e6060sw, 1); +MODULE_DEPEND(e6060sw, miibus, 1, 1, 1); /* XXX which versions? */ +MODULE_DEPEND(e6060sw, etherswitch, 1, 1, 1); /* XXX which versions? */ From owner-svn-src-head@freebsd.org Tue Nov 15 21:58:06 2016 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 06AECC43A70; Tue, 15 Nov 2016 21:58:06 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEA96D0F; Tue, 15 Nov 2016 21:58:05 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFLw5Xg078289; Tue, 15 Nov 2016 21:58:05 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFLw46E078286; Tue, 15 Nov 2016 21:58:04 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201611152158.uAFLw46E078286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Tue, 15 Nov 2016 21:58:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308700 - in head/sys: conf dev/etherswitch/rtl8366 X-SVN-Group: head 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, 15 Nov 2016 21:58:06 -0000 Author: mizhka Date: Tue Nov 15 21:58:04 2016 New Revision: 308700 URL: https://svnweb.freebsd.org/changeset/base/308700 Log: [etherswitch] add RTL8366SR support Add RTL8366SR support at etherswitch driver. Tested on RTL8366RB and RTL8366SR. Submitted by: Hiroki Mori Reviewed by: adrian, mizhka Approved by: adrian(mentor) Differential Revision: https://reviews.freebsd.org/D6796 Modified: head/sys/conf/options head/sys/dev/etherswitch/rtl8366/rtl8366rb.c head/sys/dev/etherswitch/rtl8366/rtl8366rbvar.h Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Nov 15 21:49:01 2016 (r308699) +++ head/sys/conf/options Tue Nov 15 21:58:04 2016 (r308700) @@ -993,6 +993,9 @@ BHND_LOGLEVEL opt_global.h # GPIO and child devices GPIO_SPI_DEBUG opt_gpio.h +# etherswitch(4) driver +RTL8366_SOFT_RESET opt_etherswitch.h + # evdev protocol support EVDEV_SUPPORT opt_evdev.h EVDEV_DEBUG opt_evdev.h Modified: head/sys/dev/etherswitch/rtl8366/rtl8366rb.c ============================================================================== --- head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Tue Nov 15 21:49:01 2016 (r308699) +++ head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Tue Nov 15 21:58:04 2016 (r308700) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2015-2016 Hiroki Mori. * Copyright (c) 2011-2012 Stefan Bethke. * All rights reserved. * @@ -26,6 +27,8 @@ * $FreeBSD$ */ +#include "opt_etherswitch.h" + #include #include #include @@ -65,18 +68,13 @@ struct rtl8366rb_softc { int smi_acquired; /* serialize access to SMI/I2C bus */ struct mtx callout_mtx; /* serialize callout */ device_t dev; - int vid[RTL8366RB_NUM_VLANS]; - char *ifname[RTL8366RB_NUM_PHYS]; - device_t miibus[RTL8366RB_NUM_PHYS]; - struct ifnet *ifp[RTL8366RB_NUM_PHYS]; + int vid[RTL8366_NUM_VLANS]; + char *ifname[RTL8366_NUM_PHYS]; + device_t miibus[RTL8366_NUM_PHYS]; + struct ifnet *ifp[RTL8366_NUM_PHYS]; struct callout callout_tick; -}; - -static etherswitch_info_t etherswitch_info = { - .es_nports = RTL8366RB_NUM_PORTS, - .es_nvlangroups = RTL8366RB_NUM_VLANS, - .es_name = "Realtek RTL8366RB", - .es_vlan_caps = ETHERSWITCH_VLAN_DOT1Q, + etherswitch_info_t info; + int chip_type; /* 0 = RTL8366RB, 1 = RTL8366SR */ }; #define RTL_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) @@ -133,77 +131,101 @@ rtl8366rb_identify(driver_t *driver, dev if (device_find_child(parent, "rtl8366rb", -1) == NULL) { child = BUS_ADD_CHILD(parent, 0, "rtl8366rb", -1); devi = IICBUS_IVAR(child); - devi->addr = RTL8366RB_IIC_ADDR; + devi->addr = RTL8366_IIC_ADDR; } } static int rtl8366rb_probe(device_t dev) { + struct rtl8366rb_softc *sc; + + sc = device_get_softc(dev); + + bzero(sc, sizeof(*sc)); if (smi_probe(dev) != 0) return (ENXIO); - device_set_desc(dev, "RTL8366RB Ethernet Switch Controller"); + if(sc->chip_type == 0) + device_set_desc(dev, "RTL8366RB Ethernet Switch Controller"); + else + device_set_desc(dev, "RTL8366SR Ethernet Switch Controller"); return (BUS_PROBE_DEFAULT); } static void rtl8366rb_init(device_t dev) { - int i; struct rtl8366rb_softc *sc; + int i; + + sc = device_get_softc(dev); /* Initialisation for TL-WR1043ND */ - smi_rmw(dev, RTL8366RB_RCR, - RTL8366RB_RCR_HARD_RESET, - RTL8366RB_RCR_HARD_RESET, RTL_WAITOK); +#ifdef RTL8366_SOFT_RESET + smi_rmw(dev, RTL8366_RCR, + RTL8366_RCR_SOFT_RESET, + RTL8366_RCR_SOFT_RESET, RTL_WAITOK); +#else + smi_rmw(dev, RTL8366_RCR, + RTL8366_RCR_HARD_RESET, + RTL8366_RCR_HARD_RESET, RTL_WAITOK); +#endif + /* hard reset not return ack */ DELAY(100000); /* Enable 16 VLAN mode */ - smi_rmw(dev, RTL8366RB_SGCR, - RTL8366RB_SGCR_EN_VLAN | RTL8366RB_SGCR_EN_VLAN_4KTB, - RTL8366RB_SGCR_EN_VLAN, RTL_WAITOK); + smi_rmw(dev, RTL8366_SGCR, + RTL8366_SGCR_EN_VLAN | RTL8366_SGCR_EN_VLAN_4KTB, + RTL8366_SGCR_EN_VLAN, RTL_WAITOK); /* Initialize our vlan table. */ - sc = device_get_softc(dev); for (i = 0; i <= 1; i++) sc->vid[i] = (i + 1) | ETHERSWITCH_VID_VALID; /* Remove port 0 from VLAN 1. */ - smi_rmw(dev, RTL8366RB_VMCR(RTL8366RB_VMCR_MU_REG, 0), + smi_rmw(dev, RTL8366_VMCR(RTL8366_VMCR_MU_REG, 0), (1 << 0), 0, RTL_WAITOK); /* Add port 0 untagged and port 5 tagged to VLAN 2. */ - smi_rmw(dev, RTL8366RB_VMCR(RTL8366RB_VMCR_MU_REG, 1), - ((1 << 5 | 1 << 0) << RTL8366RB_VMCR_MU_MEMBER_SHIFT) - | ((1 << 5 | 1 << 0) << RTL8366RB_VMCR_MU_UNTAG_SHIFT), - ((1 << 5 | 1 << 0) << RTL8366RB_VMCR_MU_MEMBER_SHIFT - | ((1 << 0) << RTL8366RB_VMCR_MU_UNTAG_SHIFT)), + smi_rmw(dev, RTL8366_VMCR(RTL8366_VMCR_MU_REG, 1), + ((1 << 5 | 1 << 0) << RTL8366_VMCR_MU_MEMBER_SHIFT) + | ((1 << 5 | 1 << 0) << RTL8366_VMCR_MU_UNTAG_SHIFT), + ((1 << 5 | 1 << 0) << RTL8366_VMCR_MU_MEMBER_SHIFT + | ((1 << 0) << RTL8366_VMCR_MU_UNTAG_SHIFT)), RTL_WAITOK); /* Set PVID 2 for port 0. */ - smi_rmw(dev, RTL8366RB_PVCR_REG(0), - RTL8366RB_PVCR_VAL(0, RTL8366RB_PVCR_PORT_MASK), - RTL8366RB_PVCR_VAL(0, 1), RTL_WAITOK); + smi_rmw(dev, RTL8366_PVCR_REG(0), + RTL8366_PVCR_VAL(0, RTL8366_PVCR_PORT_MASK), + RTL8366_PVCR_VAL(0, 1), RTL_WAITOK); } static int rtl8366rb_attach(device_t dev) { - uint16_t rev = 0; struct rtl8366rb_softc *sc; + uint16_t rev = 0; char name[IFNAMSIZ]; int err = 0; int i; sc = device_get_softc(dev); - bzero(sc, sizeof(*sc)); + sc->dev = dev; mtx_init(&sc->sc_mtx, "rtl8366rb", NULL, MTX_DEF); sc->smi_acquired = 0; mtx_init(&sc->callout_mtx, "rtl8366rbcallout", NULL, MTX_DEF); rtl8366rb_init(dev); - smi_read(dev, RTL8366RB_CVCR, &rev, RTL_WAITOK); + smi_read(dev, RTL8366_CVCR, &rev, RTL_WAITOK); device_printf(dev, "rev. %d\n", rev & 0x000f); + sc->info.es_nports = RTL8366_NUM_PORTS; + sc->info.es_nvlangroups = RTL8366_NUM_VLANS; + sc->info.es_vlan_caps = ETHERSWITCH_VLAN_DOT1Q; + if(sc->chip_type == 0) + sprintf(sc->info.es_name, "Realtek RTL8366RB"); + else + sprintf(sc->info.es_name, "Realtek RTL8366SR"); + /* attach miibus and phys */ /* PHYs need an interface, so we generate a dummy one */ - for (i = 0; i < RTL8366RB_NUM_PHYS; i++) { + for (i = 0; i < RTL8366_NUM_PHYS; i++) { sc->ifp[i] = if_alloc(IFT_ETHER); sc->ifp[i]->if_softc = sc; sc->ifp[i]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING @@ -236,10 +258,12 @@ rtl8366rb_attach(device_t dev) static int rtl8366rb_detach(device_t dev) { - struct rtl8366rb_softc *sc = device_get_softc(dev); + struct rtl8366rb_softc *sc; int i; - for (i=0; i < RTL8366RB_NUM_PHYS; i++) { + sc = device_get_softc(dev); + + for (i=0; i < RTL8366_NUM_PHYS; i++) { if (sc->miibus[i]) device_delete_child(dev, sc->miibus[i]); if (sc->ifp[i] != NULL) @@ -259,30 +283,30 @@ rtl8366rb_update_ifmedia(int portstatus, { *media_active = IFM_ETHER; *media_status = IFM_AVALID; - if ((portstatus & RTL8366RB_PLSR_LINK) != 0) + if ((portstatus & RTL8366_PLSR_LINK) != 0) *media_status |= IFM_ACTIVE; else { *media_active |= IFM_NONE; return; } - switch (portstatus & RTL8366RB_PLSR_SPEED_MASK) { - case RTL8366RB_PLSR_SPEED_10: + switch (portstatus & RTL8366_PLSR_SPEED_MASK) { + case RTL8366_PLSR_SPEED_10: *media_active |= IFM_10_T; break; - case RTL8366RB_PLSR_SPEED_100: + case RTL8366_PLSR_SPEED_100: *media_active |= IFM_100_TX; break; - case RTL8366RB_PLSR_SPEED_1000: + case RTL8366_PLSR_SPEED_1000: *media_active |= IFM_1000_T; break; } - if ((portstatus & RTL8366RB_PLSR_FULLDUPLEX) != 0) + if ((portstatus & RTL8366_PLSR_FULLDUPLEX) != 0) *media_active |= IFM_FDX; else *media_active |= IFM_HDX; - if ((portstatus & RTL8366RB_PLSR_TXPAUSE) != 0) + if ((portstatus & RTL8366_PLSR_TXPAUSE) != 0) *media_active |= IFM_ETH_TXPAUSE; - if ((portstatus & RTL8366RB_PLSR_RXPAUSE) != 0) + if ((portstatus & RTL8366_PLSR_RXPAUSE) != 0) *media_active |= IFM_ETH_RXPAUSE; } @@ -295,10 +319,10 @@ rtl833rb_miipollstat(struct rtl8366rb_so uint16_t value; int portstatus; - for (i = 0; i < RTL8366RB_NUM_PHYS; i++) { + for (i = 0; i < RTL8366_NUM_PHYS; i++) { mii = device_get_softc(sc->miibus[i]); if ((i % 2) == 0) { - if (smi_read(sc->dev, RTL8366RB_PLSR_BASE + i/2, &value, RTL_NOWAIT) != 0) { + if (smi_read(sc->dev, RTL8366_PLSR_BASE + i/2, &value, RTL_NOWAIT) != 0) { DEBUG_INCRVAR(callout_blocked); return; } @@ -318,7 +342,9 @@ rtl833rb_miipollstat(struct rtl8366rb_so static void rtl8366rb_tick(void *arg) { - struct rtl8366rb_softc *sc = arg; + struct rtl8366rb_softc *sc; + + sc = arg; rtl833rb_miipollstat(sc); callout_reset(&sc->callout_tick, hz, rtl8366rb_tick, sc); @@ -327,39 +353,65 @@ rtl8366rb_tick(void *arg) static int smi_probe(device_t dev) { + struct rtl8366rb_softc *sc; device_t iicbus, iicha; - int err, i; + int err, i, j; uint16_t chipid; char bytes[2]; int xferd; - bytes[0] = RTL8366RB_CIR & 0xff; - bytes[1] = (RTL8366RB_CIR >> 8) & 0xff; + sc = device_get_softc(dev); + iicbus = device_get_parent(dev); iicha = device_get_parent(iicbus); - iicbus_reset(iicbus, IIC_FASTEST, RTL8366RB_IIC_ADDR, NULL); - for (i=3; i--; ) { - IICBUS_STOP(iicha); - /* - * we go directly to the host adapter because iicbus.c - * only issues a stop on a bus that was successfully started. - */ + + for(i = 0; i < 2; ++i) { + iicbus_reset(iicbus, IIC_FASTEST, RTL8366_IIC_ADDR, NULL); + for (j=3; j--; ) { + IICBUS_STOP(iicha); + /* + * we go directly to the host adapter because iicbus.c + * only issues a stop on a bus that was successfully started. + */ + } + err = iicbus_request_bus(iicbus, dev, IIC_WAIT); + if (err != 0) + goto out; + err = iicbus_start(iicbus, RTL8366_IIC_ADDR | RTL_IICBUS_READ, RTL_IICBUS_TIMEOUT); + if (err != 0) + goto out; + if(i == 0) { + bytes[0] = RTL8366RB_CIR & 0xff; + bytes[1] = (RTL8366RB_CIR >> 8) & 0xff; + } else { + bytes[0] = RTL8366SR_CIR & 0xff; + bytes[1] = (RTL8366SR_CIR >> 8) & 0xff; + } + err = iicbus_write(iicbus, bytes, 2, &xferd, RTL_IICBUS_TIMEOUT); + if (err != 0) + goto out; + err = iicbus_read(iicbus, bytes, 2, &xferd, IIC_LAST_READ, 0); + if (err != 0) + goto out; + chipid = ((bytes[1] & 0xff) << 8) | (bytes[0] & 0xff); + if (i == 0 && chipid == RTL8366RB_CIR_ID8366RB) { + DPRINTF(dev, "chip id 0x%04x\n", chipid); + sc->chip_type = 0; + err = 0; + break; + } + if (i == 1 && chipid == RTL8366SR_CIR_ID8366SR) { + DPRINTF(dev, "chip id 0x%04x\n", chipid); + sc->chip_type = 1; + err = 0; + break; + } + if(i == 0) { + iicbus_stop(iicbus); + iicbus_release_bus(iicbus, dev); + } } - err = iicbus_request_bus(iicbus, dev, IIC_WAIT); - if (err != 0) - goto out; - err = iicbus_start(iicbus, RTL8366RB_IIC_ADDR | RTL_IICBUS_READ, RTL_IICBUS_TIMEOUT); - if (err != 0) - goto out; - err = iicbus_write(iicbus, bytes, 2, &xferd, RTL_IICBUS_TIMEOUT); - if (err != 0) - goto out; - err = iicbus_read(iicbus, bytes, 2, &xferd, IIC_LAST_READ, 0); - if (err != 0) - goto out; - chipid = ((bytes[1] & 0xff) << 8) | (bytes[0] & 0xff); - DPRINTF(dev, "chip id 0x%04x\n", chipid); - if (chipid != RTL8366RB_CIR_ID8366RB) + if(i == 2) err = ENXIO; out: iicbus_stop(iicbus); @@ -406,12 +458,25 @@ smi_release(struct rtl8366rb_softc *sc, static int smi_select(device_t dev, int op, int sleep) { + struct rtl8366rb_softc *sc; int err, i; - device_t iicbus = device_get_parent(dev); - struct iicbus_ivar *devi = IICBUS_IVAR(dev); - int slave = devi->addr; + device_t iicbus; + struct iicbus_ivar *devi; + int slave; + + sc = device_get_softc(dev); + + iicbus = device_get_parent(dev); + devi = IICBUS_IVAR(dev); + slave = devi->addr; RTL_SMI_ACQUIRED_ASSERT((struct rtl8366rb_softc *)device_get_softc(dev)); + + if(sc->chip_type == 1) { // RTL8366SR work around + // this is same work around at probe + for (int i=3; i--; ) + IICBUS_STOP(device_get_parent(device_get_parent(dev))); + } /* * The chip does not use clock stretching when it is busy, * instead ignoring the command. Retry a few times. @@ -433,10 +498,12 @@ static int smi_read_locked(struct rtl8366rb_softc *sc, uint16_t addr, uint16_t *data, int sleep) { int err; - device_t iicbus = device_get_parent(sc->dev); + device_t iicbus; char bytes[2]; int xferd; + iicbus = device_get_parent(sc->dev); + RTL_SMI_ACQUIRED_ASSERT(sc); bytes[0] = addr & 0xff; bytes[1] = (addr >> 8) & 0xff; @@ -460,10 +527,12 @@ static int smi_write_locked(struct rtl8366rb_softc *sc, uint16_t addr, uint16_t data, int sleep) { int err; - device_t iicbus = device_get_parent(sc->dev); + device_t iicbus; char bytes[4]; int xferd; + iicbus = device_get_parent(sc->dev); + RTL_SMI_ACQUIRED_ASSERT(sc); bytes[0] = addr & 0xff; bytes[1] = (addr >> 8) & 0xff; @@ -481,9 +550,11 @@ smi_write_locked(struct rtl8366rb_softc static int smi_read(device_t dev, uint16_t addr, uint16_t *data, int sleep) { - struct rtl8366rb_softc *sc = device_get_softc(dev); + struct rtl8366rb_softc *sc; int err; + sc = device_get_softc(dev); + err = smi_acquire(sc, sleep); if (err != 0) return (EBUSY); @@ -496,9 +567,11 @@ smi_read(device_t dev, uint16_t addr, ui static int smi_write(device_t dev, uint16_t addr, uint16_t data, int sleep) { - struct rtl8366rb_softc *sc = device_get_softc(dev); + struct rtl8366rb_softc *sc; int err; + sc = device_get_softc(dev); + err = smi_acquire(sc, sleep); if (err != 0) return (EBUSY); @@ -511,10 +584,12 @@ smi_write(device_t dev, uint16_t addr, u static int smi_rmw(device_t dev, uint16_t addr, uint16_t mask, uint16_t data, int sleep) { - struct rtl8366rb_softc *sc = device_get_softc(dev); + struct rtl8366rb_softc *sc; int err; uint16_t oldv, newv; + sc = device_get_softc(dev); + err = smi_acquire(sc, sleep); if (err != 0) return (EBUSY); @@ -535,13 +610,19 @@ smi_rmw(device_t dev, uint16_t addr, uin static etherswitch_info_t * rtl_getinfo(device_t dev) { - return (ðerswitch_info); + struct rtl8366rb_softc *sc; + + sc = device_get_softc(dev); + + return (&sc->info); } static int rtl_readreg(device_t dev, int reg) { - uint16_t data = 0; + uint16_t data; + + data = 0; smi_read(dev, reg, &data, RTL_WAITOK); return (data); @@ -559,18 +640,21 @@ rtl_getport(device_t dev, etherswitch_po struct rtl8366rb_softc *sc; struct ifmedia *ifm; struct mii_data *mii; - struct ifmediareq *ifmr = &p->es_ifmr; + struct ifmediareq *ifmr; uint16_t v; int err, vlangroup; - if (p->es_port < 0 || p->es_port >= RTL8366RB_NUM_PORTS) - return (ENXIO); sc = device_get_softc(dev); - vlangroup = RTL8366RB_PVCR_GET(p->es_port, - rtl_readreg(dev, RTL8366RB_PVCR_REG(p->es_port))); + + ifmr = &p->es_ifmr; + + if (p->es_port < 0 || p->es_port >= RTL8366_NUM_PORTS) + return (ENXIO); + vlangroup = RTL8366_PVCR_GET(p->es_port, + rtl_readreg(dev, RTL8366_PVCR_REG(p->es_port))); p->es_pvid = sc->vid[vlangroup] & ETHERSWITCH_VID_MASK; - if (p->es_port < RTL8366RB_NUM_PHYS) { + if (p->es_port < RTL8366_NUM_PHYS) { mii = device_get_softc(sc->miibus[p->es_port]); ifm = &mii->mii_media; err = ifmedia_ioctl(sc->ifp[p->es_port], &p->es_ifr, ifm, SIOCGIFMEDIA); @@ -579,8 +663,8 @@ rtl_getport(device_t dev, etherswitch_po } else { /* fill in fixed values for CPU port */ p->es_flags |= ETHERSWITCH_PORT_CPU; - smi_read(dev, RTL8366RB_PLSR_BASE + (RTL8366RB_NUM_PHYS)/2, &v, RTL_WAITOK); - v = v >> (8 * ((RTL8366RB_NUM_PHYS) % 2)); + smi_read(dev, RTL8366_PLSR_BASE + (RTL8366_NUM_PHYS)/2, &v, RTL_WAITOK); + v = v >> (8 * ((RTL8366_NUM_PHYS) % 2)); rtl8366rb_update_ifmedia(v, &ifmr->ifm_status, &ifmr->ifm_active); ifmr->ifm_current = ifmr->ifm_active; ifmr->ifm_mask = 0; @@ -599,16 +683,17 @@ rtl_getport(device_t dev, etherswitch_po static int rtl_setport(device_t dev, etherswitch_port_t *p) { - int i, err, vlangroup; struct rtl8366rb_softc *sc; + int i, err, vlangroup; struct ifmedia *ifm; struct mii_data *mii; - if (p->es_port < 0 || p->es_port >= RTL8366RB_NUM_PORTS) - return (ENXIO); sc = device_get_softc(dev); + + if (p->es_port < 0 || p->es_port >= RTL8366_NUM_PORTS) + return (ENXIO); vlangroup = -1; - for (i = 0; i < RTL8366RB_NUM_VLANS; i++) { + for (i = 0; i < RTL8366_NUM_VLANS; i++) { if ((sc->vid[i] & ETHERSWITCH_VID_MASK) == p->es_pvid) { vlangroup = i; break; @@ -616,12 +701,12 @@ rtl_setport(device_t dev, etherswitch_po } if (vlangroup == -1) return (ENXIO); - err = smi_rmw(dev, RTL8366RB_PVCR_REG(p->es_port), - RTL8366RB_PVCR_VAL(p->es_port, RTL8366RB_PVCR_PORT_MASK), - RTL8366RB_PVCR_VAL(p->es_port, vlangroup), RTL_WAITOK); + err = smi_rmw(dev, RTL8366_PVCR_REG(p->es_port), + RTL8366_PVCR_VAL(p->es_port, RTL8366_PVCR_PORT_MASK), + RTL8366_PVCR_VAL(p->es_port, vlangroup), RTL_WAITOK); if (err) return (err); - if (p->es_port == RTL8366RB_CPU_PORT) + if (p->es_port == RTL8366_CPU_PORT) return (0); mii = device_get_softc(sc->miibus[p->es_port]); ifm = &mii->mii_media; @@ -636,14 +721,15 @@ rtl_getvgroup(device_t dev, etherswitch_ uint16_t vmcr[3]; int i; - for (i=0; i<3; i++) - vmcr[i] = rtl_readreg(dev, RTL8366RB_VMCR(i, vg->es_vlangroup)); - sc = device_get_softc(dev); + + for (i=0; ies_vlangroup)); + vg->es_vid = sc->vid[vg->es_vlangroup]; - vg->es_member_ports = RTL8366RB_VMCR_MEMBER(vmcr); - vg->es_untagged_ports = RTL8366RB_VMCR_UNTAG(vmcr); - vg->es_fid = RTL8366RB_VMCR_FID(vmcr); + vg->es_member_ports = RTL8366_VMCR_MEMBER(vmcr); + vg->es_untagged_ports = RTL8366_VMCR_UNTAG(vmcr); + vg->es_fid = RTL8366_VMCR_FID(vmcr); return (0); } @@ -651,21 +737,31 @@ static int rtl_setvgroup(device_t dev, etherswitch_vlangroup_t *vg) { struct rtl8366rb_softc *sc; - int g = vg->es_vlangroup; + int g; sc = device_get_softc(dev); + + g = vg->es_vlangroup; + sc->vid[g] = vg->es_vid; /* VLAN group disabled ? */ if (vg->es_member_ports == 0 && vg->es_untagged_ports == 0 && vg->es_vid == 0) return (0); sc->vid[g] |= ETHERSWITCH_VID_VALID; - rtl_writereg(dev, RTL8366RB_VMCR(RTL8366RB_VMCR_DOT1Q_REG, g), - (vg->es_vid << RTL8366RB_VMCR_DOT1Q_VID_SHIFT) & RTL8366RB_VMCR_DOT1Q_VID_MASK); - rtl_writereg(dev, RTL8366RB_VMCR(RTL8366RB_VMCR_MU_REG, g), - ((vg->es_member_ports << RTL8366RB_VMCR_MU_MEMBER_SHIFT) & RTL8366RB_VMCR_MU_MEMBER_MASK) | - ((vg->es_untagged_ports << RTL8366RB_VMCR_MU_UNTAG_SHIFT) & RTL8366RB_VMCR_MU_UNTAG_MASK)); - rtl_writereg(dev, RTL8366RB_VMCR(RTL8366RB_VMCR_FID_REG, g), - vg->es_fid); + rtl_writereg(dev, RTL8366_VMCR(RTL8366_VMCR_DOT1Q_REG, g), + (vg->es_vid << RTL8366_VMCR_DOT1Q_VID_SHIFT) & RTL8366_VMCR_DOT1Q_VID_MASK); + if(sc->chip_type == 0) { + rtl_writereg(dev, RTL8366_VMCR(RTL8366_VMCR_MU_REG, g), + ((vg->es_member_ports << RTL8366_VMCR_MU_MEMBER_SHIFT) & RTL8366_VMCR_MU_MEMBER_MASK) | + ((vg->es_untagged_ports << RTL8366_VMCR_MU_UNTAG_SHIFT) & RTL8366_VMCR_MU_UNTAG_MASK)); + rtl_writereg(dev, RTL8366_VMCR(RTL8366_VMCR_FID_REG, g), + vg->es_fid); + } else { + rtl_writereg(dev, RTL8366_VMCR(RTL8366_VMCR_MU_REG, g), + ((vg->es_member_ports << RTL8366_VMCR_MU_MEMBER_SHIFT) & RTL8366_VMCR_MU_MEMBER_MASK) | + ((vg->es_untagged_ports << RTL8366_VMCR_MU_UNTAG_SHIFT) & RTL8366_VMCR_MU_UNTAG_MASK) | + ((vg->es_fid << RTL8366_VMCR_FID_FID_SHIFT) & RTL8366_VMCR_FID_FID_MASK)); + } return (0); } @@ -683,24 +779,28 @@ rtl_getconf(device_t dev, etherswitch_co static int rtl_readphy(device_t dev, int phy, int reg) { - struct rtl8366rb_softc *sc = device_get_softc(dev); - uint16_t data = 0; + struct rtl8366rb_softc *sc; + uint16_t data; int err, i, sleep; - if (phy < 0 || phy >= RTL8366RB_NUM_PHYS) + sc = device_get_softc(dev); + + data = 0; + + if (phy < 0 || phy >= RTL8366_NUM_PHYS) return (ENXIO); - if (reg < 0 || reg >= RTL8366RB_NUM_PHY_REG) + if (reg < 0 || reg >= RTL8366_NUM_PHY_REG) return (ENXIO); sleep = RTL_WAITOK; err = smi_acquire(sc, sleep); if (err != 0) return (EBUSY); for (i = RTL_IICBUS_RETRIES; i--; ) { - err = smi_write_locked(sc, RTL8366RB_PACR, RTL8366RB_PACR_READ, sleep); + err = smi_write_locked(sc, RTL8366_PACR, RTL8366_PACR_READ, sleep); if (err == 0) - err = smi_write_locked(sc, RTL8366RB_PHYREG(phy, 0, reg), 0, sleep); + err = smi_write_locked(sc, RTL8366_PHYREG(phy, 0, reg), 0, sleep); if (err == 0) { - err = smi_read_locked(sc, RTL8366RB_PADR, &data, sleep); + err = smi_read_locked(sc, RTL8366_PADR, &data, sleep); break; } DEBUG_INCRVAR(phy_access_retries); @@ -715,21 +815,23 @@ rtl_readphy(device_t dev, int phy, int r static int rtl_writephy(device_t dev, int phy, int reg, int data) { - struct rtl8366rb_softc *sc = device_get_softc(dev); + struct rtl8366rb_softc *sc; int err, i, sleep; - if (phy < 0 || phy >= RTL8366RB_NUM_PHYS) + sc = device_get_softc(dev); + + if (phy < 0 || phy >= RTL8366_NUM_PHYS) return (ENXIO); - if (reg < 0 || reg >= RTL8366RB_NUM_PHY_REG) + if (reg < 0 || reg >= RTL8366_NUM_PHY_REG) return (ENXIO); sleep = RTL_WAITOK; err = smi_acquire(sc, sleep); if (err != 0) return (EBUSY); for (i = RTL_IICBUS_RETRIES; i--; ) { - err = smi_write_locked(sc, RTL8366RB_PACR, RTL8366RB_PACR_WRITE, sleep); + err = smi_write_locked(sc, RTL8366_PACR, RTL8366_PACR_WRITE, sleep); if (err == 0) - err = smi_write_locked(sc, RTL8366RB_PHYREG(phy, 0, reg), data, sleep); + err = smi_write_locked(sc, RTL8366_PHYREG(phy, 0, reg), data, sleep); if (err == 0) { break; } @@ -745,8 +847,11 @@ rtl_writephy(device_t dev, int phy, int static int rtl8366rb_ifmedia_upd(struct ifnet *ifp) { - struct rtl8366rb_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->miibus[ifp->if_dunit]); + struct rtl8366rb_softc *sc; + struct mii_data *mii; + + sc = ifp->if_softc; + mii = device_get_softc(sc->miibus[ifp->if_dunit]); mii_mediachg(mii); return (0); @@ -755,8 +860,11 @@ rtl8366rb_ifmedia_upd(struct ifnet *ifp) static void rtl8366rb_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct rtl8366rb_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->miibus[ifp->if_dunit]); + struct rtl8366rb_softc *sc; + struct mii_data *mii; + + sc = ifp->if_softc; + mii = device_get_softc(sc->miibus[ifp->if_dunit]); mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; Modified: head/sys/dev/etherswitch/rtl8366/rtl8366rbvar.h ============================================================================== --- head/sys/dev/etherswitch/rtl8366/rtl8366rbvar.h Tue Nov 15 21:49:01 2016 (r308699) +++ head/sys/dev/etherswitch/rtl8366/rtl8366rbvar.h Tue Nov 15 21:58:04 2016 (r308700) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2015-2016 Hiroki Mori. * Copyright (c) 2011-2012 Stefan Bethke. * All rights reserved. * @@ -29,7 +30,7 @@ #ifndef _DEV_ETHERSWITCH_RTL8366RBVAR_H_ #define _DEV_ETHERSWITCH_RTL8366RBVAR_H_ -#define RTL8366RB_IIC_ADDR 0xa8 +#define RTL8366_IIC_ADDR 0xa8 #define RTL_IICBUS_TIMEOUT 100 /* us */ #define RTL_IICBUS_READ 1 #define RTL_IICBUS_WRITE 0 @@ -40,138 +41,142 @@ /* Register definitions */ /* Switch Global Configuration */ -#define RTL8366RB_SGCR 0x0000 -#define RTL8366RB_SGCR_EN_BC_STORM_CTRL 0x0001 -#define RTL8366RB_SGCR_MAX_LENGTH_MASK 0x0030 -#define RTL8366RB_SGCR_MAX_LENGTH_1522 0x0000 -#define RTL8366RB_SGCR_MAX_LENGTH_1536 0x0010 -#define RTL8366RB_SGCR_MAX_LENGTH_1552 0x0020 -#define RTL8366RB_SGCR_MAX_LENGTH_9216 0x0030 -#define RTL8366RB_SGCR_EN_VLAN 0x2000 -#define RTL8366RB_SGCR_EN_VLAN_4KTB 0x4000 -#define RTL8366RB_SGCR_EN_QOS 0x8000 +#define RTL8366_SGCR 0x0000 +#define RTL8366_SGCR_EN_BC_STORM_CTRL 0x0001 +#define RTL8366_SGCR_MAX_LENGTH_MASK 0x0030 +#define RTL8366_SGCR_MAX_LENGTH_1522 0x0000 +#define RTL8366_SGCR_MAX_LENGTH_1536 0x0010 +#define RTL8366_SGCR_MAX_LENGTH_1552 0x0020 +#define RTL8366_SGCR_MAX_LENGTH_9216 0x0030 +#define RTL8366_SGCR_EN_VLAN 0x2000 +#define RTL8366_SGCR_EN_VLAN_4KTB 0x4000 +#define RTL8366_SGCR_EN_QOS 0x8000 /* Port Enable Control: DISABLE_PORT[5:0] */ -#define RTL8366RB_PECR 0x0001 +#define RTL8366_PECR 0x0001 /* Switch Security Control 0: DIS_LEARN[5:0] */ -#define RTL8366RB_SSCR0 0x0002 +#define RTL8366_SSCR0 0x0002 /* Switch Security Control 1: DIS_AGE[5:0] */ -#define RTL8366RB_SSCR1 0x0003 +#define RTL8366_SSCR1 0x0003 /* Switch Security Control 2 */ -#define RTL8366RB_SSCR2 0x0004 -#define RTL8366RB_SSCR2_DROP_UNKNOWN_DA 0x0001 +#define RTL8366_SSCR2 0x0004 +#define RTL8366_SSCR2_DROP_UNKNOWN_DA 0x0001 /* Port Link Status: two ports per register */ -#define RTL8366RB_PLSR_BASE 0x0014 -#define RTL8366RB_PLSR_SPEED_MASK 0x03 -#define RTL8366RB_PLSR_SPEED_10 0x00 -#define RTL8366RB_PLSR_SPEED_100 0x01 -#define RTL8366RB_PLSR_SPEED_1000 0x02 -#define RTL8366RB_PLSR_FULLDUPLEX 0x04 -#define RTL8366RB_PLSR_LINK 0x10 -#define RTL8366RB_PLSR_TXPAUSE 0x20 -#define RTL8366RB_PLSR_RXPAUSE 0x40 -#define RTL8366RB_PLSR_NO_AUTO 0x80 - -/* VLAN Member Configuration, 3 registers per VLAN */ -#define RTL8366RB_VMCR_BASE 0x0020 -#define RTL8366RB_VMCR_MULT 3 -#define RTL8366RB_VMCR_DOT1Q_REG 0 -#define RTL8366RB_VMCR_DOT1Q_VID_SHIFT 0 -#define RTL8366RB_VMCR_DOT1Q_VID_MASK 0x0fff -#define RTL8366RB_VMCR_DOT1Q_PCP_SHIFT 12 -#define RTL8366RB_VMCR_DOT1Q_PCP_MASK 0x7000 -#define RTL8366RB_VMCR_MU_REG 1 -#define RTL8366RB_VMCR_MU_MEMBER_SHIFT 0 -#define RTL8366RB_VMCR_MU_MEMBER_MASK 0x00ff -#define RTL8366RB_VMCR_MU_UNTAG_SHIFT 8 -#define RTL8366RB_VMCR_MU_UNTAG_MASK 0xff00 -#define RTL8366RB_VMCR_FID_REG 2 -#define RTL8366RB_VMCR_FID_FID_SHIFT 0 -#define RTL8366RB_VMCR_FID_FID_MASK 0x0007 -#define RTL8366RB_VMCR(_reg, _vlan) \ - (RTL8366RB_VMCR_BASE + _reg + _vlan * RTL8366RB_VMCR_MULT) +#define RTL8366_PLSR_BASE (sc->chip_type == 0 ? 0x0014 : 0x0060) +#define RTL8366_PLSR_SPEED_MASK 0x03 +#define RTL8366_PLSR_SPEED_10 0x00 +#define RTL8366_PLSR_SPEED_100 0x01 +#define RTL8366_PLSR_SPEED_1000 0x02 +#define RTL8366_PLSR_FULLDUPLEX 0x04 +#define RTL8366_PLSR_LINK 0x10 +#define RTL8366_PLSR_TXPAUSE 0x20 +#define RTL8366_PLSR_RXPAUSE 0x40 +#define RTL8366_PLSR_NO_AUTO 0x80 + +/* VLAN Member Configuration, 3 or 2 registers per VLAN */ +#define RTL8366_VMCR_BASE (sc->chip_type == 0 ? 0x0020 : 0x0016) +#define RTL8366_VMCR_MULT (sc->chip_type == 0 ? 3 : 2) +#define RTL8366_VMCR_DOT1Q_REG 0 +#define RTL8366_VMCR_DOT1Q_VID_SHIFT 0 +#define RTL8366_VMCR_DOT1Q_VID_MASK 0x0fff +#define RTL8366_VMCR_DOT1Q_PCP_SHIFT 12 +#define RTL8366_VMCR_DOT1Q_PCP_MASK 0x7000 +#define RTL8366_VMCR_MU_REG 1 +#define RTL8366_VMCR_MU_MEMBER_SHIFT 0 +#define RTL8366_VMCR_MU_MEMBER_MASK (sc->chip_type == 0 ? 0x00ff : 0x003f) +#define RTL8366_VMCR_MU_UNTAG_SHIFT (sc->chip_type == 0 ? 8 : 6) +#define RTL8366_VMCR_MU_UNTAG_MASK (sc->chip_type == 0 ? 0xff00 : 0x0fc0) +#define RTL8366_VMCR_FID_REG (sc->chip_type == 0 ? 2 : 1) +#define RTL8366_VMCR_FID_FID_SHIFT (sc->chip_type == 0 ? 0 : 12) +#define RTL8366_VMCR_FID_FID_MASK (sc->chip_type == 0 ? 0x0007 : 0x7000) +#define RTL8366_VMCR(_reg, _vlan) \ + (RTL8366_VMCR_BASE + _reg + _vlan * RTL8366_VMCR_MULT) /* VLAN Identifier */ -#define RTL8366RB_VMCR_VID(_r) \ - (_r[RTL8366RB_VMCR_DOT1Q_REG] & RTL8366RB_VMCR_DOT1Q_VID_MASK) +#define RTL8366_VMCR_VID(_r) \ + (_r[RTL8366_VMCR_DOT1Q_REG] & RTL8366_VMCR_DOT1Q_VID_MASK) /* Priority Code Point */ -#define RTL8366RB_VMCR_PCP(_r) \ - ((_r[RTL8366RB_VMCR_DOT1Q_REG] & RTL8366RB_VMCR_DOT1Q_PCP_MASK) \ - >> RTL8366RB_VMCR_DOT1Q_PCP_SHIFT) +#define RTL8366_VMCR_PCP(_r) \ + ((_r[RTL8366_VMCR_DOT1Q_REG] & RTL8366_VMCR_DOT1Q_PCP_MASK) \ + >> RTL8366_VMCR_DOT1Q_PCP_SHIFT) /* Member ports */ -#define RTL8366RB_VMCR_MEMBER(_r) \ - (_r[RTL8366RB_VMCR_MU_REG] & RTL8366RB_VMCR_MU_MEMBER_MASK) +#define RTL8366_VMCR_MEMBER(_r) \ + (_r[RTL8366_VMCR_MU_REG] & RTL8366_VMCR_MU_MEMBER_MASK) /* Untagged ports */ -#define RTL8366RB_VMCR_UNTAG(_r) \ - ((_r[RTL8366RB_VMCR_MU_REG] & RTL8366RB_VMCR_MU_UNTAG_MASK) \ - >> RTL8366RB_VMCR_MU_UNTAG_SHIFT) +#define RTL8366_VMCR_UNTAG(_r) \ + ((_r[RTL8366_VMCR_MU_REG] & RTL8366_VMCR_MU_UNTAG_MASK) \ + >> RTL8366_VMCR_MU_UNTAG_SHIFT) /* Forwarding ID */ -#define RTL8366RB_VMCR_FID(_r) \ - (_r[RTL8366RB_VMCR_FID_REG] & RTL8366RB_VMCR_FID_FID_MASK) +#define RTL8366_VMCR_FID(_r) \ + (sc->chip_type == 0 ? (_r[RTL8366_VMCR_FID_REG] & RTL8366_VMCR_FID_FID_MASK) : \ + ((_r[RTL8366_VMCR_FID_REG] & RTL8366_VMCR_FID_FID_MASK) \ + >> RTL8366_VMCR_FID_FID_SHIFT)) /* * Port VLAN Control, 4 ports per register * Determines the VID for untagged ingress frames through * index into VMC. */ -#define RTL8366RB_PVCR_BASE 0x0063 -#define RTL8366RB_PVCR_PORT_SHIFT 4 -#define RTL8366RB_PVCR_PORT_PERREG (16 / RTL8366RB_PVCR_PORT_SHIFT) -#define RTL8366RB_PVCR_PORT_MASK 0x000f -#define RTL8366RB_PVCR_REG(_port) \ - (RTL8366RB_PVCR_BASE + _port / (RTL8366RB_PVCR_PORT_PERREG)) -#define RTL8366RB_PVCR_VAL(_port, _pvlan) \ - ((_pvlan & RTL8366RB_PVCR_PORT_MASK) << \ - ((_port % RTL8366RB_PVCR_PORT_PERREG) * RTL8366RB_PVCR_PORT_SHIFT)) -#define RTL8366RB_PVCR_GET(_port, _val) \ - (((_val) >> ((_port % RTL8366RB_PVCR_PORT_PERREG) * RTL8366RB_PVCR_PORT_SHIFT)) & RTL8366RB_PVCR_PORT_MASK) +#define RTL8366_PVCR_BASE (sc->chip_type == 0 ? 0x0063 : 0x0058) +#define RTL8366_PVCR_PORT_SHIFT 4 +#define RTL8366_PVCR_PORT_PERREG (16 / RTL8366_PVCR_PORT_SHIFT) +#define RTL8366_PVCR_PORT_MASK 0x000f +#define RTL8366_PVCR_REG(_port) \ + (RTL8366_PVCR_BASE + _port / (RTL8366_PVCR_PORT_PERREG)) +#define RTL8366_PVCR_VAL(_port, _pvlan) \ + ((_pvlan & RTL8366_PVCR_PORT_MASK) << \ + ((_port % RTL8366_PVCR_PORT_PERREG) * RTL8366_PVCR_PORT_SHIFT)) +#define RTL8366_PVCR_GET(_port, _val) \ + (((_val) >> ((_port % RTL8366_PVCR_PORT_PERREG) * RTL8366_PVCR_PORT_SHIFT)) & RTL8366_PVCR_PORT_MASK) /* Reset Control */ -#define RTL8366RB_RCR 0x0100 -#define RTL8366RB_RCR_HARD_RESET 0x0001 -#define RTL8366RB_RCR_SOFT_RESET 0x0002 +#define RTL8366_RCR 0x0100 +#define RTL8366_RCR_HARD_RESET 0x0001 +#define RTL8366_RCR_SOFT_RESET 0x0002 /* Chip Version Control: CHIP_VER[3:0] */ -#define RTL8366RB_CVCR 0x050A +#define RTL8366_CVCR (sc->chip_type == 0 ? 0x050A : 0x0104) /* Chip Identifier */ #define RTL8366RB_CIR 0x0509 #define RTL8366RB_CIR_ID8366RB 0x5937 +#define RTL8366SR_CIR 0x0105 +#define RTL8366SR_CIR_ID8366SR 0x8366 /* VLAN Ingress Control 2: [5:0] */ -#define RTL8366RB_VIC2R 0x037f +#define RTL8366_VIC2R 0x037f /* MIB registers */ -#define RTL8366RB_MCNT_BASE 0x1000 -#define RTL8366RB_MCTLR 0x13f0 -#define RTL8366RB_MCTLR_BUSY 0x0001 -#define RTL8366RB_MCTLR_RESET 0x0002 -#define RTL8366RB_MCTLR_RESET_PORT_MASK 0x00fc -#define RTL8366RB_MCTLR_RESET_ALL 0x0800 - -#define RTL8366RB_MCNT(_port, _r) \ - (RTL8366RB_MCNT_BASE + 0x50 * (_port) + (_r)) -#define RTL8366RB_MCTLR_RESET_PORT(_p) \ +#define RTL8366_MCNT_BASE 0x1000 +#define RTL8366_MCTLR (sc->chip_type == 0 ? 0x13f0 : 0x11F0) +#define RTL8366_MCTLR_BUSY 0x0001 +#define RTL8366_MCTLR_RESET 0x0002 +#define RTL8366_MCTLR_RESET_PORT_MASK 0x00fc +#define RTL8366_MCTLR_RESET_ALL 0x0800 + +#define RTL8366_MCNT(_port, _r) \ + (RTL8366_MCNT_BASE + 0x50 * (_port) + (_r)) +#define RTL8366_MCTLR_RESET_PORT(_p) \ (1 << ((_p) + 2)) /* PHY Access Control */ -#define RTL8366RB_PACR 0x8000 -#define RTL8366RB_PACR_WRITE 0x0000 -#define RTL8366RB_PACR_READ 0x0001 +#define RTL8366_PACR (sc->chip_type == 0 ? 0x8000 : 0x8028) +#define RTL8366_PACR_WRITE 0x0000 +#define RTL8366_PACR_READ 0x0001 /* PHY Access Data */ -#define RTL8366RB_PADR 0x8002 +#define RTL8366_PADR (sc->chip_type == 0 ? 0x8002 : 0x8029) -#define RTL8366RB_PHYREG(phy, page, reg) \ - (RTL8366RB_PACR | (1 << (((phy) & 0x1f) + 9)) | (((page) & 0xf) << 5) | ((reg) & 0x1f)) +#define RTL8366_PHYREG(phy, page, reg) \ + (0x8000 | (1 << (((phy) & 0x1f) + 9)) | (((page) & (sc->chip_type == 0 ? 0xf : 0x7)) << 5) | ((reg) & 0x1f)) /* general characteristics of the chip */ -#define RTL8366RB_CPU_PORT 5 -#define RTL8366RB_NUM_PORTS 6 -#define RTL8366RB_NUM_PHYS (RTL8366RB_NUM_PORTS-1) -#define RTL8366RB_NUM_VLANS 16 -#define RTL8366RB_NUM_PHY_REG 32 +#define RTL8366_CPU_PORT 5 +#define RTL8366_NUM_PORTS 6 +#define RTL8366_NUM_PHYS (RTL8366_NUM_PORTS-1) +#define RTL8366_NUM_VLANS 16 +#define RTL8366_NUM_PHY_REG 32 #endif From owner-svn-src-head@freebsd.org Tue Nov 15 22:30:26 2016 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 9BD5CC443E2; Tue, 15 Nov 2016 22:30:26 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 680291FAB; Tue, 15 Nov 2016 22:30:26 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFMUPXr090544; Tue, 15 Nov 2016 22:30:25 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFMUPep090542; Tue, 15 Nov 2016 22:30:25 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201611152230.uAFMUPep090542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Tue, 15 Nov 2016 22:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308702 - head/sys/dev/etherswitch/ip17x X-SVN-Group: head 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, 15 Nov 2016 22:30:26 -0000 Author: mizhka Date: Tue Nov 15 22:30:25 2016 New Revision: 308702 URL: https://svnweb.freebsd.org/changeset/base/308702 Log: [etherswitch] enable phy4/mac4 of ip175c If MII1 interface is disabled, then enable phy4/mac4. Submitted by: Hiroki Mori Reviewed by: mizhka, adrian Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6832 Modified: head/sys/dev/etherswitch/ip17x/ip175c.c head/sys/dev/etherswitch/ip17x/ip175c.h Modified: head/sys/dev/etherswitch/ip17x/ip175c.c ============================================================================== --- head/sys/dev/etherswitch/ip17x/ip175c.c Tue Nov 15 22:18:52 2016 (r308701) +++ head/sys/dev/etherswitch/ip17x/ip175c.c Tue Nov 15 22:30:25 2016 (r308702) @@ -234,6 +234,13 @@ ip175c_get_vlan_mode(struct ip17x_softc void ip175c_attach(struct ip17x_softc *sc) { + uint32_t data; + + data = ip17x_readphy(sc->sc_dev, IP175C_MII_PHY, IP175C_MII_CTL_REG); + device_printf(sc->sc_dev, "MII: %x\n", data); + /* check mii1 interface if disabled then phy4 and mac4 hold on switch */ + if((data & (1 << IP175C_MII_MII1_RMII_EN)) == 0) + sc->phymask |= 0x10; sc->hal.ip17x_reset = ip175c_reset; sc->hal.ip17x_hw_setup = ip175c_hw_setup; Modified: head/sys/dev/etherswitch/ip17x/ip175c.h ============================================================================== --- head/sys/dev/etherswitch/ip17x/ip175c.h Tue Nov 15 22:18:52 2016 (r308701) +++ head/sys/dev/etherswitch/ip17x/ip175c.h Tue Nov 15 22:30:25 2016 (r308702) @@ -35,6 +35,9 @@ #define IP175C_MODE_REG 31 #define IP175C_RESET_PHY 30 #define IP175C_RESET_REG 0 +#define IP175C_MII_PHY 31 +#define IP175C_MII_CTL_REG 5 +#define IP175C_MII_MII1_RMII_EN 8 #define IP175C_LAST_VLAN 15 From owner-svn-src-head@freebsd.org Tue Nov 15 23:46:02 2016 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 6279CC43681; Tue, 15 Nov 2016 23:46:02 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31E89982; Tue, 15 Nov 2016 23:46:02 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFNk1Of023031; Tue, 15 Nov 2016 23:46:01 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFNk1Tw023030; Tue, 15 Nov 2016 23:46:01 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201611152346.uAFNk1Tw023030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Tue, 15 Nov 2016 23:46:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308704 - head/sys/arm/allwinner/clk X-SVN-Group: head 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, 15 Nov 2016 23:46:02 -0000 Author: jmcneill Date: Tue Nov 15 23:46:01 2016 New Revision: 308704 URL: https://svnweb.freebsd.org/changeset/base/308704 Log: Allow the MMC frequency to be set up to 52MHz for MMC high speed timings. Modified: head/sys/arm/allwinner/clk/aw_mmcclk.c Modified: head/sys/arm/allwinner/clk/aw_mmcclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_mmcclk.c Tue Nov 15 23:03:57 2016 (r308703) +++ head/sys/arm/allwinner/clk/aw_mmcclk.c Tue Nov 15 23:46:01 2016 (r308704) @@ -185,7 +185,7 @@ aw_mmcclk_set_freq(struct clknode *clk, ophase = 0; phase = 5; n = 2; - } else if (*fout <= 50000000) { + } else if (*fout <= 52000000) { parent_idx = CLK_SRC_SEL_PLL6; ophase = 3; phase = 5; From owner-svn-src-head@freebsd.org Tue Nov 15 23:48:31 2016 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 904F0C437A1; Tue, 15 Nov 2016 23:48:31 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49BC4C29; Tue, 15 Nov 2016 23:48:31 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAFNmUNt023246; Tue, 15 Nov 2016 23:48:30 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAFNmUT9023245; Tue, 15 Nov 2016 23:48:30 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201611152348.uAFNmUT9023245@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Tue, 15 Nov 2016 23:48:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308705 - head/sys/arm/allwinner X-SVN-Group: head 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, 15 Nov 2016 23:48:31 -0000 Author: jmcneill Date: Tue Nov 15 23:48:30 2016 New Revision: 308705 URL: https://svnweb.freebsd.org/changeset/base/308705 Log: On command error, reset only DMA and FIFO engines instead of the entire controller. Fixes eMMC device detection on OrangePi Plus 2e (and likely others). Modified: head/sys/arm/allwinner/a10_mmc.c Modified: head/sys/arm/allwinner/a10_mmc.c ============================================================================== --- head/sys/arm/allwinner/a10_mmc.c Tue Nov 15 23:46:01 2016 (r308704) +++ head/sys/arm/allwinner/a10_mmc.c Tue Nov 15 23:48:30 2016 (r308705) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #define A10_MMC_DMA_SEGS ((MAXPHYS / PAGE_SIZE) + 1) #define A10_MMC_DMA_MAX_SIZE 0x2000 #define A10_MMC_DMA_FTRGLEVEL 0x20070008 +#define A10_MMC_RESET_RETRY 1000 #define CARD_ID_FREQUENCY 400000 @@ -229,7 +230,7 @@ a10_mmc_attach(device_t dev) bus_width = 4; sc->a10_host.f_min = 400000; - sc->a10_host.f_max = 50000000; + sc->a10_host.f_max = 52000000; sc->a10_host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340; sc->a10_host.mode = mode_sd; sc->a10_host.caps = MMC_CAP_HSPEED; @@ -449,11 +450,27 @@ a10_mmc_req_done(struct a10_mmc_softc *s { struct mmc_command *cmd; struct mmc_request *req; + uint32_t val, mask; + int retry; cmd = sc->a10_req->cmd; if (cmd->error != MMC_ERR_NONE) { - /* Reset the controller. */ - a10_mmc_reset(sc); + /* Reset the FIFO and DMA engines. */ + mask = A10_MMC_CTRL_FIFO_RST | A10_MMC_CTRL_DMA_RST; + val = A10_MMC_READ_4(sc, A10_MMC_GCTL); + A10_MMC_WRITE_4(sc, A10_MMC_GCTL, val | mask); + + retry = A10_MMC_RESET_RETRY; + while (--retry > 0) { + val = A10_MMC_READ_4(sc, A10_MMC_GCTL); + if ((val & mask) == 0) + break; + DELAY(10); + } + if (retry == 0) + device_printf(sc->a10_dev, + "timeout resetting DMA/FIFO\n"); + a10_mmc_update_clock(sc, 1); } req = sc->a10_req; From owner-svn-src-head@freebsd.org Wed Nov 16 00:21:20 2016 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 1271CC444CF; Wed, 16 Nov 2016 00:21:20 +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 D59791AC3; Wed, 16 Nov 2016 00:21:19 +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 uAG0LJBK037405; Wed, 16 Nov 2016 00:21:19 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG0LJIk037402; Wed, 16 Nov 2016 00:21:19 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201611160021.uAG0LJIk037402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 16 Nov 2016 00:21:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308706 - head/usr.bin/vmstat X-SVN-Group: head 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, 16 Nov 2016 00:21:20 -0000 Author: markj Date: Wed Nov 16 00:21:18 2016 New Revision: 308706 URL: https://svnweb.freebsd.org/changeset/base/308706 Log: Remove a lingering reference to cache pages from vmstat(8). Reported by: alc Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Tue Nov 15 23:48:30 2016 (r308705) +++ head/usr.bin/vmstat/vmstat.c Wed Nov 16 00:21:18 2016 (r308706) @@ -1085,8 +1085,6 @@ dosum(void) sum.v_vforkpages); xo_emit("{:pages-rfork/%9u} {N:pages affected by rfork}()\n", sum.v_rforkpages); - xo_emit("{:pages-total-cached/%9u} {N:pages cached}\n", - sum.v_tcached); xo_emit("{:pages-freed/%9u} {N:pages freed}\n", sum.v_tfree); xo_emit("{:pages-freed-by-daemon/%9u} {N:pages freed by daemon}\n", From owner-svn-src-head@freebsd.org Wed Nov 16 01:11:50 2016 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 DCD6AC44AEE; Wed, 16 Nov 2016 01:11:50 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A14CDB03; Wed, 16 Nov 2016 01:11:50 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAG1BnU3060009; Wed, 16 Nov 2016 01:11:49 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG1Bn9Z059993; Wed, 16 Nov 2016 01:11:49 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201611160111.uAG1Bn9Z059993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Wed, 16 Nov 2016 01:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308708 - head/sys/fs/nfs X-SVN-Group: head 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, 16 Nov 2016 01:11:51 -0000 Author: cperciva Date: Wed Nov 16 01:11:49 2016 New Revision: 308708 URL: https://svnweb.freebsd.org/changeset/base/308708 Log: Reduce NFS "NFSv4( mounted on)? fileid > 32bits" log spam. Rather than printing a warning for every time we receive a fileid > 2^32 from the NFS server, count warnings and print at most one of each warning type per minute, e.g., Nov 15 05:17:34 ip-172-30-1-221 kernel: NFSv4 fileid > 32bits (24730 occurrences) Nov 15 05:17:56 ip-172-30-1-221 kernel: NFSv4 mounted on fileid > 32bits (178 occurrences) Nov 15 05:18:53 ip-172-30-1-221 kernel: NFSv4 fileid > 32bits (7582 occurrences) Nov 15 05:18:58 ip-172-30-1-221 kernel: NFSv4 mounted on fileid > 32bits (23 occurrences) A buildworld with an NFS mounted /usr/obj can otherwise result in hundreds of thousands of lines being printed, which seems unnecessarily verbose. When ino_t becomes a 64-bit type, these printfs will no longer be needed (and the problems associated with truncating 64-bit fileids to generate 32-bit inode numbers will also go away). Reviewed by: rmacklem MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8523 Modified: head/sys/fs/nfs/nfs_commonsubs.c Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Wed Nov 16 01:03:42 2016 (r308707) +++ head/sys/fs/nfs/nfs_commonsubs.c Wed Nov 16 01:11:49 2016 (r308708) @@ -827,6 +827,12 @@ nfsv4_loadattr(struct nfsrv_descript *nd struct dqblk dqb; uid_t savuid; #endif + static struct timeval last64fileid; + static size_t count64fileid; + static struct timeval last64mountfileid; + static size_t count64mountfileid; + static struct timeval warninterval = { 60, 0 }; + if (compare) { retnotsup = 0; error = nfsrv_getattrbits(nd, &attrbits, NULL, &retnotsup); @@ -1202,8 +1208,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd *retcmpp = NFSERR_NOTSAME; } } else if (nap != NULL) { - if (*tl++) - printf("NFSv4 fileid > 32bits\n"); + if (*tl++) { + count64fileid++; + if (ratecheck(&last64fileid, &warninterval)) { + printf("NFSv4 fileid > 32bits (%zu occurrences)\n", + count64fileid); + count64fileid = 0; + } + } nap->na_fileid = thyp; } attrsum += NFSX_HYPER; @@ -1740,8 +1752,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd } } } else if (nap != NULL) { - if (*tl++) - printf("NFSv4 mounted on fileid > 32bits\n"); + if (*tl++) { + count64mountfileid++; + if (ratecheck(&last64mountfileid, &warninterval)) { + printf("NFSv4 mounted on fileid > 32bits (%zu occurrences)\n", + count64mountfileid); + count64mountfileid = 0; + } + } nap->na_mntonfileno = thyp; } attrsum += NFSX_HYPER; From owner-svn-src-head@freebsd.org Wed Nov 16 02:14:08 2016 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 D8451C43EC2; Wed, 16 Nov 2016 02:14:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B552EAAF; Wed, 16 Nov 2016 02:14:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAG2E7gJ084977; Wed, 16 Nov 2016 02:14:07 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG2E7VC084972; Wed, 16 Nov 2016 02:14:07 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201611160214.uAG2E7VC084972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 16 Nov 2016 02:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308709 - in head/sys: conf dev/gpio powerpc/conf X-SVN-Group: head 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, 16 Nov 2016 02:14:09 -0000 Author: jhibbits Date: Wed Nov 16 02:14:07 2016 New Revision: 308709 URL: https://svnweb.freebsd.org/changeset/base/308709 Log: Add a GPIO poweroff and reset driver. Summary: This implements part of the gpio-poweroff and gpio-restart device tree bindings. Optional properties are not handled currently. It also currently only supports level-triggered reset. Reviewed By: gonzo Differential Revision: https://reviews.freebsd.org/D8521 Added: head/sys/dev/gpio/gpiopower.c (contents, props changed) Modified: head/sys/conf/files head/sys/powerpc/conf/MPC85XX head/sys/powerpc/conf/MPC85XXSPE Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Nov 16 01:11:49 2016 (r308708) +++ head/sys/conf/files Wed Nov 16 02:14:07 2016 (r308709) @@ -1661,6 +1661,7 @@ dev/gpio/gpioc.c optional gpio \ dev/gpio/gpioiic.c optional gpioiic dev/gpio/gpioled.c optional gpioled !fdt dev/gpio/gpioled_fdt.c optional gpioled fdt +dev/gpio/gpiopower.c optional gpiopower fdt dev/gpio/gpioregulator.c optional gpioregulator fdt ext_resources dev/gpio/gpiospi.c optional gpiospi dev/gpio/gpio_if.m optional gpio Added: head/sys/dev/gpio/gpiopower.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpiopower.c Wed Nov 16 02:14:07 2016 (r308709) @@ -0,0 +1,137 @@ +/*- + * Copyright (c) 2016 Justin Hibbits + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +struct gpiopower_softc { + gpio_pin_t sc_pin; + int sc_rbmask; +}; + +static void gpiopower_assert(device_t dev, int howto); + +static int +gpiopower_probe(device_t dev) +{ + + if (ofw_bus_is_compatible(dev, "gpio-poweroff")) { + device_set_desc(dev, "GPIO poweroff control"); + return (0); + } else if (ofw_bus_is_compatible(dev, "gpio-restart")) { + device_set_desc(dev, "GPIO restart control"); + return (0); + } + + return (ENXIO); +} + +static int +gpiopower_attach(device_t dev) +{ + struct gpiopower_softc *sc; + phandle_t node; + + sc = device_get_softc(dev); + + if ((node = ofw_bus_get_node(dev)) == -1) + return (ENXIO); + + ofw_gpiobus_parse_gpios(dev, "gpios", &sc->sc_pin); + if (sc->sc_pin == NULL) { + device_printf(dev, "failed to map GPIO pin\n"); + return (ENXIO); + } + + if (ofw_bus_is_compatible(dev, "gpio-poweroff")) + sc->sc_rbmask = RB_HALT | RB_POWEROFF; + else + sc->sc_rbmask = 0; + EVENTHANDLER_REGISTER(shutdown_final, gpiopower_assert, dev, + SHUTDOWN_PRI_LAST); + gpio_pin_setflags(sc->sc_pin, GPIO_PIN_OUTPUT); + + return (0); +} + +static void +gpiopower_assert(device_t dev, int howto) +{ + struct gpiopower_softc *sc; + int do_assert; + + sc = device_get_softc(dev); + do_assert = sc->sc_rbmask ? (sc->sc_rbmask & howto) : + ((howto & RB_HALT) == 0); + + if (!do_assert) + return; + + if (howto & RB_POWEROFF) + device_printf(dev, "powering system off\n"); + else if ((howto & RB_HALT) == 0) + device_printf(dev, "resetting system\n"); + else + return; + + gpio_pin_set_active(sc->sc_pin, true); + + /* Wait a second for it to trip */ + DELAY(10000000); +} + +static devclass_t gpiopower_devclass; + +static device_method_t gpiopower_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, gpiopower_probe), + DEVMETHOD(device_attach, gpiopower_attach), + + DEVMETHOD_END +}; + +static driver_t gpiopower_driver = { + "gpiopower", + gpiopower_methods, + sizeof(struct gpiopower_softc) +}; + +DRIVER_MODULE(gpiopower, simplebus, gpiopower_driver, gpiopower_devclass, 0, 0); +MODULE_DEPEND(gpiopower, gpiobus, 1, 1, 1); Modified: head/sys/powerpc/conf/MPC85XX ============================================================================== --- head/sys/powerpc/conf/MPC85XX Wed Nov 16 01:11:49 2016 (r308708) +++ head/sys/powerpc/conf/MPC85XX Wed Nov 16 02:14:07 2016 (r308709) @@ -75,6 +75,7 @@ device alc device ether device fxp device gpio +device gpiopower device iic device iicbus #device isa Modified: head/sys/powerpc/conf/MPC85XXSPE ============================================================================== --- head/sys/powerpc/conf/MPC85XXSPE Wed Nov 16 01:11:49 2016 (r308708) +++ head/sys/powerpc/conf/MPC85XXSPE Wed Nov 16 02:14:07 2016 (r308709) @@ -75,6 +75,7 @@ device alc device ether device fxp device gpio +device gpiopower device iic device iicbus #device isa From owner-svn-src-head@freebsd.org Wed Nov 16 02:51:25 2016 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 D6C75C448CA; Wed, 16 Nov 2016 02:51:25 +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 A65741C31; Wed, 16 Nov 2016 02:51:25 +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 uAG2pOac099114; Wed, 16 Nov 2016 02:51:24 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG2pO71099113; Wed, 16 Nov 2016 02:51:24 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201611160251.uAG2pO71099113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 16 Nov 2016 02:51:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308710 - head/share/man/man9 X-SVN-Group: head 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, 16 Nov 2016 02:51:25 -0000 Author: alc Date: Wed Nov 16 02:51:24 2016 New Revision: 308710 URL: https://svnweb.freebsd.org/changeset/base/308710 Log: Update to reflect the demise of PG_CACHED pages. Reviewed by: kib, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8530 Modified: head/share/man/man9/vm_page_alloc.9 Modified: head/share/man/man9/vm_page_alloc.9 ============================================================================== --- head/share/man/man9/vm_page_alloc.9 Wed Nov 16 02:14:07 2016 (r308709) +++ head/share/man/man9/vm_page_alloc.9 Wed Nov 16 02:51:24 2016 (r308710) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 28, 2012 +.Dd November 16, 2016 .Dt VM_PAGE_ALLOC 9 .Os .Sh NAME @@ -52,8 +52,6 @@ The page returned is inserted into the o .Dv VM_ALLOC_NOOBJ is specified in the .Fa req . -The page may exist in the vm object cache, in which case it will -be reactivated instead, moving from the cache into the object page list. .Pp .Fn vm_page_alloc will not sleep. @@ -89,7 +87,7 @@ than zero. .El .Pp The optional flags are: -.Bl -tag -width ".Dv VM_ALLOC_IFNOTCACHED" +.Bl -tag -width ".Dv VM_ALLOC_NOBUSY" .It Dv VM_ALLOC_NOBUSY The returned page will not be exclusive busy. .It Dv VM_ALLOC_NODUMP @@ -100,16 +98,6 @@ Do not associate the allocated page with The .Fa object argument is ignored. -.It Dv VM_ALLOC_IFCACHED -Allocate the page only if it is cached. -Otherwise, return -.Dv NULL . -.It Dv VM_ALLOC_IFNOTCACHED -Only allocate the page if it is not cached in the -.Fa object . -If the page at the specified -.Fa pindex -is cached, NULL is returned instead. .It Dv VM_ALLOC_SBUSY The returned page will be shared busy. .It Dv VM_ALLOC_WIRED From owner-svn-src-head@freebsd.org Wed Nov 16 03:19:37 2016 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 B159AC4201C; Wed, 16 Nov 2016 03:19:37 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B2021288; Wed, 16 Nov 2016 03:19:37 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAG3JaSS010014; Wed, 16 Nov 2016 03:19:36 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG3JaY5010012; Wed, 16 Nov 2016 03:19:36 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201611160319.uAG3JaY5010012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Wed, 16 Nov 2016 03:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308711 - head/share/mk X-SVN-Group: head 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, 16 Nov 2016 03:19:37 -0000 Author: kan Date: Wed Nov 16 03:19:36 2016 New Revision: 308711 URL: https://svnweb.freebsd.org/changeset/base/308711 Log: Set endianness and floating point flags explicitly for MIPS targets The tree can be build with an external toolchain that will not necessarily default to desired settings, so we have to specify the required flags explicitly to force the required compilation mode. Reviewed by: adrian, br Sponsored by: https://reviews.freebsd.org/D8505 Modified: head/share/mk/bsd.cpu.mk Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Wed Nov 16 02:51:24 2016 (r308710) +++ head/share/mk/bsd.cpu.mk Wed Nov 16 03:19:36 2016 (r308711) @@ -303,9 +303,22 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3 .if ${MACHINE_CPUARCH} == "mips" CFLAGS += -G0 -.if ${MACHINE_ARCH:Mmips*hf} +. if ${MACHINE_ARCH:Mmips*el*} != "" +ACFLAGS += -EL +AFLAGS += -EL +CFLAGS += -EL +LDFLAGS += -EL +. else +ACFLAGS += -EB +AFLAGS += -EB +CFLAGS += -EB +LDFLAGS += -EB +. endif +. if ${MACHINE_ARCH:Mmips*hf} CFLAGS += -mhard-float -.endif +. else +CFLAGS += -msoft-float +. endif .endif ########## arm From owner-svn-src-head@freebsd.org Wed Nov 16 03:21:51 2016 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 1D9CCC421EC; Wed, 16 Nov 2016 03:21:51 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3F22156E; Wed, 16 Nov 2016 03:21:50 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAG3LoGb011512; Wed, 16 Nov 2016 03:21:50 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG3Lo0q011485; Wed, 16 Nov 2016 03:21:50 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201611160321.uAG3Lo0q011485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Wed, 16 Nov 2016 03:21:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308712 - head/lib/csu/mips X-SVN-Group: head 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, 16 Nov 2016 03:21:51 -0000 Author: kan Date: Wed Nov 16 03:21:49 2016 New Revision: 308712 URL: https://svnweb.freebsd.org/changeset/base/308712 Log: Make MIPS startup assembly files use neutral float ABI. This allows these files to be used with hard and softfloat targets with no special flags passed to the compiler. Reviewed by: adrian, br, imp Differential Revision: https://reviews.freebsd.org/D8506 Modified: head/lib/csu/mips/crti.S head/lib/csu/mips/crtn.S Modified: head/lib/csu/mips/crti.S ============================================================================== --- head/lib/csu/mips/crti.S Wed Nov 16 03:19:36 2016 (r308711) +++ head/lib/csu/mips/crti.S Wed Nov 16 03:21:49 2016 (r308712) @@ -1,6 +1,7 @@ #include __FBSDID("$FreeBSD$"); + .gnu_attribute 4, 0 .section .init,"ax",%progbits .align 4 .globl _init Modified: head/lib/csu/mips/crtn.S ============================================================================== --- head/lib/csu/mips/crtn.S Wed Nov 16 03:19:36 2016 (r308711) +++ head/lib/csu/mips/crtn.S Wed Nov 16 03:21:49 2016 (r308712) @@ -1,6 +1,7 @@ #include __FBSDID("$FreeBSD$"); + .gnu_attribute 4, 0 .section .init,"ax",%progbits .align 4 .set noreorder From owner-svn-src-head@freebsd.org Wed Nov 16 03:24:21 2016 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 E4BD2C42281; Wed, 16 Nov 2016 03:24:21 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6CDF18DC; Wed, 16 Nov 2016 03:24:21 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAG3OKJg013693; Wed, 16 Nov 2016 03:24:20 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG3OKRJ013692; Wed, 16 Nov 2016 03:24:20 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201611160324.uAG3OKRJ013692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Wed, 16 Nov 2016 03:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308713 - head/sys/conf X-SVN-Group: head 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, 16 Nov 2016 03:24:22 -0000 Author: kan Date: Wed Nov 16 03:24:20 2016 New Revision: 308713 URL: https://svnweb.freebsd.org/changeset/base/308713 Log: Compile trampoline with soft-float on MIPS, to match the rest of the kernel Core kernel is always compiled with -msoft-float on all of our platforms, make sure we follow the suit with trampoline as well. Reviewed by: adrian, br, imp Differential Revision: https://reviews.freebsd.org/D8507 Modified: head/sys/conf/Makefile.mips Modified: head/sys/conf/Makefile.mips ============================================================================== --- head/sys/conf/Makefile.mips Wed Nov 16 03:21:49 2016 (r308712) +++ head/sys/conf/Makefile.mips Wed Nov 16 03:24:20 2016 (r308713) @@ -52,6 +52,8 @@ CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS) HACK_EXTRA_FLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS) TRAMP_ARCH_FLAGS?=$(ARCH_FLAGS) TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} ${TRAMP_ARCH_FLAGS} +# Kernel code is always compiled with soft-float on MIPS +TRAMP_EXTRA_FLAGS+=-msoft-float .if ${MACHINE_ARCH:Mmips64*} != "" TRAMP_ELFSIZE=64 .else From owner-svn-src-head@freebsd.org Wed Nov 16 05:24:45 2016 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 22BCCC44383; Wed, 16 Nov 2016 05:24:45 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9029F50; Wed, 16 Nov 2016 05:24:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAG5Oi1p061999; Wed, 16 Nov 2016 05:24:44 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG5OhHj061990; Wed, 16 Nov 2016 05:24:43 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201611160524.uAG5OhHj061990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 16 Nov 2016 05:24:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308718 - in head/sys: contrib/ncsw/inc contrib/ncsw/user/env dev/dpaa powerpc/booke powerpc/include powerpc/mpc85xx X-SVN-Group: head 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, 16 Nov 2016 05:24:45 -0000 Author: jhibbits Date: Wed Nov 16 05:24:42 2016 New Revision: 308718 URL: https://svnweb.freebsd.org/changeset/base/308718 Log: Simplify the page tracking for VA<->PA translations. Drop the tracking down to the pmap layer, with optimizations to only track necessary pages. This should give a (slight) performance improvement, as well as a stability improvement, as the tracking is already mostly handled by the pmap layer. Modified: head/sys/contrib/ncsw/inc/xx_ext.h head/sys/contrib/ncsw/user/env/xx.c head/sys/dev/dpaa/fman.c head/sys/dev/dpaa/if_dtsec.c head/sys/dev/dpaa/if_dtsec_rm.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/include/pmap.h head/sys/powerpc/mpc85xx/mpc85xx.h head/sys/powerpc/mpc85xx/platform_mpc85xx.c Modified: head/sys/contrib/ncsw/inc/xx_ext.h ============================================================================== --- head/sys/contrib/ncsw/inc/xx_ext.h Wed Nov 16 03:54:41 2016 (r308717) +++ head/sys/contrib/ncsw/inc/xx_ext.h Wed Nov 16 05:24:42 2016 (r308718) @@ -930,9 +930,4 @@ t_Error XX_IpcSendMessage(t_Handle /** @} */ /* end of xx_ipc group */ /** @} */ /* end of xx_id group */ -/** FreeBSD Specific additions. */ -void XX_TrackInit(void); -physAddress_t XX_TrackAddress(void *addr); -void XX_UntrackAddress(void *addr); - #endif /* __XX_EXT_H */ Modified: head/sys/contrib/ncsw/user/env/xx.c ============================================================================== --- head/sys/contrib/ncsw/user/env/xx.c Wed Nov 16 03:54:41 2016 (r308717) +++ head/sys/contrib/ncsw/user/env/xx.c Wed Nov 16 05:24:42 2016 (r308718) @@ -51,6 +51,7 @@ #include #include +#include #include "error_ext.h" #include "std_ext.h" #include "list_ext.h" @@ -124,19 +125,6 @@ struct XX_PortalInfo { static struct XX_PortalInfo XX_PInfo; -/* The lower 9 bits, through emprical testing, tend to be 0. */ -#define XX_MALLOC_TRACK_SHIFT 9 - -typedef struct XX_MallocTrackStruct { - LIST_ENTRY(XX_MallocTrackStruct) entries; - physAddress_t pa; - void *va; -} XX_MallocTrackStruct; - -LIST_HEAD(XX_MallocTrackerList, XX_MallocTrackStruct) *XX_MallocTracker; -u_long XX_MallocHashMask; -static XX_MallocTrackStruct * XX_FindTracker(physAddress_t pa); - void XX_Exit(int status) { @@ -266,7 +254,6 @@ XX_FreeSmart(void *p) KASSERT(XX_MallocSmartMap[start] > 0, ("XX_FreeSmart: Double or mid-block free!\n")); - XX_UntrackAddress(p); /* Free region */ slices = XX_MallocSmartMap[start]; XX_MallocSmartMapClear(start, slices); @@ -279,8 +266,6 @@ void XX_Free(void *p) { - if (p != NULL) - XX_UntrackAddress(p); free(p, M_NETCOMMSW); } @@ -758,6 +743,11 @@ XX_VirtToPhys(void *addr) if (addr == NULL) return (-1); + /* Check CCSR */ + if ((vm_offset_t)addr >= ccsrbar_va && + (vm_offset_t)addr < ccsrbar_va + ccsrbar_size) + return (((vm_offset_t)addr - ccsrbar_va) + ccsrbar_pa); + /* Handle BMAN mappings */ if (((vm_offset_t)addr >= XX_PInfo.portal_ce_va[BM_PORTAL]) && ((vm_offset_t)addr < XX_PInfo.portal_ce_va[BM_PORTAL] + @@ -784,10 +774,12 @@ XX_VirtToPhys(void *addr) return (XX_PInfo.portal_ci_pa[QM_PORTAL][cpu] + (vm_offset_t)addr - XX_PInfo.portal_ci_va[QM_PORTAL]); - paddr = XX_TrackAddress(addr); - if (paddr == -1) + paddr = pmap_kextract((vm_offset_t)addr); + if (paddr == 0) printf("NetCommSW: " "Unable to translate virtual address 0x%08X!\n", addr); + else + pmap_track_page(kernel_pmap, (vm_offset_t)addr); return (paddr); } @@ -795,9 +787,15 @@ XX_VirtToPhys(void *addr) void * XX_PhysToVirt(physAddress_t addr) { - XX_MallocTrackStruct *ts; + struct pv_entry *pv; + vm_page_t page; int cpu; + /* Check CCSR */ + if (addr >= ccsrbar_pa && addr < ccsrbar_pa + ccsrbar_size) + return ((void *)((vm_offset_t)(addr - ccsrbar_pa) + + ccsrbar_va)); + cpu = PCPU_GET(cpuid); /* Handle BMAN mappings */ @@ -826,12 +824,11 @@ XX_PhysToVirt(physAddress_t addr) return ((void *)(XX_PInfo.portal_ci_va[QM_PORTAL] + (vm_offset_t)(addr - XX_PInfo.portal_ci_pa[QM_PORTAL][cpu]))); - mtx_lock(&XX_MallocTrackLock); - ts = XX_FindTracker(addr); - mtx_unlock(&XX_MallocTrackLock); + page = PHYS_TO_VM_PAGE(addr); + pv = TAILQ_FIRST(&page->md.pv_list); - if (ts != NULL) - return ts->va; + if (pv != NULL) + return ((void *)(pv->pv_va + ((vm_offset_t)addr & PAGE_MASK))); printf("NetCommSW: " "Unable to translate physical address 0x%08llX!\n", addr); @@ -877,72 +874,3 @@ XX_PortalSetInfo(device_t dev) end: free(dev_name, M_TEMP); } - -static inline XX_MallocTrackStruct * -XX_FindTracker(physAddress_t pa) -{ - struct XX_MallocTrackerList *l; - XX_MallocTrackStruct *tp; - - l = &XX_MallocTracker[(pa >> XX_MALLOC_TRACK_SHIFT) & XX_MallocHashMask]; - - LIST_FOREACH(tp, l, entries) { - if (tp->pa == pa) - return tp; - } - - return NULL; -} - -void -XX_TrackInit(void) -{ - if (XX_MallocTracker == NULL) { - XX_MallocTracker = hashinit(64, M_NETCOMMSW_MT, - &XX_MallocHashMask); - } -} - -physAddress_t -XX_TrackAddress(void *addr) -{ - physAddress_t pa; - struct XX_MallocTrackerList *l; - XX_MallocTrackStruct *ts; - - pa = pmap_kextract((vm_offset_t)addr); - - l = &XX_MallocTracker[(pa >> XX_MALLOC_TRACK_SHIFT) & XX_MallocHashMask]; - - mtx_lock(&XX_MallocTrackLock); - if (XX_FindTracker(pa) == NULL) { - ts = malloc(sizeof(*ts), M_NETCOMMSW_MT, M_NOWAIT); - if (ts == NULL) - return (-1); - ts->va = addr; - ts->pa = pa; - LIST_INSERT_HEAD(l, ts, entries); - } - mtx_unlock(&XX_MallocTrackLock); - - return (pa); -} - -void -XX_UntrackAddress(void *addr) -{ - physAddress_t pa; - XX_MallocTrackStruct *ts; - - pa = pmap_kextract((vm_offset_t)addr); - - KASSERT(XX_MallocTracker != NULL, - ("Untracking an address before it's even initialized!\n")); - - mtx_lock(&XX_MallocTrackLock); - ts = XX_FindTracker(pa); - if (ts != NULL) - LIST_REMOVE(ts, entries); - mtx_unlock(&XX_MallocTrackLock); - free(ts, M_NETCOMMSW_MT); -} Modified: head/sys/dev/dpaa/fman.c ============================================================================== --- head/sys/dev/dpaa/fman.c Wed Nov 16 03:54:41 2016 (r308717) +++ head/sys/dev/dpaa/fman.c Wed Nov 16 05:24:42 2016 (r308718) @@ -273,8 +273,6 @@ fman_attach(device_t dev) return (ENXIO); } - XX_TrackInit(); - node = ofw_bus_get_node(dev); if (OF_getencprop(node, "fsl,qman-channel-range", qchan_range, sizeof(qchan_range)) <= 0) { Modified: head/sys/dev/dpaa/if_dtsec.c ============================================================================== --- head/sys/dev/dpaa/if_dtsec.c Wed Nov 16 03:54:41 2016 (r308717) +++ head/sys/dev/dpaa/if_dtsec.c Wed Nov 16 05:24:42 2016 (r308718) @@ -582,8 +582,6 @@ dtsec_attach(device_t dev) if (XX_MallocSmartInit() != E_OK) return (ENXIO); - XX_TrackInit(); - /* Init locks */ mtx_init(&sc->sc_lock, device_get_nameunit(dev), "DTSEC Global Lock", MTX_DEF); Modified: head/sys/dev/dpaa/if_dtsec_rm.c ============================================================================== --- head/sys/dev/dpaa/if_dtsec_rm.c Wed Nov 16 03:54:41 2016 (r308717) +++ head/sys/dev/dpaa/if_dtsec_rm.c Wed Nov 16 05:24:42 2016 (r308718) @@ -136,7 +136,6 @@ static void dtsec_rm_fi_free(struct dtsec_softc *sc, struct dtsec_rm_frame_info *fi) { - XX_UntrackAddress(fi); uma_zfree(sc->sc_fi_zone, fi); } /** @} */ Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed Nov 16 03:54:41 2016 (r308717) +++ head/sys/powerpc/booke/pmap.c Wed Nov 16 05:24:42 2016 (r308718) @@ -872,10 +872,11 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_of if (PTE_ISWIRED(pte)) pmap->pm_stats.wired_count--; + /* Get vm_page_t for mapped pte. */ + m = PHYS_TO_VM_PAGE(PTE_PA(pte)); + /* Handle managed entry. */ if (PTE_ISMANAGED(pte)) { - /* Get vm_page_t for mapped pte. */ - m = PHYS_TO_VM_PAGE(PTE_PA(pte)); if (PTE_ISMODIFIED(pte)) vm_page_dirty(m); @@ -884,6 +885,15 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_of vm_page_aflag_set(m, PGA_REFERENCED); pv_remove(pmap, va, m); + } else if (m->md.pv_tracked) { + /* + * Always pv_insert()/pv_remove() on MPC85XX, in case DPAA is + * used. This is needed by the NCSW support code for fast + * VA<->PA translation. + */ + pv_remove(pmap, va, m); + if (TAILQ_EMPTY(&m->md.pv_list)) + m->md.pv_tracked = false; } mtx_lock_spin(&tlbivax_mutex); @@ -3466,6 +3476,33 @@ pmap_early_io_map(vm_paddr_t pa, vm_size return (va); } +void +pmap_track_page(pmap_t pmap, vm_offset_t va) +{ + vm_paddr_t pa; + vm_page_t page; + struct pv_entry *pve; + + va &= ~PAGE_MASK; + pa = pmap_kextract(va); + + rw_wlock(&pvh_global_lock); + PMAP_LOCK(pmap); + page = PHYS_TO_VM_PAGE(pa); + + TAILQ_FOREACH(pve, &page->md.pv_list, pv_link) { + if ((pmap == pve->pv_pmap) && (va == pve->pv_va)) { + goto out; + } + } + page->md.pv_tracked = true; + pv_insert(pmap, va, page); +out: + PMAP_UNLOCK(pmap); + rw_wunlock(&pvh_global_lock); +} + + /* * Setup MAS4 defaults. * These values are loaded to MAS0-2 on a TLB miss. Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Wed Nov 16 03:54:41 2016 (r308717) +++ head/sys/powerpc/include/pmap.h Wed Nov 16 05:24:42 2016 (r308718) @@ -204,6 +204,7 @@ typedef struct pv_entry *pv_entry_t; struct md_page { TAILQ_HEAD(, pv_entry) pv_list; + bool pv_tracked; }; #define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT @@ -261,6 +262,7 @@ extern int pmap_bootstrapped; vm_offset_t pmap_early_io_map(vm_paddr_t pa, vm_size_t size); void pmap_early_io_unmap(vm_offset_t va, vm_size_t size); +void pmap_track_page(pmap_t pmap, vm_offset_t va); #endif Modified: head/sys/powerpc/mpc85xx/mpc85xx.h ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx.h Wed Nov 16 03:54:41 2016 (r308717) +++ head/sys/powerpc/mpc85xx/mpc85xx.h Wed Nov 16 05:24:42 2016 (r308718) @@ -36,6 +36,8 @@ * Configuration control and status registers */ extern vm_offset_t ccsrbar_va; +extern vm_paddr_t ccsrbar_pa; +extern vm_size_t ccsrbar_size; #define CCSRBAR_VA ccsrbar_va #define OCP85XX_CCSRBAR (CCSRBAR_VA + 0x0) #define OCP85XX_BPTR (CCSRBAR_VA + 0x20) Modified: head/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/platform_mpc85xx.c Wed Nov 16 03:54:41 2016 (r308717) +++ head/sys/powerpc/mpc85xx/platform_mpc85xx.c Wed Nov 16 05:24:42 2016 (r308718) @@ -78,7 +78,9 @@ struct cpu_release { #endif extern uint32_t *bootinfo; +vm_paddr_t ccsrbar_pa; vm_offset_t ccsrbar_va; +vm_size_t ccsrbar_size; static int cpu, maxcpu; @@ -194,6 +196,8 @@ mpc85xx_attach(platform_t plat) ccsrsize |= ranges[i]; } ccsrbar_va = pmap_early_io_map(ccsrbar, ccsrsize); + ccsrbar_pa = ccsrbar; + ccsrbar_size = ccsrsize; #if 0 mpc85xx_fix_errata(ccsrbar_va); From owner-svn-src-head@freebsd.org Wed Nov 16 09:02:18 2016 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 8802BC419EA; Wed, 16 Nov 2016 09:02:18 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40B4E17E; Wed, 16 Nov 2016 09:02:18 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAG92Hon051972; Wed, 16 Nov 2016 09:02:17 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG92HIu051971; Wed, 16 Nov 2016 09:02:17 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611160902.uAG92HIu051971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Wed, 16 Nov 2016 09:02:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308723 - head/sys/dev/hyperv/vmbus X-SVN-Group: head 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, 16 Nov 2016 09:02:18 -0000 Author: dexuan Date: Wed Nov 16 09:02:17 2016 New Revision: 308723 URL: https://svnweb.freebsd.org/changeset/base/308723 Log: hyperv/vmbus: add a new method to get vcpu_id vcpu_id is host's representation of guest CPU. We get the mapping between vcpu_id and FreeBSD kernel's cpu id when VMBus driver is loaded. Later, when a driver, like the coming pcib driver, talks to the host and needs to refer to a guest CPU, the driver must use the vcpu_id. Reviewed by: jhb, sephe Approved by: sephe (mentor) MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8410 Modified: head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_if.m Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Nov 16 07:05:42 2016 (r308722) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Nov 16 09:02:17 2016 (r308723) @@ -77,6 +77,8 @@ static int vmbus_child_pnpinfo_str(dev static uint32_t vmbus_get_version_method(device_t, device_t); static int vmbus_probe_guid_method(device_t, device_t, const struct hyperv_guid *); +static uint32_t vmbus_get_vcpu_id_method(device_t bus, + device_t dev, int cpu); static int vmbus_init(struct vmbus_softc *); static int vmbus_connect(struct vmbus_softc *, uint32_t); @@ -135,6 +137,7 @@ static device_method_t vmbus_methods[] = /* Vmbus interface */ DEVMETHOD(vmbus_get_version, vmbus_get_version_method), DEVMETHOD(vmbus_probe_guid, vmbus_probe_guid_method), + DEVMETHOD(vmbus_get_vcpu_id, vmbus_get_vcpu_id_method), DEVMETHOD_END }; @@ -991,6 +994,14 @@ vmbus_probe_guid_method(device_t bus, de return ENXIO; } +static uint32_t +vmbus_get_vcpu_id_method(device_t bus, device_t dev, int cpu) +{ + const struct vmbus_softc *sc = device_get_softc(bus); + + return (VMBUS_PCPU_GET(sc, vcpuid, cpu)); +} + static int vmbus_probe(device_t dev) { Modified: head/sys/dev/hyperv/vmbus/vmbus_if.m ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_if.m Wed Nov 16 07:05:42 2016 (r308722) +++ head/sys/dev/hyperv/vmbus/vmbus_if.m Wed Nov 16 09:02:17 2016 (r308723) @@ -45,3 +45,9 @@ METHOD int probe_guid { device_t dev; const struct hyperv_guid *guid; }; + +METHOD uint32_t get_vcpu_id { + device_t bus; + device_t dev; + int cpu; +}; From owner-svn-src-head@freebsd.org Wed Nov 16 09:08:33 2016 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 EBB16C41AF1; Wed, 16 Nov 2016 09:08:33 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C83915E6; Wed, 16 Nov 2016 09:08:33 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAG98XBa052229; Wed, 16 Nov 2016 09:08:33 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG98WjC052227; Wed, 16 Nov 2016 09:08:32 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611160908.uAG98WjC052227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Wed, 16 Nov 2016 09:08:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308724 - head/sys/dev/hyperv/vmbus X-SVN-Group: head 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, 16 Nov 2016 09:08:34 -0000 Author: dexuan Date: Wed Nov 16 09:08:32 2016 New Revision: 308724 URL: https://svnweb.freebsd.org/changeset/base/308724 Log: hyperv/vmbus: add new vmbus methods to support PCIe pass-through The new methods will be used by the coming pcib driver. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8409 Modified: head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Nov 16 09:02:17 2016 (r308723) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Nov 16 09:08:32 2016 (r308724) @@ -44,10 +44,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include +#include #include #include @@ -58,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include "acpi_if.h" +#include "pcib_if.h" #include "vmbus_if.h" #define VMBUS_GPADL_START 0xe1e10 @@ -74,6 +78,20 @@ static int vmbus_read_ivar(device_t, d uintptr_t *); static int vmbus_child_pnpinfo_str(device_t, device_t, char *, size_t); +static struct resource *vmbus_alloc_resource(device_t dev, + device_t child, int type, int *rid, + rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); +static int vmbus_alloc_msi(device_t bus, device_t dev, + int count, int maxcount, int *irqs); +static int vmbus_release_msi(device_t bus, device_t dev, + int count, int *irqs); +static int vmbus_alloc_msix(device_t bus, device_t dev, + int *irq); +static int vmbus_release_msix(device_t bus, device_t dev, + int irq); +static int vmbus_map_msi(device_t bus, device_t dev, + int irq, uint64_t *addr, uint32_t *data); static uint32_t vmbus_get_version_method(device_t, device_t); static int vmbus_probe_guid_method(device_t, device_t, const struct hyperv_guid *); @@ -133,6 +151,22 @@ static device_method_t vmbus_methods[] = DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, vmbus_read_ivar), DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), + DEVMETHOD(bus_alloc_resource, vmbus_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), +#if __FreeBSD_version >= 1100000 + DEVMETHOD(bus_get_cpus, bus_generic_get_cpus), +#endif + + /* pcib interface */ + DEVMETHOD(pcib_alloc_msi, vmbus_alloc_msi), + DEVMETHOD(pcib_release_msi, vmbus_release_msi), + DEVMETHOD(pcib_alloc_msix, vmbus_alloc_msix), + DEVMETHOD(pcib_release_msix, vmbus_release_msix), + DEVMETHOD(pcib_map_msi, vmbus_map_msi), /* Vmbus interface */ DEVMETHOD(vmbus_get_version, vmbus_get_version_method), @@ -975,6 +1009,69 @@ vmbus_sysctl_version(SYSCTL_HANDLER_ARGS return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); } +/* + * We need the function to make sure the MMIO resource is allocated from the + * ranges found in _CRS. + * + * For the release function, we can use bus_generic_release_resource(). + */ +static struct resource * +vmbus_alloc_resource(device_t dev, device_t child, int type, int *rid, + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) +{ + struct vmbus_softc *sc = device_get_softc(dev); + device_t parent = device_get_parent(dev); + struct resource *res; + + if (type != SYS_RES_MEMORY) + res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start, + end, count, flags); + else + res = pcib_host_res_alloc(&sc->vmbus_mmio_res, child, type, + rid, start, end, count, flags); + + return (res); +} + +static device_t +get_nexus(device_t vmbus) +{ + device_t acpi = device_get_parent(vmbus); + device_t nexus = device_get_parent(acpi); + return (nexus); +} + +static int +vmbus_alloc_msi(device_t bus, device_t dev, int count, int maxcount, int *irqs) +{ + return (PCIB_ALLOC_MSI(get_nexus(bus), dev, count, maxcount, irqs)); +} + +static int +vmbus_release_msi(device_t bus, device_t dev, int count, int *irqs) +{ + return (PCIB_RELEASE_MSI(get_nexus(bus), dev, count, irqs)); +} + +static int +vmbus_alloc_msix(device_t bus, device_t dev, int *irq) +{ + return (PCIB_ALLOC_MSIX(get_nexus(bus), dev, irq)); +} + +static int +vmbus_release_msix(device_t bus, device_t dev, int irq) +{ + return (PCIB_RELEASE_MSIX(get_nexus(bus), dev, irq)); +} + +static int +vmbus_map_msi(device_t bus, device_t dev, int irq, uint64_t *addr, + uint32_t *data) +{ + return (PCIB_MAP_MSI(get_nexus(bus), dev, irq, addr, data)); +} + static uint32_t vmbus_get_version_method(device_t bus, device_t dev) { @@ -1002,6 +1099,138 @@ vmbus_get_vcpu_id_method(device_t bus, d return (VMBUS_PCPU_GET(sc, vcpuid, cpu)); } +#define VTPM_BASE_ADDR 0xfed40000 +#define FOUR_GB (1ULL << 32) + +enum parse_pass { parse_64, parse_32 }; + +struct parse_context { + device_t vmbus_dev; + enum parse_pass pass; +}; + +static ACPI_STATUS +parse_crs(ACPI_RESOURCE *res, void *ctx) +{ + const struct parse_context *pc = ctx; + device_t vmbus_dev = pc->vmbus_dev; + + struct vmbus_softc *sc = device_get_softc(vmbus_dev); + UINT64 start, end; + + switch (res->Type) { + case ACPI_RESOURCE_TYPE_ADDRESS32: + start = res->Data.Address32.Address.Minimum; + end = res->Data.Address32.Address.Maximum; + break; + + case ACPI_RESOURCE_TYPE_ADDRESS64: + start = res->Data.Address64.Address.Minimum; + end = res->Data.Address64.Address.Maximum; + break; + + default: + /* Unused types. */ + return (AE_OK); + } + + /* + * We don't use <1MB addresses. + */ + if (end < 0x100000) + return (AE_OK); + + /* Don't conflict with vTPM. */ + if (end >= VTPM_BASE_ADDR && start < VTPM_BASE_ADDR) + end = VTPM_BASE_ADDR - 1; + + if ((pc->pass == parse_32 && start < FOUR_GB) || + (pc->pass == parse_64 && start >= FOUR_GB)) + pcib_host_res_decodes(&sc->vmbus_mmio_res, SYS_RES_MEMORY, + start, end, 0); + + return (AE_OK); +} + +static void +vmbus_get_crs(device_t dev, device_t vmbus_dev, enum parse_pass pass) +{ + struct parse_context pc; + ACPI_STATUS status; + + if (bootverbose) + device_printf(dev, "walking _CRS, pass=%d\n", pass); + + pc.vmbus_dev = vmbus_dev; + pc.pass = pass; + status = AcpiWalkResources(acpi_get_handle(dev), "_CRS", + parse_crs, &pc); + + if (bootverbose && ACPI_FAILURE(status)) + device_printf(dev, "_CRS: not found, pass=%d\n", pass); +} + +static void +vmbus_get_mmio_res_pass(device_t dev, enum parse_pass pass) +{ + device_t acpi0, pcib0 = NULL; + device_t *children; + int i, count; + + /* Try to find _CRS on VMBus device */ + vmbus_get_crs(dev, dev, pass); + + /* Try to find _CRS on VMBus device's parent */ + acpi0 = device_get_parent(dev); + vmbus_get_crs(acpi0, dev, pass); + + /* Try to locate pcib0 and find _CRS on it */ + if (device_get_children(acpi0, &children, &count) != 0) + return; + + for (i = 0; i < count; i++) { + if (!device_is_attached(children[i])) + continue; + + if (strcmp("pcib0", device_get_nameunit(children[i]))) + continue; + + pcib0 = children[i]; + break; + } + + if (pcib0) + vmbus_get_crs(pcib0, dev, pass); + + free(children, M_TEMP); +} + +static void +vmbus_get_mmio_res(device_t dev) +{ + struct vmbus_softc *sc = device_get_softc(dev); + /* + * We walk the resources twice to make sure that: in the resource + * list, the 32-bit resources appear behind the 64-bit resources. + * NB: resource_list_add() uses INSERT_TAIL. This way, when we + * iterate through the list to find a range for a 64-bit BAR in + * vmbus_alloc_resource(), we can make sure we try to use >4GB + * ranges first. + */ + pcib_host_res_init(dev, &sc->vmbus_mmio_res); + + vmbus_get_mmio_res_pass(dev, parse_64); + vmbus_get_mmio_res_pass(dev, parse_32); +} + +static void +vmbus_free_mmio_res(device_t dev) +{ + struct vmbus_softc *sc = device_get_softc(dev); + + pcib_host_res_free(dev, &sc->vmbus_mmio_res); +} + static int vmbus_probe(device_t dev) { @@ -1038,6 +1267,9 @@ vmbus_doattach(struct vmbus_softc *sc) if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) return (0); + + vmbus_get_mmio_res(sc->vmbus_dev); + sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; sc->vmbus_gpadl = VMBUS_GPADL_START; @@ -1184,6 +1416,8 @@ vmbus_detach(device_t dev) mtx_destroy(&sc->vmbus_prichan_lock); mtx_destroy(&sc->vmbus_chan_lock); + vmbus_free_mmio_res(dev); + return (0); } Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Nov 16 09:02:17 2016 (r308723) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Nov 16 09:08:32 2016 (r308724) @@ -31,8 +31,11 @@ #include #include +#include #include +#include +#include /* * NOTE: DO NOT CHANGE THIS. @@ -77,6 +80,10 @@ struct vmbus_pcpu_data { struct task message_task; /* message task */ } __aligned(CACHE_LINE_SIZE); +#if __FreeBSD_version < 1100000 +typedef u_long rman_res_t; +#endif + struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); u_long *vmbus_tx_evtflags; @@ -120,6 +127,9 @@ struct vmbus_softc { /* Complete channel list */ struct mtx vmbus_chan_lock; TAILQ_HEAD(, vmbus_channel) vmbus_chans; + + /* The list of usable MMIO ranges for PCIe pass-through */ + struct pcib_host_resources vmbus_mmio_res; }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ From owner-svn-src-head@freebsd.org Wed Nov 16 09:25:01 2016 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 7FC0CC41F51; Wed, 16 Nov 2016 09:25:01 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4940B1305; Wed, 16 Nov 2016 09:25:01 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAG9P0UK059895; Wed, 16 Nov 2016 09:25:00 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAG9P040059891; Wed, 16 Nov 2016 09:25:00 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611160925.uAG9P040059891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Wed, 16 Nov 2016 09:25:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308725 - in head/sys: conf dev/hyperv/pcib modules/hyperv/pcib X-SVN-Group: head 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, 16 Nov 2016 09:25:01 -0000 Author: dexuan Date: Wed Nov 16 09:25:00 2016 New Revision: 308725 URL: https://svnweb.freebsd.org/changeset/base/308725 Log: hyperv/pcib: enable PCIe pass-through (a.k.a. Discrete Device Assignment) The feature enables us to pass through physical PCIe devices to FreeBSD VM running on Hyper-V (Windows Server 2016) to get near-native performance with low CPU utilization. The patch implements a PCI bridge driver to support the feature: 1) The pcib driver talks to the host to discover device(s) and presents the device(s) to FreeBSD's pci driver via PCI configuration space (note: to access the configuration space, we don't use the standard I/O port 0xCF8/CFC method; instead, we use an MMIO-based method supplied by Hyper-V, which is very similar to the 0xCF8/CFC method). 2) The pcib driver allocates resources for the device(s) and initialize the related BARs, when the device driver's attach method is invoked; 3) The pcib driver talks to the host to create MSI/MSI-X interrupt remapping between the guest and the host; 4) The pcib driver supports device hot add/remove. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8332 Added: head/sys/dev/hyperv/pcib/ head/sys/dev/hyperv/pcib/pcib.c (contents, props changed) head/sys/modules/hyperv/pcib/ head/sys/modules/hyperv/pcib/Makefile (contents, props changed) Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Wed Nov 16 09:08:32 2016 (r308724) +++ head/sys/conf/files.amd64 Wed Nov 16 09:25:00 2016 (r308725) @@ -292,6 +292,7 @@ dev/hwpmc/hwpmc_uncore.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc +dev/hyperv/pcib/pcib.c optional hyperv dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/if_hn.c optional hyperv Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Wed Nov 16 09:08:32 2016 (r308724) +++ head/sys/conf/files.i386 Wed Nov 16 09:25:00 2016 (r308725) @@ -249,6 +249,7 @@ dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_ppro.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc +dev/hyperv/pcib/pcib.c optional hyperv dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/if_hn.c optional hyperv Added: head/sys/dev/hyperv/pcib/pcib.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/pcib/pcib.c Wed Nov 16 09:25:00 2016 (r308725) @@ -0,0 +1,1790 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "pcib_if.h" + +#include +#include + +#include +#include +#include +#include +#include + +#include "vmbus_if.h" + +#if __FreeBSD_version < 1100000 +typedef u_long rman_res_t; +#define RM_MAX_END (~(rman_res_t)0) +#endif + +struct completion { + unsigned int done; + struct mtx lock; +}; + +static void +init_completion(struct completion *c) +{ + memset(c, 0, sizeof(*c)); + mtx_init(&c->lock, "hvcmpl", NULL, MTX_DEF); + c->done = 0; +} + +static void +free_completion(struct completion *c) +{ + mtx_destroy(&c->lock); +} + +static void +complete(struct completion *c) +{ + mtx_lock(&c->lock); + c->done++; + mtx_unlock(&c->lock); + wakeup(c); +} + +static void +wait_for_completion(struct completion *c) +{ + mtx_lock(&c->lock); + while (c->done == 0) + mtx_sleep(c, &c->lock, 0, "hvwfc", 0); + c->done--; + mtx_unlock(&c->lock); +} + +#define PCI_MAKE_VERSION(major, minor) ((uint32_t)(((major) << 16) | (major))) + +enum { + PCI_PROTOCOL_VERSION_1_1 = PCI_MAKE_VERSION(1, 1), + PCI_PROTOCOL_VERSION_CURRENT = PCI_PROTOCOL_VERSION_1_1 +}; + +#define PCI_CONFIG_MMIO_LENGTH 0x2000 +#define CFG_PAGE_OFFSET 0x1000 +#define CFG_PAGE_SIZE (PCI_CONFIG_MMIO_LENGTH - CFG_PAGE_OFFSET) + +/* + * Message Types + */ + +enum pci_message_type { + /* + * Version 1.1 + */ + PCI_MESSAGE_BASE = 0x42490000, + PCI_BUS_RELATIONS = PCI_MESSAGE_BASE + 0, + PCI_QUERY_BUS_RELATIONS = PCI_MESSAGE_BASE + 1, + PCI_POWER_STATE_CHANGE = PCI_MESSAGE_BASE + 4, + PCI_QUERY_RESOURCE_REQUIREMENTS = PCI_MESSAGE_BASE + 5, + PCI_QUERY_RESOURCE_RESOURCES = PCI_MESSAGE_BASE + 6, + PCI_BUS_D0ENTRY = PCI_MESSAGE_BASE + 7, + PCI_BUS_D0EXIT = PCI_MESSAGE_BASE + 8, + PCI_READ_BLOCK = PCI_MESSAGE_BASE + 9, + PCI_WRITE_BLOCK = PCI_MESSAGE_BASE + 0xA, + PCI_EJECT = PCI_MESSAGE_BASE + 0xB, + PCI_QUERY_STOP = PCI_MESSAGE_BASE + 0xC, + PCI_REENABLE = PCI_MESSAGE_BASE + 0xD, + PCI_QUERY_STOP_FAILED = PCI_MESSAGE_BASE + 0xE, + PCI_EJECTION_COMPLETE = PCI_MESSAGE_BASE + 0xF, + PCI_RESOURCES_ASSIGNED = PCI_MESSAGE_BASE + 0x10, + PCI_RESOURCES_RELEASED = PCI_MESSAGE_BASE + 0x11, + PCI_INVALIDATE_BLOCK = PCI_MESSAGE_BASE + 0x12, + PCI_QUERY_PROTOCOL_VERSION = PCI_MESSAGE_BASE + 0x13, + PCI_CREATE_INTERRUPT_MESSAGE = PCI_MESSAGE_BASE + 0x14, + PCI_DELETE_INTERRUPT_MESSAGE = PCI_MESSAGE_BASE + 0x15, + PCI_MESSAGE_MAXIMUM +}; + +/* + * Structures defining the virtual PCI Express protocol. + */ + +union pci_version { + struct { + uint16_t minor_version; + uint16_t major_version; + } parts; + uint32_t version; +} __packed; + +/* + * This representation is the one used in Windows, which is + * what is expected when sending this back and forth with + * the Hyper-V parent partition. + */ +union win_slot_encoding { + struct { + uint32_t slot:5; + uint32_t func:3; + uint32_t reserved:24; + } bits; + uint32_t val; +} __packed; + +struct pci_func_desc { + uint16_t v_id; /* vendor ID */ + uint16_t d_id; /* device ID */ + uint8_t rev; + uint8_t prog_intf; + uint8_t subclass; + uint8_t base_class; + uint32_t subsystem_id; + union win_slot_encoding wslot; + uint32_t ser; /* serial number */ +} __packed; + +struct hv_msi_desc { + uint8_t vector; + uint8_t delivery_mode; + uint16_t vector_count; + uint32_t reserved; + uint64_t cpu_mask; +} __packed; + +struct tran_int_desc { + uint16_t reserved; + uint16_t vector_count; + uint32_t data; + uint64_t address; +} __packed; + +struct pci_message { + uint32_t type; +} __packed; + +struct pci_child_message { + struct pci_message message_type; + union win_slot_encoding wslot; +} __packed; + +struct pci_incoming_message { + struct vmbus_chanpkt_hdr hdr; + struct pci_message message_type; +} __packed; + +struct pci_response { + struct vmbus_chanpkt_hdr hdr; + int32_t status; /* negative values are failures */ +} __packed; + +struct pci_packet { + void (*completion_func)(void *context, struct pci_response *resp, + int resp_packet_size); + void *compl_ctxt; + + struct pci_message message[0]; +}; + +/* + * Specific message types supporting the PCI protocol. + */ + +struct pci_version_request { + struct pci_message message_type; + uint32_t protocol_version; + uint32_t is_last_attempt:1; + uint32_t reservedz:31; +} __packed; + +struct pci_bus_d0_entry { + struct pci_message message_type; + uint32_t reserved; + uint64_t mmio_base; +} __packed; + +struct pci_bus_relations { + struct pci_incoming_message incoming; + uint32_t device_count; + struct pci_func_desc func[0]; +} __packed; + +#define MAX_NUM_BARS (PCIR_MAX_BAR_0 + 1) +struct pci_q_res_req_response { + struct vmbus_chanpkt_hdr hdr; + int32_t status; /* negative values are failures */ + uint32_t probed_bar[MAX_NUM_BARS]; +} __packed; + +struct pci_resources_assigned { + struct pci_message message_type; + union win_slot_encoding wslot; + uint8_t memory_range[0x14][MAX_NUM_BARS]; /* unused here */ + uint32_t msi_descriptors; + uint32_t reserved[4]; +} __packed; + +struct pci_create_interrupt { + struct pci_message message_type; + union win_slot_encoding wslot; + struct hv_msi_desc int_desc; +} __packed; + +struct pci_create_int_response { + struct pci_response response; + uint32_t reserved; + struct tran_int_desc int_desc; +} __packed; + +struct pci_delete_interrupt { + struct pci_message message_type; + union win_slot_encoding wslot; + struct tran_int_desc int_desc; +} __packed; + +struct pci_dev_incoming { + struct pci_incoming_message incoming; + union win_slot_encoding wslot; +} __packed; + +struct pci_eject_response { + struct pci_message message_type; + union win_slot_encoding wslot; + uint32_t status; +} __packed; + +/* + * Driver specific state. + */ + +enum hv_pcibus_state { + hv_pcibus_init = 0, + hv_pcibus_installed, +}; + +struct hv_pcibus { + device_t pcib; + device_t pci_bus; + struct vmbus_pcib_softc *sc; + + uint16_t pci_domain; + + enum hv_pcibus_state state; + + struct resource *cfg_res; + + struct completion query_completion, *query_comp; + + struct mtx config_lock; /* Avoid two threads writing index page */ + struct mtx device_list_lock; /* Protect lists below */ + TAILQ_HEAD(, hv_pci_dev) children; + TAILQ_HEAD(, hv_dr_state) dr_list; + + volatile int detaching; +}; + +struct hv_pci_dev { + TAILQ_ENTRY(hv_pci_dev) link; + + struct pci_func_desc desc; + + bool reported_missing; + + struct hv_pcibus *hbus; + struct task eject_task; + + TAILQ_HEAD(, hv_irq_desc) irq_desc_list; + + /* + * What would be observed if one wrote 0xFFFFFFFF to a BAR and then + * read it back, for each of the BAR offsets within config space. + */ + uint32_t probed_bar[MAX_NUM_BARS]; +}; + +/* + * Tracks "Device Relations" messages from the host, which must be both + * processed in order. + */ +struct hv_dr_work { + struct task task; + struct hv_pcibus *bus; +}; + +struct hv_dr_state { + TAILQ_ENTRY(hv_dr_state) link; + uint32_t device_count; + struct pci_func_desc func[0]; +}; + +struct hv_irq_desc { + TAILQ_ENTRY(hv_irq_desc) link; + struct tran_int_desc desc; + int irq; +}; + +#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) +#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) +#define PCI_FUNC(devfn) ((devfn) & 0x07) + +static uint32_t +devfn_to_wslot(unsigned int devfn) +{ + union win_slot_encoding wslot; + + wslot.val = 0; + wslot.bits.slot = PCI_SLOT(devfn); + wslot.bits.func = PCI_FUNC(devfn); + + return (wslot.val); +} + +static unsigned int +wslot_to_devfn(uint32_t wslot) +{ + union win_slot_encoding encoding; + unsigned int slot; + unsigned int func; + + encoding.val = wslot; + + slot = encoding.bits.slot; + func = encoding.bits.func; + + return (PCI_DEVFN(slot, func)); +} + +struct vmbus_pcib_softc { + struct vmbus_channel *chan; + void *rx_buf; + + struct taskqueue *taskq; + + struct hv_pcibus *hbus; +}; + +/* {44C4F61D-4444-4400-9D52-802E27EDE19F} */ +static const struct hyperv_guid g_pass_through_dev_type = { + .hv_guid = {0x1D, 0xF6, 0xC4, 0x44, 0x44, 0x44, 0x00, 0x44, + 0x9D, 0x52, 0x80, 0x2E, 0x27, 0xED, 0xE1, 0x9F} +}; + +struct hv_pci_compl { + struct completion host_event; + int32_t completion_status; +}; + +struct q_res_req_compl { + struct completion host_event; + struct hv_pci_dev *hpdev; +}; + +struct compose_comp_ctxt { + struct hv_pci_compl comp_pkt; + struct tran_int_desc int_desc; +}; + +static void +hv_pci_generic_compl(void *context, struct pci_response *resp, + int resp_packet_size) +{ + struct hv_pci_compl *comp_pkt = context; + + if (resp_packet_size >= sizeof(struct pci_response)) + comp_pkt->completion_status = resp->status; + else + comp_pkt->completion_status = -1; + + complete(&comp_pkt->host_event); +} + +static void +q_resource_requirements(void *context, struct pci_response *resp, + int resp_packet_size) +{ + struct q_res_req_compl *completion = context; + struct pci_q_res_req_response *q_res_req = + (struct pci_q_res_req_response *)resp; + int i; + + if (resp->status < 0) { + printf("vmbus_pcib: failed to query resource requirements\n"); + } else { + for (i = 0; i < MAX_NUM_BARS; i++) + completion->hpdev->probed_bar[i] = + q_res_req->probed_bar[i]; + } + + complete(&completion->host_event); +} + +static void +hv_pci_compose_compl(void *context, struct pci_response *resp, + int resp_packet_size) +{ + struct compose_comp_ctxt *comp_pkt = context; + struct pci_create_int_response *int_resp = + (struct pci_create_int_response *)resp; + + comp_pkt->comp_pkt.completion_status = resp->status; + comp_pkt->int_desc = int_resp->int_desc; + complete(&comp_pkt->comp_pkt.host_event); +} + +static void +hv_int_desc_free(struct hv_pci_dev *hpdev, struct hv_irq_desc *hid) +{ + struct pci_delete_interrupt *int_pkt; + struct { + struct pci_packet pkt; + uint8_t buffer[sizeof(struct pci_delete_interrupt)]; + } ctxt; + + memset(&ctxt, 0, sizeof(ctxt)); + int_pkt = (struct pci_delete_interrupt *)&ctxt.pkt.message; + int_pkt->message_type.type = PCI_DELETE_INTERRUPT_MESSAGE; + int_pkt->wslot.val = hpdev->desc.wslot.val; + int_pkt->int_desc = hid->desc; + + vmbus_chan_send(hpdev->hbus->sc->chan, VMBUS_CHANPKT_TYPE_INBAND, 0, + int_pkt, sizeof(*int_pkt), 0); + + free(hid, M_DEVBUF); +} + +static void +hv_pci_delete_device(struct hv_pci_dev *hpdev) +{ + struct hv_pcibus *hbus = hpdev->hbus; + struct hv_irq_desc *hid, *tmp_hid; + device_t pci_dev; + int devfn; + + devfn = wslot_to_devfn(hpdev->desc.wslot.val); + + mtx_lock(&Giant); + + pci_dev = pci_find_dbsf(hbus->pci_domain, + 0, PCI_SLOT(devfn), PCI_FUNC(devfn)); + if (pci_dev) + device_delete_child(hbus->pci_bus, pci_dev); + + mtx_unlock(&Giant); + + mtx_lock(&hbus->device_list_lock); + TAILQ_REMOVE(&hbus->children, hpdev, link); + mtx_unlock(&hbus->device_list_lock); + + TAILQ_FOREACH_SAFE(hid, &hpdev->irq_desc_list, link, tmp_hid) + hv_int_desc_free(hpdev, hid); + + free(hpdev, M_DEVBUF); +} + +static struct hv_pci_dev * +new_pcichild_device(struct hv_pcibus *hbus, struct pci_func_desc *desc) +{ + struct hv_pci_dev *hpdev; + struct pci_child_message *res_req; + struct q_res_req_compl comp_pkt; + struct { + struct pci_packet pkt; + uint8_t buffer[sizeof(struct pci_child_message)]; + } ctxt; + int ret; + + hpdev = malloc(sizeof(*hpdev), M_DEVBUF, M_WAITOK | M_ZERO); + hpdev->hbus = hbus; + + TAILQ_INIT(&hpdev->irq_desc_list); + + init_completion(&comp_pkt.host_event); + comp_pkt.hpdev = hpdev; + + ctxt.pkt.compl_ctxt = &comp_pkt; + ctxt.pkt.completion_func = q_resource_requirements; + + res_req = (struct pci_child_message *)&ctxt.pkt.message; + res_req->message_type.type = PCI_QUERY_RESOURCE_REQUIREMENTS; + res_req->wslot.val = desc->wslot.val; + + ret = vmbus_chan_send(hbus->sc->chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + res_req, sizeof(*res_req), (uint64_t)&ctxt.pkt); + if (ret) + goto err; + + wait_for_completion(&comp_pkt.host_event); + free_completion(&comp_pkt.host_event); + + hpdev->desc = *desc; + + mtx_lock(&hbus->device_list_lock); + TAILQ_INSERT_TAIL(&hbus->children, hpdev, link); + mtx_unlock(&hbus->device_list_lock); + return (hpdev); +err: + free_completion(&comp_pkt.host_event); + free(hpdev, M_DEVBUF); + return (NULL); +} + +#if __FreeBSD_version < 1100000 + +/* Old versions don't have BUS_RESCAN(). Let's copy it from FreeBSD 11. */ + +static struct pci_devinfo * +pci_identify_function(device_t pcib, device_t dev, int domain, int busno, + int slot, int func, size_t dinfo_size) +{ + struct pci_devinfo *dinfo; + + dinfo = pci_read_device(pcib, domain, busno, slot, func, dinfo_size); + if (dinfo != NULL) + pci_add_child(dev, dinfo); + + return (dinfo); +} + +static int +pci_rescan(device_t dev) +{ +#define REG(n, w) PCIB_READ_CONFIG(pcib, busno, s, f, n, w) + device_t pcib = device_get_parent(dev); + struct pci_softc *sc; + device_t child, *devlist, *unchanged; + int devcount, error, i, j, maxslots, oldcount; + int busno, domain, s, f, pcifunchigh; + uint8_t hdrtype; + + /* No need to check for ARI on a rescan. */ + error = device_get_children(dev, &devlist, &devcount); + if (error) + return (error); + if (devcount != 0) { + unchanged = malloc(devcount * sizeof(device_t), M_TEMP, + M_NOWAIT | M_ZERO); + if (unchanged == NULL) { + free(devlist, M_TEMP); + return (ENOMEM); + } + } else + unchanged = NULL; + + sc = device_get_softc(dev); + domain = pcib_get_domain(dev); + busno = pcib_get_bus(dev); + maxslots = PCIB_MAXSLOTS(pcib); + for (s = 0; s <= maxslots; s++) { + /* If function 0 is not present, skip to the next slot. */ + f = 0; + if (REG(PCIR_VENDOR, 2) == 0xffff) + continue; + pcifunchigh = 0; + hdrtype = REG(PCIR_HDRTYPE, 1); + if ((hdrtype & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) + continue; + if (hdrtype & PCIM_MFDEV) + pcifunchigh = PCIB_MAXFUNCS(pcib); + for (f = 0; f <= pcifunchigh; f++) { + if (REG(PCIR_VENDOR, 2) == 0xffff) + continue; + + /* + * Found a valid function. Check if a + * device_t for this device already exists. + */ + for (i = 0; i < devcount; i++) { + child = devlist[i]; + if (child == NULL) + continue; + if (pci_get_slot(child) == s && + pci_get_function(child) == f) { + unchanged[i] = child; + goto next_func; + } + } + + pci_identify_function(pcib, dev, domain, busno, s, f, + sizeof(struct pci_devinfo)); + next_func:; + } + } + + /* Remove devices that are no longer present. */ + for (i = 0; i < devcount; i++) { + if (unchanged[i] != NULL) + continue; + device_delete_child(dev, devlist[i]); + } + + free(devlist, M_TEMP); + oldcount = devcount; + + /* Try to attach the devices just added. */ + error = device_get_children(dev, &devlist, &devcount); + if (error) { + free(unchanged, M_TEMP); + return (error); + } + + for (i = 0; i < devcount; i++) { + for (j = 0; j < oldcount; j++) { + if (devlist[i] == unchanged[j]) + goto next_device; + } + + device_probe_and_attach(devlist[i]); + next_device:; + } + + free(unchanged, M_TEMP); + free(devlist, M_TEMP); + return (0); +#undef REG +} + +#else + +static int +pci_rescan(device_t dev) +{ + return (BUS_RESCAN(dev)); +} + +#endif + +static void +pci_devices_present_work(void *arg, int pending __unused) +{ + struct hv_dr_work *dr_wrk = arg; + struct hv_dr_state *dr = NULL; + struct hv_pcibus *hbus; + uint32_t child_no; + bool found; + struct pci_func_desc *new_desc; + struct hv_pci_dev *hpdev, *tmp_hpdev; + struct completion *query_comp; + bool need_rescan = false; + + hbus = dr_wrk->bus; + free(dr_wrk, M_DEVBUF); + + /* Pull this off the queue and process it if it was the last one. */ + mtx_lock(&hbus->device_list_lock); + while (!TAILQ_EMPTY(&hbus->dr_list)) { + dr = TAILQ_FIRST(&hbus->dr_list); + TAILQ_REMOVE(&hbus->dr_list, dr, link); + + /* Throw this away if the list still has stuff in it. */ + if (!TAILQ_EMPTY(&hbus->dr_list)) { + free(dr, M_DEVBUF); + continue; + } + } + mtx_unlock(&hbus->device_list_lock); + + if (!dr) + return; + + /* First, mark all existing children as reported missing. */ + mtx_lock(&hbus->device_list_lock); + TAILQ_FOREACH(hpdev, &hbus->children, link) + hpdev->reported_missing = true; + mtx_unlock(&hbus->device_list_lock); + + /* Next, add back any reported devices. */ + for (child_no = 0; child_no < dr->device_count; child_no++) { + found = false; + new_desc = &dr->func[child_no]; + + mtx_lock(&hbus->device_list_lock); + TAILQ_FOREACH(hpdev, &hbus->children, link) { + if ((hpdev->desc.wslot.val == + new_desc->wslot.val) && + (hpdev->desc.v_id == new_desc->v_id) && + (hpdev->desc.d_id == new_desc->d_id) && + (hpdev->desc.ser == new_desc->ser)) { + hpdev->reported_missing = false; + found = true; + break; + } + } + mtx_unlock(&hbus->device_list_lock); + + if (!found) { + if (!need_rescan) + need_rescan = true; + + hpdev = new_pcichild_device(hbus, new_desc); + if (!hpdev) + printf("vmbus_pcib: failed to add a child\n"); + } + } + + /* Remove missing device(s), if any */ + TAILQ_FOREACH_SAFE(hpdev, &hbus->children, link, tmp_hpdev) { + if (hpdev->reported_missing) + hv_pci_delete_device(hpdev); + } + + /* Rescan the bus to find any new device, if necessary. */ + if (hbus->state == hv_pcibus_installed && need_rescan) + pci_rescan(hbus->pci_bus); + + /* Wake up hv_pci_query_relations(), if it's waiting. */ + query_comp = hbus->query_comp; + if (query_comp) { + hbus->query_comp = NULL; + complete(query_comp); + } + + free(dr, M_DEVBUF); +} + +static struct hv_pci_dev * +get_pcichild_wslot(struct hv_pcibus *hbus, uint32_t wslot) +{ + struct hv_pci_dev *hpdev, *ret = NULL; + + mtx_lock(&hbus->device_list_lock); + TAILQ_FOREACH(hpdev, &hbus->children, link) { + if (hpdev->desc.wslot.val == wslot) { + ret = hpdev; + break; + } + } + mtx_unlock(&hbus->device_list_lock); + + return (ret); +} + +static void +hv_pci_devices_present(struct hv_pcibus *hbus, + struct pci_bus_relations *relations) +{ + struct hv_dr_state *dr; + struct hv_dr_work *dr_wrk; + unsigned long dr_size; + + if (hbus->detaching && relations->device_count > 0) + return; + + dr_size = offsetof(struct hv_dr_state, func) + + (sizeof(struct pci_func_desc) * relations->device_count); + dr = malloc(dr_size, M_DEVBUF, M_WAITOK | M_ZERO); + + dr->device_count = relations->device_count; + if (dr->device_count != 0) + memcpy(dr->func, relations->func, + sizeof(struct pci_func_desc) * dr->device_count); + + mtx_lock(&hbus->device_list_lock); + TAILQ_INSERT_TAIL(&hbus->dr_list, dr, link); + mtx_unlock(&hbus->device_list_lock); + + dr_wrk = malloc(sizeof(*dr_wrk), M_DEVBUF, M_WAITOK | M_ZERO); + dr_wrk->bus = hbus; + TASK_INIT(&dr_wrk->task, 0, pci_devices_present_work, dr_wrk); + taskqueue_enqueue(hbus->sc->taskq, &dr_wrk->task); +} + +static void +hv_eject_device_work(void *arg, int pending __unused) +{ + struct hv_pci_dev *hpdev = arg; + union win_slot_encoding wslot = hpdev->desc.wslot; + struct hv_pcibus *hbus = hpdev->hbus; + struct pci_eject_response *eject_pkt; + struct { + struct pci_packet pkt; + uint8_t buffer[sizeof(struct pci_eject_response)]; + } ctxt; + + hv_pci_delete_device(hpdev); + + memset(&ctxt, 0, sizeof(ctxt)); + eject_pkt = (struct pci_eject_response *)&ctxt.pkt.message; + eject_pkt->message_type.type = PCI_EJECTION_COMPLETE; + eject_pkt->wslot.val = wslot.val; + vmbus_chan_send(hbus->sc->chan, VMBUS_CHANPKT_TYPE_INBAND, 0, + eject_pkt, sizeof(*eject_pkt), 0); +} + +static void +hv_pci_eject_device(struct hv_pci_dev *hpdev) +{ + struct hv_pcibus *hbus = hpdev->hbus; + struct taskqueue *taskq; + + if (hbus->detaching) + return; + + /* + * Push this task into the same taskqueue on which + * vmbus_pcib_attach() runs, so we're sure this task can't run + * concurrently with vmbus_pcib_attach(). + */ + TASK_INIT(&hpdev->eject_task, 0, hv_eject_device_work, hpdev); + taskq = vmbus_chan_mgmt_tq(hbus->sc->chan); + taskqueue_enqueue(taskq, &hpdev->eject_task); +} + +#define PCIB_PACKET_SIZE 0x100 + +static void +vmbus_pcib_on_channel_callback(struct vmbus_channel *chan, void *arg) +{ + struct vmbus_pcib_softc *sc = arg; + struct hv_pcibus *hbus = sc->hbus; + + void *buffer; + int bufferlen = PCIB_PACKET_SIZE; + + struct pci_packet *comp_packet; + struct pci_response *response; + struct pci_incoming_message *new_msg; + struct pci_bus_relations *bus_rel; + struct pci_dev_incoming *dev_msg; + struct hv_pci_dev *hpdev; + + buffer = sc->rx_buf; + do { + struct vmbus_chanpkt_hdr *pkt = buffer; + uint32_t bytes_rxed; + int ret; + + bytes_rxed = bufferlen; + ret = vmbus_chan_recv_pkt(chan, pkt, &bytes_rxed); + + if (ret == ENOBUFS) { + /* Handle large packet */ + if (bufferlen > PCIB_PACKET_SIZE) { + free(buffer, M_DEVBUF); + buffer = NULL; + } + + /* alloc new buffer */ + buffer = malloc(bytes_rxed, M_DEVBUF, M_WAITOK | M_ZERO); + bufferlen = bytes_rxed; + + continue; + } + + if (ret != 0) { + /* ignore EIO or EAGAIN */ + break; + } + + if (bytes_rxed <= sizeof(struct pci_response)) + continue; + + switch (pkt->cph_type) { + case VMBUS_CHANPKT_TYPE_COMP: + comp_packet = (struct pci_packet *)pkt->cph_xactid; + response = (struct pci_response *)pkt; + comp_packet->completion_func(comp_packet->compl_ctxt, + response, bytes_rxed); + break; + case VMBUS_CHANPKT_TYPE_INBAND: + new_msg = (struct pci_incoming_message *)buffer; + + switch (new_msg->message_type.type) { + case PCI_BUS_RELATIONS: + bus_rel = (struct pci_bus_relations *)buffer; + + if (bus_rel->device_count == 0) + break; + + if (bytes_rxed < + offsetof(struct pci_bus_relations, func) + + (sizeof(struct pci_func_desc) * + (bus_rel->device_count))) + break; + + hv_pci_devices_present(hbus, bus_rel); + break; + + case PCI_EJECT: + dev_msg = (struct pci_dev_incoming *)buffer; + hpdev = get_pcichild_wslot(hbus, + dev_msg->wslot.val); + + if (hpdev) + hv_pci_eject_device(hpdev); + + break; + default: + printf("vmbus_pcib: Unknown msg type 0x%x\n", + new_msg->message_type.type); + break; + } + break; + default: + printf("vmbus_pcib: Unknown VMBus msg type %hd\n", + pkt->cph_type); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Nov 16 11:31:54 2016 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 A8B0CC4411D; Wed, 16 Nov 2016 11:31:54 +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 780CF691; Wed, 16 Nov 2016 11:31:54 +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 uAGBVrkW009598; Wed, 16 Nov 2016 11:31:53 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGBVraQ009597; Wed, 16 Nov 2016 11:31:53 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611161131.uAGBVraQ009597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 16 Nov 2016 11:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308726 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head 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, 16 Nov 2016 11:31:54 -0000 Author: andrew Date: Wed Nov 16 11:31:53 2016 New Revision: 308726 URL: https://svnweb.freebsd.org/changeset/base/308726 Log: Use the correct OF_getencprop to get the height. Reported by: jmcneill Sponsored by: ABT Systems Ltd Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Wed Nov 16 09:25:00 2016 (r308725) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Wed Nov 16 11:31:53 2016 (r308726) @@ -479,7 +479,7 @@ bcmfb_configure(int flags) } if (sc->height == 0) { - if ((OF_getprop(display, "broadcom,height", + if ((OF_getencprop(display, "broadcom,height", &cell, sizeof(cell))) > 0) sc->height = cell; } From owner-svn-src-head@freebsd.org Wed Nov 16 11:37:44 2016 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 B173AC442A6; Wed, 16 Nov 2016 11:37:44 +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 807B5A18; Wed, 16 Nov 2016 11:37:44 +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 uAGBbhnh012109; Wed, 16 Nov 2016 11:37:43 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGBbh1i012108; Wed, 16 Nov 2016 11:37:43 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611161137.uAGBbh1i012108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 16 Nov 2016 11:37:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308727 - head/sys/arm64/conf X-SVN-Group: head 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, 16 Nov 2016 11:37:44 -0000 Author: andrew Date: Wed Nov 16 11:37:43 2016 New Revision: 308727 URL: https://svnweb.freebsd.org/changeset/base/308727 Log: Include the SMSC LAN91C111 driver, this is found in some of the ARM models. Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Wed Nov 16 11:31:53 2016 (r308726) +++ head/sys/arm64/conf/GENERIC Wed Nov 16 11:37:43 2016 (r308727) @@ -121,6 +121,7 @@ device em # Intel PRO/1000 Gigabit Eth device igb # Intel PRO/1000 PCIE Server Gigabit Family device ix # Intel 10Gb Ethernet Family device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet +device smc # SMSC LAN91C111 device vnic # Cavium ThunderX NIC device al_eth # Annapurna Alpine Ethernet NIC From owner-svn-src-head@freebsd.org Wed Nov 16 13:22:58 2016 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 AF907C433C6; Wed, 16 Nov 2016 13:22:58 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66C3B3CF; Wed, 16 Nov 2016 13:22:58 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAGDMvpw055468; Wed, 16 Nov 2016 13:22:57 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGDMvKC055467; Wed, 16 Nov 2016 13:22:57 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201611161322.uAGDMvKC055467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 16 Nov 2016 13:22:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308728 - head/share/man/man4 X-SVN-Group: head 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, 16 Nov 2016 13:22:58 -0000 Author: brueffer Date: Wed Nov 16 13:22:57 2016 New Revision: 308728 URL: https://svnweb.freebsd.org/changeset/base/308728 Log: Various minor cleanups. Modified: head/share/man/man4/bnxt.4 Modified: head/share/man/man4/bnxt.4 ============================================================================== --- head/share/man/man4/bnxt.4 Wed Nov 16 11:37:43 2016 (r308727) +++ head/share/man/man4/bnxt.4 Wed Nov 16 13:22:57 2016 (r308728) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 12, 2016 +.Dd November 16, 2016 .Dt BNXT 4 .Os .Sh NAME @@ -89,7 +89,7 @@ Broadcom BCM57304 NetXtreme-C Virtual Fu Broadcom BCM57404 NetXtreme-E Virtual Function .El .Sh SYSCTL VARIABLES -These variables must be set before loading the driver, either via +These variables must be set before loading the driver, either via .Xr loader.conf 5 or through the use of .Xr kenv 1 . @@ -165,11 +165,12 @@ variables are read-only: .Bl -tag -width indent .It Va dev.bnxt.X.if_name Current interface name of the device. -This will normally be +This will normally be .Va bnxtX , but this can be changed using .Cm ifconfig name . -This sysctl allows correlating an interface with a child of dev.bnxt. +This sysctl allows correlating an interface with a child of +.Va dev.bnxt . .It Va dev.bnxt.X.nvram.* Information about the NVRAM device which contains the device firmware. .It Va dev.bnxt.X.ver.* @@ -191,10 +192,10 @@ reasons to ignore Ethernet frames. .It "bnxt%d: %s command returned %s error." Device firmware rejected a command from the driver. There might be a driver/firmware HWRM API mismatch. -.It "bnxt%d: Timeout sending %s (timeout: %d) seq %d\n" +.It "bnxt%d: Timeout sending %s (timeout: %d) seq %d" Device firmware unresponsive. A PCI device reset is likely needed. -.It "bnxt%d: Timeout sending %s (timeout: %d) msg {0x%x 0x%x} len:%d v: %d\n" +.It "bnxt%d: Timeout sending %s (timeout: %d) msg {0x%x 0x%x} len:%d v: %d" Partial firmware response. A PCI device reset is likely needed. .Pp @@ -203,20 +204,21 @@ As of this writing, the system must be r .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , +.Xr iflib 4 , .Xr netintro 4 , .Xr ng_ether 4 , .Xr vlan 4 , -.Xr ifconfig 8 , -.Xr iflib 4 +.Xr ifconfig 8 .Sh HISTORY The .Nm device driver first appeared in .Fx 12.0 . .Sh AUTHORS +.An -nosplit The .Nm driver was written by -.An Jack Vogel Aq Mt jfvogel@gmail.com . +.An Jack Vogel Aq Mt jfvogel@gmail.com , and is currently maintained by .An Stephen Hurd Aq Mt stephen.hurd@broadcom.com . From owner-svn-src-head@freebsd.org Wed Nov 16 13:27:41 2016 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 020FBC43562; Wed, 16 Nov 2016 13:27:41 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7609A2B; Wed, 16 Nov 2016 13:27:40 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAGDRd1S055933; Wed, 16 Nov 2016 13:27:39 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGDRdY1055932; Wed, 16 Nov 2016 13:27:39 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201611161327.uAGDRdY1055932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 16 Nov 2016 13:27:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308729 - head/release/doc/en_US.ISO8859-1/hardware X-SVN-Group: head 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, 16 Nov 2016 13:27:41 -0000 Author: brueffer Date: Wed Nov 16 13:27:39 2016 New Revision: 308729 URL: https://svnweb.freebsd.org/changeset/base/308729 Log: Add bnxt(4) to the hardware notes. Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Nov 16 13:22:57 2016 (r308728) +++ head/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Nov 16 13:27:39 2016 (r308729) @@ -800,6 +800,8 @@ &hwlist.bge; + &hwlist.bnxt; + &hwlist.bxe; &hwlist.cas; From owner-svn-src-head@freebsd.org Wed Nov 16 13:38:15 2016 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 AFBA9C439ED; Wed, 16 Nov 2016 13:38:15 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-31.csi.cam.ac.uk (ppsw-31.csi.cam.ac.uk [131.111.8.131]) by mx1.freebsd.org (Postfix) with ESMTP id 41E4EF26; Wed, 16 Nov 2016 13:38:14 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:62361) by ppsw-31.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.157]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1c70Pf-000FLn-LD (Exim 4.86_36-e07b163) (return-path ); Wed, 16 Nov 2016 13:38:07 +0000 Date: Wed, 16 Nov 2016 13:37:18 +0000 From: Ruslan Bukin To: Alan Cox Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-ID: <20161116133718.GA10251@bsdpad.com> References: <201611151822.uAFIMoj2092581@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201611151822.uAFIMoj2092581@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" 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, 16 Nov 2016 13:38:15 -0000 I have a panic with this on RISC-V. Any ideas ? vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv rr vvvvvvvvvvvvvvvvvvvvvv rr vvvvvvvvvvvvvvvvvvvvvvvv rr rrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrr rrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrr rrrrrrrr vvvvvvvvvvvvvvvvvv rrrrrrrr rrrrrrrrrr vvvvvvvvvvvvvv rrrrrrrrrr rrrrrrrrrrrr vvvvvvvvvv rrrrrrrrrrrr rrrrrrrrrrrrrr vvvvvv rrrrrrrrrrrrrr rrrrrrrrrrrrrrrr vv rrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr INSTRUCTION SETS WANT TO BE FREE KDB: debugger backends: ddb KDB: current backend: ddb Found 2 CPUs in the device tree Copyright (c) 1992-2016 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 12.0-CURRENT #4 0a3288b(br-riscv-isa-update)-dirty: Wed Nov 16 13:28:11 UTC 2016 rb743@vica.cl.cam.ac.uk:/home/rb743/obj/riscv.riscv64/home/rb743/dev/freebsd-riscv/sys/SPIKE riscv gcc version 6.1.0 (GCC) Preloaded elf64 kernel "kernel" at 0xffffffc0026be360. CPU(0): Unknown Implementer Unknown Processor Starting CPU 1 (0) FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs ULE: setup cpu 0 ULE: setup cpu 1 random: entropy device external interface crypto: mem: openfirm: null: nfslock: pseudo-device random: harvesting attach, 8 bytes (4 bits) from nexus0 ofwbus0: simplebus0: on ofwbus0 random: harvesting attach, 8 bytes (4 bits) from simplebus0 random: harvesting attach, 8 bytes (4 bits) from ofwbus0 timer0: mem 0x40000000-0x40000007,0x40000008-0x40001007 irq 5 on simplebus0 Timecounter "RISC-V Timecounter" frequency 1000000 Hz quality 1000 Event timer "RISC-V Eventtimer" frequency 1000000 Hz quality 1000 random: harvesting attach, 8 bytes (4 bits) from timer0 cpulist0: on ofwbus0 cpu0: on cpulist0 cpu0: missing 'clock-frequency' property riscv64_cpu0: register <0> random: harvesting attach, 8 bytes (4 bits) from riscv64_cpu0 random: harvesting attach, 8 bytes (4 bits) from cpu0 cpu1: on cpulist0 cpu1: missing 'clock-frequency' property riscv64_cpu1: register <0> random: harvesting attach, 8 bytes (4 bits) from riscv64_cpu1 random: harvesting attach, 8 bytes (4 bits) from cpu1 random: harvesting attach, 8 bytes (4 bits) from cpulist0 simplebus0: compat riscv,pic (no driver attached) rcons0: irq 1 on simplebus0 random: harvesting attach, 8 bytes (4 bits) from rcons0 cryptosoft0: crypto: assign cryptosoft0 driver id 0, flags 100663296 crypto: cryptosoft0 registers alg 1 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 2 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 3 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 4 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 5 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 16 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 6 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 7 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 18 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 19 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 20 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 8 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 15 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 9 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 10 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 13 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 14 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 11 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 22 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 23 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 25 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 24 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 26 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 27 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 28 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 21 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 17 flags 0 maxoplen 0 random: harvesting attach, 8 bytes (4 bits) from cryptosoft0 Device configuration finished. procfs registered Timecounters tick every 1.000 msec lo0: bpf attached vlan: initialized, using hash tables with chaining tcp_init: net.inet.tcp.tcbhashsize auto tuned to 8192 IPsec: Initialized Security Association Processing. t[0] == 0xffffffc00265bf50 t[1] == 0xffffffc00016494c t[2] == 0x0000000000000050 t[3] == 0x0000000000000000 t[4] == 0x0000000000000000 t[5] == 0x0000000000000000 t[6] == 0x0000000000000000 s[0] == 0xffffffc000003db0 s[1] == 0x0000000000000000 s[2] == 0xffffffc002c4c510 s[3] == 0xffffffc002cea9c0 s[4] == 0x000000000098967f s[5] == 0x00000000039386ff s[6] == 0xffffffc000574778 s[7] == 0x0000000000000000 s[8] == 0xffffffc00267c580 s[9] == 0xffffffc000531218 s[10] == 0x0000000000000412 s[11] == 0x0000000000000000 a[0] == 0x0000000000000000 a[1] == 0x0000000000000000 a[2] == 0xffffffc000531218 a[3] == 0x0000000000000412 a[4] == 0xffffffc00267c580 a[5] == 0x0000000000000002 a[6] == 0x0000000000000000 a[7] == 0x0000000000000003 sepc == 0xffffffc00013deac sstatus == 0x8000000000006100 panic: vm_fault failed: ffffffc00013deac, va 0x0000000000000018 cpuid = 0 KDB: stack backtrace: db_trace_self() at db_read_token+0x704 pc = 0xffffffc000455b44 ra = 0xffffffc0000244f8 sp = 0xffffffc000003858 fp = 0xffffffc000003a78 db_read_token() at kdb_backtrace+0x3c pc = 0xffffffc0000244f8 ra = 0xffffffc0001a5588 sp = 0xffffffc000003a78 fp = 0xffffffc000003a88 kdb_backtrace() at vpanic+0x158 pc = 0xffffffc0001a5588 ra = 0xffffffc00015bd74 sp = 0xffffffc000003a88 fp = 0xffffffc000003ac8 vpanic() at panic+0x34 pc = 0xffffffc00015bd74 ra = 0xffffffc00015c58c sp = 0xffffffc000003ac8 fp = 0xffffffc000003ae8 panic() at sysarch+0x36c pc = 0xffffffc00015c58c ra = 0xffffffc0004622b0 sp = 0xffffffc000003ae8 fp = 0xffffffc000003bf8 sysarch() at do_trap_supervisor+0xa0 pc = 0xffffffc0004622b0 ra = 0xffffffc000462498 sp = 0xffffffc000003bf8 fp = 0xffffffc000003c18 do_trap_supervisor() at cpu_exception_handler_supervisor+0xb0 pc = 0xffffffc000462498 ra = 0xffffffc000456440 sp = 0xffffffc000003c18 fp = 0xffffffc000003db0 cpu_exception_handler_supervisor() at ruxagg+0x34 pc = 0xffffffc000456440 ra = 0xffffffc000154458 sp = 0xffffffc000003db0 fp = 0xffffffc000003dd0 ruxagg() at rufetch+0x9c pc = 0xffffffc000154458 ra = 0xffffffc000154784 sp = 0xffffffc000003dd0 fp = 0xffffffc000003e00 rufetch() at exec_shell_imgact+0x1204 pc = 0xffffffc000154784 ra = 0xffffffc0000f9d4c sp = 0xffffffc000003e00 fp = 0xffffffc000003ee0 exec_shell_imgact() at mi_startup+0x190 pc = 0xffffffc0000f9d4c ra = 0xffffffc0000fa768 sp = 0xffffffc000003ee0 fp = 0xffffffc000003f20 mi_startup() at kernbase+0x248 pc = 0xffffffc0000fa768 ra = 0xffffffc000000248 sp = 0xffffffc000003f20 fp = 0x0000000085002ff8 KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped at kdb_enter+0x4c: db> Ruslan On Tue, Nov 15, 2016 at 06:22:50PM +0000, Alan Cox wrote: > Author: alc > Date: Tue Nov 15 18:22:50 2016 > New Revision: 308691 > URL: https://svnweb.freebsd.org/changeset/base/308691 > > Log: > Remove most of the code for implementing PG_CACHED pages. (This change does > not remove user-space visible fields from vm_cnt or all of the references to > cached pages from comments. Those changes will come later.) > > Reviewed by: kib, markj > Tested by: pho > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D8497 > > Modified: > head/sys/cddl/compat/opensolaris/sys/vnode.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > head/sys/fs/tmpfs/tmpfs_subr.c > head/sys/kern/kern_exec.c > head/sys/kern/uipc_shm.c > head/sys/vm/swap_pager.c > head/sys/vm/vm_fault.c > head/sys/vm/vm_mmap.c > head/sys/vm/vm_object.c > head/sys/vm/vm_object.h > head/sys/vm/vm_page.c > head/sys/vm/vm_page.h > head/sys/vm/vm_reserv.c > head/sys/vm/vm_reserv.h > head/sys/vm/vnode_pager.c > > Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h > ============================================================================== > --- head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 15 18:22:50 2016 (r308691) > @@ -75,8 +75,7 @@ vn_is_readonly(vnode_t *vp) > #define vn_mountedvfs(vp) ((vp)->v_mountedhere) > #define vn_has_cached_data(vp) \ > ((vp)->v_object != NULL && \ > - ((vp)->v_object->resident_page_count > 0 || \ > - !vm_object_cache_is_empty((vp)->v_object))) > + (vp)->v_object->resident_page_count > 0) > #define vn_exists(vp) do { } while (0) > #define vn_invalid(vp) do { } while (0) > #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0) > > 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 Nov 15 17:01:48 2016 (r308690) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -426,10 +426,6 @@ page_busy(vnode_t *vp, int64_t start, in > continue; > } > vm_page_sbusy(pp); > - } else if (pp == NULL) { > - pp = vm_page_alloc(obj, OFF_TO_IDX(start), > - VM_ALLOC_SYSTEM | VM_ALLOC_IFCACHED | > - VM_ALLOC_SBUSY); > } else { > ASSERT(pp != NULL && !pp->valid); > pp = NULL; > > Modified: head/sys/fs/tmpfs/tmpfs_subr.c > ============================================================================== > --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -1372,12 +1372,9 @@ retry: > VM_WAIT; > VM_OBJECT_WLOCK(uobj); > goto retry; > - } else if (m->valid != VM_PAGE_BITS_ALL) > - rv = vm_pager_get_pages(uobj, &m, 1, > - NULL, NULL); > - else > - /* A cached page was reactivated. */ > - rv = VM_PAGER_OK; > + } > + rv = vm_pager_get_pages(uobj, &m, 1, NULL, > + NULL); > vm_page_lock(m); > if (rv == VM_PAGER_OK) { > vm_page_deactivate(m); > > Modified: head/sys/kern/kern_exec.c > ============================================================================== > --- head/sys/kern/kern_exec.c Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/kern/kern_exec.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -1006,7 +1006,7 @@ exec_map_first_page(imgp) > break; > } else { > ma[i] = vm_page_alloc(object, i, > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > + VM_ALLOC_NORMAL); > if (ma[i] == NULL) > break; > } > > Modified: head/sys/kern/uipc_shm.c > ============================================================================== > --- head/sys/kern/uipc_shm.c Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/kern/uipc_shm.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -455,12 +455,9 @@ retry: > VM_WAIT; > VM_OBJECT_WLOCK(object); > goto retry; > - } else if (m->valid != VM_PAGE_BITS_ALL) > - rv = vm_pager_get_pages(object, &m, 1, > - NULL, NULL); > - else > - /* A cached page was reactivated. */ > - rv = VM_PAGER_OK; > + } > + rv = vm_pager_get_pages(object, &m, 1, NULL, > + NULL); > vm_page_lock(m); > if (rv == VM_PAGER_OK) { > vm_page_deactivate(m); > > Modified: head/sys/vm/swap_pager.c > ============================================================================== > --- head/sys/vm/swap_pager.c Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/vm/swap_pager.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -1126,7 +1126,7 @@ swap_pager_getpages(vm_object_t object, > if (shift != 0) { > for (i = 1; i <= shift; i++) { > p = vm_page_alloc(object, m[0]->pindex - i, > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > + VM_ALLOC_NORMAL); > if (p == NULL) { > /* Shift allocated pages to the left. */ > for (j = 0; j < i - 1; j++) > @@ -1144,8 +1144,7 @@ swap_pager_getpages(vm_object_t object, > if (rahead != NULL) { > for (i = 0; i < *rahead; i++) { > p = vm_page_alloc(object, > - m[reqcount - 1]->pindex + i + 1, > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > + m[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); > if (p == NULL) > break; > bp->b_pages[shift + reqcount + i] = p; > > Modified: head/sys/vm/vm_fault.c > ============================================================================== > --- head/sys/vm/vm_fault.c Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/vm/vm_fault.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -559,8 +559,7 @@ fast_failed: > unlock_and_deallocate(&fs); > VM_WAITPFAULT; > goto RetryFault; > - } else if (fs.m->valid == VM_PAGE_BITS_ALL) > - break; > + } > } > > readrest: > > Modified: head/sys/vm/vm_mmap.c > ============================================================================== > --- head/sys/vm/vm_mmap.c Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/vm/vm_mmap.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -877,9 +877,6 @@ RestartScan: > pindex = OFF_TO_IDX(current->offset + > (addr - current->start)); > m = vm_page_lookup(object, pindex); > - if (m == NULL && > - vm_page_is_cached(object, pindex)) > - mincoreinfo = MINCORE_INCORE; > if (m != NULL && m->valid == 0) > m = NULL; > if (m != NULL) > > Modified: head/sys/vm/vm_object.c > ============================================================================== > --- head/sys/vm/vm_object.c Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/vm/vm_object.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -178,9 +178,6 @@ vm_object_zdtor(void *mem, int size, voi > ("object %p has reservations", > object)); > #endif > - KASSERT(vm_object_cache_is_empty(object), > - ("object %p has cached pages", > - object)); > KASSERT(object->paging_in_progress == 0, > ("object %p paging_in_progress = %d", > object, object->paging_in_progress)); > @@ -212,8 +209,6 @@ vm_object_zinit(void *mem, int size, int > object->paging_in_progress = 0; > object->resident_page_count = 0; > object->shadow_count = 0; > - object->cache.rt_root = 0; > - object->cache.rt_flags = 0; > > mtx_lock(&vm_object_list_mtx); > TAILQ_INSERT_TAIL(&vm_object_list, object, object_list); > @@ -792,8 +787,6 @@ vm_object_terminate(vm_object_t object) > if (__predict_false(!LIST_EMPTY(&object->rvq))) > vm_reserv_break_all(object); > #endif > - if (__predict_false(!vm_object_cache_is_empty(object))) > - vm_page_cache_free(object, 0, 0); > > KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || > object->type == OBJT_SWAP, > @@ -1135,13 +1128,6 @@ shadowlookup: > } else if ((tobject->flags & OBJ_UNMANAGED) != 0) > goto unlock_tobject; > m = vm_page_lookup(tobject, tpindex); > - if (m == NULL && advise == MADV_WILLNEED) { > - /* > - * If the page is cached, reactivate it. > - */ > - m = vm_page_alloc(tobject, tpindex, VM_ALLOC_IFCACHED | > - VM_ALLOC_NOBUSY); > - } > if (m == NULL) { > /* > * There may be swap even if there is no backing page > @@ -1406,19 +1392,6 @@ retry: > swap_pager_copy(orig_object, new_object, offidxstart, 0); > TAILQ_FOREACH(m, &new_object->memq, listq) > vm_page_xunbusy(m); > - > - /* > - * Transfer any cached pages from orig_object to new_object. > - * If swap_pager_copy() found swapped out pages within the > - * specified range of orig_object, then it changed > - * new_object's type to OBJT_SWAP when it transferred those > - * pages to new_object. Otherwise, new_object's type > - * should still be OBJT_DEFAULT and orig_object should not > - * contain any cached pages within the specified range. > - */ > - if (__predict_false(!vm_object_cache_is_empty(orig_object))) > - vm_page_cache_transfer(orig_object, offidxstart, > - new_object); > } > VM_OBJECT_WUNLOCK(orig_object); > VM_OBJECT_WUNLOCK(new_object); > @@ -1754,13 +1727,6 @@ vm_object_collapse(vm_object_t object) > backing_object, > object, > OFF_TO_IDX(object->backing_object_offset), TRUE); > - > - /* > - * Free any cached pages from backing_object. > - */ > - if (__predict_false( > - !vm_object_cache_is_empty(backing_object))) > - vm_page_cache_free(backing_object, 0, 0); > } > /* > * Object now shadows whatever backing_object did. > @@ -1889,7 +1855,7 @@ vm_object_page_remove(vm_object_t object > (options & (OBJPR_CLEANONLY | OBJPR_NOTMAPPED)) == OBJPR_NOTMAPPED, > ("vm_object_page_remove: illegal options for object %p", object)); > if (object->resident_page_count == 0) > - goto skipmemq; > + return; > vm_object_pip_add(object, 1); > again: > p = vm_page_find_least(object, start); > @@ -1946,9 +1912,6 @@ next: > vm_page_unlock(p); > } > vm_object_pip_wakeup(object); > -skipmemq: > - if (__predict_false(!vm_object_cache_is_empty(object))) > - vm_page_cache_free(object, start, end); > } > > /* > > Modified: head/sys/vm/vm_object.h > ============================================================================== > --- head/sys/vm/vm_object.h Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/vm/vm_object.h Tue Nov 15 18:22:50 2016 (r308691) > @@ -118,7 +118,6 @@ struct vm_object { > vm_ooffset_t backing_object_offset;/* Offset in backing object */ > TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ > LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ > - struct vm_radix cache; /* (o + f) root of the cache page radix trie */ > void *handle; > union { > /* > @@ -290,13 +289,6 @@ void vm_object_pip_wakeup(vm_object_t ob > void vm_object_pip_wakeupn(vm_object_t object, short i); > void vm_object_pip_wait(vm_object_t object, char *waitid); > > -static __inline boolean_t > -vm_object_cache_is_empty(vm_object_t object) > -{ > - > - return (vm_radix_is_empty(&object->cache)); > -} > - > void umtx_shm_object_init(vm_object_t object); > void umtx_shm_object_terminated(vm_object_t object); > extern int umtx_shm_vnobj_persistent; > > Modified: head/sys/vm/vm_page.c > ============================================================================== > --- head/sys/vm/vm_page.c Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/vm/vm_page.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -154,8 +154,7 @@ static int vm_pageout_pages_needed; > > static uma_zone_t fakepg_zone; > > -static struct vnode *vm_page_alloc_init(vm_page_t m); > -static void vm_page_cache_turn_free(vm_page_t m); > +static void vm_page_alloc_check(vm_page_t m); > static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); > static void vm_page_enqueue(uint8_t queue, vm_page_t m); > static void vm_page_free_wakeup(void); > @@ -1118,9 +1117,7 @@ void > vm_page_dirty_KBI(vm_page_t m) > { > > - /* These assertions refer to this operation by its public name. */ > - KASSERT((m->flags & PG_CACHED) == 0, > - ("vm_page_dirty: page in cache!")); > + /* Refer to this operation by its public name. */ > KASSERT(m->valid == VM_PAGE_BITS_ALL, > ("vm_page_dirty: page is invalid!")); > m->dirty = VM_PAGE_BITS_ALL; > @@ -1459,142 +1456,6 @@ vm_page_rename(vm_page_t m, vm_object_t > } > > /* > - * Convert all of the given object's cached pages that have a > - * pindex within the given range into free pages. If the value > - * zero is given for "end", then the range's upper bound is > - * infinity. If the given object is backed by a vnode and it > - * transitions from having one or more cached pages to none, the > - * vnode's hold count is reduced. > - */ > -void > -vm_page_cache_free(vm_object_t object, vm_pindex_t start, vm_pindex_t end) > -{ > - vm_page_t m; > - boolean_t empty; > - > - mtx_lock(&vm_page_queue_free_mtx); > - if (__predict_false(vm_radix_is_empty(&object->cache))) { > - mtx_unlock(&vm_page_queue_free_mtx); > - return; > - } > - while ((m = vm_radix_lookup_ge(&object->cache, start)) != NULL) { > - if (end != 0 && m->pindex >= end) > - break; > - vm_radix_remove(&object->cache, m->pindex); > - vm_page_cache_turn_free(m); > - } > - empty = vm_radix_is_empty(&object->cache); > - mtx_unlock(&vm_page_queue_free_mtx); > - if (object->type == OBJT_VNODE && empty) > - vdrop(object->handle); > -} > - > -/* > - * Returns the cached page that is associated with the given > - * object and offset. If, however, none exists, returns NULL. > - * > - * The free page queue must be locked. > - */ > -static inline vm_page_t > -vm_page_cache_lookup(vm_object_t object, vm_pindex_t pindex) > -{ > - > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > - return (vm_radix_lookup(&object->cache, pindex)); > -} > - > -/* > - * Remove the given cached page from its containing object's > - * collection of cached pages. > - * > - * The free page queue must be locked. > - */ > -static void > -vm_page_cache_remove(vm_page_t m) > -{ > - > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > - KASSERT((m->flags & PG_CACHED) != 0, > - ("vm_page_cache_remove: page %p is not cached", m)); > - vm_radix_remove(&m->object->cache, m->pindex); > - m->object = NULL; > - vm_cnt.v_cache_count--; > -} > - > -/* > - * Transfer all of the cached pages with offset greater than or > - * equal to 'offidxstart' from the original object's cache to the > - * new object's cache. However, any cached pages with offset > - * greater than or equal to the new object's size are kept in the > - * original object. Initially, the new object's cache must be > - * empty. Offset 'offidxstart' in the original object must > - * correspond to offset zero in the new object. > - * > - * The new object must be locked. > - */ > -void > -vm_page_cache_transfer(vm_object_t orig_object, vm_pindex_t offidxstart, > - vm_object_t new_object) > -{ > - vm_page_t m; > - > - /* > - * Insertion into an object's collection of cached pages > - * requires the object to be locked. In contrast, removal does > - * not. > - */ > - VM_OBJECT_ASSERT_WLOCKED(new_object); > - KASSERT(vm_radix_is_empty(&new_object->cache), > - ("vm_page_cache_transfer: object %p has cached pages", > - new_object)); > - mtx_lock(&vm_page_queue_free_mtx); > - while ((m = vm_radix_lookup_ge(&orig_object->cache, > - offidxstart)) != NULL) { > - /* > - * Transfer all of the pages with offset greater than or > - * equal to 'offidxstart' from the original object's > - * cache to the new object's cache. > - */ > - if ((m->pindex - offidxstart) >= new_object->size) > - break; > - vm_radix_remove(&orig_object->cache, m->pindex); > - /* Update the page's object and offset. */ > - m->object = new_object; > - m->pindex -= offidxstart; > - if (vm_radix_insert(&new_object->cache, m)) > - vm_page_cache_turn_free(m); > - } > - mtx_unlock(&vm_page_queue_free_mtx); > -} > - > -/* > - * Returns TRUE if a cached page is associated with the given object and > - * offset, and FALSE otherwise. > - * > - * The object must be locked. > - */ > -boolean_t > -vm_page_is_cached(vm_object_t object, vm_pindex_t pindex) > -{ > - vm_page_t m; > - > - /* > - * Insertion into an object's collection of cached pages requires the > - * object to be locked. Therefore, if the object is locked and the > - * object's collection is empty, there is no need to acquire the free > - * page queues lock in order to prove that the specified page doesn't > - * exist. > - */ > - VM_OBJECT_ASSERT_WLOCKED(object); > - if (__predict_true(vm_object_cache_is_empty(object))) > - return (FALSE); > - mtx_lock(&vm_page_queue_free_mtx); > - m = vm_page_cache_lookup(object, pindex); > - mtx_unlock(&vm_page_queue_free_mtx); > - return (m != NULL); > -} > - > -/* > * vm_page_alloc: > * > * Allocate and return a page that is associated with the specified > @@ -1610,9 +1471,6 @@ vm_page_is_cached(vm_object_t object, vm > * optional allocation flags: > * VM_ALLOC_COUNT(number) the number of additional pages that the caller > * intends to allocate > - * VM_ALLOC_IFCACHED return page only if it is cached > - * VM_ALLOC_IFNOTCACHED return NULL, do not reactivate if the page > - * is cached > * VM_ALLOC_NOBUSY do not exclusive busy the page > * VM_ALLOC_NODUMP do not include the page in a kernel core dump > * VM_ALLOC_NOOBJ page is not associated with an object and > @@ -1626,8 +1484,6 @@ vm_page_is_cached(vm_object_t object, vm > vm_page_t > vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) > { > - struct vnode *vp = NULL; > - vm_object_t m_object; > vm_page_t m, mpred; > int flags, req_class; > > @@ -1670,31 +1526,12 @@ vm_page_alloc(vm_object_t object, vm_pin > * Allocate from the free queue if the number of free pages > * exceeds the minimum for the request class. > */ > - if (object != NULL && > - (m = vm_page_cache_lookup(object, pindex)) != NULL) { > - if ((req & VM_ALLOC_IFNOTCACHED) != 0) { > - mtx_unlock(&vm_page_queue_free_mtx); > - return (NULL); > - } > - if (vm_phys_unfree_page(m)) > - vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, 0); > -#if VM_NRESERVLEVEL > 0 > - else if (!vm_reserv_reactivate_page(m)) > -#else > - else > -#endif > - panic("vm_page_alloc: cache page %p is missing" > - " from the free queue", m); > - } else if ((req & VM_ALLOC_IFCACHED) != 0) { > - mtx_unlock(&vm_page_queue_free_mtx); > - return (NULL); > #if VM_NRESERVLEVEL > 0 > - } else if (object == NULL || (object->flags & (OBJ_COLORED | > + if (object == NULL || (object->flags & (OBJ_COLORED | > OBJ_FICTITIOUS)) != OBJ_COLORED || (m = > - vm_reserv_alloc_page(object, pindex, mpred)) == NULL) { > -#else > - } else { > + vm_reserv_alloc_page(object, pindex, mpred)) == NULL) > #endif > + { > m = vm_phys_alloc_pages(object != NULL ? > VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > #if VM_NRESERVLEVEL > 0 > @@ -1720,33 +1557,9 @@ vm_page_alloc(vm_object_t object, vm_pin > * At this point we had better have found a good page. > */ > KASSERT(m != NULL, ("vm_page_alloc: missing page")); > - KASSERT(m->queue == PQ_NONE, > - ("vm_page_alloc: page %p has unexpected queue %d", m, m->queue)); > - KASSERT(m->wire_count == 0, ("vm_page_alloc: page %p is wired", m)); > - KASSERT(m->hold_count == 0, ("vm_page_alloc: page %p is held", m)); > - KASSERT(!vm_page_busied(m), ("vm_page_alloc: page %p is busy", m)); > - KASSERT(m->dirty == 0, ("vm_page_alloc: page %p is dirty", m)); > - KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, > - ("vm_page_alloc: page %p has unexpected memattr %d", m, > - pmap_page_get_memattr(m))); > - if ((m->flags & PG_CACHED) != 0) { > - KASSERT((m->flags & PG_ZERO) == 0, > - ("vm_page_alloc: cached page %p is PG_ZERO", m)); > - KASSERT(m->valid != 0, > - ("vm_page_alloc: cached page %p is invalid", m)); > - if (m->object != object || m->pindex != pindex) > - m->valid = 0; > - m_object = m->object; > - vm_page_cache_remove(m); > - if (m_object->type == OBJT_VNODE && > - vm_object_cache_is_empty(m_object)) > - vp = m_object->handle; > - } else { > - KASSERT(m->valid == 0, > - ("vm_page_alloc: free page %p is valid", m)); > - vm_phys_freecnt_adj(m, -1); > - } > + vm_phys_freecnt_adj(m, -1); > mtx_unlock(&vm_page_queue_free_mtx); > + vm_page_alloc_check(m); > > /* > * Initialize the page. Only the PG_ZERO flag is inherited. > @@ -1778,9 +1591,6 @@ vm_page_alloc(vm_object_t object, vm_pin > > if (object != NULL) { > if (vm_page_insert_after(m, object, pindex, mpred)) { > - /* See the comment below about hold count. */ > - if (vp != NULL) > - vdrop(vp); > pagedaemon_wakeup(); > if (req & VM_ALLOC_WIRED) { > atomic_subtract_int(&vm_cnt.v_wire_count, 1); > @@ -1801,15 +1611,6 @@ vm_page_alloc(vm_object_t object, vm_pin > m->pindex = pindex; > > /* > - * The following call to vdrop() must come after the above call > - * to vm_page_insert() in case both affect the same object and > - * vnode. Otherwise, the affected vnode's hold count could > - * temporarily become zero. > - */ > - if (vp != NULL) > - vdrop(vp); > - > - /* > * Don't wakeup too often - wakeup the pageout daemon when > * we would be nearly out of memory. > */ > @@ -1819,16 +1620,6 @@ vm_page_alloc(vm_object_t object, vm_pin > return (m); > } > > -static void > -vm_page_alloc_contig_vdrop(struct spglist *lst) > -{ > - > - while (!SLIST_EMPTY(lst)) { > - vdrop((struct vnode *)SLIST_FIRST(lst)-> plinks.s.pv); > - SLIST_REMOVE_HEAD(lst, plinks.s.ss); > - } > -} > - > /* > * vm_page_alloc_contig: > * > @@ -1873,8 +1664,6 @@ vm_page_alloc_contig(vm_object_t object, > u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, > vm_paddr_t boundary, vm_memattr_t memattr) > { > - struct vnode *drop; > - struct spglist deferred_vdrop_list; > vm_page_t m, m_tmp, m_ret; > u_int flags; > int req_class; > @@ -1900,7 +1689,6 @@ vm_page_alloc_contig(vm_object_t object, > if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) > req_class = VM_ALLOC_SYSTEM; > > - SLIST_INIT(&deferred_vdrop_list); > mtx_lock(&vm_page_queue_free_mtx); > if (vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages + > vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && > @@ -1922,17 +1710,7 @@ retry: > return (NULL); > } > if (m_ret != NULL) > - for (m = m_ret; m < &m_ret[npages]; m++) { > - drop = vm_page_alloc_init(m); > - if (drop != NULL) { > - /* > - * Enqueue the vnode for deferred vdrop(). > - */ > - m->plinks.s.pv = drop; > - SLIST_INSERT_HEAD(&deferred_vdrop_list, m, > - plinks.s.ss); > - } > - } > + vm_phys_freecnt_adj(m_ret, -npages); > else { > #if VM_NRESERVLEVEL > 0 > if (vm_reserv_reclaim_contig(npages, low, high, alignment, > @@ -1943,6 +1721,8 @@ retry: > mtx_unlock(&vm_page_queue_free_mtx); > if (m_ret == NULL) > return (NULL); > + for (m = m_ret; m < &m_ret[npages]; m++) > + vm_page_alloc_check(m); > > /* > * Initialize the pages. Only the PG_ZERO flag is inherited. > @@ -1975,8 +1755,6 @@ retry: > m->oflags = VPO_UNMANAGED; > if (object != NULL) { > if (vm_page_insert(m, object, pindex)) { > - vm_page_alloc_contig_vdrop( > - &deferred_vdrop_list); > if (vm_paging_needed()) > pagedaemon_wakeup(); > if ((req & VM_ALLOC_WIRED) != 0) > @@ -2001,57 +1779,28 @@ retry: > pmap_page_set_memattr(m, memattr); > pindex++; > } > - vm_page_alloc_contig_vdrop(&deferred_vdrop_list); > if (vm_paging_needed()) > pagedaemon_wakeup(); > return (m_ret); > } > > /* > - * Initialize a page that has been freshly dequeued from a freelist. > - * The caller has to drop the vnode returned, if it is not NULL. > - * > - * This function may only be used to initialize unmanaged pages. > - * > - * To be called with vm_page_queue_free_mtx held. > + * Check a page that has been freshly dequeued from a freelist. > */ > -static struct vnode * > -vm_page_alloc_init(vm_page_t m) > +static void > +vm_page_alloc_check(vm_page_t m) > { > - struct vnode *drop; > - vm_object_t m_object; > > KASSERT(m->queue == PQ_NONE, > - ("vm_page_alloc_init: page %p has unexpected queue %d", > - m, m->queue)); > - KASSERT(m->wire_count == 0, > - ("vm_page_alloc_init: page %p is wired", m)); > - KASSERT(m->hold_count == 0, > - ("vm_page_alloc_init: page %p is held", m)); > - KASSERT(!vm_page_busied(m), > - ("vm_page_alloc_init: page %p is busy", m)); > - KASSERT(m->dirty == 0, > - ("vm_page_alloc_init: page %p is dirty", m)); > + ("page %p has unexpected queue %d", m, m->queue)); > + KASSERT(m->wire_count == 0, ("page %p is wired", m)); > + KASSERT(m->hold_count == 0, ("page %p is held", m)); > + KASSERT(!vm_page_busied(m), ("page %p is busy", m)); > + KASSERT(m->dirty == 0, ("page %p is dirty", m)); > KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, > - ("vm_page_alloc_init: page %p has unexpected memattr %d", > + ("page %p has unexpected memattr %d", > m, pmap_page_get_memattr(m))); > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > - drop = NULL; > - if ((m->flags & PG_CACHED) != 0) { > - KASSERT((m->flags & PG_ZERO) == 0, > - ("vm_page_alloc_init: cached page %p is PG_ZERO", m)); > - m->valid = 0; > - m_object = m->object; > - vm_page_cache_remove(m); > - if (m_object->type == OBJT_VNODE && > - vm_object_cache_is_empty(m_object)) > - drop = m_object->handle; > - } else { > - KASSERT(m->valid == 0, > - ("vm_page_alloc_init: free page %p is valid", m)); > - vm_phys_freecnt_adj(m, -1); > - } > - return (drop); > + KASSERT(m->valid == 0, ("free page %p is valid", m)); > } > > /* > @@ -2077,7 +1826,6 @@ vm_page_alloc_init(vm_page_t m) > vm_page_t > vm_page_alloc_freelist(int flind, int req) > { > - struct vnode *drop; > vm_page_t m; > u_int flags; > int req_class; > @@ -2111,8 +1859,9 @@ vm_page_alloc_freelist(int flind, int re > mtx_unlock(&vm_page_queue_free_mtx); > return (NULL); > } > - drop = vm_page_alloc_init(m); > + vm_phys_freecnt_adj(m, -1); > mtx_unlock(&vm_page_queue_free_mtx); > + vm_page_alloc_check(m); > > /* > * Initialize the page. Only the PG_ZERO flag is inherited. > @@ -2132,8 +1881,6 @@ vm_page_alloc_freelist(int flind, int re > } > /* Unmanaged pages don't use "act_count". */ > m->oflags = VPO_UNMANAGED; > - if (drop != NULL) > - vdrop(drop); > if (vm_paging_needed()) > pagedaemon_wakeup(); > return (m); > @@ -2259,38 +2006,8 @@ retry: > /* Don't care: PG_NODUMP, PG_ZERO. */ > if (object->type != OBJT_DEFAULT && > object->type != OBJT_SWAP && > - object->type != OBJT_VNODE) > + object->type != OBJT_VNODE) { > run_ext = 0; > - else if ((m->flags & PG_CACHED) != 0 || > - m != vm_page_lookup(object, m->pindex)) { > - /* > - * The page is cached or recently converted > - * from cached to free. > - */ > -#if VM_NRESERVLEVEL > 0 > - if (level >= 0) { > - /* > - * The page is reserved. Extend the > - * current run by one page. > - */ > - run_ext = 1; > - } else > -#endif > - if ((order = m->order) < VM_NFREEORDER) { > - /* > - * The page is enqueued in the > - * physical memory allocator's cache/ > - * free page queues. Moreover, it is > - * the first page in a power-of-two- > - * sized run of contiguous cache/free > - * pages. Add these pages to the end > - * of the current run, and jump > - * ahead. > - */ > - run_ext = 1 << order; > - m_inc = 1 << order; > - } else > - run_ext = 0; > #if VM_NRESERVLEVEL > 0 > } else if ((options & VPSC_NOSUPER) != 0 && > (level = vm_reserv_level_iffullpop(m)) >= 0) { > @@ -2457,15 +2174,7 @@ retry: > object->type != OBJT_SWAP && > object->type != OBJT_VNODE) > error = EINVAL; > - else if ((m->flags & PG_CACHED) != 0 || > - m != vm_page_lookup(object, m->pindex)) { > - /* > - * The page is cached or recently converted > - * from cached to free. > - */ > - VM_OBJECT_WUNLOCK(object); > - goto cached; > - } else if (object->memattr != VM_MEMATTR_DEFAULT) > + else if (object->memattr != VM_MEMATTR_DEFAULT) > error = EINVAL; > else if (m->queue != PQ_NONE && !vm_page_busied(m)) { > KASSERT(pmap_page_get_memattr(m) == > @@ -2566,7 +2275,6 @@ retry: > unlock: > VM_OBJECT_WUNLOCK(object); > } else { > -cached: > mtx_lock(&vm_page_queue_free_mtx); > order = m->order; > if (order < VM_NFREEORDER) { > @@ -2964,27 +2672,6 @@ vm_page_free_wakeup(void) > } > > /* > - * Turn a cached page into a free page, by changing its attributes. > - * Keep the statistics up-to-date. > - * > - * The free page queue must be locked. > - */ > -static void > -vm_page_cache_turn_free(vm_page_t m) > -{ > - > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > - > - m->object = NULL; > - m->valid = 0; > - KASSERT((m->flags & PG_CACHED) != 0, > - ("vm_page_cache_turn_free: page %p is not cached", m)); > - m->flags &= ~PG_CACHED; > - vm_cnt.v_cache_count--; > - vm_phys_freecnt_adj(m, 1); > -} > - > -/* > * vm_page_free_toq: > * > * Returns the given page to the free list, > @@ -3383,8 +3070,7 @@ retrylookup: > VM_WAIT; > VM_OBJECT_WLOCK(object); > goto retrylookup; > - } else if (m->valid != 0) > - return (m); > + } > if (allocflags & VM_ALLOC_ZERO && (m->flags & PG_ZERO) == 0) > pmap_zero_page(m); > return (m); > > Modified: head/sys/vm/vm_page.h > ============================================================================== > --- head/sys/vm/vm_page.h Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/vm/vm_page.h Tue Nov 15 18:22:50 2016 (r308691) > @@ -326,7 +326,6 @@ extern struct mtx_padalign pa_lock[]; > * Page flags. If changed at any other time than page allocation or > * freeing, the modification must be protected by the vm_page lock. > */ > -#define PG_CACHED 0x0001 /* page is cached */ > #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ > #define PG_ZERO 0x0008 /* page is zeroed */ > #define PG_MARKER 0x0010 /* special queue marker page */ > @@ -409,8 +408,6 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa) > #define VM_ALLOC_ZERO 0x0040 /* (acfg) Try to obtain a zeroed page */ > #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ > #define VM_ALLOC_NOBUSY 0x0200 /* (acg) Do not busy the page */ > -#define VM_ALLOC_IFCACHED 0x0400 /* (ag) Fail if page is not cached */ > -#define VM_ALLOC_IFNOTCACHED 0x0800 /* (ag) Fail if page is cached */ > #define VM_ALLOC_IGN_SBUSY 0x1000 /* (g) 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 */ > @@ -453,8 +450,6 @@ vm_page_t vm_page_alloc_contig(vm_object > 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_cache_free(vm_object_t, vm_pindex_t, vm_pindex_t); > -void vm_page_cache_transfer(vm_object_t, vm_pindex_t, vm_object_t); > int vm_page_try_to_free (vm_page_t); > void vm_page_deactivate (vm_page_t); > void vm_page_deactivate_noreuse(vm_page_t); > @@ -464,7 +459,6 @@ vm_page_t vm_page_find_least(vm_object_t > vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); > void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); > int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); > -boolean_t vm_page_is_cached(vm_object_t object, vm_pindex_t pindex); > void vm_page_launder(vm_page_t m); > vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); > vm_page_t vm_page_next(vm_page_t m); > > Modified: head/sys/vm/vm_reserv.c > ============================================================================== > --- head/sys/vm/vm_reserv.c Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/vm/vm_reserv.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -908,45 +908,6 @@ vm_reserv_level_iffullpop(vm_page_t m) > } > > /* > - * Prepare for the reactivation of a cached page. > - * > - * First, suppose that the given page "m" was allocated individually, i.e., not > - * as part of a reservation, and cached. Then, suppose a reservation > - * containing "m" is allocated by the same object. Although "m" and the > - * reservation belong to the same object, "m"'s pindex may not match the > - * reservation's. > - * > - * The free page queue must be locked. > - */ > -boolean_t > -vm_reserv_reactivate_page(vm_page_t m) > -{ > - vm_reserv_t rv; > - int index; > - > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > - rv = vm_reserv_from_page(m); > - if (rv->object == NULL) > - return (FALSE); > - KASSERT((m->flags & PG_CACHED) != 0, > - ("vm_reserv_reactivate_page: page %p is not cached", m)); > - if (m->object == rv->object && > - m->pindex - rv->pindex == (index = VM_RESERV_INDEX(m->object, > - m->pindex))) > - vm_reserv_populate(rv, index); > - else { > - KASSERT(rv->inpartpopq, > - ("vm_reserv_reactivate_page: reserv %p's inpartpopq is FALSE", > - rv)); > - TAILQ_REMOVE(&vm_rvq_partpop, rv, partpopq); > - rv->inpartpopq = FALSE; > - /* Don't release "m" to the physical memory allocator. */ > - vm_reserv_break(rv, m); > - } > - return (TRUE); > -} > - > -/* > * Breaks the given partially-populated reservation, releasing its cached and > * free pages to the physical memory allocator. > * > > Modified: head/sys/vm/vm_reserv.h > ============================================================================== > --- head/sys/vm/vm_reserv.h Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/vm/vm_reserv.h Tue Nov 15 18:22:50 2016 (r308691) > @@ -56,7 +56,6 @@ void vm_reserv_init(void); > bool vm_reserv_is_page_free(vm_page_t m); > int vm_reserv_level(vm_page_t m); > int vm_reserv_level_iffullpop(vm_page_t m); > -boolean_t vm_reserv_reactivate_page(vm_page_t m); > boolean_t vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, > vm_paddr_t high, u_long alignment, vm_paddr_t boundary); > boolean_t vm_reserv_reclaim_inactive(void); > > Modified: head/sys/vm/vnode_pager.c > ============================================================================== > --- head/sys/vm/vnode_pager.c Tue Nov 15 17:01:48 2016 (r308690) > +++ head/sys/vm/vnode_pager.c Tue Nov 15 18:22:50 2016 (r308691) > @@ -466,10 +466,6 @@ vnode_pager_setsize(struct vnode *vp, vm > * replacement from working properly. > */ > vm_page_clear_dirty(m, base, PAGE_SIZE - base); > - } else if ((nsize & PAGE_MASK) && > - vm_page_is_cached(object, OFF_TO_IDX(nsize))) { > - vm_page_cache_free(object, OFF_TO_IDX(nsize), > - nobjsize); > } > } > object->un_pager.vnp.vnp_size = nsize; > @@ -894,8 +890,7 @@ vnode_pager_generic_getpages(struct vnod > for (tpindex = m[0]->pindex - 1; > tpindex >= startpindex && tpindex < m[0]->pindex; > tpindex--, i++) { > - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | > - VM_ALLOC_IFNOTCACHED); > + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); > if (p == NULL) { > /* Shift the array. */ > for (int j = 0; j < i; j++) > @@ -932,8 +927,7 @@ vnode_pager_generic_getpages(struct vnod > > for (tpindex = m[count - 1]->pindex + 1; > tpindex < endpindex; i++, tpindex++) { > - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | > - VM_ALLOC_IFNOTCACHED); > + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); > if (p == NULL) > break; > bp->b_pages[i] = p; > From owner-svn-src-head@freebsd.org Wed Nov 16 14:03:17 2016 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 63D06C450E1; Wed, 16 Nov 2016 14:03:17 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-31.csi.cam.ac.uk (ppsw-31.csi.cam.ac.uk [131.111.8.131]) by mx1.freebsd.org (Postfix) with ESMTP id DCFDA1BBB; Wed, 16 Nov 2016 14:03:16 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:61896) by ppsw-31.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.157]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1c70nz-000sv5-Lr (Exim 4.86_36-e07b163) (return-path ); Wed, 16 Nov 2016 14:03:15 +0000 Date: Wed, 16 Nov 2016 14:02:27 +0000 From: Ruslan Bukin To: Alan Cox Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-ID: <20161116140227.GA10455@bsdpad.com> References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161116133718.GA10251@bsdpad.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" 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, 16 Nov 2016 14:03:17 -0000 Forgot to mention that we are using 32mb mdroot. Removing mdroot from kernel config makes it more happy: crypto: cryptosoft0 registers alg 26 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 27 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 28 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 21 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 17 flags 0 maxoplen 0 random: harvesting attach, 8 bytes (4 bits) from cryptosoft0 Device configuration finished. procfs registered Timecounters tick every 1.000 msec lo0: bpf attached vlan: initialized, using hash tables with chaining tcp_init: net.inet.tcp.tcbhashsize auto tuned to 8192 IPsec: Initialized Security Association Processing. Release APs CPU(1): Unknown Implementer Unknown Processor Trying to mount root from ufs:/dev/md0 []... mountroot: waiting for device /dev/md0... Mounting from ufs:/dev/md0 failed with error 19. Loader variables: Manual root filesystem specification: : [options] Mount using filesystem and with the specified (optional) option list. eg. ufs:/dev/da0s1a zfs:tank cd9660:/dev/cd0 ro (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /) ? List valid disk boot devices . Yield 1 second (for background tasks) Abort manual input mountroot> Ruslan On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: > I have a panic with this on RISC-V. Any ideas ? > > vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv > vvvvvvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv > rr vvvvvvvvvvvvvvvvvvvvvv > rr vvvvvvvvvvvvvvvvvvvvvvvv rr > rrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrr > rrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrr > rrrrrrrr vvvvvvvvvvvvvvvvvv rrrrrrrr > rrrrrrrrrr vvvvvvvvvvvvvv rrrrrrrrrr > rrrrrrrrrrrr vvvvvvvvvv rrrrrrrrrrrr > rrrrrrrrrrrrrr vvvvvv rrrrrrrrrrrrrr > rrrrrrrrrrrrrrrr vv rrrrrrrrrrrrrrrr > rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr > rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr > rrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr > > INSTRUCTION SETS WANT TO BE FREE > KDB: debugger backends: ddb > KDB: current backend: ddb > Found 2 CPUs in the device tree > Copyright (c) 1992-2016 The FreeBSD Project. > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 > The Regents of the University of California. All rights reserved. > FreeBSD is a registered trademark of The FreeBSD Foundation. > FreeBSD 12.0-CURRENT #4 0a3288b(br-riscv-isa-update)-dirty: Wed Nov 16 13:28:11 UTC 2016 > rb743@vica.cl.cam.ac.uk:/home/rb743/obj/riscv.riscv64/home/rb743/dev/freebsd-riscv/sys/SPIKE riscv > gcc version 6.1.0 (GCC) > Preloaded elf64 kernel "kernel" at 0xffffffc0026be360. > CPU(0): Unknown Implementer Unknown Processor > Starting CPU 1 (0) > FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs > ULE: setup cpu 0 > ULE: setup cpu 1 > random: entropy device external interface > crypto: > mem: > openfirm: > null: > nfslock: pseudo-device > random: harvesting attach, 8 bytes (4 bits) from nexus0 > ofwbus0: > simplebus0: on ofwbus0 > random: harvesting attach, 8 bytes (4 bits) from simplebus0 > random: harvesting attach, 8 bytes (4 bits) from ofwbus0 > timer0: mem 0x40000000-0x40000007,0x40000008-0x40001007 irq 5 on simplebus0 > Timecounter "RISC-V Timecounter" frequency 1000000 Hz quality 1000 > Event timer "RISC-V Eventtimer" frequency 1000000 Hz quality 1000 > random: harvesting attach, 8 bytes (4 bits) from timer0 > cpulist0: on ofwbus0 > cpu0: on cpulist0 > cpu0: missing 'clock-frequency' property > riscv64_cpu0: register <0> > random: harvesting attach, 8 bytes (4 bits) from riscv64_cpu0 > random: harvesting attach, 8 bytes (4 bits) from cpu0 > cpu1: on cpulist0 > cpu1: missing 'clock-frequency' property > riscv64_cpu1: register <0> > random: harvesting attach, 8 bytes (4 bits) from riscv64_cpu1 > random: harvesting attach, 8 bytes (4 bits) from cpu1 > random: harvesting attach, 8 bytes (4 bits) from cpulist0 > simplebus0: compat riscv,pic (no driver attached) > rcons0: irq 1 on simplebus0 > random: harvesting attach, 8 bytes (4 bits) from rcons0 > cryptosoft0: > crypto: assign cryptosoft0 driver id 0, flags 100663296 > crypto: cryptosoft0 registers alg 1 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 2 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 3 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 4 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 5 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 16 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 6 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 7 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 18 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 19 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 20 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 8 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 15 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 9 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 10 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 13 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 14 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 11 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 22 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 23 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 25 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 24 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 26 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 27 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 28 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 21 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 17 flags 0 maxoplen 0 > random: harvesting attach, 8 bytes (4 bits) from cryptosoft0 > Device configuration finished. > procfs registered > Timecounters tick every 1.000 msec > lo0: bpf attached > vlan: initialized, using hash tables with chaining > tcp_init: net.inet.tcp.tcbhashsize auto tuned to 8192 > IPsec: Initialized Security Association Processing. > t[0] == 0xffffffc00265bf50 > t[1] == 0xffffffc00016494c > t[2] == 0x0000000000000050 > t[3] == 0x0000000000000000 > t[4] == 0x0000000000000000 > t[5] == 0x0000000000000000 > t[6] == 0x0000000000000000 > s[0] == 0xffffffc000003db0 > s[1] == 0x0000000000000000 > s[2] == 0xffffffc002c4c510 > s[3] == 0xffffffc002cea9c0 > s[4] == 0x000000000098967f > s[5] == 0x00000000039386ff > s[6] == 0xffffffc000574778 > s[7] == 0x0000000000000000 > s[8] == 0xffffffc00267c580 > s[9] == 0xffffffc000531218 > s[10] == 0x0000000000000412 > s[11] == 0x0000000000000000 > a[0] == 0x0000000000000000 > a[1] == 0x0000000000000000 > a[2] == 0xffffffc000531218 > a[3] == 0x0000000000000412 > a[4] == 0xffffffc00267c580 > a[5] == 0x0000000000000002 > a[6] == 0x0000000000000000 > a[7] == 0x0000000000000003 > sepc == 0xffffffc00013deac > sstatus == 0x8000000000006100 > panic: vm_fault failed: ffffffc00013deac, va 0x0000000000000018 > cpuid = 0 > KDB: stack backtrace: > db_trace_self() at db_read_token+0x704 > pc = 0xffffffc000455b44 ra = 0xffffffc0000244f8 > sp = 0xffffffc000003858 fp = 0xffffffc000003a78 > > db_read_token() at kdb_backtrace+0x3c > pc = 0xffffffc0000244f8 ra = 0xffffffc0001a5588 > sp = 0xffffffc000003a78 fp = 0xffffffc000003a88 > > kdb_backtrace() at vpanic+0x158 > pc = 0xffffffc0001a5588 ra = 0xffffffc00015bd74 > sp = 0xffffffc000003a88 fp = 0xffffffc000003ac8 > > vpanic() at panic+0x34 > pc = 0xffffffc00015bd74 ra = 0xffffffc00015c58c > sp = 0xffffffc000003ac8 fp = 0xffffffc000003ae8 > > panic() at sysarch+0x36c > pc = 0xffffffc00015c58c ra = 0xffffffc0004622b0 > sp = 0xffffffc000003ae8 fp = 0xffffffc000003bf8 > > sysarch() at do_trap_supervisor+0xa0 > pc = 0xffffffc0004622b0 ra = 0xffffffc000462498 > sp = 0xffffffc000003bf8 fp = 0xffffffc000003c18 > > do_trap_supervisor() at cpu_exception_handler_supervisor+0xb0 > pc = 0xffffffc000462498 ra = 0xffffffc000456440 > sp = 0xffffffc000003c18 fp = 0xffffffc000003db0 > > cpu_exception_handler_supervisor() at ruxagg+0x34 > pc = 0xffffffc000456440 ra = 0xffffffc000154458 > sp = 0xffffffc000003db0 fp = 0xffffffc000003dd0 > > ruxagg() at rufetch+0x9c > pc = 0xffffffc000154458 ra = 0xffffffc000154784 > sp = 0xffffffc000003dd0 fp = 0xffffffc000003e00 > > rufetch() at exec_shell_imgact+0x1204 > pc = 0xffffffc000154784 ra = 0xffffffc0000f9d4c > sp = 0xffffffc000003e00 fp = 0xffffffc000003ee0 > > exec_shell_imgact() at mi_startup+0x190 > pc = 0xffffffc0000f9d4c ra = 0xffffffc0000fa768 > sp = 0xffffffc000003ee0 fp = 0xffffffc000003f20 > > mi_startup() at kernbase+0x248 > pc = 0xffffffc0000fa768 ra = 0xffffffc000000248 > sp = 0xffffffc000003f20 fp = 0x0000000085002ff8 > > KDB: enter: panic > [ thread pid 0 tid 100000 ] > Stopped at kdb_enter+0x4c: > db> > > Ruslan > > On Tue, Nov 15, 2016 at 06:22:50PM +0000, Alan Cox wrote: > > Author: alc > > Date: Tue Nov 15 18:22:50 2016 > > New Revision: 308691 > > URL: https://svnweb.freebsd.org/changeset/base/308691 > > > > Log: > > Remove most of the code for implementing PG_CACHED pages. (This change does > > not remove user-space visible fields from vm_cnt or all of the references to > > cached pages from comments. Those changes will come later.) > > > > Reviewed by: kib, markj > > Tested by: pho > > Sponsored by: Dell EMC Isilon > > Differential Revision: https://reviews.freebsd.org/D8497 > > > > Modified: > > head/sys/cddl/compat/opensolaris/sys/vnode.h > > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > > head/sys/fs/tmpfs/tmpfs_subr.c > > head/sys/kern/kern_exec.c > > head/sys/kern/uipc_shm.c > > head/sys/vm/swap_pager.c > > head/sys/vm/vm_fault.c > > head/sys/vm/vm_mmap.c > > head/sys/vm/vm_object.c > > head/sys/vm/vm_object.h > > head/sys/vm/vm_page.c > > head/sys/vm/vm_page.h > > head/sys/vm/vm_reserv.c > > head/sys/vm/vm_reserv.h > > head/sys/vm/vnode_pager.c > > > > Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h > > ============================================================================== > > --- head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 15 18:22:50 2016 (r308691) > > @@ -75,8 +75,7 @@ vn_is_readonly(vnode_t *vp) > > #define vn_mountedvfs(vp) ((vp)->v_mountedhere) > > #define vn_has_cached_data(vp) \ > > ((vp)->v_object != NULL && \ > > - ((vp)->v_object->resident_page_count > 0 || \ > > - !vm_object_cache_is_empty((vp)->v_object))) > > + (vp)->v_object->resident_page_count > 0) > > #define vn_exists(vp) do { } while (0) > > #define vn_invalid(vp) do { } while (0) > > #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0) > > > > 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 Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -426,10 +426,6 @@ page_busy(vnode_t *vp, int64_t start, in > > continue; > > } > > vm_page_sbusy(pp); > > - } else if (pp == NULL) { > > - pp = vm_page_alloc(obj, OFF_TO_IDX(start), > > - VM_ALLOC_SYSTEM | VM_ALLOC_IFCACHED | > > - VM_ALLOC_SBUSY); > > } else { > > ASSERT(pp != NULL && !pp->valid); > > pp = NULL; > > > > Modified: head/sys/fs/tmpfs/tmpfs_subr.c > > ============================================================================== > > --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -1372,12 +1372,9 @@ retry: > > VM_WAIT; > > VM_OBJECT_WLOCK(uobj); > > goto retry; > > - } else if (m->valid != VM_PAGE_BITS_ALL) > > - rv = vm_pager_get_pages(uobj, &m, 1, > > - NULL, NULL); > > - else > > - /* A cached page was reactivated. */ > > - rv = VM_PAGER_OK; > > + } > > + rv = vm_pager_get_pages(uobj, &m, 1, NULL, > > + NULL); > > vm_page_lock(m); > > if (rv == VM_PAGER_OK) { > > vm_page_deactivate(m); > > > > Modified: head/sys/kern/kern_exec.c > > ============================================================================== > > --- head/sys/kern/kern_exec.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/kern/kern_exec.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -1006,7 +1006,7 @@ exec_map_first_page(imgp) > > break; > > } else { > > ma[i] = vm_page_alloc(object, i, > > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > > + VM_ALLOC_NORMAL); > > if (ma[i] == NULL) > > break; > > } > > > > Modified: head/sys/kern/uipc_shm.c > > ============================================================================== > > --- head/sys/kern/uipc_shm.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/kern/uipc_shm.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -455,12 +455,9 @@ retry: > > VM_WAIT; > > VM_OBJECT_WLOCK(object); > > goto retry; > > - } else if (m->valid != VM_PAGE_BITS_ALL) > > - rv = vm_pager_get_pages(object, &m, 1, > > - NULL, NULL); > > - else > > - /* A cached page was reactivated. */ > > - rv = VM_PAGER_OK; > > + } > > + rv = vm_pager_get_pages(object, &m, 1, NULL, > > + NULL); > > vm_page_lock(m); > > if (rv == VM_PAGER_OK) { > > vm_page_deactivate(m); > > > > Modified: head/sys/vm/swap_pager.c > > ============================================================================== > > --- head/sys/vm/swap_pager.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/swap_pager.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -1126,7 +1126,7 @@ swap_pager_getpages(vm_object_t object, > > if (shift != 0) { > > for (i = 1; i <= shift; i++) { > > p = vm_page_alloc(object, m[0]->pindex - i, > > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > > + VM_ALLOC_NORMAL); > > if (p == NULL) { > > /* Shift allocated pages to the left. */ > > for (j = 0; j < i - 1; j++) > > @@ -1144,8 +1144,7 @@ swap_pager_getpages(vm_object_t object, > > if (rahead != NULL) { > > for (i = 0; i < *rahead; i++) { > > p = vm_page_alloc(object, > > - m[reqcount - 1]->pindex + i + 1, > > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > > + m[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); > > if (p == NULL) > > break; > > bp->b_pages[shift + reqcount + i] = p; > > > > Modified: head/sys/vm/vm_fault.c > > ============================================================================== > > --- head/sys/vm/vm_fault.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_fault.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -559,8 +559,7 @@ fast_failed: > > unlock_and_deallocate(&fs); > > VM_WAITPFAULT; > > goto RetryFault; > > - } else if (fs.m->valid == VM_PAGE_BITS_ALL) > > - break; > > + } > > } > > > > readrest: > > > > Modified: head/sys/vm/vm_mmap.c > > ============================================================================== > > --- head/sys/vm/vm_mmap.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_mmap.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -877,9 +877,6 @@ RestartScan: > > pindex = OFF_TO_IDX(current->offset + > > (addr - current->start)); > > m = vm_page_lookup(object, pindex); > > - if (m == NULL && > > - vm_page_is_cached(object, pindex)) > > - mincoreinfo = MINCORE_INCORE; > > if (m != NULL && m->valid == 0) > > m = NULL; > > if (m != NULL) > > > > Modified: head/sys/vm/vm_object.c > > ============================================================================== > > --- head/sys/vm/vm_object.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_object.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -178,9 +178,6 @@ vm_object_zdtor(void *mem, int size, voi > > ("object %p has reservations", > > object)); > > #endif > > - KASSERT(vm_object_cache_is_empty(object), > > - ("object %p has cached pages", > > - object)); > > KASSERT(object->paging_in_progress == 0, > > ("object %p paging_in_progress = %d", > > object, object->paging_in_progress)); > > @@ -212,8 +209,6 @@ vm_object_zinit(void *mem, int size, int > > object->paging_in_progress = 0; > > object->resident_page_count = 0; > > object->shadow_count = 0; > > - object->cache.rt_root = 0; > > - object->cache.rt_flags = 0; > > > > mtx_lock(&vm_object_list_mtx); > > TAILQ_INSERT_TAIL(&vm_object_list, object, object_list); > > @@ -792,8 +787,6 @@ vm_object_terminate(vm_object_t object) > > if (__predict_false(!LIST_EMPTY(&object->rvq))) > > vm_reserv_break_all(object); > > #endif > > - if (__predict_false(!vm_object_cache_is_empty(object))) > > - vm_page_cache_free(object, 0, 0); > > > > KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || > > object->type == OBJT_SWAP, > > @@ -1135,13 +1128,6 @@ shadowlookup: > > } else if ((tobject->flags & OBJ_UNMANAGED) != 0) > > goto unlock_tobject; > > m = vm_page_lookup(tobject, tpindex); > > - if (m == NULL && advise == MADV_WILLNEED) { > > - /* > > - * If the page is cached, reactivate it. > > - */ > > - m = vm_page_alloc(tobject, tpindex, VM_ALLOC_IFCACHED | > > - VM_ALLOC_NOBUSY); > > - } > > if (m == NULL) { > > /* > > * There may be swap even if there is no backing page > > @@ -1406,19 +1392,6 @@ retry: > > swap_pager_copy(orig_object, new_object, offidxstart, 0); > > TAILQ_FOREACH(m, &new_object->memq, listq) > > vm_page_xunbusy(m); > > - > > - /* > > - * Transfer any cached pages from orig_object to new_object. > > - * If swap_pager_copy() found swapped out pages within the > > - * specified range of orig_object, then it changed > > - * new_object's type to OBJT_SWAP when it transferred those > > - * pages to new_object. Otherwise, new_object's type > > - * should still be OBJT_DEFAULT and orig_object should not > > - * contain any cached pages within the specified range. > > - */ > > - if (__predict_false(!vm_object_cache_is_empty(orig_object))) > > - vm_page_cache_transfer(orig_object, offidxstart, > > - new_object); > > } > > VM_OBJECT_WUNLOCK(orig_object); > > VM_OBJECT_WUNLOCK(new_object); > > @@ -1754,13 +1727,6 @@ vm_object_collapse(vm_object_t object) > > backing_object, > > object, > > OFF_TO_IDX(object->backing_object_offset), TRUE); > > - > > - /* > > - * Free any cached pages from backing_object. > > - */ > > - if (__predict_false( > > - !vm_object_cache_is_empty(backing_object))) > > - vm_page_cache_free(backing_object, 0, 0); > > } > > /* > > * Object now shadows whatever backing_object did. > > @@ -1889,7 +1855,7 @@ vm_object_page_remove(vm_object_t object > > (options & (OBJPR_CLEANONLY | OBJPR_NOTMAPPED)) == OBJPR_NOTMAPPED, > > ("vm_object_page_remove: illegal options for object %p", object)); > > if (object->resident_page_count == 0) > > - goto skipmemq; > > + return; > > vm_object_pip_add(object, 1); > > again: > > p = vm_page_find_least(object, start); > > @@ -1946,9 +1912,6 @@ next: > > vm_page_unlock(p); > > } > > vm_object_pip_wakeup(object); > > -skipmemq: > > - if (__predict_false(!vm_object_cache_is_empty(object))) > > - vm_page_cache_free(object, start, end); > > } > > > > /* > > > > Modified: head/sys/vm/vm_object.h > > ============================================================================== > > --- head/sys/vm/vm_object.h Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_object.h Tue Nov 15 18:22:50 2016 (r308691) > > @@ -118,7 +118,6 @@ struct vm_object { > > vm_ooffset_t backing_object_offset;/* Offset in backing object */ > > TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ > > LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ > > - struct vm_radix cache; /* (o + f) root of the cache page radix trie */ > > void *handle; > > union { > > /* > > @@ -290,13 +289,6 @@ void vm_object_pip_wakeup(vm_object_t ob > > void vm_object_pip_wakeupn(vm_object_t object, short i); > > void vm_object_pip_wait(vm_object_t object, char *waitid); > > > > -static __inline boolean_t > > -vm_object_cache_is_empty(vm_object_t object) > > -{ > > - > > - return (vm_radix_is_empty(&object->cache)); > > -} > > - > > void umtx_shm_object_init(vm_object_t object); > > void umtx_shm_object_terminated(vm_object_t object); > > extern int umtx_shm_vnobj_persistent; > > > > Modified: head/sys/vm/vm_page.c > > ============================================================================== > > --- head/sys/vm/vm_page.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_page.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -154,8 +154,7 @@ static int vm_pageout_pages_needed; > > > > static uma_zone_t fakepg_zone; > > > > -static struct vnode *vm_page_alloc_init(vm_page_t m); > > -static void vm_page_cache_turn_free(vm_page_t m); > > +static void vm_page_alloc_check(vm_page_t m); > > static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); > > static void vm_page_enqueue(uint8_t queue, vm_page_t m); > > static void vm_page_free_wakeup(void); > > @@ -1118,9 +1117,7 @@ void > > vm_page_dirty_KBI(vm_page_t m) > > { > > > > - /* These assertions refer to this operation by its public name. */ > > - KASSERT((m->flags & PG_CACHED) == 0, > > - ("vm_page_dirty: page in cache!")); > > + /* Refer to this operation by its public name. */ > > KASSERT(m->valid == VM_PAGE_BITS_ALL, > > ("vm_page_dirty: page is invalid!")); > > m->dirty = VM_PAGE_BITS_ALL; > > @@ -1459,142 +1456,6 @@ vm_page_rename(vm_page_t m, vm_object_t > > } > > > > /* > > - * Convert all of the given object's cached pages that have a > > - * pindex within the given range into free pages. If the value > > - * zero is given for "end", then the range's upper bound is > > - * infinity. If the given object is backed by a vnode and it > > - * transitions from having one or more cached pages to none, the > > - * vnode's hold count is reduced. > > - */ > > -void > > -vm_page_cache_free(vm_object_t object, vm_pindex_t start, vm_pindex_t end) > > -{ > > - vm_page_t m; > > - boolean_t empty; > > - > > - mtx_lock(&vm_page_queue_free_mtx); > > - if (__predict_false(vm_radix_is_empty(&object->cache))) { > > - mtx_unlock(&vm_page_queue_free_mtx); > > - return; > > - } > > - while ((m = vm_radix_lookup_ge(&object->cache, start)) != NULL) { > > - if (end != 0 && m->pindex >= end) > > - break; > > - vm_radix_remove(&object->cache, m->pindex); > > - vm_page_cache_turn_free(m); > > - } > > - empty = vm_radix_is_empty(&object->cache); > > - mtx_unlock(&vm_page_queue_free_mtx); > > - if (object->type == OBJT_VNODE && empty) > > - vdrop(object->handle); > > -} > > - > > -/* > > - * Returns the cached page that is associated with the given > > - * object and offset. If, however, none exists, returns NULL. > > - * > > - * The free page queue must be locked. > > - */ > > -static inline vm_page_t > > -vm_page_cache_lookup(vm_object_t object, vm_pindex_t pindex) > > -{ > > - > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > - return (vm_radix_lookup(&object->cache, pindex)); > > -} > > - > > -/* > > - * Remove the given cached page from its containing object's > > - * collection of cached pages. > > - * > > - * The free page queue must be locked. > > - */ > > -static void > > -vm_page_cache_remove(vm_page_t m) > > -{ > > - > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > - KASSERT((m->flags & PG_CACHED) != 0, > > - ("vm_page_cache_remove: page %p is not cached", m)); > > - vm_radix_remove(&m->object->cache, m->pindex); > > - m->object = NULL; > > - vm_cnt.v_cache_count--; > > -} > > - > > -/* > > - * Transfer all of the cached pages with offset greater than or > > - * equal to 'offidxstart' from the original object's cache to the > > - * new object's cache. However, any cached pages with offset > > - * greater than or equal to the new object's size are kept in the > > - * original object. Initially, the new object's cache must be > > - * empty. Offset 'offidxstart' in the original object must > > - * correspond to offset zero in the new object. > > - * > > - * The new object must be locked. > > - */ > > -void > > -vm_page_cache_transfer(vm_object_t orig_object, vm_pindex_t offidxstart, > > - vm_object_t new_object) > > -{ > > - vm_page_t m; > > - > > - /* > > - * Insertion into an object's collection of cached pages > > - * requires the object to be locked. In contrast, removal does > > - * not. > > - */ > > - VM_OBJECT_ASSERT_WLOCKED(new_object); > > - KASSERT(vm_radix_is_empty(&new_object->cache), > > - ("vm_page_cache_transfer: object %p has cached pages", > > - new_object)); > > - mtx_lock(&vm_page_queue_free_mtx); > > - while ((m = vm_radix_lookup_ge(&orig_object->cache, > > - offidxstart)) != NULL) { > > - /* > > - * Transfer all of the pages with offset greater than or > > - * equal to 'offidxstart' from the original object's > > - * cache to the new object's cache. > > - */ > > - if ((m->pindex - offidxstart) >= new_object->size) > > - break; > > - vm_radix_remove(&orig_object->cache, m->pindex); > > - /* Update the page's object and offset. */ > > - m->object = new_object; > > - m->pindex -= offidxstart; > > - if (vm_radix_insert(&new_object->cache, m)) > > - vm_page_cache_turn_free(m); > > - } > > - mtx_unlock(&vm_page_queue_free_mtx); > > -} > > - > > -/* > > - * Returns TRUE if a cached page is associated with the given object and > > - * offset, and FALSE otherwise. > > - * > > - * The object must be locked. > > - */ > > -boolean_t > > -vm_page_is_cached(vm_object_t object, vm_pindex_t pindex) > > -{ > > - vm_page_t m; > > - > > - /* > > - * Insertion into an object's collection of cached pages requires the > > - * object to be locked. Therefore, if the object is locked and the > > - * object's collection is empty, there is no need to acquire the free > > - * page queues lock in order to prove that the specified page doesn't > > - * exist. > > - */ > > - VM_OBJECT_ASSERT_WLOCKED(object); > > - if (__predict_true(vm_object_cache_is_empty(object))) > > - return (FALSE); > > - mtx_lock(&vm_page_queue_free_mtx); > > - m = vm_page_cache_lookup(object, pindex); > > - mtx_unlock(&vm_page_queue_free_mtx); > > - return (m != NULL); > > -} > > - > > -/* > > * vm_page_alloc: > > * > > * Allocate and return a page that is associated with the specified > > @@ -1610,9 +1471,6 @@ vm_page_is_cached(vm_object_t object, vm > > * optional allocation flags: > > * VM_ALLOC_COUNT(number) the number of additional pages that the caller > > * intends to allocate > > - * VM_ALLOC_IFCACHED return page only if it is cached > > - * VM_ALLOC_IFNOTCACHED return NULL, do not reactivate if the page > > - * is cached > > * VM_ALLOC_NOBUSY do not exclusive busy the page > > * VM_ALLOC_NODUMP do not include the page in a kernel core dump > > * VM_ALLOC_NOOBJ page is not associated with an object and > > @@ -1626,8 +1484,6 @@ vm_page_is_cached(vm_object_t object, vm > > vm_page_t > > vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) > > { > > - struct vnode *vp = NULL; > > - vm_object_t m_object; > > vm_page_t m, mpred; > > int flags, req_class; > > > > @@ -1670,31 +1526,12 @@ vm_page_alloc(vm_object_t object, vm_pin > > * Allocate from the free queue if the number of free pages > > * exceeds the minimum for the request class. > > */ > > - if (object != NULL && > > - (m = vm_page_cache_lookup(object, pindex)) != NULL) { > > - if ((req & VM_ALLOC_IFNOTCACHED) != 0) { > > - mtx_unlock(&vm_page_queue_free_mtx); > > - return (NULL); > > - } > > - if (vm_phys_unfree_page(m)) > > - vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, 0); > > -#if VM_NRESERVLEVEL > 0 > > - else if (!vm_reserv_reactivate_page(m)) > > -#else > > - else > > -#endif > > - panic("vm_page_alloc: cache page %p is missing" > > - " from the free queue", m); > > - } else if ((req & VM_ALLOC_IFCACHED) != 0) { > > - mtx_unlock(&vm_page_queue_free_mtx); > > - return (NULL); > > #if VM_NRESERVLEVEL > 0 > > - } else if (object == NULL || (object->flags & (OBJ_COLORED | > > + if (object == NULL || (object->flags & (OBJ_COLORED | > > OBJ_FICTITIOUS)) != OBJ_COLORED || (m = > > - vm_reserv_alloc_page(object, pindex, mpred)) == NULL) { > > -#else > > - } else { > > + vm_reserv_alloc_page(object, pindex, mpred)) == NULL) > > #endif > > + { > > m = vm_phys_alloc_pages(object != NULL ? > > VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > > #if VM_NRESERVLEVEL > 0 > > @@ -1720,33 +1557,9 @@ vm_page_alloc(vm_object_t object, vm_pin > > * At this point we had better have found a good page. > > */ > > KASSERT(m != NULL, ("vm_page_alloc: missing page")); > > - KASSERT(m->queue == PQ_NONE, > > - ("vm_page_alloc: page %p has unexpected queue %d", m, m->queue)); > > - KASSERT(m->wire_count == 0, ("vm_page_alloc: page %p is wired", m)); > > - KASSERT(m->hold_count == 0, ("vm_page_alloc: page %p is held", m)); > > - KASSERT(!vm_page_busied(m), ("vm_page_alloc: page %p is busy", m)); > > - KASSERT(m->dirty == 0, ("vm_page_alloc: page %p is dirty", m)); > > - KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, > > - ("vm_page_alloc: page %p has unexpected memattr %d", m, > > - pmap_page_get_memattr(m))); > > - if ((m->flags & PG_CACHED) != 0) { > > - KASSERT((m->flags & PG_ZERO) == 0, > > - ("vm_page_alloc: cached page %p is PG_ZERO", m)); > > - KASSERT(m->valid != 0, > > - ("vm_page_alloc: cached page %p is invalid", m)); > > - if (m->object != object || m->pindex != pindex) > > - m->valid = 0; > > - m_object = m->object; > > - vm_page_cache_remove(m); > > - if (m_object->type == OBJT_VNODE && > > - vm_object_cache_is_empty(m_object)) > > - vp = m_object->handle; > > - } else { > > - KASSERT(m->valid == 0, > > - ("vm_page_alloc: free page %p is valid", m)); > > - vm_phys_freecnt_adj(m, -1); > > - } > > + vm_phys_freecnt_adj(m, -1); > > mtx_unlock(&vm_page_queue_free_mtx); > > + vm_page_alloc_check(m); > > > > /* > > * Initialize the page. Only the PG_ZERO flag is inherited. > > @@ -1778,9 +1591,6 @@ vm_page_alloc(vm_object_t object, vm_pin > > > > if (object != NULL) { > > if (vm_page_insert_after(m, object, pindex, mpred)) { > > - /* See the comment below about hold count. */ > > - if (vp != NULL) > > - vdrop(vp); > > pagedaemon_wakeup(); > > if (req & VM_ALLOC_WIRED) { > > atomic_subtract_int(&vm_cnt.v_wire_count, 1); > > @@ -1801,15 +1611,6 @@ vm_page_alloc(vm_object_t object, vm_pin > > m->pindex = pindex; > > > > /* > > - * The following call to vdrop() must come after the above call > > - * to vm_page_insert() in case both affect the same object and > > - * vnode. Otherwise, the affected vnode's hold count could > > - * temporarily become zero. > > - */ > > - if (vp != NULL) > > - vdrop(vp); > > - > > - /* > > * Don't wakeup too often - wakeup the pageout daemon when > > * we would be nearly out of memory. > > */ > > @@ -1819,16 +1620,6 @@ vm_page_alloc(vm_object_t object, vm_pin > > return (m); > > } > > > > -static void > > -vm_page_alloc_contig_vdrop(struct spglist *lst) > > -{ > > - > > - while (!SLIST_EMPTY(lst)) { > > - vdrop((struct vnode *)SLIST_FIRST(lst)-> plinks.s.pv); > > - SLIST_REMOVE_HEAD(lst, plinks.s.ss); > > - } > > -} > > - > > /* > > * vm_page_alloc_contig: > > * > > @@ -1873,8 +1664,6 @@ vm_page_alloc_contig(vm_object_t object, > > u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, > > vm_paddr_t boundary, vm_memattr_t memattr) > > { > > - struct vnode *drop; > > - struct spglist deferred_vdrop_list; > > vm_page_t m, m_tmp, m_ret; > > u_int flags; > > int req_class; > > @@ -1900,7 +1689,6 @@ vm_page_alloc_contig(vm_object_t object, > > if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) > > req_class = VM_ALLOC_SYSTEM; > > > > - SLIST_INIT(&deferred_vdrop_list); > > mtx_lock(&vm_page_queue_free_mtx); > > if (vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages + > > vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && > > @@ -1922,17 +1710,7 @@ retry: > > return (NULL); > > } > > if (m_ret != NULL) > > - for (m = m_ret; m < &m_ret[npages]; m++) { > > - drop = vm_page_alloc_init(m); > > - if (drop != NULL) { > > - /* > > - * Enqueue the vnode for deferred vdrop(). > > - */ > > - m->plinks.s.pv = drop; > > - SLIST_INSERT_HEAD(&deferred_vdrop_list, m, > > - plinks.s.ss); > > - } > > - } > > + vm_phys_freecnt_adj(m_ret, -npages); > > else { > > #if VM_NRESERVLEVEL > 0 > > if (vm_reserv_reclaim_contig(npages, low, high, alignment, > > @@ -1943,6 +1721,8 @@ retry: > > mtx_unlock(&vm_page_queue_free_mtx); > > if (m_ret == NULL) > > return (NULL); > > + for (m = m_ret; m < &m_ret[npages]; m++) > > + vm_page_alloc_check(m); > > > > /* > > * Initialize the pages. Only the PG_ZERO flag is inherited. > > @@ -1975,8 +1755,6 @@ retry: > > m->oflags = VPO_UNMANAGED; > > if (object != NULL) { > > if (vm_page_insert(m, object, pindex)) { > > - vm_page_alloc_contig_vdrop( > > - &deferred_vdrop_list); > > if (vm_paging_needed()) > > pagedaemon_wakeup(); > > if ((req & VM_ALLOC_WIRED) != 0) > > @@ -2001,57 +1779,28 @@ retry: > > pmap_page_set_memattr(m, memattr); > > pindex++; > > } > > - vm_page_alloc_contig_vdrop(&deferred_vdrop_list); > > if (vm_paging_needed()) > > pagedaemon_wakeup(); > > return (m_ret); > > } > > > > /* > > - * Initialize a page that has been freshly dequeued from a freelist. > > - * The caller has to drop the vnode returned, if it is not NULL. > > - * > > - * This function may only be used to initialize unmanaged pages. > > - * > > - * To be called with vm_page_queue_free_mtx held. > > + * Check a page that has been freshly dequeued from a freelist. > > */ > > -static struct vnode * > > -vm_page_alloc_init(vm_page_t m) > > +static void > > +vm_page_alloc_check(vm_page_t m) > > { > > - struct vnode *drop; > > - vm_object_t m_object; > > > > KASSERT(m->queue == PQ_NONE, > > - ("vm_page_alloc_init: page %p has unexpected queue %d", > > - m, m->queue)); > > - KASSERT(m->wire_count == 0, > > - ("vm_page_alloc_init: page %p is wired", m)); > > - KASSERT(m->hold_count == 0, > > - ("vm_page_alloc_init: page %p is held", m)); > > - KASSERT(!vm_page_busied(m), > > - ("vm_page_alloc_init: page %p is busy", m)); > > - KASSERT(m->dirty == 0, > > - ("vm_page_alloc_init: page %p is dirty", m)); > > + ("page %p has unexpected queue %d", m, m->queue)); > > + KASSERT(m->wire_count == 0, ("page %p is wired", m)); > > + KASSERT(m->hold_count == 0, ("page %p is held", m)); > > + KASSERT(!vm_page_busied(m), ("page %p is busy", m)); > > + KASSERT(m->dirty == 0, ("page %p is dirty", m)); > > KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, > > - ("vm_page_alloc_init: page %p has unexpected memattr %d", > > + ("page %p has unexpected memattr %d", > > m, pmap_page_get_memattr(m))); > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > - drop = NULL; > > - if ((m->flags & PG_CACHED) != 0) { > > - KASSERT((m->flags & PG_ZERO) == 0, > > - ("vm_page_alloc_init: cached page %p is PG_ZERO", m)); > > - m->valid = 0; > > - m_object = m->object; > > - vm_page_cache_remove(m); > > - if (m_object->type == OBJT_VNODE && > > - vm_object_cache_is_empty(m_object)) > > - drop = m_object->handle; > > - } else { > > - KASSERT(m->valid == 0, > > - ("vm_page_alloc_init: free page %p is valid", m)); > > - vm_phys_freecnt_adj(m, -1); > > - } > > - return (drop); > > + KASSERT(m->valid == 0, ("free page %p is valid", m)); > > } > > > > /* > > @@ -2077,7 +1826,6 @@ vm_page_alloc_init(vm_page_t m) > > vm_page_t > > vm_page_alloc_freelist(int flind, int req) > > { > > - struct vnode *drop; > > vm_page_t m; > > u_int flags; > > int req_class; > > @@ -2111,8 +1859,9 @@ vm_page_alloc_freelist(int flind, int re > > mtx_unlock(&vm_page_queue_free_mtx); > > return (NULL); > > } > > - drop = vm_page_alloc_init(m); > > + vm_phys_freecnt_adj(m, -1); > > mtx_unlock(&vm_page_queue_free_mtx); > > + vm_page_alloc_check(m); > > > > /* > > * Initialize the page. Only the PG_ZERO flag is inherited. > > @@ -2132,8 +1881,6 @@ vm_page_alloc_freelist(int flind, int re > > } > > /* Unmanaged pages don't use "act_count". */ > > m->oflags = VPO_UNMANAGED; > > - if (drop != NULL) > > - vdrop(drop); > > if (vm_paging_needed()) > > pagedaemon_wakeup(); > > return (m); > > @@ -2259,38 +2006,8 @@ retry: > > /* Don't care: PG_NODUMP, PG_ZERO. */ > > if (object->type != OBJT_DEFAULT && > > object->type != OBJT_SWAP && > > - object->type != OBJT_VNODE) > > + object->type != OBJT_VNODE) { > > run_ext = 0; > > - else if ((m->flags & PG_CACHED) != 0 || > > - m != vm_page_lookup(object, m->pindex)) { > > - /* > > - * The page is cached or recently converted > > - * from cached to free. > > - */ > > -#if VM_NRESERVLEVEL > 0 > > - if (level >= 0) { > > - /* > > - * The page is reserved. Extend the > > - * current run by one page. > > - */ > > - run_ext = 1; > > - } else > > -#endif > > - if ((order = m->order) < VM_NFREEORDER) { > > - /* > > - * The page is enqueued in the > > - * physical memory allocator's cache/ > > - * free page queues. Moreover, it is > > - * the first page in a power-of-two- > > - * sized run of contiguous cache/free > > - * pages. Add these pages to the end > > - * of the current run, and jump > > - * ahead. > > - */ > > - run_ext = 1 << order; > > - m_inc = 1 << order; > > - } else > > - run_ext = 0; > > #if VM_NRESERVLEVEL > 0 > > } else if ((options & VPSC_NOSUPER) != 0 && > > (level = vm_reserv_level_iffullpop(m)) >= 0) { > > @@ -2457,15 +2174,7 @@ retry: > > object->type != OBJT_SWAP && > > object->type != OBJT_VNODE) > > error = EINVAL; > > - else if ((m->flags & PG_CACHED) != 0 || > > - m != vm_page_lookup(object, m->pindex)) { > > - /* > > - * The page is cached or recently converted > > - * from cached to free. > > - */ > > - VM_OBJECT_WUNLOCK(object); > > - goto cached; > > - } else if (object->memattr != VM_MEMATTR_DEFAULT) > > + else if (object->memattr != VM_MEMATTR_DEFAULT) > > error = EINVAL; > > else if (m->queue != PQ_NONE && !vm_page_busied(m)) { > > KASSERT(pmap_page_get_memattr(m) == > > @@ -2566,7 +2275,6 @@ retry: > > unlock: > > VM_OBJECT_WUNLOCK(object); > > } else { > > -cached: > > mtx_lock(&vm_page_queue_free_mtx); > > order = m->order; > > if (order < VM_NFREEORDER) { > > @@ -2964,27 +2672,6 @@ vm_page_free_wakeup(void) > > } > > > > /* > > - * Turn a cached page into a free page, by changing its attributes. > > - * Keep the statistics up-to-date. > > - * > > - * The free page queue must be locked. > > - */ > > -static void > > -vm_page_cache_turn_free(vm_page_t m) > > -{ > > - > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > - > > - m->object = NULL; > > - m->valid = 0; > > - KASSERT((m->flags & PG_CACHED) != 0, > > - ("vm_page_cache_turn_free: page %p is not cached", m)); > > - m->flags &= ~PG_CACHED; > > - vm_cnt.v_cache_count--; > > - vm_phys_freecnt_adj(m, 1); > > -} > > - > > -/* > > * vm_page_free_toq: > > * > > * Returns the given page to the free list, > > @@ -3383,8 +3070,7 @@ retrylookup: > > VM_WAIT; > > VM_OBJECT_WLOCK(object); > > goto retrylookup; > > - } else if (m->valid != 0) > > - return (m); > > + } > > if (allocflags & VM_ALLOC_ZERO && (m->flags & PG_ZERO) == 0) > > pmap_zero_page(m); > > return (m); > > > > Modified: head/sys/vm/vm_page.h > > ============================================================================== > > --- head/sys/vm/vm_page.h Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_page.h Tue Nov 15 18:22:50 2016 (r308691) > > @@ -326,7 +326,6 @@ extern struct mtx_padalign pa_lock[]; > > * Page flags. If changed at any other time than page allocation or > > * freeing, the modification must be protected by the vm_page lock. > > */ > > -#define PG_CACHED 0x0001 /* page is cached */ > > #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ > > #define PG_ZERO 0x0008 /* page is zeroed */ > > #define PG_MARKER 0x0010 /* special queue marker page */ > > @@ -409,8 +408,6 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa) > > #define VM_ALLOC_ZERO 0x0040 /* (acfg) Try to obtain a zeroed page */ > > #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ > > #define VM_ALLOC_NOBUSY 0x0200 /* (acg) Do not busy the page */ > > -#define VM_ALLOC_IFCACHED 0x0400 /* (ag) Fail if page is not cached */ > > -#define VM_ALLOC_IFNOTCACHED 0x0800 /* (ag) Fail if page is cached */ > > #define VM_ALLOC_IGN_SBUSY 0x1000 /* (g) 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 */ > > @@ -453,8 +450,6 @@ vm_page_t vm_page_alloc_contig(vm_object > > 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_cache_free(vm_object_t, vm_pindex_t, vm_pindex_t); > > -void vm_page_cache_transfer(vm_object_t, vm_pindex_t, vm_object_t); > > int vm_page_try_to_free (vm_page_t); > > void vm_page_deactivate (vm_page_t); > > void vm_page_deactivate_noreuse(vm_page_t); > > @@ -464,7 +459,6 @@ vm_page_t vm_page_find_least(vm_object_t > > vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); > > void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); > > int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); > > -boolean_t vm_page_is_cached(vm_object_t object, vm_pindex_t pindex); > > void vm_page_launder(vm_page_t m); > > vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); > > vm_page_t vm_page_next(vm_page_t m); > > > > Modified: head/sys/vm/vm_reserv.c > > ============================================================================== > > --- head/sys/vm/vm_reserv.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_reserv.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -908,45 +908,6 @@ vm_reserv_level_iffullpop(vm_page_t m) > > } > > > > /* > > - * Prepare for the reactivation of a cached page. > > - * > > - * First, suppose that the given page "m" was allocated individually, i.e., not > > - * as part of a reservation, and cached. Then, suppose a reservation > > - * containing "m" is allocated by the same object. Although "m" and the > > - * reservation belong to the same object, "m"'s pindex may not match the > > - * reservation's. > > - * > > - * The free page queue must be locked. > > - */ > > -boolean_t > > -vm_reserv_reactivate_page(vm_page_t m) > > -{ > > - vm_reserv_t rv; > > - int index; > > - > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > - rv = vm_reserv_from_page(m); > > - if (rv->object == NULL) > > - return (FALSE); > > - KASSERT((m->flags & PG_CACHED) != 0, > > - ("vm_reserv_reactivate_page: page %p is not cached", m)); > > - if (m->object == rv->object && > > - m->pindex - rv->pindex == (index = VM_RESERV_INDEX(m->object, > > - m->pindex))) > > - vm_reserv_populate(rv, index); > > - else { > > - KASSERT(rv->inpartpopq, > > - ("vm_reserv_reactivate_page: reserv %p's inpartpopq is FALSE", > > - rv)); > > - TAILQ_REMOVE(&vm_rvq_partpop, rv, partpopq); > > - rv->inpartpopq = FALSE; > > - /* Don't release "m" to the physical memory allocator. */ > > - vm_reserv_break(rv, m); > > - } > > - return (TRUE); > > -} > > - > > -/* > > * Breaks the given partially-populated reservation, releasing its cached and > > * free pages to the physical memory allocator. > > * > > > > Modified: head/sys/vm/vm_reserv.h > > ============================================================================== > > --- head/sys/vm/vm_reserv.h Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_reserv.h Tue Nov 15 18:22:50 2016 (r308691) > > @@ -56,7 +56,6 @@ void vm_reserv_init(void); > > bool vm_reserv_is_page_free(vm_page_t m); > > int vm_reserv_level(vm_page_t m); > > int vm_reserv_level_iffullpop(vm_page_t m); > > -boolean_t vm_reserv_reactivate_page(vm_page_t m); > > boolean_t vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, > > vm_paddr_t high, u_long alignment, vm_paddr_t boundary); > > boolean_t vm_reserv_reclaim_inactive(void); > > > > Modified: head/sys/vm/vnode_pager.c > > ============================================================================== > > --- head/sys/vm/vnode_pager.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vnode_pager.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -466,10 +466,6 @@ vnode_pager_setsize(struct vnode *vp, vm > > * replacement from working properly. > > */ > > vm_page_clear_dirty(m, base, PAGE_SIZE - base); > > - } else if ((nsize & PAGE_MASK) && > > - vm_page_is_cached(object, OFF_TO_IDX(nsize))) { > > - vm_page_cache_free(object, OFF_TO_IDX(nsize), > > - nobjsize); > > } > > } > > object->un_pager.vnp.vnp_size = nsize; > > @@ -894,8 +890,7 @@ vnode_pager_generic_getpages(struct vnod > > for (tpindex = m[0]->pindex - 1; > > tpindex >= startpindex && tpindex < m[0]->pindex; > > tpindex--, i++) { > > - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | > > - VM_ALLOC_IFNOTCACHED); > > + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); > > if (p == NULL) { > > /* Shift the array. */ > > for (int j = 0; j < i; j++) > > @@ -932,8 +927,7 @@ vnode_pager_generic_getpages(struct vnod > > > > for (tpindex = m[count - 1]->pindex + 1; > > tpindex < endpindex; i++, tpindex++) { > > - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | > > - VM_ALLOC_IFNOTCACHED); > > + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); > > if (p == NULL) > > break; > > bp->b_pages[i] = p; > > > From owner-svn-src-head@freebsd.org Wed Nov 16 14:11:30 2016 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 A9E31C4558C; Wed, 16 Nov 2016 14:11:30 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-31.csi.cam.ac.uk (ppsw-31.csi.cam.ac.uk [131.111.8.131]) by mx1.freebsd.org (Postfix) with ESMTP id 1562C3F8; Wed, 16 Nov 2016 14:11:29 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:65374) by ppsw-31.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.157]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1c70vx-0007Hw-JX (Exim 4.86_36-e07b163) (return-path ); Wed, 16 Nov 2016 14:11:29 +0000 Date: Wed, 16 Nov 2016 14:10:40 +0000 From: Ruslan Bukin To: Alan Cox Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-ID: <20161116141040.GA10509@bsdpad.com> References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> <20161116140227.GA10455@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161116140227.GA10455@bsdpad.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" 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, 16 Nov 2016 14:11:30 -0000 BTW single core kernel works fine: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv rr vvvvvvvvvvvvvvvvvvvvvv rr vvvvvvvvvvvvvvvvvvvvvvvv rr rrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrr rrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrr rrrrrrrr vvvvvvvvvvvvvvvvvv rrrrrrrr rrrrrrrrrr vvvvvvvvvvvvvv rrrrrrrrrr rrrrrrrrrrrr vvvvvvvvvv rrrrrrrrrrrr rrrrrrrrrrrrrr vvvvvv rrrrrrrrrrrrrr rrrrrrrrrrrrrrrr vv rrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr INSTRUCTION SETS WANT TO BE FREE KDB: debugger backends: ddb KDB: current backend: ddb Found 1 CPUs in the device tree Copyright (c) 1992-2016 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 12.0-CURRENT #8 8e49d4e(br-riscv-isa-update)-dirty: Wed Nov 16 14:08:14 UTC 2016 rb743@vica.cl.cam.ac.uk:/home/rb743/obj/riscv.riscv64/home/rb743/dev/freebsd-riscv/sys/SPIKE riscv gcc version 6.1.0 (GCC) Preloaded elf64 kernel "kernel" at 0xffffffc0026be2e0. CPU(0): Unknown Implementer Unknown Processor ULE: setup cpu 0 random: entropy device external interface crypto: mem: openfirm: null: nfslock: pseudo-device random: harvesting attach, 8 bytes (4 bits) from nexus0 ofwbus0: simplebus0: on ofwbus0 random: harvesting attach, 8 bytes (4 bits) from simplebus0 random: harvesting attach, 8 bytes (4 bits) from ofwbus0 timer0: mem 0x40000000-0x40000007,0x40000008-0x40001007 irq 5 on simplebus0 Timecounter "RISC-V Timecounter" frequency 1000000 Hz quality 1000 Event timer "RISC-V Eventtimer" frequency 1000000 Hz quality 1000 random: harvesting attach, 8 bytes (4 bits) from timer0 cpulist0: on ofwbus0 cpu0: on cpulist0 cpu0: missing 'clock-frequency' property riscv64_cpu0: register <0> random: harvesting attach, 8 bytes (4 bits) from riscv64_cpu0 random: harvesting attach, 8 bytes (4 bits) from cpu0 random: harvesting attach, 8 bytes (4 bits) from cpulist0 simplebus0: compat riscv,pic (no driver attached) rcons0: irq 1 on simplebus0 random: harvesting attach, 8 bytes (4 bits) from rcons0 cryptosoft0: crypto: assign cryptosoft0 driver id 0, flags 100663296 crypto: cryptosoft0 registers alg 1 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 2 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 3 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 4 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 5 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 16 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 6 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 7 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 18 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 19 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 20 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 8 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 15 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 9 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 10 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 13 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 14 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 11 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 22 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 23 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 25 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 24 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 26 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 27 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 28 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 21 flags 0 maxoplen 0 crypto: cryptosoft0 registers alg 17 flags 0 maxoplen 0 random: harvesting attach, 8 bytes (4 bits) from cryptosoft0 Device configuration finished. procfs registered Timecounters tick every 1.000 msec lo0: bpf attached vlan: initialized, using hash tables with chaining tcp_init: net.inet.tcp.tcbhashsize auto tuned to 8192 IPsec: Initialized Security Association Processing. Trying to mount root from ufs:/dev/md0 []... md0: Embedded image 33554432 bytes at 0xffffffc0006598c0 warning: no time-of-day clock registered, system time will not be set accurately start_init: trying /sbin/init Nov 16 12:32:13 init: login_getclass: unknown class 'daemon' sh: cannot open /etc/rc: No such file or directory Enter full pathname of shell or RETURN for /bin/sh: Cannot read termcap database; using dumb terminal settings. # uname -a FreeBSD 12.0-CURRENT FreeBSD 12.0-CURRENT #8 8e49d4e(br-riscv-isa-update)-dirty: Wed Nov 16 14:08:14 UTC 2016 rb743@vica.cl.cam.ac.uk:/home/rb743/obj/riscv.riscv64/home/rb743/dev/freebsd-riscv/sys/SPIKE riscv # Ruslan On Wed, Nov 16, 2016 at 02:02:27PM +0000, Ruslan Bukin wrote: > Forgot to mention that we are using 32mb mdroot. > Removing mdroot from kernel config makes it more happy: > > crypto: cryptosoft0 registers alg 26 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 27 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 28 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 21 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 17 flags 0 maxoplen 0 > random: harvesting attach, 8 bytes (4 bits) from cryptosoft0 > Device configuration finished. > procfs registered > Timecounters tick every 1.000 msec > lo0: bpf attached > vlan: initialized, using hash tables with chaining > tcp_init: net.inet.tcp.tcbhashsize auto tuned to 8192 > IPsec: Initialized Security Association Processing. > Release APs > CPU(1): Unknown Implementer Unknown Processor > Trying to mount root from ufs:/dev/md0 []... > mountroot: waiting for device /dev/md0... > Mounting from ufs:/dev/md0 failed with error 19. > > Loader variables: > > Manual root filesystem specification: > : [options] > Mount using filesystem > and with the specified (optional) option list. > > eg. ufs:/dev/da0s1a > zfs:tank > cd9660:/dev/cd0 ro > (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /) > > ? List valid disk boot devices > . Yield 1 second (for background tasks) > Abort manual input > > mountroot> > > Ruslan > > On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: > > I have a panic with this on RISC-V. Any ideas ? > > > > vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv > > vvvvvvvvvvvvvvvvvvvvvvvvvvvv > > rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvvvv > > rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > > rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > > rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > > rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > > rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv > > rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv > > rr vvvvvvvvvvvvvvvvvvvvvv > > rr vvvvvvvvvvvvvvvvvvvvvvvv rr > > rrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrr > > rrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrr > > rrrrrrrr vvvvvvvvvvvvvvvvvv rrrrrrrr > > rrrrrrrrrr vvvvvvvvvvvvvv rrrrrrrrrr > > rrrrrrrrrrrr vvvvvvvvvv rrrrrrrrrrrr > > rrrrrrrrrrrrrr vvvvvv rrrrrrrrrrrrrr > > rrrrrrrrrrrrrrrr vv rrrrrrrrrrrrrrrr > > rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr > > rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr > > rrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr > > > > INSTRUCTION SETS WANT TO BE FREE > > KDB: debugger backends: ddb > > KDB: current backend: ddb > > Found 2 CPUs in the device tree > > Copyright (c) 1992-2016 The FreeBSD Project. > > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 > > The Regents of the University of California. All rights reserved. > > FreeBSD is a registered trademark of The FreeBSD Foundation. > > FreeBSD 12.0-CURRENT #4 0a3288b(br-riscv-isa-update)-dirty: Wed Nov 16 13:28:11 UTC 2016 > > rb743@vica.cl.cam.ac.uk:/home/rb743/obj/riscv.riscv64/home/rb743/dev/freebsd-riscv/sys/SPIKE riscv > > gcc version 6.1.0 (GCC) > > Preloaded elf64 kernel "kernel" at 0xffffffc0026be360. > > CPU(0): Unknown Implementer Unknown Processor > > Starting CPU 1 (0) > > FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs > > ULE: setup cpu 0 > > ULE: setup cpu 1 > > random: entropy device external interface > > crypto: > > mem: > > openfirm: > > null: > > nfslock: pseudo-device > > random: harvesting attach, 8 bytes (4 bits) from nexus0 > > ofwbus0: > > simplebus0: on ofwbus0 > > random: harvesting attach, 8 bytes (4 bits) from simplebus0 > > random: harvesting attach, 8 bytes (4 bits) from ofwbus0 > > timer0: mem 0x40000000-0x40000007,0x40000008-0x40001007 irq 5 on simplebus0 > > Timecounter "RISC-V Timecounter" frequency 1000000 Hz quality 1000 > > Event timer "RISC-V Eventtimer" frequency 1000000 Hz quality 1000 > > random: harvesting attach, 8 bytes (4 bits) from timer0 > > cpulist0: on ofwbus0 > > cpu0: on cpulist0 > > cpu0: missing 'clock-frequency' property > > riscv64_cpu0: register <0> > > random: harvesting attach, 8 bytes (4 bits) from riscv64_cpu0 > > random: harvesting attach, 8 bytes (4 bits) from cpu0 > > cpu1: on cpulist0 > > cpu1: missing 'clock-frequency' property > > riscv64_cpu1: register <0> > > random: harvesting attach, 8 bytes (4 bits) from riscv64_cpu1 > > random: harvesting attach, 8 bytes (4 bits) from cpu1 > > random: harvesting attach, 8 bytes (4 bits) from cpulist0 > > simplebus0: compat riscv,pic (no driver attached) > > rcons0: irq 1 on simplebus0 > > random: harvesting attach, 8 bytes (4 bits) from rcons0 > > cryptosoft0: > > crypto: assign cryptosoft0 driver id 0, flags 100663296 > > crypto: cryptosoft0 registers alg 1 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 2 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 3 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 4 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 5 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 16 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 6 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 7 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 18 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 19 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 20 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 8 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 15 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 9 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 10 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 13 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 14 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 11 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 22 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 23 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 25 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 24 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 26 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 27 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 28 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 21 flags 0 maxoplen 0 > > crypto: cryptosoft0 registers alg 17 flags 0 maxoplen 0 > > random: harvesting attach, 8 bytes (4 bits) from cryptosoft0 > > Device configuration finished. > > procfs registered > > Timecounters tick every 1.000 msec > > lo0: bpf attached > > vlan: initialized, using hash tables with chaining > > tcp_init: net.inet.tcp.tcbhashsize auto tuned to 8192 > > IPsec: Initialized Security Association Processing. > > t[0] == 0xffffffc00265bf50 > > t[1] == 0xffffffc00016494c > > t[2] == 0x0000000000000050 > > t[3] == 0x0000000000000000 > > t[4] == 0x0000000000000000 > > t[5] == 0x0000000000000000 > > t[6] == 0x0000000000000000 > > s[0] == 0xffffffc000003db0 > > s[1] == 0x0000000000000000 > > s[2] == 0xffffffc002c4c510 > > s[3] == 0xffffffc002cea9c0 > > s[4] == 0x000000000098967f > > s[5] == 0x00000000039386ff > > s[6] == 0xffffffc000574778 > > s[7] == 0x0000000000000000 > > s[8] == 0xffffffc00267c580 > > s[9] == 0xffffffc000531218 > > s[10] == 0x0000000000000412 > > s[11] == 0x0000000000000000 > > a[0] == 0x0000000000000000 > > a[1] == 0x0000000000000000 > > a[2] == 0xffffffc000531218 > > a[3] == 0x0000000000000412 > > a[4] == 0xffffffc00267c580 > > a[5] == 0x0000000000000002 > > a[6] == 0x0000000000000000 > > a[7] == 0x0000000000000003 > > sepc == 0xffffffc00013deac > > sstatus == 0x8000000000006100 > > panic: vm_fault failed: ffffffc00013deac, va 0x0000000000000018 > > cpuid = 0 > > KDB: stack backtrace: > > db_trace_self() at db_read_token+0x704 > > pc = 0xffffffc000455b44 ra = 0xffffffc0000244f8 > > sp = 0xffffffc000003858 fp = 0xffffffc000003a78 > > > > db_read_token() at kdb_backtrace+0x3c > > pc = 0xffffffc0000244f8 ra = 0xffffffc0001a5588 > > sp = 0xffffffc000003a78 fp = 0xffffffc000003a88 > > > > kdb_backtrace() at vpanic+0x158 > > pc = 0xffffffc0001a5588 ra = 0xffffffc00015bd74 > > sp = 0xffffffc000003a88 fp = 0xffffffc000003ac8 > > > > vpanic() at panic+0x34 > > pc = 0xffffffc00015bd74 ra = 0xffffffc00015c58c > > sp = 0xffffffc000003ac8 fp = 0xffffffc000003ae8 > > > > panic() at sysarch+0x36c > > pc = 0xffffffc00015c58c ra = 0xffffffc0004622b0 > > sp = 0xffffffc000003ae8 fp = 0xffffffc000003bf8 > > > > sysarch() at do_trap_supervisor+0xa0 > > pc = 0xffffffc0004622b0 ra = 0xffffffc000462498 > > sp = 0xffffffc000003bf8 fp = 0xffffffc000003c18 > > > > do_trap_supervisor() at cpu_exception_handler_supervisor+0xb0 > > pc = 0xffffffc000462498 ra = 0xffffffc000456440 > > sp = 0xffffffc000003c18 fp = 0xffffffc000003db0 > > > > cpu_exception_handler_supervisor() at ruxagg+0x34 > > pc = 0xffffffc000456440 ra = 0xffffffc000154458 > > sp = 0xffffffc000003db0 fp = 0xffffffc000003dd0 > > > > ruxagg() at rufetch+0x9c > > pc = 0xffffffc000154458 ra = 0xffffffc000154784 > > sp = 0xffffffc000003dd0 fp = 0xffffffc000003e00 > > > > rufetch() at exec_shell_imgact+0x1204 > > pc = 0xffffffc000154784 ra = 0xffffffc0000f9d4c > > sp = 0xffffffc000003e00 fp = 0xffffffc000003ee0 > > > > exec_shell_imgact() at mi_startup+0x190 > > pc = 0xffffffc0000f9d4c ra = 0xffffffc0000fa768 > > sp = 0xffffffc000003ee0 fp = 0xffffffc000003f20 > > > > mi_startup() at kernbase+0x248 > > pc = 0xffffffc0000fa768 ra = 0xffffffc000000248 > > sp = 0xffffffc000003f20 fp = 0x0000000085002ff8 > > > > KDB: enter: panic > > [ thread pid 0 tid 100000 ] > > Stopped at kdb_enter+0x4c: > > db> > > > > Ruslan > > > > On Tue, Nov 15, 2016 at 06:22:50PM +0000, Alan Cox wrote: > > > Author: alc > > > Date: Tue Nov 15 18:22:50 2016 > > > New Revision: 308691 > > > URL: https://svnweb.freebsd.org/changeset/base/308691 > > > > > > Log: > > > Remove most of the code for implementing PG_CACHED pages. (This change does > > > not remove user-space visible fields from vm_cnt or all of the references to > > > cached pages from comments. Those changes will come later.) > > > > > > Reviewed by: kib, markj > > > Tested by: pho > > > Sponsored by: Dell EMC Isilon > > > Differential Revision: https://reviews.freebsd.org/D8497 > > > > > > Modified: > > > head/sys/cddl/compat/opensolaris/sys/vnode.h > > > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > > > head/sys/fs/tmpfs/tmpfs_subr.c > > > head/sys/kern/kern_exec.c > > > head/sys/kern/uipc_shm.c > > > head/sys/vm/swap_pager.c > > > head/sys/vm/vm_fault.c > > > head/sys/vm/vm_mmap.c > > > head/sys/vm/vm_object.c > > > head/sys/vm/vm_object.h > > > head/sys/vm/vm_page.c > > > head/sys/vm/vm_page.h > > > head/sys/vm/vm_reserv.c > > > head/sys/vm/vm_reserv.h > > > head/sys/vm/vnode_pager.c > > > > > > Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h > > > ============================================================================== > > > --- head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -75,8 +75,7 @@ vn_is_readonly(vnode_t *vp) > > > #define vn_mountedvfs(vp) ((vp)->v_mountedhere) > > > #define vn_has_cached_data(vp) \ > > > ((vp)->v_object != NULL && \ > > > - ((vp)->v_object->resident_page_count > 0 || \ > > > - !vm_object_cache_is_empty((vp)->v_object))) > > > + (vp)->v_object->resident_page_count > 0) > > > #define vn_exists(vp) do { } while (0) > > > #define vn_invalid(vp) do { } while (0) > > > #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0) > > > > > > 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 Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -426,10 +426,6 @@ page_busy(vnode_t *vp, int64_t start, in > > > continue; > > > } > > > vm_page_sbusy(pp); > > > - } else if (pp == NULL) { > > > - pp = vm_page_alloc(obj, OFF_TO_IDX(start), > > > - VM_ALLOC_SYSTEM | VM_ALLOC_IFCACHED | > > > - VM_ALLOC_SBUSY); > > > } else { > > > ASSERT(pp != NULL && !pp->valid); > > > pp = NULL; > > > > > > Modified: head/sys/fs/tmpfs/tmpfs_subr.c > > > ============================================================================== > > > --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -1372,12 +1372,9 @@ retry: > > > VM_WAIT; > > > VM_OBJECT_WLOCK(uobj); > > > goto retry; > > > - } else if (m->valid != VM_PAGE_BITS_ALL) > > > - rv = vm_pager_get_pages(uobj, &m, 1, > > > - NULL, NULL); > > > - else > > > - /* A cached page was reactivated. */ > > > - rv = VM_PAGER_OK; > > > + } > > > + rv = vm_pager_get_pages(uobj, &m, 1, NULL, > > > + NULL); > > > vm_page_lock(m); > > > if (rv == VM_PAGER_OK) { > > > vm_page_deactivate(m); > > > > > > Modified: head/sys/kern/kern_exec.c > > > ============================================================================== > > > --- head/sys/kern/kern_exec.c Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/kern/kern_exec.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -1006,7 +1006,7 @@ exec_map_first_page(imgp) > > > break; > > > } else { > > > ma[i] = vm_page_alloc(object, i, > > > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > > > + VM_ALLOC_NORMAL); > > > if (ma[i] == NULL) > > > break; > > > } > > > > > > Modified: head/sys/kern/uipc_shm.c > > > ============================================================================== > > > --- head/sys/kern/uipc_shm.c Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/kern/uipc_shm.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -455,12 +455,9 @@ retry: > > > VM_WAIT; > > > VM_OBJECT_WLOCK(object); > > > goto retry; > > > - } else if (m->valid != VM_PAGE_BITS_ALL) > > > - rv = vm_pager_get_pages(object, &m, 1, > > > - NULL, NULL); > > > - else > > > - /* A cached page was reactivated. */ > > > - rv = VM_PAGER_OK; > > > + } > > > + rv = vm_pager_get_pages(object, &m, 1, NULL, > > > + NULL); > > > vm_page_lock(m); > > > if (rv == VM_PAGER_OK) { > > > vm_page_deactivate(m); > > > > > > Modified: head/sys/vm/swap_pager.c > > > ============================================================================== > > > --- head/sys/vm/swap_pager.c Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/vm/swap_pager.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -1126,7 +1126,7 @@ swap_pager_getpages(vm_object_t object, > > > if (shift != 0) { > > > for (i = 1; i <= shift; i++) { > > > p = vm_page_alloc(object, m[0]->pindex - i, > > > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > > > + VM_ALLOC_NORMAL); > > > if (p == NULL) { > > > /* Shift allocated pages to the left. */ > > > for (j = 0; j < i - 1; j++) > > > @@ -1144,8 +1144,7 @@ swap_pager_getpages(vm_object_t object, > > > if (rahead != NULL) { > > > for (i = 0; i < *rahead; i++) { > > > p = vm_page_alloc(object, > > > - m[reqcount - 1]->pindex + i + 1, > > > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > > > + m[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); > > > if (p == NULL) > > > break; > > > bp->b_pages[shift + reqcount + i] = p; > > > > > > Modified: head/sys/vm/vm_fault.c > > > ============================================================================== > > > --- head/sys/vm/vm_fault.c Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/vm/vm_fault.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -559,8 +559,7 @@ fast_failed: > > > unlock_and_deallocate(&fs); > > > VM_WAITPFAULT; > > > goto RetryFault; > > > - } else if (fs.m->valid == VM_PAGE_BITS_ALL) > > > - break; > > > + } > > > } > > > > > > readrest: > > > > > > Modified: head/sys/vm/vm_mmap.c > > > ============================================================================== > > > --- head/sys/vm/vm_mmap.c Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/vm/vm_mmap.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -877,9 +877,6 @@ RestartScan: > > > pindex = OFF_TO_IDX(current->offset + > > > (addr - current->start)); > > > m = vm_page_lookup(object, pindex); > > > - if (m == NULL && > > > - vm_page_is_cached(object, pindex)) > > > - mincoreinfo = MINCORE_INCORE; > > > if (m != NULL && m->valid == 0) > > > m = NULL; > > > if (m != NULL) > > > > > > Modified: head/sys/vm/vm_object.c > > > ============================================================================== > > > --- head/sys/vm/vm_object.c Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/vm/vm_object.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -178,9 +178,6 @@ vm_object_zdtor(void *mem, int size, voi > > > ("object %p has reservations", > > > object)); > > > #endif > > > - KASSERT(vm_object_cache_is_empty(object), > > > - ("object %p has cached pages", > > > - object)); > > > KASSERT(object->paging_in_progress == 0, > > > ("object %p paging_in_progress = %d", > > > object, object->paging_in_progress)); > > > @@ -212,8 +209,6 @@ vm_object_zinit(void *mem, int size, int > > > object->paging_in_progress = 0; > > > object->resident_page_count = 0; > > > object->shadow_count = 0; > > > - object->cache.rt_root = 0; > > > - object->cache.rt_flags = 0; > > > > > > mtx_lock(&vm_object_list_mtx); > > > TAILQ_INSERT_TAIL(&vm_object_list, object, object_list); > > > @@ -792,8 +787,6 @@ vm_object_terminate(vm_object_t object) > > > if (__predict_false(!LIST_EMPTY(&object->rvq))) > > > vm_reserv_break_all(object); > > > #endif > > > - if (__predict_false(!vm_object_cache_is_empty(object))) > > > - vm_page_cache_free(object, 0, 0); > > > > > > KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || > > > object->type == OBJT_SWAP, > > > @@ -1135,13 +1128,6 @@ shadowlookup: > > > } else if ((tobject->flags & OBJ_UNMANAGED) != 0) > > > goto unlock_tobject; > > > m = vm_page_lookup(tobject, tpindex); > > > - if (m == NULL && advise == MADV_WILLNEED) { > > > - /* > > > - * If the page is cached, reactivate it. > > > - */ > > > - m = vm_page_alloc(tobject, tpindex, VM_ALLOC_IFCACHED | > > > - VM_ALLOC_NOBUSY); > > > - } > > > if (m == NULL) { > > > /* > > > * There may be swap even if there is no backing page > > > @@ -1406,19 +1392,6 @@ retry: > > > swap_pager_copy(orig_object, new_object, offidxstart, 0); > > > TAILQ_FOREACH(m, &new_object->memq, listq) > > > vm_page_xunbusy(m); > > > - > > > - /* > > > - * Transfer any cached pages from orig_object to new_object. > > > - * If swap_pager_copy() found swapped out pages within the > > > - * specified range of orig_object, then it changed > > > - * new_object's type to OBJT_SWAP when it transferred those > > > - * pages to new_object. Otherwise, new_object's type > > > - * should still be OBJT_DEFAULT and orig_object should not > > > - * contain any cached pages within the specified range. > > > - */ > > > - if (__predict_false(!vm_object_cache_is_empty(orig_object))) > > > - vm_page_cache_transfer(orig_object, offidxstart, > > > - new_object); > > > } > > > VM_OBJECT_WUNLOCK(orig_object); > > > VM_OBJECT_WUNLOCK(new_object); > > > @@ -1754,13 +1727,6 @@ vm_object_collapse(vm_object_t object) > > > backing_object, > > > object, > > > OFF_TO_IDX(object->backing_object_offset), TRUE); > > > - > > > - /* > > > - * Free any cached pages from backing_object. > > > - */ > > > - if (__predict_false( > > > - !vm_object_cache_is_empty(backing_object))) > > > - vm_page_cache_free(backing_object, 0, 0); > > > } > > > /* > > > * Object now shadows whatever backing_object did. > > > @@ -1889,7 +1855,7 @@ vm_object_page_remove(vm_object_t object > > > (options & (OBJPR_CLEANONLY | OBJPR_NOTMAPPED)) == OBJPR_NOTMAPPED, > > > ("vm_object_page_remove: illegal options for object %p", object)); > > > if (object->resident_page_count == 0) > > > - goto skipmemq; > > > + return; > > > vm_object_pip_add(object, 1); > > > again: > > > p = vm_page_find_least(object, start); > > > @@ -1946,9 +1912,6 @@ next: > > > vm_page_unlock(p); > > > } > > > vm_object_pip_wakeup(object); > > > -skipmemq: > > > - if (__predict_false(!vm_object_cache_is_empty(object))) > > > - vm_page_cache_free(object, start, end); > > > } > > > > > > /* > > > > > > Modified: head/sys/vm/vm_object.h > > > ============================================================================== > > > --- head/sys/vm/vm_object.h Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/vm/vm_object.h Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -118,7 +118,6 @@ struct vm_object { > > > vm_ooffset_t backing_object_offset;/* Offset in backing object */ > > > TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ > > > LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ > > > - struct vm_radix cache; /* (o + f) root of the cache page radix trie */ > > > void *handle; > > > union { > > > /* > > > @@ -290,13 +289,6 @@ void vm_object_pip_wakeup(vm_object_t ob > > > void vm_object_pip_wakeupn(vm_object_t object, short i); > > > void vm_object_pip_wait(vm_object_t object, char *waitid); > > > > > > -static __inline boolean_t > > > -vm_object_cache_is_empty(vm_object_t object) > > > -{ > > > - > > > - return (vm_radix_is_empty(&object->cache)); > > > -} > > > - > > > void umtx_shm_object_init(vm_object_t object); > > > void umtx_shm_object_terminated(vm_object_t object); > > > extern int umtx_shm_vnobj_persistent; > > > > > > Modified: head/sys/vm/vm_page.c > > > ============================================================================== > > > --- head/sys/vm/vm_page.c Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/vm/vm_page.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -154,8 +154,7 @@ static int vm_pageout_pages_needed; > > > > > > static uma_zone_t fakepg_zone; > > > > > > -static struct vnode *vm_page_alloc_init(vm_page_t m); > > > -static void vm_page_cache_turn_free(vm_page_t m); > > > +static void vm_page_alloc_check(vm_page_t m); > > > static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); > > > static void vm_page_enqueue(uint8_t queue, vm_page_t m); > > > static void vm_page_free_wakeup(void); > > > @@ -1118,9 +1117,7 @@ void > > > vm_page_dirty_KBI(vm_page_t m) > > > { > > > > > > - /* These assertions refer to this operation by its public name. */ > > > - KASSERT((m->flags & PG_CACHED) == 0, > > > - ("vm_page_dirty: page in cache!")); > > > + /* Refer to this operation by its public name. */ > > > KASSERT(m->valid == VM_PAGE_BITS_ALL, > > > ("vm_page_dirty: page is invalid!")); > > > m->dirty = VM_PAGE_BITS_ALL; > > > @@ -1459,142 +1456,6 @@ vm_page_rename(vm_page_t m, vm_object_t > > > } > > > > > > /* > > > - * Convert all of the given object's cached pages that have a > > > - * pindex within the given range into free pages. If the value > > > - * zero is given for "end", then the range's upper bound is > > > - * infinity. If the given object is backed by a vnode and it > > > - * transitions from having one or more cached pages to none, the > > > - * vnode's hold count is reduced. > > > - */ > > > -void > > > -vm_page_cache_free(vm_object_t object, vm_pindex_t start, vm_pindex_t end) > > > -{ > > > - vm_page_t m; > > > - boolean_t empty; > > > - > > > - mtx_lock(&vm_page_queue_free_mtx); > > > - if (__predict_false(vm_radix_is_empty(&object->cache))) { > > > - mtx_unlock(&vm_page_queue_free_mtx); > > > - return; > > > - } > > > - while ((m = vm_radix_lookup_ge(&object->cache, start)) != NULL) { > > > - if (end != 0 && m->pindex >= end) > > > - break; > > > - vm_radix_remove(&object->cache, m->pindex); > > > - vm_page_cache_turn_free(m); > > > - } > > > - empty = vm_radix_is_empty(&object->cache); > > > - mtx_unlock(&vm_page_queue_free_mtx); > > > - if (object->type == OBJT_VNODE && empty) > > > - vdrop(object->handle); > > > -} > > > - > > > -/* > > > - * Returns the cached page that is associated with the given > > > - * object and offset. If, however, none exists, returns NULL. > > > - * > > > - * The free page queue must be locked. > > > - */ > > > -static inline vm_page_t > > > -vm_page_cache_lookup(vm_object_t object, vm_pindex_t pindex) > > > -{ > > > - > > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > > - return (vm_radix_lookup(&object->cache, pindex)); > > > -} > > > - > > > -/* > > > - * Remove the given cached page from its containing object's > > > - * collection of cached pages. > > > - * > > > - * The free page queue must be locked. > > > - */ > > > -static void > > > -vm_page_cache_remove(vm_page_t m) > > > -{ > > > - > > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > > - KASSERT((m->flags & PG_CACHED) != 0, > > > - ("vm_page_cache_remove: page %p is not cached", m)); > > > - vm_radix_remove(&m->object->cache, m->pindex); > > > - m->object = NULL; > > > - vm_cnt.v_cache_count--; > > > -} > > > - > > > -/* > > > - * Transfer all of the cached pages with offset greater than or > > > - * equal to 'offidxstart' from the original object's cache to the > > > - * new object's cache. However, any cached pages with offset > > > - * greater than or equal to the new object's size are kept in the > > > - * original object. Initially, the new object's cache must be > > > - * empty. Offset 'offidxstart' in the original object must > > > - * correspond to offset zero in the new object. > > > - * > > > - * The new object must be locked. > > > - */ > > > -void > > > -vm_page_cache_transfer(vm_object_t orig_object, vm_pindex_t offidxstart, > > > - vm_object_t new_object) > > > -{ > > > - vm_page_t m; > > > - > > > - /* > > > - * Insertion into an object's collection of cached pages > > > - * requires the object to be locked. In contrast, removal does > > > - * not. > > > - */ > > > - VM_OBJECT_ASSERT_WLOCKED(new_object); > > > - KASSERT(vm_radix_is_empty(&new_object->cache), > > > - ("vm_page_cache_transfer: object %p has cached pages", > > > - new_object)); > > > - mtx_lock(&vm_page_queue_free_mtx); > > > - while ((m = vm_radix_lookup_ge(&orig_object->cache, > > > - offidxstart)) != NULL) { > > > - /* > > > - * Transfer all of the pages with offset greater than or > > > - * equal to 'offidxstart' from the original object's > > > - * cache to the new object's cache. > > > - */ > > > - if ((m->pindex - offidxstart) >= new_object->size) > > > - break; > > > - vm_radix_remove(&orig_object->cache, m->pindex); > > > - /* Update the page's object and offset. */ > > > - m->object = new_object; > > > - m->pindex -= offidxstart; > > > - if (vm_radix_insert(&new_object->cache, m)) > > > - vm_page_cache_turn_free(m); > > > - } > > > - mtx_unlock(&vm_page_queue_free_mtx); > > > -} > > > - > > > -/* > > > - * Returns TRUE if a cached page is associated with the given object and > > > - * offset, and FALSE otherwise. > > > - * > > > - * The object must be locked. > > > - */ > > > -boolean_t > > > -vm_page_is_cached(vm_object_t object, vm_pindex_t pindex) > > > -{ > > > - vm_page_t m; > > > - > > > - /* > > > - * Insertion into an object's collection of cached pages requires the > > > - * object to be locked. Therefore, if the object is locked and the > > > - * object's collection is empty, there is no need to acquire the free > > > - * page queues lock in order to prove that the specified page doesn't > > > - * exist. > > > - */ > > > - VM_OBJECT_ASSERT_WLOCKED(object); > > > - if (__predict_true(vm_object_cache_is_empty(object))) > > > - return (FALSE); > > > - mtx_lock(&vm_page_queue_free_mtx); > > > - m = vm_page_cache_lookup(object, pindex); > > > - mtx_unlock(&vm_page_queue_free_mtx); > > > - return (m != NULL); > > > -} > > > - > > > -/* > > > * vm_page_alloc: > > > * > > > * Allocate and return a page that is associated with the specified > > > @@ -1610,9 +1471,6 @@ vm_page_is_cached(vm_object_t object, vm > > > * optional allocation flags: > > > * VM_ALLOC_COUNT(number) the number of additional pages that the caller > > > * intends to allocate > > > - * VM_ALLOC_IFCACHED return page only if it is cached > > > - * VM_ALLOC_IFNOTCACHED return NULL, do not reactivate if the page > > > - * is cached > > > * VM_ALLOC_NOBUSY do not exclusive busy the page > > > * VM_ALLOC_NODUMP do not include the page in a kernel core dump > > > * VM_ALLOC_NOOBJ page is not associated with an object and > > > @@ -1626,8 +1484,6 @@ vm_page_is_cached(vm_object_t object, vm > > > vm_page_t > > > vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) > > > { > > > - struct vnode *vp = NULL; > > > - vm_object_t m_object; > > > vm_page_t m, mpred; > > > int flags, req_class; > > > > > > @@ -1670,31 +1526,12 @@ vm_page_alloc(vm_object_t object, vm_pin > > > * Allocate from the free queue if the number of free pages > > > * exceeds the minimum for the request class. > > > */ > > > - if (object != NULL && > > > - (m = vm_page_cache_lookup(object, pindex)) != NULL) { > > > - if ((req & VM_ALLOC_IFNOTCACHED) != 0) { > > > - mtx_unlock(&vm_page_queue_free_mtx); > > > - return (NULL); > > > - } > > > - if (vm_phys_unfree_page(m)) > > > - vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, 0); > > > -#if VM_NRESERVLEVEL > 0 > > > - else if (!vm_reserv_reactivate_page(m)) > > > -#else > > > - else > > > -#endif > > > - panic("vm_page_alloc: cache page %p is missing" > > > - " from the free queue", m); > > > - } else if ((req & VM_ALLOC_IFCACHED) != 0) { > > > - mtx_unlock(&vm_page_queue_free_mtx); > > > - return (NULL); > > > #if VM_NRESERVLEVEL > 0 > > > - } else if (object == NULL || (object->flags & (OBJ_COLORED | > > > + if (object == NULL || (object->flags & (OBJ_COLORED | > > > OBJ_FICTITIOUS)) != OBJ_COLORED || (m = > > > - vm_reserv_alloc_page(object, pindex, mpred)) == NULL) { > > > -#else > > > - } else { > > > + vm_reserv_alloc_page(object, pindex, mpred)) == NULL) > > > #endif > > > + { > > > m = vm_phys_alloc_pages(object != NULL ? > > > VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > > > #if VM_NRESERVLEVEL > 0 > > > @@ -1720,33 +1557,9 @@ vm_page_alloc(vm_object_t object, vm_pin > > > * At this point we had better have found a good page. > > > */ > > > KASSERT(m != NULL, ("vm_page_alloc: missing page")); > > > - KASSERT(m->queue == PQ_NONE, > > > - ("vm_page_alloc: page %p has unexpected queue %d", m, m->queue)); > > > - KASSERT(m->wire_count == 0, ("vm_page_alloc: page %p is wired", m)); > > > - KASSERT(m->hold_count == 0, ("vm_page_alloc: page %p is held", m)); > > > - KASSERT(!vm_page_busied(m), ("vm_page_alloc: page %p is busy", m)); > > > - KASSERT(m->dirty == 0, ("vm_page_alloc: page %p is dirty", m)); > > > - KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, > > > - ("vm_page_alloc: page %p has unexpected memattr %d", m, > > > - pmap_page_get_memattr(m))); > > > - if ((m->flags & PG_CACHED) != 0) { > > > - KASSERT((m->flags & PG_ZERO) == 0, > > > - ("vm_page_alloc: cached page %p is PG_ZERO", m)); > > > - KASSERT(m->valid != 0, > > > - ("vm_page_alloc: cached page %p is invalid", m)); > > > - if (m->object != object || m->pindex != pindex) > > > - m->valid = 0; > > > - m_object = m->object; > > > - vm_page_cache_remove(m); > > > - if (m_object->type == OBJT_VNODE && > > > - vm_object_cache_is_empty(m_object)) > > > - vp = m_object->handle; > > > - } else { > > > - KASSERT(m->valid == 0, > > > - ("vm_page_alloc: free page %p is valid", m)); > > > - vm_phys_freecnt_adj(m, -1); > > > - } > > > + vm_phys_freecnt_adj(m, -1); > > > mtx_unlock(&vm_page_queue_free_mtx); > > > + vm_page_alloc_check(m); > > > > > > /* > > > * Initialize the page. Only the PG_ZERO flag is inherited. > > > @@ -1778,9 +1591,6 @@ vm_page_alloc(vm_object_t object, vm_pin > > > > > > if (object != NULL) { > > > if (vm_page_insert_after(m, object, pindex, mpred)) { > > > - /* See the comment below about hold count. */ > > > - if (vp != NULL) > > > - vdrop(vp); > > > pagedaemon_wakeup(); > > > if (req & VM_ALLOC_WIRED) { > > > atomic_subtract_int(&vm_cnt.v_wire_count, 1); > > > @@ -1801,15 +1611,6 @@ vm_page_alloc(vm_object_t object, vm_pin > > > m->pindex = pindex; > > > > > > /* > > > - * The following call to vdrop() must come after the above call > > > - * to vm_page_insert() in case both affect the same object and > > > - * vnode. Otherwise, the affected vnode's hold count could > > > - * temporarily become zero. > > > - */ > > > - if (vp != NULL) > > > - vdrop(vp); > > > - > > > - /* > > > * Don't wakeup too often - wakeup the pageout daemon when > > > * we would be nearly out of memory. > > > */ > > > @@ -1819,16 +1620,6 @@ vm_page_alloc(vm_object_t object, vm_pin > > > return (m); > > > } > > > > > > -static void > > > -vm_page_alloc_contig_vdrop(struct spglist *lst) > > > -{ > > > - > > > - while (!SLIST_EMPTY(lst)) { > > > - vdrop((struct vnode *)SLIST_FIRST(lst)-> plinks.s.pv); > > > - SLIST_REMOVE_HEAD(lst, plinks.s.ss); > > > - } > > > -} > > > - > > > /* > > > * vm_page_alloc_contig: > > > * > > > @@ -1873,8 +1664,6 @@ vm_page_alloc_contig(vm_object_t object, > > > u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, > > > vm_paddr_t boundary, vm_memattr_t memattr) > > > { > > > - struct vnode *drop; > > > - struct spglist deferred_vdrop_list; > > > vm_page_t m, m_tmp, m_ret; > > > u_int flags; > > > int req_class; > > > @@ -1900,7 +1689,6 @@ vm_page_alloc_contig(vm_object_t object, > > > if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) > > > req_class = VM_ALLOC_SYSTEM; > > > > > > - SLIST_INIT(&deferred_vdrop_list); > > > mtx_lock(&vm_page_queue_free_mtx); > > > if (vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages + > > > vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && > > > @@ -1922,17 +1710,7 @@ retry: > > > return (NULL); > > > } > > > if (m_ret != NULL) > > > - for (m = m_ret; m < &m_ret[npages]; m++) { > > > - drop = vm_page_alloc_init(m); > > > - if (drop != NULL) { > > > - /* > > > - * Enqueue the vnode for deferred vdrop(). > > > - */ > > > - m->plinks.s.pv = drop; > > > - SLIST_INSERT_HEAD(&deferred_vdrop_list, m, > > > - plinks.s.ss); > > > - } > > > - } > > > + vm_phys_freecnt_adj(m_ret, -npages); > > > else { > > > #if VM_NRESERVLEVEL > 0 > > > if (vm_reserv_reclaim_contig(npages, low, high, alignment, > > > @@ -1943,6 +1721,8 @@ retry: > > > mtx_unlock(&vm_page_queue_free_mtx); > > > if (m_ret == NULL) > > > return (NULL); > > > + for (m = m_ret; m < &m_ret[npages]; m++) > > > + vm_page_alloc_check(m); > > > > > > /* > > > * Initialize the pages. Only the PG_ZERO flag is inherited. > > > @@ -1975,8 +1755,6 @@ retry: > > > m->oflags = VPO_UNMANAGED; > > > if (object != NULL) { > > > if (vm_page_insert(m, object, pindex)) { > > > - vm_page_alloc_contig_vdrop( > > > - &deferred_vdrop_list); > > > if (vm_paging_needed()) > > > pagedaemon_wakeup(); > > > if ((req & VM_ALLOC_WIRED) != 0) > > > @@ -2001,57 +1779,28 @@ retry: > > > pmap_page_set_memattr(m, memattr); > > > pindex++; > > > } > > > - vm_page_alloc_contig_vdrop(&deferred_vdrop_list); > > > if (vm_paging_needed()) > > > pagedaemon_wakeup(); > > > return (m_ret); > > > } > > > > > > /* > > > - * Initialize a page that has been freshly dequeued from a freelist. > > > - * The caller has to drop the vnode returned, if it is not NULL. > > > - * > > > - * This function may only be used to initialize unmanaged pages. > > > - * > > > - * To be called with vm_page_queue_free_mtx held. > > > + * Check a page that has been freshly dequeued from a freelist. > > > */ > > > -static struct vnode * > > > -vm_page_alloc_init(vm_page_t m) > > > +static void > > > +vm_page_alloc_check(vm_page_t m) > > > { > > > - struct vnode *drop; > > > - vm_object_t m_object; > > > > > > KASSERT(m->queue == PQ_NONE, > > > - ("vm_page_alloc_init: page %p has unexpected queue %d", > > > - m, m->queue)); > > > - KASSERT(m->wire_count == 0, > > > - ("vm_page_alloc_init: page %p is wired", m)); > > > - KASSERT(m->hold_count == 0, > > > - ("vm_page_alloc_init: page %p is held", m)); > > > - KASSERT(!vm_page_busied(m), > > > - ("vm_page_alloc_init: page %p is busy", m)); > > > - KASSERT(m->dirty == 0, > > > - ("vm_page_alloc_init: page %p is dirty", m)); > > > + ("page %p has unexpected queue %d", m, m->queue)); > > > + KASSERT(m->wire_count == 0, ("page %p is wired", m)); > > > + KASSERT(m->hold_count == 0, ("page %p is held", m)); > > > + KASSERT(!vm_page_busied(m), ("page %p is busy", m)); > > > + KASSERT(m->dirty == 0, ("page %p is dirty", m)); > > > KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, > > > - ("vm_page_alloc_init: page %p has unexpected memattr %d", > > > + ("page %p has unexpected memattr %d", > > > m, pmap_page_get_memattr(m))); > > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > > - drop = NULL; > > > - if ((m->flags & PG_CACHED) != 0) { > > > - KASSERT((m->flags & PG_ZERO) == 0, > > > - ("vm_page_alloc_init: cached page %p is PG_ZERO", m)); > > > - m->valid = 0; > > > - m_object = m->object; > > > - vm_page_cache_remove(m); > > > - if (m_object->type == OBJT_VNODE && > > > - vm_object_cache_is_empty(m_object)) > > > - drop = m_object->handle; > > > - } else { > > > - KASSERT(m->valid == 0, > > > - ("vm_page_alloc_init: free page %p is valid", m)); > > > - vm_phys_freecnt_adj(m, -1); > > > - } > > > - return (drop); > > > + KASSERT(m->valid == 0, ("free page %p is valid", m)); > > > } > > > > > > /* > > > @@ -2077,7 +1826,6 @@ vm_page_alloc_init(vm_page_t m) > > > vm_page_t > > > vm_page_alloc_freelist(int flind, int req) > > > { > > > - struct vnode *drop; > > > vm_page_t m; > > > u_int flags; > > > int req_class; > > > @@ -2111,8 +1859,9 @@ vm_page_alloc_freelist(int flind, int re > > > mtx_unlock(&vm_page_queue_free_mtx); > > > return (NULL); > > > } > > > - drop = vm_page_alloc_init(m); > > > + vm_phys_freecnt_adj(m, -1); > > > mtx_unlock(&vm_page_queue_free_mtx); > > > + vm_page_alloc_check(m); > > > > > > /* > > > * Initialize the page. Only the PG_ZERO flag is inherited. > > > @@ -2132,8 +1881,6 @@ vm_page_alloc_freelist(int flind, int re > > > } > > > /* Unmanaged pages don't use "act_count". */ > > > m->oflags = VPO_UNMANAGED; > > > - if (drop != NULL) > > > - vdrop(drop); > > > if (vm_paging_needed()) > > > pagedaemon_wakeup(); > > > return (m); > > > @@ -2259,38 +2006,8 @@ retry: > > > /* Don't care: PG_NODUMP, PG_ZERO. */ > > > if (object->type != OBJT_DEFAULT && > > > object->type != OBJT_SWAP && > > > - object->type != OBJT_VNODE) > > > + object->type != OBJT_VNODE) { > > > run_ext = 0; > > > - else if ((m->flags & PG_CACHED) != 0 || > > > - m != vm_page_lookup(object, m->pindex)) { > > > - /* > > > - * The page is cached or recently converted > > > - * from cached to free. > > > - */ > > > -#if VM_NRESERVLEVEL > 0 > > > - if (level >= 0) { > > > - /* > > > - * The page is reserved. Extend the > > > - * current run by one page. > > > - */ > > > - run_ext = 1; > > > - } else > > > -#endif > > > - if ((order = m->order) < VM_NFREEORDER) { > > > - /* > > > - * The page is enqueued in the > > > - * physical memory allocator's cache/ > > > - * free page queues. Moreover, it is > > > - * the first page in a power-of-two- > > > - * sized run of contiguous cache/free > > > - * pages. Add these pages to the end > > > - * of the current run, and jump > > > - * ahead. > > > - */ > > > - run_ext = 1 << order; > > > - m_inc = 1 << order; > > > - } else > > > - run_ext = 0; > > > #if VM_NRESERVLEVEL > 0 > > > } else if ((options & VPSC_NOSUPER) != 0 && > > > (level = vm_reserv_level_iffullpop(m)) >= 0) { > > > @@ -2457,15 +2174,7 @@ retry: > > > object->type != OBJT_SWAP && > > > object->type != OBJT_VNODE) > > > error = EINVAL; > > > - else if ((m->flags & PG_CACHED) != 0 || > > > - m != vm_page_lookup(object, m->pindex)) { > > > - /* > > > - * The page is cached or recently converted > > > - * from cached to free. > > > - */ > > > - VM_OBJECT_WUNLOCK(object); > > > - goto cached; > > > - } else if (object->memattr != VM_MEMATTR_DEFAULT) > > > + else if (object->memattr != VM_MEMATTR_DEFAULT) > > > error = EINVAL; > > > else if (m->queue != PQ_NONE && !vm_page_busied(m)) { > > > KASSERT(pmap_page_get_memattr(m) == > > > @@ -2566,7 +2275,6 @@ retry: > > > unlock: > > > VM_OBJECT_WUNLOCK(object); > > > } else { > > > -cached: > > > mtx_lock(&vm_page_queue_free_mtx); > > > order = m->order; > > > if (order < VM_NFREEORDER) { > > > @@ -2964,27 +2672,6 @@ vm_page_free_wakeup(void) > > > } > > > > > > /* > > > - * Turn a cached page into a free page, by changing its attributes. > > > - * Keep the statistics up-to-date. > > > - * > > > - * The free page queue must be locked. > > > - */ > > > -static void > > > -vm_page_cache_turn_free(vm_page_t m) > > > -{ > > > - > > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > > - > > > - m->object = NULL; > > > - m->valid = 0; > > > - KASSERT((m->flags & PG_CACHED) != 0, > > > - ("vm_page_cache_turn_free: page %p is not cached", m)); > > > - m->flags &= ~PG_CACHED; > > > - vm_cnt.v_cache_count--; > > > - vm_phys_freecnt_adj(m, 1); > > > -} > > > - > > > -/* > > > * vm_page_free_toq: > > > * > > > * Returns the given page to the free list, > > > @@ -3383,8 +3070,7 @@ retrylookup: > > > VM_WAIT; > > > VM_OBJECT_WLOCK(object); > > > goto retrylookup; > > > - } else if (m->valid != 0) > > > - return (m); > > > + } > > > if (allocflags & VM_ALLOC_ZERO && (m->flags & PG_ZERO) == 0) > > > pmap_zero_page(m); > > > return (m); > > > > > > Modified: head/sys/vm/vm_page.h > > > ============================================================================== > > > --- head/sys/vm/vm_page.h Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/vm/vm_page.h Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -326,7 +326,6 @@ extern struct mtx_padalign pa_lock[]; > > > * Page flags. If changed at any other time than page allocation or > > > * freeing, the modification must be protected by the vm_page lock. > > > */ > > > -#define PG_CACHED 0x0001 /* page is cached */ > > > #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ > > > #define PG_ZERO 0x0008 /* page is zeroed */ > > > #define PG_MARKER 0x0010 /* special queue marker page */ > > > @@ -409,8 +408,6 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa) > > > #define VM_ALLOC_ZERO 0x0040 /* (acfg) Try to obtain a zeroed page */ > > > #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ > > > #define VM_ALLOC_NOBUSY 0x0200 /* (acg) Do not busy the page */ > > > -#define VM_ALLOC_IFCACHED 0x0400 /* (ag) Fail if page is not cached */ > > > -#define VM_ALLOC_IFNOTCACHED 0x0800 /* (ag) Fail if page is cached */ > > > #define VM_ALLOC_IGN_SBUSY 0x1000 /* (g) 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 */ > > > @@ -453,8 +450,6 @@ vm_page_t vm_page_alloc_contig(vm_object > > > 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_cache_free(vm_object_t, vm_pindex_t, vm_pindex_t); > > > -void vm_page_cache_transfer(vm_object_t, vm_pindex_t, vm_object_t); > > > int vm_page_try_to_free (vm_page_t); > > > void vm_page_deactivate (vm_page_t); > > > void vm_page_deactivate_noreuse(vm_page_t); > > > @@ -464,7 +459,6 @@ vm_page_t vm_page_find_least(vm_object_t > > > vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); > > > void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); > > > int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); > > > -boolean_t vm_page_is_cached(vm_object_t object, vm_pindex_t pindex); > > > void vm_page_launder(vm_page_t m); > > > vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); > > > vm_page_t vm_page_next(vm_page_t m); > > > > > > Modified: head/sys/vm/vm_reserv.c > > > ============================================================================== > > > --- head/sys/vm/vm_reserv.c Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/vm/vm_reserv.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -908,45 +908,6 @@ vm_reserv_level_iffullpop(vm_page_t m) > > > } > > > > > > /* > > > - * Prepare for the reactivation of a cached page. > > > - * > > > - * First, suppose that the given page "m" was allocated individually, i.e., not > > > - * as part of a reservation, and cached. Then, suppose a reservation > > > - * containing "m" is allocated by the same object. Although "m" and the > > > - * reservation belong to the same object, "m"'s pindex may not match the > > > - * reservation's. > > > - * > > > - * The free page queue must be locked. > > > - */ > > > -boolean_t > > > -vm_reserv_reactivate_page(vm_page_t m) > > > -{ > > > - vm_reserv_t rv; > > > - int index; > > > - > > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > > - rv = vm_reserv_from_page(m); > > > - if (rv->object == NULL) > > > - return (FALSE); > > > - KASSERT((m->flags & PG_CACHED) != 0, > > > - ("vm_reserv_reactivate_page: page %p is not cached", m)); > > > - if (m->object == rv->object && > > > - m->pindex - rv->pindex == (index = VM_RESERV_INDEX(m->object, > > > - m->pindex))) > > > - vm_reserv_populate(rv, index); > > > - else { > > > - KASSERT(rv->inpartpopq, > > > - ("vm_reserv_reactivate_page: reserv %p's inpartpopq is FALSE", > > > - rv)); > > > - TAILQ_REMOVE(&vm_rvq_partpop, rv, partpopq); > > > - rv->inpartpopq = FALSE; > > > - /* Don't release "m" to the physical memory allocator. */ > > > - vm_reserv_break(rv, m); > > > - } > > > - return (TRUE); > > > -} > > > - > > > -/* > > > * Breaks the given partially-populated reservation, releasing its cached and > > > * free pages to the physical memory allocator. > > > * > > > > > > Modified: head/sys/vm/vm_reserv.h > > > ============================================================================== > > > --- head/sys/vm/vm_reserv.h Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/vm/vm_reserv.h Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -56,7 +56,6 @@ void vm_reserv_init(void); > > > bool vm_reserv_is_page_free(vm_page_t m); > > > int vm_reserv_level(vm_page_t m); > > > int vm_reserv_level_iffullpop(vm_page_t m); > > > -boolean_t vm_reserv_reactivate_page(vm_page_t m); > > > boolean_t vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, > > > vm_paddr_t high, u_long alignment, vm_paddr_t boundary); > > > boolean_t vm_reserv_reclaim_inactive(void); > > > > > > Modified: head/sys/vm/vnode_pager.c > > > ============================================================================== > > > --- head/sys/vm/vnode_pager.c Tue Nov 15 17:01:48 2016 (r308690) > > > +++ head/sys/vm/vnode_pager.c Tue Nov 15 18:22:50 2016 (r308691) > > > @@ -466,10 +466,6 @@ vnode_pager_setsize(struct vnode *vp, vm > > > * replacement from working properly. > > > */ > > > vm_page_clear_dirty(m, base, PAGE_SIZE - base); > > > - } else if ((nsize & PAGE_MASK) && > > > - vm_page_is_cached(object, OFF_TO_IDX(nsize))) { > > > - vm_page_cache_free(object, OFF_TO_IDX(nsize), > > > - nobjsize); > > > } > > > } > > > object->un_pager.vnp.vnp_size = nsize; > > > @@ -894,8 +890,7 @@ vnode_pager_generic_getpages(struct vnod > > > for (tpindex = m[0]->pindex - 1; > > > tpindex >= startpindex && tpindex < m[0]->pindex; > > > tpindex--, i++) { > > > - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | > > > - VM_ALLOC_IFNOTCACHED); > > > + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); > > > if (p == NULL) { > > > /* Shift the array. */ > > > for (int j = 0; j < i; j++) > > > @@ -932,8 +927,7 @@ vnode_pager_generic_getpages(struct vnod > > > > > > for (tpindex = m[count - 1]->pindex + 1; > > > tpindex < endpindex; i++, tpindex++) { > > > - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | > > > - VM_ALLOC_IFNOTCACHED); > > > + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); > > > if (p == NULL) > > > break; > > > bp->b_pages[i] = p; > > > > > > From owner-svn-src-head@freebsd.org Wed Nov 16 14:39:04 2016 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 60A5FC45B06; Wed, 16 Nov 2016 14:39: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 26FB21240; Wed, 16 Nov 2016 14:39: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 uAGEd35O083356; Wed, 16 Nov 2016 14:39:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGEd3VM083355; Wed, 16 Nov 2016 14:39:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611161439.uAGEd3VM083355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 16 Nov 2016 14:39:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308730 - head/sys/dev/usb/net X-SVN-Group: head 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, 16 Nov 2016 14:39:04 -0000 Author: hselasky Date: Wed Nov 16 14:39:03 2016 New Revision: 308730 URL: https://svnweb.freebsd.org/changeset/base/308730 Log: Make sure MAC address is reprogrammed when if_init() callback is invoked. Else promiscious mode must be used to pass traffic. While at it fix a debug print macro. MFC after: 1 week Modified: head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Wed Nov 16 13:27:39 2016 (r308729) +++ head/sys/dev/usb/net/if_smsc.c Wed Nov 16 14:39:03 2016 (r308730) @@ -152,7 +152,7 @@ static const struct usb_device_id smsc_d device_printf((sc)->sc_ue.ue_dev, "debug: " fmt, ##args); \ } while(0) #else -#define smsc_dbg_printf(sc, fmt, args...) +#define smsc_dbg_printf(sc, fmt, args...) do { } while (0) #endif #define smsc_warn_printf(sc, fmt, args...) \ @@ -822,7 +822,6 @@ static int smsc_sethwcsum(struct smsc_so return (0); } - /** * smsc_setmacaddress - Sets the mac address in the device * @sc: driver soft context @@ -905,6 +904,9 @@ smsc_init(struct usb_ether *ue) SMSC_LOCK_ASSERT(sc, MA_OWNED); + if (smsc_setmacaddress(sc, IF_LLADDR(ifp))) + smsc_dbg_printf(sc, "setting MAC address failed\n"); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) return; From owner-svn-src-head@freebsd.org Wed Nov 16 15:21:35 2016 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 AEA7EC438C7; Wed, 16 Nov 2016 15:21:35 +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 769A0C35; Wed, 16 Nov 2016 15:21:35 +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 uAGFLY0C002038; Wed, 16 Nov 2016 15:21:34 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGFLWT9002019; Wed, 16 Nov 2016 15:21:32 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611161521.uAGFLWT9002019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 16 Nov 2016 15:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308731 - in head: . gnu/usr.bin/cc lib/libc lib/libc/riscv lib/libc/riscv/gen lib/libc/riscv/softfloat lib/libc/softfloat lib/libcompiler_rt lib/msun/riscv share/mk sys/conf sys/module... X-SVN-Group: head 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, 16 Nov 2016 15:21:35 -0000 Author: br Date: Wed Nov 16 15:21:32 2016 New Revision: 308731 URL: https://svnweb.freebsd.org/changeset/base/308731 Log: Add full softfloat and hardfloat support for RISC-V. Hardfloat is now default (use riscv64sf as TARGET_ARCH for softfloat). Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8529 Added: head/lib/libc/riscv/softfloat/ head/lib/libc/riscv/softfloat/milieu.h (contents, props changed) head/lib/libc/riscv/softfloat/riscv-gcc.h (contents, props changed) head/lib/libc/riscv/softfloat/softfloat.h (contents, props changed) head/lib/msun/riscv/Symbol.map (contents, props changed) head/sys/riscv/include/fpe.h (contents, props changed) Modified: head/Makefile head/Makefile.inc1 head/gnu/usr.bin/cc/Makefile.tgt head/lib/libc/Makefile head/lib/libc/riscv/Makefile.inc head/lib/libc/riscv/Symbol.map head/lib/libc/riscv/gen/_setjmp.S head/lib/libc/riscv/gen/flt_rounds.c head/lib/libc/riscv/gen/setjmp.S head/lib/libc/softfloat/Makefile.inc head/lib/libcompiler_rt/Makefile.inc head/lib/msun/riscv/Makefile.inc head/lib/msun/riscv/fenv.c head/lib/msun/riscv/fenv.h head/share/mk/bsd.cpu.mk head/share/mk/local.meta.sys.mk head/share/mk/src.opts.mk head/share/mk/sys.mk head/sys/conf/options.riscv head/sys/modules/dtrace/dtrace/Makefile head/sys/riscv/conf/GENERIC head/sys/riscv/include/pcb.h head/sys/riscv/include/reg.h head/sys/riscv/include/riscvreg.h head/sys/riscv/riscv/genassym.c head/sys/riscv/riscv/machdep.c head/sys/riscv/riscv/mp_machdep.c head/sys/riscv/riscv/swtch.S head/sys/riscv/riscv/trap.c head/sys/riscv/riscv/vm_machdep.c Modified: head/Makefile ============================================================================== --- head/Makefile Wed Nov 16 14:39:03 2016 (r308730) +++ head/Makefile Wed Nov 16 15:21:32 2016 (r308731) @@ -239,7 +239,7 @@ _MAKE+= MK_META_MODE=no _TARGET_ARCH= ${TARGET:S/pc98/i386/: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/riscv/} +_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/} .endif .if defined(TARGET) && !defined(_TARGET) _TARGET=${TARGET} Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Nov 16 14:39:03 2016 (r308730) +++ head/Makefile.inc1 Wed Nov 16 15:21:32 2016 (r308731) @@ -364,6 +364,7 @@ KNOWN_ARCHES?= aarch64/arm64 \ powerpc64/powerpc \ powerpcspe/powerpc \ riscv64/riscv \ + riscv64sf/riscv \ sparc64 .if ${TARGET} == ${TARGET_ARCH} Modified: head/gnu/usr.bin/cc/Makefile.tgt ============================================================================== --- head/gnu/usr.bin/cc/Makefile.tgt Wed Nov 16 14:39:03 2016 (r308730) +++ head/gnu/usr.bin/cc/Makefile.tgt Wed Nov 16 15:21:32 2016 (r308731) @@ -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:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv64/} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/lib/libc/Makefile ============================================================================== --- head/lib/libc/Makefile Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/libc/Makefile Wed Nov 16 15:21:32 2016 (r308731) @@ -111,7 +111,8 @@ NOASM= .include "${LIBC_SRCTOP}/xdr/Makefile.inc" .if (${LIBC_ARCH} == "arm" && \ (${MACHINE_ARCH:Marmv6*} == "" || (defined(CPUTYPE) && ${CPUTYPE:M*soft*}))) || \ - (${LIBC_ARCH} == "mips" && ${MACHINE_ARCH:Mmips*hf} == "") + (${LIBC_ARCH} == "mips" && ${MACHINE_ARCH:Mmips*hf} == "") || \ + (${LIBC_ARCH} == "riscv" && ${MACHINE_ARCH:Mriscv*sf} != "") .include "${LIBC_SRCTOP}/softfloat/Makefile.inc" .endif .if ${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "amd64" Modified: head/lib/libc/riscv/Makefile.inc ============================================================================== --- head/lib/libc/riscv/Makefile.inc Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/libc/riscv/Makefile.inc Wed Nov 16 15:21:32 2016 (r308731) @@ -3,6 +3,10 @@ # Machine dependent definitions for the RISC-V architecture. # +.if ${MACHINE_ARCH:Mriscv*sf} != "" +CFLAGS+=-DSOFTFLOAT +.endif + # Long double is quad precision GDTOASRCS+=strtorQ.c MDSRCS+=machdep_ldisQ.c Modified: head/lib/libc/riscv/Symbol.map ============================================================================== --- head/lib/libc/riscv/Symbol.map Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/libc/riscv/Symbol.map Wed Nov 16 15:21:32 2016 (r308731) @@ -35,4 +35,22 @@ FBSDprivate_1.0 { _set_tp; _end; __makecontext; + + /* softfloat */ + __addsf3; + __adddf3; + __subsf3; + __subdf3; + __mulsf3; + __muldf3; + __divsf3; + __divdf3; + __floatsisf; + __floatsidf; + __fixsfsi; + __fixdfsi; + __fixunssfsi; + __fixunsdfsi; + __extendsfdf2; + __truncdfsf2; }; Modified: head/lib/libc/riscv/gen/_setjmp.S ============================================================================== --- head/lib/libc/riscv/gen/_setjmp.S Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/libc/riscv/gen/_setjmp.S Wed Nov 16 15:21:32 2016 (r308731) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2016 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -61,25 +61,22 @@ ENTRY(_setjmp) sd ra, (12 * 8)(a0) addi a0, a0, (13 * 8) -#ifndef _STANDALONE -#if 0 - /* RISCVTODO */ - /* Store the vfp registers */ - fsq fs0, (0 * 16)(a0) - fsq fs1, (1 * 16)(a0) - fsq fs2, (2 * 16)(a0) - fsq fs3, (3 * 16)(a0) - fsq fs4, (4 * 16)(a0) - fsq fs5, (5 * 16)(a0) - fsq fs6, (6 * 16)(a0) - fsq fs7, (7 * 16)(a0) - fsq fs8, (8 * 16)(a0) - fsq fs9, (9 * 16)(a0) - fsq fs10, (10 * 16)(a0) - fsq fs11, (11 * 16)(a0) +#if !defined(_STANDALONE) && !defined(SOFTFLOAT) + /* Store the fpe registers */ + fsd fs0, (0 * 16)(a0) + fsd fs1, (1 * 16)(a0) + fsd fs2, (2 * 16)(a0) + fsd fs3, (3 * 16)(a0) + fsd fs4, (4 * 16)(a0) + fsd fs5, (5 * 16)(a0) + fsd fs6, (6 * 16)(a0) + fsd fs7, (7 * 16)(a0) + fsd fs8, (8 * 16)(a0) + fsd fs9, (9 * 16)(a0) + fsd fs10, (10 * 16)(a0) + fsd fs11, (11 * 16)(a0) addi a0, a0, (12 * 16) #endif -#endif /* Return value */ li a0, 0 @@ -117,25 +114,22 @@ ENTRY(_longjmp) ld ra, (12 * 8)(a0) addi a0, a0, (13 * 8) -#ifndef _STANDALONE -#if 0 - /* RISCVTODO */ - /* Restore the vfp registers */ - flq fs0, (0 * 16)(a0) - flq fs1, (1 * 16)(a0) - flq fs2, (2 * 16)(a0) - flq fs3, (3 * 16)(a0) - flq fs4, (4 * 16)(a0) - flq fs5, (5 * 16)(a0) - flq fs6, (6 * 16)(a0) - flq fs7, (7 * 16)(a0) - flq fs8, (8 * 16)(a0) - flq fs9, (9 * 16)(a0) - flq fs10, (10 * 16)(a0) - flq fs11, (11 * 16)(a0) +#if !defined(_STANDALONE) && !defined(SOFTFLOAT) + /* Restore the fpe registers */ + fld fs0, (0 * 16)(a0) + fld fs1, (1 * 16)(a0) + fld fs2, (2 * 16)(a0) + fld fs3, (3 * 16)(a0) + fld fs4, (4 * 16)(a0) + fld fs5, (5 * 16)(a0) + fld fs6, (6 * 16)(a0) + fld fs7, (7 * 16)(a0) + fld fs8, (8 * 16)(a0) + fld fs9, (9 * 16)(a0) + fld fs10, (10 * 16)(a0) + fld fs11, (11 * 16)(a0) addi a0, a0, (12 * 16) #endif -#endif /* Load the return value */ mv a0, a1 Modified: head/lib/libc/riscv/gen/flt_rounds.c ============================================================================== --- head/lib/libc/riscv/gen/flt_rounds.c Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/libc/riscv/gen/flt_rounds.c Wed Nov 16 15:21:32 2016 (r308731) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2016 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -40,23 +40,24 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef SOFTFLOAT +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" +#endif + int __flt_rounds(void) { -#if 0 - uint64_t fcsr; -#endif - int mode; + uint64_t mode; -#if 0 - __asm __volatile("csrr %0, fcsr" : "=r" (fcsr)); - mode = (fcsr & _ROUND_MASK); +#ifdef SOFTFLOAT + mode = __softfloat_float_rounding_mode; +#else + __asm __volatile("csrr %0, fcsr" : "=r" (mode)); #endif - /* RISCVTODO */ - mode = FE_TOWARDZERO; /* softfloat rounding mode */ - - switch (mode) { + switch (mode & _ROUND_MASK) { case FE_TOWARDZERO: return (0); case FE_TONEAREST: Modified: head/lib/libc/riscv/gen/setjmp.S ============================================================================== --- head/lib/libc/riscv/gen/setjmp.S Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/libc/riscv/gen/setjmp.S Wed Nov 16 15:21:32 2016 (r308731) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2016 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -75,21 +75,20 @@ ENTRY(setjmp) sd ra, (12 * 8)(a0) addi a0, a0, (13 * 8) -#if 0 - /* RISCVTODO */ - /* Store the vfp registers */ - fsq fs0, (0 * 16)(a0) - fsq fs1, (1 * 16)(a0) - fsq fs2, (2 * 16)(a0) - fsq fs3, (3 * 16)(a0) - fsq fs4, (4 * 16)(a0) - fsq fs5, (5 * 16)(a0) - fsq fs6, (6 * 16)(a0) - fsq fs7, (7 * 16)(a0) - fsq fs8, (8 * 16)(a0) - fsq fs9, (9 * 16)(a0) - fsq fs10, (10 * 16)(a0) - fsq fs11, (11 * 16)(a0) +#ifndef SOFTFLOAT + /* Store the fpe registers */ + fsd fs0, (0 * 16)(a0) + fsd fs1, (1 * 16)(a0) + fsd fs2, (2 * 16)(a0) + fsd fs3, (3 * 16)(a0) + fsd fs4, (4 * 16)(a0) + fsd fs5, (5 * 16)(a0) + fsd fs6, (6 * 16)(a0) + fsd fs7, (7 * 16)(a0) + fsd fs8, (8 * 16)(a0) + fsd fs9, (9 * 16)(a0) + fsd fs10, (10 * 16)(a0) + fsd fs11, (11 * 16)(a0) addi a0, a0, (12 * 16) #endif @@ -145,21 +144,20 @@ ENTRY(longjmp) ld ra, (12 * 8)(a0) addi a0, a0, (13 * 8) -#if 0 - /* RISCVTODO */ - /* Restore the vfp registers */ - flq fs0, (0 * 16)(a0) - flq fs1, (1 * 16)(a0) - flq fs2, (2 * 16)(a0) - flq fs3, (3 * 16)(a0) - flq fs4, (4 * 16)(a0) - flq fs5, (5 * 16)(a0) - flq fs6, (6 * 16)(a0) - flq fs7, (7 * 16)(a0) - flq fs8, (8 * 16)(a0) - flq fs9, (9 * 16)(a0) - flq fs10, (10 * 16)(a0) - flq fs11, (11 * 16)(a0) +#ifndef SOFTFLOAT + /* Restore the fpe registers */ + fld fs0, (0 * 16)(a0) + fld fs1, (1 * 16)(a0) + fld fs2, (2 * 16)(a0) + fld fs3, (3 * 16)(a0) + fld fs4, (4 * 16)(a0) + fld fs5, (5 * 16)(a0) + fld fs6, (6 * 16)(a0) + fld fs7, (7 * 16)(a0) + fld fs8, (8 * 16)(a0) + fld fs9, (9 * 16)(a0) + fld fs10, (10 * 16)(a0) + fld fs11, (11 * 16)(a0) addi a0, a0, (12 * 16) #endif Added: head/lib/libc/riscv/softfloat/milieu.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/riscv/softfloat/milieu.h Wed Nov 16 15:21:32 2016 (r308731) @@ -0,0 +1,48 @@ +/* $FreeBSD$ */ + +/* +=============================================================================== + +This C header file is part of the SoftFloat IEC/IEEE Floating-point +Arithmetic Package, Release 2a. + +Written by John R. Hauser. This work was made possible in part by the +International Computer Science Institute, located at Suite 600, 1947 Center +Street, Berkeley, California 94704. Funding was partially provided by the +National Science Foundation under grant MIP-9311980. The original version +of this code was written as part of a project to build a fixed-point vector +processor in collaboration with the University of California at Berkeley, +overseen by Profs. Nelson Morgan and John Wawrzynek. More information +is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/ +arithmetic/SoftFloat.html'. + +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort +has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT +TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO +PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY +AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. + +Derivative works are acceptable, even for commercial purposes, so long as +(1) they include prominent notice that the work is derivative, and (2) they +include prominent notice akin to these four paragraphs for those parts of +this code that are retained. + +=============================================================================== +*/ + +/* +------------------------------------------------------------------------------- +Include common integer types and flags. +------------------------------------------------------------------------------- +*/ +#include "riscv-gcc.h" + +/* +------------------------------------------------------------------------------- +Symbolic Boolean literals. +------------------------------------------------------------------------------- +*/ +enum { + FALSE = 0, + TRUE = 1 +}; Added: head/lib/libc/riscv/softfloat/riscv-gcc.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/riscv/softfloat/riscv-gcc.h Wed Nov 16 15:21:32 2016 (r308731) @@ -0,0 +1,86 @@ +/* $NetBSD: arm-gcc.h,v 1.2 2001/02/21 18:09:25 bjh21 Exp $ */ +/* $FreeBSD$ */ + +/* +------------------------------------------------------------------------------- +One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined. +------------------------------------------------------------------------------- +*/ +#define LITTLEENDIAN + +/* +------------------------------------------------------------------------------- +The macro `BITS64' can be defined to indicate that 64-bit integer types are +supported by the compiler. +------------------------------------------------------------------------------- +*/ +#define BITS64 + +/* +------------------------------------------------------------------------------- +Each of the following `typedef's defines the most convenient type that holds +integers of at least as many bits as specified. For example, `uint8' should +be the most convenient type that can hold unsigned integers of as many as +8 bits. The `flag' type must be able to hold either a 0 or 1. For most +implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed +to the same as `int'. +------------------------------------------------------------------------------- +*/ +typedef int flag; +typedef int uint8; +typedef int int8; +typedef int uint16; +typedef int int16; +typedef unsigned int uint32; +typedef signed int int32; +#ifdef BITS64 +typedef unsigned long long int uint64; +typedef signed long long int int64; +#endif + +/* +------------------------------------------------------------------------------- +Each of the following `typedef's defines a type that holds integers +of _exactly_ the number of bits specified. For instance, for most +implementation of C, `bits16' and `sbits16' should be `typedef'ed to +`unsigned short int' and `signed short int' (or `short int'), respectively. +------------------------------------------------------------------------------- +*/ +typedef unsigned char bits8; +typedef signed char sbits8; +typedef unsigned short int bits16; +typedef signed short int sbits16; +typedef unsigned int bits32; +typedef signed int sbits32; +#ifdef BITS64 +typedef unsigned long long int bits64; +typedef signed long long int sbits64; +#endif + +#ifdef BITS64 +/* +------------------------------------------------------------------------------- +The `LIT64' macro takes as its argument a textual integer literal and +if necessary ``marks'' the literal as having a 64-bit integer type. +For example, the GNU C Compiler (`gcc') requires that 64-bit literals be +appended with the letters `LL' standing for `long long', which is `gcc's +name for the 64-bit integer type. Some compilers may allow `LIT64' to be +defined as the identity macro: `#define LIT64( a ) a'. +------------------------------------------------------------------------------- +*/ +#define LIT64( a ) a##LL +#endif + +/* +------------------------------------------------------------------------------- +The macro `INLINE' can be used before functions that should be inlined. If +a compiler does not support explicit inlining, this macro should be defined +to be `static'. +------------------------------------------------------------------------------- +*/ +#define INLINE static __inline + +#if defined(SOFTFLOAT_FOR_GCC) +#define FLOAT64_DEMANGLE(a) (a) +#define FLOAT64_MANGLE(a) (a) +#endif Added: head/lib/libc/riscv/softfloat/softfloat.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/riscv/softfloat/softfloat.h Wed Nov 16 15:21:32 2016 (r308731) @@ -0,0 +1,315 @@ +/* $NetBSD: softfloat.h,v 1.6 2002/05/12 13:12:46 bjh21 Exp $ */ +/* $FreeBSD$ */ + +/* This is a derivative work. */ + +/* +=============================================================================== + +This C header file is part of the SoftFloat IEC/IEEE Floating-point +Arithmetic Package, Release 2a. + +Written by John R. Hauser. This work was made possible in part by the +International Computer Science Institute, located at Suite 600, 1947 Center +Street, Berkeley, California 94704. Funding was partially provided by the +National Science Foundation under grant MIP-9311980. The original version +of this code was written as part of a project to build a fixed-point vector +processor in collaboration with the University of California at Berkeley, +overseen by Profs. Nelson Morgan and John Wawrzynek. More information +is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/ +arithmetic/SoftFloat.html'. + +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort +has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT +TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO +PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY +AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. + +Derivative works are acceptable, even for commercial purposes, so long as +(1) they include prominent notice that the work is derivative, and (2) they +include prominent notice akin to these four paragraphs for those parts of +this code that are retained. + +=============================================================================== +*/ + +/* +------------------------------------------------------------------------------- +The macro `FLOATX80' must be defined to enable the extended double-precision +floating-point format `floatx80'. If this macro is not defined, the +`floatx80' type will not be defined, and none of the functions that either +input or output the `floatx80' type will be defined. The same applies to +the `FLOAT128' macro and the quadruple-precision format `float128'. +------------------------------------------------------------------------------- +*/ +/* #define FLOATX80 */ +/* #define FLOAT128 */ + +#include + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE floating-point types. +------------------------------------------------------------------------------- +*/ +typedef unsigned int float32; +typedef unsigned long long float64; +#ifdef FLOATX80 +typedef struct { + unsigned short high; + unsigned long long low; +} floatx80; +#endif +#ifdef FLOAT128 +typedef struct { + unsigned long long high, low; +} float128; +#endif + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE floating-point underflow tininess-detection mode. +------------------------------------------------------------------------------- +*/ +#ifndef SOFTFLOAT_FOR_GCC +extern int float_detect_tininess; +#endif +enum { + float_tininess_after_rounding = 0, + float_tininess_before_rounding = 1 +}; + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE floating-point rounding mode. +------------------------------------------------------------------------------- +*/ +extern int float_rounding_mode; +enum { + float_round_nearest_even = FE_TONEAREST, + float_round_to_zero = FE_TOWARDZERO, + float_round_down = FE_DOWNWARD, + float_round_up = FE_UPWARD +}; + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE floating-point exception flags. +------------------------------------------------------------------------------- +*/ +extern int float_exception_flags; +extern int float_exception_mask; +enum { + float_flag_inexact = FE_INEXACT, + float_flag_underflow = FE_UNDERFLOW, + float_flag_overflow = FE_OVERFLOW, + float_flag_divbyzero = FE_DIVBYZERO, + float_flag_invalid = FE_INVALID +}; + +/* +------------------------------------------------------------------------------- +Routine to raise any or all of the software IEC/IEEE floating-point +exception flags. +------------------------------------------------------------------------------- +*/ +void float_raise( int ); + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE integer-to-floating-point conversion routines. +------------------------------------------------------------------------------- +*/ +float32 int32_to_float32( int ); +float64 int32_to_float64( int ); +#ifdef FLOATX80 +floatx80 int32_to_floatx80( int ); +#endif +#ifdef FLOAT128 +float128 int32_to_float128( int ); +#endif +#ifndef SOFTFLOAT_FOR_GCC /* __floatdi?f is in libgcc2.c */ +float32 int64_to_float32( long long ); +float64 int64_to_float64( long long ); +#ifdef FLOATX80 +floatx80 int64_to_floatx80( long long ); +#endif +#ifdef FLOAT128 +float128 int64_to_float128( long long ); +#endif +#endif + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE single-precision conversion routines. +------------------------------------------------------------------------------- +*/ +int float32_to_int32( float32 ); +int float32_to_int32_round_to_zero( float32 ); +#if defined(SOFTFLOAT_FOR_GCC) && defined(SOFTFLOAT_NEED_FIXUNS) +unsigned int float32_to_uint32_round_to_zero( float32 ); +#endif +#ifndef SOFTFLOAT_FOR_GCC /* __fix?fdi provided by libgcc2.c */ +long long float32_to_int64( float32 ); +long long float32_to_int64_round_to_zero( float32 ); +#endif +float64 float32_to_float64( float32 ); +#ifdef FLOATX80 +floatx80 float32_to_floatx80( float32 ); +#endif +#ifdef FLOAT128 +float128 float32_to_float128( float32 ); +#endif + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE single-precision operations. +------------------------------------------------------------------------------- +*/ +float32 float32_round_to_int( float32 ); +float32 float32_add( float32, float32 ); +float32 float32_sub( float32, float32 ); +float32 float32_mul( float32, float32 ); +float32 float32_div( float32, float32 ); +float32 float32_rem( float32, float32 ); +float32 float32_sqrt( float32 ); +int float32_eq( float32, float32 ); +int float32_le( float32, float32 ); +int float32_lt( float32, float32 ); +int float32_eq_signaling( float32, float32 ); +int float32_le_quiet( float32, float32 ); +int float32_lt_quiet( float32, float32 ); +#ifndef SOFTFLOAT_FOR_GCC +int float32_is_signaling_nan( float32 ); +#endif + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE double-precision conversion routines. +------------------------------------------------------------------------------- +*/ +int float64_to_int32( float64 ); +int float64_to_int32_round_to_zero( float64 ); +#if defined(SOFTFLOAT_FOR_GCC) && defined(SOFTFLOAT_NEED_FIXUNS) +unsigned int float64_to_uint32_round_to_zero( float64 ); +#endif +#ifndef SOFTFLOAT_FOR_GCC /* __fix?fdi provided by libgcc2.c */ +long long float64_to_int64( float64 ); +long long float64_to_int64_round_to_zero( float64 ); +#endif +float32 float64_to_float32( float64 ); +#ifdef FLOATX80 +floatx80 float64_to_floatx80( float64 ); +#endif +#ifdef FLOAT128 +float128 float64_to_float128( float64 ); +#endif + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE double-precision operations. +------------------------------------------------------------------------------- +*/ +float64 float64_round_to_int( float64 ); +float64 float64_add( float64, float64 ); +float64 float64_sub( float64, float64 ); +float64 float64_mul( float64, float64 ); +float64 float64_div( float64, float64 ); +float64 float64_rem( float64, float64 ); +float64 float64_sqrt( float64 ); +int float64_eq( float64, float64 ); +int float64_le( float64, float64 ); +int float64_lt( float64, float64 ); +int float64_eq_signaling( float64, float64 ); +int float64_le_quiet( float64, float64 ); +int float64_lt_quiet( float64, float64 ); +#ifndef SOFTFLOAT_FOR_GCC +int float64_is_signaling_nan( float64 ); +#endif + +#ifdef FLOATX80 + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE extended double-precision conversion routines. +------------------------------------------------------------------------------- +*/ +int floatx80_to_int32( floatx80 ); +int floatx80_to_int32_round_to_zero( floatx80 ); +long long floatx80_to_int64( floatx80 ); +long long floatx80_to_int64_round_to_zero( floatx80 ); +float32 floatx80_to_float32( floatx80 ); +float64 floatx80_to_float64( floatx80 ); +#ifdef FLOAT128 +float128 floatx80_to_float128( floatx80 ); +#endif + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE extended double-precision rounding precision. Valid +values are 32, 64, and 80. +------------------------------------------------------------------------------- +*/ +extern int floatx80_rounding_precision; + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE extended double-precision operations. +------------------------------------------------------------------------------- +*/ +floatx80 floatx80_round_to_int( floatx80 ); +floatx80 floatx80_add( floatx80, floatx80 ); +floatx80 floatx80_sub( floatx80, floatx80 ); +floatx80 floatx80_mul( floatx80, floatx80 ); +floatx80 floatx80_div( floatx80, floatx80 ); +floatx80 floatx80_rem( floatx80, floatx80 ); +floatx80 floatx80_sqrt( floatx80 ); +int floatx80_eq( floatx80, floatx80 ); +int floatx80_le( floatx80, floatx80 ); +int floatx80_lt( floatx80, floatx80 ); +int floatx80_eq_signaling( floatx80, floatx80 ); +int floatx80_le_quiet( floatx80, floatx80 ); +int floatx80_lt_quiet( floatx80, floatx80 ); +int floatx80_is_signaling_nan( floatx80 ); + +#endif + +#ifdef FLOAT128 + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE quadruple-precision conversion routines. +------------------------------------------------------------------------------- +*/ +int float128_to_int32( float128 ); +int float128_to_int32_round_to_zero( float128 ); +long long float128_to_int64( float128 ); +long long float128_to_int64_round_to_zero( float128 ); +float32 float128_to_float32( float128 ); +float64 float128_to_float64( float128 ); +#ifdef FLOATX80 +floatx80 float128_to_floatx80( float128 ); +#endif + +/* +------------------------------------------------------------------------------- +Software IEC/IEEE quadruple-precision operations. +------------------------------------------------------------------------------- +*/ +float128 float128_round_to_int( float128 ); +float128 float128_add( float128, float128 ); +float128 float128_sub( float128, float128 ); +float128 float128_mul( float128, float128 ); +float128 float128_div( float128, float128 ); +float128 float128_rem( float128, float128 ); +float128 float128_sqrt( float128 ); +int float128_eq( float128, float128 ); +int float128_le( float128, float128 ); +int float128_lt( float128, float128 ); +int float128_eq_signaling( float128, float128 ); +int float128_le_quiet( float128, float128 ); +int float128_lt_quiet( float128, float128 ); +int float128_is_signaling_nan( float128 ); + +#endif + Modified: head/lib/libc/softfloat/Makefile.inc ============================================================================== --- head/lib/libc/softfloat/Makefile.inc Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/libc/softfloat/Makefile.inc Wed Nov 16 15:21:32 2016 (r308731) @@ -12,8 +12,11 @@ CFLAGS+= -DSOFTFLOAT_FOR_GCC SRCS+= softfloat.c +# Deprecated FPU control interface +.if ${LIBC_ARCH} != "riscv" SRCS+= fpgetround.c fpsetround.c fpgetmask.c fpsetmask.c \ fpgetsticky.c +.endif SRCS+= eqsf2.c nesf2.c gtsf2.c gesf2.c ltsf2.c lesf2.c negsf2.c \ eqdf2.c nedf2.c gtdf2.c gedf2.c ltdf2.c ledf2.c negdf2.c \ Modified: head/lib/libcompiler_rt/Makefile.inc ============================================================================== --- head/lib/libcompiler_rt/Makefile.inc Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/libcompiler_rt/Makefile.inc Wed Nov 16 15:21:32 2016 (r308731) @@ -125,7 +125,7 @@ SRCF+= umodti3 # # 128-bit quad precision long double support, -# only used on arm64 and riscv. +# only used on some architectures. # .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" SRCF+= addtf3 @@ -146,8 +146,9 @@ SRCF+= trunctfdf2 SRCF+= trunctfsf2 .endif -# These are already shipped by libc.a on arm and mips -.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" +# These are already shipped by libc.a on some architectures. +.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" && \ + ${MACHINE_CPUARCH} != "riscv" SRCF+= adddf3 SRCF+= addsf3 SRCF+= divdf3 Modified: head/lib/msun/riscv/Makefile.inc ============================================================================== --- head/lib/msun/riscv/Makefile.inc Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/msun/riscv/Makefile.inc Wed Nov 16 15:21:32 2016 (r308731) @@ -1,3 +1,8 @@ # $FreeBSD$ +.if ${MACHINE_ARCH:Mriscv*sf} != "" +CFLAGS+=-DSOFTFLOAT +.endif + LDBL_PREC = 113 +SYM_MAPS += ${.CURDIR}/riscv/Symbol.map Added: head/lib/msun/riscv/Symbol.map ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/riscv/Symbol.map Wed Nov 16 15:21:32 2016 (r308731) @@ -0,0 +1,21 @@ +/* + * $FreeBSD$ + */ +FBSD_1.0 { +}; + +FBSD_1.3 { + feclearexcept; + fegetexceptflag; + fesetexceptflag; + feraiseexcept; + fetestexcept; + fegetround; + fesetround; + fegetenv; + feholdexcept; + feupdateenv; + feenableexcept; + fedisableexcept; + fegetexcept; +}; Modified: head/lib/msun/riscv/fenv.c ============================================================================== --- head/lib/msun/riscv/fenv.c Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/msun/riscv/fenv.c Wed Nov 16 15:21:32 2016 (r308731) @@ -39,6 +39,14 @@ */ const fenv_t __fe_dfl_env = 0; +#ifdef SOFTFLOAT +#define __set_env(env, flags, mask, rnd) env = ((flags) | (rnd) << 5) +#define __env_flags(env) ((env) & FE_ALL_EXCEPT) +#define __env_mask(env) (0) /* No exception traps. */ +#define __env_round(env) (((env) >> 5) & _ROUND_MASK) +#include "fenv-softfloat.h" +#endif + extern inline int feclearexcept(int __excepts); extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); @@ -50,3 +58,6 @@ extern inline int fegetenv(fenv_t *__env extern inline int feholdexcept(fenv_t *__envp); extern inline int fesetenv(const fenv_t *__envp); extern inline int feupdateenv(const fenv_t *__envp); +extern inline int feenableexcept(int __mask); +extern inline int fedisableexcept(int __mask); +extern inline int fegetexcept(void); Modified: head/lib/msun/riscv/fenv.h ============================================================================== --- head/lib/msun/riscv/fenv.h Wed Nov 16 14:39:03 2016 (r308730) +++ head/lib/msun/riscv/fenv.h Wed Nov 16 15:21:32 2016 (r308731) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2004-2005 David Schultz - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2016 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -59,11 +59,11 @@ typedef __uint64_t fexcept_t; /* * RISC-V Rounding modes */ -#define FE_TONEAREST (0x00 << 5) -#define FE_TOWARDZERO (0x01 << 5) -#define FE_DOWNWARD (0x02 << 5) -#define FE_UPWARD (0x03 << 5) #define _ROUND_SHIFT 5 +#define FE_TONEAREST (0x00 << _ROUND_SHIFT) +#define FE_TOWARDZERO (0x01 << _ROUND_SHIFT) +#define FE_DOWNWARD (0x02 << _ROUND_SHIFT) +#define FE_UPWARD (0x03 << _ROUND_SHIFT) #define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \ FE_UPWARD | FE_TOWARDZERO) @@ -73,96 +73,117 @@ __BEGIN_DECLS extern const fenv_t __fe_dfl_env; #define FE_DFL_ENV (&__fe_dfl_env) -/* We need to be able to map status flag positions to mask flag positions */ -#define _FPUSW_SHIFT 0 -#define _ENABLE_MASK (FE_ALL_EXCEPT << _FPUSW_SHIFT) - -#define __rfs(__fpsr) __asm __volatile("csrr %0, fcsr" : "=r" (*(__fpsr))) -#define __wfs(__fpsr) __asm __volatile("csrw fcsr, %0" :: "r" (__fpsr)) +#ifndef SOFTFLOAT +#define __rfs(__fcsr) __asm __volatile("csrr %0, fcsr" : "=r" (__fcsr)) +#define __wfs(__fcsr) __asm __volatile("csrw fcsr, %0" :: "r" (__fcsr)) +#endif +#ifdef SOFTFLOAT +int feclearexcept(int __excepts); +int fegetexceptflag(fexcept_t *__flagp, int __excepts); +int fesetexceptflag(const fexcept_t *__flagp, int __excepts); +int feraiseexcept(int __excepts); +int fetestexcept(int __excepts); +int fegetround(void); +int fesetround(int __round); +int fegetenv(fenv_t *__envp); +int feholdexcept(fenv_t *__envp); +int fesetenv(const fenv_t *__envp); +int feupdateenv(const fenv_t *__envp); +#else __fenv_static inline int feclearexcept(int __excepts) { - fexcept_t __fpsr; - __rfs(&__fpsr); - __fpsr &= ~__excepts; - __wfs(__fpsr); + __asm __volatile("csrc fflags, %0" :: "r"(__excepts)); + return (0); } __fenv_static inline int fegetexceptflag(fexcept_t *__flagp, int __excepts) { - fexcept_t __fpsr; + fexcept_t __fcsr; + + __rfs(__fcsr); + *__flagp = __fcsr & __excepts; - __rfs(&__fpsr); - *__flagp = __fpsr & __excepts; return (0); } __fenv_static inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts) { - fexcept_t __fpsr; + fexcept_t __fcsr; + + __fcsr = *__flagp; + __asm __volatile("csrc fflags, %0" :: "r"(__excepts)); + __asm __volatile("csrs fflags, %0" :: "r"(__fcsr & __excepts)); - __rfs(&__fpsr); - __fpsr &= ~__excepts; - __fpsr |= *__flagp & __excepts; - __wfs(__fpsr); return (0); } __fenv_static inline int feraiseexcept(int __excepts) { - fexcept_t __ex = __excepts; - fesetexceptflag(&__ex, __excepts); /* XXX */ + __asm __volatile("csrs fflags, %0" :: "r"(__excepts)); + return (0); } __fenv_static inline int fetestexcept(int __excepts) { - fexcept_t __fpsr; + fexcept_t __fcsr; + + __rfs(__fcsr); - __rfs(&__fpsr); - return (__fpsr & __excepts); + return (__fcsr & __excepts); } __fenv_static inline int fegetround(void) { + fexcept_t __fcsr; - return (-1); + __rfs(__fcsr); + + return (__fcsr & _ROUND_MASK); } __fenv_static inline int fesetround(int __round) { + fexcept_t __fcsr; - return (-1); + if (__round & ~_ROUND_MASK) + return (-1); + + __rfs(__fcsr); + __fcsr &= ~_ROUND_MASK; + __fcsr |= __round; + __wfs(__fcsr); + + return (0); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Nov 16 16:34:18 2016 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 CE6A7C45EAC; Wed, 16 Nov 2016 16:34: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 A9863191D; Wed, 16 Nov 2016 16:34: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 uAGGYHXu031260; Wed, 16 Nov 2016 16:34:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGGYHWC031259; Wed, 16 Nov 2016 16:34:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611161634.uAGGYHWC031259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 16 Nov 2016 16:34:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308733 - head/sys/vm X-SVN-Group: head 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, 16 Nov 2016 16:34:18 -0000 Author: kib Date: Wed Nov 16 16:34:17 2016 New Revision: 308733 URL: https://svnweb.freebsd.org/changeset/base/308733 Log: Move the fast fault path into the separate function. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed Nov 16 16:14:01 2016 (r308732) +++ head/sys/vm/vm_fault.c Wed Nov 16 16:34:17 2016 (r308733) @@ -246,6 +246,48 @@ vm_fault_dirty(vm_map_entry_t entry, vm_ vm_pager_page_unswapped(m); } +static void +vm_fault_fill_hold(vm_page_t *m_hold, vm_page_t m) +{ + + if (m_hold != NULL) { + *m_hold = m; + vm_page_lock(m); + vm_page_hold(m); + vm_page_unlock(m); + } +} + +/* + * Unlocks fs.first_object and fs.map on success. + */ +static int +vm_fault_soft_fast(struct faultstate *fs, vm_offset_t vaddr, vm_prot_t prot, + int fault_type, int fault_flags, boolean_t wired, vm_page_t *m_hold) +{ + vm_page_t m; + int rv; + + MPASS(fs->vp == NULL); + m = vm_page_lookup(fs->first_object, fs->first_pindex); + /* A busy page can be mapped for read|execute access. */ + if (m == NULL || ((prot & VM_PROT_WRITE) != 0 && + vm_page_busied(m)) || m->valid != VM_PAGE_BITS_ALL) + return (KERN_FAILURE); + rv = pmap_enter(fs->map->pmap, vaddr, m, prot, fault_type | + PMAP_ENTER_NOSLEEP | (wired ? PMAP_ENTER_WIRED : 0), 0); + if (rv != KERN_SUCCESS) + return (rv); + vm_fault_fill_hold(m_hold, m); + vm_fault_dirty(fs->entry, m, prot, fault_type, fault_flags, false); + VM_OBJECT_RUNLOCK(fs->first_object); + if (!wired) + vm_fault_prefault(fs, vaddr, PFBAK, PFFOR); + vm_map_lookup_done(fs->map, fs->entry); + curthread->td_ru.ru_minflt++; + return (KERN_SUCCESS); +} + /* * vm_fault: * @@ -294,7 +336,6 @@ vm_fault_hold(vm_map_t map, vm_offset_t struct vnode *vp; vm_object_t next_object, retry_object; vm_offset_t e_end, e_start; - vm_page_t m; vm_pindex_t retry_pindex; vm_prot_t prot, retry_prot; int ahead, alloc_req, behind, cluster_offset, error, era, faultcount; @@ -376,36 +417,15 @@ RetryFault:; (fs.first_object->flags & OBJ_TMPFS_NODE) == 0) || (fs.first_object->flags & OBJ_MIGHTBEDIRTY) != 0)) { VM_OBJECT_RLOCK(fs.first_object); - if ((prot & VM_PROT_WRITE) != 0 && - (fs.first_object->type == OBJT_VNODE || - (fs.first_object->flags & OBJ_TMPFS_NODE) != 0) && - (fs.first_object->flags & OBJ_MIGHTBEDIRTY) == 0) - goto fast_failed; - m = vm_page_lookup(fs.first_object, fs.first_pindex); - /* A busy page can be mapped for read|execute access. */ - if (m == NULL || ((prot & VM_PROT_WRITE) != 0 && - vm_page_busied(m)) || m->valid != VM_PAGE_BITS_ALL) - goto fast_failed; - result = pmap_enter(fs.map->pmap, vaddr, m, prot, - fault_type | PMAP_ENTER_NOSLEEP | (wired ? PMAP_ENTER_WIRED : - 0), 0); - if (result != KERN_SUCCESS) - goto fast_failed; - if (m_hold != NULL) { - *m_hold = m; - vm_page_lock(m); - vm_page_hold(m); - vm_page_unlock(m); - } - vm_fault_dirty(fs.entry, m, prot, fault_type, fault_flags, - false); - VM_OBJECT_RUNLOCK(fs.first_object); - if (!wired) - vm_fault_prefault(&fs, vaddr, PFBAK, PFFOR); - vm_map_lookup_done(fs.map, fs.entry); - curthread->td_ru.ru_minflt++; - return (KERN_SUCCESS); -fast_failed: + if ((prot & VM_PROT_WRITE) == 0 || + (fs.first_object->type != OBJT_VNODE && + (fs.first_object->flags & OBJ_TMPFS_NODE) == 0) || + (fs.first_object->flags & OBJ_MIGHTBEDIRTY) != 0) { + rv = vm_fault_soft_fast(&fs, vaddr, prot, fault_type, + fault_flags, wired, m_hold); + if (rv == KERN_SUCCESS) + return (rv); + } if (!VM_OBJECT_TRYUPGRADE(fs.first_object)) { VM_OBJECT_RUNLOCK(fs.first_object); VM_OBJECT_WLOCK(fs.first_object); From owner-svn-src-head@freebsd.org Wed Nov 16 16:39:53 2016 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 0A4A6C45FB1; Wed, 16 Nov 2016 16:39:53 +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 CA18F1C38; Wed, 16 Nov 2016 16:39:52 +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 uAGGdpX7031478; Wed, 16 Nov 2016 16:39:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGGdpnF031477; Wed, 16 Nov 2016 16:39:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201611161639.uAGGdpnF031477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 16 Nov 2016 16:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308734 - head/usr.sbin/crunch/crunchide X-SVN-Group: head 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, 16 Nov 2016 16:39:53 -0000 Author: emaste Date: Wed Nov 16 16:39:51 2016 New Revision: 308734 URL: https://svnweb.freebsd.org/changeset/base/308734 Log: crunchide: remove obsolete a.out header and comment crunchide(1) gained ELF support in r39172, and lost the unused a.out and non-functional ECOFF suport in r281655. Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/crunch/crunchide/crunchide.c Modified: head/usr.sbin/crunch/crunchide/crunchide.c ============================================================================== --- head/usr.sbin/crunch/crunchide/crunchide.c Wed Nov 16 16:34:17 2016 (r308733) +++ head/usr.sbin/crunch/crunchide/crunchide.c Wed Nov 16 16:39:51 2016 (r308734) @@ -26,7 +26,7 @@ * University of Maryland at College Park */ /* - * crunchide.c - tiptoes through an a.out symbol table, hiding all defined + * crunchide.c - tiptoes through a symbol table, hiding all defined * global symbols. Allows the user to supply a "keep list" of symbols * that are not to be hidden. This program relies on the use of the * linker's -dc flag to actually put global bss data into the file's @@ -73,7 +73,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include "extern.h" From owner-svn-src-head@freebsd.org Wed Nov 16 16:49:23 2016 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 3BB47C452AB; Wed, 16 Nov 2016 16:49:23 +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 0A62B2CC; Wed, 16 Nov 2016 16:49:22 +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 uAGGnMXa035584; Wed, 16 Nov 2016 16:49:22 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGGnLDL035579; Wed, 16 Nov 2016 16:49:21 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611161649.uAGGnLDL035579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 16 Nov 2016 16:49:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308735 - in head/tools/tools/nanobsd: . pcengines X-SVN-Group: head 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, 16 Nov 2016 16:49:23 -0000 Author: imp Date: Wed Nov 16 16:49:21 2016 New Revision: 308735 URL: https://svnweb.freebsd.org/changeset/base/308735 Log: Start to move the old interface into a legacy file. Added: head/tools/tools/nanobsd/legacy.sh (contents, props changed) Modified: head/tools/tools/nanobsd/defaults.sh head/tools/tools/nanobsd/nanobsd.sh head/tools/tools/nanobsd/pcengines/common.conf Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Wed Nov 16 16:39:51 2016 (r308734) +++ head/tools/tools/nanobsd/defaults.sh Wed Nov 16 16:49:21 2016 (r308735) @@ -132,10 +132,6 @@ NANO_RAM_ETCSIZE=10240 # Size of the /tmp+/var ramdisk in 512 bytes sectors NANO_RAM_TMPVARSIZE=10240 -# Media geometry, only relevant if bios doesn't understand LBA. -NANO_SECTS=63 -NANO_HEADS=16 - # boot0 flags/options and configuration NANO_BOOT0CFG="-o packet -s 1 -m 3" NANO_BOOTLOADER="boot/boot0sio" @@ -652,173 +648,6 @@ populate_data_slice ( ) ( populate_slice "$1" "$2" "$3" "$4" ) -create_diskimage ( ) ( - pprint 2 "build diskimage" - pprint 3 "log: ${NANO_LOG}/_.di" - - ( - echo $NANO_MEDIASIZE $NANO_IMAGES \ - $NANO_SECTS $NANO_HEADS \ - $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | - awk ' - { - printf "# %s\n", $0 - - # size of cylinder in sectors - cs = $3 * $4 - - # number of full cylinders on media - cyl = int ($1 / cs) - - # output fdisk geometry spec, truncate cyls to 1023 - if (cyl <= 1023) - print "g c" cyl " h" $4 " s" $3 - else - print "g c" 1023 " h" $4 " s" $3 - - if ($7 > 0) { - # size of data partition in full cylinders - dsl = int (($7 + cs - 1) / cs) - } else { - dsl = 0; - } - - # size of config partition in full cylinders - csl = int (($6 + cs - 1) / cs) - - if ($5 == 0) { - # size of image partition(s) in full cylinders - isl = int ((cyl - dsl - csl) / $2) - } else { - isl = int (($5 + cs - 1) / cs) - } - - # First image partition start at second track - print "p 1 165 " $3, isl * cs - $3 - c = isl * cs; - - # Second image partition (if any) also starts offset one - # track to keep them identical. - if ($2 > 1) { - print "p 2 165 " $3 + c, isl * cs - $3 - c += isl * cs; - } - - # Config partition starts at cylinder boundary. - print "p 3 165 " c, csl * cs - c += csl * cs - - # Data partition (if any) starts at cylinder boundary. - if ($7 > 0) { - print "p 4 165 " c, dsl * cs - } else if ($7 < 0 && $1 > c) { - print "p 4 165 " c, $1 - c - } else if ($1 < c) { - print "Disk space overcommitted by", \ - c - $1, "sectors" > "/dev/stderr" - exit 2 - } - - # Force slice 1 to be marked active. This is necessary - # for booting the image from a USB device to work. - print "a 1" - } - ' > ${NANO_LOG}/_.fdisk - - IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} - MNT=${NANO_OBJ}/_.mnt - mkdir -p ${MNT} - - if [ "${NANO_MD_BACKING}" = "swap" ] ; then - MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` - else - echo "Creating md backing file..." - rm -f ${IMG} - dd if=/dev/zero of=${IMG} seek=${NANO_MEDIASIZE} count=0 - MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` - fi - - trap "echo 'Running exit trap code' ; df -i ${MNT} ; nano_umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT - - fdisk -i -f ${NANO_LOG}/_.fdisk ${MD} - fdisk ${MD} - # XXX: params - # XXX: pick up cached boot* files, they may not be in image anymore. - if [ -f ${NANO_WORLDDIR}/${NANO_BOOTLOADER} ]; then - boot0cfg -B -b ${NANO_WORLDDIR}/${NANO_BOOTLOADER} ${NANO_BOOT0CFG} ${MD} - fi - if [ -f ${NANO_WORLDDIR}/boot/boot ]; then - bsdlabel -w -B -b ${NANO_WORLDDIR}/boot/boot ${MD}${NANO_SLICE_ROOT} - else - bsdlabel -w ${MD}${NANO_SLICE_ROOT} - fi - bsdlabel ${MD}${NANO_SLICE_ROOT} - - # Create first image - populate_slice /dev/${MD}${NANO_ROOT} ${NANO_WORLDDIR} ${MNT} "${NANO_ROOT}" - mount /dev/${MD}${NANO_ROOT} ${MNT} - echo "Generating mtree..." - ( cd "${MNT}" && mtree -c ) > ${NANO_LOG}/_.mtree - ( cd "${MNT}" && du -k ) > ${NANO_LOG}/_.du - nano_umount "${MNT}" - - if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then - # Duplicate to second image (if present) - echo "Duplicating to second image..." - dd conv=sparse if=/dev/${MD}${NANO_SLICE_ROOT} of=/dev/${MD}${NANO_SLICE_ALTROOT} bs=64k - mount /dev/${MD}${NANO_ALTROOT} ${MNT} - for f in ${MNT}/etc/fstab ${MNT}/conf/base/etc/fstab - do - sed -i "" "s=${NANO_DRIVE}${NANO_SLICE_ROOT}=${NANO_DRIVE}${NANO_SLICE_ALTROOT}=g" $f - done - nano_umount ${MNT} - # Override the label from the first partition so we - # don't confuse glabel with duplicates. - if [ -n "${NANO_LABEL}" ]; then - tunefs -L ${NANO_LABEL}"${NANO_ALTROOT}" /dev/${MD}${NANO_ALTROOT} - fi - fi - - # Create Config slice - populate_cfg_slice /dev/${MD}${NANO_SLICE_CFG} "${NANO_CFGDIR}" ${MNT} "${NANO_SLICE_CFG}" - - # Create Data slice, if any. - if [ -n "$NANO_SLICE_DATA" -a "$NANO_SLICE_CFG" = "$NANO_SLICE_DATA" -a \ - "$NANO_DATASIZE" -ne 0 ]; then - pprint 2 "NANO_SLICE_DATA is the same as NANO_SLICE_CFG, fix." - exit 2 - fi - if [ $NANO_DATASIZE -ne 0 -a -n "$NANO_SLICE_DATA" ] ; then - populate_data_slice /dev/${MD}${NANO_SLICE_DATA} "${NANO_DATADIR}" ${MNT} "${NANO_SLICE_DATA}" - fi - - if [ "${NANO_MD_BACKING}" = "swap" ] ; then - if [ ${NANO_IMAGE_MBRONLY} ]; then - echo "Writing out _.disk.mbr..." - dd if=/dev/${MD} of=${NANO_DISKIMGDIR}/_.disk.mbr bs=512 count=1 - else - echo "Writing out ${NANO_IMGNAME}..." - dd if=/dev/${MD} of=${IMG} bs=64k - fi - - echo "Writing out ${NANO_IMGNAME}..." - dd conv=sparse if=/dev/${MD} of=${IMG} bs=64k - fi - - if ${do_copyout_partition} ; then - echo "Writing out _.disk.image..." - dd conv=sparse if=/dev/${MD}${NANO_SLICE_ROOT} of=${NANO_DISKIMGDIR}/_.disk.image bs=64k - fi - mdconfig -d -u $MD - - trap - 1 2 15 - trap nano_cleanup EXIT - - ) > ${NANO_LOG}/_.di 2>&1 -) - last_orders ( ) ( # Redefine this function with any last orders you may have # after the build completed, for instance to copy the finished Added: head/tools/tools/nanobsd/legacy.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/nanobsd/legacy.sh Wed Nov 16 16:49:21 2016 (r308735) @@ -0,0 +1,203 @@ +#!/bin/sh +# +# Copyright (c) 2005 Poul-Henning Kamp. +# Copyright (c) 2016 M. Warner Losh. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# Media geometry, only relevant if bios doesn't understand LBA. +[ -z "$NANO_SECTS" ] || NANO_SECTS=63 +[ -z "$NANO_HEADS" ] || NANO_HEADS=16 + +# Functions and variable definitions used by the legacy nanobsd +# image building system. + +create_diskimage ( ) ( + pprint 2 "build diskimage" + pprint 3 "log: ${NANO_LOG}/_.di" + + ( + echo $NANO_MEDIASIZE $NANO_IMAGES \ + $NANO_SECTS $NANO_HEADS \ + $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | + awk ' + { + printf "# %s\n", $0 + + # size of cylinder in sectors + cs = $3 * $4 + + # number of full cylinders on media + cyl = int ($1 / cs) + + # output fdisk geometry spec, truncate cyls to 1023 + if (cyl <= 1023) + print "g c" cyl " h" $4 " s" $3 + else + print "g c" 1023 " h" $4 " s" $3 + + if ($7 > 0) { + # size of data partition in full cylinders + dsl = int (($7 + cs - 1) / cs) + } else { + dsl = 0; + } + + # size of config partition in full cylinders + csl = int (($6 + cs - 1) / cs) + + if ($5 == 0) { + # size of image partition(s) in full cylinders + isl = int ((cyl - dsl - csl) / $2) + } else { + isl = int (($5 + cs - 1) / cs) + } + + # First image partition start at second track + print "p 1 165 " $3, isl * cs - $3 + c = isl * cs; + + # Second image partition (if any) also starts offset one + # track to keep them identical. + if ($2 > 1) { + print "p 2 165 " $3 + c, isl * cs - $3 + c += isl * cs; + } + + # Config partition starts at cylinder boundary. + print "p 3 165 " c, csl * cs + c += csl * cs + + # Data partition (if any) starts at cylinder boundary. + if ($7 > 0) { + print "p 4 165 " c, dsl * cs + } else if ($7 < 0 && $1 > c) { + print "p 4 165 " c, $1 - c + } else if ($1 < c) { + print "Disk space overcommitted by", \ + c - $1, "sectors" > "/dev/stderr" + exit 2 + } + + # Force slice 1 to be marked active. This is necessary + # for booting the image from a USB device to work. + print "a 1" + } + ' > ${NANO_LOG}/_.fdisk + + IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} + MNT=${NANO_OBJ}/_.mnt + mkdir -p ${MNT} + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + else + echo "Creating md backing file..." + rm -f ${IMG} + dd if=/dev/zero of=${IMG} seek=${NANO_MEDIASIZE} count=0 + MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + fi + + trap "echo 'Running exit trap code' ; df -i ${MNT} ; nano_umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT + + fdisk -i -f ${NANO_LOG}/_.fdisk ${MD} + fdisk ${MD} + # XXX: params + # XXX: pick up cached boot* files, they may not be in image anymore. + if [ -f ${NANO_WORLDDIR}/${NANO_BOOTLOADER} ]; then + boot0cfg -B -b ${NANO_WORLDDIR}/${NANO_BOOTLOADER} ${NANO_BOOT0CFG} ${MD} + fi + if [ -f ${NANO_WORLDDIR}/boot/boot ]; then + bsdlabel -w -B -b ${NANO_WORLDDIR}/boot/boot ${MD}${NANO_SLICE_ROOT} + else + bsdlabel -w ${MD}${NANO_SLICE_ROOT} + fi + bsdlabel ${MD}${NANO_SLICE_ROOT} + + # Create first image + populate_slice /dev/${MD}${NANO_ROOT} ${NANO_WORLDDIR} ${MNT} "${NANO_ROOT}" + mount /dev/${MD}${NANO_ROOT} ${MNT} + echo "Generating mtree..." + ( cd "${MNT}" && mtree -c ) > ${NANO_LOG}/_.mtree + ( cd "${MNT}" && du -k ) > ${NANO_LOG}/_.du + nano_umount "${MNT}" + + if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then + # Duplicate to second image (if present) + echo "Duplicating to second image..." + dd conv=sparse if=/dev/${MD}${NANO_SLICE_ROOT} of=/dev/${MD}${NANO_SLICE_ALTROOT} bs=64k + mount /dev/${MD}${NANO_ALTROOT} ${MNT} + for f in ${MNT}/etc/fstab ${MNT}/conf/base/etc/fstab + do + sed -i "" "s=${NANO_DRIVE}${NANO_SLICE_ROOT}=${NANO_DRIVE}${NANO_SLICE_ALTROOT}=g" $f + done + nano_umount ${MNT} + # Override the label from the first partition so we + # don't confuse glabel with duplicates. + if [ -n "${NANO_LABEL}" ]; then + tunefs -L ${NANO_LABEL}"${NANO_ALTROOT}" /dev/${MD}${NANO_ALTROOT} + fi + fi + + # Create Config slice + populate_cfg_slice /dev/${MD}${NANO_SLICE_CFG} "${NANO_CFGDIR}" ${MNT} "${NANO_SLICE_CFG}" + + # Create Data slice, if any. + if [ -n "$NANO_SLICE_DATA" -a "$NANO_SLICE_CFG" = "$NANO_SLICE_DATA" -a \ + "$NANO_DATASIZE" -ne 0 ]; then + pprint 2 "NANO_SLICE_DATA is the same as NANO_SLICE_CFG, fix." + exit 2 + fi + if [ $NANO_DATASIZE -ne 0 -a -n "$NANO_SLICE_DATA" ] ; then + populate_data_slice /dev/${MD}${NANO_SLICE_DATA} "${NANO_DATADIR}" ${MNT} "${NANO_SLICE_DATA}" + fi + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + if [ ${NANO_IMAGE_MBRONLY} ]; then + echo "Writing out _.disk.mbr..." + dd if=/dev/${MD} of=${NANO_DISKIMGDIR}/_.disk.mbr bs=512 count=1 + else + echo "Writing out ${NANO_IMGNAME}..." + dd if=/dev/${MD} of=${IMG} bs=64k + fi + + echo "Writing out ${NANO_IMGNAME}..." + dd conv=sparse if=/dev/${MD} of=${IMG} bs=64k + fi + + if ${do_copyout_partition} ; then + echo "Writing out _.disk.image..." + dd conv=sparse if=/dev/${MD}${NANO_SLICE_ROOT} of=${NANO_DISKIMGDIR}/_.disk.image bs=64k + fi + mdconfig -d -u $MD + + trap - 1 2 15 + trap nano_cleanup EXIT + + ) > ${NANO_LOG}/_.di 2>&1 +) Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Wed Nov 16 16:39:51 2016 (r308734) +++ head/tools/tools/nanobsd/nanobsd.sh Wed Nov 16 16:49:21 2016 (r308735) @@ -43,6 +43,9 @@ do_world=true do_image=true do_copyout_partition=true do_native_xtools=false +# Don't do the legacy build unless we detect 'old' variables being +# set. +do_legacy=false set +e args=`getopt KXbc:fhiknqvw $*` @@ -121,6 +124,15 @@ if [ $# -gt 0 ] ; then usage fi +if [ -n "$NANO_HEADS" -o -n "$NANO_SECTS" ]; then + do_legacy=true +fi + +# If this uses the old, legacy image system, pull that in as well +if $do_legacy ; then + . "${topdir}/legacy.sh" +fi + ####################################################################### # And then it is as simple as that... Modified: head/tools/tools/nanobsd/pcengines/common.conf ============================================================================== --- head/tools/tools/nanobsd/pcengines/common.conf Wed Nov 16 16:39:51 2016 (r308734) +++ head/tools/tools/nanobsd/pcengines/common.conf Wed Nov 16 16:49:21 2016 (r308735) @@ -21,7 +21,7 @@ NO_CLEAN=YES # Options to put in make.conf during installworld only CONF_INSTALL=' ' -# Options to put in make.conf during both build- & installworld. +# Options to put in make.conf during both build- & installworld. CONF_WORLD=' CFLAGS=-O -pipe WITHOUT_ACPI= From owner-svn-src-head@freebsd.org Wed Nov 16 16:54:03 2016 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 C23D0C45456; Wed, 16 Nov 2016 16:54:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::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 11B40996; Wed, 16 Nov 2016 16:54:02 +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 uAGGrh7s082988 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 16 Nov 2016 18:53:43 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua uAGGrh7s082988 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id uAGGrh7H082987; Wed, 16 Nov 2016 18:53:43 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 16 Nov 2016 18:53:43 +0200 From: Konstantin Belousov To: Ruslan Bukin Cc: Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-ID: <20161116165343.GX54029@kib.kiev.ua> References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161116133718.GA10251@bsdpad.com> User-Agent: Mutt/1.7.1 (2016-10-04) 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: Wed, 16 Nov 2016 16:54:03 -0000 On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: > I have a panic with this on RISC-V. Any ideas ? How did you checked that the revision you replied to, makes the problem ? Note that the backtrace below is not reasonable. > > vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv > vvvvvvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv > rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv > rr vvvvvvvvvvvvvvvvvvvvvv > rr vvvvvvvvvvvvvvvvvvvvvvvv rr > rrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrr > rrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrr > rrrrrrrr vvvvvvvvvvvvvvvvvv rrrrrrrr > rrrrrrrrrr vvvvvvvvvvvvvv rrrrrrrrrr > rrrrrrrrrrrr vvvvvvvvvv rrrrrrrrrrrr > rrrrrrrrrrrrrr vvvvvv rrrrrrrrrrrrrr > rrrrrrrrrrrrrrrr vv rrrrrrrrrrrrrrrr > rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr > rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr > rrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr > > INSTRUCTION SETS WANT TO BE FREE > KDB: debugger backends: ddb > KDB: current backend: ddb > Found 2 CPUs in the device tree > Copyright (c) 1992-2016 The FreeBSD Project. > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 > The Regents of the University of California. All rights reserved. > FreeBSD is a registered trademark of The FreeBSD Foundation. > FreeBSD 12.0-CURRENT #4 0a3288b(br-riscv-isa-update)-dirty: Wed Nov 16 13:28:11 UTC 2016 > rb743@vica.cl.cam.ac.uk:/home/rb743/obj/riscv.riscv64/home/rb743/dev/freebsd-riscv/sys/SPIKE riscv > gcc version 6.1.0 (GCC) > Preloaded elf64 kernel "kernel" at 0xffffffc0026be360. > CPU(0): Unknown Implementer Unknown Processor > Starting CPU 1 (0) > FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs > ULE: setup cpu 0 > ULE: setup cpu 1 > random: entropy device external interface > crypto: > mem: > openfirm: > null: > nfslock: pseudo-device > random: harvesting attach, 8 bytes (4 bits) from nexus0 > ofwbus0: > simplebus0: on ofwbus0 > random: harvesting attach, 8 bytes (4 bits) from simplebus0 > random: harvesting attach, 8 bytes (4 bits) from ofwbus0 > timer0: mem 0x40000000-0x40000007,0x40000008-0x40001007 irq 5 on simplebus0 > Timecounter "RISC-V Timecounter" frequency 1000000 Hz quality 1000 > Event timer "RISC-V Eventtimer" frequency 1000000 Hz quality 1000 > random: harvesting attach, 8 bytes (4 bits) from timer0 > cpulist0: on ofwbus0 > cpu0: on cpulist0 > cpu0: missing 'clock-frequency' property > riscv64_cpu0: register <0> > random: harvesting attach, 8 bytes (4 bits) from riscv64_cpu0 > random: harvesting attach, 8 bytes (4 bits) from cpu0 > cpu1: on cpulist0 > cpu1: missing 'clock-frequency' property > riscv64_cpu1: register <0> > random: harvesting attach, 8 bytes (4 bits) from riscv64_cpu1 > random: harvesting attach, 8 bytes (4 bits) from cpu1 > random: harvesting attach, 8 bytes (4 bits) from cpulist0 > simplebus0: compat riscv,pic (no driver attached) > rcons0: irq 1 on simplebus0 > random: harvesting attach, 8 bytes (4 bits) from rcons0 > cryptosoft0: > crypto: assign cryptosoft0 driver id 0, flags 100663296 > crypto: cryptosoft0 registers alg 1 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 2 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 3 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 4 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 5 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 16 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 6 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 7 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 18 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 19 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 20 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 8 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 15 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 9 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 10 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 13 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 14 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 11 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 22 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 23 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 25 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 24 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 26 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 27 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 28 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 21 flags 0 maxoplen 0 > crypto: cryptosoft0 registers alg 17 flags 0 maxoplen 0 > random: harvesting attach, 8 bytes (4 bits) from cryptosoft0 > Device configuration finished. > procfs registered > Timecounters tick every 1.000 msec > lo0: bpf attached > vlan: initialized, using hash tables with chaining > tcp_init: net.inet.tcp.tcbhashsize auto tuned to 8192 > IPsec: Initialized Security Association Processing. > t[0] == 0xffffffc00265bf50 > t[1] == 0xffffffc00016494c > t[2] == 0x0000000000000050 > t[3] == 0x0000000000000000 > t[4] == 0x0000000000000000 > t[5] == 0x0000000000000000 > t[6] == 0x0000000000000000 > s[0] == 0xffffffc000003db0 > s[1] == 0x0000000000000000 > s[2] == 0xffffffc002c4c510 > s[3] == 0xffffffc002cea9c0 > s[4] == 0x000000000098967f > s[5] == 0x00000000039386ff > s[6] == 0xffffffc000574778 > s[7] == 0x0000000000000000 > s[8] == 0xffffffc00267c580 > s[9] == 0xffffffc000531218 > s[10] == 0x0000000000000412 > s[11] == 0x0000000000000000 > a[0] == 0x0000000000000000 > a[1] == 0x0000000000000000 > a[2] == 0xffffffc000531218 > a[3] == 0x0000000000000412 > a[4] == 0xffffffc00267c580 > a[5] == 0x0000000000000002 > a[6] == 0x0000000000000000 > a[7] == 0x0000000000000003 > sepc == 0xffffffc00013deac > sstatus == 0x8000000000006100 > panic: vm_fault failed: ffffffc00013deac, va 0x0000000000000018 > cpuid = 0 > KDB: stack backtrace: > db_trace_self() at db_read_token+0x704 > pc = 0xffffffc000455b44 ra = 0xffffffc0000244f8 > sp = 0xffffffc000003858 fp = 0xffffffc000003a78 > > db_read_token() at kdb_backtrace+0x3c > pc = 0xffffffc0000244f8 ra = 0xffffffc0001a5588 > sp = 0xffffffc000003a78 fp = 0xffffffc000003a88 > > kdb_backtrace() at vpanic+0x158 > pc = 0xffffffc0001a5588 ra = 0xffffffc00015bd74 > sp = 0xffffffc000003a88 fp = 0xffffffc000003ac8 > > vpanic() at panic+0x34 > pc = 0xffffffc00015bd74 ra = 0xffffffc00015c58c > sp = 0xffffffc000003ac8 fp = 0xffffffc000003ae8 > > panic() at sysarch+0x36c > pc = 0xffffffc00015c58c ra = 0xffffffc0004622b0 > sp = 0xffffffc000003ae8 fp = 0xffffffc000003bf8 > > sysarch() at do_trap_supervisor+0xa0 > pc = 0xffffffc0004622b0 ra = 0xffffffc000462498 > sp = 0xffffffc000003bf8 fp = 0xffffffc000003c18 > > do_trap_supervisor() at cpu_exception_handler_supervisor+0xb0 > pc = 0xffffffc000462498 ra = 0xffffffc000456440 > sp = 0xffffffc000003c18 fp = 0xffffffc000003db0 > > cpu_exception_handler_supervisor() at ruxagg+0x34 > pc = 0xffffffc000456440 ra = 0xffffffc000154458 > sp = 0xffffffc000003db0 fp = 0xffffffc000003dd0 > > ruxagg() at rufetch+0x9c > pc = 0xffffffc000154458 ra = 0xffffffc000154784 > sp = 0xffffffc000003dd0 fp = 0xffffffc000003e00 > > rufetch() at exec_shell_imgact+0x1204 > pc = 0xffffffc000154784 ra = 0xffffffc0000f9d4c > sp = 0xffffffc000003e00 fp = 0xffffffc000003ee0 > > exec_shell_imgact() at mi_startup+0x190 > pc = 0xffffffc0000f9d4c ra = 0xffffffc0000fa768 > sp = 0xffffffc000003ee0 fp = 0xffffffc000003f20 > > mi_startup() at kernbase+0x248 > pc = 0xffffffc0000fa768 ra = 0xffffffc000000248 > sp = 0xffffffc000003f20 fp = 0x0000000085002ff8 > > KDB: enter: panic > [ thread pid 0 tid 100000 ] > Stopped at kdb_enter+0x4c: > db> > > Ruslan > > On Tue, Nov 15, 2016 at 06:22:50PM +0000, Alan Cox wrote: > > Author: alc > > Date: Tue Nov 15 18:22:50 2016 > > New Revision: 308691 > > URL: https://svnweb.freebsd.org/changeset/base/308691 > > > > Log: > > Remove most of the code for implementing PG_CACHED pages. (This change does > > not remove user-space visible fields from vm_cnt or all of the references to > > cached pages from comments. Those changes will come later.) > > > > Reviewed by: kib, markj > > Tested by: pho > > Sponsored by: Dell EMC Isilon > > Differential Revision: https://reviews.freebsd.org/D8497 > > > > Modified: > > head/sys/cddl/compat/opensolaris/sys/vnode.h > > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > > head/sys/fs/tmpfs/tmpfs_subr.c > > head/sys/kern/kern_exec.c > > head/sys/kern/uipc_shm.c > > head/sys/vm/swap_pager.c > > head/sys/vm/vm_fault.c > > head/sys/vm/vm_mmap.c > > head/sys/vm/vm_object.c > > head/sys/vm/vm_object.h > > head/sys/vm/vm_page.c > > head/sys/vm/vm_page.h > > head/sys/vm/vm_reserv.c > > head/sys/vm/vm_reserv.h > > head/sys/vm/vnode_pager.c > > > > Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h > > ============================================================================== > > --- head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 15 18:22:50 2016 (r308691) > > @@ -75,8 +75,7 @@ vn_is_readonly(vnode_t *vp) > > #define vn_mountedvfs(vp) ((vp)->v_mountedhere) > > #define vn_has_cached_data(vp) \ > > ((vp)->v_object != NULL && \ > > - ((vp)->v_object->resident_page_count > 0 || \ > > - !vm_object_cache_is_empty((vp)->v_object))) > > + (vp)->v_object->resident_page_count > 0) > > #define vn_exists(vp) do { } while (0) > > #define vn_invalid(vp) do { } while (0) > > #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0) > > > > 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 Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -426,10 +426,6 @@ page_busy(vnode_t *vp, int64_t start, in > > continue; > > } > > vm_page_sbusy(pp); > > - } else if (pp == NULL) { > > - pp = vm_page_alloc(obj, OFF_TO_IDX(start), > > - VM_ALLOC_SYSTEM | VM_ALLOC_IFCACHED | > > - VM_ALLOC_SBUSY); > > } else { > > ASSERT(pp != NULL && !pp->valid); > > pp = NULL; > > > > Modified: head/sys/fs/tmpfs/tmpfs_subr.c > > ============================================================================== > > --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -1372,12 +1372,9 @@ retry: > > VM_WAIT; > > VM_OBJECT_WLOCK(uobj); > > goto retry; > > - } else if (m->valid != VM_PAGE_BITS_ALL) > > - rv = vm_pager_get_pages(uobj, &m, 1, > > - NULL, NULL); > > - else > > - /* A cached page was reactivated. */ > > - rv = VM_PAGER_OK; > > + } > > + rv = vm_pager_get_pages(uobj, &m, 1, NULL, > > + NULL); > > vm_page_lock(m); > > if (rv == VM_PAGER_OK) { > > vm_page_deactivate(m); > > > > Modified: head/sys/kern/kern_exec.c > > ============================================================================== > > --- head/sys/kern/kern_exec.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/kern/kern_exec.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -1006,7 +1006,7 @@ exec_map_first_page(imgp) > > break; > > } else { > > ma[i] = vm_page_alloc(object, i, > > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > > + VM_ALLOC_NORMAL); > > if (ma[i] == NULL) > > break; > > } > > > > Modified: head/sys/kern/uipc_shm.c > > ============================================================================== > > --- head/sys/kern/uipc_shm.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/kern/uipc_shm.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -455,12 +455,9 @@ retry: > > VM_WAIT; > > VM_OBJECT_WLOCK(object); > > goto retry; > > - } else if (m->valid != VM_PAGE_BITS_ALL) > > - rv = vm_pager_get_pages(object, &m, 1, > > - NULL, NULL); > > - else > > - /* A cached page was reactivated. */ > > - rv = VM_PAGER_OK; > > + } > > + rv = vm_pager_get_pages(object, &m, 1, NULL, > > + NULL); > > vm_page_lock(m); > > if (rv == VM_PAGER_OK) { > > vm_page_deactivate(m); > > > > Modified: head/sys/vm/swap_pager.c > > ============================================================================== > > --- head/sys/vm/swap_pager.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/swap_pager.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -1126,7 +1126,7 @@ swap_pager_getpages(vm_object_t object, > > if (shift != 0) { > > for (i = 1; i <= shift; i++) { > > p = vm_page_alloc(object, m[0]->pindex - i, > > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > > + VM_ALLOC_NORMAL); > > if (p == NULL) { > > /* Shift allocated pages to the left. */ > > for (j = 0; j < i - 1; j++) > > @@ -1144,8 +1144,7 @@ swap_pager_getpages(vm_object_t object, > > if (rahead != NULL) { > > for (i = 0; i < *rahead; i++) { > > p = vm_page_alloc(object, > > - m[reqcount - 1]->pindex + i + 1, > > - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); > > + m[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); > > if (p == NULL) > > break; > > bp->b_pages[shift + reqcount + i] = p; > > > > Modified: head/sys/vm/vm_fault.c > > ============================================================================== > > --- head/sys/vm/vm_fault.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_fault.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -559,8 +559,7 @@ fast_failed: > > unlock_and_deallocate(&fs); > > VM_WAITPFAULT; > > goto RetryFault; > > - } else if (fs.m->valid == VM_PAGE_BITS_ALL) > > - break; > > + } > > } > > > > readrest: > > > > Modified: head/sys/vm/vm_mmap.c > > ============================================================================== > > --- head/sys/vm/vm_mmap.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_mmap.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -877,9 +877,6 @@ RestartScan: > > pindex = OFF_TO_IDX(current->offset + > > (addr - current->start)); > > m = vm_page_lookup(object, pindex); > > - if (m == NULL && > > - vm_page_is_cached(object, pindex)) > > - mincoreinfo = MINCORE_INCORE; > > if (m != NULL && m->valid == 0) > > m = NULL; > > if (m != NULL) > > > > Modified: head/sys/vm/vm_object.c > > ============================================================================== > > --- head/sys/vm/vm_object.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_object.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -178,9 +178,6 @@ vm_object_zdtor(void *mem, int size, voi > > ("object %p has reservations", > > object)); > > #endif > > - KASSERT(vm_object_cache_is_empty(object), > > - ("object %p has cached pages", > > - object)); > > KASSERT(object->paging_in_progress == 0, > > ("object %p paging_in_progress = %d", > > object, object->paging_in_progress)); > > @@ -212,8 +209,6 @@ vm_object_zinit(void *mem, int size, int > > object->paging_in_progress = 0; > > object->resident_page_count = 0; > > object->shadow_count = 0; > > - object->cache.rt_root = 0; > > - object->cache.rt_flags = 0; > > > > mtx_lock(&vm_object_list_mtx); > > TAILQ_INSERT_TAIL(&vm_object_list, object, object_list); > > @@ -792,8 +787,6 @@ vm_object_terminate(vm_object_t object) > > if (__predict_false(!LIST_EMPTY(&object->rvq))) > > vm_reserv_break_all(object); > > #endif > > - if (__predict_false(!vm_object_cache_is_empty(object))) > > - vm_page_cache_free(object, 0, 0); > > > > KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || > > object->type == OBJT_SWAP, > > @@ -1135,13 +1128,6 @@ shadowlookup: > > } else if ((tobject->flags & OBJ_UNMANAGED) != 0) > > goto unlock_tobject; > > m = vm_page_lookup(tobject, tpindex); > > - if (m == NULL && advise == MADV_WILLNEED) { > > - /* > > - * If the page is cached, reactivate it. > > - */ > > - m = vm_page_alloc(tobject, tpindex, VM_ALLOC_IFCACHED | > > - VM_ALLOC_NOBUSY); > > - } > > if (m == NULL) { > > /* > > * There may be swap even if there is no backing page > > @@ -1406,19 +1392,6 @@ retry: > > swap_pager_copy(orig_object, new_object, offidxstart, 0); > > TAILQ_FOREACH(m, &new_object->memq, listq) > > vm_page_xunbusy(m); > > - > > - /* > > - * Transfer any cached pages from orig_object to new_object. > > - * If swap_pager_copy() found swapped out pages within the > > - * specified range of orig_object, then it changed > > - * new_object's type to OBJT_SWAP when it transferred those > > - * pages to new_object. Otherwise, new_object's type > > - * should still be OBJT_DEFAULT and orig_object should not > > - * contain any cached pages within the specified range. > > - */ > > - if (__predict_false(!vm_object_cache_is_empty(orig_object))) > > - vm_page_cache_transfer(orig_object, offidxstart, > > - new_object); > > } > > VM_OBJECT_WUNLOCK(orig_object); > > VM_OBJECT_WUNLOCK(new_object); > > @@ -1754,13 +1727,6 @@ vm_object_collapse(vm_object_t object) > > backing_object, > > object, > > OFF_TO_IDX(object->backing_object_offset), TRUE); > > - > > - /* > > - * Free any cached pages from backing_object. > > - */ > > - if (__predict_false( > > - !vm_object_cache_is_empty(backing_object))) > > - vm_page_cache_free(backing_object, 0, 0); > > } > > /* > > * Object now shadows whatever backing_object did. > > @@ -1889,7 +1855,7 @@ vm_object_page_remove(vm_object_t object > > (options & (OBJPR_CLEANONLY | OBJPR_NOTMAPPED)) == OBJPR_NOTMAPPED, > > ("vm_object_page_remove: illegal options for object %p", object)); > > if (object->resident_page_count == 0) > > - goto skipmemq; > > + return; > > vm_object_pip_add(object, 1); > > again: > > p = vm_page_find_least(object, start); > > @@ -1946,9 +1912,6 @@ next: > > vm_page_unlock(p); > > } > > vm_object_pip_wakeup(object); > > -skipmemq: > > - if (__predict_false(!vm_object_cache_is_empty(object))) > > - vm_page_cache_free(object, start, end); > > } > > > > /* > > > > Modified: head/sys/vm/vm_object.h > > ============================================================================== > > --- head/sys/vm/vm_object.h Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_object.h Tue Nov 15 18:22:50 2016 (r308691) > > @@ -118,7 +118,6 @@ struct vm_object { > > vm_ooffset_t backing_object_offset;/* Offset in backing object */ > > TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ > > LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ > > - struct vm_radix cache; /* (o + f) root of the cache page radix trie */ > > void *handle; > > union { > > /* > > @@ -290,13 +289,6 @@ void vm_object_pip_wakeup(vm_object_t ob > > void vm_object_pip_wakeupn(vm_object_t object, short i); > > void vm_object_pip_wait(vm_object_t object, char *waitid); > > > > -static __inline boolean_t > > -vm_object_cache_is_empty(vm_object_t object) > > -{ > > - > > - return (vm_radix_is_empty(&object->cache)); > > -} > > - > > void umtx_shm_object_init(vm_object_t object); > > void umtx_shm_object_terminated(vm_object_t object); > > extern int umtx_shm_vnobj_persistent; > > > > Modified: head/sys/vm/vm_page.c > > ============================================================================== > > --- head/sys/vm/vm_page.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_page.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -154,8 +154,7 @@ static int vm_pageout_pages_needed; > > > > static uma_zone_t fakepg_zone; > > > > -static struct vnode *vm_page_alloc_init(vm_page_t m); > > -static void vm_page_cache_turn_free(vm_page_t m); > > +static void vm_page_alloc_check(vm_page_t m); > > static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); > > static void vm_page_enqueue(uint8_t queue, vm_page_t m); > > static void vm_page_free_wakeup(void); > > @@ -1118,9 +1117,7 @@ void > > vm_page_dirty_KBI(vm_page_t m) > > { > > > > - /* These assertions refer to this operation by its public name. */ > > - KASSERT((m->flags & PG_CACHED) == 0, > > - ("vm_page_dirty: page in cache!")); > > + /* Refer to this operation by its public name. */ > > KASSERT(m->valid == VM_PAGE_BITS_ALL, > > ("vm_page_dirty: page is invalid!")); > > m->dirty = VM_PAGE_BITS_ALL; > > @@ -1459,142 +1456,6 @@ vm_page_rename(vm_page_t m, vm_object_t > > } > > > > /* > > - * Convert all of the given object's cached pages that have a > > - * pindex within the given range into free pages. If the value > > - * zero is given for "end", then the range's upper bound is > > - * infinity. If the given object is backed by a vnode and it > > - * transitions from having one or more cached pages to none, the > > - * vnode's hold count is reduced. > > - */ > > -void > > -vm_page_cache_free(vm_object_t object, vm_pindex_t start, vm_pindex_t end) > > -{ > > - vm_page_t m; > > - boolean_t empty; > > - > > - mtx_lock(&vm_page_queue_free_mtx); > > - if (__predict_false(vm_radix_is_empty(&object->cache))) { > > - mtx_unlock(&vm_page_queue_free_mtx); > > - return; > > - } > > - while ((m = vm_radix_lookup_ge(&object->cache, start)) != NULL) { > > - if (end != 0 && m->pindex >= end) > > - break; > > - vm_radix_remove(&object->cache, m->pindex); > > - vm_page_cache_turn_free(m); > > - } > > - empty = vm_radix_is_empty(&object->cache); > > - mtx_unlock(&vm_page_queue_free_mtx); > > - if (object->type == OBJT_VNODE && empty) > > - vdrop(object->handle); > > -} > > - > > -/* > > - * Returns the cached page that is associated with the given > > - * object and offset. If, however, none exists, returns NULL. > > - * > > - * The free page queue must be locked. > > - */ > > -static inline vm_page_t > > -vm_page_cache_lookup(vm_object_t object, vm_pindex_t pindex) > > -{ > > - > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > - return (vm_radix_lookup(&object->cache, pindex)); > > -} > > - > > -/* > > - * Remove the given cached page from its containing object's > > - * collection of cached pages. > > - * > > - * The free page queue must be locked. > > - */ > > -static void > > -vm_page_cache_remove(vm_page_t m) > > -{ > > - > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > - KASSERT((m->flags & PG_CACHED) != 0, > > - ("vm_page_cache_remove: page %p is not cached", m)); > > - vm_radix_remove(&m->object->cache, m->pindex); > > - m->object = NULL; > > - vm_cnt.v_cache_count--; > > -} > > - > > -/* > > - * Transfer all of the cached pages with offset greater than or > > - * equal to 'offidxstart' from the original object's cache to the > > - * new object's cache. However, any cached pages with offset > > - * greater than or equal to the new object's size are kept in the > > - * original object. Initially, the new object's cache must be > > - * empty. Offset 'offidxstart' in the original object must > > - * correspond to offset zero in the new object. > > - * > > - * The new object must be locked. > > - */ > > -void > > -vm_page_cache_transfer(vm_object_t orig_object, vm_pindex_t offidxstart, > > - vm_object_t new_object) > > -{ > > - vm_page_t m; > > - > > - /* > > - * Insertion into an object's collection of cached pages > > - * requires the object to be locked. In contrast, removal does > > - * not. > > - */ > > - VM_OBJECT_ASSERT_WLOCKED(new_object); > > - KASSERT(vm_radix_is_empty(&new_object->cache), > > - ("vm_page_cache_transfer: object %p has cached pages", > > - new_object)); > > - mtx_lock(&vm_page_queue_free_mtx); > > - while ((m = vm_radix_lookup_ge(&orig_object->cache, > > - offidxstart)) != NULL) { > > - /* > > - * Transfer all of the pages with offset greater than or > > - * equal to 'offidxstart' from the original object's > > - * cache to the new object's cache. > > - */ > > - if ((m->pindex - offidxstart) >= new_object->size) > > - break; > > - vm_radix_remove(&orig_object->cache, m->pindex); > > - /* Update the page's object and offset. */ > > - m->object = new_object; > > - m->pindex -= offidxstart; > > - if (vm_radix_insert(&new_object->cache, m)) > > - vm_page_cache_turn_free(m); > > - } > > - mtx_unlock(&vm_page_queue_free_mtx); > > -} > > - > > -/* > > - * Returns TRUE if a cached page is associated with the given object and > > - * offset, and FALSE otherwise. > > - * > > - * The object must be locked. > > - */ > > -boolean_t > > -vm_page_is_cached(vm_object_t object, vm_pindex_t pindex) > > -{ > > - vm_page_t m; > > - > > - /* > > - * Insertion into an object's collection of cached pages requires the > > - * object to be locked. Therefore, if the object is locked and the > > - * object's collection is empty, there is no need to acquire the free > > - * page queues lock in order to prove that the specified page doesn't > > - * exist. > > - */ > > - VM_OBJECT_ASSERT_WLOCKED(object); > > - if (__predict_true(vm_object_cache_is_empty(object))) > > - return (FALSE); > > - mtx_lock(&vm_page_queue_free_mtx); > > - m = vm_page_cache_lookup(object, pindex); > > - mtx_unlock(&vm_page_queue_free_mtx); > > - return (m != NULL); > > -} > > - > > -/* > > * vm_page_alloc: > > * > > * Allocate and return a page that is associated with the specified > > @@ -1610,9 +1471,6 @@ vm_page_is_cached(vm_object_t object, vm > > * optional allocation flags: > > * VM_ALLOC_COUNT(number) the number of additional pages that the caller > > * intends to allocate > > - * VM_ALLOC_IFCACHED return page only if it is cached > > - * VM_ALLOC_IFNOTCACHED return NULL, do not reactivate if the page > > - * is cached > > * VM_ALLOC_NOBUSY do not exclusive busy the page > > * VM_ALLOC_NODUMP do not include the page in a kernel core dump > > * VM_ALLOC_NOOBJ page is not associated with an object and > > @@ -1626,8 +1484,6 @@ vm_page_is_cached(vm_object_t object, vm > > vm_page_t > > vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) > > { > > - struct vnode *vp = NULL; > > - vm_object_t m_object; > > vm_page_t m, mpred; > > int flags, req_class; > > > > @@ -1670,31 +1526,12 @@ vm_page_alloc(vm_object_t object, vm_pin > > * Allocate from the free queue if the number of free pages > > * exceeds the minimum for the request class. > > */ > > - if (object != NULL && > > - (m = vm_page_cache_lookup(object, pindex)) != NULL) { > > - if ((req & VM_ALLOC_IFNOTCACHED) != 0) { > > - mtx_unlock(&vm_page_queue_free_mtx); > > - return (NULL); > > - } > > - if (vm_phys_unfree_page(m)) > > - vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, 0); > > -#if VM_NRESERVLEVEL > 0 > > - else if (!vm_reserv_reactivate_page(m)) > > -#else > > - else > > -#endif > > - panic("vm_page_alloc: cache page %p is missing" > > - " from the free queue", m); > > - } else if ((req & VM_ALLOC_IFCACHED) != 0) { > > - mtx_unlock(&vm_page_queue_free_mtx); > > - return (NULL); > > #if VM_NRESERVLEVEL > 0 > > - } else if (object == NULL || (object->flags & (OBJ_COLORED | > > + if (object == NULL || (object->flags & (OBJ_COLORED | > > OBJ_FICTITIOUS)) != OBJ_COLORED || (m = > > - vm_reserv_alloc_page(object, pindex, mpred)) == NULL) { > > -#else > > - } else { > > + vm_reserv_alloc_page(object, pindex, mpred)) == NULL) > > #endif > > + { > > m = vm_phys_alloc_pages(object != NULL ? > > VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > > #if VM_NRESERVLEVEL > 0 > > @@ -1720,33 +1557,9 @@ vm_page_alloc(vm_object_t object, vm_pin > > * At this point we had better have found a good page. > > */ > > KASSERT(m != NULL, ("vm_page_alloc: missing page")); > > - KASSERT(m->queue == PQ_NONE, > > - ("vm_page_alloc: page %p has unexpected queue %d", m, m->queue)); > > - KASSERT(m->wire_count == 0, ("vm_page_alloc: page %p is wired", m)); > > - KASSERT(m->hold_count == 0, ("vm_page_alloc: page %p is held", m)); > > - KASSERT(!vm_page_busied(m), ("vm_page_alloc: page %p is busy", m)); > > - KASSERT(m->dirty == 0, ("vm_page_alloc: page %p is dirty", m)); > > - KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, > > - ("vm_page_alloc: page %p has unexpected memattr %d", m, > > - pmap_page_get_memattr(m))); > > - if ((m->flags & PG_CACHED) != 0) { > > - KASSERT((m->flags & PG_ZERO) == 0, > > - ("vm_page_alloc: cached page %p is PG_ZERO", m)); > > - KASSERT(m->valid != 0, > > - ("vm_page_alloc: cached page %p is invalid", m)); > > - if (m->object != object || m->pindex != pindex) > > - m->valid = 0; > > - m_object = m->object; > > - vm_page_cache_remove(m); > > - if (m_object->type == OBJT_VNODE && > > - vm_object_cache_is_empty(m_object)) > > - vp = m_object->handle; > > - } else { > > - KASSERT(m->valid == 0, > > - ("vm_page_alloc: free page %p is valid", m)); > > - vm_phys_freecnt_adj(m, -1); > > - } > > + vm_phys_freecnt_adj(m, -1); > > mtx_unlock(&vm_page_queue_free_mtx); > > + vm_page_alloc_check(m); > > > > /* > > * Initialize the page. Only the PG_ZERO flag is inherited. > > @@ -1778,9 +1591,6 @@ vm_page_alloc(vm_object_t object, vm_pin > > > > if (object != NULL) { > > if (vm_page_insert_after(m, object, pindex, mpred)) { > > - /* See the comment below about hold count. */ > > - if (vp != NULL) > > - vdrop(vp); > > pagedaemon_wakeup(); > > if (req & VM_ALLOC_WIRED) { > > atomic_subtract_int(&vm_cnt.v_wire_count, 1); > > @@ -1801,15 +1611,6 @@ vm_page_alloc(vm_object_t object, vm_pin > > m->pindex = pindex; > > > > /* > > - * The following call to vdrop() must come after the above call > > - * to vm_page_insert() in case both affect the same object and > > - * vnode. Otherwise, the affected vnode's hold count could > > - * temporarily become zero. > > - */ > > - if (vp != NULL) > > - vdrop(vp); > > - > > - /* > > * Don't wakeup too often - wakeup the pageout daemon when > > * we would be nearly out of memory. > > */ > > @@ -1819,16 +1620,6 @@ vm_page_alloc(vm_object_t object, vm_pin > > return (m); > > } > > > > -static void > > -vm_page_alloc_contig_vdrop(struct spglist *lst) > > -{ > > - > > - while (!SLIST_EMPTY(lst)) { > > - vdrop((struct vnode *)SLIST_FIRST(lst)-> plinks.s.pv); > > - SLIST_REMOVE_HEAD(lst, plinks.s.ss); > > - } > > -} > > - > > /* > > * vm_page_alloc_contig: > > * > > @@ -1873,8 +1664,6 @@ vm_page_alloc_contig(vm_object_t object, > > u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, > > vm_paddr_t boundary, vm_memattr_t memattr) > > { > > - struct vnode *drop; > > - struct spglist deferred_vdrop_list; > > vm_page_t m, m_tmp, m_ret; > > u_int flags; > > int req_class; > > @@ -1900,7 +1689,6 @@ vm_page_alloc_contig(vm_object_t object, > > if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) > > req_class = VM_ALLOC_SYSTEM; > > > > - SLIST_INIT(&deferred_vdrop_list); > > mtx_lock(&vm_page_queue_free_mtx); > > if (vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages + > > vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && > > @@ -1922,17 +1710,7 @@ retry: > > return (NULL); > > } > > if (m_ret != NULL) > > - for (m = m_ret; m < &m_ret[npages]; m++) { > > - drop = vm_page_alloc_init(m); > > - if (drop != NULL) { > > - /* > > - * Enqueue the vnode for deferred vdrop(). > > - */ > > - m->plinks.s.pv = drop; > > - SLIST_INSERT_HEAD(&deferred_vdrop_list, m, > > - plinks.s.ss); > > - } > > - } > > + vm_phys_freecnt_adj(m_ret, -npages); > > else { > > #if VM_NRESERVLEVEL > 0 > > if (vm_reserv_reclaim_contig(npages, low, high, alignment, > > @@ -1943,6 +1721,8 @@ retry: > > mtx_unlock(&vm_page_queue_free_mtx); > > if (m_ret == NULL) > > return (NULL); > > + for (m = m_ret; m < &m_ret[npages]; m++) > > + vm_page_alloc_check(m); > > > > /* > > * Initialize the pages. Only the PG_ZERO flag is inherited. > > @@ -1975,8 +1755,6 @@ retry: > > m->oflags = VPO_UNMANAGED; > > if (object != NULL) { > > if (vm_page_insert(m, object, pindex)) { > > - vm_page_alloc_contig_vdrop( > > - &deferred_vdrop_list); > > if (vm_paging_needed()) > > pagedaemon_wakeup(); > > if ((req & VM_ALLOC_WIRED) != 0) > > @@ -2001,57 +1779,28 @@ retry: > > pmap_page_set_memattr(m, memattr); > > pindex++; > > } > > - vm_page_alloc_contig_vdrop(&deferred_vdrop_list); > > if (vm_paging_needed()) > > pagedaemon_wakeup(); > > return (m_ret); > > } > > > > /* > > - * Initialize a page that has been freshly dequeued from a freelist. > > - * The caller has to drop the vnode returned, if it is not NULL. > > - * > > - * This function may only be used to initialize unmanaged pages. > > - * > > - * To be called with vm_page_queue_free_mtx held. > > + * Check a page that has been freshly dequeued from a freelist. > > */ > > -static struct vnode * > > -vm_page_alloc_init(vm_page_t m) > > +static void > > +vm_page_alloc_check(vm_page_t m) > > { > > - struct vnode *drop; > > - vm_object_t m_object; > > > > KASSERT(m->queue == PQ_NONE, > > - ("vm_page_alloc_init: page %p has unexpected queue %d", > > - m, m->queue)); > > - KASSERT(m->wire_count == 0, > > - ("vm_page_alloc_init: page %p is wired", m)); > > - KASSERT(m->hold_count == 0, > > - ("vm_page_alloc_init: page %p is held", m)); > > - KASSERT(!vm_page_busied(m), > > - ("vm_page_alloc_init: page %p is busy", m)); > > - KASSERT(m->dirty == 0, > > - ("vm_page_alloc_init: page %p is dirty", m)); > > + ("page %p has unexpected queue %d", m, m->queue)); > > + KASSERT(m->wire_count == 0, ("page %p is wired", m)); > > + KASSERT(m->hold_count == 0, ("page %p is held", m)); > > + KASSERT(!vm_page_busied(m), ("page %p is busy", m)); > > + KASSERT(m->dirty == 0, ("page %p is dirty", m)); > > KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, > > - ("vm_page_alloc_init: page %p has unexpected memattr %d", > > + ("page %p has unexpected memattr %d", > > m, pmap_page_get_memattr(m))); > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > - drop = NULL; > > - if ((m->flags & PG_CACHED) != 0) { > > - KASSERT((m->flags & PG_ZERO) == 0, > > - ("vm_page_alloc_init: cached page %p is PG_ZERO", m)); > > - m->valid = 0; > > - m_object = m->object; > > - vm_page_cache_remove(m); > > - if (m_object->type == OBJT_VNODE && > > - vm_object_cache_is_empty(m_object)) > > - drop = m_object->handle; > > - } else { > > - KASSERT(m->valid == 0, > > - ("vm_page_alloc_init: free page %p is valid", m)); > > - vm_phys_freecnt_adj(m, -1); > > - } > > - return (drop); > > + KASSERT(m->valid == 0, ("free page %p is valid", m)); > > } > > > > /* > > @@ -2077,7 +1826,6 @@ vm_page_alloc_init(vm_page_t m) > > vm_page_t > > vm_page_alloc_freelist(int flind, int req) > > { > > - struct vnode *drop; > > vm_page_t m; > > u_int flags; > > int req_class; > > @@ -2111,8 +1859,9 @@ vm_page_alloc_freelist(int flind, int re > > mtx_unlock(&vm_page_queue_free_mtx); > > return (NULL); > > } > > - drop = vm_page_alloc_init(m); > > + vm_phys_freecnt_adj(m, -1); > > mtx_unlock(&vm_page_queue_free_mtx); > > + vm_page_alloc_check(m); > > > > /* > > * Initialize the page. Only the PG_ZERO flag is inherited. > > @@ -2132,8 +1881,6 @@ vm_page_alloc_freelist(int flind, int re > > } > > /* Unmanaged pages don't use "act_count". */ > > m->oflags = VPO_UNMANAGED; > > - if (drop != NULL) > > - vdrop(drop); > > if (vm_paging_needed()) > > pagedaemon_wakeup(); > > return (m); > > @@ -2259,38 +2006,8 @@ retry: > > /* Don't care: PG_NODUMP, PG_ZERO. */ > > if (object->type != OBJT_DEFAULT && > > object->type != OBJT_SWAP && > > - object->type != OBJT_VNODE) > > + object->type != OBJT_VNODE) { > > run_ext = 0; > > - else if ((m->flags & PG_CACHED) != 0 || > > - m != vm_page_lookup(object, m->pindex)) { > > - /* > > - * The page is cached or recently converted > > - * from cached to free. > > - */ > > -#if VM_NRESERVLEVEL > 0 > > - if (level >= 0) { > > - /* > > - * The page is reserved. Extend the > > - * current run by one page. > > - */ > > - run_ext = 1; > > - } else > > -#endif > > - if ((order = m->order) < VM_NFREEORDER) { > > - /* > > - * The page is enqueued in the > > - * physical memory allocator's cache/ > > - * free page queues. Moreover, it is > > - * the first page in a power-of-two- > > - * sized run of contiguous cache/free > > - * pages. Add these pages to the end > > - * of the current run, and jump > > - * ahead. > > - */ > > - run_ext = 1 << order; > > - m_inc = 1 << order; > > - } else > > - run_ext = 0; > > #if VM_NRESERVLEVEL > 0 > > } else if ((options & VPSC_NOSUPER) != 0 && > > (level = vm_reserv_level_iffullpop(m)) >= 0) { > > @@ -2457,15 +2174,7 @@ retry: > > object->type != OBJT_SWAP && > > object->type != OBJT_VNODE) > > error = EINVAL; > > - else if ((m->flags & PG_CACHED) != 0 || > > - m != vm_page_lookup(object, m->pindex)) { > > - /* > > - * The page is cached or recently converted > > - * from cached to free. > > - */ > > - VM_OBJECT_WUNLOCK(object); > > - goto cached; > > - } else if (object->memattr != VM_MEMATTR_DEFAULT) > > + else if (object->memattr != VM_MEMATTR_DEFAULT) > > error = EINVAL; > > else if (m->queue != PQ_NONE && !vm_page_busied(m)) { > > KASSERT(pmap_page_get_memattr(m) == > > @@ -2566,7 +2275,6 @@ retry: > > unlock: > > VM_OBJECT_WUNLOCK(object); > > } else { > > -cached: > > mtx_lock(&vm_page_queue_free_mtx); > > order = m->order; > > if (order < VM_NFREEORDER) { > > @@ -2964,27 +2672,6 @@ vm_page_free_wakeup(void) > > } > > > > /* > > - * Turn a cached page into a free page, by changing its attributes. > > - * Keep the statistics up-to-date. > > - * > > - * The free page queue must be locked. > > - */ > > -static void > > -vm_page_cache_turn_free(vm_page_t m) > > -{ > > - > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > - > > - m->object = NULL; > > - m->valid = 0; > > - KASSERT((m->flags & PG_CACHED) != 0, > > - ("vm_page_cache_turn_free: page %p is not cached", m)); > > - m->flags &= ~PG_CACHED; > > - vm_cnt.v_cache_count--; > > - vm_phys_freecnt_adj(m, 1); > > -} > > - > > -/* > > * vm_page_free_toq: > > * > > * Returns the given page to the free list, > > @@ -3383,8 +3070,7 @@ retrylookup: > > VM_WAIT; > > VM_OBJECT_WLOCK(object); > > goto retrylookup; > > - } else if (m->valid != 0) > > - return (m); > > + } > > if (allocflags & VM_ALLOC_ZERO && (m->flags & PG_ZERO) == 0) > > pmap_zero_page(m); > > return (m); > > > > Modified: head/sys/vm/vm_page.h > > ============================================================================== > > --- head/sys/vm/vm_page.h Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_page.h Tue Nov 15 18:22:50 2016 (r308691) > > @@ -326,7 +326,6 @@ extern struct mtx_padalign pa_lock[]; > > * Page flags. If changed at any other time than page allocation or > > * freeing, the modification must be protected by the vm_page lock. > > */ > > -#define PG_CACHED 0x0001 /* page is cached */ > > #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ > > #define PG_ZERO 0x0008 /* page is zeroed */ > > #define PG_MARKER 0x0010 /* special queue marker page */ > > @@ -409,8 +408,6 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa) > > #define VM_ALLOC_ZERO 0x0040 /* (acfg) Try to obtain a zeroed page */ > > #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ > > #define VM_ALLOC_NOBUSY 0x0200 /* (acg) Do not busy the page */ > > -#define VM_ALLOC_IFCACHED 0x0400 /* (ag) Fail if page is not cached */ > > -#define VM_ALLOC_IFNOTCACHED 0x0800 /* (ag) Fail if page is cached */ > > #define VM_ALLOC_IGN_SBUSY 0x1000 /* (g) 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 */ > > @@ -453,8 +450,6 @@ vm_page_t vm_page_alloc_contig(vm_object > > 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_cache_free(vm_object_t, vm_pindex_t, vm_pindex_t); > > -void vm_page_cache_transfer(vm_object_t, vm_pindex_t, vm_object_t); > > int vm_page_try_to_free (vm_page_t); > > void vm_page_deactivate (vm_page_t); > > void vm_page_deactivate_noreuse(vm_page_t); > > @@ -464,7 +459,6 @@ vm_page_t vm_page_find_least(vm_object_t > > vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); > > void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); > > int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); > > -boolean_t vm_page_is_cached(vm_object_t object, vm_pindex_t pindex); > > void vm_page_launder(vm_page_t m); > > vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); > > vm_page_t vm_page_next(vm_page_t m); > > > > Modified: head/sys/vm/vm_reserv.c > > ============================================================================== > > --- head/sys/vm/vm_reserv.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_reserv.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -908,45 +908,6 @@ vm_reserv_level_iffullpop(vm_page_t m) > > } > > > > /* > > - * Prepare for the reactivation of a cached page. > > - * > > - * First, suppose that the given page "m" was allocated individually, i.e., not > > - * as part of a reservation, and cached. Then, suppose a reservation > > - * containing "m" is allocated by the same object. Although "m" and the > > - * reservation belong to the same object, "m"'s pindex may not match the > > - * reservation's. > > - * > > - * The free page queue must be locked. > > - */ > > -boolean_t > > -vm_reserv_reactivate_page(vm_page_t m) > > -{ > > - vm_reserv_t rv; > > - int index; > > - > > - mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); > > - rv = vm_reserv_from_page(m); > > - if (rv->object == NULL) > > - return (FALSE); > > - KASSERT((m->flags & PG_CACHED) != 0, > > - ("vm_reserv_reactivate_page: page %p is not cached", m)); > > - if (m->object == rv->object && > > - m->pindex - rv->pindex == (index = VM_RESERV_INDEX(m->object, > > - m->pindex))) > > - vm_reserv_populate(rv, index); > > - else { > > - KASSERT(rv->inpartpopq, > > - ("vm_reserv_reactivate_page: reserv %p's inpartpopq is FALSE", > > - rv)); > > - TAILQ_REMOVE(&vm_rvq_partpop, rv, partpopq); > > - rv->inpartpopq = FALSE; > > - /* Don't release "m" to the physical memory allocator. */ > > - vm_reserv_break(rv, m); > > - } > > - return (TRUE); > > -} > > - > > -/* > > * Breaks the given partially-populated reservation, releasing its cached and > > * free pages to the physical memory allocator. > > * > > > > Modified: head/sys/vm/vm_reserv.h > > ============================================================================== > > --- head/sys/vm/vm_reserv.h Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vm_reserv.h Tue Nov 15 18:22:50 2016 (r308691) > > @@ -56,7 +56,6 @@ void vm_reserv_init(void); > > bool vm_reserv_is_page_free(vm_page_t m); > > int vm_reserv_level(vm_page_t m); > > int vm_reserv_level_iffullpop(vm_page_t m); > > -boolean_t vm_reserv_reactivate_page(vm_page_t m); > > boolean_t vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, > > vm_paddr_t high, u_long alignment, vm_paddr_t boundary); > > boolean_t vm_reserv_reclaim_inactive(void); > > > > Modified: head/sys/vm/vnode_pager.c > > ============================================================================== > > --- head/sys/vm/vnode_pager.c Tue Nov 15 17:01:48 2016 (r308690) > > +++ head/sys/vm/vnode_pager.c Tue Nov 15 18:22:50 2016 (r308691) > > @@ -466,10 +466,6 @@ vnode_pager_setsize(struct vnode *vp, vm > > * replacement from working properly. > > */ > > vm_page_clear_dirty(m, base, PAGE_SIZE - base); > > - } else if ((nsize & PAGE_MASK) && > > - vm_page_is_cached(object, OFF_TO_IDX(nsize))) { > > - vm_page_cache_free(object, OFF_TO_IDX(nsize), > > - nobjsize); > > } > > } > > object->un_pager.vnp.vnp_size = nsize; > > @@ -894,8 +890,7 @@ vnode_pager_generic_getpages(struct vnod > > for (tpindex = m[0]->pindex - 1; > > tpindex >= startpindex && tpindex < m[0]->pindex; > > tpindex--, i++) { > > - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | > > - VM_ALLOC_IFNOTCACHED); > > + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); > > if (p == NULL) { > > /* Shift the array. */ > > for (int j = 0; j < i; j++) > > @@ -932,8 +927,7 @@ vnode_pager_generic_getpages(struct vnod > > > > for (tpindex = m[count - 1]->pindex + 1; > > tpindex < endpindex; i++, tpindex++) { > > - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | > > - VM_ALLOC_IFNOTCACHED); > > + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); > > if (p == NULL) > > break; > > bp->b_pages[i] = p; > > From owner-svn-src-head@freebsd.org Wed Nov 16 17:00:29 2016 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 E76F7C45546; Wed, 16 Nov 2016 17:00:29 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-30.csi.cam.ac.uk (ppsw-30.csi.cam.ac.uk [131.111.8.130]) by mx1.freebsd.org (Postfix) with ESMTP id B3C2DBAE; Wed, 16 Nov 2016 17:00:29 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:13713) by ppsw-30.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1c73ZU-000pD2-eP (Exim 4.86_36-e07b163) (return-path ); Wed, 16 Nov 2016 17:00:28 +0000 Date: Wed, 16 Nov 2016 16:59:39 +0000 From: Ruslan Bukin To: Konstantin Belousov Cc: Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-ID: <20161116165939.GA12498@bsdpad.com> References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> <20161116165343.GX54029@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161116165343.GX54029@kib.kiev.ua> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" 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, 16 Nov 2016 17:00:30 -0000 On Wed, Nov 16, 2016 at 06:53:43PM +0200, Konstantin Belousov wrote: > On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: > > I have a panic with this on RISC-V. Any ideas ? > How did you checked that the revision you replied to, makes the problem ? > Note that the backtrace below is not reasonable. I reverted this commit like that and rebuilt kernel: git show 2fa36073055134deb2df39c7ca46264cfc313d77 | patch -p1 -R So the problem is reproducible on dual-core with 32mb mdroot. Ruslan From owner-svn-src-head@freebsd.org Wed Nov 16 17:11:06 2016 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 BA53DC4580C; Wed, 16 Nov 2016 17:11:06 +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 8551A14F0; Wed, 16 Nov 2016 17:11:06 +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 uAGHB5lL043636; Wed, 16 Nov 2016 17:11:05 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGHB5LF043635; Wed, 16 Nov 2016 17:11:05 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611161711.uAGHB5LF043635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 16 Nov 2016 17:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308736 - head/tools/tools/nanobsd X-SVN-Group: head 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, 16 Nov 2016 17:11:06 -0000 Author: imp Date: Wed Nov 16 17:11:05 2016 New Revision: 308736 URL: https://svnweb.freebsd.org/changeset/base/308736 Log: Allow installworld to be skipped as well as installkernel with -W. Allow -B to mean -K -W. There are times when fixing non-base elementes of the build that you don't want to wait to get a completely clean world install. This allows that at the cost of a little danger. Submitted by: gallatin@ Sponsored by: Netflix, Inc Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Wed Nov 16 16:49:21 2016 (r308735) +++ head/tools/tools/nanobsd/nanobsd.sh Wed Nov 16 17:11:05 2016 (r308736) @@ -40,6 +40,7 @@ do_clean=true do_kernel=true do_installkernel=true do_world=true +do_installworld=true do_image=true do_copyout_partition=true do_native_xtools=false @@ -48,7 +49,7 @@ do_native_xtools=false do_legacy=false set +e -args=`getopt KXbc:fhiknqvw $*` +args=`getopt BKXWbc:fhiknqvw $*` if [ $? -ne 0 ] ; then usage exit 2 @@ -60,6 +61,11 @@ for i do case "$i" in + -B) + do_installworld=false + do_installkernel=false + shift + ;; -K) do_installkernel=false shift @@ -68,6 +74,10 @@ do do_native_xtools=true shift ;; + -W) + do_installworld=false + shift + ;; -b) do_world=false do_kernel=false @@ -174,10 +184,15 @@ else pprint 2 "Skipping buildkernel (as instructed)" fi -clean_world -make_conf_install -install_world -install_etc +if $do_installworld ; then + clean_world + make_conf_install + install_world + install_etc +else + pprint 2 "Skipping installworld (as instructed)" +fi + if $do_native_xtools ; then native_xtools fi From owner-svn-src-head@freebsd.org Wed Nov 16 17:53:01 2016 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 C8FD5C45105; Wed, 16 Nov 2016 17:53:01 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-30.csi.cam.ac.uk (ppsw-30.csi.cam.ac.uk [131.111.8.130]) by mx1.freebsd.org (Postfix) with ESMTP id 8DEABB5B; Wed, 16 Nov 2016 17:53:00 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:43784) by ppsw-30.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1c74OJ-00014x-do (Exim 4.86_36-e07b163) (return-path ); Wed, 16 Nov 2016 17:52:59 +0000 Date: Wed, 16 Nov 2016 17:52:10 +0000 From: Ruslan Bukin To: Konstantin Belousov Cc: Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-ID: <20161116175210.GA13203@bsdpad.com> References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> <20161116165343.GX54029@kib.kiev.ua> <20161116165939.GA12498@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161116165939.GA12498@bsdpad.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" 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, 16 Nov 2016 17:53:01 -0000 On Wed, Nov 16, 2016 at 04:59:39PM +0000, Ruslan Bukin wrote: > On Wed, Nov 16, 2016 at 06:53:43PM +0200, Konstantin Belousov wrote: > > On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: > > > I have a panic with this on RISC-V. Any ideas ? > > How did you checked that the revision you replied to, makes the problem ? > > Note that the backtrace below is not reasonable. > > I reverted this commit like that and rebuilt kernel: > git show 2fa36073055134deb2df39c7ca46264cfc313d77 | patch -p1 -R > > So the problem is reproducible on dual-core with 32mb mdroot. > I just found another interesting behavior: depending on amount of physical memory : 700m - panic 800m - works fine 1024m - panic Ruslan From owner-svn-src-head@freebsd.org Wed Nov 16 17:54:03 2016 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 7C642C45158; Wed, 16 Nov 2016 17:54:03 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4721ECE3; Wed, 16 Nov 2016 17:54:02 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.16.0.17/8.16.0.17) with SMTP id uAGHq0UU031844; Wed, 16 Nov 2016 11:53:56 -0600 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp2.rice.edu with ESMTP id 26qjswhcte-1; Wed, 16 Nov 2016 11:53:56 -0600 X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id 8EC31500138; Wed, 16 Nov 2016 11:53:55 -0600 (CST) Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm To: Ruslan Bukin , Konstantin Belousov References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> <20161116165343.GX54029@kib.kiev.ua> <20161116165939.GA12498@bsdpad.com> Cc: Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Alan Cox Message-ID: <149a44c1-6ab1-7598-7dc9-7698bfbfa10b@rice.edu> Date: Wed, 16 Nov 2016 11:53:55 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161116165939.GA12498@bsdpad.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611160267 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, 16 Nov 2016 17:54:03 -0000 On 11/16/2016 10:59, Ruslan Bukin wrote: > On Wed, Nov 16, 2016 at 06:53:43PM +0200, Konstantin Belousov wrote: >> On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: >>> I have a panic with this on RISC-V. Any ideas ? >> How did you checked that the revision you replied to, makes the proble= m ? >> Note that the backtrace below is not reasonable. > I reverted this commit like that and rebuilt kernel: > git show 2fa36073055134deb2df39c7ca46264cfc313d77 | patch -p1 -R > > So the problem is reproducible on dual-core with 32mb mdroot. This change amounted to dead code removal, so I'm not sure how it could have an effect. There were only a couple places where the changes were other than mechanical in nature. Also, that the number of cores matters is no less puzzling. Can you send Kostik and me the output of "sysctl vm.stats.vm" from shortly after boot on the kernel with the patch reverted? From owner-svn-src-head@freebsd.org Wed Nov 16 18:08:51 2016 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 67F9EC453A2; Wed, 16 Nov 2016 18:08:51 +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 343931235; Wed, 16 Nov 2016 18:08:51 +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 uAGI8owQ067365; Wed, 16 Nov 2016 18:08:50 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAGI8oxQ067364; Wed, 16 Nov 2016 18:08:50 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201611161808.uAGI8oxQ067364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 16 Nov 2016 18:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308737 - head/release X-SVN-Group: head 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, 16 Nov 2016 18:08:51 -0000 Author: gjb Date: Wed Nov 16 18:08:50 2016 New Revision: 308737 URL: https://svnweb.freebsd.org/changeset/base/308737 Log: Pass SWAPSIZE in env(1) when invoking mk-vmimage.sh, otherwise mkimg(1) does not create the second partition after r307008. Sponsored by: The FreeBSD Foundation Modified: head/release/Makefile.vm Modified: head/release/Makefile.vm ============================================================================== --- head/release/Makefile.vm Wed Nov 16 17:11:05 2016 (r308736) +++ head/release/Makefile.vm Wed Nov 16 18:08:50 2016 (r308737) @@ -55,7 +55,7 @@ ${_CW:tu}CONF?= ${.CURDIR}/tools/${_CW:t cw-${_CW:tl}: mkdir -p ${.OBJDIR}/${.TARGET} - env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ + env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} SWAPSIZE=${SWAPSIZE} \ ${.CURDIR}/scripts/mk-vmimage.sh \ -C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \ -i ${.OBJDIR}/${_CW:tl}.img -s ${VMSIZE} -f ${${_CW}_FORMAT} \ From owner-svn-src-head@freebsd.org Wed Nov 16 20:12:42 2016 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 82CE3C4369A; Wed, 16 Nov 2016 20:12:42 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-41.csi.cam.ac.uk (ppsw-41.csi.cam.ac.uk [131.111.8.141]) by mx1.freebsd.org (Postfix) with ESMTP id 4CECC1BE4; Wed, 16 Nov 2016 20:12:41 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:28308) by ppsw-41.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1c76ZS-0004Ph-Rc (Exim 4.86_36-e07b163) (return-path ); Wed, 16 Nov 2016 20:12:38 +0000 Date: Wed, 16 Nov 2016 20:11:49 +0000 From: Ruslan Bukin To: Alan Cox Cc: Konstantin Belousov , Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-ID: <20161116201149.GA12303@bsdpad.com> References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> <20161116165343.GX54029@kib.kiev.ua> <20161116165939.GA12498@bsdpad.com> <149a44c1-6ab1-7598-7dc9-7698bfbfa10b@rice.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <149a44c1-6ab1-7598-7dc9-7698bfbfa10b@rice.edu> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" 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, 16 Nov 2016 20:12:42 -0000 On Wed, Nov 16, 2016 at 11:53:55AM -0600, Alan Cox wrote: > On 11/16/2016 10:59, Ruslan Bukin wrote: > > On Wed, Nov 16, 2016 at 06:53:43PM +0200, Konstantin Belousov wrote: > >> On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: > >>> I have a panic with this on RISC-V. Any ideas ? > >> How did you checked that the revision you replied to, makes the problem ? > >> Note that the backtrace below is not reasonable. > > I reverted this commit like that and rebuilt kernel: > > git show 2fa36073055134deb2df39c7ca46264cfc313d77 | patch -p1 -R > > > > So the problem is reproducible on dual-core with 32mb mdroot. > > This change amounted to dead code removal, so I'm not sure how it could > have an effect. There were only a couple places where the changes were > other than mechanical in nature. Also, that the number of cores matters > is no less puzzling. > > Can you send Kostik and me the output of "sysctl vm.stats.vm" from > shortly after boot on the kernel with the patch reverted? > Here is result with patch reverted: # sysctl vm.stats.vm vm.stats.vm.v_vm_faults: 1578 vm.stats.vm.v_io_faults: 213 vm.stats.vm.v_cow_faults: 135 vm.stats.vm.v_cow_optim: 0 vm.stats.vm.v_zfod: 360 vm.stats.vm.v_ozfod: 0 vm.stats.vm.v_swapin: 0 vm.stats.vm.v_swapout: 0 vm.stats.vm.v_swappgsin: 0 vm.stats.vm.v_swappgsout: 0 vm.stats.vm.v_vnodein: 0 vm.stats.vm.v_vnodeout: 0 vm.stats.vm.v_vnodepgsin: 0 vm.stats.vm.v_vnodepgsout: 0 vm.stats.vm.v_intrans: 0 vm.stats.vm.v_reactivated: 0 vm.stats.vm.v_pdwakeups: 0 vm.stats.vm.v_pdpages: 2 vm.stats.vm.v_pdshortfalls: 0 vm.stats.vm.v_tcached: 0 vm.stats.vm.v_dfree: 0 vm.stats.vm.v_pfree: 142 vm.stats.vm.v_tfree: 340 vm.stats.vm.v_page_size: 4096 vm.stats.vm.v_page_count: 235637 vm.stats.vm.v_free_reserved: 356 vm.stats.vm.v_free_target: 5064 vm.stats.vm.v_free_min: 1533 vm.stats.vm.v_free_count: 231577 vm.stats.vm.v_wire_count: 3779 vm.stats.vm.v_active_count: 251 vm.stats.vm.v_inactive_target: 7596 vm.stats.vm.v_inactive_count: 29 vm.stats.vm.v_laundry_count: 0 vm.stats.vm.v_cache_count: 0 vm.stats.vm.v_pageout_free_min: 34 vm.stats.vm.v_interrupt_free_min: 2 vm.stats.vm.v_forks: 4 vm.stats.vm.v_vforks: 0 vm.stats.vm.v_rforks: 0 vm.stats.vm.v_kthreads: 20 vm.stats.vm.v_forkpages: 132 vm.stats.vm.v_vforkpages: 0 vm.stats.vm.v_rforkpages: 0 vm.stats.vm.v_kthreadpages: 0 # And here is patch not reverted, but 800m of physical memory: # sysctl sysctl vm.stats.vm vm.stats.vm.v_vm_faults: 1580 vm.stats.vm.v_io_faults: 213 vm.stats.vm.v_cow_faults: 135 vm.stats.vm.v_cow_optim: 0 vm.stats.vm.v_zfod: 362 vm.stats.vm.v_ozfod: 0 vm.stats.vm.v_swapin: 0 vm.stats.vm.v_swapout: 0 vm.stats.vm.v_swappgsin: 0 vm.stats.vm.v_swappgsout: 0 vm.stats.vm.v_vnodein: 0 vm.stats.vm.v_vnodeout: 0 vm.stats.vm.v_vnodepgsin: 0 vm.stats.vm.v_vnodepgsout: 0 vm.stats.vm.v_intrans: 0 vm.stats.vm.v_reactivated: 0 vm.stats.vm.v_pdwakeups: 0 vm.stats.vm.v_pdpages: 4 vm.stats.vm.v_pdshortfalls: 0 vm.stats.vm.v_tcached: 0 vm.stats.vm.v_dfree: 0 vm.stats.vm.v_pfree: 142 vm.stats.vm.v_tfree: 340 vm.stats.vm.v_page_size: 4096 vm.stats.vm.v_page_count: 179753 vm.stats.vm.v_free_reserved: 284 vm.stats.vm.v_free_target: 3872 vm.stats.vm.v_free_min: 1181 vm.stats.vm.v_free_count: 176074 vm.stats.vm.v_wire_count: 3396 vm.stats.vm.v_active_count: 253 vm.stats.vm.v_inactive_target: 5808 vm.stats.vm.v_inactive_count: 29 vm.stats.vm.v_laundry_count: 0 vm.stats.vm.v_cache_count: 0 vm.stats.vm.v_pageout_free_min: 34 vm.stats.vm.v_interrupt_free_min: 2 vm.stats.vm.v_forks: 4 vm.stats.vm.v_vforks: 0 vm.stats.vm.v_rforks: 0 vm.stats.vm.v_kthreads: 20 vm.stats.vm.v_forkpages: 132 vm.stats.vm.v_vforkpages: 0 vm.stats.vm.v_rforkpages: 0 vm.stats.vm.v_kthreadpages: 0 # Ruslan From owner-svn-src-head@freebsd.org Wed Nov 16 22:08:59 2016 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 63E1CC45197; Wed, 16 Nov 2016 22:08:59 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt0-x229.google.com (mail-qt0-x229.google.com [IPv6:2607:f8b0:400d:c0d::229]) (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 1EA841644; Wed, 16 Nov 2016 22:08:59 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt0-x229.google.com with SMTP id c47so117644444qtc.2; Wed, 16 Nov 2016 14:08:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UzflFff2bAwNCaBkW4CdkcHWGekz+x+vWEqfb+56zMI=; b=FEePmXplbv19EIwE5bR0sHTGWq6MEGUZfn/QEPpdhlspIlXeBFWFlF8NTfeArqxiV6 qmekAPyQfOUIsWSHhFO+57mCSmx+dod/BDuTZrITqR7W6gHxOcMCaxRJmHVlS5R5GYn2 37GUr+uvlmC3m0LMV6wv82c0rtmxtFAL2hItXi0bpFATmNpD+OYWcO9WH0Tj4etshxI+ kHWczi8L82DIM6uFUWsxG/lhPCX06DCmbwZADjFvwDA7/H2KtUO4NC7ydGNiHNVb73vQ MJtVFA6IGfI6OWY13NFDT+UU7D29UulyjxZrCmS/SJtsC47Gtv2wp9WZEz6Lh6I0e6gb xd4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=UzflFff2bAwNCaBkW4CdkcHWGekz+x+vWEqfb+56zMI=; b=IwkBHw5JWV7dxW4E+Vk42O2kKh4dHzvjFie/ihTocyxK6gD/n+F1P7+SiOi2+G2fV2 CZz5Gg7/gVavTXszlB2Gu2BgUqNEeVBOm47BPklxm26A73uOtC++UAFUPBqLdOIEkkNs o2eWIjWzPf4gzMf87YG7qFGFU4caW3d4+cvC81qqOx7uegtrUvNHZ6VUEtbYTwW8M4Q+ MVM80GsOkAGifkorQrJtTDSXw1oN2B5d3ZsO7MkMMq7ZnzsKJ4xAhHVVX4S1THnIhj5r iKINu146fdbi9fYnVo/qRB0PSYpTQlS2CZFx/VWuvNU0eAOnQ44XBEIF9HLNJ54Z4T+j jwGg== X-Gm-Message-State: ABUngveCqaZ+xK0VTzYb8cmE4ZU8fZAcXReCb9wmrw0JMNN+lNlcunwmsVEh3sCfvUOjgQ== X-Received: by 10.237.36.114 with SMTP id s47mr3951430qtc.221.1479334138107; Wed, 16 Nov 2016 14:08:58 -0800 (PST) Received: from wkstn-mjohnston.west.isilon.com (c-76-104-201-218.hsd1.wa.comcast.net. [76.104.201.218]) by smtp.gmail.com with ESMTPSA id t17sm12221839qtc.36.2016.11.16.14.08.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2016 14:08:57 -0800 (PST) Sender: Mark Johnston Date: Wed, 16 Nov 2016 14:14:40 -0800 From: Mark Johnston To: Sepherosa Ziehau Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308664 - in head: contrib/hyperv/tools etc/devd etc/mtree include share/man/man4 sys/conf sys/dev/hyperv/utilities sys/modules/hyperv/utilities usr.sbin/hyperv usr.sbin/hyperv/tools us... Message-ID: <20161116221440.GA83880@wkstn-mjohnston.west.isilon.com> References: <201611150236.uAF2aCV8015106@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201611150236.uAF2aCV8015106@repo.freebsd.org> User-Agent: Mutt/1.7.1 (2016-10-04) 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, 16 Nov 2016 22:08:59 -0000 On Tue, Nov 15, 2016 at 02:36:12AM +0000, Sepherosa Ziehau wrote: > Author: sephe > Date: Tue Nov 15 02:36:12 2016 > New Revision: 308664 > URL: https://svnweb.freebsd.org/changeset/base/308664 > > Log: > hyperv/vss: Add driver and tools for VSS > > VSS stands for "Volume Shadow Copy Service". Unlike virtual machine > snapshot, it only takes snapshot for the virtual disks, so both > filesystem and applications have to aware of it, and cooperate the > whole VSS process. > > This driver exposes two device files to the userland: > > /dev/hv_fsvss_dev > > Normally userland programs should _not_ mess with this device file. > It is currently used by the hv_vss_daemon(8), which freezes and > thaws the filesystem. NOTE: currently only UFS is supported, if > the system mounts _any_ other filesystems, the hv_vss_daemon(8) > will veto the VSS process. > > If hv_vss_daemon(8) was disabled, then this device file must be > opened, and proper ioctls must be issued to keep the VSS working. > > /dev/hv_appvss_dev > > Userland application can opened this device file to receive the > VSS freeze notification, hold the VSS for a while (mainly to flush > application data to filesystem), release the VSS process, and > receive the VSS thaw notification i.e. applications can run again. > > The VSS will still work, even if this device file is not opened. > However, only filesystem consistency is promised, if this device > file is not opened or is not operated properly. > > hv_vss_daemon(8) is started by devd(8) by default. It can be disabled > by editting /etc/devd/hyperv.conf. > > Submitted by: Hongjiang Zhang > Reviewed by: kib, mckusick > MFC after: 3 weeks > Sponsored by: Microsoft > Differential Revision: https://reviews.freebsd.org/D8224 > > Added: > head/contrib/hyperv/tools/hv_vss_daemon.8 > head/contrib/hyperv/tools/hv_vss_daemon.c > head/share/man/man4/hv_vss.4 (contents, props changed) > head/sys/dev/hyperv/utilities/hv_snapshot.c (contents, props changed) > head/sys/dev/hyperv/utilities/hv_snapshot.h (contents, props changed) > head/usr.sbin/hyperv/tools/kvp/ > head/usr.sbin/hyperv/tools/kvp/Makefile > - copied, changed from r308663, head/usr.sbin/hyperv/tools/Makefile > head/usr.sbin/hyperv/tools/kvp/Makefile.depend > - copied unchanged from r308663, head/usr.sbin/hyperv/tools/Makefile.depend > head/usr.sbin/hyperv/tools/vss/ > head/usr.sbin/hyperv/tools/vss/Makefile (contents, props changed) > head/usr.sbin/hyperv/tools/vss/Makefile.depend (contents, props changed) > Deleted: > head/usr.sbin/hyperv/tools/Makefile > head/usr.sbin/hyperv/tools/Makefile.depend > Modified: > head/etc/devd/hyperv.conf > head/etc/mtree/BSD.include.dist > head/include/Makefile > head/share/man/man4/Makefile > head/sys/conf/files.amd64 > head/sys/conf/files.i386 > head/sys/modules/hyperv/utilities/Makefile > head/usr.sbin/hyperv/Makefile This appears to install hv_kvp_daemon and hv_vss_daemon to / instead of /usr/sbin, and breaks the -DNO_ROOT build. I think a Makefile.inc is needed in usr.sbin/hyperv/tools in order to preserve BINDIR from usr.sbin/Makefile.inc. I fixed the problem in my tree with the diff below, but am not sure if this is the right way to do it. For some reason, doing this resulted in unused var warnings compiling hv_vss_daemon.c. diff --git a/contrib/hyperv/tools/hv_vss_daemon.c b/contrib/hyperv/tools/hv_vss_daemon.c index 8b58bc9..a1ba98d 100644 --- a/contrib/hyperv/tools/hv_vss_daemon.c +++ b/contrib/hyperv/tools/hv_vss_daemon.c @@ -158,10 +158,9 @@ main(int argc, char* argv[]) struct pollfd hv_vss_poll_fd[1]; uint32_t op; - int ch, r, len, error; + int ch, r, error; int hv_vss_dev_fd; - int freeze_thaw = UNDEF_FREEZE_THAW; while ((ch = getopt(argc, argv, "dnh")) != -1) { switch (ch) { case 'n': diff --git a/usr.sbin/hyperv/Makefile.inc b/usr.sbin/hyperv/tools/Makefile.inc similarity index 60% rename from usr.sbin/hyperv/Makefile.inc rename to usr.sbin/hyperv/tools/Makefile.inc index edb0129..7e09f32 100644 --- a/usr.sbin/hyperv/Makefile.inc +++ b/usr.sbin/hyperv/tools/Makefile.inc @@ -1,4 +1,4 @@ # $FreeBSD$ CFLAGS.gcc+= -Wno-uninitialized -.include "../Makefile.inc" +.include "../../Makefile.inc" From owner-svn-src-head@freebsd.org Thu Nov 17 00:21:56 2016 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 983E2C41247; Thu, 17 Nov 2016 00:21:56 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6731D1A5A; Thu, 17 Nov 2016 00:21:56 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAH0LtbE019411; Thu, 17 Nov 2016 00:21:55 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAH0Lt45019410; Thu, 17 Nov 2016 00:21:55 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611170021.uAH0Lt45019410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 17 Nov 2016 00:21:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308741 - head X-SVN-Group: head 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, 17 Nov 2016 00:21:56 -0000 Author: bdrewery Date: Thu Nov 17 00:21:55 2016 New Revision: 308741 URL: https://svnweb.freebsd.org/changeset/base/308741 Log: Fix grammar nit Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Nov 16 22:28:46 2016 (r308740) +++ head/UPDATING Thu Nov 17 00:21:55 2016 (r308741) @@ -130,7 +130,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 20160527: CAM will now strip leading spaces from SCSI disks' serial numbers. - This will effect users who create UFS filesystems on SCSI disks using + This will affect users who create UFS filesystems on SCSI disks using those disk's diskid device nodes. For example, if /etc/fstab previously contained a line like "/dev/diskid/DISK-%20%20%20%20%20%20%20ABCDEFG0123456", you should From owner-svn-src-head@freebsd.org Thu Nov 17 00:31:53 2016 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 883A6C41550; Thu, 17 Nov 2016 00:31:53 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x231.google.com (mail-qk0-x231.google.com [IPv6:2607:f8b0:400d:c09::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 3D76B92; Thu, 17 Nov 2016 00:31:53 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x231.google.com with SMTP id x190so198304901qkb.0; Wed, 16 Nov 2016 16:31:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=X7rMGVoS1o5k61m5yOIk2qEbVvmsG2bffAaMglNzquM=; b=QLViesshdfnFs0gwkKj34VbmVZC9KNxHn/00psEeRP2hucJB2Ew8aUlwnEBoFbFJUK Y42U6xydyQvz/RrITSdLr24wm1P4ABQAPhwlpwYeZ1IObP/cnjlbqHuj0eBLsYbMNemt JDxjbSs6I7DAy+sbTvFrFwv38qzV9vqGZNH6SwrcXkpFfJbOKaMyqAhBwIeBdj9+//Ts w5V5lh/G3GirE1ejef7SxqJa+ngIVytlY293RUExZHxfkNTlo/NkAg41Jkm2r1dt+yqw ic8ODltXAxyvh8Ww6gdrVhI8ZkRib6oAp/agETJJB81fP/tdmGrT5s34GkWzVmYxKfbq tvUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=X7rMGVoS1o5k61m5yOIk2qEbVvmsG2bffAaMglNzquM=; b=ff1DPal3rPsdAuv2KUmKEXEo46+HM9oJPCG3+XTZOWcNALFBC0MonrgzIkzCbmaCq6 PHEU2f2eHX/iX4IGWBjxFustcZesxwaAuGfxcQf8fS1q+naToYQMnufaV89117SkDxFe 7LiWx5Q4eJwSPxIFdV2XZoXlyca1LN9iLDIzUyG9pPIzFgx+t0Vo6sYS+ivXAgvvYyvr F5yFVMnG4iLa3Apo3nQY2HOC3IbhXLtJZcaOKUaI4dfg2lBhlmDn1ZamIXRsGK5V5Pn2 A8PyGkst0PX57/NfnRr0HlM6d3nWZ4UWRLIU0IpYvErYj4NlizxDV62q2qLvpqAm6/s3 yVzg== X-Gm-Message-State: AKaTC01IDriIIvgeiVhFa2JLc9kiA/R/u2ItmXavl7CvOfF6oAVQv5AlOzqRKW0bnwgxMhHS8Dp76n/3r7b83Q== X-Received: by 10.55.16.134 with SMTP id 6mr524234qkq.76.1479342712072; Wed, 16 Nov 2016 16:31:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.29.66 with HTTP; Wed, 16 Nov 2016 16:31:51 -0800 (PST) In-Reply-To: <20161116221440.GA83880@wkstn-mjohnston.west.isilon.com> References: <201611150236.uAF2aCV8015106@repo.freebsd.org> <20161116221440.GA83880@wkstn-mjohnston.west.isilon.com> From: Ngie Cooper Date: Wed, 16 Nov 2016 16:31:51 -0800 Message-ID: Subject: Re: svn commit: r308664 - in head: contrib/hyperv/tools etc/devd etc/mtree include share/man/man4 sys/conf sys/dev/hyperv/utilities sys/modules/hyperv/utilities usr.sbin/hyperv usr.sbin/hyperv/tools us... To: Mark Johnston Cc: Sepherosa Ziehau , "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: Thu, 17 Nov 2016 00:31:53 -0000 On Wed, Nov 16, 2016 at 2:14 PM, Mark Johnston wrote: ... > This appears to install hv_kvp_daemon and hv_vss_daemon to / instead of > /usr/sbin, and breaks the -DNO_ROOT build. I think a Makefile.inc is > needed in usr.sbin/hyperv/tools in order to preserve BINDIR from > usr.sbin/Makefile.inc. I fixed the problem in my tree with the diff > below, but am not sure if this is the right way to do it. For some > reason, doing this resulted in unused var warnings compiling > hv_vss_daemon.c. The -Wunused warnings you're seeing are because you're now it's setting WARNS by .include'ing usr.bin/Makefile.inc ; it used to be set (I verified that), but then got unset between a few weeks ago and now on the directory: $ make -V.CURDIR -VWARNS /usr/src/usr.sbin/hyperv/tools $ Cheers, -Ngie PS -Wno-uninitialized is only set for gcc...? Really...??? From owner-svn-src-head@freebsd.org Thu Nov 17 01:35:11 2016 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 06B71C45686; Thu, 17 Nov 2016 01:35:11 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-ua0-x242.google.com (mail-ua0-x242.google.com [IPv6:2607:f8b0:400c:c08::242]) (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 B43E398D; Thu, 17 Nov 2016 01:35:10 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-ua0-x242.google.com with SMTP id b35so13297714uaa.1; Wed, 16 Nov 2016 17:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=1iHB/T4/OM7X2dsYOAv0uuIJBCb3J3NYmM3gH4WZbVA=; b=RSroiCxF10mP+1oLRycwsUJT6fTgDm4TbHmFN2qjgjGx7xyxY8+UXkPbBK6Ycf3NY4 b3t6s3PVwPbJCjRECDFMpFwRRQ9lnKWohe/qrpWT6bZUkwwpsHPblLszCEYnsewR1U/k GknyPuOLhpnMC1KgjYQcjyJ+oX1AffPzQyl8mHXJCyWJwvTkcY6fZcMuIdjSmA5RURLG v9TvX9TKTy3u9B3wEJA0yRCWkgcJZbz1uDd4T0gricM5u/GNtagRtJQHy9FxI+0TY3ip UC203t5lei/MiG4+TwSGyy3cBaAJGpSXZb5EiI9chbb9bIlFCRMY5rJOVw9jcZE011wn Oeeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=1iHB/T4/OM7X2dsYOAv0uuIJBCb3J3NYmM3gH4WZbVA=; b=CS4gYfzMUNvc4RNtKrUMEjeoq5Uk4vS+tk3xi/24s/l0EZap+IY8RQj6nzGuwAqocS ocblP+zASv26WBDWMmvNO9jiaSAJUms8oPH1aWTlE6KbEhPI4+HghFMlUbYqOIeHS5t2 HaO5wINOy7WJ2d7iRRS6Tnv5EXTbcm3r8Z4YQ0czytyc2s8NlJYx+uHFqTwWTQJxjuCC 8QOimOO8XcmIt9GEDB53Q1hM6bwqfCqtgS6m2W83VcILzp+88kWWKlSjlR/fDGgDYy6h f4xatCsX4W0CsFi1llXQtChvgklfsbPg6K6BE/yY27eCP2D89RR2wC3ty3d6dt6uaHG6 htOA== X-Gm-Message-State: AKaTC02yNH3DhA7X2epJE1y/L/SCqvvPsQD2I0GEY320FZwQDQc9DelN1HMB2IUt+GtyeVPgvHNSwzinRwqGBw== X-Received: by 10.159.49.11 with SMTP id m11mr327321uab.178.1479346509491; Wed, 16 Nov 2016 17:35:09 -0800 (PST) MIME-Version: 1.0 Sender: sepherosa@gmail.com Received: by 10.159.36.247 with HTTP; Wed, 16 Nov 2016 17:35:08 -0800 (PST) In-Reply-To: <20161116221440.GA83880@wkstn-mjohnston.west.isilon.com> References: <201611150236.uAF2aCV8015106@repo.freebsd.org> <20161116221440.GA83880@wkstn-mjohnston.west.isilon.com> From: Sepherosa Ziehau Date: Thu, 17 Nov 2016 09:35:08 +0800 X-Google-Sender-Auth: Dlk5Fv7wQZvxay7xROGUO3Sd6Oo Message-ID: Subject: Re: svn commit: r308664 - in head: contrib/hyperv/tools etc/devd etc/mtree include share/man/man4 sys/conf sys/dev/hyperv/utilities sys/modules/hyperv/utilities usr.sbin/hyperv usr.sbin/hyperv/tools us... To: Mark Johnston 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: Thu, 17 Nov 2016 01:35:11 -0000 On Thu, Nov 17, 2016 at 6:14 AM, Mark Johnston wrote: > On Tue, Nov 15, 2016 at 02:36:12AM +0000, Sepherosa Ziehau wrote: >> Author: sephe >> Date: Tue Nov 15 02:36:12 2016 >> New Revision: 308664 >> URL: https://svnweb.freebsd.org/changeset/base/308664 >> >> Log: >> hyperv/vss: Add driver and tools for VSS >> >> VSS stands for "Volume Shadow Copy Service". Unlike virtual machine >> snapshot, it only takes snapshot for the virtual disks, so both >> filesystem and applications have to aware of it, and cooperate the >> whole VSS process. >> >> This driver exposes two device files to the userland: >> >> /dev/hv_fsvss_dev >> >> Normally userland programs should _not_ mess with this device file. >> It is currently used by the hv_vss_daemon(8), which freezes and >> thaws the filesystem. NOTE: currently only UFS is supported, if >> the system mounts _any_ other filesystems, the hv_vss_daemon(8) >> will veto the VSS process. >> >> If hv_vss_daemon(8) was disabled, then this device file must be >> opened, and proper ioctls must be issued to keep the VSS working. >> >> /dev/hv_appvss_dev >> >> Userland application can opened this device file to receive the >> VSS freeze notification, hold the VSS for a while (mainly to flush >> application data to filesystem), release the VSS process, and >> receive the VSS thaw notification i.e. applications can run again. >> >> The VSS will still work, even if this device file is not opened. >> However, only filesystem consistency is promised, if this device >> file is not opened or is not operated properly. >> >> hv_vss_daemon(8) is started by devd(8) by default. It can be disabled >> by editting /etc/devd/hyperv.conf. >> >> Submitted by: Hongjiang Zhang >> Reviewed by: kib, mckusick >> MFC after: 3 weeks >> Sponsored by: Microsoft >> Differential Revision: https://reviews.freebsd.org/D8224 >> >> Added: >> head/contrib/hyperv/tools/hv_vss_daemon.8 >> head/contrib/hyperv/tools/hv_vss_daemon.c >> head/share/man/man4/hv_vss.4 (contents, props changed) >> head/sys/dev/hyperv/utilities/hv_snapshot.c (contents, props changed) >> head/sys/dev/hyperv/utilities/hv_snapshot.h (contents, props changed) >> head/usr.sbin/hyperv/tools/kvp/ >> head/usr.sbin/hyperv/tools/kvp/Makefile >> - copied, changed from r308663, head/usr.sbin/hyperv/tools/Makefile >> head/usr.sbin/hyperv/tools/kvp/Makefile.depend >> - copied unchanged from r308663, head/usr.sbin/hyperv/tools/Makefile.depend >> head/usr.sbin/hyperv/tools/vss/ >> head/usr.sbin/hyperv/tools/vss/Makefile (contents, props changed) >> head/usr.sbin/hyperv/tools/vss/Makefile.depend (contents, props changed) >> Deleted: >> head/usr.sbin/hyperv/tools/Makefile >> head/usr.sbin/hyperv/tools/Makefile.depend >> Modified: >> head/etc/devd/hyperv.conf >> head/etc/mtree/BSD.include.dist >> head/include/Makefile >> head/share/man/man4/Makefile >> head/sys/conf/files.amd64 >> head/sys/conf/files.i386 >> head/sys/modules/hyperv/utilities/Makefile >> head/usr.sbin/hyperv/Makefile > > This appears to install hv_kvp_daemon and hv_vss_daemon to / instead of > /usr/sbin, and breaks the -DNO_ROOT build. I think a Makefile.inc is > needed in usr.sbin/hyperv/tools in order to preserve BINDIR from > usr.sbin/Makefile.inc. I fixed the problem in my tree with the diff > below, but am not sure if this is the right way to do it. For some > reason, doing this resulted in unused var warnings compiling > hv_vss_daemon.c. > > diff --git a/contrib/hyperv/tools/hv_vss_daemon.c b/contrib/hyperv/tools/hv_vss_daemon.c > index 8b58bc9..a1ba98d 100644 > --- a/contrib/hyperv/tools/hv_vss_daemon.c > +++ b/contrib/hyperv/tools/hv_vss_daemon.c > @@ -158,10 +158,9 @@ main(int argc, char* argv[]) > > struct pollfd hv_vss_poll_fd[1]; > uint32_t op; > - int ch, r, len, error; > + int ch, r, error; > int hv_vss_dev_fd; > > - int freeze_thaw = UNDEF_FREEZE_THAW; > while ((ch = getopt(argc, argv, "dnh")) != -1) { > switch (ch) { > case 'n': > diff --git a/usr.sbin/hyperv/Makefile.inc b/usr.sbin/hyperv/tools/Makefile.inc > similarity index 60% > rename from usr.sbin/hyperv/Makefile.inc > rename to usr.sbin/hyperv/tools/Makefile.inc > index edb0129..7e09f32 100644 > --- a/usr.sbin/hyperv/Makefile.inc > +++ b/usr.sbin/hyperv/tools/Makefile.inc > @@ -1,4 +1,4 @@ > # $FreeBSD$ > > CFLAGS.gcc+= -Wno-uninitialized > -.include "../Makefile.inc" > +.include "../../Makefile.inc" Thank you for the patch! I will handle it today! -- Tomorrow Will Never Die From owner-svn-src-head@freebsd.org Thu Nov 17 03:00:57 2016 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 AE3C2C45CC5; Thu, 17 Nov 2016 03:00:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D92D1DF2; Thu, 17 Nov 2016 03:00:57 +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 uAH30uB6078621; Thu, 17 Nov 2016 03:00:56 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAH30uB4078620; Thu, 17 Nov 2016 03:00:56 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611170300.uAH30uB4078620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 17 Nov 2016 03:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308742 - head/contrib/hyperv/tools X-SVN-Group: head 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, 17 Nov 2016 03:00:57 -0000 Author: sephe Date: Thu Nov 17 03:00:56 2016 New Revision: 308742 URL: https://svnweb.freebsd.org/changeset/base/308742 Log: hyperv/vss: Nuke unused variables. Submitted by: markj Reported by: markj MFC after: 3 weeks Sponsored by: Microsoft Modified: head/contrib/hyperv/tools/hv_vss_daemon.c Modified: head/contrib/hyperv/tools/hv_vss_daemon.c ============================================================================== --- head/contrib/hyperv/tools/hv_vss_daemon.c Thu Nov 17 00:21:55 2016 (r308741) +++ head/contrib/hyperv/tools/hv_vss_daemon.c Thu Nov 17 03:00:56 2016 (r308742) @@ -158,10 +158,9 @@ main(int argc, char* argv[]) struct pollfd hv_vss_poll_fd[1]; uint32_t op; - int ch, r, len, error; + int ch, r, error; int hv_vss_dev_fd; - int freeze_thaw = UNDEF_FREEZE_THAW; while ((ch = getopt(argc, argv, "dnh")) != -1) { switch (ch) { case 'n': From owner-svn-src-head@freebsd.org Thu Nov 17 03:02:36 2016 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 A17F5C430BB; Thu, 17 Nov 2016 03:02:36 +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 6A561868; Thu, 17 Nov 2016 03:02:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAH32ZHJ083193; Thu, 17 Nov 2016 03:02:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAH32Zsf083192; Thu, 17 Nov 2016 03:02:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201611170302.uAH32Zsf083192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 17 Nov 2016 03:02:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308743 - head/usr.sbin/hyperv/tools X-SVN-Group: head 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, 17 Nov 2016 03:02:36 -0000 Author: sephe Date: Thu Nov 17 03:02:35 2016 New Revision: 308743 URL: https://svnweb.freebsd.org/changeset/base/308743 Log: hyperv/vss: Install the userland daemon to /usr/sbin instead of / Submitted by: markj Reported by: markj MFC after: 3 weeks Sponsored by: Microsoft Added: head/usr.sbin/hyperv/tools/Makefile.inc (contents, props changed) Added: head/usr.sbin/hyperv/tools/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/hyperv/tools/Makefile.inc Thu Nov 17 03:02:35 2016 (r308743) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +CFLAGS.gcc+= -Wno-uninitialized +.include "../../Makefile.inc" From owner-svn-src-head@freebsd.org Thu Nov 17 03:03:32 2016 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 06948C432C0; Thu, 17 Nov 2016 03:03:32 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-vk0-x244.google.com (mail-vk0-x244.google.com [IPv6:2607:f8b0:400c:c05::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B33F5A2B; Thu, 17 Nov 2016 03:03:31 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-vk0-x244.google.com with SMTP id l126so13582784vkh.0; Wed, 16 Nov 2016 19:03:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Ta+RsB2zCO31ZRCoxaJm9JlRrQGfexZpbu4OpVqwMjU=; b=PrQDexK66ZRqNIcHgmFGODiZydErM7XXt+960OAs8/VwPBHmpAPCHE6reheQnJJjJ1 d+cw5onDxxzphS7Bv1DDq0NsOWVGAlcMeWsAhfEGfVtrJ+csIBF6m/7EjlOEGREUcY4s XmaLJyvApEdIXBZVgYby/jamCxgkPKBWfhswDfckzeYDpB0yPNKGiaDDg9XBGgcoKUkR WquSiHZBx1C/AQmB/dhFpTLNmG9ESF7NBvWlcCs+b4c9iZZfPfSXEA5bNXQKpjbS3gPi sbCIQqo1qKtPVHUmncGODTvlQhhk/g1sMHG8dghUSJLsewUL28bmCLcb8F4/lWgwkZWY /2SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Ta+RsB2zCO31ZRCoxaJm9JlRrQGfexZpbu4OpVqwMjU=; b=lDpCIcBvGfPFzXhGUAa4NAurAh8PogMfPfYkw3Gf9tA479xJZdnYJwFNvRQwhhAnMf DL/UFjTIE7QaeVMLafKUtmug5n5nCPnB1krIQjwu8/gp6ggo3xZyeI7UiFvqjMuYUxQE Nt7vrU293oHeCnyEnuYbgnmMvVA440qvtrsoO3pbmhsU8HCgth9bAmix1/bmW46mNRRq +ENSYl8R1c1kVTsjf5+7iRdkuUiS28WNhQrHodM+43giww6cyv8+meLWXBfhVKgKNjDi cS4k/fMQ+nIv1p86rQ1Z4hEvHTU0ijmX0cAwabVkrgTfucag5Nhm8Gs2MxrzhhlBxL6Z kEwg== X-Gm-Message-State: AKaTC02fRdyF8xwPw7JzljwJaCw4nJ4+wFV4mJXHNYP+NgEd3MFJbGytHlxIqc8pIUx4F1SZQA29wH0n0vgB1g== X-Received: by 10.31.168.7 with SMTP id r7mr390026vke.148.1479351810607; Wed, 16 Nov 2016 19:03:30 -0800 (PST) MIME-Version: 1.0 Sender: sepherosa@gmail.com Received: by 10.159.36.247 with HTTP; Wed, 16 Nov 2016 19:03:30 -0800 (PST) In-Reply-To: <20161116221440.GA83880@wkstn-mjohnston.west.isilon.com> References: <201611150236.uAF2aCV8015106@repo.freebsd.org> <20161116221440.GA83880@wkstn-mjohnston.west.isilon.com> From: Sepherosa Ziehau Date: Thu, 17 Nov 2016 11:03:30 +0800 X-Google-Sender-Auth: 5Jn3gAJHqQEPG2Aw5D3ntHHnaVY Message-ID: Subject: Re: svn commit: r308664 - in head: contrib/hyperv/tools etc/devd etc/mtree include share/man/man4 sys/conf sys/dev/hyperv/utilities sys/modules/hyperv/utilities usr.sbin/hyperv usr.sbin/hyperv/tools us... To: Mark Johnston 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: Thu, 17 Nov 2016 03:03:32 -0000 On Thu, Nov 17, 2016 at 6:14 AM, Mark Johnston wrote: > On Tue, Nov 15, 2016 at 02:36:12AM +0000, Sepherosa Ziehau wrote: >> Author: sephe >> Date: Tue Nov 15 02:36:12 2016 >> New Revision: 308664 >> URL: https://svnweb.freebsd.org/changeset/base/308664 >> >> Log: >> hyperv/vss: Add driver and tools for VSS > > This appears to install hv_kvp_daemon and hv_vss_daemon to / instead of > /usr/sbin, and breaks the -DNO_ROOT build. I think a Makefile.inc is > needed in usr.sbin/hyperv/tools in order to preserve BINDIR from > usr.sbin/Makefile.inc. I fixed the problem in my tree with the diff > below, but am not sure if this is the right way to do it. For some > reason, doing this resulted in unused var warnings compiling > hv_vss_daemon.c. > > diff --git a/contrib/hyperv/tools/hv_vss_daemon.c b/contrib/hyperv/tools/hv_vss_daemon.c > index 8b58bc9..a1ba98d 100644 > --- a/contrib/hyperv/tools/hv_vss_daemon.c > +++ b/contrib/hyperv/tools/hv_vss_daemon.c > @@ -158,10 +158,9 @@ main(int argc, char* argv[]) > > struct pollfd hv_vss_poll_fd[1]; > uint32_t op; > - int ch, r, len, error; > + int ch, r, error; > int hv_vss_dev_fd; > > - int freeze_thaw = UNDEF_FREEZE_THAW; > while ((ch = getopt(argc, argv, "dnh")) != -1) { > switch (ch) { > case 'n': > diff --git a/usr.sbin/hyperv/Makefile.inc b/usr.sbin/hyperv/tools/Makefile.inc > similarity index 60% > rename from usr.sbin/hyperv/Makefile.inc > rename to usr.sbin/hyperv/tools/Makefile.inc > index edb0129..7e09f32 100644 > --- a/usr.sbin/hyperv/Makefile.inc > +++ b/usr.sbin/hyperv/tools/Makefile.inc > @@ -1,4 +1,4 @@ > # $FreeBSD$ > > CFLAGS.gcc+= -Wno-uninitialized > -.include "../Makefile.inc" > +.include "../../Makefile.inc" Committed! Thank you for the submission! -- Tomorrow Will Never Die From owner-svn-src-head@freebsd.org Thu Nov 17 07:33:38 2016 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 B8C26C46952; Thu, 17 Nov 2016 07:33:38 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84A391290; Thu, 17 Nov 2016 07:33:38 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAH7Xb25090121; Thu, 17 Nov 2016 07:33:37 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAH7XbFV090120; Thu, 17 Nov 2016 07:33:37 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201611170733.uAH7XbFV090120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Thu, 17 Nov 2016 07:33:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308744 - head/sys/dev/etherswitch/infineon X-SVN-Group: head 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, 17 Nov 2016 07:33:38 -0000 Author: mizhka Date: Thu Nov 17 07:33:37 2016 New Revision: 308744 URL: https://svnweb.freebsd.org/changeset/base/308744 Log: [etherswitch] add infineon adm6996fc support on etherswitch This is Infineon ADM6996FC/M/MX driver code on etherswitch framework. Support PORT and DOT1Q VLAN. This code suppose ADM6996FC SDC/SDIO connect to SOC network interface MDC/MDIO. This code tested on Netgear WGR614Cv7. Submitted by: Hiroki Mori Reviewed by: adrian, mizhka Approved by: adrian(mentor) Differential Revision: https://reviews.freebsd.org/D8495 Added: head/sys/dev/etherswitch/infineon/ head/sys/dev/etherswitch/infineon/adm6996fc.c (contents, props changed) Added: head/sys/dev/etherswitch/infineon/adm6996fc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/etherswitch/infineon/adm6996fc.c Thu Nov 17 07:33:37 2016 (r308744) @@ -0,0 +1,858 @@ +/*- + * Copyright (c) 2016 Hiroki Mori + * Copyright (c) 2013 Luiz Otavio O Souza. + * Copyright (c) 2011-2012 Stefan Bethke. + * Copyright (c) 2012 Adrian Chadd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * This is Infineon ADM6996FC/M/MX driver code on etherswitch framework. + * Support PORT and DOT1Q VLAN. + * This code suppose ADM6996FC SDC/SDIO connect to SOC network interface + * MDC/MDIO. + * This code development on Netgear WGR614Cv7. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "mdio_if.h" +#include "miibus_if.h" +#include "etherswitch_if.h" + +#define ADM6996FC_PRODUCT_CODE 0x7102 + +#define ADM6996FC_SC3 0x11 +#define ADM6996FC_VF0L 0x40 +#define ADM6996FC_VF0H 0x41 +#define ADM6996FC_CI0 0xa0 +#define ADM6996FC_CI1 0xa1 +#define ADM6996FC_PHY_C0 0x200 + +#define ADM6996FC_PC_SHIFT 4 +#define ADM6996FC_TBV_SHIFT 5 +#define ADM6996FC_PVID_SHIFT 10 +#define ADM6996FC_OPTE_SHIFT 4 +#define ADM6996FC_VV_SHIFT 15 + +#define ADM6996FC_PHY_SIZE 0x20 + +MALLOC_DECLARE(M_ADM6996FC); +MALLOC_DEFINE(M_ADM6996FC, "adm6996fc", "adm6996fc data structures"); + +struct adm6996fc_softc { + struct mtx sc_mtx; /* serialize access to softc */ + device_t sc_dev; + int vlan_mode; + int media; /* cpu port media */ + int cpuport; /* which PHY is connected to the CPU */ + int phymask; /* PHYs we manage */ + int numports; /* number of ports */ + int ifpport[MII_NPHY]; + int *portphy; + char **ifname; + device_t **miibus; + struct ifnet **ifp; + struct callout callout_tick; + etherswitch_info_t info; +}; + +#define ADM6996FC_LOCK(_sc) \ + mtx_lock(&(_sc)->sc_mtx) +#define ADM6996FC_UNLOCK(_sc) \ + mtx_unlock(&(_sc)->sc_mtx) +#define ADM6996FC_LOCK_ASSERT(_sc, _what) \ + mtx_assert(&(_sc)->sc_mtx, (_what)) +#define ADM6996FC_TRYLOCK(_sc) \ + mtx_trylock(&(_sc)->sc_mtx) + +#if defined(DEBUG) +#define DPRINTF(dev, args...) device_printf(dev, args) +#else +#define DPRINTF(dev, args...) +#endif + +static inline int adm6996fc_portforphy(struct adm6996fc_softc *, int); +static void adm6996fc_tick(void *); +static int adm6996fc_ifmedia_upd(struct ifnet *); +static void adm6996fc_ifmedia_sts(struct ifnet *, struct ifmediareq *); + +#define ADM6996FC_READREG(dev, x) \ + MDIO_READREG(dev, ((x) >> 5), ((x) & 0x1f)); +#define ADM6996FC_WRITEREG(dev, x, v) \ + MDIO_WRITEREG(dev, ((x) >> 5), ((x) & 0x1f), v); + +#define ADM6996FC_PVIDBYDATA(data1, data2) \ + ((((data1) >> ADM6996FC_PVID_SHIFT) & 0x0f) | ((data2) << 4)) + +static int +adm6996fc_probe(device_t dev) +{ + int data1, data2; + int pc; + struct adm6996fc_softc *sc; + + sc = device_get_softc(dev); + bzero(sc, sizeof(*sc)); + + data1 = ADM6996FC_READREG(device_get_parent(dev), ADM6996FC_CI0); + data2 = ADM6996FC_READREG(device_get_parent(dev), ADM6996FC_CI1); + pc = ((data2 << 16) | data1) >> ADM6996FC_PC_SHIFT; + if (bootverbose) + device_printf(dev,"Chip Identifier Register %x %x\n", data1, + data2); + + /* check Product Code */ + if (pc != ADM6996FC_PRODUCT_CODE) { + return (ENXIO); + } + + device_set_desc_copy(dev, "Infineon ADM6996FC/M/MX MDIO switch driver"); + return (BUS_PROBE_DEFAULT); +} + +static int +adm6996fc_attach_phys(struct adm6996fc_softc *sc) +{ + int phy, port, err; + char name[IFNAMSIZ]; + + port = 0; + err = 0; + /* PHYs need an interface, so we generate a dummy one */ + snprintf(name, IFNAMSIZ, "%sport", device_get_nameunit(sc->sc_dev)); + for (phy = 0; phy < sc->numports; phy++) { + if (((1 << phy) & sc->phymask) == 0) + continue; + sc->ifpport[phy] = port; + sc->portphy[port] = phy; + sc->ifp[port] = if_alloc(IFT_ETHER); + sc->ifp[port]->if_softc = sc; + sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | + IFF_DRV_RUNNING | IFF_SIMPLEX; + if_initname(sc->ifp[port], name, port); + sc->miibus[port] = malloc(sizeof(device_t), M_ADM6996FC, + M_WAITOK | M_ZERO); + if (sc->miibus[port] == NULL) { + err = ENOMEM; + goto failed; + } + err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port], + adm6996fc_ifmedia_upd, adm6996fc_ifmedia_sts, \ + BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); + DPRINTF(sc->sc_dev, "%s attached to pseudo interface %s\n", + device_get_nameunit(*sc->miibus[port]), + sc->ifp[port]->if_xname); + if (err != 0) { + device_printf(sc->sc_dev, + "attaching PHY %d failed\n", + phy); + goto failed; + } + ++port; + } + sc->info.es_nports = port; + if (sc->cpuport != -1) { + /* assume cpuport is last one */ + sc->ifpport[sc->cpuport] = port; + sc->portphy[port] = sc->cpuport; + ++sc->info.es_nports; + } + return (0); + +failed: + for (phy = 0; phy < sc->numports; phy++) { + if (((1 << phy) & sc->phymask) == 0) + continue; + port = adm6996fc_portforphy(sc, phy); + if (sc->miibus[port] != NULL) + device_delete_child(sc->sc_dev, (*sc->miibus[port])); + if (sc->ifp[port] != NULL) + if_free(sc->ifp[port]); + if (sc->ifname[port] != NULL) + free(sc->ifname[port], M_ADM6996FC); + if (sc->miibus[port] != NULL) + free(sc->miibus[port], M_ADM6996FC); + } + return (err); +} + +static int +adm6996fc_attach(device_t dev) +{ + struct adm6996fc_softc *sc; + int err; + + err = 0; + sc = device_get_softc(dev); + + sc->sc_dev = dev; + mtx_init(&sc->sc_mtx, "adm6996fc", NULL, MTX_DEF); + strlcpy(sc->info.es_name, device_get_desc(dev), + sizeof(sc->info.es_name)); + + /* ADM6996FC Defaults */ + sc->numports = 6; + sc->phymask = 0x1f; + sc->cpuport = 5; + sc->media = 100; + + sc->info.es_nvlangroups = 16; + sc->info.es_vlan_caps = ETHERSWITCH_VLAN_PORT | ETHERSWITCH_VLAN_DOT1Q; + + sc->ifp = malloc(sizeof(struct ifnet *) * sc->numports, M_ADM6996FC, + M_WAITOK | M_ZERO); + sc->ifname = malloc(sizeof(char *) * sc->numports, M_ADM6996FC, + M_WAITOK | M_ZERO); + sc->miibus = malloc(sizeof(device_t *) * sc->numports, M_ADM6996FC, + M_WAITOK | M_ZERO); + sc->portphy = malloc(sizeof(int) * sc->numports, M_ADM6996FC, + M_WAITOK | M_ZERO); + + if (sc->ifp == NULL || sc->ifname == NULL || sc->miibus == NULL || + sc->portphy == NULL) { + err = ENOMEM; + goto failed; + } + + /* + * Attach the PHYs and complete the bus enumeration. + */ + err = adm6996fc_attach_phys(sc); + if (err != 0) + goto failed; + + bus_generic_probe(dev); + bus_enumerate_hinted_children(dev); + err = bus_generic_attach(dev); + if (err != 0) + goto failed; + + callout_init(&sc->callout_tick, 0); + + adm6996fc_tick(sc); + + return (0); + +failed: + if (sc->portphy != NULL) + free(sc->portphy, M_ADM6996FC); + if (sc->miibus != NULL) + free(sc->miibus, M_ADM6996FC); + if (sc->ifname != NULL) + free(sc->ifname, M_ADM6996FC); + if (sc->ifp != NULL) + free(sc->ifp, M_ADM6996FC); + + return (err); +} + +static int +adm6996fc_detach(device_t dev) +{ + struct adm6996fc_softc *sc; + int i, port; + + sc = device_get_softc(dev); + + callout_drain(&sc->callout_tick); + + for (i = 0; i < MII_NPHY; i++) { + if (((1 << i) & sc->phymask) == 0) + continue; + port = adm6996fc_portforphy(sc, i); + if (sc->miibus[port] != NULL) + device_delete_child(dev, (*sc->miibus[port])); + if (sc->ifp[port] != NULL) + if_free(sc->ifp[port]); + free(sc->ifname[port], M_ADM6996FC); + free(sc->miibus[port], M_ADM6996FC); + } + + free(sc->portphy, M_ADM6996FC); + free(sc->miibus, M_ADM6996FC); + free(sc->ifname, M_ADM6996FC); + free(sc->ifp, M_ADM6996FC); + + bus_generic_detach(dev); + mtx_destroy(&sc->sc_mtx); + + return (0); +} + +/* + * Convert PHY number to port number. + */ +static inline int +adm6996fc_portforphy(struct adm6996fc_softc *sc, int phy) +{ + + return (sc->ifpport[phy]); +} + +static inline struct mii_data * +adm6996fc_miiforport(struct adm6996fc_softc *sc, int port) +{ + + if (port < 0 || port > sc->numports) + return (NULL); + if (port == sc->cpuport) + return (NULL); + return (device_get_softc(*sc->miibus[port])); +} + +static inline struct ifnet * +adm6996fc_ifpforport(struct adm6996fc_softc *sc, int port) +{ + + if (port < 0 || port > sc->numports) + return (NULL); + return (sc->ifp[port]); +} + +/* + * Poll the status for all PHYs. + */ +static void +adm6996fc_miipollstat(struct adm6996fc_softc *sc) +{ + int i, port; + struct mii_data *mii; + struct mii_softc *miisc; + + ADM6996FC_LOCK_ASSERT(sc, MA_NOTOWNED); + + for (i = 0; i < MII_NPHY; i++) { + if (((1 << i) & sc->phymask) == 0) + continue; + port = adm6996fc_portforphy(sc, i); + if ((*sc->miibus[port]) == NULL) + continue; + mii = device_get_softc(*sc->miibus[port]); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) { + if (IFM_INST(mii->mii_media.ifm_cur->ifm_media) != + miisc->mii_inst) + continue; + ukphy_status(miisc); + mii_phy_update(miisc, MII_POLLSTAT); + } + } +} + +static void +adm6996fc_tick(void *arg) +{ + struct adm6996fc_softc *sc; + + sc = arg; + + adm6996fc_miipollstat(sc); + callout_reset(&sc->callout_tick, hz, adm6996fc_tick, sc); +} + +static void +adm6996fc_lock(device_t dev) +{ + struct adm6996fc_softc *sc; + + sc = device_get_softc(dev); + + ADM6996FC_LOCK_ASSERT(sc, MA_NOTOWNED); + ADM6996FC_LOCK(sc); +} + +static void +adm6996fc_unlock(device_t dev) +{ + struct adm6996fc_softc *sc; + + sc = device_get_softc(dev); + + ADM6996FC_LOCK_ASSERT(sc, MA_OWNED); + ADM6996FC_UNLOCK(sc); +} + +static etherswitch_info_t * +adm6996fc_getinfo(device_t dev) +{ + struct adm6996fc_softc *sc; + + sc = device_get_softc(dev); + + return (&sc->info); +} + +static int +adm6996fc_getport(device_t dev, etherswitch_port_t *p) +{ + struct adm6996fc_softc *sc; + struct mii_data *mii; + struct ifmediareq *ifmr; + device_t parent; + int err, phy; + int data1, data2; + + int bcaddr[6] = {0x01, 0x03, 0x05, 0x07, 0x08, 0x09}; + int vidaddr[6] = {0x28, 0x29, 0x2a, 0x2b, 0x2b, 0x2c}; + + sc = device_get_softc(dev); + ifmr = &p->es_ifmr; + + if (p->es_port < 0 || p->es_port >= sc->numports) + return (ENXIO); + + parent = device_get_parent(dev); + + if (sc->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) { + data1 = ADM6996FC_READREG(parent, bcaddr[p->es_port]); + data2 = ADM6996FC_READREG(parent, vidaddr[p->es_port]); + /* only port 4 is hi bit */ + if (p->es_port == 4) + data2 = (data2 >> 8) & 0xff; + else + data2 = data2 & 0xff; + + p->es_pvid = ADM6996FC_PVIDBYDATA(data1, data2); + if (((data1 >> ADM6996FC_OPTE_SHIFT) & 0x01) == 1) + p->es_flags |= ETHERSWITCH_PORT_ADDTAG; + else + p->es_flags |= ETHERSWITCH_PORT_STRIPTAG; + } else { + p->es_pvid = 0; + } + + phy = sc->portphy[p->es_port]; + mii = adm6996fc_miiforport(sc, p->es_port); + if (sc->cpuport != -1 && phy == sc->cpuport) { + /* fill in fixed values for CPU port */ + p->es_flags |= ETHERSWITCH_PORT_CPU; + ifmr->ifm_count = 0; + if (sc->media == 100) + ifmr->ifm_current = ifmr->ifm_active = + IFM_ETHER | IFM_100_TX | IFM_FDX; + else + ifmr->ifm_current = ifmr->ifm_active = + IFM_ETHER | IFM_1000_T | IFM_FDX; + ifmr->ifm_mask = 0; + ifmr->ifm_status = IFM_ACTIVE | IFM_AVALID; + } else if (mii != NULL) { + err = ifmedia_ioctl(mii->mii_ifp, &p->es_ifr, + &mii->mii_media, SIOCGIFMEDIA); + if (err) + return (err); + } else { + return (ENXIO); + } + return (0); +} + +static int +adm6996fc_setport(device_t dev, etherswitch_port_t *p) +{ + struct adm6996fc_softc *sc; + struct ifmedia *ifm; + struct mii_data *mii; + struct ifnet *ifp; + device_t parent; + int err; + int data; + + int bcaddr[6] = {0x01, 0x03, 0x05, 0x07, 0x08, 0x09}; + int vidaddr[6] = {0x28, 0x29, 0x2a, 0x2b, 0x2b, 0x2c}; + + sc = device_get_softc(dev); + parent = device_get_parent(dev); + + if (p->es_port < 0 || p->es_port >= sc->numports) + return (ENXIO); + + if (sc->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) { + data = ADM6996FC_READREG(parent, bcaddr[p->es_port]); + data &= ~(0xf << 10); + data |= (p->es_pvid & 0xf) << ADM6996FC_PVID_SHIFT; + ADM6996FC_WRITEREG(parent, bcaddr[p->es_port], data); + data = ADM6996FC_READREG(parent, vidaddr[p->es_port]); + /* only port 4 is hi bit */ + if (p->es_port == 4) { + data &= ~(0xff << 8); + data = data | (((p->es_pvid >> 4) & 0xff) << 8); + } else { + data &= ~0xff; + data = data | ((p->es_pvid >> 4) & 0xff); + } + ADM6996FC_WRITEREG(parent, vidaddr[p->es_port], data); + err = 0; + } else { + if (sc->portphy[p->es_port] == sc->cpuport) + return (ENXIO); + } + + if (sc->portphy[p->es_port] != sc->cpuport) { + mii = adm6996fc_miiforport(sc, p->es_port); + if (mii == NULL) + return (ENXIO); + + ifp = adm6996fc_ifpforport(sc, p->es_port); + + ifm = &mii->mii_media; + err = ifmedia_ioctl(ifp, &p->es_ifr, ifm, SIOCSIFMEDIA); + } + return (err); +} + +static int +adm6996fc_getvgroup(device_t dev, etherswitch_vlangroup_t *vg) +{ + struct adm6996fc_softc *sc; + device_t parent; + int datahi, datalo; + + sc = device_get_softc(dev); + parent = device_get_parent(dev); + + if (sc->vlan_mode == ETHERSWITCH_VLAN_PORT) { + if (vg->es_vlangroup <= 5) { + vg->es_vid = ETHERSWITCH_VID_VALID; + vg->es_vid |= vg->es_vlangroup; + datalo = ADM6996FC_READREG(parent, + ADM6996FC_VF0L + 2 * vg->es_vlangroup); + datahi = ADM6996FC_READREG(parent, + ADM6996FC_VF0H + 2 * vg->es_vlangroup); + + vg->es_member_ports = datalo & 0x3f; + vg->es_untagged_ports = vg->es_member_ports; + vg->es_fid = 0; + } else { + vg->es_vid = 0; + } + } else if (sc->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) { + datalo = ADM6996FC_READREG(parent, + ADM6996FC_VF0L + 2 * vg->es_vlangroup); + datahi = ADM6996FC_READREG(parent, + ADM6996FC_VF0H + 2 * vg->es_vlangroup); + + if (datahi & (1 << ADM6996FC_VV_SHIFT)) { + vg->es_vid = ETHERSWITCH_VID_VALID; + vg->es_vid |= datahi & 0xfff; + vg->es_member_ports = datalo & 0x3f; + vg->es_untagged_ports = (~datalo >> 6) & 0x3f; + vg->es_fid = 0; + } else { + vg->es_fid = 0; + } + } else { + vg->es_fid = 0; + } + + return (0); +} + +static int +adm6996fc_setvgroup(device_t dev, etherswitch_vlangroup_t *vg) +{ + struct adm6996fc_softc *sc; + device_t parent; + + sc = device_get_softc(dev); + parent = device_get_parent(dev); + + if (sc->vlan_mode == ETHERSWITCH_VLAN_PORT) { + ADM6996FC_WRITEREG(parent, ADM6996FC_VF0L + 2 * vg->es_vlangroup, + vg->es_member_ports); + } else if (sc->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) { + ADM6996FC_WRITEREG(parent, ADM6996FC_VF0L + 2 * vg->es_vlangroup, + vg->es_member_ports | ((~vg->es_untagged_ports & 0x3f)<< 6)); + ADM6996FC_WRITEREG(parent, ADM6996FC_VF0H + 2 * vg->es_vlangroup, + (1 << ADM6996FC_VV_SHIFT) | vg->es_vid); + } + + return (0); +} + +static int +adm6996fc_getconf(device_t dev, etherswitch_conf_t *conf) +{ + struct adm6996fc_softc *sc; + + sc = device_get_softc(dev); + + /* Return the VLAN mode. */ + conf->cmd = ETHERSWITCH_CONF_VLAN_MODE; + conf->vlan_mode = sc->vlan_mode; + + return (0); +} + +static int +adm6996fc_setconf(device_t dev, etherswitch_conf_t *conf) +{ + struct adm6996fc_softc *sc; + device_t parent; + int i; + int data; + int bcaddr[6] = {0x01, 0x03, 0x05, 0x07, 0x08, 0x09}; + + sc = device_get_softc(dev); + parent = device_get_parent(dev); + + if ((conf->cmd & ETHERSWITCH_CONF_VLAN_MODE) == 0) + return (0); + + if (conf->vlan_mode == ETHERSWITCH_VLAN_PORT) { + sc->vlan_mode = ETHERSWITCH_VLAN_PORT; + data = ADM6996FC_READREG(parent, ADM6996FC_SC3); + data &= ~(1 << ADM6996FC_TBV_SHIFT); + ADM6996FC_WRITEREG(parent, ADM6996FC_SC3, data); + for (i = 0;i <= 5; ++i) { + data = ADM6996FC_READREG(parent, bcaddr[i]); + data &= ~(0xf << 10); + data |= (i << 10); + ADM6996FC_WRITEREG(parent, bcaddr[i], data); + ADM6996FC_WRITEREG(parent, ADM6996FC_VF0L + 2 * i, + 0x003f); + ADM6996FC_WRITEREG(parent, ADM6996FC_VF0H + 2 * i, + (1 << ADM6996FC_VV_SHIFT) | 1); + } + } else if (conf->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) { + sc->vlan_mode = ETHERSWITCH_VLAN_DOT1Q; + data = ADM6996FC_READREG(parent, ADM6996FC_SC3); + data |= (1 << ADM6996FC_TBV_SHIFT); + ADM6996FC_WRITEREG(parent, ADM6996FC_SC3, data); + for (i = 0;i <= 5; ++i) { + data = ADM6996FC_READREG(parent, bcaddr[i]); + /* Private VID set 1 */ + data &= ~(0xf << 10); + data |= (1 << 10); + /* Output Packet Tagging Enable */ + if (i == 5) + data |= (1 << 4); + ADM6996FC_WRITEREG(parent, bcaddr[i], data); + } + for (i = 2;i <= 15; ++i) { + ADM6996FC_WRITEREG(parent, ADM6996FC_VF0H + 2 * i, + 0x0000); + } + } else { + /* + ADM6996FC have no VLAN off. Then set Port base and + add all port to member. Use VLAN Filter 1 is reset + default. + */ + sc->vlan_mode = 0; + data = ADM6996FC_READREG(parent, ADM6996FC_SC3); + data &= ~(1 << ADM6996FC_TBV_SHIFT); + ADM6996FC_WRITEREG(parent, ADM6996FC_SC3, data); + for (i = 0;i <= 5; ++i) { + data = ADM6996FC_READREG(parent, bcaddr[i]); + data &= ~(0xf << 10); + data |= (1 << 10); + if (i == 5) + data &= ~(1 << 4); + ADM6996FC_WRITEREG(parent, bcaddr[i], data); + } + /* default setting */ + ADM6996FC_WRITEREG(parent, ADM6996FC_VF0L + 2, 0x003f); + ADM6996FC_WRITEREG(parent, ADM6996FC_VF0H + 2, + (1 << ADM6996FC_VV_SHIFT) | 1); + } + + + return (0); +} + +static void +adm6996fc_statchg(device_t dev) +{ + + DPRINTF(dev, "%s\n", __func__); +} + +static int +adm6996fc_ifmedia_upd(struct ifnet *ifp) +{ + struct adm6996fc_softc *sc; + struct mii_data *mii; + + sc = ifp->if_softc; + mii = adm6996fc_miiforport(sc, ifp->if_dunit); + + DPRINTF(sc->sc_dev, "%s\n", __func__); + if (mii == NULL) + return (ENXIO); + mii_mediachg(mii); + return (0); +} + +static void +adm6996fc_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + struct adm6996fc_softc *sc; + struct mii_data *mii; + + sc = ifp->if_softc; + mii = adm6996fc_miiforport(sc, ifp->if_dunit); + + DPRINTF(sc->sc_dev, "%s\n", __func__); + + if (mii == NULL) + return; + mii_pollstat(mii); + ifmr->ifm_active = mii->mii_media_active; + ifmr->ifm_status = mii->mii_media_status; +} + +static int +adm6996fc_readphy(device_t dev, int phy, int reg) +{ + struct adm6996fc_softc *sc; + int data; + + sc = device_get_softc(dev); + ADM6996FC_LOCK_ASSERT(sc, MA_NOTOWNED); + + if (phy < 0 || phy >= 32) + return (ENXIO); + if (reg < 0 || reg >= 32) + return (ENXIO); + + ADM6996FC_LOCK(sc); + data = ADM6996FC_READREG(device_get_parent(dev), + (ADM6996FC_PHY_C0 + ADM6996FC_PHY_SIZE * phy) + reg); + ADM6996FC_UNLOCK(sc); + + return (data); +} + +static int +adm6996fc_writephy(device_t dev, int phy, int reg, int data) +{ + struct adm6996fc_softc *sc; + int err; + + sc = device_get_softc(dev); + ADM6996FC_LOCK_ASSERT(sc, MA_NOTOWNED); + + if (phy < 0 || phy >= 32) + return (ENXIO); + if (reg < 0 || reg >= 32) + return (ENXIO); + + ADM6996FC_LOCK(sc); + err = ADM6996FC_WRITEREG(device_get_parent(dev), + (ADM6996FC_PHY_C0 + ADM6996FC_PHY_SIZE * phy) + reg, data); + ADM6996FC_UNLOCK(sc); + + return (err); +} + +static int +adm6996fc_readreg(device_t dev, int addr) +{ + + return ADM6996FC_READREG(device_get_parent(dev), addr); +} + +static int +adm6996fc_writereg(device_t dev, int addr, int value) +{ + int err; + + err = ADM6996FC_WRITEREG(device_get_parent(dev), addr, value); + return (err); +} + +static device_method_t adm6996fc_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, adm6996fc_probe), + DEVMETHOD(device_attach, adm6996fc_attach), + DEVMETHOD(device_detach, adm6996fc_detach), + + /* bus interface */ + DEVMETHOD(bus_add_child, device_add_child_ordered), + + /* MII interface */ + DEVMETHOD(miibus_readreg, adm6996fc_readphy), + DEVMETHOD(miibus_writereg, adm6996fc_writephy), + DEVMETHOD(miibus_statchg, adm6996fc_statchg), + + /* MDIO interface */ + DEVMETHOD(mdio_readreg, adm6996fc_readphy), + DEVMETHOD(mdio_writereg, adm6996fc_writephy), + + /* etherswitch interface */ + DEVMETHOD(etherswitch_lock, adm6996fc_lock), + DEVMETHOD(etherswitch_unlock, adm6996fc_unlock), + DEVMETHOD(etherswitch_getinfo, adm6996fc_getinfo), + DEVMETHOD(etherswitch_readreg, adm6996fc_readreg), + DEVMETHOD(etherswitch_writereg, adm6996fc_writereg), + DEVMETHOD(etherswitch_readphyreg, adm6996fc_readphy), + DEVMETHOD(etherswitch_writephyreg, adm6996fc_writephy), + DEVMETHOD(etherswitch_getport, adm6996fc_getport), + DEVMETHOD(etherswitch_setport, adm6996fc_setport), + DEVMETHOD(etherswitch_getvgroup, adm6996fc_getvgroup), + DEVMETHOD(etherswitch_setvgroup, adm6996fc_setvgroup), + DEVMETHOD(etherswitch_setconf, adm6996fc_setconf), + DEVMETHOD(etherswitch_getconf, adm6996fc_getconf), + + DEVMETHOD_END +}; + +DEFINE_CLASS_0(adm6996fc, adm6996fc_driver, adm6996fc_methods, + sizeof(struct adm6996fc_softc)); +static devclass_t adm6996fc_devclass; + +DRIVER_MODULE(adm6996fc, mdio, adm6996fc_driver, adm6996fc_devclass, 0, 0); +DRIVER_MODULE(miibus, adm6996fc, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE(mdio, adm6996fc, mdio_driver, mdio_devclass, 0, 0); +DRIVER_MODULE(etherswitch, adm6996fc, etherswitch_driver, etherswitch_devclass, + 0, 0); +MODULE_VERSION(adm6996fc, 1); +MODULE_DEPEND(adm6996fc, miibus, 1, 1, 1); /* XXX which versions? */ +MODULE_DEPEND(adm6996fc, etherswitch, 1, 1, 1); /* XXX which versions? */ From owner-svn-src-head@freebsd.org Thu Nov 17 08:15:03 2016 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 C6459C4684A; Thu, 17 Nov 2016 08:15:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 928D3760; Thu, 17 Nov 2016 08:15:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAH8F2Jq005938; Thu, 17 Nov 2016 08:15:02 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAH8F2D2005936; Thu, 17 Nov 2016 08:15:02 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201611170815.uAH8F2D2005936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 17 Nov 2016 08:15:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308745 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head 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, 17 Nov 2016 08:15:03 -0000 Author: tuexen Date: Thu Nov 17 08:15:02 2016 New Revision: 308745 URL: https://svnweb.freebsd.org/changeset/base/308745 Log: Notify the use via setting errno when a TCP RST segment is received either in the CLOSING or LAST-ACK state. Reviewed by: hiren MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D8371 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/fastpath.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Nov 17 07:33:37 2016 (r308744) +++ head/sys/netinet/tcp_input.c Thu Nov 17 08:15:02 2016 (r308745) @@ -2202,6 +2202,8 @@ tcp_do_segment(struct mbuf *m, struct tc case TCPS_FIN_WAIT_1: case TCPS_FIN_WAIT_2: case TCPS_CLOSE_WAIT: + case TCPS_CLOSING: + case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: tcp_state_change(tp, TCPS_CLOSED); Modified: head/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- head/sys/netinet/tcp_stacks/fastpath.c Thu Nov 17 07:33:37 2016 (r308744) +++ head/sys/netinet/tcp_stacks/fastpath.c Thu Nov 17 08:15:02 2016 (r308745) @@ -746,6 +746,8 @@ tcp_do_slowpath(struct mbuf *m, struct t case TCPS_FIN_WAIT_1: case TCPS_FIN_WAIT_2: case TCPS_CLOSE_WAIT: + case TCPS_CLOSING: + case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: tcp_state_change(tp, TCPS_CLOSED); From owner-svn-src-head@freebsd.org Thu Nov 17 11:31:14 2016 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 882FFC46332; Thu, 17 Nov 2016 11:31:14 +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 4B96EBA6; Thu, 17 Nov 2016 11:31:14 +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 uAHBVD3a083773; Thu, 17 Nov 2016 11:31:13 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHBVDsX083769; Thu, 17 Nov 2016 11:31:13 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611171131.uAHBVDsX083769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 17 Nov 2016 11:31:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308746 - in head/sys/gnu/dts: include/dt-bindings/dma include/dt-bindings/net mips/ingenic X-SVN-Group: head 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, 17 Nov 2016 11:31:14 -0000 Author: br Date: Thu Nov 17 11:31:13 2016 New Revision: 308746 URL: https://svnweb.freebsd.org/changeset/base/308746 Log: Import Ingenic CI20 (jz4780) DTS files. Submitted by: kan Sponsored by: DARPA, AFRL Added: head/sys/gnu/dts/include/dt-bindings/dma/jz4780-dma.h (contents, props changed) head/sys/gnu/dts/include/dt-bindings/net/rfkill-regulator.h (contents, props changed) head/sys/gnu/dts/mips/ingenic/ head/sys/gnu/dts/mips/ingenic/ci20.dts (contents, props changed) head/sys/gnu/dts/mips/ingenic/jz4780.dtsi (contents, props changed) Added: head/sys/gnu/dts/include/dt-bindings/dma/jz4780-dma.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gnu/dts/include/dt-bindings/dma/jz4780-dma.h Thu Nov 17 11:31:13 2016 (r308746) @@ -0,0 +1,49 @@ +#ifndef __DT_BINDINGS_DMA_JZ4780_DMA_H__ +#define __DT_BINDINGS_DMA_JZ4780_DMA_H__ + +/* + * Request type numbers for the JZ4780 DMA controller (written to the DRTn + * register for the channel). + */ +#define JZ4780_DMA_I2S1_TX 0x4 +#define JZ4780_DMA_I2S1_RX 0x5 +#define JZ4780_DMA_I2S0_TX 0x6 +#define JZ4780_DMA_I2S0_RX 0x7 +#define JZ4780_DMA_AUTO 0x8 +#define JZ4780_DMA_SADC_RX 0x9 +#define JZ4780_DMA_UART4_TX 0xc +#define JZ4780_DMA_UART4_RX 0xd +#define JZ4780_DMA_UART3_TX 0xe +#define JZ4780_DMA_UART3_RX 0xf +#define JZ4780_DMA_UART2_TX 0x10 +#define JZ4780_DMA_UART2_RX 0x11 +#define JZ4780_DMA_UART1_TX 0x12 +#define JZ4780_DMA_UART1_RX 0x13 +#define JZ4780_DMA_UART0_TX 0x14 +#define JZ4780_DMA_UART0_RX 0x15 +#define JZ4780_DMA_SSI0_TX 0x16 +#define JZ4780_DMA_SSI0_RX 0x17 +#define JZ4780_DMA_SSI1_TX 0x18 +#define JZ4780_DMA_SSI1_RX 0x19 +#define JZ4780_DMA_MSC0_TX 0x1a +#define JZ4780_DMA_MSC0_RX 0x1b +#define JZ4780_DMA_MSC1_TX 0x1c +#define JZ4780_DMA_MSC1_RX 0x1d +#define JZ4780_DMA_MSC2_TX 0x1e +#define JZ4780_DMA_MSC2_RX 0x1f +#define JZ4780_DMA_PCM0_TX 0x20 +#define JZ4780_DMA_PCM0_RX 0x21 +#define JZ4780_DMA_SMB0_TX 0x24 +#define JZ4780_DMA_SMB0_RX 0x25 +#define JZ4780_DMA_SMB1_TX 0x26 +#define JZ4780_DMA_SMB1_RX 0x27 +#define JZ4780_DMA_SMB2_TX 0x28 +#define JZ4780_DMA_SMB2_RX 0x29 +#define JZ4780_DMA_SMB3_TX 0x2a +#define JZ4780_DMA_SMB3_RX 0x2b +#define JZ4780_DMA_SMB4_TX 0x2c +#define JZ4780_DMA_SMB4_RX 0x2d +#define JZ4780_DMA_DES_TX 0x2e +#define JZ4780_DMA_DES_RX 0x2f + +#endif /* __DT_BINDINGS_DMA_JZ4780_DMA_H__ */ Added: head/sys/gnu/dts/include/dt-bindings/net/rfkill-regulator.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gnu/dts/include/dt-bindings/net/rfkill-regulator.h Thu Nov 17 11:31:13 2016 (r308746) @@ -0,0 +1,23 @@ +/* + * This header provides macros for rfkill-regulator bindings. + * + * Copyright (C) 2014 Marek Belisko + * + * GPLv2 only + */ + +#ifndef __DT_BINDINGS_RFKILL_REGULATOR_H__ +#define __DT_BINDINGS_RFKILL_REGULATOR_H__ + + +#define RFKILL_TYPE_ALL (0) +#define RFKILL_TYPE_WLAN (1) +#define RFKILL_TYPE_BLUETOOTH (2) +#define RFKILL_TYPE_UWB (3) +#define RFKILL_TYPE_WIMAX (4) +#define RFKILL_TYPE_WWAN (5) +#define RFKILL_TYPE_GPS (6) +#define RFKILL_TYPE_FM (7) +#define RFKILL_TYPE_NFC (8) + +#endif /* __DT_BINDINGS_RFKILL_REGULATOR_H__ */ Added: head/sys/gnu/dts/mips/ingenic/ci20.dts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gnu/dts/mips/ingenic/ci20.dts Thu Nov 17 11:31:13 2016 (r308746) @@ -0,0 +1,395 @@ +/dts-v1/; +#include +#include +#include "jz4780.dtsi" + +/ { + compatible = "imgtec,ci20", "ingenic,jz4780"; + + aliases { + serial0 = &uart0; + serial1 = &uart1; + serial3 = &uart3; + serial4 = &uart4; + }; + + chosen { + stdout-path = &uart4; + }; + + memory { + device_type = "memory"; + reg = <0x0 0x10000000 + 0x30000000 0x30000000>; + }; + + audio: audio-ci20 { + compatible = "ingenic,ci20-audio"; + ingenic,i2s-controller = <&i2s>; + ingenic,codec = <&codec>; + }; + + eth0_power: fixedregulator@0 { + compatible = "regulator-fixed"; + regulator-name = "eth0_power"; + gpio = <&gpb 25 GPIO_ACTIVE_LOW>; + enable-active-high; + }; + + hdmi_power: fixedregulator@1 { + compatible = "regulator-fixed"; + regulator-name = "hdmi_power"; + gpio = <&gpa 25 GPIO_ACTIVE_LOW>; + enable-active-high; + regulator-always-on; + }; + + wifi_power: fixedregulator@2 { + compatible = "regulator-fixed"; + regulator-name = "wifi_power_gpio"; + gpio = <&gpb 19 0>; + enable-active-high; + + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + }; + + /* HACK: Keeping wifi reset high. No simple driver fix */ + wifi_reset: fixedregulator@3 { + compatible = "regulator-fixed"; + regulator-name = "wifi_reset_gpio"; + gpio = <&gpf 7 0>; + enable-active-high; + regulator-always-on; + }; + + /* HACK: Keeping BT reset high. No simple driver fix */ + bt_reset: fixedregulator@4 { + compatible = "regulator-fixed"; + regulator-name = "bt_reset_gpio"; + gpio = <&gpf 8 0>; + enable-active-high; + }; + + /* HACK: Keeping BT_reg_on high. No simple driver fix */ + bt_reg_on: fixedregulator@5 { + compatible = "regulator-fixed"; + regulator-name = "bt_reg_on_gpio"; + gpio = <&gpf 4 0>; + enable-active-high; + regulator-always-on; + }; + + /* HACK: Keeping BT wake high. No simple driver fix */ + bt_wake: fixedregulator@6 { + compatible = "regulator-fixed"; + regulator-name = "bt_wake_gpio"; + gpio = <&gpf 5 0>; + enable-active-high; + regulator-always-on; + }; + + ir: ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpe 3 GPIO_ACTIVE_LOW>; + }; + + bt-rfkill { + compatible = "rfkill-regulator"; + label = "bt-reset"; + type = ; + vrfkill-supply = <&bt_reset>; + }; + + leds { + compatible = "gpio-leds"; + led3 { + gpios = <&gpc 0 0>; + linux,default-trigger = "cpu0"; + }; + led2 { + gpios = <&gpc 1 0>; + linux,default-trigger = "cpu1"; + }; + led1 { + gpios = <&gpc 2 0>; + linux,default-trigger = "nand-disk"; + }; + led0 { + gpios = <&gpc 3 0>; + linux,default-trigger = "none"; + }; + }; +}; + +&ext { + clock-frequency = <48000000>; +}; + +&msc0 { + bus-width = <4>; + max-frequency = <50000000>; + cd-gpios = <&gpf 20 GPIO_ACTIVE_LOW>; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_msc0_pe>; +}; + +&msc1 { + bus-width = <4>; + max-frequency = <24000000>; + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_msc1_pd>; + vmmc-supply = <&wifi_power>; +}; + +&ehci { + ingenic,vbus-gpio = <&gpf 15 0>; +}; + +&ohci { + ingenic,vbus-gpio = <&gpf 15 0>; +}; + +&nemc { + /* + * Only CLE/ALE are needed for the devices that are connected, rather + * than the full address line set. + */ + pinctrl-names = "default"; + pinctrl-0 = <&pins_nemc_data + &pins_nemc_cle_ale + &pins_nemc_rd_we + &pins_nemc_frd_fwe>; + + nand: nand@1 { + compatible = "ingenic,jz4780-nand"; + reg = <1 0 0x1000000>; + + ingenic,nemc-tAS = <10>; + ingenic,nemc-tAH = <5>; + ingenic,nemc-tBP = <10>; + ingenic,nemc-tAW = <15>; + ingenic,nemc-tSTRV = <100>; + + ingenic,bch-device = <&bch>; + ingenic,ecc-size = <1024>; + ingenic,ecc-strength = <24>; + + ingenic,busy-gpio = <&gpa 20 GPIO_ACTIVE_LOW>; + ingenic,wp-gpio = <&gpf 22 GPIO_ACTIVE_LOW>; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_nemc_cs1>; + + #address-cells = <2>; + #size-cells = <2>; + + partition@0 { + label = "u-boot-spl"; + reg = <0x0 0x0 0x0 0x800000>; + }; + + partition@0x800000 { + label = "u-boot"; + reg = <0x0 0x800000 0x0 0x200000>; + }; + + partition@0xa00000 { + label = "u-boot-env"; + reg = <0x0 0xa00000 0x0 0x200000>; + }; + + partition@0xc00000 { + label = "boot"; + reg = <0x0 0xc00000 0x0 0x4000000>; + }; + + partition@0x8c00000 { + label = "system"; + reg = <0x0 0x4c00000 0x1 0xfb400000>; + }; + }; + + dm9000@6 { + compatible = "davicom,dm9000"; + davicom,no-eeprom; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_nemc_cs6>; + + reg = <6 0x0 1 /* addr */ + 6 0x2 1>; /* data */ + + ingenic,nemc-tAS = <15>; + ingenic,nemc-tAH = <10>; + ingenic,nemc-tBP = <20>; + ingenic,nemc-tAW = <50>; + ingenic,nemc-tSTRV = <100>; + + reset-gpios = <&gpf 12 GPIO_ACTIVE_HIGH>; + vcc-supply = <ð0_power>; + + interrupt-parent = <&gpe>; + interrupts = <19 0x4>; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&pins_uart0_data>; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pins_uart1_data>; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&pins_uart2_dataplusflow>; +}; + +&uart3 { + pinctrl-names = "default"; + pinctrl-0 = <&pins_uart3_data>; +}; + +&uart4 { + pinctrl-names = "default"; + pinctrl-0 = <&pins_uart4_data>; +}; + +&i2c0 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pins_i2c0_data>; + + pmic: act8600@5a { + compatible = "active-semi,act8600"; + reg = <0x5a>; + + regulators { + vcore1v_reg: DCDC_REG1 { + regulator-name = "vcore1v2"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1400000>; + regulator-always-on; + }; + + vddmem1v5_reg: DCDC_REG2 { + regulator-name = "vddmem1v5"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + }; + + vccio3v3_reg: DCDC_REG3 { + regulator-name = "vccio3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + vcc2v5_reg: LDO_REG5 { + regulator-name = "vcc2.5"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2500000>; + regulator-always-on; + }; + + vwifi_reg: LDO_REG6 { + regulator-name = "vwifi3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vcim2v8_reg: LDO_REG7 { + regulator-name = "vcim2v8"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + }; + + vcim1v5_reg: LDO_REG8 { + regulator-name = "vcim1v5"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + }; + + /* Do not disable RTC as they connect to reset line */ + vrtc1v8_reg: LDO_REG9 { + regulator-name = "vrtc1v8"; + regulator-always-on; + }; + + vrtc1v1_reg: LDO_REG10 { + regulator-name = "vrtc1v2"; + regulator-always-on; + }; + }; + }; +}; + +&i2c1 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pins_i2c1_data>; +}; + +&i2c2 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pins_i2c2_data>; + + ov5640@0x3C { + compatible = "omnivision,ov5640"; + reg = <0x3C>; + + core-supply = <&vcim1v5_reg>; + analog-supply = <&vcim2v8_reg>; + + gpio-enable = <&gpb 18 0>; + gpio-reset = <&gpb 26 0>; + + remote = <&cim>; + port { + ov5640_1: endpoint { + bus-width = <8>; + remote-endpoint = <&cim>; + }; + }; + }; +}; + +&i2c3 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pins_i2c3_data>; +}; + +&i2c4 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pins_i2c4_data_pf>; +}; + +&cim { + clock-frequency = <24000000>; + + port { + #address-cells = <1>; + #size-cells = <0>; + + /* Parallel bus endpoint */ + camera: endpoint@0 { + reg = <0>; /* Local endpoint # */ + remote-endpoint = <&ov5640_1>; + hsync-active = <1>; /* Active high */ + vsync-active = <1>; /* Active high */ + pclk-sample = <0>; /* Falling */ + }; + }; +}; Added: head/sys/gnu/dts/mips/ingenic/jz4780.dtsi ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gnu/dts/mips/ingenic/jz4780.dtsi Thu Nov 17 11:31:13 2016 (r308746) @@ -0,0 +1,768 @@ +#include +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ingenic,jz4780"; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + compatible = "ingenic,xburst"; + reg = <0>; + }; + cpu1: cpu@1 { + compatible = "ingenic,xburst"; + reg = <1>; + clocks = <&cgu JZ4780_CLK_CORE1>; + }; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + intc: intc@10001000 { + compatible = "ingenic,jz4780-intc"; + reg = <0x10001000 0x50>; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + }; + + ext: ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + }; + + rtc: rtc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + + cgu: jz4780-cgu@10000000 { + compatible = "ingenic,jz4780-cgu"; + reg = <0x10000000 0x100>; + + clocks = <&ext>, <&rtc>; + clock-names = "ext", "rtc"; + + #clock-cells = <1>; + }; + + gpu: jz4780-sgx@13040000 { + compatible = "ingenic,jz4780-sgx"; + reg = <0x13040000 0x4000>; + + clocks = <&cgu JZ4780_CLK_GPU>; + clock-names = "gpu"; + + interrupt-parent = <&intc>; + interrupts = <63>; + }; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <>; + + tcu@0x10002000 { + compatible = "ingenic,jz4780-tcu"; + reg = <0x10002000 0x140>; + + interrupt-parent = <&intc>; + interrupts = <27 26 25>; + }; + + watchdog: jz47xx-watchdog@0x10002000 { + compatible = "ingenic,jz4780-watchdog"; + reg = <0x10002000 0x100>; + + clocks = <&rtc>; + clock-names = "rtc"; + }; + + rtcdev: rtcdev@10003000 { + compatible = "ingenic,jz4780-rtc"; + reg = <0x10003000 0x4c>; + interrupt-parent = <&intc>; + interrupts = <32>; + }; + + i2s: i2s@10020000 { + compatible = "ingenic,jz4780-i2s"; + reg = <0x10020000 0x94>; + + clocks = <&cgu JZ4780_CLK_AIC>, <&cgu JZ4780_CLK_I2SPLL>; + clock-names = "aic", "i2s"; + + dmas = <&dma 0 JZ4780_DMA_I2S0_RX 0xffffffff>, <&dma JZ4780_DMA_I2S0_TX 0 0xffffffff>; + dma-names = "rx" , "tx"; + + }; + + codec: codec@100200a4 { + compatible = "ingenic,jz4780-codec"; + reg = <0x100200a4 0x8>; + + clocks = <&cgu JZ4780_CLK_I2SPLL>; + clock-names = "i2s"; + + }; + + pinctrl@0x10010000 { + compatible = "ingenic,jz4780-pinctrl"; + reg = <0x10010000 0x600>; + + gpa: gpa { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <17>; + + ingenic,pull-ups = <0x3fffffff>; + }; + + gpb: gpb { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <16>; + + ingenic,pull-downs = <0x000f0c03>; + ingenic,pull-ups = <0xfff0030c>; + }; + + gpc: gpc { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <15>; + + ingenic,pull-ups = <0xffffffff>; + }; + + gpd: gpd { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <14>; + + ingenic,pull-downs = <0x0000b000>; + ingenic,pull-ups = <0xffff4fff>; + }; + + gpe: gpe { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <13>; + + ingenic,pull-downs = <0x00000483>; + ingenic,pull-ups = <0xfffffb7c>; + }; + + gpf: gpf { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <12>; + + ingenic,pull-downs = <0x00580ff0>; + ingenic,pull-ups = <0xffa7f00f>; + }; + + pincfg_nobias: nobias { + bias-disable; + }; + + pincfg_pull_up: pull_up { + bias-pull-up; + }; + + pincfg_pull_down: pull_down { + bias-pull-down; + }; + + pinfunc_uart0: uart0 { + pins_uart0_data: uart0-data { + ingenic,pins = <&gpf 0 0 &pincfg_pull_up /* rxd */ + &gpf 3 0 &pincfg_nobias>; /* txd */ + }; + + pins_uart0_dataplusflow: uart0-dataplusflow { + ingenic,pins = <&gpf 0 0 &pincfg_pull_up /* rxd */ + &gpf 1 0 &pincfg_nobias /* cts */ + &gpf 2 0 &pincfg_nobias /* rts */ + &gpf 3 0 &pincfg_nobias>; /* txd */ + }; + }; + + pinfunc_uart1: uart1 { + pins_uart1_data: uart1-data { + ingenic,pins = <&gpd 26 0 &pincfg_pull_up /* rxd */ + &gpd 28 0 &pincfg_nobias>; /* txd */ + }; + + pins_uart1_dataplusflow: uart1-dataplusflow { + ingenic,pins = <&gpd 26 0 &pincfg_pull_up /* rxd */ + &gpd 27 0 &pincfg_nobias /* cts */ + &gpd 29 0 &pincfg_nobias /* rts */ + &gpd 28 0 &pincfg_nobias>; /* txd */ + }; + }; + + pinfunc_uart2: uart2 { + pins_uart2_data: uart2-data { + ingenic,pins = <&gpd 6 1 &pincfg_nobias /* rxd */ + &gpd 7 1 &pincfg_nobias>; /* txd */ + }; + + pins_uart2_dataplusflow: uart2-dataplusflow { + ingenic,pins = <&gpd 6 1 &pincfg_nobias /* rxd */ + &gpd 5 1 &pincfg_nobias /* cts */ + &gpd 4 1 &pincfg_nobias /* rts */ + &gpd 7 1 &pincfg_nobias>; /* txd */ + }; + }; + + pinfunc_uart3: uart3 { + pins_uart3_data: uart3-data { + ingenic,pins = <&gpd 12 0 &pincfg_pull_down /* rxd */ + &gpe 5 1 &pincfg_nobias>; /* txd */ + }; + + pins_uart3_dataplusflow: uart3-dataplusflow { + ingenic,pins = <&gpd 12 0 &pincfg_pull_down /* rxd */ + &gpe 5 1 &pincfg_nobias /* txd */ + &gpe 8 0 &pincfg_nobias /* cts */ + &gpe 9 0 &pincfg_nobias>; /* rts */ + }; + }; + + pinfunc_uart4: uart4 { + pins_uart4_data: uart4-data { + ingenic,pins = <&gpc 20 2 &pincfg_pull_up /* rxd */ + &gpc 10 2 &pincfg_nobias>; /* txd */ + }; + }; + + pinfunc_msc0: msc0 { + pins_msc0_pa: msc0-pa { + ingenic,pins = <&gpa 4 1 &pincfg_nobias /* d4 */ + &gpa 5 1 &pincfg_nobias /* d5 */ + &gpa 6 1 &pincfg_nobias /* d6 */ + &gpa 7 1 &pincfg_nobias /* d7 */ + &gpa 18 1 &pincfg_nobias /* clk */ + &gpa 19 1 &pincfg_nobias /* cmd */ + &gpa 20 1 &pincfg_nobias /* d0 */ + &gpa 21 1 &pincfg_nobias /* d1 */ + &gpa 22 1 &pincfg_nobias /* d2 */ + &gpa 23 1 &pincfg_nobias /* d3 */ + &gpa 24 1 &pincfg_nobias>; /* rst */ + }; + + pins_msc0_pe: msc0-pe { + ingenic,pins = <&gpe 20 0 &pincfg_nobias /* d0 */ + &gpe 21 0 &pincfg_nobias /* d1 */ + &gpe 22 0 &pincfg_nobias /* d2 */ + &gpe 23 0 &pincfg_nobias /* d3 */ + &gpe 28 0 &pincfg_nobias /* clk */ + &gpe 29 0 &pincfg_nobias>; /* cmd */ + }; + }; + + pinfunc_msc1: msc1 { + pins_msc1_pd: msc1-pd { + ingenic,pins = <&gpd 20 0 &pincfg_nobias /* d0 */ + &gpd 21 0 &pincfg_nobias /* d1 */ + &gpd 22 0 &pincfg_nobias /* d2 */ + &gpd 23 0 &pincfg_nobias /* d3 */ + &gpd 24 0 &pincfg_nobias /* clk */ + &gpd 25 0 &pincfg_nobias>; /* cmd */ + }; + + pins_msc1_pe: msc1-pe { + ingenic,pins = <&gpe 20 1 &pincfg_nobias /* d0 */ + &gpe 21 1 &pincfg_nobias /* d1 */ + &gpe 22 1 &pincfg_nobias /* d2 */ + &gpe 23 1 &pincfg_nobias /* d3 */ + &gpe 28 1 &pincfg_nobias /* clk */ + &gpe 29 1 &pincfg_nobias>; /* cmd */ + }; + }; + + pinfunc_nemc: nemc { + pins_nemc_data: nemc-data { + ingenic,pins = <&gpa 0 0 &pincfg_nobias /* sd0 */ + &gpa 1 0 &pincfg_nobias /* sd1 */ + &gpa 2 0 &pincfg_nobias /* sd2 */ + &gpa 3 0 &pincfg_nobias /* sd3 */ + &gpa 4 0 &pincfg_nobias /* sd4 */ + &gpa 5 0 &pincfg_nobias /* sd5 */ + &gpa 6 0 &pincfg_nobias /* sd6 */ + &gpa 7 0 &pincfg_nobias>; /* sd7 */ + }; + + pins_nemc_cle_ale: nemc-cle-ale { + ingenic,pins = <&gpb 0 0 &pincfg_nobias /* sa0_cl */ + &gpb 1 0 &pincfg_nobias>; /* sa1_al */ + }; + + pins_nemc_addr: nemc-addr { + ingenic,pins = <&gpb 0 0 &pincfg_nobias /* sa0_cl */ + &gpb 1 0 &pincfg_nobias /* sa1_al */ + &gpb 2 0 &pincfg_nobias /* sa2 */ + &gpb 3 0 &pincfg_nobias /* sa3 */ + &gpb 4 0 &pincfg_nobias /* sa4 */ + &gpb 5 0 &pincfg_nobias>; /* sa5 */ + }; + + pins_nemc_rd_we: nemc-rd-we { + ingenic,pins = <&gpa 16 0 &pincfg_nobias /* rd */ + &gpa 17 0 &pincfg_nobias>; /* we */ + }; + + pins_nemc_frd_fwe: nemc-frd-fwe { + ingenic,pins = <&gpa 18 0 &pincfg_nobias /* rd */ + &gpa 19 0 &pincfg_nobias>; /* we */ + }; + + pins_nemc_cs1: nemc-cs1 { + ingenic,pins = <&gpa 21 0 &pincfg_nobias>; /* cs1 */ + }; + + pins_nemc_cs6: nemc-cs6 { + ingenic,pins = <&gpa 26 0 &pincfg_nobias>; /* cs6 */ + }; + }; + + pinfunc_i2c0: i2c0 { + pins_i2c0_data: i2c0-data{ + ingenic,pins = <&gpd 30 0 &pincfg_nobias /* sda */ + &gpd 31 0 &pincfg_nobias>; /* sck */ + }; + }; + + pinfunc_i2c1: i2c1 { + pins_i2c1_data: i2c1-data{ + ingenic,pins = <&gpe 30 0 &pincfg_nobias /* sda */ + &gpe 31 0 &pincfg_nobias>; /* sck */ + }; + }; + + pinfunc_i2c2: i2c2 { + pins_i2c2_data: i2c2-data{ + ingenic,pins = <&gpf 16 2 &pincfg_nobias /* sda */ + &gpf 17 2 &pincfg_nobias>; /* sck */ + }; + }; + + pinfunc_i2c3: i2c3 { + pins_i2c3_data: i2c3-data{ + ingenic,pins = <&gpd 10 1 &pincfg_nobias /* sda */ + &gpd 11 1 &pincfg_nobias>; /* sck */ + }; + }; + + pinfunc_i2c4: i2c4 { + pins_i2c4_data: i2c4-data-pe{ + ingenic,pins = <&gpe 12 1 &pincfg_nobias /* sda */ + &gpe 13 1 &pincfg_nobias>; /* sck */ + }; + + pins_i2c4_data_pf: i2c4-data-pf{ + ingenic,pins = <&gpf 25 1 &pincfg_nobias /* hdmi_sda */ + &gpf 24 1 &pincfg_nobias>; /* hdmi_sck */ + }; + }; + + pinfunc_cim: cim { + pins_cim: cim-pb { + ingenic,pins = <&gpb 6 0 &pincfg_nobias + &gpb 7 0 &pincfg_nobias + &gpb 8 0 &pincfg_nobias + &gpb 9 0 &pincfg_nobias + &gpb 10 0 &pincfg_nobias + &gpb 11 0 &pincfg_nobias + &gpb 12 0 &pincfg_nobias + &gpb 13 0 &pincfg_nobias + &gpb 14 0 &pincfg_nobias + &gpb 15 0 &pincfg_nobias + &gpb 16 0 &pincfg_nobias + &gpb 17 0 &pincfg_nobias>; + }; + }; + }; + + spi_gpio { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + num-chipselects = <2>; + + gpio-miso = <&gpe 14 0>; + gpio-sck = <&gpe 15 0>; + gpio-mosi = <&gpe 17 0>; + cs-gpios = <&gpe 16 0 + &gpe 18 0>; + + spidev@0 { + compatible = "spidev"; + reg = <0>; + spi-max-frequency = <1000000>; + }; + }; + + uart0: serial@10030000 { + compatible = "ingenic,jz4780-uart"; + reg = <0x10030000 0x100>; + reg-shift = <2>; + + interrupt-parent = <&intc>; + interrupts = <51>; + + clocks = <&ext>, <&cgu JZ4780_CLK_UART0>; + clock-names = "baud", "module"; + }; + + uart1: serial@10031000 { + compatible = "ingenic,jz4780-uart"; + reg = <0x10031000 0x100>; + reg-shift = <2>; + + interrupt-parent = <&intc>; + interrupts = <50>; + + clocks = <&ext>, <&cgu JZ4780_CLK_UART1>; + clock-names = "baud", "module"; + }; + + uart2: serial@10032000 { + compatible = "ingenic,jz4780-uart"; + reg = <0x10032000 0x100>; + reg-shift = <2>; + + interrupt-parent = <&intc>; + interrupts = <49>; + + clocks = <&ext>, <&cgu JZ4780_CLK_UART2>; + clock-names = "baud", "module"; + }; + + uart3: serial@10033000 { + compatible = "ingenic,jz4780-uart"; + reg = <0x10033000 0x100>; + reg-shift = <2>; + + interrupt-parent = <&intc>; + interrupts = <48>; + + clocks = <&ext>, <&cgu JZ4780_CLK_UART3>; + clock-names = "baud", "module"; + }; + + uart4: serial@10034000 { + compatible = "ingenic,jz4780-uart"; + reg = <0x10034000 0x100>; + reg-shift = <2>; + + interrupt-parent = <&intc>; + interrupts = <34>; + + clocks = <&ext>, <&cgu JZ4780_CLK_UART4>; + clock-names = "baud", "module"; + }; + + i2c0: i2c0@0x10050000 { + compatible = "ingenic,jz4780-i2c"; + reg = <0x10050000 0x1000>; + + interrupt-parent = <&intc>; + interrupts = <60>; + + clocks = <&cgu JZ4780_CLK_SMB0>; + + #address-cells = <1>; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Nov 17 11:48:08 2016 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 73A11C46846; Thu, 17 Nov 2016 11:48:08 +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 45197158F; Thu, 17 Nov 2016 11:48:08 +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 uAHBm7O5089035; Thu, 17 Nov 2016 11:48:07 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHBm7I8089031; Thu, 17 Nov 2016 11:48:07 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611171148.uAHBm7I8089031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 17 Nov 2016 11:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308747 - in head/sys: conf dev/dme X-SVN-Group: head 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, 17 Nov 2016 11:48:08 -0000 Author: br Date: Thu Nov 17 11:48:07 2016 New Revision: 308747 URL: https://svnweb.freebsd.org/changeset/base/308747 Log: Add driver for DM9000 Ethernet MAC Controller. This device found in the Ingenic jz4780 SoC. Submitted by: kan Sponsored by: DARPA, AFRL Added: head/sys/dev/dme/ head/sys/dev/dme/if_dme.c (contents, props changed) head/sys/dev/dme/if_dmereg.h (contents, props changed) head/sys/dev/dme/if_dmevar.h (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Nov 17 11:31:13 2016 (r308746) +++ head/sys/conf/files Thu Nov 17 11:48:07 2016 (r308747) @@ -1402,6 +1402,7 @@ dev/dcons/dcons.c optional dcons dev/dcons/dcons_crom.c optional dcons_crom dev/dcons/dcons_os.c optional dcons dev/de/if_de.c optional de pci +dev/dme/if_dme.c optional dme dev/dpt/dpt_eisa.c optional dpt eisa dev/dpt/dpt_pci.c optional dpt pci dev/dpt/dpt_scsi.c optional dpt Added: head/sys/dev/dme/if_dme.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/dme/if_dme.c Thu Nov 17 11:48:07 2016 (r308747) @@ -0,0 +1,1070 @@ +/* + * Copyright (C) 2015 Alexander Kabaev + * Copyright (C) 2010 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * A driver for the DM9000 MAC + * + * TODO: + * Get the interrupt working + * Port to non-S3C2440 systems + * Test with 8 and 32 bit busses + * Test on a big endian machine + * Implement the rest of dme_detach + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include "miibus_if.h" + +struct dme_softc { + struct ifnet *dme_ifp; + device_t dme_dev; + device_t dme_miibus; + bus_space_handle_t dme_handle; + bus_space_tag_t dme_tag; + int dme_rev; + int dme_bits; + struct resource *dme_res; + struct resource *dme_irq; + void *dme_intrhand; + struct mtx dme_mtx; + struct callout dme_tick_ch; + struct gpiobus_pin *gpio_rset; + uint32_t dme_ticks; + uint8_t dme_macaddr[ETHER_ADDR_LEN]; + regulator_t dme_vcc_regulator; + uint8_t dme_txbusy: 1; + uint8_t dme_txready: 1; + uint16_t dme_txlen; +}; + +#define DME_CHIP_DM9000 0x00 +#define DME_CHIP_DM9000A 0x19 +#define DME_CHIP_DM9000B 0x1a + +#define DME_INT_PHY 1 + +static int dme_probe(device_t); +static int dme_attach(device_t); +static int dme_detach(device_t); + +static void dme_intr(void *arg); +static void dme_init_locked(struct dme_softc *); + +static void dme_prepare(struct dme_softc *); +static void dme_transmit(struct dme_softc *); + +static int dme_miibus_writereg(device_t dev, int phy, int reg, int data); +static int dme_miibus_readreg(device_t dev, int phy, int reg); + +/* The bit on the address bus attached to the CMD pin */ +#define BASE_ADDR 0x000 +#define CMD_ADDR BASE_ADDR +#define DATA_BIT 1 +#define DATA_ADDR 0x002 + +#undef DME_TRACE + +#ifdef DME_TRACE +#define DTR3 TR3 +#define DTR4 TR4 +#else +#define NOTR(args...) (void)0 +#define DTR3 NOTR +#define DTR4 NOTR +#endif + +static uint8_t +dme_read_reg(struct dme_softc *sc, uint8_t reg) +{ + + /* Send the register to read from */ + bus_space_write_1(sc->dme_tag, sc->dme_handle, CMD_ADDR, reg); + bus_space_barrier(sc->dme_tag, sc->dme_handle, CMD_ADDR, 1, + BUS_SPACE_BARRIER_WRITE); + + /* Get the value of the register */ + return bus_space_read_1(sc->dme_tag, sc->dme_handle, DATA_ADDR); +} + +static void +dme_write_reg(struct dme_softc *sc, uint8_t reg, uint8_t value) +{ + + /* Send the register to write to */ + bus_space_write_1(sc->dme_tag, sc->dme_handle, CMD_ADDR, reg); + bus_space_barrier(sc->dme_tag, sc->dme_handle, CMD_ADDR, 1, + BUS_SPACE_BARRIER_WRITE); + + /* Write the value to the register */ + bus_space_write_1(sc->dme_tag, sc->dme_handle, DATA_ADDR, value); + bus_space_barrier(sc->dme_tag, sc->dme_handle, DATA_ADDR, 1, + BUS_SPACE_BARRIER_WRITE); +} + +static void +dme_reset(struct dme_softc *sc) +{ + u_int ncr; + + /* Send a soft reset #1 */ + dme_write_reg(sc, DME_NCR, NCR_RST | NCR_LBK_MAC); + DELAY(100); /* Wait for the MAC to reset */ + ncr = dme_read_reg(sc, DME_NCR); + if (ncr & NCR_RST) + device_printf(sc->dme_dev, "device did not complete first reset\n"); + + /* Send a soft reset #2 per Application Notes v1.22 */ + dme_write_reg(sc, DME_NCR, 0); + dme_write_reg(sc, DME_NCR, NCR_RST | NCR_LBK_MAC); + DELAY(100); /* Wait for the MAC to reset */ + ncr = dme_read_reg(sc, DME_NCR); + if (ncr & NCR_RST) + device_printf(sc->dme_dev, "device did not complete second reset\n"); + + /* Reset trasmit state */ + sc->dme_txbusy = 0; + sc->dme_txready = 0; + + DTR3("dme_reset, flags %#x busy %d ready %d", + sc->dme_ifp ? sc->dme_ifp->if_drv_flags : 0, + sc->dme_txbusy, sc->dme_txready); +} + +/* + * Parse string MAC address into usable form + */ +static int +dme_parse_macaddr(const char *str, uint8_t *mac) +{ + int count, i; + unsigned int amac[ETHER_ADDR_LEN]; /* Aligned version */ + + count = sscanf(str, "%x%*c%x%*c%x%*c%x%*c%x%*c%x", + &amac[0], &amac[1], &amac[2], + &amac[3], &amac[4], &amac[5]); + if (count < ETHER_ADDR_LEN) { + memset(mac, 0, ETHER_ADDR_LEN); + return (1); + } + + /* Copy aligned to result */ + for (i = 0; i < ETHER_ADDR_LEN; i ++) + mac[i] = (amac[i] & 0xff); + + return (0); +} + +/* + * Try to determine our own MAC address + */ +static void +dme_get_macaddr(struct dme_softc *sc) +{ + char devid_str[32]; + char *var; + int i; + + /* Cannot use resource_string_value with static hints mode */ + snprintf(devid_str, 32, "hint.%s.%d.macaddr", + device_get_name(sc->dme_dev), + device_get_unit(sc->dme_dev)); + + /* Try resource hints */ + if ((var = kern_getenv(devid_str)) != NULL) { + if (!dme_parse_macaddr(var, sc->dme_macaddr)) { + device_printf(sc->dme_dev, "MAC address: %s (hints)\n", var); + return; + } + } + + /* + * Try to read MAC address from the device, in case U-Boot has + * pre-programmed one for us. + */ + for (i = 0; i < ETHER_ADDR_LEN; i++) + sc->dme_macaddr[i] = dme_read_reg(sc, DME_PAR(i)); + + device_printf(sc->dme_dev, "MAC address %6D (existing)\n", + sc->dme_macaddr, ":"); +} + +static void +dme_config(struct dme_softc *sc) +{ + int i; + + /* Mask all interrupts and reset receive pointer */ + dme_write_reg(sc, DME_IMR, IMR_PAR); + + /* Disable GPIO0 to enable the internal PHY */ + dme_write_reg(sc, DME_GPCR, 1); + dme_write_reg(sc, DME_GPR, 0); + +#if 0 + /* + * Supposedly requires special initialization for DSP PHYs + * used by DM9000B. Maybe belongs in dedicated PHY driver? + */ + if (sc->dme_rev == DME_CHIP_DM9000B) { + dme_miibus_writereg(sc->dme_dev, DME_INT_PHY, MII_BMCR, + BMCR_RESET); + dme_miibus_writereg(sc->dme_dev, DME_INT_PHY, MII_DME_DSPCR, + DSPCR_INIT); + /* Wait 100ms for it to complete. */ + for (i = 0; i < 100; i++) { + int reg; + + reg = dme_miibus_readreg(sc->dme_dev, DME_INT_PHY, MII_BMCR); + if ((reg & BMCR_RESET) == 0) + break; + DELAY(1000); + } + } +#endif + + /* Select the internal PHY and normal loopback */ + dme_write_reg(sc, DME_NCR, NCR_LBK_NORMAL); + /* Clear any TX requests */ + dme_write_reg(sc, DME_TCR, 0); + /* Setup backpressure thresholds to 4k and 600us */ + dme_write_reg(sc, DME_BPTR, BPTR_BPHW(3) | BPTR_JPT(0x0f)); + /* Setup flow control */ + dme_write_reg(sc, DME_FCTR, FCTR_HWOT(0x3) | FCTR_LWOT(0x08)); + /* Enable flow control */ + dme_write_reg(sc, DME_FCR, 0xff); + /* Clear special modes */ + dme_write_reg(sc, DME_SMCR, 0); + /* Clear TX status */ + dme_write_reg(sc, DME_NSR, NSR_WAKEST | NSR_TX2END | NSR_TX1END); + /* Clear interrrupts */ + dme_write_reg(sc, DME_ISR, 0xff); + /* Set multicast address filter */ + for (i = 0; i < 8; i++) + dme_write_reg(sc, DME_MAR(i), 0xff); + /* Set the MAC address */ + for (i = 0; i < ETHER_ADDR_LEN; i++) + dme_write_reg(sc, DME_PAR(i), sc->dme_macaddr[i]); + /* Enable the RX buffer */ + dme_write_reg(sc, DME_RCR, RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN); + + /* Enable interrupts we care about */ + dme_write_reg(sc, DME_IMR, IMR_PAR | IMR_PRI | IMR_PTI); +} + +void +dme_prepare(struct dme_softc *sc) +{ + struct ifnet *ifp; + struct mbuf *m, *mp; + uint16_t total_len, len; + + DME_ASSERT_LOCKED(sc); + + KASSERT(sc->dme_txready == 0, + ("dme_prepare: called with txready set\n")); + + ifp = sc->dme_ifp; + IFQ_DEQUEUE(&ifp->if_snd, m); + if (m == NULL) { + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + DTR3("dme_prepare none, flags %#x busy %d ready %d", + sc->dme_ifp->if_drv_flags, sc->dme_txbusy, sc->dme_txready); + return; /* Nothing to transmit */ + } + + /* Element has now been removed from the queue, so we better send it */ + BPF_MTAP(ifp, m); + + /* Setup the controller to accept the writes */ + bus_space_write_1(sc->dme_tag, sc->dme_handle, CMD_ADDR, DME_MWCMD); + + /* + * TODO: Fix the case where an mbuf is + * not a multiple of the write size. + */ + total_len = 0; + for (mp = m; mp != NULL; mp = mp->m_next) { + len = mp->m_len; + + /* Ignore empty parts */ + if (len == 0) + continue; + + total_len += len; + +#if 0 + bus_space_write_multi_2(sc->dme_tag, sc->dme_handle, + DATA_ADDR, mtod(mp, uint16_t *), (len + 1) / 2); +#else + bus_space_write_multi_1(sc->dme_tag, sc->dme_handle, + DATA_ADDR, mtod(mp, uint8_t *), len); +#endif + } + + if (total_len % (sc->dme_bits >> 3) != 0) + panic("dme_prepare: length is not compatible with IO_MODE"); + + sc->dme_txlen = total_len; + sc->dme_txready = 1; + DTR3("dme_prepare done, flags %#x busy %d ready %d", + sc->dme_ifp->if_drv_flags, sc->dme_txbusy, sc->dme_txready); + + m_freem(m); +} + +void +dme_transmit(struct dme_softc *sc) +{ + + DME_ASSERT_LOCKED(sc); + KASSERT(sc->dme_txready, ("transmit without txready")); + + dme_write_reg(sc, DME_TXPLL, sc->dme_txlen & 0xff); + dme_write_reg(sc, DME_TXPLH, (sc->dme_txlen >> 8) & 0xff ); + + /* Request to send the packet */ + dme_read_reg(sc, DME_ISR); + + dme_write_reg(sc, DME_TCR, TCR_TXREQ); + + sc->dme_txready = 0; + sc->dme_txbusy = 1; + DTR3("dme_transmit done, flags %#x busy %d ready %d", + sc->dme_ifp->if_drv_flags, sc->dme_txbusy, sc->dme_txready); +} + + +static void +dme_start_locked(struct ifnet *ifp) +{ + struct dme_softc *sc; + + sc = ifp->if_softc; + DME_ASSERT_LOCKED(sc); + + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) + return; + + DTR3("dme_start, flags %#x busy %d ready %d", + sc->dme_ifp->if_drv_flags, sc->dme_txbusy, sc->dme_txready); + KASSERT(sc->dme_txbusy == 0 || sc->dme_txready == 0, + ("dme: send without empty queue\n")); + + dme_prepare(sc); + + if (sc->dme_txbusy == 0) { + /* We are ready to transmit right away */ + dme_transmit(sc); + dme_prepare(sc); /* Prepare next one */ + } + /* + * We need to wait until the current packet has + * been transmitted. + */ + if (sc->dme_txready != 0) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; +} + +static void +dme_start(struct ifnet *ifp) +{ + struct dme_softc *sc; + + sc = ifp->if_softc; + DME_LOCK(sc); + dme_start_locked(ifp); + DME_UNLOCK(sc); +} + +static void +dme_stop(struct dme_softc *sc) +{ + struct ifnet *ifp; + + DME_ASSERT_LOCKED(sc); + /* Disable receiver */ + dme_write_reg(sc, DME_RCR, 0x00); + /* Mask interrupts */ + dme_write_reg(sc, DME_IMR, 0x00); + /* Stop poll */ + callout_stop(&sc->dme_tick_ch); + + ifp = sc->dme_ifp; + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + + DTR3("dme_stop, flags %#x busy %d ready %d", + sc->dme_ifp->if_drv_flags, sc->dme_txbusy, sc->dme_txready); + sc->dme_txbusy = 0; + sc->dme_txready = 0; +} + +static int +dme_rxeof(struct dme_softc *sc) +{ + struct ifnet *ifp; + struct mbuf *m; + int len, i; + + DME_ASSERT_LOCKED(sc); + + ifp = sc->dme_ifp; + + /* Read the first byte to check it correct */ + (void)dme_read_reg(sc, DME_MRCMDX); + i = bus_space_read_1(sc->dme_tag, sc->dme_handle, DATA_ADDR); + switch(bus_space_read_1(sc->dme_tag, sc->dme_handle, DATA_ADDR)) { + case 1: + /* Correct value */ + break; + case 0: + return 1; + default: + /* Error */ + return -1; + } + + i = dme_read_reg(sc, DME_MRRL); + i |= dme_read_reg(sc, DME_MRRH) << 8; + + len = dme_read_reg(sc, DME_ROCR); + + bus_space_write_1(sc->dme_tag, sc->dme_handle, CMD_ADDR, DME_MRCMD); + len = 0; + switch(sc->dme_bits) { + case 8: + i = bus_space_read_1(sc->dme_tag, sc->dme_handle, DATA_ADDR); + i <<= 8; + i |= bus_space_read_1(sc->dme_tag, sc->dme_handle, DATA_ADDR); + + len = bus_space_read_1(sc->dme_tag, sc->dme_handle, DATA_ADDR); + len |= bus_space_read_1(sc->dme_tag, sc->dme_handle, + DATA_ADDR) << 8; + break; + case 16: + bus_space_read_2(sc->dme_tag, sc->dme_handle, DATA_ADDR); + len = bus_space_read_2(sc->dme_tag, sc->dme_handle, DATA_ADDR); + break; + case 32: + { + uint32_t reg; + + reg = bus_space_read_4(sc->dme_tag, sc->dme_handle, DATA_ADDR); + len = reg & 0xFFFF; + break; + } + } + + MGETHDR(m, M_NOWAIT, MT_DATA); + if (m == NULL) + return -1; + + if (len > MHLEN - ETHER_ALIGN) { + MCLGET(m, M_NOWAIT); + if (!(m->m_flags & M_EXT)) { + m_freem(m); + return -1; + } + } + + m->m_pkthdr.rcvif = ifp; + m->m_len = m->m_pkthdr.len = len; + m_adj(m, ETHER_ALIGN); + + /* Read the data */ +#if 0 + bus_space_read_multi_2(sc->dme_tag, sc->dme_handle, DATA_ADDR, + mtod(m, uint16_t *), (len + 1) / 2); +#else + bus_space_read_multi_1(sc->dme_tag, sc->dme_handle, DATA_ADDR, + mtod(m, uint8_t *), len); +#endif + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); + DME_UNLOCK(sc); + (*ifp->if_input)(ifp, m); + DME_LOCK(sc); + + return 0; +} + +static void +dme_tick(void *arg) +{ + struct dme_softc *sc; + struct mii_data *mii; + + sc = (struct dme_softc *)arg; + + /* Probably too frequent? */ + mii = device_get_softc(sc->dme_miibus); + mii_tick(mii); + + callout_reset(&sc->dme_tick_ch, hz, dme_tick, sc); +} + +static void +dme_intr(void *arg) +{ + struct dme_softc *sc; + uint32_t intr_status; + + sc = (struct dme_softc *)arg; + + DME_LOCK(sc); + + intr_status = dme_read_reg(sc, DME_ISR); + dme_write_reg(sc, DME_ISR, intr_status); + + DTR4("dme_intr flags %#x busy %d ready %d intr %#x", + sc->dme_ifp->if_drv_flags, sc->dme_txbusy, + sc->dme_txready, intr_status); + + if (intr_status & ISR_PT) { + uint8_t nsr, tx_status; + + sc->dme_txbusy = 0; + + nsr = dme_read_reg(sc, DME_NSR); + + if (nsr & NSR_TX1END) + tx_status = dme_read_reg(sc, DME_TSR1); + else if (nsr & NSR_TX2END) + tx_status = dme_read_reg(sc, DME_TSR2); + else + tx_status = 1; + + DTR4("dme_intr flags %#x busy %d ready %d nsr %#x", + sc->dme_ifp->if_drv_flags, sc->dme_txbusy, + sc->dme_txready, nsr); + + /* Prepare packet to send if none is currently pending */ + if (sc->dme_txready == 0) + dme_prepare(sc); + /* Send the packet out of one is waiting for transmit */ + if (sc->dme_txready != 0) { + /* Initiate transmission of the prepared packet */ + dme_transmit(sc); + /* Prepare next packet to send */ + dme_prepare(sc); + /* + * We need to wait until the current packet has + * been transmitted. + */ + if (sc->dme_txready != 0) + sc->dme_ifp->if_drv_flags |= IFF_DRV_OACTIVE; + } + } + + if (intr_status & ISR_PR) { + /* Read the packets off the device */ + while (dme_rxeof(sc) == 0) + continue; + } + DME_UNLOCK(sc); +} + +static void +dme_setmode(struct dme_softc *sc) +{ +} + +static int +dme_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct dme_softc *sc; + struct mii_data *mii; + struct ifreq *ifr; + int error = 0; + + sc = ifp->if_softc; + ifr = (struct ifreq *)data; + + switch (command) { + case SIOCSIFFLAGS: + /* + * Switch interface state between "running" and + * "stopped", reflecting the UP flag. + */ + DME_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + dme_init_locked(sc); + } + } else { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { + dme_stop(sc); + } + } + dme_setmode(sc); + DME_UNLOCK(sc); + break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + mii = device_get_softc(sc->dme_miibus); + error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); + break; + default: + error = ether_ioctl(ifp, command, data); + break; + } + return (error); +} + +static void dme_init_locked(struct dme_softc *sc) +{ + struct ifnet *ifp = sc->dme_ifp; + + DME_ASSERT_LOCKED(sc); + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + + dme_reset(sc); + dme_config(sc); + + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + + callout_reset(&sc->dme_tick_ch, hz, dme_tick, sc); +} + +static void +dme_init(void *xcs) +{ + struct dme_softc *sc = xcs; + + DME_LOCK(sc); + dme_init_locked(sc); + DME_UNLOCK(sc); +} + +static int +dme_ifmedia_upd(struct ifnet *ifp) +{ + struct dme_softc *sc; + struct mii_data *mii; + + sc = ifp->if_softc; + mii = device_get_softc(sc->dme_miibus); + + DME_LOCK(sc); + mii_mediachg(mii); + DME_UNLOCK(sc); + + return (0); +} + +static void +dme_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + struct dme_softc *sc; + struct mii_data *mii; + + sc = ifp->if_softc; + mii = device_get_softc(sc->dme_miibus); + + DME_LOCK(sc); + mii_pollstat(mii); + ifmr->ifm_active = mii->mii_media_active; + ifmr->ifm_status = mii->mii_media_status; + DME_UNLOCK(sc); +} + +static struct ofw_compat_data compat_data[] = { + { "davicom,dm9000", true }, + { NULL, false } +}; + +static int +dme_probe(device_t dev) +{ + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + device_set_desc(dev, "Davicom DM9000"); + return (0); +} + +static int +dme_attach(device_t dev) +{ + struct dme_softc *sc; + struct ifnet *ifp; + int error, rid; + uint32_t data; + + sc = device_get_softc(dev); + sc->dme_dev = dev; + + error = 0; + + mtx_init(&sc->dme_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->dme_tick_ch, &sc->dme_mtx, 0); + + rid = 0; + sc->dme_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->dme_res == NULL) { + device_printf(dev, "unable to map memory\n"); + error = ENXIO; + goto fail; + } + + rid = 0; + sc->dme_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->dme_irq == NULL) { + device_printf(dev, "unable to map memory\n"); + error = ENXIO; + goto fail; + } + /* + * Power the chip up, if necessary + */ + error = regulator_get_by_ofw_property(dev, 0, "vcc-supply", &sc->dme_vcc_regulator); + if (error == 0) { + error = regulator_enable(sc->dme_vcc_regulator); + if (error != 0) { + device_printf(dev, "unable to enable power supply\n"); + error = ENXIO; + goto fail; + } + } + + /* + * Delay a little. This seems required on rev-1 boards (green.) + */ + DELAY(100000); + + /* Bring controller out of reset */ + error = ofw_gpiobus_parse_gpios(dev, "reset-gpios", &sc->gpio_rset); + if (error > 1) { + device_printf(dev, "too many reset gpios\n"); + sc->gpio_rset = NULL; + error = ENXIO; + goto fail; + } + + if (sc->gpio_rset != NULL) { + error = GPIO_PIN_SET(sc->gpio_rset->dev, sc->gpio_rset->pin, 0); + if (error != 0) { + device_printf(dev, "Cannot configure GPIO pin %d on %s\n", + sc->gpio_rset->pin, device_get_nameunit(sc->gpio_rset->dev)); + goto fail; + } + + error = GPIO_PIN_SETFLAGS(sc->gpio_rset->dev, sc->gpio_rset->pin, + GPIO_PIN_OUTPUT); + if (error != 0) { + device_printf(dev, "Cannot configure GPIO pin %d on %s\n", + sc->gpio_rset->pin, device_get_nameunit(sc->gpio_rset->dev)); + goto fail; + } + + DELAY(2000); + + error = GPIO_PIN_SET(sc->gpio_rset->dev, sc->gpio_rset->pin, 1); + if (error != 0) { + device_printf(dev, "Cannot configure GPIO pin %d on %s\n", + sc->gpio_rset->pin, device_get_nameunit(sc->gpio_rset->dev)); + goto fail; + } + + DELAY(4000); + } else + device_printf(dev, "Unable to find reset GPIO\n"); + + sc->dme_tag = rman_get_bustag(sc->dme_res); + sc->dme_handle = rman_get_bushandle(sc->dme_res); + + /* Reset the chip as soon as possible */ + dme_reset(sc); + + /* Figure IO mode */ + switch((dme_read_reg(sc, DME_ISR) >> 6) & 0x03) { + case 0: + /* 16 bit */ + sc->dme_bits = 16; + break; + case 1: + /* 32 bit */ + sc->dme_bits = 32; + break; + case 2: + /* 8 bit */ + sc->dme_bits = 8; + break; + default: + /* reserved */ + device_printf(dev, "Unable to determine device mode\n"); + error = ENXIO; + goto fail; + } + + DELAY(100000); + + /* Read vendor and device id's */ + data = dme_read_reg(sc, DME_VIDH) << 8; + data |= dme_read_reg(sc, DME_VIDL); + device_printf(dev, "Vendor ID: 0x%04x\n", data); + + /* Read vendor and device id's */ + data = dme_read_reg(sc, DME_PIDH) << 8; + data |= dme_read_reg(sc, DME_PIDL); + device_printf(dev, "Product ID: 0x%04x\n", data); + + /* Chip revision */ + data = dme_read_reg(sc, DME_CHIPR); + device_printf(dev, "Revision: 0x%04x\n", data); + if (data != DME_CHIP_DM9000A && data != DME_CHIP_DM9000B) + data = DME_CHIP_DM9000; + sc->dme_rev = data; + + device_printf(dev, "using %d-bit IO mode\n", sc->dme_bits); + KASSERT(sc->dme_bits == 8, ("wrong io mode")); + + /* Try to figure our mac address */ + dme_get_macaddr(sc); + + /* Configure chip after reset */ + dme_config(sc); + + ifp = sc->dme_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "unable to allocate ifp\n"); + error = ENOSPC; + goto fail; + } + ifp->if_softc = sc; + + /* Setup MII */ + error = mii_attach(dev, &sc->dme_miibus, ifp, dme_ifmedia_upd, + dme_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + /* This should never happen as the DM9000 contains it's own PHY */ + if (error != 0) { + device_printf(dev, "PHY probe failed\n"); + goto fail; + } + + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_start = dme_start; + ifp->if_ioctl = dme_ioctl; + ifp->if_init = dme_init; + IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + + ether_ifattach(ifp, sc->dme_macaddr); + + error = bus_setup_intr(dev, sc->dme_irq, INTR_TYPE_NET | INTR_MPSAFE, + NULL, dme_intr, sc, &sc->dme_intrhand); + if (error) { + device_printf(dev, "couldn't set up irq\n"); + ether_ifdetach(ifp); + goto fail; + } +fail: + if (error != 0) + dme_detach(dev); + return (error); +} + +static int +dme_detach(device_t dev) +{ + struct dme_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + KASSERT(mtx_initialized(&sc->dme_mtx), ("dme mutex not initialized")); + + ifp = sc->dme_ifp; + + if (device_is_attached(dev)) { + DME_LOCK(sc); + dme_stop(sc); + DME_UNLOCK(sc); + ether_ifdetach(ifp); + callout_drain(&sc->dme_tick_ch); + } + + if (sc->dme_miibus) + device_delete_child(dev, sc->dme_miibus); + bus_generic_detach(dev); + + if (sc->dme_vcc_regulator != 0) + regulator_release(sc->dme_vcc_regulator); + if (sc->dme_intrhand) + bus_teardown_intr(dev, sc->dme_irq, sc->dme_intrhand); + if (sc->dme_irq) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->dme_irq); + if (sc->dme_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->dme_res); + + if (ifp != NULL) + if_free(ifp); + + mtx_destroy(&sc->dme_mtx); + + return (0); +} + +/* + * The MII bus interface + */ +static int +dme_miibus_readreg(device_t dev, int phy, int reg) +{ + struct dme_softc *sc; + int i, rval; + + /* We have up to 4 PHY's */ + if (phy >= 4) + return (0); + + sc = device_get_softc(dev); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Nov 17 13:58:15 2016 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 CAC5EC47162; Thu, 17 Nov 2016 13:58:15 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id D1ED71054; Thu, 17 Nov 2016 13:58:14 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (global-5-142.nat-2.net.cam.ac.uk [131.111.5.142]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id A3624D8506; Thu, 17 Nov 2016 13:48:13 +0000 (UTC) Date: Thu, 17 Nov 2016 13:48:59 +0000 From: Andrew Turner To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308747 - in head/sys: conf dev/dme Message-ID: <20161117134859.12c97d90@zapp> In-Reply-To: <201611171148.uAHBm7I8089031@repo.freebsd.org> References: <201611171148.uAHBm7I8089031@repo.freebsd.org> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; 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: Thu, 17 Nov 2016 13:58:15 -0000 On Thu, 17 Nov 2016 11:48:07 +0000 (UTC) Ruslan Bukin wrote: > Added: head/sys/dev/dme/if_dme.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is > newly added) +++ head/sys/dev/dme/if_dme.c Thu Nov 17 11:48:07 > 2016 (r308747) @@ -0,0 +1,1070 @@ > +/* > + * Copyright (C) 2015 Alexander Kabaev > + * Copyright (C) 2010 Andrew Turner > + * All rights reserved. ... > +/* > + * A driver for the DM9000 MAC > + * > + * TODO: > + * Get the interrupt working > + * Port to non-S3C2440 systems > + * Test with 8 and 32 bit busses > + * Test on a big endian machine > + * Implement the rest of dme_detach > + */ I think this comment is about 6 years out of date. Andrew From owner-svn-src-head@freebsd.org Thu Nov 17 14:03:45 2016 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 7E0A1C4741A; Thu, 17 Nov 2016 14:03:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CA83168E; Thu, 17 Nov 2016 14:03:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAHE3ill044463; Thu, 17 Nov 2016 14:03:44 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHE3i3N044462; Thu, 17 Nov 2016 14:03:44 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201611171403.uAHE3i3N044462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 17 Nov 2016 14:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308748 - head/sys/netgraph X-SVN-Group: head 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, 17 Nov 2016 14:03:45 -0000 Author: bz Date: Thu Nov 17 14:03:44 2016 New Revision: 308748 URL: https://svnweb.freebsd.org/changeset/base/308748 Log: Writing out the L2TP control packet requires 12 bytes of contiguous memory but in one path we did not always guarantee this, thus do a m_pullup() there. PR: 214385 Submitted by: Joe Jones (joeknockando googlemail.com) MFC after: 3 days Modified: head/sys/netgraph/ng_l2tp.c Modified: head/sys/netgraph/ng_l2tp.c ============================================================================== --- head/sys/netgraph/ng_l2tp.c Thu Nov 17 11:48:07 2016 (r308747) +++ head/sys/netgraph/ng_l2tp.c Thu Nov 17 14:03:44 2016 (r308748) @@ -1544,6 +1544,16 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mb priv->stats.memoryFailures++; return (ENOBUFS); } + + /* + * The below requires 12 contiguous bytes for the L2TP header + * to be written into. + */ + m = m_pullup(m, 12); + if (m == NULL) { + priv->stats.memoryFailures++; + return (ENOBUFS); + } } /* Fill in L2TP header */ From owner-svn-src-head@freebsd.org Thu Nov 17 14:41:24 2016 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 31011C47DAA; Thu, 17 Nov 2016 14:41:24 +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 0B534BEE; Thu, 17 Nov 2016 14:41:23 +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 uAHEfNkL060157; Thu, 17 Nov 2016 14:41:23 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHEfN8W060154; Thu, 17 Nov 2016 14:41:23 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611171441.uAHEfN8W060154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 17 Nov 2016 14:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308750 - in head/sys/dev: ic uart X-SVN-Group: head 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, 17 Nov 2016 14:41:24 -0000 Author: br Date: Thu Nov 17 14:41:22 2016 New Revision: 308750 URL: https://svnweb.freebsd.org/changeset/base/308750 Log: Add support for UART found in the Ingenic XBurst system on chips. These CPUs has non-standard UART enable bit hidden in the UART FIFO Control Register. Sponsored by: DARPA, AFRL Modified: head/sys/dev/ic/ns16550.h head/sys/dev/uart/uart_dev_ns8250.c Modified: head/sys/dev/ic/ns16550.h ============================================================================== --- head/sys/dev/ic/ns16550.h Thu Nov 17 14:32:23 2016 (r308749) +++ head/sys/dev/ic/ns16550.h Thu Nov 17 14:41:22 2016 (r308750) @@ -156,6 +156,9 @@ #define FIFO_XMT_RST FCR_XMT_RST #define FCR_DMA 0x08 #define FIFO_DMA_MODE FCR_DMA +#ifdef CPU_XBURST +#define FCR_UART_ON 0x10 +#endif #define FCR_RX_LOW 0x00 #define FIFO_RX_LOW FCR_RX_LOW #define FCR_RX_MEDL 0x40 Modified: head/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- head/sys/dev/uart/uart_dev_ns8250.c Thu Nov 17 14:32:23 2016 (r308749) +++ head/sys/dev/uart/uart_dev_ns8250.c Thu Nov 17 14:41:22 2016 (r308750) @@ -198,6 +198,9 @@ ns8250_flush(struct uart_bas *bas, int w uint8_t fcr; fcr = FCR_ENABLE; +#ifdef CPU_XBURST + fcr |= FCR_UART_ON; +#endif if (what & UART_FLUSH_TRANSMITTER) fcr |= FCR_XMT_RST; if (what & UART_FLUSH_RECEIVER) @@ -268,6 +271,10 @@ ns8250_probe(struct uart_bas *bas) { u_char val; +#ifdef CPU_XBURST + uart_setreg(bas, REG_FCR, FCR_UART_ON); +#endif + /* Check known 0 bits that don't depend on DLAB. */ val = uart_getreg(bas, REG_IIR); if (val & 0x30) @@ -289,7 +296,7 @@ static void ns8250_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, int parity) { - u_char ier; + u_char ier, val; if (bas->rclk == 0) bas->rclk = DEFAULT_RCLK; @@ -306,7 +313,11 @@ ns8250_init(struct uart_bas *bas, int ba uart_barrier(bas); /* Disable the FIFO (if present). */ - uart_setreg(bas, REG_FCR, 0); + val = 0; +#ifdef CPU_XBURST + val = FCR_UART_ON; +#endif + uart_setreg(bas, REG_FCR, val); uart_barrier(bas); /* Set RTS & DTR. */ @@ -461,6 +472,9 @@ ns8250_bus_attach(struct uart_softc *sc) ns8250->mcr = uart_getreg(bas, REG_MCR); ns8250->fcr = FCR_ENABLE; +#ifdef CPU_XBURST + ns8250->fcr |= FCR_UART_ON; +#endif if (!resource_int_value("uart", device_get_unit(sc->sc_dev), "flags", &ivar)) { if (UART_FLAGS_FCR_RX_LOW(ivar)) @@ -753,6 +767,7 @@ ns8250_bus_probe(struct uart_softc *sc) struct uart_bas *bas; int count, delay, error, limit; uint8_t lsr, mcr, ier; + uint8_t val; ns8250 = (struct ns8250_softc *)sc; bas = &sc->sc_bas; @@ -786,7 +801,11 @@ ns8250_bus_probe(struct uart_softc *sc) * done. Since this is the first time we enable the FIFOs, we reset * them. */ - uart_setreg(bas, REG_FCR, FCR_ENABLE); + val = FCR_ENABLE; +#ifdef CPU_XBURST + val |= FCR_UART_ON; +#endif + uart_setreg(bas, REG_FCR, val); uart_barrier(bas); if (!(uart_getreg(bas, REG_IIR) & IIR_FIFO_MASK)) { /* @@ -800,7 +819,11 @@ ns8250_bus_probe(struct uart_softc *sc) return (0); } - uart_setreg(bas, REG_FCR, FCR_ENABLE | FCR_XMT_RST | FCR_RCV_RST); + val = FCR_ENABLE | FCR_XMT_RST | FCR_RCV_RST; +#ifdef CPU_XBURST + val |= FCR_UART_ON; +#endif + uart_setreg(bas, REG_FCR, val); uart_barrier(bas); count = 0; @@ -810,7 +833,11 @@ ns8250_bus_probe(struct uart_softc *sc) error = ns8250_drain(bas, UART_DRAIN_RECEIVER|UART_DRAIN_TRANSMITTER); if (error) { uart_setreg(bas, REG_MCR, mcr); - uart_setreg(bas, REG_FCR, 0); + val = 0; +#ifdef CPU_XBURST + val |= FCR_UART_ON; +#endif + uart_setreg(bas, REG_FCR, val); uart_barrier(bas); goto describe; } @@ -840,7 +867,11 @@ ns8250_bus_probe(struct uart_softc *sc) ier = uart_getreg(bas, REG_IER) & ns8250->ier_mask; uart_setreg(bas, REG_IER, ier); uart_setreg(bas, REG_MCR, mcr); - uart_setreg(bas, REG_FCR, 0); + val = 0; +#ifdef CPU_XBURST + val |= FCR_UART_ON; +#endif + uart_setreg(bas, REG_FCR, val); uart_barrier(bas); count = 0; goto describe; From owner-svn-src-head@freebsd.org Thu Nov 17 14:43:14 2016 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 66479C47F05; Thu, 17 Nov 2016 14:43:14 +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 331D8F30; Thu, 17 Nov 2016 14:43:14 +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 uAHEhDvt060258; Thu, 17 Nov 2016 14:43:13 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHEhDHg060257; Thu, 17 Nov 2016 14:43:13 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611171443.uAHEhDHg060257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 17 Nov 2016 14:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308751 - head/sys/dev/dme X-SVN-Group: head 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, 17 Nov 2016 14:43:14 -0000 Author: br Date: Thu Nov 17 14:43:13 2016 New Revision: 308751 URL: https://svnweb.freebsd.org/changeset/base/308751 Log: Remove outdated comment. Pointed out by: andrew (original author) Sponsored by: DARPA, AFRL Modified: head/sys/dev/dme/if_dme.c Modified: head/sys/dev/dme/if_dme.c ============================================================================== --- head/sys/dev/dme/if_dme.c Thu Nov 17 14:41:22 2016 (r308750) +++ head/sys/dev/dme/if_dme.c Thu Nov 17 14:43:13 2016 (r308751) @@ -25,16 +25,7 @@ * SUCH DAMAGE. */ -/* - * A driver for the DM9000 MAC - * - * TODO: - * Get the interrupt working - * Port to non-S3C2440 systems - * Test with 8 and 32 bit busses - * Test on a big endian machine - * Implement the rest of dme_detach - */ +/* A driver for the Davicom DM9000 MAC. */ #include __FBSDID("$FreeBSD$"); From owner-svn-src-head@freebsd.org Thu Nov 17 14:44:14 2016 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 C7377C47F66; Thu, 17 Nov 2016 14:44:14 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-ua0-x243.google.com (mail-ua0-x243.google.com [IPv6:2607:f8b0:400c:c08::243]) (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 8B3D910B5; Thu, 17 Nov 2016 14:44:14 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-ua0-x243.google.com with SMTP id 12so14648455uas.3; Thu, 17 Nov 2016 06:44:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=IrUaBn/gG06jRuCGIjvhvbhw+SxYjivGeiTCmArRRwM=; b=er9StpGX77RcKyePPJgChVWcEtbP7ZahYYeYv7SA8n6zxkdCYeAqkw5aARBns/h1GZ 9UVL/+5OR/bBCQgzerHz2rSLNreuAf8+ZLnk0/+oVw3GU7nV9C9LCC7R3LvSJUDbHx/F r0t/AwMi+rTBBVa5tSZAGrUV8Q3D0DX3R66TJ1Rqdr6rAqZcpzmftcxOTkJ6yjyu1yRG vpAaBKyUGZt5SzybNiyBo8Fb7laxxf9jJUuXkROZtUbgyHrKmCrXolw+dyM4KY7bAENR Ln9z6pbEbgvwYxJxcWCUBOF9QGEGF9qwsf6or0Kxa5yqTIhrZ8Qxx7i/EXKjaahM1TzE BjZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IrUaBn/gG06jRuCGIjvhvbhw+SxYjivGeiTCmArRRwM=; b=apw6QV7nhZCm35qVv93ys5V0x+W7YK+gFjiB3ON6GpWIA3WVYFi/OkprhPVgFfTtGb H7lQpD/4eN8A1gC+ZM3kvZ6XFU9GNaF+Izx8ryeFIimD50dGFOmFlcU4wbm1s11jirJA WOVlZI/drbKrWYWWqoHc34HVV5MACycxJJSKGIzjCbfPUt2eoFc3ztRJ4j5EgwhhSn3W EnmX62JxoGjgn4uJ8QsCP7Ak3cncYOs1CtP9eEsqR3reHYV0IABxgGWj57ButQ7439WR MsdXCaT+wXgboaYleujcesBVV3mDScFYDPQq1fku25PsLCUMqfPHrC5FF6NmrDWEYNwk lkGg== X-Gm-Message-State: ABUngvcyZbAg3We3elIt2ZASsyn7lOvxkXrD5vrZuYodYrAKc1T1u1i0/UoENufrEa6DrC4gfWD+QRch3JuFmQ== X-Received: by 10.176.85.24 with SMTP id t24mr2112640uaa.21.1479393852833; Thu, 17 Nov 2016 06:44:12 -0800 (PST) MIME-Version: 1.0 Received: by 10.159.36.247 with HTTP; Thu, 17 Nov 2016 06:44:12 -0800 (PST) In-Reply-To: <201611171403.uAHE3i3N044462@repo.freebsd.org> References: <201611171403.uAHE3i3N044462@repo.freebsd.org> From: Sepherosa Ziehau Date: Thu, 17 Nov 2016 22:44:12 +0800 Message-ID: Subject: Re: svn commit: r308748 - head/sys/netgraph To: "Bjoern A. Zeeb" 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: Thu, 17 Nov 2016 14:44:14 -0000 On Thu, Nov 17, 2016 at 10:03 PM, Bjoern A. Zeeb wrote: > Author: bz > Date: Thu Nov 17 14:03:44 2016 > New Revision: 308748 > URL: https://svnweb.freebsd.org/changeset/base/308748 > > Log: > Writing out the L2TP control packet requires 12 bytes of > contiguous memory but in one path we did not always guarantee this, > thus do a m_pullup() there. > > PR: 214385 > Submitted by: Joe Jones (joeknockando googlemail.com) > MFC after: 3 days > > Modified: > head/sys/netgraph/ng_l2tp.c > > Modified: head/sys/netgraph/ng_l2tp.c > ============================================================================== > --- head/sys/netgraph/ng_l2tp.c Thu Nov 17 11:48:07 2016 (r308747) > +++ head/sys/netgraph/ng_l2tp.c Thu Nov 17 14:03:44 2016 (r308748) > @@ -1544,6 +1544,16 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mb > priv->stats.memoryFailures++; > return (ENOBUFS); > } > + > + /* > + * The below requires 12 contiguous bytes for the L2TP header > + * to be written into. > + */ > + m = m_pullup(m, 12); > + if (m == NULL) { > + priv->stats.memoryFailures++; > + return (ENOBUFS); > + } Would it be better that we do a (m->m_len < 12) test before doing the m_pullup()? Thanks, sephe -- Tomorrow Will Never Die From owner-svn-src-head@freebsd.org Thu Nov 17 15:08:31 2016 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 CABD0C455D8; Thu, 17 Nov 2016 15:08:31 +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 88BF71AAD; Thu, 17 Nov 2016 15:08:31 +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 uAHF8U8o068202; Thu, 17 Nov 2016 15:08:30 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHF8Ua8068200; Thu, 17 Nov 2016 15:08:30 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611171508.uAHF8Ua8068200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 17 Nov 2016 15:08:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308752 - head/sys/dev/usb/controller X-SVN-Group: head 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, 17 Nov 2016 15:08:31 -0000 Author: br Date: Thu Nov 17 15:08:30 2016 New Revision: 308752 URL: https://svnweb.freebsd.org/changeset/base/308752 Log: Allow operation with UTMI+ phy. Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/dev/usb/controller/dwc_otg.c head/sys/dev/usb/controller/dwc_otg.h Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Thu Nov 17 14:43:13 2016 (r308751) +++ head/sys/dev/usb/controller/dwc_otg.c Thu Nov 17 15:08:30 2016 (r308752) @@ -98,10 +98,6 @@ GINTSTS_WKUPINT | GINTSTS_USBSUSP | GINTMSK_OTGINTMSK | \ GINTSTS_SESSREQINT) -#define DWC_OTG_PHY_ULPI 0 -#define DWC_OTG_PHY_HSIC 1 -#define DWC_OTG_PHY_INTERNAL 2 - #ifndef DWC_OTG_PHY_DEFAULT #define DWC_OTG_PHY_DEFAULT DWC_OTG_PHY_ULPI #endif @@ -110,10 +106,10 @@ static int dwc_otg_phy_type = DWC_OTG_PH static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, "USB DWC OTG"); SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, phy_type, CTLFLAG_RDTUN, - &dwc_otg_phy_type, 0, "DWC OTG PHY TYPE - 0/1/2 - ULPI/HSIC/INTERNAL"); + &dwc_otg_phy_type, 0, "DWC OTG PHY TYPE - 0/1/2/3 - ULPI/HSIC/INTERNAL/UTMI+"); #ifdef USB_DEBUG -static int dwc_otg_debug; +static int dwc_otg_debug = 0; SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, debug, CTLFLAG_RWTUN, &dwc_otg_debug, 0, "DWC OTG debug level"); @@ -3889,8 +3885,13 @@ dwc_otg_init(struct dwc_otg_softc *sc) break; } - /* select HSIC, ULPI or internal PHY mode */ - switch (dwc_otg_phy_type) { + if (sc->sc_phy_type == 0) + sc->sc_phy_type = dwc_otg_phy_type + 1; + if (sc->sc_phy_bits == 0) + sc->sc_phy_bits = 16; + + /* select HSIC, ULPI, UTMI+ or internal PHY mode */ + switch (sc->sc_phy_type) { case DWC_OTG_PHY_HSIC: DWC_OTG_WRITE_4(sc, DOTG_GUSBCFG, GUSBCFG_PHYIF | @@ -3914,6 +3915,16 @@ dwc_otg_init(struct dwc_otg_softc *sc) DWC_OTG_WRITE_4(sc, DOTG_GLPMCFG, temp & ~GLPMCFG_HSIC_CONN); break; + case DWC_OTG_PHY_UTMI: + DWC_OTG_WRITE_4(sc, DOTG_GUSBCFG, + (sc->sc_phy_bits == 16 ? GUSBCFG_PHYIF : 0) | + GUSBCFG_TRD_TIM_SET(5) | temp); + DWC_OTG_WRITE_4(sc, DOTG_GOTGCTL, 0); + + temp = DWC_OTG_READ_4(sc, DOTG_GLPMCFG); + DWC_OTG_WRITE_4(sc, DOTG_GLPMCFG, + temp & ~GLPMCFG_HSIC_CONN); + break; case DWC_OTG_PHY_INTERNAL: DWC_OTG_WRITE_4(sc, DOTG_GUSBCFG, GUSBCFG_PHYSEL | Modified: head/sys/dev/usb/controller/dwc_otg.h ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.h Thu Nov 17 14:43:13 2016 (r308751) +++ head/sys/dev/usb/controller/dwc_otg.h Thu Nov 17 15:08:30 2016 (r308752) @@ -191,6 +191,13 @@ struct dwc_otg_softc { uint16_t sc_active_rx_ep; uint16_t sc_last_frame_num; + uint8_t sc_phy_type; + uint8_t sc_phy_bits; +#define DWC_OTG_PHY_ULPI 1 +#define DWC_OTG_PHY_HSIC 2 +#define DWC_OTG_PHY_INTERNAL 3 +#define DWC_OTG_PHY_UTMI 4 + uint8_t sc_timer_active; uint8_t sc_dev_ep_max; uint8_t sc_dev_in_ep_max; From owner-svn-src-head@freebsd.org Thu Nov 17 15:12:05 2016 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 002D2C458D4; Thu, 17 Nov 2016 15:12:04 +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 C65E17A; Thu, 17 Nov 2016 15:12:04 +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 uAHFC3Ha072262; Thu, 17 Nov 2016 15:12:03 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHFC3pM072261; Thu, 17 Nov 2016 15:12:03 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611171512.uAHFC3pM072261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 17 Nov 2016 15:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308755 - head/sys/dev/usb/controller X-SVN-Group: head 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, 17 Nov 2016 15:12:05 -0000 Author: br Date: Thu Nov 17 15:12:03 2016 New Revision: 308755 URL: https://svnweb.freebsd.org/changeset/base/308755 Log: Declare dwc_otg_detach as non-static (same as dwc_otg_attach), so it can be called from fdt-glue drivers. Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/dev/usb/controller/dwc_otg_fdt.c head/sys/dev/usb/controller/dwc_otg_fdt.h Modified: head/sys/dev/usb/controller/dwc_otg_fdt.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg_fdt.c Thu Nov 17 15:10:52 2016 (r308754) +++ head/sys/dev/usb/controller/dwc_otg_fdt.c Thu Nov 17 15:12:03 2016 (r308755) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include static device_probe_t dwc_otg_probe; -static device_detach_t dwc_otg_detach; static int dwc_otg_probe(device_t dev) @@ -159,7 +158,7 @@ error: return (ENXIO); } -static int +int dwc_otg_detach(device_t dev) { struct dwc_otg_fdt_softc *sc = device_get_softc(dev); Modified: head/sys/dev/usb/controller/dwc_otg_fdt.h ============================================================================== --- head/sys/dev/usb/controller/dwc_otg_fdt.h Thu Nov 17 15:10:52 2016 (r308754) +++ head/sys/dev/usb/controller/dwc_otg_fdt.h Thu Nov 17 15:12:03 2016 (r308755) @@ -35,5 +35,6 @@ struct dwc_otg_fdt_softc { extern driver_t dwc_otg_driver; device_attach_t dwc_otg_attach; +device_attach_t dwc_otg_detach; #endif From owner-svn-src-head@freebsd.org Thu Nov 17 15:18:23 2016 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 EB9DCC45C60; Thu, 17 Nov 2016 15:18:23 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A947DE8A; Thu, 17 Nov 2016 15:18:23 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C5A2F1FE023; Thu, 17 Nov 2016 16:18:21 +0100 (CET) Subject: Re: svn commit: r308752 - head/sys/dev/usb/controller To: Ruslan Bukin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201611171508.uAHF8Ua8068200@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Thu, 17 Nov 2016 16:18:18 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <201611171508.uAHF8Ua8068200@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed 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: Thu, 17 Nov 2016 15:18:24 -0000 On 11/17/16 16:08, Ruslan Bukin wrote: > #ifdef USB_DEBUG > -static int dwc_otg_debug; > +static int dwc_otg_debug = 0; BSS/static is zero by default. Else looks good. --HPS From owner-svn-src-head@freebsd.org Thu Nov 17 15:19:07 2016 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 A63E7C45CF3; Thu, 17 Nov 2016 15:19:07 +0000 (UTC) (envelope-from fanf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 834DF1005; Thu, 17 Nov 2016 15:19:07 +0000 (UTC) (envelope-from fanf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAHFJ6uG072879; Thu, 17 Nov 2016 15:19:06 GMT (envelope-from fanf@FreeBSD.org) Received: (from fanf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHFJ6me072878; Thu, 17 Nov 2016 15:19:06 GMT (envelope-from fanf@FreeBSD.org) Message-Id: <201611171519.uAHFJ6me072878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fanf set sender to fanf@FreeBSD.org using -f From: Tony Finch Date: Thu, 17 Nov 2016 15:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308762 - head/usr.bin/whois X-SVN-Group: head 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, 17 Nov 2016 15:19:07 -0000 Author: fanf Date: Thu Nov 17 15:19:06 2016 New Revision: 308762 URL: https://svnweb.freebsd.org/changeset/base/308762 Log: More robust handling of whois referrals from RIRs. An example problem case is 163.1.0.0 (University of Oxford) which is in an APNIC ERX address range. Previously we assumed that ARIN has the correct information for all ERX allocations, but in this case ARIN refers back to APNIC, rather than referring to RIPE. This caused whois to loop. Whois will no longer loop back and forth forever between two RIRs that don't have an answer, but instead try the other RIRs in turn. Modified: head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.c ============================================================================== --- head/usr.bin/whois/whois.c Thu Nov 17 15:17:01 2016 (r308761) +++ head/usr.bin/whois/whois.c Thu Nov 17 15:19:06 2016 (r308762) @@ -119,12 +119,38 @@ static struct { { NULL, 0 } }; +/* + * We have a list of patterns for RIRs that assert ignorance rather than + * providing referrals. If that happens, we guess that ARIN will be more + * helpful. But, before following a referral to an RIR, we check if we have + * asked that RIR already, and if so we make another guess. + */ static const char *actually_arin[] = { "netname: ERX-NETBLOCK\n", /* APNIC */ "netname: NON-RIPE-NCC-MANAGED-ADDRESS-BLOCK\n", NULL }; +static struct { + int loop; + const char *host; +} try_rir[] = { + { 0, ANICHOST }, + { 0, RNICHOST }, + { 0, PNICHOST }, + { 0, FNICHOST }, + { 0, LNICHOST }, + { 0, NULL } +}; + +static void +reset_rir(void) { + int i; + + for (i = 0; try_rir[i].host != NULL; i++) + try_rir[i].loop = 0; +} + static const char *port = DEFAULT_PORT; static const char *choose_server(char *); @@ -232,6 +258,7 @@ main(int argc, char *argv[]) } else whois(*argv, host != NULL ? host : choose_server(*argv), flags); + reset_rir(); argv++; } exit(0); @@ -420,7 +447,7 @@ whois(const char *query, const char *hos FILE *fp; struct addrinfo *hostres; char *buf, *host, *nhost, *p; - int s, f; + int comment, s, f; size_t len, i; hostres = gethostinfo(hostname, 1); @@ -467,12 +494,28 @@ whois(const char *query, const char *hos fprintf(fp, "%s\r\n", query); fflush(fp); + comment = 0; + if (!(flags & WHOIS_SPAM_ME) && + (strcasecmp(hostname, ANICHOST) == 0 || + strcasecmp(hostname, RNICHOST) == 0)) { + comment = 2; + } + nhost = NULL; while ((buf = fgetln(fp, &len)) != NULL) { /* Nominet */ if (!(flags & WHOIS_SPAM_ME) && len == 5 && strncmp(buf, "-- \r\n", 5) == 0) break; + /* RIRs */ + if (comment == 1 && buf[0] == '#') + break; + else if (comment == 2) { + if (strchr("#%\r\n", buf[0]) != NULL) + continue; + else + comment = 1; + } printf("%.*s", (int)len, buf); @@ -487,8 +530,7 @@ whois(const char *query, const char *hos SCAN(p, buf+len, *p == ' '); host = p; SCAN(p, buf+len, ishost(*p)); - /* avoid loops */ - if (strncmp(hostname, host, p - host) != 0) + if (p > host) s_asprintf(&nhost, "%.*s", (int)(p - host), host); break; @@ -511,8 +553,37 @@ whois(const char *query, const char *hos } fclose(fp); freeaddrinfo(hostres); + + f = 0; + for (i = 0; try_rir[i].host != NULL; i++) { + /* Remember visits to RIRs */ + if (try_rir[i].loop == 0 && + strcasecmp(try_rir[i].host, hostname) == 0) + try_rir[i].loop = 1; + /* Do we need to find an alternative RIR? */ + if (try_rir[i].loop != 0 && nhost != NULL && + strcasecmp(try_rir[i].host, nhost) == 0) { + free(nhost); + nhost = NULL; + f = 1; + } + } + if (f) { + /* Find a replacement RIR */ + for (i = 0; try_rir[i].host != NULL; i++) { + if (try_rir[i].loop == 0) { + s_asprintf(&nhost, "%s", + try_rir[i].host); + break; + } + } + } if (nhost != NULL) { - whois(query, nhost, flags); + /* Ignore self-referrals */ + if (strcasecmp(hostname, nhost) != 0) { + printf("# %s\n\n", nhost); + whois(query, nhost, flags); + } free(nhost); } } From owner-svn-src-head@freebsd.org Thu Nov 17 15:37:45 2016 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 87EAEC465D5; Thu, 17 Nov 2016 15:37:45 +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 549C5D2; Thu, 17 Nov 2016 15:37:45 +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 uAHFbi5d081043; Thu, 17 Nov 2016 15:37:44 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHFbi3N081042; Thu, 17 Nov 2016 15:37:44 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611171537.uAHFbi3N081042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 17 Nov 2016 15:37:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308767 - head/sys/dev/gpio X-SVN-Group: head 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, 17 Nov 2016 15:37:45 -0000 Author: br Date: Thu Nov 17 15:37:44 2016 New Revision: 308767 URL: https://svnweb.freebsd.org/changeset/base/308767 Log: Make gpiobus early driver at BUS_PAS_BUS. The gpiobus driver is attached explicitly and generally should be at the same pass as its parent. Making it use BUS_PAS_BUS ensures that it attaches immediately after parent adds it (assuming the parent itself attached at BUS_PAS_BUS and above). Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/dev/gpio/gpiobus.c Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Thu Nov 17 15:25:26 2016 (r308766) +++ head/sys/dev/gpio/gpiobus.c Thu Nov 17 15:37:44 2016 (r308767) @@ -855,5 +855,6 @@ driver_t gpiobus_driver = { devclass_t gpiobus_devclass; -DRIVER_MODULE(gpiobus, gpio, gpiobus_driver, gpiobus_devclass, 0, 0); +EARLY_DRIVER_MODULE(gpiobus, gpio, gpiobus_driver, gpiobus_devclass, 0, 0, + BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(gpiobus, 1); From owner-svn-src-head@freebsd.org Thu Nov 17 16:06:54 2016 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 9F6EDC46ED8; Thu, 17 Nov 2016 16:06:54 +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 6FC6D106C; Thu, 17 Nov 2016 16:06:54 +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 uAHG6rvX093028; Thu, 17 Nov 2016 16:06:53 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHG6rvg093027; Thu, 17 Nov 2016 16:06:53 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611171606.uAHG6rvg093027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 17 Nov 2016 16:06:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308768 - head/sys/dev/uart X-SVN-Group: head 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, 17 Nov 2016 16:06:54 -0000 Author: br Date: Thu Nov 17 16:06:53 2016 New Revision: 308768 URL: https://svnweb.freebsd.org/changeset/base/308768 Log: Do not reallocate driver softc for uart unnecessarily. Do not assume that all uart drivers use uart_softc structure as is. Some do a sensible thing and do declare their uart class and driver properly and arrive into uart_bus_attach with suitably sized softc. Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/dev/uart/uart_core.c Modified: head/sys/dev/uart/uart_core.c ============================================================================== --- head/sys/dev/uart/uart_core.c Thu Nov 17 15:37:44 2016 (r308767) +++ head/sys/dev/uart/uart_core.c Thu Nov 17 16:06:53 2016 (r308768) @@ -573,7 +573,7 @@ uart_bus_attach(device_t dev) * the device. */ sc0 = device_get_softc(dev); - if (sc0->sc_class->size > sizeof(*sc)) { + if (sc0->sc_class->size > device_get_driver(dev)->size) { sc = malloc(sc0->sc_class->size, M_UART, M_WAITOK|M_ZERO); bcopy(sc0, sc, sizeof(*sc)); device_set_softc(dev, sc); @@ -781,11 +781,10 @@ uart_bus_detach(device_t dev) mtx_destroy(&sc->sc_hwmtx_s); - if (sc->sc_class->size > sizeof(*sc)) { + if (sc->sc_class->size > device_get_driver(dev)->size) { device_set_softc(dev, NULL); free(sc, M_UART); - } else - device_set_softc(dev, NULL); + } return (0); } From owner-svn-src-head@freebsd.org Thu Nov 17 16:13:31 2016 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 A6117C4711B; Thu, 17 Nov 2016 16:13:31 +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 769761580; Thu, 17 Nov 2016 16:13:31 +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 uAHGDU91096744; Thu, 17 Nov 2016 16:13:30 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHGDUgE096743; Thu, 17 Nov 2016 16:13:30 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611171613.uAHGDUgE096743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 17 Nov 2016 16:13:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308769 - head/sys/kern X-SVN-Group: head 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, 17 Nov 2016 16:13:31 -0000 Author: br Date: Thu Nov 17 16:13:30 2016 New Revision: 308769 URL: https://svnweb.freebsd.org/changeset/base/308769 Log: Fix build when no INET and INET6 in kernel config. Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/kern/vfs_export.c Modified: head/sys/kern/vfs_export.c ============================================================================== --- head/sys/kern/vfs_export.c Thu Nov 17 16:06:53 2016 (r308768) +++ head/sys/kern/vfs_export.c Thu Nov 17 16:13:30 2016 (r308769) @@ -61,8 +61,10 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_NETADDR, "export_host", "Export host address structure"); +#if defined(INET) || defined(INET6) static struct radix_node_head *vfs_create_addrlist_af( struct radix_node_head **prnh, int off); +#endif static void vfs_free_addrlist(struct netexport *nep); static int vfs_free_netcred(struct radix_node *rn, void *w); static void vfs_free_addrlist_af(struct radix_node_head **prnh); @@ -239,6 +241,7 @@ vfs_free_netcred(struct radix_node *rn, return (0); } +#if defined(INET) || defined(INET6) static struct radix_node_head * vfs_create_addrlist_af(struct radix_node_head **prnh, int off) { @@ -248,6 +251,7 @@ vfs_create_addrlist_af(struct radix_node RADIX_NODE_HEAD_LOCK_INIT(*prnh); return (*prnh); } +#endif static void vfs_free_addrlist_af(struct radix_node_head **prnh) From owner-svn-src-head@freebsd.org Thu Nov 17 16:27:30 2016 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 3D205C473E9; Thu, 17 Nov 2016 16:27:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (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 02AFD1BD5; Thu, 17 Nov 2016 16:27:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x236.google.com with SMTP id c20so286644159itb.0; Thu, 17 Nov 2016 08:27:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0xRpzoJiVY+12LgRnYANXUlnaW/R9U4a5zQmh+uk6f8=; b=ucwo797O1h1rzWfqdL5QByT1X3kKb6i60IZ2KYNlQ/ud59c5O1rxZEcQxnUNLfwPq8 fBzn9BCQgYtHchizbevILD+x0l6mZCwY9Ge654T3wqedcOoMB/hM74pfI6ur/iUGB5Fq 3gYkjJ+SYOlg20kxlhHNWlYBVFb+Qm+K8adUPqxGV2519KthbfHEXEd1uleRTbVIASE8 FZL6MzxefgsI2u+KR42gFriROBiCKMpAzIXG/5yG/lS8yX7UfuQkQop1MKUX/DgUriCl YfjrkGYk9HSJRt28YhSUd5vzOciJwGQdKmI7x+rPjbU80c/1/cgvMRoG0zBSBMI9LntV ZqvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0xRpzoJiVY+12LgRnYANXUlnaW/R9U4a5zQmh+uk6f8=; b=dzTqTb8gX0XYFa3DWTRzia0bL5ESIxXPT9rvGuUKZ4C1e/KihDiYn8JLPR36ipUjdw CpcuDi1wmYQLy/MZ947czfrC7YE4hvQltss3y8NSEuXCP87Qz3torVLFeBED4c9Kcsuc EU2qTFZHP2wzudOP6taCO8ZtVdB/Y+TIciGXEriDn64ky7VG8Hm04RUHCWhkm6pelnq3 m1bSlO0tsy2mbIQ8LhgeuBsDsMkEetDS2WGExm8VFeuzvdTEAkkBl87W9nj7M+2gZDf2 ohP6Rjrjt9363LTKschXK2yYG1zS9CyoC4V2/xCgw5SBOCbCL9hzKRjgqSaxcI3kqkRW 9A6g== X-Gm-Message-State: ABUngvfQpEGwwV5VBVEDWKJX0zEk/8Zk6T+NVX9BWezvRqG2x42czQWmAo0yeNcfdmjNkwSFEZRgRKzz4Ke18A== X-Received: by 10.36.138.67 with SMTP id v64mr3528385itd.39.1479400048209; Thu, 17 Nov 2016 08:27:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Thu, 17 Nov 2016 08:27:27 -0800 (PST) In-Reply-To: <201611171131.uAHBVDsX083769@repo.freebsd.org> References: <201611171131.uAHBVDsX083769@repo.freebsd.org> From: Adrian Chadd Date: Thu, 17 Nov 2016 08:27:27 -0800 Message-ID: Subject: Re: svn commit: r308746 - in head/sys/gnu/dts: include/dt-bindings/dma include/dt-bindings/net mips/ingenic To: Ruslan Bukin 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: Thu, 17 Nov 2016 16:27:30 -0000 heh, as someone with the ye older board / boot loader, I'll see about adding a comment somewhere that the console is .. not what dts says. :) -a From owner-svn-src-head@freebsd.org Thu Nov 17 16:35:57 2016 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 4EC9FC47604; Thu, 17 Nov 2016 16:35:57 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::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 13010212; Thu, 17 Nov 2016 16:35:57 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x22a.google.com with SMTP id c20so287084637itb.0; Thu, 17 Nov 2016 08:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=VQbRuxRwB5ZVSbyO2uZDthGTsNBOWSyWccfgOjU4ulY=; b=uBrR4+Wi/zaEDbbApL5TTu+uIM8tde7IPQNIUD+3kA4XpS7X2SvasbBDKMn7iUzFb1 E98NVK6MP0b9TLXnR/veEOQQoJlURPoDdiawke4eNDuilpsRfwey5aNikhYJuOLNpLCY 3+z3SHiLfRhAMimFzn7bvXE5j+AhbbjKrPQtEP3ETy2p64P5oKqBtH1+N63njuDzWGa6 A3+ZAxQUxpd6JFwro308XtMvA9tcawBuDTBK0OqN9Mv+gPCfsaUqczzV92ULXomKLnvn kb1wqrDQYyyQK03YlQbaq4BF/m4NHfmRvIYaJ2J256q1EqDoUcpLTaA+K+ZSHb0IuvKS h0Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=VQbRuxRwB5ZVSbyO2uZDthGTsNBOWSyWccfgOjU4ulY=; b=YlYpP0jho1OpKTzeNKtNIFFY+F9WyyTAskBHaIuCwyUg9a1oj4btnvK6LAqFdW02ON XObpm46BY+VQtqONTC/jwStrLuFWSme9lYe5+jUd3ARG9yVJsdY3nJplIkVrpCl6QRwH 0MAdZ1loQk1PNh9ACMwGOI0FI15MbzgfPtew++S9Y/qNH3/lYPc3n0R7XkcJCK4g+Jov P/TfV4hdng7IZAheAHf0dyZvxvakMj7IDTd79sZL67rEQTG78j5ysEeE0BMS3PhRLmLD xu+ofV+BpHZ3F5fBLpQjaR/puyoJfzAlOj3G5o1N9BZs/zn5S3pi5RDFp7l/wmvQJ+wZ /OhQ== X-Gm-Message-State: AKaTC027VOXGHZDV8g4FgB5B9sulius3JcqiqGEGcTEvOzFlPlk9ZGHoxUa00SaE4I7u6/tY80U5Stw3rSs69A== X-Received: by 10.107.19.164 with SMTP id 36mr4329735iot.155.1479400555394; Thu, 17 Nov 2016 08:35:55 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.27.212 with HTTP; Thu, 17 Nov 2016 08:35:35 -0800 (PST) In-Reply-To: <201611121926.uACJQDsu078946@repo.freebsd.org> References: <201611121926.uACJQDsu078946@repo.freebsd.org> From: Ed Maste Date: Thu, 17 Nov 2016 11:35:35 -0500 X-Google-Sender-Auth: Ksyr0iZW0tToE6Pk-ybN2R-LiXU Message-ID: Subject: Re: svn commit: r308582 - in head: cddl/contrib/opensolaris/lib/libdtrace/common sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/contrib/opensolaris/uts/common/sys To: Mark Johnston 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: Thu, 17 Nov 2016 16:35:57 -0000 On 12 November 2016 at 14:26, Mark Johnston wrote: > Author: markj > Date: Sat Nov 12 19:26:12 2016 > New Revision: 308582 > URL: https://svnweb.freebsd.org/changeset/base/308582 > > Log: > Remove the DTrace printt and typeref actions. It looks like we have a missing dependency here, as a non-clean build fails with: dt_names.c:62:7: error: use of undeclared identifier 'DIF_SUBR_TYPEREF' case DIF_SUBR_TYPEREF: return ("typeref"); ^ From owner-svn-src-head@freebsd.org Thu Nov 17 16:51:58 2016 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 B3D3EC47966; Thu, 17 Nov 2016 16:51:58 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68764D02; Thu, 17 Nov 2016 16:51:57 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.16.0.17/8.16.0.17) with SMTP id uAHGh3gj028097; Thu, 17 Nov 2016 10:51:41 -0600 Received: from mh3.mail.rice.edu (mh3.mail.rice.edu [128.42.199.10]) by pp2.rice.edu with ESMTP id 26s1u3gbvx-1; Thu, 17 Nov 2016 10:51:41 -0600 X-Virus-Scanned: by amavis-2.7.0 at mh3.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh3.mail.rice.edu (Postfix) with ESMTPSA id 1085D4013D; Thu, 17 Nov 2016 10:51:41 -0600 (CST) Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm To: Ruslan Bukin , Konstantin Belousov References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> <20161116165343.GX54029@kib.kiev.ua> <20161116165939.GA12498@bsdpad.com> <20161116175210.GA13203@bsdpad.com> Cc: Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Alan Cox Message-ID: <9047aad0-0713-5d7a-f92e-6f931642bb27@rice.edu> Date: Thu, 17 Nov 2016 10:51:40 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161116175210.GA13203@bsdpad.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611170292 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, 17 Nov 2016 16:51:58 -0000 On 11/16/2016 11:52, Ruslan Bukin wrote: > On Wed, Nov 16, 2016 at 04:59:39PM +0000, Ruslan Bukin wrote: >> On Wed, Nov 16, 2016 at 06:53:43PM +0200, Konstantin Belousov wrote: >>> On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: >>>> I have a panic with this on RISC-V. Any ideas ? >>> How did you checked that the revision you replied to, makes the probl= em ? >>> Note that the backtrace below is not reasonable. >> I reverted this commit like that and rebuilt kernel: >> git show 2fa36073055134deb2df39c7ca46264cfc313d77 | patch -p1 -R >> >> So the problem is reproducible on dual-core with 32mb mdroot. >> > I just found another interesting behavior: > depending on amount of physical memory : > 700m - panic > 800m - works fine > 1024m - panic I think that this behavior is not inconsistent with your report of the system crashing if you enabled two cores but not one. Specifically, changing the number of active cores will slightly affect the amount of memory that is allocated during initialization. There is nothing unusual in the sysctl output that you sent out. I have two suggestions. Try these in order. 1. r308691 reduced the size of struct vm_object. Try undoing the one snippet that reduced the vm object size and see if that makes a differenc= e. @@ -118,7 +118,6 @@ vm_ooffset_t backing_object_offset;/* Offset in backing object */ TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of thi= s pager type */ LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ - struct vm_radix cache; /* (o + f) root of the cache page radix trie */= void *handle; union { /* 2. I'd like to know if vm_page_scan_contig() is being called. Finally, to simply the situation a little, I would suggest that you disable superpage reservations in vmparam.h. You have no need for them. From owner-svn-src-head@freebsd.org Thu Nov 17 17:45:58 2016 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 9F434C47660; Thu, 17 Nov 2016 17:45:58 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.imp.ch (smtp.imp.ch [IPv6:2001:4060:1:1001::13:197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67816C61; Thu, 17 Nov 2016 17:45:55 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from [192.168.225.14] (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by fgznet.ch (Postfix) with ESMTPSA id 0952FD2158; Thu, 17 Nov 2016 18:45:51 +0100 (CET) Subject: Re: svn commit: r308725 - in head/sys: conf dev/hyperv/pcib modules/hyperv/pcib To: Dexuan Cui , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201611160925.uAG9P040059891@repo.freebsd.org> From: Andreas Tobler Message-ID: Date: Thu, 17 Nov 2016 18:46:27 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <201611160925.uAG9P040059891@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: Idefix Submit on 127.0.1.1 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, 17 Nov 2016 17:45:58 -0000 On 16.11.16 10:25, Dexuan Cui wrote: > Author: dexuan > Date: Wed Nov 16 09:25:00 2016 > New Revision: 308725 > URL: https://svnweb.freebsd.org/changeset/base/308725 > Modified: head/sys/conf/files.amd64 > ============================================================================== > --- head/sys/conf/files.amd64 Wed Nov 16 09:08:32 2016 (r308724) > +++ head/sys/conf/files.amd64 Wed Nov 16 09:25:00 2016 (r308725) > @@ -292,6 +292,7 @@ dev/hwpmc/hwpmc_uncore.c optional hwpmc > dev/hwpmc/hwpmc_piv.c optional hwpmc > dev/hwpmc/hwpmc_tsc.c optional hwpmc > dev/hwpmc/hwpmc_x86.c optional hwpmc > +dev/hyperv/pcib/pcib.c optional hyperv I'd say, for both, files.amd64 and files.i386 -dev/hyperv/pcib/pcib.c optional hyperv +dev/hyperv/pcib/pcib.c optional hyperv pci Fixes the build on trunk. Andreas From owner-svn-src-head@freebsd.org Thu Nov 17 18:12:18 2016 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 AB980C4712F; Thu, 17 Nov 2016 18:12:18 +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 7793DDB; Thu, 17 Nov 2016 18:12:18 +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 uAHICHdH044674; Thu, 17 Nov 2016 18:12:17 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHICHnZ044673; Thu, 17 Nov 2016 18:12:17 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201611171812.uAHICHnZ044673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 17 Nov 2016 18:12:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308772 - head/usr.sbin/crunch/crunchide X-SVN-Group: head 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, 17 Nov 2016 18:12:18 -0000 Author: emaste Date: Thu Nov 17 18:12:17 2016 New Revision: 308772 URL: https://svnweb.freebsd.org/changeset/base/308772 Log: crunchide: report explicit error for combined string table Some tools produce objects with a combined strtab and shstrtab. These objects are not supported by crunchide since it rewrites the symtab and strtab to "hide" symbols. This invalidates section header offsets into a combined strtab/shstrtab. In the future we could support these objects (by ensuring that we retain unmodified section name strings in the output .strtab, and then rewriting each section header's sh_name). MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- head/usr.sbin/crunch/crunchide/exec_elf32.c Thu Nov 17 18:10:08 2016 (r308771) +++ head/usr.sbin/crunch/crunchide/exec_elf32.c Thu Nov 17 18:12:17 2016 (r308772) @@ -279,6 +279,10 @@ ELFNAMEEND(hide)(int fd, const char *fn) weird = 1; weirdreason = "section header string table does not exist"; } + if (strtabshdr == shstrtabshdr) { + weird = 1; + weirdreason = "combined strtab and shstrtab not supported"; + } if (weirdreason == NULL) weirdreason = "unsupported"; if (weird) { From owner-svn-src-head@freebsd.org Thu Nov 17 18:13:43 2016 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 6D841C471BF; Thu, 17 Nov 2016 18:13:43 +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 389393BC; Thu, 17 Nov 2016 18:13:43 +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 uAHIDgpZ044928; Thu, 17 Nov 2016 18:13:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHIDgXE044927; Thu, 17 Nov 2016 18:13:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201611171813.uAHIDgXE044927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 17 Nov 2016 18:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308773 - head/cddl/lib/libdtrace X-SVN-Group: head 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, 17 Nov 2016 18:13:43 -0000 Author: markj Date: Thu Nov 17 18:13:42 2016 New Revision: 308773 URL: https://svnweb.freebsd.org/changeset/base/308773 Log: Define dependencies for some auto-generated source files in libdtrace. Remove an unneeded beforedepend rule. Reported by: emaste, jhb Reviewed by: bdrewery MFC after: 1 week Modified: head/cddl/lib/libdtrace/Makefile Modified: head/cddl/lib/libdtrace/Makefile ============================================================================== --- head/cddl/lib/libdtrace/Makefile Thu Nov 17 18:12:17 2016 (r308772) +++ head/cddl/lib/libdtrace/Makefile Thu Nov 17 18:13:42 2016 (r308773) @@ -121,12 +121,10 @@ LIBADD= ctf elf proc pthread rtld_db CLEANFILES= dt_errtags.c dt_names.c -dt_errtags.c: - sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mkerrtags.sh < ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/dt_errtags.h > dt_errtags.c - -dt_names.c: - sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mknames.sh < ${OPENSOLARIS_SYS_DISTDIR}/uts/common/sys/dtrace.h > dt_names.c +.include -beforedepend: dt_errtags.c dt_names.c +dt_errtags.c: ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/dt_errtags.h + sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mkerrtags.sh < ${.ALLSRC} > ${.TARGET} -.include +dt_names.c: ${OPENSOLARIS_SYS_DISTDIR}/uts/common/sys/dtrace.h + sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mknames.sh < ${.ALLSRC} > ${.TARGET} From owner-svn-src-head@freebsd.org Thu Nov 17 18:15:23 2016 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 BB4D1C47236; Thu, 17 Nov 2016 18:15:23 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk0-x22d.google.com (mail-qk0-x22d.google.com [IPv6:2607:f8b0:400d: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 729517DA; Thu, 17 Nov 2016 18:15:23 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk0-x22d.google.com with SMTP id x190so232160279qkb.0; Thu, 17 Nov 2016 10:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=eEZSxBBgEZ7k4yWVfgMek5Oi8lhDM9ItsXBzceOqoAU=; b=PCxMqB1SYKPuEjS1fCaDuOtQkqNXbBmppnV01TgMzgZNz1Agip5iwm1xpgqDUakiuE wHFqJyC8mStpRPqPeS8MG8GL5Zb8OpZcjDiIlhIwqv4BwPHLzneErmVbnm9v8BYVxmdL WWgqq9f6/M8Qc0hcEjTNorWKnoCskna0ov9MsjIfxWn5iitDsNdjKtSbjATIo5lgtFHQ iGMKktqS28UuEmfRbv4HtUYnOGT9uSSuipYAABqwG9nFsm/WDqscMo1RCCQWBQulweP6 +4ZoG/sfvqtyNj+5s6wEowOpVvNLPRldaoF3sdqmDfNmMi9Q/hjmveyMRYNpmZEWUvn3 hAug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=eEZSxBBgEZ7k4yWVfgMek5Oi8lhDM9ItsXBzceOqoAU=; b=Hn5NgvxJOHnbpyfRZ9hEKfvQQmfTWcSR9fsnKdQ0IueEAhHj+V3O4WaufZSZ3QHd9I ZpWgYRja/p/5/UKdk6Ge598fTDYf+ER7JhjOJEp4uy8gPiBX7KyjhQ8Stj+yx9bqL775 aUzeRKPHBtyYDsrQVfu72IfGOmcYT7m0nOlHW5XzVuGYlgADGHcY/l5kTZQ5XRqP8uAv B6XcvyQrX3I1Zwn2e0ZaH5PGaxdDdZ2TFNAjC/uo3UkuaG82n1SE8orMw+LF5+BDda5y BNJQz283B1J5t/y4hrGNEzW45Od3tIhc9HVUr43nWUn3hHlUo4L+ZpSkMH29t31Apnz0 WgeQ== X-Gm-Message-State: AKaTC01gpXOJo8BIRDG40me16sQ/IX+yrRQWUvZcR2ga5QsfDseypRjQzFO6TwVxpIwHZg== X-Received: by 10.55.88.197 with SMTP id m188mr4698693qkb.322.1479406522332; Thu, 17 Nov 2016 10:15:22 -0800 (PST) Received: from wkstn-mjohnston.west.isilon.com (c-76-104-201-218.hsd1.wa.comcast.net. [76.104.201.218]) by smtp.gmail.com with ESMTPSA id p28sm2026779qtb.31.2016.11.17.10.15.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Nov 2016 10:15:21 -0800 (PST) Sender: Mark Johnston Date: Thu, 17 Nov 2016 10:21:05 -0800 From: Mark Johnston To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r308582 - in head: cddl/contrib/opensolaris/lib/libdtrace/common sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/contrib/opensolaris/uts/common/sys Message-ID: <20161117182105.GB90879@wkstn-mjohnston.west.isilon.com> References: <201611121926.uACJQDsu078946@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) 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, 17 Nov 2016 18:15:23 -0000 On Thu, Nov 17, 2016 at 11:35:35AM -0500, Ed Maste wrote: > On 12 November 2016 at 14:26, Mark Johnston wrote: > > Author: markj > > Date: Sat Nov 12 19:26:12 2016 > > New Revision: 308582 > > URL: https://svnweb.freebsd.org/changeset/base/308582 > > > > Log: > > Remove the DTrace printt and typeref actions. > > It looks like we have a missing dependency here, as a non-clean build > fails with: > > dt_names.c:62:7: error: use of undeclared identifier 'DIF_SUBR_TYPEREF' > case DIF_SUBR_TYPEREF: return ("typeref"); > ^ This should be fixed by r308773. From owner-svn-src-head@freebsd.org Thu Nov 17 18:36:46 2016 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 5C4F0C476C3; Thu, 17 Nov 2016 18:36:46 +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 31CD21296; Thu, 17 Nov 2016 18:36:46 +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 61DD810A727; Thu, 17 Nov 2016 13:36:44 -0500 (EST) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308773 - head/cddl/lib/libdtrace Date: Thu, 17 Nov 2016 10:31:44 -0800 Message-ID: <3173873.oWmXpZdma6@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201611171813.uAHIDgXE044927@repo.freebsd.org> References: <201611171813.uAHIDgXE044927@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); Thu, 17 Nov 2016 13:36:44 -0500 (EST) 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: Thu, 17 Nov 2016 18:36:46 -0000 On Thursday, November 17, 2016 06:13:42 PM Mark Johnston wrote: > Author: markj > Date: Thu Nov 17 18:13:42 2016 > New Revision: 308773 > URL: https://svnweb.freebsd.org/changeset/base/308773 > > Log: > Define dependencies for some auto-generated source files in libdtrace. > > Remove an unneeded beforedepend rule. > > Reported by: emaste, jhb > Reviewed by: bdrewery > MFC after: 1 week Thanks. I guess moving the .include fixed the issue I ran into previously when I tried this. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Nov 17 18:38:37 2016 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 25198C47727; Thu, 17 Nov 2016 18:38:37 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EAF1D1660; Thu, 17 Nov 2016 18:38:36 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAHIcaO6053106; Thu, 17 Nov 2016 18:38:36 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHIcam6053105; Thu, 17 Nov 2016 18:38:36 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201611171838.uAHIcam6053105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 17 Nov 2016 18:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308774 - head/sys/boot/mips/beri/loader X-SVN-Group: head 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, 17 Nov 2016 18:38:37 -0000 Author: tsoome Date: Thu Nov 17 18:38:35 2016 New Revision: 308774 URL: https://svnweb.freebsd.org/changeset/base/308774 Log: loader: beri_sdcard_disk_print() needs to return int. The https://reviews.freebsd.org/rS308434 did change the return type for dv_print callbacks, but the return type for beri_sdcard_disk_print() was left unchanged, causing compile errors. Reported by: cy Reviewed by: brooks, rstone, allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8515 Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c ============================================================================== --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Thu Nov 17 18:13:42 2016 (r308773) +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Thu Nov 17 18:38:35 2016 (r308774) @@ -118,7 +118,7 @@ beri_sdcard_disk_close(struct open_file return (disk_close(dev)); } -static void +static int beri_sdcard_disk_print(int verbose) { struct disk_devdesc dev; From owner-svn-src-head@freebsd.org Thu Nov 17 19:02:26 2016 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 573B9C47E7A; Thu, 17 Nov 2016 19:02:26 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21CBF87D; Thu, 17 Nov 2016 19:02:26 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAHJ2P8D064737; Thu, 17 Nov 2016 19:02:25 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHJ2PJw064736; Thu, 17 Nov 2016 19:02:25 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201611171902.uAHJ2PJw064736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 17 Nov 2016 19:02:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308775 - head/sbin/etherswitchcfg X-SVN-Group: head 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, 17 Nov 2016 19:02:26 -0000 Author: loos Date: Thu Nov 17 19:02:25 2016 New Revision: 308775 URL: https://svnweb.freebsd.org/changeset/base/308775 Log: Zero etherswitch_vlangroup structure before doing partial assignments. MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sbin/etherswitchcfg/etherswitchcfg.c Modified: head/sbin/etherswitchcfg/etherswitchcfg.c ============================================================================== --- head/sbin/etherswitchcfg/etherswitchcfg.c Thu Nov 17 18:38:35 2016 (r308774) +++ head/sbin/etherswitchcfg/etherswitchcfg.c Thu Nov 17 19:02:25 2016 (r308775) @@ -308,7 +308,8 @@ set_vlangroup_vid(struct cfg *cfg, char { int v; etherswitch_vlangroup_t vg; - + + memset(&vg, 0, sizeof(vg)); v = strtol(argv[1], NULL, 0); if (v < 0 || v > IEEE802DOT1Q_VID_MAX) errx(EX_USAGE, "vlan must be between 0 and %d", IEEE802DOT1Q_VID_MAX); @@ -327,8 +328,9 @@ set_vlangroup_members(struct cfg *cfg, c int member, untagged; char *c, *d; int v; - + member = untagged = 0; + memset(&vg, 0, sizeof(vg)); if (strcmp(argv[1], "none") != 0) { for (c=argv[1]; *c; c=d) { v = strtol(c, &d, 0); From owner-svn-src-head@freebsd.org Thu Nov 17 19:23:45 2016 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 11376C4757E; Thu, 17 Nov 2016 19:23:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2E34151B; Thu, 17 Nov 2016 19:23:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::1d64:fe7e:bf43:65ca] (unknown [IPv6:2001:7b8:3a7:0:1d64:fe7e:bf43:65ca]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id D7A79F5D8; Thu, 17 Nov 2016 20:23:40 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_298B0D63-2035-422A-B34B-C42275DE7318"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r308664 - in head: contrib/hyperv/tools etc/devd etc/mtree include share/man/man4 sys/conf sys/dev/hyperv/utilities sys/modules/hyperv/utilities usr.sbin/hyperv usr.sbin/hyperv/tools us... From: Dimitry Andric In-Reply-To: Date: Thu, 17 Nov 2016 20:23:28 +0100 Cc: Mark Johnston , Sepherosa Ziehau , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-Id: References: <201611150236.uAF2aCV8015106@repo.freebsd.org> <20161116221440.GA83880@wkstn-mjohnston.west.isilon.com> To: Ngie Cooper 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: Thu, 17 Nov 2016 19:23:45 -0000 --Apple-Mail=_298B0D63-2035-422A-B34B-C42275DE7318 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 17 Nov 2016, at 01:31, Ngie Cooper wrote: > > On Wed, Nov 16, 2016 at 2:14 PM, Mark Johnston wrote: > ... >> This appears to install hv_kvp_daemon and hv_vss_daemon to / instead of >> /usr/sbin, and breaks the -DNO_ROOT build. I think a Makefile.inc is >> needed in usr.sbin/hyperv/tools in order to preserve BINDIR from >> usr.sbin/Makefile.inc. I fixed the problem in my tree with the diff >> below, but am not sure if this is the right way to do it. For some >> reason, doing this resulted in unused var warnings compiling >> hv_vss_daemon.c. > > The -Wunused warnings you're seeing are because you're now it's > setting WARNS by .include'ing usr.bin/Makefile.inc ; it used to be set > (I verified that), but then got unset between a few weeks ago and now > on the directory: > > $ make -V.CURDIR -VWARNS > /usr/src/usr.sbin/hyperv/tools > > $ > > Cheers, > -Ngie > > PS -Wno-uninitialized is only set for gcc...? Really...??? Yes, because base gcc has produced many false positives with its -Wuninitialized warnings. In fact, I would suggest that is globally turned off for any gcc version before 4.7. -Dimitry --Apple-Mail=_298B0D63-2035-422A-B34B-C42275DE7318 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----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAlguA78ACgkQsF6jCi4glqPt9ACg4ZUbfFmnLfKJechINmWtv+e6 UNgAoLcZU5VebYLSWZpenkyjaz4ED7fm =wfLC -----END PGP SIGNATURE----- --Apple-Mail=_298B0D63-2035-422A-B34B-C42275DE7318-- From owner-svn-src-head@freebsd.org Thu Nov 17 19:38:32 2016 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 21867C478FB; Thu, 17 Nov 2016 19:38:32 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E14C41C50; Thu, 17 Nov 2016 19:38:31 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAHJcVfr076704; Thu, 17 Nov 2016 19:38:31 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHJcVIe076703; Thu, 17 Nov 2016 19:38:31 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201611171938.uAHJcVIe076703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 17 Nov 2016 19:38:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308776 - head/sys/boot/zfs X-SVN-Group: head 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, 17 Nov 2016 19:38:32 -0000 Author: tsoome Date: Thu Nov 17 19:38:30 2016 New Revision: 308776 URL: https://svnweb.freebsd.org/changeset/base/308776 Log: loader: zfs toplevel vdev must have spa set. The salt based checksum mechanisms, such as skein, are storing the seed in spa structure, and need to access the spa to use the seed. The current mechanism for quick access to correct spa is via pointer provided by vdev structure, but unfortunately the current code does set spa only for the leaf vdev. This patch will fix the issue by making sure the loader zfs reader will set spa also for top-level vdevs. PR: 214375 Reported by: lstewart Reviewed by: allanjude, imp Approved by: allanjude (mentor), imp (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D8487 Modified: head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Thu Nov 17 19:02:25 2016 (r308775) +++ head/sys/boot/zfs/zfsimpl.c Thu Nov 17 19:38:30 2016 (r308776) @@ -1049,8 +1049,10 @@ vdev_probe(vdev_phys_read_t *read, void STAILQ_FOREACH(pool_vdev, &spa->spa_vdevs, v_childlink) if (top_vdev == pool_vdev) break; - if (!pool_vdev && top_vdev) + if (!pool_vdev && top_vdev) { + top_vdev->spa = spa; STAILQ_INSERT_TAIL(&spa->spa_vdevs, top_vdev, v_childlink); + } /* * We should already have created an incomplete vdev for this From owner-svn-src-head@freebsd.org Thu Nov 17 20:00:22 2016 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 21C38C47EC6; Thu, 17 Nov 2016 20:00:22 +0000 (UTC) (envelope-from ivadasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D50DBD15; Thu, 17 Nov 2016 20:00:21 +0000 (UTC) (envelope-from ivadasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAHK0K9B084673; Thu, 17 Nov 2016 20:00:20 GMT (envelope-from ivadasz@FreeBSD.org) Received: (from ivadasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHK0KPS084672; Thu, 17 Nov 2016 20:00:20 GMT (envelope-from ivadasz@FreeBSD.org) Message-Id: <201611172000.uAHK0KPS084672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ivadasz set sender to ivadasz@FreeBSD.org using -f From: =?UTF-8?Q?Imre_Vad=c3=a1sz?= Date: Thu, 17 Nov 2016 20:00:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308777 - head/sys/dev/iwm X-SVN-Group: head 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, 17 Nov 2016 20:00:22 -0000 Author: ivadasz Date: Thu Nov 17 20:00:20 2016 New Revision: 308777 URL: https://svnweb.freebsd.org/changeset/base/308777 Log: [iwm] Sync iwm_nvm_read_chunk() function with Linux iwlwifi. This fixes an error handling detail in iwm_nvm_read_chunk(), where an error response from the firmware for an NVM read shouldn't be fatal if the offset was non-zero. Approved by: adrian (mentor) Obtained from: DragonFlyBSD git 250a1c33fca1725121fe499f9cebc90267d209f9 Differential Revision: https://reviews.freebsd.org/D8542 Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 17 19:38:30 2016 (r308776) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 17 20:00:20 2016 (r308777) @@ -1666,8 +1666,10 @@ const int nvm_to_read[] = { #define IWM_NVM_READ_OPCODE 0 /* load nvm chunk response */ -#define IWM_READ_NVM_CHUNK_SUCCEED 0 -#define IWM_READ_NVM_CHUNK_INVALID_ADDRESS 1 +enum { + IWM_READ_NVM_CHUNK_SUCCEED = 0, + IWM_READ_NVM_CHUNK_NOT_VALID_ADDRESS = 1 +}; static int iwm_nvm_read_chunk(struct iwm_softc *sc, uint16_t section, @@ -1684,12 +1686,10 @@ iwm_nvm_read_chunk(struct iwm_softc *sc, struct iwm_rx_packet *pkt; struct iwm_host_cmd cmd = { .id = IWM_NVM_ACCESS_CMD, - .flags = IWM_CMD_SYNC | IWM_CMD_WANT_SKB | - IWM_CMD_SEND_IN_RFKILL, + .flags = IWM_CMD_WANT_SKB | IWM_CMD_SEND_IN_RFKILL, .data = { &nvm_access_cmd, }, }; - int ret, offset_read; - size_t bytes_read; + int ret, bytes_read, offset_read; uint8_t *resp_data; cmd.len[0] = sizeof(struct iwm_nvm_access_cmd); @@ -1718,9 +1718,26 @@ iwm_nvm_read_chunk(struct iwm_softc *sc, offset_read = le16toh(nvm_resp->offset); resp_data = nvm_resp->data; if (ret) { - IWM_DPRINTF(sc, IWM_DEBUG_RESET, - "NVM access command failed with status %d\n", ret); - ret = EINVAL; + if ((offset != 0) && + (ret == IWM_READ_NVM_CHUNK_NOT_VALID_ADDRESS)) { + /* + * meaning of NOT_VALID_ADDRESS: + * driver try to read chunk from address that is + * multiple of 2K and got an error since addr is empty. + * meaning of (offset != 0): driver already + * read valid data from another chunk so this case + * is not an error. + */ + IWM_DPRINTF(sc, IWM_DEBUG_EEPROM | IWM_DEBUG_RESET, + "NVM access command failed on offset 0x%x since that section size is multiple 2K\n", + offset); + *len = 0; + ret = 0; + } else { + IWM_DPRINTF(sc, IWM_DEBUG_EEPROM | IWM_DEBUG_RESET, + "NVM access command failed with status %d\n", ret); + ret = EIO; + } goto exit; } @@ -1735,7 +1752,7 @@ iwm_nvm_read_chunk(struct iwm_softc *sc, if (bytes_read > length) { device_printf(sc->sc_dev, "NVM ACCESS response with too much data " - "(%d bytes requested, %zd bytes received)\n", + "(%d bytes requested, %d bytes received)\n", length, bytes_read); ret = EINVAL; goto exit; From owner-svn-src-head@freebsd.org Thu Nov 17 20:32:33 2016 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 41C27C4778D; Thu, 17 Nov 2016 20:32:33 +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 1EA281DF2; Thu, 17 Nov 2016 20:32:33 +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 uAHKWWNw000440; Thu, 17 Nov 2016 20:32:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHKWWcT000439; Thu, 17 Nov 2016 20:32:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201611172032.uAHKWWcT000439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 17 Nov 2016 20:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308778 - head/sys/vm X-SVN-Group: head 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, 17 Nov 2016 20:32:33 -0000 Author: glebius Date: Thu Nov 17 20:32:32 2016 New Revision: 308778 URL: https://svnweb.freebsd.org/changeset/base/308778 Log: - If caller specifies readbehind and readahead that together with count doesn't fit into a buf, then trim readbehind and readahead evenly. If rbehind was limited by the previous BMAP, then roundup its trim to block size. - Add KASSERT to check that b_blkno has proper offset from original blkno returned by BMAP. [1] - Add KASSERT to check that pages in buf are consecutive. Reviewed by: kib Submitted by: kib [1] Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Thu Nov 17 20:00:20 2016 (r308777) +++ head/sys/vm/vnode_pager.c Thu Nov 17 20:32:32 2016 (r308778) @@ -743,6 +743,9 @@ vnode_pager_generic_getpages(struct vnod struct bufobj *bo; struct buf *bp; off_t foff; +#ifdef INVARIANTS + off_t blkno0; +#endif int bsize, pagesperblock, *freecnt; int error, before, after, rbehind, rahead, poff, i; int bytecount, secmask; @@ -843,6 +846,9 @@ vnode_pager_generic_getpages(struct vnod return (VM_PAGER_OK); } +#ifdef INVARIANTS + blkno0 = bp->b_blkno; +#endif bp->b_blkno += (foff % bsize) / DEV_BSIZE; /* Recalculate blocks available after/before to pages. */ @@ -864,7 +870,25 @@ vnode_pager_generic_getpages(struct vnod rbehind = min(rbehind, m[0]->pindex); rahead = min(rahead, after); rahead = min(rahead, object->size - m[count - 1]->pindex); - KASSERT(rbehind + rahead + count <= sizeof(bp->b_pages), + /* + * Check that total amount of pages fit into buf. Trim rbehind and + * rahead evenly if not. + */ + if (rbehind + rahead + count > nitems(bp->b_pages)) { + int trim, sum; + + trim = rbehind + rahead + count - nitems(bp->b_pages) + 1; + sum = rbehind + rahead; + if (rbehind == before) { + /* Roundup rbehind trim to block size. */ + rbehind -= roundup(trim * rbehind / sum, pagesperblock); + if (rbehind < 0) + rbehind = 0; + } else + rbehind -= trim * rbehind / sum; + rahead -= trim * rahead / sum; + } + KASSERT(rbehind + rahead + count <= nitems(bp->b_pages), ("%s: behind %d ahead %d count %d", __func__, rbehind, rahead, count)); @@ -947,8 +971,14 @@ vnode_pager_generic_getpages(struct vnod if (a_rahead) *a_rahead = bp->b_pgafter; +#ifdef INVARIANTS KASSERT(bp->b_npages <= nitems(bp->b_pages), ("%s: buf %p overflowed", __func__, bp)); + for (int j = 1; j < bp->b_npages; j++) + KASSERT(bp->b_pages[j]->pindex - 1 == + bp->b_pages[j - 1]->pindex, + ("%s: pages array not consecutive, bp %p", __func__, bp)); +#endif /* * Recalculate first offset and bytecount with regards to read behind. @@ -987,6 +1017,13 @@ vnode_pager_generic_getpages(struct vnod bp->b_vp = vp; bp->b_bcount = bp->b_bufsize = bp->b_runningbufspace = bytecount; bp->b_iooffset = dbtob(bp->b_blkno); + KASSERT(IDX_TO_OFF(m[0]->pindex - bp->b_pages[0]->pindex) == + (blkno0 - bp->b_blkno) * DEV_BSIZE + + IDX_TO_OFF(m[0]->pindex) % bsize, + ("wrong offsets bsize %d m[0] %ju b_pages[0] %ju " + "blkno0 %ju b_blkno %ju", bsize, + (uintmax_t)m[0]->pindex, (uintmax_t)bp->b_pages[0]->pindex, + (uintmax_t)blkno0, (uintmax_t)bp->b_blkno)); atomic_add_long(&runningbufspace, bp->b_runningbufspace); PCPU_INC(cnt.v_vnodein); From owner-svn-src-head@freebsd.org Thu Nov 17 20:34:09 2016 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 B7545C478A4; Thu, 17 Nov 2016 20:34:09 +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 8906E15F; Thu, 17 Nov 2016 20:34:09 +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 uAHKY8JV000567; Thu, 17 Nov 2016 20:34:08 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHKY8EC000566; Thu, 17 Nov 2016 20:34:08 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201611172034.uAHKY8EC000566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 17 Nov 2016 20:34:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308779 - head/release X-SVN-Group: head 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, 17 Nov 2016 20:34:09 -0000 Author: gjb Date: Thu Nov 17 20:34:08 2016 New Revision: 308779 URL: https://svnweb.freebsd.org/changeset/base/308779 Log: Pass SWAPSIZE in env(1) when invoking mk-vmimage.sh for the vm-image target, missed in r308737. Sponsored by: The FreeBSD Foundation Modified: head/release/Makefile.vm Modified: head/release/Makefile.vm ============================================================================== --- head/release/Makefile.vm Thu Nov 17 20:32:32 2016 (r308778) +++ head/release/Makefile.vm Thu Nov 17 20:34:08 2016 (r308779) @@ -89,7 +89,7 @@ vm-image: .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) . for FORMAT in ${VMFORMATS} mkdir -p ${.OBJDIR}/${.TARGET} - env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ + env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} SWAPSIZE=${SWAPSIZE} \ ${.CURDIR}/scripts/mk-vmimage.sh \ -C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \ -i ${.OBJDIR}/${FORMAT}.img -s ${VMSIZE} -f ${FORMAT} \ From owner-svn-src-head@freebsd.org Thu Nov 17 20:42:57 2016 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 9D443C47BCC; Thu, 17 Nov 2016 20:42:57 +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 69C0193C; Thu, 17 Nov 2016 20:42:57 +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 uAHKguNi004328; Thu, 17 Nov 2016 20:42:56 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHKgubI004327; Thu, 17 Nov 2016 20:42:56 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201611172042.uAHKgubI004327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 17 Nov 2016 20:42:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308780 - head/sys/cam/scsi X-SVN-Group: head 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, 17 Nov 2016 20:42:57 -0000 Author: asomers Date: Thu Nov 17 20:42:56 2016 New Revision: 308780 URL: https://svnweb.freebsd.org/changeset/base/308780 Log: Fix "camcontrol rescan" with SATA drives behind a SAS controller A bug in CAM's serial number hash logic resulted in SATA drives behind a SAS controller getting removed and readded anytime the drive was rescanned for any reason. PR: 212914 Submitted by: kadesai Reported by: kadesai Reviewed by: asomers, ken MFC after: 4 weeks Sponsored by: Spectra Logic Corp Modified: head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/scsi/scsi_xpt.c ============================================================================== --- head/sys/cam/scsi/scsi_xpt.c Thu Nov 17 20:34:08 2016 (r308779) +++ head/sys/cam/scsi/scsi_xpt.c Thu Nov 17 20:42:56 2016 (r308780) @@ -1626,8 +1626,8 @@ probe_device_check: sizeof(struct scsi_inquiry_data)); if (have_serialnum) - MD5Update(&context, serial_buf->serial_num, - serial_buf->length); + MD5Update(&context, path->device->serial_num, + path->device->serial_num_len); MD5Final(digest, &context); if (bcmp(softc->digest, digest, 16) == 0) From owner-svn-src-head@freebsd.org Thu Nov 17 20:44:53 2016 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 497EAC47C51; Thu, 17 Nov 2016 20:44:53 +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 F0B1EAEA; Thu, 17 Nov 2016 20:44:52 +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 uAHKiqfu004485; Thu, 17 Nov 2016 20:44:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHKiqWs004484; Thu, 17 Nov 2016 20:44:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611172044.uAHKiqWs004484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 17 Nov 2016 20:44:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308781 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head 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, 17 Nov 2016 20:44:53 -0000 Author: mav Date: Thu Nov 17 20:44:51 2016 New Revision: 308781 URL: https://svnweb.freebsd.org/changeset/base/308781 Log: Revert r307392: I've found a way to avoid big allocations completely. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 20:42:56 2016 (r308780) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 20:44:51 2016 (r308781) @@ -1142,11 +1142,6 @@ zil_itx_create(uint64_t txtype, size_t l lrsize = P2ROUNDUP_TYPED(lrsize, sizeof (uint64_t), size_t); -#ifdef __FreeBSD__ - if (offsetof(itx_t, itx_lr) + lrsize > PAGE_SIZE) - itx = zio_buf_alloc(offsetof(itx_t, itx_lr) + lrsize); - else -#endif itx = kmem_alloc(offsetof(itx_t, itx_lr) + lrsize, KM_SLEEP); itx->itx_lr.lrc_txtype = txtype; itx->itx_lr.lrc_reclen = lrsize; @@ -1160,11 +1155,6 @@ zil_itx_create(uint64_t txtype, size_t l void zil_itx_destroy(itx_t *itx) { -#ifdef __FreeBSD__ - if (offsetof(itx_t, itx_lr) + itx->itx_lr.lrc_reclen > PAGE_SIZE) - zio_buf_free(itx, offsetof(itx_t, itx_lr) + itx->itx_lr.lrc_reclen); - else -#endif kmem_free(itx, offsetof(itx_t, itx_lr) + itx->itx_lr.lrc_reclen); } @@ -1184,7 +1174,8 @@ zil_itxg_clean(itxs_t *itxs) list = &itxs->i_sync_list; while ((itx = list_head(list)) != NULL) { list_remove(list, itx); - zil_itx_destroy(itx); + kmem_free(itx, offsetof(itx_t, itx_lr) + + itx->itx_lr.lrc_reclen); } cookie = NULL; @@ -1193,7 +1184,8 @@ zil_itxg_clean(itxs_t *itxs) list = &ian->ia_list; while ((itx = list_head(list)) != NULL) { list_remove(list, itx); - zil_itx_destroy(itx); + kmem_free(itx, offsetof(itx_t, itx_lr) + + itx->itx_lr.lrc_reclen); } list_destroy(list); kmem_free(ian, sizeof (itx_async_node_t)); @@ -1258,7 +1250,8 @@ zil_remove_async(zilog_t *zilog, uint64_ } while ((itx = list_head(&clean_list)) != NULL) { list_remove(&clean_list, itx); - zil_itx_destroy(itx); + kmem_free(itx, offsetof(itx_t, itx_lr) + + itx->itx_lr.lrc_reclen); } list_destroy(&clean_list); } @@ -1508,7 +1501,8 @@ zil_commit_writer(zilog_t *zilog) if (txg > spa_last_synced_txg(spa) || txg > spa_freeze_txg(spa)) lwb = zil_lwb_commit(zilog, itx, lwb); list_remove(&zilog->zl_itx_commit_list, itx); - zil_itx_destroy(itx); + kmem_free(itx, offsetof(itx_t, itx_lr) + + itx->itx_lr.lrc_reclen); } DTRACE_PROBE1(zil__cw2, zilog_t *, zilog); From owner-svn-src-head@freebsd.org Thu Nov 17 21:01:29 2016 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 2C217C47EE4; Thu, 17 Nov 2016 21:01:29 +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 E697F10B6; Thu, 17 Nov 2016 21:01:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAHL1STb009879; Thu, 17 Nov 2016 21:01:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHL1R2O009871; Thu, 17 Nov 2016 21:01:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611172101.uAHL1R2O009871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 17 Nov 2016 21:01:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308782 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head 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, 17 Nov 2016 21:01:29 -0000 Author: mav Date: Thu Nov 17 21:01:27 2016 New Revision: 308782 URL: https://svnweb.freebsd.org/changeset/base/308782 Log: After some ZIL changes 6 years ago zil_slog_limit got partially broken due to zl_itx_list_sz not updated when async itx'es upgraded to sync. Actually because of other changes about that time zl_itx_list_sz is not really required to implement the functionality, so this patch removes some unneeded broken code and variables. Original idea of zil_slog_limit was to reduce chance of SLOG abuse by single heavy logger, that increased latency for other (more latency critical) loggers, by pushing heavy log out into the main pool instead of SLOG. Beside huge latency increase for heavy writers, this implementation caused double write of all data, since the log records were explicitly prepared for SLOG. Since we now have I/O scheduler, I've found it can be much more efficient to reduce priority of heavy logger SLOG writes from ZIO_PRIORITY_SYNC_WRITE to ZIO_PRIORITY_ASYNC_WRITE, while still leave them on SLOG. Existing ZIL implementation had problem with space efficiency when it has to write large chunks of data into log blocks of limited size. In some cases efficiency stopped to almost as low as 50%. In case of ZIL stored on spinning rust, that also reduced log write speed in half, since head had to uselessly fly over allocated but not written areas. This change improves the situation by offloading problematic operations from z*_log_write() to zil_lwb_commit(), which knows real situation of log blocks allocation and can split large requests into pieces much more efficiently. Also as side effect it removes one of two data copy operations done by ZIL code WR_COPIED case. While there, untangle and unify code of z*_log_write() functions. Also zfs_log_write() alike to zvol_log_write() can now handle writes crossing block boundary, that may also improve efficiency if ZPL is made to do that. Sponsored by: iXsystems, Inc. Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Nov 17 20:44:51 2016 (r308781) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Nov 17 21:01:27 2016 (r308782) @@ -1371,7 +1371,6 @@ ztest_log_write(ztest_ds_t *zd, dmu_tx_t itx->itx_private = zd; itx->itx_wr_state = write_state; itx->itx_sync = (ztest_random(8) == 0); - itx->itx_sod += (write_state == WR_NEED_COPY ? lr->lr_length : 0); bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, sizeof (*lr) - sizeof (lr_t)); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Nov 17 20:44:51 2016 (r308781) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Nov 17 21:01:27 2016 (r308782) @@ -369,7 +369,6 @@ typedef struct itx { void *itx_private; /* type-specific opaque data */ itx_wr_state_t itx_wr_state; /* write state */ uint8_t itx_sync; /* synchronous transaction */ - uint64_t itx_sod; /* record size on disk */ uint64_t itx_oid; /* object id */ lr_t itx_lr; /* common part of log record */ /* followed by type-specific part of lr_xx_t and its immediate data */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Nov 17 20:44:51 2016 (r308781) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Nov 17 21:01:27 2016 (r308782) @@ -42,6 +42,7 @@ extern "C" { typedef struct lwb { zilog_t *lwb_zilog; /* back pointer to log struct */ blkptr_t lwb_blk; /* on disk address of this log blk */ + boolean_t lwb_slog; /* lwb_blk is on SLOG device */ int lwb_nused; /* # used bytes in buffer */ int lwb_sz; /* size of block and buffer */ char *lwb_buf; /* log write buffer */ @@ -62,7 +63,6 @@ typedef struct itxs { typedef struct itxg { kmutex_t itxg_lock; /* lock for this structure */ uint64_t itxg_txg; /* txg for this chain */ - uint64_t itxg_sod; /* total size on disk for this txg */ itxs_t *itxg_itxs; /* sync and async itxs */ } itxg_t; @@ -120,7 +120,6 @@ struct zilog { kcondvar_t zl_cv_batch[2]; /* batch condition variables */ itxg_t zl_itxg[TXG_SIZE]; /* intent log txg chains */ list_t zl_itx_commit_list; /* itx list to be committed */ - uint64_t zl_itx_list_sz; /* total size of records on list */ uint64_t zl_cur_used; /* current commit log size used */ list_t zl_lwb_list; /* in-flight log write list */ kmutex_t zl_vdev_lock; /* protects zl_vdev_tree */ @@ -142,6 +141,8 @@ typedef struct zil_bp_node { #define ZIL_MAX_LOG_DATA (SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t) - \ sizeof (lr_write_t)) +#define ZIL_MAX_COPIED_DATA \ + ((SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t)) / 2 - sizeof (lr_write_t)) #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Nov 17 20:44:51 2016 (r308781) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Nov 17 21:01:27 2016 (r308782) @@ -547,7 +547,7 @@ extern zio_t *zio_free_sync(zio_t *pio, const blkptr_t *bp, uint64_t size, enum zio_flag flags); extern int zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, - blkptr_t *old_bp, uint64_t size, boolean_t use_slog); + blkptr_t *old_bp, uint64_t size, boolean_t *slog); extern void zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp); extern void zio_flush(zio_t *zio, vdev_t *vd); extern zio_t *zio_trim(zio_t *zio, spa_t *spa, vdev_t *vd, uint64_t offset, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Thu Nov 17 20:44:51 2016 (r308781) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Thu Nov 17 21:01:27 2016 (r308782) @@ -464,20 +464,17 @@ void zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype, znode_t *zp, offset_t off, ssize_t resid, int ioflag) { + uint32_t blocksize = zp->z_blksz; itx_wr_state_t write_state; - boolean_t slogging; uintptr_t fsync_cnt; - ssize_t immediate_write_sz; if (zil_replaying(zilog, tx) || zp->z_unlinked) return; - immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) - ? 0 : zfs_immediate_write_sz; - - slogging = spa_has_slogs(zilog->zl_spa) && - (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); - if (resid > immediate_write_sz && !slogging && resid <= zp->z_blksz) + if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) + write_state = WR_INDIRECT; + else if (!spa_has_slogs(zilog->zl_spa) && + resid >= zfs_immediate_write_sz) write_state = WR_INDIRECT; else if (ioflag & (FSYNC | FDSYNC)) write_state = WR_COPIED; @@ -491,30 +488,26 @@ zfs_log_write(zilog_t *zilog, dmu_tx_t * while (resid) { itx_t *itx; lr_write_t *lr; - ssize_t len; + itx_wr_state_t wr_state = write_state; + ssize_t len = resid; - /* - * If the write would overflow the largest block then split it. - */ - if (write_state != WR_INDIRECT && resid > ZIL_MAX_LOG_DATA) - len = SPA_OLD_MAXBLOCKSIZE >> 1; - else - len = resid; + if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA) + wr_state = WR_NEED_COPY; + else if (wr_state == WR_INDIRECT) + len = MIN(blocksize - P2PHASE(off, blocksize), resid); itx = zil_itx_create(txtype, sizeof (*lr) + - (write_state == WR_COPIED ? len : 0)); + (wr_state == WR_COPIED ? len : 0)); lr = (lr_write_t *)&itx->itx_lr; - if (write_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os, + if (wr_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os, zp->z_id, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { zil_itx_destroy(itx); itx = zil_itx_create(txtype, sizeof (*lr)); lr = (lr_write_t *)&itx->itx_lr; - write_state = WR_NEED_COPY; + wr_state = WR_NEED_COPY; } - itx->itx_wr_state = write_state; - if (write_state == WR_NEED_COPY) - itx->itx_sod += len; + itx->itx_wr_state = wr_state; lr->lr_foid = zp->z_id; lr->lr_offset = off; lr->lr_length = len; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 20:44:51 2016 (r308781) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 21:01:27 2016 (r308782) @@ -88,6 +88,15 @@ SYSCTL_DECL(_vfs_zfs_trim); SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enabled, CTLFLAG_RDTUN, &zfs_trim_enabled, 0, "Enable ZFS TRIM"); +/* + * Limit SLOG write size per commit executed with synchronous priority. + * Any writes above that executed with lower (asynchronous) priority to + * limit potential SLOG device abuse by single active ZIL writer. + */ +uint64_t zil_slog_limit = 768 * 1024; +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, + &zil_slog_limit, 0, "Maximal SLOG commit size with sync priority"); + static kmem_cache_t *zil_lwb_cache; #define LWB_EMPTY(lwb) ((BP_GET_LSIZE(&lwb->lwb_blk) - \ @@ -447,13 +456,14 @@ zil_free_log_record(zilog_t *zilog, lr_t } static lwb_t * -zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, uint64_t txg) +zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t slog, uint64_t txg) { lwb_t *lwb; lwb = kmem_cache_alloc(zil_lwb_cache, KM_SLEEP); lwb->lwb_zilog = zilog; lwb->lwb_blk = *bp; + lwb->lwb_slog = slog; lwb->lwb_buf = zio_buf_alloc(BP_GET_LSIZE(bp)); lwb->lwb_max_txg = txg; lwb->lwb_zio = NULL; @@ -516,6 +526,7 @@ zil_create(zilog_t *zilog) dmu_tx_t *tx = NULL; blkptr_t blk; int error = 0; + boolean_t slog = FALSE; /* * Wait for any previous destroy to complete. @@ -544,7 +555,7 @@ zil_create(zilog_t *zilog) } error = zio_alloc_zil(zilog->zl_spa, txg, &blk, NULL, - ZIL_MIN_BLKSZ, zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); + ZIL_MIN_BLKSZ, &slog); if (error == 0) zil_init_log_chain(zilog, &blk); @@ -554,7 +565,7 @@ zil_create(zilog_t *zilog) * Allocate a log write buffer (lwb) for the first log block. */ if (error == 0) - lwb = zil_alloc_lwb(zilog, &blk, txg); + lwb = zil_alloc_lwb(zilog, &blk, slog, txg); /* * If we just allocated the first log block, commit our transaction @@ -885,6 +896,7 @@ static void zil_lwb_write_init(zilog_t *zilog, lwb_t *lwb) { zbookmark_phys_t zb; + zio_priority_t prio; SET_BOOKMARK(&zb, lwb->lwb_blk.blk_cksum.zc_word[ZIL_ZC_OBJSET], ZB_ZIL_OBJECT, ZB_ZIL_LEVEL, @@ -895,9 +907,13 @@ zil_lwb_write_init(zilog_t *zilog, lwb_t ZIO_FLAG_CANFAIL); } if (lwb->lwb_zio == NULL) { + if (zilog->zl_cur_used <= zil_slog_limit || !lwb->lwb_slog) + prio = ZIO_PRIORITY_SYNC_WRITE; + else + prio = ZIO_PRIORITY_ASYNC_WRITE; lwb->lwb_zio = zio_rewrite(zilog->zl_root_zio, zilog->zl_spa, 0, &lwb->lwb_blk, lwb->lwb_buf, BP_GET_LSIZE(&lwb->lwb_blk), - zil_lwb_write_done, lwb, ZIO_PRIORITY_SYNC_WRITE, + zil_lwb_write_done, lwb, prio, ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE, &zb); } } @@ -917,18 +933,6 @@ uint64_t zil_block_buckets[] = { }; /* - * Use the slog as long as the logbias is 'latency' and the current commit size - * is less than the limit or the total list size is less than 2X the limit. - * Limit checking is disabled by setting zil_slog_limit to UINT64_MAX. - */ -uint64_t zil_slog_limit = 1024 * 1024; -SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, - &zil_slog_limit, 0, "Maximal commit size to use SLOG"); -#define USE_SLOG(zilog) (((zilog)->zl_logbias == ZFS_LOGBIAS_LATENCY) && \ - (((zilog)->zl_cur_used < zil_slog_limit) || \ - ((zilog)->zl_itx_list_sz < (zil_slog_limit << 1)))) - -/* * Start a log block write and advance to the next log block. * Calls are serialized. */ @@ -943,6 +947,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ uint64_t txg; uint64_t zil_blksz, wsz; int i, error; + boolean_t slog; if (BP_GET_CHECKSUM(&lwb->lwb_blk) == ZIO_CHECKSUM_ZILOG2) { zilc = (zil_chain_t *)lwb->lwb_buf; @@ -999,8 +1004,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ BP_ZERO(bp); /* pass the old blkptr in order to spread log blocks across devs */ - error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, - USE_SLOG(zilog)); + error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, &slog); if (error == 0) { ASSERT3U(bp->blk_birth, ==, txg); bp->blk_cksum = lwb->lwb_blk.blk_cksum; @@ -1009,7 +1013,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ /* * Allocate a new log write buffer (lwb). */ - nlwb = zil_alloc_lwb(zilog, bp, txg); + nlwb = zil_alloc_lwb(zilog, bp, slog, txg); /* Record the block for later vdev flushing */ zil_add_block(zilog, &lwb->lwb_blk); @@ -1046,12 +1050,13 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ static lwb_t * zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) { - lr_t *lrc = &itx->itx_lr; /* common log record */ - lr_write_t *lrw = (lr_write_t *)lrc; + lr_t *lrcb, *lrc = &itx->itx_lr; /* common log record */ + lr_write_t *lrwb, *lrw = (lr_write_t *)lrc; char *lr_buf; uint64_t txg = lrc->lrc_txg; uint64_t reclen = lrc->lrc_reclen; uint64_t dlen = 0; + uint64_t dnow, lwb_sp; if (lwb == NULL) return (NULL); @@ -1068,25 +1073,30 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it zil_lwb_write_init(zilog, lwb); +cont: /* * If this record won't fit in the current log block, start a new one. + * For WR_NEED_COPY optimize layout for minimal number of chunks, but + * try to keep wasted space withing reasonable range (12%). */ - if (lwb->lwb_nused + reclen + dlen > lwb->lwb_sz) { + lwb_sp = lwb->lwb_sz - lwb->lwb_nused; + if (reclen > lwb_sp || (reclen + dlen > lwb_sp && + lwb_sp < ZIL_MAX_LOG_DATA / 8 && (dlen % ZIL_MAX_LOG_DATA == 0 || + lwb_sp < reclen + dlen % ZIL_MAX_LOG_DATA))) { lwb = zil_lwb_write_start(zilog, lwb); if (lwb == NULL) return (NULL); zil_lwb_write_init(zilog, lwb); ASSERT(LWB_EMPTY(lwb)); - if (lwb->lwb_nused + reclen + dlen > lwb->lwb_sz) { - txg_wait_synced(zilog->zl_dmu_pool, txg); - return (lwb); - } + lwb_sp = lwb->lwb_sz - lwb->lwb_nused; + ASSERT3U(reclen + MIN(dlen, sizeof(uint64_t)), <=, lwb_sp); } + dnow = MIN(dlen, lwb_sp - reclen); lr_buf = lwb->lwb_buf + lwb->lwb_nused; bcopy(lrc, lr_buf, reclen); - lrc = (lr_t *)lr_buf; - lrw = (lr_write_t *)lrc; + lrcb = (lr_t *)lr_buf; + lrwb = (lr_write_t *)lrcb; /* * If it's a write, fetch the data or get its blkptr as appropriate. @@ -1098,16 +1108,19 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it char *dbuf; int error; - if (dlen) { - ASSERT(itx->itx_wr_state == WR_NEED_COPY); + if (itx->itx_wr_state == WR_NEED_COPY) { dbuf = lr_buf + reclen; - lrw->lr_common.lrc_reclen += dlen; + lrcb->lrc_reclen += dnow; + if (lrwb->lr_length > dnow) + lrwb->lr_length = dnow; + lrw->lr_offset += dnow; + lrw->lr_length -= dnow; } else { ASSERT(itx->itx_wr_state == WR_INDIRECT); dbuf = NULL; } error = zilog->zl_get_data( - itx->itx_private, lrw, dbuf, lwb->lwb_zio); + itx->itx_private, lrwb, dbuf, lwb->lwb_zio); if (error == EIO) { txg_wait_synced(zilog->zl_dmu_pool, txg); return (lwb); @@ -1126,12 +1139,18 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it * equal to the itx sequence number because not all transactions * are synchronous, and sometimes spa_sync() gets there first. */ - lrc->lrc_seq = ++zilog->zl_lr_seq; /* we are single threaded */ - lwb->lwb_nused += reclen + dlen; + lrcb->lrc_seq = ++zilog->zl_lr_seq; /* we are single threaded */ + lwb->lwb_nused += reclen + dnow; lwb->lwb_max_txg = MAX(lwb->lwb_max_txg, txg); ASSERT3U(lwb->lwb_nused, <=, lwb->lwb_sz); ASSERT0(P2PHASE(lwb->lwb_nused, sizeof (uint64_t))); + dlen -= dnow; + if (dlen > 0) { + zilog->zl_cur_used += reclen; + goto cont; + } + return (lwb); } @@ -1145,7 +1164,6 @@ zil_itx_create(uint64_t txtype, size_t l itx = kmem_alloc(offsetof(itx_t, itx_lr) + lrsize, KM_SLEEP); itx->itx_lr.lrc_txtype = txtype; itx->itx_lr.lrc_reclen = lrsize; - itx->itx_sod = lrsize; /* if write & WR_NEED_COPY will be increased */ itx->itx_lr.lrc_seq = 0; /* defensive */ itx->itx_sync = B_TRUE; /* default is synchronous */ @@ -1294,11 +1312,8 @@ zil_itx_assign(zilog_t *zilog, itx_t *it * this itxg. Save the itxs for release below. * This should be rare. */ - atomic_add_64(&zilog->zl_itx_list_sz, -itxg->itxg_sod); - itxg->itxg_sod = 0; clean = itxg->itxg_itxs; } - ASSERT(itxg->itxg_sod == 0); itxg->itxg_txg = txg; itxs = itxg->itxg_itxs = kmem_zalloc(sizeof (itxs_t), KM_SLEEP); @@ -1310,8 +1325,6 @@ zil_itx_assign(zilog_t *zilog, itx_t *it } if (itx->itx_sync) { list_insert_tail(&itxs->i_sync_list, itx); - atomic_add_64(&zilog->zl_itx_list_sz, itx->itx_sod); - itxg->itxg_sod += itx->itx_sod; } else { avl_tree_t *t = &itxs->i_async_tree; uint64_t foid = ((lr_ooo_t *)&itx->itx_lr)->lr_foid; @@ -1359,8 +1372,6 @@ zil_clean(zilog_t *zilog, uint64_t synce ASSERT3U(itxg->itxg_txg, <=, synced_txg); ASSERT(itxg->itxg_txg != 0); ASSERT(zilog->zl_clean_taskq != NULL); - atomic_add_64(&zilog->zl_itx_list_sz, -itxg->itxg_sod); - itxg->itxg_sod = 0; clean_me = itxg->itxg_itxs; itxg->itxg_itxs = NULL; itxg->itxg_txg = 0; @@ -1384,7 +1395,6 @@ zil_get_commit_list(zilog_t *zilog) { uint64_t otxg, txg; list_t *commit_list = &zilog->zl_itx_commit_list; - uint64_t push_sod = 0; if (spa_freeze_txg(zilog->zl_spa) != UINT64_MAX) /* ziltest support */ otxg = ZILTEST_TXG; @@ -1401,12 +1411,9 @@ zil_get_commit_list(zilog_t *zilog) } list_move_tail(commit_list, &itxg->itxg_itxs->i_sync_list); - push_sod += itxg->itxg_sod; - itxg->itxg_sod = 0; mutex_exit(&itxg->itxg_lock); } - atomic_add_64(&zilog->zl_itx_list_sz, -push_sod); } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Nov 17 20:44:51 2016 (r308781) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Nov 17 21:01:27 2016 (r308782) @@ -2908,20 +2908,21 @@ zio_dva_unallocate(zio_t *zio, zio_gang_ */ int zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp, - uint64_t size, boolean_t use_slog) + uint64_t size, boolean_t *slog) { int error = 1; ASSERT(txg > spa_syncing_txg(spa)); - if (use_slog) { - error = metaslab_alloc(spa, spa_log_class(spa), size, - new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); - } - - if (error) { + error = metaslab_alloc(spa, spa_log_class(spa), size, + new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); + if (error == 0) { + *slog = TRUE; + } else { error = metaslab_alloc(spa, spa_normal_class(spa), size, new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); + if (error == 0) + *slog = FALSE; } if (error == 0) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Nov 17 20:44:51 2016 (r308781) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Nov 17 21:01:27 2016 (r308782) @@ -1387,54 +1387,44 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_ { uint32_t blocksize = zv->zv_volblocksize; zilog_t *zilog = zv->zv_zilog; - boolean_t slogging; - ssize_t immediate_write_sz; + itx_wr_state_t write_state; if (zil_replaying(zilog, tx)) return; - immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) - ? 0 : zvol_immediate_write_sz; - - slogging = spa_has_slogs(zilog->zl_spa) && - (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); + if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) + write_state = WR_INDIRECT; + else if (!spa_has_slogs(zilog->zl_spa) && + resid >= blocksize && blocksize > zvol_immediate_write_sz) + write_state = WR_INDIRECT; + else if (sync) + write_state = WR_COPIED; + else + write_state = WR_NEED_COPY; while (resid) { itx_t *itx; lr_write_t *lr; - ssize_t len; - itx_wr_state_t write_state; + itx_wr_state_t wr_state = write_state; + ssize_t len = resid; - /* - * Unlike zfs_log_write() we can be called with - * upto DMU_MAX_ACCESS/2 (5MB) writes. - */ - if (blocksize > immediate_write_sz && !slogging && - resid >= blocksize && off % blocksize == 0) { - write_state = WR_INDIRECT; /* uses dmu_sync */ - len = blocksize; - } else if (sync) { - write_state = WR_COPIED; - len = MIN(ZIL_MAX_LOG_DATA, resid); - } else { - write_state = WR_NEED_COPY; - len = MIN(ZIL_MAX_LOG_DATA, resid); - } + if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA) + wr_state = WR_NEED_COPY; + else if (wr_state == WR_INDIRECT) + len = MIN(blocksize - P2PHASE(off, blocksize), resid); itx = zil_itx_create(TX_WRITE, sizeof (*lr) + - (write_state == WR_COPIED ? len : 0)); + (wr_state == WR_COPIED ? len : 0)); lr = (lr_write_t *)&itx->itx_lr; - if (write_state == WR_COPIED && dmu_read(zv->zv_objset, + if (wr_state == WR_COPIED && dmu_read(zv->zv_objset, ZVOL_OBJ, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { zil_itx_destroy(itx); itx = zil_itx_create(TX_WRITE, sizeof (*lr)); lr = (lr_write_t *)&itx->itx_lr; - write_state = WR_NEED_COPY; + wr_state = WR_NEED_COPY; } - itx->itx_wr_state = write_state; - if (write_state == WR_NEED_COPY) - itx->itx_sod += len; + itx->itx_wr_state = wr_state; lr->lr_foid = ZVOL_OBJ; lr->lr_offset = off; lr->lr_length = len; From owner-svn-src-head@freebsd.org Thu Nov 17 21:02:56 2016 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 98100C47F78; Thu, 17 Nov 2016 21:02:56 +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 7230E145E; Thu, 17 Nov 2016 21:02:56 +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 uAHL2tfq012216; Thu, 17 Nov 2016 21:02:55 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHL2tbS012213; Thu, 17 Nov 2016 21:02:55 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201611172102.uAHL2tbS012213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 17 Nov 2016 21:02:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308783 - in head: sys/kern sys/sys usr.bin/netstat X-SVN-Group: head 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, 17 Nov 2016 21:02:56 -0000 Author: glebius Date: Thu Nov 17 21:02:55 2016 New Revision: 308783 URL: https://svnweb.freebsd.org/changeset/base/308783 Log: Use bogus_page to properly reduce number of I/Os in sendfile(2). The new sendfile_swapin() loop works this way: - Find first invalid page in the request. - Do vm_pager_has_page() and get count of pages, that can be taken in single I/O. - Trim valid pages from the end of the request. - Cycle through the request and substitute to bogus_page all valid pages that are in the middle of the request. - After I/O launched (pager copies array of pages into buf(9), it is important to restore proper page pointers with help vm_page_lookup(). Count bogus pages used and report them in sendfile stats. Modified: head/sys/kern/kern_sendfile.c head/sys/sys/sf_buf.h head/usr.bin/netstat/mbuf.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Thu Nov 17 21:01:27 2016 (r308782) +++ head/sys/kern/kern_sendfile.c Thu Nov 17 21:02:55 2016 (r308783) @@ -62,6 +62,8 @@ __FBSDID("$FreeBSD$"); #include #include +extern vm_page_t bogus_page; + /* * Structure describing a single sendfile(2) I/O, which may consist of * several underlying pager I/Os. @@ -258,7 +260,8 @@ sendfile_iodone(void *arg, vm_page_t *pg struct socket *so; for (int i = 0; i < count; i++) - vm_page_xunbusy(pg[i]); + if (pg[i] != bogus_page) + vm_page_xunbusy(pg[i]); if (error) sfio->error = error; @@ -341,51 +344,53 @@ sendfile_swapin(vm_object_t obj, struct } /* - * Now 'i' points to first invalid page, iterate further - * to make 'j' point at first valid after a bunch of - * invalid ones. - */ - for (j = i + 1; j < npages; j++) - if (vm_page_is_valid(pa[j], vmoff(j, off) & PAGE_MASK, - xfsize(j, npages, off, len))) { - SFSTAT_INC(sf_pages_valid); - break; - } - - /* - * Now we got region of invalid pages between 'i' and 'j'. - * Check that they belong to pager. They may not be there, - * which is a regular situation for shmem pager. For vnode - * pager this happens only in case of sparse file. + * Next page is invalid. Check if it belongs to pager. It + * may not be there, which is a regular situation for shmem + * pager. For vnode pager this happens only in case of + * a sparse file. * * Important feature of vm_pager_has_page() is the hint * stored in 'a', about how many pages we can pagein after * this page in a single I/O. */ - while (!vm_pager_has_page(obj, OFF_TO_IDX(vmoff(i, off)), - NULL, &a) && i < j) { + if (!vm_pager_has_page(obj, OFF_TO_IDX(vmoff(i, off)), NULL, + &a)) { pmap_zero_page(pa[i]); pa[i]->valid = VM_PAGE_BITS_ALL; pa[i]->dirty = 0; vm_page_xunbusy(pa[i]); i++; - } - if (i == j) continue; + } /* * We want to pagein as many pages as possible, limited only * by the 'a' hint and actual request. - * - * We should not pagein into already valid page, thus if - * 'j' didn't reach last page, trim by that page. - * - * When the pagein fulfils the request, also specify readahead. */ - if (j < npages) - a = min(a, j - i - 1); count = min(a + 1, npages - i); + /* + * We should not pagein into a valid page, thus we first trim + * any valid pages off the end of request, and substitute + * to bogus_page those, that are in the middle. + */ + for (j = i + count - 1; j > i; j--) { + if (vm_page_is_valid(pa[j], vmoff(j, off) & PAGE_MASK, + xfsize(j, npages, off, len))) { + count--; + rhpages = 0; + } else + break; + } + for (j = i + 1; j < i + count - 1; j++) + if (vm_page_is_valid(pa[j], vmoff(j, off) & PAGE_MASK, + xfsize(j, npages, off, len))) { + vm_page_xunbusy(pa[j]); + SFSTAT_INC(sf_pages_valid); + SFSTAT_INC(sf_pages_bogus); + pa[j] = bogus_page; + } + refcount_acquire(&sfio->nios); rv = vm_pager_get_pages_async(obj, pa + i, count, NULL, i + count == npages ? &rhpages : NULL, @@ -398,13 +403,18 @@ sendfile_swapin(vm_object_t obj, struct if (i + count == npages) SFSTAT_ADD(sf_rhpages_read, rhpages); -#ifdef INVARIANTS - for (j = i; j < i + count && j < npages; j++) - KASSERT(pa[j] == vm_page_lookup(obj, - OFF_TO_IDX(vmoff(j, off))), - ("pa[j] %p lookup %p\n", pa[j], - vm_page_lookup(obj, OFF_TO_IDX(vmoff(j, off))))); -#endif + /* + * Restore the valid page pointers. They are already + * unbusied, but still wired. + */ + for (j = i; j < i + count; j++) + if (pa[j] == bogus_page) { + pa[j] = vm_page_lookup(obj, + OFF_TO_IDX(vmoff(j, off))); + KASSERT(pa[j], ("%s: page %p[%d] disappeared", + __func__, pa, j)); + + } i += count; nios++; } Modified: head/sys/sys/sf_buf.h ============================================================================== --- head/sys/sys/sf_buf.h Thu Nov 17 21:01:27 2016 (r308782) +++ head/sys/sys/sf_buf.h Thu Nov 17 21:02:55 2016 (r308783) @@ -41,6 +41,7 @@ struct sfstat { /* sendfile statistic uint64_t sf_busy; /* times aborted on a busy page */ uint64_t sf_allocfail; /* times sfbuf allocation failed */ uint64_t sf_allocwait; /* times sfbuf allocation had to wait */ + uint64_t sf_pages_bogus; /* times bogus page was used */ }; #ifdef _KERNEL Modified: head/usr.bin/netstat/mbuf.c ============================================================================== --- head/usr.bin/netstat/mbuf.c Thu Nov 17 21:01:27 2016 (r308782) +++ head/usr.bin/netstat/mbuf.c Thu Nov 17 21:02:55 2016 (r308783) @@ -340,6 +340,9 @@ mbpr(void *kvmd, u_long mbaddr) xo_emit("{:sendfile-pages-valid/%ju} " "{N:pages were valid at time of a sendfile request}\n", (uintmax_t)sfstat.sf_pages_valid); + xo_emit("{:sendfile-pages-bogus/%ju} " + "{N:pages were valid and substituted to bogus page}\n", + (uintmax_t)sfstat.sf_pages_bogus); xo_emit("{:sendfile-requested-readahead/%ju} " "{N:pages were requested for read ahead by applications}\n", (uintmax_t)sfstat.sf_rhpages_requested); From owner-svn-src-head@freebsd.org Thu Nov 17 21:36:20 2016 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 1CC8DC468B4; Thu, 17 Nov 2016 21:36:20 +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 EDED57C5; Thu, 17 Nov 2016 21:36:19 +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 uAHLaJvH024217; Thu, 17 Nov 2016 21:36:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHLaI6m024214; Thu, 17 Nov 2016 21:36:18 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201611172136.uAHLaI6m024214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 17 Nov 2016 21:36:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308784 - in head: lib/libc/sys sys/kern sys/sys X-SVN-Group: head 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, 17 Nov 2016 21:36:20 -0000 Author: glebius Date: Thu Nov 17 21:36:18 2016 New Revision: 308784 URL: https://svnweb.freebsd.org/changeset/base/308784 Log: Add flag SF_USER_READAHEAD to sendfile(2). When specified, the syscall won't do any speculations about readahead, and use exactly the amount of readahead specified by user. E.g. setting SF_FLAGS(0, SF_USER_READAHEAD) will guarantee that no readahead at all will be performed. Modified: head/lib/libc/sys/sendfile.2 head/sys/kern/kern_sendfile.c head/sys/sys/socket.h Modified: head/lib/libc/sys/sendfile.2 ============================================================================== --- head/lib/libc/sys/sendfile.2 Thu Nov 17 21:02:55 2016 (r308783) +++ head/lib/libc/sys/sendfile.2 Thu Nov 17 21:36:18 2016 (r308784) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2016 +.Dd November 17, 2016 .Dt SENDFILE 2 .Os .Sh NAME @@ -155,8 +155,33 @@ sleeps until the network stack no longer of the file, making subsequent modifications to it safe. Please note that this is not a guarantee that the data has actually been sent. +.It Dv SF_USER_READAHEAD +.Nm +has some internal heuristics to do readahead when sending data. +This flag forces +.Nm +to override any heuristically calculated readahead and use exactly the +application specified readahead. +See +.Sx SETTING READAHEAD +for more details on readahead. .El .Pp +When using a socket marked for non-blocking I/O, +.Fn sendfile +may send fewer bytes than requested. +In this case, the number of bytes successfully +written is returned in +.Fa *sbytes +(if specified), +and the error +.Er EAGAIN +is returned. +.Sh SETTING READAHEAD +.Nm +uses internal heuristics based on request size and file system layout +to do readahead. +Additionally application may request extra readahead. The most significant 16 bits of .Fa flags specify amount of pages that @@ -173,16 +198,13 @@ flag: SF_FLAGS(16, SF_NOCACHE) .Ed .Pp -When using a socket marked for non-blocking I/O, -.Fn sendfile -may send fewer bytes than requested. -In this case, the number of bytes successfully -written is returned in -.Fa *sbytes -(if specified), -and the error -.Er EAGAIN -is returned. +.Nm +will use either application specified readahead or internally calculated, +whichever is bigger. +Setting flag +.Dv SF_USER_READAHEAD +would turn off any heuristics and set maximum possible readahead length to +the number of pages specified via flags. .Sh IMPLEMENTATION NOTES The .Fx Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Thu Nov 17 21:02:55 2016 (r308783) +++ head/sys/kern/kern_sendfile.c Thu Nov 17 21:36:18 2016 (r308784) @@ -706,13 +706,20 @@ retry_space: /* * Calculate maximum allowed number of pages for readahead - * at this iteration. First, we allow readahead up to "rem". + * at this iteration. If SF_USER_READAHEAD was set, we don't + * do any heuristics and use exactly the value supplied by + * application. Otherwise, we allow readahead up to "rem". * If application wants more, let it be, but there is no * reason to go above MAXPHYS. Also check against "obj_size", * since vm_pager_has_page() can hint beyond EOF. */ - rhpages = howmany(rem + (off & PAGE_MASK), PAGE_SIZE) - npages; - rhpages += SF_READAHEAD(flags); + if (flags & SF_USER_READAHEAD) { + rhpages = SF_READAHEAD(flags); + } else { + rhpages = howmany(rem + (off & PAGE_MASK), PAGE_SIZE) - + npages; + rhpages += SF_READAHEAD(flags); + } rhpages = min(howmany(MAXPHYS, PAGE_SIZE), rhpages); rhpages = min(howmany(obj_size - trunc_page(off), PAGE_SIZE) - npages, rhpages); Modified: head/sys/sys/socket.h ============================================================================== --- head/sys/sys/socket.h Thu Nov 17 21:02:55 2016 (r308783) +++ head/sys/sys/socket.h Thu Nov 17 21:36:18 2016 (r308784) @@ -590,6 +590,7 @@ struct sf_hdtr { #define SF_NODISKIO 0x00000001 #define SF_MNOWAIT 0x00000002 /* obsolete */ #define SF_SYNC 0x00000004 +#define SF_USER_READAHEAD 0x00000008 #define SF_NOCACHE 0x00000010 #define SF_FLAGS(rh, flags) (((rh) << 16) | (flags)) From owner-svn-src-head@freebsd.org Thu Nov 17 21:37:03 2016 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 5C546C46912; Thu, 17 Nov 2016 21:37:03 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x243.google.com (mail-qk0-x243.google.com [IPv6:2607:f8b0:400d:c09::243]) (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 1737C939; Thu, 17 Nov 2016 21:37:03 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x243.google.com with SMTP id x190so28381479qkb.0; Thu, 17 Nov 2016 13:37:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1FaAyhywZ4zHLMbShLvz9Y+dofFn2WfbyghrvVdf+ic=; b=itaUiCFjaqG/wbUmPWBgJqa0JW9BpcIj4pOlxmUsX5JWAnrOjVbTQyNajpQsvDezt1 tSgfqMCw6ZUnpFRPrv7wA/Ob4wBgfrgZEZD6H9BubyAvv3hMB2l1wqL0HBlDcDKINbJa /12/6n3vOxk4oDUY/MwSYrEC1W7jvyqvS2QNJfnckYQ92/z72rQojYxXWZ5353qZuGRD elHI4JBe5jLFaLgDtAA2HwaMP5Qw3f0hojoGyPGCrq3nvLQX4YxZWVyAfMWMuesyHE7/ kOBvSSsepEjF8UH7+4scr7uFjBUcsOptKu9a191MWHPKVvgJFwZltVIIC+lgrT5UI+UM m4fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1FaAyhywZ4zHLMbShLvz9Y+dofFn2WfbyghrvVdf+ic=; b=RJzamQkghYd1RTPkQHJKqXv8tnWcFd9ge6/T5+iqDeHhc9v6aUgxkh67jMwwCQ2l8j VPTD8VfoXsPtdJNBbDR2DUhQ+yJ4zNoDEQ5Udwvd5cuuScVA0UGjTV+vKv5bCFd9L9D9 KcX70GuEru0ACsJWuC+ngkPJw76If5T0UcAaDW7w2enKsQPJQFrFYrS8M8PStrMoH9nT u9bh8pkT6RA2UCBm+Q/fHTIew8DEyM24KzOCnDKlOZiBaIy9JwpGvCaQKqhBFVH4qKDo jkiosDIG+4Zjj8ow4vp8lvJX5t86Sp3ZxCye6d6HHGeUZH6P5gjrbsfFZLR4v4voeWsH pk8A== X-Gm-Message-State: AKaTC01KvMBo3fYe8wDmizfNlm+H+PB3cu6+OfL5+RsgvslUcLAnHzzypP0qYyUI4OjL5WHetzMc5KCLHOSc7g== X-Received: by 10.55.16.134 with SMTP id 6mr7200207qkq.76.1479418622082; Thu, 17 Nov 2016 13:37:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.29.66 with HTTP; Thu, 17 Nov 2016 13:37:01 -0800 (PST) In-Reply-To: References: <201611160925.uAG9P040059891@repo.freebsd.org> From: Ngie Cooper Date: Thu, 17 Nov 2016 13:37:01 -0800 Message-ID: Subject: Re: svn commit: r308725 - in head/sys: conf dev/hyperv/pcib modules/hyperv/pcib To: Andreas Tobler Cc: Dexuan Cui , "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: Thu, 17 Nov 2016 21:37:03 -0000 On Thu, Nov 17, 2016 at 9:46 AM, Andreas Tobler wrote: > On 16.11.16 10:25, Dexuan Cui wrote: >> >> Author: dexuan >> Date: Wed Nov 16 09:25:00 2016 >> New Revision: 308725 >> URL: https://svnweb.freebsd.org/changeset/base/308725 ... > -dev/hyperv/pcib/pcib.c optional hyperv > +dev/hyperv/pcib/pcib.c optional hyperv pci This seems to be causing Jenkins failures too: https://jenkins.freebsd.org/job/FreeBSD_HEAD/903/ . Doesn't sys/modules/hyperv/vmbus/Makefile need pci_if.h now in SRCS? Thanks, -Ngie From owner-svn-src-head@freebsd.org Thu Nov 17 21:42:49 2016 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 764DFC46CD6 for ; Thu, 17 Nov 2016 21:42:49 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (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 D3F1BE48 for ; Thu, 17 Nov 2016 21:42:48 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wm0-x229.google.com with SMTP id f82so174866306wmf.1 for ; Thu, 17 Nov 2016 13:42:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=C+tC3x2xUSLgTIoeiKxmlJZjc7Kf6b83MaeebknJJfg=; b=Y+nbP3qHU/aKvrsT37l9H3Z5EEISIdrTjmPkNPGokc+9iHf6z+MapcD379hnKTAO+P b8PwlA4JvJDXfSw18rDBoogf2DkbmMg6AVhBMURNFsA8IcfSiC9/xD4lV+SBBR6AAwfZ S8ybtFev5W9/iw0kcNqEE2+8251oi8AM2C2xzuoOYOZs4JTmtslzpW43t+w9MRWB9BMT 5b86KfJFLUyX95hUSR93k3OnFF9TjbRCqo6gPpv+9KJW/3SCwTNkSSgFXtcoXgUyVBWz kNZ7vyHNaHTQa3eRk098A8v3h97aPfwGBvTPaXYAceOaz5YQtPLhLzdhZFt+ZInK5u/c Gx+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=C+tC3x2xUSLgTIoeiKxmlJZjc7Kf6b83MaeebknJJfg=; b=Ddq/ev840OwkbIWYwiqzN33F2QP0cOmRbOGHe/N+aNdXOZkIwhcUEfSfu8Wv/5XxKw rfb2EsWHqR4lrDt4SUUizaSKmH+RkCsvErpuncng98oEwsHXT36WI4JUZ+x4zcceliyo 1ZrIMVHvsLNdunyMIPXV7SzKyCupDeQyW4SSOhi+20Lw/73AXOgub3OvOR2PH1H+plYZ htg/AbrfYrKQmsfYRfMg+L4nt9kG3iZdTQQUvH9Q2mSgZzeoe2IG7BOwV2cIONN48Kgb wdsTR4b407MhgjKdwIfRW0uCmkEIKYqZJOQBgrZUAyBmi54IFhyx5MH9tXKstVz1As2O ZRpg== X-Gm-Message-State: ABUngvdbYFteZaZQDedK5cPUVrXMK4SlQVoxpYQuXV8e8w2fk6Ft/ToTwZZZ/KCXbR5qjhC6 X-Received: by 10.28.98.130 with SMTP id w124mr7055189wmb.125.1479418967086; Thu, 17 Nov 2016 13:42:47 -0800 (PST) Received: from [10.10.1.58] ([185.97.61.26]) by smtp.gmail.com with ESMTPSA id kq7sm5343332wjb.30.2016.11.17.13.42.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Nov 2016 13:42:46 -0800 (PST) Subject: Re: svn commit: r308782 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201611172101.uAHL1R2O009871@repo.freebsd.org> From: Steven Hartland Message-ID: <79c521bc-3186-10a5-d553-12072523f439@multiplay.co.uk> Date: Thu, 17 Nov 2016 21:43:04 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <201611172101.uAHL1R2O009871@repo.freebsd.org> 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: Thu, 17 Nov 2016 21:42:49 -0000 Is this something that should be upstreamed? On 17/11/2016 21:01, Alexander Motin wrote: > Author: mav > Date: Thu Nov 17 21:01:27 2016 > New Revision: 308782 > URL: https://svnweb.freebsd.org/changeset/base/308782 > > Log: > After some ZIL changes 6 years ago zil_slog_limit got partially broken > due to zl_itx_list_sz not updated when async itx'es upgraded to sync. > Actually because of other changes about that time zl_itx_list_sz is not > really required to implement the functionality, so this patch removes > some unneeded broken code and variables. > > Original idea of zil_slog_limit was to reduce chance of SLOG abuse by > single heavy logger, that increased latency for other (more latency critical) > loggers, by pushing heavy log out into the main pool instead of SLOG. Beside > huge latency increase for heavy writers, this implementation caused double > write of all data, since the log records were explicitly prepared for SLOG. > Since we now have I/O scheduler, I've found it can be much more efficient > to reduce priority of heavy logger SLOG writes from ZIO_PRIORITY_SYNC_WRITE > to ZIO_PRIORITY_ASYNC_WRITE, while still leave them on SLOG. > > Existing ZIL implementation had problem with space efficiency when it > has to write large chunks of data into log blocks of limited size. In some > cases efficiency stopped to almost as low as 50%. In case of ZIL stored on > spinning rust, that also reduced log write speed in half, since head had to > uselessly fly over allocated but not written areas. This change improves > the situation by offloading problematic operations from z*_log_write() to > zil_lwb_commit(), which knows real situation of log blocks allocation and > can split large requests into pieces much more efficiently. Also as side > effect it removes one of two data copy operations done by ZIL code WR_COPIED > case. > > While there, untangle and unify code of z*_log_write() functions. > Also zfs_log_write() alike to zvol_log_write() can now handle writes crossing > block boundary, that may also improve efficiency if ZPL is made to do that. > > Sponsored by: iXsystems, Inc. > > Modified: > head/cddl/contrib/opensolaris/cmd/ztest/ztest.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c > > Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Nov 17 20:44:51 2016 (r308781) > +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Nov 17 21:01:27 2016 (r308782) > @@ -1371,7 +1371,6 @@ ztest_log_write(ztest_ds_t *zd, dmu_tx_t > itx->itx_private = zd; > itx->itx_wr_state = write_state; > itx->itx_sync = (ztest_random(8) == 0); > - itx->itx_sod += (write_state == WR_NEED_COPY ? lr->lr_length : 0); > > bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, > sizeof (*lr) - sizeof (lr_t)); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Nov 17 20:44:51 2016 (r308781) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Nov 17 21:01:27 2016 (r308782) > @@ -369,7 +369,6 @@ typedef struct itx { > void *itx_private; /* type-specific opaque data */ > itx_wr_state_t itx_wr_state; /* write state */ > uint8_t itx_sync; /* synchronous transaction */ > - uint64_t itx_sod; /* record size on disk */ > uint64_t itx_oid; /* object id */ > lr_t itx_lr; /* common part of log record */ > /* followed by type-specific part of lr_xx_t and its immediate data */ > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Nov 17 20:44:51 2016 (r308781) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Nov 17 21:01:27 2016 (r308782) > @@ -42,6 +42,7 @@ extern "C" { > typedef struct lwb { > zilog_t *lwb_zilog; /* back pointer to log struct */ > blkptr_t lwb_blk; /* on disk address of this log blk */ > + boolean_t lwb_slog; /* lwb_blk is on SLOG device */ > int lwb_nused; /* # used bytes in buffer */ > int lwb_sz; /* size of block and buffer */ > char *lwb_buf; /* log write buffer */ > @@ -62,7 +63,6 @@ typedef struct itxs { > typedef struct itxg { > kmutex_t itxg_lock; /* lock for this structure */ > uint64_t itxg_txg; /* txg for this chain */ > - uint64_t itxg_sod; /* total size on disk for this txg */ > itxs_t *itxg_itxs; /* sync and async itxs */ > } itxg_t; > > @@ -120,7 +120,6 @@ struct zilog { > kcondvar_t zl_cv_batch[2]; /* batch condition variables */ > itxg_t zl_itxg[TXG_SIZE]; /* intent log txg chains */ > list_t zl_itx_commit_list; /* itx list to be committed */ > - uint64_t zl_itx_list_sz; /* total size of records on list */ > uint64_t zl_cur_used; /* current commit log size used */ > list_t zl_lwb_list; /* in-flight log write list */ > kmutex_t zl_vdev_lock; /* protects zl_vdev_tree */ > @@ -142,6 +141,8 @@ typedef struct zil_bp_node { > > #define ZIL_MAX_LOG_DATA (SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t) - \ > sizeof (lr_write_t)) > +#define ZIL_MAX_COPIED_DATA \ > + ((SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t)) / 2 - sizeof (lr_write_t)) > > #ifdef __cplusplus > } > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Nov 17 20:44:51 2016 (r308781) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Nov 17 21:01:27 2016 (r308782) > @@ -547,7 +547,7 @@ extern zio_t *zio_free_sync(zio_t *pio, > const blkptr_t *bp, uint64_t size, enum zio_flag flags); > > extern int zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, > - blkptr_t *old_bp, uint64_t size, boolean_t use_slog); > + blkptr_t *old_bp, uint64_t size, boolean_t *slog); > extern void zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp); > extern void zio_flush(zio_t *zio, vdev_t *vd); > extern zio_t *zio_trim(zio_t *zio, spa_t *spa, vdev_t *vd, uint64_t offset, > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Thu Nov 17 20:44:51 2016 (r308781) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Thu Nov 17 21:01:27 2016 (r308782) > @@ -464,20 +464,17 @@ void > zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype, > znode_t *zp, offset_t off, ssize_t resid, int ioflag) > { > + uint32_t blocksize = zp->z_blksz; > itx_wr_state_t write_state; > - boolean_t slogging; > uintptr_t fsync_cnt; > - ssize_t immediate_write_sz; > > if (zil_replaying(zilog, tx) || zp->z_unlinked) > return; > > - immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) > - ? 0 : zfs_immediate_write_sz; > - > - slogging = spa_has_slogs(zilog->zl_spa) && > - (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); > - if (resid > immediate_write_sz && !slogging && resid <= zp->z_blksz) > + if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) > + write_state = WR_INDIRECT; > + else if (!spa_has_slogs(zilog->zl_spa) && > + resid >= zfs_immediate_write_sz) > write_state = WR_INDIRECT; > else if (ioflag & (FSYNC | FDSYNC)) > write_state = WR_COPIED; > @@ -491,30 +488,26 @@ zfs_log_write(zilog_t *zilog, dmu_tx_t * > while (resid) { > itx_t *itx; > lr_write_t *lr; > - ssize_t len; > + itx_wr_state_t wr_state = write_state; > + ssize_t len = resid; > > - /* > - * If the write would overflow the largest block then split it. > - */ > - if (write_state != WR_INDIRECT && resid > ZIL_MAX_LOG_DATA) > - len = SPA_OLD_MAXBLOCKSIZE >> 1; > - else > - len = resid; > + if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA) > + wr_state = WR_NEED_COPY; > + else if (wr_state == WR_INDIRECT) > + len = MIN(blocksize - P2PHASE(off, blocksize), resid); > > itx = zil_itx_create(txtype, sizeof (*lr) + > - (write_state == WR_COPIED ? len : 0)); > + (wr_state == WR_COPIED ? len : 0)); > lr = (lr_write_t *)&itx->itx_lr; > - if (write_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os, > + if (wr_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os, > zp->z_id, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { > zil_itx_destroy(itx); > itx = zil_itx_create(txtype, sizeof (*lr)); > lr = (lr_write_t *)&itx->itx_lr; > - write_state = WR_NEED_COPY; > + wr_state = WR_NEED_COPY; > } > > - itx->itx_wr_state = write_state; > - if (write_state == WR_NEED_COPY) > - itx->itx_sod += len; > + itx->itx_wr_state = wr_state; > lr->lr_foid = zp->z_id; > lr->lr_offset = off; > lr->lr_length = len; > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 20:44:51 2016 (r308781) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 21:01:27 2016 (r308782) > @@ -88,6 +88,15 @@ SYSCTL_DECL(_vfs_zfs_trim); > SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enabled, CTLFLAG_RDTUN, &zfs_trim_enabled, 0, > "Enable ZFS TRIM"); > > +/* > + * Limit SLOG write size per commit executed with synchronous priority. > + * Any writes above that executed with lower (asynchronous) priority to > + * limit potential SLOG device abuse by single active ZIL writer. > + */ > +uint64_t zil_slog_limit = 768 * 1024; > +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, > + &zil_slog_limit, 0, "Maximal SLOG commit size with sync priority"); > + > static kmem_cache_t *zil_lwb_cache; > > #define LWB_EMPTY(lwb) ((BP_GET_LSIZE(&lwb->lwb_blk) - \ > @@ -447,13 +456,14 @@ zil_free_log_record(zilog_t *zilog, lr_t > } > > static lwb_t * > -zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, uint64_t txg) > +zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t slog, uint64_t txg) > { > lwb_t *lwb; > > lwb = kmem_cache_alloc(zil_lwb_cache, KM_SLEEP); > lwb->lwb_zilog = zilog; > lwb->lwb_blk = *bp; > + lwb->lwb_slog = slog; > lwb->lwb_buf = zio_buf_alloc(BP_GET_LSIZE(bp)); > lwb->lwb_max_txg = txg; > lwb->lwb_zio = NULL; > @@ -516,6 +526,7 @@ zil_create(zilog_t *zilog) > dmu_tx_t *tx = NULL; > blkptr_t blk; > int error = 0; > + boolean_t slog = FALSE; > > /* > * Wait for any previous destroy to complete. > @@ -544,7 +555,7 @@ zil_create(zilog_t *zilog) > } > > error = zio_alloc_zil(zilog->zl_spa, txg, &blk, NULL, > - ZIL_MIN_BLKSZ, zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); > + ZIL_MIN_BLKSZ, &slog); > > if (error == 0) > zil_init_log_chain(zilog, &blk); > @@ -554,7 +565,7 @@ zil_create(zilog_t *zilog) > * Allocate a log write buffer (lwb) for the first log block. > */ > if (error == 0) > - lwb = zil_alloc_lwb(zilog, &blk, txg); > + lwb = zil_alloc_lwb(zilog, &blk, slog, txg); > > /* > * If we just allocated the first log block, commit our transaction > @@ -885,6 +896,7 @@ static void > zil_lwb_write_init(zilog_t *zilog, lwb_t *lwb) > { > zbookmark_phys_t zb; > + zio_priority_t prio; > > SET_BOOKMARK(&zb, lwb->lwb_blk.blk_cksum.zc_word[ZIL_ZC_OBJSET], > ZB_ZIL_OBJECT, ZB_ZIL_LEVEL, > @@ -895,9 +907,13 @@ zil_lwb_write_init(zilog_t *zilog, lwb_t > ZIO_FLAG_CANFAIL); > } > if (lwb->lwb_zio == NULL) { > + if (zilog->zl_cur_used <= zil_slog_limit || !lwb->lwb_slog) > + prio = ZIO_PRIORITY_SYNC_WRITE; > + else > + prio = ZIO_PRIORITY_ASYNC_WRITE; > lwb->lwb_zio = zio_rewrite(zilog->zl_root_zio, zilog->zl_spa, > 0, &lwb->lwb_blk, lwb->lwb_buf, BP_GET_LSIZE(&lwb->lwb_blk), > - zil_lwb_write_done, lwb, ZIO_PRIORITY_SYNC_WRITE, > + zil_lwb_write_done, lwb, prio, > ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE, &zb); > } > } > @@ -917,18 +933,6 @@ uint64_t zil_block_buckets[] = { > }; > > /* > - * Use the slog as long as the logbias is 'latency' and the current commit size > - * is less than the limit or the total list size is less than 2X the limit. > - * Limit checking is disabled by setting zil_slog_limit to UINT64_MAX. > - */ > -uint64_t zil_slog_limit = 1024 * 1024; > -SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, > - &zil_slog_limit, 0, "Maximal commit size to use SLOG"); > -#define USE_SLOG(zilog) (((zilog)->zl_logbias == ZFS_LOGBIAS_LATENCY) && \ > - (((zilog)->zl_cur_used < zil_slog_limit) || \ > - ((zilog)->zl_itx_list_sz < (zil_slog_limit << 1)))) > - > -/* > * Start a log block write and advance to the next log block. > * Calls are serialized. > */ > @@ -943,6 +947,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ > uint64_t txg; > uint64_t zil_blksz, wsz; > int i, error; > + boolean_t slog; > > if (BP_GET_CHECKSUM(&lwb->lwb_blk) == ZIO_CHECKSUM_ZILOG2) { > zilc = (zil_chain_t *)lwb->lwb_buf; > @@ -999,8 +1004,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ > > BP_ZERO(bp); > /* pass the old blkptr in order to spread log blocks across devs */ > - error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, > - USE_SLOG(zilog)); > + error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, &slog); > if (error == 0) { > ASSERT3U(bp->blk_birth, ==, txg); > bp->blk_cksum = lwb->lwb_blk.blk_cksum; > @@ -1009,7 +1013,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ > /* > * Allocate a new log write buffer (lwb). > */ > - nlwb = zil_alloc_lwb(zilog, bp, txg); > + nlwb = zil_alloc_lwb(zilog, bp, slog, txg); > > /* Record the block for later vdev flushing */ > zil_add_block(zilog, &lwb->lwb_blk); > @@ -1046,12 +1050,13 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ > static lwb_t * > zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) > { > - lr_t *lrc = &itx->itx_lr; /* common log record */ > - lr_write_t *lrw = (lr_write_t *)lrc; > + lr_t *lrcb, *lrc = &itx->itx_lr; /* common log record */ > + lr_write_t *lrwb, *lrw = (lr_write_t *)lrc; > char *lr_buf; > uint64_t txg = lrc->lrc_txg; > uint64_t reclen = lrc->lrc_reclen; > uint64_t dlen = 0; > + uint64_t dnow, lwb_sp; > > if (lwb == NULL) > return (NULL); > @@ -1068,25 +1073,30 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it > > zil_lwb_write_init(zilog, lwb); > > +cont: > /* > * If this record won't fit in the current log block, start a new one. > + * For WR_NEED_COPY optimize layout for minimal number of chunks, but > + * try to keep wasted space withing reasonable range (12%). > */ > - if (lwb->lwb_nused + reclen + dlen > lwb->lwb_sz) { > + lwb_sp = lwb->lwb_sz - lwb->lwb_nused; > + if (reclen > lwb_sp || (reclen + dlen > lwb_sp && > + lwb_sp < ZIL_MAX_LOG_DATA / 8 && (dlen % ZIL_MAX_LOG_DATA == 0 || > + lwb_sp < reclen + dlen % ZIL_MAX_LOG_DATA))) { > lwb = zil_lwb_write_start(zilog, lwb); > if (lwb == NULL) > return (NULL); > zil_lwb_write_init(zilog, lwb); > ASSERT(LWB_EMPTY(lwb)); > - if (lwb->lwb_nused + reclen + dlen > lwb->lwb_sz) { > - txg_wait_synced(zilog->zl_dmu_pool, txg); > - return (lwb); > - } > + lwb_sp = lwb->lwb_sz - lwb->lwb_nused; > + ASSERT3U(reclen + MIN(dlen, sizeof(uint64_t)), <=, lwb_sp); > } > > + dnow = MIN(dlen, lwb_sp - reclen); > lr_buf = lwb->lwb_buf + lwb->lwb_nused; > bcopy(lrc, lr_buf, reclen); > - lrc = (lr_t *)lr_buf; > - lrw = (lr_write_t *)lrc; > + lrcb = (lr_t *)lr_buf; > + lrwb = (lr_write_t *)lrcb; > > /* > * If it's a write, fetch the data or get its blkptr as appropriate. > @@ -1098,16 +1108,19 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it > char *dbuf; > int error; > > - if (dlen) { > - ASSERT(itx->itx_wr_state == WR_NEED_COPY); > + if (itx->itx_wr_state == WR_NEED_COPY) { > dbuf = lr_buf + reclen; > - lrw->lr_common.lrc_reclen += dlen; > + lrcb->lrc_reclen += dnow; > + if (lrwb->lr_length > dnow) > + lrwb->lr_length = dnow; > + lrw->lr_offset += dnow; > + lrw->lr_length -= dnow; > } else { > ASSERT(itx->itx_wr_state == WR_INDIRECT); > dbuf = NULL; > } > error = zilog->zl_get_data( > - itx->itx_private, lrw, dbuf, lwb->lwb_zio); > + itx->itx_private, lrwb, dbuf, lwb->lwb_zio); > if (error == EIO) { > txg_wait_synced(zilog->zl_dmu_pool, txg); > return (lwb); > @@ -1126,12 +1139,18 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it > * equal to the itx sequence number because not all transactions > * are synchronous, and sometimes spa_sync() gets there first. > */ > - lrc->lrc_seq = ++zilog->zl_lr_seq; /* we are single threaded */ > - lwb->lwb_nused += reclen + dlen; > + lrcb->lrc_seq = ++zilog->zl_lr_seq; /* we are single threaded */ > + lwb->lwb_nused += reclen + dnow; > lwb->lwb_max_txg = MAX(lwb->lwb_max_txg, txg); > ASSERT3U(lwb->lwb_nused, <=, lwb->lwb_sz); > ASSERT0(P2PHASE(lwb->lwb_nused, sizeof (uint64_t))); > > + dlen -= dnow; > + if (dlen > 0) { > + zilog->zl_cur_used += reclen; > + goto cont; > + } > + > return (lwb); > } > > @@ -1145,7 +1164,6 @@ zil_itx_create(uint64_t txtype, size_t l > itx = kmem_alloc(offsetof(itx_t, itx_lr) + lrsize, KM_SLEEP); > itx->itx_lr.lrc_txtype = txtype; > itx->itx_lr.lrc_reclen = lrsize; > - itx->itx_sod = lrsize; /* if write & WR_NEED_COPY will be increased */ > itx->itx_lr.lrc_seq = 0; /* defensive */ > itx->itx_sync = B_TRUE; /* default is synchronous */ > > @@ -1294,11 +1312,8 @@ zil_itx_assign(zilog_t *zilog, itx_t *it > * this itxg. Save the itxs for release below. > * This should be rare. > */ > - atomic_add_64(&zilog->zl_itx_list_sz, -itxg->itxg_sod); > - itxg->itxg_sod = 0; > clean = itxg->itxg_itxs; > } > - ASSERT(itxg->itxg_sod == 0); > itxg->itxg_txg = txg; > itxs = itxg->itxg_itxs = kmem_zalloc(sizeof (itxs_t), KM_SLEEP); > > @@ -1310,8 +1325,6 @@ zil_itx_assign(zilog_t *zilog, itx_t *it > } > if (itx->itx_sync) { > list_insert_tail(&itxs->i_sync_list, itx); > - atomic_add_64(&zilog->zl_itx_list_sz, itx->itx_sod); > - itxg->itxg_sod += itx->itx_sod; > } else { > avl_tree_t *t = &itxs->i_async_tree; > uint64_t foid = ((lr_ooo_t *)&itx->itx_lr)->lr_foid; > @@ -1359,8 +1372,6 @@ zil_clean(zilog_t *zilog, uint64_t synce > ASSERT3U(itxg->itxg_txg, <=, synced_txg); > ASSERT(itxg->itxg_txg != 0); > ASSERT(zilog->zl_clean_taskq != NULL); > - atomic_add_64(&zilog->zl_itx_list_sz, -itxg->itxg_sod); > - itxg->itxg_sod = 0; > clean_me = itxg->itxg_itxs; > itxg->itxg_itxs = NULL; > itxg->itxg_txg = 0; > @@ -1384,7 +1395,6 @@ zil_get_commit_list(zilog_t *zilog) > { > uint64_t otxg, txg; > list_t *commit_list = &zilog->zl_itx_commit_list; > - uint64_t push_sod = 0; > > if (spa_freeze_txg(zilog->zl_spa) != UINT64_MAX) /* ziltest support */ > otxg = ZILTEST_TXG; > @@ -1401,12 +1411,9 @@ zil_get_commit_list(zilog_t *zilog) > } > > list_move_tail(commit_list, &itxg->itxg_itxs->i_sync_list); > - push_sod += itxg->itxg_sod; > - itxg->itxg_sod = 0; > > mutex_exit(&itxg->itxg_lock); > } > - atomic_add_64(&zilog->zl_itx_list_sz, -push_sod); > } > > /* > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Nov 17 20:44:51 2016 (r308781) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Nov 17 21:01:27 2016 (r308782) > @@ -2908,20 +2908,21 @@ zio_dva_unallocate(zio_t *zio, zio_gang_ > */ > int > zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp, > - uint64_t size, boolean_t use_slog) > + uint64_t size, boolean_t *slog) > { > int error = 1; > > ASSERT(txg > spa_syncing_txg(spa)); > > - if (use_slog) { > - error = metaslab_alloc(spa, spa_log_class(spa), size, > - new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); > - } > - > - if (error) { > + error = metaslab_alloc(spa, spa_log_class(spa), size, > + new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); > + if (error == 0) { > + *slog = TRUE; > + } else { > error = metaslab_alloc(spa, spa_normal_class(spa), size, > new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); > + if (error == 0) > + *slog = FALSE; > } > > if (error == 0) { > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Nov 17 20:44:51 2016 (r308781) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Nov 17 21:01:27 2016 (r308782) > @@ -1387,54 +1387,44 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_ > { > uint32_t blocksize = zv->zv_volblocksize; > zilog_t *zilog = zv->zv_zilog; > - boolean_t slogging; > - ssize_t immediate_write_sz; > + itx_wr_state_t write_state; > > if (zil_replaying(zilog, tx)) > return; > > - immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) > - ? 0 : zvol_immediate_write_sz; > - > - slogging = spa_has_slogs(zilog->zl_spa) && > - (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); > + if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) > + write_state = WR_INDIRECT; > + else if (!spa_has_slogs(zilog->zl_spa) && > + resid >= blocksize && blocksize > zvol_immediate_write_sz) > + write_state = WR_INDIRECT; > + else if (sync) > + write_state = WR_COPIED; > + else > + write_state = WR_NEED_COPY; > > while (resid) { > itx_t *itx; > lr_write_t *lr; > - ssize_t len; > - itx_wr_state_t write_state; > + itx_wr_state_t wr_state = write_state; > + ssize_t len = resid; > > - /* > - * Unlike zfs_log_write() we can be called with > - * upto DMU_MAX_ACCESS/2 (5MB) writes. > - */ > - if (blocksize > immediate_write_sz && !slogging && > - resid >= blocksize && off % blocksize == 0) { > - write_state = WR_INDIRECT; /* uses dmu_sync */ > - len = blocksize; > - } else if (sync) { > - write_state = WR_COPIED; > - len = MIN(ZIL_MAX_LOG_DATA, resid); > - } else { > - write_state = WR_NEED_COPY; > - len = MIN(ZIL_MAX_LOG_DATA, resid); > - } > + if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA) > + wr_state = WR_NEED_COPY; > + else if (wr_state == WR_INDIRECT) > + len = MIN(blocksize - P2PHASE(off, blocksize), resid); > > itx = zil_itx_create(TX_WRITE, sizeof (*lr) + > - (write_state == WR_COPIED ? len : 0)); > + (wr_state == WR_COPIED ? len : 0)); > lr = (lr_write_t *)&itx->itx_lr; > - if (write_state == WR_COPIED && dmu_read(zv->zv_objset, > + if (wr_state == WR_COPIED && dmu_read(zv->zv_objset, > ZVOL_OBJ, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { > zil_itx_destroy(itx); > itx = zil_itx_create(TX_WRITE, sizeof (*lr)); > lr = (lr_write_t *)&itx->itx_lr; > - write_state = WR_NEED_COPY; > + wr_state = WR_NEED_COPY; > } > > - itx->itx_wr_state = write_state; > - if (write_state == WR_NEED_COPY) > - itx->itx_sod += len; > + itx->itx_wr_state = wr_state; > lr->lr_foid = ZVOL_OBJ; > lr->lr_offset = off; > lr->lr_length = len; > From owner-svn-src-head@freebsd.org Thu Nov 17 21:52:01 2016 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 C3E04C4704C; Thu, 17 Nov 2016 21:52:01 +0000 (UTC) (envelope-from ivadasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C8C41471; Thu, 17 Nov 2016 21:52:01 +0000 (UTC) (envelope-from ivadasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAHLq0qW032158; Thu, 17 Nov 2016 21:52:00 GMT (envelope-from ivadasz@FreeBSD.org) Received: (from ivadasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHLq0eQ032144; Thu, 17 Nov 2016 21:52:00 GMT (envelope-from ivadasz@FreeBSD.org) Message-Id: <201611172152.uAHLq0eQ032144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ivadasz set sender to ivadasz@FreeBSD.org using -f From: =?UTF-8?Q?Imre_Vad=c3=a1sz?= Date: Thu, 17 Nov 2016 21:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308785 - head/sys/net80211 X-SVN-Group: head 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, 17 Nov 2016 21:52:01 -0000 Author: ivadasz Date: Thu Nov 17 21:52:00 2016 New Revision: 308785 URL: https://svnweb.freebsd.org/changeset/base/308785 Log: [net80211] Don't check bgscanidle setting in net80211 for full-offload scan. If full-offload scan is used, the NIC driver (or rather the firmware of the NIC) should take care of interrupting and continuing the background scan. So net80211 should ignore the vap->iv_bgscanidle setting then, instead the NIC driver might look at this setting and pass it on to the firmware in some way if possible. Since full-offload scans won't be explicitly interrupted by net80211, it also doesn't really make sense to check the vap->iv_bgscanidle condition in that case, before starting a background scan. If the NIC driver advertises background scan support and full-offload scanning, the firmware should be able to execute that scan without interfering too much with our data traffic. Reviewed by: adrian, avos Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8539 Modified: head/sys/net80211/ieee80211_scan_sta.c head/sys/net80211/ieee80211_sta.c Modified: head/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sta.c Thu Nov 17 21:36:18 2016 (r308784) +++ head/sys/net80211/ieee80211_scan_sta.c Thu Nov 17 21:52:00 2016 (r308785) @@ -1336,7 +1336,8 @@ sta_roam_check(struct ieee80211_scan_sta * XXX force immediate switch on scan complete */ if (!IEEE80211_IS_CHAN_DTURBO(ic->ic_curchan) && - ieee80211_time_after(ticks, ic->ic_lastdata + vap->iv_bgscanidle)) + ((vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD) || + ieee80211_time_after(ticks, ic->ic_lastdata + vap->iv_bgscanidle))) ieee80211_bg_scan(vap, 0); return; } Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Thu Nov 17 21:36:18 2016 (r308784) +++ head/sys/net80211/ieee80211_sta.c Thu Nov 17 21:52:00 2016 (r308785) @@ -1230,6 +1230,7 @@ done: * o bg scan is active * o no channel switch is pending * o there has not been any traffic recently + * o no full-offload scan support (no need for explicitly continuing scan then) * * Note we do not check if there is an administrative enable; * this is only done to start the scan. We assume that any @@ -1243,6 +1244,7 @@ contbgscan(struct ieee80211vap *vap) return ((ic->ic_flags_ext & IEEE80211_FEXT_BGSCAN) && (ic->ic_flags & IEEE80211_F_CSAPENDING) == 0 && + !(vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD) && vap->iv_state == IEEE80211_S_RUN && /* XXX? */ ieee80211_time_after(ticks, ic->ic_lastdata + vap->iv_bgscanidle)); } @@ -1253,7 +1255,7 @@ contbgscan(struct ieee80211vap *vap) * o no channel switch is pending * o we are not boosted on a dynamic turbo channel * o there has not been a scan recently - * o there has not been any traffic recently + * o there has not been any traffic recently (don't check if full-offload scan) */ static __inline int startbgscan(struct ieee80211vap *vap) @@ -1266,7 +1268,8 @@ startbgscan(struct ieee80211vap *vap) !IEEE80211_IS_CHAN_DTURBO(ic->ic_curchan) && #endif ieee80211_time_after(ticks, ic->ic_lastscan + vap->iv_bgscanintvl) && - ieee80211_time_after(ticks, ic->ic_lastdata + vap->iv_bgscanidle)); + ((vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD) || + ieee80211_time_after(ticks, ic->ic_lastdata + vap->iv_bgscanidle))); } static void From owner-svn-src-head@freebsd.org Thu Nov 17 22:11:48 2016 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 76D2BC473DD; Thu, 17 Nov 2016 22:11:48 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::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 350381CB7; Thu, 17 Nov 2016 22:11:48 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-pg0-x241.google.com with SMTP id p66so18620602pga.2; Thu, 17 Nov 2016 14:11:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=aMQoNPVgwM92EIcZj5MrucQd5QOxKHlN53M25NA1j/s=; b=eHLp/TALe8qEUPN49gG0EViJrbvF92ymbZYK/tjUhHSKWq1RDJpDhZs1LW30lfWsvi YXjmIednFo+OTrHTkrbrQvKld1NCXg9oSkATTg6lZ1D3eyQhctAeKHwOVbDbKlvxPWUf EvQ+IQUbwCHn5Do4HIpn3TZAfeAfaBh5SWKNc+r/CjHqSiGpyf4NhqymsKyn8KGgRocN NfRznHvg8EOzBaELYg5gItI826KEyMExv7BGSCcrzCZJKfl4JsHLJBC52XmrbLtLPAng nfug2W24F3xIm8L2mq2cbRJXGHqEi+YWXO0HHsDnPKXSDG8k9Gl+Mu6hDSLq5mLTOeqW mmCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=aMQoNPVgwM92EIcZj5MrucQd5QOxKHlN53M25NA1j/s=; b=XL1JZ/QWq7nTdeKlhFJ1/52JJNBrI60pFN/sBB71XqtJH43fwMa4n7tQDXiXk9SEkv FJiNcT5Lulu6991pMpjAvl4ebloXwtdleydsvdHvMB4ejF9MXdGpuoBH/orKaC3shTYi MRliWK0QrtmAnI/FisNR6NTWQgwUmjkf9BcWrYBAt+hN940KJCwYWkcU4WSIAlYoVSPV ygvzAPWHvVS8Uo8WdihpCCPNlhLxKAQZ7XWYyS41k1gG/hNN3EtIYZ9f9GMr444n2eDW k23tAi4jbLMXooHffvYZiy77tLlpR/PMEuUnCkFc9vpNnSTV6/ltJnuRrui2ne8viT4E BrVw== X-Gm-Message-State: ABUngvdHy2I3UOwGqRspvTFA+EIZ/mXYIYHcZyu5iYB489ZskVr4nS7GE4TSyHvOgGDytA== X-Received: by 10.99.127.16 with SMTP id a16mr11905414pgd.27.1479420707009; Thu, 17 Nov 2016 14:11:47 -0800 (PST) Received: from mavbook.mavhome.dp.ua ([12.229.62.29]) by smtp.gmail.com with ESMTPSA id u23sm10634560pfg.86.2016.11.17.14.11.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Nov 2016 14:11:46 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r308782 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys To: Steven Hartland , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201611172101.uAHL1R2O009871@repo.freebsd.org> <79c521bc-3186-10a5-d553-12072523f439@multiplay.co.uk> From: Alexander Motin Message-ID: <725f293e-3d3b-1248-4900-acee5659d382@FreeBSD.org> Date: Thu, 17 Nov 2016 14:11:38 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <79c521bc-3186-10a5-d553-12072523f439@multiplay.co.uk> Content-Type: text/plain; charset=utf-8 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: Thu, 17 Nov 2016 22:11:48 -0000 It is in OpenZFS review queue now: https://github.com/openzfs/openzfs/pull/219 Welcome to comment there to speed up the process. On 17.11.2016 13:43, Steven Hartland wrote: > Is this something that should be upstreamed? > > On 17/11/2016 21:01, Alexander Motin wrote: >> Author: mav >> Date: Thu Nov 17 21:01:27 2016 >> New Revision: 308782 >> URL: https://svnweb.freebsd.org/changeset/base/308782 >> >> Log: >> After some ZIL changes 6 years ago zil_slog_limit got partially broken >> due to zl_itx_list_sz not updated when async itx'es upgraded to sync. >> Actually because of other changes about that time zl_itx_list_sz is not >> really required to implement the functionality, so this patch removes >> some unneeded broken code and variables. >> >> Original idea of zil_slog_limit was to reduce chance of SLOG abuse by >> single heavy logger, that increased latency for other (more latency critical) >> loggers, by pushing heavy log out into the main pool instead of SLOG. Beside >> huge latency increase for heavy writers, this implementation caused double >> write of all data, since the log records were explicitly prepared for SLOG. >> Since we now have I/O scheduler, I've found it can be much more efficient >> to reduce priority of heavy logger SLOG writes from ZIO_PRIORITY_SYNC_WRITE >> to ZIO_PRIORITY_ASYNC_WRITE, while still leave them on SLOG. >> >> Existing ZIL implementation had problem with space efficiency when it >> has to write large chunks of data into log blocks of limited size. In some >> cases efficiency stopped to almost as low as 50%. In case of ZIL stored on >> spinning rust, that also reduced log write speed in half, since head had to >> uselessly fly over allocated but not written areas. This change improves >> the situation by offloading problematic operations from z*_log_write() to >> zil_lwb_commit(), which knows real situation of log blocks allocation and >> can split large requests into pieces much more efficiently. Also as side >> effect it removes one of two data copy operations done by ZIL code WR_COPIED >> case. >> >> While there, untangle and unify code of z*_log_write() functions. >> Also zfs_log_write() alike to zvol_log_write() can now handle writes crossing >> block boundary, that may also improve efficiency if ZPL is made to do that. >> >> Sponsored by: iXsystems, Inc. >> >> Modified: >> head/cddl/contrib/opensolaris/cmd/ztest/ztest.c >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c >> >> Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c >> ============================================================================== >> --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Nov 17 20:44:51 2016 (r308781) >> +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Nov 17 21:01:27 2016 (r308782) >> @@ -1371,7 +1371,6 @@ ztest_log_write(ztest_ds_t *zd, dmu_tx_t >> itx->itx_private = zd; >> itx->itx_wr_state = write_state; >> itx->itx_sync = (ztest_random(8) == 0); >> - itx->itx_sod += (write_state == WR_NEED_COPY ? lr->lr_length : 0); >> >> bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, >> sizeof (*lr) - sizeof (lr_t)); >> >> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h >> ============================================================================== >> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Nov 17 20:44:51 2016 (r308781) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Nov 17 21:01:27 2016 (r308782) >> @@ -369,7 +369,6 @@ typedef struct itx { >> void *itx_private; /* type-specific opaque data */ >> itx_wr_state_t itx_wr_state; /* write state */ >> uint8_t itx_sync; /* synchronous transaction */ >> - uint64_t itx_sod; /* record size on disk */ >> uint64_t itx_oid; /* object id */ >> lr_t itx_lr; /* common part of log record */ >> /* followed by type-specific part of lr_xx_t and its immediate data */ >> >> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h >> ============================================================================== >> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Nov 17 20:44:51 2016 (r308781) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Nov 17 21:01:27 2016 (r308782) >> @@ -42,6 +42,7 @@ extern "C" { >> typedef struct lwb { >> zilog_t *lwb_zilog; /* back pointer to log struct */ >> blkptr_t lwb_blk; /* on disk address of this log blk */ >> + boolean_t lwb_slog; /* lwb_blk is on SLOG device */ >> int lwb_nused; /* # used bytes in buffer */ >> int lwb_sz; /* size of block and buffer */ >> char *lwb_buf; /* log write buffer */ >> @@ -62,7 +63,6 @@ typedef struct itxs { >> typedef struct itxg { >> kmutex_t itxg_lock; /* lock for this structure */ >> uint64_t itxg_txg; /* txg for this chain */ >> - uint64_t itxg_sod; /* total size on disk for this txg */ >> itxs_t *itxg_itxs; /* sync and async itxs */ >> } itxg_t; >> >> @@ -120,7 +120,6 @@ struct zilog { >> kcondvar_t zl_cv_batch[2]; /* batch condition variables */ >> itxg_t zl_itxg[TXG_SIZE]; /* intent log txg chains */ >> list_t zl_itx_commit_list; /* itx list to be committed */ >> - uint64_t zl_itx_list_sz; /* total size of records on list */ >> uint64_t zl_cur_used; /* current commit log size used */ >> list_t zl_lwb_list; /* in-flight log write list */ >> kmutex_t zl_vdev_lock; /* protects zl_vdev_tree */ >> @@ -142,6 +141,8 @@ typedef struct zil_bp_node { >> >> #define ZIL_MAX_LOG_DATA (SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t) - \ >> sizeof (lr_write_t)) >> +#define ZIL_MAX_COPIED_DATA \ >> + ((SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t)) / 2 - sizeof (lr_write_t)) >> >> #ifdef __cplusplus >> } >> >> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h >> ============================================================================== >> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Nov 17 20:44:51 2016 (r308781) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Nov 17 21:01:27 2016 (r308782) >> @@ -547,7 +547,7 @@ extern zio_t *zio_free_sync(zio_t *pio, >> const blkptr_t *bp, uint64_t size, enum zio_flag flags); >> >> extern int zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, >> - blkptr_t *old_bp, uint64_t size, boolean_t use_slog); >> + blkptr_t *old_bp, uint64_t size, boolean_t *slog); >> extern void zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp); >> extern void zio_flush(zio_t *zio, vdev_t *vd); >> extern zio_t *zio_trim(zio_t *zio, spa_t *spa, vdev_t *vd, uint64_t offset, >> >> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c >> ============================================================================== >> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Thu Nov 17 20:44:51 2016 (r308781) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Thu Nov 17 21:01:27 2016 (r308782) >> @@ -464,20 +464,17 @@ void >> zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype, >> znode_t *zp, offset_t off, ssize_t resid, int ioflag) >> { >> + uint32_t blocksize = zp->z_blksz; >> itx_wr_state_t write_state; >> - boolean_t slogging; >> uintptr_t fsync_cnt; >> - ssize_t immediate_write_sz; >> >> if (zil_replaying(zilog, tx) || zp->z_unlinked) >> return; >> >> - immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >> - ? 0 : zfs_immediate_write_sz; >> - >> - slogging = spa_has_slogs(zilog->zl_spa) && >> - (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); >> - if (resid > immediate_write_sz && !slogging && resid <= zp->z_blksz) >> + if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >> + write_state = WR_INDIRECT; >> + else if (!spa_has_slogs(zilog->zl_spa) && >> + resid >= zfs_immediate_write_sz) >> write_state = WR_INDIRECT; >> else if (ioflag & (FSYNC | FDSYNC)) >> write_state = WR_COPIED; >> @@ -491,30 +488,26 @@ zfs_log_write(zilog_t *zilog, dmu_tx_t * >> while (resid) { >> itx_t *itx; >> lr_write_t *lr; >> - ssize_t len; >> + itx_wr_state_t wr_state = write_state; >> + ssize_t len = resid; >> >> - /* >> - * If the write would overflow the largest block then split it. >> - */ >> - if (write_state != WR_INDIRECT && resid > ZIL_MAX_LOG_DATA) >> - len = SPA_OLD_MAXBLOCKSIZE >> 1; >> - else >> - len = resid; >> + if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA) >> + wr_state = WR_NEED_COPY; >> + else if (wr_state == WR_INDIRECT) >> + len = MIN(blocksize - P2PHASE(off, blocksize), resid); >> >> itx = zil_itx_create(txtype, sizeof (*lr) + >> - (write_state == WR_COPIED ? len : 0)); >> + (wr_state == WR_COPIED ? len : 0)); >> lr = (lr_write_t *)&itx->itx_lr; >> - if (write_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os, >> + if (wr_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os, >> zp->z_id, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { >> zil_itx_destroy(itx); >> itx = zil_itx_create(txtype, sizeof (*lr)); >> lr = (lr_write_t *)&itx->itx_lr; >> - write_state = WR_NEED_COPY; >> + wr_state = WR_NEED_COPY; >> } >> >> - itx->itx_wr_state = write_state; >> - if (write_state == WR_NEED_COPY) >> - itx->itx_sod += len; >> + itx->itx_wr_state = wr_state; >> lr->lr_foid = zp->z_id; >> lr->lr_offset = off; >> lr->lr_length = len; >> >> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c >> ============================================================================== >> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 20:44:51 2016 (r308781) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 21:01:27 2016 (r308782) >> @@ -88,6 +88,15 @@ SYSCTL_DECL(_vfs_zfs_trim); >> SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enabled, CTLFLAG_RDTUN, &zfs_trim_enabled, 0, >> "Enable ZFS TRIM"); >> >> +/* >> + * Limit SLOG write size per commit executed with synchronous priority. >> + * Any writes above that executed with lower (asynchronous) priority to >> + * limit potential SLOG device abuse by single active ZIL writer. >> + */ >> +uint64_t zil_slog_limit = 768 * 1024; >> +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, >> + &zil_slog_limit, 0, "Maximal SLOG commit size with sync priority"); >> + >> static kmem_cache_t *zil_lwb_cache; >> >> #define LWB_EMPTY(lwb) ((BP_GET_LSIZE(&lwb->lwb_blk) - \ >> @@ -447,13 +456,14 @@ zil_free_log_record(zilog_t *zilog, lr_t >> } >> >> static lwb_t * >> -zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, uint64_t txg) >> +zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t slog, uint64_t txg) >> { >> lwb_t *lwb; >> >> lwb = kmem_cache_alloc(zil_lwb_cache, KM_SLEEP); >> lwb->lwb_zilog = zilog; >> lwb->lwb_blk = *bp; >> + lwb->lwb_slog = slog; >> lwb->lwb_buf = zio_buf_alloc(BP_GET_LSIZE(bp)); >> lwb->lwb_max_txg = txg; >> lwb->lwb_zio = NULL; >> @@ -516,6 +526,7 @@ zil_create(zilog_t *zilog) >> dmu_tx_t *tx = NULL; >> blkptr_t blk; >> int error = 0; >> + boolean_t slog = FALSE; >> >> /* >> * Wait for any previous destroy to complete. >> @@ -544,7 +555,7 @@ zil_create(zilog_t *zilog) >> } >> >> error = zio_alloc_zil(zilog->zl_spa, txg, &blk, NULL, >> - ZIL_MIN_BLKSZ, zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); >> + ZIL_MIN_BLKSZ, &slog); >> >> if (error == 0) >> zil_init_log_chain(zilog, &blk); >> @@ -554,7 +565,7 @@ zil_create(zilog_t *zilog) >> * Allocate a log write buffer (lwb) for the first log block. >> */ >> if (error == 0) >> - lwb = zil_alloc_lwb(zilog, &blk, txg); >> + lwb = zil_alloc_lwb(zilog, &blk, slog, txg); >> >> /* >> * If we just allocated the first log block, commit our transaction >> @@ -885,6 +896,7 @@ static void >> zil_lwb_write_init(zilog_t *zilog, lwb_t *lwb) >> { >> zbookmark_phys_t zb; >> + zio_priority_t prio; >> >> SET_BOOKMARK(&zb, lwb->lwb_blk.blk_cksum.zc_word[ZIL_ZC_OBJSET], >> ZB_ZIL_OBJECT, ZB_ZIL_LEVEL, >> @@ -895,9 +907,13 @@ zil_lwb_write_init(zilog_t *zilog, lwb_t >> ZIO_FLAG_CANFAIL); >> } >> if (lwb->lwb_zio == NULL) { >> + if (zilog->zl_cur_used <= zil_slog_limit || !lwb->lwb_slog) >> + prio = ZIO_PRIORITY_SYNC_WRITE; >> + else >> + prio = ZIO_PRIORITY_ASYNC_WRITE; >> lwb->lwb_zio = zio_rewrite(zilog->zl_root_zio, zilog->zl_spa, >> 0, &lwb->lwb_blk, lwb->lwb_buf, BP_GET_LSIZE(&lwb->lwb_blk), >> - zil_lwb_write_done, lwb, ZIO_PRIORITY_SYNC_WRITE, >> + zil_lwb_write_done, lwb, prio, >> ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE, &zb); >> } >> } >> @@ -917,18 +933,6 @@ uint64_t zil_block_buckets[] = { >> }; >> >> /* >> - * Use the slog as long as the logbias is 'latency' and the current commit size >> - * is less than the limit or the total list size is less than 2X the limit. >> - * Limit checking is disabled by setting zil_slog_limit to UINT64_MAX. >> - */ >> -uint64_t zil_slog_limit = 1024 * 1024; >> -SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, >> - &zil_slog_limit, 0, "Maximal commit size to use SLOG"); >> -#define USE_SLOG(zilog) (((zilog)->zl_logbias == ZFS_LOGBIAS_LATENCY) && \ >> - (((zilog)->zl_cur_used < zil_slog_limit) || \ >> - ((zilog)->zl_itx_list_sz < (zil_slog_limit << 1)))) >> - >> -/* >> * Start a log block write and advance to the next log block. >> * Calls are serialized. >> */ >> @@ -943,6 +947,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >> uint64_t txg; >> uint64_t zil_blksz, wsz; >> int i, error; >> + boolean_t slog; >> >> if (BP_GET_CHECKSUM(&lwb->lwb_blk) == ZIO_CHECKSUM_ZILOG2) { >> zilc = (zil_chain_t *)lwb->lwb_buf; >> @@ -999,8 +1004,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >> >> BP_ZERO(bp); >> /* pass the old blkptr in order to spread log blocks across devs */ >> - error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, >> - USE_SLOG(zilog)); >> + error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, &slog); >> if (error == 0) { >> ASSERT3U(bp->blk_birth, ==, txg); >> bp->blk_cksum = lwb->lwb_blk.blk_cksum; >> @@ -1009,7 +1013,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >> /* >> * Allocate a new log write buffer (lwb). >> */ >> - nlwb = zil_alloc_lwb(zilog, bp, txg); >> + nlwb = zil_alloc_lwb(zilog, bp, slog, txg); >> >> /* Record the block for later vdev flushing */ >> zil_add_block(zilog, &lwb->lwb_blk); >> @@ -1046,12 +1050,13 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >> static lwb_t * >> zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) >> { >> - lr_t *lrc = &itx->itx_lr; /* common log record */ >> - lr_write_t *lrw = (lr_write_t *)lrc; >> + lr_t *lrcb, *lrc = &itx->itx_lr; /* common log record */ >> + lr_write_t *lrwb, *lrw = (lr_write_t *)lrc; >> char *lr_buf; >> uint64_t txg = lrc->lrc_txg; >> uint64_t reclen = lrc->lrc_reclen; >> uint64_t dlen = 0; >> + uint64_t dnow, lwb_sp; >> >> if (lwb == NULL) >> return (NULL); >> @@ -1068,25 +1073,30 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it >> >> zil_lwb_write_init(zilog, lwb); >> >> +cont: >> /* >> * If this record won't fit in the current log block, start a new one. >> + * For WR_NEED_COPY optimize layout for minimal number of chunks, but >> + * try to keep wasted space withing reasonable range (12%). >> */ >> - if (lwb->lwb_nused + reclen + dlen > lwb->lwb_sz) { >> + lwb_sp = lwb->lwb_sz - lwb->lwb_nused; >> + if (reclen > lwb_sp || (reclen + dlen > lwb_sp && >> + lwb_sp < ZIL_MAX_LOG_DATA / 8 && (dlen % ZIL_MAX_LOG_DATA == 0 || >> + lwb_sp < reclen + dlen % ZIL_MAX_LOG_DATA))) { >> lwb = zil_lwb_write_start(zilog, lwb); >> if (lwb == NULL) >> return (NULL); >> zil_lwb_write_init(zilog, lwb); >> ASSERT(LWB_EMPTY(lwb)); >> - if (lwb->lwb_nused + reclen + dlen > lwb->lwb_sz) { >> - txg_wait_synced(zilog->zl_dmu_pool, txg); >> - return (lwb); >> - } >> + lwb_sp = lwb->lwb_sz - lwb->lwb_nused; >> + ASSERT3U(reclen + MIN(dlen, sizeof(uint64_t)), <=, lwb_sp); >> } >> >> + dnow = MIN(dlen, lwb_sp - reclen); >> lr_buf = lwb->lwb_buf + lwb->lwb_nused; >> bcopy(lrc, lr_buf, reclen); >> - lrc = (lr_t *)lr_buf; >> - lrw = (lr_write_t *)lrc; >> + lrcb = (lr_t *)lr_buf; >> + lrwb = (lr_write_t *)lrcb; >> >> /* >> * If it's a write, fetch the data or get its blkptr as appropriate. >> @@ -1098,16 +1108,19 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it >> char *dbuf; >> int error; >> >> - if (dlen) { >> - ASSERT(itx->itx_wr_state == WR_NEED_COPY); >> + if (itx->itx_wr_state == WR_NEED_COPY) { >> dbuf = lr_buf + reclen; >> - lrw->lr_common.lrc_reclen += dlen; >> + lrcb->lrc_reclen += dnow; >> + if (lrwb->lr_length > dnow) >> + lrwb->lr_length = dnow; >> + lrw->lr_offset += dnow; >> + lrw->lr_length -= dnow; >> } else { >> ASSERT(itx->itx_wr_state == WR_INDIRECT); >> dbuf = NULL; >> } >> error = zilog->zl_get_data( >> - itx->itx_private, lrw, dbuf, lwb->lwb_zio); >> + itx->itx_private, lrwb, dbuf, lwb->lwb_zio); >> if (error == EIO) { >> txg_wait_synced(zilog->zl_dmu_pool, txg); >> return (lwb); >> @@ -1126,12 +1139,18 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it >> * equal to the itx sequence number because not all transactions >> * are synchronous, and sometimes spa_sync() gets there first. >> */ >> - lrc->lrc_seq = ++zilog->zl_lr_seq; /* we are single threaded */ >> - lwb->lwb_nused += reclen + dlen; >> + lrcb->lrc_seq = ++zilog->zl_lr_seq; /* we are single threaded */ >> + lwb->lwb_nused += reclen + dnow; >> lwb->lwb_max_txg = MAX(lwb->lwb_max_txg, txg); >> ASSERT3U(lwb->lwb_nused, <=, lwb->lwb_sz); >> ASSERT0(P2PHASE(lwb->lwb_nused, sizeof (uint64_t))); >> >> + dlen -= dnow; >> + if (dlen > 0) { >> + zilog->zl_cur_used += reclen; >> + goto cont; >> + } >> + >> return (lwb); >> } >> >> @@ -1145,7 +1164,6 @@ zil_itx_create(uint64_t txtype, size_t l >> itx = kmem_alloc(offsetof(itx_t, itx_lr) + lrsize, KM_SLEEP); >> itx->itx_lr.lrc_txtype = txtype; >> itx->itx_lr.lrc_reclen = lrsize; >> - itx->itx_sod = lrsize; /* if write & WR_NEED_COPY will be increased */ >> itx->itx_lr.lrc_seq = 0; /* defensive */ >> itx->itx_sync = B_TRUE; /* default is synchronous */ >> >> @@ -1294,11 +1312,8 @@ zil_itx_assign(zilog_t *zilog, itx_t *it >> * this itxg. Save the itxs for release below. >> * This should be rare. >> */ >> - atomic_add_64(&zilog->zl_itx_list_sz, -itxg->itxg_sod); >> - itxg->itxg_sod = 0; >> clean = itxg->itxg_itxs; >> } >> - ASSERT(itxg->itxg_sod == 0); >> itxg->itxg_txg = txg; >> itxs = itxg->itxg_itxs = kmem_zalloc(sizeof (itxs_t), KM_SLEEP); >> >> @@ -1310,8 +1325,6 @@ zil_itx_assign(zilog_t *zilog, itx_t *it >> } >> if (itx->itx_sync) { >> list_insert_tail(&itxs->i_sync_list, itx); >> - atomic_add_64(&zilog->zl_itx_list_sz, itx->itx_sod); >> - itxg->itxg_sod += itx->itx_sod; >> } else { >> avl_tree_t *t = &itxs->i_async_tree; >> uint64_t foid = ((lr_ooo_t *)&itx->itx_lr)->lr_foid; >> @@ -1359,8 +1372,6 @@ zil_clean(zilog_t *zilog, uint64_t synce >> ASSERT3U(itxg->itxg_txg, <=, synced_txg); >> ASSERT(itxg->itxg_txg != 0); >> ASSERT(zilog->zl_clean_taskq != NULL); >> - atomic_add_64(&zilog->zl_itx_list_sz, -itxg->itxg_sod); >> - itxg->itxg_sod = 0; >> clean_me = itxg->itxg_itxs; >> itxg->itxg_itxs = NULL; >> itxg->itxg_txg = 0; >> @@ -1384,7 +1395,6 @@ zil_get_commit_list(zilog_t *zilog) >> { >> uint64_t otxg, txg; >> list_t *commit_list = &zilog->zl_itx_commit_list; >> - uint64_t push_sod = 0; >> >> if (spa_freeze_txg(zilog->zl_spa) != UINT64_MAX) /* ziltest support */ >> otxg = ZILTEST_TXG; >> @@ -1401,12 +1411,9 @@ zil_get_commit_list(zilog_t *zilog) >> } >> >> list_move_tail(commit_list, &itxg->itxg_itxs->i_sync_list); >> - push_sod += itxg->itxg_sod; >> - itxg->itxg_sod = 0; >> >> mutex_exit(&itxg->itxg_lock); >> } >> - atomic_add_64(&zilog->zl_itx_list_sz, -push_sod); >> } >> >> /* >> >> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c >> ============================================================================== >> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Nov 17 20:44:51 2016 (r308781) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Nov 17 21:01:27 2016 (r308782) >> @@ -2908,20 +2908,21 @@ zio_dva_unallocate(zio_t *zio, zio_gang_ >> */ >> int >> zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp, >> - uint64_t size, boolean_t use_slog) >> + uint64_t size, boolean_t *slog) >> { >> int error = 1; >> >> ASSERT(txg > spa_syncing_txg(spa)); >> >> - if (use_slog) { >> - error = metaslab_alloc(spa, spa_log_class(spa), size, >> - new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); >> - } >> - >> - if (error) { >> + error = metaslab_alloc(spa, spa_log_class(spa), size, >> + new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); >> + if (error == 0) { >> + *slog = TRUE; >> + } else { >> error = metaslab_alloc(spa, spa_normal_class(spa), size, >> new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); >> + if (error == 0) >> + *slog = FALSE; >> } >> >> if (error == 0) { >> >> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c >> ============================================================================== >> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Nov 17 20:44:51 2016 (r308781) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Nov 17 21:01:27 2016 (r308782) >> @@ -1387,54 +1387,44 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_ >> { >> uint32_t blocksize = zv->zv_volblocksize; >> zilog_t *zilog = zv->zv_zilog; >> - boolean_t slogging; >> - ssize_t immediate_write_sz; >> + itx_wr_state_t write_state; >> >> if (zil_replaying(zilog, tx)) >> return; >> >> - immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >> - ? 0 : zvol_immediate_write_sz; >> - >> - slogging = spa_has_slogs(zilog->zl_spa) && >> - (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); >> + if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >> + write_state = WR_INDIRECT; >> + else if (!spa_has_slogs(zilog->zl_spa) && >> + resid >= blocksize && blocksize > zvol_immediate_write_sz) >> + write_state = WR_INDIRECT; >> + else if (sync) >> + write_state = WR_COPIED; >> + else >> + write_state = WR_NEED_COPY; >> >> while (resid) { >> itx_t *itx; >> lr_write_t *lr; >> - ssize_t len; >> - itx_wr_state_t write_state; >> + itx_wr_state_t wr_state = write_state; >> + ssize_t len = resid; >> >> - /* >> - * Unlike zfs_log_write() we can be called with >> - * upto DMU_MAX_ACCESS/2 (5MB) writes. >> - */ >> - if (blocksize > immediate_write_sz && !slogging && >> - resid >= blocksize && off % blocksize == 0) { >> - write_state = WR_INDIRECT; /* uses dmu_sync */ >> - len = blocksize; >> - } else if (sync) { >> - write_state = WR_COPIED; >> - len = MIN(ZIL_MAX_LOG_DATA, resid); >> - } else { >> - write_state = WR_NEED_COPY; >> - len = MIN(ZIL_MAX_LOG_DATA, resid); >> - } >> + if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA) >> + wr_state = WR_NEED_COPY; >> + else if (wr_state == WR_INDIRECT) >> + len = MIN(blocksize - P2PHASE(off, blocksize), resid); >> >> itx = zil_itx_create(TX_WRITE, sizeof (*lr) + >> - (write_state == WR_COPIED ? len : 0)); >> + (wr_state == WR_COPIED ? len : 0)); >> lr = (lr_write_t *)&itx->itx_lr; >> - if (write_state == WR_COPIED && dmu_read(zv->zv_objset, >> + if (wr_state == WR_COPIED && dmu_read(zv->zv_objset, >> ZVOL_OBJ, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { >> zil_itx_destroy(itx); >> itx = zil_itx_create(TX_WRITE, sizeof (*lr)); >> lr = (lr_write_t *)&itx->itx_lr; >> - write_state = WR_NEED_COPY; >> + wr_state = WR_NEED_COPY; >> } >> >> - itx->itx_wr_state = write_state; >> - if (write_state == WR_NEED_COPY) >> - itx->itx_sod += len; >> + itx->itx_wr_state = wr_state; >> lr->lr_foid = ZVOL_OBJ; >> lr->lr_offset = off; >> lr->lr_length = len; >> > -- Alexander Motin From owner-svn-src-head@freebsd.org Thu Nov 17 22:21:46 2016 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 3F7CFC4766F for ; Thu, 17 Nov 2016 22:21:46 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (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 932C91B0 for ; Thu, 17 Nov 2016 22:21:45 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wm0-x229.google.com with SMTP id f82so844083wmf.1 for ; Thu, 17 Nov 2016 14:21:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=Xz3mhO/SCwfkIpr7etUeP+bJIADj3cwYJP5c0mMu8eM=; b=cMtGymc4wZoYz4PU7zpl0DOvuIKsRvndlvSDL/3pJqbTzeVZxNNIZV7awr2omL5TPA 3vNU2VgadF5iTPtdE0yN/EoRaJApiYywLkE4YifdJJLs602FbnlJJqSPBwKPPvsqU5SG 6Kgu1yZVvYQ48hpI/wp82nsju0mxYWZNulK+EGzpgD9TSYC3d3iEFC+lCTa4qTUUSrnq 51QssxMfJIKg3tkrIb5v8YfroJrZQE+xGIja+af63s8lbHsDoNFiQLM7t1+ZltvWVjYH QV6zCagKycJKaqBr9gMyqY09ZV04vRd15z81CQ/F7DGqEowqjeO0jVWlRzYOQG9eHaoa 9O9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=Xz3mhO/SCwfkIpr7etUeP+bJIADj3cwYJP5c0mMu8eM=; b=ETWiAq1NQC6dp2yQXcJDw++ewGY4G4eyCk2VMu4omHUSE/Cs8pUaEJMUJPTS6G4pG3 8x+rUgNizuOSMpQXYzh9r0aWVPU373r52ofcH8Hiwn9jQ5kVHOaVMxRKPsKSFXGMaUEc uYyLz/tGOGEikUE+dHPB1/8cXCq3QhNHAyv6eNHdaSgMHyrfCf02eEA7pcEnMr+iPghu kd0cJRsvXFjwkLVqI9PAT8+GSpFACVK2ERy5zBA9Dr0w3NpNwsLC0RY4GVykmP3DuqP5 BckdC+QqfgfibbSUA443ncKxm8/pUIo1VOrZbuEm/oRVoDNB9+Ny8a+oKmAmmXPurWgr gB1w== X-Gm-Message-State: ABUngvfAzcG7skJPxazugaQAOHRtAwNvPKQH7QSAFSKPxFDVNwsBz8Er0jBs+5VHdxKvBEY7 X-Received: by 10.28.37.2 with SMTP id l2mr5450361wml.86.1479421304019; Thu, 17 Nov 2016 14:21:44 -0800 (PST) Received: from [10.10.1.58] ([185.97.61.26]) by smtp.gmail.com with ESMTPSA id bj1sm5517572wjc.17.2016.11.17.14.21.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Nov 2016 14:21:42 -0800 (PST) Subject: Re: svn commit: r308782 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201611172101.uAHL1R2O009871@repo.freebsd.org> <79c521bc-3186-10a5-d553-12072523f439@multiplay.co.uk> <725f293e-3d3b-1248-4900-acee5659d382@FreeBSD.org> From: Steven Hartland Message-ID: <7675c768-c1b1-108b-b651-28b6184f8176@multiplay.co.uk> Date: Thu, 17 Nov 2016 22:22:00 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <725f293e-3d3b-1248-4900-acee5659d382@FreeBSD.org> 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: Thu, 17 Nov 2016 22:21:46 -0000 Thanks, looks like the PR needs a rebase before it can be merged. On 17/11/2016 22:11, Alexander Motin wrote: > It is in OpenZFS review queue now: > https://github.com/openzfs/openzfs/pull/219 Welcome to comment there to > speed up the process. > > On 17.11.2016 13:43, Steven Hartland wrote: >> Is this something that should be upstreamed? >> >> On 17/11/2016 21:01, Alexander Motin wrote: >>> Author: mav >>> Date: Thu Nov 17 21:01:27 2016 >>> New Revision: 308782 >>> URL: https://svnweb.freebsd.org/changeset/base/308782 >>> >>> Log: >>> After some ZIL changes 6 years ago zil_slog_limit got partially broken >>> due to zl_itx_list_sz not updated when async itx'es upgraded to sync. >>> Actually because of other changes about that time zl_itx_list_sz is not >>> really required to implement the functionality, so this patch removes >>> some unneeded broken code and variables. >>> >>> Original idea of zil_slog_limit was to reduce chance of SLOG abuse by >>> single heavy logger, that increased latency for other (more latency critical) >>> loggers, by pushing heavy log out into the main pool instead of SLOG. Beside >>> huge latency increase for heavy writers, this implementation caused double >>> write of all data, since the log records were explicitly prepared for SLOG. >>> Since we now have I/O scheduler, I've found it can be much more efficient >>> to reduce priority of heavy logger SLOG writes from ZIO_PRIORITY_SYNC_WRITE >>> to ZIO_PRIORITY_ASYNC_WRITE, while still leave them on SLOG. >>> >>> Existing ZIL implementation had problem with space efficiency when it >>> has to write large chunks of data into log blocks of limited size. In some >>> cases efficiency stopped to almost as low as 50%. In case of ZIL stored on >>> spinning rust, that also reduced log write speed in half, since head had to >>> uselessly fly over allocated but not written areas. This change improves >>> the situation by offloading problematic operations from z*_log_write() to >>> zil_lwb_commit(), which knows real situation of log blocks allocation and >>> can split large requests into pieces much more efficiently. Also as side >>> effect it removes one of two data copy operations done by ZIL code WR_COPIED >>> case. >>> >>> While there, untangle and unify code of z*_log_write() functions. >>> Also zfs_log_write() alike to zvol_log_write() can now handle writes crossing >>> block boundary, that may also improve efficiency if ZPL is made to do that. >>> >>> Sponsored by: iXsystems, Inc. >>> >>> Modified: >>> head/cddl/contrib/opensolaris/cmd/ztest/ztest.c >>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h >>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h >>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h >>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c >>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c >>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c >>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c >>> >>> Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c >>> ============================================================================== >>> --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Nov 17 20:44:51 2016 (r308781) >>> +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Nov 17 21:01:27 2016 (r308782) >>> @@ -1371,7 +1371,6 @@ ztest_log_write(ztest_ds_t *zd, dmu_tx_t >>> itx->itx_private = zd; >>> itx->itx_wr_state = write_state; >>> itx->itx_sync = (ztest_random(8) == 0); >>> - itx->itx_sod += (write_state == WR_NEED_COPY ? lr->lr_length : 0); >>> >>> bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, >>> sizeof (*lr) - sizeof (lr_t)); >>> >>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h >>> ============================================================================== >>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Nov 17 20:44:51 2016 (r308781) >>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Nov 17 21:01:27 2016 (r308782) >>> @@ -369,7 +369,6 @@ typedef struct itx { >>> void *itx_private; /* type-specific opaque data */ >>> itx_wr_state_t itx_wr_state; /* write state */ >>> uint8_t itx_sync; /* synchronous transaction */ >>> - uint64_t itx_sod; /* record size on disk */ >>> uint64_t itx_oid; /* object id */ >>> lr_t itx_lr; /* common part of log record */ >>> /* followed by type-specific part of lr_xx_t and its immediate data */ >>> >>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h >>> ============================================================================== >>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Nov 17 20:44:51 2016 (r308781) >>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Nov 17 21:01:27 2016 (r308782) >>> @@ -42,6 +42,7 @@ extern "C" { >>> typedef struct lwb { >>> zilog_t *lwb_zilog; /* back pointer to log struct */ >>> blkptr_t lwb_blk; /* on disk address of this log blk */ >>> + boolean_t lwb_slog; /* lwb_blk is on SLOG device */ >>> int lwb_nused; /* # used bytes in buffer */ >>> int lwb_sz; /* size of block and buffer */ >>> char *lwb_buf; /* log write buffer */ >>> @@ -62,7 +63,6 @@ typedef struct itxs { >>> typedef struct itxg { >>> kmutex_t itxg_lock; /* lock for this structure */ >>> uint64_t itxg_txg; /* txg for this chain */ >>> - uint64_t itxg_sod; /* total size on disk for this txg */ >>> itxs_t *itxg_itxs; /* sync and async itxs */ >>> } itxg_t; >>> >>> @@ -120,7 +120,6 @@ struct zilog { >>> kcondvar_t zl_cv_batch[2]; /* batch condition variables */ >>> itxg_t zl_itxg[TXG_SIZE]; /* intent log txg chains */ >>> list_t zl_itx_commit_list; /* itx list to be committed */ >>> - uint64_t zl_itx_list_sz; /* total size of records on list */ >>> uint64_t zl_cur_used; /* current commit log size used */ >>> list_t zl_lwb_list; /* in-flight log write list */ >>> kmutex_t zl_vdev_lock; /* protects zl_vdev_tree */ >>> @@ -142,6 +141,8 @@ typedef struct zil_bp_node { >>> >>> #define ZIL_MAX_LOG_DATA (SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t) - \ >>> sizeof (lr_write_t)) >>> +#define ZIL_MAX_COPIED_DATA \ >>> + ((SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t)) / 2 - sizeof (lr_write_t)) >>> >>> #ifdef __cplusplus >>> } >>> >>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h >>> ============================================================================== >>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Nov 17 20:44:51 2016 (r308781) >>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Nov 17 21:01:27 2016 (r308782) >>> @@ -547,7 +547,7 @@ extern zio_t *zio_free_sync(zio_t *pio, >>> const blkptr_t *bp, uint64_t size, enum zio_flag flags); >>> >>> extern int zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, >>> - blkptr_t *old_bp, uint64_t size, boolean_t use_slog); >>> + blkptr_t *old_bp, uint64_t size, boolean_t *slog); >>> extern void zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp); >>> extern void zio_flush(zio_t *zio, vdev_t *vd); >>> extern zio_t *zio_trim(zio_t *zio, spa_t *spa, vdev_t *vd, uint64_t offset, >>> >>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c >>> ============================================================================== >>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Thu Nov 17 20:44:51 2016 (r308781) >>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Thu Nov 17 21:01:27 2016 (r308782) >>> @@ -464,20 +464,17 @@ void >>> zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype, >>> znode_t *zp, offset_t off, ssize_t resid, int ioflag) >>> { >>> + uint32_t blocksize = zp->z_blksz; >>> itx_wr_state_t write_state; >>> - boolean_t slogging; >>> uintptr_t fsync_cnt; >>> - ssize_t immediate_write_sz; >>> >>> if (zil_replaying(zilog, tx) || zp->z_unlinked) >>> return; >>> >>> - immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >>> - ? 0 : zfs_immediate_write_sz; >>> - >>> - slogging = spa_has_slogs(zilog->zl_spa) && >>> - (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); >>> - if (resid > immediate_write_sz && !slogging && resid <= zp->z_blksz) >>> + if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >>> + write_state = WR_INDIRECT; >>> + else if (!spa_has_slogs(zilog->zl_spa) && >>> + resid >= zfs_immediate_write_sz) >>> write_state = WR_INDIRECT; >>> else if (ioflag & (FSYNC | FDSYNC)) >>> write_state = WR_COPIED; >>> @@ -491,30 +488,26 @@ zfs_log_write(zilog_t *zilog, dmu_tx_t * >>> while (resid) { >>> itx_t *itx; >>> lr_write_t *lr; >>> - ssize_t len; >>> + itx_wr_state_t wr_state = write_state; >>> + ssize_t len = resid; >>> >>> - /* >>> - * If the write would overflow the largest block then split it. >>> - */ >>> - if (write_state != WR_INDIRECT && resid > ZIL_MAX_LOG_DATA) >>> - len = SPA_OLD_MAXBLOCKSIZE >> 1; >>> - else >>> - len = resid; >>> + if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA) >>> + wr_state = WR_NEED_COPY; >>> + else if (wr_state == WR_INDIRECT) >>> + len = MIN(blocksize - P2PHASE(off, blocksize), resid); >>> >>> itx = zil_itx_create(txtype, sizeof (*lr) + >>> - (write_state == WR_COPIED ? len : 0)); >>> + (wr_state == WR_COPIED ? len : 0)); >>> lr = (lr_write_t *)&itx->itx_lr; >>> - if (write_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os, >>> + if (wr_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os, >>> zp->z_id, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { >>> zil_itx_destroy(itx); >>> itx = zil_itx_create(txtype, sizeof (*lr)); >>> lr = (lr_write_t *)&itx->itx_lr; >>> - write_state = WR_NEED_COPY; >>> + wr_state = WR_NEED_COPY; >>> } >>> >>> - itx->itx_wr_state = write_state; >>> - if (write_state == WR_NEED_COPY) >>> - itx->itx_sod += len; >>> + itx->itx_wr_state = wr_state; >>> lr->lr_foid = zp->z_id; >>> lr->lr_offset = off; >>> lr->lr_length = len; >>> >>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c >>> ============================================================================== >>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 20:44:51 2016 (r308781) >>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 21:01:27 2016 (r308782) >>> @@ -88,6 +88,15 @@ SYSCTL_DECL(_vfs_zfs_trim); >>> SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enabled, CTLFLAG_RDTUN, &zfs_trim_enabled, 0, >>> "Enable ZFS TRIM"); >>> >>> +/* >>> + * Limit SLOG write size per commit executed with synchronous priority. >>> + * Any writes above that executed with lower (asynchronous) priority to >>> + * limit potential SLOG device abuse by single active ZIL writer. >>> + */ >>> +uint64_t zil_slog_limit = 768 * 1024; >>> +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, >>> + &zil_slog_limit, 0, "Maximal SLOG commit size with sync priority"); >>> + >>> static kmem_cache_t *zil_lwb_cache; >>> >>> #define LWB_EMPTY(lwb) ((BP_GET_LSIZE(&lwb->lwb_blk) - \ >>> @@ -447,13 +456,14 @@ zil_free_log_record(zilog_t *zilog, lr_t >>> } >>> >>> static lwb_t * >>> -zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, uint64_t txg) >>> +zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t slog, uint64_t txg) >>> { >>> lwb_t *lwb; >>> >>> lwb = kmem_cache_alloc(zil_lwb_cache, KM_SLEEP); >>> lwb->lwb_zilog = zilog; >>> lwb->lwb_blk = *bp; >>> + lwb->lwb_slog = slog; >>> lwb->lwb_buf = zio_buf_alloc(BP_GET_LSIZE(bp)); >>> lwb->lwb_max_txg = txg; >>> lwb->lwb_zio = NULL; >>> @@ -516,6 +526,7 @@ zil_create(zilog_t *zilog) >>> dmu_tx_t *tx = NULL; >>> blkptr_t blk; >>> int error = 0; >>> + boolean_t slog = FALSE; >>> >>> /* >>> * Wait for any previous destroy to complete. >>> @@ -544,7 +555,7 @@ zil_create(zilog_t *zilog) >>> } >>> >>> error = zio_alloc_zil(zilog->zl_spa, txg, &blk, NULL, >>> - ZIL_MIN_BLKSZ, zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); >>> + ZIL_MIN_BLKSZ, &slog); >>> >>> if (error == 0) >>> zil_init_log_chain(zilog, &blk); >>> @@ -554,7 +565,7 @@ zil_create(zilog_t *zilog) >>> * Allocate a log write buffer (lwb) for the first log block. >>> */ >>> if (error == 0) >>> - lwb = zil_alloc_lwb(zilog, &blk, txg); >>> + lwb = zil_alloc_lwb(zilog, &blk, slog, txg); >>> >>> /* >>> * If we just allocated the first log block, commit our transaction >>> @@ -885,6 +896,7 @@ static void >>> zil_lwb_write_init(zilog_t *zilog, lwb_t *lwb) >>> { >>> zbookmark_phys_t zb; >>> + zio_priority_t prio; >>> >>> SET_BOOKMARK(&zb, lwb->lwb_blk.blk_cksum.zc_word[ZIL_ZC_OBJSET], >>> ZB_ZIL_OBJECT, ZB_ZIL_LEVEL, >>> @@ -895,9 +907,13 @@ zil_lwb_write_init(zilog_t *zilog, lwb_t >>> ZIO_FLAG_CANFAIL); >>> } >>> if (lwb->lwb_zio == NULL) { >>> + if (zilog->zl_cur_used <= zil_slog_limit || !lwb->lwb_slog) >>> + prio = ZIO_PRIORITY_SYNC_WRITE; >>> + else >>> + prio = ZIO_PRIORITY_ASYNC_WRITE; >>> lwb->lwb_zio = zio_rewrite(zilog->zl_root_zio, zilog->zl_spa, >>> 0, &lwb->lwb_blk, lwb->lwb_buf, BP_GET_LSIZE(&lwb->lwb_blk), >>> - zil_lwb_write_done, lwb, ZIO_PRIORITY_SYNC_WRITE, >>> + zil_lwb_write_done, lwb, prio, >>> ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE, &zb); >>> } >>> } >>> @@ -917,18 +933,6 @@ uint64_t zil_block_buckets[] = { >>> }; >>> >>> /* >>> - * Use the slog as long as the logbias is 'latency' and the current commit size >>> - * is less than the limit or the total list size is less than 2X the limit. >>> - * Limit checking is disabled by setting zil_slog_limit to UINT64_MAX. >>> - */ >>> -uint64_t zil_slog_limit = 1024 * 1024; >>> -SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, >>> - &zil_slog_limit, 0, "Maximal commit size to use SLOG"); >>> -#define USE_SLOG(zilog) (((zilog)->zl_logbias == ZFS_LOGBIAS_LATENCY) && \ >>> - (((zilog)->zl_cur_used < zil_slog_limit) || \ >>> - ((zilog)->zl_itx_list_sz < (zil_slog_limit << 1)))) >>> - >>> -/* >>> * Start a log block write and advance to the next log block. >>> * Calls are serialized. >>> */ >>> @@ -943,6 +947,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >>> uint64_t txg; >>> uint64_t zil_blksz, wsz; >>> int i, error; >>> + boolean_t slog; >>> >>> if (BP_GET_CHECKSUM(&lwb->lwb_blk) == ZIO_CHECKSUM_ZILOG2) { >>> zilc = (zil_chain_t *)lwb->lwb_buf; >>> @@ -999,8 +1004,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >>> >>> BP_ZERO(bp); >>> /* pass the old blkptr in order to spread log blocks across devs */ >>> - error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, >>> - USE_SLOG(zilog)); >>> + error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, &slog); >>> if (error == 0) { >>> ASSERT3U(bp->blk_birth, ==, txg); >>> bp->blk_cksum = lwb->lwb_blk.blk_cksum; >>> @@ -1009,7 +1013,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >>> /* >>> * Allocate a new log write buffer (lwb). >>> */ >>> - nlwb = zil_alloc_lwb(zilog, bp, txg); >>> + nlwb = zil_alloc_lwb(zilog, bp, slog, txg); >>> >>> /* Record the block for later vdev flushing */ >>> zil_add_block(zilog, &lwb->lwb_blk); >>> @@ -1046,12 +1050,13 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >>> static lwb_t * >>> zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) >>> { >>> - lr_t *lrc = &itx->itx_lr; /* common log record */ >>> - lr_write_t *lrw = (lr_write_t *)lrc; >>> + lr_t *lrcb, *lrc = &itx->itx_lr; /* common log record */ >>> + lr_write_t *lrwb, *lrw = (lr_write_t *)lrc; >>> char *lr_buf; >>> uint64_t txg = lrc->lrc_txg; >>> uint64_t reclen = lrc->lrc_reclen; >>> uint64_t dlen = 0; >>> + uint64_t dnow, lwb_sp; >>> >>> if (lwb == NULL) >>> return (NULL); >>> @@ -1068,25 +1073,30 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it >>> >>> zil_lwb_write_init(zilog, lwb); >>> >>> +cont: >>> /* >>> * If this record won't fit in the current log block, start a new one. >>> + * For WR_NEED_COPY optimize layout for minimal number of chunks, but >>> + * try to keep wasted space withing reasonable range (12%). >>> */ >>> - if (lwb->lwb_nused + reclen + dlen > lwb->lwb_sz) { >>> + lwb_sp = lwb->lwb_sz - lwb->lwb_nused; >>> + if (reclen > lwb_sp || (reclen + dlen > lwb_sp && >>> + lwb_sp < ZIL_MAX_LOG_DATA / 8 && (dlen % ZIL_MAX_LOG_DATA == 0 || >>> + lwb_sp < reclen + dlen % ZIL_MAX_LOG_DATA))) { >>> lwb = zil_lwb_write_start(zilog, lwb); >>> if (lwb == NULL) >>> return (NULL); >>> zil_lwb_write_init(zilog, lwb); >>> ASSERT(LWB_EMPTY(lwb)); >>> - if (lwb->lwb_nused + reclen + dlen > lwb->lwb_sz) { >>> - txg_wait_synced(zilog->zl_dmu_pool, txg); >>> - return (lwb); >>> - } >>> + lwb_sp = lwb->lwb_sz - lwb->lwb_nused; >>> + ASSERT3U(reclen + MIN(dlen, sizeof(uint64_t)), <=, lwb_sp); >>> } >>> >>> + dnow = MIN(dlen, lwb_sp - reclen); >>> lr_buf = lwb->lwb_buf + lwb->lwb_nused; >>> bcopy(lrc, lr_buf, reclen); >>> - lrc = (lr_t *)lr_buf; >>> - lrw = (lr_write_t *)lrc; >>> + lrcb = (lr_t *)lr_buf; >>> + lrwb = (lr_write_t *)lrcb; >>> >>> /* >>> * If it's a write, fetch the data or get its blkptr as appropriate. >>> @@ -1098,16 +1108,19 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it >>> char *dbuf; >>> int error; >>> >>> - if (dlen) { >>> - ASSERT(itx->itx_wr_state == WR_NEED_COPY); >>> + if (itx->itx_wr_state == WR_NEED_COPY) { >>> dbuf = lr_buf + reclen; >>> - lrw->lr_common.lrc_reclen += dlen; >>> + lrcb->lrc_reclen += dnow; >>> + if (lrwb->lr_length > dnow) >>> + lrwb->lr_length = dnow; >>> + lrw->lr_offset += dnow; >>> + lrw->lr_length -= dnow; >>> } else { >>> ASSERT(itx->itx_wr_state == WR_INDIRECT); >>> dbuf = NULL; >>> } >>> error = zilog->zl_get_data( >>> - itx->itx_private, lrw, dbuf, lwb->lwb_zio); >>> + itx->itx_private, lrwb, dbuf, lwb->lwb_zio); >>> if (error == EIO) { >>> txg_wait_synced(zilog->zl_dmu_pool, txg); >>> return (lwb); >>> @@ -1126,12 +1139,18 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it >>> * equal to the itx sequence number because not all transactions >>> * are synchronous, and sometimes spa_sync() gets there first. >>> */ >>> - lrc->lrc_seq = ++zilog->zl_lr_seq; /* we are single threaded */ >>> - lwb->lwb_nused += reclen + dlen; >>> + lrcb->lrc_seq = ++zilog->zl_lr_seq; /* we are single threaded */ >>> + lwb->lwb_nused += reclen + dnow; >>> lwb->lwb_max_txg = MAX(lwb->lwb_max_txg, txg); >>> ASSERT3U(lwb->lwb_nused, <=, lwb->lwb_sz); >>> ASSERT0(P2PHASE(lwb->lwb_nused, sizeof (uint64_t))); >>> >>> + dlen -= dnow; >>> + if (dlen > 0) { >>> + zilog->zl_cur_used += reclen; >>> + goto cont; >>> + } >>> + >>> return (lwb); >>> } >>> >>> @@ -1145,7 +1164,6 @@ zil_itx_create(uint64_t txtype, size_t l >>> itx = kmem_alloc(offsetof(itx_t, itx_lr) + lrsize, KM_SLEEP); >>> itx->itx_lr.lrc_txtype = txtype; >>> itx->itx_lr.lrc_reclen = lrsize; >>> - itx->itx_sod = lrsize; /* if write & WR_NEED_COPY will be increased */ >>> itx->itx_lr.lrc_seq = 0; /* defensive */ >>> itx->itx_sync = B_TRUE; /* default is synchronous */ >>> >>> @@ -1294,11 +1312,8 @@ zil_itx_assign(zilog_t *zilog, itx_t *it >>> * this itxg. Save the itxs for release below. >>> * This should be rare. >>> */ >>> - atomic_add_64(&zilog->zl_itx_list_sz, -itxg->itxg_sod); >>> - itxg->itxg_sod = 0; >>> clean = itxg->itxg_itxs; >>> } >>> - ASSERT(itxg->itxg_sod == 0); >>> itxg->itxg_txg = txg; >>> itxs = itxg->itxg_itxs = kmem_zalloc(sizeof (itxs_t), KM_SLEEP); >>> >>> @@ -1310,8 +1325,6 @@ zil_itx_assign(zilog_t *zilog, itx_t *it >>> } >>> if (itx->itx_sync) { >>> list_insert_tail(&itxs->i_sync_list, itx); >>> - atomic_add_64(&zilog->zl_itx_list_sz, itx->itx_sod); >>> - itxg->itxg_sod += itx->itx_sod; >>> } else { >>> avl_tree_t *t = &itxs->i_async_tree; >>> uint64_t foid = ((lr_ooo_t *)&itx->itx_lr)->lr_foid; >>> @@ -1359,8 +1372,6 @@ zil_clean(zilog_t *zilog, uint64_t synce >>> ASSERT3U(itxg->itxg_txg, <=, synced_txg); >>> ASSERT(itxg->itxg_txg != 0); >>> ASSERT(zilog->zl_clean_taskq != NULL); >>> - atomic_add_64(&zilog->zl_itx_list_sz, -itxg->itxg_sod); >>> - itxg->itxg_sod = 0; >>> clean_me = itxg->itxg_itxs; >>> itxg->itxg_itxs = NULL; >>> itxg->itxg_txg = 0; >>> @@ -1384,7 +1395,6 @@ zil_get_commit_list(zilog_t *zilog) >>> { >>> uint64_t otxg, txg; >>> list_t *commit_list = &zilog->zl_itx_commit_list; >>> - uint64_t push_sod = 0; >>> >>> if (spa_freeze_txg(zilog->zl_spa) != UINT64_MAX) /* ziltest support */ >>> otxg = ZILTEST_TXG; >>> @@ -1401,12 +1411,9 @@ zil_get_commit_list(zilog_t *zilog) >>> } >>> >>> list_move_tail(commit_list, &itxg->itxg_itxs->i_sync_list); >>> - push_sod += itxg->itxg_sod; >>> - itxg->itxg_sod = 0; >>> >>> mutex_exit(&itxg->itxg_lock); >>> } >>> - atomic_add_64(&zilog->zl_itx_list_sz, -push_sod); >>> } >>> >>> /* >>> >>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c >>> ============================================================================== >>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Nov 17 20:44:51 2016 (r308781) >>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Nov 17 21:01:27 2016 (r308782) >>> @@ -2908,20 +2908,21 @@ zio_dva_unallocate(zio_t *zio, zio_gang_ >>> */ >>> int >>> zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp, >>> - uint64_t size, boolean_t use_slog) >>> + uint64_t size, boolean_t *slog) >>> { >>> int error = 1; >>> >>> ASSERT(txg > spa_syncing_txg(spa)); >>> >>> - if (use_slog) { >>> - error = metaslab_alloc(spa, spa_log_class(spa), size, >>> - new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); >>> - } >>> - >>> - if (error) { >>> + error = metaslab_alloc(spa, spa_log_class(spa), size, >>> + new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); >>> + if (error == 0) { >>> + *slog = TRUE; >>> + } else { >>> error = metaslab_alloc(spa, spa_normal_class(spa), size, >>> new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); >>> + if (error == 0) >>> + *slog = FALSE; >>> } >>> >>> if (error == 0) { >>> >>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c >>> ============================================================================== >>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Nov 17 20:44:51 2016 (r308781) >>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Nov 17 21:01:27 2016 (r308782) >>> @@ -1387,54 +1387,44 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_ >>> { >>> uint32_t blocksize = zv->zv_volblocksize; >>> zilog_t *zilog = zv->zv_zilog; >>> - boolean_t slogging; >>> - ssize_t immediate_write_sz; >>> + itx_wr_state_t write_state; >>> >>> if (zil_replaying(zilog, tx)) >>> return; >>> >>> - immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >>> - ? 0 : zvol_immediate_write_sz; >>> - >>> - slogging = spa_has_slogs(zilog->zl_spa) && >>> - (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); >>> + if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >>> + write_state = WR_INDIRECT; >>> + else if (!spa_has_slogs(zilog->zl_spa) && >>> + resid >= blocksize && blocksize > zvol_immediate_write_sz) >>> + write_state = WR_INDIRECT; >>> + else if (sync) >>> + write_state = WR_COPIED; >>> + else >>> + write_state = WR_NEED_COPY; >>> >>> while (resid) { >>> itx_t *itx; >>> lr_write_t *lr; >>> - ssize_t len; >>> - itx_wr_state_t write_state; >>> + itx_wr_state_t wr_state = write_state; >>> + ssize_t len = resid; >>> >>> - /* >>> - * Unlike zfs_log_write() we can be called with >>> - * upto DMU_MAX_ACCESS/2 (5MB) writes. >>> - */ >>> - if (blocksize > immediate_write_sz && !slogging && >>> - resid >= blocksize && off % blocksize == 0) { >>> - write_state = WR_INDIRECT; /* uses dmu_sync */ >>> - len = blocksize; >>> - } else if (sync) { >>> - write_state = WR_COPIED; >>> - len = MIN(ZIL_MAX_LOG_DATA, resid); >>> - } else { >>> - write_state = WR_NEED_COPY; >>> - len = MIN(ZIL_MAX_LOG_DATA, resid); >>> - } >>> + if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA) >>> + wr_state = WR_NEED_COPY; >>> + else if (wr_state == WR_INDIRECT) >>> + len = MIN(blocksize - P2PHASE(off, blocksize), resid); >>> >>> itx = zil_itx_create(TX_WRITE, sizeof (*lr) + >>> - (write_state == WR_COPIED ? len : 0)); >>> + (wr_state == WR_COPIED ? len : 0)); >>> lr = (lr_write_t *)&itx->itx_lr; >>> - if (write_state == WR_COPIED && dmu_read(zv->zv_objset, >>> + if (wr_state == WR_COPIED && dmu_read(zv->zv_objset, >>> ZVOL_OBJ, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { >>> zil_itx_destroy(itx); >>> itx = zil_itx_create(TX_WRITE, sizeof (*lr)); >>> lr = (lr_write_t *)&itx->itx_lr; >>> - write_state = WR_NEED_COPY; >>> + wr_state = WR_NEED_COPY; >>> } >>> >>> - itx->itx_wr_state = write_state; >>> - if (write_state == WR_NEED_COPY) >>> - itx->itx_sod += len; >>> + itx->itx_wr_state = wr_state; >>> lr->lr_foid = ZVOL_OBJ; >>> lr->lr_offset = off; >>> lr->lr_length = len; >>> From owner-svn-src-head@freebsd.org Thu Nov 17 22:27:20 2016 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 75FC0C4771E; Thu, 17 Nov 2016 22:27:20 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (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 32E057F5; Thu, 17 Nov 2016 22:27:20 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-pg0-x242.google.com with SMTP id x23so18639675pgx.3; Thu, 17 Nov 2016 14:27:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=NntohxvoNzBXShXlfQqLpePnuwiFQasnteDUUISiigE=; b=H8CQkoYKsG1MDeqmevxY+xK0c++SOIj/J6JgvkTFhSYnIq0+jyCxpJ1eic2AvbSTlJ Ntvl0eDKDrOrtmOW6LzFTWZypHtvZ041INjTp7DqVJWLQ6Ab3q5ZVSQ1xNWhkNxepf/T oRavuB0QShGygqRpKA0gmOGeq7O7Zn1mRsJkzgduhpspXx8vTXaWx659ZeC7qJ0N74Az pPva+5W7nSzbitArzgQlw4M6E/Qxzkb+mKgOhj6rly25v942xs0Xjd8QNXTCByw6e2DB zFgIrfIv1F1MHF9r0snn+bGzoSwEyxhcJS4wb9SeQjdkhEmXqT69Ze/kESuKGTTHm8ZB ygFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=NntohxvoNzBXShXlfQqLpePnuwiFQasnteDUUISiigE=; b=BWkdHl6S7wGfcWiTWckB34lXu6QxNrrw5rH4Me6hmUCig6mXSuJDndV+qW+Y/D1vad /kZzObx4tqrd39mZXGMzUnk3gNCWnQ7lncV+7op4Tyl+BkoZqHHkfeUXusMjKD5MyYvO cuyk86MeU4y1I+oVnRmKI4YUUPPo1mLkVmBhKIx/bWxsivWCl/eRk20y0+y+/Qf3d1yc zESokcHCUN0YAkttrnMdGLvVCO5dCV9CNI8wVfJ/7elYbr+OguLCgzBo46mxeVw8l4Bs aqLvXgyW4c4FfmLGDdQdzX7mgRBL86CaTGUY2MzR4WY8iX9fFMNyKIAZtYyRKdmGSKcS IH5Q== X-Gm-Message-State: ABUngvf93GmC0bsKxdzlyAabdl0j/OYBC3vsXCc9z+YCrmXOicJvIVOo/9KKaQOtGmWZ2Q== X-Received: by 10.98.76.8 with SMTP id z8mr7443455pfa.167.1479421638789; Thu, 17 Nov 2016 14:27:18 -0800 (PST) Received: from mavbook.mavhome.dp.ua ([12.229.62.29]) by smtp.gmail.com with ESMTPSA id v82sm10752594pfi.6.2016.11.17.14.27.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Nov 2016 14:27:18 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r308782 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys To: Steven Hartland , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201611172101.uAHL1R2O009871@repo.freebsd.org> <79c521bc-3186-10a5-d553-12072523f439@multiplay.co.uk> <725f293e-3d3b-1248-4900-acee5659d382@FreeBSD.org> <7675c768-c1b1-108b-b651-28b6184f8176@multiplay.co.uk> From: Alexander Motin Message-ID: <71f021c6-5847-5808-20d2-4cc84925af46@FreeBSD.org> Date: Thu, 17 Nov 2016 14:27:16 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <7675c768-c1b1-108b-b651-28b6184f8176@multiplay.co.uk> Content-Type: text/plain; charset=utf-8 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: Thu, 17 Nov 2016 22:27:20 -0000 Rebased, but that is not the first time. What it really needs is reviews. On 17.11.2016 14:22, Steven Hartland wrote: > Thanks, looks like the PR needs a rebase before it can be merged. > > On 17/11/2016 22:11, Alexander Motin wrote: >> It is in OpenZFS review queue now: >> https://github.com/openzfs/openzfs/pull/219 Welcome to comment there to >> speed up the process. >> >> On 17.11.2016 13:43, Steven Hartland wrote: >>> Is this something that should be upstreamed? >>> >>> On 17/11/2016 21:01, Alexander Motin wrote: >>>> Author: mav >>>> Date: Thu Nov 17 21:01:27 2016 >>>> New Revision: 308782 >>>> URL: https://svnweb.freebsd.org/changeset/base/308782 >>>> >>>> Log: >>>> After some ZIL changes 6 years ago zil_slog_limit got partially broken >>>> due to zl_itx_list_sz not updated when async itx'es upgraded to sync. >>>> Actually because of other changes about that time zl_itx_list_sz is not >>>> really required to implement the functionality, so this patch removes >>>> some unneeded broken code and variables. >>>> >>>> Original idea of zil_slog_limit was to reduce chance of SLOG abuse by >>>> single heavy logger, that increased latency for other (more latency critical) >>>> loggers, by pushing heavy log out into the main pool instead of SLOG. Beside >>>> huge latency increase for heavy writers, this implementation caused double >>>> write of all data, since the log records were explicitly prepared for SLOG. >>>> Since we now have I/O scheduler, I've found it can be much more efficient >>>> to reduce priority of heavy logger SLOG writes from ZIO_PRIORITY_SYNC_WRITE >>>> to ZIO_PRIORITY_ASYNC_WRITE, while still leave them on SLOG. >>>> >>>> Existing ZIL implementation had problem with space efficiency when it >>>> has to write large chunks of data into log blocks of limited size. In some >>>> cases efficiency stopped to almost as low as 50%. In case of ZIL stored on >>>> spinning rust, that also reduced log write speed in half, since head had to >>>> uselessly fly over allocated but not written areas. This change improves >>>> the situation by offloading problematic operations from z*_log_write() to >>>> zil_lwb_commit(), which knows real situation of log blocks allocation and >>>> can split large requests into pieces much more efficiently. Also as side >>>> effect it removes one of two data copy operations done by ZIL code WR_COPIED >>>> case. >>>> >>>> While there, untangle and unify code of z*_log_write() functions. >>>> Also zfs_log_write() alike to zvol_log_write() can now handle writes crossing >>>> block boundary, that may also improve efficiency if ZPL is made to do that. >>>> >>>> Sponsored by: iXsystems, Inc. >>>> >>>> Modified: >>>> head/cddl/contrib/opensolaris/cmd/ztest/ztest.c >>>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h >>>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h >>>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h >>>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c >>>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c >>>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c >>>> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c >>>> >>>> Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c >>>> ============================================================================== >>>> --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Nov 17 20:44:51 2016 (r308781) >>>> +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Nov 17 21:01:27 2016 (r308782) >>>> @@ -1371,7 +1371,6 @@ ztest_log_write(ztest_ds_t *zd, dmu_tx_t >>>> itx->itx_private = zd; >>>> itx->itx_wr_state = write_state; >>>> itx->itx_sync = (ztest_random(8) == 0); >>>> - itx->itx_sod += (write_state == WR_NEED_COPY ? lr->lr_length : 0); >>>> >>>> bcopy(&lr->lr_common + 1, &itx->itx_lr + 1, >>>> sizeof (*lr) - sizeof (lr_t)); >>>> >>>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h >>>> ============================================================================== >>>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Nov 17 20:44:51 2016 (r308781) >>>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Nov 17 21:01:27 2016 (r308782) >>>> @@ -369,7 +369,6 @@ typedef struct itx { >>>> void *itx_private; /* type-specific opaque data */ >>>> itx_wr_state_t itx_wr_state; /* write state */ >>>> uint8_t itx_sync; /* synchronous transaction */ >>>> - uint64_t itx_sod; /* record size on disk */ >>>> uint64_t itx_oid; /* object id */ >>>> lr_t itx_lr; /* common part of log record */ >>>> /* followed by type-specific part of lr_xx_t and its immediate data */ >>>> >>>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h >>>> ============================================================================== >>>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Nov 17 20:44:51 2016 (r308781) >>>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Thu Nov 17 21:01:27 2016 (r308782) >>>> @@ -42,6 +42,7 @@ extern "C" { >>>> typedef struct lwb { >>>> zilog_t *lwb_zilog; /* back pointer to log struct */ >>>> blkptr_t lwb_blk; /* on disk address of this log blk */ >>>> + boolean_t lwb_slog; /* lwb_blk is on SLOG device */ >>>> int lwb_nused; /* # used bytes in buffer */ >>>> int lwb_sz; /* size of block and buffer */ >>>> char *lwb_buf; /* log write buffer */ >>>> @@ -62,7 +63,6 @@ typedef struct itxs { >>>> typedef struct itxg { >>>> kmutex_t itxg_lock; /* lock for this structure */ >>>> uint64_t itxg_txg; /* txg for this chain */ >>>> - uint64_t itxg_sod; /* total size on disk for this txg */ >>>> itxs_t *itxg_itxs; /* sync and async itxs */ >>>> } itxg_t; >>>> >>>> @@ -120,7 +120,6 @@ struct zilog { >>>> kcondvar_t zl_cv_batch[2]; /* batch condition variables */ >>>> itxg_t zl_itxg[TXG_SIZE]; /* intent log txg chains */ >>>> list_t zl_itx_commit_list; /* itx list to be committed */ >>>> - uint64_t zl_itx_list_sz; /* total size of records on list */ >>>> uint64_t zl_cur_used; /* current commit log size used */ >>>> list_t zl_lwb_list; /* in-flight log write list */ >>>> kmutex_t zl_vdev_lock; /* protects zl_vdev_tree */ >>>> @@ -142,6 +141,8 @@ typedef struct zil_bp_node { >>>> >>>> #define ZIL_MAX_LOG_DATA (SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t) - \ >>>> sizeof (lr_write_t)) >>>> +#define ZIL_MAX_COPIED_DATA \ >>>> + ((SPA_OLD_MAXBLOCKSIZE - sizeof (zil_chain_t)) / 2 - sizeof (lr_write_t)) >>>> >>>> #ifdef __cplusplus >>>> } >>>> >>>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h >>>> ============================================================================== >>>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Nov 17 20:44:51 2016 (r308781) >>>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Nov 17 21:01:27 2016 (r308782) >>>> @@ -547,7 +547,7 @@ extern zio_t *zio_free_sync(zio_t *pio, >>>> const blkptr_t *bp, uint64_t size, enum zio_flag flags); >>>> >>>> extern int zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, >>>> - blkptr_t *old_bp, uint64_t size, boolean_t use_slog); >>>> + blkptr_t *old_bp, uint64_t size, boolean_t *slog); >>>> extern void zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp); >>>> extern void zio_flush(zio_t *zio, vdev_t *vd); >>>> extern zio_t *zio_trim(zio_t *zio, spa_t *spa, vdev_t *vd, uint64_t offset, >>>> >>>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c >>>> ============================================================================== >>>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Thu Nov 17 20:44:51 2016 (r308781) >>>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Thu Nov 17 21:01:27 2016 (r308782) >>>> @@ -464,20 +464,17 @@ void >>>> zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype, >>>> znode_t *zp, offset_t off, ssize_t resid, int ioflag) >>>> { >>>> + uint32_t blocksize = zp->z_blksz; >>>> itx_wr_state_t write_state; >>>> - boolean_t slogging; >>>> uintptr_t fsync_cnt; >>>> - ssize_t immediate_write_sz; >>>> >>>> if (zil_replaying(zilog, tx) || zp->z_unlinked) >>>> return; >>>> >>>> - immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >>>> - ? 0 : zfs_immediate_write_sz; >>>> - >>>> - slogging = spa_has_slogs(zilog->zl_spa) && >>>> - (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); >>>> - if (resid > immediate_write_sz && !slogging && resid <= zp->z_blksz) >>>> + if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >>>> + write_state = WR_INDIRECT; >>>> + else if (!spa_has_slogs(zilog->zl_spa) && >>>> + resid >= zfs_immediate_write_sz) >>>> write_state = WR_INDIRECT; >>>> else if (ioflag & (FSYNC | FDSYNC)) >>>> write_state = WR_COPIED; >>>> @@ -491,30 +488,26 @@ zfs_log_write(zilog_t *zilog, dmu_tx_t * >>>> while (resid) { >>>> itx_t *itx; >>>> lr_write_t *lr; >>>> - ssize_t len; >>>> + itx_wr_state_t wr_state = write_state; >>>> + ssize_t len = resid; >>>> >>>> - /* >>>> - * If the write would overflow the largest block then split it. >>>> - */ >>>> - if (write_state != WR_INDIRECT && resid > ZIL_MAX_LOG_DATA) >>>> - len = SPA_OLD_MAXBLOCKSIZE >> 1; >>>> - else >>>> - len = resid; >>>> + if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA) >>>> + wr_state = WR_NEED_COPY; >>>> + else if (wr_state == WR_INDIRECT) >>>> + len = MIN(blocksize - P2PHASE(off, blocksize), resid); >>>> >>>> itx = zil_itx_create(txtype, sizeof (*lr) + >>>> - (write_state == WR_COPIED ? len : 0)); >>>> + (wr_state == WR_COPIED ? len : 0)); >>>> lr = (lr_write_t *)&itx->itx_lr; >>>> - if (write_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os, >>>> + if (wr_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os, >>>> zp->z_id, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { >>>> zil_itx_destroy(itx); >>>> itx = zil_itx_create(txtype, sizeof (*lr)); >>>> lr = (lr_write_t *)&itx->itx_lr; >>>> - write_state = WR_NEED_COPY; >>>> + wr_state = WR_NEED_COPY; >>>> } >>>> >>>> - itx->itx_wr_state = write_state; >>>> - if (write_state == WR_NEED_COPY) >>>> - itx->itx_sod += len; >>>> + itx->itx_wr_state = wr_state; >>>> lr->lr_foid = zp->z_id; >>>> lr->lr_offset = off; >>>> lr->lr_length = len; >>>> >>>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c >>>> ============================================================================== >>>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 20:44:51 2016 (r308781) >>>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Thu Nov 17 21:01:27 2016 (r308782) >>>> @@ -88,6 +88,15 @@ SYSCTL_DECL(_vfs_zfs_trim); >>>> SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enabled, CTLFLAG_RDTUN, &zfs_trim_enabled, 0, >>>> "Enable ZFS TRIM"); >>>> >>>> +/* >>>> + * Limit SLOG write size per commit executed with synchronous priority. >>>> + * Any writes above that executed with lower (asynchronous) priority to >>>> + * limit potential SLOG device abuse by single active ZIL writer. >>>> + */ >>>> +uint64_t zil_slog_limit = 768 * 1024; >>>> +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, >>>> + &zil_slog_limit, 0, "Maximal SLOG commit size with sync priority"); >>>> + >>>> static kmem_cache_t *zil_lwb_cache; >>>> >>>> #define LWB_EMPTY(lwb) ((BP_GET_LSIZE(&lwb->lwb_blk) - \ >>>> @@ -447,13 +456,14 @@ zil_free_log_record(zilog_t *zilog, lr_t >>>> } >>>> >>>> static lwb_t * >>>> -zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, uint64_t txg) >>>> +zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t slog, uint64_t txg) >>>> { >>>> lwb_t *lwb; >>>> >>>> lwb = kmem_cache_alloc(zil_lwb_cache, KM_SLEEP); >>>> lwb->lwb_zilog = zilog; >>>> lwb->lwb_blk = *bp; >>>> + lwb->lwb_slog = slog; >>>> lwb->lwb_buf = zio_buf_alloc(BP_GET_LSIZE(bp)); >>>> lwb->lwb_max_txg = txg; >>>> lwb->lwb_zio = NULL; >>>> @@ -516,6 +526,7 @@ zil_create(zilog_t *zilog) >>>> dmu_tx_t *tx = NULL; >>>> blkptr_t blk; >>>> int error = 0; >>>> + boolean_t slog = FALSE; >>>> >>>> /* >>>> * Wait for any previous destroy to complete. >>>> @@ -544,7 +555,7 @@ zil_create(zilog_t *zilog) >>>> } >>>> >>>> error = zio_alloc_zil(zilog->zl_spa, txg, &blk, NULL, >>>> - ZIL_MIN_BLKSZ, zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); >>>> + ZIL_MIN_BLKSZ, &slog); >>>> >>>> if (error == 0) >>>> zil_init_log_chain(zilog, &blk); >>>> @@ -554,7 +565,7 @@ zil_create(zilog_t *zilog) >>>> * Allocate a log write buffer (lwb) for the first log block. >>>> */ >>>> if (error == 0) >>>> - lwb = zil_alloc_lwb(zilog, &blk, txg); >>>> + lwb = zil_alloc_lwb(zilog, &blk, slog, txg); >>>> >>>> /* >>>> * If we just allocated the first log block, commit our transaction >>>> @@ -885,6 +896,7 @@ static void >>>> zil_lwb_write_init(zilog_t *zilog, lwb_t *lwb) >>>> { >>>> zbookmark_phys_t zb; >>>> + zio_priority_t prio; >>>> >>>> SET_BOOKMARK(&zb, lwb->lwb_blk.blk_cksum.zc_word[ZIL_ZC_OBJSET], >>>> ZB_ZIL_OBJECT, ZB_ZIL_LEVEL, >>>> @@ -895,9 +907,13 @@ zil_lwb_write_init(zilog_t *zilog, lwb_t >>>> ZIO_FLAG_CANFAIL); >>>> } >>>> if (lwb->lwb_zio == NULL) { >>>> + if (zilog->zl_cur_used <= zil_slog_limit || !lwb->lwb_slog) >>>> + prio = ZIO_PRIORITY_SYNC_WRITE; >>>> + else >>>> + prio = ZIO_PRIORITY_ASYNC_WRITE; >>>> lwb->lwb_zio = zio_rewrite(zilog->zl_root_zio, zilog->zl_spa, >>>> 0, &lwb->lwb_blk, lwb->lwb_buf, BP_GET_LSIZE(&lwb->lwb_blk), >>>> - zil_lwb_write_done, lwb, ZIO_PRIORITY_SYNC_WRITE, >>>> + zil_lwb_write_done, lwb, prio, >>>> ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE, &zb); >>>> } >>>> } >>>> @@ -917,18 +933,6 @@ uint64_t zil_block_buckets[] = { >>>> }; >>>> >>>> /* >>>> - * Use the slog as long as the logbias is 'latency' and the current commit size >>>> - * is less than the limit or the total list size is less than 2X the limit. >>>> - * Limit checking is disabled by setting zil_slog_limit to UINT64_MAX. >>>> - */ >>>> -uint64_t zil_slog_limit = 1024 * 1024; >>>> -SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, >>>> - &zil_slog_limit, 0, "Maximal commit size to use SLOG"); >>>> -#define USE_SLOG(zilog) (((zilog)->zl_logbias == ZFS_LOGBIAS_LATENCY) && \ >>>> - (((zilog)->zl_cur_used < zil_slog_limit) || \ >>>> - ((zilog)->zl_itx_list_sz < (zil_slog_limit << 1)))) >>>> - >>>> -/* >>>> * Start a log block write and advance to the next log block. >>>> * Calls are serialized. >>>> */ >>>> @@ -943,6 +947,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >>>> uint64_t txg; >>>> uint64_t zil_blksz, wsz; >>>> int i, error; >>>> + boolean_t slog; >>>> >>>> if (BP_GET_CHECKSUM(&lwb->lwb_blk) == ZIO_CHECKSUM_ZILOG2) { >>>> zilc = (zil_chain_t *)lwb->lwb_buf; >>>> @@ -999,8 +1004,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >>>> >>>> BP_ZERO(bp); >>>> /* pass the old blkptr in order to spread log blocks across devs */ >>>> - error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, >>>> - USE_SLOG(zilog)); >>>> + error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, &slog); >>>> if (error == 0) { >>>> ASSERT3U(bp->blk_birth, ==, txg); >>>> bp->blk_cksum = lwb->lwb_blk.blk_cksum; >>>> @@ -1009,7 +1013,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >>>> /* >>>> * Allocate a new log write buffer (lwb). >>>> */ >>>> - nlwb = zil_alloc_lwb(zilog, bp, txg); >>>> + nlwb = zil_alloc_lwb(zilog, bp, slog, txg); >>>> >>>> /* Record the block for later vdev flushing */ >>>> zil_add_block(zilog, &lwb->lwb_blk); >>>> @@ -1046,12 +1050,13 @@ zil_lwb_write_start(zilog_t *zilog, lwb_ >>>> static lwb_t * >>>> zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) >>>> { >>>> - lr_t *lrc = &itx->itx_lr; /* common log record */ >>>> - lr_write_t *lrw = (lr_write_t *)lrc; >>>> + lr_t *lrcb, *lrc = &itx->itx_lr; /* common log record */ >>>> + lr_write_t *lrwb, *lrw = (lr_write_t *)lrc; >>>> char *lr_buf; >>>> uint64_t txg = lrc->lrc_txg; >>>> uint64_t reclen = lrc->lrc_reclen; >>>> uint64_t dlen = 0; >>>> + uint64_t dnow, lwb_sp; >>>> >>>> if (lwb == NULL) >>>> return (NULL); >>>> @@ -1068,25 +1073,30 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it >>>> >>>> zil_lwb_write_init(zilog, lwb); >>>> >>>> +cont: >>>> /* >>>> * If this record won't fit in the current log block, start a new one. >>>> + * For WR_NEED_COPY optimize layout for minimal number of chunks, but >>>> + * try to keep wasted space withing reasonable range (12%). >>>> */ >>>> - if (lwb->lwb_nused + reclen + dlen > lwb->lwb_sz) { >>>> + lwb_sp = lwb->lwb_sz - lwb->lwb_nused; >>>> + if (reclen > lwb_sp || (reclen + dlen > lwb_sp && >>>> + lwb_sp < ZIL_MAX_LOG_DATA / 8 && (dlen % ZIL_MAX_LOG_DATA == 0 || >>>> + lwb_sp < reclen + dlen % ZIL_MAX_LOG_DATA))) { >>>> lwb = zil_lwb_write_start(zilog, lwb); >>>> if (lwb == NULL) >>>> return (NULL); >>>> zil_lwb_write_init(zilog, lwb); >>>> ASSERT(LWB_EMPTY(lwb)); >>>> - if (lwb->lwb_nused + reclen + dlen > lwb->lwb_sz) { >>>> - txg_wait_synced(zilog->zl_dmu_pool, txg); >>>> - return (lwb); >>>> - } >>>> + lwb_sp = lwb->lwb_sz - lwb->lwb_nused; >>>> + ASSERT3U(reclen + MIN(dlen, sizeof(uint64_t)), <=, lwb_sp); >>>> } >>>> >>>> + dnow = MIN(dlen, lwb_sp - reclen); >>>> lr_buf = lwb->lwb_buf + lwb->lwb_nused; >>>> bcopy(lrc, lr_buf, reclen); >>>> - lrc = (lr_t *)lr_buf; >>>> - lrw = (lr_write_t *)lrc; >>>> + lrcb = (lr_t *)lr_buf; >>>> + lrwb = (lr_write_t *)lrcb; >>>> >>>> /* >>>> * If it's a write, fetch the data or get its blkptr as appropriate. >>>> @@ -1098,16 +1108,19 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it >>>> char *dbuf; >>>> int error; >>>> >>>> - if (dlen) { >>>> - ASSERT(itx->itx_wr_state == WR_NEED_COPY); >>>> + if (itx->itx_wr_state == WR_NEED_COPY) { >>>> dbuf = lr_buf + reclen; >>>> - lrw->lr_common.lrc_reclen += dlen; >>>> + lrcb->lrc_reclen += dnow; >>>> + if (lrwb->lr_length > dnow) >>>> + lrwb->lr_length = dnow; >>>> + lrw->lr_offset += dnow; >>>> + lrw->lr_length -= dnow; >>>> } else { >>>> ASSERT(itx->itx_wr_state == WR_INDIRECT); >>>> dbuf = NULL; >>>> } >>>> error = zilog->zl_get_data( >>>> - itx->itx_private, lrw, dbuf, lwb->lwb_zio); >>>> + itx->itx_private, lrwb, dbuf, lwb->lwb_zio); >>>> if (error == EIO) { >>>> txg_wait_synced(zilog->zl_dmu_pool, txg); >>>> return (lwb); >>>> @@ -1126,12 +1139,18 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it >>>> * equal to the itx sequence number because not all transactions >>>> * are synchronous, and sometimes spa_sync() gets there first. >>>> */ >>>> - lrc->lrc_seq = ++zilog->zl_lr_seq; /* we are single threaded */ >>>> - lwb->lwb_nused += reclen + dlen; >>>> + lrcb->lrc_seq = ++zilog->zl_lr_seq; /* we are single threaded */ >>>> + lwb->lwb_nused += reclen + dnow; >>>> lwb->lwb_max_txg = MAX(lwb->lwb_max_txg, txg); >>>> ASSERT3U(lwb->lwb_nused, <=, lwb->lwb_sz); >>>> ASSERT0(P2PHASE(lwb->lwb_nused, sizeof (uint64_t))); >>>> >>>> + dlen -= dnow; >>>> + if (dlen > 0) { >>>> + zilog->zl_cur_used += reclen; >>>> + goto cont; >>>> + } >>>> + >>>> return (lwb); >>>> } >>>> >>>> @@ -1145,7 +1164,6 @@ zil_itx_create(uint64_t txtype, size_t l >>>> itx = kmem_alloc(offsetof(itx_t, itx_lr) + lrsize, KM_SLEEP); >>>> itx->itx_lr.lrc_txtype = txtype; >>>> itx->itx_lr.lrc_reclen = lrsize; >>>> - itx->itx_sod = lrsize; /* if write & WR_NEED_COPY will be increased */ >>>> itx->itx_lr.lrc_seq = 0; /* defensive */ >>>> itx->itx_sync = B_TRUE; /* default is synchronous */ >>>> >>>> @@ -1294,11 +1312,8 @@ zil_itx_assign(zilog_t *zilog, itx_t *it >>>> * this itxg. Save the itxs for release below. >>>> * This should be rare. >>>> */ >>>> - atomic_add_64(&zilog->zl_itx_list_sz, -itxg->itxg_sod); >>>> - itxg->itxg_sod = 0; >>>> clean = itxg->itxg_itxs; >>>> } >>>> - ASSERT(itxg->itxg_sod == 0); >>>> itxg->itxg_txg = txg; >>>> itxs = itxg->itxg_itxs = kmem_zalloc(sizeof (itxs_t), KM_SLEEP); >>>> >>>> @@ -1310,8 +1325,6 @@ zil_itx_assign(zilog_t *zilog, itx_t *it >>>> } >>>> if (itx->itx_sync) { >>>> list_insert_tail(&itxs->i_sync_list, itx); >>>> - atomic_add_64(&zilog->zl_itx_list_sz, itx->itx_sod); >>>> - itxg->itxg_sod += itx->itx_sod; >>>> } else { >>>> avl_tree_t *t = &itxs->i_async_tree; >>>> uint64_t foid = ((lr_ooo_t *)&itx->itx_lr)->lr_foid; >>>> @@ -1359,8 +1372,6 @@ zil_clean(zilog_t *zilog, uint64_t synce >>>> ASSERT3U(itxg->itxg_txg, <=, synced_txg); >>>> ASSERT(itxg->itxg_txg != 0); >>>> ASSERT(zilog->zl_clean_taskq != NULL); >>>> - atomic_add_64(&zilog->zl_itx_list_sz, -itxg->itxg_sod); >>>> - itxg->itxg_sod = 0; >>>> clean_me = itxg->itxg_itxs; >>>> itxg->itxg_itxs = NULL; >>>> itxg->itxg_txg = 0; >>>> @@ -1384,7 +1395,6 @@ zil_get_commit_list(zilog_t *zilog) >>>> { >>>> uint64_t otxg, txg; >>>> list_t *commit_list = &zilog->zl_itx_commit_list; >>>> - uint64_t push_sod = 0; >>>> >>>> if (spa_freeze_txg(zilog->zl_spa) != UINT64_MAX) /* ziltest support */ >>>> otxg = ZILTEST_TXG; >>>> @@ -1401,12 +1411,9 @@ zil_get_commit_list(zilog_t *zilog) >>>> } >>>> >>>> list_move_tail(commit_list, &itxg->itxg_itxs->i_sync_list); >>>> - push_sod += itxg->itxg_sod; >>>> - itxg->itxg_sod = 0; >>>> >>>> mutex_exit(&itxg->itxg_lock); >>>> } >>>> - atomic_add_64(&zilog->zl_itx_list_sz, -push_sod); >>>> } >>>> >>>> /* >>>> >>>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c >>>> ============================================================================== >>>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Nov 17 20:44:51 2016 (r308781) >>>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Nov 17 21:01:27 2016 (r308782) >>>> @@ -2908,20 +2908,21 @@ zio_dva_unallocate(zio_t *zio, zio_gang_ >>>> */ >>>> int >>>> zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp, >>>> - uint64_t size, boolean_t use_slog) >>>> + uint64_t size, boolean_t *slog) >>>> { >>>> int error = 1; >>>> >>>> ASSERT(txg > spa_syncing_txg(spa)); >>>> >>>> - if (use_slog) { >>>> - error = metaslab_alloc(spa, spa_log_class(spa), size, >>>> - new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); >>>> - } >>>> - >>>> - if (error) { >>>> + error = metaslab_alloc(spa, spa_log_class(spa), size, >>>> + new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); >>>> + if (error == 0) { >>>> + *slog = TRUE; >>>> + } else { >>>> error = metaslab_alloc(spa, spa_normal_class(spa), size, >>>> new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID, NULL); >>>> + if (error == 0) >>>> + *slog = FALSE; >>>> } >>>> >>>> if (error == 0) { >>>> >>>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c >>>> ============================================================================== >>>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Nov 17 20:44:51 2016 (r308781) >>>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Nov 17 21:01:27 2016 (r308782) >>>> @@ -1387,54 +1387,44 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_ >>>> { >>>> uint32_t blocksize = zv->zv_volblocksize; >>>> zilog_t *zilog = zv->zv_zilog; >>>> - boolean_t slogging; >>>> - ssize_t immediate_write_sz; >>>> + itx_wr_state_t write_state; >>>> >>>> if (zil_replaying(zilog, tx)) >>>> return; >>>> >>>> - immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >>>> - ? 0 : zvol_immediate_write_sz; >>>> - >>>> - slogging = spa_has_slogs(zilog->zl_spa) && >>>> - (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY); >>>> + if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT) >>>> + write_state = WR_INDIRECT; >>>> + else if (!spa_has_slogs(zilog->zl_spa) && >>>> + resid >= blocksize && blocksize > zvol_immediate_write_sz) >>>> + write_state = WR_INDIRECT; >>>> + else if (sync) >>>> + write_state = WR_COPIED; >>>> + else >>>> + write_state = WR_NEED_COPY; >>>> >>>> while (resid) { >>>> itx_t *itx; >>>> lr_write_t *lr; >>>> - ssize_t len; >>>> - itx_wr_state_t write_state; >>>> + itx_wr_state_t wr_state = write_state; >>>> + ssize_t len = resid; >>>> >>>> - /* >>>> - * Unlike zfs_log_write() we can be called with >>>> - * upto DMU_MAX_ACCESS/2 (5MB) writes. >>>> - */ >>>> - if (blocksize > immediate_write_sz && !slogging && >>>> - resid >= blocksize && off % blocksize == 0) { >>>> - write_state = WR_INDIRECT; /* uses dmu_sync */ >>>> - len = blocksize; >>>> - } else if (sync) { >>>> - write_state = WR_COPIED; >>>> - len = MIN(ZIL_MAX_LOG_DATA, resid); >>>> - } else { >>>> - write_state = WR_NEED_COPY; >>>> - len = MIN(ZIL_MAX_LOG_DATA, resid); >>>> - } >>>> + if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA) >>>> + wr_state = WR_NEED_COPY; >>>> + else if (wr_state == WR_INDIRECT) >>>> + len = MIN(blocksize - P2PHASE(off, blocksize), resid); >>>> >>>> itx = zil_itx_create(TX_WRITE, sizeof (*lr) + >>>> - (write_state == WR_COPIED ? len : 0)); >>>> + (wr_state == WR_COPIED ? len : 0)); >>>> lr = (lr_write_t *)&itx->itx_lr; >>>> - if (write_state == WR_COPIED && dmu_read(zv->zv_objset, >>>> + if (wr_state == WR_COPIED && dmu_read(zv->zv_objset, >>>> ZVOL_OBJ, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) { >>>> zil_itx_destroy(itx); >>>> itx = zil_itx_create(TX_WRITE, sizeof (*lr)); >>>> lr = (lr_write_t *)&itx->itx_lr; >>>> - write_state = WR_NEED_COPY; >>>> + wr_state = WR_NEED_COPY; >>>> } >>>> >>>> - itx->itx_wr_state = write_state; >>>> - if (write_state == WR_NEED_COPY) >>>> - itx->itx_sod += len; >>>> + itx->itx_wr_state = wr_state; >>>> lr->lr_foid = ZVOL_OBJ; >>>> lr->lr_offset = off; >>>> lr->lr_length = len; >>>> > -- Alexander Motin From owner-svn-src-head@freebsd.org Thu Nov 17 22:49:52 2016 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 6559EC47D96; Thu, 17 Nov 2016 22:49:52 +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 34E8615AC; Thu, 17 Nov 2016 22:49:52 +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 uAHMnpgw052802; Thu, 17 Nov 2016 22:49:51 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHMnpnF052801; Thu, 17 Nov 2016 22:49:51 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201611172249.uAHMnpnF052801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Thu, 17 Nov 2016 22:49:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308786 - head/etc X-SVN-Group: head 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, 17 Nov 2016 22:49:52 -0000 Author: jilles Date: Thu Nov 17 22:49:51 2016 New Revision: 308786 URL: https://svnweb.freebsd.org/changeset/base/308786 Log: rc.subr: Swap checks so we only fork sysctl if *_oomprotect is set. Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Thu Nov 17 21:52:00 2016 (r308785) +++ head/etc/rc.subr Thu Nov 17 22:49:51 2016 (r308786) @@ -1206,22 +1206,17 @@ $command $rc_flags $command_args" case "$rc_arg" in start) # We cannot use protect(1) inside jails. - jailed="$(sysctl -n security.jail.jailed)" - if [ ${jailed} -eq 1 ]; then - return $_return - fi - if [ -n "$_oomprotect" ]; then - if [ -f "${PROTECT}" ]; then - pid=$(check_process $command) - case $_oomprotect in - [Aa][Ll][Ll]) - ${PROTECT} -i -p ${pid} - ;; - [Yy][Ee][Ss]) - ${PROTECT} -p ${pid} - ;; - esac - fi + if [ -n "$_oomprotect" ] && [ -f "${PROTECT}" ] && + [ "$(sysctl -n security.jail.jailed)" -eq 0 ]; then + pid=$(check_process $command) + case $_oomprotect in + [Aa][Ll][Ll]) + ${PROTECT} -i -p ${pid} + ;; + [Yy][Ee][Ss]) + ${PROTECT} -p ${pid} + ;; + esac fi ;; esac From owner-svn-src-head@freebsd.org Thu Nov 17 23:05:35 2016 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 E350BC47497; Thu, 17 Nov 2016 23:05:35 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B37D61FDC; Thu, 17 Nov 2016 23:05:35 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAHN5Yqx060562; Thu, 17 Nov 2016 23:05:34 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHN5Ytk060561; Thu, 17 Nov 2016 23:05:34 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201611172305.uAHN5Ytk060561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Thu, 17 Nov 2016 23:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308787 - head/sys/dev/bnxt X-SVN-Group: head 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, 17 Nov 2016 23:05:36 -0000 Author: shurd (ports committer) Date: Thu Nov 17 23:05:34 2016 New Revision: 308787 URL: https://svnweb.freebsd.org/changeset/base/308787 Log: Add missing newline in error mesage Approved by: davidch MFC after: 13 days Sponsored by: Broadcom Corporation Modified: head/sys/dev/bnxt/bnxt_hwrm.c Modified: head/sys/dev/bnxt/bnxt_hwrm.c ============================================================================== --- head/sys/dev/bnxt/bnxt_hwrm.c Thu Nov 17 22:49:51 2016 (r308786) +++ head/sys/dev/bnxt/bnxt_hwrm.c Thu Nov 17 23:05:34 2016 (r308787) @@ -424,7 +424,7 @@ bnxt_hwrm_func_qcaps(struct bnxt_softc * pf->max_rx_wm_flows = le32toh(resp->max_rx_wm_flows); } if (!_is_valid_ether_addr(func->mac_addr)) { - device_printf(softc->dev, "Invalid ethernet address, generating random locally administered address"); + device_printf(softc->dev, "Invalid ethernet address, generating random locally administered address\n"); get_random_ether_addr(func->mac_addr); } From owner-svn-src-head@freebsd.org Thu Nov 17 23:16:57 2016 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 6AB8EC47812; Thu, 17 Nov 2016 23:16:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C7C596F; Thu, 17 Nov 2016 23:16:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAHNGuCX064390; Thu, 17 Nov 2016 23:16:56 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAHNGuYV064389; Thu, 17 Nov 2016 23:16:56 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611172316.uAHNGuYV064389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 17 Nov 2016 23:16:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308788 - head/usr.bin/gcore X-SVN-Group: head 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, 17 Nov 2016 23:16:57 -0000 Author: bdrewery Date: Thu Nov 17 23:16:56 2016 New Revision: 308788 URL: https://svnweb.freebsd.org/changeset/base/308788 Log: Cleanup some leftovers from '-s' removal in r302792. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/usr.bin/gcore/gcore.c Modified: head/usr.bin/gcore/gcore.c ============================================================================== --- head/usr.bin/gcore/gcore.c Thu Nov 17 23:05:34 2016 (r308787) +++ head/usr.bin/gcore/gcore.c Thu Nov 17 23:16:56 2016 (r308788) @@ -143,21 +143,6 @@ main(int argc, char *argv[]) fd = open(corefile, O_RDWR|O_CREAT|O_TRUNC, DEFFILEMODE); if (fd < 0) err(1, "%s", corefile); - /* - * The semantics of the 's' flag is to stop the target process. - * Previous versions of gcore would manage this by trapping SIGHUP, - * SIGINT and SIGTERM (to be passed to the target pid), and then - * signal the child to stop. - * - * However, this messes up if the selected dumper uses ptrace calls - * that leave the child already stopped. The waitpid call in elfcore - * never returns. - * - * The best thing to do here is to externalize the 's' flag and let - * each dumper dispose of what that means, if anything. For the elfcore - * dumper, the 's' flag is a no-op since the ptrace attach stops the - * process in question already. - */ dumper->dump(efd, fd, pid); (void)close(fd); @@ -169,6 +154,6 @@ void usage(void) { - (void)fprintf(stderr, "usage: gcore [-s] [-c core] [executable] pid\n"); + (void)fprintf(stderr, "usage: gcore [-c core] [executable] pid\n"); exit(1); } From owner-svn-src-head@freebsd.org Thu Nov 17 23:56:59 2016 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 636C0C476FA; Thu, 17 Nov 2016 23:56:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C1D61FB8; Thu, 17 Nov 2016 23:56:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id uAHNuvTR063939 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 17 Nov 2016 15:56:58 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id uAHNuvhE063938; Thu, 17 Nov 2016 15:56:57 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 17 Nov 2016 15:56:57 -0800 From: Gleb Smirnoff To: Sepherosa Ziehau Cc: "Bjoern A. Zeeb" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308748 - head/sys/netgraph Message-ID: <20161117235657.GV27748@FreeBSD.org> References: <201611171403.uAHE3i3N044462@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.0 (2016-08-17) 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, 17 Nov 2016 23:56:59 -0000 On Thu, Nov 17, 2016 at 10:44:12PM +0800, Sepherosa Ziehau wrote: S> On Thu, Nov 17, 2016 at 10:03 PM, Bjoern A. Zeeb wrote: S> > Author: bz S> > Date: Thu Nov 17 14:03:44 2016 S> > New Revision: 308748 S> > URL: https://svnweb.freebsd.org/changeset/base/308748 S> > S> > Log: S> > Writing out the L2TP control packet requires 12 bytes of S> > contiguous memory but in one path we did not always guarantee this, S> > thus do a m_pullup() there. S> > S> > PR: 214385 S> > Submitted by: Joe Jones (joeknockando googlemail.com) S> > MFC after: 3 days S> > S> > Modified: S> > head/sys/netgraph/ng_l2tp.c S> > S> > Modified: head/sys/netgraph/ng_l2tp.c S> > ============================================================================== S> > --- head/sys/netgraph/ng_l2tp.c Thu Nov 17 11:48:07 2016 (r308747) S> > +++ head/sys/netgraph/ng_l2tp.c Thu Nov 17 14:03:44 2016 (r308748) S> > @@ -1544,6 +1544,16 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mb S> > priv->stats.memoryFailures++; S> > return (ENOBUFS); S> > } S> > + S> > + /* S> > + * The below requires 12 contiguous bytes for the L2TP header S> > + * to be written into. S> > + */ S> > + m = m_pullup(m, 12); S> > + if (m == NULL) { S> > + priv->stats.memoryFailures++; S> > + return (ENOBUFS); S> > + } S> S> Would it be better that we do a (m->m_len < 12) test before doing the S> m_pullup()? Yes, and a line like: if (m->m_len < 12 && (m = m_pullup(m, 12)) == NULL) will also match the style of the rest of the code in the function. -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Fri Nov 18 00:01:03 2016 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 1915FC47BC1; Fri, 18 Nov 2016 00:01:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 022EA691; Fri, 18 Nov 2016 00:01:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id uAI0123u063984 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 17 Nov 2016 16:01:02 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id uAI012Nm063983; Thu, 17 Nov 2016 16:01:02 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 17 Nov 2016 16:01:02 -0800 From: Gleb Smirnoff To: Sepherosa Ziehau Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" , src-committers@freebsd.org Subject: Re: svn commit: r308748 - head/sys/netgraph Message-ID: <20161118000102.GW27748@FreeBSD.org> References: <201611171403.uAHE3i3N044462@repo.freebsd.org> <20161117235657.GV27748@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161117235657.GV27748@FreeBSD.org> User-Agent: Mutt/1.7.0 (2016-08-17) 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, 18 Nov 2016 00:01:03 -0000 On Thu, Nov 17, 2016 at 03:56:57PM -0800, Gleb Smirnoff wrote: T> On Thu, Nov 17, 2016 at 10:44:12PM +0800, Sepherosa Ziehau wrote: T> S> On Thu, Nov 17, 2016 at 10:03 PM, Bjoern A. Zeeb wrote: T> S> > Author: bz T> S> > Date: Thu Nov 17 14:03:44 2016 T> S> > New Revision: 308748 T> S> > URL: https://svnweb.freebsd.org/changeset/base/308748 T> S> > T> S> > Log: T> S> > Writing out the L2TP control packet requires 12 bytes of T> S> > contiguous memory but in one path we did not always guarantee this, T> S> > thus do a m_pullup() there. T> S> > T> S> > PR: 214385 T> S> > Submitted by: Joe Jones (joeknockando googlemail.com) T> S> > MFC after: 3 days T> S> > T> S> > Modified: T> S> > head/sys/netgraph/ng_l2tp.c T> S> > T> S> > Modified: head/sys/netgraph/ng_l2tp.c T> S> > ============================================================================== T> S> > --- head/sys/netgraph/ng_l2tp.c Thu Nov 17 11:48:07 2016 (r308747) T> S> > +++ head/sys/netgraph/ng_l2tp.c Thu Nov 17 14:03:44 2016 (r308748) T> S> > @@ -1544,6 +1544,16 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mb T> S> > priv->stats.memoryFailures++; T> S> > return (ENOBUFS); T> S> > } T> S> > + T> S> > + /* T> S> > + * The below requires 12 contiguous bytes for the L2TP header T> S> > + * to be written into. T> S> > + */ T> S> > + m = m_pullup(m, 12); T> S> > + if (m == NULL) { T> S> > + priv->stats.memoryFailures++; T> S> > + return (ENOBUFS); T> S> > + } T> S> T> S> Would it be better that we do a (m->m_len < 12) test before doing the T> S> m_pullup()? T> T> Yes, and a line like: T> T> if (m->m_len < 12 && (m = m_pullup(m, 12)) == NULL) T> T> will also match the style of the rest of the code in the function. I think the whole block can be shortened to: - prepend 10 - pullup 12 - read session_id at offset 10 The first pullup can be removed. -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Fri Nov 18 00:13:31 2016 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 DBFFBC44035; Fri, 18 Nov 2016 00:13:31 +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 8BC3AEE4; Fri, 18 Nov 2016 00:13:31 +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 uAI0DUlq087972; Fri, 18 Nov 2016 00:13:30 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAI0DU57087971; Fri, 18 Nov 2016 00:13:30 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201611180013.uAI0DU57087971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 18 Nov 2016 00:13:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308789 - head/sys/conf X-SVN-Group: head 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, 18 Nov 2016 00:13:32 -0000 Author: glebius Date: Fri Nov 18 00:13:30 2016 New Revision: 308789 URL: https://svnweb.freebsd.org/changeset/base/308789 Log: If FreeBSD source tree is a subproject of a bigger project, then .git or .hg may reside above FreeBSD sources root. Provide function findvcs() that will climb up and seek for presence of a VCS directory. Reviewed by: imp (earlier version of the patch) Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Thu Nov 17 23:16:56 2016 (r308788) +++ head/sys/conf/newvers.sh Fri Nov 18 00:13:30 2016 (r308789) @@ -39,6 +39,28 @@ fi RELEASE="${REVISION}-${BRANCH}" VERSION="${TYPE} ${RELEASE}" +# +# findvcs dir +# Looks up directory dir at world root and up the filesystem +# +findvcs() +{ + local savedir + + savedir=$(pwd) + cd ${SYSDIR}/.. + while [ $(pwd) != "/" ]; do + if [ -d "./$1" ]; then + VCSDIR=$(pwd)"/$1" + cd ${savedir} + return 0 + fi + cd .. + done + cd ${savedir} + return 1 +} + if [ -z "${SYSDIR}" ]; then SYSDIR=$(dirname $0)/.. fi @@ -142,19 +164,20 @@ for dir in /usr/bin /usr/local/bin; do p4_cmd=${dir}/p4 fi done -if [ -d "${SYSDIR}/../.git" ] ; then + +if findvcs .git; then for dir in /usr/bin /usr/local/bin; do if [ -x "${dir}/git" ] ; then - git_cmd="${dir}/git --git-dir=${SYSDIR}/../.git" + git_cmd="${dir}/git --git-dir=${VCSDIR}" break fi done fi -if [ -d "${SYSDIR}/../.hg" ] ; then +if findvcs .hg; then for dir in /usr/bin /usr/local/bin; do if [ -x "${dir}/hg" ] ; then - hg_cmd="${dir}/hg -R ${SYSDIR}/.." + hg_cmd="${dir}/hg -R ${VCSDIR}" break fi done @@ -193,7 +216,7 @@ if [ -n "$git_cmd" ] ; then if [ -n "$git_b" ] ; then git="${git}(${git_b})" fi - if $git_cmd --work-tree=${SYSDIR}/.. diff-index \ + if $git_cmd --work-tree=${VCSDIR}/.. diff-index \ --name-only HEAD | read dummy; then git="${git}-dirty" fi From owner-svn-src-head@freebsd.org Fri Nov 18 02:07:44 2016 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 E3D37C47167; Fri, 18 Nov 2016 02:07:44 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0104.outbound.protection.outlook.com [104.47.37.104]) (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 B50101F30; Fri, 18 Nov 2016 02:07:43 +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=bt4RlZtNpvz35CmGJ6DefyT8NZJy/uYTNtIP3Dt7/oY=; b=OpI7gcfoEvYicnMOQOGfcF7R/yM5IFp8jL93UdF74j45GLRrbFc4NHJNxqgq2mL3Sh+nYDEJMVhmr7zjDV5OHcmFKacAjUxMtLIzZVOFtCLU9RzkjMTJ8ibfm4Dpvx7t+A2jf4U7asAXYKF/T7wmfQNvzSsW2dIQZqpLsOs6PzY= Received: from MWHPR03MB2669.namprd03.prod.outlook.com (10.168.207.15) by MWHPR03MB2669.namprd03.prod.outlook.com (10.168.207.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Fri, 18 Nov 2016 01:52:28 +0000 Received: from MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) by MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) with mapi id 15.01.0707.017; Fri, 18 Nov 2016 01:52:28 +0000 From: Dexuan Cui To: Ngie Cooper , Andreas Tobler CC: Dexuan Cui , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: RE: svn commit: r308725 - in head/sys: conf dev/hyperv/pcib modules/hyperv/pcib Thread-Topic: svn commit: r308725 - in head/sys: conf dev/hyperv/pcib modules/hyperv/pcib Thread-Index: AQHSQPp+Oty5/wNzNEWi8HtRc9jC/qDds4GAgABGf5A= Date: Fri, 18 Nov 2016 01:52:28 +0000 Message-ID: References: <201611160925.uAG9P040059891@repo.freebsd.org> In-Reply-To: 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=decui@microsoft.com; x-originating-ip: [2404:f801:9000:18::7c2] x-microsoft-exchange-diagnostics: 1; MWHPR03MB2669; 7:cLh7r26SkBNbCdKs67LW/2GYjJGVGI9uYrZyA0XQVWNAOJ2/04BLT5rP2F/b8D1sAtvFlHHBz4YVuB4VYHMU6b94IOkzX+2GQ6NKreBC/gkGfYC+hDkgbs+1nVeTYr9Pg/IHOo5+Kz6Yz8NpA5axOdUU4Hd+RCTf3j2nj+BIcwYnjpkEfdg7HzdsfoHq9kwkzW215B6Q3y6PFHBuThnRHC82sSHtImgrN2+5iXg2NZ01UvZBcHb1ayTwKS3+GJzAMpa2GAbtqQbsgWNdjiJHZ80V4bbgVzVwn3VCLaIYzyn6JvTPmHIktOsnq+u7MOkM5GXGqzpTtOpIVZ862hRXD5ivy7kcOog6Q2vHvYETV/3cXWluwhCaYIBFzMyubw4X x-ms-office365-filtering-correlation-id: a16209b4-01fe-41d0-ea17-08d40f558d74 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2669; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6060326)(6040281)(6045074)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(61426038)(61427038)(6061324)(6046074)(6041223); SRVR:MWHPR03MB2669; BCL:0; PCL:0; RULEID:; SRVR:MWHPR03MB2669; x-forefront-prvs: 01304918F3 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(189002)(377454003)(24454002)(199003)(51914003)(54356999)(86362001)(76176999)(50986999)(74316002)(122556002)(8990500004)(10090500001)(5005710100001)(76576001)(3280700002)(7736002)(7846002)(305945005)(10290500002)(189998001)(3660700001)(4326007)(9686002)(81156014)(81166006)(68736007)(6506003)(101416001)(8936002)(8676002)(87936001)(5001770100001)(97736004)(86612001)(6116002)(102836003)(2950100002)(2906002)(77096005)(33656002)(2900100001)(7696004)(105586002)(99286002)(229853002)(106356001)(92566002)(106116001)(5660300001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR03MB2669; H:MWHPR03MB2669.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; 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: 18 Nov 2016 01:52:28.4117 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2669 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, 18 Nov 2016 02:07:45 -0000 PiBGcm9tOiBOZ2llIENvb3BlciBbbWFpbHRvOnlhbmV1cmFiZXlhQGdtYWlsLmNvbV0NCj4gU2Vu dDogRnJpZGF5LCBOb3ZlbWJlciAxOCwgMjAxNiAwNTozNw0KPiBUbzogQW5kcmVhcyBUb2JsZXIg PGFuZHJlYXN0QGZyZWVic2Qub3JnPg0KPiBPbiBUaHUsIE5vdiAxNywgMjAxNiBhdCA5OjQ2IEFN LCBBbmRyZWFzIFRvYmxlciA8YW5kcmVhc3RAZnJlZWJzZC5vcmc+DQo+IHdyb3RlOg0KPiA+IE9u IDE2LjExLjE2IDEwOjI1LCBEZXh1YW4gQ3VpIHdyb3RlOg0KPiA+Pg0KPiA+PiBBdXRob3I6IGRl eHVhbg0KPiA+PiBEYXRlOiBXZWQgTm92IDE2IDA5OjI1OjAwIDIwMTYNCj4gPj4gTmV3IFJldmlz aW9uOiAzMDg3MjUNCj4gDQo+ID4gLWRldi9oeXBlcnYvcGNpYi9wY2liLmMgICAgICAgICBvcHRp b25hbCAgICAgICAgaHlwZXJ2DQo+ID4gK2Rldi9oeXBlcnYvcGNpYi9wY2liLmMgICAgICAgICBv cHRpb25hbCAgICAgICAgaHlwZXJ2IHBjaQ0KPiANCj4gICAgIFRoaXMgc2VlbXMgdG8gYmUgY2F1 c2luZyBKZW5raW5zIGZhaWx1cmVzIHRvbzoNCj4gICAgIERvZXNuJ3Qgc3lzL21vZHVsZXMvaHlw ZXJ2L3ZtYnVzL01ha2VmaWxlIG5lZWQgcGNpX2lmLmggbm93IGluIFNSQ1M/DQo+IFRoYW5rcywN Cj4gLU5naWUNCg0KSGkgTmdpZSwgQW5kcmVhcywNClRoYW5rcyBmb3IgdGhlIHJlbWluZGVyISAg SSdsbCBmaXggdGhpcyBBU0FQLg0KTm93IEknbSB0ZXN0aW5nIGxvY2FsIGNoYW5nZXMgYW5kIHdp bGwgcmVwb3J0IGJhY2sgc2hvcnRseS4NCg0KVGhhbmtzLA0KLS0gRGV4dWFuDQo= From owner-svn-src-head@freebsd.org Fri Nov 18 02:29:11 2016 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 37773C47A95; Fri, 18 Nov 2016 02:29:11 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE942EA0; Fri, 18 Nov 2016 02:29:10 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAI2TA0Z039282; Fri, 18 Nov 2016 02:29:10 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAI2TAXr039281; Fri, 18 Nov 2016 02:29:10 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201611180229.uAI2TAXr039281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Fri, 18 Nov 2016 02:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308790 - head/tools/sched X-SVN-Group: head 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, 18 Nov 2016 02:29:11 -0000 Author: rstone Date: Fri Nov 18 02:29:09 2016 New Revision: 308790 URL: https://svnweb.freebsd.org/changeset/base/308790 Log: Add a dtrace script for collecting schedgraph data Added: head/tools/sched/make_ktr.sh (contents, props changed) head/tools/sched/schedgraph.d (contents, props changed) Added: head/tools/sched/make_ktr.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/sched/make_ktr.sh Fri Nov 18 02:29:09 2016 (r308790) @@ -0,0 +1,37 @@ +#!/bin/sh +# +# Copyright (c) 2012 Ryan Stone +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +if [ "$#" -ne 2 ] +then + echo "Usage: make_ktr input output" >&2 + exit 1 +fi + +sort -k 2nrb $1 | cat -n > $2 + Added: head/tools/sched/schedgraph.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/sched/schedgraph.d Fri Nov 18 02:29:09 2016 (r308790) @@ -0,0 +1,135 @@ +#!/usr/sbin/dtrace -s + +/*- + * Copyright (c) 2012-2016 Ryan Stone + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * DTrace script for collecting schedgraph data. Run the output + * of this script through make_ktr before feeding it into + * schedgraph.py + * + * e.g. + * # ./schedgraph.d > /tmp/sched.out + * # ./make_ktr.sh /tmp/sched.out /tmp/sched.ktr + * # python schedgraph.py /tmp/sched.ktr 1 + */ + +#pragma D option quiet +#pragma D option bufpolicy=ring + +inline int TDF_IDLETD = 0x00000020; + +/* + * Reasons that the current thread can not be run yet. + * More than one may apply. + */ +inline int TDI_SUSPENDED = 0x0001; /* On suspension queue. */ +inline int TDI_SLEEPING = 0x0002; /* Actually asleep! (tricky). */ +inline int TDI_SWAPPED = 0x0004; /* Stack not in mem. Bad juju if run. */ +inline int TDI_LOCK = 0x0008; /* Stopped on a lock. */ +inline int TDI_IWAIT = 0x0010; /* Awaiting interrupt. */ + +inline string KTDSTATE[struct thread * td] = \ + (((td)->td_inhibitors & TDI_SLEEPING) != 0 ? "sleep" : \ + ((td)->td_inhibitors & TDI_SUSPENDED) != 0 ? "suspended" : \ + ((td)->td_inhibitors & TDI_SWAPPED) != 0 ? "swapped" : \ + ((td)->td_inhibitors & TDI_LOCK) != 0 ? "blocked" : \ + ((td)->td_inhibitors & TDI_IWAIT) != 0 ? "iwait" : "yielding"); + +/* + * NOCPU changed from 255 to -1 at some point. This hacky test will work on a + * kernel compiled with either version. + */ +inline int is_nocpu[int cpu] = cpu < 0 || cpu > `mp_maxid; + +sched:::load-change +/ is_nocpu[args[0]] / +{ + printf("%d %d KTRGRAPH group:\"load\", id:\"global load\", counter:\"%d\", attributes: \"none\"\n", cpu, timestamp, args[1]); +} + +sched:::load-change +/ !is_nocpu[args[0]] / +{ + printf("%d %d KTRGRAPH group:\"load\", id:\"CPU %d load\", counter:\"%d\", attributes: \"none\"\n", cpu, timestamp, args[0], args[1]); + +} + +proc:::exit +{ + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", state:\"proc exit\", attributes: prio:td\n", cpu, timestamp, curthread->td_proc->p_comm, curthread->td_name, curthread->td_tid); +} + +proc:::lwp-exit +{ + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", state:\"exit\", attributes: prio:td\n", cpu, timestamp, curthread->td_proc->p_comm, curthread->td_name, curthread->td_tid); +} + +sched:::change-pri +{ + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", point:\"priority change\", attributes: prio:%d, new prio:%d, linkedto:\"%s/%s tid %d\"\n", cpu, timestamp, args[0]->td_proc->p_comm, args[0]->td_name, args[0]->td_tid, args[0]->td_priority, arg2, curthread->td_proc->p_comm, curthread->td_name, curthread->td_tid); +} + +sched:::lend-pri +{ + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", point:\"lend prio\", attributes: prio:%d, new prio:%d, linkedto:\"%s/%s tid %d\"\n", cpu, timestamp, curthread->td_proc->p_comm, curthread->td_name, curthread->td_tid, args[0]->td_priority, arg2, args[0]->td_proc->p_comm, args[0]->td_name, args[0]->td_tid); +} + +sched:::enqueue +{ + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", state:\"runq add\", attributes: prio:%d, linkedto:\"%s/%s tid %d\"\n", cpu, timestamp, args[0]->td_proc->p_comm, args[0]->td_name, args[0]->td_tid, args[0]->td_priority, curthread->td_proc->p_comm, curthread->td_name, curthread->td_tid); + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", point:\"wokeup\", attributes: linkedto:\"%s/%s tid %d\"\n", cpu, timestamp, curthread->td_proc->p_comm, curthread->td_name, curthread->td_tid, args[0]->td_proc->p_comm, args[0]->td_name, args[0]->td_tid); +} + +sched:::dequeue +{ + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", state:\"runq rem\", attributes: prio:%d, linkedto:\"%s/%s tid %d\"\n", cpu, timestamp, args[0]->td_proc->p_comm, args[0]->td_name, args[0]->td_tid, args[0]->td_priority, curthread->td_proc->p_comm, curthread->td_name, curthread->td_tid); +} + +sched:::tick +{ + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", point:\"statclock\", attributes: prio:%d, stathz:%d\n", cpu, timestamp, args[0]->td_proc->p_comm, args[0]->td_name, args[0]->td_tid, args[0]->td_priority, `stathz ? `stathz : `hz); +} + +sched:::off-cpu +/ curthread->td_flags & TDF_IDLETD / +{ + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", state:\"idle\", attributes: prio:%d\n", cpu, timestamp, curthread->td_proc->p_comm, curthread->td_name, curthread->td_tid, curthread->td_priority); +} + +sched:::off-cpu +/ (curthread->td_flags & TDF_IDLETD) == 0 / +{ + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", state:\"%s\", attributes: prio:%d, wmesg:\"%s\", lockname:\"%s\"\n", cpu, timestamp, curthread->td_proc->p_comm, curthread->td_name, curthread->td_tid, KTDSTATE[curthread], curthread->td_priority, curthread->td_wmesg ? stringof(curthread->td_wmesg) : "(null)", curthread->td_lockname ? stringof(curthread->td_lockname) : "(null)"); +} + +sched:::on-cpu +{ + printf("%d %d KTRGRAPH group:\"thread\", id:\"%s/%s tid %d\", state:\"running\", attributes: prio:%d\n", cpu, timestamp, curthread->td_proc->p_comm, curthread->td_name, curthread->td_tid, curthread->td_priority); +} + From owner-svn-src-head@freebsd.org Fri Nov 18 03:11:13 2016 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 0A2DDC47455; Fri, 18 Nov 2016 03:11: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 CF7FA6ED; Fri, 18 Nov 2016 03:11: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 uAI3BBgZ056628; Fri, 18 Nov 2016 03:11:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAI3BB93056627; Fri, 18 Nov 2016 03:11:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201611180311.uAI3BB93056627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Nov 2016 03:11:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308791 - head/sys/cddl/contrib/opensolaris/uts/intel/dtrace X-SVN-Group: head 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, 18 Nov 2016 03:11:13 -0000 Author: markj Date: Fri Nov 18 03:11:11 2016 New Revision: 308791 URL: https://svnweb.freebsd.org/changeset/base/308791 Log: Support fetching RFLAGS in fasttrap_getreg(). MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Fri Nov 18 02:29:09 2016 (r308790) +++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Fri Nov 18 03:11:11 2016 (r308791) @@ -1871,9 +1871,7 @@ fasttrap_getreg(struct reg *rp, uint_t r case REG_ERR: return (rp->r_err); case REG_RIP: return (rp->r_rip); case REG_CS: return (rp->r_cs); -#ifdef illumos - case REG_RFL: return (rp->r_rfl); -#endif + case REG_RFL: return (rp->r_rflags); case REG_RSP: return (rp->r_rsp); case REG_SS: return (rp->r_ss); case REG_FS: return (rp->r_fs); From owner-svn-src-head@freebsd.org Fri Nov 18 04:19:23 2016 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 3DB23C4559B; Fri, 18 Nov 2016 04:19: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 0D49A369; Fri, 18 Nov 2016 04:19:22 +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 uAI4JMJc083645; Fri, 18 Nov 2016 04:19:22 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAI4JMLi083644; Fri, 18 Nov 2016 04:19:22 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201611180419.uAI4JMLi083644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 18 Nov 2016 04:19:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308792 - head/sys/net X-SVN-Group: head 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, 18 Nov 2016 04:19:23 -0000 Author: sbruno Date: Fri Nov 18 04:19:21 2016 New Revision: 308792 URL: https://svnweb.freebsd.org/changeset/base/308792 Log: iflib updates and fixes: - reset gen on down - initialize admin task statically - drain mp_ring on down - don't drop context lock on stop - reset error stats on down - fix typo in min_latency sysctl - return ENOBUFS from if_transmit if the driver isn't running or the link is down Submitted by: mmacy@nextbsd.org Reviewed by: shurd MFC after: 2 days Sponsored by: Isilon and Limelight Networks Differential Revision: https://reviews.freebsd.org/D8558 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Fri Nov 18 03:11:11 2016 (r308791) +++ head/sys/net/iflib.c Fri Nov 18 04:19:21 2016 (r308792) @@ -93,7 +93,6 @@ __FBSDID("$FreeBSD$"); #include #endif - /* * enable accounting of every mbuf as it comes in to and goes out of iflib's software descriptor references */ @@ -500,7 +499,7 @@ static SYSCTL_NODE(_net, OID_AUTO, iflib static int iflib_min_tx_latency = 0; SYSCTL_INT(_net_iflib, OID_AUTO, min_tx_latency, CTLFLAG_RW, - &iflib_min_tx_latency, 0, "minimize transmit latency at the possibel expense of throughput"); + &iflib_min_tx_latency, 0, "minimize transmit latency at the possible expense of throughput"); #if IFLIB_DEBUG_COUNTERS @@ -595,10 +594,23 @@ SYSCTL_INT(_net_iflib, OID_AUTO, verbose &iflib_verbose_debug, 0, "enable verbose debugging"); #define DBG_COUNTER_INC(name) atomic_add_int(&(iflib_ ## name), 1) +static void +iflib_debug_reset(void) +{ + iflib_tx_seen = iflib_tx_sent = iflib_tx_encap = iflib_rx_allocs = + iflib_fl_refills = iflib_fl_refills_large = iflib_tx_frees = + iflib_txq_drain_flushing = iflib_txq_drain_oactive = + iflib_txq_drain_notready = iflib_txq_drain_encapfail = + iflib_encap_load_mbuf_fail = iflib_encap_txq_avail_fail = + iflib_encap_txd_encap_fail = iflib_task_fn_rxs = iflib_rx_intr_enables = + iflib_fast_intrs = iflib_intr_link = iflib_intr_msix = iflib_rx_unavail = + iflib_rx_ctx_inactive = iflib_rx_zero_len = iflib_rx_if_input = + iflib_rx_mbuf_null = iflib_rxd_flush = 0; +} #else #define DBG_COUNTER_INC(name) - +static void iflib_debug_reset(void) {} #endif @@ -619,6 +631,7 @@ static int iflib_register(if_ctx_t); static void iflib_init_locked(if_ctx_t ctx); static void iflib_add_device_sysctl_pre(if_ctx_t ctx); static void iflib_add_device_sysctl_post(if_ctx_t ctx); +static void iflib_ifmp_purge(iflib_txq_t txq); #ifdef DEV_NETMAP @@ -1266,11 +1279,6 @@ iflib_txsd_alloc(iflib_txq_t txq) sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize); goto fail; } -#ifdef IFLIB_DIAGNOSTICS - device_printf(dev,"maxsize: %zd nsegments: %d maxsegsize: %zd\n", - sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize); - -#endif if ((err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR, /* lowaddr */ @@ -1287,11 +1295,6 @@ iflib_txsd_alloc(iflib_txq_t txq) goto fail; } -#ifdef IFLIB_DIAGNOSTICS - device_printf(dev,"TSO maxsize: %d ntsosegments: %d maxsegsize: %d\n", - scctx->isc_tx_tso_size_max, ntsosegments, - scctx->isc_tx_tso_segsize_max); -#endif if (!(txq->ift_sds.ifsd_flags = (uint8_t *) malloc(sizeof(uint8_t) * scctx->isc_ntxd[txq->ift_br_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { @@ -1921,20 +1924,23 @@ iflib_stop(if_ctx_t ctx) if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); IFDI_INTR_DISABLE(ctx); - msleep(ctx, &ctx->ifc_mtx, PUSER, "iflib_init", hz); + DELAY(100000); + IFDI_STOP(ctx); + DELAY(100000); + iflib_debug_reset(); /* Wait for current tx queue users to exit to disarm watchdog timer. */ for (i = 0; i < scctx->isc_ntxqsets; i++, txq++) { /* make sure all transmitters have completed before proceeding XXX */ /* clean any enqueued buffers */ - iflib_txq_check_drain(txq, 0); + iflib_ifmp_purge(txq); /* Free any existing tx buffers. */ for (j = 0; j < txq->ift_size; j++) { iflib_txsd_free(ctx, txq, j); } txq->ift_processed = txq->ift_cleaned = txq->ift_cidx_processed = 0; - txq->ift_in_use = txq->ift_cidx = txq->ift_pidx = txq->ift_no_desc_avail = 0; + txq->ift_in_use = txq->ift_gen = txq->ift_cidx = txq->ift_pidx = txq->ift_no_desc_avail = 0; txq->ift_closed = txq->ift_mbuf_defrag = txq->ift_mbuf_defrag_failed = 0; txq->ift_no_tx_dma_setup = txq->ift_txd_encap_efbig = txq->ift_map_failed = 0; txq->ift_pullups = 0; @@ -1951,7 +1957,6 @@ iflib_stop(if_ctx_t ctx) for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) iflib_fl_bufs_free(fl); } - IFDI_STOP(ctx); } static iflib_rxsd_t @@ -2890,22 +2895,27 @@ iflib_txq_drain(struct ifmp_ring *r, uin } consumed = mcast_sent = bytes_sent = pkt_sent = 0; count = MIN(avail, TX_BATCH_SIZE); +#ifdef INVARIANTS + if (iflib_verbose_debug) + printf("%s avail=%d ifc_flags=%x txq_avail=%d ", __FUNCTION__, + avail, ctx->ifc_flags, TXQ_AVAIL(txq)); +#endif for (desc_used = i = 0; i < count && TXQ_AVAIL(txq) > MAX_TX_DESC(ctx) + 2; i++) { mp = _ring_peek_one(r, cidx, i); + MPASS(mp != NULL && *mp != NULL); in_use_prev = txq->ift_in_use; - err = iflib_encap(txq, mp); - /* - * What other errors should we bail out for? - */ - if (err == ENOBUFS) { + if ((err = iflib_encap(txq, mp)) == ENOBUFS) { DBG_COUNTER_INC(txq_drain_encapfail); + /* no room - bail out */ break; } consumed++; - if (err) + if (err) { + DBG_COUNTER_INC(txq_drain_encapfail); + /* we can't send this packet - skip it */ continue; - + } pkt_sent++; m = *mp; DBG_COUNTER_INC(tx_sent); @@ -2936,10 +2946,58 @@ iflib_txq_drain(struct ifmp_ring *r, uin if_inc_counter(ifp, IFCOUNTER_OPACKETS, pkt_sent); if (mcast_sent) if_inc_counter(ifp, IFCOUNTER_OMCASTS, mcast_sent); - +#ifdef INVARIANTS + if (iflib_verbose_debug) + printf("consumed=%d\n", consumed); +#endif return (consumed); } +static uint32_t +iflib_txq_drain_always(struct ifmp_ring *r) +{ + return (1); +} + +static uint32_t +iflib_txq_drain_free(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) +{ + int i, avail; + struct mbuf **mp; + iflib_txq_t txq; + + txq = r->cookie; + + txq->ift_qstatus = IFLIB_QUEUE_IDLE; + CALLOUT_LOCK(txq); + callout_stop(&txq->ift_timer); + callout_stop(&txq->ift_db_check); + CALLOUT_UNLOCK(txq); + + avail = IDXDIFF(pidx, cidx, r->size); + for (i = 0; i < avail; i++) { + mp = _ring_peek_one(r, cidx, i); + m_freem(*mp); + } + MPASS(ifmp_ring_is_stalled(r) == 0); + return (avail); +} + +static void +iflib_ifmp_purge(iflib_txq_t txq) +{ + struct ifmp_ring *r; + + r = txq->ift_br[0]; + r->drain = iflib_txq_drain_free; + r->can_drain = iflib_txq_drain_always; + + ifmp_ring_check_drainage(r, r->size); + + r->drain = iflib_txq_drain; + r->can_drain = iflib_txq_can_drain; +} + static void _task_fn_tx(void *context) { @@ -3073,7 +3131,7 @@ iflib_if_transmit(if_t ifp, struct mbuf if (__predict_false((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || !LINK_ACTIVE(ctx))) { DBG_COUNTER_INC(tx_frees); m_freem(m); - return (0); + return (ENOBUFS); } MPASS(m->m_nextpkt == NULL); @@ -3590,6 +3648,10 @@ iflib_device_register(device_t dev, void if (scctx->isc_rss_table_size == 0) scctx->isc_rss_table_size = 64; scctx->isc_rss_table_mask = scctx->isc_rss_table_size-1; + + GROUPTASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx); + /* XXX format name */ + taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx, -1, "admin"); /* ** Now setup MSI or MSI/X, should ** return us the number of supported @@ -4342,6 +4404,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if gtask = &ctx->ifc_txqs[qid].ift_task; tqg = qgroup_if_io_tqg; fn = _task_fn_tx; + GROUPTASK_INIT(gtask, 0, fn, q); break; case IFLIB_INTR_RX: q = &ctx->ifc_rxqs[qid]; @@ -4349,9 +4412,11 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if gtask = &ctx->ifc_rxqs[qid].ifr_task; tqg = qgroup_if_io_tqg; fn = _task_fn_rx; + GROUPTASK_INIT(gtask, 0, fn, q); break; case IFLIB_INTR_ADMIN: q = ctx; + tqrid = -1; info = &ctx->ifc_filter_info; gtask = &ctx->ifc_admin_task; tqg = qgroup_if_config_tqg; @@ -4360,17 +4425,19 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if default: panic("unknown net intr type"); } - GROUPTASK_INIT(gtask, 0, fn, q); info->ifi_filter = filter; info->ifi_filter_arg = filter_arg; info->ifi_task = gtask; - /* XXX query cpu that rid belongs to */ - err = _iflib_irq_alloc(ctx, irq, rid, iflib_fast_intr, NULL, info, name); - if (err != 0) + if (err != 0) { + device_printf(ctx->ifc_dev, "_iflib_irq_alloc failed %d\n", err); return (err); + } + if (type == IFLIB_INTR_ADMIN) + return (0); + if (tqrid != -1) { cpuid = find_nth(ctx, &cpus, qid); taskqgroup_attach_cpu(tqg, gtask, q, cpuid, irq->ii_rid, name); @@ -4402,13 +4469,6 @@ iflib_softirq_alloc_generic(if_ctx_t ctx tqg = qgroup_if_io_tqg; fn = _task_fn_rx; break; - case IFLIB_INTR_ADMIN: - q = ctx; - gtask = &ctx->ifc_admin_task; - tqg = qgroup_if_config_tqg; - rid = -1; - fn = _task_fn_admin; - break; case IFLIB_INTR_IOV: q = ctx; gtask = &ctx->ifc_vflr_task; @@ -4965,7 +5025,6 @@ iflib_add_device_sysctl_post(if_ctx_t ct SYSCTL_ADD_COUNTER_U64(ctx_list, queue_list, OID_AUTO, "r_abdications", CTLFLAG_RD, &txq->ift_br[0]->abdications, "# of consumer abdications in the mp_ring for this queue"); - } if (scctx->isc_nrxqsets > 100) @@ -4987,6 +5046,7 @@ iflib_add_device_sysctl_post(if_ctx_t ct CTLFLAG_RD, &rxq->ifr_cq_cidx, 1, "Consumer Index"); } + for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) { snprintf(namebuf, NAME_BUFLEN, "rxq_fl%d", j); fl_node = SYSCTL_ADD_NODE(ctx_list, queue_list, OID_AUTO, namebuf, From owner-svn-src-head@freebsd.org Fri Nov 18 05:33:03 2016 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 33C84C476F0; Fri, 18 Nov 2016 05:33:03 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DC2F212; Fri, 18 Nov 2016 05:33:02 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAI5X2IZ014993; Fri, 18 Nov 2016 05:33:02 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAI5X1DX014988; Fri, 18 Nov 2016 05:33:01 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611180533.uAI5X1DX014988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Fri, 18 Nov 2016 05:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308793 - in head/sys: conf modules/hyperv/pcib modules/hyperv/vmbus X-SVN-Group: head 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, 18 Nov 2016 05:33:03 -0000 Author: dexuan Date: Fri Nov 18 05:33:01 2016 New Revision: 308793 URL: https://svnweb.freebsd.org/changeset/base/308793 Log: hyperv/pcib: Fix the build for some kernel configs Add the dependency on pci explicitly for the pcib and vmbus drivers. The related Makefiles are updated accordingly too. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 1 week Sponsored by: Microsoft Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/hyperv/pcib/Makefile head/sys/modules/hyperv/vmbus/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Fri Nov 18 04:19:21 2016 (r308792) +++ head/sys/conf/files.amd64 Fri Nov 18 05:33:01 2016 (r308793) @@ -292,7 +292,7 @@ dev/hwpmc/hwpmc_uncore.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/hyperv/pcib/pcib.c optional hyperv +dev/hyperv/pcib/pcib.c optional hyperv pci dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/if_hn.c optional hyperv @@ -305,7 +305,7 @@ dev/hyperv/utilities/hv_timesync.c opt dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv -dev/hyperv/vmbus/vmbus.c optional hyperv +dev/hyperv/vmbus/vmbus.c optional hyperv pci dev/hyperv/vmbus/vmbus_br.c optional hyperv dev/hyperv/vmbus/vmbus_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Nov 18 04:19:21 2016 (r308792) +++ head/sys/conf/files.i386 Fri Nov 18 05:33:01 2016 (r308793) @@ -249,7 +249,7 @@ dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_ppro.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/hyperv/pcib/pcib.c optional hyperv +dev/hyperv/pcib/pcib.c optional hyperv pci dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/if_hn.c optional hyperv @@ -262,7 +262,7 @@ dev/hyperv/utilities/hv_timesync.c opt dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv -dev/hyperv/vmbus/vmbus.c optional hyperv +dev/hyperv/vmbus/vmbus.c optional hyperv pci dev/hyperv/vmbus/vmbus_br.c optional hyperv dev/hyperv/vmbus/vmbus_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv Modified: head/sys/modules/hyperv/pcib/Makefile ============================================================================== --- head/sys/modules/hyperv/pcib/Makefile Fri Nov 18 04:19:21 2016 (r308792) +++ head/sys/modules/hyperv/pcib/Makefile Fri Nov 18 05:33:01 2016 (r308793) @@ -5,7 +5,7 @@ KMOD= vmbus_pcib SRCS= pcib.c -SRCS+= bus_if.h device_if.h vmbus_if.h +SRCS+= bus_if.h device_if.h pci_if.h pcib_if.h vmbus_if.h CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/pcib Modified: head/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- head/sys/modules/hyperv/vmbus/Makefile Fri Nov 18 04:19:21 2016 (r308792) +++ head/sys/modules/hyperv/vmbus/Makefile Fri Nov 18 05:33:01 2016 (r308793) @@ -13,7 +13,7 @@ SRCS= hyperv.c \ vmbus_et.c \ vmbus_if.c \ vmbus_xact.c -SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h vmbus_if.h +SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h pci_if.h pcib_if.h vmbus_if.h # XXX: for assym.s SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h opt_compat.h From owner-svn-src-head@freebsd.org Fri Nov 18 06:24:23 2016 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 6EF6DC471C5; Fri, 18 Nov 2016 06:24:23 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40B1815D1; Fri, 18 Nov 2016 06:24:23 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAI6OMxm034625; Fri, 18 Nov 2016 06:24:22 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAI6OMln034623; Fri, 18 Nov 2016 06:24:22 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611180624.uAI6OMln034623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Fri, 18 Nov 2016 06:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308794 - in head/sys/dev/hyperv: pcib vmbus X-SVN-Group: head 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, 18 Nov 2016 06:24:23 -0000 Author: dexuan Date: Fri Nov 18 06:24:22 2016 New Revision: 308794 URL: https://svnweb.freebsd.org/changeset/base/308794 Log: hyperv/vmbus,pcib: Add MODULE_DEPEND on pci We'd better add this dependency explicitly, though usually the pci driver is built into the kernel by default. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/pcib/pcib.c head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/pcib/pcib.c ============================================================================== --- head/sys/dev/hyperv/pcib/pcib.c Fri Nov 18 05:33:01 2016 (r308793) +++ head/sys/dev/hyperv/pcib/pcib.c Fri Nov 18 06:24:22 2016 (r308794) @@ -1788,3 +1788,4 @@ DEFINE_CLASS_0(pcib, vmbus_pcib_driver, sizeof(struct vmbus_pcib_softc)); DRIVER_MODULE(vmbus_pcib, vmbus, vmbus_pcib_driver, pcib_devclass, 0, 0); MODULE_DEPEND(vmbus_pcib, vmbus, 1, 1, 1); +MODULE_DEPEND(vmbus_pcib, pci, 1, 1, 1); Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Fri Nov 18 05:33:01 2016 (r308793) +++ head/sys/dev/hyperv/vmbus/vmbus.c Fri Nov 18 06:24:22 2016 (r308794) @@ -186,6 +186,7 @@ static devclass_t vmbus_devclass; DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, NULL, NULL); MODULE_DEPEND(vmbus, acpi, 1, 1, 1); +MODULE_DEPEND(vmbus, pci, 1, 1, 1); MODULE_VERSION(vmbus, 1); static __inline struct vmbus_softc * From owner-svn-src-head@freebsd.org Fri Nov 18 06:44:19 2016 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 754DFC47651; Fri, 18 Nov 2016 06:44:19 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43C181E23; Fri, 18 Nov 2016 06:44:19 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAI6iItq042616; Fri, 18 Nov 2016 06:44:18 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAI6iISN042612; Fri, 18 Nov 2016 06:44:18 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611180644.uAI6iISN042612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Fri, 18 Nov 2016 06:44:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308795 - in head/sys: conf dev/hyperv/pcib modules/hyperv/pcib X-SVN-Group: head 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, 18 Nov 2016 06:44:19 -0000 Author: dexuan Date: Fri Nov 18 06:44:18 2016 New Revision: 308795 URL: https://svnweb.freebsd.org/changeset/base/308795 Log: hyperv/pcib: change the file name: pcib.c -> vmbus_pcib.c This makes the file name and the variable naming in the file consistent. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 1 week Sponsored by: Microsoft Added: head/sys/dev/hyperv/pcib/vmbus_pcib.c - copied unchanged from r308794, head/sys/dev/hyperv/pcib/pcib.c Deleted: head/sys/dev/hyperv/pcib/pcib.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/hyperv/pcib/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Fri Nov 18 06:24:22 2016 (r308794) +++ head/sys/conf/files.amd64 Fri Nov 18 06:44:18 2016 (r308795) @@ -292,7 +292,7 @@ dev/hwpmc/hwpmc_uncore.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/hyperv/pcib/pcib.c optional hyperv pci +dev/hyperv/pcib/vmbus_pcib.c optional hyperv pci dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/if_hn.c optional hyperv Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Nov 18 06:24:22 2016 (r308794) +++ head/sys/conf/files.i386 Fri Nov 18 06:44:18 2016 (r308795) @@ -249,7 +249,7 @@ dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_ppro.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/hyperv/pcib/pcib.c optional hyperv pci +dev/hyperv/pcib/vmbus_pcib.c optional hyperv pci dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/if_hn.c optional hyperv Copied: head/sys/dev/hyperv/pcib/vmbus_pcib.c (from r308794, head/sys/dev/hyperv/pcib/pcib.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/pcib/vmbus_pcib.c Fri Nov 18 06:44:18 2016 (r308795, copy of r308794, head/sys/dev/hyperv/pcib/pcib.c) @@ -0,0 +1,1791 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "pcib_if.h" + +#include +#include + +#include +#include +#include +#include +#include + +#include "vmbus_if.h" + +#if __FreeBSD_version < 1100000 +typedef u_long rman_res_t; +#define RM_MAX_END (~(rman_res_t)0) +#endif + +struct completion { + unsigned int done; + struct mtx lock; +}; + +static void +init_completion(struct completion *c) +{ + memset(c, 0, sizeof(*c)); + mtx_init(&c->lock, "hvcmpl", NULL, MTX_DEF); + c->done = 0; +} + +static void +free_completion(struct completion *c) +{ + mtx_destroy(&c->lock); +} + +static void +complete(struct completion *c) +{ + mtx_lock(&c->lock); + c->done++; + mtx_unlock(&c->lock); + wakeup(c); +} + +static void +wait_for_completion(struct completion *c) +{ + mtx_lock(&c->lock); + while (c->done == 0) + mtx_sleep(c, &c->lock, 0, "hvwfc", 0); + c->done--; + mtx_unlock(&c->lock); +} + +#define PCI_MAKE_VERSION(major, minor) ((uint32_t)(((major) << 16) | (major))) + +enum { + PCI_PROTOCOL_VERSION_1_1 = PCI_MAKE_VERSION(1, 1), + PCI_PROTOCOL_VERSION_CURRENT = PCI_PROTOCOL_VERSION_1_1 +}; + +#define PCI_CONFIG_MMIO_LENGTH 0x2000 +#define CFG_PAGE_OFFSET 0x1000 +#define CFG_PAGE_SIZE (PCI_CONFIG_MMIO_LENGTH - CFG_PAGE_OFFSET) + +/* + * Message Types + */ + +enum pci_message_type { + /* + * Version 1.1 + */ + PCI_MESSAGE_BASE = 0x42490000, + PCI_BUS_RELATIONS = PCI_MESSAGE_BASE + 0, + PCI_QUERY_BUS_RELATIONS = PCI_MESSAGE_BASE + 1, + PCI_POWER_STATE_CHANGE = PCI_MESSAGE_BASE + 4, + PCI_QUERY_RESOURCE_REQUIREMENTS = PCI_MESSAGE_BASE + 5, + PCI_QUERY_RESOURCE_RESOURCES = PCI_MESSAGE_BASE + 6, + PCI_BUS_D0ENTRY = PCI_MESSAGE_BASE + 7, + PCI_BUS_D0EXIT = PCI_MESSAGE_BASE + 8, + PCI_READ_BLOCK = PCI_MESSAGE_BASE + 9, + PCI_WRITE_BLOCK = PCI_MESSAGE_BASE + 0xA, + PCI_EJECT = PCI_MESSAGE_BASE + 0xB, + PCI_QUERY_STOP = PCI_MESSAGE_BASE + 0xC, + PCI_REENABLE = PCI_MESSAGE_BASE + 0xD, + PCI_QUERY_STOP_FAILED = PCI_MESSAGE_BASE + 0xE, + PCI_EJECTION_COMPLETE = PCI_MESSAGE_BASE + 0xF, + PCI_RESOURCES_ASSIGNED = PCI_MESSAGE_BASE + 0x10, + PCI_RESOURCES_RELEASED = PCI_MESSAGE_BASE + 0x11, + PCI_INVALIDATE_BLOCK = PCI_MESSAGE_BASE + 0x12, + PCI_QUERY_PROTOCOL_VERSION = PCI_MESSAGE_BASE + 0x13, + PCI_CREATE_INTERRUPT_MESSAGE = PCI_MESSAGE_BASE + 0x14, + PCI_DELETE_INTERRUPT_MESSAGE = PCI_MESSAGE_BASE + 0x15, + PCI_MESSAGE_MAXIMUM +}; + +/* + * Structures defining the virtual PCI Express protocol. + */ + +union pci_version { + struct { + uint16_t minor_version; + uint16_t major_version; + } parts; + uint32_t version; +} __packed; + +/* + * This representation is the one used in Windows, which is + * what is expected when sending this back and forth with + * the Hyper-V parent partition. + */ +union win_slot_encoding { + struct { + uint32_t slot:5; + uint32_t func:3; + uint32_t reserved:24; + } bits; + uint32_t val; +} __packed; + +struct pci_func_desc { + uint16_t v_id; /* vendor ID */ + uint16_t d_id; /* device ID */ + uint8_t rev; + uint8_t prog_intf; + uint8_t subclass; + uint8_t base_class; + uint32_t subsystem_id; + union win_slot_encoding wslot; + uint32_t ser; /* serial number */ +} __packed; + +struct hv_msi_desc { + uint8_t vector; + uint8_t delivery_mode; + uint16_t vector_count; + uint32_t reserved; + uint64_t cpu_mask; +} __packed; + +struct tran_int_desc { + uint16_t reserved; + uint16_t vector_count; + uint32_t data; + uint64_t address; +} __packed; + +struct pci_message { + uint32_t type; +} __packed; + +struct pci_child_message { + struct pci_message message_type; + union win_slot_encoding wslot; +} __packed; + +struct pci_incoming_message { + struct vmbus_chanpkt_hdr hdr; + struct pci_message message_type; +} __packed; + +struct pci_response { + struct vmbus_chanpkt_hdr hdr; + int32_t status; /* negative values are failures */ +} __packed; + +struct pci_packet { + void (*completion_func)(void *context, struct pci_response *resp, + int resp_packet_size); + void *compl_ctxt; + + struct pci_message message[0]; +}; + +/* + * Specific message types supporting the PCI protocol. + */ + +struct pci_version_request { + struct pci_message message_type; + uint32_t protocol_version; + uint32_t is_last_attempt:1; + uint32_t reservedz:31; +} __packed; + +struct pci_bus_d0_entry { + struct pci_message message_type; + uint32_t reserved; + uint64_t mmio_base; +} __packed; + +struct pci_bus_relations { + struct pci_incoming_message incoming; + uint32_t device_count; + struct pci_func_desc func[0]; +} __packed; + +#define MAX_NUM_BARS (PCIR_MAX_BAR_0 + 1) +struct pci_q_res_req_response { + struct vmbus_chanpkt_hdr hdr; + int32_t status; /* negative values are failures */ + uint32_t probed_bar[MAX_NUM_BARS]; +} __packed; + +struct pci_resources_assigned { + struct pci_message message_type; + union win_slot_encoding wslot; + uint8_t memory_range[0x14][MAX_NUM_BARS]; /* unused here */ + uint32_t msi_descriptors; + uint32_t reserved[4]; +} __packed; + +struct pci_create_interrupt { + struct pci_message message_type; + union win_slot_encoding wslot; + struct hv_msi_desc int_desc; +} __packed; + +struct pci_create_int_response { + struct pci_response response; + uint32_t reserved; + struct tran_int_desc int_desc; +} __packed; + +struct pci_delete_interrupt { + struct pci_message message_type; + union win_slot_encoding wslot; + struct tran_int_desc int_desc; +} __packed; + +struct pci_dev_incoming { + struct pci_incoming_message incoming; + union win_slot_encoding wslot; +} __packed; + +struct pci_eject_response { + struct pci_message message_type; + union win_slot_encoding wslot; + uint32_t status; +} __packed; + +/* + * Driver specific state. + */ + +enum hv_pcibus_state { + hv_pcibus_init = 0, + hv_pcibus_installed, +}; + +struct hv_pcibus { + device_t pcib; + device_t pci_bus; + struct vmbus_pcib_softc *sc; + + uint16_t pci_domain; + + enum hv_pcibus_state state; + + struct resource *cfg_res; + + struct completion query_completion, *query_comp; + + struct mtx config_lock; /* Avoid two threads writing index page */ + struct mtx device_list_lock; /* Protect lists below */ + TAILQ_HEAD(, hv_pci_dev) children; + TAILQ_HEAD(, hv_dr_state) dr_list; + + volatile int detaching; +}; + +struct hv_pci_dev { + TAILQ_ENTRY(hv_pci_dev) link; + + struct pci_func_desc desc; + + bool reported_missing; + + struct hv_pcibus *hbus; + struct task eject_task; + + TAILQ_HEAD(, hv_irq_desc) irq_desc_list; + + /* + * What would be observed if one wrote 0xFFFFFFFF to a BAR and then + * read it back, for each of the BAR offsets within config space. + */ + uint32_t probed_bar[MAX_NUM_BARS]; +}; + +/* + * Tracks "Device Relations" messages from the host, which must be both + * processed in order. + */ +struct hv_dr_work { + struct task task; + struct hv_pcibus *bus; +}; + +struct hv_dr_state { + TAILQ_ENTRY(hv_dr_state) link; + uint32_t device_count; + struct pci_func_desc func[0]; +}; + +struct hv_irq_desc { + TAILQ_ENTRY(hv_irq_desc) link; + struct tran_int_desc desc; + int irq; +}; + +#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) +#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) +#define PCI_FUNC(devfn) ((devfn) & 0x07) + +static uint32_t +devfn_to_wslot(unsigned int devfn) +{ + union win_slot_encoding wslot; + + wslot.val = 0; + wslot.bits.slot = PCI_SLOT(devfn); + wslot.bits.func = PCI_FUNC(devfn); + + return (wslot.val); +} + +static unsigned int +wslot_to_devfn(uint32_t wslot) +{ + union win_slot_encoding encoding; + unsigned int slot; + unsigned int func; + + encoding.val = wslot; + + slot = encoding.bits.slot; + func = encoding.bits.func; + + return (PCI_DEVFN(slot, func)); +} + +struct vmbus_pcib_softc { + struct vmbus_channel *chan; + void *rx_buf; + + struct taskqueue *taskq; + + struct hv_pcibus *hbus; +}; + +/* {44C4F61D-4444-4400-9D52-802E27EDE19F} */ +static const struct hyperv_guid g_pass_through_dev_type = { + .hv_guid = {0x1D, 0xF6, 0xC4, 0x44, 0x44, 0x44, 0x00, 0x44, + 0x9D, 0x52, 0x80, 0x2E, 0x27, 0xED, 0xE1, 0x9F} +}; + +struct hv_pci_compl { + struct completion host_event; + int32_t completion_status; +}; + +struct q_res_req_compl { + struct completion host_event; + struct hv_pci_dev *hpdev; +}; + +struct compose_comp_ctxt { + struct hv_pci_compl comp_pkt; + struct tran_int_desc int_desc; +}; + +static void +hv_pci_generic_compl(void *context, struct pci_response *resp, + int resp_packet_size) +{ + struct hv_pci_compl *comp_pkt = context; + + if (resp_packet_size >= sizeof(struct pci_response)) + comp_pkt->completion_status = resp->status; + else + comp_pkt->completion_status = -1; + + complete(&comp_pkt->host_event); +} + +static void +q_resource_requirements(void *context, struct pci_response *resp, + int resp_packet_size) +{ + struct q_res_req_compl *completion = context; + struct pci_q_res_req_response *q_res_req = + (struct pci_q_res_req_response *)resp; + int i; + + if (resp->status < 0) { + printf("vmbus_pcib: failed to query resource requirements\n"); + } else { + for (i = 0; i < MAX_NUM_BARS; i++) + completion->hpdev->probed_bar[i] = + q_res_req->probed_bar[i]; + } + + complete(&completion->host_event); +} + +static void +hv_pci_compose_compl(void *context, struct pci_response *resp, + int resp_packet_size) +{ + struct compose_comp_ctxt *comp_pkt = context; + struct pci_create_int_response *int_resp = + (struct pci_create_int_response *)resp; + + comp_pkt->comp_pkt.completion_status = resp->status; + comp_pkt->int_desc = int_resp->int_desc; + complete(&comp_pkt->comp_pkt.host_event); +} + +static void +hv_int_desc_free(struct hv_pci_dev *hpdev, struct hv_irq_desc *hid) +{ + struct pci_delete_interrupt *int_pkt; + struct { + struct pci_packet pkt; + uint8_t buffer[sizeof(struct pci_delete_interrupt)]; + } ctxt; + + memset(&ctxt, 0, sizeof(ctxt)); + int_pkt = (struct pci_delete_interrupt *)&ctxt.pkt.message; + int_pkt->message_type.type = PCI_DELETE_INTERRUPT_MESSAGE; + int_pkt->wslot.val = hpdev->desc.wslot.val; + int_pkt->int_desc = hid->desc; + + vmbus_chan_send(hpdev->hbus->sc->chan, VMBUS_CHANPKT_TYPE_INBAND, 0, + int_pkt, sizeof(*int_pkt), 0); + + free(hid, M_DEVBUF); +} + +static void +hv_pci_delete_device(struct hv_pci_dev *hpdev) +{ + struct hv_pcibus *hbus = hpdev->hbus; + struct hv_irq_desc *hid, *tmp_hid; + device_t pci_dev; + int devfn; + + devfn = wslot_to_devfn(hpdev->desc.wslot.val); + + mtx_lock(&Giant); + + pci_dev = pci_find_dbsf(hbus->pci_domain, + 0, PCI_SLOT(devfn), PCI_FUNC(devfn)); + if (pci_dev) + device_delete_child(hbus->pci_bus, pci_dev); + + mtx_unlock(&Giant); + + mtx_lock(&hbus->device_list_lock); + TAILQ_REMOVE(&hbus->children, hpdev, link); + mtx_unlock(&hbus->device_list_lock); + + TAILQ_FOREACH_SAFE(hid, &hpdev->irq_desc_list, link, tmp_hid) + hv_int_desc_free(hpdev, hid); + + free(hpdev, M_DEVBUF); +} + +static struct hv_pci_dev * +new_pcichild_device(struct hv_pcibus *hbus, struct pci_func_desc *desc) +{ + struct hv_pci_dev *hpdev; + struct pci_child_message *res_req; + struct q_res_req_compl comp_pkt; + struct { + struct pci_packet pkt; + uint8_t buffer[sizeof(struct pci_child_message)]; + } ctxt; + int ret; + + hpdev = malloc(sizeof(*hpdev), M_DEVBUF, M_WAITOK | M_ZERO); + hpdev->hbus = hbus; + + TAILQ_INIT(&hpdev->irq_desc_list); + + init_completion(&comp_pkt.host_event); + comp_pkt.hpdev = hpdev; + + ctxt.pkt.compl_ctxt = &comp_pkt; + ctxt.pkt.completion_func = q_resource_requirements; + + res_req = (struct pci_child_message *)&ctxt.pkt.message; + res_req->message_type.type = PCI_QUERY_RESOURCE_REQUIREMENTS; + res_req->wslot.val = desc->wslot.val; + + ret = vmbus_chan_send(hbus->sc->chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + res_req, sizeof(*res_req), (uint64_t)&ctxt.pkt); + if (ret) + goto err; + + wait_for_completion(&comp_pkt.host_event); + free_completion(&comp_pkt.host_event); + + hpdev->desc = *desc; + + mtx_lock(&hbus->device_list_lock); + TAILQ_INSERT_TAIL(&hbus->children, hpdev, link); + mtx_unlock(&hbus->device_list_lock); + return (hpdev); +err: + free_completion(&comp_pkt.host_event); + free(hpdev, M_DEVBUF); + return (NULL); +} + +#if __FreeBSD_version < 1100000 + +/* Old versions don't have BUS_RESCAN(). Let's copy it from FreeBSD 11. */ + +static struct pci_devinfo * +pci_identify_function(device_t pcib, device_t dev, int domain, int busno, + int slot, int func, size_t dinfo_size) +{ + struct pci_devinfo *dinfo; + + dinfo = pci_read_device(pcib, domain, busno, slot, func, dinfo_size); + if (dinfo != NULL) + pci_add_child(dev, dinfo); + + return (dinfo); +} + +static int +pci_rescan(device_t dev) +{ +#define REG(n, w) PCIB_READ_CONFIG(pcib, busno, s, f, n, w) + device_t pcib = device_get_parent(dev); + struct pci_softc *sc; + device_t child, *devlist, *unchanged; + int devcount, error, i, j, maxslots, oldcount; + int busno, domain, s, f, pcifunchigh; + uint8_t hdrtype; + + /* No need to check for ARI on a rescan. */ + error = device_get_children(dev, &devlist, &devcount); + if (error) + return (error); + if (devcount != 0) { + unchanged = malloc(devcount * sizeof(device_t), M_TEMP, + M_NOWAIT | M_ZERO); + if (unchanged == NULL) { + free(devlist, M_TEMP); + return (ENOMEM); + } + } else + unchanged = NULL; + + sc = device_get_softc(dev); + domain = pcib_get_domain(dev); + busno = pcib_get_bus(dev); + maxslots = PCIB_MAXSLOTS(pcib); + for (s = 0; s <= maxslots; s++) { + /* If function 0 is not present, skip to the next slot. */ + f = 0; + if (REG(PCIR_VENDOR, 2) == 0xffff) + continue; + pcifunchigh = 0; + hdrtype = REG(PCIR_HDRTYPE, 1); + if ((hdrtype & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) + continue; + if (hdrtype & PCIM_MFDEV) + pcifunchigh = PCIB_MAXFUNCS(pcib); + for (f = 0; f <= pcifunchigh; f++) { + if (REG(PCIR_VENDOR, 2) == 0xffff) + continue; + + /* + * Found a valid function. Check if a + * device_t for this device already exists. + */ + for (i = 0; i < devcount; i++) { + child = devlist[i]; + if (child == NULL) + continue; + if (pci_get_slot(child) == s && + pci_get_function(child) == f) { + unchanged[i] = child; + goto next_func; + } + } + + pci_identify_function(pcib, dev, domain, busno, s, f, + sizeof(struct pci_devinfo)); + next_func:; + } + } + + /* Remove devices that are no longer present. */ + for (i = 0; i < devcount; i++) { + if (unchanged[i] != NULL) + continue; + device_delete_child(dev, devlist[i]); + } + + free(devlist, M_TEMP); + oldcount = devcount; + + /* Try to attach the devices just added. */ + error = device_get_children(dev, &devlist, &devcount); + if (error) { + free(unchanged, M_TEMP); + return (error); + } + + for (i = 0; i < devcount; i++) { + for (j = 0; j < oldcount; j++) { + if (devlist[i] == unchanged[j]) + goto next_device; + } + + device_probe_and_attach(devlist[i]); + next_device:; + } + + free(unchanged, M_TEMP); + free(devlist, M_TEMP); + return (0); +#undef REG +} + +#else + +static int +pci_rescan(device_t dev) +{ + return (BUS_RESCAN(dev)); +} + +#endif + +static void +pci_devices_present_work(void *arg, int pending __unused) +{ + struct hv_dr_work *dr_wrk = arg; + struct hv_dr_state *dr = NULL; + struct hv_pcibus *hbus; + uint32_t child_no; + bool found; + struct pci_func_desc *new_desc; + struct hv_pci_dev *hpdev, *tmp_hpdev; + struct completion *query_comp; + bool need_rescan = false; + + hbus = dr_wrk->bus; + free(dr_wrk, M_DEVBUF); + + /* Pull this off the queue and process it if it was the last one. */ + mtx_lock(&hbus->device_list_lock); + while (!TAILQ_EMPTY(&hbus->dr_list)) { + dr = TAILQ_FIRST(&hbus->dr_list); + TAILQ_REMOVE(&hbus->dr_list, dr, link); + + /* Throw this away if the list still has stuff in it. */ + if (!TAILQ_EMPTY(&hbus->dr_list)) { + free(dr, M_DEVBUF); + continue; + } + } + mtx_unlock(&hbus->device_list_lock); + + if (!dr) + return; + + /* First, mark all existing children as reported missing. */ + mtx_lock(&hbus->device_list_lock); + TAILQ_FOREACH(hpdev, &hbus->children, link) + hpdev->reported_missing = true; + mtx_unlock(&hbus->device_list_lock); + + /* Next, add back any reported devices. */ + for (child_no = 0; child_no < dr->device_count; child_no++) { + found = false; + new_desc = &dr->func[child_no]; + + mtx_lock(&hbus->device_list_lock); + TAILQ_FOREACH(hpdev, &hbus->children, link) { + if ((hpdev->desc.wslot.val == + new_desc->wslot.val) && + (hpdev->desc.v_id == new_desc->v_id) && + (hpdev->desc.d_id == new_desc->d_id) && + (hpdev->desc.ser == new_desc->ser)) { + hpdev->reported_missing = false; + found = true; + break; + } + } + mtx_unlock(&hbus->device_list_lock); + + if (!found) { + if (!need_rescan) + need_rescan = true; + + hpdev = new_pcichild_device(hbus, new_desc); + if (!hpdev) + printf("vmbus_pcib: failed to add a child\n"); + } + } + + /* Remove missing device(s), if any */ + TAILQ_FOREACH_SAFE(hpdev, &hbus->children, link, tmp_hpdev) { + if (hpdev->reported_missing) + hv_pci_delete_device(hpdev); + } + + /* Rescan the bus to find any new device, if necessary. */ + if (hbus->state == hv_pcibus_installed && need_rescan) + pci_rescan(hbus->pci_bus); + + /* Wake up hv_pci_query_relations(), if it's waiting. */ + query_comp = hbus->query_comp; + if (query_comp) { + hbus->query_comp = NULL; + complete(query_comp); + } + + free(dr, M_DEVBUF); +} + +static struct hv_pci_dev * +get_pcichild_wslot(struct hv_pcibus *hbus, uint32_t wslot) +{ + struct hv_pci_dev *hpdev, *ret = NULL; + + mtx_lock(&hbus->device_list_lock); + TAILQ_FOREACH(hpdev, &hbus->children, link) { + if (hpdev->desc.wslot.val == wslot) { + ret = hpdev; + break; + } + } + mtx_unlock(&hbus->device_list_lock); + + return (ret); +} + +static void +hv_pci_devices_present(struct hv_pcibus *hbus, + struct pci_bus_relations *relations) +{ + struct hv_dr_state *dr; + struct hv_dr_work *dr_wrk; + unsigned long dr_size; + + if (hbus->detaching && relations->device_count > 0) + return; + + dr_size = offsetof(struct hv_dr_state, func) + + (sizeof(struct pci_func_desc) * relations->device_count); + dr = malloc(dr_size, M_DEVBUF, M_WAITOK | M_ZERO); + + dr->device_count = relations->device_count; + if (dr->device_count != 0) + memcpy(dr->func, relations->func, + sizeof(struct pci_func_desc) * dr->device_count); + + mtx_lock(&hbus->device_list_lock); + TAILQ_INSERT_TAIL(&hbus->dr_list, dr, link); + mtx_unlock(&hbus->device_list_lock); + + dr_wrk = malloc(sizeof(*dr_wrk), M_DEVBUF, M_WAITOK | M_ZERO); + dr_wrk->bus = hbus; + TASK_INIT(&dr_wrk->task, 0, pci_devices_present_work, dr_wrk); + taskqueue_enqueue(hbus->sc->taskq, &dr_wrk->task); +} + +static void +hv_eject_device_work(void *arg, int pending __unused) +{ + struct hv_pci_dev *hpdev = arg; + union win_slot_encoding wslot = hpdev->desc.wslot; + struct hv_pcibus *hbus = hpdev->hbus; + struct pci_eject_response *eject_pkt; + struct { + struct pci_packet pkt; + uint8_t buffer[sizeof(struct pci_eject_response)]; + } ctxt; + + hv_pci_delete_device(hpdev); + + memset(&ctxt, 0, sizeof(ctxt)); + eject_pkt = (struct pci_eject_response *)&ctxt.pkt.message; + eject_pkt->message_type.type = PCI_EJECTION_COMPLETE; + eject_pkt->wslot.val = wslot.val; + vmbus_chan_send(hbus->sc->chan, VMBUS_CHANPKT_TYPE_INBAND, 0, + eject_pkt, sizeof(*eject_pkt), 0); +} + +static void +hv_pci_eject_device(struct hv_pci_dev *hpdev) +{ + struct hv_pcibus *hbus = hpdev->hbus; + struct taskqueue *taskq; + + if (hbus->detaching) + return; + + /* + * Push this task into the same taskqueue on which + * vmbus_pcib_attach() runs, so we're sure this task can't run + * concurrently with vmbus_pcib_attach(). + */ + TASK_INIT(&hpdev->eject_task, 0, hv_eject_device_work, hpdev); + taskq = vmbus_chan_mgmt_tq(hbus->sc->chan); + taskqueue_enqueue(taskq, &hpdev->eject_task); +} + +#define PCIB_PACKET_SIZE 0x100 + +static void +vmbus_pcib_on_channel_callback(struct vmbus_channel *chan, void *arg) +{ + struct vmbus_pcib_softc *sc = arg; + struct hv_pcibus *hbus = sc->hbus; + + void *buffer; + int bufferlen = PCIB_PACKET_SIZE; + + struct pci_packet *comp_packet; + struct pci_response *response; + struct pci_incoming_message *new_msg; + struct pci_bus_relations *bus_rel; + struct pci_dev_incoming *dev_msg; + struct hv_pci_dev *hpdev; + + buffer = sc->rx_buf; + do { + struct vmbus_chanpkt_hdr *pkt = buffer; + uint32_t bytes_rxed; + int ret; + + bytes_rxed = bufferlen; + ret = vmbus_chan_recv_pkt(chan, pkt, &bytes_rxed); + + if (ret == ENOBUFS) { + /* Handle large packet */ + if (bufferlen > PCIB_PACKET_SIZE) { + free(buffer, M_DEVBUF); + buffer = NULL; + } + + /* alloc new buffer */ + buffer = malloc(bytes_rxed, M_DEVBUF, M_WAITOK | M_ZERO); + bufferlen = bytes_rxed; + + continue; + } + + if (ret != 0) { + /* ignore EIO or EAGAIN */ + break; + } + + if (bytes_rxed <= sizeof(struct pci_response)) + continue; + + switch (pkt->cph_type) { + case VMBUS_CHANPKT_TYPE_COMP: + comp_packet = (struct pci_packet *)pkt->cph_xactid; + response = (struct pci_response *)pkt; + comp_packet->completion_func(comp_packet->compl_ctxt, + response, bytes_rxed); + break; + case VMBUS_CHANPKT_TYPE_INBAND: + new_msg = (struct pci_incoming_message *)buffer; + + switch (new_msg->message_type.type) { + case PCI_BUS_RELATIONS: + bus_rel = (struct pci_bus_relations *)buffer; + + if (bus_rel->device_count == 0) + break; + + if (bytes_rxed < + offsetof(struct pci_bus_relations, func) + + (sizeof(struct pci_func_desc) * + (bus_rel->device_count))) + break; + + hv_pci_devices_present(hbus, bus_rel); + break; + + case PCI_EJECT: + dev_msg = (struct pci_dev_incoming *)buffer; + hpdev = get_pcichild_wslot(hbus, + dev_msg->wslot.val); + + if (hpdev) + hv_pci_eject_device(hpdev); + + break; + default: + printf("vmbus_pcib: Unknown msg type 0x%x\n", + new_msg->message_type.type); + break; + } + break; + default: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Nov 18 07:09:42 2016 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 2F538C47C19; Fri, 18 Nov 2016 07:09:42 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0103.outbound.protection.outlook.com [104.47.34.103]) (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 63565A9A; Fri, 18 Nov 2016 07:09:41 +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=T9gQo15MPCA8gvBceWv7vtvPNRgg6MWONZQ5CXofj9w=; b=iPoGg+yklMSPDUj2Wk+KZKDJFca/K1qlF9KI5htSebyhRhQGqf93caLZQfsX91ynUJIDBhPC5exlwx13b7KShrPeRpaKn6njeEmWSg+eecMKrib5XyxvhdPnTh7Qa4DywKFlVhI9Bzr0GRqez0m9PieTmoI88VuG1vPu2YxOcrU= Received: from CY4PR03MB2662.namprd03.prod.outlook.com (10.173.43.17) by CY4PR03MB2661.namprd03.prod.outlook.com (10.173.43.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Fri, 18 Nov 2016 05:36:37 +0000 Received: from CY4PR03MB2662.namprd03.prod.outlook.com ([10.173.43.17]) by CY4PR03MB2662.namprd03.prod.outlook.com ([10.173.43.17]) with mapi id 15.01.0707.006; Fri, 18 Nov 2016 05:36:37 +0000 From: Dexuan Cui To: Ngie Cooper , Andreas Tobler CC: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: RE: svn commit: r308725 - in head/sys: conf dev/hyperv/pcib modules/hyperv/pcib Thread-Topic: svn commit: r308725 - in head/sys: conf dev/hyperv/pcib modules/hyperv/pcib Thread-Index: AQHSQPp+Oty5/wNzNEWi8HtRc9jC/qDds4GAgABGf5CAAD8NcA== Date: Fri, 18 Nov 2016 05:36:37 +0000 Message-ID: References: <201611160925.uAG9P040059891@repo.freebsd.org> In-Reply-To: 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=decui@microsoft.com; x-originating-ip: [2404:f801:9000:18::7c2] x-microsoft-exchange-diagnostics: 1; CY4PR03MB2661; 7:G65ectgKN2QyKTjXk71bWZnhwOCr/A87o7qJkReS+7MSaL7whNDRlwvt/ywNuNH6KN7JRTdyaWV7N6Ns/MO/sXj8iOQiUeOXwdhaXsO/rjsEKnMc21TsIzWaMZ9YnxiMEHuiPi2C7opGjdHZdFEuDTOREA6bx8f68JHgOtyBVRKW7eg5e7dJ6alsW+8ewzVLBsqshN0gKZXW+CHII8MKg3gM4RTfOnXMZ6DDk1UAqoTYNCNhPlYvP3rZ9ixsHl7Sm+BYXmNzKobS3bglzBgczF4PZW6D/WHzFMyi5SBcTsJj6DvoSduyk2hEXxmO4ikgFRgH0o/M+Y0K3W61rbx0HlcwOyOt4EiEzEtQQfLwxw8No6cVPSJHPu6dgFpK7bQg x-ms-office365-filtering-correlation-id: 043ba54b-37d5-44a0-e608-08d40f74dd81 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR03MB2661; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6045074)(6060326)(6040281)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(61426038)(61427038)(6061324)(6041223)(6046074); SRVR:CY4PR03MB2661; BCL:0; PCL:0; RULEID:; SRVR:CY4PR03MB2661; x-forefront-prvs: 01304918F3 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(189002)(377454003)(51914003)(199003)(24454002)(229853002)(2906002)(189998001)(7696004)(92566002)(77096005)(2900100001)(50986999)(54356999)(8676002)(305945005)(81166006)(76176999)(8990500004)(7736002)(5001770100001)(81156014)(6506003)(106356001)(86362001)(10290500002)(33656002)(86612001)(105586002)(99286002)(5660300001)(102836003)(106116001)(6116002)(101416001)(4326007)(9686002)(122556002)(2950100002)(97736004)(3660700001)(10090500001)(3280700002)(8936002)(87936001)(5005710100001)(7846002)(93886004)(68736007)(74316002)(76576001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR03MB2661; H:CY4PR03MB2662.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; 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: 18 Nov 2016 05:36:37.1752 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2661 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, 18 Nov 2016 07:09:42 -0000 PiBGcm9tOiBEZXh1YW4gQ3VpIFttYWlsdG86ZGVjdWlAbWljcm9zb2Z0LmNvbV0NCj4gPiBGcm9t OiBOZ2llIENvb3BlciBbbWFpbHRvOnlhbmV1cmFiZXlhQGdtYWlsLmNvbV0NCj4gPiBTZW50OiBG cmlkYXksIE5vdmVtYmVyIDE4LCAyMDE2IDA1OjM3DQo+ID4gVG86IEFuZHJlYXMgVG9ibGVyIDxh bmRyZWFzdEBmcmVlYnNkLm9yZz4NCj4gPiBPbiBUaHUsIE5vdiAxNywgMjAxNiBhdCA5OjQ2IEFN LCBBbmRyZWFzIFRvYmxlciA8YW5kcmVhc3RAZnJlZWJzZC5vcmc+DQo+ID4gd3JvdGU6DQo+ID4g PiBPbiAxNi4xMS4xNiAxMDoyNSwgRGV4dWFuIEN1aSB3cm90ZToNCj4gPiA+Pg0KPiA+ID4+IEF1 dGhvcjogZGV4dWFuDQo+ID4gPj4gRGF0ZTogV2VkIE5vdiAxNiAwOToyNTowMCAyMDE2DQo+ID4g Pj4gTmV3IFJldmlzaW9uOiAzMDg3MjUNCj4gPg0KPiA+ID4gLWRldi9oeXBlcnYvcGNpYi9wY2li LmMgICAgICAgICBvcHRpb25hbCAgICAgICAgaHlwZXJ2DQo+ID4gPiArZGV2L2h5cGVydi9wY2li L3BjaWIuYyAgICAgICAgIG9wdGlvbmFsICAgICAgICBoeXBlcnYgcGNpDQo+ID4NCj4gPiAgICAg VGhpcyBzZWVtcyB0byBiZSBjYXVzaW5nIEplbmtpbnMgZmFpbHVyZXMgdG9vOg0KPiA+ICAgICBE b2Vzbid0IHN5cy9tb2R1bGVzL2h5cGVydi92bWJ1cy9NYWtlZmlsZSBuZWVkIHBjaV9pZi5oIG5v dyBpbiBTUkNTPw0KPiA+IFRoYW5rcywNCj4gPiAtTmdpZQ0KPiANCj4gSGkgTmdpZSwgQW5kcmVh cywNCj4gVGhhbmtzIGZvciB0aGUgcmVtaW5kZXIhICBJJ2xsIGZpeCB0aGlzIEFTQVAuDQo+IE5v dyBJJ20gdGVzdGluZyBsb2NhbCBjaGFuZ2VzIGFuZCB3aWxsIHJlcG9ydCBiYWNrIHNob3J0bHku DQogDQpIaSwgSSBjb21taXR0ZWQgYSBwYXRjaCB0byBmaXggdGhlIGlzc3VlIGp1c3Qgbm93Lg0K DQpUaGFua3MsDQotLSBEZXh1YW4NCg== From owner-svn-src-head@freebsd.org Fri Nov 18 07:27:42 2016 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 783B1C44201; Fri, 18 Nov 2016 07:27:42 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4779412A4; Fri, 18 Nov 2016 07:27:42 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAI7RfKY058975; Fri, 18 Nov 2016 07:27:41 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAI7Rfhi058974; Fri, 18 Nov 2016 07:27:41 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611180727.uAI7Rfhi058974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Fri, 18 Nov 2016 07:27:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308797 - head/share/man/man4 X-SVN-Group: head 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, 18 Nov 2016 07:27:42 -0000 Author: dexuan Date: Fri Nov 18 07:27:41 2016 New Revision: 308797 URL: https://svnweb.freebsd.org/changeset/base/308797 Log: update the hv_vmbus(4) manual by adding a dependency on pci We enhanced the vmbus driver to support PCIe pass-through recently. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 1 week Sponsored by: Microsoft Modified: head/share/man/man4/hv_vmbus.4 Modified: head/share/man/man4/hv_vmbus.4 ============================================================================== --- head/share/man/man4/hv_vmbus.4 Fri Nov 18 07:07:00 2016 (r308796) +++ head/share/man/man4/hv_vmbus.4 Fri Nov 18 07:27:41 2016 (r308797) @@ -35,6 +35,7 @@ To compile this driver into the kernel, the system kernel configuration file: .Bd -ragged -offset indent .Cd "device hyperv" +.Cd "device pci" .Ed .Sh DESCRIPTION The From owner-svn-src-head@freebsd.org Fri Nov 18 07:36:01 2016 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 AE11FC444D0; Fri, 18 Nov 2016 07:36:01 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FDBD1769; Fri, 18 Nov 2016 07:36:01 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAI7a0XI063126; Fri, 18 Nov 2016 07:36:00 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAI7a0GI063125; Fri, 18 Nov 2016 07:36:00 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611180736.uAI7a0GI063125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Fri, 18 Nov 2016 07:36:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308798 - head/share/man/man4 X-SVN-Group: head 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, 18 Nov 2016 07:36:01 -0000 Author: dexuan Date: Fri Nov 18 07:36:00 2016 New Revision: 308798 URL: https://svnweb.freebsd.org/changeset/base/308798 Log: remove the hv_ata_pci_disengage(4) manual A few months ago, we removed the driver, which was not necessary any longer. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 1 week Sponsored by: Microsoft Deleted: head/share/man/man4/hv_ata_pci_disengage.4 Modified: head/share/man/man4/hv_vmbus.4 Modified: head/share/man/man4/hv_vmbus.4 ============================================================================== --- head/share/man/man4/hv_vmbus.4 Fri Nov 18 07:27:41 2016 (r308797) +++ head/share/man/man4/hv_vmbus.4 Fri Nov 18 07:36:00 2016 (r308798) @@ -74,7 +74,6 @@ the interface that facilitate high perfo between the VSCs and VSPs. All VSCs utilize the VMBus driver. .Sh SEE ALSO -.Xr hv_ata_pci_disengage 4 , .Xr hv_netvsc 4 , .Xr hv_storvsc 4 , .Xr hv_utils 4 From owner-svn-src-head@freebsd.org Fri Nov 18 08:03:37 2016 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 18811C4604F; Fri, 18 Nov 2016 08:03:37 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (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 C40BE2D7; Fri, 18 Nov 2016 08:03:36 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id 7e8tc3UkvIwqS7e8ucYxyB; Fri, 18 Nov 2016 01:03:29 -0700 X-Authority-Analysis: v=2.2 cv=cNuQihWN c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=L24OOQBejmoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=D50h1nt6sp51YlMmnYIA: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 6DCA1E6; Fri, 18 Nov 2016 00:03:27 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id uAI83RZ3035237; Fri, 18 Nov 2016 00:03:27 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201611180803.uAI83RZ3035237@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: Dexuan Cui cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308798 - head/share/man/man4 In-Reply-To: Message from Dexuan Cui of "Fri, 18 Nov 2016 07:36:00 +0000." <201611180736.uAI7a0GI063125@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 18 Nov 2016 00:03:27 -0800 X-CMAE-Envelope: MS4wfIpaTtjMzOEDVBQ7ItMfsf94S31ac0H3bSunFiEZ+QobF+qv/DeD984u0d44//NfoXgpVs/fFHunDxGk9JvHR19ifSP0R6YfZLcm94rtl9v0uNyp+Awn hpu5VRkQDF/G3CRvllTQmrec5wAKnDI7WqOvWuhvJebD8MJOQ8iuaigpAJIvOicx7Oaf6suy8k8QFfzKupL7Wxa5tb0kDzuhQg0RMgOiHI3Lh4nsCTgJBRV+ enK8LvnNtdsUNjueotSLfROUc8LS5YzHne2+mmCh54dpoo07ve02BEmufhIPgSTx 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, 18 Nov 2016 08:03:37 -0000 In message <201611180736.uAI7a0GI063125@repo.freebsd.org>, Dexuan Cui writes: > Author: dexuan > Date: Fri Nov 18 07:36:00 2016 > New Revision: 308798 > URL: https://svnweb.freebsd.org/changeset/base/308798 > > Log: > remove the hv_ata_pci_disengage(4) manual > > A few months ago, we removed the driver, which was not necessary any longer > . > > Reviewed by: sephe > Approved by: sephe (mentor) > MFC after: 1 week > Sponsored by: Microsoft > > Deleted: > head/share/man/man4/hv_ata_pci_disengage.4 > Modified: > head/share/man/man4/hv_vmbus.4 > > Modified: head/share/man/man4/hv_vmbus.4 > ============================================================================= > = > --- head/share/man/man4/hv_vmbus.4 Fri Nov 18 07:27:41 2016 (r30879 > 7) > +++ head/share/man/man4/hv_vmbus.4 Fri Nov 18 07:36:00 2016 (r30879 > 8) > @@ -74,7 +74,6 @@ the interface that facilitate high perfo > between the VSCs and VSPs. > All VSCs utilize the VMBus driver. > .Sh SEE ALSO > -.Xr hv_ata_pci_disengage 4 , > .Xr hv_netvsc 4 , > .Xr hv_storvsc 4 , > .Xr hv_utils 4 > > This causes a build failure: make[5]: make[5]: don't know how to make hv_ata_pci_disengage.4. Stop make[5]: stopped in /opt/src/svn-current/share/man/man4 *** [all_subdir_share/man/man4] Error code 2 You'll need to remove its reference from the Makefile. -- 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 Nov 18 08:15:47 2016 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 31CD2C4629E; Fri, 18 Nov 2016 08:15:47 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03C52A04; Fri, 18 Nov 2016 08:15:46 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAI8FkWd078867; Fri, 18 Nov 2016 08:15:46 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAI8FktG078866; Fri, 18 Nov 2016 08:15:46 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611180815.uAI8FktG078866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Fri, 18 Nov 2016 08:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308799 - head/share/man/man4 X-SVN-Group: head 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, 18 Nov 2016 08:15:47 -0000 Author: dexuan Date: Fri Nov 18 08:15:45 2016 New Revision: 308799 URL: https://svnweb.freebsd.org/changeset/base/308799 Log: fix share/man/man4/Makefile for hv_ata_pci_disengage.4 We need to remove the line since we removed the related manual just now. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 1 week Sponsored by: Microsoft Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Fri Nov 18 07:36:00 2016 (r308798) +++ head/share/man/man4/Makefile Fri Nov 18 08:15:45 2016 (r308799) @@ -187,7 +187,6 @@ MAN= aac.4 \ ${_hptmv.4} \ ${_hptnr.4} \ ${_hptrr.4} \ - hv_ata_pci_disengage.4 \ hv_kvp.4 \ hv_netvsc.4 \ hv_storvsc.4 \ From owner-svn-src-head@freebsd.org Fri Nov 18 08:52:13 2016 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 173EFC47B89; Fri, 18 Nov 2016 08:52:13 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0104.outbound.protection.outlook.com [104.47.34.104]) (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 C4E8720A; Fri, 18 Nov 2016 08:52:12 +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=41WCPEqrionPgFxydhy1Skxrqcks0Xh97vYyP3r7lrM=; b=XH+i/EqQNctPTgTgZRkuKh2yUmgFiniggP7sSzE/3tbQBS4Irx14R7bsV8s6H7IYWZOfhggCop92KpU8ANfeJT3703NPLr3jlX9anzv36q4y7hXnjJ7tblDFJWLNqIp+rsfdKcsxq/ejmYomURx433rdYU7hmD+0vE4OmRc7tyE= Received: from CY4PR03MB2662.namprd03.prod.outlook.com (10.173.43.17) by CY4PR03MB2661.namprd03.prod.outlook.com (10.173.43.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Fri, 18 Nov 2016 08:18:13 +0000 Received: from CY4PR03MB2662.namprd03.prod.outlook.com ([10.173.43.17]) by CY4PR03MB2662.namprd03.prod.outlook.com ([10.173.43.17]) with mapi id 15.01.0707.006; Fri, 18 Nov 2016 08:18:13 +0000 From: Dexuan Cui To: Cy Schubert CC: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: RE: svn commit: r308798 - head/share/man/man4 Thread-Topic: svn commit: r308798 - head/share/man/man4 Thread-Index: AQHSQXJGyyVEkQQ01UWDUKGoAysOOqDeZRxQ Date: Fri, 18 Nov 2016 08:18:13 +0000 Message-ID: References: Message from Dexuan Cui of "Fri, 18 Nov 2016 07:36:00 +0000." <201611180736.uAI7a0GI063125@repo.freebsd.org> <201611180803.uAI83RZ3035237@slippy.cwsent.com> In-Reply-To: <201611180803.uAI83RZ3035237@slippy.cwsent.com> 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=decui@microsoft.com; x-originating-ip: [2404:f801:9000:18::7c2] x-microsoft-exchange-diagnostics: 1; CY4PR03MB2661; 7:zkyttUgR2YsD13mGywVGUYIfNr3oXop06YsLkFM9xZtOsNEgBGqfAE8EVRMTqu9ac+A06S8xjd/IXi83ZZ+FPX/KC4/8A/PspH8lQ8AiUP17HIYE/m7twYOwsoru0V0WvQSN5VLNnifosvbCXblg7U6DfGuPR415Tt7T08MMP1z5sGwuY0dVbrCGrhTn26qq7Z4vEj9hiCDIpOR+pHv6kLZPknHCbB4m+z8x0+j8x55zUeTC/5FOwGc0qz3LtjfR0Uw6PtfzqKlW6dkr0iGVxcU9rV8EwrXGKfq2M3wWqujIgaYQN7b6CZnOImN33I04jY70VxeZ9KJpvT796qOj80FVctzVtH8/kW9/6CptModpgam5qXSMnl5YOK7xz9r8 x-ms-office365-filtering-correlation-id: 0967ee10-c155-44f9-52da-08d40f8b7126 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR03MB2661; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(211171220733660); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6045074)(6060326)(6040281)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(61426038)(61427038)(6046074)(6061324)(6041223); SRVR:CY4PR03MB2661; BCL:0; PCL:0; RULEID:; SRVR:CY4PR03MB2661; x-forefront-prvs: 01304918F3 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(199003)(189002)(10090500001)(3660700001)(5005710100001)(6916009)(87936001)(345774005)(8936002)(3280700002)(122556002)(9686002)(2950100002)(4326007)(97736004)(74316002)(110136003)(76576001)(7846002)(68736007)(7736002)(81166006)(8990500004)(76176999)(81156014)(229853002)(2906002)(2900100001)(50986999)(8676002)(305945005)(92566002)(54356999)(7696004)(189998001)(77096005)(102836003)(99286002)(5660300001)(6116002)(101416001)(106116001)(86362001)(6506003)(106356001)(105586002)(86612001)(10290500002)(38730400001)(33656002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR03MB2661; H:CY4PR03MB2662.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2016 08:18:13.7078 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2661 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, 18 Nov 2016 08:52:13 -0000 > > head/share/man/man4/hv_ata_pci_disengage.4 > > Modified: > > head/share/man/man4/hv_vmbus.4 > > @@ -74,7 +74,6 @@ the interface that facilitate high perfo > > between the VSCs and VSPs. > > All VSCs utilize the VMBus driver. > > .Sh SEE ALSO > > -.Xr hv_ata_pci_disengage 4 , > > .Xr hv_netvsc 4 , >=20 > This causes a build failure: >=20 > make[5]: make[5]: don't know how to make hv_ata_pci_disengage.4. Stop >=20 > make[5]: stopped in /opt/src/svn-current/share/man/man4 > *** [all_subdir_share/man/man4] Error code 2 >=20 > You'll need to remove its reference from the Makefile. Hi Cy, Thank you for reporting this! I committed a fix just now.=20 Thanks, -- Dexuan From owner-svn-src-head@freebsd.org Fri Nov 18 10:23:27 2016 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 E5709C48B9E; Fri, 18 Nov 2016 10:23:27 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-41.csi.cam.ac.uk (ppsw-41.csi.cam.ac.uk [131.111.8.141]) by mx1.freebsd.org (Postfix) with ESMTP id B01151C1F; Fri, 18 Nov 2016 10:23:27 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:24599) by ppsw-41.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1c7gKL-0000dJ-SP (Exim 4.86_36-e07b163) (return-path ); Fri, 18 Nov 2016 10:23:25 +0000 Date: Fri, 18 Nov 2016 10:22:35 +0000 From: Ruslan Bukin To: Alan Cox Cc: Konstantin Belousov , Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-ID: <20161118102235.GA40554@bsdpad.com> References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> <20161116165343.GX54029@kib.kiev.ua> <20161116165939.GA12498@bsdpad.com> <20161116175210.GA13203@bsdpad.com> <9047aad0-0713-5d7a-f92e-6f931642bb27@rice.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <9047aad0-0713-5d7a-f92e-6f931642bb27@rice.edu> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" 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, 18 Nov 2016 10:23:28 -0000 On Thu, Nov 17, 2016 at 10:51:40AM -0600, Alan Cox wrote: > On 11/16/2016 11:52, Ruslan Bukin wrote: > > On Wed, Nov 16, 2016 at 04:59:39PM +0000, Ruslan Bukin wrote: > >> On Wed, Nov 16, 2016 at 06:53:43PM +0200, Konstantin Belousov wrote: > >>> On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: > >>>> I have a panic with this on RISC-V. Any ideas ? > >>> How did you checked that the revision you replied to, makes the problem ? > >>> Note that the backtrace below is not reasonable. > >> I reverted this commit like that and rebuilt kernel: > >> git show 2fa36073055134deb2df39c7ca46264cfc313d77 | patch -p1 -R > >> > >> So the problem is reproducible on dual-core with 32mb mdroot. > >> > > I just found another interesting behavior: > > depending on amount of physical memory : > > 700m - panic > > 800m - works fine > > 1024m - panic > > I think that this behavior is not inconsistent with your report of the > system crashing if you enabled two cores but not one. Specifically, > changing the number of active cores will slightly affect the amount of > memory that is allocated during initialization. > > There is nothing unusual in the sysctl output that you sent out. > > I have two suggestions. Try these in order. > > 1. r308691 reduced the size of struct vm_object. Try undoing the one > snippet that reduced the vm object size and see if that makes a difference. > > > @@ -118,7 +118,6 @@ > vm_ooffset_t backing_object_offset;/* Offset in backing object */ > TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ > LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ > - struct vm_radix cache; /* (o + f) root of the cache page radix trie */ > void *handle; > union { > /* > > > 2. I'd like to know if vm_page_scan_contig() is being called. > > Finally, to simply the situation a little, I would suggest that you > disable superpage reservations in vmparam.h. You have no need for them. > > I made another one merge from svn-head and problem disappeared for 700m,1024m of physical memory, but now I able to reproduce it with 900m of physical memory. Restoring 'struct vm_radix cache' in struct vm_object gives no behavior changes. Adding a panic() call to vm_page_scan_contig gives an original panic (so vm_page_scan_contig is not called), it looks like size of function is changed and it unhides the original problem. Disable superpage reservations changes behavior and gives same panic on 1024m boot. Finally, if I comment ruxagg call in kern_resource then I can't reproduce the problem any more with any amount of memory in any setup: --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1063,7 +1063,7 @@ rufetch(struct proc *p, struct rusage *ru) *ru = p->p_ru; if (p->p_numthreads > 0) { FOREACH_THREAD_IN_PROC(p, td) { - ruxagg(p, td); + //ruxagg(p, td); rucollect(ru, &td->td_ru); } } I found this patch in my early RISC-V development directory, so it looks the problem persist whole the freebsd/riscv life, but was hidden until now. Ruslan From owner-svn-src-head@freebsd.org Fri Nov 18 10:26:07 2016 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 A62A2C48C0B; Fri, 18 Nov 2016 10:26:07 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id 768E31DC8; Fri, 18 Nov 2016 10:26:07 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (host81-149-102-120.in-addr.btopenworld.com [81.149.102.120]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id 7C077D7DC6; Fri, 18 Nov 2016 10:24:46 +0000 (UTC) Date: Fri, 18 Nov 2016 10:25:31 +0000 From: Andrew Turner To: Dexuan Cui Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308799 - head/share/man/man4 Message-ID: <20161118102531.664e22cb@zapp> In-Reply-To: <201611180815.uAI8FktG078866@repo.freebsd.org> References: <201611180815.uAI8FktG078866@repo.freebsd.org> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; 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: Fri, 18 Nov 2016 10:26:07 -0000 On Fri, 18 Nov 2016 08:15:46 +0000 (UTC) Dexuan Cui wrote: > Author: dexuan > Date: Fri Nov 18 08:15:45 2016 > New Revision: 308799 > URL: https://svnweb.freebsd.org/changeset/base/308799 > > Log: > fix share/man/man4/Makefile for hv_ata_pci_disengage.4 > > We need to remove the line since we removed the related manual just > now. > Reviewed by: sephe > Approved by: sephe (mentor) > MFC after: 1 week > Sponsored by: Microsoft > > Modified: > head/share/man/man4/Makefile > > Modified: head/share/man/man4/Makefile > ============================================================================== > --- head/share/man/man4/Makefile Fri Nov 18 07:36:00 > 2016 (r308798) +++ head/share/man/man4/Makefile Fri Nov > 18 08:15:45 2016 (r308799) @@ -187,7 +187,6 @@ MAN= > aac.4 \ ${_hptmv.4} \ > ${_hptnr.4} \ > ${_hptrr.4} \ > - hv_ata_pci_disengage.4 \ > hv_kvp.4 \ > hv_netvsc.4 \ > hv_storvsc.4 \ > Should the other Hyper-V man pages be installed on architectures where the driver is unavailable? Andrew From owner-svn-src-head@freebsd.org Fri Nov 18 10:37:40 2016 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 73F34C4802A; Fri, 18 Nov 2016 10:37:40 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::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 01D2E89F; Fri, 18 Nov 2016 10:37:39 +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 uAIAbSvw045790 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 18 Nov 2016 12:37:28 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua uAIAbSvw045790 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id uAIAbSIe045789; Fri, 18 Nov 2016 12:37:28 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 18 Nov 2016 12:37:28 +0200 From: Konstantin Belousov To: Ruslan Bukin Cc: Alan Cox , Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-ID: <20161118103728.GE54029@kib.kiev.ua> References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> <20161116165343.GX54029@kib.kiev.ua> <20161116165939.GA12498@bsdpad.com> <20161116175210.GA13203@bsdpad.com> <9047aad0-0713-5d7a-f92e-6f931642bb27@rice.edu> <20161118102235.GA40554@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161118102235.GA40554@bsdpad.com> User-Agent: Mutt/1.7.1 (2016-10-04) 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: Fri, 18 Nov 2016 10:37:40 -0000 On Fri, Nov 18, 2016 at 10:22:35AM +0000, Ruslan Bukin wrote: > On Thu, Nov 17, 2016 at 10:51:40AM -0600, Alan Cox wrote: > > On 11/16/2016 11:52, Ruslan Bukin wrote: > > > On Wed, Nov 16, 2016 at 04:59:39PM +0000, Ruslan Bukin wrote: > > >> On Wed, Nov 16, 2016 at 06:53:43PM +0200, Konstantin Belousov wrote: > > >>> On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: > > >>>> I have a panic with this on RISC-V. Any ideas ? > > >>> How did you checked that the revision you replied to, makes the problem ? > > >>> Note that the backtrace below is not reasonable. > > >> I reverted this commit like that and rebuilt kernel: > > >> git show 2fa36073055134deb2df39c7ca46264cfc313d77 | patch -p1 -R > > >> > > >> So the problem is reproducible on dual-core with 32mb mdroot. > > >> > > > I just found another interesting behavior: > > > depending on amount of physical memory : > > > 700m - panic > > > 800m - works fine > > > 1024m - panic > > > > I think that this behavior is not inconsistent with your report of the > > system crashing if you enabled two cores but not one. Specifically, > > changing the number of active cores will slightly affect the amount of > > memory that is allocated during initialization. > > > > There is nothing unusual in the sysctl output that you sent out. > > > > I have two suggestions. Try these in order. > > > > 1. r308691 reduced the size of struct vm_object. Try undoing the one > > snippet that reduced the vm object size and see if that makes a difference. > > > > > > @@ -118,7 +118,6 @@ > > vm_ooffset_t backing_object_offset;/* Offset in backing object */ > > TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ > > LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ > > - struct vm_radix cache; /* (o + f) root of the cache page radix trie */ > > void *handle; > > union { > > /* > > > > > > 2. I'd like to know if vm_page_scan_contig() is being called. > > > > Finally, to simply the situation a little, I would suggest that you > > disable superpage reservations in vmparam.h. You have no need for them. > > > > > > I made another one merge from svn-head and problem disappeared for 700m,1024m of physical memory, but now I able to reproduce it with 900m of physical memory. > > Restoring 'struct vm_radix cache' in struct vm_object gives no behavior changes. > > Adding a panic() call to vm_page_scan_contig gives an original panic (so vm_page_scan_contig is not called), > it looks like size of function is changed and it unhides the original problem. > > Disable superpage reservations changes behavior and gives same panic on 1024m boot. > > Finally, if I comment ruxagg call in kern_resource then I can't reproduce the problem any more with any amount of memory in any setup: > > --- a/sys/kern/kern_resource.c > +++ b/sys/kern/kern_resource.c > @@ -1063,7 +1063,7 @@ rufetch(struct proc *p, struct rusage *ru) > *ru = p->p_ru; > if (p->p_numthreads > 0) { > FOREACH_THREAD_IN_PROC(p, td) { > - ruxagg(p, td); > + //ruxagg(p, td); > rucollect(ru, &td->td_ru); > } > } > > I found this patch in my early RISC-V development directory, so it looks the problem persist whole the freebsd/riscv life, but was hidden until now. > If you comment out the rufetch() call in proc0_post(), does the problem go away as well ? I suggest to start with fixing the backtrace anyway, because the backtrace you posted is wrong. From owner-svn-src-head@freebsd.org Fri Nov 18 11:22:01 2016 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 D8BE5C48E10; Fri, 18 Nov 2016 11:22:01 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0113.outbound.protection.outlook.com [104.47.33.113]) (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 6154A337; Fri, 18 Nov 2016 11:22:01 +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=5KBz1tjmZySyMLEvjzgof8keK0LhBNtkziw35X2UJL4=; b=WBSAAYJy9IVlb8vXh/RKKwJsLGkQPQXPwETWJyuYE5LKhBap2meyFK9SY/eMPn0qdG8uDNNLX2A+5Pkpxz/LlAwFnqYHS6IfxW4lSxdo9ChagZXasYottCIVBxqtK7PQlXUa/AZRslzqClK0zwFGLP1mCKEIaZdJOE7GSmlsERk= Received: from MWHPR03MB2669.namprd03.prod.outlook.com (10.168.207.15) by MWHPR03MB2672.namprd03.prod.outlook.com (10.168.207.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8; Fri, 18 Nov 2016 11:21:58 +0000 Received: from MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) by MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) with mapi id 15.01.0734.007; Fri, 18 Nov 2016 11:21:58 +0000 From: Dexuan Cui To: Andrew Turner , Dexuan Cui CC: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: RE: svn commit: r308799 - head/share/man/man4 Thread-Topic: svn commit: r308799 - head/share/man/man4 Thread-Index: AQHSQYYu/obNDDy+RUug5tT6vY6PUqDemD+w Date: Fri, 18 Nov 2016 11:21:58 +0000 Message-ID: References: <201611180815.uAI8FktG078866@repo.freebsd.org> <20161118102531.664e22cb@zapp> In-Reply-To: <20161118102531.664e22cb@zapp> 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=decui@microsoft.com; x-originating-ip: [2404:f801:9000:18::7c2] x-microsoft-exchange-diagnostics: 1; MWHPR03MB2672; 7:ou50eqEUkBalDi71UxzHI34xg766MxAyKwN0Ay12Q2bA4T0HfhSlsm4fGA8124i6teG3PRFHVtyaBe/robPCqmkVrDW8wrNG7A2eh8qm2hl+sT1khKS7XDr0UZNGpOHb2RqFrTyYavPGpA+tD9bIYBx8wVmHZZYsDUz4kWMjCMa973ZUI1ISEMZ9q41s2jfdpndYS+Zoh57tPIzYeAKaAWj0I43x5COQqawhJN4lth+fQTxc+Bn8x7UlgxcVe11lri59wJszuUWm0HjYDUa8WedNyY3hiClasBAzgj9AVQ/nQGjkFSQ/pcg13Dnk5AwarBkuqFZg7o8pVLf5tIfFolANYuoZ+a2NDb5WQT+BCEFjtjG3K2b6Z6k3UVtLNcfa x-ms-office365-filtering-correlation-id: f7ed1675-2264-4eb6-dce2-08d40fa51c46 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2672; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6045074)(6060326)(6040281)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(61426038)(61427038)(6046074)(6041223)(6061324)(6072148)(6047074); SRVR:MWHPR03MB2672; BCL:0; PCL:0; RULEID:; SRVR:MWHPR03MB2672; x-forefront-prvs: 01304918F3 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(189002)(199003)(86612001)(2906002)(99286002)(106356001)(7696004)(105586002)(92566002)(106116001)(3660700001)(77096005)(3280700002)(87936001)(86362001)(122556002)(5660300001)(2900100001)(10090500001)(38730400001)(76576001)(2950100002)(50986999)(10290500002)(76176999)(54356999)(4326007)(5005710100001)(101416001)(8990500004)(33656002)(7846002)(189998001)(5001770100001)(97736004)(81156014)(81166006)(102836003)(7736002)(305945005)(8936002)(9686002)(68736007)(8676002)(74316002)(6116002)(229853002)(6506003)(19627235001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR03MB2672; H:MWHPR03MB2669.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2016 11:21:58.3688 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2672 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, 18 Nov 2016 11:22:02 -0000 > > Author: dexuan > > Date: Fri Nov 18 08:15:45 2016 > > New Revision: 308799 > > Modified: head/share/man/man4/Makefile > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/share/man/man4/Makefile Fri Nov 18 07:36:00 > > 2016 (r308798) +++ head/share/man/man4/Makefile Fri Nov > > 18 08:15:45 2016 (r308799) @@ -187,7 +187,6 @@ MAN=3D > > aac.4 \ ${_hptmv.4} \ > > ${_hptnr.4} \ > > ${_hptrr.4} \ > > - hv_ata_pci_disengage.4 \ > > hv_kvp.4 \ > > hv_netvsc.4 \ > > hv_storvsc.4 \ > > >=20 > Should the other Hyper-V man pages be installed on architectures where > the driver is unavailable? >=20 > Andrew I don't think so. :-) I created a patch for this: https://reviews.freebsd.org/D8572 Thanks, -- Dexuan From owner-svn-src-head@freebsd.org Fri Nov 18 13:22:20 2016 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 7502DC4532C; Fri, 18 Nov 2016 13:22:20 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-41.csi.cam.ac.uk (ppsw-41.csi.cam.ac.uk [131.111.8.141]) by mx1.freebsd.org (Postfix) with ESMTP id 3F336F9A; Fri, 18 Nov 2016 13:22:19 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:42312) by ppsw-41.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1c7j7T-0008Mk-QM (Exim 4.86_36-e07b163) (return-path ); Fri, 18 Nov 2016 13:22:19 +0000 Date: Fri, 18 Nov 2016 13:21:28 +0000 From: Ruslan Bukin To: Konstantin Belousov Cc: Alan Cox , Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-ID: <20161118132128.GA43507@bsdpad.com> References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> <20161116165343.GX54029@kib.kiev.ua> <20161116165939.GA12498@bsdpad.com> <20161116175210.GA13203@bsdpad.com> <9047aad0-0713-5d7a-f92e-6f931642bb27@rice.edu> <20161118102235.GA40554@bsdpad.com> <20161118103728.GE54029@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161118103728.GE54029@kib.kiev.ua> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" 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, 18 Nov 2016 13:22:20 -0000 On Fri, Nov 18, 2016 at 12:37:28PM +0200, Konstantin Belousov wrote: > On Fri, Nov 18, 2016 at 10:22:35AM +0000, Ruslan Bukin wrote: > > On Thu, Nov 17, 2016 at 10:51:40AM -0600, Alan Cox wrote: > > > On 11/16/2016 11:52, Ruslan Bukin wrote: > > > > On Wed, Nov 16, 2016 at 04:59:39PM +0000, Ruslan Bukin wrote: > > > >> On Wed, Nov 16, 2016 at 06:53:43PM +0200, Konstantin Belousov wrote: > > > >>> On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: > > > >>>> I have a panic with this on RISC-V. Any ideas ? > > > >>> How did you checked that the revision you replied to, makes the problem ? > > > >>> Note that the backtrace below is not reasonable. > > > >> I reverted this commit like that and rebuilt kernel: > > > >> git show 2fa36073055134deb2df39c7ca46264cfc313d77 | patch -p1 -R > > > >> > > > >> So the problem is reproducible on dual-core with 32mb mdroot. > > > >> > > > > I just found another interesting behavior: > > > > depending on amount of physical memory : > > > > 700m - panic > > > > 800m - works fine > > > > 1024m - panic > > > > > > I think that this behavior is not inconsistent with your report of the > > > system crashing if you enabled two cores but not one. Specifically, > > > changing the number of active cores will slightly affect the amount of > > > memory that is allocated during initialization. > > > > > > There is nothing unusual in the sysctl output that you sent out. > > > > > > I have two suggestions. Try these in order. > > > > > > 1. r308691 reduced the size of struct vm_object. Try undoing the one > > > snippet that reduced the vm object size and see if that makes a difference. > > > > > > > > > @@ -118,7 +118,6 @@ > > > vm_ooffset_t backing_object_offset;/* Offset in backing object */ > > > TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ > > > LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ > > > - struct vm_radix cache; /* (o + f) root of the cache page radix trie */ > > > void *handle; > > > union { > > > /* > > > > > > > > > 2. I'd like to know if vm_page_scan_contig() is being called. > > > > > > Finally, to simply the situation a little, I would suggest that you > > > disable superpage reservations in vmparam.h. You have no need for them. > > > > > > > > > > I made another one merge from svn-head and problem disappeared for 700m,1024m of physical memory, but now I able to reproduce it with 900m of physical memory. > > > > Restoring 'struct vm_radix cache' in struct vm_object gives no behavior changes. > > > > Adding a panic() call to vm_page_scan_contig gives an original panic (so vm_page_scan_contig is not called), > > it looks like size of function is changed and it unhides the original problem. > > > > Disable superpage reservations changes behavior and gives same panic on 1024m boot. > > > > Finally, if I comment ruxagg call in kern_resource then I can't reproduce the problem any more with any amount of memory in any setup: > > > > --- a/sys/kern/kern_resource.c > > +++ b/sys/kern/kern_resource.c > > @@ -1063,7 +1063,7 @@ rufetch(struct proc *p, struct rusage *ru) > > *ru = p->p_ru; > > if (p->p_numthreads > 0) { > > FOREACH_THREAD_IN_PROC(p, td) { > > - ruxagg(p, td); > > + //ruxagg(p, td); > > rucollect(ru, &td->td_ru); > > } > > } > > > > I found this patch in my early RISC-V development directory, so it looks the problem persist whole the freebsd/riscv life, but was hidden until now. > > > > If you comment out the rufetch() call in proc0_post(), does the problem go > away as well ? Yes it goes away as well (sys/kern/kern_resource.c reverted). --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -591,7 +591,7 @@ proc0_post(void *dummy __unused) { struct timespec ts; struct proc *p; - struct rusage ru; + //struct rusage ru; struct thread *td; /* @@ -602,7 +602,7 @@ proc0_post(void *dummy __unused) FOREACH_PROC_IN_SYSTEM(p) { microuptime(&p->p_stats->p_start); PROC_STATLOCK(p); - rufetch(p, &ru); /* Clears thread stats */ + //rufetch(p, &ru); /* Clears thread stats */ PROC_STATUNLOCK(p); p->p_rux.rux_runtime = 0; p->p_rux.rux_uticks = 0; > > I suggest to start with fixing the backtrace anyway, because the backtrace > you posted is wrong. yeah I see it show: rufetch() at exec_shell_imgact+0x1204 instead of rufetch() at proc0_post()+0x88 BTW problem is also goes away when Spike simulator run in debug mode (when you compare PC with some value on each cycle for example). I suppose it goes away on slower machines as well. I will debug more. Ruslan From owner-svn-src-head@freebsd.org Fri Nov 18 13:50:46 2016 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 D2F59C45ED7; Fri, 18 Nov 2016 13:50:46 +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 95AEC91; Fri, 18 Nov 2016 13:50:46 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id 7jYwc3aOWvsSM7jYxcC7gJ; Fri, 18 Nov 2016 06:50:44 -0700 X-Authority-Analysis: v=2.2 cv=R8tzIZZX c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=L24OOQBejmoA:10 a=UqCG9HQmAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=4lH9DK-h55J5Tn09RXQA:9 a=CjuIK1q_8ugA:10 a=XqhbnV00hwtEhPrFMTfD:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 6A51C38A; Fri, 18 Nov 2016 05:50:42 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id uAIDofiM071780; Fri, 18 Nov 2016 05:50:41 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201611181350.uAIDofiM071780@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: Dexuan Cui cc: Cy Schubert , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r308798 - head/share/man/man4 In-Reply-To: Message from Dexuan Cui of "Fri, 18 Nov 2016 08:18:13 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 18 Nov 2016 05:50:41 -0800 X-CMAE-Envelope: MS4wfPIJbWtRtcaCJsygTcx+fL5JE8IYTSQEW2JTSltHDQ/w3vIcC4k90tmFOCA5OR2UzJgi2NPGUPBGv+rPb8/x/l1//2XTzW27pgsQHOpfpXVNSVlyhEsV I6yk+GIGC9b+E5aqeeM376ZHuGVoY1ulfdbFHyj4EWMj6fCDYWdLEhCmdoIAtFATgIxOYkxnftX4qEbsGpjZaGehWhDs9Z3wpmtjRLnieVPQqKNw7/Iq4rpt kcTz3m2VXMSGamjdxRA2W8XbfxlQSgtKDWq5B85QtHqsc747fTWy+hT9Gpu9ZsfT 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, 18 Nov 2016 13:50:46 -0000 In message , Dexuan Cui writes: > > > head/share/man/man4/hv_ata_pci_disengage.4 > > > Modified: > > > head/share/man/man4/hv_vmbus.4 > > > @@ -74,7 +74,6 @@ the interface that facilitate high perfo > > > between the VSCs and VSPs. > > > All VSCs utilize the VMBus driver. > > > .Sh SEE ALSO > > > -.Xr hv_ata_pci_disengage 4 , > > > .Xr hv_netvsc 4 , > > > > This causes a build failure: > > > > make[5]: make[5]: don't know how to make hv_ata_pci_disengage.4. Stop > > > > make[5]: stopped in /opt/src/svn-current/share/man/man4 > > *** [all_subdir_share/man/man4] Error code 2 > > > > You'll need to remove its reference from the Makefile. > > Hi Cy, > > Thank you for reporting this! I committed a fix just now. Thanks for fixing it so quickly. ;) -- 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 Nov 18 14:06:31 2016 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 4FDA3C483FB; Fri, 18 Nov 2016 14:06:31 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13068E16; Fri, 18 Nov 2016 14:06:31 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAIE6ULc017231; Fri, 18 Nov 2016 14:06:30 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAIE6UDP017228; Fri, 18 Nov 2016 14:06:30 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201611181406.uAIE6UDP017228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Fri, 18 Nov 2016 14:06:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308803 - head/sys/mips/atheros/ar531x X-SVN-Group: head 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, 18 Nov 2016 14:06:31 -0000 Author: mizhka Date: Fri Nov 18 14:06:29 2016 New Revision: 308803 URL: https://svnweb.freebsd.org/changeset/base/308803 Log: [mips/ar531x] code cleanup, non-INTRNG support This commit improves code styles like: - removing commented code - format comments as C-style - add spaces after #define-s It also bring ability to build kernel without INTRNG and remove RedBoot dependency. Tested on FON2201 Submitted by: Hiroki Sato Reviewed by: adrian, mizhka Approved by: adrian(mentor) Differential Revision: https://reviews.freebsd.org/D8557 Modified: head/sys/mips/atheros/ar531x/files.ar5315 head/sys/mips/atheros/ar531x/if_are.c head/sys/mips/atheros/ar531x/if_arereg.h Modified: head/sys/mips/atheros/ar531x/files.ar5315 ============================================================================== --- head/sys/mips/atheros/ar531x/files.ar5315 Fri Nov 18 09:03:31 2016 (r308802) +++ head/sys/mips/atheros/ar531x/files.ar5315 Fri Nov 18 14:06:29 2016 (r308803) @@ -14,17 +14,18 @@ mips/atheros/ar531x/uart_cpu_ar5315.c o mips/atheros/ar531x/ar5312_chip.c standard mips/atheros/ar71xx_bus_space_reversed.c standard -#mips/mips/intr_machdep.c standard mips/mips/tick.c standard dev/etherswitch/e6000sw/e6060sw.c optional etherswitch -dev/etherswitch/realtek/rtl830x.c optional etherswitch # Hack to reuse ARM intrng code -kern/subr_intr.c standard -kern/msi_if.m standard -kern/pic_if.m standard +kern/subr_intr.c optional intrng +kern/msi_if.m optional intrng +kern/pic_if.m optional intrng # Intrng compatible MIPS32 interrupt controller -mips/mips/mips_pic.c standard +mips/mips/mips_pic.c optional intrng + +# Non Intrng +mips/mips/intr_machdep.c optional !intrng Modified: head/sys/mips/atheros/ar531x/if_are.c ============================================================================== --- head/sys/mips/atheros/ar531x/if_are.c Fri Nov 18 09:03:31 2016 (r308802) +++ head/sys/mips/atheros/ar531x/if_are.c Fri Nov 18 14:06:29 2016 (r308803) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); /* - * AR231x Ethernet interface driver + * AR531x Ethernet interface driver * copy from mips/idt/if_kr.c and netbsd code */ #include @@ -90,8 +90,6 @@ MODULE_DEPEND(are, miibus, 1, 1, 1); #include #include -//#define ARE_DEBUG - #ifdef ARE_DEBUG void dump_txdesc(struct are_softc *, int); void dump_status_reg(struct are_softc *); @@ -226,7 +224,7 @@ are_attach(device_t dev) unit = device_get_unit(dev); sc->are_dev = dev; - // hardcode macaddress + /* hardcode macaddress */ sc->are_eaddr[0] = 0x00; sc->are_eaddr[1] = 0x0C; sc->are_eaddr[2] = 0x42; @@ -234,7 +232,7 @@ are_attach(device_t dev) sc->are_eaddr[4] = 0x5E; sc->are_eaddr[5] = 0x6B; - // try to get from hints + /* try to get from hints */ if (!resource_string_value(device_get_name(dev), device_get_unit(dev), "macaddr", (const char **)&local_macstr)) { uint32_t tmpmac[ETHER_ADDR_LEN]; @@ -302,12 +300,16 @@ are_attach(device_t dev) ifp->if_ioctl = are_ioctl; ifp->if_start = are_start; ifp->if_init = are_init; + sc->are_if_flags = ifp->if_flags; /* XXX: add real size */ IFQ_SET_MAXLEN(&ifp->if_snd, 9); ifp->if_snd.ifq_maxlen = 9; IFQ_SET_READY(&ifp->if_snd); + /* Tell the upper layer(s) we support long frames. */ + ifp->if_capabilities |= IFCAP_VLAN_MTU; + ifp->if_capenable = ifp->if_capabilities; if (are_dma_alloc(sc) != 0) { @@ -315,14 +317,6 @@ are_attach(device_t dev) goto fail; } - /* TODO: calculate prescale */ -/* - CSR_WRITE_4(sc, ARE_ETHMCP, (165000000 / (1250000 + 1)) & ~1); - - CSR_WRITE_4(sc, ARE_MIIMCFG, ARE_MIIMCFG_R); - DELAY(1000); - CSR_WRITE_4(sc, ARE_MIIMCFG, 0); -*/ CSR_WRITE_4(sc, CSR_BUSMODE, BUSMODE_SWR); DELAY(1000); @@ -350,11 +344,11 @@ are_attach(device_t dev) #ifdef INTRNG char *name; - if(ar531x_soc >= AR531X_SOC_AR5315) { + if (ar531x_soc >= AR531X_SOC_AR5315) { enetirq = AR5315_CPU_IRQ_ENET; name = "enet"; } else { - if(device_get_unit(dev) == 0) { + if (device_get_unit(dev) == 0) { enetirq = AR5312_IRQ_ENET0; name = "enet0"; } else { @@ -465,7 +459,6 @@ are_miibus_readreg(device_t dev, int phy addr = (phy << MIIADDR_PHY_SHIFT) | (reg << MIIADDR_REG_SHIFT); CSR_WRITE_4(sc, CSR_MIIADDR, addr); -// AE_BARRIER(sc); for (i = 0; i < 100000000; i++) { if ((CSR_READ_4(sc, CSR_MIIADDR) & MIIADDR_BUSY) == 0) break; @@ -488,7 +481,6 @@ are_miibus_writereg(device_t dev, int ph addr = (phy << MIIADDR_PHY_SHIFT) | (reg << MIIADDR_REG_SHIFT) | MIIADDR_WRITE; CSR_WRITE_4(sc, CSR_MIIADDR, addr); -// AE_BARRIER(sc); for (i = 0; i < 100000000; i++) { if ((CSR_READ_4(sc, CSR_MIIADDR) & MIIADDR_BUSY) == 0) @@ -610,7 +602,6 @@ are_init_locked(struct are_softc *sc) */ CSR_WRITE_4(sc, CSR_BUSMODE, /* XXX: not sure if this is a good thing or not... */ - //BUSMODE_ALIGN_16B | BUSMODE_BAR | BUSMODE_BLE | BUSMODE_PBL_4LW); /* @@ -648,15 +639,16 @@ are_init_locked(struct are_softc *sc) /* * Start the mac. */ - CSR_WRITE_4(sc, CSR_MACCTL, CSR_READ_4(sc, CSR_MACCTL) | - (MACCTL_RE | MACCTL_TE)); + CSR_WRITE_4(sc, CSR_FLOWC, FLOWC_FCE); + CSR_WRITE_4(sc, CSR_MACCTL, MACCTL_RE | MACCTL_TE | + MACCTL_PM | MACCTL_FDX | MACCTL_HBD | MACCTL_RA); /* * Write out the opmode. */ - CSR_WRITE_4(sc, CSR_OPMODE, OPMODE_SR | OPMODE_ST | -// ae_txthresh[sc->sc_txthresh].txth_opmode); + CSR_WRITE_4(sc, CSR_OPMODE, OPMODE_SR | OPMODE_ST | OPMODE_SF | OPMODE_TR_64); + /* * Start the receive process. */ @@ -741,7 +733,6 @@ are_encap(struct are_softc *sc, struct m if (i == 0) desc->are_devcs |= ADCTL_Tx_FS; desc->are_addr = txsegs[i].ds_addr; -// desc->are_link = 0; /* link with previous descriptor */ if (prev_desc) prev_desc->are_link = ARE_TX_RING_ADDR(sc, prod); @@ -850,6 +841,36 @@ are_stop(struct are_softc *sc) } +static int +are_set_filter(struct are_softc *sc) +{ + struct ifnet *ifp; + int mchash[2]; + int macctl; + + ifp = sc->are_ifp; + + macctl = CSR_READ_4(sc, CSR_MACCTL); + macctl &= ~(MACCTL_PR | MACCTL_PM); + macctl |= MACCTL_HBD; + + if (ifp->if_flags & IFF_PROMISC) + macctl |= MACCTL_PR; + + /* Todo: hash table set. + * But I don't know how to use multicast hash table at this soc. + */ + + /* this is allmulti */ + mchash[0] = mchash[1] = 0xffffffff; + macctl |= MACCTL_PM; + + CSR_WRITE_4(sc, CSR_HTLO, mchash[0]); + CSR_WRITE_4(sc, CSR_HTHI, mchash[1]); + CSR_WRITE_4(sc, CSR_MACCTL, macctl); + + return 0; +} static int are_ioctl(struct ifnet *ifp, u_long command, caddr_t data) @@ -863,7 +884,6 @@ are_ioctl(struct ifnet *ifp, u_long comm switch (command) { case SIOCSIFFLAGS: -#if 0 ARE_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { @@ -880,16 +900,13 @@ are_ioctl(struct ifnet *ifp, u_long comm } sc->are_if_flags = ifp->if_flags; ARE_UNLOCK(sc); -#endif error = 0; break; case SIOCADDMULTI: case SIOCDELMULTI: -#if 0 ARE_LOCK(sc); are_set_filter(sc); ARE_UNLOCK(sc); -#endif error = 0; break; case SIOCGIFMEDIA: @@ -903,28 +920,6 @@ are_ioctl(struct ifnet *ifp, u_long comm break; case SIOCSIFCAP: error = 0; -#if 0 - mask = ifr->ifr_reqcap ^ ifp->if_capenable; - if ((mask & IFCAP_HWCSUM) != 0) { - ifp->if_capenable ^= IFCAP_HWCSUM; - if ((IFCAP_HWCSUM & ifp->if_capenable) && - (IFCAP_HWCSUM & ifp->if_capabilities)) - ifp->if_hwassist = ARE_CSUM_FEATURES; - else - ifp->if_hwassist = 0; - } - if ((mask & IFCAP_VLAN_HWTAGGING) != 0) { - ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; - if (IFCAP_VLAN_HWTAGGING & ifp->if_capenable && - IFCAP_VLAN_HWTAGGING & ifp->if_capabilities && - ifp->if_drv_flags & IFF_DRV_RUNNING) { - ARE_LOCK(sc); - are_vlan_setup(sc); - ARE_UNLOCK(sc); - } - } - VLAN_CAPABILITIES(ifp); -#endif break; default: error = ether_ioctl(ifp, command, data); @@ -1343,7 +1338,7 @@ are_newbuf(struct are_softc *sc, int idx return (ENOBUFS); m->m_len = m->m_pkthdr.len = MCLBYTES; - // tcp header boundary margin + /* tcp header boundary margin */ m_adj(m, 4); if (bus_dmamap_load_mbuf_sg(sc->are_cdata.are_rx_tag, @@ -1355,9 +1350,11 @@ are_newbuf(struct are_softc *sc, int idx rxd = &sc->are_cdata.are_rxdesc[idx]; if (rxd->rx_m != NULL) { -// This code make bug. Make scranble on buffer data. -// bus_dmamap_sync(sc->are_cdata.are_rx_tag, rxd->rx_dmamap, -// BUS_DMASYNC_POSTREAD); + /* + * THis is if_kr.c original code but make bug. Make scranble on buffer data. + * bus_dmamap_sync(sc->are_cdata.are_rx_tag, rxd->rx_dmamap, + * BUS_DMASYNC_POSTREAD); + */ bus_dmamap_unload(sc->are_cdata.are_rx_tag, rxd->rx_dmamap); } map = rxd->rx_dmamap; @@ -1551,7 +1548,6 @@ are_intr(void *arg) struct are_softc *sc = arg; uint32_t status; struct ifnet *ifp = sc->are_ifp; -//kdb_break(); ARE_LOCK(sc); Modified: head/sys/mips/atheros/ar531x/if_arereg.h ============================================================================== --- head/sys/mips/atheros/ar531x/if_arereg.h Fri Nov 18 09:03:31 2016 (r308802) +++ head/sys/mips/atheros/ar531x/if_arereg.h Fri Nov 18 14:06:29 2016 (r308803) @@ -37,17 +37,17 @@ struct are_desc { uint32_t are_link; }; -#define ARE_DMASIZE(len) ((len) & ((1 << 11)-1)) -#define ARE_PKTSIZE(len) ((len & 0xffff0000) >> 16) +#define ARE_DMASIZE(len) ((len) & ((1 << 11)-1)) +#define ARE_PKTSIZE(len) ((len & 0xffff0000) >> 16) -#define ARE_RX_RING_CNT 128 -#define ARE_TX_RING_CNT 128 -#define ARE_TX_RING_SIZE sizeof(struct are_desc) * ARE_TX_RING_CNT -#define ARE_RX_RING_SIZE sizeof(struct are_desc) * ARE_RX_RING_CNT -#define ARE_RING_ALIGN sizeof(struct are_desc) -#define ARE_RX_ALIGN sizeof(uint32_t) -#define ARE_MAXFRAGS 8 -#define ARE_TX_INTR_THRESH 8 +#define ARE_RX_RING_CNT 128 +#define ARE_TX_RING_CNT 128 +#define ARE_TX_RING_SIZE sizeof(struct are_desc) * ARE_TX_RING_CNT +#define ARE_RX_RING_SIZE sizeof(struct are_desc) * ARE_RX_RING_CNT +#define ARE_RING_ALIGN sizeof(struct are_desc) +#define ARE_RX_ALIGN sizeof(uint32_t) +#define ARE_MAXFRAGS 8 +#define ARE_TX_INTR_THRESH 8 #define ARE_TX_RING_ADDR(sc, i) \ ((sc)->are_rdata.are_tx_ring_paddr + sizeof(struct are_desc) * (i)) @@ -123,6 +123,7 @@ struct are_softc { struct are_ring_data are_rdata; int are_link_status; int are_detach; + int are_if_flags; /* last if flags */ }; #define ARE_LOCK(_sc) mtx_lock(&(_sc)->are_mtx) @@ -132,11 +133,11 @@ struct are_softc { /* * register space access macros */ -#define CSR_WRITE_4(sc, reg, val) \ - bus_space_write_4(sc->are_btag, sc->are_bhandle, reg, val) +#define CSR_WRITE_4(sc, reg, val) \ + bus_space_write_4(sc->are_btag, sc->are_bhandle, reg, val) -#define CSR_READ_4(sc, reg) \ - bus_space_read_4(sc->are_btag, sc->are_bhandle, reg) +#define CSR_READ_4(sc, reg) \ + bus_space_read_4(sc->are_btag, sc->are_bhandle, reg) /* $NetBSD: aereg.h,v 1.2 2008/04/28 20:23:28 martin Exp $ */ From owner-svn-src-head@freebsd.org Fri Nov 18 14:07:08 2016 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 AF2B5C4847F; Fri, 18 Nov 2016 14:07:08 +0000 (UTC) (envelope-from cochard@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 57672F93; Fri, 18 Nov 2016 14:07:08 +0000 (UTC) (envelope-from cochard@gmail.com) Received: by mail-wm0-x22a.google.com with SMTP id a197so40557033wmd.0; Fri, 18 Nov 2016 06:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=c6jxxQsfC4JnyP5EQNUXbLL5NBsVPL5zYsvmbOk/rq4=; b=OA8oEVsZuZkGDKFnpIp7xsDOBFA2ZNCxN2DGYINXCWVmu8qP9rZzCBAdjN9T22ElyU kj+L5Z8Gs66IGAGaUa2hvYnmHVOxs6hNoBgQrg8aZwxXXzUyqo2v+epS5qQoyLE+yBHj Fwh4bYjSuEjDkXH3J6XMWnperDoqQplI963jBYbkjSk1krInzxvvqgqmEx0ZneA3kmn5 yPE7iiWK4lWWLFPrZj83kmMJBQa3OmOrHVF1neCYP5zm9nbfGFHJAwkJwmeLwNyvH7mH WAGR629pMLMTe0QzuYSd8Z6XnvR0c2lovX02z8B98e2kgEfy9QllIL+6//8dYU7Tl1Eh zOIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=c6jxxQsfC4JnyP5EQNUXbLL5NBsVPL5zYsvmbOk/rq4=; b=dHoMNBK1m6ikDn5+R9VQvPfH6BUPI/2LINqgrzZ25cxmRYclBBVDCqId3G2aYIGtPJ lAN0wjreUwANQ8Rw6EQMjTiX4K4lWQwoA27S1/zsrATuT6qUTDW6L+lZLzsh7K693YPR jNHOYkKopHBgKiup5xUT2+BP3vo3L95stllLzAYrd4ei41fLYd7j34wX5gqELFeQdtqo esP+ItOf9cyBbg1F9eaqHem9YDvoVjoGP3UseNeRc9kwD74DAfn4Ywps5V958k35dyhL /97HndDflXzSXiNGTGmZGKYE7jDm6dywhDjooAyXQTEqcYW5CCMJeqDAp8KFSCFKjwag VVOA== X-Gm-Message-State: ABUngvcV6QuM2A1jvxa+FJDnS7rN+xqrf8SJMagpLgRmWvresnkiaFPVT6b0bnB0WrFGSvCwC11ZYlopIjWn/w== X-Received: by 10.28.133.144 with SMTP id h138mr24617655wmd.12.1479478026742; Fri, 18 Nov 2016 06:07:06 -0800 (PST) MIME-Version: 1.0 Sender: cochard@gmail.com Received: by 10.194.28.7 with HTTP; Fri, 18 Nov 2016 06:06:46 -0800 (PST) In-Reply-To: <201608012148.u71LmbaA003739@repo.freebsd.org> References: <201608012148.u71LmbaA003739@repo.freebsd.org> From: =?UTF-8?Q?Olivier_Cochard=2DLabb=C3=A9?= Date: Fri, 18 Nov 2016 15:06:46 +0100 X-Google-Sender-Auth: sSHf6obH7bhKXaUFGZvhy8bblYY Message-ID: Subject: Re: svn commit: r303643 - in head/sys: kern sys To: Mateusz Guzik Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Fri, 18 Nov 2016 14:07:08 -0000 On Mon, Aug 1, 2016 at 11:48 PM, Mateusz Guzik wrote: > Author: mjg > Date: Mon Aug 1 21:48:37 2016 > New Revision: 303643 > URL: https://svnweb.freebsd.org/changeset/base/303643 > > Log: > Implement trivial backoff for locking primitives. > > > =E2=80=8BI was checking FreeBSD's forwarding speed evolution of year 2016= =E2=80=8B, when I found a unexpected improvement: http://dev.bsdrp.net/benchs/2016.jan-nov.SM5018A-FTN4-Chelsio.png Something append between r303601 (July 31th) and r303818 (August 6th). ae@ advices me to bench this specific commit: http://dev.bsdrp.net/benchs/r303643.png Thanks ! Olivier From owner-svn-src-head@freebsd.org Fri Nov 18 16:07:10 2016 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 B7CD5C48D30; Fri, 18 Nov 2016 16:07:10 +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 6F80F394; Fri, 18 Nov 2016 16:07:10 +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 uAIG79wC065267; Fri, 18 Nov 2016 16:07:09 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAIG791W065262; Fri, 18 Nov 2016 16:07:09 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201611181607.uAIG791W065262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 18 Nov 2016 16:07:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308806 - in head: lib/libutil usr.sbin/pw X-SVN-Group: head 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, 18 Nov 2016 16:07:10 -0000 Author: asomers Date: Fri Nov 18 16:07:08 2016 New Revision: 308806 URL: https://svnweb.freebsd.org/changeset/base/308806 Log: Speed up pw operations that edit /etc/group or /etc/passwd r285050 fixed a bug in pw that could lead to /etc/passwd or /etc/group corruption on power loss. However, it fixed it by opening those files with O_SYNC, which is very slow, especially on ZFS. This change replaces O_SYNC with appropriately placed fsync()s instead, which is much faster. Using a ZFS tmpdir, the time to run pw's kyua tests drops from 245s to 35s. Reviewed by: allanjude, bapt, vangyzen, garga Tested on pfSense by: garga MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8319 Modified: head/lib/libutil/gr_util.c head/lib/libutil/pw_util.c head/usr.sbin/pw/grupd.c head/usr.sbin/pw/pw_nis.c head/usr.sbin/pw/pwupd.c Modified: head/lib/libutil/gr_util.c ============================================================================== --- head/lib/libutil/gr_util.c Fri Nov 18 16:05:32 2016 (r308805) +++ head/lib/libutil/gr_util.c Fri Nov 18 16:07:08 2016 (r308806) @@ -141,7 +141,7 @@ gr_tmp(int mfd) errno = ENAMETOOLONG; return (-1); } - if ((tfd = mkostemp(tempname, O_SYNC)) == -1) + if ((tfd = mkostemp(tempname, 0)) == -1) return (-1); if (mfd != -1) { while ((nr = read(mfd, buf, sizeof(buf))) > 0) Modified: head/lib/libutil/pw_util.c ============================================================================== --- head/lib/libutil/pw_util.c Fri Nov 18 16:05:32 2016 (r308805) +++ head/lib/libutil/pw_util.c Fri Nov 18 16:07:08 2016 (r308806) @@ -225,7 +225,7 @@ pw_tmp(int mfd) errno = ENAMETOOLONG; return (-1); } - if ((tfd = mkostemp(tempname, O_SYNC)) == -1) + if ((tfd = mkostemp(tempname, 0)) == -1) return (-1); if (mfd != -1) { while ((nr = read(mfd, buf, sizeof(buf))) > 0) Modified: head/usr.sbin/pw/grupd.c ============================================================================== --- head/usr.sbin/pw/grupd.c Fri Nov 18 16:05:32 2016 (r308805) +++ head/usr.sbin/pw/grupd.c Fri Nov 18 16:07:08 2016 (r308806) @@ -77,6 +77,7 @@ gr_update(struct group * grp, char const close(tfd); err(1, "gr_copy()"); } + fsync(tfd); close(tfd); if (gr_mkdb() == -1) { gr_fini(); Modified: head/usr.sbin/pw/pw_nis.c ============================================================================== --- head/usr.sbin/pw/pw_nis.c Fri Nov 18 16:05:32 2016 (r308805) +++ head/usr.sbin/pw/pw_nis.c Fri Nov 18 16:07:08 2016 (r308806) @@ -67,6 +67,7 @@ pw_nisupdate(const char * path, struct p close(tfd); err(1, "pw_copy()"); } + fsync(tfd); close(tfd); if (chmod(pw_tempname(), 0644) == -1) err(1, "chmod()"); Modified: head/usr.sbin/pw/pwupd.c ============================================================================== --- head/usr.sbin/pw/pwupd.c Fri Nov 18 16:05:32 2016 (r308805) +++ head/usr.sbin/pw/pwupd.c Fri Nov 18 16:07:08 2016 (r308806) @@ -114,6 +114,7 @@ pw_update(struct passwd * pwd, char cons close(tfd); err(1, "pw_copy()"); } + fsync(tfd); close(tfd); /* * in case of deletion of a user, the whole database From owner-svn-src-head@freebsd.org Fri Nov 18 16:09:45 2016 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 BF59CC48DC6; Fri, 18 Nov 2016 16:09:45 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82F5C7FC; Fri, 18 Nov 2016 16:09:45 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1c7ljN-0006Lh-5o; Fri, 18 Nov 2016 19:09:37 +0300 Date: Fri, 18 Nov 2016 19:09:37 +0300 From: Slawa Olhovchenkov To: Navdeep Parhar Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305852 - in head/sys: dev/cxgbe dev/cxgbe/firmware modules/cxgbe modules/cxgbe/if_cc modules/cxgbe/if_ccv Message-ID: <20161118160937.GL57876@zxy.spb.ru> References: <201609160008.u8G08bWr033156@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201609160008.u8G08bWr033156@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-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, 18 Nov 2016 16:09:45 -0000 On Fri, Sep 16, 2016 at 12:08:37AM +0000, Navdeep Parhar wrote: > Author: np > Date: Fri Sep 16 00:08:37 2016 > New Revision: 305852 > URL: https://svnweb.freebsd.org/changeset/base/305852 > > Log: > cxgbe(4): Attach to cards with the Terminator 6 ASIC. T6 cards will > come up as 't6nex' nexus devices with 'cc' ports hanging off them. > > The T6 firmware and configuration files will be added as soon as they > are released. For now the driver will try to work with whatever > firmware and configuration is on the card's flash. > > Sponsored by: Chelsio Communications No MFC planed? From owner-svn-src-head@freebsd.org Fri Nov 18 16:15:20 2016 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 C8906C471A6; Fri, 18 Nov 2016 16:15:20 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x244.google.com (mail-it0-x244.google.com [IPv6:2607:f8b0:4001:c0b::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8ED9DDC5; Fri, 18 Nov 2016 16:15:20 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x244.google.com with SMTP id b123so5218504itb.2; Fri, 18 Nov 2016 08:15:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=lLgoJvmhlULd7DK0JZOM7xgeFpwy9FgPxU6K+wtrl9k=; b=scZNgNQdEMGPxBchKpfdRzmemlCe5gA+l+1+1XkSM0lZtZxV0+G60tp/1CojFdRrSi eQsC84gmtDnDPLIGQLz4I80UyvR0Xp+51Jsoukjkv17TF24NYiLM7qSEeNwRp3Ej9bGF yBBQU7Vs0uJ/R1Zf8Jx9O7l+q+0z36bJGl1ypfW19T1dsvZ09D5Q1UOmiurpfCi8o8ZL CA8f4AiG1MJbiUINom97il2l/gQYlBepRc1FJ1cfF0A7QalWEGsNsc0hl4KdUDKlzg8C CrjR+CHwTDnwTGixmcTg3z2Alp2iCplCVA/FP5vyHOZE+EU4B3a+zR4NBN96id5zs3AO XHlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=lLgoJvmhlULd7DK0JZOM7xgeFpwy9FgPxU6K+wtrl9k=; b=ZiyBzTOO3JG6/g+Gv22Q1w59JLZOqnhyAw+KgOKMZopLbq2OU/t9MzFshET9Z/2GPh hWTcflR7EzIr9LTv87OMDqaxcwyTuTrn+z5nss23++6z58I6OjYHJtWlx96SMChWcWQf 7oOVSaM0nXcu6mucDUPYd4nC/xc4X5eHLhSDFv0SA4t0hCjWi1z/IHTsCjaANfRjK5JS Thszj4GYnxmAOJjheyoPkZZLUiuIcOorQnD0WZoPsZWinrazIEWhZJrifHV0TC7vcKUm C24VLhsVVo77F/arTrmWuB6g7iUUktvOqVdiDBmfx+xAHuSrXTc0WUu99tGX0MTHAXgT o9sQ== X-Gm-Message-State: AKaTC01Rsrzwf0FcD1UZSOTt12/xtFbrshOfoHqfNFLHph9iacZv9Yvcm0kuDAyWkPqGNB83vpSBMfPA4mAAKQ== X-Received: by 10.36.233.69 with SMTP id f66mr436389ith.83.1479485719849; Fri, 18 Nov 2016 08:15:19 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.27.212 with HTTP; Fri, 18 Nov 2016 08:14:59 -0800 (PST) In-Reply-To: <201611160524.uAG5OhHj061990@repo.freebsd.org> References: <201611160524.uAG5OhHj061990@repo.freebsd.org> From: Ed Maste Date: Fri, 18 Nov 2016 11:14:59 -0500 X-Google-Sender-Auth: _ZpCuvtPi1QbI3-YEUEH-8cFotg Message-ID: Subject: Re: svn commit: r308718 - in head/sys: contrib/ncsw/inc contrib/ncsw/user/env dev/dpaa powerpc/booke powerpc/include powerpc/mpc85xx To: Justin Hibbits 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: Fri, 18 Nov 2016 16:15:20 -0000 On 16 November 2016 at 00:24, Justin Hibbits wrote: > Author: jhibbits > Date: Wed Nov 16 05:24:42 2016 > New Revision: 308718 > URL: https://svnweb.freebsd.org/changeset/base/308718 My tinderbox build is now failing in libc with: In file included from /scratch/tmp/emaste/obj/powerpc.powerpc/scratch/tmp/emaste/freebsd/tmp/usr/include/vm/pmap.h:90, from /scratch/tmp/emaste/freebsd/lib/libc/gen/setproctitle.c:28: /scratch/tmp/emaste/obj/powerpc.powerpc/scratch/tmp/emaste/freebsd/tmp/usr/include/machine/pmap.h:207: error: expected specifier-qualifier-list before 'bool' *** [setproctitle.pico] Error code 1 From owner-svn-src-head@freebsd.org Fri Nov 18 16:23:33 2016 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 5829AC4750C; Fri, 18 Nov 2016 16:23:33 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FEBD1317; Fri, 18 Nov 2016 16:23:32 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAIGNWfJ072833; Fri, 18 Nov 2016 16:23:32 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAIGNWfV072831; Fri, 18 Nov 2016 16:23:32 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201611181623.uAIGNWfV072831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Fri, 18 Nov 2016 16:23:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308807 - in head/sys: conf mips/include X-SVN-Group: head 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, 18 Nov 2016 16:23:33 -0000 Author: kan Date: Fri Nov 18 16:23:31 2016 New Revision: 308807 URL: https://svnweb.freebsd.org/changeset/base/308807 Log: Subject: [PATCH] Pass MACHINE_ARCH on command line for MIPS kernels. While there, make param.h guess proper MACHINE_ARCH on hardfloat targets correctly as well, so tools like bmake can get their defaults right. This does not help the kernel case, since we compile them with forced -msoft-float and need to override an incorrect guess by param.h. Reviewed by: br Differential Revision: https://reviews.freebsd.org/D8574 Modified: head/sys/conf/kern.pre.mk head/sys/mips/include/param.h Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Fri Nov 18 16:07:08 2016 (r308806) +++ head/sys/conf/kern.pre.mk Fri Nov 18 16:23:31 2016 (r308807) @@ -74,7 +74,7 @@ CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KE CFLAGS_PARAM_INLINE_UNIT_GROWTH?=100 CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000 .if ${MACHINE_CPUARCH} == "mips" -CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 +CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 -DMACHINE_ARCH='"${MACHINE_ARCH}"' .endif CFLAGS.gcc+= -fno-common -fms-extensions -finline-limit=${INLINE_LIMIT} CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH} Modified: head/sys/mips/include/param.h ============================================================================== --- head/sys/mips/include/param.h Fri Nov 18 16:07:08 2016 (r308806) +++ head/sys/mips/include/param.h Fri Nov 18 16:23:31 2016 (r308807) @@ -53,33 +53,36 @@ #define __PCI_REROUTE_INTERRUPT -#ifndef MACHINE -#define MACHINE "mips" -#endif -#ifndef MACHINE_ARCH #if _BYTE_ORDER == _BIG_ENDIAN -#ifdef __mips_n64 -#define MACHINE_ARCH "mips64" -#ifndef MACHINE_ARCH32 -#define MACHINE_ARCH32 "mips" +# define _EL_SUFFIX "" +#else +# define _EL_SUFFIX "el" #endif + +#ifdef __mips_n64 +# define _N64_SUFFIX "64" #elif defined(__mips_n32) -#define MACHINE_ARCH "mipsn32" +# define _N64_SUFFIX "n32" #else -#define MACHINE_ARCH "mips" +# define _N64_SUFFIX "" #endif + +#ifdef __mips_hard_float +# define _HF_SUFFIX "hf" #else -#ifdef __mips_n64 -#define MACHINE_ARCH "mips64el" -#ifndef MACHINE_ARCH32 -#define MACHINE_ARCH32 "mipsel" +# define _HF_SUFFIX "" #endif -#elif defined(__mips_n32) -#define MACHINE_ARCH "mipsn32el" -#else -#define MACHINE_ARCH "mipsel" + +#ifndef MACHINE +# define MACHINE "mips" #endif +#ifndef MACHINE_ARCH +# define MACHINE_ARCH "mips" _N64_SUFFIX _EL_SUFFIX _HF_SUFFIX #endif +#ifdef __mips_n64 +# ifndef MACHINE_ARCH32 +# define MACHINE_ARCH32 "mips" _EL_SUFFIX _HF_SUFFIX +# endif #endif /* From owner-svn-src-head@freebsd.org Fri Nov 18 16:48:38 2016 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 3AE88C48069; Fri, 18 Nov 2016 16:48:38 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D18C35D; Fri, 18 Nov 2016 16:48:37 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAIGmbJV080947; Fri, 18 Nov 2016 16:48:37 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAIGmb3X080946; Fri, 18 Nov 2016 16:48:37 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201611181648.uAIGmb3X080946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Fri, 18 Nov 2016 16:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308808 - head/usr.bin/locale X-SVN-Group: head 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, 18 Nov 2016 16:48:38 -0000 Author: ume Date: Fri Nov 18 16:48:37 2016 New Revision: 308808 URL: https://svnweb.freebsd.org/changeset/base/308808 Log: Lookup locale when print all keywords as well. Reported by: dumbbell Reviewed by: dumbbell MFC after: 1 week Modified: head/usr.bin/locale/locale.c Modified: head/usr.bin/locale/locale.c ============================================================================== --- head/usr.bin/locale/locale.c Fri Nov 18 16:23:31 2016 (r308807) +++ head/usr.bin/locale/locale.c Fri Nov 18 16:48:37 2016 (r308808) @@ -283,8 +283,9 @@ main(int argc, char *argv[]) /* process '-c', '-k', or command line arguments. */ if (prt_categories || prt_keywords || argc > 0) { - if (argc > 0) { + if (prt_keywords) setlocale(LC_ALL, ""); + if (argc > 0) { while (argc > 0) { showdetails(*argv); argv++; From owner-svn-src-head@freebsd.org Fri Nov 18 17:18:06 2016 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 E8F9EC48C20; Fri, 18 Nov 2016 17:18:06 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B74EC1A78; Fri, 18 Nov 2016 17:18:06 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAIHI5tC092943; Fri, 18 Nov 2016 17:18:05 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAIHI5be092942; Fri, 18 Nov 2016 17:18:05 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201611181718.uAIHI5be092942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Fri, 18 Nov 2016 17:18:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308809 - head/usr.bin/locale X-SVN-Group: head 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, 18 Nov 2016 17:18:07 -0000 Author: ume Date: Fri Nov 18 17:18:05 2016 New Revision: 308809 URL: https://svnweb.freebsd.org/changeset/base/308809 Log: We need to lookup locale when command line arguments are specified, as well. MFC after: 1 week Modified: head/usr.bin/locale/locale.c Modified: head/usr.bin/locale/locale.c ============================================================================== --- head/usr.bin/locale/locale.c Fri Nov 18 16:48:37 2016 (r308808) +++ head/usr.bin/locale/locale.c Fri Nov 18 17:18:05 2016 (r308809) @@ -283,7 +283,7 @@ main(int argc, char *argv[]) /* process '-c', '-k', or command line arguments. */ if (prt_categories || prt_keywords || argc > 0) { - if (prt_keywords) + if (prt_keywords || argc > 0) setlocale(LC_ALL, ""); if (argc > 0) { while (argc > 0) { From owner-svn-src-head@freebsd.org Fri Nov 18 18:18:38 2016 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 0F575C48A18; Fri, 18 Nov 2016 18:18:38 +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 E3E9F18A4; Fri, 18 Nov 2016 18:18:37 +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 E258F10A758; Fri, 18 Nov 2016 13:18:36 -0500 (EST) From: John Baldwin To: Dexuan Cui Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308798 - head/share/man/man4 Date: Fri, 18 Nov 2016 08:44:06 -0800 Message-ID: <4062212.DYY6ahumff@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201611180736.uAI7a0GI063125@repo.freebsd.org> References: <201611180736.uAI7a0GI063125@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); Fri, 18 Nov 2016 13:18:37 -0500 (EST) 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, 18 Nov 2016 18:18:38 -0000 On Friday, November 18, 2016 07:36:00 AM Dexuan Cui wrote: > Author: dexuan > Date: Fri Nov 18 07:36:00 2016 > New Revision: 308798 > URL: https://svnweb.freebsd.org/changeset/base/308798 > > Log: > remove the hv_ata_pci_disengage(4) manual > > A few months ago, we removed the driver, which was not necessary any longer. > > Reviewed by: sephe > Approved by: sephe (mentor) > MFC after: 1 week > Sponsored by: Microsoft You will also want to add an entry in head/ObsoleteFiles.inc so that the installed manpage on existing systems gets deleted via 'make delete-old'. -- John Baldwin From owner-svn-src-head@freebsd.org Fri Nov 18 21:09:58 2016 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 DED6CC48B74; Fri, 18 Nov 2016 21:09:58 +0000 (UTC) (envelope-from robak@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A39DF86F; Fri, 18 Nov 2016 21:09:58 +0000 (UTC) (envelope-from robak@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAIL9v89084532; Fri, 18 Nov 2016 21:09:57 GMT (envelope-from robak@FreeBSD.org) Received: (from robak@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAIL9vBY084531; Fri, 18 Nov 2016 21:09:57 GMT (envelope-from robak@FreeBSD.org) Message-Id: <201611182109.uAIL9vBY084531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: robak set sender to robak@FreeBSD.org using -f From: Bartek Rutkowski Date: Fri, 18 Nov 2016 21:09:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308810 - head/bin/dd X-SVN-Group: head 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, 18 Nov 2016 21:09:59 -0000 Author: robak (ports committer) Date: Fri Nov 18 21:09:57 2016 New Revision: 308810 URL: https://svnweb.freebsd.org/changeset/base/308810 Log: Capsicum support for dd(1) Adds Capsicum sandboxing to dd utility. Submitted by: Pawel Biernacki Reviewed by: allanjude, emaste, oshogbo Approved by: oshogbo Sponsored by: Mysterious Code Ltd. Differential Revision: https://reviews.freebsd.org/D8543 Modified: head/bin/dd/dd.c Modified: head/bin/dd/dd.c ============================================================================== --- head/bin/dd/dd.c Fri Nov 18 17:18:05 2016 (r308809) +++ head/bin/dd/dd.c Fri Nov 18 21:09:57 2016 (r308810) @@ -48,10 +48,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include +#include #include #include #include @@ -92,6 +95,10 @@ main(int argc __unused, char *argv[]) jcl(argv); setup(); + caph_cache_catpages(); + if (cap_enter() == -1 && errno != ENOSYS) + err(1, "unable to enter capability mode"); + (void)signal(SIGINFO, siginfo_handler); (void)signal(SIGINT, terminate); @@ -125,6 +132,8 @@ static void setup(void) { u_int cnt; + cap_rights_t rights; + unsigned long cmds[] = { FIODTYPE, MTIOCTOP }; if (in.name == NULL) { in.name = "stdin"; @@ -133,13 +142,20 @@ setup(void) in.fd = open(in.name, O_RDONLY, 0); if (in.fd == -1) err(1, "%s", in.name); + if (caph_limit_stdin() == -1) + err(1, "unable to limit capability rights"); } getfdtype(&in); + cap_rights_init(&rights, CAP_READ, CAP_SEEK); + if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS) + err(1, "unable to limit capability rights"); + if (files_cnt > 1 && !(in.flags & ISTAPE)) errx(1, "files is not supported for non-tape devices"); + cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL); if (out.name == NULL) { /* No way to check for read access here. */ out.fd = STDOUT_FILENO; @@ -156,13 +172,27 @@ setup(void) if (out.fd == -1) { out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE); out.flags |= NOREAD; + cap_rights_clear(&rights, CAP_READ); } if (out.fd == -1) err(1, "%s", out.name); + if (caph_limit_stdout() == -1) + err(1, "unable to limit capability rights"); } getfdtype(&out); + if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS) + err(1, "unable to limit capability rights"); + if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 && + errno != ENOSYS) + err(1, "unable to limit capability rights"); + + if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) { + if (caph_limit_stderr() == -1) + err(1, "unable to limit capability rights"); + } + /* * Allocate space for the input and output buffers. If not doing * record oriented I/O, only need a single buffer. From owner-svn-src-head@freebsd.org Fri Nov 18 21:12:14 2016 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 78DBAC48FC5; Fri, 18 Nov 2016 21:12:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E80BD20; Fri, 18 Nov 2016 21:12:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAILCDsE087592; Fri, 18 Nov 2016 21:12:13 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAILCDXv087590; Fri, 18 Nov 2016 21:12:13 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611182112.uAILCDXv087590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 18 Nov 2016 21:12:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308811 - head/sys/net80211 X-SVN-Group: head 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, 18 Nov 2016 21:12:14 -0000 Author: adrian Date: Fri Nov 18 21:12:13 2016 New Revision: 308811 URL: https://svnweb.freebsd.org/changeset/base/308811 Log: [net80211] shuffle IEEE80211_C and HTC bits over to _ieee80211.h so userland can use this. Reviewed by: avos Differential Revision: https://reviews.freebsd.org/D8553 Modified: head/sys/net80211/_ieee80211.h head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/_ieee80211.h ============================================================================== --- head/sys/net80211/_ieee80211.h Fri Nov 18 21:09:57 2016 (r308810) +++ head/sys/net80211/_ieee80211.h Fri Nov 18 21:12:13 2016 (r308811) @@ -402,4 +402,71 @@ struct ieee80211_mimo_info { uint8_t pad[2]; uint32_t evm[3]; /* EVM data */ }; + +/* + * ic_caps/iv_caps: device driver capabilities + */ +/* 0x2e available */ +#define IEEE80211_C_STA 0x00000001 /* CAPABILITY: STA available */ +#define IEEE80211_C_8023ENCAP 0x00000002 /* CAPABILITY: 802.3 encap */ +#define IEEE80211_C_FF 0x00000040 /* CAPABILITY: ATH FF avail */ +#define IEEE80211_C_TURBOP 0x00000080 /* CAPABILITY: ATH Turbo avail*/ +#define IEEE80211_C_IBSS 0x00000100 /* CAPABILITY: IBSS available */ +#define IEEE80211_C_PMGT 0x00000200 /* CAPABILITY: Power mgmt */ +#define IEEE80211_C_HOSTAP 0x00000400 /* CAPABILITY: HOSTAP avail */ +#define IEEE80211_C_AHDEMO 0x00000800 /* CAPABILITY: Old Adhoc Demo */ +#define IEEE80211_C_SWRETRY 0x00001000 /* CAPABILITY: sw tx retry */ +#define IEEE80211_C_TXPMGT 0x00002000 /* CAPABILITY: tx power mgmt */ +#define IEEE80211_C_SHSLOT 0x00004000 /* CAPABILITY: short slottime */ +#define IEEE80211_C_SHPREAMBLE 0x00008000 /* CAPABILITY: short preamble */ +#define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */ +#define IEEE80211_C_DFS 0x00020000 /* CAPABILITY: DFS/radar avail*/ +#define IEEE80211_C_MBSS 0x00040000 /* CAPABILITY: MBSS available */ +#define IEEE80211_C_SWSLEEP 0x00080000 /* CAPABILITY: do sleep here */ +#define IEEE80211_C_SWAMSDUTX 0x00100000 /* CAPABILITY: software A-MSDU TX */ +/* 0x7c0000 available */ +#define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */ +#define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */ +#define IEEE80211_C_WPA 0x01800000 /* CAPABILITY: WPA1+WPA2 avail*/ +#define IEEE80211_C_BURST 0x02000000 /* CAPABILITY: frame bursting */ +#define IEEE80211_C_WME 0x04000000 /* CAPABILITY: WME avail */ +#define IEEE80211_C_WDS 0x08000000 /* CAPABILITY: 4-addr support */ +/* 0x10000000 reserved */ +#define IEEE80211_C_BGSCAN 0x20000000 /* CAPABILITY: bg scanning */ +#define IEEE80211_C_TXFRAG 0x40000000 /* CAPABILITY: tx fragments */ +#define IEEE80211_C_TDMA 0x80000000 /* CAPABILITY: TDMA avail */ +/* XXX protection/barker? */ + +#define IEEE80211_C_OPMODE \ + (IEEE80211_C_STA | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | \ + IEEE80211_C_AHDEMO | IEEE80211_C_MONITOR | IEEE80211_C_WDS | \ + IEEE80211_C_TDMA | IEEE80211_C_MBSS) + +#define IEEE80211_C_BITS \ + "\20\1STA\002803ENCAP\7FF\10TURBOP\11IBSS\12PMGT" \ + "\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \ + "\21MONITOR\22DFS\23MBSS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \ + "\37TXFRAG\40TDMA" + +/* + * ic_htcaps/iv_htcaps: HT-specific device/driver capabilities + * + * NB: the low 16-bits are the 802.11 definitions, the upper + * 16-bits are used to define s/w/driver capabilities. + */ +#define IEEE80211_HTC_AMPDU 0x00010000 /* CAPABILITY: A-MPDU tx */ +#define IEEE80211_HTC_AMSDU 0x00020000 /* CAPABILITY: A-MSDU tx */ +/* NB: HT40 is implied by IEEE80211_HTCAP_CHWIDTH40 */ +#define IEEE80211_HTC_HT 0x00040000 /* CAPABILITY: HT operation */ +#define IEEE80211_HTC_SMPS 0x00080000 /* CAPABILITY: MIMO power save*/ +#define IEEE80211_HTC_RIFS 0x00100000 /* CAPABILITY: RIFS support */ +#define IEEE80211_HTC_RXUNEQUAL 0x00200000 /* CAPABILITY: RX unequal MCS */ +#define IEEE80211_HTC_RXMCS32 0x00400000 /* CAPABILITY: MCS32 support */ +#define IEEE80211_HTC_TXUNEQUAL 0x00800000 /* CAPABILITY: TX unequal MCS */ +#define IEEE80211_HTC_TXMCS32 0x01000000 /* CAPABILITY: MCS32 support */ + +#define IEEE80211_C_HTCAP_BITS \ + "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \ + "\21AMPDU\22AMSDU\23HT\24SMPS\25RIFS" + #endif /* _NET80211__IEEE80211_H_ */ Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Fri Nov 18 21:09:57 2016 (r308810) +++ head/sys/net80211/ieee80211_var.h Fri Nov 18 21:12:13 2016 (r308811) @@ -633,70 +633,6 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FVEN_BITS "\20" -/* ic_caps/iv_caps: device driver capabilities */ -/* 0x2e available */ -#define IEEE80211_C_STA 0x00000001 /* CAPABILITY: STA available */ -#define IEEE80211_C_8023ENCAP 0x00000002 /* CAPABILITY: 802.3 encap */ -#define IEEE80211_C_FF 0x00000040 /* CAPABILITY: ATH FF avail */ -#define IEEE80211_C_TURBOP 0x00000080 /* CAPABILITY: ATH Turbo avail*/ -#define IEEE80211_C_IBSS 0x00000100 /* CAPABILITY: IBSS available */ -#define IEEE80211_C_PMGT 0x00000200 /* CAPABILITY: Power mgmt */ -#define IEEE80211_C_HOSTAP 0x00000400 /* CAPABILITY: HOSTAP avail */ -#define IEEE80211_C_AHDEMO 0x00000800 /* CAPABILITY: Old Adhoc Demo */ -#define IEEE80211_C_SWRETRY 0x00001000 /* CAPABILITY: sw tx retry */ -#define IEEE80211_C_TXPMGT 0x00002000 /* CAPABILITY: tx power mgmt */ -#define IEEE80211_C_SHSLOT 0x00004000 /* CAPABILITY: short slottime */ -#define IEEE80211_C_SHPREAMBLE 0x00008000 /* CAPABILITY: short preamble */ -#define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */ -#define IEEE80211_C_DFS 0x00020000 /* CAPABILITY: DFS/radar avail*/ -#define IEEE80211_C_MBSS 0x00040000 /* CAPABILITY: MBSS available */ -#define IEEE80211_C_SWSLEEP 0x00080000 /* CAPABILITY: do sleep here */ -#define IEEE80211_C_SWAMSDUTX 0x00100000 /* CAPABILITY: software A-MSDU TX */ -/* 0x7c0000 available */ -#define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */ -#define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */ -#define IEEE80211_C_WPA 0x01800000 /* CAPABILITY: WPA1+WPA2 avail*/ -#define IEEE80211_C_BURST 0x02000000 /* CAPABILITY: frame bursting */ -#define IEEE80211_C_WME 0x04000000 /* CAPABILITY: WME avail */ -#define IEEE80211_C_WDS 0x08000000 /* CAPABILITY: 4-addr support */ -/* 0x10000000 reserved */ -#define IEEE80211_C_BGSCAN 0x20000000 /* CAPABILITY: bg scanning */ -#define IEEE80211_C_TXFRAG 0x40000000 /* CAPABILITY: tx fragments */ -#define IEEE80211_C_TDMA 0x80000000 /* CAPABILITY: TDMA avail */ -/* XXX protection/barker? */ - -#define IEEE80211_C_OPMODE \ - (IEEE80211_C_STA | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | \ - IEEE80211_C_AHDEMO | IEEE80211_C_MONITOR | IEEE80211_C_WDS | \ - IEEE80211_C_TDMA | IEEE80211_C_MBSS) - -#define IEEE80211_C_BITS \ - "\20\1STA\002803ENCAP\7FF\10TURBOP\11IBSS\12PMGT" \ - "\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \ - "\21MONITOR\22DFS\23MBSS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \ - "\37TXFRAG\40TDMA" - -/* - * ic_htcaps/iv_htcaps: HT-specific device/driver capabilities - * - * NB: the low 16-bits are the 802.11 definitions, the upper - * 16-bits are used to define s/w/driver capabilities. - */ -#define IEEE80211_HTC_AMPDU 0x00010000 /* CAPABILITY: A-MPDU tx */ -#define IEEE80211_HTC_AMSDU 0x00020000 /* CAPABILITY: A-MSDU tx */ -/* NB: HT40 is implied by IEEE80211_HTCAP_CHWIDTH40 */ -#define IEEE80211_HTC_HT 0x00040000 /* CAPABILITY: HT operation */ -#define IEEE80211_HTC_SMPS 0x00080000 /* CAPABILITY: MIMO power save*/ -#define IEEE80211_HTC_RIFS 0x00100000 /* CAPABILITY: RIFS support */ -#define IEEE80211_HTC_RXUNEQUAL 0x00200000 /* CAPABILITY: RX unequal MCS */ -#define IEEE80211_HTC_RXMCS32 0x00400000 /* CAPABILITY: MCS32 support */ -#define IEEE80211_HTC_TXUNEQUAL 0x00800000 /* CAPABILITY: TX unequal MCS */ -#define IEEE80211_HTC_TXMCS32 0x01000000 /* CAPABILITY: MCS32 suport */ - -#define IEEE80211_C_HTCAP_BITS \ - "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \ - "\21AMPDU\22AMSDU\23HT\24SMPS\25RIFS" - int ic_printf(struct ieee80211com *, const char *, ...) __printflike(2, 3); void ieee80211_ifattach(struct ieee80211com *); void ieee80211_ifdetach(struct ieee80211com *); From owner-svn-src-head@freebsd.org Fri Nov 18 21:12:37 2016 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 7D655C48009; Fri, 18 Nov 2016 21:12:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CF04EC3; Fri, 18 Nov 2016 21:12:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAILCaUG088361; Fri, 18 Nov 2016 21:12:36 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAILCaNf088360; Fri, 18 Nov 2016 21:12:36 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611182112.uAILCaNf088360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 18 Nov 2016 21:12:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308812 - head/sbin/ifconfig X-SVN-Group: head 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, 18 Nov 2016 21:12:37 -0000 Author: adrian Date: Fri Nov 18 21:12:36 2016 New Revision: 308812 URL: https://svnweb.freebsd.org/changeset/base/308812 Log: [ifconfig] remove now duplicate IEEE80211_C_BITS definition; it's now in _ieee80211.h . Reviewed by: avos Differential Revision: https://reviews.freebsd.org/D8553 Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Fri Nov 18 21:12:13 2016 (r308811) +++ head/sbin/ifconfig/ifieee80211.c Fri Nov 18 21:12:36 2016 (r308812) @@ -3785,12 +3785,6 @@ list_keys(int s) { } -#define IEEE80211_C_BITS \ - "\20\1STA\002803ENCAP\7FF\10TURBOP\11IBSS\12PMGT" \ - "\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \ - "\21MONITOR\22DFS\23MBSS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \ - "\37TXFRAG\40TDMA" - static void list_capabilities(int s) { From owner-svn-src-head@freebsd.org Fri Nov 18 21:18:52 2016 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 5C009C48267; Fri, 18 Nov 2016 21:18:52 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A8E312B1; Fri, 18 Nov 2016 21:18:52 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAILIpno088602; Fri, 18 Nov 2016 21:18:51 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAILIpFJ088601; Fri, 18 Nov 2016 21:18:51 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201611182118.uAILIpFJ088601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Fri, 18 Nov 2016 21:18:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308813 - head/sys/dev/bnxt X-SVN-Group: head 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, 18 Nov 2016 21:18:52 -0000 Author: shurd (ports committer) Date: Fri Nov 18 21:18:51 2016 New Revision: 308813 URL: https://svnweb.freebsd.org/changeset/base/308813 Log: Check link status after init Because link state change events aren't enabled until the end of init(), the initial link up event could be missed. Check the current media status immediately after enabling the default completion ring interrupt. Approved by: sbruno MFC after: 12 days Sponsored by: Broadcom Limited Modified: head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Fri Nov 18 21:12:36 2016 (r308812) +++ head/sys/dev/bnxt/if_bnxt.c Fri Nov 18 21:18:51 2016 (r308813) @@ -822,6 +822,7 @@ static void bnxt_init(if_ctx_t ctx) { struct bnxt_softc *softc = iflib_get_softc(ctx); + struct ifmediareq ifmr; int i, j; int rc; @@ -975,6 +976,7 @@ bnxt_init(if_ctx_t ctx) } bnxt_do_enable_intr(&softc->def_cp_ring); + bnxt_media_status(softc->ctx, &ifmr); return; fail: From owner-svn-src-head@freebsd.org Fri Nov 18 22:58:49 2016 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 299BDC48F8E; Fri, 18 Nov 2016 22:58:49 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03CB9C73; Fri, 18 Nov 2016 22:58:48 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAIMwmOt028551; Fri, 18 Nov 2016 22:58:48 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAIMwlLx028547; Fri, 18 Nov 2016 22:58:47 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201611182258.uAIMwlLx028547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Fri, 18 Nov 2016 22:58:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308816 - in head/sys/arm: conf ti ti/omap4 X-SVN-Group: head 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, 18 Nov 2016 22:58:49 -0000 Author: cognet Date: Fri Nov 18 22:58:47 2016 New Revision: 308816 URL: https://svnweb.freebsd.org/changeset/base/308816 Log: Convert the omap4 code to use PLATFORM_SMP. Added: head/sys/arm/ti/omap4/omap4_mp.h (contents, props changed) Modified: head/sys/arm/conf/PANDABOARD head/sys/arm/ti/omap4/omap4_mp.c head/sys/arm/ti/ti_machdep.c Modified: head/sys/arm/conf/PANDABOARD ============================================================================== --- head/sys/arm/conf/PANDABOARD Fri Nov 18 22:28:57 2016 (r308815) +++ head/sys/arm/conf/PANDABOARD Fri Nov 18 22:58:47 2016 (r308816) @@ -34,6 +34,7 @@ makeoptions MODULES_EXTRA=dtb/omap4 options SCHED_ULE # ULE scheduler options PLATFORM +options PLATFORM_SMP options SMP # Enable multiple cores # NFS root from boopt/dhcp Modified: head/sys/arm/ti/omap4/omap4_mp.c ============================================================================== --- head/sys/arm/ti/omap4/omap4_mp.c Fri Nov 18 22:28:57 2016 (r308815) +++ head/sys/arm/ti/omap4/omap4_mp.c Fri Nov 18 22:58:47 2016 (r308816) @@ -38,20 +38,24 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include void -platform_mp_setmaxid(void) +omap4_mp_setmaxid(platform_t plat) { + if (mp_ncpus != 0) + return; mp_maxid = 1; mp_ncpus = 2; } void -platform_mp_start_ap(void) +omap4_mp_start_ap(platform_t plat) { bus_addr_t scu_addr; Added: head/sys/arm/ti/omap4/omap4_mp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/ti/omap4/omap4_mp.h Fri Nov 18 22:58:47 2016 (r308816) @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2016 Olivier Houchard + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _OMAP4_MP_H_ +#define _OMAP4_MP_H_ +void omap4_mp_setmaxid(platform_t plat); +void omap4_mp_start_ap(platform_t plat); +#endif /* _OMAP4_MP_H_ */ + Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Fri Nov 18 22:28:57 2016 (r308815) +++ head/sys/arm/ti/ti_machdep.c Fri Nov 18 22:58:47 2016 (r308816) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "platform_if.h" @@ -110,6 +111,10 @@ static platform_method_t omap4_methods[] PLATFORMMETHOD(platform_lastaddr, ti_lastaddr), PLATFORMMETHOD(platform_cpu_reset, ti_plat_cpu_reset), +#ifdef SMP + PLATFORMMETHOD(platform_mp_start_ap, omap4_mp_start_ap), + PLATFORMMETHOD(platform_mp_setmaxid, omap4_mp_setmaxid), +#endif PLATFORMMETHOD_END, }; FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,omap4430", 0); From owner-svn-src-head@freebsd.org Fri Nov 18 22:59:34 2016 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 78532C48FED; Fri, 18 Nov 2016 22:59:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 485F5DEF; Fri, 18 Nov 2016 22:59:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAIMxXf6028620; Fri, 18 Nov 2016 22:59:33 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAIMxXbh028619; Fri, 18 Nov 2016 22:59:33 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201611182259.uAIMxXbh028619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 18 Nov 2016 22:59:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308817 - head/sys/powerpc/include X-SVN-Group: head 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, 18 Nov 2016 22:59:34 -0000 Author: jhibbits Date: Fri Nov 18 22:59:33 2016 New Revision: 308817 URL: https://svnweb.freebsd.org/changeset/base/308817 Log: Fix buildworld Change the pv_tracked flag to an int, just in case userspace decides to include this file and defines BOOKE. Guard this block from unintentional inclusion with ifdef BOOKE. Reported by: emaste Modified: head/sys/powerpc/include/pmap.h Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Fri Nov 18 22:58:47 2016 (r308816) +++ head/sys/powerpc/include/pmap.h Fri Nov 18 22:59:33 2016 (r308817) @@ -179,7 +179,7 @@ void slb_free_tree(pmap_t pm); struct slb **slb_alloc_user_cache(void); void slb_free_user_cache(struct slb **); -#else +#elif defined(BOOKE) struct pmap { struct mtx pm_mtx; /* pmap mutex */ @@ -204,7 +204,7 @@ typedef struct pv_entry *pv_entry_t; struct md_page { TAILQ_HEAD(, pv_entry) pv_list; - bool pv_tracked; + int pv_tracked; }; #define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT From owner-svn-src-head@freebsd.org Fri Nov 18 23:03:18 2016 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 25284C48251; Fri, 18 Nov 2016 23:03:18 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::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 E411F1288; Fri, 18 Nov 2016 23:03:17 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x241.google.com with SMTP id n68so7501662itn.3; Fri, 18 Nov 2016 15:03:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tmhxjjseXx0lV/F5Dsf17GgHW3nrIOdVwyjuGH4O/dk=; b=bGVwiU+EbNBkcBelBb3Kc02kfqX2jrDBy2E5+Qp9TlNtQ/2maEZb6LKjUVfKzt7nWq /JJ2TLjUSzw758swLBL2ghs0oZEHba8HmKyR9XbLUKPh+ik3urbwYFs61/T5rVfY4exs c98s8LFJzzChcGw+oIdYt5Asm9lhyv/SjXBNojS/VhW+g1N0QMw985Ky3i3rYTB/tTyH 2xflQ+5bEWdonI6ZogLFT9VAK2+KEegsEQdUxrg86yzfdldkyewBuUBIyA29XqY/Kz5O 2BTALhTAM5IObAEsp4ZbDVzYQpEKT9l0mXIJP5laDNOMBgM5RJQhsiSMNbLb/iPgCr3S 3kFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tmhxjjseXx0lV/F5Dsf17GgHW3nrIOdVwyjuGH4O/dk=; b=miXTwc5xQiENpFtEirQTvXyGAx/2RLTyJaWHnrepa73iYX99+qdQDnF+DfnWyHKCey n9MqwJTS2GuDCizmfwfxwrIQCij5mLX0FTMCpL2CeZgC89XuVbAq1VIE2on2Sdn6Vk1H GpwLW6FivziD0tgRoKJjx0ywirKw1Ak66Cpr4BbjJEMHES1J8zI8iCGnSGmOeVqrGZBb i7e9jaemll7+DGAdM3M2KezTN0bclJQ7Cxt5pApPR4P7Pf3aAsXjETUjAd6rJ7NO/TM1 Xl+eszB2ND5X0GW7qY3dISmh/U0SvWBrBX1eo3vikkbUoDIulOEASGSWq2f7jZ3azdqa tvVA== X-Gm-Message-State: AKaTC00nTZKeJD9TzHD52OFcXSFpNRbhYNDBIMWu7pKUgsW/uLY6FAEW4DBI1pCxS7gIm96MWtdVDQ/O1UG4ew== X-Received: by 10.36.220.130 with SMTP id q124mr851783itg.78.1479510197059; Fri, 18 Nov 2016 15:03:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.39.134 with HTTP; Fri, 18 Nov 2016 15:03:16 -0800 (PST) In-Reply-To: <201611182109.uAIL9vBY084531@repo.freebsd.org> References: <201611182109.uAIL9vBY084531@repo.freebsd.org> From: Adrian Chadd Date: Fri, 18 Nov 2016 15:03:16 -0800 Message-ID: Subject: Re: svn commit: r308810 - head/bin/dd To: Bartek Rutkowski 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: Fri, 18 Nov 2016 23:03:18 -0000 fwiw, this breaks -head compilation. -a On 18 November 2016 at 13:09, Bartek Rutkowski wrote: > Author: robak (ports committer) > Date: Fri Nov 18 21:09:57 2016 > New Revision: 308810 > URL: https://svnweb.freebsd.org/changeset/base/308810 > > Log: > Capsicum support for dd(1) > > Adds Capsicum sandboxing to dd utility. > > Submitted by: Pawel Biernacki > Reviewed by: allanjude, emaste, oshogbo > Approved by: oshogbo > Sponsored by: Mysterious Code Ltd. > Differential Revision: https://reviews.freebsd.org/D8543 > > Modified: > head/bin/dd/dd.c > > Modified: head/bin/dd/dd.c > ============================================================================== > --- head/bin/dd/dd.c Fri Nov 18 17:18:05 2016 (r308809) > +++ head/bin/dd/dd.c Fri Nov 18 21:09:57 2016 (r308810) > @@ -48,10 +48,13 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > +#include > > #include > +#include > #include > #include > #include > @@ -92,6 +95,10 @@ main(int argc __unused, char *argv[]) > jcl(argv); > setup(); > > + caph_cache_catpages(); > + if (cap_enter() == -1 && errno != ENOSYS) > + err(1, "unable to enter capability mode"); > + > (void)signal(SIGINFO, siginfo_handler); > (void)signal(SIGINT, terminate); > > @@ -125,6 +132,8 @@ static void > setup(void) > { > u_int cnt; > + cap_rights_t rights; > + unsigned long cmds[] = { FIODTYPE, MTIOCTOP }; > > if (in.name == NULL) { > in.name = "stdin"; > @@ -133,13 +142,20 @@ setup(void) > in.fd = open(in.name, O_RDONLY, 0); > if (in.fd == -1) > err(1, "%s", in.name); > + if (caph_limit_stdin() == -1) > + err(1, "unable to limit capability rights"); > } > > getfdtype(&in); > > + cap_rights_init(&rights, CAP_READ, CAP_SEEK); > + if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS) > + err(1, "unable to limit capability rights"); > + > if (files_cnt > 1 && !(in.flags & ISTAPE)) > errx(1, "files is not supported for non-tape devices"); > > + cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL); > if (out.name == NULL) { > /* No way to check for read access here. */ > out.fd = STDOUT_FILENO; > @@ -156,13 +172,27 @@ setup(void) > if (out.fd == -1) { > out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE); > out.flags |= NOREAD; > + cap_rights_clear(&rights, CAP_READ); > } > if (out.fd == -1) > err(1, "%s", out.name); > + if (caph_limit_stdout() == -1) > + err(1, "unable to limit capability rights"); > } > > getfdtype(&out); > > + if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS) > + err(1, "unable to limit capability rights"); > + if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 && > + errno != ENOSYS) > + err(1, "unable to limit capability rights"); > + > + if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) { > + if (caph_limit_stderr() == -1) > + err(1, "unable to limit capability rights"); > + } > + > /* > * Allocate space for the input and output buffers. If not doing > * record oriented I/O, only need a single buffer. > From owner-svn-src-head@freebsd.org Fri Nov 18 23:48:22 2016 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 6F313C48F73; Fri, 18 Nov 2016 23:48:22 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 224A7A97; Fri, 18 Nov 2016 23:48:22 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAINmLYw048300; Fri, 18 Nov 2016 23:48:21 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAINmLnH048298; Fri, 18 Nov 2016 23:48:21 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201611182348.uAINmLnH048298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Fri, 18 Nov 2016 23:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308818 - head/sys/arm/ti X-SVN-Group: head 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, 18 Nov 2016 23:48:22 -0000 Author: cognet Date: Fri Nov 18 23:48:20 2016 New Revision: 308818 URL: https://svnweb.freebsd.org/changeset/base/308818 Log: Guess the TI chip based on the PLATFORM infos, instead of relying on the kernel config file. Modified: head/sys/arm/ti/ti_cpuid.h head/sys/arm/ti/ti_machdep.c Modified: head/sys/arm/ti/ti_cpuid.h ============================================================================== --- head/sys/arm/ti/ti_cpuid.h Fri Nov 18 22:59:33 2016 (r308817) +++ head/sys/arm/ti/ti_cpuid.h Fri Nov 18 23:48:20 2016 (r308818) @@ -70,15 +70,12 @@ #define CHIP_OMAP_4 0 #define CHIP_AM335X 1 +extern int _ti_chip; + static __inline int ti_chip(void) { -#if defined(SOC_OMAP4) - return CHIP_OMAP_4; -#elif defined(SOC_TI_AM335X) - return CHIP_AM335X; -#else -# error Chip type not defined, ensure SOC_xxxx is defined -#endif + KASSERT(_ti_chip != -1, ("Can't determine TI Chip")); + return _ti_chip; } uint32_t ti_revision(void); Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Fri Nov 18 22:59:33 2016 (r308817) +++ head/sys/arm/ti/ti_machdep.c Fri Nov 18 23:48:20 2016 (r308818) @@ -54,11 +54,32 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "platform_if.h" void (*ti_cpu_reset)(void) = NULL; +int _ti_chip = -1; + +#if defined(SOC_OMAP4) +static int +omap4_attach(platform_t plat) +{ + _ti_chip = CHIP_OMAP_4; + return (0); +} +#endif + +#if defined(SOC_TI_AM335X) +static int +ti_am335x_attach(platform_t plat) +{ + _ti_chip = CHIP_AM335X; + return (0); +} +#endif + static vm_offset_t ti_lastaddr(platform_t plat) { @@ -107,6 +128,7 @@ ti_plat_cpu_reset(platform_t plat) #if defined(SOC_OMAP4) static platform_method_t omap4_methods[] = { + PLATFORMMETHOD(platform_attach, omap4_attach), PLATFORMMETHOD(platform_devmap_init, ti_omap4_devmap_init), PLATFORMMETHOD(platform_lastaddr, ti_lastaddr), PLATFORMMETHOD(platform_cpu_reset, ti_plat_cpu_reset), @@ -122,6 +144,7 @@ FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti, #if defined(SOC_TI_AM335X) static platform_method_t am335x_methods[] = { + PLATFORMMETHOD(platform_attach, ti_am335x_attach), PLATFORMMETHOD(platform_devmap_init, ti_am335x_devmap_init), PLATFORMMETHOD(platform_lastaddr, ti_lastaddr), PLATFORMMETHOD(platform_cpu_reset, ti_plat_cpu_reset), From owner-svn-src-head@freebsd.org Sat Nov 19 00:55:47 2016 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 D119AC471E1; Sat, 19 Nov 2016 00:55:47 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D2B9784; Sat, 19 Nov 2016 00:55:47 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJ0tkPh075554; Sat, 19 Nov 2016 00:55:46 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJ0tkN8075550; Sat, 19 Nov 2016 00:55:46 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201611190055.uAJ0tkN8075550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sat, 19 Nov 2016 00:55:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308819 - in head/sys/arm: conf ti/omap4 ti/omap4/pandaboard ti/usb X-SVN-Group: head 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, 19 Nov 2016 00:55:47 -0000 Author: cognet Date: Sat Nov 19 00:55:46 2016 New Revision: 308819 URL: https://svnweb.freebsd.org/changeset/base/308819 Log: Don't assume we're running on a pandaboard if the pandaboard-specific code is compiled in, use FDT to detect it instead. Added: head/sys/arm/ti/omap4/pandaboard/pandaboard.h (contents, props changed) Deleted: head/sys/arm/ti/omap4/pandaboard/files.pandaboard head/sys/arm/ti/omap4/pandaboard/std.pandaboard Modified: head/sys/arm/conf/PANDABOARD head/sys/arm/ti/omap4/files.omap4 head/sys/arm/ti/omap4/pandaboard/pandaboard.c head/sys/arm/ti/usb/omap_ehci.c Modified: head/sys/arm/conf/PANDABOARD ============================================================================== --- head/sys/arm/conf/PANDABOARD Fri Nov 18 23:48:20 2016 (r308818) +++ head/sys/arm/conf/PANDABOARD Sat Nov 19 00:55:46 2016 (r308819) @@ -28,7 +28,7 @@ ident PANDABOARD hints "PANDABOARD.hints" include "std.armv6" -include "../ti/omap4/pandaboard/std.pandaboard" +include "../ti/omap4/std.omap4" makeoptions MODULES_EXTRA=dtb/omap4 Modified: head/sys/arm/ti/omap4/files.omap4 ============================================================================== --- head/sys/arm/ti/omap4/files.omap4 Fri Nov 18 23:48:20 2016 (r308818) +++ head/sys/arm/ti/omap4/files.omap4 Sat Nov 19 00:55:46 2016 (r308819) @@ -14,6 +14,8 @@ arm/ti/omap4/omap4_scm_padconf.c standa arm/ti/omap4/omap4_mp.c optional smp arm/ti/omap4/omap4_wugen.c standard +arm/ti/omap4/pandaboard/pandaboard.c standard + arm/ti/twl/twl.c optional twl arm/ti/twl/twl_vreg.c optional twl twl_vreg arm/ti/twl/twl_clks.c optional twl twl_clks Modified: head/sys/arm/ti/omap4/pandaboard/pandaboard.c ============================================================================== --- head/sys/arm/ti/omap4/pandaboard/pandaboard.c Fri Nov 18 23:48:20 2016 (r308818) +++ head/sys/arm/ti/omap4/pandaboard/pandaboard.c Sat Nov 19 00:55:46 2016 (r308819) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include /* Registers in the SCRM that control the AUX clocks */ #define SCRM_ALTCLKSRC (0x110) @@ -111,8 +112,8 @@ __FBSDID("$FreeBSD$"); * RETURNS: * nothing. */ -static void -usb_hub_init(void) +void +pandaboard_usb_hub_init(void) { bus_space_handle_t scrm_addr, gpio1_addr, gpio2_addr, scm_addr; @@ -169,39 +170,3 @@ usb_hub_init(void) bus_space_unmap(fdtbus_bs_tag, gpio2_addr, OMAP44XX_GPIO2_SIZE); bus_space_unmap(fdtbus_bs_tag, scm_addr, OMAP44XX_SCM_PADCONF_SIZE); } - -/** - * board_init - initialises the pandaboard - * @dummy: ignored - * - * This function is called before any of the driver are initialised, which is - * annoying because it means we can't use the SCM, PRCM and GPIO modules which - * would really be useful. - * - * So we don't have: - * - any drivers - * - no interrupts - * - * What we do have: - * - virt/phys mappings from the devmap (see omap4.c) - * - - * - * - * So we are hamstrung without the useful drivers and we have to go back to - * direct register manupulation. Luckly we don't have to do to much, basically - * just setup the usb hub/ethernet. - * - */ -static void -board_init(void *dummy) -{ - /* Initialise the USB phy and hub */ - usb_hub_init(); - - /* - * XXX Board identification e.g. read out from FPGA or similar should - * go here - */ -} - -SYSINIT(board_init, SI_SUB_CPU, SI_ORDER_THIRD, board_init, NULL); Added: head/sys/arm/ti/omap4/pandaboard/pandaboard.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/ti/omap4/pandaboard/pandaboard.h Sat Nov 19 00:55:46 2016 (r308819) @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2016 Olivier Houchard + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _PANDABOARD_H_ +#define _PANDABOARD_H_ +void pandaboard_usb_hub_init(void); +#endif /* _OMAP4_MP_H_ */ + Modified: head/sys/arm/ti/usb/omap_ehci.c ============================================================================== --- head/sys/arm/ti/usb/omap_ehci.c Fri Nov 18 23:48:20 2016 (r308818) +++ head/sys/arm/ti/usb/omap_ehci.c Sat Nov 19 00:55:46 2016 (r308819) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -57,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + /* EHCI */ #define OMAP_USBHOST_HCCAPBASE 0x0000 #define OMAP_USBHOST_HCSPARAMS 0x0004 @@ -258,6 +261,7 @@ omap_ehci_init(struct omap_ehci_softc *i static int omap_ehci_probe(device_t dev) { + phandle_t root; if (!ofw_bus_status_okay(dev)) return (ENXIO); @@ -265,6 +269,16 @@ omap_ehci_probe(device_t dev) if (!ofw_bus_is_compatible(dev, "ti,ehci-omap")) return (ENXIO); +#ifdef SOC_OMAP4 + /* + * If we're running a Pandaboard, run Pandaboard-specific + * init code. + */ + root = OF_finddevice("/"); + if (fdt_is_compatible(root, "ti,omap4-panda")) + pandaboard_usb_hub_init(); +#endif + device_set_desc(dev, OMAP_EHCI_HC_DEVSTR); return (BUS_PROBE_DEFAULT); From owner-svn-src-head@freebsd.org Sat Nov 19 01:36:45 2016 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 77269C48E01; Sat, 19 Nov 2016 01:36:45 +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 4771F5E4; Sat, 19 Nov 2016 01:36:45 +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 uAJ1aiIX091276; Sat, 19 Nov 2016 01:36:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJ1aiZb091275; Sat, 19 Nov 2016 01:36:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611190136.uAJ1aiZb091275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 19 Nov 2016 01:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308821 - head/sys/i386/i386 X-SVN-Group: head 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, 19 Nov 2016 01:36:45 -0000 Author: jhb Date: Sat Nov 19 01:36:44 2016 New Revision: 308821 URL: https://svnweb.freebsd.org/changeset/base/308821 Log: MFamd64: Various fatal page fault fixes. - If a page fault is triggered due to reserved bits in a PTE, treat it as a fatal fault and panic. - If PG_NX is in use, report whether a fatal page fault is due to an instruction fetch or a data access. - If a fatal page fault is due to reserved bits in a PTE, report that as the page fault type rather than a protection violation. MFC after: 1 month Modified: head/sys/i386/i386/trap.c Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Sat Nov 19 01:34:12 2016 (r308820) +++ head/sys/i386/i386/trap.c Sat Nov 19 01:36:44 2016 (r308821) @@ -857,6 +857,14 @@ trap_pfault(frame, usermode, eva) } /* + * If the trap was caused by errant bits in the PTE then panic. + */ + if (frame->tf_err & PGEX_RSV) { + trap_fatal(frame, eva); + return (-1); + } + + /* * PGEX_I is defined only if the execute disable bit capability is * supported and enabled. */ @@ -926,9 +934,15 @@ trap_fatal(frame, eva) #endif if (type == T_PAGEFLT) { printf("fault virtual address = 0x%x\n", eva); - printf("fault code = %s %s, %s\n", + printf("fault code = %s %s%s, %s\n", code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", +#if defined(PAE) || defined(PAE_TABLES) + pg_nx != 0 ? + (code & PGEX_I ? " instruction" : " data") : +#endif + "", + code & PGEX_RSV ? "reserved bits in PTE" : code & PGEX_P ? "protection violation" : "page not present"); } printf("instruction pointer = 0x%x:0x%x\n", From owner-svn-src-head@freebsd.org Sat Nov 19 01:34:14 2016 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 43468C48BF5; Sat, 19 Nov 2016 01:34:14 +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 1311AA7; Sat, 19 Nov 2016 01:34:14 +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 uAJ1YDiY091148; Sat, 19 Nov 2016 01:34:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJ1YDEB091147; Sat, 19 Nov 2016 01:34:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611190134.uAJ1YDEB091147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 19 Nov 2016 01:34:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308820 - head/sys/amd64/amd64 X-SVN-Group: head 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, 19 Nov 2016 01:34:14 -0000 Author: jhb Date: Sat Nov 19 01:34:12 2016 New Revision: 308820 URL: https://svnweb.freebsd.org/changeset/base/308820 Log: Report page faults due to reserved bits in PTEs as a separate fault type. Rather than reporting a page fault due to a bad PTE as a protection violation with the "rsv" flag, treat these faults as a separate type of fault altogether. MFC after: 1 month Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Sat Nov 19 00:55:46 2016 (r308819) +++ head/sys/amd64/amd64/trap.c Sat Nov 19 01:34:12 2016 (r308820) @@ -761,11 +761,11 @@ trap_fatal(frame, eva) #endif if (type == T_PAGEFLT) { printf("fault virtual address = 0x%lx\n", eva); - printf("fault code = %s %s %s%s, %s\n", + printf("fault code = %s %s %s, %s\n", code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", code & PGEX_I ? "instruction" : "data", - code & PGEX_RSV ? " rsv" : "", + code & PGEX_RSV ? "reserved bits in PTE" : code & PGEX_P ? "protection violation" : "page not present"); } printf("instruction pointer = 0x%lx:0x%lx\n", From owner-svn-src-head@freebsd.org Sat Nov 19 02:10:00 2016 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 1EB56C473A2; Sat, 19 Nov 2016 02:10:00 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C87E11B2A; Sat, 19 Nov 2016 02:09:59 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJ29wc9003417; Sat, 19 Nov 2016 02:09:58 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJ29wwS003416; Sat, 19 Nov 2016 02:09:58 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201611190209.uAJ29wwS003416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Sat, 19 Nov 2016 02:09:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308824 - head/usr.bin/locale X-SVN-Group: head 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, 19 Nov 2016 02:10:00 -0000 Author: vangyzen Date: Sat Nov 19 02:09:58 2016 New Revision: 308824 URL: https://svnweb.freebsd.org/changeset/base/308824 Log: locale: fix display of "grouping" and "mon_grouping" values The "grouping" and "mon_grouping" values are arrays of one-byte integers, not arrays of ASCII characters. Display them in a format similar to GNU and MacOS. MFC after: 3 days Sponsored by: Dell EMC Modified: head/usr.bin/locale/locale.c Modified: head/usr.bin/locale/locale.c ============================================================================== --- head/usr.bin/locale/locale.c Sat Nov 19 02:00:24 2016 (r308823) +++ head/usr.bin/locale/locale.c Sat Nov 19 02:09:58 2016 (r308824) @@ -50,6 +50,7 @@ #include "setlocale.h" /* Local prototypes */ +char *format_grouping(const char *); void init_locales_list(void); void list_charmaps(void); void list_locales(void); @@ -488,6 +489,34 @@ showlocale(void) printf("LC_ALL=%s\n", vval); } +char * +format_grouping(const char *binary) +{ + static char rval[64]; + const char *cp; + size_t len; + + rval[0] = '\0'; + for (cp = binary; *cp != '\0'; ++cp) { + char group[sizeof("127;")]; + snprintf(group, sizeof(group), "%hhd;", *cp); + len = strlcat(rval, group, sizeof(rval)); + if (len >= sizeof(rval)) { + len = sizeof(rval) - 1; + break; + } + if (*cp == CHAR_MAX) { + break; + } + } + + /* Remove the trailing ';'. */ + rval[len - 1] = '\0'; + + return (rval); +} + + /* * keyword value lookup helper (via localeconv()) */ @@ -501,7 +530,7 @@ kwval_lconv(int id) lc = localeconv(); switch (id) { case KW_GROUPING: - rval = lc->grouping; + rval = format_grouping(lc->grouping); break; case KW_INT_CURR_SYMBOL: rval = lc->int_curr_symbol; @@ -516,7 +545,7 @@ kwval_lconv(int id) rval = lc->mon_thousands_sep; break; case KW_MON_GROUPING: - rval = lc->mon_grouping; + rval = format_grouping(lc->mon_grouping); break; case KW_POSITIVE_SIGN: rval = lc->positive_sign; From owner-svn-src-head@freebsd.org Sat Nov 19 01:51:58 2016 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 CAF81C49A78; Sat, 19 Nov 2016 01:51:58 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6406127E; Sat, 19 Nov 2016 01:51:58 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJ1pvoI098271; Sat, 19 Nov 2016 01:51:57 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJ1pv6l098264; Sat, 19 Nov 2016 01:51:57 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201611190151.uAJ1pv6l098264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sat, 19 Nov 2016 01:51:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308822 - in head/sys/arm: conf ti ti/am335x ti/omap4 X-SVN-Group: head 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, 19 Nov 2016 01:51:58 -0000 Author: cognet Date: Sat Nov 19 01:51:56 2016 New Revision: 308822 URL: https://svnweb.freebsd.org/changeset/base/308822 Log: Resolv the remaining conflicting symbols between omap4 and am335x, and add omap4/pandaboard into the GENERIC kernel. Modified: head/sys/arm/conf/GENERIC head/sys/arm/ti/am335x/am335x_scm_padconf.c head/sys/arm/ti/am335x/am335x_scm_padconf.h head/sys/arm/ti/omap4/omap4_scm_padconf.c head/sys/arm/ti/omap4/omap4_scm_padconf.h head/sys/arm/ti/ti_machdep.c head/sys/arm/ti/ti_pinmux.c Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Sat Nov 19 01:36:44 2016 (r308821) +++ head/sys/arm/conf/GENERIC Sat Nov 19 01:51:56 2016 (r308822) @@ -43,6 +43,7 @@ files "../nvidia/tegra124/files.tegra12 files "../qemu/files.qemu" files "../ti/files.ti" files "../ti/am335x/files.am335x" +files "../ti/omap4/files.omap4" options SOC_ALLWINNER_A10 options SOC_ALLWINNER_A13 @@ -53,6 +54,7 @@ options SOC_ALLWINNER_A83T options SOC_ALLWINNER_H3 options SOC_BCM2836 options SOC_TI_AM335X +options SOC_OMAP4 options SCHED_ULE # ULE scheduler options SMP # Enable multiple cores @@ -80,6 +82,7 @@ device pmu # ARM Generic Timer device generic_timer +device mpcore_timer # MMC/SD/SDIO Card slot support device sdhci # SD controller @@ -129,6 +132,9 @@ device ti_i2c device am335x_pmic # AM335x Power Management IC (TPC65217) device am335x_rtc # RTC support (power management only) #define am335x_dmtpps # Pulse Per Second capture driver +device twl # TI TWLX0X0/TPS659x0 Power Management +device twl_vreg # twl voltage regulation +device twl_clks # twl external clocks # GPIO device gpio @@ -214,9 +220,12 @@ device ti_pruss # Mailbox support device ti_mbox +# DMA controller +device ti_sdma + # Extensible Firmware Interface options EFI # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA="dtb/allwinner dtb/am335x dtb/nvidia dtb/rpi" +makeoptions MODULES_EXTRA="dtb/allwinner dtb/am335x dtb/nvidia dtb/rpi dtb/omap4" Modified: head/sys/arm/ti/am335x/am335x_scm_padconf.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_scm_padconf.c Sat Nov 19 01:36:44 2016 (r308821) +++ head/sys/arm/ti/am335x/am335x_scm_padconf.c Sat Nov 19 01:51:56 2016 (r308822) @@ -293,7 +293,7 @@ const static struct ti_pinmux_padconf ti { .ballname = NULL }, }; -const struct ti_pinmux_device ti_pinmux_dev = { +const struct ti_pinmux_device ti_am335x_pinmux_dev = { .padconf_muxmode_mask = 0x7, .padconf_sate_mask = 0x78, .padstate = ti_padstate_devmap, Modified: head/sys/arm/ti/am335x/am335x_scm_padconf.h ============================================================================== --- head/sys/arm/ti/am335x/am335x_scm_padconf.h Sat Nov 19 01:36:44 2016 (r308821) +++ head/sys/arm/ti/am335x/am335x_scm_padconf.h Sat Nov 19 01:51:56 2016 (r308822) @@ -42,4 +42,6 @@ #define PADCONF_INPUT_PULLDOWN (RXACTIVE) #define PADCONF_INPUT_PULLUP_SLOW (PADCONF_INPUT_PULLUP | SLEWCTRL) +extern const struct ti_pinmux_device ti_am335x_pinmux_dev; + #endif /* AM335X_SCM_PADCONF_H */ Modified: head/sys/arm/ti/omap4/omap4_scm_padconf.c ============================================================================== --- head/sys/arm/ti/omap4/omap4_scm_padconf.c Sat Nov 19 01:36:44 2016 (r308821) +++ head/sys/arm/ti/omap4/omap4_scm_padconf.c Sat Nov 19 01:51:56 2016 (r308822) @@ -295,7 +295,7 @@ const static struct ti_pinmux_padconf ti { .ballname = NULL }, }; -const struct ti_pinmux_device ti_pinmux_dev = { +const struct ti_pinmux_device omap4_pinmux_dev = { .padconf_muxmode_mask = CONTROL_PADCONF_MUXMODE_MASK, .padconf_sate_mask = CONTROL_PADCONF_SATE_MASK, .padstate = ti_padstate_devmap, Modified: head/sys/arm/ti/omap4/omap4_scm_padconf.h ============================================================================== --- head/sys/arm/ti/omap4/omap4_scm_padconf.h Sat Nov 19 01:36:44 2016 (r308821) +++ head/sys/arm/ti/omap4/omap4_scm_padconf.h Sat Nov 19 01:51:56 2016 (r308822) @@ -78,4 +78,6 @@ | CONTROL_PADCONF_OFF_PULL_ENABLE) #define PADCONF_PIN_OFF_WAKEUPENABLE CONTROL_PADCONF_WAKEUP_ENABLE +extern const struct ti_pinmux_device omap4_pinmux_dev; + #endif /* OMAP4_SCM_PADCONF_H */ Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Sat Nov 19 01:36:44 2016 (r308821) +++ head/sys/arm/ti/ti_machdep.c Sat Nov 19 01:51:56 2016 (r308822) @@ -139,7 +139,7 @@ static platform_method_t omap4_methods[] #endif PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,omap4430", 0); +FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,omap4430", 200); #endif #if defined(SOC_TI_AM335X) Modified: head/sys/arm/ti/ti_pinmux.c ============================================================================== --- head/sys/arm/ti/ti_pinmux.c Sat Nov 19 01:36:44 2016 (r308821) +++ head/sys/arm/ti/ti_pinmux.c Sat Nov 19 01:51:56 2016 (r308822) @@ -54,6 +54,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include #include "ti_pinmux.h" struct pincfg { @@ -85,7 +88,7 @@ static struct ti_pinmux_softc *ti_pinmux * files and is specific to the given SoC platform. Each entry in the array * corresponds to an individual pin. */ -extern const struct ti_pinmux_device ti_pinmux_dev; +static const struct ti_pinmux_device *ti_pinmux_dev; /** @@ -101,7 +104,7 @@ ti_pinmux_padconf_from_name(const char * { const struct ti_pinmux_padconf *padconf; - padconf = ti_pinmux_dev.padconf; + padconf = ti_pinmux_dev->padconf; while (padconf->ballname != NULL) { if (strcmp(ballname, padconf->ballname) == 0) return(padconf); @@ -134,7 +137,7 @@ ti_pinmux_padconf_set_internal(struct ti uint16_t reg_val; /* populate the new value for the PADCONF register */ - reg_val = (uint16_t)(state & ti_pinmux_dev.padconf_sate_mask); + reg_val = (uint16_t)(state & ti_pinmux_dev->padconf_sate_mask); /* find the new mode requested */ for (mode = 0; mode < 8; mode++) { @@ -151,7 +154,7 @@ ti_pinmux_padconf_set_internal(struct ti } /* set the mux mode */ - reg_val |= (uint16_t)(mode & ti_pinmux_dev.padconf_muxmode_mask); + reg_val |= (uint16_t)(mode & ti_pinmux_dev->padconf_muxmode_mask); if (bootverbose) device_printf(sc->sc_dev, "setting internal %x for %s\n", @@ -226,11 +229,11 @@ ti_pinmux_padconf_get(const char *padnam /* save the state */ if (state) - *state = (reg_val & ti_pinmux_dev.padconf_sate_mask); + *state = (reg_val & ti_pinmux_dev->padconf_sate_mask); /* save the mode */ if (muxmode) - *muxmode = padconf->muxmodes[(reg_val & ti_pinmux_dev.padconf_muxmode_mask)]; + *muxmode = padconf->muxmodes[(reg_val & ti_pinmux_dev->padconf_muxmode_mask)]; return (0); } @@ -259,7 +262,7 @@ ti_pinmux_padconf_set_gpiomode(uint32_t return (ENXIO); /* find the gpio pin in the padconf array */ - padconf = ti_pinmux_dev.padconf; + padconf = ti_pinmux_dev->padconf; while (padconf->ballname != NULL) { if (padconf->gpio_pin == gpio) break; @@ -269,10 +272,10 @@ ti_pinmux_padconf_set_gpiomode(uint32_t return (EINVAL); /* populate the new value for the PADCONF register */ - reg_val = (uint16_t)(state & ti_pinmux_dev.padconf_sate_mask); + reg_val = (uint16_t)(state & ti_pinmux_dev->padconf_sate_mask); /* set the mux mode */ - reg_val |= (uint16_t)(padconf->gpio_mode & ti_pinmux_dev.padconf_muxmode_mask); + reg_val |= (uint16_t)(padconf->gpio_mode & ti_pinmux_dev->padconf_muxmode_mask); /* write the register value (16-bit writes) */ ti_pinmux_write_2(ti_pinmux_sc, padconf->reg_off, reg_val); @@ -304,7 +307,7 @@ ti_pinmux_padconf_get_gpiomode(uint32_t return (ENXIO); /* find the gpio pin in the padconf array */ - padconf = ti_pinmux_dev.padconf; + padconf = ti_pinmux_dev->padconf; while (padconf->ballname != NULL) { if (padconf->gpio_pin == gpio) break; @@ -317,12 +320,12 @@ ti_pinmux_padconf_get_gpiomode(uint32_t reg_val = ti_pinmux_read_2(ti_pinmux_sc, padconf->reg_off); /* check to make sure the pins is configured as GPIO in the first state */ - if ((reg_val & ti_pinmux_dev.padconf_muxmode_mask) != padconf->gpio_mode) + if ((reg_val & ti_pinmux_dev->padconf_muxmode_mask) != padconf->gpio_mode) return (EINVAL); /* read and store the reset of the state, i.e. pull-up, pull-down, etc */ if (state) - *state = (reg_val & ti_pinmux_dev.padconf_sate_mask); + *state = (reg_val & ti_pinmux_dev->padconf_sate_mask); return (0); } @@ -381,6 +384,22 @@ ti_pinmux_probe(device_t dev) __func__); return (EEXIST); } + switch (ti_chip()) { +#ifdef SOC_OMAP4 + case CHIP_OMAP_4: + ti_pinmux_dev = &omap4_pinmux_dev; + break; +#endif +#ifdef SOC_TI_AM335X + case CHIP_AM335X: + ti_pinmux_dev = &ti_am335x_pinmux_dev; + break; +#endif + default: + printf("Unknown CPU in pinmux\n"); + return (ENXIO); + } + device_set_desc(dev, "TI Pinmux Module"); return (BUS_PROBE_DEFAULT); From owner-svn-src-head@freebsd.org Sat Nov 19 02:00:26 2016 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 85DE8C49CFC; Sat, 19 Nov 2016 02:00:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 51E56154D; Sat, 19 Nov 2016 02:00:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJ20P3U099361; Sat, 19 Nov 2016 02:00:25 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJ20Ovm099353; Sat, 19 Nov 2016 02:00:24 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611190200.uAJ20Ovm099353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 19 Nov 2016 02:00:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308823 - head/sys/net80211 X-SVN-Group: head 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, 19 Nov 2016 02:00:26 -0000 Author: adrian Date: Sat Nov 19 02:00:24 2016 New Revision: 308823 URL: https://svnweb.freebsd.org/changeset/base/308823 Log: [net80211] handle hardware encryption offload in the receive path * teach the crypto modules about receive offload - although I have to do some further reviewing in places where we /can't/ have an RX key * teach the RX data path about receive offload encryption - check the flag, handle NULL key, do decap and checking as appropriate. Tested: * iwn(4), STA mode * ath(4), STA and AP mode * ath10k port, STA mode (hardware encryption) Reviewed by: avos Differential Revision: https://reviews.freebsd.org/D8533 Modified: head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_crypto.c head/sys/net80211/ieee80211_crypto.h head/sys/net80211/ieee80211_crypto_ccmp.c head/sys/net80211/ieee80211_crypto_tkip.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_wds.c Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Sat Nov 19 01:51:56 2016 (r308822) +++ head/sys/net80211/ieee80211_adhoc.c Sat Nov 19 02:00:24 2016 (r308823) @@ -316,6 +316,16 @@ adhoc_input(struct ieee80211_node *ni, s int hdrspace, need_tap = 1; /* mbuf need to be tapped. */ uint8_t dir, type, subtype, qos; uint8_t *bssid; + int is_hw_decrypted = 0; + int has_decrypted = 0; + + /* + * Some devices do hardware decryption all the way through + * to pretending the frame wasn't encrypted in the first place. + * So, tag it appropriately so it isn't discarded inappropriately. + */ + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_DECRYPTED)) + is_hw_decrypted = 1; if (m->m_flags & M_AMPDU_MPDU) { /* @@ -479,7 +489,7 @@ adhoc_input(struct ieee80211_node *ni, s * crypto cipher modules used to do delayed update * of replay sequence numbers. */ - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (is_hw_decrypted || wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { /* * Discard encrypted frames when privacy is off. @@ -490,14 +500,14 @@ adhoc_input(struct ieee80211_node *ni, s IEEE80211_NODE_STAT(ni, rx_noprivacy); goto out; } - key = ieee80211_crypto_decap(ni, m, hdrspace); - if (key == NULL) { + if (ieee80211_crypto_decap(ni, m, hdrspace, &key) == 0) { /* NB: stats+msgs handled in crypto_decap */ IEEE80211_NODE_STAT(ni, rx_wepfail); goto out; } wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; + has_decrypted = 1; } else { /* XXX M_WEP and IEEE80211_F_PRIVACY */ key = NULL; @@ -528,7 +538,7 @@ adhoc_input(struct ieee80211_node *ni, s /* * Next strip any MSDU crypto bits. */ - if (key != NULL && !ieee80211_crypto_demic(vap, key, m, 0)) { + if (!ieee80211_crypto_demic(vap, key, m, 0)) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, ni->ni_macaddr, "data", "%s", "demic error"); vap->iv_stats.is_rx_demicfail++; @@ -582,7 +592,8 @@ adhoc_input(struct ieee80211_node *ni, s * any non-PAE frames received without encryption. */ if ((vap->iv_flags & IEEE80211_F_DROPUNENC) && - (key == NULL && (m->m_flags & M_WEP) == 0) && + ((has_decrypted == 0) && (m->m_flags & M_WEP) == 0) && + (is_hw_decrypted == 0) && eh->ether_type != htons(ETHERTYPE_PAE)) { /* * Drop unencrypted frames. Modified: head/sys/net80211/ieee80211_crypto.c ============================================================================== --- head/sys/net80211/ieee80211_crypto.c Sat Nov 19 01:51:56 2016 (r308822) +++ head/sys/net80211/ieee80211_crypto.c Sat Nov 19 02:00:24 2016 (r308823) @@ -580,8 +580,9 @@ ieee80211_crypto_encap(struct ieee80211_ * Validate and strip privacy headers (and trailer) for a * received frame that has the WEP/Privacy bit set. */ -struct ieee80211_key * -ieee80211_crypto_decap(struct ieee80211_node *ni, struct mbuf *m, int hdrlen) +int +ieee80211_crypto_decap(struct ieee80211_node *ni, struct mbuf *m, int hdrlen, + struct ieee80211_key **key) { #define IEEE80211_WEP_HDRLEN (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN) #define IEEE80211_WEP_MINLEN \ @@ -590,16 +591,38 @@ ieee80211_crypto_decap(struct ieee80211_ struct ieee80211vap *vap = ni->ni_vap; struct ieee80211_key *k; struct ieee80211_frame *wh; + const struct ieee80211_rx_stats *rxs; const struct ieee80211_cipher *cip; uint8_t keyid; + /* + * Check for hardware decryption and IV stripping. + * If the IV is stripped then we definitely can't find a key. + * Set the key to NULL but return true; upper layers + * will need to handle a NULL key for a successful + * decrypt. + */ + rxs = ieee80211_get_rx_params_ptr(m); + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_DECRYPTED)) { + if (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP) { + /* + * Hardware decrypted, IV stripped. + * We can't find a key with a stripped IV. + * Return successful. + */ + *key = NULL; + return (1); + } + } + /* NB: this minimum size data frame could be bigger */ if (m->m_pkthdr.len < IEEE80211_WEP_MINLEN) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_ANY, "%s: WEP data frame too short, len %u\n", __func__, m->m_pkthdr.len); vap->iv_stats.is_rx_tooshort++; /* XXX need unique stat? */ - return NULL; + *key = NULL; + return (0); } /* @@ -625,15 +648,29 @@ ieee80211_crypto_decap(struct ieee80211_ IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO, wh->i_addr2, "unable to pullup %s header", cip->ic_name); vap->iv_stats.is_rx_wepfail++; /* XXX */ - return NULL; + *key = NULL; + return (0); + } + + /* + * Attempt decryption. + * + * If we fail then don't return the key - return NULL + * and an error. + */ + if (cip->ic_decap(k, m, hdrlen)) { + /* success */ + *key = k; + return (1); } - return (cip->ic_decap(k, m, hdrlen) ? k : NULL); + /* Failure */ + *key = NULL; + return (0); #undef IEEE80211_WEP_MINLEN #undef IEEE80211_WEP_HDRLEN } - /* * Check and remove any MIC. */ Modified: head/sys/net80211/ieee80211_crypto.h ============================================================================== --- head/sys/net80211/ieee80211_crypto.h Sat Nov 19 01:51:56 2016 (r308822) +++ head/sys/net80211/ieee80211_crypto.h Sat Nov 19 02:00:24 2016 (r308823) @@ -114,7 +114,8 @@ struct ieee80211_key { #define IEEE80211_KEY_DEVICE /* flags owned by device driver */\ (IEEE80211_KEY_DEVKEY|IEEE80211_KEY_CIPHER0|IEEE80211_KEY_CIPHER1| \ - IEEE80211_KEY_SWCRYPT|IEEE80211_KEY_SWMIC) + IEEE80211_KEY_SWCRYPT|IEEE80211_KEY_SWMIC|IEEE80211_KEY_NOIV | \ + IEEE80211_KEY_NOIVMGT|IEEE80211_KEY_NOMIC|IEEE80211_KEY_NOMICMGT) #define IEEE80211_KEY_BITS \ "\20\1XMIT\2RECV\3GROUP\4SWENCRYPT\5SWDECRYPT\6SWENMIC\7SWDEMIC" \ @@ -207,8 +208,8 @@ struct ieee80211_key *ieee80211_crypto_g struct mbuf *); struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211_node *, struct mbuf *); -struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211_node *, - struct mbuf *, int); +int ieee80211_crypto_decap(struct ieee80211_node *, + struct mbuf *, int, struct ieee80211_key **); int ieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k, struct mbuf *, int); /* Modified: head/sys/net80211/ieee80211_crypto_ccmp.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_ccmp.c Sat Nov 19 01:51:56 2016 (r308822) +++ head/sys/net80211/ieee80211_crypto_ccmp.c Sat Nov 19 02:00:24 2016 (r308823) @@ -162,12 +162,27 @@ ccmp_setiv(struct ieee80211_key *k, uint static int ccmp_encap(struct ieee80211_key *k, struct mbuf *m) { + const struct ieee80211_frame *wh; struct ccmp_ctx *ctx = k->wk_private; struct ieee80211com *ic = ctx->cc_ic; uint8_t *ivp; int hdrlen; + int is_mgmt; hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); + wh = mtod(m, const struct ieee80211_frame *); + is_mgmt = IEEE80211_IS_MGMT(wh); + + /* + * Check to see if we need to insert IV/MIC. + * + * Some offload devices don't require the IV to be inserted + * as part of the hardware encryption. + */ + if (is_mgmt && (k->wk_flags & IEEE80211_KEY_NOIVMGT)) + return 1; + if ((! is_mgmt) && (k->wk_flags & IEEE80211_KEY_NOIV)) + return 1; /* * Copy down 802.11 header and add the IV, KeyID, and ExtIV. @@ -217,12 +232,18 @@ READ_6(uint8_t b0, uint8_t b1, uint8_t b static int ccmp_decap(struct ieee80211_key *k, struct mbuf *m, int hdrlen) { + const struct ieee80211_rx_stats *rxs; struct ccmp_ctx *ctx = k->wk_private; struct ieee80211vap *vap = ctx->cc_vap; struct ieee80211_frame *wh; uint8_t *ivp, tid; uint64_t pn; + rxs = ieee80211_get_rx_params_ptr(m); + + if ((rxs != NULL) & (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP)) + goto finish; + /* * Header should have extended IV and sequence number; * verify the former and validate the latter. @@ -261,17 +282,28 @@ ccmp_decap(struct ieee80211_key *k, stru !ccmp_decrypt(k, pn, m, hdrlen)) return 0; +finish: /* * Copy up 802.11 header and strip crypto bits. */ - ovbcopy(mtod(m, void *), mtod(m, uint8_t *) + ccmp.ic_header, hdrlen); - m_adj(m, ccmp.ic_header); - m_adj(m, -ccmp.ic_trailer); + if (! ((rxs != NULL) & (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))) { + ovbcopy(mtod(m, void *), mtod(m, uint8_t *) + ccmp.ic_header, + hdrlen); + m_adj(m, ccmp.ic_header); + } + + /* + * XXX TODO: see if MMIC_STRIP also covers CCMP MIC trailer. + */ + if (! ((rxs != NULL) & (rxs->c_pktflags & IEEE80211_RX_F_MMIC_STRIP))) + m_adj(m, -ccmp.ic_trailer); /* * Ok to update rsc now. */ - k->wk_keyrsc[tid] = pn; + if (! ((rxs != NULL) & (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))) { + k->wk_keyrsc[tid] = pn; + } return 1; } Modified: head/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_tkip.c Sat Nov 19 01:51:56 2016 (r308822) +++ head/sys/net80211/ieee80211_crypto_tkip.c Sat Nov 19 02:00:24 2016 (r308823) @@ -177,8 +177,13 @@ tkip_encap(struct ieee80211_key *k, stru struct tkip_ctx *ctx = k->wk_private; struct ieee80211vap *vap = ctx->tc_vap; struct ieee80211com *ic = vap->iv_ic; + struct ieee80211_frame *wh; uint8_t *ivp; int hdrlen; + int is_mgmt; + + wh = mtod(m, struct ieee80211_frame *); + is_mgmt = IEEE80211_IS_MGMT(wh); /* * Handle TKIP counter measures requirement. @@ -193,6 +198,16 @@ tkip_encap(struct ieee80211_key *k, stru vap->iv_stats.is_crypto_tkipcm++; return 0; } + + /* + * Check to see whether IV needs to be included. + */ + if (is_mgmt && (k->wk_flags & IEEE80211_KEY_NOIVMGT)) + return 1; + if ((! is_mgmt) && (k->wk_flags & IEEE80211_KEY_NOIV)) + return 1; + + hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); /* @@ -224,6 +239,19 @@ static int tkip_enmic(struct ieee80211_key *k, struct mbuf *m, int force) { struct tkip_ctx *ctx = k->wk_private; + struct ieee80211_frame *wh; + int is_mgmt; + + wh = mtod(m, struct ieee80211_frame *); + is_mgmt = IEEE80211_IS_MGMT(wh); + + /* + * Check to see whether MIC needs to be included. + */ + if (is_mgmt && (k->wk_flags & IEEE80211_KEY_NOMICMGT)) + return 1; + if ((! is_mgmt) && (k->wk_flags & IEEE80211_KEY_NOMIC)) + return 1; if (force || (k->wk_flags & IEEE80211_KEY_SWENMIC)) { struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); @@ -259,11 +287,20 @@ READ_6(uint8_t b0, uint8_t b1, uint8_t b static int tkip_decap(struct ieee80211_key *k, struct mbuf *m, int hdrlen) { + const struct ieee80211_rx_stats *rxs; struct tkip_ctx *ctx = k->wk_private; struct ieee80211vap *vap = ctx->tc_vap; struct ieee80211_frame *wh; uint8_t *ivp, tid; + rxs = ieee80211_get_rx_params_ptr(m); + + /* + * If IV has been stripped, we skip most of the below. + */ + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP)) + goto finish; + /* * Header should have extended IV and sequence number; * verify the former and validate the latter. @@ -318,11 +355,22 @@ tkip_decap(struct ieee80211_key *k, stru !tkip_decrypt(ctx, k, m, hdrlen)) return 0; +finish: + + /* + * Copy up 802.11 header and strip crypto bits - but only if we + * are required to. + */ + if (! ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))) { + memmove(mtod(m, uint8_t *) + tkip.ic_header, mtod(m, void *), + hdrlen); + m_adj(m, tkip.ic_header); + } + /* - * Copy up 802.11 header and strip crypto bits. + * XXX TODO: do we need an option to potentially not strip the + * WEP trailer? Does "MMIC_STRIP" also mean this? Or? */ - memmove(mtod(m, uint8_t *) + tkip.ic_header, mtod(m, void *), hdrlen); - m_adj(m, tkip.ic_header); m_adj(m, -tkip.ic_trailer); return 1; @@ -334,11 +382,33 @@ tkip_decap(struct ieee80211_key *k, stru static int tkip_demic(struct ieee80211_key *k, struct mbuf *m, int force) { + const struct ieee80211_rx_stats *rxs; struct tkip_ctx *ctx = k->wk_private; struct ieee80211_frame *wh; uint8_t tid; wh = mtod(m, struct ieee80211_frame *); + rxs = ieee80211_get_rx_params_ptr(m); + + /* + * If we are told about a MIC failure from the driver, + * directly notify as a michael failure to the upper + * layers. + */ + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_FAIL_MIC)) { + struct ieee80211vap *vap = ctx->tc_vap; + ieee80211_notify_michael_failure(vap, wh, + k->wk_rxkeyix != IEEE80211_KEYIX_NONE ? + k->wk_rxkeyix : k->wk_keyix); + return 0; + } + + /* + * If IV has been stripped, we skip most of the below. + */ + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_MMIC_STRIP)) + goto finish; + if ((k->wk_flags & IEEE80211_KEY_SWDEMIC) || force) { struct ieee80211vap *vap = ctx->tc_vap; int hdrlen = ieee80211_hdrspace(vap->iv_ic, wh); @@ -371,6 +441,7 @@ tkip_demic(struct ieee80211_key *k, stru tid = ieee80211_gettid(wh); k->wk_keyrsc[tid] = ctx->rx_rsc; +finish: return 1; } Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Sat Nov 19 01:51:56 2016 (r308822) +++ head/sys/net80211/ieee80211_hostap.c Sat Nov 19 02:00:24 2016 (r308823) @@ -479,6 +479,16 @@ hostap_input(struct ieee80211_node *ni, int hdrspace, need_tap = 1; /* mbuf need to be tapped. */ uint8_t dir, type, subtype, qos; uint8_t *bssid; + int is_hw_decrypted = 0; + int has_decrypted = 0; + + /* + * Some devices do hardware decryption all the way through + * to pretending the frame wasn't encrypted in the first place. + * So, tag it appropriately so it isn't discarded inappropriately. + */ + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_DECRYPTED)) + is_hw_decrypted = 1; if (m->m_flags & M_AMPDU_MPDU) { /* @@ -668,7 +678,7 @@ hostap_input(struct ieee80211_node *ni, * crypto cipher modules used to do delayed update * of replay sequence numbers. */ - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (is_hw_decrypted || wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { /* * Discard encrypted frames when privacy is off. @@ -679,14 +689,14 @@ hostap_input(struct ieee80211_node *ni, IEEE80211_NODE_STAT(ni, rx_noprivacy); goto out; } - key = ieee80211_crypto_decap(ni, m, hdrspace); - if (key == NULL) { + if (ieee80211_crypto_decap(ni, m, hdrspace, &key) == 0) { /* NB: stats+msgs handled in crypto_decap */ IEEE80211_NODE_STAT(ni, rx_wepfail); goto out; } wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; + has_decrypted = 1; } else { /* XXX M_WEP and IEEE80211_F_PRIVACY */ key = NULL; @@ -769,7 +779,8 @@ hostap_input(struct ieee80211_node *ni, * any non-PAE frames received without encryption. */ if ((vap->iv_flags & IEEE80211_F_DROPUNENC) && - (key == NULL && (m->m_flags & M_WEP) == 0) && + ((has_decrypted == 0) && (m->m_flags & M_WEP) == 0) && + (is_hw_decrypted == 0) && eh->ether_type != htons(ETHERTYPE_PAE)) { /* * Drop unencrypted frames. @@ -851,13 +862,13 @@ hostap_input(struct ieee80211_node *ni, goto out; } hdrspace = ieee80211_hdrspace(ic, wh); - key = ieee80211_crypto_decap(ni, m, hdrspace); - if (key == NULL) { + if (ieee80211_crypto_decap(ni, m, hdrspace, &key) == 0) { /* NB: stats+msgs handled in crypto_decap */ goto out; } wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; + has_decrypted = 1; } /* * Pass the packet to radiotap before calling iv_recv_mgmt(). Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Sat Nov 19 01:51:56 2016 (r308822) +++ head/sys/net80211/ieee80211_sta.c Sat Nov 19 02:00:24 2016 (r308823) @@ -546,6 +546,16 @@ sta_input(struct ieee80211_node *ni, str int hdrspace, need_tap = 1; /* mbuf need to be tapped. */ uint8_t dir, type, subtype, qos; uint8_t *bssid; + int is_hw_decrypted = 0; + int has_decrypted = 0; + + /* + * Some devices do hardware decryption all the way through + * to pretending the frame wasn't encrypted in the first place. + * So, tag it appropriately so it isn't discarded inappropriately. + */ + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_DECRYPTED)) + is_hw_decrypted = 1; if (m->m_flags & M_AMPDU_MPDU) { /* @@ -724,6 +734,21 @@ sta_input(struct ieee80211_node *ni, str } /* + * Handle privacy requirements for hardware decryption + * devices. + * + * For those devices, a handful of things happen. + * + * + If IV has been stripped, then we can't run + * ieee80211_crypto_decap() - none of the key + * + If MIC has been stripped, we can't validate + * MIC here. + * + If MIC fails, then we need to communicate a + * MIC failure up to the stack - but we don't know + * which key was used. + */ + + /* * Handle privacy requirements. Note that we * must not be preempted from here until after * we (potentially) call ieee80211_crypto_demic; @@ -731,7 +756,7 @@ sta_input(struct ieee80211_node *ni, str * crypto cipher modules used to do delayed update * of replay sequence numbers. */ - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (is_hw_decrypted || wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { /* * Discard encrypted frames when privacy is off. @@ -742,14 +767,14 @@ sta_input(struct ieee80211_node *ni, str IEEE80211_NODE_STAT(ni, rx_noprivacy); goto out; } - key = ieee80211_crypto_decap(ni, m, hdrspace); - if (key == NULL) { + if (ieee80211_crypto_decap(ni, m, hdrspace, &key) == 0) { /* NB: stats+msgs handled in crypto_decap */ IEEE80211_NODE_STAT(ni, rx_wepfail); goto out; } wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; + has_decrypted = 1; } else { /* XXX M_WEP and IEEE80211_F_PRIVACY */ key = NULL; @@ -779,8 +804,13 @@ sta_input(struct ieee80211_node *ni, str /* * Next strip any MSDU crypto bits. + * + * Note: we can't do MIC stripping/verification if the + * upper layer has stripped it. We have to check MIC + * ourselves. So, key may be NULL, but we have to check + * the RX status. */ - if (key != NULL && !ieee80211_crypto_demic(vap, key, m, 0)) { + if (!ieee80211_crypto_demic(vap, key, m, 0)) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, ni->ni_macaddr, "data", "%s", "demic error"); vap->iv_stats.is_rx_demicfail++; @@ -834,7 +864,8 @@ sta_input(struct ieee80211_node *ni, str * any non-PAE frames received without encryption. */ if ((vap->iv_flags & IEEE80211_F_DROPUNENC) && - (key == NULL && (m->m_flags & M_WEP) == 0) && + ((has_decrypted == 0) && (m->m_flags & M_WEP) == 0) && + (is_hw_decrypted == 0) && eh->ether_type != htons(ETHERTYPE_PAE)) { /* * Drop unencrypted frames. @@ -883,6 +914,16 @@ sta_input(struct ieee80211_node *ni, str ether_sprintf(wh->i_addr2), rssi); } #endif + + /* + * Note: See above for hardware offload privacy requirements. + * It also applies here. + */ + + /* + * Again, having encrypted flag set check would be good, but + * then we have to also handle crypto_decap() like above. + */ if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { if (subtype != IEEE80211_FC0_SUBTYPE_AUTH) { /* @@ -905,11 +946,16 @@ sta_input(struct ieee80211_node *ni, str goto out; } hdrspace = ieee80211_hdrspace(ic, wh); - key = ieee80211_crypto_decap(ni, m, hdrspace); - if (key == NULL) { + + /* + * Again, if IV/MIC was stripped, then this whole + * setup will fail. That's going to need some poking. + */ + if (ieee80211_crypto_decap(ni, m, hdrspace, &key) == 0) { /* NB: stats+msgs handled in crypto_decap */ goto out; } + has_decrypted = 1; wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; } Modified: head/sys/net80211/ieee80211_wds.c ============================================================================== --- head/sys/net80211/ieee80211_wds.c Sat Nov 19 01:51:56 2016 (r308822) +++ head/sys/net80211/ieee80211_wds.c Sat Nov 19 02:00:24 2016 (r308823) @@ -417,6 +417,16 @@ wds_input(struct ieee80211_node *ni, str struct ether_header *eh; int hdrspace, need_tap = 1; /* mbuf need to be tapped. */ uint8_t dir, type, subtype, qos; + int is_hw_decrypted = 0; + int has_decrypted = 0; + + /* + * Some devices do hardware decryption all the way through + * to pretending the frame wasn't encrypted in the first place. + * So, tag it appropriately so it isn't discarded inappropriately. + */ + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_DECRYPTED)) + is_hw_decrypted = 1; if (m->m_flags & M_AMPDU_MPDU) { /* @@ -544,7 +554,7 @@ wds_input(struct ieee80211_node *ni, str * crypto cipher modules used to do delayed update * of replay sequence numbers. */ - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (is_hw_decrypted || wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { /* * Discard encrypted frames when privacy is off. @@ -555,14 +565,14 @@ wds_input(struct ieee80211_node *ni, str IEEE80211_NODE_STAT(ni, rx_noprivacy); goto out; } - key = ieee80211_crypto_decap(ni, m, hdrspace); - if (key == NULL) { + if (ieee80211_crypto_decap(ni, m, hdrspace, &key) == 0) { /* NB: stats+msgs handled in crypto_decap */ IEEE80211_NODE_STAT(ni, rx_wepfail); goto out; } wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; + has_decrypted = 1; } else { /* XXX M_WEP and IEEE80211_F_PRIVACY */ key = NULL; @@ -593,7 +603,7 @@ wds_input(struct ieee80211_node *ni, str /* * Next strip any MSDU crypto bits. */ - if (key != NULL && !ieee80211_crypto_demic(vap, key, m, 0)) { + if (!ieee80211_crypto_demic(vap, key, m, 0)) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, ni->ni_macaddr, "data", "%s", "demic error"); vap->iv_stats.is_rx_demicfail++; @@ -647,7 +657,8 @@ wds_input(struct ieee80211_node *ni, str * any non-PAE frames received without encryption. */ if ((vap->iv_flags & IEEE80211_F_DROPUNENC) && - (key == NULL && (m->m_flags & M_WEP) == 0) && + ((has_decrypted == 0) && (m->m_flags & M_WEP) == 0) && + (is_hw_decrypted == 0) && eh->ether_type != htons(ETHERTYPE_PAE)) { /* * Drop unencrypted frames. From owner-svn-src-head@freebsd.org Sat Nov 19 05:38:09 2016 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 6151FC497DA for ; Sat, 19 Nov 2016 05:38:09 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-32.reflexion.net [208.70.210.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED94D994 for ; Sat, 19 Nov 2016 05:38:08 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 13075 invoked from network); 19 Nov 2016 05:37:46 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 19 Nov 2016 05:37:46 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v8.20.0) with SMTP; Sat, 19 Nov 2016 00:38:11 -0500 (EST) Received: (qmail 32709 invoked from network); 19 Nov 2016 05:38:11 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 19 Nov 2016 05:38:11 -0000 Received: from [192.168.1.106] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id BEAFEEC91A9; Fri, 18 Nov 2016 21:38:00 -0800 (PST) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm Message-Id: <147CB9E9-6515-486E-B0D2-1DB096C834FB@dsl-only.net> Date: Fri, 18 Nov 2016 21:37:58 -0800 To: svn-src-head@freebsd.org, alc@rice.edu X-Mailer: Apple Mail (2.3251) 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, 19 Nov 2016 05:38:09 -0000 Alan Cox alc at rice.edu wrote on Wed Nov 16 17:54:03 UTC 2016 : > This change amounted to dead code removal, so I'm not sure how it = could > have an effect. There were only a couple places where the changes = were > other than mechanical in nature. Also, that the number of cores = matters > is no less puzzling. But bugzilla 214629 reports a fix that is not checked in yet: Andriy Gapon in Comment 1 notes for = /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c = around line 430 (as listed in the description): > Now that 'else if (pp =3D=3D NULL)' block has been removed (and we no = longer fabricate a cached page), the code should look like: > ... > else if (pp !=3D NULL) { > ASSERT(!pp->valid); > pp =3D NULL; > } Alan Cox then agrees (Comment 2) --and Shawn Webb reports trying the = change fixed the issue for him (Comment 3). So once the fix is checked in and put to use this issue will likely go = away. =3D=3D=3D Mark Millard markmi at dsl-only.net From owner-svn-src-head@freebsd.org Sat Nov 19 07:28:02 2016 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 2AB50C4A3FC; Sat, 19 Nov 2016 07:28:02 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0245C1A78; Sat, 19 Nov 2016 07:28:01 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJ7S1IV029994; Sat, 19 Nov 2016 07:28:01 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJ7S05U029992; Sat, 19 Nov 2016 07:28:00 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201611190728.uAJ7S05U029992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Sat, 19 Nov 2016 07:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308825 - head/sys/dev/rtwn/rtl8812a X-SVN-Group: head 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, 19 Nov 2016 07:28:02 -0000 Author: kevlo Date: Sat Nov 19 07:28:00 2016 New Revision: 308825 URL: https://svnweb.freebsd.org/changeset/base/308825 Log: For RTL8812AU: - The Tx power (diff) values should be signed - Fix an off by one error when reading Tx power (diff) values Reviewed by: avos, adrian Differential Revision: https://reviews.freebsd.org/D8571 Modified: head/sys/dev/rtwn/rtl8812a/r12a_rom.c head/sys/dev/rtwn/rtl8812a/r12a_var.h Modified: head/sys/dev/rtwn/rtl8812a/r12a_rom.c ============================================================================== --- head/sys/dev/rtwn/rtl8812a/r12a_rom.c Sat Nov 19 02:09:58 2016 (r308824) +++ head/sys/dev/rtwn/rtl8812a/r12a_rom.c Sat Nov 19 07:28:00 2016 (r308825) @@ -65,7 +65,7 @@ r12a_parse_rom_common(struct rtwn_softc { struct r12a_softc *rs = sc->sc_priv; struct r12a_rom *rom = (struct r12a_rom *)buf; - int i, j; + int i, j, k; sc->thermal_meter = rom->thermal_meter; rs->crystalcap = RTWN_GET_ROM_VAR(rom->crystalcap, @@ -99,15 +99,15 @@ r12a_parse_rom_common(struct rtwn_softc MS(pwr_diff_2g->ht20_ofdm, HIGH_PART)); rs->bw40_tx_pwr_diff_2g[i][0] = 0; - for (j = 1; j < nitems(pwr_diff_2g->diff123); j++) { + for (j = 1, k = 0; k < nitems(pwr_diff_2g->diff123); j++, k++) { rs->cck_tx_pwr_diff_2g[i][j] = RTWN_SIGN4TO8( - MS(pwr_diff_2g->diff123[j].ofdm_cck, LOW_PART)); + MS(pwr_diff_2g->diff123[k].ofdm_cck, LOW_PART)); rs->ofdm_tx_pwr_diff_2g[i][j] = RTWN_SIGN4TO8( - MS(pwr_diff_2g->diff123[j].ofdm_cck, HIGH_PART)); + MS(pwr_diff_2g->diff123[k].ofdm_cck, HIGH_PART)); rs->bw20_tx_pwr_diff_2g[i][j] = RTWN_SIGN4TO8( - MS(pwr_diff_2g->diff123[j].ht40_ht20, LOW_PART)); + MS(pwr_diff_2g->diff123[k].ht40_ht20, LOW_PART)); rs->bw40_tx_pwr_diff_2g[i][j] = RTWN_SIGN4TO8( - MS(pwr_diff_2g->diff123[j].ht40_ht20, HIGH_PART)); + MS(pwr_diff_2g->diff123[k].ht40_ht20, HIGH_PART)); } for (j = 0; j < R12A_GROUP_5G; j++) { @@ -128,11 +128,12 @@ r12a_parse_rom_common(struct rtwn_softc rs->bw20_tx_pwr_diff_5g[i][0] = RTWN_SIGN4TO8( MS(pwr_diff_5g->ht20_ofdm, HIGH_PART)); rs->bw40_tx_pwr_diff_5g[i][0] = 0; - for (j = 1; j < nitems(pwr_diff_5g->ht40_ht20); j++) { + for (j = 1, k = 0; k < nitems(pwr_diff_5g->ht40_ht20); + j++, k++) { rs->bw20_tx_pwr_diff_5g[i][j] = RTWN_SIGN4TO8( - MS(pwr_diff_5g->ht40_ht20[j], LOW_PART)); + MS(pwr_diff_5g->ht40_ht20[k], LOW_PART)); rs->bw40_tx_pwr_diff_5g[i][j] = RTWN_SIGN4TO8( - MS(pwr_diff_5g->ht40_ht20[j], HIGH_PART)); + MS(pwr_diff_5g->ht40_ht20[k], HIGH_PART)); } for (j = 0; j < nitems(pwr_diff_5g->ht80_ht160); j++) { Modified: head/sys/dev/rtwn/rtl8812a/r12a_var.h ============================================================================== --- head/sys/dev/rtwn/rtl8812a/r12a_var.h Sat Nov 19 02:09:58 2016 (r308824) +++ head/sys/dev/rtwn/rtl8812a/r12a_var.h Sat Nov 19 07:28:00 2016 (r308825) @@ -64,16 +64,16 @@ struct r12a_softc { uint8_t ht40_tx_pwr_2g[R12A_MAX_RF_PATH][R12A_GROUP_2G]; uint8_t ht40_tx_pwr_5g[R12A_MAX_RF_PATH][R12A_GROUP_5G]; - uint8_t cck_tx_pwr_diff_2g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; - uint8_t ofdm_tx_pwr_diff_2g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; - uint8_t bw20_tx_pwr_diff_2g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; - uint8_t bw40_tx_pwr_diff_2g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; - - uint8_t ofdm_tx_pwr_diff_5g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; - uint8_t bw20_tx_pwr_diff_5g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; - uint8_t bw40_tx_pwr_diff_5g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; - uint8_t bw80_tx_pwr_diff_5g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; - uint8_t bw160_tx_pwr_diff_5g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; + int8_t cck_tx_pwr_diff_2g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; + int8_t ofdm_tx_pwr_diff_2g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; + int8_t bw20_tx_pwr_diff_2g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; + int8_t bw40_tx_pwr_diff_2g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; + + int8_t ofdm_tx_pwr_diff_5g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; + int8_t bw20_tx_pwr_diff_5g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; + int8_t bw40_tx_pwr_diff_5g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; + int8_t bw80_tx_pwr_diff_5g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; + int8_t bw160_tx_pwr_diff_5g[R12A_MAX_RF_PATH][R12A_MAX_TX_COUNT]; int sc_ant; From owner-svn-src-head@freebsd.org Sat Nov 19 08:12:58 2016 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 CB893C4A738; Sat, 19 Nov 2016 08:12:58 +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 97481128A; Sat, 19 Nov 2016 08:12:58 +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 uAJ8CvMo049656; Sat, 19 Nov 2016 08:12:57 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJ8Cv2C049655; Sat, 19 Nov 2016 08:12:57 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611190812.uAJ8Cv2C049655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 19 Nov 2016 08:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308826 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head 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, 19 Nov 2016 08:12:58 -0000 Author: avg Date: Sat Nov 19 08:12:57 2016 New Revision: 308826 URL: https://svnweb.freebsd.org/changeset/base/308826 Log: zfs: fix up after the removal of PG_CACHED pages in r308691 PR: 214629 Reported by: mshirk@daemon-security.com Reviewed by: alc Tested by: Shawn Webb X-MFC with: 308691 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c 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 Sat Nov 19 07:28:00 2016 (r308825) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Nov 19 08:12:57 2016 (r308826) @@ -426,8 +426,8 @@ page_busy(vnode_t *vp, int64_t start, in continue; } vm_page_sbusy(pp); - } else { - ASSERT(pp != NULL && !pp->valid); + } else if (pp != NULL) { + ASSERT(!pp->valid); pp = NULL; } From owner-svn-src-head@freebsd.org Sat Nov 19 08:54:24 2016 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 7EFB5C47737; Sat, 19 Nov 2016 08:54:24 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59478A41; Sat, 19 Nov 2016 08:54:24 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJ8sNtI065386; Sat, 19 Nov 2016 08:54:23 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJ8sLuG065368; Sat, 19 Nov 2016 08:54:21 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201611190854.uAJ8sLuG065368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 19 Nov 2016 08:54:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308827 - in head/sys/boot: common efi/libefi i386/libfirewire i386/libi386 mips/beri/loader pc98/libpc98 uboot/lib usb/storage userboot/userboot zfs X-SVN-Group: head 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, 19 Nov 2016 08:54:24 -0000 Author: tsoome Date: Sat Nov 19 08:54:21 2016 New Revision: 308827 URL: https://svnweb.freebsd.org/changeset/base/308827 Log: lsdev device name section headers should be printed by dv_print callback. lsdev command does walk over devsw list, prints list element name and will use dv_print() callback to print the device list. Unfortunately this approach will add unneeded noise when there are no particular devices detected. To remove "empty" device section headers, the dv_print() callback should print the header instead. In addition, fixed dv_print callback for md module. Reviewed by: imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D8551 Modified: head/sys/boot/common/commands.c head/sys/boot/common/dev_net.c head/sys/boot/common/md.c head/sys/boot/efi/libefi/efinet.c head/sys/boot/efi/libefi/efipart.c head/sys/boot/i386/libfirewire/firewire.c head/sys/boot/i386/libi386/bioscd.c head/sys/boot/i386/libi386/biosdisk.c head/sys/boot/i386/libi386/pxe.c head/sys/boot/mips/beri/loader/beri_disk_cfi.c head/sys/boot/mips/beri/loader/beri_disk_sdcard.c head/sys/boot/pc98/libpc98/bioscd.c head/sys/boot/pc98/libpc98/biosdisk.c head/sys/boot/uboot/lib/disk.c head/sys/boot/usb/storage/umass_loader.c head/sys/boot/userboot/userboot/host.c head/sys/boot/userboot/userboot/userboot_disk.c head/sys/boot/zfs/zfs.c Modified: head/sys/boot/common/commands.c ============================================================================== --- head/sys/boot/common/commands.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/common/commands.c Sat Nov 19 08:54:21 2016 (r308827) @@ -497,10 +497,8 @@ command_lsdev(int argc, char *argv[]) pager_open(); for (i = 0; devsw[i] != NULL; i++) { if (devsw[i]->dv_print != NULL){ - sprintf(line, "%s devices:\n", devsw[i]->dv_name); - if (pager_output(line)) - break; - devsw[i]->dv_print(verbose); + if (devsw[i]->dv_print(verbose)) + break; } else { sprintf(line, "%s: (unknown)\n", devsw[i]->dv_name); if (pager_output(line)) Modified: head/sys/boot/common/dev_net.c ============================================================================== --- head/sys/boot/common/dev_net.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/common/dev_net.c Sat Nov 19 08:54:21 2016 (r308827) @@ -332,11 +332,18 @@ net_print(int verbose) int i, d, cnt; int ret = 0; + if (netif_drivers[0] == NULL) + return (ret); + + printf("%s devices:", netdev.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + cnt = 0; for (d = 0; netif_drivers[d]; d++) { drv = netif_drivers[d]; for (i = 0; i < drv->netif_nifs; i++) { - printf("\t%s%d:", "net", cnt++); + printf("\t%s%d:", netdev.dv_name, cnt++); if (verbose) { printf(" (%s%d)", drv->netif_bname, drv->netif_ifs[i].dif_unit); Modified: head/sys/boot/common/md.c ============================================================================== --- head/sys/boot/common/md.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/common/md.c Sat Nov 19 08:54:21 2016 (r308827) @@ -63,7 +63,7 @@ static int md_init(void); static int md_strategy(void *, int, daddr_t, size_t, size_t, char *, size_t *); static int md_open(struct open_file *, ...); static int md_close(struct open_file *); -static void md_print(int); +static int md_print(int); struct devsw md_dev = { "md", @@ -143,9 +143,14 @@ md_close(struct open_file *f) return ((dev->d_unit != 0) ? ENXIO : 0); } -static void +static int md_print(int verbose) { - printf("MD (%u bytes)\n", MD_IMAGE_SIZE); + printf("%s devices:", md_dev.dv_name); + if (pager_output("\n") != 0) + return (1); + + printf("MD (%u bytes)", MD_IMAGE_SIZE); + return (pager_output("\n")); } Modified: head/sys/boot/efi/libefi/efinet.c ============================================================================== --- head/sys/boot/efi/libefi/efinet.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/efi/libefi/efinet.c Sat Nov 19 08:54:21 2016 (r308827) @@ -353,6 +353,10 @@ efinet_dev_print(int verbose) EFI_HANDLE h; int unit, ret = 0; + printf("%s devices:", efinet_dev.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (unit = 0, h = efi_find_handle(&efinet_dev, 0); h != NULL; h = efi_find_handle(&efinet_dev, ++unit)) { printf(" %s%d:", efinet_dev.dv_name, unit); Modified: head/sys/boot/efi/libefi/efipart.c ============================================================================== --- head/sys/boot/efi/libefi/efipart.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/efi/libefi/efipart.c Sat Nov 19 08:54:21 2016 (r308827) @@ -172,6 +172,10 @@ efipart_print(int verbose) u_int unit; int ret = 0; + printf("%s devices:", efipart_dev.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (unit = 0, h = efi_find_handle(&efipart_dev, 0); h != NULL; h = efi_find_handle(&efipart_dev, ++unit)) { snprintf(line, sizeof(line), " %s%d:", Modified: head/sys/boot/i386/libfirewire/firewire.c ============================================================================== --- head/sys/boot/i386/libfirewire/firewire.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/i386/libfirewire/firewire.c Sat Nov 19 08:54:21 2016 (r308827) @@ -155,6 +155,10 @@ fw_print(int verbose) int i, ret = 0; struct fwohci_softc *sc; + printf("%s devices:", fwohci.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < MAX_OHCI; i ++) { sc = &fwinfo[i]; if (sc->state == FWOHCI_STATE_DEAD) Modified: head/sys/boot/i386/libi386/bioscd.c ============================================================================== --- head/sys/boot/i386/libi386/bioscd.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/i386/libi386/bioscd.c Sat Nov 19 08:54:21 2016 (r308827) @@ -183,6 +183,13 @@ bc_print(int verbose) char line[80]; int i, ret = 0; + if (nbcinfo == 0) + return (0); + + printf("%s devices:", bioscd.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < nbcinfo; i++) { snprintf(line, sizeof(line), " cd%d: Device 0x%x\n", i, bcinfo[i].bc_sp.sp_devicespec); Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/i386/libi386/biosdisk.c Sat Nov 19 08:54:21 2016 (r308827) @@ -328,6 +328,13 @@ bd_print(int verbose) struct disk_devdesc dev; int i, ret = 0; + if (nbdinfo == 0) + return (0); + + printf("%s devices:", biosdisk.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < nbdinfo; i++) { snprintf(line, sizeof(line), " disk%d: BIOS drive %c (%ju X %u):\n", i, Modified: head/sys/boot/i386/libi386/pxe.c ============================================================================== --- head/sys/boot/i386/libi386/pxe.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/i386/libi386/pxe.c Sat Nov 19 08:54:21 2016 (r308827) @@ -389,6 +389,9 @@ pxe_print(int verbose) if (pxe_call == NULL) return (0); + printf("%s devices:", pxedisk.dv_name); + if (pager_output("\n") != 0) + return (1); if (verbose) { snprintf(line, sizeof(line), " pxe0: %s:%s\n", inet_ntoa(rootip), rootpath); Modified: head/sys/boot/mips/beri/loader/beri_disk_cfi.c ============================================================================== --- head/sys/boot/mips/beri/loader/beri_disk_cfi.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/mips/beri/loader/beri_disk_cfi.c Sat Nov 19 08:54:21 2016 (r308827) @@ -119,6 +119,10 @@ beri_cfi_disk_print(int verbose) char line[80]; int ret; + printf("%s devices:", beri_cfi_disk.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + snprintf(line, sizeof(line), " cfi%d CFI flash device\n", 0); ret = pager_output(line); if (ret != 0) Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c ============================================================================== --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Sat Nov 19 08:54:21 2016 (r308827) @@ -125,6 +125,10 @@ beri_sdcard_disk_print(int verbose) char line[80]; int ret; + printf("%s devices:", beri_sdcard_disk.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + snprintf(line, sizeof(line), " sdcard%d Altera SD card drive\n", 0); ret = pager_output(line); if (ret != 0) Modified: head/sys/boot/pc98/libpc98/bioscd.c ============================================================================== --- head/sys/boot/pc98/libpc98/bioscd.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/pc98/libpc98/bioscd.c Sat Nov 19 08:54:21 2016 (r308827) @@ -179,6 +179,13 @@ bc_print(int verbose) char line[80]; int i, ret = 0; + if (nbcinfo == 0) + return (0); + + printf("%s devices:", bioscd.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < nbcinfo; i++) { sprintf(line, " cd%d: Device 0x%x\n", i, bcinfo[i].bc_sp.sp_devicespec); Modified: head/sys/boot/pc98/libpc98/biosdisk.c ============================================================================== --- head/sys/boot/pc98/libpc98/biosdisk.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/pc98/libpc98/biosdisk.c Sat Nov 19 08:54:21 2016 (r308827) @@ -258,6 +258,13 @@ bd_print(int verbose) struct open_disk *od; struct pc98_partition *dptr; + if (nbdinfo == 0) + return (0); + + printf("%s devices:", biosdisk.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < nbdinfo; i++) { snprintf(line, sizeof(line), " disk%d: BIOS drive %c:\n", i, 'A' + i); Modified: head/sys/boot/uboot/lib/disk.c ============================================================================== --- head/sys/boot/uboot/lib/disk.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/uboot/lib/disk.c Sat Nov 19 08:54:21 2016 (r308827) @@ -245,6 +245,13 @@ stor_print(int verbose) static char line[80]; int i, ret = 0; + if (stor_info_no == 0) + return (ret); + + printf("%s devices:", uboot_storage.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < stor_info_no; i++) { dev.d_dev = &uboot_storage; dev.d_unit = i; Modified: head/sys/boot/usb/storage/umass_loader.c ============================================================================== --- head/sys/boot/usb/storage/umass_loader.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/usb/storage/umass_loader.c Sat Nov 19 08:54:21 2016 (r308827) @@ -175,6 +175,10 @@ umass_disk_print(int verbose) { struct disk_devdesc dev; + printf("%s devices:", umass_disk.dv_name); + if (pager_output("\n") != 0) + return (1); + memset(&dev, 0, sizeof(dev)); ret = pager_output(" umass0 UMASS device\n"); Modified: head/sys/boot/userboot/userboot/host.c ============================================================================== --- head/sys/boot/userboot/userboot/host.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/userboot/userboot/host.c Sat Nov 19 08:54:21 2016 (r308827) @@ -139,6 +139,10 @@ host_dev_print(int verbose) { char line[80]; + printf("%s devices:", host_dev.dv_name); + if (pager_output("\n") != 0) + return (1); + snprintf(line, sizeof(line), " host%d: Host filesystem\n", 0); return (pager_output(line)); } Modified: head/sys/boot/userboot/userboot/userboot_disk.c ============================================================================== --- head/sys/boot/userboot/userboot/userboot_disk.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/userboot/userboot/userboot_disk.c Sat Nov 19 08:54:21 2016 (r308827) @@ -123,6 +123,13 @@ userdisk_print(int verbose) char line[80]; int i, ret = 0; + if (userdisk_maxunit == 0) + return (0); + + printf("%s devices:", userboot_disk.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + for (i = 0; i < userdisk_maxunit; i++) { snprintf(line, sizeof(line), " disk%d: Guest drive image\n", i); Modified: head/sys/boot/zfs/zfs.c ============================================================================== --- head/sys/boot/zfs/zfs.c Sat Nov 19 08:12:57 2016 (r308826) +++ head/sys/boot/zfs/zfs.c Sat Nov 19 08:54:21 2016 (r308827) @@ -521,6 +521,13 @@ zfs_dev_print(int verbose) char line[80]; int ret = 0; + if (STAILQ_EMPTY(&zfs_pools)) + return (0); + + printf("%s devices:", zfs_dev.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + if (verbose) { return (spa_all_status()); } From owner-svn-src-head@freebsd.org Sat Nov 19 10:49:47 2016 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 32CF9C4A521; Sat, 19 Nov 2016 10:49:47 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id EF00715AD; Sat, 19 Nov 2016 10:49:46 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (97e759e5.skybroadband.com [151.231.89.229]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id 8B45FD8506; Sat, 19 Nov 2016 10:48:47 +0000 (UTC) Date: Sat, 19 Nov 2016 10:49:37 +0000 From: Andrew Turner To: Olivier Houchard Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308819 - in head/sys/arm: conf ti/omap4 ti/omap4/pandaboard ti/usb Message-ID: <20161119104937.5e1abea8@zapp> In-Reply-To: <201611190055.uAJ0tkN8075550@repo.freebsd.org> References: <201611190055.uAJ0tkN8075550@repo.freebsd.org> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; 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: Sat, 19 Nov 2016 10:49:47 -0000 On Sat, 19 Nov 2016 00:55:46 +0000 (UTC) Olivier Houchard wrote: ... > @@ -265,6 +269,16 @@ omap_ehci_probe(device_t dev) > if (!ofw_bus_is_compatible(dev, "ti,ehci-omap")) > return (ENXIO); > > +#ifdef SOC_OMAP4 > + /* > + * If we're running a Pandaboard, run Pandaboard-specific > + * init code. > + */ > + root = OF_finddevice("/"); > + if (fdt_is_compatible(root, "ti,omap4-panda")) > + pandaboard_usb_hub_init(); > +#endif Shouldn't this be in the attach function? It should also use ofw_bus_node_is_compatible as I'm about to remove fdt_is_compatible. Andrew From owner-svn-src-head@freebsd.org Sat Nov 19 11:19:20 2016 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 37446C4AF05; Sat, 19 Nov 2016 11:19:20 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0096.outbound.protection.outlook.com [104.47.34.96]) (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 E98463B6; Sat, 19 Nov 2016 11:19:19 +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=G7psVf+9eYFhMIl7NHne+2liWWlLhb3maNaRmCrTuZ4=; b=o3YhsJtNuBwdemNFKRxO0YHWDjiEhvvfnB9IR2Q4BusPP03lr5zqbmDkKCK037KUO2piE4352AAalmRlVj6ssvdeIMHrsqGv1gjlSc9eIW8DitqcsPrRLYiT0/sfMEID1++exTEwLo1GETnnUBnNjxQpwAD2SuIip93MZFRuvI8= Received: from MWHPR03MB2669.namprd03.prod.outlook.com (10.168.207.15) by MWHPR03MB2672.namprd03.prod.outlook.com (10.168.207.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8; Sat, 19 Nov 2016 04:45:34 +0000 Received: from MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) by MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) with mapi id 15.01.0734.007; Sat, 19 Nov 2016 04:45:34 +0000 From: Dexuan Cui To: John Baldwin , Ngie Cooper CC: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: RE: svn commit: r308798 - head/share/man/man4 Thread-Topic: svn commit: r308798 - head/share/man/man4 Thread-Index: AQHSQbr5yyVEkQQ01UWDUKGoAysOOqDfuXSQ Date: Sat, 19 Nov 2016 04:45:33 +0000 Message-ID: References: <201611180736.uAI7a0GI063125@repo.freebsd.org> <4062212.DYY6ahumff@ralph.baldwin.cx> In-Reply-To: <4062212.DYY6ahumff@ralph.baldwin.cx> 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=decui@microsoft.com; x-originating-ip: [139.226.141.81] x-microsoft-exchange-diagnostics: 1; MWHPR03MB2672; 7:9hGjwVh+5cOYe3HhG6gRg75AVZ6web+wj/6ktYg9dyLuXOeJ0i+mAnWsj+t4exoKQhlrAVKpd7zVFo/3PN9P1oeV/c+8xI0WyR/f7fdlD9wmgKeLdE5pgkyVN5neNgAFFTYricem2c+D/bzNB+NOQ0s7k4Pz+1DfB3SHO2YcGKY93+rTld/w89ZVgWogitPszV6/rcrsT+zgJDNUqRqIHXtHfHhKX9iR8pD2d1OfzrlNKlp2ewhYr+ImWfPomiNBEPh2hD804vQD/UWf9xkNXUD0iqHWWG9d4w4FKeoDgqLvNc7P+mjBIarwxT4yXC4bIXRLSlwsaAFAAqoKoqGDyPquj2/s35vzhvjq3OIx7PiEX23gE7wOaKYQK9io4SNd x-ms-office365-filtering-correlation-id: 9fb8499d-913a-45fc-da2e-08d41036e60f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2672; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6040307)(6060326)(6045199)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041248)(6046074)(6061324)(6047074)(6072148); SRVR:MWHPR03MB2672; BCL:0; PCL:0; RULEID:; SRVR:MWHPR03MB2672; x-forefront-prvs: 0131D22242 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(199003)(189002)(51914003)(377454003)(24454002)(33656002)(66066001)(5001770100001)(97736004)(189998001)(7846002)(8676002)(68736007)(6116002)(229853002)(6506003)(8936002)(305945005)(74316002)(102836003)(81156014)(9686002)(3846002)(7736002)(81166006)(7696004)(105586002)(87936001)(122556002)(106356001)(106116001)(3280700002)(92566002)(3660700001)(77096005)(86612001)(2906002)(99286002)(76176999)(10290500002)(8990500004)(4326007)(50986999)(101416001)(5005710100001)(54356999)(2950100002)(5660300001)(86362001)(76576001)(2900100001)(10090500001)(38730400001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR03MB2672; H:MWHPR03MB2669.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Nov 2016 04:45:33.9609 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2672 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, 19 Nov 2016 11:19:20 -0000 > From: John Baldwin [mailto:jhb@freebsd.org] > Sent: Saturday, November 19, 2016 00:44 > To: Dexuan Cui > Cc: src-committers@freebsd.org; svn-src-all@freebsd.org; svn-src- > head@freebsd.org > Subject: Re: svn commit: r308798 - head/share/man/man4 >=20 > On Friday, November 18, 2016 07:36:00 AM Dexuan Cui wrote: > > Author: dexuan > > Date: Fri Nov 18 07:36:00 2016 > > New Revision: 308798 > > Log: > > remove the hv_ata_pci_disengage(4) manual > > > > A few months ago, we removed the driver, which was not necessary any > longer. >=20 > You will also want to add an entry in head/ObsoleteFiles.inc so that the = installed > manpage on existing systems gets deleted via 'make delete-old'. >=20 > John Baldwin Hi John, Thanks for the reminder! Ngie also pointed this out to me. It turns out I'm too new to the build system. :-) It would be great if you can help to add a patch for this, as I won't be ab= le to make and test such a patch until next Monday. Sorry. Or I can do it next Monday. I'm OK either way. Thanks, -- Dexuan From owner-svn-src-head@freebsd.org Sat Nov 19 13:11:05 2016 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 1E0BAC4A5DF; Sat, 19 Nov 2016 13:11:05 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEB4B877; Sat, 19 Nov 2016 13:11:04 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJDB3ck065598; Sat, 19 Nov 2016 13:11:03 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJDB3h9065597; Sat, 19 Nov 2016 13:11:03 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201611191311.uAJDB3h9065597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sat, 19 Nov 2016 13:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308828 - head/sys/arm/ti/usb X-SVN-Group: head 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, 19 Nov 2016 13:11:05 -0000 Author: cognet Date: Sat Nov 19 13:11:03 2016 New Revision: 308828 URL: https://svnweb.freebsd.org/changeset/base/308828 Log: Move the pandaboard initialization from the probe to the attach method. Use ofw_bus_node_is_compatible instead of fdt_is_compatible, as the later is deprecated. Suggested by: andrew Modified: head/sys/arm/ti/usb/omap_ehci.c Modified: head/sys/arm/ti/usb/omap_ehci.c ============================================================================== --- head/sys/arm/ti/usb/omap_ehci.c Sat Nov 19 08:54:21 2016 (r308827) +++ head/sys/arm/ti/usb/omap_ehci.c Sat Nov 19 13:11:03 2016 (r308828) @@ -261,24 +261,12 @@ omap_ehci_init(struct omap_ehci_softc *i static int omap_ehci_probe(device_t dev) { - phandle_t root; - if (!ofw_bus_status_okay(dev)) return (ENXIO); if (!ofw_bus_is_compatible(dev, "ti,ehci-omap")) return (ENXIO); -#ifdef SOC_OMAP4 - /* - * If we're running a Pandaboard, run Pandaboard-specific - * init code. - */ - root = OF_finddevice("/"); - if (fdt_is_compatible(root, "ti,omap4-panda")) - pandaboard_usb_hub_init(); -#endif - device_set_desc(dev, OMAP_EHCI_HC_DEVSTR); return (BUS_PROBE_DEFAULT); @@ -303,9 +291,22 @@ omap_ehci_attach(device_t dev) { struct omap_ehci_softc *isc = device_get_softc(dev); ehci_softc_t *sc = &isc->base; +#ifdef SOC_OMAP4 + phandle_t root; +#endif int err; int rid; +#ifdef SOC_OMAP4 + /* + * If we're running a Pandaboard, run Pandaboard-specific + * init code. + */ + root = OF_finddevice("/"); + if (ofw_bus_node_is_compatible(root, "ti,omap4-panda")) + pandaboard_usb_hub_init(); +#endif + /* initialise some bus fields */ sc->sc_bus.parent = dev; sc->sc_bus.devices = sc->sc_devices; From owner-svn-src-head@freebsd.org Sat Nov 19 13:57:22 2016 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 90378C485CF; Sat, 19 Nov 2016 13:57:22 +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 552E61D8; Sat, 19 Nov 2016 13:57:22 +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 uAJDvL3A084989; Sat, 19 Nov 2016 13:57:21 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJDvLBP084988; Sat, 19 Nov 2016 13:57:21 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611191357.uAJDvLBP084988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 19 Nov 2016 13:57:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308830 - head/sys/dev/fdt X-SVN-Group: head 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, 19 Nov 2016 13:57:22 -0000 Author: andrew Date: Sat Nov 19 13:57:21 2016 New Revision: 308830 URL: https://svnweb.freebsd.org/changeset/base/308830 Log: Make fdt_is_compatible a static function. It's only used in fdt_common.c. Sponsored by: ABT Systems Ltd Modified: head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdt_common.h Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Sat Nov 19 13:32:01 2016 (r308829) +++ head/sys/dev/fdt/fdt_common.c Sat Nov 19 13:57:21 2016 (r308830) @@ -69,6 +69,8 @@ vm_offset_t fdt_immr_size; struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head); +static int fdt_is_compatible(phandle_t, const char *); + static int fdt_get_range_by_busaddr(phandle_t node, u_long addr, u_long *base, u_long *size) @@ -242,7 +244,7 @@ moveon: * Note the buffer has to be on the stack since malloc() is usually not * available in such cases either. */ -int +static int fdt_is_compatible(phandle_t node, const char *compatstr) { char buf[FDT_COMPAT_LEN]; Modified: head/sys/dev/fdt/fdt_common.h ============================================================================== --- head/sys/dev/fdt/fdt_common.h Sat Nov 19 13:32:01 2016 (r308829) +++ head/sys/dev/fdt/fdt_common.h Sat Nov 19 13:57:21 2016 (r308830) @@ -94,7 +94,6 @@ int fdt_get_phyaddr(phandle_t, device_t, int fdt_get_range(phandle_t, int, u_long *, u_long *); int fdt_immr_addr(vm_offset_t); int fdt_regsize(phandle_t, u_long *, u_long *); -int fdt_is_compatible(phandle_t, const char *); int fdt_is_compatible_strict(phandle_t, const char *); int fdt_is_enabled(phandle_t); int fdt_pm_is_enabled(phandle_t); From owner-svn-src-head@freebsd.org Sat Nov 19 14:45:10 2016 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 79B82C4A4D1; Sat, 19 Nov 2016 14:45:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A31E1D99; Sat, 19 Nov 2016 14:45:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJEj9ot006071; Sat, 19 Nov 2016 14:45:09 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJEj95P006067; Sat, 19 Nov 2016 14:45:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201611191445.uAJEj95P006067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 19 Nov 2016 14:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308832 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head 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, 19 Nov 2016 14:45:10 -0000 Author: tuexen Date: Sat Nov 19 14:45:08 2016 New Revision: 308832 URL: https://svnweb.freebsd.org/changeset/base/308832 Log: Ensure that TCP state changes to state-closing are reported via dtrace. This does not cover state changes from TIME-WAIT. Reviewed by: gnn MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D8443 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/fastpath.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sat Nov 19 14:40:18 2016 (r308831) +++ head/sys/netinet/tcp_input.c Sat Nov 19 14:45:08 2016 (r308832) @@ -2206,7 +2206,6 @@ tcp_do_segment(struct mbuf *m, struct tc case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: - tcp_state_change(tp, TCPS_CLOSED); /* FALLTHROUGH */ default: tp = tcp_close(tp); Modified: head/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- head/sys/netinet/tcp_stacks/fastpath.c Sat Nov 19 14:40:18 2016 (r308831) +++ head/sys/netinet/tcp_stacks/fastpath.c Sat Nov 19 14:45:08 2016 (r308832) @@ -750,7 +750,6 @@ tcp_do_slowpath(struct mbuf *m, struct t case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: - tcp_state_change(tp, TCPS_CLOSED); /* FALLTHROUGH */ default: tp = tcp_close(tp); Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sat Nov 19 14:40:18 2016 (r308831) +++ head/sys/netinet/tcp_subr.c Sat Nov 19 14:45:08 2016 (r308832) @@ -1502,6 +1502,7 @@ tcp_discardcb(struct tcpcb *tp) inp->inp_ppcb = NULL; if (tp->t_timers->tt_draincnt == 0) { /* We own the last reference on tcpcb, let's free it. */ + TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp, 1); refcount_release(&tp->t_fb->tfb_refcnt); @@ -1531,6 +1532,7 @@ tcp_timer_discard(void *ptp) tp->t_timers->tt_draincnt--; if (tp->t_timers->tt_draincnt == 0) { /* We own the last reference on this tcpcb, let's free it. */ + TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp, 1); refcount_release(&tp->t_fb->tfb_refcnt); @@ -1577,7 +1579,8 @@ tcp_close(struct tcpcb *tp) #endif in_pcbdrop(inp); TCPSTAT_INC(tcps_closed); - TCPSTATES_DEC(tp->t_state); + if (tp->t_state != TCPS_CLOSED) + tcp_state_change(tp, TCPS_CLOSED); KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL")); so = inp->inp_socket; soisdisconnected(so); Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Sat Nov 19 14:40:18 2016 (r308831) +++ head/sys/netinet/tcp_timewait.c Sat Nov 19 14:45:08 2016 (r308832) @@ -340,6 +340,7 @@ tcp_twstart(struct tcpcb *tp) tcp_twrespond(tw, TH_ACK); inp->inp_ppcb = tw; inp->inp_flags |= INP_TIMEWAIT; + TCPSTATES_INC(TCPS_TIME_WAIT); tcp_tw_2msl_reset(tw, 0); /* From owner-svn-src-head@freebsd.org Sat Nov 19 14:56:23 2016 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 B8B3DC4A771; Sat, 19 Nov 2016 14:56:23 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BB6E5FB; Sat, 19 Nov 2016 14:56:23 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJEuMih010025; Sat, 19 Nov 2016 14:56:22 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJEuM4c010024; Sat, 19 Nov 2016 14:56:22 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201611191456.uAJEuM4c010024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sat, 19 Nov 2016 14:56:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308833 - head/sys/arm/allwinner X-SVN-Group: head 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, 19 Nov 2016 14:56:23 -0000 Author: jmcneill Date: Sat Nov 19 14:56:22 2016 New Revision: 308833 URL: https://svnweb.freebsd.org/changeset/base/308833 Log: On H3, initialize alarm and shutdown trip points and do temperature conversion as it is done in the BSP. Modified: head/sys/arm/allwinner/aw_thermal.c Modified: head/sys/arm/allwinner/aw_thermal.c ============================================================================== --- head/sys/arm/allwinner/aw_thermal.c Sat Nov 19 14:45:08 2016 (r308832) +++ head/sys/arm/allwinner/aw_thermal.c Sat Nov 19 14:56:22 2016 (r308833) @@ -109,10 +109,13 @@ __FBSDID("$FreeBSD$"); #define H3_ADC_ACQUIRE_TIME 0x3f #define H3_FILTER 0x6 #define H3_INTC 0x191000 -#define H3_TEMP_BASE 1794000 +#define H3_TEMP_BASE 217 #define H3_TEMP_MUL 1000 -#define H3_TEMP_DIV -8253 +#define H3_TEMP_DIV 8253 +#define H3_TEMP_MINUS 1794000 #define H3_CLK_RATE 4000000 +#define H3_INIT_ALARM 90 /* degC */ +#define H3_INIT_SHUT 105 /* degC */ #define TEMP_C_TO_K 273 #define SENSOR_ENABLE_ALL (SENSOR0_EN|SENSOR1_EN|SENSOR2_EN) @@ -131,6 +134,8 @@ TUNABLE_INT("hw.aw_thermal.throttle_enab struct aw_thermal_sensor { const char *name; const char *desc; + int init_alarm; + int init_shut; }; struct aw_thermal_config { @@ -142,6 +147,7 @@ struct aw_thermal_config { uint32_t filter; uint32_t intc; int (*to_temp)(uint32_t); + uint32_t (*to_reg)(int); int temp_base; int temp_mul; int temp_div; @@ -177,9 +183,7 @@ static const struct aw_thermal_config a8 .filter = A83T_FILTER, .intc = A83T_INTC, .to_temp = a83t_to_temp, - .calib0 = 1, .calib0_mask = 0xffffffff, - .calib1 = 1, .calib1_mask = 0xffffffff, }; @@ -215,7 +219,13 @@ static const struct aw_thermal_config a6 static int h3_to_temp(uint32_t val) { - return (((int)(val * H3_TEMP_MUL) - H3_TEMP_BASE) / H3_TEMP_DIV); + return (H3_TEMP_BASE - ((val * H3_TEMP_MUL) / H3_TEMP_DIV)); +} + +static uint32_t +h3_to_reg(int val) +{ + return ((H3_TEMP_MINUS - (val * H3_TEMP_DIV)) / H3_TEMP_MUL); } static const struct aw_thermal_config h3_config = { @@ -224,6 +234,8 @@ static const struct aw_thermal_config h3 [0] = { .name = "cpu", .desc = "CPU temperature", + .init_alarm = H3_INIT_ALARM, + .init_shut = H3_INIT_SHUT, }, }, .clk_rate = H3_CLK_RATE, @@ -231,7 +243,7 @@ static const struct aw_thermal_config h3 .filter = H3_FILTER, .intc = H3_INTC, .to_temp = h3_to_temp, - .calib0 = 1, + .to_reg = h3_to_reg, .calib0_mask = 0xfff, }; @@ -272,7 +284,7 @@ aw_thermal_init(struct aw_thermal_softc uint32_t calib0, calib1; int error; - if (sc->conf->calib0 != 0 || sc->conf->calib1 != 0) { + if (sc->conf->calib0_mask != 0 || sc->conf->calib1_mask != 0) { /* Read calibration settings from SRAM */ error = aw_sid_read_tscalib(&calib0, &calib1); if (error != 0) @@ -282,9 +294,9 @@ aw_thermal_init(struct aw_thermal_softc calib1 &= sc->conf->calib1_mask; /* Write calibration settings to thermal controller */ - if (sc->conf->calib0 != 0 && calib0 != 0) + if (calib0 != 0) WR4(sc, THS_CALIB0, calib0); - if (sc->conf->calib1 != 0 && calib1 != 0) + if (calib1 != 0) WR4(sc, THS_CALIB1, calib1); } @@ -313,7 +325,7 @@ aw_thermal_gettemp(struct aw_thermal_sof val = RD4(sc, THS_DATA0 + (sensor * 4)); - return (sc->conf->to_temp(val) + TEMP_C_TO_K); + return (sc->conf->to_temp(val)); } static int @@ -324,7 +336,18 @@ aw_thermal_getshut(struct aw_thermal_sof val = RD4(sc, THS_SHUTDOWN0_CTRL + (sensor * 4)); val = (val >> SHUT_T_HOT_SHIFT) & SHUT_T_HOT_MASK; - return (sc->conf->to_temp(val) + TEMP_C_TO_K); + return (sc->conf->to_temp(val)); +} + +static void +aw_thermal_setshut(struct aw_thermal_softc *sc, int sensor, int temp) +{ + uint32_t val; + + val = RD4(sc, THS_SHUTDOWN0_CTRL + (sensor * 4)); + val &= ~(SHUT_T_HOT_MASK << SHUT_T_HOT_SHIFT); + val |= (sc->conf->to_reg(temp) << SHUT_T_HOT_SHIFT); + WR4(sc, THS_SHUTDOWN0_CTRL + (sensor * 4), val); } static int @@ -335,7 +358,7 @@ aw_thermal_gethyst(struct aw_thermal_sof val = RD4(sc, THS_ALARM0_CTRL + (sensor * 4)); val = (val >> ALARM_T_HYST_SHIFT) & ALARM_T_HYST_MASK; - return (sc->conf->to_temp(val) + TEMP_C_TO_K); + return (sc->conf->to_temp(val)); } static int @@ -346,7 +369,18 @@ aw_thermal_getalarm(struct aw_thermal_so val = RD4(sc, THS_ALARM0_CTRL + (sensor * 4)); val = (val >> ALARM_T_HOT_SHIFT) & ALARM_T_HOT_MASK; - return (sc->conf->to_temp(val) + TEMP_C_TO_K); + return (sc->conf->to_temp(val)); +} + +static void +aw_thermal_setalarm(struct aw_thermal_softc *sc, int sensor, int temp) +{ + uint32_t val; + + val = RD4(sc, THS_ALARM0_CTRL + (sensor * 4)); + val &= ~(ALARM_T_HOT_MASK << ALARM_T_HOT_SHIFT); + val |= (sc->conf->to_reg(temp) << ALARM_T_HOT_SHIFT); + WR4(sc, THS_ALARM0_CTRL + (sensor * 4), val); } static int @@ -358,7 +392,7 @@ aw_thermal_sysctl(SYSCTL_HANDLER_ARGS) sc = arg1; sensor = arg2; - val = aw_thermal_gettemp(sc, sensor); + val = aw_thermal_gettemp(sc, sensor) + TEMP_C_TO_K; return sysctl_handle_opaque(oidp, &val, sizeof(val), req); } @@ -514,6 +548,15 @@ aw_thermal_attach(device_t dev) goto fail; } + for (i = 0; i < sc->conf->nsensors; i++) { + if (sc->conf->sensors[i].init_alarm > 0) + aw_thermal_setalarm(sc, i, + sc->conf->sensors[i].init_alarm); + if (sc->conf->sensors[i].init_shut > 0) + aw_thermal_setshut(sc, i, + sc->conf->sensors[i].init_shut); + } + if (aw_thermal_init(sc) != 0) goto fail; @@ -529,9 +572,9 @@ aw_thermal_attach(device_t dev) for (i = 0; i < sc->conf->nsensors; i++) { device_printf(dev, "#%d: alarm %dC hyst %dC shut %dC\n", i, - aw_thermal_getalarm(sc, i) - TEMP_C_TO_K, - aw_thermal_gethyst(sc, i) - TEMP_C_TO_K, - aw_thermal_getshut(sc, i) - TEMP_C_TO_K); + aw_thermal_getalarm(sc, i), + aw_thermal_gethyst(sc, i), + aw_thermal_getshut(sc, i)); } sc->cf_pre_tag = EVENTHANDLER_REGISTER(cpufreq_pre_change, From owner-svn-src-head@freebsd.org Sat Nov 19 15:03:51 2016 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 58372C4AB70; Sat, 19 Nov 2016 15:03:51 +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 1A361DE8; Sat, 19 Nov 2016 15:03:51 +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 uAJF3oKF014100; Sat, 19 Nov 2016 15:03:50 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJF3ouV014098; Sat, 19 Nov 2016 15:03:50 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611191503.uAJF3ouV014098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 19 Nov 2016 15:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308834 - head/sys/gnu/dts/mips/ingenic X-SVN-Group: head 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, 19 Nov 2016 15:03:51 -0000 Author: br Date: Sat Nov 19 15:03:49 2016 New Revision: 308834 URL: https://svnweb.freebsd.org/changeset/base/308834 Log: Add Ingenic X1000 DTS files (unofficial). This is based on JZ4780 due to missing original X1000 parts. Sponsored by: DARPA, AFRL Added: head/sys/gnu/dts/mips/ingenic/canna.dts (contents, props changed) head/sys/gnu/dts/mips/ingenic/x1000.dtsi (contents, props changed) Added: head/sys/gnu/dts/mips/ingenic/canna.dts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gnu/dts/mips/ingenic/canna.dts Sat Nov 19 15:03:49 2016 (r308834) @@ -0,0 +1,42 @@ +/dts-v1/; +#include +#include +#include "x1000.dtsi" + +/ { + compatible = "ingenic,x1000"; + + aliases { + serial0 = &uart0; + serial1 = &uart1; + serial2 = &uart2; + serial3 = &uart3; + }; + + chosen { + stdout-path = &uart2; + }; + + memory { + device_type = "memory"; + reg = <0x0 0x2000000>; /* 32 MiB at 0x0 */ + }; +}; + +&ext { + clock-frequency = <48000000>; +}; + +&msc0 { + bus-width = <4>; + max-frequency = <6000000>; + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_msc0_pa>; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&pins_uart2_dataplusflow>; +}; Added: head/sys/gnu/dts/mips/ingenic/x1000.dtsi ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gnu/dts/mips/ingenic/x1000.dtsi Sat Nov 19 15:03:49 2016 (r308834) @@ -0,0 +1,420 @@ +#include +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ingenic,x1000"; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + compatible = "ingenic,xburst"; + reg = <0>; + }; + }; + + cpuintc: cpuintc@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + intc: intc@10001000 { + compatible = "ingenic,jz4780-intc"; + reg = <0x10001000 0x50>; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + }; + + ext: ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + }; + + rtc: rtc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + + cgu: jz4780-cgu@10000000 { + compatible = "ingenic,jz4780-cgu"; + reg = <0x10000000 0x100>; + + clocks = <&ext>, <&rtc>; + clock-names = "ext", "rtc"; + + #clock-cells = <1>; + }; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <>; + + tcu@0x10002000 { + compatible = "ingenic,jz4780-tcu"; + reg = <0x10002000 0x140>; + + interrupt-parent = <&intc>; + interrupts = <27 26 25>; + }; + + watchdog: jz47xx-watchdog@0x10002000 { + compatible = "ingenic,jz4780-watchdog"; + reg = <0x10002000 0x100>; + + clocks = <&rtc>; + clock-names = "rtc"; + }; + + rtcdev: rtcdev@10003000 { + compatible = "ingenic,jz4780-rtc"; + reg = <0x10003000 0x4c>; + interrupt-parent = <&intc>; + interrupts = <32>; + }; + + i2s: i2s@10020000 { + compatible = "ingenic,jz4780-i2s"; + reg = <0x10020000 0x94>; + + clocks = <&cgu JZ4780_CLK_AIC>, <&cgu JZ4780_CLK_I2SPLL>; + clock-names = "aic", "i2s"; + + dmas = <&dma 0 JZ4780_DMA_I2S0_RX 0xffffffff>, <&dma JZ4780_DMA_I2S0_TX 0 0xffffffff>; + dma-names = "rx" , "tx"; + + }; + + codec: codec@100200a4 { + compatible = "ingenic,jz4780-codec"; + reg = <0x100200a4 0x8>; + + clocks = <&cgu JZ4780_CLK_I2SPLL>; + clock-names = "i2s"; + + }; + + pinctrl@0x10010000 { + compatible = "ingenic,jz4780-pinctrl"; + reg = <0x10010000 0x600>; + + gpa: gpa { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <17>; + + ingenic,pull-ups = <0x3fffffff>; + }; + + gpb: gpb { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <16>; + + ingenic,pull-downs = <0x000f0c03>; + ingenic,pull-ups = <0xfff0030c>; + }; + + gpc: gpc { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <15>; + + ingenic,pull-ups = <0xffffffff>; + }; + + gpd: gpd { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <14>; + + ingenic,pull-downs = <0x0000b000>; + ingenic,pull-ups = <0xffff4fff>; + }; + + pincfg_nobias: nobias { + bias-disable; + }; + + pincfg_pull_up: pull_up { + bias-pull-up; + }; + + pincfg_pull_down: pull_down { + bias-pull-down; + }; + + pinfunc_uart2: uart2 { + pins_uart2_data: uart2-data { + ingenic,pins = <&gpd 6 1 &pincfg_nobias /* rxd */ + &gpd 7 1 &pincfg_nobias>; /* txd */ + }; + + pins_uart2_dataplusflow: uart2-dataplusflow { + ingenic,pins = <&gpd 6 1 &pincfg_nobias /* rxd */ + &gpd 5 1 &pincfg_nobias /* cts */ + &gpd 4 1 &pincfg_nobias /* rts */ + &gpd 7 1 &pincfg_nobias>; /* txd */ + }; + }; + + pinfunc_msc0: msc0 { + pins_msc0_pa: msc0-pa { + ingenic,pins = <&gpa 16 1 &pincfg_nobias /* d7 */ + &gpa 17 1 &pincfg_nobias /* d6 */ + &gpa 18 1 &pincfg_nobias /* d5 */ + &gpa 19 1 &pincfg_nobias /* d4 */ + &gpa 20 1 &pincfg_nobias /* d3 */ + &gpa 21 1 &pincfg_nobias /* d2 */ + &gpa 22 1 &pincfg_nobias /* d1 */ + &gpa 23 1 &pincfg_nobias /* d0 */ + &gpa 24 1 &pincfg_nobias /* clk */ + &gpa 25 1 &pincfg_nobias>; /* cmd */ + }; + }; + + pinfunc_cim: cim { + pins_cim: cim-pb { + ingenic,pins = < /* Fill me. */ >; + }; + }; + }; + + uart0: serial@10030000 { + compatible = "ingenic,jz4780-uart"; + reg = <0x10030000 0x100>; + reg-shift = <2>; + + interrupt-parent = <&intc>; + interrupts = <51>; + status = "disabled"; + + clocks = <&ext>, <&cgu JZ4780_CLK_UART0>; + clock-names = "baud", "module"; + }; + + uart1: serial@10031000 { + compatible = "ingenic,jz4780-uart"; + reg = <0x10031000 0x100>; + reg-shift = <2>; + + interrupt-parent = <&intc>; + interrupts = <50>; + status = "disabled"; + + clocks = <&ext>, <&cgu JZ4780_CLK_UART1>; + clock-names = "baud", "module"; + }; + + uart2: serial@10032000 { + compatible = "ingenic,jz4780-uart"; + reg = <0x10032000 0x100>; + reg-shift = <2>; + + interrupt-parent = <&intc>; + interrupts = <49>; + + clocks = <&ext>, <&cgu JZ4780_CLK_UART2>; + clock-names = "baud", "module"; + }; + + uart3: serial@10033000 { + compatible = "ingenic,jz4780-uart"; + reg = <0x10033000 0x100>; + reg-shift = <2>; + + interrupt-parent = <&intc>; + interrupts = <48>; + status = "disabled"; + + clocks = <&ext>, <&cgu JZ4780_CLK_UART3>; + clock-names = "baud", "module"; + }; + + i2c0: i2c0@0x10050000 { + compatible = "ingenic,jz4780-i2c"; + reg = <0x10050000 0x1000>; + + interrupt-parent = <&intc>; + interrupts = <60>; + + clocks = <&cgu JZ4780_CLK_SMB0>; + + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c1: i2c1@0x10051000 { + compatible = "ingenic,jz4780-i2c"; + reg = <0x10051000 0x1000>; + + interrupt-parent = <&intc>; + interrupts = <59>; + + clocks = <&cgu JZ4780_CLK_SMB1>; + + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c2: i2c2@0x10052000 { + compatible = "ingenic,jz4780-i2c"; + reg = <0x10052000 0x1000>; + + interrupt-parent = <&intc>; + interrupts = <58>; + + clocks = <&cgu JZ4780_CLK_SMB2>; + + #address-cells = <1>; + #size-cells = <0>; + }; + + lpcr: lcr@0x10000004 { + compatible = "ingenic,jz4780-lcr"; + reg = <0x10000004 0x4>; + + regulators { + vpu_power: VPU { + }; + gpu_power: GPU { + }; + gps_power: GPS { + }; + }; + }; + }; + + ahb2 { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <>; + + lcd: jz4780-lcdk@0x13050000 { + compatible = "ingenic,jz4780-lcd"; + reg = <0x13050000 0x1800>; + + clocks = <&cgu JZ4780_CLK_TVE>, <&cgu JZ4780_CLK_LCD0PIXCLK>; + clock-names = "lcd_clk", "lcd_pixclk"; + + interrupt-parent = <&intc>; + interrupts = <31>; + }; + + cim: jz4780-cim@0x13060000 { + compatible = "ingenic,jz4780-cim"; + reg = <0x13060000 0x68>; + reg-shift = <2>; + + interrupt-parent = <&intc>; + interrupts = <30>; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_cim>; + + clocks = <&cgu JZ4780_CLK_CIM>, <&cgu JZ4780_CLK_CIMMCLK>; + clock-names = "cim", "module"; + }; + + efuse: efuse@13540000 { + compatible = "ingenic,jz4780-efuse"; + reg = <0x13540000 0xFF>; + + clocks = <&cgu JZ4780_CLK_AHB2>; + clock-names = "bus_clk"; + }; + + dma: dma@13420000 { + compatible = "ingenic,jz4780-dma"; + reg = <0x13420000 0x10000>; + + interrupt-parent = <&intc>; + interrupts = <10>; + + clocks = <&cgu JZ4780_CLK_PDMA>; + + #dma-cells = <3>; + }; + + msc0: msc@13450000 { + compatible = "ingenic,jz4780-mmc"; + reg = <0x13450000 0x1000>; + + interrupt-parent = <&intc>; + interrupts = <37>; + + clocks = <&cgu JZ4780_CLK_MSC0>; + clock-names = "mmc"; + + cap-sd-highspeed; + cap-mmc-highspeed; + cap-sdio-irq; + + dmas = <&dma JZ4780_DMA_MSC0_TX JZ4780_DMA_MSC0_RX 0xffffffff>; + dma-names = "rx-tx"; + }; + + msc1: msc@13460000 { + compatible = "ingenic,jz4780-mmc"; + reg = <0x13460000 0x1000>; + + status = "disabled"; + + interrupt-parent = <&intc>; + interrupts = <36>; + + clocks = <&cgu JZ4780_CLK_MSC1>; + clock-names = "mmc"; + + cap-sd-highspeed; + cap-mmc-highspeed; + cap-sdio-irq; + + dmas = <&dma JZ4780_DMA_MSC1_TX JZ4780_DMA_MSC1_RX 0xffffffff>; + dma-names = "rx-tx"; + }; + + otg: jz4780-otg@0x13500000 { + compatible = "ingenic,jz4780-otg"; + reg = <0x13500000 0x40000>; + + interrupt-parent = <&intc>; + interrupts = <21>; + + clocks = <&cgu JZ4780_CLK_OTGPHY>, <&cgu JZ4780_CLK_OTG1>; + clock-names = "otg_phy", "otg1"; + }; + }; +}; From owner-svn-src-head@freebsd.org Sat Nov 19 15:10:12 2016 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 1FCAFC4ACC6; Sat, 19 Nov 2016 15:10: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 E5B4DFC3; Sat, 19 Nov 2016 15:10:11 +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 uAJFABNT014367; Sat, 19 Nov 2016 15:10:11 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJFAAne014365; Sat, 19 Nov 2016 15:10:10 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611191510.uAJFAAne014365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 19 Nov 2016 15:10:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308835 - in head/sys/mips: include mips X-SVN-Group: head 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, 19 Nov 2016 15:10:12 -0000 Author: br Date: Sat Nov 19 15:10:10 2016 New Revision: 308835 URL: https://svnweb.freebsd.org/changeset/base/308835 Log: Identify Ingenic CPUs. Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/mips/include/locore.h head/sys/mips/mips/cpu.c Modified: head/sys/mips/include/locore.h ============================================================================== --- head/sys/mips/include/locore.h Sat Nov 19 15:03:49 2016 (r308834) +++ head/sys/mips/include/locore.h Sat Nov 19 15:10:10 2016 (r308835) @@ -59,6 +59,9 @@ #define MIPS_PRID_CID_LEXRA 0x0b /* Lexra */ #define MIPS_PRID_CID_RMI 0x0c /* RMI */ #define MIPS_PRID_CID_CAVIUM 0x0d /* Cavium */ +#define MIPS_PRID_CID_INGENIC 0xe1 /* Ingenic */ +#define MIPS_PRID_CID_INGENIC2 0xd1 /* Ingenic */ + #define MIPS_PRID_COPTS(x) (((x) >> 24) & 0x00ff) /* Company Options */ #endif /* _MIPS_LOCORE_H */ Modified: head/sys/mips/mips/cpu.c ============================================================================== --- head/sys/mips/mips/cpu.c Sat Nov 19 15:03:49 2016 (r308834) +++ head/sys/mips/mips/cpu.c Sat Nov 19 15:10:10 2016 (r308835) @@ -373,6 +373,10 @@ cpu_identify(void) case MIPS_PRID_CID_CAVIUM: printf("Cavium"); break; + case MIPS_PRID_CID_INGENIC: + case MIPS_PRID_CID_INGENIC2: + printf("Ingenic XBurst"); + break; case MIPS_PRID_CID_PREHISTORIC: default: printf("Unknown cid %#x", cpuinfo.cpu_vendor); From owner-svn-src-head@freebsd.org Sat Nov 19 15:35:11 2016 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 AB5D9C4A577; Sat, 19 Nov 2016 15:35:11 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CD451EB5; Sat, 19 Nov 2016 15:35:11 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJFZA54026453; Sat, 19 Nov 2016 15:35:10 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJFZAdC026452; Sat, 19 Nov 2016 15:35:10 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201611191535.uAJFZAdC026452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sat, 19 Nov 2016 15:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308836 - head/sys/arm/ti X-SVN-Group: head 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, 19 Nov 2016 15:35:11 -0000 Author: cognet Date: Sat Nov 19 15:35:10 2016 New Revision: 308836 URL: https://svnweb.freebsd.org/changeset/base/308836 Log: Don't attempt to get the chip revision if it's not a supported TI chip Modified: head/sys/arm/ti/ti_cpuid.c Modified: head/sys/arm/ti/ti_cpuid.c ============================================================================== --- head/sys/arm/ti/ti_cpuid.c Sat Nov 19 15:10:10 2016 (r308835) +++ head/sys/arm/ti/ti_cpuid.c Sat Nov 19 15:35:10 2016 (r308836) @@ -43,6 +43,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include @@ -268,6 +272,12 @@ am335x_get_revision(void) static void ti_cpu_ident(void *dummy) { + phandle_t root; + + root = OF_finddevice("/"); + if (!ofw_bus_node_is_compatible(root, "ti,omap4") && + !ofw_bus_node_is_compatible(root, "ti,am33xx")) + return; switch(ti_chip()) { case CHIP_OMAP_4: omap4_get_revision(); From owner-svn-src-head@freebsd.org Sat Nov 19 15:35:41 2016 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 F1F93C4A5E2; Sat, 19 Nov 2016 15:35:41 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C23E175; Sat, 19 Nov 2016 15:35:41 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJFZewn026512; Sat, 19 Nov 2016 15:35:40 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJFZegr026511; Sat, 19 Nov 2016 15:35:40 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201611191535.uAJFZegr026511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sat, 19 Nov 2016 15:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308837 - head/sys/arm/ti X-SVN-Group: head 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, 19 Nov 2016 15:35:42 -0000 Author: cognet Date: Sat Nov 19 15:35:40 2016 New Revision: 308837 URL: https://svnweb.freebsd.org/changeset/base/308837 Log: Don't panic if it's not a TI chip, this code can be called when it is not. Modified: head/sys/arm/ti/ti_cpuid.h Modified: head/sys/arm/ti/ti_cpuid.h ============================================================================== --- head/sys/arm/ti/ti_cpuid.h Sat Nov 19 15:35:10 2016 (r308836) +++ head/sys/arm/ti/ti_cpuid.h Sat Nov 19 15:35:40 2016 (r308837) @@ -74,7 +74,6 @@ extern int _ti_chip; static __inline int ti_chip(void) { - KASSERT(_ti_chip != -1, ("Can't determine TI Chip")); return _ti_chip; } From owner-svn-src-head@freebsd.org Sat Nov 19 15:38:15 2016 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 34F74C4A6D7; Sat, 19 Nov 2016 15:38:15 +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 DDBE43E3; Sat, 19 Nov 2016 15:38:14 +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 uAJFcDpS026729; Sat, 19 Nov 2016 15:38:13 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJFcDxQ026727; Sat, 19 Nov 2016 15:38:13 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611191538.uAJFcDxQ026727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 19 Nov 2016 15:38:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308839 - head/sys/mips/include X-SVN-Group: head 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, 19 Nov 2016 15:38:15 -0000 Author: br Date: Sat Nov 19 15:38:13 2016 New Revision: 308839 URL: https://svnweb.freebsd.org/changeset/base/308839 Log: Add Ingenic XBurst coprocessor 0 extra bits. Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/mips/include/cpufunc.h head/sys/mips/include/cpuregs.h Modified: head/sys/mips/include/cpufunc.h ============================================================================== --- head/sys/mips/include/cpufunc.h Sat Nov 19 15:37:12 2016 (r308838) +++ head/sys/mips/include/cpufunc.h Sat Nov 19 15:38:13 2016 (r308839) @@ -279,6 +279,13 @@ MIPS_RW32_COP0(entrylo1, MIPS_COP_0_TLB_ MIPS_RW32_COP0(prid, MIPS_COP_0_PRID); /* XXX 64-bit? */ MIPS_RW32_COP0_SEL(ebase, MIPS_COP_0_PRID, 1); +#ifdef CPU_XBURST +MIPS_RW32_COP0_SEL(xburst_mbox0, MIPS_COP_0_XBURST_MBOX, 0); +MIPS_RW32_COP0_SEL(xburst_mbox1, MIPS_COP_0_XBURST_MBOX, 1); +MIPS_RW32_COP0_SEL(xburst_core_ctl, MIPS_COP_0_XBURST_C12, 2); +MIPS_RW32_COP0_SEL(xburst_core_sts, MIPS_COP_0_XBURST_C12, 3); +MIPS_RW32_COP0_SEL(xburst_reim, MIPS_COP_0_XBURST_C12, 4); +#endif MIPS_RW32_COP0(watchlo, MIPS_COP_0_WATCH_LO); MIPS_RW32_COP0_SEL(watchlo1, MIPS_COP_0_WATCH_LO, 1); MIPS_RW32_COP0_SEL(watchlo2, MIPS_COP_0_WATCH_LO, 2); Modified: head/sys/mips/include/cpuregs.h ============================================================================== --- head/sys/mips/include/cpuregs.h Sat Nov 19 15:37:12 2016 (r308838) +++ head/sys/mips/include/cpuregs.h Sat Nov 19 15:38:13 2016 (r308839) @@ -522,12 +522,18 @@ #define MIPS_COP_0_COUNT _(9) #define MIPS_COP_0_COMPARE _(11) - +#ifdef CPU_XBURST +#define MIPS_COP_0_XBURST_C12 _(12) +#endif #define MIPS_COP_0_CONFIG _(16) #define MIPS_COP_0_LLADDR _(17) #define MIPS_COP_0_WATCH_LO _(18) #define MIPS_COP_0_WATCH_HI _(19) #define MIPS_COP_0_TLB_XCONTEXT _(20) +#ifdef CPU_XBURST +#define MIPS_COP_0_XBURST_MBOX _(20) +#endif + #define MIPS_COP_0_ECC _(26) #define MIPS_COP_0_CACHE_ERR _(27) #define MIPS_COP_0_TAG_LO _(28) From owner-svn-src-head@freebsd.org Sat Nov 19 15:43:24 2016 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 7EB1BC4A8F4; Sat, 19 Nov 2016 15:43:24 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36B1CA5A; Sat, 19 Nov 2016 15:43:24 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJFhN0h030366; Sat, 19 Nov 2016 15:43:23 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJFhNAa030363; Sat, 19 Nov 2016 15:43:23 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201611191543.uAJFhNAa030363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sat, 19 Nov 2016 15:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308840 - in head/sys/arm/ti: . am335x omap4 X-SVN-Group: head 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, 19 Nov 2016 15:43:24 -0000 Author: cognet Date: Sat Nov 19 15:43:22 2016 New Revision: 308840 URL: https://svnweb.freebsd.org/changeset/base/308840 Log: The only remaining offender that used ti_chip() without checking for compatibility first was the gpio code, so change that, and re-assert that the TI chip is a known chip Modified: head/sys/arm/ti/am335x/am335x_gpio.c head/sys/arm/ti/omap4/omap4_gpio.c head/sys/arm/ti/ti_cpuid.h Modified: head/sys/arm/ti/am335x/am335x_gpio.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_gpio.c Sat Nov 19 15:38:13 2016 (r308839) +++ head/sys/arm/ti/am335x/am335x_gpio.c Sat Nov 19 15:43:22 2016 (r308840) @@ -65,8 +65,6 @@ static struct ofw_compat_data compat_dat static int am335x_gpio_probe(device_t dev) { - if (ti_chip() != CHIP_AM335X) - return (ENXIO); if (!ofw_bus_status_okay(dev)) return (ENXIO); @@ -74,6 +72,9 @@ am335x_gpio_probe(device_t dev) if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); + if (ti_chip() != CHIP_AM335X) + return (ENXIO); + device_set_desc(dev, "TI AM335x General Purpose I/O (GPIO)"); return (0); Modified: head/sys/arm/ti/omap4/omap4_gpio.c ============================================================================== --- head/sys/arm/ti/omap4/omap4_gpio.c Sat Nov 19 15:38:13 2016 (r308839) +++ head/sys/arm/ti/omap4/omap4_gpio.c Sat Nov 19 15:43:22 2016 (r308840) @@ -59,14 +59,14 @@ static struct ofw_compat_data compat_dat static int omap4_gpio_probe(device_t dev) { - if (ti_chip() != CHIP_OMAP_4) - return (ENXIO); if (!ofw_bus_status_okay(dev)) return (ENXIO); if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); + if (ti_chip() != CHIP_OMAP_4) + return (ENXIO); device_set_desc(dev, "TI OMAP4 General Purpose I/O (GPIO)"); Modified: head/sys/arm/ti/ti_cpuid.h ============================================================================== --- head/sys/arm/ti/ti_cpuid.h Sat Nov 19 15:38:13 2016 (r308839) +++ head/sys/arm/ti/ti_cpuid.h Sat Nov 19 15:43:22 2016 (r308840) @@ -74,6 +74,7 @@ extern int _ti_chip; static __inline int ti_chip(void) { + KASSERT(_ti_chip != -1, ("Can't determine TI Chip")); return _ti_chip; } From owner-svn-src-head@freebsd.org Sat Nov 19 16:00:06 2016 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 C657CC4A0B6; Sat, 19 Nov 2016 16:00:06 +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 9613212CE; Sat, 19 Nov 2016 16:00:06 +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 uAJG05Tm035116; Sat, 19 Nov 2016 16:00:05 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJG058p035115; Sat, 19 Nov 2016 16:00:05 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611191600.uAJG058p035115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 19 Nov 2016 16:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308841 - head/sys/dev/ic X-SVN-Group: head 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, 19 Nov 2016 16:00:06 -0000 Author: br Date: Sat Nov 19 16:00:05 2016 New Revision: 308841 URL: https://svnweb.freebsd.org/changeset/base/308841 Log: Add receiver timeout interrupt enable bit implemented in some system on chips. Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/dev/ic/ns16550.h Modified: head/sys/dev/ic/ns16550.h ============================================================================== --- head/sys/dev/ic/ns16550.h Sat Nov 19 15:43:22 2016 (r308840) +++ head/sys/dev/ic/ns16550.h Sat Nov 19 16:00:05 2016 (r308841) @@ -45,8 +45,13 @@ #define IER_ETXRDY 0x2 #define IER_ERLS 0x4 #define IER_EMSC 0x8 +/* + * Receive timeout interrupt enable. + * Implemented in Intel XScale, Ingenic XBurst. + */ +#define IER_RXTMOUT 0x10 -#define IER_BITS "\20\1ERXRDY\2ETXRDY\3ERLS\4EMSC" +#define IER_BITS "\20\1ERXRDY\2ETXRDY\3ERLS\4EMSC\5RXTMOUT" #define com_iir 2 /* interrupt identification register (R) */ #define REG_IIR com_iir From owner-svn-src-head@freebsd.org Sat Nov 19 16:08:41 2016 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 AFCDDC4A395; Sat, 19 Nov 2016 16:08:41 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7EEC919CD; Sat, 19 Nov 2016 16:08:41 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJG8e74039066; Sat, 19 Nov 2016 16:08:40 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJG8eH6039065; Sat, 19 Nov 2016 16:08:40 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201611191608.uAJG8eH6039065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 19 Nov 2016 16:08:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308843 - head/sys/boot/i386/libi386 X-SVN-Group: head 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, 19 Nov 2016 16:08:41 -0000 Author: tsoome Date: Sat Nov 19 16:08:40 2016 New Revision: 308843 URL: https://svnweb.freebsd.org/changeset/base/308843 Log: loader: smbios version check is not correct The version check for sku and family values is not correct, as this data is valid for version 2.4+, that also includes version 3.0 and above. Reported by: Dan McDonald Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8578 Modified: head/sys/boot/i386/libi386/smbios.c Modified: head/sys/boot/i386/libi386/smbios.c ============================================================================== --- head/sys/boot/i386/libi386/smbios.c Sat Nov 19 16:05:55 2016 (r308842) +++ head/sys/boot/i386/libi386/smbios.c Sat Nov 19 16:08:40 2016 (r308843) @@ -238,7 +238,8 @@ smbios_parse_table(const caddr_t addr) smbios_setenv("smbios.system.serial", addr, 0x07); smbios_setuuid("smbios.system.uuid", addr + 0x08, smbios.ver); #endif - if (smbios.major >= 2 && smbios.minor >= 4) { + if (smbios.major > 2 || + (smbios.major == 2 && smbios.minor >= 4)) { smbios_setenv("smbios.system.sku", addr, 0x19); smbios_setenv("smbios.system.family", addr, 0x1a); } From owner-svn-src-head@freebsd.org Sat Nov 19 16:36:39 2016 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 9620BC4AD00; Sat, 19 Nov 2016 16:36:39 +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 4B35EB8B; Sat, 19 Nov 2016 16:36:39 +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 uAJGacRr051116; Sat, 19 Nov 2016 16:36:38 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJGackw051113; Sat, 19 Nov 2016 16:36:38 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611191636.uAJGackw051113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 19 Nov 2016 16:36:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308845 - in head/sys/mips: include mips X-SVN-Group: head 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, 19 Nov 2016 16:36:39 -0000 Author: br Date: Sat Nov 19 16:36:38 2016 New Revision: 308845 URL: https://svnweb.freebsd.org/changeset/base/308845 Log: Account for bigger secondary data cache line size. Secondary data cache line size can be bigger than primary data cache line size, so use biggest value as a minimum alignment. Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/mips/include/cache.h head/sys/mips/mips/busdma_machdep.c head/sys/mips/mips/cache_mipsNN.c Modified: head/sys/mips/include/cache.h ============================================================================== --- head/sys/mips/include/cache.h Sat Nov 19 16:23:54 2016 (r308844) +++ head/sys/mips/include/cache.h Sat Nov 19 16:36:38 2016 (r308845) @@ -161,6 +161,8 @@ extern struct mips_cache_ops mips_cache_ /* PRIMARY CACHE VARIABLES */ extern int mips_picache_linesize; extern int mips_pdcache_linesize; +extern int mips_sdcache_linesize; +extern int mips_dcache_max_linesize; #define __mco_noargs(prefix, x) \ do { \ Modified: head/sys/mips/mips/busdma_machdep.c ============================================================================== --- head/sys/mips/mips/busdma_machdep.c Sat Nov 19 16:23:54 2016 (r308844) +++ head/sys/mips/mips/busdma_machdep.c Sat Nov 19 16:36:38 2016 (r308845) @@ -226,7 +226,7 @@ busdma_init(void *dummy) /* Create a cache of buffers in standard (cacheable) memory. */ standard_allocator = busdma_bufalloc_create("buffer", - mips_pdcache_linesize, /* minimum_alignment */ + mips_dcache_max_linesize, /* minimum_alignment */ NULL, /* uma_alloc func */ NULL, /* uma_free func */ 0); /* uma_zcreate_flags */ @@ -236,7 +236,7 @@ busdma_init(void *dummy) * BUS_DMA_COHERENT flag. */ coherent_allocator = busdma_bufalloc_create("coherent", - mips_pdcache_linesize, /* minimum_alignment */ + mips_dcache_max_linesize, /* minimum_alignment */ busdma_bufalloc_alloc_uncacheable, busdma_bufalloc_free_uncacheable, 0); /* uma_zcreate_flags */ @@ -1061,10 +1061,10 @@ _bus_dmamap_unload(bus_dma_tag_t dmat, b static void bus_dmamap_sync_buf(vm_offset_t buf, int len, bus_dmasync_op_t op, int aligned) { - char tmp_cl[mips_pdcache_linesize], tmp_clend[mips_pdcache_linesize]; + char tmp_cl[mips_dcache_max_linesize], tmp_clend[mips_dcache_max_linesize]; vm_offset_t buf_cl, buf_clend; vm_size_t size_cl, size_clend; - int cache_linesize_mask = mips_pdcache_linesize - 1; + int cache_linesize_mask = mips_dcache_max_linesize - 1; /* * dcache invalidation operates on cache line aligned addresses @@ -1091,7 +1091,7 @@ bus_dmamap_sync_buf(vm_offset_t buf, int buf_cl = buf & ~cache_linesize_mask; size_cl = buf & cache_linesize_mask; buf_clend = buf + len; - size_clend = (mips_pdcache_linesize - + size_clend = (mips_dcache_max_linesize - (buf_clend & cache_linesize_mask)) & cache_linesize_mask; } @@ -1123,7 +1123,7 @@ bus_dmamap_sync_buf(vm_offset_t buf, int if (size_cl) mips_dcache_wbinv_range(buf_cl, size_cl); if (size_clend && (size_cl == 0 || - buf_clend - buf_cl > mips_pdcache_linesize)) + buf_clend - buf_cl > mips_dcache_max_linesize)) mips_dcache_wbinv_range(buf_clend, size_clend); break; @@ -1156,7 +1156,7 @@ bus_dmamap_sync_buf(vm_offset_t buf, int if (size_cl) mips_dcache_wbinv_range(buf_cl, size_cl); if (size_clend && (size_cl == 0 || - buf_clend - buf_cl > mips_pdcache_linesize)) + buf_clend - buf_cl > mips_dcache_max_linesize)) mips_dcache_wbinv_range(buf_clend, size_clend); break; Modified: head/sys/mips/mips/cache_mipsNN.c ============================================================================== --- head/sys/mips/mips/cache_mipsNN.c Sat Nov 19 16:23:54 2016 (r308844) +++ head/sys/mips/mips/cache_mipsNN.c Sat Nov 19 16:36:38 2016 (r308845) @@ -97,6 +97,8 @@ xlp_sync(void) */ int mips_picache_linesize; int mips_pdcache_linesize; +int mips_sdcache_linesize; +int mips_dcache_max_linesize; static int picache_size; static int picache_stride; @@ -157,6 +159,10 @@ mipsNN_cache_init(struct mips_cpuinfo * sdcache_size = cpuinfo->l2.dc_size; sdcache_way_mask = cpuinfo->l2.dc_nways - 1; + mips_sdcache_linesize = cpuinfo->l2.dc_linesize; + mips_dcache_max_linesize = MAX(mips_pdcache_linesize, + mips_sdcache_linesize); + #define CACHE_DEBUG #ifdef CACHE_DEBUG printf("Cache info:\n"); @@ -166,6 +172,7 @@ mipsNN_cache_init(struct mips_cpuinfo * printf(" picache_loopcount = %d\n", picache_loopcount); printf(" pdcache_stride = %d\n", pdcache_stride); printf(" pdcache_loopcount = %d\n", pdcache_loopcount); + printf(" max line size = %d\n", mips_dcache_max_linesize); #endif } From owner-svn-src-head@freebsd.org Sat Nov 19 16:39:16 2016 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 26861C4ADCE; Sat, 19 Nov 2016 16:39:16 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA5E8DF5; Sat, 19 Nov 2016 16:39:15 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [172.20.2.29] (70-90-206-28-Albuquerque.hfc.comcastbusiness.net [70.90.206.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 71FF61928BA; Sat, 19 Nov 2016 16:39:06 +0000 (UTC) Subject: Re: svn commit: r308810 - head/bin/dd To: Adrian Chadd , Bartek Rutkowski References: <201611182109.uAIL9vBY084531@repo.freebsd.org> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Sean Bruno Message-ID: <55bcfaee-7045-ad50-b0a9-002055321809@freebsd.org> Date: Sat, 19 Nov 2016 09:39:04 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="O1RinnVjcAIOEwUIocVLFdxpXgLMi9OKk" 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, 19 Nov 2016 16:39:16 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --O1RinnVjcAIOEwUIocVLFdxpXgLMi9OKk Content-Type: multipart/mixed; boundary="ridDgVcf0ToJntjnJCVf08rp0MQssGkfM"; protected-headers="v1" From: Sean Bruno To: Adrian Chadd , Bartek Rutkowski Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-ID: <55bcfaee-7045-ad50-b0a9-002055321809@freebsd.org> Subject: Re: svn commit: r308810 - head/bin/dd References: <201611182109.uAIL9vBY084531@repo.freebsd.org> In-Reply-To: --ridDgVcf0ToJntjnJCVf08rp0MQssGkfM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/18/16 16:03, Adrian Chadd wrote: > fwiw, this breaks -head compilation. >=20 >=20 >=20 > -a >=20 This seems to not allow head to be built on stable/10 (not strictly supported, but worked until this commit) ... I haven't tried building head on stable/11 as of yet, but I assume it will break there too? sean >=20 > On 18 November 2016 at 13:09, Bartek Rutkowski wrot= e: >> Author: robak (ports committer) >> Date: Fri Nov 18 21:09:57 2016 >> New Revision: 308810 >> URL: https://svnweb.freebsd.org/changeset/base/308810 >> >> Log: >> Capsicum support for dd(1) >> >> Adds Capsicum sandboxing to dd utility. >> >> Submitted by: Pawel Biernacki >> Reviewed by: allanjude, emaste, oshogbo >> Approved by: oshogbo >> Sponsored by: Mysterious Code Ltd. >> Differential Revision: https://reviews.freebsd.org/D8543 >> >> Modified: >> head/bin/dd/dd.c >> >> Modified: head/bin/dd/dd.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/bin/dd/dd.c Fri Nov 18 17:18:05 2016 (r308809) >> +++ head/bin/dd/dd.c Fri Nov 18 21:09:57 2016 (r308810) >> @@ -48,10 +48,13 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> #include >> #include >> +#include >> >> #include >> +#include >> #include >> #include >> #include >> @@ -92,6 +95,10 @@ main(int argc __unused, char *argv[]) >> jcl(argv); >> setup(); >> >> + caph_cache_catpages(); >> + if (cap_enter() =3D=3D -1 && errno !=3D ENOSYS) >> + err(1, "unable to enter capability mode"); >> + >> (void)signal(SIGINFO, siginfo_handler); >> (void)signal(SIGINT, terminate); >> >> @@ -125,6 +132,8 @@ static void >> setup(void) >> { >> u_int cnt; >> + cap_rights_t rights; >> + unsigned long cmds[] =3D { FIODTYPE, MTIOCTOP }; >> >> if (in.name =3D=3D NULL) { >> in.name =3D "stdin"; >> @@ -133,13 +142,20 @@ setup(void) >> in.fd =3D open(in.name, O_RDONLY, 0); >> if (in.fd =3D=3D -1) >> err(1, "%s", in.name); >> + if (caph_limit_stdin() =3D=3D -1) >> + err(1, "unable to limit capability rights"); >> } >> >> getfdtype(&in); >> >> + cap_rights_init(&rights, CAP_READ, CAP_SEEK); >> + if (cap_rights_limit(in.fd, &rights) =3D=3D -1 && errno !=3D E= NOSYS) >> + err(1, "unable to limit capability rights"); >> + >> if (files_cnt > 1 && !(in.flags & ISTAPE)) >> errx(1, "files is not supported for non-tape devices")= ; >> >> + cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL); >> if (out.name =3D=3D NULL) { >> /* No way to check for read access here. */ >> out.fd =3D STDOUT_FILENO; >> @@ -156,13 +172,27 @@ setup(void) >> if (out.fd =3D=3D -1) { >> out.fd =3D open(out.name, O_WRONLY | OFLAGS, D= EFFILEMODE); >> out.flags |=3D NOREAD; >> + cap_rights_clear(&rights, CAP_READ); >> } >> if (out.fd =3D=3D -1) >> err(1, "%s", out.name); >> + if (caph_limit_stdout() =3D=3D -1) >> + err(1, "unable to limit capability rights"); >> } >> >> getfdtype(&out); >> >> + if (cap_rights_limit(out.fd, &rights) =3D=3D -1 && errno !=3D = ENOSYS) >> + err(1, "unable to limit capability rights"); >> + if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) =3D=3D -1 && >> + errno !=3D ENOSYS) >> + err(1, "unable to limit capability rights"); >> + >> + if (in.fd !=3D STDERR_FILENO && out.fd !=3D STDERR_FILENO) { >> + if (caph_limit_stderr() =3D=3D -1) >> + err(1, "unable to limit capability rights"); >> + } >> + >> /* >> * Allocate space for the input and output buffers. If not do= ing >> * record oriented I/O, only need a single buffer. >> >=20 >=20 --ridDgVcf0ToJntjnJCVf08rp0MQssGkfM-- --O1RinnVjcAIOEwUIocVLFdxpXgLMi9OKk Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQF8BAEBCgBmBQJYMIAoXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRCQUFENDYzMkU3MTIxREU4RDIwOTk3REQx MjAxRUZDQTFFNzI3RTY0AAoJEBIB78oecn5kjiMH/3CNGPjeu0UV+ozgupB3dMN5 Dq1lhklworSKDKH6qDP+NLf6q3QvB8gDDoeJ4GDjzhrqna49YhUFr9PuY4QJL66d OG7wKrZSXW4Uoc7TO2xfWP+RFOLgfTg3SlvjG3bY5Le7KXVYwQnWqilZBIJuWVee r4uI90ildNryBpHUaycE0qQ8zaeGB+9YwmqAg+Ihwob39lguMVr8SUyuPQ4CiSdT N56I4n36fYyR8Ijdhcx5m1UcZqk5opxBp1D5vF4LGKEvXpJgZZ8FgLyImPisBXMY +0ZPUz6BgwoqGRauvaAsD7EuMrHXHtRJGfb8NpCukVabw0aHOEHdAkw3hEUWAgM= =94MX -----END PGP SIGNATURE----- --O1RinnVjcAIOEwUIocVLFdxpXgLMi9OKk-- From owner-svn-src-head@freebsd.org Sat Nov 19 16:52:36 2016 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 E3666C4A29C; Sat, 19 Nov 2016 16:52:36 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA2A616C2; Sat, 19 Nov 2016 16:52:36 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (unknown [10.1.1.2]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 5993C13A83; Sat, 19 Nov 2016 16:52:35 +0000 (UTC) Subject: Re: svn commit: r308810 - head/bin/dd To: Sean Bruno , Adrian Chadd , Bartek Rutkowski References: <201611182109.uAIL9vBY084531@repo.freebsd.org> <55bcfaee-7045-ad50-b0a9-002055321809@freebsd.org> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Allan Jude Message-ID: <874c55db-9f05-2789-3daa-d84dbf3c067c@freebsd.org> Date: Sat, 19 Nov 2016 11:52:31 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <55bcfaee-7045-ad50-b0a9-002055321809@freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vM6wqdnIndi1x1eNgbq57OTGtVIotmgKC" 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, 19 Nov 2016 16:52:37 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vM6wqdnIndi1x1eNgbq57OTGtVIotmgKC Content-Type: multipart/mixed; boundary="SUn8rGuF1RaREjw4InLR6RmVidoIxO3og"; protected-headers="v1" From: Allan Jude To: Sean Bruno , Adrian Chadd , Bartek Rutkowski Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-ID: <874c55db-9f05-2789-3daa-d84dbf3c067c@freebsd.org> Subject: Re: svn commit: r308810 - head/bin/dd References: <201611182109.uAIL9vBY084531@repo.freebsd.org> <55bcfaee-7045-ad50-b0a9-002055321809@freebsd.org> In-Reply-To: <55bcfaee-7045-ad50-b0a9-002055321809@freebsd.org> --SUn8rGuF1RaREjw4InLR6RmVidoIxO3og Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2016-11-19 11:39, Sean Bruno wrote: >=20 >=20 > On 11/18/16 16:03, Adrian Chadd wrote: >> fwiw, this breaks -head compilation. >> >> >> >> -a >> >=20 > This seems to not allow head to be built on stable/10 (not strictly > supported, but worked until this commit) ... I haven't tried building > head on stable/11 as of yet, but I assume it will break there too? >=20 > sean >=20 >=20 It breaks building dd as a 'build tool', so it will break building everything i think. --=20 Allan Jude --SUn8rGuF1RaREjw4InLR6RmVidoIxO3og-- --vM6wqdnIndi1x1eNgbq57OTGtVIotmgKC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iQIcBAEBAgAGBQJYMINSAAoJEBmVNT4SmAt+UckQAKIXE2lUjk279yfBKbq6eZtl Nkv7Os5vbD8lMy61tgEK8QaNXD5qVlSBiEL/TXlljJQ82vB7XOGvRBdOzUeIaLfn hwGt63fQJAsCjM55dWum6kCJNaMM9oQX95VdD+u7pMQkDsFyheZutSlJJMAUtvIb 3PFK3JyAoyYOziB6EeLBdB6HaF86U2tsFZR5BtKBvngB9t5O8JwB2DiCYFjgzd/K BT0iPkO2J6osMz0e8jcaIO2qnkSeNwyZknoD4dxm2+zLWqhE0tYCzjO3l/joRSoL sKWpbWBqsnC8DOgk9xREgO/Hpu86j+2GOrQZ/BIPjRknH7ussBYiNOVZ3wiZP7qm 48MnhuZOt4g9HPOrSBFFcebpFnBSeDuYmytBpY+qTiUldKhQuA6iruJb/dV1hpaP OuzRrxmEJcdkP4vz1AjExmmV1c6k7kKMRXU+qeJ1BaE0T+On4p7duroOFZA9Yzz2 AwiR21w87c3zGfMOlQjv+Mmcnf4l6paxVhtTdIgVVfE9qa7s5+rxvB1uaN5xYFTv UfBSaLixon6PkIL8tiTuIe2nJU5SPY9623C8GB/trT33M0HsgwVp8il8mHHN3qW0 BBb4Qv0kJKyso43AGFQhh6yS3BOaydddtUz+GzdIduBVhcs4pS/wFXW+GZLTbnRZ zG8t01nFRP7z3QjRM24e =Zg2Z -----END PGP SIGNATURE----- --vM6wqdnIndi1x1eNgbq57OTGtVIotmgKC-- From owner-svn-src-head@freebsd.org Sat Nov 19 17:01:08 2016 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 9B34BC4A7D4; Sat, 19 Nov 2016 17:01:08 +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 536631F47; Sat, 19 Nov 2016 17:01:08 +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 uAJH17Fp059843; Sat, 19 Nov 2016 17:01:07 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJH17Lq059839; Sat, 19 Nov 2016 17:01:07 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611191701.uAJH17Lq059839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 19 Nov 2016 17:01:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308846 - in head/sys: conf mips/atheros/ar531x mips/broadcom mips/mediatek X-SVN-Group: head 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, 19 Nov 2016 17:01:08 -0000 Author: br Date: Sat Nov 19 17:01:06 2016 New Revision: 308846 URL: https://svnweb.freebsd.org/changeset/base/308846 Log: Move intrng includes to the main MIPS includes file. Sponsored by: DARPA, AFRL Modified: head/sys/conf/files.mips head/sys/mips/atheros/ar531x/files.ar5315 head/sys/mips/broadcom/files.broadcom head/sys/mips/mediatek/files.mediatek Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Sat Nov 19 16:36:38 2016 (r308845) +++ head/sys/conf/files.mips Sat Nov 19 17:01:06 2016 (r308846) @@ -97,6 +97,13 @@ dev/hwpmc/hwpmc_mips74k.c optional hwpm # ofw support dev/ofw/ofwpci.c optional fdt pci +# INTRNG support code +kern/msi_if.m optional intrng +kern/pic_if.m optional intrng +kern/subr_intr.c optional intrng +# INTRNG compatible MIPS32 interrupt controller +mips/mips/mips_pic.c optional intrng + # DTrace cddl/compat/opensolaris/kern/opensolaris_atomic.c optional zfs | dtrace compile-with "${CDDL_C}" cddl/dev/dtrace/mips/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" Modified: head/sys/mips/atheros/ar531x/files.ar5315 ============================================================================== --- head/sys/mips/atheros/ar531x/files.ar5315 Sat Nov 19 16:36:38 2016 (r308845) +++ head/sys/mips/atheros/ar531x/files.ar5315 Sat Nov 19 17:01:06 2016 (r308846) @@ -18,14 +18,5 @@ mips/mips/tick.c standard dev/etherswitch/e6000sw/e6060sw.c optional etherswitch -# Hack to reuse ARM intrng code -kern/subr_intr.c optional intrng -kern/msi_if.m optional intrng -kern/pic_if.m optional intrng - -# Intrng compatible MIPS32 interrupt controller -mips/mips/mips_pic.c optional intrng - # Non Intrng mips/mips/intr_machdep.c optional !intrng - Modified: head/sys/mips/broadcom/files.broadcom ============================================================================== --- head/sys/mips/broadcom/files.broadcom Sat Nov 19 16:36:38 2016 (r308845) +++ head/sys/mips/broadcom/files.broadcom Sat Nov 19 17:01:06 2016 (r308846) @@ -9,11 +9,6 @@ mips/broadcom/bcm_bmips.c optional siba mips/broadcom/bcm_mips74k.c optional bcma_nexus bcma mips/broadcom/bcm_pmu.c standard mips/mips/tick.c standard -mips/mips/mips_pic.c standard -kern/subr_intr.c standard -kern/pic_if.m standard - -kern/msi_if.m optional intrng mips/broadcom/uart_cpu_chipc.c optional uart mips/broadcom/uart_bus_chipc.c optional uart Modified: head/sys/mips/mediatek/files.mediatek ============================================================================== --- head/sys/mips/mediatek/files.mediatek Sat Nov 19 16:36:38 2016 (r308845) +++ head/sys/mips/mediatek/files.mediatek Sat Nov 19 17:01:06 2016 (r308846) @@ -26,14 +26,6 @@ mips/mediatek/mtk_gpio_v2.c optional g # Ralink/Mediatek Ethernet driver dev/rt/if_rt.c optional rt -# Hack to reuse ARM intrng code -kern/subr_intr.c standard -kern/msi_if.m standard -kern/pic_if.m standard - -# Intrng compatible MIPS32 interrupt controller -mips/mips/mips_pic.c standard - # Standard MIPS ticker mips/mips/tick.c standard From owner-svn-src-head@freebsd.org Sat Nov 19 17:14:33 2016 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 6B7FAC4B251; Sat, 19 Nov 2016 17:14:33 +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 0EB2765849; Sat, 19 Nov 2016 17: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 uAJHCTE7082549; Sat, 19 Nov 2016 17:12:29 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHCT38082548; Sat, 19 Nov 2016 17:12:29 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191712.uAJHCT38082548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 17:12:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308848 - head/sbin/nvmecontrol X-SVN-Group: head 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, 19 Nov 2016 17:14:33 -0000 Author: imp Date: Sat Nov 19 17:12:28 2016 New Revision: 308848 URL: https://svnweb.freebsd.org/changeset/base/308848 Log: Remove check for valid log pages. Let the drive tell us which pages are valid or not. While many pages are reserved in the standard, that doesn't make them invalid and future versions of the standard may define then. Sponsored by: Netflix, Inc Modified: head/sbin/nvmecontrol/logpage.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:24 2016 (r308847) +++ head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:28 2016 (r308848) @@ -262,14 +262,6 @@ logpage(int argc, char *argv[]) "\"%s\" not valid log page id.\n", optarg); logpage_usage(); - /* TODO: Define valid log page id ranges in nvme.h? */ - } else if (log_page == 0 || - (log_page >= 0x04 && log_page <= 0x7F) || - (log_page >= 0x80 && log_page <= 0xBF)) { - fprintf(stderr, - "\"%s\" not valid log page id.\n", - optarg); - logpage_usage(); } pageflag = true; break; From owner-svn-src-head@freebsd.org Sat Nov 19 17:15:25 2016 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 EE766C4B32F; Sat, 19 Nov 2016 17:15:25 +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 4096E65B60; Sat, 19 Nov 2016 17:12:45 +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 uAJHCiDx082657; Sat, 19 Nov 2016 17:12:44 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHCiCD082656; Sat, 19 Nov 2016 17:12:44 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191712.uAJHCiCD082656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 17:12:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308850 - head/sbin/nvmecontrol X-SVN-Group: head 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, 19 Nov 2016 17:15:26 -0000 Author: imp Date: Sat Nov 19 17:12:44 2016 New Revision: 308850 URL: https://svnweb.freebsd.org/changeset/base/308850 Log: Print numbers instead of hex values for smart data. The full 128-bit number is printed, even though you'd need like a billion IOPs for a 10 billion seconds to overflow the 64-bit counters (~300 years). Sponsored by: Netflix, Inc Modified: head/sbin/nvmecontrol/logpage.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:39 2016 (r308849) +++ head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:44 2016 (r308850) @@ -42,6 +42,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include + +#if _BYTE_ORDER != _LITTLE_ENDIAN +#error "Code only works on little endian machines" +#endif #include "nvmecontrol.h" @@ -50,6 +55,38 @@ __FBSDID("$FreeBSD$"); typedef void (*print_fn_t)(void *buf, uint32_t size); + +/* + * 128-bit integer augments to standard values + */ +#define UINT128_DIG 39 +typedef __uint128_t uint128_t; + +static inline uint128_t +to128(void *p) +{ + return *(uint128_t *)p; +} + +static char * +uint128_to_str(uint128_t u, char *buf, size_t buflen) +{ + char *end = buf + buflen - 1; + + *end-- = '\0'; + if (u == 0) + *end-- = '0'; + while (u && end >= buf) { + *end-- = u % 10 + '0'; + u /= 10; + } + end++; + if (u != 0) + return NULL; + + return end; +} + static void * get_log_buffer(uint32_t size) { @@ -128,6 +165,7 @@ static void print_log_health(void *buf, uint32_t size __unused) { struct nvme_health_information_page *health = buf; + char cbuf[UINT128_DIG + 1]; printf("SMART/Health Information Log\n"); printf("============================\n"); @@ -155,40 +193,26 @@ print_log_health(void *buf, uint32_t siz printf("Percentage used: %u\n", health->percentage_used); - /* - * TODO: These are pretty ugly in hex. Is there a library that - * will convert 128-bit unsigned values to decimal? - */ - printf("Data units (512 byte) read: 0x%016jx%016jx\n", - health->data_units_read[1], - health->data_units_read[0]); - printf("Data units (512 byte) written: 0x%016jx%016jx\n", - health->data_units_written[1], - health->data_units_written[0]); - printf("Host read commands: 0x%016jx%016jx\n", - health->host_read_commands[1], - health->host_read_commands[0]); - printf("Host write commands: 0x%016jx%016jx\n", - health->host_write_commands[1], - health->host_write_commands[0]); - printf("Controller busy time (minutes): 0x%016jx%016jx\n", - health->controller_busy_time[1], - health->controller_busy_time[0]); - printf("Power cycles: 0x%016jx%016jx\n", - health->power_cycles[1], - health->power_cycles[0]); - printf("Power on hours: 0x%016jx%016jx\n", - health->power_on_hours[1], - health->power_on_hours[0]); - printf("Unsafe shutdowns: 0x%016jx%016jx\n", - health->unsafe_shutdowns[1], - health->unsafe_shutdowns[0]); - printf("Media errors: 0x%016jx%016jx\n", - health->media_errors[1], - health->media_errors[0]); - printf("No. error info log entries: 0x%016jx%016jx\n", - health->num_error_info_log_entries[1], - health->num_error_info_log_entries[0]); + printf("Data units (512,000 byte) read: %s\n", + uint128_to_str(to128(health->data_units_read), cbuf, sizeof(cbuf))); + printf("Data units (512,000 byte) written: %s\n", + uint128_to_str(to128(health->data_units_written), cbuf, sizeof(cbuf))); + printf("Host read commands: %s\n", + uint128_to_str(to128(health->host_read_commands), cbuf, sizeof(cbuf))); + printf("Host write commands: %s\n", + uint128_to_str(to128(health->host_write_commands), cbuf, sizeof(cbuf))); + printf("Controller busy time (minutes): %s\n", + uint128_to_str(to128(health->controller_busy_time), cbuf, sizeof(cbuf))); + printf("Power cycles: %s\n", + uint128_to_str(to128(health->power_cycles), cbuf, sizeof(cbuf))); + printf("Power on hours: %s\n", + uint128_to_str(to128(health->power_on_hours), cbuf, sizeof(cbuf))); + printf("Unsafe shutdowns: %s\n", + uint128_to_str(to128(health->unsafe_shutdowns), cbuf, sizeof(cbuf))); + printf("Media errors: %s\n", + uint128_to_str(to128(health->media_errors), cbuf, sizeof(cbuf))); + printf("No. error info log entries: %s\n", + uint128_to_str(to128(health->num_error_info_log_entries), cbuf, sizeof(cbuf))); } static void From owner-svn-src-head@freebsd.org Sat Nov 19 17:15:32 2016 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 8B243C4B354; Sat, 19 Nov 2016 17:15:32 +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 4CD8365BDE; Sat, 19 Nov 2016 17:12:50 +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 uAJHCncG082710; Sat, 19 Nov 2016 17:12:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHCn7l082708; Sat, 19 Nov 2016 17:12:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191712.uAJHCn7l082708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 17:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308851 - in head: sbin/nvmecontrol sys/dev/nvme X-SVN-Group: head 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, 19 Nov 2016 17:15:32 -0000 Author: imp Date: Sat Nov 19 17:12:49 2016 New Revision: 308851 URL: https://svnweb.freebsd.org/changeset/base/308851 Log: Expand the SMART / Health Information Log Page (Page 02) printout based on NVM Express 1.2.1 Standard. Sponsored by: Netflix, Inc Modified: head/sbin/nvmecontrol/logpage.c head/sys/dev/nvme/nvme.h Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:44 2016 (r308850) +++ head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:49 2016 (r308851) @@ -162,10 +162,18 @@ print_log_error(void *buf, uint32_t size } static void +print_temp(uint16_t t) +{ + printf("%u K, %2.2f C, %3.2f F\n", t, (float)t - 273.15, (float)t * 9 / 5 - 459.67); +} + + +static void print_log_health(void *buf, uint32_t size __unused) { struct nvme_health_information_page *health = buf; char cbuf[UINT128_DIG + 1]; + int i; printf("SMART/Health Information Log\n"); printf("============================\n"); @@ -182,10 +190,8 @@ print_log_health(void *buf, uint32_t siz health->critical_warning.bits.read_only); printf(" Volatile memory backup: %d\n", health->critical_warning.bits.volatile_memory_backup); - printf("Temperature: %u K, %2.2f C, %3.2f F\n", - health->temperature, - (float)health->temperature - (float)273.15, - ((float)health->temperature * (float)9/5) - (float)459.67); + printf("Temperature: "); + print_temp(health->temperature); printf("Available spare: %u\n", health->available_spare); printf("Available spare threshold: %u\n", @@ -193,9 +199,9 @@ print_log_health(void *buf, uint32_t siz printf("Percentage used: %u\n", health->percentage_used); - printf("Data units (512,000 byte) read: %s\n", + printf("Data units (512,000 byte) read: %s\n", uint128_to_str(to128(health->data_units_read), cbuf, sizeof(cbuf))); - printf("Data units (512,000 byte) written: %s\n", + printf("Data units written: %s\n", uint128_to_str(to128(health->data_units_written), cbuf, sizeof(cbuf))); printf("Host read commands: %s\n", uint128_to_str(to128(health->host_read_commands), cbuf, sizeof(cbuf))); @@ -213,6 +219,15 @@ print_log_health(void *buf, uint32_t siz uint128_to_str(to128(health->media_errors), cbuf, sizeof(cbuf))); printf("No. error info log entries: %s\n", uint128_to_str(to128(health->num_error_info_log_entries), cbuf, sizeof(cbuf))); + + printf("Warning Temp Composite Time: %d\n", health->warning_temp_time); + printf("Error Temp Composite Time: %d\n", health->error_temp_time); + for (i = 0; i < 7; i++) { + if (health->temp_sensor[i] == 0) + continue; + printf("Temperature Sensor %d: ", i + 1); + print_temp(health->temp_sensor[i]); + } } static void Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sat Nov 19 17:12:44 2016 (r308850) +++ head/sys/dev/nvme/nvme.h Sat Nov 19 17:12:49 2016 (r308851) @@ -724,8 +724,11 @@ struct nvme_health_information_page { uint64_t unsafe_shutdowns[2]; uint64_t media_errors[2]; uint64_t num_error_info_log_entries[2]; + uint32_t warning_temp_time; + uint32_t error_temp_time; + uint16_t temp_sensor[8]; - uint8_t reserved2[320]; + uint8_t reserved2[296]; } __packed __aligned(4); struct nvme_firmware_page { From owner-svn-src-head@freebsd.org Sat Nov 19 17:16:20 2016 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 EDF2EC4B405; Sat, 19 Nov 2016 17:16:20 +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 34AFF6579E; Sat, 19 Nov 2016 17:12:25 +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 uAJHCO1g082500; Sat, 19 Nov 2016 17:12:24 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHCOh0082499; Sat, 19 Nov 2016 17:12:24 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611191712.uAJHCOh0082499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 19 Nov 2016 17:12:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308847 - head/sys/conf X-SVN-Group: head 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, 19 Nov 2016 17:16:21 -0000 Author: br Date: Sat Nov 19 17:12:24 2016 New Revision: 308847 URL: https://svnweb.freebsd.org/changeset/base/308847 Log: Add XBurst CPU option. Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/conf/options.mips Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Sat Nov 19 17:01:06 2016 (r308846) +++ head/sys/conf/options.mips Sat Nov 19 17:12:24 2016 (r308847) @@ -45,6 +45,7 @@ CPU_CNMIPS opt_global.h CPU_RMI opt_global.h CPU_NLM opt_global.h CPU_BERI opt_global.h +CPU_XBURST opt_global.h CPU_MALTA opt_global.h # which MACHINE_ARCH architecture From owner-svn-src-head@freebsd.org Sat Nov 19 17:16:29 2016 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 04E55C4B42E; Sat, 19 Nov 2016 17:16: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 9DF2565CFF; Sat, 19 Nov 2016 17:12:59 +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 uAJHCwxb082815; Sat, 19 Nov 2016 17:12:58 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHCwcj082814; Sat, 19 Nov 2016 17:12:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191712.uAJHCwcj082814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 17:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308853 - head/sys/dev/nvme X-SVN-Group: head 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, 19 Nov 2016 17:16:29 -0000 Author: imp Date: Sat Nov 19 17:12:58 2016 New Revision: 308853 URL: https://svnweb.freebsd.org/changeset/base/308853 Log: Add log pages that Intel SSDs provide. It turns out that many of these are widely implemented beyond just Intel drives. Sponsored by: Netflix, Inc Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sat Nov 19 17:12:53 2016 (r308852) +++ head/sys/dev/nvme/nvme.h Sat Nov 19 17:12:58 2016 (r308853) @@ -667,8 +667,18 @@ enum nvme_log_page { NVME_LOG_COMMAND_EFFECT = 0x05, /* 0x06-0x7F - reserved */ /* 0x80-0xBF - I/O command set specific */ - NVME_LOG_RES_NOTIFICATION = 0x80 + NVME_LOG_RES_NOTIFICATION = 0x80, /* 0xC0-0xFF - vendor specific */ +/* + * The following are Intel Specific log pages, but they seem to + * be widely implemented. + */ + INTEL_LOG_READ_LAT_LOG = 0xc1, + INTEL_LOG_WRITE_LAT_LOG = 0xc2, + INTEL_LOG_TEMP_STATS = 0xc5, + INTEL_LOG_ADD_SMART = 0xca, + INTEL_LOG_DRIVE_MKT_NAME = 0xdd, + }; struct nvme_error_information_entry { From owner-svn-src-head@freebsd.org Sat Nov 19 17:16:31 2016 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 02356C4B436; Sat, 19 Nov 2016 17:16:31 +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 963DA65D70; Sat, 19 Nov 2016 17:13:04 +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 uAJHD3O8082874; Sat, 19 Nov 2016 17:13:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHD3uG082872; Sat, 19 Nov 2016 17:13:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191713.uAJHD3uG082872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 17:13:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308854 - in head: sbin/nvmecontrol sys/dev/nvme X-SVN-Group: head 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, 19 Nov 2016 17:16:31 -0000 Author: imp Date: Sat Nov 19 17:13:03 2016 New Revision: 308854 URL: https://svnweb.freebsd.org/changeset/base/308854 Log: Print Intel's expanded Temperature log page. Sponsored by: Netflix, Inc Modified: head/sbin/nvmecontrol/logpage.c head/sys/dev/nvme/nvme.h Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:58 2016 (r308853) +++ head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:13:03 2016 (r308854) @@ -100,7 +100,7 @@ get_log_buffer(uint32_t size) } void -read_logpage(int fd, uint8_t log_page, int nsid, void *payload, +read_logpage(int fd, uint8_t log_page, int nsid, void *payload, uint32_t payload_size) { struct nvme_pt_command pt; @@ -259,6 +259,35 @@ print_log_firmware(void *buf, uint32_t s } } +static void +print_intel_temp_stats(void *buf, uint32_t size __unused) +{ + struct intel_log_temp_stats *temp = buf; + + printf("Intel Temperature Log\n"); + printf("=====================\n"); + + printf("Current: "); + print_temp(temp->current); + printf("Overtemp Last Flags %#jx\n", (uintmax_t)temp->overtemp_flag_last); + printf("Overtemp Lifetime Flags %#jx\n", (uintmax_t)temp->overtemp_flag_life); + printf("Max Temperature "); + print_temp(temp->max_temp); + printf("Min Temperature "); + print_temp(temp->min_temp); + printf("Max Operating Temperature "); + print_temp(temp->max_oper_temp); + printf("Min Operating Temperature "); + print_temp(temp->min_oper_temp); + printf("Estimated Temperature Offset: %ju C/K\n", (uintmax_t)temp->est_offset); +} + +/* + * Table of log page printer / sizing. + * + * This includes Intel specific pages that are widely implemented. Not + * sure how best to switch between different vendors. + */ static struct logpage_function { uint8_t log_page; print_fn_t print_fn; @@ -270,6 +299,8 @@ static struct logpage_function { sizeof(struct nvme_health_information_page)}, {NVME_LOG_FIRMWARE_SLOT, print_log_firmware, sizeof(struct nvme_firmware_page)}, + {INTEL_LOG_TEMP_STATS, print_intel_temp_stats, + sizeof(struct intel_log_temp_stats)}, {0, NULL, 0}, }; Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sat Nov 19 17:12:58 2016 (r308853) +++ head/sys/dev/nvme/nvme.h Sat Nov 19 17:13:03 2016 (r308854) @@ -670,7 +670,7 @@ enum nvme_log_page { NVME_LOG_RES_NOTIFICATION = 0x80, /* 0xC0-0xFF - vendor specific */ /* - * The following are Intel Specific log pages, but they seem to + * The following are Intel Specific log pages, but they seem to * be widely implemented. */ INTEL_LOG_READ_LAT_LOG = 0xc1, @@ -756,6 +756,19 @@ struct nvme_firmware_page { uint8_t reserved2[448]; } __packed __aligned(4); +struct intel_log_temp_stats +{ + uint64_t current; + uint64_t overtemp_flag_last; + uint64_t overtemp_flag_life; + uint64_t max_temp; + uint64_t min_temp; + uint64_t _rsvd[5]; + uint64_t max_oper_temp; + uint64_t min_oper_temp; + uint64_t est_offset; +} __packed __aligned(4); + #define NVME_TEST_MAX_THREADS 128 struct nvme_io_test { From owner-svn-src-head@freebsd.org Sat Nov 19 17:16:56 2016 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 5C80CC4B489; Sat, 19 Nov 2016 17:16:56 +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 A2FC665E39; Sat, 19 Nov 2016 17:13:14 +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 uAJHDDAq082980; Sat, 19 Nov 2016 17:13:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHDD4N082979; Sat, 19 Nov 2016 17:13:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191713.uAJHDD4N082979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 17:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308856 - head/sbin/nvmecontrol X-SVN-Group: head 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, 19 Nov 2016 17:16:56 -0000 Author: imp Date: Sat Nov 19 17:13:12 2016 New Revision: 308856 URL: https://svnweb.freebsd.org/changeset/base/308856 Log: Decode the Intel-specific Additional SMART data page (0xca) and print it in human readable form. Include a pointer to the public spec that was followed to implement this in the code. Samsung also implements page 0xca on some of their drives, but the format is slighly different, so the code skips printing zero keys. Samsung's log page has additional, unknown data after the end of Intel defined data which isn't displayed. Supported by: Netfix, Inc Modified: head/sbin/nvmecontrol/logpage.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:13:08 2016 (r308855) +++ head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:13:12 2016 (r308856) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); typedef void (*print_fn_t)(void *buf, uint32_t size); - struct kv_name { uint32_t key; @@ -106,6 +105,15 @@ uint128_to_str(uint128_t u, char *buf, s return end; } +/* "fMissing" from endian.h */ +static __inline uint64_t +le48dec(const void *pp) +{ + uint8_t const *p = (uint8_t const *)pp; + + return (((uint64_t)le16dec(p + 4) << 32) | le32dec(p)); +} + static void * get_log_buffer(uint32_t size) { @@ -278,6 +286,13 @@ print_log_firmware(void *buf, uint32_t s } } +/* + * Intel specific log pages from + * http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/ssd-dc-p3700-spec.pdf + * + * Though the version as of this date has a typo for the size of log page 0xca, + * offset 147: it is only 1 byte, not 6. + */ static void print_intel_temp_stats(void *buf, uint32_t size __unused) { @@ -301,6 +316,68 @@ print_intel_temp_stats(void *buf, uint32 printf("Estimated Temperature Offset: %ju C/K\n", (uintmax_t)temp->est_offset); } +static void +print_intel_add_smart(void *buf, uint32_t size __unused) +{ + uint8_t *walker = buf; + uint8_t *end = walker + 150; + const char *name; + uint64_t raw; + uint8_t normalized; + + static struct kv_name kv[] = + { + { 0xab, "Program Fail Count" }, + { 0xac, "Erase Fail Count" }, + { 0xad, "Wear Leveling Count" }, + { 0xb8, "End to End Error Count" }, + { 0xc7, "CRC Error Count" }, + { 0xe2, "Timed: Media Wear" }, + { 0xe3, "Timed: Host Read %" }, + { 0xe4, "Timed: Elapsed Time" }, + { 0xea, "Thermal Throttle Status" }, + { 0xf0, "Retry Buffer Overflows" }, + { 0xf3, "PLL Lock Loss Count" }, + { 0xf4, "NAND Bytes Written" }, + { 0xf5, "Host Bytes Written" }, + }; + + printf("Additional SMART Data Log\n"); + printf("=========================\n"); + /* + * walker[0] = Key + * walker[1,2] = reserved + * walker[3] = Normalized Value + * walker[4] = reserved + * walker[5..10] = Little Endian Raw value + * (or other represenations) + * walker[11] = reserved + */ + while (walker < end) { + name = kv_lookup(kv, nitems(kv), *walker); + normalized = walker[3]; + raw = le48dec(walker + 5); + switch (*walker){ + case 0: + break; + case 0xad: + printf("%-32s: %3d min: %u max: %u ave: %u\n", name, normalized, + le16dec(walker + 5), le16dec(walker + 7), le16dec(walker + 9)); + break; + case 0xe2: + printf("%-32s: %3d %.3f%%\n", name, normalized, raw / 1024.0); + break; + case 0xea: + printf("%-32s: %3d %d%% %d times\n", name, normalized, walker[5], le32dec(walker+6)); + break; + default: + printf("%-32s: %3d %ju\n", name, normalized, (uintmax_t)raw); + break; + } + walker += 12; + } +} + /* * HGST's 0xc1 page. This is a grab bag of additional data. Please see * https://www.hgst.com/sites/default/files/resources/US_SN150_ProdManual.pdf @@ -719,6 +796,8 @@ static struct logpage_function { sizeof(struct nvme_firmware_page)}, {INTEL_LOG_TEMP_STATS, print_intel_temp_stats, sizeof(struct intel_log_temp_stats)}, + {INTEL_LOG_ADD_SMART, print_intel_add_smart, + DEFAULT_SIZE}, {HGST_INFO_LOG, print_hgst_info_log, DEFAULT_SIZE}, {0, NULL, From owner-svn-src-head@freebsd.org Sat Nov 19 17:17:32 2016 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 81EA2C4B4FA; Sat, 19 Nov 2016 17:17:32 +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 C428C65AEC; Sat, 19 Nov 2016 17:12:40 +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 uAJHCdN7082604; Sat, 19 Nov 2016 17:12:39 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHCdcb082603; Sat, 19 Nov 2016 17:12:39 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191712.uAJHCdcb082603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 17:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308849 - head/sbin/nvmecontrol X-SVN-Group: head 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, 19 Nov 2016 17:17:32 -0000 Author: imp Date: Sat Nov 19 17:12:39 2016 New Revision: 308849 URL: https://svnweb.freebsd.org/changeset/base/308849 Log: Use a table for pages we know the size of. We have a special case for the error log since it isn't a fixed size. Sponsored by: Netflix, Inc Modified: head/sbin/nvmecontrol/logpage.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:28 2016 (r308848) +++ head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:12:39 2016 (r308849) @@ -222,12 +222,17 @@ print_log_firmware(void *buf, uint32_t s static struct logpage_function { uint8_t log_page; - print_fn_t fn; + print_fn_t print_fn; + size_t size; } logfuncs[] = { - {NVME_LOG_ERROR, print_log_error }, - {NVME_LOG_HEALTH_INFORMATION, print_log_health }, - {NVME_LOG_FIRMWARE_SLOT, print_log_firmware }, - {0, NULL }, + {NVME_LOG_ERROR, print_log_error, + 0}, + {NVME_LOG_HEALTH_INFORMATION, print_log_health, + sizeof(struct nvme_health_information_page)}, + {NVME_LOG_FIRMWARE_SLOT, print_log_firmware, + sizeof(struct nvme_firmware_page)}, + {0, NULL, + 0}, }; static void @@ -308,6 +313,7 @@ logpage(int argc, char *argv[]) } print_fn = print_hex; + size = DEFAULT_SIZE; if (!hexflag) { /* * See if there is a pretty print function for the @@ -317,30 +323,20 @@ logpage(int argc, char *argv[]) f = logfuncs; while (f->log_page > 0) { if (log_page == f->log_page) { - print_fn = f->fn; + print_fn = f->print_fn; + size = f->size; break; } f++; } } - /* Read the log page */ - switch (log_page) { - case NVME_LOG_ERROR: + if (log_page == NVME_LOG_ERROR) { size = sizeof(struct nvme_error_information_entry); size *= (cdata.elpe + 1); - break; - case NVME_LOG_HEALTH_INFORMATION: - size = sizeof(struct nvme_health_information_page); - break; - case NVME_LOG_FIRMWARE_SLOT: - size = sizeof(struct nvme_firmware_page); - break; - default: - size = DEFAULT_SIZE; - break; } + /* Read the log page */ buf = get_log_buffer(size); read_logpage(fd, log_page, nsid, buf, size); print_fn(buf, size); From owner-svn-src-head@freebsd.org Sat Nov 19 17:18:53 2016 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 53B24C4B581; Sat, 19 Nov 2016 17:18:53 +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 6B10D65DE3; Sat, 19 Nov 2016 17:13:09 +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 uAJHD8sv082929; Sat, 19 Nov 2016 17:13:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHD8WN082927; Sat, 19 Nov 2016 17:13:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191713.uAJHD8WN082927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 17:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308855 - in head: sbin/nvmecontrol sys/dev/nvme X-SVN-Group: head 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, 19 Nov 2016 17:18:53 -0000 Author: imp Date: Sat Nov 19 17:13:08 2016 New Revision: 308855 URL: https://svnweb.freebsd.org/changeset/base/308855 Log: Implement HGST Log page 0xc1, as documented in the HGST SN100 and SN150 product manuals. Subpage 0x32 is documented, but not implemented. Sponsored by: Netflix, Inc Modified: head/sbin/nvmecontrol/logpage.c head/sys/dev/nvme/nvme.h Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:13:03 2016 (r308854) +++ head/sbin/nvmecontrol/logpage.c Sat Nov 19 17:13:08 2016 (r308855) @@ -56,6 +56,25 @@ __FBSDID("$FreeBSD$"); typedef void (*print_fn_t)(void *buf, uint32_t size); +struct kv_name +{ + uint32_t key; + const char *name; +}; + +static const char * +kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key) +{ + static char bad[32]; + size_t i; + + for (i = 0; i < kv_count; i++, kv++) + if (kv->key == key) + return kv->name; + snprintf(bad, sizeof(bad), "Attribute %#x", key); + return bad; +} + /* * 128-bit integer augments to standard values */ @@ -283,6 +302,405 @@ print_intel_temp_stats(void *buf, uint32 } /* + * HGST's 0xc1 page. This is a grab bag of additional data. Please see + * https://www.hgst.com/sites/default/files/resources/US_SN150_ProdManual.pdf + * https://www.hgst.com/sites/default/files/resources/US_SN100_ProdManual.pdf + * Appendix A for details + */ + +typedef void (*subprint_fn_t)(void *buf, uint16_t subtype, uint8_t res, uint32_t size); + +struct subpage_print +{ + uint16_t key; + subprint_fn_t fn; +}; + +static void print_hgst_info_write_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_read_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_verify_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_self_test(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_background_scan(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_erase_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_erase_counts(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_temp_history(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_ssd_perf(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_firmware_load(void *buf, uint16_t subtype, uint8_t res, uint32_t size); + +static struct subpage_print hgst_subpage[] = { + { 0x02, print_hgst_info_write_errors }, + { 0x03, print_hgst_info_read_errors }, + { 0x05, print_hgst_info_verify_errors }, + { 0x10, print_hgst_info_self_test }, + { 0x15, print_hgst_info_background_scan }, + { 0x30, print_hgst_info_erase_errors }, + { 0x31, print_hgst_info_erase_counts }, + { 0x32, print_hgst_info_temp_history }, + { 0x37, print_hgst_info_ssd_perf }, + { 0x38, print_hgst_info_firmware_load }, +}; + +/* Print a subpage that is basically just key value pairs */ +static void +print_hgst_info_subpage_gen(void *buf, uint16_t subtype __unused, uint32_t size, + const struct kv_name *kv, size_t kv_count) +{ + uint8_t *wsp, *esp; + uint16_t ptype; + uint8_t plen; + uint64_t param; + int i; + + wsp = buf; + esp = wsp + size; + while (wsp < esp) { + ptype = le16dec(wsp); + wsp += 2; + wsp++; /* Flags, just ignore */ + plen = *wsp++; + param = 0; + for (i = 0; i < plen; i++) + param |= (uint64_t)*wsp++ << (i * 8); + printf(" %-30s: %jd\n", kv_lookup(kv, kv_count, ptype), (uintmax_t)param); + } +} + +static void +print_hgst_info_write_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Writes" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Flash Write Commands" }, + { 0x8001, "HGST Special" }, + }; + + printf("Write Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_read_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Reads" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Flash Read Commands" }, + { 0x8001, "XOR Recovered" }, + { 0x8002, "Total Corrected Bits" }, + }; + + printf("Read Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_verify_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Reads" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Commands Processed" }, + }; + + printf("Verify Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_self_test(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) +{ + size_t i; + uint8_t *walker = buf; + uint16_t code, hrs; + uint32_t lba; + + printf("Self Test Subpage:\n"); + for (i = 0; i < size / 20; i++) { /* Each entry is 20 bytes */ + code = le16dec(walker); + walker += 2; + walker++; /* Ignore fixed flags */ + if (*walker == 0) /* Last entry is zero length */ + break; + if (*walker++ != 0x10) { + printf("Bad length for self test report\n"); + return; + } + printf(" %-30s: %d\n", "Recent Test", code); + printf(" %-28s: %#x\n", "Self-Test Results", *walker & 0xf); + printf(" %-28s: %#x\n", "Self-Test Code", (*walker >> 5) & 0x7); + walker++; + printf(" %-28s: %#x\n", "Self-Test Number", *walker++); + hrs = le16dec(walker); + walker += 2; + lba = le32dec(walker); + walker += 4; + printf(" %-28s: %u\n", "Total Power On Hrs", hrs); + printf(" %-28s: %#jx (%jd)\n", "LBA", (uintmax_t)lba, (uintmax_t)lba); + printf(" %-28s: %#x\n", "Sense Key", *walker++ & 0xf); + printf(" %-28s: %#x\n", "Additional Sense Code", *walker++); + printf(" %-28s: %#x\n", "Additional Sense Qualifier", *walker++); + printf(" %-28s: %#x\n", "Vendor Specific Detail", *walker++); + } +} + +static void +print_hgst_info_background_scan(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) +{ + uint8_t *walker = buf; + uint8_t status; + uint16_t code, nscan, progress; + uint32_t pom, nand; + + printf("Background Media Scan Subpage:\n"); + /* Decode the header */ + code = le16dec(walker); + walker += 2; + walker++; /* Ignore fixed flags */ + if (*walker++ != 0x10) { + printf("Bad length for background scan header\n"); + return; + } + if (code != 0) { + printf("Expceted code 0, found code %#x\n", code); + return; + } + pom = le32dec(walker); + walker += 4; + walker++; /* Reserved */ + status = *walker++; + nscan = le16dec(walker); + walker += 2; + progress = le16dec(walker); + walker += 2; + walker += 6; /* Reserved */ + printf(" %-30s: %d\n", "Power On Minutes", pom); + printf(" %-30s: %x (%s)\n", "BMS Status", status, + status == 0 ? "idle" : (status == 1 ? "active" : (status == 8 ? "suspended" : "unknown"))); + printf(" %-30s: %d\n", "Number of BMS", nscan); + printf(" %-30s: %d\n", "Progress Current BMS", progress); + /* Report retirements */ + if (walker - (uint8_t *)buf != 20) { + printf("Coding error, offset not 20\n"); + return; + } + size -= 20; + printf(" %-30s: %d\n", "BMS retirements", size / 0x18); + while (size > 0) { + code = le16dec(walker); + walker += 2; + walker++; + if (*walker++ != 0x14) { + printf("Bad length parameter\n"); + return; + } + pom = le32dec(walker); + walker += 4; + /* + * Spec sheet says the following are hard coded, if true, just + * print the NAND retirement. + */ + if (walker[0] == 0x41 && + walker[1] == 0x0b && + walker[2] == 0x01 && + walker[3] == 0x00 && + walker[4] == 0x00 && + walker[5] == 0x00 && + walker[6] == 0x00 && + walker[7] == 0x00) { + walker += 8; + walker += 4; /* Skip reserved */ + nand = le32dec(walker); + walker += 4; + printf(" %-30s: %d\n", "Retirement number", code); + printf(" %-28s: %#x\n", "NAND (C/T)BBBPPP", nand); + } else { + printf("Parameter %#x entry corrupt\n", code); + walker += 16; + } + } +} + +static void +print_hgst_info_erase_errors(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Erase" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Flash Erase Commands" }, + { 0x8001, "Mfg Defect Count" }, + { 0x8002, "Grown Defect Count" }, + { 0x8003, "Erase Count -- User" }, + { 0x8004, "Erase Count -- System" }, + }; + + printf("Erase Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_erase_counts(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + /* My drive doesn't export this -- so not coding up */ + printf("XXX: Erase counts subpage: %p, %#x %d\n", buf, subtype, size); +} + +static void +print_hgst_info_temp_history(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size __unused) +{ + uint8_t *walker = buf; + uint32_t min; + + printf("Temperature History:\n"); + printf(" %-30s: %d C\n", "Current Temperature", *walker++); + printf(" %-30s: %d C\n", "Reference Temperature", *walker++); + printf(" %-30s: %d C\n", "Maximum Temperature", *walker++); + printf(" %-30s: %d C\n", "Minimum Temperature", *walker++); + min = le32dec(walker); + walker += 4; + printf(" %-30s: %d:%02d:00\n", "Max Temperture Time", min / 60, min % 60); + min = le32dec(walker); + walker += 4; + printf(" %-30s: %d:%02d:00\n", "Over Temperture Duration", min / 60, min % 60); + min = le32dec(walker); + walker += 4; + printf(" %-30s: %d:%02d:00\n", "Min Temperture Time", min / 60, min % 60); +} + +static void +print_hgst_info_ssd_perf(void *buf, uint16_t subtype __unused, uint8_t res, uint32_t size __unused) +{ + uint8_t *walker = buf; + uint64_t val; + + printf("SSD Performance Subpage Type %d:\n", res); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Read Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Read Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Cache Read Hits Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Cache Read Hits Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Read Commands Stalled", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Odd Start Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Odd End Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Commands Stalled", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Read Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Read Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Write Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Write Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Read Before Writes", val); +} + +static void +print_hgst_info_firmware_load(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size __unused) +{ + uint8_t *walker = buf; + + printf("Firmware Load Subpage:\n"); + printf(" %-30s: %d\n", "Firmware Downloads", le32dec(walker)); +} + +static void +kv_indirect(void *buf, uint32_t subtype, uint8_t res, uint32_t size, struct subpage_print *sp, size_t nsp) +{ + size_t i; + + for (i = 0; i < nsp; i++, sp++) { + if (sp->key == subtype) { + sp->fn(buf, subtype, res, size); + return; + } + } + printf("No handler for page type %x\n", subtype); +} + +static void +print_hgst_info_log(void *buf, uint32_t size __unused) +{ + uint8_t *walker, *end, *subpage; + int pages; + uint16_t len; + uint8_t subtype, res; + + printf("HGST Extra Info Log\n"); + printf("===================\n"); + + walker = buf; + pages = *walker++; + walker++; + len = le16dec(walker); + walker += 2; + end = walker + len; /* Length is exclusive of this header */ + + while (walker < end) { + subpage = walker + 4; + subtype = *walker++ & 0x3f; /* subtype */ + res = *walker++; /* Reserved */ + len = le16dec(walker); + walker += len + 2; /* Length, not incl header */ + if (walker > end) { + printf("Ooops! Off the end of the list\n"); + break; + } + kv_indirect(subpage, subtype, res, len, hgst_subpage, nitems(hgst_subpage)); + } +} + +/* * Table of log page printer / sizing. * * This includes Intel specific pages that are widely implemented. Not @@ -301,6 +719,8 @@ static struct logpage_function { sizeof(struct nvme_firmware_page)}, {INTEL_LOG_TEMP_STATS, print_intel_temp_stats, sizeof(struct intel_log_temp_stats)}, + {HGST_INFO_LOG, print_hgst_info_log, + DEFAULT_SIZE}, {0, NULL, 0}, }; Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sat Nov 19 17:13:03 2016 (r308854) +++ head/sys/dev/nvme/nvme.h Sat Nov 19 17:13:08 2016 (r308855) @@ -669,16 +669,21 @@ enum nvme_log_page { /* 0x80-0xBF - I/O command set specific */ NVME_LOG_RES_NOTIFICATION = 0x80, /* 0xC0-0xFF - vendor specific */ -/* - * The following are Intel Specific log pages, but they seem to - * be widely implemented. - */ + + /* + * The following are Intel Specific log pages, but they seem + * to be widely implemented. + */ INTEL_LOG_READ_LAT_LOG = 0xc1, INTEL_LOG_WRITE_LAT_LOG = 0xc2, INTEL_LOG_TEMP_STATS = 0xc5, INTEL_LOG_ADD_SMART = 0xca, INTEL_LOG_DRIVE_MKT_NAME = 0xdd, + /* + * HGST log page, with lots ofs sub pages. + */ + HGST_INFO_LOG = 0xc1, }; struct nvme_error_information_entry { From owner-svn-src-head@freebsd.org Sat Nov 19 17:19:44 2016 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 80383C4B61C; Sat, 19 Nov 2016 17:19:44 +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 D5C4565C5D; Sat, 19 Nov 2016 17:12:54 +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 uAJHCsNl082764; Sat, 19 Nov 2016 17:12:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHCsCr082763; Sat, 19 Nov 2016 17:12:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611191712.uAJHCsCr082763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 17:12:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308852 - head/sys/dev/nvme X-SVN-Group: head 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, 19 Nov 2016 17:19:44 -0000 Author: imp Date: Sat Nov 19 17:12:53 2016 New Revision: 308852 URL: https://svnweb.freebsd.org/changeset/base/308852 Log: Add log pages defined through NVM Express 1.2.1. Sponsored by: Netflix, Inc Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sat Nov 19 17:12:49 2016 (r308851) +++ head/sys/dev/nvme/nvme.h Sat Nov 19 17:12:53 2016 (r308852) @@ -663,8 +663,11 @@ enum nvme_log_page { NVME_LOG_ERROR = 0x01, NVME_LOG_HEALTH_INFORMATION = 0x02, NVME_LOG_FIRMWARE_SLOT = 0x03, - /* 0x04-0x7F - reserved */ + NVME_LOG_CHANGED_NAMESPACE = 0x04, + NVME_LOG_COMMAND_EFFECT = 0x05, + /* 0x06-0x7F - reserved */ /* 0x80-0xBF - I/O command set specific */ + NVME_LOG_RES_NOTIFICATION = 0x80 /* 0xC0-0xFF - vendor specific */ }; From owner-svn-src-head@freebsd.org Sat Nov 19 17:45:38 2016 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 D9AA9C4B48B for ; Sat, 19 Nov 2016 17:45:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (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 A0DA286F for ; Sat, 19 Nov 2016 17:45:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x242.google.com with SMTP id c20so10026489itb.0 for ; Sat, 19 Nov 2016 09:45:38 -0800 (PST) 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=u5flJTi3wqMJixpArpx9oxQnNko0wT3P1Fm9oZjEt/g=; b=b6397foTQUzPhuQSJ3IiOx9ljjkD4No1GwNniTxvKX6INy9waP1qcM6OlMmfvrK3cf r43qewTSA0dX7gUG7PXW5/KGUQoK7hTTlrbfqBanawukPeTbqUK0tqGNMBY/+1ji4pN9 LZlc5WNBUOc9mWwASZB3vvdzg1GlfQ6Fxxkb6kxQsoRzBms75YUV8Ss58IS9bih0uB+8 duwM4WM9CeGp1VIq1FlMhEw4TeZbcmstmIFWsy4WvUxNXRo/KWWEPx2ZTMx9Wf5K1WR0 JsbfDLNk3HrDvu31X1n5IKhCKrQd85cDZ/hRzOxxf/P/hfUOotpYbLu3cY0kXWd/yBMk XfHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=u5flJTi3wqMJixpArpx9oxQnNko0wT3P1Fm9oZjEt/g=; b=itzsAzq5dUyCAPUX+VYbb3bNIalzWTWrfAXIsukMJdyjIT6FiKaCzCwSYLLNmMNeUF z26yBnPqdmLXUvzlzvt0+eaF1Q2/DGjqSYW+LJn+P4275PWXmbFqd6li4Dd0v1X5YOLL H/qT0x7VLmdAmEADlHyflbyEnNWvNXbjXBYpUwLpJjYPv/iVhBu1T9l6ca9kZXBwDn8M IDR9z2mUGDZZQhFAKrjmPiMYISUXHF2QV72SDnVmRoU2vW5HjFJhpcTuT+uMw18ykHSI fhDzpjDd1oD5vaonUsygY7MO+E/nVVJC/tnIAQlwsL3FVo6PfIqO95bglr1UrtxAx+Mm 5nNQ== X-Gm-Message-State: AKaTC02a0S5Y6Cb3hNFAUhEcWHVlE47Qbm5WMJ9ZRWuLUfx0l6LhDSbd4/mbvkYcSCiusqjxWMp1hgg4bbHGmg== X-Received: by 10.36.41.81 with SMTP id p78mr3662875itp.60.1479577537867; Sat, 19 Nov 2016 09:45:37 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.134.66 with HTTP; Sat, 19 Nov 2016 09:45:37 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <55bcfaee-7045-ad50-b0a9-002055321809@freebsd.org> References: <201611182109.uAIL9vBY084531@repo.freebsd.org> <55bcfaee-7045-ad50-b0a9-002055321809@freebsd.org> From: Warner Losh Date: Sat, 19 Nov 2016 10:45:37 -0700 X-Google-Sender-Auth: HxPdhx_h_V2JnjcZCWO_JmDoc7c Message-ID: Subject: Re: svn commit: r308810 - head/bin/dd To: Sean Bruno Cc: Adrian Chadd , Bartek Rutkowski , "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, 19 Nov 2016 17:45:38 -0000 On Sat, Nov 19, 2016 at 9:39 AM, Sean Bruno wrote: > > > On 11/18/16 16:03, Adrian Chadd wrote: >> fwiw, this breaks -head compilation. >> >> >> >> -a >> > > This seems to not allow head to be built on stable/10 (not strictly > supported, but worked until this commit) ... I haven't tried building > head on stable/11 as of yet, but I assume it will break there too? Actually, strictly speaking, it is supported. Check the revisions in Makefile.inc1 for the latest supported versions. If you can't build head on stable/10, somebody has done something wrong. dd is a bootstrap tool, and may need special treatment. Warner >> On 18 November 2016 at 13:09, Bartek Rutkowski wrote: >>> Author: robak (ports committer) >>> Date: Fri Nov 18 21:09:57 2016 >>> New Revision: 308810 >>> URL: https://svnweb.freebsd.org/changeset/base/308810 >>> >>> Log: >>> Capsicum support for dd(1) >>> >>> Adds Capsicum sandboxing to dd utility. >>> >>> Submitted by: Pawel Biernacki >>> Reviewed by: allanjude, emaste, oshogbo >>> Approved by: oshogbo >>> Sponsored by: Mysterious Code Ltd. >>> Differential Revision: https://reviews.freebsd.org/D8543 >>> >>> Modified: >>> head/bin/dd/dd.c >>> >>> Modified: head/bin/dd/dd.c >>> ============================================================================== >>> --- head/bin/dd/dd.c Fri Nov 18 17:18:05 2016 (r308809) >>> +++ head/bin/dd/dd.c Fri Nov 18 21:09:57 2016 (r308810) >>> @@ -48,10 +48,13 @@ __FBSDID("$FreeBSD$"); >>> #include >>> #include >>> #include >>> +#include >>> #include >>> #include >>> +#include >>> >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -92,6 +95,10 @@ main(int argc __unused, char *argv[]) >>> jcl(argv); >>> setup(); >>> >>> + caph_cache_catpages(); >>> + if (cap_enter() == -1 && errno != ENOSYS) >>> + err(1, "unable to enter capability mode"); >>> + >>> (void)signal(SIGINFO, siginfo_handler); >>> (void)signal(SIGINT, terminate); >>> >>> @@ -125,6 +132,8 @@ static void >>> setup(void) >>> { >>> u_int cnt; >>> + cap_rights_t rights; >>> + unsigned long cmds[] = { FIODTYPE, MTIOCTOP }; >>> >>> if (in.name == NULL) { >>> in.name = "stdin"; >>> @@ -133,13 +142,20 @@ setup(void) >>> in.fd = open(in.name, O_RDONLY, 0); >>> if (in.fd == -1) >>> err(1, "%s", in.name); >>> + if (caph_limit_stdin() == -1) >>> + err(1, "unable to limit capability rights"); >>> } >>> >>> getfdtype(&in); >>> >>> + cap_rights_init(&rights, CAP_READ, CAP_SEEK); >>> + if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS) >>> + err(1, "unable to limit capability rights"); >>> + >>> if (files_cnt > 1 && !(in.flags & ISTAPE)) >>> errx(1, "files is not supported for non-tape devices"); >>> >>> + cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL); >>> if (out.name == NULL) { >>> /* No way to check for read access here. */ >>> out.fd = STDOUT_FILENO; >>> @@ -156,13 +172,27 @@ setup(void) >>> if (out.fd == -1) { >>> out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE); >>> out.flags |= NOREAD; >>> + cap_rights_clear(&rights, CAP_READ); >>> } >>> if (out.fd == -1) >>> err(1, "%s", out.name); >>> + if (caph_limit_stdout() == -1) >>> + err(1, "unable to limit capability rights"); >>> } >>> >>> getfdtype(&out); >>> >>> + if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS) >>> + err(1, "unable to limit capability rights"); >>> + if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 && >>> + errno != ENOSYS) >>> + err(1, "unable to limit capability rights"); >>> + >>> + if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) { >>> + if (caph_limit_stderr() == -1) >>> + err(1, "unable to limit capability rights"); >>> + } >>> + >>> /* >>> * Allocate space for the input and output buffers. If not doing >>> * record oriented I/O, only need a single buffer. >>> >> >> > From owner-svn-src-head@freebsd.org Sat Nov 19 17:46:21 2016 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 81841C4B501; Sat, 19 Nov 2016 17:46:21 +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 249429FB; Sat, 19 Nov 2016 17:46:21 +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 uAJHkKdI095260; Sat, 19 Nov 2016 17:46:20 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHkJQ8095246; Sat, 19 Nov 2016 17:46:19 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611191746.uAJHkJQ8095246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 19 Nov 2016 17:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308857 - in head: bin/dd sys/mips/conf sys/mips/ingenic X-SVN-Group: head 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, 19 Nov 2016 17:46:21 -0000 Author: br Date: Sat Nov 19 17:46:18 2016 New Revision: 308857 URL: https://svnweb.freebsd.org/changeset/base/308857 Log: Bring in support for Ingenic XBurst JZ4780 and X1000 systems on chips. Imgtec CI20 and Ingenic CANNA boards supported. Submitted by: Alexander Kabaev Reviewed by: Ruslan Bukin Sponsored by: DARPA, AFRL Added: head/sys/mips/conf/CANNA (contents, props changed) head/sys/mips/conf/CI20 (contents, props changed) head/sys/mips/conf/JZ4780 (contents, props changed) head/sys/mips/conf/JZ4780.hints (contents, props changed) head/sys/mips/conf/X1000 (contents, props changed) head/sys/mips/conf/X1000.hints (contents, props changed) head/sys/mips/ingenic/ head/sys/mips/ingenic/files.jz4780 (contents, props changed) head/sys/mips/ingenic/files.x1000 (contents, props changed) head/sys/mips/ingenic/jz4780_clk.h (contents, props changed) head/sys/mips/ingenic/jz4780_clk_gen.c (contents, props changed) head/sys/mips/ingenic/jz4780_clk_otg.c (contents, props changed) head/sys/mips/ingenic/jz4780_clk_pll.c (contents, props changed) head/sys/mips/ingenic/jz4780_clock.c (contents, props changed) head/sys/mips/ingenic/jz4780_clock.h (contents, props changed) head/sys/mips/ingenic/jz4780_cpuregs.h (contents, props changed) head/sys/mips/ingenic/jz4780_dme.c (contents, props changed) head/sys/mips/ingenic/jz4780_dwc_fdt.c (contents, props changed) head/sys/mips/ingenic/jz4780_efuse.c (contents, props changed) head/sys/mips/ingenic/jz4780_ehci.c (contents, props changed) head/sys/mips/ingenic/jz4780_gpio.c (contents, props changed) head/sys/mips/ingenic/jz4780_gpio_if.m (contents, props changed) head/sys/mips/ingenic/jz4780_intr.c (contents, props changed) head/sys/mips/ingenic/jz4780_machdep.c (contents, props changed) head/sys/mips/ingenic/jz4780_mmc.c (contents, props changed) head/sys/mips/ingenic/jz4780_mp.c (contents, props changed) head/sys/mips/ingenic/jz4780_mpboot.S (contents, props changed) head/sys/mips/ingenic/jz4780_nand.c (contents, props changed) head/sys/mips/ingenic/jz4780_nemc.c (contents, props changed) head/sys/mips/ingenic/jz4780_ohci.c (contents, props changed) head/sys/mips/ingenic/jz4780_pinctrl.c (contents, props changed) head/sys/mips/ingenic/jz4780_pinctrl.h (contents, props changed) head/sys/mips/ingenic/jz4780_regs.h (contents, props changed) head/sys/mips/ingenic/jz4780_timer.c (contents, props changed) head/sys/mips/ingenic/jz4780_uart.c (contents, props changed) Modified: head/bin/dd/dd.c Modified: head/bin/dd/dd.c ============================================================================== --- head/bin/dd/dd.c Sat Nov 19 17:13:12 2016 (r308856) +++ head/bin/dd/dd.c Sat Nov 19 17:46:18 2016 (r308857) @@ -48,13 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include -#include #include -#include #include #include #include @@ -95,10 +92,6 @@ main(int argc __unused, char *argv[]) jcl(argv); setup(); - caph_cache_catpages(); - if (cap_enter() == -1 && errno != ENOSYS) - err(1, "unable to enter capability mode"); - (void)signal(SIGINFO, siginfo_handler); (void)signal(SIGINT, terminate); @@ -132,8 +125,6 @@ static void setup(void) { u_int cnt; - cap_rights_t rights; - unsigned long cmds[] = { FIODTYPE, MTIOCTOP }; if (in.name == NULL) { in.name = "stdin"; @@ -142,20 +133,13 @@ setup(void) in.fd = open(in.name, O_RDONLY, 0); if (in.fd == -1) err(1, "%s", in.name); - if (caph_limit_stdin() == -1) - err(1, "unable to limit capability rights"); } getfdtype(&in); - cap_rights_init(&rights, CAP_READ, CAP_SEEK); - if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS) - err(1, "unable to limit capability rights"); - if (files_cnt > 1 && !(in.flags & ISTAPE)) errx(1, "files is not supported for non-tape devices"); - cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL); if (out.name == NULL) { /* No way to check for read access here. */ out.fd = STDOUT_FILENO; @@ -172,27 +156,13 @@ setup(void) if (out.fd == -1) { out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE); out.flags |= NOREAD; - cap_rights_clear(&rights, CAP_READ); } if (out.fd == -1) err(1, "%s", out.name); - if (caph_limit_stdout() == -1) - err(1, "unable to limit capability rights"); } getfdtype(&out); - if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS) - err(1, "unable to limit capability rights"); - if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 && - errno != ENOSYS) - err(1, "unable to limit capability rights"); - - if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) { - if (caph_limit_stderr() == -1) - err(1, "unable to limit capability rights"); - } - /* * Allocate space for the input and output buffers. If not doing * record oriented I/O, only need a single buffer. Added: head/sys/mips/conf/CANNA ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/conf/CANNA Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,29 @@ +# CANNA -- Kernel config for Ingenic CANNA board +# +# $FreeBSD$ + +include "X1000" +ident CANNA + +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=ingenic/canna.dts + +#options KTR +#options KTR_CPUMASK=0x3 +#options KTR_MASK=(KTR_GEN) +#options KTR_COMPILE=(KTR_GEN) +#options KTR_VERBOSE + +# Uncomment for NFS root +#options BOOTP +#options BOOTP_NFSROOT +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=dme0 +#options BOOTP_COMPAT +options ROOTDEVNAME=\"ufs:mmcsd0s3\" + +makeoptions TRAMPLOADADDR=0x88000000 + +#options VERBOSE_SYSINIT +options PRINTF_BUFR_SIZE=256 Added: head/sys/mips/conf/CI20 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/conf/CI20 Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,31 @@ +# CI20 -- Kernel config for Creator CI20 board +# +# $FreeBSD$ + +include "JZ4780" +ident CI20 + +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=ingenic/ci20.dts + +#options KTR +#options KTR_CPUMASK=0x3 +#options KTR_MASK=(KTR_GEN) +#options KTR_COMPILE=(KTR_GEN) +#options KTR_VERBOSE + +# Uncomment for NFS root +#options BOOTP +#options BOOTP_NFSROOT +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=dme0 +#options BOOTP_COMPAT + +options ROOTDEVNAME=\"ufs:mmcsd0\" + +makeoptions TRAMPLOADADDR=0x88000000 + +#options VERBOSE_SYSINIT +device dme +options PRINTF_BUFR_SIZE=256 Added: head/sys/mips/conf/JZ4780 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/conf/JZ4780 Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,92 @@ +# JZ4780 -- Kernel config for Ingenic JZ47XX boards +# +# $FreeBSD$ + +ident JZ4780 +machine mips mipsel +cpu CPU_XBURST +cpu CPU_MIPS4KC + +makeoptions KERNLOADADDR=0x80020000 +makeoptions ARCH_FLAGS="-EL -march=mips32r2" + +# Don't build any modules yet. +makeoptions MODULES_OVERRIDE="" + +files "../ingenic/files.jz4780" +hints "JZ4780.hints" #Default places to look for devices. + +makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols + +options INTRNG # Borrow interrupt code from ARM +options MIPS_NIRQ=264 # 8 cpuintc + 64 intc + 6 * 23 gpio + +options DDB +options KDB +options BREAK_TO_DEBUGGER + +options COMPAT_FREEBSD10 + +options SCHED_4BSD #4BSD scheduler +options INET #InterNETworking +options NFSCL #Network Filesystem Client +options NFS_ROOT #NFS usable as /, requires NFSCL +options NFSLOCKD #Network Lock Manager +options PSEUDOFS #Pseudo-filesystem framework +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions + +options FFS #Berkeley Fast Filesystem +options SOFTUPDATES #Enable FFS soft updates support +options UFS_ACL #Support for access control lists +options UFS_DIRHASH #Improve performance on big directories +#options ROOTDEVNAME=\"ufs:ada0\" + +options GEOM_LABEL # Provides labelization +options GEOM_PART_GPT # GUID Partition Tables. +#options GEOM_RAID # Soft RAID functionality. + +# Debugging for use in -current +#options DEADLKRES #Enable the deadlock resolver +options INVARIANTS #Enable calls of extra sanity checking +options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS #Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed + +# Make an SMP-capable kernel by default +# options SMP # Symmetric MultiProcessor Kernel + +device loop +device ether +#device le +device miibus +device bpf +device md +device uart +device random + +device fdt_pinctrl + +device clk +device regulator +device ext_resources + +device gpio + +device scbus +device da + +device mmc +device mmcsd + +# USB support +options USB_DEBUG # enable debug msgs +options USB_HOST_ALIGN=128 # L2 cache line size +device ohci # OHCI PCI->USB interface +device ehci # EHCI PCI->USB interface (USB 2.0) +device dwcotg # DesignWare HS OTG controller +device usb # USB Bus (required) +#device udbp # USB Double Bulk Pipe devices +device uhid # "Human Interface Devices" +#device ulpt # Printer +device umass # Disks/Mass storage - Requires scbus and da +device ums # Mouse Added: head/sys/mips/conf/JZ4780.hints ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/conf/JZ4780.hints Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,2 @@ +# $FreeBSD$ +# device.hints Added: head/sys/mips/conf/X1000 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/conf/X1000 Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,89 @@ +# X1000 -- Kernel config for Ingenic X1000 boards +# +# $FreeBSD$ + +ident X1000 +machine mips mipsel +cpu CPU_XBURST +cpu CPU_MIPS4KC + +makeoptions KERNLOADADDR=0x80020000 +makeoptions ARCH_FLAGS="-EL -march=mips32r2" + +# Don't build any modules yet. +makeoptions MODULES_OVERRIDE="" + +files "../ingenic/files.x1000" +hints "X1000.hints" #Default places to look for devices. + +makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols + +options INTRNG # Borrow interrupt code from ARM +options MIPS_NIRQ=264 # 8 cpuintc + 64 intc + 6 * 23 gpio + +options DDB +options KDB +options BREAK_TO_DEBUGGER + +options COMPAT_FREEBSD10 + +options SCHED_4BSD #4BSD scheduler +options INET #InterNETworking +options NFSCL #Network Filesystem Client +options NFS_ROOT #NFS usable as /, requires NFSCL +options NFSLOCKD #Network Lock Manager +options PSEUDOFS #Pseudo-filesystem framework +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions + +options FFS #Berkeley Fast Filesystem +options SOFTUPDATES #Enable FFS soft updates support +options UFS_ACL #Support for access control lists +options UFS_DIRHASH #Improve performance on big directories +#options ROOTDEVNAME=\"ufs:ada0\" + +options GEOM_LABEL # Provides labelization +options GEOM_PART_GPT # GUID Partition Tables. +#options GEOM_RAID # Soft RAID functionality. + +# Debugging for use in -current +#options DEADLKRES #Enable the deadlock resolver +options INVARIANTS #Enable calls of extra sanity checking +options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS #Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed + +device loop +device ether +#device le +device miibus +device bpf +device md +device uart +device random + +device fdt_pinctrl + +device clk +device regulator +device ext_resources + +device gpio + +device scbus +device da + +device mmc +device mmcsd + +# USB support +#options USB_DEBUG # enable debug msgs +#options USB_HOST_ALIGN=128 # L2 cache line size +#device ohci # OHCI PCI->USB interface +#device ehci # EHCI PCI->USB interface (USB 2.0) +#device dwcotg # DesignWare HS OTG controller +#device usb # USB Bus (required) +#device udbp # USB Double Bulk Pipe devices +#device uhid # "Human Interface Devices" +#device ulpt # Printer +#device umass # Disks/Mass storage - Requires scbus and da +#device ums # Mouse Added: head/sys/mips/conf/X1000.hints ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/conf/X1000.hints Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,2 @@ +# $FreeBSD$ +# device.hints Added: head/sys/mips/ingenic/files.jz4780 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/files.jz4780 Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,26 @@ +# $FreeBSD$ + +mips/ingenic/jz4780_dwc_fdt.c optional dwcotg +mips/ingenic/jz4780_ehci.c optional ehci +mips/ingenic/jz4780_mmc.c optional mmc +mips/ingenic/jz4780_ohci.c optional ohci +mips/ingenic/jz4780_uart.c optional uart + +mips/ingenic/jz4780_clock.c standard +mips/ingenic/jz4780_clk_gen.c standard +mips/ingenic/jz4780_clk_otg.c standard +mips/ingenic/jz4780_clk_pll.c standard +mips/ingenic/jz4780_efuse.c standard +mips/ingenic/jz4780_intr.c standard +mips/ingenic/jz4780_gpio.c standard +mips/ingenic/jz4780_machdep.c standard +mips/ingenic/jz4780_nemc.c standard +mips/ingenic/jz4780_pinctrl.c standard +mips/ingenic/jz4780_timer.c standard + +# SMP +mips/ingenic/jz4780_mp.c optional smp +mips/ingenic/jz4780_mpboot.S optional smp + +# Custom interface between pinctrl and gpio +mips/ingenic/jz4780_gpio_if.m standard Added: head/sys/mips/ingenic/files.x1000 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/files.x1000 Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,17 @@ +# $FreeBSD$ + +mips/ingenic/jz4780_mmc.c optional mmc +mips/ingenic/jz4780_uart.c optional uart + +mips/ingenic/jz4780_clock.c standard +mips/ingenic/jz4780_clk_gen.c standard +mips/ingenic/jz4780_clk_otg.c standard +mips/ingenic/jz4780_clk_pll.c standard +mips/ingenic/jz4780_intr.c standard +mips/ingenic/jz4780_gpio.c standard +mips/ingenic/jz4780_machdep.c standard +mips/ingenic/jz4780_pinctrl.c standard +mips/ingenic/jz4780_timer.c standard + +# Custom interface between pinctrl and gpio +mips/ingenic/jz4780_gpio_if.m standard Added: head/sys/mips/ingenic/jz4780_clk.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/jz4780_clk.h Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,93 @@ +/*- + * Copyright 2015 Alexander Kabaev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MIPS_INGENIC_JZ4780_CLK_H +#define _MIPS_INGENIC_JZ4780_CLK_H + +#include +#include + +/* Convenience bitfiled manipulation macros */ +#define REG_MSK(field) (((1u << field ## _WIDTH) - 1) << field ##_SHIFT) +#define REG_VAL(field, val) ((val) << field ##_SHIFT) +#define REG_CLR(reg, field) ((reg) & ~REG_MSK(field)) +#define REG_GET(reg, field) (((reg) & REG_MSK(field)) >> field ##_SHIFT) +#define REG_SET(reg, field, val) (REG_CLR(reg, field) | REG_VAL(field, val)) + +/* Common clock macros */ +#define CLK_LOCK(_sc) mtx_lock((_sc)->clk_mtx) +#define CLK_UNLOCK(_sc) mtx_unlock((_sc)->clk_mtx) + +#define CLK_WR_4(_sc, off, val) bus_write_4((_sc)->clk_res, (off), (val)) +#define CLK_RD_4(_sc, off) bus_read_4((_sc)->clk_res, (off)) + +struct jz4780_clk_mux_descr { + uint16_t mux_reg; + uint16_t mux_shift: 5; + uint16_t mux_bits: 5; + uint16_t mux_map: 4; /* Map into mux space */ +}; + +struct jz4780_clk_div_descr { + uint16_t div_reg; + uint16_t div_shift: 5; + uint16_t div_bits: 5; + uint16_t div_lg: 5; + int div_ce_bit: 6; /* -1, if CE bit is not present */ + int div_st_bit: 6; /* Can be negative */ + int div_busy_bit: 6; /* Can be negative */ +}; + +struct jz4780_clk_descr { + uint16_t clk_id: 6; + uint16_t clk_type: 3; + int clk_gate_bit: 7; /* Can be negative */ + struct jz4780_clk_mux_descr clk_mux; + struct jz4780_clk_div_descr clk_div; + const char *clk_name; + const char *clk_pnames[4]; +}; + +/* clk_type bits */ +#define CLK_MASK_GATE 0x01 +#define CLK_MASK_DIV 0x02 +#define CLK_MASK_MUX 0x04 + +extern int jz4780_clk_gen_register(struct clkdom *clkdom, + const struct jz4780_clk_descr *descr, struct mtx *dev_mtx, + struct resource *mem_res); + +extern int jz4780_clk_pll_register(struct clkdom *clkdom, + struct clknode_init_def *clkdef, struct mtx *dev_mtx, + struct resource *mem_res, uint32_t mem_reg); + +extern int jz4780_clk_otg_register(struct clkdom *clkdom, + struct clknode_init_def *clkdef, struct mtx *dev_mtx, + struct resource *mem_res); + +#endif /* _MIPS_INGENIC_JZ4780_CLK_PLL_H */ Added: head/sys/mips/ingenic/jz4780_clk_gen.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/jz4780_clk_gen.c Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,317 @@ +/*- + * Copyright 2015 Alexander Kabaev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Ingenic JZ4780 generic CGU clock driver. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +/* JZ4780 generic mux and div clocks implementation */ +static int jz4780_clk_gen_init(struct clknode *clk, device_t dev); +static int jz4780_clk_gen_recalc_freq(struct clknode *clk, uint64_t *freq); +static int jz4780_clk_gen_set_freq(struct clknode *clk, uint64_t fin, + uint64_t *fout, int flags, int *stop); +static int jz4780_clk_gen_set_gate(struct clknode *clk, bool enable); +static int jz4780_clk_gen_set_mux(struct clknode *clk, int src); + +struct jz4780_clk_gen_sc { + struct mtx *clk_mtx; + struct resource *clk_res; + int clk_reg; + const struct jz4780_clk_descr *clk_descr; +}; + +/* + * JZ4780 clock PLL clock methods + */ +static clknode_method_t jz4780_clk_gen_methods[] = { + CLKNODEMETHOD(clknode_init, jz4780_clk_gen_init), + CLKNODEMETHOD(clknode_set_gate, jz4780_clk_gen_set_gate), + CLKNODEMETHOD(clknode_recalc_freq, jz4780_clk_gen_recalc_freq), + CLKNODEMETHOD(clknode_set_freq, jz4780_clk_gen_set_freq), + CLKNODEMETHOD(clknode_set_mux, jz4780_clk_gen_set_mux), + + CLKNODEMETHOD_END +}; +DEFINE_CLASS_1(jz4780_clk_pll, jz4780_clk_gen_class, jz4780_clk_gen_methods, + sizeof(struct jz4780_clk_gen_sc), clknode_class); + +static inline unsigned +mux_to_reg(unsigned src, unsigned map) +{ + unsigned ret, bit; + + bit = (1u << 3); + for (ret = 0; bit; ret++, bit >>= 1) { + if (map & bit) { + if (src-- == 0) + return (ret); + } + } + panic("mux_to_reg"); +} + +static inline unsigned +reg_to_mux(unsigned reg, unsigned map) +{ + unsigned ret, bit; + + bit = (1u << 3); + for (ret = 0; reg; reg--, bit >>= 1) + if (map & bit) + ret++; + return (ret); +} + +static int +jz4780_clk_gen_init(struct clknode *clk, device_t dev) +{ + struct jz4780_clk_gen_sc *sc; + uint32_t reg, msk, parent_idx; + + sc = clknode_get_softc(clk); + CLK_LOCK(sc); + /* Figure our parent out */ + if (sc->clk_descr->clk_type & CLK_MASK_MUX) { + msk = (1u << sc->clk_descr->clk_mux.mux_bits) - 1; + reg = CLK_RD_4(sc, sc->clk_descr->clk_mux.mux_reg); + reg = (reg >> sc->clk_descr->clk_mux.mux_shift) & msk; + parent_idx = reg_to_mux(reg, sc->clk_descr->clk_mux.mux_map); + } else + parent_idx = 0; + CLK_UNLOCK(sc); + + clknode_init_parent_idx(clk, parent_idx); + return (0); +} + +static int +jz4780_clk_gen_recalc_freq(struct clknode *clk, uint64_t *freq) +{ + struct jz4780_clk_gen_sc *sc; + uint32_t reg; + + sc = clknode_get_softc(clk); + + /* Calculate divisor frequency */ + if (sc->clk_descr->clk_type & CLK_MASK_DIV) { + uint32_t msk; + + msk = (1u << sc->clk_descr->clk_div.div_bits) - 1; + reg = CLK_RD_4(sc, sc->clk_descr->clk_div.div_reg); + reg = (reg >> sc->clk_descr->clk_div.div_shift) & msk; + reg = (reg + 1) << sc->clk_descr->clk_div.div_lg; + *freq /= reg; + } + return (0); +} + +#define DIV_TIMEOUT 100 + +static int +jz4780_clk_gen_set_freq(struct clknode *clk, uint64_t fin, + uint64_t *fout, int flags, int *stop) +{ + struct jz4780_clk_gen_sc *sc; + uint64_t _fout; + uint32_t divider, div_reg, div_msk, reg; + int rv; + + sc = clknode_get_softc(clk); + + divider = fin / *fout; + + /* Adjust for divider multiplier */ + div_reg = divider >> sc->clk_descr->clk_div.div_lg; + divider = div_reg << sc->clk_descr->clk_div.div_lg; + + _fout = fin / divider; + + /* Rounding */ + if ((flags & CLK_SET_ROUND_UP) && (*fout < _fout)) + div_reg--; + else if ((flags & CLK_SET_ROUND_DOWN) && (*fout > _fout)) + div_reg++; + if (div_reg == 0) + div_reg = 1; + + div_msk = (1u << sc->clk_descr->clk_div.div_bits) - 1; + + *stop = 1; + if (div_reg > div_msk + 1) { + *stop = 0; + div_reg = div_msk; + } + + divider = (div_reg << sc->clk_descr->clk_div.div_lg); + div_reg--; + + if ((flags & CLK_SET_DRYRUN) != 0) { + if (*stop != 0 && *fout != fin / divider && + (flags & (CLK_SET_ROUND_UP | CLK_SET_ROUND_DOWN)) == 0) + return (ERANGE); + *fout = fin / divider; + return (0); + } + + CLK_LOCK(sc); + /* Apply the new divider value */ + reg = CLK_RD_4(sc, sc->clk_descr->clk_div.div_reg); + reg &= ~(div_msk << sc->clk_descr->clk_div.div_shift); + reg |= (div_reg << sc->clk_descr->clk_div.div_shift); + /* Set the change enable bit, it present */ + if (sc->clk_descr->clk_div.div_ce_bit >= 0) + reg |= (1u << sc->clk_descr->clk_div.div_ce_bit); + /* Clear stop bit, it present */ + if (sc->clk_descr->clk_div.div_st_bit >= 0) + reg &= ~(1u << sc->clk_descr->clk_div.div_st_bit); + /* Initiate the change */ + CLK_WR_4(sc, sc->clk_descr->clk_div.div_reg, reg); + + /* Wait for busy bit to clear indicating the change is complete */ + rv = 0; + if (sc->clk_descr->clk_div.div_busy_bit >= 0) { + int i; + + for (i = 0; i < DIV_TIMEOUT; i++) { + reg = CLK_RD_4(sc, sc->clk_descr->clk_div.div_reg); + if (!(reg & (1u << sc->clk_descr->clk_div.div_busy_bit))) + break; + DELAY(1000); + } + if (i == DIV_TIMEOUT) + rv = ETIMEDOUT; + } + CLK_UNLOCK(sc); + + *fout = fin / divider; + return (rv); +} + +static int +jz4780_clk_gen_set_mux(struct clknode *clk, int src) +{ + struct jz4780_clk_gen_sc *sc; + uint32_t reg, msk; + + sc = clknode_get_softc(clk); + + /* Only mux nodes are capable of being reparented */ + if (!(sc->clk_descr->clk_type & CLK_MASK_MUX)) + return (src ? EINVAL : 0); + + msk = (1u << sc->clk_descr->clk_mux.mux_bits) - 1; + src = mux_to_reg(src & msk, sc->clk_descr->clk_mux.mux_map); + + CLK_LOCK(sc); + reg = CLK_RD_4(sc, sc->clk_descr->clk_mux.mux_reg); + reg &= ~(msk << sc->clk_descr->clk_mux.mux_shift); + reg |= (src << sc->clk_descr->clk_mux.mux_shift); + CLK_WR_4(sc, sc->clk_descr->clk_mux.mux_reg, reg); + CLK_UNLOCK(sc); + + return (0); +} + +static int +jz4780_clk_gen_set_gate(struct clknode *clk, bool enable) +{ + struct jz4780_clk_gen_sc *sc; + uint32_t off, reg, bit; + + sc = clknode_get_softc(clk); + + /* Check is clock can be gated */ + if (sc->clk_descr->clk_gate_bit < 0) + return 0; + + bit = sc->clk_descr->clk_gate_bit; + if (bit < 32) { + off = JZ_CLKGR0; + } else { + off = JZ_CLKGR1; + bit -= 32; + } + + CLK_LOCK(sc); + reg = CLK_RD_4(sc, off); + if (enable) + reg &= ~(1u << bit); + else + reg |= (1u << bit); + CLK_WR_4(sc, off, reg); + CLK_UNLOCK(sc); + + return (0); +} + + +int jz4780_clk_gen_register(struct clkdom *clkdom, + const struct jz4780_clk_descr *descr, struct mtx *dev_mtx, + struct resource *mem_res) +{ + struct clknode_init_def clkdef; + struct clknode *clk; + struct jz4780_clk_gen_sc *sc; + + clkdef.id = descr->clk_id; + clkdef.name = __DECONST(char *, descr->clk_name); + /* Silly const games to work around API deficiency */ + clkdef.parent_names = (const char **)(uintptr_t)&descr->clk_pnames[0]; + clkdef.flags = CLK_NODE_STATIC_STRINGS; + if (descr->clk_type & CLK_MASK_MUX) + clkdef.parent_cnt = __bitcount16(descr->clk_mux.mux_map); + else + clkdef.parent_cnt = 1; + + clk = clknode_create(clkdom, &jz4780_clk_gen_class, &clkdef); + if (clk == NULL) + return (1); + + sc = clknode_get_softc(clk); + sc->clk_mtx = dev_mtx; + sc->clk_res = mem_res; + sc->clk_descr = descr; + clknode_register(clkdom, clk); + + return (0); +} Added: head/sys/mips/ingenic/jz4780_clk_otg.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/jz4780_clk_otg.c Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,167 @@ +/*- + * Copyright 2015 Alexander Kabaev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Ingenic JZ4780 OTG PHY clock driver. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +/* JZ4780 OTG PHY clock */ +static int jz4780_clk_otg_init(struct clknode *clk, device_t dev); +static int jz4780_clk_otg_recalc_freq(struct clknode *clk, uint64_t *freq); +static int jz4780_clk_otg_set_freq(struct clknode *clk, uint64_t fin, + uint64_t *fout, int flags, int *stop); + +struct jz4780_clk_otg_sc { + struct mtx *clk_mtx; + struct resource *clk_res; +}; + +/* + * JZ4780 OTG PHY clock methods + */ +static clknode_method_t jz4780_clk_otg_methods[] = { + CLKNODEMETHOD(clknode_init, jz4780_clk_otg_init), + CLKNODEMETHOD(clknode_recalc_freq, jz4780_clk_otg_recalc_freq), + CLKNODEMETHOD(clknode_set_freq, jz4780_clk_otg_set_freq), + + CLKNODEMETHOD_END +}; +DEFINE_CLASS_1(jz4780_clk_pll, jz4780_clk_otg_class, jz4780_clk_otg_methods, + sizeof(struct jz4780_clk_otg_sc), clknode_class); + +static int +jz4780_clk_otg_init(struct clknode *clk, device_t dev) +{ + struct jz4780_clk_otg_sc *sc; + uint32_t reg; + + sc = clknode_get_softc(clk); + CLK_LOCK(sc); + /* Force the use fo the core clock */ + reg = CLK_RD_4(sc, JZ_USBPCR1); + reg &= ~PCR_REFCLK_M; + reg |= PCR_REFCLK_CORE; + CLK_WR_4(sc, JZ_USBPCR1, reg); + CLK_UNLOCK(sc); + + clknode_init_parent_idx(clk, 0); + return (0); +} + +static const struct { + uint32_t div_val; + uint32_t freq; +} otg_div_table[] = { + { PCR_CLK_12, 12000000 }, + { PCR_CLK_192, 19200000 }, + { PCR_CLK_24, 24000000 }, + { PCR_CLK_48, 48000000 } +}; + +static int +jz4780_clk_otg_recalc_freq(struct clknode *clk, uint64_t *freq) +{ + struct jz4780_clk_otg_sc *sc; + uint32_t reg; + int i; + + sc = clknode_get_softc(clk); + reg = CLK_RD_4(sc, JZ_USBPCR1); + reg &= PCR_CLK_M; + + for (i = 0; i < nitems(otg_div_table); i++) + if (otg_div_table[i].div_val == reg) + *freq = otg_div_table[i].freq; + return (0); +} + +static int +jz4780_clk_otg_set_freq(struct clknode *clk, uint64_t fin, + uint64_t *fout, int flags, int *stop) +{ + struct jz4780_clk_otg_sc *sc; + uint32_t reg; + int i; + + sc = clknode_get_softc(clk); + + for (i = 0; i < nitems(otg_div_table) - 1; i++) { + if (*fout < (otg_div_table[i].freq + otg_div_table[i + 1].freq) / 2) + break; + } + + *fout = otg_div_table[i].freq; + + *stop = 1; + if (flags & CLK_SET_DRYRUN) + return (0); + + CLK_LOCK(sc); + reg = CLK_RD_4(sc, JZ_USBPCR1); + /* Set the calculated values */ + reg &= ~PCR_CLK_M; + reg |= otg_div_table[i].div_val; + /* Initiate the change */ + CLK_WR_4(sc, JZ_USBPCR1, reg); + CLK_UNLOCK(sc); + + return (0); +} + +int jz4780_clk_otg_register(struct clkdom *clkdom, + struct clknode_init_def *clkdef, struct mtx *dev_mtx, + struct resource *mem_res) +{ + struct clknode *clk; + struct jz4780_clk_otg_sc *sc; + + clk = clknode_create(clkdom, &jz4780_clk_otg_class, clkdef); + if (clk == NULL) + return (1); + + sc = clknode_get_softc(clk); + sc->clk_mtx = dev_mtx; + sc->clk_res = mem_res; + clknode_register(clkdom, clk); + return (0); +} Added: head/sys/mips/ingenic/jz4780_clk_pll.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/jz4780_clk_pll.c Sat Nov 19 17:46:18 2016 (r308857) @@ -0,0 +1,234 @@ +/*- + * Copyright 2015 Alexander Kabaev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Nov 19 17:51:04 2016 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 06FD7C4B645; Sat, 19 Nov 2016 17:51:04 +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 B0E74DBD; Sat, 19 Nov 2016 17:51:03 +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 uAJHp2rW097168; Sat, 19 Nov 2016 17:51:02 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJHp2Tu097167; Sat, 19 Nov 2016 17:51:02 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611191751.uAJHp2Tu097167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 19 Nov 2016 17:51:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308858 - head/bin/dd X-SVN-Group: head 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, 19 Nov 2016 17:51:04 -0000 Author: br Date: Sat Nov 19 17:51:02 2016 New Revision: 308858 URL: https://svnweb.freebsd.org/changeset/base/308858 Log: Restore dd changes included accidentally in r308857. Modified: head/bin/dd/dd.c Modified: head/bin/dd/dd.c ============================================================================== --- head/bin/dd/dd.c Sat Nov 19 17:46:18 2016 (r308857) +++ head/bin/dd/dd.c Sat Nov 19 17:51:02 2016 (r308858) @@ -48,10 +48,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include +#include #include #include #include @@ -92,6 +95,10 @@ main(int argc __unused, char *argv[]) jcl(argv); setup(); + caph_cache_catpages(); + if (cap_enter() == -1 && errno != ENOSYS) + err(1, "unable to enter capability mode"); + (void)signal(SIGINFO, siginfo_handler); (void)signal(SIGINT, terminate); @@ -125,6 +132,8 @@ static void setup(void) { u_int cnt; + cap_rights_t rights; + unsigned long cmds[] = { FIODTYPE, MTIOCTOP }; if (in.name == NULL) { in.name = "stdin"; @@ -133,13 +142,20 @@ setup(void) in.fd = open(in.name, O_RDONLY, 0); if (in.fd == -1) err(1, "%s", in.name); + if (caph_limit_stdin() == -1) + err(1, "unable to limit capability rights"); } getfdtype(&in); + cap_rights_init(&rights, CAP_READ, CAP_SEEK); + if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS) + err(1, "unable to limit capability rights"); + if (files_cnt > 1 && !(in.flags & ISTAPE)) errx(1, "files is not supported for non-tape devices"); + cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL); if (out.name == NULL) { /* No way to check for read access here. */ out.fd = STDOUT_FILENO; @@ -156,13 +172,27 @@ setup(void) if (out.fd == -1) { out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE); out.flags |= NOREAD; + cap_rights_clear(&rights, CAP_READ); } if (out.fd == -1) err(1, "%s", out.name); + if (caph_limit_stdout() == -1) + err(1, "unable to limit capability rights"); } getfdtype(&out); + if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS) + err(1, "unable to limit capability rights"); + if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 && + errno != ENOSYS) + err(1, "unable to limit capability rights"); + + if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) { + if (caph_limit_stderr() == -1) + err(1, "unable to limit capability rights"); + } + /* * Allocate space for the input and output buffers. If not doing * record oriented I/O, only need a single buffer. From owner-svn-src-head@freebsd.org Sat Nov 19 17:52:35 2016 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 CA800C4B7AA; Sat, 19 Nov 2016 17:52:35 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-41.csi.cam.ac.uk (ppsw-41.csi.cam.ac.uk [131.111.8.141]) by mx1.freebsd.org (Postfix) with ESMTP id 98454115C; Sat, 19 Nov 2016 17:52:34 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:34116) by ppsw-41.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1c89oX-0008Eb-SR (Exim 4.86_36-e07b163) (return-path ); Sat, 19 Nov 2016 17:52:33 +0000 Date: Sat, 19 Nov 2016 17:51:42 +0000 From: Ruslan Bukin To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308857 - in head: bin/dd sys/mips/conf sys/mips/ingenic Message-ID: <20161119175142.GA65925@bsdpad.com> References: <201611191746.uAJHkJQ8095246@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201611191746.uAJHkJQ8095246@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" 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, 19 Nov 2016 17:52:35 -0000 On Sat, Nov 19, 2016 at 05:46:19PM +0000, Ruslan Bukin wrote: > Author: br > Date: Sat Nov 19 17:46:18 2016 > New Revision: 308857 > URL: https://svnweb.freebsd.org/changeset/base/308857 > > Log: > Bring in support for Ingenic XBurst JZ4780 and > X1000 systems on chips. > > Imgtec CI20 and Ingenic CANNA boards supported. > > Submitted by: Alexander Kabaev > Reviewed by: Ruslan Bukin > Sponsored by: DARPA, AFRL > > Modified: > head/bin/dd/dd.c Ooops. Sorry. Ruslan From owner-svn-src-head@freebsd.org Sat Nov 19 18:03:47 2016 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 A2D20C4B96C; Sat, 19 Nov 2016 18:03:47 +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 732C71641; Sat, 19 Nov 2016 18:03:47 +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 uAJI3k0d003230; Sat, 19 Nov 2016 18:03:46 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJI3kJX003228; Sat, 19 Nov 2016 18:03:46 GMT (envelope-from br@FreeBSD.org) Message-Id: <201611191803.uAJI3kJX003228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 19 Nov 2016 18:03:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308859 - in head/sys/mips: conf mips X-SVN-Group: head 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, 19 Nov 2016 18:03:47 -0000 Author: br Date: Sat Nov 19 18:03:46 2016 New Revision: 308859 URL: https://svnweb.freebsd.org/changeset/base/308859 Log: Enable SMP on Ingenic JZ4780. It is required to proceed full cache flush before we can use wait instruction on multicore, so use nop instead for now. Submitted by: kan Sponsored by: DARPA, AFRL Modified: head/sys/mips/conf/JZ4780 head/sys/mips/mips/exception.S Modified: head/sys/mips/conf/JZ4780 ============================================================================== --- head/sys/mips/conf/JZ4780 Sat Nov 19 17:51:02 2016 (r308858) +++ head/sys/mips/conf/JZ4780 Sat Nov 19 18:03:46 2016 (r308859) @@ -53,7 +53,7 @@ options INVARIANT_SUPPORT #Extra sanity #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed # Make an SMP-capable kernel by default -# options SMP # Symmetric MultiProcessor Kernel +options SMP # Symmetric MultiProcessor Kernel device loop device ether Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Sat Nov 19 17:51:02 2016 (r308858) +++ head/sys/mips/mips/exception.S Sat Nov 19 18:03:46 2016 (r308859) @@ -590,7 +590,11 @@ GLOBAL(MipsWaitStart) # this is 16 byt mtc0 t1, MIPS_COP_0_STATUS bnez v0, MipsWaitEnd nop +#if defined(CPU_XBURST) && defined(SMP) + nop +#else wait +#endif GLOBAL(MipsWaitEnd) # MipsWaitStart + 16 jr ra PTR_ADDU sp, sp, CALLFRAME_SIZ From owner-svn-src-head@freebsd.org Sat Nov 19 18:19:22 2016 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 B3FB8C4BE40; Sat, 19 Nov 2016 18:19:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A5921EEE; Sat, 19 Nov 2016 18:19:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJIJLfb007644; Sat, 19 Nov 2016 18:19:21 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJIJLA1007643; Sat, 19 Nov 2016 18:19:21 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611191819.uAJIJLA1007643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 19 Nov 2016 18:19:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308860 - head/bin/dd X-SVN-Group: head 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, 19 Nov 2016 18:19:22 -0000 Author: adrian Date: Sat Nov 19 18:19:21 2016 New Revision: 308860 URL: https://svnweb.freebsd.org/changeset/base/308860 Log: [dd] Revert the capsicum bits for now until it gets fixed. dd is a bootstrap tool and that header isn't installed as part of the bootstrap environment for previous releases (eg freebsd-10.) We'll figure it out in post and then re-commit it. Modified: head/bin/dd/dd.c Modified: head/bin/dd/dd.c ============================================================================== --- head/bin/dd/dd.c Sat Nov 19 18:03:46 2016 (r308859) +++ head/bin/dd/dd.c Sat Nov 19 18:19:21 2016 (r308860) @@ -48,13 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include -#include #include -#include #include #include #include @@ -95,10 +92,6 @@ main(int argc __unused, char *argv[]) jcl(argv); setup(); - caph_cache_catpages(); - if (cap_enter() == -1 && errno != ENOSYS) - err(1, "unable to enter capability mode"); - (void)signal(SIGINFO, siginfo_handler); (void)signal(SIGINT, terminate); @@ -132,8 +125,6 @@ static void setup(void) { u_int cnt; - cap_rights_t rights; - unsigned long cmds[] = { FIODTYPE, MTIOCTOP }; if (in.name == NULL) { in.name = "stdin"; @@ -142,20 +133,13 @@ setup(void) in.fd = open(in.name, O_RDONLY, 0); if (in.fd == -1) err(1, "%s", in.name); - if (caph_limit_stdin() == -1) - err(1, "unable to limit capability rights"); } getfdtype(&in); - cap_rights_init(&rights, CAP_READ, CAP_SEEK); - if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS) - err(1, "unable to limit capability rights"); - if (files_cnt > 1 && !(in.flags & ISTAPE)) errx(1, "files is not supported for non-tape devices"); - cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL); if (out.name == NULL) { /* No way to check for read access here. */ out.fd = STDOUT_FILENO; @@ -172,27 +156,13 @@ setup(void) if (out.fd == -1) { out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE); out.flags |= NOREAD; - cap_rights_clear(&rights, CAP_READ); } if (out.fd == -1) err(1, "%s", out.name); - if (caph_limit_stdout() == -1) - err(1, "unable to limit capability rights"); } getfdtype(&out); - if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS) - err(1, "unable to limit capability rights"); - if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 && - errno != ENOSYS) - err(1, "unable to limit capability rights"); - - if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) { - if (caph_limit_stderr() == -1) - err(1, "unable to limit capability rights"); - } - /* * Allocate space for the input and output buffers. If not doing * record oriented I/O, only need a single buffer. From owner-svn-src-head@freebsd.org Sat Nov 19 18:30:54 2016 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 C4F8AC4B392 for ; Sat, 19 Nov 2016 18:30:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x232.google.com (mail-it0-x232.google.com [IPv6:2607:f8b0:4001:c0b::232]) (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 8C0041086 for ; Sat, 19 Nov 2016 18:30:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x232.google.com with SMTP id l8so62395461iti.1 for ; Sat, 19 Nov 2016 10:30:54 -0800 (PST) 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=qPIDOjiE0htpc6Y/LUA0YF5/dcvKXA52un8FS7xideA=; b=EMC6NV0sDb9MITIi60U0c8S3asXhxwj3w6Num4KKhkWe4kHbYYb649NHGPUfH16K4M +mf98gl/taF1q35wTfWWgcnAmwGv6309bhTcUqQSkc1z6ArAri6/3CF0UxX/frHjWwdT OGgodw9hdKYYTjnmqAf2HidEAiopbWlkmdIvsDnl5PNjlVgw2cIjGBzAckQcMAg/nFpX LToVnWv8mIzydCbUIqxPJb5xKIBfgvz7ouKDThs5FiNZG6YxTXeshspqrEhXwshAgcmu lIF1e/lI2yahyWgXYnipzL0Qs+xTCThYliGL8ZFxO1wI4YmQVmD2n0KceMblNLN87aaj 48Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=qPIDOjiE0htpc6Y/LUA0YF5/dcvKXA52un8FS7xideA=; b=AIAx4TBTzgVgxUHFYwZa2aRe5KlUHU2D941OnuKsfoS5Q++aAtwgFEVx2iggxmAjup mJw1rksfP2wfx+yFyJ05hnLa1ZCvBHr3mrlPGPyfTIDVZjSCnaxg9UzstvNwBc+T4uxp UeMRTxepHxST2eIM/x0WNqGo+tf9cIldBVwYdE05/lvzn0pgDFD35I+kJDwObsqJSKaI aqQF7di6Ey2y4Ddgqo8ZhtUCcdh8ck+56K6oVW/1wEyktb9cnjGd+qoKY7Tv6uStdjKR ldheGRmeFhBWoPUR8wlX2vjtKw9owwQeGoV/6WZrbsl0SBijpRlG6E49eac6qM9GCbxE r9iA== X-Gm-Message-State: AKaTC022RTYOhFtStsg2URVzKUFPVM3l/lSZqt2fs2HTV2h32UQdr436pBCfCrxFwPMwR7fDTcGX9zaAnnfT1A== X-Received: by 10.36.5.208 with SMTP id 199mr3265479itl.103.1479580253907; Sat, 19 Nov 2016 10:30:53 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.134.66 with HTTP; Sat, 19 Nov 2016 10:30:53 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201611182109.uAIL9vBY084531@repo.freebsd.org> <55bcfaee-7045-ad50-b0a9-002055321809@freebsd.org> From: Warner Losh Date: Sat, 19 Nov 2016 11:30:53 -0700 X-Google-Sender-Auth: POCq6JfyBx7ALAVuTVUYf3HqLYA Message-ID: Subject: Re: svn commit: r308810 - head/bin/dd To: Sean Bruno Cc: Adrian Chadd , Bartek Rutkowski , "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, 19 Nov 2016 18:30:54 -0000 On Sat, Nov 19, 2016 at 10:45 AM, Warner Losh wrote: > On Sat, Nov 19, 2016 at 9:39 AM, Sean Bruno wrote: >> >> >> On 11/18/16 16:03, Adrian Chadd wrote: >>> fwiw, this breaks -head compilation. >>> >>> >>> >>> -a >>> >> >> This seems to not allow head to be built on stable/10 (not strictly >> supported, but worked until this commit) ... I haven't tried building >> head on stable/11 as of yet, but I assume it will break there too? > > Actually, strictly speaking, it is supported. Check the revisions in > Makefile.inc1 for the latest supported versions. > If you can't build head on stable/10, somebody has done something > wrong. dd is a bootstrap tool, and may need > special treatment. What likely makes the most sense is to create libegacy bindings for Capsicum that makes it 100% a nop so we don't need to keep litigating this battle. Warner From owner-svn-src-head@freebsd.org Sat Nov 19 19:47:52 2016 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 ADC9FC4B551; Sat, 19 Nov 2016 19:47:52 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 797BD1ABD; Sat, 19 Nov 2016 19:47:51 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.16.0.17/8.16.0.17) with SMTP id uAJBZ0S6013943; Sat, 19 Nov 2016 13:47:44 -0600 Received: from mh3.mail.rice.edu (mh3.mail.rice.edu [128.42.199.10]) by pp1.rice.edu with ESMTP id 26tjv9r4qy-1; Sat, 19 Nov 2016 13:47:44 -0600 X-Virus-Scanned: by amavis-2.7.0 at mh3.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh3.mail.rice.edu (Postfix) with ESMTPSA id C0EA840134; Sat, 19 Nov 2016 13:47:43 -0600 (CST) Subject: Re: svn commit: r308691 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs kern vm To: Ruslan Bukin References: <201611151822.uAFIMoj2092581@repo.freebsd.org> <20161116133718.GA10251@bsdpad.com> <20161116165343.GX54029@kib.kiev.ua> <20161116165939.GA12498@bsdpad.com> <20161116175210.GA13203@bsdpad.com> <9047aad0-0713-5d7a-f92e-6f931642bb27@rice.edu> <20161118102235.GA40554@bsdpad.com> Cc: Konstantin Belousov , Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Alan Cox Message-ID: <31420999-26bb-c1fc-acee-8e2e20f42830@rice.edu> Date: Sat, 19 Nov 2016 13:47:43 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161118102235.GA40554@bsdpad.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611190142 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, 19 Nov 2016 19:47:52 -0000 On 11/18/2016 04:22, Ruslan Bukin wrote: > On Thu, Nov 17, 2016 at 10:51:40AM -0600, Alan Cox wrote: >> On 11/16/2016 11:52, Ruslan Bukin wrote: >>> On Wed, Nov 16, 2016 at 04:59:39PM +0000, Ruslan Bukin wrote: >>>> On Wed, Nov 16, 2016 at 06:53:43PM +0200, Konstantin Belousov wrote: >>>>> On Wed, Nov 16, 2016 at 01:37:18PM +0000, Ruslan Bukin wrote: >>>>>> I have a panic with this on RISC-V. Any ideas ? >>>>> How did you checked that the revision you replied to, makes the problem ? >>>>> Note that the backtrace below is not reasonable. >>>> I reverted this commit like that and rebuilt kernel: >>>> git show 2fa36073055134deb2df39c7ca46264cfc313d77 | patch -p1 -R >>>> >>>> So the problem is reproducible on dual-core with 32mb mdroot. >>>> >>> I just found another interesting behavior: >>> depending on amount of physical memory : >>> 700m - panic >>> 800m - works fine >>> 1024m - panic >> I think that this behavior is not inconsistent with your report of the >> system crashing if you enabled two cores but not one. Specifically, >> changing the number of active cores will slightly affect the amount of >> memory that is allocated during initialization. >> >> There is nothing unusual in the sysctl output that you sent out. >> >> I have two suggestions. Try these in order. >> >> 1. r308691 reduced the size of struct vm_object. Try undoing the one >> snippet that reduced the vm object size and see if that makes a difference. >> >> >> @@ -118,7 +118,6 @@ >> vm_ooffset_t backing_object_offset;/* Offset in backing object */ >> TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ >> LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ >> - struct vm_radix cache; /* (o + f) root of the cache page radix trie */ >> void *handle; >> union { >> /* >> >> >> 2. I'd like to know if vm_page_scan_contig() is being called. >> >> Finally, to simply the situation a little, I would suggest that you >> disable superpage reservations in vmparam.h. You have no need for them. >> >> > I made another one merge from svn-head and problem disappeared for 700m,1024m of physical memory, but now I able to reproduce it with 900m of physical memory. > > Restoring 'struct vm_radix cache' in struct vm_object gives no behavior changes. > > Adding a panic() call to vm_page_scan_contig gives an original panic (so vm_page_scan_contig is not called), > it looks like size of function is changed and it unhides the original problem. > > Disable superpage reservations changes behavior and gives same panic on 1024m boot. I would still encourage you to commit a change disabling reservations in vmparam.h until support for superpages is added to the riscv pmap. From owner-svn-src-head@freebsd.org Sat Nov 19 21:46:14 2016 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 97F0AC4B37C; Sat, 19 Nov 2016 21:46:14 +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 684EB1A5E; Sat, 19 Nov 2016 21:46:14 +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 uAJLkDVo094318; Sat, 19 Nov 2016 21:46:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJLkDP5094317; Sat, 19 Nov 2016 21:46:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201611192146.uAJLkDP5094317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 19 Nov 2016 21:46:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308869 - head/sbin/nvmecontrol X-SVN-Group: head 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, 19 Nov 2016 21:46:14 -0000 Author: imp Date: Sat Nov 19 21:46:13 2016 New Revision: 308869 URL: https://svnweb.freebsd.org/changeset/base/308869 Log: i386 turns out to not have __uint128_t. So confusingly use 64-bit math instead. Since we're little endian, we can get away with it. Also, since the counters in quesitons would require billions of iops for tens of billions of seconds to overflow, and since such data rates are unlikely for people using i386 for a while, that's OK. The fastest cards today can't do even a million IOPs. Noticed by: dim@ Sponsored by: Netflix, Inc Modified: head/sbin/nvmecontrol/logpage.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sat Nov 19 21:10:46 2016 (r308868) +++ head/sbin/nvmecontrol/logpage.c Sat Nov 19 21:46:13 2016 (r308869) @@ -75,10 +75,18 @@ kv_lookup(const struct kv_name *kv, size } /* - * 128-bit integer augments to standard values + * 128-bit integer augments to standard values. On i386 this + * doesn't exist, so we use 64-bit values. The 128-bit counters + * are crazy anyway, since for this purpose, you'd need a + * billion IOPs for billions of seconds to overflow them. + * So, on 32-bit i386, you'll get truncated values. */ #define UINT128_DIG 39 +#ifdef __i386__ +typedef uint64_t uint128_t; +#else typedef __uint128_t uint128_t; +#endif static inline uint128_t to128(void *p) From owner-svn-src-head@freebsd.org Sat Nov 19 23:58:51 2016 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 85D07C4B48B; Sat, 19 Nov 2016 23:58:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B85C14A1; Sat, 19 Nov 2016 23:58:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAJNwokc046039; Sat, 19 Nov 2016 23:58:50 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAJNwovA046038; Sat, 19 Nov 2016 23:58:50 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201611192358.uAJNwovA046038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 19 Nov 2016 23:58:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308871 - head/sbin/umount X-SVN-Group: head 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, 19 Nov 2016 23:58:51 -0000 Author: rmacklem Date: Sat Nov 19 23:58:50 2016 New Revision: 308871 URL: https://svnweb.freebsd.org/changeset/base/308871 Log: Modify umount so that it does not do an Unmount RPC for NFSv4 mounts and uses TCP for the Unmount RPC if the mount is over TCP. Without this patch, umount does an Unmount RPC over UDP for all NFS mounts. Suggested by: cperciva Reviewed by: cperciva MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D8503 Modified: head/sbin/umount/umount.c Modified: head/sbin/umount/umount.c ============================================================================== --- head/sbin/umount/umount.c Sat Nov 19 22:01:58 2016 (r308870) +++ head/sbin/umount/umount.c Sat Nov 19 23:58:50 2016 (r308871) @@ -49,6 +49,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -323,6 +324,9 @@ umountfs(struct statfs *sfs) CLIENT *clp; char *nfsdirname, *orignfsdirname; char *hostp, *delimp; + char buf[1024]; + struct nfscl_dumpmntopts dumpmntopts; + const char *proto_ptr = NULL; ai = NULL; do_rpc = 0; @@ -361,8 +365,24 @@ umountfs(struct statfs *sfs) * mount from mntfromname that is still mounted. */ if (getmntentry(sfs->f_mntfromname, NULL, NULL, - CHECKUNIQUE) != NULL) + CHECKUNIQUE) != NULL) { do_rpc = 1; + proto_ptr = "udp"; + /* + * Try and find out whether this NFS mount is NFSv4 and + * what protocol is being used. If this fails, the + * default is NFSv2,3 and use UDP for the Unmount RPC. + */ + dumpmntopts.ndmnt_fname = sfs->f_mntonname; + dumpmntopts.ndmnt_buf = buf; + dumpmntopts.ndmnt_blen = sizeof(buf); + if (nfssvc(NFSSVC_DUMPMNTOPTS, &dumpmntopts) >= 0) { + if (strstr(buf, "nfsv4,") != NULL) + do_rpc = 0; + else if (strstr(buf, ",tcp,") != NULL) + proto_ptr = "tcp"; + } + } } if (!namematch(ai)) { @@ -400,7 +420,7 @@ umountfs(struct statfs *sfs) * has been unmounted. */ if (ai != NULL && !(fflag & MNT_FORCE) && do_rpc) { - clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS3, "udp"); + clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS3, proto_ptr); if (clp == NULL) { warnx("%s: %s", hostp, clnt_spcreateerror("MOUNTPROG"));