svn commit: r352434 - in head/sys/mips: include mips

2019-09-16 Thread Jason A. Harmening
Author: jah
Date: Tue Sep 17 03:39:31 2019
New Revision: 352434
URL: https://svnweb.freebsd.org/changeset/base/352434

Log:
  mips: move support for temporary mappings above KSEG0 to per-CPU data
  
  This is derived from similar work done in r310481 for i386 and r312610 for
  armv6/armv7. Additionally, use a critical section to keep the thread
  pinned for per-CPU operations instead of completely disabling local 
interrupts.
  
  No objections from:   adrian, jmallett, imp
  Differential Revision:https://reviews.freebsd.org/D18593

Modified:
  head/sys/mips/include/pcpu.h
  head/sys/mips/mips/pmap.c

Modified: head/sys/mips/include/pcpu.h
==
--- head/sys/mips/include/pcpu.hTue Sep 17 02:53:59 2019
(r352433)
+++ head/sys/mips/include/pcpu.hTue Sep 17 03:39:31 2019
(r352434)
@@ -51,7 +51,13 @@
 #else
 #definePCPU_MD_MIPS32_FIELDS   
\
PCPU_MD_COMMON_FIELDS   \
-   char__pad[125]
+   pt_entry_t  *pc_cmap1_ptep; /* PTE for copy window 1 KVA */ 
\
+   pt_entry_t  *pc_cmap2_ptep; /* PTE for copy window 2 KVA */ 
\
+   vm_offset_t pc_cmap1_addr;  /* KVA page for copy window 1 
*/ \
+   vm_offset_t pc_cmap2_addr;  /* KVA page for copy window 2 
*/ \
+   vm_offset_t pc_qmap_addr;   /* KVA page for temporary 
mappings */ \
+   pt_entry_t  *pc_qmap_ptep;  /* PTE for temporary mapping 
KVA */ \
+   char__pad[101]
 #endif
 
 #ifdef __mips_n64

Modified: head/sys/mips/mips/pmap.c
==
--- head/sys/mips/mips/pmap.c   Tue Sep 17 02:53:59 2019(r352433)
+++ head/sys/mips/mips/pmap.c   Tue Sep 17 03:39:31 2019(r352434)
@@ -138,6 +138,8 @@ pd_entry_t *kernel_segmap;
 vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */
 vm_offset_t virtual_end;   /* VA of last avail page (end of kernel AS) */
 
+static int need_local_mappings;
+
 static int nkpt;
 unsigned pmap_max_asid;/* max ASID supported by the system */
 
@@ -187,104 +189,96 @@ static void pmap_invalidate_range_action(void *arg);
 static void pmap_update_page_action(void *arg);
 
 #ifndef __mips_n64
+
+static vm_offset_t crashdumpva;
+
 /*
- * This structure is for high memory (memory above 512Meg in 32 bit) support.
+ * These functions are for high memory (memory above 512Meg in 32 bit) support.
  * The highmem area does not have a KSEG0 mapping, and we need a mechanism to
  * do temporary per-CPU mappings for pmap_zero_page, pmap_copy_page etc.
  *
  * At bootup, we reserve 2 virtual pages per CPU for mapping highmem pages. To
  * access a highmem physical address on a CPU, we map the physical address to
- * the reserved virtual address for the CPU in the kernel pagetable.  This is
- * done with interrupts disabled(although a spinlock and sched_pin would be
- * sufficient).
+ * the reserved virtual address for the CPU in the kernel pagetable.
  */
-struct local_sysmaps {
-   vm_offset_t base;
-   uint32_tsaved_intr;
-   uint16_tvalid1, valid2;
-};
-static struct local_sysmaps sysmap_lmem[MAXCPU];
 
+static void
+pmap_init_reserved_pages(void)
+{
+   struct pcpu *pc;
+   vm_offset_t pages;
+   int i;
+ 
+   if (need_local_mappings == 0)
+   return;
+
+   CPU_FOREACH(i) {
+   pc = pcpu_find(i);
+   /*
+* Skip if the mapping has already been initialized,
+* i.e. this is the BSP.
+*/
+   if (pc->pc_cmap1_addr != 0)
+   continue;
+   pages =  kva_alloc(PAGE_SIZE * 3);
+   if (pages == 0)
+   panic("%s: unable to allocate KVA", __func__);
+   pc->pc_cmap1_ptep = pmap_pte(kernel_pmap, pages);
+   pc->pc_cmap2_ptep = pmap_pte(kernel_pmap, pages + PAGE_SIZE);
+   pc->pc_qmap_ptep =
+   pmap_pte(kernel_pmap, pages + (PAGE_SIZE * 2));
+   pc->pc_cmap1_addr = pages;
+   pc->pc_cmap2_addr = pages + PAGE_SIZE;
+   pc->pc_qmap_addr = pages + (PAGE_SIZE * 2);
+   }
+}
+SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages, NULL);
+
 static __inline void
 pmap_alloc_lmem_map(void)
 {
-   int i;
-
-   for (i = 0; i < MAXCPU; i++) {
-   sysmap_lmem[i].base = virtual_avail;
-   virtual_avail += PAGE_SIZE * 2;
-   sysmap_lmem[i].valid1 = sysmap_lmem[i].valid2 = 0;
-   }
+   PCPU_SET(cmap1_addr, virtual_avail);
+   PCPU_SET(cmap2_addr, virtual_avail + PAGE_SIZE);
+   PCPU_SET(cmap1_ptep, pmap_pte(kernel_pmap, virtual_avail));
+   

svn commit: r352433 - head/sys/vm

2019-09-16 Thread Doug Moore
Author: dougm
Date: Tue Sep 17 02:53:59 2019
New Revision: 352433
URL: https://svnweb.freebsd.org/changeset/base/352433

Log:
  Remove dead code from vm_map_unlink_entry made dead by r351476, and also
  a no-longer-used enumerant.
  
  Reviewed by: alc
  Approved by: markj (mentor, implicit)
  Tested by: pho (as part of a larger change)
  Differential Revision: https://reviews.freebsd.org/D21668

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cTue Sep 17 00:22:20 2019(r352432)
+++ head/sys/vm/vm_map.cTue Sep 17 02:53:59 2019(r352433)
@@ -1250,7 +1250,6 @@ vm_map_entry_link(vm_map_t map, vm_map_entry_t entry)
 }
 
 enum unlink_merge_type {
-   UNLINK_MERGE_PREV,
UNLINK_MERGE_NONE,
UNLINK_MERGE_NEXT
 };
@@ -1266,17 +1265,9 @@ vm_map_entry_unlink(vm_map_t map, vm_map_entry_t entry
KASSERT(root != NULL,
("vm_map_entry_unlink: unlink object not mapped"));
 
+   vm_map_splay_findnext(root, );
switch (op) {
-   case UNLINK_MERGE_PREV:
-   vm_map_splay_findprev(root, );
-   llist->end = root->end;
-   y = root->right;
-   root = llist;
-   llist = root->right;
-   root->right = y;
-   break;
case UNLINK_MERGE_NEXT:
-   vm_map_splay_findnext(root, );
rlist->start = root->start;
rlist->offset = root->offset;
y = root->left;
@@ -1286,7 +1277,6 @@ vm_map_entry_unlink(vm_map_t map, vm_map_entry_t entry
break;
case UNLINK_MERGE_NONE:
vm_map_splay_findprev(root, );
-   vm_map_splay_findnext(root, );
if (llist != >header) {
root = llist;
llist = root->right;
___
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: Re; svn commit: r352393 - head/sys/fs/nfsclient

2019-09-16 Thread Rick Macklem
Konstantin Belousov wrote:
>On Mon, Sep 16, 2019 at 03:27:02PM +, Rick Macklem wrote:
>> Hi Kostik,
>>
>> I'm afraid there was a reason that only certain cases (where the file was
>> being shrunk) did the vnode_pager_setsize() call after the NFS node
>> lock is released.
>>
>> See the commit log message for r252528.
>>
>> If vnode_pager_setsize() now acquires a sleep lock for the case where the
>> size is increasing, it sounds like the NFS node lock will have to become a
>> sleep lock instead of a mutex.
>> (If needed, I can get working on this in a day or two.)
>I suspect that the reason for the bug mentioned in r252528 is the fact
>that NFS calls vnode_pager_setsize() without owning the vnode lock.  AFAIR
>this happens when iod thread performs RPCs.  If you look at the start of
>the vnode_pager_setsize() function, you would note a commented out assert
>that the vnode is exclusively locked.
>
>Indeed, changing node lock to sleepable lock is a lot of work.  But may
>be we should get rid of this mutex at all ?  If you state that we should
>change it to some sleepable lock, then vnode lock should already serve
>the purpose.
>
>The only issue I see is that we would need to add missed vnode locks
>acquires in iod, and upgrade vnode lock shared to exclusive as needed.
>An ugly intermediate solution might be to make NFS vnode locks always
>exclusive.
Well, the reason that the readahead/writebehind RPCs done by the iod threads
haven't acquired the vnode lock was to allow them to occur concurrently.
--> Now that there are LK_SHARED vnode locks, those could be used for
  the readaheads.
--> For writebehinds, which is where the file's size changes, holding an
  exclusive vnode lock for the entire RPC would serialize them and that
  could be a large performance hit.
  --> However, holding an exclusive vnode lock for short periods (but not
 while the RPC is being done on the server) should be ok.
The NFS node mutex may still be needed to serialize use of fields
in the NFS part of the vnode, but if the exclusive vnode lock can be
held for the code section in question and the other places where
the n_size field is used (instead of depending on the NFS node 
mutex),
that should work, I think.
--> I'll take a look at the code tomorrow.

rick
___
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: r352432 - head/share/misc

2019-09-16 Thread Dmitri Goutnik
Author: dmgk (ports committer)
Date: Tue Sep 17 00:22:20 2019
New Revision: 352432
URL: https://svnweb.freebsd.org/changeset/base/352432

Log:
  Amend r352422, add missing 'n'
  
  Reported by:  yuripv
  Approved by:  araujo (mentor)
  Differential Revision:https://reviews.freebsd.org/D21679

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

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotMon Sep 16 22:48:40 2019
(r352431)
+++ head/share/misc/committers-ports.dotTue Sep 17 00:22:20 2019
(r352432)
@@ -96,7 +96,7 @@ decke [label="Bernhard Froehlich\nde...@freebsd.org\n2
 delphij [label="Xin Li\ndelp...@freebsd.org\n2006/05/01"]
 demon [label="Dmitry Sivachenko\nde...@freebsd.org\n2000/11/13"]
 dhn [label="Dennis Herrmann\n...@freebsd.org\n2009/03/03"]
-dmgk [label="Dmitri Goutnik\d...@freebsd.org\n2019/09/15"]
+dmgk [label="Dmitri Goutnik\nd...@freebsd.org\n2019/09/15"]
 dryice [label="Dryice Dong Liu\ndry...@freebsd.org\n2006/12/25"]
 dteske [label="Devin Teske\ndte...@freebsd.org\n2018/03/01"]
 dumbbell [label="Jean-Sebastien Pedron\ndumbb...@freebsd.org\n2017/01/10"]
___
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: r352431 - head/libexec/rc/rc.d

2019-09-16 Thread John-Mark Gurney
Author: jmg
Date: Mon Sep 16 22:48:40 2019
New Revision: 352431
URL: https://svnweb.freebsd.org/changeset/base/352431

Log:
  fix the article to be correct...

Modified:
  head/libexec/rc/rc.d/growfs

Modified: head/libexec/rc/rc.d/growfs
==
--- head/libexec/rc/rc.d/growfs Mon Sep 16 22:17:16 2019(r352430)
+++ head/libexec/rc/rc.d/growfs Mon Sep 16 22:48:40 2019(r352431)
@@ -31,7 +31,7 @@
 # BEFORE: sysctl
 # KEYWORD: firstboot
 
-# This allows us to distribute a image
+# This allows us to distribute an image
 # and have it work on essentially any size drive.
 #
 # TODO: Figure out where this should really be ordered.
___
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: r352430 - in head/sys/riscv: conf riscv

2019-09-16 Thread Mitchell Horne
Author: mhorne
Date: Mon Sep 16 22:17:16 2019
New Revision: 352430
URL: https://svnweb.freebsd.org/changeset/base/352430

Log:
  RISC-V: Support EARLY_AP_STARTUP
  
  The EARLY_AP_STARTUP option initializes non-boot processors
  much sooner during startup. This adds support for this option
  on RISC-V and enables it by default for GENERIC.
  
  Reviewed by:  jhb, markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21661

Modified:
  head/sys/riscv/conf/GENERIC
  head/sys/riscv/riscv/clock.c
  head/sys/riscv/riscv/mp_machdep.c

Modified: head/sys/riscv/conf/GENERIC
==
--- head/sys/riscv/conf/GENERIC Mon Sep 16 22:02:14 2019(r352429)
+++ head/sys/riscv/conf/GENERIC Mon Sep 16 22:17:16 2019(r352430)
@@ -71,6 +71,7 @@ options   RACCT   # Resource accounting 
framework
 optionsRACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default
 optionsRCTL# Resource limits
 optionsSMP
+optionsEARLY_AP_STARTUP
 optionsINTRNG
 
 # RISC-V SBI console

Modified: head/sys/riscv/riscv/clock.c
==
--- head/sys/riscv/riscv/clock.cMon Sep 16 22:02:14 2019
(r352429)
+++ head/sys/riscv/riscv/clock.cMon Sep 16 22:17:16 2019
(r352430)
@@ -37,10 +37,34 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 void
 cpu_initclocks(void)
 {
+#ifdef EARLY_AP_STARTUP
+   struct thread *td;
+   int i;
 
+   td = curthread;
cpu_initclocks_bsp();
+   CPU_FOREACH(i) {
+   if (i == 0)
+   continue;
+   thread_lock(td);
+   sched_bind(td, i);
+   thread_unlock(td);
+   cpu_initclocks_ap();
+   }
+   thread_lock(td);
+   if (sched_is_bound(td))
+   sched_unbind(td);
+   thread_unlock(td);
+#else
+   cpu_initclocks_bsp();
+#endif
 }

Modified: head/sys/riscv/riscv/mp_machdep.c
==
--- head/sys/riscv/riscv/mp_machdep.c   Mon Sep 16 22:02:14 2019
(r352429)
+++ head/sys/riscv/riscv/mp_machdep.c   Mon Sep 16 22:17:16 2019
(r352430)
@@ -257,8 +257,10 @@ init_secondary(uint64_t hart)
/* Enable software interrupts */
riscv_unmask_ipi();
 
+#ifndef EARLY_AP_STARTUP
/* Start per-CPU event timers. */
cpu_initclocks_ap();
+#endif
 
/* Enable external (PLIC) interrupts */
csr_set(sie, SIE_SEIE);
___
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: r352429 - stable/11/lib/libc/sys

2019-09-16 Thread Mitchell Horne
Author: mhorne
Date: Mon Sep 16 22:02:14 2019
New Revision: 352429
URL: https://svnweb.freebsd.org/changeset/base/352429

Log:
  MFC r352048:
  
  Fix cpuwhich_t column width

Modified:
  stable/11/lib/libc/sys/cpuset.2
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/sys/cpuset.2
==
--- stable/11/lib/libc/sys/cpuset.2 Mon Sep 16 22:00:29 2019
(r352428)
+++ stable/11/lib/libc/sys/cpuset.2 Mon Sep 16 22:02:14 2019
(r352429)
@@ -95,7 +95,7 @@ is interpreted and is of type
 The
 .Fa which
 argument may have the following values:
-.Bl -column CPU_WHICH_CPUSET -offset indent
+.Bl -column CPU_WHICH_INTRHANDLER -offset indent
 .It Dv CPU_WHICH_TID Ta "id is lwpid_t (thread id)"
 .It Dv CPU_WHICH_PID Ta "id is pid_t (process id)"
 .It Dv CPU_WHICH_JAIL Ta "id is jid (jail id)"
___
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: r352428 - stable/12/lib/libc/sys

2019-09-16 Thread Mitchell Horne
Author: mhorne
Date: Mon Sep 16 22:00:29 2019
New Revision: 352428
URL: https://svnweb.freebsd.org/changeset/base/352428

Log:
  MFC r352048:
  
  Fix cpuwhich_t column width

Modified:
  stable/12/lib/libc/sys/cpuset.2
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/sys/cpuset.2
==
--- stable/12/lib/libc/sys/cpuset.2 Mon Sep 16 21:37:47 2019
(r352427)
+++ stable/12/lib/libc/sys/cpuset.2 Mon Sep 16 22:00:29 2019
(r352428)
@@ -96,7 +96,7 @@ is interpreted and is of type
 The
 .Fa which
 argument may have the following values:
-.Bl -column CPU_WHICH_CPUSET -offset indent
+.Bl -column CPU_WHICH_INTRHANDLER -offset indent
 .It Dv CPU_WHICH_TID Ta "id is lwpid_t (thread id)"
 .It Dv CPU_WHICH_PID Ta "id is pid_t (process id)"
 .It Dv CPU_WHICH_JAIL Ta "id is jid (jail id)"
___
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: r352427 - in head/sys: fs/tmpfs kern sys ufs/ffs

2019-09-16 Thread Mateusz Guzik
Author: mjg
Date: Mon Sep 16 21:37:47 2019
New Revision: 352427
URL: https://svnweb.freebsd.org/changeset/base/352427

Log:
  vfs: convert struct mount counters to per-cpu
  
  There are 3 counters modified all the time in this structure - one for
  keeping the structure alive, one for preventing unmount and one for
  tracking active writers. Exact values of these counters are very rarely
  needed, which makes them a prime candidate for conversion to a per-cpu
  scheme, resulting in much better performance.
  
  Sample benchmark performing fstatfs (modifying 2 out of 3 counters) on
  a 104-way 2 socket Skylake system:
  before:   852393 ops/s
  after:  76682077 ops/s
  
  Reviewed by:  kib, jeff
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21637

Modified:
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/kern/vfs_default.c
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vfs_vnops.c
  head/sys/sys/mount.h
  head/sys/sys/pcpu.h
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==
--- head/sys/fs/tmpfs/tmpfs_subr.c  Mon Sep 16 21:33:16 2019
(r352426)
+++ head/sys/fs/tmpfs/tmpfs_subr.c  Mon Sep 16 21:37:47 2019
(r352427)
@@ -190,8 +190,6 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount 
/* If the root directory of the 'tmp' file system is not yet
 * allocated, this must be the request to do it. */
MPASS(IMPLIES(tmp->tm_root == NULL, parent == NULL && type == VDIR));
-   KASSERT(tmp->tm_root == NULL || mp->mnt_writeopcount > 0,
-   ("creating node not under vn_start_write"));
 
MPASS(IFF(type == VLNK, target != NULL));
MPASS(IFF(type == VBLK || type == VCHR, rdev != VNOVAL));

Modified: head/sys/kern/vfs_default.c
==
--- head/sys/kern/vfs_default.c Mon Sep 16 21:33:16 2019(r352426)
+++ head/sys/kern/vfs_default.c Mon Sep 16 21:37:47 2019(r352427)
@@ -607,7 +607,7 @@ vop_stdgetwritemount(ap)
}
if (vfs_op_thread_enter(mp)) {
if (mp == vp->v_mount)
-   MNT_REF_UNLOCKED(mp);
+   vfs_mp_count_add_pcpu(mp, ref, 1);
else
mp = NULL;
vfs_op_thread_exit(mp);

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Mon Sep 16 21:33:16 2019(r352426)
+++ head/sys/kern/vfs_mount.c   Mon Sep 16 21:37:47 2019(r352427)
@@ -126,6 +126,12 @@ mount_init(void *mem, int size, int flags)
lockinit(>mnt_explock, PVFS, "explock", 0, 0);
mp->mnt_thread_in_ops_pcpu = uma_zalloc_pcpu(pcpu_zone_int,
M_WAITOK | M_ZERO);
+   mp->mnt_ref_pcpu = uma_zalloc_pcpu(pcpu_zone_int,
+   M_WAITOK | M_ZERO);
+   mp->mnt_lockref_pcpu = uma_zalloc_pcpu(pcpu_zone_int,
+   M_WAITOK | M_ZERO);
+   mp->mnt_writeopcount_pcpu = uma_zalloc_pcpu(pcpu_zone_int,
+   M_WAITOK | M_ZERO);
mp->mnt_ref = 0;
mp->mnt_vfs_ops = 1;
return (0);
@@ -137,6 +143,9 @@ mount_fini(void *mem, int size)
struct mount *mp;
 
mp = (struct mount *)mem;
+   uma_zfree_pcpu(pcpu_zone_int, mp->mnt_writeopcount_pcpu);
+   uma_zfree_pcpu(pcpu_zone_int, mp->mnt_lockref_pcpu);
+   uma_zfree_pcpu(pcpu_zone_int, mp->mnt_ref_pcpu);
uma_zfree_pcpu(pcpu_zone_int, mp->mnt_thread_in_ops_pcpu);
lockdestroy(>mnt_explock);
mtx_destroy(>mnt_listmtx);
@@ -452,7 +461,7 @@ vfs_ref(struct mount *mp)
 
CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
if (vfs_op_thread_enter(mp)) {
-   MNT_REF_UNLOCKED(mp);
+   vfs_mp_count_add_pcpu(mp, ref, 1);
vfs_op_thread_exit(mp);
return;
}
@@ -468,7 +477,7 @@ vfs_rel(struct mount *mp)
 
CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
if (vfs_op_thread_enter(mp)) {
-   MNT_REL_UNLOCKED(mp);
+   vfs_mp_count_sub_pcpu(mp, ref, 1);
vfs_op_thread_exit(mp);
return;
}
@@ -533,6 +542,8 @@ vfs_mount_destroy(struct mount *mp)
if (mp->mnt_vfs_ops == 0)
panic("%s: entered with zero vfs_ops\n", __func__);
 
+   vfs_assert_mount_counters(mp);
+
MNT_ILOCK(mp);
mp->mnt_kern_flag |= MNTK_REFEXPIRE;
if (mp->mnt_kern_flag & MNTK_MWAIT) {
@@ -1382,6 +1393,7 @@ dounmount_cleanup(struct mount *mp, struct vnode *cove
 void
 vfs_op_enter(struct mount *mp)
 {
+   int cpu;
 
MNT_ILOCK(mp);
mp->mnt_vfs_ops++;
@@ -1395,7 +1407,20 @@ vfs_op_enter(struct mount *mp)
 */
atomic_thread_fence_seq_cst();
vfs_op_barrier_wait(mp);
+   

svn commit: r352426 - in head/sys: kern ufs/ffs

2019-09-16 Thread Mateusz Guzik
Author: mjg
Date: Mon Sep 16 21:33:16 2019
New Revision: 352426
URL: https://svnweb.freebsd.org/changeset/base/352426

Log:
  vfs: manage mnt_writeopcount with atomics
  
  See r352424.
  
  Reviewed by:  kib, jeff
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21575

Modified:
  head/sys/kern/vfs_vnops.c
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Mon Sep 16 21:32:21 2019(r352425)
+++ head/sys/kern/vfs_vnops.c   Mon Sep 16 21:33:16 2019(r352426)
@@ -1621,11 +1621,23 @@ vn_suspendable(struct mount *mp)
  * suspension is over, and then proceed.
  */
 static int
-vn_start_write_locked(struct mount *mp, int flags)
+vn_start_write_refed(struct mount *mp, int flags, bool mplocked)
 {
int error, mflags;
 
-   mtx_assert(MNT_MTX(mp), MA_OWNED);
+   if (__predict_true(!mplocked) && (flags & V_XSLEEP) == 0 &&
+   vfs_op_thread_enter(mp)) {
+   MPASS((mp->mnt_kern_flag & MNTK_SUSPEND) == 0);
+   atomic_add_int(>mnt_writeopcount, 1);
+   vfs_op_thread_exit(mp);
+   return (0);
+   }
+
+   if (mplocked)
+   mtx_assert(MNT_MTX(mp), MA_OWNED);
+   else
+   MNT_ILOCK(mp);
+
error = 0;
 
/*
@@ -1648,7 +1660,7 @@ vn_start_write_locked(struct mount *mp, int flags)
}
if (flags & V_XSLEEP)
goto unlock;
-   mp->mnt_writeopcount++;
+   atomic_add_int(>mnt_writeopcount, 1);
 unlock:
if (error != 0 || (flags & V_XSLEEP) != 0)
MNT_REL(mp);
@@ -1694,11 +1706,10 @@ vn_start_write(struct vnode *vp, struct mount **mpp, i
 * refcount for the provided mountpoint too, in order to
 * emulate a vfs_ref().
 */
-   MNT_ILOCK(mp);
if (vp == NULL && (flags & V_MNTREF) == 0)
-   MNT_REF(mp);
+   vfs_ref(mp);
 
-   return (vn_start_write_locked(mp, flags));
+   return (vn_start_write_refed(mp, flags, false));
 }
 
 /*
@@ -1780,15 +1791,26 @@ vn_start_secondary_write(struct vnode *vp, struct moun
 void
 vn_finished_write(struct mount *mp)
 {
+   int c;
+
if (mp == NULL || !vn_suspendable(mp))
return;
+
+   if (vfs_op_thread_enter(mp)) {
+   c = atomic_fetchadd_int(>mnt_writeopcount, -1) - 1;
+   if (c < 0)
+   panic("vn_finished_write: invalid writeopcount %d", c);
+   MNT_REL_UNLOCKED(mp);
+   vfs_op_thread_exit(mp);
+   return;
+   }
+
MNT_ILOCK(mp);
MNT_REL(mp);
-   mp->mnt_writeopcount--;
-   if (mp->mnt_writeopcount < 0)
-   panic("vn_finished_write: neg cnt");
-   if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0 &&
-   mp->mnt_writeopcount <= 0)
+   c = atomic_fetchadd_int(>mnt_writeopcount, -1) - 1;
+   if (c < 0)
+   panic("vn_finished_write: invalid writeopcount %d", c);
+   if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0 && c == 0)
wakeup(>mnt_writeopcount);
MNT_IUNLOCK(mp);
 }
@@ -1827,8 +1849,11 @@ vfs_write_suspend(struct mount *mp, int flags)
 
MPASS(vn_suspendable(mp));
 
+   vfs_op_enter(mp);
+
MNT_ILOCK(mp);
if (mp->mnt_susp_owner == curthread) {
+   vfs_op_exit_locked(mp);
MNT_IUNLOCK(mp);
return (EALREADY);
}
@@ -1845,6 +1870,7 @@ vfs_write_suspend(struct mount *mp, int flags)
 */
if ((flags & VS_SKIP_UNMOUNT) != 0 &&
(mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) {
+   vfs_op_exit_locked(mp);
MNT_IUNLOCK(mp);
return (EBUSY);
}
@@ -1856,8 +1882,10 @@ vfs_write_suspend(struct mount *mp, int flags)
MNT_MTX(mp), (PUSER - 1)|PDROP, "suspwt", 0);
else
MNT_IUNLOCK(mp);
-   if ((error = VFS_SYNC(mp, MNT_SUSPEND)) != 0)
+   if ((error = VFS_SYNC(mp, MNT_SUSPEND)) != 0) {
vfs_write_resume(mp, 0);
+   vfs_op_exit(mp);
+   }
return (error);
 }
 
@@ -1881,14 +1909,15 @@ vfs_write_resume(struct mount *mp, int flags)
curthread->td_pflags &= ~TDP_IGNSUSP;
if ((flags & VR_START_WRITE) != 0) {
MNT_REF(mp);
-   mp->mnt_writeopcount++;
+   atomic_add_int(>mnt_writeopcount, 1);
}
MNT_IUNLOCK(mp);
if ((flags & VR_NO_SUSPCLR) == 0)
VFS_SUSP_CLEAN(mp);
+   vfs_op_exit(mp);
} else if ((flags & VR_START_WRITE) != 0) {
MNT_REF(mp);
-   vn_start_write_locked(mp, 0);
+   vn_start_write_refed(mp, 0, true);
} 

svn commit: r352425 - head/sys/kern

2019-09-16 Thread Mateusz Guzik
Author: mjg
Date: Mon Sep 16 21:32:21 2019
New Revision: 352425
URL: https://svnweb.freebsd.org/changeset/base/352425

Log:
  vfs: manage mnt_lockref with atomics
  
  See r352424.
  
  Reviewed by:  kib, jeff
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21574

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cMon Sep 16 21:31:02 2019(r352424)
+++ head/sys/kern/vfs_subr.cMon Sep 16 21:32:21 2019(r352425)
@@ -641,6 +641,18 @@ vfs_busy(struct mount *mp, int flags)
MPASS((flags & ~MBF_MASK) == 0);
CTR3(KTR_VFS, "%s: mp %p with flags %d", __func__, mp, flags);
 
+   if (vfs_op_thread_enter(mp)) {
+   MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0);
+   MPASS((mp->mnt_kern_flag & MNTK_UNMOUNT) == 0);
+   MPASS((mp->mnt_kern_flag & MNTK_REFEXPIRE) == 0);
+   MNT_REF_UNLOCKED(mp);
+   atomic_add_int(>mnt_lockref, 1);
+   vfs_op_thread_exit(mp);
+   if (flags & MBF_MNTLSTLOCK)
+   mtx_unlock(_mtx);
+   return (0);
+   }
+
MNT_ILOCK(mp);
MNT_REF(mp);
/*
@@ -673,7 +685,7 @@ vfs_busy(struct mount *mp, int flags)
}
if (flags & MBF_MNTLSTLOCK)
mtx_unlock(_mtx);
-   mp->mnt_lockref++;
+   atomic_add_int(>mnt_lockref, 1);
MNT_IUNLOCK(mp);
return (0);
 }
@@ -684,13 +696,24 @@ vfs_busy(struct mount *mp, int flags)
 void
 vfs_unbusy(struct mount *mp)
 {
+   int c;
 
CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
+
+   if (vfs_op_thread_enter(mp)) {
+   MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0);
+   c = atomic_fetchadd_int(>mnt_lockref, -1) - 1;
+   KASSERT(c >= 0, ("%s: negative mnt_lockref %d\n", __func__, c));
+   MNT_REL_UNLOCKED(mp);
+   vfs_op_thread_exit(mp);
+   return;
+   }
+
MNT_ILOCK(mp);
MNT_REL(mp);
-   KASSERT(mp->mnt_lockref > 0, ("negative mnt_lockref"));
-   mp->mnt_lockref--;
-   if (mp->mnt_lockref == 0 && (mp->mnt_kern_flag & MNTK_DRAINING) != 0) {
+   c = atomic_fetchadd_int(>mnt_lockref, -1) - 1;
+   KASSERT(c >= 0, ("%s: negative mnt_lockref %d\n", __func__, c));
+   if (c == 0 && (mp->mnt_kern_flag & MNTK_DRAINING) != 0) {
MPASS(mp->mnt_kern_flag & MNTK_UNMOUNT);
CTR1(KTR_VFS, "%s: waking up waiters", __func__);
mp->mnt_kern_flag &= ~MNTK_DRAINING;
___
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: r352424 - in head/sys: cddl/compat/opensolaris/kern kern sys vm

2019-09-16 Thread Mateusz Guzik
Author: mjg
Date: Mon Sep 16 21:31:02 2019
New Revision: 352424
URL: https://svnweb.freebsd.org/changeset/base/352424

Log:
  vfs: manage mnt_ref with atomics
  
  New primitive is introduced to denote sections can operate locklessly
  on aspects of struct mount, but which can also be disabled if necessary.
  This provides an opportunity to start scaling common case modifications
  while providing stable state of the struct when facing unmount, write
  suspendion or other events.
  
  mnt_ref is the first counter to start being managed in this manner with
  the intent to make it per-cpu.
  
  Reviewed by:  kib, jeff
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21425

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
  head/sys/kern/subr_pcpu.c
  head/sys/kern/vfs_default.c
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_mountroot.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/mount.h
  head/sys/vm/uma.h

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Sep 16 
20:43:20 2019(r352423)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Sep 16 
21:31:02 2019(r352424)
@@ -242,6 +242,7 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const cha
if (VFS_ROOT(mp, LK_EXCLUSIVE, ))
panic("mount: lost mount");
VOP_UNLOCK(vp, 0);
+   vfs_op_exit(mp);
vfs_unbusy(mp);
*vpp = mvp;
return (0);

Modified: head/sys/kern/subr_pcpu.c
==
--- head/sys/kern/subr_pcpu.c   Mon Sep 16 20:43:20 2019(r352423)
+++ head/sys/kern/subr_pcpu.c   Mon Sep 16 21:31:02 2019(r352424)
@@ -131,15 +131,19 @@ SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_start
 
 /*
  * UMA_PCPU_ZONE zones, that are available for all kernel
- * consumers. Right now 64 bit zone is used for counter(9).
+ * consumers. Right now 64 bit zone is used for counter(9)
+ * and int zone is used for mount point counters.
  */
 
+uma_zone_t pcpu_zone_int;
 uma_zone_t pcpu_zone_64;
 
 static void
 pcpu_zones_startup(void)
 {
 
+   pcpu_zone_int = uma_zcreate("int pcpu", sizeof(int),
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
pcpu_zone_64 = uma_zcreate("64 pcpu", sizeof(uint64_t),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
 }

Modified: head/sys/kern/vfs_default.c
==
--- head/sys/kern/vfs_default.c Mon Sep 16 20:43:20 2019(r352423)
+++ head/sys/kern/vfs_default.c Mon Sep 16 21:31:02 2019(r352424)
@@ -601,17 +601,24 @@ vop_stdgetwritemount(ap)
 */
vp = ap->a_vp;
mp = vp->v_mount;
-   if (mp == NULL)
-   goto out;
-   MNT_ILOCK(mp);
-   if (mp != vp->v_mount) {
+   if (mp == NULL) {
+   *(ap->a_mpp) = NULL;
+   return (0);
+   }
+   if (vfs_op_thread_enter(mp)) {
+   if (mp == vp->v_mount)
+   MNT_REF_UNLOCKED(mp);
+   else
+   mp = NULL;
+   vfs_op_thread_exit(mp);
+   } else {
+   MNT_ILOCK(mp);
+   if (mp == vp->v_mount)
+   MNT_REF(mp);
+   else
+   mp = NULL;
MNT_IUNLOCK(mp);
-   mp = NULL;
-   goto out;
}
-   MNT_REF(mp);
-   MNT_IUNLOCK(mp);
-out:
*(ap->a_mpp) = mp;
return (0);
 }

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Mon Sep 16 20:43:20 2019(r352423)
+++ head/sys/kern/vfs_mount.c   Mon Sep 16 21:31:02 2019(r352424)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -123,6 +124,10 @@ mount_init(void *mem, int size, int flags)
mtx_init(>mnt_mtx, "struct mount mtx", NULL, MTX_DEF);
mtx_init(>mnt_listmtx, "struct mount vlist mtx", NULL, MTX_DEF);
lockinit(>mnt_explock, PVFS, "explock", 0, 0);
+   mp->mnt_thread_in_ops_pcpu = uma_zalloc_pcpu(pcpu_zone_int,
+   M_WAITOK | M_ZERO);
+   mp->mnt_ref = 0;
+   mp->mnt_vfs_ops = 1;
return (0);
 }
 
@@ -132,6 +137,7 @@ mount_fini(void *mem, int size)
struct mount *mp;
 
mp = (struct mount *)mem;
+   uma_zfree_pcpu(pcpu_zone_int, mp->mnt_thread_in_ops_pcpu);
lockdestroy(>mnt_explock);
mtx_destroy(>mnt_listmtx);
mtx_destroy(>mnt_mtx);
@@ -445,6 +451,12 @@ vfs_ref(struct mount *mp)
 {
 
CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
+   if (vfs_op_thread_enter(mp)) {
+   

svn commit: r352423 - head/usr.bin/calendar/calendars

2019-09-16 Thread Dmitri Goutnik
Author: dmgk (ports committer)
Date: Mon Sep 16 20:43:20 2019
New Revision: 352423
URL: https://svnweb.freebsd.org/changeset/base/352423

Log:
  Add myself (dmgk) to calendar.freebsd
  
  Approved by:  tz (mentor)
  Differential Revision:https://reviews.freebsd.org/D21675

Modified:
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdMon Sep 16 20:41:37 
2019(r352422)
+++ head/usr.bin/calendar/calendars/calendar.freebsdMon Sep 16 20:43:20 
2019(r352423)
@@ -446,6 +446,7 @@
 11/28  Nik Clayton  born in Peterborough, United Kingdom, 
1973
 11/28  Stanislav Sedov  born in Chelyabinsk, USSR, 1985
 11/29  Doug Moore  born in Arlington, Texas, United States, 
1960
+11/30  Dmitri Goutnik  born in Minsk, USSR, 1969
 12/01  Hajimu Umemoto  born in Nara, Japan, 1961
 12/01  Alexey Dokuchaev  born in Magadan, USSR, 1980
 12/02  Ermal Luçi  born in Tirane, Albania, 1980
___
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: r352422 - head/share/misc

2019-09-16 Thread Dmitri Goutnik
Author: dmgk (ports committer)
Date: Mon Sep 16 20:41:37 2019
New Revision: 352422
URL: https://svnweb.freebsd.org/changeset/base/352422

Log:
  Add myself (dmgk) as a ports committer
  
  Approved by:  tz (mentor)
  Differential Revision:https://reviews.freebsd.org/D21672

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

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotMon Sep 16 20:28:08 2019
(r352421)
+++ head/share/misc/committers-ports.dotMon Sep 16 20:41:37 2019
(r352422)
@@ -96,6 +96,7 @@ decke [label="Bernhard Froehlich\nde...@freebsd.org\n2
 delphij [label="Xin Li\ndelp...@freebsd.org\n2006/05/01"]
 demon [label="Dmitry Sivachenko\nde...@freebsd.org\n2000/11/13"]
 dhn [label="Dennis Herrmann\n...@freebsd.org\n2009/03/03"]
+dmgk [label="Dmitri Goutnik\d...@freebsd.org\n2019/09/15"]
 dryice [label="Dryice Dong Liu\ndry...@freebsd.org\n2006/12/25"]
 dteske [label="Devin Teske\ndte...@freebsd.org\n2018/03/01"]
 dumbbell [label="Jean-Sebastien Pedron\ndumbb...@freebsd.org\n2017/01/10"]
@@ -304,6 +305,7 @@ amdmi3 -> arrowd
 
 antoine -> dumbbell
 
+araujo -> dmgk
 araujo -> egypcio
 araujo -> jhixson
 araujo -> lippe
@@ -736,6 +738,7 @@ timur -> kbowling
 tmclaugh -> itetcu
 tmclaugh -> xride
 
+tz -> dmgk
 tz -> joneum
 tz -> fernape
 tz -> mfechner
___
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: r352421 - head/stand/libsa

2019-09-16 Thread Toomas Soome
Author: tsoome
Date: Mon Sep 16 20:28:08 2019
New Revision: 352421
URL: https://svnweb.freebsd.org/changeset/base/352421

Log:
  loader: Malloc(0) should return NULL.
  
  We really should not allocate anything with size 0.

Modified:
  head/stand/libsa/zalloc_malloc.c

Modified: head/stand/libsa/zalloc_malloc.c
==
--- head/stand/libsa/zalloc_malloc.cMon Sep 16 20:26:53 2019
(r352420)
+++ head/stand/libsa/zalloc_malloc.cMon Sep 16 20:28:08 2019
(r352421)
@@ -55,6 +55,9 @@ Malloc(size_t bytes, const char *file, int line)
 {
 Guard *res;
 
+if (bytes == 0)
+   return (NULL);
+
 #ifdef USEENDGUARD
 bytes += MALLOCALIGN + 1;
 #else
___
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: r352420 - head/stand/forth

2019-09-16 Thread Toomas Soome
Author: tsoome
Date: Mon Sep 16 20:26:53 2019
New Revision: 352420
URL: https://svnweb.freebsd.org/changeset/base/352420

Log:
  loader_4th: scan_buffer can leave empty string on stack
  
  When the file processing is done, we will have string with lenght 0 in stack 
and we will attempt to
  allocate 0 bytes.

Modified:
  head/stand/forth/support.4th

Modified: head/stand/forth/support.4th
==
--- head/stand/forth/support.4thMon Sep 16 18:40:27 2019
(r352419)
+++ head/stand/forth/support.4thMon Sep 16 20:26:53 2019
(r352420)
@@ -363,6 +363,7 @@ variable fd
 ;
 
 : line_buffer_resize  ( len -- len )
+  dup 0= if exit then
   >r
   line_buffer .len @ if
 line_buffer .addr @
@@ -376,6 +377,7 @@ variable fd
 ;
 
 : append_to_line_buffer  ( addr len -- )
+  dup 0= if 2drop exit then
   line_buffer strget
   2swap strcat
   line_buffer .len !
___
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: r352419 - stable/12/sys/fs/fuse

2019-09-16 Thread Mark Johnston
Author: markj
Date: Mon Sep 16 18:40:27 2019
New Revision: 352419
URL: https://svnweb.freebsd.org/changeset/base/352419

Log:
  MFC r351613:
  Remove unused VM page locking macros.
  
  This completes the merge of the revision.  r352043 updated only the merge
  info for some reason.
  
  Reported by:  alc

Modified:
  stable/12/sys/fs/fuse/fuse_vnops.c

Modified: stable/12/sys/fs/fuse/fuse_vnops.c
==
--- stable/12/sys/fs/fuse/fuse_vnops.c  Mon Sep 16 18:23:01 2019
(r352418)
+++ stable/12/sys/fs/fuse/fuse_vnops.c  Mon Sep 16 18:40:27 2019
(r352419)
@@ -226,11 +226,6 @@ struct vop_vector fuse_vnops = {
 
 intfuse_pbuf_freecnt = -1;
 
-#define fuse_vm_page_lock(m)   vm_page_lock((m));
-#define fuse_vm_page_unlock(m) vm_page_unlock((m));
-#define fuse_vm_page_lock_queues() ((void)0)
-#define fuse_vm_page_unlock_queues()   ((void)0)
-
 /* Check permission for extattr operations, much like extattr_check_cred */
 static int
 fuse_extattr_check_cred(struct vnode *vp, int ns, struct ucred *cred,
___
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: r352418 - stable/12/sys/compat/linuxkpi/common/include/linux

2019-09-16 Thread Johannes Lundberg
Author: johalun
Date: Mon Sep 16 18:23:01 2019
New Revision: 352418
URL: https://svnweb.freebsd.org/changeset/base/352418

Log:
  LinuxKPI: Limit exposure of new field in dev_pm_ops to LinuxKPI >= 5.
  
  This will fix a suspend/resume issue that occurs on drm-kmod packages
  build on 12.0 and run on 12.1.
  
  Approved by:  imp (mentor)

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/device.h

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/device.h
==
--- stable/12/sys/compat/linuxkpi/common/include/linux/device.h Mon Sep 16 
16:41:01 2019(r352417)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/device.h Mon Sep 16 
18:23:01 2019(r352418)
@@ -60,7 +60,9 @@ struct class {
 };
 
 struct dev_pm_ops {
+#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 5
int (*prepare)(struct device *dev);
+#endif
int (*suspend)(struct device *dev);
int (*suspend_late)(struct device *dev);
int (*resume)(struct device *dev);
___
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: r352417 - head/sys/fs/fuse

2019-09-16 Thread Alan Somers
Author: asomers
Date: Mon Sep 16 16:41:01 2019
New Revision: 352417
URL: https://svnweb.freebsd.org/changeset/base/352417

Log:
  Fix an off-by-one error from r351961
  
  That revision addressed a Coverity CID that could lead to a buffer overflow,
  but it had an off-by-one error in the buffer size check.
  
  Reported by:  Coverity
  Coverity CID: 1405530
  MFC after:3 days
  MFC-With: 351961
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/fs/fuse/fuse_internal.c

Modified: head/sys/fs/fuse/fuse_internal.c
==
--- head/sys/fs/fuse/fuse_internal.cMon Sep 16 16:17:29 2019
(r352416)
+++ head/sys/fs/fuse/fuse_internal.cMon Sep 16 16:41:01 2019
(r352417)
@@ -390,7 +390,7 @@ fuse_internal_invalidate_entry(struct mount *mp, struc
if ((err = uiomove(, sizeof(fnieo), uio)) != 0)
return (err);
 
-   if (fnieo.namelen > sizeof(name))
+   if (fnieo.namelen >= sizeof(name))
return (EINVAL);
 
if ((err = uiomove(name, fnieo.namelen, uio)) != 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: r352416 - in stable/12: etc/mtree usr.bin/locale usr.bin/locale/tests

2019-09-16 Thread Yuri Pankov
Author: yuripv
Date: Mon Sep 16 16:17:29 2019
New Revision: 352416
URL: https://svnweb.freebsd.org/changeset/base/352416

Log:
  MFC r352138, r352214, r352216:
  
  locale: handle day, abday, mon, abmon, am_pm keywords
  
  All of these are defined as mandatory by POSIX.
  
  While here, mark all non-standard ones as FreeBSD-only as
  other systems (at least, GNU/Linux and illumos) do not handle
  them, so we should not encourage their use.
  
  - make abday, day, abmon, mon, am_pm output quoting match linux
  - workaround localeconv() issue for mon_grouping and grouping (PR172215)
  - for other values not available in default locale, output -1 instead of
127 (CHAR_MAX) as returned by localeconv()
  
  PR:   237752

Added:
  stable/12/usr.bin/locale/tests/
 - copied from r352138, head/usr.bin/locale/tests/
  stable/12/usr.bin/locale/tests/no_flags_posix_messages.out
 - copied unchanged from r352214, 
head/usr.bin/locale/tests/no_flags_posix_messages.out
  stable/12/usr.bin/locale/tests/no_flags_posix_monetary.out
 - copied unchanged from r352214, 
head/usr.bin/locale/tests/no_flags_posix_monetary.out
  stable/12/usr.bin/locale/tests/no_flags_posix_numeric.out
 - copied unchanged from r352214, 
head/usr.bin/locale/tests/no_flags_posix_numeric.out
  stable/12/usr.bin/locale/tests/no_flags_posix_time.out
 - copied unchanged from r352214, 
head/usr.bin/locale/tests/no_flags_posix_time.out
Modified:
  stable/12/etc/mtree/BSD.tests.dist
  stable/12/usr.bin/locale/Makefile
  stable/12/usr.bin/locale/locale.c
  stable/12/usr.bin/locale/tests/Makefile
  stable/12/usr.bin/locale/tests/k_flag_posix_monetary.out
  stable/12/usr.bin/locale/tests/k_flag_posix_numeric.out
  stable/12/usr.bin/locale/tests/k_flag_posix_time.out
  stable/12/usr.bin/locale/tests/locale_test.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/etc/mtree/BSD.tests.dist
==
--- stable/12/etc/mtree/BSD.tests.dist  Mon Sep 16 16:10:44 2019
(r352415)
+++ stable/12/etc/mtree/BSD.tests.dist  Mon Sep 16 16:17:29 2019
(r352416)
@@ -1000,6 +1000,8 @@
 ..
 limits
 ..
+locale
+..
 m4
 ..
 mkimg

Modified: stable/12/usr.bin/locale/Makefile
==
--- stable/12/usr.bin/locale/Makefile   Mon Sep 16 16:10:44 2019
(r352415)
+++ stable/12/usr.bin/locale/Makefile   Mon Sep 16 16:17:29 2019
(r352416)
@@ -1,6 +1,12 @@
 # $FreeBSD$
 
+.include 
+
 PROG=  locale
 CFLAGS+= -I${SRCTOP}/lib/libc/locale
+LIBADD+= sbuf
+
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
 
 .include 

Modified: stable/12/usr.bin/locale/locale.c
==
--- stable/12/usr.bin/locale/locale.c   Mon Sep 16 16:10:44 2019
(r352415)
+++ stable/12/usr.bin/locale/locale.c   Mon Sep 16 16:17:29 2019
(r352416)
@@ -39,6 +39,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -53,13 +54,13 @@
 #include "setlocale.h"
 
 /* Local prototypes */
-char   *format_grouping(const char *);
+char   *format_grouping(char *);
 void   init_locales_list(void);
 void   list_charmaps(void);
 void   list_locales(void);
 const char *lookup_localecat(int);
 char   *kwval_lconv(int);
-intkwval_lookup(const char *, char **, int *, int *);
+intkwval_lookup(const char *, char **, int *, int *, int *);
 void   showdetails(const char *);
 void   showkeywordslist(char *substring);
 void   showlocale(void);
@@ -87,141 +88,264 @@ static const struct _lcinfo {
 #defineNLCINFO nitems(lcinfo)
 
 /* ids for values not referenced by nl_langinfo() */
-#defineKW_ZERO 1
-#defineKW_GROUPING (KW_ZERO+1)
-#defineKW_INT_CURR_SYMBOL  (KW_ZERO+2)
-#defineKW_CURRENCY_SYMBOL  (KW_ZERO+3)
-#defineKW_MON_DECIMAL_POINT(KW_ZERO+4)
-#defineKW_MON_THOUSANDS_SEP(KW_ZERO+5)
-#defineKW_MON_GROUPING (KW_ZERO+6)
-#defineKW_POSITIVE_SIGN(KW_ZERO+7)
-#defineKW_NEGATIVE_SIGN(KW_ZERO+8)
-#defineKW_INT_FRAC_DIGITS  (KW_ZERO+9)
-#defineKW_FRAC_DIGITS  (KW_ZERO+10)
-#defineKW_P_CS_PRECEDES(KW_ZERO+11)
-#defineKW_P_SEP_BY_SPACE   (KW_ZERO+12)
-#defineKW_N_CS_PRECEDES(KW_ZERO+13)
-#defineKW_N_SEP_BY_SPACE   (KW_ZERO+14)
-#defineKW_P_SIGN_POSN  (KW_ZERO+15)
-#defineKW_N_SIGN_POSN  (KW_ZERO+16)
-#defineKW_INT_P_CS_PRECEDES(KW_ZERO+17)
-#defineKW_INT_P_SEP_BY_SPACE   (KW_ZERO+18)
-#defineKW_INT_N_CS_PRECEDES(KW_ZERO+19)
-#defineKW_INT_N_SEP_BY_SPACE   (KW_ZERO+20)
-#defineKW_INT_P_SIGN_POSN  (KW_ZERO+21)
-#defineKW_INT_N_SIGN_POSN  (KW_ZERO+22)

svn commit: r352415 - stable/12/sys/dev/ichsmb

2019-09-16 Thread Yuri Pankov
Author: yuripv
Date: Mon Sep 16 16:10:44 2019
New Revision: 352415
URL: https://svnweb.freebsd.org/changeset/base/352415

Log:
  MFC r351604:
  
  ichsmb: defer smbus attach until interrupts are available
  
  This fixes a "timed sleep before timers are working" panic seen
  while attaching jedec_dimm(4) instances too early in the boot.
  
  Submitted by: ian
  Reviewed by:  hselasky
  Differential Revision:https://reviews.freebsd.org/D21452

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

Modified: stable/12/sys/dev/ichsmb/ichsmb.c
==
--- stable/12/sys/dev/ichsmb/ichsmb.c   Mon Sep 16 15:56:21 2019
(r352414)
+++ stable/12/sys/dev/ichsmb/ichsmb.c   Mon Sep 16 16:10:44 2019
(r352415)
@@ -131,11 +131,8 @@ ichsmb_attach(device_t dev)
goto fail;
}
 
-   /* Attach "smbus" child */
-   if ((error = bus_generic_attach(dev)) != 0) {
-   device_printf(dev, "failed to attach child: %d\n", error);
-   goto fail;
-   }
+   /* Probe and attach the smbus when interrupts are available */
+   config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev);
 
return (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: r352414 - head/tests/sys/fs/fusefs

2019-09-16 Thread Alan Somers
Author: asomers
Date: Mon Sep 16 15:56:21 2019
New Revision: 352414
URL: https://svnweb.freebsd.org/changeset/base/352414

Log:
  fusefs: initialize C++ classes the Coverity way
  
  Coverity complained that I wasn't initializing some class members until the
  SetUp method.  Do it in the constructor instead.
  
  Reported by:  Coverity
  Coverity CIDs:1404352, 1404378
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/fs/fusefs/io.cc
  head/tests/sys/fs/fusefs/mknod.cc

Modified: head/tests/sys/fs/fusefs/io.cc
==
--- head/tests/sys/fs/fusefs/io.cc  Mon Sep 16 15:44:59 2019
(r352413)
+++ head/tests/sys/fs/fusefs/io.cc  Mon Sep 16 15:56:21 2019
(r352414)
@@ -108,11 +108,11 @@ int m_backing_fd, m_control_fd, m_test_fd;
 off_t m_filesize;
 bool m_direct_io;
 
-Io(): m_backing_fd(-1), m_control_fd(-1), m_test_fd(-1), m_direct_io(false) {};
+Io(): m_backing_fd(-1), m_control_fd(-1), m_test_fd(-1), m_filesize(0),
+   m_direct_io(false) {};
 
 void SetUp()
 {
-   m_filesize = 0;
m_backing_fd = open("backing_file", O_RDWR | O_CREAT | O_TRUNC, 0644);
if (m_backing_fd < 0)
FAIL() << strerror(errno);

Modified: head/tests/sys/fs/fusefs/mknod.cc
==
--- head/tests/sys/fs/fusefs/mknod.cc   Mon Sep 16 15:44:59 2019
(r352413)
+++ head/tests/sys/fs/fusefs/mknod.cc   Mon Sep 16 15:56:21 2019
(r352414)
@@ -55,8 +55,11 @@ const static mode_t c_umask = 022;
 
 public:
 
-virtual void SetUp() {
+Mknod() {
m_oldmask = umask(c_umask);
+}
+
+virtual void SetUp() {
if (geteuid() != 0) {
GTEST_SKIP() << "Only root may use most mknod(2) variations";
}
___
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: r352413 - head/tests/sys/fs/fusefs

2019-09-16 Thread Alan Somers
Author: asomers
Date: Mon Sep 16 15:44:59 2019
New Revision: 352413
URL: https://svnweb.freebsd.org/changeset/base/352413

Log:
  fusefs: fix some minor Coverity CIDs in the tests
  
  Where open(2) is expected to fail, the tests should assert or expect that
  its return value is -1.  These tests all accepted too much but happened to
  pass anyway.
  
  Reported by:  Coverity
  Coverity CID: 1404512, 1404378, 1404504, 1404483
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/fs/fusefs/create.cc
  head/tests/sys/fs/fusefs/default_permissions.cc
  head/tests/sys/fs/fusefs/opendir.cc

Modified: head/tests/sys/fs/fusefs/create.cc
==
--- head/tests/sys/fs/fusefs/create.cc  Mon Sep 16 15:21:37 2019
(r352412)
+++ head/tests/sys/fs/fusefs/create.cc  Mon Sep 16 15:44:59 2019
(r352413)
@@ -204,7 +204,7 @@ TEST_F(Create, eexist)
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
.WillOnce(Invoke(ReturnErrno(ENOENT)));
expect_create(RELPATH, mode, ReturnErrno(EEXIST));
-   EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode));
+   EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, mode));
EXPECT_EQ(EEXIST, errno);
 }
 
@@ -342,7 +342,7 @@ TEST_F(Create, eperm)
.WillOnce(Invoke(ReturnErrno(ENOENT)));
expect_create(RELPATH, mode, ReturnErrno(EPERM));
 
-   EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode));
+   EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, mode));
EXPECT_EQ(EPERM, errno);
 }
 

Modified: head/tests/sys/fs/fusefs/default_permissions.cc
==
--- head/tests/sys/fs/fusefs/default_permissions.cc Mon Sep 16 15:21:37 
2019(r352412)
+++ head/tests/sys/fs/fusefs/default_permissions.cc Mon Sep 16 15:44:59 
2019(r352413)
@@ -749,7 +749,7 @@ TEST_F(Open, eacces)
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
 
-   EXPECT_NE(0, open(FULLPATH, O_RDWR));
+   EXPECT_EQ(-1, open(FULLPATH, O_RDWR));
EXPECT_EQ(EACCES, errno);
 }
 

Modified: head/tests/sys/fs/fusefs/opendir.cc
==
--- head/tests/sys/fs/fusefs/opendir.cc Mon Sep 16 15:21:37 2019
(r352412)
+++ head/tests/sys/fs/fusefs/opendir.cc Mon Sep 16 15:44:59 2019
(r352413)
@@ -103,7 +103,7 @@ TEST_F(Opendir, eperm)
expect_lookup(RELPATH, ino);
expect_opendir(ino, O_RDONLY, ReturnErrno(EPERM));
 
-   EXPECT_NE(0, open(FULLPATH, O_DIRECTORY));
+   EXPECT_EQ(-1, open(FULLPATH, O_DIRECTORY));
EXPECT_EQ(EPERM, errno);
 }
 
___
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: Re; svn commit: r352393 - head/sys/fs/nfsclient

2019-09-16 Thread Rick Macklem
Resent to correct address...


From: Rick Macklem
Sent: Monday, September 16, 2019 11:27 AM
To: k...@freebsd.org; pet...@freebsd.org
Cc: src-svn-...@freebsd.org
Subject: Re; svn commit: r352393 - head/sys/fs/nfsclient

Hi Kostik,

I'm afraid there was a reason that only certain cases (where the file was
being shrunk) did the vnode_pager_setsize() call after the NFS node
lock is released.

See the commit log message for r252528.

If vnode_pager_setsize() now acquires a sleep lock for the case where the
size is increasing, it sounds like the NFS node lock will have to become a
sleep lock instead of a mutex.
(If needed, I can get working on this in a day or two.)

rick
___
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: r352412 - stable/12/sys/amd64/amd64

2019-09-16 Thread Mark Johnston
Author: markj
Date: Mon Sep 16 15:21:37 2019
New Revision: 352412
URL: https://svnweb.freebsd.org/changeset/base/352412

Log:
  MFC r351727:
  Replace PMAP_LARGEMAP_MAX_ADDRESS() with a more general predicate.

Modified:
  stable/12/sys/amd64/amd64/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/pmap.c
==
--- stable/12/sys/amd64/amd64/pmap.cMon Sep 16 15:16:48 2019
(r352411)
+++ stable/12/sys/amd64/amd64/pmap.cMon Sep 16 15:21:37 2019
(r352412)
@@ -426,8 +426,8 @@ static int pmap_flags = PMAP_PDE_SUPERPAGE; /* flags f
 
 static vmem_t *large_vmem;
 static u_int lm_ents;
-#definePMAP_LARGEMAP_MAX_ADDRESS() \
-(LARGEMAP_MIN_ADDRESS + NBPML4 * (u_long)lm_ents)
+#definePMAP_ADDRESS_IN_LARGEMAP(va)((va) >= LARGEMAP_MIN_ADDRESS 
&& \
+   (va) < LARGEMAP_MIN_ADDRESS + NBPML4 * (u_long)lm_ents)
 
 int pmap_pcid_enabled = 1;
 SYSCTL_INT(_vm_pmap, OID_AUTO, pcid_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
@@ -3063,8 +3063,7 @@ pmap_kextract(vm_offset_t va)
 
if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) {
pa = DMAP_TO_PHYS(va);
-   } else if (LARGEMAP_MIN_ADDRESS <= va &&
-   va < PMAP_LARGEMAP_MAX_ADDRESS()) {
+   } else if (PMAP_ADDRESS_IN_LARGEMAP(va)) {
pa = pmap_large_map_kextract(va);
} else {
pde = *vtopde(va);
@@ -8957,7 +8956,7 @@ pmap_large_map_kextract(vm_offset_t va)
pd_entry_t *pde, pd;
pt_entry_t *pte, pt;
 
-   KASSERT(LARGEMAP_MIN_ADDRESS <= va && va < PMAP_LARGEMAP_MAX_ADDRESS(),
+   KASSERT(PMAP_ADDRESS_IN_LARGEMAP(va),
("not largemap range %#lx", (u_long)va));
pdpe = pmap_large_map_pdpe(va);
pdp = *pdpe;
@@ -9099,8 +9098,8 @@ pmap_large_unmap(void *svaa, vm_size_t len)
return;
 
SLIST_INIT();
-   KASSERT(LARGEMAP_MIN_ADDRESS <= sva &&
-   sva + len <= PMAP_LARGEMAP_MAX_ADDRESS(),
+   KASSERT(PMAP_ADDRESS_IN_LARGEMAP(sva) &&
+   PMAP_ADDRESS_IN_LARGEMAP(sva + len - 1),
("not largemap range %#lx %#lx", (u_long)svaa, (u_long)svaa + len));
PMAP_LOCK(kernel_pmap);
for (va = sva; va < sva + len; va += inc) {
___
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: r352411 - head/sys/vm

2019-09-16 Thread Mark Johnston
Author: markj
Date: Mon Sep 16 15:16:48 2019
New Revision: 352411
URL: https://svnweb.freebsd.org/changeset/base/352411

Log:
  Assert that the refcount value is not VPRC_BLOCKED in vm_page_drop().
  
  VPRC_BLOCKED is a refcount flag used to indicate that a thread is
  tearing down mappings of a page.  When set, it causes attempts to wire a
  page via a pmap lookup to fail.  It should never represent the last
  reference to a page, so assert this.
  
  Suggested by: kib
  Reviewed by:  alc, kib
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21639

Modified:
  head/sys/vm/vm_page.h

Modified: head/sys/vm/vm_page.h
==
--- head/sys/vm/vm_page.h   Mon Sep 16 15:12:49 2019(r352410)
+++ head/sys/vm/vm_page.h   Mon Sep 16 15:16:48 2019(r352411)
@@ -902,13 +902,17 @@ vm_page_in_laundry(vm_page_t m)
 static inline u_int
 vm_page_drop(vm_page_t m, u_int val)
 {
+   u_int old;
 
/*
 * Synchronize with vm_page_free_prep(): ensure that all updates to the
 * page structure are visible before it is freed.
 */
atomic_thread_fence_rel();
-   return (atomic_fetchadd_int(>ref_count, -val));
+   old = atomic_fetchadd_int(>ref_count, -val);
+   KASSERT(old != VPRC_BLOCKED,
+   ("vm_page_drop: page %p has an invalid refcount value", m));
+   return (old);
 }
 
 /*
___
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: r352410 - head/sys/vm

2019-09-16 Thread Mark Johnston
Author: markj
Date: Mon Sep 16 15:12:49 2019
New Revision: 352410
URL: https://svnweb.freebsd.org/changeset/base/352410

Log:
  Fix a race in vm_page_dequeue_deferred_free() after r352110.
  
  This function loaded the page's queue index before setting PGA_DEQUEUE.
  In this window the page daemon may have deactivated the page, updating
  its queue index.  Make the operation atomic using vm_page_pqstate_cmpset();
  the page daemon will not modify the page once it observes that PGA_DEQUEUE
  is set.
  
  Reported and tested by:   pho
  Reviewed by:  alc, kib
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21639

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   Mon Sep 16 15:09:31 2019(r352409)
+++ head/sys/vm/vm_page.c   Mon Sep 16 15:12:49 2019(r352410)
@@ -3315,13 +3315,18 @@ vm_page_dequeue_deferred_free(vm_page_t m)
 
KASSERT(m->ref_count == 0, ("page %p has references", m));
 
-   if ((m->aflags & PGA_DEQUEUE) != 0)
-   return;
-   atomic_thread_fence_acq();
-   if ((queue = m->queue) == PQ_NONE)
-   return;
-   vm_page_aflag_set(m, PGA_DEQUEUE);
-   vm_page_pqbatch_submit(m, queue);
+   for (;;) {
+   if ((m->aflags & PGA_DEQUEUE) != 0)
+   return;
+   atomic_thread_fence_acq();
+   if ((queue = atomic_load_8(>queue)) == PQ_NONE)
+   return;
+   if (vm_page_pqstate_cmpset(m, queue, queue, PGA_DEQUEUE,
+   PGA_DEQUEUE)) {
+   vm_page_pqbatch_submit(m, queue);
+   break;
+   }
+   }
 }
 
 /*

Modified: head/sys/vm/vm_page.h
==
--- head/sys/vm/vm_page.h   Mon Sep 16 15:09:31 2019(r352409)
+++ head/sys/vm/vm_page.h   Mon Sep 16 15:12:49 2019(r352410)
@@ -783,8 +783,6 @@ vm_page_pqstate_cmpset(vm_page_t m, uint32_t oldq, uin
 {
uint32_t *addr, nval, oval, qsmask;
 
-   vm_page_assert_locked(m);
-
fflags <<= VM_PAGE_AFLAG_SHIFT;
nflags <<= VM_PAGE_AFLAG_SHIFT;
newq <<= VM_PAGE_QUEUE_SHIFT;
___
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: r352409 - head/sys/vm

2019-09-16 Thread Mark Johnston
Author: markj
Date: Mon Sep 16 15:09:31 2019
New Revision: 352409
URL: https://svnweb.freebsd.org/changeset/base/352409

Log:
  Fix a page leak in vm_page_reclaim_run().
  
  After r352110 the attempt to remove mappings of the page being replaced
  may fail if the page is wired.  In this case we must free the replacement
  page.
  
  Reviewed by:  alc, kib
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21639

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Mon Sep 16 15:06:19 2019(r352408)
+++ head/sys/vm/vm_page.c   Mon Sep 16 15:09:31 2019(r352409)
@@ -2597,16 +2597,23 @@ retry:
}
 
/*
-* Replace "m" with the new page.  For
-* vm_page_replace(), "m" must be busy
-* and dequeued.  Finally, change "m"
-* as if vm_page_free() was called.
+* Unmap the page and check for new
+* wirings that may have been acquired
+* through a pmap lookup.
 */
if (object->ref_count != 0 &&
!vm_page_try_remove_all(m)) {
+   vm_page_free(m_new);
error = EBUSY;
goto unlock;
}
+
+   /*
+* Replace "m" with the new page.  For
+* vm_page_replace(), "m" must be busy
+* and dequeued.  Finally, change "m"
+* as if vm_page_free() was called.
+*/
m_new->aflags = m->aflags &
~PGA_QUEUE_STATE_MASK;
KASSERT(m_new->oflags == VPO_UNMANAGED,
___
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: r352408 - in head: share/man/man9 sys/amd64/amd64

2019-09-16 Thread Mark Johnston
Author: markj
Date: Mon Sep 16 15:06:19 2019
New Revision: 352408
URL: https://svnweb.freebsd.org/changeset/base/352408

Log:
  Fix a couple of nits in r352110.
  
  - Remove a dead variable from the amd64 pmap_extract_and_hold().
  - Fix grammar in the vm_page_wire man page.
  
  Reported by:  alc
  Reviewed by:  alc, kib
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21639

Modified:
  head/share/man/man9/vm_page_wire.9
  head/sys/amd64/amd64/pmap.c

Modified: head/share/man/man9/vm_page_wire.9
==
--- head/share/man/man9/vm_page_wire.9  Mon Sep 16 15:04:45 2019
(r352407)
+++ head/share/man/man9/vm_page_wire.9  Mon Sep 16 15:06:19 2019
(r352408)
@@ -51,7 +51,7 @@ The
 .Fn vm_page_wire
 and
 .Fn vm_page_wire_mapped
-function wire the page, prevent it from being reclaimed by the page
+functions wire the page, which prevents it from being reclaimed by the page
 daemon or when its containing object is destroyed.
 Both functions require that the page belong to an object.
 The

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Sep 16 15:04:45 2019(r352407)
+++ head/sys/amd64/amd64/pmap.c Mon Sep 16 15:06:19 2019(r352408)
@@ -3064,10 +3064,8 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_
 {
pd_entry_t pde, *pdep;
pt_entry_t pte, PG_RW, PG_V;
-   vm_paddr_t pa;
vm_page_t m;
 
-   pa = 0;
m = NULL;
PG_RW = pmap_rw_bit(pmap);
PG_V = pmap_valid_bit(pmap);
___
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: r352407 - in head: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm64/arm64 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/dev/virtio/balloon sys/i386/i386 sys/m...

2019-09-16 Thread Mark Johnston
Author: markj
Date: Mon Sep 16 15:04:45 2019
New Revision: 352407
URL: https://svnweb.freebsd.org/changeset/base/352407

Log:
  Revert r352406, which contained changes I didn't intend to commit.

Modified:
  head/share/man/man9/vm_page_wire.9
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/include/pmap.h
  head/sys/arm/arm/pmap-v4.c
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm64/arm64/pmap.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/dev/virtio/balloon/virtio_balloon.c
  head/sys/i386/i386/pmap.c
  head/sys/mips/mips/pmap.c
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/booke/pmap.c
  head/sys/riscv/riscv/pmap.c
  head/sys/sparc64/sparc64/pmap.c
  head/sys/vm/swap_pager.c
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_mmap.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_pagequeue.h
  head/sys/vm/vm_swapout.c

Modified: head/share/man/man9/vm_page_wire.9
==
--- head/share/man/man9/vm_page_wire.9  Mon Sep 16 15:03:12 2019
(r352406)
+++ head/share/man/man9/vm_page_wire.9  Mon Sep 16 15:04:45 2019
(r352407)
@@ -51,7 +51,7 @@ The
 .Fn vm_page_wire
 and
 .Fn vm_page_wire_mapped
-functions wire the page, which prevents it from being reclaimed by the page
+function wire the page, prevent it from being reclaimed by the page
 daemon or when its containing object is destroyed.
 Both functions require that the page belong to an object.
 The

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Sep 16 15:03:12 2019(r352406)
+++ head/sys/amd64/amd64/pmap.c Mon Sep 16 15:04:45 2019(r352407)
@@ -3064,8 +3064,10 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_
 {
pd_entry_t pde, *pdep;
pt_entry_t pte, PG_RW, PG_V;
+   vm_paddr_t pa;
vm_page_t m;
 
+   pa = 0;
m = NULL;
PG_RW = pmap_rw_bit(pmap);
PG_V = pmap_valid_bit(pmap);
@@ -5804,7 +5806,7 @@ retry:
("pmap_enter: no PV entry for %#lx", va));
if ((newpte & PG_MANAGED) == 0)
free_pv_entry(pmap, pv);
-   if ((vm_page_aflags(om) & PGA_WRITEABLE) != 0 &&
+   if ((om->aflags & PGA_WRITEABLE) != 0 &&
TAILQ_EMPTY(>md.pv_list) &&
((om->flags & PG_FICTITIOUS) != 0 ||
TAILQ_EMPTY(_to_pvh(opa)->pv_list)))
@@ -6987,7 +6989,7 @@ pmap_remove_pages(pmap_t pmap)
pvh->pv_gen++;
if (TAILQ_EMPTY(>pv_list)) {
for (mt = m; mt < [NBPDR / 
PAGE_SIZE]; mt++)
-   if ((vm_page_aflags(mt) 
& PGA_WRITEABLE) != 0 &&
+   if ((mt->aflags & 
PGA_WRITEABLE) != 0 &&

TAILQ_EMPTY(>md.pv_list))

vm_page_aflag_clear(mt, PGA_WRITEABLE);
}
@@ -7005,7 +7007,7 @@ pmap_remove_pages(pmap_t pmap)
pmap_resident_count_dec(pmap, 1);
TAILQ_REMOVE(>md.pv_list, pv, 
pv_next);
m->md.pv_gen++;
-   if ((vm_page_aflags(m) & PGA_WRITEABLE) 
!= 0 &&
+   if ((m->aflags & PGA_WRITEABLE) != 0 &&
TAILQ_EMPTY(>md.pv_list) &&
(m->flags & PG_FICTITIOUS) == 0) {
pvh = 
pa_to_pvh(VM_PAGE_TO_PHYS(m));
@@ -7136,7 +7138,7 @@ pmap_is_modified(vm_page_t m)
 * is clear, no PTEs can have PG_M set.
 */
VM_OBJECT_ASSERT_WLOCKED(m->object);
-   if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0)
+   if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0)
return (FALSE);
return (pmap_page_test_mappings(m, FALSE, TRUE));
 }
@@ -7205,7 +7207,7 @@ pmap_remove_write(vm_page_t m)
 * if PGA_WRITEABLE is clear, no page table entries need updating.
 */
VM_OBJECT_ASSERT_WLOCKED(m->object);
-   if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0)
+   if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0)
return;
lock = VM_PAGE_TO_PV_LIST_LOCK(m);
pvh = (m->flags & PG_FICTITIOUS) != 0 ? _dummy :
@@ -7688,7 +7690,7 @@ pmap_clear_modify(vm_page_t m)
 * If the object containing 

svn commit: r352406 - in head: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm64/arm64 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/dev/virtio/balloon sys/i386/i386 sys/m...

2019-09-16 Thread Mark Johnston
Author: markj
Date: Mon Sep 16 15:03:12 2019
New Revision: 352406
URL: https://svnweb.freebsd.org/changeset/base/352406

Log:
  Fix a couple of nits in r352110.
  
  - Remove a dead variable from the amd64 pmap_extract_and_hold().
  - Fix grammar in the vm_page_wire man page.
  
  Reported by:  alc
  Reviewed by:  alc, kib
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21639

Modified:
  head/share/man/man9/vm_page_wire.9
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/include/pmap.h
  head/sys/arm/arm/pmap-v4.c
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm64/arm64/pmap.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/dev/virtio/balloon/virtio_balloon.c
  head/sys/i386/i386/pmap.c
  head/sys/mips/mips/pmap.c
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/booke/pmap.c
  head/sys/riscv/riscv/pmap.c
  head/sys/sparc64/sparc64/pmap.c
  head/sys/vm/swap_pager.c
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_mmap.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_pagequeue.h
  head/sys/vm/vm_swapout.c

Modified: head/share/man/man9/vm_page_wire.9
==
--- head/share/man/man9/vm_page_wire.9  Mon Sep 16 15:00:11 2019
(r352405)
+++ head/share/man/man9/vm_page_wire.9  Mon Sep 16 15:03:12 2019
(r352406)
@@ -51,7 +51,7 @@ The
 .Fn vm_page_wire
 and
 .Fn vm_page_wire_mapped
-function wire the page, prevent it from being reclaimed by the page
+functions wire the page, which prevents it from being reclaimed by the page
 daemon or when its containing object is destroyed.
 Both functions require that the page belong to an object.
 The

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Sep 16 15:00:11 2019(r352405)
+++ head/sys/amd64/amd64/pmap.c Mon Sep 16 15:03:12 2019(r352406)
@@ -3064,10 +3064,8 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_
 {
pd_entry_t pde, *pdep;
pt_entry_t pte, PG_RW, PG_V;
-   vm_paddr_t pa;
vm_page_t m;
 
-   pa = 0;
m = NULL;
PG_RW = pmap_rw_bit(pmap);
PG_V = pmap_valid_bit(pmap);
@@ -5806,7 +5804,7 @@ retry:
("pmap_enter: no PV entry for %#lx", va));
if ((newpte & PG_MANAGED) == 0)
free_pv_entry(pmap, pv);
-   if ((om->aflags & PGA_WRITEABLE) != 0 &&
+   if ((vm_page_aflags(om) & PGA_WRITEABLE) != 0 &&
TAILQ_EMPTY(>md.pv_list) &&
((om->flags & PG_FICTITIOUS) != 0 ||
TAILQ_EMPTY(_to_pvh(opa)->pv_list)))
@@ -6989,7 +6987,7 @@ pmap_remove_pages(pmap_t pmap)
pvh->pv_gen++;
if (TAILQ_EMPTY(>pv_list)) {
for (mt = m; mt < [NBPDR / 
PAGE_SIZE]; mt++)
-   if ((mt->aflags & 
PGA_WRITEABLE) != 0 &&
+   if ((vm_page_aflags(mt) 
& PGA_WRITEABLE) != 0 &&

TAILQ_EMPTY(>md.pv_list))

vm_page_aflag_clear(mt, PGA_WRITEABLE);
}
@@ -7007,7 +7005,7 @@ pmap_remove_pages(pmap_t pmap)
pmap_resident_count_dec(pmap, 1);
TAILQ_REMOVE(>md.pv_list, pv, 
pv_next);
m->md.pv_gen++;
-   if ((m->aflags & PGA_WRITEABLE) != 0 &&
+   if ((vm_page_aflags(m) & PGA_WRITEABLE) 
!= 0 &&
TAILQ_EMPTY(>md.pv_list) &&
(m->flags & PG_FICTITIOUS) == 0) {
pvh = 
pa_to_pvh(VM_PAGE_TO_PHYS(m));
@@ -7138,7 +7136,7 @@ pmap_is_modified(vm_page_t m)
 * is clear, no PTEs can have PG_M set.
 */
VM_OBJECT_ASSERT_WLOCKED(m->object);
-   if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0)
+   if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0)
return (FALSE);
return (pmap_page_test_mappings(m, FALSE, TRUE));
 }
@@ -7207,7 +7205,7 @@ pmap_remove_write(vm_page_t m)
 * if PGA_WRITEABLE is clear, no page table entries need updating.
 */
VM_OBJECT_ASSERT_WLOCKED(m->object);
-   if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0)
+   if (!vm_page_xbusied(m) && (vm_page_aflags(m) & 

svn commit: r352405 - stable/12/sys/arm64/arm64

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 15:00:11 2019
New Revision: 352405
URL: https://svnweb.freebsd.org/changeset/base/352405

Log:
  MFC r342937:
  
  Fix the location of td->td_frame at the top of the kernel stack.
  
  In cpu_thread_alloc we would allocate space for the trap frame at the top of
  the kernel stack. This is just below the pcb, however due to a missing cast
  the pointer arithmetic would use the pcb size, not the trapframe size. As
  the pcb is larger than the trapframe this is safe, however later in cpu_fork
  we include the case leading to the two disagreeing on the location.
  
  Fix by using the same arithmetic in both locations.
  
  Found by: An early KASAN patch
  Sponsored by: DARPA, AFRL

Modified:
  stable/12/sys/arm64/arm64/vm_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/vm_machdep.c
==
--- stable/12/sys/arm64/arm64/vm_machdep.c  Mon Sep 16 14:51:49 2019
(r352404)
+++ stable/12/sys/arm64/arm64/vm_machdep.c  Mon Sep 16 15:00:11 2019
(r352405)
@@ -228,7 +228,7 @@ cpu_thread_alloc(struct thread *td)
td->td_pcb = (struct pcb *)(td->td_kstack +
td->td_kstack_pages * PAGE_SIZE) - 1;
td->td_frame = (struct trapframe *)STACKALIGN(
-   td->td_pcb - 1);
+   (struct trapframe *)td->td_pcb - 1);
 }
 
 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: r352404 - head/sys/fs/fuse

2019-09-16 Thread Alan Somers
Author: asomers
Date: Mon Sep 16 14:51:49 2019
New Revision: 352404
URL: https://svnweb.freebsd.org/changeset/base/352404

Log:
  fusefs: fix some minor issues with fuse_vnode_setparent
  
  * When unparenting a vnode, actually clear the flag. AFAIK this is basically
a no-op because we only unparent a vnode when reclaiming it or when
unlinking.
  
  * There's no need to call fuse_vnode_setparent during reclaim, because we're
about to free the vnode data anyway.
  
  Reviewed by:  emaste
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21630

Modified:
  head/sys/fs/fuse/fuse_node.h
  head/sys/fs/fuse/fuse_vnops.c

Modified: head/sys/fs/fuse/fuse_node.h
==
--- head/sys/fs/fuse/fuse_node.hMon Sep 16 14:51:24 2019
(r352403)
+++ head/sys/fs/fuse/fuse_node.hMon Sep 16 14:51:49 2019
(r352404)
@@ -174,6 +174,8 @@ fuse_vnode_setparent(struct vnode *vp, struct vnode *d
MPASS(dvp->v_type == VDIR);
VTOFUD(vp)->parent_nid = VTOI(dvp);
VTOFUD(vp)->flag |= FN_PARENT_NID;
+   } else {
+   VTOFUD(vp)->flag &= ~FN_PARENT_NID;
}
 }
 

Modified: head/sys/fs/fuse/fuse_vnops.c
==
--- head/sys/fs/fuse/fuse_vnops.c   Mon Sep 16 14:51:24 2019
(r352403)
+++ head/sys/fs/fuse/fuse_vnops.c   Mon Sep 16 14:51:49 2019
(r352404)
@@ -1525,11 +1525,10 @@ fuse_vnop_reclaim(struct vop_reclaim_args *ap)
fuse_filehandle_close(vp, fufh, td, NULL);
}
 
-   if ((!fuse_isdeadfs(vp)) && (fvdat->nlookup)) {
+   if (!fuse_isdeadfs(vp) && fvdat->nlookup > 0) {
fuse_internal_forget_send(vnode_mount(vp), td, NULL, VTOI(vp),
fvdat->nlookup);
}
-   fuse_vnode_setparent(vp, NULL);
cache_purge(vp);
vfs_hash_remove(vp);
fuse_vnode_destroy(vp);
___
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: r352403 - in stable/12/sys/arm64: arm64 include

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 14:51:24 2019
New Revision: 352403
URL: https://svnweb.freebsd.org/changeset/base/352403

Log:
  MFC r340008, r340013
  
  r340008:
  Add the ARMv8.3 HCR_EL2 register fields.
  
  Sponsored by: DARPA, AFRL
  
  r340013:
  Add the ARMv8.3 SCTLR_EL1 fields.
  
  While here tag which architecture release fields were added and remove a
  field that only existed in very early releases of the ARMv8 spec.
  
  Sponsored by: DARPA, AFRL

Modified:
  stable/12/sys/arm64/arm64/locore.S
  stable/12/sys/arm64/include/armreg.h
  stable/12/sys/arm64/include/hypervisor.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/locore.S
==
--- stable/12/sys/arm64/arm64/locore.S  Mon Sep 16 14:45:20 2019
(r352402)
+++ stable/12/sys/arm64/arm64/locore.S  Mon Sep 16 14:51:24 2019
(r352403)
@@ -633,7 +633,7 @@ sctlr_set:
 sctlr_clear:
/* Bits to clear */
.quad (SCTLR_EE | SCTLR_EOE | SCTLR_IESB | SCTLR_WXN | SCTLR_UMA | \
-   SCTLR_ITD | SCTLR_THEE | SCTLR_A)
+   SCTLR_ITD | SCTLR_A)
 
.globl abort
 abort:

Modified: stable/12/sys/arm64/include/armreg.h
==
--- stable/12/sys/arm64/include/armreg.hMon Sep 16 14:45:20 2019
(r352402)
+++ stable/12/sys/arm64/include/armreg.hMon Sep 16 14:51:24 2019
(r352403)
@@ -527,7 +527,7 @@
 #definePAR_S_MASK  (0x1 << PAR_S_SHIFT)
 
 /* SCTLR_EL1 - System Control Register */
-#defineSCTLR_RES0  0xc8222400  /* Reserved ARMv8.0, write 0 */
+#defineSCTLR_RES0  0xc8222440  /* Reserved ARMv8.0, write 0 */
 #defineSCTLR_RES1  0x30d00800  /* Reserved ARMv8.0, write 1 */
 
 #defineSCTLR_M 0x0001
@@ -536,23 +536,32 @@
 #defineSCTLR_SA0x0008
 #defineSCTLR_SA0   0x0010
 #defineSCTLR_CP15BEN   0x0020
-#defineSCTLR_THEE  0x0040
+/* Bit 6 is reserved */
 #defineSCTLR_ITD   0x0080
 #defineSCTLR_SED   0x0100
 #defineSCTLR_UMA   0x0200
+/* Bit 10 is reserved */
+/* Bit 11 is reserved */
 #defineSCTLR_I 0x1000
+#defineSCTLR_EnDB  0x2000 /* ARMv8.3 */
 #defineSCTLR_DZE   0x4000
 #defineSCTLR_UCT   0x8000
 #defineSCTLR_nTWI  0x0001
+/* Bit 17 is reserved */
 #defineSCTLR_nTWE  0x0004
 #defineSCTLR_WXN   0x0008
-#defineSCTLR_IESB  0x0020
-#defineSCTLR_SPAN  0x0080
+/* Bit 20 is reserved */
+#defineSCTLR_IESB  0x0020 /* ARMv8.2 */
+/* Bit 22 is reserved */
+#defineSCTLR_SPAN  0x0080 /* ARMv8.1 */
 #defineSCTLR_EOE   0x0100
 #defineSCTLR_EE0x0200
 #defineSCTLR_UCI   0x0400
-#defineSCTLR_nTLSMD0x1000
-#defineSCTLR_LSMAOE0x2000
+#defineSCTLR_EnDA  0x0800 /* ARMv8.3 */
+#defineSCTLR_nTLSMD0x1000 /* ARMv8.2 */
+#defineSCTLR_LSMAOE0x2000 /* ARMv8.2 */
+#defineSCTLR_EnIB  0x4000 /* ARMv8.3 */
+#defineSCTLR_EnIA  0x8000 /* ARMv8.3 */
 
 /* SPSR_EL1 */
 /*

Modified: stable/12/sys/arm64/include/hypervisor.h
==
--- stable/12/sys/arm64/include/hypervisor.hMon Sep 16 14:45:20 2019
(r352402)
+++ stable/12/sys/arm64/include/hypervisor.hMon Sep 16 14:51:24 2019
(r352403)
@@ -80,6 +80,17 @@
 #defineHCR_RW  0x8000
 #defineHCR_CD  0x0001
 #defineHCR_ID  0x0002
+#defineHCR_E2H 0x0004
+#defineHCR_TLOR0x0008
+#defineHCR_TERR0x0010
+#defineHCR_TEA 0x0020
+#defineHCR_MIOCNCE 0x0040
+/* Bit 39 is reserved */
+#defineHCR_APK 0x0100
+#defineHCR_API 0x0200
+#defineHCR_NV  0x0400
+#defineHCR_NV1 0x0800
+#defineHCR_AT  0x1000
 
 #endif
 
___
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: r352402 - stable/12/sys/arm64/arm64

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 14:45:20 2019
New Revision: 352402
URL: https://svnweb.freebsd.org/changeset/base/352402

Log:
  MFC r339988:
  
  Use the correct offsets for the trap frame in fork_trampoline.
  
  Sponsored by: DARPA, AFRL

Modified:
  stable/12/sys/arm64/arm64/swtch.S
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/swtch.S
==
--- stable/12/sys/arm64/arm64/swtch.S   Mon Sep 16 14:43:43 2019
(r352401)
+++ stable/12/sys/arm64/arm64/swtch.S   Mon Sep 16 14:45:20 2019
(r352402)
@@ -236,12 +236,12 @@ ENTRY(fork_trampoline)
msr daifset, #2
 
/* Restore sp and lr */
-   ldp x0, x1, [sp]
+   ldp x0, x1, [sp, #TF_SP]
msr sp_el0, x0
mov lr, x1
 
/* Restore elr and spsr */
-   ldp x0, x1, [sp, #16]
+   ldp x0, x1, [sp, #TF_ELR]
msr elr_el1, x0
msr spsr_el1, x1
 
___
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: r352401 - stable/12/sys/arm64/arm64

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 14:43:43 2019
New Revision: 352401
URL: https://svnweb.freebsd.org/changeset/base/352401

Log:
  MFC r339594:
  
  Stop advertising ARMv8.3 Pointer Authentication
  
  This needs firmware and kernel support before userspace can use it. Until
  then don't advertise it's available.

Modified:
  stable/12/sys/arm64/arm64/identcpu.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/identcpu.c
==
--- stable/12/sys/arm64/arm64/identcpu.cMon Sep 16 14:42:14 2019
(r352400)
+++ stable/12/sys/arm64/arm64/identcpu.cMon Sep 16 14:43:43 2019
(r352401)
@@ -211,13 +211,13 @@ static struct mrs_field id_aa64isar0_fields[] = {
 };
 
 static struct mrs_field id_aa64isar1_fields[] = {
-   MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_GPI_SHIFT),
-   MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_GPA_SHIFT),
+   MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_GPI_SHIFT),
+   MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_GPA_SHIFT),
MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_LRCPC_SHIFT),
MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_FCMA_SHIFT),
MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_JSCVT_SHIFT),
-   MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_API_SHIFT),
-   MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_APA_SHIFT),
+   MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_API_SHIFT),
+   MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_APA_SHIFT),
MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_DPB_SHIFT),
MRS_FIELD_END,
 };
___
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: r352400 - stable/12

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 14:42:14 2019
New Revision: 352400
URL: https://svnweb.freebsd.org/changeset/base/352400

Log:
  MFC r341489:
  
  Only gnu/lib/csu when MK_BSD_CRTBEGIN is off.
  
  We were still building it from Makefile.inc1. Disable it there so we don't
  try to build the GNU crtbegin/crtend when the BSD version was asked for.
  
  PR:   233733
  Reported by:  lwhsu
  Reviewed by:  emaste
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D18428

Modified:
  stable/12/Makefile.inc1
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/Makefile.inc1
==
--- stable/12/Makefile.inc1 Mon Sep 16 14:35:02 2019(r352399)
+++ stable/12/Makefile.inc1 Mon Sep 16 14:42:14 2019(r352400)
@@ -2514,8 +2514,10 @@ _prereq_libs+= gnu/lib/libssp/libssp_nonshared
 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
 # all shared libraries for ELF.
 #
-_startup_libs= gnu/lib/csu
-_startup_libs+=lib/csu
+_startup_libs= lib/csu
+.if ${MK_BSD_CRTBEGIN} == "no"
+_startup_libs+=gnu/lib/csu
+.endif
 _startup_libs+=lib/libcompiler_rt
 _startup_libs+=lib/libc
 _startup_libs+=lib/libc_nonshared
___
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: r352399 - stable/12/sys/arm64/arm64

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 14:35:02 2019
New Revision: 352399
URL: https://svnweb.freebsd.org/changeset/base/352399

Log:
  MFC r339948:
  
  Use pmap_invalidate_all rather than invalidating 512 level 2 entries in
  the early pmap_mapbios/unmapbios code. It is even worse when there are
  multiple L2 entries to handle as we would need to iterate over all pages.
  
  Sponsored by: DARPA, AFRL

Modified:
  stable/12/sys/arm64/arm64/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/pmap.c
==
--- stable/12/sys/arm64/arm64/pmap.cMon Sep 16 14:34:10 2019
(r352398)
+++ stable/12/sys/arm64/arm64/pmap.cMon Sep 16 14:35:02 2019
(r352399)
@@ -4869,11 +4869,11 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size)
pmap_load_store(l2,
pa | ATTR_DEFAULT | ATTR_XN |
ATTR_IDX(CACHED_MEMORY) | L2_BLOCK);
-   pmap_invalidate_range(kernel_pmap, va, va + L2_SIZE);
 
va += L2_SIZE;
pa += L2_SIZE;
}
+   pmap_invalidate_all(kernel_pmap);
 
va = preinit_map_va + (start_idx * L2_SIZE);
 
@@ -4906,12 +4906,14 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size)
pd_entry_t *pde;
pt_entry_t *l2;
int i, lvl, l2_blocks, block;
+   bool preinit_map;
 
l2_blocks =
   (roundup2(va + size, L2_SIZE) - rounddown2(va, L2_SIZE)) >> L2_SHIFT;
KASSERT(l2_blocks > 0, ("pmap_unmapbios: invalid size %lx", size));
 
/* Remove preinit mapping */
+   preinit_map = false;
block = 0;
for (i = 0; i < PMAP_PREINIT_MAPPING_COUNT; i++) {
ppim = pmap_preinit_mapping + i;
@@ -4921,6 +4923,7 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size)
ppim->va = 0;
ppim->pa = 0;
ppim->size = 0;
+   preinit_map = true;
offset = block * L2_SIZE;
va_trunc = rounddown2(va, L2_SIZE) + offset;
 
@@ -4931,13 +4934,15 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size)
va_trunc));
l2 = pmap_l1_to_l2(pde, va_trunc);
pmap_clear(l2);
-   pmap_invalidate_range(kernel_pmap, va_trunc,
-   va_trunc + L2_SIZE);
 
if (block == (l2_blocks - 1))
-   return;
+   break;
block++;
}
+   }
+   if (preinit_map) {
+   pmap_invalidate_all(kernel_pmap);
+   return;
}
 
/* Unmap the pages reserved with kva_alloc. */
___
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: r352398 - stable/12/sys/arm64/arm64

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 14:34:10 2019
New Revision: 352398
URL: https://svnweb.freebsd.org/changeset/base/352398

Log:
  MFC r339944:
  
  Fix some style(9) issues in the arm64 pmap_mapbios/unmapbios. Split lines
  when they are too long.

Modified:
  stable/12/sys/arm64/arm64/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/pmap.c
==
--- stable/12/sys/arm64/arm64/pmap.cMon Sep 16 14:25:51 2019
(r352397)
+++ stable/12/sys/arm64/arm64/pmap.cMon Sep 16 14:34:10 2019
(r352398)
@@ -4810,8 +4810,9 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size)
 if (size == 0)
 return (NULL);
 
-/* Calculate how many full L2 blocks are needed for the 
mapping */
-   l2_blocks = (roundup2(pa + size, L2_SIZE) - rounddown2(pa, 
L2_SIZE)) >> L2_SHIFT;
+/* Calculate how many L2 blocks are needed for the mapping */
+   l2_blocks = (roundup2(pa + size, L2_SIZE) -
+   rounddown2(pa, L2_SIZE)) >> L2_SHIFT;
 
offset = pa & L2_OFFSET;
 
@@ -4858,8 +4859,10 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size)
for (i = 0; i < l2_blocks; i++) {
pde = pmap_pde(kernel_pmap, va, );
KASSERT(pde != NULL,
-   ("pmap_mapbios: Invalid page entry, va: 0x%lx", 
va));
-   KASSERT(lvl == 1, ("pmap_mapbios: Invalid level %d", 
lvl));
+   ("pmap_mapbios: Invalid page entry, va: 0x%lx",
+   va));
+   KASSERT(lvl == 1,
+   ("pmap_mapbios: Invalid level %d", lvl));
 
/* Insert L2_BLOCK */
l2 = pmap_l1_to_l2(pde, va);
@@ -4904,7 +4907,8 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size)
pt_entry_t *l2;
int i, lvl, l2_blocks, block;
 
-   l2_blocks = (roundup2(va + size, L2_SIZE) - rounddown2(va, L2_SIZE)) >> 
L2_SHIFT;
+   l2_blocks =
+  (roundup2(va + size, L2_SIZE) - rounddown2(va, L2_SIZE)) >> L2_SHIFT;
KASSERT(l2_blocks > 0, ("pmap_unmapbios: invalid size %lx", size));
 
/* Remove preinit mapping */
@@ -4912,7 +4916,8 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size)
for (i = 0; i < PMAP_PREINIT_MAPPING_COUNT; i++) {
ppim = pmap_preinit_mapping + i;
if (ppim->va == va) {
-   KASSERT(ppim->size == size, ("pmap_unmapbios: size 
mismatch"));
+   KASSERT(ppim->size == size,
+   ("pmap_unmapbios: size mismatch"));
ppim->va = 0;
ppim->pa = 0;
ppim->size = 0;
@@ -4922,10 +4927,12 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size)
/* Remove L2_BLOCK */
pde = pmap_pde(kernel_pmap, va_trunc, );
KASSERT(pde != NULL,
-   ("pmap_unmapbios: Invalid page entry, va: 0x%lx", 
va_trunc));
+   ("pmap_unmapbios: Invalid page entry, va: 0x%lx",
+   va_trunc));
l2 = pmap_l1_to_l2(pde, va_trunc);
pmap_clear(l2);
-   pmap_invalidate_range(kernel_pmap, va_trunc, va_trunc + 
L2_SIZE);
+   pmap_invalidate_range(kernel_pmap, va_trunc,
+   va_trunc + L2_SIZE);
 
if (block == (l2_blocks - 1))
return;
___
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: r352397 - stable/12/sys/sys

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 14:25:51 2019
New Revision: 352397
URL: https://svnweb.freebsd.org/changeset/base/352397

Log:
  MFC r348323:
  
  The alignment is passed into contigmalloc_domainset in the 7th argument.
  
  KUBSAN was complaining the pointer contigmalloc_domainset returned was
  misaligned. Fix this by using the correct argument to find the alignment
  in the function signature.
  
  Reported by:  KUBSAN
  Sponsored by: DARPA, AFRL

Modified:
  stable/12/sys/sys/malloc.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/sys/malloc.h
==
--- stable/12/sys/sys/malloc.h  Mon Sep 16 14:07:30 2019(r352396)
+++ stable/12/sys/sys/malloc.h  Mon Sep 16 14:25:51 2019(r352397)
@@ -177,7 +177,7 @@ void*contigmalloc(unsigned long size, struct 
malloc_t
 void   *contigmalloc_domainset(unsigned long size, struct malloc_type *type,
struct domainset *ds, int flags, vm_paddr_t low, vm_paddr_t high,
unsigned long alignment, vm_paddr_t boundary)
-   __malloc_like __result_use_check __alloc_size(1) __alloc_align(6);
+   __malloc_like __result_use_check __alloc_size(1) __alloc_align(7);
 void   free(void *addr, struct malloc_type *type);
 void   free_domain(void *addr, struct malloc_type *type);
 void   *malloc(size_t size, struct malloc_type *type, int flags) __malloc_like
___
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: r352396 - stable/12/sys/arm64/arm64

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 14:07:30 2019
New Revision: 352396
URL: https://svnweb.freebsd.org/changeset/base/352396

Log:
  MFC r343876:
  
  Add missing data barriers after storeing a new valid pagetable entry.
  
  When moving from an invalid to a valid entry we don't need to invalidate
  the tlb, however we do need to ensure the store is ordered before later
  memory accesses. This is because this later access may be to a virtual
  address within the newly mapped region.
  
  Add the needed barriers to places where we don't later invalidate the
  tlb. When we do invalidate the tlb there will be a barrier to correctly
  order this.
  
  This fixes a panic on boot on ThunderX2 when INVARIANTS is turned off:
  panic: vm_fault_hold: fault on nofault entry, addr: 0x40c11000
  
  Reported by:  jchandra
  Tested by:jchandra
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D19097

Modified:
  stable/12/sys/arm64/arm64/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/pmap.c
==
--- stable/12/sys/arm64/arm64/pmap.cMon Sep 16 13:45:31 2019
(r352395)
+++ stable/12/sys/arm64/arm64/pmap.cMon Sep 16 14:07:30 2019
(r352396)
@@ -2935,6 +2935,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent
 
/* Create the new mapping */
pmap_load_store(pte, newpte);
+   dsb(ishst);
 
critical_exit();
intr_restore(intr);
@@ -3309,6 +3310,7 @@ validate:
} else {
/* New mapping */
pmap_load_store(l3, new_l3);
+   dsb(ishst);
}
 
 #if VM_NRESERVLEVEL > 0
@@ -3455,6 +3457,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t 
 * Map the superpage.
 */
(void)pmap_load_store(l2, new_l2);
+   dsb(ishst);
 
atomic_add_long(_l2_mappings, 1);
CTR2(KTR_PMAP, "pmap_enter_l2: success for va %#lx in pmap %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: r352395 - stable/12/sys/arm64/arm64

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 13:45:31 2019
New Revision: 352395
URL: https://svnweb.freebsd.org/changeset/base/352395

Log:
  MFC r346996:
  
  Restore x18 in efi_arch_leave.
  
  Some UEFI implementations trash this register and, as we use it as a
  platform register, the kernel doesn't save it before calling into the UEFI
  runtime services. As we have a copy in tpidr_el1 restore from there when
  exiting the EFI environment.
  
  PR:   237234, 237055
  Reviewed by:  manu
  Tested On:Ampere eMAG
  Sponsored by: DARPA, AFRL
  Sponsored by: Ampere Computing (hardware)
  Differential Revision:https://reviews.freebsd.org/D20127

Modified:
  stable/12/sys/arm64/arm64/efirt_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/efirt_machdep.c
==
--- stable/12/sys/arm64/arm64/efirt_machdep.c   Mon Sep 16 13:41:24 2019
(r352394)
+++ stable/12/sys/arm64/arm64/efirt_machdep.c   Mon Sep 16 13:45:31 2019
(r352395)
@@ -260,6 +260,16 @@ efi_arch_leave(void)
 {
struct thread *td;
 
+   /*
+* Restore the pcpu pointer. Some UEFI implementations trash it and
+* we don't store it before calling into them. To fix this we need
+* to restore it after returning to the kernel context. As reading
+* curthread will access x18 we need to restore it before loading
+* the thread pointer.
+*/
+   __asm __volatile(
+   "mrs x18, tpidr_el1 \n"
+   );
td = curthread;
__asm __volatile(
"msr ttbr0_el1, %0  \n"
___
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: r352394 - in stable/12: etc/mtree gnu/lib gnu/lib/csu lib/csu lib/csu/aarch64 lib/csu/amd64 lib/csu/arm lib/csu/common lib/csu/i386 lib/csu/mips lib/csu/powerpc lib/csu/powerpc64 lib/cs...

2019-09-16 Thread Andrew Turner
Author: andrew
Date: Mon Sep 16 13:41:24 2019
New Revision: 352394
URL: https://svnweb.freebsd.org/changeset/base/352394

Log:
  MFC r339738, r339744, r339770, r339773, r339864-r339866, r339907-r339908, 
r339912-r339913, r339916, r339954, r340213, r340395, r340840, r340910-r340911, 
r341424, r342773, r342974, r351027, r352073:
  
  MFC the BSD crtbegin to stable/12 but keep it disabled.
  
  r339738:
  Implement a BSD licensed crtbegin/crtend
  
  These are needed for .ctors/.dtors and .jcr handling. The former needs
  all the function pointers to be called in the correct order from the
  .init/.fini section. The latter just needs to call a gcj specific function
  if it exists with a pointer to the start of the .jcr section.
  
  This is currently disabled until __dso_handle support is added.
  
  Reviewed by:  emaste
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D17587
  
  r339744:
  Add a missing include for src.opts.mk. Without it MK_TESTS isn't defined.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339770:
  Drop the csu tests WARNS to 5 to fix the powerpc64 build.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339773:
  Add __dso_handle to the BSD crtbegin. This is used to identify shared
  objects.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339864:
  Check __dso_handle is NULL in non-DSO objects. It should only be non-NULL
  when accessed from a shared object.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339865:
  Include the csu test directories in BSD.tests.dist
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339866:
  Make the .ctors, .dtors, and .jcr markers as static. They shouldn't be
  accessible from out of the files they are defined in.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339907:
  The jcr argument to _Jv_RegisterClasses is used, stop marking it otherwise.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339908:
  Run the csu tests on a DSO. This builds the tests into a shared library,
  then runs these from the base test programs. With this we can check
  crtbeginS.o and crtendS.o are working as expected.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339912:
  Fix the location of the static keyword.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339913:
  Disable the .preinit_array test in DSOs, ld.bfd fails to link objects with
  the section.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339916:
  Build the csu tests on all architectures.
  
  The tests haven't been run them, but this is enough to build them so I can
  get feedback on if the various crt.h headers are correct.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r339954:
  Add __used to __CTOR_LIST__ and __DTOR_LIST__
  
  Enabling BSD_CRTBEGIN on amd64 resulted in
  error: unused variable '__CTOR_LIST__'.
  
  __CTOR_LIST__ is indeed unused in crtbegin.c; it marks the beginning of
  the .ctors array and is used in crtend.c.  Annotate __DTOR_LIST__ as
  well for consistency.
  
  Discussed with:   andrew
  MFC with: r339738
  Sponsored by: The FreeBSD Foundation
  
  r340213:
  Add the (untested) mips and sparc64 .init call sequences.
  
  The BSD crtbegin/crtend code now builds on all architectures, however
  further work is needed to check if it works correctly.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r340395:
  Run __cxa_finalize in shared objects in the destructor path.
  
  When we have .dtors call them before .dtor handling, otherwise call from
  a destructor.
  
  PR:   233056
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r340840:
  Mark the function called by the MIPS .init/.fini sequence with .local.
  
  As with r328939 we need to mark local symbols as such. Without this the
  assembly parser treats the symbols as global and created relocations
  against these private symbols.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r340910:
  Add the missing 0 at the end of the .jcr section.
  
  Without this the dynamic library test was failing as it was calling
  _Jv_RegisterClasses multiple times.
  
  r340911:
  Re-enable the dynamiclib tests. These should be fixed by r340910.
  
  r341424:
  Disable the BSD CRT code on powerpc and sparc64, they need extra crt*.o
  files that haven't been implemented.
  
  Reported by:  sbruno
  MFC with: r339738
  Sponsored by: DARPA, AFRL
  
  r342773:
  Add explicit csu test dependency
  
  lib/csu/tests/dynamiclib requires libh_csu.so be built first.  I'm not
  sure this is the most correct/best way to address this but it solves
  the issue in my testing.
  
  PR:   233734
  Sponsored by: The FreeBSD Foundation
  
  r342974:
  Create crtsavres.o for powerpc builds
  
  Summary:
  GCC expects to link in a crtsavres.o on powerpc platforms.  On
  powerpc64 this is an empty file, but on powerpc and powerpcspe 

svn commit: r352393 - head/sys/fs/nfsclient

2019-09-16 Thread Konstantin Belousov
Author: kib
Date: Mon Sep 16 13:26:27 2019
New Revision: 352393
URL: https://svnweb.freebsd.org/changeset/base/352393

Log:
  nfscl_loadattrcache: fix rest of the cases to not call
  vnode_pager_setsize() under the node mutex.
  
  r248567 moved some calls of vnode_pager_setsize() after the node lock
  is unlocked, do the rest now.
  
  Reported and tested by:   peterj
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/fs/nfsclient/nfs_clport.c

Modified: head/sys/fs/nfsclient/nfs_clport.c
==
--- head/sys/fs/nfsclient/nfs_clport.c  Mon Sep 16 13:10:34 2019
(r352392)
+++ head/sys/fs/nfsclient/nfs_clport.c  Mon Sep 16 13:26:27 2019
(r352393)
@@ -511,10 +511,10 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt
 * zero np->n_attrstamp to indicate that
 * the attributes are stale.
 */
-   vap->va_size = np->n_size;
+   nsize = vap->va_size = np->n_size;
+   setnsize = 1;
np->n_attrstamp = 0;
KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
-   vnode_pager_setsize(vp, np->n_size);
} else if (np->n_flag & NMODIFIED) {
/*
 * We've modified the file: Use the larger
@@ -526,7 +526,8 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt
np->n_size = vap->va_size;
np->n_flag |= NSIZECHANGED;
}
-   vnode_pager_setsize(vp, np->n_size);
+   nsize = np->n_size;
+   setnsize = 1;
} else if (vap->va_size < np->n_size) {
/*
 * When shrinking the size, the call to
@@ -538,9 +539,9 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt
np->n_flag |= NSIZECHANGED;
setnsize = 1;
} else {
-   np->n_size = vap->va_size;
+   nsize = np->n_size = vap->va_size;
np->n_flag |= NSIZECHANGED;
-   vnode_pager_setsize(vp, np->n_size);
+   setnsize = 1;
}
} else {
np->n_size = vap->va_size;
___
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: r352392 - stable/12/sys/dev/acpica

2019-09-16 Thread Ed Maste
Author: emaste
Date: Mon Sep 16 13:10:34 2019
New Revision: 352392
URL: https://svnweb.freebsd.org/changeset/base/352392

Log:
  MFC r350499: acpi_resource.c: mention ThunderX2 firmware revision with issue
  
  [This has been fixed in a later version] and the workaround can
  eventually be removed.  See r330113 and r346066 details.

Modified:
  stable/12/sys/dev/acpica/acpi_resource.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/acpica/acpi_resource.c
==
--- stable/12/sys/dev/acpica/acpi_resource.cMon Sep 16 13:10:03 2019
(r352391)
+++ stable/12/sys/dev/acpica/acpi_resource.cMon Sep 16 13:10:34 2019
(r352392)
@@ -434,7 +434,10 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
 arc.dev = dev;
 arc.ignore_producer_flag = false;
 
-/* UARTs on ThunderX2 set ResourceProducer on memory resources. */
+/*
+ * UARTs on ThunderX2 set ResourceProducer on memory resources, with
+ * 7.2 firmware.
+ */
 if (acpi_MatchHid(handle, "ARMH0011"))
arc.ignore_producer_flag = true;
 
___
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: r352391 - head/share/man/man9

2019-09-16 Thread Yuri Pankov
Author: yuripv
Date: Mon Sep 16 13:10:03 2019
New Revision: 352391
URL: https://svnweb.freebsd.org/changeset/base/352391

Log:
  sbuf(9): fix sbuf_drain_func typedef markup
  
  Reviewed by:  0mp (previous version)
  Differential Revision:https://reviews.freebsd.org/D21569

Modified:
  head/share/man/man9/sbuf.9

Modified: head/share/man/man9/sbuf.9
==
--- head/share/man/man9/sbuf.9  Mon Sep 16 12:54:44 2019(r352390)
+++ head/share/man/man9/sbuf.9  Mon Sep 16 13:10:03 2019(r352391)
@@ -65,7 +65,12 @@
 .Sh SYNOPSIS
 .In sys/types.h
 .In sys/sbuf.h
-.Ft typedef\ int ( sbuf_drain_func ) ( void\ *arg, const\ char\ *data, int\ 
len ) ;
+.Ft typedef int
+.Fo (sbuf_drain_func)
+.Fa "void *arg"
+.Fa "const char *data"
+.Fa "int len"
+.Fc
 .Pp
 .Ft struct sbuf *
 .Fo sbuf_new
___
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: r352390 - stable/12/sys/modules/i2c/controllers/ichiic

2019-09-16 Thread Ed Maste
Author: emaste
Date: Mon Sep 16 12:54:44 2019
New Revision: 352390
URL: https://svnweb.freebsd.org/changeset/base/352390

Log:
  MFC r350303: enable ig4_acpi on aarch64
  
  The already-listed APMC0D0F ID belongs to the Ampere eMAG aarch64
  platform, but ACPI support was not even built on aarch64.
  
  Submitted by: Greg V 

Modified:
  stable/12/sys/modules/i2c/controllers/ichiic/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/modules/i2c/controllers/ichiic/Makefile
==
--- stable/12/sys/modules/i2c/controllers/ichiic/Makefile   Mon Sep 16 
12:51:30 2019(r352389)
+++ stable/12/sys/modules/i2c/controllers/ichiic/Makefile   Mon Sep 16 
12:54:44 2019(r352390)
@@ -6,7 +6,8 @@ SRCS= acpi_if.h device_if.h bus_if.h iicbus_if.h pci
  smbus_if.h ${ig4_acpi} ig4_iic.c ig4_pci.c ig4_reg.h \
  ig4_var.h opt_acpi.h
 
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
+${MACHINE_CPUARCH} == "i386"
 ig4_acpi=  ig4_acpi.c
 .endif
 
___
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: r352388 - in stable/12/sys/compat/linuxkpi/common: include/linux src

2019-09-16 Thread Ed Maste
Author: emaste
Date: Mon Sep 16 12:51:28 2019
New Revision: 352388
URL: https://svnweb.freebsd.org/changeset/base/352388

Log:
  MFC r346445: Enable ioremap for aarch64 in the LinuxKPI
  
  Required for Mellanox drivers (e.g. on Ampere eMAG at Packet.com).
  
  PR:   237055
  Submitted by: Greg V 

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/io.h
  stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/io.h
==
--- stable/12/sys/compat/linuxkpi/common/include/linux/io.h Mon Sep 16 
12:44:44 2019(r352387)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/io.h Mon Sep 16 
12:51:28 2019(r352388)
@@ -350,7 +350,7 @@ _outb(u_char data, u_int port)
 }
 #endif
 
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__)
+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || 
defined(__aarch64__)
 void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr);
 #else
 #define_ioremap_attr(...) NULL

Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Mon Sep 16 
12:44:44 2019(r352387)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Mon Sep 16 
12:51:28 2019(r352388)
@@ -1777,7 +1777,7 @@ vmmap_remove(void *addr)
return (vmmap);
 }
 
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__)
+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || 
defined(__aarch64__)
 void *
 _ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr)
 {
@@ -1800,7 +1800,7 @@ iounmap(void *addr)
vmmap = vmmap_remove(addr);
if (vmmap == NULL)
return;
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__)
+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || 
defined(__aarch64__)
pmap_unmapdev((vm_offset_t)addr, vmmap->vm_size);
 #endif
kfree(vmmap);
___
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: r352389 - head/release/packages

2019-09-16 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep 16 12:51:30 2019
New Revision: 352389
URL: https://svnweb.freebsd.org/changeset/base/352389

Log:
  pkgbase: Move cap_mkdb from runtime to utilities POST-INSTALL
  
  Since login and login.conf moved to the utilities packages move also
  the post-install related commands.
  
  Reported by:  mj-mailingl...@gmx.de
  Reviewed by:  bapt

Added:
  head/release/packages/utilities.ucl   (contents, props changed)
Modified:
  head/release/packages/runtime.ucl

Modified: head/release/packages/runtime.ucl
==
--- head/release/packages/runtime.ucl   Mon Sep 16 12:51:28 2019
(r352388)
+++ head/release/packages/runtime.ucl   Mon Sep 16 12:51:30 2019
(r352389)
@@ -18,7 +18,6 @@ desc = 

svn commit: r352387 - head

2019-09-16 Thread Kyle Evans
Author: kevans
Date: Mon Sep 16 12:44:44 2019
New Revision: 352387
URL: https://svnweb.freebsd.org/changeset/base/352387

Log:
  Fix 20190507 UPDATING entry
  
  The rc mechanism for loading kernel modules is actually called 'kld_list',
  not 'kld_load'
  
  Reported by:  yuripv

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Mon Sep 16 08:18:05 2019(r352386)
+++ head/UPDATING   Mon Sep 16 12:44:44 2019(r352387)
@@ -89,8 +89,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
 
 20190507:
The tap(4) driver has been folded into tun(4), and the module has been
-   renamed to tuntap.  You should update any kld_load="if_tap" or
-   kld_load="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or
+   renamed to tuntap.  You should update any kld_list="if_tap" or
+   kld_list="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or
if_tun_load="YES" entries in /boot/loader.conf to load the if_tuntap
module instead, and "device tap" or "device tun" entries in kernel
config files to select the tuntap device instead.
___
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: r352386 - head/sys/netinet

2019-09-16 Thread Michael Tuexen
Author: tuexen
Date: Mon Sep 16 08:18:05 2019
New Revision: 352386
URL: https://svnweb.freebsd.org/changeset/base/352386

Log:
  Don't write to memory outside of the allocated array for SACK blocks.
  
  Obtained from:rrs@
  MFC after:3 days
  Sponsored by: Netflix, Inc.

Modified:
  head/sys/netinet/tcp_sack.c

Modified: head/sys/netinet/tcp_sack.c
==
--- head/sys/netinet/tcp_sack.c Mon Sep 16 07:31:59 2019(r352385)
+++ head/sys/netinet/tcp_sack.c Mon Sep 16 08:18:05 2019(r352386)
@@ -235,7 +235,7 @@ tcp_update_dsack_list(struct tcpcb *tp, tcp_seq rcv_st
saved_blks[n].start = mid_blk.start;
saved_blks[n++].end = mid_blk.end;
}
-   for (j = 0; (j < tp->rcv_numsacks) && (j < MAX_SACK_BLKS-1); j++) {
+   for (j = 0; (j < tp->rcv_numsacks) && (n < MAX_SACK_BLKS); j++) {
if (((SEQ_LT(tp->sackblks[j].end, mid_blk.start) ||
  SEQ_GT(tp->sackblks[j].start, mid_blk.end)) &&
(SEQ_GT(tp->sackblks[j].start, tp->rcv_nxt
___
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: r352385 - head/bin/sh

2019-09-16 Thread Baptiste Daroussin
Author: bapt
Date: Mon Sep 16 07:31:59 2019
New Revision: 352385
URL: https://svnweb.freebsd.org/changeset/base/352385

Log:
  Do not use our custom completion function, it is not needed anymore

Modified:
  head/bin/sh/histedit.c

Modified: head/bin/sh/histedit.c
==
--- head/bin/sh/histedit.c  Mon Sep 16 06:42:01 2019(r352384)
+++ head/bin/sh/histedit.c  Mon Sep 16 07:31:59 2019(r352385)
@@ -122,7 +122,7 @@ histedit(void)
el_set(el, EL_PROMPT, getprompt);
el_set(el, EL_ADDFN, "sh-complete",
"Filename completion",
-   _el_fn_sh_complete);
+   _el_fn_complete);
} else {
 bad:
out2fmt_flush("sh: can't initialize editing\n");
___
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: r352341 - head/contrib/libedit

2019-09-16 Thread Baptiste Daroussin
On Sat, Sep 14, 2019 at 09:49:43PM +, Dimitry Andric wrote:
> Author: dim
> Date: Sat Sep 14 21:49:42 2019
> New Revision: 352341
> URL: https://svnweb.freebsd.org/changeset/base/352341
> 
> Log:
>   Fix arm and aarch64 builds of libedit after r352275
>   
>   On arm and arm64, where chars are unsigned by default, buildworld dies
>   with:
>   
>   --- terminal.o ---
>   /usr/src/contrib/libedit/terminal.c:569:41: error: comparison of
>   integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
>   'unsigned int') [-Werror,-Wsign-compare]
>el->el_cursor.v][where & 0370] !=
>~~ ^
>   /usr/src/contrib/libedit/terminal.c:659:28: error: comparison of
>   integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
>   'unsigned int') [-Werror,-Wsign-compare]
>[el->el_cursor.h] == MB_FILL_CHAR)
>~ ^  
>   
>   Fix this by making MB_FILL_CHAR a wint_t, so no casting is needed.
>   
>   Note that in https://reviews.freebsd.org/D21584 this was also proposed
>   by Yuichiro Naito .
>   
>   Reviewed by:bapt
>   Subscribers:naito.yuichiro_gmail.com, ml_vishwin.info
>   MFC after:  3 weeks
>   X-MFC-With: r352275
>   Differential Revision: https://reviews.freebsd.org/D21657
> 
Just for completeness it was also approved by christos@NetBSD (upstream)


signature.asc
Description: PGP signature


svn commit: r352384 - head/lib/libc/yp

2019-09-16 Thread Konstantin Belousov
Author: kib
Date: Mon Sep 16 06:42:01 2019
New Revision: 352384
URL: https://svnweb.freebsd.org/changeset/base/352384

Log:
  Increase the size of the send and receive buffers for YP client rpc
  calls to max allowed UDP datagram size.
  
  Since max allowed size both for keys and values where increased, the
  old sizes of around 1K cause ypmatch(3) failures, while plain maps
  fetches work.
  
  The buffers were reduced in r34146 from default UDP rpcclient values
  to 1024/2304 due to the key and value size being 1K.
  
  Reviewed by:  slavash
  Sponsored by: Mellanox Technologies
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D21586

Modified:
  head/lib/libc/yp/yplib.c

Modified: head/lib/libc/yp/yplib.c
==
--- head/lib/libc/yp/yplib.cMon Sep 16 06:23:52 2019(r352383)
+++ head/lib/libc/yp/yplib.cMon Sep 16 06:42:01 2019(r352384)
@@ -526,7 +526,7 @@ gotit:
tv.tv_usec = 0;
ysd->dom_socket = RPC_ANYSOCK;
ysd->dom_client = clntudp_bufcreate(>dom_server_addr,
-   YPPROG, YPVERS, tv, >dom_socket, 1280, 2304);
+   YPPROG, YPVERS, tv, >dom_socket, 65507, 65507);
if (ysd->dom_client == NULL) {
clnt_pcreateerror("clntudp_create");
ysd->dom_vers = -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: r352383 - stable/11/sys/kern

2019-09-16 Thread Konstantin Belousov
Author: kib
Date: Mon Sep 16 06:23:52 2019
New Revision: 352383
URL: https://svnweb.freebsd.org/changeset/base/352383

Log:
  MFC r352059, r352060:
  Make timehands count selectable at boottime.

Modified:
  stable/11/sys/kern/kern_tc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_tc.c
==
--- stable/11/sys/kern/kern_tc.cMon Sep 16 06:22:54 2019
(r352382)
+++ stable/11/sys/kern/kern_tc.cMon Sep 16 06:23:52 2019
(r352383)
@@ -82,19 +82,16 @@ struct timehands {
struct timehands*th_next;
 };
 
-static struct timehands th0;
-static struct timehands th1 = {
-   .th_next = 
-};
-static struct timehands th0 = {
+static struct timehands ths[16] = {
+[0] =  {
.th_counter = _timecounter,
.th_scale = (uint64_t)-1 / 100,
.th_offset = { .sec = 1 },
.th_generation = 1,
-   .th_next = 
+},
 };
 
-static struct timehands *volatile timehands = 
+static struct timehands *volatile timehands = [0];
 struct timecounter *timecounter = _timecounter;
 static struct timecounter *timecounters = _timecounter;
 
@@ -116,6 +113,11 @@ static int timestepwarnings;
 SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW,
 , 0, "Log time steps");
 
+static int timehands_count = 2;
+SYSCTL_INT(_kern_timecounter, OID_AUTO, timehands_count,
+CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
+_count, 0, "Count of timehands in rotation");
+
 struct bintime bt_timethreshold;
 struct bintime bt_tickthreshold;
 sbintime_t sbt_timethreshold;
@@ -1959,7 +1961,26 @@ done:
return (0);
 }
 
+/* Set up the requested number of timehands. */
 static void
+inittimehands(void *dummy)
+{
+   struct timehands *thp;
+   int i;
+
+   TUNABLE_INT_FETCH("kern.timecounter.timehands_count",
+   _count);
+   if (timehands_count < 1)
+   timehands_count = 1;
+   if (timehands_count > nitems(ths))
+   timehands_count = nitems(ths);
+   for (i = 1, thp = [0]; i < timehands_count;  thp = [i++])
+   thp->th_next = [i];
+   thp->th_next = [0];
+}
+SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL);
+
+static void
 inittimecounter(void *dummy)
 {
u_int p;
@@ -1989,6 +2010,7 @@ inittimecounter(void *dummy)
 #ifdef FFCLOCK
ffclock_init();
 #endif
+
/* warm up new timecounter (again) and get rolling. */
(void)timecounter->tc_get_timecount(timecounter);
(void)timecounter->tc_get_timecount(timecounter);
___
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: r352382 - stable/11/include

2019-09-16 Thread Konstantin Belousov
Author: kib
Date: Mon Sep 16 06:22:54 2019
New Revision: 352382
URL: https://svnweb.freebsd.org/changeset/base/352382

Log:
  MFC r352056:
  Make snprintf(3) and vscanf(3) definitions available under appropriate
  POSIX visibility.
  
  PR:   207287

Modified:
  stable/11/include/stdio.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/include/stdio.h
==
--- stable/11/include/stdio.h   Mon Sep 16 06:22:08 2019(r352381)
+++ stable/11/include/stdio.h   Mon Sep 16 06:22:54 2019(r352382)
@@ -293,14 +293,16 @@ intvprintf(const char * __restrict, __va_list);
 int vsprintf(char * __restrict, const char * __restrict,
__va_list);
 
-#if __ISO_C_VISIBLE >= 1999
+#if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 199506
 int snprintf(char * __restrict, size_t, const char * __restrict,
...) __printflike(3, 4);
+int vsnprintf(char * __restrict, size_t, const char * __restrict,
+   __va_list) __printflike(3, 0);
+#endif
+#if __ISO_C_VISIBLE >= 1999
 int vfscanf(FILE * __restrict, const char * __restrict, __va_list)
__scanflike(2, 0);
 int vscanf(const char * __restrict, __va_list) __scanflike(1, 0);
-int vsnprintf(char * __restrict, size_t, const char * __restrict,
-   __va_list) __printflike(3, 0);
 int vsscanf(const char * __restrict, const char * __restrict, __va_list)
__scanflike(2, 0);
 #endif
___
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: r352381 - stable/11/sys/ufs/ffs

2019-09-16 Thread Konstantin Belousov
Author: kib
Date: Mon Sep 16 06:22:08 2019
New Revision: 352381
URL: https://svnweb.freebsd.org/changeset/base/352381

Log:
  MFC r352058:
  Remove some unneeded vfs_busy() calls in SU code.

Modified:
  stable/11/sys/ufs/ffs/ffs_softdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ufs/ffs/ffs_softdep.c
==
--- stable/11/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 06:15:22 2019
(r352380)
+++ stable/11/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 06:22:08 2019
(r352381)
@@ -12429,24 +12429,13 @@ restart:
FREE_LOCK(ump);
if (ffs_vgetf(mp, parentino, LK_NOWAIT | LK_EXCLUSIVE, ,
FFSV_FORCEINSMQ)) {
-   error = vfs_busy(mp, MBF_NOWAIT);
-   if (error != 0) {
-   vfs_ref(mp);
-   VOP_UNLOCK(vp, 0);
-   error = vfs_busy(mp, 0);
-   vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-   vfs_rel(mp);
-   if (error != 0)
-   return (ENOENT);
-   if (vp->v_iflag & VI_DOOMED) {
-   vfs_unbusy(mp);
-   return (ENOENT);
-   }
-   }
+   /*
+* Unmount cannot proceed after unlock because
+* caller must have called vn_start_write().
+*/
VOP_UNLOCK(vp, 0);
error = ffs_vgetf(mp, parentino, LK_EXCLUSIVE,
, FFSV_FORCEINSMQ);
-   vfs_unbusy(mp);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
if (vp->v_iflag & VI_DOOMED) {
if (error == 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: r352380 - stable/12/sys/kern

2019-09-16 Thread Konstantin Belousov
Author: kib
Date: Mon Sep 16 06:15:22 2019
New Revision: 352380
URL: https://svnweb.freebsd.org/changeset/base/352380

Log:
  MFC r352059, r352060:
  Make timehands count selectable at boottime.

Modified:
  stable/12/sys/kern/kern_tc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_tc.c
==
--- stable/12/sys/kern/kern_tc.cMon Sep 16 06:13:29 2019
(r352379)
+++ stable/12/sys/kern/kern_tc.cMon Sep 16 06:15:22 2019
(r352380)
@@ -83,19 +83,16 @@ struct timehands {
struct timehands*th_next;
 };
 
-static struct timehands th0;
-static struct timehands th1 = {
-   .th_next = 
-};
-static struct timehands th0 = {
+static struct timehands ths[16] = {
+[0] =  {
.th_counter = _timecounter,
.th_scale = (uint64_t)-1 / 100,
.th_offset = { .sec = 1 },
.th_generation = 1,
-   .th_next = 
+},
 };
 
-static struct timehands *volatile timehands = 
+static struct timehands *volatile timehands = [0];
 struct timecounter *timecounter = _timecounter;
 static struct timecounter *timecounters = _timecounter;
 
@@ -115,6 +112,11 @@ static int timestepwarnings;
 SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW,
 , 0, "Log time steps");
 
+static int timehands_count = 2;
+SYSCTL_INT(_kern_timecounter, OID_AUTO, timehands_count,
+CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
+_count, 0, "Count of timehands in rotation");
+
 struct bintime bt_timethreshold;
 struct bintime bt_tickthreshold;
 sbintime_t sbt_timethreshold;
@@ -1956,7 +1958,26 @@ done:
return (0);
 }
 
+/* Set up the requested number of timehands. */
 static void
+inittimehands(void *dummy)
+{
+   struct timehands *thp;
+   int i;
+
+   TUNABLE_INT_FETCH("kern.timecounter.timehands_count",
+   _count);
+   if (timehands_count < 1)
+   timehands_count = 1;
+   if (timehands_count > nitems(ths))
+   timehands_count = nitems(ths);
+   for (i = 1, thp = [0]; i < timehands_count;  thp = [i++])
+   thp->th_next = [i];
+   thp->th_next = [0];
+}
+SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL);
+
+static void
 inittimecounter(void *dummy)
 {
u_int p;
@@ -1986,6 +2007,7 @@ inittimecounter(void *dummy)
 #ifdef FFCLOCK
ffclock_init();
 #endif
+
/* warm up new timecounter (again) and get rolling. */
(void)timecounter->tc_get_timecount(timecounter);
(void)timecounter->tc_get_timecount(timecounter);
___
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: r352379 - stable/12/include

2019-09-16 Thread Konstantin Belousov
Author: kib
Date: Mon Sep 16 06:13:29 2019
New Revision: 352379
URL: https://svnweb.freebsd.org/changeset/base/352379

Log:
  MFC r352056:
  Make snprintf(3) and vscanf(3) definitions available under appropriate
  POSIX visibility.
  
  PR:   207287

Modified:
  stable/12/include/stdio.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/include/stdio.h
==
--- stable/12/include/stdio.h   Mon Sep 16 06:12:12 2019(r352378)
+++ stable/12/include/stdio.h   Mon Sep 16 06:13:29 2019(r352379)
@@ -295,14 +295,16 @@ intvprintf(const char * __restrict, __va_list);
 int vsprintf(char * __restrict, const char * __restrict,
__va_list);
 
-#if __ISO_C_VISIBLE >= 1999
+#if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 199506
 int snprintf(char * __restrict, size_t, const char * __restrict,
...) __printflike(3, 4);
+int vsnprintf(char * __restrict, size_t, const char * __restrict,
+   __va_list) __printflike(3, 0);
+#endif
+#if __ISO_C_VISIBLE >= 1999
 int vfscanf(FILE * __restrict, const char * __restrict, __va_list)
__scanflike(2, 0);
 int vscanf(const char * __restrict, __va_list) __scanflike(1, 0);
-int vsnprintf(char * __restrict, size_t, const char * __restrict,
-   __va_list) __printflike(3, 0);
 int vsscanf(const char * __restrict, const char * __restrict, __va_list)
__scanflike(2, 0);
 #endif
___
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: r352378 - stable/12/sys/ufs/ffs

2019-09-16 Thread Konstantin Belousov
Author: kib
Date: Mon Sep 16 06:12:12 2019
New Revision: 352378
URL: https://svnweb.freebsd.org/changeset/base/352378

Log:
  MFC r352058:
  Remove some unneeded vfs_busy() calls in SU code.

Modified:
  stable/12/sys/ufs/ffs/ffs_softdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/ufs/ffs/ffs_softdep.c
==
--- stable/12/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 06:01:06 2019
(r352377)
+++ stable/12/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 06:12:12 2019
(r352378)
@@ -12478,24 +12478,13 @@ restart:
FREE_LOCK(ump);
if (ffs_vgetf(mp, parentino, LK_NOWAIT | LK_EXCLUSIVE, ,
FFSV_FORCEINSMQ)) {
-   error = vfs_busy(mp, MBF_NOWAIT);
-   if (error != 0) {
-   vfs_ref(mp);
-   VOP_UNLOCK(vp, 0);
-   error = vfs_busy(mp, 0);
-   vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-   vfs_rel(mp);
-   if (error != 0)
-   return (ENOENT);
-   if (vp->v_iflag & VI_DOOMED) {
-   vfs_unbusy(mp);
-   return (ENOENT);
-   }
-   }
+   /*
+* Unmount cannot proceed after unlock because
+* caller must have called vn_start_write().
+*/
VOP_UNLOCK(vp, 0);
error = ffs_vgetf(mp, parentino, LK_EXCLUSIVE,
, FFSV_FORCEINSMQ);
-   vfs_unbusy(mp);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
if (vp->v_iflag & VI_DOOMED) {
if (error == 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: r352377 - in stable: 11/contrib/libcxxrt 12/contrib/libcxxrt

2019-09-16 Thread Dimitry Andric
Author: dim
Date: Mon Sep 16 06:01:06 2019
New Revision: 352377
URL: https://svnweb.freebsd.org/changeset/base/352377

Log:
  MFC r352306:
  
  Include  in unwind-arm.h, since it uses uint32_t and uint64_t
  in various declarations.
  
  Otherwise, depending on how unwind-arm.h is included from other source
  files, the compiler may complain that uint32_t and uint64_t are unknown
  types.

Modified:
  stable/12/contrib/libcxxrt/unwind-arm.h
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/libcxxrt/unwind-arm.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/contrib/libcxxrt/unwind-arm.h
==
--- stable/12/contrib/libcxxrt/unwind-arm.h Mon Sep 16 05:28:40 2019
(r352376)
+++ stable/12/contrib/libcxxrt/unwind-arm.h Mon Sep 16 06:01:06 2019
(r352377)
@@ -20,6 +20,9 @@
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */ 
 
+/* For uint32_t and uint64_t */
+#include 
+
 /**
  * ARM-specific unwind definitions.  These are taken from the ARM EHABI
  * specification.
___
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: r352377 - in stable: 11/contrib/libcxxrt 12/contrib/libcxxrt

2019-09-16 Thread Dimitry Andric
Author: dim
Date: Mon Sep 16 06:01:06 2019
New Revision: 352377
URL: https://svnweb.freebsd.org/changeset/base/352377

Log:
  MFC r352306:
  
  Include  in unwind-arm.h, since it uses uint32_t and uint64_t
  in various declarations.
  
  Otherwise, depending on how unwind-arm.h is included from other source
  files, the compiler may complain that uint32_t and uint64_t are unknown
  types.

Modified:
  stable/11/contrib/libcxxrt/unwind-arm.h
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/contrib/libcxxrt/unwind-arm.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/contrib/libcxxrt/unwind-arm.h
==
--- stable/11/contrib/libcxxrt/unwind-arm.h Mon Sep 16 05:28:40 2019
(r352376)
+++ stable/11/contrib/libcxxrt/unwind-arm.h Mon Sep 16 06:01:06 2019
(r352377)
@@ -20,6 +20,9 @@
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */ 
 
+/* For uint32_t and uint64_t */
+#include 
+
 /**
  * ARM-specific unwind definitions.  These are taken from the ARM EHABI
  * specification.
___
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"