svn commit: r355521 - in head: stand/powerpc/kboot sys/conf sys/powerpc/include

2019-12-07 Thread Justin Hibbits
Author: jhibbits
Date: Sun Dec  8 04:36:42 2019
New Revision: 355521
URL: https://svnweb.freebsd.org/changeset/base/355521

Log:
  powerpc: Use builtins for fls/flsl
  
  Summary:
  There's no need to use the fallback fls() and flsl() libkern functions
  when the PowerISA includes instructions that already do the bulk of the
  work.  Take advantage of this through the GCC builtins __builtin_clz()
  and __builtin_clzl().
  
  Reviewed by:  luporl
  Differential Revision:https://reviews.freebsd.org/D22340

Modified:
  head/stand/powerpc/kboot/main.c
  head/sys/conf/files.powerpc
  head/sys/powerpc/include/cpufunc.h

Modified: head/stand/powerpc/kboot/main.c
==
--- head/stand/powerpc/kboot/main.c Sun Dec  8 04:19:05 2019
(r355520)
+++ head/stand/powerpc/kboot/main.c Sun Dec  8 04:36:42 2019
(r355521)
@@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#define _KERNEL
 #include 
 #include "bootstrap.h"
 #include "host_syscall.h"

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sun Dec  8 04:19:05 2019(r355520)
+++ head/sys/conf/files.powerpc Sun Dec  8 04:36:42 2019(r355521)
@@ -88,8 +88,6 @@ libkern/divdi3.c  optionalpowerpc | 
powerpcspe
 libkern/ffs.c  standard
 libkern/ffsl.c standard
 libkern/ffsll.cstandard
-libkern/fls.c  standard
-libkern/flsl.c standard
 libkern/flsll.cstandard
 libkern/lshrdi3.c  optionalpowerpc | powerpcspe
 libkern/memcmp.c   standard

Modified: head/sys/powerpc/include/cpufunc.h
==
--- head/sys/powerpc/include/cpufunc.h  Sun Dec  8 04:19:05 2019
(r355520)
+++ head/sys/powerpc/include/cpufunc.h  Sun Dec  8 04:36:42 2019
(r355521)
@@ -212,6 +212,20 @@ get_pcpu(void)
return (ret);
 }
 
+#defineHAVE_INLINE_FLS
+static __inline __pure2 int
+fls(int mask)
+{
+   return (mask ? 32 - __builtin_clz(mask) : 0);
+}
+
+#define HAVE_INLINE_FLSL
+static __inline __pure2 int
+flsl(long mask)
+{
+   return (mask ? (8 * sizeof(long) - __builtin_clzl(mask)) : 0);
+}
+
 /* "NOP" operations to signify priorities to the kernel. */
 static __inline void
 nop_prio_vlow(void)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355520 - stable/12/bin/dd

2019-12-07 Thread Matt Macy
Author: mmacy
Date: Sun Dec  8 04:19:05 2019
New Revision: 355520
URL: https://svnweb.freebsd.org/changeset/base/355520

Log:
  MFC r351770,r352920-r352923
  
  MFCs to dd appear to have been haphazard so selectively
  MFCing individually didn't work easily.
  
  Add conv=fsync flag to dd
  
  The fsync flag performs an fsync(2) on the output file before closing it.
  This will be useful for the ZFS test suite.
  
  Add conv=fdatasync flag to dd
  
  The fdatasync flag performs an fdatasync(2) on the output file before closing 
it.
  This will be useful for the ZFS test suite.
  
  dd: Check result of close(2) for errors
  
  close(2) can return errors from previous operations which should not be 
ignored.
  
  Add oflag=fsync and oflag=sync capability to dd
  
  Sets the O_FSYNC flag on the output file. oflag=fsync and oflag=sync are
  synonyms just as O_FSYNC and O_SYNC are synonyms. This functionality is
  intended to improve portability of dd commands in the ZFS test suite.
  
  Add iflag=fullblock to dd
  
  Normally, count=n means read(2) will be called n times on the input to dd. If
  the read() returns short, as may happen when reading from a pipe, fewer bytes
  will be copied from the input. With conv=sync the buffer is padded with zeros
  to fill the rest of the block.
  
  iflag=fullblock causes dd to continue reading until the block is full, so that
  count=n means n full blocks are copied. This flag is compatible with illumos
  and GNU dd and is used in the ZFS test suite.
  
  Submitted by: Ryan Moeller, Thomas Hurst
  Reviewed by:  manpages, mmacy@
  Sponsored by: iXsystems, Inc.

Modified:
  stable/12/bin/dd/args.c
  stable/12/bin/dd/dd.1
  stable/12/bin/dd/dd.c
  stable/12/bin/dd/dd.h
  stable/12/bin/dd/extern.h

Modified: stable/12/bin/dd/args.c
==
--- stable/12/bin/dd/args.c Sun Dec  8 04:17:04 2019(r355519)
+++ stable/12/bin/dd/args.c Sun Dec  8 04:19:05 2019(r355520)
@@ -41,7 +41,7 @@ static char sccsid[] = "@(#)args.c8.3 (Berkeley) 4/2/
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
+#include 
 
 #include 
 #include 
@@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$");
 
 static int c_arg(const void *, const void *);
 static int c_conv(const void *, const void *);
+static int c_iflag(const void *, const void *);
+static int c_oflag(const void *, const void *);
 static voidf_bs(char *);
 static voidf_cbs(char *);
 static voidf_conv(char *);
@@ -65,8 +67,10 @@ static void  f_files(char *);
 static voidf_fillchar(char *);
 static voidf_ibs(char *);
 static voidf_if(char *);
+static voidf_iflag(char *);
 static voidf_obs(char *);
 static voidf_of(char *);
+static voidf_oflag(char *);
 static voidf_seek(char *);
 static voidf_skip(char *);
 static voidf_speed(char *);
@@ -77,7 +81,7 @@ static off_t  get_off_t(const char *);
 static const struct arg {
const char *name;
void (*f)(char *);
-   u_int set, noset;
+   uint64_t set, noset;
 } args[] = {
{ "bs", f_bs,   C_BS,C_BS|C_IBS|C_OBS|C_OSYNC },
{ "cbs",f_cbs,  C_CBS,   C_CBS },
@@ -87,9 +91,11 @@ static const struct arg {
{ "fillchar",   f_fillchar, C_FILL,  C_FILL },
{ "ibs",f_ibs,  C_IBS,   C_BS|C_IBS },
{ "if", f_if,   C_IF,C_IF },
+   { "iflag",  f_iflag,0,   0 },
{ "iseek",  f_skip, C_SKIP,  C_SKIP },
{ "obs",f_obs,  C_OBS,   C_BS|C_OBS },
{ "of", f_of,   C_OF,C_OF },
+   { "oflag",  f_oflag,0,   0 },
{ "oseek",  f_seek, C_SEEK,  C_SEEK },
{ "seek",   f_seek, C_SEEK,  C_SEEK },
{ "skip",   f_skip, C_SKIP,  C_SKIP },
@@ -256,7 +262,39 @@ f_if(char *arg)
in.name = arg;
 }
 
+static const struct iflag {
+   const char *name;
+   uint64_t set, noset;
+} ilist[] = {
+   { "fullblock",  C_IFULLBLOCK,   C_SYNC },
+};
+
 static void
+f_iflag(char *arg)
+{
+   struct iflag *ip, tmp;
+
+   while (arg != NULL) {
+   tmp.name = strsep(, ",");
+   ip = bsearch(, ilist, nitems(ilist), sizeof(struct iflag),
+   c_iflag);
+   if (ip == NULL)
+   errx(1, "unknown iflag %s", tmp.name);
+   if (ddflags & ip->noset)
+   errx(1, "%s: illegal conversion combination", tmp.name);
+   ddflags |= ip->set;
+   }
+}
+
+static int
+c_iflag(const void *a, const void *b)
+{
+
+   return (strcmp(((const struct iflag *)a)->name,
+   ((const struct iflag *)b)->name));
+}
+
+static void
 f_obs(char *arg)
 {
uintmax_t res;
@@ -314,12 +352,14 @@ f_status(char *arg)
  
 static const struct conv {
const char *name;
-   u_int set, 

svn commit: r355519 - head/sys/powerpc/aim

2019-12-07 Thread Justin Hibbits
Author: jhibbits
Date: Sun Dec  8 04:17:04 2019
New Revision: 355519
URL: https://svnweb.freebsd.org/changeset/base/355519

Log:
  powerpc64/pmap: micro-optimize some PVO-PTE logic
  
  Summary:
  moea64_pte_sync_native() and moea64_pte_unset_native() don't need the
  full PTE created, they only need to check that the PVO has a matching
  PTE to the PTE in the page table.  Don't waste time creating the full
  PTE in this case.
  
  Reviewed by:  luporl
  Differential Revision:https://reviews.freebsd.org/D22341

Modified:
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/aim/mmu_oea64.h
  head/sys/powerpc/aim/moea64_native.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cSun Dec  8 02:11:06 2019
(r355518)
+++ head/sys/powerpc/aim/mmu_oea64.cSun Dec  8 04:17:04 2019
(r355519)
@@ -435,8 +435,7 @@ void
 moea64_pte_from_pvo(const struct pvo_entry *pvo, struct lpte *lpte)
 {
 
-   lpte->pte_hi = (pvo->pvo_vpn >> (ADDR_API_SHFT64 - ADDR_PIDX_SHFT)) &
-   LPTE_AVPN_MASK;
+   lpte->pte_hi = moea64_pte_vpn_from_pvo_vpn(pvo);
lpte->pte_hi |= LPTE_VALID;

if (pvo->pvo_vaddr & PVO_LARGE)

Modified: head/sys/powerpc/aim/mmu_oea64.h
==
--- head/sys/powerpc/aim/mmu_oea64.hSun Dec  8 02:11:06 2019
(r355518)
+++ head/sys/powerpc/aim/mmu_oea64.hSun Dec  8 04:17:04 2019
(r355519)
@@ -76,6 +76,13 @@ void moea64_mid_bootstrap(mmu_t mmup, vm_offset_t ker
 void   moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelstart,
vm_offset_t kernelend);
 
+static inline uint64_t
+moea64_pte_vpn_from_pvo_vpn(const struct pvo_entry *pvo)
+{
+   return ((pvo->pvo_vpn >> (ADDR_API_SHFT64 - ADDR_PIDX_SHFT)) &
+   LPTE_AVPN_MASK);
+}
+
 /*
  * Statistics
  */

Modified: head/sys/powerpc/aim/moea64_native.c
==
--- head/sys/powerpc/aim/moea64_native.cSun Dec  8 02:11:06 2019
(r355518)
+++ head/sys/powerpc/aim/moea64_native.cSun Dec  8 04:17:04 2019
(r355519)
@@ -257,16 +257,14 @@ static int64_t
 moea64_pte_synch_native(mmu_t mmu, struct pvo_entry *pvo)
 {
volatile struct lpte *pt = moea64_pteg_table + pvo->pvo_pte.slot;
-   struct lpte properpt;
-   uint64_t ptelo;
+   uint64_t ptelo, pvo_ptevpn;
 
PMAP_LOCK_ASSERT(pvo->pvo_pmap, MA_OWNED);
 
-   moea64_pte_from_pvo(pvo, );
+   pvo_ptevpn = moea64_pte_vpn_from_pvo_vpn(pvo);
 
rw_rlock(_eviction_lock);
-   if ((be64toh(pt->pte_hi) & LPTE_AVPN_MASK) !=
-   (properpt.pte_hi & LPTE_AVPN_MASK)) {
+   if ((be64toh(pt->pte_hi) & LPTE_AVPN_MASK) != pvo_ptevpn) {
/* Evicted */
rw_runlock(_eviction_lock);
return (-1);
@@ -330,14 +328,12 @@ static int64_t
 moea64_pte_unset_native(mmu_t mmu, struct pvo_entry *pvo)
 {
volatile struct lpte *pt = moea64_pteg_table + pvo->pvo_pte.slot;
-   struct lpte properpt;
-   uint64_t ptelo;
+   uint64_t ptelo, pvo_ptevpn;
 
-   moea64_pte_from_pvo(pvo, );
+   pvo_ptevpn = moea64_pte_vpn_from_pvo_vpn(pvo);
 
rw_rlock(_eviction_lock);
-   if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) !=
-   (properpt.pte_hi & LPTE_AVPN_MASK)) {
+   if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) != pvo_ptevpn) {
/* Evicted */
STAT_MOEA64(moea64_pte_overflow--);
rw_runlock(_eviction_lock);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355518 - head/share/man/man5

2019-12-07 Thread Kristof Provost
Author: kp
Date: Sun Dec  8 02:11:06 2019
New Revision: 355518
URL: https://svnweb.freebsd.org/changeset/base/355518

Log:
  pf: Remove references to 'egress'
  
  Avoid giving users the impression that FreeBSD has the automatic interface
  group 'egress'.
  
  Submitted by: tj AT mrsk.me

Modified:
  head/share/man/man5/pf.conf.5

Modified: head/share/man/man5/pf.conf.5
==
--- head/share/man/man5/pf.conf.5   Sun Dec  8 01:55:23 2019
(r355517)
+++ head/share/man/man5/pf.conf.5   Sun Dec  8 02:11:06 2019
(r355518)
@@ -28,7 +28,7 @@
 .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 10, 2019
+.Dd December 7, 2019
 .Dt PF.CONF 5
 .Os
 .Sh NAME
@@ -2616,7 +2616,7 @@ block.
 Brace delimited blocks may contain rules or other brace-delimited blocks.
 When anchors are loaded this way the anchor name becomes optional.
 .Bd -literal -offset indent
-anchor "external" on egress {
+anchor "external" on $ext_if {
block
anchor out {
pass proto tcp from any to port { 25, 80, 443 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355517 - head/sys/vm

2019-12-07 Thread Jeff Roberson
Author: jeff
Date: Sun Dec  8 01:55:23 2019
New Revision: 355517
URL: https://svnweb.freebsd.org/changeset/base/355517

Log:
  Fix two problems with r355149.  The sysctl name collision code assumed that
  zones would never be freed.  In the case of tmpfs this was not true.  While
  here test for the right bit to disable the keg related sysctls for zones
  that don't have kegs.
  
  Reported by:  pho
  Reviewed by:  rlibby
  Differential Revision:https://reviews.freebsd.org/D22655

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Sun Dec  8 01:49:53 2019(r355516)
+++ head/sys/vm/uma_core.c  Sun Dec  8 01:55:23 2019(r355517)
@@ -1859,14 +1859,13 @@ zone_alloc_counters(uma_zone_t zone, void *unused)
zone->uz_fails = counter_u64_alloc(M_WAITOK);
 }
 
-#defineUMA_MAX_DUP 999
 static void
 zone_alloc_sysctl(uma_zone_t zone, void *unused)
 {
uma_zone_domain_t zdom;
uma_keg_t keg;
struct sysctl_oid *oid, *domainoid;
-   int domains, i;
+   int domains, i, cnt;
static const char *nokeg = "cache zone";
char *c;
 
@@ -1876,10 +1875,11 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused)
 * an index.
 */
if (zone->uz_namecnt != 0) {
-   if (zone->uz_namecnt > UMA_MAX_DUP)
-   zone->uz_namecnt = UMA_MAX_DUP;
-   zone->uz_ctlname = malloc(strlen(zone->uz_name) +
-   sizeof(__XSTRING(UMA_MAX_DUP)) + 1 , M_UMA, M_WAITOK);
+   /* Count the number of decimal digits and '_' separator. */
+   for (i = 1, cnt = zone->uz_namecnt; cnt != 0; i++)
+   cnt /= 10;
+   zone->uz_ctlname = malloc(strlen(zone->uz_name) + i + 1,
+   M_UMA, M_WAITOK);
sprintf(zone->uz_ctlname, "%s_%d", zone->uz_name,
zone->uz_namecnt);
} else
@@ -1912,7 +1912,7 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused)
oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(zone->uz_oid), OID_AUTO,
"keg", CTLFLAG_RD, NULL, "");
keg = zone->uz_keg;
-   if ((zone->uz_flags & UMA_ZFLAG_CACHEONLY) == 0) {
+   if ((zone->uz_flags & UMA_ZFLAG_CACHE) == 0) {
SYSCTL_ADD_CONST_STRING(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
"name", CTLFLAG_RD, keg->uk_name, "Keg name");
SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO,
@@ -2018,8 +2018,14 @@ zone_count(uma_zone_t zone, void *arg)
struct uma_zone_count *cnt;
 
cnt = arg;
+   /*
+* Some zones are rapidly created with identical names and
+* destroyed out of order.  This can lead to gaps in the count.
+* Use one greater than the maximum observed for this name.
+*/
if (strcmp(zone->uz_name, cnt->name) == 0)
-   cnt->count++;
+   cnt->count = MAX(cnt->count,
+   zone->uz_namecnt + 1);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355516 - head/sys/vm

2019-12-07 Thread Jeff Roberson
Author: jeff
Date: Sun Dec  8 01:49:53 2019
New Revision: 355516
URL: https://svnweb.freebsd.org/changeset/base/355516

Log:
  It is safe to wire a page while the object is busy.
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D22636

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sun Dec  8 01:49:03 2019(r355515)
+++ head/sys/vm/vm_page.c   Sun Dec  8 01:49:53 2019(r355516)
@@ -3803,7 +3803,7 @@ vm_page_wire(vm_page_t m)
 
KASSERT(m->object != NULL,
("vm_page_wire: page %p does not belong to an object", m));
-   if (!vm_page_busied(m))
+   if (!vm_page_busied(m) && !vm_object_busied(m->object))
VM_OBJECT_ASSERT_LOCKED(m->object);
KASSERT((m->flags & PG_FICTITIOUS) == 0 ||
VPRC_WIRE_COUNT(m->ref_count) >= 1,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355515 - head/sys/vm

2019-12-07 Thread Jeff Roberson
Author: jeff
Date: Sun Dec  8 01:49:03 2019
New Revision: 355515
URL: https://svnweb.freebsd.org/changeset/base/355515

Log:
  It is now safe to rename a page that is still on a queue.  Allowing this
  is necessary for a forthcoming patch.
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D22636

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sun Dec  8 01:47:29 2019(r355514)
+++ head/sys/vm/vm_page.c   Sun Dec  8 01:49:03 2019(r355515)
@@ -1720,8 +1720,6 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm
mnew->pindex = pindex;
atomic_set_int(>ref_count, VPRC_OBJREF);
mold = vm_radix_replace(>rtree, mnew);
-   KASSERT(mold->queue == PQ_NONE,
-   ("vm_page_replace: old page %p is on a paging queue", mold));
 
/* Keep the resident page list in sorted order. */
TAILQ_INSERT_AFTER(>memq, mold, mnew, listq);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355514 - head/sys/vm

2019-12-07 Thread Jeff Roberson
Author: jeff
Date: Sun Dec  8 01:47:29 2019
New Revision: 355514
URL: https://svnweb.freebsd.org/changeset/base/355514

Log:
  Do not assert that the object lock is held in vm_object_set_writeable_dirty.
  A valid reference is all that is required.  If we race with a deallocation
  we will harmlessly misidentify the type of an already dead object.
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D22636

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Sun Dec  8 01:20:37 2019(r355513)
+++ head/sys/vm/vm_object.c Sun Dec  8 01:47:29 2019(r355514)
@@ -2225,8 +2225,6 @@ void
 vm_object_set_writeable_dirty(vm_object_t object)
 {
 
-   VM_OBJECT_ASSERT_LOCKED(object);
-
/* Only set for vnodes & tmpfs */
if (object->type != OBJT_VNODE &&
(object->flags & OBJ_TMPFS_NODE) == 0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355513 - head/sbin/newfs_msdos

2019-12-07 Thread Xin LI
Author: delphij
Date: Sun Dec  8 01:20:37 2019
New Revision: 355513
URL: https://svnweb.freebsd.org/changeset/base/355513

Log:
  Fix a couple of minor issues with newfs_msdos:
  
   - Do not unnecessarily strdup().
   - Check return value of getdiskinfo(), if it failed, bail out.
  
  Reviewed by:  imp
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D22729

Modified:
  head/sbin/newfs_msdos/mkfs_msdos.c
  head/sbin/newfs_msdos/newfs_msdos.c

Modified: head/sbin/newfs_msdos/mkfs_msdos.c
==
--- head/sbin/newfs_msdos/mkfs_msdos.c  Sun Dec  8 01:17:38 2019
(r355512)
+++ head/sbin/newfs_msdos/mkfs_msdos.c  Sun Dec  8 01:20:37 2019
(r355513)
@@ -318,7 +318,8 @@ mkfs_msdos(const char *fname, const char *dtype, const
bpb.bpbHiddenSecs = o.hidden_sectors;
 if (!(o.floppy || (o.drive_heads && o.sectors_per_track &&
o.bytes_per_sector && o.size && o.hidden_sectors_set))) {
-   getdiskinfo(fd, fname, dtype, o.hidden_sectors_set, );
+   if (getdiskinfo(fd, fname, dtype, o.hidden_sectors_set, ) == -1)
+   goto done;
bpb.bpbHugeSectors -= (o.offset / bpb.bpbBytesPerSec);
if (bpb.bpbSecPerClust == 0) {  /* set defaults */
if (bpb.bpbHugeSectors <= 6000) /* about 3MB -> 512 bytes */
@@ -423,10 +424,7 @@ mkfs_msdos(const char *fname, const char *dtype, const
bname = o.bootstrap;
if (!strchr(bname, '/')) {
snprintf(buf, sizeof(buf), "/boot/%s", bname);
-   if (!(bname = strdup(buf))) {
-   warn(NULL);
-   goto done;
-   }
+   bname = buf;
}
if ((fd1 = open(bname, O_RDONLY)) == -1 || fstat(fd1, )) {
warn("%s", bname);

Modified: head/sbin/newfs_msdos/newfs_msdos.c
==
--- head/sbin/newfs_msdos/newfs_msdos.c Sun Dec  8 01:17:38 2019
(r355512)
+++ head/sbin/newfs_msdos/newfs_msdos.c Sun Dec  8 01:20:37 2019
(r355513)
@@ -185,8 +185,7 @@ main(int argc, char *argv[])
 fname = *argv++;
 if (!o.create_size && !strchr(fname, '/')) {
snprintf(buf, sizeof(buf), "%s%s", _PATH_DEV, fname);
-   if (!(fname = strdup(buf)))
-   err(1, NULL);
+   fname = buf;
 }
 dtype = *argv;
 exit(!!mkfs_msdos(fname, dtype, ));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355512 - in head/sys: kern sys

2019-12-07 Thread Jeff Roberson
Author: jeff
Date: Sun Dec  8 01:17:38 2019
New Revision: 355512
URL: https://svnweb.freebsd.org/changeset/base/355512

Log:
  Handle multiple clock interrupts simultaneously in sched_clock().
  
  Reviewed by:  kib, markj, mav
  Differential Revision:https://reviews.freebsd.org/D22625

Modified:
  head/sys/kern/kern_clock.c
  head/sys/kern/sched_4bsd.c
  head/sys/kern/sched_ule.c
  head/sys/sys/sched.h

Modified: head/sys/kern/kern_clock.c
==
--- head/sys/kern/kern_clock.c  Sun Dec  8 01:16:22 2019(r355511)
+++ head/sys/kern/kern_clock.c  Sun Dec  8 01:17:38 2019(r355512)
@@ -711,8 +711,7 @@ statclock(int cnt, int usermode)
td->td_incruntime += runtime;
PCPU_SET(switchtime, new_switchtime);
 
-   for ( ; cnt > 0; cnt--)
-   sched_clock(td);
+   sched_clock(td, cnt);
thread_unlock(td);
 #ifdef HWPMC_HOOKS
if (td->td_intr_frame != NULL)

Modified: head/sys/kern/sched_4bsd.c
==
--- head/sys/kern/sched_4bsd.c  Sun Dec  8 01:16:22 2019(r355511)
+++ head/sys/kern/sched_4bsd.c  Sun Dec  8 01:17:38 2019(r355512)
@@ -706,8 +706,8 @@ sched_rr_interval(void)
  * favor processes which haven't run much recently, and to round-robin
  * among other processes.
  */
-void
-sched_clock(struct thread *td)
+static void
+sched_clock_tick(struct thread *td)
 {
struct pcpuidlestat *stat;
struct td_sched *ts;
@@ -734,6 +734,14 @@ sched_clock(struct thread *td)
stat = DPCPU_PTR(idlestat);
stat->oldidlecalls = stat->idlecalls;
stat->idlecalls = 0;
+}
+
+void
+sched_clock(struct thread *td, int cnt)
+{
+
+   for ( ; cnt > 0; cnt--)
+   sched_clock_tick(td);
 }
 
 /*

Modified: head/sys/kern/sched_ule.c
==
--- head/sys/kern/sched_ule.c   Sun Dec  8 01:16:22 2019(r355511)
+++ head/sys/kern/sched_ule.c   Sun Dec  8 01:17:38 2019(r355512)
@@ -2421,7 +2421,7 @@ sched_userret_slowpath(struct thread *td)
  * threads.
  */
 void
-sched_clock(struct thread *td)
+sched_clock(struct thread *td, int cnt)
 {
struct tdq *tdq;
struct td_sched *ts;
@@ -2432,8 +2432,10 @@ sched_clock(struct thread *td)
/*
 * We run the long term load balancer infrequently on the first cpu.
 */
-   if (balance_tdq == tdq && smp_started != 0 && rebalance != 0) {
-   if (balance_ticks && --balance_ticks == 0)
+   if (balance_tdq == tdq && smp_started != 0 && rebalance != 0 &&
+   balance_ticks != 0) {
+   balance_ticks -= cnt;
+   if (balance_ticks <= 0)
sched_balance();
}
 #endif
@@ -2455,14 +2457,15 @@ sched_clock(struct thread *td)
}
ts = td_get_sched(td);
sched_pctcpu_update(ts, 1);
-   if (td->td_pri_class & PRI_FIFO_BIT)
+   if ((td->td_pri_class & PRI_FIFO_BIT) || TD_IS_IDLETHREAD(td))
return;
+
if (PRI_BASE(td->td_pri_class) == PRI_TIMESHARE) {
/*
 * We used a tick; charge it to the thread so
 * that we can compute our interactivity.
 */
-   td_get_sched(td)->ts_runtime += tickincr;
+   td_get_sched(td)->ts_runtime += tickincr * cnt;
sched_interact_update(td);
sched_priority(td);
}
@@ -2471,7 +2474,8 @@ sched_clock(struct thread *td)
 * Force a context switch if the current thread has used up a full
 * time slice (default is 100ms).
 */
-   if (!TD_IS_IDLETHREAD(td) && ++ts->ts_slice >= tdq_slice(tdq)) {
+   ts->ts_slice += cnt;
+   if (ts->ts_slice >= tdq_slice(tdq)) {
ts->ts_slice = 0;
td->td_flags |= TDF_NEEDRESCHED | TDF_SLICEEND;
}

Modified: head/sys/sys/sched.h
==
--- head/sys/sys/sched.hSun Dec  8 01:16:22 2019(r355511)
+++ head/sys/sys/sched.hSun Dec  8 01:17:38 2019(r355512)
@@ -135,7 +135,7 @@ sched_userret(struct thread *td)
  * Threads are moved on and off of run queues
  */
 void   sched_add(struct thread *td, int flags);
-void   sched_clock(struct thread *td);
+void   sched_clock(struct thread *td, int ticks);
 void   sched_preempt(struct thread *td);
 void   sched_rem(struct thread *td);
 void   sched_relinquish(struct thread *td);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355511 - head/sys/vm

2019-12-07 Thread Jeff Roberson
Author: jeff
Date: Sun Dec  8 01:16:22 2019
New Revision: 355511
URL: https://svnweb.freebsd.org/changeset/base/355511

Log:
  Reduce duplication in grab functions by providing allocflags based inlines.
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D22635

Modified:
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sun Dec  8 01:15:06 2019(r355510)
+++ head/sys/vm/vm_page.c   Sun Dec  8 01:16:22 2019(r355511)
@@ -862,13 +862,49 @@ vm_page_reference(vm_page_t m)
vm_page_aflag_set(m, PGA_REFERENCED);
 }
 
+static bool
+vm_page_acquire_flags(vm_page_t m, int allocflags)
+{
+   bool locked;
+
+   if ((allocflags & (VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY)) != 0)
+   locked = vm_page_trysbusy(m);
+   else
+   locked = vm_page_tryxbusy(m);
+   if (locked && (allocflags & VM_ALLOC_WIRED) != 0)
+   vm_page_wire(m);
+   return (locked);
+}
+
+static bool
+vm_page_busy_sleep_flags(vm_object_t object, vm_page_t m, const char *wchan,
+int allocflags)
+{
+
+   if ((allocflags & VM_ALLOC_NOWAIT) != 0)
+   return (false);
+   /*
+* Reference the page before unlocking and
+* sleeping so that the page daemon is less
+* likely to reclaim it.
+*/
+   if ((allocflags & VM_ALLOC_NOCREAT) == 0)
+   vm_page_aflag_set(m, PGA_REFERENCED);
+   vm_page_busy_sleep(m, wchan, (allocflags &
+   VM_ALLOC_IGN_SBUSY) != 0);
+   VM_OBJECT_WLOCK(object);
+   if ((allocflags & VM_ALLOC_WAITFAIL) != 0)
+   return (false);
+   return (true);
+}
+
 /*
  * vm_page_busy_acquire:
  *
  * Acquire the busy lock as described by VM_ALLOC_* flags.  Will loop
  * and drop the object lock if necessary.
  */
-int
+bool
 vm_page_busy_acquire(vm_page_t m, int allocflags)
 {
vm_object_t obj;
@@ -883,26 +919,21 @@ vm_page_busy_acquire(vm_page_t m, int allocflags)
 */
obj = m->object;
for (;;) {
-   if ((allocflags & VM_ALLOC_SBUSY) == 0) {
-   if (vm_page_tryxbusy(m))
-   return (TRUE);
-   } else {
-   if (vm_page_trysbusy(m))
-   return (TRUE);
-   }
+   if (vm_page_acquire_flags(m, allocflags))
+   return (true);
if ((allocflags & VM_ALLOC_NOWAIT) != 0)
-   return (FALSE);
+   return (false);
if (obj != NULL)
locked = VM_OBJECT_WOWNED(obj);
else
-   locked = FALSE;
+   locked = false;
MPASS(locked || vm_page_wired(m));
_vm_page_busy_sleep(obj, m, "vmpba",
(allocflags & VM_ALLOC_SBUSY) != 0, locked);
if (locked)
VM_OBJECT_WLOCK(obj);
if ((allocflags & VM_ALLOC_WAITFAIL) != 0)
-   return (FALSE);
+   return (false);
KASSERT(m->object == obj || m->object == NULL,
("vm_page_busy_acquire: page %p does not belong to %p",
m, obj));
@@ -4227,6 +4258,29 @@ vm_page_advise(vm_page_t m, int advice)
vm_page_launder(m);
 }
 
+static inline int
+vm_page_grab_pflags(int allocflags)
+{
+   int pflags;
+
+   KASSERT((allocflags & VM_ALLOC_NOBUSY) == 0 ||
+   (allocflags & VM_ALLOC_WIRED) != 0,
+   ("vm_page_grab_pflags: the pages must be busied or wired"));
+   KASSERT((allocflags & VM_ALLOC_SBUSY) == 0 ||
+   (allocflags & VM_ALLOC_IGN_SBUSY) != 0,
+   ("vm_page_grab_pflags: VM_ALLOC_SBUSY/VM_ALLOC_IGN_SBUSY "
+   "mismatch"));
+   pflags = allocflags &
+   ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL |
+   VM_ALLOC_NOBUSY);
+   if ((allocflags & VM_ALLOC_NOWAIT) == 0)
+   pflags |= VM_ALLOC_WAITFAIL;
+   if ((allocflags & VM_ALLOC_IGN_SBUSY) != 0)
+   pflags |= VM_ALLOC_SBUSY;
+
+   return (pflags);
+}
+
 /*
  * Grab a page, waiting until we are waken up due to the page
  * changing state.  We keep on waiting, if the page continues
@@ -4242,47 +4296,19 @@ vm_page_t
 vm_page_grab(vm_object_t object, vm_pindex_t pindex, int allocflags)
 {
vm_page_t m;
-   int sleep;
int pflags;
 
VM_OBJECT_ASSERT_WLOCKED(object);
-   KASSERT((allocflags & VM_ALLOC_SBUSY) == 0 ||
-   (allocflags & VM_ALLOC_IGN_SBUSY) != 0,
-   ("vm_page_grab: VM_ALLOC_SBUSY/VM_ALLOC_IGN_SBUSY mismatch"));
-   pflags = allocflags &
-   ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL |
- 

svn commit: r355510 - head/sys/vm

2019-12-07 Thread Jeff Roberson
Author: jeff
Date: Sun Dec  8 01:15:06 2019
New Revision: 355510
URL: https://svnweb.freebsd.org/changeset/base/355510

Log:
  Use a variant slab structure for offpage zones.  This saves space in
  embedded slabs but also is an opportunity to tidy up code and add
  accessor inlines.
  
  Reviewed by:  markj, rlibby
  Differential Revision:https://reviews.freebsd.org/D22609

Modified:
  head/sys/vm/uma_core.c
  head/sys/vm/uma_int.h

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Sun Dec  8 00:06:00 2019(r355509)
+++ head/sys/vm/uma_core.c  Sun Dec  8 01:15:06 2019(r355510)
@@ -664,8 +664,7 @@ hash_alloc(struct uma_hash *hash, u_int size)
if (size > UMA_HASH_SIZE_INIT)  {
hash->uh_hashsize = size;
alloc = sizeof(hash->uh_slab_hash[0]) * hash->uh_hashsize;
-   hash->uh_slab_hash = (struct slabhead *)malloc(alloc,
-   M_UMAHASH, M_NOWAIT);
+   hash->uh_slab_hash = malloc(alloc, M_UMAHASH, M_NOWAIT);
} else {
alloc = sizeof(hash->uh_slab_hash[0]) * UMA_HASH_SIZE_INIT;
hash->uh_slab_hash = zone_alloc_item(hashzone, NULL,
@@ -698,7 +697,7 @@ hash_alloc(struct uma_hash *hash, u_int size)
 static int
 hash_expand(struct uma_hash *oldhash, struct uma_hash *newhash)
 {
-   uma_slab_t slab;
+   uma_hash_slab_t slab;
u_int hval;
u_int idx;
 
@@ -714,12 +713,12 @@ hash_expand(struct uma_hash *oldhash, struct uma_hash 
 */
 
for (idx = 0; idx < oldhash->uh_hashsize; idx++)
-   while (!SLIST_EMPTY(>uh_slab_hash[idx])) {
-   slab = SLIST_FIRST(>uh_slab_hash[idx]);
-   SLIST_REMOVE_HEAD(>uh_slab_hash[idx], 
us_hlink);
-   hval = UMA_HASH(newhash, slab->us_data);
-   SLIST_INSERT_HEAD(>uh_slab_hash[hval],
-   slab, us_hlink);
+   while (!LIST_EMPTY(>uh_slab_hash[idx])) {
+   slab = LIST_FIRST(>uh_slab_hash[idx]);
+   LIST_REMOVE(slab, uhs_hlink);
+   hval = UMA_HASH(newhash, slab->uhs_data);
+   LIST_INSERT_HEAD(>uh_slab_hash[hval],
+   slab, uhs_hlink);
}
 
return (1);
@@ -992,7 +991,7 @@ keg_free_slab(uma_keg_t keg, uma_slab_t slab, int star
CTR4(KTR_UMA, "keg_free_slab keg %s(%p) slab %p, returning %d bytes",
keg->uk_name, keg, slab, PAGE_SIZE * keg->uk_ppera);
 
-   mem = slab->us_data;
+   mem = slab_data(slab, keg);
flags = slab->us_flags;
i = start;
if (keg->uk_fini != NULL) {
@@ -1006,11 +1005,10 @@ keg_free_slab(uma_keg_t keg, uma_slab_t slab, int star
 * albeit we don't make skip check for other init/fini
 * invocations.
 */
-   if (!uma_dbg_kskip(keg, slab->us_data + (keg->uk_rsize * i)) ||
+   if (!uma_dbg_kskip(keg, slab_item(slab, keg, i)) ||
keg->uk_fini != trash_fini)
 #endif
-   keg->uk_fini(slab->us_data + (keg->uk_rsize * i),
-   keg->uk_size);
+   keg->uk_fini(slab_item(slab, keg, i), keg->uk_size);
}
if (keg->uk_flags & UMA_ZONE_OFFPAGE)
zone_free_item(keg->uk_slabzone, slab, NULL, SKIP_NONE);
@@ -1057,18 +1055,17 @@ keg_drain(uma_keg_t keg)
keg->uk_free -= keg->uk_ipers;
 
if (keg->uk_flags & UMA_ZONE_HASH)
-   UMA_HASH_REMOVE(>uk_hash, slab,
-   slab->us_data);
+   UMA_HASH_REMOVE(>uk_hash, slab);
 
-   SLIST_INSERT_HEAD(, slab, us_hlink);
+   LIST_INSERT_HEAD(, slab, us_link);
}
}
 
 finished:
KEG_UNLOCK(keg);
 
-   while ((slab = SLIST_FIRST()) != NULL) {
-   SLIST_REMOVE(, slab, uma_slab, us_hlink);
+   while ((slab = LIST_FIRST()) != NULL) {
+   LIST_REMOVE(slab, us_link);
keg_free_slab(keg, slab, keg->uk_ipers);
}
 }
@@ -1190,13 +1187,14 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom
/* Point the slab into the allocated memory */
if (!(keg->uk_flags & UMA_ZONE_OFFPAGE))
slab = (uma_slab_t )(mem + keg->uk_pgoff);
+   else
+   ((uma_hash_slab_t)slab)->uhs_data = mem;
 
if (keg->uk_flags & UMA_ZONE_VTOSLAB)
for (i = 0; i < keg->uk_ppera; i++)
vsetzoneslab((vm_offset_t)mem + (i * PAGE_SIZE),
zone, slab);
 
-   slab->us_data = mem;
slab->us_freecount = keg->uk_ipers;
slab->us_flags = sflags;
slab->us_domain = 

svn commit: r355509 - head/sys/fs/nfs

2019-12-07 Thread Rick Macklem
Author: rmacklem
Date: Sun Dec  8 00:06:00 2019
New Revision: 355509
URL: https://svnweb.freebsd.org/changeset/base/355509

Log:
  Fix kernel handling of a NFSERR_MINORVERSMISMATCH NFSv4 server reply.
  
  When an NFSv4 server replies NFSERR_MINORVERSMISMATCH, it does not generate
  a status result for the first operation in the compound. Without this
  patch, this will result in a bogus EBADXDR error return.
  Returning EBADXDR is relatively harmless, but a correct reply of
  NFSERR_MINORVERSMISMATCH is needed by the pNFS client to select the correct
  minor version to use for a File Layout DS now that there can be NFSv4.2
  DS servers.
  
  mount_nfs.c still needs to be fixed for this, although how the mount fails
  is only useful to help sysadmins isolate why a mount fails.
  
  Found during testing of the NFSv4.2 client and server.
  
  MFC after:2 weeks

Modified:
  head/sys/fs/nfs/nfs_commonkrpc.c

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==
--- head/sys/fs/nfs/nfs_commonkrpc.cSun Dec  8 00:02:36 2019
(r355508)
+++ head/sys/fs/nfs/nfs_commonkrpc.cSun Dec  8 00:06:00 2019
(r355509)
@@ -918,7 +918,8 @@ tryagain:
 * Get rid of the tag, return count and SEQUENCE result for
 * NFSv4.
 */
-   if ((nd->nd_flag & ND_NFSV4) != 0) {
+   if ((nd->nd_flag & ND_NFSV4) != 0 && nd->nd_repstat !=
+   NFSERR_MINORVERMISMATCH) {
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
i = fxdr_unsigned(int, *tl);
error = nfsm_advance(nd, NFSM_RNDUP(i), -1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355508 - head/sys/vm

2019-12-07 Thread Mark Johnston
Author: markj
Date: Sun Dec  8 00:02:36 2019
New Revision: 355508
URL: https://svnweb.freebsd.org/changeset/base/355508

Log:
  Add casts required by the 32-bit build after r355491.

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cSat Dec  7 23:13:51 2019(r355507)
+++ head/sys/vm/vm_map.cSun Dec  8 00:02:36 2019(r355508)
@@ -5034,17 +5034,17 @@ _vm_map_assert_consistent(vm_map_t map, int check)
cur = cur->left;
KASSERT(cur != lbound,
("map %p cannot find %jx",
-   map, entry->start));
+   map, (uintmax_t)entry->start));
} else if (cur->end <= entry->start) {
lbound = cur;
cur = cur->right;
KASSERT(cur != ubound,
("map %p cannot find %jx",
-   map, entry->start));
+   map, (uintmax_t)entry->start));
} else {
KASSERT(cur == entry,
("map %p cannot find %jx",
-   map, entry->start));
+   map, (uintmax_t)entry->start));
break;
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355507 - head/sys/fs/nfs

2019-12-07 Thread Rick Macklem
Author: rmacklem
Date: Sat Dec  7 23:13:51 2019
New Revision: 355507
URL: https://svnweb.freebsd.org/changeset/base/355507

Log:
  Add some definitions for NFSv4.2 which will be used by subsequent commits.
  
  This is a preliminary commit of NFSv4.2 definitions that will be used by
  subsequent commits which adds NFSv4.2 support to the NFS client and server.
  
  There will be a series of these preliminary commits that will prepare for
  a major commit of the NFSv4.2 client/server changes currently found in
  subversion under projects/nfsv42/sys.

Modified:
  head/sys/fs/nfs/nfsport.h

Modified: head/sys/fs/nfs/nfsport.h
==
--- head/sys/fs/nfs/nfsport.h   Sat Dec  7 20:01:55 2019(r355506)
+++ head/sys/fs/nfs/nfsport.h   Sat Dec  7 23:13:51 2019(r355507)
@@ -257,9 +257,38 @@
 
 /*
  * Must be one more than last op#.
- * NFSv4.2 isn't implemented yet, but define the op# limit for it.
  */
 #defineNFSV41_NOPS 59
+
+/*
+ * Additional operations for NFSv4.2.
+ */
+#defineNFSV4OP_ALLOCATE59
+#defineNFSV4OP_COPY60
+#defineNFSV4OP_COPYNOTIFY  61
+#defineNFSV4OP_DEALLOCATE  62
+#defineNFSV4OP_IOADVISE63
+#defineNFSV4OP_LAYOUTERROR 64
+#defineNFSV4OP_LAYOUTSTATS 65
+#defineNFSV4OP_OFFLOADCANCEL   66
+#defineNFSV4OP_OFFLOADSTATUS   67
+#defineNFSV4OP_READPLUS68
+#defineNFSV4OP_SEEK69
+#defineNFSV4OP_WRITESAME   70
+#defineNFSV4OP_CLONE   71
+
+/* One greater than the last Operation # defined in RFC-7862. */
+#defineNFSV42_PURENOPS 72
+
+/* and the optional Extended attribute operations (RFC-8276). */
+#defineNFSV4OP_GETXATTR72
+#defineNFSV4OP_SETXATTR73
+#defineNFSV4OP_LISTXATTRS  74
+#defineNFSV4OP_REMOVEXATTR 75
+
+/*
+ * Must be one more than the last NFSv4.2 op#.
+ */
 #defineNFSV42_NOPS 72
 
 /* Quirky case if the illegal op code */
@@ -309,6 +338,12 @@
 #defineNFSV4OP_CBNOTIFYDEVID   14
 
 #defineNFSV41_CBNOPS   15
+
+/*
+ * Additional callback operations for NFSv4.2.
+ */
+#defineNFSV4OP_CBOFFLOAD   15
+
 #defineNFSV42_CBNOPS   16
 
 /*
@@ -366,6 +401,24 @@
  * Must be defined as one higher than the last NFSv4.1 Proc# above.
  */
 #defineNFSV41_NPROCS   56
+
+/* Additional procedures for NFSv4.2. */
+#defineNFSPROC_IOADVISE56
+#defineNFSPROC_ALLOCATE57
+#defineNFSPROC_COPY58
+#defineNFSPROC_SEEK59
+#defineNFSPROC_SEEKDS  60
+
+/* and the ones for the optional Extended attribute support (RFC-8276). */
+#defineNFSPROC_GETEXTATTR  61
+#defineNFSPROC_SETEXTATTR  62
+#defineNFSPROC_RMEXTATTR   63
+#defineNFSPROC_LISTEXTATTR 64
+
+/*
+ * Must be defined as one higher than the last NFSv4.2 Proc# above.
+ */
+#defineNFSV42_NPROCS   65
 
 #endif /* NFS_V3NPROCS */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355506 - head/usr.bin/gcore

2019-12-07 Thread Mark Johnston
Author: markj
Date: Sat Dec  7 20:01:55 2019
New Revision: 355506
URL: https://svnweb.freebsd.org/changeset/base/355506

Log:
  gcore: Avoid using vm_map_entry_t.
  
  Use an internally defined structure instead, to avoid relying on kernel
  structure details.  No functional change intended.
  
  MFC after:1 week

Modified:
  head/usr.bin/gcore/elfcore.c

Modified: head/usr.bin/gcore/elfcore.c
==
--- head/usr.bin/gcore/elfcore.cSat Dec  7 19:36:40 2019
(r355505)
+++ head/usr.bin/gcore/elfcore.cSat Dec  7 20:01:55 2019
(r355506)
@@ -44,8 +44,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -64,8 +62,15 @@ __FBSDID("$FreeBSD$");
  * Code for generating ELF core dumps.
  */
 
-typedef void (*segment_callback)(vm_map_entry_t, void *);
+struct map_entry {
+   struct map_entry *next;
+   vm_offset_t start;
+   vm_offset_t end;
+   vm_prot_t protection;
+};
 
+typedef void (*segment_callback)(struct map_entry *, void *);
+
 /* Closure for cb_put_phdr(). */
 struct phdr_closure {
Elf_Phdr *phdr; /* Program header to fill in */
@@ -101,9 +106,9 @@ typedef struct ptrace_lwpinfo elfcore_lwpinfo_t;
 
 typedef void* (*notefunc_t)(void *, size_t *);
 
-static void cb_put_phdr(vm_map_entry_t, void *);
-static void cb_size_segment(vm_map_entry_t, void *);
-static void each_dumpable_segment(vm_map_entry_t, segment_callback,
+static void cb_put_phdr(struct map_entry *, void *);
+static void cb_size_segment(struct map_entry *, void *);
+static void each_dumpable_segment(struct map_entry *, segment_callback,
 void *closure);
 static void elf_detach(void);  /* atexit() handler. */
 static void *elf_note_fpregset(void *, size_t *);
@@ -130,12 +135,12 @@ static void *elf_note_procstat_psstrings(void *, size_
 static void *elf_note_procstat_rlimit(void *, size_t *);
 static void *elf_note_procstat_umask(void *, size_t *);
 static void *elf_note_procstat_vmmap(void *, size_t *);
-static void elf_puthdr(int, pid_t, vm_map_entry_t, void *, size_t, size_t,
+static void elf_puthdr(int, pid_t, struct map_entry *, void *, size_t, size_t,
 size_t, int);
 static void elf_putnote(int, notefunc_t, void *, struct sbuf *);
 static void elf_putnotes(pid_t, struct sbuf *, size_t *);
-static void freemap(vm_map_entry_t);
-static vm_map_entry_t readmap(pid_t);
+static void freemap(struct map_entry *);
+static struct map_entry *readmap(pid_t);
 static void *procstat_sysctl(void *, int, size_t, size_t *sizep);
 
 static pid_t g_pid;/* Pid being dumped, global for elf_detach */
@@ -193,7 +198,7 @@ elf_detach(void)
 static void
 elf_coredump(int efd, int fd, pid_t pid)
 {
-   vm_map_entry_t map;
+   struct map_entry *map;
struct sseg_closure seginfo;
struct sbuf *sb;
void *hdr;
@@ -294,7 +299,7 @@ elf_coredump(int efd, int fd, pid_t pid)
  * program header entry.
  */
 static void
-cb_put_phdr(vm_map_entry_t entry, void *closure)
+cb_put_phdr(struct map_entry *entry, void *closure)
 {
struct phdr_closure *phc = (struct phdr_closure *)closure;
Elf_Phdr *phdr = phc->phdr;
@@ -324,7 +329,7 @@ cb_put_phdr(vm_map_entry_t entry, void *closure)
  * the number of segments and their total size.
  */
 static void
-cb_size_segment(vm_map_entry_t entry, void *closure)
+cb_size_segment(struct map_entry *entry, void *closure)
 {
struct sseg_closure *ssc = (struct sseg_closure *)closure;
 
@@ -338,11 +343,12 @@ cb_size_segment(vm_map_entry_t entry, void *closure)
  * data.
  */
 static void
-each_dumpable_segment(vm_map_entry_t map, segment_callback func, void *closure)
+each_dumpable_segment(struct map_entry *map, segment_callback func,
+void *closure)
 {
-   vm_map_entry_t entry;
+   struct map_entry *entry;
 
-   for (entry = map;  entry != NULL;  entry = entry->next)
+   for (entry = map; entry != NULL; entry = entry->next)
(*func)(entry, closure);
 }
 
@@ -440,7 +446,7 @@ elf_putnote(int type, notefunc_t notefunc, void *arg, 
  * Generate the ELF coredump header.
  */
 static void
-elf_puthdr(int efd, pid_t pid, vm_map_entry_t map, void *hdr, size_t hdrsize,
+elf_puthdr(int efd, pid_t pid, struct map_entry *map, void *hdr, size_t 
hdrsize,
 size_t notesz, size_t segoff, int numsegs)
 {
Elf_Ehdr *ehdr, binhdr;
@@ -531,11 +537,12 @@ elf_puthdr(int efd, pid_t pid, vm_map_entry_t map, voi
  * Free the memory map.
  */
 static void
-freemap(vm_map_entry_t map)
+freemap(struct map_entry *map)
 {
+   struct map_entry *next;
 
while (map != NULL) {
-   vm_map_entry_t next = map->next;
+   next = map->next;
free(map);
map = next;
}
@@ -547,10 +554,10 @@ freemap(vm_map_entry_t map)
  * returned.  The map entries in the list aren't fully filled in; only
  * the 

svn commit: r355505 - head/sys/vm

2019-12-07 Thread Mark Johnston
Author: markj
Date: Sat Dec  7 19:36:40 2019
New Revision: 355505
URL: https://svnweb.freebsd.org/changeset/base/355505

Log:
  Provide vm_map_entry traversal routines to userspace.
  
  This is required for now to allow libprocstat to compile.
  
  Discussed with:   dougm

Modified:
  head/sys/vm/vm_map.h

Modified: head/sys/vm/vm_map.h
==
--- head/sys/vm/vm_map.hSat Dec  7 19:05:48 2019(r355504)
+++ head/sys/vm/vm_map.hSat Dec  7 19:36:40 2019(r355505)
@@ -402,27 +402,6 @@ long vmspace_resident_count(struct vmspace *vmspace);
 
 #define VM_MAP_WIRE_WRITE  4   /* Validate writable. */
 
-#ifdef _KERNEL
-boolean_t vm_map_check_protection (vm_map_t, vm_offset_t, vm_offset_t, 
vm_prot_t);
-vm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_t);
-int vm_map_delete(vm_map_t, vm_offset_t, vm_offset_t);
-int vm_map_find(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t,
-vm_offset_t, int, vm_prot_t, vm_prot_t, int);
-int vm_map_find_min(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *,
-vm_size_t, vm_offset_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int);
-int vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t,
-vm_prot_t, vm_prot_t, int);
-vm_offset_t vm_map_findspace(vm_map_t, vm_offset_t, vm_size_t);
-int vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t);
-void vm_map_init(vm_map_t, pmap_t, vm_offset_t, vm_offset_t);
-int vm_map_insert (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, 
vm_offset_t, vm_prot_t, vm_prot_t, int);
-int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, 
vm_object_t *,
-vm_pindex_t *, vm_prot_t *, boolean_t *);
-int vm_map_lookup_locked(vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, 
vm_object_t *,
-vm_pindex_t *, vm_prot_t *, boolean_t *);
-void vm_map_lookup_done (vm_map_t, vm_map_entry_t);
-boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *);
-
 static inline vm_map_entry_t
 vm_map_entry_first(vm_map_t map)
 {
@@ -448,6 +427,27 @@ vm_map_entry_succ(vm_map_entry_t entry)
for ((it) = vm_map_entry_first(map);\
(it) != &(map)->header; \
(it) = vm_map_entry_succ(it))
+
+#ifdef _KERNEL
+boolean_t vm_map_check_protection (vm_map_t, vm_offset_t, vm_offset_t, 
vm_prot_t);
+vm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_t);
+int vm_map_delete(vm_map_t, vm_offset_t, vm_offset_t);
+int vm_map_find(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t,
+vm_offset_t, int, vm_prot_t, vm_prot_t, int);
+int vm_map_find_min(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *,
+vm_size_t, vm_offset_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int);
+int vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t,
+vm_prot_t, vm_prot_t, int);
+vm_offset_t vm_map_findspace(vm_map_t, vm_offset_t, vm_size_t);
+int vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t);
+void vm_map_init(vm_map_t, pmap_t, vm_offset_t, vm_offset_t);
+int vm_map_insert (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, 
vm_offset_t, vm_prot_t, vm_prot_t, int);
+int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, 
vm_object_t *,
+vm_pindex_t *, vm_prot_t *, boolean_t *);
+int vm_map_lookup_locked(vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, 
vm_object_t *,
+vm_pindex_t *, vm_prot_t *, boolean_t *);
+void vm_map_lookup_done (vm_map_t, vm_map_entry_t);
+boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *);
 int vm_map_protect (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t);
 int vm_map_remove (vm_map_t, vm_offset_t, vm_offset_t);
 void vm_map_try_merge_entries(vm_map_t map, vm_map_entry_t prev,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355504 - in stable/11: contrib/less usr.bin/less

2019-12-07 Thread Xin LI
Author: delphij
Date: Sat Dec  7 19:05:48 2019
New Revision: 355504
URL: https://svnweb.freebsd.org/changeset/base/355504

Log:
  MFC r349549: MFV r349535: less v551.
  
  Relnotes: yes

Modified:
  stable/11/contrib/less/LICENSE
  stable/11/contrib/less/NEWS
  stable/11/contrib/less/README
  stable/11/contrib/less/brac.c
  stable/11/contrib/less/ch.c
  stable/11/contrib/less/charset.c
  stable/11/contrib/less/charset.h
  stable/11/contrib/less/cmd.h
  stable/11/contrib/less/cmdbuf.c
  stable/11/contrib/less/command.c
  stable/11/contrib/less/compose.uni
  stable/11/contrib/less/cvt.c
  stable/11/contrib/less/decode.c
  stable/11/contrib/less/edit.c
  stable/11/contrib/less/filename.c
  stable/11/contrib/less/fmt.uni
  stable/11/contrib/less/forwback.c
  stable/11/contrib/less/funcs.h
  stable/11/contrib/less/help.c
  stable/11/contrib/less/ifile.c
  stable/11/contrib/less/input.c
  stable/11/contrib/less/jump.c
  stable/11/contrib/less/less.h
  stable/11/contrib/less/less.hlp
  stable/11/contrib/less/less.nro
  stable/11/contrib/less/lessecho.c
  stable/11/contrib/less/lessecho.nro
  stable/11/contrib/less/lesskey.c
  stable/11/contrib/less/lesskey.h
  stable/11/contrib/less/lesskey.nro
  stable/11/contrib/less/lglob.h
  stable/11/contrib/less/line.c
  stable/11/contrib/less/linenum.c
  stable/11/contrib/less/lsystem.c
  stable/11/contrib/less/main.c
  stable/11/contrib/less/mark.c
  stable/11/contrib/less/mkutable
  stable/11/contrib/less/optfunc.c
  stable/11/contrib/less/option.c
  stable/11/contrib/less/option.h
  stable/11/contrib/less/opttbl.c
  stable/11/contrib/less/os.c
  stable/11/contrib/less/output.c
  stable/11/contrib/less/pattern.c
  stable/11/contrib/less/pattern.h
  stable/11/contrib/less/pckeys.h
  stable/11/contrib/less/position.c
  stable/11/contrib/less/position.h
  stable/11/contrib/less/prompt.c
  stable/11/contrib/less/screen.c
  stable/11/contrib/less/scrsize.c
  stable/11/contrib/less/search.c
  stable/11/contrib/less/signal.c
  stable/11/contrib/less/tags.c
  stable/11/contrib/less/ttyin.c
  stable/11/contrib/less/ubin.uni
  stable/11/contrib/less/version.c
  stable/11/contrib/less/wide.uni
  stable/11/usr.bin/less/defines.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/less/LICENSE
==
--- stable/11/contrib/less/LICENSE  Sat Dec  7 19:02:09 2019
(r355503)
+++ stable/11/contrib/less/LICENSE  Sat Dec  7 19:05:48 2019
(r355504)
@@ -2,7 +2,7 @@
   
 
 Less
-Copyright (C) 1984-2016  Mark Nudelman
+Copyright (C) 1984-2018  Mark Nudelman
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions

Modified: stable/11/contrib/less/NEWS
==
--- stable/11/contrib/less/NEWS Sat Dec  7 19:02:09 2019(r355503)
+++ stable/11/contrib/less/NEWS Sat Dec  7 19:05:48 2019(r355504)
@@ -11,6 +11,38 @@
 
 ==
 
+   Major changes between "less" versions 530 and 551
+
+* Add --mouse option.
+
+* Add --wheel-lines option.
+
+* Add --no-histdups option.
+
+* Add --save-marks option.
+
+* Support PCRE2 regular expression library.
+
+* Redraw screen on SIGWINCH even if screen size doesn't change.
+
+* Shell-escape filenames in history so they can be used again.
+
+* Ring bell if user enters invalid long option name.
+
+* Use PCRE_UTF8 flag for pcre regular expressions when in UTF-8 mode.
+
+* Windows: use wide-char string to set console title.
+
+* Don't count lines in initial screen if using -X with -F.
+
+* Support mingw build system.
+
+* Fix bug in v command on empty file.
+
+* Fix bug in v command when filename contains shell metacharacters.
+
+==
+
Major changes between "less" versions 487 and 530
 
 * Don't output terminal init sequence if using -F and file fits on one screen.

Modified: stable/11/contrib/less/README
==
--- stable/11/contrib/less/README   Sat Dec  7 19:02:09 2019
(r355503)
+++ stable/11/contrib/less/README   Sat Dec  7 19:05:48 2019
(r355504)
@@ -7,9 +7,9 @@
 **
 **
 
-Less, version 530
+Less, version 551
 
-This is the distribution of less, version 530, released 05 Dec 2017.
+This is the distribution of less, version 551, released 11 Jun 2019.
 This program is part of the GNU project (http://www.gnu.org).
 
 This program is free software.  You may redistribute it and/or
@@ -56,6 +56,7 @@ 

svn commit: r355503 - in stable/12: contrib/less usr.bin/less

2019-12-07 Thread Xin LI
Author: delphij
Date: Sat Dec  7 19:02:09 2019
New Revision: 355503
URL: https://svnweb.freebsd.org/changeset/base/355503

Log:
  MFC r349549: MFV r349535: less v551.
  
  Relnotes: yes

Modified:
  stable/12/contrib/less/LICENSE
  stable/12/contrib/less/NEWS
  stable/12/contrib/less/README
  stable/12/contrib/less/brac.c
  stable/12/contrib/less/ch.c
  stable/12/contrib/less/charset.c
  stable/12/contrib/less/charset.h
  stable/12/contrib/less/cmd.h
  stable/12/contrib/less/cmdbuf.c
  stable/12/contrib/less/command.c
  stable/12/contrib/less/compose.uni
  stable/12/contrib/less/cvt.c
  stable/12/contrib/less/decode.c
  stable/12/contrib/less/edit.c
  stable/12/contrib/less/filename.c
  stable/12/contrib/less/fmt.uni
  stable/12/contrib/less/forwback.c
  stable/12/contrib/less/funcs.h
  stable/12/contrib/less/help.c
  stable/12/contrib/less/ifile.c
  stable/12/contrib/less/input.c
  stable/12/contrib/less/jump.c
  stable/12/contrib/less/less.h
  stable/12/contrib/less/less.hlp
  stable/12/contrib/less/less.nro
  stable/12/contrib/less/lessecho.c
  stable/12/contrib/less/lessecho.nro
  stable/12/contrib/less/lesskey.c
  stable/12/contrib/less/lesskey.h
  stable/12/contrib/less/lesskey.nro
  stable/12/contrib/less/lglob.h
  stable/12/contrib/less/line.c
  stable/12/contrib/less/linenum.c
  stable/12/contrib/less/lsystem.c
  stable/12/contrib/less/main.c
  stable/12/contrib/less/mark.c
  stable/12/contrib/less/mkutable
  stable/12/contrib/less/optfunc.c
  stable/12/contrib/less/option.c
  stable/12/contrib/less/option.h
  stable/12/contrib/less/opttbl.c
  stable/12/contrib/less/os.c
  stable/12/contrib/less/output.c
  stable/12/contrib/less/pattern.c
  stable/12/contrib/less/pattern.h
  stable/12/contrib/less/pckeys.h
  stable/12/contrib/less/position.c
  stable/12/contrib/less/position.h
  stable/12/contrib/less/prompt.c
  stable/12/contrib/less/screen.c
  stable/12/contrib/less/scrsize.c
  stable/12/contrib/less/search.c
  stable/12/contrib/less/signal.c
  stable/12/contrib/less/tags.c
  stable/12/contrib/less/ttyin.c
  stable/12/contrib/less/ubin.uni
  stable/12/contrib/less/version.c
  stable/12/contrib/less/wide.uni
  stable/12/usr.bin/less/defines.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/less/LICENSE
==
--- stable/12/contrib/less/LICENSE  Sat Dec  7 18:40:46 2019
(r355502)
+++ stable/12/contrib/less/LICENSE  Sat Dec  7 19:02:09 2019
(r355503)
@@ -2,7 +2,7 @@
   
 
 Less
-Copyright (C) 1984-2016  Mark Nudelman
+Copyright (C) 1984-2018  Mark Nudelman
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions

Modified: stable/12/contrib/less/NEWS
==
--- stable/12/contrib/less/NEWS Sat Dec  7 18:40:46 2019(r355502)
+++ stable/12/contrib/less/NEWS Sat Dec  7 19:02:09 2019(r355503)
@@ -11,6 +11,38 @@
 
 ==
 
+   Major changes between "less" versions 530 and 551
+
+* Add --mouse option.
+
+* Add --wheel-lines option.
+
+* Add --no-histdups option.
+
+* Add --save-marks option.
+
+* Support PCRE2 regular expression library.
+
+* Redraw screen on SIGWINCH even if screen size doesn't change.
+
+* Shell-escape filenames in history so they can be used again.
+
+* Ring bell if user enters invalid long option name.
+
+* Use PCRE_UTF8 flag for pcre regular expressions when in UTF-8 mode.
+
+* Windows: use wide-char string to set console title.
+
+* Don't count lines in initial screen if using -X with -F.
+
+* Support mingw build system.
+
+* Fix bug in v command on empty file.
+
+* Fix bug in v command when filename contains shell metacharacters.
+
+==
+
Major changes between "less" versions 487 and 530
 
 * Don't output terminal init sequence if using -F and file fits on one screen.

Modified: stable/12/contrib/less/README
==
--- stable/12/contrib/less/README   Sat Dec  7 18:40:46 2019
(r355502)
+++ stable/12/contrib/less/README   Sat Dec  7 19:02:09 2019
(r355503)
@@ -7,9 +7,9 @@
 **
 **
 
-Less, version 530
+Less, version 551
 
-This is the distribution of less, version 530, released 05 Dec 2017.
+This is the distribution of less, version 551, released 11 Jun 2019.
 This program is part of the GNU project (http://www.gnu.org).
 
 This program is free software.  You may redistribute it and/or
@@ -56,6 +56,7 @@ 

svn commit: r355502 - head/lib/libprocstat

2019-12-07 Thread Doug Moore
Author: dougm
Date: Sat Dec  7 18:40:46 2019
New Revision: 355502
URL: https://svnweb.freebsd.org/changeset/base/355502

Log:
  Fix a type error in fixing libprocstat to be compatible with vm_map changes.
  
  Approved by: markj
  Differential Revision: https://reviews.freebsd.org/D22726

Modified:
  head/lib/libprocstat/libprocstat.c

Modified: head/lib/libprocstat/libprocstat.c
==
--- head/lib/libprocstat/libprocstat.c  Sat Dec  7 18:16:35 2019
(r355501)
+++ head/lib/libprocstat/libprocstat.c  Sat Dec  7 18:40:46 2019
(r355502)
@@ -619,7 +619,7 @@ do_mmapped:
 
for (entryp = vm_map_entry_first(map);
entryp != >ki_vmspace->vm_map.header;
-   entryp = vm_map_entry_succ(vmentry)) {
+   entryp = vm_map_entry_succ()) {
if (!kvm_read_all(kd, (unsigned long)entryp, ,
sizeof(vmentry))) {
warnx("can't read vm_map_entry at %p",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355501 - head/lib/libprocstat

2019-12-07 Thread Doug Moore
Author: dougm
Date: Sat Dec  7 18:16:35 2019
New Revision: 355501
URL: https://svnweb.freebsd.org/changeset/base/355501

Log:
  r355491 broke compilation of libprocstat.c.  Change that code to use
  new methods for accessing first, next map entries.
  
  Approved by: kib
  Differential Revision: https://reviews.freebsd.org/D22725

Modified:
  head/lib/libprocstat/libprocstat.c

Modified: head/lib/libprocstat/libprocstat.c
==
--- head/lib/libprocstat/libprocstat.c  Sat Dec  7 18:07:49 2019
(r355500)
+++ head/lib/libprocstat/libprocstat.c  Sat Dec  7 18:16:35 2019
(r355501)
@@ -617,9 +617,9 @@ do_mmapped:
}
map = _map;
 
-   for (entryp = map->header.next;
+   for (entryp = vm_map_entry_first(map);
entryp != >ki_vmspace->vm_map.header;
-   entryp = vmentry.next) {
+   entryp = vm_map_entry_succ(vmentry)) {
if (!kvm_read_all(kd, (unsigned long)entryp, ,
sizeof(vmentry))) {
warnx("can't read vm_map_entry at %p",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355500 - in head: lib/libc/sys sys/kern

2019-12-07 Thread Konstantin Belousov
Author: kib
Date: Sat Dec  7 18:07:49 2019
New Revision: 355500
URL: https://svnweb.freebsd.org/changeset/base/355500

Log:
  Only return EPERM from kill(-pid) when no process was signalled.
  
  As mandated by POSIX.  Also clarify the kill(2) manpage.
  
  While there, restructure the code in killpg1() to use helper which
  keeps overall state of the process list iteration in the killpg1_ctx
  structued, later used to infer the error returned.
  
  Reported by:  amdmi3
  Reviewed by:  jilles
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D22621

Modified:
  head/lib/libc/sys/kill.2
  head/sys/kern/kern_sig.c

Modified: head/lib/libc/sys/kill.2
==
--- head/lib/libc/sys/kill.2Sat Dec  7 17:54:40 2019(r355499)
+++ head/lib/libc/sys/kill.2Sat Dec  7 18:07:49 2019(r355500)
@@ -28,7 +28,7 @@
 .\" @(#)kill.2 8.3 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd December 1, 2017
+.Dd December 1, 2019
 .Dt KILL 2
 .Os
 .Sh NAME
@@ -105,12 +105,11 @@ process with ID 1
 .Xr init 8 ) ,
 and the process sending the signal.
 If the user is not the super user, the signal is sent to all processes
-with the same uid as the user excluding the process sending the signal.
+which the caller has permissions to, excluding the process sending the signal.
 No error is returned if any process could be signaled.
 .El
 .Pp
-For compatibility with System V,
-if the process number is negative but not -1,
+If the process number is negative but not -1,
 the signal is sent to all processes whose process group ID
 is equal to the absolute value of the process number.
 This is a variant of
@@ -134,7 +133,7 @@ No process or process group can be found corresponding
 .It Bq Er EPERM
 The sending process does not have permission to send
 .Va sig
-to the receiving process.
+to any receiving process.
 .El
 .Sh SEE ALSO
 .Xr getpgrp 2 ,

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cSat Dec  7 17:54:40 2019(r355499)
+++ head/sys/kern/kern_sig.cSat Dec  7 18:07:49 2019(r355500)
@@ -1679,6 +1679,36 @@ kern_sigaltstack(struct thread *td, stack_t *ss, stack
return (0);
 }
 
+struct killpg1_ctx {
+   struct thread *td;
+   ksiginfo_t *ksi;
+   int sig;
+   bool sent;
+   bool found;
+   int ret;
+};
+
+static void
+killpg1_sendsig(struct proc *p, bool notself, struct killpg1_ctx *arg)
+{
+   int err;
+
+   if (p->p_pid <= 1 || (p->p_flag & P_SYSTEM) != 0 ||
+   (notself && p == arg->td->td_proc) || p->p_state == PRS_NEW)
+   return;
+   PROC_LOCK(p);
+   err = p_cansignal(arg->td, p, arg->sig);
+   if (err == 0 && arg->sig != 0)
+   pksignal(p, arg->sig, arg->ksi);
+   PROC_UNLOCK(p);
+   if (err != ESRCH)
+   arg->found = true;
+   if (err == 0)
+   arg->sent = true;
+   else if (arg->ret == 0 && err != ESRCH && err != EPERM)
+   arg->ret = err;
+}
+
 /*
  * Common code for kill process group/broadcast kill.
  * cp is calling process.
@@ -1688,30 +1718,21 @@ killpg1(struct thread *td, int sig, int pgid, int all,
 {
struct proc *p;
struct pgrp *pgrp;
-   int err;
-   int ret;
+   struct killpg1_ctx arg;
 
-   ret = ESRCH;
+   arg.td = td;
+   arg.ksi = ksi;
+   arg.sig = sig;
+   arg.sent = false;
+   arg.found = false;
+   arg.ret = 0;
if (all) {
/*
 * broadcast
 */
sx_slock(_lock);
FOREACH_PROC_IN_SYSTEM(p) {
-   if (p->p_pid <= 1 || p->p_flag & P_SYSTEM ||
-   p == td->td_proc || p->p_state == PRS_NEW) {
-   continue;
-   }
-   PROC_LOCK(p);
-   err = p_cansignal(td, p, sig);
-   if (err == 0) {
-   if (sig)
-   pksignal(p, sig, ksi);
-   ret = err;
-   }
-   else if (ret == ESRCH)
-   ret = err;
-   PROC_UNLOCK(p);
+   killpg1_sendsig(p, true, );
}
sx_sunlock(_lock);
} else {
@@ -1731,25 +1752,14 @@ killpg1(struct thread *td, int sig, int pgid, int all,
}
sx_sunlock(_lock);
LIST_FOREACH(p, >pg_members, p_pglist) {
-   PROC_LOCK(p);
-   if (p->p_pid <= 1 || p->p_flag & P_SYSTEM ||
-   p->p_state == PRS_NEW) {
-   PROC_UNLOCK(p);
-  

svn commit: r355499 - in head/sys/modules/gpio: . gpioths

2019-12-07 Thread Ian Lepore
Author: ian
Date: Sat Dec  7 17:54:40 2019
New Revision: 355499
URL: https://svnweb.freebsd.org/changeset/base/355499

Log:
  Add module build stuff for gpioths(4), a driver for DHT11/DHT22 sensors.

Added:
  head/sys/modules/gpio/gpioths/
  head/sys/modules/gpio/gpioths/Makefile   (contents, props changed)
Modified:
  head/sys/modules/gpio/Makefile

Modified: head/sys/modules/gpio/Makefile
==
--- head/sys/modules/gpio/Makefile  Sat Dec  7 17:46:32 2019
(r355498)
+++ head/sys/modules/gpio/Makefile  Sat Dec  7 17:54:40 2019
(r355499)
@@ -25,7 +25,7 @@
 # SUCH DAMAGE.
 #
 
-SUBDIR = gpiobus gpioiic gpioled gpiospi
+SUBDIR = gpiobus gpioiic gpioled gpiospi gpioths
 
 .if !empty(OPT_FDT)
 SUBDIR += gpiokeys gpiopps

Added: head/sys/modules/gpio/gpioths/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/gpio/gpioths/Makefile  Sat Dec  7 17:54:40 2019
(r355499)
@@ -0,0 +1,19 @@
+# $FreeBSD$
+#
+
+.PATH: ${SRCTOP}/sys/dev/gpio/
+
+KMOD=  gpioths
+SRCS=  gpioths.c
+
+SRCS+= \
+   bus_if.h \
+   device_if.h \
+   gpio_if.h \
+   gpiobus_if.h \
+   ofw_bus_if.h \
+   opt_platform.h \
+
+CFLAGS+=  -I. -I${SRCTOP}/sys/dev/gpio/
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355498 - stable/12/sys/arm/freescale/imx

2019-12-07 Thread Ian Lepore
Author: ian
Date: Sat Dec  7 17:46:32 2019
New Revision: 355498
URL: https://svnweb.freebsd.org/changeset/base/355498

Log:
  MFC r355193:
  
  Implement the ofw_bus_get_node method in the imx_gpio driver so that
  ofw_gpiobus can find its fdt metadata and instantiate child devices.

Modified:
  stable/12/sys/arm/freescale/imx/imx_gpio.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/freescale/imx/imx_gpio.c
==
--- stable/12/sys/arm/freescale/imx/imx_gpio.c  Sat Dec  7 17:44:21 2019
(r355497)
+++ stable/12/sys/arm/freescale/imx/imx_gpio.c  Sat Dec  7 17:46:32 2019
(r355498)
@@ -865,6 +865,15 @@ imx51_gpio_detach(device_t dev)
return(0);
 }
 
+static phandle_t
+imx51_gpio_get_node(device_t bus, device_t dev)
+{
+   /*
+* Share controller node with gpiobus device
+*/
+   return ofw_bus_get_node(bus);
+}
+
 static device_method_t imx51_gpio_methods[] = {
DEVMETHOD(device_probe, imx51_gpio_probe),
DEVMETHOD(device_attach,imx51_gpio_attach),
@@ -881,6 +890,9 @@ static device_method_t imx51_gpio_methods[] = {
DEVMETHOD(pic_post_ithread, gpio_pic_post_ithread),
DEVMETHOD(pic_pre_ithread,  gpio_pic_pre_ithread),
 #endif
+
+   /* OFW methods */
+   DEVMETHOD(ofw_bus_get_node, imx51_gpio_get_node),
 
/* GPIO protocol */
DEVMETHOD(gpio_get_bus, imx51_gpio_get_bus),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355497 - stable/12/sys/dev/iicbus

2019-12-07 Thread Ian Lepore
Author: ian
Date: Sat Dec  7 17:44:21 2019
New Revision: 355497
URL: https://svnweb.freebsd.org/changeset/base/355497

Log:
  MFC r354973:
  
  Rewrite iicdev_writeto() to use a single buffer and a single iic_msg, rather
  than effectively doing scatter/gather IO with a pair of iic_msgs that direct
  the controller to do a single transfer with no bus STOP/START between the
  two buffers.  It turns out we have multiple i2c hardware drivers that don't
  honor the NOSTOP and NOSTART flags; sometimes they just try to do the
  transfers anyway, creating confusing failures or leading to corrupted data.

Modified:
  stable/12/sys/dev/iicbus/iiconf.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/iicbus/iiconf.c
==
--- stable/12/sys/dev/iicbus/iiconf.c   Sat Dec  7 17:34:04 2019
(r355496)
+++ stable/12/sys/dev/iicbus/iiconf.c   Sat Dec  7 17:44:21 2019
(r355497)
@@ -540,25 +540,47 @@ iicdev_readfrom(device_t slavedev, uint8_t regaddr, vo
 int iicdev_writeto(device_t slavedev, uint8_t regaddr, void *buffer,
 uint16_t buflen, int waithow)
 {
-   struct iic_msg msgs[2];
-   uint8_t slaveaddr;
+   struct iic_msg msg;
+   uint8_t local_buffer[32];
+   uint8_t *bufptr;
+   size_t bufsize;
+   int error;
 
/*
-* Two transfers back to back with no stop or start between them; first
-* we write the address then we write the data to that address, all in a
-* single transfer from two scattered buffers.
+* Ideally, we would do two transfers back to back with no stop or start
+* between them using an array of 2 iic_msgs; first we'd write the
+* address byte using the IIC_M_NOSTOP flag, then we write the data
+* using IIC_M_NOSTART, all in a single transfer.  Unfortunately,
+* several i2c hardware drivers don't support that (perhaps because the
+* hardware itself can't support it).  So instead we gather the
+* scattered bytes into a single buffer here before writing them using a
+* single iic_msg.  This function is typically used to write a few bytes
+* at a time, so we try to use a small local buffer on the stack, but
+* fall back to allocating a temporary buffer when necessary.
 */
-   slaveaddr = iicbus_get_addr(slavedev);
 
-   msgs[0].slave = slaveaddr;
-   msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP;
-   msgs[0].len   = 1;
-   msgs[0].buf   = 
+   bufsize = buflen + 1;
+   if (bufsize <= sizeof(local_buffer)) {
+   bufptr = local_buffer;
+   } else {
+   bufptr = malloc(bufsize, M_DEVBUF,
+   (waithow & IIC_WAIT) ? M_WAITOK : M_NOWAIT);
+   if (bufptr == NULL)
+   return (errno2iic(ENOMEM));
+   }
 
-   msgs[1].slave = slaveaddr;
-   msgs[1].flags = IIC_M_WR | IIC_M_NOSTART;
-   msgs[1].len   = buflen;
-   msgs[1].buf   = buffer;
+   bufptr[0] = regaddr;
+   memcpy([1], buffer, buflen);
 
-   return (iicbus_transfer_excl(slavedev, msgs, nitems(msgs), waithow));
+   msg.slave = iicbus_get_addr(slavedev);
+   msg.flags = IIC_M_WR;
+   msg.len   = bufsize;
+   msg.buf   = bufptr;
+
+   error = iicbus_transfer_excl(slavedev, , 1, waithow);
+
+   if (bufptr != local_buffer)
+   free(bufptr, M_DEVBUF);
+
+   return (error);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355496 - stable/12/sys/arm/include

2019-12-07 Thread Ian Lepore
Author: ian
Date: Sat Dec  7 17:34:04 2019
New Revision: 355496
URL: https://svnweb.freebsd.org/changeset/base/355496

Log:
  MFC r352938:
  
  Add 8 and 16 bit versions of atomic_cmpset and atomic_fcmpset for arm.
  
  This adds 8 and 16 bit versions of the cmpset and fcmpset functions. Macros
  are used to generate all the flavors from the same set of instructions; the
  macro expansion handles the couple minor differences between each size
  variation (generating ldrexb/ldrexh/ldrex for 8/16/32, etc).
  
  In addition to handling new sizes, the instruction sequences used for cmpset
  and fcmpset are rewritten to be a bit shorter/faster, and the new sequence
  will not return false when *dst==*old but the store-exclusive fails because
  of concurrent writers. Instead, it just loops like ldrex/strex sequences
  normally do until it gets a non-conflicted store. The manpage allows LL/SC
  architectures to bogusly return false, but there's no reason to actually do
  so, at least on arm.
  
  Reviewed by:  cognet

Modified:
  stable/12/sys/arm/include/atomic-v4.h
  stable/12/sys/arm/include/atomic-v6.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/include/atomic-v4.h
==
--- stable/12/sys/arm/include/atomic-v4.h   Sat Dec  7 17:28:41 2019
(r355495)
+++ stable/12/sys/arm/include/atomic-v4.h   Sat Dec  7 17:34:04 2019
(r355496)
@@ -113,6 +113,43 @@ atomic_clear_64(volatile uint64_t *address, uint64_t c
 }
 
 static __inline int
+atomic_fcmpset_8(volatile uint8_t *p, volatile uint8_t *cmpval, volatile 
uint8_t newval)
+{
+   int ret;
+
+   __with_interrupts_disabled(
+{
+   ret = *p;
+   if (*p == *cmpval) {
+   *p = newval;
+   ret = 1;
+   } else {
+   *cmpval = *p;
+   ret = 0;
+   }
+   });
+   return (ret);
+}
+static __inline int
+atomic_fcmpset_16(volatile uint16_t *p, volatile uint16_t *cmpval, volatile 
uint16_t newval)
+{
+   int ret;
+
+   __with_interrupts_disabled(
+{
+   ret = *p;
+   if (*p == *cmpval) {
+   *p = newval;
+   ret = 1;
+   } else {
+   *cmpval = *p;
+   ret = 0;
+   }
+   });
+   return (ret);
+}
+
+static __inline int
 atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile 
u_int32_t newval)
 {
int ret;
@@ -150,6 +187,40 @@ atomic_fcmpset_64(volatile u_int64_t *p, volatile u_in
 }
 
 static __inline int
+atomic_cmpset_8(volatile uint8_t *p, volatile uint8_t cmpval, volatile uint8_t 
newval)
+{
+   int ret;
+
+   __with_interrupts_disabled(
+{
+   if (*p == cmpval) {
+   *p = newval;
+   ret = 1;
+   } else {
+   ret = 0;
+   }
+   });
+   return (ret);
+}
+
+static __inline int
+atomic_cmpset_16(volatile uint16_t *p, volatile uint16_t cmpval, volatile 
uint16_t newval)
+{
+   int ret;
+
+   __with_interrupts_disabled(
+{
+   if (*p == cmpval) {
+   *p = newval;
+   ret = 1;
+   } else {
+   ret = 0;
+   }
+   });
+   return (ret);
+}
+
+static __inline int
 atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile 
u_int32_t newval)
 {
int ret;
@@ -450,6 +521,10 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v)
 #define atomic_fcmpset_rel_32  atomic_fcmpset_32
 #define atomic_fcmpset_acq_32  atomic_fcmpset_32
 #ifdef _KERNEL
+#define atomic_fcmpset_rel_8   atomic_fcmpset_8
+#define atomic_fcmpset_acq_8   atomic_fcmpset_8
+#define atomic_fcmpset_rel_16  atomic_fcmpset_16
+#define atomic_fcmpset_acq_16  atomic_fcmpset_16
 #define atomic_fcmpset_rel_64  atomic_fcmpset_64
 #define atomic_fcmpset_acq_64  atomic_fcmpset_64
 #endif
@@ -458,6 +533,10 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v)
 #define atomic_cmpset_rel_32   atomic_cmpset_32
 #define atomic_cmpset_acq_32   atomic_cmpset_32
 #ifdef _KERNEL
+#define atomic_cmpset_rel_8atomic_cmpset_8
+#define atomic_cmpset_acq_8atomic_cmpset_8
+#define atomic_cmpset_rel_16   atomic_cmpset_16
+#define atomic_cmpset_acq_16   atomic_cmpset_16
 #define atomic_cmpset_rel_64   atomic_cmpset_64
 #define atomic_cmpset_acq_64   atomic_cmpset_64
 #endif

Modified: stable/12/sys/arm/include/atomic-v6.h
==
--- stable/12/sys/arm/include/atomic-v6.h   Sat Dec  7 17:28:41 2019
(r355495)
+++ stable/12/sys/arm/include/atomic-v6.h   Sat Dec  7 17:34:04 2019
(r355496)
@@ -190,224 +190,380 @@ ATOMIC_ACQ_REL(clear, 32)
 

svn commit: r355495 - head/sys/vm

2019-12-07 Thread Mateusz Guzik
Author: mjg
Date: Sat Dec  7 17:28:41 2019
New Revision: 355495
URL: https://svnweb.freebsd.org/changeset/base/355495

Log:
  vm: fix sysctl vm.kstack_cache_size change report
  
  Cache gets resized correctly, but sysctl reports the wrong number:
  # sysctl vm.kstack_cache_size=512
  vm.kstack_cache_size: 128 -> 128
  
  patched:
  vm.kstack_cache_size: 128 -> 512
  
  Reviewed by:  markj
  Differential Revision:https://reviews.freebsd.org/D22717
  Fixes:r355002 "Revise the page cache size policy."

Modified:
  head/sys/vm/vm_glue.c

Modified: head/sys/vm/vm_glue.c
==
--- head/sys/vm/vm_glue.c   Sat Dec  7 17:24:07 2019(r355494)
+++ head/sys/vm/vm_glue.c   Sat Dec  7 17:28:41 2019(r355495)
@@ -273,12 +273,12 @@ static int kstack_domain_iter;
 static int
 sysctl_kstack_cache_size(SYSCTL_HANDLER_ARGS)
 {
-   int error, newsize;
+   int error, oldsize;
 
-   newsize = kstack_cache_size;
-   error = sysctl_handle_int(oidp, , 0, req);
-   if (error == 0 && req->newptr && newsize != kstack_cache_size)
-   uma_zone_set_maxcache(kstack_cache, newsize);
+   oldsize = kstack_cache_size;
+   error = sysctl_handle_int(oidp, arg1, arg2, req);
+   if (error == 0 && req->newptr && oldsize != kstack_cache_size)
+   uma_zone_set_maxcache(kstack_cache, kstack_cache_size);
return (error);
 }
 SYSCTL_PROC(_vm, OID_AUTO, kstack_cache_size, CTLTYPE_INT|CTLFLAG_RW,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355494 - stable/12/sys/dev/iicbus

2019-12-07 Thread Ian Lepore
Author: ian
Date: Sat Dec  7 17:24:07 2019
New Revision: 355494
URL: https://svnweb.freebsd.org/changeset/base/355494

Log:
  MFC r352338:
  
  Create a mechanism for encoding a system errno into the IIC_Ex space.
  
  Errors are communicated between the i2c controller layer and upper layers
  (iicbus and slave device drivers) using a set of IIC_Exx constants which
  effectively define a private number space separate from (and having values
  that conflict with) the system errno number space. Sometimes it is necessary
  to report a plain old system error (especially EINTR) from the controller or
  bus layer and have that value make it back across the syscall interface
  intact.
  
  I initially considered replicating a few "crucial" errno values with similar
  names and new numbers, e.g., IIC_EINTR, IIC_ERESTART, etc. It seemed like
  that had the potential to grow over time until many of the errno names were
  duplicated into the IIC_Ex space.
  
  So instead, this defines a mechanism to "encode" an errno into the IIC_E
  space by setting the high bit and putting the errno into the lower-order
  bits; a new errno2iic() function does this. The existing iic2errno()
  recognizes the encoded values and extracts the original errno out of the
  encoded value. An interesting wrinkle occurs with the pseudo-error values
  such as ERESTART -- they aleady have the high bit set, and turning it off
  would be the wrong thing to do. Instead, iic2errno() recognizes that lots of
  high bits are on (i.e., it's a negative number near to zero) and just
  returns that value as-is.
  
  Thus, existing drivers continue to work without needing any changes, and
  there is now a way to return errno values from the lower layers. The first
  use of that is in iicbus_poll() which does mtx_sleep() with the PCATCH flag,
  and needs to return the errno from that up the call chain.
  
  Differential Revision:https://reviews.freebsd.org/D20975

Modified:
  stable/12/sys/dev/iicbus/iiconf.c
  stable/12/sys/dev/iicbus/iiconf.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/iicbus/iiconf.c
==
--- stable/12/sys/dev/iicbus/iiconf.c   Sat Dec  7 17:19:36 2019
(r355493)
+++ stable/12/sys/dev/iicbus/iiconf.c   Sat Dec  7 17:24:07 2019
(r355494)
@@ -42,6 +42,18 @@ __FBSDID("$FreeBSD$");
 #include "iicbus_if.h"
 
 /*
+ * Encode a system errno value into the IIC_Ex space by setting the
+ * IIC_ERRNO marker bit, so that iic2errno() can turn it back into a plain
+ * system errno value later.  This lets controller- and bus-layer code get
+ * important system errno values (such as EINTR/ERESTART) back to the caller.
+ */
+int
+errno2iic(int errno)
+{
+   return ((errno == 0) ? 0 : errno | IIC_ERRNO);
+}
+
+/*
  * Translate IIC_Ex status values to vaguely-equivelent errno values.
  */
 int
@@ -59,7 +71,22 @@ iic2errno(int iic_status)
case IIC_ENOTSUPP:  return (EOPNOTSUPP);
case IIC_ENOADDR:   return (EADDRNOTAVAIL);
case IIC_ERESOURCE: return (ENOMEM);
-   default:return (EIO);
+   default:
+   /*
+* If the high bit is set, that means it's a system errno value
+* that was encoded into the IIC_Exx space by setting the
+* IIC_ERRNO marker bit.  If lots of high-order bits are set,
+* then it's one of the negative pseudo-errors such as ERESTART
+* and we return it as-is.  Otherwise it's a plain "small
+* positive integer" errno, so just remove the IIC_ERRNO marker
+* bit.  If it's some unknown number without the high bit set,
+* there isn't much we can do except call it an I/O error.
+*/
+   if ((iic_status & IIC_ERRNO) == 0)
+   return (EIO);
+   if ((iic_status & 0x) != 0)
+   return (iic_status);
+   return (iic_status & ~IIC_ERRNO);
}
 }
 
@@ -97,7 +124,7 @@ iicbus_poll(struct iicbus_softc *sc, int how)
return (IIC_EBUSBSY);
}
 
-   return (error);
+   return (errno2iic(error));
 }
 
 /*

Modified: stable/12/sys/dev/iicbus/iiconf.h
==
--- stable/12/sys/dev/iicbus/iiconf.h   Sat Dec  7 17:19:36 2019
(r355493)
+++ stable/12/sys/dev/iicbus/iiconf.h   Sat Dec  7 17:24:07 2019
(r355494)
@@ -96,12 +96,14 @@
 #define IIC_ENOTSUPP   0x8 /* request not supported */
 #define IIC_ENOADDR0x9 /* no address assigned to the interface */
 #define IIC_ERESOURCE  0xa /* resources (memory, whatever) unavailable */
+#define IIC_ERRNO  __INT_MIN /* marker bit: errno is in low-order bits */
 
 /*
  * Note that all iicbus functions return IIC_Ex status values,
  

svn commit: r355493 - stable/12/usr.sbin/daemon

2019-12-07 Thread Ian Lepore
Author: ian
Date: Sat Dec  7 17:19:36 2019
New Revision: 355493
URL: https://svnweb.freebsd.org/changeset/base/355493

Log:
  MFC r353024-r353025
  
  r353024:
  Clarify how the -f option for daemon(8) interacts with other options
  related to redirecting stdout and stderr.
  
  r353025:
  Bump .Dd for earlier update (should have been part of r353024).

Modified:
  stable/12/usr.sbin/daemon/daemon.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/daemon/daemon.8
==
--- stable/12/usr.sbin/daemon/daemon.8  Sat Dec  7 17:17:34 2019
(r355492)
+++ stable/12/usr.sbin/daemon/daemon.8  Sat Dec  7 17:19:36 2019
(r355493)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 25, 2019
+.Dd October 2, 2019
 .Dt DAEMON 8
 .Os
 .Sh NAME
@@ -63,6 +63,11 @@ Change the current working directory to the root
 .It Fl f
 Redirect standard input, standard output and standard error to
 .Pa /dev/null .
+When this option is used together with any of the options related to file
+or syslog output, the standard file descriptors are first redirected to
+.Pa /dev/null ,
+then stdout and/or stderr is redirected to a file or to syslog as
+specified by the other options.
 .It Fl S
 Enable syslog output.
 This is implicitly applied if other syslog parameters are provided.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355492 - in stable/12/sys/arm/ti: . am335x

2019-12-07 Thread Ian Lepore
Author: ian
Date: Sat Dec  7 17:17:34 2019
New Revision: 355492
URL: https://svnweb.freebsd.org/changeset/base/355492

Log:
  MFC r352196, r352333, r352342, r353653
  
  r352196:
  In am335x_dmtpps, use a spin mutex to interlock between PPS capture and PPS
  ioctl(2) handling.  This allows doing the pps_event() work in the polling
  routine, instead of using a taskqueue task to do that work.
  
  Also, add PNPINFO, and switch to using make_dev_s() to create the cdev.
  
  Using a spin mutex and calling pps_event() from the polling function works
  around the situation which requires more than 2 sets of timecounter
  timehands in a single-core system to get reliable PPS capture.  That problem
  would happen when a single-core system is idle in cpu_idle() then gets woken
  up with an event timer event which was scheduled to handle a hardclock tick.
  That processing path would end up calling tc_windup 3 or 4 times between
  when the tc polling function was called and when the taskqueue task would
  eventually run, and with only two sets of timehands, the th_generation count
  would always be too old to allow the captured PPS data to be used.
  
  r352333:
  Include , required to use spinlocks in this code.
  
  r352342:
  Make the ti_sysc device quiet.  It's an internal utility pseudo-device
  that makes the upstream FDT data work right, so we don't need to see a
  couple dozen instances of it spam the dmesg at boot time unless it's a
  verbose boot.
  
  r353653:
  Update some comments; no functional changes.  Some historical old comments
  in this driver indicate that the SD_CAPA register is write-once and after
  being set one time the values in it cannot be changed.  That turns out not
  to be the case -- the values written to it survive a reset, but they can
  be rewritten/changed at any time.

Modified:
  stable/12/sys/arm/ti/am335x/am335x_dmtpps.c
  stable/12/sys/arm/ti/ti_sdhci.c
  stable/12/sys/arm/ti/ti_sysc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/ti/am335x/am335x_dmtpps.c
==
--- stable/12/sys/arm/ti/am335x/am335x_dmtpps.c Sat Dec  7 17:14:33 2019
(r355491)
+++ stable/12/sys/arm/ti/am335x/am335x_dmtpps.c Sat Dec  7 17:17:34 2019
(r355492)
@@ -48,11 +48,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -79,7 +79,6 @@ struct dmtpps_softc {
uint32_ttclr;   /* Cached TCLR register. */
struct timecounter  tc;
int pps_curmode;/* Edge mode now set in hw. */
-   struct task pps_task;   /* For pps_event handling. */
struct cdev *   pps_cdev;
struct pps_statepps_state;
struct mtx  pps_mtx;
@@ -93,6 +92,7 @@ static struct ofw_compat_data compat_data[] = {
{"ti,am335x-timer-1ms", 1},
{NULL,  0},
 };
+SIMPLEBUS_PNP_INFO(compat_data);
 
 /*
  * A table relating pad names to the hardware timer number they can be mux'd 
to.
@@ -285,48 +285,29 @@ dmtpps_poll(struct timecounter *tc)
 * populates it from the current DMT_TCRR register) with the latched
 * value from the TCAR1 register.
 *
-* There is no locking here, by design.  pps_capture() writes into an
-* area of struct pps_state which is read only by pps_event().  The
-* synchronization of access to that area is temporal rather than
-* interlock based... we write in this routine and trigger the task that
-* will read the data, so no simultaneous access can occur.
-*
 * Note that we don't have the TCAR interrupt enabled, but the hardware
 * still provides the status bits in the "RAW" status register even when
 * they're masked from generating an irq.  However, when clearing the
 * TCAR status to re-arm the capture for the next second, we have to
 * write to the IRQ status register, not the RAW register.  Quirky.
+*
+* We do not need to hold a lock while capturing the pps data, because
+* it is captured into an area of the pps_state struct which is read
+* only by pps_event().  We do need to hold a lock while calling
+* pps_event(), because it manipulates data which is also accessed from
+* the ioctl(2) context by userland processes.
 */
if (DMTIMER_READ4(sc, DMT_IRQSTATUS_RAW) & DMT_IRQ_TCAR) {
pps_capture(>pps_state);
sc->pps_state.capcount = DMTIMER_READ4(sc, DMT_TCAR1);
DMTIMER_WRITE4(sc, DMT_IRQSTATUS, DMT_IRQ_TCAR);
-   taskqueue_enqueue(taskqueue_fast, >pps_task);
+
+   mtx_lock_spin(>pps_mtx);
+   pps_event(>pps_state, PPS_CAPTUREASSERT);
+   

svn commit: r355491 - head/sys/vm

2019-12-07 Thread Doug Moore
Author: dougm
Date: Sat Dec  7 17:14:33 2019
New Revision: 355491
URL: https://svnweb.freebsd.org/changeset/base/355491

Log:
  Remove the next and prev fields from vm_map_entry, to save a bit of
  space.  Where the vm_map tree now has null pointers, store pointers to
  next and previous entries in right and left fields, making the binary
  tree threaded.  Have the predecessor and successor functions compute
  what the prev and next fields previously stored.
  
  Reviewed by: markj, kib (previous version)
  Tested by: pho (previous version)
  Differential Revision: https://reviews.freebsd.org/D21964

Modified:
  head/sys/vm/vm_map.c
  head/sys/vm/vm_map.h

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cSat Dec  7 17:10:03 2019(r355490)
+++ head/sys/vm/vm_map.cSat Dec  7 17:14:33 2019(r355491)
@@ -896,7 +896,6 @@ static void
 _vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max)
 {
 
-   map->header.next = map->header.prev = >header;
map->header.eflags = MAP_ENTRY_HEADER;
map->needs_wakeup = FALSE;
map->system_map = 0;
@@ -904,6 +903,7 @@ _vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t mi
map->header.end = min;
map->header.start = max;
map->flags = 0;
+   map->header.left = map->header.right = >header;
map->root = NULL;
map->timestamp = 0;
map->busy = 0;
@@ -977,7 +977,7 @@ static inline vm_size_t
 vm_map_entry_max_free_left(vm_map_entry_t root, vm_map_entry_t left_ancestor)
 {
 
-   return (root->left != NULL ?
+   return (root->left != left_ancestor ?
root->left->max_free : root->start - left_ancestor->end);
 }
 
@@ -985,7 +985,7 @@ static inline vm_size_t
 vm_map_entry_max_free_right(vm_map_entry_t root, vm_map_entry_t right_ancestor)
 {
 
-   return (root->right != NULL ?
+   return (root->right != right_ancestor ?
root->right->max_free : right_ancestor->start - root->end);
 }
 
@@ -994,16 +994,22 @@ vm_map_entry_max_free_right(vm_map_entry_t root, vm_ma
  *
  * Find the {predecessor, successor} of the entry by taking one step
  * in the appropriate direction and backtracking as much as necessary.
+ * vm_map_entry_succ is defined in vm_map.h.
  */
 static inline vm_map_entry_t
 vm_map_entry_pred(vm_map_entry_t entry)
 {
+   vm_map_entry_t prior;
 
-   return (entry->prev);
+   prior = entry->left;
+   if (prior->right->start < entry->start) {
+   do
+   prior = prior->right;
+   while (prior->right != entry);
+   }
+   return (prior);
 }
 
-/* vm_map_entry_succ is defined in vm_map.h. */
-
 static inline vm_size_t
 vm_size_max(vm_size_t a, vm_size_t b)
 {
@@ -1011,7 +1017,8 @@ vm_size_max(vm_size_t a, vm_size_t b)
return (a > b ? a : b);
 }
 
-#define SPLAY_LEFT_STEP(root, y, rlist, test) do { \
+#define SPLAY_LEFT_STEP(root, y, llist, rlist, test) do {  \
+   vm_map_entry_t z;   \
vm_size_t max_free; \
\
/*  \
@@ -1023,16 +1030,20 @@ vm_size_max(vm_size_t a, vm_size_t b)
max_free = root->max_free;  \
KASSERT(max_free >= vm_map_entry_max_free_right(root, rlist),   \
("%s: max_free invariant fails", __func__));\
-   if (y == NULL ? max_free > 0 : max_free - 1 < y->max_free)  \
+   if (y == llist ? max_free > 0 : max_free - 1 < y->max_free) \
max_free = vm_map_entry_max_free_right(root, rlist);\
-   if (y != NULL && (test)) {  \
+   if (y != llist && (test)) { \
/* Rotate right and make y root. */ \
-   root->left = y->right;  \
-   y->right = root;\
-   if (max_free < y->max_free) \
+   z = y->right;   \
+   if (z != root) {\
+   root->left = z; \
+   y->right = root;\
+   if (max_free < y->max_free) \
+   root->max_free = max_free = \
+   vm_size_max(max_free, z->max_free); \
+   } else if (max_free < y->max_free)  \
root->max_free = max_free =   

svn commit: r355490 - in stable/12: share/man/man4 sys/dev/gpio sys/dev/ofw

2019-12-07 Thread Ian Lepore
Author: ian
Date: Sat Dec  7 17:10:03 2019
New Revision: 355490
URL: https://svnweb.freebsd.org/changeset/base/355490

Log:
  MFC r355214, r355239, r355274, r355276-r355277, r355295, r355298
  
  r355214:
  Ignore "gpio-hog" nodes when instantiating ofw_gpiobus children.  Also,
  in ofw_gpiobus_probe() return BUS_PROBE_DEFAULT rather than 0; we are not
  the only possible driver to handle this device, we're just slightly better
  than the base gpiobus (which probes at BUS_PROBE_GENERIC).
  
  In the time since this code was first written, the gpio controller bindings
  aquired the concept of a "hog" node which could be used to preset one or
  more gpio pins as input or output at a specified level.  This change doesn't
  fully implement the hogging concept, it just filters out hog nodes when
  instantiating child devices by scanning for child nodes in the fdt data.
  
  The whole concept of having child nodes under the controller node is not
  supported by the standard bindings, and appears to be a freebsd extension,
  probably left over from the days when we had no support for cross-tree
  phandle references in the fdt data.
  
  r355239:
  Add an OFWBUS_PNP_INFO() macro for devices that hang directly off the root
  ofwbus.  Also, apply some style(9) whitespace fixing to the
  SIMPLEBUS_PNP_INFO() macro (no functional change).
  
  r355274:
  Move most of the gpio_pin_* functions from ofw_gpiobus.c to gpiobus.c so
  that they can be used by drivers on non-FDT-configured systems.  Only the
  functions related to acquiring pins by parsing FDT data remain in
  ofw_gpiobus.  Also, add two new functions for acquiring gpio pins based on
  child device_t and index, or on the bus device_t and pin number.  And
  finally, defer reserving pins for gpiobus children until they acquire the
  pin, rather than reserving them as soon as the child is added (before it's
  even known whether the child will attach).
  
  This will allow drivers configured with hints (or any other mechanism) to
  use the same code as drivers configured via FDT data.  Until now, a hinted
  driver and an FDT driver had to be two completely different sets of code,
  because hinted drivers could only use gpiobus calls to manipulate pins,
  while fdt-configured drivers could not use that API (due to not always being
  children of the bus that owns the pins) and had to use the newer
  gpio_pin_() functions.  Now drivers can be written in the more
  traditional form, where most of the code is shared and only the resource
  acquisition code at attachment time changes.
  
  r355276:
  Rewrite gpioiic(4) to use the gpio_pin_* API, and to conform to the modern
  FDT bindings document for gpio-i2c devices.
  
  Using the gpio_pin_* functions to acquire/release/manipulate gpio pins
  removes the constraint that both gpio pins must belong to the same gpio
  controller/bank, and that the gpioiic instance must be a child of gpiobus.
  Removing those constraints allows the driver to be fully compatible with
  the modern dts bindings for a gpio bitbanged i2c bus.
  
  For hinted attachment, the two gpio pins still must be on the same gpiobus,
  and the device instance must be a child of that bus.  This preserves
  compatibility for existing installations that have use gpioiic(4) with hints.
  
  r355277:
  Fix leading whitespace (spaces->tabs) in comments; no functional change.
  
  r355295:
  Remove "all rights reserved" from copyright after getting a response from
  Luiz that he also was not intentionally asserting that right, it was already
  there when he added his name.
  
  r355298:
  Do not initialize the flags field in struct gpiobus_pin from the flags in
  struct gpio_pin.  It turns out these two sets of flags are completely
  unrelated to each other.
  
  Also, update the comment for GPIO_ACTIVE_LOW to reflect the fact that it
  does get set, somewhat unobviously, by code that parses FDT data.  The bits
  from the FDT cell containing flags are just copied to gpiobus_pin.flags, so
  there's never any obvious reference to the symbol GPIO_ACTIVE_LOW being
  stored into the flags field.

Modified:
  stable/12/share/man/man4/gpioiic.4
  stable/12/sys/dev/gpio/gpiobus.c
  stable/12/sys/dev/gpio/gpiobusvar.h
  stable/12/sys/dev/gpio/gpioiic.c
  stable/12/sys/dev/gpio/ofw_gpiobus.c
  stable/12/sys/dev/ofw/ofw_bus_subr.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/gpioiic.4
==
--- stable/12/share/man/man4/gpioiic.4  Sat Dec  7 16:45:12 2019
(r355489)
+++ stable/12/share/man/man4/gpioiic.4  Sat Dec  7 17:10:03 2019
(r355490)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 14, 2014
+.Dd December 1, 2019
 .Dt GPIOIIC 4
 .Os
 .Sh NAME
@@ -37,38 +37,42 @@ kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device gpio"
 .Cd "device gpioiic"
-.Cd "device iic"
 .Cd "device iicbb"
 .Cd "device iicbus"
 .Ed
+.Pp

svn commit: r355489 - head/lib/libc/sys

2019-12-07 Thread Alan Somers
Author: asomers
Date: Sat Dec  7 16:45:12 2019
New Revision: 355489
URL: https://svnweb.freebsd.org/changeset/base/355489

Log:
  clock_gettime(2): add a HISTORY section
  
  MFC after:2 weeks

Modified:
  head/lib/libc/sys/clock_gettime.2

Modified: head/lib/libc/sys/clock_gettime.2
==
--- head/lib/libc/sys/clock_gettime.2   Sat Dec  7 16:29:56 2019
(r355488)
+++ head/lib/libc/sys/clock_gettime.2   Sat Dec  7 16:45:12 2019
(r355489)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 20, 2017
+.Dd December 7, 2019
 .Dt CLOCK_GETTIME 2
 .Os
 .Sh NAME
@@ -174,3 +174,11 @@ The clock IDs
 .Fa CLOCK_UPTIME_PRECISE ,
 .Fa CLOCK_SECOND
 are FreeBSD extensions to the POSIX interface.
+.Sh HISTORY
+The
+.Fn clock_gettime ,
+.Fn clock_settime ,
+and
+.Fn clock_getres
+system calls first appeared in
+.Fx 3.0 .
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355488 - head/lib/libc/sys

2019-12-07 Thread Alan Somers
Author: asomers
Date: Sat Dec  7 16:29:56 2019
New Revision: 355488
URL: https://svnweb.freebsd.org/changeset/base/355488

Log:
  lio_listio(2): add a HISTORY section
  
  MFC after:2 weeks

Modified:
  head/lib/libc/sys/lio_listio.2

Modified: head/lib/libc/sys/lio_listio.2
==
--- head/lib/libc/sys/lio_listio.2  Sat Dec  7 16:14:23 2019
(r355487)
+++ head/lib/libc/sys/lio_listio.2  Sat Dec  7 16:29:56 2019
(r355488)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Oct 23, 2017
+.Dd Dec 7, 2019
 .Dt LIO_LISTIO 2
 .Os
 .Sh NAME
@@ -216,3 +216,8 @@ The
 .Fn lio_listio
 function is expected to conform to
 .St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Fn lio_listio
+system call first appeared in
+.Fx 3.0 .
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355487 - in head/sys: arm64/arm64 arm64/include conf

2019-12-07 Thread Michal Meloun
Author: mmel
Date: Sat Dec  7 16:14:23 2019
New Revision: 355487
URL: https://svnweb.freebsd.org/changeset/base/355487

Log:
  Add support for booting kernel directly from U-Boot using booti command.
  
  In some cases, like is locked bootstrap or device's inability to boot from
  removable media, we cannot use standard boot sequence and is necessary to
  boot kernel directly from U-Boot.
  
  Discussed with:   jhibbits
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D13861

Added:
  head/sys/arm64/arm64/machdep_boot.c   (contents, props changed)
Modified:
  head/sys/arm64/arm64/locore.S
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/include/machdep.h
  head/sys/conf/Makefile.arm64
  head/sys/conf/files.arm64
  head/sys/conf/options.arm64

Modified: head/sys/arm64/arm64/locore.S
==
--- head/sys/arm64/arm64/locore.S   Sat Dec  7 15:17:00 2019
(r355486)
+++ head/sys/arm64/arm64/locore.S   Sat Dec  7 16:14:23 2019
(r355487)
@@ -43,6 +43,24 @@
.globl  kernbase
.setkernbase, KERNBASE
 
+
+/* U-Boot booti related constants. */
+#if defined(LINUX_BOOT_ABI)
+#define FDT_MAGIC  0xEDFE0DD0  /* FDT blob Magic */
+
+#ifndef UBOOT_IMAGE_OFFSET
+#defineUBOOT_IMAGE_OFFSET  0   /* Image offset from 
start of */
+#endif /*  2 MiB page */
+
+#ifndef UBOOT_IMAGE_SIZE   /* Total size of image */
+#defineUBOOT_IMAGE_SIZE _end - _start
+#endif
+
+#ifndef UBOOT_IMAGE_FLAGS
+#defineUBOOT_IMAGE_FLAGS   0   /* LE kernel, 
unspecified */
+#endif /*  page size */
+#endif /* defined(LINUX_BOOT_ABI) */
+
 /*
  * We assume:
  *  MMU  on with an identity map, or off
@@ -54,6 +72,21 @@
.text
.globl _start
 _start:
+#if defined(LINUX_BOOT_ABI)
+   /* U-boot image header */
+   b   1f  /* code 0 */
+   .long   0   /* code 1 */
+   .quad   UBOOT_IMAGE_OFFSET  /* Image offset in 2 MiB page, LE */
+   .quad   UBOOT_IMAGE_SIZE/* Image size, LE */
+   .quad   UBOOT_IMAGE_FLAGS   /* Flags for kernel. LE */
+   .quad   0   /* Reserved */
+   .quad   0   /* Reserved */
+   .quad   0   /* Reserved */
+   .long   0x644d5241  /* Magic  "ARM\x64", LE */
+   .long   0   /* Reserved for PE COFF offset*/
+1:
+#endif /* defined(LINUX_BOOT_ABI) */
+
/* Drop to EL1 */
bl  drop_to_el1
 
@@ -350,11 +383,50 @@ create_pagetables:
 
/* Find the size of the kernel */
mov x6, #(KERNBASE)
+
+#if defined(LINUX_BOOT_ABI)
+   /* X19 is used as 'map FDT data' flag */
+   mov x19, xzr
+
+   /* No modules or FDT pointer ? */
+   cbz x0, booti_no_fdt
+
+   /* Test if modulep points to modules descriptor or to FDT */
+   ldr w8, [x0]
+   ldr w7, =FDT_MAGIC
+   cmp w7, w8
+   b.eqbooti_fdt
+#endif
+
+   /* Booted with modules pointer */
/* Find modulep - begin */
sub x8, x0, x6
/* Add two 2MiB pages for the module data and round up */
ldr x7, =(3 * L2_SIZE - 1)
add x8, x8, x7
+   b   common
+
+#if defined(LINUX_BOOT_ABI)
+booti_fdt:
+   /* Booted by U-Boot booti with FDT data */
+   /* Set 'map FDT data' flag */
+   mov x19, #1
+
+booti_no_fdt:
+   /* Booted by U-Boot booti without FTD data */
+   /* Find the end - begin */
+   ldr x7, .Lend
+   sub x8, x7, x6
+
+   /*
+* Add one 2MiB page for copy of FDT data (maximum FDT size),
+* one for metadata and round up
+*/
+   ldr x7, =(3 * L2_SIZE - 1)
+   add x8, x8, x7
+#endif
+
+common:
/* Get the number of l2 pages to allocate, rounded down */
lsr x10, x8, #(L2_SHIFT)
 
@@ -404,9 +476,21 @@ create_pagetables:
bl  build_l1_block_pagetable
 #endif
 
-   /*
-* Create the VA = PA map
-*/
+#if defined(LINUX_BOOT_ABI)
+   /* Map FDT data ? */
+   cbz x19, 1f
+
+   /* Create the identity mapping for FDT data (2 MiB max) */
+   mov x7, #(ATTR_nG | ATTR_IDX(VM_MEMATTR_UNCACHEABLE))
+   mov x9, x0
+   mov x8, x0  /* VA start (== PA start) */
+   mov x10, #1
+   bl  build_l1_block_pagetable
+
+1:
+#endif
+
+   /* Create the VA = PA map */
mov x7, #(ATTR_nG | ATTR_IDX(VM_MEMATTR_UNCACHEABLE))
mov x9, x27
mov x8, x9  /* VA start (== PA start) */

Modified: head/sys/arm64/arm64/machdep.c
==
--- 

svn commit: r355486 - head/sbin/mount_fusefs

2019-12-07 Thread Jens Schweikhardt
Author: schweikh
Date: Sat Dec  7 15:17:00 2019
New Revision: 355486
URL: https://svnweb.freebsd.org/changeset/base/355486

Log:
  Correct a handful of typos/grammos.

Modified:
  head/sbin/mount_fusefs/mount_fusefs.8

Modified: head/sbin/mount_fusefs/mount_fusefs.8
==
--- head/sbin/mount_fusefs/mount_fusefs.8   Sat Dec  7 14:17:56 2019
(r355485)
+++ head/sbin/mount_fusefs/mount_fusefs.8   Sat Dec  7 15:17:00 2019
(r355486)
@@ -60,7 +60,7 @@ Basic usage is to start a fuse daemon on the given
 file.
 In practice, the daemon is assigned a
 .Ar special
-file automatically, which can then be indentified via
+file automatically, which can then be identified via
 .Xr fstat 1 .
 That special file can then be mounted by
 .Nm .
@@ -100,7 +100,7 @@ is an integer it will be interpreted as the number
 of the file descriptor of an already open fuse device
 (used when the Fuse library invokes
 .Nm .
-(See
+See
 .Sx DAEMON MOUNTS ) .
 .Pp
 The options are as follows:
@@ -181,7 +181,7 @@ are supported by the Fuse library.
 One can list these by passing
 .Fl h
 to a Fuse daemon.
-Most of these options only have affect on the behavior of the daemon (that is,
+Most of these options only have effect on the behavior of the daemon (that is,
 their scope is limited to userspace).
 However, there are some which do require in-kernel support.
 Currently the options supported by the kernel are:
@@ -209,7 +209,7 @@ has the same effect as
 This is the recommended usage when you want basic usage
 (eg, run the daemon at a low privilege level but mount it as root).
 .Sh STRICT ACCESS POLICY
-The strict access policy for Fuse filesystems lets one to use the filesystem
+The strict access policy for Fuse filesystems lets one use the filesystem
 only if the filesystem daemon has the same credentials (uid, real uid, gid,
 real gid) as the user.
 .Pp
@@ -222,7 +222,7 @@ This is to shield users from the daemon
 .Dq spying
 on their I/O activities.
 .Pp
-Users might opt to willingly relax strict access policy (as far they
+Users might opt to willingly relax strict access policy (as far as they
 are concerned) by doing their own secondary mount (See
 .Sx SHARED MOUNTS ) .
 .Sh SHARED MOUNTS
@@ -259,13 +259,13 @@ However, given that
 is capable of invoking an arbitrary program, one must be careful when doing 
this.
 .Nm
 is designed in a way such that it makes that easy.
-For this purpose, there are options which disable certain risky features (
-.Fl S
+For this purpose, there are options which disable certain risky features
+.Fl ( S
 and
 .Fl A ) ,
 and command line parsing is done in a flexible way: mixing options and
 non-options is allowed, but processing them stops at the third non-option
-argument (after the first two has been utilized as device and mountpoint).
+argument (after the first two have been utilized as device and mountpoint).
 The rest of the command line specifies the daemon and its arguments.
 (Alternatively, the daemon, the special and the mount path can be
 specified using the respective options.) Note that
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355485 - stable/12/sbin/bectl

2019-12-07 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Sat Dec  7 14:17:56 2019
New Revision: 355485
URL: https://svnweb.freebsd.org/changeset/base/355485

Log:
  MFC r355225:
  Capitalize some user-visible output messages in
  the bectl utility.
  
  No functional changes.
  
  Approved by:  imp@
  Differential Revision:https://reviews.freebsd.org/D22330

Modified:
  stable/12/sbin/bectl/bectl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/bectl/bectl.c
==
--- stable/12/sbin/bectl/bectl.cSat Dec  7 12:56:24 2019
(r355484)
+++ stable/12/sbin/bectl/bectl.cSat Dec  7 14:17:56 2019
(r355485)
@@ -68,7 +68,7 @@ usage(bool explicit)
 
fp =  explicit ? stdout : stderr;
fprintf(fp, "%s",
-   "usage:\tbectl {-h | -? | subcommand [args...]}\n"
+   "Usage:\tbectl {-h | -? | subcommand [args...]}\n"
 #if SOON
"\tbectl add (path)*\n"
 #endif
@@ -167,10 +167,10 @@ bectl_cmd_activate(int argc, char *argv[])
/* activate logic goes here */
if ((err = be_activate(be, argv[0], temp)) != 0)
/* XXX TODO: more specific error msg based on err */
-   printf("did not successfully activate boot environment %s\n",
+   printf("Did not successfully activate boot environment %s\n",
argv[0]);
else
-   printf("successfully activated boot environment %s\n", argv[0]);
+   printf("Successfully activated boot environment %s\n", argv[0]);
 
if (temp)
printf("for next boot\n");
@@ -250,14 +250,14 @@ bectl_cmd_create(int argc, char *argv[])
default:
if (atpos != NULL)
fprintf(stderr,
-   "failed to create a snapshot '%s' of '%s'\n",
+   "Failed to create a snapshot '%s' of '%s'\n",
atpos, bootenv);
else if (snapname == NULL)
fprintf(stderr,
-   "failed to create bootenv %s\n", bootenv);
+   "Failed to create bootenv %s\n", bootenv);
else
fprintf(stderr,
-   "failed to create bootenv %s from snapshot %s\n",
+   "Failed to create bootenv %s from snapshot %s\n",
bootenv, snapname);
}
 
@@ -424,12 +424,12 @@ bectl_cmd_mount(int argc, char *argv[])
 
switch (err) {
case BE_ERR_SUCCESS:
-   printf("successfully mounted %s at %s\n", bootenv, result_loc);
+   printf("Successfully mounted %s at %s\n", bootenv, result_loc);
break;
default:
fprintf(stderr,
-   (argc == 3) ? "failed to mount bootenv %s at %s\n" :
-   "failed to mount bootenv %s at temporary path %s\n",
+   (argc == 3) ? "Failed to mount bootenv %s at %s\n" :
+   "Failed to mount bootenv %s at temporary path %s\n",
bootenv, mountpoint);
}
 
@@ -462,7 +462,7 @@ bectl_cmd_rename(int argc, char *argv[])
case BE_ERR_SUCCESS:
break;
default:
-   fprintf(stderr, "failed to rename bootenv %s to %s\n",
+   fprintf(stderr, "Failed to rename bootenv %s to %s\n",
src, dest);
}
 
@@ -507,7 +507,7 @@ bectl_cmd_unmount(int argc, char *argv[])
case BE_ERR_SUCCESS:
break;
default:
-   fprintf(stderr, "failed to unmount bootenv %s\n", bootenv);
+   fprintf(stderr, "Failed to unmount bootenv %s\n", bootenv);
}
 
return (err);
@@ -563,7 +563,7 @@ main(int argc, char *argv[])
return (usage(true));
 
if ((cmd = get_cmd_info(command)) == NULL) {
-   fprintf(stderr, "unknown command: %s\n", command);
+   fprintf(stderr, "Unknown command: %s\n", command);
return (usage(false));
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355483 - head/sys/kern

2019-12-07 Thread Mateusz Guzik
Author: mjg
Date: Sat Dec  7 12:55:58 2019
New Revision: 355483
URL: https://svnweb.freebsd.org/changeset/base/355483

Log:
  vfs: catch vn_printf up with reality
  
  - add the missing VV_VMSIZEVNLOCK and VV_READLINK flags
  - add decoding v_mflag
  
  While here sort flags.

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cSat Dec  7 03:56:36 2019(r355482)
+++ head/sys/kern/vfs_subr.cSat Dec  7 12:55:58 2019(r355483)
@@ -3745,6 +3745,8 @@ vn_printf(struct vnode *vp, const char *fmt, ...)
strlcat(buf, "|VV_ETERNALDEV", sizeof(buf));
if (vp->v_vflag & VV_CACHEDLABEL)
strlcat(buf, "|VV_CACHEDLABEL", sizeof(buf));
+   if (vp->v_vflag & VV_VMSIZEVNLOCK)
+   strlcat(buf, "|VV_VMSIZEVNLOCK", sizeof(buf));
if (vp->v_vflag & VV_COPYONWRITE)
strlcat(buf, "|VV_COPYONWRITE", sizeof(buf));
if (vp->v_vflag & VV_SYSTEM)
@@ -3759,6 +3761,8 @@ vn_printf(struct vnode *vp, const char *fmt, ...)
strlcat(buf, "|VV_MD", sizeof(buf));
if (vp->v_vflag & VV_FORCEINSMQ)
strlcat(buf, "|VV_FORCEINSMQ", sizeof(buf));
+   if (vp->v_vflag & VV_READLINK)
+   strlcat(buf, "|VV_READLINK", sizeof(buf));
flags = vp->v_vflag & ~(VV_ROOT | VV_ISTTY | VV_NOSYNC | VV_ETERNALDEV |
VV_CACHEDLABEL | VV_COPYONWRITE | VV_SYSTEM | VV_PROCDEP |
VV_NOKNOTE | VV_DELETED | VV_MD | VV_FORCEINSMQ);
@@ -3766,6 +3770,8 @@ vn_printf(struct vnode *vp, const char *fmt, ...)
snprintf(buf2, sizeof(buf2), "|VV(0x%lx)", flags);
strlcat(buf, buf2, sizeof(buf));
}
+   if (vp->v_iflag & VI_TEXT_REF)
+   strlcat(buf, "|VI_TEXT_REF", sizeof(buf));
if (vp->v_iflag & VI_MOUNT)
strlcat(buf, "|VI_MOUNT", sizeof(buf));
if (vp->v_iflag & VI_DOOMED)
@@ -3778,12 +3784,17 @@ vn_printf(struct vnode *vp, const char *fmt, ...)
strlcat(buf, "|VI_DOINGINACT", sizeof(buf));
if (vp->v_iflag & VI_OWEINACT)
strlcat(buf, "|VI_OWEINACT", sizeof(buf));
-   if (vp->v_iflag & VI_TEXT_REF)
-   strlcat(buf, "|VI_TEXT_REF", sizeof(buf));
-   flags = vp->v_iflag & ~(VI_MOUNT | VI_DOOMED | VI_FREE |
-   VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT | VI_TEXT_REF);
+   flags = vp->v_iflag & ~(VI_TEXT_REF | VI_MOUNT | VI_DOOMED | VI_FREE |
+   VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT);
if (flags != 0) {
snprintf(buf2, sizeof(buf2), "|VI(0x%lx)", flags);
+   strlcat(buf, buf2, sizeof(buf));
+   }
+   if (vp->v_mflag & VMP_TMPMNTFREELIST)
+   strlcat(buf, "|VMP_TMPMNTFREELIST", sizeof(buf));
+   flags = vp->v_mflag & ~(VMP_TMPMNTFREELIST);
+   if (flags != 0) {
+   snprintf(buf2, sizeof(buf2), "|VMP(0x%lx)", flags);
strlcat(buf, buf2, sizeof(buf));
}
printf("flags (%s)\n", buf + 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355484 - head/sys/kern

2019-12-07 Thread Mateusz Guzik
Author: mjg
Date: Sat Dec  7 12:56:24 2019
New Revision: 355484
URL: https://svnweb.freebsd.org/changeset/base/355484

Log:
  vfs: clean up delmntque similarly to vdrop r355414

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cSat Dec  7 12:55:58 2019(r355483)
+++ head/sys/kern/vfs_subr.cSat Dec  7 12:56:24 2019(r355484)
@@ -1670,7 +1670,6 @@ static void
 delmntque(struct vnode *vp)
 {
struct mount *mp;
-   int active;
 
mp = vp->v_mount;
if (mp == NULL)
@@ -1680,9 +1679,8 @@ delmntque(struct vnode *vp)
KASSERT(mp->mnt_activevnodelistsize <= mp->mnt_nvnodelistsize,
("Active vnode list size %d > Vnode list size %d",
 mp->mnt_activevnodelistsize, mp->mnt_nvnodelistsize));
-   active = vp->v_iflag & VI_ACTIVE;
-   vp->v_iflag &= ~VI_ACTIVE;
-   if (active) {
+   if (vp->v_iflag & VI_ACTIVE) {
+   vp->v_iflag &= ~VI_ACTIVE;
mtx_lock(>mnt_listmtx);
TAILQ_REMOVE(>mnt_activevnodelist, vp, v_actfreelist);
mp->mnt_activevnodelistsize--;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r355482 - stable/12/sbin/dhclient

2019-12-07 Thread Harry Schmalzbauer

Am 07.12.2019 um 04:56 schrieb Ed Maste:

Author: emaste
Date: Sat Dec  7 03:56:36 2019
New Revision: 355482
URL: https://svnweb.freebsd.org/changeset/base/355482

Log:
   MFC r238022 (cem): dhclient: fix braino in previous bugfix r300174


PR vs. SVN typo, cem's commit was r355204.

Thanks,

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