From owner-svn-src-projects@FreeBSD.ORG Sun Apr 14 01:21:22 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 121CC5EA; Sun, 14 Apr 2013 01:21:22 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E75151BB1; Sun, 14 Apr 2013 01:21:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E1LLUN070014; Sun, 14 Apr 2013 01:21:21 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E1LKqF070009; Sun, 14 Apr 2013 01:21:20 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201304140121.r3E1LKqF070009@svn.freebsd.org> From: "Simon J. Gerraty" Date: Sun, 14 Apr 2013 01:21:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249458 - projects/bmake/share/mk X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 01:21:22 -0000 Author: sjg Date: Sun Apr 14 01:21:20 2013 New Revision: 249458 URL: http://svnweb.freebsd.org/changeset/base/249458 Log: Sync latest versions Modified: projects/bmake/share/mk/dirdeps.mk projects/bmake/share/mk/gendirdeps.mk projects/bmake/share/mk/meta.autodep.mk projects/bmake/share/mk/meta.stage.mk projects/bmake/share/mk/meta2deps.py Modified: projects/bmake/share/mk/dirdeps.mk ============================================================================== --- projects/bmake/share/mk/dirdeps.mk Sun Apr 14 00:59:56 2013 (r249457) +++ projects/bmake/share/mk/dirdeps.mk Sun Apr 14 01:21:20 2013 (r249458) @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.24 2013/02/10 19:21:46 sjg Exp $ +# $Id: dirdeps.mk,v 1.28 2013/03/25 21:11:43 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -86,19 +86,29 @@ # # For example: # -# # variables other than MACHINE might be optional +# # Always list MACHINE first, +# # other variables might be optional. # TARGET_SPEC_VARS = MACHINE TARGET_OS # .if ${TARGET_SPEC:Uno:M*,*} != "" # _tspec := ${TARGET_SPEC:S/,/ /g} # MACHINE := ${_tspec:[1]} # TARGET_OS := ${_tspec:[2]} # # etc. +# # We need to stop that TARGET_SPEC affecting any submakes +# # and deal with MACHINE=${TARGET_SPEC} in the environment. +# TARGET_SPEC = +# # export but do not track +# .export-env TARGET_SPEC +# .export ${TARGET_SPEC_VARS} # .for v in ${TARGET_SPEC_VARS:O:u} # .if empty($v) # .undef $v # .endif # .endfor # .endif +# # make sure we know what TARGET_SPEC is +# # as we may need it to find Makefile.depend* +# TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} # .if ${.MAKE.LEVEL} == 0 Modified: projects/bmake/share/mk/gendirdeps.mk ============================================================================== --- projects/bmake/share/mk/gendirdeps.mk Sun Apr 14 00:59:56 2013 (r249457) +++ projects/bmake/share/mk/gendirdeps.mk Sun Apr 14 01:21:20 2013 (r249458) @@ -1,4 +1,4 @@ -# $Id: gendirdeps.mk,v 1.12 2013/02/10 19:59:10 sjg Exp $ +# $Id: gendirdeps.mk,v 1.21 2013/03/28 20:01:05 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -119,7 +119,7 @@ META2DEPS_CMD = ${_time} ${PYTHON} ${MET META2DEPS_CMD += -D ${DPDEPS} .endif -M2D_OBJROOTS += ${OBJTOP}/ ${_OBJROOT} ${_objroot} +M2D_OBJROOTS += ${OBJTOP} ${_OBJROOT} ${_objroot} .if defined(SB_OBJROOT) M2D_OBJROOTS += ${SB_OBJROOT} .endif @@ -174,7 +174,12 @@ dir_list += ${f:H:tA} .endfor .if !empty(ddep_list) ddeps != cat ${ddep_list:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \ - sed 's,//*$$,,;s,\.${HOST_TARGET}$$,.host,' + sed 's,//*$$,,;s,\.${HOST_TARGET}$$,.host,;s,\.${MACHINE}$$,,' + +.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" +.info ${RELDIR}: raw_dir_list='${dir_list}' +.info ${RELDIR}: ddeps='${ddeps}' +.endif dir_list += ${ddeps} .endif .endif @@ -188,8 +193,10 @@ dir_list += ${ddeps} # so we add # ${"${dir_list:M*bsd/sys/${MACHINE_ARCH}/include}":?bsd/include:} # to GENDIRDEPS_DIR_LIST_XTRAS +_objtops = ${OBJTOP} ${_OBJTOP} ${_obtop} +_objtops := ${_objtops:O:u} dirdep_list = \ - ${dir_list:M${_objtop}*/*:C,${_objtop}[^/]*/,,} \ + ${_objtops:@o@${dir_list:M$o*/*:C,$o[^/]*/,,}@} \ ${GENDIRDEPS_DIR_LIST_XTRAS} # sort longest first @@ -198,10 +205,11 @@ M2D_OBJROOTS := ${M2D_OBJROOTS:O:u:[-1.. # anything we use from an object dir other than ours # needs to be qualified with its . suffix # (we used the pseudo machine "host" for the HOST_TARGET). -skip_ql= ${SRCTOP}* ${_objtop}* +skip_ql= ${SRCTOP}* ${_objtops:@o@$o*@} .for o in ${M2D_OBJROOTS:${skip_ql:${M_ListToSkip}}} -qualdir_list += \ - ${dir_list:${skip_ql:${M_ListToSkip}}:M$o*/*/*:C,$o([^/]+)/(.*),\2.\1,:S,.${HOST_TARGET},.host,} +# we need := so only skip_ql to this point applies +ql := ${dir_list:${skip_ql:${M_ListToSkip}}:M$o*/*/*:C,$o([^/]+)/(.*),\2.\1,:S,.${HOST_TARGET},.host,} +qualdir_list += ${ql} skip_ql+= $o* .endfor Modified: projects/bmake/share/mk/meta.autodep.mk ============================================================================== --- projects/bmake/share/mk/meta.autodep.mk Sun Apr 14 00:59:56 2013 (r249457) +++ projects/bmake/share/mk/meta.autodep.mk Sun Apr 14 01:21:20 2013 (r249458) @@ -1,4 +1,4 @@ -# $Id: meta.autodep.mk,v 1.28 2012/07/13 15:38:16 sjg Exp $ +# $Id: meta.autodep.mk,v 1.32 2012/11/13 00:44:26 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -235,6 +235,7 @@ META_FILES = ${.MAKE.META.FILES:T:N.depe .export GENDIRDEPS_FILTER .endif +# we might have .../ in MAKESYSPATH _makesyspath:= ${_PARSEDIR} ${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.META.CREATED} @echo Checking $@: ${.OODATE:T:[1..8]} Modified: projects/bmake/share/mk/meta.stage.mk ============================================================================== --- projects/bmake/share/mk/meta.stage.mk Sun Apr 14 00:59:56 2013 (r249457) +++ projects/bmake/share/mk/meta.stage.mk Sun Apr 14 01:21:20 2013 (r249458) @@ -1,4 +1,4 @@ -# $Id: meta.stage.mk,v 1.22 2013/03/08 17:52:11 sjg Exp $ +# $Id: meta.stage.mk,v 1.24 2013/03/23 02:25:19 sjg Exp $ # # @(#) Copyright (c) 2011, Simon J. Gerraty # @@ -48,17 +48,21 @@ GENDIRDEPS_FILTER += Nnot-empty-is-impor ${_STAGED_DIRS:O:u:M${OBJTOP}*:S,${OBJTOP}/,N,} \ ${_STAGED_DIRS:O:u:N${OBJTOP}*:S,${_objroot},,:C,^([^/]+)/(.*),N\2.\1,:S,${HOST_TARGET},.host,} +LN_CP_SCRIPT = LnCp() { \ + rm -f $$2 2> /dev/null; \ + ln $$1 $$2 2> /dev/null || \ + cp -p $$1 $$2; } + # it is an error for more than one src dir to try and stage # the same file -STAGE_DIRDEP_SCRIPT = StageDirdep() { \ +STAGE_DIRDEP_SCRIPT = ${LN_CP_SCRIPT}; StageDirdep() { \ t=$$1; \ if [ -s $$t.dirdep ]; then \ cmp -s .dirdep $$t.dirdep && return; \ echo "ERROR: $$t installed by `cat $$t.dirdep` not ${_dirdep}" >&2; \ exit 1; \ fi; \ - ln .dirdep $$t.dirdep 2> /dev/null || \ - cp .dirdep $$t.dirdep || exit 1; } + LnCp .dirdep $$t.dirdep || exit 1; } # common logic for staging files # this all relies on RELDIR being set to a subdir of SRCTOP @@ -71,9 +75,7 @@ STAGE_FILE_SCRIPT = ${STAGE_DIRDEP_SCRIP for f in "$$@"; do \ case "$$f" in */*) t=$$dest/${_stage_file_basename};; *) t=$$dest/$$f;; esac; \ StageDirdep $$t; \ - rm -f $$t; \ - { ln $$f $$t 2> /dev/null || \ - cp -p $$f $$t; } || exit 1; \ + LnCp $$f $$t || exit 1; \ [ -z "$$mode" ] || chmod $$mode $$t; \ done; :; } @@ -103,9 +105,7 @@ STAGE_AS_SCRIPT = ${STAGE_DIRDEP_SCRIPT} case "$$1" in */*) mkdir -p ${_stage_target_dirname};; esac; \ shift; \ StageDirdep $$t; \ - rm -f $$t; \ - { ln $$s $$t 2> /dev/null || \ - cp -p $$s $$t; } || exit 1; \ + LnCp $$s $$t || exit 1; \ [ -z "$$mode" ] || chmod $$mode $$t; \ done; :; } Modified: projects/bmake/share/mk/meta2deps.py ============================================================================== --- projects/bmake/share/mk/meta2deps.py Sun Apr 14 00:59:56 2013 (r249457) +++ projects/bmake/share/mk/meta2deps.py Sun Apr 14 01:21:20 2013 (r249458) @@ -35,7 +35,7 @@ We only pay attention to a subset of the """ RCSid: - $Id: meta2deps.py,v 1.10 2013/03/17 03:10:09 sjg Exp $ + $Id: meta2deps.py,v 1.12 2013/03/31 22:31:59 sjg Exp $ Copyright (c) 2011-2013, Juniper Networks, Inc. All rights reserved. @@ -196,9 +196,17 @@ class MetaFile: if not _srctop in self.srctops: self.srctops.append(_srctop) - trim_list = ['/' + self.machine, '/' + self.machine + '/'] + trim_list = ['/' + self.machine + '/', + '/' + self.machine, + self.machine + '/', + self.machine] + if self.machine == 'host': - trim_list += ['/' + self.host_target, '/' + self.host_target + '/'] + trim_list += ['/' + self.host_target + '/', + '/' + self.host_target, + self.host_target + '/', + self.host_target] + for objroot in getv(conf, 'OBJROOTS', []): for e in trim_list: if objroot.endswith(e): @@ -237,6 +245,8 @@ class MetaFile: if not self.reldir: self.dpdeps = None # we cannot do it? + self.cwd = os.getcwd() # make sure this is initialized + if name: self.parse() From owner-svn-src-projects@FreeBSD.ORG Sun Apr 14 01:22:43 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2661C70B; Sun, 14 Apr 2013 01:22:43 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 158CF1BB8; Sun, 14 Apr 2013 01:22:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E1MgYv070285; Sun, 14 Apr 2013 01:22:42 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E1MdO0070265; Sun, 14 Apr 2013 01:22:39 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201304140122.r3E1MdO0070265@svn.freebsd.org> From: "Simon J. Gerraty" Date: Sun, 14 Apr 2013 01:22:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249459 - in projects/bmake: cddl/lib/libzfs cddl/lib/libzfs_core cddl/sbin/zfs cddl/sbin/zpool cddl/usr.bin/zinject cddl/usr.bin/ztest cddl/usr.sbin/zdb cddl/usr.sbin/zhack lib/libyaml... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 01:22:43 -0000 Author: sjg Date: Sun Apr 14 01:22:39 2013 New Revision: 249459 URL: http://svnweb.freebsd.org/changeset/base/249459 Log: New/updated dependencies Added: projects/bmake/cddl/lib/libzfs_core/Makefile.depend (contents, props changed) projects/bmake/lib/libyaml/Makefile.depend (contents, props changed) Modified: projects/bmake/cddl/lib/libzfs/Makefile.depend projects/bmake/cddl/sbin/zfs/Makefile.depend projects/bmake/cddl/sbin/zpool/Makefile.depend projects/bmake/cddl/usr.bin/zinject/Makefile.depend projects/bmake/cddl/usr.bin/ztest/Makefile.depend projects/bmake/cddl/usr.sbin/zdb/Makefile.depend projects/bmake/cddl/usr.sbin/zhack/Makefile.depend projects/bmake/share/doc/bind9/Makefile.depend projects/bmake/share/misc/Makefile.depend projects/bmake/usr.bin/ar/Makefile.depend projects/bmake/usr.sbin/acpi/iasl/Makefile.depend projects/bmake/usr.sbin/pc-sysinstall/backend-query/Makefile.depend projects/bmake/usr.sbin/pc-sysinstall/backend/Makefile.depend projects/bmake/usr.sbin/pc-sysinstall/conf/Makefile.depend projects/bmake/usr.sbin/pkg/Makefile.depend Modified: projects/bmake/cddl/lib/libzfs/Makefile.depend ============================================================================== --- projects/bmake/cddl/lib/libzfs/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/cddl/lib/libzfs/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -5,6 +5,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,, DIRDEPS = \ cddl/lib/libnvpair \ cddl/lib/libumem \ + cddl/lib/libzfs_core \ gnu/lib/libgcc \ include \ include/xlocale \ Added: projects/bmake/cddl/lib/libzfs_core/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/bmake/cddl/lib/libzfs_core/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -0,0 +1,20 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DIRDEPS = \ + cddl/lib/libnvpair \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/msun \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Modified: projects/bmake/cddl/sbin/zfs/Makefile.depend ============================================================================== --- projects/bmake/cddl/sbin/zfs/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/cddl/sbin/zfs/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -7,6 +7,7 @@ DIRDEPS = \ cddl/lib/libumem \ cddl/lib/libuutil \ cddl/lib/libzfs \ + cddl/lib/libzfs_core \ gnu/lib/libgcc \ include \ include/xlocale \ Modified: projects/bmake/cddl/sbin/zpool/Makefile.depend ============================================================================== --- projects/bmake/cddl/sbin/zpool/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/cddl/sbin/zpool/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -8,6 +8,7 @@ DIRDEPS = \ cddl/lib/libumem \ cddl/lib/libuutil \ cddl/lib/libzfs \ + cddl/lib/libzfs_core \ gnu/lib/libgcc \ include \ include/xlocale \ Modified: projects/bmake/cddl/usr.bin/zinject/Makefile.depend ============================================================================== --- projects/bmake/cddl/usr.bin/zinject/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/cddl/usr.bin/zinject/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -7,6 +7,7 @@ DIRDEPS = \ cddl/lib/libumem \ cddl/lib/libuutil \ cddl/lib/libzfs \ + cddl/lib/libzfs_core \ cddl/lib/libzpool \ gnu/lib/libgcc \ include \ Modified: projects/bmake/cddl/usr.bin/ztest/Makefile.depend ============================================================================== --- projects/bmake/cddl/usr.bin/ztest/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/cddl/usr.bin/ztest/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -8,6 +8,7 @@ DIRDEPS = \ cddl/lib/libumem \ cddl/lib/libuutil \ cddl/lib/libzfs \ + cddl/lib/libzfs_core \ cddl/lib/libzpool \ gnu/lib/libgcc \ include \ Modified: projects/bmake/cddl/usr.sbin/zdb/Makefile.depend ============================================================================== --- projects/bmake/cddl/usr.sbin/zdb/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/cddl/usr.sbin/zdb/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -7,6 +7,7 @@ DIRDEPS = \ cddl/lib/libumem \ cddl/lib/libuutil \ cddl/lib/libzfs \ + cddl/lib/libzfs_core \ cddl/lib/libzpool \ gnu/lib/libgcc \ include \ Modified: projects/bmake/cddl/usr.sbin/zhack/Makefile.depend ============================================================================== --- projects/bmake/cddl/usr.sbin/zhack/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/cddl/usr.sbin/zhack/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -7,6 +7,7 @@ DIRDEPS = \ cddl/lib/libumem \ cddl/lib/libuutil \ cddl/lib/libzfs \ + cddl/lib/libzfs_core \ cddl/lib/libzpool \ gnu/lib/libgcc \ include \ Added: projects/bmake/lib/libyaml/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/bmake/lib/libyaml/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -0,0 +1,18 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DIRDEPS = \ + 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 Modified: projects/bmake/share/doc/bind9/Makefile.depend ============================================================================== --- projects/bmake/share/doc/bind9/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/share/doc/bind9/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -2,8 +2,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} -DEP_MACHINE := ${.PARSEFILE:E} - DIRDEPS = \ Modified: projects/bmake/share/misc/Makefile.depend ============================================================================== --- projects/bmake/share/misc/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/share/misc/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -2,8 +2,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} -DEP_MACHINE := ${.PARSEFILE:E} - DIRDEPS = \ Modified: projects/bmake/usr.bin/ar/Makefile.depend ============================================================================== --- projects/bmake/usr.bin/ar/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/usr.bin/ar/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -10,6 +10,7 @@ DIRDEPS = \ lib/libc \ lib/libcompiler_rt \ lib/libelf \ + lib/libz \ .include Modified: projects/bmake/usr.sbin/acpi/iasl/Makefile.depend ============================================================================== --- projects/bmake/usr.sbin/acpi/iasl/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/usr.sbin/acpi/iasl/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -33,6 +33,8 @@ asllength.o: aslcompiler.y.h asllength.po: aslcompiler.y.h asllisting.o: aslcompiler.y.h asllisting.po: aslcompiler.y.h +asllistsup.o: aslcompiler.y.h +asllistsup.po: aslcompiler.y.h aslload.o: aslcompiler.y.h aslload.po: aslcompiler.y.h asllookup.o: aslcompiler.y.h @@ -41,6 +43,8 @@ aslmethod.o: aslcompiler.y.h aslmethod.po: aslcompiler.y.h aslnamesp.o: aslcompiler.y.h aslnamesp.po: aslcompiler.y.h +asloffset.o: aslcompiler.y.h +asloffset.po: aslcompiler.y.h aslopcodes.o: aslcompiler.y.h aslopcodes.po: aslcompiler.y.h asloperands.o: aslcompiler.y.h @@ -49,6 +53,8 @@ aslopt.o: aslcompiler.y.h aslopt.po: aslcompiler.y.h aslpredef.o: aslcompiler.y.h aslpredef.po: aslcompiler.y.h +aslprepkg.o: aslcompiler.y.h +aslprepkg.po: aslcompiler.y.h aslresource.o: aslcompiler.y.h aslresource.po: aslcompiler.y.h aslrestype1.o: aslcompiler.y.h Modified: projects/bmake/usr.sbin/pc-sysinstall/backend-query/Makefile.depend ============================================================================== --- projects/bmake/usr.sbin/pc-sysinstall/backend-query/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/usr.sbin/pc-sysinstall/backend-query/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -2,8 +2,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} -DEP_MACHINE := ${.PARSEFILE:E} - DIRDEPS = \ Modified: projects/bmake/usr.sbin/pc-sysinstall/backend/Makefile.depend ============================================================================== --- projects/bmake/usr.sbin/pc-sysinstall/backend/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/usr.sbin/pc-sysinstall/backend/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -2,8 +2,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} -DEP_MACHINE := ${.PARSEFILE:E} - DIRDEPS = \ Modified: projects/bmake/usr.sbin/pc-sysinstall/conf/Makefile.depend ============================================================================== --- projects/bmake/usr.sbin/pc-sysinstall/conf/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/usr.sbin/pc-sysinstall/conf/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -2,8 +2,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} -DEP_MACHINE := ${.PARSEFILE:E} - DIRDEPS = \ Modified: projects/bmake/usr.sbin/pkg/Makefile.depend ============================================================================== --- projects/bmake/usr.sbin/pkg/Makefile.depend Sun Apr 14 01:21:20 2013 (r249458) +++ projects/bmake/usr.sbin/pkg/Makefile.depend Sun Apr 14 01:22:39 2013 (r249459) @@ -13,6 +13,8 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libelf \ lib/libfetch \ + lib/libsbuf \ + lib/libyaml \ .include From owner-svn-src-projects@FreeBSD.ORG Sun Apr 14 09:05:41 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 985B165C; Sun, 14 Apr 2013 09:05:41 +0000 (UTC) (envelope-from cherry@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 89C14807; Sun, 14 Apr 2013 09:05:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E95fWV010757; Sun, 14 Apr 2013 09:05:41 GMT (envelope-from cherry@svn.freebsd.org) Received: (from cherry@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E95eqO010749; Sun, 14 Apr 2013 09:05:40 GMT (envelope-from cherry@svn.freebsd.org) Message-Id: <201304140905.r3E95eqO010749@svn.freebsd.org> From: "Cherry G. Mathew" Date: Sun, 14 Apr 2013 09:05:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249465 - in projects/amd64_xen_pv/sys/amd64: conf include xen X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 09:05:41 -0000 Author: cherry Date: Sun Apr 14 09:05:40 2013 New Revision: 249465 URL: http://svnweb.freebsd.org/changeset/base/249465 Log: pmap.c: - Bump copyright year. - Fill in further pmap stubs, mainly pmap_enter()/pmap_remove() - Refine the use of managed and unmanaged pages. pmap_pv.c: - Improve support to free pv entries - Remove responsibility for locking the pmap to pmap.c cpufunc.h: - invltlb() should work on xen too. machdep.c: - Copy exec_setregs() implementation from native, sans debug register support. mmu_map.c: - flush the mmu update queue after pml4 entry update. conf/XEN: - revert VERBOSE_SYSINIT. This was re-enabled by mistake in r248719, contrary to the status message, which claimed to disable it. Modified: projects/amd64_xen_pv/sys/amd64/conf/XEN projects/amd64_xen_pv/sys/amd64/include/cpufunc.h projects/amd64_xen_pv/sys/amd64/xen/machdep.c projects/amd64_xen_pv/sys/amd64/xen/mmu_map.c projects/amd64_xen_pv/sys/amd64/xen/pmap.c projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c Modified: projects/amd64_xen_pv/sys/amd64/conf/XEN ============================================================================== --- projects/amd64_xen_pv/sys/amd64/conf/XEN Sun Apr 14 08:49:35 2013 (r249464) +++ projects/amd64_xen_pv/sys/amd64/conf/XEN Sun Apr 14 09:05:40 2013 (r249465) @@ -55,7 +55,7 @@ options INVARIANTS # Enable calls of e options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS nooptions WITNESS # Enable checks to detect deadlocks and cycles nooptions WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options VERBOSE_SYSINIT +nooptions VERBOSE_SYSINIT nooptions NATIVE option XEN Modified: projects/amd64_xen_pv/sys/amd64/include/cpufunc.h ============================================================================== --- projects/amd64_xen_pv/sys/amd64/include/cpufunc.h Sun Apr 14 08:49:35 2013 (r249464) +++ projects/amd64_xen_pv/sys/amd64/include/cpufunc.h Sun Apr 14 09:05:40 2013 (r249465) @@ -493,8 +493,11 @@ load_xcr(u_int reg, u_long val) static __inline void invltlb(void) { - +#ifdef XEN + xen_tlb_flush(); +#else load_cr3(rcr3()); +#endif } /* Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/machdep.c Sun Apr 14 08:49:35 2013 (r249464) +++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c Sun Apr 14 09:05:40 2013 (r249465) @@ -746,7 +746,43 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, void exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { - KASSERT(0, ("TODO")); + struct trapframe *regs = td->td_frame; + struct pcb *pcb = td->td_pcb; + + mtx_lock(&dt_lock); + if (td->td_proc->p_md.md_ldt != NULL) + user_ldt_free(td); + else + mtx_unlock(&dt_lock); + + pcb->pcb_fsbase = 0; + pcb->pcb_gsbase = 0; + clear_pcb_flags(pcb, PCB_32BIT | PCB_GS32BIT); + pcb->pcb_initial_fpucw = __INITIAL_FPUCW__; + set_pcb_flags(pcb, PCB_FULL_IRET); + + bzero((char *)regs, sizeof(struct trapframe)); + regs->tf_rip = imgp->entry_addr; + regs->tf_rsp = ((stack - 8) & ~0xFul) + 8; + regs->tf_rdi = stack; /* argv */ + regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T); + regs->tf_ss = _udatasel; + regs->tf_cs = _ucodesel; + regs->tf_ds = _udatasel; + regs->tf_es = _udatasel; + regs->tf_fs = _ufssel; + regs->tf_gs = _ugssel; + regs->tf_flags = TF_HASSEGS; + td->td_retval[1] = 0; + + /* XXX: we don't do PCB_DBREGS */ + + /* + * Drop the FP state if we hold it, so that the process gets a + * clean FP state if it uses the FPU again. + */ + fpstate_drop(td); + } void Modified: projects/amd64_xen_pv/sys/amd64/xen/mmu_map.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/mmu_map.c Sun Apr 14 08:49:35 2013 (r249464) +++ projects/amd64_xen_pv/sys/amd64/xen/mmu_map.c Sun Apr 14 09:05:40 2013 (r249465) @@ -337,7 +337,7 @@ mmu_map_hold_va(struct pmap *pm, void *a pml4tep_ma = xpmap_ptom(pti->ptmb.vtop((uintptr_t)pml4tep)); pml4te = xpmap_ptom(pti->ptmb.vtop((uintptr_t)pti->pdpt)) | PG_RW | PG_V | PG_U; /* XXX: revisit flags */ xen_queue_pt_update(pml4tep_ma, pml4te); - + xen_flush_queue(); } else { pti->pdpt = (pdp_entry_t *) pti->ptmb.ptov(pt); } Modified: projects/amd64_xen_pv/sys/amd64/xen/pmap.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/pmap.c Sun Apr 14 08:49:35 2013 (r249464) +++ projects/amd64_xen_pv/sys/amd64/xen/pmap.c Sun Apr 14 09:05:40 2013 (r249465) @@ -8,10 +8,10 @@ * All rights reserved. * Copyright (c) 2005 Alan L. Cox * All rights reserved. - * Copyright (c) 2012 Spectra Logic Corporation - * All rights reserved. * Copyright (c) 2012 Citrix Systems * All rights reserved. + * Copyright (c) 2012, 2013 Spectra Logic Corporation + * All rights reserved. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer @@ -147,6 +147,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -183,7 +184,7 @@ static vm_paddr_t dmaplimit; #endif uintptr_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS; -pt_entry_t pg_nx; /* XXX: do we need this ? */ +pt_entry_t pg_nx = 0; /* XXX: probe for this ? */ struct msgbuf *msgbufp = 0; @@ -218,6 +219,15 @@ extern char *console_page; /* The shared extern struct xenstore_domain_interface *xen_store; /* xenstore page */ extern vm_map_t pv_map; +vm_offset_t pv_minva, pv_maxva; + +/* Index offset into a pagetable, for a given va */ +static int +pt_index(uintptr_t va) +{ + return ((va & PDRMASK) >> PAGE_SHIFT); +} + /* return kernel virtual address of 'n' claimed physical pages at boot. */ static uintptr_t @@ -634,7 +644,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr) kernel_pmap->pm_root.rt_root = 0; CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ pmap_pv_init(); - pmap_pv_pmap_init(kernel_pmap); tsz = mmu_map_t_size(); @@ -712,20 +721,6 @@ pmap_init(void) /* XXX: review the use of gdtset for the purpose below */ - /* - * At this point we initialise the pv mappings of all PAs that - * have been mapped into the kernel VA by pmap_bootstrap() - */ - - vm_paddr_t pa; - - for (pa = phys_avail[0]; pa < VTOP(virtual_avail); pa += PAGE_SIZE) { - vm_page_t m; - m = PHYS_TO_VM_PAGE(pa); - if (m == NULL) continue; - pmap_put_pv_entry(kernel_pmap, PTOV(pa), m); - } - /* Get a va for console and map the console mfn into it */ vm_paddr_t ma = xen_start_info->console.domU.mfn << PAGE_SHIFT; @@ -745,7 +740,6 @@ pmap_init(void) xen_store = (void *)va; /* Reserve pv VA space by allocating a submap */ - vm_offset_t pv_minva, pv_maxva; KASSERT(kernel_map != 0, ("Initialising kernel submap before kernel_map!")); pv_map = kmem_suballoc(kernel_map, &pv_minva, &pv_maxva, sizeof(struct pv_chunk) * 100 /* XXX: Totally arbitrary */, 0); @@ -772,7 +766,7 @@ pmap_pinit(pmap_t pmap) { KASSERT(pmap != kernel_pmap, - ("kernel map re-initialised!")); + ("kernel map re-initialised!", __func__)); PMAP_LOCK_INIT(pmap); @@ -781,7 +775,7 @@ pmap_pinit(pmap_t pmap) */ pmap->pm_pml4 = (void *) kmem_alloc(kernel_map, PAGE_SIZE); bzero(pmap->pm_pml4, PAGE_SIZE); - printf("%s: pmap->pm_pml4 == %p\n", __func__, pmap->pm_pml4); + /* * We do not wire in kernel space, or the self-referencial * entry in userspace pmaps becase both kernel and userland @@ -795,7 +789,7 @@ pmap_pinit(pmap_t pmap) pmap_xen_setpages_ro((uintptr_t)pmap->pm_pml4, 1); - xen_pgdir_pin(phystomach(ptmb_vtop((uintptr_t)pmap->pm_pml4))); + xen_pgdir_pin(pmap_kextract_ma((uintptr_t)pmap->pm_pml4)); pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); @@ -810,8 +804,6 @@ void pmap_xen_userload(pmap_t pmap) KASSERT(pmap != kernel_pmap, ("Kernel pmap requested on user load.\n")); - printf("%s: pmap->pm_pml4 == %p\n", __func__, pmap->pm_pml4); - printf("%s: curthread %s\n", __func__, curthread->td_name); int i; for (i = 0; i < NUPML4E; i++) { pml4_entry_t pml4e; @@ -827,11 +819,20 @@ void pmap_xen_userload(pmap_t pmap) void pmap_release(pmap_t pmap) { - KASSERT(0, ("XXX: %s: TODO\n", __func__)); + KASSERT(pmap != kernel_pmap, + ("%s: kernel pmap released", __func__)); + + xen_pgdir_unpin(pmap_kextract_ma((uintptr_t)pmap->pm_pml4)); + pmap_xen_setpages_rw((uintptr_t)pmap->pm_pml4, 1); + + bzero(pmap->pm_pml4, PAGE_SIZE); + kmem_free(kernel_map, (vm_offset_t)pmap->pm_pml4, PAGE_SIZE); + + PMAP_LOCK_DESTROY(pmap); } static pt_entry_t * -pmap_vtopte_hold(pmap_t pmap, uintptr_t va, void *addr) +pmap_vtopte_inspect(pmap_t pmap, uintptr_t va, void *addr) { KASSERT(addr != NULL, ("addr == NULL")); @@ -848,14 +849,51 @@ pmap_vtopte_hold(pmap_t pmap, uintptr_t mmu_map_t_init(tptr, &mb); - if (!mmu_map_inspect_va(kernel_pmap, tptr, va)) { + if (!mmu_map_inspect_va(pmap, tptr, va)) { return NULL; /* XXX: fix api, return some kind of #define */ } pte = mmu_map_pt(tptr); /* Read out PT from mmu state */ /* add VA offset */ - pte += (va & PDRMASK) >> PAGE_SHIFT; + pte += pt_index(va); + + return pte; +} + +static pt_entry_t * +vtopte_inspect(uintptr_t va, void *addr) +{ + return pmap_vtopte_inspect(kernel_pmap, va, addr); +} + +static pt_entry_t * +pmap_vtopte_hold(pmap_t pmap, uintptr_t va, void *addr) +{ + KASSERT(addr != NULL, ("addr == NULL")); + + mmu_map_t tptr = *(mmu_map_t *)addr; + + pd_entry_t *pte; /* PTE address to return */ + + struct mmu_map_mbackend mb = { + ptmb_mappedalloc, + ptmb_mappedfree, + ptmb_ptov, + ptmb_vtop + }; + + mmu_map_t_init(tptr, &mb); + + if (!mmu_map_inspect_va(pmap, tptr, va)) { + mmu_map_hold_va(pmap, tptr, va); /* PT hierarchy */ + xen_flush_queue(); + } + + pte = mmu_map_pt(tptr); /* Read out PT from mmu state */ + + /* add VA offset */ + pte += pt_index(va); return pte; } @@ -892,6 +930,22 @@ pmap_lazyfix_action(void) } #endif /* SMP */ +static __inline void +pmap_resident_count_inc(pmap_t pmap, int count) +{ + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + pmap->pm_stats.resident_count += count; +} + +static __inline void +pmap_resident_count_dec(pmap_t pmap, int count) +{ + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + pmap->pm_stats.resident_count -= count; +} + /* * Add a list of wired pages to the kva * this routine is only used for temporary @@ -964,6 +1018,11 @@ void pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m, vm_prot_t prot, boolean_t wired) { + pt_entry_t *pte; + pt_entry_t newpte, origpte; + vm_paddr_t opa, pa; + vm_page_t mpte, om; + va = trunc_page(va); KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); @@ -973,21 +1032,201 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0) VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT(pmap == kernel_pmap, ("XXX: TODO: Userland pmap\n")); KASSERT(VM_PAGE_TO_PHYS(m) != 0, ("VM_PAGE_TO_PHYS(m) == 0x%lx\n", VM_PAGE_TO_PHYS(m))); - pmap_kenter(va, VM_PAGE_TO_PHYS(m)); /* Shim to keep bootup - * happy for now */ + pa = VM_PAGE_TO_PHYS(m); + newpte = (pt_entry_t)(xpmap_ptom(pa) | PG_A | PG_V | PG_U); + if ((access & VM_PROT_WRITE) != 0) + newpte |= PG_M; + if ((prot & VM_PROT_WRITE) != 0) + newpte |= PG_RW; + KASSERT((newpte & (PG_M | PG_RW)) != PG_M, + ("pmap_enter: access includes VM_PROT_WRITE but prot doesn't")); + if ((prot & VM_PROT_EXECUTE) == 0) + newpte |= pg_nx; + if (wired) + newpte |= PG_W; + + /* newpte |= pmap_cache_bits(m->md.pat_mode, 0); XXX */ + + mpte = NULL; + + PMAP_LOCK(pmap); - /* XXX: TODO: */ + /* + * In the case that a page table page is not + * resident, we are creating it here. + */ + + KASSERT(tsz != 0, ("tsz != 0")); + + char tbuf[tsz]; /* Safe to do this on the stack since tsz is + * effectively const. + */ + + mmu_map_t tptr = tbuf; + + pte = pmap_vtopte_hold(pmap, va, &tptr); + + origpte = pte_load(pte); + + /* + * Is the specified virtual address already mapped? + */ + if ((origpte & PG_V) != 0) { + /* + * Wiring change, just update stats. We don't worry about + * wiring PT pages as they remain resident as long as there + * are valid mappings in them. Hence, if a user page is wired, + * the PT page will be also. + */ + if ((newpte & PG_W) != 0 && (origpte & PG_W) == 0) + pmap->pm_stats.wired_count++; + else if ((newpte & PG_W) == 0 && (origpte & PG_W) != 0) + pmap->pm_stats.wired_count--; + + /* + * Has the physical page changed? + */ + opa = xpmap_mtop(origpte & PG_FRAME); + if (opa == pa) { + /* + * No, might be a protection or wiring change. + */ + if ((origpte & PG_MANAGED) != 0) { + newpte |= PG_MANAGED; + if ((newpte & PG_RW) != 0) + vm_page_aflag_set(m, PGA_WRITEABLE); + } + if (((origpte ^ newpte) & ~(PG_M | PG_A)) == 0) + goto unchanged; + goto validate; + } + } else { + /* + * Increment the counters. + */ + if ((newpte & PG_W) != 0) + pmap->pm_stats.wired_count++; + pmap_resident_count_inc(pmap, 1); + } + + + /* + * Enter on the PV list if part of our managed memory. + */ + if ((m->oflags & VPO_UNMANAGED) == 0) { + newpte |= PG_MANAGED; + pmap_put_pv_entry(pmap, va, m); + + if ((newpte & PG_RW) != 0) + vm_page_aflag_set(m, PGA_WRITEABLE); + } + + /* + * Update the PTE. + */ + if ((origpte & PG_V) != 0) { +validate: + { + /* XXX: This is not atomic */ + origpte = pte_load(pte); + PT_SET_VA_MA(pte, newpte, true); + /* Sync the kernel's view of the pmap */ + if (pmap != kernel_pmap && PCPU_GET(curpmap) == pmap) { + /* XXX: this can be optimised to a single entry update */ + pmap_xen_userload(pmap); + } + + } + opa = xpmap_mtop(origpte & PG_FRAME); + if (opa != pa) { + if ((origpte & PG_MANAGED) != 0) { + om = PHYS_TO_VM_PAGE(opa); + if ((origpte & (PG_M | PG_RW)) == (PG_M | + PG_RW)) + vm_page_dirty(om); + if ((origpte & PG_A) != 0) + vm_page_aflag_set(om, PGA_REFERENCED); + if (!pmap_free_pv_entry(pmap, va, om)) { + panic("Unable to free pv entry!"); + } + + if ((om->aflags & PGA_WRITEABLE) != 0 && + !pmap_page_is_mapped(om) && + (om->flags & PG_FICTITIOUS) != 0) + vm_page_aflag_clear(om, PGA_WRITEABLE); + } + } else if ((newpte & PG_M) == 0 && (origpte & (PG_M | + PG_RW)) == (PG_M | PG_RW)) { + if ((origpte & PG_MANAGED) != 0) + vm_page_dirty(m); + /* + * Although the PTE may still have PG_RW set, TLB + * invalidation may nonetheless be required because + * the PTE no longer has PG_M set. + */ + } else if ((origpte & PG_NX) != 0 || (newpte & PG_NX) == 0) { + /* + * This PTE change does not require TLB invalidation. + */ + goto unchanged; + } + + if ((origpte & PG_A) != 0) + pmap_invalidate_page(pmap, va); + + } else { + PT_SET_VA_MA(pte, newpte, true); + + /* Sync the kernel's view of the pmap */ + if (pmap != kernel_pmap && PCPU_GET(curpmap) == pmap) { + /* XXX: this can be optimised to a single entry update */ + pmap_xen_userload(pmap); + } + } + + + if (pmap != kernel_pmap) pmap_xen_userload(pmap); + + +unchanged: + pmap_vtopte_release(pmap, va, &tptr); + PMAP_UNLOCK(pmap); } +/* + * Maps a sequence of resident pages belonging to the same object. + * The sequence begins with the given page m_start. This page is + * mapped at the given virtual address start. Each subsequent page is + * mapped at a virtual address that is offset from start by the same + * amount as the page is offset from m_start within the object. The + * last page in the sequence is the page with the largest offset from + * m_start that can be mapped at a virtual address less than the given + * virtual address end. Not every virtual page between start and end + * is mapped; only those for which a resident page exists with the + * corresponding offset from m_start are mapped. + */ + void pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, vm_page_t m_start, vm_prot_t prot) { - KASSERT(0, ("XXX: %s: TODO\n", __func__)); + vm_offset_t va; + vm_pindex_t diff, psize; + vm_page_t m; + + VM_OBJECT_ASSERT_WLOCKED(m_start->object); + + psize = atop(end - start); + m = m_start; + + while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { + va = start + ptoa(diff); + pmap_enter(pmap, va, prot, m, prot, false); + m = TAILQ_NEXT(m, listq); + } } void @@ -1011,13 +1250,189 @@ pmap_object_init_pt(pmap_t pmap, vm_offs KASSERT(0, ("XXX: %s: TODO\n", __func__)); } +/* + * pmap_remove_pte: do the things to unmap a page in a process + */ +static int +pmap_remove_pte(pmap_t pmap, vm_offset_t va, pt_entry_t *ptq) +{ + pt_entry_t oldpte; + vm_page_t m; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + + { /* XXX: there's no way to make this atomic ? */ + oldpte = pte_load(ptq); + if (oldpte & PG_FRAME) { /* Optimise */ + PT_CLEAR_VA(ptq, TRUE); + } + } + + if (oldpte & PG_W) + pmap->pm_stats.wired_count -= 1; + pmap_resident_count_dec(pmap, 1); + + if (oldpte & PG_MANAGED) { + m = MACH_TO_VM_PAGE(oldpte & PG_FRAME); + + if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) + vm_page_dirty(m); + + if (oldpte & PG_A) + vm_page_aflag_set(m, PGA_REFERENCED); + + if (!pmap_free_pv_entry(pmap, va, m)) { + panic("%s: pv 0x%lx: 0x%lx, unknown on managed page!", + __func__, VM_PAGE_TO_PHYS(m), va); + } + + if (!pmap_page_is_mapped(m) && + (m->flags & PG_FICTITIOUS) == 0) { + vm_page_aflag_clear(m, PGA_WRITEABLE); + } + } + /* + * We never remove the backing pages - that's the job of + * mmu_map.[ch] + */ + return false; +} + +/* + * Remove a single page from a process address space + */ +static void +pmap_remove_page(pmap_t pmap, vm_offset_t va, pt_entry_t *pte) +{ + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + if ((pte_load(pte) & PG_V) == 0) + return; + + pmap_remove_pte(pmap, va, pte); + + pmap_invalidate_page(pmap, va); +} + void pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - KASSERT(pmap == kernel_pmap, ("XXX: TODO: Userland pmap\n")); - KASSERT(eva >= sva, ("End VA is lower than Start VA")); - pmap_qremove(sva, atop(eva - sva)); + vm_offset_t va, va_next; + pt_entry_t *pte; + int anyvalid; + + /* + * Perform an unsynchronized read. This is, however, safe. + */ + if (pmap->pm_stats.resident_count == 0) + return; + + anyvalid = 0; + + KASSERT(tsz != 0, ("tsz != 0")); + + char tbuf[tsz]; /* Safe to do this on the stack since tsz is + * effectively const. + */ + + mmu_map_t tptr = tbuf; + + struct mmu_map_mbackend mb = { + ptmb_mappedalloc, + ptmb_mappedfree, + ptmb_ptov, + ptmb_vtop + }; + + mmu_map_t_init(tptr, &mb); + + + PMAP_LOCK(pmap); + + /* + * special handling of removing one page. a very + * common operation and easy to short circuit some + * code. + */ + + if (sva + PAGE_SIZE == eva) { + if (!mmu_map_inspect_va(pmap, tptr, sva)) { + goto out; + } + + pte = mmu_map_pt(tptr) + pt_index(sva); + + pmap_remove_page(pmap, sva, pte); + goto out; + } + + for (; sva < eva; sva = va_next) { + if (pmap->pm_stats.resident_count == 0) + break; + + if (!mmu_map_inspect_va(pmap, tptr, sva)) { + if (mmu_map_pdpt(tptr) == NULL) { + va_next = (sva + NBPML4) & ~PML4MASK; + if (va_next < sva) /* Overflow */ + va_next = eva; + continue; + } + + if (mmu_map_pdt(tptr) == NULL) { + va_next = (sva + NBPDP) & ~PDPMASK; + if (va_next < sva) /* Overflow */ + va_next = eva; + continue; + } + + if (mmu_map_pt(tptr) == NULL) { + va_next = (sva + NBPDR) & ~PDRMASK; + if (va_next < sva) /* Overflow */ + va_next = eva; + continue; + } + + panic("%s: All backing tables non-NULL," + "yet hierarchy can't be inspected at va = 0x%lx\n", + __func__, sva); + } + + va_next = (sva + NBPDR) & ~PDRMASK; + if (va_next < sva) + va_next = eva; + + va = va_next; + + for (pte = (mmu_map_pt(tptr) + pt_index(sva)); + sva != va_next;pte++, sva += PAGE_SIZE) { + if (pte_load(pte) == 0) { + if (va != va_next) { + pmap_invalidate_range(pmap, sva, va); + va = va_next; + } + continue; + } + /* + * XXX: PG_G is set on *user* entries unlike + * native, where it is set on kernel entries + */ + if ((pte_load(pte) & PG_G) != 0) + anyvalid = 1; + else if (va == va_next) + va = sva; + + pmap_remove_pte(pmap, sva, pte); + } + if (va != va_next) { + pmap_invalidate_range(pmap, sva, va); + } + } +out: + if (anyvalid) + pmap_invalidate_all(pmap); + + PMAP_UNLOCK(pmap); + mmu_map_t_fini(tptr); } static bool @@ -1032,8 +1447,11 @@ pv_remove(pmap_t pmap, vm_offset_t va, v mmu_map_t tptr = tbuf; PMAP_LOCK(pmap); - pte = pmap_vtopte_hold(pmap, va, &tptr); - tpte = *pte; + pte = pmap_vtopte_inspect(pmap, va, &tptr); + + KASSERT(pte != NULL, ("pte has no backing page tables!")); + + tpte = pte_load(pte); PT_CLEAR_VA(pte, TRUE); if (tpte & PG_A) vm_page_aflag_set(m, PGA_REFERENCED); @@ -1102,6 +1520,11 @@ pmap_kextract(vm_offset_t va) vm_paddr_t pmap_kextract_ma(vm_offset_t va) { + + if (ISDMAPVA(va)) { + return xpmap_ptom(DMAP_TO_PHYS(va)); + } + vm_paddr_t ma; /* Walk the PT hierarchy to get the ma */ @@ -1124,7 +1547,7 @@ pmap_kextract_ma(vm_offset_t va) goto nomapping; } - ma = mmu_map_pt(tptr)[(PDRMASK & va) >> PAGE_SHIFT]; + ma = mmu_map_pt(tptr)[pt_index(va)]; mmu_map_t_fini(tptr); @@ -1146,18 +1569,6 @@ nomapping: void pmap_kenter(vm_offset_t va, vm_paddr_t pa) { - - vm_page_t m; - - m = PHYS_TO_VM_PAGE(pa); - - if (gdtset == 1 && m != NULL) { - /* - * Enter on the PV list if part of our managed memory. - */ - - pmap_put_pv_entry(kernel_pmap, va, m); - } pmap_kenter_ma(va, xpmap_ptom(pa)); } @@ -1211,40 +1622,18 @@ pmap_kremove(vm_offset_t va) mmu_map_t tptr = tbuf; -#define nobackingfree /* Shim to make boot progress. XXX: MUST go away */ -#ifdef nobackingfree - (void) pte; - struct mmu_map_mbackend mb = { - ptmb_mappedalloc, - ptmb_mappedfree, - ptmb_ptov, - ptmb_vtop - }; - mmu_map_t_init(tptr, &mb); - - if (!mmu_map_inspect_va(kernel_pmap, tptr, va)) { - mmu_map_hold_va(kernel_pmap, tptr, va); /* PT hierarchy */ - xen_flush_queue(); /* XXX: cleanup */ - } - - /* Backing page tables are in place, let xen do the maths */ - PT_SET_MA(va, 0); - PT_UPDATES_FLUSH(); - - mmu_map_t_fini(tptr); - -#else - pte = vtopte_hold(va, &tptr); + pte = vtopte_inspect(va, &tptr); if (pte == NULL) { /* Mapping doesn't exist */ - goto unmappte; + goto notmapped; } PT_CLEAR_VA(pte, TRUE); PT_UPDATES_FLUSH(); -unmappte: - vtopte_release(va, &tptr); -#endif + pmap_invalidate_page(kernel_pmap, va); +notmapped: +// XXX: vtopte_release(va, &tptr); + mmu_map_t_fini(tptr); } /* @@ -1292,6 +1681,14 @@ pmap_protect(pmap_t pmap, vm_offset_t sv } void +pmap_invalidate_all(pmap_t pmap) +{ + + if (pmap == kernel_pmap || !CPU_EMPTY(&pmap->pm_active)) + invltlb(); +} + +void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { @@ -1365,7 +1762,32 @@ pmap_zero_page_idle(vm_page_t m) void pmap_activate(struct thread *td) { - KASSERT(0, ("XXX: %s: TODO\n", __func__)); + pmap_t pmap, oldpmap; + u_int cpuid; + u_int64_t cr3; + + critical_enter(); + pmap = vmspace_pmap(td->td_proc->p_vmspace); + oldpmap = PCPU_GET(curpmap); + cpuid = PCPU_GET(cpuid); +#ifdef SMP + CPU_CLR_ATOMIC(cpuid, &oldpmap->pm_active); + CPU_SET_ATOMIC(cpuid, &pmap->pm_active); +#else + CPU_CLR(cpuid, &oldpmap->pm_active); + CPU_SET(cpuid, &pmap->pm_active); +#endif + cr3 = pmap_kextract((vm_offset_t)pmap->pm_pml4); + td->td_pcb->pcb_cr3 = cr3; + if (__predict_false(pmap == kernel_pmap)) { + xen_load_cr3(cr3); + } + else { + pmap_xen_userload(pmap); + } + + PCPU_SET(curpmap, pmap); + critical_exit(); } void @@ -1379,12 +1801,10 @@ pmap_page_set_memattr(vm_page_t m, vm_me { KASSERT(0, ("XXX: %s: TODO\n", __func__)); } - +#include static bool pv_dummy(pmap_t pmap, vm_offset_t va, vm_page_t m) { - printf("%s: va == 0x%lx, pa == 0x%lx\n", - __func__, va, VM_PAGE_TO_PHYS(m)); return true; /* stop at the first iteration */ } @@ -1393,7 +1813,7 @@ pmap_page_is_mapped(vm_page_t m) { if ((m->oflags & VPO_UNMANAGED) != 0) return (FALSE); - printf("pmap_pv_iterate(m, pv_dummy) == %d\n", pmap_pv_iterate(m, pv_dummy)); + return pmap_pv_iterate(m, pv_dummy); } @@ -1425,11 +1845,47 @@ pmap_is_referenced(vm_page_t m) return 0; } +/* + * pmap_is_prefaultable: + * + * Return whether or not the specified virtual address is elgible + * for prefault. + */ + +/* + * XXX: I've just duplicated what native does here. I *think*, with + * mmu_map.[ch] (which native doesn't have), addr is always + * prefaultable. Research this. + */ boolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) { - KASSERT(0, ("XXX: %s: TODO\n", __func__)); - return 0; + boolean_t prefaultable = false; + + KASSERT(tsz != 0, ("tsz != 0")); + + char tbuf[tsz]; /* Safe to do this on the stack since tsz is + * effectively const. + */ + + mmu_map_t tptr = tbuf; + + struct mmu_map_mbackend mb = { + ptmb_mappedalloc, + ptmb_mappedfree, + ptmb_ptov, + ptmb_vtop + }; + + mmu_map_t_init(tptr, &mb); + + PMAP_LOCK(pmap); + prefaultable = mmu_map_inspect_va(pmap, tptr, addr); + PMAP_UNLOCK(pmap); + + mmu_map_t_fini(tptr); + + return prefaultable; } void @@ -1448,7 +1904,6 @@ pmap_clear_reference(vm_page_t m) static bool pv_remove_write(pmap_t pmap, vm_offset_t va, vm_page_t m) { - pt_entry_t oldpte, *pte; char tbuf[tsz]; /* Safe to do this on the stack since tsz is * effectively const. @@ -1457,9 +1912,11 @@ pv_remove_write(pmap_t pmap, vm_offset_t mmu_map_t tptr = tbuf; PMAP_LOCK(pmap); - pte = pmap_vtopte_hold(pmap, va, &tptr); + pte = pmap_vtopte_inspect(pmap, va, &tptr); - oldpte = *pte; + KASSERT(pte != NULL, ("pte has no backing page tables!")); + + oldpte = pte_load(pte); if (oldpte & PG_RW) { PT_SET_MA(va, oldpte & ~(PG_RW | PG_M)); if ((oldpte & PG_M) != 0) @@ -1592,6 +2049,12 @@ xen_vm_vtop(uintptr_t va) return DMAP_TO_PHYS(va); } + if (ISKERNELVA(va)) { + return pmap_kextract(va); + } + + panic("Unknown VA 0x%lxpassed to %s\n", va, __func__); + return 0; } Modified: projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c Sun Apr 14 08:49:35 2013 (r249464) +++ projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c Sun Apr 14 09:05:40 2013 (r249465) @@ -136,6 +136,7 @@ static struct mtx pv_chunks_mutex; static struct rwlock pv_list_locks[NPV_LIST_LOCKS]; vm_map_t pv_map; /* Kernel submap for pc chunk alloc */ +extern vm_offset_t pv_minva, pv_maxva; /* VA range for submap */ /*************************************************** * page management routines. @@ -169,21 +170,31 @@ pv_to_chunk(pv_entry_t pv) #include #include - static void free_pv_chunk(struct pv_chunk *pc) { vm_page_t m; - mtx_lock(&pv_chunks_mutex); TAILQ_REMOVE(&pv_chunks, pc, pc_lru); mtx_unlock(&pv_chunks_mutex); PV_STAT(atomic_subtract_int(&pv_entry_spare, _NPCPV)); PV_STAT(atomic_subtract_int(&pc_chunk_count, 1)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sun Apr 14 09:38:33 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A366FA69; Sun, 14 Apr 2013 09:38:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 85C978A0; Sun, 14 Apr 2013 09:38:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E9cXBC020228; Sun, 14 Apr 2013 09:38:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E9cS1Z020194; Sun, 14 Apr 2013 09:38:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304140938.r3E9cS1Z020194@svn.freebsd.org> From: Alexander Motin Date: Sun, 14 Apr 2013 09:38:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249467 - in projects/camlock: contrib/ldns/compat contrib/ldns/ldns lib/libldns sys/amd64/amd64 sys/amd64/vmm/intel sys/arm/allwinner sys/arm/broadcom/bcm2835 sys/arm/freescale/imx sys... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 09:38:33 -0000 Author: mav Date: Sun Apr 14 09:38:28 2013 New Revision: 249467 URL: http://svnweb.freebsd.org/changeset/base/249467 Log: MFC @ r249466 Modified: projects/camlock/contrib/ldns/compat/b32_ntop.c projects/camlock/contrib/ldns/compat/b32_pton.c projects/camlock/contrib/ldns/compat/b64_ntop.c projects/camlock/contrib/ldns/compat/b64_pton.c projects/camlock/contrib/ldns/ldns/config.h projects/camlock/contrib/ldns/ldns/util.h projects/camlock/lib/libldns/Makefile projects/camlock/sys/amd64/amd64/support.S projects/camlock/sys/amd64/vmm/intel/vmx.c projects/camlock/sys/arm/allwinner/a10_gpio.c projects/camlock/sys/arm/broadcom/bcm2835/bcm2835_gpio.c projects/camlock/sys/arm/freescale/imx/imx51_gpio.c projects/camlock/sys/arm/xscale/ixp425/avila_gpio.c projects/camlock/sys/arm/xscale/ixp425/cambria_gpio.c projects/camlock/sys/dev/hwpmc/hwpmc_core.c projects/camlock/sys/dev/ips/ips.c projects/camlock/sys/geom/nop/g_nop.c projects/camlock/sys/geom/nop/g_nop.h projects/camlock/sys/i386/i386/support.s projects/camlock/sys/mips/atheros/ar71xx_gpio.c projects/camlock/sys/mips/cavium/octeon_gpio.c projects/camlock/sys/mips/rt305x/rt305x_gpio.c projects/camlock/usr.bin/calendar/calendars/calendar.birthday projects/camlock/usr.bin/calendar/calendars/calendar.history Directory Properties: projects/camlock/ (props changed) projects/camlock/contrib/ldns/ (props changed) projects/camlock/sys/ (props changed) projects/camlock/sys/amd64/vmm/ (props changed) projects/camlock/usr.bin/calendar/ (props changed) Modified: projects/camlock/contrib/ldns/compat/b32_ntop.c ============================================================================== --- projects/camlock/contrib/ldns/compat/b32_ntop.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/contrib/ldns/compat/b32_ntop.c Sun Apr 14 09:38:28 2013 (r249467) @@ -40,6 +40,7 @@ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. */ #include +#ifndef HAVE_B32_NTOP #include #include @@ -61,6 +62,8 @@ #include +#include + static const char Base32[] = "abcdefghijklmnopqrstuvwxyz234567"; /* "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";*/ @@ -171,7 +174,7 @@ static const char Pad32 = '='; */ -int +static int ldns_b32_ntop_ar(uint8_t const *src, size_t srclength, char *target, size_t targsize, const char B32_ar[]) { size_t datalength = 0; uint8_t input[5]; @@ -331,3 +334,4 @@ b32_ntop_extended_hex(uint8_t const *src return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32_extended_hex); } +#endif /* !HAVE_B32_NTOP */ Modified: projects/camlock/contrib/ldns/compat/b32_pton.c ============================================================================== --- projects/camlock/contrib/ldns/compat/b32_pton.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/contrib/ldns/compat/b32_pton.c Sun Apr 14 09:38:28 2013 (r249467) @@ -40,6 +40,7 @@ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. */ #include +#ifndef HAVE_B32_PTON #include #include @@ -59,6 +60,8 @@ #include #include +#include + /* "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";*/ static const char Base32[] = "abcdefghijklmnopqrstuvwxyz234567"; @@ -174,7 +177,7 @@ static const char Pad32 = '='; it returns the number of data bytes stored at the target, or -1 on error. */ -int +static int ldns_b32_pton_ar(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize, const char B32_ar[]) { int tarindex, state, ch; @@ -385,3 +388,5 @@ b32_pton_extended_hex(char const *src, s { return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32_extended_hex); } + +#endif /* !HAVE_B32_PTON */ Modified: projects/camlock/contrib/ldns/compat/b64_ntop.c ============================================================================== --- projects/camlock/contrib/ldns/compat/b64_ntop.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/contrib/ldns/compat/b64_ntop.c Sun Apr 14 09:38:28 2013 (r249467) @@ -40,6 +40,7 @@ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. */ #include +#ifndef HAVE_B64_NTOP #include #include @@ -59,6 +60,8 @@ #include #include +#include + #define Assert(Cond) if (!(Cond)) abort() static const char Base64[] = @@ -200,3 +203,5 @@ ldns_b64_ntop(uint8_t const *src, size_t target[datalength] = '\0'; /* Returned value doesn't count \0. */ return (int) (datalength); } + +#endif /* !HAVE_B64_NTOP */ Modified: projects/camlock/contrib/ldns/compat/b64_pton.c ============================================================================== --- projects/camlock/contrib/ldns/compat/b64_pton.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/contrib/ldns/compat/b64_pton.c Sun Apr 14 09:38:28 2013 (r249467) @@ -40,6 +40,7 @@ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. */ #include +#ifndef HAVE_B64_PTON #include #include @@ -59,7 +60,7 @@ #include #include -#define Assert(Cond) if (!(Cond)) abort() +#include static const char Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -258,3 +259,5 @@ ldns_b64_pton(char const *src, uint8_t * return (tarindex); } + +#endif /* !HAVE_B64_PTON */ Modified: projects/camlock/contrib/ldns/ldns/config.h ============================================================================== --- projects/camlock/contrib/ldns/ldns/config.h Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/contrib/ldns/ldns/config.h Sun Apr 14 09:38:28 2013 (r249467) @@ -489,30 +489,6 @@ extern "C" { #endif -#ifndef B64_PTON -int ldns_b64_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -/** - * calculates the size needed to store the result of b64_ntop - */ -/*@unused@*/ -static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) -{ - return ((((srcsize + 2) / 3) * 4) + 1); -} -#endif /* !B64_PTON */ -#ifndef B64_NTOP -int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); -/** - * calculates the size needed to store the result of ldns_b64_pton - */ -/*@unused@*/ -static inline size_t ldns_b64_pton_calculate_size(size_t srcsize) -{ - return (((((srcsize + 3) / 4) * 3)) + 1); -} -#endif /* !B64_NTOP */ - #ifndef HAVE_SLEEP /* use windows sleep, in millisecs, instead */ #define sleep(x) Sleep((x)*1000) Modified: projects/camlock/contrib/ldns/ldns/util.h ============================================================================== --- projects/camlock/contrib/ldns/ldns/util.h Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/contrib/ldns/ldns/util.h Sun Apr 14 09:38:28 2013 (r249467) @@ -325,7 +325,7 @@ uint16_t ldns_get_random(void); */ char *ldns_bubblebabble(uint8_t *data, size_t len); -#ifndef B32_NTOP +#ifndef HAVE_B32_NTOP int ldns_b32_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize); int b32_ntop(uint8_t const *src, size_t srclength, @@ -343,8 +343,8 @@ INLINE size_t ldns_b32_ntop_calculate_si size_t result = ((((srcsize / 5) * 8) - 2) + 2); return result; } -#endif /* !B32_NTOP */ -#ifndef B32_PTON +#endif /* !HAVE_B32_NTOP */ +#ifndef HAVE_B32_PTON int ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); int b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); @@ -358,7 +358,30 @@ INLINE size_t ldns_b32_pton_calculate_si size_t result = ((((srcsize) / 8) * 5)); return result; } -#endif /* !B32_PTON */ +#endif /* !HAVE_B32_PTON */ +#ifndef HAVE_B64_NTOP +int ldns_b64_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +/** + * calculates the size needed to store the result of b64_ntop + */ +/*@unused@*/ +static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) +{ + return ((((srcsize + 2) / 3) * 4) + 1); +} +#endif /* !HAVE_B64_NTOP */ +#ifndef HAVE_B64_PTON +int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); +/** + * calculates the size needed to store the result of ldns_b64_pton + */ +/*@unused@*/ +static inline size_t ldns_b64_pton_calculate_size(size_t srcsize) +{ + return (((((srcsize + 3) / 4) * 3)) + 1); +} +#endif /* !HAVE_B64_PTON */ INLINE time_t ldns_time(time_t *t) { return time(t); } Modified: projects/camlock/lib/libldns/Makefile ============================================================================== --- projects/camlock/lib/libldns/Makefile Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/lib/libldns/Makefile Sun Apr 14 09:38:28 2013 (r249467) @@ -3,42 +3,20 @@ # Vendor sources and generated files LDNSDIR = ${.CURDIR}/../../contrib/ldns -.PATH: ${LDNSDIR} +.PATH: ${LDNSDIR} ${LDNSDIR}/compat -LIB = ldns -INTERNALLIB = true +LIB= ldns +INTERNALLIB= true -CFLAGS += -I${LDNSDIR} +CFLAGS+= -I${LDNSDIR} -SRCS += buffer.c -SRCS += dane.c -SRCS += dname.c -SRCS += dnssec.c -SRCS += dnssec_sign.c -SRCS += dnssec_verify.c -SRCS += dnssec_zone.c -SRCS += duration.c -SRCS += error.c -SRCS += higher.c -SRCS += host2str.c -SRCS += host2wire.c -SRCS += keys.c -SRCS += net.c -SRCS += packet.c -SRCS += parse.c -SRCS += rbtree.c -SRCS += rdata.c -SRCS += resolver.c -SRCS += rr.c -SRCS += rr_functions.c -SRCS += sha1.c -SRCS += sha2.c -SRCS += str2host.c -SRCS += tsig.c -SRCS += update.c -SRCS += util.c -SRCS += wire2host.c -SRCS += zone.c +SRCS= buffer.c dane.c dname.c dnssec.c dnssec_sign.c dnssec_verify.c \ + dnssec_zone.c duration.c error.c higher.c host2str.c host2wire.c \ + keys.c net.c packet.c parse.c rbtree.c rdata.c resolver.c rr.c \ + rr_functions.c sha1.c sha2.c str2host.c tsig.c update.c util.c \ + wire2host.c zone.c + +SRCS+= b32_ntop.c b32_pton.c b64_ntop.c b64_pton.c WARNS ?= 3 Modified: projects/camlock/sys/amd64/amd64/support.S ============================================================================== --- projects/camlock/sys/amd64/amd64/support.S Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/amd64/amd64/support.S Sun Apr 14 09:38:28 2013 (r249467) @@ -200,9 +200,9 @@ END(fillw) * Access user memory from inside the kernel. These routines should be * the only places that do this. * - * These routines set curpcb->onfault for the time they execute. When a + * These routines set curpcb->pcb_onfault for the time they execute. When a * protection violation occurs inside the functions, the trap handler - * returns to *curpcb->onfault instead of the function. + * returns to *curpcb->pcb_onfault instead of the function. */ /* Modified: projects/camlock/sys/amd64/vmm/intel/vmx.c ============================================================================== --- projects/camlock/sys/amd64/vmm/intel/vmx.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/amd64/vmm/intel/vmx.c Sun Apr 14 09:38:28 2013 (r249467) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -116,6 +117,9 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_VMX, "vmx", "vmx"); +SYSCTL_DECL(_hw_vmm); +SYSCTL_NODE(_hw_vmm, OID_AUTO, vmx, CTLFLAG_RW, NULL, NULL); + int vmxon_enabled[MAXCPU]; static char vmxon_region[MAXCPU][PAGE_SIZE] __aligned(PAGE_SIZE); @@ -123,12 +127,25 @@ static uint32_t pinbased_ctls, procbased static uint32_t exit_ctls, entry_ctls; static uint64_t cr0_ones_mask, cr0_zeros_mask; +SYSCTL_ULONG(_hw_vmm_vmx, OID_AUTO, cr0_ones_mask, CTLFLAG_RD, + &cr0_ones_mask, 0, NULL); +SYSCTL_ULONG(_hw_vmm_vmx, OID_AUTO, cr0_zeros_mask, CTLFLAG_RD, + &cr0_zeros_mask, 0, NULL); + static uint64_t cr4_ones_mask, cr4_zeros_mask; +SYSCTL_ULONG(_hw_vmm_vmx, OID_AUTO, cr4_ones_mask, CTLFLAG_RD, + &cr4_ones_mask, 0, NULL); +SYSCTL_ULONG(_hw_vmm_vmx, OID_AUTO, cr4_zeros_mask, CTLFLAG_RD, + &cr4_zeros_mask, 0, NULL); static volatile u_int nextvpid; static int vmx_no_patmsr; +static int vmx_initialized; +SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, initialized, CTLFLAG_RD, + &vmx_initialized, 0, "Intel VMX initialized"); + /* * Virtual NMI blocking conditions. * @@ -593,6 +610,8 @@ vmx_init(void) /* enable VMX operation */ smp_rendezvous(NULL, vmx_enable, NULL, NULL); + vmx_initialized = 1; + return (0); } Modified: projects/camlock/sys/arm/allwinner/a10_gpio.c ============================================================================== --- projects/camlock/sys/arm/allwinner/a10_gpio.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/arm/allwinner/a10_gpio.c Sun Apr 14 09:38:28 2013 (r249467) @@ -300,8 +300,8 @@ a10_gpio_pin_setflags(device_t dev, uint if (i >= sc->sc_gpio_npins) return (EINVAL); - /* Filter out unwanted flags. */ - if ((flags &= sc->sc_gpio_pins[i].gp_caps) != flags) + /* Check for unwanted flags. */ + if ((flags & sc->sc_gpio_pins[i].gp_caps) != flags) return (EINVAL); /* Can't mix input/output together. */ Modified: projects/camlock/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- projects/camlock/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Sun Apr 14 09:38:28 2013 (r249467) @@ -385,8 +385,8 @@ bcm_gpio_pin_setflags(device_t dev, uint if (bcm_gpio_pin_is_ro(sc, pin)) return (EINVAL); - /* Filter out unwanted flags. */ - if ((flags &= sc->sc_gpio_pins[i].gp_caps) != flags) + /* Check for unwanted flags. */ + if ((flags & sc->sc_gpio_pins[i].gp_caps) != flags) return (EINVAL); /* Can't mix input/output together. */ Modified: projects/camlock/sys/arm/freescale/imx/imx51_gpio.c ============================================================================== --- projects/camlock/sys/arm/freescale/imx/imx51_gpio.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/arm/freescale/imx/imx51_gpio.c Sun Apr 14 09:38:28 2013 (r249467) @@ -261,8 +261,8 @@ imx51_gpio_pin_setflags(device_t dev, ui if (i >= sc->gpio_npins) return (EINVAL); - /* Filter out unwanted flags */ - if ((flags &= sc->gpio_pins[i].gp_caps) != flags) + /* Check for unwanted flags. */ + if ((flags & sc->gpio_pins[i].gp_caps) != flags) return (EINVAL); /* Can't mix input/output together */ Modified: projects/camlock/sys/arm/xscale/ixp425/avila_gpio.c ============================================================================== --- projects/camlock/sys/arm/xscale/ixp425/avila_gpio.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/arm/xscale/ixp425/avila_gpio.c Sun Apr 14 09:38:28 2013 (r249467) @@ -220,8 +220,8 @@ avila_gpio_pin_setflags(device_t dev, ui if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & mask)) return (EINVAL); - /* Filter out unwanted flags */ - if ((flags &= sc->sc_pins[pin].gp_caps) != flags) + /* Check for unwanted flags. */ + if ((flags & sc->sc_pins[pin].gp_caps) != flags) return (EINVAL); /* Can't mix input/output together */ Modified: projects/camlock/sys/arm/xscale/ixp425/cambria_gpio.c ============================================================================== --- projects/camlock/sys/arm/xscale/ixp425/cambria_gpio.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/arm/xscale/ixp425/cambria_gpio.c Sun Apr 14 09:38:28 2013 (r249467) @@ -317,8 +317,8 @@ cambria_gpio_pin_setflags(device_t dev, if (pin >= GPIO_PINS) return (EINVAL); - /* Filter out unwanted flags */ - if ((flags &= sc->sc_pins[pin].gp_caps) != flags) + /* Check for unwanted flags. */ + if ((flags & sc->sc_pins[pin].gp_caps) != flags) return (EINVAL); /* Can't mix input/output together */ Modified: projects/camlock/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- projects/camlock/sys/dev/hwpmc/hwpmc_core.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/dev/hwpmc/hwpmc_core.c Sun Apr 14 09:38:28 2013 (r249467) @@ -25,7 +25,7 @@ */ /* - * Intel Core, Core 2 and Atom PMCs. + * Intel Core PMCs. */ #include Modified: projects/camlock/sys/dev/ips/ips.c ============================================================================== --- projects/camlock/sys/dev/ips/ips.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/dev/ips/ips.c Sun Apr 14 09:38:28 2013 (r249467) @@ -578,7 +578,7 @@ static int ips_copperhead_queue_init(ips { int error; bus_dma_tag_t dmatag; - bus_dmamap_t dmamap; + bus_dmamap_t dmamap = NULL; if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, /* alignemnt */ 1, /* boundary */ 0, Modified: projects/camlock/sys/geom/nop/g_nop.c ============================================================================== --- projects/camlock/sys/geom/nop/g_nop.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/geom/nop/g_nop.c Sun Apr 14 09:38:28 2013 (r249467) @@ -124,7 +124,7 @@ g_nop_start(struct bio *bp) rval = arc4random() % 100; if (rval < failprob) { - G_NOP_LOGREQ(bp, "Returning error=%d.", sc->sc_error); + G_NOP_LOGREQLVL(1, bp, "Returning error=%d.", sc->sc_error); g_io_deliver(bp, sc->sc_error); return; } Modified: projects/camlock/sys/geom/nop/g_nop.h ============================================================================== --- projects/camlock/sys/geom/nop/g_nop.h Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/geom/nop/g_nop.h Sun Apr 14 09:38:28 2013 (r249467) @@ -44,9 +44,10 @@ printf("\n"); \ } \ } while (0) -#define G_NOP_LOGREQ(bp, ...) do { \ - if (g_nop_debug >= 2) { \ - printf("GEOM_NOP[2]: "); \ +#define G_NOP_LOGREQ(bp, ...) G_NOP_LOGREQLVL(2, bp, __VA_ARGS__) +#define G_NOP_LOGREQLVL(lvl, bp, ...) do { \ + if (g_nop_debug >= (lvl)) { \ + printf("GEOM_NOP[%d]: ", (lvl)); \ printf(__VA_ARGS__); \ printf(" "); \ g_print_bio(bp); \ Modified: projects/camlock/sys/i386/i386/support.s ============================================================================== --- projects/camlock/sys/i386/i386/support.s Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/i386/i386/support.s Sun Apr 14 09:38:28 2013 (r249467) @@ -262,9 +262,9 @@ END(memcpy) * write permissions when we are executing with EPL 0. The 486 does check * this if the WP bit is set in CR0, so we can use a simpler version here. * - * These routines set curpcb->onfault for the time they execute. When a + * These routines set curpcb->pcb_onfault for the time they execute. When a * protection violation occurs inside the functions, the trap handler - * returns to *curpcb->onfault instead of the function. + * returns to *curpcb->pcb_onfault instead of the function. */ /* Modified: projects/camlock/sys/mips/atheros/ar71xx_gpio.c ============================================================================== --- projects/camlock/sys/mips/atheros/ar71xx_gpio.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/mips/atheros/ar71xx_gpio.c Sun Apr 14 09:38:28 2013 (r249467) @@ -219,8 +219,8 @@ ar71xx_gpio_pin_setflags(device_t dev, u if (i >= sc->gpio_npins) return (EINVAL); - /* Filter out unwanted flags */ - if ((flags &= sc->gpio_pins[i].gp_caps) != flags) + /* Check for unwanted flags. */ + if ((flags & sc->gpio_pins[i].gp_caps) != flags) return (EINVAL); /* Can't mix input/output together */ Modified: projects/camlock/sys/mips/cavium/octeon_gpio.c ============================================================================== --- projects/camlock/sys/mips/cavium/octeon_gpio.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/mips/cavium/octeon_gpio.c Sun Apr 14 09:38:28 2013 (r249467) @@ -219,8 +219,8 @@ octeon_gpio_pin_setflags(device_t dev, u if (i >= sc->gpio_npins) return (EINVAL); - /* Filter out unwanted flags */ - if ((flags &= sc->gpio_pins[i].gp_caps) != flags) + /* Check for unwanted flags. */ + if ((flags & sc->gpio_pins[i].gp_caps) != flags) return (EINVAL); /* Can't mix input/output together */ Modified: projects/camlock/sys/mips/rt305x/rt305x_gpio.c ============================================================================== --- projects/camlock/sys/mips/rt305x/rt305x_gpio.c Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/sys/mips/rt305x/rt305x_gpio.c Sun Apr 14 09:38:28 2013 (r249467) @@ -242,8 +242,8 @@ rt305x_gpio_pin_setflags(device_t dev, u if (i >= sc->gpio_npins) return (EINVAL); - /* Filter out unwanted flags */ - if ((flags &= sc->gpio_pins[i].gp_caps) != flags) + /* Check for unwanted flags. */ + if ((flags & sc->gpio_pins[i].gp_caps) != flags) return (EINVAL); /* Can't mix input/output together */ Modified: projects/camlock/usr.bin/calendar/calendars/calendar.birthday ============================================================================== --- projects/camlock/usr.bin/calendar/calendars/calendar.birthday Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/usr.bin/calendar/calendars/calendar.birthday Sun Apr 14 09:38:28 2013 (r249467) @@ -120,7 +120,7 @@ 04/10 William Booth born, 1829, founder of the Salvation Army 04/13 Thomas Jefferson, 3rd President of the United States, born Shadwell Plantation, Albemarle County, Virginia, 1743 -04/14 Christian Huygen born, 1629, physicist & astronomer; +04/14 Christiaan Huygens born, 1629, physicist & astronomer; discovered Saturn's rings 04/15 Leonardo da Vinci born, 1452 04/16 Charles (Charlie) Chaplin (Sir) born in London, 1889 Modified: projects/camlock/usr.bin/calendar/calendars/calendar.history ============================================================================== --- projects/camlock/usr.bin/calendar/calendars/calendar.history Sun Apr 14 09:28:14 2013 (r249466) +++ projects/camlock/usr.bin/calendar/calendars/calendar.history Sun Apr 14 09:38:28 2013 (r249467) @@ -99,7 +99,6 @@ 04/04 Martin Luther King assassinated in Memphis, Tennessee, 1968 04/04 NATO Established, 1949 04/06 Joseph Smith founds Mormon Church, 1830 -04/07 Albert Hofmann synthesizes LSD in Switzerland, 1943 04/07 Alewives run, Cape Cod 04/08 Matthew Flinders and Nicolas Baudin meet in Encounter Bay, 1802 04/09 Lee surrenders to Grant at Appomattox Courthouse, 1865 @@ -420,6 +419,7 @@ from McDonald's), 1971 11/15 Niagara Falls power plant startup, 1896 11/16 Opening of the Suez Canal, 1869 +11/16 Albert Hofmann synthesizes LSD in Switzerland, 1938 11/17 46,000 meteoroids fall over AZ in 20 minutes, 1966 11/17 Richard Nixon says "I am not a crook.", 1973 11/18 First hydrogen bomb blasts Enewetok, 1952 From owner-svn-src-projects@FreeBSD.ORG Sun Apr 14 09:59:41 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D4A60F30; Sun, 14 Apr 2013 09:59:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AE01290F; Sun, 14 Apr 2013 09:59:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3E9xfif026311; Sun, 14 Apr 2013 09:59:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3E9xfbA026309; Sun, 14 Apr 2013 09:59:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304140959.r3E9xfbA026309@svn.freebsd.org> From: Alexander Motin Date: Sun, 14 Apr 2013 09:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249469 - in projects/camlock: . sys X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 09:59:41 -0000 Author: mav Date: Sun Apr 14 09:59:41 2013 New Revision: 249469 URL: http://svnweb.freebsd.org/changeset/base/249469 Log: MFC @ 249468 Modified: Directory Properties: projects/camlock/ (props changed) projects/camlock/sys/ (props changed) From owner-svn-src-projects@FreeBSD.ORG Sun Apr 14 18:12:43 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 41A5D648; Sun, 14 Apr 2013 18:12:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3314DB55; Sun, 14 Apr 2013 18:12:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EIChWF077659; Sun, 14 Apr 2013 18:12:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EICemK077642; Sun, 14 Apr 2013 18:12:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304141812.r3EICemK077642@svn.freebsd.org> From: Alexander Motin Date: Sun, 14 Apr 2013 18:12:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249482 - in projects/camlock: . contrib/openpam/lib crypto/openssh lib/libc/nls lib/libpam sbin/geom/class/nop sys/cam sys/dev/ata sys/dev/pci sys/kern sys/sys X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 18:12:43 -0000 Author: mav Date: Sun Apr 14 18:12:40 2013 New Revision: 249482 URL: http://svnweb.freebsd.org/changeset/base/249482 Log: MFC @ 249481 Modified: projects/camlock/ObsoleteFiles.inc projects/camlock/contrib/openpam/lib/openpam_log.c projects/camlock/crypto/openssh/packet.c projects/camlock/lib/libc/nls/fr_FR.ISO8859-1.msg projects/camlock/lib/libpam/Makefile.inc projects/camlock/sbin/geom/class/nop/gnop.8 projects/camlock/sys/cam/cam_queue.h projects/camlock/sys/cam/cam_xpt.c projects/camlock/sys/dev/ata/ata-pci.c projects/camlock/sys/dev/pci/vga_pci.c projects/camlock/sys/kern/kern_descrip.c projects/camlock/sys/kern/uipc_usrreq.c projects/camlock/sys/sys/filedesc.h Directory Properties: projects/camlock/ (props changed) projects/camlock/contrib/openpam/ (props changed) projects/camlock/crypto/openssh/ (props changed) projects/camlock/lib/libc/ (props changed) projects/camlock/sbin/ (props changed) projects/camlock/sys/ (props changed) Modified: projects/camlock/ObsoleteFiles.inc ============================================================================== --- projects/camlock/ObsoleteFiles.inc Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/ObsoleteFiles.inc Sun Apr 14 18:12:40 2013 (r249482) @@ -70,6 +70,7 @@ OLD_FILES+=usr/include/clang/3.2/xmmintr OLD_FILES+=usr/include/clang/3.2/xopintrin.h OLD_DIRS+=usr/include/clang/3.2 # 20130404: legacy ATA stack removed +OLD_FILES+=rescue/atacontrol OLD_FILES+=sbin/atacontrol OLD_FILES+=usr/share/man/man8/atacontrol.8.gz OLD_FILES+=usr/share/man/man4/atapicam.4.gz Modified: projects/camlock/contrib/openpam/lib/openpam_log.c ============================================================================== --- projects/camlock/contrib/openpam/lib/openpam_log.c Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/contrib/openpam/lib/openpam_log.c Sun Apr 14 18:12:40 2013 (r249482) @@ -49,11 +49,7 @@ #include "openpam_impl.h" -#ifdef OPENPAM_DEBUG -int openpam_debug = 1; -#else int openpam_debug = 0; -#endif #if !defined(openpam_log) Modified: projects/camlock/crypto/openssh/packet.c ============================================================================== --- projects/camlock/crypto/openssh/packet.c Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/crypto/openssh/packet.c Sun Apr 14 18:12:40 2013 (r249482) @@ -1465,7 +1465,11 @@ packet_read_poll_seqnr(u_int32_t *seqnr_ case SSH2_MSG_DISCONNECT: reason = packet_get_int(); msg = packet_get_string(NULL); - error("Received disconnect from %s: %u: %.400s", + /* Ignore normal client exit notifications */ + do_log2(active_state->server_side && + reason == SSH2_DISCONNECT_BY_APPLICATION ? + SYSLOG_LEVEL_DEBUG1 : SYSLOG_LEVEL_ERROR, + "Received disconnect from %s: %u: %.400s", get_remote_ipaddr(), reason, msg); xfree(msg); cleanup_exit(255); @@ -1490,7 +1494,7 @@ packet_read_poll_seqnr(u_int32_t *seqnr_ break; case SSH_MSG_DISCONNECT: msg = packet_get_string(NULL); - error("Received disconnect from %s: %.400s", + logit("Received disconnect from %s: %.400s", get_remote_ipaddr(), msg); cleanup_exit(255); break; Modified: projects/camlock/lib/libc/nls/fr_FR.ISO8859-1.msg ============================================================================== --- projects/camlock/lib/libc/nls/fr_FR.ISO8859-1.msg Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/lib/libc/nls/fr_FR.ISO8859-1.msg Sun Apr 14 18:12:40 2013 (r249482) @@ -94,7 +94,7 @@ $ EPROTONOSUPPORT $ ESOCKTNOSUPPORT 44 Type de socket non supporté $ EOPNOTSUPP -45 Opération non supporté +45 Opération non supportée $ EPFNOSUPPORT 46 Famille de protocole non supportée $ EAFNOSUPPORT Modified: projects/camlock/lib/libpam/Makefile.inc ============================================================================== --- projects/camlock/lib/libpam/Makefile.inc Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/lib/libpam/Makefile.inc Sun Apr 14 18:12:40 2013 (r249482) @@ -24,9 +24,7 @@ # # $FreeBSD$ -.ifdef PAM_DEBUG -DEBUG_FLAGS+= -DDEBUG -.endif +CFLAGS+= -DOPENPAM_DEBUG SHLIB_MAJOR= 5 PAM_MOD_DIR= ${LIBDIR} Modified: projects/camlock/sbin/geom/class/nop/gnop.8 ============================================================================== --- projects/camlock/sbin/geom/class/nop/gnop.8 Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/sbin/geom/class/nop/gnop.8 Sun Apr 14 18:12:40 2013 (r249482) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2009 +.Dd April 14, 2013 .Dt GNOP 8 .Os .Sh NAME @@ -139,8 +139,11 @@ Debug level of the .Nm NOP GEOM class. This can be set to a number between 0 and 2 inclusive. -If set to 0 minimal debug information is printed, and if set to 2 the -maximum amount of debug information is printed. +If set to 0, minimal debug information is printed. +If set to 1, basic debug information is logged along with the I/O requests +that were returned as errors. +If set to 2, the maximum amount of debug information is printed including +all I/O requests. .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. Modified: projects/camlock/sys/cam/cam_queue.h ============================================================================== --- projects/camlock/sys/cam/cam_queue.h Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/sys/cam/cam_queue.h Sun Apr 14 18:12:40 2013 (r249482) @@ -158,10 +158,10 @@ cam_ccbq_pending_ccb_count(struct cam_cc static __inline void cam_ccbq_take_opening(struct cam_ccbq *ccbq); -static __inline int +static __inline void cam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb); -static __inline int +static __inline void cam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb); static __inline union ccb * @@ -190,29 +190,17 @@ cam_ccbq_take_opening(struct cam_ccbq *c ccbq->held++; } -static __inline int +static __inline void cam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb) { ccbq->held--; camq_insert(&ccbq->queue, &new_ccb->ccb_h.pinfo); - if (ccbq->queue.qfrozen_cnt > 0) { - ccbq->devq_openings++; - ccbq->held++; - return (1); - } else - return (0); } -static __inline int +static __inline void cam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb) { camq_remove(&ccbq->queue, ccb->ccb_h.pinfo.index); - if (ccbq->queue.qfrozen_cnt > 0) { - ccbq->devq_openings--; - ccbq->held--; - return (1); - } else - return (0); } static __inline union ccb * Modified: projects/camlock/sys/cam/cam_xpt.c ============================================================================== --- projects/camlock/sys/cam/cam_xpt.c Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/sys/cam/cam_xpt.c Sun Apr 14 18:12:40 2013 (r249482) @@ -2464,8 +2464,8 @@ xpt_action_default(union ccb *start_ccb) devq = path->bus->sim->devq; mtx_lock(&devq->send_mtx); - if (cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb) == 0 && - xpt_schedule_devq(devq, path->device) != 0) + cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); + if (xpt_schedule_devq(devq, path->device) != 0) xpt_run_devq(devq); mtx_unlock(&devq->send_mtx); break; Modified: projects/camlock/sys/dev/ata/ata-pci.c ============================================================================== --- projects/camlock/sys/dev/ata/ata-pci.c Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/sys/dev/ata/ata-pci.c Sun Apr 14 18:12:40 2013 (r249482) @@ -571,6 +571,13 @@ ata_pci_child_location_str(device_t dev, return (0); } +static bus_dma_tag_t +ata_pci_get_dma_tag(device_t bus, device_t child) +{ + + return (bus_get_dma_tag(bus)); +} + static device_method_t ata_pci_methods[] = { /* device interface */ DEVMETHOD(device_probe, ata_pci_probe), @@ -593,6 +600,7 @@ static device_method_t ata_pci_methods[] DEVMETHOD(pci_write_config, ata_pci_write_config), DEVMETHOD(bus_print_child, ata_pci_print_child), DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), + DEVMETHOD(bus_get_dma_tag, ata_pci_get_dma_tag), DEVMETHOD_END }; Modified: projects/camlock/sys/dev/pci/vga_pci.c ============================================================================== --- projects/camlock/sys/dev/pci/vga_pci.c Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/sys/dev/pci/vga_pci.c Sun Apr 14 18:12:40 2013 (r249482) @@ -419,6 +419,13 @@ vga_pci_msix_count(device_t dev, device_ return (pci_msix_count(dev)); } +static bus_dma_tag_t +vga_pci_get_dma_tag(device_t bus, device_t child) +{ + + return (bus_get_dma_tag(bus)); +} + static device_method_t vga_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, vga_pci_probe), @@ -436,6 +443,7 @@ static device_method_t vga_pci_methods[] DEVMETHOD(bus_release_resource, vga_pci_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_get_dma_tag, vga_pci_get_dma_tag), /* PCI interface */ DEVMETHOD(pci_read_config, vga_pci_read_config), Modified: projects/camlock/sys/kern/kern_descrip.c ============================================================================== --- projects/camlock/sys/kern/kern_descrip.c Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/sys/kern/kern_descrip.c Sun Apr 14 18:12:40 2013 (r249482) @@ -1582,6 +1582,34 @@ fdalloc(struct thread *td, int minfd, in } /* + * Allocate n file descriptors for the process. + */ +int +fdallocn(struct thread *td, int minfd, int *fds, int n) +{ + struct proc *p = td->td_proc; + struct filedesc *fdp = p->p_fd; + int i; + + FILEDESC_XLOCK_ASSERT(fdp); + + if (!fdavail(td, n)) + return (EMFILE); + + for (i = 0; i < n; i++) + if (fdalloc(td, 0, &fds[i]) != 0) + break; + + if (i < n) { + for (i--; i >= 0; i--) + fdunused(fdp, fds[i]); + return (EMFILE); + } + + return (0); +} + +/* * Check to see whether n user file descriptors are available to the process * p. */ Modified: projects/camlock/sys/kern/uipc_usrreq.c ============================================================================== --- projects/camlock/sys/kern/uipc_usrreq.c Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/sys/kern/uipc_usrreq.c Sun Apr 14 18:12:40 2013 (r249482) @@ -1706,7 +1706,6 @@ unp_externalize(struct mbuf *control, st void *data; socklen_t clen = control->m_len, datalen; int error, newfds; - int f; u_int newlen; UNP_LINK_UNLOCK_ASSERT(); @@ -1732,13 +1731,6 @@ unp_externalize(struct mbuf *control, st goto next; } FILEDESC_XLOCK(fdesc); - /* if the new FD's will not fit free them. */ - if (!fdavail(td, newfds)) { - FILEDESC_XUNLOCK(fdesc); - error = EMSGSIZE; - unp_freerights(fdep, newfds); - goto next; - } /* * Now change each pointer to an fd in the global @@ -1758,17 +1750,22 @@ unp_externalize(struct mbuf *control, st fdp = (int *) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); + if (fdallocn(td, 0, fdp, newfds) != 0) { + FILEDESC_XUNLOCK(td->td_proc->p_fd); + error = EMSGSIZE; + unp_freerights(fdep, newfds); + m_freem(*controlp); + *controlp = NULL; + goto next; + } for (i = 0; i < newfds; i++, fdp++) { - if (fdalloc(td, 0, &f)) - panic("unp_externalize fdalloc failed"); - fde = &fdesc->fd_ofiles[f]; + fde = &fdesc->fd_ofiles[*fdp]; fde->fde_file = fdep[0]->fde_file; filecaps_move(&fdep[0]->fde_caps, &fde->fde_caps); if ((flags & MSG_CMSG_CLOEXEC) != 0) fde->fde_flags |= UF_EXCLOSE; unp_externalize_fp(fde->fde_file); - *fdp = f; } FILEDESC_XUNLOCK(fdesc); free(fdep[0], M_FILECAPS); Modified: projects/camlock/sys/sys/filedesc.h ============================================================================== --- projects/camlock/sys/sys/filedesc.h Sun Apr 14 18:09:08 2013 (r249481) +++ projects/camlock/sys/sys/filedesc.h Sun Apr 14 18:12:40 2013 (r249482) @@ -150,6 +150,7 @@ int falloc_noinstall(struct thread *td, int finstall(struct thread *td, struct file *fp, int *resultfp, int flags, struct filecaps *fcaps); int fdalloc(struct thread *td, int minfd, int *result); +int fdallocn(struct thread *td, int minfd, int *fds, int n); int fdavail(struct thread *td, int n); int fdcheckstd(struct thread *td); void fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td); From owner-svn-src-projects@FreeBSD.ORG Sun Apr 14 18:36:30 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B4B83C12; Sun, 14 Apr 2013 18:36:30 +0000 (UTC) (envelope-from cherry@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A6B66D06; Sun, 14 Apr 2013 18:36:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EIaUbJ084029; Sun, 14 Apr 2013 18:36:30 GMT (envelope-from cherry@svn.freebsd.org) Received: (from cherry@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3EIaUNd084027; Sun, 14 Apr 2013 18:36:30 GMT (envelope-from cherry@svn.freebsd.org) Message-Id: <201304141836.r3EIaUNd084027@svn.freebsd.org> From: "Cherry G. Mathew" Date: Sun, 14 Apr 2013 18:36:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249483 - projects/amd64_xen_pv/sys/amd64/xen X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 18:36:30 -0000 Author: cherry Date: Sun Apr 14 18:36:30 2013 New Revision: 249483 URL: http://svnweb.freebsd.org/changeset/base/249483 Log: Fix return to usermode codepath. Approved by: gibbs(implicit) Modified: projects/amd64_xen_pv/sys/amd64/xen/exception.S projects/amd64_xen_pv/sys/amd64/xen/machdep.c Modified: projects/amd64_xen_pv/sys/amd64/xen/exception.S ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/exception.S Sun Apr 14 18:12:40 2013 (r249482) +++ projects/amd64_xen_pv/sys/amd64/xen/exception.S Sun Apr 14 18:36:30 2013 (r249483) @@ -517,6 +517,7 @@ ENTRY(fork_trampoline) DO_AST_MAYBE ; RESTORE_GENERAL_REGS ; RESTORE_SEGMENT_REGS ; + TRAP_FRAME_EXIT_NOERR ; INTR_EXIT ; IDTVEC(hypervisor_callback) /* Xen only */ Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/machdep.c Sun Apr 14 18:12:40 2013 (r249482) +++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c Sun Apr 14 18:36:30 2013 (r249483) @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /*- - * Copyright (c) 2012 Spectra Logic Corporation + * Copyright (c) 2012, 2013 Spectra Logic Corporation * All rights reserved. * * Portions of this software were developed by @@ -175,7 +175,7 @@ setup_gdt(struct user_segment_descriptor #endif /* 0 */ case GUFS32_SEL: case GUGS32_SEL: - case GUDATA_SEL: + case GUDATA_SEL: /* XXX: why def32 ? */ limit = 0xfffff; type = SDT_MEMRWA; dpl = SEL_UPL; @@ -184,6 +184,15 @@ setup_gdt(struct user_segment_descriptor gran = 1; break; + case GUCODE_SEL: + limit = 0xfffff; + type = SDT_MEMERA; + dpl = SEL_UPL; + p = 1; + l = 1; + gran = 1; + break; + case GCODE_SEL: limit = 0xfffff; type = SDT_MEMERA; From owner-svn-src-projects@FreeBSD.ORG Mon Apr 15 03:27:44 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 20F30300; Mon, 15 Apr 2013 03:27:44 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id D266DEA1; Mon, 15 Apr 2013 03:27:40 +0000 (UTC) Received: from jre-mbp.elischer.org (ppp121-45-237-17.lns20.per1.internode.on.net [121.45.237.17]) (authenticated bits=0) by vps1.elischer.org (8.14.5/8.14.5) with ESMTP id r3F3RUC2013163 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 14 Apr 2013 20:27:33 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <516B73A5.6000909@freebsd.org> Date: Mon, 15 Apr 2013 11:27:33 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Neel Natu Subject: Re: svn commit: r249353 - projects/bhyve_svm/sys/amd64/vmm/amd References: <201304110652.r3B6qJmP055359@svn.freebsd.org> In-Reply-To: <201304110652.r3B6qJmP055359@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 03:27:44 -0000 On 4/11/13 2:52 PM, Neel Natu wrote: > Author: neel > Date: Thu Apr 11 06:52:19 2013 > New Revision: 249353 > URL: http://svnweb.freebsd.org/changeset/base/249353 > > Log: > Provide functions to manipulate the guest state in the VMCB. > > Submitted by: Anish Gupta (akgupt3@gmail.com) > > Added: > projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c (contents, props changed) > Modified: > projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h > > Added: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c Thu Apr 11 06:52:19 2013 (r249353) > @@ -0,0 +1,383 @@ > +/*- > + * Copyright (c) 2013 Anish Gupta (akgupt3@gmail.com) > + * 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 NETAPP, INC ``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 NETAPP, INC 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$ > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#include "vmcb.h" about here there should be a comment explianing what a VMCB is and giving background information.. This is true for a lot of files being added these days.. I just picked on this one randomly. Julian > + > +/* > + * Initialize SVM h/w context i.e. the VMCB control and saved state areas. > + */ > +int From owner-svn-src-projects@FreeBSD.ORG Mon Apr 15 04:16:13 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B5F05B1E; Mon, 15 Apr 2013 04:16:13 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A7E4681; Mon, 15 Apr 2013 04:16:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3F4GDRG062968; Mon, 15 Apr 2013 04:16:13 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3F4GDOQ062967; Mon, 15 Apr 2013 04:16:13 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201304150416.r3F4GDOQ062967@svn.freebsd.org> From: Neel Natu Date: Mon, 15 Apr 2013 04:16:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249493 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 04:16:13 -0000 Author: neel Date: Mon Apr 15 04:16:12 2013 New Revision: 249493 URL: http://svnweb.freebsd.org/changeset/base/249493 Log: Add a Cliff Notes version of the purpose and contents of the VMCB. Requested by: julian Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c Mon Apr 15 03:09:59 2013 (r249492) +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c Mon Apr 15 04:16:12 2013 (r249493) @@ -40,6 +40,16 @@ __FBSDID("$FreeBSD$"); #include "vmcb.h" /* + * The VMCB aka Virtual Machine Control Block is a 4KB aligned page + * in memory that describes the virtual machine. + * + * The VMCB contains: + * - instructions or events in the guest to intercept + * - control bits that modify execution environment of the guest + * - guest processor state (e.g. general purpose registers) + */ + +/* * Initialize SVM h/w context i.e. the VMCB control and saved state areas. */ int From owner-svn-src-projects@FreeBSD.ORG Mon Apr 15 04:17:40 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 616F3C42; Mon, 15 Apr 2013 04:17:40 +0000 (UTC) (envelope-from neelnatu@gmail.com) Received: from mail-ie0-x22f.google.com (mail-ie0-x22f.google.com [IPv6:2607:f8b0:4001:c03::22f]) by mx1.freebsd.org (Postfix) with ESMTP id 194A589; Mon, 15 Apr 2013 04:17:40 +0000 (UTC) Received: by mail-ie0-f175.google.com with SMTP id c12so5354393ieb.34 for ; Sun, 14 Apr 2013 21:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=ohf6O4DR+jWug7TQVEiMlf4ESc4e3yqgfFK/maeCxGw=; b=QFX2sEtplmldzMWL9yeKB27D1OaGvtVjJiCXKIrlW7baiY4tHObhxEUGlbajoJgLLO v8DWyoRUbqUfBfOTMyCWhCIvFMAL5lfr/ofRNg3JmagrxK4Etw2/staTY7eeFOMV24CV U1/CE1D/xTUmQJ+5FGYJgmAJWTQayq4Zm1lRYx8epzIPvHcGC1ZYpTB0HevddTGuEiXX oFTqG214slNP5uBtCz+8JWdHaaiWtFo09fH1XbRkySzi0b6l+FI9/ZHKyxJ0BOEcVWP1 fVtXcbcIr5JrPReEIq/AtIq/bNsl5d42DRUfXcvZn3uwbyeC3lpllWHVgWfIvbblLmfN B1fw== MIME-Version: 1.0 X-Received: by 10.43.62.12 with SMTP id wy12mr10988306icb.19.1365999459792; Sun, 14 Apr 2013 21:17:39 -0700 (PDT) Received: by 10.43.9.138 with HTTP; Sun, 14 Apr 2013 21:17:39 -0700 (PDT) In-Reply-To: <516B73A5.6000909@freebsd.org> References: <201304110652.r3B6qJmP055359@svn.freebsd.org> <516B73A5.6000909@freebsd.org> Date: Sun, 14 Apr 2013 21:17:39 -0700 Message-ID: Subject: Re: svn commit: r249353 - projects/bhyve_svm/sys/amd64/vmm/amd From: Neel Natu To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-projects@freebsd.org, "src-committers@freebsd.org" , Neel Natu X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 04:17:40 -0000 Hi Julian, On Sun, Apr 14, 2013 at 8:27 PM, Julian Elischer wrote: > On 4/11/13 2:52 PM, Neel Natu wrote: > >> Author: neel >> Date: Thu Apr 11 06:52:19 2013 >> New Revision: 249353 >> URL: http://svnweb.freebsd.org/**changeset/base/249353 >> >> Log: >> Provide functions to manipulate the guest state in the VMCB. >> Submitted by: Anish Gupta (akgupt3@gmail.com) >> >> Added: >> projects/bhyve_svm/sys/amd64/**vmm/amd/vmcb.c (contents, props >> changed) >> Modified: >> projects/bhyve_svm/sys/amd64/**vmm/amd/vmcb.h >> >> Added: projects/bhyve_svm/sys/amd64/**vmm/amd/vmcb.c >> ==============================**==============================** >> ================== >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ projects/bhyve_svm/sys/amd64/**vmm/amd/vmcb.c Thu Apr 11 06:52:19 >> 2013 (r249353) >> @@ -0,0 +1,383 @@ >> +/*- >> + * Copyright (c) 2013 Anish Gupta (akgupt3@gmail.com) >> + * 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 NETAPP, INC ``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 NETAPP, INC 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$ >> + */ >> + >> +#include >> +__FBSDID("$FreeBSD$"); >> + >> +#include >> +#include >> +#include >> + >> +#include >> +#include >> +#include >> + >> +#include "vmcb.h" >> > > about here there should be a comment explianing what a VMCB is and giving > background information.. > > Fixed in r249493. > This is true for a lot of files being added these days.. I just picked on > this one randomly. No problem. best Neel > > > Julian > > > > + >> +/* >> + * Initialize SVM h/w context i.e. the VMCB control and saved state >> areas. >> + */ >> +int >> > > From owner-svn-src-projects@FreeBSD.ORG Mon Apr 15 04:54:51 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C68A5140; Mon, 15 Apr 2013 04:54:51 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 9CA8317F; Mon, 15 Apr 2013 04:54:51 +0000 (UTC) Received: from jre-mbp.elischer.org (ppp121-45-237-17.lns20.per1.internode.on.net [121.45.237.17]) (authenticated bits=0) by vps1.elischer.org (8.14.5/8.14.5) with ESMTP id r3F4slMj013434 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 14 Apr 2013 21:54:49 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <516B881A.5000000@freebsd.org> Date: Mon, 15 Apr 2013 12:54:50 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Neel Natu Subject: Re: svn commit: r249493 - projects/bhyve_svm/sys/amd64/vmm/amd References: <201304150416.r3F4GDOQ062967@svn.freebsd.org> In-Reply-To: <201304150416.r3F4GDOQ062967@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 04:54:51 -0000 On 4/15/13 12:16 PM, Neel Natu wrote: > Author: neel > Date: Mon Apr 15 04:16:12 2013 > New Revision: 249493 > URL: http://svnweb.freebsd.org/changeset/base/249493 > > Log: > Add a Cliff Notes version of the purpose and contents of the VMCB. > > Requested by: julian thanks! others take note! > > Modified: > projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c > > Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c > ============================================================================== > --- projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c Mon Apr 15 03:09:59 2013 (r249492) > +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c Mon Apr 15 04:16:12 2013 (r249493) > @@ -40,6 +40,16 @@ __FBSDID("$FreeBSD$"); > #include "vmcb.h" > > /* > + * The VMCB aka Virtual Machine Control Block is a 4KB aligned page > + * in memory that describes the virtual machine. > + * > + * The VMCB contains: > + * - instructions or events in the guest to intercept > + * - control bits that modify execution environment of the guest > + * - guest processor state (e.g. general purpose registers) > + */ > + > +/* > * Initialize SVM h/w context i.e. the VMCB control and saved state areas. > */ > int > > From owner-svn-src-projects@FreeBSD.ORG Mon Apr 15 12:16:25 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A6E9D26D; Mon, 15 Apr 2013 12:16:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 992D1D18; Mon, 15 Apr 2013 12:16:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FCGPt6008496; Mon, 15 Apr 2013 12:16:25 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FCGO5w008489; Mon, 15 Apr 2013 12:16:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304151216.r3FCGO5w008489@svn.freebsd.org> From: Alexander Motin Date: Mon, 15 Apr 2013 12:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249505 - projects/camlock/sys/cam X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 12:16:25 -0000 Author: mav Date: Mon Apr 15 12:16:24 2013 New Revision: 249505 URL: http://svnweb.freebsd.org/changeset/base/249505 Log: Change CCB queue resize logic to be able safely handle overallocations: - (re)allocate queue space in power of 2 chunks with 64 elements minimum and never shrink it; with only 4/8 bytes per element size is insignificant. - automatically reallocate the queue to double size if it is overflowed. - if queue reallocation failed, store extra CCBs in unsorted TAILQ, fetching them back as soon as some queue element is freed. To free space in CCB for TAILQ linking, change highpowerq from keeping high-power CCBs to keeping devices frozen due to high-power CCBs. Modified: projects/camlock/sys/cam/cam.h projects/camlock/sys/cam/cam_queue.c projects/camlock/sys/cam/cam_queue.h projects/camlock/sys/cam/cam_xpt.c projects/camlock/sys/cam/cam_xpt_internal.h Modified: projects/camlock/sys/cam/cam.h ============================================================================== --- projects/camlock/sys/cam/cam.h Mon Apr 15 11:49:16 2013 (r249504) +++ projects/camlock/sys/cam/cam.h Mon Apr 15 12:16:24 2013 (r249505) @@ -88,6 +88,7 @@ typedef struct { #define CAM_UNQUEUED_INDEX -1 #define CAM_ACTIVE_INDEX -2 #define CAM_DONEQ_INDEX -3 +#define CAM_EXTRAQ_INDEX INT_MAX } cam_pinfo; /* Modified: projects/camlock/sys/cam/cam_queue.c ============================================================================== --- projects/camlock/sys/cam/cam_queue.c Mon Apr 15 11:49:16 2013 (r249504) +++ projects/camlock/sys/cam/cam_queue.c Mon Apr 15 12:16:24 2013 (r249505) @@ -287,39 +287,24 @@ u_int32_t cam_ccbq_resize(struct cam_ccbq *ccbq, int new_size) { int delta; - int space_left; delta = new_size - (ccbq->dev_active + ccbq->dev_openings); - space_left = new_size - - ccbq->queue.entries - - ccbq->held - - ccbq->dev_active; - - /* - * Only attempt to change the underlying queue size if we are - * shrinking it and there is space for all outstanding entries - * in the new array or we have been requested to grow the array. - * We don't fail in the case where we can't reduce the array size, - * but clients that care that the queue be "garbage collected" - * should detect this condition and call us again with the - * same size once the outstanding entries have been processed. - */ - if (space_left < 0 - || camq_resize(&ccbq->queue, new_size + (CAM_RL_VALUES - 1)) == - CAM_REQ_CMP) { - ccbq->devq_openings += delta; - ccbq->dev_openings += delta; + ccbq->devq_openings += delta; + ccbq->dev_openings += delta; + + new_size = imax(64, 1 << fls(new_size + new_size / 2)); + if (new_size > ccbq->queue.array_size) + return (camq_resize(&ccbq->queue, new_size)); + else return (CAM_REQ_CMP); - } else { - return (CAM_RESRC_UNAVAIL); - } } int cam_ccbq_init(struct cam_ccbq *ccbq, int openings) { bzero(ccbq, sizeof(*ccbq)); - if (camq_init(&ccbq->queue, openings + (CAM_RL_VALUES - 1)) != 0) + if (camq_init(&ccbq->queue, + imax(64, 1 << fls(openings + openings / 2))) != 0) return (1); ccbq->devq_openings = openings; ccbq->dev_openings = openings; Modified: projects/camlock/sys/cam/cam_queue.h ============================================================================== --- projects/camlock/sys/cam/cam_queue.h Mon Apr 15 11:49:16 2013 (r249504) +++ projects/camlock/sys/cam/cam_queue.h Mon Apr 15 12:16:24 2013 (r249505) @@ -59,6 +59,8 @@ SLIST_HEAD(ccb_hdr_slist, ccb_hdr); struct cam_ccbq { struct camq queue; + struct ccb_hdr_tailq queue_extra_head; + int queue_extra_entries; int devq_openings; int devq_allocating; int dev_openings; @@ -180,7 +182,7 @@ cam_ccbq_release_opening(struct cam_ccbq static __inline int cam_ccbq_pending_ccb_count(struct cam_ccbq *ccbq) { - return (ccbq->queue.entries); + return (ccbq->queue.entries + ccbq->queue_extra_entries); } static __inline void @@ -193,14 +195,61 @@ cam_ccbq_take_opening(struct cam_ccbq *c static __inline void cam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb) { + struct ccb_hdr *old_ccb; + struct camq *queue = &ccbq->queue; + ccbq->held--; - camq_insert(&ccbq->queue, &new_ccb->ccb_h.pinfo); + + /* + * If queue is already full, try to resize. + * If resize fail, push CCB with lowest priority out to the TAILQ. + */ + if (queue->entries == queue->array_size && + camq_resize(&ccbq->queue, queue->array_size * 2) != CAM_REQ_CMP) { + old_ccb = (struct ccb_hdr *)camq_remove(queue, queue->entries); + TAILQ_INSERT_HEAD(&ccbq->queue_extra_head, old_ccb, + xpt_links.tqe); + old_ccb->pinfo.index = CAM_EXTRAQ_INDEX; + ccbq->queue_extra_entries++; + } + + camq_insert(queue, &new_ccb->ccb_h.pinfo); } static __inline void cam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb) { - camq_remove(&ccbq->queue, ccb->ccb_h.pinfo.index); + struct ccb_hdr *cccb, *bccb; + struct camq *queue = &ccbq->queue; + + /* If the CCB is on the TAILQ, remove it from there. */ + if (ccb->ccb_h.pinfo.index == CAM_EXTRAQ_INDEX) { + TAILQ_REMOVE(&ccbq->queue_extra_head, &ccb->ccb_h, + xpt_links.tqe); + ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX; + ccbq->queue_extra_entries--; + return; + } + + camq_remove(queue, ccb->ccb_h.pinfo.index); + + /* + * If there are some CCBs on TAILQ, find the best one and move it + * to the emptied space in the queue. + */ + bccb = TAILQ_FIRST(&ccbq->queue_extra_head); + if (bccb == NULL) + return; + TAILQ_FOREACH(cccb, &ccbq->queue_extra_head, xpt_links.tqe) { + if (bccb->pinfo.priority > cccb->pinfo.priority || + (bccb->pinfo.priority == cccb->pinfo.priority && + GENERATIONCMP(bccb->pinfo.generation, >, + cccb->pinfo.generation))) + bccb = cccb; + } + TAILQ_REMOVE(&ccbq->queue_extra_head, bccb, xpt_links.tqe); + ccbq->queue_extra_entries--; + camq_insert(queue, &bccb->pinfo); } static __inline union ccb * Modified: projects/camlock/sys/cam/cam_xpt.c ============================================================================== --- projects/camlock/sys/cam/cam_xpt.c Mon Apr 15 11:49:16 2013 (r249504) +++ projects/camlock/sys/cam/cam_xpt.c Mon Apr 15 12:16:24 2013 (r249505) @@ -98,7 +98,7 @@ struct xpt_softc { u_int32_t xpt_generation; /* number of high powered commands that can go through right now */ - STAILQ_HEAD(highpowerlist, ccb_hdr) highpowerq; + STAILQ_HEAD(highpowerlist, cam_ed) highpowerq; int num_highpower; /* queue for handling async rescan requests. */ @@ -2626,7 +2626,7 @@ xpt_action_default(union ccb *start_ccb) cgds->dev_openings = dev->ccbq.dev_openings; cgds->dev_active = dev->ccbq.dev_active; cgds->devq_openings = dev->ccbq.devq_openings; - cgds->devq_queued = dev->ccbq.queue.entries; + cgds->devq_queued = cam_ccbq_pending_ccb_count(&dev->ccbq); cgds->held = dev->ccbq.held; cgds->last_reset = tar->last_reset; cgds->maxtags = dev->maxtags; @@ -3208,8 +3208,8 @@ xpt_run_devq(struct cam_devq *devq) */ xpt_freeze_devq(work_ccb->ccb_h.path, 1); STAILQ_INSERT_TAIL(&xsoftc.highpowerq, - &work_ccb->ccb_h, - xpt_links.stqe); + work_ccb->ccb_h.path->device, + highpowerq_entry); mtx_unlock(&xsoftc.xpt_lock); continue; @@ -3731,11 +3731,6 @@ xpt_release_ccb(union ccb *free_ccb) mtx_lock(&devq->send_mtx); cam_ccbq_release_opening(&device->ccbq); - if (device->flags & CAM_DEV_RESIZE_QUEUE_NEEDED) { - device->flags &= ~CAM_DEV_RESIZE_QUEUE_NEEDED; - cam_ccbq_resize(&device->ccbq, - device->ccbq.dev_openings + device->ccbq.dev_active); - } xpt_run_dev_allocq(device); mtx_unlock(&devq->send_mtx); xpt_free_ccb(free_ccb); @@ -4537,17 +4532,11 @@ xpt_release_device(struct cam_ed *device u_int32_t xpt_dev_ccbq_resize(struct cam_path *path, int newopenings) { - int diff; int result; struct cam_ed *dev; dev = path->device; - - diff = newopenings - (dev->ccbq.dev_active + dev->ccbq.dev_openings); result = cam_ccbq_resize(&dev->ccbq, newopenings); - if (result == CAM_REQ_CMP && (diff < 0)) { - dev->flags |= CAM_DEV_RESIZE_QUEUE_NEEDED; - } if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 || (dev->inq_flags & SID_CmdQue) != 0) dev->tag_saved_openings = newopenings; @@ -4921,12 +4910,12 @@ camisr_runqueue(struct cam_sim *sim) if (ccb_h->flags & CAM_HIGH_POWER) { struct highpowerlist *hphead; - union ccb *send_ccb; + struct cam_ed *device; mtx_lock(&xsoftc.xpt_lock); hphead = &xsoftc.highpowerq; - send_ccb = (union ccb *)STAILQ_FIRST(hphead); + device = STAILQ_FIRST(hphead); /* * Increment the count since this command is done. @@ -4936,13 +4925,15 @@ camisr_runqueue(struct cam_sim *sim) /* * Any high powered commands queued up? */ - if (send_ccb != NULL) { + if (device != NULL) { - STAILQ_REMOVE_HEAD(hphead, xpt_links.stqe); + STAILQ_REMOVE_HEAD(hphead, highpowerq_entry); mtx_unlock(&xsoftc.xpt_lock); - xpt_release_devq(send_ccb->ccb_h.path, + mtx_lock(&device->sim->devq->send_mtx); + xpt_release_devq_device(device, /*count*/1, /*runqueue*/TRUE); + mtx_unlock(&device->sim->devq->send_mtx); } else mtx_unlock(&xsoftc.xpt_lock); } Modified: projects/camlock/sys/cam/cam_xpt_internal.h ============================================================================== --- projects/camlock/sys/cam/cam_xpt_internal.h Mon Apr 15 11:49:16 2013 (r249504) +++ projects/camlock/sys/cam/cam_xpt_internal.h Mon Apr 15 12:16:24 2013 (r249505) @@ -114,7 +114,6 @@ struct cam_ed { #define CAM_DEV_REL_TIMEOUT_PENDING 0x02 #define CAM_DEV_REL_ON_COMPLETE 0x04 #define CAM_DEV_REL_ON_QUEUE_EMPTY 0x08 -#define CAM_DEV_RESIZE_QUEUE_NEEDED 0x10 #define CAM_DEV_TAG_AFTER_COUNT 0x20 #define CAM_DEV_INQUIRY_DATA_VALID 0x40 #define CAM_DEV_IN_DV 0x80 @@ -125,6 +124,7 @@ struct cam_ed { u_int32_t tag_saved_openings; u_int32_t refcount; struct callout callout; + STAILQ_ENTRY(cam_ed) highpowerq_entry; }; /* From owner-svn-src-projects@FreeBSD.ORG Mon Apr 15 17:20:01 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 39871D15; Mon, 15 Apr 2013 17:20:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2BC78F8B; Mon, 15 Apr 2013 17:20:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FHK1lD001318; Mon, 15 Apr 2013 17:20:01 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3FHJvPJ001244; Mon, 15 Apr 2013 17:19:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304151719.r3FHJvPJ001244@svn.freebsd.org> From: Alexander Motin Date: Mon, 15 Apr 2013 17:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249512 - in projects/camlock/sys/cam: . ata ctl scsi X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 17:20:01 -0000 Author: mav Date: Mon Apr 15 17:19:57 2013 New Revision: 249512 URL: http://svnweb.freebsd.org/changeset/base/249512 Log: Make cam_periph_getccb() to simply allocate CCBs and consume device openings neither checking their availability nor bothering with periph scheduling. Consumers of this KPI are normally waiting on the CCB completion and so number of CCBs there can't be infinite. Finite number of CCBs can now be correctly handled by the modified CCB queue code. This allows to remove duplicated code needed to schedule allocation of these immediate CCBs from many periph drivers, simplifying them and their locking. Modified: projects/camlock/sys/cam/ata/ata_da.c projects/camlock/sys/cam/cam_periph.c projects/camlock/sys/cam/cam_periph.h projects/camlock/sys/cam/cam_xpt.c projects/camlock/sys/cam/ctl/scsi_ctl.c projects/camlock/sys/cam/scsi/scsi_cd.c projects/camlock/sys/cam/scsi/scsi_ch.c projects/camlock/sys/cam/scsi/scsi_da.c projects/camlock/sys/cam/scsi/scsi_enc.c projects/camlock/sys/cam/scsi/scsi_enc_internal.h projects/camlock/sys/cam/scsi/scsi_enc_safte.c projects/camlock/sys/cam/scsi/scsi_enc_ses.c projects/camlock/sys/cam/scsi/scsi_pass.c projects/camlock/sys/cam/scsi/scsi_pt.c projects/camlock/sys/cam/scsi/scsi_sa.c projects/camlock/sys/cam/scsi/scsi_sg.c projects/camlock/sys/cam/scsi/scsi_targ_bh.c Modified: projects/camlock/sys/cam/ata/ata_da.c ============================================================================== --- projects/camlock/sys/cam/ata/ata_da.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/ata/ata_da.c Mon Apr 15 17:19:57 2013 (r249512) @@ -98,7 +98,6 @@ typedef enum { ADA_CCB_RAHEAD = 0x01, ADA_CCB_WCACHE = 0x02, ADA_CCB_BUFFER_IO = 0x03, - ADA_CCB_WAITING = 0x04, ADA_CCB_DUMP = 0x05, ADA_CCB_TRIM = 0x06, ADA_CCB_TYPE_MASK = 0x0F, @@ -611,23 +610,15 @@ static void adaschedule(struct cam_periph *periph) { struct ada_softc *softc = (struct ada_softc *)periph->softc; - uint32_t prio; if (softc->state != ADA_STATE_NORMAL) return; - /* Check if cam_periph_getccb() was called. */ - prio = periph->immediate_priority; - /* Check if we have more work to do. */ if (bioq_first(&softc->bio_queue) || (!softc->trim_running && bioq_first(&softc->trim_queue))) { - prio = CAM_PRIORITY_NORMAL; + xpt_schedule(periph, CAM_PRIORITY_NORMAL); } - - /* Schedule CCB if any of above is true. */ - if (prio != CAM_PRIORITY_NONE) - xpt_schedule(periph, prio); } /* @@ -1321,19 +1312,6 @@ adastart(struct cam_periph *periph, unio struct bio *bp; u_int8_t tag_code; - /* Execute immediate CCB if waiting. */ - if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, - ("queuing for immediate ccb\n")); - start_ccb->ccb_h.ccb_state = ADA_CCB_WAITING; - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - /* Have more work to do, so ensure we stay scheduled */ - adaschedule(periph); - break; - } /* Run TRIM if not running yet. */ if (!softc->trim_running && (bp = bioq_first(&softc->trim_queue)) != 0) { @@ -1775,12 +1753,6 @@ out: cam_periph_release_locked(periph); return; } - case ADA_CCB_WAITING: - { - /* Caller will release the CCB */ - wakeup(&done_ccb->ccb_h.cbfcnp); - return; - } case ADA_CCB_DUMP: /* No-op. We're polling */ return; Modified: projects/camlock/sys/cam/cam_periph.c ============================================================================== --- projects/camlock/sys/cam/cam_periph.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/cam_periph.c Mon Apr 15 17:19:57 2013 (r249512) @@ -202,7 +202,6 @@ cam_periph_alloc(periph_ctor_t *periph_c periph->periph_oninval = periph_oninvalidate; periph->type = type; periph->periph_name = name; - periph->immediate_priority = CAM_PRIORITY_NONE; periph->refcount = 0; periph->sim = sim; mtx_init(&periph->periph_mtx, "CAM periph lock", NULL, MTX_DEF); @@ -948,31 +947,6 @@ cam_periph_unmapmem(union ccb *ccb, stru PRELE(curproc); } -union ccb * -cam_periph_getccb(struct cam_periph *periph, u_int32_t priority) -{ - struct ccb_hdr *ccb_h; - - mtx_assert(periph->sim->mtx, MA_OWNED); - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdgetccb\n")); - - while (SLIST_FIRST(&periph->ccb_list) == NULL) { - if (periph->immediate_priority > priority) - periph->immediate_priority = priority; - xpt_schedule(periph, priority); - if ((SLIST_FIRST(&periph->ccb_list) != NULL) - && (SLIST_FIRST(&periph->ccb_list)->pinfo.priority == priority)) - break; - mtx_assert(periph->sim->mtx, MA_OWNED); - mtx_sleep(&periph->ccb_list, periph->sim->mtx, PRIBIO, "cgticb", - 0); - } - - ccb_h = SLIST_FIRST(&periph->ccb_list); - SLIST_REMOVE_HEAD(&periph->ccb_list, periph_links.sle); - return ((union ccb *)ccb_h); -} - void cam_periph_ccbwait(union ccb *ccb) { @@ -1046,6 +1020,14 @@ cam_periph_ioctl(struct cam_periph *peri return(error); } +static void +cam_periph_done(struct cam_periph *periph, union ccb *done_ccb) +{ + + /* Caller will release the CCB */ + wakeup(&done_ccb->ccb_h.cbfcnp); +} + int cam_periph_runccb(union ccb *ccb, int (*error_routine)(union ccb *ccb, @@ -1069,6 +1051,7 @@ cam_periph_runccb(union ccb *ccb, ccb->ccb_h.func_code == XPT_ATA_IO)) devstat_start_transaction(ds, NULL); + ccb->ccb_h.cbfcnp = cam_periph_done; xpt_action(ccb); do { Modified: projects/camlock/sys/cam/cam_periph.h ============================================================================== --- projects/camlock/sys/cam/cam_periph.h Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/cam_periph.h Mon Apr 15 17:19:57 2013 (r249512) @@ -121,7 +121,6 @@ struct cam_periph { #define CAM_PERIPH_NEW_DEV_FOUND 0x10 #define CAM_PERIPH_RECOVERY_INPROG 0x20 #define CAM_PERIPH_FREE 0x80 - u_int32_t immediate_priority; u_int32_t refcount; SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */ SLIST_ENTRY(cam_periph) periph_links; Modified: projects/camlock/sys/cam/cam_xpt.c ============================================================================== --- projects/camlock/sys/cam/cam_xpt.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/cam_xpt.c Mon Apr 15 17:19:57 2013 (r249512) @@ -342,13 +342,6 @@ xpt_periph_init() make_dev(&xpt_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0600, "xpt0"); } -static void -xptdone(struct cam_periph *periph, union ccb *done_ccb) -{ - /* Caller will release the CCB */ - wakeup(&done_ccb->ccb_h.cbfcnp); -} - static int xptopen(struct cdev *dev, int flags, int fmt, struct thread *td) { @@ -468,7 +461,6 @@ xptioctl(struct cdev *dev, u_long cmd, c xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, inccb->ccb_h.pinfo.priority); xpt_merge_ccb(ccb, inccb); - ccb->ccb_h.cbfcnp = xptdone; cam_periph_runccb(ccb, NULL, 0, 0, NULL); bcopy(ccb, inccb, sizeof(union ccb)); xpt_free_path(ccb->ccb_h.path); @@ -503,7 +495,6 @@ xptioctl(struct cdev *dev, u_long cmd, c xpt_setup_ccb(&ccb.ccb_h, ccb.ccb_h.path, inccb->ccb_h.pinfo.priority); xpt_merge_ccb(&ccb, inccb); - ccb.ccb_h.cbfcnp = xptdone; xpt_action(&ccb); bcopy(&ccb, inccb, sizeof(union ccb)); xpt_free_path(ccb.ccb_h.path); @@ -4332,6 +4323,23 @@ xpt_get_ccb(struct cam_ed *device) return (new_ccb); } +union ccb * +cam_periph_getccb(struct cam_periph *periph, u_int32_t priority) +{ + union ccb *ccb; + struct cam_devq *devq; + + cam_periph_unlock(periph); + ccb = malloc(sizeof(*ccb), M_CAMCCB, M_WAITOK); + cam_periph_lock(periph); + devq = periph->sim->devq; + mtx_lock(&devq->send_mtx); + cam_ccbq_take_opening(&periph->path->device->ccbq); + xpt_setup_ccb(&ccb->ccb_h, periph->path, priority); + mtx_unlock(&devq->send_mtx); + return (ccb); +} + static void xpt_release_bus(struct cam_eb *bus) { Modified: projects/camlock/sys/cam/ctl/scsi_ctl.c ============================================================================== --- projects/camlock/sys/cam/ctl/scsi_ctl.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/ctl/scsi_ctl.c Mon Apr 15 17:19:57 2013 (r249512) @@ -73,8 +73,7 @@ __FBSDID("$FreeBSD$"); #include typedef enum { - CTLFE_CCB_DEFAULT = 0x00, - CTLFE_CCB_WAITING = 0x01 + CTLFE_CCB_DEFAULT = 0x00 } ctlfe_ccb_types; struct ctlfe_softc { @@ -705,14 +704,7 @@ ctlfestart(struct cam_periph *periph, un start_ccb->ccb_h.ccb_type = CTLFE_CCB_DEFAULT; ccb_h = TAILQ_FIRST(&softc->work_queue); - if (periph->immediate_priority <= periph->pinfo.priority) { - panic("shouldn't get to the CCB waiting case!"); - start_ccb->ccb_h.ccb_type = CTLFE_CCB_WAITING; - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - } else if (ccb_h == NULL) { + if (ccb_h == NULL) { softc->ccbs_freed++; xpt_release_ccb(start_ccb); } else { @@ -1157,12 +1149,6 @@ ctlfedone(struct cam_periph *periph, uni softc = (struct ctlfe_lun_softc *)periph->softc; bus_softc = softc->parent_softc; - if (done_ccb->ccb_h.ccb_type == CTLFE_CCB_WAITING) { - panic("shouldn't get to the CCB waiting case!"); - wakeup(&done_ccb->ccb_h.cbfcnp); - return; - } - /* * If the peripheral is invalid, ATIOs and immediate notify CCBs * need to be freed. Most of the ATIOs and INOTs that come back Modified: projects/camlock/sys/cam/scsi/scsi_cd.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_cd.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_cd.c Mon Apr 15 17:19:57 2013 (r249512) @@ -110,7 +110,6 @@ typedef enum { typedef enum { CD_CCB_PROBE = 0x01, CD_CCB_BUFFER_IO = 0x02, - CD_CCB_WAITING = 0x03, CD_CCB_TUR = 0x04, CD_CCB_TYPE_MASK = 0x0F, CD_CCB_RETRY_UA = 0x10 @@ -1530,14 +1529,7 @@ cdstart(struct cam_periph *periph, union case CD_STATE_NORMAL: { bp = bioq_first(&softc->bio_queue); - if (periph->immediate_priority <= periph->pinfo.priority) { - start_ccb->ccb_h.ccb_state = CD_CCB_WAITING; - - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - } else if (bp == NULL) { + if (bp == NULL) { if (softc->tur) { softc->tur = 0; csio = &start_ccb->csio; @@ -1601,11 +1593,9 @@ cdstart(struct cam_periph *periph, union xpt_action(start_ccb); } - if (bp != NULL || softc->tur || - periph->immediate_priority != CAM_PRIORITY_NONE) { + if (bp != NULL || softc->tur) { /* Have more work to do, so ensure we stay scheduled */ - xpt_schedule(periph, min(CAM_PRIORITY_NORMAL, - periph->immediate_priority)); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); } break; } @@ -1888,15 +1878,6 @@ cddone(struct cam_periph *periph, union cam_periph_unhold(periph); return; } - case CD_CCB_WAITING: - { - /* Caller will release the CCB */ - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, - ("trying to wakeup ccbwait\n")); - - wakeup(&done_ccb->ccb_h.cbfcnp); - return; - } case CD_CCB_TUR: { if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { Modified: projects/camlock/sys/cam/scsi/scsi_ch.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_ch.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_ch.c Mon Apr 15 17:19:57 2013 (r249512) @@ -116,8 +116,7 @@ typedef enum { } ch_state; typedef enum { - CH_CCB_PROBE, - CH_CCB_WAITING + CH_CCB_PROBE } ch_ccb_types; typedef enum { @@ -535,14 +534,7 @@ chstart(struct cam_periph *periph, union switch (softc->state) { case CH_STATE_NORMAL: { - if (periph->immediate_priority <= periph->pinfo.priority){ - start_ccb->ccb_h.ccb_state = CH_CCB_WAITING; - - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - } + xpt_release_ccb(start_ccb); break; } case CH_STATE_PROBE: @@ -719,12 +711,6 @@ chdone(struct cam_periph *periph, union cam_periph_unhold(periph); return; } - case CH_CCB_WAITING: - { - /* Caller will release the CCB */ - wakeup(&done_ccb->ccb_h.cbfcnp); - return; - } default: break; } Modified: projects/camlock/sys/cam/scsi/scsi_da.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_da.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_da.c Mon Apr 15 17:19:57 2013 (r249512) @@ -99,7 +99,6 @@ typedef enum { DA_CCB_PROBE = 0x01, DA_CCB_PROBE2 = 0x02, DA_CCB_BUFFER_IO = 0x03, - DA_CCB_WAITING = 0x04, DA_CCB_DUMP = 0x05, DA_CCB_DELETE = 0x06, DA_CCB_TUR = 0x07, @@ -1079,24 +1078,16 @@ static void daschedule(struct cam_periph *periph) { struct da_softc *softc = (struct da_softc *)periph->softc; - uint32_t prio; if (softc->state != DA_STATE_NORMAL) return; - /* Check if cam_periph_getccb() was called. */ - prio = periph->immediate_priority; - /* Check if we have more work to do. */ if (bioq_first(&softc->bio_queue) || (!softc->delete_running && bioq_first(&softc->delete_queue)) || softc->tur) { - prio = CAM_PRIORITY_NORMAL; + xpt_schedule(periph, CAM_PRIORITY_NORMAL); } - - /* Schedule CCB if any of above is true. */ - if (prio != CAM_PRIORITY_NONE) - xpt_schedule(periph, prio); } /* @@ -1829,20 +1820,6 @@ dastart(struct cam_periph *periph, union struct bio *bp, *bp1; uint8_t tag_code; - /* Execute immediate CCB if waiting. */ - if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, - ("queuing for immediate ccb\n")); - start_ccb->ccb_h.ccb_state = DA_CCB_WAITING; - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - /* May have more work to do, so ensure we stay scheduled */ - daschedule(periph); - break; - } - /* Run BIO_DELETE if not running yet. */ if (!softc->delete_running && (bp = bioq_first(&softc->delete_queue)) != NULL) { @@ -2532,12 +2509,6 @@ dadone(struct cam_periph *periph, union cam_periph_release_locked(periph); return; } - case DA_CCB_WAITING: - { - /* Caller will release the CCB */ - wakeup(&done_ccb->ccb_h.cbfcnp); - return; - } case DA_CCB_DUMP: /* No-op. We're polling */ return; Modified: projects/camlock/sys/cam/scsi/scsi_enc.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_enc.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_enc.c Mon Apr 15 17:19:57 2013 (r249512) @@ -67,7 +67,6 @@ static periph_init_t enc_init; static periph_ctor_t enc_ctor; static periph_oninv_t enc_oninvalidate; static periph_dtor_t enc_dtor; -static periph_start_t enc_start; static void enc_async(void *, uint32_t, struct cam_path *, void *); static enctyp enc_type(struct ccb_getdev *); @@ -246,7 +245,7 @@ enc_async(void *callback_arg, uint32_t c } status = cam_periph_alloc(enc_ctor, enc_oninvalidate, - enc_dtor, enc_start, "ses", CAM_PERIPH_BIO, + enc_dtor, NULL, "ses", CAM_PERIPH_BIO, cgd->ccb_h.path, enc_async, AC_FOUND_DEVICE, cgd); if (status != CAM_REQ_CMP && status != CAM_REQ_INPROG) { @@ -336,29 +335,6 @@ enc_close(struct cdev *dev, int flag, in return (0); } -static void -enc_start(struct cam_periph *p, union ccb *sccb) -{ - struct enc_softc *enc; - - enc = p->softc; - ENC_DLOG(enc, "%s enter imm=%d prio=%d\n", - __func__, p->immediate_priority, p->pinfo.priority); - if (p->immediate_priority <= p->pinfo.priority) { - SLIST_INSERT_HEAD(&p->ccb_list, &sccb->ccb_h, periph_links.sle); - p->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&p->ccb_list); - } else - xpt_release_ccb(sccb); - ENC_DLOG(enc, "%s exit\n", __func__); -} - -void -enc_done(struct cam_periph *periph, union ccb *dccb) -{ - wakeup(&dccb->ccb_h.cbfcnp); -} - int enc_error(union ccb *ccb, uint32_t cflags, uint32_t sflags) { @@ -617,7 +593,7 @@ enc_runcmd(struct enc_softc *enc, char * if (enc->enc_type == ENC_SEMB_SES || enc->enc_type == ENC_SEMB_SAFT) { tdlen = min(dlen, 1020); tdlen = (tdlen + 3) & ~3; - cam_fill_ataio(&ccb->ataio, 0, enc_done, ddf, 0, dptr, tdlen, + cam_fill_ataio(&ccb->ataio, 0, NULL, ddf, 0, dptr, tdlen, 30 * 1000); if (cdb[0] == RECEIVE_DIAGNOSTIC) ata_28bit_cmd(&ccb->ataio, @@ -635,7 +611,7 @@ enc_runcmd(struct enc_softc *enc, char * 0x80, tdlen / 4); } else { tdlen = dlen; - cam_fill_csio(&ccb->csio, 0, enc_done, ddf, MSG_SIMPLE_Q_TAG, + cam_fill_csio(&ccb->csio, 0, NULL, ddf, MSG_SIMPLE_Q_TAG, dptr, dlen, sizeof (struct scsi_sense_data), cdbl, 60 * 1000); bcopy(cdb, ccb->csio.cdb_io.cdb_bytes, cdbl); Modified: projects/camlock/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_enc_internal.h Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_enc_internal.h Mon Apr 15 17:19:57 2013 (r249512) @@ -192,7 +192,6 @@ struct ses_mgmt_mode_page { /* Enclosure core interface for sub-drivers */ int enc_runcmd(struct enc_softc *, char *, int, char *, int *); void enc_log(struct enc_softc *, const char *, ...); -void enc_done(struct cam_periph *, union ccb *); int enc_error(union ccb *, uint32_t, uint32_t); void enc_update_request(enc_softc_t *, uint32_t); Modified: projects/camlock/sys/cam/scsi/scsi_enc_safte.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_enc_safte.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_enc_safte.c Mon Apr 15 17:19:57 2013 (r249512) @@ -243,12 +243,12 @@ safte_fill_read_buf_io(enc_softc_t *enc, if (enc->enc_type == ENC_SEMB_SAFT) { semb_read_buffer(&ccb->ataio, /*retries*/5, - enc_done, MSG_SIMPLE_Q_TAG, + NULL, MSG_SIMPLE_Q_TAG, state->page_code, buf, state->buf_size, state->timeout); } else { scsi_read_buffer(&ccb->csio, /*retries*/5, - enc_done, MSG_SIMPLE_Q_TAG, 1, + NULL, MSG_SIMPLE_Q_TAG, 1, state->page_code, 0, buf, state->buf_size, SSD_FULL_SIZE, state->timeout); } @@ -942,11 +942,11 @@ safte_fill_control_request(enc_softc_t * if (enc->enc_type == ENC_SEMB_SAFT) { semb_write_buffer(&ccb->ataio, /*retries*/5, - enc_done, MSG_SIMPLE_Q_TAG, + NULL, MSG_SIMPLE_Q_TAG, buf, xfer_len, state->timeout); } else { scsi_write_buffer(&ccb->csio, /*retries*/5, - enc_done, MSG_SIMPLE_Q_TAG, 1, + NULL, MSG_SIMPLE_Q_TAG, 1, 0, 0, buf, xfer_len, SSD_FULL_SIZE, state->timeout); } Modified: projects/camlock/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_enc_ses.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_enc_ses.c Mon Apr 15 17:19:57 2013 (r249512) @@ -1185,7 +1185,7 @@ ses_set_timed_completion(enc_softc_t *en if (mode_buf == NULL) goto out; - scsi_mode_sense(&ccb->csio, /*retries*/4, enc_done, MSG_SIMPLE_Q_TAG, + scsi_mode_sense(&ccb->csio, /*retries*/4, NULL, MSG_SIMPLE_Q_TAG, /*dbd*/FALSE, SMS_PAGE_CTRL_CURRENT, SES_MGMT_MODE_PAGE_CODE, mode_buf, mode_buf_len, SSD_FULL_SIZE, /*timeout*/60 * 1000); @@ -1213,7 +1213,7 @@ ses_set_timed_completion(enc_softc_t *en /* SES2r20: a completion time of zero means as long as possible */ bzero(&mgmt->max_comp_time, sizeof(mgmt->max_comp_time)); - scsi_mode_select(&ccb->csio, 5, enc_done, MSG_SIMPLE_Q_TAG, + scsi_mode_select(&ccb->csio, 5, NULL, MSG_SIMPLE_Q_TAG, /*page_fmt*/FALSE, /*save_pages*/TRUE, mode_buf, mode_buf_len, SSD_FULL_SIZE, /*timeout*/60 * 1000); @@ -2017,12 +2017,12 @@ ses_fill_rcv_diag_io(enc_softc_t *enc, s if (enc->enc_type == ENC_SEMB_SES) { semb_receive_diagnostic_results(&ccb->ataio, /*retries*/5, - enc_done, MSG_SIMPLE_Q_TAG, /*pcv*/1, + NULL, MSG_SIMPLE_Q_TAG, /*pcv*/1, state->page_code, buf, state->buf_size, state->timeout); } else { scsi_receive_diagnostic_results(&ccb->csio, /*retries*/5, - enc_done, MSG_SIMPLE_Q_TAG, /*pcv*/1, + NULL, MSG_SIMPLE_Q_TAG, /*pcv*/1, state->page_code, buf, state->buf_size, SSD_FULL_SIZE, state->timeout); } @@ -2140,12 +2140,12 @@ ses_fill_control_request(enc_softc_t *en /* Fill out the ccb */ if (enc->enc_type == ENC_SEMB_SES) { - semb_send_diagnostic(&ccb->ataio, /*retries*/5, enc_done, + semb_send_diagnostic(&ccb->ataio, /*retries*/5, NULL, MSG_SIMPLE_Q_TAG, buf, ses_page_length(&ses_cache->status_page->hdr), state->timeout); } else { - scsi_send_diagnostic(&ccb->csio, /*retries*/5, enc_done, + scsi_send_diagnostic(&ccb->csio, /*retries*/5, NULL, MSG_SIMPLE_Q_TAG, /*unit_offline*/0, /*device_offline*/0, /*self_test*/0, /*page_format*/1, /*self_test_code*/0, Modified: projects/camlock/sys/cam/scsi/scsi_pass.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_pass.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_pass.c Mon Apr 15 17:19:57 2013 (r249512) @@ -64,8 +64,7 @@ typedef enum { } pass_state; typedef enum { - PASS_CCB_BUFFER_IO, - PASS_CCB_WAITING + PASS_CCB_BUFFER_IO } pass_ccb_types; #define ccb_type ppriv_field0 @@ -92,12 +91,9 @@ static periph_init_t passinit; static periph_ctor_t passregister; static periph_oninv_t passoninvalidate; static periph_dtor_t passcleanup; -static periph_start_t passstart; static void pass_add_physpath(void *context, int pending); static void passasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg); -static void passdone(struct cam_periph *periph, - union ccb *done_ccb); static int passerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags); static int passsendccb(struct cam_periph *periph, union ccb *ccb, @@ -300,7 +296,7 @@ passasync(void *callback_arg, u_int32_t * process. */ status = cam_periph_alloc(passregister, passoninvalidate, - passcleanup, passstart, "pass", + passcleanup, NULL, "pass", CAM_PERIPH_BIO, cgd->ccb_h.path, passasync, AC_FOUND_DEVICE, cgd); @@ -537,41 +533,6 @@ passclose(struct cdev *dev, int flag, in return (0); } -static void -passstart(struct cam_periph *periph, union ccb *start_ccb) -{ - struct pass_softc *softc; - - softc = (struct pass_softc *)periph->softc; - - switch (softc->state) { - case PASS_STATE_NORMAL: - start_ccb->ccb_h.ccb_type = PASS_CCB_WAITING; - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - break; - } -} - -static void -passdone(struct cam_periph *periph, union ccb *done_ccb) -{ - struct pass_softc *softc; - struct ccb_scsiio *csio; - - softc = (struct pass_softc *)periph->softc; - csio = &done_ccb->csio; - switch (csio->ccb_h.ccb_type) { - case PASS_CCB_WAITING: - /* Caller will release the CCB */ - wakeup(&done_ccb->ccb_h.cbfcnp); - return; - } - xpt_release_ccb(done_ccb); -} - static int passioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { @@ -681,12 +642,6 @@ passsendccb(struct cam_periph *periph, u xpt_merge_ccb(ccb, inccb); /* - * There's no way for the user to have a completion - * function, so we put our own completion function in here. - */ - ccb->ccb_h.cbfcnp = passdone; - - /* * We only attempt to map the user memory into kernel space * if they haven't passed in a physical memory pointer, * and if there is actually an I/O operation to perform. Modified: projects/camlock/sys/cam/scsi/scsi_pt.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_pt.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_pt.c Mon Apr 15 17:19:57 2013 (r249512) @@ -66,7 +66,6 @@ typedef enum { typedef enum { PT_CCB_BUFFER_IO = 0x01, - PT_CCB_WAITING = 0x02, PT_CCB_RETRY_UA = 0x04, PT_CCB_BUFFER_IO_UA = PT_CCB_BUFFER_IO|PT_CCB_RETRY_UA } pt_ccb_state; @@ -426,15 +425,7 @@ ptstart(struct cam_periph *periph, union * See if there is a buf with work for us to do.. */ bp = bioq_first(&softc->bio_queue); - if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, - ("queuing for immediate ccb\n")); - start_ccb->ccb_h.ccb_state = PT_CCB_WAITING; - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - } else if (bp == NULL) { + if (bp == NULL) { xpt_release_ccb(start_ccb); } else { bioq_remove(&softc->bio_queue, bp); @@ -557,10 +548,6 @@ ptdone(struct cam_periph *periph, union biofinish(bp, softc->device_stats, 0); break; } - case PT_CCB_WAITING: - /* Caller will release the CCB */ - wakeup(&done_ccb->ccb_h.cbfcnp); - return; } xpt_release_ccb(done_ccb); } Modified: projects/camlock/sys/cam/scsi/scsi_sa.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_sa.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_sa.c Mon Apr 15 17:19:57 2013 (r249512) @@ -112,7 +112,6 @@ typedef enum { #define ccb_bp ppriv_ptr1 #define SA_CCB_BUFFER_IO 0x0 -#define SA_CCB_WAITING 0x1 #define SA_CCB_TYPEMASK 0x1 #define SA_POSITION_UPDATED 0x2 @@ -1570,15 +1569,7 @@ sastart(struct cam_periph *periph, union * See if there is a buf with work for us to do.. */ bp = bioq_first(&softc->bio_queue); - if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, - ("queuing for immediate ccb\n")); - Set_CCB_Type(start_ccb, SA_CCB_WAITING); - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - } else if (bp == NULL) { + if (bp == NULL) { xpt_release_ccb(start_ccb); } else if ((softc->flags & SA_FLAG_ERR_PENDING) != 0) { struct bio *done_bp; @@ -1797,12 +1788,6 @@ sadone(struct cam_periph *periph, union biofinish(bp, softc->device_stats, 0); break; } - case SA_CCB_WAITING: - { - /* Caller will release the CCB */ - wakeup(&done_ccb->ccb_h.cbfcnp); - return; - } } xpt_release_ccb(done_ccb); } @@ -2389,7 +2374,8 @@ saerror(union ccb *ccb, u_int32_t cflgs, /* * If a read/write command, we handle it here. */ - if (CCB_Type(csio) != SA_CCB_WAITING) { + if (csio->cdb_io.cdb_bytes[0] == SA_READ || + csio->cdb_io.cdb_bytes[0] == SA_WRITE) { break; } /* Modified: projects/camlock/sys/cam/scsi/scsi_sg.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_sg.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_sg.c Mon Apr 15 17:19:57 2013 (r249512) @@ -76,8 +76,7 @@ typedef enum { } sg_rdwr_state; typedef enum { - SG_CCB_RDWR_IO, - SG_CCB_WAITING + SG_CCB_RDWR_IO } sg_ccb_types; #define ccb_type ppriv_field0 @@ -119,7 +118,6 @@ static periph_init_t sginit; static periph_ctor_t sgregister; static periph_oninv_t sgoninvalidate; static periph_dtor_t sgcleanup; -static periph_start_t sgstart; static void sgasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg); static void sgdone(struct cam_periph *periph, union ccb *done_ccb); @@ -282,7 +280,7 @@ sgasync(void *callback_arg, uint32_t cod * start the probe process. */ status = cam_periph_alloc(sgregister, sgoninvalidate, - sgcleanup, sgstart, "sg", + sgcleanup, NULL, "sg", CAM_PERIPH_BIO, cgd->ccb_h.path, sgasync, AC_FOUND_DEVICE, cgd); if ((status != CAM_REQ_CMP) && (status != CAM_REQ_INPROG)) { @@ -388,24 +386,6 @@ sgregister(struct cam_periph *periph, vo } static void -sgstart(struct cam_periph *periph, union ccb *start_ccb) -{ - struct sg_softc *softc; - - softc = (struct sg_softc *)periph->softc; - - switch (softc->state) { - case SG_STATE_NORMAL: - start_ccb->ccb_h.ccb_type = SG_CCB_WAITING; - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - break; - } -} - -static void sgdone(struct cam_periph *periph, union ccb *done_ccb) { struct sg_softc *softc; @@ -414,10 +394,6 @@ sgdone(struct cam_periph *periph, union softc = (struct sg_softc *)periph->softc; csio = &done_ccb->csio; switch (csio->ccb_h.ccb_type) { - case SG_CCB_WAITING: - /* Caller will release the CCB */ - wakeup(&done_ccb->ccb_h.cbfcnp); - return; case SG_CCB_RDWR_IO: { struct sg_rdwr *rdwr; Modified: projects/camlock/sys/cam/scsi/scsi_targ_bh.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_targ_bh.c Mon Apr 15 17:19:28 2013 (r249511) +++ projects/camlock/sys/cam/scsi/scsi_targ_bh.c Mon Apr 15 17:19:57 2013 (r249512) @@ -65,8 +65,7 @@ typedef enum { } targbh_flags; typedef enum { - TARGBH_CCB_WORKQ, - TARGBH_CCB_WAITING + TARGBH_CCB_WORKQ } targbh_ccb_types; #define MAX_ACCEPT 8 @@ -453,13 +452,7 @@ targbhstart(struct cam_periph *periph, u softc = (struct targbh_softc *)periph->softc; ccbh = TAILQ_FIRST(&softc->work_queue); - if (periph->immediate_priority <= periph->pinfo.priority) { - start_ccb->ccb_h.ccb_type = TARGBH_CCB_WAITING; - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - } else if (ccbh == NULL) { + if (ccbh == NULL) { xpt_release_ccb(start_ccb); } else { TAILQ_REMOVE(&softc->work_queue, ccbh, periph_links.tqe); @@ -538,12 +531,6 @@ targbhdone(struct cam_periph *periph, un softc = (struct targbh_softc *)periph->softc; - if (done_ccb->ccb_h.ccb_type == TARGBH_CCB_WAITING) { - /* Caller will release the CCB */ - wakeup(&done_ccb->ccb_h.cbfcnp); - return; - } - switch (done_ccb->ccb_h.func_code) { case XPT_ACCEPT_TARGET_IO: { From owner-svn-src-projects@FreeBSD.ORG Tue Apr 16 07:02:13 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C98EBEA2; Tue, 16 Apr 2013 07:02:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BD163D5; Tue, 16 Apr 2013 07:02:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3G72Dgj041649; Tue, 16 Apr 2013 07:02:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3G72DVa041646; Tue, 16 Apr 2013 07:02:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304160702.r3G72DVa041646@svn.freebsd.org> From: Alexander Motin Date: Tue, 16 Apr 2013 07:02:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249537 - projects/camlock/sys/cam X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 07:02:13 -0000 Author: mav Date: Tue Apr 16 07:02:13 2013 New Revision: 249537 URL: http://svnweb.freebsd.org/changeset/base/249537 Log: Remove ccb_list from struct periph, unused after r249512. Modified: projects/camlock/sys/cam/cam_periph.c projects/camlock/sys/cam/cam_periph.h Modified: projects/camlock/sys/cam/cam_periph.c ============================================================================== --- projects/camlock/sys/cam/cam_periph.c Tue Apr 16 06:53:20 2013 (r249536) +++ projects/camlock/sys/cam/cam_periph.c Tue Apr 16 07:02:13 2013 (r249537) @@ -205,7 +205,6 @@ cam_periph_alloc(periph_ctor_t *periph_c periph->refcount = 0; periph->sim = sim; mtx_init(&periph->periph_mtx, "CAM periph lock", NULL, MTX_DEF); - SLIST_INIT(&periph->ccb_list); status = xpt_create_path(&path, periph, path_id, target_id, lun_id); if (status != CAM_REQ_CMP) goto failure; Modified: projects/camlock/sys/cam/cam_periph.h ============================================================================== --- projects/camlock/sys/cam/cam_periph.h Tue Apr 16 06:53:20 2013 (r249536) +++ projects/camlock/sys/cam/cam_periph.h Tue Apr 16 07:02:13 2013 (r249537) @@ -122,7 +122,6 @@ struct cam_periph { #define CAM_PERIPH_RECOVERY_INPROG 0x20 #define CAM_PERIPH_FREE 0x80 u_int32_t refcount; - SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */ SLIST_ENTRY(cam_periph) periph_links; TAILQ_ENTRY(cam_periph) unit_links; ac_callback_t *deferred_callback; From owner-svn-src-projects@FreeBSD.ORG Tue Apr 16 07:45:28 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 505BB9AE; Tue, 16 Apr 2013 07:45:28 +0000 (UTC) (envelope-from cherry@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3346E324; Tue, 16 Apr 2013 07:45:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3G7jSg3054491; Tue, 16 Apr 2013 07:45:28 GMT (envelope-from cherry@svn.freebsd.org) Received: (from cherry@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3G7jRZA054489; Tue, 16 Apr 2013 07:45:27 GMT (envelope-from cherry@svn.freebsd.org) Message-Id: <201304160745.r3G7jRZA054489@svn.freebsd.org> From: "Cherry G. Mathew" Date: Tue, 16 Apr 2013 07:45:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249539 - projects/amd64_xen_pv/sys/amd64/xen X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 07:45:28 -0000 Author: cherry Date: Tue Apr 16 07:45:27 2013 New Revision: 249539 URL: http://svnweb.freebsd.org/changeset/base/249539 Log: - change pmap_put_pv_entry() to return false on duplicates. - Do not track kernel pv entries. Approved by: gibbs(implicit) Modified: projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.h Modified: projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c Tue Apr 16 07:11:52 2013 (r249538) +++ projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.c Tue Apr 16 07:45:27 2013 (r249539) @@ -239,6 +239,8 @@ pmap_get_pv_entry(pmap_t pmap) struct pv_chunk *pc; vm_page_t m; + KASSERT(pmap != kernel_pmap, + ("Trying to track kernel va")); rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); PV_STAT(atomic_add_long(&pv_entry_allocs, 1)); @@ -310,7 +312,7 @@ pmap_get_pv_entry(pmap_t pmap) return (pv); } -void +bool pmap_put_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m) { pv_entry_t pv; @@ -320,11 +322,18 @@ pmap_put_pv_entry(pmap_t pmap, vm_offset ("Tried to manage an unmanaged page!")); PMAP_LOCK_ASSERT(pmap, MA_OWNED); + if (pmap_find_pv_entry(pmap, va, m)) { + return false; /* Duplicate */ + } + rw_rlock(&pvh_global_lock); - pv = pmap_get_pv_entry(pmap); - pv->pv_va = va; - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); + if (pmap != kernel_pmap) { + pv = pmap_get_pv_entry(pmap); + pv->pv_va = va; + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); + } rw_runlock(&pvh_global_lock); + return true; } @@ -335,6 +344,8 @@ pmap_free_pv_entry(pmap_t pmap, vm_offse pv_entry_t pv; PMAP_LOCK_ASSERT(pmap, MA_OWNED); + if (pmap == kernel_pmap) return true; + rw_rlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { @@ -357,6 +368,7 @@ pmap_find_pv_entry(pmap_t pmap, vm_offse pv_entry_t pv = NULL; PMAP_LOCK_ASSERT(pmap, MA_OWNED); + if (pmap == kernel_pmap) return NULL; rw_rlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { @@ -439,6 +451,7 @@ pmap_pv_vm_page_to_v(pmap_t pmap, vm_pag bool pmap_pv_vm_page_mapped(pmap_t pmap, vm_page_t m) { + if (pmap == kernel_pmap) return true; return (pmap_pv_vm_page_to_v(pmap, m) == (VM_MAX_KERNEL_ADDRESS + 1)) ? false : true; Modified: projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.h ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.h Tue Apr 16 07:11:52 2013 (r249538) +++ projects/amd64_xen_pv/sys/amd64/xen/pmap_pv.h Tue Apr 16 07:45:27 2013 (r249539) @@ -48,7 +48,7 @@ void pmap_pv_vm_page_init(vm_page_t m); vm_offset_t pmap_pv_vm_page_to_v(pmap_t pmap, vm_page_t m); bool pmap_pv_vm_page_mapped(pmap_t pmap, vm_page_t m); pv_entry_t pmap_get_pv_entry(pmap_t pmap); -void pmap_put_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); +bool pmap_put_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); bool pmap_free_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); pv_entry_t pmap_find_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); int pmap_pv_iterate(vm_page_t m, pv_cb_t cb); From owner-svn-src-projects@FreeBSD.ORG Tue Apr 16 07:48:50 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 43E60CA6; Tue, 16 Apr 2013 07:48:50 +0000 (UTC) (envelope-from cherry@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 27079403; Tue, 16 Apr 2013 07:48:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3G7mnqq054949; Tue, 16 Apr 2013 07:48:49 GMT (envelope-from cherry@svn.freebsd.org) Received: (from cherry@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3G7mnVu054948; Tue, 16 Apr 2013 07:48:49 GMT (envelope-from cherry@svn.freebsd.org) Message-Id: <201304160748.r3G7mnVu054948@svn.freebsd.org> From: "Cherry G. Mathew" Date: Tue, 16 Apr 2013 07:48:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249540 - projects/amd64_xen_pv/sys/amd64/xen X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 07:48:50 -0000 Author: cherry Date: Tue Apr 16 07:48:49 2013 New Revision: 249540 URL: http://svnweb.freebsd.org/changeset/base/249540 Log: Fill in further stubs. We are now able to execute in usermode. Approved by: gibbs(implicit) Modified: projects/amd64_xen_pv/sys/amd64/xen/pmap.c Modified: projects/amd64_xen_pv/sys/amd64/xen/pmap.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/pmap.c Tue Apr 16 07:45:27 2013 (r249539) +++ projects/amd64_xen_pv/sys/amd64/xen/pmap.c Tue Apr 16 07:48:49 2013 (r249540) @@ -1232,7 +1232,11 @@ pmap_enter_object(pmap_t pmap, vm_offset void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) { - KASSERT(0, ("XXX: %s: TODO\n", __func__)); + /* RO and unwired */ + prot = (prot & ~VM_PROT_WRITE) | VM_PROT_READ; + + /* XXX: do we care about "speed" ? */ + pmap_enter(pmap, va, prot, m, prot, false); } void * @@ -1717,17 +1721,163 @@ pmap_change_wiring(pmap_t pmap, vm_offse */ } +/* + * Copy the range specified by src_addr/len + * from the source map to the range dst_addr/len + * in the destination map. + * + * This routine is only advisory and need not do anything. + */ + void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { - KASSERT(0, ("XXX: %s: TODO\n", __func__)); + vm_offset_t addr; + vm_offset_t end_addr = src_addr + len; + vm_offset_t va_next; + + if (dst_addr != src_addr) + return; + + if (dst_pmap < src_pmap) { + PMAP_LOCK(dst_pmap); + PMAP_LOCK(src_pmap); + } else { + PMAP_LOCK(src_pmap); + PMAP_LOCK(dst_pmap); + } + + + KASSERT(tsz != 0, ("tsz != 0")); + + char stbuf[tsz]; /* Safe to do this on the stack since tsz is + * effectively const. + */ + + char dtbuf[tsz]; /* Safe to do this on the stack since tsz is + * effectively const. + */ + + mmu_map_t stptr = stbuf; + mmu_map_t dtptr = dtbuf; + + struct mmu_map_mbackend mb = { + ptmb_mappedalloc, + ptmb_mappedfree, + ptmb_ptov, + ptmb_vtop + }; + mmu_map_t_init(stptr, &mb); + mmu_map_t_init(dtptr, &mb); + + for (addr = src_addr; addr < end_addr; addr = va_next) { + pt_entry_t *src_pte, *dst_pte; + + KASSERT(addr < UPT_MIN_ADDRESS, + ("pmap_copy: invalid to pmap_copy page tables")); + + if (!mmu_map_inspect_va(src_pmap, stptr, addr)) { + if (mmu_map_pdpt(stptr) == NULL) { + va_next = (addr + NBPML4) & ~PML4MASK; + if (va_next < addr) /* Overflow */ + va_next = end_addr; + continue; + } + + if (mmu_map_pdt(stptr) == NULL) { + va_next = (addr + NBPDP) & ~PDPMASK; + if (va_next < addr) /* Overflow */ + va_next = end_addr; + continue; + } + + + if (mmu_map_pt(stptr) == NULL) { + va_next = (addr + NBPDR) & ~PDRMASK; + if (va_next < addr) + va_next = end_addr; + continue; + } + + panic("%s: All backing tables non-NULL," + "yet hierarchy can't be inspected at va = 0x%lx\n", + __func__, addr); + } + + va_next = (addr + NBPDR) & ~PDRMASK; + if (va_next < addr) + va_next = end_addr; + + src_pte = mmu_map_pt(stptr) + pt_index(addr); + + while (addr < va_next) { + pt_entry_t ptetemp; + ptetemp = *src_pte; + /* + * we only virtual copy managed pages + */ + if ((ptetemp & PG_MANAGED) != 0) { + if (!mmu_map_hold_va(dst_pmap, dtptr, addr)) { + goto out; + } + + dst_pte = mmu_map_pt(dtptr) + pt_index(addr); + if (pte_load(dst_pte) == 0 && + pmap_put_pv_entry(dst_pmap, addr, + MACH_TO_VM_PAGE(ptetemp & PG_FRAME))) { + /* + * Clear the wired, modified, and + * accessed (referenced) bits + * during the copy. + */ + PT_SET_VA_MA(dst_pte, ptetemp & + ~(PG_W | PG_M | PG_A), true); + pmap_resident_count_inc(dst_pmap, 1); + } else { + goto out; + } + } + addr += PAGE_SIZE; + src_pte++; + } + } +out: + mmu_map_t_fini(dtptr); + mmu_map_t_fini(stptr); + + + PMAP_UNLOCK(src_pmap); + PMAP_UNLOCK(dst_pmap); } void -pmap_copy_page(vm_page_t src, vm_page_t dst) +pmap_copy_page(vm_page_t msrc, vm_page_t mdst) { - KASSERT(0, ("XXX: %s: TODO\n", __func__)); + vm_offset_t ma_src, ma_dst; + vm_offset_t va_src, va_dst; + + KASSERT(msrc != NULL && mdst != NULL, + ("Invalid source or destination page!")); + + va_src = kmem_alloc_nofault(kernel_map, PAGE_SIZE * 2); + va_dst = va_src + PAGE_SIZE; + + KASSERT(va_src != 0, + ("Out of kernel virtual space!")); + + ma_src = VM_PAGE_TO_MACH(msrc); + ma_dst = VM_PAGE_TO_MACH(mdst); + + pmap_kenter_ma(va_src, ma_src); + pmap_kenter_ma(va_dst, ma_dst); + + pagecopy((void *)va_src, (void *)va_dst); + + pmap_kremove(va_src); + pmap_kremove(va_dst); + + kmem_free(kernel_map, va_src, PAGE_SIZE * 2); } int unmapped_buf_allowed = 1; @@ -1736,7 +1886,39 @@ void pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) { - KASSERT(0, ("XXX: %s: TODO\n", __func__)); + void *a_cp, *b_cp; + vm_offset_t a_pg, b_pg; + vm_offset_t a_pg_offset, b_pg_offset; + int cnt; + panic(__func__); + a_pg = kmem_alloc_nofault(kernel_map, PAGE_SIZE * 2); + b_pg = a_pg + PAGE_SIZE; + + KASSERT(a_pg != 0, + ("Out of kernel virtual space!")); + + while (xfersize > 0) { + a_pg_offset = a_offset & PAGE_MASK; + cnt = min(xfersize, PAGE_SIZE - a_pg_offset); + pmap_kenter_ma(a_pg, + VM_PAGE_TO_MACH(ma[a_offset >> PAGE_SHIFT])); + a_cp = (char *)a_pg + a_pg_offset; + + b_pg_offset = b_offset & PAGE_MASK; + cnt = min(cnt, PAGE_SIZE - b_pg_offset); + pmap_kenter_ma(b_pg, + VM_PAGE_TO_MACH(mb[b_offset >> PAGE_SHIFT])); + b_cp = (char *)b_pg + b_pg_offset; + bcopy(a_cp, b_cp, cnt); + a_offset += cnt; + b_offset += cnt; + xfersize -= cnt; + } + + pmap_kremove(a_pg); + pmap_kremove(b_pg); + + kmem_free(kernel_map, a_pg, PAGE_SIZE * 2); } void From owner-svn-src-projects@FreeBSD.ORG Tue Apr 16 08:49:28 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C85B75DB; Tue, 16 Apr 2013 08:49:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A1B738B1; Tue, 16 Apr 2013 08:49:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3G8nStR073333; Tue, 16 Apr 2013 08:49:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3G8nSGn073332; Tue, 16 Apr 2013 08:49:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304160849.r3G8nSGn073332@svn.freebsd.org> From: Alexander Motin Date: Tue, 16 Apr 2013 08:49:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249541 - projects/camlock/sys/cam X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 08:49:28 -0000 Author: mav Date: Tue Apr 16 08:49:27 2013 New Revision: 249541 URL: http://svnweb.freebsd.org/changeset/base/249541 Log: Give periph validity flag own periph reference. That slightly simplifies the release logic and covers hypothetical case if lock is dropped inside the periph_oninval() method. Modified: projects/camlock/sys/cam/cam_periph.c Modified: projects/camlock/sys/cam/cam_periph.c ============================================================================== --- projects/camlock/sys/cam/cam_periph.c Tue Apr 16 07:48:49 2013 (r249540) +++ projects/camlock/sys/cam/cam_periph.c Tue Apr 16 08:49:27 2013 (r249541) @@ -202,7 +202,7 @@ cam_periph_alloc(periph_ctor_t *periph_c periph->periph_oninval = periph_oninvalidate; periph->type = type; periph->periph_name = name; - periph->refcount = 0; + periph->refcount = 1; /* Dropped by invalidation. */ periph->sim = sim; mtx_init(&periph->periph_mtx, "CAM periph lock", NULL, MTX_DEF); status = xpt_create_path(&path, periph, path_id, target_id, lun_id); @@ -380,10 +380,8 @@ cam_periph_release_locked_buses(struct c mtx_assert(periph->sim->mtx, MA_OWNED); KASSERT(periph->refcount >= 1, ("periph->refcount >= 1")); - if (--periph->refcount == 0 - && (periph->flags & CAM_PERIPH_INVALID)) { + if (--periph->refcount == 0) camperiphfree(periph); - } } void @@ -578,23 +576,20 @@ void cam_periph_invalidate(struct cam_periph *periph) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); mtx_assert(periph->sim->mtx, MA_OWNED); /* * We only call this routine the first time a peripheral is * invalidated. */ - if (((periph->flags & CAM_PERIPH_INVALID) == 0) - && (periph->periph_oninval != NULL)) - periph->periph_oninval(periph); + if ((periph->flags & CAM_PERIPH_INVALID) != 0) + return; + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); periph->flags |= CAM_PERIPH_INVALID; periph->flags &= ~CAM_PERIPH_NEW_DEV_FOUND; - - xpt_lock_buses(); - if (periph->refcount == 0) - camperiphfree(periph); - xpt_unlock_buses(); + if (periph->periph_oninval != NULL) + periph->periph_oninval(periph); + cam_periph_release_locked(periph); } static void From owner-svn-src-projects@FreeBSD.ORG Tue Apr 16 08:54:51 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7E442DEA; Tue, 16 Apr 2013 08:54:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 61398CBE; Tue, 16 Apr 2013 08:54:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3G8spoH075670; Tue, 16 Apr 2013 08:54:51 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3G8spYv075668; Tue, 16 Apr 2013 08:54:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304160854.r3G8spYv075668@svn.freebsd.org> From: Alexander Motin Date: Tue, 16 Apr 2013 08:54:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249542 - in projects/camlock/sys/cam: ata scsi X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 08:54:51 -0000 Author: mav Date: Tue Apr 16 08:54:50 2013 New Revision: 249542 URL: http://svnweb.freebsd.org/changeset/base/249542 Log: Remove ADA_FLAG_PACK_INVALID flag. Since ATA disks have no concept of media change it only duplicates CAM_PERIPH_INVALID flag, so we can use last one. Slightly cleanup DA_FLAG_PACK_INVALID use. Modified: projects/camlock/sys/cam/ata/ata_da.c projects/camlock/sys/cam/scsi/scsi_da.c Modified: projects/camlock/sys/cam/ata/ata_da.c ============================================================================== --- projects/camlock/sys/cam/ata/ata_da.c Tue Apr 16 08:49:27 2013 (r249541) +++ projects/camlock/sys/cam/ata/ata_da.c Tue Apr 16 08:54:50 2013 (r249542) @@ -74,7 +74,6 @@ typedef enum { } ada_state; typedef enum { - ADA_FLAG_PACK_INVALID = 0x0001, ADA_FLAG_CAN_48BIT = 0x0002, ADA_FLAG_CAN_FLUSHCACHE = 0x0004, ADA_FLAG_CAN_NCQ = 0x0008, @@ -537,16 +536,11 @@ adaopen(struct disk *dp) return (error); } - softc = (struct ada_softc *)periph->softc; - softc->flags |= ADA_FLAG_OPEN; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("adaopen\n")); - if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { - /* Invalidate our pack information. */ - softc->flags &= ~ADA_FLAG_PACK_INVALID; - } + softc = (struct ada_softc *)periph->softc; + softc->flags |= ADA_FLAG_OPEN; cam_periph_unhold(periph); cam_periph_unlock(periph); @@ -575,7 +569,7 @@ adaclose(struct disk *dp) /* We only sync the cache if the drive is capable of it. */ if ((softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && - (softc->flags & ADA_FLAG_PACK_INVALID) == 0) { + (periph->flags & CAM_PERIPH_INVALID) == 0) { ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); cam_fill_ataio(&ccb->ataio, @@ -642,7 +636,7 @@ adastrategy(struct bio *bp) /* * If the device has been made invalid, error out */ - if ((softc->flags & ADA_FLAG_PACK_INVALID)) { + if ((periph->flags & CAM_PERIPH_INVALID) != 0) { cam_periph_unlock(periph); biofinish(bp, NULL, ENXIO); return; @@ -693,7 +687,7 @@ adadump(void *arg, void *virtual, vm_off lba = offset / secsize; count = length / secsize; - if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { + if ((periph->flags & CAM_PERIPH_INVALID) != 0) { cam_periph_unlock(periph); return (ENXIO); } @@ -818,8 +812,6 @@ adaoninvalidate(struct cam_periph *perip */ xpt_register_async(0, adaasync, periph, periph->path); - softc->flags |= ADA_FLAG_PACK_INVALID; - /* * Return all queued I/O with ENXIO. * XXX Handle any transactions queued to the card @@ -981,7 +973,7 @@ adasysctlinit(void *context, int pending periph = (struct cam_periph *)context; /* periph was held for us when this task was enqueued */ - if (periph->flags & CAM_PERIPH_INVALID) { + if ((periph->flags & CAM_PERIPH_INVALID) != 0) { cam_periph_release(periph); return; } @@ -1556,10 +1548,9 @@ out: case ADA_STATE_RAHEAD: case ADA_STATE_WCACHE: { - if (softc->flags & ADA_FLAG_PACK_INVALID) { + if ((periph->flags & CAM_PERIPH_INVALID) != 0) { softc->state = ADA_STATE_NORMAL; xpt_release_ccb(start_ccb); - adaschedule(periph); cam_periph_release_locked(periph); return; } @@ -1619,19 +1610,6 @@ adadone(struct cam_periph *periph, union return; } if (error != 0) { - if (error == ENXIO && - (softc->flags & ADA_FLAG_PACK_INVALID) == 0) { - /* - * Catastrophic error. Mark our pack as - * invalid. - */ - /* - * XXX See if this is really a media - * XXX change first? - */ - xpt_print(path, "Invalidating pack\n"); - softc->flags |= ADA_FLAG_PACK_INVALID; - } bp->bio_error = error; bp->bio_resid = bp->bio_bcount; bp->bio_flags |= BIO_ERROR; Modified: projects/camlock/sys/cam/scsi/scsi_da.c ============================================================================== --- projects/camlock/sys/cam/scsi/scsi_da.c Tue Apr 16 08:49:27 2013 (r249541) +++ projects/camlock/sys/cam/scsi/scsi_da.c Tue Apr 16 08:54:50 2013 (r249542) @@ -957,7 +957,6 @@ daopen(struct disk *dp) { struct cam_periph *periph; struct da_softc *softc; - int unit; int error; periph = (struct cam_periph *)dp->d_drv1; @@ -972,17 +971,12 @@ daopen(struct disk *dp) return (error); } - unit = periph->unit_number; - softc = (struct da_softc *)periph->softc; - softc->flags |= DA_FLAG_OPEN; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("daopen\n")); - if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) { - /* Invalidate our pack information. */ - softc->flags &= ~DA_FLAG_PACK_INVALID; - } + softc = (struct da_softc *)periph->softc; + softc->flags |= DA_FLAG_OPEN; + softc->flags &= ~DA_FLAG_PACK_INVALID; dareprobe(periph); @@ -2262,11 +2256,6 @@ dadone(struct cam_periph *periph, union if (softc->outstanding_cmds == 0) softc->flags |= DA_FLAG_WENT_IDLE; - if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) { - xpt_print(periph->path, "oustanding %d\n", - softc->outstanding_cmds); - } - if (state == DA_CCB_DELETE) { while ((bp1 = bioq_takefirst(&softc->delete_run_queue)) != NULL) { From owner-svn-src-projects@FreeBSD.ORG Fri Apr 19 18:45:05 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9D96D470; Fri, 19 Apr 2013 18:45:05 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F86C15C8; Fri, 19 Apr 2013 18:45:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3JIj5t5078437; Fri, 19 Apr 2013 18:45:05 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3JIj4uP078404; Fri, 19 Apr 2013 18:45:04 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201304191845.r3JIj4uP078404@svn.freebsd.org> From: "Simon J. Gerraty" Date: Fri, 19 Apr 2013 18:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249654 - in projects/bmake: include share/mk usr.bin/kdump X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 18:45:05 -0000 Author: sjg Date: Fri Apr 19 18:45:03 2013 New Revision: 249654 URL: http://svnweb.freebsd.org/changeset/base/249654 Log: Add stage-install.sh so we can do away with the need to have $STAGE_OBJTOP/include for src/include. Added: projects/bmake/share/mk/stage-install.sh (contents, props changed) Modified: projects/bmake/include/Makefile projects/bmake/share/mk/local.sys.mk projects/bmake/share/mk/meta.stage.mk projects/bmake/usr.bin/kdump/Makefile projects/bmake/usr.bin/kdump/Makefile.depend Modified: projects/bmake/include/Makefile ============================================================================== --- projects/bmake/include/Makefile Fri Apr 19 18:39:17 2013 (r249653) +++ projects/bmake/include/Makefile Fri Apr 19 18:45:03 2013 (r249654) @@ -135,9 +135,6 @@ stage_includes: .if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD) .if make(all) DESTDIR= ${STAGE_OBJTOP} -# we want to keep this separate from the folk who -# do staging "normally" -INCLUDEDIR= /include all: stage_includes installincludes: buildincludes @@ -148,11 +145,6 @@ stage_prep: @touch $@ stage_includes: .dirdep installincludes - @find ${DESTDIR}${INCLUDEDIR} -type d | while read d; do \ - rm -f $$d/.dirdep; \ - { ln .dirdep $$d/.dirdep 2> /dev/null || \ - cp -p .dirdep $$d/.dirdep; }; \ - done @touch $@ .endif .endif Modified: projects/bmake/share/mk/local.sys.mk ============================================================================== --- projects/bmake/share/mk/local.sys.mk Fri Apr 19 18:39:17 2013 (r249653) +++ projects/bmake/share/mk/local.sys.mk Fri Apr 19 18:45:03 2013 (r249654) @@ -156,7 +156,7 @@ STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP} .if ${MACHINE} != "host" CFLAGS_LAST+= -nostdinc .endif -CFLAGS_LAST+= -isystem ${STAGE_OBJTOP}/usr/include -isystem ${STAGE_OBJTOP}/include +CFLAGS_LAST+= -isystem ${STAGE_OBJTOP}/usr/include CFLAGS_LAST += ${CFLAGS_LAST.${COMPILER_TYPE}} LDFLAGS_LAST+= -B${STAGE_LIBDIR} -L${STAGE_LIBDIR} CXXFLAGS_LAST += -isystem ${STAGE_OBJTOP}/usr/include/c++/${GCCVER:U4.2} @@ -166,10 +166,10 @@ CFLAGS_LAST.clang += -isystem ${STAGE_OB CXXFLAGS_LAST += ${CFLAGS_LAST.${COMPILER_TYPE}} .else # if ld suppored sysroot, this would suffice -CFLAGS_LAST+= --sysroot=${STAGE_OBJTOP} -isystem ${STAGE_OBJTOP}/include +CFLAGS_LAST+= --sysroot=${STAGE_OBJTOP} .endif .endif -STAGED_INCLUDE_DIR= ${STAGE_OBJTOP}/include +STAGED_INCLUDE_DIR= ${STAGE_OBJTOP}/usr/include .if ${USE_META:Uyes} == "yes" .include "meta.sys.mk" .endif Modified: projects/bmake/share/mk/meta.stage.mk ============================================================================== --- projects/bmake/share/mk/meta.stage.mk Fri Apr 19 18:39:17 2013 (r249653) +++ projects/bmake/share/mk/meta.stage.mk Fri Apr 19 18:45:03 2013 (r249654) @@ -1,4 +1,4 @@ -# $Id: meta.stage.mk,v 1.24 2013/03/23 02:25:19 sjg Exp $ +# $Id: meta.stage.mk,v 1.30 2013/04/19 16:32:57 sjg Exp $ # # @(#) Copyright (c) 2011, Simon J. Gerraty # @@ -228,4 +228,17 @@ STAGING_WAIT ?= .WAIT all: ${STAGING_WAIT} staging +.if exists(${.PARSEDIR}/stage-install.sh) && !defined(STAGE_INSTALL) +# this will run install(1) and then followup with .dirdep files. +STAGE_INSTALL := sh ${.PARSEDIR:tA}/stage-install.sh INSTALL="${INSTALL}" OBJDIR=${.OBJDIR:tA} +.endif + +# if ${INSTALL} gets run during 'all' assume it is for staging? +.if ${.TARGETS:Nall} == "" && defined(STAGE_INSTALL) +INSTALL := ${STAGE_INSTALL} +.if target(beforeinstall) +beforeinstall: .dirdep +.endif +.endif + .endif Added: projects/bmake/share/mk/stage-install.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/bmake/share/mk/stage-install.sh Fri Apr 19 18:45:03 2013 (r249654) @@ -0,0 +1,98 @@ +#!/bin/sh + +# NAME: +# stage-install.sh - wrapper around install +# +# SYNOPSIS: +# stage-install.sh [variable="value"] "args" "dest" +# +# DESCRIPTION: +# This script is a wrapper around the normal install(1). +# Its role is to add '.dirdep' files to the destination. +# The variables we might use are: +# +# INSTALL +# Path to actual install(1), default is +# $REAL_INSTALL +# +# OBJDIR +# Path to the dir where '.dirdep' was generated, +# default is '.' +# +# _DIRDEP +# Path to actual '.dirdep' file, default is +# $OBJDIR/.dirdep +# +# The "args" and "dest" are passed as is to install(1), and if a +# '.dirdep' file exists it will be linked or copied to each +# "file".dirdep placed in "dest" or "dest".dirdep if it happed +# to be a file rather than a directory. +# +# SEE ALSO: +# meta.stage.mk +# + +# RCSid: +# $Id: stage-install.sh,v 1.5 2013/04/19 16:32:24 sjg Exp $ +# +# @(#) Copyright (c) 2013, Simon J. Gerraty +# +# This file is provided in the hope that it will +# be of use. There is absolutely NO WARRANTY. +# Permission to copy, redistribute or otherwise +# use this file is hereby granted provided that +# the above copyright notice and this notice are +# left intact. +# +# Please send copies of changes and bug-fixes to: +# sjg@crufty.net +# + +INSTALL=${REAL_INSTALL:-install} +OBJDIR=. + +while : +do + case "$1" in + *=*) eval "$1"; shift;; + *) break;; + esac +done + +# if .dirdep doesn't exist, just run install and be done +_DIRDEP=${_DIRDEP:-$OBJDIR/.dirdep} +[ -s $_DIRDEP ] && EXEC= || EXEC=exec +$EXEC $INSTALL "$@" || exit 1 + +# from meta.stage.mk +LnCp() { + rm -f $2 2> /dev/null + ln $1 $2 2> /dev/null || cp -p $1 $2 +} + +StageDirdep() { + t=$1 + if [ -s $t.dirdep ]; then + cmp -s $_DIRDEP $t.dirdep && return + echo "ERROR: $t installed by `cat $t.dirdep` not `cat $_DIRDEP`" >&2 + exit 1 + fi + LnCp $_DIRDEP $t.dirdep || exit 1 +} + +args="$@" +while [ $# -gt 8 ] +do + shift 8 +done +eval dest=\$$# +if [ -f $dest ]; then + # a file, there can be only one .dirdep needed + StageDirdep $dest +elif [ -d $dest ]; then + for f in $args + do + test -f $f || continue + StageDirdep $dest/${f##*/} + done +fi Modified: projects/bmake/usr.bin/kdump/Makefile ============================================================================== --- projects/bmake/usr.bin/kdump/Makefile Fri Apr 19 18:39:17 2013 (r249653) +++ projects/bmake/usr.bin/kdump/Makefile Fri Apr 19 18:45:03 2013 (r249654) @@ -38,8 +38,3 @@ linux_syscalls.c: >> linux_syscalls.c .include - -.if ${MK_STAGING} != "" -# we are interested in the files put in ${STAGE_OBJTOP}/include -INCLUDEDIR= /include -.endif Modified: projects/bmake/usr.bin/kdump/Makefile.depend ============================================================================== --- projects/bmake/usr.bin/kdump/Makefile.depend Fri Apr 19 18:39:17 2013 (r249653) +++ projects/bmake/usr.bin/kdump/Makefile.depend Fri Apr 19 18:45:03 2013 (r249654) @@ -6,6 +6,7 @@ DIRDEPS = \ gnu/lib/libgcc \ include \ include/arpa \ + include/rpc \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ From owner-svn-src-projects@FreeBSD.ORG Sat Apr 20 18:45:29 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 575BFC57; Sat, 20 Apr 2013 18:45:29 +0000 (UTC) (envelope-from cherry@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4A8A79F7; Sat, 20 Apr 2013 18:45:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KIjT1s019695; Sat, 20 Apr 2013 18:45:29 GMT (envelope-from cherry@svn.freebsd.org) Received: (from cherry@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KIjT5x019693; Sat, 20 Apr 2013 18:45:29 GMT (envelope-from cherry@svn.freebsd.org) Message-Id: <201304201845.r3KIjT5x019693@svn.freebsd.org> From: "Cherry G. Mathew" Date: Sat, 20 Apr 2013 18:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249708 - projects/amd64_xen_pv/sys/amd64/xen X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 18:45:29 -0000 Author: cherry Date: Sat Apr 20 18:45:28 2013 New Revision: 249708 URL: http://svnweb.freebsd.org/changeset/base/249708 Log: When holding or inspecting the mmu state, reset various MD pointers first. Approved by: gibbs(implicit) Modified: projects/amd64_xen_pv/sys/amd64/xen/mmu_map.c Modified: projects/amd64_xen_pv/sys/amd64/xen/mmu_map.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/mmu_map.c Sat Apr 20 17:53:39 2013 (r249707) +++ projects/amd64_xen_pv/sys/amd64/xen/mmu_map.c Sat Apr 20 18:45:28 2013 (r249708) @@ -279,6 +279,9 @@ mmu_map_inspect_va(struct pmap *pm, void struct mmu_map_index *pti = addr; KASSERT(pti->sanity == SANE, ("%s: Uninitialised index cookie used", __func__)); + /* Reset pti */ + pti->pml4t = pti->pdpt = pti->pdt = pti->pt = 0; + vm_paddr_t pt; pti->pml4t = pmap_get_pml4t(pm); @@ -318,6 +321,9 @@ mmu_map_hold_va(struct pmap *pm, void *a struct mmu_map_index *pti = addr; KASSERT(pti->sanity == SANE, ("%s: Uninitialised index cookie used", __func__)); + /* Reset pti */ + pti->pml4t = pti->pdpt = pti->pdt = pti->pt = 0; + bool alloced = false; /* Did we have to alloc backing pages ? */ vm_paddr_t pt; From owner-svn-src-projects@FreeBSD.ORG Sat Apr 20 18:52:07 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 439B86B; Sat, 20 Apr 2013 18:52:07 +0000 (UTC) (envelope-from cherry@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 36FB9A2A; Sat, 20 Apr 2013 18:52:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3KIq7nY024848; Sat, 20 Apr 2013 18:52:07 GMT (envelope-from cherry@svn.freebsd.org) Received: (from cherry@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3KIq6AA024845; Sat, 20 Apr 2013 18:52:06 GMT (envelope-from cherry@svn.freebsd.org) Message-Id: <201304201852.r3KIq6AA024845@svn.freebsd.org> From: "Cherry G. Mathew" Date: Sat, 20 Apr 2013 18:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r249709 - projects/amd64_xen_pv/sys/amd64/xen X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 18:52:07 -0000 Author: cherry Date: Sat Apr 20 18:52:06 2013 New Revision: 249709 URL: http://svnweb.freebsd.org/changeset/base/249709 Log: Intercept syscall instruction from userland via hypervisor callback. Reroute to FreeBSD system call routines. Enable fpu (Unrelated) Approved by: gibbs(implicit) Modified: projects/amd64_xen_pv/sys/amd64/xen/exception.S projects/amd64_xen_pv/sys/amd64/xen/machdep.c Modified: projects/amd64_xen_pv/sys/amd64/xen/exception.S ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/exception.S Sat Apr 20 18:45:28 2013 (r249708) +++ projects/amd64_xen_pv/sys/amd64/xen/exception.S Sat Apr 20 18:52:06 2013 (r249709) @@ -41,6 +41,7 @@ #include "assym.s" #define T_EVENT T_RESERVED /* XXX: */ +#define VGCF_IN_SYSCALL 256 /* See: xen/interface/arch-x86/xen-x86_64.h */ /* * We're guaranteed that sizeof(struct vcpu_info) == 64 bytes. @@ -213,6 +214,24 @@ pushq $0 ; \ jmp hypercall_page + (__HYPERVISOR_iret * 32) +#define CALLSYSCALL \ + cld ;\ + movq PCPU(CURTHREAD),%rdi ;\ + movq %rsp, TD_FRAME(%rdi) ;\ + movl TF_RFLAGS(%rsp),%esi ;\ + andl $PSL_T,%esi ;\ + call amd64_syscall + +#define SYSRET \ + /* XXX: watchout for: + * http: //cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-0744 + * Explained here: + * http://blog.xen.org/index.php/2012/06/13/the-intel-sysret-privilege-escalation/ + * Also see comments in trap.c + */ + pushq $VGCF_IN_SYSCALL ;\ + jmp hypercall_page + (__HYPERVISOR_iret * 32) + NON_GPROF_ENTRY(restore_segment_regs) .globl ld_es .globl ld_ds @@ -537,3 +556,16 @@ ENTRY(failsafe_callback) movq msgfailsafe, %rdi ; call panic ; /* panic("..."); */ msgfailsafe: .asciz "Failsafe upcall triggered\n" + +IDTVEC(syscall_callback) + TRAP_FRAME_ENTER_NOERR ; + TRAP_PROLOGUE(T_USER) ; + SAVE_SEGMENT_REGS ; + SAVE_GENERAL_REGS ; + DO_STI_MAYBE ; + CALLSYSCALL ; + DO_AST_MAYBE ; + RESTORE_GENERAL_REGS ; /* XXX: optimise for SYSRET */ + RESTORE_SEGMENT_REGS ; + TRAP_FRAME_EXIT_NOERR ; + INTR_EXIT ; /* XXX: SYSRET is more optimal */ Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/machdep.c Sat Apr 20 18:45:28 2013 (r249708) +++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c Sat Apr 20 18:52:06 2013 (r249709) @@ -131,9 +131,10 @@ __aligned(PAGE_SIZE); /* vcpu0 global de struct mtx icu_lock; struct mtx dt_lock; /* lock for GDT and LDT */ /* XXX : please review its use */ -/* Event callback prototypes */ +/* callback prototypes */ void Xhypervisor_callback(void); void failsafe_callback(void); +void Xsyscall_callback(void); vm_paddr_t initxen(struct start_info *); @@ -290,21 +291,24 @@ init_exception_table(void) static void init_event_callbacks(void) { - struct callback_register event = { - .type = CALLBACKTYPE_event, - .address = (unsigned long)Xhypervisor_callback - }; + struct callback_register cbr; - struct callback_register failsafe = { - .type = CALLBACKTYPE_failsafe, - .address = (unsigned long)failsafe_callback - }; + cbr.type = CALLBACKTYPE_event; + cbr.address = (unsigned long)Xhypervisor_callback; + PANIC_IF(HYPERVISOR_callback_op(CALLBACKOP_register, &cbr)); + + + cbr.type = CALLBACKTYPE_failsafe; + cbr.address = (unsigned long)failsafe_callback; - PANIC_IF(HYPERVISOR_callback_op(CALLBACKOP_register, &event)); + PANIC_IF(HYPERVISOR_callback_op(CALLBACKOP_register, &cbr)); - PANIC_IF(HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe)); + cbr.type = CALLBACKTYPE_syscall; + cbr.address = (unsigned long)Xsyscall_callback; - /* XXX: syscall */ + PANIC_IF(HYPERVISOR_callback_op(CALLBACKOP_register, &cbr)); + + /* XXX: syscall32, sysenter */ } #define XEN_CPUID_LEAF_HYPERCALL XEN_CPUID_LEAF(3 - 1) @@ -540,7 +544,14 @@ initxen(struct start_info *si) bzero(msgbufp, msgbufsize); msgbufinit(msgbufp, msgbufsize); - //fpuinit(); XXX: TODO + + /* Enable write permissions for code patching */ + static vm_offset_t xsave_cpage; + xsave_cpage = (vm_offset_t) ctx_switch_xsave & ~PAGE_MASK; + PT_SET_MA(xsave_cpage, phystomach(VTOP(xsave_cpage)) | PG_V | PG_U | PG_RW); + fpuinit(); + PT_SET_MA(xsave_cpage, phystomach(VTOP(xsave_cpage)) | PG_V | PG_U); + /* * Set up thread0 pcb after fpuinit calculated pcb + fpu save