Re: svn commit: r351831 - in head: . stand/efi/boot1 stand/efi/gptboot tools/build/mk

2019-09-04 Thread Dimitry Andric
On 4 Sep 2019, at 22:55, Rebecca Cran  wrote:
> 
> Author: bcran
> Date: Wed Sep  4 20:55:48 2019
> New Revision: 351831
> URL: https://svnweb.freebsd.org/changeset/base/351831
> 
> Log:
>  The efifat files are no longer used: remove the code to build them
> 
>  Reviewed by: imp, tsoome, emaste
>  Differential Revision:   https://reviews.freebsd.org/D20562

So what are now the instructions for updating an EFI partition, after a
buildworld?  I used to find that efifat file quite handy, I could just
use gpart -p to write it into the EFI partition... :-/

-Dimitry



signature.asc
Description: Message signed with OpenPGP


svn commit: r351836 - in head: etc/mtree usr.bin/patch usr.bin/patch/tests

2019-09-04 Thread Kyle Evans
Author: kevans
Date: Thu Sep  5 03:16:14 2019
New Revision: 351836
URL: https://svnweb.freebsd.org/changeset/base/351836

Log:
  patch(1): add some basic tests
  
  Summary:
  - basic: test application of patches created by diff -u at the
beginning/middle/end of file, which have differing amounts of context
before and after chunks being added
  - limited_ctx: stems from PR 74127 in which a rogue line was getting added
when the patch should have been rejected. Similar behavior was
reproducible with larger contexts near the beginning/end of a file. See
r326084 for details
  - file_creation: patch sourced from /dev/null should create the file
  - file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents
when re-applied (personal vendetta, WIP, see comment)
  - file_removal: this follows from nodupe; the reverse of a patch sourced
from /dev/null is most naturally deleting the file, as is expected based
on GNU patch behavior (WIP)

Added:
  head/usr.bin/patch/tests/
  head/usr.bin/patch/tests/Makefile   (contents, props changed)
  head/usr.bin/patch/tests/PR74127-cline.diff   (contents, props changed)
  head/usr.bin/patch/tests/PR74127-good.diff   (contents, props changed)
  head/usr.bin/patch/tests/PR74127-repro.diff   (contents, props changed)
  head/usr.bin/patch/tests/PR74127.in   (contents, props changed)
  head/usr.bin/patch/tests/unified_patch_test.sh   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.bin/patch/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Thu Sep  5 00:56:37 2019
(r351835)
+++ head/etc/mtree/BSD.tests.dist   Thu Sep  5 03:16:14 2019
(r351836)
@@ -1018,6 +1018,8 @@
 ..
 opensm
 ..
+patch
+..
 pr
 ..
 printf

Modified: head/usr.bin/patch/Makefile
==
--- head/usr.bin/patch/Makefile Thu Sep  5 00:56:37 2019(r351835)
+++ head/usr.bin/patch/Makefile Thu Sep  5 03:16:14 2019(r351836)
@@ -1,8 +1,13 @@
 #  $OpenBSD: Makefile,v 1.4 2005/05/16 15:22:46 espie Exp $
 # $FreeBSD$
 
+.include 
+
 PROG=  patch
 
 SRCS=  backupfile.c inp.c mkpath.c patch.c pch.c util.c
+
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
 
 .include 

Added: head/usr.bin/patch/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/patch/tests/Makefile   Thu Sep  5 03:16:14 2019
(r351836)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+PACKAGE=   tests
+
+ATF_TESTS_SH+= unified_patch_test
+
+${PACKAGE}FILES+=  PR74127-cline.diff
+${PACKAGE}FILES+=  PR74127-good.diff
+${PACKAGE}FILES+=  PR74127-repro.diff
+${PACKAGE}FILES+=  PR74127.in
+
+.include 

Added: head/usr.bin/patch/tests/PR74127-cline.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/patch/tests/PR74127-cline.diff Thu Sep  5 03:16:14 2019
(r351836)
@@ -0,0 +1,4 @@
+file.c
+@@ -3,1 +3,1 @@
+-   set Log(compressProg) /usr/local/bin/gzip
++   set Log(compressProg) /usr/bin/gzip

Added: head/usr.bin/patch/tests/PR74127-good.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/patch/tests/PR74127-good.diff  Thu Sep  5 03:16:14 2019
(r351836)
@@ -0,0 +1,4 @@
+file.c
+@@ -3,1 +3,1 @@
+-set Log(compressProg) gzip
++set Log(compressProg) /usr/local/bin/gzip

Added: head/usr.bin/patch/tests/PR74127-repro.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/patch/tests/PR74127-repro.diff Thu Sep  5 03:16:14 2019
(r351836)
@@ -0,0 +1,4 @@
+file.c
+@@ -5,1 +5,1 @@
+-   set Log(compressProg) /usr/local/bin/gzip
++   set Log(compressProg) /usr/bin/gzip

Added: head/usr.bin/patch/tests/PR74127.in
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/patch/tests/PR74127.in Thu Sep  5 03:16:14 2019
(r351836)
@@ -0,0 +1,14 @@
+# This program is used to compress log files
+if {![info exists Log(compressProg)]} {
+set Log(compressProg) gzip
+}
+
+# Flush interval
+if {![info exists Log(flushInterval)]} {
+set Log(flushInterval) [expr {60 * 1000}]
+}
+
+# This is used to turn on an alternate debug log file
+if {![info exist Log(debug_log)]} {
+set Log(debug_log) 0
+}

Added: 

svn commit: r351835 - head/sys/sys

2019-09-04 Thread Conrad Meyer
Author: cem
Date: Thu Sep  5 00:56:37 2019
New Revision: 351835
URL: https://svnweb.freebsd.org/changeset/base/351835

Log:
  sys/mount.h: Comment on distinction between vfs_{c,}mount
  
  Hope to save someone else a little future effort in ugly duplicated code.
  
  No functional change.

Modified:
  head/sys/sys/mount.h

Modified: head/sys/sys/mount.h
==
--- head/sys/sys/mount.hWed Sep  4 22:37:28 2019(r351834)
+++ head/sys/sys/mount.hThu Sep  5 00:56:37 2019(r351835)
@@ -651,6 +651,18 @@ struct nameidata;
 struct sysctl_req;
 struct mntarg;
 
+/*
+ * N.B., vfs_cmount is the ancient vfsop invoked by the old mount(2) syscall.
+ * The new way is vfs_mount.
+ *
+ * vfs_cmount implementations typically translate arguments from their
+ * respective old per-FS structures into the key-value list supported by
+ * nmount(2), then use kernel_mount(9) to mimic nmount(2) from kernelspace.
+ *
+ * Filesystems with mounters that use nmount(2) do not need to and should not
+ * implement vfs_cmount.  Hopefully a future cleanup can remove vfs_cmount and
+ * mount(2) entirely.
+ */
 typedef int vfs_cmount_t(struct mntarg *ma, void *data, uint64_t flags);
 typedef int vfs_unmount_t(struct mount *mp, int mntflags);
 typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp);
___
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: r351834 - in head/sys/fs: nfs nfsserver

2019-09-04 Thread Rick Macklem
Author: rmacklem
Date: Wed Sep  4 22:37:28 2019
New Revision: 351834
URL: https://svnweb.freebsd.org/changeset/base/351834

Log:
  Delete the unused "nd" argument for nfsrv_checkdsattr().
  
  The "nd" argument for nfsrv_checkdsattr() is no longer used by the function.
  This patch deletes it. This allows subsequent patches to delete the "nd"
  argument from nfsrv_proxyds(), since it's only use of "nd" was to pass it
  to nfsrv_checkdsattr(). The same will then be true for nfsvno_getattr(),
  which passes "nd" to nfsrv_proxyds().
  Getting rid of the "nd" argument from nfsvno_getattr() avoids confusion
  over why it might need "nd".
  
  This patch is trivial and does not have any semantic effect.
  Found by inspection while working on the NFSv4.2 server.

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfs/nfs_var.h
==
--- head/sys/fs/nfs/nfs_var.h   Wed Sep  4 21:53:45 2019(r351833)
+++ head/sys/fs/nfs/nfs_var.h   Wed Sep  4 22:37:28 2019(r351834)
@@ -162,7 +162,7 @@ void nfsrv_freefilelayouts(fhandle_t *);
 int nfsrv_deldsserver(int, char *, NFSPROC_T *);
 struct nfsdevice *nfsrv_deldsnmp(int, struct nfsmount *, NFSPROC_T *);
 int nfsrv_createdevids(struct nfsd_nfsd_args *, NFSPROC_T *);
-int nfsrv_checkdsattr(struct nfsrv_descript *, vnode_t, NFSPROC_T *);
+int nfsrv_checkdsattr(vnode_t, NFSPROC_T *);
 int nfsrv_copymr(vnode_t, vnode_t, vnode_t, struct nfsdevice *,
 struct pnfsdsfile *, struct pnfsdsfile *, int, struct ucred *, NFSPROC_T 
*);
 int nfsrv_mdscopymr(char *, char *, char *, char *, int *, char *, NFSPROC_T *,

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==
--- head/sys/fs/nfsserver/nfs_nfsdport.cWed Sep  4 21:53:45 2019
(r351833)
+++ head/sys/fs/nfsserver/nfs_nfsdport.cWed Sep  4 22:37:28 2019
(r351834)
@@ -4448,7 +4448,7 @@ nfsrv_proxyds(struct nfsrv_descript *nd, struct vnode 
 * delegation issued to a client for the file.
 */
if (nfsrv_pnfsgetdsattr == 0 ||
-   nfsrv_checkdsattr(nd, vp, p) == 0) {
+   nfsrv_checkdsattr(vp, p) == 0) {
free(buf, M_TEMP);
return (error);
}

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- head/sys/fs/nfsserver/nfs_nfsdstate.c   Wed Sep  4 21:53:45 2019
(r351833)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c   Wed Sep  4 22:37:28 2019
(r351834)
@@ -7999,7 +7999,7 @@ nfsrv_freealldevids(void)
  */
 #defineNFSCLIDVECSIZE  6
 APPLESTATIC int
-nfsrv_checkdsattr(struct nfsrv_descript *nd, vnode_t vp, NFSPROC_T *p)
+nfsrv_checkdsattr(vnode_t vp, NFSPROC_T *p)
 {
fhandle_t fh, *tfhp;
struct nfsstate *stp;
___
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: r351831 - in head: . stand/efi/boot1 stand/efi/gptboot tools/build/mk

2019-09-04 Thread Rebecca Cran
Author: bcran
Date: Wed Sep  4 20:55:48 2019
New Revision: 351831
URL: https://svnweb.freebsd.org/changeset/base/351831

Log:
  The efifat files are no longer used: remove the code to build them
  
  Reviewed by:  imp, tsoome, emaste
  Differential Revision:https://reviews.freebsd.org/D20562

Deleted:
  head/stand/efi/boot1/Makefile.fat
  head/stand/efi/boot1/fat-amd64.tmpl.xz
  head/stand/efi/boot1/fat-arm.tmpl.xz
  head/stand/efi/boot1/fat-arm64.tmpl.xz
  head/stand/efi/boot1/fat-i386.tmpl.xz
  head/stand/efi/boot1/generate-fat.sh
Modified:
  head/ObsoleteFiles.inc
  head/stand/efi/boot1/Makefile
  head/stand/efi/gptboot/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Sep  4 20:28:16 2019(r351830)
+++ head/ObsoleteFiles.inc  Wed Sep  4 20:55:48 2019(r351831)
@@ -37,7 +37,9 @@
 #   -V OLD_FILES -V OLD_LIBS -V OLD_DIRS check-old | \
 #   xargs -n1 | sort | uniq -d;
 # done
- 
+
+# 20190904: Remove boot1.efifat
+OLD_FILES+=boot/boot1.efifat
 # 20190903: pc-sysinstall(8) removed
 OLD_FILES+=usr/share/examples/pc-sysinstall/README
 OLD_FILES+=usr/share/examples/pc-sysinstall/pc-autoinstall.conf

Modified: head/stand/efi/boot1/Makefile
==
--- head/stand/efi/boot1/Makefile   Wed Sep  4 20:28:16 2019
(r351830)
+++ head/stand/efi/boot1/Makefile   Wed Sep  4 20:55:48 2019
(r351831)
@@ -62,9 +62,6 @@ CFLAGS+=  -I${LDRSRC}
 
 FILES= ${BOOT1}.efi
 FILESMODE_${BOOT1}.efi=${BINMODE}
-.ifndef(NOFAT)
-FILES+= ${BOOT1}.efifat
-.endif
 
 LDSCRIPT=  ${EFISRC}/loader/arch/${MACHINE}/ldscript.${MACHINE}
 LDFLAGS+=  -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
@@ -99,25 +96,5 @@ ${BOOT1}.efi: ${PROG}
-j .dynamic -j .dynsym -j .rel.dyn \
-j .rela.dyn -j .reloc -j .eh_frame \
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
-
-.ifndef(NOFAT)
-# The following inserts our objects into a template FAT file system
-# created by generate-fat.sh
-
-.include "Makefile.fat"
-
-${BOOT1}.efifat: ${BOOT1}.efi
-   @set -- `ls -l ${.ALLSRC}`; \
-   x=$$(($$5-${BOOT1_MAXSIZE})); \
-   if [ $$x -ge 0 ]; then \
-   echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\
-   exit 1; \
-   fi
-   echo ${.OBJDIR}
-   xz -d -c ${BOOTSRC}/efi/boot1/fat-${MACHINE}.tmpl.xz > ${.TARGET}
-   ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
-
-CLEANFILES+= ${BOOT1}.efi ${BOOT1}.efifat
-.endif
 
 .include 

Modified: head/stand/efi/gptboot/Makefile
==
--- head/stand/efi/gptboot/Makefile Wed Sep  4 20:28:16 2019
(r351830)
+++ head/stand/efi/gptboot/Makefile Wed Sep  4 20:55:48 2019
(r351831)
@@ -4,7 +4,6 @@
 # we don't want the gptboot.efifat thing created.
 MK_LOADER_ZFS=no
 EFI_DEBUG=yes
-NOFAT=yes
 
 BOOT1?=gptboot
 .PATH: ${SRCTOP}/stand/efi/boot1 ${SRCTOP}/stand/libsa

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Sep  4 20:28:16 
2019(r351830)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Sep  4 20:55:48 
2019(r351831)
@@ -618,7 +618,6 @@ OLD_FILES+=boot/boot0
 OLD_FILES+=boot/boot0sio
 OLD_FILES+=boot/boot1
 OLD_FILES+=boot/boot1.efi
-OLD_FILES+=boot/boot1.efifat
 OLD_FILES+=boot/boot2
 OLD_FILES+=boot/brand.4th
 OLD_FILES+=boot/cdboot
___
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: r351830 - head/sys/vm

2019-09-04 Thread Konstantin Belousov
Author: kib
Date: Wed Sep  4 20:28:16 2019
New Revision: 351830
URL: https://svnweb.freebsd.org/changeset/base/351830

Log:
  madvise(MADV_FREE): Quick fix to time rewind.
  
  Don't free pages in a shadowing object.  While this degrades MADV_FREE
  to a no-op (and we could, instead, choose to fall back to
  MADV_DONTNEED, at the cost of changing pmap_madvise), this is
  presently considered a temporary fix. We may prefer to risk a little
  fragmentation of the map by creating a zero/OBJT_DEFAULT entry over
  top of the existing object and, simultaneously, revert to the existing
  marking any pages in the former shadowing object in the advised region
  as reclaimable.  At least one consumer of MADV_FREE (snmalloc) may use
  mmap() to construct zeroed pages "eventually" here anyway, so the
  fragmentation may be coming anyway.
  
  Submitted by: Nathaniel Filardo 
  PR:   240061
  Reviewed by:  markj
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D21517

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cWed Sep  4 20:14:21 2019(r351829)
+++ head/sys/vm/vm_map.cWed Sep  4 20:28:16 2019(r351830)
@@ -2736,6 +2736,18 @@ vm_map_madvise(
if (current->eflags & MAP_ENTRY_IS_SUB_MAP)
continue;
 
+   /*
+* MADV_FREE would otherwise rewind time to
+* the creation of the shadow object.  Because
+* we hold the VM map read-locked, neither the
+* entry's object nor the presence of a
+* backing object can change.
+*/
+   if (behav == MADV_FREE &&
+   current->object.vm_object != NULL &&
+   current->object.vm_object->backing_object != NULL)
+   continue;
+
pstart = OFF_TO_IDX(current->offset);
pend = pstart + atop(current->end - current->start);
useStart = current->start;
___
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: r351828 - head/sys/dev/nvme

2019-09-04 Thread Warner Losh
Author: imp
Date: Wed Sep  4 20:08:36 2019
New Revision: 351828
URL: https://svnweb.freebsd.org/changeset/base/351828

Log:
  Support doorbell strides != 0.
  
  The NVMe standard (1.4) states
  
  >>> 8.6 Doorbell Stride for Software Emulation
  >>> The doorbell stride,...is useful in software emulation of an NVM
  >>> Express controller. ...  For hardware implementations of the NVM
  >>> Express interface, the expected doorbell stride value is 0h.
  
  However, hardware in the wild exists with a doorbell stride of 1
  (meaning 8 byte separation). This change supports that hardware, as
  well as software emulators as envisioned in Section 8.6. Since this is
  the fast path, care has been taken to make this computation
  efficient. The bit of math to compute an offset for each is replaced
  by a memory load from cache of a pre-computed value.
  
  MFC After: 3 days
  Reviewed by: scottl@
  Differential Revision: https://reviews.freebsd.org/D21514

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_private.h
  head/sys/dev/nvme/nvme_qpair.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Wed Sep  4 19:32:50 2019
(r351827)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Wed Sep  4 20:08:36 2019
(r351828)
@@ -90,19 +90,25 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller 
struct nvme_qpair   *qpair;
uint32_tcap_lo;
uint16_tmqes;
-   int i, error, num_entries, num_trackers;
+   int i, error, num_entries, num_trackers, 
max_entries;
 
-   num_entries = NVME_IO_ENTRIES;
-   TUNABLE_INT_FETCH("hw.nvme.io_entries", _entries);
-
/*
-* NVMe spec sets a hard limit of 64K max entries, but
-*  devices may specify a smaller limit, so we need to check
-*  the MQES field in the capabilities register.
+* NVMe spec sets a hard limit of 64K max entries, but devices may
+* specify a smaller limit, so we need to check the MQES field in the
+* capabilities register. We have to cap the number of entries to the
+* current stride allows for in BAR 0/1, otherwise the remainder entries
+* are inaccessable. MQES should reflect this, and this is just a
+* fail-safe.
 */
+   max_entries =
+   (rman_get_size(ctrlr->resource) - nvme_mmio_offsetof(doorbell[0])) /
+   (1 << (ctrlr->dstrd + 1));
+   num_entries = NVME_IO_ENTRIES;
+   TUNABLE_INT_FETCH("hw.nvme.io_entries", _entries);
cap_lo = nvme_mmio_read_4(ctrlr, cap_lo);
mqes = NVME_CAP_LO_MQES(cap_lo);
num_entries = min(num_entries, mqes + 1);
+   num_entries = min(num_entries, max_entries);
 
num_trackers = NVME_IO_TRACKERS;
TUNABLE_INT_FETCH("hw.nvme.io_trackers", _trackers);
@@ -110,9 +116,9 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller 
num_trackers = max(num_trackers, NVME_MIN_IO_TRACKERS);
num_trackers = min(num_trackers, NVME_MAX_IO_TRACKERS);
/*
-* No need to have more trackers than entries in the submit queue.
-*  Note also that for a queue size of N, we can only have (N-1)
-*  commands outstanding, hence the "-1" here.
+* No need to have more trackers than entries in the submit queue.  Note
+* also that for a queue size of N, we can only have (N-1) commands
+* outstanding, hence the "-1" here.
 */
num_trackers = min(num_trackers, (num_entries-1));
 
@@ -1120,7 +1126,6 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de
uint32_tcap_lo;
uint32_tcap_hi;
uint32_tto;
-   uint8_t dstrd;
uint8_t mpsmin;
int status, timeout_period;
 
@@ -1128,14 +1133,8 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de
 
mtx_init(>lock, "nvme ctrlr lock", NULL, MTX_DEF);
 
-   /*
-* Software emulators may set the doorbell stride to something
-*  other than zero, but this driver is not set up to handle that.
-*/
cap_hi = nvme_mmio_read_4(ctrlr, cap_hi);
-   dstrd = NVME_CAP_HI_DSTRD(cap_hi);
-   if (dstrd != 0)
-   return (ENXIO);
+   ctrlr->dstrd = NVME_CAP_HI_DSTRD(cap_hi) + 2;
 
mpsmin = NVME_CAP_HI_MPSMIN(cap_hi);
ctrlr->min_page_size = 1 << (12 + mpsmin);

Modified: head/sys/dev/nvme/nvme_private.h
==
--- head/sys/dev/nvme/nvme_private.hWed Sep  4 19:32:50 2019
(r351827)
+++ head/sys/dev/nvme/nvme_private.hWed Sep  4 20:08:36 2019
(r351828)
@@ -297,6 +297,9 @@ struct nvme_controller {
/** timeout period in seconds */
uint32_ttimeout_period;
 
+   /** doorbell 

svn commit: r351825 - head/sys/kern

2019-09-04 Thread Mateusz Guzik
Author: mjg
Date: Wed Sep  4 19:23:18 2019
New Revision: 351825
URL: https://svnweb.freebsd.org/changeset/base/351825

Log:
  vfs: fully hold vnodes in vnlru_free_locked
  
  Currently the code only bumps holdcnt and clears the VI_FREE flag, not
  performing actual vhold. Since the vnode is still visible elsewhere, a
  potential new user can find it and incorrectly assume it is properly held.
  
  Use vholdl instead to correctly hold the vnode. Another place recycling
  (vlrureclaim) does this already.
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21522

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Sep  4 19:19:23 2019(r351824)
+++ head/sys/kern/vfs_subr.cWed Sep  4 19:23:18 2019(r351825)
@@ -1102,7 +1102,6 @@ vnlru_free_locked(int count, struct vfsops *mnt_op)
("Removing vnode not on freelist"));
KASSERT((vp->v_iflag & VI_ACTIVE) == 0,
("Mangling active vnode"));
-   TAILQ_REMOVE(_free_list, vp, v_actfreelist);
 
/*
 * Don't recycle if our vnode is from different type
@@ -1114,7 +1113,6 @@ vnlru_free_locked(int count, struct vfsops *mnt_op)
 */
if ((mnt_op != NULL && (mp = vp->v_mount) != NULL &&
mp->mnt_op != mnt_op) || !VI_TRYLOCK(vp)) {
-   TAILQ_INSERT_TAIL(_free_list, vp, v_actfreelist);
continue;
}
VNASSERT((vp->v_iflag & VI_FREE) != 0 && vp->v_holdcnt == 0,
@@ -1129,11 +1127,8 @@ vnlru_free_locked(int count, struct vfsops *mnt_op)
 * activating.
 */
freevnodes--;
-   vp->v_iflag &= ~VI_FREE;
-   VNODE_REFCOUNT_FENCE_REL();
-   refcount_acquire(>v_holdcnt);
-
mtx_unlock(_free_list_mtx);
+   vholdl(vp);
VI_UNLOCK(vp);
vtryrecycle(vp);
/*
___
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: r351824 - head/sbin/nvmecontrol

2019-09-04 Thread Warner Losh
Author: imp
Date: Wed Sep  4 19:19:23 2019
New Revision: 351824
URL: https://svnweb.freebsd.org/changeset/base/351824

Log:
  Report the Host Buffer Memory minimum and preferred sizes.
  
  The Host Buffer feature (NVMe 1.4 section 89) allows for the NVMe card
  request the host provide it buffer for lookaside tables and maybe
  other things. Report the card's minimum and preferred sizes with
  nvmecontrol/camcontrol identify.

Modified:
  head/sbin/nvmecontrol/identify_ext.c

Modified: head/sbin/nvmecontrol/identify_ext.c
==
--- head/sbin/nvmecontrol/identify_ext.cWed Sep  4 18:32:11 2019
(r351823)
+++ head/sbin/nvmecontrol/identify_ext.cWed Sep  4 19:19:23 2019
(r351824)
@@ -192,6 +192,8 @@ nvme_print_controller(struct nvme_controller_data *cda
uint128_to_str(to128(cdata->untncap.unvmcap),
cbuf, sizeof(cbuf)));
}
+   printf("Host Buffer Preferred Size:  %d bytes\n", cdata->hmpre);
+   printf("Host Buffer Minimum Size:%d bytes\n", cdata->hmmin);
 
printf("\n");
printf("NVM Command Set Attributes\n");
___
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: r351823 - head/share/mk

2019-09-04 Thread Bryan Drewery
Author: bdrewery
Date: Wed Sep  4 18:32:11 2019
New Revision: 351823
URL: https://svnweb.freebsd.org/changeset/base/351823

Log:
  PROGS: Build common sources before recursed PROGS_TARGETS as well when 
building.
  
  MFC after:2 weeks
  Sponsored by: DellEMC

Modified:
  head/share/mk/bsd.progs.mk

Modified: head/share/mk/bsd.progs.mk
==
--- head/share/mk/bsd.progs.mk  Wed Sep  4 18:00:54 2019(r351822)
+++ head/share/mk/bsd.progs.mk  Wed Sep  4 18:32:11 2019(r351823)
@@ -92,6 +92,7 @@ $v =
 # handle being called [bsd.]progs.mk
 .include 
 
+.if !defined(_SKIP_BUILD)
 # Find common sources among the PROGS to depend on them before building
 # anything.  This allows parallelization without them each fighting over
 # the same objects.
@@ -118,6 +119,7 @@ _PROGS_COMMON_OBJS+=
${_PROGS_COMMON_SRCS:N*.[dhly]:${
 !empty(.MAKE.MODE:Mmeta)
 ${_PROGS_COMMON_OBJS}: .NOMETA
 .endif
+.endif
 
 .if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
 # tell progs.mk we might want to install things
@@ -132,11 +134,6 @@ _PROG_MK.cleanobj= CLEANDEPENDFILES= CLEANDEPENDDIRS=
 PROGS_TARGETS+=cleandir cleanobj
 .endif
 
-# Ensure common objects are built before recursing.
-.if !empty(_PROGS_COMMON_OBJS)
-${PROGS}: ${_PROGS_COMMON_OBJS}
-.endif
-
 .for p in ${PROGS}
 .if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)
 # bsd.prog.mk may need to know this
@@ -144,7 +141,7 @@ x.$p= PROG_CXX=$p
 .endif
 
 # Main PROG target
-$p ${p}_p: .PHONY .MAKE
+$p ${p}_p: .PHONY .MAKE ${_PROGS_COMMON_OBJS}
(cd ${.CURDIR} && \
DEPENDFILE=.depend.$p \
NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS=t \
@@ -152,7 +149,7 @@ $p ${p}_p: .PHONY .MAKE
 
 # Pseudo targets for PROG, such as 'install'.
 .for t in ${PROGS_TARGETS:O:u}
-$p.$t: .PHONY .MAKE
+$p.$t: .PHONY .MAKE ${_PROGS_COMMON_OBJS}
(cd ${.CURDIR} && \
DEPENDFILE=.depend.$p \
NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS=t \
___
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: r351822 - head/sys/compat/linprocfs

2019-09-04 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Sep  4 18:00:54 2019
New Revision: 351822
URL: https://svnweb.freebsd.org/changeset/base/351822

Log:
  Fix /proc/mounts for autofs(5) mounts.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/compat/linprocfs/linprocfs.c

Modified: head/sys/compat/linprocfs/linprocfs.c
==
--- head/sys/compat/linprocfs/linprocfs.c   Wed Sep  4 18:00:03 2019
(r351821)
+++ head/sys/compat/linprocfs/linprocfs.c   Wed Sep  4 18:00:54 2019
(r351822)
@@ -462,6 +462,15 @@ linprocfs_domtab(PFS_FILL_ARGS)
else if (strcmp(fstype, "procfs") == 0)
continue;
 
+   if (strcmp(fstype, "autofs") == 0) {
+   /*
+* FreeBSD uses eg "map -hosts", whereas Linux
+* expects just "-hosts".
+*/
+   if (strncmp(mntfrom, "map ", 4) == 0)
+   mntfrom += 4;
+   }
+
if (strcmp(fstype, "linsysfs") == 0) {
sbuf_printf(sb, "/sys %s sysfs %s", mntto,
sp->f_flags & MNT_RDONLY ? "ro" : "rw");
___
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: r351821 - head/sys/amd64/linux

2019-09-04 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Sep  4 18:00:03 2019
New Revision: 351821
URL: https://svnweb.freebsd.org/changeset/base/351821

Log:
  Improve debugging output.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/amd64/linux/linux_ptrace.c

Modified: head/sys/amd64/linux/linux_ptrace.c
==
--- head/sys/amd64/linux/linux_ptrace.c Wed Sep  4 17:52:30 2019
(r351820)
+++ head/sys/amd64/linux/linux_ptrace.c Wed Sep  4 18:00:03 2019
(r351821)
@@ -319,6 +319,22 @@ linux_ptrace_peek(struct thread *td, pid_t pid, void *
 }
 
 static int
+linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data)
+{
+
+   linux_msg(td, "PTRACE_PEEKUSER not implemented; returning EINVAL");
+   return (EINVAL);
+}
+
+static int
+linux_ptrace_pokeuser(struct thread *td, pid_t pid, void *addr, void *data)
+{
+
+   linux_msg(td, "PTRACE_POKEUSER not implemented; returning EINVAL");
+   return (EINVAL);
+}
+
+static int
 linux_ptrace_setoptions(struct thread *td, pid_t pid, l_ulong data)
 {
struct linux_pemuldata *pem;
@@ -566,11 +582,17 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar
error = linux_ptrace_peek(td, pid,
(void *)(uap->addr + 4), (void *)(uap->data + 4));
break;
+   case LINUX_PTRACE_PEEKUSER:
+   error = linux_ptrace_peekuser(td, pid, addr, (void *)uap->data);
+   break;
case LINUX_PTRACE_POKETEXT:
error = kern_ptrace(td, PT_WRITE_I, pid, addr, uap->data);
break;
case LINUX_PTRACE_POKEDATA:
error = kern_ptrace(td, PT_WRITE_D, pid, addr, uap->data);
+   break;
+   case LINUX_PTRACE_POKEUSER:
+   error = linux_ptrace_pokeuser(td, pid, addr, (void *)uap->data);
break;
case LINUX_PTRACE_CONT:
error = map_signum(uap->data, );
___
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: r351820 - head/share/man/man5

2019-09-04 Thread Jason Helfman
Author: jgh (doc,ports committer)
Date: Wed Sep  4 17:52:30 2019
New Revision: 351820
URL: https://svnweb.freebsd.org/changeset/base/351820

Log:
  - correct HISTORY section
  - while here clarify wording
  
  PR:   240260 (based on)
  Submitted by: gbergl...@gmail.com
  MFC after:after 1 week

Modified:
  head/share/man/man5/passwd.5

Modified: head/share/man/man5/passwd.5
==
--- head/share/man/man5/passwd.5Wed Sep  4 16:25:41 2019
(r351819)
+++ head/share/man/man5/passwd.5Wed Sep  4 17:52:30 2019
(r351820)
@@ -438,8 +438,8 @@ BEGIN { FS = ":"}
 .Sh HISTORY
 A
 .Nm
-file format appeared in
-.At v6 .
+file format first appeared in
+.At v1 .
 .Pp
 The
 .Tn NIS
___
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: r351818 - in head/sys: arm/conf arm64/conf conf

2019-09-04 Thread Ian Lepore
On Wed, 2019-09-04 at 15:55 +, Ruslan Bukin wrote:
> Author: br
> Date: Wed Sep  4 15:55:44 2019
> New Revision: 351818
> URL: https://svnweb.freebsd.org/changeset/base/351818
> 
> Log:
>   Include dwgpio to the build.
>   
>   Sponsored by:   DARPA, AFRL
> 
> Modified:
>   head/sys/arm/conf/GENERIC
>   head/sys/arm64/conf/GENERIC
>   head/sys/conf/files
> 

This should probably also be added to sys/conf/NOTES so it gets built
in LINT kernels.

-- Ian

___
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: r351819 - head/usr.bin/procstat/tests

2019-09-04 Thread Jilles Tjoelker
Author: jilles
Date: Wed Sep  4 16:25:41 2019
New Revision: 351819
URL: https://svnweb.freebsd.org/changeset/base/351819

Log:
  procstat/tests: Fix flakiness by waiting for program to start
  
  Some of the procstat tests start a program "while1" and examine the process
  using procstat, but did not wait properly for it to start (kill -0 will
  succeed immediately after the child process has been created).
  
  Instead, have "while1" write something when it starts, and use a fifo to
  wait for that.
  
  PR:   233587, 233588
  Reviewed by:  ngie
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21519

Modified:
  head/usr.bin/procstat/tests/procstat_test.sh
  head/usr.bin/procstat/tests/while1.c

Modified: head/usr.bin/procstat/tests/procstat_test.sh
==
--- head/usr.bin/procstat/tests/procstat_test.shWed Sep  4 15:55:44 
2019(r351818)
+++ head/usr.bin/procstat/tests/procstat_test.shWed Sep  4 16:25:41 
2019(r351819)
@@ -25,7 +25,6 @@
 # $FreeBSD$
 #
 
-MAX_TRIES=20
 PROG_PID=
 PROG_PATH=$(atf_get_srcdir)/while1
 
@@ -37,16 +36,13 @@ start_program()
PROG_COMM=while1
PROG_PATH=$(atf_get_srcdir)/$PROG_COMM
 
-   $PROG_PATH $* &
+   mkfifo wait_for_start || atf_fail "mkfifo"
+   $PROG_PATH $* >wait_for_start &
PROG_PID=$!
-   try=0
-   while [ $try -lt $MAX_TRIES ] && ! kill -0 $PROG_PID; do
-   sleep 0.5
-   : $(( try += 1 ))
-   done
-   if [ $try -ge $MAX_TRIES ]; then
-   atf_fail "Polled for program start $MAX_TRIES tries and failed"
+   if ! read dummy https://bugs.freebsd.org/233587;
-
arguments="my arguments"
 
start_program $arguments
@@ -104,8 +98,6 @@ environment_head()
 }
 environment_body()
 {
-   atf_skip "https://bugs.freebsd.org/233588;
-
var="MY_VARIABLE=foo"
eval "export $var"
 

Modified: head/usr.bin/procstat/tests/while1.c
==
--- head/usr.bin/procstat/tests/while1.cWed Sep  4 15:55:44 2019
(r351818)
+++ head/usr.bin/procstat/tests/while1.cWed Sep  4 16:25:41 2019
(r351819)
@@ -33,7 +33,8 @@ int
 main(void)
 {
 
+   if (write(STDOUT_FILENO, "started\n", 8) != 8)
+   abort();
for (;;)
-   usleep(100);
-   exit(1);
+   pause();
 }
___
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: r351818 - in head/sys: arm/conf arm64/conf conf

2019-09-04 Thread Ruslan Bukin
Author: br
Date: Wed Sep  4 15:55:44 2019
New Revision: 351818
URL: https://svnweb.freebsd.org/changeset/base/351818

Log:
  Include dwgpio to the build.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm/conf/GENERIC
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files

Modified: head/sys/arm/conf/GENERIC
==
--- head/sys/arm/conf/GENERIC   Wed Sep  4 15:37:24 2019(r351817)
+++ head/sys/arm/conf/GENERIC   Wed Sep  4 15:55:44 2019(r351818)
@@ -153,6 +153,7 @@ device  nxprtc  # NXP RTCs: 
PCA/PFC212x PCA/PCF85xx
 device s35390a # Seiko s3539x RTCs
 
 # GPIO
+device dwgpio  # Synopsys DesignWare APB GPIO 
Controller
 device gpio
 device gpiobacklight
 device gpioled

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Wed Sep  4 15:37:24 2019(r351817)
+++ head/sys/arm64/conf/GENERIC Wed Sep  4 15:55:44 2019(r351818)
@@ -228,6 +228,7 @@ device  a31_dmac
 # GPIO / PINCTRL
 device a37x0_gpio  # Marvell Armada 37x0 GPIO controller
 device aw_gpio # Allwinner GPIO controller
+device dwgpio  # Synopsys DesignWare APB GPIO Controller
 device gpio
 device gpioled
 device fdt_pinctrl

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Sep  4 15:37:24 2019(r351817)
+++ head/sys/conf/files Wed Sep  4 15:55:44 2019(r351818)
@@ -1734,6 +1734,9 @@ dev/fxp/inphy.c   optional fxp
 dev/gem/if_gem.c   optional gem
 dev/gem/if_gem_pci.c   optional gem pci
 dev/gem/if_gem_sbus.c  optional gem sbus
+dev/gpio/dwgpio/dwgpio.c   optional gpio dwgpio fdt
+dev/gpio/dwgpio/dwgpio_bus.c   optional gpio dwgpio fdt
+dev/gpio/dwgpio/dwgpio_if.moptional gpio dwgpio fdt
 dev/gpio/gpiobacklight.c   optional gpiobacklight fdt
 dev/gpio/gpiokeys.coptional gpiokeys fdt
 dev/gpio/gpiokeys_codes.c  optional gpiokeys fdt
___
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: r351817 - in head/sys: arm/altera/socfpga dev/gpio/dwgpio

2019-09-04 Thread Ruslan Bukin
Author: br
Date: Wed Sep  4 15:37:24 2019
New Revision: 351817
URL: https://svnweb.freebsd.org/changeset/base/351817

Log:
  o Add support for multi-port instances of Synopsys DesignWare APB GPIO
Controller.
  o Rename the driver to dwgpio.
  
  Sponsored by: DARPA, AFRL

Added:
  head/sys/dev/gpio/dwgpio/
  head/sys/dev/gpio/dwgpio/dwgpio.c
 - copied, changed from r351816, head/sys/arm/altera/socfpga/socfpga_gpio.c
  head/sys/dev/gpio/dwgpio/dwgpio_bus.c   (contents, props changed)
  head/sys/dev/gpio/dwgpio/dwgpio_if.m   (contents, props changed)
Deleted:
  head/sys/arm/altera/socfpga/socfpga_gpio.c
Modified:
  head/sys/arm/altera/socfpga/files.socfpga

Modified: head/sys/arm/altera/socfpga/files.socfpga
==
--- head/sys/arm/altera/socfpga/files.socfpga   Wed Sep  4 14:32:04 2019
(r351816)
+++ head/sys/arm/altera/socfpga/files.socfpga   Wed Sep  4 15:37:24 2019
(r351817)
@@ -5,7 +5,6 @@ arm/altera/socfpga/socfpga_machdep.cstandard
 arm/altera/socfpga/socfpga_manager.c   standard
 arm/altera/socfpga/socfpga_rstmgr.cstandard
 arm/altera/socfpga/socfpga_mp.coptional smp
-arm/altera/socfpga/socfpga_gpio.c  optional gpio
 
 dev/mmc/host/dwmmc.c   optional dwmmc
 dev/mmc/host/dwmmc_altera.coptional dwmmc

Copied and modified: head/sys/dev/gpio/dwgpio/dwgpio.c (from r351816, 
head/sys/arm/altera/socfpga/socfpga_gpio.c)
==
--- head/sys/arm/altera/socfpga/socfpga_gpio.c  Wed Sep  4 14:32:04 2019
(r351816, copy source)
+++ head/sys/dev/gpio/dwgpio/dwgpio.c   Wed Sep  4 15:37:24 2019
(r351817)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 Ruslan Bukin 
+ * Copyright (c) 2015, 2019 Ruslan Bukin 
  * All rights reserved.
  *
  * This software was developed by SRI International and the University of
@@ -29,15 +29,12 @@
  */
 
 /*
- * SOCFPGA General-Purpose I/O Interface.
+ * Synopsys® DesignWare® APB General Purpose Programming I/O
+ * (DW_apb_gpio) peripheral.
+ *
  * Chapter 22, Cyclone V Device Handbook (CV-5V2 2014.07.22)
  */
 
-/*
- * The GPIO modules are instances of the Synopsys® DesignWare® APB General
- * Purpose Programming I/O (DW_apb_gpio) peripheral.
- */
-
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -53,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -64,14 +62,13 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "gpio_if.h"
+#include "dwgpio_if.h"
 
-#define READ4(_sc, _reg) \
-   bus_read_4((_sc)->res[0], _reg)
-#define WRITE4(_sc, _reg, _val) \
-   bus_write_4((_sc)->res[0], _reg, _val)
+#define READ4(_sc, _reg)   DWGPIO_READ((_sc)->parent, _reg)
+#define WRITE4(_sc, _reg, _val)DWGPIO_WRITE((_sc)->parent, _reg, _val)
 
-#defineGPIO_SWPORTA_DR 0x00/* Port A Data Register */
-#defineGPIO_SWPORTA_DDR0x04/* Port A Data Direction 
Register */
+#defineGPIO_SWPORT_DR(n)   (0x00 + 0xc * (n)) /* Port n Data 
Register */
+#defineGPIO_SWPORT_DDR(n)  (0x04 + 0xc * (n)) /* Port n Data 
Direction */
 #defineGPIO_INTEN  0x30/* Interrupt Enable Register */
 #defineGPIO_INTMASK0x34/* Interrupt Mask Register */
 #defineGPIO_INTTYPE_LEVEL  0x38/* Interrupt Level Register */
@@ -80,7 +77,7 @@ __FBSDID("$FreeBSD$");
 #defineGPIO_RAW_INTSTATUS  0x44/* Raw Interrupt Status 
Register */
 #defineGPIO_DEBOUNCE   0x48/* Debounce Enable Register */
 #defineGPIO_PORTA_EOI  0x4C/* Clear Interrupt Register */
-#defineGPIO_EXT_PORTA  0x50/* External Port A Register */
+#defineGPIO_EXT_PORT(n)(0x50 + 0x4 * (n)) /* External Port n */
 #defineGPIO_LS_SYNC0x60/* Synchronization Level 
Register */
 #defineGPIO_ID_CODE0x64/* ID Code Register */
 #defineGPIO_VER_ID_CODE0x6C/* GPIO Version Register */
@@ -89,13 +86,6 @@ __FBSDID("$FreeBSD$");
 #define ENCODED_ID_PWIDTH_S(n) (5 * n) /* Width of GPIO Port N Shift */
 #defineGPIO_CONFIG_REG10x74/* Configuration Register 1 */
 
-enum port_no {
-   PORTA,
-   PORTB,
-   PORTC,
-   PORTD,
-};
-
 #defineNR_GPIO_MAX 32  /* Maximum pins per port */
 
 #defineGPIO_LOCK(_sc)  mtx_lock(&(_sc)->sc_mtx)
@@ -106,43 +96,35 @@ enum port_no {
 /*
  * GPIO interface
  */
-static device_t socfpga_gpio_get_bus(device_t);
-static int socfpga_gpio_pin_max(device_t, int *);
-static int socfpga_gpio_pin_getcaps(device_t, uint32_t, uint32_t *);
-static int socfpga_gpio_pin_getname(device_t, uint32_t, char *);
-static int socfpga_gpio_pin_getflags(device_t, uint32_t, uint32_t *);
-static int 

Re: svn commit: r351673 - in head: lib/libmemstat share/man/man9 sys/cddl/compat/opensolaris/kern sys/kern sys/vm

2019-09-04 Thread Slawa Olhovchenkov
On Wed, Sep 04, 2019 at 09:27:00AM +0300, Andriy Gapon wrote:

> On 04/09/2019 01:01, Mark Johnston wrote:
> > Some of the vm_lowmem eventhandlers probably shouldn't be called each
> > time the page daemon scans the inactive queue (every 0.1s under memory
> > pressure).  ufsdirhash_lowmem and mb_reclaim in particular don't seem
> > like they need to be invoked very frequently.  We could easily define
> > multiple eventhandlers to differentiate between these cases, though.
> 
> My proposal is to run uma_reclaim(UMA_RECLAIM_TRIM) before invoking vm_lowmem.
> If that reclaims "enough" memory, then do not call vm_lowmem at all.
> 
> Oh, and I have a related question.
> Say, a zone has X items in use and Y items in cache.
> After running vm_lowmem the composition changes to X - C and Y + C 
> respectively.
> Then we run uma_reclaim(UMA_RECLAIM_TRIM).
> Question: is that guaranteed to free at least C items?
> I am thinking about a possibility that the zone's workset size is estimated to
> be at least X (and maybe even more than X + Y).  In that case UMA_RECLAIM_TRIM
> won't free those C items, they will stay in the cache.  So, it seems like
> releasing them was in vain, at least for the immediate reclaim.

My goal is uma_reclaim(UMA_RECLAIM_TRIM) reclaim from zone cache up to zone 
cache working set.
Idealy in stable run uma_reclaim(UMA_RECLAIM_TRIM) do nothing and all
allocation/free from zone go from/to zone cache. As result
uma_reclaim(UMA_RECLAIM_TRIM) work only for rebalance memory consume at
working profile change.
___
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: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Andriy Gapon
On 04/09/2019 16:50, Alan Somers wrote:
> On Wed, Sep 4, 2019 at 7:47 AM Andriy Gapon  > wrote:
> 
> Author: avg
> Date: Wed Sep  4 13:47:38 2019
> New Revision: 351812
> URL: https://svnweb.freebsd.org/changeset/base/351812
> 
> Log:
>   mpsutil slot set status
> 
>   This code has been written as a proof of concept, but I think that it
>   can be useful in general.  It allows to set the status of an enclosure
>   slot.  Practically, this means controlling whatever slot status LEDs the
>   enclosure provides.  At present, the new command does not have sanity
>   checks or any conveniences.  That means that it is possible to issue the
>   command for an invalid slot and an enclosure.  But the worst I have seen
>   happening is either the command failing or simply being ignored.  Also,
>   at the moment, the status has to be specified as a numeric bit mask.
>   The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they
>   are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to address a
>   slot is by the enclosure handle and the slot number.  Both are readily
>   available from mpsutil show commands.
> 
>   So, future enhancements could include alternative ways to address a slot
>   (e.g., by a disk handle or a disk device name) and human friendly names
>   for slot statuses.
> 
>   The new command is useful alternative to 'sas2ircu locate' command.
>   First, sas2ircu is a proprietary blob.  Second, it supports setting only
>   locate / identify status bit.
> 
>   Tested on HP H220 running LSI IT firmware 20.x.
> 
>   Reviewed by:  bapt
>   MFC after:    3 weeks
>   Differential Revision:        https://reviews.freebsd.org/D20535
> 
> Added:
>   head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
> Modified:
>   head/usr.sbin/mpsutil/Makefile
>   head/usr.sbin/mpsutil/mps_cmd.c
>   head/usr.sbin/mpsutil/mpsutil.h
> 
> 
> Is this redundant with sesutil, or does it work on different kinds of 
> enclosures? 

This is for controllers that do not expose a SES device for a directly attached
(no expanders in between) backplane that does not have a built-in expander of
its own.

Here is some information for a context.

I have a configuration with a SAS2308 based HBA that's flashed with LSI IT
firmware version 20.00.07.00.  I think that the HBA does not support IR firmware
as it is very simple and it seems to lack NVSRAM (whatever it is).
The controller is attached to a Supermicro 743TQ backplane that's built into a
namesake chassis. The attachment is via a fan-out cable that connects one
mini-SAS (SFF-8087) port on the controller to four individual SAS/SATA ports on
the backplane plus a sideband connector that's attached to the backplane as
well.  The backplane supports two modes of operation for the sideband
connection, I2C and SGPIO.  But it seems that the controller or its firmware
supports only SGPIO.  Maybe I2C communication was considered to be an overkill
for the IT mode.  In any case, the controller does not fake a SES device for the
enclosure, so it's not available for tools like sesutil, etc.  The controller
specific tools like mpsutil and sas2ircu do see the enclosure.

-- 
Andriy Gapon
___
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: r351673 - in head: lib/libmemstat share/man/man9 sys/cddl/compat/opensolaris/kern sys/kern sys/vm

2019-09-04 Thread Slawa Olhovchenkov
On Tue, Sep 03, 2019 at 06:01:06PM -0400, Mark Johnston wrote:

> > > have you considered running UMA_RECLAIM_TRIM periodically, even without a 
> > > memory
> > > pressure?
> > > I think that with such a periodic trimming there will be less need to 
> > > invoke
> > > vm_lowmem().
> 
> Slawa and I talked about this in the past.  His complaint is that a
> large cache can take a significant amount of time to trim, and it

Not only large cache. Also I am see large mbuf cache (10GB+ after pike network 
activites)
and many other zones. For example, live server w/ stable/11, cache sizes of 
zones in MB:

54 RADIX NODE
55 zio_data_buf_131072
73 zio_data_buf_12288
77 zio_data_buf_98304
93 socket
99 tcpcb
  1072 mbuf
  1136 zio_buf_131072
  1443 zio_data_buf_1048576
 17242 mbuf_jumbo_page

> manifests as a spike of CPU usage and contention on the zone lock.  In
> particular, keg_drain() iterates over the list of free slabs with the
> keg lock held, and if the many items were freed to the keg while
> trimming/draining, the list can be quite long.  This can have effects
> outside the zone, for example if we are reclaiming items from zones used
> by other UMA zones, like the bucket or slab zones.
> 
> Reclaiming cached items when there is no demand for free pages seems
> wrong to me.  We historically had similar problems with the page daemon,
> which last year was changed to perform smaller reclamations at a greater
> frequency.  I suspect a better approach for UMA would be to similarly
> increase reclaim frequency and reduce the number of items freed in one
> go.

My goal is next:

1. Today memory size is quite big. 64GB is minimal, 256GB is not extraordinary.
   As result memory processed at lowmem event can be very big compared to 
historicaly.
2. Memory reclaiming is very expensetive at last stage. As result reclaiming 
some 10GB
   can take 10s and more
3. Memory depletion may be very fast at current speed (40Gbit network 
connectivity is 5GB/s).
   As result (2+3) memory reclaiming at lowmem event may be slow for depletion 
compensation.
4. Many susbsystem now try do't cause lowmem by automatic memory depletion. 
Large unused in
   zone cache memory cause inefficent memory use (see above -- about 18GB 
memory may be used
   as cache or other way but currently just in zone cache. lowmem don't caused 
because all consumer
   try to rest sufficient free memory)
5. NUMA dramatize situation because (as I see) memory allocation can give from 
dom1 and free to dom0.
   As result zone cache in dom0 rise and don't used. Currently kernel not fully 
NUMA-avare and need many work.
6. All of this can cause exause memory below vmd_free_reserved and slowly many 
operation in kernel.

I am see all of this.

> > > Also, I think that we would be able to retire (or re-purpose) 
> > > lowmem_period.
> > > E.g., the trimming would be done every lowmem_period, but vm_lowmem() 
> > > would not
> > > be throttled.
> 
> Some of the vm_lowmem eventhandlers probably shouldn't be called each
> time the page daemon scans the inactive queue (every 0.1s under memory
> pressure).  ufsdirhash_lowmem and mb_reclaim in particular don't seem
> like they need to be invoked very frequently.  We could easily define
> multiple eventhandlers to differentiate between these cases, though.
> 
> > > One example of the throttling of vm_lowmem being bad is its interaction 
> > > with the
> > > ZFS ARC.  When there is a spike in memory usage we want the ARC to adapt 
> > > as
> > > quickly as possible.  But at present the lowmem_period logic interferes 
> > > with that.
> >
> > Some time ago, I sent Mark a patch that implements this logic,
> > specialy for ARC and mbuf cooperate.
> >
> > Mostly problem I am see at this
> > work -- very slowly vm_page_free(). May be currenly this is more
> > speedy...
> 
> How did you determine this?

This is you guess:

==
> while ((slab = SLIST_FIRST()) != NULL) {
> SLIST_REMOVE(, slab, uma_slab, us_hlink);
> keg_free_slab(keg, slab, keg->uk_ipers);
> }
> 2019 Feb  2 19:49:54.800524364   zio_data_buf_1048576  1032605 
> cache_reclaim limit  100 dom 0 nitems 1672 imin  298
> 2019 Feb  2 19:49:54.800524364   zio_data_buf_1048576  1033736 
> cache_reclaim recla  149 dom 0 nitems 1672 imin  298
> 2019 Feb  2 19:49:54.802524468   zio_data_buf_1048576  3119710 
> cache_reclaim limit  100 dom 1 nitems1 imin0
> 2019 Feb  2 19:49:54.802524468   zio_data_buf_1048576  3127550 keg_drain2
> 2019 Feb  2 19:49:54.803524487   zio_data_buf_1048576  219 keg_drain3
> 2019 Feb  2 19:49:54.838524634   zio_data_buf_1048576 39553705 keg_drain4
> 2019 Feb  2 19:49:54.838524634   zio_data_buf_1048576 39565323 
> zone_reclaim:return
>
> 35109.486 ms for last loop, 149 items to freed.

35ms to free 149MB (38144 4KB pages), so roughly 1us per page.  That
does seem like a lot, but freeing a page 

Re: svn commit: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Andriy Gapon
On 04/09/2019 17:21, Allan Jude wrote:
> mpsutil's method will work on direct-attach backplanes and enclosures,
> where sesutil only works if there is an expander that provides the SES
> service.

I think that theoretically a controller (its firmware) can emulate a SES device
for a directly attached enclosure (that does not have a built-in expander too).
I believe that some controllers actually do that.  But maybe I am wrong.
And even if I am not, not all controllers do that.


-- 
Andriy Gapon
___
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: r351816 - head/sys/conf

2019-09-04 Thread Kyle Evans
Author: kevans
Date: Wed Sep  4 14:32:04 2019
New Revision: 351816
URL: https://svnweb.freebsd.org/changeset/base/351816

Log:
  Back out r351799
  
  empty does not appear to work like I thought it did and it actively breaks
  real LOCAL_MODULES usage, of which I have none at the moment...

Modified:
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Wed Sep  4 14:20:39 2019(r351815)
+++ head/sys/conf/kern.post.mk  Wed Sep  4 14:32:04 2019(r351816)
@@ -77,12 +77,10 @@ modules-${target}:
${target:S/^reinstall$/install/:S/^clobber$/cleandir/}
 .endif
 .for module in ${LOCAL_MODULES}
-.if !empty(module)
@${ECHODIR} "===> ${module} 
(${target:S/^reinstall$/install/:S/^clobber$/cleandir/})"
@cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} ${MAKE} \
DIRPRFX="${module}/" \
${target:S/^reinstall$/install/:S/^clobber$/cleandir/}
-.endif
 .endfor
 .endif
 .endfor
___
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: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Alan Somers
On Wed, Sep 4, 2019 at 8:21 AM Allan Jude  wrote:

> On 2019-09-04 09:50, Alan Somers wrote:
> > On Wed, Sep 4, 2019 at 7:47 AM Andriy Gapon  > > wrote:
> >
> > Author: avg
> > Date: Wed Sep  4 13:47:38 2019
> > New Revision: 351812
> > URL: https://svnweb.freebsd.org/changeset/base/351812
> >
> > Log:
> >   mpsutil slot set status
> >
> >   This code has been written as a proof of concept, but I think that
> it
> >   can be useful in general.  It allows to set the status of an
> enclosure
> >   slot.  Practically, this means controlling whatever slot status
> > LEDs the
> >   enclosure provides.  At present, the new command does not have
> sanity
> >   checks or any conveniences.  That means that it is possible to
> > issue the
> >   command for an invalid slot and an enclosure.  But the worst I
> > have seen
> >   happening is either the command failing or simply being ignored.
> > Also,
> >   at the moment, the status has to be specified as a numeric bit
> mask.
> >   The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h,
> they
> >   are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to
> address a
> >   slot is by the enclosure handle and the slot number.  Both are
> readily
> >   available from mpsutil show commands.
> >
> >   So, future enhancements could include alternative ways to address
> > a slot
> >   (e.g., by a disk handle or a disk device name) and human friendly
> > names
> >   for slot statuses.
> >
> >   The new command is useful alternative to 'sas2ircu locate' command.
> >   First, sas2ircu is a proprietary blob.  Second, it supports
> > setting only
> >   locate / identify status bit.
> >
> >   Tested on HP H220 running LSI IT firmware 20.x.
> >
> >   Reviewed by:  bapt
> >   MFC after:3 weeks
> >   Differential Revision:https://reviews.freebsd.org/D20535
> >
> > Added:
> >   head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
> > Modified:
> >   head/usr.sbin/mpsutil/Makefile
> >   head/usr.sbin/mpsutil/mps_cmd.c
> >   head/usr.sbin/mpsutil/mpsutil.h
> >
> >
> > Is this redundant with sesutil, or does it work on different kinds of
> > enclosures?
>
> mpsutil's method will work on direct-attach backplanes and enclosures,
> where sesutil only works if there is an expander that provides the SES
> service.
>
> --
> Allan Jude
>

By direct-attach, do you mean SGPIO, or is there some kind of backplane
where the HDD itself controls the LEDs?
___
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: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Allan Jude
On 2019-09-04 09:50, Alan Somers wrote:
> On Wed, Sep 4, 2019 at 7:47 AM Andriy Gapon  > wrote:
> 
> Author: avg
> Date: Wed Sep  4 13:47:38 2019
> New Revision: 351812
> URL: https://svnweb.freebsd.org/changeset/base/351812
> 
> Log:
>   mpsutil slot set status
> 
>   This code has been written as a proof of concept, but I think that it
>   can be useful in general.  It allows to set the status of an enclosure
>   slot.  Practically, this means controlling whatever slot status
> LEDs the
>   enclosure provides.  At present, the new command does not have sanity
>   checks or any conveniences.  That means that it is possible to
> issue the
>   command for an invalid slot and an enclosure.  But the worst I
> have seen
>   happening is either the command failing or simply being ignored. 
> Also,
>   at the moment, the status has to be specified as a numeric bit mask.
>   The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they
>   are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to address a
>   slot is by the enclosure handle and the slot number.  Both are readily
>   available from mpsutil show commands.
> 
>   So, future enhancements could include alternative ways to address
> a slot
>   (e.g., by a disk handle or a disk device name) and human friendly
> names
>   for slot statuses.
> 
>   The new command is useful alternative to 'sas2ircu locate' command.
>   First, sas2ircu is a proprietary blob.  Second, it supports
> setting only
>   locate / identify status bit.
> 
>   Tested on HP H220 running LSI IT firmware 20.x.
> 
>   Reviewed by:  bapt
>   MFC after:    3 weeks
>   Differential Revision:        https://reviews.freebsd.org/D20535
> 
> Added:
>   head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
> Modified:
>   head/usr.sbin/mpsutil/Makefile
>   head/usr.sbin/mpsutil/mps_cmd.c
>   head/usr.sbin/mpsutil/mpsutil.h
> 
> 
> Is this redundant with sesutil, or does it work on different kinds of
> enclosures? 

mpsutil's method will work on direct-attach backplanes and enclosures,
where sesutil only works if there is an expander that provides the SES
service.

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r351815 - head/sys/fs/pseudofs

2019-09-04 Thread Kyle Evans
Author: kevans
Date: Wed Sep  4 14:20:39 2019
New Revision: 351815
URL: https://svnweb.freebsd.org/changeset/base/351815

Log:
  pseudofs: make readdir work without a pid again
  
  Specifically, the following was broken:
  
  $ mount -t procfs procfs /proc
  $ ls -l /proc
  
  r351741 reworked readdir slightly to avoid pfs_node/pidhash LOR, but
  inadvertently regressed pid == NO_PID; new pfs_lookup_proc() fails for the
  obvious reasons, and later pfs_visible_proc doesn't capture the
  pid == NO_PID -> return 1 aspect of pfs_visible. We can infact skip this
  whole block if we're operating on a directory w/ NO_PID, as it's always
  visible.
  
  Reported by:  trasz
  Reviewed by:  mjg
  Differential Revision:https://reviews.freebsd.org/D21518

Modified:
  head/sys/fs/pseudofs/pseudofs_vnops.c

Modified: head/sys/fs/pseudofs/pseudofs_vnops.c
==
--- head/sys/fs/pseudofs/pseudofs_vnops.c   Wed Sep  4 14:05:04 2019
(r351814)
+++ head/sys/fs/pseudofs/pseudofs_vnops.c   Wed Sep  4 14:20:39 2019
(r351815)
@@ -809,23 +809,28 @@ pfs_readdir(struct vop_readdir_args *va)
if (resid == 0)
PFS_RETURN (0);
 
-   if (!pfs_lookup_proc(pid, ))
+   proc = NULL;
+   if (pid != NO_PID && !pfs_lookup_proc(pid, ))
PFS_RETURN (ENOENT);
 
sx_slock(_lock);
pfs_lock(pd);
-   PROC_LOCK(proc);
 
-/* check if the directory is visible to the caller */
-if (!pfs_visible_proc(curthread, pd, proc)) {
-   _PRELE(proc);
-   PROC_UNLOCK(proc);
-   sx_sunlock(_lock);
-   pfs_unlock(pd);
-PFS_RETURN (ENOENT);
-   }
KASSERT(pid == NO_PID || proc != NULL,
("%s(): no process for pid %lu", __func__, (unsigned long)pid));
+
+   if (pid != NO_PID) {
+   PROC_LOCK(proc);
+
+   /* check if the directory is visible to the caller */
+   if (!pfs_visible_proc(curthread, pd, proc)) {
+   _PRELE(proc);
+   PROC_UNLOCK(proc);
+   sx_sunlock(_lock);
+   pfs_unlock(pd);
+   PFS_RETURN (ENOENT);
+   }
+   }
 
/* skip unwanted entries */
for (pn = NULL, p = NULL; offset > 0; offset -= PFS_DELEN) {
___
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: r351813 - head/sbin/bectl

2019-09-04 Thread Kyle Evans
Author: kevans
Date: Wed Sep  4 13:59:06 2019
New Revision: 351813
URL: https://svnweb.freebsd.org/changeset/base/351813

Log:
  bectl(8): implement sorting for 'bectl list' output
  
  Allow 'bectl list' to sort output by a given property name. The property
  name is passed in using a command-line flag, '-c' for ascending order and
  '-C' for descending order. The properties allowed to sort by are:
  
  - name (the default output, even if '-c' or '-C' are not used)
  - creation
  - origin
  - used
  - usedds
  - usedsnap
  - usedrefreserv
  
  The default output for 'bectl list' is now ascending alphabetical order of
  BE name.
  
  To sort by creation time from earliest to latest, the command would be
  'bectl list -c creation'
  
  Submitted by: Rob Fairbanks 
  Reviewed by:  ler
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D20818

Modified:
  head/sbin/bectl/bectl.8
  head/sbin/bectl/bectl.c
  head/sbin/bectl/bectl_list.c

Modified: head/sbin/bectl/bectl.8
==
--- head/sbin/bectl/bectl.8 Wed Sep  4 13:47:38 2019(r351812)
+++ head/sbin/bectl/bectl.8 Wed Sep  4 13:59:06 2019(r351813)
@@ -18,7 +18,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 12, 2019
+.Dd September 4, 2019
 .Dt BECTL 8
 .Os
 .Sh NAME
@@ -57,6 +57,9 @@
 .Nm
 .Cm list
 .Op Fl aDHs
+.Op Fl c Ar property
+.Op Fl C Ar property
+.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc
 .Nm
 .Cm mount
 .Ar beName
@@ -234,7 +237,12 @@ generated by
 .El
 .Pp
 All default parameters may be overwritten.
-.It Cm list Op Fl aDHs
+.It Xo
+.Cm list
+.Op Fl DHas
+.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc
+.Xc
+.Pp
 Display all boot environments.
 The
 .Em Active
@@ -245,21 +253,44 @@ active on reboot
 or both
 .Pq Em \ .
 .Pp
-If
-.Fl a
-is used, display all datasets.
-If
-.Fl D
-is used, display the full space usage for each boot environment, assuming all
+.Bl -tag -width indent
+.It Fl a
+Display all datasets.
+.It Fl D
+Display the full space usage for each boot environment, assuming all
 other boot environments were destroyed.
-The
-.Fl H
-option is used for scripting.
-It does not print headers and separate fields by a single tab instead of
+.It Fl H
+Used for scripting.
+Do not print headers and separate fields by a single tab instead of
 arbitrary white space.
-If
+.It Fl s
+Display all snapshots as well.
+.It Fl c Ar property
+Sort boot environments by given property name.
+The following properties are supported:
+.Pp
+.Bl -tag -width 4n -offset indent -compact
+.It name (default output)
+.It creation
+.It origin
+.It used
+.It usedds
+.It usedsnap
+.It usedrefreserv
+.El
+.It Fl C Ar property
+Same as the
+.Fl c
+option, but displays in descending order.
+.El
+.Pp
+The
+.Fl D
+option is ignored when either the
 .Fl s
-is used, display all snapshots as well.
+or
+.Fl a
+option is used.
 .It Cm mount Ar beName Op Ar mountpoint
 Temporarily mount the boot environment.
 Mount at the specified

Modified: head/sbin/bectl/bectl.c
==
--- head/sbin/bectl/bectl.c Wed Sep  4 13:47:38 2019(r351812)
+++ head/sbin/bectl/bectl.c Wed Sep  4 13:59:06 2019(r351813)
@@ -80,7 +80,7 @@ usage(bool explicit)
"\tbectl jail {-b | -U} [{-o key=value | -u key}]... "
"{jailID | jailName}\n"
"\t  bootenv [utility [argument ...]]\n"
-   "\tbectl list [-DHas]\n"
+   "\tbectl list [-DHas] [{-c property | -C property}]\n"
"\tbectl mount beName [mountpoint]\n"
"\tbectl rename origBeName newBeName\n"
"\tbectl {ujail | unjail} {jailID | jailName} bootenv\n"

Modified: head/sbin/bectl/bectl_list.c
==
--- head/sbin/bectl/bectl_list.cWed Sep  4 13:47:38 2019
(r351812)
+++ head/sbin/bectl/bectl_list.cWed Sep  4 13:59:06 2019
(r351813)
@@ -38,6 +38,12 @@ __FBSDID("$FreeBSD$");
 
 #include "bectl.h"
 
+struct sort_column {
+   char *name;
+   char *val;
+   nvlist_t *nvl;
+};
+
 struct printc {
int active_colsz_def;
int be_colsz;
@@ -324,6 +330,74 @@ print_headers(nvlist_t *props, struct printc *pc)
printf("\n");
 }
 
+/*
+ * Sort the given nvlist of boot environments by property.
+ */
+static int
+prop_list_sort(nvlist_t *props, char *property, bool reverse)
+{
+   nvpair_t *nvp;
+   nvlist_t *nvl;
+   int i, nvp_count;
+   uint64_t lval, rval;
+   struct sort_column sc_prev, sc_next;
+
+   /* a temporary list to work with */
+   nvlist_dup(props, , 0);
+
+   nvp_count = fnvlist_num_pairs(nvl);
+   for (i = 0; i < nvp_count; i++) {
+
+   nvp = nvlist_next_nvpair(nvl, NULL);
+   nvpair_value_nvlist(nvp, _prev.nvl);
+   

Re: svn commit: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Alan Somers
On Wed, Sep 4, 2019 at 7:47 AM Andriy Gapon  wrote:

> Author: avg
> Date: Wed Sep  4 13:47:38 2019
> New Revision: 351812
> URL: https://svnweb.freebsd.org/changeset/base/351812
>
> Log:
>   mpsutil slot set status
>
>   This code has been written as a proof of concept, but I think that it
>   can be useful in general.  It allows to set the status of an enclosure
>   slot.  Practically, this means controlling whatever slot status LEDs the
>   enclosure provides.  At present, the new command does not have sanity
>   checks or any conveniences.  That means that it is possible to issue the
>   command for an invalid slot and an enclosure.  But the worst I have seen
>   happening is either the command failing or simply being ignored.  Also,
>   at the moment, the status has to be specified as a numeric bit mask.
>   The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they
>   are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to address a
>   slot is by the enclosure handle and the slot number.  Both are readily
>   available from mpsutil show commands.
>
>   So, future enhancements could include alternative ways to address a slot
>   (e.g., by a disk handle or a disk device name) and human friendly names
>   for slot statuses.
>
>   The new command is useful alternative to 'sas2ircu locate' command.
>   First, sas2ircu is a proprietary blob.  Second, it supports setting only
>   locate / identify status bit.
>
>   Tested on HP H220 running LSI IT firmware 20.x.
>
>   Reviewed by:  bapt
>   MFC after:3 weeks
>   Differential Revision:https://reviews.freebsd.org/D20535
>
> Added:
>   head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
> Modified:
>   head/usr.sbin/mpsutil/Makefile
>   head/usr.sbin/mpsutil/mps_cmd.c
>   head/usr.sbin/mpsutil/mpsutil.h
>

Is this redundant with sesutil, or does it work on different kinds of
enclosures?
___
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: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Andriy Gapon
Author: avg
Date: Wed Sep  4 13:47:38 2019
New Revision: 351812
URL: https://svnweb.freebsd.org/changeset/base/351812

Log:
  mpsutil slot set status
  
  This code has been written as a proof of concept, but I think that it
  can be useful in general.  It allows to set the status of an enclosure
  slot.  Practically, this means controlling whatever slot status LEDs the
  enclosure provides.  At present, the new command does not have sanity
  checks or any conveniences.  That means that it is possible to issue the
  command for an invalid slot and an enclosure.  But the worst I have seen
  happening is either the command failing or simply being ignored.  Also,
  at the moment, the status has to be specified as a numeric bit mask.
  The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they
  are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to address a
  slot is by the enclosure handle and the slot number.  Both are readily
  available from mpsutil show commands.
  
  So, future enhancements could include alternative ways to address a slot
  (e.g., by a disk handle or a disk device name) and human friendly names
  for slot statuses.
  
  The new command is useful alternative to 'sas2ircu locate' command.
  First, sas2ircu is a proprietary blob.  Second, it supports setting only
  locate / identify status bit.
  
  Tested on HP H220 running LSI IT firmware 20.x.
  
  Reviewed by:  bapt
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D20535

Added:
  head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
Modified:
  head/usr.sbin/mpsutil/Makefile
  head/usr.sbin/mpsutil/mps_cmd.c
  head/usr.sbin/mpsutil/mpsutil.h

Modified: head/usr.sbin/mpsutil/Makefile
==
--- head/usr.sbin/mpsutil/Makefile  Wed Sep  4 13:44:46 2019
(r351811)
+++ head/usr.sbin/mpsutil/Makefile  Wed Sep  4 13:47:38 2019
(r351812)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PROG=  mpsutil
-SRCS=  mps_cmd.c mps_debug.c mps_flash.c mps_show.c mpsutil.c
+SRCS=  mps_cmd.c mps_debug.c mps_flash.c mps_show.c mps_slot.c mpsutil.c
 MAN=   mpsutil.8
 
 WARNS?= 3

Modified: head/usr.sbin/mpsutil/mps_cmd.c
==
--- head/usr.sbin/mpsutil/mps_cmd.c Wed Sep  4 13:44:46 2019
(r351811)
+++ head/usr.sbin/mpsutil/mps_cmd.c Wed Sep  4 13:47:38 2019
(r351812)
@@ -283,6 +283,29 @@ mps_map_btdh(int fd, uint16_t *devhandle, uint16_t *bu
 }
 
 int
+mps_set_slot_status(int fd, U16 handle, U16 slot, U32 status)
+{
+   MPI2_SEP_REQUEST req;
+   MPI2_SEP_REPLY reply;
+
+   bzero(, sizeof(req));
+   req.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
+   req.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS;
+   req.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS;
+   req.EnclosureHandle = handle;
+   req.Slot = slot;
+   req.SlotStatus = status;
+
+   if (mps_pass_command(fd, , sizeof(req), , sizeof(reply),
+   NULL, 0, NULL, 0, 30) != 0)
+   return (errno);
+
+   if (!IOC_STATUS_SUCCESS(reply.IOCStatus))
+   return (EIO);
+   return (0);
+}
+
+int
 mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 
PageAddress,
 MPI2_CONFIG_PAGE_HEADER *header, U16 *IOCStatus)
 {

Added: head/usr.sbin/mpsutil/mps_slot.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/mpsutil/mps_slot.cWed Sep  4 13:47:38 2019
(r351812)
@@ -0,0 +1,114 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Andriy Gapon 
+ *
+ * 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
+ 

svn commit: r351811 - in head: lib/libc/compat-43 usr.bin/dc usr.bin/sort

2019-09-04 Thread Sevan Janiyan
Author: sevan (doc committer)
Date: Wed Sep  4 13:44:46 2019
New Revision: 351811
URL: https://svnweb.freebsd.org/changeset/base/351811

Log:
  Adjust history, info source from v1's manuals
  https://www.bell-labs.com/usr/dmr/www/1stEdman.html
  
  MFC after:5 days

Modified:
  head/lib/libc/compat-43/creat.2
  head/usr.bin/dc/dc.1
  head/usr.bin/sort/sort.1.in

Modified: head/lib/libc/compat-43/creat.2
==
--- head/lib/libc/compat-43/creat.2 Wed Sep  4 13:26:59 2019
(r351810)
+++ head/lib/libc/compat-43/creat.2 Wed Sep  4 13:44:46 2019
(r351811)
@@ -28,7 +28,7 @@
 .\" @(#)creat.28.1 (Berkeley) 6/2/93
 .\" $FreeBSD$
 .\"
-.Dd June 2, 1993
+.Dd September 4, 2019
 .Dt CREAT 2
 .Os
 .Sh NAME
@@ -59,4 +59,4 @@ open(path, O_CREAT | O_TRUNC | O_WRONLY, mode);
 The
 .Fn creat
 function appeared in
-.At v6 .
+.At v1 .

Modified: head/usr.bin/dc/dc.1
==
--- head/usr.bin/dc/dc.1Wed Sep  4 13:26:59 2019(r351810)
+++ head/usr.bin/dc/dc.1Wed Sep  4 13:44:46 2019(r351811)
@@ -35,7 +35,7 @@
 .\"
 .\"@(#)dc.18.1 (Berkeley) 6/6/93
 .\"
-.Dd December 5, 2017
+.Dd September 4, 2019
 .Dt DC 1
 .Os
 .Sh NAME
@@ -537,7 +537,7 @@ specification.
 The
 .Nm
 command first appeared in
-.At v6 .
+.At v1 .
 A complete rewrite of the
 .Nm
 command using the

Modified: head/usr.bin/sort/sort.1.in
==
--- head/usr.bin/sort/sort.1.in Wed Sep  4 13:26:59 2019(r351810)
+++ head/usr.bin/sort/sort.1.in Wed Sep  4 13:44:46 2019(r351811)
@@ -33,7 +33,7 @@
 .\"
 .\" @(#)sort.1 8.1 (Berkeley) 6/6/93
 .\"
-.Dd March 19, 2015
+.Dd September 4, 2019
 .Dt SORT 1
 .Os
 .Sh NAME
@@ -607,7 +607,7 @@ and are still supported but their use is highly discou
 A
 .Nm
 command first appeared in
-.At v3 .
+.At v1 .
 .Sh AUTHORS
 .An Gabor Kovesdan Aq Mt ga...@freebsd.org ,
 .Pp
___
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: r351810 - head/sys/kern

2019-09-04 Thread Andriy Gapon
Author: avg
Date: Wed Sep  4 13:26:59 2019
New Revision: 351810
URL: https://svnweb.freebsd.org/changeset/base/351810

Log:
  shutdown_halt: make sure that watchdog timer is stopped
  
  The point of halt is to keep the machine in limbo.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Differential Revision: https://reviews.freebsd.org/D21222

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Wed Sep  4 09:54:21 2019
(r351809)
+++ head/sys/kern/kern_shutdown.c   Wed Sep  4 13:26:59 2019
(r351810)
@@ -592,6 +592,9 @@ shutdown_halt(void *junk, int howto)
printf("\n");
printf("The operating system has halted.\n");
printf("Please press any key to reboot.\n\n");
+
+   wdog_kern_pat(WD_TO_NEVER);
+
switch (cngetc()) {
case -1:/* No console, just die */
cpu_halt();
___
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: r351803 - in head: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-09-04 Thread Andriy Gapon
Author: avg
Date: Wed Sep  4 07:33:22 2019
New Revision: 351803
URL: https://svnweb.freebsd.org/changeset/base/351803

Log:
  ZFS: Always refuse receving non-resume stream when resume state exists
  
  This fixes a hole in the situation where the resume state is left from
  receiving a new dataset and, so, the state is set on the dataset itself
  (as opposed to %recv child).
  
  Additionally, distinguish incremental and resume streams in error
  messages.
  
  This was also committed to ZoL:
  zfsonlinux/zfs@ebeb6f23bf7e8fe6732a05267ed1cab4c38d3b23
  
  MFC after:2 weeks
  Sponsored by: CyberSecure

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Wed Sep 
 4 04:44:03 2019(r351802)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Wed Sep 
 4 07:33:22 2019(r351803)
@@ -3278,11 +3278,18 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
}
} else {
/*
-* if the fs does not exist, look for it based on the
-* fromsnap GUID
+* If the fs does not exist, look for it based on the
+* fromsnap GUID.
 */
-   (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
-   "cannot receive incremental stream"));
+   if (resuming) {
+   (void) snprintf(errbuf, sizeof (errbuf),
+   dgettext(TEXT_DOMAIN,
+   "cannot receive resume stream"));
+   } else {
+   (void) snprintf(errbuf, sizeof (errbuf),
+   dgettext(TEXT_DOMAIN,
+   "cannot receive incremental stream"));
+   }
 
(void) strcpy(zc.zc_name, zc.zc_value);
*strchr(zc.zc_name, '@') = '\0';

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c  Wed Sep 
 4 04:44:03 2019(r351802)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c  Wed Sep 
 4 07:33:22 2019(r351803)
@@ -1311,19 +1311,23 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *d
int error;
dsl_pool_t *dp = ds->ds_dir->dd_pool;
 
-   /* temporary clone name must not exist */
+   /* Temporary clone name must not exist. */
error = zap_lookup(dp->dp_meta_objset,
dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, recv_clone_name,
8, 1, );
if (error != ENOENT)
-   return (error == 0 ? EBUSY : error);
+   return (error == 0 ? SET_ERROR(EBUSY) : error);
 
-   /* new snapshot name must not exist */
+   /* Resume state must not be set. */
+   if (dsl_dataset_has_resume_receive_state(ds))
+   return (SET_ERROR(EBUSY));
+
+   /* New snapshot name must not exist. */
error = zap_lookup(dp->dp_meta_objset,
dsl_dataset_phys(ds)->ds_snapnames_zapobj,
drba->drba_cookie->drc_tosnap, 8, 1, );
if (error != ENOENT)
-   return (error == 0 ? EEXIST : error);
+   return (error == 0 ? SET_ERROR(EEXIST) : error);
 
/*
 * Check snapshot limit before receiving. We'll recheck again at the
___
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: r351673 - in head: lib/libmemstat share/man/man9 sys/cddl/compat/opensolaris/kern sys/kern sys/vm

2019-09-04 Thread Andriy Gapon
On 04/09/2019 01:01, Mark Johnston wrote:
> Some of the vm_lowmem eventhandlers probably shouldn't be called each
> time the page daemon scans the inactive queue (every 0.1s under memory
> pressure).  ufsdirhash_lowmem and mb_reclaim in particular don't seem
> like they need to be invoked very frequently.  We could easily define
> multiple eventhandlers to differentiate between these cases, though.

My proposal is to run uma_reclaim(UMA_RECLAIM_TRIM) before invoking vm_lowmem.
If that reclaims "enough" memory, then do not call vm_lowmem at all.

Oh, and I have a related question.
Say, a zone has X items in use and Y items in cache.
After running vm_lowmem the composition changes to X - C and Y + C respectively.
Then we run uma_reclaim(UMA_RECLAIM_TRIM).
Question: is that guaranteed to free at least C items?
I am thinking about a possibility that the zone's workset size is estimated to
be at least X (and maybe even more than X + Y).  In that case UMA_RECLAIM_TRIM
won't free those C items, they will stay in the cache.  So, it seems like
releasing them was in vain, at least for the immediate reclaim.

-- 
Andriy Gapon
___
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: r351673 - in head: lib/libmemstat share/man/man9 sys/cddl/compat/opensolaris/kern sys/kern sys/vm

2019-09-04 Thread Andriy Gapon
On 04/09/2019 01:01, Mark Johnston wrote:
> Slawa and I talked about this in the past.  His complaint is that a
> large cache can take a significant amount of time to trim, and it
> manifests as a spike of CPU usage and contention on the zone lock.  In
> particular, keg_drain() iterates over the list of free slabs with the
> keg lock held, and if the many items were freed to the keg while
> trimming/draining, the list can be quite long.  This can have effects
> outside the zone, for example if we are reclaiming items from zones used
> by other UMA zones, like the bucket or slab zones.

My concern is different, though.
I feel that having oversized caches for long periods of time produces a skewed
picture of memory usage.  Particularly, some ZFS caches are sometimes extremely
oversized.  I don't care much about details of consequences of such oversized
caches.  I just think that that is not right on a more general level.

> Reclaiming cached items when there is no demand for free pages seems
> wrong to me.

It certainly was wrong before.
Now that we have a capability to trim a cache size to a workset size it doesn't
feel as wrong to me.

> We historically had similar problems with the page daemon,
> which last year was changed to perform smaller reclamations at a greater
> frequency.  I suspect a better approach for UMA would be to similarly
> increase reclaim frequency and reduce the number of items freed in one
> go.



-- 
Andriy Gapon
___
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"