Re: svn commit: r325728 - head/lib/libkvm

2019-02-06 Thread Will Andrews
On Tue, Feb 5, 2019 at 10:25 AM Bruce Evans  wrote:

> Signed kp_offset seems wrong.  Apart from it not reaching the top of 64-
> bit address spaces, adding unsigned kp_len to it gives an unsigned type.
>

It's appropriate, because in this context, we return page information
including addresses that would be valid pointer references, but are not
included in the core file.  Minidumps omit large numbers of physical pages,
so calls to kvm_walk_pages() will generate large numbers of kvm_page
instances that have an offset of -1.

--Will.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342560 - head/tools/build

2018-12-27 Thread Will Andrews
Author: will
Date: Thu Dec 27 23:27:48 2018
New Revision: 342560
URL: https://svnweb.freebsd.org/changeset/base/342560

Log:
  beinstall: try to save progress from pkg updates.
  
  This is primarily aimed at failed updates due to package conflicts, and
  affects treatment of failed updates.  Whereas before potentially a large
  number of packages would need to be synced for each attempt, they can now
  be persisted.  Requires rsync.  There may be better ways to implement this,
  e.g. using secondary cache path that is only used on followup attempts and
  then wiped on success, which avoids polluting current cache.

Modified:
  head/tools/build/beinstall.sh

Modified: head/tools/build/beinstall.sh
==
--- head/tools/build/beinstall.sh   Thu Dec 27 22:44:07 2018
(r342559)
+++ head/tools/build/beinstall.sh   Thu Dec 27 23:27:48 2018
(r342560)
@@ -82,6 +82,14 @@ unmount_be() {
mount | grep " on ${BE_MNTPT}" | awk '{print $3}' | sort -r | xargs -t 
umount -f
 }
 
+copy_pkgs() {
+   # Before cleaning up, try to save progress in pkg(8) updates, to
+   # speed up future updates.  This is only called on the error path;
+   # no need to run on success.
+   echo "Rsyncing back newly saved packages..."
+   rsync -av --progress ${BE_MNTPT}/var/cache/pkg/. /var/cache/pkg/.
+}
+
 cleanup_be() {
# Before destroying, unmount any child filesystems that may have
# been mounted under the boot environment.  Sort them in reverse
@@ -223,6 +231,10 @@ chroot ${BE_MNTPT} make "$@" -C ${srcdir} installworld
 if [ -n "${CONFIG_UPDATER}" ]; then
"update_${CONFIG_UPDATER}"
[ $? -ne 0 ] && errx "${CONFIG_UPDATER} (post-world) failed!"
+fi
+
+if which rsync >/dev/null 2>&1; then
+   cleanup_commands="copy_pkgs ${cleanup_commands}"
 fi
 
 BE_PKG="chroot ${BE_MNTPT} env ASSUME_ALWAYS_YES=true pkg"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r338103 - head/usr.sbin/iostat

2018-08-20 Thread Will Andrews
Author: will
Date: Mon Aug 20 13:42:22 2018
New Revision: 338103
URL: https://svnweb.freebsd.org/changeset/base/338103

Log:
  iostat: update man page for r277566
  
  The original commit added granularity to the transaction latency display
  in the extended device stats mode, but didn't update the man page.
  
  Reported by:  Miroslav Lachman <000.f...@quip.cz> via jmg
  MFC after:1 day

Modified:
  head/usr.sbin/iostat/iostat.8

Modified: head/usr.sbin/iostat/iostat.8
==
--- head/usr.sbin/iostat/iostat.8   Mon Aug 20 12:43:18 2018
(r338102)
+++ head/usr.sbin/iostat/iostat.8   Mon Aug 20 13:42:22 2018
(r338103)
@@ -360,8 +360,14 @@ kilobytes read per second
 kilobytes write per second
 .It qlen
 transactions queue length
-.It svc_t
-average duration of transactions, in milliseconds
+.It ms/r
+average duration of read transactions, in milliseconds
+.It ms/w
+average duration of write transactions, in milliseconds
+.It ms/o
+average duration of all other transactions, in milliseconds
+.It ms/t
+average duration of all transactions, in milliseconds
 .It %b
 % of time the device had one or more outstanding transactions
 .El
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r337840 - in head: cddl/usr.bin/ztest cddl/usr.bin/ztest/tests etc/mtree

2018-08-15 Thread Will Andrews
Author: will
Date: Wed Aug 15 13:05:04 2018
New Revision: 337840
URL: https://svnweb.freebsd.org/changeset/base/337840

Log:
  zfs: add ztest to the kyua test suite.
  
  This program is currently failing, and has been for >6 months on HEAD.
  Ideally, this should be run 24x7 in CI, to discover hard-to-find bugs that
  only manifest with concurrent i/o.
  
  Requested by: lwhsu, mmacy

Added:
  head/cddl/usr.bin/ztest/tests/
  head/cddl/usr.bin/ztest/tests/Makefile   (contents, props changed)
  head/cddl/usr.bin/ztest/tests/ztest.sh   (contents, props changed)
Modified:
  head/cddl/usr.bin/ztest/Makefile
  head/etc/mtree/BSD.tests.dist

Modified: head/cddl/usr.bin/ztest/Makefile
==
--- head/cddl/usr.bin/ztest/MakefileWed Aug 15 13:03:01 2018
(r337839)
+++ head/cddl/usr.bin/ztest/MakefileWed Aug 15 13:05:04 2018
(r337840)
@@ -25,4 +25,7 @@ CSTD= c99
 # it without debugging.
 CFLAGS+= -g -DDEBUG=1 -Wno-format
 
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
+
 .include 

Added: head/cddl/usr.bin/ztest/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/cddl/usr.bin/ztest/tests/Makefile  Wed Aug 15 13:05:04 2018
(r337840)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+.include 
+
+ATF_TESTS_SH+= ztest
+
+.include 

Added: head/cddl/usr.bin/ztest/tests/ztest.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/cddl/usr.bin/ztest/tests/ztest.sh  Wed Aug 15 13:05:04 2018
(r337840)
@@ -0,0 +1,52 @@
+#
+# Test Case: ztest
+# $FreeBSD$
+#
+atf_test_case ztest
+ztest_head()
+{
+   atf_set "descr" "Run ztest"
+   atf_set "timeout" 900
+   atf_set "require.config" "rt_long"
+}
+
+ztest_body()
+{
+   ARGS="-V -f ${TMPDIR:-/tmp}"
+   if atf_config_has ztest_extra_args; then
+   ARGS="${ARGS} $(atf_config_get ztest_extra_args)"
+   fi
+   ztest ${ARGS}
+   if [ $? != 0 ]; then
+   echo "failing"
+   save_ztest_artifacts
+   atf_fail "Testcase failed"
+   else
+   echo "passing"
+   atf_pass
+   fi
+}
+
+#
+# ATF Test Program Init Function
+#
+atf_init_test_cases()
+{
+   atf_add_test_case ztest
+}
+
+save_ztest_artifacts()
+{
+   # If artifacts_dir is defined, save test artifacts for
+   # post-mortem analysis
+   if atf_config_has artifacts_dir; then
+   TC_ARTIFACTS_DIR=`atf_config_get 
artifacts_dir`/cddl/usr.bin/ztest/$(atf_get ident)
+   mkdir -p $TC_ARTIFACTS_DIR
+   TC_CORE_DIR=/var/crash
+   if atf_config_has core_dir; then
+   TC_CORE_DIR=`atf_config_get core_dir`
+   fi
+   mv *ztest*.core* $TC_ARTIFACTS_DIR || true
+   mv ${TC_CORE_DIR}/*ztest*.core* $TC_ARTIFACTS_DIR || true
+   fi
+}

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Wed Aug 15 13:03:01 2018
(r337839)
+++ head/etc/mtree/BSD.tests.dist   Wed Aug 15 13:05:04 2018
(r337840)
@@ -67,6 +67,8 @@
 usr.bin
 ctfconvert
 ..
+ztest
+..
 ..
 usr.sbin
 dtrace
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r336526 - head

2018-07-28 Thread Will Andrews
Hi Ravi,

Thanks for taking an initial stab, I applied your patch and quickly
realized the problem is deeper than it looks.  This is because installworld
and the second stage of mergemaster/etcupdate require the "pre" phase to
take effect in their view of the system (specifically, the "ntpd" user must
exist from their /etc/passwd, etc).  For traditional upgrades, this occurs
by simply rebooting.

I've committed a revised version of your original patch, and have upgraded
across this barrier using beinstall.  Please give it a try and let me know
how it goes.

Thanks!
--Will.

On Wed, Jul 25, 2018 at 11:28 PM, Ravi Pokala  wrote:

> -Original Message-
> From: Ravi Pokala 
> Date: 2018-07-20, Friday at 10:53
> To: Ian Lepore , , <
> svn-src-...@freebsd.org>, , Will Andrews
> 
> Subject: Re: svn commit: r336526 - head
>
> > -Original Message-
> > From:  on behalf of Ian Lepore <
> i...@freebsd.org>
> > Date: 2018-07-20, Friday at 10:38
> > To: Ravi Pokala , , <
> svn-src-...@freebsd.org>, 
> > Subject: Re: svn commit: r336526 - head
> >
> >> On Fri, 2018-07-20 at 09:56 -0700, Ravi Pokala wrote:
> >>> Hi Ian,
> >>>
> >>> -Original Message-
> >>> From:  on behalf of Ian Lepore
> >>> Date: 2018-07-19, Thursday at 17:44
> >>> To: , ,
> >>> Subject: svn commit: r336526 - head
> >>>
> >>>>
> >>>> Author: ian
> >>>> Date: Fri Jul 20 00:44:04 2018
> >>>> New Revision: 336526
> >>>> URL: https://svnweb.freebsd.org/changeset/base/336526
> >>>>
> >>>> Log:
> >>>>   Add ntpd to the list of users/groups to check before installing.
> >>>>
> >>>> Modified:
> >>>>   head/Makefile.inc1
> >>> When trying to installworld:
> >>>
> >>> ERROR: Required ntpd user is missing, see /usr/src/UPDATING.
> >>>
> >>> But there is no UPDATING entry about this. (Also, shouldn't it be
> ${SRCTOP}/UPDATING?)
> >>>
> >>> Thanks,
> >>>
> >>> Ravi (rpokala@)
> >>
> >> I wondered about that too, when I accidentally stumbled across the
> >> CHECK_UIDS thing and realized I should add ntpd to it. I searched in
> >> UPDATING for some of the other things in the CHECK_UIDS list to see
> >> what had been said about such changes in the past, even searching
> >> through old-old svn history, and found nothing.
> >>
> >> I finally settled on the thought that the reference to UPDATING was to
> >> the stuff at the bottom that never changes. In particular to the
> >> section around line 1595 that documents the instalkernel, reboot,
> >> mergemaster, installworld sequence. The mergemaster part should take
> >> care of the new userid, I guess.
> >>
> >> -- Ian
> >
> > Interesting. I was attempting the install via the `beinstall.sh' script.
> CCing will@, since he wrote it.
> >
> > Thanks,
> >
> > Ravi (rpokala@)
>
> After some discussion on IRC, I created this patch to fix `beinstall.sh'.
>
> https://people.freebsd.org/~rpokala/beinstall.patch
>
> However, I'm a bit afraid of testing it, until someone who actually knows
> `etcupdate' and `mergemaster' can confirm that it won't blow up my box. :-)
>
> Can anyone take a look and assuage my fears?
>
> Thanks,
>
> Ravi (rpokala@)
>
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r336856 - head/tools/build

2018-07-28 Thread Will Andrews
Author: will
Date: Sun Jul 29 01:44:26 2018
New Revision: 336856
URL: https://svnweb.freebsd.org/changeset/base/336856

Log:
  beinstall: perform pre-installworld steps.
  
  Since all post-installkernel steps are assumed to operate in the updated
  installation, it's necessary to chroot all of the followup steps in the new
  boot environment.  Set up and mount the source and object directories at the
  same paths inside the BE root, and clean up to the extent changes were made.
  This commit fixes upgrading using beinstall past the new ntpd user change.
  
  Improve testability of changes to this script while I'm here.
  
  Reported by:  rpokala (earlier patch)

Modified:
  head/tools/build/beinstall.sh

Modified: head/tools/build/beinstall.sh
==
--- head/tools/build/beinstall.sh   Sun Jul 29 00:30:06 2018
(r336855)
+++ head/tools/build/beinstall.sh   Sun Jul 29 01:44:26 2018
(r336856)
@@ -78,26 +78,92 @@ rmdir_be() {
rm -rf ${BE_MNTPT}
 }
 
+unmount_be() {
+   mount | grep " on ${BE_MNTPT}" | awk '{print $3}' | sort -r | xargs -t 
umount -f
+}
+
 cleanup_be() {
+   # Before destroying, unmount any child filesystems that may have
+   # been mounted under the boot environment.  Sort them in reverse
+   # order so children are unmounted first.
+   unmount_be
+   # Finally, clean up any directories that were created by the
+   # operation, via cleanup_be_dirs().
+   if [ -n "${created_be_dirs}" ]; then
+   chroot ${BE_MNTPT} /bin/rm -rf ${created_be_dirs}
+   fi
beadm destroy -F ${BENAME}
 }
 
+create_be_dirs() {
+   echo "${BE_MNTPT}: Inspecting dirs $*"
+   for dir in $*; do
+   curdir="$dir"
+   topdir="$dir"
+   while :; do
+   [ -e "${BE_MNTPT}${curdir}" ] && break
+   topdir=$curdir
+   curdir=$(dirname ${curdir})
+   done
+   [ "$curdir" = "$dir" ] && continue
+
+   # Add the top-most nonexistent directory to the list, then
+   # mkdir -p the innermost directory specified by the argument.
+   # This way the least number of directories are rm'd directly.
+   created_be_dirs="${topdir} ${created_be_dirs}"
+   echo "${BE_MNTPT}: Created ${dir}"
+   mkdir -p ${BE_MNTPT}${dir} || return $?
+   done
+   return 0
+}
+
+update_mergemaster_pre() {
+   mergemaster -p -m ${srcdir} -D ${BE_MNTPT} -t ${BE_MM_ROOT} 
${MERGEMASTER_FLAGS}
+}
+
 update_mergemaster() {
-   mergemaster -m $(pwd) -D ${BE_MNTPT} -t ${BE_MM_ROOT} 
${MERGEMASTER_FLAGS}
+   chroot ${BE_MNTPT} \
+   mergemaster -m ${srcdir} -t ${BE_MM_ROOT} ${MERGEMASTER_FLAGS}
 }
 
+update_etcupdate_pre() {
+   etcupdate -p -s ${srcdir} -D ${BE_MNTPT} ${ETCUPDATE_FLAGS} || return $?
+   etcupdate resolve -D ${BE_MNTPT} || return $?
+}
+
 update_etcupdate() {
-   etcupdate -s $(pwd) -D ${BE_MNTPT} ${ETCUPDATE_FLAGS} || return $?
-   etcupdate resolve -D ${BE_MNTPT}
+   chroot ${BE_MNTPT} \
+   etcupdate -s ${srcdir} ${ETCUPDATE_FLAGS} || return $?
+   chroot ${BE_MNTPT} etcupdate resolve
 }
 
 
+# Special command-line subcommand that can be used to do a full cleanup
+# after a manual post-mortem has been completed.
+postmortem() {
+   [ -n "${BENAME}" ] || errx "Must specify BENAME"
+   [ -n "${BE_MNTPT}" ] || errx "Must specify BE_MNTPT"
+   echo "Performing post-mortem on BE ${BENAME} at ${BE_MNTPT} ..."
+   unmount_be
+   rmdir_be
+   echo "Post-mortem cleanup complete."
+   echo "To destroy the BE (recommended), run: beadm destroy ${BENAME}"
+   echo "To instead continue with the BE, run: beadm activate ${BENAME}"
+}
+
+if [ -n "$BEINSTALL_CMD" ]; then
+   ${BEINSTALL_CMD} $*
+   exit $?
+fi
+
+
 cleanup_commands=""
 trap 'errx "Interrupt caught"' HUP INT TERM
 
 [ "$(whoami)" != "root" ] && errx "Must be run as root"
 
 [ ! -f "Makefile.inc1" ] && errx "Must be in FreeBSD source tree"
+srcdir=$(pwd)
 objdir=$(make -V .OBJDIR 2>/dev/null)
 [ ! -d "${objdir}" ] && errx "Must have built FreeBSD from source tree"
 
@@ -139,11 +205,24 @@ beadm mount ${BENAME} ${BE_TMP}/mnt || errx "Unable to
 
 echo "Mounted ${BENAME} to ${BE_MNTPT}, performing install/update ..."
 make "$@" DESTDIR=${BE_MNTPT} installkernel || errx "Installkernel failed!"
-make "$@" DESTDIR=${BE_MNTPT} installworld || errx "Installworld failed!"
+if [ -n "${CONFIG_UPDATER}" ]; then
+   "update_${CONFIG_UPDATER}_pre"
+   [ $? -ne 0 ] && errx "${CONFIG_UPDATER} (pre-world) failed!"
+fi
 
+# Mount the source and object tree within the BE in order to account for any
+# changes applied by the pre-installworld updater.  Cleanup any directories
+# created if they didn't exist previously.
+create_be_dirs "${srcdir}" "${objdir}" 

Re: svn commit: r336526 - head

2018-07-26 Thread Will Andrews
Hi Ravi,

I don't think you have to worry.  These commands are confined to the
temporary mount point used for the BE during the install phase, so they
won't affect your running system (which is sort of the point of using
beinstall instead of doing it the "traditional" way).  I haven't had a
chance yet to test it, but I would expect it works fine.

Very minor nit: I'd distinguish the "pre" phase from the post in the error
message.

Thanks for looking into this.

--Will.

On Wed, Jul 25, 2018 at 11:28 PM, Ravi Pokala  wrote:

> -Original Message-
> From: Ravi Pokala 
> Date: 2018-07-20, Friday at 10:53
> To: Ian Lepore , , <
> svn-src-...@freebsd.org>, , Will Andrews
> 
> Subject: Re: svn commit: r336526 - head
>
> > -Original Message-
> > From:  on behalf of Ian Lepore <
> i...@freebsd.org>
> > Date: 2018-07-20, Friday at 10:38
> > To: Ravi Pokala , , <
> svn-src-...@freebsd.org>, 
> > Subject: Re: svn commit: r336526 - head
> >
> >> On Fri, 2018-07-20 at 09:56 -0700, Ravi Pokala wrote:
> >>> Hi Ian,
> >>>
> >>> -Original Message-
> >>> From:  on behalf of Ian Lepore
> >>> Date: 2018-07-19, Thursday at 17:44
> >>> To: , ,
> >>> Subject: svn commit: r336526 - head
> >>>
> >>>>
> >>>> Author: ian
> >>>> Date: Fri Jul 20 00:44:04 2018
> >>>> New Revision: 336526
> >>>> URL: https://svnweb.freebsd.org/changeset/base/336526
> >>>>
> >>>> Log:
> >>>>   Add ntpd to the list of users/groups to check before installing.
> >>>>
> >>>> Modified:
> >>>>   head/Makefile.inc1
> >>> When trying to installworld:
> >>>
> >>> ERROR: Required ntpd user is missing, see /usr/src/UPDATING.
> >>>
> >>> But there is no UPDATING entry about this. (Also, shouldn't it be
> ${SRCTOP}/UPDATING?)
> >>>
> >>> Thanks,
> >>>
> >>> Ravi (rpokala@)
> >>
> >> I wondered about that too, when I accidentally stumbled across the
> >> CHECK_UIDS thing and realized I should add ntpd to it. I searched in
> >> UPDATING for some of the other things in the CHECK_UIDS list to see
> >> what had been said about such changes in the past, even searching
> >> through old-old svn history, and found nothing.
> >>
> >> I finally settled on the thought that the reference to UPDATING was to
> >> the stuff at the bottom that never changes. In particular to the
> >> section around line 1595 that documents the instalkernel, reboot,
> >> mergemaster, installworld sequence. The mergemaster part should take
> >> care of the new userid, I guess.
> >>
> >> -- Ian
> >
> > Interesting. I was attempting the install via the `beinstall.sh' script.
> CCing will@, since he wrote it.
> >
> > Thanks,
> >
> > Ravi (rpokala@)
>
> After some discussion on IRC, I created this patch to fix `beinstall.sh'.
>
> https://people.freebsd.org/~rpokala/beinstall.patch
>
> However, I'm a bit afraid of testing it, until someone who actually knows
> `etcupdate' and `mergemaster' can confirm that it won't blow up my box. :-)
>
> Can anyone take a look and assuage my fears?
>
> Thanks,
>
> Ravi (rpokala@)
>
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r335928 - in head: share/man/man4 sys/net sys/netpfil/pf

2018-07-03 Thread Will Andrews
Author: will
Date: Wed Jul  4 03:36:46 2018
New Revision: 335928
URL: https://svnweb.freebsd.org/changeset/base/335928

Log:
  Revert r335833.
  
  Several third-parties use at least some of these ioctls.  While it would be
  better for regression testing if they were used in base (or at least in the
  test suite), it's currently not worth the trouble to push through removal.
  
  Submitted by: antoine, markj

Modified:
  head/share/man/man4/pf.4
  head/sys/net/pfvar.h
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/share/man/man4/pf.4
==
--- head/share/man/man4/pf.4Wed Jul  4 03:24:11 2018(r335927)
+++ head/share/man/man4/pf.4Wed Jul  4 03:36:46 2018(r335928)
@@ -139,8 +139,9 @@ Clear the buffer address pool and get a
 .Va ticket
 for subsequent
 .Dv DIOCADDADDR ,
+.Dv DIOCADDRULE ,
 and
-.Dv DIOCADDRULE
+.Dv DIOCCHANGERULE
 calls.
 .It Dv DIOCADDADDR Fa "struct pfioc_pooladdr *pp"
 .Pp
@@ -148,6 +149,8 @@ Add the pool address
 .Va addr
 to the buffer address pool to be used in the following
 .Dv DIOCADDRULE
+or
+.Dv DIOCCHANGERULE
 call.
 All other members of the structure are ignored.
 .It Dv DIOCADDRULE Fa "struct pfioc_rule *pr"
@@ -316,6 +319,21 @@ This ioctl returns
 if the given anchor does not exist or
 .Er EBUSY
 if another process is concurrently updating a ruleset.
+.It Dv DIOCADDSTATE Fa "struct pfioc_state *ps"
+Add a state entry.
+.Bd -literal
+struct pfioc_state {
+   struct pfsync_state state;
+};
+.Ed
+.It Dv DIOCGETSTATE Fa "struct pfioc_state *ps"
+Extract the entry identified by the
+.Va id
+and
+.Va creatorid
+fields of the
+.Va state
+structure from the state table.
 .It Dv DIOCKILLSTATES Fa "struct pfioc_state_kill *psk"
 Remove matching entries from the state table.
 This ioctl returns the number of killed states in
@@ -421,6 +439,11 @@ On exit,
 is always set to the total size required to hold all state table entries
 (i.e., it is set to
 .Li sizeof(struct pf_state) * nr ) .
+.It Dv DIOCCHANGERULE Fa "struct pfioc_rule *pcr"
+Add or remove the
+.Va rule
+in the ruleset specified by
+.Va rule.action .
 .Pp
 The type of operation to be performed is indicated by
 .Va action ,
@@ -452,6 +475,15 @@ indicates the rule number against which
 or
 .Dv PF_CHANGE_REMOVE
 actions are applied.
+.\" It Dv DIOCCHANGEALTQ Fa "struct pfioc_altq *pcr"
+.It Dv DIOCCHANGEADDR Fa "struct pfioc_pooladdr *pca"
+Add or remove the pool address
+.Va addr
+from the rule specified by
+.Va r_action ,
+.Va r_num ,
+and
+.Va anchor .
 .It Dv DIOCSETTIMEOUT Fa "struct pfioc_tm *pt"
 .Bd -literal
 struct pfioc_tm {
@@ -478,6 +510,8 @@ Get the state timeout of
 The value will be placed into the
 .Va seconds
 field.
+.It Dv DIOCCLRRULECTRS
+Clear per-rule statistics.
 .It Dv DIOCSETLIMIT Fa "struct pfioc_limit *pl"
 Set the hard limits on the memory pools used by the packet filter.
 .Bd -literal

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hWed Jul  4 03:24:11 2018(r335927)
+++ head/sys/net/pfvar.hWed Jul  4 03:36:46 2018(r335928)
@@ -1385,17 +1385,19 @@ struct pfioc_iface {
 #define DIOCGETRULE_IOWR('D',  7, struct pfioc_rule)
 /* XXX cut 8 - 17 */
 #define DIOCCLRSTATES  _IOWR('D', 18, struct pfioc_state_kill)
-/* XXX cut 19 */
+#define DIOCGETSTATE   _IOWR('D', 19, struct pfioc_state)
 #define DIOCSETSTATUSIF _IOWR('D', 20, struct pfioc_if)
 #define DIOCGETSTATUS  _IOWR('D', 21, struct pf_status)
 #define DIOCCLRSTATUS  _IO  ('D', 22)
 #define DIOCNATLOOK_IOWR('D', 23, struct pfioc_natlook)
 #define DIOCSETDEBUG   _IOWR('D', 24, u_int32_t)
 #define DIOCGETSTATES  _IOWR('D', 25, struct pfioc_states)
+#define DIOCCHANGERULE _IOWR('D', 26, struct pfioc_rule)
 /* XXX cut 26 - 28 */
 #define DIOCSETTIMEOUT _IOWR('D', 29, struct pfioc_tm)
 #define DIOCGETTIMEOUT _IOWR('D', 30, struct pfioc_tm)
-/* XXX cut 31-38 */
+#define DIOCADDSTATE   _IOWR('D', 37, struct pfioc_state)
+#define DIOCCLRRULECTRS_IO  ('D', 38)
 #define DIOCGETLIMIT   _IOWR('D', 39, struct pfioc_limit)
 #define DIOCSETLIMIT   _IOWR('D', 40, struct pfioc_limit)
 #define DIOCKILLSTATES _IOWR('D', 41, struct pfioc_state_kill)
@@ -1404,12 +1406,13 @@ struct pfioc_iface {
 #define DIOCADDALTQ_IOWR('D', 45, struct pfioc_altq)
 #define DIOCGETALTQS   _IOWR('D', 47, struct pfioc_altq)
 #define DIOCGETALTQ_IOWR('D', 48, struct pfioc_altq)
-/* XXX cut 49 */
+#define DIOCCHANGEALTQ _IOWR('D', 49, struct pfioc_altq)
 #define DIOCGETQSTATS  _IOWR('D', 50, struct pfioc_qstats)
 #define DIOCBEGINADDRS _IOWR('D', 51, struct pfioc_pooladdr)
 #define DIOCADDADDR_IOWR('D', 52, struct pfioc_pooladdr)
 #define DIOCGETADDRS   _IOWR('D', 53, struct pfioc_pooladdr)
 #define DIOCGETADDR_IOWR('D', 54, struct pfioc_pooladdr)
+#define DIOCCHANGEADDR _IOWR('D', 55, struct pfioc_pooladdr)
 /* XXX cut 55 - 57 */
 #define  

svn commit: r335835 - head/share/man/man4

2018-06-30 Thread Will Andrews
Author: will
Date: Sun Jul  1 01:56:40 2018
New Revision: 335835
URL: https://svnweb.freebsd.org/changeset/base/335835

Log:
  pf(4): remove reference to non-existent pflow(4).

Modified:
  head/share/man/man4/pf.4

Modified: head/share/man/man4/pf.4
==
--- head/share/man/man4/pf.4Sun Jul  1 01:45:41 2018(r335834)
+++ head/share/man/man4/pf.4Sun Jul  1 01:56:40 2018(r335835)
@@ -1135,7 +1135,6 @@ main(int argc, char *argv[])
 .Xr altq 4 ,
 .Xr if_bridge 4 ,
 .Xr pflog 4 ,
-.Xr pflow 4 ,
 .Xr pfsync 4 ,
 .Xr pfctl 8 ,
 .Xr altq 9
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r335833 - in head: share/man/man4 sys/net sys/netpfil/pf

2018-06-30 Thread Will Andrews
Author: will
Date: Sun Jul  1 01:16:03 2018
New Revision: 335833
URL: https://svnweb.freebsd.org/changeset/base/335833

Log:
  pf: remove unused ioctls.
  
  Several ioctls are unused in pf, in the sense that no base utility
  references them.  Additionally, a cursory review of pf-based ports
  indicates they're not used elsewhere either.  Some of them have been
  unused since the original import.  As far as I can tell, they're also
  unused in OpenBSD.  Finally, removing this code removes the need for
  future pf work to take them into account.
  
  Reviewed by:  kp
  Differential Revision:https://reviews.freebsd.org/D16076

Modified:
  head/share/man/man4/pf.4
  head/sys/net/pfvar.h
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/share/man/man4/pf.4
==
--- head/share/man/man4/pf.4Sun Jul  1 01:11:32 2018(r335832)
+++ head/share/man/man4/pf.4Sun Jul  1 01:16:03 2018(r335833)
@@ -139,9 +139,8 @@ Clear the buffer address pool and get a
 .Va ticket
 for subsequent
 .Dv DIOCADDADDR ,
-.Dv DIOCADDRULE ,
 and
-.Dv DIOCCHANGERULE
+.Dv DIOCADDRULE
 calls.
 .It Dv DIOCADDADDR Fa "struct pfioc_pooladdr *pp"
 .Pp
@@ -149,8 +148,6 @@ Add the pool address
 .Va addr
 to the buffer address pool to be used in the following
 .Dv DIOCADDRULE
-or
-.Dv DIOCCHANGERULE
 call.
 All other members of the structure are ignored.
 .It Dv DIOCADDRULE Fa "struct pfioc_rule *pr"
@@ -319,21 +316,6 @@ This ioctl returns
 if the given anchor does not exist or
 .Er EBUSY
 if another process is concurrently updating a ruleset.
-.It Dv DIOCADDSTATE Fa "struct pfioc_state *ps"
-Add a state entry.
-.Bd -literal
-struct pfioc_state {
-   struct pfsync_state state;
-};
-.Ed
-.It Dv DIOCGETSTATE Fa "struct pfioc_state *ps"
-Extract the entry identified by the
-.Va id
-and
-.Va creatorid
-fields of the
-.Va state
-structure from the state table.
 .It Dv DIOCKILLSTATES Fa "struct pfioc_state_kill *psk"
 Remove matching entries from the state table.
 This ioctl returns the number of killed states in
@@ -439,11 +421,6 @@ On exit,
 is always set to the total size required to hold all state table entries
 (i.e., it is set to
 .Li sizeof(struct pf_state) * nr ) .
-.It Dv DIOCCHANGERULE Fa "struct pfioc_rule *pcr"
-Add or remove the
-.Va rule
-in the ruleset specified by
-.Va rule.action .
 .Pp
 The type of operation to be performed is indicated by
 .Va action ,
@@ -475,15 +452,6 @@ indicates the rule number against which
 or
 .Dv PF_CHANGE_REMOVE
 actions are applied.
-.\" It Dv DIOCCHANGEALTQ Fa "struct pfioc_altq *pcr"
-.It Dv DIOCCHANGEADDR Fa "struct pfioc_pooladdr *pca"
-Add or remove the pool address
-.Va addr
-from the rule specified by
-.Va r_action ,
-.Va r_num ,
-and
-.Va anchor .
 .It Dv DIOCSETTIMEOUT Fa "struct pfioc_tm *pt"
 .Bd -literal
 struct pfioc_tm {
@@ -510,8 +478,6 @@ Get the state timeout of
 The value will be placed into the
 .Va seconds
 field.
-.It Dv DIOCCLRRULECTRS
-Clear per-rule statistics.
 .It Dv DIOCSETLIMIT Fa "struct pfioc_limit *pl"
 Set the hard limits on the memory pools used by the packet filter.
 .Bd -literal

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hSun Jul  1 01:11:32 2018(r335832)
+++ head/sys/net/pfvar.hSun Jul  1 01:16:03 2018(r335833)
@@ -1385,19 +1385,17 @@ struct pfioc_iface {
 #define DIOCGETRULE_IOWR('D',  7, struct pfioc_rule)
 /* XXX cut 8 - 17 */
 #define DIOCCLRSTATES  _IOWR('D', 18, struct pfioc_state_kill)
-#define DIOCGETSTATE   _IOWR('D', 19, struct pfioc_state)
+/* XXX cut 19 */
 #define DIOCSETSTATUSIF _IOWR('D', 20, struct pfioc_if)
 #define DIOCGETSTATUS  _IOWR('D', 21, struct pf_status)
 #define DIOCCLRSTATUS  _IO  ('D', 22)
 #define DIOCNATLOOK_IOWR('D', 23, struct pfioc_natlook)
 #define DIOCSETDEBUG   _IOWR('D', 24, u_int32_t)
 #define DIOCGETSTATES  _IOWR('D', 25, struct pfioc_states)
-#define DIOCCHANGERULE _IOWR('D', 26, struct pfioc_rule)
 /* XXX cut 26 - 28 */
 #define DIOCSETTIMEOUT _IOWR('D', 29, struct pfioc_tm)
 #define DIOCGETTIMEOUT _IOWR('D', 30, struct pfioc_tm)
-#define DIOCADDSTATE   _IOWR('D', 37, struct pfioc_state)
-#define DIOCCLRRULECTRS_IO  ('D', 38)
+/* XXX cut 31-38 */
 #define DIOCGETLIMIT   _IOWR('D', 39, struct pfioc_limit)
 #define DIOCSETLIMIT   _IOWR('D', 40, struct pfioc_limit)
 #define DIOCKILLSTATES _IOWR('D', 41, struct pfioc_state_kill)
@@ -1406,13 +1404,12 @@ struct pfioc_iface {
 #define DIOCADDALTQ_IOWR('D', 45, struct pfioc_altq)
 #define DIOCGETALTQS   _IOWR('D', 47, struct pfioc_altq)
 #define DIOCGETALTQ_IOWR('D', 48, struct pfioc_altq)
-#define DIOCCHANGEALTQ _IOWR('D', 49, struct pfioc_altq)
+/* XXX cut 49 */
 #define DIOCGETQSTATS  _IOWR('D', 50, struct pfioc_qstats)
 #define DIOCBEGINADDRS _IOWR('D', 51, struct pfioc_pooladdr)
 #define DIOCADDADDR_IOWR('D', 52, struct pfi

svn commit: r335832 - head/share/misc

2018-06-30 Thread Will Andrews
Author: will
Date: Sun Jul  1 01:11:32 2018
New Revision: 335832
URL: https://svnweb.freebsd.org/changeset/base/335832

Log:
  Rather belatedly add myself to committers-src.dot.

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Sun Jul  1 01:09:52 2018
(r335831)
+++ head/share/misc/committers-src.dot  Sun Jul  1 01:11:32 2018
(r335832)
@@ -349,6 +349,7 @@ versus [label="Konrad Jankowski\nver...@freebsd.org\n2
 weongyo [label="Weongyo Jeong\nweon...@freebsd.org\n2007/12/21"]
 wes [label="Wes Peters\n...@freebsd.org\n1998/11/25"]
 whu [label="Wei Hu\n...@freebsd.org\n2015/02/11"]
+will [label="Will Andrews\nw...@freebsd.org\n2000/03/20"]
 wkoszek [label="Wojciech A. Koszek\nwkos...@freebsd.org\n2006/02/21"]
 wma [label="Wojciech Macek\n...@freebsd.org\n2016/01/18"]
 wollman [label="Garrett Wollman\nwoll...@freebsd.org\n/??/??"]
@@ -419,6 +420,7 @@ billf -> gad
 billf -> jedgar
 billf -> jhb
 billf -> shafeeq
+billf -> will
 
 bmilekic -> csjp
 
@@ -645,6 +647,7 @@ ken -> asomers
 ken -> chuck
 ken -> ram
 ken -> slm
+ken -> will
 
 kib -> ae
 kib -> badger
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r335831 - head/tools/build

2018-06-30 Thread Will Andrews
Author: will
Date: Sun Jul  1 01:09:52 2018
New Revision: 335831
URL: https://svnweb.freebsd.org/changeset/base/335831

Log:
  beinstall: enable use with git worktrees.

Modified:
  head/tools/build/beinstall.sh

Modified: head/tools/build/beinstall.sh
==
--- head/tools/build/beinstall.sh   Sun Jul  1 01:01:59 2018
(r335830)
+++ head/tools/build/beinstall.sh   Sun Jul  1 01:09:52 2018
(r335831)
@@ -101,7 +101,8 @@ trap 'errx "Interrupt caught"' HUP INT TERM
 objdir=$(make -V .OBJDIR 2>/dev/null)
 [ ! -d "${objdir}" ] && errx "Must have built FreeBSD from source tree"
 
-if [ -d .git ] ; then
+# May be a worktree, in which case .git is a file, not a directory.
+if [ -e .git ] ; then
 commit_time=$(git show --format='%ct' 2>/dev/null | head -1)
 [ $? -ne 0 ] && errx "Can't lookup git commit timestamp"
 commit_ts=$(date -r ${commit_time} '+%Y%m%d.%H%M%S')
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r325735 - head/lib/libkvm

2017-11-11 Thread Will Andrews
Author: will
Date: Sun Nov 12 03:28:47 2017
New Revision: 325735
URL: https://svnweb.freebsd.org/changeset/base/325735

Log:
  libkvm: fix lib32 build.

Modified:
  head/lib/libkvm/kvm_i386.c

Modified: head/lib/libkvm/kvm_i386.c
==
--- head/lib/libkvm/kvm_i386.c  Sun Nov 12 03:13:01 2017(r325734)
+++ head/lib/libkvm/kvm_i386.c  Sun Nov 12 03:28:47 2017(r325735)
@@ -51,6 +51,7 @@ static char sccsid[] = "@(#)kvm_hp300.c   8.1 (Berkeley)
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #ifdef __i386__
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r325732 - head/lib/libkvm

2017-11-11 Thread Will Andrews
Author: will
Date: Sun Nov 12 01:36:48 2017
New Revision: 325732
URL: https://svnweb.freebsd.org/changeset/base/325732

Log:
  libkvm: fix build failures

Modified:
  head/lib/libkvm/kvm.h
  head/lib/libkvm/kvm_aarch64.h
  head/lib/libkvm/kvm_amd64.c
  head/lib/libkvm/kvm_amd64.h
  head/lib/libkvm/kvm_minidump_aarch64.c
  head/lib/libkvm/kvm_minidump_amd64.c
  head/lib/libkvm/kvm_minidump_arm.c
  head/lib/libkvm/kvm_minidump_i386.c
  head/lib/libkvm/kvm_minidump_mips.c
  head/lib/libkvm/kvm_private.c

Modified: head/lib/libkvm/kvm.h
==
--- head/lib/libkvm/kvm.h   Sun Nov 12 01:28:20 2017(r325731)
+++ head/lib/libkvm/kvm.h   Sun Nov 12 01:36:48 2017(r325732)
@@ -36,7 +36,14 @@
 #include 
 #include 
 #include 
-#include 
+
+/*
+ * Including vm/vm.h causes namespace pollution issues.  For the
+ * most part, only things using kvm_walk_pages() need to #include it.
+ */
+#ifndef VM_H
+typedef u_char vm_prot_t;
+#endif
 
 /* Default version symbol. */
 #defineVRS_SYM "_version"

Modified: head/lib/libkvm/kvm_aarch64.h
==
--- head/lib/libkvm/kvm_aarch64.h   Sun Nov 12 01:28:20 2017
(r325731)
+++ head/lib/libkvm/kvm_aarch64.h   Sun Nov 12 01:36:48 2017
(r325732)
@@ -42,8 +42,8 @@ typedef uint64_t  aarch64_pte_t;
 
 /* Source: arm64/include/pte.h */
 #defineAARCH64_ATTR_MASK   0xfff00fff
-#defineAARCH64_ATTR_UXN(1UL << 54)
-#defineAARCH64_ATTR_PXN(1UL << 53)
+#defineAARCH64_ATTR_UXN(1ULL << 54)
+#defineAARCH64_ATTR_PXN(1ULL << 53)
 #defineAARCH64_ATTR_XN (AARCH64_ATTR_PXN | AARCH64_ATTR_UXN)
 #defineAARCH64_ATTR_AP(x)  ((x) << 6)
 #defineAARCH64_ATTR_AP_RO  (1 << 1)

Modified: head/lib/libkvm/kvm_amd64.c
==
--- head/lib/libkvm/kvm_amd64.c Sun Nov 12 01:28:20 2017(r325731)
+++ head/lib/libkvm/kvm_amd64.c Sun Nov 12 01:36:48 2017(r325732)
@@ -51,6 +51,7 @@ static char sccsid[] = "@(#)kvm_hp300.c   8.1 (Berkeley)
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 

Modified: head/lib/libkvm/kvm_amd64.h
==
--- head/lib/libkvm/kvm_amd64.h Sun Nov 12 01:28:20 2017(r325731)
+++ head/lib/libkvm/kvm_amd64.h Sun Nov 12 01:36:48 2017(r325732)
@@ -55,7 +55,9 @@ typedef   uint64_tamd64_pml4e_t;
 #defineAMD64_NPML4EPG  (AMD64_PAGE_SIZE / 
sizeof(amd64_pml4e_t))
 #defineAMD64_PML4SHIFT 39
 
+#defineAMD64_PG_NX (1ULL << 63)
 #defineAMD64_PG_V  0x001
+#defineAMD64_PG_RW 0x002
 #defineAMD64_PG_PS 0x080
 #defineAMD64_PG_FRAME  (0x000ff000)
 #defineAMD64_PG_PS_FRAME   (0x000fffe0)

Modified: head/lib/libkvm/kvm_minidump_aarch64.c
==
--- head/lib/libkvm/kvm_minidump_aarch64.c  Sun Nov 12 01:28:20 2017
(r325731)
+++ head/lib/libkvm/kvm_minidump_aarch64.c  Sun Nov 12 01:36:48 2017
(r325732)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "../../sys/arm64/include/minidump.h"

Modified: head/lib/libkvm/kvm_minidump_amd64.c
==
--- head/lib/libkvm/kvm_minidump_amd64.cSun Nov 12 01:28:20 2017
(r325731)
+++ head/lib/libkvm/kvm_minidump_amd64.cSun Nov 12 01:36:48 2017
(r325732)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "../../sys/amd64/include/minidump.h"
@@ -59,9 +60,9 @@ _amd64_entry_to_prot(uint64_t entry)
 {
vm_prot_t prot = VM_PROT_READ;
 
-   if ((entry & PG_RW) != 0)
+   if ((entry & AMD64_PG_RW) != 0)
prot |= VM_PROT_WRITE;
-   if ((entry & PG_NX) == 0)
+   if ((entry & AMD64_PG_NX) == 0)
prot |= VM_PROT_EXECUTE;
return prot;
 }
@@ -351,12 +352,12 @@ _amd64_minidump_walk_pages(kvm_t *kd, kvm_walk_pages_c
return (0);
 
for (pdeindex = 0; pdeindex < npdes; pdeindex++) {
-   pd_entry_t pde = _amd64_pde_get(kd, pdeindex);
-   pt_entry_t *ptes;
+   amd64_pde_t pde = _amd64_pde_get(kd, pdeindex);
+   amd64_pte_t *ptes;
u_long i;
 
va = vm->hdr.kernbase + (pdeindex << AMD64_PDRSHIFT);
-   if ((pde & PG_V) == 0)
+   if ((pde & AMD64_PG_V) == 0)
continue;
 
if ((pde & AMD64_PG_PS) != 0) {

svn commit: r325729 - head/lib/libkvm

2017-11-11 Thread Will Andrews
Author: will
Date: Sun Nov 12 00:00:38 2017
New Revision: 325729
URL: https://svnweb.freebsd.org/changeset/base/325729

Log:
  libkvm: fix 'index' shadowing.

Modified:
  head/lib/libkvm/kvm_private.c

Modified: head/lib/libkvm/kvm_private.c
==
--- head/lib/libkvm/kvm_private.c   Sat Nov 11 23:30:58 2017
(r325728)
+++ head/lib/libkvm/kvm_private.c   Sun Nov 12 00:00:38 2017
(r325729)
@@ -261,9 +261,9 @@ popcount_bytes(uint64_t *addr, uint32_t bit0, uint32_t
 }
 
 void *
-_kvm_pmap_get(kvm_t *kd, u_long index, size_t len)
+_kvm_pmap_get(kvm_t *kd, u_long idx, size_t len)
 {
-   off_t off = index * len;
+   off_t off = idx * len;
 
if (off >= kd->pt_sparse_off)
return (NULL);
@@ -699,10 +699,10 @@ again:
 }
 
 int
-_kvm_bitmap_init(struct kvm_bitmap *bm, u_long bitmapsize, u_long *index)
+_kvm_bitmap_init(struct kvm_bitmap *bm, u_long bitmapsize, u_long *idx)
 {
 
-   *index = ULONG_MAX;
+   *idx = ULONG_MAX;
bm->map = calloc(bitmapsize, sizeof *bm->map);
if (bm->map == NULL)
return (0);
@@ -720,23 +720,23 @@ _kvm_bitmap_set(struct kvm_bitmap *bm, u_long pa, unsi
 }
 
 int
-_kvm_bitmap_next(struct kvm_bitmap *bm, u_long *index)
+_kvm_bitmap_next(struct kvm_bitmap *bm, u_long *idx)
 {
u_long first_invalid = bm->size * CHAR_BIT;
 
-   if (*index == ULONG_MAX)
-   *index = 0;
+   if (*idx == ULONG_MAX)
+   *idx = 0;
else
-   (*index)++;
+   (*idx)++;
 
-   /* Find the next valid index. */
-   for (; *index < first_invalid; (*index)++) {
-   unsigned int mask = *index % CHAR_BIT;
-   if ((bm->map[*index * CHAR_BIT] & mask) == 0)
+   /* Find the next valid idx. */
+   for (; *idx < first_invalid; (*idx)++) {
+   unsigned int mask = *idx % CHAR_BIT;
+   if ((bm->map[*idx * CHAR_BIT] & mask) == 0)
break;
}
 
-   return (*index < first_invalid);
+   return (*idx < first_invalid);
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r325728 - head/lib/libkvm

2017-11-11 Thread Will Andrews
Author: will
Date: Sat Nov 11 23:30:58 2017
New Revision: 325728
URL: https://svnweb.freebsd.org/changeset/base/325728

Log:
  libkvm: add kvm_walk_pages API.
  
  This API allows callers to enumerate all known pages, including any
  direct map & kernel map virtual addresses, physical addresses, size,
  offset into the core, & protection configured.
  
  For architectures that support direct map addresses, also generate pages
  for any direct map only addresses that are not associated with kernel
  map addresses.
  
  Fix page size portability issue left behind from previous kvm page table
  lookup interface.
  
  Reviewed by:  jhb
  Sponsored by: Backtrace I/O
  Differential Revision:https://reviews.freebsd.org/D12279

Modified:
  head/lib/libkvm/kvm.c
  head/lib/libkvm/kvm.h
  head/lib/libkvm/kvm_aarch64.h
  head/lib/libkvm/kvm_arm.h
  head/lib/libkvm/kvm_i386.h
  head/lib/libkvm/kvm_minidump_aarch64.c
  head/lib/libkvm/kvm_minidump_amd64.c
  head/lib/libkvm/kvm_minidump_arm.c
  head/lib/libkvm/kvm_minidump_i386.c
  head/lib/libkvm/kvm_minidump_mips.c
  head/lib/libkvm/kvm_mips.h
  head/lib/libkvm/kvm_private.c
  head/lib/libkvm/kvm_private.h

Modified: head/lib/libkvm/kvm.c
==
--- head/lib/libkvm/kvm.c   Sat Nov 11 22:50:14 2017(r325727)
+++ head/lib/libkvm/kvm.c   Sat Nov 11 23:30:58 2017(r325728)
@@ -49,6 +49,7 @@ static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -299,6 +300,10 @@ kvm_close(kvm_t *kd)
free((void *)kd->argv);
if (kd->pt_map != NULL)
free(kd->pt_map);
+   if (kd->page_map != NULL)
+   free(kd->page_map);
+   if (kd->sparse_map != MAP_FAILED)
+   munmap(kd->sparse_map, kd->pt_sparse_size);
free((void *)kd);
 
return (error);
@@ -486,4 +491,14 @@ kvm_native(kvm_t *kd)
if (ISALIVE(kd))
return (1);
return (kd->arch->ka_native(kd));
+}
+
+int
+kvm_walk_pages(kvm_t *kd, kvm_walk_pages_cb_t *cb, void *closure)
+{
+
+   if (kd->arch->ka_walk_pages == NULL)
+   return (0);
+
+   return (kd->arch->ka_walk_pages(kd, cb, closure));
 }

Modified: head/lib/libkvm/kvm.h
==
--- head/lib/libkvm/kvm.h   Sat Nov 11 22:50:14 2017(r325727)
+++ head/lib/libkvm/kvm.h   Sat Nov 11 23:30:58 2017(r325728)
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Default version symbol. */
 #defineVRS_SYM "_version"
@@ -73,7 +74,19 @@ struct kvm_swap {
u_int   ksw_reserved2;
 };
 
+struct kvm_page {
+   unsigned int version;
+   u_long paddr;
+   u_long kmap_vaddr;
+   u_long dmap_vaddr;
+   vm_prot_t prot;
+   u_long offset;
+   size_t len;
+   /* end of version 1 */
+};
+
 #define SWIF_DEV_PREFIX0x0002
+#defineLIBKVM_WALK_PAGES_VERSION   1
 
 __BEGIN_DECLS
 int  kvm_close(kvm_t *);
@@ -104,6 +117,9 @@ ssize_t   kvm_read(kvm_t *, unsigned long, void *, siz
 ssize_t  kvm_read_zpcpu(kvm_t *, unsigned long, void *, size_t, int);
 ssize_t  kvm_read2(kvm_t *, kvaddr_t, void *, size_t);
 ssize_t  kvm_write(kvm_t *, unsigned long, const void *, size_t);
+
+typedef int kvm_walk_pages_cb_t(struct kvm_page *, void *);
+int kvm_walk_pages(kvm_t *, kvm_walk_pages_cb_t *, void *);
 __END_DECLS
 
 #endif /* !_KVM_H_ */

Modified: head/lib/libkvm/kvm_aarch64.h
==
--- head/lib/libkvm/kvm_aarch64.h   Sat Nov 11 22:50:14 2017
(r325727)
+++ head/lib/libkvm/kvm_aarch64.h   Sat Nov 11 23:30:58 2017
(r325728)
@@ -40,7 +40,13 @@ typedef uint64_t aarch64_pte_t;
 #defineAARCH64_PAGE_SIZE   (1 << AARCH64_PAGE_SHIFT)
 #defineAARCH64_PAGE_MASK   (AARCH64_PAGE_SIZE - 1)
 
+/* Source: arm64/include/pte.h */
 #defineAARCH64_ATTR_MASK   0xfff00fff
+#defineAARCH64_ATTR_UXN(1UL << 54)
+#defineAARCH64_ATTR_PXN(1UL << 53)
+#defineAARCH64_ATTR_XN (AARCH64_ATTR_PXN | AARCH64_ATTR_UXN)
+#defineAARCH64_ATTR_AP(x)  ((x) << 6)
+#defineAARCH64_ATTR_AP_RO  (1 << 1)
 
 #defineAARCH64_ATTR_DESCR_MASK 3
 

Modified: head/lib/libkvm/kvm_arm.h
==
--- head/lib/libkvm/kvm_arm.h   Sat Nov 11 22:50:14 2017(r325727)
+++ head/lib/libkvm/kvm_arm.h   Sat Nov 11 23:30:58 2017(r325728)
@@ -53,6 +53,19 @@ typedef uint32_t arm_pt_entry_t;
 #defineARM_L2_S_OFFSET (ARM_L2_S_SIZE - 1)
 #defineARM_L2_S_FRAME  (~ARM_L2_S_OFFSET)
 #defineARM_L2_S_SHIFT  12
+#defineARM_L2_TEX1 0x0080
+#define   

svn commit: r319613 - head/lib/libc/tests/stdlib

2017-06-05 Thread Will Andrews
Author: will
Date: Tue Jun  6 03:40:45 2017
New Revision: 319613
URL: https://svnweb.freebsd.org/changeset/base/319613

Log:
  tsearch_test: Test twalk & add some determinism.

Modified:
  head/lib/libc/tests/stdlib/tsearch_test.c

Modified: head/lib/libc/tests/stdlib/tsearch_test.c
==
--- head/lib/libc/tests/stdlib/tsearch_test.c   Tue Jun  6 03:32:17 2017
(r319612)
+++ head/lib/libc/tests/stdlib/tsearch_test.c   Tue Jun  6 03:40:45 2017
(r319613)
@@ -31,7 +31,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
+static int n_nodes = 0;
+static int n_seen = 0;
+
 /* Validates the integrity of an AVL tree. */
 static inline unsigned int
 tnode_assert(const posix_tnode *n)
@@ -57,6 +61,14 @@ compar(const void *a, const void *b)
return *(int *)a - *(int *)b;
 }
 
+static void
+treewalk(const posix_tnode *node, VISIT v, int level)
+{
+
+   if (v == postorder || v == leaf)
+   n_seen++;
+}
+
 ATF_TC_WITHOUT_HEAD(tsearch_test);
 ATF_TC_BODY(tsearch_test, tc)
 {
@@ -83,11 +95,22 @@ ATF_TC_BODY(tsearch_test, tc)
bool present[NKEYS] = {};
for (int i = 0; i < NKEYS * 10; ++i) {
int key = nrand48(random_state) % NKEYS;
-   switch (nrand48(random_state) % 3) {
+   int sample = i;
+
+   /*
+* Ensure each case is tested at least 10 times, plus a
+* random sampling.
+*/
+   if ((sample % NKEYS) > 3)
+   sample = nrand48(random_state) % 3;
+
+   switch (sample) {
case 0:  /* tdelete(). */
if (present[key]) {
ATF_CHECK(tdelete(&key, &root, compar) != NULL);
present[key] = false;
+   ATF_CHECK(n_nodes > 0);
+   n_nodes--;
} else {
ATF_CHECK_EQ(NULL,
tdelete(&key, &root, compar));
@@ -109,11 +132,16 @@ ATF_TC_BODY(tsearch_test, tc)
ATF_CHECK_EQ(&keys[key], *(int **)tsearch(
&keys[key], &root, compar));
present[key] = true;
+   n_nodes++;
}
break;
}
tnode_assert(root);
}
+
+   /* Walk the tree. */
+   twalk(root, treewalk);
+   ATF_CHECK_EQ(n_nodes, n_seen);
 
/* Remove all entries from the tree. */
for (int key = 0; key < NKEYS; ++key)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305484 - head/sys/boot/efi/loader

2016-09-06 Thread Will Andrews
Author: will
Date: Tue Sep  6 17:58:58 2016
New Revision: 305484
URL: https://svnweb.freebsd.org/changeset/base/305484

Log:
  loader.efi: Bump the staging size to 64M.
  
  This is required on my system, which loads nvidia, vmm, and zfs, and 48M is
  no longer enough for that.  nvidia-driver's recent update increased its size
  by several megabytes.
  
  Reviewed by:  jhb
  MFC after:1 week

Modified:
  head/sys/boot/efi/loader/copy.c

Modified: head/sys/boot/efi/loader/copy.c
==
--- head/sys/boot/efi/loader/copy.c Tue Sep  6 17:22:25 2016
(r305483)
+++ head/sys/boot/efi/loader/copy.c Tue Sep  6 17:58:58 2016
(r305484)
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
 #include "loader_efi.h"
 
 #ifndef EFI_STAGING_SIZE
-#defineEFI_STAGING_SIZE48
+#defineEFI_STAGING_SIZE64
 #endif
 
 #defineSTAGE_PAGES EFI_SIZE_TO_PAGES((EFI_STAGING_SIZE) * 1024 * 
1024)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r302977 - head/tools/build

2016-07-17 Thread Will Andrews
Author: will
Date: Mon Jul 18 02:13:57 2016
New Revision: 302977
URL: https://svnweb.freebsd.org/changeset/base/302977

Log:
  Add my beinstall script.
  
  This is meant to install a new BE (boot environment) given a fully built
  world/kernel.  In addition to installing world and kernel in the new BE,
  it also automatically performs /etc updates (using etcupdate or mergemaster)
  and package updates (using pkg).
  
  Because this process is performed in a new BE, it reduces the need for a
  second reboot.  It also means a reboot into a partially updated system (due
  to install or hardware failure) can't happen.
  
  Inspired by and similar in function to Solaris/illumos-style upgrades.

Added:
  head/tools/build/beinstall.sh   (contents, props changed)

Added: head/tools/build/beinstall.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/beinstall.sh   Mon Jul 18 02:13:57 2016
(r302977)
@@ -0,0 +1,153 @@
+#!/bin/sh
+#
+# Copyright (c) 2016 Will Andrews
+# 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 
+#in this position and unchanged.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+##
+# Install a boot environment using the current FreeBSD source tree.
+# Requires a fully built world & kernel.
+#
+# Non-base tools required: beadm, pkg
+#
+# In a sandbox for the new boot environment, this script also runs etcupdate
+# and pkg upgrade automatically in the sandbox.  Upon successful completion,
+# the system will be ready to boot into the new boot environment.  Upon
+# failure, the target boot environment will be destroyed.  In all cases, the
+# running system is left untouched.
+#
+## Usage:
+# beinstall [optional world/kernel flags e.g. KERNCONF]
+#
+## User modifiable variables - set these in the environment if desired.
+# If not empty, 'pkg upgrade' will be skipped.
+NO_PKG_UPGRADE="${NO_PKG_UPGRADE:-""}"
+# Config updater - 'etcupdate' and 'mergemaster' are supported.  Set to an
+# empty string to skip.
+CONFIG_UPDATER="${CONFIG_UPDATER:-"etcupdate"}"
+# Flags for etcupdate if used.
+ETCUPDATE_FLAGS="${ETCUPDATE_FLAGS:-"-F"}"
+# Flags for mergemaster if used.
+MERGEMASTER_FLAGS="${MERGEMASTER_FLAGS:-"-iFU"}"
+
+
+
+## Constants
+ETCUPDATE_CMD="etcupdate"
+MERGEMASTER_CMD="mergemaster"
+
+## Functions
+cleanup() {
+   [ -z "${cleanup_commands}" ] && return
+   echo "Cleaning up ..."
+   for command in ${cleanup_commands}; do
+   ${command}
+   done
+}
+
+errx() {
+   cleanup
+   echo "error: $*"
+   exit 1
+}
+
+rmdir_be() {
+   chflags -R noschg ${BE_MNTPT}
+   rm -rf ${BE_MNTPT}
+}
+
+cleanup_be() {
+   beadm destroy -F ${BENAME}
+}
+
+update_mergemaster() {
+   mergemaster -m $(pwd) -D ${BE_MNTPT} -t ${BE_MM_ROOT} 
${MERGEMASTER_FLAGS}
+}
+
+update_etcupdate() {
+   etcupdate -s $(pwd) -D ${BE_MNTPT} ${ETCUPDATE_FLAGS} || return $?
+   etcupdate resolve -D ${BE_MNTPT}
+}
+
+
+cleanup_commands=""
+trap 'errx "Interrupt caught"' HUP INT TERM
+
+[ "$(whoami)" != "root" ] && errx "Must be run as root"
+
+[ ! -f "Makefile.inc1" ] && errx "Must be in FreeBSD source tree"
+objdir=$(make -V .OBJDIR 2>/dev/null)
+[ ! -d "${objdir}" ] && errx "Must have built FreeBSD from source tree"
+
+if [ -d .git ] ; then
+commit_time=$(git show --format='%ct'

svn commit: r302976 - head/lib/libkvm

2016-07-17 Thread Will Andrews
Author: will
Date: Mon Jul 18 01:55:25 2016
New Revision: 302976
URL: https://svnweb.freebsd.org/changeset/base/302976

Log:
  libkvm: Improve physical address lookup scaling.
  
  Instead of using a hash table to convert physical page addresses to offsets
  in the sparse page array, cache the number of bits set for each 4MB chunk of
  physical pages.  Upon lookup, find the nearest cached population count, then
  add/subtract the number of bits from that point to the page's PTE bit.
  Then multiply by page size and add to the sparse page map's base offset.
  
  This replaces O(n) worst-case lookup with O(1) (plus a small number of bits
  to scan in the bitmap).  Also, for a 128GB system, a typical kernel core of
  about 8GB will now only require ~4.5MB of RAM for this approach instead of
  ~48MB as with the hash table.
  
  More concretely, /usr/sbin/crashinfo against the same core improves from a
  max RSS of 188MB and wall time of 43.72s (33.25 user 2.94 sys) to 135MB and
  9.43s (2.58 user 1.47 sys).  Running "thread apply all bt" in kgdb has a
  similar RSS improvement, and wall time drops from 4.44s to 1.93s.
  
  Reviewed by:  jhb
  Sponsored by: Backtrace I/O

Modified:
  head/lib/libkvm/kvm.c
  head/lib/libkvm/kvm_minidump_aarch64.c
  head/lib/libkvm/kvm_minidump_amd64.c
  head/lib/libkvm/kvm_minidump_arm.c
  head/lib/libkvm/kvm_minidump_i386.c
  head/lib/libkvm/kvm_minidump_mips.c
  head/lib/libkvm/kvm_private.c
  head/lib/libkvm/kvm_private.h

Modified: head/lib/libkvm/kvm.c
==
--- head/lib/libkvm/kvm.c   Mon Jul 18 01:03:39 2016(r302975)
+++ head/lib/libkvm/kvm.c   Mon Jul 18 01:55:25 2016(r302976)
@@ -283,6 +283,8 @@ kvm_close(kvm_t *kd)
free((void *) kd->argspc);
if (kd->argv != 0)
free((void *)kd->argv);
+   if (kd->pt_map != NULL)
+   free(kd->pt_map);
free((void *)kd);
 
return (0);

Modified: head/lib/libkvm/kvm_minidump_aarch64.c
==
--- head/lib/libkvm/kvm_minidump_aarch64.c  Mon Jul 18 01:03:39 2016
(r302975)
+++ head/lib/libkvm/kvm_minidump_aarch64.c  Mon Jul 18 01:55:25 2016
(r302976)
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
 
 struct vmstate {
struct minidumphdr hdr;
-   struct hpt hpt;
uint64_t *page_map;
 };
 
@@ -67,7 +66,6 @@ _aarch64_minidump_freevtop(kvm_t *kd)
 {
struct vmstate *vm = kd->vmst;
 
-   _kvm_hpt_free(&vm->hpt);
free(vm->page_map);
free(vm);
kd->vmst = NULL;
@@ -77,8 +75,7 @@ static int
 _aarch64_minidump_initvtop(kvm_t *kd)
 {
struct vmstate *vmst;
-   uint64_t *bitmap;
-   off_t off;
+   off_t off, sparse_off;
 
vmst = _kvm_malloc(kd, sizeof(*vmst));
if (vmst == NULL) {
@@ -114,19 +111,12 @@ _aarch64_minidump_initvtop(kvm_t *kd)
/* Skip header and msgbuf */
off = AARCH64_PAGE_SIZE + aarch64_round_page(vmst->hdr.msgbufsize);
 
-   bitmap = _kvm_malloc(kd, vmst->hdr.bitmapsize);
-   if (bitmap == NULL) {
-   _kvm_err(kd, kd->program,
-   "cannot allocate %d bytes for bitmap",
-   vmst->hdr.bitmapsize);
-   return (-1);
-   }
-   if (pread(kd->pmfd, bitmap, vmst->hdr.bitmapsize, off) !=
-   (ssize_t)vmst->hdr.bitmapsize) {
-   _kvm_err(kd, kd->program,
-   "cannot read %d bytes for page bitmap",
-   vmst->hdr.bitmapsize);
-   free(bitmap);
+   /* build physical address lookup table for sparse pages */
+   sparse_off = off + aarch64_round_page(vmst->hdr.bitmapsize) +
+   aarch64_round_page(vmst->hdr.pmapsize);
+   if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off,
+   AARCH64_PAGE_SIZE, sizeof(uint64_t)) == -1) {
+   _kvm_err(kd, kd->program, "cannot load core bitmap");
return (-1);
}
off += aarch64_round_page(vmst->hdr.bitmapsize);
@@ -136,7 +126,6 @@ _aarch64_minidump_initvtop(kvm_t *kd)
_kvm_err(kd, kd->program,
"cannot allocate %d bytes for page_map",
vmst->hdr.pmapsize);
-   free(bitmap);
return (-1);
}
/* This is the end of the dump, savecore may have truncated it. */
@@ -149,15 +138,9 @@ _aarch64_minidump_initvtop(kvm_t *kd)
AARCH64_PAGE_SIZE) {
_kvm_err(kd, kd->program, "cannot read %d bytes for page_map",
vmst->hdr.pmapsize);
-   free(bitmap);
return (-1);
}
-   off += vmst->hdr.pmapsize;
-
-   /* build physical address hash table for sparse pages */
-   _kvm_hpt_init(kd, &vmst->hpt, bitmap, vmst->hdr.bitmapsize, off,
-   AARCH64_PAGE_SIZE, sizeof(*bitmap));
-   free(bi

svn commit: r302975 - head/lib/libkvm

2016-07-17 Thread Will Andrews
Author: will
Date: Mon Jul 18 01:03:39 2016
New Revision: 302975
URL: https://svnweb.freebsd.org/changeset/base/302975

Log:
  libkvm: Bounds check (more) PTE indices.

Modified:
  head/lib/libkvm/kvm_minidump_arm.c
  head/lib/libkvm/kvm_minidump_i386.c
  head/lib/libkvm/kvm_minidump_mips.c

Modified: head/lib/libkvm/kvm_minidump_arm.c
==
--- head/lib/libkvm/kvm_minidump_arm.c  Mon Jul 18 01:02:52 2016
(r302974)
+++ head/lib/libkvm/kvm_minidump_arm.c  Mon Jul 18 01:03:39 2016
(r302975)
@@ -184,6 +184,8 @@ _arm_minidump_kvatop(kvm_t *kd, kvaddr_t
 
if (va >= vm->hdr.kernbase) {
pteindex = (va - vm->hdr.kernbase) >> ARM_PAGE_SHIFT;
+   if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap))
+   goto invalid;
pte = _kvm32toh(kd, ptemap[pteindex]);
if ((pte & ARM_L2_TYPE_MASK) == ARM_L2_TYPE_INV) {
_kvm_err(kd, kd->program,

Modified: head/lib/libkvm/kvm_minidump_i386.c
==
--- head/lib/libkvm/kvm_minidump_i386.c Mon Jul 18 01:02:52 2016
(r302974)
+++ head/lib/libkvm/kvm_minidump_i386.c Mon Jul 18 01:03:39 2016
(r302975)
@@ -162,6 +162,8 @@ _i386_minidump_vatop_pae(kvm_t *kd, kvad
 
if (va >= vm->hdr.kernbase) {
pteindex = (va - vm->hdr.kernbase) >> I386_PAGE_SHIFT;
+   if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap))
+   goto invalid;
pte = le64toh(ptemap[pteindex]);
if ((pte & I386_PG_V) == 0) {
_kvm_err(kd, kd->program,
@@ -207,6 +209,8 @@ _i386_minidump_vatop(kvm_t *kd, kvaddr_t
 
if (va >= vm->hdr.kernbase) {
pteindex = (va - vm->hdr.kernbase) >> I386_PAGE_SHIFT;
+   if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap))
+   goto invalid;
pte = le32toh(ptemap[pteindex]);
if ((pte & I386_PG_V) == 0) {
_kvm_err(kd, kd->program,

Modified: head/lib/libkvm/kvm_minidump_mips.c
==
--- head/lib/libkvm/kvm_minidump_mips.c Mon Jul 18 01:02:52 2016
(r302974)
+++ head/lib/libkvm/kvm_minidump_mips.c Mon Jul 18 01:03:39 2016
(r302975)
@@ -221,9 +221,13 @@ _mips_minidump_kvatop(kvm_t *kd, kvaddr_
if (va >= vm->hdr.kernbase) {
pteindex = (va - vm->hdr.kernbase) >> MIPS_PAGE_SHIFT;
if (vm->pte_size == 64) {
+   if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap64))
+   goto invalid;
pte = _kvm64toh(kd, ptemap64[pteindex]);
a = MIPS64_PTE_TO_PA(pte);
} else {
+   if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap32))
+   goto invalid;
pte = _kvm32toh(kd, ptemap32[pteindex]);
a = MIPS32_PTE_TO_PA(pte);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r302974 - head/lib/libkvm

2016-07-17 Thread Will Andrews
Author: will
Date: Mon Jul 18 01:02:52 2016
New Revision: 302974
URL: https://svnweb.freebsd.org/changeset/base/302974

Log:
  libkvm: Put private kvm routines in kvm_private.c.

Added:
  head/lib/libkvm/kvm_private.c   (contents, props changed)
Modified:
  head/lib/libkvm/Makefile
  head/lib/libkvm/kvm.c

Modified: head/lib/libkvm/Makefile
==
--- head/lib/libkvm/MakefileSun Jul 17 21:49:53 2016(r302973)
+++ head/lib/libkvm/MakefileMon Jul 18 01:02:52 2016(r302974)
@@ -11,7 +11,7 @@ CFLAGS+=-DLIBC_SCCS -I${.CURDIR}
 WARNS?=3
 
 SRCS=  kvm.c kvm_cptime.c kvm_getloadavg.c \
-   kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c kvm_vnet.c \
+   kvm_getswapinfo.c kvm_pcpu.c kvm_private.c kvm_proc.c kvm_vnet.c \
kvm_minidump_aarch64.c \
kvm_amd64.c kvm_minidump_amd64.c \
kvm_arm.c kvm_minidump_arm.c \

Modified: head/lib/libkvm/kvm.c
==
--- head/lib/libkvm/kvm.c   Sun Jul 17 21:49:53 2016(r302973)
+++ head/lib/libkvm/kvm.c   Mon Jul 18 01:02:52 2016(r302974)
@@ -66,114 +66,12 @@ static char sccsid[] = "@(#)kvm.c  8.2 (B
 
 SET_DECLARE(kvm_arch, struct kvm_arch);
 
-/* from src/lib/libc/gen/nlist.c */
-int __fdnlist(int, struct nlist *);
-
-static int
-kvm_fdnlist(kvm_t *kd, struct kvm_nlist *list)
-{
-   kvaddr_t addr;
-   int error, nfail;
-
-   if (kd->resolve_symbol == NULL) {
-   struct nlist *nl;
-   int count, i;
-
-   for (count = 0; list[count].n_name != NULL &&
-list[count].n_name[0] != '\0'; count++)
-   ;
-   nl = calloc(count + 1, sizeof(*nl));
-   for (i = 0; i < count; i++)
-   nl[i].n_name = list[i].n_name;
-   nfail = __fdnlist(kd->nlfd, nl);
-   for (i = 0; i < count; i++) {
-   list[i].n_type = nl[i].n_type;
-   list[i].n_value = nl[i].n_value;
-   }
-   free(nl);
-   return (nfail);
-   }
-
-   nfail = 0;
-   while (list->n_name != NULL && list->n_name[0] != '\0') {
-   error = kd->resolve_symbol(list->n_name, &addr);
-   if (error != 0) {
-   nfail++;
-   list->n_value = 0;
-   list->n_type = 0;
-   } else {
-   list->n_value = addr;
-   list->n_type = N_DATA | N_EXT;
-   }
-   list++;
-   }
-   return (nfail);
-}
-
 char *
 kvm_geterr(kvm_t *kd)
 {
return (kd->errbuf);
 }
 
-#include 
-
-/*
- * Report an error using printf style arguments.  "program" is kd->program
- * on hard errors, and 0 on soft errors, so that under sun error emulation,
- * only hard errors are printed out (otherwise, programs like gdb will
- * generate tons of error messages when trying to access bogus pointers).
- */
-void
-_kvm_err(kvm_t *kd, const char *program, const char *fmt, ...)
-{
-   va_list ap;
-
-   va_start(ap, fmt);
-   if (program != NULL) {
-   (void)fprintf(stderr, "%s: ", program);
-   (void)vfprintf(stderr, fmt, ap);
-   (void)fputc('\n', stderr);
-   } else
-   (void)vsnprintf(kd->errbuf,
-   sizeof(kd->errbuf), fmt, ap);
-
-   va_end(ap);
-}
-
-void
-_kvm_syserr(kvm_t *kd, const char *program, const char *fmt, ...)
-{
-   va_list ap;
-   int n;
-
-   va_start(ap, fmt);
-   if (program != NULL) {
-   (void)fprintf(stderr, "%s: ", program);
-   (void)vfprintf(stderr, fmt, ap);
-   (void)fprintf(stderr, ": %s\n", strerror(errno));
-   } else {
-   char *cp = kd->errbuf;
-
-   (void)vsnprintf(cp, sizeof(kd->errbuf), fmt, ap);
-   n = strlen(cp);
-   (void)snprintf(&cp[n], sizeof(kd->errbuf) - n, ": %s",
-   strerror(errno));
-   }
-   va_end(ap);
-}
-
-void *
-_kvm_malloc(kvm_t *kd, size_t n)
-{
-   void *p;
-
-   if ((p = calloc(n, sizeof(char))) == NULL)
-   _kvm_err(kd, kd->program, "can't allocate %zu bytes: %s",
-n, strerror(errno));
-   return (p);
-}
-
 static int
 _kvm_read_kernel_ehdr(kvm_t *kd)
 {
@@ -210,166 +108,6 @@ _kvm_read_kernel_ehdr(kvm_t *kd)
}
 }
 
-int
-_kvm_probe_elf_kernel(kvm_t *kd, int class, int machine)
-{
-
-   return (kd->nlehdr.e_ident[EI_CLASS] == class &&
-   kd->nlehdr.e_type == ET_EXEC &&
-   kd->nlehdr.e_machine == machine);
-}
-
-int
-_kvm_is_minidump(kvm_t *kd)
-{
-   char minihdr[8];
-
-   if (kd->rawdump)
-   return (0);
-   if (pread(kd->pmfd, &minihdr, 8, 0) == 8 &&
-   memcmp(&minihdr, "minidump", 8) == 0)
-  

svn commit: r281442 - head/sys/kern

2015-04-11 Thread Will Andrews
Author: will
Date: Sat Apr 11 18:51:41 2015
New Revision: 281442
URL: https://svnweb.freebsd.org/changeset/base/281442

Log:
  uiomove_object_page(): Avoid instantiating pages in sparse regions on reads.
  
  Check whether the page being requested is either resident or on swap.  If
  not, read from the zero_region instead of instantiating an unnecessary page.
  
  This avoids consuming memory for sparse files on tmpfs, when they are read
  by applications that do not use SEEK_HOLE/SEEK_DATA (which is most of them).
  
  Reviewed by:  kib
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sys/kern/uipc_shm.c

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cSat Apr 11 18:45:22 2015(r281441)
+++ head/sys/kern/uipc_shm.cSat Apr 11 18:51:41 2015(r281442)
@@ -163,6 +163,17 @@ uiomove_object_page(vm_object_t obj, siz
VM_OBJECT_WLOCK(obj);
 
/*
+* Read I/O without either a corresponding resident page or swap
+* page: use zero_region.  This is intended to avoid instantiating
+* pages on read from a sparse region.
+*/
+   if (uio->uio_rw == UIO_READ && vm_page_lookup(obj, idx) == NULL &&
+   !vm_pager_has_page(obj, idx, NULL, NULL)) {
+   VM_OBJECT_WUNLOCK(obj);
+   return (uiomove(__DECONST(void *, zero_region), len, uio));
+   }
+
+   /*
 * Parallel reads of the page content from disk are prevented
 * by exclusive busy.
 *
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278321 - head/sys/dev/ipmi

2015-02-13 Thread Will Andrews
On Fri, Feb 06, 2015 at 12:00:02PM -0500, John Baldwin wrote:
> I think we should further change this to only allow the watchdog to be used 
> with KCS and SMIC so that watchdog requests never sleep.  I think that we 
> could then revert r272366 as to my knowledge this was the only watchdog 
> driver 
> that could sleep?

No objection from me.  :)

-- 
wca


pgptWinix1T4x.pgp
Description: PGP signature


Re: svn commit: r278040 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-02-01 Thread Will Andrews
On Sunday, February 1, 2015, Davide Italiano  wrote:

> On Mon, Feb 2, 2015 at 1:17 AM, Steven Hartland  > wrote:
> > Author: smh
> > Date: Mon Feb  2 00:17:36 2015
> > New Revision: 278040
> > URL: https://svnweb.freebsd.org/changeset/base/278040
> >
> > Log:
> >   Prevent inlining txg_quiesce
> >
> >   This allows dtrace to monitor the calls to txg_quiesce which can be
> really
> >   helpful.
> >
> >   Also standardise __noinline order for arc_kmem_reap_now.
> >
> >   Sponsored by: Multiplay
> >
> >
>
> I found this while I was at iXsystems, trying to port Richard Elling's
> arc statistics utility to FreeBSD.
> I do not disagree with the change in theory, but I never committed
> this because I was worried of performance penalty.
> Last time I checked Solaris/Illumos actually do not inline this
> function without any particular directive (I guess this is mostly due
> to difference in toolchain, in particular in the compiler), so it
> shouldn't be a big deal, but if you have time, do you mind to check
> the penalty introduced, if any, is negligible?
>

It should be negligible. The function is only called once per txg, which
generally is only supposed to happen about 1-0.2Hz.

--Will.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r277651 - head/sys/vm

2015-01-24 Thread Will Andrews
On Sat, Jan 24, 2015 at 11:34:10AM -0800, Garrett Cooper wrote:
> Could you please add a kernel option to set the default from
> 0 to 1, or provide a tunable so the value could be set in loader.conf?

Hi Garrett,

The sysctl is configured as a CTLFLAG_RWTUN, so it can be configured in
loader.conf or sysctl.conf already.  I don't see a need for an option.

-- 
wca


pgp6jx7C02b3r.pgp
Description: PGP signature


svn commit: r277651 - head/sys/vm

2015-01-24 Thread Will Andrews
Author: will
Date: Sat Jan 24 17:32:45 2015
New Revision: 277651
URL: https://svnweb.freebsd.org/changeset/base/277651

Log:
  Add vm.panic_on_oom sysctl, which enables those who would rather panic than
  kill a process, when the system runs out of memory.  Defaults to off.
  
  Usually, this is most useful when the OOM condition is due to mismanagement
  of memory, on a system where the applications in question don't respond well
  to being killed.
  
  In theory, if the system is properly managed, it shouldn't be possible to
  hit this condition. If it does, the panic can be more desirable for some
  users (since it can be a good means of finding the root cause) rather than
  killing the largest process and continuing on its merry way.
  
  As kib@ mentions in the differential, there is also protect(1), which uses
  procctl(PROC_SPROTECT) to ensure that some processes are immune.  However,
  a panic approach is still useful in some environments.  This is primarily
  intended as a development/debugging tool.
  
  Differential Revision:D1627
  Reviewed by:  kib
  MFC after:1 week

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cSat Jan 24 17:11:11 2015(r277650)
+++ head/sys/vm/vm_pageout.cSat Jan 24 17:32:45 2015(r277651)
@@ -180,6 +180,12 @@ static int vm_swap_enabled = 1;
 static int vm_swap_idle_enabled = 0;
 #endif
 
+static int vm_panic_on_oom = 0;
+
+SYSCTL_INT(_vm, OID_AUTO, panic_on_oom,
+   CTLFLAG_RWTUN, &vm_panic_on_oom, 0,
+   "panic on out of memory instead of killing the largest process");
+
 SYSCTL_INT(_vm, OID_AUTO, pageout_wakeup_thresh,
CTLFLAG_RW, &vm_pageout_wakeup_thresh, 0,
"free page threshold for waking up the pageout daemon");
@@ -1585,6 +1591,8 @@ vm_pageout_oom(int shortage)
}
sx_sunlock(&allproc_lock);
if (bigproc != NULL) {
+   if (vm_panic_on_oom != 0)
+   panic("out of swap space");
PROC_LOCK(bigproc);
killproc(bigproc, "out of swap space");
sched_nice(bigproc, PRIO_MIN);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277650 - head/etc/mtree

2015-01-24 Thread Will Andrews
Author: will
Date: Sat Jan 24 17:11:11 2015
New Revision: 277650
URL: https://svnweb.freebsd.org/changeset/base/277650

Log:
  Add tests/etc/rc.d to mtree.
  
  Submitted by: stefanf
  MFC after:1 week
  MFC with: 277627

Modified:
  head/etc/mtree/BSD.tests.dist

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Sat Jan 24 16:59:38 2015
(r277649)
+++ head/etc/mtree/BSD.tests.dist   Sat Jan 24 17:11:11 2015
(r277650)
@@ -52,6 +52,8 @@
 ..
 ..
 etc
+rc.d
+..
 ..
 games
 ..
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277629 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-01-23 Thread Will Andrews
Author: will
Date: Sat Jan 24 00:43:02 2015
New Revision: 277629
URL: https://svnweb.freebsd.org/changeset/base/277629

Log:
  When creating or updating a node, use vfs_timestamp() for "now" instead
  of gethrestime(), to allow the administrator to decide the appropriate
  timestamp precision instead of always using nanosecond precision.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sat Jan 
24 00:40:42 2015(r277628)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sat Jan 
24 00:43:02 2015(r277629)
@@ -794,7 +794,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, d
gen = vap->va_nblocks;  /* ditto */
} else {
obj = 0;
-   gethrestime(&now);
+   vfs_timestamp(&now);
gen = dmu_tx_get_txg(tx);
}
 
@@ -1426,7 +1426,7 @@ zfs_tstamp_update_setup(znode_t *zp, uin
 {
timestruc_t now;
 
-   gethrestime(&now);
+   vfs_timestamp(&now);
 
if (have_tx) {  /* will sa_bulk_update happen really soon? */
zp->z_atime_dirty = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277627 - in head/etc/tests: . rc.d

2015-01-23 Thread Will Andrews
Author: will
Date: Sat Jan 24 00:37:41 2015
New Revision: 277627
URL: https://svnweb.freebsd.org/changeset/base/277627

Log:
  Add routing_test:static_ipv6_loopback_route_for_each_fib.
  It tests that all FIBs get a static IPv6 loopback route.
  
  Submitted by: asomers
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1048456 on 2014/03/13
1114523 on 2015/01/23

Added:
  head/etc/tests/rc.d/
  head/etc/tests/rc.d/Makefile   (contents, props changed)
  head/etc/tests/rc.d/routing_test.sh   (contents, props changed)
Modified:
  head/etc/tests/Makefile

Modified: head/etc/tests/Makefile
==
--- head/etc/tests/Makefile Sat Jan 24 00:35:49 2015(r277626)
+++ head/etc/tests/Makefile Sat Jan 24 00:37:41 2015(r277627)
@@ -7,4 +7,6 @@ TESTSDIR=   ${TESTSBASE}/etc
 .PATH: ${.CURDIR:H:H}/tests
 KYUAFILE=  yes
 
+TESTS_SUBDIRS+=rc.d
+
 .include 

Added: head/etc/tests/rc.d/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/etc/tests/rc.d/MakefileSat Jan 24 00:37:41 2015
(r277627)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR=  ${TESTSBASE}/etc/rc.d
+
+ATF_TESTS_SH+= routing_test
+
+.include 

Added: head/etc/tests/rc.d/routing_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/etc/tests/rc.d/routing_test.sh Sat Jan 24 00:37:41 2015
(r277627)
@@ -0,0 +1,138 @@
+#
+#  Copyright (c) 2014 Spectra Logic Corporation
+#  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,
+# without modification.
+#  2. Redistributions in binary form must reproduce at minimum a disclaimer
+# substantially similar to the "NO WARRANTY" disclaimer below
+# ("Disclaimer") and any redistribution must be conditioned upon
+# including a substantially similar Disclaimer requirement for further
+# binary redistribution.
+# 
+#  NO WARRANTY
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#  HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+# 
+#  Authors: Alan Somers (Spectra Logic Corporation)
+#
+# $FreeBSD$
+
+atf_test_case static_ipv6_loopback_route_for_each_fib cleanup
+static_ipv6_loopback_route_for_each_fib_head()
+{
+   atf_set "descr" "Every FIB should have a static IPv6 loopback route"
+   atf_set "require.user" "root"
+   atf_set "require.config" "fibs"
+   atf_set "require.progs" "sysrc"
+}
+static_ipv6_loopback_route_for_each_fib_body()
+{
+   # Configure the TAP interface to use an RFC5737 nonrouteable address
+   # and a non-default fib
+   ADDR="192.0.2.2"
+   SUBNET="192.0.2.0"
+   MASK="24"
+
+   # Check system configuration
+   if [ 0 != `sysctl -n net.add_addr_allfibs` ]; then
+   atf_skip "This test requires net.add_addr_allfibs=0"
+   fi
+
+   get_fibs 1
+   get_tap
+   
+   # Configure a TAP interface in /etc/rc.conf.  Register the sysrc
+   # variable for cleanup.
+   echo "ifconfig_${TAP}" >> "sysrc_vars_to_cleanup"
+   sysrc ifconfig_${TAP}="${ADDR}/${MASK} fib ${FIB0}"
+
+   # Start the interface
+   service netif start ${TAP}
+   # Check for an IPv6 loopback route
+   setfib ${FIB0} netstat -rn -f inet6 | grep -q "^::1.*lo0$"
+   if [ 0 -eq $? ]; then
+   atf_pass
+   else
+   setfib ${FIB0} netstat -rn -f inet6
+   atf_fail "Did not find an IPv6 loopback route"
+   fi
+}
+static_ipv6_loopback_route_for_each_fib_cleanup()
+{
+   cleanup_sysrc
+   cleanup_tap
+}
+
+atf_init_test_cases()
+{
+   atf_add_test_case static_ipv6_loopback_route_for_each_fib
+}
+
+# Looks up one or more fibs from the configuration data and validates them.
+# Returns the results in the env varilables FIB0, FIB1, etc.
+# parameter numfibsT

svn commit: r277624 - head/usr.sbin/config

2015-01-23 Thread Will Andrews
Author: will
Date: Sat Jan 24 00:04:34 2015
New Revision: 277624
URL: https://svnweb.freebsd.org/changeset/base/277624

Log:
  Bump config(8) minor version for r277567.
  
  Config files built using this version that take advantage of the bugfix
  won't be buildable using older config(8).
  
  Submitted by: imp
  MFC after:1 week
  MFC with: 277567

Modified:
  head/usr.sbin/config/configvers.h

Modified: head/usr.sbin/config/configvers.h
==
--- head/usr.sbin/config/configvers.h   Fri Jan 23 23:54:55 2015
(r277623)
+++ head/usr.sbin/config/configvers.h   Sat Jan 24 00:04:34 2015
(r277624)
@@ -49,5 +49,5 @@
  *
  * $FreeBSD$
  */
-#defineCONFIGVERS  600013
+#defineCONFIGVERS  600014
 #defineMAJOR_VERS(x)   ((x) / 10)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277622 - head/sys/boot/i386/libfirewire

2015-01-23 Thread Will Andrews
Author: will
Date: Fri Jan 23 23:53:56 2015
New Revision: 277622
URL: https://svnweb.freebsd.org/changeset/base/277622

Log:
  Fix panic in firewire and creation of invalid config ROM.
  (This change was supposed to be included in r277508.)
  
  sys/boot/i386/libfirewire/firewire.c:
Fix configuration ROM generation count wrapping logic
so that the generation count is never outside of
allowed limits (0x2 -> 0xF).
  
  Submitted by: gibbs
  MFC after:1 week
  MFC with: 277508
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1110685 on 2015/01/05

Modified:
  head/sys/boot/i386/libfirewire/firewire.c

Modified: head/sys/boot/i386/libfirewire/firewire.c
==
--- head/sys/boot/i386/libfirewire/firewire.c   Fri Jan 23 23:52:33 2015
(r277621)
+++ head/sys/boot/i386/libfirewire/firewire.c   Fri Jan 23 23:53:56 2015
(r277622)
@@ -233,7 +233,8 @@ fw_init_crom(struct fwohci_softc *sc)
src->businfo.cyc_clk_acc = 100;
src->businfo.max_rec = sc->maxrec;
src->businfo.max_rom = MAXROM_4;
-   src->businfo.generation = 1;
+#define FW_GENERATION_CHANGEABLE 2
+   src->businfo.generation = FW_GENERATION_CHANGEABLE;
src->businfo.link_spd = sc->speed;
 
src->businfo.eui64.hi = sc->eui.hi;
@@ -313,11 +314,14 @@ fw_crom(struct fwohci_softc *sc)
src = &sc->crom_src_buf->src;
crom_load(src, (uint32_t *)newrom, CROMSIZE);
if (bcmp(newrom, sc->config_rom, CROMSIZE) != 0) {
-   /* bump generation and reload */
-   src->businfo.generation ++;
-   /* generation must be between 0x2 and 0xF */
+   /* Bump generation and reload. */
+   src->businfo.generation++;
+
+   /* Handle generation count wraps. */
if (src->businfo.generation < 2)
-   src->businfo.generation ++;
+   src->businfo.generation = 2;
+
+   /* Recalculate CRC to account for generation change. */
crom_load(src, (uint32_t *)newrom, CROMSIZE);
bcopy(newrom, (void *)sc->config_rom, CROMSIZE);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r277570 - head/usr.bin/vmstat

2015-01-23 Thread Will Andrews
On Fri, Jan 23, 2015 at 11:23:57AM -0800, Davide Italiano wrote:
> What's the rationale behind this change?

The rationale was to match the clock used to the name (and implied intent)
of the variables used to store/manipulate the data.

It's possible that 'uptime' is entirely the wrong term in vmstat, in which
case the naming used elsewhere in vmstat needs to be changed too.

-- 
wca


pgpCQ9x7viBbG.pgp
Description: PGP signature


svn commit: r277571 - head/usr.bin/vmstat

2015-01-23 Thread Will Andrews
Author: will
Date: Fri Jan 23 16:21:31 2015
New Revision: 277571
URL: https://svnweb.freebsd.org/changeset/base/277571

Log:
  Use clock_gettime to measure the time that we spent asleep during
  "vmstat -i" instead of assuming it's what we asked for.
  
  Submitted by: asomers
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1066751 on 2014/06/04

Modified:
  head/usr.bin/vmstat/vmstat.c

Modified: head/usr.bin/vmstat/vmstat.c
==
--- head/usr.bin/vmstat/vmstat.cFri Jan 23 16:18:39 2015
(r277570)
+++ head/usr.bin/vmstat/vmstat.cFri Jan 23 16:21:31 2015
(r277571)
@@ -163,7 +163,7 @@ static void printhdr(int, u_long);
 static voidusage(void);
 
 static longpct(long, long);
-static longgetuptime(void);
+static long long   getuptime(void);
 
 static char   **getdrivedata(char **);
 
@@ -406,14 +406,15 @@ getdrivedata(char **argv)
return(argv);
 }
 
-static long
+/* Return system uptime in nanoseconds */
+static long long
 getuptime(void)
 {
struct timespec sp;
 
(void)clock_gettime(CLOCK_UPTIME, &sp);
 
-   return(sp.tv_sec);
+   return((long long)sp.tv_sec * 10LL + sp.tv_nsec);
 }
 
 static void
@@ -654,7 +655,7 @@ dovmstat(unsigned int interval, int reps
u_long cpumask;
int rate_adj;
 
-   uptime = getuptime();
+   uptime = getuptime() / 10LL;
halfuptime = uptime / 2;
rate_adj = 1;
ncpus = 1;
@@ -1192,7 +1193,7 @@ read_intrcnts(unsigned long **intrcnts)
 static void
 print_intrcnts(unsigned long *intrcnts, unsigned long *old_intrcnts,
char *intrnames, unsigned int nintr,
-   size_t istrnamlen, unsigned long long period)
+   size_t istrnamlen, long long period_ms)
 {
unsigned long *intrcnt, *old_intrcnt;
uint64_t inttotal, old_inttotal, total_count, total_rate;
@@ -1207,7 +1208,7 @@ print_intrcnts(unsigned long *intrcnts, 
unsigned long count, rate;
 
count = *intrcnt - *old_intrcnt;
-   rate = (count * 1000 + period/2) / period;
+   rate = (count * 1000 + period_ms / 2) / period_ms;
(void)printf("%-*s %20lu %10lu\n", (int)istrnamlen,
intrname, count, rate);
}
@@ -1216,7 +1217,7 @@ print_intrcnts(unsigned long *intrcnts, 
old_inttotal += *old_intrcnt++;
}
total_count = inttotal - old_inttotal;
-   total_rate = (total_count * 1000 + period/2) / period;
+   total_rate = (total_count * 1000 + period_ms / 2) / period_ms;
(void)printf("%-*s %20" PRIu64 " %10" PRIu64 "\n", (int)istrnamlen,
"Total", total_count, total_rate);
 }
@@ -1225,10 +1226,9 @@ static void
 dointr(unsigned int interval, int reps)
 {
unsigned long *intrcnts;
-   unsigned long long uptime, period;
+   long long uptime, period_ms;
unsigned long *old_intrcnts = NULL;
size_t clen, inamlen, istrnamlen;
-   unsigned int rep;
char *intrnames, *intrname;
 
uptime = getuptime();
@@ -1265,10 +1265,10 @@ dointr(unsigned int interval, int reps)
 * Loop reps times printing differential interrupt counts.  If reps is
 * zero, then run just once, printing total counts
 */
-   period = uptime * 1000;
+   period_ms = uptime / 100;
while(1) {
-   char *intrname;
unsigned int nintr;
+   long long old_uptime;
 
nintr = read_intrcnts(&intrcnts);
/* 
@@ -1282,14 +1282,16 @@ dointr(unsigned int interval, int reps)
}
 
print_intrcnts(intrcnts, old_intrcnts, intrnames, nintr,
-   istrnamlen, period);
+   istrnamlen, period_ms);
 
free(old_intrcnts);
old_intrcnts = intrcnts;
if (reps >= 0 && --reps <= 0)
break;
usleep(interval * 1000);
-   period = interval;
+   old_uptime = uptime;
+   uptime = getuptime();
+   period_ms = (uptime - old_uptime) / 100;
}
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277570 - head/usr.bin/vmstat

2015-01-23 Thread Will Andrews
Author: will
Date: Fri Jan 23 16:18:39 2015
New Revision: 277570
URL: https://svnweb.freebsd.org/changeset/base/277570

Log:
  Use CLOCK_UPTIME to get the uptime instead of CLOCK_MONOTONIC.
  
  Submitted by: asomers
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1066740 on 2014/06/04

Modified:
  head/usr.bin/vmstat/vmstat.c

Modified: head/usr.bin/vmstat/vmstat.c
==
--- head/usr.bin/vmstat/vmstat.cFri Jan 23 16:15:55 2015
(r277569)
+++ head/usr.bin/vmstat/vmstat.cFri Jan 23 16:18:39 2015
(r277570)
@@ -411,7 +411,7 @@ getuptime(void)
 {
struct timespec sp;
 
-   (void)clock_gettime(CLOCK_MONOTONIC, &sp);
+   (void)clock_gettime(CLOCK_UPTIME, &sp);
 
return(sp.tv_sec);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277569 - head/usr.bin/vmstat

2015-01-23 Thread Will Andrews
Author: will
Date: Fri Jan 23 16:15:55 2015
New Revision: 277569
URL: https://svnweb.freebsd.org/changeset/base/277569

Log:
  Make "vmstat -i" respect the -c  and -i  options together.
  
  Submitted by: asomers
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1066735 on 2014/06/04

Modified:
  head/usr.bin/vmstat/vmstat.c

Modified: head/usr.bin/vmstat/vmstat.c
==
--- head/usr.bin/vmstat/vmstat.cFri Jan 23 16:05:47 2015
(r277568)
+++ head/usr.bin/vmstat/vmstat.cFri Jan 23 16:15:55 2015
(r277569)
@@ -148,7 +148,7 @@ static void cpustats(void);
 static voidpcpustats(int, u_long, int);
 static voiddevstats(void);
 static voiddoforkst(void);
-static voiddointr(void);
+static voiddointr(unsigned int, int);
 static voiddosum(void);
 static voiddovmstat(unsigned int, int);
 static voiddomemstat_malloc(void);
@@ -325,7 +325,7 @@ retry_nlist:
dotimes();
 #endif
if (todo & INTRSTAT)
-   dointr();
+   dointr(interval, reps);
if (todo & VMSTAT)
dovmstat(interval, reps);
exit(0);
@@ -1165,61 +1165,132 @@ pcpustats(int ncpus, u_long cpumask, int
}
 }
 
-static void
-dointr(void)
+static unsigned int
+read_intrcnts(unsigned long **intrcnts)
 {
-   unsigned long *intrcnt, uptime;
-   uint64_t inttotal;
-   size_t clen, inamlen, intrcntlen, istrnamlen;
-   unsigned int i, nintr;
-   char *intrname, *tintrname;
+   size_t intrcntlen;
 
-   uptime = getuptime();
if (kd != NULL) {
kread(X_SINTRCNT, &intrcntlen, sizeof(intrcntlen));
-   kread(X_SINTRNAMES, &inamlen, sizeof(inamlen));
-   if ((intrcnt = malloc(intrcntlen)) == NULL ||
-   (intrname = malloc(inamlen)) == NULL)
+   if ((*intrcnts = malloc(intrcntlen)) == NULL)
err(1, "malloc()");
-   kread(X_INTRCNT, intrcnt, intrcntlen);
-   kread(X_INTRNAMES, intrname, inamlen);
+   kread(X_INTRCNT, *intrcnts, intrcntlen);
} else {
-   for (intrcnt = NULL, intrcntlen = 1024; ; intrcntlen *= 2) {
-   if ((intrcnt = reallocf(intrcnt, intrcntlen)) == NULL)
+   for (*intrcnts = NULL, intrcntlen = 1024; ; intrcntlen *= 2) {
+   *intrcnts = reallocf(*intrcnts, intrcntlen);
+   if (*intrcnts == NULL)
err(1, "reallocf()");
if (mysysctl("hw.intrcnt",
-   intrcnt, &intrcntlen, NULL, 0) == 0)
+   *intrcnts, &intrcntlen, NULL, 0) == 0)
break;
}
-   for (intrname = NULL, inamlen = 1024; ; inamlen *= 2) {
-   if ((intrname = reallocf(intrname, inamlen)) == NULL)
+   }
+
+   return (intrcntlen / sizeof(unsigned long));
+}
+
+static void
+print_intrcnts(unsigned long *intrcnts, unsigned long *old_intrcnts,
+   char *intrnames, unsigned int nintr,
+   size_t istrnamlen, unsigned long long period)
+{
+   unsigned long *intrcnt, *old_intrcnt;
+   uint64_t inttotal, old_inttotal, total_count, total_rate;
+   char* intrname;
+   unsigned int i;
+
+   inttotal = 0;
+   old_inttotal = 0;
+   intrname = intrnames;
+   for (i = 0, intrcnt=intrcnts, old_intrcnt=old_intrcnts; i < nintr; i++) 
{
+   if (intrname[0] != '\0' && (*intrcnt != 0 || aflag)) {
+   unsigned long count, rate;
+
+   count = *intrcnt - *old_intrcnt;
+   rate = (count * 1000 + period/2) / period;
+   (void)printf("%-*s %20lu %10lu\n", (int)istrnamlen,
+   intrname, count, rate);
+   }
+   intrname += strlen(intrname) + 1;
+   inttotal += *intrcnt++;
+   old_inttotal += *old_intrcnt++;
+   }
+   total_count = inttotal - old_inttotal;
+   total_rate = (total_count * 1000 + period/2) / period;
+   (void)printf("%-*s %20" PRIu64 " %10" PRIu64 "\n", (int)istrnamlen,
+   "Total", total_count, total_rate);
+}
+
+static void
+dointr(unsigned int interval, int reps)
+{
+   unsigned long *intrcnts;
+   unsigned long long uptime, period;
+   unsigned long *old_intrcnts = NULL;
+   size_t clen, inamlen, istrnamlen;
+   unsigned int rep;
+   char *intrnames, *intrname;
+
+   uptime = getuptime();
+
+   /* Get the names of each interrupt source */
+   if (kd != NULL) {
+   kread(X_SINTRNAMES, &inamlen, sizeof(inamlen));
+   if ((intrnames = malloc(inamlen)) == NULL)
+   err(1, "malloc()");
+   kread(X_INTRNAMES, intrnames, inamlen);
+

svn commit: r277567 - head/usr.sbin/config

2015-01-23 Thread Will Andrews
Author: will
Date: Fri Jan 23 16:03:02 2015
New Revision: 277567
URL: https://svnweb.freebsd.org/changeset/base/277567

Log:
  Allow lists for "nooption" and "nooptions" keywords.
  
  usr.sbin/config/config.y
According to config(5), the "device", "devices",
"nodevice", "nodevices", "option", "options",
"nooption", and "nooptions" keywords can all take a
comma-separated list of values.  However, the yacc code
did not allow lists for "nooption" and "nooptions", only
single values.  This commit fixes the yacc code to allow
comma separated values for all the above keywords.
  
  Submitted by: asomers
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1095296 on 2014/10/07

Modified:
  head/usr.sbin/config/config.y

Modified: head/usr.sbin/config/config.y
==
--- head/usr.sbin/config/config.y   Fri Jan 23 15:55:03 2015
(r277566)
+++ head/usr.sbin/config/config.y   Fri Jan 23 16:03:02 2015
(r277567)
@@ -178,7 +178,7 @@ Config_spec:
  } |
OPTIONS Opt_list
|
-   NOOPTION Save_id { rmopt_schedule(&opt, $2); } |
+   NOOPTION NoOpt_list |
MAKEOPTIONS Mkopt_list
|
NOMAKEOPTION Save_id { rmopt_schedule(&mkopt, $2); } |
@@ -225,6 +225,11 @@ Opt_list:
Option
;
 
+NoOpt_list:
+   NoOpt_list COMMA NoOption
+   |
+   NoOption
+   ;
 Option:
Save_id {
newopt(&opt, $1, NULL, 0);
@@ -236,6 +241,11 @@ Option:
newopt(&opt, $1, $3, 0);
  } ;
 
+NoOption:
+   Save_id {
+   rmopt_schedule(&opt, $1);
+   };
+
 Opt_value:
ID { $$ = $1; } |
NUMBER {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277566 - head/usr.sbin/iostat

2015-01-23 Thread Will Andrews
Author: will
Date: Fri Jan 23 15:55:03 2015
New Revision: 277566
URL: https://svnweb.freebsd.org/changeset/base/277566

Log:
  Print transfer times for read, write, & overall independently.
  
  Round up calculated values for iops and average time per io to avoid a
  shifting display if there are 1000+ (or even 1+) iops, or if an
  average time per io column is 1000+ ms.
  
  Reviewed by:  ken
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1089947 on 2014/09/26
1093625 on 2014/09/29
1093650 on 2014/09/29
1095662 on 2014/10/09

Modified:
  head/usr.sbin/iostat/iostat.c

Modified: head/usr.sbin/iostat/iostat.c
==
--- head/usr.sbin/iostat/iostat.c   Fri Jan 23 15:14:30 2015
(r277565)
+++ head/usr.sbin/iostat/iostat.c   Fri Jan 23 15:55:03 2015
(r277566)
@@ -726,15 +726,17 @@ static void
 devstats(int perf_select, long double etime, int havelast)
 {
int dn;
-   long double transfers_per_second, transfers_per_second_read, 
transfers_per_second_write;
-   long double kb_per_transfer, mb_per_second, mb_per_second_read, 
mb_per_second_write;
+   long double transfers_per_second, transfers_per_second_read;
+   long double transfers_per_second_write;
+   long double kb_per_transfer, mb_per_second, mb_per_second_read;
+   long double mb_per_second_write;
u_int64_t total_bytes, total_transfers, total_blocks;
u_int64_t total_bytes_read, total_transfers_read;
u_int64_t total_bytes_write, total_transfers_write;
long double busy_pct, busy_time;
u_int64_t queue_len;
-   long double total_mb;
-   long double blocks_per_second, ms_per_transaction, total_duration;
+   long double total_mb, blocks_per_second, total_duration;
+   long double ms_per_other, ms_per_read, ms_per_write, ms_per_transaction;
int firstline = 1;
char *devname;
 
@@ -746,8 +748,8 @@ devstats(int perf_select, long double et
printf("   cpu ");
printf("\n");
if (Iflag == 0) {
-   printf("device r/s   w/skr/skw/s qlen "
-   "svc_t  %%b  ");
+   printf("device r/s   w/s kr/s kw/s "
+   " ms/r  ms/w  ms/o  ms/t qlen  %%b  ");
} else {
printf("device   r/i w/i kr/i"
" kw/i qlen   tsvc_t/i  sb/i  ");
@@ -786,6 +788,9 @@ devstats(int perf_select, long double et
DSM_MB_PER_SECOND_WRITE, &mb_per_second_write,
DSM_BLOCKS_PER_SECOND, &blocks_per_second,
DSM_MS_PER_TRANSACTION, &ms_per_transaction,
+   DSM_MS_PER_TRANSACTION_READ, &ms_per_read,
+   DSM_MS_PER_TRANSACTION_WRITE, &ms_per_write,
+   DSM_MS_PER_TRANSACTION_OTHER, &ms_per_other,
DSM_BUSY_PCT, &busy_pct,
DSM_QUEUE_LENGTH, &queue_len,
DSM_TOTAL_DURATION, &total_duration,
@@ -820,13 +825,18 @@ devstats(int perf_select, long double et
mb_per_second_write > ((long double).0005)/1024 ||
busy_pct > 0.5) {
if (Iflag == 0)
-   printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf 
%7.1Lf %4" PRIu64 " %5.1Lf %3.0Lf ",
-   devname, transfers_per_second_read,
-   transfers_per_second_write,
+   printf("%-8.8s %5d %5d %8.1Lf "
+   "%8.1Lf %5d %5d %5d %5d "
+   "%4" PRIu64 " %3.0Lf ",
+   devname,
+   (int)transfers_per_second_read,
+   (int)transfers_per_second_write,
mb_per_second_read * 1024,
mb_per_second_write * 1024,
-   queue_len,
-   ms_per_transaction, busy_pct);
+   (int)ms_per_read, (int)ms_per_write,
+   (int)ms_per_other,
+   (int)ms_per_transaction,
+   queue_len, busy_pct);
else
printf("%-8.8s %11.1Lf %11.1Lf "
"%12.1Lf %12.1Lf %4" PRIu64
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.

svn commit: r277564 - head/sys/netinet

2015-01-23 Thread Will Andrews
Author: will
Date: Fri Jan 23 14:30:24 2015
New Revision: 277564
URL: https://svnweb.freebsd.org/changeset/base/277564

Log:
  Log hardware interface up/down as "hardware" rather than just "hw".
  
  Suggested by: glebius
  MFC after:1 week
  MFC with: 277530

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Fri Jan 23 14:28:12 2015(r277563)
+++ head/sys/netinet/ip_carp.c  Fri Jan 23 14:30:24 2015(r277564)
@@ -2001,13 +2001,13 @@ carp_sc_state(struct carp_softc *sc)
 #ifdef INET6
callout_stop(&sc->sc_md6_tmo);
 #endif
-   carp_set_state(sc, INIT, "hw interface down");
+   carp_set_state(sc, INIT, "hardware interface down");
carp_setrun(sc, 0);
if (!sc->sc_suppress)
carp_demote_adj(V_carp_ifdown_adj, "interface down");
sc->sc_suppress = 1;
} else {
-   carp_set_state(sc, INIT, "hw interface up");
+   carp_set_state(sc, INIT, "hardware interface up");
carp_setrun(sc, 0);
if (sc->sc_suppress)
carp_demote_adj(-V_carp_ifdown_adj, "interface up");
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r277530 - head/sys/netinet

2015-01-23 Thread Will Andrews
On Fri, Jan 23, 2015 at 02:03:53AM +0300, Gleb Smirnoff wrote:
> Very nice, thanks!
> 
> The only thing I'd suggest to change is "SIOCSVH". You and me, we understand
> this enchantment word, but average user Joe doesn't. :) May be a text like
> "user requested" or something else. I don't insist on anything, as I am not
> native speaker, but anything except of SIOCSVH :)
> 
> P.S. Abbreviation "hw" might also be improved.

Sounds good to me.  Done.

-- 
wca


pgp9A2rC52sFM.pgp
Description: PGP signature


svn commit: r277563 - head/sys/netinet

2015-01-23 Thread Will Andrews
Author: will
Date: Fri Jan 23 14:28:12 2015
New Revision: 277563
URL: https://svnweb.freebsd.org/changeset/base/277563

Log:
  When a CARP state change is caused by an ifconfig request, log it accordingly.
  
  Suggested by: glebius
  MFC after:1 week
  MFC with: 277530

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Fri Jan 23 13:26:35 2015(r277562)
+++ head/sys/netinet/ip_carp.c  Fri Jan 23 14:28:12 2015(r277563)
@@ -1702,12 +1702,14 @@ carp_ioctl(struct ifreq *ifr, u_long cmd
switch (carpr.carpr_state) {
case BACKUP:
callout_stop(&sc->sc_ad_tmo);
-   carp_set_state(sc, BACKUP, "SIOCSVH");
+   carp_set_state(sc, BACKUP,
+   "user requested via ifconfig");
carp_setrun(sc, 0);
carp_delroute(sc);
break;
case MASTER:
-   carp_master_down_locked(sc, "SIOCSVH");
+   carp_master_down_locked(sc,
+   "user requested via ifconfig");
break;
default:
break;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277544 - head/sys/net

2015-01-22 Thread Will Andrews
Author: will
Date: Fri Jan 23 00:06:35 2015
New Revision: 277544
URL: https://svnweb.freebsd.org/changeset/base/277544

Log:
  Improve the distribution of LAGG port traffic.
  
  I edited the original change to retain the use of arc4random() as a seed for
  the hashing as a very basic defense against intentional lagg port selection.
  
  The author's original commit message (edited slightly):
  
  sys/net/ieee8023ad_lacp.c
  sys/net/if_lagg.c
In lagg_hashmbuf, use the FNV hash instead of the old
hash32_buf.  The hash32 family of functions operate one octet
at a time, and when run on a string s of length n, their output
is equivalent to :
  
   - i=n-1
   \
   n\   (n-i-1)  32
( seed^  +  /33^* s[i] ) % 2^
   /
   - i=0
  
The problem is that the last five bytes of input don't get
multiplied by sufficiently many powers of 33 to rollover 2^32.
That means that changing the last few bytes (but obviously not
the very last) of input will always change the value of the
hash by a multiple of 33.  In the case of lagg_hashmbuf() with
ipv4 input, the last four bytes are the TCP or UDP port
numbers.  Since the output of lagg_hashmbuf is always taken
modulo the port count, and 3 is a common port count for a lagg,
that's bad.  It means that the UDP or TCP source port will
never affect which lagg member is selected on a 3-port lagg.
  
At 10Gbps, I was not able to measure any difference in CPU
consumption between the old and new hash.
  
  Submitted by: asomers (original commit)
  Reviewed by:  emaste, glebius
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1001723 on 2013/08/28 (original)
1114258 on 2015/01/22 (edit)

Modified:
  head/sys/net/ieee8023ad_lacp.c
  head/sys/net/if_lagg.c

Modified: head/sys/net/ieee8023ad_lacp.c
==
--- head/sys/net/ieee8023ad_lacp.c  Fri Jan 23 00:02:26 2015
(r277543)
+++ head/sys/net/ieee8023ad_lacp.c  Fri Jan 23 00:06:35 2015
(r277544)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include  /* hz */
 #include  /* for net/if.h */
@@ -757,13 +758,16 @@ void
 lacp_attach(struct lagg_softc *sc)
 {
struct lacp_softc *lsc;
+   uint32_t seed;
 
lsc = malloc(sizeof(struct lacp_softc), M_DEVBUF, M_WAITOK | M_ZERO);
 
sc->sc_psc = lsc;
lsc->lsc_softc = sc;
 
-   lsc->lsc_hashkey = arc4random();
+   seed = arc4random();
+   lsc->lsc_hashkey = FNV1_32_INIT;
+   lsc->lsc_hashkey = fnv_32_buf(&seed, sizeof(seed), lsc->lsc_hashkey);
lsc->lsc_active_aggregator = NULL;
lsc->lsc_strict_mode = 1;
LACP_LOCK_INIT(lsc);

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Fri Jan 23 00:02:26 2015(r277543)
+++ head/sys/net/if_lagg.c  Fri Jan 23 00:06:35 2015(r277544)
@@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1853,13 +1853,13 @@ lagg_hashmbuf(struct lagg_softc *sc, str
eh = mtod(m, struct ether_header *);
etype = ntohs(eh->ether_type);
if (sc->sc_flags & LAGG_F_HASHL2) {
-   p = hash32_buf(&eh->ether_shost, ETHER_ADDR_LEN, p);
-   p = hash32_buf(&eh->ether_dhost, ETHER_ADDR_LEN, p);
+   p = fnv_32_buf(&eh->ether_shost, ETHER_ADDR_LEN, p);
+   p = fnv_32_buf(&eh->ether_dhost, ETHER_ADDR_LEN, p);
}
 
/* Special handling for encapsulating VLAN frames */
if ((m->m_flags & M_VLANTAG) && (sc->sc_flags & LAGG_F_HASHL2)) {
-   p = hash32_buf(&m->m_pkthdr.ether_vtag,
+   p = fnv_32_buf(&m->m_pkthdr.ether_vtag,
sizeof(m->m_pkthdr.ether_vtag), p);
} else if (etype == ETHERTYPE_VLAN) {
vlan = lagg_gethdr(m, off,  sizeof(*vlan), &buf);
@@ -1867,7 +1867,7 @@ lagg_hashmbuf(struct lagg_softc *sc, str
goto out;
 
if (sc->sc_flags & LAGG_F_HASHL2)
-   p = hash32_buf(&vlan->evl_tag, sizeof(vlan->evl_tag), 
p);
+   p = fnv_32_buf(&vlan->evl_tag, sizeof(vlan->evl_tag), 
p);
etype = ntohs(vlan->evl_proto);
off += sizeof(*vlan) - sizeof(*eh);
}
@@ -1880,8 +1880,8 @@ lagg_hashmbuf(struct lagg_softc *sc, str
goto out;
 
if (sc->sc_flags & LAGG_F_HASHL3) {
-   p = hash32_buf(&ip->ip_src, sizeof(struct in_addr), p);
-   p = hash32_buf(&ip->ip_dst, sizeof(struct in_add

Re: svn commit: r277532 - head/sys/arm/arm

2015-01-22 Thread Will Andrews
On Thu, Jan 22, 2015 at 05:42:31PM +, Ian Lepore wrote:
> Log:
>   Add the Maxmem global and set it to the highest physical page number plus 1.

Thanks!

-- 
wca


pgpuN_Ku7yjWE.pgp
Description: PGP signature


svn commit: r277530 - head/sys/netinet

2015-01-22 Thread Will Andrews
Author: will
Date: Thu Jan 22 17:09:54 2015
New Revision: 277530
URL: https://svnweb.freebsd.org/changeset/base/277530

Log:
  Improve CARP logging so that all state transitions are logged.
  
  sys/netinet/ip_carp.c:
Add a "reason" string parameter to carp_set_state() and
carp_master_down_locked() allowing more specific logging
information to be passed into these apis.
  
Refactor existing state transition logging into a single
log call in carp_set_state().
  
Update all calls to carp_set_state() and
carp_master_down_locked() to pass an appropriate reason
string.  For state transitions that were previously logged,
the output should be unchanged.
  
  Submitted by: gibbs (original), asomers (updated)
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1039697 on 2014/02/11 (original)
1049992 on 2014/03/21 (updated)

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Thu Jan 22 14:49:36 2015(r277529)
+++ head/sys/netinet/ip_carp.c  Thu Jan 22 17:09:54 2015(r277530)
@@ -304,11 +304,12 @@ static void   carp_destroy(struct carp_sof
 static struct carp_if
*carp_alloc_if(struct ifnet *);
 static voidcarp_free_if(struct carp_if *);
-static voidcarp_set_state(struct carp_softc *, int);
+static voidcarp_set_state(struct carp_softc *, int, const char* reason);
 static voidcarp_sc_state(struct carp_softc *);
 static voidcarp_setrun(struct carp_softc *, sa_family_t);
 static voidcarp_master_down(void *);
-static voidcarp_master_down_locked(struct carp_softc *);
+static voidcarp_master_down_locked(struct carp_softc *,
+   const char* reason);
 static voidcarp_send_ad(void *);
 static voidcarp_send_ad_locked(struct carp_softc *);
 static voidcarp_addroute(struct carp_softc *);
@@ -654,11 +655,8 @@ carp_input_c(struct mbuf *m, struct carp
if (timevalcmp(&sc_tv, &ch_tv, >) ||
timevalcmp(&sc_tv, &ch_tv, ==)) {
callout_stop(&sc->sc_ad_tmo);
-   CARP_LOG("VHID %u@%s: MASTER -> BACKUP "
-   "(more frequent advertisement received)\n",
-   sc->sc_vhid,
-   sc->sc_carpdev->if_xname);
-   carp_set_state(sc, BACKUP);
+   carp_set_state(sc, BACKUP,
+   "more frequent advertisement received");
carp_setrun(sc, 0);
carp_delroute(sc);
}
@@ -669,11 +667,8 @@ carp_input_c(struct mbuf *m, struct carp
 * and this one claims to be slower, treat him as down.
 */
if (V_carp_preempt && timevalcmp(&sc_tv, &ch_tv, <)) {
-   CARP_LOG("VHID %u@%s: BACKUP -> MASTER "
-   "(preempting a slower master)\n",
-   sc->sc_vhid,
-   sc->sc_carpdev->if_xname);
-   carp_master_down_locked(sc);
+   carp_master_down_locked(sc,
+   "preempting a slower master");
break;
}
 
@@ -684,11 +679,7 @@ carp_input_c(struct mbuf *m, struct carp
 */
sc_tv.tv_sec = sc->sc_advbase * 3;
if (timevalcmp(&sc_tv, &ch_tv, <)) {
-   CARP_LOG("VHID %u@%s: BACKUP -> MASTER "
-   "(master timed out)\n",
-   sc->sc_vhid,
-   sc->sc_carpdev->if_xname);
-   carp_master_down_locked(sc);
+   carp_master_down_locked(sc, "master will time out");
break;
}
 
@@ -1153,10 +1144,7 @@ carp_master_down(void *v)
 
CURVNET_SET(sc->sc_carpdev->if_vnet);
if (sc->sc_state == BACKUP) {
-   CARP_LOG("VHID %u@%s: BACKUP -> MASTER (master down)\n",
-   sc->sc_vhid,
-   sc->sc_carpdev->if_xname);
-   carp_master_down_locked(sc);
+   carp_master_down_locked(sc, "master timed out");
}
CURVNET_RESTORE();
 
@@ -1164,14 +1152,14 @@ carp_master_down(void *v)
 }
 
 static void
-carp_master_down_locked(struct carp_softc *sc)
+carp_master_down_locked(struct carp_softc *sc, const char *reason)
 {
 
CARP_LOCK_ASSERT(sc);
 
switch (sc->sc_state) {
case BACKUP:
-   carp_set_state(sc, MASTER);
+   carp_set_state(sc, MASTER, reason);
carp_send_ad_locked(sc);
 #ifdef INET
carp_send_arp(sc);
@@ -1212,10 +1200,7 @@ carp_setrun(struct carp_softc *sc, sa_fa
 
switch (sc->sc_state) {

Re: svn commit: r275832 - head/tools/tools/nanobsd

2015-01-21 Thread Will Andrews
On Thu, Jan 22, 2015 at 09:54:04AM +1100, Lawrence Stewart wrote:
> Yes, looks good to me and fixes the issue I reported. Please commit.

Done in r277518.  Thanks for the quick test.

-- 
wca


pgp76MlrXeDmC.pgp
Description: PGP signature


svn commit: r277518 - head/tools/tools/nanobsd

2015-01-21 Thread Will Andrews
Author: will
Date: Thu Jan 22 00:52:34 2015
New Revision: 277518
URL: https://svnweb.freebsd.org/changeset/base/277518

Log:
  Enable nanobsd.sh to be executed when pwd != NANO_SRC.
  
  While here, fix a bug in which NANO_PMAKE would not be appended at the
  appropriate time.
  
  Simply move both checks to after the call to set_defaults_and_export().
  
  Tested by:lstewart
  Sponsored by: Spectra Logic

Modified:
  head/tools/tools/nanobsd/nanobsd.sh   (contents, props changed)

Modified: head/tools/tools/nanobsd/nanobsd.sh
==
--- head/tools/tools/nanobsd/nanobsd.sh Wed Jan 21 21:49:03 2015
(r277517)
+++ head/tools/tools/nanobsd/nanobsd.sh Thu Jan 22 00:52:34 2015
(r277518)
@@ -121,6 +121,13 @@ if [ $# -gt 0 ] ; then
usage
 fi
 
+###
+# And then it is as simple as that...
+
+# File descriptor 3 is used for logging output, see pprint
+exec 3>&1
+set_defaults_and_export
+
 if [ ! -d "${NANO_TOOLS}" ]; then
echo "NANO_TOOLS directory does not exist" 1>&2
exit 1
@@ -130,13 +137,6 @@ if ! $do_clean; then
NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN"
 fi
 
-###
-# And then it is as simple as that...
-
-# File descriptor 3 is used for logging output, see pprint
-exec 3>&1
-set_defaults_and_export
-
 pprint 1 "NanoBSD image ${NANO_NAME} build starting"
 
 if $do_world ; then
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277515 - head/sys/dev/isp

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 20:32:36 2015
New Revision: 277515
URL: https://svnweb.freebsd.org/changeset/base/277515

Log:
  Fix SCSI status byte reporting on 4Gb and 8Gb Qlogic boards.
  
  The newer boards don't have the response field that indicates
  whether the SCSI status byte is present.  You have to just look to
  see whether it is non-zero.
  
  The code was looking to see whether the sense length was valid
  before propagating the SCSI status byte (and sense information) up
  the stack.  With a status like Reservation Conflict, there is no
  sense information, only the SCSI status byte.  So it wasn't getting
  correctly returned.
  
  isp.c:
In isp_intr(), if we are on a 2400 or 2500 type board and
get a response, look at the actual contents of the
SCSI status value and set the RQSF_GOT_STATUS flag
accordingly so that return any SCSI status value we get.  The
RQSF_GOT_SENSE flag will get set later on if there is
actual sense information returned.
  
  Submitted by: ken
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1112791 on 2015/01/15

Modified:
  head/sys/dev/isp/isp.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Wed Jan 21 20:27:11 2015(r277514)
+++ head/sys/dev/isp/isp.c  Wed Jan 21 20:32:36 2015(r277515)
@@ -5224,7 +5224,10 @@ again:
}
scsi_status = sp2->req_scsi_status;
completion_status = sp2->req_completion_status;
-   req_state_flags = 0;
+   if ((scsi_status & 0xff) != 0)
+   req_state_flags = RQSF_GOT_STATUS;
+   else
+   req_state_flags = 0;
resid = sp2->req_resid;
} else if (etype == RQSTYPE_RESPONSE) {
isp_get_response(isp, (ispstatusreq_t *) hp, sp);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277514 - head/sys/dev/isp

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 20:27:11 2015
New Revision: 277514
URL: https://svnweb.freebsd.org/changeset/base/277514

Log:
  Force commit to record the correct log for r277513.
  
  If the user sends an XPT_RESET_DEV CCB, make sure to reset the
  Fibre Channel Command Reference Number if we're running on a FC
  controller.
  
  We send a SCSI Target Reset when we get this CCB, and as a result
  need to reset the CRN to 1 on the next command.
  
  isp_freebsd.c:
In the XPT_RESET_DEV implementation in isp_action(), reset
the CRN if we're on a FC controller.
  
  Submitted by: ken
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1112787 on 2015/01/15

Modified:
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Wed Jan 21 20:22:53 2015
(r277513)
+++ head/sys/dev/isp/isp_freebsd.c  Wed Jan 21 20:27:11 2015
(r277514)
@@ -29,6 +29,7 @@
  */
 #include 
 __FBSDID("$FreeBSD$");
+
 #include 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277513 - head/sys/dev/isp

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 20:22:53 2015
New Revision: 277513
URL: https://svnweb.freebsd.org/changeset/base/277513

Log:
  Change 1112791 by kenm@ken.spectrabsd8 on 2015/01/15 16:45:13
  
  Fix SCSI status byte reporting on 4Gb and 8Gb Qlogic boards.
  
  The newer boards don't have the response field that indicates
  whether the SCSI status byte is present.  You have to just look to
  see whether it is non-zero.
  
  The code was looking to see whether the sense length was valid
  before propagating the SCSI status byte (and sense information) up
  the stack.  With a status like Reservation Conflict, there is no
  sense information, only the SCSI status byte.  So it wasn't getting
  correctly returned.
  
  isp.c:
In isp_intr(), if we are on a 2400 or 2500 type board and
get a response, look at the actual contents of the
SCSI status value and set the RQSF_GOT_STATUS flag
accordingly so that return any SCSI status value we get.  The
RQSF_GOT_SENSE flag will get set later on if there is
actual sense information returned.
  
  Submitted by: ken
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1112791 on 2015/01/15

Modified:
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Wed Jan 21 20:12:35 2015
(r277512)
+++ head/sys/dev/isp/isp_freebsd.c  Wed Jan 21 20:22:53 2015
(r277513)
@@ -5123,19 +5123,34 @@ isp_action(struct cam_sim *sim, union cc
break;
 #endif
case XPT_RESET_DEV: /* BDR the specified SCSI device */
+   {
+   struct isp_fc *fc;
 
bus = cam_sim_bus(xpt_path_sim(ccb->ccb_h.path));
tgt = ccb->ccb_h.target_id;
tgt |= (bus << 16);
+   if (IS_FC(isp))
+   fc = ISP_FC_PC(isp, bus);
+   else
+   fc = NULL;
 
error = isp_control(isp, ISPCTL_RESET_DEV, bus, tgt);
if (error) {
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
} else {
+   /*
+* If we have a FC device, reset the Command
+* Reference Number, because the target will expect
+* that we re-start the CRN at 1 after a reset.
+*/
+   if (fc != NULL)
+   isp_fcp_reset_crn(fc, tgt, /*tgt_set*/ 1);
+
ccb->ccb_h.status = CAM_REQ_CMP;
}
xpt_done(ccb);
break;
+   }
case XPT_ABORT: /* Abort the specified CCB */
{
union ccb *accb = ccb->cab.abort_ccb;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277511 - head/sys/dev/firewire

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 20:08:24 2015
New Revision: 277511
URL: https://svnweb.freebsd.org/changeset/base/277511

Log:
  Fix remote DMA based firewire debugging when targeting
  systems with more than 4GB of physical memory.
  
  To remotely debug the system 'stealthy' which has a kernel
  with this change installed and firewire properly configured:
  
% fwcontrol -m stealthy (or stealthy's firewire EUI64)
% kgdb kernel /dev/fwmem0.0
  
  sys/dev/firewire/fwohci.c:
Rather than hard code the upper limit for hw based
automatic responses to remote DMA requests at 4GB,
program the hardware using Maxmem, the page number
one higher than the highest physical page detected
in the system.
  
While here, garbage collect more useless splfw()
calls.
  
  Submitted by: gibbs
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1110994 on 2015/01/06

Modified:
  head/sys/dev/firewire/fwohci.c

Modified: head/sys/dev/firewire/fwohci.c
==
--- head/sys/dev/firewire/fwohci.c  Wed Jan 21 20:06:25 2015
(r277510)
+++ head/sys/dev/firewire/fwohci.c  Wed Jan 21 20:08:24 2015
(r277511)
@@ -48,6 +48,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -188,6 +189,7 @@ static void fwohci_task_dma(void *, int)
 #defineOHCI_PREQLO 0x118
 #defineOHCI_PREQLOCLR  0x11c
 #defineOHCI_PREQUPPER  0x120
+#define OHCI_PREQUPPER_MAX 0x
 
 #defineOHCI_SID_BUF0x64
 #defineOHCI_SID_CNT0x68
@@ -854,7 +856,7 @@ fwohci_execute_db2(void *arg, bus_dma_se
 static void
 fwohci_start(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
 {
-   int i, s;
+   int i;
int tcode, hdr_len, pl_off;
int fsegment = -1;
uint32_t off;
@@ -880,7 +882,6 @@ fwohci_start(struct fwohci_softc *sc, st
if (dbch->flags & FWOHCI_DBCH_FULL)
return;
 
-   s = splfw();
db_tr = dbch->top;
 txloop:
xfer = STAILQ_FIRST(&dbch->xferq.q);
@@ -1030,7 +1031,6 @@ kick:
}
 
dbch->top = db_tr;
-   splx(s);
return;
 }
 
@@ -1821,6 +1821,7 @@ static void
 fwohci_intr_core(struct fwohci_softc *sc, uint32_t stat, int count)
 {
struct firewire_comm *fc = (struct firewire_comm *)sc;
+   uintmax_t prequpper;
uint32_t node_id, plen;
 
FW_GLOCK_ASSERT(fc);
@@ -1852,8 +1853,17 @@ fwohci_intr_core(struct fwohci_softc *sc
/* allow from all nodes */
OWRITE(sc, OHCI_PREQHI, 0x7fff);
OWRITE(sc, OHCI_PREQLO, 0x);
-   /* 0 to 4GB region */
-   OWRITE(sc, OHCI_PREQUPPER, 0x1);
+   prequpper = ((uintmax_t)Maxmem << PAGE_SHIFT) >> 16;
+   if (prequpper > OHCI_PREQUPPER_MAX) {
+   device_printf(fc->dev,
+   "Physical memory size of 0x%jx exceeds "
+   "fire wire address space.  Limiting dma "
+   "to memory below 0x%jx\n",
+   (uintmax_t)Maxmem << PAGE_SHIFT,
+   (uintmax_t)OHCI_PREQUPPER_MAX << 16);
+   prequpper = OHCI_PREQUPPER_MAX;
+   }
+   OWRITE(sc, OHCI_PREQUPPER, prequpper & 0x);
}
/* Set ATRetries register */
OWRITE(sc, OHCI_ATRETRY, 1<<(13 + 16) | 0xfff);
@@ -2171,7 +2181,7 @@ fwohci_rbuf_update(struct fwohci_softc *
struct fw_bulkxfer *chunk;
struct fw_xferq *ir;
uint32_t stat;
-   int s, w = 0, ldesc;
+   int w = 0, ldesc;
 
ir = fc->ir[dmach];
ldesc = sc->ir[dmach].ndesc - 1;
@@ -2179,7 +2189,6 @@ fwohci_rbuf_update(struct fwohci_softc *
 #if 0
dump_db(sc, dmach);
 #endif
-   s = splfw();
if ((ir->flag & FWXFERQ_HANDLER) == 0)
FW_GLOCK(fc);
fwdma_sync_multiseg_all(sc->ir[dmach].am, BUS_DMASYNC_POSTREAD);
@@ -2218,7 +2227,6 @@ fwohci_rbuf_update(struct fwohci_softc *
}
if ((ir->flag & FWXFERQ_HANDLER) == 0)
FW_GUNLOCK(fc);
-   splx(s);
if (w == 0)
return;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277510 - head/sys/dev/firewire

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 20:06:25 2015
New Revision: 277510
URL: https://svnweb.freebsd.org/changeset/base/277510

Log:
  Fix firewire panic when issuing a reply to an unhandled
  asynchronous remote dma request (DMA request that the
  hardware cannot automatically handle).
  
  sys/dev/firewire/firewire.c
In fw_rcv(), add missing early return in the error
path for DMA requests to unregistered regions.
  
  Submitted by: gibbs
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1110993 on 2015/01/06

Modified:
  head/sys/dev/firewire/firewire.c

Modified: head/sys/dev/firewire/firewire.c
==
--- head/sys/dev/firewire/firewire.cWed Jan 21 20:05:10 2015
(r277509)
+++ head/sys/dev/firewire/firewire.cWed Jan 21 20:06:25 2015
(r277510)
@@ -2030,6 +2030,7 @@ fw_rcv(struct fw_rcv_buf *rb)
rb->xfer->hand = fw_xfer_free;
if (fw_asyreq(rb->fc, -1, rb->xfer))
fw_xfer_free(rb->xfer);
+   return;
}
len = 0;
for (i = 0; i < rb->nvec; i++)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277509 - head/sys/dev/firewire

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 20:05:10 2015
New Revision: 277509
URL: https://svnweb.freebsd.org/changeset/base/277509

Log:
  Properly lock accesss to the firewire_comm->devices list.
  
  sys/dev/firewire/firewire.c:
Add missing FW_GLOCK/UNLOCK() usage to fw_noderesolve_nodeid().
  
  sys/dev/firewire/firewire.c:
  sys/dev/firewire/fwmem.c:
Remove no-op splfw() calls from functions that have been
audited for proper lock usage.
  
  Submitted by: gibbs
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1110992 on 2015/01/06

Modified:
  head/sys/dev/firewire/firewire.c
  head/sys/dev/firewire/fwmem.c

Modified: head/sys/dev/firewire/firewire.c
==
--- head/sys/dev/firewire/firewire.cWed Jan 21 20:03:46 2015
(r277508)
+++ head/sys/dev/firewire/firewire.cWed Jan 21 20:05:10 2015
(r277509)
@@ -146,13 +146,12 @@ struct fw_device *
 fw_noderesolve_nodeid(struct firewire_comm *fc, int dst)
 {
struct fw_device *fwdev;
-   int s;
 
-   s = splfw();
+   FW_GLOCK(fc);
STAILQ_FOREACH(fwdev, &fc->devices, link)
if (fwdev->dst == dst && fwdev->status != FWDEVINVAL)
break;
-   splx(s);
+   FW_GUNLOCK(fc);
 
return fwdev;
 }
@@ -164,15 +163,12 @@ struct fw_device *
 fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 *eui)
 {
struct fw_device *fwdev;
-   int s;
 
-   s = splfw();
FW_GLOCK(fc);
STAILQ_FOREACH(fwdev, &fc->devices, link)
if (FW_EUI64_EQUAL(fwdev->eui, *eui))
break;
FW_GUNLOCK(fc);
-   splx(s);
 
if (fwdev == NULL)
return NULL;
@@ -301,9 +297,7 @@ static void
 fw_asystart(struct fw_xfer *xfer)
 {
struct firewire_comm *fc = xfer->fc;
-   int s;
 
-   s = splfw();
/* Protect from interrupt/timeout */
FW_GLOCK(fc);
xfer->flag = FWXF_INQ;
@@ -312,7 +306,6 @@ fw_asystart(struct fw_xfer *xfer)
xfer->q->queued++;
 #endif
FW_GUNLOCK(fc);
-   splx(s);
/* XXX just queue for mbuf */
if (xfer->mbuf == NULL)
xfer->q->start(fc);
@@ -332,6 +325,7 @@ firewire_probe(device_t dev)
return (0);
 }
 
+/* Just use a per-packet callout? */
 static void
 firewire_xfer_timeout(void *arg, int pending)
 {
@@ -340,7 +334,7 @@ firewire_xfer_timeout(void *arg, int pen
struct timeval tv;
struct timeval split_timeout;
STAILQ_HEAD(, fw_xfer) xfer_timeout;
-   int i, s;
+   int i;
 
split_timeout.tv_sec = 0;
split_timeout.tv_usec = 200 * 1000;  /* 200 msec */
@@ -349,9 +343,8 @@ firewire_xfer_timeout(void *arg, int pen
timevalsub(&tv, &split_timeout);
STAILQ_INIT(&xfer_timeout);
 
-   s = splfw();
mtx_lock(&fc->tlabel_lock);
-   for (i = 0; i < 0x40; i++) {
+   for (i = 0; i < nitems(fc->tlabels); i++) {
while ((xfer = STAILQ_FIRST(&fc->tlabels[i])) != NULL) {
if ((xfer->flag & FWXF_SENT) == 0)
/* not sent yet */
@@ -370,7 +363,6 @@ firewire_xfer_timeout(void *arg, int pen
}
}
mtx_unlock(&fc->tlabel_lock);
-   splx(s);
fc->timeout(fc);
 
STAILQ_FOREACH_SAFE(xfer, &xfer_timeout, tlabel, txfer)

Modified: head/sys/dev/firewire/fwmem.c
==
--- head/sys/dev/firewire/fwmem.c   Wed Jan 21 20:03:46 2015
(r277508)
+++ head/sys/dev/firewire/fwmem.c   Wed Jan 21 20:05:10 2015
(r277509)
@@ -348,12 +348,11 @@ fwmem_strategy(struct bio *bp)
struct fw_device *fwdev;
struct fw_xfer *xfer;
struct cdev *dev;
-   int err = 0, s, iolen;
+   int err = 0, iolen;
 
dev = bp->bio_dev;
/* XXX check request length */
 
-   s = splfw();
fms = dev->si_drv1;
fwdev = fw_noderesolve_eui64(fms->sc->fc, &fms->eui);
if (fwdev == NULL) {
@@ -395,7 +394,6 @@ fwmem_strategy(struct bio *bp)
/* XXX */
bp->bio_resid = bp->bio_bcount - iolen;
 error:
-   splx(s);
if (err != 0) {
if (fwmem_debug)
printf("%s: err=%d\n", __func__, err);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277508 - head/sys/dev/firewire

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 20:03:46 2015
New Revision: 277508
URL: https://svnweb.freebsd.org/changeset/base/277508

Log:
  Fix panic in firewire and creation of invalid config ROM.
  
  sys/boot/i386/libfirewire/firewire.c:
  sys/dev/firewire/firewire.c:
Fix configuration ROM generation count wrapping logic
so that the generation count is never outside of
allowed limits (0x2 -> 0xF).
  
  sys/dev/firewire/firewire.c:
In fw_xfer_unload(), xfer->fc may be NULL.  Protect
against this before taking the fc lock.
  
  Submitted by: gibbs
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1110685 on 2015/01/05

Modified:
  head/sys/dev/firewire/firewire.c

Modified: head/sys/dev/firewire/firewire.c
==
--- head/sys/dev/firewire/firewire.cWed Jan 21 20:02:16 2015
(r277507)
+++ head/sys/dev/firewire/firewire.cWed Jan 21 20:03:46 2015
(r277508)
@@ -761,8 +761,15 @@ fw_busreset(struct firewire_comm *fc, ui
src = &fc->crom_src_buf->src;
crom_load(src, newrom, CROMSIZE);
if (bcmp(newrom, fc->config_rom, CROMSIZE) != 0) {
-   if (src->businfo.generation++ > FW_MAX_GENERATION)
+   /* Bump generation and reload. */
+   src->businfo.generation++;
+
+   /* Handle generation count wraps. */
+   if (src->businfo.generation < FW_GENERATION_CHANGEABLE)
src->businfo.generation = FW_GENERATION_CHANGEABLE;
+
+   /* Recalculate CRC to account for generation change. */
+   crom_load(src, newrom, CROMSIZE);
bcopy(newrom, fc->config_rom, CROMSIZE);
}
free(newrom, M_FW);
@@ -1156,16 +1163,18 @@ fw_xfer_unload(struct fw_xfer *xfer)
 
if (xfer == NULL)
return;
-   FW_GLOCK(xfer->fc);
-   if (xfer->flag & FWXF_INQ) {
-   STAILQ_REMOVE(&xfer->q->q, xfer, fw_xfer, link);
-   xfer->flag &= ~FWXF_INQ;
-#if 0
-   xfer->q->queued--;
-#endif
-   }
-   FW_GUNLOCK(xfer->fc);
+
if (xfer->fc != NULL) {
+   FW_GLOCK(xfer->fc);
+   if (xfer->flag & FWXF_INQ) {
+   STAILQ_REMOVE(&xfer->q->q, xfer, fw_xfer, link);
+   xfer->flag &= ~FWXF_INQ;
+   #if 0
+   xfer->q->queued--;
+   #endif
+   }
+   FW_GUNLOCK(xfer->fc);
+
/*
 * Ensure that any tlabel owner can't access this
 * xfer after it's freed.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277507 - head/sys/dev/firewire

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 20:02:16 2015
New Revision: 277507
URL: https://svnweb.freebsd.org/changeset/base/277507

Log:
  Fix a FWXF_INQ race in the firewire driver.
  
  sys/dev/firewire/firewire.c:
In fw_xfer_unload() expand lock coverage so that
the test for FWXF_INQ doesn't race with it being
cleared in another thread.
  
  Submitted by: gibbs
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1110207 on 2015/01/02

Modified:
  head/sys/dev/firewire/firewire.c

Modified: head/sys/dev/firewire/firewire.c
==
--- head/sys/dev/firewire/firewire.cWed Jan 21 19:59:09 2015
(r277506)
+++ head/sys/dev/firewire/firewire.cWed Jan 21 20:02:16 2015
(r277507)
@@ -1022,9 +1022,7 @@ static void
 fw_tl_free(struct firewire_comm *fc, struct fw_xfer *xfer)
 {
struct fw_xfer *txfer;
-   int s;
 
-   s = splfw();
mtx_lock(&fc->tlabel_lock);
if (xfer->tl < 0) {
mtx_unlock(&fc->tlabel_lock);
@@ -1042,14 +1040,12 @@ fw_tl_free(struct firewire_comm *fc, str
fw_dump_hdr(&xfer->recv.hdr, "recv");
kdb_backtrace();
mtx_unlock(&fc->tlabel_lock);
-   splx(s);
return;
}
 
STAILQ_REMOVE(&fc->tlabels[xfer->tl], xfer, fw_xfer, tlabel);
xfer->tl = -1;
mtx_unlock(&fc->tlabel_lock);
-   splx(s);
return;
 }
 
@@ -1157,22 +1153,18 @@ fw_xfer_done(struct fw_xfer *xfer)
 void
 fw_xfer_unload(struct fw_xfer *xfer)
 {
-   int s;
 
if (xfer == NULL)
return;
+   FW_GLOCK(xfer->fc);
if (xfer->flag & FWXF_INQ) {
-   printf("fw_xfer_free FWXF_INQ\n");
-   s = splfw();
-   FW_GLOCK(xfer->fc);
STAILQ_REMOVE(&xfer->q->q, xfer, fw_xfer, link);
xfer->flag &= ~FWXF_INQ;
 #if 0
xfer->q->queued--;
 #endif
-   FW_GUNLOCK(xfer->fc);
-   splx(s);
}
+   FW_GUNLOCK(xfer->fc);
if (xfer->fc != NULL) {
/*
 * Ensure that any tlabel owner can't access this
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277506 - head/sys/dev/firewire

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 19:59:09 2015
New Revision: 277506
URL: https://svnweb.freebsd.org/changeset/base/277506

Log:
  Fix one cause of firewire panics.
  
  sys/dev/firewire/firewire.c:
In fw_xfer_unload(), clear the FWXF_INQ flag on the
xfer under protection of the FW_GMTX, after the
xfer is removeed from the tx/rx queue.  Otherwise
it is possible for the xfer to be removed again
(corrupting the list or immediately panicing) from
another thread that has found this xfer in the
transaction label table.
  
  Submitted by: gibbs
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1110200 on 2015/01/02

Modified:
  head/sys/dev/firewire/firewire.c

Modified: head/sys/dev/firewire/firewire.c
==
--- head/sys/dev/firewire/firewire.cWed Jan 21 19:53:52 2015
(r277505)
+++ head/sys/dev/firewire/firewire.cWed Jan 21 19:59:09 2015
(r277506)
@@ -1166,6 +1166,7 @@ fw_xfer_unload(struct fw_xfer *xfer)
s = splfw();
FW_GLOCK(xfer->fc);
STAILQ_REMOVE(&xfer->q->q, xfer, fw_xfer, link);
+   xfer->flag &= ~FWXF_INQ;
 #if 0
xfer->q->queued--;
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277505 - head/sys/dev/dcons

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 19:53:52 2015
New Revision: 277505
URL: https://svnweb.freebsd.org/changeset/base/277505

Log:
  Garbage collect dragonfly and legacy FreeBSD system support from dcons(4).
  
  Submitted by: gibbs
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1110990 on 2015/01/06

Modified:
  head/sys/dev/dcons/dcons.c
  head/sys/dev/dcons/dcons_crom.c
  head/sys/dev/dcons/dcons_os.h

Modified: head/sys/dev/dcons/dcons.c
==
--- head/sys/dev/dcons/dcons.c  Wed Jan 21 19:30:01 2015(r277504)
+++ head/sys/dev/dcons/dcons.c  Wed Jan 21 19:53:52 2015(r277505)
@@ -37,11 +37,9 @@
 
 #include 
 
-#if defined(__DragonFly__) || defined(_BOOT)
-#include "dcons.h"
 #if defined(_BOOT)
+#include "dcons.h"
 #include "stand.h"
-#endif
 #else
 #include 
 #endif

Modified: head/sys/dev/dcons/dcons_crom.c
==
--- head/sys/dev/dcons/dcons_crom.c Wed Jan 21 19:30:01 2015
(r277504)
+++ head/sys/dev/dcons/dcons_crom.c Wed Jan 21 19:53:52 2015
(r277505)
@@ -46,40 +46,25 @@
 #include 
 #include 
 
-#ifdef __DragonFly__
-#include 
-#include 
-#include 
-#include "dcons.h"
-#include "dcons_os.h"
-#else
 #include 
 #include 
 #include 
 #include 
 #include 
-#endif
 
 #include 
 
-#define EXPOSE_IDT_ADDR 1
-
-#if (defined(__i386__) || defined(__amd64__)) && defined(EXPOSE_IDT_ADDR)
+#if (defined(__i386__) || defined(__amd64__))
 #include 
 #include 
 #include 
 #include  /* for idt */
 #endif
+
 static bus_addr_t dcons_paddr;
 
-#if __FreeBSD_version >= 50
 static int force_console = 0;
 TUNABLE_INT("hw.firewire.dcons_crom.force_console", &force_console);
-#endif
-
-#ifndef CSRVAL_VENDOR_PRIVATE
-#define NEED_NEW_DRIVER
-#endif
 
 #define ADDR_HI(x) (((x) >> 24) & 0xff)
 #define ADDR_LO(x) ((x) & 0xff)
@@ -115,8 +100,7 @@ dcons_crom_probe(device_t dev)
return (0);
 }
 
-#ifndef NEED_NEW_DRIVER
-#if (defined(__i386__) || defined(__amd64__)) && defined(EXPOSE_IDT_ADDR)
+#if (defined(__i386__) || defined(__amd64__))
 static void
 dcons_crom_expose_idt(struct dcons_crom_softc *sc)
 {
@@ -129,6 +113,7 @@ dcons_crom_expose_idt(struct dcons_crom_
crom_add_entry(&sc->unit, DCONS_CSR_KEY_RESET_LO, ADDR_LO(idt_paddr));
 }
 #endif
+
 static void
 dcons_crom_post_busreset(void *arg)
 {
@@ -149,11 +134,10 @@ dcons_crom_post_busreset(void *arg)
crom_add_simple_text(src, &sc->unit, &sc->ver, "dcons");
crom_add_entry(&sc->unit, DCONS_CSR_KEY_HI, ADDR_HI(dcons_paddr));
crom_add_entry(&sc->unit, DCONS_CSR_KEY_LO, ADDR_LO(dcons_paddr));
-#if (defined(__i386__) || defined(__amd64__)) && defined(EXPOSE_IDT_ADDR)
+#if (defined(__i386__) || defined(__amd64__))
dcons_crom_expose_idt(sc);
 #endif
 }
-#endif
 
 static void
 dmamap_cb(void *arg, bus_dma_segment_t *segments, int seg, int error)
@@ -168,11 +152,7 @@ dmamap_cb(void *arg, bus_dma_segment_t *
 
bus_dmamap_sync(sc->dma_tag, sc->dma_map, BUS_DMASYNC_PREWRITE);
device_printf(sc->fd.dev,
-#if __FreeBSD_version < 50
-   "bus_addr 0x%x\n", sc->bus_addr);
-#else
"bus_addr 0x%jx\n", (uintmax_t)sc->bus_addr);
-#endif
if (dcons_paddr != 0) {
/* XXX */
device_printf(sc->fd.dev, "dcons_paddr is already set\n");
@@ -182,11 +162,9 @@ dmamap_cb(void *arg, bus_dma_segment_t *
dcons_conf->dma_map = sc->dma_map;
dcons_paddr = sc->bus_addr;
 
-#if __FreeBSD_version >= 50
/* Force to be the high-level console */
if (force_console)
cnselect(dcons_conf->cdev);
-#endif
 }
 
 static void
@@ -200,10 +178,6 @@ dcons_crom_poll(void *p, int arg)
 static int
 dcons_crom_attach(device_t dev)
 {
-#ifdef NEED_NEW_DRIVER
-   printf("dcons_crom: you need newer firewire driver\n");
-   return (-1);
-#else
struct dcons_crom_softc *sc;
int error;
 
@@ -227,10 +201,8 @@ dcons_crom_attach(device_t dev)
/*nsegments*/ 1,
/*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT,
/*flags*/ BUS_DMA_ALLOCNOW,
-#if __FreeBSD_version >= 501102
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant,
-#endif
&sc->dma_tag);
if (error != 0)
return (error);
@@ -245,7 +217,6 @@ dcons_crom_attach(device_t dev)
sc->ehand = EVENTHANDLER_REGISTER(dcons_poll, dcons_crom_poll,
 (void *)sc, 0);
return (0);
-#endif
 }
 
 static int

Modified: head/sys/dev/dcons/dcons_os.h
==
--- head/sys/dev/dcons/dcons_os.h   Wed Jan 21 19:30:01 2015
(r277504)
+++ head/sys/dev/dcons/dcons_os.h   Wed Jan 21 19:53:52 2015
(r277505)
@@ -34,7 +34,6 @@
  * $FreeBSD$
  */
 
-
 typedef void (*dcons_poll_fn)(v

svn commit: r277504 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 19:30:01 2015
New Revision: 277504
URL: https://svnweb.freebsd.org/changeset/base/277504

Log:
  Remove commented log messages.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Wed Jan 21 
19:25:57 2015(r277503)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Wed Jan 21 
19:30:01 2015(r277504)
@@ -2090,7 +2090,6 @@ zil_replay(objset_t *os, void *arg, zil_
zil_destroy(zilog, B_TRUE);
return;
}
-   //printf("ZFS: Replaying ZIL on %s...\n", os->os->os_spa->spa_name);
 
zr.zr_replay = replay_func;
zr.zr_arg = arg;
@@ -2112,7 +2111,6 @@ zil_replay(objset_t *os, void *arg, zil_
zil_destroy(zilog, B_FALSE);
txg_wait_synced(zilog->zl_dmu_pool, zilog->zl_destroy_txg);
zilog->zl_replay = B_FALSE;
-   //printf("ZFS: Replay of ZIL on %s finished.\n", 
os->os->os_spa->spa_name);
 }
 
 boolean_t
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277503 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 19:25:57 2015
New Revision: 277503
URL: https://svnweb.freebsd.org/changeset/base/277503

Log:
  Ignore sync requests from the system syncher, i.e. VFS_SYNC(waitfor=MNT_LAZY).
  
  ZFS already commits outstanding data every zfs_txg_timeout seconds, so these
  syncs are unnecessarily intrusive.
  
  Submitted by: gibbs
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1105759 on 2014/12/11

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cWed Jan 
21 19:23:46 2015(r277502)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cWed Jan 
21 19:25:57 2015(r277503)
@@ -132,6 +132,13 @@ zfs_sync(vfs_t *vfsp, int waitfor)
if (panicstr)
return (0);
 
+   /*
+* Ignore the system syncher.  ZFS already commits async data
+* at zfs_txg_timeout intervals.
+*/
+   if (waitfor == MNT_LAZY)
+   return (0);
+
if (vfsp != NULL) {
/*
 * Sync a specific filesystem.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277501 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 19:20:36 2015
New Revision: 277501
URL: https://svnweb.freebsd.org/changeset/base/277501

Log:
  Eliminate an #ifdef illumos for zfs_ioc_rename().
  
  Since allow_mounted is a FreeBSD-specific change, default to B_TRUE, then
  locally check for the magic bit.  Unconditionally check allow_mounted below.
  Convert the setting of allow_mounted to an explicit boolean.
  
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 672578 (in part) on 2013/07/19

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Jan 
21 19:11:15 2015(r277500)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Jan 
21 19:20:36 2015(r277501)
@@ -3751,10 +3751,12 @@ static int
 zfs_ioc_rename(zfs_cmd_t *zc)
 {
boolean_t recursive = zc->zc_cookie & 1;
+   char *at;
+   boolean_t allow_mounted = B_TRUE;
+
 #ifdef __FreeBSD__
-   boolean_t allow_mounted = zc->zc_cookie & 2;
+   allow_mounted = (zc->zc_cookie & 2) != 0;
 #endif
-   char *at;
 
zc->zc_value[sizeof (zc->zc_value) - 1] = '\0';
if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 ||
@@ -3769,11 +3771,7 @@ zfs_ioc_rename(zfs_cmd_t *zc)
if (strncmp(zc->zc_name, zc->zc_value, at - zc->zc_name + 1))
return (SET_ERROR(EXDEV));
*at = '\0';
-#ifdef illumos
-   if (zc->zc_objset_type == DMU_OST_ZFS) {
-#else
if (zc->zc_objset_type == DMU_OST_ZFS && allow_mounted) {
-#endif
error = dmu_objset_find(zc->zc_name,
recursive_unmount, at + 1,
recursive ? DS_FIND_CHILDREN : 0);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277492 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-01-21 Thread Will Andrews
Author: will
Date: Wed Jan 21 17:03:11 2015
New Revision: 277492
URL: https://svnweb.freebsd.org/changeset/base/277492

Log:
  Add vfs.zfs.reference_tracking_enable sysctl/tunable.
  
  This is primarily for developer/debugging use; it enables built-in tagged
  tracking of refcounts inside ZFS.  It can only be enabled from the loader,
  since it modifies how in-core state is managed.  Default remains disabled.
  
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c  Wed Jan 
21 16:52:24 2015(r277491)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c  Wed Jan 
21 17:03:11 2015(r277492)
@@ -30,6 +30,10 @@
 
 #ifdef _KERNEL
 int reference_tracking_enable = FALSE; /* runs out of memory too easily */
+SYSCTL_DECL(_vfs_zfs);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, reference_tracking_enable, CTLFLAG_RDTUN,
+&reference_tracking_enable, 0,
+"Track reference holders to refcount_t objects, used mostly by ZFS");
 #else
 int reference_tracking_enable = TRUE;
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r275832 - head/tools/tools/nanobsd

2015-01-21 Thread Will Andrews
On Wed, Jan 21, 2015 at 06:51:23PM +1100, Lawrence Stewart wrote:
> I think this change introduced a bug - I'm seeing nanobsd error out with
> the "NANO_TOOLS directory does not exist" message.
> 
> The problem is that NANO_TOOLS is initialised to "tools/tools/nanobsd",
> and you changed the test in nanobsd.sh to *not* check for
> "${NANO_SRC}/${NANO_TOOLS}", which errors out except if the cwd is
> ${NANO_SRC}.
> 
> You tweak NANO_TOOLS appropriately in set_defaults_and_export() but it's
> run after the dir test. There are a couple of ways to fix but I'll leave
> it to you to decide which you prefer.

Will this work for you?

https://people.freebsd.org/~will/patches/nanobsd.sh.diff

This also fixes another bug where NANO_PMAKE would be modified too early.

Thanks,
--Will.


pgpuHepTMzjaF.pgp
Description: PGP signature


svn commit: r277452 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-01-20 Thread Will Andrews
Author: will
Date: Tue Jan 20 22:39:10 2015
New Revision: 277452
URL: https://svnweb.freebsd.org/changeset/base/277452

Log:
  Fix arc__shrink DTrace probe's to_free argument.
  
  Remove the unnecessary #ifdef _KERNEL, which did not differ in the true or
  false cases.  Actually set the value of to_free before using it.
  
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Tue Jan 20 
22:33:27 2015(r277451)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Tue Jan 20 
22:39:10 2015(r277452)
@@ -2540,13 +2540,9 @@ arc_shrink(void)
if (arc_c > arc_c_min) {
uint64_t to_free;
 
+   to_free = arc_c >> arc_shrink_shift;
DTRACE_PROBE4(arc__shrink, uint64_t, arc_c, uint64_t,
arc_c_min, uint64_t, arc_p, uint64_t, to_free);
-#ifdef _KERNEL
-   to_free = arc_c >> arc_shrink_shift;
-#else
-   to_free = arc_c >> arc_shrink_shift;
-#endif
if (arc_c > arc_c_min + to_free)
atomic_add_64(&arc_c, -to_free);
else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277450 - head/sys/cddl/contrib/opensolaris/uts/common/fs

2015-01-20 Thread Will Andrews
Author: will
Date: Tue Jan 20 22:31:26 2015
New Revision: 277450
URL: https://svnweb.freebsd.org/changeset/base/277450

Log:
  Use the "zfs_gfs" tag for GFS vnodes to make them easier to identify.
  
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c   Tue Jan 20 
22:29:27 2015(r277449)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c   Tue Jan 20 
22:31:26 2015(r277450)
@@ -489,7 +489,7 @@ gfs_file_create(size_t size, vnode_t *pv
 * Allocate vnode and internal data structure
 */
fp = kmem_zalloc(size, KM_SLEEP);
-   error = getnewvnode("zfs", vfsp, ops, &vp);
+   error = getnewvnode("zfs_gfs", vfsp, ops, &vp);
ASSERT(error == 0);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
vp->v_data = (caddr_t)fp;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277449 - head/sys/cddl/compat/opensolaris/sys

2015-01-20 Thread Will Andrews
Author: will
Date: Tue Jan 20 22:29:27 2015
New Revision: 277449
URL: https://svnweb.freebsd.org/changeset/base/277449

Log:
  NSEC_TO_TICK(usec) -> NSEC_TO_TICK(nsec)

Modified:
  head/sys/cddl/compat/opensolaris/sys/time.h

Modified: head/sys/cddl/compat/opensolaris/sys/time.h
==
--- head/sys/cddl/compat/opensolaris/sys/time.h Tue Jan 20 22:27:45 2015
(r277448)
+++ head/sys/cddl/compat/opensolaris/sys/time.h Tue Jan 20 22:29:27 2015
(r277449)
@@ -51,7 +51,7 @@ typedef longlong_thrtime_t;
 #endif
 
 #defineSEC_TO_TICK(sec)((sec) * hz)
-#defineNSEC_TO_TICK(usec)  ((usec) / (NANOSEC / hz))
+#defineNSEC_TO_TICK(nsec)  ((nsec) / (NANOSEC / hz))
 
 #ifdef _KERNEL
 static __inline hrtime_t
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277448 - head/sys/cddl/compat/opensolaris/sys

2015-01-20 Thread Will Andrews
Author: will
Date: Tue Jan 20 22:27:45 2015
New Revision: 277448
URL: https://svnweb.freebsd.org/changeset/base/277448

Log:
  Remove unused strdup() #define.

Modified:
  head/sys/cddl/compat/opensolaris/sys/sunddi.h

Modified: head/sys/cddl/compat/opensolaris/sys/sunddi.h
==
--- head/sys/cddl/compat/opensolaris/sys/sunddi.h   Tue Jan 20 22:15:36 
2015(r277447)
+++ head/sys/cddl/compat/opensolaris/sys/sunddi.h   Tue Jan 20 22:27:45 
2015(r277448)
@@ -35,7 +35,6 @@
 #include 
 #include 
 
-#definestrdup(ptr) strdup((ptr), M_SOLARIS)
 #defineddi_driver_major(zfs_dip)   (0)
 #defineddi_copyin(from, to, size, flag)
\
(copyin((from), (to), (size)), 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277440 - head/sys/cam

2015-01-20 Thread Will Andrews
Author: will
Date: Tue Jan 20 21:15:33 2015
New Revision: 277440
URL: https://svnweb.freebsd.org/changeset/base/277440

Log:
  Restore the CAM XPT peripheral generation counter, and export it via sysctl.
  
  Define it as an atomic uint32_t.  These increments happen infrequently
  enough for the atomic overhead to be a problem, and since they're now
  independent atomics, they won't contend with xpt_lock_buses().
  
  This counter is useful as a means of cheaply identifying whether any changes
  have been made to the CAM peripheral list.  Userland programs have no 
guarantee
  that the counter won't change on them while being returned or while processing
  the information, so they must be written accordingly.
  
  Discussed with:   ken, mav (in general)
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Tue Jan 20 21:09:39 2015(r277439)
+++ head/sys/cam/cam_xpt.c  Tue Jan 20 21:15:33 2015(r277440)
@@ -93,6 +93,8 @@ struct xpt_task {
 };
 
 struct xpt_softc {
+   uint32_txpt_generation;
+
/* number of high powered commands that can go through right now */
struct mtx  xpt_highpower_lock;
STAILQ_HEAD(highpowerlist, cam_ed)  highpowerq;
@@ -151,6 +153,8 @@ static struct xpt_softc xsoftc;
 
 SYSCTL_INT(_kern_cam, OID_AUTO, boot_delay, CTLFLAG_RDTUN,
&xsoftc.boot_delay, 0, "Bus registration wait time");
+SYSCTL_UINT(_kern_cam, OID_AUTO, xpt_generation, CTLFLAG_RD,
+   &xsoftc.xpt_generation, 0, "CAM peripheral generation count");
 
 struct cam_doneq {
struct mtx_padalign cam_doneq_mtx;
@@ -976,6 +980,7 @@ xpt_add_periph(struct cam_periph *periph
device->generation++;
SLIST_INSERT_HEAD(&device->periphs, periph, periph_links);
mtx_unlock(&device->target->bus->eb_mtx);
+   atomic_add_32(&xsoftc.xpt_generation, 1);
}
 
return (status);
@@ -992,6 +997,7 @@ xpt_remove_periph(struct cam_periph *per
device->generation++;
SLIST_REMOVE(&device->periphs, periph, cam_periph, 
periph_links);
mtx_unlock(&device->target->bus->eb_mtx);
+   atomic_add_32(&xsoftc.xpt_generation, 1);
}
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277273 - in head: bin/csh etc/mail gnu/usr.bin/grep kerberos5/lib/libasn1 kerberos5/lib/libgssapi_spnego kerberos5/lib/libhdb kerberos5/lib/libhx509 lib/libc lib/libexpat lib/libunboun...

2015-01-16 Thread Will Andrews
Author: will
Date: Fri Jan 16 21:39:08 2015
New Revision: 277273
URL: https://svnweb.freebsd.org/changeset/base/277273

Log:
  Add a ${CP} alias for copying files in the build.
  
  Some users build FreeBSD as non-root in Perforce workspaces.  By default,
  Perforce sets files read-only unless they're explicitly being edited.
  As a result, the -f argument must be used to cp in order to override the
  read-only flag when copying source files to object directories.  Bare use of
  'cp' should be avoided in the future.
  
  Update all current users of 'cp' in the src tree.
  
  Reviewed by:  emaste
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/bin/csh/Makefile
  head/etc/mail/Makefile
  head/gnu/usr.bin/grep/Makefile
  head/kerberos5/lib/libasn1/Makefile
  head/kerberos5/lib/libgssapi_spnego/Makefile
  head/kerberos5/lib/libhdb/Makefile
  head/kerberos5/lib/libhx509/Makefile
  head/lib/libc/Makefile
  head/lib/libexpat/Makefile
  head/lib/libunbound/Makefile
  head/secure/lib/libcrypto/Makefile
  head/share/mk/sys.mk
  head/tools/regression/execve/Makefile
  head/tools/test/dtrace/Makefile
  head/usr.bin/grep/Makefile
  head/usr.bin/lex/Makefile
  head/usr.bin/make/Makefile
  head/usr.sbin/mtree/Makefile

Modified: head/bin/csh/Makefile
==
--- head/bin/csh/Makefile   Fri Jan 16 21:12:36 2015(r277272)
+++ head/bin/csh/Makefile   Fri Jan 16 21:39:08 2015(r277273)
@@ -93,7 +93,7 @@ GENHDRS+= iconv.h
 SRCS+= iconv_stub.c
 
 iconv.h: ${.CURDIR}/iconv_stub.h
-   cp -f ${.CURDIR}/iconv_stub.h ${.TARGET}
+   ${CP} ${.CURDIR}/iconv_stub.h ${.TARGET}
 .endif
 .endif
 

Modified: head/etc/mail/Makefile
==
--- head/etc/mail/Makefile  Fri Jan 16 21:12:36 2015(r277272)
+++ head/etc/mail/Makefile  Fri Jan 16 21:39:08 2015(r277273)
@@ -69,7 +69,7 @@ SENDMAIL_MC!=   hostname
 SENDMAIL_MC:=   ${SENDMAIL_MC}.mc
 
 ${SENDMAIL_MC}:
-   cp -f freebsd.mc ${SENDMAIL_MC}
+   ${CP} freebsd.mc ${SENDMAIL_MC}
 .endif
 
 .ifndef SENDMAIL_SUBMIT_MC
@@ -77,7 +77,7 @@ SENDMAIL_SUBMIT_MC!=  hostname
 SENDMAIL_SUBMIT_MC:=   ${SENDMAIL_SUBMIT_MC}.submit.mc
 
 ${SENDMAIL_SUBMIT_MC}:
-   cp -f freebsd.submit.mc ${SENDMAIL_SUBMIT_MC}
+   ${CP} freebsd.submit.mc ${SENDMAIL_SUBMIT_MC}
 .endif
 
 INSTALL_CF=${SENDMAIL_MC:R}.cf

Modified: head/gnu/usr.bin/grep/Makefile
==
--- head/gnu/usr.bin/grep/Makefile  Fri Jan 16 21:12:36 2015
(r277272)
+++ head/gnu/usr.bin/grep/Makefile  Fri Jan 16 21:39:08 2015
(r277273)
@@ -43,7 +43,7 @@ MLINKS+=grep.1 zgrep.1 grep.1 zegrep.1 g
 .endif
 
 gnugrep.1: grep.1
-   cp ${.ALLSRC} ${.TARGET}
+   ${CP} ${.ALLSRC} ${.TARGET}
 
 check: all
@failed=0; total=0; \

Modified: head/kerberos5/lib/libasn1/Makefile
==
--- head/kerberos5/lib/libasn1/Makefile Fri Jan 16 21:12:36 2015
(r277272)
+++ head/kerberos5/lib/libasn1/Makefile Fri Jan 16 21:39:08 2015
(r277273)
@@ -111,10 +111,10 @@ ${GEN_KX509}: kx509.asn1
 .SUFFIXES: .h .c .x .hx
 
 .x.c:
-   cp -f ${.IMPSRC} ${.TARGET}
+   ${CP} ${.IMPSRC} ${.TARGET}
 
 .hx.h:
-   cp -f ${.IMPSRC} ${.TARGET}
+   ${CP} ${.IMPSRC} ${.TARGET}

 .include 
 

Modified: head/kerberos5/lib/libgssapi_spnego/Makefile
==
--- head/kerberos5/lib/libgssapi_spnego/MakefileFri Jan 16 21:12:36 
2015(r277272)
+++ head/kerberos5/lib/libgssapi_spnego/MakefileFri Jan 16 21:39:08 
2015(r277273)
@@ -45,10 +45,10 @@ ${GEN}: spnego.asn1 spnego.opt
 .SUFFIXES: .h .c .x .hx
 
 .x.c:   
-   cp ${.IMPSRC} ${.TARGET}
+   ${CP} ${.IMPSRC} ${.TARGET}
 
 .hx.h:
-   cp ${.IMPSRC} ${.TARGET}
+   ${CP} ${.IMPSRC} ${.TARGET}
 
 .include 
 

Modified: head/kerberos5/lib/libhdb/Makefile
==
--- head/kerberos5/lib/libhdb/Makefile  Fri Jan 16 21:12:36 2015
(r277272)
+++ head/kerberos5/lib/libhdb/Makefile  Fri Jan 16 21:39:08 2015
(r277273)
@@ -91,10 +91,10 @@ ${GEN}: hdb.asn1
 .SUFFIXES: .h .c .x .hx
 
 .x.c:   
-   cp ${.IMPSRC} ${.TARGET}
+   ${CP} ${.IMPSRC} ${.TARGET}
 
 .hx.h:
-   cp ${.IMPSRC} ${.TARGET}
+   ${CP} ${.IMPSRC} ${.TARGET}
 
 .include 
 

Modified: head/kerberos5/lib/libhx509/Makefile
==
--- head/kerberos5/lib/libhx509/MakefileFri Jan 16 21:12:36 2015
(r277272)
+++ head/kerberos5/lib/libhx509/MakefileFri Jan 16 21:39:08 2015
(r277273)
@@ -285,10 +285,10 @@ ${GEN_CRMF}: crmf.a

Re: svn commit: r276123 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-12-25 Thread Will Andrews
Why was the original condition there? It may not be documented in a
commenf, but presumably there is a reason. Did you ask the original author
of the code in question?

--Will.


On Tuesday, December 23, 2014, Steven Hartland  wrote:

> Author: smh
> Date: Tue Dec 23 09:31:24 2014
> New Revision: 276123
> URL: https://svnweb.freebsd.org/changeset/base/276123
>
> Log:
>   Always sync the global ZFS config cache to reflect the new mosconfig
>
>   This fixes out of date zpool.cache for root pools, which can cause issues
>   such as confusion of zdb etc.
>
>   MFC after:1 month
>
> Modified:
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
>
> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
>
> ==
> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
> Tue Dec 23 08:51:30 2014(r276122)
> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
> Tue Dec 23 09:31:24 2014(r276123)
> @@ -536,8 +536,7 @@ spa_config_update(spa_t *spa, int what)
> /*
>  * Update the global config cache to reflect the new mosconfig.
>  */
> -   if (!spa->spa_is_root)
> -   spa_config_sync(spa, B_FALSE, what !=
> SPA_CONFIG_UPDATE_POOL);
> +   spa_config_sync(spa, B_FALSE, what != SPA_CONFIG_UPDATE_POOL);
>
> if (what == SPA_CONFIG_UPDATE_POOL)
> spa_config_update(spa, SPA_CONFIG_UPDATE_VDEVS);
>
>
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275845 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2014-12-16 Thread Will Andrews
Author: will
Date: Wed Dec 17 00:22:41 2014
New Revision: 275845
URL: https://svnweb.freebsd.org/changeset/base/275845

Log:
  Initialize an argument to NULL instead of expecting dlinfo() to do it.
  
  dlinfo() is a weak reference that may not be initialized at the time of
  execution. The default implementation (in lib/libc/gen/dlfcn.c) neither
  modifies the address pointed to by the third argument nor returns an error.
  
  Differential Revision:https://reviews.freebsd.org/D1326
  Reviewed by:  markj
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c   Tue Dec 16 
23:25:12 2014(r275844)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c   Wed Dec 17 
00:22:41 2014(r275845)
@@ -110,7 +110,7 @@ dtrace_dof_init(void)
Elf32_Ehdr *elf;
 #endif
dof_helper_t dh;
-   Link_map *lmp;
+   Link_map *lmp = NULL;
 #if defined(sun)
Lmid_t lmid;
 #else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r275832 - head/tools/tools/nanobsd

2014-12-16 Thread Will Andrews
This change was committed with 'arc commit'.

I had intended to note in the commit message that this change does not
make any sort of API guarantee.  It is just intended to enable reuse.

--Will.

On Tue, Dec 16, 2014 at 10:59 AM, Will Andrews  wrote:
> Author: will
> Date: Tue Dec 16 17:59:05 2014
> New Revision: 275832
> URL: https://svnweb.freebsd.org/changeset/base/275832
>
> Log:
>   Make NanoBSD source-able from other scripts.
>
>   Summary:
>   This change converts NanoBSD into a two-script bundle.
>   - defaults.sh contains all non-CLI code.  Most NanoBSD code is moved into
> this file.
>   - nanobsd.sh now consists just of a command line interface that calls into
> functions in defaults.sh.
>
>   Test Plan: Run NanoBSD using a previously-working configuration.
>
>   Reviewers: imp
>
>   Reviewed By: imp
>
>   Differential Revision: https://reviews.freebsd.org/D1321
>
> Added:
>   head/tools/tools/nanobsd/defaults.sh   (contents, props changed)
> Modified:
>   head/tools/tools/nanobsd/nanobsd.sh
>
> Added: head/tools/tools/nanobsd/defaults.sh
> ==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/tools/tools/nanobsd/defaults.shTue Dec 16 17:59:05 2014  
>   (r275832)
> @@ -0,0 +1,983 @@
> +#!/bin/sh
> +#
> +# Copyright (c) 2005 Poul-Henning Kamp.
> +# All rights reserved.
> +#
> +# Redistribution and use in source and binary forms, with or without
> +# modification, are permitted provided that the following conditions
> +# are met:
> +# 1. Redistributions of source code must retain the above copyright
> +#notice, this list of conditions and the following disclaimer.
> +# 2. Redistributions in binary form must reproduce the above copyright
> +#notice, this list of conditions and the following disclaimer in the
> +#documentation and/or other materials provided with the distribution.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> +# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> +# SUCH DAMAGE.
> +#
> +# $FreeBSD$
> +#
> +
> +set -e
> +
> +###
> +#
> +# Setup default values for all controlling variables.
> +# These values can be overridden from the config file(s)
> +#
> +###
> +
> +# Name of this NanoBSD build.  (Used to construct workdir names)
> +NANO_NAME=full
> +
> +# Source tree directory
> +NANO_SRC=/usr/src
> +
> +# Where nanobsd additional files live under the source tree
> +NANO_TOOLS=tools/tools/nanobsd
> +
> +# Where cust_pkg() finds packages to install
> +NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/Pkg
> +NANO_PACKAGE_LIST="*"
> +
> +# where package metadata gets placed
> +NANO_PKG_META_BASE=/var/db
> +
> +# Object tree directory
> +# default is subdir of /usr/obj
> +#NANO_OBJ=""
> +
> +# The directory to put the final images
> +# default is ${NANO_OBJ}
> +#NANO_DISKIMGDIR=""
> +
> +# Make & parallel Make
> +NANO_MAKE="make"
> +NANO_PMAKE="make -j 3"
> +
> +# The default name for any image we create.
> +NANO_IMGNAME="_.disk.full"
> +
> +# Options to put in make.conf during buildworld only
> +CONF_BUILD=' '
> +
> +# Options to put in make.conf during installworld only
> +CONF_INSTALL=' '
> +
> +# Options to put in make.conf during both build- & installworld.
> +CONF_WORLD=' '
> +
> +# Kernel config file to use
> +NANO_KERNEL=GENERIC
> +
> +# Kernel modules to install. If empty, no modules are installed.
> +# Use "default" to install all built modules.
> +NANO_MODULES=
> +
> +# Customize commands.
> +NANO_CUSTOMIZE=""
> +
> +# Late customize commands.
> +NANO_LATE_CUSTOMIZE=""
> +
> +# Newfs paramters to use
> +NANO_NEWFS="

svn commit: r275832 - head/tools/tools/nanobsd

2014-12-16 Thread Will Andrews
Author: will
Date: Tue Dec 16 17:59:05 2014
New Revision: 275832
URL: https://svnweb.freebsd.org/changeset/base/275832

Log:
  Make NanoBSD source-able from other scripts.
  
  Summary:
  This change converts NanoBSD into a two-script bundle.
  - defaults.sh contains all non-CLI code.  Most NanoBSD code is moved into
this file.
  - nanobsd.sh now consists just of a command line interface that calls into
functions in defaults.sh.
  
  Test Plan: Run NanoBSD using a previously-working configuration.
  
  Reviewers: imp
  
  Reviewed By: imp
  
  Differential Revision: https://reviews.freebsd.org/D1321

Added:
  head/tools/tools/nanobsd/defaults.sh   (contents, props changed)
Modified:
  head/tools/tools/nanobsd/nanobsd.sh

Added: head/tools/tools/nanobsd/defaults.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/nanobsd/defaults.shTue Dec 16 17:59:05 2014
(r275832)
@@ -0,0 +1,983 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Poul-Henning Kamp.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+set -e
+
+###
+#
+# Setup default values for all controlling variables.
+# These values can be overridden from the config file(s)
+#
+###
+
+# Name of this NanoBSD build.  (Used to construct workdir names)
+NANO_NAME=full
+
+# Source tree directory
+NANO_SRC=/usr/src
+
+# Where nanobsd additional files live under the source tree
+NANO_TOOLS=tools/tools/nanobsd
+
+# Where cust_pkg() finds packages to install
+NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/Pkg
+NANO_PACKAGE_LIST="*"
+
+# where package metadata gets placed
+NANO_PKG_META_BASE=/var/db
+
+# Object tree directory
+# default is subdir of /usr/obj
+#NANO_OBJ=""
+
+# The directory to put the final images
+# default is ${NANO_OBJ}
+#NANO_DISKIMGDIR=""
+
+# Make & parallel Make
+NANO_MAKE="make"
+NANO_PMAKE="make -j 3"
+
+# The default name for any image we create.
+NANO_IMGNAME="_.disk.full"
+
+# Options to put in make.conf during buildworld only
+CONF_BUILD=' '
+
+# Options to put in make.conf during installworld only
+CONF_INSTALL=' '
+
+# Options to put in make.conf during both build- & installworld.
+CONF_WORLD=' '
+
+# Kernel config file to use
+NANO_KERNEL=GENERIC
+
+# Kernel modules to install. If empty, no modules are installed.
+# Use "default" to install all built modules.
+NANO_MODULES=
+
+# Customize commands.
+NANO_CUSTOMIZE=""
+
+# Late customize commands.
+NANO_LATE_CUSTOMIZE=""
+
+# Newfs paramters to use
+NANO_NEWFS="-b 4096 -f 512 -i 8192 -U"
+
+# The drive name of the media at runtime
+NANO_DRIVE=ad0
+
+# Target media size in 512 bytes sectors
+NANO_MEDIASIZE=200
+
+# Number of code images on media (1 or 2)
+NANO_IMAGES=2
+
+# 0 -> Leave second image all zeroes so it compresses better.
+# 1 -> Initialize second image with a copy of the first
+NANO_INIT_IMG2=1
+
+# Size of code file system in 512 bytes sectors
+# If zero, size will be as large as possible.
+NANO_CODESIZE=0
+
+# Size of configuration file system in 512 bytes sectors
+# Cannot be zero.
+NANO_CONFSIZE=2048
+
+# Size of data file system in 512 bytes sectors
+# If zero: no partition configured.
+# If negative: max size possible
+NANO_DATASIZE=0
+
+# Size of the /etc ramdisk in 512 bytes sectors
+NANO_RAM_ETCSIZE=10240
+
+# Size of the /tmp+/var ramdisk in 512 bytes sectors
+NANO_RAM_TMPVARSIZE=10240
+
+# Media geometry, only relevant if bios doesn't understand LBA.
+NANO_SECTS=63
+NANO_HEADS=16
+
+# boot0 flags/options and configuration
+NANO_BOOT0CFG="-o 

Re: svn commit: r272282 - head/share/mk

2014-10-01 Thread Will Andrews
On Wed, Oct 1, 2014 at 3:21 PM, NGie Cooper  wrote:
> Sounds like a documentation issue though (it's not listed in the
> handbook :(..: https://www.freebsd.org/doc/handbook/ports-using.html )

Well, I would argue this sort of thing should not need to be
documented in the first place.

--Will.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272383 - head/share/mk

2014-10-01 Thread Will Andrews
Author: will
Date: Wed Oct  1 20:52:08 2014
New Revision: 272383
URL: https://svnweb.freebsd.org/changeset/base/272383

Log:
  Revise r272363 by collapsing the tests into a for loop.
  
  This has the side effect of ensuring that realpath is also run for the
  nominal case of PORTSDIR=/usr/ports (assuming .CURDIR is a ports directory
  that relies on /usr/ports but is not rooted in it).  This ensures that any
  generated PORTSDIR used is always the actual location.
  
  Submitted by: jkim (different implementation)

Modified:
  head/share/mk/bsd.port.mk
  head/share/mk/bsd.port.subdir.mk

Modified: head/share/mk/bsd.port.mk
==
--- head/share/mk/bsd.port.mk   Wed Oct  1 20:37:15 2014(r272382)
+++ head/share/mk/bsd.port.mk   Wed Oct  1 20:52:08 2014(r272383)
@@ -4,17 +4,13 @@
 # Autodetect if the command is being run in a ports tree that's not rooted
 # in the default /usr/ports.  The ../../.. case is in case ports ever grows
 # a third level.
-.if exists(${.CURDIR}/Mk/bsd.port.mk)
-PORTSDIR!= realpath ${.CURDIR}
-.elif exists(${.CURDIR}/../Mk/bsd.port.mk)
-PORTSDIR!= realpath ${.CURDIR}/..
-.elif exists(${.CURDIR}/../../Mk/bsd.port.mk)
-PORTSDIR!= realpath ${.CURDIR}/../..
-.elif exists(${.CURDIR}/../../../Mk/bsd.port.mk)
-PORTSDIR!= realpath ${.CURDIR}/../../..
-.else
-PORTSDIR=  /usr/ports
+.for RELPATH in . .. ../.. ../../..
+.if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk)
+_PORTSDIR= ${.CURDIR}/${RELPATH}
 .endif
+.endfor
+_PORTSDIR?=/usr/ports
+PORTSDIR!= realpath ${_PORTSDIR}
 .endif
 
 BSDPORTMK?=${PORTSDIR}/Mk/bsd.port.mk

Modified: head/share/mk/bsd.port.subdir.mk
==
--- head/share/mk/bsd.port.subdir.mkWed Oct  1 20:37:15 2014
(r272382)
+++ head/share/mk/bsd.port.subdir.mkWed Oct  1 20:52:08 2014
(r272383)
@@ -4,17 +4,13 @@
 # Autodetect if the command is being run in a ports tree that's not rooted
 # in the default /usr/ports.  The ../../.. case is in case ports ever grows
 # a third level.
-.if exists(${.CURDIR}/Mk/bsd.port.mk)
-PORTSDIR!= realpath ${.CURDIR}
-.elif exists(${.CURDIR}/../Mk/bsd.port.mk)
-PORTSDIR!= realpath ${.CURDIR}/..
-.elif exists(${.CURDIR}/../../Mk/bsd.port.mk)
-PORTSDIR!= realpath ${.CURDIR}/../..
-.elif exists(${.CURDIR}/../../../Mk/bsd.port.mk)
-PORTSDIR!= realpath ${.CURDIR}/../../..
-.else
-PORTSDIR=  /usr/ports
+.for RELPATH in . .. ../.. ../../..
+.if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk)
+_PORTSDIR= ${.CURDIR}/${RELPATH}
 .endif
+.endfor
+_PORTSDIR?=/usr/ports
+PORTSDIR!= realpath ${_PORTSDIR}
 .endif
 
 BSDPORTSUBDIRMK?=  ${PORTSDIR}/Mk/bsd.port.subdir.mk
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r272282 - head/share/mk

2014-10-01 Thread Will Andrews
On Wed, Oct 1, 2014 at 2:13 PM, Jung-uk Kim  wrote:
> Actually, portmaster.diff is just enough to fix portmaster problem.
> ports.diff is for consistency.

So I guess portmaster is doing a string comparison to decide whether
to install a port?  That sounds like a bug in portmaster.  I suggest
changing it to always ask make for the value of PORTSDIR.

--Will.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r272282 - head/share/mk

2014-10-01 Thread Will Andrews
On Wed, Oct 1, 2014 at 2:03 PM, NGie Cooper  wrote:
> This change seems like it introduces a lot of unnecessary complexity
> in lieu of someone setting PORTSDIR to the root of their ports tree in
> the environment.

Sure, but people that are trying to use it somewhere other than
/usr/ports shouldn't be surprised by misbehavior.  I've worked with
several people (who aren't steeped in the usage of ports) who were
astonished by this behavior.

> Why isn't it using a for-loop by the way?

My original implementation used a shell for loop (see the CR), but
given the lack of a legitimate use case for looking farther up than
three parent directories, it seemed easier not to.  I suppose one
could use a static list of paths in the for loop though.

--Will.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r272282 - head/share/mk

2014-10-01 Thread Will Andrews
What kind of problem did this cause compared to the original version?
Could you provide the details of what you saw?

Thanks,
--Will.

On Wed, Oct 1, 2014 at 1:03 PM, Jung-uk Kim  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 2014-10-01 11:06:04 -0400, Will Andrews wrote:
>> If r272363 doesn't resolve the issue for you, let me know.
>
> portmaster still fails for me because:
>
> # ls -l /usr/ports
> lrwxr-xr-x  1 root  wheel  16 10  1 14:37 /usr/ports -> /home/jkim/ports
>
> To work around the failure, I had to apply the attached patches.
>
> Jung-uk Kim
>
>> Thanks! --Will.
>>
>> On Wed, Oct 1, 2014 at 8:51 AM, Guido Falsi 
>> wrote:
>>> On 09/29/14 17:05, Will Andrews wrote:
>>>> Author: will Date: Mon Sep 29 15:05:23 2014 New Revision:
>>>> 272282 URL: http://svnweb.freebsd.org/changeset/base/272282
>>>>
>>>> Log: Search for the nearest PORTSDIR where Mk/bsd.ports.mk
>>>> exists, from .CURDIR. This will only take effect if PORTSDIR
>>>> is not set, as previously supported.
>>>>
>>>> Use .if exists(), for four specific possibilities relative to
>>>> .CURDIR: ., .., ../.., and ../../..  The fourth possibility is
>>>> primarily in case ports ever grows a third level.  If none of
>>>> these paths exist, fall back to the old default of /usr/ports.
>>>>
>>>> This removes the need to set PORTSDIR explicitly (or via
>>>> wrapper script) if one is running out of a ports tree that is
>>>> not in /usr/ports, but in a home directory.
>>>>
>>>> Reviewed by:bapt, bdrewery (older version) CR: D799 MFC
>>>> after:  1 week Sponsored by:   Spectra Logic
>>>>
>>>
>>> Hi,
>>>
>>> I just refreshed my machines head r272349 and this change is
>>> creating problems to me.
>>>
>>> Maybe I've always been doing something wrong but this is what is
>>> happening:
>>>
>>> root@marvin:~ [0]# cd /usr/ports/x11/nvidia-driver
>>> root@marvin:/usr/ports/x11/nvidia-driver [0]# make -V PORTSDIR
>>> /usr/ports/x11/nvidia-driver/../..
>>>
>>> this is problematic since now all dependencies are relative
>>> paths, this is said to be unsupported in bsd.sanity.mk, line 35
>>> and following ones.
>>>
>>> It also makes poudriere builds fail:
>>>
>>> root@marvin:~ [0]# poudriere bulk -C -p mptest -t -j 11amd64
>>> x11/xlogo >> Creating the reference jail... done >>
>>> Mounting system devices for 11amd64-mptest >> Mounting
>>> ports/packages/distfiles >> Mounting packages from:
>>> /poudriere/data/packages/11amd64-mptest >> Logs:
>>> /poudriere/data/logs/bulk/11amd64-mptest/2014-10-01_16h44m56s
>>> >> WWW:
>>> http://pkg.madpilot.net:/logs/bulk/11amd64-mptest/2014-10-01_16h44m56s
>>>
>>>
>>>
> >> Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
>>> >> DEVELOPER=yes ignored from make.conf. Use 'bulk -t' or
>>> 'testport' for testing instead. /etc/resolv.conf ->
>>> /poudriere/data/build/11amd64-mptest/ref/etc/resolv.conf >>
>>> Starting jail 11amd64-mptest >> Loading MOVED >>
>>> Calculating ports order and dependencies >> Error:
>>> Duplicated origin for pkgconf-0.9.7:
>>> devel/xorg-macros/../../devel/pkgconf AND
>>> x11/xlogo/../../devel/pkgconf. Rerun with -vv to see which ports
>>> are depending on these. >> Cleaning up >> Umounting file
>>> systems
>>>
>>> (the ports nvidia-driver and xlogo in these small logs are taken
>>> at random)
>>>
>>> It also completely breaks portmaster.
>>>
>>> Maybe this patch is excessive and should first try to discover
>>> if we already are in the standard /usr/ports subtree?
>>>
>>> I have not tried but I'm quite confident I can :fix: this by
>>> adding PORTSTREE=/usr/ports in /etc/make.conf, but this does not
>>> look like a good solution.
>>>
>>> -- Guido Falsi 
>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2
>
> iQEcBAEBAgAGBQJULE/rAAoJEHyflib82/FGuM8IAInuaiLVvxrRG/th0Q/o8cQ2
> vFlBry7cDOVeibnYAcNzKmQBYjVD/XdwQYIJu5Hrpdwj1o6JVfUvlOQYZV++m/Yz
> G5zvwhqvBqgKMi95mZCXEqPDUXN241f627jnLYX6OrTnQRDqapELtMfdcVssXDMt
> jQcYK+0Q0F3CtHSQhUicwsUYIl2bff1uOS+vgGU/C/kvDwImla5XuCMf3WJHq87H
> P5X9yKADc5FzqXoCyaCN++cwHKYx0Dw9p1ym4rfX1VfbZrPjaBUsswxW55lcLQ5/
> 9BWJ1sGvcuXt82M9UkcIoxstL4+uQrH3B92MAgXVI49j1iB7u2+iFU2dgZCocZs=
> =Epd0
> -END PGP SIGNATURE-
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r272366 - head/sys/kern

2014-10-01 Thread Will Andrews
I think it depends on what kind of safety you're concerned about.

There's only one syncer; none of its state can be reclaimed behind its
back.  If additional work is added to its queue in the interim, it
will be processed as if it was already there at the start of the loop.

We've been running with this change for 2 years; I don't think any
issues have been reported with it.  I realize that's not a guarantee
that there isn't a problem.

However, this change does fix an issue where the system could deadlock
on shutdown because it's calling a watchdog callback that mallocs,
while holding sync_mtx.

--Will.

On Wed, Oct 1, 2014 at 9:40 AM, Davide Italiano  wrote:
> On Wed, Oct 1, 2014 at 8:32 AM, Will Andrews  wrote:
>> Author: will
>> Date: Wed Oct  1 15:32:28 2014
>> New Revision: 272366
>> URL: https://svnweb.freebsd.org/changeset/base/272366
>>
>> Log:
>>   In the syncer, drop the sync mutex while patting the watchdog.
>>
>>   Some watchdog drivers (like ipmi) need to sleep while patting the watchdog.
>>   See sys/dev/ipmi/ipmi.c:ipmi_wd_event(), which calls malloc(M_WAITOK).
>>
>>   Submitted by: asomers
>>   MFC after:1 month
>>   Sponsored by: Spectra Logic
>>   MFSpectraBSD: 637548 on 2012/10/04
>>
>> Modified:
>>   head/sys/kern/vfs_subr.c
>>
>> Modified: head/sys/kern/vfs_subr.c
>> ==
>> --- head/sys/kern/vfs_subr.cWed Oct  1 15:23:23 2014(r272365)
>> +++ head/sys/kern/vfs_subr.cWed Oct  1 15:32:28 2014(r272366)
>> @@ -1863,8 +1863,15 @@ sched_sync(void)
>> continue;
>> }
>>
>> -   if (first_printf == 0)
>> +   if (first_printf == 0) {
>> +   /*
>> +* Drop the sync mutex, because some watchdog
>> +* drivers need to sleep while patting
>> +*/
>> +   mtx_unlock(&sync_mtx);
>> wdog_kern_pat(WD_LASTVAL);
>> +   mtx_lock(&sync_mtx);
>> +   }
>>
>> }
>> if (syncer_state == SYNCER_FINAL_DELAY && syncer_final_iter 
>> > 0)
>>
>
> I introduced something like this back in the days when I was at iX but
> never convinced myself this is completely safe -- I assume you
> investigated about possible races opened by releasing the syncer
> mutex, and I would be happy if you can elaborate a bit more.
>
> --
> Davide
>
> "There are no solved problems; there are only problems that are more
> or less solved" -- Henri Poincare
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272371 - head/sys/sys

2014-10-01 Thread Will Andrews
Author: will
Date: Wed Oct  1 16:16:01 2014
New Revision: 272371
URL: https://svnweb.freebsd.org/changeset/base/272371

Log:
  Embellish a comment regarding the reliability of DEBUG_VFS_LOCKS.
  
  Submitted by: kib

Modified:
  head/sys/sys/vnode.h

Modified: head/sys/sys/vnode.h
==
--- head/sys/sys/vnode.hWed Oct  1 16:09:11 2014(r272370)
+++ head/sys/sys/vnode.hWed Oct  1 16:16:01 2014(r272371)
@@ -503,7 +503,9 @@ extern struct vnodeop_desc *vnodeop_desc
  * reliable since if the thread sleeps between changing the lock
  * state and checking it with the assert, some other thread could
  * change the state.  They are good enough for debugging a single
- * filesystem using a single-threaded test.
+ * filesystem using a single-threaded test.  Note that the unreliability is
+ * limited to false negatives; efforts were made to ensure that false
+ * positives cannot occur.
  */
 void   assert_vi_locked(struct vnode *vp, const char *str);
 void   assert_vi_unlocked(struct vnode *vp, const char *str);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272367 - head/sys/modules/zfs

2014-10-01 Thread Will Andrews
Author: will
Date: Wed Oct  1 15:34:48 2014
New Revision: 272367
URL: https://svnweb.freebsd.org/changeset/base/272367

Log:
  Instead of requiring an edit to turn on ZFS debugging, define ZFS_DEBUG.
  
  MFC after:1 month

Modified:
  head/sys/modules/zfs/Makefile

Modified: head/sys/modules/zfs/Makefile
==
--- head/sys/modules/zfs/Makefile   Wed Oct  1 15:32:28 2014
(r272366)
+++ head/sys/modules/zfs/Makefile   Wed Oct  1 15:34:48 2014
(r272367)
@@ -94,8 +94,10 @@ CFLAGS+=-DBUILDING_ZFS
 CFLAGS+=-mminimal-toc
 .endif
 
-#CFLAGS+=-DDEBUG=1
-#DEBUG_FLAGS=-g
+.ifdef ZFS_DEBUG
+CFLAGS+=-DDEBUG=1
+DEBUG_FLAGS=-g
+.endif
 
 .include 
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272366 - head/sys/kern

2014-10-01 Thread Will Andrews
Author: will
Date: Wed Oct  1 15:32:28 2014
New Revision: 272366
URL: https://svnweb.freebsd.org/changeset/base/272366

Log:
  In the syncer, drop the sync mutex while patting the watchdog.
  
  Some watchdog drivers (like ipmi) need to sleep while patting the watchdog.
  See sys/dev/ipmi/ipmi.c:ipmi_wd_event(), which calls malloc(M_WAITOK).
  
  Submitted by: asomers
  MFC after:1 month
  Sponsored by: Spectra Logic
  MFSpectraBSD: 637548 on 2012/10/04

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Oct  1 15:23:23 2014(r272365)
+++ head/sys/kern/vfs_subr.cWed Oct  1 15:32:28 2014(r272366)
@@ -1863,8 +1863,15 @@ sched_sync(void)
continue;
}
 
-   if (first_printf == 0)
+   if (first_printf == 0) {
+   /*
+* Drop the sync mutex, because some watchdog
+* drivers need to sleep while patting
+*/
+   mtx_unlock(&sync_mtx);
wdog_kern_pat(WD_LASTVAL);
+   mtx_lock(&sync_mtx);
+   }
 
}
if (syncer_state == SYNCER_FINAL_DELAY && syncer_final_iter > 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r272282 - head/share/mk

2014-10-01 Thread Will Andrews
If r272363 doesn't resolve the issue for you, let me know.

Thanks!
--Will.

On Wed, Oct 1, 2014 at 8:51 AM, Guido Falsi  wrote:
> On 09/29/14 17:05, Will Andrews wrote:
>> Author: will
>> Date: Mon Sep 29 15:05:23 2014
>> New Revision: 272282
>> URL: http://svnweb.freebsd.org/changeset/base/272282
>>
>> Log:
>>   Search for the nearest PORTSDIR where Mk/bsd.ports.mk exists, from .CURDIR.
>>   This will only take effect if PORTSDIR is not set, as previously supported.
>>
>>   Use .if exists(), for four specific possibilities relative to .CURDIR:
>>   ., .., ../.., and ../../..  The fourth possibility is primarily in case
>>   ports ever grows a third level.  If none of these paths exist, fall back to
>>   the old default of /usr/ports.
>>
>>   This removes the need to set PORTSDIR explicitly (or via wrapper script) if
>>   one is running out of a ports tree that is not in /usr/ports, but in a
>>   home directory.
>>
>>   Reviewed by:bapt, bdrewery (older version)
>>   CR: D799
>>   MFC after:  1 week
>>   Sponsored by:   Spectra Logic
>>
>
> Hi,
>
> I just refreshed my machines head r272349 and this change is creating
> problems to me.
>
> Maybe I've always been doing something wrong but this is what is happening:
>
> root@marvin:~ [0]# cd /usr/ports/x11/nvidia-driver
> root@marvin:/usr/ports/x11/nvidia-driver [0]# make -V PORTSDIR
> /usr/ports/x11/nvidia-driver/../..
>
> this is problematic since now all dependencies are relative paths, this
> is said to be unsupported in bsd.sanity.mk, line 35 and following ones.
>
> It also makes poudriere builds fail:
>
> root@marvin:~ [0]# poudriere bulk -C -p mptest -t -j 11amd64 x11/xlogo
> >> Creating the reference jail... done
> >> Mounting system devices for 11amd64-mptest
> >> Mounting ports/packages/distfiles
> >> Mounting packages from: /poudriere/data/packages/11amd64-mptest
> >> Logs: /poudriere/data/logs/bulk/11amd64-mptest/2014-10-01_16h44m56s
> >> WWW:
> http://pkg.madpilot.net:/logs/bulk/11amd64-mptest/2014-10-01_16h44m56s
> >> Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
> >> DEVELOPER=yes ignored from make.conf. Use 'bulk -t' or 'testport'
> for testing instead.
> /etc/resolv.conf -> /poudriere/data/build/11amd64-mptest/ref/etc/resolv.conf
> >> Starting jail 11amd64-mptest
> >> Loading MOVED
> >> Calculating ports order and dependencies
> >> Error: Duplicated origin for pkgconf-0.9.7:
> devel/xorg-macros/../../devel/pkgconf AND x11/xlogo/../../devel/pkgconf.
> Rerun with -vv to see which ports are depending on these.
> >> Cleaning up
> >> Umounting file systems
>
> (the ports nvidia-driver and xlogo in these small logs are taken at random)
>
> It also completely breaks portmaster.
>
> Maybe this patch is excessive and should first try to discover if we
> already are in the standard /usr/ports subtree?
>
> I have not tried but I'm quite confident I can :fix: this by adding
> PORTSTREE=/usr/ports in /etc/make.conf, but this does not look like a
> good solution.
>
> --
> Guido Falsi 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272363 - head/share/mk

2014-10-01 Thread Will Andrews
Author: will
Date: Wed Oct  1 15:02:37 2014
New Revision: 272363
URL: https://svnweb.freebsd.org/changeset/base/272363

Log:
  Always resolve PORTSDIR to absolute paths using realpath(1).
  
  Reported by:  madpilot
  Reviewed by:  bapt
  X-MFC-With:   272282

Modified:
  head/share/mk/bsd.port.mk
  head/share/mk/bsd.port.subdir.mk

Modified: head/share/mk/bsd.port.mk
==
--- head/share/mk/bsd.port.mk   Wed Oct  1 15:00:21 2014(r272362)
+++ head/share/mk/bsd.port.mk   Wed Oct  1 15:02:37 2014(r272363)
@@ -5,13 +5,13 @@
 # in the default /usr/ports.  The ../../.. case is in case ports ever grows
 # a third level.
 .if exists(${.CURDIR}/Mk/bsd.port.mk)
-PORTSDIR=  ${.CURDIR}
+PORTSDIR!= realpath ${.CURDIR}
 .elif exists(${.CURDIR}/../Mk/bsd.port.mk)
-PORTSDIR=  ${.CURDIR}/..
+PORTSDIR!= realpath ${.CURDIR}/..
 .elif exists(${.CURDIR}/../../Mk/bsd.port.mk)
-PORTSDIR=  ${.CURDIR}/../..
+PORTSDIR!= realpath ${.CURDIR}/../..
 .elif exists(${.CURDIR}/../../../Mk/bsd.port.mk)
-PORTSDIR=  ${.CURDIR}/../../..
+PORTSDIR!= realpath ${.CURDIR}/../../..
 .else
 PORTSDIR=  /usr/ports
 .endif

Modified: head/share/mk/bsd.port.subdir.mk
==
--- head/share/mk/bsd.port.subdir.mkWed Oct  1 15:00:21 2014
(r272362)
+++ head/share/mk/bsd.port.subdir.mkWed Oct  1 15:02:37 2014
(r272363)
@@ -5,13 +5,13 @@
 # in the default /usr/ports.  The ../../.. case is in case ports ever grows
 # a third level.
 .if exists(${.CURDIR}/Mk/bsd.port.mk)
-PORTSDIR=  ${.CURDIR}
+PORTSDIR!= realpath ${.CURDIR}
 .elif exists(${.CURDIR}/../Mk/bsd.port.mk)
-PORTSDIR=  ${.CURDIR}/..
+PORTSDIR!= realpath ${.CURDIR}/..
 .elif exists(${.CURDIR}/../../Mk/bsd.port.mk)
-PORTSDIR=  ${.CURDIR}/../..
+PORTSDIR!= realpath ${.CURDIR}/../..
 .elif exists(${.CURDIR}/../../../Mk/bsd.port.mk)
-PORTSDIR=  ${.CURDIR}/../../..
+PORTSDIR!= realpath ${.CURDIR}/../../..
 .else
 PORTSDIR=  /usr/ports
 .endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272360 - head/sys/dev/acpica/Osd

2014-10-01 Thread Will Andrews
Author: will
Date: Wed Oct  1 14:35:52 2014
New Revision: 272360
URL: https://svnweb.freebsd.org/changeset/base/272360

Log:
  Add sysctl to track the resource consumption of ACPI interrupts.
  
  Submitted by: gibbs
  MFC after:1 month
  Sponsored by: Spectra Logic
  MFSpectraBSD: 636827 on 2012/09/28

Modified:
  head/sys/dev/acpica/Osd/OsdSchedule.c

Modified: head/sys/dev/acpica/Osd/OsdSchedule.c
==
--- head/sys/dev/acpica/Osd/OsdSchedule.c   Wed Oct  1 14:12:02 2014
(r272359)
+++ head/sys/dev/acpica/Osd/OsdSchedule.c   Wed Oct  1 14:35:52 2014
(r272360)
@@ -60,6 +60,13 @@ SYSCTL_INT(_debug_acpi, OID_AUTO, max_ta
 0, "Maximum acpi tasks");
 
 /*
+ * Track and report the system's demand for task slots.
+ */
+static int acpi_tasks_hiwater;
+SYSCTL_INT(_debug_acpi, OID_AUTO, tasks_hiwater, CTLFLAG_RD,
+&acpi_tasks_hiwater, 1, "Peak demand for ACPI event task slots.");
+
+/*
  * Allow the user to tune the number of task threads we start.  It seems
  * some systems have problems with increased parallelism.
  */
@@ -151,6 +158,10 @@ acpi_task_enqueue(int priority, ACPI_OSD
acpi_task_count++;
break;
}
+
+if (i > acpi_tasks_hiwater)
+   atomic_cmpset_int(&acpi_tasks_hiwater, acpi_tasks_hiwater, i);
+
 if (at == NULL) {
printf("AcpiOsExecute: failed to enqueue task, consider increasing "
"the debug.acpi.max_tasks tunable\n");
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272359 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-10-01 Thread Will Andrews
Author: will
Date: Wed Oct  1 14:12:02 2014
New Revision: 272359
URL: https://svnweb.freebsd.org/changeset/base/272359

Log:
  zfsvfs_create(): Refuse to mount datasets whose names are too long.
  
  This is checked for in the zfs_snapshot_004_neg STF/ATF test (currently
  still in projects/zfsd rather than head).
  
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c:
  - zfsvfs_create(): Check whether the objset name fits into
statfs.f_mntfromname, and return ENAMETOOLONG if not.  Although
the filesystem can be unmounted via the umount(8) command, any
interface that relies on iterating on statfs (e.g. libzfs) will
fail to find the filesystem by its objset name, and thus assume
it's not mounted.  This causes "zfs unmount", "zfs destroy",
etc. to fail on these filesystems, whether or not -f is passed.
  
  MFC after:1 month
  Sponsored by: Spectra Logic
  MFSpectraBSD: 974872 on 2013/08/09

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cWed Oct 
 1 13:35:41 2014(r272358)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cWed Oct 
 1 14:12:02 2014(r272359)
@@ -870,6 +870,17 @@ zfsvfs_create(const char *osname, zfsvfs
int i, error;
uint64_t sa_obj;
 
+   /*
+* XXX: Fix struct statfs so this isn't necessary!
+*
+* The 'osname' is used as the filesystem's special node, which means
+* it must fit in statfs.f_mntfromname, or else it can't be
+* enumerated, so libzfs_mnttab_find() returns NULL, which causes
+* 'zfs unmount' to think it's not mounted when it is.
+*/
+   if (strlen(osname) >= MNAMELEN)
+   return (SET_ERROR(ENAMETOOLONG));
+
zfsvfs = kmem_zalloc(sizeof (zfsvfs_t), KM_SLEEP);
 
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272282 - head/share/mk

2014-09-29 Thread Will Andrews
Author: will
Date: Mon Sep 29 15:05:23 2014
New Revision: 272282
URL: http://svnweb.freebsd.org/changeset/base/272282

Log:
  Search for the nearest PORTSDIR where Mk/bsd.ports.mk exists, from .CURDIR.
  This will only take effect if PORTSDIR is not set, as previously supported.
  
  Use .if exists(), for four specific possibilities relative to .CURDIR:
  ., .., ../.., and ../../..  The fourth possibility is primarily in case
  ports ever grows a third level.  If none of these paths exist, fall back to
  the old default of /usr/ports.
  
  This removes the need to set PORTSDIR explicitly (or via wrapper script) if
  one is running out of a ports tree that is not in /usr/ports, but in a
  home directory.
  
  Reviewed by:  bapt, bdrewery (older version)
  CR:   D799
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/share/mk/bsd.port.mk
  head/share/mk/bsd.port.subdir.mk

Modified: head/share/mk/bsd.port.mk
==
--- head/share/mk/bsd.port.mk   Mon Sep 29 10:36:14 2014(r272281)
+++ head/share/mk/bsd.port.mk   Mon Sep 29 15:05:23 2014(r272282)
@@ -1,6 +1,22 @@
 # $FreeBSD$
 
-PORTSDIR?= /usr/ports
+.if !defined(PORTSDIR)
+# Autodetect if the command is being run in a ports tree that's not rooted
+# in the default /usr/ports.  The ../../.. case is in case ports ever grows
+# a third level.
+.if exists(${.CURDIR}/Mk/bsd.port.mk)
+PORTSDIR=  ${.CURDIR}
+.elif exists(${.CURDIR}/../Mk/bsd.port.mk)
+PORTSDIR=  ${.CURDIR}/..
+.elif exists(${.CURDIR}/../../Mk/bsd.port.mk)
+PORTSDIR=  ${.CURDIR}/../..
+.elif exists(${.CURDIR}/../../../Mk/bsd.port.mk)
+PORTSDIR=  ${.CURDIR}/../../..
+.else
+PORTSDIR=  /usr/ports
+.endif
+.endif
+
 BSDPORTMK?=${PORTSDIR}/Mk/bsd.port.mk
 
 # Needed to keep bsd.own.mk from reading in /etc/src.conf

Modified: head/share/mk/bsd.port.subdir.mk
==
--- head/share/mk/bsd.port.subdir.mkMon Sep 29 10:36:14 2014
(r272281)
+++ head/share/mk/bsd.port.subdir.mkMon Sep 29 15:05:23 2014
(r272282)
@@ -1,6 +1,22 @@
 # $FreeBSD$
 
-PORTSDIR?= /usr/ports
+.if !defined(PORTSDIR)
+# Autodetect if the command is being run in a ports tree that's not rooted
+# in the default /usr/ports.  The ../../.. case is in case ports ever grows
+# a third level.
+.if exists(${.CURDIR}/Mk/bsd.port.mk)
+PORTSDIR=  ${.CURDIR}
+.elif exists(${.CURDIR}/../Mk/bsd.port.mk)
+PORTSDIR=  ${.CURDIR}/..
+.elif exists(${.CURDIR}/../../Mk/bsd.port.mk)
+PORTSDIR=  ${.CURDIR}/../..
+.elif exists(${.CURDIR}/../../../Mk/bsd.port.mk)
+PORTSDIR=  ${.CURDIR}/../../..
+.else
+PORTSDIR=  /usr/ports
+.endif
+.endif
+
 BSDPORTSUBDIRMK?=  ${PORTSDIR}/Mk/bsd.port.subdir.mk
 
 .include "${BSDPORTSUBDIRMK}"
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r271771 - in head: bin/csh etc/mail lib/libc usr.bin/grep usr.sbin/mtree

2014-09-22 Thread Will Andrews
On Sat, Sep 20, 2014 at 1:38 AM, Bruce Evans  wrote:
> The log message is confused.  Source files are not being overwritten.
> They are being copied to object directories using cp.  Then if they
> are read-only in the source directory, they are read-only in the object
> directory, even if they are copied without -p so as to clobber their
> timestamps (their mode is still preserved).  Then if the source file's
> mtime is changed, either by actually changing the file or just by
> clobbering its mtime, the copy in the object directory becomes out of
> date.  Then the cp to make it up to date fails because it is read-only.

Yes, this is the more correct way of explaining the issue.  Thanks.

> Many makefiles avoid this problem by using cat instead of cp to copy
> the files.  I prefer using cp -p.  The above fixes the problem for
> a makefile that uses cp (without -p) by adding -f.  This causes the file
> to be unlinked before a new copy is made.  If the object directory is
> in the source tree (most likely since it is the source directory) and
> the source files are read-only, then this would often fail because the
> source directory is also read-only, but then it can't reasonably be
> an object directory.

The problem with 'cp -p' is that it doesn't work either.  Try it
(twice) with a read-only file -- I get EPERM when I try the second
time.  cp -p also doesn't work with NFS targets if the file happens to
have flags.

In the case of .CURDIR == .OBJDIR, the file would satisfy the
dependency and thus not be overwritten with itself.  In any case, this
is about read-only *files* anyway, not read-only directories, since as
you point out, the latter are unusable as object directories.

--Will.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r271788 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-09-19 Thread Will Andrews
I found that neither TUNABLE_INT nor CTLFLAG_RWTUN work with this
particular implementation of the tunable, so there is a regression
that needs to be fixed (i.e. vfs.zfs.debug_flags always comes up 0 no
matter what's in loader.conf).  I believe it's limited to this
particular tunable, however, because I tested another SYSCTL_PROC that
had CTLFLAG_TUN set and it worked.

--Will.

On Fri, Sep 19, 2014 at 10:34 AM, John Baldwin  wrote:
> On Thursday, September 18, 2014 06:37:28 PM Steven Hartland wrote:
>> You don't need a seperate TUNABLE_INT declations any more since the
>> excellent SYSCTL refactor.
>
> That is my fault.  I wasn't certain if SYSCTL_PROC() would work correctly when
> Will asked me on IRC, but it seems it does so long as the tunable type is one
> it knows how to parse (e.g. CTLTYPE_INT).  If your sysctl wants a "blob"
> (CTLTYPE_OPAQUE or the like), then you still need your own tunable fetching
> handler.
>
> --
> John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271798 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 18:46:38 2014
New Revision: 271798
URL: http://svnweb.freebsd.org/changeset/base/271798

Log:
  Remove debug.zfs_flags in favor of the new vfs.zfs.debug_flags.
  Replace TUNABLE_INT with CTLFLAG_RWTUN.
  
  Submitted by: avg (debug.zfs_flags removal), smh (TUNABLE_INT replacement)

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Thu Sep 
18 17:39:04 2014(r271797)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Thu Sep 
18 18:46:38 2014(r271798)
@@ -243,9 +243,6 @@ int zfs_flags = ~(ZFS_DEBUG_DPRINTF | ZF
 #else
 int zfs_flags = 0;
 #endif
-SYSCTL_DECL(_debug);
-SYSCTL_INT(_debug, OID_AUTO, zfs_flags, CTLFLAG_RWTUN, &zfs_flags, 0,
-"ZFS debug flags.");
 
 /*
  * zfs_recover can be set to nonzero to attempt to recover from
@@ -281,9 +278,8 @@ sysctl_vfs_zfs_debug_flags(SYSCTL_HANDLE
 
return (0);
 }
-TUNABLE_INT("vfs.zfs.debug_flags", &zfs_flags);
 SYSCTL_PROC(_vfs_zfs, OID_AUTO, debug_flags,
-CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(int),
+CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RWTUN, 0, sizeof(int),
 sysctl_vfs_zfs_debug_flags, "IU", "Debug flags for ZFS testing.");
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271796 - head/tools/regression/pjdfstest

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 17:37:19 2014
New Revision: 271796
URL: http://svnweb.freebsd.org/changeset/base/271796

Log:
  Use 'cc' for the C compiler instead of 'gcc'.
  
  MFC after:1 week
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1079507 on 2014/07/24

Modified:
  head/tools/regression/pjdfstest/Makefile

Modified: head/tools/regression/pjdfstest/Makefile
==
--- head/tools/regression/pjdfstest/MakefileThu Sep 18 17:28:21 2014
(r271795)
+++ head/tools/regression/pjdfstest/MakefileThu Sep 18 17:37:19 2014
(r271796)
@@ -18,7 +18,7 @@ ${PROG}:  ${PROG}.c
echo "Unsupported operating system: ${OSTYPE}."; \
exit 1; \
fi; \
-   cmd="gcc -Wall $$CFLAGS ${PROG}.c -o ${PROG}"; \
+   cmd="cc -Wall $$CFLAGS ${PROG}.c -o ${PROG}"; \
echo $$cmd; \
$$cmd
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271795 - head/sys/dev/firewire

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 17:28:21 2014
New Revision: 271795
URL: http://svnweb.freebsd.org/changeset/base/271795

Log:
  Start the process of cleaning up FreeBSD's firewire driver.
  
  sys/dev/firewire/firewire.c:
  sys/dev/firewire/firewire.h:
  sys/dev/firewire/firewirereg.h:
  sys/dev/firewire/fwcrom.c:
  sys/dev/firewire/fwdev.c:
  sys/dev/firewire/fwdma.c:
  sys/dev/firewire/fwmem.c:
  sys/dev/firewire/fwohci.c:
  sys/dev/firewire/fwohci_pci.c:
  sys/dev/firewire/fwohcivar.h:
  sys/dev/firewire/if_fwe.c:
  sys/dev/firewire/if_fwip.c:
  sys/dev/firewire/sbp.c:
  sys/dev/firewire/sbp_targ.c:
Unifdef the code, removing support for DragonflyBSD
and FreeBSD prior to version 5.
  
  Submitted by: gibbs
  MFC after:1 month
  Sponsored by: Spectra Logic
  MFSpectraBSD: 1081188 on 2014/08/01

Modified:
  head/sys/dev/firewire/firewire.c
  head/sys/dev/firewire/firewire.h
  head/sys/dev/firewire/firewirereg.h
  head/sys/dev/firewire/fwcrom.c
  head/sys/dev/firewire/fwdev.c
  head/sys/dev/firewire/fwdma.c
  head/sys/dev/firewire/fwmem.c
  head/sys/dev/firewire/fwohci.c
  head/sys/dev/firewire/fwohci_pci.c
  head/sys/dev/firewire/fwohcivar.h
  head/sys/dev/firewire/if_fwe.c
  head/sys/dev/firewire/if_fwip.c
  head/sys/dev/firewire/sbp.c
  head/sys/dev/firewire/sbp_targ.c

Modified: head/sys/dev/firewire/firewire.c
==
--- head/sys/dev/firewire/firewire.cThu Sep 18 17:25:20 2014
(r271794)
+++ head/sys/dev/firewire/firewire.cThu Sep 18 17:28:21 2014
(r271795)
@@ -49,26 +49,14 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#if defined(__DragonFly__) || __FreeBSD_version < 50
-#include  /* for DELAY() */
-#endif
-
 #include/* used by smbus and newbus */
 #include 
 
-#ifdef __DragonFly__
-#include "firewire.h"
-#include "firewirereg.h"
-#include "fwmem.h"
-#include "iec13213.h"
-#include "iec68113.h"
-#else
 #include 
 #include 
 #include 
 #include 
 #include 
-#endif
 
 struct crom_src_buf {
struct crom_src src;
@@ -99,9 +87,6 @@ static int firewire_attach  (device_
 static int firewire_detach  (device_t);
 static int firewire_resume  (device_t);
 static void firewire_xfer_timeout(void *, int);
-#if 0
-static int firewire_shutdown(device_t);
-#endif
 static device_t firewire_add_child(device_t, u_int, const char *, int);
 static void fw_try_bmr (void *);
 static void fw_try_bmr_callback (struct fw_xfer *);
@@ -563,14 +548,6 @@ firewire_detach(device_t dev)
mtx_destroy(&fc->wait_lock);
return(0);
 }
-#if 0
-static int
-firewire_shutdown( device_t dev )
-{
-   return 0;
-}
-#endif
-
 
 static void
 fw_xferq_drain(struct fw_xferq *xferq)
@@ -1052,7 +1029,7 @@ fw_tl_free(struct firewire_comm *fc, str
mtx_unlock(&fc->tlabel_lock);
return;
}
-#if 1  /* make sure the label is allocated */
+   /* make sure the label is allocated */
STAILQ_FOREACH(txfer, &fc->tlabels[xfer->tl], tlabel)
if(txfer == xfer)
break;
@@ -1067,7 +1044,6 @@ fw_tl_free(struct firewire_comm *fc, str
splx(s);
return;
}
-#endif
 
STAILQ_REMOVE(&fc->tlabels[xfer->tl], xfer, fw_xfer, tlabel);
xfer->tl = -1;

Modified: head/sys/dev/firewire/firewire.h
==
--- head/sys/dev/firewire/firewire.hThu Sep 18 17:25:20 2014
(r271794)
+++ head/sys/dev/firewire/firewire.hThu Sep 18 17:28:21 2014
(r271795)
@@ -454,11 +454,6 @@ struct fw_crom_buf {
 
 #define FWMAXNDMA 0x100 /* 8 bits DMA channel id. in device No. */
 
-#if defined(__DragonFly__) || __FreeBSD_version < 50
-#define dev2unit(x)((minor(x) & 0xff) | (minor(x) >> 8))
-#define unit2minor(x)  (((x) & 0xff) | (((x) << 8) & ~0x))
-#endif
-
 #define MAKEMINOR(f, u, s) \
((f) | (((u) & 0xff) << 8) | (s & 0xff))
 #define DEV2UNIT(x)((dev2unit(x) & 0xff00) >> 8)

Modified: head/sys/dev/firewire/firewirereg.h
==
--- head/sys/dev/firewire/firewirereg.h Thu Sep 18 17:25:20 2014
(r271794)
+++ head/sys/dev/firewire/firewirereg.h Thu Sep 18 17:28:21 2014
(r271795)
@@ -75,9 +75,7 @@ struct fw_device{
 };
 
 struct firewire_softc {
-#if defined(__FreeBSD__) && __FreeBSD_version >= 50
struct cdev *dev;
-#endif
struct firewire_comm *fc;
 };
 
@@ -303,36 +301,9 @@ extern int firewire_debug;
 extern devclass_t firewire_devclass;
 extern int firewire_phydma_enable;
 
-#ifdef __DragonFly__
-#defineFWPRI   PCATCH
-#else
 #defineFWPRI   ((PZERO+8)|PCATCH)
-#endif
 
-#if defined(__DragonFly__) || __FreeBSD_version < 50
-#define CALLOUT_INIT(x) callout_init(x)
-#else
 #define CALLOUT_INIT(x) callout_init(x, 1 /* mpsafe */

svn commit: r271793 - head/sys/dev/firewire

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 17:22:42 2014
New Revision: 271793
URL: http://svnweb.freebsd.org/changeset/base/271793

Log:
  Silence noisy firewire logging.
  
  MFC after:1 month
  Sponsored by: Spectra Logic
  MFSpectraBSD: 974594 on 2013/08/02

Modified:
  head/sys/dev/firewire/firewire.c
  head/sys/dev/firewire/fwohci.c

Modified: head/sys/dev/firewire/firewire.c
==
--- head/sys/dev/firewire/firewire.cThu Sep 18 17:18:42 2014
(r271792)
+++ head/sys/dev/firewire/firewire.cThu Sep 18 17:22:42 2014
(r271793)
@@ -1560,8 +1560,6 @@ fw_explore_node(struct fw_device *dfwdev
/* First quad */
err = fw_explore_read_quads(dfwdev, CSRROMOFF, &csr[0], 1);
if (err) {
-   device_printf(fc->bdev, "%s: node%d: explore_read_quads 
failure\n",
-   __func__, node);
dfwdev->status = FWDEVINVAL;
return (-1);
}
@@ -1577,15 +1575,11 @@ fw_explore_node(struct fw_device *dfwdev
/* bus info */
err = fw_explore_read_quads(dfwdev, CSRROMOFF + 0x04, &csr[1], 4);
if (err) {
-   device_printf(fc->bdev, "%s: node%d: error reading 0x04\n",
-   __func__, node);
dfwdev->status = FWDEVINVAL;
return (-1);
}
binfo = (struct bus_info *)&csr[1];
if (binfo->bus_name != CSR_BUS_NAME_IEEE1394) {
-   device_printf(fc->bdev, "%s: node%d: invalid bus name 0x%08x\n",
-   __func__, node, binfo->bus_name);
dfwdev->status = FWDEVINVAL;
return (-1);
}
@@ -1668,10 +1662,6 @@ fw_explore_node(struct fw_device *dfwdev
STAILQ_INSERT_HEAD(&fc->devices, fwdev, link);
else
STAILQ_INSERT_AFTER(&fc->devices, pfwdev, fwdev, link);
-
-   device_printf(fc->bdev, "New %s device ID:%08x%08x\n",
-   linkspeed[fwdev->speed],
-   fwdev->eui.hi, fwdev->eui.lo);
} else {
fwdev->dst = node;
fwdev->status = FWDEVINIT;
@@ -1828,9 +1818,6 @@ fw_attach_dev(struct firewire_comm *fc)
 * Remove devices which have not been seen
 * for a while.
 */
-   device_printf(fc->bdev, "%s:"
-   "Removing missing device ID:%08x%08x\n",
-   __func__, fwdev->eui.hi, fwdev->eui.lo);
STAILQ_REMOVE(&fc->devices, fwdev, fw_device,
link);
free(fwdev, M_FW);

Modified: head/sys/dev/firewire/fwohci.c
==
--- head/sys/dev/firewire/fwohci.c  Thu Sep 18 17:18:42 2014
(r271792)
+++ head/sys/dev/firewire/fwohci.c  Thu Sep 18 17:22:42 2014
(r271793)
@@ -1126,12 +1126,10 @@ fwohci_txd(struct fwohci_softc *sc, stru
case FWOHCIEV_ACKBSA:
case FWOHCIEV_ACKBSB:
case FWOHCIEV_ACKBSX:
-   device_printf(sc->fc.dev, "txd err=%2x %s\n", stat, 
fwohcicode[stat]);
err = EBUSY;
break;
case FWOHCIEV_FLUSHED:
case FWOHCIEV_ACKTARD:
-   device_printf(sc->fc.dev, "txd err=%2x %s\n", stat, 
fwohcicode[stat]);
err = EAGAIN;
break;
case FWOHCIEV_MISSACK:
@@ -1145,8 +1143,6 @@ fwohci_txd(struct fwohci_softc *sc, stru
case FWOHCIEV_ACKDERR:
case FWOHCIEV_ACKTERR:
default:
-   device_printf(sc->fc.dev, "txd err=%2x %s\n",
-   stat, fwohcicode[stat]);
err = EINVAL;
break;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r271788 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-09-18 Thread Will Andrews
Which one is more idiomatic?  Sorry, I never noticed that one.

Thanks,
--Will.

On Thu, Sep 18, 2014 at 11:03 AM, Andriy Gapon  wrote:
> On 18/09/2014 19:55, Will Andrews wrote:
>> Author: will
>> Date: Thu Sep 18 16:55:41 2014
>> New Revision: 271788
>> URL: http://svnweb.freebsd.org/changeset/base/271788
>>
>> Log:
>>   Enable ZFS debug flags to be modified via vfs.zfs.debug_flags.
>>
>>   This is primarily only of interest to ZFS developers, but it makes it
>>   easier to get additional debugging.
>>
>>   Submitted by:   gibbs
>>   MFC after:  1 month
>>   Sponsored by:   Spectra Logic
>>   MFSpectraBSD:   517074 on 2011/12/15 (by will), 662343 on 2013/03/20 
>> (by gibbs)
>
> zfs_flags was already accessible via debug.zfs_flags sysctl and tunable.
> That should probably be removed now?
>
>> Modified:
>>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
>>
>> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
>> ==
>> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.cThu 
>> Sep 18 16:53:44 2014(r271787)
>> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.cThu 
>> Sep 18 16:55:41 2014(r271788)
>> @@ -259,6 +259,33 @@ SYSCTL_DECL(_vfs_zfs);
>>  SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RDTUN, &zfs_recover, 0,
>>  "Try to recover from otherwise-fatal errors.");
>>
>> +static int
>> +sysctl_vfs_zfs_debug_flags(SYSCTL_HANDLER_ARGS)
>> +{
>> + int err, val;
>> +
>> + val = zfs_flags;
>> + err = sysctl_handle_int(oidp, &val, 0, req);
>> + if (err != 0 || req->newptr == NULL)
>> + return (err);
>> +
>> + /*
>> +  * ZFS_DEBUG_MODIFY must be enabled prior to boot so all
>> +  * arc buffers in the system have the necessary additional
>> +  * checksum data.  However, it is safe to disable at any
>> +  * time.
>> +  */
>> + if (!(zfs_flags & ZFS_DEBUG_MODIFY))
>> + val &= ~ZFS_DEBUG_MODIFY;
>> + zfs_flags = val;
>> +
>> + return (0);
>> +}
>> +TUNABLE_INT("vfs.zfs.debug_flags", &zfs_flags);
>> +SYSCTL_PROC(_vfs_zfs, OID_AUTO, debug_flags,
>> +CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(int),
>> +sysctl_vfs_zfs_debug_flags, "IU", "Debug flags for ZFS testing.");
>> +
>>  /*
>>   * If destroy encounters an EIO while reading metadata (e.g. indirect
>>   * blocks), space referenced by the missing metadata can not be freed.
>>
>
>
> --
> Andriy Gapon
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271788 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 16:55:41 2014
New Revision: 271788
URL: http://svnweb.freebsd.org/changeset/base/271788

Log:
  Enable ZFS debug flags to be modified via vfs.zfs.debug_flags.
  
  This is primarily only of interest to ZFS developers, but it makes it
  easier to get additional debugging.
  
  Submitted by: gibbs
  MFC after:1 month
  Sponsored by: Spectra Logic
  MFSpectraBSD: 517074 on 2011/12/15 (by will), 662343 on 2013/03/20 (by gibbs)

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Thu Sep 
18 16:53:44 2014(r271787)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Thu Sep 
18 16:55:41 2014(r271788)
@@ -259,6 +259,33 @@ SYSCTL_DECL(_vfs_zfs);
 SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RDTUN, &zfs_recover, 0,
 "Try to recover from otherwise-fatal errors.");
 
+static int
+sysctl_vfs_zfs_debug_flags(SYSCTL_HANDLER_ARGS)
+{
+   int err, val;
+
+   val = zfs_flags;
+   err = sysctl_handle_int(oidp, &val, 0, req);
+   if (err != 0 || req->newptr == NULL)
+   return (err);
+
+   /*
+* ZFS_DEBUG_MODIFY must be enabled prior to boot so all
+* arc buffers in the system have the necessary additional
+* checksum data.  However, it is safe to disable at any
+* time.
+*/
+   if (!(zfs_flags & ZFS_DEBUG_MODIFY))
+   val &= ~ZFS_DEBUG_MODIFY;
+   zfs_flags = val;
+
+   return (0);
+}
+TUNABLE_INT("vfs.zfs.debug_flags", &zfs_flags);
+SYSCTL_PROC(_vfs_zfs, OID_AUTO, debug_flags,
+CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(int),
+sysctl_vfs_zfs_debug_flags, "IU", "Debug flags for ZFS testing.");
+
 /*
  * If destroy encounters an EIO while reading metadata (e.g. indirect
  * blocks), space referenced by the missing metadata can not be freed.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271785 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 16:38:03 2014
New Revision: 271785
URL: http://svnweb.freebsd.org/changeset/base/271785

Log:
  Reorder sysctls for spa.c global tunables; add sysctl for ccw_retry_interval.
  
  MFC after:1 month
  Sponsored by: Spectra Logic

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Thu Sep 18 
16:20:17 2014(r271784)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Thu Sep 18 
16:38:03 2014(r271785)
@@ -83,16 +83,20 @@
 /* Check hostid on import? */
 static int check_hostid = 1;
 
-SYSCTL_DECL(_vfs_zfs);
-SYSCTL_INT(_vfs_zfs, OID_AUTO, check_hostid, CTLFLAG_RWTUN, &check_hostid, 0,
-"Check hostid on import?");
-
 /*
  * The interval, in seconds, at which failed configuration cache file writes
  * should be retried.
  */
 static int zfs_ccw_retry_interval = 300;
 
+SYSCTL_DECL(_vfs_zfs);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, check_hostid, CTLFLAG_RWTUN, &check_hostid, 0,
+"Check hostid on import?");
+TUNABLE_INT("vfs.zfs.ccw_retry_interval", &zfs_ccw_retry_interval);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, ccw_retry_interval, CTLFLAG_RW,
+&zfs_ccw_retry_interval, 0,
+"Configuration cache file write, retry after failure, interval (seconds)");
+
 typedef enum zti_modes {
ZTI_MODE_FIXED, /* value is # of threads (min 1) */
ZTI_MODE_BATCH, /* cpu-intensive; value is ignored */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271781 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 15:37:53 2014
New Revision: 271781
URL: http://svnweb.freebsd.org/changeset/base/271781

Log:
  bpobj_iterate_impl(): Close a refcount leak iterating on a sublist.
  
  If bpobj_space() returned non-zero here, the sublist would have been
  left open, along with the bonus buffer hold it requires.  This call
  does not invoke any calls to bpobj_close() itself.
  
  This bug doesn't have any known vector, but was found on inspection.
  
  MFC after:1 week
  Sponsored by: Spectra Logic
  Affects:  All ZFS versions starting 21 May 2010 (illumos cde58dbc)
  MFSpectraBSD: r1050998 on 2014/03/26

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c Thu Sep 18 
15:26:12 2014(r271780)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c Thu Sep 18 
15:37:53 2014(r271781)
@@ -301,8 +301,10 @@ bpobj_iterate_impl(bpobj_t *bpo, bpobj_i
if (free) {
err = bpobj_space(&sublist,
&used_before, &comp_before, &uncomp_before);
-   if (err)
+   if (err != 0) {
+   bpobj_close(&sublist);
break;
+   }
}
err = bpobj_iterate_impl(&sublist, func, arg, tx, free);
if (free) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271778 - head/lib/libunbound

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 14:54:20 2014
New Revision: 271778
URL: http://svnweb.freebsd.org/changeset/base/271778

Log:
  Fix incremental builds involving non-root users with read-only source files.
  This is a followup commit to r271771.
  
  MFC after:1 month

Modified:
  head/lib/libunbound/Makefile

Modified: head/lib/libunbound/Makefile
==
--- head/lib/libunbound/MakefileThu Sep 18 14:53:30 2014
(r271777)
+++ head/lib/libunbound/MakefileThu Sep 18 14:54:20 2014
(r271778)
@@ -33,7 +33,7 @@ LDADD+=   -lssl -lcrypto -lpthread
 
 # Misnamed file in upstream source
 configlexer.l: configlexer.lex
-   cp -p ${.ALLSRC} ${.TARGET}
+   cp -fp ${.ALLSRC} ${.TARGET}
 CLEANFILES+= configlexer.l
 
 # Symbol prefix for lex and yacc
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271775 - head/kerberos5/lib/libasn1

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 14:50:21 2014
New Revision: 271775
URL: http://svnweb.freebsd.org/changeset/base/271775

Log:
  Fix incremental builds involving non-root users with read-only source files.
  This is a followup commit to r271771.
  
  MFC after:1 month

Modified:
  head/kerberos5/lib/libasn1/Makefile

Modified: head/kerberos5/lib/libasn1/Makefile
==
--- head/kerberos5/lib/libasn1/Makefile Thu Sep 18 14:47:13 2014
(r271774)
+++ head/kerberos5/lib/libasn1/Makefile Thu Sep 18 14:50:21 2014
(r271775)
@@ -112,10 +112,10 @@ ${GEN_KX509}: kx509.asn1
 .SUFFIXES: .h .c .x .hx
 
 .x.c:
-   cp ${.IMPSRC} ${.TARGET}
+   cp -f ${.IMPSRC} ${.TARGET}
 
 .hx.h:
-   cp ${.IMPSRC} ${.TARGET}
+   cp -f ${.IMPSRC} ${.TARGET}

 .include 
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271771 - in head: bin/csh etc/mail lib/libc usr.bin/grep usr.sbin/mtree

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 14:41:57 2014
New Revision: 271771
URL: http://svnweb.freebsd.org/changeset/base/271771

Log:
  Fix incremental builds involving non-root users with read-only source files.
  
  Makefiles should not assume that source files can be overwritten.  This is the
  common case for Perforce source trees.
  
  This is a followup commit to r211243 in the same vein.
  
  MFC after:1 month
  Sponsored by: Spectra Logic
  MFSpectraBSD: r1036319 on 2014/01/29, r1046711 on 2014/03/06

Modified:
  head/bin/csh/Makefile
  head/etc/mail/Makefile
  head/lib/libc/Makefile
  head/usr.bin/grep/Makefile
  head/usr.sbin/mtree/Makefile

Modified: head/bin/csh/Makefile
==
--- head/bin/csh/Makefile   Thu Sep 18 14:38:28 2014(r271770)
+++ head/bin/csh/Makefile   Thu Sep 18 14:41:57 2014(r271771)
@@ -94,7 +94,7 @@ GENHDRS+= iconv.h
 SRCS+= iconv_stub.c
 
 iconv.h: ${.CURDIR}/iconv_stub.h
-   cp ${.CURDIR}/iconv_stub.h ${.TARGET}
+   cp -f ${.CURDIR}/iconv_stub.h ${.TARGET}
 .endif
 .endif
 

Modified: head/etc/mail/Makefile
==
--- head/etc/mail/Makefile  Thu Sep 18 14:38:28 2014(r271770)
+++ head/etc/mail/Makefile  Thu Sep 18 14:41:57 2014(r271771)
@@ -69,7 +69,7 @@ SENDMAIL_MC!=   hostname
 SENDMAIL_MC:=   ${SENDMAIL_MC}.mc
 
 ${SENDMAIL_MC}:
-   cp freebsd.mc ${SENDMAIL_MC}
+   cp -f freebsd.mc ${SENDMAIL_MC}
 .endif
 
 .ifndef SENDMAIL_SUBMIT_MC
@@ -77,7 +77,7 @@ SENDMAIL_SUBMIT_MC!=  hostname
 SENDMAIL_SUBMIT_MC:=   ${SENDMAIL_SUBMIT_MC}.submit.mc
 
 ${SENDMAIL_SUBMIT_MC}:
-   cp freebsd.submit.mc ${SENDMAIL_SUBMIT_MC}
+   cp -f freebsd.submit.mc ${SENDMAIL_SUBMIT_MC}
 .endif
 
 INSTALL_CF=${SENDMAIL_MC:R}.cf

Modified: head/lib/libc/Makefile
==
--- head/lib/libc/Makefile  Thu Sep 18 14:38:28 2014(r271770)
+++ head/lib/libc/Makefile  Thu Sep 18 14:41:57 2014(r271771)
@@ -151,11 +151,11 @@ KSRCS=bcmp.c ffs.c ffsl.c fls.c flsl.c 
 libkern: libkern.gen libkern.${LIBC_ARCH}
 
 libkern.gen: ${KQSRCS} ${KSRCS}
-   cp -p ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
+   cp -fp ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
 
 libkern.${LIBC_ARCH}:: ${KMSRCS}
 .if defined(KMSRCS) && !empty(KMSRCS)
-   cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
+   cp -fp ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
 .endif
 
 .include 

Modified: head/usr.bin/grep/Makefile
==
--- head/usr.bin/grep/Makefile  Thu Sep 18 14:38:28 2014(r271770)
+++ head/usr.bin/grep/Makefile  Thu Sep 18 14:41:57 2014(r271771)
@@ -11,7 +11,7 @@ PROG= bsdgrep
 CLEANFILES+= bsdgrep.1
 
 bsdgrep.1: grep.1
-   cp ${.ALLSRC} ${.TARGET}
+   cp -f ${.ALLSRC} ${.TARGET}
 .endif
 SRCS=  file.c grep.c queue.c util.c
 

Modified: head/usr.sbin/mtree/Makefile
==
--- head/usr.sbin/mtree/MakefileThu Sep 18 14:38:28 2014
(r271770)
+++ head/usr.sbin/mtree/MakefileThu Sep 18 14:41:57 2014
(r271771)
@@ -17,6 +17,6 @@ LDADD=-lmd
 CLEANFILES+=   fmtree.8
 
 fmtree.8: mtree.8
-   cp ${.ALLSRC} ${.TARGET}
+   cp -f ${.ALLSRC} ${.TARGET}
 
 .include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271764 - head/cddl/contrib/opensolaris/lib/libzfs/common

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 14:09:42 2014
New Revision: 271764
URL: http://svnweb.freebsd.org/changeset/base/271764

Log:
  zfs_setprop_error(): Handle errno value E2BIG.
  
  This errno value is emitted by dsl_props_set_check() in
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c, and
  is used to mean that the property value is too long.  For the record,
  the maximum length is ZAP_MAXVALUELEN, which is 8*1024 bytes.
  
  Instead of claiming an unknown error (and abort()ing), provide
  something more specific to the scenario involved.  As far as I
  can tell, E2BIG is not emitted for any other scenario.
  
  MFC after:1 week
  Sponsored by: Spectra Logic
  Affects:  All ZFS versions starting 27 Feb 2009 (illumos ccba0801)
This change modified the value returned by
dsl_props_set_check(), so that it can distinguish between
a name that's too long and a value that's too long, but
libzfs was not updated accordingly.
  MFSpectraBSD: r1051499 on 2014/03/28 11:07:59

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cThu Sep 
18 14:02:25 2014(r271763)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cThu Sep 
18 14:09:42 2014(r271764)
@@ -1457,6 +1457,12 @@ zfs_setprop_error(libzfs_handle_t *hdl, 
(void) zfs_error(hdl, EZFS_DSREADONLY, errbuf);
break;
 
+   case E2BIG:
+   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+   "property value too long"));
+   (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
+   break;
+
case ENOTSUP:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"pool and or dataset must be upgraded to set this "
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271763 - head/cddl/contrib/opensolaris/cmd/zpool

2014-09-18 Thread Will Andrews
Author: will
Date: Thu Sep 18 14:02:25 2014
New Revision: 271763
URL: http://svnweb.freebsd.org/changeset/base/271763

Log:
  Fix an assert to tolerate spare parents with more than 2 children.
  
  This can occur if a spare is being spared, which would yield three
  children: the original pool drive, the previous spare, and the spare
  that is replacing it.
  
  MFC after:1 week
  Sponsored by: Spectra Logic
  Affects:  All ZFS versions starting 7 Jun 2006 (illumos 94de1d4c)
  MFSpectraBSD: r668345 on 2013/06/04 17:10:43

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.cThu Sep 18 
13:59:36 2014(r271762)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.cThu Sep 18 
14:02:25 2014(r271763)
@@ -653,6 +653,7 @@ get_replication(nvlist_t *nvroot, boolea
dontreport = 0;
vdev_size = -1ULL;
for (c = 0; c < children; c++) {
+   boolean_t is_replacing, is_spare;
nvlist_t *cnv = child[c];
char *path;
struct stat64 statbuf;
@@ -669,16 +670,19 @@ get_replication(nvlist_t *nvroot, boolea
 * If this is a replacing or spare vdev, then
 * get the real first child of the vdev.
 */
-   if (strcmp(childtype,
-   VDEV_TYPE_REPLACING) == 0 ||
-   strcmp(childtype, VDEV_TYPE_SPARE) == 0) {
+   is_replacing = strcmp(childtype,
+   VDEV_TYPE_REPLACING) == 0;
+   is_spare = strcmp(childtype,
+   VDEV_TYPE_SPARE) == 0;
+   if (is_replacing || is_spare) {
nvlist_t **rchild;
uint_t rchildren;
 
verify(nvlist_lookup_nvlist_array(cnv,
ZPOOL_CONFIG_CHILDREN, &rchild,
&rchildren) == 0);
-   assert(rchildren == 2);
+   assert((is_replacing && rchildren == 2)
+   || (is_spare && rchildren >= 2));
cnv = rchild[0];
 
verify(nvlist_lookup_string(cnv,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


  1   2   >