Re: svn commit: r305084 - head/tools/regression/capsicum/syscalls

2016-09-03 Thread Ngie Cooper

> On Aug 31, 2016, at 00:06, Mariusz Zaborski  wrote:
> 
>> On Tue, Aug 30, 2016 at 06:04:50PM -0700, Ngie Cooper wrote:
>>> On Tue, Aug 30, 2016 at 12:58 PM, Mariusz Zaborski  
>>> wrote:
>>> Author: oshogbo
>>> Date: Tue Aug 30 19:58:41 2016
>>> New Revision: 305084
>>> URL: https://svnweb.freebsd.org/changeset/base/305084
>>> 
>>> Log:
>>>  Fix Capsicum syscalls test suite.
>> 
>> Do you plan on MFCing the change?
> emaste@ suggested to change it to the kyua tests, what would you think about
> MFCing after that?

Sure. Let's work out the kinks with the tests, then we can push that back to 
^/stable/11.

Thanks!
-Ngie
___
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: r305362 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/conf sys/i386/i386 sys/i386/include sys/mips/mips sys/powerpc/aim sys/powerpc/booke sys/powerpc/powerp

2016-09-03 Thread Bruce Evans

On Sat, 3 Sep 2016, Mark Johnston wrote:


Log:
 Remove support for idle page zeroing.

 Idle page zeroing has been disabled by default on all architectures since
 r170816 and has some bugs that make it seemingly unusable. Specifically,
 the idle-priority pagezero thread exacerbates contention for the free page
 lock, and yields the CPU without releasing it in non-preemptive kernels. The
 pagezero thread also does not behave correctly when superpage reservations
 are enabled: its target is a function of v_free_count, which includes
 reserved-but-free pages, but it is only able to zero pages belonging to the
 physical memory allocator.

 Reviewed by:   alc, imp, kib


It worked well in 2007.  I tried to fix it, and asked alc to fix it,
in 2008, but didn't get anywhere.

Now another problem is obvious.  Memories and CPUs are a bit faster,
but context switches are still very slow.  My newest system can "rep
stosb" at 16-128GB/sec or 1/32-1/4usec per page, but it takes 1 usec
for a (user) context switch.  So to amortize the cost of a context
switch, idlezero needs to zero many pages per switch, perhaps hundreds,
and to ensure this it must run at high (numerically low) priority and
schedule itself to not become too active, but it does exactly the
opposite (idle priority, and then if PREEMPTION is configured,
scheduled generally with the opposite policy).  But if it schedules
itself to do many pages at a time, this gives bad latency.

Zeroing in idle last worked correctly in FreeBSD-4 with UP.  Then
there were no kernel context switches and vm_page_zero_idle() was 
just a function call away from the idle loop.  However, the version

with context switching was better than nothing with slow memory in
2007.

This is not fixed in the following patch for a ~2008 version:

X Index: vm_phys.c
X ===
X --- vm_phys.c (revision 181737)
X +++ vm_phys.c (working copy)
X @@ -41,6 +41,8 @@
X  #include 
X  #include 
X +#include 
X  #include 
X  #include 
X +#include 
X  #include 
X  #include 
X @@ -552,7 +554,18 @@
X   cnt.v_free_count--;
X   mtx_unlock(_page_queue_free_mtx);
X +#ifndef PREEMPTION_AND_PREEMPTION_WORKS
X + if (sched_runnable()) {
X + thread_lock(curthread);
X + critical_exit();
X + mi_switch(SW_VOL | SWT_IDLE,
X + NULL);
X + thread_unlock(curthread);
X + } else
X +#endif
X + critical_exit();
X   pmap_zero_page_idle(m_tmp);
X   m_tmp->flags |= PG_ZERO;
X   mtx_lock(_page_queue_free_mtx);
X + critical_enter();
X   cnt.v_free_count++;
X   vm_phys_free_pages(m_tmp, 0);
X Index: vm_zeroidle.c
X ===
X --- vm_zeroidle.c (revision 181737)
X +++ vm_zeroidle.c (working copy)
X @@ -122,18 +122,14 @@
X 
X  	mtx_lock(_page_queue_free_mtx);

X + critical_enter();
X   for (;;) {
X   if (vm_page_zero_check()) {
X   vm_page_zero_idle();
X -#ifndef PREEMPTION
X - if (sched_runnable()) {
X - thread_lock(curthread);
X - mi_switch(SW_VOL | SWT_IDLE, NULL);
X - thread_unlock(curthread);
X - }
X -#endif
X   } else {
X   wakeup_needed = TRUE;
X + critical_exit();
X   msleep(_state, _page_queue_free_mtx, 0,
X   "pgzero", hz * 300);
X + critical_enter();
X   }
X   }

PREEMPTION had to be turned off for best results.  This is only practical
for SMP systems.  It was more broken (gave too many context switches) in
2007 than now.  I still turn it off for SMP.  Perhaps the extra context
switches had a lot to do with this idlezero problem.  Any time the system
goes idle for a short time, idlezero runs for a short time.  Then it
gets preempted, but still holds the lock, so there may be another context
switch back to it.  This might be repeated several times per page.

The version in FreeBSD-5.2 is threaded and uses preemption if available,
but has vestiges of the FreeBSD-4 scheduling.  It sleeps voluntarily
after zeroing maxrun pages.  But maxrun defaults to 16.  A system too
new to run FreeBSD-4 is just warming up after doing 16 pages.

So my only idea for making this work is:
- do it from the idle 

svn commit: r305375 - head/sys/dev/bhnd/bhndb

2016-09-03 Thread Landon J. Fuller
Author: landonf
Date: Sun Sep  4 01:47:21 2016
New Revision: 305375
URL: https://svnweb.freebsd.org/changeset/base/305375

Log:
  bhndb(4): Fix probing of bhndb-attached bhnd_nvram devices.
  
  This fixes bhnd(4) nvram handling on devices that map SPROM CSRs via PCI
  configuration space.
  
  The probe method previously required that a bhnd(4) device be attached to the
  parent bridge; now that the bhnd_nvram device is always attached first, this
  unnecessary sanity check always failed.
  
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c

Modified: head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c
==
--- head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c   Sun Sep  4 01:43:54 2016
(r305374)
+++ head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c   Sun Sep  4 01:47:21 2016
(r305375)
@@ -60,17 +60,13 @@ __FBSDID("$FreeBSD$");
 static int
 bhndb_pci_sprom_probe(device_t dev)
 {
-   device_tbridge, bus;
+   device_tbridge;
int error;
 
-   /* Our parent must be a PCI-BHND bridge with an attached bhnd bus */
+   /* Our parent must be a PCI-BHND bridge */
bridge = device_get_parent(dev);
if (device_get_driver(bridge) != _pci_driver)
return (ENXIO);
-   
-   bus = device_find_child(bridge, devclass_get_name(bhnd_devclass), 0);
-   if (bus == NULL)
-   return (ENXIO);
 
/* Defer to default driver implementation */
if ((error = bhnd_sprom_probe(dev)) > 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: r305374 - head/sys/dev/bhnd/bhndb

2016-09-03 Thread Landon J. Fuller
Author: landonf
Date: Sun Sep  4 01:43:54 2016
New Revision: 305374
URL: https://svnweb.freebsd.org/changeset/base/305374

Log:
  bhndb(4): Skip disabled cores when performing bridge configuration probing.
  
  On BCM4321 chipsets, both PCI and PCIe cores are included, with one of
  the cores potentially left floating.
  
  Since the PCI core appears first in the device table, and the PCI
  profiles appear first in the resource configuration tables, this resulted in
  incorrectly matching and using the PCI/v1 resource configuration on PCIe
  devices, rather than the correct PCIe/v1 profile.
  
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/bhndb/bhnd_bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb_if.m

Modified: head/sys/dev/bhnd/bhndb/bhnd_bhndb.c
==
--- head/sys/dev/bhnd/bhndb/bhnd_bhndb.cSun Sep  4 01:25:46 2016
(r305373)
+++ head/sys/dev/bhnd/bhndb/bhnd_bhndb.cSun Sep  4 01:43:54 2016
(r305374)
@@ -66,6 +66,17 @@ bhnd_bhndb_get_attach_type(device_t dev,
return (BHND_ATTACH_ADAPTER);
 }
 
+
+static bool
+bhnd_bhndb_is_hw_disabled(device_t dev, device_t child)
+{
+   struct bhnd_core_info core = bhnd_get_core_info(child);
+
+   /* Delegate to parent bridge */
+   return (BHNDB_IS_CORE_DISABLED(device_get_parent(dev), dev, ));
+}
+
+
 static device_t
 bhnd_bhndb_find_hostb_device(device_t dev)
 {
@@ -112,6 +123,7 @@ bhnd_bhndb_pwrctl_ungate_clock(device_t 
 static device_method_t bhnd_bhndb_methods[] = {
/* BHND interface */
DEVMETHOD(bhnd_bus_get_attach_type, bhnd_bhndb_get_attach_type),
+   DEVMETHOD(bhnd_bus_is_hw_disabled,  bhnd_bhndb_is_hw_disabled),
DEVMETHOD(bhnd_bus_find_hostb_device,   bhnd_bhndb_find_hostb_device),
DEVMETHOD(bhnd_bus_read_board_info, bhnd_bhndb_read_board_info),
 

Modified: head/sys/dev/bhnd/bhndb/bhndb.c
==
--- head/sys/dev/bhnd/bhndb/bhndb.c Sun Sep  4 01:25:46 2016
(r305373)
+++ head/sys/dev/bhnd/bhndb/bhndb.c Sun Sep  4 01:43:54 2016
(r305374)
@@ -85,8 +85,9 @@ static int bhndb_init_full_config(str
 
 static struct bhnd_core_info   *bhndb_get_bridge_core(struct bhndb_softc *sc);
 
-static bool bhndb_hw_matches(struct bhnd_core_info *cores,
-u_int ncores, const struct bhndb_hw *hw);
+static bool bhndb_hw_matches(struct bhndb_softc *sc,
+struct bhnd_core_info *cores, u_int ncores,
+const struct bhndb_hw *hw);
 
 static int  bhndb_init_region_cfg(struct bhndb_softc *sc,
 bhnd_erom_t *erom,
@@ -212,14 +213,15 @@ bhndb_get_bridge_core(struct bhndb_softc
 
 /**
  * Return true if @p cores matches the @p hw specification.
- * 
+ *
+ * @param sc BHNDB device state.
  * @param cores A device table to match against.
  * @param ncores The number of cores in @p cores.
  * @param hw The hardware description to be matched against.
  */
 static bool
-bhndb_hw_matches(struct bhnd_core_info *cores, u_int ncores,
-const struct bhndb_hw *hw)
+bhndb_hw_matches(struct bhndb_softc *sc, struct bhnd_core_info *cores,
+u_int ncores, const struct bhndb_hw *hw)
 {
for (u_int i = 0; i < hw->num_hw_reqs; i++) {
const struct bhnd_core_match*match;
@@ -229,7 +231,12 @@ bhndb_hw_matches(struct bhnd_core_info *
found = false;
 
for (u_int d = 0; d < ncores; d++) {
-   if (!bhnd_core_matches([d], match))
+   struct bhnd_core_info *core = [d];
+   
+   if (BHNDB_IS_CORE_DISABLED(sc->dev, sc->bus_dev, core))
+   continue;
+
+   if (!bhnd_core_matches(core, match))
continue;
 
found = true;
@@ -353,7 +360,7 @@ bhndb_init_region_cfg(struct bhndb_softc
 */

/* ... do not require bridge resources */
-   if (BHNDB_BUS_IS_CORE_DISABLED(sc->parent_dev, sc->dev, core))
+   if (BHNDB_IS_CORE_DISABLED(sc->dev, sc->bus_dev, core))
continue;
 
/* ... do not have a priority table entry */
@@ -475,7 +482,7 @@ bhndb_find_hwspec(struct bhndb_softc *sc
/* Search for the first matching hardware config. */
hw_table = BHNDB_BUS_GET_HARDWARE_TABLE(sc->parent_dev, sc->dev);
for (next = hw_table; next->hw_reqs != NULL; next++) {
-   if (!bhndb_hw_matches(cores, ncores, next))
+   if (!bhndb_hw_matches(sc, cores, ncores, next))
continue;
 
/* 

svn commit: r305373 - head/sys/dev/bhnd/siba

2016-09-03 Thread Landon J. Fuller
Author: landonf
Date: Sun Sep  4 01:25:46 2016
New Revision: 305373
URL: https://svnweb.freebsd.org/changeset/base/305373

Log:
  siba(4): Add missing bhnd_device/bhnd_device_quirk table terminator entries.
  
  This resulted in an over-read on siba chipsets that failed to match the
  existing entries.
  
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/siba/siba_bhndb.c

Modified: head/sys/dev/bhnd/siba/siba_bhndb.c
==
--- head/sys/dev/bhnd/siba/siba_bhndb.c Sun Sep  4 01:17:16 2016
(r305372)
+++ head/sys/dev/bhnd/siba/siba_bhndb.c Sun Sep  4 01:25:46 2016
(r305373)
@@ -71,10 +71,12 @@ enum {
 static struct bhnd_device_quirk bridge_quirks[] = {
BHND_CHIP_QUIRK(4311, HWREV_EQ(2), SIBA_QUIRK_PCIE_D11_SB_TIMEOUT),
BHND_CHIP_QUIRK(4312, HWREV_EQ(0), SIBA_QUIRK_PCIE_D11_SB_TIMEOUT),
+   BHND_DEVICE_QUIRK_END
 };
 
 static struct bhnd_device bridge_devs[] = {
BHND_DEVICE(BCM, PCI, NULL, bridge_quirks),
+   BHND_DEVICE_END
 };
 
 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: r305372 - in head/sys: dev/bhnd/pmu dev/bhnd/soc mips/sentry5 modules/bhnd/nvram

2016-09-03 Thread Landon J. Fuller
Author: landonf
Date: Sun Sep  4 01:17:16 2016
New Revision: 305372
URL: https://svnweb.freebsd.org/changeset/base/305372

Log:
  Remove empty directories left by r299241, r302190, r304870, and r301410
  
  Approved by:  adrian (mentor, implicit)

Deleted:
  head/sys/dev/bhnd/pmu/
  head/sys/dev/bhnd/soc/
  head/sys/mips/sentry5/
  head/sys/modules/bhnd/nvram/
___
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: r305371 - in head/sys: dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/siba dev/bwn mips/broadcom modules/bhnd/bhndb

2016-09-03 Thread Landon J. Fuller
Author: landonf
Date: Sun Sep  4 00:58:19 2016
New Revision: 305371
URL: https://svnweb.freebsd.org/changeset/base/305371

Log:
  Migrate bhndb(4) to the new bhnd_erom API.
  
  Adds support for probing and initializing bhndb(4) bridge state using
  the bhnd_erom API, ensuring that full bridge configuration is available
  *prior* to actually attaching and enumerating the bhnd(4) child device,
  allowing us to safely allocate bus-level agent/device resources during
  bhnd(4) bus enumeration.
  
  - Add a bhnd_erom_probe() method usable by bhndb(4). This is an analogue
to the existing bhnd_erom_probe_static() method, and allows the bhndb
bridge to discover the best available erom parser class prior to newbus
probing of its children.
  - Add support for supplying identification hints when probing erom
devices. This is required on early EXTIF-only chipsets, where chip
identification registers are not available.
  - Migrate bhndb over to the new bhnd_erom API, using bhnd_core_info
records rather than bridged bhnd(4) device_t references to determine
the bridged chipsets' capability/bridge configuration.
  - The bhndb parent (e.g. if_bwn) is now required to supply a hardware
priority table to the bridge. The default table is currently sufficient
for our supported devices.
  - Drop the two-pass attach approach we used for compatibility with bhndb(4) in
the bhnd(4) bus drivers, and instead perform bus enumeration immediately,
and allocate bridged per-child bus-level resources during that enumeration.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7768

Modified:
  head/sys/dev/bhnd/bcma/bcma.c
  head/sys/dev/bhnd/bcma/bcma_bhndb.c
  head/sys/dev/bhnd/bcma/bcma_erom.c
  head/sys/dev/bhnd/bcma/bcma_eromvar.h
  head/sys/dev/bhnd/bcma/bcma_nexus.c
  head/sys/dev/bhnd/bcma/bcma_subr.c
  head/sys/dev/bhnd/bcma/bcmavar.h
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/bhnd_erom.c
  head/sys/dev/bhnd/bhnd_erom.h
  head/sys/dev/bhnd/bhnd_erom_if.m
  head/sys/dev/bhnd/bhnd_match.h
  head/sys/dev/bhnd/bhnd_nexus.c
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/bhndb/bhnd_bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb_bus_if.m
  head/sys/dev/bhnd/bhndb/bhndb_if.m
  head/sys/dev/bhnd/bhndb/bhndb_pci.c
  head/sys/dev/bhnd/bhndb/bhndb_private.h
  head/sys/dev/bhnd/bhndb/bhndb_subr.c
  head/sys/dev/bhnd/bhndb/bhndbvar.h
  head/sys/dev/bhnd/cores/chipc/chipcreg.h
  head/sys/dev/bhnd/siba/siba.c
  head/sys/dev/bhnd/siba/siba_bhndb.c
  head/sys/dev/bhnd/siba/siba_erom.c
  head/sys/dev/bhnd/siba/siba_nexus.c
  head/sys/dev/bhnd/siba/sibavar.h
  head/sys/dev/bwn/if_bwn_pci.c
  head/sys/dev/bwn/if_bwn_pcivar.h
  head/sys/mips/broadcom/bcm_machdep.c
  head/sys/modules/bhnd/bhndb/Makefile

Modified: head/sys/dev/bhnd/bcma/bcma.c
==
--- head/sys/dev/bhnd/bcma/bcma.c   Sun Sep  4 00:35:55 2016
(r305370)
+++ head/sys/dev/bhnd/bcma/bcma.c   Sun Sep  4 00:58:19 2016
(r305371)
@@ -48,6 +48,12 @@ __FBSDID("$FreeBSD$");
 /* RID used when allocating EROM table */
 #defineBCMA_EROM_RID   0
 
+static bhnd_erom_class_t *
+bcma_get_erom_class(driver_t *driver)
+{
+   return (_erom_parser);
+}
+
 int
 bcma_probe(device_t dev)
 {
@@ -55,70 +61,25 @@ bcma_probe(device_t dev)
return (BUS_PROBE_DEFAULT);
 }
 
+/**
+ * Default bcma(4) bus driver implementation of DEVICE_ATTACH().
+ * 
+ * This implementation initializes internal bcma(4) state and performs
+ * bus enumeration, and must be called by subclassing drivers in
+ * DEVICE_ATTACH() before any other bus methods.
+ */
 int
 bcma_attach(device_t dev)
 {
-   struct bcma_devinfo *dinfo;
-   device_t*devs, child;
-   int  ndevs;
-   int  error;
+   int error;
 
-
-   if ((error = device_get_children(dev, , )))
+   /* Enumerate children */
+   if ((error = bcma_add_children(dev))) {
+   device_delete_children(dev);
return (error);
-
-   /*
-* Map our children's agent register block.
-*/
-   for (int i = 0; i < ndevs; i++) {
-   bhnd_addr_t addr;
-   bhnd_size_t size;
-   rman_res_t  r_start, r_count, r_end;
-
-   child = devs[i];
-   dinfo = device_get_ivars(child);
-
-   KASSERT(!device_is_suspended(child),
-   ("bcma(4) stateful suspend handling requires that devices "
-   "not be suspended before bcma_attach()"));
-   
-   /* Verify that the agent register block exists and is
-* mappable */
-   if (bhnd_get_port_rid(child, BHND_PORT_AGENT, 0, 0) == -1)
-   continue;
-
-   /* Fetch the 

svn commit: r305370 - stable/11/lib/libc/stdio

2016-09-03 Thread Andrey A. Chernov
Author: ache
Date: Sun Sep  4 00:35:55 2016
New Revision: 305370
URL: https://svnweb.freebsd.org/changeset/base/305370

Log:
  MFC r305219
  
  If error happens, don't overwrite original errno comes from __mbrtowc()
  and __srefill().

Modified:
  stable/11/lib/libc/stdio/fgetwc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/stdio/fgetwc.c
==
--- stable/11/lib/libc/stdio/fgetwc.c   Sun Sep  4 00:34:15 2016
(r305369)
+++ stable/11/lib/libc/stdio/fgetwc.c   Sun Sep  4 00:35:55 2016
(r305370)
@@ -84,9 +84,10 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i
return (WEOF);
do {
nconv = l->__mbrtowc(, fp->_p, fp->_r, mbs);
-   if (nconv == (size_t)-1)
-   break;
-   else if (nconv == (size_t)-2)
+   if (nconv == (size_t)-1) {
+   fp->_flags |= __SERR;
+   return (WEOF);
+   } else if (nconv == (size_t)-2)
continue;
else if (nconv == 0) {
fp->_p++;
@@ -100,7 +101,9 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i
return (wc);
}
} while (__srefill(fp) == 0);
-   fp->_flags |= __SERR;
-   errno = EILSEQ;
+   if (__sfeof(fp)) {
+   fp->_flags |= __SERR;
+   errno = EILSEQ;
+   }
return (WEOF);
 }
___
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: r305369 - stable/10/lib/libc/stdio

2016-09-03 Thread Andrey A. Chernov
Author: ache
Date: Sun Sep  4 00:34:15 2016
New Revision: 305369
URL: https://svnweb.freebsd.org/changeset/base/305369

Log:
  MFC r305219
  
  If error happens, don't overwrite original errno comes from __mbrtowc()
  and __srefill().

Modified:
  stable/10/lib/libc/stdio/fgetwc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/stdio/fgetwc.c
==
--- stable/10/lib/libc/stdio/fgetwc.c   Sun Sep  4 00:29:48 2016
(r305368)
+++ stable/10/lib/libc/stdio/fgetwc.c   Sun Sep  4 00:34:15 2016
(r305369)
@@ -84,9 +84,10 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i
return (WEOF);
do {
nconv = l->__mbrtowc(, fp->_p, fp->_r, mbs);
-   if (nconv == (size_t)-1)
-   break;
-   else if (nconv == (size_t)-2)
+   if (nconv == (size_t)-1) {
+   fp->_flags |= __SERR;
+   return (WEOF);
+   } else if (nconv == (size_t)-2)
continue;
else if (nconv == 0) {
fp->_p++;
@@ -100,7 +101,9 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i
return (wc);
}
} while (__srefill(fp) == 0);
-   fp->_flags |= __SERR;
-   errno = EILSEQ;
+   if (__sfeof(fp)) {
+   fp->_flags |= __SERR;
+   errno = EILSEQ;
+   }
return (WEOF);
 }
___
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: r305368 - head/sys/kern

2016-09-03 Thread Mark Johnston
Author: markj
Date: Sun Sep  4 00:29:48 2016
New Revision: 305368
URL: https://svnweb.freebsd.org/changeset/base/305368

Log:
  Micro-optimize sleepq_signal().
  
  Lift a comparison out of the loop that finds the highest-priority thread
  on the queue.
  
  MFC after:1 week

Modified:
  head/sys/kern/subr_sleepqueue.c

Modified: head/sys/kern/subr_sleepqueue.c
==
--- head/sys/kern/subr_sleepqueue.c Sun Sep  4 00:25:49 2016
(r305367)
+++ head/sys/kern/subr_sleepqueue.c Sun Sep  4 00:29:48 2016
(r305368)
@@ -861,9 +861,9 @@ sleepq_signal(void *wchan, int flags, in
 * been sleeping the longest since threads are always added to
 * the tail of sleep queues.
 */
-   besttd = NULL;
+   besttd = TAILQ_FIRST(>sq_blocked[queue]);
TAILQ_FOREACH(td, >sq_blocked[queue], td_slpq) {
-   if (besttd == NULL || td->td_priority < besttd->td_priority)
+   if (td->td_priority < besttd->td_priority)
besttd = td;
}
MPASS(besttd != 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: r305367 - head/sys/vm

2016-09-03 Thread Mark Johnston
Author: markj
Date: Sun Sep  4 00:25:49 2016
New Revision: 305367
URL: https://svnweb.freebsd.org/changeset/base/305367

Log:
  Respect the caller's hints when performing swap readahead.
  
  The pager getpages interface allows the caller to bound the number of
  readahead and readbehind pages, and vm_fault_hold() makes use of this
  feature. These bounds were ignored after r305056, causing the swap pager
  to potentially page in more than the specified number of pages.
  
  Reported and reviewed by: alc
  X-MFC with:   r305056

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cSat Sep  3 23:57:17 2016(r305366)
+++ head/sys/vm/swap_pager.cSun Sep  4 00:25:49 2016(r305367)
@@ -1086,7 +1086,7 @@ swap_pager_getpages(vm_object_t object, 
vm_page_t mpred, msucc, p;
vm_pindex_t pindex;
daddr_t blk;
-   int i, j, reqcount, shift;
+   int i, j, maxahead, maxbehind, reqcount, shift;
 
reqcount = count;
 
@@ -1094,7 +1094,7 @@ swap_pager_getpages(vm_object_t object, 
bp = getpbuf(_rcount);
VM_OBJECT_WLOCK(object);
 
-   if (!swap_pager_haspage(object, m[0]->pindex, rbehind, rahead)) {
+   if (!swap_pager_haspage(object, m[0]->pindex, , )) {
relpbuf(bp, _rcount);
return (VM_PAGER_FAIL);
}
@@ -1103,15 +1103,16 @@ swap_pager_getpages(vm_object_t object, 
 * Clip the readahead and readbehind ranges to exclude resident pages.
 */
if (rahead != NULL) {
-   KASSERT(reqcount - 1 <= *rahead,
+   KASSERT(reqcount - 1 <= maxahead,
("page count %d extends beyond swap block", reqcount));
-   *rahead -= reqcount - 1;
+   *rahead = imin(*rahead, maxahead - (reqcount - 1));
pindex = m[reqcount - 1]->pindex;
msucc = TAILQ_NEXT(m[reqcount - 1], listq);
if (msucc != NULL && msucc->pindex - pindex - 1 < *rahead)
*rahead = msucc->pindex - pindex - 1;
}
if (rbehind != NULL) {
+   *rbehind = imin(*rbehind, maxbehind);
pindex = m[0]->pindex;
mpred = TAILQ_PREV(m[0], pglist, listq);
if (mpred != NULL && pindex - mpred->pindex - 1 < *rbehind)
___
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: r304947 - stable/11/tests/sys/kern/acct

2016-09-03 Thread Ngie Cooper

> On Aug 28, 2016, at 01:49, Bruce Evans  wrote:

...

I agree. This commit in effect papered over the problem. More investigation 
will be done with the PR that introduced the expected failure.

Thanks!
-Ngie
> 
> This can't depend on 64-bitness.  It might depend on FLT_EPSILON, but
> IEEE might require a specific representation of floats and we only have
> and only support one.
> 
> This is probably a bug in the tests that shows up on arches with extra
> precision.  Perhaps just a complier bug.
> 
>> Modified: stable/11/tests/sys/kern/acct/acct_test.c
>> ==
>> --- stable/11/tests/sys/kern/acct/acct_test.cSun Aug 28 07:09:45 2016
>> (r304946)
>> +++ stable/11/tests/sys/kern/acct/acct_test.cSun Aug 28 07:10:48 2016
>> (r304947)
>> @@ -204,7 +204,10 @@ ATF_TC_BODY(encode_tv_random_million, tc
>>struct timeval tv;
>>long k;
>> 
>> -atf_tc_expect_fail("the testcase violates FLT_EPSILON");
>> +#ifdef __LP64__
>> +atf_tc_expect_fail("the testcase violates FLT_EPSILON on 64-bit "
>> +"platforms, e.g. amd64");
>> +#endif
>> 
>>ATF_REQUIRE_MSG(unsetenv("TZ") == 0, "unsetting TZ failed; errno=%d", 
>> errno);
> 
> The rest of the function is:
> 
> Xfor (k = 1; k < 100L; k++) {
> Xtv.tv_sec = random();
> Xtv.tv_usec = (random() % 100L);
> Xv.c = encode_timeval(tv);
> Xcheck_result(atf_tc_get_ident(tc),
> X(float)tv.tv_sec * AHZ + tv.tv_usec, v);
> X}
> 
> AHZ here is less than an obfuscation of literal 1000 or just 1e6 or
> 1e6F.  It doesn't even have the style bug of an L suffix like the nearby
> literals.  Types are important here, but the L isn't.
> 
> AHZ used to be a constant related to fixed-point conversions in acct.h.
> It used to have value 1000.  Note much like the AHZ.   now
> devfines AHZV1 and this has value 64.  This is for a legacy API.  Not
> very compatible.
> 
> This file doesn't include  except possibly via namespace
> pollution, so it doesn't get any AHZ*.  It only uses AHZ to convert
> tv_sec to usec.  This was magical and may be broken.  The file convert.c
> is included.  This is a converted copy of kern_acct.c.  Back when AHZ
> existed in acct.h, kern_acct.c used to use AHZ with its different value.
> I don't see how overriding that value either didn't cause a redefinition
> error or inconsistencies.  Now kern_acct.c doesn't use either AHZ* so
> this definition is not magical.
> 
> So AHZ should be replaced by literal 100 except possibly for type
> problems.  IIRC, C99 specifies the dubious behaviour of converting
> integers to float in float expressions to support the dubious behaviour
> of evaluating float expressions in float precision.  100 is even
> exactly representable in float precision.  But the result of the
> mutliplication isn't in general.  Adding a small tv_usec to a not
> very large tv_sec converted to usec is almost certain to not be
> representable in a 32-bit float after a few random choices.  So
> we expect innacuracies.
> 
> The float expression may be evaluated in extra precision, and is on
> i386.  So we expect smaller inaccuracies on i386.
> 
> It is not clear if remaining bugs are in the test or the compiler.
> Probably both.  The test asks for inaccuracies and gets them in the
> expression sometimes.  It doesn't try to force the inaccuracies by
> casting to float, and only C90+ compilers do this cast as specified
> since the specification specifies behaviour that is too pessimal to
> use.  C90+ compilers are in short supply, but gcc later than aout
> 4.6 properlay pessimizes the cast when instructed to by certain
> compiler flags.
> 
> But the test it calls a function which should do the conversion.  It
> takes excessive inlining combined with the de-pessimization to not
> do the conversion.  Apparently, clang does do the excessive inlining.
> Otherwise the result would be the same on i386 as on amd64.
> 
> The test seems to be quite broken.  encode_timeval() does some
> conversion which is presumably correct.  We calculate a value in
> usec to compare against.  This is only done in float precision
> (possibly higher, but we don't control this).  We expect a relative
> error of about FLT_EPSILON in this.  Later we convert to a relative
> error, so this is only slightly broken.  encode_timeval() must
> have a rounding error, and our calculation has one and the scaling
> has more.  So we should expect errors of several times FLT_EPSILON.
> So the test only seems to be slightly broken.  Strictly less than
> FLT_EPSILON is too strict if the calculations are actually done in
> float precision since it is too difficult to calculate the reference
> and do the scaling without increasing the error.  The worst case
> for the reference is tv_sec = 2**31-1 (31 bits) and tv_usec = 99
> (20 bits).  That is exactly representable in 53 bits (double precision)
> so we 

svn commit: r305366 - in head/sys: conf dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/siba mips/broadcom modules/bhnd modules/bhnd/bcma modules/bhnd/bcma_bhndb modules/bhnd/siba modules/bhnd/siba_...

2016-09-03 Thread Landon J. Fuller
Author: landonf
Date: Sat Sep  3 23:57:17 2016
New Revision: 305366
URL: https://svnweb.freebsd.org/changeset/base/305366

Log:
  Implement a generic bhnd(4) device enumeration table API.
  
  This defines a new bhnd_erom_if API, providing a common interface to device
  enumeration on siba(4) and bcma(4) devices, for use both in the bhndb bridge
  and SoC early boot contexts, and migrates mips/broadcom over to the new API.
  
  This also replaces the previous adhoc device enumeration support implemented
  for mips/broadcom.
  
  Migration of bhndb to the new API will be implemented in a follow-up commit.
  
  
  - Defined new bhnd_erom_if interface for bhnd(4) device enumeration, along
with bcma(4) and siba(4)-specific implementations.
  - Fixed a minor bug in bhndb that logged an error when we attempted to map the
full siba(4) bus space (1800-17FF) in the siba EROM parser.
  - Reverted use of the resource's start address as the ChipCommon enum_addr in
bhnd_read_chipid(). When called from bhndb, this address is found within the
host address space, resulting in an invalid bridged enum_addr.
  - Added support for falling back on standard bus_activate_resource() in
bhnd_bus_generic_activate_resource(), enabling allocation of the bhnd_erom's
bhnd_resource directly from a nexus-attached bhnd(4) device.
  - Removed BHND_BUS_GET_CORE_TABLE(); it has been replaced by the erom API.
  - Added support for statically initializing bhnd_erom instances, for use prior
to malloc availability. The statically allocated buffer size is verified 
both
at runtime, and via a compile-time assertion (see BHND_EROM_STATIC_BYTES).
  - bhnd_erom classes are registered within a module via a linker set, allowing
mips/broadcom to probe available EROM parser instances without creating a
strong reference to bcma/siba-specific symbols.
  - Migrated mips/broadcom to bhnd_erom_if, replacing the previous MIPS-specific
device enumeration implementation.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7748

Added:
  head/sys/dev/bhnd/bhnd_erom.c   (contents, props changed)
  head/sys/dev/bhnd/bhnd_erom.h   (contents, props changed)
  head/sys/dev/bhnd/bhnd_erom_if.m   (contents, props changed)
  head/sys/dev/bhnd/bhnd_erom_types.h   (contents, props changed)
  head/sys/dev/bhnd/siba/siba_erom.c   (contents, props changed)
Deleted:
  head/sys/mips/broadcom/bcm_bcma.c
  head/sys/mips/broadcom/bcm_siba.c
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/bcma/bcma.c
  head/sys/dev/bhnd/bcma/bcma.h
  head/sys/dev/bhnd/bcma/bcma_bhndb.c
  head/sys/dev/bhnd/bcma/bcma_erom.c
  head/sys/dev/bhnd/bcma/bcma_eromvar.h
  head/sys/dev/bhnd/bcma/bcma_nexus.c
  head/sys/dev/bhnd/bcma/bcmavar.h
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/dev/bhnd/siba/siba.c
  head/sys/dev/bhnd/siba/siba.h
  head/sys/dev/bhnd/siba/siba_subr.c
  head/sys/dev/bhnd/siba/sibareg.h
  head/sys/dev/bhnd/siba/sibavar.h
  head/sys/mips/broadcom/bcm_machdep.c
  head/sys/mips/broadcom/bcm_machdep.h
  head/sys/mips/broadcom/bcm_pmu.c
  head/sys/mips/broadcom/files.broadcom
  head/sys/modules/bhnd/Makefile
  head/sys/modules/bhnd/bcma/Makefile
  head/sys/modules/bhnd/bcma_bhndb/Makefile
  head/sys/modules/bhnd/siba/Makefile
  head/sys/modules/bhnd/siba_bhndb/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sat Sep  3 23:04:56 2016(r305365)
+++ head/sys/conf/files Sat Sep  3 23:57:17 2016(r305366)
@@ -1140,6 +1140,8 @@ dev/bce/if_bce.c  optional bce
 dev/bfe/if_bfe.c   optional bfe
 dev/bge/if_bge.c   optional bge
 dev/bhnd/bhnd.coptional bhnd
+dev/bhnd/bhnd_erom.c   optional bhnd
+dev/bhnd/bhnd_erom_if.moptional bhnd
 dev/bhnd/bhnd_nexus.c  optional bhnd siba_nexus | \
 bhnd bcma_nexus
 dev/bhnd/bhnd_subr.c   optional bhnd
@@ -1188,6 +1190,7 @@ dev/bhnd/nvram/bhnd_sprom.c   optional bh
 dev/bhnd/nvram/bhnd_sprom_parser.c optional bhnd
 dev/bhnd/siba/siba.c   optional siba bhnd
 dev/bhnd/siba/siba_bhndb.c optional siba bhnd bhndb
+dev/bhnd/siba/siba_erom.c  optional siba bhnd
 dev/bhnd/siba/siba_nexus.c optional siba_nexus siba bhnd
 dev/bhnd/siba/siba_subr.c  optional siba bhnd
 #

Modified: head/sys/dev/bhnd/bcma/bcma.c
==
--- head/sys/dev/bhnd/bcma/bcma.c   Sat Sep  3 23:04:56 2016
(r305365)
+++ head/sys/dev/bhnd/bcma/bcma.c   Sat Sep  3 23:57:17 2016
(r305366)
@@ -45,6 +45,9 @@ __FBSDID("$FreeBSD$");
 

svn commit: r305365 - head/contrib/one-true-awk

2016-09-03 Thread Andrey A. Chernov
Author: ache
Date: Sat Sep  3 23:04:56 2016
New Revision: 305365
URL: https://svnweb.freebsd.org/changeset/base/305365

Log:
  The bug:
  $ echo x | awk '/[[:cntrl:]]/'
  x
  
  The NUL character in cntrl class truncates the pattern, and an empty
  pattern matches anything. The patch skips NUL as a quick fix.
  
  PR: 195792
  Submitted by:   kdrak...@zoho.com
  Approved by:b...@cs.princeton.edu (the author)
  MFC after:  3 days

Modified:
  head/contrib/one-true-awk/b.c

Modified: head/contrib/one-true-awk/b.c
==
--- head/contrib/one-true-awk/b.c   Sat Sep  3 21:41:29 2016
(r305364)
+++ head/contrib/one-true-awk/b.c   Sat Sep  3 23:04:56 2016
(r305365)
@@ -841,7 +841,7 @@ int relex(void) /* lexical analyzer for
if (cc->cc_name != NULL && prestr[1 + 
cc->cc_namelen] == ':' &&
prestr[2 + cc->cc_namelen] == ']') {
prestr += cc->cc_namelen + 3;
-   for (i = 0; i < NCHARS; i++) {
+   for (i = 1; i < NCHARS; i++) {
if (!adjbuf((char **) , 
, bp-buf+1, 100, (char **) , "relex2"))
FATAL("out of space for reg 
expr %.10s...", lastre);
if (cc->cc_func(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: r305363 - head/share/dtrace

2016-09-03 Thread Mark Johnston
Author: markj
Date: Sat Sep  3 20:43:59 2016
New Revision: 305363
URL: https://svnweb.freebsd.org/changeset/base/305363

Log:
  Remove redefinitions of some kernel types from mbuf.d.
  
  These override the kernel's definitions and do not match in some cases,
  which can break scripts that use these types. With r305055, dtrace is able
  to trace fields of struct mbuf's anonymous structs and unions, so there is
  no need to redefine types already defined in CTF.
  
  MFC after:3 days

Modified:
  head/share/dtrace/mbuf.d

Modified: head/share/dtrace/mbuf.d
==
--- head/share/dtrace/mbuf.dSat Sep  3 20:38:13 2016(r305362)
+++ head/share/dtrace/mbuf.dSat Sep  3 20:43:59 2016(r305363)
@@ -26,7 +26,6 @@
  * $FreeBSD$
  *
  * Translators and flags for the mbuf structure.  FreeBSD specific code.
- *
  */
 
 #pragma D depends_on module kernel
@@ -110,89 +109,6 @@ inline string mbufflags_string[uint32_t 
 flags & M_PROTO12 ? "M_PROTO12" :
 "none" ;
 
-/*
- * Packet tag structure (see below for details).
- */
-typedef struct m_tag {
-   u_int16_t   m_tag_id;   /* Tag ID */
-   u_int16_t   m_tag_len;  /* Length of data */
-   u_int32_t   m_tag_cookie;   /* ABI/Module ID */
-} m_tag_t;
-
-/*
- * Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set.
- * Size ILP32: 48
- *  LP64: 56
- * Compile-time assertions in uipc_mbuf.c test these values to ensure that
- * they are correct.
- */
-typedef struct pkthdr {
-/* struct ifnet*rcvif; */  /* rcv interface */
-   int32_t  len;   /* total packet length */
-
-   /* Layer crossing persistent information. */
-   uint32_t flowid;/* packet's 4-tuple system */
-   uint64_t csum_flags;/* checksum and offload features */
-   uint16_t fibnum;/* this packet should use this fib */
-   uint8_t  cosqos;/* class/quality of service */
-   uint8_t  rsstype;   /* hash type */
-} pkthdr_t;
-
-/*
- * Description of external storage mapped into mbuf; valid only if M_EXT is
- * set.
- * Size ILP32: 28
- *  LP64: 48
- * Compile-time assertions in uipc_mbuf.c test these values to ensure that
- * they are correct.
- */
-typedef struct m_ext {
-   volatile u_int  *ext_cnt;   /* pointer to ref count info */
-   caddr_t  ext_buf;   /* start of buffer */
-   uint32_t ext_size;  /* size of buffer, for ext_free */
-   uint32_t ext_type:8,/* type of external storage */
-ext_flags:24;  /* external storage mbuf flags */
-   void*ext_arg1;  /* optional argument pointer */
-   void*ext_arg2;  /* optional argument pointer */
-} m_ext_t;
-
-/*
- * The core of the mbuf object along with some shortcut defines for practical
- * purposes.
- */
-struct mbuf {
-   uintptr_t mbuf_addr;
-   /*
-* Header present at the beginning of every mbuf.
-* Size ILP32: 24
-*  LP64: 32
-* Compile-time assertions in uipc_mbuf.c test these values to ensure
-* that they are correct.
-*/
-   caddr_t  m_data;/* location of data */
-   int32_t  m_len; /* amount of data in this mbuf */
-   uint32_t m_type:8,  /* type of data in this mbuf */
-m_flags:24;/* flags; see below */
-   /*
-* A set of optional headers (packet header, external storage header)
-* and internal data storage.  Historically, these arrays were sized
-* to MHLEN (space left after a packet header) and MLEN (space left
-* after only a regular mbuf header); they are now variable size in
-* order to support future work on variable-size mbufs.
-*/
-   /* union { */
-   /*  struct { */
-   /*  struct pkthdr   m_pkthdr; */
-   /*  union { */
-   /*  struct m_extm_ext; */
-   /*  charm_pktdat[0]; */
-   /*  }; */
-   /*  }; */
-   /*  charm_dat[0];*/
-   /* }; */
-   char *m_dat;
-};
-
 typedef struct mbufinfo {
uintptr_t mbuf_addr;
caddr_t m_data;
___
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: r305362 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/conf sys/i386/i386 sys/i386/include sys/mips/mips sys/powerpc/aim sys/powerpc/booke sys/powerpc/powerpc...

2016-09-03 Thread Mark Johnston
Author: markj
Date: Sat Sep  3 20:38:13 2016
New Revision: 305362
URL: https://svnweb.freebsd.org/changeset/base/305362

Log:
  Remove support for idle page zeroing.
  
  Idle page zeroing has been disabled by default on all architectures since
  r170816 and has some bugs that make it seemingly unusable. Specifically,
  the idle-priority pagezero thread exacerbates contention for the free page
  lock, and yields the CPU without releasing it in non-preemptive kernels. The
  pagezero thread also does not behave correctly when superpage reservations
  are enabled: its target is a function of v_free_count, which includes
  reserved-but-free pages, but it is only able to zero pages belonging to the
  physical memory allocator.
  
  Reviewed by:  alc, imp, kib
  Differential Revision:https://reviews.freebsd.org/D7714

Deleted:
  head/sys/vm/vm_zeroidle.c
Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/pmap.9
  head/share/man/man9/pmap_zero_page.9
  head/sys/amd64/amd64/pmap.c
  head/sys/arm/arm/pmap-v4.c
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm64/arm64/pmap.c
  head/sys/conf/files
  head/sys/i386/i386/pmap.c
  head/sys/i386/include/pmap.h
  head/sys/mips/mips/pmap.c
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/powerpc/mmu_if.m
  head/sys/powerpc/powerpc/pmap_dispatch.c
  head/sys/riscv/riscv/pmap.c
  head/sys/sparc64/sparc64/pmap.c
  head/sys/vm/pmap.h
  head/sys/vm/vm_meter.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h
  head/sys/vm/vm_phys.c
  head/sys/vm/vm_phys.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileSat Sep  3 19:09:01 2016
(r305361)
+++ head/share/man/man9/MakefileSat Sep  3 20:38:13 2016
(r305362)
@@ -1391,8 +1391,7 @@ MLINKS+=pmap_quick_enter_page.9 pmap_qui
 MLINKS+=pmap_remove.9 pmap_remove_all.9 \
pmap_remove.9 pmap_remove_pages.9
 MLINKS+=pmap_resident_count.9 pmap_wired_count.9
-MLINKS+=pmap_zero_page.9 pmap_zero_area.9 \
-   pmap_zero_page.9 pmap_zero_idle.9
+MLINKS+=pmap_zero_page.9 pmap_zero_area.9
 MLINKS+=printf.9 log.9 \
printf.9 tprintf.9 \
printf.9 uprintf.9

Modified: head/share/man/man9/pmap.9
==
--- head/share/man/man9/pmap.9  Sat Sep  3 19:09:01 2016(r305361)
+++ head/share/man/man9/pmap.9  Sat Sep  3 20:38:13 2016(r305362)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 3, 2014
+.Dd August 30, 2016
 .Dt PMAP 9
 .Os
 .Sh NAME
@@ -121,7 +121,6 @@ operation.
 .Xr pmap_unwire 9 ,
 .Xr pmap_wired_count 9 ,
 .Xr pmap_zero_area 9 ,
-.Xr pmap_zero_idle 9 ,
 .Xr pmap_zero_page 9 ,
 .Xr vm_map 9
 .Sh AUTHORS

Modified: head/share/man/man9/pmap_zero_page.9
==
--- head/share/man/man9/pmap_zero_page.9Sat Sep  3 19:09:01 2016
(r305361)
+++ head/share/man/man9/pmap_zero_page.9Sat Sep  3 20:38:13 2016
(r305362)
@@ -25,13 +25,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 21, 2003
+.Dd August 30, 2016
 .Dt PMAP_ZERO 9
 .Os
 .Sh NAME
 .Nm pmap_zero_page ,
 .Nm pmap_zero_area ,
-.Nm pmap_zero_idle
 .Nd zero-fill a page using machine-dependent optimizations
 .Sh SYNOPSIS
 .In sys/param.h
@@ -41,8 +40,6 @@
 .Fn pmap_zero_page "vm_page_t m"
 .Ft void
 .Fn pmap_zero_page_area "vm_page_t m" "int off" "int size"
-.Ft void
-.Fn pmap_zero_page_idle "vm_page_t m"
 .Sh DESCRIPTION
 The
 .Fn pmap_zero_page
@@ -53,14 +50,6 @@ function is used to zero-fill an area of
 The range specified must not cross a page boundary; it must be contained
 entirely within a single page.
 .Pp
-The
-.Fn pmap_zero_page_idle
-interface is used by the
-.Nm vm_pagezero
-process.
-The system-wide
-.Va Giant
-lock should not be required to be held in order to call this interface.
 .Sh IMPLEMENTATION NOTES
 This function is required to be implemented for each architecture supported by
 .Fx .

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Sat Sep  3 19:09:01 2016(r305361)
+++ head/sys/amd64/amd64/pmap.c Sat Sep  3 20:38:13 2016(r305362)
@@ -5179,19 +5179,6 @@ pmap_zero_page_area(vm_page_t m, int off
 }
 
 /*
- * Zero the specified hardware page in a way that minimizes cache thrashing.
- * This is intended to be called from the vm_pagezero process only and
- * outside of Giant.
- */
-void
-pmap_zero_page_idle(vm_page_t m)
-{
-   vm_offset_t va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m));
-
-   sse2_pagezero((void *)va);
-}
-
-/*
  * Copy 1 specified hardware page to another.
  */
 void

Modified: head/sys/arm/arm/pmap-v4.c
==
--- head/sys/arm/arm/pmap-v4.c  Sat Sep  3 19:09:01 2016

Re: svn commit: r305354 - head/sys/arm/allwinner

2016-09-03 Thread Oliver Pinter
Hi!

Thanks for explanation. The feature's name is very misleading...


On 9/3/16, Jared McNeill  wrote:
> Hi Oliver --
>
> It's really just a serial number. The Allwinner A20 datasheet refers to it
> as a root key, later ones such as A83T refer to it as chip ID. U-Boot
> uses the same process to generate MAC addresses for all Allwinner boards.
>
> Cheers,
> Jared
>
>
> On Sat, 3 Sep 2016, Oliver Pinter wrote:
>
>> Hi!
>>
>> On 9/3/16, Jared McNeill  wrote:
>>> Author: jmcneill
>>> Date: Sat Sep  3 15:28:09 2016
>>> New Revision: 305354
>>> URL: https://svnweb.freebsd.org/changeset/base/305354
>>>
>>> Log:
>>>   Use the root key in the Security ID EFUSE (when valid) to generate a
>>>   MAC address instead of creating a random one each boot.
>>
>> Could you please describe a little more about this root key? What is
>> it? What's the main purpose? Is is a crypto root key?
>>
>>>
>>> Modified:
>>>   head/sys/arm/allwinner/if_awg.c
>>>
>>> Modified: head/sys/arm/allwinner/if_awg.c
>>> ==
>>> --- head/sys/arm/allwinner/if_awg.c Sat Sep  3 15:26:28 2016
>>> (r305353)
>>> +++ head/sys/arm/allwinner/if_awg.c Sat Sep  3 15:28:09 2016
>>> (r305354)
>>> @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
>>>  #include 
>>>
>>>  #include 
>>> +#include 
>>>  #include 
>>>  #include 
>>>
>>> @@ -1277,6 +1278,7 @@ awg_get_eaddr(device_t dev, uint8_t *ead
>>>  {
>>> struct awg_softc *sc;
>>> uint32_t maclo, machi, rnd;
>>> +   u_char rootkey[16];
>>>
>>> sc = device_get_softc(dev);
>>>
>>> @@ -1285,9 +1287,19 @@ awg_get_eaddr(device_t dev, uint8_t *ead
>>>
>>> if (maclo == 0x && machi == 0x) {
>>> /* MAC address in hardware is invalid, create one */
>>> -   rnd = arc4random();
>>> -   maclo = 0x00f2 | (rnd & 0x);
>>> -   machi = rnd & 0x;
>>> +   if (aw_sid_get_rootkey(rootkey) == 0 &&
>>> +   (rootkey[3] | rootkey[12] | rootkey[13] | rootkey[14] |
>>> +rootkey[15]) != 0) {
>>> +   /* MAC address is derived from the root key in SID */
>>> +   maclo = (rootkey[13] << 24) | (rootkey[12] << 16) |
>>> +   (rootkey[3] << 8) | 0x02;
>>> +   machi = (rootkey[15] << 8) | rootkey[14];
>>> +   } else {
>>> +   /* Create one */
>>> +   rnd = arc4random();
>>> +   maclo = 0x00f2 | (rnd & 0x);
>>> +   machi = rnd & 0x;
>>> +   }
>>> }
>>>
>>> eaddr[0] = maclo & 0xff;
>>> ___
>>> svn-src-h...@freebsd.org mailing list
>>> https://lists.freebsd.org/mailman/listinfo/svn-src-head
>>> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
>>>
>>
>>
>
___
svn-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: r305360 - head/sys/dev/cxgb

2016-09-03 Thread Dimitry Andric
Author: dim
Date: Sat Sep  3 19:01:11 2016
New Revision: 305360
URL: https://svnweb.freebsd.org/changeset/base/305360

Log:
  With clang 3.9.0, compiling cxgb results in the following warning:
  
  sys/dev/cxgb/cxgb_sge.c:2873:44: error: implicit conversion from 'int'
  to 'char' changes value from 128 to -128 [-Werror,-Wconstant-conversion]
  *mtod(m, char *) = CPL_ASYNC_NOTIF;
   ~ ^~~
  
  This is because CPL_ASYNC_NOTIF is 0x80, so the plain char argument is
  wrapped to a negative value.  Fix this by using uint8_t instead.
  
  Reviewed by:  np
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D7772

Modified:
  head/sys/dev/cxgb/cxgb_sge.c

Modified: head/sys/dev/cxgb/cxgb_sge.c
==
--- head/sys/dev/cxgb/cxgb_sge.cSat Sep  3 18:54:26 2016
(r305359)
+++ head/sys/dev/cxgb/cxgb_sge.cSat Sep  3 19:01:11 2016
(r305360)
@@ -2870,7 +2870,7 @@ process_responses(adapter_t *adap, struc
 
 memcpy(mtod(m, char *), r, AN_PKT_SIZE);
m->m_len = m->m_pkthdr.len = AN_PKT_SIZE;
-*mtod(m, char *) = CPL_ASYNC_NOTIF;
+*mtod(m, uint8_t *) = CPL_ASYNC_NOTIF;
opcode = CPL_ASYNC_NOTIF;
eop = 1;
 rspq->async_notif++;
___
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: r305359 - head/sys/dev/cxgbe/cxgbei

2016-09-03 Thread Navdeep Parhar
Author: np
Date: Sat Sep  3 18:54:26 2016
New Revision: 305359
URL: https://svnweb.freebsd.org/changeset/base/305359

Log:
  Use correct CTR variant.

Modified:
  head/sys/dev/cxgbe/cxgbei/cxgbei.c

Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.c
==
--- head/sys/dev/cxgbe/cxgbei/cxgbei.c  Sat Sep  3 18:11:48 2016
(r305358)
+++ head/sys/dev/cxgbe/cxgbei/cxgbei.c  Sat Sep  3 18:54:26 2016
(r305359)
@@ -355,7 +355,7 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const
val = be32toh(cpl->ddpvld);
 
 #if 0
-   CTR4(KTR_CXGBE,
+   CTR5(KTR_CXGBE,
"%s: tid %u, cpl->len %u, ddpvld 0x%08x, icp_flags 0x%08x",
__func__, tid, pdu_len, val, icp->icp_flags);
 #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"


Re: svn commit: r305308 - stable/11/sys/arm/ti

2016-09-03 Thread Oleksandr Tymoshenko

> On Sep 3, 2016, at 1:44 AM, Konstantin Belousov  wrote:
> 
> On Fri, Sep 02, 2016 at 10:04:20PM +, Oleksandr Tymoshenko wrote:
>> Author: gonzo
>> Date: Fri Sep  2 22:04:20 2016
>> New Revision: 305308
>> URL: https://svnweb.freebsd.org/changeset/base/305308
>> 
>> Log:
>>  MFC r305039:
>> 
>>  Fix TI PRUSS driver panic with INVARIANTS enabled
>> 
>>  Value passed as islocked argument to knlist_add should
>>  be consistent with actual lock state so add lock/unlock
>>  calls around knlist_add
>> 
>>  PR: 212120
>>  Submitted by:   Manuel Stuhn
>> 
>> Modified:
>>  stable/11/sys/arm/ti/ti_pruss.c
>> Directory Properties:
>>  stable/11/   (props changed)
>> 
>> Modified: stable/11/sys/arm/ti/ti_pruss.c
>> ==
>> --- stable/11/sys/arm/ti/ti_pruss.c  Fri Sep  2 21:35:32 2016
>> (r305307)
>> +++ stable/11/sys/arm/ti/ti_pruss.c  Fri Sep  2 22:04:20 2016
>> (r305308)
>> @@ -310,7 +310,9 @@ ti_pruss_kqfilter(struct cdev *cdev, str
>>  case EVFILT_READ:
>>  kn->kn_hook = sc;
>>  kn->kn_fop = _pruss_kq_read;
>> +mtx_lock(>sc_mtx);
>>  knlist_add(>sc_selinfo.si_note, kn, 1);
>> +mtx_unlock(>sc_mtx);
>>  break;
>>  default:
>>  return (EINVAL);
> Wouldn't it be less code to just change the arg to indicate 'unlocked’ ?

It would. I’ll update HEAD and stable/11 soon. Thanks for spotting. 

___
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: r305358 - in head: bin/cat/tests contrib/netbsd-tests contrib/netbsd-tests/bin/cat contrib/netbsd-tests/bin/sh contrib/netbsd-tests/bin/sh/dotcmd contrib/netbsd-tests/crypto/opencrypto ...

2016-09-03 Thread Ngie Cooper
Author: ngie
Date: Sat Sep  3 18:11:48 2016
New Revision: 305358
URL: https://svnweb.freebsd.org/changeset/base/305358

Log:
  Update contrib/netbsd-tests with new content from NetBSD
  
  This updates the snapshot from 09/30/2014 to 08/11/2016
  
  This brings in a number of new testcases from upstream, most
  notably:
  
  - bin/cat
  - lib/libc
  - lib/msun
  - lib/libthr
  - usr.bin/sort
  
  lib/libc/tests/stdio/open_memstream_test.c was moved to
  lib/libc/tests/stdio/open_memstream2_test.c to accomodate
  the new open_memstream test from NetBSD.
  
  MFC after:2 months
  Tested on:amd64 (VMware fusion VM; various bare metal platforms); i386 
(VMware fusion VM); make tinderbox
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/contrib/netbsd-tests/bin/cat/d_se_output.in
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/cat/d_se_output.in
  head/contrib/netbsd-tests/bin/cat/d_se_output.out
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/cat/d_se_output.out
  head/contrib/netbsd-tests/bin/sh/t_arith.sh
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_arith.sh
  head/contrib/netbsd-tests/bin/sh/t_cmdsub.sh
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_cmdsub.sh
  head/contrib/netbsd-tests/bin/sh/t_option.sh
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_option.sh
  head/contrib/netbsd-tests/bin/sh/t_redir.sh
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_redir.sh
  head/contrib/netbsd-tests/bin/sh/t_redircloexec.sh
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_redircloexec.sh
  head/contrib/netbsd-tests/bin/sh/t_shift.sh
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_shift.sh
  head/contrib/netbsd-tests/bin/sh/t_varval.sh
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/bin/sh/t_varval.sh
  head/contrib/netbsd-tests/dev/fss/
 - copied from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/dev/fss/
  head/contrib/netbsd-tests/dev/usb/
 - copied from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/dev/usb/
  head/contrib/netbsd-tests/include/sys/t_pslist.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/include/sys/t_pslist.c
  head/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
  head/contrib/netbsd-tests/lib/libc/db/h_lfsr.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/db/h_lfsr.c
  head/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c
  head/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c
  head/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c
  head/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c
  head/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc
  head/contrib/netbsd-tests/lib/libc/sys/t_bind.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/sys/t_bind.c
  head/contrib/netbsd-tests/lib/libc/sys/t_getsockname.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/sys/t_getsockname.c
  head/contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c
  head/contrib/netbsd-tests/lib/libc/sys/t_wait.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libc/sys/t_wait.c
  head/contrib/netbsd-tests/lib/libm/t_fenv.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libm/t_fenv.c
  head/contrib/netbsd-tests/lib/libm/t_hypot.c
 - copied unchanged from r305318, 
projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libm/t_hypot.c
  head/contrib/netbsd-tests/lib/libusbhid/
 - copied from r305318, 

svn commit: r305357 - head/tests/sys/mac/bsdextended

2016-09-03 Thread Ngie Cooper
Author: ngie
Date: Sat Sep  3 17:59:46 2016
New Revision: 305357
URL: https://svnweb.freebsd.org/changeset/base/305357

Log:
  Skip testcases 9/10 if jail(8) isn't installed
  
  These testcases require jail support
  
  MFC after:1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/tests/sys/mac/bsdextended/matches_test.sh

Modified: head/tests/sys/mac/bsdextended/matches_test.sh
==
--- head/tests/sys/mac/bsdextended/matches_test.sh  Sat Sep  3 17:31:13 
2016(r305356)
+++ head/tests/sys/mac/bsdextended/matches_test.sh  Sat Sep  3 17:59:46 
2016(r305357)
@@ -144,30 +144,36 @@ else
fail $desc
 fi
 
-#
-# Subject Match on jail
-#
-rm -f $playground/test-jail
-
-desc="subject matching jailid"
-jailid=`jail -i / localhost 127.0.0.1 /usr/sbin/daemon -f /bin/sh -c "(sleep 
5; touch $playground/test-jail) &"`
-ugidfw set 1 subject jailid $jailid object mode rasx
-sleep 10
-
-if [ -f $playground/test-jail ]; then
-   fail "TODO $desc: this testcase fails (see bug # 205481)"
-else
-   pass $desc
-fi
-
-rm -f $playground/test-jail
-desc="subject nonmatching jailid"
-jailid=`jail -i / localhost 127.0.0.1 /usr/sbin/daemon -f /bin/sh -c "(sleep 
5; touch $playground/test-jail) &"`
-sleep 10
-if [ -f $playground/test-jail ]; then
-   pass $desc
-else
-   fail $desc
+if which jail >/dev/null; then
+   #
+   # Subject Match on jail
+   #
+   rm -f $playground/test-jail
+
+   desc="subject matching jailid"
+   jailid=`jail -i / localhost 127.0.0.1 /usr/sbin/daemon -f /bin/sh -c 
"(sleep 5; touch $playground/test-jail) &"`
+   ugidfw set 1 subject jailid $jailid object mode rasx
+   sleep 10
+
+   if [ -f $playground/test-jail ]; then
+   fail "TODO $desc: this testcase fails (see bug # 205481)"
+   else
+   pass $desc
+   fi
+
+   rm -f $playground/test-jail
+   desc="subject nonmatching jailid"
+   jailid=`jail -i / localhost 127.0.0.1 /usr/sbin/daemon -f /bin/sh -c 
"(sleep 5; touch $playground/test-jail) &"`
+   sleep 10
+   if [ -f $playground/test-jail ]; then
+   pass $desc
+   else
+   fail $desc
+   fi
+else
+   # XXX: kyua is too dumb to parse skip ranges, still..
+   pass "skip jail(8) not installed"
+   pass "skip jail(8) not installed"
 fi
 
 #
___
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: r305356 - head/tests/sys/acl

2016-09-03 Thread Ngie Cooper
Author: ngie
Date: Sat Sep  3 17:31:13 2016
New Revision: 305356
URL: https://svnweb.freebsd.org/changeset/base/305356

Log:
  Add a missing "Bail out!" if zpool create fails
  
  This will make the exit info more meaningful if/when zpool create fails,
  and establishes parity with the other 2 zfs acl testcases (01, 03).
  
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/tests/sys/acl/04.sh

Modified: head/tests/sys/acl/04.sh
==
--- head/tests/sys/acl/04.shSat Sep  3 17:23:24 2016(r305355)
+++ head/tests/sys/acl/04.shSat Sep  3 17:31:13 2016(r305356)
@@ -50,6 +50,7 @@ MNT=`mktemp -dt acltools`
 zpool create -m $MNT acltools /dev/$MD
 if [ $? -ne 0 ]; then
echo "not ok 1 - 'zpool create' failed."
+   echo 'Bail out!'
exit 1
 fi
 
___
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: r305354 - head/sys/arm/allwinner

2016-09-03 Thread Emmanuel Vadot

 I'll add that everybody uses this as a serial number. Since thoses are
efuses, you can't change it unless a specific voltage is applied to a
certain pin (which is tied to GND on every board), but no one have tried
to do that.
There might be some way do restrict reading that key a
there is also some configuration fuses but the documentation doesn't
say much about this peripheral.
 You can check http://linux-sunxi.org/SID for (a little) more
information.

On Sat, 3 Sep 2016 14:06:37 -0300 (ADT)
Jared McNeill  wrote:

> Hi Oliver --
> 
> It's really just a serial number. The Allwinner A20 datasheet refers to it 
> as a root key, later ones such as A83T refer to it as chip ID. U-Boot 
> uses the same process to generate MAC addresses for all Allwinner boards.
> 
> Cheers,
> Jared
> 
> 
> On Sat, 3 Sep 2016, Oliver Pinter wrote:
> 
> > Hi!
> >
> > On 9/3/16, Jared McNeill  wrote:
> >> Author: jmcneill
> >> Date: Sat Sep  3 15:28:09 2016
> >> New Revision: 305354
> >> URL: https://svnweb.freebsd.org/changeset/base/305354
> >>
> >> Log:
> >>   Use the root key in the Security ID EFUSE (when valid) to generate a
> >>   MAC address instead of creating a random one each boot.
> >
> > Could you please describe a little more about this root key? What is
> > it? What's the main purpose? Is is a crypto root key?
> >
> >>
> >> Modified:
> >>   head/sys/arm/allwinner/if_awg.c
> >>
> >> Modified: head/sys/arm/allwinner/if_awg.c
> >> ==
> >> --- head/sys/arm/allwinner/if_awg.cSat Sep  3 15:26:28 2016
> >> (r305353)
> >> +++ head/sys/arm/allwinner/if_awg.cSat Sep  3 15:28:09 2016
> >> (r305354)
> >> @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
> >>  #include 
> >>
> >>  #include 
> >> +#include 
> >>  #include 
> >>  #include 
> >>
> >> @@ -1277,6 +1278,7 @@ awg_get_eaddr(device_t dev, uint8_t *ead
> >>  {
> >>struct awg_softc *sc;
> >>uint32_t maclo, machi, rnd;
> >> +  u_char rootkey[16];
> >>
> >>sc = device_get_softc(dev);
> >>
> >> @@ -1285,9 +1287,19 @@ awg_get_eaddr(device_t dev, uint8_t *ead
> >>
> >>if (maclo == 0x && machi == 0x) {
> >>/* MAC address in hardware is invalid, create one */
> >> -  rnd = arc4random();
> >> -  maclo = 0x00f2 | (rnd & 0x);
> >> -  machi = rnd & 0x;
> >> +  if (aw_sid_get_rootkey(rootkey) == 0 &&
> >> +  (rootkey[3] | rootkey[12] | rootkey[13] | rootkey[14] |
> >> +   rootkey[15]) != 0) {
> >> +  /* MAC address is derived from the root key in SID */
> >> +  maclo = (rootkey[13] << 24) | (rootkey[12] << 16) |
> >> +  (rootkey[3] << 8) | 0x02;
> >> +  machi = (rootkey[15] << 8) | rootkey[14];
> >> +  } else {
> >> +  /* Create one */
> >> +  rnd = arc4random();
> >> +  maclo = 0x00f2 | (rnd & 0x);
> >> +  machi = rnd & 0x;
> >> +  }
> >>}
> >>
> >>eaddr[0] = maclo & 0xff;
> >> ___
> >> svn-src-h...@freebsd.org mailing list
> >> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> >> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
> >>
> >
> >


-- 
Emmanuel Vadot
___
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: r305355 - head/sys/conf

2016-09-03 Thread Andrew Turner
Author: andrew
Date: Sat Sep  3 17:23:24 2016
New Revision: 305355
URL: https://svnweb.freebsd.org/changeset/base/305355

Log:
  Explicitly include all .rodata.* sections in the kernel .rodata. This
  helps link the kernel with lld as it will then put all these into a single
  .rodata section.
  
  MFC after:1 week
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/conf/ldscript.arm64

Modified: head/sys/conf/ldscript.arm64
==
--- head/sys/conf/ldscript.arm64Sat Sep  3 15:28:09 2016
(r305354)
+++ head/sys/conf/ldscript.arm64Sat Sep  3 17:23:24 2016
(r305355)
@@ -18,7 +18,7 @@ SECTIONS
   _etext = .;
   PROVIDE (etext = .);
   .fini  : { *(.fini)} =0x9090
-  .rodata: { *(.rodata) *(.gnu.linkonce.r*) }
+  .rodata: { *(.rodata*) *(.gnu.linkonce.r*) }
   .rodata1   : { *(.rodata1) }
.interp : { *(.interp)  }
   .hash  : { *(.hash)  }
___
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: r305354 - head/sys/arm/allwinner

2016-09-03 Thread Jared McNeill

Hi Oliver --

It's really just a serial number. The Allwinner A20 datasheet refers to it 
as a root key, later ones such as A83T refer to it as chip ID. U-Boot 
uses the same process to generate MAC addresses for all Allwinner boards.


Cheers,
Jared


On Sat, 3 Sep 2016, Oliver Pinter wrote:


Hi!

On 9/3/16, Jared McNeill  wrote:

Author: jmcneill
Date: Sat Sep  3 15:28:09 2016
New Revision: 305354
URL: https://svnweb.freebsd.org/changeset/base/305354

Log:
  Use the root key in the Security ID EFUSE (when valid) to generate a
  MAC address instead of creating a random one each boot.


Could you please describe a little more about this root key? What is
it? What's the main purpose? Is is a crypto root key?



Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Sat Sep  3 15:26:28 2016
(r305353)
+++ head/sys/arm/allwinner/if_awg.c Sat Sep  3 15:28:09 2016
(r305354)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 

 #include 
+#include 
 #include 
 #include 

@@ -1277,6 +1278,7 @@ awg_get_eaddr(device_t dev, uint8_t *ead
 {
struct awg_softc *sc;
uint32_t maclo, machi, rnd;
+   u_char rootkey[16];

sc = device_get_softc(dev);

@@ -1285,9 +1287,19 @@ awg_get_eaddr(device_t dev, uint8_t *ead

if (maclo == 0x && machi == 0x) {
/* MAC address in hardware is invalid, create one */
-   rnd = arc4random();
-   maclo = 0x00f2 | (rnd & 0x);
-   machi = rnd & 0x;
+   if (aw_sid_get_rootkey(rootkey) == 0 &&
+   (rootkey[3] | rootkey[12] | rootkey[13] | rootkey[14] |
+rootkey[15]) != 0) {
+   /* MAC address is derived from the root key in SID */
+   maclo = (rootkey[13] << 24) | (rootkey[12] << 16) |
+   (rootkey[3] << 8) | 0x02;
+   machi = (rootkey[15] << 8) | rootkey[14];
+   } else {
+   /* Create one */
+   rnd = arc4random();
+   maclo = 0x00f2 | (rnd & 0x);
+   machi = rnd & 0x;
+   }
}

eaddr[0] = maclo & 0xff;
___
svn-src-h...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"





___
svn-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: r305354 - head/sys/arm/allwinner

2016-09-03 Thread Oliver Pinter
Hi!

On 9/3/16, Jared McNeill  wrote:
> Author: jmcneill
> Date: Sat Sep  3 15:28:09 2016
> New Revision: 305354
> URL: https://svnweb.freebsd.org/changeset/base/305354
>
> Log:
>   Use the root key in the Security ID EFUSE (when valid) to generate a
>   MAC address instead of creating a random one each boot.

Could you please describe a little more about this root key? What is
it? What's the main purpose? Is is a crypto root key?

>
> Modified:
>   head/sys/arm/allwinner/if_awg.c
>
> Modified: head/sys/arm/allwinner/if_awg.c
> ==
> --- head/sys/arm/allwinner/if_awg.c   Sat Sep  3 15:26:28 2016
> (r305353)
> +++ head/sys/arm/allwinner/if_awg.c   Sat Sep  3 15:28:09 2016
> (r305354)
> @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -1277,6 +1278,7 @@ awg_get_eaddr(device_t dev, uint8_t *ead
>  {
>   struct awg_softc *sc;
>   uint32_t maclo, machi, rnd;
> + u_char rootkey[16];
>
>   sc = device_get_softc(dev);
>
> @@ -1285,9 +1287,19 @@ awg_get_eaddr(device_t dev, uint8_t *ead
>
>   if (maclo == 0x && machi == 0x) {
>   /* MAC address in hardware is invalid, create one */
> - rnd = arc4random();
> - maclo = 0x00f2 | (rnd & 0x);
> - machi = rnd & 0x;
> + if (aw_sid_get_rootkey(rootkey) == 0 &&
> + (rootkey[3] | rootkey[12] | rootkey[13] | rootkey[14] |
> +  rootkey[15]) != 0) {
> + /* MAC address is derived from the root key in SID */
> + maclo = (rootkey[13] << 24) | (rootkey[12] << 16) |
> + (rootkey[3] << 8) | 0x02;
> + machi = (rootkey[15] << 8) | rootkey[14];
> + } else {
> + /* Create one */
> + rnd = arc4random();
> + maclo = 0x00f2 | (rnd & 0x);
> + machi = rnd & 0x;
> + }
>   }
>
>   eaddr[0] = maclo & 0xff;
> ___
> svn-src-h...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
>
___
svn-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: r305354 - head/sys/arm/allwinner

2016-09-03 Thread Jared McNeill
Author: jmcneill
Date: Sat Sep  3 15:28:09 2016
New Revision: 305354
URL: https://svnweb.freebsd.org/changeset/base/305354

Log:
  Use the root key in the Security ID EFUSE (when valid) to generate a
  MAC address instead of creating a random one each boot.

Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Sat Sep  3 15:26:28 2016
(r305353)
+++ head/sys/arm/allwinner/if_awg.c Sat Sep  3 15:28:09 2016
(r305354)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -1277,6 +1278,7 @@ awg_get_eaddr(device_t dev, uint8_t *ead
 {
struct awg_softc *sc;
uint32_t maclo, machi, rnd;
+   u_char rootkey[16];
 
sc = device_get_softc(dev);
 
@@ -1285,9 +1287,19 @@ awg_get_eaddr(device_t dev, uint8_t *ead
 
if (maclo == 0x && machi == 0x) {
/* MAC address in hardware is invalid, create one */
-   rnd = arc4random();
-   maclo = 0x00f2 | (rnd & 0x);
-   machi = rnd & 0x;
+   if (aw_sid_get_rootkey(rootkey) == 0 &&
+   (rootkey[3] | rootkey[12] | rootkey[13] | rootkey[14] |
+rootkey[15]) != 0) {
+   /* MAC address is derived from the root key in SID */
+   maclo = (rootkey[13] << 24) | (rootkey[12] << 16) |
+   (rootkey[3] << 8) | 0x02;
+   machi = (rootkey[15] << 8) | rootkey[14];
+   } else {
+   /* Create one */
+   rnd = arc4random();
+   maclo = 0x00f2 | (rnd & 0x);
+   machi = rnd & 0x;
+   }
}
 
eaddr[0] = maclo & 0xff;
___
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: r305353 - in head/sys/boot: i386 i386/boot0 i386/boot2 i386/btx/btx i386/btx/btxldr i386/cdboot i386/gptboot i386/gptzfsboot i386/mbr i386/pmbr i386/pxeldr i386/zfsboot pc98 pc98/boot0 ...

2016-09-03 Thread Warner Losh
Author: imp
Date: Sat Sep  3 15:26:28 2016
New Revision: 305353
URL: https://svnweb.freebsd.org/changeset/base/305353

Log:
  Don't use -N to set the OMAGIC with data and text writeable and data
  not page aligned. To do this, use the ld script gnu ld installs on my
  system.
  
  This is imperfect: LDFLAGS_BIN and LD_FLAGS_BIN describe different
  things. The loader script could be better named and take into account
  other architectures. And having two different mechanisms to do
  basically the same thing needs study. However, it's blocking forward
  progress on lld, so I'll work in parallel to sort these out.
  
  Differential Revision: https://reviews.freebsd.org/D7409
  Reviewed by: emaste

Added:
  head/sys/boot/i386/boot.ldscript   (contents, props changed)
Modified:
  head/sys/boot/i386/Makefile.inc
  head/sys/boot/i386/boot0/Makefile
  head/sys/boot/i386/boot2/Makefile
  head/sys/boot/i386/btx/btx/Makefile
  head/sys/boot/i386/btx/btxldr/Makefile
  head/sys/boot/i386/cdboot/Makefile
  head/sys/boot/i386/gptboot/Makefile
  head/sys/boot/i386/gptzfsboot/Makefile
  head/sys/boot/i386/mbr/Makefile
  head/sys/boot/i386/pmbr/Makefile
  head/sys/boot/i386/pxeldr/Makefile
  head/sys/boot/i386/zfsboot/Makefile
  head/sys/boot/pc98/Makefile.inc
  head/sys/boot/pc98/boot0/Makefile
  head/sys/boot/pc98/boot2/Makefile
  head/sys/boot/pc98/btx/btx/Makefile
  head/sys/boot/pc98/btx/btxldr/Makefile
  head/sys/boot/pc98/cdboot/Makefile

Modified: head/sys/boot/i386/Makefile.inc
==
--- head/sys/boot/i386/Makefile.inc Sat Sep  3 15:26:00 2016
(r305352)
+++ head/sys/boot/i386/Makefile.inc Sat Sep  3 15:26:28 2016
(r305353)
@@ -28,4 +28,9 @@ BTXLDR=   ${BTXDIR}/btxldr/btxldr
 BTXKERN=   ${BTXDIR}/btx/btx
 BTXCRT=${BTXDIR}/lib/crt0.o
 
+# compact binary with no padding between text, data, bss
+LDSCRIPT=  ${SRCTOP}/sys/boot/i386/boot.ldscript
+LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-T,${LDSCRIPT},-S,--oformat,binary
+LD_FLAGS_BIN=-static -T ${LDSCRIPT} --gc-sections
+
 .include "../Makefile.inc"

Added: head/sys/boot/i386/boot.ldscript
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/i386/boot.ldscriptSat Sep  3 15:26:28 2016
(r305353)
@@ -0,0 +1,11 @@
+/* $FreeBSD$ */
+/* Merge text, data and bss together almost no padding */
+OUTPUT_FORMAT("elf32-i386-freebsd")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+SECTIONS {
+  . = 0x08048000 + SIZEOF_HEADERS;
+  .text : { *(.text) } =0x90909090 /* Pad with nops, if needed */
+  .data : { *(.data) } _edata = .;
+  .bss  : { *(.bss) }  _end = .;
+}

Modified: head/sys/boot/i386/boot0/Makefile
==
--- head/sys/boot/i386/boot0/Makefile   Sat Sep  3 15:26:00 2016
(r305352)
+++ head/sys/boot/i386/boot0/Makefile   Sat Sep  3 15:26:28 2016
(r305353)
@@ -40,6 +40,7 @@ BOOT_BOOT0_TICKS?=0xb6
 # The base address that we the boot0 code to to run it.  Don't change this
 # unless you are glutton for punishment.
 BOOT_BOOT0_ORG?=   0x600
+ORG=${BOOT_BOOT0_ORG}
 
 # Comm settings for boot0sio.
 # Bit(s) Description
@@ -74,7 +75,7 @@ CFLAGS+=-DFLAGS=${BOOT_BOOT0_FLAGS} \
-DTICKS=${BOOT_BOOT0_TICKS} \
-DCOMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED}
 
-LDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N,-S,--oformat,binary
+LDFLAGS=${LDFLAGS_BIN}
 
 .include 
 

Modified: head/sys/boot/i386/boot2/Makefile
==
--- head/sys/boot/i386/boot2/Makefile   Sat Sep  3 15:26:00 2016
(r305352)
+++ head/sys/boot/i386/boot2/Makefile   Sat Sep  3 15:26:28 2016
(r305353)
@@ -48,7 +48,7 @@ CFLAGS.gcc+=   -mno-align-long-strings
 
 CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL}
 
-LD_FLAGS=-static -N --gc-sections
+LD_FLAGS=${LD_FLAGS_BIN}
 
 # Pick up ../Makefile.inc early.
 .include 

Modified: head/sys/boot/i386/btx/btx/Makefile
==
--- head/sys/boot/i386/btx/btx/Makefile Sat Sep  3 15:26:00 2016
(r305352)
+++ head/sys/boot/i386/btx/btx/Makefile Sat Sep  3 15:26:28 2016
(r305353)
@@ -25,7 +25,7 @@ CFLAGS+=-DBTX_SERIAL -DSIOPRT=${BOOT_COM
 
 ORG=   0x9000
 
-LDFLAGS=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary
+LDFLAGS=${LDFLAGS_BIN}
 
 .include 
 

Modified: head/sys/boot/i386/btx/btxldr/Makefile
==
--- head/sys/boot/i386/btx/btxldr/Makefile  Sat Sep  3 15:26:00 2016
(r305352)
+++ head/sys/boot/i386/btx/btxldr/Makefile  Sat Sep  3 15:26:28 2016
(r305353)
@@ -12,7 +12,8 @@ CFLAGS+=-I${.CURDIR}/../../common
 CFLAGS+=-DBTXLDR_VERBOSE
 .endif
 
-LDFLAGS=-e start -Ttext 

svn commit: r305352 - in head/sys: arm/allwinner arm/allwinner/clk arm64/conf conf

2016-09-03 Thread Jared McNeill
Author: jmcneill
Date: Sat Sep  3 15:26:00 2016
New Revision: 305352
URL: https://svnweb.freebsd.org/changeset/base/305352

Log:
  Add support for Allwinner A64 thermal sensors.

Added:
  head/sys/arm/allwinner/clk/aw_thsclk.c   (contents, props changed)
Modified:
  head/sys/arm/allwinner/aw_thermal.c
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm/allwinner/aw_thermal.c
==
--- head/sys/arm/allwinner/aw_thermal.c Sat Sep  3 15:24:30 2016
(r305351)
+++ head/sys/arm/allwinner/aw_thermal.c Sat Sep  3 15:26:00 2016
(r305352)
@@ -39,15 +39,21 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 
 #defineTHS_CTRL0   0x00
+#defineTHS_CTRL1   0x04
+#define ADC_CALI_EN(1 << 17)
 #defineTHS_CTRL2   0x40
 #define SENSOR_ACQ1_SHIFT  16
 #define SENSOR2_EN (1 << 2)
@@ -55,8 +61,16 @@ __FBSDID("$FreeBSD$");
 #define SENSOR0_EN (1 << 0)
 #defineTHS_INTC0x44
 #defineTHS_INTS0x48
+#define THS2_DATA_IRQ_STS  (1 << 10)
+#define THS1_DATA_IRQ_STS  (1 << 9)
+#define THS0_DATA_IRQ_STS  (1 << 8)
+#define SHUT_INT2_STS  (1 << 6)
+#define SHUT_INT1_STS  (1 << 5)
+#define SHUT_INT0_STS  (1 << 4)
+#define ALARM_INT2_STS (1 << 2)
+#define ALARM_INT1_STS (1 << 1)
+#define ALARM_INT0_STS (1 << 0)
 #defineTHS_FILTER  0x70
-#define FILTER_EN  (1 << 2)
 #defineTHS_CALIB0  0x74
 #defineTHS_CALIB1  0x78
 #defineTHS_DATA0   0x80
@@ -64,38 +78,93 @@ __FBSDID("$FreeBSD$");
 #defineTHS_DATA2   0x88
 #define DATA_MASK  0xfff
 
-#defineTEMP_BASE   2719
-#defineTEMP_MUL1000
-#defineTEMP_DIV14186
-#defineTEMP_TO_K   273
-#defineADC_ACQUIRE_TIME(24 - 1)
+#defineA83T_ADC_ACQUIRE_TIME   0x17
+#defineA83T_FILTER 0x4
+#defineA83T_INTC   0x1000
+#defineA83T_TEMP_BASE  2719000
+#defineA83T_TEMP_DIV   14186
+#defineA83T_CLK_RATE   2400
+
+#defineA64_ADC_ACQUIRE_TIME0x190
+#defineA64_FILTER  0x6
+#define A64_INTC   0x18000
+#defineA64_TEMP_BASE   217
+#defineA64_TEMP_DIV8560
+#defineA64_CLK_RATE400
+
+#defineTEMP_C_TO_K 273
 #defineSENSOR_ENABLE_ALL   (SENSOR0_EN|SENSOR1_EN|SENSOR2_EN)
+#defineSHUT_INT_ALL
(SHUT_INT0_STS|SHUT_INT1_STS|SHUT_INT2_STS)
 
-enum aw_thermal_sensor {
-   THS_SENSOR_CPU_CLUSTER0,
-   THS_SENSOR_CPU_CLUSTER1,
-   THS_SENSOR_GPU,
-   THS_SENSOR_END = -1
-};
+#defineMAX_SENSORS 3
 
-struct aw_thermal_sensor_config {
-   enum aw_thermal_sensor  sensor;
+struct aw_thermal_sensor {
const char  *name;
const char  *desc;
 };
 
-static const struct aw_thermal_sensor_config a83t_sensor_config[] = {
-   { .sensor = THS_SENSOR_CPU_CLUSTER0,
- .name = "cluster0",   .desc = "CPU cluster 0 temperature" },
-   { .sensor = THS_SENSOR_CPU_CLUSTER1,
- .name = "cluster1",   .desc = "CPU cluster 1 temperature" },
-   { .sensor = THS_SENSOR_GPU,
- .name = "gpu",.desc = "GPU temperature" },
-   { .sensor = THS_SENSOR_END }
+struct aw_thermal_config {
+   struct aw_thermal_sensorsensors[MAX_SENSORS];
+   int nsensors;
+   uint64_tclk_rate;
+   uint32_tadc_acquire_time;
+   uint32_tfilter;
+   uint32_tintc;
+   uint32_ttemp_base;
+   uint32_ttemp_div;
+};
+
+static const struct aw_thermal_config a83t_config = {
+   .nsensors = 3,
+   .sensors = {
+   [0] = {
+   .name = "cluster0",
+   .desc = "CPU cluster 0 temperature",
+   },
+   [1] = {
+   .name = "cluster1",
+   .desc = "CPU cluster 1 temperature",
+   },
+   [2] = {
+   .name = "gpu",
+   .desc = "GPU temperature",
+   },
+   },
+   .clk_rate = A83T_CLK_RATE,
+   .adc_acquire_time = A83T_ADC_ACQUIRE_TIME,
+   .filter = A83T_FILTER,
+  

svn commit: r305351 - head/sys/boot/fdt/dts/arm64

2016-09-03 Thread Jared McNeill
Author: jmcneill
Date: Sat Sep  3 15:24:30 2016
New Revision: 305351
URL: https://svnweb.freebsd.org/changeset/base/305351

Log:
  Add cpu-supply xref to cpu@0

Modified:
  head/sys/boot/fdt/dts/arm64/pine64_plus.dts

Modified: head/sys/boot/fdt/dts/arm64/pine64_plus.dts
==
--- head/sys/boot/fdt/dts/arm64/pine64_plus.dts Sat Sep  3 15:23:59 2016
(r305350)
+++ head/sys/boot/fdt/dts/arm64/pine64_plus.dts Sat Sep  3 15:24:30 2016
(r305351)
@@ -31,6 +31,14 @@
 
 #include 
 
+/ {
+   cpus {
+   cpu@0 {
+   cpu-supply = <_dcdc2>;
+   };
+   };
+};
+
  {
emac_phy_reset_pin_pine64_plus: emac_phy_reset_pin@0 {
allwinner,pins = "PD14";
@@ -64,6 +72,10 @@
reg_dc1dc: dc1sw {
regulator-name = "dc1sw";
};
+
+   reg_dcdc2: dcdc2 {
+   regulator-name = "dcdc2";
+   };
};
};
 };
___
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: r305350 - head/sys/boot/fdt/dts/arm64

2016-09-03 Thread Jared McNeill
Author: jmcneill
Date: Sat Sep  3 15:23:59 2016
New Revision: 305350
URL: https://svnweb.freebsd.org/changeset/base/305350

Log:
  Add SID, THS, and CPU operating points.

Modified:
  head/sys/boot/fdt/dts/arm64/a64.dtsi

Modified: head/sys/boot/fdt/dts/arm64/a64.dtsi
==
--- head/sys/boot/fdt/dts/arm64/a64.dtsiSat Sep  3 15:22:50 2016
(r305349)
+++ head/sys/boot/fdt/dts/arm64/a64.dtsiSat Sep  3 15:23:59 2016
(r305350)
@@ -27,6 +27,21 @@
  */
 
 / {
+   cpus {
+   cpu@0 {
+   clocks = <>;
+   clock-latency = <200>;
+   operating-points = <
+   /* kHzuV */
+   120 130
+   1008000 120
+   816000  110
+   648000  104
+   408000  104
+   >;
+   };
+   };
+
clocks {
pll_hsic: clk@01c20044 {
#clock-cells = <0>;
@@ -49,6 +64,14 @@
 "usb_hsic_pll", "usb_hsic_12m",
 "usb_otg_ohci", "usb_ohci0";
};
+
+   ths_clk: clk@01c20074 {
+   #clock-cells = <0>;
+   compatible = "allwinner,sun50i-a64-ths-clk";
+   reg = <0x01c20074 0x4>;
+   clocks = <>;
+   clock-output-names = "ths";
+   };
};
 
soc {
@@ -79,6 +102,21 @@
#size-cells = <0>;
};
 
+   sid: eeprom@01c14000 {
+   compatible = "allwinner,sun8i-a83t-sid";
+   reg = <0x01c14000 0x400>;
+   };
+
+   rtp: rtp@01c25000 {
+   compatible = "allwinner,sun50i-a64-ts";
+   reg = <0x01c25000 0x400>;
+   interrupts = ;
+   clocks = <_gates 72>, <_clk>;
+   clock-names = "ahb", "ths";
+   resets = <_rst 136>;
+   #thermal-sensor-cells = <0>;
+   };
+
usbphy: phy@01c19400 {
compatible = "allwinner,sun50i-a64-usb-phy";
reg = <0x01c19400 0x24 0x01c1a800 0x4 0x01c1b800 0x4>;
___
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: r305349 - head/sys/arm/allwinner

2016-09-03 Thread Jared McNeill
Author: jmcneill
Date: Sat Sep  3 15:22:50 2016
New Revision: 305349
URL: https://svnweb.freebsd.org/changeset/base/305349

Log:
  Add support for reading root key on A83T/A64.

Modified:
  head/sys/arm/allwinner/aw_sid.c

Modified: head/sys/arm/allwinner/aw_sid.c
==
--- head/sys/arm/allwinner/aw_sid.c Sat Sep  3 15:08:46 2016
(r305348)
+++ head/sys/arm/allwinner/aw_sid.c Sat Sep  3 15:22:50 2016
(r305349)
@@ -52,6 +52,11 @@ __FBSDID("$FreeBSD$");
 #defineSID_THERMAL_CALIB0  (SID_SRAM + 0x34)
 #defineSID_THERMAL_CALIB1  (SID_SRAM + 0x38)
 
+#defineA10_ROOT_KEY_OFF0x0
+#defineA83T_ROOT_KEY_OFF   SID_SRAM
+
+#defineROOT_KEY_SIZE   4
+
 enum sid_type {
A10_SID = 1,
A20_SID,
@@ -67,7 +72,8 @@ static struct ofw_compat_data compat_dat
 
 struct aw_sid_softc {
struct resource *res;
-   int type;
+   int type;
+   bus_size_t  root_key_off;
 };
 
 static struct aw_sid_softc *aw_sid_sc;
@@ -81,9 +87,6 @@ enum sid_keys {
AW_SID_ROOT_KEY,
 };
 
-#defineROOT_KEY_OFF0x0
-#defineROOT_KEY_SIZE   4
-
 #defineRD4(sc, reg)bus_read_4((sc)->res, (reg))
 #defineWR4(sc, reg, val)   bus_write_4((sc)->res, (reg), (val))
 
@@ -118,17 +121,20 @@ aw_sid_attach(device_t dev)
 
sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
switch (sc->type) {
-   case A10_SID:
-   case A20_SID:
-   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
-   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
-   OID_AUTO, "rootkey",
-   CTLTYPE_STRING | CTLFLAG_RD,
-   dev, AW_SID_ROOT_KEY, aw_sid_sysctl, "A", "Root Key");
+   case A83T_SID:
+   sc->root_key_off = A83T_ROOT_KEY_OFF;
break;
default:
+   sc->root_key_off = A10_ROOT_KEY_OFF;
break;
}
+
+   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+   OID_AUTO, "rootkey",
+   CTLTYPE_STRING | CTLFLAG_RD,
+   dev, AW_SID_ROOT_KEY, aw_sid_sysctl, "A", "Root Key");
+
return (0);
 }
 
@@ -159,11 +165,9 @@ aw_sid_get_rootkey(u_char *out)
sc = aw_sid_sc;
if (sc == NULL)
return (ENXIO);
-   if (sc->type != A10_SID && sc->type != A20_SID)
-   return (ENXIO);
 
for (i = 0; i < ROOT_KEY_SIZE ; i++) {
-   tmp = RD4(aw_sid_sc, ROOT_KEY_OFF + (i * 4));
+   tmp = RD4(aw_sid_sc, aw_sid_sc->root_key_off + (i * 4));
be32enc([i * 4], tmp);
}
 
___
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: r305347 - in vendor/unbound/dist: . cachedb compat daemon dns64 dnstap doc iterator libunbound libunbound/python pythonmod services services/cache sldns smallapp testcode testdata util ...

2016-09-03 Thread Dag-Erling Smørgrav
Author: des
Date: Sat Sep  3 15:08:13 2016
New Revision: 305347
URL: https://svnweb.freebsd.org/changeset/base/305347

Log:
  import unbound 1.5.9

Added:
  vendor/unbound/dist/cachedb/
  vendor/unbound/dist/cachedb/cachedb.c   (contents, props changed)
  vendor/unbound/dist/cachedb/cachedb.h   (contents, props changed)
  vendor/unbound/dist/compat/strsep.c   (contents, props changed)
  vendor/unbound/dist/testdata/val_deleg_nons.rpl
  vendor/unbound/dist/util/ub_event.c   (contents, props changed)
  vendor/unbound/dist/util/ub_event.h   (contents, props changed)
  vendor/unbound/dist/util/ub_event_pluggable.c   (contents, props changed)
Modified:
  vendor/unbound/dist/Makefile.in
  vendor/unbound/dist/acx_nlnetlabs.m4
  vendor/unbound/dist/compat/explicit_bzero.c
  vendor/unbound/dist/compat/getentropy_linux.c
  vendor/unbound/dist/config.h.in
  vendor/unbound/dist/configure
  vendor/unbound/dist/configure.ac
  vendor/unbound/dist/daemon/daemon.c
  vendor/unbound/dist/daemon/daemon.h
  vendor/unbound/dist/daemon/remote.c
  vendor/unbound/dist/daemon/unbound.c
  vendor/unbound/dist/daemon/worker.c
  vendor/unbound/dist/dns64/dns64.c
  vendor/unbound/dist/dnstap/dnstap.c
  vendor/unbound/dist/doc/Changelog
  vendor/unbound/dist/doc/README
  vendor/unbound/dist/doc/example.conf.in
  vendor/unbound/dist/doc/libunbound.3.in
  vendor/unbound/dist/doc/unbound-anchor.8.in
  vendor/unbound/dist/doc/unbound-checkconf.8.in
  vendor/unbound/dist/doc/unbound-control.8.in
  vendor/unbound/dist/doc/unbound-host.1.in
  vendor/unbound/dist/doc/unbound.8.in
  vendor/unbound/dist/doc/unbound.conf.5.in
  vendor/unbound/dist/iterator/iter_fwd.c
  vendor/unbound/dist/iterator/iter_utils.c
  vendor/unbound/dist/iterator/iter_utils.h
  vendor/unbound/dist/iterator/iterator.c
  vendor/unbound/dist/iterator/iterator.h
  vendor/unbound/dist/libunbound/context.h
  vendor/unbound/dist/libunbound/libunbound.c
  vendor/unbound/dist/libunbound/libworker.c
  vendor/unbound/dist/libunbound/libworker.h
  vendor/unbound/dist/libunbound/python/libunbound.i
  vendor/unbound/dist/libunbound/ubsyms.def
  vendor/unbound/dist/libunbound/unbound-event.h
  vendor/unbound/dist/libunbound/worker.h
  vendor/unbound/dist/pythonmod/pythonmod.c
  vendor/unbound/dist/pythonmod/pythonmod_utils.c
  vendor/unbound/dist/services/cache/dns.c
  vendor/unbound/dist/services/listen_dnsport.c
  vendor/unbound/dist/services/listen_dnsport.h
  vendor/unbound/dist/services/localzone.c
  vendor/unbound/dist/services/localzone.h
  vendor/unbound/dist/services/mesh.c
  vendor/unbound/dist/services/modstack.c
  vendor/unbound/dist/services/outside_network.c
  vendor/unbound/dist/services/outside_network.h
  vendor/unbound/dist/sldns/keyraw.c
  vendor/unbound/dist/sldns/parseutil.c
  vendor/unbound/dist/sldns/rrdef.h
  vendor/unbound/dist/sldns/str2wire.c
  vendor/unbound/dist/sldns/wire2str.c
  vendor/unbound/dist/smallapp/unbound-checkconf.c
  vendor/unbound/dist/smallapp/unbound-control.c
  vendor/unbound/dist/smallapp/worker_cb.c
  vendor/unbound/dist/testcode/fake_event.c
  vendor/unbound/dist/testcode/petal.c
  vendor/unbound/dist/testcode/unitmain.c
  vendor/unbound/dist/testcode/unitverify.c
  vendor/unbound/dist/util/config_file.c
  vendor/unbound/dist/util/config_file.h
  vendor/unbound/dist/util/configlexer.c
  vendor/unbound/dist/util/configlexer.lex
  vendor/unbound/dist/util/configparser.c
  vendor/unbound/dist/util/configparser.h
  vendor/unbound/dist/util/configparser.y
  vendor/unbound/dist/util/data/dname.c
  vendor/unbound/dist/util/data/msgencode.c
  vendor/unbound/dist/util/data/msgparse.c
  vendor/unbound/dist/util/data/msgparse.h
  vendor/unbound/dist/util/data/msgreply.c
  vendor/unbound/dist/util/data/msgreply.h
  vendor/unbound/dist/util/fptr_wlist.c
  vendor/unbound/dist/util/fptr_wlist.h
  vendor/unbound/dist/util/iana_ports.inc
  vendor/unbound/dist/util/module.h
  vendor/unbound/dist/util/net_help.c
  vendor/unbound/dist/util/netevent.c
  vendor/unbound/dist/util/netevent.h
  vendor/unbound/dist/util/tube.c
  vendor/unbound/dist/util/tube.h
  vendor/unbound/dist/validator/autotrust.c
  vendor/unbound/dist/validator/val_anchor.c
  vendor/unbound/dist/validator/val_secalgo.c
  vendor/unbound/dist/validator/val_secalgo.h
  vendor/unbound/dist/winrc/w_inst.c
  vendor/unbound/dist/winrc/win_svc.c

Modified: vendor/unbound/dist/Makefile.in
==
--- vendor/unbound/dist/Makefile.in Sat Sep  3 13:57:47 2016
(r305346)
+++ vendor/unbound/dist/Makefile.in Sat Sep  3 15:08:13 2016
(r305347)
@@ -108,11 +108,12 @@ util/fptr_wlist.c util/locks.c util/log.
 util/netevent.c util/net_help.c util/random.c util/rbtree.c util/regional.c \
 util/rtt.c util/storage/dnstree.c util/storage/lookup3.c \
 util/storage/lruhash.c util/storage/slabhash.c util/timehist.c util/tube.c \
-util/winsock_event.c validator/autotrust.c validator/val_anchor.c \
-validator/validator.c 

svn commit: r305348 - vendor/unbound/1.5.9

2016-09-03 Thread Dag-Erling Smørgrav
Author: des
Date: Sat Sep  3 15:08:46 2016
New Revision: 305348
URL: https://svnweb.freebsd.org/changeset/base/305348

Log:
  tag unbound 1.5.9

Added:
  vendor/unbound/1.5.9/
 - copied from r305347, vendor/unbound/dist/
___
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: r305345 - head/sys/dev/ppbus

2016-09-03 Thread Dimitry Andric
Author: dim
Date: Sat Sep  3 13:48:44 2016
New Revision: 305345
URL: https://svnweb.freebsd.org/changeset/base/305345

Log:
  With clang 3.9.0, compiling ppbus(4) results in the following warnings:
  
  sys/dev/ppbus/ppb_1284.c:296:46: error: implicit conversion from 'int'
  to 'char' changes value from 144 to -112 [-Werror,-Wconstant-conversion]
  if ((error = do_peripheral_wait(bus, SELECT | nBUSY, 0))) {
   ~~  ~~~^~~
  sys/dev/ppbus/ppb_1284.c:785:48: error: implicit conversion from 'int'
  to 'char' changes value from 240 to -16 [-Werror,-Wconstant-conversion]
  if (do_1284_wait(bus, nACK | SELECT | PERROR | nBUSY,
    ~~~^~~
  sys/dev/ppbus/ppb_1284.c:786:29: error: implicit conversion from 'int'
  to 'char' changes value from 240 to -16 [-Werror,-Wconstant-conversion]
  nACK | SELECT | PERROR | nBUSY)) {
  ~~~^~~
  
  This is because nBUSY is 0x80, so the plain char argument is wrapped to
  a negative value.  Fix this in a minimal fashion, by using uint8_t in a
  few places.
  
  Reviewed by:  emaste
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D7771

Modified:
  head/sys/dev/ppbus/ppb_1284.c
  head/sys/dev/ppbus/ppb_base.c
  head/sys/dev/ppbus/ppbconf.h

Modified: head/sys/dev/ppbus/ppb_1284.c
==
--- head/sys/dev/ppbus/ppb_1284.c   Sat Sep  3 13:33:28 2016
(r305344)
+++ head/sys/dev/ppbus/ppb_1284.c   Sat Sep  3 13:48:44 2016
(r305345)
@@ -57,13 +57,13 @@ __FBSDID("$FreeBSD$");
  * Wait for the peripherial up to 40ms
  */
 static int
-do_1284_wait(device_t bus, char mask, char status)
+do_1284_wait(device_t bus, uint8_t mask, uint8_t status)
 {
return (ppb_poll_bus(bus, 4, mask, status, PPB_NOINTR | PPB_POLL));
 }
 
 static int
-do_peripheral_wait(device_t bus, char mask, char status)
+do_peripheral_wait(device_t bus, uint8_t mask, uint8_t status)
 {
return (ppb_poll_bus(bus, 100, mask, status, PPB_NOINTR | PPB_POLL));
 }

Modified: head/sys/dev/ppbus/ppb_base.c
==
--- head/sys/dev/ppbus/ppb_base.c   Sat Sep  3 13:33:28 2016
(r305344)
+++ head/sys/dev/ppbus/ppb_base.c   Sat Sep  3 13:48:44 2016
(r305345)
@@ -54,11 +54,11 @@ MODULE_VERSION(ppbus, 1);
  */
 int
 ppb_poll_bus(device_t bus, int max,
-char mask, char status, int how)
+uint8_t mask, uint8_t status, int how)
 {
struct ppb_data *ppb = DEVTOSOFTC(bus);
int i, j, error;
-   char r;
+   uint8_t r;
 
ppb_assert_locked(bus);
 
@@ -186,7 +186,7 @@ ppb_ecp_sync(device_t bus)
 int
 ppb_get_status(device_t bus, struct ppb_status *status)
 {
-   register char r;
+   uint8_t r;
 
ppb_assert_locked(bus);
 

Modified: head/sys/dev/ppbus/ppbconf.h
==
--- head/sys/dev/ppbus/ppbconf.hSat Sep  3 13:33:28 2016
(r305344)
+++ head/sys/dev/ppbus/ppbconf.hSat Sep  3 13:48:44 2016
(r305345)
@@ -263,7 +263,7 @@ extern void _ppb_assert_locked(device_t,
 extern void ppb_init_callout(device_t, struct callout *, int);
 extern int ppb_sleep(device_t, void *, int, const char *, int);
 extern int ppb_get_status(device_t, struct ppb_status *);
-extern int ppb_poll_bus(device_t, int, char, char, int);
+extern int ppb_poll_bus(device_t, int, uint8_t, uint8_t, int);
 extern int ppb_reset_epp_timeout(device_t);
 extern int ppb_ecp_sync(device_t);
 extern int ppb_get_epp_protocol(device_t);
___
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: r305344 - head/sys/dev/drm2

2016-09-03 Thread Dimitry Andric
Author: dim
Date: Sat Sep  3 13:33:28 2016
New Revision: 305344
URL: https://svnweb.freebsd.org/changeset/base/305344

Log:
  Define drmP.h's __OS_HAS_AGP and __OS_HAS_MTRR macros in a defined and
  portable way.
  
  Reviewed by:  dumbbell
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D7770

Modified:
  head/sys/dev/drm2/drmP.h

Modified: head/sys/dev/drm2/drmP.h
==
--- head/sys/dev/drm2/drmP.hSat Sep  3 13:01:37 2016(r305343)
+++ head/sys/dev/drm2/drmP.hSat Sep  3 13:33:28 2016(r305344)
@@ -103,8 +103,16 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && 
defined(MODULE)))
-#define __OS_HAS_MTRR (defined(CONFIG_MTRR))
+#if defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))
+#define __OS_HAS_AGP 1
+#else
+#define __OS_HAS_AGP 0
+#endif
+#if defined(CONFIG_MTRR)
+#define __OS_HAS_MTRR 1
+#else
+#define __OS_HAS_MTRR 0
+#endif
 
 struct drm_file;
 struct drm_device;
___
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: r305343 - head/sys/boot/mips/uboot

2016-09-03 Thread Ed Maste
Author: emaste
Date: Sat Sep  3 13:01:37 2016
New Revision: 305343
URL: https://svnweb.freebsd.org/changeset/base/305343

Log:
  remove CONSTRUCTORS from MIPS uboot linker script
  
  The linker script CONSTRUCTORS keyword is only meaningful "when linking
  object file formats which do not support arbitrary sections, such as
  ECOFF and XCOFF"[1] and is ignored for other object file formats.
  
  LLVM's lld does not yet accept (and ignore) CONSTRUCTORS, so just remove
  CONSTRUCTORS from the linker script as it has no effect.
  
  [1] https://sourceware.org/binutils/docs/ld/Output-Section-Keywords.html

Modified:
  head/sys/boot/mips/uboot/ldscript.mips

Modified: head/sys/boot/mips/uboot/ldscript.mips
==
--- head/sys/boot/mips/uboot/ldscript.mips  Sat Sep  3 11:17:33 2016
(r305342)
+++ head/sys/boot/mips/uboot/ldscript.mips  Sat Sep  3 13:01:37 2016
(r305343)
@@ -55,7 +55,6 @@ SECTIONS
   {
 *(.data)
 *(.gnu.linkonce.d*)
-CONSTRUCTORS
   }
   .data1   : { *(.data1) }
   .got1   : { *(.got1) }
___
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: r305342 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 11:17:33 2016
New Revision: 305342
URL: https://svnweb.freebsd.org/changeset/base/305342

Log:
  Missed FreeBSD-specific piece of r305338.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Sat Sep 
 3 11:09:47 2016(r305341)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Sat Sep 
 3 11:17:33 2016(r305342)
@@ -1435,7 +1435,7 @@ zap_cursor_move_to_key(zap_cursor_t *zc,
 
if (zc->zc_zap == NULL) {
err = zap_lockdir(zc->zc_objset, zc->zc_zapobj, NULL,
-   RW_READER, TRUE, FALSE, >zc_zap);
+   RW_READER, TRUE, FALSE, FTAG, >zc_zap);
if (err)
return (err);
} 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: r305341 - in stable/10/lib/libc: amd64/sys arm/sys i386/sys ia64/sys include mips/sys powerpc/sys powerpc64/sys sparc64/sys sys

2016-09-03 Thread Konstantin Belousov
Author: kib
Date: Sat Sep  3 11:09:47 2016
New Revision: 305341
URL: https://svnweb.freebsd.org/changeset/base/305341

Log:
  MFC r304928:
  Do not obliterate errno value in the main thread during ptrace(2) call on x86.
  
  MFC r304931:
  Follow ABI when calling __error from the ptrace(2) wrapper.
  
  MFC r305012:
  Rewrite ptrace(2) wrappers in C.
  
  MFC r305022:
  Restore the requirement of setting errno to zero before calling ptrace(2).

Added:
  stable/10/lib/libc/sys/ptrace.c
 - copied unchanged from r305012, head/lib/libc/sys/ptrace.c
Deleted:
  stable/10/lib/libc/amd64/sys/ptrace.S
  stable/10/lib/libc/arm/sys/ptrace.S
  stable/10/lib/libc/i386/sys/ptrace.S
  stable/10/lib/libc/ia64/sys/ptrace.S
  stable/10/lib/libc/mips/sys/ptrace.S
  stable/10/lib/libc/powerpc/sys/ptrace.S
  stable/10/lib/libc/powerpc64/sys/ptrace.S
  stable/10/lib/libc/sparc64/sys/ptrace.S
Modified:
  stable/10/lib/libc/amd64/sys/Makefile.inc
  stable/10/lib/libc/arm/sys/Makefile.inc
  stable/10/lib/libc/i386/sys/Makefile.inc
  stable/10/lib/libc/ia64/sys/Makefile.inc
  stable/10/lib/libc/include/libc_private.h
  stable/10/lib/libc/mips/sys/Makefile.inc
  stable/10/lib/libc/powerpc/sys/Makefile.inc
  stable/10/lib/libc/powerpc64/sys/Makefile.inc
  stable/10/lib/libc/sparc64/sys/Makefile.inc
  stable/10/lib/libc/sys/Makefile.inc
  stable/10/lib/libc/sys/ptrace.2
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/amd64/sys/Makefile.inc
==
--- stable/10/lib/libc/amd64/sys/Makefile.inc   Sat Sep  3 11:00:29 2016
(r305340)
+++ stable/10/lib/libc/amd64/sys/Makefile.inc   Sat Sep  3 11:09:47 2016
(r305341)
@@ -4,7 +4,7 @@
 SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \
amd64_set_gsbase.c __vdso_gettc.c
 
-MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \
+MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S \
sbrk.S setlogin.S sigreturn.S
 
 # Don't generate default code for these syscalls:

Modified: stable/10/lib/libc/arm/sys/Makefile.inc
==
--- stable/10/lib/libc/arm/sys/Makefile.inc Sat Sep  3 11:00:29 2016
(r305340)
+++ stable/10/lib/libc/arm/sys/Makefile.inc Sat Sep  3 11:09:47 2016
(r305341)
@@ -2,7 +2,7 @@
 
 SRCS+= __vdso_gettc.c
 
-MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S 
syscall.S
+MDASM= Ovfork.S brk.S cerror.S pipe.S sbrk.S shmat.S sigreturn.S syscall.S
 
 # Don't generate default code for these syscalls:
 NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o

Modified: stable/10/lib/libc/i386/sys/Makefile.inc
==
--- stable/10/lib/libc/i386/sys/Makefile.incSat Sep  3 11:00:29 2016
(r305340)
+++ stable/10/lib/libc/i386/sys/Makefile.incSat Sep  3 11:09:47 2016
(r305341)
@@ -8,7 +8,7 @@ SRCS+=  i386_get_fsbase.c i386_get_gsbase
i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c \
__vdso_gettc.c
 
-MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \
+MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S \
sbrk.S setlogin.S sigreturn.S syscall.S
 
 # Don't generate default code for these syscalls:

Modified: stable/10/lib/libc/ia64/sys/Makefile.inc
==
--- stable/10/lib/libc/ia64/sys/Makefile.incSat Sep  3 11:00:29 2016
(r305340)
+++ stable/10/lib/libc/ia64/sys/Makefile.incSat Sep  3 11:09:47 2016
(r305341)
@@ -2,7 +2,7 @@
 
 SRCS+= __vdso_gettc.c
 
-MDASM+=Ovfork.S brk.S cerror.S exect.S fork.S getcontext.S pipe.S 
ptrace.S \
+MDASM+=Ovfork.S brk.S cerror.S exect.S fork.S getcontext.S pipe.S \
sbrk.S setlogin.S sigreturn.S swapcontext.S
 
 # Don't generate default code for these syscalls:

Modified: stable/10/lib/libc/include/libc_private.h
==
--- stable/10/lib/libc/include/libc_private.h   Sat Sep  3 11:00:29 2016
(r305340)
+++ stable/10/lib/libc/include/libc_private.h   Sat Sep  3 11:09:47 2016
(r305341)
@@ -339,6 +339,7 @@ int __sys_openat(int, const char *, int
 int__sys_pselect(int, struct fd_set *, struct fd_set *,
struct fd_set *, const struct timespec *,
const __sigset_t *);
+int__sys_ptrace(int, __pid_t, char *, int);
 int__sys_poll(struct pollfd *, unsigned, int);
 int__sys_ppoll(struct pollfd *, unsigned, const struct timespec *,
const __sigset_t *);

Modified: stable/10/lib/libc/mips/sys/Makefile.inc
==
--- 

svn commit: r305340 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 11:00:29 2016
New Revision: 305340
URL: https://svnweb.freebsd.org/changeset/base/305340

Log:
  MFC r305337: 7004 dmu_tx_hold_zap() does dnode_hold() 7x on same object
  
  Using a benchmark which has 32 threads creating 2 million files in the
  same directory, on a machine with 16 CPU cores, I observed poor
  performance. I noticed that dmu_tx_hold_zap() was using about 30% of
  all CPU, and doing dnode_hold() 7 times on the same object (the ZAP
  object that is being held).
  
  dmu_tx_hold_zap() keeps a hold on the dnode_t the entire time it is
  running, in dmu_tx_hold_t:txh_dnode, so it would be nice to use the
  dnode_t that we already have in hand, rather than repeatedly calling
  dnode_hold(). To do this, we need to pass the dnode_t down through
  all the intermediate calls that dmu_tx_hold_zap() makes, making these
  routines take the dnode_t* rather than an objset_t* and a uint64_t
  object number. In particular, the following routines will need to have
  analogous *_by_dnode() variants created:
  
  dmu_buf_hold_noread()
  dmu_buf_hold()
  zap_lookup()
  zap_lookup_norm()
  zap_count_write()
  zap_lockdir()
  zap_count_write()
  
  This can improve performance on the benchmark described above by 100%,
  from 30,000 file creations per second to 60,000. (This improvement is on
  top of that provided by working around the object allocation issue. Peak
  performance of ~90,000 creations per second was observed with 8 CPUs;
  adding CPUs past that decreased performance due to lock contention.) The
  CPU used by dmu_tx_hold_zap() was reduced by 88%, from 340 CPU-seconds
  to 40 CPU-seconds.
  
  Sponsored by: Intel Corp.
  
  Closes #109
  
  Reviewed by: Steve Gonczi 
  Reviewed by: George Wilson 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Ned Bass 
  Reviewed by: Brian Behlendorf 
  Author: Matthew Ahrens 
  
  openzfs/openzfs@d3e523d489a169ab36f9ec1b2a111a60a5563a9f

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Sat Sep  3 
10:59:05 2016(r305339)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Sat Sep  3 
11:00:29 2016(r305340)
@@ -2910,6 +2910,21 @@ dmu_buf_get_objset(dmu_buf_t *db)
return (dbi->db_objset);
 }
 
+dnode_t *
+dmu_buf_dnode_enter(dmu_buf_t *db)
+{
+   dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db;
+   DB_DNODE_ENTER(dbi);
+   return (DB_DNODE(dbi));
+}
+
+void
+dmu_buf_dnode_exit(dmu_buf_t *db)
+{
+   dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db;
+   DB_DNODE_EXIT(dbi);
+}
+
 static void
 dbuf_check_blkptr(dnode_t *dn, dmu_buf_impl_t *db)
 {

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Sat Sep  3 
10:59:05 2016(r305339)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Sat Sep  3 
11:00:29 2016(r305340)
@@ -131,6 +131,26 @@ const dmu_object_byteswap_info_t dmu_ot_
 };
 
 int
+dmu_buf_hold_noread_by_dnode(dnode_t *dn, uint64_t offset,
+void *tag, dmu_buf_t **dbp)
+{
+   uint64_t blkid;
+   dmu_buf_impl_t *db;
+
+   blkid = dbuf_whichblock(dn, 0, offset);
+   rw_enter(>dn_struct_rwlock, RW_READER);
+   db = dbuf_hold(dn, blkid, tag);
+   rw_exit(>dn_struct_rwlock);
+
+   if (db == NULL) {
+   *dbp = NULL;
+   return (SET_ERROR(EIO));
+   }
+
+   *dbp = >db;
+   return (0);
+}
+int
 dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset,
 void *tag, dmu_buf_t **dbp)
 {
@@ -158,6 +178,29 @@ dmu_buf_hold_noread(objset_t *os, uint64
 }
 
 int
+dmu_buf_hold_by_dnode(dnode_t *dn, uint64_t offset,
+void *tag, dmu_buf_t **dbp, int flags)
+{
+   int err;
+   int db_flags = DB_RF_CANFAIL;
+
+   if (flags & DMU_READ_NO_PREFETCH)
+   db_flags |= DB_RF_NOPREFETCH;
+
+   err = dmu_buf_hold_noread_by_dnode(dn, offset, tag, dbp);
+   if (err == 0) {
+   dmu_buf_impl_t *db = (dmu_buf_impl_t *)(*dbp);
+   

svn commit: r305339 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 10:59:05 2016
New Revision: 305339
URL: https://svnweb.freebsd.org/changeset/base/305339

Log:
  MFV r305336: 7247 zfs receive of deduplicated stream fails
  
  This resolves two 'zfs recv' issues. First, when receiving into an
  existing filesystem, a snapshot created during the receive process is
  not added to the guid->dataset map for the stream, resulting in failed
  lookups for deduped streams when a WRITE_BYREF record refers to a
  snapshot received earlier in the stream. Second, the newly created
  snapshot was also not set properly, referencing the snapshot before the
  new receiving dataset rather than the existing filesystem.
  
  Closes #159
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Dan Kimmel 
  Author: Chris Williamson 
  
  openzfs/openzfs@b09697c8c18be68abfe538de9809938239402ae8

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c  Sat Sep 
 3 10:58:14 2016(r305338)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c  Sat Sep 
 3 10:59:05 2016(r305339)
@@ -3113,6 +3113,9 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *t
dsl_dataset_phys(origin_head)->ds_flags &=
~DS_FLAG_INCONSISTENT;
 
+   drc->drc_newsnapobj =
+   dsl_dataset_phys(origin_head)->ds_prev_snap_obj;
+
dsl_dataset_rele(origin_head, FTAG);
dsl_destroy_head_sync_impl(drc->drc_ds, tx);
 
@@ -3148,8 +3151,9 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *t
(void) zap_remove(dp->dp_meta_objset, ds->ds_object,
DS_FIELD_RESUME_TONAME, tx);
}
+   drc->drc_newsnapobj =
+   dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj;
}
-   drc->drc_newsnapobj = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj;
/*
 * Release the hold from dmu_recv_begin.  This must be done before
 * we return to open context, so that when we free the dataset's dnode,
@@ -3191,8 +3195,6 @@ static int dmu_recv_end_modified_blocks 
 static int
 dmu_recv_existing_end(dmu_recv_cookie_t *drc)
 {
-   int error;
-
 #ifdef _KERNEL
/*
 * We will be destroying the ds; make sure its origin is unmounted if
@@ -3203,23 +3205,30 @@ dmu_recv_existing_end(dmu_recv_cookie_t 
zfs_destroy_unmount_origin(name);
 #endif
 
-   error = dsl_sync_task(drc->drc_tofs,
+   return (dsl_sync_task(drc->drc_tofs,
dmu_recv_end_check, dmu_recv_end_sync, drc,
-   dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL);
-
-   if (error != 0)
-   dmu_recv_cleanup_ds(drc);
-   return (error);
+   dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL));
 }
 
 static int
 dmu_recv_new_end(dmu_recv_cookie_t *drc)
 {
+   return (dsl_sync_task(drc->drc_tofs,
+   dmu_recv_end_check, dmu_recv_end_sync, drc,
+   dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL));
+}
+
+int
+dmu_recv_end(dmu_recv_cookie_t *drc, void *owner)
+{
int error;
 
-   error = dsl_sync_task(drc->drc_tofs,
-   dmu_recv_end_check, dmu_recv_end_sync, drc,
-   dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL);
+   drc->drc_owner = owner;
+
+   if (drc->drc_newfs)
+   error = dmu_recv_new_end(drc);
+   else
+   error = dmu_recv_existing_end(drc);
 
if (error != 0) {
dmu_recv_cleanup_ds(drc);
@@ -3231,17 +3240,6 @@ dmu_recv_new_end(dmu_recv_cookie_t *drc)
return (error);
 }
 
-int
-dmu_recv_end(dmu_recv_cookie_t *drc, void *owner)
-{
-   drc->drc_owner = owner;
-
-   if (drc->drc_newfs)
-   return (dmu_recv_new_end(drc));
-   else
-   return (dmu_recv_existing_end(drc));
-}
-
 /*
  * Return TRUE if this objset is currently being received into.
  */
___
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: r305338 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 10:58:14 2016
New Revision: 305338
URL: https://svnweb.freebsd.org/changeset/base/305338

Log:
  MFV r305335: 7003 zap_lockdir() should tag hold
  
  zap_lockdir() / zap_unlockdir() should take a "void *tag" argument which
  tags the hold on the zap. This will help diagnose programming errors
  which misuse the hold on the ZAP.
  
  Sponsored by: Intel Corp.
  
  Closes #108
  
  Reviewed by: Pavel Zakharov 
  Reviewed by: Steve Gonczi 
  Reviewed by: George Wilson 
  Reviewed by: Brian Behlendorf 
  Author: Matthew Ahrens 
  
  openzfs/openzfs@0780b3eab5a2c13e04328b39ecd2a6d0d3c4f7cb

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Sat Sep  3 
10:54:56 2016(r305337)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Sat Sep  3 
10:58:14 2016(r305338)
@@ -21,7 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
- * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
@@ -2903,6 +2903,13 @@ dmu_buf_get_blkptr(dmu_buf_t *db)
return (dbi->db_blkptr);
 }
 
+objset_t *
+dmu_buf_get_objset(dmu_buf_t *db)
+{
+   dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db;
+   return (dbi->db_objset);
+}
+
 static void
 dbuf_check_blkptr(dnode_t *dn, dmu_buf_impl_t *db)
 {

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h   Sat Sep 
 3 10:54:56 2016(r305337)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h   Sat Sep 
 3 10:58:14 2016(r305338)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright 2013 DEY Storage Systems, Inc.
@@ -617,6 +617,8 @@ void *dmu_buf_remove_user(dmu_buf_t *db,
  */
 void *dmu_buf_get_user(dmu_buf_t *db);
 
+objset_t *dmu_buf_get_objset(dmu_buf_t *db);
+
 /* Block until any in-progress dmu buf user evictions complete. */
 void dmu_buf_user_evict_wait(void);
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h  Sat Sep 
 3 10:54:56 2016(r305337)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h  Sat Sep 
 3 10:58:14 2016(r305338)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  */
@@ -197,8 +197,8 @@ typedef struct zap_name {
 
 boolean_t zap_match(zap_name_t *zn, const char *matchname);
 int zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx,
-krw_t lti, boolean_t fatreader, boolean_t adding, zap_t **zapp);
-void zap_unlockdir(zap_t *zap);
+krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp);
+void zap_unlockdir(zap_t *zap, void *tag);
 void zap_evict(void *dbu);
 zap_name_t *zap_name_alloc(zap_t *zap, const char *key, matchtype_t mt);
 void zap_name_free(zap_name_t *zn);
@@ -217,9 +217,10 @@ void fzap_prefetch(zap_name_t *zn);
 int fzap_count_write(zap_name_t *zn, int add, refcount_t *towrite,
 refcount_t *tooverwrite);
 int fzap_add(zap_name_t *zn, uint64_t integer_size, uint64_t num_integers,
-const void *val, dmu_tx_t *tx);
+const void *val, void *tag, dmu_tx_t *tx);
 int fzap_update(zap_name_t *zn,
-int integer_size, uint64_t 

svn commit: r305337 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 10:54:56 2016
New Revision: 305337
URL: https://svnweb.freebsd.org/changeset/base/305337

Log:
  7004 dmu_tx_hold_zap() does dnode_hold() 7x on same object
  
  Using a benchmark which has 32 threads creating 2 million files in the
  same directory, on a machine with 16 CPU cores, I observed poor
  performance. I noticed that dmu_tx_hold_zap() was using about 30% of
  all CPU, and doing dnode_hold() 7 times on the same object (the ZAP
  object that is being held).
  
  dmu_tx_hold_zap() keeps a hold on the dnode_t the entire time it is
  running, in dmu_tx_hold_t:txh_dnode, so it would be nice to use the
  dnode_t that we already have in hand, rather than repeatedly calling
  dnode_hold(). To do this, we need to pass the dnode_t down through
  all the intermediate calls that dmu_tx_hold_zap() makes, making these
  routines take the dnode_t* rather than an objset_t* and a uint64_t
  object number. In particular, the following routines will need to have
  analogous *_by_dnode() variants created:
  
  dmu_buf_hold_noread()
  dmu_buf_hold()
  zap_lookup()
  zap_lookup_norm()
  zap_count_write()
  zap_lockdir()
  zap_count_write()
  
  This can improve performance on the benchmark described above by 100%,
  from 30,000 file creations per second to 60,000. (This improvement is on
  top of that provided by working around the object allocation issue. Peak
  performance of ~90,000 creations per second was observed with 8 CPUs;
  adding CPUs past that decreased performance due to lock contention.) The
  CPU used by dmu_tx_hold_zap() was reduced by 88%, from 340 CPU-seconds
  to 40 CPU-seconds.
  
  Sponsored by: Intel Corp.
  
  Closes #109
  
  Reviewed by: Steve Gonczi 
  Reviewed by: George Wilson 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Ned Bass 
  Reviewed by: Brian Behlendorf 
  Author: Matthew Ahrens 
  
  openzfs/openzfs@d3e523d489a169ab36f9ec1b2a111a60a5563a9f

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cSat Sep  3 10:50:43 
2016(r305336)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cSat Sep  3 10:54:56 
2016(r305337)
@@ -2910,6 +2910,21 @@ dmu_buf_get_objset(dmu_buf_t *db)
return (dbi->db_objset);
 }
 
+dnode_t *
+dmu_buf_dnode_enter(dmu_buf_t *db)
+{
+   dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db;
+   DB_DNODE_ENTER(dbi);
+   return (DB_DNODE(dbi));
+}
+
+void
+dmu_buf_dnode_exit(dmu_buf_t *db)
+{
+   dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db;
+   DB_DNODE_EXIT(dbi);
+}
+
 static void
 dbuf_check_blkptr(dnode_t *dn, dmu_buf_impl_t *db)
 {

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Sat Sep  3 10:50:43 
2016(r305336)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Sat Sep  3 10:54:56 
2016(r305337)
@@ -127,6 +127,26 @@ const dmu_object_byteswap_info_t dmu_ot_
 };
 
 int
+dmu_buf_hold_noread_by_dnode(dnode_t *dn, uint64_t offset,
+void *tag, dmu_buf_t **dbp)
+{
+   uint64_t blkid;
+   dmu_buf_impl_t *db;
+
+   blkid = dbuf_whichblock(dn, 0, offset);
+   rw_enter(>dn_struct_rwlock, RW_READER);
+   db = dbuf_hold(dn, blkid, tag);
+   rw_exit(>dn_struct_rwlock);
+
+   if (db == NULL) {
+   *dbp = NULL;
+   return (SET_ERROR(EIO));
+   }
+
+   *dbp = >db;
+   return (0);
+}
+int
 dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset,
 void *tag, dmu_buf_t **dbp)
 {
@@ -154,6 +174,29 @@ dmu_buf_hold_noread(objset_t *os, uint64
 }
 
 int
+dmu_buf_hold_by_dnode(dnode_t *dn, uint64_t offset,
+void *tag, dmu_buf_t **dbp, int flags)
+{
+   int err;
+   int db_flags = DB_RF_CANFAIL;
+
+   if (flags & DMU_READ_NO_PREFETCH)
+   db_flags |= DB_RF_NOPREFETCH;
+
+   err = dmu_buf_hold_noread_by_dnode(dn, offset, tag, dbp);
+   if (err == 0) {
+   dmu_buf_impl_t *db = (dmu_buf_impl_t *)(*dbp);
+   err = dbuf_read(db, NULL, db_flags);
+   if (err != 0) {
+   dbuf_rele(db, tag);
+   *dbp = NULL;
+   }
+   }
+
+   return (err);
+}
+
+int
 

svn commit: r305336 - vendor-sys/illumos/dist/uts/common/fs/zfs

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 10:50:43 2016
New Revision: 305336
URL: https://svnweb.freebsd.org/changeset/base/305336

Log:
  7247 zfs receive of deduplicated stream fails
  
  This resolves two 'zfs recv' issues. First, when receiving into an
  existing filesystem, a snapshot created during the receive process is
  not added to the guid->dataset map for the stream, resulting in failed
  lookups for deduped streams when a WRITE_BYREF record refers to a
  snapshot received earlier in the stream. Second, the newly created
  snapshot was also not set properly, referencing the snapshot before the
  new receiving dataset rather than the existing filesystem.
  
  Closes #159
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Dan Kimmel 
  Author: Chris Williamson 
  
  openzfs/openzfs@b09697c8c18be68abfe538de9809938239402ae8

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.cSat Sep  3 
10:48:48 2016(r305335)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.cSat Sep  3 
10:50:43 2016(r305336)
@@ -3047,6 +3047,9 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *t
dsl_dataset_phys(origin_head)->ds_flags &=
~DS_FLAG_INCONSISTENT;
 
+   drc->drc_newsnapobj =
+   dsl_dataset_phys(origin_head)->ds_prev_snap_obj;
+
dsl_dataset_rele(origin_head, FTAG);
dsl_destroy_head_sync_impl(drc->drc_ds, tx);
 
@@ -3082,8 +3085,9 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *t
(void) zap_remove(dp->dp_meta_objset, ds->ds_object,
DS_FIELD_RESUME_TONAME, tx);
}
+   drc->drc_newsnapobj =
+   dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj;
}
-   drc->drc_newsnapobj = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj;
/*
 * Release the hold from dmu_recv_begin.  This must be done before
 * we return to open context, so that when we free the dataset's dnode,
@@ -3126,8 +3130,6 @@ static int dmu_recv_end_modified_blocks 
 static int
 dmu_recv_existing_end(dmu_recv_cookie_t *drc)
 {
-   int error;
-
 #ifdef _KERNEL
/*
 * We will be destroying the ds; make sure its origin is unmounted if
@@ -3138,23 +3140,30 @@ dmu_recv_existing_end(dmu_recv_cookie_t 
zfs_destroy_unmount_origin(name);
 #endif
 
-   error = dsl_sync_task(drc->drc_tofs,
+   return (dsl_sync_task(drc->drc_tofs,
dmu_recv_end_check, dmu_recv_end_sync, drc,
-   dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL);
-
-   if (error != 0)
-   dmu_recv_cleanup_ds(drc);
-   return (error);
+   dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL));
 }
 
 static int
 dmu_recv_new_end(dmu_recv_cookie_t *drc)
 {
+   return (dsl_sync_task(drc->drc_tofs,
+   dmu_recv_end_check, dmu_recv_end_sync, drc,
+   dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL));
+}
+
+int
+dmu_recv_end(dmu_recv_cookie_t *drc, void *owner)
+{
int error;
 
-   error = dsl_sync_task(drc->drc_tofs,
-   dmu_recv_end_check, dmu_recv_end_sync, drc,
-   dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL);
+   drc->drc_owner = owner;
+
+   if (drc->drc_newfs)
+   error = dmu_recv_new_end(drc);
+   else
+   error = dmu_recv_existing_end(drc);
 
if (error != 0) {
dmu_recv_cleanup_ds(drc);
@@ -3166,17 +3175,6 @@ dmu_recv_new_end(dmu_recv_cookie_t *drc)
return (error);
 }
 
-int
-dmu_recv_end(dmu_recv_cookie_t *drc, void *owner)
-{
-   drc->drc_owner = owner;
-
-   if (drc->drc_newfs)
-   return (dmu_recv_new_end(drc));
-   else
-   return (dmu_recv_existing_end(drc));
-}
-
 /*
  * Return TRUE if this objset is currently being received into.
  */
___
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: r305335 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 10:48:48 2016
New Revision: 305335
URL: https://svnweb.freebsd.org/changeset/base/305335

Log:
  7003 zap_lockdir() should tag hold
  
  zap_lockdir() / zap_unlockdir() should take a "void *tag" argument which
  tags the hold on the zap. This will help diagnose programming errors
  which misuse the hold on the ZAP.
  
  Sponsored by: Intel Corp.
  
  Closes #108
  
  Reviewed by: Pavel Zakharov 
  Reviewed by: Steve Gonczi 
  Reviewed by: George Wilson 
  Reviewed by: Brian Behlendorf 
  Author: Matthew Ahrens 
  
  openzfs/openzfs@0780b3eab5a2c13e04328b39ecd2a6d0d3c4f7cb

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap_impl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cSat Sep  3 10:10:58 
2016(r305334)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cSat Sep  3 10:48:48 
2016(r305335)
@@ -21,7 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
- * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
@@ -2903,6 +2903,13 @@ dmu_buf_get_blkptr(dmu_buf_t *db)
return (dbi->db_blkptr);
 }
 
+objset_t *
+dmu_buf_get_objset(dmu_buf_t *db)
+{
+   dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db;
+   return (dbi->db_objset);
+}
+
 static void
 dbuf_check_blkptr(dnode_t *dn, dmu_buf_impl_t *db)
 {

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Sat Sep  3 10:10:58 
2016(r305334)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Sat Sep  3 10:48:48 
2016(r305335)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright 2013 DEY Storage Systems, Inc.
@@ -615,6 +615,8 @@ void *dmu_buf_remove_user(dmu_buf_t *db,
  */
 void *dmu_buf_get_user(dmu_buf_t *db);
 
+objset_t *dmu_buf_get_objset(dmu_buf_t *db);
+
 /* Block until any in-progress dmu buf user evictions complete. */
 void dmu_buf_user_evict_wait(void);
 

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap_impl.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap_impl.hSat Sep  3 
10:10:58 2016(r305334)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap_impl.hSat Sep  3 
10:48:48 2016(r305335)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  */
@@ -197,8 +197,8 @@ typedef struct zap_name {
 
 boolean_t zap_match(zap_name_t *zn, const char *matchname);
 int zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx,
-krw_t lti, boolean_t fatreader, boolean_t adding, zap_t **zapp);
-void zap_unlockdir(zap_t *zap);
+krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp);
+void zap_unlockdir(zap_t *zap, void *tag);
 void zap_evict(void *dbu);
 zap_name_t *zap_name_alloc(zap_t *zap, const char *key, matchtype_t mt);
 void zap_name_free(zap_name_t *zn);
@@ -217,9 +217,10 @@ void fzap_prefetch(zap_name_t *zn);
 int fzap_count_write(zap_name_t *zn, int add, refcount_t *towrite,
 refcount_t *tooverwrite);
 int fzap_add(zap_name_t *zn, uint64_t integer_size, uint64_t num_integers,
-const void *val, dmu_tx_t *tx);
+const void *val, void *tag, dmu_tx_t *tx);
 int fzap_update(zap_name_t *zn,
-int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx);
+int integer_size, uint64_t num_integers, const void *val,
+void *tag, dmu_tx_t *tx);
 int fzap_length(zap_name_t *zn,
 uint64_t *integer_size, uint64_t *num_integers);
 int 

svn commit: r305334 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 10:10:58 2016
New Revision: 305334
URL: https://svnweb.freebsd.org/changeset/base/305334

Log:
  MFV r304157:
  7230 add assertions to dmu_send_impl() to verify that stream includes BEGIN 
and END records
  
  illumos/illumos-gate@12b90ee2d3b10689fc45f4930d2392f5fe1d9cfa
  
https://github.com/illumos/illumos-gate/commit/12b90ee2d3b10689fc45f4930d2392f5f
  e1d9cfa
  
  https://www.illumos.org/issues/7230
A test failure occurred where a send stream had only a BEGIN record. This
should not be possible if the send returns without error. Prevented this 
from
happening in the future by adding an assertion to dmu_send_impl() to verify
that if the function returns 0 (success) both a BEGIN and END record are
present. Did this by adding flags to dmu_sendarg_t (indicating whether 
BEGIN o
  r
END records sent), having dump_record() set flags appropriately, adding 
VERIFY
statement to dmu_send_impl().
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Igor Kozhukhov 
  Approved by: Robert Mustacchi 
  Author: Matt Krantz 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c  Sat Sep 
 3 10:09:23 2016(r305333)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c  Sat Sep 
 3 10:10:58 2016(r305334)
@@ -160,11 +160,16 @@ dump_record(dmu_sendarg_t *dsp, void *pa
fletcher_4_incremental_native(dsp->dsa_drr,
offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum),
>dsa_zc);
-   if (dsp->dsa_drr->drr_type != DRR_BEGIN) {
+   if (dsp->dsa_drr->drr_type == DRR_BEGIN) {
+   dsp->dsa_sent_begin = B_TRUE;
+   } else {
ASSERT(ZIO_CHECKSUM_IS_ZERO(>dsa_drr->drr_u.
drr_checksum.drr_checksum));
dsp->dsa_drr->drr_u.drr_checksum.drr_checksum = dsp->dsa_zc;
}
+   if (dsp->dsa_drr->drr_type == DRR_END) {
+   dsp->dsa_sent_end = B_TRUE;
+   }
fletcher_4_incremental_native(>dsa_drr->
drr_u.drr_checksum.drr_checksum,
sizeof (zio_cksum_t), >dsa_zc);
@@ -912,6 +917,8 @@ out:
list_remove(_ds->ds_sendstreams, dsp);
mutex_exit(_ds->ds_sendstream_lock);
 
+   VERIFY(err != 0 || (dsp->dsa_sent_begin && dsp->dsa_sent_end));
+
kmem_free(drr, sizeof (dmu_replay_record_t));
kmem_free(dsp, sizeof (dmu_sendarg_t));
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h  Sat Sep 
 3 10:09:23 2016(r305333)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h  Sat Sep 
 3 10:10:58 2016(r305334)
@@ -301,6 +301,8 @@ typedef struct dmu_sendarg {
uint64_t dsa_last_data_offset;
uint64_t dsa_resume_object;
uint64_t dsa_resume_offset;
+   boolean_t dsa_sent_begin;
+   boolean_t dsa_sent_end;
 } dmu_sendarg_t;
 
 void dmu_object_zapify(objset_t *, uint64_t, dmu_object_type_t, dmu_tx_t *);
___
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: r305333 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 10:09:23 2016
New Revision: 305333
URL: https://svnweb.freebsd.org/changeset/base/305333

Log:
  MFV r304156: 7235 remove unused func dsl_dataset_set_blkptr
  
  illumos/illumos-gate@bd56f80007857b960e0981ed0797ad8ec844a96b
  
https://github.com/illumos/illumos-gate/commit/bd56f80007857b960e0981ed0797ad8ec
  844a96b
  
  https://www.illumos.org/issues/7235
The function dsl_dataset_set_blkptr() is unused. We should remove it.
  
  Reviewed by: George Wilson 
  Reviewed by: Alex Reece 
  Reviewed by: Prakash Surya 
  Reviewed by: Igor Kozhukhov 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   Sat Sep 
 3 10:07:46 2016(r305332)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   Sat Sep 
 3 10:09:23 2016(r305333)
@@ -1060,19 +1060,6 @@ dsl_dataset_get_blkptr(dsl_dataset_t *ds
return (_dataset_phys(ds)->ds_bp);
 }
 
-void
-dsl_dataset_set_blkptr(dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx)
-{
-   ASSERT(dmu_tx_is_syncing(tx));
-   /* If it's the meta-objset, set dp_meta_rootbp */
-   if (ds == NULL) {
-   tx->tx_pool->dp_meta_rootbp = *bp;
-   } else {
-   dmu_buf_will_dirty(ds->ds_dbuf, tx);
-   dsl_dataset_phys(ds)->ds_bp = *bp;
-   }
-}
-
 spa_t *
 dsl_dataset_get_spa(dsl_dataset_t *ds)
 {

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h   
Sat Sep  3 10:07:46 2016(r305332)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h   
Sat Sep  3 10:09:23 2016(r305333)
@@ -272,7 +272,6 @@ int dsl_dataset_snapshot_tmp(const char 
 minor_t cleanup_minor, const char *htag);
 
 blkptr_t *dsl_dataset_get_blkptr(dsl_dataset_t *ds);
-void dsl_dataset_set_blkptr(dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx);
 
 spa_t *dsl_dataset_get_spa(dsl_dataset_t *ds);
 
___
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: r305332 - head/cddl/contrib/opensolaris/cmd/zdb

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 10:07:46 2016
New Revision: 305332
URL: https://svnweb.freebsd.org/changeset/base/305332

Log:
  MFV r304159: 7277 zdb should be able to print zfs_dbgmsg's
  
  illumos/illumos-gate@29bdd2f916366ece37c4748bca6b3d61f57a223b
  
https://github.com/illumos/illumos-gate/commit/29bdd2f916366ece37c4748bca6b3d61f
  57a223b
  
  https://www.illumos.org/issues/7277
ztest always prints the debug messages (zfs_dbgmsg()) by calling
zfs_dbgmsg_print(). We should add a flag to zdb to make it do this as well
before exiting.
  
  Reviewed by: George Wilson 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Pavel Zakharov 

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zdb/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Sep  3 10:04:37 2016
(r305331)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Sep  3 10:07:46 2016
(r305332)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  */
 
@@ -117,7 +117,7 @@ static void
 usage(void)
 {
(void) fprintf(stderr,
-   "Usage: %s [-CumMdibcsDvhLXFPA] [-t txg] [-e [-p path...]] "
+   "Usage: %s [-CumMdibcsDvhLXFPAG] [-t txg] [-e [-p path...]] "
"[-U config] [-I inflight I/Os] [-x dumpdir] poolname [object...]\n"
"   %s [-divPA] [-e -p path...] [-U config] dataset "
"[object...]\n"
@@ -178,12 +178,23 @@ usage(void)
(void) fprintf(stderr, "-I  -- "
"specify the maximum number of "
"checksumming I/Os [default is 200]\n");
+   (void) fprintf(stderr, "-G dump zfs_dbgmsg buffer before "
+   "exiting\n");
(void) fprintf(stderr, "Specify an option more than once (e.g. -bb) "
"to make only that option verbose\n");
(void) fprintf(stderr, "Default is to dump everything non-verbosely\n");
exit(1);
 }
 
+static void
+dump_debug_buffer()
+{
+   if (dump_opt['G']) {
+   (void) printf("\n");
+   zfs_dbgmsg_print("zdb");
+   }
+}
+
 /*
  * Called for usage errors that are discovered after a call to spa_open(),
  * dmu_bonus_hold(), or pool_match().  abort() is called for other errors.
@@ -200,6 +211,8 @@ fatal(const char *fmt, ...)
va_end(ap);
(void) fprintf(stderr, "\n");
 
+   dump_debug_buffer();
+
exit(1);
 }
 
@@ -3103,8 +3116,10 @@ dump_zpool(spa_t *spa)
if (dump_opt['h'])
dump_history(spa);
 
-   if (rc != 0)
+   if (rc != 0) {
+   dump_debug_buffer();
exit(rc);
+   }
 }
 
 #defineZDB_FLAG_CHECKSUM   0x0001
@@ -3575,7 +3590,7 @@ main(int argc, char **argv)
spa_config_path = spa_config_path_env;
 
while ((c = getopt(argc, argv,
-   "bcdhilmMI:suCDRSAFLXx:evp:t:U:P")) != -1) {
+   "bcdhilmMI:suCDRSAFLXx:evp:t:U:PG")) != -1) {
switch (c) {
case 'b':
case 'c':
@@ -3591,6 +3606,7 @@ main(int argc, char **argv)
case 'M':
case 'R':
case 'S':
+   case 'G':
dump_opt[c]++;
dump_all = 0;
break;
@@ -3826,6 +3842,8 @@ main(int argc, char **argv)
fuid_table_destroy();
sa_loaded = B_FALSE;
 
+   dump_debug_buffer();
+
libzfs_fini(g_zfs);
kernel_fini();
 
___
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: r305331 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 10:04:37 2016
New Revision: 305331
URL: https://svnweb.freebsd.org/changeset/base/305331

Log:
  MFV r304155: 7090 zfs should improve allocation order and throttle allocations
  
  illumos/illumos-gate@0f7643c7376dd69a08acbfc9d1d7d548b10c846a
  
https://github.com/illumos/illumos-gate/commit/0f7643c7376dd69a08acbfc9d1d7d548b
  10c846a
  
  https://www.illumos.org/issues/7090
When write I/Os are issued, they are issued in block order but the ZIO 
pipelin
  e
will drive them asynchronously through the allocation stage which can 
result i
  n
blocks being allocated out-of-order. It would be nice to preserve as much of
the logical order as possible.
In addition, the allocations are equally scattered across all top-level 
VDEVs
but not all top-level VDEVs are created equally. The pipeline should be 
able t
  o
detect devices that are more capable of handling allocations and should
allocate more blocks to those devices. This allows for dynamic allocation
distribution when devices are imbalanced as fuller devices will tend to be
slower than empty devices.
The change includes a new pool-wide allocation queue which would throttle 
and
order allocations in the ZIO pipeline. The queue would be ordered by issued
time and offset and would provide an initial amount of allocation of work to
each top-level vdev. The allocation logic utilizes a reservation system to
reserve allocations that will be performed by the allocator. Once an 
allocatio
  n
is successfully completed it's scheduled on a given top-level vdev. Each 
top-
level vdev maintains a maximum number of allocations that it can handle
(mg_alloc_queue_depth). The pool-wide reserved allocations (top-levels *
mg_alloc_queue_depth) are distributed across the top-level vdevs metaslab
groups and round robin across all eligible metaslab groups to distribute the
work. As top-levels complete their work, they receive additional work from 
the
pool-wide allocation queue until the allocation queue is emptied.
  
  Reviewed by: Adam Leventhal 
  Reviewed by: Alex Reece 
  Reviewed by: Christopher Siden 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Prakash Surya 
  Reviewed by: Sebastien Roy 
  Approved by: Robert Mustacchi 
  Author: George Wilson 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c  Sat Sep 
 3 09:24:33 2016(r305330)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c  Sat Sep 
 3 10:04:37 2016(r305331)
@@ -38,17 +38,8 @@
 SYSCTL_DECL(_vfs_zfs);
 SYSCTL_NODE(_vfs_zfs, OID_AUTO, metaslab, CTLFLAG_RW, 0, "ZFS metaslab");
 
-/*
- * Allow allocations to switch to gang blocks quickly. We do this to
- * avoid having to load lots of space_maps in a given txg. There are,
- * however, some cases where we want to avoid "fast" ganging and instead
- * we want to do an exhaustive search of all metaslabs on this device.
- * Currently we don't allow any gang, slog, or dump device related allocations
- * to "fast" gang.
- */
-#defineCAN_FASTGANG(flags) \
-   (!((flags) & (METASLAB_GANG_CHILD | METASLAB_GANG_HEADER | \
-   METASLAB_GANG_AVOID)))
+#defineGANG_ALLOCATION(flags) \
+   ((flags) & (METASLAB_GANG_CHILD | METASLAB_GANG_HEADER))
 
 #define

svn commit: r305330 - stable/11/lib/libc/aarch64/sys

2016-09-03 Thread Konstantin Belousov
Author: kib
Date: Sat Sep  3 09:24:33 2016
New Revision: 305330
URL: https://svnweb.freebsd.org/changeset/base/305330

Log:
  MFC r305015:
  Remove commented out mention of ptrace.S.

Modified:
  stable/11/lib/libc/aarch64/sys/Makefile.inc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/aarch64/sys/Makefile.inc
==
--- stable/11/lib/libc/aarch64/sys/Makefile.inc Sat Sep  3 09:03:40 2016
(r305329)
+++ stable/11/lib/libc/aarch64/sys/Makefile.inc Sat Sep  3 09:24:33 2016
(r305330)
@@ -4,7 +4,6 @@ MIASM:= ${MIASM:Nfreebsd[467]_*}
 
 SRCS+= __vdso_gettc.c
 
-#MDASM= ptrace.S
 MDASM= cerror.S \
shmat.S \
sigreturn.S \
___
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: r305329 - in stable/11/lib/libc: amd64/sys arm/sys i386/sys include mips/sys powerpc/sys powerpc64/sys sparc64/sys sys

2016-09-03 Thread Konstantin Belousov
Author: kib
Date: Sat Sep  3 09:03:40 2016
New Revision: 305329
URL: https://svnweb.freebsd.org/changeset/base/305329

Log:
  MFC r304928:
  Do not obliterate errno value in the main thread during ptrace(2) call on x86.
  
  MFC r304931:
  Follow ABI when calling __error from the ptrace(2) wrapper.
  
  MFC r305012:
  Rewrite ptrace(2) wrappers in C.
  
  MFC r305022:
  Restore the requirement of setting errno to zero before calling ptrace(2).

Added:
  stable/11/lib/libc/sys/ptrace.c
 - copied unchanged from r305012, head/lib/libc/sys/ptrace.c
Deleted:
  stable/11/lib/libc/amd64/sys/ptrace.S
  stable/11/lib/libc/arm/sys/ptrace.S
  stable/11/lib/libc/i386/sys/ptrace.S
  stable/11/lib/libc/mips/sys/ptrace.S
  stable/11/lib/libc/powerpc/sys/ptrace.S
  stable/11/lib/libc/powerpc64/sys/ptrace.S
  stable/11/lib/libc/sparc64/sys/ptrace.S
Modified:
  stable/11/lib/libc/amd64/sys/Makefile.inc
  stable/11/lib/libc/arm/sys/Makefile.inc
  stable/11/lib/libc/i386/sys/Makefile.inc
  stable/11/lib/libc/include/libc_private.h
  stable/11/lib/libc/mips/sys/Makefile.inc
  stable/11/lib/libc/powerpc/sys/Makefile.inc
  stable/11/lib/libc/powerpc64/sys/Makefile.inc
  stable/11/lib/libc/sparc64/sys/Makefile.inc
  stable/11/lib/libc/sys/Makefile.inc
  stable/11/lib/libc/sys/ptrace.2
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/amd64/sys/Makefile.inc
==
--- stable/11/lib/libc/amd64/sys/Makefile.inc   Sat Sep  3 08:48:51 2016
(r305328)
+++ stable/11/lib/libc/amd64/sys/Makefile.inc   Sat Sep  3 09:03:40 2016
(r305329)
@@ -4,7 +4,7 @@
 SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \
amd64_set_gsbase.c __vdso_gettc.c
 
-MDASM= vfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \
+MDASM= vfork.S brk.S cerror.S exect.S getcontext.S \
sbrk.S setlogin.S sigreturn.S
 
 # Don't generate default code for these syscalls:

Modified: stable/11/lib/libc/arm/sys/Makefile.inc
==
--- stable/11/lib/libc/arm/sys/Makefile.inc Sat Sep  3 08:48:51 2016
(r305328)
+++ stable/11/lib/libc/arm/sys/Makefile.inc Sat Sep  3 09:03:40 2016
(r305329)
@@ -2,7 +2,7 @@
 
 SRCS+= __vdso_gettc.c
 
-MDASM= Ovfork.S brk.S cerror.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S
+MDASM= Ovfork.S brk.S cerror.S sbrk.S shmat.S sigreturn.S syscall.S
 
 # Don't generate default code for these syscalls:
 NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o

Modified: stable/11/lib/libc/i386/sys/Makefile.inc
==
--- stable/11/lib/libc/i386/sys/Makefile.incSat Sep  3 08:48:51 2016
(r305328)
+++ stable/11/lib/libc/i386/sys/Makefile.incSat Sep  3 09:03:40 2016
(r305329)
@@ -8,7 +8,7 @@ SRCS+=  i386_get_fsbase.c i386_get_gsbase
i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c \
__vdso_gettc.c
 
-MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \
+MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S \
sbrk.S setlogin.S sigreturn.S syscall.S
 
 # Don't generate default code for these syscalls:

Modified: stable/11/lib/libc/include/libc_private.h
==
--- stable/11/lib/libc/include/libc_private.h   Sat Sep  3 08:48:51 2016
(r305328)
+++ stable/11/lib/libc/include/libc_private.h   Sat Sep  3 09:03:40 2016
(r305329)
@@ -335,6 +335,7 @@ int __sys_openat(int, const char *, int
 int__sys_pselect(int, struct fd_set *, struct fd_set *,
struct fd_set *, const struct timespec *,
const __sigset_t *);
+int__sys_ptrace(int, __pid_t, char *, int);
 int__sys_poll(struct pollfd *, unsigned, int);
 int__sys_ppoll(struct pollfd *, unsigned, const struct timespec *,
const __sigset_t *);

Modified: stable/11/lib/libc/mips/sys/Makefile.inc
==
--- stable/11/lib/libc/mips/sys/Makefile.incSat Sep  3 08:48:51 2016
(r305328)
+++ stable/11/lib/libc/mips/sys/Makefile.incSat Sep  3 09:03:40 2016
(r305329)
@@ -3,7 +3,7 @@
 SRCS+= trivial-vdso_tc.c
 
 MDASM=  Ovfork.S brk.S cerror.S exect.S \
-   ptrace.S sbrk.S syscall.S
+   sbrk.S syscall.S
 
 # Don't generate default code for these syscalls:
 NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o

Modified: stable/11/lib/libc/powerpc/sys/Makefile.inc
==
--- stable/11/lib/libc/powerpc/sys/Makefile.inc Sat Sep  3 08:48:51 2016
(r305328)
+++ stable/11/lib/libc/powerpc/sys/Makefile.inc Sat Sep  3 09:03:40 2016

svn commit: r305328 - head/cddl/contrib/opensolaris/cmd/ztest

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 08:48:51 2016
New Revision: 305328
URL: https://svnweb.freebsd.org/changeset/base/305328

Log:
  MFV r303081: 7163 ztest failures due to excess error injection
  
  illumos/illumos-gate@f34284d835bc555f987c1310df46c034c3101155
  
https://github.com/illumos/illumos-gate/commit/f34284d835bc555f987c1310df46c034c
  3101155
  
  https://www.illumos.org/issues/7163
Running zloop from zfs-precommit hit this assertion:
 *panicstr/s
0xfd7fd7419370: assertion failed for thread 0xfd7fe29ed240,
thread-id 577: parent != NULL, file ../../../uts/common/fs/zfs/dbuf.c, line
1827
 $c
libc.so.1`_lwp_kill+0xa()
libc.so.1`_assfail+0x182(fd7ffb1c29fa, fd7ffb1cc028, 723)
libc.so.1`assfail+0x19(fd7ffb1c29fa, fd7ffb1cc028, 723)
libzpool.so.1`dbuf_dirty+0xc69(10e3bc10, 3601700)
libzpool.so.1`dbuf_dirty+0x61e(10c73640, 3601700)
libzpool.so.1`dbuf_dirty+0x61e(10e28280, 3601700)
libzpool.so.1`dmu_buf_will_fill+0x64(10e28280, 3601700)
libzpool.so.1`dmu_write+0x1b6(2c7e640, d, 40002e00, 200, 3717b40,
3601700)
ztest_replay_write+0x568(4950d0, 3717a80, 0)
ztest_write+0x125(4950d0, d, 40002e00, 200, 413f000)
ztest_io+0x1bb(4950d0, d, 40002e00)
ztest_dmu_write_parallel+0xaa(4950d0, 6)
ztest_execute+0x83(1, 420c98, 6)
ztest_thread+0xf4(6)
libc.so.1`_thrp_setup+0x8a(fd7fe29ed240)
libc.so.1`_lwp_start()
This is another manifestation of ECKSUM in ztest:
The lowest level ancestor that’s in memory is the L8 (topmost). The L7
ancestor is blkid 0x10:
 ::dbufs -O 0x2c7e640 -o d -l 7 |::dbuf
addr object lvl blkid holds os
600be50 d 7 4 1 ztest/ds_6
719d880 d 7 0 4 ztest/ds_6
  
  Reviewed by: George Wilson 
  Reviewed by: Paul Dagnelie 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Sep  3 08:47:46 
2016(r305327)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Sep  3 08:48:51 
2016(r305328)
@@ -4793,7 +4793,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint6
char path0[MAXPATHLEN];
char pathrand[MAXPATHLEN];
size_t fsize;
-   int bshift = SPA_MAXBLOCKSHIFT + 2; /* don't scrog all labels */
+   int bshift = SPA_MAXBLOCKSHIFT + 2;
int iters = 1000;
int maxfaults;
int mirror_save;
@@ -4983,7 +4983,29 @@ ztest_fault_inject(ztest_ds_t *zd, uint6
(leaves << bshift) + (leaf << bshift) +
(ztest_random(1ULL << (bshift - 1)) & -8ULL);
 
-   if (offset >= fsize)
+   /*
+* Only allow damage to the labels at one end of the vdev.
+*
+* If all labels are damaged, the device will be totally
+* inaccessible, which will result in loss of data,
+* because we also damage (parts of) the other side of
+* the mirror/raidz.
+*
+* Additionally, we will always have both an even and an
+* odd label, so that we can handle crashes in the
+* middle of vdev_config_sync().
+*/
+   if ((leaf & 1) == 0 && offset < VDEV_LABEL_START_SIZE)
+   continue;
+
+   /*
+* The two end labels are stored at the "end" of the disk, but
+* the end of the disk (vdev_psize) is aligned to
+* sizeof (vdev_label_t).
+*/
+   uint64_t psize = P2ALIGN(fsize, sizeof (vdev_label_t));
+   if ((leaf & 1) == 1 &&
+   offset + sizeof (bad) > psize - VDEV_LABEL_END_SIZE)
continue;
 
VERIFY(mutex_lock(_vdev_lock) == 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: r305327 - head/cddl/contrib/opensolaris/cmd/ztest

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 08:47:46 2016
New Revision: 305327
URL: https://svnweb.freebsd.org/changeset/base/305327

Log:
  MFV r303080: 6451 ztest fails due to checksum errors
  
  illumos/illumos-gate@f9eb9fdf196b6ed476e4ffc69cecd8b0da3cb7e7
  
https://github.com/illumos/illumos-gate/commit/f9eb9fdf196b6ed476e4ffc69cecd8b0d
  a3cb7e7
  
  https://www.illumos.org/issues/6451
Sometimes ztest fails because zdb detects checksum errors. e.g.:
Traversing all blocks to verify checksums and verify nothing leaked ...
zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 8000160> DVA0=<0:1cc2000:
18> [L0 other uint64[]] sha256 uncompressed LE contiguou
s unique single size=10L/10P birth=271L/271P fill=1
cksum=c5a3e27d1ed0f894:843bca3a5473c4bf:f76a19b6830a2e4:91292591613a12bf --
skipping
zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 80180> DVA0=<0:ce16800:
18> [L0 other uint64[]] sha256 uncompressed LE contigu
ous unique single size=10L/10P birth=840L/840P fill=1
cksum=5d018f3d061e17f3:6d1584784587bf63:2805a74a0ce37369:ba68a214806c7e75
-- skipping
zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 100360> 
DVA0=<0:10d37400:
18> [L0 other uint64[]] sha256 uncompressed LE conti
guous unique single size=10L/10P birth=904L/904P fill=1
cksum=fa1e11d4138bd14b:86c9488c73e3:f31e43c72e72e46b:e3446472d1174d
ba -- skipping
zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 40002c0> 
DVA0=<0:127ef400:
18> [L0 other uint64[]] sha256 uncompressed LE cont
iguous dedup single size=10L/10P birth=549L/549P fill=1
cksum=30e14955ebf13522:66dc2ff8067e6810:4607e750abb9d3b3:6582b8af909fcb
58 -- skipping
zdb_blkptr_cb: Got error 50 reading <657, 5, 0, 1c0> 
DVA0=<0:1a180400:18>
[L0 other uint64[]] fletcher4 uncompressed LE contiguou
s unique single size=10L/10P birth=1091L/1091P fill=1 
cksum=a6cf1e50:
29b3bd01c57e5:36779b914035db9a:db61cdcf6bec56f0 -- skippin
g
The problem is that ztest_fault_inject() can inject multiple faults into the
same block. It is designed such that it can inject errors on all leafs of a
RAID-Z or mirror, but for a given range of offsets, it will only inject 
errors
  
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Jorgen Lundman 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

Modified:
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Sep  3 08:46:53 
2016(r305326)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Sep  3 08:47:46 
2016(r305327)
@@ -4793,7 +4793,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint6
char path0[MAXPATHLEN];
char pathrand[MAXPATHLEN];
size_t fsize;
-   int bshift = SPA_OLD_MAXBLOCKSHIFT + 2; /* don't scrog all labels */
+   int bshift = SPA_MAXBLOCKSHIFT + 2; /* don't scrog all labels */
int iters = 1000;
int maxfaults;
int mirror_save;
@@ -4954,6 +4954,31 @@ ztest_fault_inject(ztest_ds_t *zd, uint6
fsize = lseek(fd, 0, SEEK_END);
 
while (--iters != 0) {
+   /*
+* The offset must be chosen carefully to ensure that
+* we do not inject a given logical block with errors
+* on two different leaf devices, because ZFS can not
+* tolerate that (if maxfaults==1).
+*
+* We divide each leaf into chunks of size
+* (# leaves * SPA_MAXBLOCKSIZE * 4).  Within each chunk
+* there is a series of ranges to which we can inject errors.
+* Each range can accept errors on only a single leaf vdev.
+* The error injection ranges are separated by ranges
+* which we will not inject errors on any device (DMZs).
+* Each DMZ must be large enough such that a single block
+* can not straddle it, so that a single block can not be
+* a target in two different injection ranges (on different
+* leaf vdevs).
+*
+* For example, with 3 leaves, each chunk looks like:
+*0 to  32M: injection range for leaf 0
+*  32M to  64M: DMZ - no injection allowed
+*  64M to  96M: injection range for leaf 1
+*  96M to 128M: DMZ - no injection allowed
+* 128M to 160M: injection range for leaf 2
+* 160M to 192M: DMZ - no injection allowed
+*/
   

svn commit: r305326 - head/cddl/contrib/opensolaris/cmd/ztest

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 08:46:53 2016
New Revision: 305326
URL: https://svnweb.freebsd.org/changeset/base/305326

Log:
  MFV r303079:
  7147 ztest: ztest_ddt_repair fails with ztest_pattern_match assertion
  
  illumos/illumos-gate@aab80726335c76a7cae32c7300890248d73a51e3
  
https://github.com/illumos/illumos-gate/commit/aab80726335c76a7cae32c7300890248d
  73a51e3
  
  https://www.illumos.org/issues/7147
Here's the dbuf we're currently reading:
 966f200::dbuf
addr object lvl blkid holds os
966f200 4 0 0 1 ztest/ds_3
 966f200::print dmu_buf_t db_data
db_data = 0x9ae0400
 0x9ae0400/10J
0x9ae0400: c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d
c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d
c1c7ced932020d c1c7ced932020d
The pattern we're expecting is actually this: a34ae10b5f2db2. If we attempt 
to
read the block on disk we find that it has matches what ztest_ddt_repair()
would have written:
 ~c1c7ced932020d=J
ff3e383126cdfdf2
 966f200::print dmu_buf_impl_t db_blkptr | ::blkptr
DVA0=<0:71d3c00:800>
[L0 UINT64_OTHER] SHA256 OFF LE contiguous dedup single
size=400L/400P birth=55L/55P fill=1
cksum=18486450d3ce8c6d:75a72f4bbf117b0f:2d3a226314eb5650:2eb0fd68648b1af0
   1. zdb -U /rpool/tmp/zpool.cache -R ztest 0:71d3c00:800 | head
  Found vdev type: mirror
0:71d3c00:800
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>&18>.
10: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>&18>.
20: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>&18>.
30: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>&18>.
40: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>&18>.
50: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>&18>.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Prakash Surya 
  Approved by: Robert Mustacchi 
  Author: George Wilson 

Modified:
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Sep  3 08:43:43 
2016(r305325)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Sep  3 08:46:53 
2016(r305326)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2012 Martin Matuska .  All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
@@ -5022,9 +5022,14 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_
return;
}
 
+   dmu_objset_stats_t dds;
+   dsl_pool_config_enter(dmu_objset_pool(os), FTAG);
+   dmu_objset_fast_stat(os, );
+   dsl_pool_config_exit(dmu_objset_pool(os), FTAG);
+
object = od[0].od_object;
blocksize = od[0].od_blocksize;
-   pattern = zs->zs_guid ^ dmu_objset_fsid_guid(os);
+   pattern = zs->zs_guid ^ dds.dds_guid;
 
ASSERT(object != 0);
 
@@ -5627,9 +5632,13 @@ ztest_run(ztest_shared_t *zs)
metaslab_preload_limit = ztest_random(20) + 1;
ztest_spa = spa;
 
+   dmu_objset_stats_t dds;
VERIFY0(dmu_objset_own(ztest_opts.zo_pool,
DMU_OST_ANY, B_TRUE, FTAG, ));
-   zs->zs_guid = dmu_objset_fsid_guid(os);
+   dsl_pool_config_enter(dmu_objset_pool(os), FTAG);
+   dmu_objset_fast_stat(os, );
+   dsl_pool_config_exit(dmu_objset_pool(os), FTAG);
+   zs->zs_guid = dds.dds_guid;
dmu_objset_disown(os, FTAG);
 
spa->spa_dedup_ditto = 2 * ZIO_DEDUPDITTO_MIN;
___
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: r305308 - stable/11/sys/arm/ti

2016-09-03 Thread Konstantin Belousov
On Fri, Sep 02, 2016 at 10:04:20PM +, Oleksandr Tymoshenko wrote:
> Author: gonzo
> Date: Fri Sep  2 22:04:20 2016
> New Revision: 305308
> URL: https://svnweb.freebsd.org/changeset/base/305308
> 
> Log:
>   MFC r305039:
>   
>   Fix TI PRUSS driver panic with INVARIANTS enabled
>   
>   Value passed as islocked argument to knlist_add should
>   be consistent with actual lock state so add lock/unlock
>   calls around knlist_add
>   
>   PR: 212120
>   Submitted by:   Manuel Stuhn
> 
> Modified:
>   stable/11/sys/arm/ti/ti_pruss.c
> Directory Properties:
>   stable/11/   (props changed)
> 
> Modified: stable/11/sys/arm/ti/ti_pruss.c
> ==
> --- stable/11/sys/arm/ti/ti_pruss.c   Fri Sep  2 21:35:32 2016
> (r305307)
> +++ stable/11/sys/arm/ti/ti_pruss.c   Fri Sep  2 22:04:20 2016
> (r305308)
> @@ -310,7 +310,9 @@ ti_pruss_kqfilter(struct cdev *cdev, str
>   case EVFILT_READ:
>   kn->kn_hook = sc;
>   kn->kn_fop = _pruss_kq_read;
> + mtx_lock(>sc_mtx);
>   knlist_add(>sc_selinfo.si_note, kn, 1);
> + mtx_unlock(>sc_mtx);
>   break;
>   default:
>   return (EINVAL);
Wouldn't it be less code to just change the arg to indicate 'unlocked' ?
___
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: r305325 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 08:43:43 2016
New Revision: 305325
URL: https://svnweb.freebsd.org/changeset/base/305325

Log:
  MFV r303078:
  7086 ztest attempts dva_get_dsize_sync on an embedded blockpointer
  
  illumos/illumos-gate@926549256b71acd595f69b236779ff6b78fa08ef
  
https://github.com/illumos/illumos-gate/commit/926549256b71acd595f69b236779ff6b7
  8fa08ef
  
  https://www.illumos.org/issues/7086
In dbuf_dirty(), we need to grab the dn_struct_rwlock before looking at the
db_blkptr, to prevent it from being changed by syncing context.
Otherwise we may see that ztest got a segfault from this stack:
libzpool.so.1`dva_get_dsize_sync+0x98(872f000, b32b240, fed7811b, 0, 
b4cda20,
  0)
libzpool.so.1`bp_get_dsize+0x60(872f000, b32b240, 0, 97cb780, 9d4c1a8, 0)
libzpool.so.1`dbuf_dirty+0x9b3(ce0a100, 97cb780, 9, fecd2530)
libzpool.so.1`dmu_buf_will_dirty+0xc3(ce0a100, 97cb780, ea293d6c, 1)
libzpool.so.1`zap_lockdir+0x1a0(8aaa3c0, 1, 0, 97cb780, 1, 1)
libzpool.so.1`zap_remove_norm+0x30(8aaa3c0, 1, 0, 8728b10, 0, 97cb780)
libzpool.so.1`zap_remove+0x29(8aaa3c0, 1, 0, 8728b10, 97cb780, a)
ztest_replay_remove+0x225(ea294588, 8728ae8, 0, 3801, 0, 0)
ztest_remove+0x9f(ea294588, ea293f50, 4, 3)
ztest_object_init+0x78(ea294588, ea293f50, 4e0, 1)
ztest_dmu_object_alloc_free+0x71(ea294588, 13)
ztest_dmu_objset_create_destroy+0x224(80cef08, 13, 0, 805d36c, 9017ad44, 0)
ztest_execute+0x89(a, 807c720, 13, 0)
ztest_thread+0xea(13, 0, 0, 0)
libc.so.1`_thrp_setup+0x88(f0983240)
libc.so.1`_lwp_start(f0983240, 0, 0, 0, 0, 0)
Looking into it a bit, we see that this is an embedded blockpointer, so
BP_GET_NDVAS should have returned 0:
 b32b240::blkptr
EMBEDDED [L0 ZAP_OTHER] et=0 LZ4 size=200L/4aP birth=80L
Instead, it looks like another thread is modifying this blockpointer:
 b32b240::ugrep | ::whatis
f47a0e0c is in [ stack tid=0x19f ]
ebd6ec40 is in [ stack tid=0x226 ]
ea293bd0 is in [ stack tid=0x244 ]
ea293be4 is in [ stack tid=0x244 ]
  
  Reviewed by: Prakash Surya 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Sat Sep  3 
08:42:12 2016(r305324)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Sat Sep  3 
08:43:43 2016(r305325)
@@ -1662,7 +1662,20 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t 
dnode_setdirty(dn, tx);
DB_DNODE_EXIT(db);
return (dr);
-   } else if (do_free_accounting) {
+   }
+
+   /*
+* The dn_struct_rwlock prevents db_blkptr from changing
+* due to a write from syncing context completing
+* while we are running, so we want to acquire it before
+* looking at db_blkptr.
+*/
+   if (!RW_WRITE_HELD(>dn_struct_rwlock)) {
+   rw_enter(>dn_struct_rwlock, RW_READER);
+   drop_struct_lock = TRUE;
+   }
+
+   if (do_free_accounting) {
blkptr_t *bp = db->db_blkptr;
int64_t willfree = (bp && !BP_IS_HOLE(bp)) ?
bp_get_dsize(os->os_spa, bp) : db->db.db_size;
@@ -1678,11 +1691,6 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t 
dnode_willuse_space(dn, -willfree, tx);
}
 
-   if (!RW_WRITE_HELD(>dn_struct_rwlock)) {
-   rw_enter(>dn_struct_rwlock, RW_READER);
-   drop_struct_lock = TRUE;
-   }
-
if (db->db_level == 0) {
dnode_new_blkid(dn, db->db_blkid, tx, drop_struct_lock);
ASSERT(dn->dn_maxblkid >= db->db_blkid);
___
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: r305324 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 08:42:12 2016
New Revision: 305324
URL: https://svnweb.freebsd.org/changeset/base/305324

Log:
  MFV r303077:
  7072 zfs fails to expand if lun added when os is in shutdown state
  
  illumos/illumos-gate@c39a2aae1e2c439d156021edfc20910dad7f9891
  
https://github.com/illumos/illumos-gate/commit/c39a2aae1e2c439d156021edfc20910dad7f9891
  
  https://www.illumos.org/issues/7072
upstream:
38733 zfs fails to expand if lun added when os is in shutdown state
DLPX-36910 spares and caches should not display expandable space
DLPX-39262 vdev_disk_open spam zfs_dbgmsg buffer
  
  Reviewed by: Igor Kozhukhov 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Prakash Surya 
  Reviewed by: Alex Reece 
  Approved by: Dan McDonald 
  Author: George Wilson 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c  Sat Sep 
 3 08:30:51 2016(r305323)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c  Sat Sep 
 3 08:42:12 2016(r305324)
@@ -468,7 +468,13 @@ metaslab_class_expandable_space(metaslab
continue;
}
 
-   space += tvd->vdev_max_asize - tvd->vdev_asize;
+   /*
+* Calculate if we have enough space to add additional
+* metaslabs. We report the expandable space in terms
+* of the metaslab size since that's the unit of expansion.
+*/
+   space += P2ALIGN(tvd->vdev_max_asize - tvd->vdev_asize,
+   1ULL << tvd->vdev_ms_shift);
}
spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG);
return (space);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Sat Sep  3 
08:30:51 2016(r305323)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Sat Sep  3 
08:42:12 2016(r305324)
@@ -2885,6 +2885,7 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *
 {
spa_t *spa = vd->vdev_spa;
vdev_t *rvd = spa->spa_root_vdev;
+   vdev_t *tvd = vd->vdev_top;
 
ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0);
 
@@ -2895,8 +2896,15 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *
vs->vs_rsize = vdev_get_min_asize(vd);
if (vd->vdev_ops->vdev_op_leaf)
vs->vs_rsize += VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE;
-   if (vd->vdev_max_asize != 0)
-   vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize;
+   /*
+* Report expandable space on top-level, non-auxillary devices only.
+* The expandable space is reported in terms of metaslab sized units
+* since that determines how much space the pool can expand.
+*/
+   if (vd->vdev_aux == NULL && tvd != NULL && vd->vdev_max_asize != 0) {
+   vs->vs_esize = P2ALIGN(vd->vdev_max_asize - vd->vdev_asize,
+   1ULL << tvd->vdev_ms_shift);
+   }
vs->vs_configured_ashift = vd->vdev_top != NULL
? vd->vdev_top->vdev_ashift : vd->vdev_ashift;
vs->vs_logical_ashift = vd->vdev_logical_ashift;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Sat Sep 
 3 08:30:51 2016(r305323)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Sat Sep 
 3 08:42:12 2016(r305324)
@@ -241,34 +241,6 @@ vdev_disk_rele(vdev_t *vd)
}
 }
 
-static uint64_t
-vdev_disk_get_space(vdev_t *vd, uint64_t capacity, uint_t blksz)
-{
-   ASSERT(vd->vdev_wholedisk);
-
-   vdev_disk_t *dvd = vd->vdev_tsd;
-   dk_efi_t dk_ioc;
-   efi_gpt_t *efi;
-   uint64_t avail_space = 0;
-   int efisize = EFI_LABEL_SIZE * 2;
-
-   dk_ioc.dki_data = kmem_alloc(efisize, KM_SLEEP);
-   dk_ioc.dki_lba = 1;
-   dk_ioc.dki_length = efisize;
-   dk_ioc.dki_data_64 = (uint64_t)(uintptr_t)dk_ioc.dki_data;
-   efi = dk_ioc.dki_data;
-
-   if (ldi_ioctl(dvd->vd_lh, DKIOCGETEFI, (intptr_t)_ioc,
-   FKIOCTL, kcred, NULL) == 0) {
-   uint64_t efi_altern_lba = LE_64(efi->efi_gpt_AlternateLBA);

svn commit: r305323 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2016-09-03 Thread Alexander Motin
Author: mav
Date: Sat Sep  3 08:30:51 2016
New Revision: 305323
URL: https://svnweb.freebsd.org/changeset/base/305323

Log:
  MFV r302991: 6950 ARC should cache compressed data
  
  illumos/illumos-gate@dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2
  
https://github.com/illumos/illumos-gate/commit/dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2
  
  https://www.illumos.org/issues/6950
When reading compressed data from disk, the ARC should keep the compressed
block cached and only decompress it when consumers access the block. The
uncompressed data should be short-lived allowing the ARC to cache a much 
larger
amount of data. The DMU would also maintain a smaller cache of uncompressed
blocks to minimize the impact of decompressing frequently accessed blocks.
  
  Reviewed by: Prakash Surya 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matt Ahrens 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Don Brady 
  Reviewed by: Richard Elling 
  Approved by: Richard Lowe 
  Author: George Wilson 

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_checksum.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zdb/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Sep  3 04:53:12 2016
(r305322)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Sep  3 08:30:51 2016
(r305323)
@@ -1289,7 +1289,7 @@ visit_indirect(spa_t *spa, const dnode_p
}
if (!err)
ASSERT3U(fill, ==, BP_GET_FILL(bp));
-   (void) arc_buf_remove_ref(buf, );
+   arc_buf_destroy(buf, );
}
 
return (err);

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Sep  3 04:53:12 
2016(r305322)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Sep  3 08:30:51 
2016(r305323)
@@ -189,6 +189,7 @@ extern uint64_t metaslab_gang_bang;
 extern uint64_t metaslab_df_alloc_threshold;
 extern uint64_t zfs_deadman_synctime_ms;
 extern int metaslab_preload_limit;
+extern boolean_t zfs_compressed_arc_enabled;
 
 static ztest_shared_opts_t *ztest_shared_opts;
 static ztest_shared_opts_t ztest_opts;
@@ -5355,6 +5356,12 @@ ztest_resume_thread(void *arg)
if (spa_suspended(spa))
ztest_resume(spa);
(void) poll(NULL, 0, 100);
+
+   /*
+* Periodically change the zfs_compressed_arc_enabled setting.
+*/
+   if (ztest_random(10) == 0)
+   zfs_compressed_arc_enabled = ztest_random(2);
}
return (NULL);
 }

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Sat Sep  3 
04:53:12 2016(r305322)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Sat Sep  3 
08:30:51 2016(r305323)
@@ -120,9 +120,134 @@
  * - ARC header release, as it removes from L2ARC buflists
  */
 
+/*
+ * ARC operation:
+ *
+ * Every block