svn commit: r320438 - stable/11/sys/kern

2017-06-27 Thread Alan Cox
Author: alc
Date: Wed Jun 28 05:28:15 2017
New Revision: 320438
URL: https://svnweb.freebsd.org/changeset/base/320438

Log:
  MFC r315518
Avoid unnecessary calls to vm_map_protect() in elf_load_section().
  
Typically, when elf_load_section() unconditionally passed VM_PROT_ALL to
elf_map_insert(), it was needlessly enabling execute access on the
mapping, and it would later have to call vm_map_protect() to correct the
mapping's access rights.  Now, instead, elf_load_section() always passes
its parameter "prot" to elf_map_insert().  So, elf_load_section() must
only call vm_map_protect() if it needs to remove the write access that
was temporarily granted to perform a copyout().
  
  Approved by:  re (kib)

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

Modified: stable/11/sys/kern/imgact_elf.c
==
--- stable/11/sys/kern/imgact_elf.c Wed Jun 28 05:21:00 2017
(r320437)
+++ stable/11/sys/kern/imgact_elf.c Wed Jun 28 05:28:15 2017
(r320438)
@@ -596,7 +596,7 @@ __elfN(load_section)(struct image_params *imgp, vm_oof
/* This had damn well better be true! */
if (map_len != 0) {
rv = __elfN(map_insert)(imgp, map, NULL, 0, map_addr,
-   map_addr + map_len, VM_PROT_ALL, 0);
+   map_addr + map_len, prot, 0);
if (rv != KERN_SUCCESS)
return (EINVAL);
}
@@ -617,10 +617,12 @@ __elfN(load_section)(struct image_params *imgp, vm_oof
}
 
/*
-* set it to the specified protection.
+* Remove write access to the page if it was only granted by map_insert
+* to allow copyout.
 */
-   vm_map_protect(map, trunc_page(map_addr), round_page(map_addr +
-   map_len), prot, FALSE);
+   if ((prot & VM_PROT_WRITE) == 0)
+   vm_map_protect(map, trunc_page(map_addr), round_page(map_addr +
+   map_len), prot, FALSE);
 
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: r320437 - stable/10/sys/vm

2017-06-27 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 28 05:21:00 2017
New Revision: 320437
URL: https://svnweb.freebsd.org/changeset/base/320437

Log:
  MFC r320202:
  Call pmap_copy() only for map entries which have the backing object
  instantiated.

Modified:
  stable/10/sys/vm/vm_map.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/vm/vm_map.c
==
--- stable/10/sys/vm/vm_map.c   Wed Jun 28 05:20:28 2017(r320436)
+++ stable/10/sys/vm/vm_map.c   Wed Jun 28 05:21:00 2017(r320437)
@@ -3185,6 +3185,10 @@ vm_map_copy_entry(
fake_entry->next = curthread->td_map_def_user;
curthread->td_map_def_user = fake_entry;
}
+
+   pmap_copy(dst_map->pmap, src_map->pmap,
+   dst_entry->start, dst_entry->end - dst_entry->start,
+   src_entry->start);
} else {
dst_entry->object.vm_object = NULL;
dst_entry->offset = 0;
@@ -3194,9 +3198,6 @@ vm_map_copy_entry(
*fork_charge += size;
}
}
-
-   pmap_copy(dst_map->pmap, src_map->pmap, dst_entry->start,
-   dst_entry->end - dst_entry->start, src_entry->start);
} else {
/*
 * We don't want to make writeable wired pages copy-on-write.
___
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: r320436 - stable/11/sys/vm

2017-06-27 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 28 05:20:28 2017
New Revision: 320436
URL: https://svnweb.freebsd.org/changeset/base/320436

Log:
  MFC r320202:
  Call pmap_copy() only for map entries which have the backing object
  instantiated.
  
  Approved by:  re (delphij)

Modified:
  stable/11/sys/vm/vm_map.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_map.c
==
--- stable/11/sys/vm/vm_map.c   Wed Jun 28 04:53:06 2017(r320435)
+++ stable/11/sys/vm/vm_map.c   Wed Jun 28 05:20:28 2017(r320436)
@@ -3239,6 +3239,10 @@ vm_map_copy_entry(
fake_entry->next = curthread->td_map_def_user;
curthread->td_map_def_user = fake_entry;
}
+
+   pmap_copy(dst_map->pmap, src_map->pmap,
+   dst_entry->start, dst_entry->end - dst_entry->start,
+   src_entry->start);
} else {
dst_entry->object.vm_object = NULL;
dst_entry->offset = 0;
@@ -3248,9 +3252,6 @@ vm_map_copy_entry(
*fork_charge += size;
}
}
-
-   pmap_copy(dst_map->pmap, src_map->pmap, dst_entry->start,
-   dst_entry->end - dst_entry->start, src_entry->start);
} else {
/*
 * We don't want to make writeable wired pages copy-on-write.
___
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: r320435 - stable/10/sys/vm

2017-06-27 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 28 04:53:06 2017
New Revision: 320435
URL: https://svnweb.freebsd.org/changeset/base/320435

Log:
  MFC r320201:
  Assert that the protection of a new map entry is a subset of the max
  protection.

Modified:
  stable/10/sys/vm/vm_map.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/vm/vm_map.c
==
--- stable/10/sys/vm/vm_map.c   Wed Jun 28 04:25:20 2017(r320434)
+++ stable/10/sys/vm/vm_map.c   Wed Jun 28 04:53:06 2017(r320435)
@@ -1143,6 +1143,8 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof
("vm_map_insert: kmem or kernel object and COW"));
KASSERT(object == NULL || (cow & MAP_NOFAULT) == 0,
("vm_map_insert: paradoxical MAP_NOFAULT request"));
+   KASSERT((prot & ~max) == 0,
+   ("prot %#x is not subset of max_prot %#x", prot, max));
 
/*
 * Check that the start and end points are not bogus.
___
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: r320434 - stable/11/sys/vm

2017-06-27 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 28 04:25:20 2017
New Revision: 320434
URL: https://svnweb.freebsd.org/changeset/base/320434

Log:
  MFC r320201:
  Assert that the protection of a new map entry is a subset of the max
  protection.
  
  Approved by:  re (delphij)

Modified:
  stable/11/sys/vm/vm_map.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_map.c
==
--- stable/11/sys/vm/vm_map.c   Wed Jun 28 04:24:10 2017(r320433)
+++ stable/11/sys/vm/vm_map.c   Wed Jun 28 04:25:20 2017(r320434)
@@ -1190,6 +1190,8 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof
("vm_map_insert: kmem or kernel object and COW"));
KASSERT(object == NULL || (cow & MAP_NOFAULT) == 0,
("vm_map_insert: paradoxical MAP_NOFAULT request"));
+   KASSERT((prot & ~max) == 0,
+   ("prot %#x is not subset of max_prot %#x", prot, max));
 
/*
 * Check that the start and end points are not bogus.
___
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: r320433 - head/libexec/rshd

2017-06-27 Thread Xin LI
Author: delphij
Date: Wed Jun 28 04:24:10 2017
New Revision: 320433
URL: https://svnweb.freebsd.org/changeset/base/320433

Log:
  Use strlcpy() instead of strncpy() and nul-terminating.
  
  MFC after:2 weeks

Modified:
  head/libexec/rshd/rshd.c

Modified: head/libexec/rshd/rshd.c
==
--- head/libexec/rshd/rshd.cWed Jun 28 04:23:20 2017(r320432)
+++ head/libexec/rshd/rshd.cWed Jun 28 04:24:10 2017(r320433)
@@ -338,8 +338,7 @@ doit(struct sockaddr *fromp)
pam_err = pam_authenticate(pamh, 0);
if (pam_err == PAM_SUCCESS) {
if ((pam_err = pam_get_user(pamh, , NULL)) == PAM_SUCCESS) {
-   strncpy(luser, cp, sizeof(luser));
-   luser[sizeof(luser) - 1] = '\0';
+   strlcpy(luser, cp, sizeof(luser));
/* XXX truncation! */
}
pam_err = pam_acct_mgmt(pamh, 0);
@@ -386,9 +385,7 @@ doit(struct sockaddr *fromp)
if (lc != NULL && fromp->sa_family == AF_INET) {/*XXX*/
charremote_ip[MAXHOSTNAMELEN];
 
-   strncpy(remote_ip, numericname,
-   sizeof(remote_ip) - 1);
-   remote_ip[sizeof(remote_ip) - 1] = 0;
+   strlcpy(remote_ip, numericname, sizeof(remote_ip));
/* XXX truncation! */
if (!auth_hostok(lc, rhost, remote_ip)) {
syslog(LOG_INFO|LOG_AUTH,
___
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: r320432 - in stable/10/sys: amd64/amd64 amd64/include i386/i386 i386/include

2017-06-27 Thread Alan Cox
Author: alc
Date: Wed Jun 28 04:23:20 2017
New Revision: 320432
URL: https://svnweb.freebsd.org/changeset/base/320432

Log:
  MFC r314310
Refine the fix from r312954.  Specifically, add a new PDE-only flag,
PG_PROMOTED, that indicates whether lingering 4KB page mappings might
need to be flushed on a PDE change that restricts or destroys a 2MB
page mapping.  This flag allows the pmap to avoid range invalidations
that are both unnecessary and costly.

Modified:
  stable/10/sys/amd64/amd64/pmap.c
  stable/10/sys/amd64/include/pmap.h
  stable/10/sys/i386/i386/pmap.c
  stable/10/sys/i386/include/pmap.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/pmap.c
==
--- stable/10/sys/amd64/amd64/pmap.cWed Jun 28 04:19:54 2017
(r320431)
+++ stable/10/sys/amd64/amd64/pmap.cWed Jun 28 04:23:20 2017
(r320432)
@@ -455,6 +455,8 @@ static vm_page_t pmap_enter_quick_locked(pmap_t pmap, 
 vm_page_t m, vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp);
 static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte);
 static int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte);
+static void pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va,
+   pd_entry_t pde);
 static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode);
 static vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va);
 static void pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask);
@@ -1777,6 +1779,27 @@ pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_
 }
 #endif /* !SMP */
 
+static void
+pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va, pd_entry_t pde)
+{
+
+   /*
+* When the PDE has PG_PROMOTED set, the 2MB page mapping was created
+* by a promotion that did not invalidate the 512 4KB page mappings
+* that might exist in the TLB.  Consequently, at this point, the TLB
+* may hold both 4KB and 2MB page mappings for the address range [va,
+* va + NBPDR).  Therefore, the entire range must be invalidated here.
+* In contrast, when PG_PROMOTED is clear, the TLB will not hold any
+* 4KB page mappings for the address range [va, va + NBPDR), and so a
+* single INVLPG suffices to invalidate the 2MB page mapping from the
+* TLB.
+*/
+   if ((pde & PG_PROMOTED) != 0)
+   pmap_invalidate_range(pmap, va, va + NBPDR - 1);
+   else
+   pmap_invalidate_page(pmap, va);
+}
+
 #define PMAP_CLFLUSH_THRESHOLD   (2 * 1024 * 1024)
 
 void
@@ -3418,7 +3441,8 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, v
SLIST_INIT();
sva = trunc_2mpage(va);
pmap_remove_pde(pmap, pde, sva, , lockp);
-   pmap_invalidate_range(pmap, sva, sva + NBPDR - 1);
+   if ((oldpde & PG_G) == 0)
+   pmap_invalidate_pde_page(pmap, sva, oldpde);
pmap_free_zero_pages();
CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#lx"
" in pmap %p", va, pmap);
@@ -3559,25 +3583,8 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offse
oldpde = pte_load_clear(pdq);
if (oldpde & PG_W)
pmap->pm_stats.wired_count -= NBPDR / PAGE_SIZE;
-
-   /*
-* When workaround_erratum383 is false, a promotion to a 2M
-* page mapping does not invalidate the 512 4K page mappings
-* from the TLB.  Consequently, at this point, the TLB may
-* hold both 4K and 2M page mappings.  Therefore, the entire
-* range of addresses must be invalidated here.  In contrast,
-* when workaround_erratum383 is true, a promotion does
-* invalidate the 512 4K page mappings, and so a single INVLPG
-* suffices to invalidate the 2M page mapping.
-*/
-   if ((oldpde & PG_G) != 0) {
-   if (workaround_erratum383)
-   pmap_invalidate_page(kernel_pmap, sva);
-   else
-   pmap_invalidate_range(kernel_pmap, sva,
-   sva + NBPDR - 1);
-   }
-
+   if ((oldpde & PG_G) != 0)
+   pmap_invalidate_pde_page(kernel_pmap, sva, oldpde);
pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE);
if (oldpde & PG_MANAGED) {
CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, oldpde & PG_PS_FRAME);
@@ -3930,16 +3937,16 @@ retry:
if ((prot & VM_PROT_EXECUTE) == 0)
newpde |= pg_nx;
if (newpde != oldpde) {
-   if (!atomic_cmpset_long(pde, oldpde, newpde))
+   /*
+* As an optimization to future operations on this PDE, clear
+* PG_PROMOTED.  The impending invalidation will remove any
+* lingering 4KB page mappings 

svn commit: r320431 - head/usr.sbin/watchdogd

2017-06-27 Thread Xin LI
Author: delphij
Date: Wed Jun 28 04:19:54 2017
New Revision: 320431
URL: https://svnweb.freebsd.org/changeset/base/320431

Log:
  Chase malloc() change by removing lg_chunk malloc_conf settings.
  
  In jemalloc 5, there are no longer chunks, and as configured on
  FreeBSD (the "retain" option defaults to false), the mmap()
  requests are precisely sized for the specific needs, which means
  the virtual memory overhead should be lower for small applications.
  
  Reviewed by:  jasone, ian
  Differential Revision:https://reviews.freebsd.org/D11366

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

Modified: head/usr.sbin/watchdogd/watchdogd.c
==
--- head/usr.sbin/watchdogd/watchdogd.c Wed Jun 28 04:02:36 2017
(r320430)
+++ head/usr.sbin/watchdogd/watchdogd.c Wed Jun 28 04:19:54 2017
(r320431)
@@ -112,14 +112,6 @@ static struct option longopts[] = {
 };
 
 /*
- * Ask malloc() to map minimum-sized chunks of virtual address space at a time,
- * so that mlockall() won't needlessly wire megabytes of unused memory into the
- * process.  This must be done using the malloc_conf string so that it gets set
- * up before the first allocation, which happens before entry to main().
- */
-const char * malloc_conf = "lg_chunk:0";
-
-/*
  * Periodically pat the watchdog, preventing it from firing.
  */
 int
___
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: r320430 - head/sys/vm

2017-06-27 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 28 04:02:36 2017
New Revision: 320430
URL: https://svnweb.freebsd.org/changeset/base/320430

Log:
  Treat the addr argument for mmap(2) request without MAP_FIXED flag as
  a hint.
  
  Right now, for non-fixed mmap(2) calls, addr is de-facto interpreted
  as the absolute minimal address of the range where the mapping is
  created.  The VA allocator only allocates in the range [addr,
  VM_MAXUSER_ADDRESS].  This is too restrictive, the mmap(2) call might
  unduly fail if there is no free addresses above addr but a lot of
  usable space below it.
  
  Lift this implementation limitation by allocating VA in two passes.
  First, try to allocate above addr, as before.  If that fails, do the
  second pass with less restrictive constraints for the start of
  allocation by specifying minimal allocation address at the max bss
  end, if this limit is less than addr.
  
  One important case where this change makes a difference is the
  allocation of the stacks for new threads in libthr.  Under some
  configuration conditions, libthr tries to hint kernel to reuse the
  main thread stack grow area for the new stacks.  This cannot work by
  design now after grow area is converted to stack, and there is no
  unallocated VA above the main stack.  Interpreting requested stack
  base address as the hint provides compatibility with old libthr and
  with (mis-)configured current libthr.
  
  Reviewed by:  alc
  Tested by:dim (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cWed Jun 28 04:01:29 2017(r320429)
+++ head/sys/vm/vm_map.cWed Jun 28 04:02:36 2017(r320430)
@@ -1556,6 +1556,25 @@ again:
return (result);
 }
 
+int
+vm_map_find_min(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
+vm_offset_t *addr, vm_size_t length, vm_offset_t min_addr,
+vm_offset_t max_addr, int find_space, vm_prot_t prot, vm_prot_t max,
+int cow)
+{
+   vm_offset_t hint;
+   int rv;
+
+   hint = *addr;
+   for (;;) {
+   rv = vm_map_find(map, object, offset, addr, length, max_addr,
+   find_space, prot, max, cow);
+   if (rv == KERN_SUCCESS || min_addr >= hint)
+   return (rv);
+   *addr = min_addr;
+   }
+}
+
 /*
  * vm_map_simplify_entry:
  *

Modified: head/sys/vm/vm_map.h
==
--- head/sys/vm/vm_map.hWed Jun 28 04:01:29 2017(r320429)
+++ head/sys/vm/vm_map.hWed Jun 28 04:02:36 2017(r320430)
@@ -372,6 +372,8 @@ vm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_
 int vm_map_delete(vm_map_t, vm_offset_t, vm_offset_t);
 int vm_map_find(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t,
 vm_offset_t, int, vm_prot_t, vm_prot_t, int);
+int vm_map_find_min(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *,
+vm_size_t, vm_offset_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int);
 int vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t,
 vm_prot_t, vm_prot_t, int);
 int vm_map_findspace (vm_map_t, vm_offset_t, vm_size_t, vm_offset_t *);

Modified: head/sys/vm/vm_mmap.c
==
--- head/sys/vm/vm_mmap.c   Wed Jun 28 04:01:29 2017(r320429)
+++ head/sys/vm/vm_mmap.c   Wed Jun 28 04:02:36 2017(r320430)
@@ -1438,10 +1438,12 @@ vm_mmap_object(vm_map_t map, vm_offset_t *addr, vm_siz
 vm_prot_t maxprot, int flags, vm_object_t object, vm_ooffset_t foff,
 boolean_t writecounted, struct thread *td)
 {
-   boolean_t fitit;
+   boolean_t curmap, fitit;
+   vm_offset_t max_addr;
int docow, error, findspace, rv;
 
-   if (map == >td_proc->p_vmspace->vm_map) {
+   curmap = map == >td_proc->p_vmspace->vm_map;
+   if (curmap) {
PROC_LOCK(td->td_proc);
if (map->size + size > lim_cur_proc(td->td_proc, RLIMIT_VMEM)) {
PROC_UNLOCK(td->td_proc);
@@ -1529,11 +1531,20 @@ vm_mmap_object(vm_map_t map, vm_offset_t *addr, vm_siz
MAP_ALIGNMENT_SHIFT);
else
findspace = VMFS_OPTIMAL_SPACE;
-   rv = vm_map_find(map, object, foff, addr, size,
+   max_addr = 0;
 #ifdef MAP_32BIT
-   flags & MAP_32BIT ? MAP_32BIT_MAX_ADDR :
+   if ((flags & MAP_32BIT) != 0)
+   max_addr = MAP_32BIT_MAX_ADDR;
 #endif
-   0, findspace, prot, maxprot, docow);
+   if (curmap) {
+   rv = vm_map_find_min(map, object, foff, addr, size,
+   

svn commit: r320429 - in stable/11/sys: amd64/amd64 amd64/include i386/i386 i386/include

2017-06-27 Thread Alan Cox
Author: alc
Date: Wed Jun 28 04:01:29 2017
New Revision: 320429
URL: https://svnweb.freebsd.org/changeset/base/320429

Log:
  MFC r314310
Refine the fix from r312954.  Specifically, add a new PDE-only flag,
PG_PROMOTED, that indicates whether lingering 4KB page mappings might
need to be flushed on a PDE change that restricts or destroys a 2MB
page mapping.  This flag allows the pmap to avoid range invalidations
that are both unnecessary and costly.
  
  Approved by:  re (kib)

Modified:
  stable/11/sys/amd64/amd64/pmap.c
  stable/11/sys/amd64/include/pmap.h
  stable/11/sys/i386/i386/pmap.c
  stable/11/sys/i386/include/pmap.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/amd64/pmap.c
==
--- stable/11/sys/amd64/amd64/pmap.cWed Jun 28 02:30:32 2017
(r320428)
+++ stable/11/sys/amd64/amd64/pmap.cWed Jun 28 04:01:29 2017
(r320429)
@@ -613,6 +613,8 @@ static vm_page_t pmap_enter_quick_locked(pmap_t pmap, 
 vm_page_t m, vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp);
 static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte);
 static int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte);
+static void pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va,
+   pd_entry_t pde);
 static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode);
 static void pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask);
 static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
@@ -1838,6 +1840,27 @@ pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_
 }
 #endif /* !SMP */
 
+static void
+pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va, pd_entry_t pde)
+{
+
+   /*
+* When the PDE has PG_PROMOTED set, the 2MB page mapping was created
+* by a promotion that did not invalidate the 512 4KB page mappings
+* that might exist in the TLB.  Consequently, at this point, the TLB
+* may hold both 4KB and 2MB page mappings for the address range [va,
+* va + NBPDR).  Therefore, the entire range must be invalidated here.
+* In contrast, when PG_PROMOTED is clear, the TLB will not hold any
+* 4KB page mappings for the address range [va, va + NBPDR), and so a
+* single INVLPG suffices to invalidate the 2MB page mapping from the
+* TLB.
+*/
+   if ((pde & PG_PROMOTED) != 0)
+   pmap_invalidate_range(pmap, va, va + NBPDR - 1);
+   else
+   pmap_invalidate_page(pmap, va);
+}
+
 #define PMAP_CLFLUSH_THRESHOLD   (2 * 1024 * 1024)
 
 void
@@ -3472,7 +3495,8 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, v
SLIST_INIT();
sva = trunc_2mpage(va);
pmap_remove_pde(pmap, pde, sva, , lockp);
-   pmap_invalidate_range(pmap, sva, sva + NBPDR - 1);
+   if ((oldpde & PG_G) == 0)
+   pmap_invalidate_pde_page(pmap, sva, oldpde);
pmap_free_zero_pages();
CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#lx"
" in pmap %p", va, pmap);
@@ -3612,25 +3636,8 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offse
oldpde = pte_load_clear(pdq);
if (oldpde & PG_W)
pmap->pm_stats.wired_count -= NBPDR / PAGE_SIZE;
-
-   /*
-* When workaround_erratum383 is false, a promotion to a 2M
-* page mapping does not invalidate the 512 4K page mappings
-* from the TLB.  Consequently, at this point, the TLB may
-* hold both 4K and 2M page mappings.  Therefore, the entire
-* range of addresses must be invalidated here.  In contrast,
-* when workaround_erratum383 is true, a promotion does
-* invalidate the 512 4K page mappings, and so a single INVLPG
-* suffices to invalidate the 2M page mapping.
-*/
-   if ((oldpde & PG_G) != 0) {
-   if (workaround_erratum383)
-   pmap_invalidate_page(kernel_pmap, sva);
-   else
-   pmap_invalidate_range(kernel_pmap, sva,
-   sva + NBPDR - 1);
-   }
-
+   if ((oldpde & PG_G) != 0)
+   pmap_invalidate_pde_page(kernel_pmap, sva, oldpde);
pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE);
if (oldpde & PG_MANAGED) {
CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, oldpde & PG_PS_FRAME);
@@ -4010,16 +4017,16 @@ retry:
if ((prot & VM_PROT_EXECUTE) == 0)
newpde |= pg_nx;
if (newpde != oldpde) {
-   if (!atomic_cmpset_long(pde, oldpde, newpde))
+   /*
+* As an optimization to future operations on this PDE, clear
+* PG_PROMOTED.  The impending invalidation will remove any
+ 

Re: svn commit: r320043 - in head: contrib/netbsd-tests/kernel/kqueue lib/libc/include lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/kqueue/libkqueue usr.bin/truss

2017-06-27 Thread Konstantin Belousov
On Tue, Jun 27, 2017 at 10:55:10PM +0200, Andreas Tobler wrote:
> On 27.06.17 22:43, Konstantin Belousov wrote:
> > On Tue, Jun 27, 2017 at 10:21:42PM +0200, Andreas Tobler wrote:
> >> Hi Kib,
> >>
> >> On 17.06.17 02:57, Konstantin Belousov wrote:
> >>> Author: kib
> >>> Date: Sat Jun 17 00:57:26 2017
> >>> New Revision: 320043
> >>> URL: https://svnweb.freebsd.org/changeset/base/320043
> >>>
> >>> Log:
> >>> Add abstime kqueue(2) timers and expand struct kevent members.
> >>> 
> >>> This change implements NOTE_ABSTIME flag for EVFILT_TIMER, which
> >>> specifies that the data field contains absolute time to fire the
> >>> event.
> >>> 
> >>> To make this useful, data member of the struct kevent must be extended
> >>> to 64bit.  Using the opportunity, I also added ext members.  This
> >>> changes struct kevent almost to Apple struct kevent64, except I did
> >>> not changed type of ident and udata, the later would cause serious API
> >>> incompatibilities.
> >>> 
> >>> The type of ident was kept uintptr_t since EVFILT_AIO returns a
> >>> pointer in this field, and e.g. CHERI is sensitive to the type
> >>> (discussed with brooks, jhb).
> >>> 
> >>> Unlike Apple kevent64, symbol versioning allows us to claim ABI
> >>> compatibility and still name the new syscall kevent(2).  Compat shims
> >>> are provided for both host native and compat32.
> >>> 
> >>> Requested by: bapt
> >>> Reviewed by:  bapt, brooks, ngie (previous version)
> >>> Sponsored by: The FreeBSD Foundation
> >>> Differential revision:https://reviews.freebsd.org/D11025
> >>
> >> This, or one of the following commits breaks my nfs mounts on powerpc64.
> >> With the following I mean, 320044-46. The last working revision is 320038.
> >>
> >> With this revision I get this error:
> >>
> >> RPCPROG_NFS: RPC: Port mapper failure - RPC: Unable to receive
> >>
> >> Boot is ok beside not having nfs.
> >>
> >> Right now I build the latest trunk to be sure to test against jhibbit's
> >> latest commit in this area. But I do not expect a change.
> >>
> >> Any idea where to look for suspects?
> > 
> > Start with ktrace-ing the mount command, assuming the direct invocation of
> > mount_nfs(8) fails.
> 
> Hm, if you could give me some hands-on? How do I do that?
mount_nfs server:/path /mnt
If this fails with an RPC error, run it under ktrace and then show
me kdump.

Right now I do not undestand where does your error occur.  Are you able
to boot single-user ?

> 
> > Did you rebuilt the world after the update ?  It should work both ways,
> > but knowing the answer trims half of the change for suspect.
> 
> I built world and kernel in a clean env. rm -rf the obj part.
> The whole boot is done via nfs. I do boot the tree via netboot, 
> crossbuilt on amd64. The machine is shot I can not boot from disk atm.
> 
> With the r320421, the picture is the same, as expected.
> 
> > Can you run the ktrace tests on ppc ?
> > cd tests/sys/kqueue/libkqueue/
> > make
> > ./kqtest
> 
> This is chicken and egg, my src is on the nfs drive :(
It is enough to checkout the libkqueue directory alone for this test
to build and run.  You can probably squeeze it into your boot nfs mount.
___
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: r320428 - head/contrib/ipfilter/tools

2017-06-27 Thread Cy Schubert
Author: cy
Date: Wed Jun 28 02:30:32 2017
New Revision: 320428
URL: https://svnweb.freebsd.org/changeset/base/320428

Log:
  In poolnodecommand() (ippool -a and ippool -r) -m (pool name) is not
  optional.

Modified:
  head/contrib/ipfilter/tools/ippool.c

Modified: head/contrib/ipfilter/tools/ippool.c
==
--- head/contrib/ipfilter/tools/ippool.cWed Jun 28 00:50:51 2017
(r320427)
+++ head/contrib/ipfilter/tools/ippool.cWed Jun 28 02:30:32 2017
(r320428)
@@ -75,7 +75,7 @@ usage(prog)
char *prog;
 {
fprintf(stderr, "Usage:\t%s\n", prog);
-   fprintf(stderr, "\t-a [-dnv] [-m ] [-o ] [-t type] [-T ttl] 
-i [/netmask]\n");
+   fprintf(stderr, "\t-a [-dnv] -m  [-o ] [-t type] [-T ttl] 
-i [/netmask]\n");
fprintf(stderr, "\t-A [-dnv] [-m ] [-o ] [-S ] [-t 
]\n");
fprintf(stderr, "\t-f  [-dnuv]\n");
fprintf(stderr, "\t-F [-dv] [-o ] [-t ]\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: r320427 - head/usr.bin/calendar/calendars

2017-06-27 Thread Greg Lehey
Author: grog
Date: Wed Jun 28 00:50:51 2017
New Revision: 320427
URL: https://svnweb.freebsd.org/changeset/base/320427

Log:
  Spelling.

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

Modified: head/usr.bin/calendar/calendars/calendar.history
==
--- head/usr.bin/calendar/calendars/calendar.historyTue Jun 27 22:05:06 
2017(r320426)
+++ head/usr.bin/calendar/calendars/calendar.historyWed Jun 28 00:50:51 
2017(r320427)
@@ -190,7 +190,7 @@
 06/26  Toothbrush invented, 1498
 06/27  100 degrees, Fort Yukon, 1915
 06/27  Bill Graham closes the Fillmore East, 1971
-06/28  Supreme Court decides in favor of Alan Bakke, 1978
+06/28  Supreme Court decides in favor of Allan Bakke, 1978
 06/30  "That" explosion in Siberia, 1908
 06/30  China and Soviet Union announce split over ideology, 1960
 07/01  Battle of Gettysburg begins, 1863
___
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: r320426 - head/sys/dev/cxgbe/tom

2017-06-27 Thread Navdeep Parhar
Author: np
Date: Tue Jun 27 22:05:06 2017
New Revision: 320426
URL: https://svnweb.freebsd.org/changeset/base/320426

Log:
  cxgbe/t4_tom: Do not include space taken by the TCP timestamp option in
  the "effective MSS" for the connection.  The chip expects it this way.
  
  Submitted by: Krishnamraju Eraparaju @ Chelsio
  MFC after:3 days
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Tue Jun 27 20:24:44 2017
(r320425)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Tue Jun 27 22:05:06 2017
(r320426)
@@ -332,6 +332,8 @@ assign_rxopt(struct tcpcb *tp, unsigned int opt)
n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
else
n = sizeof(struct ip) + sizeof(struct tcphdr);
+   if (V_tcp_do_rfc1323)
+   n += TCPOLEN_TSTAMP_APPA;
tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(opt)] - n;
 
CTR4(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u)", __func__, toep->tid,
___
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: r320043 - in head: contrib/netbsd-tests/kernel/kqueue lib/libc/include lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/kqueue/libkqueue usr.bin/truss

2017-06-27 Thread Andreas Tobler

On 27.06.17 22:43, Konstantin Belousov wrote:

On Tue, Jun 27, 2017 at 10:21:42PM +0200, Andreas Tobler wrote:

Hi Kib,

On 17.06.17 02:57, Konstantin Belousov wrote:

Author: kib
Date: Sat Jun 17 00:57:26 2017
New Revision: 320043
URL: https://svnweb.freebsd.org/changeset/base/320043

Log:
Add abstime kqueue(2) timers and expand struct kevent members.

This change implements NOTE_ABSTIME flag for EVFILT_TIMER, which

specifies that the data field contains absolute time to fire the
event.

To make this useful, data member of the struct kevent must be extended

to 64bit.  Using the opportunity, I also added ext members.  This
changes struct kevent almost to Apple struct kevent64, except I did
not changed type of ident and udata, the later would cause serious API
incompatibilities.

The type of ident was kept uintptr_t since EVFILT_AIO returns a

pointer in this field, and e.g. CHERI is sensitive to the type
(discussed with brooks, jhb).

Unlike Apple kevent64, symbol versioning allows us to claim ABI

compatibility and still name the new syscall kevent(2).  Compat shims
are provided for both host native and compat32.

Requested by:	bapt

Reviewed by:bapt, brooks, ngie (previous version)
Sponsored by:   The FreeBSD Foundation
Differential revision:  https://reviews.freebsd.org/D11025


This, or one of the following commits breaks my nfs mounts on powerpc64.
With the following I mean, 320044-46. The last working revision is 320038.

With this revision I get this error:

RPCPROG_NFS: RPC: Port mapper failure - RPC: Unable to receive

Boot is ok beside not having nfs.

Right now I build the latest trunk to be sure to test against jhibbit's
latest commit in this area. But I do not expect a change.

Any idea where to look for suspects?


Start with ktrace-ing the mount command, assuming the direct invocation of
mount_nfs(8) fails.


Hm, if you could give me some hands-on? How do I do that?


Did you rebuilt the world after the update ?  It should work both ways,
but knowing the answer trims half of the change for suspect.


I built world and kernel in a clean env. rm -rf the obj part.
The whole boot is done via nfs. I do boot the tree via netboot, 
crossbuilt on amd64. The machine is shot I can not boot from disk atm.


With the r320421, the picture is the same, as expected.


Can you run the ktrace tests on ppc ?
cd tests/sys/kqueue/libkqueue/
make
./kqtest


This is chicken and egg, my src is on the nfs drive :(

I'll check-out a src tree on this machine tomorrow and do test build/run.

Thx for the feedback!
Andreas

___
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: r320043 - in head: contrib/netbsd-tests/kernel/kqueue lib/libc/include lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/kqueue/libkqueue usr.bin/truss

2017-06-27 Thread Konstantin Belousov
On Tue, Jun 27, 2017 at 10:21:42PM +0200, Andreas Tobler wrote:
> Hi Kib,
> 
> On 17.06.17 02:57, Konstantin Belousov wrote:
> > Author: kib
> > Date: Sat Jun 17 00:57:26 2017
> > New Revision: 320043
> > URL: https://svnweb.freebsd.org/changeset/base/320043
> > 
> > Log:
> >Add abstime kqueue(2) timers and expand struct kevent members.
> >
> >This change implements NOTE_ABSTIME flag for EVFILT_TIMER, which
> >specifies that the data field contains absolute time to fire the
> >event.
> >
> >To make this useful, data member of the struct kevent must be extended
> >to 64bit.  Using the opportunity, I also added ext members.  This
> >changes struct kevent almost to Apple struct kevent64, except I did
> >not changed type of ident and udata, the later would cause serious API
> >incompatibilities.
> >
> >The type of ident was kept uintptr_t since EVFILT_AIO returns a
> >pointer in this field, and e.g. CHERI is sensitive to the type
> >(discussed with brooks, jhb).
> >
> >Unlike Apple kevent64, symbol versioning allows us to claim ABI
> >compatibility and still name the new syscall kevent(2).  Compat shims
> >are provided for both host native and compat32.
> >
> >Requested by:bapt
> >Reviewed by: bapt, brooks, ngie (previous version)
> >Sponsored by:The FreeBSD Foundation
> >Differential revision:   https://reviews.freebsd.org/D11025
> 
> This, or one of the following commits breaks my nfs mounts on powerpc64. 
> With the following I mean, 320044-46. The last working revision is 320038.
> 
> With this revision I get this error:
> 
> RPCPROG_NFS: RPC: Port mapper failure - RPC: Unable to receive
> 
> Boot is ok beside not having nfs.
> 
> Right now I build the latest trunk to be sure to test against jhibbit's 
> latest commit in this area. But I do not expect a change.
> 
> Any idea where to look for suspects?

Start with ktrace-ing the mount command, assuming the direct invocation of
mount_nfs(8) fails.

Did you rebuilt the world after the update ?  It should work both ways,
but knowing the answer trims half of the change for suspect.

Can you run the ktrace tests on ppc ?
cd tests/sys/kqueue/libkqueue/
make
./kqtest
___
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: r320424 - head/sys/dev/nvme

2017-06-27 Thread Warner Losh
Author: imp
Date: Tue Jun 27 20:24:39 2017
New Revision: 320424
URL: https://svnweb.freebsd.org/changeset/base/320424

Log:
  Add new definitions for namespaces.
  
  Sponsored by: Netflix
  Submitted by: Matt Williams (via D11330)

Modified:
  head/sys/dev/nvme/nvme.h

Modified: head/sys/dev/nvme/nvme.h
==
--- head/sys/dev/nvme/nvme.hTue Jun 27 20:24:25 2017(r320423)
+++ head/sys/dev/nvme/nvme.hTue Jun 27 20:24:39 2017(r320424)
@@ -341,9 +341,11 @@ enum nvme_admin_opcode {
NVME_OPC_GET_FEATURES   = 0x0a,
/* 0x0b - reserved */
NVME_OPC_ASYNC_EVENT_REQUEST= 0x0c,
-   /* 0x0d-0x0f - reserved */
+   NVME_OPC_NAMESPACE_MANAGEMENT   = 0x0d,
+   /* 0x0e-0x0f - reserved */
NVME_OPC_FIRMWARE_ACTIVATE  = 0x10,
NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD= 0x11,
+   NVME_OPC_NAMESPACE_ATTACHMENT   = 0x15,
 
NVME_OPC_FORMAT_NVM = 0x80,
NVME_OPC_SECURITY_SEND  = 0x81,
@@ -456,8 +458,11 @@ struct nvme_controller_data {
/** maximum data transfer size */
uint8_t mdts;
 
-   uint8_t reserved1[178];
+   /** Controller ID */
+   uint16_tctrlr_id;
 
+   uint8_t reserved1[176];
+
/* bytes 256-511: admin command set attributes */
 
/** optional admin command support */
@@ -471,7 +476,10 @@ struct nvme_controller_data {
/* supports firmware activate/download commands */
uint16_tfirmware  : 1;
 
-   uint16_toacs_rsvd : 13;
+   /* supports namespace management commands */
+   uint16_tnsmgmt: 1;
+
+   uint16_toacs_rsvd : 12;
} __packed oacs;
 
/** abort command limit */
@@ -513,8 +521,16 @@ struct nvme_controller_data {
uint8_t avscc_rsvd  : 7;
} __packed avscc;
 
-   uint8_t reserved2[247];
+   uint8_t reserved2[15];
 
+   /** Name space capabilities  */
+   struct {
+   /* if nsmgmt, report tnvmcap and unvmcap */
+   uint8_ttnvmcap[16];
+   uint8_tunvmcap[16];
+   } __packed untncap;
+
+   uint8_t reserved3[200];
/* bytes 512-703: nvm command set attributes */
 
/** submission queue entry size */
@@ -529,7 +545,7 @@ struct nvme_controller_data {
uint8_t max : 4;
} __packed cqes;
 
-   uint8_t reserved3[2];
+   uint8_t reserved4[2];
 
/** number of namespaces */
uint32_tnn;
@@ -555,10 +571,10 @@ struct nvme_controller_data {
} __packed vwc;
 
/* TODO: flesh out remaining nvm command set attributes */
-   uint8_t reserved4[178];
+   uint8_t reserved5[178];
 
/* bytes 704-2047: i/o command set attributes */
-   uint8_t reserved5[1344];
+   uint8_t reserved6[1344];
 
/* bytes 2048-3071: power state descriptors */
struct nvme_power_state power_state[32];
___
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: r320425 - head/sbin/nvmecontrol

2017-06-27 Thread Warner Losh
Author: imp
Date: Tue Jun 27 20:24:44 2017
New Revision: 320425
URL: https://svnweb.freebsd.org/changeset/base/320425

Log:
  Report some aspects of namespaces and namespace support in identify
  command.
  
  Sponsored by: Netflix
  Submitted by: Matt Williams (via D11330)

Modified:
  head/sbin/nvmecontrol/identify.c

Modified: head/sbin/nvmecontrol/identify.c
==
--- head/sbin/nvmecontrol/identify.cTue Jun 27 20:24:39 2017
(r320424)
+++ head/sbin/nvmecontrol/identify.cTue Jun 27 20:24:44 2017
(r320425)
@@ -44,6 +44,7 @@ static void
 print_controller(struct nvme_controller_data *cdata)
 {
uint8_t str[128];
+   char cbuf[UINT128_DIG + 1];
 
printf("Controller Capabilities/Features\n");
printf("\n");
@@ -65,8 +66,8 @@ print_controller(struct nvme_controller_data *cdata)
printf("Unlimited\n");
else
printf("%d\n", PAGE_SIZE * (1 << cdata->mdts));
-   printf("\n");
 
+   printf("\n");
printf("Admin Command Set Attributes\n");
printf("\n");
printf("Security Send/Receive:   %s\n",
@@ -75,6 +76,8 @@ print_controller(struct nvme_controller_data *cdata)
cdata->oacs.format ? "Supported" : "Not Supported");
printf("Firmware Activate/Download:  %s\n",
cdata->oacs.firmware ? "Supported" : "Not Supported");
+   printf("Namespace Managment: %s\n",
+  cdata->oacs.nsmgmt ? "Supported" : "Not Supported");
printf("Abort Command Limit: %d\n", cdata->acl+1);
printf("Async Event Request Limit:   %d\n", cdata->aerl+1);
printf("Number of Firmware Slots:");
@@ -91,8 +94,8 @@ print_controller(struct nvme_controller_data *cdata)
cdata->lpa.ns_smart ? "Yes" : "No");
printf("Error Log Page Entries:  %d\n", cdata->elpe+1);
printf("Number of Power States:  %d\n", cdata->npss+1);
-   printf("\n");
 
+   printf("\n");
printf("NVM Command Set Attributes\n");
printf("==\n");
printf("Submission Queue Entry Size\n");
@@ -110,6 +113,16 @@ print_controller(struct nvme_controller_data *cdata)
cdata->oncs.dsm ? "Supported" : "Not Supported");
printf("Volatile Write Cache:%s\n",
cdata->vwc.present ? "Present" : "Not Present");
+
+   if (cdata->oacs.nsmgmt) {
+   printf("\n");
+   printf("Namespace Drive Attributes\n");
+   printf("==\n");
+   printf("NVM total cap:   %s\n",
+  uint128_to_str(to128(cdata->untncap.tnvmcap), cbuf, 
sizeof(cbuf)));
+   printf("NVM unallocated cap: %s\n",
+  uint128_to_str(to128(cdata->untncap.unvmcap), cbuf, 
sizeof(cbuf)));
+   }
 }
 
 static 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: r320423 - head/sbin/nvmecontrol

2017-06-27 Thread Warner Losh
Author: imp
Date: Tue Jun 27 20:24:25 2017
New Revision: 320423
URL: https://svnweb.freebsd.org/changeset/base/320423

Log:
  Move 128-bit integer routines to util.c so they can be used by more
  than just the log page code.
  
  Sponsored by: Netflix, Inc
  Submitted by: Matt Williams (via D11330)

Added:
  head/sbin/nvmecontrol/util.c   (contents, props changed)
Modified:
  head/sbin/nvmecontrol/Makefile
  head/sbin/nvmecontrol/logpage.c
  head/sbin/nvmecontrol/nvmecontrol.h

Modified: head/sbin/nvmecontrol/Makefile
==
--- head/sbin/nvmecontrol/Makefile  Tue Jun 27 20:12:13 2017
(r320422)
+++ head/sbin/nvmecontrol/Makefile  Tue Jun 27 20:24:25 2017
(r320423)
@@ -3,7 +3,7 @@
 PACKAGE=runtime
 PROG=  nvmecontrol
 SRCS=  nvmecontrol.c devlist.c firmware.c identify.c logpage.c \
-   perftest.c reset.c nvme_util.c power.c wdc.c
+   perftest.c reset.c nvme_util.c power.c util.c wdc.c
 MAN=   nvmecontrol.8
 
 .PATH: ${SRCTOP}/sys/dev/nvme

Modified: head/sbin/nvmecontrol/logpage.c
==
--- head/sbin/nvmecontrol/logpage.c Tue Jun 27 20:12:13 2017
(r320422)
+++ head/sbin/nvmecontrol/logpage.c Tue Jun 27 20:24:25 2017
(r320423)
@@ -80,54 +80,6 @@ print_bin(void *data, uint32_t length)
write(STDOUT_FILENO, data, length);
 }
 
-/*
- * 128-bit integer augments to standard values. On i386 this
- * doesn't exist, so we use 64-bit values. The 128-bit counters
- * are crazy anyway, since for this purpose, you'd need a
- * billion IOPs for billions of seconds to overflow them.
- * So, on 32-bit i386, you'll get truncated values.
- */
-#define UINT128_DIG39
-#ifdef __i386__
-typedef uint64_t uint128_t;
-#else
-typedef __uint128_t uint128_t;
-#endif
-
-static inline uint128_t
-to128(void *p)
-{
-   return *(uint128_t *)p;
-}
-
-static char *
-uint128_to_str(uint128_t u, char *buf, size_t buflen)
-{
-   char *end = buf + buflen - 1;
-
-   *end-- = '\0';
-   if (u == 0)
-   *end-- = '0';
-   while (u && end >= buf) {
-   *end-- = u % 10 + '0';
-   u /= 10;
-   }
-   end++;
-   if (u != 0)
-   return NULL;
-
-   return end;
-}
-
-/* "Missing" from endian.h */
-static __inline uint64_t
-le48dec(const void *pp)
-{
-   uint8_t const *p = (uint8_t const *)pp;
-
-   return (((uint64_t)le16dec(p + 4) << 32) | le32dec(p));
-}
-
 static void *
 get_log_buffer(uint32_t size)
 {

Modified: head/sbin/nvmecontrol/nvmecontrol.h
==
--- head/sbin/nvmecontrol/nvmecontrol.h Tue Jun 27 20:12:13 2017
(r320422)
+++ head/sbin/nvmecontrol/nvmecontrol.h Tue Jun 27 20:24:25 2017
(r320423)
@@ -88,5 +88,27 @@ void read_logpage(int fd, uint8_t log_page, int nsid, 
 void gen_usage(struct nvme_function *);
 void dispatch(int argc, char *argv[], struct nvme_function *f);
 
+/* Utility Routines */
+/*
+ * 128-bit integer augments to standard values. On i386 this
+ * doesn't exist, so we use 64-bit values. So, on 32-bit i386,
+ * you'll get truncated values until someone implement 128bit
+ * ints in sofware.
+ */
+#define UINT128_DIG39
+#ifdef __i386__
+typedef uint64_t uint128_t;
+#else
+typedef __uint128_t uint128_t;
 #endif
 
+static __inline uint128_t
+to128(void *p)
+{
+   return *(uint128_t *)p;
+}
+
+uint64_t le48dec(const void *pp);
+char * uint128_to_str(uint128_t u, char *buf, size_t buflen);
+
+#endif

Added: head/sbin/nvmecontrol/util.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sbin/nvmecontrol/util.cTue Jun 27 20:24:25 2017
(r320423)
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2017 Netflix, Inc
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, 

Re: svn commit: r320043 - in head: contrib/netbsd-tests/kernel/kqueue lib/libc/include lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/kqueue/libkqueue usr.bin/truss

2017-06-27 Thread Andreas Tobler

Hi Kib,

On 17.06.17 02:57, Konstantin Belousov wrote:

Author: kib
Date: Sat Jun 17 00:57:26 2017
New Revision: 320043
URL: https://svnweb.freebsd.org/changeset/base/320043

Log:
   Add abstime kqueue(2) timers and expand struct kevent members.
   
   This change implements NOTE_ABSTIME flag for EVFILT_TIMER, which

   specifies that the data field contains absolute time to fire the
   event.
   
   To make this useful, data member of the struct kevent must be extended

   to 64bit.  Using the opportunity, I also added ext members.  This
   changes struct kevent almost to Apple struct kevent64, except I did
   not changed type of ident and udata, the later would cause serious API
   incompatibilities.
   
   The type of ident was kept uintptr_t since EVFILT_AIO returns a

   pointer in this field, and e.g. CHERI is sensitive to the type
   (discussed with brooks, jhb).
   
   Unlike Apple kevent64, symbol versioning allows us to claim ABI

   compatibility and still name the new syscall kevent(2).  Compat shims
   are provided for both host native and compat32.
   
   Requested by:	bapt

   Reviewed by: bapt, brooks, ngie (previous version)
   Sponsored by:The FreeBSD Foundation
   Differential revision:   https://reviews.freebsd.org/D11025


This, or one of the following commits breaks my nfs mounts on powerpc64. 
With the following I mean, 320044-46. The last working revision is 320038.


With this revision I get this error:

RPCPROG_NFS: RPC: Port mapper failure - RPC: Unable to receive

Boot is ok beside not having nfs.

Right now I build the latest trunk to be sure to test against jhibbit's 
latest commit in this area. But I do not expect a change.


Any idea where to look for suspects?

TIA,
Andreas
___
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: r320422 - head/sys/kern

2017-06-27 Thread Konstantin Belousov
Author: kib
Date: Tue Jun 27 20:12:13 2017
New Revision: 320422
URL: https://svnweb.freebsd.org/changeset/base/320422

Log:
  Do not ignore an error from vm_mmap_object().
  
  Found and reviewed by:alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/uipc_shm.c

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cTue Jun 27 19:26:02 2017(r320421)
+++ head/sys/kern/uipc_shm.cTue Jun 27 20:12:13 2017(r320422)
@@ -926,7 +926,7 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *a
shmfd->shm_object, foff, FALSE, td);
if (error != 0)
vm_object_deallocate(shmfd->shm_object);
-   return (0);
+   return (error);
 }
 
 static int
___
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: r320421 - head/sys/cam

2017-06-27 Thread Kenneth D. Merry
Author: ken
Date: Tue Jun 27 19:26:02 2017
New Revision: 320421
URL: https://svnweb.freebsd.org/changeset/base/320421

Log:
  Fix a panic in camperiphfree().
  
  If a peripheral driver (e.g. da, sa, cd) is added or removed from the
  peripheral driver list while an unrelated peripheral driver instance (e.g.
  da0, sa5, cd2) is going away and is inside camperiphfree(), we could
  dereference an invalid pointer.
  
  When peripheral drivers are added or removed (see periphdriver_register()
  and periphdriver_unregister()), the peripheral driver array is resized
  and existing entries are moved.
  
  Although we hold the topology lock while we traverse the peripheral driver
  list, we retain a pointer to the location of the peripheral driver pointer
  and then drop the topology lock.  So we are still vulnerable to the list
  getting moved around while the lock is dropped.
  
  To solve the problem, cache a copy of the peripheral driver pointer.  If
  its storage location in the list changes while we have the lock dropped, it
  won't have any effect.
  
  This doesn't solve the issue that peripheral drivers ("da", "cd", as opposed
  to individual instances like "da0", "cd0") are not generally part of a
  reference counting scheme to guard against deregistering them while there
  are instances active.  The caller (generally the person unloading a module)
  has to be aware of active drivers and not unload something that is in use.
  
  sys/cam/cam_periph.c:
In camperiphfree(), cache a pointer to the peripheral driver
instance to avoid holding a pointer to an invalid memory location
in the event that the peripheral driver list changes while we have
the topology lock dropped.
  
  PR:   kern/219701
  Submitted by: avg
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Tue Jun 27 17:55:25 2017(r320420)
+++ head/sys/cam/cam_periph.c   Tue Jun 27 19:26:02 2017(r320421)
@@ -661,6 +661,7 @@ static void
 camperiphfree(struct cam_periph *periph)
 {
struct periph_driver **p_drv;
+   struct periph_driver *drv;
 
cam_periph_assert(periph, MA_OWNED);
KASSERT(periph->periph_allocating == 0, ("%s%d: freed while allocating",
@@ -673,6 +674,15 @@ camperiphfree(struct cam_periph *periph)
printf("camperiphfree: attempt to free non-existant periph\n");
return;
}
+   /*
+* Cache a pointer to the periph_driver structure.  If a
+* periph_driver is added or removed from the array (see
+* periphdriver_register()) while we drop the toplogy lock
+* below, p_drv may change.  This doesn't protect against this
+* particular periph_driver going away.  That will require full
+* reference counting in the periph_driver infrastructure.
+*/
+   drv = *p_drv;
 
/*
 * We need to set this flag before dropping the topology lock, to
@@ -708,8 +718,8 @@ camperiphfree(struct cam_periph *periph)
 */
xpt_lock_buses();
 
-   TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links);
-   (*p_drv)->generation++;
+   TAILQ_REMOVE(>units, periph, unit_links);
+   drv->generation++;
 
xpt_remove_periph(periph);
 
___
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: r320420 - head/sys/cam/scsi

2017-06-27 Thread Kenneth D. Merry
Author: ken
Date: Tue Jun 27 17:55:25 2017
New Revision: 320420
URL: https://svnweb.freebsd.org/changeset/base/320420

Log:
  In scsi_zbc_in(), fill in the length in the ZBC IN CDB.
  
  Without the allocation length set, the target will either reject
  the command or complete it without transferring any data.
  
  This fixes the REPORT ZONES command for SCSI ZBC protocol devices,
  as well as ATA ZAC protocol devices that are behind a SCSI to ATA
  translation layer.  (LSI/Broadcom's 12Gb SAS adapters translate ZBC
  commands to ZAC commands.)  Those are Host Aware and Host Managed SMR
  drives.
  
  This will fix REPORT ZONE commands sent to the da(4) driver via the
  GEOM bio interface and zonectl, and REPORT ZONE commands sent from
  camcontrol(8).
  
  Note that in the case of camcontrol(8), we currently only send
  SCSI ZBC commands to native SCSI protocol devices, not ATA devices
  behind a SAT layer.
  
  sys/cam/scsi/scsi_da.c:
Fill in the length field in scsi_zbc_in().
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Tue Jun 27 17:48:11 2017(r320419)
+++ head/sys/cam/scsi/scsi_da.c Tue Jun 27 17:55:25 2017(r320420)
@@ -5804,6 +5804,7 @@ scsi_zbc_in(struct ccb_scsiio *csio, uint32_t retries,
scsi_cmd = (struct scsi_zbc_in *)>cdb_io.cdb_bytes;
scsi_cmd->opcode = ZBC_IN;
scsi_cmd->service_action = service_action;
+   scsi_ulto4b(dxfer_len, scsi_cmd->length);
scsi_u64to8b(zone_start_lba, scsi_cmd->zone_start_lba);
scsi_cmd->zone_options = zone_options;
 
___
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: r320419 - head/sys/dev/cxgbe/iw_cxgbe

2017-06-27 Thread Navdeep Parhar
Author: np
Date: Tue Jun 27 17:48:11 2017
New Revision: 320419
URL: https://svnweb.freebsd.org/changeset/base/320419

Log:
  cxgbe/iw_cxgbe: Disable debug output by default.  The help text for the sysctl
  already says that the default is 0.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cTue Jun 27 17:45:47 2017
(r320418)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cTue Jun 27 17:48:11 2017
(r320419)
@@ -881,7 +881,7 @@ static int enable_tcp_window_scaling = 1;
 SYSCTL_INT(_hw_iw_cxgbe, OID_AUTO, enable_tcp_window_scaling, CTLFLAG_RWTUN, 
_tcp_window_scaling, 0,
"Enable tcp window scaling (default = 1)");
 
-int c4iw_debug = 1;
+int c4iw_debug = 0;
 SYSCTL_INT(_hw_iw_cxgbe, OID_AUTO, c4iw_debug, CTLFLAG_RWTUN, _debug, 0,
"Enable debug logging (default = 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: r320418 - head/sys/dev/cxgbe/iw_cxgbe

2017-06-27 Thread Navdeep Parhar
Author: np
Date: Tue Jun 27 17:45:47 2017
New Revision: 320418
URL: https://svnweb.freebsd.org/changeset/base/320418

Log:
  cxgbe/iw_cxgbe: Catch up with r319722.  The socket lock is not the same as the
  lock for the receive buffer any more.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cTue Jun 27 17:45:26 2017
(r320417)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cTue Jun 27 17:45:47 2017
(r320418)
@@ -622,11 +622,10 @@ init_iwarp_socket(struct socket *so, void *arg)
struct sockopt sopt;
int on = 1;
 
-   /* Note that SOCK_LOCK(so) is same as SOCKBUF_LOCK(>so_rcv) */
-   SOCK_LOCK(so);
+   SOCKBUF_LOCK(>so_rcv);
soupcall_set(so, SO_RCV, c4iw_so_upcall, arg);
so->so_state |= SS_NBIO;
-   SOCK_UNLOCK(so);
+   SOCKBUF_UNLOCK(>so_rcv);
sopt.sopt_dir = SOPT_SET;
sopt.sopt_level = IPPROTO_TCP;
sopt.sopt_name = TCP_NODELAY;
___
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: r320417 - head/sys/kern

2017-06-27 Thread Alan Cox
Author: alc
Date: Tue Jun 27 17:45:26 2017
New Revision: 320417
URL: https://svnweb.freebsd.org/changeset/base/320417

Log:
  Address the remaining integer overflow issues with the "skip" parameters
  and "next_skip" variables.  The "skip" value in struct blist has long been
  a 64-bit quantity but various functions have implicitly truncated this
  value to 32 bits.  Now, all arithmetic involving the "skip" value is 64
  bits wide.  (This should allow us to relax the size limit on a swap device
  in the swap pager.)
  
  Maintain the ability to test this allocator as a user-space application by
  including .
  
  Remove an unused variable from blst_radix_print().
  
  Reviewed by:  kib, markj
  MFC after:4 weeks
  Differential Revision:https://reviews.freebsd.org/D11358

Modified:
  head/sys/kern/subr_blist.c

Modified: head/sys/kern/subr_blist.c
==
--- head/sys/kern/subr_blist.c  Tue Jun 27 17:43:28 2017(r320416)
+++ head/sys/kern/subr_blist.c  Tue Jun 27 17:45:26 2017(r320417)
@@ -105,6 +105,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #definebitcount64(x)   __bitcount64((uint64_t)(x))
 #define malloc(a,b,c)  calloc(a, 1)
@@ -125,17 +126,17 @@ static daddr_tblst_meta_alloc(blmeta_t *scan, daddr_t
daddr_t radix, daddr_t skip, daddr_t cursor);
 static void blst_leaf_free(blmeta_t *scan, daddr_t relblk, int count);
 static void blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_t count, 
-   daddr_t radix, int skip, daddr_t blk);
+   daddr_t radix, daddr_t skip, daddr_t blk);
 static void blst_copy(blmeta_t *scan, daddr_t blk, daddr_t radix, 
daddr_t skip, blist_t dest, daddr_t count);
 static daddr_t blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count);
 static daddr_t blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count,
-   daddr_t radix, int skip, daddr_t blk);
-static daddr_t blst_radix_init(blmeta_t *scan, daddr_t radix, 
-   int skip, daddr_t count);
+   daddr_t radix, daddr_t skip, daddr_t blk);
+static daddr_t blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t skip,
+   daddr_t count);
 #ifndef _KERNEL
-static voidblst_radix_print(blmeta_t *scan, daddr_t blk, 
-   daddr_t radix, int skip, int tab);
+static voidblst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix,
+   daddr_t skip, int tab);
 #endif
 
 #ifdef _KERNEL
@@ -157,18 +158,18 @@ blist_t 
 blist_create(daddr_t blocks, int flags)
 {
blist_t bl;
-   daddr_t nodes, radix;
-   int skip = 0;
+   daddr_t nodes, radix, skip;
 
/*
 * Calculate radix and skip field used for scanning.
 */
radix = BLIST_BMAP_RADIX;
-
+   skip = 0;
while (radix < blocks) {
radix *= BLIST_META_RADIX;
skip = (skip + 1) * BLIST_META_RADIX;
}
+   nodes = 1 + blst_radix_init(NULL, radix, skip, blocks);
 
bl = malloc(sizeof(struct blist), M_SWAP, flags);
if (bl == NULL)
@@ -178,13 +179,12 @@ blist_create(daddr_t blocks, int flags)
bl->bl_radix = radix;
bl->bl_skip = skip;
bl->bl_cursor = 0;
-   nodes = 1 + blst_radix_init(NULL, radix, bl->bl_skip, blocks);
bl->bl_root = malloc(nodes * sizeof(blmeta_t), M_SWAP, flags);
if (bl->bl_root == NULL) {
free(bl, M_SWAP);
return (NULL);
}
-   blst_radix_init(bl->bl_root, radix, bl->bl_skip, blocks);
+   blst_radix_init(bl->bl_root, radix, skip, blocks);
 
 #if defined(BLIST_DEBUG)
printf(
@@ -569,16 +569,11 @@ blst_leaf_free(
  */
 
 static void 
-blst_meta_free(
-   blmeta_t *scan, 
-   daddr_t freeBlk,
-   daddr_t count,
-   daddr_t radix, 
-   int skip,
-   daddr_t blk
-) {
-   int i;
-   int next_skip = ((u_int)skip / BLIST_META_RADIX);
+blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_t count, daddr_t radix,
+daddr_t skip, daddr_t blk)
+{
+   daddr_t i, next_skip, v;
+   int child;
 
 #if 0
printf("free (%llx,%lld) FROM (%llx,%lld)\n",
@@ -586,6 +581,7 @@ blst_meta_free(
(long long)blk, (long long)radix
);
 #endif
+   next_skip = skip / BLIST_META_RADIX;
 
if (scan->u.bmu_avail == 0) {
/*
@@ -630,13 +626,10 @@ blst_meta_free(
 
radix /= BLIST_META_RADIX;
 
-   i = (freeBlk - blk) / radix;
-   blk += i * radix;
-   i = i * next_skip + 1;
-
+   child = (freeBlk - blk) / radix;
+   blk += child * radix;
+   i = 1 + child * next_skip;
while (i <= skip && blk < freeBlk + count) {
-   daddr_t v;
-
v = blk + radix 

svn commit: r320416 - head/sys/dev/cxgbe/tom

2017-06-27 Thread Navdeep Parhar
Author: np
Date: Tue Jun 27 17:43:28 2017
New Revision: 320416
URL: https://svnweb.freebsd.org/changeset/base/320416

Log:
  cxgbe/t4_tom: sbspace on listening sockets is no longer supported (as of
  r319722), use sol_sbrcv_hiwat instead.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_listen.c

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==
--- head/sys/dev/cxgbe/tom/t4_listen.c  Tue Jun 27 17:23:20 2017
(r320415)
+++ head/sys/dev/cxgbe/tom/t4_listen.c  Tue Jun 27 17:43:28 2017
(r320416)
@@ -1185,6 +1185,7 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss
struct synq_entry *synqe = NULL;
int reject_reason, v, ntids;
uint16_t vid;
+   u_int wnd;
 #ifdef INVARIANTS
unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl)));
 #endif
@@ -1326,10 +1327,10 @@ found:
 
mtu_idx = find_best_mtu_idx(sc, , be16toh(cpl->tcpopt.mss));
rscale = cpl->tcpopt.wsf && V_tcp_do_rfc1323 ? select_rcv_wscale() : 0;
-   SOCKBUF_LOCK(>so_rcv);
/* opt0 rcv_bufsiz initially, assumes its normal meaning later */
-   rx_credits = min(select_rcv_wnd(so) >> 10, M_RCV_BUFSIZ);
-   SOCKBUF_UNLOCK(>so_rcv);
+   wnd = max(so->sol_sbrcv_hiwat, MIN_RCV_WND);
+   wnd = min(wnd, MAX_RCV_WND);
+   rx_credits = min(wnd >> 10, M_RCV_BUFSIZ);
 
save_qids_in_mbuf(m, vi);
get_qids_from_mbuf(m, NULL, );
___
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: r320415 - head/sys/kern

2017-06-27 Thread Conrad Meyer
Author: cem
Date: Tue Jun 27 17:23:20 2017
New Revision: 320415
URL: https://svnweb.freebsd.org/changeset/base/320415

Log:
  Fix one more place uio_resid is truncated to int
  
  A follow-up to r231949 and r194990.
  
  Reported by:  pho@
  Reviewed by:  kib@, markj@
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D11373

Modified:
  head/sys/kern/uipc_mbuf.c

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Tue Jun 27 17:22:03 2017(r320414)
+++ head/sys/kern/uipc_mbuf.c   Tue Jun 27 17:23:20 2017(r320415)
@@ -1517,7 +1517,7 @@ m_uiotombuf(struct uio *uio, int how, int len, int ali
 * the total data supplied by the uio.
 */
if (len > 0)
-   total = min(uio->uio_resid, len);
+   total = (uio->uio_resid < len) ? uio->uio_resid : len;
else
total = uio->uio_resid;
 
___
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: r320414 - head/contrib/netbsd-tests/usr.bin/grep

2017-06-27 Thread Ngie Cooper
Author: ngie
Date: Tue Jun 27 17:22:03 2017
New Revision: 320414
URL: https://svnweb.freebsd.org/changeset/base/320414

Log:
  Expect :mmap_eof_not_eol to fail
  
  It relies on a jemalloc feature (opt.redzone) no longer available after
  r319971.
  
  MFC with: r318908, r319971
  PR:   220309

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue Jun 27 17:01:46 
2017(r320413)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue Jun 27 17:22:03 
2017(r320414)
@@ -658,6 +658,8 @@ mmap_eof_not_eol_body()
atf_expect_fail "gnu grep from ports has no --mmap option"
fi
 
+   atf_expect_fail "relies on jemalloc feature no longer available; needs 
to be rewritten - bug 220309"
+
printf "ABC" > test1
jot -b " "  -s "" 4096 >> test2
 
___
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: r320388 - head/sys/arm64/include

2017-06-27 Thread Ngie Cooper (yaneurabeya)

> On Jun 27, 2017, at 10:06, Andrew Turner  wrote:

...

> I already fixed it in r320411.

Ok! The CI build is currently running, so *crosses fingers* hopefully 
everything will be fixed after this build on amd64/arm64.
Thanks!
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r320388 - head/sys/arm64/include

2017-06-27 Thread Andrew Turner

> On 27 Jun 2017, at 18:04, Ngie Cooper (yaneurabeya)  
> wrote:
> 
> 
>> On Jun 26, 2017, at 15:32, Andrew Turner  wrote:
>> 
>> Author: andrew
>> Date: Mon Jun 26 22:32:52 2017
>> New Revision: 320388
>> URL: https://svnweb.freebsd.org/changeset/base/320388
>> 
>> Log:
>> In _bswap16 and _bswap32 cast constant values to the appropriate type. This 
>> is
>> similar to what is done in the x86 code.
>> 
>> Sponsored by:DARPA, AFRL
> 
> Hi Andrew,
>   This change broke htons use in libsdp on arm64. From 
> https://ci.freebsd.org/job/FreeBSD-head-aarch64-build/2932/console :
> 
> 16:08:38 --- all_subdir_lib/libsdp ---
> 16:08:38 /usr/src/lib/libsdp/search.c:160:31: error: invalid operands to 
> binary expression ('int' and 'uint8_t *' (aka 'unsigned char *'))
> 16:08:38 xpdu.pdu.len = htons(req_cs - ss->req);
> 
> 16:08:38~^~
> 
>   It might be a good idea to revert the change, fix the fallout, then 
> recommit the change.
> Thanks,
> -Ngie

I already fixed it in r320411.

Andrew
___
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: r320388 - head/sys/arm64/include

2017-06-27 Thread Ngie Cooper (yaneurabeya)

> On Jun 26, 2017, at 15:32, Andrew Turner  wrote:
> 
> Author: andrew
> Date: Mon Jun 26 22:32:52 2017
> New Revision: 320388
> URL: https://svnweb.freebsd.org/changeset/base/320388
> 
> Log:
>  In _bswap16 and _bswap32 cast constant values to the appropriate type. This 
> is
>  similar to what is done in the x86 code.
> 
>  Sponsored by:DARPA, AFRL

Hi Andrew,
This change broke htons use in libsdp on arm64. From 
https://ci.freebsd.org/job/FreeBSD-head-aarch64-build/2932/console :

16:08:38 --- all_subdir_lib/libsdp ---
16:08:38 /usr/src/lib/libsdp/search.c:160:31: error: invalid operands to binary 
expression ('int' and 'uint8_t *' (aka 'unsigned char *'))
16:08:38 xpdu.pdu.len = htons(req_cs - ss->req);

16:08:38~^~

It might be a good idea to revert the change, fix the fallout, then 
recommit the change.
Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


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

2017-06-27 Thread Ngie Cooper
Author: ngie
Date: Tue Jun 27 17:01:46 2017
New Revision: 320413
URL: https://svnweb.freebsd.org/changeset/base/320413

Log:
  Fix LINT, broken by a -Wformat warning in r320329 with PFS_DELEN being
  changed from %d to a long-width type.
  
  Use uintmax_t casting and %ju to futureproof the format string against
  potential changes with either the #define or the implementation-specific
  definition for offsetof(..).

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

Modified: head/sys/fs/pseudofs/pseudofs_vnops.c
==
--- head/sys/fs/pseudofs/pseudofs_vnops.c   Tue Jun 27 16:48:05 2017
(r320412)
+++ head/sys/fs/pseudofs/pseudofs_vnops.c   Tue Jun 27 17:01:46 2017
(r320413)
@@ -866,7 +866,7 @@ pfs_readdir(struct vop_readdir_args *va)
free(pfsent, M_IOV);
i++;
}
-   PFS_TRACE(("%d bytes", i * PFS_DELEN));
+   PFS_TRACE(("%ju bytes", (uintmax_t)(i * PFS_DELEN)));
PFS_RETURN (error);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r320412 - head/sys/cam/nvme

2017-06-27 Thread Warner Losh
Author: imp
Date: Tue Jun 27 16:48:05 2017
New Revision: 320412
URL: https://svnweb.freebsd.org/changeset/base/320412

Log:
  Namespace is 32-bits, don't cast it to 16 here

Modified:
  head/sys/cam/nvme/nvme_da.c

Modified: head/sys/cam/nvme/nvme_da.c
==
--- head/sys/cam/nvme/nvme_da.c Tue Jun 27 16:30:01 2017(r320411)
+++ head/sys/cam/nvme/nvme_da.c Tue Jun 27 16:48:05 2017(r320412)
@@ -743,7 +743,7 @@ ndaregister(struct cam_periph *periph, void *arg)
/*
 * The name space ID is the lun, save it for later I/O
 */
-   softc->nsid = (uint16_t)xpt_path_lun_id(periph->path);
+   softc->nsid = (uint32_t)xpt_path_lun_id(periph->path);
 
/*
 * Register this media as a disk
___
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: r320411 - head/sys/arm64/include

2017-06-27 Thread Andrew Turner
Author: andrew
Date: Tue Jun 27 16:30:01 2017
New Revision: 320411
URL: https://svnweb.freebsd.org/changeset/base/320411

Log:
  Add parentheses missed in r320388
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/include/endian.h

Modified: head/sys/arm64/include/endian.h
==
--- head/sys/arm64/include/endian.h Tue Jun 27 16:05:11 2017
(r320410)
+++ head/sys/arm64/include/endian.h Tue Jun 27 16:30:01 2017
(r320411)
@@ -106,12 +106,12 @@ __bswap16_var(__uint16_t v)
 
 #define__bswap16(x)\
 ((__uint16_t)(__builtin_constant_p(x) ?\
- __bswap16_constant((__uint16_t)x) :   \
+ __bswap16_constant((__uint16_t)(x)) : \
  __bswap16_var(x)))
 
 #define__bswap32(x)\
 ((__uint32_t)(__builtin_constant_p(x) ?\
- __bswap32_constant((__uint32_t)x) :   \
+ __bswap32_constant((__uint32_t)(x)) : \
  __bswap32_var(x)))
 
 #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: r320410 - svnadmin/hooks/scripts

2017-06-27 Thread Ryan Steinmetz
Author: zi (ports committer)
Date: Tue Jun 27 16:05:11 2017
New Revision: 320410
URL: https://svnweb.freebsd.org/changeset/base/320410

Log:
  - Add in additional X-SVN-* headers to assist with mail sorting
  
  PR:   200484
  Requested by: emaste

Modified:
  svnadmin/hooks/scripts/mailer.py

Modified: svnadmin/hooks/scripts/mailer.py
==
--- svnadmin/hooks/scripts/mailer.pyTue Jun 27 15:14:06 2017
(r320409)
+++ svnadmin/hooks/scripts/mailer.pyTue Jun 27 16:05:11 2017
(r320410)
@@ -235,6 +235,8 @@ class MailedOutput(OutputBase):
 
   def mail_headers(self, group, params):
 subject = self.make_subject(group, params)
+dirlist_limit = 200
+dirlist = self.dirlist[:dirlist_limit] + 
bool(self.dirlist[dirlist_limit:]) * '...'
 try:
   subject.encode('ascii')
 except UnicodeError:
@@ -244,10 +246,15 @@ class MailedOutput(OutputBase):
 #hdrs = 'To: %s\n'  \
 hdrs = 'Subject: %s\n' \
'X-SVN-Group: %s\n' \
+   'X-SVN-Commit-Author: %s\n' \
+   'X-SVN-Commit-Paths: %s\n' \
+   'X-SVN-Commit-Revision: %d\n' \
+   'X-SVN-Commit-Repository: %s\n' \
'MIME-Version: 1.0\n' \
'Content-Type: text/plain; charset=UTF-8\n' \
'Content-Transfer-Encoding: 8bit\n' \
-   % (subject, group or "defaults")
+   % (subject, group or "defaults", self.repos.author or 'no_author', 
+ dirlist, self.repos.rev, os.path.basename(self.repos.repos_dir))
 #   % (self.from_addr, string.join(self.to_addrs, ', '), subject)
 if self.reply_to:
   hdrs = '%sReply-To: %s\n' % (hdrs, self.reply_to)
@@ -397,8 +404,10 @@ class Commit(Messenger):
 dirlist = string.join(dirlist)
 if commondir:
   self.output.subject = 'r%d - in %s: %s' % (repos.rev, commondir, dirlist)
+  self.output.dirlist = 'in %s: %s' % (commondir, dirlist)
 else:
   self.output.subject = 'r%d - %s' % (repos.rev, dirlist)
+  self.output.dirlist = '%s' % (dirlist)
 
   def generate(self):
 "Generate email for the various groups and option-params."
___
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: r320409 - head/sys/fs/nfs

2017-06-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Jun 27 15:14:06 2017
New Revision: 320409
URL: https://svnweb.freebsd.org/changeset/base/320409

Log:
  Revert part of r320359, as suggested by rmacklem@.  That case is only used
  for nfsuserd -manage-gids and shouldn't depend on sysctl.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

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

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cTue Jun 27 15:07:19 2017
(r320408)
+++ head/sys/fs/nfs/nfs_commonsubs.cTue Jun 27 15:14:06 2017
(r320409)
@@ -2672,7 +2672,7 @@ nfsrv_getgrpscred(struct ucred *oldcred)
cnt = 0;
uid = oldcred->cr_uid;
 tryagain:
-   if (nfsrv_dnsnamelen > 0 && !nfsd_enable_uidtostring) {
+   if (nfsrv_dnsnamelen > 0) {
hp = NFSUSERHASH(uid);
mtx_lock(>mtx);
TAILQ_FOREACH(usrp, >lughead, lug_numhash) {
___
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: r320408 - head/sys/fs/ext2fs

2017-06-27 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jun 27 15:07:19 2017
New Revision: 320408
URL: https://svnweb.freebsd.org/changeset/base/320408

Log:
  ext2fs: Support e2di_uid_high and e2di_gid_high.
  
  The fields exist on all versions of the filesystem and using them is a mount
  option on linux. For FreeBSD, the corresponding i_uid and i_gid are always
  long enough so use them by default.
  
  Reviewed by:  Fedor Uporov
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D11354

Modified:
  head/sys/fs/ext2fs/ext2_inode_cnv.c

Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c
==
--- head/sys/fs/ext2fs/ext2_inode_cnv.c Tue Jun 27 14:39:00 2017
(r320407)
+++ head/sys/fs/ext2fs/ext2_inode_cnv.c Tue Jun 27 15:07:19 2017
(r320408)
@@ -124,6 +124,8 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip)
ip->i_gen = ei->e2di_gen;
ip->i_uid = ei->e2di_uid;
ip->i_gid = ei->e2di_gid;
+   ip->i_uid |= (uint32_t)ei->e2di_uid_high << 16;
+   ip->i_gid |= (uint32_t)ei->e2di_gid_high << 16;
/* XXX use memcpy */
for (i = 0; i < EXT2_NDADDR; i++)
ip->i_db[i] = ei->e2di_blocks[i];
@@ -170,8 +172,10 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei)
ei->e2di_facl = ip->i_facl & 0x;
ei->e2di_facl_high = ip->i_facl >> 32 & 0x;
ei->e2di_gen = ip->i_gen;
-   ei->e2di_uid = ip->i_uid;
-   ei->e2di_gid = ip->i_gid;
+   ei->e2di_uid = ip->i_uid & 0x;
+   ei->e2di_uid_high = ip->i_uid >> 16 & 0x;
+   ei->e2di_gid = ip->i_gid & 0x;
+   ei->e2di_gid_high = ip->i_gid >> 16 & 0x;
/* XXX use memcpy */
for (i = 0; i < EXT2_NDADDR; i++)
ei->e2di_blocks[i] = ip->i_db[i];
___
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: r320407 - head/release/arm64

2017-06-27 Thread Glen Barber
Author: gjb
Date: Tue Jun 27 14:39:00 2017
New Revision: 320407
URL: https://svnweb.freebsd.org/changeset/base/320407

Log:
  Remove CHROOT_MAKEENV from the RPI3 configuration file, to avoid
  assuming the build host is amd64.
  
  MFC after:3 days
  X-MFC-With:   r320252, r320253, r320254
  X-MFC-Note:   maybe
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/arm64/RPI3.conf

Modified: head/release/arm64/RPI3.conf
==
--- head/release/arm64/RPI3.confTue Jun 27 13:24:06 2017
(r320406)
+++ head/release/arm64/RPI3.confTue Jun 27 14:39:00 2017
(r320407)
@@ -3,7 +3,6 @@
 # $FreeBSD$
 #
 
-CHROOT_MAKEENV="TARGET=amd64 TARGET_ARCH=amd64"
 SRCBRANCH="base/head@rHEAD"
 EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm64"
___
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: r320406 - head/libexec/rshd

2017-06-27 Thread John W. De Boskey
Author: jwd
Date: Tue Jun 27 13:24:06 2017
New Revision: 320406
URL: https://svnweb.freebsd.org/changeset/base/320406

Log:
  A little tweak for performance
  
  Reviewed by: adrian
  Approved by: rmacklem (mentor)
  MFC after: 3 weeks

Modified:
  head/libexec/rshd/rshd.c

Modified: head/libexec/rshd/rshd.c
==
--- head/libexec/rshd/rshd.cTue Jun 27 12:56:36 2017(r320405)
+++ head/libexec/rshd/rshd.cTue Jun 27 13:24:06 2017(r320406)
@@ -191,7 +191,7 @@ doit(struct sockaddr *fromp)
struct passwd *pwd;
u_short port;
fd_set ready, readfrom;
-   int cc, fd, nfd, pv[2], pid, s;
+   int cc, nfd, pv[2], pid, s;
int one = 1;
const char *cp, *errorstr;
char sig, buf[BUFSIZ];
@@ -496,8 +496,7 @@ doit(struct sockaddr *fromp)
 #ifdef USE_BLACKLIST
blacklist(0, STDIN_FILENO, "success");
 #endif
-   for (fd = getdtablesize(); fd > 2; fd--)
-   (void) close(fd);
+   closefrom(3);
if (setsid() == -1)
syslog(LOG_ERR, "setsid() failed: %m");
if (setlogin(pwd->pw_name) < 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: r320405 - stable/11/sys/cam/scsi

2017-06-27 Thread Kenneth D. Merry
Author: ken
Date: Tue Jun 27 12:56:36 2017
New Revision: 320405
URL: https://svnweb.freebsd.org/changeset/base/320405

Log:
  MFC r320123:
  
Fix a potential sleep while holding a mutex in the sa(4) driver.
  
If the user issues a MTIOCEXTGET ioctl, and the tape drive in question has
a serial number that is longer than 80 characters, we malloc a buffer in
saextget() to hold the output of cam_strvis().
  
Since a mutex is held in that codepath, doing a M_WAITOK malloc could lead
to sleeping while holding a mutex.  Change it to a M_NOWAIT malloc and bail
out if we fail to allocate the memory.  Devices with serial numbers longer
than 80 bytes are very rare (I don't recall seeing one), so this
should be a very unusual case to hit.  But it is a bug that should be fixed.
  
sys/cam/scsi/scsi_sa.c:
In saextget(), if we need to malloc a buffer to hold the output of
cam_strvis(), don't wait for the memory.  Fail and return an error
if we can't allocate the memory immediately.
  
  PR:   kern/220094
  Submitted by: Jia-Ju Bai 
  Sponsored by: Spectra Logic
  Approved by:  re (gjb)

Modified:
  stable/11/sys/cam/scsi/scsi_sa.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_sa.c
==
--- stable/11/sys/cam/scsi/scsi_sa.cTue Jun 27 10:50:48 2017
(r320404)
+++ stable/11/sys/cam/scsi/scsi_sa.cTue Jun 27 12:56:36 2017
(r320405)
@@ -4465,7 +4465,18 @@ saextget(struct cdev *dev, struct cam_periph *periph, 
if (cgd.serial_num_len > sizeof(tmpstr)) {
ts2_len = cgd.serial_num_len + 1;
ts2_malloc = 1;
-   tmpstr2 = malloc(ts2_len, M_SCSISA, M_WAITOK | M_ZERO);
+   tmpstr2 = malloc(ts2_len, M_SCSISA, M_NOWAIT | M_ZERO);
+   /*
+* The 80 characters allocated on the stack above
+* will handle the vast majority of serial numbers.
+* If we run into one that is larger than that, and
+* we can't malloc the length without blocking,
+* bail out with an out of memory error.
+*/
+   if (tmpstr2 == NULL) {
+   error = ENOMEM;
+   goto extget_bailout;
+   }
} else {
ts2_len = sizeof(tmpstr);
ts2_malloc = 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"


Re: svn commit: r320240 - head/include

2017-06-27 Thread Baptiste Daroussin
On Tue, Jun 27, 2017 at 12:33:44PM +0200, Ed Schouten wrote:
> 2017-06-27 7:02 GMT+02:00 Jan Beich :
> > max_align_t is now exposed even without -std=c11.
> 
> Which is now consistent with the rest of the C library, as this is
> also the case for other C11 features, like 's quick_exit().
> 
> > thus regressing some ports e.g.,
> >
> > [...]
> >
> > https://lists.freebsd.org/pipermail/freebsd-pkg-fallout/Week-of-Mon-20170626/493679.html
> 
> Would there be an easy way for me to extract a list of ports that are 
> affected?
> 
An exp-run would have shown you the list, that is what they are made for :)

Bapt


signature.asc
Description: PGP signature


Re: svn commit: r320240 - head/include

2017-06-27 Thread Ed Schouten
2017-06-27 13:17 GMT+02:00 Jan Beich :
> False alarm. Sorry.

No problem. Thanks for bringing it to my attention, regardless! \o/

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
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: r320240 - head/include

2017-06-27 Thread Jan Beich
Ed Schouten  writes:

> 2017-06-27 7:02 GMT+02:00 Jan Beich :
>> thus regressing some ports e.g.,
>>
>> [...]
>>
>> https://lists.freebsd.org/pipermail/freebsd-pkg-fallout/Week-of-Mon-20170626/493679.html
>
> Would there be an easy way for me to extract a list of ports that are 
> affected?

"fgrep -r max_align" over error logs[1] from a complete build suggests only
www/libxul is busted which was fixed upstream[2]. I'll backport it shortly.

False alarm. Sorry.

[1] 
http://beefy11.nyi.freebsd.org/data/head-i386-default/p444252_s320323/logs/errors/

http://beefy12.nyi.freebsd.org/data/head-amd64-default/p444252_s320323/logs/errors/
[2] https://github.com/kinetiknz/nestegg/pull/31
___
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: r320404 - stable/11/sys/i386/isa

2017-06-27 Thread Konstantin Belousov
Author: kib
Date: Tue Jun 27 10:50:48 2017
New Revision: 320404
URL: https://svnweb.freebsd.org/changeset/base/320404

Log:
  MFC r320307:
  Fix indent.
  
  Approved by:  re (marius)

Modified:
  stable/11/sys/i386/isa/npx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/i386/isa/npx.c
==
--- stable/11/sys/i386/isa/npx.cTue Jun 27 10:45:13 2017
(r320403)
+++ stable/11/sys/i386/isa/npx.cTue Jun 27 10:50:48 2017
(r320404)
@@ -1157,7 +1157,7 @@ npx_set_fpregs_xmm(struct save87 *sv_87, struct savexm
for (i = 0; i < 8; ++i) {
sv_xmm->sv_fp[i].fp_acc = sv_87->sv_ac[i];
if ((penv_87->en_tw & (3 << i * 2)) != (3 << i * 2))
-   penv_xmm->en_tw |= 1 << i;
+   penv_xmm->en_tw |= 1 << i;
}
 }
 
___
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: r320403 - head/sys/arm64/include

2017-06-27 Thread Andrew Turner
Author: andrew
Date: Tue Jun 27 10:45:13 2017
New Revision: 320403
URL: https://svnweb.freebsd.org/changeset/base/320403

Log:
  Some of the atomic_clear_* functions were incorrectly defined to be an
  atomic add. Correct these, fixing a NULL-pointer dereference in netgraph.
  
  PR:   220273
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/include/atomic.h

Modified: head/sys/arm64/include/atomic.h
==
--- head/sys/arm64/include/atomic.h Tue Jun 27 10:09:00 2017
(r320402)
+++ head/sys/arm64/include/atomic.h Tue Jun 27 10:45:13 2017
(r320403)
@@ -385,7 +385,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val
 
 #defineatomic_add_rel_int  atomic_add_rel_32
 #defineatomic_fcmpset_rel_int  atomic_fcmpset_rel_32
-#defineatomic_clear_rel_intatomic_add_rel_32
+#defineatomic_clear_rel_intatomic_clear_rel_32
 #defineatomic_cmpset_rel_int   atomic_cmpset_rel_32
 #defineatomic_set_rel_int  atomic_set_rel_32
 #defineatomic_subtract_rel_int atomic_subtract_rel_32
@@ -413,7 +413,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val
 
 #defineatomic_add_acq_long atomic_add_acq_64
 #defineatomic_fcmpset_acq_long atomic_fcmpset_acq_64
-#defineatomic_clear_acq_long   atomic_add_acq_64
+#defineatomic_clear_acq_long   atomic_clear_acq_64
 #defineatomic_cmpset_acq_long  atomic_cmpset_acq_64
 #defineatomic_load_acq_longatomic_load_acq_64
 #defineatomic_set_acq_long atomic_set_acq_64
@@ -421,7 +421,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val
 
 #defineatomic_add_acq_ptr  atomic_add_acq_64
 #defineatomic_fcmpset_acq_ptr  atomic_fcmpset_acq_64
-#defineatomic_clear_acq_ptratomic_add_acq_64
+#defineatomic_clear_acq_ptratomic_clear_acq_64
 #defineatomic_cmpset_acq_ptr   atomic_cmpset_acq_64
 #defineatomic_load_acq_ptr atomic_load_acq_64
 #defineatomic_set_acq_ptr  atomic_set_acq_64
@@ -448,6 +448,7 @@ atomic_thread_fence_acq(void)
 {
 
dmb(ld);
+
 }
 
 static __inline 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"


Editorial Ideas for your consideration

2017-06-27 Thread Robin
Hello Editor, 
 
My name is Robin; I am an educational researcher at ProProfs.com, a website for 
building and testing knowledge. ProProfs tools are used by millions of users 
each month including companies like Sony, Dell and even Harvard & Yale. I have 
recently contributed articles to sites like biznology.com ( 
http://www.biznology.com/2016/12/why-online-software-documentation-is-a-necessity-in-businesses/
 ) , capterra.com ( 
http://blog.capterra.com/how-to-reduce-customer-service-costs-and-generate-leads-with-a-self-service-knowledge-base/
 ) , Toolbox.com ( 
http://it.toolbox.com/blogs/itmanagement/tactics-for-growth-hacking-with-cloudbased-knowledge-management-software-74632
 ) , famousbloggers ( 
http://famousbloggers.net/social-media-sales-smart-business.html ) , Att.com ( 
https://bizcircle.att.com/circle-solutions/satisfying/how-to-delight-customers-while-reducing-support-costs?
 ) and I was wondering whether you would be interested in having me contribute 
some articles to your website. For example, here are a couple of story ideas 
that I have for you: 
 5 Reasons for Knowledge Management Fails in the Marketing Team 
 
 5 Features Businesses Should Look for in Help Authoring Software 
 
 Why Knowledge Base Is Different From Its Customer Support Tools Family 
 
 5 Reasons Why Online User Manuals Are Cost Effective 
 
 What Can Group Discussions and Mock Practices Teach Your Live Chat Agents? 
 
 Why a Knowledge Base Is Such a Giant Leap in the Arena of Customer ServiceAre 
you interested? Let me know and I’ll send across what I wrote for you. 
 Best, 
Robin
___
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: r320240 - head/include

2017-06-27 Thread Ed Schouten
2017-06-27 7:02 GMT+02:00 Jan Beich :
> max_align_t is now exposed even without -std=c11.

Which is now consistent with the rest of the C library, as this is
also the case for other C11 features, like 's quick_exit().

> thus regressing some ports e.g.,
>
> [...]
>
> https://lists.freebsd.org/pipermail/freebsd-pkg-fallout/Week-of-Mon-20170626/493679.html

Would there be an easy way for me to extract a list of ports that are affected?

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
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: r320402 - stable/11/lib/libc/sys

2017-06-27 Thread Konstantin Belousov
Author: kib
Date: Tue Jun 27 10:09:00 2017
New Revision: 320402
URL: https://svnweb.freebsd.org/changeset/base/320402

Log:
  MFC r320314:
  Remove the description of MAP_HASSEMAPHORE.
  
  Approved by:  re (marius)

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

Modified: stable/11/lib/libc/sys/mmap.2
==
--- stable/11/lib/libc/sys/mmap.2   Tue Jun 27 09:42:56 2017
(r320401)
+++ stable/11/lib/libc/sys/mmap.2   Tue Jun 27 10:09:00 2017
(r320402)
@@ -28,7 +28,7 @@
 .\"@(#)mmap.2  8.4 (Berkeley) 5/11/95
 .\" $FreeBSD$
 .\"
-.Dd February 4, 2017
+.Dd June 22, 2017
 .Dt MMAP 2
 .Os
 .Sh NAME
@@ -199,9 +199,6 @@ In contrast, if
 .Dv MAP_EXCL
 is specified, the request will fail if a mapping
 already exists within the range.
-.It Dv MAP_HASSEMAPHORE
-Notify the kernel that the region may contain semaphores and that special
-handling may be necessary.
 .It Dv MAP_NOCORE
 Region is not included in a core file.
 .It Dv MAP_NOSYNC
___
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: r320401 - stable/11/lib/libc/sys

2017-06-27 Thread Konstantin Belousov
Author: kib
Date: Tue Jun 27 09:42:56 2017
New Revision: 320401
URL: https://svnweb.freebsd.org/changeset/base/320401

Log:
  MFC r320313:
  Fix typo.
  
  Approved by:  re (marius)

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

Modified: stable/11/lib/libc/sys/mmap.2
==
--- stable/11/lib/libc/sys/mmap.2   Tue Jun 27 08:49:47 2017
(r320400)
+++ stable/11/lib/libc/sys/mmap.2   Tue Jun 27 09:42:56 2017
(r320401)
@@ -69,7 +69,7 @@ current) offsets in the object.
 In particular, the
 .Fa offset
 value cannot be negative.
-If the object is truncated and the process later accesses a pages that
+If the object is truncated and the process later accesses a page that
 is wholly within the truncated region, the access is aborted and a
 .Dv SIGBUS
 signal is delivered to the process.
___
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: r320400 - head/lib/libprocstat

2017-06-27 Thread Ngie Cooper
Author: ngie
Date: Tue Jun 27 08:49:47 2017
New Revision: 320400
URL: https://svnweb.freebsd.org/changeset/base/320400

Log:
  Add initial documentation for procstat_freeptlwpinfo and procstat_getptlwpinfo
  
  MFC after:1 month
  MFC with: r316286

Modified:
  head/lib/libprocstat/libprocstat.3

Modified: head/lib/libprocstat/libprocstat.3
==
--- head/lib/libprocstat/libprocstat.3  Tue Jun 27 08:18:08 2017
(r320399)
+++ head/lib/libprocstat/libprocstat.3  Tue Jun 27 08:49:47 2017
(r320400)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 18, 2015
+.Dd June 27, 2017
 .Dt LIBPROCSTAT 3
 .Os
 .Sh NAME
@@ -36,6 +36,7 @@
 .Nm procstat_freegroups ,
 .Nm procstat_freekstack ,
 .Nm procstat_freeprocs ,
+.Nm procstat_freeptlwpinfo ,
 .Nm procstat_freevmmap ,
 .Nm procstat_get_pipe_info ,
 .Nm procstat_get_pts_info ,
@@ -52,6 +53,7 @@
 .Nm procstat_getosrel ,
 .Nm procstat_getpathname ,
 .Nm procstat_getprocs ,
+.Nm procstat_getptlwpinfo ,
 .Nm procstat_getrlimit ,
 .Nm procstat_getumask ,
 .Nm procstat_getvmmap ,
@@ -102,6 +104,11 @@
 .Fa "struct procstat *procstat"
 .Fa "struct kinfo_vmentry *vmmap"
 .Fc
+.Ft void
+.Fo procstat_freeptlwpinfo
+.Fa "struct procstat *procstat"
+.Fa "struct ptrace_lwpinfo *pl"
+.Fc
 .Ft int
 .Fo procstat_get_pipe_info
 .Fa "struct procstat *procstat"
@@ -202,6 +209,11 @@
 .Fa "int arg"
 .Fa "unsigned int *count"
 .Fc
+.Ft "struct ptrace_lwpinfo *"
+.Fo procstat_getptlwpinfo
+.Fa "struct procstat *procstat"
+.Fa "unsigned int *count"
+.Fc
 .Ft "int"
 .Fo procstat_getrlimit
 .Fa "struct procstat *procstat"
@@ -309,6 +321,20 @@ The number of processes found is returned in the refer
 .Fa cnt .
 The caller is responsible to free the allocated memory with a subsequent
 .Fn procstat_freeprocs
+function call.
+.Pp
+The
+.Fn procstat_getptlwpinfo
+function gets a pointer to the
+.Vt procstat
+structure from the
+.Fn procstat_open_core
+function and returns a dynamically allocated set of signals intercepted by a
+process in the process's core file.
+The number of processes found is returned in the reference parameter
+.Fa cnt .
+The caller is responsible to free the allocated memory with a subsequent
+.Fn procstat_freeptlwpinfo
 function call.
 .Pp
 The
___
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: r320399 - head/lib/libprocstat

2017-06-27 Thread Ngie Cooper
Author: ngie
Date: Tue Jun 27 08:18:08 2017
New Revision: 320399
URL: https://svnweb.freebsd.org/changeset/base/320399

Log:
  procstat_getptlwpinfo(..): clarify the fact that KVM/SYSCTL support
  isn't supported
  
  This will make the error message reported in bug 220023 a bit more
  intuitive for end-users that don't have access to the source code to
  decode the procstat->type argument.
  
  MFC after:1 month
  MFC with: r316286
  PR:   220023

Modified:
  head/lib/libprocstat/libprocstat.c

Modified: head/lib/libprocstat/libprocstat.c
==
--- head/lib/libprocstat/libprocstat.c  Tue Jun 27 06:44:32 2017
(r320398)
+++ head/lib/libprocstat/libprocstat.c  Tue Jun 27 08:18:08 2017
(r320399)
@@ -2510,6 +2510,12 @@ struct ptrace_lwpinfo *
 procstat_getptlwpinfo(struct procstat *procstat, unsigned int *cntp)
 {
switch (procstat->type) {
+   case PROCSTAT_KVM:
+   warnx("kvm method is not supported");
+   return (NULL);
+   case PROCSTAT_SYSCTL:
+   warnx("sysctl method is not supported");
+   return (NULL);
case PROCSTAT_CORE:
return (procstat_getptlwpinfo_core(procstat->core, cntp));
default:
___
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"