svn commit: r352376 - in stable/11: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-09-15 Thread Andriy Gapon
Author: avg
Date: Mon Sep 16 05:28:40 2019
New Revision: 352376
URL: https://svnweb.freebsd.org/changeset/base/352376

Log:
  MFC r351803: ZFS: Always refuse receving non-resume stream when resume state 
exists

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Mon Sep 16 05:25:36 2019(r352375)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Mon Sep 16 05:28:40 2019(r352376)
@@ -3278,11 +3278,18 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
}
} else {
/*
-* if the fs does not exist, look for it based on the
-* fromsnap GUID
+* If the fs does not exist, look for it based on the
+* fromsnap GUID.
 */
-   (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
-   "cannot receive incremental stream"));
+   if (resuming) {
+   (void) snprintf(errbuf, sizeof (errbuf),
+   dgettext(TEXT_DOMAIN,
+   "cannot receive resume stream"));
+   } else {
+   (void) snprintf(errbuf, sizeof (errbuf),
+   dgettext(TEXT_DOMAIN,
+   "cannot receive incremental stream"));
+   }
 
(void) strcpy(zc.zc_name, zc.zc_value);
*strchr(zc.zc_name, '@') = '\0';

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Sep 
16 05:25:36 2019(r352375)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Sep 
16 05:28:40 2019(r352376)
@@ -1308,19 +1308,23 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *d
int error;
dsl_pool_t *dp = ds->ds_dir->dd_pool;
 
-   /* temporary clone name must not exist */
+   /* Temporary clone name must not exist. */
error = zap_lookup(dp->dp_meta_objset,
dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, recv_clone_name,
8, 1, );
if (error != ENOENT)
-   return (error == 0 ? EBUSY : error);
+   return (error == 0 ? SET_ERROR(EBUSY) : error);
 
-   /* new snapshot name must not exist */
+   /* Resume state must not be set. */
+   if (dsl_dataset_has_resume_receive_state(ds))
+   return (SET_ERROR(EBUSY));
+
+   /* New snapshot name must not exist. */
error = zap_lookup(dp->dp_meta_objset,
dsl_dataset_phys(ds)->ds_snapnames_zapobj,
drba->drba_cookie->drc_tosnap, 8, 1, );
if (error != ENOENT)
-   return (error == 0 ? EEXIST : error);
+   return (error == 0 ? SET_ERROR(EEXIST) : error);
 
/*
 * Check snapshot limit before receiving. We'll recheck again at the
___
svn-src-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: r352375 - in stable/12: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-09-15 Thread Andriy Gapon
Author: avg
Date: Mon Sep 16 05:25:36 2019
New Revision: 352375
URL: https://svnweb.freebsd.org/changeset/base/352375

Log:
  MFC r351803: ZFS: Always refuse receving non-resume stream when resume state 
exists

Modified:
  stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Mon Sep 16 04:54:17 2019(r352374)
+++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Mon Sep 16 05:25:36 2019(r352375)
@@ -3278,11 +3278,18 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
}
} else {
/*
-* if the fs does not exist, look for it based on the
-* fromsnap GUID
+* If the fs does not exist, look for it based on the
+* fromsnap GUID.
 */
-   (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
-   "cannot receive incremental stream"));
+   if (resuming) {
+   (void) snprintf(errbuf, sizeof (errbuf),
+   dgettext(TEXT_DOMAIN,
+   "cannot receive resume stream"));
+   } else {
+   (void) snprintf(errbuf, sizeof (errbuf),
+   dgettext(TEXT_DOMAIN,
+   "cannot receive incremental stream"));
+   }
 
(void) strcpy(zc.zc_name, zc.zc_value);
*strchr(zc.zc_name, '@') = '\0';

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Sep 
16 04:54:17 2019(r352374)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Sep 
16 05:25:36 2019(r352375)
@@ -1311,19 +1311,23 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *d
int error;
dsl_pool_t *dp = ds->ds_dir->dd_pool;
 
-   /* temporary clone name must not exist */
+   /* Temporary clone name must not exist. */
error = zap_lookup(dp->dp_meta_objset,
dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, recv_clone_name,
8, 1, );
if (error != ENOENT)
-   return (error == 0 ? EBUSY : error);
+   return (error == 0 ? SET_ERROR(EBUSY) : error);
 
-   /* new snapshot name must not exist */
+   /* Resume state must not be set. */
+   if (dsl_dataset_has_resume_receive_state(ds))
+   return (SET_ERROR(EBUSY));
+
+   /* New snapshot name must not exist. */
error = zap_lookup(dp->dp_meta_objset,
dsl_dataset_phys(ds)->ds_snapnames_zapobj,
drba->drba_cookie->drc_tosnap, 8, 1, );
if (error != ENOENT)
-   return (error == 0 ? EEXIST : error);
+   return (error == 0 ? SET_ERROR(EEXIST) : error);
 
/*
 * Check snapshot limit before receiving. We'll recheck again at the
___
svn-src-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: r352374 - stable/12/sys/arm64/arm64

2019-09-15 Thread Alan Cox
Author: alc
Date: Mon Sep 16 04:54:17 2019
New Revision: 352374
URL: https://svnweb.freebsd.org/changeset/base/352374

Log:
  MFC r349323, r349442, r349866, r349975
pmap_enter_quick_locked() never replaces a valid mapping, so it need not
perform a TLB invalidation.  A barrier suffices.  (See r343876.)
  
Add a comment to pmap_enter_quick_locked() in order to highlight the fact
that it does not replace valid mappings.
  
Correct a typo in one of pmap_enter()'s comments.
  
Introduce pmap_clear(), which zeroes a page table entry, and use it,
instead of pmap_load_clear(), in places where we don't care about the page
table entry's prior contents.
  
Eliminate an unnecessary pmap_load() from pmap_remove_all().  Instead, use
the value returned by the pmap_load_clear() on the very next line.
  
A KASSERT() in pmap_enter(), which originated in the amd64 pmap, was meant
to check the value returned by the pmap_load_clear() on the previous
line.  However, we were ignoring the value returned by the
pmap_load_clear(), and so the KASSERT() was not serving its intended
purpose.  Use the value returned by the pmap_load_clear() in the
KASSERT().

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

Modified: stable/12/sys/arm64/arm64/pmap.c
==
--- stable/12/sys/arm64/arm64/pmap.cMon Sep 16 02:31:58 2019
(r352373)
+++ stable/12/sys/arm64/arm64/pmap.cMon Sep 16 04:54:17 2019
(r352374)
@@ -315,6 +315,7 @@ static __inline vm_page_t pmap_remove_pt_page(pmap_t p
  * They need to be atomic as the System MMU may write to the table at
  * the same time as the CPU.
  */
+#definepmap_clear(table) atomic_store_64(table, 0)
 #definepmap_load_store(table, entry) atomic_swap_64(table, entry)
 #definepmap_set(table, mask) atomic_set_64(table, mask)
 #definepmap_load_clear(table) atomic_swap_64(table, 0)
@@ -1208,7 +1209,7 @@ pmap_kremove(vm_offset_t va)
KASSERT(pte != NULL, ("pmap_kremove: Invalid address"));
KASSERT(lvl == 3, ("pmap_kremove: Invalid pte level %d", lvl));
 
-   pmap_load_clear(pte);
+   pmap_clear(pte);
pmap_invalidate_page(kernel_pmap, va);
 }
 
@@ -1230,7 +1231,7 @@ pmap_kremove_device(vm_offset_t sva, vm_size_t size)
KASSERT(pte != NULL, ("Invalid page table, va: 0x%lx", va));
KASSERT(lvl == 3,
("Invalid device pagetable level: %d != 3", lvl));
-   pmap_load_clear(pte);
+   pmap_clear(pte);
 
va += PAGE_SIZE;
size -= PAGE_SIZE;
@@ -1315,7 +1316,7 @@ pmap_qremove(vm_offset_t sva, int count)
KASSERT(lvl == 3,
("Invalid device pagetable level: %d != 3", lvl));
if (pte != NULL) {
-   pmap_load_clear(pte);
+   pmap_clear(pte);
}
 
va += PAGE_SIZE;
@@ -1374,19 +1375,19 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t
pd_entry_t *l0;
 
l0 = pmap_l0(pmap, va);
-   pmap_load_clear(l0);
+   pmap_clear(l0);
} else if (m->pindex >= NUL2E) {
/* l2 page */
pd_entry_t *l1;
 
l1 = pmap_l1(pmap, va);
-   pmap_load_clear(l1);
+   pmap_clear(l1);
} else {
/* l3 page */
pd_entry_t *l2;
 
l2 = pmap_l2(pmap, va);
-   pmap_load_clear(l2);
+   pmap_clear(l2);
}
pmap_resident_count_dec(pmap, 1);
if (m->pindex < NUL2E) {
@@ -2760,8 +2761,7 @@ retry:
tpde = pmap_load(pde);
 
pte = pmap_l2_to_l3(pde, pv->pv_va);
-   tpte = pmap_load(pte);
-   pmap_load_clear(pte);
+   tpte = pmap_load_clear(pte);
pmap_invalidate_page(pmap, pv->pv_va);
if (tpte & ATTR_SW_WIRED)
pmap->pm_stats.wired_count--;
@@ -2930,7 +2930,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent
critical_enter();
 
/* Clear the old mapping */
-   pmap_load_clear(pte);
+   pmap_clear(pte);
pmap_invalidate_range_nopin(pmap, va, va + size);
 
/* Create the new mapping */
@@ -3208,9 +3208,10 @@ havel3:
}
 
/*
-* The physical page has changed.
+* The physical page has changed.  Temporarily invalidate
+* the mapping.
 */
-   (void)pmap_load_clear(l3);
+   orig_l3 = pmap_load_clear(l3);
KASSERT((orig_l3 & ~ATTR_MASK) == opa,
("pmap_enter: unexpected pa update for %#lx", va));
if ((orig_l3 & ATTR_SW_MANAGED) != 0) 

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

2019-09-15 Thread Alan Cox
Author: alc
Date: Mon Sep 16 02:31:58 2019
New Revision: 352373
URL: https://svnweb.freebsd.org/changeset/base/352373

Log:
  MFC r349003, r349031, r349042, r349129, r349290, r349618, r349798
Change pmap_demote_l2_locked() so that it removes the superpage mapping on
a demotion failure.  Otherwise, some callers to pmap_demote_l2_locked(),
such as pmap_protect(), may leave an incorrect mapping in place on a
demotion failure.
  
Change pmap_demote_l2_locked() so that it handles addresses that are not
superpage aligned.  Some callers to pmap_demote_l2_locked(), such as
pmap_protect(), may not pass a superpage aligned address.
  
Optimize TLB invalidation in pmap_remove_l2().
  
Change the arm64 pmap so that updates to the global count of wired pages
are not performed directly by the pmap.  Instead, they are performed by
vm_page_free_pages_toq().
  
Batch the TLB invalidations that are performed by pmap_protect() rather
than performing them one at a time.
  
Eliminate a redundant call to pmap_invalidate_page() from
pmap_ts_referenced().
  
Introduce pmap_remove_l3_range() and use it in two places: (1)
pmap_remove(), where it eliminates redundant TLB invalidations by
pmap_remove() and pmap_remove_l3(), and (2) pmap_enter_l2(), where it may
optimize the TLB invalidations by batching them.
  
Implement pmap_copy().
  
Three changes to pmap_enter():
  
1. Use _pmap_alloc_l3() instead of pmap_alloc_l3() in order to handle the
possibility that a superpage mapping for "va" was created while we slept.
  
2. Eliminate code for allocating kernel page table pages.  Kernel page
table pages are preallocated by pmap_growkernel().
  
3. Eliminate duplicated unlock operations when KERN_RESOURCE_SHORTAGE is
returned.

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

Modified: stable/12/sys/arm64/arm64/pmap.c
==
--- stable/12/sys/arm64/arm64/pmap.cMon Sep 16 00:59:10 2019
(r352372)
+++ stable/12/sys/arm64/arm64/pmap.cMon Sep 16 02:31:58 2019
(r352373)
@@ -1410,8 +1410,6 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t
}
pmap_invalidate_page(pmap, va);
 
-   vm_wire_sub(1);
-
/*
 * Put page on a list so that it is released after
 * *ALL* TLB shootdown is done
@@ -2030,9 +2028,8 @@ next_chunk:
SLIST_REMOVE_HEAD(, plinks.s.ss);
/* Recycle a freed page table page. */
m_pc->wire_count = 1;
-   vm_wire_add(1);
}
-   vm_page_free_pages_toq(, false);
+   vm_page_free_pages_toq(, true);
return (m_pc);
 }
 
@@ -2267,6 +2264,8 @@ pmap_pv_demote_l2(pmap_t pmap, vm_offset_t va, vm_padd
int bit, field;
 
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+   KASSERT((va & L2_OFFSET) == 0,
+   ("pmap_pv_demote_l2: va is not 2mpage aligned"));
KASSERT((pa & L2_OFFSET) == 0,
("pmap_pv_demote_l2: pa is not 2mpage aligned"));
CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa);
@@ -2277,7 +2276,6 @@ pmap_pv_demote_l2(pmap_t pmap, vm_offset_t va, vm_padd
 * must not be released until the last pv entry is reinstantiated.
 */
pvh = pa_to_pvh(pa);
-   va = va & ~L2_OFFSET;
pv = pmap_pvh_remove(pvh, pmap, va);
KASSERT(pv != NULL, ("pmap_pv_demote_l2: pv not found"));
m = PHYS_TO_VM_PAGE(pa);
@@ -2433,7 +2431,13 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_
old_l2 = pmap_load_clear(l2);
KASSERT((old_l2 & ATTR_DESCR_MASK) == L2_BLOCK,
("pmap_remove_l2: L2e %lx is not a block mapping", old_l2));
-   pmap_invalidate_range(pmap, sva, sva + L2_SIZE);
+
+   /*
+* Since a promotion must break the 4KB page mappings before making
+* the 2MB page mapping, a pmap_invalidate_page() suffices.
+*/
+   pmap_invalidate_page(pmap, sva);
+
if (old_l2 & ATTR_SW_WIRED)
pmap->pm_stats.wired_count -= L2_SIZE / PAGE_SIZE;
pmap_resident_count_dec(pmap, L2_SIZE / PAGE_SIZE);
@@ -2463,8 +2467,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_
pmap_resident_count_dec(pmap, 1);
KASSERT(ml3->wire_count == NL3PG,
("pmap_remove_l2: l3 page wire count error"));
-   ml3->wire_count = 1;
-   vm_page_unwire_noq(ml3);
+   ml3->wire_count = 0;
pmap_add_delayed_free_list(ml3, free, FALSE);
}
}
@@ -2507,6 +2510,82 @@ pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_
 }
 
 /*
+ * Remove the specified range of addresses from the L3 page table that is
+ * identified by the given L2 entry.
+ */
+static void

svn commit: r352372 - stable/12/lib/libc/sys

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

Log:
  MFC r352231:
  
  getsockopt.2: clarify that SO_TIMESTAMP is not 100% reliable
  
  When SO_TIMESTAMP is set, the kernel will attempt to attach a timestamp as
  ancillary data to each IP datagram that is received on the socket. However,
  it may fail, for example due to insufficient memory. In that case the
  packet will still be received but not timestamp will be attached.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D21607

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

Modified: stable/12/lib/libc/sys/getsockopt.2
==
--- stable/12/lib/libc/sys/getsockopt.2 Mon Sep 16 00:56:33 2019
(r352371)
+++ stable/12/lib/libc/sys/getsockopt.2 Mon Sep 16 00:59:10 2019
(r352372)
@@ -28,7 +28,7 @@
 .\" @(#)getsockopt.2   8.4 (Berkeley) 5/2/95
 .\" $FreeBSD$
 .\"
-.Dd February 10, 2019
+.Dd September 11, 2019
 .Dt GETSOCKOPT 2
 .Os
 .Sh NAME
@@ -431,7 +431,8 @@ option is enabled on a
 .Dv SOCK_DGRAM
 socket, the
 .Xr recvmsg 2
-call will return a timestamp corresponding to when the datagram was received.
+call may return a timestamp corresponding to when the datagram was received.
+However, it may not, for example due to a resource shortage.
 The
 .Va msg_control
 field in 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: r352371 - in stable/12: etc/mtree sbin/ping sbin/ping/tests

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

Log:
  MFC r351318, r351330, r351393, r351398, r351440, r351461, r351548, r352226, 
r352229
  
  r351318:
  ping: Add tests of the Internet checksum function
  
  Submitted by: Ján Sučan 
  Sponsored by: Google LLC (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21340
  
  r351330:
  ping: do reverse DNS lookup of the target address
  
  When printing replies, ping will now attempt a reverse DNS lookup of the
  target.  That can be suppressed by using the "-n" option.  Curiously, ping
  has always done reverse lookups in certain error paths, but never in the
  success path.
  
  Submitted by: Ján Sučan 
  Sponsored by: Google LLC (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21351
  
  r351393:
  ping: add a basic functional test
  
  Submitted by: Ján Sučan 
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21289
  
  r351398:
  ping: By default, don't reverse lookup IP addresses
  
  ping's default is now not to attempt reverse DNS lookups.  The -H flag will
  enable them.  This change is not quite a reversion of r351330.  That change
  made the happy path and error path do reverse lookups consistently; this
  change changes the default for both paths.
  
  Submitted by: Ján Sučan 
  Discussed with:   cem
  MFC-With: 351330
  Sponsored by: Google LLC (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21364
  
  r351440:
  ping: Fix alignment errors
  
  This fixes -Wcast-align errors when compiled with WARNS=6.
  
  Submitted by: Ján Sučan 
  Sponsored by: Google LLC (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21327
  
  r351461:
  ping: fix unaligned access to ancillary data
  
  Use CMSG_FIRSTHDR rather than assume that an array is correctly aligned.
  Fixes warnings on sparc64 and powerpcspe.
  
  Submitted by: Ján Sučan 
  MFH:  2 weeks
  Sponsored by: Google LLC (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21406
  
  r351548:
  ping: raise WARNS level to 6
  
  Submitted by: Ján Sučan 
  Sponsored by: Google LLC (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21405
  
  r352226:
  ping: fix a string in an error message
  
  r352229:
  ping: Verify whether a datagram timestamp was actually received.
  
  ping(8) uses SO_TIMESTAMP, which attaches a timestamp to each IP datagram at
  the time it's received by the kernel.  Except that occasionally it doesn't.
  Add a check to see whether such a timestamp was actually set before trying
  to read it.  This fixes segfaults that can happen when the kernel doesn't
  attach a timestamp.
  
  The bug has always existed, but prior to r351461 it manifested as an
  implausible round-trip-time, not a segfault.
  
  Reported by:  pho
  MFC-With: 351461

Added:
  stable/12/sbin/ping/tests/
 - copied from r351318, head/sbin/ping/tests/
  stable/12/sbin/ping/tests/ping_c1_s56_t1.out
 - copied, changed from r351393, head/sbin/ping/tests/ping_c1_s56_t1.out
  stable/12/sbin/ping/tests/ping_test.sh
 - copied unchanged from r351393, head/sbin/ping/tests/ping_test.sh
Modified:
  stable/12/etc/mtree/BSD.tests.dist
  stable/12/sbin/ping/Makefile
  stable/12/sbin/ping/ping.8
  stable/12/sbin/ping/ping.c
  stable/12/sbin/ping/tests/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/etc/mtree/BSD.tests.dist
==
--- stable/12/etc/mtree/BSD.tests.dist  Mon Sep 16 00:32:23 2019
(r352370)
+++ stable/12/etc/mtree/BSD.tests.dist  Mon Sep 16 00:56:33 2019
(r352371)
@@ -428,6 +428,8 @@
 files
 ..
 ..
+ping
+..
 ..
 secure
 lib

Modified: stable/12/sbin/ping/Makefile
==
--- stable/12/sbin/ping/MakefileMon Sep 16 00:32:23 2019
(r352370)
+++ stable/12/sbin/ping/MakefileMon Sep 16 00:56:33 2019
(r352371)
@@ -9,7 +9,6 @@ SRCS=   ping.c utils.c
 MAN=   ping.8
 BINOWN=root
 BINMODE=4555
-WARNS?=3
 LIBADD=m
 
 .if ${MK_DYNAMICROOT} == "no"
@@ -24,5 +23,8 @@ CFLAGS+=-DWITH_CASPER
 CFLAGS+=-DIPSEC
 LIBADD+=   ipsec
 .endif
+
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
 
 .include 

Modified: stable/12/sbin/ping/ping.8
==
--- stable/12/sbin/ping/ping.8  Mon Sep 16 00:32:23 2019(r352370)
+++ stable/12/sbin/ping/ping.8  Mon Sep 16 00:56:33 2019(r352371)
@@ -28,7 +28,7 @@
 .\" @(#)ping.8 8.2 (Berkeley) 12/11/93
 .\" 

Re: svn commit: r352337 - in head: share/man/man3 sys/sys tests/sys/sys

2019-09-15 Thread Conrad Meyer
On Sun, Sep 15, 2019 at 12:51 PM Edward Tomasz Napierala
 wrote:
> On 0914T1532, Conrad Meyer wrote:
> > On Sat, Sep 14, 2019 at 12:23 PM Edward Tomasz Napierala
> >  wrote:
> > > URL: https://svnweb.freebsd.org/changeset/base/352337
> > >
> > > Log:
> > >   Introduce arb(3), the Array-based Red-Black Tree macros: similar
> > >   to the traditional tree(3) RB trees, but using an array (preallocated,
> > >   linear chunk of memory) to store the tree.
> > > ...
> > >
> > >   Reviewed by:  bcr (man pages), markj
> > >   Discussed with:   cem
> > > ...
> > >   Differential Revision: https://reviews.freebsd.org/D20324
> >
> > This should read: "Objected to by: cem"
>
> Sorry, I misunderstood your last comment as withdrawing your objection,
> my mistake.

The comment that starts with "I'm still skeptical?"  "Less
objectionable" doesn't mean "not objectionable."  Maybe I could have
been more explicit, sorry for the confusion.

Conrad
___
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: r352370 - head/share/mk

2019-09-15 Thread Simon J. Gerraty
Author: sjg
Date: Mon Sep 16 00:32:23 2019
New Revision: 352370
URL: https://svnweb.freebsd.org/changeset/base/352370

Log:
  Document logic for __DEFAULT_DEPENDENT_OPTIONS
  
  Reviewed by:  stevek
  Differential Revision:https://reviews.freebsd.org/D21640

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

Modified: head/share/mk/bsd.mkopt.mk
==
--- head/share/mk/bsd.mkopt.mk  Sun Sep 15 23:56:39 2019(r352369)
+++ head/share/mk/bsd.mkopt.mk  Mon Sep 16 00:32:23 2019(r352370)
@@ -11,12 +11,16 @@
 # For each option FOO in __DEFAULT_NO_OPTIONS, MK_FOO is set to "no",
 # unless WITH_FOO is defined, in which case it is set to "yes".
 #
+# For each entry FOO/BAR in __DEFAULT_DEPENDENT_OPTIONS,
+# MK_FOO is set to "no" if WITHOUT_FOO is defined,
+# "yes" if WITH_FOO is defined, otherwise the value of MK_BAR.
+#
 # If both WITH_FOO and WITHOUT_FOO are defined, WITHOUT_FOO wins and
 # MK_FOO is set to "no" regardless of which list it was in.
 #
-# Both __DEFAULT_YES_OPTIONS and __DEFAULT_NO_OPTIONS are undef'd
-# after all this processing, allowing this file to be included
-# multiple times with different lists.
+# All of __DEFAULT_YES_OPTIONS, __DEFAULT_NO_OPTIONS and
+# __DEFAULT_DEPENDENT_OPTIONS are undef'd after all this processing,
+# allowing this file to be included multiple times with different lists.
 #
 # Other parts of the build system will set BROKEN_OPTIONS to a list
 # of options that are broken on this platform. This will not be unset
___
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: r352369 - head/sys/dev/uart

2019-09-15 Thread Alexander Motin
Author: mav
Date: Sun Sep 15 23:56:39 2019
New Revision: 352369
URL: https://svnweb.freebsd.org/changeset/base/352369

Log:
  Relax TX draining in ns8250_bus_transmit().
  
  Since TX interrupt is generated when THRE is set, wait for TEMT set means
  wait for full character transmission time.  At low speeds that may take
  awhile, burning CPU time while holding sc_hwmtx lock, also congested.
  
  This is partial revert of r317659.
  
  PR:   240121
  MFC after:2 weeks

Modified:
  head/sys/dev/uart/uart_dev_ns8250.c

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==
--- head/sys/dev/uart/uart_dev_ns8250.c Sun Sep 15 21:32:19 2019
(r352368)
+++ head/sys/dev/uart/uart_dev_ns8250.c Sun Sep 15 23:56:39 2019
(r352369)
@@ -1029,13 +1029,8 @@ ns8250_bus_transmit(struct uart_softc *sc)
 
bas = >sc_bas;
uart_lock(sc->sc_hwmtx);
-   if (sc->sc_txdatasz > 1) {
-   if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0)
-   ns8250_drain(bas, UART_DRAIN_TRANSMITTER);
-   } else {
-   while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
-   DELAY(4);
-   }
+   while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
+   DELAY(4);
for (i = 0; i < sc->sc_txdatasz; i++) {
uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]);
uart_barrier(bas);
___
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: r352368 - stable/12/sys/arm64/arm64

2019-09-15 Thread Alan Cox
Author: alc
Date: Sun Sep 15 21:32:19 2019
New Revision: 352368
URL: https://svnweb.freebsd.org/changeset/base/352368

Log:
  MFC r349070
Previously, when pmap_remove_pages() destroyed a dirty superpage mapping,
it only called vm_page_dirty() on the first of the superpage's constituent
4KB pages.  This revision corrects that error, calling vm_page_dirty() on
all of superpage's constituent 4KB pages.

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

Modified: stable/12/sys/arm64/arm64/pmap.c
==
--- stable/12/sys/arm64/arm64/pmap.cSun Sep 15 21:27:14 2019
(r352367)
+++ stable/12/sys/arm64/arm64/pmap.cSun Sep 15 21:32:19 2019
(r352368)
@@ -4055,7 +4055,7 @@ pmap_remove_pages(pmap_t pmap)
switch (lvl) {
case 1:
for (mt = m; mt < [L2_SIZE / 
PAGE_SIZE]; mt++)
-   vm_page_dirty(m);
+   vm_page_dirty(mt);
break;
case 2:
vm_page_dirty(m);
___
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: r352367 - stable/12/sys/arm64/arm64

2019-09-15 Thread Alan Cox
Author: alc
Date: Sun Sep 15 21:27:14 2019
New Revision: 352367
URL: https://svnweb.freebsd.org/changeset/base/352367

Log:
  MFC r349905
According to Section D5.10.3 "Maintenance requirements on changing System
register values" of the architecture manual, an isb instruction should be
executed after updating ttbr0_el1 and before invalidating the TLB.

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

Modified: stable/12/sys/arm64/arm64/efirt_machdep.c
==
--- stable/12/sys/arm64/arm64/efirt_machdep.c   Sun Sep 15 21:13:13 2019
(r352366)
+++ stable/12/sys/arm64/arm64/efirt_machdep.c   Sun Sep 15 21:27:14 2019
(r352367)
@@ -245,6 +245,7 @@ efi_arch_enter(void)
 
__asm __volatile(
"msr ttbr0_el1, %0  \n"
+   "isb\n"
"dsb  ishst \n"
"tlbi vmalle1is \n"
"dsb  ish   \n"
@@ -262,6 +263,7 @@ efi_arch_leave(void)
td = curthread;
__asm __volatile(
"msr ttbr0_el1, %0  \n"
+   "isb\n"
"dsb  ishst \n"
"tlbi vmalle1is \n"
"dsb  ish   \n"

Modified: stable/12/sys/arm64/arm64/pmap.c
==
--- stable/12/sys/arm64/arm64/pmap.cSun Sep 15 21:13:13 2019
(r352366)
+++ stable/12/sys/arm64/arm64/pmap.cSun Sep 15 21:27:14 2019
(r352367)
@@ -5175,8 +5175,10 @@ pmap_activate(struct thread *td)
critical_enter();
pmap = vmspace_pmap(td->td_proc->p_vmspace);
td->td_proc->p_md.md_l0addr = vtophys(pmap->pm_l0);
-   __asm __volatile("msr ttbr0_el1, %0" : :
-   "r"(td->td_proc->p_md.md_l0addr));
+   __asm __volatile(
+   "msr ttbr0_el1, %0  \n"
+   "isb\n"
+   : : "r"(td->td_proc->p_md.md_l0addr));
pmap_invalidate_all(pmap);
critical_exit();
 }
___
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: r352366 - stable/12/sys/vm

2019-09-15 Thread Doug Moore
Author: dougm
Date: Sun Sep 15 21:13:13 2019
New Revision: 352366
URL: https://svnweb.freebsd.org/changeset/base/352366

Log:
  MFC r348809, r349767
  Let swap_pager_swapoff_object and swp_pager_force_pagein operate on
  multiple pages per I/O operation.
  
  Reviewed by: alc
  Approved by: markj (implicit, mentor)

Modified:
  stable/12/sys/vm/swap_pager.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/swap_pager.c
==
--- stable/12/sys/vm/swap_pager.c   Sun Sep 15 20:13:46 2019
(r352365)
+++ stable/12/sys/vm/swap_pager.c   Sun Sep 15 21:13:13 2019
(r352366)
@@ -1653,56 +1653,143 @@ swap_pager_nswapdev(void)
return (nswapdev);
 }
 
-/*
- * SWP_PAGER_FORCE_PAGEIN() - force a swap block to be paged in
- *
- * This routine dissociates the page at the given index within an object
- * from its backing store, paging it in if it does not reside in memory.
- * If the page is paged in, it is marked dirty and placed in the laundry
- * queue.  The page is marked dirty because it no longer has backing
- * store.  It is placed in the laundry queue because it has not been
- * accessed recently.  Otherwise, it would already reside in memory.
- *
- * We also attempt to swap in all other pages in the swap block.
- * However, we only guarantee that the one at the specified index is
- * paged in.
- *
- * XXX - The code to page the whole block in doesn't work, so we
- *   revert to the one-by-one behavior for now.  Sigh.
- */
-static inline void
-swp_pager_force_pagein(vm_object_t object, vm_pindex_t pindex)
+static void
+swp_pager_force_dirty(vm_page_t m)
 {
-   vm_page_t m;
 
-   vm_object_pip_add(object, 1);
-   m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL);
-   if (m->valid == VM_PAGE_BITS_ALL) {
-   vm_object_pip_wakeup(object);
-   vm_page_dirty(m);
+   vm_page_dirty(m);
 #ifdef INVARIANTS
-   vm_page_lock(m);
-   if (!vm_page_wired(m) && m->queue == PQ_NONE)
-   panic("page %p is neither wired nor queued", m);
-   vm_page_unlock(m);
+   vm_page_lock(m);
+   if (!vm_page_wired(m) && m->queue == PQ_NONE)
+   panic("page %p is neither wired nor queued", m);
+   vm_page_unlock(m);
 #endif
-   vm_page_xunbusy(m);
-   vm_pager_page_unswapped(m);
-   return;
-   }
+   vm_page_xunbusy(m);
+   swap_pager_unswapped(m);
+}
 
-   if (swap_pager_getpages(object, , 1, NULL, NULL) != VM_PAGER_OK)
-   panic("swap_pager_force_pagein: read from swap failed");/*XXX*/
-   vm_object_pip_wakeup(object);
+static void
+swp_pager_force_launder(vm_page_t m)
+{
+
vm_page_dirty(m);
vm_page_lock(m);
vm_page_launder(m);
vm_page_unlock(m);
vm_page_xunbusy(m);
-   vm_pager_page_unswapped(m);
+   swap_pager_unswapped(m);
 }
 
 /*
+ * SWP_PAGER_FORCE_PAGEIN() - force swap blocks to be paged in
+ *
+ * This routine dissociates pages starting at the given index within an
+ * object from their backing store, paging them in if they do not reside
+ * in memory.  Pages that are paged in are marked dirty and placed in the
+ * laundry queue.  Pages are marked dirty because they no longer have
+ * backing store.  They are placed in the laundry queue because they have
+ * not been accessed recently.  Otherwise, they would already reside in
+ * memory.
+ */
+static void
+swp_pager_force_pagein(vm_object_t object, vm_pindex_t pindex, int npages)
+{
+   vm_page_t ma[npages];
+   int i, j;
+
+   KASSERT(npages > 0, ("%s: No pages", __func__));
+   KASSERT(npages <= MAXPHYS / PAGE_SIZE,
+   ("%s: Too many pages: %d", __func__, npages));
+   vm_object_pip_add(object, npages);
+   vm_page_grab_pages(object, pindex, VM_ALLOC_NORMAL, ma, npages);
+   for (i = j = 0;; i++) {
+   /* Count nonresident pages, to page-in all at once. */
+   if (i < npages && ma[i]->valid != VM_PAGE_BITS_ALL)
+   continue;
+   if (j < i) {
+   /* Page-in nonresident pages. Mark for laundering. */
+   if (swap_pager_getpages(object, [j], i - j, NULL,
+   NULL) != VM_PAGER_OK)
+   panic("%s: read from swap failed", __func__);
+   do {
+   swp_pager_force_launder(ma[j]);
+   } while (++j < i);
+   }
+   if (i == npages)
+   break;
+   /* Mark dirty a resident page. */
+   swp_pager_force_dirty(ma[j++]);
+   }
+   vm_object_pip_wakeupn(object, npages);
+}
+
+/*
+ * swap_pager_swapoff_object:
+ *
+ * Page in all of 

svn commit: r352365 - in stable/12: sbin/swapon share/man/man5 sys/vm

2019-09-15 Thread Doug Moore
Author: dougm
Date: Sun Sep 15 20:13:46 2019
New Revision: 352365
URL: https://svnweb.freebsd.org/changeset/base/352365

Log:
  MFC 351064
  Don't let swapon trimming wipe the bsd label.
  
  Reviewed by: alc
  Approved by: markj (mentor, implicit)

Modified:
  stable/12/sbin/swapon/swapon.8
  stable/12/sbin/swapon/swapon.c
  stable/12/share/man/man5/fstab.5
  stable/12/sys/vm/swap_pager.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/swapon/swapon.8
==
--- stable/12/sbin/swapon/swapon.8  Sun Sep 15 19:41:54 2019
(r352364)
+++ stable/12/sbin/swapon/swapon.8  Sun Sep 15 20:13:46 2019
(r352365)
@@ -90,7 +90,17 @@ The
 .Fl E
 option causes each of following devices to receive a
 .Dv BIO_DELETE
-command to mark all blocks as unused.
+command.
+This command marks the device's blocks as unused, except those that
+might store a disk label.
+This marking can erase a crash dump.
+To delay
+.Nm swapon
+for a device until after
+.Nm savecore
+has copied the crash dump to another location, use the 
+.Dq late
+option.
 .Pp
 The
 .Nm swapoff

Modified: stable/12/sbin/swapon/swapon.c
==
--- stable/12/sbin/swapon/swapon.c  Sun Sep 15 19:41:54 2019
(r352364)
+++ stable/12/sbin/swapon/swapon.c  Sun Sep 15 20:13:46 2019
(r352365)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -761,8 +762,8 @@ swapon_trim(const char *name)
} else
errx(1, "%s has an invalid file type", name);
/* Trim the device. */
-   ioarg[0] = 0;
-   ioarg[1] = sz;
+   ioarg[0] = BBSIZE;
+   ioarg[1] = sz - BBSIZE;
if (ioctl(fd, DIOCGDELETE, ioarg) != 0)
warn("ioctl(DIOCGDELETE)");
 

Modified: stable/12/share/man/man5/fstab.5
==
--- stable/12/share/man/man5/fstab.5Sun Sep 15 19:41:54 2019
(r352364)
+++ stable/12/share/man/man5/fstab.5Sun Sep 15 20:13:46 2019
(r352365)
@@ -220,8 +220,17 @@ For swap devices, the keyword
 .Dq trimonce
 triggers the delivery of a
 .Dv BIO_DELETE
-command to the device to mark
-all blocks as unused.
+command to the device.
+This command marks the device's blocks as unused, except those that
+might store a disk label.
+This marking can erase a crash dump.
+To delay
+.Nm swapon
+for a device until after
+.Nm savecore
+has copied the crash dump to another location, use the 
+.Dq late
+option.
 For vnode-backed swap spaces,
 .Dq file
 is supported in the

Modified: stable/12/sys/vm/swap_pager.c
==
--- stable/12/sys/vm/swap_pager.c   Sun Sep 15 19:41:54 2019
(r352364)
+++ stable/12/sys/vm/swap_pager.c   Sun Sep 15 20:13:46 2019
(r352365)
@@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2240,10 +2241,11 @@ swaponsomething(struct vnode *vp, void *id, u_long nbl
 
sp->sw_blist = blist_create(nblks, M_WAITOK);
/*
-* Do not free the first two block in order to avoid overwriting
+* Do not free the first blocks in order to avoid overwriting
 * any bsd label at the front of the partition
 */
-   blist_free(sp->sw_blist, 2, nblks - 2);
+   blist_free(sp->sw_blist, howmany(BBSIZE, PAGE_SIZE),
+   nblks - howmany(BBSIZE, PAGE_SIZE));
 
dvbase = 0;
mtx_lock(_dev_mtx);
@@ -2261,7 +2263,7 @@ swaponsomething(struct vnode *vp, void *id, u_long nbl
sp->sw_end = dvbase + nblks;
TAILQ_INSERT_TAIL(, sp, sw_list);
nswapdev++;
-   swap_pager_avail += nblks - 2;
+   swap_pager_avail += nblks - howmany(BBSIZE, PAGE_SIZE);
swap_total += nblks;
swapon_check_swzone();
swp_sizecheck();
___
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: r352337 - in head: share/man/man3 sys/sys tests/sys/sys

2019-09-15 Thread Edward Tomasz Napierala
On 0914T1532, Conrad Meyer wrote:
> One correction:
> 
> On Sat, Sep 14, 2019 at 12:23 PM Edward Tomasz Napierala
>  wrote:
> >
> > Author: trasz
> > Date: Sat Sep 14 19:23:46 2019
> > New Revision: 352337
> > URL: https://svnweb.freebsd.org/changeset/base/352337
> >
> > Log:
> >   Introduce arb(3), the Array-based Red-Black Tree macros: similar
> >   to the traditional tree(3) RB trees, but using an array (preallocated,
> >   linear chunk of memory) to store the tree.
> >
> >   This avoids allocation overhead, improves memory locality,
> >   and makes it trivially easy to share/transfer/copy the entire tree
> >   without the need for marshalling.  The downside is that the size
> >   is fixed at initialization time; there is no mechanism to resize
> >   it.
> >
> >   This is one of the dependencies for the new stats(3) framework
> >   (https://reviews.freebsd.org/D20477).
> >
> >   Reviewed by:  bcr (man pages), markj
> >   Discussed with:   cem
> 
> This should read: "Objected to by: cem"

Sorry, I misunderstood your last comment as withdrawing your objection,
my mistake.

___
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: r352364 - head/sbin/fsck_msdosfs

2019-09-15 Thread Xin LI
Author: delphij
Date: Sun Sep 15 19:41:54 2019
New Revision: 352364
URL: https://svnweb.freebsd.org/changeset/base/352364

Log:
  Avoid mixing cluster numbers and sector numbers. Makes code more readable.
  
  Obtained from:NetBSD
  MFC after:2 weeks

Modified:
  head/sbin/fsck_msdosfs/boot.c
  head/sbin/fsck_msdosfs/dir.c
  head/sbin/fsck_msdosfs/dosfs.h

Modified: head/sbin/fsck_msdosfs/boot.c
==
--- head/sbin/fsck_msdosfs/boot.c   Sun Sep 15 19:38:15 2019
(r352363)
+++ head/sbin/fsck_msdosfs/boot.c   Sun Sep 15 19:41:54 2019
(r352364)
@@ -259,12 +259,18 @@ readboot(int dosfs, struct bootblock *boot)
return FSFATAL;
}
 
-   boot->ClusterOffset = (boot->bpbRootDirEnts * 32 +
+   boot->FirstCluster = (boot->bpbRootDirEnts * 32 +
boot->bpbBytesPerSec - 1) / boot->bpbBytesPerSec +
-   boot->bpbResSectors + boot->bpbFATs * boot->FATsecs -
-   CLUST_FIRST * boot->bpbSecPerClust;
-   boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) /
-   boot->bpbSecPerClust;
+   boot->bpbResSectors + boot->bpbFATs * boot->FATsecs;
+
+   if (boot->FirstCluster + boot->bpbSecPerClust > boot->NumSectors) {
+   pfatal("Cluster offset too large (%u clusters)\n",
+   boot->FirstCluster);
+   return FSFATAL;
+   }
+
+   boot->NumClusters = (boot->NumSectors - boot->FirstCluster) / 
boot->bpbSecPerClust +
+   CLUST_FIRST;
 
if (boot->flags & FAT32)
boot->ClustMask = CLUST32_MASK;

Modified: head/sbin/fsck_msdosfs/dir.c
==
--- head/sbin/fsck_msdosfs/dir.cSun Sep 15 19:38:15 2019
(r352363)
+++ head/sbin/fsck_msdosfs/dir.cSun Sep 15 19:41:54 2019
(r352364)
@@ -317,7 +317,8 @@ delete(int f, struct bootblock *boot, struct fatEntry 
break;
e = delbuf + endoff;
}
-   off = startcl * boot->bpbSecPerClust + boot->ClusterOffset;
+   off = (startcl - CLUST_FIRST) * boot->bpbSecPerClust + 
boot->FirstCluster;
+
off *= boot->bpbBytesPerSec;
if (lseek(f, off, SEEK_SET) != off) {
perr("Unable to lseek to %" PRId64, off);
@@ -457,7 +458,7 @@ check_subdirectory(int f, struct bootblock *boot, stru
off = boot->bpbResSectors + boot->bpbFATs *
boot->FATsecs;
} else {
-   off = cl * boot->bpbSecPerClust + boot->ClusterOffset;
+   off = (cl - CLUST_FIRST) * boot->bpbSecPerClust + 
boot->FirstCluster;
}
 
/*
@@ -538,7 +539,7 @@ readDosDirSection(int f, struct bootblock *boot, struc
boot->FATsecs;
} else {
last = boot->bpbSecPerClust * boot->bpbBytesPerSec;
-   off = cl * boot->bpbSecPerClust + boot->ClusterOffset;
+   off = (cl - CLUST_FIRST) * boot->bpbSecPerClust + 
boot->FirstCluster;
}
 
off *= boot->bpbBytesPerSec;
@@ -1069,8 +1070,9 @@ reconnect(int dosfs, struct bootblock *boot, struct fa
lfcl = (lostDir->head < boot->NumClusters) ? 
lostDir->head : 0;
return FSERROR;
}
-   lfoff = lfcl * boot->ClusterSize
-   + boot->ClusterOffset * boot->bpbBytesPerSec;
+   lfoff = (lfcl - CLUST_FIRST) * boot->ClusterSize
+   + boot->FirstCluster * boot->bpbBytesPerSec;
+
if (lseek(dosfs, lfoff, SEEK_SET) != lfoff
|| (size_t)read(dosfs, lfbuf, boot->ClusterSize) != 
boot->ClusterSize) {
perr("could not read LOST.DIR");

Modified: head/sbin/fsck_msdosfs/dosfs.h
==
--- head/sbin/fsck_msdosfs/dosfs.h  Sun Sep 15 19:38:15 2019
(r352363)
+++ head/sbin/fsck_msdosfs/dosfs.h  Sun Sep 15 19:41:54 2019
(r352364)
@@ -74,7 +74,7 @@ struct bootblock {
u_int32_t NumSectors;   /* how many sectors are there */
u_int32_t FATsecs;  /* how many sectors are in FAT */
u_int32_t NumFatEntries;/* how many entries really are there */
-   u_int   ClusterOffset;  /* at what sector would sector 0 start 
*/
+   u_int   FirstCluster;   /* at what sector is Cluster 
CLUST_FIRST */
u_int   ClusterSize;/* Cluster size in bytes */
 
/* Now some statistics: */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r352363 - head/sys/arm/freescale/imx

2019-09-15 Thread Ian Lepore
Author: ian
Date: Sun Sep 15 19:38:15 2019
New Revision: 352363
URL: https://svnweb.freebsd.org/changeset/base/352363

Log:
  Apply a runtime patch to the FDT data for imx6 to fix iomuxc problems.
  
  The latest imported FDT data defines a node for an iomuxc-gpr device,
  which we don't support (or need, right now) in addition to the usual
  iomuxc device.  Unfortunately, the dts improperly assigns overlapping
  ranges of mmio space to both devices.  The -gpr device is also a syscon
  and simple_mfd device.
  
  At runtime the simple_mfd driver attaches for the iomuxc-gpr node, then
  when the real iomuxc driver comes along later, it fails to attach because
  it tries to allocate its register space, and it's already partially in
  use by the bogus instance of simple_mfd.
  
  This change works around the problem by simply disabling the node for
  the iomuxc-gpr device, since we don't need it for anything.

Modified:
  head/sys/arm/freescale/imx/imx6_machdep.c

Modified: head/sys/arm/freescale/imx/imx6_machdep.c
==
--- head/sys/arm/freescale/imx/imx6_machdep.c   Sun Sep 15 19:16:42 2019
(r352362)
+++ head/sys/arm/freescale/imx/imx6_machdep.c   Sun Sep 15 19:38:15 2019
(r352363)
@@ -148,12 +148,43 @@ fix_fdt_interrupt_data(void)
OF_setprop(socnode, "interrupt-parent", , sizeof(gicxref));
 }
 
+static void
+fix_fdt_iomuxc_data(void)
+{
+   phandle_t node;
+
+   /*
+* The linux dts defines two nodes with the same mmio address range,
+* iomuxc-gpr and the regular iomuxc.  The -grp node is a simple_mfd and
+* a syscon, but it only has access to a small subset of the iomuxc
+* registers, so it can't serve as the accessor for the iomuxc driver's
+* register IO.  But right now, the simple_mfd driver attaches first,
+* preventing the real iomuxc driver from allocating its mmio register
+* range because it partially overlaps with the -gpr range.
+*
+* For now, by far the easiest thing to do to keep imx6 working is to
+* just disable the iomuxc-gpr node because we don't have a driver for
+* it anyway, we just need to prevent attachment of simple_mfd.
+*
+* If we ever write a -gpr driver, this code should probably switch to
+* modifying the reg property so that the range covers all the iomuxc
+* regs, then the -gpr driver can be a regular syscon driver that iomuxc
+* uses for register access.
+*/
+   node = OF_finddevice("/soc/aips-bus@200/iomuxc-gpr@20e");
+   if (node != -1)
+   OF_setprop(node, "status", "disabled", sizeof("disabled"));
+}
+
 static int
 imx6_attach(platform_t plat)
 {
 
/* Fix soc interrupt-parent property. */
fix_fdt_interrupt_data();
+
+   /* Fix iomuxc-gpr and iomuxc nodes both using the same mmio range. */
+   fix_fdt_iomuxc_data();
 
/* Inform the MPCore timer driver that its clock is variable. */
arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES);
___
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: r352362 - stable/12/sys/dev/ichiic

2019-09-15 Thread Vladimir Kondratyev
Author: wulf
Date: Sun Sep 15 19:16:42 2019
New Revision: 352362
URL: https://svnweb.freebsd.org/changeset/base/352362

Log:
  ig4(4): Fix SDA HOLD time set too low on Skylake controllers
  
  Execution of "Soft reset" command (IG4_REG_RESETS_SKL) at controller init
  stage sets SDA_HOLD register value to 0x0001 which is often too low for
  normal operation.
  
  Set SDA_HOLD back to 28 after reset to restore controller functionality.
  
  PR:   240339
  Reported by:  imp, GregV, et al.

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

Modified: stable/12/sys/dev/ichiic/ig4_iic.c
==
--- stable/12/sys/dev/ichiic/ig4_iic.c  Sun Sep 15 18:29:45 2019
(r352361)
+++ stable/12/sys/dev/ichiic/ig4_iic.c  Sun Sep 15 19:16:42 2019
(r352362)
@@ -590,6 +590,8 @@ ig4iic_attach(ig4iic_softc_t *sc)
reg_write(sc, IG4_REG_SS_SCL_LCNT, 125);
reg_write(sc, IG4_REG_FS_SCL_HCNT, 100);
reg_write(sc, IG4_REG_FS_SCL_LCNT, 125);
+   if (sc->version == IG4_SKYLAKE)
+   reg_write(sc, IG4_REG_SDA_HOLD, 28);
 
/*
 * Use a threshold of 1 so we get interrupted on each character,
___
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: r352361 - head/sys/netinet

2019-09-15 Thread Michael Tuexen
Author: tuexen
Date: Sun Sep 15 18:29:45 2019
New Revision: 352361
URL: https://svnweb.freebsd.org/changeset/base/352361

Log:
  When the IP layer calls back into the SCTP layer to perform the SCTP
  checksum computation, do not assume that the IP header chain and the
  SCTP common header are in contiguous memory although the SCTP lays
  out the mbuf chains that way. If there are IP-level options inserted
  by the IP layer, the constraint is not fulfilled anymore.
  
  This issues was found by running syzkaller. Thanks to markj@ who is
  running an instance which also provides kernel dumps. This allowed me
  to find this issue.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_crc32.c

Modified: head/sys/netinet/sctp_crc32.c
==
--- head/sys/netinet/sctp_crc32.c   Sun Sep 15 17:59:03 2019
(r352360)
+++ head/sys/netinet/sctp_crc32.c   Sun Sep 15 18:29:45 2019
(r352361)
@@ -132,16 +132,16 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset)
SCTP_STAT_INCR(sctps_sendswcrc);
offset += offsetof(struct sctphdr, checksum);
 
-   if (offset + sizeof(uint32_t) > (uint32_t)(m->m_len)) {
+   if (offset + sizeof(uint32_t) > (uint32_t)(m->m_pkthdr.len)) {
 #ifdef INVARIANTS
-   panic("sctp_delayed_cksum(): m->m_len: %d, offset: %u.",
-   m->m_len, offset);
+   panic("sctp_delayed_cksum(): m->m_pkthdr.len: %d, offset: %u.",
+   m->m_pkthdr.len, offset);
 #else
-   SCTP_PRINTF("sctp_delayed_cksum(): m->m_len: %d, offset: %u.\n",
-   m->m_len, offset);
+   SCTP_PRINTF("sctp_delayed_cksum(): m->m_pkthdr.len: %d, offset: 
%u.\n",
+   m->m_pkthdr.len, offset);
 #endif
return;
}
-   *(uint32_t *)(m->m_data + offset) = checksum;
+   m_copyback(m, (int)offset, (int)sizeof(uint32_t), (caddr_t));
 }
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r352360 - stable/11/sbin/camcontrol

2019-09-15 Thread Alexander Motin
Author: mav
Date: Sun Sep 15 17:59:03 2019
New Revision: 352360
URL: https://svnweb.freebsd.org/changeset/base/352360

Log:
  MFC r352258: Remove Tagged Command Queuing feature reporting.
  
  I never saw those devices myself, FreeBSD never supported them, and it is
  officially obsolete since ACS-2 specification.

Modified:
  stable/11/sbin/camcontrol/camcontrol.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Sun Sep 15 17:58:39 2019
(r352359)
+++ stable/11/sbin/camcontrol/camcontrol.c  Sun Sep 15 17:59:03 2019
(r352360)
@@ -1452,16 +1452,6 @@ atacapprint(struct ata_params *parm)
printf("flush cache%s   %s\n",
parm->support.command2 & ATA_SUPPORT_FLUSHCACHE ? "yes" : "no",
parm->enabled.command2 & ATA_SUPPORT_FLUSHCACHE ? "yes" : "no");
-   printf("overlap%s\n",
-   parm->capabilities1 & ATA_SUPPORT_OVERLAP ? "yes" : "no");
-   printf("Tagged Command Queuing (TCQ)   %s   %s",
-   parm->support.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no",
-   parm->enabled.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no");
-   if (parm->support.command2 & ATA_SUPPORT_QUEUED) {
-   printf("%d tags\n",
-   ATA_QUEUE_LEN(parm->queue) + 1);
-   } else
-   printf("\n");
printf("Native Command Queuing (NCQ)   ");
if (atasata(parm) && (parm->satacapabilities & ATA_SUPPORT_NCQ)) {
printf("yes %d tags\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: r352359 - stable/12/sbin/camcontrol

2019-09-15 Thread Alexander Motin
Author: mav
Date: Sun Sep 15 17:58:39 2019
New Revision: 352359
URL: https://svnweb.freebsd.org/changeset/base/352359

Log:
  MFC r352258: Remove Tagged Command Queuing feature reporting.
  
  I never saw those devices myself, FreeBSD never supported them, and it is
  officially obsolete since ACS-2 specification.

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

Modified: stable/12/sbin/camcontrol/camcontrol.c
==
--- stable/12/sbin/camcontrol/camcontrol.c  Sun Sep 15 17:22:29 2019
(r352358)
+++ stable/12/sbin/camcontrol/camcontrol.c  Sun Sep 15 17:58:39 2019
(r352359)
@@ -1619,16 +1619,6 @@ atacapprint(struct ata_params *parm)
printf("flush cache%s   %s\n",
parm->support.command2 & ATA_SUPPORT_FLUSHCACHE ? "yes" : "no",
parm->enabled.command2 & ATA_SUPPORT_FLUSHCACHE ? "yes" : "no");
-   printf("overlap%s\n",
-   parm->capabilities1 & ATA_SUPPORT_OVERLAP ? "yes" : "no");
-   printf("Tagged Command Queuing (TCQ)   %s   %s",
-   parm->support.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no",
-   parm->enabled.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no");
-   if (parm->support.command2 & ATA_SUPPORT_QUEUED) {
-   printf("%d tags\n",
-   ATA_QUEUE_LEN(parm->queue) + 1);
-   } else
-   printf("\n");
printf("Native Command Queuing (NCQ)   ");
if (atasata(parm) && (parm->satacapabilities & ATA_SUPPORT_NCQ)) {
printf("yes %d tags\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: r352358 - in stable/12/sys: amd64/amd64 arm64/arm64 i386/i386 riscv/riscv

2019-09-15 Thread Alan Cox
Author: alc
Date: Sun Sep 15 17:22:29 2019
New Revision: 352358
URL: https://svnweb.freebsd.org/changeset/base/352358

Log:
  MFC r348828
Implement an alternative solution to the amd64 and i386 pmap problem that
we previously addressed in r348246 (and MFCed in r348479).
  
This pmap problem also exists on arm64 and riscv.  However, the original
solution developed for amd64 and i386 cannot be used on arm64 and riscv.
In particular, arm64 and riscv do not define a PG_PROMOTED flag in their
level 2 PTEs.  (A PG_PROMOTED flag makes no sense on arm64, where unlike
x86 or riscv we are required to break the old 4KB mappings before making
the 2MB mapping; and on riscv there are no unused bits in the PTE to
define a PG_PROMOTED flag.)
  
This commit implements an alternative solution that can be used on all
four architectures.  Moreover, this solution has two other advantages.
First, on older AMD processors that required the Erratum 383 workaround,
it is less costly.  Specifically, it avoids unnecessary calls to
pmap_fill_ptp() on a superpage demotion.  Second, it enables the
elimination of some calls to pagezero() in pmap_kernel_remove_{l2,pde}().
  
In addition, remove a related stale comment from pmap_enter_{l2,pde}().

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

Modified: stable/12/sys/amd64/amd64/pmap.c
==
--- stable/12/sys/amd64/amd64/pmap.cSun Sep 15 16:53:02 2019
(r352357)
+++ stable/12/sys/amd64/amd64/pmap.cSun Sep 15 17:22:29 2019
(r352358)
@@ -1142,7 +1142,7 @@ static intpmap_enter_pde(pmap_t pmap, vm_offset_t 
va,
 static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va,
 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 int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte, bool promoted);
 static void pmap_invalidate_cache_range_selfsnoop(vm_offset_t sva,
 vm_offset_t eva);
 static void pmap_invalidate_cache_range_all(vm_offset_t sva,
@@ -1846,8 +1846,13 @@ pmap_init(void)
mpte->pindex = pmap_pde_pindex(KERNBASE) + i;
mpte->phys_addr = KPTphys + (i << PAGE_SHIFT);
mpte->wire_count = 1;
+
+   /*
+* Collect the page table pages that were replaced by a 2MB
+* page in create_pagetables().  They are zero filled.
+*/
if (i << PDRSHIFT < KERNend &&
-   pmap_insert_pt_page(kernel_pmap, mpte))
+   pmap_insert_pt_page(kernel_pmap, mpte, false))
panic("pmap_init: pmap_insert_pt_page failed");
}
PMAP_UNLOCK(kernel_pmap);
@@ -3219,12 +3224,15 @@ pmap_add_delayed_free_list(vm_page_t m, struct spglist
  * of idle page table pages.  Each of a pmap's page table pages is responsible
  * for mapping a distinct range of virtual addresses.  The pmap's collection is
  * ordered by this virtual address range.
+ *
+ * If "promoted" is false, then the page table page "mpte" must be zero filled.
  */
 static __inline int
-pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte)
+pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte, bool promoted)
 {
 
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+   mpte->valid = promoted ? VM_PAGE_BITS_ALL : 0;
return (vm_radix_insert(>pm_root, mpte));
 }
 
@@ -4716,7 +4724,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, v
 * If the page table page is not leftover from an earlier promotion,
 * initialize it.
 */
-   if ((oldpde & PG_PROMOTED) == 0)
+   if (mpte->valid == 0)
pmap_fill_ptp(firstpte, newpte);
 
pmap_demote_pde_check(firstpte, newpte);
@@ -4789,9 +4797,11 @@ pmap_remove_kernel_pde(pmap_t pmap, pd_entry_t *pde, v
newpde = mptepa | X86_PG_M | X86_PG_A | X86_PG_RW | X86_PG_V;
 
/*
-* Initialize the page table page.
+* If this page table page was unmapped by a promotion, then it
+* contains valid mappings.  Zero it to invalidate those mappings.
 */
-   pagezero((void *)PHYS_TO_DMAP(mptepa));
+   if (mpte->valid != 0)
+   pagezero((void *)PHYS_TO_DMAP(mptepa));
 
/*
 * Demote the mapping.
@@ -4856,6 +4866,8 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offse
} else {
mpte = pmap_remove_pt_page(pmap, sva);
if (mpte != NULL) {
+   KASSERT(mpte->valid == VM_PAGE_BITS_ALL,
+   ("pmap_remove_pde: pte page not promoted"));

svn commit: r352357 - stable/12/sbin/ping

2019-09-15 Thread Alan Somers
Author: asomers
Date: Sun Sep 15 16:53:02 2019
New Revision: 352357
URL: https://svnweb.freebsd.org/changeset/base/352357

Log:
  MFC r350994, r350998, r351030, r351033, r351171, r351223, r351226, r351424
  
  r350994:
  ping: fix data type of a variable for a packet sequence number
  
  Submitted by: Ján Sučan 
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21244
  
  r350998:
  ping: use the monotonic clock to measure durations
  
  Submitted by: Ján Sučan 
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21245
  
  r351030:
  ping: fix triptime calculation after r350998
  
  That revision changed the internal clock to the monotonic, but neglected to
  change the datagram's timestamp source.
  
  Reported by:  Oliver Hartmann, Michael Butler
  Reviewed by:  Ján Sučan , allanjude
  MFC-With: r350998
  Differential Revision:https://reviews.freebsd.org/D21258
  
  r351033:
  ping: Make in_cksum() operate on u_char buffer
  
  This fixes -Wcast-align errors for in_cksum() calls when compiled with
  WARNS=6.
  
  Submitted by: Ján Sučan 
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21261
  
  r351171:
  ping: Move in_cksum() to a separate source file
  
  This is a preparation step for adding ATF tests of in_cksum(), which has been
  modified to operate on unaligned data. ping.o cannot be linked to the test
  executable because both of them contain 'main' symbol.
  
  Submitted by: Ján Sučan 
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21288
  
  r351223:
  ping: fix -Wformat-truncating warning with GCC
  
  Increase buffer size for the string representation of n_time
  
  ICMP timestamp is a 32-bit number. In pr_ntime(), number of minutes
  and seconds is always 2 characters wide. Max. number of hours is 4
  characters wide. The buffer size should be at least:
  
  4 + 2 + 2 + 1 (':') + 1 (':') + 1 ('\0') = 11
  
  Submitted by: Ján Sučan 
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21325
  
  r351226:
  Fix uninitialized variable warnings when MK_CASPER=no
  
  Submitted by: Ján Sučan 
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21322
  
  r351424:
  ping: fix include guard symbol name to reflect the header file name
  
  Submitted by: Ján Sučan 
  MFC-With: 351171
  Sponsored by: Google LLC (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21374

Added:
  stable/12/sbin/ping/utils.c
 - copied unchanged from r351171, head/sbin/ping/utils.c
  stable/12/sbin/ping/utils.h
 - copied, changed from r351171, head/sbin/ping/utils.h
Modified:
  stable/12/sbin/ping/Makefile
  stable/12/sbin/ping/ping.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ping/Makefile
==
--- stable/12/sbin/ping/MakefileSun Sep 15 14:37:50 2019
(r352356)
+++ stable/12/sbin/ping/MakefileSun Sep 15 16:53:02 2019
(r352357)
@@ -5,6 +5,7 @@
 
 PACKAGE=runtime
 PROG=  ping
+SRCS=  ping.c utils.c
 MAN=   ping.8
 BINOWN=root
 BINMODE=4555

Modified: stable/12/sbin/ping/ping.c
==
--- stable/12/sbin/ping/ping.c  Sun Sep 15 14:37:50 2019(r352356)
+++ stable/12/sbin/ping/ping.c  Sun Sep 15 16:53:02 2019(r352357)
@@ -95,8 +95,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
+#include "utils.h"
+
 #defineINADDR_LEN  ((int)sizeof(in_addr_t))
 #defineTIMEVAL_LEN ((int)sizeof(struct tv32))
 #defineMASK_LEN(ICMP_MASKLEN - ICMP_MINLEN)
@@ -118,7 +121,7 @@ __FBSDID("$FreeBSD$");
 
 struct tv32 {
int32_t tv32_sec;
-   int32_t tv32_usec;
+   int32_t tv32_nsec;
 };
 
 /* various options */
@@ -207,7 +210,6 @@ static volatile sig_atomic_t siginfo_p;
 static cap_channel_t *capdns;
 
 static void fill(char *, char *);
-static u_short in_cksum(u_short *, int);
 static cap_channel_t *capdns_setup(void);
 static void check_status(void);
 static void finish(void) __dead2;
@@ -216,11 +218,10 @@ static char *pr_addr(struct in_addr);
 static char *pr_ntime(n_time);
 static void pr_icmph(struct icmp *);
 static void pr_iph(struct ip *);
-static void pr_pack(char *, int, struct sockaddr_in *, struct timeval *);
+static void pr_pack(char *, int, struct sockaddr_in *, struct timespec *);
 static void pr_retip(struct ip *);
 static void status(int);
 static void stopit(int);
-static void tvsub(struct timeval *, const struct timeval *);
 static void 

svn commit: r352356 - stable/12/tests/sys/fs

2019-09-15 Thread Kyle Evans
Author: kevans
Date: Sun Sep 15 14:37:50 2019
New Revision: 352356
URL: https://svnweb.freebsd.org/changeset/base/352356

Log:
  MFC r351399: Fix the build with WITHOUT_GOOGLETEST
  
  Attempting to build the fusefs tests WITHOUT_GOOGLETEST will result in an
  error if the host system or sysroot doesn't already have googletest headers
  in /usr/include/private (e.g. host built/installed WITHOUT_GOOGLETEST, clean
  cross-buildworld WITHOUT_GOOGLETEST).

Modified:
  stable/12/tests/sys/fs/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tests/sys/fs/Makefile
==
--- stable/12/tests/sys/fs/Makefile Sun Sep 15 14:26:19 2019
(r352355)
+++ stable/12/tests/sys/fs/Makefile Sun Sep 15 14:37:50 2019
(r352356)
@@ -1,5 +1,6 @@
 # $FreeBSD$
 
+.include 
 .include 
 
 PACKAGE=   tests
@@ -9,7 +10,8 @@ TESTSDIR=  ${TESTSBASE}/sys/fs
 TESTSRC=   ${SRCTOP}/contrib/netbsd-tests/fs
 
 #TESTS_SUBDIRS+=   nullfs  # XXX: needs rump
-.if ${COMPILER_FEATURES:Mc++14}
+# fusefs tests cannot be compiled/used without the googletest infrastructure.
+.if ${COMPILER_FEATURES:Mc++14} && ${MK_GOOGLETEST} != "no"
 TESTS_SUBDIRS+=fusefs
 .endif
 TESTS_SUBDIRS+=tmpfs
___
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: r352355 - in stable/12/sys: dev/netmap net

2019-09-15 Thread Vincenzo Maffione
Author: vmaffione
Date: Sun Sep 15 14:26:19 2019
New Revision: 352355
URL: https://svnweb.freebsd.org/changeset/base/352355

Log:
  MFC r351657
  
  netmap: import changes from upstream (SHA 137f537eae513)
  
   - Rework option processing.
   - Use larger integers for memory size values in the
 memory management code.

Modified:
  stable/12/sys/dev/netmap/netmap.c
  stable/12/sys/dev/netmap/netmap_kern.h
  stable/12/sys/dev/netmap/netmap_kloop.c
  stable/12/sys/dev/netmap/netmap_mem2.c
  stable/12/sys/net/netmap.h
  stable/12/sys/net/netmap_user.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/netmap/netmap.c
==
--- stable/12/sys/dev/netmap/netmap.c   Sun Sep 15 10:54:33 2019
(r352354)
+++ stable/12/sys/dev/netmap/netmap.c   Sun Sep 15 14:26:19 2019
(r352355)
@@ -1037,8 +1037,13 @@ netmap_do_unregif(struct netmap_priv_d *priv)
na->nm_krings_delete(na);
 
/* restore the default number of host tx and rx rings */
-   na->num_host_tx_rings = 1;
-   na->num_host_rx_rings = 1;
+   if (na->na_flags & NAF_HOST_RINGS) {
+   na->num_host_tx_rings = 1;
+   na->num_host_rx_rings = 1;
+   } else {
+   na->num_host_tx_rings = 0;
+   na->num_host_rx_rings = 0;
+   }
}
 
/* possibily decrement counter of tx_si/rx_si users */
@@ -2505,17 +2510,11 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c
}
 
 #ifdef WITH_EXTMEM
-   opt = nmreq_findoption((struct nmreq_option 
*)(uintptr_t)hdr->nr_options,
-   NETMAP_REQ_OPT_EXTMEM);
+   opt = nmreq_getoption(hdr, 
NETMAP_REQ_OPT_EXTMEM);
if (opt != NULL) {
struct nmreq_opt_extmem *e =
(struct nmreq_opt_extmem *)opt;
 
-   error = nmreq_checkduplicate(opt);
-   if (error) {
-   opt->nro_status = error;
-   break;
-   }
nmd = 
netmap_mem_ext_create(e->nro_usrptr,
>nro_info, );
opt->nro_status = error;
@@ -2559,15 +2558,11 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c
break;
}
 
-   opt = nmreq_findoption((struct nmreq_option 
*)(uintptr_t)hdr->nr_options,
-   NETMAP_REQ_OPT_CSB);
+   opt = nmreq_getoption(hdr, NETMAP_REQ_OPT_CSB);
if (opt != NULL) {
struct nmreq_opt_csb *csbo =
(struct nmreq_opt_csb *)opt;
-   error = nmreq_checkduplicate(opt);
-   if (!error) {
-   error = 
netmap_csb_validate(priv, csbo);
-   }
+   error = netmap_csb_validate(priv, csbo);
opt->nro_status = error;
if (error) {
netmap_do_unregif(priv);
@@ -2841,19 +2836,15 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c
case NETMAP_REQ_CSB_ENABLE: {
struct nmreq_option *opt;
 
-   opt = nmreq_findoption((struct nmreq_option 
*)(uintptr_t)hdr->nr_options,
-   NETMAP_REQ_OPT_CSB);
+   opt = nmreq_getoption(hdr, NETMAP_REQ_OPT_CSB);
if (opt == NULL) {
error = EINVAL;
} else {
struct nmreq_opt_csb *csbo =
(struct nmreq_opt_csb *)opt;
-   error = nmreq_checkduplicate(opt);
-   if (!error) {
-   NMG_LOCK();
-   error = netmap_csb_validate(priv, csbo);
-   NMG_UNLOCK();
-   }
+   NMG_LOCK();
+   error = netmap_csb_validate(priv, csbo);
+   NMG_UNLOCK();
  

svn commit: r352353 - stable/12/contrib/tzdata

2019-09-15 Thread Philip Paeps
Author: philip
Date: Sun Sep 15 10:54:18 2019
New Revision: 352353
URL: https://svnweb.freebsd.org/changeset/base/352353

Log:
  MFC r352238: Import tzdata 2019c

Modified:
  stable/12/contrib/tzdata/NEWS
  stable/12/contrib/tzdata/asia
  stable/12/contrib/tzdata/australasia
  stable/12/contrib/tzdata/backzone
  stable/12/contrib/tzdata/europe
  stable/12/contrib/tzdata/leap-seconds.list
  stable/12/contrib/tzdata/leapseconds
  stable/12/contrib/tzdata/leapseconds.awk
  stable/12/contrib/tzdata/northamerica
  stable/12/contrib/tzdata/southamerica
  stable/12/contrib/tzdata/theory.html
  stable/12/contrib/tzdata/version
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/tzdata/NEWS
==
--- stable/12/contrib/tzdata/NEWS   Sun Sep 15 08:16:28 2019
(r352352)
+++ stable/12/contrib/tzdata/NEWS   Sun Sep 15 10:54:18 2019
(r352353)
@@ -1,5 +1,80 @@
 News for the tz database
 
+Release 2019c - 2019-09-11 08:59:48 -0700
+
+  Briefly:
+Fiji observes DST from 2019-11-10 to 2020-01-12.
+Norfolk Island starts observing Australian-style DST.
+
+  Changes to future timestamps
+
+Fiji's next DST transitions will be 2019-11-10 and 2020-01-12
+instead of 2019-11-03 and 2020-01-19.  (Thanks to Raymond Kumar.)
+Adjust future guesses accordingly.
+
+Norfolk Island will observe Australian-style DST starting in
+spring 2019.  The first transition is on 2019-10-06.  (Thanks to
+Kyle Czech and Michael Deckers.)
+
+  Changes to past timestamps
+
+Many corrections to time in Turkey from 1940 through 1985.
+(Thanks to Oya Vulaş via Alois Treindl, and to Kıvanç Yazan.)
+
+The Norfolk Island 1975-03-02 transition was at 02:00 standard
+time, not 02:00 DST.  (Thanks to Michael Deckers.)
+
+South Korea observed DST from 1948 through 1951.  Although this
+info was supposed to appear in release 2014j, a typo inadvertently
+suppressed the change.  (Thanks to Alois Treindl.)
+
+Detroit observed DST in 1967 and 1968 following the US DST rules,
+except that its 1967 DST began on June 14 at 00:01.  (Thanks to
+Alois Treindl for pointing out that the old data entries were
+probably wrong.)
+
+Fix several errors in pre-1970 transitions in Perry County, IN.
+(Thanks to Alois Triendl for pointing out the 1967/9 errors.)
+
+Edmonton did not observe DST in 1967 or 1969.  In 1946 Vancouver
+ended DST on 09-29 not 10-13, and Vienna ended DST on 10-07 not
+10-06.  In 1945 Königsberg (now Kaliningrad) switched from +01/+02
+to +02/+03 on 04-10 not 01-01, and its +02/+03 is abbreviated
+EET/EEST, not CET/CEST.  (Thanks to Alois Triendl.)  In 1946
+Königsberg switched to +03 on 04-07 not 01-01.
+
+In 1946 Louisville switched from CST to CDT on 04-28 at 00:01, not
+01-01 at 00:00.  (Thanks to Alois Treindl and Michael Deckers.)
+Also, it switched from CST to CDT on 1950-04-30, not 1947-04-27.
+
+The 1892-05-01 transition in Brussels was at 00:17:30, not at noon.
+(Thanks to Michael Deckers.)
+
+  Changes to past time zone abbreviations and DST flags
+
+Hong Kong Winter Time, observed from 1941-10-01 to 1941-12-25,
+is now flagged as DST and is abbreviated HKWT not HKT.
+
+  Changes to code
+
+leapseconds.awk now relies only on its input data, rather than
+also relying on its comments.  (Inspired by code from Dennis
+Ferguson and Chris Woodbury.)
+
+The code now defends against CRLFs in leap-seconds.list.
+(Thanks to Brian Inglis and Chris Woodbury.)
+
+  Changes to documentation and commentary
+
+theory.html discusses leap seconds.  (Thanks to Steve Summit.)
+
+Nashville's newspapers dueled about the time of day in the 1950s.
+(Thanks to John Seigenthaler.)
+
+Liechtenstein observed Swiss DST in 1941/2.
+(Thanks to Alois Treindl.)
+
+
 Release 2019b - 2019-07-01 00:09:53 -0700
 
   Briefly:

Modified: stable/12/contrib/tzdata/asia
==
--- stable/12/contrib/tzdata/asia   Sun Sep 15 08:16:28 2019
(r352352)
+++ stable/12/contrib/tzdata/asia   Sun Sep 15 10:54:18 2019
(r352353)
@@ -8,7 +8,7 @@
 # t...@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2018-06-19):
+# From Paul Eggert (2019-07-11):
 #
 # Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
@@ -47,13 +47,13 @@
 #  7:00 WIBwest Indonesia (Waktu Indonesia Barat)
 #  8:00 WITA   central Indonesia (Waktu Indonesia Tengah)
 #  8:00 CSTChina
-#  8:00 PST  PDT*  Philippine Standard Time
+#  8:00 HKT  HKST  Hong Kong (HKWT* for Winter Time in late 1941)
+#  8:00 PST  PDT*  Philippines
 # 

svn commit: r352354 - stable/11/contrib/tzdata

2019-09-15 Thread Philip Paeps
Author: philip
Date: Sun Sep 15 10:54:33 2019
New Revision: 352354
URL: https://svnweb.freebsd.org/changeset/base/352354

Log:
  MFC r352238: Import tzdata 2019c

Modified:
  stable/11/contrib/tzdata/NEWS
  stable/11/contrib/tzdata/asia
  stable/11/contrib/tzdata/australasia
  stable/11/contrib/tzdata/backzone
  stable/11/contrib/tzdata/europe
  stable/11/contrib/tzdata/leap-seconds.list
  stable/11/contrib/tzdata/leapseconds
  stable/11/contrib/tzdata/leapseconds.awk
  stable/11/contrib/tzdata/northamerica
  stable/11/contrib/tzdata/southamerica
  stable/11/contrib/tzdata/theory.html
  stable/11/contrib/tzdata/version
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/tzdata/NEWS
==
--- stable/11/contrib/tzdata/NEWS   Sun Sep 15 10:54:18 2019
(r352353)
+++ stable/11/contrib/tzdata/NEWS   Sun Sep 15 10:54:33 2019
(r352354)
@@ -1,5 +1,80 @@
 News for the tz database
 
+Release 2019c - 2019-09-11 08:59:48 -0700
+
+  Briefly:
+Fiji observes DST from 2019-11-10 to 2020-01-12.
+Norfolk Island starts observing Australian-style DST.
+
+  Changes to future timestamps
+
+Fiji's next DST transitions will be 2019-11-10 and 2020-01-12
+instead of 2019-11-03 and 2020-01-19.  (Thanks to Raymond Kumar.)
+Adjust future guesses accordingly.
+
+Norfolk Island will observe Australian-style DST starting in
+spring 2019.  The first transition is on 2019-10-06.  (Thanks to
+Kyle Czech and Michael Deckers.)
+
+  Changes to past timestamps
+
+Many corrections to time in Turkey from 1940 through 1985.
+(Thanks to Oya Vulaş via Alois Treindl, and to Kıvanç Yazan.)
+
+The Norfolk Island 1975-03-02 transition was at 02:00 standard
+time, not 02:00 DST.  (Thanks to Michael Deckers.)
+
+South Korea observed DST from 1948 through 1951.  Although this
+info was supposed to appear in release 2014j, a typo inadvertently
+suppressed the change.  (Thanks to Alois Treindl.)
+
+Detroit observed DST in 1967 and 1968 following the US DST rules,
+except that its 1967 DST began on June 14 at 00:01.  (Thanks to
+Alois Treindl for pointing out that the old data entries were
+probably wrong.)
+
+Fix several errors in pre-1970 transitions in Perry County, IN.
+(Thanks to Alois Triendl for pointing out the 1967/9 errors.)
+
+Edmonton did not observe DST in 1967 or 1969.  In 1946 Vancouver
+ended DST on 09-29 not 10-13, and Vienna ended DST on 10-07 not
+10-06.  In 1945 Königsberg (now Kaliningrad) switched from +01/+02
+to +02/+03 on 04-10 not 01-01, and its +02/+03 is abbreviated
+EET/EEST, not CET/CEST.  (Thanks to Alois Triendl.)  In 1946
+Königsberg switched to +03 on 04-07 not 01-01.
+
+In 1946 Louisville switched from CST to CDT on 04-28 at 00:01, not
+01-01 at 00:00.  (Thanks to Alois Treindl and Michael Deckers.)
+Also, it switched from CST to CDT on 1950-04-30, not 1947-04-27.
+
+The 1892-05-01 transition in Brussels was at 00:17:30, not at noon.
+(Thanks to Michael Deckers.)
+
+  Changes to past time zone abbreviations and DST flags
+
+Hong Kong Winter Time, observed from 1941-10-01 to 1941-12-25,
+is now flagged as DST and is abbreviated HKWT not HKT.
+
+  Changes to code
+
+leapseconds.awk now relies only on its input data, rather than
+also relying on its comments.  (Inspired by code from Dennis
+Ferguson and Chris Woodbury.)
+
+The code now defends against CRLFs in leap-seconds.list.
+(Thanks to Brian Inglis and Chris Woodbury.)
+
+  Changes to documentation and commentary
+
+theory.html discusses leap seconds.  (Thanks to Steve Summit.)
+
+Nashville's newspapers dueled about the time of day in the 1950s.
+(Thanks to John Seigenthaler.)
+
+Liechtenstein observed Swiss DST in 1941/2.
+(Thanks to Alois Treindl.)
+
+
 Release 2019b - 2019-07-01 00:09:53 -0700
 
   Briefly:

Modified: stable/11/contrib/tzdata/asia
==
--- stable/11/contrib/tzdata/asia   Sun Sep 15 10:54:18 2019
(r352353)
+++ stable/11/contrib/tzdata/asia   Sun Sep 15 10:54:33 2019
(r352354)
@@ -8,7 +8,7 @@
 # t...@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2018-06-19):
+# From Paul Eggert (2019-07-11):
 #
 # Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
@@ -47,13 +47,13 @@
 #  7:00 WIBwest Indonesia (Waktu Indonesia Barat)
 #  8:00 WITA   central Indonesia (Waktu Indonesia Tengah)
 #  8:00 CSTChina
-#  8:00 PST  PDT*  Philippine Standard Time
+#  8:00 HKT  HKST  Hong Kong (HKWT* for Winter Time in late 1941)
+#  8:00 PST  PDT*  Philippines
 # 

svn commit: r352352 - stable/12/sys/netinet

2019-09-15 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Sep 15 08:16:28 2019
New Revision: 352352
URL: https://svnweb.freebsd.org/changeset/base/352352

Log:
  MFC 346554,346556,346595,348060,348061,348494 udp locking fixes
  
Fix multiple possible locking problems found by syzkaller and
update comment (which was wrong already anyway due to previous
changes).
Improve KASSERTs for debugging lock related issues.
Fold two RSS sections together.

Modified:
  stable/12/sys/netinet/udp_usrreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/udp_usrreq.c
==
--- stable/12/sys/netinet/udp_usrreq.c  Sun Sep 15 04:14:31 2019
(r352351)
+++ stable/12/sys/netinet/udp_usrreq.c  Sun Sep 15 08:16:28 2019
(r352352)
@@ -1156,9 +1156,23 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s
 
src.sin_family = 0;
sin = (struct sockaddr_in *)addr;
+retry:
if (sin == NULL ||
(inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) {
INP_WLOCK(inp);
+   /*
+* In case we lost a race and another thread bound addr/port
+* on the inp we cannot keep the wlock (which still would be
+* fine) as further down, based on these values we make
+* decisions for the pcbinfo lock.  If the locks are not in
+* synch the assertions on unlock will fire, hence we go for
+* one retry loop.
+*/
+   if (sin != NULL && (inp->inp_laddr.s_addr != INADDR_ANY ||
+   inp->inp_lport != 0)) {
+   INP_WUNLOCK(inp);
+   goto retry;
+   }
unlock_inp = UH_WLOCKED;
} else {
INP_RLOCK(inp);
@@ -1258,36 +1272,44 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s
}
 
/*
-* Depending on whether or not the application has bound or connected
-* the socket, we may have to do varying levels of work.  The optimal
-* case is for a connected UDP socket, as a global lock isn't
-* required at all.
-*
-* In order to decide which we need, we require stability of the
-* inpcb binding, which we ensure by acquiring a read lock on the
-* inpcb.  This doesn't strictly follow the lock order, so we play
-* the trylock and retry game; note that we may end up with more
-* conservative locks than required the second time around, so later
-* assertions have to accept that.  Further analysis of the number of
-* misses under contention is required.
-*
-* XXXRW: Check that hash locking update here is correct.
+* In the old days, depending on whether or not the application had
+* bound or connected the socket, we had to do varying levels of work.
+* The optimal case was for a connected UDP socket, as a global lock
+* wasn't required at all.
+* In order to decide which we need, we required stability of the
+* inpcb binding, which we ensured by acquiring a read lock on the
+* inpcb.  This didn't strictly follow the lock order, so we played
+* the trylock and retry game.
+* With the re-introduction of the route-cache in some cases, we started
+* to acquire an early inp wlock and a possible race during re-lock
+* went away.  With the introduction of epoch(9) some read locking
+* became epoch(9) and the lock-order issues also went away.
+* Due to route-cache we may now hold more conservative locks than
+* otherwise required and have split up the 2nd case in case 2 and 3
+* in order to keep the udpinfo lock level in sync with the inp one
+* for the IP_SENDSRCADDR case below.
 */
pr = inp->inp_socket->so_proto->pr_protocol;
pcbinfo = udp_get_inpcbinfo(pr);
-   sin = (struct sockaddr_in *)addr;
if (sin != NULL &&
(inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) {
INP_HASH_WLOCK(pcbinfo);
unlock_udbinfo = UH_WLOCKED;
-   } else if ((sin != NULL && (
-   (sin->sin_addr.s_addr == INADDR_ANY) ||
-   (sin->sin_addr.s_addr == INADDR_BROADCAST) ||
-   (inp->inp_laddr.s_addr == INADDR_ANY) ||
-   (inp->inp_lport == 0))) ||
-   (src.sin_family == AF_INET)) {
+   } else if (sin != NULL &&
+   (sin->sin_addr.s_addr == INADDR_ANY ||
+   sin->sin_addr.s_addr == INADDR_BROADCAST ||
+   inp->inp_laddr.s_addr == INADDR_ANY ||
+   inp->inp_lport == 0)) {
INP_HASH_RLOCK_ET(pcbinfo, et);
unlock_udbinfo = UH_RLOCKED;
+   } else if (src.sin_family == AF_INET) {
+   if (unlock_inp == UH_WLOCKED) {
+